code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@Override
public int getDiskCacheHashcode(boolean debug, boolean includeValue) throws DynamicCacheException {
final String methodName = "getDiskCacheHashcode()";
if (this.swapToDisk) {
// TODO write code to support getDiskCacheHashcode function
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet");
}
} else {
if (this.featureSupport.isDiskCacheSupported() == false) {
Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName });
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled");
}
}
}
return 0;
} } | public class class_name {
@Override
public int getDiskCacheHashcode(boolean debug, boolean includeValue) throws DynamicCacheException {
final String methodName = "getDiskCacheHashcode()";
if (this.swapToDisk) {
// TODO write code to support getDiskCacheHashcode function
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it is not implemented yet"); // depends on control dependency: [if], data = [none]
}
} else {
if (this.featureSupport.isDiskCacheSupported() == false) {
Tr.error(tc, "DYNA1064E", new Object[] { methodName, cacheName, this.cacheProviderName }); // depends on control dependency: [if], data = [none]
} else {
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " no operation is done because the disk cache offload is not enabled"); // depends on control dependency: [if], data = [none]
}
}
}
return 0;
} } |
public class class_name {
private void createDirectory() {
int numTables = 9;
// Create the TrueType header
writeByte((byte)0);
writeByte((byte)1);
writeByte((byte)0);
writeByte((byte)0);
realSize += 4;
writeUShort(numTables);
realSize += 2;
// Create searchRange, entrySelector and rangeShift
int maxPow = maxPow2(numTables);
int searchRange = maxPow * 16;
writeUShort(searchRange);
realSize += 2;
writeUShort(maxPow);
realSize += 2;
writeUShort((numTables * 16) - searchRange);
realSize += 2;
// Create space for the table entries
writeString("cvt ");
cvtDirOffset = currentPos;
currentPos += 12;
realSize += 16;
if (hasFpgm()) {
writeString("fpgm");
fpgmDirOffset = currentPos;
currentPos += 12;
realSize += 16;
}
writeString("glyf");
glyfDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("head");
headDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("hhea");
hheaDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("hmtx");
hmtxDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("loca");
locaDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("maxp");
maxpDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("prep");
prepDirOffset = currentPos;
currentPos += 12;
realSize += 16;
} } | public class class_name {
private void createDirectory() {
int numTables = 9;
// Create the TrueType header
writeByte((byte)0);
writeByte((byte)1);
writeByte((byte)0);
writeByte((byte)0);
realSize += 4;
writeUShort(numTables);
realSize += 2;
// Create searchRange, entrySelector and rangeShift
int maxPow = maxPow2(numTables);
int searchRange = maxPow * 16;
writeUShort(searchRange);
realSize += 2;
writeUShort(maxPow);
realSize += 2;
writeUShort((numTables * 16) - searchRange);
realSize += 2;
// Create space for the table entries
writeString("cvt ");
cvtDirOffset = currentPos;
currentPos += 12;
realSize += 16;
if (hasFpgm()) {
writeString("fpgm"); // depends on control dependency: [if], data = [none]
fpgmDirOffset = currentPos; // depends on control dependency: [if], data = [none]
currentPos += 12; // depends on control dependency: [if], data = [none]
realSize += 16; // depends on control dependency: [if], data = [none]
}
writeString("glyf");
glyfDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("head");
headDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("hhea");
hheaDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("hmtx");
hmtxDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("loca");
locaDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("maxp");
maxpDirOffset = currentPos;
currentPos += 12;
realSize += 16;
writeString("prep");
prepDirOffset = currentPos;
currentPos += 12;
realSize += 16;
} } |
public class class_name {
public static String redecodeUriComponent(String input) {
if (input == null) {
return input;
}
return new String(
changeEncoding(input.getBytes(), ENCODING_UTF_8, OpenCms.getSystemInfo().getDefaultEncoding()));
} } | public class class_name {
public static String redecodeUriComponent(String input) {
if (input == null) {
return input; // depends on control dependency: [if], data = [none]
}
return new String(
changeEncoding(input.getBytes(), ENCODING_UTF_8, OpenCms.getSystemInfo().getDefaultEncoding()));
} } |
public class class_name {
private I_CmsFacetQueryItem parseFacetQueryItem(final String prefix) {
I_CmsXmlContentValue query = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_QUERY, m_locale);
if (null != query) {
String queryString = query.getStringValue(null);
I_CmsXmlContentValue label = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_LABEL, m_locale);
String labelString = null != label ? label.getStringValue(null) : null;
return new CmsFacetQueryItem(queryString, labelString);
} else {
return null;
}
} } | public class class_name {
private I_CmsFacetQueryItem parseFacetQueryItem(final String prefix) {
I_CmsXmlContentValue query = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_QUERY, m_locale);
if (null != query) {
String queryString = query.getStringValue(null);
I_CmsXmlContentValue label = m_xml.getValue(prefix + XML_ELEMENT_QUERY_FACET_QUERY_LABEL, m_locale);
String labelString = null != label ? label.getStringValue(null) : null;
return new CmsFacetQueryItem(queryString, labelString); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void addPush(long k) {
int ik = (int) k;
if (ik == k) {
addPush(ik);
add(ByteCode.I2L);
} else {
addLoadConstant(k);
}
} } | public class class_name {
public void addPush(long k) {
int ik = (int) k;
if (ik == k) {
addPush(ik); // depends on control dependency: [if], data = [(ik]
add(ByteCode.I2L); // depends on control dependency: [if], data = [none]
} else {
addLoadConstant(k); // depends on control dependency: [if], data = [k)]
}
} } |
public class class_name {
private Set<CmsUUID> getIdsOfPublishResourcesWhichAreBothNewAndDeleted(
List<CmsPublishedResource> publishedResources) {
Set<CmsUUID> result = new HashSet<CmsUUID>();
Set<CmsUUID> deletedSet = new HashSet<CmsUUID>();
for (CmsPublishedResource pubRes : publishedResources) {
if (pubRes.getState().isNew()) {
result.add(pubRes.getStructureId());
}
if (pubRes.getState().isDeleted()) {
deletedSet.add(pubRes.getStructureId());
}
}
result.retainAll(deletedSet);
return result;
} } | public class class_name {
private Set<CmsUUID> getIdsOfPublishResourcesWhichAreBothNewAndDeleted(
List<CmsPublishedResource> publishedResources) {
Set<CmsUUID> result = new HashSet<CmsUUID>();
Set<CmsUUID> deletedSet = new HashSet<CmsUUID>();
for (CmsPublishedResource pubRes : publishedResources) {
if (pubRes.getState().isNew()) {
result.add(pubRes.getStructureId()); // depends on control dependency: [if], data = [none]
}
if (pubRes.getState().isDeleted()) {
deletedSet.add(pubRes.getStructureId()); // depends on control dependency: [if], data = [none]
}
}
result.retainAll(deletedSet);
return result;
} } |
public class class_name {
public static boolean isScrolledIntoView (Widget target, int minPixels)
{
int wtop = Window.getScrollTop(), wheight = Window.getClientHeight();
int ttop = target.getAbsoluteTop();
if (ttop > wtop) {
return (wtop + wheight - ttop > minPixels);
} else {
return (ttop + target.getOffsetHeight() - wtop > minPixels);
}
} } | public class class_name {
public static boolean isScrolledIntoView (Widget target, int minPixels)
{
int wtop = Window.getScrollTop(), wheight = Window.getClientHeight();
int ttop = target.getAbsoluteTop();
if (ttop > wtop) {
return (wtop + wheight - ttop > minPixels); // depends on control dependency: [if], data = [none]
} else {
return (ttop + target.getOffsetHeight() - wtop > minPixels); // depends on control dependency: [if], data = [(ttop]
}
} } |
public class class_name {
protected static Type getTypeReference(Object type) {
if (type instanceof Type) {
return (Type) type;
} else if (type instanceof Class) {
return Type.getType((Class) type);
} else if (type instanceof String) {
String className = type.toString();
String internalName = getInternalName(className);
if (className.endsWith("[]")) {
internalName = "[L" + internalName + ";";
}
return Type.getObjectType(internalName);
} else {
throw new IllegalArgumentException("Type reference [" + type + "] should be a Class or a String representing the class name");
}
} } | public class class_name {
protected static Type getTypeReference(Object type) {
if (type instanceof Type) {
return (Type) type; // depends on control dependency: [if], data = [none]
} else if (type instanceof Class) {
return Type.getType((Class) type); // depends on control dependency: [if], data = [none]
} else if (type instanceof String) {
String className = type.toString();
String internalName = getInternalName(className);
if (className.endsWith("[]")) {
internalName = "[L" + internalName + ";"; // depends on control dependency: [if], data = [none]
}
return Type.getObjectType(internalName); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Type reference [" + type + "] should be a Class or a String representing the class name");
}
} } |
public class class_name {
protected String getDBCreationUrl()
{
JdbcConnectionDescriptor jcd = getConnection();
// currently I only know about specifics for mysql
if (TORQUE_PLATFORM_MYSQL.equals(getTargetTorquePlatform()))
{
// we have to remove the db name as the jdbc driver would try to connect to
// a non-existing db
// the db-alias has this form: [host&port]/[dbname]?[options]
String dbAliasPrefix = jcd.getDbAlias();
String dbAliasSuffix = "";
int questionPos = dbAliasPrefix.indexOf('?');
if (questionPos > 0)
{
dbAliasSuffix = dbAliasPrefix.substring(questionPos);
dbAliasPrefix = dbAliasPrefix.substring(0, questionPos);
}
int slashPos = dbAliasPrefix.lastIndexOf('/');
if (slashPos > 0)
{
// it is important that the slash at the end is present
dbAliasPrefix = dbAliasPrefix.substring(0, slashPos + 1);
}
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+dbAliasPrefix+dbAliasSuffix;
}
else if (TORQUE_PLATFORM_POSTGRESQL.equals(getTargetTorquePlatform()))
{
// we have to replace the db name with 'template1'
// the db-alias has this form: [host&port]/[dbname]?[options]
String dbAliasPrefix = jcd.getDbAlias();
String dbAliasSuffix = "";
int questionPos = dbAliasPrefix.indexOf('?');
if (questionPos > 0)
{
dbAliasSuffix = dbAliasPrefix.substring(questionPos);
dbAliasPrefix = dbAliasPrefix.substring(0, questionPos);
}
int slashPos = dbAliasPrefix.lastIndexOf('/');
if (slashPos > 0)
{
// it is important that the slash at the end is present
dbAliasPrefix = dbAliasPrefix.substring(0, slashPos + 1);
}
else
{
dbAliasPrefix += "/";
}
dbAliasPrefix += "template1";
if (dbAliasSuffix.length() > 0)
{
dbAliasPrefix += "/";
}
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+dbAliasPrefix+dbAliasSuffix;
}
else
{
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+jcd.getDbAlias();
}
} } | public class class_name {
protected String getDBCreationUrl()
{
JdbcConnectionDescriptor jcd = getConnection();
// currently I only know about specifics for mysql
if (TORQUE_PLATFORM_MYSQL.equals(getTargetTorquePlatform()))
{
// we have to remove the db name as the jdbc driver would try to connect to
// a non-existing db
// the db-alias has this form: [host&port]/[dbname]?[options]
String dbAliasPrefix = jcd.getDbAlias();
String dbAliasSuffix = "";
int questionPos = dbAliasPrefix.indexOf('?');
if (questionPos > 0)
{
dbAliasSuffix = dbAliasPrefix.substring(questionPos);
// depends on control dependency: [if], data = [(questionPos]
dbAliasPrefix = dbAliasPrefix.substring(0, questionPos);
// depends on control dependency: [if], data = [none]
}
int slashPos = dbAliasPrefix.lastIndexOf('/');
if (slashPos > 0)
{
// it is important that the slash at the end is present
dbAliasPrefix = dbAliasPrefix.substring(0, slashPos + 1);
// depends on control dependency: [if], data = [none]
}
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+dbAliasPrefix+dbAliasSuffix;
// depends on control dependency: [if], data = [none]
}
else if (TORQUE_PLATFORM_POSTGRESQL.equals(getTargetTorquePlatform()))
{
// we have to replace the db name with 'template1'
// the db-alias has this form: [host&port]/[dbname]?[options]
String dbAliasPrefix = jcd.getDbAlias();
String dbAliasSuffix = "";
int questionPos = dbAliasPrefix.indexOf('?');
if (questionPos > 0)
{
dbAliasSuffix = dbAliasPrefix.substring(questionPos);
// depends on control dependency: [if], data = [(questionPos]
dbAliasPrefix = dbAliasPrefix.substring(0, questionPos);
// depends on control dependency: [if], data = [none]
}
int slashPos = dbAliasPrefix.lastIndexOf('/');
if (slashPos > 0)
{
// it is important that the slash at the end is present
dbAliasPrefix = dbAliasPrefix.substring(0, slashPos + 1);
// depends on control dependency: [if], data = [none]
}
else
{
dbAliasPrefix += "/";
// depends on control dependency: [if], data = [none]
}
dbAliasPrefix += "template1";
// depends on control dependency: [if], data = [none]
if (dbAliasSuffix.length() > 0)
{
dbAliasPrefix += "/";
// depends on control dependency: [if], data = [none]
}
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+dbAliasPrefix+dbAliasSuffix;
// depends on control dependency: [if], data = [none]
}
else
{
return jcd.getProtocol()+":"+jcd.getSubProtocol()+":"+jcd.getDbAlias();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized void lockAndRegister(RuntimeObject rtObject, int lockMode, boolean cascade, List registeredObjects)
{
if(log.isDebugEnabled()) log.debug("Lock and register called for " + rtObject.getIdentity());
// if current object was already locked, do nothing
// avoid endless loops when circular object references are used
if(!registeredObjects.contains(rtObject.getIdentity()))
{
if(cascade)
{
// if implicite locking is enabled, first add the current object to
// list of registered objects to avoid endless loops on circular objects
registeredObjects.add(rtObject.getIdentity());
// lock and register 1:1 references first
//
// If implicit locking is used, we have materialize the main object
// to lock the referenced objects too
lockAndRegisterReferences(rtObject.getCld(), rtObject.getObjMaterialized(), lockMode, registeredObjects);
}
try
{
// perform the lock on the object
// we don't need to lock new objects
if(!rtObject.isNew())
{
doSingleLock(rtObject.getCld(), rtObject.getObj(), rtObject.getIdentity(), lockMode);
}
// after we locked the object, register it to detect status and changes while tx
doSingleRegister(rtObject, lockMode);
}
catch (Throwable t)
{
//log.error("Locking of obj " + rtObject.getIdentity() + " failed", t);
// if registering of object fails release lock on object, because later we don't
// get a change to do this.
implementation.getLockManager().releaseLock(this, rtObject.getIdentity(), rtObject.getObj());
if(t instanceof LockNotGrantedException)
{
throw (LockNotGrantedException) t;
}
else
{
log.error("Unexpected failure while locking", t);
throw new LockNotGrantedException("Locking failed for "
+ rtObject.getIdentity()+ ", nested exception is: [" + t.getClass().getName()
+ ": " + t.getMessage() + "]");
}
}
if(cascade)
{
// perform locks and register 1:n and m:n references
// If implicit locking is used, we have materialize the main object
// to lock the referenced objects too
lockAndRegisterCollections(rtObject.getCld(), rtObject.getObjMaterialized(), lockMode, registeredObjects);
}
}
} } | public class class_name {
public synchronized void lockAndRegister(RuntimeObject rtObject, int lockMode, boolean cascade, List registeredObjects)
{
if(log.isDebugEnabled()) log.debug("Lock and register called for " + rtObject.getIdentity());
// if current object was already locked, do nothing
// avoid endless loops when circular object references are used
if(!registeredObjects.contains(rtObject.getIdentity()))
{
if(cascade)
{
// if implicite locking is enabled, first add the current object to
// list of registered objects to avoid endless loops on circular objects
registeredObjects.add(rtObject.getIdentity());
// depends on control dependency: [if], data = [none]
// lock and register 1:1 references first
//
// If implicit locking is used, we have materialize the main object
// to lock the referenced objects too
lockAndRegisterReferences(rtObject.getCld(), rtObject.getObjMaterialized(), lockMode, registeredObjects);
// depends on control dependency: [if], data = [none]
}
try
{
// perform the lock on the object
// we don't need to lock new objects
if(!rtObject.isNew())
{
doSingleLock(rtObject.getCld(), rtObject.getObj(), rtObject.getIdentity(), lockMode);
// depends on control dependency: [if], data = [none]
}
// after we locked the object, register it to detect status and changes while tx
doSingleRegister(rtObject, lockMode);
}
catch (Throwable t)
{
//log.error("Locking of obj " + rtObject.getIdentity() + " failed", t);
// if registering of object fails release lock on object, because later we don't
// get a change to do this.
implementation.getLockManager().releaseLock(this, rtObject.getIdentity(), rtObject.getObj());
if(t instanceof LockNotGrantedException)
{
throw (LockNotGrantedException) t;
}
else
{
log.error("Unexpected failure while locking", t);
throw new LockNotGrantedException("Locking failed for "
+ rtObject.getIdentity()+ ", nested exception is: [" + t.getClass().getName()
+ ": " + t.getMessage() + "]");
}
}
if(cascade)
{
// perform locks and register 1:n and m:n references
// If implicit locking is used, we have materialize the main object
// to lock the referenced objects too
lockAndRegisterCollections(rtObject.getCld(), rtObject.getObjMaterialized(), lockMode, registeredObjects);
}
}
} } |
public class class_name {
private static float pointToPolygonDist(double x, double y, Polygon polygon) {
boolean inside = false;
double minDistSq = Double.POSITIVE_INFINITY;
// External ring
LineString exterior = polygon.getExteriorRing();
for (int i = 0, n = exterior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) {
Coordinate a = exterior.getCoordinateN(i);
Coordinate b = exterior.getCoordinateN(j);
if (((a.y > y) ^ (b.y > y)) &&
(x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x))
inside = !inside;
double seqDistSq = getSegDistSq(x, y, a, b);
minDistSq = Math.min(minDistSq, seqDistSq);
}
// Internal rings
for (int k = 0; k < polygon.getNumInteriorRing(); k++) {
LineString interior = polygon.getInteriorRingN(k);
for (int i = 0, n = interior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) {
Coordinate a = interior.getCoordinateN(i);
Coordinate b = interior.getCoordinateN(j);
if (((a.y > y) ^ (b.y > y)) &&
(x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x))
inside = !inside;
minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b));
}
}
return (float) ((inside ? 1 : -1) * Math.sqrt(minDistSq));
} } | public class class_name {
private static float pointToPolygonDist(double x, double y, Polygon polygon) {
boolean inside = false;
double minDistSq = Double.POSITIVE_INFINITY;
// External ring
LineString exterior = polygon.getExteriorRing();
for (int i = 0, n = exterior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) {
Coordinate a = exterior.getCoordinateN(i);
Coordinate b = exterior.getCoordinateN(j);
if (((a.y > y) ^ (b.y > y)) &&
(x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x))
inside = !inside;
double seqDistSq = getSegDistSq(x, y, a, b);
minDistSq = Math.min(minDistSq, seqDistSq); // depends on control dependency: [for], data = [none]
}
// Internal rings
for (int k = 0; k < polygon.getNumInteriorRing(); k++) {
LineString interior = polygon.getInteriorRingN(k);
for (int i = 0, n = interior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) {
Coordinate a = interior.getCoordinateN(i);
Coordinate b = interior.getCoordinateN(j);
if (((a.y > y) ^ (b.y > y)) &&
(x < (b.x - a.x) * (y - a.y) / (b.y - a.y) + a.x))
inside = !inside;
minDistSq = Math.min(minDistSq, getSegDistSq(x, y, a, b)); // depends on control dependency: [for], data = [none]
}
}
return (float) ((inside ? 1 : -1) * Math.sqrt(minDistSq));
} } |
public class class_name {
@SuppressWarnings("unchecked")
private final Shape<?> doCheckEnterExitShape(final INodeXYEvent event)
{
final int x = event.getX();
final int y = event.getY();
final Shape<?> shape = findShapeAtPoint(x, y);
if (shape != null)
{
final IPrimitive<?> prim = shape.asPrimitive();
if (null != m_over_prim)
{
if (prim != m_over_prim)
{
if (m_over_prim.isEventHandled(NodeMouseExitEvent.getType()))
{
if (event instanceof AbstractNodeHumanInputEvent)
{
m_over_prim.fireEvent(new NodeMouseExitEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y));
}
else
{
m_over_prim.fireEvent(new NodeMouseExitEvent(null, x, y));
}
}
}
}
if (prim != m_over_prim)
{
if ((null != prim) && (prim.isEventHandled(NodeMouseEnterEvent.getType())))
{
if (event instanceof AbstractNodeHumanInputEvent)
{
prim.fireEvent(new NodeMouseEnterEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y));
}
else
{
prim.fireEvent(new NodeMouseEnterEvent(null, x, y));
}
}
m_over_prim = prim;
}
}
else
{
doCancelEnterExitShape(event);
}
return shape;
} } | public class class_name {
@SuppressWarnings("unchecked")
private final Shape<?> doCheckEnterExitShape(final INodeXYEvent event)
{
final int x = event.getX();
final int y = event.getY();
final Shape<?> shape = findShapeAtPoint(x, y);
if (shape != null)
{
final IPrimitive<?> prim = shape.asPrimitive();
if (null != m_over_prim)
{
if (prim != m_over_prim)
{
if (m_over_prim.isEventHandled(NodeMouseExitEvent.getType()))
{
if (event instanceof AbstractNodeHumanInputEvent)
{
m_over_prim.fireEvent(new NodeMouseExitEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y)); // depends on control dependency: [if], data = [none]
}
else
{
m_over_prim.fireEvent(new NodeMouseExitEvent(null, x, y)); // depends on control dependency: [if], data = [none]
}
}
}
}
if (prim != m_over_prim)
{
if ((null != prim) && (prim.isEventHandled(NodeMouseEnterEvent.getType())))
{
if (event instanceof AbstractNodeHumanInputEvent)
{
prim.fireEvent(new NodeMouseEnterEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y)); // depends on control dependency: [if], data = [none]
}
else
{
prim.fireEvent(new NodeMouseEnterEvent(null, x, y)); // depends on control dependency: [if], data = [none]
}
}
m_over_prim = prim; // depends on control dependency: [if], data = [none]
}
}
else
{
doCancelEnterExitShape(event); // depends on control dependency: [if], data = [none]
}
return shape;
} } |
public class class_name {
static String getLogHeader(Map<String, String> config) {
StringBuilder builder = new StringBuilder(512);
String productInfo = config.get("websphere.product.info");
if (productInfo != null) {
builder.append("product = ").append(productInfo).append(LoggingConstants.nl);
}
String installDir = config.get("wlp.install.dir");
if (installDir != null) {
builder.append("wlp.install.dir = ").append(installDir).append(LoggingConstants.nl);
}
String serverConfigDir = config.get("server.config.dir");
if (serverConfigDir != null && !"true".equals(config.get("wlp.user.dir.isDefault"))) {
builder.append("server.config.dir = ").append(serverConfigDir).append(LoggingConstants.nl);
}
String serverOutputDir = config.get("server.output.dir");
if (serverOutputDir != null && !serverOutputDir.equals(serverConfigDir)) {
builder.append("server.output.dir = ").append(serverOutputDir).append(LoggingConstants.nl);
}
builder.append("java.home = ").append(System.getProperty("java.home")).append(LoggingConstants.nl);
builder.append("java.version = ").append(System.getProperty("java.version")).append(LoggingConstants.nl);
builder.append("java.runtime = ").append(System.getProperty("java.runtime.name")).append(" (").append(System.getProperty("java.runtime.version")).append(')').append(LoggingConstants.nl);
builder.append("os = ").append(System.getProperty("os.name")).append(" (").append(System.getProperty("os.version")).append("; ").append(System.getProperty("os.arch")).append(") (").append(Locale.getDefault()).append(")").append(LoggingConstants.nl);
// avoid the initialization overhead retrieving the RuntimeMXBean. Not guaranteed to work on all platforms, so fallback as appropriate
builder.append("process = ");
String pid = System.getProperty("sun.java.launcher.pid");
if (pid != null) {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
builder.append(pid).append('@').append(ip);
} catch (Exception e) {
pid = null;
}
}
if (pid == null) {
builder.append(ManagementFactory.getRuntimeMXBean().getName());
}
builder.append(LoggingConstants.nl);
return builder.toString();
} } | public class class_name {
static String getLogHeader(Map<String, String> config) {
StringBuilder builder = new StringBuilder(512);
String productInfo = config.get("websphere.product.info");
if (productInfo != null) {
builder.append("product = ").append(productInfo).append(LoggingConstants.nl); // depends on control dependency: [if], data = [(productInfo]
}
String installDir = config.get("wlp.install.dir");
if (installDir != null) {
builder.append("wlp.install.dir = ").append(installDir).append(LoggingConstants.nl); // depends on control dependency: [if], data = [(installDir]
}
String serverConfigDir = config.get("server.config.dir");
if (serverConfigDir != null && !"true".equals(config.get("wlp.user.dir.isDefault"))) {
builder.append("server.config.dir = ").append(serverConfigDir).append(LoggingConstants.nl);
}
String serverOutputDir = config.get("server.output.dir");
if (serverOutputDir != null && !serverOutputDir.equals(serverConfigDir)) {
builder.append("server.output.dir = ").append(serverOutputDir).append(LoggingConstants.nl);
}
builder.append("java.home = ").append(System.getProperty("java.home")).append(LoggingConstants.nl);
builder.append("java.version = ").append(System.getProperty("java.version")).append(LoggingConstants.nl);
builder.append("java.runtime = ").append(System.getProperty("java.runtime.name")).append(" (").append(System.getProperty("java.runtime.version")).append(')').append(LoggingConstants.nl);
builder.append("os = ").append(System.getProperty("os.name")).append(" (").append(System.getProperty("os.version")).append("; ").append(System.getProperty("os.arch")).append(") (").append(Locale.getDefault()).append(")").append(LoggingConstants.nl);
// avoid the initialization overhead retrieving the RuntimeMXBean. Not guaranteed to work on all platforms, so fallback as appropriate
builder.append("process = ");
String pid = System.getProperty("sun.java.launcher.pid");
if (pid != null) {
try {
String ip = InetAddress.getLocalHost().getHostAddress();
builder.append(pid).append('@').append(ip);
} catch (Exception e) {
pid = null;
}
}
if (pid == null) {
builder.append(ManagementFactory.getRuntimeMXBean().getName());
}
builder.append(LoggingConstants.nl);
return builder.toString();
} } |
public class class_name {
private String generateXmlSchema(Reader cobolReader,
String targetNamespace, String targetXmlSchemaName,
final String xsltFileName) {
log.debug("XML schema {} generation started", targetXmlSchemaName
+ XSD_FILE_EXTENSION);
String xmlSchemaSource = cob2xsd.translate(cobolReader,
NamespaceUtils.toNamespace(targetNamespace), xsltFileName);
if (log.isDebugEnabled()) {
log.debug("Generated Cobol-annotated XML Schema: ");
log.debug(xmlSchemaSource);
}
log.debug("XML schema {} generation ended", targetXmlSchemaName
+ XSD_FILE_EXTENSION);
return xmlSchemaSource;
} } | public class class_name {
private String generateXmlSchema(Reader cobolReader,
String targetNamespace, String targetXmlSchemaName,
final String xsltFileName) {
log.debug("XML schema {} generation started", targetXmlSchemaName
+ XSD_FILE_EXTENSION);
String xmlSchemaSource = cob2xsd.translate(cobolReader,
NamespaceUtils.toNamespace(targetNamespace), xsltFileName);
if (log.isDebugEnabled()) {
log.debug("Generated Cobol-annotated XML Schema: "); // depends on control dependency: [if], data = [none]
log.debug(xmlSchemaSource); // depends on control dependency: [if], data = [none]
}
log.debug("XML schema {} generation ended", targetXmlSchemaName
+ XSD_FILE_EXTENSION);
return xmlSchemaSource;
} } |
public class class_name {
public ResultSet executeQuery(final String query) throws SQLException {
startTimer();
try {
if (queryResult != null) {
queryResult.close();
}
final Query queryToSend = queryFactory.createQuery(query);
queryResult = protocol.executeQuery(queryToSend);
warningsCleared = false;
return new DrizzleResultSet(queryResult, this, getProtocol());
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
stopTimer();
}
} } | public class class_name {
public ResultSet executeQuery(final String query) throws SQLException {
startTimer();
try {
if (queryResult != null) {
queryResult.close(); // depends on control dependency: [if], data = [none]
}
final Query queryToSend = queryFactory.createQuery(query);
queryResult = protocol.executeQuery(queryToSend);
warningsCleared = false;
return new DrizzleResultSet(queryResult, this, getProtocol());
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
} finally {
stopTimer();
}
} } |
public class class_name {
public void marshall(UpdateSecurityProfileRequest updateSecurityProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSecurityProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSecurityProfileRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getSecurityProfileDescription(), SECURITYPROFILEDESCRIPTION_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getBehaviors(), BEHAVIORS_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getAlertTargets(), ALERTTARGETS_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getAdditionalMetricsToRetain(), ADDITIONALMETRICSTORETAIN_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteBehaviors(), DELETEBEHAVIORS_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteAlertTargets(), DELETEALERTTARGETS_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteAdditionalMetricsToRetain(), DELETEADDITIONALMETRICSTORETAIN_BINDING);
protocolMarshaller.marshall(updateSecurityProfileRequest.getExpectedVersion(), EXPECTEDVERSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateSecurityProfileRequest updateSecurityProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSecurityProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSecurityProfileRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getSecurityProfileDescription(), SECURITYPROFILEDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getBehaviors(), BEHAVIORS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getAlertTargets(), ALERTTARGETS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getAdditionalMetricsToRetain(), ADDITIONALMETRICSTORETAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteBehaviors(), DELETEBEHAVIORS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteAlertTargets(), DELETEALERTTARGETS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getDeleteAdditionalMetricsToRetain(), DELETEADDITIONALMETRICSTORETAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSecurityProfileRequest.getExpectedVersion(), EXPECTEDVERSION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setMappings(List<String> mappings) {
if (mappings.size() > 0) {
@SuppressWarnings("unchecked") Pair<String, String>[] renames = (Pair<String, String>[])Array.newInstance(Pair.class, mappings.size());
for (int i = 0; i < _renames.length; ++i) {
String[] names = mappings.get(i).split("[ ,]+");
renames[i] = new Pair<String, String>(names[0], names[1]);
}
_renames = renames;
}
} } | public class class_name {
public void setMappings(List<String> mappings) {
if (mappings.size() > 0) {
@SuppressWarnings("unchecked") Pair<String, String>[] renames = (Pair<String, String>[])Array.newInstance(Pair.class, mappings.size());
for (int i = 0; i < _renames.length; ++i) {
String[] names = mappings.get(i).split("[ ,]+");
renames[i] = new Pair<String, String>(names[0], names[1]); // depends on control dependency: [for], data = [i]
}
_renames = renames; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final Object put2d(Object key1, Object key2, Object value) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
internalData.put(key1, new AssociativeArray());
}
return internalData.get(key1).internalData.put(key2, value);
} } | public class class_name {
public final Object put2d(Object key1, Object key2, Object value) {
AssociativeArray tmp = internalData.get(key1);
if(tmp == null) {
internalData.put(key1, new AssociativeArray()); // depends on control dependency: [if], data = [none]
}
return internalData.get(key1).internalData.put(key2, value);
} } |
public class class_name {
private static String doGetPath(final String filename, final int separatorAdd) {
if (filename == null) {
return null;
}
int prefix = getPrefixLength(filename);
if (prefix < 0) {
return null;
}
int index = indexOfLastSeparator(filename);
int endIndex = index + separatorAdd;
if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {
return StringPool.EMPTY;
}
return filename.substring(prefix, endIndex);
} } | public class class_name {
private static String doGetPath(final String filename, final int separatorAdd) {
if (filename == null) {
return null; // depends on control dependency: [if], data = [none]
}
int prefix = getPrefixLength(filename);
if (prefix < 0) {
return null; // depends on control dependency: [if], data = [none]
}
int index = indexOfLastSeparator(filename);
int endIndex = index + separatorAdd;
if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {
return StringPool.EMPTY; // depends on control dependency: [if], data = [none]
}
return filename.substring(prefix, endIndex);
} } |
public class class_name {
private double wayLength(List<OSMNode> nodes) {
double length = 0d;
OSMNode n1, n2;
n1 = nodes.get(0);
for (int i = 1; i < nodes.size(); i++) {
n2 = nodes.get(i);
length += LatLongUtil.distance(
Double.parseDouble(n1.lat), Double.parseDouble(n1.lon),
Double.parseDouble(n2.lat), Double.parseDouble(n2.lon));
n1 = n2;
}
return length;
} } | public class class_name {
private double wayLength(List<OSMNode> nodes) {
double length = 0d;
OSMNode n1, n2;
n1 = nodes.get(0);
for (int i = 1; i < nodes.size(); i++) {
n2 = nodes.get(i); // depends on control dependency: [for], data = [i]
length += LatLongUtil.distance(
Double.parseDouble(n1.lat), Double.parseDouble(n1.lon),
Double.parseDouble(n2.lat), Double.parseDouble(n2.lon)); // depends on control dependency: [for], data = [none]
n1 = n2; // depends on control dependency: [for], data = [none]
}
return length;
} } |
public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(Address.toDottedQuad(address));
sb.append(" ");
sb.append(protocol);
for (int i = 0; i < services.length; i++) {
sb.append(" " + services[i]);
}
return sb.toString();
} } | public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(Address.toDottedQuad(address));
sb.append(" ");
sb.append(protocol);
for (int i = 0; i < services.length; i++) {
sb.append(" " + services[i]); // depends on control dependency: [for], data = [i]
}
return sb.toString();
} } |
public class class_name {
public void marshall(StartCrawlerRequest startCrawlerRequest, ProtocolMarshaller protocolMarshaller) {
if (startCrawlerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startCrawlerRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StartCrawlerRequest startCrawlerRequest, ProtocolMarshaller protocolMarshaller) {
if (startCrawlerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startCrawlerRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void connect(String dn, String credentials) {
BindRequest bindRequest = new BindRequestImpl();
bindRequest.setCredentials(credentials);
try {
bindRequest.setDn(new Dn(dn));
connection.connect();
connection.bind(bindRequest);
((LdapNetworkConnection) connection).loadSchema(new DefaultSchemaLoader(connection));
} catch (Exception e) {
throw new LdapDaoException(e);
}
} } | public class class_name {
public void connect(String dn, String credentials) {
BindRequest bindRequest = new BindRequestImpl();
bindRequest.setCredentials(credentials);
try {
bindRequest.setDn(new Dn(dn)); // depends on control dependency: [try], data = [none]
connection.connect(); // depends on control dependency: [try], data = [none]
connection.bind(bindRequest); // depends on control dependency: [try], data = [none]
((LdapNetworkConnection) connection).loadSchema(new DefaultSchemaLoader(connection)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new LdapDaoException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean configure(final FeatureContext context) {
if (!context.getConfiguration().isRegistered(PersistenceExceptionMapper.class)) {
context.register(PersistenceExceptionMapper.class);
}
if (context.getConfiguration().isRegistered(ModelInterceptor.class)) {
return false;
}
context.register(ModelInterceptor.class)
.register(JsonIOExceptionMapper.class);
final Configuration appConfig = context.getConfiguration();
final JsonFactory jsonFactory = objectMapper.getFactory();
ContainerConfig containerConfig = new ContainerConfig();
Properties cp = new Properties();
cp.putAll(appConfig.getProperties());
containerConfig.loadFromProperties(cp);
for (final String name : DataSourceManager.getDataSourceNames()) {
final ServerConfig config = new ServerConfig() {
@Override
public void loadFromProperties(Properties properties) {
loadSettings(new PropertiesWrapper("db", name, properties, this.getClassLoadConfig()));
}
};
config.setName(name);
config.setJsonInclude(JsonConfig.Include.NON_EMPTY);
config.setPersistBatch(PersistBatch.ALL);
config.setUpdateAllPropertiesInBatch(false);
config.setAllQuotedIdentifiers(true);
config.getMigrationConfig().setStrictMode(false);
config.loadFromProperties(cp);
config.setPackages(null);
config.setDataSourceJndiName(null);
config.setDataSource(DataSourceManager.getDataSource(name));//设置为druid数据源
config.setJsonFactory(jsonFactory);
config.setContainerConfig(containerConfig);
config.setDisableClasspathSearch(true);
if (name.equals(DataSourceManager.getDefaultDataSourceName())) {
config.setDefaultServer(true);
} else {
config.setDefaultServer(false);
}
config.addClass(ScriptInfo.class);
Set<Class> classes = ModelManager.getModels(name);
if (classes != null) {
classes.forEach(config::addClass);
}
logger.debug(Messages.get("info.db.connect", name));
final EbeanServer server = EbeanServerFactory.create(config);
logger.info(Messages.get("info.db.connected", name, appConfig.getProperty("db." + name + ".url")));
JacksonEbeanModule module = new JacksonEbeanModule(server, locator);
objectMapper.registerModule(module);
xmlMapper.registerModule(module);
servers.add(server);
}
SystemEventBus.subscribe(ShutdownEvent.class, event -> {
servers.forEach(server -> server.shutdown(true, true));
servers.clear();
});
ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
@Override
protected void configure() {
for (EbeanServer server : servers) {
String name = server.getName();
createBuilder(server).named(name);
if (name.equals(DataSourceManager.getDefaultDataSourceName())) {
createBuilder(server);
}
bind(new EbeanMigration(application, (SpiEbeanServer) server))
.to(Migration.class)
.named(name)
.proxy(false);
}
}
private ScopedBindingBuilder<SpiEbeanServer> createBuilder(EbeanServer server) {
return bind((SpiEbeanServer) server)
.to(SpiEbeanServer.class)
.to(EbeanServer.class)
.proxy(false);
}
});
return true;
} } | public class class_name {
@Override
public boolean configure(final FeatureContext context) {
if (!context.getConfiguration().isRegistered(PersistenceExceptionMapper.class)) {
context.register(PersistenceExceptionMapper.class); // depends on control dependency: [if], data = [none]
}
if (context.getConfiguration().isRegistered(ModelInterceptor.class)) {
return false; // depends on control dependency: [if], data = [none]
}
context.register(ModelInterceptor.class)
.register(JsonIOExceptionMapper.class);
final Configuration appConfig = context.getConfiguration();
final JsonFactory jsonFactory = objectMapper.getFactory();
ContainerConfig containerConfig = new ContainerConfig();
Properties cp = new Properties();
cp.putAll(appConfig.getProperties());
containerConfig.loadFromProperties(cp);
for (final String name : DataSourceManager.getDataSourceNames()) {
final ServerConfig config = new ServerConfig() {
@Override
public void loadFromProperties(Properties properties) {
loadSettings(new PropertiesWrapper("db", name, properties, this.getClassLoadConfig()));
}
};
config.setName(name); // depends on control dependency: [for], data = [name]
config.setJsonInclude(JsonConfig.Include.NON_EMPTY); // depends on control dependency: [for], data = [none]
config.setPersistBatch(PersistBatch.ALL); // depends on control dependency: [for], data = [none]
config.setUpdateAllPropertiesInBatch(false); // depends on control dependency: [for], data = [none]
config.setAllQuotedIdentifiers(true); // depends on control dependency: [for], data = [none]
config.getMigrationConfig().setStrictMode(false); // depends on control dependency: [for], data = [none]
config.loadFromProperties(cp); // depends on control dependency: [for], data = [none]
config.setPackages(null); // depends on control dependency: [for], data = [none]
config.setDataSourceJndiName(null); // depends on control dependency: [for], data = [none]
config.setDataSource(DataSourceManager.getDataSource(name));//设置为druid数据源 // depends on control dependency: [for], data = [name]
config.setJsonFactory(jsonFactory); // depends on control dependency: [for], data = [none]
config.setContainerConfig(containerConfig); // depends on control dependency: [for], data = [none]
config.setDisableClasspathSearch(true); // depends on control dependency: [for], data = [none]
if (name.equals(DataSourceManager.getDefaultDataSourceName())) {
config.setDefaultServer(true); // depends on control dependency: [if], data = [none]
} else {
config.setDefaultServer(false); // depends on control dependency: [if], data = [none]
}
config.addClass(ScriptInfo.class); // depends on control dependency: [for], data = [none]
Set<Class> classes = ModelManager.getModels(name);
if (classes != null) {
classes.forEach(config::addClass); // depends on control dependency: [if], data = [none]
}
logger.debug(Messages.get("info.db.connect", name)); // depends on control dependency: [for], data = [name]
final EbeanServer server = EbeanServerFactory.create(config);
logger.info(Messages.get("info.db.connected", name, appConfig.getProperty("db." + name + ".url"))); // depends on control dependency: [for], data = [name]
JacksonEbeanModule module = new JacksonEbeanModule(server, locator);
objectMapper.registerModule(module); // depends on control dependency: [for], data = [none]
xmlMapper.registerModule(module); // depends on control dependency: [for], data = [none]
servers.add(server); // depends on control dependency: [for], data = [none]
}
SystemEventBus.subscribe(ShutdownEvent.class, event -> {
servers.forEach(server -> server.shutdown(true, true));
servers.clear();
});
ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
@Override
protected void configure() {
for (EbeanServer server : servers) {
String name = server.getName();
createBuilder(server).named(name); // depends on control dependency: [for], data = [server]
if (name.equals(DataSourceManager.getDefaultDataSourceName())) {
createBuilder(server); // depends on control dependency: [if], data = [none]
}
bind(new EbeanMigration(application, (SpiEbeanServer) server))
.to(Migration.class)
.named(name)
.proxy(false); // depends on control dependency: [for], data = [none]
}
}
private ScopedBindingBuilder<SpiEbeanServer> createBuilder(EbeanServer server) {
return bind((SpiEbeanServer) server)
.to(SpiEbeanServer.class)
.to(EbeanServer.class)
.proxy(false);
}
});
return true;
} } |
public class class_name {
public void dispatch_event(final EventData eventData) {
final TangoInterfaceChange interfaceChange = this;
if (EventUtil.graphicAvailable()) {
// Causes doRun.run() to be executed asynchronously
// on the AWT event dispatching thread.
Runnable do_work_later = new Runnable() {
public void run() {
fireTangoInterfaceChangeEvent(interfaceChange, eventData);
}
};
SwingUtilities.invokeLater(do_work_later);
}
else {
fireTangoInterfaceChangeEvent(interfaceChange, eventData);
}
} } | public class class_name {
public void dispatch_event(final EventData eventData) {
final TangoInterfaceChange interfaceChange = this;
if (EventUtil.graphicAvailable()) {
// Causes doRun.run() to be executed asynchronously
// on the AWT event dispatching thread.
Runnable do_work_later = new Runnable() {
public void run() {
fireTangoInterfaceChangeEvent(interfaceChange, eventData);
}
};
SwingUtilities.invokeLater(do_work_later); // depends on control dependency: [if], data = [none]
}
else {
fireTangoInterfaceChangeEvent(interfaceChange, eventData); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean isApplicable(QueryCacheEventData event) {
if (!getInfo().isPublishable()) {
return false;
}
final int partitionId = event.getPartitionId();
if (isEndEvent(event)) {
sequenceProvider.reset(partitionId);
removeFromBrokenSequences(event);
return false;
}
if (isNextEvent(event)) {
long currentSequence = sequenceProvider.getSequence(partitionId);
sequenceProvider.compareAndSetSequence(currentSequence, event.getSequence(), partitionId);
removeFromBrokenSequences(event);
return true;
}
handleUnexpectedEvent(event);
return false;
} } | public class class_name {
private boolean isApplicable(QueryCacheEventData event) {
if (!getInfo().isPublishable()) {
return false; // depends on control dependency: [if], data = [none]
}
final int partitionId = event.getPartitionId();
if (isEndEvent(event)) {
sequenceProvider.reset(partitionId); // depends on control dependency: [if], data = [none]
removeFromBrokenSequences(event); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (isNextEvent(event)) {
long currentSequence = sequenceProvider.getSequence(partitionId);
sequenceProvider.compareAndSetSequence(currentSequence, event.getSequence(), partitionId); // depends on control dependency: [if], data = [none]
removeFromBrokenSequences(event); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
handleUnexpectedEvent(event);
return false;
} } |
public class class_name {
private static String getHostAddress(InetSocketAddress addr) {
String hostToAppend = "";
if (addr.isUnresolved()) {
hostToAppend = addr.getHostName();
} else {
hostToAppend = addr.getAddress().getHostAddress();
}
return hostToAppend;
} } | public class class_name {
private static String getHostAddress(InetSocketAddress addr) {
String hostToAppend = "";
if (addr.isUnresolved()) {
hostToAppend = addr.getHostName(); // depends on control dependency: [if], data = [none]
} else {
hostToAppend = addr.getAddress().getHostAddress(); // depends on control dependency: [if], data = [none]
}
return hostToAppend;
} } |
public class class_name {
public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException {
final ArrayList<String> newTokens = new ArrayList<String>();
for (String pathToken : pathTokens) {
if (isCurrentToken(pathToken)) { continue; } else if (isReverseToken(pathToken)) {
final int size = newTokens.size();
if (size == 0) {
throw VFSMessages.MESSAGES.onRootPath();
}
newTokens.remove(size - 1);
} else { newTokens.add(pathToken); }
}
return newTokens;
} } | public class class_name {
public static List<String> applySpecialPaths(List<String> pathTokens) throws IllegalArgumentException {
final ArrayList<String> newTokens = new ArrayList<String>();
for (String pathToken : pathTokens) {
if (isCurrentToken(pathToken)) { continue; } else if (isReverseToken(pathToken)) {
final int size = newTokens.size();
if (size == 0) {
throw VFSMessages.MESSAGES.onRootPath();
}
newTokens.remove(size - 1); // depends on control dependency: [if], data = [none]
} else { newTokens.add(pathToken); } // depends on control dependency: [if], data = [none]
}
return newTokens;
} } |
public class class_name {
public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) {
int month, day, year, hour, minute, second;
try {
month = Integer.parseInt(monthStr);
day = Integer.parseInt(dayStr);
year = Integer.parseInt(yearStr);
hour = Integer.parseInt(hourStr);
minute = Integer.parseInt(minuteStr);
second = Integer.parseInt(secondStr);
} catch (Exception e) {
return null;
}
return toDate(month, day, year, hour, minute, second);
} } | public class class_name {
public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, String minuteStr, String secondStr) {
int month, day, year, hour, minute, second;
try {
month = Integer.parseInt(monthStr);
// depends on control dependency: [try], data = [none]
day = Integer.parseInt(dayStr);
// depends on control dependency: [try], data = [none]
year = Integer.parseInt(yearStr);
// depends on control dependency: [try], data = [none]
hour = Integer.parseInt(hourStr);
// depends on control dependency: [try], data = [none]
minute = Integer.parseInt(minuteStr);
// depends on control dependency: [try], data = [none]
second = Integer.parseInt(secondStr);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
}
// depends on control dependency: [catch], data = [none]
return toDate(month, day, year, hour, minute, second);
} } |
public class class_name {
private BeanReferences[] convertRefToReferences(final String[] references) {
if (references == null) {
return null;
}
BeanReferences[] ref = new BeanReferences[references.length];
for (int i = 0; i < references.length; i++) {
ref[i] = BeanReferences.of(references[i]);
}
return ref;
} } | public class class_name {
private BeanReferences[] convertRefToReferences(final String[] references) {
if (references == null) {
return null; // depends on control dependency: [if], data = [none]
}
BeanReferences[] ref = new BeanReferences[references.length];
for (int i = 0; i < references.length; i++) {
ref[i] = BeanReferences.of(references[i]); // depends on control dependency: [for], data = [i]
}
return ref;
} } |
public class class_name {
public static <T> String joinAnd(final String delimiter, final String lastDelimiter, final Collection<T> objs) {
if (objs == null || objs.isEmpty()) {
return "";
}
final Iterator<T> iter = objs.iterator();
final StringBuffer buffer = new StringBuffer(Strings.toString(iter.next()));
int i = 1;
while (iter.hasNext()) {
final T obj = iter.next();
if (notEmpty(obj)) {
buffer.append(++i == objs.size() ? lastDelimiter : delimiter).append(Strings.toString(obj));
}
}
return buffer.toString();
} } | public class class_name {
public static <T> String joinAnd(final String delimiter, final String lastDelimiter, final Collection<T> objs) {
if (objs == null || objs.isEmpty()) {
return ""; // depends on control dependency: [if], data = [none]
}
final Iterator<T> iter = objs.iterator();
final StringBuffer buffer = new StringBuffer(Strings.toString(iter.next()));
int i = 1;
while (iter.hasNext()) {
final T obj = iter.next();
if (notEmpty(obj)) {
buffer.append(++i == objs.size() ? lastDelimiter : delimiter).append(Strings.toString(obj)); // depends on control dependency: [if], data = [none]
}
}
return buffer.toString();
} } |
public class class_name {
private void tred2() {
// This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
// Fortran subroutine in EISPACK.
System.arraycopy(V[n - 1], 0, d, 0, n);
// Householder reduction to tridiagonal form.
for(int i = n - 1; i > 0; i--) {
double[] V_i = V[i], V_im1 = V[i - 1];
// Scale to avoid under/overflow.
double scale = 0.;
for(int k = 0; k < i; k++) {
scale += abs(d[k]);
}
if(scale < Double.MIN_NORMAL) {
e[i] = d[i - 1];
for(int j = 0; j < i; j++) {
d[j] = V_im1[j];
V_i[j] = V[j][i] = 0.;
}
d[i] = 0;
continue;
}
// Generate Householder vector.
double h = 0.;
for(int k = 0; k < i; k++) {
double dk = d[k] /= scale;
h += dk * dk;
}
{
double f = d[i - 1], g = FastMath.sqrt(h);
g = (f > 0) ? -g : g;
e[i] = scale * g;
h -= f * g;
d[i - 1] = f - g;
Arrays.fill(e, 0, i, 0.);
}
// Apply similarity transformation to remaining columns.
for(int j = 0; j < i; j++) {
final double[] Vj = V[j];
double dj = Vj[i] = d[j], ej = e[j] + Vj[j] * dj;
for(int k = j + 1; k <= i - 1; k++) {
final double Vkj = V[k][j];
ej += Vkj * d[k];
e[k] += Vkj * dj;
}
e[j] = ej;
}
double sum = 0.;
for(int j = 0; j < i; j++) {
sum += (e[j] /= h) * d[j];
}
double hh = sum / (h + h);
for(int j = 0; j < i; j++) {
e[j] -= hh * d[j];
}
for(int j = 0; j < i; j++) {
double dj = d[j], ej = e[j];
for(int k = j; k <= i - 1; k++) {
V[k][j] -= (dj * e[k] + ej * d[k]);
}
d[j] = V_im1[j];
V_i[j] = 0.;
}
d[i] = h;
}
// Accumulate transformations.
tred2AccumulateTransformations();
System.arraycopy(V[n - 1], 0, d, 0, n);
Arrays.fill(V[n - 1], 0.);
V[n - 1][n - 1] = 1.;
e[0] = 0.;
} } | public class class_name {
private void tred2() {
// This is derived from the Algol procedures tred2 by
// Bowdler, Martin, Reinsch, and Wilkinson, Handbook for
// Auto. Comp., Vol.ii-Linear Algebra, and the corresponding
// Fortran subroutine in EISPACK.
System.arraycopy(V[n - 1], 0, d, 0, n);
// Householder reduction to tridiagonal form.
for(int i = n - 1; i > 0; i--) {
double[] V_i = V[i], V_im1 = V[i - 1];
// Scale to avoid under/overflow.
double scale = 0.;
for(int k = 0; k < i; k++) {
scale += abs(d[k]); // depends on control dependency: [for], data = [k]
}
if(scale < Double.MIN_NORMAL) {
e[i] = d[i - 1]; // depends on control dependency: [if], data = [none]
for(int j = 0; j < i; j++) {
d[j] = V_im1[j]; // depends on control dependency: [for], data = [j]
V_i[j] = V[j][i] = 0.; // depends on control dependency: [for], data = [j]
}
d[i] = 0; // depends on control dependency: [if], data = [none]
continue;
}
// Generate Householder vector.
double h = 0.;
for(int k = 0; k < i; k++) {
double dk = d[k] /= scale;
h += dk * dk; // depends on control dependency: [for], data = [none]
}
{
double f = d[i - 1], g = FastMath.sqrt(h);
g = (f > 0) ? -g : g;
e[i] = scale * g;
h -= f * g;
d[i - 1] = f - g;
Arrays.fill(e, 0, i, 0.);
}
// Apply similarity transformation to remaining columns.
for(int j = 0; j < i; j++) {
final double[] Vj = V[j];
double dj = Vj[i] = d[j], ej = e[j] + Vj[j] * dj;
for(int k = j + 1; k <= i - 1; k++) {
final double Vkj = V[k][j];
ej += Vkj * d[k]; // depends on control dependency: [for], data = [k]
e[k] += Vkj * dj; // depends on control dependency: [for], data = [k]
}
e[j] = ej; // depends on control dependency: [for], data = [j]
}
double sum = 0.;
for(int j = 0; j < i; j++) {
sum += (e[j] /= h) * d[j]; // depends on control dependency: [for], data = [j]
}
double hh = sum / (h + h);
for(int j = 0; j < i; j++) {
e[j] -= hh * d[j]; // depends on control dependency: [for], data = [j]
}
for(int j = 0; j < i; j++) {
double dj = d[j], ej = e[j];
for(int k = j; k <= i - 1; k++) {
V[k][j] -= (dj * e[k] + ej * d[k]); // depends on control dependency: [for], data = [k]
}
d[j] = V_im1[j]; // depends on control dependency: [for], data = [j]
V_i[j] = 0.; // depends on control dependency: [for], data = [j]
}
d[i] = h; // depends on control dependency: [for], data = [i]
}
// Accumulate transformations.
tred2AccumulateTransformations();
System.arraycopy(V[n - 1], 0, d, 0, n);
Arrays.fill(V[n - 1], 0.);
V[n - 1][n - 1] = 1.;
e[0] = 0.;
} } |
public class class_name {
protected void notifyToHandlers(Object message, ISFSObject params) {
if(params == null) params = new SFSObject();
for(ServerHandlerClass handler : handlers) {
notifyToHandler(handler, message, params);
}
} } | public class class_name {
protected void notifyToHandlers(Object message, ISFSObject params) {
if(params == null) params = new SFSObject();
for(ServerHandlerClass handler : handlers) {
notifyToHandler(handler, message, params); // depends on control dependency: [for], data = [handler]
}
} } |
public class class_name {
public java.util.List<DirectConnectGatewayAssociation> getDirectConnectGatewayAssociations() {
if (directConnectGatewayAssociations == null) {
directConnectGatewayAssociations = new com.amazonaws.internal.SdkInternalList<DirectConnectGatewayAssociation>();
}
return directConnectGatewayAssociations;
} } | public class class_name {
public java.util.List<DirectConnectGatewayAssociation> getDirectConnectGatewayAssociations() {
if (directConnectGatewayAssociations == null) {
directConnectGatewayAssociations = new com.amazonaws.internal.SdkInternalList<DirectConnectGatewayAssociation>(); // depends on control dependency: [if], data = [none]
}
return directConnectGatewayAssociations;
} } |
public class class_name {
public void marshall(DescribeElasticsearchDomainsRequest describeElasticsearchDomainsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeElasticsearchDomainsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeElasticsearchDomainsRequest.getDomainNames(), DOMAINNAMES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeElasticsearchDomainsRequest describeElasticsearchDomainsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeElasticsearchDomainsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeElasticsearchDomainsRequest.getDomainNames(), DOMAINNAMES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static List<Long> ends(final Iterable<Range<Long>> ranges) {
List<Long> ends = new ArrayList<Long>();
for (Range<Long> range : ranges) {
checkClosedOpen(range);
ends.add(range.upperEndpoint());
}
return ends;
} } | public class class_name {
public static List<Long> ends(final Iterable<Range<Long>> ranges) {
List<Long> ends = new ArrayList<Long>();
for (Range<Long> range : ranges) {
checkClosedOpen(range); // depends on control dependency: [for], data = [range]
ends.add(range.upperEndpoint()); // depends on control dependency: [for], data = [range]
}
return ends;
} } |
public class class_name {
public int getPort() {
if (port != null && port != 0) {
return port;
}
return urlParser != null ? urlParser.getHostAddresses().get(0).port : 3306;
} } | public class class_name {
public int getPort() {
if (port != null && port != 0) {
return port; // depends on control dependency: [if], data = [none]
}
return urlParser != null ? urlParser.getHostAddresses().get(0).port : 3306;
} } |
public class class_name {
public void configure(ConfigProvider configProvider) {
ConfigBuilder builder;
this.configReadLock.lock();
try {
builder = ConfigBuilder.withConfig(this.config);
} finally {
this.configReadLock.unlock();
}
Config newConfig = configProvider.provide(builder);
this.configure(newConfig);
} } | public class class_name {
public void configure(ConfigProvider configProvider) {
ConfigBuilder builder;
this.configReadLock.lock();
try {
builder = ConfigBuilder.withConfig(this.config); // depends on control dependency: [try], data = [none]
} finally {
this.configReadLock.unlock();
}
Config newConfig = configProvider.provide(builder);
this.configure(newConfig);
} } |
public class class_name {
public PactDslWithState given(String state, String firstKey, Object firstValue, Object... paramsKeyValuePair) {
if (paramsKeyValuePair.length % 2 != 0) {
throw new IllegalArgumentException("Pair key value should be provided, but there is one key without value.");
}
final Map<String, Object> params = new HashMap<>();
params.put(firstKey, firstValue);
for (int i = 0; i < paramsKeyValuePair.length; i+=2) {
params.put(paramsKeyValuePair[i].toString(), paramsKeyValuePair[i+1]);
}
return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName,
new ProviderState(state, params), defaultRequestValues, defaultResponseValues);
} } | public class class_name {
public PactDslWithState given(String state, String firstKey, Object firstValue, Object... paramsKeyValuePair) {
if (paramsKeyValuePair.length % 2 != 0) {
throw new IllegalArgumentException("Pair key value should be provided, but there is one key without value.");
}
final Map<String, Object> params = new HashMap<>();
params.put(firstKey, firstValue);
for (int i = 0; i < paramsKeyValuePair.length; i+=2) {
params.put(paramsKeyValuePair[i].toString(), paramsKeyValuePair[i+1]); // depends on control dependency: [for], data = [i]
}
return new PactDslWithState(consumerPactBuilder, consumerPactBuilder.getConsumerName(), providerName,
new ProviderState(state, params), defaultRequestValues, defaultResponseValues);
} } |
public class class_name {
public Properties generate(Properties instructions, ProjectDependencies dependencies) {
Properties result = new Properties();
result.putAll(instructions);
StringBuilder include = new StringBuilder();
if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) {
include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE));
}
StringBuilder classpath = new StringBuilder();
final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH);
if (originalClassPath != null) {
classpath.append(originalClassPath);
}
for (EmbeddedDependency configuration : embedded) {
configuration.addClause(dependencies, include, classpath, reporter);
}
if (include.length() != 0) {
result.setProperty(Constants.INCLUDE_RESOURCE, include.toString());
}
if (classpath.length() != 0) {
if (originalClassPath != null) {
result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString());
} else {
// Prepend . to the classpath.
result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString());
}
}
return result;
} } | public class class_name {
public Properties generate(Properties instructions, ProjectDependencies dependencies) {
Properties result = new Properties();
result.putAll(instructions);
StringBuilder include = new StringBuilder();
if (instructions.getProperty(Constants.INCLUDE_RESOURCE) != null) {
include.append(instructions.getProperty(Constants.INCLUDE_RESOURCE)); // depends on control dependency: [if], data = [(instructions.getProperty(Constants.INCLUDE_RESOURCE)]
}
StringBuilder classpath = new StringBuilder();
final String originalClassPath = instructions.getProperty(Constants.BUNDLE_CLASSPATH);
if (originalClassPath != null) {
classpath.append(originalClassPath); // depends on control dependency: [if], data = [(originalClassPath]
}
for (EmbeddedDependency configuration : embedded) {
configuration.addClause(dependencies, include, classpath, reporter); // depends on control dependency: [for], data = [configuration]
}
if (include.length() != 0) {
result.setProperty(Constants.INCLUDE_RESOURCE, include.toString()); // depends on control dependency: [if], data = [none]
}
if (classpath.length() != 0) {
if (originalClassPath != null) {
result.setProperty(Constants.BUNDLE_CLASSPATH, classpath.toString()); // depends on control dependency: [if], data = [none]
} else {
// Prepend . to the classpath.
result.setProperty(Constants.BUNDLE_CLASSPATH, "., " + classpath.toString()); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static Optional<Method> extractSetter(final Class<?> targetClass, final String propertyName, final Class<?> propertyType) {
final String methodName = "set" + Utils.capitalize(propertyName);
Method method;
try {
method = targetClass.getMethod(methodName, propertyType);
} catch (NoSuchMethodException | SecurityException e) {
return Optional.empty();
}
method.setAccessible(true);
return Optional.of(method);
} } | public class class_name {
public static Optional<Method> extractSetter(final Class<?> targetClass, final String propertyName, final Class<?> propertyType) {
final String methodName = "set" + Utils.capitalize(propertyName);
Method method;
try {
method = targetClass.getMethod(methodName, propertyType);
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException | SecurityException e) {
return Optional.empty();
}
// depends on control dependency: [catch], data = [none]
method.setAccessible(true);
return Optional.of(method);
} } |
public class class_name {
private List iterateAndReturnNative(final ResultSet rSet) {
final Iterator<Row> rowIter = rSet.iterator();
final List results = new ArrayList();
final List item = new ArrayList<>();
final boolean isSingle = (rSet.getColumnDefinitions().size() == 1);
while (rowIter.hasNext()) {
final Row row = rowIter.next();
final ColumnDefinitions columnDefs = row.getColumnDefinitions();
final Iterator<Definition> columnDefIter = columnDefs.iterator();
item.clear();
while (columnDefIter.hasNext()) {
final Definition columnDef = columnDefIter.next();
item.add(DSClientUtilities.assign(row, null, null, columnDef.getType().getName(), null,
columnDef.getName(), null, null));
}
if (isSingle) {
if (!item.isEmpty())
results.add(item.get(0));
else
results.add(null);
} else
results.add(item.toArray(new Object[item.size()]));
}
return results;
} } | public class class_name {
private List iterateAndReturnNative(final ResultSet rSet) {
final Iterator<Row> rowIter = rSet.iterator();
final List results = new ArrayList();
final List item = new ArrayList<>();
final boolean isSingle = (rSet.getColumnDefinitions().size() == 1);
while (rowIter.hasNext()) {
final Row row = rowIter.next();
final ColumnDefinitions columnDefs = row.getColumnDefinitions();
final Iterator<Definition> columnDefIter = columnDefs.iterator();
item.clear(); // depends on control dependency: [while], data = [none]
while (columnDefIter.hasNext()) {
final Definition columnDef = columnDefIter.next();
item.add(DSClientUtilities.assign(row, null, null, columnDef.getType().getName(), null,
columnDef.getName(), null, null)); // depends on control dependency: [while], data = [none]
}
if (isSingle) {
if (!item.isEmpty())
results.add(item.get(0));
else
results.add(null);
} else
results.add(item.toArray(new Object[item.size()]));
}
return results;
} } |
public class class_name {
private static void cleanup(ContextFromVertx context) {
// Release all resources, especially uploaded file.
if (context != null) {
context.cleanup();
}
Context.CONTEXT.remove();
} } | public class class_name {
private static void cleanup(ContextFromVertx context) {
// Release all resources, especially uploaded file.
if (context != null) {
context.cleanup(); // depends on control dependency: [if], data = [none]
}
Context.CONTEXT.remove();
} } |
public class class_name {
private static I_CmsResourceType getResourceType(CmsResource resource, String createType) {
I_CmsResourceType resType = null;
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(createType)) {
try {
resType = OpenCms.getResourceManager().getResourceType(createType);
} catch (CmsLoaderException e) {
LOG.error("Could not read resource type '" + createType + "' for resource creation.", e);
}
} else if (resource != null) {
resType = OpenCms.getResourceManager().getResourceType(resource);
}
return resType;
} } | public class class_name {
private static I_CmsResourceType getResourceType(CmsResource resource, String createType) {
I_CmsResourceType resType = null;
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(createType)) {
try {
resType = OpenCms.getResourceManager().getResourceType(createType); // depends on control dependency: [try], data = [none]
} catch (CmsLoaderException e) {
LOG.error("Could not read resource type '" + createType + "' for resource creation.", e);
} // depends on control dependency: [catch], data = [none]
} else if (resource != null) {
resType = OpenCms.getResourceManager().getResourceType(resource); // depends on control dependency: [if], data = [(resource]
}
return resType;
} } |
public class class_name {
public void removeDefaultBindingIfNotExists(Properties properties) {
List<Bw> bwServices = this.getBWServices();
for (Bw bw : bwServices) {
String path = "bw[" + bw.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = bw.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove();
}
}
}
List<Adapter> adapterServices = this.getAdapterServices();
for (Adapter adapter : adapterServices) {
String path = "adapter[" + adapter.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = adapter.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove();
}
}
}
} } | public class class_name {
public void removeDefaultBindingIfNotExists(Properties properties) {
List<Bw> bwServices = this.getBWServices();
for (Bw bw : bwServices) {
String path = "bw[" + bw.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = bw.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
}
List<Adapter> adapterServices = this.getAdapterServices();
for (Adapter adapter : adapterServices) {
String path = "adapter[" + adapter.getName() + "]/bindings/binding[]/machine";
List<Binding> bindings = adapter.getBindings().getBinding();
for (Iterator<Binding> iterator = bindings.iterator(); iterator.hasNext();) {
Binding binding = (Binding) iterator.next();
// if (binding.getName().equals("") && properties.getString(path) == null) {
if (binding.getName().equals("") && !properties.containsKey(path)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
protected void chooseFirstInRemoteRack(DatanodeDescriptor localMachine,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results)
throws NotEnoughReplicasException {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(localMachine.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(localMachine);
assert (machineId != null);
if (!chooseRemoteRack(rackInfo.index, rackInfo.index, rackWindow + 1,
machineId, machineWindow, excludedNodes, blocksize,
maxReplicasPerRack, results, false)) {
LOG.info("Couldn't find a Datanode within node group. "
+ "Resorting to default policy.");
super.chooseRemoteRack(1, localMachine, excludedNodes, blocksize,
maxReplicasPerRack, results);
}
} finally {
readUnlock();
}
} } | public class class_name {
protected void chooseFirstInRemoteRack(DatanodeDescriptor localMachine,
HashMap<Node, Node> excludedNodes, long blocksize,
int maxReplicasPerRack, List<DatanodeDescriptor> results)
throws NotEnoughReplicasException {
readLock();
try {
RackRingInfo rackInfo = racksMap.get(localMachine.getNetworkLocation());
assert (rackInfo != null);
Integer machineId = rackInfo.findNode(localMachine);
assert (machineId != null);
if (!chooseRemoteRack(rackInfo.index, rackInfo.index, rackWindow + 1,
machineId, machineWindow, excludedNodes, blocksize,
maxReplicasPerRack, results, false)) {
LOG.info("Couldn't find a Datanode within node group. "
+ "Resorting to default policy."); // depends on control dependency: [if], data = [none]
super.chooseRemoteRack(1, localMachine, excludedNodes, blocksize,
maxReplicasPerRack, results); // depends on control dependency: [if], data = [none]
}
} finally {
readUnlock();
}
} } |
public class class_name {
protected void removeLastChildNodeIfEmptyText(final Node parentNode, final boolean closedTag) {
if (parentNode == null) {
return;
}
Node lastChild = parentNode.getLastChild();
if (lastChild == null) {
return;
}
if (lastChild.getNodeType() != Node.NodeType.TEXT) {
return;
}
if (closedTag) {
if (parentNode.getChildNodesCount() == 1) {
return;
}
}
Text text = (Text) lastChild;
if (text.isBlank()) {
lastChild.detachFromParent();
}
} } | public class class_name {
protected void removeLastChildNodeIfEmptyText(final Node parentNode, final boolean closedTag) {
if (parentNode == null) {
return; // depends on control dependency: [if], data = [none]
}
Node lastChild = parentNode.getLastChild();
if (lastChild == null) {
return; // depends on control dependency: [if], data = [none]
}
if (lastChild.getNodeType() != Node.NodeType.TEXT) {
return; // depends on control dependency: [if], data = [none]
}
if (closedTag) {
if (parentNode.getChildNodesCount() == 1) {
return; // depends on control dependency: [if], data = [none]
}
}
Text text = (Text) lastChild;
if (text.isBlank()) {
lastChild.detachFromParent(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Operator getReversedOperator(Operator e) {
if ( e.equals( Operator.NOT_EQUAL ) ) {
return Operator.EQUAL;
} else if ( e.equals( Operator.EQUAL ) ) {
return Operator.NOT_EQUAL;
} else if ( e.equals( Operator.GREATER ) ) {
return Operator.LESS_OR_EQUAL;
} else if ( e.equals( Operator.LESS ) ) {
return Operator.GREATER_OR_EQUAL;
} else if ( e.equals( Operator.GREATER_OR_EQUAL ) ) {
return Operator.LESS;
} else if ( e.equals( Operator.LESS_OR_EQUAL ) ) {
return Operator.GREATER;
} else {
return Operator.determineOperator( e.getOperatorString(),
!e.isNegated() );
}
} } | public class class_name {
public static Operator getReversedOperator(Operator e) {
if ( e.equals( Operator.NOT_EQUAL ) ) {
return Operator.EQUAL; // depends on control dependency: [if], data = [none]
} else if ( e.equals( Operator.EQUAL ) ) {
return Operator.NOT_EQUAL; // depends on control dependency: [if], data = [none]
} else if ( e.equals( Operator.GREATER ) ) {
return Operator.LESS_OR_EQUAL; // depends on control dependency: [if], data = [none]
} else if ( e.equals( Operator.LESS ) ) {
return Operator.GREATER_OR_EQUAL; // depends on control dependency: [if], data = [none]
} else if ( e.equals( Operator.GREATER_OR_EQUAL ) ) {
return Operator.LESS; // depends on control dependency: [if], data = [none]
} else if ( e.equals( Operator.LESS_OR_EQUAL ) ) {
return Operator.GREATER; // depends on control dependency: [if], data = [none]
} else {
return Operator.determineOperator( e.getOperatorString(),
!e.isNegated() ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<Family> getFamilies() {
final List<Family> families = new ArrayList<>();
for (final FamilyNavigator nav : familySNavigators) {
families.add(nav.getFamily());
}
return families;
} } | public class class_name {
public List<Family> getFamilies() {
final List<Family> families = new ArrayList<>();
for (final FamilyNavigator nav : familySNavigators) {
families.add(nav.getFamily()); // depends on control dependency: [for], data = [nav]
}
return families;
} } |
public class class_name {
private int addMandatoryArcs() throws ContradictionException {
int from, to, rFrom, rTo, arc;
int tSize = 0;
double val = propHK.getMinArcVal();
for (int i = ma.size() - 1; i >= 0; i--) {
arc = ma.get(i);
from = arc / n;
to = arc % n;
rFrom = findUF(from);
rTo = findUF(to);
if (rFrom != rTo) {
linkUF(rFrom, rTo);
Tree.addEdge(from, to);
updateCCTree(rFrom, rTo, val);
treeCost += costs[arc];
tSize++;
} else {
propHK.contradiction();
}
}
return tSize;
} } | public class class_name {
private int addMandatoryArcs() throws ContradictionException {
int from, to, rFrom, rTo, arc;
int tSize = 0;
double val = propHK.getMinArcVal();
for (int i = ma.size() - 1; i >= 0; i--) {
arc = ma.get(i);
from = arc / n;
to = arc % n;
rFrom = findUF(from);
rTo = findUF(to);
if (rFrom != rTo) {
linkUF(rFrom, rTo); // depends on control dependency: [if], data = [(rFrom]
Tree.addEdge(from, to); // depends on control dependency: [if], data = [none]
updateCCTree(rFrom, rTo, val); // depends on control dependency: [if], data = [(rFrom]
treeCost += costs[arc]; // depends on control dependency: [if], data = [none]
tSize++; // depends on control dependency: [if], data = [none]
} else {
propHK.contradiction(); // depends on control dependency: [if], data = [none]
}
}
return tSize;
} } |
public class class_name {
private XPathFactory _newFactory(String uri) {
XPathFactory xpf;
String propertyName = SERVICE_CLASS.getName() + ":" + uri;
// system property look up
try {
if (debug) debugPrintln("Looking up system property '"+propertyName+"'" );
String r = System.getProperty(propertyName);
if (r != null && r.length() > 0) {
if (debug) debugPrintln("The value is '"+r+"'");
xpf = createInstance(r);
if(xpf!=null) return xpf;
} else if (debug) {
debugPrintln("The property is undefined.");
}
} catch (Exception e) {
e.printStackTrace();
}
// try to read from $java.home/lib/jaxp.properties
try {
String factoryClassName = CacheHolder.cacheProps.getProperty(propertyName);
if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
if (factoryClassName != null) {
xpf = createInstance(factoryClassName);
if(xpf != null){
return xpf;
}
}
} catch (Exception ex) {
if (debug) {
ex.printStackTrace();
}
}
// try META-INF/services files
for (URL resource : createServiceFileIterator()) {
if (debug) debugPrintln("looking into " + resource);
try {
xpf = loadFromServicesFile(uri, resource.toExternalForm(), resource.openStream());
if(xpf!=null) return xpf;
} catch(IOException e) {
if( debug ) {
debugPrintln("failed to read "+resource);
e.printStackTrace();
}
}
}
// platform default
if(uri.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
if (debug) debugPrintln("attempting to use the platform default W3C DOM XPath lib");
return createInstance("org.apache.xpath.jaxp.XPathFactoryImpl");
}
if (debug) debugPrintln("all things were tried, but none was found. bailing out.");
return null;
} } | public class class_name {
private XPathFactory _newFactory(String uri) {
XPathFactory xpf;
String propertyName = SERVICE_CLASS.getName() + ":" + uri;
// system property look up
try {
if (debug) debugPrintln("Looking up system property '"+propertyName+"'" );
String r = System.getProperty(propertyName);
if (r != null && r.length() > 0) {
if (debug) debugPrintln("The value is '"+r+"'");
xpf = createInstance(r); // depends on control dependency: [if], data = [(r]
if(xpf!=null) return xpf;
} else if (debug) {
debugPrintln("The property is undefined."); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
// try to read from $java.home/lib/jaxp.properties
try {
String factoryClassName = CacheHolder.cacheProps.getProperty(propertyName);
if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
if (factoryClassName != null) {
xpf = createInstance(factoryClassName);
if(xpf != null){
return xpf; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ex) {
if (debug) {
ex.printStackTrace(); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
// try META-INF/services files
for (URL resource : createServiceFileIterator()) {
if (debug) debugPrintln("looking into " + resource);
try {
xpf = loadFromServicesFile(uri, resource.toExternalForm(), resource.openStream()); // depends on control dependency: [try], data = [none]
if(xpf!=null) return xpf;
} catch(IOException e) {
if( debug ) {
debugPrintln("failed to read "+resource); // depends on control dependency: [if], data = [none]
e.printStackTrace(); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// platform default
if(uri.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
if (debug) debugPrintln("attempting to use the platform default W3C DOM XPath lib");
return createInstance("org.apache.xpath.jaxp.XPathFactoryImpl"); // depends on control dependency: [if], data = [none]
}
if (debug) debugPrintln("all things were tried, but none was found. bailing out.");
return null;
} } |
public class class_name {
public static <Item extends IItem & IExpandable> void notifyItemsChanged(final FastAdapter adapter, final ExpandableExtension expandableExtension, Item header, Set<Long> identifiers, boolean checkSubItems, boolean restoreExpandedState) {
int subItems = header.getSubItems().size();
int position = adapter.getPosition(header);
boolean expanded = header.isExpanded();
// 1) check header itself
if (identifiers.contains(header.getIdentifier())) {
adapter.notifyAdapterItemChanged(position);
}
// 2) check sub items, recursively
IItem item;
if (header.isExpanded()) {
for (int i = 0; i < subItems; i++) {
item = (IItem) header.getSubItems().get(i);
if (identifiers.contains(item.getIdentifier())) {
// Log.d("NOTIFY", "Position=" + position + ", i=" + i);
adapter.notifyAdapterItemChanged(position + i + 1);
}
if (checkSubItems && item instanceof IExpandable) {
notifyItemsChanged(adapter, expandableExtension, (Item) item, identifiers, true, restoreExpandedState);
}
}
}
if (restoreExpandedState && expanded) {
expandableExtension.expand(position);
}
} } | public class class_name {
public static <Item extends IItem & IExpandable> void notifyItemsChanged(final FastAdapter adapter, final ExpandableExtension expandableExtension, Item header, Set<Long> identifiers, boolean checkSubItems, boolean restoreExpandedState) {
int subItems = header.getSubItems().size();
int position = adapter.getPosition(header);
boolean expanded = header.isExpanded();
// 1) check header itself
if (identifiers.contains(header.getIdentifier())) {
adapter.notifyAdapterItemChanged(position); // depends on control dependency: [if], data = [none]
}
// 2) check sub items, recursively
IItem item;
if (header.isExpanded()) {
for (int i = 0; i < subItems; i++) {
item = (IItem) header.getSubItems().get(i); // depends on control dependency: [for], data = [i]
if (identifiers.contains(item.getIdentifier())) {
// Log.d("NOTIFY", "Position=" + position + ", i=" + i);
adapter.notifyAdapterItemChanged(position + i + 1); // depends on control dependency: [if], data = [none]
}
if (checkSubItems && item instanceof IExpandable) {
notifyItemsChanged(adapter, expandableExtension, (Item) item, identifiers, true, restoreExpandedState); // depends on control dependency: [if], data = [none]
}
}
}
if (restoreExpandedState && expanded) {
expandableExtension.expand(position); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String combine(String left, String right, int minOverlap) {
if (left.length() < minOverlap) return null;
if (right.length() < minOverlap) return null;
int bestOffset = Integer.MAX_VALUE;
for (int offset = minOverlap - left.length(); offset < right.length() - minOverlap; offset++) {
boolean match = true;
for (int posLeft = Math.max(0, -offset); posLeft < Math.min(left.length(), right.length() - offset); posLeft++) {
if (left.charAt(posLeft) != right.charAt(posLeft + offset)) {
match = false;
break;
}
}
if (match) {
if (Math.abs(bestOffset) > Math.abs(offset)) bestOffset = offset;
}
}
if (bestOffset < Integer.MAX_VALUE) {
String combined = left;
if (bestOffset > 0) {
combined = right.substring(0, bestOffset) + combined;
}
if (left.length() + bestOffset < right.length()) {
combined = combined + right.substring(left.length() + bestOffset);
}
return combined;
}
else {
return null;
}
} } | public class class_name {
public static String combine(String left, String right, int minOverlap) {
if (left.length() < minOverlap) return null;
if (right.length() < minOverlap) return null;
int bestOffset = Integer.MAX_VALUE;
for (int offset = minOverlap - left.length(); offset < right.length() - minOverlap; offset++) {
boolean match = true;
for (int posLeft = Math.max(0, -offset); posLeft < Math.min(left.length(), right.length() - offset); posLeft++) {
if (left.charAt(posLeft) != right.charAt(posLeft + offset)) {
match = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (match) {
if (Math.abs(bestOffset) > Math.abs(offset)) bestOffset = offset;
}
}
if (bestOffset < Integer.MAX_VALUE) {
String combined = left;
if (bestOffset > 0) {
combined = right.substring(0, bestOffset) + combined; // depends on control dependency: [if], data = [none]
}
if (left.length() + bestOffset < right.length()) {
combined = combined + right.substring(left.length() + bestOffset); // depends on control dependency: [if], data = [(left.length() + bestOffset]
}
return combined; // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setVolumesFrom(java.util.Collection<VolumeFrom> volumesFrom) {
if (volumesFrom == null) {
this.volumesFrom = null;
return;
}
this.volumesFrom = new com.amazonaws.internal.SdkInternalList<VolumeFrom>(volumesFrom);
} } | public class class_name {
public void setVolumesFrom(java.util.Collection<VolumeFrom> volumesFrom) {
if (volumesFrom == null) {
this.volumesFrom = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.volumesFrom = new com.amazonaws.internal.SdkInternalList<VolumeFrom>(volumesFrom);
} } |
public class class_name {
@UiThread
public static <T extends View, V> void set(@NonNull List<T> list,
@NonNull Property<? super T, V> setter, @Nullable V value) {
//noinspection ForLoopReplaceableByForEach
for (int i = 0, count = list.size(); i < count; i++) {
setter.set(list.get(i), value);
}
} } | public class class_name {
@UiThread
public static <T extends View, V> void set(@NonNull List<T> list,
@NonNull Property<? super T, V> setter, @Nullable V value) {
//noinspection ForLoopReplaceableByForEach
for (int i = 0, count = list.size(); i < count; i++) {
setter.set(list.get(i), value); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
protected Object convertToAsyncDriverTypes(Object object){
if(object instanceof Enum){
return ((Enum)object).name();
}else if(object instanceof LocalDateTime){
LocalDateTime convert = (LocalDateTime) object;
return new org.joda.time.LocalDateTime(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth(),convert.getHour(),convert.getMinute(),convert.getSecond(), convert.get(ChronoField.MILLI_OF_SECOND));
}else if(object instanceof LocalDate){
LocalDate convert = (LocalDate) object;
return new org.joda.time.LocalDate(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth());
}else if(object instanceof ZonedDateTime){
ZonedDateTime convert = (ZonedDateTime) object;
return new org.joda.time.DateTime(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth(),convert.getHour(),convert.getMinute(),convert.getSecond(), convert.get(ChronoField.MILLI_OF_SECOND), DateTimeZone.forID(convert.getZone().getId()));
} else if (object instanceof OffsetDateTime) {
OffsetDateTime obj = (OffsetDateTime) object;
// Keep the same instant when converting to date time
ZonedDateTime convert = obj.toZonedDateTime();
org.joda.time.DateTime dt = new org.joda.time.DateTime(convert.getYear(),
convert.getMonthValue(),
convert.getDayOfMonth(),
convert.getHour(),
convert.getMinute(),
convert.getSecond(),
convert.get(ChronoField.MILLI_OF_SECOND),
DateTimeZone.forID(convert.getZone().getId()));
return dt;
} else if (object instanceof Instant) {
Instant convert = (Instant) object;
org.joda.time.Instant i = org.joda.time.Instant.parse(convert.toString());
return i.toDateTime();
}
return object;
} } | public class class_name {
protected Object convertToAsyncDriverTypes(Object object){
if(object instanceof Enum){
return ((Enum)object).name(); // depends on control dependency: [if], data = [none]
}else if(object instanceof LocalDateTime){
LocalDateTime convert = (LocalDateTime) object;
return new org.joda.time.LocalDateTime(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth(),convert.getHour(),convert.getMinute(),convert.getSecond(), convert.get(ChronoField.MILLI_OF_SECOND)); // depends on control dependency: [if], data = [none]
}else if(object instanceof LocalDate){
LocalDate convert = (LocalDate) object;
return new org.joda.time.LocalDate(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth()); // depends on control dependency: [if], data = [none]
}else if(object instanceof ZonedDateTime){
ZonedDateTime convert = (ZonedDateTime) object;
return new org.joda.time.DateTime(convert.getYear(),convert.getMonthValue(),convert.getDayOfMonth(),convert.getHour(),convert.getMinute(),convert.getSecond(), convert.get(ChronoField.MILLI_OF_SECOND), DateTimeZone.forID(convert.getZone().getId())); // depends on control dependency: [if], data = [none]
} else if (object instanceof OffsetDateTime) {
OffsetDateTime obj = (OffsetDateTime) object;
// Keep the same instant when converting to date time
ZonedDateTime convert = obj.toZonedDateTime();
org.joda.time.DateTime dt = new org.joda.time.DateTime(convert.getYear(),
convert.getMonthValue(),
convert.getDayOfMonth(),
convert.getHour(),
convert.getMinute(),
convert.getSecond(),
convert.get(ChronoField.MILLI_OF_SECOND),
DateTimeZone.forID(convert.getZone().getId()));
return dt; // depends on control dependency: [if], data = [none]
} else if (object instanceof Instant) {
Instant convert = (Instant) object;
org.joda.time.Instant i = org.joda.time.Instant.parse(convert.toString());
return i.toDateTime(); // depends on control dependency: [if], data = [none]
}
return object;
} } |
public class class_name {
@Override
public long getCumulativeJobInstancesCount()
{
DbConn em2 = Helpers.getNewDbSession();
try
{
return em2.runSelectSingle("history_select_count_for_poller", Long.class, this.queue.getId(), this.engine.getNode().getId());
}
finally
{
Helpers.closeQuietly(em2);
}
} } | public class class_name {
@Override
public long getCumulativeJobInstancesCount()
{
DbConn em2 = Helpers.getNewDbSession();
try
{
return em2.runSelectSingle("history_select_count_for_poller", Long.class, this.queue.getId(), this.engine.getNode().getId()); // depends on control dependency: [try], data = [none]
}
finally
{
Helpers.closeQuietly(em2);
}
} } |
public class class_name {
public JsonObject getAsObject(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonObject()), false);
}
return get(property).getAsObject();
} } | public class class_name {
public JsonObject getAsObject(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonObject()), false); // depends on control dependency: [if], data = [none]
}
return get(property).getAsObject();
} } |
public class class_name {
@Override
public String getInitParameter(String name) {
FilterConfig fc = getFilterConfig();
if (fc == null) {
throw new IllegalStateException(
lStrings.getString("err.filter_config_not_initialized"));
}
return fc.getInitParameter(name);
} } | public class class_name {
@Override
public String getInitParameter(String name) {
FilterConfig fc = getFilterConfig();
if (fc == null) {
throw new IllegalStateException(
lStrings.getString("err.filter_config_not_initialized"));
}
return fc.getInitParameter(name); // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public static Integer getRedirectPort(String host, int httpPort) {
Integer httpsPort = null;
synchronized (map) {
if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) {
// use default redirect of 80 to 443
httpsPort = DEFAULT_HTTPS_PORT;
} else {
Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort);
if (redirectsForThisPort != null) {
HttpProxyRedirect hdr = redirectsForThisPort.get(host);
if (hdr == null) {
hdr = redirectsForThisPort.get(STAR);
}
if (hdr != null && hdr.enabled) {
httpsPort = hdr.httpsPort;
}
}
}
}
return httpsPort;
} } | public class class_name {
public static Integer getRedirectPort(String host, int httpPort) {
Integer httpsPort = null;
synchronized (map) {
if (httpPort == DEFAULT_HTTP_PORT && map.get(httpPort) == null) {
// use default redirect of 80 to 443
httpsPort = DEFAULT_HTTPS_PORT; // depends on control dependency: [if], data = [none]
} else {
Map<String, HttpProxyRedirect> redirectsForThisPort = map.get(httpPort);
if (redirectsForThisPort != null) {
HttpProxyRedirect hdr = redirectsForThisPort.get(host);
if (hdr == null) {
hdr = redirectsForThisPort.get(STAR); // depends on control dependency: [if], data = [none]
}
if (hdr != null && hdr.enabled) {
httpsPort = hdr.httpsPort; // depends on control dependency: [if], data = [none]
}
}
}
}
return httpsPort;
} } |
public class class_name {
public static Date fromISODate(final String val) throws BadDateException {
try {
synchronized (isoDateFormat) {
try {
isoDateFormat.setTimeZone(Timezones.getDefaultTz());
} catch (TimezonesException tze) {
throw new RuntimeException(tze);
}
return isoDateFormat.parse(val);
}
} catch (Throwable t) {
throw new BadDateException();
}
} } | public class class_name {
public static Date fromISODate(final String val) throws BadDateException {
try {
synchronized (isoDateFormat) {
try {
isoDateFormat.setTimeZone(Timezones.getDefaultTz()); // depends on control dependency: [try], data = [none]
} catch (TimezonesException tze) {
throw new RuntimeException(tze);
} // depends on control dependency: [catch], data = [none]
return isoDateFormat.parse(val);
}
} catch (Throwable t) {
throw new BadDateException();
}
} } |
public class class_name {
public java.util.List<QueryInfo> getQueries() {
if (queries == null) {
queries = new com.amazonaws.internal.SdkInternalList<QueryInfo>();
}
return queries;
} } | public class class_name {
public java.util.List<QueryInfo> getQueries() {
if (queries == null) {
queries = new com.amazonaws.internal.SdkInternalList<QueryInfo>(); // depends on control dependency: [if], data = [none]
}
return queries;
} } |
public class class_name {
private DocumentedFeature getDocumentedFeatureForClass(final Class<?> clazz) {
if (clazz != null && clazz.isAnnotationPresent(DocumentedFeature.class)) {
return clazz.getAnnotation(DocumentedFeature.class);
}
else {
return null;
}
} } | public class class_name {
private DocumentedFeature getDocumentedFeatureForClass(final Class<?> clazz) {
if (clazz != null && clazz.isAnnotationPresent(DocumentedFeature.class)) {
return clazz.getAnnotation(DocumentedFeature.class); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
validateConfiguration(preReleaseGoals, postReleaseGoals);
try {
// check uncommitted changes
checkUncommittedChanges();
// git for-each-ref --format='%(refname:short)' refs/heads/release/*
final String releaseBranch = gitFindBranches(
gitFlowConfig.getReleaseBranchPrefix(), false).trim();
if (StringUtils.isBlank(releaseBranch)) {
throw new MojoFailureException("There is no release branch.");
} else if (StringUtils.countMatches(releaseBranch,
gitFlowConfig.getReleaseBranchPrefix()) > 1) {
throw new MojoFailureException(
"More than one release branch exists. Cannot finish release.");
}
// check snapshots dependencies
if (!allowSnapshots) {
gitCheckout(releaseBranch);
checkSnapshotDependencies();
}
if (fetchRemote) {
// fetch and check remote
gitFetchRemoteAndCompare(releaseBranch);
// checkout from remote if doesn't exist
gitFetchRemoteAndCreate(gitFlowConfig.getDevelopmentBranch());
// fetch and check remote
gitFetchRemoteAndCompare(gitFlowConfig.getDevelopmentBranch());
if (notSameProdDevName()) {
// checkout from remote if doesn't exist
gitFetchRemoteAndCreate(gitFlowConfig.getProductionBranch());
// fetch and check remote
gitFetchRemoteAndCompare(gitFlowConfig
.getProductionBranch());
}
}
// git checkout release/...
gitCheckout(releaseBranch);
if (!skipTestProject) {
// mvn clean test
mvnCleanTest();
}
// maven goals before merge
if (StringUtils.isNotBlank(preReleaseGoals)) {
mvnRun(preReleaseGoals);
}
String currentReleaseVersion = getCurrentProjectVersion();
Map<String, String> messageProperties = new HashMap<String, String>();
messageProperties.put("version", currentReleaseVersion);
if (useSnapshotInRelease && ArtifactUtils.isSnapshot(currentReleaseVersion)) {
String commitVersion = currentReleaseVersion.replace("-" + Artifact.SNAPSHOT_VERSION, "");
mvnSetVersions(commitVersion);
messageProperties.put("version", commitVersion);
gitCommit(commitMessages.getReleaseFinishMessage(), messageProperties);
}
// git checkout master
gitCheckout(gitFlowConfig.getProductionBranch());
gitMerge(releaseBranch, releaseRebase, releaseMergeNoFF, releaseMergeFFOnly,
commitMessages.getReleaseFinishMergeMessage(), messageProperties);
// get current project version from pom
final String currentVersion = getCurrentProjectVersion();
if (!skipTag) {
String tagVersion = currentVersion;
if ((tychoBuild || useSnapshotInRelease) && ArtifactUtils.isSnapshot(currentVersion)) {
tagVersion = currentVersion.replace("-"
+ Artifact.SNAPSHOT_VERSION, "");
}
messageProperties.put("version", tagVersion);
// git tag -a ...
gitTag(gitFlowConfig.getVersionTagPrefix() + tagVersion,
commitMessages.getTagReleaseMessage(), gpgSignTag, messageProperties);
}
// maven goals after merge
if (StringUtils.isNotBlank(postReleaseGoals)) {
mvnRun(postReleaseGoals);
}
if (notSameProdDevName()) {
// git checkout develop
gitCheckout(gitFlowConfig.getDevelopmentBranch());
// get develop version
final String developReleaseVersion = getCurrentProjectVersion();
if (commitDevelopmentVersionAtStart && useSnapshotInRelease) {
// updating develop poms to master version to avoid merge conflicts
mvnSetVersions(currentVersion);
// commit the changes
gitCommit(commitMessages.getUpdateDevToAvoidConflictsMessage());
}
// merge branch master into develop
gitMerge(releaseBranch, releaseRebase, releaseMergeNoFF, false, null, null);
if (commitDevelopmentVersionAtStart && useSnapshotInRelease) {
// updating develop poms version back to pre merge state
mvnSetVersions(developReleaseVersion);
// commit the changes
gitCommit(commitMessages.getUpdateDevBackPreMergeStateMessage());
}
}
if (commitDevelopmentVersionAtStart && !notSameProdDevName()) {
getLog().warn(
"The commitDevelopmentVersionAtStart will not have effect. It can be enabled only when there are separate branches for development and production.");
commitDevelopmentVersionAtStart = false;
}
if (!commitDevelopmentVersionAtStart) {
// get next snapshot version
final String nextSnapshotVersion;
if (!settings.isInteractiveMode()
&& StringUtils.isNotBlank(developmentVersion)) {
nextSnapshotVersion = developmentVersion;
} else {
GitFlowVersionInfo versionInfo = new GitFlowVersionInfo(
currentVersion);
if (digitsOnlyDevVersion) {
versionInfo = versionInfo.digitsVersionInfo();
}
nextSnapshotVersion = versionInfo
.nextSnapshotVersion(versionDigitToIncrement);
}
if (StringUtils.isBlank(nextSnapshotVersion)) {
throw new MojoFailureException(
"Next snapshot version is blank.");
}
// mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false
mvnSetVersions(nextSnapshotVersion);
messageProperties.put("version", nextSnapshotVersion);
// git commit -a -m updating for next development version
gitCommit(commitMessages.getReleaseFinishMessage(), messageProperties);
}
if (installProject) {
// mvn clean install
mvnCleanInstall();
}
if (pushRemote) {
gitPush(gitFlowConfig.getProductionBranch(), !skipTag);
if (notSameProdDevName()) {
gitPush(gitFlowConfig.getDevelopmentBranch(), !skipTag);
}
if (!keepBranch) {
gitPushDelete(releaseBranch);
}
}
if (!keepBranch) {
// git branch -d release/...
gitBranchDelete(releaseBranch);
}
} catch (Exception e) {
throw new MojoFailureException("release-finish", e);
}
} } | public class class_name {
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
validateConfiguration(preReleaseGoals, postReleaseGoals);
try {
// check uncommitted changes
checkUncommittedChanges();
// git for-each-ref --format='%(refname:short)' refs/heads/release/*
final String releaseBranch = gitFindBranches(
gitFlowConfig.getReleaseBranchPrefix(), false).trim();
if (StringUtils.isBlank(releaseBranch)) {
throw new MojoFailureException("There is no release branch.");
} else if (StringUtils.countMatches(releaseBranch,
gitFlowConfig.getReleaseBranchPrefix()) > 1) {
throw new MojoFailureException(
"More than one release branch exists. Cannot finish release.");
}
// check snapshots dependencies
if (!allowSnapshots) {
gitCheckout(releaseBranch); // depends on control dependency: [if], data = [none]
checkSnapshotDependencies(); // depends on control dependency: [if], data = [none]
}
if (fetchRemote) {
// fetch and check remote
gitFetchRemoteAndCompare(releaseBranch); // depends on control dependency: [if], data = [none]
// checkout from remote if doesn't exist
gitFetchRemoteAndCreate(gitFlowConfig.getDevelopmentBranch()); // depends on control dependency: [if], data = [none]
// fetch and check remote
gitFetchRemoteAndCompare(gitFlowConfig.getDevelopmentBranch()); // depends on control dependency: [if], data = [none]
if (notSameProdDevName()) {
// checkout from remote if doesn't exist
gitFetchRemoteAndCreate(gitFlowConfig.getProductionBranch()); // depends on control dependency: [if], data = [none]
// fetch and check remote
gitFetchRemoteAndCompare(gitFlowConfig
.getProductionBranch()); // depends on control dependency: [if], data = [none]
}
}
// git checkout release/...
gitCheckout(releaseBranch);
if (!skipTestProject) {
// mvn clean test
mvnCleanTest(); // depends on control dependency: [if], data = [none]
}
// maven goals before merge
if (StringUtils.isNotBlank(preReleaseGoals)) {
mvnRun(preReleaseGoals); // depends on control dependency: [if], data = [none]
}
String currentReleaseVersion = getCurrentProjectVersion();
Map<String, String> messageProperties = new HashMap<String, String>();
messageProperties.put("version", currentReleaseVersion);
if (useSnapshotInRelease && ArtifactUtils.isSnapshot(currentReleaseVersion)) {
String commitVersion = currentReleaseVersion.replace("-" + Artifact.SNAPSHOT_VERSION, "");
mvnSetVersions(commitVersion); // depends on control dependency: [if], data = [none]
messageProperties.put("version", commitVersion); // depends on control dependency: [if], data = [none]
gitCommit(commitMessages.getReleaseFinishMessage(), messageProperties); // depends on control dependency: [if], data = [none]
}
// git checkout master
gitCheckout(gitFlowConfig.getProductionBranch());
gitMerge(releaseBranch, releaseRebase, releaseMergeNoFF, releaseMergeFFOnly,
commitMessages.getReleaseFinishMergeMessage(), messageProperties);
// get current project version from pom
final String currentVersion = getCurrentProjectVersion();
if (!skipTag) {
String tagVersion = currentVersion;
if ((tychoBuild || useSnapshotInRelease) && ArtifactUtils.isSnapshot(currentVersion)) {
tagVersion = currentVersion.replace("-"
+ Artifact.SNAPSHOT_VERSION, ""); // depends on control dependency: [if], data = [none]
}
messageProperties.put("version", tagVersion); // depends on control dependency: [if], data = [none]
// git tag -a ...
gitTag(gitFlowConfig.getVersionTagPrefix() + tagVersion,
commitMessages.getTagReleaseMessage(), gpgSignTag, messageProperties); // depends on control dependency: [if], data = [none]
}
// maven goals after merge
if (StringUtils.isNotBlank(postReleaseGoals)) {
mvnRun(postReleaseGoals); // depends on control dependency: [if], data = [none]
}
if (notSameProdDevName()) {
// git checkout develop
gitCheckout(gitFlowConfig.getDevelopmentBranch()); // depends on control dependency: [if], data = [none]
// get develop version
final String developReleaseVersion = getCurrentProjectVersion();
if (commitDevelopmentVersionAtStart && useSnapshotInRelease) {
// updating develop poms to master version to avoid merge conflicts
mvnSetVersions(currentVersion); // depends on control dependency: [if], data = [none]
// commit the changes
gitCommit(commitMessages.getUpdateDevToAvoidConflictsMessage()); // depends on control dependency: [if], data = [none]
}
// merge branch master into develop
gitMerge(releaseBranch, releaseRebase, releaseMergeNoFF, false, null, null); // depends on control dependency: [if], data = [none]
if (commitDevelopmentVersionAtStart && useSnapshotInRelease) {
// updating develop poms version back to pre merge state
mvnSetVersions(developReleaseVersion); // depends on control dependency: [if], data = [none]
// commit the changes
gitCommit(commitMessages.getUpdateDevBackPreMergeStateMessage()); // depends on control dependency: [if], data = [none]
}
}
if (commitDevelopmentVersionAtStart && !notSameProdDevName()) {
getLog().warn(
"The commitDevelopmentVersionAtStart will not have effect. It can be enabled only when there are separate branches for development and production."); // depends on control dependency: [if], data = [none]
commitDevelopmentVersionAtStart = false; // depends on control dependency: [if], data = [none]
}
if (!commitDevelopmentVersionAtStart) {
// get next snapshot version
final String nextSnapshotVersion;
if (!settings.isInteractiveMode()
&& StringUtils.isNotBlank(developmentVersion)) {
nextSnapshotVersion = developmentVersion; // depends on control dependency: [if], data = [none]
} else {
GitFlowVersionInfo versionInfo = new GitFlowVersionInfo(
currentVersion);
if (digitsOnlyDevVersion) {
versionInfo = versionInfo.digitsVersionInfo(); // depends on control dependency: [if], data = [none]
}
nextSnapshotVersion = versionInfo
.nextSnapshotVersion(versionDigitToIncrement); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isBlank(nextSnapshotVersion)) {
throw new MojoFailureException(
"Next snapshot version is blank.");
}
// mvn versions:set -DnewVersion=... -DgenerateBackupPoms=false
mvnSetVersions(nextSnapshotVersion); // depends on control dependency: [if], data = [none]
messageProperties.put("version", nextSnapshotVersion); // depends on control dependency: [if], data = [none]
// git commit -a -m updating for next development version
gitCommit(commitMessages.getReleaseFinishMessage(), messageProperties); // depends on control dependency: [if], data = [none]
}
if (installProject) {
// mvn clean install
mvnCleanInstall(); // depends on control dependency: [if], data = [none]
}
if (pushRemote) {
gitPush(gitFlowConfig.getProductionBranch(), !skipTag); // depends on control dependency: [if], data = [none]
if (notSameProdDevName()) {
gitPush(gitFlowConfig.getDevelopmentBranch(), !skipTag); // depends on control dependency: [if], data = [none]
}
if (!keepBranch) {
gitPushDelete(releaseBranch); // depends on control dependency: [if], data = [none]
}
}
if (!keepBranch) {
// git branch -d release/...
gitBranchDelete(releaseBranch); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new MojoFailureException("release-finish", e);
}
} } |
public class class_name {
public void addAdditionalInformation(String key, String value) {
if (this.additionalInformation == null) {
this.additionalInformation = new TreeMap<String, String>();
}
this.additionalInformation.put(key, value);
} } | public class class_name {
public void addAdditionalInformation(String key, String value) {
if (this.additionalInformation == null) {
this.additionalInformation = new TreeMap<String, String>(); // depends on control dependency: [if], data = [none]
}
this.additionalInformation.put(key, value);
} } |
public class class_name {
@Override
public void visitMethod(Method obj) {
methodSignatureIsConstrained = false;
String methodName = obj.getName();
if (!Values.CONSTRUCTOR.equals(methodName) && !Values.STATIC_INITIALIZER.equals(methodName)) {
String methodSig = obj.getSignature();
methodSignatureIsConstrained = methodIsSpecial(methodName, methodSig)
|| methodHasSyntheticTwin(methodName, methodSig);
if (!methodSignatureIsConstrained) {
for (AnnotationEntry entry : obj.getAnnotationEntries()) {
if (CONVERSION_ANNOTATIONS.contains(entry.getAnnotationType())) {
methodSignatureIsConstrained = true;
break;
}
}
}
if (!methodSignatureIsConstrained) {
String parms = methodSig.split("\\(|\\)")[1];
if (parms.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) >= 0) {
outer: for (JavaClass constrainCls : constrainingClasses) {
Method[] methods = constrainCls.getMethods();
for (Method m : methods) {
if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
methodSignatureIsConstrained = true;
break outer;
}
}
}
}
}
}
} } | public class class_name {
@Override
public void visitMethod(Method obj) {
methodSignatureIsConstrained = false;
String methodName = obj.getName();
if (!Values.CONSTRUCTOR.equals(methodName) && !Values.STATIC_INITIALIZER.equals(methodName)) {
String methodSig = obj.getSignature();
methodSignatureIsConstrained = methodIsSpecial(methodName, methodSig)
|| methodHasSyntheticTwin(methodName, methodSig); // depends on control dependency: [if], data = [none]
if (!methodSignatureIsConstrained) {
for (AnnotationEntry entry : obj.getAnnotationEntries()) {
if (CONVERSION_ANNOTATIONS.contains(entry.getAnnotationType())) {
methodSignatureIsConstrained = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
if (!methodSignatureIsConstrained) {
String parms = methodSig.split("\\(|\\)")[1];
if (parms.indexOf(Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR) >= 0) {
outer: for (JavaClass constrainCls : constrainingClasses) {
Method[] methods = constrainCls.getMethods();
for (Method m : methods) {
if (methodName.equals(m.getName()) && methodSig.equals(m.getSignature())) {
methodSignatureIsConstrained = true; // depends on control dependency: [if], data = [none]
break outer;
}
}
}
}
}
}
} } |
public class class_name {
@Override
public CommerceNotificationTemplate fetchByG_T_E_Last(long groupId,
String type, boolean enabled,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
int count = countByG_T_E(groupId, type, enabled);
if (count == 0) {
return null;
}
List<CommerceNotificationTemplate> list = findByG_T_E(groupId, type,
enabled, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommerceNotificationTemplate fetchByG_T_E_Last(long groupId,
String type, boolean enabled,
OrderByComparator<CommerceNotificationTemplate> orderByComparator) {
int count = countByG_T_E(groupId, type, enabled);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommerceNotificationTemplate> list = findByG_T_E(groupId, type,
enabled, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private void fixAfterDeletion(TreeEntry<E> x) {
while (x != root && colorOf(x) == BLACK) {
if (x == leftOf(parentOf(x))) {
TreeEntry<E> sib = rightOf(parentOf(x));
if (colorOf(sib) == RED) {
setColor(sib, BLACK);
setColor(parentOf(x), RED);
rotateLeft(parentOf(x));
sib = rightOf(parentOf(x));
}
if (colorOf(leftOf(sib)) == BLACK
&& colorOf(rightOf(sib)) == BLACK) {
setColor(sib, RED);
x = parentOf(x);
} else {
if (colorOf(rightOf(sib)) == BLACK) {
setColor(leftOf(sib), BLACK);
setColor(sib, RED);
rotateRight(sib);
sib = rightOf(parentOf(x));
}
setColor(sib, colorOf(parentOf(x)));
setColor(parentOf(x), BLACK);
setColor(rightOf(sib), BLACK);
rotateLeft(parentOf(x));
x = root;
}
} else { // symmetric
TreeEntry<E> sib = leftOf(parentOf(x));
if (colorOf(sib) == RED) {
setColor(sib, BLACK);
setColor(parentOf(x), RED);
rotateRight(parentOf(x));
sib = leftOf(parentOf(x));
}
if (colorOf(rightOf(sib)) == BLACK
&& colorOf(leftOf(sib)) == BLACK) {
setColor(sib, RED);
x = parentOf(x);
} else {
if (colorOf(leftOf(sib)) == BLACK) {
setColor(rightOf(sib), BLACK);
setColor(sib, RED);
rotateLeft(sib);
sib = leftOf(parentOf(x));
}
setColor(sib, colorOf(parentOf(x)));
setColor(parentOf(x), BLACK);
setColor(leftOf(sib), BLACK);
rotateRight(parentOf(x));
x = root;
}
}
}
setColor(x, BLACK);
} } | public class class_name {
private void fixAfterDeletion(TreeEntry<E> x) {
while (x != root && colorOf(x) == BLACK) {
if (x == leftOf(parentOf(x))) {
TreeEntry<E> sib = rightOf(parentOf(x));
if (colorOf(sib) == RED) {
setColor(sib, BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(x), RED); // depends on control dependency: [if], data = [RED)]
rotateLeft(parentOf(x)); // depends on control dependency: [if], data = [none]
sib = rightOf(parentOf(x)); // depends on control dependency: [if], data = [none]
}
if (colorOf(leftOf(sib)) == BLACK
&& colorOf(rightOf(sib)) == BLACK) {
setColor(sib, RED); // depends on control dependency: [if], data = [none]
x = parentOf(x); // depends on control dependency: [if], data = [none]
} else {
if (colorOf(rightOf(sib)) == BLACK) {
setColor(leftOf(sib), BLACK); // depends on control dependency: [if], data = [BLACK)]
setColor(sib, RED); // depends on control dependency: [if], data = [none]
rotateRight(sib); // depends on control dependency: [if], data = [none]
sib = rightOf(parentOf(x)); // depends on control dependency: [if], data = [none]
}
setColor(sib, colorOf(parentOf(x))); // depends on control dependency: [if], data = [none]
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [BLACK]
setColor(rightOf(sib), BLACK); // depends on control dependency: [if], data = [BLACK]
rotateLeft(parentOf(x)); // depends on control dependency: [if], data = [none]
x = root; // depends on control dependency: [if], data = [none]
}
} else { // symmetric
TreeEntry<E> sib = leftOf(parentOf(x));
if (colorOf(sib) == RED) {
setColor(sib, BLACK); // depends on control dependency: [if], data = [none]
setColor(parentOf(x), RED); // depends on control dependency: [if], data = [RED)]
rotateRight(parentOf(x)); // depends on control dependency: [if], data = [none]
sib = leftOf(parentOf(x)); // depends on control dependency: [if], data = [none]
}
if (colorOf(rightOf(sib)) == BLACK
&& colorOf(leftOf(sib)) == BLACK) {
setColor(sib, RED); // depends on control dependency: [if], data = [none]
x = parentOf(x); // depends on control dependency: [if], data = [none]
} else {
if (colorOf(leftOf(sib)) == BLACK) {
setColor(rightOf(sib), BLACK); // depends on control dependency: [if], data = [BLACK)]
setColor(sib, RED); // depends on control dependency: [if], data = [none]
rotateLeft(sib); // depends on control dependency: [if], data = [none]
sib = leftOf(parentOf(x)); // depends on control dependency: [if], data = [none]
}
setColor(sib, colorOf(parentOf(x))); // depends on control dependency: [if], data = [none]
setColor(parentOf(x), BLACK); // depends on control dependency: [if], data = [BLACK]
setColor(leftOf(sib), BLACK); // depends on control dependency: [if], data = [BLACK]
rotateRight(parentOf(x)); // depends on control dependency: [if], data = [none]
x = root; // depends on control dependency: [if], data = [none]
}
}
}
setColor(x, BLACK);
} } |
public class class_name {
public static <T extends XNSerializable> List<T> parseList(XNElement container,
String itemName, Supplier<T> creator) {
List<T> result = new ArrayList<>();
for (XNElement e : container.childrenWithName(itemName)) {
T obj = creator.get();
obj.load(e);
result.add(obj);
}
return result;
} } | public class class_name {
public static <T extends XNSerializable> List<T> parseList(XNElement container,
String itemName, Supplier<T> creator) {
List<T> result = new ArrayList<>();
for (XNElement e : container.childrenWithName(itemName)) {
T obj = creator.get();
obj.load(e); // depends on control dependency: [for], data = [e]
result.add(obj); // depends on control dependency: [for], data = [e]
}
return result;
} } |
public class class_name {
public PresenceSubscriber addBuddy(String uri, int duration, String eventId, long timeout) {
initErrorInfo();
if (buddyList.get(uri) != null) {
setReturnCode(SipSession.INVALID_ARGUMENT);
setErrorMessage("addBuddy() called but buddy is already in the list");
return null;
}
try {
PresenceSubscriber sub = new PresenceSubscriber(uri, this);
Request req = sub.createSubscribeMessage(duration, eventId);
if (req != null) {
synchronized (buddyList) {
buddyList.put(uri, sub);
}
if (sub.startSubscription(req, timeout, proxyHost != null) == true) {
synchronized (buddyList) {
buddyTerminatedList.remove(uri); // in case it was
// there
// from before
}
return sub;
}
}
setReturnCode(sub.getReturnCode());
setErrorMessage(sub.getErrorMessage());
setException(sub.getException());
} catch (Exception e) {
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
setException(e);
setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage());
}
synchronized (buddyList) {
buddyList.remove(uri);
}
return null;
} } | public class class_name {
public PresenceSubscriber addBuddy(String uri, int duration, String eventId, long timeout) {
initErrorInfo();
if (buddyList.get(uri) != null) {
setReturnCode(SipSession.INVALID_ARGUMENT); // depends on control dependency: [if], data = [none]
setErrorMessage("addBuddy() called but buddy is already in the list"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
try {
PresenceSubscriber sub = new PresenceSubscriber(uri, this);
Request req = sub.createSubscribeMessage(duration, eventId);
if (req != null) {
synchronized (buddyList) { // depends on control dependency: [if], data = [none]
buddyList.put(uri, sub);
}
if (sub.startSubscription(req, timeout, proxyHost != null) == true) {
synchronized (buddyList) { // depends on control dependency: [if], data = [none]
buddyTerminatedList.remove(uri); // in case it was
// there
// from before
}
return sub; // depends on control dependency: [if], data = [none]
}
}
setReturnCode(sub.getReturnCode()); // depends on control dependency: [try], data = [none]
setErrorMessage(sub.getErrorMessage()); // depends on control dependency: [try], data = [none]
setException(sub.getException()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
setReturnCode(SipSession.EXCEPTION_ENCOUNTERED);
setException(e);
setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
synchronized (buddyList) {
buddyList.remove(uri);
}
return null;
} } |
public class class_name {
public void bind(SQLiteStatement statement) {
if (this.compiledStatement != null) {
// already binded
return;
}
int index = 1;
statement.clearBindings();
Object value;
for (int j = 0; j < args.size(); j++) {
value = args.get(j);
switch (valueType.get(index - 1)) {
case BOOLEAN:
statement.bindLong(index, (long) (((Boolean) value) == true ? 1 : 0));
break;
case BYTE:
statement.bindLong(index, (byte) value);
break;
case SHORT:
statement.bindLong(index, (short) value);
break;
case INTEGER:
statement.bindLong(index, (int) value);
break;
case CHARACTER:
statement.bindLong(index, Character.getNumericValue((char)value));
break;
case LONG:
statement.bindLong(index, (long) value);
break;
case BYTE_ARRAY:
statement.bindBlob(index, (byte[]) value);
break;
case FLOAT:
statement.bindDouble(index, (float) value);
break;
case DOUBLE:
statement.bindDouble(index, (double) value);
break;
case NULL:
statement.bindNull(index);
break;
case STRING:
statement.bindString(index, (String) value);
break;
}
index++;
}
for (int i = 0; i < whereArgs.size(); i++, index++) {
statement.bindString(index, whereArgs.get(i));
}
} } | public class class_name {
public void bind(SQLiteStatement statement) {
if (this.compiledStatement != null) {
// already binded
return; // depends on control dependency: [if], data = [none]
}
int index = 1;
statement.clearBindings();
Object value;
for (int j = 0; j < args.size(); j++) {
value = args.get(j); // depends on control dependency: [for], data = [j]
switch (valueType.get(index - 1)) {
case BOOLEAN:
statement.bindLong(index, (long) (((Boolean) value) == true ? 1 : 0)); // depends on control dependency: [for], data = [none]
break;
case BYTE:
statement.bindLong(index, (byte) value); // depends on control dependency: [for], data = [none]
break;
case SHORT:
statement.bindLong(index, (short) value); // depends on control dependency: [for], data = [none]
break;
case INTEGER:
statement.bindLong(index, (int) value); // depends on control dependency: [for], data = [none]
break;
case CHARACTER:
statement.bindLong(index, Character.getNumericValue((char)value)); // depends on control dependency: [for], data = [none]
break;
case LONG:
statement.bindLong(index, (long) value); // depends on control dependency: [for], data = [none]
break;
case BYTE_ARRAY:
statement.bindBlob(index, (byte[]) value);
break;
case FLOAT:
statement.bindDouble(index, (float) value); // depends on control dependency: [for], data = [none]
break;
case DOUBLE:
statement.bindDouble(index, (double) value); // depends on control dependency: [for], data = [none]
break;
case NULL:
statement.bindNull(index); // depends on control dependency: [for], data = [none]
break;
case STRING:
statement.bindString(index, (String) value); // depends on control dependency: [for], data = [none]
break;
}
index++;
}
for (int i = 0; i < whereArgs.size(); i++, index++) {
statement.bindString(index, whereArgs.get(i));
}
} } |
public class class_name {
@Override
public void processComponent(String propertyName, JComponent component) {
if (component instanceof JComboBox) {
this.installSearchable((JComboBox) component);
} else if (component instanceof JList) {
this.installSearchable((JList) component);
} else if (component instanceof JTable) {
this.installSearchable((JTable) component);
} else if (component instanceof JTextComponent) {
this.installSearchable((JTextComponent) component);
}
} } | public class class_name {
@Override
public void processComponent(String propertyName, JComponent component) {
if (component instanceof JComboBox) {
this.installSearchable((JComboBox) component); // depends on control dependency: [if], data = [none]
} else if (component instanceof JList) {
this.installSearchable((JList) component); // depends on control dependency: [if], data = [none]
} else if (component instanceof JTable) {
this.installSearchable((JTable) component); // depends on control dependency: [if], data = [none]
} else if (component instanceof JTextComponent) {
this.installSearchable((JTextComponent) component); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void callCallbacks(Event event, CallbackType type) throws CancelledException, AsyncException {
String trigger = event.name;
if (type == CallbackType.LEAVE_STATE) trigger = event.src;
else if (type == CallbackType.ENTER_STATE) trigger = event.dst;
Callback[] callbacks = new Callback[] {
this.callbacks.get(new CallbackKey(trigger, type)), //Primary
this.callbacks.get(new CallbackKey("", type)), //General
};
for (Callback callback : callbacks) {
if (callback != null) {
callback.run(event);
if (type == CallbackType.LEAVE_STATE) {
if (event.cancelled) {
transition = null;
throw new CancelledException(event.error);
} else if (event.async) {
throw new AsyncException(event.error);
}
} else if (type == CallbackType.BEFORE_EVENT) {
if (event.cancelled) {
throw new CancelledException(event.error);
}
}
}
}
} } | public class class_name {
public void callCallbacks(Event event, CallbackType type) throws CancelledException, AsyncException {
String trigger = event.name;
if (type == CallbackType.LEAVE_STATE) trigger = event.src;
else if (type == CallbackType.ENTER_STATE) trigger = event.dst;
Callback[] callbacks = new Callback[] {
this.callbacks.get(new CallbackKey(trigger, type)), //Primary
this.callbacks.get(new CallbackKey("", type)), //General
};
for (Callback callback : callbacks) {
if (callback != null) {
callback.run(event); // depends on control dependency: [if], data = [none]
if (type == CallbackType.LEAVE_STATE) {
if (event.cancelled) {
transition = null; // depends on control dependency: [if], data = [none]
throw new CancelledException(event.error);
} else if (event.async) {
throw new AsyncException(event.error);
}
} else if (type == CallbackType.BEFORE_EVENT) {
if (event.cancelled) {
throw new CancelledException(event.error);
}
}
}
}
} } |
public class class_name {
public String events(EventCondition condition) {
String description = "event on: " + condition.getDataId();
if (condition.getExpression() != null) {
description += " [" + condition.getExpression() + "]";
}
return description;
} } | public class class_name {
public String events(EventCondition condition) {
String description = "event on: " + condition.getDataId();
if (condition.getExpression() != null) {
description += " [" + condition.getExpression() + "]"; // depends on control dependency: [if], data = [none]
}
return description;
} } |
public class class_name {
public boolean matches(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return itemName.equals(pattern);
}
String firstPart = pattern.substring(0, index);
int indexFirstPart = itemName.indexOf(firstPart, 0);
if (indexFirstPart == -1) {
return false;
}
String secondPart = pattern.substring(index + 1);
int indexSecondPart = itemName.indexOf(secondPart, index + 1);
return (indexSecondPart != -1);
} } | public class class_name {
public boolean matches(String pattern, String itemName) {
int index = pattern.indexOf('*');
if (index == -1) {
return itemName.equals(pattern); // depends on control dependency: [if], data = [none]
}
String firstPart = pattern.substring(0, index);
int indexFirstPart = itemName.indexOf(firstPart, 0);
if (indexFirstPart == -1) {
return false; // depends on control dependency: [if], data = [none]
}
String secondPart = pattern.substring(index + 1);
int indexSecondPart = itemName.indexOf(secondPart, index + 1);
return (indexSecondPart != -1);
} } |
public class class_name {
public DataSource getDataSource() {
if(dataSource == null) {
LOG.info("Having to construct a new DataSource");
dataSource = new DataSource();
dataSource.setDriverClassName(dbSettings.getDriver());
dataSource.setUrl(dbSettings.getJdbcUrl());
dataSource.setUsername(dbSettings.getUser());
dataSource.setPassword(dbSettings.getPass());
dataSource.setMaxActive(dbSettings.getMaxActive());
dataSource.setMaxIdle(dbSettings.getMaxIdle());
dataSource.setMinIdle(dbSettings.getMinIdle());
dataSource.setInitialSize(dbSettings.getInitialSize());
dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow());
dataSource.setTestOnReturn(dbSettings.getTestOnReturn());
dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle());
dataSource.setValidationQuery(dbSettings.getValidationQuery());
dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors());
// a catch-all for any other properties that are needed
dataSource.setDbProperties(dbSettings.getProperties());
}
return dataSource;
} } | public class class_name {
public DataSource getDataSource() {
if(dataSource == null) {
LOG.info("Having to construct a new DataSource"); // depends on control dependency: [if], data = [none]
dataSource = new DataSource(); // depends on control dependency: [if], data = [none]
dataSource.setDriverClassName(dbSettings.getDriver()); // depends on control dependency: [if], data = [none]
dataSource.setUrl(dbSettings.getJdbcUrl()); // depends on control dependency: [if], data = [none]
dataSource.setUsername(dbSettings.getUser()); // depends on control dependency: [if], data = [none]
dataSource.setPassword(dbSettings.getPass()); // depends on control dependency: [if], data = [none]
dataSource.setMaxActive(dbSettings.getMaxActive()); // depends on control dependency: [if], data = [none]
dataSource.setMaxIdle(dbSettings.getMaxIdle()); // depends on control dependency: [if], data = [none]
dataSource.setMinIdle(dbSettings.getMinIdle()); // depends on control dependency: [if], data = [none]
dataSource.setInitialSize(dbSettings.getInitialSize()); // depends on control dependency: [if], data = [none]
dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow()); // depends on control dependency: [if], data = [none]
dataSource.setTestOnReturn(dbSettings.getTestOnReturn()); // depends on control dependency: [if], data = [none]
dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle()); // depends on control dependency: [if], data = [none]
dataSource.setValidationQuery(dbSettings.getValidationQuery()); // depends on control dependency: [if], data = [none]
dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors()); // depends on control dependency: [if], data = [none]
// a catch-all for any other properties that are needed
dataSource.setDbProperties(dbSettings.getProperties()); // depends on control dependency: [if], data = [none]
}
return dataSource;
} } |
public class class_name {
@Override
public Object get(String propName) {
if (propName.equals(PROP_PRINCIPAL_NAME)) {
return getPrincipalName();
}
if (propName.equals(PROP_PASSWORD)) {
return getPassword();
}
if (propName.equals(PROP_REALM)) {
return getRealm();
}
if (propName.equals(PROP_CERTIFICATE)) {
return getCertificate();
}
return super.get(propName);
} } | public class class_name {
@Override
public Object get(String propName) {
if (propName.equals(PROP_PRINCIPAL_NAME)) {
return getPrincipalName(); // depends on control dependency: [if], data = [none]
}
if (propName.equals(PROP_PASSWORD)) {
return getPassword(); // depends on control dependency: [if], data = [none]
}
if (propName.equals(PROP_REALM)) {
return getRealm(); // depends on control dependency: [if], data = [none]
}
if (propName.equals(PROP_CERTIFICATE)) {
return getCertificate(); // depends on control dependency: [if], data = [none]
}
return super.get(propName);
} } |
public class class_name {
private boolean isValidTreeType(Tree t) {
if (t instanceof LambdaExpressionTree) {
return true;
}
if (t instanceof ClassTree) {
NestingKind nestingKind = ASTHelpers.getSymbol((ClassTree) t).getNestingKind();
return nestingKind.equals(NestingKind.ANONYMOUS) || nestingKind.equals(NestingKind.LOCAL);
}
return false;
} } | public class class_name {
private boolean isValidTreeType(Tree t) {
if (t instanceof LambdaExpressionTree) {
return true; // depends on control dependency: [if], data = [none]
}
if (t instanceof ClassTree) {
NestingKind nestingKind = ASTHelpers.getSymbol((ClassTree) t).getNestingKind();
return nestingKind.equals(NestingKind.ANONYMOUS) || nestingKind.equals(NestingKind.LOCAL); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public PersistenceBroker getInnermostDelegate()
{
PersistenceBroker broker = this.m_broker;
while (broker != null && broker instanceof DelegatingPersistenceBroker)
{
broker = ((DelegatingPersistenceBroker) broker).getDelegate();
if (this == broker)
{
return null;
}
}
return broker;
} } | public class class_name {
public PersistenceBroker getInnermostDelegate()
{
PersistenceBroker broker = this.m_broker;
while (broker != null && broker instanceof DelegatingPersistenceBroker)
{
broker = ((DelegatingPersistenceBroker) broker).getDelegate();
// depends on control dependency: [while], data = [none]
if (this == broker)
{
return null;
// depends on control dependency: [if], data = [none]
}
}
return broker;
} } |
public class class_name {
public void init() {
WfdLog.d(TAG, "Called init()");
initAndStartHandler();
try {
mPort = this.requestAvailablePortFromOs();
} catch (IOException e) {
mListener.onError();
return;
}
mManager = (WifiP2pManager) mContext.getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(mContext, Looper.getMainLooper(), new WifiP2pManager.ChannelListener() {
@Override
public void onChannelDisconnected() {
WfdLog.d(TAG, "Channel disconnected");
}
});
mReceiver.register(mContext);
NineBus.get().register(this);
} } | public class class_name {
public void init() {
WfdLog.d(TAG, "Called init()");
initAndStartHandler();
try {
mPort = this.requestAvailablePortFromOs(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
mListener.onError();
return;
} // depends on control dependency: [catch], data = [none]
mManager = (WifiP2pManager) mContext.getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(mContext, Looper.getMainLooper(), new WifiP2pManager.ChannelListener() {
@Override
public void onChannelDisconnected() {
WfdLog.d(TAG, "Channel disconnected");
}
});
mReceiver.register(mContext);
NineBus.get().register(this);
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected <T extends Object> T extractFieldValue(
final JSONObject jsonObject, final String field, final Class<T> fieldType) {
T fieldValue = null;
if ((jsonObject != null) && jsonObject.has(field) && !jsonObject.isNull(field)) {
try {
if (fieldType == String.class) {
fieldValue = (T) jsonObject.getString(field);
} else if (fieldType == Integer.class) {
fieldValue = (T) Integer.valueOf(jsonObject.getInt(field));
} else if (fieldType == Long.class) {
fieldValue = (T) Long.valueOf(jsonObject.getLong(field));
} else if (fieldType == Float.class) {
fieldValue = (T) Float.valueOf(Double.toString(jsonObject.getDouble(field)));
} else if (fieldType == JSONArray.class) {
fieldValue = (T) jsonObject.getJSONArray(field);
} else if (fieldType == JSONObject.class) {
fieldValue = (T) jsonObject.getJSONObject(field);
} else {
fieldValue = (T) jsonObject.get(field);
}
} catch (final JSONException | ClassCastException e) {
// TODO Log a warning
}
}
return fieldValue;
} } | public class class_name {
@SuppressWarnings("unchecked")
protected <T extends Object> T extractFieldValue(
final JSONObject jsonObject, final String field, final Class<T> fieldType) {
T fieldValue = null;
if ((jsonObject != null) && jsonObject.has(field) && !jsonObject.isNull(field)) {
try {
if (fieldType == String.class) {
fieldValue = (T) jsonObject.getString(field); // depends on control dependency: [if], data = [none]
} else if (fieldType == Integer.class) {
fieldValue = (T) Integer.valueOf(jsonObject.getInt(field)); // depends on control dependency: [if], data = [none]
} else if (fieldType == Long.class) {
fieldValue = (T) Long.valueOf(jsonObject.getLong(field)); // depends on control dependency: [if], data = [none]
} else if (fieldType == Float.class) {
fieldValue = (T) Float.valueOf(Double.toString(jsonObject.getDouble(field))); // depends on control dependency: [if], data = [none]
} else if (fieldType == JSONArray.class) {
fieldValue = (T) jsonObject.getJSONArray(field); // depends on control dependency: [if], data = [none]
} else if (fieldType == JSONObject.class) {
fieldValue = (T) jsonObject.getJSONObject(field); // depends on control dependency: [if], data = [none]
} else {
fieldValue = (T) jsonObject.get(field); // depends on control dependency: [if], data = [none]
}
} catch (final JSONException | ClassCastException e) {
// TODO Log a warning
} // depends on control dependency: [catch], data = [none]
}
return fieldValue;
} } |
public class class_name {
public static Collection<Info> getPendingCollaborations(BoxAPIConnection api) {
URL url = PENDING_COLLABORATIONS_URL.build(api.getBaseURL());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int entriesCount = responseJSON.get("total_count").asInt();
Collection<BoxCollaboration.Info> collaborations = new ArrayList<BoxCollaboration.Info>(entriesCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue entry : entries) {
JsonObject entryObject = entry.asObject();
BoxCollaboration collaboration = new BoxCollaboration(api, entryObject.get("id").asString());
BoxCollaboration.Info info = collaboration.new Info(entryObject);
collaborations.add(info);
}
return collaborations;
} } | public class class_name {
public static Collection<Info> getPendingCollaborations(BoxAPIConnection api) {
URL url = PENDING_COLLABORATIONS_URL.build(api.getBaseURL());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int entriesCount = responseJSON.get("total_count").asInt();
Collection<BoxCollaboration.Info> collaborations = new ArrayList<BoxCollaboration.Info>(entriesCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue entry : entries) {
JsonObject entryObject = entry.asObject();
BoxCollaboration collaboration = new BoxCollaboration(api, entryObject.get("id").asString());
BoxCollaboration.Info info = collaboration.new Info(entryObject);
collaborations.add(info); // depends on control dependency: [for], data = [none]
}
return collaborations;
} } |
public class class_name {
private boolean checkFileNHeader(final InputStream is, final StreamParseWriter dout, StreamData din, int cidx)
throws IOException {
byte[] headerBytes = ZipUtil.unzipForHeader(din.getChunkData(cidx), this._setup._chunk_size);
ParseSetup ps = ParseSetup.guessSetup(null, headerBytes, new ParseSetup(GUESS_INFO, ParseSetup.GUESS_SEP,
this._setup._single_quotes, ParseSetup.GUESS_HEADER, ParseSetup.GUESS_COL_CNT, null, null));
// check to make sure datasets in file belong to the same dataset
// just check for number for number of columns/separator here. Ignore the column type, user can force it
if ((this._setup._number_columns != ps._number_columns) || (this._setup._separator != ps._separator)) {
String warning = "Your zip file contains a file that belong to another dataset with different " +
"number of column or separator. Number of columns for files that have been parsed = "+
this._setup._number_columns + ". Number of columns in new file = "+ps._number_columns+
". This new file is skipped and not parsed.";
dout.addError(new ParseWriter.ParseErr(warning, -1, -1L, -2L));
// something is wrong
return false;
} else {
// assume column names must appear in the first file. If column names appear in first and other
// files, they will be recognized. Otherwise, if no column name ever appear in the first file, the other
// column names in the other files will not be recognized.
if (ps._check_header == ParseSetup.HAS_HEADER) {
if (this._setup._column_names != null) {
// found header in later files, only incorporate it if the column names are the same as before
String[] thisColumnName = this._setup.getColumnNames();
String[] psColumnName = ps.getColumnNames();
Boolean sameColumnNames = true;
for (int index = 0; index < this._setup._number_columns; index++) {
if (!(thisColumnName[index].equals(psColumnName[index]))) {
sameColumnNames = false;
break;
}
}
if (sameColumnNames) // only recognize current file header if it has the same column names as previous files
this._setup.setCheckHeader(ps._check_header);
}
} else // should refresh _setup with correct check_header
this._setup.setCheckHeader(ps._check_header);
}
return true; // everything is fine
} } | public class class_name {
private boolean checkFileNHeader(final InputStream is, final StreamParseWriter dout, StreamData din, int cidx)
throws IOException {
byte[] headerBytes = ZipUtil.unzipForHeader(din.getChunkData(cidx), this._setup._chunk_size);
ParseSetup ps = ParseSetup.guessSetup(null, headerBytes, new ParseSetup(GUESS_INFO, ParseSetup.GUESS_SEP,
this._setup._single_quotes, ParseSetup.GUESS_HEADER, ParseSetup.GUESS_COL_CNT, null, null));
// check to make sure datasets in file belong to the same dataset
// just check for number for number of columns/separator here. Ignore the column type, user can force it
if ((this._setup._number_columns != ps._number_columns) || (this._setup._separator != ps._separator)) {
String warning = "Your zip file contains a file that belong to another dataset with different " +
"number of column or separator. Number of columns for files that have been parsed = "+
this._setup._number_columns + ". Number of columns in new file = "+ps._number_columns+
". This new file is skipped and not parsed.";
dout.addError(new ParseWriter.ParseErr(warning, -1, -1L, -2L));
// something is wrong
return false;
} else {
// assume column names must appear in the first file. If column names appear in first and other
// files, they will be recognized. Otherwise, if no column name ever appear in the first file, the other
// column names in the other files will not be recognized.
if (ps._check_header == ParseSetup.HAS_HEADER) {
if (this._setup._column_names != null) {
// found header in later files, only incorporate it if the column names are the same as before
String[] thisColumnName = this._setup.getColumnNames();
String[] psColumnName = ps.getColumnNames();
Boolean sameColumnNames = true;
for (int index = 0; index < this._setup._number_columns; index++) {
if (!(thisColumnName[index].equals(psColumnName[index]))) {
sameColumnNames = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (sameColumnNames) // only recognize current file header if it has the same column names as previous files
this._setup.setCheckHeader(ps._check_header);
}
} else // should refresh _setup with correct check_header
this._setup.setCheckHeader(ps._check_header);
}
return true; // everything is fine
} } |
public class class_name {
public OutputGroupDetail withOutputDetails(OutputDetail... outputDetails) {
if (this.outputDetails == null) {
setOutputDetails(new java.util.ArrayList<OutputDetail>(outputDetails.length));
}
for (OutputDetail ele : outputDetails) {
this.outputDetails.add(ele);
}
return this;
} } | public class class_name {
public OutputGroupDetail withOutputDetails(OutputDetail... outputDetails) {
if (this.outputDetails == null) {
setOutputDetails(new java.util.ArrayList<OutputDetail>(outputDetails.length)); // depends on control dependency: [if], data = [none]
}
for (OutputDetail ele : outputDetails) {
this.outputDetails.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected void
buildseqtypes(Variable cdmvar)
throws DapException
{
if (CDMUtil.hasVLEN(cdmvar)) {
buildseqtype(cdmvar);
}
if (cdmvar.getDataType() == DataType.STRUCTURE
|| cdmvar.getDataType() == DataType.SEQUENCE) {
Structure struct = (Structure) cdmvar;
List<Variable> fields = struct.getVariables();
for (int i = 0; i < fields.size(); i++) {
Variable field = fields.get(i);
buildseqtypes(field); // recurse for inner vlen dims
}
}
} } | public class class_name {
protected void
buildseqtypes(Variable cdmvar)
throws DapException
{
if (CDMUtil.hasVLEN(cdmvar)) {
buildseqtype(cdmvar);
}
if (cdmvar.getDataType() == DataType.STRUCTURE
|| cdmvar.getDataType() == DataType.SEQUENCE) {
Structure struct = (Structure) cdmvar;
List<Variable> fields = struct.getVariables();
for (int i = 0; i < fields.size(); i++) {
Variable field = fields.get(i);
buildseqtypes(field); // recurse for inner vlen dims // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
protected List<DisabledDuration> createBlockingDurations(final Iterable<BlockingState> inputBundleEvents) {
final List<DisabledDuration> result = new ArrayList<DisabledDuration>();
final Set<String> services = ImmutableSet.copyOf(Iterables.transform(inputBundleEvents, new Function<BlockingState, String>() {
@Override
public String apply(final BlockingState input) {
return input.getService();
}
}));
final Map<String, BlockingStateService> svcBlockedMap = new HashMap<String, BlockingStateService>();
for (String svc : services) {
svcBlockedMap.put(svc, new BlockingStateService());
}
for (final BlockingState e : inputBundleEvents) {
svcBlockedMap.get(e.getService()).addBlockingState(e);
}
final Iterable<DisabledDuration> unorderedDisabledDuration = Iterables.concat(Iterables.transform(svcBlockedMap.values(), new Function<BlockingStateService, List<DisabledDuration>>() {
@Override
public List<DisabledDuration> apply(final BlockingStateService input) {
return input.build();
}
}));
final List<DisabledDuration> sortedDisabledDuration = Ordering.natural().sortedCopy(unorderedDisabledDuration);
DisabledDuration prevDuration = null;
for (DisabledDuration d : sortedDisabledDuration) {
// isDisjoint
if (prevDuration == null) {
prevDuration = d;
} else {
if (prevDuration.isDisjoint(d)) {
result.add(prevDuration);
prevDuration = d;
} else {
prevDuration = DisabledDuration.mergeDuration(prevDuration, d);
}
}
}
if (prevDuration != null) {
result.add(prevDuration);
}
return result;
} } | public class class_name {
protected List<DisabledDuration> createBlockingDurations(final Iterable<BlockingState> inputBundleEvents) {
final List<DisabledDuration> result = new ArrayList<DisabledDuration>();
final Set<String> services = ImmutableSet.copyOf(Iterables.transform(inputBundleEvents, new Function<BlockingState, String>() {
@Override
public String apply(final BlockingState input) {
return input.getService();
}
}));
final Map<String, BlockingStateService> svcBlockedMap = new HashMap<String, BlockingStateService>();
for (String svc : services) {
svcBlockedMap.put(svc, new BlockingStateService()); // depends on control dependency: [for], data = [svc]
}
for (final BlockingState e : inputBundleEvents) {
svcBlockedMap.get(e.getService()).addBlockingState(e); // depends on control dependency: [for], data = [e]
}
final Iterable<DisabledDuration> unorderedDisabledDuration = Iterables.concat(Iterables.transform(svcBlockedMap.values(), new Function<BlockingStateService, List<DisabledDuration>>() {
@Override
public List<DisabledDuration> apply(final BlockingStateService input) {
return input.build();
}
}));
final List<DisabledDuration> sortedDisabledDuration = Ordering.natural().sortedCopy(unorderedDisabledDuration);
DisabledDuration prevDuration = null;
for (DisabledDuration d : sortedDisabledDuration) {
// isDisjoint
if (prevDuration == null) {
prevDuration = d; // depends on control dependency: [if], data = [none]
} else {
if (prevDuration.isDisjoint(d)) {
result.add(prevDuration); // depends on control dependency: [if], data = [none]
prevDuration = d; // depends on control dependency: [if], data = [none]
} else {
prevDuration = DisabledDuration.mergeDuration(prevDuration, d); // depends on control dependency: [if], data = [none]
}
}
}
if (prevDuration != null) {
result.add(prevDuration); // depends on control dependency: [if], data = [(prevDuration]
}
return result;
} } |
public class class_name {
@Override
public void onClick()
{
try {
setResponsePage(new DashboardPage(getPage().getPageReference()));
} catch (final EFapsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} } | public class class_name {
@Override
public void onClick()
{
try {
setResponsePage(new DashboardPage(getPage().getPageReference())); // depends on control dependency: [try], data = [none]
} catch (final EFapsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public UploadMaterialResponse uploadMaterialFile(File file, String title, String introduction){
UploadMaterialResponse response;
String url = "http://api.weixin.qq.com/cgi-bin/material/add_material?access_token=#";
BaseResponse r;
if(StrUtil.isBlank(title)) {
r = executePost(url, null, file);
}else{
final Map<String, String> param = new HashMap<String, String>();
param.put("title", title);
param.put("introduction", introduction);
r = executePost(url, JSONUtil.toJson(param), file);
}
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, UploadMaterialResponse.class);
return response;
} } | public class class_name {
public UploadMaterialResponse uploadMaterialFile(File file, String title, String introduction){
UploadMaterialResponse response;
String url = "http://api.weixin.qq.com/cgi-bin/material/add_material?access_token=#";
BaseResponse r;
if(StrUtil.isBlank(title)) {
r = executePost(url, null, file); // depends on control dependency: [if], data = [none]
}else{
final Map<String, String> param = new HashMap<String, String>();
param.put("title", title); // depends on control dependency: [if], data = [none]
param.put("introduction", introduction); // depends on control dependency: [if], data = [none]
r = executePost(url, JSONUtil.toJson(param), file); // depends on control dependency: [if], data = [none]
}
String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString();
response = JSONUtil.toBean(resultJson, UploadMaterialResponse.class);
return response;
} } |
public class class_name {
public static final double signed(double angle)
{
angle = normalizeToFullAngle(angle);
if (angle > Math.PI)
{
return angle - FULL_CIRCLE;
}
else
{
return angle;
}
} } | public class class_name {
public static final double signed(double angle)
{
angle = normalizeToFullAngle(angle);
if (angle > Math.PI)
{
return angle - FULL_CIRCLE;
// depends on control dependency: [if], data = [none]
}
else
{
return angle;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static void checkNotNull (Object[] array)
{
checkNotNull((Object)array);
for (Object o : array) {
checkNotNull(o);
}
} } | public class class_name {
protected static void checkNotNull (Object[] array)
{
checkNotNull((Object)array);
for (Object o : array) {
checkNotNull(o); // depends on control dependency: [for], data = [o]
}
} } |
public class class_name {
public boolean failAndRecycle(Throwable cause) {
ReferenceCountUtil.release(msg);
if (promise != null) {
promise.setFailure(cause);
}
return recycle();
} } | public class class_name {
public boolean failAndRecycle(Throwable cause) {
ReferenceCountUtil.release(msg);
if (promise != null) {
promise.setFailure(cause); // depends on control dependency: [if], data = [none]
}
return recycle();
} } |
public class class_name {
public void marshall(CheckpointConfigurationUpdate checkpointConfigurationUpdate, ProtocolMarshaller protocolMarshaller) {
if (checkpointConfigurationUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(checkpointConfigurationUpdate.getConfigurationTypeUpdate(), CONFIGURATIONTYPEUPDATE_BINDING);
protocolMarshaller.marshall(checkpointConfigurationUpdate.getCheckpointingEnabledUpdate(), CHECKPOINTINGENABLEDUPDATE_BINDING);
protocolMarshaller.marshall(checkpointConfigurationUpdate.getCheckpointIntervalUpdate(), CHECKPOINTINTERVALUPDATE_BINDING);
protocolMarshaller.marshall(checkpointConfigurationUpdate.getMinPauseBetweenCheckpointsUpdate(), MINPAUSEBETWEENCHECKPOINTSUPDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CheckpointConfigurationUpdate checkpointConfigurationUpdate, ProtocolMarshaller protocolMarshaller) {
if (checkpointConfigurationUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(checkpointConfigurationUpdate.getConfigurationTypeUpdate(), CONFIGURATIONTYPEUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(checkpointConfigurationUpdate.getCheckpointingEnabledUpdate(), CHECKPOINTINGENABLEDUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(checkpointConfigurationUpdate.getCheckpointIntervalUpdate(), CHECKPOINTINTERVALUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(checkpointConfigurationUpdate.getMinPauseBetweenCheckpointsUpdate(), MINPAUSEBETWEENCHECKPOINTSUPDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public List<IndexableField> indexableFields(String name, String value) {
JtsGeometry shape = geometry(value);
for (GeoTransformation transformation : transformations) {
shape = transformation.apply(shape);
}
return Arrays.asList(strategy.createIndexableFields(shape));
} } | public class class_name {
@Override
public List<IndexableField> indexableFields(String name, String value) {
JtsGeometry shape = geometry(value);
for (GeoTransformation transformation : transformations) {
shape = transformation.apply(shape); // depends on control dependency: [for], data = [transformation]
}
return Arrays.asList(strategy.createIndexableFields(shape));
} } |
public class class_name {
public double getATMForward(AnalyticModelInterface model, boolean isFirstPeriodIncluded) {
if(!Double.isNaN(cachedATMForward) && cacheStateModel.get() == model && cacheStateIsFirstPeriodIncluded == isFirstPeriodIncluded) {
return cachedATMForward;
}
ScheduleInterface remainderSchedule = schedule;
if(!isFirstPeriodIncluded) {
ArrayList<Period> periods = new ArrayList<Period>();
periods.addAll(schedule.getPeriods());
if(periods.size() > 1) {
periods.remove(0);
}
remainderSchedule = new Schedule(schedule.getReferenceDate(), periods, schedule.getDaycountconvention());
}
SwapLeg floatLeg = new SwapLeg(remainderSchedule, forwardCurveName, 0.0, discountCurveName, false);
SwapLeg annuityLeg = new SwapLeg(remainderSchedule, null, 1.0, discountCurveName, false);
cachedATMForward = floatLeg.getValue(model) / annuityLeg.getValue(model);
cacheStateModel = new SoftReference<AnalyticModelInterface>(model);
cacheStateIsFirstPeriodIncluded = isFirstPeriodIncluded;
return cachedATMForward;
} } | public class class_name {
public double getATMForward(AnalyticModelInterface model, boolean isFirstPeriodIncluded) {
if(!Double.isNaN(cachedATMForward) && cacheStateModel.get() == model && cacheStateIsFirstPeriodIncluded == isFirstPeriodIncluded) {
return cachedATMForward; // depends on control dependency: [if], data = [none]
}
ScheduleInterface remainderSchedule = schedule;
if(!isFirstPeriodIncluded) {
ArrayList<Period> periods = new ArrayList<Period>();
periods.addAll(schedule.getPeriods()); // depends on control dependency: [if], data = [none]
if(periods.size() > 1) {
periods.remove(0); // depends on control dependency: [if], data = [none]
}
remainderSchedule = new Schedule(schedule.getReferenceDate(), periods, schedule.getDaycountconvention()); // depends on control dependency: [if], data = [none]
}
SwapLeg floatLeg = new SwapLeg(remainderSchedule, forwardCurveName, 0.0, discountCurveName, false);
SwapLeg annuityLeg = new SwapLeg(remainderSchedule, null, 1.0, discountCurveName, false);
cachedATMForward = floatLeg.getValue(model) / annuityLeg.getValue(model);
cacheStateModel = new SoftReference<AnalyticModelInterface>(model);
cacheStateIsFirstPeriodIncluded = isFirstPeriodIncluded;
return cachedATMForward;
} } |
public class class_name {
public void readEntries(TableKelp table,
InSegment reader,
SegmentEntryCallback cb)
{
TempBuffer tBuf = TempBuffer.createLarge();
byte []buffer = tBuf.buffer();
InStore sIn = reader.getStoreRead();
byte []tableKey = new byte[TableKelp.TABLE_KEY_SIZE];
for (int ptr = length() - BLOCK_SIZE; ptr > 0; ptr -= BLOCK_SIZE) {
sIn.read(getAddress() + ptr, buffer, 0, buffer.length);
int index = 0;
long seq = BitsUtil.readLong(buffer, index);
index += 8;
if (seq != getSequence()) {
log.warning(L.l("Invalid sequence {0} expected {1} at 0x{2}",
seq,
getSequence(),
Long.toHexString(getAddress() + ptr)));
break;
}
System.arraycopy(buffer, index, tableKey, 0, tableKey.length);
index += tableKey.length;
if (! Arrays.equals(tableKey, _tableKey)) {
log.warning(L.l("Invalid table {0} table {1} at 0x{2}",
Hex.toShortHex(tableKey),
Hex.toShortHex(_tableKey),
Long.toHexString(getAddress() + ptr)));
break;
}
/*
int tail = BitsUtil.readInt16(buffer, index);
index += 2;
if (tail <= 0) {
throw new IllegalStateException();
}
*/
int head = index;
while (head < BLOCK_SIZE && buffer[head] != 0) {
head = readEntry(table, buffer, head, cb, getAddress());
}
boolean isCont = buffer[head + 1] != 0;
if (! isCont) {
break;
}
}
tBuf.free();
} } | public class class_name {
public void readEntries(TableKelp table,
InSegment reader,
SegmentEntryCallback cb)
{
TempBuffer tBuf = TempBuffer.createLarge();
byte []buffer = tBuf.buffer();
InStore sIn = reader.getStoreRead();
byte []tableKey = new byte[TableKelp.TABLE_KEY_SIZE];
for (int ptr = length() - BLOCK_SIZE; ptr > 0; ptr -= BLOCK_SIZE) {
sIn.read(getAddress() + ptr, buffer, 0, buffer.length); // depends on control dependency: [for], data = [ptr]
int index = 0;
long seq = BitsUtil.readLong(buffer, index);
index += 8; // depends on control dependency: [for], data = [none]
if (seq != getSequence()) {
log.warning(L.l("Invalid sequence {0} expected {1} at 0x{2}",
seq,
getSequence(),
Long.toHexString(getAddress() + ptr))); // depends on control dependency: [if], data = [none]
break;
}
System.arraycopy(buffer, index, tableKey, 0, tableKey.length); // depends on control dependency: [for], data = [none]
index += tableKey.length; // depends on control dependency: [for], data = [none]
if (! Arrays.equals(tableKey, _tableKey)) {
log.warning(L.l("Invalid table {0} table {1} at 0x{2}",
Hex.toShortHex(tableKey),
Hex.toShortHex(_tableKey),
Long.toHexString(getAddress() + ptr))); // depends on control dependency: [if], data = [none]
break;
}
/*
int tail = BitsUtil.readInt16(buffer, index);
index += 2;
if (tail <= 0) {
throw new IllegalStateException();
}
*/
int head = index;
while (head < BLOCK_SIZE && buffer[head] != 0) {
head = readEntry(table, buffer, head, cb, getAddress()); // depends on control dependency: [while], data = [none]
}
boolean isCont = buffer[head + 1] != 0;
if (! isCont) {
break;
}
}
tBuf.free();
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.