code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public String getRealmName() {
if (realmName == null || realmName.trim().equals("")) {
realmName = getDefaultRealmName();
}
return realmName;
} } | public class class_name {
public String getRealmName() {
if (realmName == null || realmName.trim().equals("")) {
realmName = getDefaultRealmName(); // depends on control dependency: [if], data = [none]
}
return realmName;
} } |
public class class_name {
public void append(final char[] data) {
if (data == null) {
return;
}
provideCapacity(length + data.length);
System.arraycopy(data, 0, c, length, data.length);
length += data.length;
} } | public class class_name {
public void append(final char[] data) {
if (data == null) {
return; // depends on control dependency: [if], data = [none]
}
provideCapacity(length + data.length);
System.arraycopy(data, 0, c, length, data.length);
length += data.length;
} } |
public class class_name {
public static byte[] str2bin(final String values, final JBBPBitOrder bitOrder) {
if (values == null) {
return new byte[0];
}
int buff = 0;
int cnt = 0;
final ByteArrayOutputStream buffer = new ByteArrayOutputStream((values.length() + 7) >> 3);
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (final char v : values.toCharArray()) {
switch (v) {
case '_':
case ' ':
continue;
case '0':
case 'X':
case 'x':
case 'Z':
case 'z': {
if (msb0) {
buff >>= 1;
} else {
buff <<= 1;
}
}
break;
case '1': {
if (msb0) {
buff = (buff >> 1) | 0x80;
} else {
buff = (buff << 1) | 1;
}
}
break;
default:
throw new IllegalArgumentException("Detected unsupported char '" + v + ']');
}
cnt++;
if (cnt == 8) {
buffer.write(buff);
cnt = 0;
buff = 0;
}
}
if (cnt > 0) {
buffer.write(msb0 ? buff >>> (8 - cnt) : buff);
}
return buffer.toByteArray();
} } | public class class_name {
public static byte[] str2bin(final String values, final JBBPBitOrder bitOrder) {
if (values == null) {
return new byte[0]; // depends on control dependency: [if], data = [none]
}
int buff = 0;
int cnt = 0;
final ByteArrayOutputStream buffer = new ByteArrayOutputStream((values.length() + 7) >> 3);
final boolean msb0 = bitOrder == JBBPBitOrder.MSB0;
for (final char v : values.toCharArray()) {
switch (v) {
case '_':
case ' ':
continue;
case '0':
case 'X':
case 'x':
case 'Z':
case 'z': {
if (msb0) {
buff >>= 1; // depends on control dependency: [if], data = [none]
} else {
buff <<= 1; // depends on control dependency: [if], data = [none]
}
}
break;
case '1': {
if (msb0) {
buff = (buff >> 1) | 0x80; // depends on control dependency: [if], data = [none]
} else {
buff = (buff << 1) | 1; // depends on control dependency: [if], data = [none]
}
}
break;
default:
throw new IllegalArgumentException("Detected unsupported char '" + v + ']');
}
cnt++; // depends on control dependency: [for], data = [none]
if (cnt == 8) {
buffer.write(buff); // depends on control dependency: [if], data = [none]
cnt = 0; // depends on control dependency: [if], data = [none]
buff = 0; // depends on control dependency: [if], data = [none]
}
}
if (cnt > 0) {
buffer.write(msb0 ? buff >>> (8 - cnt) : buff); // depends on control dependency: [if], data = [none]
}
return buffer.toByteArray();
} } |
public class class_name {
public final UnicodeSet remove(CharSequence s) {
int cp = getSingleCP(s);
if (cp < 0) {
strings.remove(s.toString());
pat = null;
} else {
remove(cp, cp);
}
return this;
} } | public class class_name {
public final UnicodeSet remove(CharSequence s) {
int cp = getSingleCP(s);
if (cp < 0) {
strings.remove(s.toString()); // depends on control dependency: [if], data = [none]
pat = null; // depends on control dependency: [if], data = [none]
} else {
remove(cp, cp); // depends on control dependency: [if], data = [(cp]
}
return this;
} } |
public class class_name {
public static int[] unbox (Integer[] list)
{
if (list == null) {
return null;
}
int[] unboxed = new int[list.length];
for (int ii = 0; ii < list.length; ii++) {
unboxed[ii] = list[ii];
}
return unboxed;
} } | public class class_name {
public static int[] unbox (Integer[] list)
{
if (list == null) {
return null; // depends on control dependency: [if], data = [none]
}
int[] unboxed = new int[list.length];
for (int ii = 0; ii < list.length; ii++) {
unboxed[ii] = list[ii]; // depends on control dependency: [for], data = [ii]
}
return unboxed;
} } |
public class class_name {
protected Map<String, CmsResource> getResourcesByRelativePath(List<CmsResource> resources, String basePath) {
Map<String, CmsResource> result = new HashMap<String, CmsResource>();
for (CmsResource resource : resources) {
String relativeSubPath = CmsStringUtil.getRelativeSubPath(basePath, resource.getRootPath());
if (relativeSubPath != null) {
result.put(relativeSubPath, resource);
}
}
return result;
} } | public class class_name {
protected Map<String, CmsResource> getResourcesByRelativePath(List<CmsResource> resources, String basePath) {
Map<String, CmsResource> result = new HashMap<String, CmsResource>();
for (CmsResource resource : resources) {
String relativeSubPath = CmsStringUtil.getRelativeSubPath(basePath, resource.getRootPath());
if (relativeSubPath != null) {
result.put(relativeSubPath, resource); // depends on control dependency: [if], data = [(relativeSubPath]
}
}
return result;
} } |
public class class_name {
public static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
boolean withParameters, boolean splitStatements,
boolean isBatchedReWriteConfigured,
String... returningColumnNames) throws SQLException {
if (!withParameters && !splitStatements
&& returningColumnNames != null && returningColumnNames.length == 0) {
return Collections.singletonList(new NativeQuery(query,
SqlCommand.createStatementTypeInfo(SqlCommandType.BLANK)));
}
int fragmentStart = 0;
int inParen = 0;
char[] aChars = query.toCharArray();
StringBuilder nativeSql = new StringBuilder(query.length() + 10);
List<Integer> bindPositions = null; // initialized on demand
List<NativeQuery> nativeQueries = null;
boolean isCurrentReWriteCompatible = false;
boolean isValuesFound = false;
int valuesBraceOpenPosition = -1;
int valuesBraceClosePosition = -1;
boolean valuesBraceCloseFound = false;
boolean isInsertPresent = false;
boolean isReturningPresent = false;
boolean isReturningPresentPrev = false;
SqlCommandType currentCommandType = SqlCommandType.BLANK;
SqlCommandType prevCommandType = SqlCommandType.BLANK;
int numberOfStatements = 0;
boolean whitespaceOnly = true;
int keyWordCount = 0;
int keywordStart = -1;
int keywordEnd = -1;
for (int i = 0; i < aChars.length; ++i) {
char aChar = aChars[i];
boolean isKeyWordChar = false;
// ';' is ignored as it splits the queries
whitespaceOnly &= aChar == ';' || Character.isWhitespace(aChar);
keywordEnd = i; // parseSingleQuotes, parseDoubleQuotes, etc move index so we keep old value
switch (aChar) {
case '\'': // single-quotes
i = Parser.parseSingleQuotes(aChars, i, standardConformingStrings);
break;
case '"': // double-quotes
i = Parser.parseDoubleQuotes(aChars, i);
break;
case '-': // possibly -- style comment
i = Parser.parseLineComment(aChars, i);
break;
case '/': // possibly /* */ style comment
i = Parser.parseBlockComment(aChars, i);
break;
case '$': // possibly dollar quote start
i = Parser.parseDollarQuotes(aChars, i);
break;
// case '(' moved below to parse "values(" properly
case ')':
inParen--;
if (inParen == 0 && isValuesFound && !valuesBraceCloseFound) {
// If original statement is multi-values like VALUES (...), (...), ... then
// search for the latest closing paren
valuesBraceClosePosition = nativeSql.length() + i - fragmentStart;
}
break;
case '?':
nativeSql.append(aChars, fragmentStart, i - fragmentStart);
if (i + 1 < aChars.length && aChars[i + 1] == '?') /* replace ?? with ? */ {
nativeSql.append('?');
i++; // make sure the coming ? is not treated as a bind
} else {
if (!withParameters) {
nativeSql.append('?');
} else {
if (bindPositions == null) {
bindPositions = new ArrayList<Integer>();
}
bindPositions.add(nativeSql.length());
int bindIndex = bindPositions.size();
nativeSql.append(NativeQuery.bindName(bindIndex));
}
}
fragmentStart = i + 1;
break;
case ';':
if (inParen == 0) {
if (!whitespaceOnly) {
numberOfStatements++;
nativeSql.append(aChars, fragmentStart, i - fragmentStart);
whitespaceOnly = true;
}
fragmentStart = i + 1;
if (nativeSql.length() > 0) {
if (addReturning(nativeSql, currentCommandType, returningColumnNames, isReturningPresent)) {
isReturningPresent = true;
}
if (splitStatements) {
if (nativeQueries == null) {
nativeQueries = new ArrayList<NativeQuery>();
}
if (!isValuesFound || !isCurrentReWriteCompatible || valuesBraceClosePosition == -1
|| (bindPositions != null
&& valuesBraceClosePosition < bindPositions.get(bindPositions.size() - 1))) {
valuesBraceOpenPosition = -1;
valuesBraceClosePosition = -1;
}
nativeQueries.add(new NativeQuery(nativeSql.toString(),
toIntArray(bindPositions), false,
SqlCommand.createStatementTypeInfo(
currentCommandType, isBatchedReWriteConfigured, valuesBraceOpenPosition,
valuesBraceClosePosition,
isReturningPresent, nativeQueries.size())));
}
}
prevCommandType = currentCommandType;
isReturningPresentPrev = isReturningPresent;
currentCommandType = SqlCommandType.BLANK;
isReturningPresent = false;
if (splitStatements) {
// Prepare for next query
if (bindPositions != null) {
bindPositions.clear();
}
nativeSql.setLength(0);
isValuesFound = false;
isCurrentReWriteCompatible = false;
valuesBraceOpenPosition = -1;
valuesBraceClosePosition = -1;
valuesBraceCloseFound = false;
}
}
break;
default:
if (keywordStart >= 0) {
// When we are inside a keyword, we need to detect keyword end boundary
// Note that isKeyWordChar is initialized to false before the switch, so
// all other characters would result in isKeyWordChar=false
isKeyWordChar = isIdentifierContChar(aChar);
break;
}
// Not in keyword, so just detect next keyword start
isKeyWordChar = isIdentifierStartChar(aChar);
if (isKeyWordChar) {
keywordStart = i;
if (valuesBraceOpenPosition != -1 && inParen == 0) {
// When the statement already has multi-values, stop looking for more of them
// Since values(?,?),(?,?),... should not contain keywords in the middle
valuesBraceCloseFound = true;
}
}
break;
}
if (keywordStart >= 0 && (i == aChars.length - 1 || !isKeyWordChar)) {
int wordLength = (isKeyWordChar ? i + 1 : keywordEnd) - keywordStart;
if (currentCommandType == SqlCommandType.BLANK) {
if (wordLength == 6 && parseUpdateKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.UPDATE;
} else if (wordLength == 6 && parseDeleteKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.DELETE;
} else if (wordLength == 4 && parseMoveKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.MOVE;
} else if (wordLength == 6 && parseSelectKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.SELECT;
} else if (wordLength == 4 && parseWithKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.WITH;
} else if (wordLength == 6 && parseInsertKeyword(aChars, keywordStart)) {
if (!isInsertPresent && (nativeQueries == null || nativeQueries.isEmpty())) {
// Only allow rewrite for insert command starting with the insert keyword.
// Else, too many risks of wrong interpretation.
isCurrentReWriteCompatible = keyWordCount == 0;
isInsertPresent = true;
currentCommandType = SqlCommandType.INSERT;
} else {
isCurrentReWriteCompatible = false;
}
}
} else if (currentCommandType == SqlCommandType.WITH
&& inParen == 0) {
SqlCommandType command = parseWithCommandType(aChars, i, keywordStart, wordLength);
if (command != null) {
currentCommandType = command;
}
}
if (inParen != 0 || aChar == ')') {
// RETURNING and VALUES cannot be present in braces
} else if (wordLength == 9 && parseReturningKeyword(aChars, keywordStart)) {
isReturningPresent = true;
} else if (wordLength == 6 && parseValuesKeyword(aChars, keywordStart)) {
isValuesFound = true;
}
keywordStart = -1;
keyWordCount++;
}
if (aChar == '(') {
inParen++;
if (inParen == 1 && isValuesFound && valuesBraceOpenPosition == -1) {
valuesBraceOpenPosition = nativeSql.length() + i - fragmentStart;
}
}
}
if (!isValuesFound || !isCurrentReWriteCompatible || valuesBraceClosePosition == -1
|| (bindPositions != null
&& valuesBraceClosePosition < bindPositions.get(bindPositions.size() - 1))) {
valuesBraceOpenPosition = -1;
valuesBraceClosePosition = -1;
}
if (fragmentStart < aChars.length && !whitespaceOnly) {
nativeSql.append(aChars, fragmentStart, aChars.length - fragmentStart);
} else {
if (numberOfStatements > 1) {
isReturningPresent = false;
currentCommandType = SqlCommandType.BLANK;
} else if (numberOfStatements == 1) {
isReturningPresent = isReturningPresentPrev;
currentCommandType = prevCommandType;
}
}
if (nativeSql.length() == 0) {
return nativeQueries != null ? nativeQueries : Collections.<NativeQuery>emptyList();
}
if (addReturning(nativeSql, currentCommandType, returningColumnNames, isReturningPresent)) {
isReturningPresent = true;
}
NativeQuery lastQuery = new NativeQuery(nativeSql.toString(),
toIntArray(bindPositions), !splitStatements,
SqlCommand.createStatementTypeInfo(currentCommandType,
isBatchedReWriteConfigured, valuesBraceOpenPosition, valuesBraceClosePosition,
isReturningPresent, (nativeQueries == null ? 0 : nativeQueries.size())));
if (nativeQueries == null) {
return Collections.singletonList(lastQuery);
}
if (!whitespaceOnly) {
nativeQueries.add(lastQuery);
}
return nativeQueries;
} } | public class class_name {
public static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
boolean withParameters, boolean splitStatements,
boolean isBatchedReWriteConfigured,
String... returningColumnNames) throws SQLException {
if (!withParameters && !splitStatements
&& returningColumnNames != null && returningColumnNames.length == 0) {
return Collections.singletonList(new NativeQuery(query,
SqlCommand.createStatementTypeInfo(SqlCommandType.BLANK))); // depends on control dependency: [if], data = [none]
}
int fragmentStart = 0;
int inParen = 0;
char[] aChars = query.toCharArray();
StringBuilder nativeSql = new StringBuilder(query.length() + 10);
List<Integer> bindPositions = null; // initialized on demand
List<NativeQuery> nativeQueries = null;
boolean isCurrentReWriteCompatible = false;
boolean isValuesFound = false;
int valuesBraceOpenPosition = -1;
int valuesBraceClosePosition = -1;
boolean valuesBraceCloseFound = false;
boolean isInsertPresent = false;
boolean isReturningPresent = false;
boolean isReturningPresentPrev = false;
SqlCommandType currentCommandType = SqlCommandType.BLANK;
SqlCommandType prevCommandType = SqlCommandType.BLANK;
int numberOfStatements = 0;
boolean whitespaceOnly = true;
int keyWordCount = 0;
int keywordStart = -1;
int keywordEnd = -1;
for (int i = 0; i < aChars.length; ++i) {
char aChar = aChars[i];
boolean isKeyWordChar = false;
// ';' is ignored as it splits the queries
whitespaceOnly &= aChar == ';' || Character.isWhitespace(aChar); // depends on control dependency: [for], data = [none]
keywordEnd = i; // parseSingleQuotes, parseDoubleQuotes, etc move index so we keep old value // depends on control dependency: [for], data = [i]
switch (aChar) {
case '\'': // single-quotes
i = Parser.parseSingleQuotes(aChars, i, standardConformingStrings);
break;
case '"': // double-quotes
i = Parser.parseDoubleQuotes(aChars, i);
break;
case '-': // possibly -- style comment
i = Parser.parseLineComment(aChars, i);
break;
case '/': // possibly /* */ style comment
i = Parser.parseBlockComment(aChars, i);
break;
case '$': // possibly dollar quote start
i = Parser.parseDollarQuotes(aChars, i);
break;
// case '(' moved below to parse "values(" properly
case ')':
inParen--;
if (inParen == 0 && isValuesFound && !valuesBraceCloseFound) {
// If original statement is multi-values like VALUES (...), (...), ... then
// search for the latest closing paren
valuesBraceClosePosition = nativeSql.length() + i - fragmentStart; // depends on control dependency: [if], data = [none]
}
break;
case '?':
nativeSql.append(aChars, fragmentStart, i - fragmentStart);
if (i + 1 < aChars.length && aChars[i + 1] == '?') /* replace ?? with ? */ {
nativeSql.append('?'); // depends on control dependency: [if], data = ['?')]
i++; // make sure the coming ? is not treated as a bind // depends on control dependency: [if], data = [none]
} else {
if (!withParameters) {
nativeSql.append('?'); // depends on control dependency: [if], data = [none]
} else {
if (bindPositions == null) {
bindPositions = new ArrayList<Integer>(); // depends on control dependency: [if], data = [none]
}
bindPositions.add(nativeSql.length()); // depends on control dependency: [if], data = [none]
int bindIndex = bindPositions.size();
nativeSql.append(NativeQuery.bindName(bindIndex)); // depends on control dependency: [if], data = [none]
}
}
fragmentStart = i + 1;
break;
case ';':
if (inParen == 0) {
if (!whitespaceOnly) {
numberOfStatements++; // depends on control dependency: [if], data = [none]
nativeSql.append(aChars, fragmentStart, i - fragmentStart); // depends on control dependency: [if], data = [none]
whitespaceOnly = true; // depends on control dependency: [if], data = [none]
}
fragmentStart = i + 1; // depends on control dependency: [if], data = [none]
if (nativeSql.length() > 0) {
if (addReturning(nativeSql, currentCommandType, returningColumnNames, isReturningPresent)) {
isReturningPresent = true; // depends on control dependency: [if], data = [none]
}
if (splitStatements) {
if (nativeQueries == null) {
nativeQueries = new ArrayList<NativeQuery>(); // depends on control dependency: [if], data = [none]
}
if (!isValuesFound || !isCurrentReWriteCompatible || valuesBraceClosePosition == -1
|| (bindPositions != null
&& valuesBraceClosePosition < bindPositions.get(bindPositions.size() - 1))) {
valuesBraceOpenPosition = -1; // depends on control dependency: [if], data = [none]
valuesBraceClosePosition = -1; // depends on control dependency: [if], data = [none]
}
nativeQueries.add(new NativeQuery(nativeSql.toString(),
toIntArray(bindPositions), false,
SqlCommand.createStatementTypeInfo(
currentCommandType, isBatchedReWriteConfigured, valuesBraceOpenPosition,
valuesBraceClosePosition,
isReturningPresent, nativeQueries.size()))); // depends on control dependency: [if], data = [none]
}
}
prevCommandType = currentCommandType; // depends on control dependency: [if], data = [none]
isReturningPresentPrev = isReturningPresent; // depends on control dependency: [if], data = [none]
currentCommandType = SqlCommandType.BLANK; // depends on control dependency: [if], data = [none]
isReturningPresent = false; // depends on control dependency: [if], data = [none]
if (splitStatements) {
// Prepare for next query
if (bindPositions != null) {
bindPositions.clear(); // depends on control dependency: [if], data = [none]
}
nativeSql.setLength(0); // depends on control dependency: [if], data = [none]
isValuesFound = false; // depends on control dependency: [if], data = [none]
isCurrentReWriteCompatible = false; // depends on control dependency: [if], data = [none]
valuesBraceOpenPosition = -1; // depends on control dependency: [if], data = [none]
valuesBraceClosePosition = -1; // depends on control dependency: [if], data = [none]
valuesBraceCloseFound = false; // depends on control dependency: [if], data = [none]
}
}
break;
default:
if (keywordStart >= 0) {
// When we are inside a keyword, we need to detect keyword end boundary
// Note that isKeyWordChar is initialized to false before the switch, so
// all other characters would result in isKeyWordChar=false
isKeyWordChar = isIdentifierContChar(aChar); // depends on control dependency: [if], data = [none]
break;
}
// Not in keyword, so just detect next keyword start
isKeyWordChar = isIdentifierStartChar(aChar);
if (isKeyWordChar) {
keywordStart = i; // depends on control dependency: [if], data = [none]
if (valuesBraceOpenPosition != -1 && inParen == 0) {
// When the statement already has multi-values, stop looking for more of them
// Since values(?,?),(?,?),... should not contain keywords in the middle
valuesBraceCloseFound = true; // depends on control dependency: [if], data = [none]
}
}
break;
}
if (keywordStart >= 0 && (i == aChars.length - 1 || !isKeyWordChar)) {
int wordLength = (isKeyWordChar ? i + 1 : keywordEnd) - keywordStart;
if (currentCommandType == SqlCommandType.BLANK) {
if (wordLength == 6 && parseUpdateKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.UPDATE; // depends on control dependency: [if], data = [none]
} else if (wordLength == 6 && parseDeleteKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.DELETE; // depends on control dependency: [if], data = [none]
} else if (wordLength == 4 && parseMoveKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.MOVE; // depends on control dependency: [if], data = [none]
} else if (wordLength == 6 && parseSelectKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.SELECT; // depends on control dependency: [if], data = [none]
} else if (wordLength == 4 && parseWithKeyword(aChars, keywordStart)) {
currentCommandType = SqlCommandType.WITH; // depends on control dependency: [if], data = [none]
} else if (wordLength == 6 && parseInsertKeyword(aChars, keywordStart)) {
if (!isInsertPresent && (nativeQueries == null || nativeQueries.isEmpty())) {
// Only allow rewrite for insert command starting with the insert keyword.
// Else, too many risks of wrong interpretation.
isCurrentReWriteCompatible = keyWordCount == 0; // depends on control dependency: [if], data = [none]
isInsertPresent = true; // depends on control dependency: [if], data = [none]
currentCommandType = SqlCommandType.INSERT; // depends on control dependency: [if], data = [none]
} else {
isCurrentReWriteCompatible = false; // depends on control dependency: [if], data = [none]
}
}
} else if (currentCommandType == SqlCommandType.WITH
&& inParen == 0) {
SqlCommandType command = parseWithCommandType(aChars, i, keywordStart, wordLength);
if (command != null) {
currentCommandType = command; // depends on control dependency: [if], data = [none]
}
}
if (inParen != 0 || aChar == ')') {
// RETURNING and VALUES cannot be present in braces
} else if (wordLength == 9 && parseReturningKeyword(aChars, keywordStart)) {
isReturningPresent = true; // depends on control dependency: [if], data = [none]
} else if (wordLength == 6 && parseValuesKeyword(aChars, keywordStart)) {
isValuesFound = true; // depends on control dependency: [if], data = [none]
}
keywordStart = -1; // depends on control dependency: [if], data = [none]
keyWordCount++; // depends on control dependency: [if], data = [none]
}
if (aChar == '(') {
inParen++; // depends on control dependency: [if], data = [none]
if (inParen == 1 && isValuesFound && valuesBraceOpenPosition == -1) {
valuesBraceOpenPosition = nativeSql.length() + i - fragmentStart; // depends on control dependency: [if], data = [none]
}
}
}
if (!isValuesFound || !isCurrentReWriteCompatible || valuesBraceClosePosition == -1
|| (bindPositions != null
&& valuesBraceClosePosition < bindPositions.get(bindPositions.size() - 1))) {
valuesBraceOpenPosition = -1; // depends on control dependency: [if], data = [none]
valuesBraceClosePosition = -1; // depends on control dependency: [if], data = [none]
}
if (fragmentStart < aChars.length && !whitespaceOnly) {
nativeSql.append(aChars, fragmentStart, aChars.length - fragmentStart); // depends on control dependency: [if], data = [none]
} else {
if (numberOfStatements > 1) {
isReturningPresent = false; // depends on control dependency: [if], data = [none]
currentCommandType = SqlCommandType.BLANK; // depends on control dependency: [if], data = [none]
} else if (numberOfStatements == 1) {
isReturningPresent = isReturningPresentPrev; // depends on control dependency: [if], data = [none]
currentCommandType = prevCommandType; // depends on control dependency: [if], data = [none]
}
}
if (nativeSql.length() == 0) {
return nativeQueries != null ? nativeQueries : Collections.<NativeQuery>emptyList(); // depends on control dependency: [if], data = [none]
}
if (addReturning(nativeSql, currentCommandType, returningColumnNames, isReturningPresent)) {
isReturningPresent = true; // depends on control dependency: [if], data = [none]
}
NativeQuery lastQuery = new NativeQuery(nativeSql.toString(),
toIntArray(bindPositions), !splitStatements,
SqlCommand.createStatementTypeInfo(currentCommandType,
isBatchedReWriteConfigured, valuesBraceOpenPosition, valuesBraceClosePosition,
isReturningPresent, (nativeQueries == null ? 0 : nativeQueries.size())));
if (nativeQueries == null) {
return Collections.singletonList(lastQuery); // depends on control dependency: [if], data = [none]
}
if (!whitespaceOnly) {
nativeQueries.add(lastQuery); // depends on control dependency: [if], data = [none]
}
return nativeQueries;
} } |
public class class_name {
public static TaskQueueStatistics fromJson(final String json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, TaskQueueStatistics.class);
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) {
throw new ApiConnectionException(e.getMessage(), e);
}
} } | public class class_name {
public static TaskQueueStatistics fromJson(final String json, final ObjectMapper objectMapper) {
// Convert all checked exceptions to Runtime
try {
return objectMapper.readValue(json, TaskQueueStatistics.class); // depends on control dependency: [try], data = [none]
} catch (final JsonMappingException | JsonParseException e) {
throw new ApiException(e.getMessage(), e);
} catch (final IOException e) { // depends on control dependency: [catch], data = [none]
throw new ApiConnectionException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private InputStream getStream(List<FileItem> items) throws IOException {
for (FileItem i : items) {
if (!i.isFormField() && i.getFieldName().equals(CONTENT_PARAMETER)) {
return i.getInputStream();
}
}
return null;
} } | public class class_name {
private InputStream getStream(List<FileItem> items) throws IOException {
for (FileItem i : items) {
if (!i.isFormField() && i.getFieldName().equals(CONTENT_PARAMETER)) {
return i.getInputStream(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private int toInt(InetAddress inetAddress) {
byte[] address = inetAddress.getAddress();
int result = 0;
for (int i = 0; i < address.length; i++) {
result <<= 8;
result |= address[i] & BYTE_MASK;
}
return result;
} } | public class class_name {
private int toInt(InetAddress inetAddress) {
byte[] address = inetAddress.getAddress();
int result = 0;
for (int i = 0; i < address.length; i++) {
result <<= 8; // depends on control dependency: [for], data = [none]
result |= address[i] & BYTE_MASK; // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public void sendMessageToAllNeighbors(Message m) {
if (edgesUsed) {
throw new IllegalStateException("Can use either 'getEdges()' or 'sendMessageToAllNeighbors()'"
+ "exactly once.");
}
edgesUsed = true;
outValue.f1 = m;
while (edges.hasNext()) {
Tuple next = (Tuple) edges.next();
/*
* When EdgeDirection is OUT, the edges iterator only has the out-edges
* of the vertex, i.e. the ones where this vertex is src.
* next.getField(1) gives the neighbor of the vertex running this ScatterFunction.
*/
if (getDirection().equals(EdgeDirection.OUT)) {
outValue.f0 = next.getField(1);
}
/*
* When EdgeDirection is IN, the edges iterator only has the in-edges
* of the vertex, i.e. the ones where this vertex is trg.
* next.getField(10) gives the neighbor of the vertex running this ScatterFunction.
*/
else if (getDirection().equals(EdgeDirection.IN)) {
outValue.f0 = next.getField(0);
}
// When EdgeDirection is ALL, the edges iterator contains both in- and out- edges
if (getDirection().equals(EdgeDirection.ALL)) {
if (next.getField(0).equals(vertexId)) {
// send msg to the trg
outValue.f0 = next.getField(1);
}
else {
// send msg to the src
outValue.f0 = next.getField(0);
}
}
out.collect(outValue);
}
} } | public class class_name {
public void sendMessageToAllNeighbors(Message m) {
if (edgesUsed) {
throw new IllegalStateException("Can use either 'getEdges()' or 'sendMessageToAllNeighbors()'"
+ "exactly once.");
}
edgesUsed = true;
outValue.f1 = m;
while (edges.hasNext()) {
Tuple next = (Tuple) edges.next();
/*
* When EdgeDirection is OUT, the edges iterator only has the out-edges
* of the vertex, i.e. the ones where this vertex is src.
* next.getField(1) gives the neighbor of the vertex running this ScatterFunction.
*/
if (getDirection().equals(EdgeDirection.OUT)) {
outValue.f0 = next.getField(1); // depends on control dependency: [if], data = [none]
}
/*
* When EdgeDirection is IN, the edges iterator only has the in-edges
* of the vertex, i.e. the ones where this vertex is trg.
* next.getField(10) gives the neighbor of the vertex running this ScatterFunction.
*/
else if (getDirection().equals(EdgeDirection.IN)) {
outValue.f0 = next.getField(0); // depends on control dependency: [if], data = [none]
}
// When EdgeDirection is ALL, the edges iterator contains both in- and out- edges
if (getDirection().equals(EdgeDirection.ALL)) {
if (next.getField(0).equals(vertexId)) {
// send msg to the trg
outValue.f0 = next.getField(1); // depends on control dependency: [if], data = [none]
}
else {
// send msg to the src
outValue.f0 = next.getField(0); // depends on control dependency: [if], data = [none]
}
}
out.collect(outValue); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public static List<DockerImage> getDockerImagesFromAgents(final int buildInfoId, TaskListener listener) throws IOException, InterruptedException {
List<DockerImage> dockerImages = new ArrayList<DockerImage>();
// Collect images from the master:
dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));
// Collect images from all the agents:
List<Node> nodes = Jenkins.getInstance().getNodes();
for (Node node : nodes) {
if (node == null || node.getChannel() == null) {
continue;
}
try {
List<DockerImage> partialDockerImages = node.getChannel().call(new MasterToSlaveCallable<List<DockerImage>, IOException>() {
public List<DockerImage> call() throws IOException {
List<DockerImage> dockerImages = new ArrayList<DockerImage>();
dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));
return dockerImages;
}
});
dockerImages.addAll(partialDockerImages);
} catch (Exception e) {
listener.getLogger().println("Could not collect docker images from Jenkins node '" + node.getDisplayName() + "' due to: " + e.getMessage());
}
}
return dockerImages;
} } | public class class_name {
public static List<DockerImage> getDockerImagesFromAgents(final int buildInfoId, TaskListener listener) throws IOException, InterruptedException {
List<DockerImage> dockerImages = new ArrayList<DockerImage>();
// Collect images from the master:
dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));
// Collect images from all the agents:
List<Node> nodes = Jenkins.getInstance().getNodes();
for (Node node : nodes) {
if (node == null || node.getChannel() == null) {
continue;
}
try {
List<DockerImage> partialDockerImages = node.getChannel().call(new MasterToSlaveCallable<List<DockerImage>, IOException>() {
public List<DockerImage> call() throws IOException {
List<DockerImage> dockerImages = new ArrayList<DockerImage>();
dockerImages.addAll(getAndDiscardImagesByBuildId(buildInfoId));
return dockerImages;
}
});
dockerImages.addAll(partialDockerImages); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
listener.getLogger().println("Could not collect docker images from Jenkins node '" + node.getDisplayName() + "' due to: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
return dockerImages;
} } |
public class class_name {
public static String canonicalize(String str) {
if (str == null) return null;
int length = str.length();
char ch;
StringBuffer buf = new StringBuffer(length);
for (int i=0;i<length;i++) {
ch = str.charAt(i);
if (ch == '_') continue;
buf.append( Character.toLowerCase(ch) );
}
return buf.toString();
} } | public class class_name {
public static String canonicalize(String str) {
if (str == null) return null;
int length = str.length();
char ch;
StringBuffer buf = new StringBuffer(length);
for (int i=0;i<length;i++) {
ch = str.charAt(i); // depends on control dependency: [for], data = [i]
if (ch == '_') continue;
buf.append( Character.toLowerCase(ch) ); // depends on control dependency: [for], data = [none]
}
return buf.toString();
} } |
public class class_name {
public java.util.List<ElasticGpuSpecification> getElasticGpuSpecification() {
if (elasticGpuSpecification == null) {
elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>();
}
return elasticGpuSpecification;
} } | public class class_name {
public java.util.List<ElasticGpuSpecification> getElasticGpuSpecification() {
if (elasticGpuSpecification == null) {
elasticGpuSpecification = new com.amazonaws.internal.SdkInternalList<ElasticGpuSpecification>(); // depends on control dependency: [if], data = [none]
}
return elasticGpuSpecification;
} } |
public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
boolean bFlag = false;
if (strCommand.equalsIgnoreCase(ThinMenuConstants.UNDO))
{ // Special - handle undo
if (m_sfTarget != null)
if (m_sfTarget.getScreenFieldView().getControl() != null)
if (m_sfTarget.getScreenFieldView().hasFocus())
{
if (m_objUndo == m_sfTarget)
{
m_sfTarget.fieldToControl(); // Restore original data
}
else
{
BaseField field = (BaseField)m_sfTarget.getConverter().getField();
if (field != null)
field.setData(m_objUndo);
}
bFlag = true; // Command handled
}
}
//xif (bFlag == false) The AppletScreen doesn't processes any commands (child screens will)
//x bFlag = super.doCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent
if (this.getScreenFieldView() != null)
return this.getScreenFieldView().doCommand(strCommand); // Instead I do this
return bFlag;
} } | public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
boolean bFlag = false;
if (strCommand.equalsIgnoreCase(ThinMenuConstants.UNDO))
{ // Special - handle undo
if (m_sfTarget != null)
if (m_sfTarget.getScreenFieldView().getControl() != null)
if (m_sfTarget.getScreenFieldView().hasFocus())
{
if (m_objUndo == m_sfTarget)
{
m_sfTarget.fieldToControl(); // Restore original data // depends on control dependency: [if], data = [none]
}
else
{
BaseField field = (BaseField)m_sfTarget.getConverter().getField();
if (field != null)
field.setData(m_objUndo);
}
bFlag = true; // Command handled // depends on control dependency: [if], data = [none]
}
}
//xif (bFlag == false) The AppletScreen doesn't processes any commands (child screens will)
//x bFlag = super.doCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent
if (this.getScreenFieldView() != null)
return this.getScreenFieldView().doCommand(strCommand); // Instead I do this
return bFlag;
} } |
public class class_name {
private static byte[] decodeHexStringToBytes(int index, int len, ByteBuf buff) {
len = len >> 1;
byte[] bytes = new byte[len];
for (int i = 0;i < len;i++) {
byte b0 = decodeHexChar(buff.getByte(index++));
byte b1 = decodeHexChar(buff.getByte(index++));
bytes[i] = (byte)(b0 * 16 + b1);
}
return bytes;
} } | public class class_name {
private static byte[] decodeHexStringToBytes(int index, int len, ByteBuf buff) {
len = len >> 1;
byte[] bytes = new byte[len];
for (int i = 0;i < len;i++) {
byte b0 = decodeHexChar(buff.getByte(index++));
byte b1 = decodeHexChar(buff.getByte(index++));
bytes[i] = (byte)(b0 * 16 + b1); // depends on control dependency: [for], data = [i]
}
return bytes;
} } |
public class class_name {
private static SoyMsgSelectPart buildMsgPartForSelect(
MsgSelectNode msgSelectNode, MsgNode msgNode) {
// This is the list of the cases.
ImmutableList.Builder<SoyMsgPart.Case<String>> selectCases = ImmutableList.builder();
for (CaseOrDefaultNode child : msgSelectNode.getChildren()) {
ImmutableList<SoyMsgPart> caseMsgParts =
buildMsgPartsForChildren((MsgBlockNode) child, msgNode);
String caseValue;
if (child instanceof MsgSelectCaseNode) {
caseValue = ((MsgSelectCaseNode) child).getCaseValue();
} else if (child instanceof MsgSelectDefaultNode) {
caseValue = null;
} else {
throw new AssertionError("Unidentified node under a select node.");
}
selectCases.add(SoyMsgPart.Case.create(caseValue, caseMsgParts));
}
return new SoyMsgSelectPart(msgNode.getSelectVarName(msgSelectNode), selectCases.build());
} } | public class class_name {
private static SoyMsgSelectPart buildMsgPartForSelect(
MsgSelectNode msgSelectNode, MsgNode msgNode) {
// This is the list of the cases.
ImmutableList.Builder<SoyMsgPart.Case<String>> selectCases = ImmutableList.builder();
for (CaseOrDefaultNode child : msgSelectNode.getChildren()) {
ImmutableList<SoyMsgPart> caseMsgParts =
buildMsgPartsForChildren((MsgBlockNode) child, msgNode);
String caseValue;
if (child instanceof MsgSelectCaseNode) {
caseValue = ((MsgSelectCaseNode) child).getCaseValue(); // depends on control dependency: [if], data = [none]
} else if (child instanceof MsgSelectDefaultNode) {
caseValue = null; // depends on control dependency: [if], data = [none]
} else {
throw new AssertionError("Unidentified node under a select node.");
}
selectCases.add(SoyMsgPart.Case.create(caseValue, caseMsgParts)); // depends on control dependency: [for], data = [none]
}
return new SoyMsgSelectPart(msgNode.getSelectVarName(msgSelectNode), selectCases.build());
} } |
public class class_name {
public InternalTenantContext createInternalTenantContext(final Long tenantRecordId, @Nullable final Long accountRecordId) {
populateMDCContext(null, accountRecordId, tenantRecordId);
if (accountRecordId == null) {
return new InternalTenantContext(tenantRecordId);
} else {
final ImmutableAccountData immutableAccountData = getImmutableAccountData(accountRecordId, tenantRecordId);
final DateTimeZone fixedOffsetTimeZone = immutableAccountData.getFixedOffsetTimeZone();
final DateTime referenceTime = immutableAccountData.getReferenceTime();
return new InternalTenantContext(tenantRecordId, accountRecordId, fixedOffsetTimeZone, referenceTime);
}
} } | public class class_name {
public InternalTenantContext createInternalTenantContext(final Long tenantRecordId, @Nullable final Long accountRecordId) {
populateMDCContext(null, accountRecordId, tenantRecordId);
if (accountRecordId == null) {
return new InternalTenantContext(tenantRecordId); // depends on control dependency: [if], data = [none]
} else {
final ImmutableAccountData immutableAccountData = getImmutableAccountData(accountRecordId, tenantRecordId);
final DateTimeZone fixedOffsetTimeZone = immutableAccountData.getFixedOffsetTimeZone();
final DateTime referenceTime = immutableAccountData.getReferenceTime();
return new InternalTenantContext(tenantRecordId, accountRecordId, fixedOffsetTimeZone, referenceTime); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setRGBA(int x, int y, int r, int g, int b, int a) {
if ((x < 0) || (x >= width) || (y < 0) || (y >= height)) {
throw new RuntimeException("Specified location: "+x+","+y+" outside of image");
}
int ofs = ((x + (y * texWidth)) * 4);
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
rawData[ofs] = (byte) b;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) r;
rawData[ofs + 3] = (byte) a;
} else {
rawData[ofs] = (byte) r;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) b;
rawData[ofs + 3] = (byte) a;
}
} } | public class class_name {
public void setRGBA(int x, int y, int r, int g, int b, int a) {
if ((x < 0) || (x >= width) || (y < 0) || (y >= height)) {
throw new RuntimeException("Specified location: "+x+","+y+" outside of image");
}
int ofs = ((x + (y * texWidth)) * 4);
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
rawData[ofs] = (byte) b;
// depends on control dependency: [if], data = [none]
rawData[ofs + 1] = (byte) g;
// depends on control dependency: [if], data = [none]
rawData[ofs + 2] = (byte) r;
// depends on control dependency: [if], data = [none]
rawData[ofs + 3] = (byte) a;
// depends on control dependency: [if], data = [none]
} else {
rawData[ofs] = (byte) r;
// depends on control dependency: [if], data = [none]
rawData[ofs + 1] = (byte) g;
// depends on control dependency: [if], data = [none]
rawData[ofs + 2] = (byte) b;
// depends on control dependency: [if], data = [none]
rawData[ofs + 3] = (byte) a;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public R get(final I key) {
final P params = getParam(key);
final String paramsKey = params.getKey();
// Retrieve the resource weak reference from the map
final SoftReference<R> resourceSoftRef = this.resourceMap.get(paramsKey);
// Warning the gc can collect gthe resource between the test and the getter call so we have to get the resource immediately
// and test it instead of testing the reference value
// The resourceSoftRef may be null if nobody use it
// If the resource reference is not null try to grab its value
R resource = resourceSoftRef == null ? null : resourceSoftRef.get();
// When the reference is null (first access time) or the resource is null (the resource has been collected y gc)
if (resourceSoftRef == null || resource == null) {
// We must (re)build an instance and then store it weakly
resource = buildResource(key, params);
set(paramsKey, resource);
params.hasChanged(false);
}
return resource;
} } | public class class_name {
@Override
public R get(final I key) {
final P params = getParam(key);
final String paramsKey = params.getKey();
// Retrieve the resource weak reference from the map
final SoftReference<R> resourceSoftRef = this.resourceMap.get(paramsKey);
// Warning the gc can collect gthe resource between the test and the getter call so we have to get the resource immediately
// and test it instead of testing the reference value
// The resourceSoftRef may be null if nobody use it
// If the resource reference is not null try to grab its value
R resource = resourceSoftRef == null ? null : resourceSoftRef.get();
// When the reference is null (first access time) or the resource is null (the resource has been collected y gc)
if (resourceSoftRef == null || resource == null) {
// We must (re)build an instance and then store it weakly
resource = buildResource(key, params); // depends on control dependency: [if], data = [none]
set(paramsKey, resource); // depends on control dependency: [if], data = [none]
params.hasChanged(false); // depends on control dependency: [if], data = [none]
}
return resource;
} } |
public class class_name {
static void applyRules(Configuration configuration, DisplayMetrics displayMetrics, int apiLevel) {
Locale locale = getLocale(configuration, apiLevel);
String language = locale == null ? "" : locale.getLanguage();
if (language.isEmpty()) {
language = "en";
String country = locale == null ? "" : locale.getCountry();
if (country.isEmpty()) {
country = "us";
}
locale = new Locale(language, country);
setLocale(apiLevel, configuration, locale);
}
if (apiLevel <= ConfigDescription.SDK_JELLY_BEAN &&
getScreenLayoutLayoutDir(configuration) == Configuration.SCREENLAYOUT_LAYOUTDIR_UNDEFINED) {
setScreenLayoutLayoutDir(configuration, Configuration.SCREENLAYOUT_LAYOUTDIR_LTR);
}
ScreenSize requestedScreenSize = getScreenSize(configuration);
if (requestedScreenSize == null) {
requestedScreenSize = DEFAULT_SCREEN_SIZE;
}
if (configuration.orientation == Configuration.ORIENTATION_UNDEFINED
&& configuration.screenWidthDp != 0 && configuration.screenHeightDp != 0) {
configuration.orientation = (configuration.screenWidthDp > configuration.screenHeightDp)
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT;
}
if (configuration.screenWidthDp == 0) {
configuration.screenWidthDp = requestedScreenSize.width;
}
if (configuration.screenHeightDp == 0) {
configuration.screenHeightDp = requestedScreenSize.height;
if ((configuration.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK)
== Configuration.SCREENLAYOUT_LONG_YES) {
configuration.screenHeightDp = (int) (configuration.screenHeightDp * 1.25f);
}
}
int lesserDimenPx = Math.min(configuration.screenWidthDp, configuration.screenHeightDp);
int greaterDimenPx = Math.max(configuration.screenWidthDp, configuration.screenHeightDp);
if (configuration.smallestScreenWidthDp == 0) {
configuration.smallestScreenWidthDp = lesserDimenPx;
}
if (getScreenLayoutSize(configuration) == Configuration.SCREENLAYOUT_SIZE_UNDEFINED) {
ScreenSize screenSize =
ScreenSize.match(configuration.screenWidthDp, configuration.screenHeightDp);
setScreenLayoutSize(configuration, screenSize.configValue);
}
if (getScreenLayoutLong(configuration) == Configuration.SCREENLAYOUT_LONG_UNDEFINED) {
setScreenLayoutLong(configuration,
((float) greaterDimenPx) / lesserDimenPx >= 1.75
? Configuration.SCREENLAYOUT_LONG_YES
: Configuration.SCREENLAYOUT_LONG_NO);
}
if (getScreenLayoutRound(configuration) == Configuration.SCREENLAYOUT_ROUND_UNDEFINED) {
setScreenLayoutRound(configuration, Configuration.SCREENLAYOUT_ROUND_NO);
}
if (configuration.orientation == Configuration.ORIENTATION_UNDEFINED) {
configuration.orientation = configuration.screenWidthDp > configuration.screenHeightDp
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT;
} else if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT
&& configuration.screenWidthDp > configuration.screenHeightDp) {
swapXY(configuration);
} else if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
&& configuration.screenWidthDp < configuration.screenHeightDp) {
swapXY(configuration);
}
if (getUiModeType(configuration) == Configuration.UI_MODE_TYPE_UNDEFINED) {
setUiModeType(configuration, Configuration.UI_MODE_TYPE_NORMAL);
}
if (getUiModeNight(configuration) == Configuration.UI_MODE_NIGHT_UNDEFINED) {
setUiModeNight(configuration, Configuration.UI_MODE_NIGHT_NO);
}
switch (displayMetrics.densityDpi) {
case ResTable_config.DENSITY_DPI_ANY:
throw new IllegalArgumentException("'anydpi' isn't actually a dpi");
case ResTable_config.DENSITY_DPI_NONE:
throw new IllegalArgumentException("'nodpi' isn't actually a dpi");
case ResTable_config.DENSITY_DPI_UNDEFINED:
// DisplayMetrics.DENSITY_DEFAULT is mdpi
setDensity(DEFAULT_DENSITY, apiLevel, configuration, displayMetrics);
}
if (configuration.touchscreen == Configuration.TOUCHSCREEN_UNDEFINED) {
configuration.touchscreen = Configuration.TOUCHSCREEN_FINGER;
}
if (configuration.keyboardHidden == Configuration.KEYBOARDHIDDEN_UNDEFINED) {
configuration.keyboardHidden = Configuration.KEYBOARDHIDDEN_SOFT;
}
if (configuration.keyboard == Configuration.KEYBOARD_UNDEFINED) {
configuration.keyboard = Configuration.KEYBOARD_NOKEYS;
}
if (configuration.navigationHidden == Configuration.NAVIGATIONHIDDEN_UNDEFINED) {
configuration.navigationHidden = Configuration.NAVIGATIONHIDDEN_YES;
}
if (configuration.navigation == Configuration.NAVIGATION_UNDEFINED) {
configuration.navigation = Configuration.NAVIGATION_NONAV;
}
if (apiLevel >= VERSION_CODES.O) {
if (getColorModeGamut(configuration) == Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED) {
setColorModeGamut(configuration, Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_NO);
}
if (getColorModeHdr(configuration) == Configuration.COLOR_MODE_HDR_UNDEFINED) {
setColorModeHdr(configuration, Configuration.COLOR_MODE_HDR_NO);
}
}
} } | public class class_name {
static void applyRules(Configuration configuration, DisplayMetrics displayMetrics, int apiLevel) {
Locale locale = getLocale(configuration, apiLevel);
String language = locale == null ? "" : locale.getLanguage();
if (language.isEmpty()) {
language = "en"; // depends on control dependency: [if], data = [none]
String country = locale == null ? "" : locale.getCountry();
if (country.isEmpty()) {
country = "us"; // depends on control dependency: [if], data = [none]
}
locale = new Locale(language, country); // depends on control dependency: [if], data = [none]
setLocale(apiLevel, configuration, locale); // depends on control dependency: [if], data = [none]
}
if (apiLevel <= ConfigDescription.SDK_JELLY_BEAN &&
getScreenLayoutLayoutDir(configuration) == Configuration.SCREENLAYOUT_LAYOUTDIR_UNDEFINED) {
setScreenLayoutLayoutDir(configuration, Configuration.SCREENLAYOUT_LAYOUTDIR_LTR); // depends on control dependency: [if], data = [none]
}
ScreenSize requestedScreenSize = getScreenSize(configuration);
if (requestedScreenSize == null) {
requestedScreenSize = DEFAULT_SCREEN_SIZE; // depends on control dependency: [if], data = [none]
}
if (configuration.orientation == Configuration.ORIENTATION_UNDEFINED
&& configuration.screenWidthDp != 0 && configuration.screenHeightDp != 0) {
configuration.orientation = (configuration.screenWidthDp > configuration.screenHeightDp)
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT; // depends on control dependency: [if], data = [none]
}
if (configuration.screenWidthDp == 0) {
configuration.screenWidthDp = requestedScreenSize.width; // depends on control dependency: [if], data = [none]
}
if (configuration.screenHeightDp == 0) {
configuration.screenHeightDp = requestedScreenSize.height; // depends on control dependency: [if], data = [none]
if ((configuration.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK)
== Configuration.SCREENLAYOUT_LONG_YES) {
configuration.screenHeightDp = (int) (configuration.screenHeightDp * 1.25f); // depends on control dependency: [if], data = [none]
}
}
int lesserDimenPx = Math.min(configuration.screenWidthDp, configuration.screenHeightDp);
int greaterDimenPx = Math.max(configuration.screenWidthDp, configuration.screenHeightDp);
if (configuration.smallestScreenWidthDp == 0) {
configuration.smallestScreenWidthDp = lesserDimenPx; // depends on control dependency: [if], data = [none]
}
if (getScreenLayoutSize(configuration) == Configuration.SCREENLAYOUT_SIZE_UNDEFINED) {
ScreenSize screenSize =
ScreenSize.match(configuration.screenWidthDp, configuration.screenHeightDp);
setScreenLayoutSize(configuration, screenSize.configValue); // depends on control dependency: [if], data = [none]
}
if (getScreenLayoutLong(configuration) == Configuration.SCREENLAYOUT_LONG_UNDEFINED) {
setScreenLayoutLong(configuration,
((float) greaterDimenPx) / lesserDimenPx >= 1.75
? Configuration.SCREENLAYOUT_LONG_YES
: Configuration.SCREENLAYOUT_LONG_NO); // depends on control dependency: [if], data = [none]
}
if (getScreenLayoutRound(configuration) == Configuration.SCREENLAYOUT_ROUND_UNDEFINED) {
setScreenLayoutRound(configuration, Configuration.SCREENLAYOUT_ROUND_NO); // depends on control dependency: [if], data = [none]
}
if (configuration.orientation == Configuration.ORIENTATION_UNDEFINED) {
configuration.orientation = configuration.screenWidthDp > configuration.screenHeightDp
? Configuration.ORIENTATION_LANDSCAPE
: Configuration.ORIENTATION_PORTRAIT; // depends on control dependency: [if], data = [none]
} else if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT
&& configuration.screenWidthDp > configuration.screenHeightDp) {
swapXY(configuration); // depends on control dependency: [if], data = [none]
} else if (configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
&& configuration.screenWidthDp < configuration.screenHeightDp) {
swapXY(configuration); // depends on control dependency: [if], data = [none]
}
if (getUiModeType(configuration) == Configuration.UI_MODE_TYPE_UNDEFINED) {
setUiModeType(configuration, Configuration.UI_MODE_TYPE_NORMAL); // depends on control dependency: [if], data = [none]
}
if (getUiModeNight(configuration) == Configuration.UI_MODE_NIGHT_UNDEFINED) {
setUiModeNight(configuration, Configuration.UI_MODE_NIGHT_NO); // depends on control dependency: [if], data = [none]
}
switch (displayMetrics.densityDpi) {
case ResTable_config.DENSITY_DPI_ANY:
throw new IllegalArgumentException("'anydpi' isn't actually a dpi");
case ResTable_config.DENSITY_DPI_NONE:
throw new IllegalArgumentException("'nodpi' isn't actually a dpi");
case ResTable_config.DENSITY_DPI_UNDEFINED:
// DisplayMetrics.DENSITY_DEFAULT is mdpi
setDensity(DEFAULT_DENSITY, apiLevel, configuration, displayMetrics);
}
if (configuration.touchscreen == Configuration.TOUCHSCREEN_UNDEFINED) {
configuration.touchscreen = Configuration.TOUCHSCREEN_FINGER; // depends on control dependency: [if], data = [none]
}
if (configuration.keyboardHidden == Configuration.KEYBOARDHIDDEN_UNDEFINED) {
configuration.keyboardHidden = Configuration.KEYBOARDHIDDEN_SOFT; // depends on control dependency: [if], data = [none]
}
if (configuration.keyboard == Configuration.KEYBOARD_UNDEFINED) {
configuration.keyboard = Configuration.KEYBOARD_NOKEYS; // depends on control dependency: [if], data = [none]
}
if (configuration.navigationHidden == Configuration.NAVIGATIONHIDDEN_UNDEFINED) {
configuration.navigationHidden = Configuration.NAVIGATIONHIDDEN_YES; // depends on control dependency: [if], data = [none]
}
if (configuration.navigation == Configuration.NAVIGATION_UNDEFINED) {
configuration.navigation = Configuration.NAVIGATION_NONAV; // depends on control dependency: [if], data = [none]
}
if (apiLevel >= VERSION_CODES.O) {
if (getColorModeGamut(configuration) == Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED) {
setColorModeGamut(configuration, Configuration.COLOR_MODE_WIDE_COLOR_GAMUT_NO); // depends on control dependency: [if], data = [none]
}
if (getColorModeHdr(configuration) == Configuration.COLOR_MODE_HDR_UNDEFINED) {
setColorModeHdr(configuration, Configuration.COLOR_MODE_HDR_NO); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public BodyTypeAwareRenderer getBodyTypeAwareRenderer() {
if (bodyTypeAwareRenderer != null) {
return bodyTypeAwareRenderer;
}
bodyTypeAwareRenderer = new BodyTypeAwareRenderer(getViewRenderer(), getWikiStyleRenderer());
return bodyTypeAwareRenderer;
} } | public class class_name {
public BodyTypeAwareRenderer getBodyTypeAwareRenderer() {
if (bodyTypeAwareRenderer != null) {
return bodyTypeAwareRenderer; // depends on control dependency: [if], data = [none]
}
bodyTypeAwareRenderer = new BodyTypeAwareRenderer(getViewRenderer(), getWikiStyleRenderer());
return bodyTypeAwareRenderer;
} } |
public class class_name {
public EClass getFontDescriptorSpecification() {
if (fontDescriptorSpecificationEClass == null) {
fontDescriptorSpecificationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(378);
}
return fontDescriptorSpecificationEClass;
} } | public class class_name {
public EClass getFontDescriptorSpecification() {
if (fontDescriptorSpecificationEClass == null) {
fontDescriptorSpecificationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(378); // depends on control dependency: [if], data = [none]
}
return fontDescriptorSpecificationEClass;
} } |
public class class_name {
int get(int rowSize) {
if (lookup.size() == 0) {
return -1;
}
int index = lookup.findFirstGreaterEqualKeyIndex(rowSize);
if (index == -1) {
return -1;
}
// statistics for successful requests only - to be used later for midSize
requestCount++;
requestSize += rowSize;
int length = lookup.getValue(index);
int difference = length - rowSize;
int key = lookup.getKey(index);
lookup.remove(index);
if (difference >= midSize) {
int pos = key + (rowSize / scale);
lookup.add(pos, difference);
} else {
lostFreeBlockSize += difference;
}
return key;
} } | public class class_name {
int get(int rowSize) {
if (lookup.size() == 0) {
return -1; // depends on control dependency: [if], data = [none]
}
int index = lookup.findFirstGreaterEqualKeyIndex(rowSize);
if (index == -1) {
return -1; // depends on control dependency: [if], data = [none]
}
// statistics for successful requests only - to be used later for midSize
requestCount++;
requestSize += rowSize;
int length = lookup.getValue(index);
int difference = length - rowSize;
int key = lookup.getKey(index);
lookup.remove(index);
if (difference >= midSize) {
int pos = key + (rowSize / scale);
lookup.add(pos, difference); // depends on control dependency: [if], data = [none]
} else {
lostFreeBlockSize += difference; // depends on control dependency: [if], data = [none]
}
return key;
} } |
public class class_name {
public void put(String key, T token) {
purge();
if (map.containsKey(key)) {
map.remove(key);
}
final long time = System.currentTimeMillis();
map.put(key, new Value(token, time + expireMillis));
latestWriteTime = time;
} } | public class class_name {
public void put(String key, T token) {
purge();
if (map.containsKey(key)) {
map.remove(key); // depends on control dependency: [if], data = [none]
}
final long time = System.currentTimeMillis();
map.put(key, new Value(token, time + expireMillis));
latestWriteTime = time;
} } |
public class class_name {
public void send(String uri, String data) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = getConnections(uri);
if (uriConnections != null) {
uriConnections.stream()
.filter(ServerSentEventConnection::isOpen)
.forEach((ServerSentEventConnection connection) -> connection.send(data));
}
} } | public class class_name {
public void send(String uri, String data) {
Objects.requireNonNull(uri, Required.URI.toString());
final Set<ServerSentEventConnection> uriConnections = getConnections(uri);
if (uriConnections != null) {
uriConnections.stream()
.filter(ServerSentEventConnection::isOpen)
.forEach((ServerSentEventConnection connection) -> connection.send(data)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(MFAOptionType mFAOptionType, ProtocolMarshaller protocolMarshaller) {
if (mFAOptionType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mFAOptionType.getDeliveryMedium(), DELIVERYMEDIUM_BINDING);
protocolMarshaller.marshall(mFAOptionType.getAttributeName(), ATTRIBUTENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(MFAOptionType mFAOptionType, ProtocolMarshaller protocolMarshaller) {
if (mFAOptionType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(mFAOptionType.getDeliveryMedium(), DELIVERYMEDIUM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(mFAOptionType.getAttributeName(), ATTRIBUTENAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Artifact<?> emitLandingPageCacheManifest(LinkerContext context, TreeLogger logger,
ArtifactSet artifacts, String[] staticFiles) throws UnableToCompleteException {
// Create a string of cacheable resources
StringBuilder publicSourcesSb = new StringBuilder();
StringBuilder publicStaticSourcesSb = new StringBuilder();
// Iterate over all emitted artifacts, and collect all cacheable artifacts
for (@SuppressWarnings("rawtypes")
Artifact artifact : artifacts) {
if (artifact instanceof EmittedArtifact) {
EmittedArtifact ea = (EmittedArtifact) artifact;
String path = "/" + context.getModuleFunctionName() + "/" + ea.getPartialPath();
if (accept(path)) {
publicSourcesSb.append(path + "\n");
}
}
}
// Iterate over all static files
if (staticFiles != null) {
for (String staticFile : staticFiles) {
if (accept(staticFile)) {
publicStaticSourcesSb.append(staticFile + "\n");
}
}
}
// build cache list
StringBuilder sb = new StringBuilder();
sb.append("CACHE MANIFEST\n");
sb.append("# Unique id #" + (new Date()).getTime() + "." + Math.random() + "\n");
// we have to generate this unique id because the resources can change but
// the hashed cache.html files can remain the same.
sb.append("# Note: must change this every time for cache to invalidate\n");
sb.append("\n");
sb.append("CACHE:\n");
sb.append(publicSourcesSb.toString());
sb.append("# Static cached files\n");
sb.append(publicStaticSourcesSb.toString());
sb.append("\n\n");
sb.append("# All other resources require the user to be online.\n");
sb.append("NETWORK:\n");
sb.append("*\n");
logger.log(TreeLogger.DEBUG, "Make sure you have the following"
+ " attribute added to your landing page's <html> tag: <html manifest=\""
+ context.getModuleFunctionName() + "/" + MANIFEST + "\">");
// Create the manifest as a new artifact and return it:
return emitString(logger, sb.toString(), MANIFEST);
} } | public class class_name {
private Artifact<?> emitLandingPageCacheManifest(LinkerContext context, TreeLogger logger,
ArtifactSet artifacts, String[] staticFiles) throws UnableToCompleteException {
// Create a string of cacheable resources
StringBuilder publicSourcesSb = new StringBuilder();
StringBuilder publicStaticSourcesSb = new StringBuilder();
// Iterate over all emitted artifacts, and collect all cacheable artifacts
for (@SuppressWarnings("rawtypes")
Artifact artifact : artifacts) {
if (artifact instanceof EmittedArtifact) {
EmittedArtifact ea = (EmittedArtifact) artifact;
String path = "/" + context.getModuleFunctionName() + "/" + ea.getPartialPath();
if (accept(path)) {
publicSourcesSb.append(path + "\n"); // depends on control dependency: [if], data = [none]
}
}
}
// Iterate over all static files
if (staticFiles != null) {
for (String staticFile : staticFiles) {
if (accept(staticFile)) {
publicStaticSourcesSb.append(staticFile + "\n"); // depends on control dependency: [if], data = [none]
}
}
}
// build cache list
StringBuilder sb = new StringBuilder();
sb.append("CACHE MANIFEST\n");
sb.append("# Unique id #" + (new Date()).getTime() + "." + Math.random() + "\n");
// we have to generate this unique id because the resources can change but
// the hashed cache.html files can remain the same.
sb.append("# Note: must change this every time for cache to invalidate\n");
sb.append("\n");
sb.append("CACHE:\n");
sb.append(publicSourcesSb.toString());
sb.append("# Static cached files\n");
sb.append(publicStaticSourcesSb.toString());
sb.append("\n\n");
sb.append("# All other resources require the user to be online.\n");
sb.append("NETWORK:\n");
sb.append("*\n");
logger.log(TreeLogger.DEBUG, "Make sure you have the following"
+ " attribute added to your landing page's <html> tag: <html manifest=\""
+ context.getModuleFunctionName() + "/" + MANIFEST + "\">");
// Create the manifest as a new artifact and return it:
return emitString(logger, sb.toString(), MANIFEST);
} } |
public class class_name {
public static NeuralNetConfiguration fromJson(String json) {
ObjectMapper mapper = mapper();
try {
NeuralNetConfiguration ret = mapper.readValue(json, NeuralNetConfiguration.class);
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static NeuralNetConfiguration fromJson(String json) {
ObjectMapper mapper = mapper();
try {
NeuralNetConfiguration ret = mapper.readValue(json, NeuralNetConfiguration.class);
return ret; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static ZonedDateTime toZonedDateTime(final Calendar self) {
if (self instanceof GregorianCalendar) { // would this branch ever be true?
return ((GregorianCalendar) self).toZonedDateTime();
} else {
return ZonedDateTime.of(toLocalDateTime(self), getZoneId(self));
}
} } | public class class_name {
public static ZonedDateTime toZonedDateTime(final Calendar self) {
if (self instanceof GregorianCalendar) { // would this branch ever be true?
return ((GregorianCalendar) self).toZonedDateTime(); // depends on control dependency: [if], data = [none]
} else {
return ZonedDateTime.of(toLocalDateTime(self), getZoneId(self)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean initEventSource() {
boolean success = false;
try {
eventSource = ServerCache.cacheUnit.createEventSource(cacheConfig.useListenerContext, cacheName);
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.Cache.initEventSource", "3289", this);
}
if (eventSource != null) {
success = true;
}
return success;
} } | public class class_name {
private boolean initEventSource() {
boolean success = false;
try {
eventSource = ServerCache.cacheUnit.createEventSource(cacheConfig.useListenerContext, cacheName); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.Cache.initEventSource", "3289", this);
} // depends on control dependency: [catch], data = [none]
if (eventSource != null) {
success = true; // depends on control dependency: [if], data = [none]
}
return success;
} } |
public class class_name {
private void reopen(final ConnectionPoolConnection conn) {
if(isActive) {
if(conn.reopenAttempts == 0) {
conn.reopenAttempts++;
reopenService.execute(new Reopener(conn));
} else {
long delayMillis = 100L * conn.reopenAttempts;
if(delayMillis > maxReconnectDelayMillis) {
delayMillis = maxReconnectDelayMillis;
}
conn.reopenAttempts++;
reopenService.schedule(new Reopener(conn), delayMillis, TimeUnit.MILLISECONDS);
}
}
} } | public class class_name {
private void reopen(final ConnectionPoolConnection conn) {
if(isActive) {
if(conn.reopenAttempts == 0) {
conn.reopenAttempts++; // depends on control dependency: [if], data = [none]
reopenService.execute(new Reopener(conn)); // depends on control dependency: [if], data = [none]
} else {
long delayMillis = 100L * conn.reopenAttempts;
if(delayMillis > maxReconnectDelayMillis) {
delayMillis = maxReconnectDelayMillis; // depends on control dependency: [if], data = [none]
}
conn.reopenAttempts++; // depends on control dependency: [if], data = [none]
reopenService.schedule(new Reopener(conn), delayMillis, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static void addGroupByExpressionsToProjections(QueryPlanningInfo info) {
if (info.groupBy == null || info.groupBy.getItems() == null || info.groupBy.getItems().size() == 0) {
return;
}
OGroupBy newGroupBy = new OGroupBy(-1);
int i = 0;
for (OExpression exp : info.groupBy.getItems()) {
if (exp.isAggregate()) {
throw new OCommandExecutionException("Cannot group by an aggregate function");
}
boolean found = false;
if (info.preAggregateProjection != null) {
for (String alias : info.preAggregateProjection.getAllAliases()) {
//if it's a simple identifier and it's the same as one of the projections in the query,
//then the projection itself is used for GROUP BY without recalculating; in all the other cases, it is evaluated separately
if (alias.equals(exp.getDefaultAlias().getStringValue()) && exp.isBaseIdentifier()) {
found = true;
newGroupBy.getItems().add(exp);
break;
}
}
}
if (!found) {
OProjectionItem newItem = new OProjectionItem(-1);
newItem.setExpression(exp);
OIdentifier groupByAlias = new OIdentifier("_$$$GROUP_BY_ALIAS$$$_" + (i++));
newItem.setAlias(groupByAlias);
if (info.preAggregateProjection == null) {
info.preAggregateProjection = new OProjection(-1);
}
if (info.preAggregateProjection.getItems() == null) {
info.preAggregateProjection.setItems(new ArrayList<>());
}
info.preAggregateProjection.getItems().add(newItem);
newGroupBy.getItems().add(new OExpression(groupByAlias));
}
info.groupBy = newGroupBy;
}
} } | public class class_name {
private static void addGroupByExpressionsToProjections(QueryPlanningInfo info) {
if (info.groupBy == null || info.groupBy.getItems() == null || info.groupBy.getItems().size() == 0) {
return; // depends on control dependency: [if], data = [none]
}
OGroupBy newGroupBy = new OGroupBy(-1);
int i = 0;
for (OExpression exp : info.groupBy.getItems()) {
if (exp.isAggregate()) {
throw new OCommandExecutionException("Cannot group by an aggregate function");
}
boolean found = false;
if (info.preAggregateProjection != null) {
for (String alias : info.preAggregateProjection.getAllAliases()) {
//if it's a simple identifier and it's the same as one of the projections in the query,
//then the projection itself is used for GROUP BY without recalculating; in all the other cases, it is evaluated separately
if (alias.equals(exp.getDefaultAlias().getStringValue()) && exp.isBaseIdentifier()) {
found = true; // depends on control dependency: [if], data = [none]
newGroupBy.getItems().add(exp); // depends on control dependency: [if], data = [none]
break;
}
}
}
if (!found) {
OProjectionItem newItem = new OProjectionItem(-1);
newItem.setExpression(exp); // depends on control dependency: [if], data = [none]
OIdentifier groupByAlias = new OIdentifier("_$$$GROUP_BY_ALIAS$$$_" + (i++));
newItem.setAlias(groupByAlias); // depends on control dependency: [if], data = [none]
if (info.preAggregateProjection == null) {
info.preAggregateProjection = new OProjection(-1); // depends on control dependency: [if], data = [none]
}
if (info.preAggregateProjection.getItems() == null) {
info.preAggregateProjection.setItems(new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
info.preAggregateProjection.getItems().add(newItem); // depends on control dependency: [if], data = [none]
newGroupBy.getItems().add(new OExpression(groupByAlias)); // depends on control dependency: [if], data = [none]
}
info.groupBy = newGroupBy; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private static int searchForChunkContainingPos(final long[] arr, final long pos, final int l, final int r) {
// the following three asserts can probably go away eventually, since it is fairly clear
// that if these invariants hold at the beginning of the search, they will be maintained
assert l < r;
assert arr[l] <= pos;
assert pos < arr[r];
if (l + 1 == r) {
return l;
}
final int m = l + (r - l) / 2;
if (arr[m] <= pos) {
return searchForChunkContainingPos(arr, pos, m, r);
}
return searchForChunkContainingPos(arr, pos, l, m);
} } | public class class_name {
private static int searchForChunkContainingPos(final long[] arr, final long pos, final int l, final int r) {
// the following three asserts can probably go away eventually, since it is fairly clear
// that if these invariants hold at the beginning of the search, they will be maintained
assert l < r;
assert arr[l] <= pos;
assert pos < arr[r];
if (l + 1 == r) {
return l; // depends on control dependency: [if], data = [none]
}
final int m = l + (r - l) / 2;
if (arr[m] <= pos) {
return searchForChunkContainingPos(arr, pos, m, r); // depends on control dependency: [if], data = [none]
}
return searchForChunkContainingPos(arr, pos, l, m);
} } |
public class class_name {
public QueryStringBuilder getQueryParameters() {
QueryStringBuilder builder = new QueryStringBuilder();
if (this.isNullOrEmpty(this.query) && this.metadataFilter == null) {
throw new BoxAPIException(
"BoxSearchParameters requires either a search query or Metadata filter to be set."
);
}
//Set the query of the search
if (!this.isNullOrEmpty(this.query)) {
builder.appendParam("query", this.query);
}
//Set the scope of the search
if (!this.isNullOrEmpty(this.scope)) {
builder.appendParam("scope", this.scope);
}
//Acceptable Value: "jpg,png"
if (!this.isNullOrEmpty(this.fileExtensions)) {
builder.appendParam("file_extensions", this.listToCSV(this.fileExtensions));
}
//Created Date Range: From Date - To Date
if ((this.createdRange != null)) {
builder.appendParam("created_at_range", this.createdRange.buildRangeString());
}
//Updated Date Range: From Date - To Date
if ((this.updatedRange != null)) {
builder.appendParam("updated_at_range", this.updatedRange.buildRangeString());
}
//Filesize Range
if ((this.sizeRange != null)) {
builder.appendParam("size_range", this.sizeRange.buildRangeString());
}
//Owner Id's
if (!this.isNullOrEmpty(this.ownerUserIds)) {
builder.appendParam("owner_user_ids", this.listToCSV(this.ownerUserIds));
}
//Ancestor ID's
if (!this.isNullOrEmpty(this.ancestorFolderIds)) {
builder.appendParam("ancestor_folder_ids", this.listToCSV(this.ancestorFolderIds));
}
//Content Types: "name, description"
if (!this.isNullOrEmpty(this.contentTypes)) {
builder.appendParam("content_types", this.listToCSV(this.contentTypes));
}
//Type of File: "file,folder,web_link"
if (this.type != null) {
builder.appendParam("type", this.type);
}
//Trash Content
if (!this.isNullOrEmpty(this.trashContent)) {
builder.appendParam("trash_content", this.trashContent);
}
//Metadata filters
if (this.metadataFilter != null) {
builder.appendParam("mdfilters", this.formatBoxMetadataFilterRequest().toString());
}
//Fields
if (!this.isNullOrEmpty(this.fields)) {
builder.appendParam("fields", this.listToCSV(this.fields));
}
//Sort
if (!this.isNullOrEmpty(this.sort)) {
builder.appendParam("sort", this.sort);
}
//Direction
if (!this.isNullOrEmpty(this.direction)) {
builder.appendParam("direction", this.direction);
}
return builder;
} } | public class class_name {
public QueryStringBuilder getQueryParameters() {
QueryStringBuilder builder = new QueryStringBuilder();
if (this.isNullOrEmpty(this.query) && this.metadataFilter == null) {
throw new BoxAPIException(
"BoxSearchParameters requires either a search query or Metadata filter to be set."
);
}
//Set the query of the search
if (!this.isNullOrEmpty(this.query)) {
builder.appendParam("query", this.query); // depends on control dependency: [if], data = [none]
}
//Set the scope of the search
if (!this.isNullOrEmpty(this.scope)) {
builder.appendParam("scope", this.scope); // depends on control dependency: [if], data = [none]
}
//Acceptable Value: "jpg,png"
if (!this.isNullOrEmpty(this.fileExtensions)) {
builder.appendParam("file_extensions", this.listToCSV(this.fileExtensions)); // depends on control dependency: [if], data = [none]
}
//Created Date Range: From Date - To Date
if ((this.createdRange != null)) {
builder.appendParam("created_at_range", this.createdRange.buildRangeString()); // depends on control dependency: [if], data = [none]
}
//Updated Date Range: From Date - To Date
if ((this.updatedRange != null)) {
builder.appendParam("updated_at_range", this.updatedRange.buildRangeString()); // depends on control dependency: [if], data = [none]
}
//Filesize Range
if ((this.sizeRange != null)) {
builder.appendParam("size_range", this.sizeRange.buildRangeString()); // depends on control dependency: [if], data = [none]
}
//Owner Id's
if (!this.isNullOrEmpty(this.ownerUserIds)) {
builder.appendParam("owner_user_ids", this.listToCSV(this.ownerUserIds)); // depends on control dependency: [if], data = [none]
}
//Ancestor ID's
if (!this.isNullOrEmpty(this.ancestorFolderIds)) {
builder.appendParam("ancestor_folder_ids", this.listToCSV(this.ancestorFolderIds)); // depends on control dependency: [if], data = [none]
}
//Content Types: "name, description"
if (!this.isNullOrEmpty(this.contentTypes)) {
builder.appendParam("content_types", this.listToCSV(this.contentTypes)); // depends on control dependency: [if], data = [none]
}
//Type of File: "file,folder,web_link"
if (this.type != null) {
builder.appendParam("type", this.type); // depends on control dependency: [if], data = [none]
}
//Trash Content
if (!this.isNullOrEmpty(this.trashContent)) {
builder.appendParam("trash_content", this.trashContent); // depends on control dependency: [if], data = [none]
}
//Metadata filters
if (this.metadataFilter != null) {
builder.appendParam("mdfilters", this.formatBoxMetadataFilterRequest().toString()); // depends on control dependency: [if], data = [none]
}
//Fields
if (!this.isNullOrEmpty(this.fields)) {
builder.appendParam("fields", this.listToCSV(this.fields)); // depends on control dependency: [if], data = [none]
}
//Sort
if (!this.isNullOrEmpty(this.sort)) {
builder.appendParam("sort", this.sort); // depends on control dependency: [if], data = [none]
}
//Direction
if (!this.isNullOrEmpty(this.direction)) {
builder.appendParam("direction", this.direction); // depends on control dependency: [if], data = [none]
}
return builder;
} } |
public class class_name {
public EEnum getFNCPatTech() {
if (fncPatTechEEnum == null) {
fncPatTechEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(18);
}
return fncPatTechEEnum;
} } | public class class_name {
public EEnum getFNCPatTech() {
if (fncPatTechEEnum == null) {
fncPatTechEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(18); // depends on control dependency: [if], data = [none]
}
return fncPatTechEEnum;
} } |
public class class_name {
@Override
public synchronized void run() {
try {
// do the rename operation
m_mergePages.actionMerge(getReport());
} catch (Exception e) {
getReport().println(e);
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage());
}
}
} } | public class class_name {
@Override
public synchronized void run() {
try {
// do the rename operation
m_mergePages.actionMerge(getReport()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
getReport().println(e);
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private MethodDescriptor[] mergeMethods(MethodDescriptor[] superDescs) {
HashMap<String, MethodDescriptor> subMap = internalAsMap(methods);
for (MethodDescriptor superMethod : superDescs) {
String methodName = getQualifiedName(superMethod.getMethod());
MethodDescriptor method = subMap.get(methodName);
if (method == null) {
subMap.put(methodName, superMethod);
} else {
method.merge(superMethod);
}
}
MethodDescriptor[] theMethods = new MethodDescriptor[subMap.size()];
subMap.values().toArray(theMethods);
return theMethods;
} } | public class class_name {
private MethodDescriptor[] mergeMethods(MethodDescriptor[] superDescs) {
HashMap<String, MethodDescriptor> subMap = internalAsMap(methods);
for (MethodDescriptor superMethod : superDescs) {
String methodName = getQualifiedName(superMethod.getMethod());
MethodDescriptor method = subMap.get(methodName);
if (method == null) {
subMap.put(methodName, superMethod); // depends on control dependency: [if], data = [(method]
} else {
method.merge(superMethod); // depends on control dependency: [if], data = [none]
}
}
MethodDescriptor[] theMethods = new MethodDescriptor[subMap.size()];
subMap.values().toArray(theMethods);
return theMethods;
} } |
public class class_name {
public Map<String, Object> buildNewNestedMap(String[] mapKeys,
Object propertyValue) {
Map<String, Object> rootMap = new HashMap<String, Object>();
Map<String, Object> higherNestedMap = new HashMap<String, Object>();
Map<String, Object> deeperNestedMap = new HashMap<String, Object>();
// if only one key, add to the rootMap and return
if (mapKeys.length - 1 == 0) {
rootMap.put(mapKeys[0], propertyValue);
return rootMap;
}
// after if we need min. one nestedMap
// add deeperNestedMap to the higherNestedMap with the first key
higherNestedMap.put(mapKeys[0], deeperNestedMap);
// add the first nested map to the root map
rootMap.putAll(higherNestedMap);
// switch the higherNestedMap to the deeperNestedMap
higherNestedMap = deeperNestedMap;
// if mapKeys.length > 1
for (int i = 1; i <= mapKeys.length - 1; i++) {
if (i == mapKeys.length - 1) {
higherNestedMap.put(mapKeys[i], propertyValue);
break;
}
// make a new deeperNestedMap
deeperNestedMap = new HashMap<String, Object>();
// add deeperNestedMap to the higherNestedMap with the first key[i]
higherNestedMap.put(mapKeys[i], deeperNestedMap);
// switch the higherNestedMap to the deeperNestedMap
higherNestedMap = deeperNestedMap;
}
return rootMap;
} } | public class class_name {
public Map<String, Object> buildNewNestedMap(String[] mapKeys,
Object propertyValue) {
Map<String, Object> rootMap = new HashMap<String, Object>();
Map<String, Object> higherNestedMap = new HashMap<String, Object>();
Map<String, Object> deeperNestedMap = new HashMap<String, Object>();
// if only one key, add to the rootMap and return
if (mapKeys.length - 1 == 0) {
rootMap.put(mapKeys[0], propertyValue); // depends on control dependency: [if], data = [none]
return rootMap; // depends on control dependency: [if], data = [none]
}
// after if we need min. one nestedMap
// add deeperNestedMap to the higherNestedMap with the first key
higherNestedMap.put(mapKeys[0], deeperNestedMap);
// add the first nested map to the root map
rootMap.putAll(higherNestedMap);
// switch the higherNestedMap to the deeperNestedMap
higherNestedMap = deeperNestedMap;
// if mapKeys.length > 1
for (int i = 1; i <= mapKeys.length - 1; i++) {
if (i == mapKeys.length - 1) {
higherNestedMap.put(mapKeys[i], propertyValue); // depends on control dependency: [if], data = [none]
break;
}
// make a new deeperNestedMap
deeperNestedMap = new HashMap<String, Object>(); // depends on control dependency: [for], data = [none]
// add deeperNestedMap to the higherNestedMap with the first key[i]
higherNestedMap.put(mapKeys[i], deeperNestedMap); // depends on control dependency: [for], data = [i]
// switch the higherNestedMap to the deeperNestedMap
higherNestedMap = deeperNestedMap; // depends on control dependency: [for], data = [none]
}
return rootMap;
} } |
public class class_name {
public EClass getIfcTextFontSelect() {
if (ifcTextFontSelectEClass == null) {
ifcTextFontSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(976);
}
return ifcTextFontSelectEClass;
} } | public class class_name {
public EClass getIfcTextFontSelect() {
if (ifcTextFontSelectEClass == null) {
ifcTextFontSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(976);
// depends on control dependency: [if], data = [none]
}
return ifcTextFontSelectEClass;
} } |
public class class_name {
protected void removeKey (Comparable<?> key)
{
int index = _keys.indexOf(key);
if (index != -1) {
_keys.remove(index);
_table.removeDatum(index);
}
} } | public class class_name {
protected void removeKey (Comparable<?> key)
{
int index = _keys.indexOf(key);
if (index != -1) {
_keys.remove(index); // depends on control dependency: [if], data = [(index]
_table.removeDatum(index); // depends on control dependency: [if], data = [(index]
}
} } |
public class class_name {
@Override
public void flush() throws IOException
{
if (_os == null || ! _needsFlush)
return;
_needsFlush = false;
try {
_os.flush();
} catch (IOException e) {
try {
close();
} catch (IOException e1) {
}
throw ClientDisconnectException.create(e);
}
} } | public class class_name {
@Override
public void flush() throws IOException
{
if (_os == null || ! _needsFlush)
return;
_needsFlush = false;
try {
_os.flush();
} catch (IOException e) {
try {
close(); // depends on control dependency: [try], data = [none]
} catch (IOException e1) {
} // depends on control dependency: [catch], data = [none]
throw ClientDisconnectException.create(e);
}
} } |
public class class_name {
public RestClientOptions putGlobalHeaders(MultiMap headers) {
for (Map.Entry<String, String> header : headers) {
globalHeaders.add(header.getKey(), header.getValue());
}
return this;
} } | public class class_name {
public RestClientOptions putGlobalHeaders(MultiMap headers) {
for (Map.Entry<String, String> header : headers) {
globalHeaders.add(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
return this;
} } |
public class class_name {
public static void closeQuietly(final Connection connection)
{
if (connection != null && connection.isOpen()) {
try {
connection.close();
}
catch (IOException ioe) {
LOG.warnDebug(ioe, "While closing connection");
}
}
} } | public class class_name {
public static void closeQuietly(final Connection connection)
{
if (connection != null && connection.isOpen()) {
try {
connection.close(); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe) {
LOG.warnDebug(ioe, "While closing connection");
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static String buildDescription(final List<String> missingFields) {
final StringBuilder description =
new StringBuilder("Message missing required fields: ");
boolean first = true;
for (final String field : missingFields) {
if (first) {
first = false;
} else {
description.append(", ");
}
description.append(field);
}
return description.toString();
} } | public class class_name {
private static String buildDescription(final List<String> missingFields) {
final StringBuilder description =
new StringBuilder("Message missing required fields: ");
boolean first = true;
for (final String field : missingFields) {
if (first) {
first = false; // depends on control dependency: [if], data = [none]
} else {
description.append(", "); // depends on control dependency: [if], data = [none]
}
description.append(field); // depends on control dependency: [for], data = [field]
}
return description.toString();
} } |
public class class_name {
public IStatus validate(ISREInstall sre) {
final IStatus status;
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
if (SARLRuntime.getDefaultSREInstall() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, Messages.SREConfigurationBlock_5);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
if (retreiveProjectSRE() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_6);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (this.runtimeEnvironments.isEmpty()) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_8);
} else {
status = sre.getValidity();
}
return status;
} } | public class class_name {
public IStatus validate(ISREInstall sre) {
final IStatus status;
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
if (SARLRuntime.getDefaultSREInstall() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, Messages.SREConfigurationBlock_5); // depends on control dependency: [if], data = [none]
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus(); // depends on control dependency: [if], data = [none]
}
} else if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
if (retreiveProjectSRE() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_6); // depends on control dependency: [if], data = [none]
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus(); // depends on control dependency: [if], data = [none]
}
} else if (this.runtimeEnvironments.isEmpty()) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_8); // depends on control dependency: [if], data = [none]
} else {
status = sre.getValidity(); // depends on control dependency: [if], data = [none]
}
return status;
} } |
public class class_name {
@Override
public String getTimeZoneDisplayName(String tzID, NameType type) {
if (tzID == null || tzID.length() == 0) {
return null;
}
return loadTimeZoneNames(tzID).getName(type);
} } | public class class_name {
@Override
public String getTimeZoneDisplayName(String tzID, NameType type) {
if (tzID == null || tzID.length() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return loadTimeZoneNames(tzID).getName(type);
} } |
public class class_name {
@Override
public Set<URI> listOperations(URI serviceUri) {
if (serviceUri == null || !serviceUri.isAbsolute()) {
log.warn("The Service URI is either absent or relative. Provide an absolute URI");
return ImmutableSet.of();
}
URI graphUri;
try {
graphUri = getGraphUriForElement(serviceUri);
} catch (URISyntaxException e) {
log.warn("The namespace of the URI of the service is incorrect.", e);
return ImmutableSet.of();
}
if (graphUri == null) {
log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri);
return ImmutableSet.of();
}
String queryStr = new StringBuilder()
.append("SELECT DISTINCT ?op WHERE { \n")
.append(" GRAPH <").append(graphUri.toASCIIString()).append("> { \n")
.append(" <").append(serviceUri.toASCIIString()).append("> ").append("<").append(MSM.hasOperation.getURI()).append(">").append(" ?op . ")
.append(" ?op ").append("<").append(RDF.type.getURI()).append(">").append(" ").append("<").append(MSM.Operation.getURI()).append("> . \n")
.append(" } \n ")
.append("} \n ")
.toString();
return this.graphStoreManager.listResourcesByQuery(queryStr, "op");
} } | public class class_name {
@Override
public Set<URI> listOperations(URI serviceUri) {
if (serviceUri == null || !serviceUri.isAbsolute()) {
log.warn("The Service URI is either absent or relative. Provide an absolute URI"); // depends on control dependency: [if], data = [none]
return ImmutableSet.of(); // depends on control dependency: [if], data = [none]
}
URI graphUri;
try {
graphUri = getGraphUriForElement(serviceUri); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
log.warn("The namespace of the URI of the service is incorrect.", e);
return ImmutableSet.of();
} // depends on control dependency: [catch], data = [none]
if (graphUri == null) {
log.warn("Could not obtain a graph URI for the element. The URI may not be managed by the server - " + serviceUri); // depends on control dependency: [if], data = [none]
return ImmutableSet.of(); // depends on control dependency: [if], data = [none]
}
String queryStr = new StringBuilder()
.append("SELECT DISTINCT ?op WHERE { \n")
.append(" GRAPH <").append(graphUri.toASCIIString()).append("> { \n")
.append(" <").append(serviceUri.toASCIIString()).append("> ").append("<").append(MSM.hasOperation.getURI()).append(">").append(" ?op . ")
.append(" ?op ").append("<").append(RDF.type.getURI()).append(">").append(" ").append("<").append(MSM.Operation.getURI()).append("> . \n")
.append(" } \n ")
.append("} \n ")
.toString();
return this.graphStoreManager.listResourcesByQuery(queryStr, "op");
} } |
public class class_name {
private static String encode(String s) {
int n = INITIAL_N;
int delta = 0;
int bias = INITIAL_BIAS;
StringBuffer output = new StringBuffer();
// Copy all basic code points to the output.
int b = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (basicCodePoint(c)) {
output.append(c);
b++;
}
}
if (b > 0) {
output.append(DELIMITER);
}
int h = b;
while (h < s.length()) {
int m = Integer.MAX_VALUE;
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c >= n && c < m) {
m = c;
}
}
if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) {
// This should probably be a java.text.ParseException, but
// IllegalArgumentException is what Android's IDN expects.
throw new IllegalArgumentException("encoding overflow");
}
delta = delta + (m - n) * (h + 1);
n = m;
for (int j = 0; j < s.length(); j++) {
int c = s.charAt(j);
if (c < n) {
delta++;
if (0 == delta) {
throw new IllegalArgumentException("encoding overflow");
}
}
if (c == n) {
int q = delta;
for (int k = BASE;; k += BASE) {
int t;
if (k <= bias) {
t = TMIN;
} else if (k >= bias + TMAX) {
t = TMAX;
} else {
t = k - bias;
}
if (q < t) {
break;
}
output.append((char) encodeDigit(t + (q - t) % (BASE - t)));
q = (q - t) / (BASE - t);
}
output.append((char) encodeDigit(q));
bias = adapt(delta, h + 1, h == b);
delta = 0;
h++;
}
}
delta++;
n++;
}
return output.toString();
} } | public class class_name {
private static String encode(String s) {
int n = INITIAL_N;
int delta = 0;
int bias = INITIAL_BIAS;
StringBuffer output = new StringBuffer();
// Copy all basic code points to the output.
int b = 0;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (basicCodePoint(c)) {
output.append(c); // depends on control dependency: [if], data = [none]
b++; // depends on control dependency: [if], data = [none]
}
}
if (b > 0) {
output.append(DELIMITER); // depends on control dependency: [if], data = [none]
}
int h = b;
while (h < s.length()) {
int m = Integer.MAX_VALUE;
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c >= n && c < m) {
m = c; // depends on control dependency: [if], data = [none]
}
}
if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) {
// This should probably be a java.text.ParseException, but
// IllegalArgumentException is what Android's IDN expects.
throw new IllegalArgumentException("encoding overflow");
}
delta = delta + (m - n) * (h + 1); // depends on control dependency: [while], data = [(h]
n = m; // depends on control dependency: [while], data = [none]
for (int j = 0; j < s.length(); j++) {
int c = s.charAt(j);
if (c < n) {
delta++; // depends on control dependency: [if], data = [none]
if (0 == delta) {
throw new IllegalArgumentException("encoding overflow");
}
}
if (c == n) {
int q = delta;
for (int k = BASE;; k += BASE) {
int t;
if (k <= bias) {
t = TMIN; // depends on control dependency: [if], data = [none]
} else if (k >= bias + TMAX) {
t = TMAX; // depends on control dependency: [if], data = [none]
} else {
t = k - bias; // depends on control dependency: [if], data = [none]
}
if (q < t) {
break;
}
output.append((char) encodeDigit(t + (q - t) % (BASE - t))); // depends on control dependency: [for], data = [none]
q = (q - t) / (BASE - t); // depends on control dependency: [for], data = [none]
}
output.append((char) encodeDigit(q)); // depends on control dependency: [if], data = [(c]
bias = adapt(delta, h + 1, h == b); // depends on control dependency: [if], data = [none]
delta = 0; // depends on control dependency: [if], data = [none]
h++; // depends on control dependency: [if], data = [none]
}
}
delta++; // depends on control dependency: [while], data = [none]
n++; // depends on control dependency: [while], data = [none]
}
return output.toString();
} } |
public class class_name {
List<List<BlockInfo>> chooseUnderReplicatedBlocks(int blocksToProcess) {
// initialize data structure for the return value
List<List<BlockInfo>> blocksToReplicate =
new ArrayList<List<BlockInfo>>(UnderReplicatedBlocks.LEVEL);
for (int i = 0; i < UnderReplicatedBlocks.LEVEL; i++) {
blocksToReplicate.add(new ArrayList<BlockInfo>());
}
writeLock();
try {
synchronized (neededReplications) {
if (neededReplications.size() == 0) {
return blocksToReplicate;
}
for (int priority = 0; priority<UnderReplicatedBlocks.LEVEL; priority++) {
// Go through all blocks that need replications of priority
BlockIterator neededReplicationsIterator = neededReplications.iterator(priority);
int numBlocks = neededReplications.size(priority);
if (replIndex[priority] > numBlocks) {
replIndex[priority] = 0;
}
// skip to the first unprocessed block, which is at replIndex
for (int i = 0; i < replIndex[priority] && neededReplicationsIterator.hasNext(); i++) {
neededReplicationsIterator.next();
}
// # of blocks to process for this priority
int blocksToProcessIter = getQuotaForThisPriority(blocksToProcess,
numBlocks, neededReplications.getSize(priority+1));
blocksToProcess -= blocksToProcessIter;
for (int blkCnt = 0; blkCnt < blocksToProcessIter; blkCnt++, replIndex[priority]++) {
if (!neededReplicationsIterator.hasNext()) {
// start from the beginning
replIndex[priority] = 0;
neededReplicationsIterator = neededReplications.iterator(priority);
assert neededReplicationsIterator.hasNext() :
"neededReplications should not be empty.";
}
BlockInfo block = neededReplicationsIterator.next();
blocksToReplicate.get(priority).add(block);
} // end for
}
} // end try
return blocksToReplicate;
} finally {
writeUnlock();
}
} } | public class class_name {
List<List<BlockInfo>> chooseUnderReplicatedBlocks(int blocksToProcess) {
// initialize data structure for the return value
List<List<BlockInfo>> blocksToReplicate =
new ArrayList<List<BlockInfo>>(UnderReplicatedBlocks.LEVEL);
for (int i = 0; i < UnderReplicatedBlocks.LEVEL; i++) {
blocksToReplicate.add(new ArrayList<BlockInfo>()); // depends on control dependency: [for], data = [none]
}
writeLock();
try {
synchronized (neededReplications) { // depends on control dependency: [try], data = [none]
if (neededReplications.size() == 0) {
return blocksToReplicate; // depends on control dependency: [if], data = [none]
}
for (int priority = 0; priority<UnderReplicatedBlocks.LEVEL; priority++) {
// Go through all blocks that need replications of priority
BlockIterator neededReplicationsIterator = neededReplications.iterator(priority);
int numBlocks = neededReplications.size(priority);
if (replIndex[priority] > numBlocks) {
replIndex[priority] = 0; // depends on control dependency: [if], data = [none]
}
// skip to the first unprocessed block, which is at replIndex
for (int i = 0; i < replIndex[priority] && neededReplicationsIterator.hasNext(); i++) {
neededReplicationsIterator.next(); // depends on control dependency: [for], data = [none]
}
// # of blocks to process for this priority
int blocksToProcessIter = getQuotaForThisPriority(blocksToProcess,
numBlocks, neededReplications.getSize(priority+1));
blocksToProcess -= blocksToProcessIter; // depends on control dependency: [for], data = [none]
for (int blkCnt = 0; blkCnt < blocksToProcessIter; blkCnt++, replIndex[priority]++) {
if (!neededReplicationsIterator.hasNext()) {
// start from the beginning
replIndex[priority] = 0; // depends on control dependency: [if], data = [none]
neededReplicationsIterator = neededReplications.iterator(priority); // depends on control dependency: [if], data = [none]
assert neededReplicationsIterator.hasNext() :
"neededReplications should not be empty.";
}
BlockInfo block = neededReplicationsIterator.next();
blocksToReplicate.get(priority).add(block); // depends on control dependency: [for], data = [none]
} // end for
}
} // end try
return blocksToReplicate; // depends on control dependency: [try], data = [none]
} finally {
writeUnlock();
}
} } |
public class class_name {
public DescribeScalableTargetsRequest withResourceIds(String... resourceIds) {
if (this.resourceIds == null) {
setResourceIds(new java.util.ArrayList<String>(resourceIds.length));
}
for (String ele : resourceIds) {
this.resourceIds.add(ele);
}
return this;
} } | public class class_name {
public DescribeScalableTargetsRequest withResourceIds(String... resourceIds) {
if (this.resourceIds == null) {
setResourceIds(new java.util.ArrayList<String>(resourceIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : resourceIds) {
this.resourceIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void setFeatureStyle(String featureTable, long featureId,
GeometryType geometryType, FeatureStyle featureStyle) {
if (featureStyle != null) {
setStyle(featureTable, featureId, geometryType,
featureStyle.getStyle());
setIcon(featureTable, featureId, geometryType,
featureStyle.getIcon());
} else {
deleteStyle(featureTable, featureId, geometryType);
deleteIcon(featureTable, featureId, geometryType);
}
} } | public class class_name {
public void setFeatureStyle(String featureTable, long featureId,
GeometryType geometryType, FeatureStyle featureStyle) {
if (featureStyle != null) {
setStyle(featureTable, featureId, geometryType,
featureStyle.getStyle()); // depends on control dependency: [if], data = [none]
setIcon(featureTable, featureId, geometryType,
featureStyle.getIcon()); // depends on control dependency: [if], data = [none]
} else {
deleteStyle(featureTable, featureId, geometryType); // depends on control dependency: [if], data = [none]
deleteIcon(featureTable, featureId, geometryType); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Schema superSetOf(String newName, Schema schema, Field... newFields) {
List<Field> newSchema = new ArrayList<Field>();
newSchema.addAll(schema.getFields());
for(Field newField: newFields) {
newSchema.add(newField);
}
return new Schema(newName, newSchema);
} } | public class class_name {
public static Schema superSetOf(String newName, Schema schema, Field... newFields) {
List<Field> newSchema = new ArrayList<Field>();
newSchema.addAll(schema.getFields());
for(Field newField: newFields) {
newSchema.add(newField); // depends on control dependency: [for], data = [newField]
}
return new Schema(newName, newSchema);
} } |
public class class_name {
public void drawGroup(Object parent, Object object) {
if (isAttached()) {
helper.createOrUpdateGroup(parent, object, null, null);
}
} } | public class class_name {
public void drawGroup(Object parent, Object object) {
if (isAttached()) {
helper.createOrUpdateGroup(parent, object, null, null); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean diff(Node right, Buffer rightBuffer) throws IOException {
Buffer leftBuffer;
int leftChunk;
int rightChunk;
boolean result;
leftBuffer = getWorld().getBuffer();
try (InputStream leftSrc = newInputStream();
InputStream rightSrc = right.newInputStream()) {
result = false;
do {
leftChunk = leftBuffer.fill(leftSrc);
rightChunk = rightBuffer.fill(rightSrc);
if (leftChunk != rightChunk || leftBuffer.diff(rightBuffer, leftChunk)) {
result = true;
break;
}
} while (leftChunk > 0);
}
return result;
} } | public class class_name {
public boolean diff(Node right, Buffer rightBuffer) throws IOException {
Buffer leftBuffer;
int leftChunk;
int rightChunk;
boolean result;
leftBuffer = getWorld().getBuffer();
try (InputStream leftSrc = newInputStream();
InputStream rightSrc = right.newInputStream()) {
result = false;
do {
leftChunk = leftBuffer.fill(leftSrc);
rightChunk = rightBuffer.fill(rightSrc);
if (leftChunk != rightChunk || leftBuffer.diff(rightBuffer, leftChunk)) {
result = true; // depends on control dependency: [if], data = [none]
break;
}
} while (leftChunk > 0);
}
return result;
} } |
public class class_name {
@Override
protected List<ChecksumFile> getFilesToProcess()
{
List<ChecksumFile> files = new LinkedList<ChecksumFile>();
// Add project main artifact.
if ( hasValidFile( project.getArtifact() ) )
{
files.add( new ChecksumFile( "", project.getArtifact().getFile(), project.getArtifact().getType(),null ) );
}
// Add projects attached.
if ( project.getAttachedArtifacts() != null )
{
for ( Artifact artifact : (List<Artifact>) project.getAttachedArtifacts() )
{
if ( hasValidFile( artifact ) )
{
files.add( new ChecksumFile( "", artifact.getFile(), artifact.getType(), artifact.getClassifier() ) );
}
}
}
return files;
} } | public class class_name {
@Override
protected List<ChecksumFile> getFilesToProcess()
{
List<ChecksumFile> files = new LinkedList<ChecksumFile>();
// Add project main artifact.
if ( hasValidFile( project.getArtifact() ) )
{
files.add( new ChecksumFile( "", project.getArtifact().getFile(), project.getArtifact().getType(),null ) ); // depends on control dependency: [if], data = [none]
}
// Add projects attached.
if ( project.getAttachedArtifacts() != null )
{
for ( Artifact artifact : (List<Artifact>) project.getAttachedArtifacts() )
{
if ( hasValidFile( artifact ) )
{
files.add( new ChecksumFile( "", artifact.getFile(), artifact.getType(), artifact.getClassifier() ) ); // depends on control dependency: [if], data = [none]
}
}
}
return files;
} } |
public class class_name {
@Override
public void notifyTransformed(Transformable transformable)
{
final Collidable collidable = transformable.getFeature(Collidable.class);
final double oldX = transformable.getOldX();
final double oldY = transformable.getOldY();
final int oldMinX = (int) Math.floor(oldX / REDUCE_FACTOR);
final int oldMinY = (int) Math.floor(oldY / REDUCE_FACTOR);
final int oldMaxX = (int) Math.floor((oldX + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int oldMaxY = (int) Math.floor((oldY + collidable.getMaxHeight()) / REDUCE_FACTOR);
final double x = transformable.getX();
final double y = transformable.getY();
final int minX = (int) Math.floor(x / REDUCE_FACTOR);
final int minY = (int) Math.floor(y / REDUCE_FACTOR);
final int maxX = (int) Math.floor((x + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int maxY = (int) Math.floor((y + collidable.getMaxHeight()) / REDUCE_FACTOR);
if (oldMinX != minX || oldMinY != minY || oldMaxX != maxX || oldMaxY != maxY)
{
removePoints(oldMinX, oldMinY, oldMaxX, oldMaxY, collidable);
}
addPoints(minX, minY, maxX, maxY, collidable);
} } | public class class_name {
@Override
public void notifyTransformed(Transformable transformable)
{
final Collidable collidable = transformable.getFeature(Collidable.class);
final double oldX = transformable.getOldX();
final double oldY = transformable.getOldY();
final int oldMinX = (int) Math.floor(oldX / REDUCE_FACTOR);
final int oldMinY = (int) Math.floor(oldY / REDUCE_FACTOR);
final int oldMaxX = (int) Math.floor((oldX + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int oldMaxY = (int) Math.floor((oldY + collidable.getMaxHeight()) / REDUCE_FACTOR);
final double x = transformable.getX();
final double y = transformable.getY();
final int minX = (int) Math.floor(x / REDUCE_FACTOR);
final int minY = (int) Math.floor(y / REDUCE_FACTOR);
final int maxX = (int) Math.floor((x + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int maxY = (int) Math.floor((y + collidable.getMaxHeight()) / REDUCE_FACTOR);
if (oldMinX != minX || oldMinY != minY || oldMaxX != maxX || oldMaxY != maxY)
{
removePoints(oldMinX, oldMinY, oldMaxX, oldMaxY, collidable); // depends on control dependency: [if], data = [(oldMinX]
}
addPoints(minX, minY, maxX, maxY, collidable);
} } |
public class class_name {
protected void initBundles() {
if (commonBundle == null) {
Locale locale = configuration.getLocale();
this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale);
this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale);
}
} } | public class class_name {
protected void initBundles() {
if (commonBundle == null) {
Locale locale = configuration.getLocale();
this.commonBundle = ResourceBundle.getBundle(commonBundleName, locale); // depends on control dependency: [if], data = [(commonBundle]
this.docletBundle = ResourceBundle.getBundle(docletBundleName, locale); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void backupFile() {
writeLock.lock();
try {
if (incBackup) {
if (fa.isStreamElement(backupFileName)) {
fa.removeElement(backupFileName);
}
return;
}
if (fa.isStreamElement(fileName)) {
FileArchiver.archive(fileName, backupFileName + ".new",
database.getFileAccess(),
FileArchiver.COMPRESSION_ZIP);
}
} catch (IOException e) {
database.logger.appLog.logContext(e, null);
throw new HsqlException(e.getMessage(), "", 0);
} finally {
writeLock.unlock();
}
} } | public class class_name {
void backupFile() {
writeLock.lock();
try {
if (incBackup) {
if (fa.isStreamElement(backupFileName)) {
fa.removeElement(backupFileName); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (fa.isStreamElement(fileName)) {
FileArchiver.archive(fileName, backupFileName + ".new",
database.getFileAccess(),
FileArchiver.COMPRESSION_ZIP); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
database.logger.appLog.logContext(e, null);
throw new HsqlException(e.getMessage(), "", 0);
} finally { // depends on control dependency: [catch], data = [none]
writeLock.unlock();
}
} } |
public class class_name {
public long getAverageEventRoutingTime() {
long time = 0L;
long events = 0L;
for (EventTypeID eventTypeID : eventRouter.getSleeContainer().getComponentManagement().getComponentRepository().getEventComponentIDs()) {
for (int i = 0; i < getExecutors().length; i++) {
final EventRouterExecutorStatistics eventRouterExecutorStatistics = getEventRouterExecutorStatistics(i);
if (eventRouterExecutorStatistics != null) {
EventTypeRoutingStatistics eventTypeRoutingStatistics = eventRouterExecutorStatistics.getEventTypeRoutingStatistics(eventTypeID);
if (eventTypeRoutingStatistics != null) {
time += eventTypeRoutingStatistics.getRoutingTime();
events += eventTypeRoutingStatistics.getEventsRouted();
}
}
}
}
return time == 0L ? 0L : time / events;
} } | public class class_name {
public long getAverageEventRoutingTime() {
long time = 0L;
long events = 0L;
for (EventTypeID eventTypeID : eventRouter.getSleeContainer().getComponentManagement().getComponentRepository().getEventComponentIDs()) {
for (int i = 0; i < getExecutors().length; i++) {
final EventRouterExecutorStatistics eventRouterExecutorStatistics = getEventRouterExecutorStatistics(i);
if (eventRouterExecutorStatistics != null) {
EventTypeRoutingStatistics eventTypeRoutingStatistics = eventRouterExecutorStatistics.getEventTypeRoutingStatistics(eventTypeID);
if (eventTypeRoutingStatistics != null) {
time += eventTypeRoutingStatistics.getRoutingTime(); // depends on control dependency: [if], data = [none]
events += eventTypeRoutingStatistics.getEventsRouted(); // depends on control dependency: [if], data = [none]
}
}
}
}
return time == 0L ? 0L : time / events;
} } |
public class class_name {
public static void usage(PrintStream errStream, Object target) {
Class<?> clazz;
if (target instanceof Class) {
clazz = (Class) target;
} else {
clazz = target.getClass();
}
errStream.println("Usage: " + clazz.getName());
for (Class<?> currentClazz = clazz; currentClazz != null; currentClazz = currentClazz.getSuperclass()) {
for (Field field : currentClazz.getDeclaredFields()) {
fieldUsage(errStream, target, field);
}
}
try {
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
propertyUsage(errStream, target, pd);
}
} catch (IntrospectionException e) {
// If its not a JavaBean we ignore it
}
} } | public class class_name {
public static void usage(PrintStream errStream, Object target) {
Class<?> clazz;
if (target instanceof Class) {
clazz = (Class) target; // depends on control dependency: [if], data = [none]
} else {
clazz = target.getClass(); // depends on control dependency: [if], data = [none]
}
errStream.println("Usage: " + clazz.getName());
for (Class<?> currentClazz = clazz; currentClazz != null; currentClazz = currentClazz.getSuperclass()) {
for (Field field : currentClazz.getDeclaredFields()) {
fieldUsage(errStream, target, field); // depends on control dependency: [for], data = [field]
}
}
try {
BeanInfo info = Introspector.getBeanInfo(clazz);
for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
propertyUsage(errStream, target, pd); // depends on control dependency: [for], data = [pd]
}
} catch (IntrospectionException e) {
// If its not a JavaBean we ignore it
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int getField(int index, int defaultValue)
{
if (index >= 0 && index < this.version.length)
{
return version[index];
}
else
{
return defaultValue;
}
} } | public class class_name {
public int getField(int index, int defaultValue)
{
if (index >= 0 && index < this.version.length)
{
return version[index]; // depends on control dependency: [if], data = [none]
}
else
{
return defaultValue; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static DirContextOperations searchForSingleEntryInternal(DirContext ctx,
SearchControls searchControls, String base, String filter, Object[] params)
throws NamingException {
final DistinguishedName ctxBaseDn = new DistinguishedName(
ctx.getNameInNamespace());
final DistinguishedName searchBaseDn = new DistinguishedName(base);
final NamingEnumeration<SearchResult> resultsEnum = ctx.search(searchBaseDn,
filter, params, buildControls(searchControls));
if (logger.isDebugEnabled()) {
logger.debug("Searching for entry under DN '" + ctxBaseDn + "', base = '"
+ searchBaseDn + "', filter = '" + filter + "'");
}
Set<DirContextOperations> results = new HashSet<>();
try {
while (resultsEnum.hasMore()) {
SearchResult searchResult = resultsEnum.next();
DirContextAdapter dca = (DirContextAdapter) searchResult.getObject();
Assert.notNull(dca,
"No object returned by search, DirContext is not correctly configured");
if (logger.isDebugEnabled()) {
logger.debug("Found DN: " + dca.getDn());
}
results.add(dca);
}
}
catch (PartialResultException e) {
LdapUtils.closeEnumeration(resultsEnum);
logger.info("Ignoring PartialResultException");
}
if (results.size() == 0) {
throw new IncorrectResultSizeDataAccessException(1, 0);
}
if (results.size() > 1) {
throw new IncorrectResultSizeDataAccessException(1, results.size());
}
return results.iterator().next();
} } | public class class_name {
public static DirContextOperations searchForSingleEntryInternal(DirContext ctx,
SearchControls searchControls, String base, String filter, Object[] params)
throws NamingException {
final DistinguishedName ctxBaseDn = new DistinguishedName(
ctx.getNameInNamespace());
final DistinguishedName searchBaseDn = new DistinguishedName(base);
final NamingEnumeration<SearchResult> resultsEnum = ctx.search(searchBaseDn,
filter, params, buildControls(searchControls));
if (logger.isDebugEnabled()) {
logger.debug("Searching for entry under DN '" + ctxBaseDn + "', base = '"
+ searchBaseDn + "', filter = '" + filter + "'");
}
Set<DirContextOperations> results = new HashSet<>();
try {
while (resultsEnum.hasMore()) {
SearchResult searchResult = resultsEnum.next();
DirContextAdapter dca = (DirContextAdapter) searchResult.getObject();
Assert.notNull(dca,
"No object returned by search, DirContext is not correctly configured"); // depends on control dependency: [while], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("Found DN: " + dca.getDn()); // depends on control dependency: [if], data = [none]
}
results.add(dca); // depends on control dependency: [while], data = [none]
}
}
catch (PartialResultException e) {
LdapUtils.closeEnumeration(resultsEnum);
logger.info("Ignoring PartialResultException");
}
if (results.size() == 0) {
throw new IncorrectResultSizeDataAccessException(1, 0);
}
if (results.size() > 1) {
throw new IncorrectResultSizeDataAccessException(1, results.size());
}
return results.iterator().next();
} } |
public class class_name {
public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout();
} catch (ClassCastException exc) {
System.err.println("The first argument to makeGrid must use SpringLayout.");
return;
}
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth());
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight());
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
cons.setWidth(maxWidthSpring);
cons.setHeight(maxHeightSpring);
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons;
cons.setX(initialXSpring);
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring));
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring);
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
yPadSpring));
}
lastCons = cons;
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH,
Spring.sum(
Spring.constant(yPad),
lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST,
Spring.sum(
Spring.constant(xPad),
lastCons.getConstraint(SpringLayout.EAST)));
} } | public class class_name {
public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout)parent.getLayout(); // depends on control dependency: [try], data = [none]
} catch (ClassCastException exc) {
System.err.println("The first argument to makeGrid must use SpringLayout.");
return;
} // depends on control dependency: [catch], data = [none]
Spring xPadSpring = Spring.constant(xPad);
Spring yPadSpring = Spring.constant(yPad);
Spring initialXSpring = Spring.constant(initialX);
Spring initialYSpring = Spring.constant(initialY);
int max = rows * cols;
//Calculate Springs that are the max of the width/height so that all
//cells have the same size.
Spring maxWidthSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
Spring maxHeightSpring = layout.getConstraints(parent.getComponent(0)).
getWidth();
for (int i = 1; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
maxWidthSpring = Spring.max(maxWidthSpring, cons.getWidth()); // depends on control dependency: [for], data = [none]
maxHeightSpring = Spring.max(maxHeightSpring, cons.getHeight()); // depends on control dependency: [for], data = [none]
}
//Apply the new width/height Spring. This forces all the
//components to have the same size.
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
cons.setWidth(maxWidthSpring); // depends on control dependency: [for], data = [none]
cons.setHeight(maxHeightSpring); // depends on control dependency: [for], data = [none]
}
//Then adjust the x/y constraints of all the cells so that they
//are aligned in a grid.
SpringLayout.Constraints lastCons = null;
SpringLayout.Constraints lastRowCons = null;
for (int i = 0; i < max; i++) {
SpringLayout.Constraints cons = layout.getConstraints(
parent.getComponent(i));
if (i % cols == 0) { //start of new row
lastRowCons = lastCons; // depends on control dependency: [if], data = [none]
cons.setX(initialXSpring); // depends on control dependency: [if], data = [none]
} else { //x position depends on previous component
cons.setX(Spring.sum(lastCons.getConstraint(SpringLayout.EAST),
xPadSpring)); // depends on control dependency: [if], data = [none]
}
if (i / cols == 0) { //first row
cons.setY(initialYSpring); // depends on control dependency: [if], data = [none]
} else { //y position depends on previous row
cons.setY(Spring.sum(lastRowCons.getConstraint(SpringLayout.SOUTH),
yPadSpring)); // depends on control dependency: [if], data = [none]
}
lastCons = cons; // depends on control dependency: [for], data = [none]
}
//Set the parent's size.
SpringLayout.Constraints pCons = layout.getConstraints(parent);
pCons.setConstraint(SpringLayout.SOUTH,
Spring.sum(
Spring.constant(yPad),
lastCons.getConstraint(SpringLayout.SOUTH)));
pCons.setConstraint(SpringLayout.EAST,
Spring.sum(
Spring.constant(xPad),
lastCons.getConstraint(SpringLayout.EAST)));
} } |
public class class_name {
public boolean matches(MonitorConfig config) {
String name = config.getName();
TagList tags = config.getTags();
String value;
if (tagKey == null) {
value = name;
} else {
Tag t = tags.getTag(tagKey);
value = (t == null) ? null : t.getValue();
}
boolean match = matchIfMissingTag;
if (value != null) {
match = pattern.matcher(value).matches();
}
return match ^ invert;
} } | public class class_name {
public boolean matches(MonitorConfig config) {
String name = config.getName();
TagList tags = config.getTags();
String value;
if (tagKey == null) {
value = name; // depends on control dependency: [if], data = [none]
} else {
Tag t = tags.getTag(tagKey);
value = (t == null) ? null : t.getValue(); // depends on control dependency: [if], data = [null)]
}
boolean match = matchIfMissingTag;
if (value != null) {
match = pattern.matcher(value).matches(); // depends on control dependency: [if], data = [(value]
}
return match ^ invert;
} } |
public class class_name {
public static String[] extractToStringArray(final DeviceData deviceDataArgout) throws DevFailed {
final Object[] values = CommandHelper.extractArray(deviceDataArgout);
if (values == null) {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output is empty ",
"CommandHelper.extractToStringArray(deviceDataArgin)");
}
final String[] argout = new String[values.length];
if (values.length > 0) {
if (values[0] instanceof Short) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Short) values[i]).toString();
}
} else if (values[0] instanceof String) {
for (int i = 0; i < values.length; i++) {
argout[i] = (String) values[i];
}
} else if (values[0] instanceof Integer) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Integer) values[i]).toString();
}
} else if (values[0] instanceof Long) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Long) values[i]).toString();
}
} else if (values[0] instanceof Float) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Float) values[i]).toString();
}
} else if (values[0] instanceof Boolean) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Boolean) values[i]).toString();
}
} else if (values[0] instanceof Double) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Double) values[i]).toString();
}
} else if (values[0] instanceof Byte) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Byte) values[i]).toString();
}
} else if (values[0] instanceof DevState) {
for (int i = 0; i < values.length; i++) {
argout[i] = StateUtilities.getNameForState((DevState) values[0]);
}
} else {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type "
+ values[0].getClass() + " not supported",
"CommandHelper.extractToStringArray(Object value,deviceDataArgin)");
}
}
return argout;
} } | public class class_name {
public static String[] extractToStringArray(final DeviceData deviceDataArgout) throws DevFailed {
final Object[] values = CommandHelper.extractArray(deviceDataArgout);
if (values == null) {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output is empty ",
"CommandHelper.extractToStringArray(deviceDataArgin)");
}
final String[] argout = new String[values.length];
if (values.length > 0) {
if (values[0] instanceof Short) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Short) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof String) {
for (int i = 0; i < values.length; i++) {
argout[i] = (String) values[i]; // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Integer) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Integer) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Long) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Long) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Float) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Float) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Boolean) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Boolean) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Double) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Double) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof Byte) {
for (int i = 0; i < values.length; i++) {
argout[i] = ((Byte) values[i]).toString(); // depends on control dependency: [for], data = [i]
}
} else if (values[0] instanceof DevState) {
for (int i = 0; i < values.length; i++) {
argout[i] = StateUtilities.getNameForState((DevState) values[0]); // depends on control dependency: [for], data = [i]
}
} else {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type "
+ values[0].getClass() + " not supported",
"CommandHelper.extractToStringArray(Object value,deviceDataArgin)"); // depends on control dependency: [if], data = [none]
}
}
return argout;
} } |
public class class_name {
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) {
checkImageArguments(real,complex);
for( int y = 0; y < complex.height; y++ ) {
int indexReal = real.startIndex + y*real.stride;
int indexComplex = complex.startIndex + y*complex.stride;
for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) {
complex.data[indexComplex] = real.data[indexReal];
complex.data[indexComplex+1] = 0;
}
}
} } | public class class_name {
public static void realToComplex(GrayF32 real , InterleavedF32 complex ) {
checkImageArguments(real,complex);
for( int y = 0; y < complex.height; y++ ) {
int indexReal = real.startIndex + y*real.stride;
int indexComplex = complex.startIndex + y*complex.stride;
for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) {
complex.data[indexComplex] = real.data[indexReal]; // depends on control dependency: [for], data = [none]
complex.data[indexComplex+1] = 0; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public List<String[]> readAll() throws IOException {
List<String[]> allElements = new ArrayList<>();
while (hasNext) {
String[] nextLineAsTokens = readNext();
if (nextLineAsTokens != null) {
allElements.add(nextLineAsTokens);
}
}
return allElements;
} } | public class class_name {
public List<String[]> readAll() throws IOException {
List<String[]> allElements = new ArrayList<>();
while (hasNext) {
String[] nextLineAsTokens = readNext();
if (nextLineAsTokens != null) {
allElements.add(nextLineAsTokens); // depends on control dependency: [if], data = [(nextLineAsTokens]
}
}
return allElements;
} } |
public class class_name {
synchronized void registerService(Promotable service)
{
m_services.add(service);
if (m_isLeader) {
try {
service.acceptPromotion();
}
catch (Exception e) {
VoltDB.crashLocalVoltDB("Unable to promote global service.", true, e);
}
}
} } | public class class_name {
synchronized void registerService(Promotable service)
{
m_services.add(service);
if (m_isLeader) {
try {
service.acceptPromotion(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
VoltDB.crashLocalVoltDB("Unable to promote global service.", true, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public HitResult intersect(Shape shape, Line line) {
float distance = Float.MAX_VALUE;
HitResult hit = null;
for (int i=0;i<shape.getPointCount();i++) {
int next = rationalPoint(shape, i+1);
Line local = getLine(shape, i, next);
Vector2f pt = line.intersect(local, true);
if (pt != null) {
float newDis = pt.distance(line.getStart());
if ((newDis < distance) && (newDis > EPSILON)) {
hit = new HitResult();
hit.pt = pt;
hit.line = local;
hit.p1 = i;
hit.p2 = next;
distance = newDis;
}
}
}
return hit;
} } | public class class_name {
public HitResult intersect(Shape shape, Line line) {
float distance = Float.MAX_VALUE;
HitResult hit = null;
for (int i=0;i<shape.getPointCount();i++) {
int next = rationalPoint(shape, i+1);
Line local = getLine(shape, i, next);
Vector2f pt = line.intersect(local, true);
if (pt != null) {
float newDis = pt.distance(line.getStart());
if ((newDis < distance) && (newDis > EPSILON)) {
hit = new HitResult();
// depends on control dependency: [if], data = [none]
hit.pt = pt;
// depends on control dependency: [if], data = [none]
hit.line = local;
// depends on control dependency: [if], data = [none]
hit.p1 = i;
// depends on control dependency: [if], data = [none]
hit.p2 = next;
// depends on control dependency: [if], data = [none]
distance = newDis;
// depends on control dependency: [if], data = [none]
}
}
}
return hit;
} } |
public class class_name {
public double[][] latLonToProj(double[][] from, double[][] to, int latIndex, int lonIndex) {
int cnt = from[0].length;
double[] fromLatA = from[latIndex];
double[] fromLonA = from[lonIndex];
double[] resultXA = to[INDEX_X];
double[] resultYA = to[INDEX_Y];
double toX, toY;
for (int i = 0; i < cnt; i++) {
double fromLat = fromLatA[i];
double fromLon = fromLonA[i];
double lat = Math.toRadians(fromLat);
double lon = Math.toRadians(fromLon);
// keep away from the singular point
if ((Math.abs(lat + latt) <= TOLERANCE)) {
lat = -latt * (1.0 - TOLERANCE);
}
double sdlon = Math.sin(lon - lont);
double cdlon = Math.cos(lon - lont);
double sinlat = Math.sin(lat);
double coslat = Math.cos(lat);
double k = 2.0 * scale
/ (1.0 + sinlatt * sinlat + coslatt * coslat * cdlon);
toX = k * coslat * sdlon;
toY = k * (coslatt * sinlat - sinlatt * coslat * cdlon);
resultXA[i] = toX + falseEasting;
resultYA[i] = toY + falseNorthing;
}
return to;
} } | public class class_name {
public double[][] latLonToProj(double[][] from, double[][] to, int latIndex, int lonIndex) {
int cnt = from[0].length;
double[] fromLatA = from[latIndex];
double[] fromLonA = from[lonIndex];
double[] resultXA = to[INDEX_X];
double[] resultYA = to[INDEX_Y];
double toX, toY;
for (int i = 0; i < cnt; i++) {
double fromLat = fromLatA[i];
double fromLon = fromLonA[i];
double lat = Math.toRadians(fromLat);
double lon = Math.toRadians(fromLon);
// keep away from the singular point
if ((Math.abs(lat + latt) <= TOLERANCE)) {
lat = -latt * (1.0 - TOLERANCE);
// depends on control dependency: [if], data = [none]
}
double sdlon = Math.sin(lon - lont);
double cdlon = Math.cos(lon - lont);
double sinlat = Math.sin(lat);
double coslat = Math.cos(lat);
double k = 2.0 * scale
/ (1.0 + sinlatt * sinlat + coslatt * coslat * cdlon);
toX = k * coslat * sdlon;
// depends on control dependency: [for], data = [none]
toY = k * (coslatt * sinlat - sinlatt * coslat * cdlon);
// depends on control dependency: [for], data = [none]
resultXA[i] = toX + falseEasting;
// depends on control dependency: [for], data = [i]
resultYA[i] = toY + falseNorthing;
// depends on control dependency: [for], data = [i]
}
return to;
} } |
public class class_name {
@Override
public void setup(JavaStreamingContext jssc, CommandLine cli) throws Exception {
String filtersArg = cli.getOptionValue("tweetFilters");
String[] filters = (filtersArg != null) ? filtersArg.split(",") : new String[0];
// start receiving a stream of tweets ...
JavaReceiverInputDStream<Status> tweets =
TwitterUtils.createStream(jssc, null, filters);
String fusionUrl = cli.getOptionValue("fusion");
if (fusionUrl != null) {
// just send JSON directly to Fusion
SolrSupport.sendDStreamOfDocsToFusion(fusionUrl, cli.getOptionValue("fusionCredentials"), tweets.dstream(), batchSize);
} else {
// map incoming tweets into PipelineDocument objects for indexing in Solr
JavaDStream<SolrInputDocument> docs = tweets.map(
new Function<Status,SolrInputDocument>() {
/**
* Convert a twitter4j Status object into a SolrJ SolrInputDocument
*/
public SolrInputDocument call(Status status) {
if (log.isDebugEnabled()) {
log.debug("Received tweet: " + status.getId() + ": " + status.getText().replaceAll("\\s+", " "));
}
// simple mapping from primitives to dynamic Solr fields using reflection
SolrInputDocument doc =
SolrSupport.autoMapToSolrInputDoc("tweet-"+status.getId(), status, null);
doc.setField("provider_s", "twitter");
doc.setField("author_s", status.getUser().getScreenName());
doc.setField("type_s", status.isRetweet() ? "echo" : "post");
if (log.isDebugEnabled())
log.debug("Transformed document: " + doc.toString());
return doc;
}
}
);
// when ready, send the docs into a SolrCloud cluster
SolrSupport.indexDStreamOfDocs(zkHost, collection, batchSize, docs.dstream());
}
} } | public class class_name {
@Override
public void setup(JavaStreamingContext jssc, CommandLine cli) throws Exception {
String filtersArg = cli.getOptionValue("tweetFilters");
String[] filters = (filtersArg != null) ? filtersArg.split(",") : new String[0];
// start receiving a stream of tweets ...
JavaReceiverInputDStream<Status> tweets =
TwitterUtils.createStream(jssc, null, filters);
String fusionUrl = cli.getOptionValue("fusion");
if (fusionUrl != null) {
// just send JSON directly to Fusion
SolrSupport.sendDStreamOfDocsToFusion(fusionUrl, cli.getOptionValue("fusionCredentials"), tweets.dstream(), batchSize);
} else {
// map incoming tweets into PipelineDocument objects for indexing in Solr
JavaDStream<SolrInputDocument> docs = tweets.map(
new Function<Status,SolrInputDocument>() {
/**
* Convert a twitter4j Status object into a SolrJ SolrInputDocument
*/
public SolrInputDocument call(Status status) {
if (log.isDebugEnabled()) {
log.debug("Received tweet: " + status.getId() + ": " + status.getText().replaceAll("\\s+", " ")); // depends on control dependency: [if], data = [none]
}
// simple mapping from primitives to dynamic Solr fields using reflection
SolrInputDocument doc =
SolrSupport.autoMapToSolrInputDoc("tweet-"+status.getId(), status, null);
doc.setField("provider_s", "twitter");
doc.setField("author_s", status.getUser().getScreenName());
doc.setField("type_s", status.isRetweet() ? "echo" : "post");
if (log.isDebugEnabled())
log.debug("Transformed document: " + doc.toString());
return doc;
}
}
);
// when ready, send the docs into a SolrCloud cluster
SolrSupport.indexDStreamOfDocs(zkHost, collection, batchSize, docs.dstream());
}
} } |
public class class_name {
public void tagFile(String input,String output,String sep){
String s = tagFile(input,"\n");
try {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(
output), "utf-8");
BufferedWriter bw = new BufferedWriter(writer);
bw.write(s);
bw.close();
} catch (Exception e) {
System.out.println("写输出文件错误");
e.printStackTrace();
}
} } | public class class_name {
public void tagFile(String input,String output,String sep){
String s = tagFile(input,"\n");
try {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(
output), "utf-8");
BufferedWriter bw = new BufferedWriter(writer);
bw.write(s);
// depends on control dependency: [try], data = [none]
bw.close();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.out.println("写输出文件错误");
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public <R> R getHeader(String name, R defaultValue) {
if (headers().contains(name)) {
return getHeader(name);
} else {
return defaultValue;
}
} } | public class class_name {
public <R> R getHeader(String name, R defaultValue) {
if (headers().contains(name)) {
return getHeader(name); // depends on control dependency: [if], data = [none]
} else {
return defaultValue; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public OperationFuture<List<Group>> defineInfrastructure(InfrastructureConfig... configs) {
checkNotNull(configs, "array of InfrastructureConfig must be not null");
Arrays.asList(configs).stream()
.map(InfrastructureConfig::getAlertPolicies)
.flatMap(List::stream)
.forEach(alertConfig -> {
List<AlertPolicyMetadata> policies = policyService.alert().find(
new AlertPolicyFilter().names(alertConfig.getName())
);
if (policies.size() == 0) {
policyService.alert().create(alertConfig).waitUntilComplete();
}
}
);
List<OperationFuture<Group>> operationFutures = Arrays.asList(configs).stream()
.map(cfg ->
cfg.getDataCenters().stream()
.map(dc -> {
defineAntiAffinityPolicies(dc, cfg.getAntiAffinityPolicies());
return cfg.getSubitems().stream()
.map(subCfg -> defineGroupHierarchy(dc, subCfg))
.collect(toList());
}
)
.collect(toList())
)
.flatMap(List::stream)
.flatMap(List::stream)
.collect(toList());
List<Group> groups = operationFutures.stream()
.map(OperationFuture::getResult)
.collect(toList());
List<JobFuture> futures = operationFutures.stream()
.map(OperationFuture::jobFuture)
.collect(toList());
return new OperationFuture<>(groups, new ParallelJobsFuture(futures));
} } | public class class_name {
public OperationFuture<List<Group>> defineInfrastructure(InfrastructureConfig... configs) {
checkNotNull(configs, "array of InfrastructureConfig must be not null");
Arrays.asList(configs).stream()
.map(InfrastructureConfig::getAlertPolicies)
.flatMap(List::stream)
.forEach(alertConfig -> {
List<AlertPolicyMetadata> policies = policyService.alert().find(
new AlertPolicyFilter().names(alertConfig.getName())
);
if (policies.size() == 0) {
policyService.alert().create(alertConfig).waitUntilComplete(); // depends on control dependency: [if], data = [none]
}
}
);
List<OperationFuture<Group>> operationFutures = Arrays.asList(configs).stream()
.map(cfg ->
cfg.getDataCenters().stream()
.map(dc -> {
defineAntiAffinityPolicies(dc, cfg.getAntiAffinityPolicies());
return cfg.getSubitems().stream()
.map(subCfg -> defineGroupHierarchy(dc, subCfg))
.collect(toList());
}
)
.collect(toList())
)
.flatMap(List::stream)
.flatMap(List::stream)
.collect(toList());
List<Group> groups = operationFutures.stream()
.map(OperationFuture::getResult)
.collect(toList());
List<JobFuture> futures = operationFutures.stream()
.map(OperationFuture::jobFuture)
.collect(toList());
return new OperationFuture<>(groups, new ParallelJobsFuture(futures));
} } |
public class class_name {
static void push(Span span, boolean autoClose) {
if (isCurrent(span)) {
return;
}
setSpanContextInternal(new SpanContext(span, autoClose));
} } | public class class_name {
static void push(Span span, boolean autoClose) {
if (isCurrent(span)) {
return; // depends on control dependency: [if], data = [none]
}
setSpanContextInternal(new SpanContext(span, autoClose));
} } |
public class class_name {
public static LinkedList<Word> tokenize(Analyzer morphoAnalyzer, String chunk, boolean bruteSplit) {
if(bruteSplit)
{
LinkedList<Word> tokens = new LinkedList<Word>();
if (chunk == null) return tokens;
String[] parts_of_string = chunk.trim().split(" ");
for(String part : parts_of_string)
{
if (part.length()>0)
tokens.add( (morphoAnalyzer == null) ?
new Word(part) :
morphoAnalyzer.analyze(part));
}
return tokens;
}
else
{
return tokenize(morphoAnalyzer, chunk);
}
} } | public class class_name {
public static LinkedList<Word> tokenize(Analyzer morphoAnalyzer, String chunk, boolean bruteSplit) {
if(bruteSplit)
{
LinkedList<Word> tokens = new LinkedList<Word>();
if (chunk == null) return tokens;
String[] parts_of_string = chunk.trim().split(" ");
for(String part : parts_of_string)
{
if (part.length()>0)
tokens.add( (morphoAnalyzer == null) ?
new Word(part) :
morphoAnalyzer.analyze(part));
}
return tokens;
// depends on control dependency: [if], data = [none]
}
else
{
return tokenize(morphoAnalyzer, chunk);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void scheduleOnPostNotificationExecutor(@NonNull Runnable runnable, /* Milliseconds */ long delay) {
try { postExecutor.schedule(runnable, delay, TimeUnit.MILLISECONDS); }
catch (RejectedExecutionException ignore) { }
} } | public class class_name {
void scheduleOnPostNotificationExecutor(@NonNull Runnable runnable, /* Milliseconds */ long delay) {
try { postExecutor.schedule(runnable, delay, TimeUnit.MILLISECONDS); } // depends on control dependency: [try], data = [none]
catch (RejectedExecutionException ignore) { } // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean attachTimer(TimerID timerID) {
final Node node = getAttachedTimersNode(true);
if (!node.hasChild(timerID)) {
node.addChild(Fqn.fromElements(timerID));
return true;
}
else {
return false;
}
} } | public class class_name {
public boolean attachTimer(TimerID timerID) {
final Node node = getAttachedTimersNode(true);
if (!node.hasChild(timerID)) {
node.addChild(Fqn.fromElements(timerID)); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void trackDelayedAggregatedMetricsTenant(String tenantId, long collectionTimeMs, long delayTimeMs, List<String> delayedMetricNames) {
if (isTrackingDelayedMetrics) {
String logMessage = String.format("[TRACKER][DELAYED METRIC] Tenant sending delayed metrics %s", tenantId);
log.info(logMessage);
// log individual delayed metrics locator and collectionTime
double delayMin = delayTimeMs / 1000 / 60;
logMessage = String.format("[TRACKER][DELAYED METRIC] %s have collectionTime %s which is delayed by %.2f minutes",
StringUtils.join(delayedMetricNames, ","),
dateFormatter.format(new Date(collectionTimeMs)),
delayMin);
log.info(logMessage);
}
} } | public class class_name {
public void trackDelayedAggregatedMetricsTenant(String tenantId, long collectionTimeMs, long delayTimeMs, List<String> delayedMetricNames) {
if (isTrackingDelayedMetrics) {
String logMessage = String.format("[TRACKER][DELAYED METRIC] Tenant sending delayed metrics %s", tenantId);
log.info(logMessage); // depends on control dependency: [if], data = [none]
// log individual delayed metrics locator and collectionTime
double delayMin = delayTimeMs / 1000 / 60;
logMessage = String.format("[TRACKER][DELAYED METRIC] %s have collectionTime %s which is delayed by %.2f minutes",
StringUtils.join(delayedMetricNames, ","),
dateFormatter.format(new Date(collectionTimeMs)),
delayMin); // depends on control dependency: [if], data = [none]
log.info(logMessage); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized void shutdown() {
// mark this as no longer running
active = false;
// close the socket
try {
if (socketNode != null) {
socketNode.close();
socketNode = null;
}
} catch (Exception e) {
getLogger().info("Excpetion closing socket", e);
// ignore for now
}
// stop the connector
if (connector != null) {
connector.interrupted = true;
connector = null; // allow gc
}
if (advertiseViaMulticastDNS) {
zeroConf.unadvertise();
}
} } | public class class_name {
public synchronized void shutdown() {
// mark this as no longer running
active = false;
// close the socket
try {
if (socketNode != null) {
socketNode.close(); // depends on control dependency: [if], data = [none]
socketNode = null; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
getLogger().info("Excpetion closing socket", e);
// ignore for now
} // depends on control dependency: [catch], data = [none]
// stop the connector
if (connector != null) {
connector.interrupted = true; // depends on control dependency: [if], data = [none]
connector = null; // allow gc // depends on control dependency: [if], data = [none]
}
if (advertiseViaMulticastDNS) {
zeroConf.unadvertise(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void clearFacesEvents(FacesContext context) {
if (context.getRenderResponse() || context.getResponseComplete()) {
if (events != null) {
for (List<FacesEvent> eventList : events) {
if (eventList != null) {
eventList.clear();
}
}
events = null;
}
}
} } | public class class_name {
private void clearFacesEvents(FacesContext context) {
if (context.getRenderResponse() || context.getResponseComplete()) {
if (events != null) {
for (List<FacesEvent> eventList : events) {
if (eventList != null) {
eventList.clear(); // depends on control dependency: [if], data = [none]
}
}
events = null; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public EEnum getResourceObjectIncludeObjType() {
if (resourceObjectIncludeObjTypeEEnum == null) {
resourceObjectIncludeObjTypeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(189);
}
return resourceObjectIncludeObjTypeEEnum;
} } | public class class_name {
public EEnum getResourceObjectIncludeObjType() {
if (resourceObjectIncludeObjTypeEEnum == null) {
resourceObjectIncludeObjTypeEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(189); // depends on control dependency: [if], data = [none]
}
return resourceObjectIncludeObjTypeEEnum;
} } |
public class class_name {
public static void reset()
throws StartupException
{
try {
final InitialContext initCtx = new InitialContext();
final javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
Context.DBTYPE = (AbstractDatabase<?>) envCtx.lookup(INamingBinds.RESOURCE_DBTYPE);
Context.DATASOURCE = (DataSource) envCtx.lookup(INamingBinds.RESOURCE_DATASOURCE);
Context.TRANSMANAG = (TransactionManager) envCtx.lookup(INamingBinds.RESOURCE_TRANSMANAG);
try {
Context.TRANSMANAGTIMEOUT = 0;
final Map<?, ?> props = (Map<?, ?>) envCtx.lookup(INamingBinds.RESOURCE_CONFIGPROPERTIES);
if (props != null) {
final String transactionTimeoutString = (String) props.get(IeFapsProperties.TRANSACTIONTIMEOUT);
if (transactionTimeoutString != null) {
Context.TRANSMANAGTIMEOUT = Integer.parseInt(transactionTimeoutString);
}
}
} catch (final NamingException e) {
// this is actual no error, so nothing is presented
Context.TRANSMANAGTIMEOUT = 0;
}
} catch (final NamingException e) {
throw new StartupException("eFaps context could not be initialized", e);
}
} } | public class class_name {
public static void reset()
throws StartupException
{
try {
final InitialContext initCtx = new InitialContext();
final javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env");
Context.DBTYPE = (AbstractDatabase<?>) envCtx.lookup(INamingBinds.RESOURCE_DBTYPE);
Context.DATASOURCE = (DataSource) envCtx.lookup(INamingBinds.RESOURCE_DATASOURCE);
Context.TRANSMANAG = (TransactionManager) envCtx.lookup(INamingBinds.RESOURCE_TRANSMANAG);
try {
Context.TRANSMANAGTIMEOUT = 0;
final Map<?, ?> props = (Map<?, ?>) envCtx.lookup(INamingBinds.RESOURCE_CONFIGPROPERTIES);
if (props != null) {
final String transactionTimeoutString = (String) props.get(IeFapsProperties.TRANSACTIONTIMEOUT);
if (transactionTimeoutString != null) {
Context.TRANSMANAGTIMEOUT = Integer.parseInt(transactionTimeoutString); // depends on control dependency: [if], data = [(transactionTimeoutString]
}
}
} catch (final NamingException e) {
// this is actual no error, so nothing is presented
Context.TRANSMANAGTIMEOUT = 0;
}
} catch (final NamingException e) {
throw new StartupException("eFaps context could not be initialized", e);
}
} } |
public class class_name {
private void processParentPage(PageWrapper parentPage, PageModificationContext context) {
if (context.getDeletedPageKey() != null) {
// We have a deleted page. Remove its pointer from the parent.
parentPage.getPage().update(Collections.singletonList(PageEntry.noValue(context.getDeletedPageKey())));
parentPage.markNeedsFirstKeyUpdate();
} else {
// Update parent page's child pointers for modified pages.
val toUpdate = context.getUpdatedPagePointers().stream()
.map(pp -> new PageEntry(pp.getKey(), serializePointer(pp)))
.collect(Collectors.toList());
parentPage.getPage().update(toUpdate);
}
} } | public class class_name {
private void processParentPage(PageWrapper parentPage, PageModificationContext context) {
if (context.getDeletedPageKey() != null) {
// We have a deleted page. Remove its pointer from the parent.
parentPage.getPage().update(Collections.singletonList(PageEntry.noValue(context.getDeletedPageKey()))); // depends on control dependency: [if], data = [(context.getDeletedPageKey()]
parentPage.markNeedsFirstKeyUpdate(); // depends on control dependency: [if], data = [none]
} else {
// Update parent page's child pointers for modified pages.
val toUpdate = context.getUpdatedPagePointers().stream()
.map(pp -> new PageEntry(pp.getKey(), serializePointer(pp)))
.collect(Collectors.toList());
parentPage.getPage().update(toUpdate); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object readArrayRaw(byte type, int len, Object resultingArray) {
Class componentType = resultingArray.getClass().getComponentType();
if ( componentType == byte.class ) {
byte[] barr = (byte[]) resultingArray;
for ( int i = 0; i < len; i++ ) {
barr[i] = (byte) readRawInt(type);
}
} else if ( componentType == short.class ) {
short[] sArr = (short[]) resultingArray;
for ( int i = 0; i < len; i++ ) {
sArr[i] = (short) readRawInt(type);
}
} else if ( componentType == char.class ) {
char[] cArr = (char[]) resultingArray;
for (int i = 0; i < len; i++) {
cArr[i] = (char) readRawInt(type);
}
} else if ( componentType == int.class ) {
int[] iArr = (int[]) resultingArray;
for (int i = 0; i < len; i++) {
iArr[i] = (int) readRawInt(type);
}
} else if ( componentType == long.class ) {
long[] lArr = (long[]) resultingArray;
for (int i = 0; i < len; i++) {
lArr[i] = readRawInt(type);
}
} else if ( componentType == boolean.class ) {
boolean[] boolArr = (boolean[]) resultingArray;
for (int i = 0; i < len; i++) {
boolArr[i] = readRawInt(MinBin.INT_8) != 0;
}
} else
throw new RuntimeException("unsupported array type "+resultingArray.getClass().getName());
return resultingArray;
} } | public class class_name {
public Object readArrayRaw(byte type, int len, Object resultingArray) {
Class componentType = resultingArray.getClass().getComponentType();
if ( componentType == byte.class ) {
byte[] barr = (byte[]) resultingArray;
for ( int i = 0; i < len; i++ ) {
barr[i] = (byte) readRawInt(type); // depends on control dependency: [for], data = [i]
}
} else if ( componentType == short.class ) {
short[] sArr = (short[]) resultingArray;
for ( int i = 0; i < len; i++ ) {
sArr[i] = (short) readRawInt(type); // depends on control dependency: [for], data = [i]
}
} else if ( componentType == char.class ) {
char[] cArr = (char[]) resultingArray;
for (int i = 0; i < len; i++) {
cArr[i] = (char) readRawInt(type); // depends on control dependency: [for], data = [i]
}
} else if ( componentType == int.class ) {
int[] iArr = (int[]) resultingArray;
for (int i = 0; i < len; i++) {
iArr[i] = (int) readRawInt(type); // depends on control dependency: [for], data = [i]
}
} else if ( componentType == long.class ) {
long[] lArr = (long[]) resultingArray;
for (int i = 0; i < len; i++) {
lArr[i] = readRawInt(type); // depends on control dependency: [for], data = [i]
}
} else if ( componentType == boolean.class ) {
boolean[] boolArr = (boolean[]) resultingArray;
for (int i = 0; i < len; i++) {
boolArr[i] = readRawInt(MinBin.INT_8) != 0; // depends on control dependency: [for], data = [i]
}
} else
throw new RuntimeException("unsupported array type "+resultingArray.getClass().getName());
return resultingArray;
} } |
public class class_name {
public static void main(String[] args) {
try {
Path graknHome = Paths.get(Objects.requireNonNull(SystemProperty.CURRENT_DIRECTORY.value()));
Path graknProperties = Paths.get(Objects.requireNonNull(SystemProperty.CONFIGURATION_FILE.value()));
assertEnvironment(graknHome, graknProperties);
printGraknLogo();
Executor bootupProcessExecutor = new Executor();
GraknDaemon daemon = new GraknDaemon(
new Storage(bootupProcessExecutor, graknHome, graknProperties),
new Server(bootupProcessExecutor, graknHome, graknProperties)
);
daemon.run(args);
System.exit(0);
} catch (RuntimeException ex) {
LOG.error(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage(), ex);
System.out.println(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage());
System.err.println(ex.getMessage());
System.exit(1);
}
} } | public class class_name {
public static void main(String[] args) {
try {
Path graknHome = Paths.get(Objects.requireNonNull(SystemProperty.CURRENT_DIRECTORY.value()));
Path graknProperties = Paths.get(Objects.requireNonNull(SystemProperty.CONFIGURATION_FILE.value()));
assertEnvironment(graknHome, graknProperties); // depends on control dependency: [try], data = [none]
printGraknLogo(); // depends on control dependency: [try], data = [none]
Executor bootupProcessExecutor = new Executor();
GraknDaemon daemon = new GraknDaemon(
new Storage(bootupProcessExecutor, graknHome, graknProperties),
new Server(bootupProcessExecutor, graknHome, graknProperties)
);
daemon.run(args); // depends on control dependency: [try], data = [none]
System.exit(0); // depends on control dependency: [try], data = [none]
} catch (RuntimeException ex) {
LOG.error(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage(), ex);
System.out.println(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage());
System.err.println(ex.getMessage());
System.exit(1);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
synchronized void activate(ComponentContext componentContext) throws Exception {
this.componentContext = componentContext;
this.classAvailableTransformer = new ClassAvailableTransformer(this, instrumentation, includeBootstrap);
this.transformer = new ProbeClassFileTransformer(this, instrumentation, includeBootstrap);
this.proxyActivator = new MonitoringProxyActivator(componentContext.getBundleContext(), this, this.instrumentation);
this.proxyActivator.activate();
// The class available transformer is registered as retransform incapable
// to avoid having to keep track of which classes have been updated with
// static initializers and serialVersionUID fields. The probe transformer
// however, must run through the listener config every time a retransform
// occurs to allow it to discover new probes and replace currently active
// probes
//RTCD 89497-Update the set with the classes
for (Class<?> clazz : MonitoringUtility.loadMonitoringClasses(componentContext.getBundleContext().getBundle())) {
for (int i = 0; i < clazz.getMethods().length; i++) {
Annotation anno = ((clazz.getMethods()[i]).getAnnotation(ProbeSite.class));
if (anno != null) {
String temp = ((ProbeSite) anno).clazz();
probeMonitorSet.add(temp);
}
}
}
//Update to the set ended.
//RTC D89497 adding instrumentors moved below as the MonitoringUtility.loadMonitoringClasses
//was resulting in loading classes and in turn getting called during with transform process which
//might cause hang in some situations
this.instrumentation.addTransformer(this.transformer, true);
this.instrumentation.addTransformer(this.classAvailableTransformer);
// We're active so if we have any listeners, we can run down the loaded
// classes.
for (Class<?> clazz : this.instrumentation.getAllLoadedClasses()) {
classAvailable(clazz);
}
} } | public class class_name {
synchronized void activate(ComponentContext componentContext) throws Exception {
this.componentContext = componentContext;
this.classAvailableTransformer = new ClassAvailableTransformer(this, instrumentation, includeBootstrap);
this.transformer = new ProbeClassFileTransformer(this, instrumentation, includeBootstrap);
this.proxyActivator = new MonitoringProxyActivator(componentContext.getBundleContext(), this, this.instrumentation);
this.proxyActivator.activate();
// The class available transformer is registered as retransform incapable
// to avoid having to keep track of which classes have been updated with
// static initializers and serialVersionUID fields. The probe transformer
// however, must run through the listener config every time a retransform
// occurs to allow it to discover new probes and replace currently active
// probes
//RTCD 89497-Update the set with the classes
for (Class<?> clazz : MonitoringUtility.loadMonitoringClasses(componentContext.getBundleContext().getBundle())) {
for (int i = 0; i < clazz.getMethods().length; i++) {
Annotation anno = ((clazz.getMethods()[i]).getAnnotation(ProbeSite.class));
if (anno != null) {
String temp = ((ProbeSite) anno).clazz();
probeMonitorSet.add(temp); // depends on control dependency: [if], data = [none]
}
}
}
//Update to the set ended.
//RTC D89497 adding instrumentors moved below as the MonitoringUtility.loadMonitoringClasses
//was resulting in loading classes and in turn getting called during with transform process which
//might cause hang in some situations
this.instrumentation.addTransformer(this.transformer, true);
this.instrumentation.addTransformer(this.classAvailableTransformer);
// We're active so if we have any listeners, we can run down the loaded
// classes.
for (Class<?> clazz : this.instrumentation.getAllLoadedClasses()) {
classAvailable(clazz);
}
} } |
public class class_name {
@Override
public E doDeserialize( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
try {
return Enum.valueOf( enumClass, reader.nextString() );
} catch ( IllegalArgumentException ex ) {
if ( ctx.isReadUnknownEnumValuesAsNull() ) {
return null;
}
throw ex;
}
} } | public class class_name {
@Override
public E doDeserialize( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
try {
return Enum.valueOf( enumClass, reader.nextString() ); // depends on control dependency: [try], data = [none]
} catch ( IllegalArgumentException ex ) {
if ( ctx.isReadUnknownEnumValuesAsNull() ) {
return null; // depends on control dependency: [if], data = [none]
}
throw ex;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public TrieBuilder<T> addAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
add(entry.getKey(), entry.getValue());
}
return this;
} } | public class class_name {
public TrieBuilder<T> addAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
add(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
return this;
} } |
public class class_name {
public ElementDefinitionDt addCondition( String theId) {
if (myCondition == null) {
myCondition = new java.util.ArrayList<IdDt>();
}
myCondition.add(new IdDt(theId));
return this;
} } | public class class_name {
public ElementDefinitionDt addCondition( String theId) {
if (myCondition == null) {
myCondition = new java.util.ArrayList<IdDt>(); // depends on control dependency: [if], data = [none]
}
myCondition.add(new IdDt(theId));
return this;
} } |
public class class_name {
@Override public ProjectFile read(String accessDatabaseFileName) throws MPXJException
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + accessDatabaseFileName;
m_connection = DriverManager.getConnection(url);
m_projectID = Integer.valueOf(1);
return (read());
}
catch (ClassNotFoundException ex)
{
throw new MPXJException("Failed to load JDBC driver", ex);
}
catch (SQLException ex)
{
throw new MPXJException("Failed to create connection", ex);
}
finally
{
if (m_connection != null)
{
try
{
m_connection.close();
}
catch (SQLException ex)
{
// silently ignore exceptions when closing connection
}
}
}
} } | public class class_name {
@Override public ProjectFile read(String accessDatabaseFileName) throws MPXJException
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + accessDatabaseFileName;
m_connection = DriverManager.getConnection(url);
m_projectID = Integer.valueOf(1);
return (read());
}
catch (ClassNotFoundException ex)
{
throw new MPXJException("Failed to load JDBC driver", ex);
}
catch (SQLException ex)
{
throw new MPXJException("Failed to create connection", ex);
}
finally
{
if (m_connection != null)
{
try
{
m_connection.close(); // depends on control dependency: [try], data = [none]
}
catch (SQLException ex)
{
// silently ignore exceptions when closing connection
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private void doWork() {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "doWork: " + ivTimer);
TimedObjectWrapper timedObject;
try {
ivBeanId = ivBeanId.getInitializedBeanId(); // F743-506CodRev
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".doWork", "247", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "doWork: " + ex);
throw ExceptionUtil.EJBException(ex);
}
EJSHome home = (EJSHome) ivBeanId.home;
// Get the TimedObjectWrapper from the pool to execute the method.
timedObject = home.getTimedObjectWrapper(ivBeanId);
// Invoke ejbTimeout on the wrapper. No need to handle exceptions,
// as the wrapper will have already handled/mapped any exceptions
// as expected.
try {
ivTimer.ivTimeoutThread = Thread.currentThread(); // d595255
timedObject.invokeCallback(ivTimer, ivMethodId, false); // F743-506
} finally {
ivTimer.ivTimeoutThread = null; // d595255
// Always return the TimedObjectWrapper to the pool.
home.putTimedObjectWrapper(timedObject);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "doWork");
}
} } | public class class_name {
private void doWork() {
boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "doWork: " + ivTimer);
TimedObjectWrapper timedObject;
try {
ivBeanId = ivBeanId.getInitializedBeanId(); // F743-506CodRev // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
FFDCFilter.processException(ex, CLASS_NAME + ".doWork", "247", this);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "doWork: " + ex);
throw ExceptionUtil.EJBException(ex);
} // depends on control dependency: [catch], data = [none]
EJSHome home = (EJSHome) ivBeanId.home;
// Get the TimedObjectWrapper from the pool to execute the method.
timedObject = home.getTimedObjectWrapper(ivBeanId);
// Invoke ejbTimeout on the wrapper. No need to handle exceptions,
// as the wrapper will have already handled/mapped any exceptions
// as expected.
try {
ivTimer.ivTimeoutThread = Thread.currentThread(); // d595255 // depends on control dependency: [try], data = [none]
timedObject.invokeCallback(ivTimer, ivMethodId, false); // F743-506 // depends on control dependency: [try], data = [none]
} finally {
ivTimer.ivTimeoutThread = null; // d595255
// Always return the TimedObjectWrapper to the pool.
home.putTimedObjectWrapper(timedObject);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "doWork");
}
} } |
public class class_name {
public List<StepCandidate> collectCandidates(List<CandidateSteps> candidateSteps) {
List<StepCandidate> collected = new ArrayList<>();
for (CandidateSteps steps : candidateSteps) {
collected.addAll(steps.listCandidates());
}
return collected;
} } | public class class_name {
public List<StepCandidate> collectCandidates(List<CandidateSteps> candidateSteps) {
List<StepCandidate> collected = new ArrayList<>();
for (CandidateSteps steps : candidateSteps) {
collected.addAll(steps.listCandidates()); // depends on control dependency: [for], data = [steps]
}
return collected;
} } |
public class class_name {
public EClass getGCCBEZRG() {
if (gccbezrgEClass == null) {
gccbezrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(493);
}
return gccbezrgEClass;
} } | public class class_name {
public EClass getGCCBEZRG() {
if (gccbezrgEClass == null) {
gccbezrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(493); // depends on control dependency: [if], data = [none]
}
return gccbezrgEClass;
} } |
public class class_name {
private static String _formatSizeForRead(long size, double SZU) {
if (size < SZU) {
return String.format("%d bytes", size);
}
double n = (double) size / SZU;
if (n < SZU) {
return String.format("%5.2f KB", n);
}
n = n / SZU;
if (n < SZU) {
return String.format("%5.2f MB", n);
}
n = n / SZU;
return String.format("%5.2f GB", n);
} } | public class class_name {
private static String _formatSizeForRead(long size, double SZU) {
if (size < SZU) {
return String.format("%d bytes", size); // depends on control dependency: [if], data = [none]
}
double n = (double) size / SZU;
if (n < SZU) {
return String.format("%5.2f KB", n); // depends on control dependency: [if], data = [none]
}
n = n / SZU;
if (n < SZU) {
return String.format("%5.2f MB", n); // depends on control dependency: [if], data = [none]
}
n = n / SZU;
return String.format("%5.2f GB", n);
} } |
public class class_name {
public static void main(String[] args) {
if (args.length < 2) {
throw new IllegalArgumentException("Path and datasource are Mandatory");
}
String workspacePath = args[0];
String databaseName = args[1];
String sourcePath = workspacePath + File.separator + ProjectMetaDataDao.DATA_MODEL_FOLDER_NAME;
try(FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext("classpath:applicationContext-generator-bash.xml", "file:" + sourcePath + File.separator + DATASOURCE_CONTEXT_FILE);){
logger.info("Context loaded");
Project project;
try {
logger.info("start loading project");
ProjectMetaDataService projectMetaDataService = appContext.getBean(ProjectMetaDataService.class);
ProjectLoader projectLoader = appContext.getBean(ProjectLoader.class);
ProjectMetaData projectMetaData = projectMetaDataService.loadProjectMetaData(workspacePath);
ProjectValidationReport report = projectMetaDataService.validate(projectMetaData);
ValidationPrompter.promptOnValidation(report);
project = projectLoader.loadProject(projectMetaData);
logger.info("loading project " + project.projectName + " completed");
} catch (Exception e) {
logger.error("failed", e);
return;
}
try {
OutputDataSourceProvider outputDataSourceProvider = appContext.getBean(OutputDataSourceProvider.class);
DataSource dataSource = outputDataSourceProvider.getDataSource(databaseName);
DatabaseBuilder databaseBuilder = appContext.getBean(DatabaseBuilder.class);
databaseBuilder.buildDatabase(dataSource, project);
} catch (Exception e) {
logger.error("failed", e);
return;
}
}
} } | public class class_name {
public static void main(String[] args) {
if (args.length < 2) {
throw new IllegalArgumentException("Path and datasource are Mandatory");
}
String workspacePath = args[0];
String databaseName = args[1];
String sourcePath = workspacePath + File.separator + ProjectMetaDataDao.DATA_MODEL_FOLDER_NAME;
try(FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext("classpath:applicationContext-generator-bash.xml", "file:" + sourcePath + File.separator + DATASOURCE_CONTEXT_FILE);){
logger.info("Context loaded");
Project project;
try {
logger.info("start loading project");
// depends on control dependency: [try], data = [none]
ProjectMetaDataService projectMetaDataService = appContext.getBean(ProjectMetaDataService.class);
ProjectLoader projectLoader = appContext.getBean(ProjectLoader.class);
ProjectMetaData projectMetaData = projectMetaDataService.loadProjectMetaData(workspacePath);
ProjectValidationReport report = projectMetaDataService.validate(projectMetaData);
ValidationPrompter.promptOnValidation(report);
// depends on control dependency: [try], data = [none]
project = projectLoader.loadProject(projectMetaData);
// depends on control dependency: [try], data = [none]
logger.info("loading project " + project.projectName + " completed");
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("failed", e);
return;
}
// depends on control dependency: [catch], data = [none]
try {
OutputDataSourceProvider outputDataSourceProvider = appContext.getBean(OutputDataSourceProvider.class);
DataSource dataSource = outputDataSourceProvider.getDataSource(databaseName);
DatabaseBuilder databaseBuilder = appContext.getBean(DatabaseBuilder.class);
databaseBuilder.buildDatabase(dataSource, project);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("failed", e);
return;
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Pure
public DoubleProperty x1Property() {
if (this.p1.x == null) {
this.p1.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X1);
}
return this.p1.x;
} } | public class class_name {
@Pure
public DoubleProperty x1Property() {
if (this.p1.x == null) {
this.p1.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X1); // depends on control dependency: [if], data = [none]
}
return this.p1.x;
} } |
public class class_name {
public int getActiveTab() {
if (m_activeTab < 0) {
String paramTab = getParamTab();
int tab = 1;
if (CmsStringUtil.isNotEmpty(paramTab)) {
try {
tab = Integer.parseInt(paramTab);
} catch (NumberFormatException e) {
// do nothing, the first tab is returned
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage());
}
}
}
setParamTab("" + tab);
m_activeTab = tab;
return tab;
} else {
return m_activeTab;
}
} } | public class class_name {
public int getActiveTab() {
if (m_activeTab < 0) {
String paramTab = getParamTab();
int tab = 1;
if (CmsStringUtil.isNotEmpty(paramTab)) {
try {
tab = Integer.parseInt(paramTab); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// do nothing, the first tab is returned
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
setParamTab("" + tab); // depends on control dependency: [if], data = [none]
m_activeTab = tab; // depends on control dependency: [if], data = [none]
return tab; // depends on control dependency: [if], data = [none]
} else {
return m_activeTab; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private KeyToken key(Token prev) {
// Store keys as normal Strings; we don't want keys to contain spans.
StringBuilder sb = new StringBuilder();
// Consume the opening '{'.
consume();
while ((curChar >= 'a' && curChar <= 'z') || curChar == '_') {
sb.append(curChar);
consume();
}
// Consume the closing '}'.
if (curChar != '}') {
throw new IllegalArgumentException("Unexpected character '" + curChar
+ "'; expecting lower case a-z, '_', or '}'");
}
consume();
// Disallow empty keys: {}.
if (sb.length() == 0) {
throw new IllegalArgumentException("Empty key: {}");
}
String key = sb.toString();
keys.add(key);
return new KeyToken(prev, key);
} } | public class class_name {
private KeyToken key(Token prev) {
// Store keys as normal Strings; we don't want keys to contain spans.
StringBuilder sb = new StringBuilder();
// Consume the opening '{'.
consume();
while ((curChar >= 'a' && curChar <= 'z') || curChar == '_') {
sb.append(curChar); // depends on control dependency: [while], data = [none]
consume(); // depends on control dependency: [while], data = [none]
}
// Consume the closing '}'.
if (curChar != '}') {
throw new IllegalArgumentException("Unexpected character '" + curChar
+ "'; expecting lower case a-z, '_', or '}'");
}
consume();
// Disallow empty keys: {}.
if (sb.length() == 0) {
throw new IllegalArgumentException("Empty key: {}");
}
String key = sb.toString();
keys.add(key);
return new KeyToken(prev, key);
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.