code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private ParsedResultAccumulator getBestCostPlanForEphemeralScans(List<StmtEphemeralTableScan> scans) {
int nextPlanId = m_planSelector.m_planId;
boolean orderIsDeterministic = true;
boolean hasSignificantOffsetOrLimit = false;
String contentNonDeterminismMessage = null;
for (StmtEphemeralTableScan scan : scans) {
if (scan instanceof StmtSubqueryScan) {
nextPlanId = planForParsedSubquery((StmtSubqueryScan)scan, nextPlanId);
// If we can't plan this, then give up.
if (((StmtSubqueryScan) scan).getBestCostPlan() == null) {
return null;
}
}
else if (scan instanceof StmtCommonTableScan) {
nextPlanId = planForCommonTableQuery((StmtCommonTableScan)scan, nextPlanId);
if (((StmtCommonTableScan) scan).getBestCostBasePlan() == null) {
return null;
}
}
else {
throw new PlanningErrorException("Unknown scan plan type.");
}
orderIsDeterministic = scan.isOrderDeterministic(orderIsDeterministic);
contentNonDeterminismMessage = scan.contentNonDeterminismMessage(contentNonDeterminismMessage);
hasSignificantOffsetOrLimit = scan.hasSignificantOffsetOrLimit(hasSignificantOffsetOrLimit);
}
// need to reset plan id for the entire SQL
m_planSelector.m_planId = nextPlanId;
return new ParsedResultAccumulator(orderIsDeterministic,
hasSignificantOffsetOrLimit,
contentNonDeterminismMessage);
} } | public class class_name {
private ParsedResultAccumulator getBestCostPlanForEphemeralScans(List<StmtEphemeralTableScan> scans) {
int nextPlanId = m_planSelector.m_planId;
boolean orderIsDeterministic = true;
boolean hasSignificantOffsetOrLimit = false;
String contentNonDeterminismMessage = null;
for (StmtEphemeralTableScan scan : scans) {
if (scan instanceof StmtSubqueryScan) {
nextPlanId = planForParsedSubquery((StmtSubqueryScan)scan, nextPlanId); // depends on control dependency: [if], data = [none]
// If we can't plan this, then give up.
if (((StmtSubqueryScan) scan).getBestCostPlan() == null) {
return null; // depends on control dependency: [if], data = [none]
}
}
else if (scan instanceof StmtCommonTableScan) {
nextPlanId = planForCommonTableQuery((StmtCommonTableScan)scan, nextPlanId); // depends on control dependency: [if], data = [none]
if (((StmtCommonTableScan) scan).getBestCostBasePlan() == null) {
return null; // depends on control dependency: [if], data = [none]
}
}
else {
throw new PlanningErrorException("Unknown scan plan type.");
}
orderIsDeterministic = scan.isOrderDeterministic(orderIsDeterministic); // depends on control dependency: [for], data = [scan]
contentNonDeterminismMessage = scan.contentNonDeterminismMessage(contentNonDeterminismMessage); // depends on control dependency: [for], data = [scan]
hasSignificantOffsetOrLimit = scan.hasSignificantOffsetOrLimit(hasSignificantOffsetOrLimit); // depends on control dependency: [for], data = [scan]
}
// need to reset plan id for the entire SQL
m_planSelector.m_planId = nextPlanId;
return new ParsedResultAccumulator(orderIsDeterministic,
hasSignificantOffsetOrLimit,
contentNonDeterminismMessage);
} } |
public class class_name {
public T increaseHitRect(final int top, final int left, final int bottom, final int right) {
final View parent = (View) view.getParent();
if (parent != null && view.getContext() != null) {
parent.post(new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
public void run() {
final Rect r = new Rect();
view.getHitRect(r);
r.top -= dip2pixel(top);
r.left -= dip2pixel(left);
r.bottom += dip2pixel(bottom);
r.right += dip2pixel(right);
parent.setTouchDelegate(new TouchDelegate(r, view));
}
});
}
return self();
} } | public class class_name {
public T increaseHitRect(final int top, final int left, final int bottom, final int right) {
final View parent = (View) view.getParent();
if (parent != null && view.getContext() != null) {
parent.post(new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
public void run() {
final Rect r = new Rect();
view.getHitRect(r);
r.top -= dip2pixel(top);
r.left -= dip2pixel(left);
r.bottom += dip2pixel(bottom);
r.right += dip2pixel(right);
parent.setTouchDelegate(new TouchDelegate(r, view));
}
}); // depends on control dependency: [if], data = [none]
}
return self();
} } |
public class class_name {
public CmsPublishList mergePublishLists(CmsRequestContext context, CmsPublishList pubList1, CmsPublishList pubList2)
throws CmsException {
CmsPublishList ret = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// get all resources from the first list
Set<CmsResource> publishResources = new HashSet<CmsResource>(pubList1.getAllResources());
// get all resources from the second list
publishResources.addAll(pubList2.getAllResources());
// create merged publish list
ret = new CmsPublishList(
pubList1.getDirectPublishResources(),
pubList1.isPublishSiblings(),
pubList1.isPublishSubResources());
ret.addAll(publishResources, false); // ignore files that should not be published
if (pubList1.isUserPublishList()) {
ret.setUserPublishList(true);
}
ret.initialize(); // ensure sort order
checkPublishPermissions(dbc, ret);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_MERGING_PUBLISH_LISTS_0), e);
} finally {
dbc.clear();
}
return ret;
} } | public class class_name {
public CmsPublishList mergePublishLists(CmsRequestContext context, CmsPublishList pubList1, CmsPublishList pubList2)
throws CmsException {
CmsPublishList ret = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// get all resources from the first list
Set<CmsResource> publishResources = new HashSet<CmsResource>(pubList1.getAllResources());
// get all resources from the second list
publishResources.addAll(pubList2.getAllResources());
// create merged publish list
ret = new CmsPublishList(
pubList1.getDirectPublishResources(),
pubList1.isPublishSiblings(),
pubList1.isPublishSubResources());
ret.addAll(publishResources, false); // ignore files that should not be published
if (pubList1.isUserPublishList()) {
ret.setUserPublishList(true); // depends on control dependency: [if], data = [none]
}
ret.initialize(); // ensure sort order
checkPublishPermissions(dbc, ret);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_MERGING_PUBLISH_LISTS_0), e);
} finally {
dbc.clear();
}
return ret;
} } |
public class class_name {
public void cache(Identity oid, Object obj)
{
try
{
jcsCache.put(oid.toString(), obj);
}
catch (CacheException e)
{
throw new RuntimeCacheException(e);
}
} } | public class class_name {
public void cache(Identity oid, Object obj)
{
try
{
jcsCache.put(oid.toString(), obj);
// depends on control dependency: [try], data = [none]
}
catch (CacheException e)
{
throw new RuntimeCacheException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setAttributesToDelete(java.util.Collection<String> attributesToDelete) {
if (attributesToDelete == null) {
this.attributesToDelete = null;
return;
}
this.attributesToDelete = new java.util.ArrayList<String>(attributesToDelete);
} } | public class class_name {
public void setAttributesToDelete(java.util.Collection<String> attributesToDelete) {
if (attributesToDelete == null) {
this.attributesToDelete = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.attributesToDelete = new java.util.ArrayList<String>(attributesToDelete);
} } |
public class class_name {
public String getJSONMessages() {
StringBuilder builder = new StringBuilder();
builder.append("{");
boolean first = true;
Enumeration<String> keys = this.bundle.getKeys();
while (keys.hasMoreElements()) {
if (!first)
builder.append(",");
else
first = false;
String key = keys.nextElement();
String value = this.getMessage(key);
String escaped = value.replaceAll("\\'", "\\\\'");
builder.append("'").append(key).append("':'").append(escaped).append("'");
}
builder.append("}");
return builder.toString();
} } | public class class_name {
public String getJSONMessages() {
StringBuilder builder = new StringBuilder();
builder.append("{");
boolean first = true;
Enumeration<String> keys = this.bundle.getKeys();
while (keys.hasMoreElements()) {
if (!first)
builder.append(",");
else
first = false;
String key = keys.nextElement();
String value = this.getMessage(key);
String escaped = value.replaceAll("\\'", "\\\\'");
builder.append("'").append(key).append("':'").append(escaped).append("'"); // depends on control dependency: [while], data = [none]
}
builder.append("}");
return builder.toString();
} } |
public class class_name {
@Override
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisCluster jedis) {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<RedisTriggerState, Double> scores = new HashMap<>(RedisTriggerState.values().length);
for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) {
scores.put(redisTriggerState, jedis.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey));
}
for (Map.Entry<RedisTriggerState, Double> entry : scores.entrySet()) {
if (entry.getValue() != null) {
return entry.getKey().getTriggerState();
}
}
return Trigger.TriggerState.NONE;
} } | public class class_name {
@Override
public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, JedisCluster jedis) {
final String triggerHashKey = redisSchema.triggerHashKey(triggerKey);
Map<RedisTriggerState, Double> scores = new HashMap<>(RedisTriggerState.values().length);
for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) {
scores.put(redisTriggerState, jedis.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey)); // depends on control dependency: [for], data = [redisTriggerState]
}
for (Map.Entry<RedisTriggerState, Double> entry : scores.entrySet()) {
if (entry.getValue() != null) {
return entry.getKey().getTriggerState(); // depends on control dependency: [if], data = [none]
}
}
return Trigger.TriggerState.NONE;
} } |
public class class_name {
public static int multiply( int a , int b ) {
int z = 0;
for (int i = 0; (b>>i) > 0; i++) {
if( (b & (1 << i)) != 0 ) {
z ^= a << i;
}
}
return z;
} } | public class class_name {
public static int multiply( int a , int b ) {
int z = 0;
for (int i = 0; (b>>i) > 0; i++) {
if( (b & (1 << i)) != 0 ) {
z ^= a << i; // depends on control dependency: [if], data = [none]
}
}
return z;
} } |
public class class_name {
public boolean consume(int ch){
offset++;
if(ch==0x0D){
skipLF = true;
line++;
col = 0;
return true;
}else if(ch==0x0A){
if(skipLF){
skipLF = false;
return false;
}else{
line++;
col = 0;
return true;
}
}else{
skipLF = false;
col++;
return true;
}
} } | public class class_name {
public boolean consume(int ch){
offset++;
if(ch==0x0D){
skipLF = true; // depends on control dependency: [if], data = [none]
line++; // depends on control dependency: [if], data = [none]
col = 0; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}else if(ch==0x0A){
if(skipLF){
skipLF = false; // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}else{
line++; // depends on control dependency: [if], data = [none]
col = 0; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}else{
skipLF = false; // depends on control dependency: [if], data = [none]
col++; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
final Serializable fetchValue(String columnName, int columnIndex, int type, final int meta, boolean isBinary) {
int len = 0;
if (type == LogEvent.MYSQL_TYPE_STRING) {
if (meta >= 256) {
int byte0 = meta >> 8;
int byte1 = meta & 0xff;
if ((byte0 & 0x30) != 0x30) {
/* a long CHAR() field: see #37426 */
len = byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
type = byte0 | 0x30;
} else {
switch (byte0) {
case LogEvent.MYSQL_TYPE_SET:
case LogEvent.MYSQL_TYPE_ENUM:
case LogEvent.MYSQL_TYPE_STRING:
type = byte0;
len = byte1;
break;
default:
throw new IllegalArgumentException(String.format("!! Don't know how to handle column type=%d meta=%d (%04X)",
type,
meta,
meta));
}
}
} else {
len = meta;
}
}
switch (type) {
case LogEvent.MYSQL_TYPE_LONG: {
// XXX: How to check signed / unsigned?
// value = unsigned ? Long.valueOf(buffer.getUint32()) :
// Integer.valueOf(buffer.getInt32());
value = Integer.valueOf(buffer.getInt32());
javaType = Types.INTEGER;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_TINY: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint8() :
// buffer.getInt8());
value = Integer.valueOf(buffer.getInt8());
javaType = Types.TINYINT; // java.sql.Types.INTEGER;
length = 1;
break;
}
case LogEvent.MYSQL_TYPE_SHORT: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint16() :
// buffer.getInt16());
value = Integer.valueOf((short) buffer.getInt16());
javaType = Types.SMALLINT; // java.sql.Types.INTEGER;
length = 2;
break;
}
case LogEvent.MYSQL_TYPE_INT24: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint24() :
// buffer.getInt24());
value = Integer.valueOf(buffer.getInt24());
javaType = Types.INTEGER;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_LONGLONG: {
// XXX: How to check signed / unsigned?
// value = unsigned ? buffer.getUlong64()) :
// Long.valueOf(buffer.getLong64());
value = Long.valueOf(buffer.getLong64());
javaType = Types.BIGINT; // Types.INTEGER;
length = 8;
break;
}
case LogEvent.MYSQL_TYPE_DECIMAL: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_DECIMAL : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
javaType = Types.DECIMAL;
value = null; /* unknown format */
length = 0;
break;
}
case LogEvent.MYSQL_TYPE_NEWDECIMAL: {
final int precision = meta >> 8;
final int decimals = meta & 0xff;
value = buffer.getDecimal(precision, decimals);
javaType = Types.DECIMAL;
length = precision;
break;
}
case LogEvent.MYSQL_TYPE_FLOAT: {
value = Float.valueOf(buffer.getFloat32());
javaType = Types.REAL; // Types.FLOAT;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_DOUBLE: {
value = Double.valueOf(buffer.getDouble64());
javaType = Types.DOUBLE;
length = 8;
break;
}
case LogEvent.MYSQL_TYPE_BIT: {
/* Meta-data: bit_len, bytes_in_rec, 2 bytes */
final int nbits = ((meta >> 8) * 8) + (meta & 0xff);
len = (nbits + 7) / 8;
if (nbits > 1) {
// byte[] bits = new byte[len];
// buffer.fillBytes(bits, 0, len);
// 转化为unsign long
switch (len) {
case 1:
value = buffer.getUint8();
break;
case 2:
value = buffer.getBeUint16();
break;
case 3:
value = buffer.getBeUint24();
break;
case 4:
value = buffer.getBeUint32();
break;
case 5:
value = buffer.getBeUlong40();
break;
case 6:
value = buffer.getBeUlong48();
break;
case 7:
value = buffer.getBeUlong56();
break;
case 8:
value = buffer.getBeUlong64();
break;
default:
throw new IllegalArgumentException("!! Unknown Bit len = " + len);
}
} else {
final int bit = buffer.getInt8();
// value = (bit != 0) ? Boolean.TRUE : Boolean.FALSE;
value = bit;
}
javaType = Types.BIT;
length = nbits;
break;
}
case LogEvent.MYSQL_TYPE_TIMESTAMP: {
// MYSQL DataTypes: TIMESTAMP
// range is '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07'
// UTC
// A TIMESTAMP cannot represent the value '1970-01-01 00:00:00'
// because that is equivalent to 0 seconds from the epoch and
// the value 0 is reserved for representing '0000-00-00
// 00:00:00', the “zero” TIMESTAMP value.
final long i32 = buffer.getUint32();
if (i32 == 0) {
value = "0000-00-00 00:00:00";
} else {
String v = new Timestamp(i32 * 1000).toString();
value = v.substring(0, v.length() - 2);
}
javaType = Types.TIMESTAMP;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_TIMESTAMP2: {
final long tv_sec = buffer.getBeUint32(); // big-endian
int tv_usec = 0;
switch (meta) {
case 0:
tv_usec = 0;
break;
case 1:
case 2:
tv_usec = buffer.getInt8() * 10000;
break;
case 3:
case 4:
tv_usec = buffer.getBeInt16() * 100;
break;
case 5:
case 6:
tv_usec = buffer.getBeInt24();
break;
default:
tv_usec = 0;
break;
}
String second = null;
if (tv_sec == 0) {
second = "0000-00-00 00:00:00";
} else {
Timestamp time = new Timestamp(tv_sec * 1000);
second = time.toString();
second = second.substring(0, second.length() - 2);// 去掉毫秒精度.0
}
if (meta >= 1) {
String microSecond = usecondsToStr(tv_usec, meta);
microSecond = microSecond.substring(0, meta);
value = second + '.' + microSecond;
} else {
value = second;
}
javaType = Types.TIMESTAMP;
length = 4 + (meta + 1) / 2;
break;
}
case LogEvent.MYSQL_TYPE_DATETIME: {
// MYSQL DataTypes: DATETIME
// range is '0000-01-01 00:00:00' to '9999-12-31 23:59:59'
final long i64 = buffer.getLong64(); /* YYYYMMDDhhmmss */
if (i64 == 0) {
value = "0000-00-00 00:00:00";
} else {
final int d = (int) (i64 / 1000000);
final int t = (int) (i64 % 1000000);
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
/* month is 0-based, 0 for january. */
// cal.set(d / 10000, (d % 10000) / 100 - 1, d % 100, t /
// 10000, (t % 10000) / 100, t % 100);
// value = new Timestamp(cal.getTimeInMillis());
// value = String.format("%04d-%02d-%02d %02d:%02d:%02d",
// d / 10000,
// (d % 10000) / 100,
// d % 100,
// t / 10000,
// (t % 10000) / 100,
// t % 100);
StringBuilder builder = new StringBuilder();
appendNumber4(builder, d / 10000);
builder.append('-');
appendNumber2(builder, (d % 10000) / 100);
builder.append('-');
appendNumber2(builder, d % 100);
builder.append(' ');
appendNumber2(builder, t / 10000);
builder.append(':');
appendNumber2(builder, (t % 10000) / 100);
builder.append(':');
appendNumber2(builder, t % 100);
value = builder.toString();
}
javaType = Types.TIMESTAMP;
length = 8;
break;
}
case LogEvent.MYSQL_TYPE_DATETIME2: {
/*
* DATETIME and DATE low-level memory and disk representation
* routines 1 bit sign (used when on disk) 17 bits year*13+month
* (year 0-9999, month 0-12) 5 bits day (0-31) 5 bits hour
* (0-23) 6 bits minute (0-59) 6 bits second (0-59) 24 bits
* microseconds (0-999999) Total: 64 bits = 8 bytes
* SYYYYYYY.YYYYYYYY
* .YYdddddh.hhhhmmmm.mmssssss.ffffffff.ffffffff.ffffffff
*/
long intpart = buffer.getBeUlong40() - DATETIMEF_INT_OFS; // big-endian
int frac = 0;
switch (meta) {
case 0:
frac = 0;
break;
case 1:
case 2:
frac = buffer.getInt8() * 10000;
break;
case 3:
case 4:
frac = buffer.getBeInt16() * 100;
break;
case 5:
case 6:
frac = buffer.getBeInt24();
break;
default:
frac = 0;
break;
}
String second = null;
if (intpart == 0) {
second = "0000-00-00 00:00:00";
} else {
// 构造TimeStamp只处理到秒
long ymd = intpart >> 17;
long ym = ymd >> 5;
long hms = intpart % (1 << 17);
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set((int) (ym / 13), (int) (ym % 13) - 1, (int) (ymd
// % (1 << 5)), (int) (hms >> 12),
// (int) ((hms >> 6) % (1 << 6)), (int) (hms % (1 << 6)));
// value = new Timestamp(cal.getTimeInMillis());
// second = String.format("%04d-%02d-%02d %02d:%02d:%02d",
// (int) (ym / 13),
// (int) (ym % 13),
// (int) (ymd % (1 << 5)),
// (int) (hms >> 12),
// (int) ((hms >> 6) % (1 << 6)),
// (int) (hms % (1 << 6)));
StringBuilder builder = new StringBuilder(26);
appendNumber4(builder, (int) (ym / 13));
builder.append('-');
appendNumber2(builder, (int) (ym % 13));
builder.append('-');
appendNumber2(builder, (int) (ymd % (1 << 5)));
builder.append(' ');
appendNumber2(builder, (int) (hms >> 12));
builder.append(':');
appendNumber2(builder, (int) ((hms >> 6) % (1 << 6)));
builder.append(':');
appendNumber2(builder, (int) (hms % (1 << 6)));
second = builder.toString();
}
if (meta >= 1) {
String microSecond = usecondsToStr(frac, meta);
microSecond = microSecond.substring(0, meta);
value = second + '.' + microSecond;
} else {
value = second;
}
javaType = Types.TIMESTAMP;
length = 5 + (meta + 1) / 2;
break;
}
case LogEvent.MYSQL_TYPE_TIME: {
// MYSQL DataTypes: TIME
// The range is '-838:59:59' to '838:59:59'
// final int i32 = buffer.getUint24();
final int i32 = buffer.getInt24();
final int u32 = Math.abs(i32);
if (i32 == 0) {
value = "00:00:00";
} else {
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set(70, 0, 1, i32 / 10000, (i32 % 10000) / 100, i32 %
// 100);
// value = new Time(cal.getTimeInMillis());
// value = String.format("%s%02d:%02d:%02d",
// (i32 >= 0) ? "" : "-",
// u32 / 10000,
// (u32 % 10000) / 100,
// u32 % 100);
StringBuilder builder = new StringBuilder(17);
if (i32 < 0) {
builder.append('-');
}
int d = u32 / 10000;
if (d > 100) {
builder.append(String.valueOf(d));
} else {
appendNumber2(builder, d);
}
builder.append(':');
appendNumber2(builder, (u32 % 10000) / 100);
builder.append(':');
appendNumber2(builder, u32 % 100);
value = builder.toString();
}
javaType = Types.TIME;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_TIME2: {
/*
* TIME low-level memory and disk representation routines
* In-memory format: 1 bit sign (Used for sign, when on disk) 1
* bit unused (Reserved for wider hour range, e.g. for
* intervals) 10 bit hour (0-836) 6 bit minute (0-59) 6 bit
* second (0-59) 24 bits microseconds (0-999999) Total: 48 bits
* = 6 bytes
* Suhhhhhh.hhhhmmmm.mmssssss.ffffffff.ffffffff.ffffffff
*/
long intpart = 0;
int frac = 0;
long ltime = 0;
switch (meta) {
case 0:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS; // big-endian
ltime = intpart << 24;
break;
case 1:
case 2:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
frac = buffer.getUint8();
if (intpart < 0 && frac > 0) {
/*
* Negative values are stored with reverse
* fractional part order, for binary sort
* compatibility. Disk value intpart frac Time value
* Memory value 800000.00 0 0 00:00:00.00
* 0000000000.000000 7FFFFF.FF -1 255 -00:00:00.01
* FFFFFFFFFF.FFD8F0 7FFFFF.9D -1 99 -00:00:00.99
* FFFFFFFFFF.F0E4D0 7FFFFF.00 -1 0 -00:00:01.00
* FFFFFFFFFF.000000 7FFFFE.FF -1 255 -00:00:01.01
* FFFFFFFFFE.FFD8F0 7FFFFE.F6 -2 246 -00:00:01.10
* FFFFFFFFFE.FE7960 Formula to convert fractional
* part from disk format (now stored in "frac"
* variable) to absolute value: "0x100 - frac". To
* reconstruct in-memory value, we shift to the next
* integer value and then substruct fractional part.
*/
intpart++; /* Shift to the next integer value */
frac -= 0x100; /* -(0x100 - frac) */
// fraclong = frac * 10000;
}
frac = frac * 10000;
ltime = intpart << 24;
break;
case 3:
case 4:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
frac = buffer.getBeUint16();
if (intpart < 0 && frac > 0) {
/*
* Fix reverse fractional part order:
* "0x10000 - frac". See comments for FSP=1 and
* FSP=2 above.
*/
intpart++; /* Shift to the next integer value */
frac -= 0x10000; /* -(0x10000-frac) */
// fraclong = frac * 100;
}
frac = frac * 100;
ltime = intpart << 24;
break;
case 5:
case 6:
intpart = buffer.getBeUlong48() - TIMEF_OFS;
ltime = intpart;
frac = (int) (intpart % (1L << 24));
break;
default:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
ltime = intpart << 24;
break;
}
String second = null;
if (intpart == 0) {
second = "00:00:00";
} else {
// 目前只记录秒,不处理us frac
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set(70, 0, 1, (int) ((intpart >> 12) % (1 << 10)),
// (int) ((intpart >> 6) % (1 << 6)),
// (int) (intpart % (1 << 6)));
// value = new Time(cal.getTimeInMillis());
long ultime = Math.abs(ltime);
intpart = ultime >> 24;
// second = String.format("%s%02d:%02d:%02d",
// ltime >= 0 ? "" : "-",
// (int) ((intpart >> 12) % (1 << 10)),
// (int) ((intpart >> 6) % (1 << 6)),
// (int) (intpart % (1 << 6)));
StringBuilder builder = new StringBuilder(12);
if (ltime < 0) {
builder.append('-');
}
int d = (int) ((intpart >> 12) % (1 << 10));
if (d > 100) {
builder.append(String.valueOf(d));
} else {
appendNumber2(builder, d);
}
builder.append(':');
appendNumber2(builder, (int) ((intpart >> 6) % (1 << 6)));
builder.append(':');
appendNumber2(builder, (int) (intpart % (1 << 6)));
second = builder.toString();
}
if (meta >= 1) {
String microSecond = usecondsToStr(Math.abs(frac), meta);
microSecond = microSecond.substring(0, meta);
value = second + '.' + microSecond;
} else {
value = second;
}
javaType = Types.TIME;
length = 3 + (meta + 1) / 2;
break;
}
case LogEvent.MYSQL_TYPE_NEWDATE: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_NEWDATE : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
javaType = Types.DATE;
value = null; /* unknown format */
length = 0;
break;
}
case LogEvent.MYSQL_TYPE_DATE: {
// MYSQL DataTypes:
// range: 0000-00-00 ~ 9999-12-31
final int i32 = buffer.getUint24();
if (i32 == 0) {
value = "0000-00-00";
} else {
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
/* month is 0-based, 0 for january. */
// cal.set((i32 / (16 * 32)), (i32 / 32 % 16) - 1, (i32 %
// 32));
// value = new java.sql.Date(cal.getTimeInMillis());
// value = String.format("%04d-%02d-%02d", i32 / (16 * 32),
// i32 / 32 % 16, i32 % 32);
StringBuilder builder = new StringBuilder(12);
appendNumber4(builder, i32 / (16 * 32));
builder.append('-');
appendNumber2(builder, i32 / 32 % 16);
builder.append('-');
appendNumber2(builder, i32 % 32);
value = builder.toString();
}
javaType = Types.DATE;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_YEAR: {
// MYSQL DataTypes: YEAR[(2|4)]
// In four-digit format, values display as 1901 to 2155, and
// 0000.
// In two-digit format, values display as 70 to 69, representing
// years from 1970 to 2069.
final int i32 = buffer.getUint8();
// If connection property 'YearIsDateType' has
// set, value is java.sql.Date.
/*
* if (cal == null) cal = Calendar.getInstance(); cal.clear();
* cal.set(Calendar.YEAR, i32 + 1900); value = new
* java.sql.Date(cal.getTimeInMillis());
*/
// The else, value is java.lang.Short.
if (i32 == 0) {
value = "0000";
} else {
value = String.valueOf((short) (i32 + 1900));
}
// It might seem more correct to create a java.sql.Types.DATE
// value
// for this date, but it is much simpler to pass the value as an
// integer. The MySQL JDBC specification states that one can
// pass a java int between 1901 and 2055. Creating a DATE value
// causes truncation errors with certain SQL_MODES
// (e.g."STRICT_TRANS_TABLES").
javaType = Types.VARCHAR; // Types.INTEGER;
length = 1;
break;
}
case LogEvent.MYSQL_TYPE_ENUM: {
final int int32;
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
switch (len) {
case 1:
int32 = buffer.getUint8();
break;
case 2:
int32 = buffer.getUint16();
break;
default:
throw new IllegalArgumentException("!! Unknown ENUM packlen = " + len);
}
// logger.warn("MYSQL_TYPE_ENUM : This enumeration value is "
// + "only used internally and cannot exist in a binlog!");
value = Integer.valueOf(int32);
javaType = Types.INTEGER;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_SET: {
final int nbits = (meta & 0xFF) * 8;
len = (nbits + 7) / 8;
if (nbits > 1) {
// byte[] bits = new byte[len];
// buffer.fillBytes(bits, 0, len);
// 转化为unsign long
switch (len) {
case 1:
value = buffer.getUint8();
break;
case 2:
value = buffer.getUint16();
break;
case 3:
value = buffer.getUint24();
break;
case 4:
value = buffer.getUint32();
break;
case 5:
value = buffer.getUlong40();
break;
case 6:
value = buffer.getUlong48();
break;
case 7:
value = buffer.getUlong56();
break;
case 8:
value = buffer.getUlong64();
break;
default:
throw new IllegalArgumentException("!! Unknown Set len = " + len);
}
} else {
final int bit = buffer.getInt8();
// value = (bit != 0) ? Boolean.TRUE : Boolean.FALSE;
value = bit;
}
javaType = Types.BIT;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_TINY_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_TINY_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_MEDIUM_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_MEDIUM_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_LONG_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_LONG_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_BLOB: {
/*
* BLOB or TEXT datatype
*/
switch (meta) {
case 1: {
/* TINYBLOB/TINYTEXT */
final int len8 = buffer.getUint8();
byte[] binary = new byte[len8];
buffer.fillBytes(binary, 0, len8);
value = binary;
javaType = Types.VARBINARY;
length = len8;
break;
}
case 2: {
/* BLOB/TEXT */
final int len16 = buffer.getUint16();
byte[] binary = new byte[len16];
buffer.fillBytes(binary, 0, len16);
value = binary;
javaType = Types.LONGVARBINARY;
length = len16;
break;
}
case 3: {
/* MEDIUMBLOB/MEDIUMTEXT */
final int len24 = buffer.getUint24();
byte[] binary = new byte[len24];
buffer.fillBytes(binary, 0, len24);
value = binary;
javaType = Types.LONGVARBINARY;
length = len24;
break;
}
case 4: {
/* LONGBLOB/LONGTEXT */
final int len32 = (int) buffer.getUint32();
byte[] binary = new byte[len32];
buffer.fillBytes(binary, 0, len32);
value = binary;
javaType = Types.LONGVARBINARY;
length = len32;
break;
}
default:
throw new IllegalArgumentException("!! Unknown BLOB packlen = " + meta);
}
break;
}
case LogEvent.MYSQL_TYPE_VARCHAR:
case LogEvent.MYSQL_TYPE_VAR_STRING: {
/*
* Except for the data length calculation, MYSQL_TYPE_VARCHAR,
* MYSQL_TYPE_VAR_STRING and MYSQL_TYPE_STRING are handled the
* same way.
*/
len = meta;
if (len < 256) {
len = buffer.getUint8();
} else {
len = buffer.getUint16();
}
if (isBinary) {
// fixed issue #66 ,binary类型在binlog中为var_string
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
javaType = Types.VARBINARY;
value = binary;
} else {
value = buffer.getFullString(len, charsetName);
javaType = Types.VARCHAR;
}
length = len;
break;
}
case LogEvent.MYSQL_TYPE_STRING: {
if (len < 256) {
len = buffer.getUint8();
} else {
len = buffer.getUint16();
}
if (isBinary) {
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
javaType = Types.BINARY;
value = binary;
} else {
value = buffer.getFullString(len, charsetName);
javaType = Types.CHAR; // Types.VARCHAR;
}
length = len;
break;
}
case LogEvent.MYSQL_TYPE_JSON: {
switch (meta) {
case 1: {
len = buffer.getUint8();
break;
}
case 2: {
len = buffer.getUint16();
break;
}
case 3: {
len = buffer.getUint24();
break;
}
case 4: {
len = (int) buffer.getUint32();
break;
}
default:
throw new IllegalArgumentException("!! Unknown JSON packlen = " + meta);
}
if (partialBits.get(1)) {
// print_json_diff
int position = buffer.position();
StringBuilder builder = JsonDiffConversion.print_json_diff(buffer,
len,
columnName,
columnIndex,
charsetName);
value = builder.toString();
buffer.position(position + len);
} else {
if (0 == len) {
// fixed issue #1 by lava, json column of zero length
// has no
// value, value parsing should be skipped
value = "";
} else {
int position = buffer.position();
Json_Value jsonValue = JsonConversion.parse_value(buffer.getUint8(),
buffer,
len - 1,
charsetName);
StringBuilder builder = new StringBuilder();
jsonValue.toJsonString(builder, charsetName);
value = builder.toString();
buffer.position(position + len);
}
}
javaType = Types.VARCHAR;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_GEOMETRY: {
/*
* MYSQL_TYPE_GEOMETRY: copy from BLOB or TEXT
*/
switch (meta) {
case 1:
len = buffer.getUint8();
break;
case 2:
len = buffer.getUint16();
break;
case 3:
len = buffer.getUint24();
break;
case 4:
len = (int) buffer.getUint32();
break;
default:
throw new IllegalArgumentException("!! Unknown MYSQL_TYPE_GEOMETRY packlen = " + meta);
}
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
/* Warning unsupport cloumn type */
// logger.warn(String.format("!! Unsupport column type MYSQL_TYPE_GEOMETRY: meta=%d (%04X), len = %d",
// meta,
// meta,
// len));
javaType = Types.BINARY;
value = binary;
length = len;
break;
}
default:
logger.error(String.format("!! Don't know how to handle column type=%d meta=%d (%04X)",
type,
meta,
meta));
javaType = Types.OTHER;
value = null;
length = 0;
}
return value;
} } | public class class_name {
final Serializable fetchValue(String columnName, int columnIndex, int type, final int meta, boolean isBinary) {
int len = 0;
if (type == LogEvent.MYSQL_TYPE_STRING) {
if (meta >= 256) {
int byte0 = meta >> 8;
int byte1 = meta & 0xff;
if ((byte0 & 0x30) != 0x30) {
/* a long CHAR() field: see #37426 */
len = byte1 | (((byte0 & 0x30) ^ 0x30) << 4);
// depends on control dependency: [if], data = [((byte0 & 0x30)]
type = byte0 | 0x30;
// depends on control dependency: [if], data = [none]
} else {
switch (byte0) {
case LogEvent.MYSQL_TYPE_SET:
case LogEvent.MYSQL_TYPE_ENUM:
case LogEvent.MYSQL_TYPE_STRING:
type = byte0;
len = byte1;
break;
default:
throw new IllegalArgumentException(String.format("!! Don't know how to handle column type=%d meta=%d (%04X)",
type,
meta,
meta));
}
}
} else {
len = meta;
}
}
switch (type) {
case LogEvent.MYSQL_TYPE_LONG: {
// XXX: How to check signed / unsigned?
// value = unsigned ? Long.valueOf(buffer.getUint32()) :
// Integer.valueOf(buffer.getInt32());
value = Integer.valueOf(buffer.getInt32());
javaType = Types.INTEGER;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_TINY: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint8() :
// buffer.getInt8());
value = Integer.valueOf(buffer.getInt8());
javaType = Types.TINYINT; // java.sql.Types.INTEGER;
length = 1;
break;
}
case LogEvent.MYSQL_TYPE_SHORT: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint16() :
// buffer.getInt16());
value = Integer.valueOf((short) buffer.getInt16());
javaType = Types.SMALLINT; // java.sql.Types.INTEGER;
length = 2;
break;
}
case LogEvent.MYSQL_TYPE_INT24: {
// XXX: How to check signed / unsigned?
// value = Integer.valueOf(unsigned ? buffer.getUint24() :
// buffer.getInt24());
value = Integer.valueOf(buffer.getInt24());
javaType = Types.INTEGER;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_LONGLONG: {
// XXX: How to check signed / unsigned?
// value = unsigned ? buffer.getUlong64()) :
// Long.valueOf(buffer.getLong64());
value = Long.valueOf(buffer.getLong64());
javaType = Types.BIGINT; // Types.INTEGER;
length = 8;
break;
}
case LogEvent.MYSQL_TYPE_DECIMAL: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_DECIMAL : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
javaType = Types.DECIMAL;
value = null; /* unknown format */
length = 0;
break;
}
case LogEvent.MYSQL_TYPE_NEWDECIMAL: {
final int precision = meta >> 8;
final int decimals = meta & 0xff;
value = buffer.getDecimal(precision, decimals);
javaType = Types.DECIMAL;
length = precision;
break;
}
case LogEvent.MYSQL_TYPE_FLOAT: {
value = Float.valueOf(buffer.getFloat32());
javaType = Types.REAL; // Types.FLOAT;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_DOUBLE: {
value = Double.valueOf(buffer.getDouble64());
javaType = Types.DOUBLE;
length = 8;
break;
}
case LogEvent.MYSQL_TYPE_BIT: {
/* Meta-data: bit_len, bytes_in_rec, 2 bytes */
final int nbits = ((meta >> 8) * 8) + (meta & 0xff);
len = (nbits + 7) / 8;
if (nbits > 1) {
// byte[] bits = new byte[len];
// buffer.fillBytes(bits, 0, len);
// 转化为unsign long
switch (len) {
case 1:
value = buffer.getUint8();
break;
case 2:
value = buffer.getBeUint16();
break;
case 3:
value = buffer.getBeUint24();
break;
case 4:
value = buffer.getBeUint32();
break;
case 5:
value = buffer.getBeUlong40();
break;
case 6:
value = buffer.getBeUlong48();
break;
case 7:
value = buffer.getBeUlong56();
break;
case 8:
value = buffer.getBeUlong64();
break;
default:
throw new IllegalArgumentException("!! Unknown Bit len = " + len);
}
} else {
final int bit = buffer.getInt8();
// value = (bit != 0) ? Boolean.TRUE : Boolean.FALSE;
value = bit;
}
javaType = Types.BIT;
length = nbits;
break;
}
case LogEvent.MYSQL_TYPE_TIMESTAMP: {
// MYSQL DataTypes: TIMESTAMP
// range is '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07'
// UTC
// A TIMESTAMP cannot represent the value '1970-01-01 00:00:00'
// because that is equivalent to 0 seconds from the epoch and
// the value 0 is reserved for representing '0000-00-00
// 00:00:00', the “zero” TIMESTAMP value.
final long i32 = buffer.getUint32();
if (i32 == 0) {
value = "0000-00-00 00:00:00";
// depends on control dependency: [if], data = [none]
} else {
String v = new Timestamp(i32 * 1000).toString();
value = v.substring(0, v.length() - 2);
// depends on control dependency: [if], data = [none]
}
javaType = Types.TIMESTAMP;
length = 4;
break;
}
case LogEvent.MYSQL_TYPE_TIMESTAMP2: {
final long tv_sec = buffer.getBeUint32(); // big-endian
int tv_usec = 0;
switch (meta) {
case 0:
tv_usec = 0;
break;
case 1:
case 2:
tv_usec = buffer.getInt8() * 10000;
break;
case 3:
case 4:
tv_usec = buffer.getBeInt16() * 100;
break;
case 5:
case 6:
tv_usec = buffer.getBeInt24();
break;
default:
tv_usec = 0;
break;
}
String second = null;
if (tv_sec == 0) {
second = "0000-00-00 00:00:00";
// depends on control dependency: [if], data = [none]
} else {
Timestamp time = new Timestamp(tv_sec * 1000);
second = time.toString();
// depends on control dependency: [if], data = [none]
second = second.substring(0, second.length() - 2);// 去掉毫秒精度.0
// depends on control dependency: [if], data = [none]
}
if (meta >= 1) {
String microSecond = usecondsToStr(tv_usec, meta);
microSecond = microSecond.substring(0, meta);
// depends on control dependency: [if], data = [none]
value = second + '.' + microSecond;
// depends on control dependency: [if], data = [none]
} else {
value = second;
// depends on control dependency: [if], data = [none]
}
javaType = Types.TIMESTAMP;
// depends on control dependency: [if], data = [none]
length = 4 + (meta + 1) / 2;
// depends on control dependency: [if], data = [none]
break;
}
case LogEvent.MYSQL_TYPE_DATETIME: {
// MYSQL DataTypes: DATETIME
// range is '0000-01-01 00:00:00' to '9999-12-31 23:59:59'
final long i64 = buffer.getLong64(); /* YYYYMMDDhhmmss */
if (i64 == 0) {
value = "0000-00-00 00:00:00";
// depends on control dependency: [if], data = [none]
} else {
final int d = (int) (i64 / 1000000);
final int t = (int) (i64 % 1000000);
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
/* month is 0-based, 0 for january. */
// cal.set(d / 10000, (d % 10000) / 100 - 1, d % 100, t /
// 10000, (t % 10000) / 100, t % 100);
// value = new Timestamp(cal.getTimeInMillis());
// value = String.format("%04d-%02d-%02d %02d:%02d:%02d",
// d / 10000,
// (d % 10000) / 100,
// d % 100,
// t / 10000,
// (t % 10000) / 100,
// t % 100);
StringBuilder builder = new StringBuilder();
appendNumber4(builder, d / 10000);
// depends on control dependency: [if], data = [0)]
builder.append('-');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (d % 10000) / 100);
// depends on control dependency: [if], data = [0)]
builder.append('-');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, d % 100);
// depends on control dependency: [if], data = [0)]
builder.append(' ');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, t / 10000);
// depends on control dependency: [if], data = [0)]
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (t % 10000) / 100);
// depends on control dependency: [if], data = [0)]
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, t % 100);
// depends on control dependency: [if], data = [0)]
value = builder.toString();
// depends on control dependency: [if], data = [none]
}
javaType = Types.TIMESTAMP;
// depends on control dependency: [if], data = [none]
length = 8;
// depends on control dependency: [if], data = [none]
break;
}
case LogEvent.MYSQL_TYPE_DATETIME2: {
/*
* DATETIME and DATE low-level memory and disk representation
* routines 1 bit sign (used when on disk) 17 bits year*13+month
* (year 0-9999, month 0-12) 5 bits day (0-31) 5 bits hour
* (0-23) 6 bits minute (0-59) 6 bits second (0-59) 24 bits
* microseconds (0-999999) Total: 64 bits = 8 bytes
* SYYYYYYY.YYYYYYYY
* .YYdddddh.hhhhmmmm.mmssssss.ffffffff.ffffffff.ffffffff
*/
long intpart = buffer.getBeUlong40() - DATETIMEF_INT_OFS; // big-endian
int frac = 0;
switch (meta) {
case 0:
frac = 0;
break;
case 1:
case 2:
frac = buffer.getInt8() * 10000;
break;
case 3:
case 4:
frac = buffer.getBeInt16() * 100;
break;
case 5:
case 6:
frac = buffer.getBeInt24();
break;
default:
frac = 0;
break;
}
String second = null;
if (intpart == 0) {
second = "0000-00-00 00:00:00";
// depends on control dependency: [if], data = [none]
} else {
// 构造TimeStamp只处理到秒
long ymd = intpart >> 17;
long ym = ymd >> 5;
long hms = intpart % (1 << 17);
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set((int) (ym / 13), (int) (ym % 13) - 1, (int) (ymd
// % (1 << 5)), (int) (hms >> 12),
// (int) ((hms >> 6) % (1 << 6)), (int) (hms % (1 << 6)));
// value = new Timestamp(cal.getTimeInMillis());
// second = String.format("%04d-%02d-%02d %02d:%02d:%02d",
// (int) (ym / 13),
// (int) (ym % 13),
// (int) (ymd % (1 << 5)),
// (int) (hms >> 12),
// (int) ((hms >> 6) % (1 << 6)),
// (int) (hms % (1 << 6)));
StringBuilder builder = new StringBuilder(26);
appendNumber4(builder, (int) (ym / 13));
// depends on control dependency: [if], data = [none]
builder.append('-');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (int) (ym % 13));
// depends on control dependency: [if], data = [none]
builder.append('-');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (int) (ymd % (1 << 5)));
// depends on control dependency: [if], data = [none]
builder.append(' ');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (int) (hms >> 12));
// depends on control dependency: [if], data = [none]
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (int) ((hms >> 6) % (1 << 6)));
// depends on control dependency: [if], data = [none]
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (int) (hms % (1 << 6)));
// depends on control dependency: [if], data = [none]
second = builder.toString();
// depends on control dependency: [if], data = [none]
}
if (meta >= 1) {
String microSecond = usecondsToStr(frac, meta);
microSecond = microSecond.substring(0, meta);
// depends on control dependency: [if], data = [none]
value = second + '.' + microSecond;
// depends on control dependency: [if], data = [none]
} else {
value = second;
// depends on control dependency: [if], data = [none]
}
javaType = Types.TIMESTAMP;
// depends on control dependency: [if], data = [none]
length = 5 + (meta + 1) / 2;
// depends on control dependency: [if], data = [none]
break;
}
case LogEvent.MYSQL_TYPE_TIME: {
// MYSQL DataTypes: TIME
// The range is '-838:59:59' to '838:59:59'
// final int i32 = buffer.getUint24();
final int i32 = buffer.getInt24();
final int u32 = Math.abs(i32);
if (i32 == 0) {
value = "00:00:00";
// depends on control dependency: [if], data = [none]
} else {
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set(70, 0, 1, i32 / 10000, (i32 % 10000) / 100, i32 %
// 100);
// value = new Time(cal.getTimeInMillis());
// value = String.format("%s%02d:%02d:%02d",
// (i32 >= 0) ? "" : "-",
// u32 / 10000,
// (u32 % 10000) / 100,
// u32 % 100);
StringBuilder builder = new StringBuilder(17);
if (i32 < 0) {
builder.append('-');
// depends on control dependency: [if], data = [none]
}
int d = u32 / 10000;
if (d > 100) {
builder.append(String.valueOf(d));
// depends on control dependency: [if], data = [(d]
} else {
appendNumber2(builder, d);
// depends on control dependency: [if], data = [none]
}
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, (u32 % 10000) / 100);
// depends on control dependency: [if], data = [0)]
builder.append(':');
// depends on control dependency: [if], data = [none]
appendNumber2(builder, u32 % 100);
// depends on control dependency: [if], data = [0)]
value = builder.toString();
// depends on control dependency: [if], data = [none]
}
javaType = Types.TIME;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_TIME2: {
/*
* TIME low-level memory and disk representation routines
* In-memory format: 1 bit sign (Used for sign, when on disk) 1
* bit unused (Reserved for wider hour range, e.g. for
* intervals) 10 bit hour (0-836) 6 bit minute (0-59) 6 bit
* second (0-59) 24 bits microseconds (0-999999) Total: 48 bits
* = 6 bytes
* Suhhhhhh.hhhhmmmm.mmssssss.ffffffff.ffffffff.ffffffff
*/
long intpart = 0;
int frac = 0;
long ltime = 0;
switch (meta) {
case 0:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS; // big-endian
ltime = intpart << 24;
break;
case 1:
case 2:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
frac = buffer.getUint8();
if (intpart < 0 && frac > 0) {
/*
* Negative values are stored with reverse
* fractional part order, for binary sort
* compatibility. Disk value intpart frac Time value
* Memory value 800000.00 0 0 00:00:00.00
* 0000000000.000000 7FFFFF.FF -1 255 -00:00:00.01
* FFFFFFFFFF.FFD8F0 7FFFFF.9D -1 99 -00:00:00.99
* FFFFFFFFFF.F0E4D0 7FFFFF.00 -1 0 -00:00:01.00
* FFFFFFFFFF.000000 7FFFFE.FF -1 255 -00:00:01.01
* FFFFFFFFFE.FFD8F0 7FFFFE.F6 -2 246 -00:00:01.10
* FFFFFFFFFE.FE7960 Formula to convert fractional
* part from disk format (now stored in "frac"
* variable) to absolute value: "0x100 - frac". To
* reconstruct in-memory value, we shift to the next
* integer value and then substruct fractional part.
*/
intpart++; /* Shift to the next integer value */
// depends on control dependency: [if], data = [none]
frac -= 0x100; /* -(0x100 - frac) */
// depends on control dependency: [if], data = [none]
// fraclong = frac * 10000;
}
frac = frac * 10000;
ltime = intpart << 24;
break;
case 3:
case 4:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
frac = buffer.getBeUint16();
if (intpart < 0 && frac > 0) {
/*
* Fix reverse fractional part order:
* "0x10000 - frac". See comments for FSP=1 and
* FSP=2 above.
*/
intpart++; /* Shift to the next integer value */
// depends on control dependency: [if], data = [none]
frac -= 0x10000; /* -(0x10000-frac) */
// depends on control dependency: [if], data = [none]
// fraclong = frac * 100;
}
frac = frac * 100;
ltime = intpart << 24;
break;
case 5:
case 6:
intpart = buffer.getBeUlong48() - TIMEF_OFS;
ltime = intpart;
frac = (int) (intpart % (1L << 24));
break;
default:
intpart = buffer.getBeUint24() - TIMEF_INT_OFS;
ltime = intpart << 24;
break;
}
String second = null;
if (intpart == 0) {
second = "00:00:00";
} else {
// 目前只记录秒,不处理us frac
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
// cal.set(70, 0, 1, (int) ((intpart >> 12) % (1 << 10)),
// (int) ((intpart >> 6) % (1 << 6)),
// (int) (intpart % (1 << 6)));
// value = new Time(cal.getTimeInMillis());
long ultime = Math.abs(ltime);
intpart = ultime >> 24;
// second = String.format("%s%02d:%02d:%02d",
// ltime >= 0 ? "" : "-",
// (int) ((intpart >> 12) % (1 << 10)),
// (int) ((intpart >> 6) % (1 << 6)),
// (int) (intpart % (1 << 6)));
StringBuilder builder = new StringBuilder(12);
if (ltime < 0) {
builder.append('-');
// depends on control dependency: [if], data = [none]
}
int d = (int) ((intpart >> 12) % (1 << 10));
if (d > 100) {
builder.append(String.valueOf(d));
// depends on control dependency: [if], data = [(d]
} else {
appendNumber2(builder, d);
// depends on control dependency: [if], data = [none]
}
builder.append(':');
appendNumber2(builder, (int) ((intpart >> 6) % (1 << 6)));
builder.append(':');
appendNumber2(builder, (int) (intpart % (1 << 6)));
second = builder.toString();
}
if (meta >= 1) {
String microSecond = usecondsToStr(Math.abs(frac), meta);
microSecond = microSecond.substring(0, meta);
value = second + '.' + microSecond;
} else {
value = second;
}
javaType = Types.TIME;
length = 3 + (meta + 1) / 2;
break;
}
case LogEvent.MYSQL_TYPE_NEWDATE: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_NEWDATE : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
javaType = Types.DATE;
value = null; /* unknown format */
length = 0;
break;
}
case LogEvent.MYSQL_TYPE_DATE: {
// MYSQL DataTypes:
// range: 0000-00-00 ~ 9999-12-31
final int i32 = buffer.getUint24();
if (i32 == 0) {
value = "0000-00-00";
} else {
// if (cal == null) cal = Calendar.getInstance();
// cal.clear();
/* month is 0-based, 0 for january. */
// cal.set((i32 / (16 * 32)), (i32 / 32 % 16) - 1, (i32 %
// 32));
// value = new java.sql.Date(cal.getTimeInMillis());
// value = String.format("%04d-%02d-%02d", i32 / (16 * 32),
// i32 / 32 % 16, i32 % 32);
StringBuilder builder = new StringBuilder(12);
appendNumber4(builder, i32 / (16 * 32));
builder.append('-');
appendNumber2(builder, i32 / 32 % 16);
builder.append('-');
appendNumber2(builder, i32 % 32);
value = builder.toString();
}
javaType = Types.DATE;
length = 3;
break;
}
case LogEvent.MYSQL_TYPE_YEAR: {
// MYSQL DataTypes: YEAR[(2|4)]
// In four-digit format, values display as 1901 to 2155, and
// 0000.
// In two-digit format, values display as 70 to 69, representing
// years from 1970 to 2069.
final int i32 = buffer.getUint8();
// If connection property 'YearIsDateType' has
// set, value is java.sql.Date.
/*
* if (cal == null) cal = Calendar.getInstance(); cal.clear();
* cal.set(Calendar.YEAR, i32 + 1900); value = new
* java.sql.Date(cal.getTimeInMillis());
*/
// The else, value is java.lang.Short.
if (i32 == 0) {
value = "0000";
} else {
value = String.valueOf((short) (i32 + 1900));
}
// It might seem more correct to create a java.sql.Types.DATE
// value
// for this date, but it is much simpler to pass the value as an
// integer. The MySQL JDBC specification states that one can
// pass a java int between 1901 and 2055. Creating a DATE value
// causes truncation errors with certain SQL_MODES
// (e.g."STRICT_TRANS_TABLES").
javaType = Types.VARCHAR; // Types.INTEGER;
length = 1;
break;
}
case LogEvent.MYSQL_TYPE_ENUM: {
final int int32;
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
switch (len) {
case 1:
int32 = buffer.getUint8();
break;
case 2:
int32 = buffer.getUint16();
break;
default:
throw new IllegalArgumentException("!! Unknown ENUM packlen = " + len);
}
// logger.warn("MYSQL_TYPE_ENUM : This enumeration value is "
// + "only used internally and cannot exist in a binlog!");
value = Integer.valueOf(int32);
javaType = Types.INTEGER;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_SET: {
final int nbits = (meta & 0xFF) * 8;
len = (nbits + 7) / 8;
if (nbits > 1) {
// byte[] bits = new byte[len];
// buffer.fillBytes(bits, 0, len);
// 转化为unsign long
switch (len) {
case 1:
value = buffer.getUint8();
break;
case 2:
value = buffer.getUint16();
break;
case 3:
value = buffer.getUint24();
break;
case 4:
value = buffer.getUint32();
break;
case 5:
value = buffer.getUlong40();
break;
case 6:
value = buffer.getUlong48();
break;
case 7:
value = buffer.getUlong56();
break;
case 8:
value = buffer.getUlong64();
break;
default:
throw new IllegalArgumentException("!! Unknown Set len = " + len);
}
} else {
final int bit = buffer.getInt8();
// value = (bit != 0) ? Boolean.TRUE : Boolean.FALSE;
value = bit;
}
javaType = Types.BIT;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_TINY_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_TINY_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_MEDIUM_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_MEDIUM_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_LONG_BLOB: {
/*
* log_event.h : This enumeration value is only used internally
* and cannot exist in a binlog.
*/
logger.warn("MYSQL_TYPE_LONG_BLOB : This enumeration value is "
+ "only used internally and cannot exist in a binlog!");
}
case LogEvent.MYSQL_TYPE_BLOB: {
/*
* BLOB or TEXT datatype
*/
switch (meta) {
case 1: {
/* TINYBLOB/TINYTEXT */
final int len8 = buffer.getUint8();
byte[] binary = new byte[len8];
buffer.fillBytes(binary, 0, len8);
value = binary;
javaType = Types.VARBINARY;
length = len8;
break;
}
case 2: {
/* BLOB/TEXT */
final int len16 = buffer.getUint16();
byte[] binary = new byte[len16];
buffer.fillBytes(binary, 0, len16);
value = binary;
javaType = Types.LONGVARBINARY;
length = len16;
break;
}
case 3: {
/* MEDIUMBLOB/MEDIUMTEXT */
final int len24 = buffer.getUint24();
byte[] binary = new byte[len24];
buffer.fillBytes(binary, 0, len24);
value = binary;
javaType = Types.LONGVARBINARY;
length = len24;
break;
}
case 4: {
/* LONGBLOB/LONGTEXT */
final int len32 = (int) buffer.getUint32();
byte[] binary = new byte[len32];
buffer.fillBytes(binary, 0, len32);
value = binary;
javaType = Types.LONGVARBINARY;
length = len32;
break;
}
default:
throw new IllegalArgumentException("!! Unknown BLOB packlen = " + meta);
}
break;
}
case LogEvent.MYSQL_TYPE_VARCHAR:
case LogEvent.MYSQL_TYPE_VAR_STRING: {
/*
* Except for the data length calculation, MYSQL_TYPE_VARCHAR,
* MYSQL_TYPE_VAR_STRING and MYSQL_TYPE_STRING are handled the
* same way.
*/
len = meta;
if (len < 256) {
len = buffer.getUint8();
} else {
len = buffer.getUint16();
}
if (isBinary) {
// fixed issue #66 ,binary类型在binlog中为var_string
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
javaType = Types.VARBINARY;
value = binary;
} else {
value = buffer.getFullString(len, charsetName);
javaType = Types.VARCHAR;
}
length = len;
break;
}
case LogEvent.MYSQL_TYPE_STRING: {
if (len < 256) {
len = buffer.getUint8();
} else {
len = buffer.getUint16();
}
if (isBinary) {
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
javaType = Types.BINARY;
value = binary;
} else {
value = buffer.getFullString(len, charsetName);
javaType = Types.CHAR; // Types.VARCHAR;
}
length = len;
break;
}
case LogEvent.MYSQL_TYPE_JSON: {
switch (meta) {
case 1: {
len = buffer.getUint8();
break;
}
case 2: {
len = buffer.getUint16();
break;
}
case 3: {
len = buffer.getUint24();
break;
}
case 4: {
len = (int) buffer.getUint32();
break;
}
default:
throw new IllegalArgumentException("!! Unknown JSON packlen = " + meta);
}
if (partialBits.get(1)) {
// print_json_diff
int position = buffer.position();
StringBuilder builder = JsonDiffConversion.print_json_diff(buffer,
len,
columnName,
columnIndex,
charsetName);
value = builder.toString();
buffer.position(position + len);
} else {
if (0 == len) {
// fixed issue #1 by lava, json column of zero length
// has no
// value, value parsing should be skipped
value = "";
} else {
int position = buffer.position();
Json_Value jsonValue = JsonConversion.parse_value(buffer.getUint8(),
buffer,
len - 1,
charsetName);
StringBuilder builder = new StringBuilder();
jsonValue.toJsonString(builder, charsetName);
value = builder.toString();
buffer.position(position + len);
}
}
javaType = Types.VARCHAR;
length = len;
break;
}
case LogEvent.MYSQL_TYPE_GEOMETRY: {
/*
* MYSQL_TYPE_GEOMETRY: copy from BLOB or TEXT
*/
switch (meta) {
case 1:
len = buffer.getUint8();
break;
case 2:
len = buffer.getUint16();
break;
case 3:
len = buffer.getUint24();
break;
case 4:
len = (int) buffer.getUint32();
break;
default:
throw new IllegalArgumentException("!! Unknown MYSQL_TYPE_GEOMETRY packlen = " + meta);
}
/* fill binary */
byte[] binary = new byte[len];
buffer.fillBytes(binary, 0, len);
/* Warning unsupport cloumn type */
// logger.warn(String.format("!! Unsupport column type MYSQL_TYPE_GEOMETRY: meta=%d (%04X), len = %d",
// meta,
// meta,
// len));
javaType = Types.BINARY;
value = binary;
length = len;
break;
}
default:
logger.error(String.format("!! Don't know how to handle column type=%d meta=%d (%04X)",
type,
meta,
meta));
javaType = Types.OTHER;
value = null;
length = 0;
}
return value;
} } |
public class class_name {
public static String toParams(Map<String, ?> paramMap, Charset charset) {
if (CollectionUtil.isEmpty(paramMap)) {
return StrUtil.EMPTY;
}
if (null == charset) {// 默认编码为系统编码
charset = CharsetUtil.CHARSET_UTF_8;
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
String key;
Object value;
String valueStr;
for (Entry<String, ?> item : paramMap.entrySet()) {
if (isFirst) {
isFirst = false;
} else {
sb.append("&");
}
key = item.getKey();
value = item.getValue();
if (value instanceof Iterable) {
value = CollectionUtil.join((Iterable<?>) value, ",");
} else if (value instanceof Iterator) {
value = CollectionUtil.join((Iterator<?>) value, ",");
}
valueStr = Convert.toStr(value);
if (StrUtil.isNotEmpty(key)) {
sb.append(URLUtil.encodeQuery(key, charset)).append("=");
if (StrUtil.isNotEmpty(valueStr)) {
sb.append(URLUtil.encodeQuery(valueStr, charset));
}
}
}
return sb.toString();
} } | public class class_name {
public static String toParams(Map<String, ?> paramMap, Charset charset) {
if (CollectionUtil.isEmpty(paramMap)) {
return StrUtil.EMPTY;
// depends on control dependency: [if], data = [none]
}
if (null == charset) {// 默认编码为系统编码
charset = CharsetUtil.CHARSET_UTF_8;
// depends on control dependency: [if], data = [none]
}
final StringBuilder sb = new StringBuilder();
boolean isFirst = true;
String key;
Object value;
String valueStr;
for (Entry<String, ?> item : paramMap.entrySet()) {
if (isFirst) {
isFirst = false;
// depends on control dependency: [if], data = [none]
} else {
sb.append("&");
// depends on control dependency: [if], data = [none]
}
key = item.getKey();
// depends on control dependency: [for], data = [item]
value = item.getValue();
// depends on control dependency: [for], data = [item]
if (value instanceof Iterable) {
value = CollectionUtil.join((Iterable<?>) value, ",");
// depends on control dependency: [if], data = [none]
} else if (value instanceof Iterator) {
value = CollectionUtil.join((Iterator<?>) value, ",");
// depends on control dependency: [if], data = [none]
}
valueStr = Convert.toStr(value);
// depends on control dependency: [for], data = [none]
if (StrUtil.isNotEmpty(key)) {
sb.append(URLUtil.encodeQuery(key, charset)).append("=");
// depends on control dependency: [if], data = [none]
if (StrUtil.isNotEmpty(valueStr)) {
sb.append(URLUtil.encodeQuery(valueStr, charset));
// depends on control dependency: [if], data = [none]
}
}
}
return sb.toString();
} } |
public class class_name {
public static boolean preOrderTraversal(File root, FileVisitor visitor) throws Exception {
if (!visitor.visit(root)) {
return false;
}
if (root.isDirectory()) {
for (File child : root.listFiles()) {
if (!preOrderTraversal(child, visitor)) {
return false;
}
}
}
return true;
} } | public class class_name {
public static boolean preOrderTraversal(File root, FileVisitor visitor) throws Exception {
if (!visitor.visit(root)) {
return false;
}
if (root.isDirectory()) {
for (File child : root.listFiles()) {
if (!preOrderTraversal(child, visitor)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
if (srcBegin < 0) {
srcBegin = 0;
}
if (srcEnd < 0) {
srcEnd = 0;
} else if (srcEnd > this.position) {
srcEnd = this.position;
}
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
}
System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
return this;
} } | public class class_name {
public StrBuilder getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
if (srcBegin < 0) {
srcBegin = 0; // depends on control dependency: [if], data = [none]
}
if (srcEnd < 0) {
srcEnd = 0; // depends on control dependency: [if], data = [none]
} else if (srcEnd > this.position) {
srcEnd = this.position; // depends on control dependency: [if], data = [none]
}
if (srcBegin > srcEnd) {
throw new StringIndexOutOfBoundsException("srcBegin > srcEnd");
}
System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
return this;
} } |
public class class_name {
public static UnicodeSet parseGlobalFilter(String id, int[] pos, int dir,
int[] withParens,
StringBuffer canonID) {
UnicodeSet filter = null;
int start = pos[0];
if (withParens[0] == -1) {
withParens[0] = Utility.parseChar(id, pos, OPEN_REV) ? 1 : 0;
} else if (withParens[0] == 1) {
if (!Utility.parseChar(id, pos, OPEN_REV)) {
pos[0] = start;
return null;
}
}
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (UnicodeSet.resemblesPattern(id, pos[0])) {
ParsePosition ppos = new ParsePosition(pos[0]);
try {
filter = new UnicodeSet(id, ppos, null);
} catch (IllegalArgumentException e) {
pos[0] = start;
return null;
}
String pattern = id.substring(pos[0], ppos.getIndex());
pos[0] = ppos.getIndex();
if (withParens[0] == 1 && !Utility.parseChar(id, pos, CLOSE_REV)) {
pos[0] = start;
return null;
}
// In the forward direction, append the pattern to the
// canonID. In the reverse, insert it at zero, and invert
// the presence of parens ("A" <-> "(A)").
if (canonID != null) {
if (dir == FORWARD) {
if (withParens[0] == 1) {
pattern = String.valueOf(OPEN_REV) + pattern + CLOSE_REV;
}
canonID.append(pattern + ID_DELIM);
} else {
if (withParens[0] == 0) {
pattern = String.valueOf(OPEN_REV) + pattern + CLOSE_REV;
}
canonID.insert(0, pattern + ID_DELIM);
}
}
}
return filter;
} } | public class class_name {
public static UnicodeSet parseGlobalFilter(String id, int[] pos, int dir,
int[] withParens,
StringBuffer canonID) {
UnicodeSet filter = null;
int start = pos[0];
if (withParens[0] == -1) {
withParens[0] = Utility.parseChar(id, pos, OPEN_REV) ? 1 : 0; // depends on control dependency: [if], data = [none]
} else if (withParens[0] == 1) {
if (!Utility.parseChar(id, pos, OPEN_REV)) {
pos[0] = start; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
}
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (UnicodeSet.resemblesPattern(id, pos[0])) {
ParsePosition ppos = new ParsePosition(pos[0]);
try {
filter = new UnicodeSet(id, ppos, null); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
pos[0] = start;
return null;
} // depends on control dependency: [catch], data = [none]
String pattern = id.substring(pos[0], ppos.getIndex());
pos[0] = ppos.getIndex(); // depends on control dependency: [if], data = [none]
if (withParens[0] == 1 && !Utility.parseChar(id, pos, CLOSE_REV)) {
pos[0] = start; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// In the forward direction, append the pattern to the
// canonID. In the reverse, insert it at zero, and invert
// the presence of parens ("A" <-> "(A)").
if (canonID != null) {
if (dir == FORWARD) {
if (withParens[0] == 1) {
pattern = String.valueOf(OPEN_REV) + pattern + CLOSE_REV; // depends on control dependency: [if], data = [none]
}
canonID.append(pattern + ID_DELIM); // depends on control dependency: [if], data = [none]
} else {
if (withParens[0] == 0) {
pattern = String.valueOf(OPEN_REV) + pattern + CLOSE_REV; // depends on control dependency: [if], data = [none]
}
canonID.insert(0, pattern + ID_DELIM); // depends on control dependency: [if], data = [none]
}
}
}
return filter;
} } |
public class class_name {
@Override
@SuppressWarnings("unchecked")
public Handle<K, V> deleteMax() {
if (size == 0) {
throw new NoSuchElementException();
} else if (size == 1) {
Handle<K, V> max = free;
free = null;
size--;
return max;
} else if (size % 2 == 0) {
// find max
AddressableHeap.Handle<K, HandleMap<K, V>> maxInner = maxHeap.deleteMin();
ReflectedHandle<K, V> maxOuter = maxInner.getValue().outer;
maxOuter.inner = null;
maxOuter.minNotMax = false;
// delete min and keep as free
AddressableHeap.Handle<K, HandleMap<K, V>> minInner = maxInner.getValue().otherInner;
ReflectedHandle<K, V> minOuter = minInner.getValue().outer;
minInner.delete();
minOuter.inner = null;
minOuter.minNotMax = false;
free = minOuter;
size--;
return maxOuter;
} else {
// find max
AddressableHeap.Handle<K, HandleMap<K, V>> maxInner = maxHeap.findMin();
int c;
if (comparator == null) {
c = ((Comparable<? super K>) maxInner.getKey()).compareTo(free.key);
} else {
c = comparator.compare(maxInner.getKey(), free.key);
}
if (c < 0) {
Handle<K, V> max = free;
free = null;
size--;
return max;
}
// maxInner is larger
maxInner.delete();
ReflectedHandle<K, V> maxOuter = maxInner.getValue().outer;
maxOuter.inner = null;
maxOuter.minNotMax = false;
// delete min
AddressableHeap.Handle<K, HandleMap<K, V>> minInner = maxInner.getValue().otherInner;
ReflectedHandle<K, V> minOuter = minInner.getValue().outer;
minInner.delete();
minOuter.inner = null;
minOuter.minNotMax = false;
// reinsert min with free
insertPair(minOuter, free);
free = null;
size--;
return maxOuter;
}
} } | public class class_name {
@Override
@SuppressWarnings("unchecked")
public Handle<K, V> deleteMax() {
if (size == 0) {
throw new NoSuchElementException();
} else if (size == 1) {
Handle<K, V> max = free;
free = null; // depends on control dependency: [if], data = [none]
size--; // depends on control dependency: [if], data = [none]
return max; // depends on control dependency: [if], data = [none]
} else if (size % 2 == 0) {
// find max
AddressableHeap.Handle<K, HandleMap<K, V>> maxInner = maxHeap.deleteMin();
ReflectedHandle<K, V> maxOuter = maxInner.getValue().outer;
maxOuter.inner = null; // depends on control dependency: [if], data = [none]
maxOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
// delete min and keep as free
AddressableHeap.Handle<K, HandleMap<K, V>> minInner = maxInner.getValue().otherInner;
ReflectedHandle<K, V> minOuter = minInner.getValue().outer;
minInner.delete(); // depends on control dependency: [if], data = [none]
minOuter.inner = null; // depends on control dependency: [if], data = [none]
minOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
free = minOuter; // depends on control dependency: [if], data = [none]
size--; // depends on control dependency: [if], data = [none]
return maxOuter; // depends on control dependency: [if], data = [none]
} else {
// find max
AddressableHeap.Handle<K, HandleMap<K, V>> maxInner = maxHeap.findMin();
int c;
if (comparator == null) {
c = ((Comparable<? super K>) maxInner.getKey()).compareTo(free.key); // depends on control dependency: [if], data = [none]
} else {
c = comparator.compare(maxInner.getKey(), free.key); // depends on control dependency: [if], data = [none]
}
if (c < 0) {
Handle<K, V> max = free;
free = null; // depends on control dependency: [if], data = [none]
size--; // depends on control dependency: [if], data = [none]
return max; // depends on control dependency: [if], data = [none]
}
// maxInner is larger
maxInner.delete(); // depends on control dependency: [if], data = [none]
ReflectedHandle<K, V> maxOuter = maxInner.getValue().outer;
maxOuter.inner = null; // depends on control dependency: [if], data = [none]
maxOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
// delete min
AddressableHeap.Handle<K, HandleMap<K, V>> minInner = maxInner.getValue().otherInner;
ReflectedHandle<K, V> minOuter = minInner.getValue().outer;
minInner.delete(); // depends on control dependency: [if], data = [none]
minOuter.inner = null; // depends on control dependency: [if], data = [none]
minOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
// reinsert min with free
insertPair(minOuter, free); // depends on control dependency: [if], data = [none]
free = null; // depends on control dependency: [if], data = [none]
size--; // depends on control dependency: [if], data = [none]
return maxOuter; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Sequence<T> next() {
Sequence<T> sequence = new Sequence<>();
int startPosition = position.getAndIncrement();
int lastId = -1;
int currentPoint = order[startPosition];
int startPoint = currentPoint;
for (int i = 0; i < walkLength; i++) {
if (alpha > 0 && lastId != startPoint && lastId != -1 && alpha > rng.nextDouble()) {
startPosition = startPoint;
continue;
}
Vertex<T> vertex = sourceGraph.getVertex(currentPoint);
sequence.addElement(vertex.getValue());
List<? extends Edge<? extends Number>> edges = sourceGraph.getEdgesOut(currentPoint);
if (edges == null || edges.isEmpty()) {
switch (noEdgeHandling) {
case CUTOFF_ON_DISCONNECTED:
// we just break this sequence
i = walkLength;
break;
case EXCEPTION_ON_DISCONNECTED:
throw new NoEdgesException("No available edges left");
case PADDING_ON_DISCONNECTED:
// TODO: implement padding
throw new UnsupportedOperationException("Padding isn't implemented yet");
case RESTART_ON_DISCONNECTED:
currentPoint = order[startPosition];
break;
case SELF_LOOP_ON_DISCONNECTED:
// we pad walk with this vertex, to do that - we just don't do anything, and currentPoint will be the same till the end of walk
break;
}
} else {
double totalWeight = 0.0;
for (Edge<? extends Number> edge : edges) {
totalWeight += edge.getValue().doubleValue();
}
double d = rng.nextDouble();
double threshold = d * totalWeight;
double sumWeight = 0.0;
for (Edge<? extends Number> edge : edges) {
sumWeight += edge.getValue().doubleValue();
if (sumWeight >= threshold) {
if (edge.isDirected()) {
currentPoint = edge.getTo();
} else {
if (edge.getFrom() == currentPoint) {
currentPoint = edge.getTo();
} else {
currentPoint = edge.getFrom(); //Undirected edge: might be next--currVertexIdx instead of currVertexIdx--next
}
}
lastId = currentPoint;
break;
}
}
}
}
return sequence;
} } | public class class_name {
@Override
public Sequence<T> next() {
Sequence<T> sequence = new Sequence<>();
int startPosition = position.getAndIncrement();
int lastId = -1;
int currentPoint = order[startPosition];
int startPoint = currentPoint;
for (int i = 0; i < walkLength; i++) {
if (alpha > 0 && lastId != startPoint && lastId != -1 && alpha > rng.nextDouble()) {
startPosition = startPoint; // depends on control dependency: [if], data = [none]
continue;
}
Vertex<T> vertex = sourceGraph.getVertex(currentPoint);
sequence.addElement(vertex.getValue()); // depends on control dependency: [for], data = [none]
List<? extends Edge<? extends Number>> edges = sourceGraph.getEdgesOut(currentPoint); // depends on control dependency: [for], data = [none]
if (edges == null || edges.isEmpty()) {
switch (noEdgeHandling) {
case CUTOFF_ON_DISCONNECTED:
// we just break this sequence
i = walkLength;
break;
case EXCEPTION_ON_DISCONNECTED:
throw new NoEdgesException("No available edges left");
case PADDING_ON_DISCONNECTED:
// TODO: implement padding
throw new UnsupportedOperationException("Padding isn't implemented yet");
case RESTART_ON_DISCONNECTED:
currentPoint = order[startPosition];
break;
case SELF_LOOP_ON_DISCONNECTED:
// we pad walk with this vertex, to do that - we just don't do anything, and currentPoint will be the same till the end of walk
break;
}
} else {
double totalWeight = 0.0;
for (Edge<? extends Number> edge : edges) {
totalWeight += edge.getValue().doubleValue();
}
double d = rng.nextDouble();
double threshold = d * totalWeight;
double sumWeight = 0.0;
for (Edge<? extends Number> edge : edges) {
sumWeight += edge.getValue().doubleValue();
if (sumWeight >= threshold) {
if (edge.isDirected()) {
currentPoint = edge.getTo();
} else {
if (edge.getFrom() == currentPoint) {
currentPoint = edge.getTo();
} else {
currentPoint = edge.getFrom(); //Undirected edge: might be next--currVertexIdx instead of currVertexIdx--next
}
}
lastId = currentPoint;
break;
}
}
}
}
return sequence;
} } |
public class class_name {
public void setNumber(String number) {
try {
String iso = null;
if (mSelectedCountry != null) {
iso = mSelectedCountry.getIso();
}
Phonenumber.PhoneNumber phoneNumber = mPhoneUtil.parse(number, iso);
int countryIdx = mCountries.indexOfIso(mPhoneUtil.getRegionCodeForNumber(phoneNumber));
mSelectedCountry = mCountries.get(countryIdx);
mCountrySpinner.setSelection(countryIdx);
mPhoneEdit.setText(mPhoneUtil.format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.NATIONAL));
} catch (NumberParseException ignored) {
}
} } | public class class_name {
public void setNumber(String number) {
try {
String iso = null;
if (mSelectedCountry != null) {
iso = mSelectedCountry.getIso(); // depends on control dependency: [if], data = [none]
}
Phonenumber.PhoneNumber phoneNumber = mPhoneUtil.parse(number, iso);
int countryIdx = mCountries.indexOfIso(mPhoneUtil.getRegionCodeForNumber(phoneNumber));
mSelectedCountry = mCountries.get(countryIdx); // depends on control dependency: [try], data = [none]
mCountrySpinner.setSelection(countryIdx); // depends on control dependency: [try], data = [none]
mPhoneEdit.setText(mPhoneUtil.format(phoneNumber, PhoneNumberUtil.PhoneNumberFormat.NATIONAL)); // depends on control dependency: [try], data = [none]
} catch (NumberParseException ignored) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getSourceLine(File file, int line, String sep)
{
SourceFile source = sourceFiles.get(file);
if (source == null)
{
try
{
source = new SourceFile(file);
sourceFiles.put(file, source);
} catch (IOException e)
{
return "Cannot open source file: " + file;
}
}
return line + sep + source.getLine(line);
} } | public class class_name {
public String getSourceLine(File file, int line, String sep)
{
SourceFile source = sourceFiles.get(file);
if (source == null)
{
try
{
source = new SourceFile(file); // depends on control dependency: [try], data = [none]
sourceFiles.put(file, source); // depends on control dependency: [try], data = [none]
} catch (IOException e)
{
return "Cannot open source file: " + file;
} // depends on control dependency: [catch], data = [none]
}
return line + sep + source.getLine(line);
} } |
public class class_name {
public void marshall(Session session, ProtocolMarshaller protocolMarshaller) {
if (session == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(session.getDuration(), DURATION_BINDING);
protocolMarshaller.marshall(session.getId(), ID_BINDING);
protocolMarshaller.marshall(session.getStartTimestamp(), STARTTIMESTAMP_BINDING);
protocolMarshaller.marshall(session.getStopTimestamp(), STOPTIMESTAMP_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Session session, ProtocolMarshaller protocolMarshaller) {
if (session == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(session.getDuration(), DURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(session.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(session.getStartTimestamp(), STARTTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(session.getStopTimestamp(), STOPTIMESTAMP_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 <I extends ImageGray<I>, O extends ImageGray<O>>
void hessian(O[] derivX, O[] derivY , ImageHessian<O> hessian , O[] derivXX, O[] derivYY , O[] derivXY )
{
for( int i = 0; i < derivX.length; i++ ) {
hessian.process(derivX[i],derivY[i],derivXX[i],derivYY[i],derivXY[i]);
}
} } | public class class_name {
public static <I extends ImageGray<I>, O extends ImageGray<O>>
void hessian(O[] derivX, O[] derivY , ImageHessian<O> hessian , O[] derivXX, O[] derivYY , O[] derivXY )
{
for( int i = 0; i < derivX.length; i++ ) {
hessian.process(derivX[i],derivY[i],derivXX[i],derivYY[i],derivXY[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private List<Row> createExceptionAssignmentRowList(String exceptionData)
{
List<Row> list = new ArrayList<Row>();
String[] exceptions = exceptionData.split(",|:");
int index = 1;
while (index < exceptions.length)
{
Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);
Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);
//Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("STARU_DATE", startDate);
map.put("ENE_DATE", endDate);
list.add(new MapRow(map));
index += 3;
}
return list;
} } | public class class_name {
private List<Row> createExceptionAssignmentRowList(String exceptionData)
{
List<Row> list = new ArrayList<Row>();
String[] exceptions = exceptionData.split(",|:");
int index = 1;
while (index < exceptions.length)
{
Date startDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 0]);
Date endDate = DatatypeConverter.parseEpochTimestamp(exceptions[index + 1]);
//Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]);
Map<String, Object> map = new HashMap<String, Object>();
map.put("STARU_DATE", startDate); // depends on control dependency: [while], data = [none]
map.put("ENE_DATE", endDate); // depends on control dependency: [while], data = [none]
list.add(new MapRow(map)); // depends on control dependency: [while], data = [none]
index += 3; // depends on control dependency: [while], data = [none]
}
return list;
} } |
public class class_name {
public boolean requestShouldBeHandledByTAI(HttpServletRequest request, SocialTaiRequest socialTaiRequest) {
// 241526 don't process jmx requests with this interceptor
if (isJmxConnectorRequest(request)) {
return false;
}
String loginHint = webUtils.getLoginHint(request);
socialTaiRequest = setSocialTaiRequestConfigInfo(request, loginHint, socialTaiRequest);
return socialTaiRequest.hasServices();
} } | public class class_name {
public boolean requestShouldBeHandledByTAI(HttpServletRequest request, SocialTaiRequest socialTaiRequest) {
// 241526 don't process jmx requests with this interceptor
if (isJmxConnectorRequest(request)) {
return false; // depends on control dependency: [if], data = [none]
}
String loginHint = webUtils.getLoginHint(request);
socialTaiRequest = setSocialTaiRequestConfigInfo(request, loginHint, socialTaiRequest);
return socialTaiRequest.hasServices();
} } |
public class class_name {
public static Date read(String value) {
String pattern = getPattern(value);
Date date=null;
try {
date = ThreadLocalDateFormatter.parse(value, pattern);
} catch (ParseException e) {
e.printStackTrace();
}
return date;
} } | public class class_name {
public static Date read(String value) {
String pattern = getPattern(value);
Date date=null;
try {
date = ThreadLocalDateFormatter.parse(value, pattern); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return date;
} } |
public class class_name {
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
if (width > 2) {
formatWeekday(b, d, width, weekdays);
return;
}
if (width == 2) {
b.append('0');
}
formatWeekdayNumeric(b, d, firstDay);
} } | public class class_name {
void formatLocalWeekday(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
if (width > 2) {
formatWeekday(b, d, width, weekdays); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (width == 2) {
b.append('0'); // depends on control dependency: [if], data = [none]
}
formatWeekdayNumeric(b, d, firstDay);
} } |
public class class_name {
public final GridParameter getParameter(GridRecord gr) {
McIDASGridRecord mgr = (McIDASGridRecord) gr;
String name = mgr.getParameterName();
String desc = mgr.getGridDescription();
if (desc.trim().equals("")) {
desc = name;
}
String unit = visad.jmet.MetUnits.makeSymbol(mgr.getParamUnitName());
return new GridParameter(0, name, desc, unit);
} } | public class class_name {
public final GridParameter getParameter(GridRecord gr) {
McIDASGridRecord mgr = (McIDASGridRecord) gr;
String name = mgr.getParameterName();
String desc = mgr.getGridDescription();
if (desc.trim().equals("")) {
desc = name; // depends on control dependency: [if], data = [none]
}
String unit = visad.jmet.MetUnits.makeSymbol(mgr.getParamUnitName());
return new GridParameter(0, name, desc, unit);
} } |
public class class_name {
static BootstrapText resolveMarkdown(Context context, String markdown, boolean editMode) {
if (markdown == null) {
return null;
}
else { // detect {fa_*} and split into spannable, ignore escaped chars
BootstrapText.Builder builder = new BootstrapText.Builder(context, editMode);
int lastAddedIndex = 0;
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < markdown.length(); i++) {
char c = markdown.charAt(i);
if (c == '\\') { // escape sequence, ignore next char
i += 2;
continue;
}
if (c == '{') {
startIndex = i;
}
else if (c == '}') {
endIndex = i;
}
if (startIndex != -1 && endIndex != -1) { // recognised markdown string
if (startIndex >= 0 && endIndex < markdown.length()) {
String iconCode = markdown.substring(startIndex + 1, endIndex).replaceAll("\\-", "_");
builder.addText(markdown.substring(lastAddedIndex, startIndex));
if (iconCode.matches(REGEX_FONT_AWESOME)) { // text is FontAwesome code
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(FontAwesome.FONT_PATH, false));
}
}
else if (iconCode.matches(REGEX_TYPICONS)) {
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(Typicon.FONT_PATH, false));
}
}
else if(iconCode.matches(REGEX_MATERIAL_ICONS)){
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(MaterialIcons.FONT_PATH, false));
}
}
else {
if (editMode) {
builder.addText("?");
}
else {
builder.addIcon(iconCode, resolveIconSet(iconCode));
}
}
lastAddedIndex = endIndex + 1;
}
startIndex = -1;
endIndex = -1;
}
}
return builder.addText(markdown.substring(lastAddedIndex, markdown.length())).build();
}
} } | public class class_name {
static BootstrapText resolveMarkdown(Context context, String markdown, boolean editMode) {
if (markdown == null) {
return null; // depends on control dependency: [if], data = [none]
}
else { // detect {fa_*} and split into spannable, ignore escaped chars
BootstrapText.Builder builder = new BootstrapText.Builder(context, editMode);
int lastAddedIndex = 0;
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < markdown.length(); i++) {
char c = markdown.charAt(i);
if (c == '\\') { // escape sequence, ignore next char
i += 2; // depends on control dependency: [if], data = [none]
continue;
}
if (c == '{') {
startIndex = i; // depends on control dependency: [if], data = [none]
}
else if (c == '}') {
endIndex = i; // depends on control dependency: [if], data = [none]
}
if (startIndex != -1 && endIndex != -1) { // recognised markdown string
if (startIndex >= 0 && endIndex < markdown.length()) {
String iconCode = markdown.substring(startIndex + 1, endIndex).replaceAll("\\-", "_");
builder.addText(markdown.substring(lastAddedIndex, startIndex)); // depends on control dependency: [if], data = [none]
if (iconCode.matches(REGEX_FONT_AWESOME)) { // text is FontAwesome code
if (editMode) {
builder.addText("?"); // depends on control dependency: [if], data = [none]
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(FontAwesome.FONT_PATH, false)); // depends on control dependency: [if], data = [none]
}
}
else if (iconCode.matches(REGEX_TYPICONS)) {
if (editMode) {
builder.addText("?"); // depends on control dependency: [if], data = [none]
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(Typicon.FONT_PATH, false)); // depends on control dependency: [if], data = [none]
}
}
else if(iconCode.matches(REGEX_MATERIAL_ICONS)){
if (editMode) {
builder.addText("?"); // depends on control dependency: [if], data = [none]
}
else {
builder.addIcon(iconCode, retrieveRegisteredIconSet(MaterialIcons.FONT_PATH, false)); // depends on control dependency: [if], data = [none]
}
}
else {
if (editMode) {
builder.addText("?"); // depends on control dependency: [if], data = [none]
}
else {
builder.addIcon(iconCode, resolveIconSet(iconCode)); // depends on control dependency: [if], data = [none]
}
}
lastAddedIndex = endIndex + 1; // depends on control dependency: [if], data = [none]
}
startIndex = -1; // depends on control dependency: [if], data = [none]
endIndex = -1; // depends on control dependency: [if], data = [none]
}
}
return builder.addText(markdown.substring(lastAddedIndex, markdown.length())).build(); // depends on control dependency: [if], data = [(markdown]
}
} } |
public class class_name {
private void setSelectPosition(int posX, int posY, int height, int width) {
int useWidth = Window.getClientWidth();
int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft();
if (bodyWidth > useWidth) {
useWidth = bodyWidth;
}
int useHeight = Window.getClientHeight();
int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop();
if (bodyHeight > useHeight) {
useHeight = bodyHeight;
}
m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX);
m_overlayLeftStyle.setHeight(useHeight, Unit.PX);
m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX);
m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX);
m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX);
m_borderTopStyle.setLeft(posX - m_offset, Unit.PX);
m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX);
m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX);
m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX);
m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX);
if (m_hasButtonBar) {
m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX);
}
m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX);
m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX);
m_overlayRightStyle.setHeight(useHeight, Unit.PX);
m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX);
} else {
m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX);
}
m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX);
m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX);
m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX);
} } | public class class_name {
private void setSelectPosition(int posX, int posY, int height, int width) {
int useWidth = Window.getClientWidth();
int bodyWidth = RootPanel.getBodyElement().getClientWidth() + RootPanel.getBodyElement().getOffsetLeft();
if (bodyWidth > useWidth) {
useWidth = bodyWidth;
// depends on control dependency: [if], data = [none]
}
int useHeight = Window.getClientHeight();
int bodyHeight = RootPanel.getBodyElement().getClientHeight() + RootPanel.getBodyElement().getOffsetTop();
if (bodyHeight > useHeight) {
useHeight = bodyHeight;
// depends on control dependency: [if], data = [none]
}
m_overlayLeftStyle.setWidth(posX - m_offset, Unit.PX);
m_overlayLeftStyle.setHeight(useHeight, Unit.PX);
m_borderLeftStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderLeftStyle.setTop(posY - (2 * m_offset), Unit.PX);
m_borderLeftStyle.setLeft(posX - (2 * m_offset), Unit.PX);
m_overlayTopStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
m_overlayTopStyle.setHeight(posY - m_offset, Unit.PX);
m_borderTopStyle.setLeft(posX - m_offset, Unit.PX);
m_borderTopStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderTopStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
// depends on control dependency: [if], data = [none]
} else {
m_borderTopStyle.setWidth(width + (2 * m_offset), Unit.PX);
// depends on control dependency: [if], data = [none]
}
m_overlayBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_overlayBottomStyle.setWidth(width + m_offset + m_offset, Unit.PX);
m_overlayBottomStyle.setHeight(useHeight - posY - height - m_offset, Unit.PX);
m_overlayBottomStyle.setTop(posY + height + m_offset, Unit.PX);
m_borderBottomStyle.setLeft(posX - m_offset, Unit.PX);
m_borderBottomStyle.setTop((posY + height) + m_offset, Unit.PX);
if (m_hasButtonBar) {
m_borderBottomStyle.setWidth(width + (2 * m_offset) + BUTTON_BAR_WIDTH, Unit.PX);
// depends on control dependency: [if], data = [none]
} else {
m_borderBottomStyle.setWidth(width + (2 * m_offset), Unit.PX);
// depends on control dependency: [if], data = [none]
}
m_overlayRightStyle.setLeft(posX + width + m_offset, Unit.PX);
m_overlayRightStyle.setWidth(useWidth - posX - width - m_offset, Unit.PX);
m_overlayRightStyle.setHeight(useHeight, Unit.PX);
m_borderRightStyle.setHeight(height + (4 * m_offset), Unit.PX);
m_borderRightStyle.setTop(posY - (2 * m_offset), Unit.PX);
if (m_hasButtonBar) {
m_borderRightStyle.setLeft(posX + width + m_offset + BUTTON_BAR_WIDTH, Unit.PX);
// depends on control dependency: [if], data = [none]
} else {
m_borderRightStyle.setLeft(posX + width + m_offset, Unit.PX);
// depends on control dependency: [if], data = [none]
}
m_buttonBar.getStyle().setTop(posY - m_offset, Unit.PX);
m_buttonBar.getStyle().setHeight(height + (2 * m_offset), Unit.PX);
m_buttonBar.getStyle().setLeft(posX + width + m_offset + 1, Unit.PX);
} } |
public class class_name {
public INDArray symmetrized(INDArray rowP, INDArray colP, INDArray valP) {
INDArray rowCounts = Nd4j.create(N);
MemoryWorkspace workspace =
workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace()
: Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(
workspaceConfigurationExternal,
workspaceExternal);
try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {
for (int n = 0; n < N; n++) {
int begin = rowP.getInt(n);
int end = rowP.getInt(n + 1);
for (int i = begin; i < end; i++) {
boolean present = false;
for (int m = rowP.getInt(colP.getInt(i)); m < rowP.getInt(colP.getInt(i) + 1); m++)
if (colP.getInt(m) == n) {
present = true;
}
if (present)
rowCounts.putScalar(n, rowCounts.getDouble(n) + 1);
else {
rowCounts.putScalar(n, rowCounts.getDouble(n) + 1);
rowCounts.putScalar(colP.getInt(i), rowCounts.getDouble(colP.getInt(i)) + 1);
}
}
}
int numElements = rowCounts.sum(Integer.MAX_VALUE).getInt(0);
INDArray offset = Nd4j.create(N);
INDArray symRowP = Nd4j.create(N + 1);
INDArray symColP = Nd4j.create(numElements);
INDArray symValP = Nd4j.create(numElements);
for (int n = 0; n < N; n++)
symRowP.putScalar(n + 1, symRowP.getDouble(n) + rowCounts.getDouble(n));
for (int n = 0; n < N; n++) {
for (int i = rowP.getInt(n); i < rowP.getInt(n + 1); i++) {
boolean present = false;
for (int m = rowP.getInt(colP.getInt(i)); m < rowP.getInt(colP.getInt(i)) + 1; m++) {
if (colP.getInt(m) == n) {
present = true;
if (n < colP.getInt(i)) {
// make sure we do not add elements twice
symColP.putScalar(symRowP.getInt(n) + offset.getInt(n), colP.getInt(i));
symColP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colP.getInt(i)), n);
symValP.putScalar(symRowP.getInt(n) + offset.getInt(n),
valP.getDouble(i) + valP.getDouble(m));
symValP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colP.getInt(i)),
valP.getDouble(i) + valP.getDouble(m));
}
}
}
// If (colP[i], n) is not present, there is no addition involved
if (!present) {
int colPI = colP.getInt(i);
if (n < colPI) {
symColP.putScalar(symRowP.getInt(n) + offset.getInt(n), colPI);
symColP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colPI), n);
symValP.putScalar(symRowP.getInt(n) + offset.getInt(n), valP.getDouble(i));
symValP.putScalar(symRowP.getInt(colPI) + offset.getInt(colPI), valP.getDouble(i));
}
}
// Update offsets
if (!present || (present && n < colP.getInt(i))) {
offset.putScalar(n, offset.getInt(n) + 1);
int colPI = colP.getInt(i);
if (colPI != n)
offset.putScalar(colPI, offset.getDouble(colPI) + 1);
}
}
}
// Divide the result by two
symValP.divi(2.0);
return symValP;
}
} } | public class class_name {
public INDArray symmetrized(INDArray rowP, INDArray colP, INDArray valP) {
INDArray rowCounts = Nd4j.create(N);
MemoryWorkspace workspace =
workspaceMode == WorkspaceMode.NONE ? new DummyWorkspace()
: Nd4j.getWorkspaceManager().getWorkspaceForCurrentThread(
workspaceConfigurationExternal,
workspaceExternal);
try (MemoryWorkspace ws = workspace.notifyScopeEntered()) {
for (int n = 0; n < N; n++) {
int begin = rowP.getInt(n);
int end = rowP.getInt(n + 1);
for (int i = begin; i < end; i++) {
boolean present = false;
for (int m = rowP.getInt(colP.getInt(i)); m < rowP.getInt(colP.getInt(i) + 1); m++)
if (colP.getInt(m) == n) {
present = true; // depends on control dependency: [if], data = [none]
}
if (present)
rowCounts.putScalar(n, rowCounts.getDouble(n) + 1);
else {
rowCounts.putScalar(n, rowCounts.getDouble(n) + 1); // depends on control dependency: [if], data = [none]
rowCounts.putScalar(colP.getInt(i), rowCounts.getDouble(colP.getInt(i)) + 1); // depends on control dependency: [if], data = [none]
}
}
}
int numElements = rowCounts.sum(Integer.MAX_VALUE).getInt(0);
INDArray offset = Nd4j.create(N);
INDArray symRowP = Nd4j.create(N + 1);
INDArray symColP = Nd4j.create(numElements);
INDArray symValP = Nd4j.create(numElements);
for (int n = 0; n < N; n++)
symRowP.putScalar(n + 1, symRowP.getDouble(n) + rowCounts.getDouble(n));
for (int n = 0; n < N; n++) {
for (int i = rowP.getInt(n); i < rowP.getInt(n + 1); i++) {
boolean present = false;
for (int m = rowP.getInt(colP.getInt(i)); m < rowP.getInt(colP.getInt(i)) + 1; m++) {
if (colP.getInt(m) == n) {
present = true; // depends on control dependency: [if], data = [none]
if (n < colP.getInt(i)) {
// make sure we do not add elements twice
symColP.putScalar(symRowP.getInt(n) + offset.getInt(n), colP.getInt(i)); // depends on control dependency: [if], data = [(n]
symColP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colP.getInt(i)), n); // depends on control dependency: [if], data = [colP.getInt(i))]
symValP.putScalar(symRowP.getInt(n) + offset.getInt(n),
valP.getDouble(i) + valP.getDouble(m)); // depends on control dependency: [if], data = [(n]
symValP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colP.getInt(i)),
valP.getDouble(i) + valP.getDouble(m)); // depends on control dependency: [if], data = [none]
}
}
}
// If (colP[i], n) is not present, there is no addition involved
if (!present) {
int colPI = colP.getInt(i);
if (n < colPI) {
symColP.putScalar(symRowP.getInt(n) + offset.getInt(n), colPI); // depends on control dependency: [if], data = [(n]
symColP.putScalar(symRowP.getInt(colP.getInt(i)) + offset.getInt(colPI), n); // depends on control dependency: [if], data = [colPI)]
symValP.putScalar(symRowP.getInt(n) + offset.getInt(n), valP.getDouble(i)); // depends on control dependency: [if], data = [(n]
symValP.putScalar(symRowP.getInt(colPI) + offset.getInt(colPI), valP.getDouble(i)); // depends on control dependency: [if], data = [colPI)]
}
}
// Update offsets
if (!present || (present && n < colP.getInt(i))) {
offset.putScalar(n, offset.getInt(n) + 1); // depends on control dependency: [if], data = [none]
int colPI = colP.getInt(i);
if (colPI != n)
offset.putScalar(colPI, offset.getDouble(colPI) + 1);
}
}
}
// Divide the result by two
symValP.divi(2.0);
return symValP;
}
} } |
public class class_name {
static DataBlock[] getDataBlocks(byte[] rawCodewords,
Version version) {
// Figure out the number and size of data blocks used by this version
Version.ECBlocks ecBlocks = version.getECBlocks();
// First count the total number of data blocks
int totalBlocks = 0;
Version.ECB[] ecBlockArray = ecBlocks.getECBlocks();
for (Version.ECB ecBlock : ecBlockArray) {
totalBlocks += ecBlock.getCount();
}
// Now establish DataBlocks of the appropriate size and number of data codewords
DataBlock[] result = new DataBlock[totalBlocks];
int numResultBlocks = 0;
for (Version.ECB ecBlock : ecBlockArray) {
for (int i = 0; i < ecBlock.getCount(); i++) {
int numDataCodewords = ecBlock.getDataCodewords();
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]);
}
}
// All blocks have the same amount of data, except that the last n
// (where n may be 0) have 1 less byte. Figure out where these start.
// TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144
int longerBlocksTotalCodewords = result[0].codewords.length;
//int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
int longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();
int shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
// The last elements of result may be 1 element shorter for 144 matrix
// first fill out as many elements as all of them have minus 1
int rawCodewordsOffset = 0;
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
for (int j = 0; j < numResultBlocks; j++) {
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++];
}
}
// Fill out the last data block in the longer ones
boolean specialVersion = version.getVersionNumber() == 24;
int numLongerBlocks = specialVersion ? 8 : numResultBlocks;
for (int j = 0; j < numLongerBlocks; j++) {
result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++];
}
// Now add in error correction blocks
int max = result[0].codewords.length;
for (int i = longerBlocksNumDataCodewords; i < max; i++) {
for (int j = 0; j < numResultBlocks; j++) {
int jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
int iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++];
}
}
if (rawCodewordsOffset != rawCodewords.length) {
throw new IllegalArgumentException();
}
return result;
} } | public class class_name {
static DataBlock[] getDataBlocks(byte[] rawCodewords,
Version version) {
// Figure out the number and size of data blocks used by this version
Version.ECBlocks ecBlocks = version.getECBlocks();
// First count the total number of data blocks
int totalBlocks = 0;
Version.ECB[] ecBlockArray = ecBlocks.getECBlocks();
for (Version.ECB ecBlock : ecBlockArray) {
totalBlocks += ecBlock.getCount(); // depends on control dependency: [for], data = [ecBlock]
}
// Now establish DataBlocks of the appropriate size and number of data codewords
DataBlock[] result = new DataBlock[totalBlocks];
int numResultBlocks = 0;
for (Version.ECB ecBlock : ecBlockArray) {
for (int i = 0; i < ecBlock.getCount(); i++) {
int numDataCodewords = ecBlock.getDataCodewords();
int numBlockCodewords = ecBlocks.getECCodewords() + numDataCodewords;
result[numResultBlocks++] = new DataBlock(numDataCodewords, new byte[numBlockCodewords]); // depends on control dependency: [for], data = [none]
}
}
// All blocks have the same amount of data, except that the last n
// (where n may be 0) have 1 less byte. Figure out where these start.
// TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144
int longerBlocksTotalCodewords = result[0].codewords.length;
//int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
int longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();
int shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
// The last elements of result may be 1 element shorter for 144 matrix
// first fill out as many elements as all of them have minus 1
int rawCodewordsOffset = 0;
for (int i = 0; i < shorterBlocksNumDataCodewords; i++) {
for (int j = 0; j < numResultBlocks; j++) {
result[j].codewords[i] = rawCodewords[rawCodewordsOffset++]; // depends on control dependency: [for], data = [j]
}
}
// Fill out the last data block in the longer ones
boolean specialVersion = version.getVersionNumber() == 24;
int numLongerBlocks = specialVersion ? 8 : numResultBlocks;
for (int j = 0; j < numLongerBlocks; j++) {
result[j].codewords[longerBlocksNumDataCodewords - 1] = rawCodewords[rawCodewordsOffset++]; // depends on control dependency: [for], data = [j]
}
// Now add in error correction blocks
int max = result[0].codewords.length;
for (int i = longerBlocksNumDataCodewords; i < max; i++) {
for (int j = 0; j < numResultBlocks; j++) {
int jOffset = specialVersion ? (j + 8) % numResultBlocks : j;
int iOffset = specialVersion && jOffset > 7 ? i - 1 : i;
result[jOffset].codewords[iOffset] = rawCodewords[rawCodewordsOffset++]; // depends on control dependency: [for], data = [none]
}
}
if (rawCodewordsOffset != rawCodewords.length) {
throw new IllegalArgumentException();
}
return result;
} } |
public class class_name {
protected int executeApplication(Object svc, String[] args, String orig){
if(svc!=null && (svc instanceof ExecS_Application)){
if(svc instanceof Gen_RunScripts){
//hook for GenRunScripts to get current class map - registered applications
((Gen_RunScripts)svc).setClassMap(this.classmap);
}
if(svc instanceof Gen_ExecJarScripts){
//hook for Gen_ExecJarScripts to get current class map - registered applications
((Gen_ExecJarScripts)svc).setClassMap(this.classmap);
}
return ((ExecS_Application)svc).executeApplication(ArrayUtils.remove(args, 0));
}
else if(svc==null){
System.err.println("could not create object for class or application name <" + orig + ">");
return -1;
}
else if(!(svc instanceof ExecS_Application)){
System.err.println("given class or application name <" + orig + "> is not instance of " + ExecS_Application.class.getName());
return -2;
}
else{
System.err.println("unexpected error processing for class or application name <" + orig + ">");
return -3;
}
} } | public class class_name {
protected int executeApplication(Object svc, String[] args, String orig){
if(svc!=null && (svc instanceof ExecS_Application)){
if(svc instanceof Gen_RunScripts){
//hook for GenRunScripts to get current class map - registered applications
((Gen_RunScripts)svc).setClassMap(this.classmap); // depends on control dependency: [if], data = [none]
}
if(svc instanceof Gen_ExecJarScripts){
//hook for Gen_ExecJarScripts to get current class map - registered applications
((Gen_ExecJarScripts)svc).setClassMap(this.classmap); // depends on control dependency: [if], data = [none]
}
return ((ExecS_Application)svc).executeApplication(ArrayUtils.remove(args, 0)); // depends on control dependency: [if], data = [none]
}
else if(svc==null){
System.err.println("could not create object for class or application name <" + orig + ">"); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
else if(!(svc instanceof ExecS_Application)){
System.err.println("given class or application name <" + orig + "> is not instance of " + ExecS_Application.class.getName()); // depends on control dependency: [if], data = [none]
return -2; // depends on control dependency: [if], data = [none]
}
else{
System.err.println("unexpected error processing for class or application name <" + orig + ">"); // depends on control dependency: [if], data = [none]
return -3; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setConfig( String key, String value ) {
if ( config == null ) {
config = new HashMap<String, String>();
}
config.put( key, value );
} } | public class class_name {
public void setConfig( String key, String value ) {
if ( config == null ) {
config = new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
config.put( key, value );
} } |
public class class_name {
public Object execute(final Map<Object, Object> iArgs) {
if (attribute == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final List<OCluster> clusters = getClusters();
if (clusters.isEmpty())
throw new OCommandExecutionException("Cluster '" + clusterName + "' not found");
Object result = null;
for (OCluster cluster : getClusters()) {
if (clusterId > -1 && clusterName.equals(String.valueOf(clusterId))) {
clusterName = cluster.getName();
} else {
clusterId = cluster.getId();
}
try {
if (attribute == ATTRIBUTES.STATUS && OStorageClusterConfiguration.STATUS.OFFLINE.toString().equalsIgnoreCase(value))
// REMOVE CACHE OF COMMAND RESULTS IF ACTIVE
getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName);
if (attribute == ATTRIBUTES.NAME)
// REMOVE CACHE OF COMMAND RESULTS IF ACTIVE
getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName);
result = cluster.set(attribute, value);
} catch (IOException ioe) {
throw OException.wrapException(new OCommandExecutionException("Error altering cluster '" + clusterName + "'"), ioe);
}
}
return result;
} } | public class class_name {
public Object execute(final Map<Object, Object> iArgs) {
if (attribute == null)
throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");
final List<OCluster> clusters = getClusters();
if (clusters.isEmpty())
throw new OCommandExecutionException("Cluster '" + clusterName + "' not found");
Object result = null;
for (OCluster cluster : getClusters()) {
if (clusterId > -1 && clusterName.equals(String.valueOf(clusterId))) {
clusterName = cluster.getName();
// depends on control dependency: [if], data = [none]
} else {
clusterId = cluster.getId();
// depends on control dependency: [if], data = [none]
}
try {
if (attribute == ATTRIBUTES.STATUS && OStorageClusterConfiguration.STATUS.OFFLINE.toString().equalsIgnoreCase(value))
// REMOVE CACHE OF COMMAND RESULTS IF ACTIVE
getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName);
if (attribute == ATTRIBUTES.NAME)
// REMOVE CACHE OF COMMAND RESULTS IF ACTIVE
getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName);
result = cluster.set(attribute, value);
// depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw OException.wrapException(new OCommandExecutionException("Error altering cluster '" + clusterName + "'"), ioe);
}
// depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
private String getSingleSlotHtml(TestSlot s, String icon) {
StringBuilder builder = new StringBuilder();
TestSession session = s.getSession();
if (icon != null) {
builder.append("<img ");
builder.append("src='").append(icon).append("' width='16' height='16'");
} else {
builder.append("<a href='#' ");
}
if (session != null) {
builder.append(" class='busy' ");
builder.append(" title='").append(session.get("lastCommand")).append("' ");
} else {
builder.append(" title='").append(s.getCapabilities()).append("'");
}
if (icon != null) {
builder.append(" />\n");
} else {
builder.append(">");
builder.append(s.getCapabilities().get(CapabilityType.BROWSER_NAME));
builder.append("</a>");
}
return builder.toString();
} } | public class class_name {
private String getSingleSlotHtml(TestSlot s, String icon) {
StringBuilder builder = new StringBuilder();
TestSession session = s.getSession();
if (icon != null) {
builder.append("<img "); // depends on control dependency: [if], data = [none]
builder.append("src='").append(icon).append("' width='16' height='16'"); // depends on control dependency: [if], data = [(icon]
} else {
builder.append("<a href='#' "); // depends on control dependency: [if], data = [none]
}
if (session != null) {
builder.append(" class='busy' "); // depends on control dependency: [if], data = [none]
builder.append(" title='").append(session.get("lastCommand")).append("' "); // depends on control dependency: [if], data = [(session]
} else {
builder.append(" title='").append(s.getCapabilities()).append("'"); // depends on control dependency: [if], data = [none]
}
if (icon != null) {
builder.append(" />\n"); // depends on control dependency: [if], data = [none]
} else {
builder.append(">"); // depends on control dependency: [if], data = [none]
builder.append(s.getCapabilities().get(CapabilityType.BROWSER_NAME)); // depends on control dependency: [if], data = [none]
builder.append("</a>"); // depends on control dependency: [if], data = [none]
}
return builder.toString();
} } |
public class class_name {
public CustomCommandLine<?> getActiveCustomCommandLine(CommandLine commandLine) {
for (CustomCommandLine<?> cli : customCommandLines) {
if (cli.isActive(commandLine)) {
return cli;
}
}
throw new IllegalStateException("No command-line ran.");
} } | public class class_name {
public CustomCommandLine<?> getActiveCustomCommandLine(CommandLine commandLine) {
for (CustomCommandLine<?> cli : customCommandLines) {
if (cli.isActive(commandLine)) {
return cli; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalStateException("No command-line ran.");
} } |
public class class_name {
@Override
public void sendMetrics(final UnifiedPushMetricsMessage metricsMessage,
final Callback<UnifiedPushMetricsMessage> callback) {
new AsyncTask<Void, Void, Exception>() {
@Override
protected Exception doInBackground(Void... params) {
try {
if ((metricsMessage.getMessageId() == null) || (metricsMessage.getMessageId().trim().equals(""))) {
throw new IllegalStateException("Message ID cannot be null or blank");
}
HttpProvider provider = httpProviderProvider.get(metricsURL, TIMEOUT);
setPasswordAuthentication(variantId, secret, provider);
try {
provider.put(metricsMessage.getMessageId(), "");
return null;
} catch (HttpException ex) {
return ex;
}
} catch (Exception ex) {
return ex;
}
}
@SuppressWarnings("unchecked")
@Override
protected void onPostExecute(Exception result) {
if (result == null) {
callback.onSuccess(metricsMessage);
} else {
callback.onFailure(result);
}
}
}.execute((Void) null);
} } | public class class_name {
@Override
public void sendMetrics(final UnifiedPushMetricsMessage metricsMessage,
final Callback<UnifiedPushMetricsMessage> callback) {
new AsyncTask<Void, Void, Exception>() {
@Override
protected Exception doInBackground(Void... params) {
try {
if ((metricsMessage.getMessageId() == null) || (metricsMessage.getMessageId().trim().equals(""))) {
throw new IllegalStateException("Message ID cannot be null or blank");
}
HttpProvider provider = httpProviderProvider.get(metricsURL, TIMEOUT);
setPasswordAuthentication(variantId, secret, provider); // depends on control dependency: [try], data = [none]
try {
provider.put(metricsMessage.getMessageId(), ""); // depends on control dependency: [try], data = [none]
return null; // depends on control dependency: [try], data = [none]
} catch (HttpException ex) {
return ex;
} // depends on control dependency: [catch], data = [none]
} catch (Exception ex) {
return ex;
} // depends on control dependency: [catch], data = [none]
}
@SuppressWarnings("unchecked")
@Override
protected void onPostExecute(Exception result) {
if (result == null) {
callback.onSuccess(metricsMessage); // depends on control dependency: [if], data = [none]
} else {
callback.onFailure(result); // depends on control dependency: [if], data = [(result]
}
}
}.execute((Void) null);
} } |
public class class_name {
static UnitPatterns of(Locale lang) {
if (lang == null) {
throw new NullPointerException("Missing language.");
}
UnitPatterns p = CACHE.get(lang);
if (p == null) {
p = new UnitPatterns(lang);
UnitPatterns old = CACHE.putIfAbsent(lang, p);
if (old != null) {
p = old;
}
}
return p;
} } | public class class_name {
static UnitPatterns of(Locale lang) {
if (lang == null) {
throw new NullPointerException("Missing language.");
}
UnitPatterns p = CACHE.get(lang);
if (p == null) {
p = new UnitPatterns(lang); // depends on control dependency: [if], data = [none]
UnitPatterns old = CACHE.putIfAbsent(lang, p);
if (old != null) {
p = old; // depends on control dependency: [if], data = [none]
}
}
return p;
} } |
public class class_name {
public void write(ByteBuffer bb, VBucketCoordinates coords) {
if (!enabled) {
return;
}
bb.putLong(24, coords.getUuid());
bb.putLong(32, coords.getSeqno());
} } | public class class_name {
public void write(ByteBuffer bb, VBucketCoordinates coords) {
if (!enabled) {
return; // depends on control dependency: [if], data = [none]
}
bb.putLong(24, coords.getUuid());
bb.putLong(32, coords.getSeqno());
} } |
public class class_name {
public void marshall(InstancesCount instancesCount, ProtocolMarshaller protocolMarshaller) {
if (instancesCount == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instancesCount.getAssigning(), ASSIGNING_BINDING);
protocolMarshaller.marshall(instancesCount.getBooting(), BOOTING_BINDING);
protocolMarshaller.marshall(instancesCount.getConnectionLost(), CONNECTIONLOST_BINDING);
protocolMarshaller.marshall(instancesCount.getDeregistering(), DEREGISTERING_BINDING);
protocolMarshaller.marshall(instancesCount.getOnline(), ONLINE_BINDING);
protocolMarshaller.marshall(instancesCount.getPending(), PENDING_BINDING);
protocolMarshaller.marshall(instancesCount.getRebooting(), REBOOTING_BINDING);
protocolMarshaller.marshall(instancesCount.getRegistered(), REGISTERED_BINDING);
protocolMarshaller.marshall(instancesCount.getRegistering(), REGISTERING_BINDING);
protocolMarshaller.marshall(instancesCount.getRequested(), REQUESTED_BINDING);
protocolMarshaller.marshall(instancesCount.getRunningSetup(), RUNNINGSETUP_BINDING);
protocolMarshaller.marshall(instancesCount.getSetupFailed(), SETUPFAILED_BINDING);
protocolMarshaller.marshall(instancesCount.getShuttingDown(), SHUTTINGDOWN_BINDING);
protocolMarshaller.marshall(instancesCount.getStartFailed(), STARTFAILED_BINDING);
protocolMarshaller.marshall(instancesCount.getStopFailed(), STOPFAILED_BINDING);
protocolMarshaller.marshall(instancesCount.getStopped(), STOPPED_BINDING);
protocolMarshaller.marshall(instancesCount.getStopping(), STOPPING_BINDING);
protocolMarshaller.marshall(instancesCount.getTerminated(), TERMINATED_BINDING);
protocolMarshaller.marshall(instancesCount.getTerminating(), TERMINATING_BINDING);
protocolMarshaller.marshall(instancesCount.getUnassigning(), UNASSIGNING_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InstancesCount instancesCount, ProtocolMarshaller protocolMarshaller) {
if (instancesCount == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instancesCount.getAssigning(), ASSIGNING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getBooting(), BOOTING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getConnectionLost(), CONNECTIONLOST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getDeregistering(), DEREGISTERING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getOnline(), ONLINE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getPending(), PENDING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getRebooting(), REBOOTING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getRegistered(), REGISTERED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getRegistering(), REGISTERING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getRequested(), REQUESTED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getRunningSetup(), RUNNINGSETUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getSetupFailed(), SETUPFAILED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getShuttingDown(), SHUTTINGDOWN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getStartFailed(), STARTFAILED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getStopFailed(), STOPFAILED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getStopped(), STOPPED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getStopping(), STOPPING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getTerminated(), TERMINATED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getTerminating(), TERMINATING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instancesCount.getUnassigning(), UNASSIGNING_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 CharBuf sputl(CharBuf buf, Object... messages) {
for (Object message : messages) {
if (message == null) {
buf.add("<NULL>");
} else if (message.getClass().isArray()) {
buf.add(toListOrSingletonList(message).toString());
} else {
buf.add(message.toString());
}
buf.add('\n');
}
buf.add('\n');
return buf;
} } | public class class_name {
public static CharBuf sputl(CharBuf buf, Object... messages) {
for (Object message : messages) {
if (message == null) {
buf.add("<NULL>"); // depends on control dependency: [if], data = [none]
} else if (message.getClass().isArray()) {
buf.add(toListOrSingletonList(message).toString()); // depends on control dependency: [if], data = [none]
} else {
buf.add(message.toString()); // depends on control dependency: [if], data = [none]
}
buf.add('\n'); // depends on control dependency: [for], data = [none]
}
buf.add('\n');
return buf;
} } |
public class class_name {
public DescribeServicesRequest withInclude(ServiceField... include) {
com.amazonaws.internal.SdkInternalList<String> includeCopy = new com.amazonaws.internal.SdkInternalList<String>(include.length);
for (ServiceField value : include) {
includeCopy.add(value.toString());
}
if (getInclude() == null) {
setInclude(includeCopy);
} else {
getInclude().addAll(includeCopy);
}
return this;
} } | public class class_name {
public DescribeServicesRequest withInclude(ServiceField... include) {
com.amazonaws.internal.SdkInternalList<String> includeCopy = new com.amazonaws.internal.SdkInternalList<String>(include.length);
for (ServiceField value : include) {
includeCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getInclude() == null) {
setInclude(includeCopy); // depends on control dependency: [if], data = [none]
} else {
getInclude().addAll(includeCopy); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
private void condenseTree(IndexTreePath<E> subtree, Stack<N> stack) {
N node = getNode(subtree.getEntry());
// node is not root
if(!isRoot(node)) {
N parent = getNode(subtree.getParentPath().getEntry());
int index = subtree.getIndex();
if(hasUnderflow(node)) {
if(parent.deleteEntry(index)) {
stack.push(node);
}
else {
node.adjustEntry(parent.getEntry(index));
}
}
else {
node.adjustEntry(parent.getEntry(index));
}
writeNode(parent);
// get subtree to parent
condenseTree(subtree.getParentPath(), stack);
}
// node is root
else {
if(hasUnderflow(node) && node.getNumEntries() == 1 && !node.isLeaf()) {
N child = getNode(node.getEntry(0));
final N newRoot;
if(child.isLeaf()) {
newRoot = createNewLeafNode();
newRoot.setPageID(getRootID());
for(int i = 0; i < child.getNumEntries(); i++) {
newRoot.addLeafEntry(child.getEntry(i));
}
}
else {
newRoot = createNewDirectoryNode();
newRoot.setPageID(getRootID());
for(int i = 0; i < child.getNumEntries(); i++) {
newRoot.addDirectoryEntry(child.getEntry(i));
}
}
writeNode(newRoot);
height--;
}
}
} } | public class class_name {
private void condenseTree(IndexTreePath<E> subtree, Stack<N> stack) {
N node = getNode(subtree.getEntry());
// node is not root
if(!isRoot(node)) {
N parent = getNode(subtree.getParentPath().getEntry());
int index = subtree.getIndex();
if(hasUnderflow(node)) {
if(parent.deleteEntry(index)) {
stack.push(node); // depends on control dependency: [if], data = [none]
}
else {
node.adjustEntry(parent.getEntry(index)); // depends on control dependency: [if], data = [none]
}
}
else {
node.adjustEntry(parent.getEntry(index)); // depends on control dependency: [if], data = [none]
}
writeNode(parent); // depends on control dependency: [if], data = [none]
// get subtree to parent
condenseTree(subtree.getParentPath(), stack); // depends on control dependency: [if], data = [none]
}
// node is root
else {
if(hasUnderflow(node) && node.getNumEntries() == 1 && !node.isLeaf()) {
N child = getNode(node.getEntry(0));
final N newRoot;
if(child.isLeaf()) {
newRoot = createNewLeafNode(); // depends on control dependency: [if], data = [none]
newRoot.setPageID(getRootID()); // depends on control dependency: [if], data = [none]
for(int i = 0; i < child.getNumEntries(); i++) {
newRoot.addLeafEntry(child.getEntry(i)); // depends on control dependency: [for], data = [i]
}
}
else {
newRoot = createNewDirectoryNode(); // depends on control dependency: [if], data = [none]
newRoot.setPageID(getRootID()); // depends on control dependency: [if], data = [none]
for(int i = 0; i < child.getNumEntries(); i++) {
newRoot.addDirectoryEntry(child.getEntry(i)); // depends on control dependency: [for], data = [i]
}
}
writeNode(newRoot); // depends on control dependency: [if], data = [none]
height--; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Nullable
static String parseResourceType(@Nullable String rawEnvType) {
if (rawEnvType != null && !rawEnvType.isEmpty()) {
Utils.checkArgument(isValidAndNotEmpty(rawEnvType), "Type" + ERROR_MESSAGE_INVALID_CHARS);
return rawEnvType.trim();
}
return rawEnvType;
} } | public class class_name {
@Nullable
static String parseResourceType(@Nullable String rawEnvType) {
if (rawEnvType != null && !rawEnvType.isEmpty()) {
Utils.checkArgument(isValidAndNotEmpty(rawEnvType), "Type" + ERROR_MESSAGE_INVALID_CHARS); // depends on control dependency: [if], data = [(rawEnvType]
return rawEnvType.trim(); // depends on control dependency: [if], data = [none]
}
return rawEnvType;
} } |
public class class_name {
public synchronized void printStatistics() {
ClientStats stats = m_periodicStatsContext.fetchAndResetBaseline().getStats();
long time = Math.round((stats.getEndTimestamp() - m_startTS) / 1000.0);
StringBuilder statsBuilder = new StringBuilder();
statsBuilder.append(String.format("%02d:%02d:%02d ", time / 3600, (time / 60) % 60, time % 60));
statsBuilder.append(String.format("Throughput %d/s, ", stats.getTxnThroughput()));
statsBuilder.append(String.format("Aborts/Failures %d/%d",
stats.getInvocationAborts(), stats.getInvocationErrors()));
if (m_config.latencyreport) {
statsBuilder.append(String.format(", Avg/95%% Latency %.2f/%.2fms",
stats.getAverageLatency(),
stats.kPercentileLatencyAsDouble(0.95)));
}
printLog(statsBuilder.toString());
} } | public class class_name {
public synchronized void printStatistics() {
ClientStats stats = m_periodicStatsContext.fetchAndResetBaseline().getStats();
long time = Math.round((stats.getEndTimestamp() - m_startTS) / 1000.0);
StringBuilder statsBuilder = new StringBuilder();
statsBuilder.append(String.format("%02d:%02d:%02d ", time / 3600, (time / 60) % 60, time % 60));
statsBuilder.append(String.format("Throughput %d/s, ", stats.getTxnThroughput()));
statsBuilder.append(String.format("Aborts/Failures %d/%d",
stats.getInvocationAborts(), stats.getInvocationErrors()));
if (m_config.latencyreport) {
statsBuilder.append(String.format(", Avg/95%% Latency %.2f/%.2fms",
stats.getAverageLatency(),
stats.kPercentileLatencyAsDouble(0.95))); // depends on control dependency: [if], data = [none]
}
printLog(statsBuilder.toString());
} } |
public class class_name {
public static boolean applyTo(ImageHolder imageHolder, ImageView imageView, String tag) {
if (imageHolder != null && imageView != null) {
return imageHolder.applyTo(imageView, tag);
}
return false;
} } | public class class_name {
public static boolean applyTo(ImageHolder imageHolder, ImageView imageView, String tag) {
if (imageHolder != null && imageView != null) {
return imageHolder.applyTo(imageView, tag); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private void outputDocTypeDecl(String name) throws SAXException {
if (true == m_needToOutputDocTypeDecl)
{
String doctypeSystem = getDoctypeSystem();
String doctypePublic = getDoctypePublic();
if ((null != doctypeSystem) || (null != doctypePublic))
{
final java.io.Writer writer = m_writer;
try
{
writer.write("<!DOCTYPE ");
writer.write(name);
if (null != doctypePublic)
{
writer.write(" PUBLIC \"");
writer.write(doctypePublic);
writer.write('"');
}
if (null != doctypeSystem)
{
if (null == doctypePublic)
writer.write(" SYSTEM \"");
else
writer.write(" \"");
writer.write(doctypeSystem);
writer.write('"');
}
writer.write('>');
outputLineSep();
}
catch(IOException e)
{
throw new SAXException(e);
}
}
}
m_needToOutputDocTypeDecl = false;
} } | public class class_name {
private void outputDocTypeDecl(String name) throws SAXException {
if (true == m_needToOutputDocTypeDecl)
{
String doctypeSystem = getDoctypeSystem();
String doctypePublic = getDoctypePublic();
if ((null != doctypeSystem) || (null != doctypePublic))
{
final java.io.Writer writer = m_writer;
try
{
writer.write("<!DOCTYPE "); // depends on control dependency: [try], data = [none]
writer.write(name); // depends on control dependency: [try], data = [none]
if (null != doctypePublic)
{
writer.write(" PUBLIC \""); // depends on control dependency: [if], data = [none]
writer.write(doctypePublic); // depends on control dependency: [if], data = [doctypePublic)]
writer.write('"'); // depends on control dependency: [if], data = [none]
}
if (null != doctypeSystem)
{
if (null == doctypePublic)
writer.write(" SYSTEM \"");
else
writer.write(" \"");
writer.write(doctypeSystem); // depends on control dependency: [if], data = [doctypeSystem)]
writer.write('"'); // depends on control dependency: [if], data = [none]
}
writer.write('>'); // depends on control dependency: [try], data = [none]
outputLineSep(); // depends on control dependency: [try], data = [none]
}
catch(IOException e)
{
throw new SAXException(e);
} // depends on control dependency: [catch], data = [none]
}
}
m_needToOutputDocTypeDecl = false;
} } |
public class class_name {
@RequestMapping("/async")
public void asynch(HttpServletRequest request, HttpServletResponse response) {
final AsyncContext async = request.startAsync();
async.start(new Runnable() {
public void run() {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
try {
final HttpServletResponse asyncResponse = (HttpServletResponse) async
.getResponse();
asyncResponse.setStatus(HttpServletResponse.SC_OK);
asyncResponse.getWriter().write(String.valueOf(authentication));
async.complete();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
});
} } | public class class_name {
@RequestMapping("/async")
public void asynch(HttpServletRequest request, HttpServletResponse response) {
final AsyncContext async = request.startAsync();
async.start(new Runnable() {
public void run() {
Authentication authentication = SecurityContextHolder.getContext()
.getAuthentication();
try {
final HttpServletResponse asyncResponse = (HttpServletResponse) async
.getResponse();
asyncResponse.setStatus(HttpServletResponse.SC_OK); // depends on control dependency: [try], data = [none]
asyncResponse.getWriter().write(String.valueOf(authentication)); // depends on control dependency: [try], data = [none]
async.complete(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
@Override
protected CollectionMatch getCollectionMatchForWebResourceCollection(WebResourceCollection webResourceCollection, String resourceName, String method) {
CollectionMatch match = null;
CollectionMatch collectionMatchFound = webResourceCollection.performUrlMatch(resourceName);
if (collectionMatchFound != null) {
if (webResourceCollection.isMethodMatched(method)) {
match = collectionMatchFound;
} else if (webResourceCollection.isMethodListed(method)) {
match = CollectionMatch.RESPONSE_NO_MATCH;
}
} else {
match = CollectionMatch.RESPONSE_NO_MATCH;
}
return match;
} } | public class class_name {
@Override
protected CollectionMatch getCollectionMatchForWebResourceCollection(WebResourceCollection webResourceCollection, String resourceName, String method) {
CollectionMatch match = null;
CollectionMatch collectionMatchFound = webResourceCollection.performUrlMatch(resourceName);
if (collectionMatchFound != null) {
if (webResourceCollection.isMethodMatched(method)) {
match = collectionMatchFound; // depends on control dependency: [if], data = [none]
} else if (webResourceCollection.isMethodListed(method)) {
match = CollectionMatch.RESPONSE_NO_MATCH; // depends on control dependency: [if], data = [none]
}
} else {
match = CollectionMatch.RESPONSE_NO_MATCH; // depends on control dependency: [if], data = [none]
}
return match;
} } |
public class class_name {
public static boolean isAlphanumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetterOrDigit(str.charAt(i)) == false) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean isAlphanumeric(String str) {
if (str == null) {
return false; // depends on control dependency: [if], data = [none]
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (Character.isLetterOrDigit(str.charAt(i)) == false) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
protected State checkState() throws IOException {
State localState;
synchronized (lock) {
if (first) {
firstInit();
updateCollection(state, config.updateConfig.updateType);
// makeDatasetTop(state);
first = false;
}
localState = state.copy();
}
return localState;
} } | public class class_name {
protected State checkState() throws IOException {
State localState;
synchronized (lock) {
if (first) {
firstInit(); // depends on control dependency: [if], data = [none]
updateCollection(state, config.updateConfig.updateType); // depends on control dependency: [if], data = [none]
// makeDatasetTop(state);
first = false; // depends on control dependency: [if], data = [none]
}
localState = state.copy();
}
return localState;
} } |
public class class_name {
public Observable<ServiceResponse<OperationStatus>> deleteRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.deleteRegexEntityRole(appId, versionId, entityId, roleId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() {
@Override
public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) {
try {
ServiceResponse<OperationStatus> clientResponse = deleteRegexEntityRoleDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<OperationStatus>> deleteRegexEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.deleteRegexEntityRole(appId, versionId, entityId, roleId, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() {
@Override
public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) {
try {
ServiceResponse<OperationStatus> clientResponse = deleteRegexEntityRoleDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private boolean jobHasScheduledStatus() {
final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true);
while (it.hasNext()) {
final ExecutionState s = it.next().getExecutionState();
if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) {
return false;
}
}
return true;
} } | public class class_name {
private boolean jobHasScheduledStatus() {
final Iterator<ExecutionVertex> it = new ExecutionGraphIterator(this, true);
while (it.hasNext()) {
final ExecutionState s = it.next().getExecutionState();
if (s != ExecutionState.CREATED && s != ExecutionState.SCHEDULED && s != ExecutionState.READY) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public void setDialogCopyFolderMode(String mode) {
CmsResourceCopyMode copyMode = CmsResource.COPY_AS_NEW;
if (mode.equalsIgnoreCase(COPYMODE_SIBLING)) {
copyMode = CmsResource.COPY_AS_SIBLING;
} else if (mode.equalsIgnoreCase(COPYMODE_PRESERVE)) {
copyMode = CmsResource.COPY_PRESERVE_SIBLING;
}
setDialogCopyFolderMode(copyMode);
} } | public class class_name {
public void setDialogCopyFolderMode(String mode) {
CmsResourceCopyMode copyMode = CmsResource.COPY_AS_NEW;
if (mode.equalsIgnoreCase(COPYMODE_SIBLING)) {
copyMode = CmsResource.COPY_AS_SIBLING; // depends on control dependency: [if], data = [none]
} else if (mode.equalsIgnoreCase(COPYMODE_PRESERVE)) {
copyMode = CmsResource.COPY_PRESERVE_SIBLING; // depends on control dependency: [if], data = [none]
}
setDialogCopyFolderMode(copyMode);
} } |
public class class_name {
void digReplaceContent(Map<String, Object> map) {
map.entrySet().stream().forEach(entry -> {
Object value = entry.getValue();
if (value instanceof Map) {
digReplaceContent((Map<String, Object>) value);
} else {
LOGGER.debug("Leaf node found = {}, checking for any external json file...", value);
if (value != null && value.toString().contains(JSON_PAYLOAD_FILE)) {
LOGGER.info("Found external JSON file place holder = {}. Replacing with content", value);
String valueString = value.toString();
String token = getJsonFilePhToken(valueString);
if (token != null && token.startsWith(JSON_PAYLOAD_FILE)) {
String resourceJsonFile = token.substring(JSON_PAYLOAD_FILE.length());
try {
Object jsonFileContent = objectMapper.readTree(readJsonAsString(resourceJsonFile));
entry.setValue(jsonFileContent);
} catch (Exception exx) {
LOGGER.error("External file reference exception - {}", exx.getMessage());
throw new RuntimeException(exx);
}
}
// ----------------------------------------------------
// Extension- for XML file type in case a ticket raised
// ----------------------------------------------------
/*
else if (token != null && token.startsWith(XML_FILE)) {
}
*/
// ---------------------------------------------------
// Extension- for Other types in case a ticket raised
// ---------------------------------------------------
/*
else if (token != null && token.startsWith(OTHER_FILE)) {
}
*/
}
}
});
} } | public class class_name {
void digReplaceContent(Map<String, Object> map) {
map.entrySet().stream().forEach(entry -> {
Object value = entry.getValue();
if (value instanceof Map) {
digReplaceContent((Map<String, Object>) value); // depends on control dependency: [if], data = [none]
} else {
LOGGER.debug("Leaf node found = {}, checking for any external json file...", value); // depends on control dependency: [if], data = [none]
if (value != null && value.toString().contains(JSON_PAYLOAD_FILE)) {
LOGGER.info("Found external JSON file place holder = {}. Replacing with content", value); // depends on control dependency: [if], data = [none]
String valueString = value.toString();
String token = getJsonFilePhToken(valueString);
if (token != null && token.startsWith(JSON_PAYLOAD_FILE)) {
String resourceJsonFile = token.substring(JSON_PAYLOAD_FILE.length());
try {
Object jsonFileContent = objectMapper.readTree(readJsonAsString(resourceJsonFile));
entry.setValue(jsonFileContent); // depends on control dependency: [try], data = [none]
} catch (Exception exx) {
LOGGER.error("External file reference exception - {}", exx.getMessage());
throw new RuntimeException(exx);
} // depends on control dependency: [catch], data = [none]
}
// ----------------------------------------------------
// Extension- for XML file type in case a ticket raised
// ----------------------------------------------------
/*
else if (token != null && token.startsWith(XML_FILE)) {
}
*/
// ---------------------------------------------------
// Extension- for Other types in case a ticket raised
// ---------------------------------------------------
/*
else if (token != null && token.startsWith(OTHER_FILE)) {
}
*/
}
}
});
} } |
public class class_name {
private XmlElement generateSetsSelective(List<IntrospectedColumn> columns, IntrospectedColumn versionColumn) {
XmlElement setsChooseEle = new XmlElement("choose");
XmlElement setWhenEle = new XmlElement("when");
setWhenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
setsChooseEle.addElement(setWhenEle);
XmlElement setForeachEle = new XmlElement("foreach");
setWhenEle.addElement(setForeachEle);
setForeachEle.addAttribute(new Attribute("collection", "selective"));
setForeachEle.addAttribute(new Attribute("item", "column"));
setForeachEle.addAttribute(new Attribute("separator", ","));
Element incrementEle = PluginTools.getHook(IIncrementsPluginHook.class).incrementSetsWithSelectiveEnhancedPluginElementGenerated(versionColumn);
// 普通情况
if (incrementEle == null && versionColumn == null) {
setForeachEle.addElement(new TextElement("${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}"));
} else if (incrementEle != null) {
setForeachEle.addElement(incrementEle);
} else if (versionColumn != null) {
XmlElement ifEle = new XmlElement("if");
ifEle.addAttribute(new Attribute("test", "column.value != '" + versionColumn.getActualColumnName() + "'.toString()"));
ifEle.addElement(new TextElement("${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}"));
setForeachEle.addElement(ifEle);
}
XmlElement setOtherwiseEle = new XmlElement("otherwise");
setOtherwiseEle.addElement(XmlElementGeneratorTools.generateSetsSelective(columns, "record."));
setsChooseEle.addElement(setOtherwiseEle);
return setsChooseEle;
} } | public class class_name {
private XmlElement generateSetsSelective(List<IntrospectedColumn> columns, IntrospectedColumn versionColumn) {
XmlElement setsChooseEle = new XmlElement("choose");
XmlElement setWhenEle = new XmlElement("when");
setWhenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
setsChooseEle.addElement(setWhenEle);
XmlElement setForeachEle = new XmlElement("foreach");
setWhenEle.addElement(setForeachEle);
setForeachEle.addAttribute(new Attribute("collection", "selective"));
setForeachEle.addAttribute(new Attribute("item", "column"));
setForeachEle.addAttribute(new Attribute("separator", ","));
Element incrementEle = PluginTools.getHook(IIncrementsPluginHook.class).incrementSetsWithSelectiveEnhancedPluginElementGenerated(versionColumn);
// 普通情况
if (incrementEle == null && versionColumn == null) {
setForeachEle.addElement(new TextElement("${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}")); // depends on control dependency: [if], data = [none]
} else if (incrementEle != null) {
setForeachEle.addElement(incrementEle); // depends on control dependency: [if], data = [(incrementEle]
} else if (versionColumn != null) {
XmlElement ifEle = new XmlElement("if");
ifEle.addAttribute(new Attribute("test", "column.value != '" + versionColumn.getActualColumnName() + "'.toString()")); // depends on control dependency: [if], data = [none]
ifEle.addElement(new TextElement("${column.escapedColumnName} = #{record.${column.javaProperty},jdbcType=${column.jdbcType}}")); // depends on control dependency: [if], data = [none]
setForeachEle.addElement(ifEle); // depends on control dependency: [if], data = [none]
}
XmlElement setOtherwiseEle = new XmlElement("otherwise");
setOtherwiseEle.addElement(XmlElementGeneratorTools.generateSetsSelective(columns, "record."));
setsChooseEle.addElement(setOtherwiseEle);
return setsChooseEle;
} } |
public class class_name {
public MeteoExtrasLongTermForecast createLongTermForecast() {
List<MeteoExtrasForecastDay> forecastDays = new ArrayList<>();
ZonedDateTime dt = toZeroHMSN(getLocationForecast().getCreated().plusDays(1));
for (int i = 0; i < series.getSeries().size(); i++) {
createLongTermForecastDay(dt.plusDays(i), series.getSeries().get(i))
.ifPresent(forecastDays::add);
}
return new MeteoExtrasLongTermForecast(forecastDays);
} } | public class class_name {
public MeteoExtrasLongTermForecast createLongTermForecast() {
List<MeteoExtrasForecastDay> forecastDays = new ArrayList<>();
ZonedDateTime dt = toZeroHMSN(getLocationForecast().getCreated().plusDays(1));
for (int i = 0; i < series.getSeries().size(); i++) {
createLongTermForecastDay(dt.plusDays(i), series.getSeries().get(i))
.ifPresent(forecastDays::add); // depends on control dependency: [for], data = [none]
}
return new MeteoExtrasLongTermForecast(forecastDays);
} } |
public class class_name {
@Override
public void sync(List<Dml> dmls) {
if (dmls == null || dmls.isEmpty()) {
return;
}
try {
rdbSyncService.sync(mappingConfigCache, dmls, envProperties);
rdbMirrorDbSyncService.sync(dmls);
} catch (Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@Override
public void sync(List<Dml> dmls) {
if (dmls == null || dmls.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
try {
rdbSyncService.sync(mappingConfigCache, dmls, envProperties); // depends on control dependency: [try], data = [none]
rdbMirrorDbSyncService.sync(dmls); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Response<Bitmap> doParse(NetworkResponse response) {
byte[] data = response.data;
BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
Bitmap bitmap = null;
if (mMaxWidth == 0 && mMaxHeight == 0) {
decodeOptions.inPreferredConfig = mDecodeConfig;
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions);
} else {
// If we have to resize this image, first get the natural bounds.
decodeOptions.inJustDecodeBounds = true;
BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions);
int actualWidth = decodeOptions.outWidth;
int actualHeight = decodeOptions.outHeight;
// Then compute the dimensions we would ideally like to decode to.
int desiredWidth = getResizedDimension(mMaxWidth, mMaxHeight,
actualWidth, actualHeight, mScaleType);
int desiredHeight = getResizedDimension(mMaxHeight, mMaxWidth,
actualHeight, actualWidth, mScaleType);
// Decode to the nearest power of two scaling factor.
decodeOptions.inJustDecodeBounds = false;
decodeOptions.inPreferQualityOverSpeed = PREFER_QUALITY_OVER_SPEED;
decodeOptions.inSampleSize =
findBestSampleSize(actualWidth, actualHeight, desiredWidth, desiredHeight);
Bitmap tempBitmap =
BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions);
// If necessary, scale down to the maximal acceptable size.
if (tempBitmap != null && (tempBitmap.getWidth() > desiredWidth ||
tempBitmap.getHeight() > desiredHeight)) {
bitmap = Bitmap.createScaledBitmap(tempBitmap,
desiredWidth, desiredHeight, true);
} else {
bitmap = tempBitmap;
}
}
if (bitmap == null) {
return Response.error(new ParseError(response));
} else {
return Response.success(bitmap, HttpHeaderParser.parseCacheHeaders(response));
}
} } | public class class_name {
private Response<Bitmap> doParse(NetworkResponse response) {
byte[] data = response.data;
BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
Bitmap bitmap = null;
if (mMaxWidth == 0 && mMaxHeight == 0) {
decodeOptions.inPreferredConfig = mDecodeConfig; // depends on control dependency: [if], data = [none]
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); // depends on control dependency: [if], data = [none]
} else {
// If we have to resize this image, first get the natural bounds.
decodeOptions.inJustDecodeBounds = true; // depends on control dependency: [if], data = [none]
BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions); // depends on control dependency: [if], data = [none]
int actualWidth = decodeOptions.outWidth;
int actualHeight = decodeOptions.outHeight;
// Then compute the dimensions we would ideally like to decode to.
int desiredWidth = getResizedDimension(mMaxWidth, mMaxHeight,
actualWidth, actualHeight, mScaleType);
int desiredHeight = getResizedDimension(mMaxHeight, mMaxWidth,
actualHeight, actualWidth, mScaleType);
// Decode to the nearest power of two scaling factor.
decodeOptions.inJustDecodeBounds = false; // depends on control dependency: [if], data = [none]
decodeOptions.inPreferQualityOverSpeed = PREFER_QUALITY_OVER_SPEED; // depends on control dependency: [if], data = [none]
decodeOptions.inSampleSize =
findBestSampleSize(actualWidth, actualHeight, desiredWidth, desiredHeight); // depends on control dependency: [if], data = [none]
Bitmap tempBitmap =
BitmapFactory.decodeByteArray(data, 0, data.length, decodeOptions);
// If necessary, scale down to the maximal acceptable size.
if (tempBitmap != null && (tempBitmap.getWidth() > desiredWidth ||
tempBitmap.getHeight() > desiredHeight)) {
bitmap = Bitmap.createScaledBitmap(tempBitmap,
desiredWidth, desiredHeight, true); // depends on control dependency: [if], data = [none]
} else {
bitmap = tempBitmap; // depends on control dependency: [if], data = [none]
}
}
if (bitmap == null) {
return Response.error(new ParseError(response)); // depends on control dependency: [if], data = [none]
} else {
return Response.success(bitmap, HttpHeaderParser.parseCacheHeaders(response)); // depends on control dependency: [if], data = [(bitmap]
}
} } |
public class class_name {
public void marshall(DeprecateDomainRequest deprecateDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (deprecateDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deprecateDomainRequest.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(DeprecateDomainRequest deprecateDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (deprecateDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deprecateDomainRequest.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 setSupportedUserNames(Collection<String> supportedUserNames) {
if (supportedUserNames == null) {
this.supportedUserNames = null;
} else {
this.supportedUserNames = ImmutableSet.copyOf(supportedUserNames);
}
} } | public class class_name {
public void setSupportedUserNames(Collection<String> supportedUserNames) {
if (supportedUserNames == null) {
this.supportedUserNames = null; // depends on control dependency: [if], data = [none]
} else {
this.supportedUserNames = ImmutableSet.copyOf(supportedUserNames); // depends on control dependency: [if], data = [(supportedUserNames]
}
} } |
public class class_name {
@Override
public JsonNode visit(Comparator op, JsonNode input) {
JsonNode lhsNode = op.getLhsExpr().accept(this, input);
JsonNode rhsNode = op.getRhsExpr().accept(this, input);
if (op.matches(lhsNode, rhsNode)) {
return BooleanNode.TRUE;
}
return BooleanNode.FALSE;
} } | public class class_name {
@Override
public JsonNode visit(Comparator op, JsonNode input) {
JsonNode lhsNode = op.getLhsExpr().accept(this, input);
JsonNode rhsNode = op.getRhsExpr().accept(this, input);
if (op.matches(lhsNode, rhsNode)) {
return BooleanNode.TRUE; // depends on control dependency: [if], data = [none]
}
return BooleanNode.FALSE;
} } |
public class class_name {
@Override
protected boolean _validate(StringBuffer buff) {
try {
new DateType(tf.getText(), null, null);
return true;
} catch (java.text.ParseException e) {
if (null != buff) buff.append(name).append(": ").append(e.getMessage());
return false;
}
} } | public class class_name {
@Override
protected boolean _validate(StringBuffer buff) {
try {
new DateType(tf.getText(), null, null); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (java.text.ParseException e) {
if (null != buff) buff.append(name).append(": ").append(e.getMessage());
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<Relationship> getRelatedRelationships() {
final List<Relationship> relatedRelationships = new LinkedList<Relationship>();
for (final Relationship r : relationships) {
if (r.getType() == RelationshipType.REFER_TO) {
relatedRelationships.add(r);
}
}
return relatedRelationships;
} } | public class class_name {
public List<Relationship> getRelatedRelationships() {
final List<Relationship> relatedRelationships = new LinkedList<Relationship>();
for (final Relationship r : relationships) {
if (r.getType() == RelationshipType.REFER_TO) {
relatedRelationships.add(r); // depends on control dependency: [if], data = [none]
}
}
return relatedRelationships;
} } |
public class class_name {
public void setConnections(java.util.Collection<ClientVpnConnection> connections) {
if (connections == null) {
this.connections = null;
return;
}
this.connections = new com.amazonaws.internal.SdkInternalList<ClientVpnConnection>(connections);
} } | public class class_name {
public void setConnections(java.util.Collection<ClientVpnConnection> connections) {
if (connections == null) {
this.connections = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.connections = new com.amazonaws.internal.SdkInternalList<ClientVpnConnection>(connections);
} } |
public class class_name {
public boolean readUserInfo(boolean bRefreshOnChange, boolean bForceRead)
{
String strUserID = this.getProperty(DBParams.USER_ID);
if (strUserID == null)
strUserID = this.getProperty(DBParams.USER_NAME);
if (strUserID == null)
strUserID = Constants.BLANK;
Record recUserInfo = (Record)this.getUserInfo();
if (recUserInfo == null)
recUserInfo = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, m_systemRecordOwner);
else
{
try {
if (recUserInfo.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
if (recUserInfo.isModified())
{
int iID = (int)recUserInfo.getCounterField().getValue();
recUserInfo.set(); // Update the current record.
if (iID != recUserInfo.getCounterField().getValue())
this.setProperty(DBParams.USER_ID, recUserInfo.getCounterField().toString());
}
} catch (DBException ex) {
ex.printStackTrace();
}
}
boolean bFound = ((UserInfoModel)recUserInfo).getUserInfo(strUserID, bForceRead); // This will read using either the userID or the user name
if (!bFound)
{ // Not found, add new
int iOpenMode = recUserInfo.getOpenMode();
if (bRefreshOnChange)
recUserInfo.setOpenMode(recUserInfo.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current
else
recUserInfo.setOpenMode(recUserInfo.getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current
try {
recUserInfo.addNew(); // new user
if ((strUserID != null) && (strUserID.length() > 0))
if (!Utility.isNumeric(strUserID)) // Can't have a numeric userid.
recUserInfo.getField(UserInfoModel.USER_NAME).setString(strUserID);
} catch (DBException ex) {
bFound = false;
} finally {
recUserInfo.setOpenMode(iOpenMode);
}
}
return bFound;
} } | public class class_name {
public boolean readUserInfo(boolean bRefreshOnChange, boolean bForceRead)
{
String strUserID = this.getProperty(DBParams.USER_ID);
if (strUserID == null)
strUserID = this.getProperty(DBParams.USER_NAME);
if (strUserID == null)
strUserID = Constants.BLANK;
Record recUserInfo = (Record)this.getUserInfo();
if (recUserInfo == null)
recUserInfo = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, m_systemRecordOwner);
else
{
try {
if (recUserInfo.getEditMode() == DBConstants.EDIT_IN_PROGRESS)
if (recUserInfo.isModified())
{
int iID = (int)recUserInfo.getCounterField().getValue();
recUserInfo.set(); // Update the current record. // depends on control dependency: [if], data = [none]
if (iID != recUserInfo.getCounterField().getValue())
this.setProperty(DBParams.USER_ID, recUserInfo.getCounterField().toString());
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
boolean bFound = ((UserInfoModel)recUserInfo).getUserInfo(strUserID, bForceRead); // This will read using either the userID or the user name
if (!bFound)
{ // Not found, add new
int iOpenMode = recUserInfo.getOpenMode();
if (bRefreshOnChange)
recUserInfo.setOpenMode(recUserInfo.getOpenMode() | DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current
else
recUserInfo.setOpenMode(recUserInfo.getOpenMode() & ~DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY); // Refresh if new, lock if current
try {
recUserInfo.addNew(); // new user // depends on control dependency: [try], data = [none]
if ((strUserID != null) && (strUserID.length() > 0))
if (!Utility.isNumeric(strUserID)) // Can't have a numeric userid.
recUserInfo.getField(UserInfoModel.USER_NAME).setString(strUserID);
} catch (DBException ex) {
bFound = false;
} finally { // depends on control dependency: [catch], data = [none]
recUserInfo.setOpenMode(iOpenMode);
}
}
return bFound;
} } |
public class class_name {
public synchronized boolean open(final boolean readOnly) {
if (isOpen()) {
close();
}
if (log.isDebugEnabled()) {
log.debug("open(" + file + ", " + (readOnly ? "r" : "rw") + ")");
}
try {
if (!readOnly) {
osOutput = new FileOutputStream(file, true);
fcOutput = osOutput.getChannel();
}
rafInput = new RandomAccessFile(file, "r");
fcInput = rafInput.getChannel();
if (readOnly) {
fcOutput = fcInput;
}
offsetOutputUncommited = offsetOutputCommited = fcOutput.size();
} catch (Exception e) {
log.error("Exception in open()", e);
try {
close();
} catch (Exception ign) {
}
}
validState = isOpen();
return validState;
} } | public class class_name {
public synchronized boolean open(final boolean readOnly) {
if (isOpen()) {
close(); // depends on control dependency: [if], data = [none]
}
if (log.isDebugEnabled()) {
log.debug("open(" + file + ", " + (readOnly ? "r" : "rw") + ")");
}
try {
if (!readOnly) {
osOutput = new FileOutputStream(file, true);
fcOutput = osOutput.getChannel();
}
rafInput = new RandomAccessFile(file, "r");
fcInput = rafInput.getChannel();
if (readOnly) {
fcOutput = fcInput;
}
offsetOutputUncommited = offsetOutputCommited = fcOutput.size();
} catch (Exception e) {
log.error("Exception in open()", e);
try {
close();
} catch (Exception ign) {
}
}
validState = isOpen();
return validState;
} } |
public class class_name {
@PublicEvolving
public static ExecutionEnvironment createLocalEnvironmentWithWebUI(Configuration conf) {
checkNotNull(conf, "conf");
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
if (!conf.contains(RestOptions.PORT)) {
// explicitly set this option so that it's not set to 0 later
conf.setInteger(RestOptions.PORT, RestOptions.PORT.defaultValue());
}
return createLocalEnvironment(conf, -1);
} } | public class class_name {
@PublicEvolving
public static ExecutionEnvironment createLocalEnvironmentWithWebUI(Configuration conf) {
checkNotNull(conf, "conf");
conf.setBoolean(ConfigConstants.LOCAL_START_WEBSERVER, true);
if (!conf.contains(RestOptions.PORT)) {
// explicitly set this option so that it's not set to 0 later
conf.setInteger(RestOptions.PORT, RestOptions.PORT.defaultValue()); // depends on control dependency: [if], data = [none]
}
return createLocalEnvironment(conf, -1);
} } |
public class class_name {
public T get() {
T value = object;
if (value == null) {
synchronized (this) {
value = object;
if (object == null) {
object = value = supplier.get();
}
}
}
return value;
} } | public class class_name {
public T get() {
T value = object;
if (value == null) {
synchronized (this) { // depends on control dependency: [if], data = [none]
value = object;
if (object == null) {
object = value = supplier.get(); // depends on control dependency: [if], data = [none]
}
}
}
return value;
} } |
public class class_name {
public void validate(Object o)
{
if (o != null && o instanceof Comparable)
{
compareMinExclusive((Comparable<?>)o);
compareMinInclusive((Comparable<?>)o);
compareMaxExclusive((Comparable<?>)o);
compareMaxInclusive((Comparable<?>)o);
}
} } | public class class_name {
public void validate(Object o)
{
if (o != null && o instanceof Comparable)
{
compareMinExclusive((Comparable<?>)o); // depends on control dependency: [if], data = [none]
compareMinInclusive((Comparable<?>)o); // depends on control dependency: [if], data = [none]
compareMaxExclusive((Comparable<?>)o); // depends on control dependency: [if], data = [none]
compareMaxInclusive((Comparable<?>)o); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected List<Tuple<TextLayout,Rectangle2D>> computeLines (
LineBreakMeasurer measurer, int targetWidth, Dimension size, boolean keepWordsWhole)
{
// start with a size of zero
double width = 0, height = 0;
List<Tuple<TextLayout,Rectangle2D>> layouts = new ArrayList<Tuple<TextLayout,Rectangle2D>>();
try {
// obtain our new dimensions by using a line break iterator to lay out our text one
// line at a time
TextLayout layout;
int lastposition = _text.length();
while (true) {
int nextret = _text.indexOf('\n', measurer.getPosition() + 1);
if (nextret == -1) {
nextret = lastposition;
}
layout = measurer.nextLayout(targetWidth, nextret, keepWordsWhole);
if (layout == null) {
break;
}
Rectangle2D bounds = getBounds(layout);
width = Math.max(width, getWidth(bounds));
height += getHeight(layout);
layouts.add(new Tuple<TextLayout,Rectangle2D>(layout, bounds));
}
// fill in the computed size; for some reason JDK1.3 on Linux chokes on
// setSize(double,double)
size.setSize(Math.ceil(width), Math.ceil(height));
// this can only happen if keepWordsWhole is true
if (measurer.getPosition() < lastposition) {
return null;
}
} catch (Throwable t) {
log.warning("Label layout failed", "text", _text, t);
}
return layouts;
} } | public class class_name {
protected List<Tuple<TextLayout,Rectangle2D>> computeLines (
LineBreakMeasurer measurer, int targetWidth, Dimension size, boolean keepWordsWhole)
{
// start with a size of zero
double width = 0, height = 0;
List<Tuple<TextLayout,Rectangle2D>> layouts = new ArrayList<Tuple<TextLayout,Rectangle2D>>();
try {
// obtain our new dimensions by using a line break iterator to lay out our text one
// line at a time
TextLayout layout;
int lastposition = _text.length();
while (true) {
int nextret = _text.indexOf('\n', measurer.getPosition() + 1);
if (nextret == -1) {
nextret = lastposition; // depends on control dependency: [if], data = [none]
}
layout = measurer.nextLayout(targetWidth, nextret, keepWordsWhole); // depends on control dependency: [while], data = [none]
if (layout == null) {
break;
}
Rectangle2D bounds = getBounds(layout);
width = Math.max(width, getWidth(bounds)); // depends on control dependency: [while], data = [none]
height += getHeight(layout); // depends on control dependency: [while], data = [none]
layouts.add(new Tuple<TextLayout,Rectangle2D>(layout, bounds)); // depends on control dependency: [while], data = [none]
}
// fill in the computed size; for some reason JDK1.3 on Linux chokes on
// setSize(double,double)
size.setSize(Math.ceil(width), Math.ceil(height)); // depends on control dependency: [try], data = [none]
// this can only happen if keepWordsWhole is true
if (measurer.getPosition() < lastposition) {
return null; // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
log.warning("Label layout failed", "text", _text, t);
} // depends on control dependency: [catch], data = [none]
return layouts;
} } |
public class class_name {
@SuppressWarnings("UnusedParameters")
protected String createDescriptionMetaData(String parameterName, DatabaseChangeProperty changePropertyAnnotation) {
if (changePropertyAnnotation == null) {
return null;
}
return StringUtil.trimToNull(changePropertyAnnotation.description());
} } | public class class_name {
@SuppressWarnings("UnusedParameters")
protected String createDescriptionMetaData(String parameterName, DatabaseChangeProperty changePropertyAnnotation) {
if (changePropertyAnnotation == null) {
return null; // depends on control dependency: [if], data = [none]
}
return StringUtil.trimToNull(changePropertyAnnotation.description());
} } |
public class class_name {
protected void fillMissingParameters() {
if (dest == null) {
dest = Key.make();
}
if (seed == -1) {
seed = new Random().nextLong();
Log.info("Generated seed: " + seed);
}
} } | public class class_name {
protected void fillMissingParameters() {
if (dest == null) {
dest = Key.make(); // depends on control dependency: [if], data = [none]
}
if (seed == -1) {
seed = new Random().nextLong(); // depends on control dependency: [if], data = [none]
Log.info("Generated seed: " + seed); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void checkArgumentFormat(CommandLineOption optionInfo, CharSequence matchedArg)
{
// Check if this option enforces a format for its argument.
if (optionInfo.argumentFormatRegexp != null)
{
Pattern pattern = Pattern.compile(optionInfo.argumentFormatRegexp);
Matcher argumentMatcher = pattern.matcher(matchedArg);
// Check if the argument does not meet its required format.
if (!argumentMatcher.matches())
{
// Create an error for this badly formed argument.
parsingErrors.add("The argument to option " + optionInfo.option +
" does not meet its required format.\n");
}
}
} } | public class class_name {
private void checkArgumentFormat(CommandLineOption optionInfo, CharSequence matchedArg)
{
// Check if this option enforces a format for its argument.
if (optionInfo.argumentFormatRegexp != null)
{
Pattern pattern = Pattern.compile(optionInfo.argumentFormatRegexp);
Matcher argumentMatcher = pattern.matcher(matchedArg);
// Check if the argument does not meet its required format.
if (!argumentMatcher.matches())
{
// Create an error for this badly formed argument.
parsingErrors.add("The argument to option " + optionInfo.option +
" does not meet its required format.\n"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void extract(URL sourceURL, File targetFolder)
throws IOException {
if (sourceURL.getProtocol().equals("file")) {
if (sourceURL.getFile().indexOf(".zip") > 0) {
extractZipDistribution(sourceURL, targetFolder);
}
else if (sourceURL.getFile().indexOf(".tar.gz") > 0) {
extractTarGzDistribution(sourceURL, targetFolder);
}
else {
throw new IllegalStateException(
"Unknow packaging of distribution; only zip or tar.gz could be handled.");
}
return;
}
if (sourceURL.toExternalForm().indexOf("/zip") > 0) {
extractZipDistribution(sourceURL, targetFolder);
}
else if (sourceURL.toExternalForm().indexOf("/tar.gz") > 0) {
extractTarGzDistribution(sourceURL, targetFolder);
}
else {
throw new IllegalStateException(
"Unknow packaging; only zip or tar.gz could be handled. URL was " + sourceURL);
}
} } | public class class_name {
public static void extract(URL sourceURL, File targetFolder)
throws IOException {
if (sourceURL.getProtocol().equals("file")) {
if (sourceURL.getFile().indexOf(".zip") > 0) {
extractZipDistribution(sourceURL, targetFolder); // depends on control dependency: [if], data = [none]
}
else if (sourceURL.getFile().indexOf(".tar.gz") > 0) {
extractTarGzDistribution(sourceURL, targetFolder); // depends on control dependency: [if], data = [none]
}
else {
throw new IllegalStateException(
"Unknow packaging of distribution; only zip or tar.gz could be handled.");
}
return;
}
if (sourceURL.toExternalForm().indexOf("/zip") > 0) {
extractZipDistribution(sourceURL, targetFolder);
}
else if (sourceURL.toExternalForm().indexOf("/tar.gz") > 0) {
extractTarGzDistribution(sourceURL, targetFolder);
}
else {
throw new IllegalStateException(
"Unknow packaging; only zip or tar.gz could be handled. URL was " + sourceURL);
}
} } |
public class class_name {
public void close() {
try {
unmmap.invoke(null, addr, this.size);
if (!file.delete()) {
throw new RuntimeException("could not delete " + file);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public void close() {
try {
unmmap.invoke(null, addr, this.size); // depends on control dependency: [try], data = [none]
if (!file.delete()) {
throw new RuntimeException("could not delete " + file);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String convertToDebianVersion( String version, boolean apply, String envName, String template, Date timestamp ) {
Matcher matcher = SNAPSHOT_PATTERN.matcher(version);
if (matcher.matches()) {
version = matcher.group(1) + "~";
if (apply) {
final String envValue = System.getenv(envName);
if(template != null && template.length() > 0) {
version += formatSnapshotTemplate(template, timestamp);
} else if (envValue != null && envValue.length() > 0) {
version += envValue;
} else {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
version += dateFormat.format(timestamp);
}
} else {
version += "SNAPSHOT";
}
} else {
matcher = BETA_PATTERN.matcher(version);
if (matcher.matches()) {
if (matcher.group(1) != null) {
version = matcher.group(1) + "~" + matcher.group(4) + matcher.group(5);
} else {
version = matcher.group(3) + "~" + matcher.group(4) + matcher.group(5);
}
}
}
// safest upstream_version should only contain full stop, plus, tilde, and alphanumerics
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
version = version.replaceAll("[^\\.+~A-Za-z0-9]", "+").replaceAll("\\++", "+");
return version;
} } | public class class_name {
public static String convertToDebianVersion( String version, boolean apply, String envName, String template, Date timestamp ) {
Matcher matcher = SNAPSHOT_PATTERN.matcher(version);
if (matcher.matches()) {
version = matcher.group(1) + "~"; // depends on control dependency: [if], data = [none]
if (apply) {
final String envValue = System.getenv(envName);
if(template != null && template.length() > 0) {
version += formatSnapshotTemplate(template, timestamp); // depends on control dependency: [if], data = [(template]
} else if (envValue != null && envValue.length() > 0) {
version += envValue; // depends on control dependency: [if], data = [none]
} else {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); // depends on control dependency: [if], data = [none]
version += dateFormat.format(timestamp); // depends on control dependency: [if], data = [none]
}
} else {
version += "SNAPSHOT"; // depends on control dependency: [if], data = [none]
}
} else {
matcher = BETA_PATTERN.matcher(version); // depends on control dependency: [if], data = [none]
if (matcher.matches()) {
if (matcher.group(1) != null) {
version = matcher.group(1) + "~" + matcher.group(4) + matcher.group(5); // depends on control dependency: [if], data = [none]
} else {
version = matcher.group(3) + "~" + matcher.group(4) + matcher.group(5); // depends on control dependency: [if], data = [none]
}
}
}
// safest upstream_version should only contain full stop, plus, tilde, and alphanumerics
// https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version
version = version.replaceAll("[^\\.+~A-Za-z0-9]", "+").replaceAll("\\++", "+");
return version;
} } |
public class class_name {
public void setText (String text)
{
if (_label.setText(text)) {
_dirty = true;
// clear out our constrained size where appropriate
if (_constrain == HORIZONTAL || _constrain == VERTICAL) {
_constrainedSize = 0;
_label.clearTargetDimens();
}
revalidate();
repaint();
}
} } | public class class_name {
public void setText (String text)
{
if (_label.setText(text)) {
_dirty = true; // depends on control dependency: [if], data = [none]
// clear out our constrained size where appropriate
if (_constrain == HORIZONTAL || _constrain == VERTICAL) {
_constrainedSize = 0; // depends on control dependency: [if], data = [none]
_label.clearTargetDimens(); // depends on control dependency: [if], data = [none]
}
revalidate(); // depends on control dependency: [if], data = [none]
repaint(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@RequestMapping(value = "changelog/export/{projectId}/formats", method = RequestMethod.GET)
public Resources<ExportFormat> changeLogExportFormats(@PathVariable ID projectId) {
// Gets the project
Project project = structureService.getProject(projectId);
// Gets the configuration for the project
GitConfiguration projectConfiguration = gitService.getProjectConfiguration(project);
if (projectConfiguration != null) {
Optional<ConfiguredIssueService> configuredIssueService = projectConfiguration.getConfiguredIssueService();
if (configuredIssueService.isPresent()) {
return Resources.of(
configuredIssueService.get().getIssueServiceExtension().exportFormats(
configuredIssueService.get().getIssueServiceConfiguration()
),
uri(on(GitController.class).changeLogExportFormats(projectId))
);
}
}
// Not found
return Resources.of(
Collections.emptyList(),
uri(on(GitController.class).changeLogExportFormats(projectId))
);
} } | public class class_name {
@RequestMapping(value = "changelog/export/{projectId}/formats", method = RequestMethod.GET)
public Resources<ExportFormat> changeLogExportFormats(@PathVariable ID projectId) {
// Gets the project
Project project = structureService.getProject(projectId);
// Gets the configuration for the project
GitConfiguration projectConfiguration = gitService.getProjectConfiguration(project);
if (projectConfiguration != null) {
Optional<ConfiguredIssueService> configuredIssueService = projectConfiguration.getConfiguredIssueService();
if (configuredIssueService.isPresent()) {
return Resources.of(
configuredIssueService.get().getIssueServiceExtension().exportFormats(
configuredIssueService.get().getIssueServiceConfiguration()
),
uri(on(GitController.class).changeLogExportFormats(projectId))
); // depends on control dependency: [if], data = [none]
}
}
// Not found
return Resources.of(
Collections.emptyList(),
uri(on(GitController.class).changeLogExportFormats(projectId))
);
} } |
public class class_name {
public boolean isPermittedAll(Collection<String> permissions) {
for (boolean permitted : isPermitted(permissions.toArray(new String[permissions.size()]))) {
if (!permitted) {
return false;
}
}
return true;
} } | public class class_name {
public boolean isPermittedAll(Collection<String> permissions) {
for (boolean permitted : isPermitted(permissions.toArray(new String[permissions.size()]))) {
if (!permitted) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public CmsResourceTranslator getXsdTranslator() {
String[] array = m_xsdTranslationEnabled ? new String[m_xsdTranslations.size()] : new String[0];
for (int i = 0; i < m_xsdTranslations.size(); i++) {
array[i] = m_xsdTranslations.get(i);
}
return new CmsResourceTranslator(array, true);
} } | public class class_name {
public CmsResourceTranslator getXsdTranslator() {
String[] array = m_xsdTranslationEnabled ? new String[m_xsdTranslations.size()] : new String[0];
for (int i = 0; i < m_xsdTranslations.size(); i++) {
array[i] = m_xsdTranslations.get(i); // depends on control dependency: [for], data = [i]
}
return new CmsResourceTranslator(array, true);
} } |
public class class_name {
public void updateConfig(AbstractInterfaceConfig config, String configPath, ChildData data) {
if (data == null) {
if (LOGGER.isInfoEnabled(config.getAppName())) {
LOGGER.infoWithApp(config.getAppName(), "Receive update data is null");
}
} else {
if (LOGGER.isInfoEnabled(config.getAppName())) {
LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]"
+ ", data=[" + StringSerializer.decode(data.getData()) + "]"
+ ", stat=[" + data.getStat() + "]");
}
notifyListeners(config, configPath, data, false);
}
} } | public class class_name {
public void updateConfig(AbstractInterfaceConfig config, String configPath, ChildData data) {
if (data == null) {
if (LOGGER.isInfoEnabled(config.getAppName())) {
LOGGER.infoWithApp(config.getAppName(), "Receive update data is null"); // depends on control dependency: [if], data = [none]
}
} else {
if (LOGGER.isInfoEnabled(config.getAppName())) {
LOGGER.infoWithApp(config.getAppName(), "Receive update data: path=[" + data.getPath() + "]"
+ ", data=[" + StringSerializer.decode(data.getData()) + "]"
+ ", stat=[" + data.getStat() + "]"); // depends on control dependency: [if], data = [none]
}
notifyListeners(config, configPath, data, false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addOuToTable(CmsOrganizationalUnit ou) {
if (m_app.isParentOfManagableOU(ou.getName())) {
Item item = m_container.addItem(ou.getName());
if (item != null) {
item.getItemProperty(TableProperty.Name).setValue(ou.getName());
item.getItemProperty(TableProperty.Description).setValue(ou.getDisplayName(A_CmsUI.get().getLocale()));
if (ou.hasFlagWebuser()) {
item.getItemProperty(TableProperty.Icon).setValue(new CmsCssIcon(OpenCmsTheme.ICON_OU_WEB));
}
}
}
} } | public class class_name {
private void addOuToTable(CmsOrganizationalUnit ou) {
if (m_app.isParentOfManagableOU(ou.getName())) {
Item item = m_container.addItem(ou.getName());
if (item != null) {
item.getItemProperty(TableProperty.Name).setValue(ou.getName()); // depends on control dependency: [if], data = [none]
item.getItemProperty(TableProperty.Description).setValue(ou.getDisplayName(A_CmsUI.get().getLocale())); // depends on control dependency: [if], data = [none]
if (ou.hasFlagWebuser()) {
item.getItemProperty(TableProperty.Icon).setValue(new CmsCssIcon(OpenCmsTheme.ICON_OU_WEB)); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
@Override
public final String getSeriesLabelFromCTSer(final Object ctObjSer) {
if (ctObjSer instanceof CTAreaSer) {
return ((CTAreaSer) ctObjSer).getTx().getStrRef().getF();
}
return null;
} } | public class class_name {
@Override
public final String getSeriesLabelFromCTSer(final Object ctObjSer) {
if (ctObjSer instanceof CTAreaSer) {
return ((CTAreaSer) ctObjSer).getTx().getStrRef().getF();
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void setZeroColor(final Color COLOR) {
if (null == zeroColor) {
_zeroColor = COLOR;
fireUpdateEvent(REDRAW_EVENT);
} else {
zeroColor.set(COLOR);
}
} } | public class class_name {
public void setZeroColor(final Color COLOR) {
if (null == zeroColor) {
_zeroColor = COLOR; // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
zeroColor.set(COLOR); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean isParam(ExpressionNode expr)
{
while(null != expr)
{
if(expr instanceof ElemTemplateElement)
break;
expr = expr.exprGetParent();
}
if(null != expr)
{
ElemTemplateElement ete = (ElemTemplateElement)expr;
while(null != ete)
{
int type = ete.getXSLToken();
switch(type)
{
case Constants.ELEMNAME_PARAMVARIABLE:
return true;
case Constants.ELEMNAME_TEMPLATE:
case Constants.ELEMNAME_STYLESHEET:
return false;
}
ete = ete.getParentElem();
}
}
return false;
} } | public class class_name {
protected boolean isParam(ExpressionNode expr)
{
while(null != expr)
{
if(expr instanceof ElemTemplateElement)
break;
expr = expr.exprGetParent(); // depends on control dependency: [while], data = [none]
}
if(null != expr)
{
ElemTemplateElement ete = (ElemTemplateElement)expr;
while(null != ete)
{
int type = ete.getXSLToken();
switch(type)
{
case Constants.ELEMNAME_PARAMVARIABLE:
return true;
case Constants.ELEMNAME_TEMPLATE:
case Constants.ELEMNAME_STYLESHEET:
return false;
}
ete = ete.getParentElem(); // depends on control dependency: [while], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
protected void emitStartManualElement(final long mVersion) {
try {
write("<tt revision=\"");
write(Long.toString(mVersion));
write("\">");
} catch (final IOException exc) {
exc.printStackTrace();
}
} } | public class class_name {
@Override
protected void emitStartManualElement(final long mVersion) {
try {
write("<tt revision=\""); // depends on control dependency: [try], data = [none]
write(Long.toString(mVersion)); // depends on control dependency: [try], data = [none]
write("\">"); // depends on control dependency: [try], data = [none]
} catch (final IOException exc) {
exc.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected void writeValue(String column, int line, String value) {
logger.info("Writing: [{}] at line [{}] in column [{}]", value, line, column);
final int colIndex = columns.indexOf(column);
final String url = this.norauiWebServicesApi + scenarioName + COLUMN + colIndex + LINE + line;
logger.info("url: [{}]", url);
try {
final DataModel dataModel = new Gson().fromJson(httpService.post(url, value), DataModel.class);
if (resultColumnName.equals(column)) {
if (value.equals(dataModel.getRows().get(line - 1).getResult())) {
logger.info(Messages.getMessage(REST_DATA_PROVIDER_WRITING_IN_REST_WS_ERROR_MESSAGE), column, line, value);
}
} else {
if (value.equals(dataModel.getRows().get(line - 1).getColumns().get(colIndex - 1))) {
logger.info(Messages.getMessage(REST_DATA_PROVIDER_WRITING_IN_REST_WS_ERROR_MESSAGE), column, line, value);
}
}
} catch (TechnicalException | NumberFormatException | HttpServiceException e) {
logger.error("writeValue error", e);
}
} } | public class class_name {
@Override
protected void writeValue(String column, int line, String value) {
logger.info("Writing: [{}] at line [{}] in column [{}]", value, line, column);
final int colIndex = columns.indexOf(column);
final String url = this.norauiWebServicesApi + scenarioName + COLUMN + colIndex + LINE + line;
logger.info("url: [{}]", url);
try {
final DataModel dataModel = new Gson().fromJson(httpService.post(url, value), DataModel.class);
if (resultColumnName.equals(column)) {
if (value.equals(dataModel.getRows().get(line - 1).getResult())) {
logger.info(Messages.getMessage(REST_DATA_PROVIDER_WRITING_IN_REST_WS_ERROR_MESSAGE), column, line, value); // depends on control dependency: [if], data = [none]
}
} else {
if (value.equals(dataModel.getRows().get(line - 1).getColumns().get(colIndex - 1))) {
logger.info(Messages.getMessage(REST_DATA_PROVIDER_WRITING_IN_REST_WS_ERROR_MESSAGE), column, line, value); // depends on control dependency: [if], data = [none]
}
}
} catch (TechnicalException | NumberFormatException | HttpServiceException e) {
logger.error("writeValue error", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void sessionLastAccessTimeSet(ISession session, long old, long newaccess) {
// ArrayList sessionStateObservers = null;
/*
* Check to see if there is a non-empty list of sessionStateObservers.
*/
if (_sessionStateObservers == null || _sessionStateObservers.size() < 1) {
return;
}
// synchronized(_sessionStateObservers) {
// sessionStateObservers = (ArrayList)_sessionStateObservers.clone();
// }
ISessionStateObserver sessionStateObserver = null;
for (int i = 0; i < _sessionStateObservers.size(); i++) {
sessionStateObserver = (ISessionStateObserver) _sessionStateObservers.get(i);
sessionStateObserver.sessionLastAccessTimeSet(session, old, newaccess);
}
} } | public class class_name {
public void sessionLastAccessTimeSet(ISession session, long old, long newaccess) {
// ArrayList sessionStateObservers = null;
/*
* Check to see if there is a non-empty list of sessionStateObservers.
*/
if (_sessionStateObservers == null || _sessionStateObservers.size() < 1) {
return; // depends on control dependency: [if], data = [none]
}
// synchronized(_sessionStateObservers) {
// sessionStateObservers = (ArrayList)_sessionStateObservers.clone();
// }
ISessionStateObserver sessionStateObserver = null;
for (int i = 0; i < _sessionStateObservers.size(); i++) {
sessionStateObserver = (ISessionStateObserver) _sessionStateObservers.get(i); // depends on control dependency: [for], data = [i]
sessionStateObserver.sessionLastAccessTimeSet(session, old, newaccess); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private void generateTemplateIndices(WikipediaTemplateInfo info,
Set<String> templateNames)
{
try {
for (String name : templateNames) {
int id = info.checkTemplateId(name);
if (id != -1) {
tplNameToTplId.put(name, id);
}
}
}
catch (WikiApiException e) {
}
} } | public class class_name {
private void generateTemplateIndices(WikipediaTemplateInfo info,
Set<String> templateNames)
{
try {
for (String name : templateNames) {
int id = info.checkTemplateId(name);
if (id != -1) {
tplNameToTplId.put(name, id); // depends on control dependency: [if], data = [none]
}
}
}
catch (WikiApiException e) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Integer getMinPoolSize()
{
if (childNode.getTextValueForPatternName("min-pool-size") != null && !childNode.getTextValueForPatternName("min-pool-size").equals("null")) {
return Integer.valueOf(childNode.getTextValueForPatternName("min-pool-size"));
}
return null;
} } | public class class_name {
public Integer getMinPoolSize()
{
if (childNode.getTextValueForPatternName("min-pool-size") != null && !childNode.getTextValueForPatternName("min-pool-size").equals("null")) {
return Integer.valueOf(childNode.getTextValueForPatternName("min-pool-size")); // depends on control dependency: [if], data = [(childNode.getTextValueForPatternName("min-pool-size")]
}
return null;
} } |
public class class_name {
public static String to(String str, NamingStyle namingStyle) {
NamingStyle ns = namingStyle;
if (str == null) {
return null;
}
if (ns == null) {
ns = NamingStyle.CAMEL;
}
String formatStr;
switch (ns) {
case CAMEL:
formatStr = toLowerCamel(str);
break;
case SNAKE:
formatStr = toSnake(str);
break;
case PASCAL:
formatStr = toPascal(str);
break;
case KEBAB:
formatStr = toKebab(str);
break;
default:
formatStr = toLowerCamel(str);
break;
}
return formatStr;
} } | public class class_name {
public static String to(String str, NamingStyle namingStyle) {
NamingStyle ns = namingStyle;
if (str == null) {
return null;
// depends on control dependency: [if], data = [none]
}
if (ns == null) {
ns = NamingStyle.CAMEL;
// depends on control dependency: [if], data = [none]
}
String formatStr;
switch (ns) {
case CAMEL:
formatStr = toLowerCamel(str);
break;
case SNAKE:
formatStr = toSnake(str);
break;
case PASCAL:
formatStr = toPascal(str);
break;
case KEBAB:
formatStr = toKebab(str);
break;
default:
formatStr = toLowerCamel(str);
break;
}
return formatStr;
} } |
public class class_name {
@Override
public Collection<KamEdge> getEdges(EdgeFilter filter) {
Set<KamEdge> kamEdges = new LinkedHashSet<KamEdge>();
for (KamEdge kamEdge : edgeIdMap.keySet()) {
// Check for an edge filter
if (null != filter) {
if (!filter.accept(kamEdge)) {
continue;
}
}
kamEdges.add(kamEdge);
}
return kamEdges;
} } | public class class_name {
@Override
public Collection<KamEdge> getEdges(EdgeFilter filter) {
Set<KamEdge> kamEdges = new LinkedHashSet<KamEdge>();
for (KamEdge kamEdge : edgeIdMap.keySet()) {
// Check for an edge filter
if (null != filter) {
if (!filter.accept(kamEdge)) {
continue;
}
}
kamEdges.add(kamEdge); // depends on control dependency: [for], data = [kamEdge]
}
return kamEdges;
} } |
public class class_name {
@Override
public void visitClassContext(final ClassContext classContext) {
JavaClass cls = classContext.getJavaClass();
Field[] flds = cls.getFields();
for (Field f : flds) {
String sig = f.getSignature();
if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
if (sig.startsWith("Ljava/util/") && sig.endsWith("List;")) {
fieldsReported.put(f.getName(), new FieldInfo());
}
}
}
if (!fieldsReported.isEmpty()) {
super.visitClassContext(classContext);
reportBugs();
}
} } | public class class_name {
@Override
public void visitClassContext(final ClassContext classContext) {
JavaClass cls = classContext.getJavaClass();
Field[] flds = cls.getFields();
for (Field f : flds) {
String sig = f.getSignature();
if (sig.startsWith(Values.SIG_QUALIFIED_CLASS_PREFIX)) {
if (sig.startsWith("Ljava/util/") && sig.endsWith("List;")) {
fieldsReported.put(f.getName(), new FieldInfo()); // depends on control dependency: [if], data = [none]
}
}
}
if (!fieldsReported.isEmpty()) {
super.visitClassContext(classContext); // depends on control dependency: [if], data = [none]
reportBugs(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void fillDetailProject(CmsListItem item, String detailId) {
StringBuffer html = new StringBuffer();
// search /read for the corresponding history project: it's tag id transmitted from getListItems()
// in a hidden column
Object tagIdObj = item.get(LIST_COLUMN_PUBLISH_TAG);
if (tagIdObj != null) {
// it is null if the offline version with changes is shown here: now history project available then
int tagId = ((Integer)tagIdObj).intValue();
try {
CmsHistoryProject project = getCms().readHistoryProject(tagId);
// output of project info
html.append(project.getName()).append("<br/>").append(project.getDescription());
} catch (CmsException cmse) {
html.append(cmse.getMessageContainer().key(getLocale()));
}
}
item.set(detailId, html.toString());
} } | public class class_name {
private void fillDetailProject(CmsListItem item, String detailId) {
StringBuffer html = new StringBuffer();
// search /read for the corresponding history project: it's tag id transmitted from getListItems()
// in a hidden column
Object tagIdObj = item.get(LIST_COLUMN_PUBLISH_TAG);
if (tagIdObj != null) {
// it is null if the offline version with changes is shown here: now history project available then
int tagId = ((Integer)tagIdObj).intValue();
try {
CmsHistoryProject project = getCms().readHistoryProject(tagId);
// output of project info
html.append(project.getName()).append("<br/>").append(project.getDescription()); // depends on control dependency: [try], data = [none]
} catch (CmsException cmse) {
html.append(cmse.getMessageContainer().key(getLocale()));
} // depends on control dependency: [catch], data = [none]
}
item.set(detailId, html.toString());
} } |
public class class_name {
public static boolean match(String keyword, String mappingId) {
if (mappingId.indexOf(keyword) != -1) { // match found!
return true;
}
return false;
} } | public class class_name {
public static boolean match(String keyword, String mappingId) {
if (mappingId.indexOf(keyword) != -1) { // match found!
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static boolean deleteRecursive(final File file) {
boolean result = true;
if (file.isDirectory()) {
for (final File inner : file.listFiles()) {
result &= deleteRecursive(inner);
}
}
return result & file.delete();
} } | public class class_name {
public static boolean deleteRecursive(final File file) {
boolean result = true;
if (file.isDirectory()) {
for (final File inner : file.listFiles()) {
result &= deleteRecursive(inner); // depends on control dependency: [for], data = [inner]
}
}
return result & file.delete();
} } |
public class class_name {
public String get(String key, Charset charset)
{
BinaryValue wrappedKey = BinaryValue.unsafeCreate(key.getBytes(charset));
BinaryValue value = meta.get(wrappedKey);
if (value != null)
{
return value.toString(charset);
}
else
{
return null;
}
} } | public class class_name {
public String get(String key, Charset charset)
{
BinaryValue wrappedKey = BinaryValue.unsafeCreate(key.getBytes(charset));
BinaryValue value = meta.get(wrappedKey);
if (value != null)
{
return value.toString(charset); // depends on control dependency: [if], data = [none]
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void computeIntersection() {
final ByteMap<ExpressionDataPoint[]> ordered_intersection =
new ByteMap<ExpressionDataPoint[]>();
final Iterator<ITimeSyncedIterator> it = queries.values().iterator();
// assume we have at least on query in our set
ITimeSyncedIterator sub = it.next();
Map<String, ByteMap<Integer>> flattened_tags =
new HashMap<String, ByteMap<Integer>>(queries.size());
ByteMap<Integer> tags = new ByteMap<Integer>();
flattened_tags.put(sub.getId(), tags);
ExpressionDataPoint[] dps = sub.values();
for (int i = 0; i < sub.size(); i++) {
final byte[] tagks = flattenTags(intersect_on_query_tagks, include_agg_tags,
dps[i].tags(), dps[i].aggregatedTags(), sub);
tags.put(tagks, i);
final ExpressionDataPoint[] idps = new ExpressionDataPoint[queries.size()];
idps[sub.getIndex()] = dps[i];
ordered_intersection.put(tagks, idps);
}
if (!it.hasNext()) {
setCurrentAndMeta(ordered_intersection);
return;
}
while (it.hasNext()) {
sub = it.next();
tags = new ByteMap<Integer>();
flattened_tags.put(sub.getId(), tags);
dps = sub.values();
// loop through the series in the sub iterator, compute the flattened tag
// ids, then kick out any that are NOT in the existing intersection map.
for (int i = 0; i < sub.size(); i++) {
final byte[] tagks = flattenTags(intersect_on_query_tagks, include_agg_tags,
dps[i].tags(), dps[i].aggregatedTags(), sub);
tags.put(tagks, i);
final ExpressionDataPoint[] idps = ordered_intersection.get(tagks);
if (idps == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Kicking out " + Bytes.pretty(tagks) + " from " + sub.getId());
}
sub.nullIterator(i);
continue;
}
idps[sub.getIndex()] = dps[i];
}
// gotta go backwards now to complete the intersection by kicking
// any series that appear in other sets but not HERE
final Iterator<Entry<byte[], ExpressionDataPoint[]>> reverse_it =
ordered_intersection.iterator();
while (reverse_it.hasNext()) {
Entry<byte[], ExpressionDataPoint[]> e = reverse_it.next();
if (!tags.containsKey(e.getKey())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Kicking out " + Bytes.pretty(e.getKey()) +
" from the main list since the query for " + sub.getId() +
" didn't have it");
}
// null the iterators for the other sets
for (final Map.Entry<String, ByteMap<Integer>> entry :
flattened_tags.entrySet()) {
if (entry.getKey().equals(sub.getId())) {
continue;
}
final Integer index = entry.getValue().get(e.getKey());
if (index != null) {
queries.get(entry.getKey()).nullIterator(index);
}
}
reverse_it.remove();
}
}
}
// now set our properly condensed and ordered values
if (ordered_intersection.size() < 1) {
// TODO - is it best to toss an exception here or return an empty result?
throw new IllegalDataException("No intersections found: " + this);
}
setCurrentAndMeta(ordered_intersection);
} } | public class class_name {
private void computeIntersection() {
final ByteMap<ExpressionDataPoint[]> ordered_intersection =
new ByteMap<ExpressionDataPoint[]>();
final Iterator<ITimeSyncedIterator> it = queries.values().iterator();
// assume we have at least on query in our set
ITimeSyncedIterator sub = it.next();
Map<String, ByteMap<Integer>> flattened_tags =
new HashMap<String, ByteMap<Integer>>(queries.size());
ByteMap<Integer> tags = new ByteMap<Integer>();
flattened_tags.put(sub.getId(), tags);
ExpressionDataPoint[] dps = sub.values();
for (int i = 0; i < sub.size(); i++) {
final byte[] tagks = flattenTags(intersect_on_query_tagks, include_agg_tags,
dps[i].tags(), dps[i].aggregatedTags(), sub);
tags.put(tagks, i); // depends on control dependency: [for], data = [i]
final ExpressionDataPoint[] idps = new ExpressionDataPoint[queries.size()];
idps[sub.getIndex()] = dps[i]; // depends on control dependency: [for], data = [i]
ordered_intersection.put(tagks, idps); // depends on control dependency: [for], data = [none]
}
if (!it.hasNext()) {
setCurrentAndMeta(ordered_intersection); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
while (it.hasNext()) {
sub = it.next(); // depends on control dependency: [while], data = [none]
tags = new ByteMap<Integer>(); // depends on control dependency: [while], data = [none]
flattened_tags.put(sub.getId(), tags); // depends on control dependency: [while], data = [none]
dps = sub.values(); // depends on control dependency: [while], data = [none]
// loop through the series in the sub iterator, compute the flattened tag
// ids, then kick out any that are NOT in the existing intersection map.
for (int i = 0; i < sub.size(); i++) {
final byte[] tagks = flattenTags(intersect_on_query_tagks, include_agg_tags,
dps[i].tags(), dps[i].aggregatedTags(), sub);
tags.put(tagks, i); // depends on control dependency: [for], data = [i]
final ExpressionDataPoint[] idps = ordered_intersection.get(tagks);
if (idps == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Kicking out " + Bytes.pretty(tagks) + " from " + sub.getId()); // depends on control dependency: [if], data = [none]
}
sub.nullIterator(i); // depends on control dependency: [if], data = [none]
continue;
}
idps[sub.getIndex()] = dps[i]; // depends on control dependency: [for], data = [i]
}
// gotta go backwards now to complete the intersection by kicking
// any series that appear in other sets but not HERE
final Iterator<Entry<byte[], ExpressionDataPoint[]>> reverse_it =
ordered_intersection.iterator();
while (reverse_it.hasNext()) {
Entry<byte[], ExpressionDataPoint[]> e = reverse_it.next();
if (!tags.containsKey(e.getKey())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Kicking out " + Bytes.pretty(e.getKey()) +
" from the main list since the query for " + sub.getId() +
" didn't have it"); // depends on control dependency: [if], data = [none]
}
// null the iterators for the other sets
for (final Map.Entry<String, ByteMap<Integer>> entry :
flattened_tags.entrySet()) {
if (entry.getKey().equals(sub.getId())) {
continue;
}
final Integer index = entry.getValue().get(e.getKey());
if (index != null) {
queries.get(entry.getKey()).nullIterator(index); // depends on control dependency: [if], data = [(index]
}
}
reverse_it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
// now set our properly condensed and ordered values
if (ordered_intersection.size() < 1) {
// TODO - is it best to toss an exception here or return an empty result?
throw new IllegalDataException("No intersections found: " + this);
}
setCurrentAndMeta(ordered_intersection);
} } |
public class class_name {
public Object javaToSql(Object source)
{
if (source == null)
return null;
try
{
return SerializationUtils.serialize((Serializable) source);
}
catch(Throwable t)
{
throw new ConversionException(t);
}
} } | public class class_name {
public Object javaToSql(Object source)
{
if (source == null)
return null;
try
{
return SerializationUtils.serialize((Serializable) source);
// depends on control dependency: [try], data = [none]
}
catch(Throwable t)
{
throw new ConversionException(t);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void addScalar(int k) {
Set<O> remove = new HashSet<>();
for (O o : multiplicities.keySet()) {
setMultiplicity(o, multiplicity(o) + k);
if (multiplicity(o) < 1) {
remove.add(o);
}
}
for (O o : remove) {
remove(o);
}
} } | public class class_name {
public void addScalar(int k) {
Set<O> remove = new HashSet<>();
for (O o : multiplicities.keySet()) {
setMultiplicity(o, multiplicity(o) + k); // depends on control dependency: [for], data = [o]
if (multiplicity(o) < 1) {
remove.add(o); // depends on control dependency: [if], data = [none]
}
}
for (O o : remove) {
remove(o); // depends on control dependency: [for], data = [o]
}
} } |
public class class_name {
public CreatePresetResponse createPreset(CreatePresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
if (request.getAudio() != null) {
checkNotNull(request.getAudio().getBitRateInBps(),
"The parameter bitRateInBps in audio should NOT be null.");
checkIsTrue(request.getAudio().getBitRateInBps() > 0,
"The audio's parameter bitRateInBps should be greater than zero.");
}
if (request.getVideo() != null) {
checkNotNull(request.getVideo().getBitRateInBps(),
"The parameter bitRateInBps in video should NOT be null.");
checkIsTrue(request.getVideo().getBitRateInBps() > 0,
"The video's parameter bitRateInBps should be greater than zero.");
checkNotNull(request.getVideo().getMaxFrameRate(),
"The parameter maxFrameRate in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxFrameRate() > 0,
"The video's parameter maxFrameRate should be greater than zero.");
checkNotNull(request.getVideo().getMaxWidthInPixel(),
"The parameter maxWidthInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxWidthInPixel() > 0,
"The video's parameter maxWidthInPixel should be greater than zero.");
checkNotNull(request.getVideo().getMaxHeightInPixel(),
"The parameter maxHeightInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxHeightInPixel() > 0,
"The video's parameter maxHeightInPixel should be greater than zero.");
}
// not support yet
request.setThumbnail(null);
request.setWatermarks(null);
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} } | public class class_name {
public CreatePresetResponse createPreset(CreatePresetRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getName(),
"The parameter name should NOT be null or empty string.");
if (request.getAudio() != null) {
checkNotNull(request.getAudio().getBitRateInBps(),
"The parameter bitRateInBps in audio should NOT be null."); // depends on control dependency: [if], data = [(request.getAudio()]
checkIsTrue(request.getAudio().getBitRateInBps() > 0,
"The audio's parameter bitRateInBps should be greater than zero.");
}
if (request.getVideo() != null) {
checkNotNull(request.getVideo().getBitRateInBps(),
"The parameter bitRateInBps in video should NOT be null.");
checkIsTrue(request.getVideo().getBitRateInBps() > 0,
"The video's parameter bitRateInBps should be greater than zero."); // depends on control dependency: [if], data = [(request.getAudio()]
checkNotNull(request.getVideo().getMaxFrameRate(),
"The parameter maxFrameRate in video should NOT be null."); // depends on control dependency: [if], data = [none]
checkIsTrue(request.getVideo().getMaxFrameRate() > 0,
"The video's parameter maxFrameRate should be greater than zero.");
checkNotNull(request.getVideo().getMaxWidthInPixel(),
"The parameter maxWidthInPixel in video should NOT be null.");
checkIsTrue(request.getVideo().getMaxWidthInPixel() > 0,
"The video's parameter maxWidthInPixel should be greater than zero."); // depends on control dependency: [if], data = [none]
checkNotNull(request.getVideo().getMaxHeightInPixel(),
"The parameter maxHeightInPixel in video should NOT be null."); // depends on control dependency: [if], data = [none]
checkIsTrue(request.getVideo().getMaxHeightInPixel() > 0,
"The video's parameter maxHeightInPixel should be greater than zero."); // depends on control dependency: [if], data = [none]
}
// not support yet
request.setThumbnail(null);
request.setWatermarks(null);
InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_PRESET);
return invokeHttpClient(internalRequest, CreatePresetResponse.class);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.