code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
protected void initSynchronizations(Element root, CmsXmlContentDefinition contentDefinition) {
List<Element> elements = new ArrayList<Element>(CmsXmlGenericWrapper.elements(root, APPINFO_SYNCHRONIZATION));
for (Element element : elements) {
String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT);
m_synchronizations.add(elementName);
}
} } | public class class_name {
protected void initSynchronizations(Element root, CmsXmlContentDefinition contentDefinition) {
List<Element> elements = new ArrayList<Element>(CmsXmlGenericWrapper.elements(root, APPINFO_SYNCHRONIZATION));
for (Element element : elements) {
String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT);
m_synchronizations.add(elementName); // depends on control dependency: [for], data = [element]
}
} } |
public class class_name {
public java.util.List<Artwork> getArtwork() {
if (artwork == null) {
artwork = new com.amazonaws.internal.SdkInternalList<Artwork>();
}
return artwork;
} } | public class class_name {
public java.util.List<Artwork> getArtwork() {
if (artwork == null) {
artwork = new com.amazonaws.internal.SdkInternalList<Artwork>(); // depends on control dependency: [if], data = [none]
}
return artwork;
} } |
public class class_name {
private int countCharsStart(final char ch, final boolean allowSpaces)
{
int count = 0;
for (int i = 0; i < this.value.length(); i++)
{
final char c = this.value.charAt(i);
if (c == ' ' && allowSpaces)
{
continue;
}
if (c == ch)
{
count++;
}
else
{
break;
}
}
return count;
} } | public class class_name {
private int countCharsStart(final char ch, final boolean allowSpaces)
{
int count = 0;
for (int i = 0; i < this.value.length(); i++)
{
final char c = this.value.charAt(i);
if (c == ' ' && allowSpaces)
{
continue;
}
if (c == ch)
{
count++; // depends on control dependency: [if], data = [none]
}
else
{
break;
}
}
return count;
} } |
public class class_name {
public static String getCookieValue(String name, Cookies cookies) {
Cookie c = cookies.get(name);
if (c != null) {
return c.value();
}
return null;
} } | public class class_name {
public static String getCookieValue(String name, Cookies cookies) {
Cookie c = cookies.get(name);
if (c != null) {
return c.value(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName) {
if (!Character.isDefined(codePoint))
throw new IllegalArgumentException(String.format("Given code point [U+%1$04X - %1$d] not assigned to an abstract character.", codePoint));
if (Character.getType(codePoint) == Character.SURROGATE)
throw new IllegalArgumentException(String.format("Given code point [U+%1$04X - %1$d] is an unencodable (by itself) surrogate character.", codePoint));
Charset charset = Charset.availableCharsets().get(charsetName);
if (charset == null)
throw new IllegalArgumentException(String.format("Unsupported charset [%s].", charsetName));
char[] chars = Character.toChars(codePoint);
ByteBuffer byteBuffer = null;
try {
byteBuffer = charset.newEncoder().encode(CharBuffer.wrap(chars));
} catch (CharacterCodingException e) {
String message = String.format("Given code point [U+%1$04X - %1$d] cannot be encode in given charset [%2$s].", codePoint, charsetName);
throw new IllegalArgumentException(message, e);
}
byteBuffer.rewind();
StringBuilder encodedString = new StringBuilder();
for (int i = 0; i < byteBuffer.limit(); i++) {
String asHex = Integer.toHexString(byteBuffer.get() & 0xFF);
encodedString.append("%").append(asHex.length() == 1 ? "0" : "").append(asHex);
}
return encodedString.toString();
} } | public class class_name {
public static String unicodeCodePoint2PercentHexString(int codePoint, String charsetName) {
if (!Character.isDefined(codePoint))
throw new IllegalArgumentException(String.format("Given code point [U+%1$04X - %1$d] not assigned to an abstract character.", codePoint));
if (Character.getType(codePoint) == Character.SURROGATE)
throw new IllegalArgumentException(String.format("Given code point [U+%1$04X - %1$d] is an unencodable (by itself) surrogate character.", codePoint));
Charset charset = Charset.availableCharsets().get(charsetName);
if (charset == null)
throw new IllegalArgumentException(String.format("Unsupported charset [%s].", charsetName));
char[] chars = Character.toChars(codePoint);
ByteBuffer byteBuffer = null;
try {
byteBuffer = charset.newEncoder().encode(CharBuffer.wrap(chars)); // depends on control dependency: [try], data = [none]
} catch (CharacterCodingException e) {
String message = String.format("Given code point [U+%1$04X - %1$d] cannot be encode in given charset [%2$s].", codePoint, charsetName);
throw new IllegalArgumentException(message, e);
} // depends on control dependency: [catch], data = [none]
byteBuffer.rewind();
StringBuilder encodedString = new StringBuilder();
for (int i = 0; i < byteBuffer.limit(); i++) {
String asHex = Integer.toHexString(byteBuffer.get() & 0xFF);
encodedString.append("%").append(asHex.length() == 1 ? "0" : "").append(asHex); // depends on control dependency: [for], data = [none]
}
return encodedString.toString();
} } |
public class class_name {
@Override
protected void encode() {
eciProcess();
// mode 2 -> mode 3 if postal code isn't strictly numeric
if (mode == 2) {
for (int i = 0; i < 10 && i < primaryData.length(); i++) {
if ((primaryData.charAt(i) < '0') || (primaryData.charAt(i) > '9')) {
mode = 3;
break;
}
}
}
// initialize the set and character arrays
processText();
// start building the codeword array, starting with a copy of the character data
// insert primary message if this is a structured carrier message; insert mode otherwise
codewords = Arrays.copyOf(character, character.length);
if (mode == 2 || mode == 3) {
int[] primary = getPrimaryCodewords();
codewords = insertArray(codewords, 0, primary);
} else {
codewords = insertArray(codewords, 0, new int[] { mode });
}
// insert structured append flag if necessary
if (structuredAppendTotal > 1) {
int[] flag = new int[2];
flag[0] = 33; // padding
flag[1] = ((structuredAppendPosition - 1) << 3) | (structuredAppendTotal - 1); // position + total
int index;
if (mode == 2 || mode == 3) {
index = 10; // first two data symbols in the secondary message
} else {
index = 1; // first two data symbols in the primary message (first symbol at index 0 isn't a data symbol)
}
codewords = insertArray(codewords, index, flag);
}
int secondaryMax, secondaryECMax;
if (mode == 5) {
// 68 data codewords, 56 error corrections in secondary message
secondaryMax = 68;
secondaryECMax = 56;
} else {
// 84 data codewords, 40 error corrections in secondary message
secondaryMax = 84;
secondaryECMax = 40;
}
// truncate data codewords to maximum data space available
int totalMax = secondaryMax + 10;
if (codewords.length > totalMax) {
codewords = Arrays.copyOfRange(codewords, 0, totalMax);
}
// insert primary error correction between primary message and secondary message (always EEC)
int[] primary = Arrays.copyOfRange(codewords, 0, 10);
int[] primaryCheck = getErrorCorrection(primary, 10);
codewords = insertArray(codewords, 10, primaryCheck);
// calculate secondary error correction
int[] secondary = Arrays.copyOfRange(codewords, 20, codewords.length);
int[] secondaryOdd = new int[secondary.length / 2];
int[] secondaryEven = new int[secondary.length / 2];
for (int i = 0; i < secondary.length; i++) {
if ((i & 1) != 0) { // odd
secondaryOdd[(i - 1) / 2] = secondary[i];
} else { // even
secondaryEven[i / 2] = secondary[i];
}
}
int[] secondaryECOdd = getErrorCorrection(secondaryOdd, secondaryECMax / 2);
int[] secondaryECEven = getErrorCorrection(secondaryEven, secondaryECMax / 2);
// add secondary error correction after secondary message
codewords = Arrays.copyOf(codewords, codewords.length + secondaryECOdd.length + secondaryECEven.length);
for (int i = 0; i < secondaryECOdd.length; i++) {
codewords[20 + secondaryMax + (2 * i) + 1] = secondaryECOdd[i];
}
for (int i = 0; i < secondaryECEven.length; i++) {
codewords[20 + secondaryMax + (2 * i)] = secondaryECEven[i];
}
encodeInfo += "Mode: " + mode + "\n";
encodeInfo += "ECC Codewords: " + secondaryECMax + "\n";
encodeInfo += "Codewords: ";
for (int i = 0; i < codewords.length; i++) {
encodeInfo += Integer.toString(codewords[i]) + " ";
}
encodeInfo += "\n";
// copy data into symbol grid
int[] bit_pattern = new int[7];
for (int i = 0; i < 33; i++) {
for (int j = 0; j < 30; j++) {
int block = (MAXICODE_GRID[(i * 30) + j] + 5) / 6;
int bit = (MAXICODE_GRID[(i * 30) + j] + 5) % 6;
if (block != 0) {
bit_pattern[0] = (codewords[block - 1] & 0x20) >> 5;
bit_pattern[1] = (codewords[block - 1] & 0x10) >> 4;
bit_pattern[2] = (codewords[block - 1] & 0x8) >> 3;
bit_pattern[3] = (codewords[block - 1] & 0x4) >> 2;
bit_pattern[4] = (codewords[block - 1] & 0x2) >> 1;
bit_pattern[5] = (codewords[block - 1] & 0x1);
if (bit_pattern[bit] != 0) {
grid[i][j] = true;
} else {
grid[i][j] = false;
}
}
}
}
// add orientation markings
grid[0][28] = true; // top right filler
grid[0][29] = true;
grid[9][10] = true; // top left marker
grid[9][11] = true;
grid[10][11] = true;
grid[15][7] = true; // left hand marker
grid[16][8] = true;
grid[16][20] = true; // right hand marker
grid[17][20] = true;
grid[22][10] = true; // bottom left marker
grid[23][10] = true;
grid[22][17] = true; // bottom right marker
grid[23][17] = true;
// the following is provided for compatibility, but the results are not useful
row_count = 33;
readable = "";
pattern = new String[33];
row_height = new int[33];
for (int i = 0; i < 33; i++) {
StringBuilder bin = new StringBuilder(30);
for (int j = 0; j < 30; j++) {
if (grid[i][j]) {
bin.append("1");
} else {
bin.append("0");
}
}
pattern[i] = bin2pat(bin.toString());
row_height[i] = 1;
}
symbol_height = 72;
symbol_width = 74;
} } | public class class_name {
@Override
protected void encode() {
eciProcess();
// mode 2 -> mode 3 if postal code isn't strictly numeric
if (mode == 2) {
for (int i = 0; i < 10 && i < primaryData.length(); i++) {
if ((primaryData.charAt(i) < '0') || (primaryData.charAt(i) > '9')) {
mode = 3;
// depends on control dependency: [if], data = [none]
break;
}
}
}
// initialize the set and character arrays
processText();
// start building the codeword array, starting with a copy of the character data
// insert primary message if this is a structured carrier message; insert mode otherwise
codewords = Arrays.copyOf(character, character.length);
if (mode == 2 || mode == 3) {
int[] primary = getPrimaryCodewords();
codewords = insertArray(codewords, 0, primary);
// depends on control dependency: [if], data = [none]
} else {
codewords = insertArray(codewords, 0, new int[] { mode });
// depends on control dependency: [if], data = [none]
}
// insert structured append flag if necessary
if (structuredAppendTotal > 1) {
int[] flag = new int[2];
flag[0] = 33; // padding
// depends on control dependency: [if], data = [none]
flag[1] = ((structuredAppendPosition - 1) << 3) | (structuredAppendTotal - 1); // position + total
// depends on control dependency: [if], data = [(structuredAppendTotal]
int index;
if (mode == 2 || mode == 3) {
index = 10; // first two data symbols in the secondary message
// depends on control dependency: [if], data = [none]
} else {
index = 1; // first two data symbols in the primary message (first symbol at index 0 isn't a data symbol)
// depends on control dependency: [if], data = [none]
}
codewords = insertArray(codewords, index, flag);
// depends on control dependency: [if], data = [none]
}
int secondaryMax, secondaryECMax;
if (mode == 5) {
// 68 data codewords, 56 error corrections in secondary message
secondaryMax = 68;
// depends on control dependency: [if], data = [none]
secondaryECMax = 56;
// depends on control dependency: [if], data = [none]
} else {
// 84 data codewords, 40 error corrections in secondary message
secondaryMax = 84;
// depends on control dependency: [if], data = [none]
secondaryECMax = 40;
// depends on control dependency: [if], data = [none]
}
// truncate data codewords to maximum data space available
int totalMax = secondaryMax + 10;
if (codewords.length > totalMax) {
codewords = Arrays.copyOfRange(codewords, 0, totalMax);
// depends on control dependency: [if], data = [totalMax)]
}
// insert primary error correction between primary message and secondary message (always EEC)
int[] primary = Arrays.copyOfRange(codewords, 0, 10);
int[] primaryCheck = getErrorCorrection(primary, 10);
codewords = insertArray(codewords, 10, primaryCheck);
// calculate secondary error correction
int[] secondary = Arrays.copyOfRange(codewords, 20, codewords.length);
int[] secondaryOdd = new int[secondary.length / 2];
int[] secondaryEven = new int[secondary.length / 2];
for (int i = 0; i < secondary.length; i++) {
if ((i & 1) != 0) { // odd
secondaryOdd[(i - 1) / 2] = secondary[i];
// depends on control dependency: [if], data = [none]
} else { // even
secondaryEven[i / 2] = secondary[i];
// depends on control dependency: [if], data = [none]
}
}
int[] secondaryECOdd = getErrorCorrection(secondaryOdd, secondaryECMax / 2);
int[] secondaryECEven = getErrorCorrection(secondaryEven, secondaryECMax / 2);
// add secondary error correction after secondary message
codewords = Arrays.copyOf(codewords, codewords.length + secondaryECOdd.length + secondaryECEven.length);
for (int i = 0; i < secondaryECOdd.length; i++) {
codewords[20 + secondaryMax + (2 * i) + 1] = secondaryECOdd[i];
// depends on control dependency: [for], data = [i]
}
for (int i = 0; i < secondaryECEven.length; i++) {
codewords[20 + secondaryMax + (2 * i)] = secondaryECEven[i];
// depends on control dependency: [for], data = [i]
}
encodeInfo += "Mode: " + mode + "\n";
encodeInfo += "ECC Codewords: " + secondaryECMax + "\n";
encodeInfo += "Codewords: ";
for (int i = 0; i < codewords.length; i++) {
encodeInfo += Integer.toString(codewords[i]) + " ";
// depends on control dependency: [for], data = [i]
}
encodeInfo += "\n";
// copy data into symbol grid
int[] bit_pattern = new int[7];
for (int i = 0; i < 33; i++) {
for (int j = 0; j < 30; j++) {
int block = (MAXICODE_GRID[(i * 30) + j] + 5) / 6;
int bit = (MAXICODE_GRID[(i * 30) + j] + 5) % 6;
if (block != 0) {
bit_pattern[0] = (codewords[block - 1] & 0x20) >> 5;
// depends on control dependency: [if], data = [0)]
bit_pattern[1] = (codewords[block - 1] & 0x10) >> 4;
// depends on control dependency: [if], data = [0)]
bit_pattern[2] = (codewords[block - 1] & 0x8) >> 3;
// depends on control dependency: [if], data = [none]
bit_pattern[3] = (codewords[block - 1] & 0x4) >> 2;
// depends on control dependency: [if], data = [none]
bit_pattern[4] = (codewords[block - 1] & 0x2) >> 1;
// depends on control dependency: [if], data = [none]
bit_pattern[5] = (codewords[block - 1] & 0x1);
// depends on control dependency: [if], data = [none]
if (bit_pattern[bit] != 0) {
grid[i][j] = true;
// depends on control dependency: [if], data = [none]
} else {
grid[i][j] = false;
// depends on control dependency: [if], data = [none]
}
}
}
}
// add orientation markings
grid[0][28] = true; // top right filler
grid[0][29] = true;
grid[9][10] = true; // top left marker
grid[9][11] = true;
grid[10][11] = true;
grid[15][7] = true; // left hand marker
grid[16][8] = true;
grid[16][20] = true; // right hand marker
grid[17][20] = true;
grid[22][10] = true; // bottom left marker
grid[23][10] = true;
grid[22][17] = true; // bottom right marker
grid[23][17] = true;
// the following is provided for compatibility, but the results are not useful
row_count = 33;
readable = "";
pattern = new String[33];
row_height = new int[33];
for (int i = 0; i < 33; i++) {
StringBuilder bin = new StringBuilder(30);
for (int j = 0; j < 30; j++) {
if (grid[i][j]) {
bin.append("1");
// depends on control dependency: [if], data = [none]
} else {
bin.append("0");
// depends on control dependency: [if], data = [none]
}
}
pattern[i] = bin2pat(bin.toString());
// depends on control dependency: [for], data = [i]
row_height[i] = 1;
// depends on control dependency: [for], data = [i]
}
symbol_height = 72;
symbol_width = 74;
} } |
public class class_name {
void exportToVariable(Object result) throws JspTagException {
/*
* Store the result, letting an IllegalArgumentException
* propagate back if the scope is invalid (e.g., if an attempt
* is made to store something in the session without any
* HttpSession existing).
*/
int scopeValue = Util.getScope(scope);
ELContext myELContext = pageContext.getELContext();
VariableMapper vm = myELContext.getVariableMapper();
if (result != null) {
// if the result is a ValueExpression we just export to the mapper
if (result instanceof ValueExpression) {
if (scopeValue != PageContext.PAGE_SCOPE) {
throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
}
vm.setVariable(var, (ValueExpression) result);
} else {
// make sure to remove it from the VariableMapper if we will be setting into page scope
if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
pageContext.setAttribute(var, result, scopeValue);
}
} else {
//make sure to remove it from the Var mapper
if (vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
if (scope != null) {
pageContext.removeAttribute(var, Util.getScope(scope));
} else {
pageContext.removeAttribute(var);
}
}
} } | public class class_name {
void exportToVariable(Object result) throws JspTagException {
/*
* Store the result, letting an IllegalArgumentException
* propagate back if the scope is invalid (e.g., if an attempt
* is made to store something in the session without any
* HttpSession existing).
*/
int scopeValue = Util.getScope(scope);
ELContext myELContext = pageContext.getELContext();
VariableMapper vm = myELContext.getVariableMapper();
if (result != null) {
// if the result is a ValueExpression we just export to the mapper
if (result instanceof ValueExpression) {
if (scopeValue != PageContext.PAGE_SCOPE) {
throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
}
vm.setVariable(var, (ValueExpression) result);
} else {
// make sure to remove it from the VariableMapper if we will be setting into page scope
if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
vm.setVariable(var, null); // depends on control dependency: [if], data = [none]
}
pageContext.setAttribute(var, result, scopeValue);
}
} else {
//make sure to remove it from the Var mapper
if (vm.resolveVariable(var) != null) {
vm.setVariable(var, null);
}
if (scope != null) {
pageContext.removeAttribute(var, Util.getScope(scope));
} else {
pageContext.removeAttribute(var);
}
}
} } |
public class class_name {
public void getGroupHistories(final List<String> groupIds, final Integer maxMessages,
final GroupHistoriesCompletionListener completionListener) {
if (!isConnected()) {
getGroupHistoriesError(completionListener, "Can't complete request when not connected, " +
"Please reconnect!");
return;
}
if ((maxMessages == null) || (maxMessages < 1)) {
getGroupHistoriesError(completionListener, "maxMessages must be at least 1");
return;
}
if ((groupIds == null) || (groupIds.size() == 0)) {
getGroupHistoriesError(completionListener, "At least 1 group must be specified");
return;
}
JSONObject body = new JSONObject();
try {
body.put("limit", maxMessages.toString());
JSONArray groupIdParams = new JSONArray(groupIds);
body.put("groupIds", groupIdParams);
} catch(JSONException e) {
getGroupHistoriesError(completionListener, "Error forming JSON body to send.");
return;
}
// This has been modifed to use the newer group-history-search route over the
// deprecated group-histories route.
String urlEndpoint = "/v1/group-history-search";
signalingChannel.sendRESTMessage("post", urlEndpoint, body,
new RespokeSignalingChannel.RESTListener() {
@Override
public void onSuccess(Object response) {
if (!(response instanceof JSONObject)) {
getGroupHistoriesError(completionListener, "Invalid response from server");
return;
}
final JSONObject json = (JSONObject) response;
final HashMap<String, List<RespokeGroupMessage>> results = new HashMap<>();
for (Iterator<String> keys = json.keys(); keys.hasNext();) {
final String key = keys.next();
try {
final JSONArray jsonMessages = json.getJSONArray(key);
final ArrayList<RespokeGroupMessage> messageList =
new ArrayList<>(jsonMessages.length());
for (int i = 0; i < jsonMessages.length(); i++) {
final JSONObject jsonMessage = jsonMessages.getJSONObject(i);
final RespokeGroupMessage message = buildGroupMessage(jsonMessage);
messageList.add(message);
}
results.put(key, messageList);
} catch (JSONException e) {
getGroupHistoriesError(completionListener, "Error parsing JSON response");
return;
}
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (completionListener != null) {
completionListener.onSuccess(results);
}
}
});
}
@Override
public void onError(final String errorMessage) {
getGroupHistoriesError(completionListener, errorMessage);
}
});
} } | public class class_name {
public void getGroupHistories(final List<String> groupIds, final Integer maxMessages,
final GroupHistoriesCompletionListener completionListener) {
if (!isConnected()) {
getGroupHistoriesError(completionListener, "Can't complete request when not connected, " +
"Please reconnect!"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if ((maxMessages == null) || (maxMessages < 1)) {
getGroupHistoriesError(completionListener, "maxMessages must be at least 1"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if ((groupIds == null) || (groupIds.size() == 0)) {
getGroupHistoriesError(completionListener, "At least 1 group must be specified"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
JSONObject body = new JSONObject();
try {
body.put("limit", maxMessages.toString()); // depends on control dependency: [try], data = [none]
JSONArray groupIdParams = new JSONArray(groupIds);
body.put("groupIds", groupIdParams); // depends on control dependency: [try], data = [none]
} catch(JSONException e) {
getGroupHistoriesError(completionListener, "Error forming JSON body to send.");
return;
} // depends on control dependency: [catch], data = [none]
// This has been modifed to use the newer group-history-search route over the
// deprecated group-histories route.
String urlEndpoint = "/v1/group-history-search";
signalingChannel.sendRESTMessage("post", urlEndpoint, body,
new RespokeSignalingChannel.RESTListener() {
@Override
public void onSuccess(Object response) {
if (!(response instanceof JSONObject)) {
getGroupHistoriesError(completionListener, "Invalid response from server"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final JSONObject json = (JSONObject) response;
final HashMap<String, List<RespokeGroupMessage>> results = new HashMap<>();
for (Iterator<String> keys = json.keys(); keys.hasNext();) {
final String key = keys.next();
try {
final JSONArray jsonMessages = json.getJSONArray(key);
final ArrayList<RespokeGroupMessage> messageList =
new ArrayList<>(jsonMessages.length());
for (int i = 0; i < jsonMessages.length(); i++) {
final JSONObject jsonMessage = jsonMessages.getJSONObject(i);
final RespokeGroupMessage message = buildGroupMessage(jsonMessage);
messageList.add(message); // depends on control dependency: [for], data = [none]
}
results.put(key, messageList); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
getGroupHistoriesError(completionListener, "Error parsing JSON response");
return;
} // depends on control dependency: [catch], data = [none]
}
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (completionListener != null) {
completionListener.onSuccess(results); // depends on control dependency: [if], data = [none]
}
}
});
}
@Override
public void onError(final String errorMessage) {
getGroupHistoriesError(completionListener, errorMessage);
}
});
} } |
public class class_name {
public static double dotInnerColumns( DMatrixSparseCSC A , int colA , DMatrixSparseCSC B , int colB ,
IGrowArray gw , DGrowArray gx)
{
if( A.numRows != B.numRows )
throw new IllegalArgumentException("Number of rows must match.");
int w[] = adjust(gw,A.numRows);
Arrays.fill(w,0,A.numRows,-1);
double x[] = adjust(gx,A.numRows);
int length = 0;
int idx0 = A.col_idx[colA];
int idx1 = A.col_idx[colA+1];
for (int i = idx0; i < idx1; i++) {
int row = A.nz_rows[i];
x[length] = A.nz_values[i];
w[row] = length++;
}
double dot = 0;
idx0 = B.col_idx[colB];
idx1 = B.col_idx[colB+1];
for (int i = idx0; i < idx1; i++) {
int row = B.nz_rows[i];
if( w[row] != -1 ) {
dot += x[w[row]]*B.nz_values[i];
}
}
return dot;
} } | public class class_name {
public static double dotInnerColumns( DMatrixSparseCSC A , int colA , DMatrixSparseCSC B , int colB ,
IGrowArray gw , DGrowArray gx)
{
if( A.numRows != B.numRows )
throw new IllegalArgumentException("Number of rows must match.");
int w[] = adjust(gw,A.numRows);
Arrays.fill(w,0,A.numRows,-1);
double x[] = adjust(gx,A.numRows);
int length = 0;
int idx0 = A.col_idx[colA];
int idx1 = A.col_idx[colA+1];
for (int i = idx0; i < idx1; i++) {
int row = A.nz_rows[i];
x[length] = A.nz_values[i]; // depends on control dependency: [for], data = [i]
w[row] = length++; // depends on control dependency: [for], data = [none]
}
double dot = 0;
idx0 = B.col_idx[colB];
idx1 = B.col_idx[colB+1];
for (int i = idx0; i < idx1; i++) {
int row = B.nz_rows[i];
if( w[row] != -1 ) {
dot += x[w[row]]*B.nz_values[i]; // depends on control dependency: [if], data = [none]
}
}
return dot;
} } |
public class class_name {
@UsedByGeneratedCode
public static boolean instanceFieldInterceptionRequired(int ids, String name) {
if (nothingReloaded) {
return false;
}
int registryId = ids >>> 16;
int typeId = ids & 0xffff;
TypeRegistry typeRegistry = registryInstances[registryId].get();
ReloadableType reloadableType = typeRegistry.getReloadableType(typeId);
// TODO covers all situations?
if (reloadableType != null) {
if (reloadableType.hasFieldChangedInHierarchy(name)) {
return true;
}
}
return false;
} } | public class class_name {
@UsedByGeneratedCode
public static boolean instanceFieldInterceptionRequired(int ids, String name) {
if (nothingReloaded) {
return false; // depends on control dependency: [if], data = [none]
}
int registryId = ids >>> 16;
int typeId = ids & 0xffff;
TypeRegistry typeRegistry = registryInstances[registryId].get();
ReloadableType reloadableType = typeRegistry.getReloadableType(typeId);
// TODO covers all situations?
if (reloadableType != null) {
if (reloadableType.hasFieldChangedInHierarchy(name)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void marshall(CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes, ProtocolMarshaller protocolMarshaller) {
if (cancelWorkflowExecutionDecisionAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelWorkflowExecutionDecisionAttributes.getDetails(), DETAILS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CancelWorkflowExecutionDecisionAttributes cancelWorkflowExecutionDecisionAttributes, ProtocolMarshaller protocolMarshaller) {
if (cancelWorkflowExecutionDecisionAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelWorkflowExecutionDecisionAttributes.getDetails(), DETAILS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public ServiceRefHandlerType<ServiceRefType<T>> getOrCreateHandler()
{
List<Node> nodeList = childNode.get("handler");
if (nodeList != null && nodeList.size() > 0)
{
return new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, nodeList.get(0));
}
return createHandler();
} } | public class class_name {
public ServiceRefHandlerType<ServiceRefType<T>> getOrCreateHandler()
{
List<Node> nodeList = childNode.get("handler");
if (nodeList != null && nodeList.size() > 0)
{
return new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createHandler();
} } |
public class class_name {
public void setDurationHistogram(java.util.Collection<HistogramEntry> durationHistogram) {
if (durationHistogram == null) {
this.durationHistogram = null;
return;
}
this.durationHistogram = new java.util.ArrayList<HistogramEntry>(durationHistogram);
} } | public class class_name {
public void setDurationHistogram(java.util.Collection<HistogramEntry> durationHistogram) {
if (durationHistogram == null) {
this.durationHistogram = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.durationHistogram = new java.util.ArrayList<HistogramEntry>(durationHistogram);
} } |
public class class_name {
@SuppressWarnings("unchecked")
public String asLiteral(Object o) {
if (o == null || o instanceof Null) {
return "null";
} else {
Type type = javaTypeMapping.getType(o.getClass());
if (type != null) {
return templates.serialize(type.getLiteral(o), type.getSQLTypes()[0]);
} else {
throw new IllegalArgumentException("Unsupported literal type " + o.getClass().getName());
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public String asLiteral(Object o) {
if (o == null || o instanceof Null) {
return "null"; // depends on control dependency: [if], data = [none]
} else {
Type type = javaTypeMapping.getType(o.getClass());
if (type != null) {
return templates.serialize(type.getLiteral(o), type.getSQLTypes()[0]); // depends on control dependency: [if], data = [(type]
} else {
throw new IllegalArgumentException("Unsupported literal type " + o.getClass().getName());
}
}
} } |
public class class_name {
public static <I extends ScoreIter> double computeDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive;
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied;
}
positive = 0;
tied = 0;
}
return sum * MathUtil.LOG2; // Change base to log 2.
} } | public class class_name {
public static <I extends ScoreIter> double computeDCG(Predicate<? super I> predicate, I iter) {
double sum = 0.;
int i = 0, positive = 0, tied = 0;
while(iter.valid()) {
// positive or negative match?
do {
if(predicate.test(iter)) {
++positive; // depends on control dependency: [if], data = [none]
}
++tied;
++i;
iter.advance();
} // Loop while tied:
while(iter.valid() && iter.tiedToPrevious());
// We only support binary labeling, and can ignore negative weight.
if(positive > 0) {
sum += tied == 1 ? 1. / FastMath.log(i + 1) : //
DCGEvaluation.sumInvLog1p(i - tied + 1, i) * positive / (double) tied; // depends on control dependency: [if], data = [none]
}
positive = 0; // depends on control dependency: [while], data = [none]
tied = 0; // depends on control dependency: [while], data = [none]
}
return sum * MathUtil.LOG2; // Change base to log 2.
} } |
public class class_name {
public static TriFunction<JsonNode, List<String>, List<String>, List<String>> getSummaryFunctionWithStartTime(
final JDefaultDict<String, AtomicInteger> emptyCounts,
final JDefaultDict<String, AtomicInteger> nonEmptyCounts,
final JDefaultDict<String, AtomicBoolean> possibleIntegerFields,
final JDefaultDict<String, AtomicBoolean> possibleDoubleFields,
final JDefaultDict<String, JDefaultDict<String, AtomicInteger>> valueCounts, final AtomicInteger rowCount,
final long startTime) {
return (node, header, line) -> {
int nextLineNumber = rowCount.incrementAndGet();
if (nextLineNumber % 10000 == 0) {
double secondsSinceStart = (System.currentTimeMillis() - startTime) / 1000.0d;
System.out.printf("%d\tSeconds since start: %f\tRecords per second: %f%n", nextLineNumber,
secondsSinceStart, nextLineNumber / secondsSinceStart);
}
for (int i = 0; i < header.size(); i++) {
if (line.get(i).trim().isEmpty()) {
emptyCounts.get(header.get(i)).incrementAndGet();
} else {
nonEmptyCounts.get(header.get(i)).incrementAndGet();
valueCounts.get(header.get(i)).get(line.get(i)).incrementAndGet();
try {
Integer.parseInt(line.get(i));
} catch (NumberFormatException nfe) {
possibleIntegerFields.get(header.get(i)).set(false);
}
try {
Double.parseDouble(line.get(i));
} catch (NumberFormatException nfe) {
possibleDoubleFields.get(header.get(i)).set(false);
}
}
}
return line;
};
} } | public class class_name {
public static TriFunction<JsonNode, List<String>, List<String>, List<String>> getSummaryFunctionWithStartTime(
final JDefaultDict<String, AtomicInteger> emptyCounts,
final JDefaultDict<String, AtomicInteger> nonEmptyCounts,
final JDefaultDict<String, AtomicBoolean> possibleIntegerFields,
final JDefaultDict<String, AtomicBoolean> possibleDoubleFields,
final JDefaultDict<String, JDefaultDict<String, AtomicInteger>> valueCounts, final AtomicInteger rowCount,
final long startTime) {
return (node, header, line) -> {
int nextLineNumber = rowCount.incrementAndGet();
if (nextLineNumber % 10000 == 0) {
double secondsSinceStart = (System.currentTimeMillis() - startTime) / 1000.0d;
System.out.printf("%d\tSeconds since start: %f\tRecords per second: %f%n", nextLineNumber,
secondsSinceStart, nextLineNumber / secondsSinceStart); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < header.size(); i++) {
if (line.get(i).trim().isEmpty()) {
emptyCounts.get(header.get(i)).incrementAndGet(); // depends on control dependency: [if], data = [none]
} else {
nonEmptyCounts.get(header.get(i)).incrementAndGet(); // depends on control dependency: [if], data = [none]
valueCounts.get(header.get(i)).get(line.get(i)).incrementAndGet(); // depends on control dependency: [if], data = [none]
try {
Integer.parseInt(line.get(i)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
possibleIntegerFields.get(header.get(i)).set(false);
} // depends on control dependency: [catch], data = [none]
try {
Double.parseDouble(line.get(i)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
possibleDoubleFields.get(header.get(i)).set(false);
} // depends on control dependency: [catch], data = [none]
}
}
return line;
};
} } |
public class class_name {
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
String host = System.getProperty(hostKey);
if (host == null || host.isEmpty()) {
return null;
}
int port = getSystemPropertyInt(portKey, defaultPort);
return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
} } | public class class_name {
private Proxy lookupProxy(String hostKey, String portKey, Proxy.Type type, int defaultPort) {
String host = System.getProperty(hostKey);
if (host == null || host.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
int port = getSystemPropertyInt(portKey, defaultPort);
return new Proxy(type, InetSocketAddress.createUnresolved(host, port));
} } |
public class class_name {
protected int readConfigFileVersion() {
try {
return getConfig().getInt(getConfigVersionKey(), NO_CONFIG_VERSION);
} catch (ConversionException e) {
logger.error("Error while getting the version of the configurations: " + e.getMessage(), e);
return ERROR_READING_CONFIG_VERSION;
}
} } | public class class_name {
protected int readConfigFileVersion() {
try {
return getConfig().getInt(getConfigVersionKey(), NO_CONFIG_VERSION); // depends on control dependency: [try], data = [none]
} catch (ConversionException e) {
logger.error("Error while getting the version of the configurations: " + e.getMessage(), e);
return ERROR_READING_CONFIG_VERSION;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public int read(char[] buf, int offset, int length) throws IOException {
synchronized (lock) {
if (!isOpen()) {
throw new IOException("InputStreamReader is closed.");
}
if (offset < 0 || offset > buf.length - length || length < 0) {
throw new IndexOutOfBoundsException();
}
if (length == 0) {
return 0;
}
CharBuffer out = CharBuffer.wrap(buf, offset, length);
CoderResult result = CoderResult.UNDERFLOW;
// bytes.remaining() indicates number of bytes in buffer
// when 1-st time entered, it'll be equal to zero
boolean needInput = !bytes.hasRemaining();
while (out.hasRemaining()) {
// fill the buffer if needed
if (needInput) {
try {
if ((in.available() == 0)
&& (out.position() > offset)) {
// we could return the result without blocking read
break;
}
} catch (IOException e) {
// available didn't work so just try the read
}
int to_read = bytes.capacity() - bytes.limit();
int off = bytes.arrayOffset() + bytes.limit();
int was_red = in.read(bytes.array(), off, to_read);
if (was_red == -1) {
endOfInput = true;
break;
} else if (was_red == 0) {
break;
}
bytes.limit(bytes.limit() + was_red);
needInput = false;
}
// decode bytes
result = decoder.decode(bytes, out, false);
if (result.isUnderflow()) {
// compact the buffer if no space left
if (bytes.limit() == bytes.capacity()) {
bytes.compact();
bytes.limit(bytes.position());
bytes.position(0);
}
needInput = true;
} else {
break;
}
}
if (result == CoderResult.UNDERFLOW && endOfInput) {
result = decoder.decode(bytes, out, true);
decoder.flush(out);
decoder.reset();
}
if (result.isMalformed()) {
throw new MalformedInputException(result.length());
} else if (result.isUnmappable()) {
throw new UnmappableCharacterException(result.length());
}
return out.position() - offset == 0 ? -1 : out.position() - offset;
}
} } | public class class_name {
@Override
public int read(char[] buf, int offset, int length) throws IOException {
synchronized (lock) {
if (!isOpen()) {
throw new IOException("InputStreamReader is closed.");
}
if (offset < 0 || offset > buf.length - length || length < 0) {
throw new IndexOutOfBoundsException();
}
if (length == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
CharBuffer out = CharBuffer.wrap(buf, offset, length);
CoderResult result = CoderResult.UNDERFLOW;
// bytes.remaining() indicates number of bytes in buffer
// when 1-st time entered, it'll be equal to zero
boolean needInput = !bytes.hasRemaining();
while (out.hasRemaining()) {
// fill the buffer if needed
if (needInput) {
try {
if ((in.available() == 0)
&& (out.position() > offset)) {
// we could return the result without blocking read
break;
}
} catch (IOException e) {
// available didn't work so just try the read
} // depends on control dependency: [catch], data = [none]
int to_read = bytes.capacity() - bytes.limit();
int off = bytes.arrayOffset() + bytes.limit();
int was_red = in.read(bytes.array(), off, to_read);
if (was_red == -1) {
endOfInput = true; // depends on control dependency: [if], data = [none]
break;
} else if (was_red == 0) {
break;
}
bytes.limit(bytes.limit() + was_red); // depends on control dependency: [if], data = [none]
needInput = false; // depends on control dependency: [if], data = [none]
}
// decode bytes
result = decoder.decode(bytes, out, false); // depends on control dependency: [while], data = [none]
if (result.isUnderflow()) {
// compact the buffer if no space left
if (bytes.limit() == bytes.capacity()) {
bytes.compact(); // depends on control dependency: [if], data = [none]
bytes.limit(bytes.position()); // depends on control dependency: [if], data = [none]
bytes.position(0); // depends on control dependency: [if], data = [none]
}
needInput = true; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
if (result == CoderResult.UNDERFLOW && endOfInput) {
result = decoder.decode(bytes, out, true); // depends on control dependency: [if], data = [none]
decoder.flush(out); // depends on control dependency: [if], data = [none]
decoder.reset(); // depends on control dependency: [if], data = [none]
}
if (result.isMalformed()) {
throw new MalformedInputException(result.length());
} else if (result.isUnmappable()) {
throw new UnmappableCharacterException(result.length());
}
return out.position() - offset == 0 ? -1 : out.position() - offset;
}
} } |
public class class_name {
public static String join(Set<?> items, String separator, Integer limit) {
if (separator == null || separator.equalsIgnoreCase("")) {
throw new IllegalArgumentException("Missing separator!");
}
if (items != null && items.size() > 0) {
Object[] array = items.toArray();
return join(array, separator, limit);
}
return "";
} } | public class class_name {
public static String join(Set<?> items, String separator, Integer limit) {
if (separator == null || separator.equalsIgnoreCase("")) {
throw new IllegalArgumentException("Missing separator!");
}
if (items != null && items.size() > 0) {
Object[] array = items.toArray();
return join(array, separator, limit); // depends on control dependency: [if], data = [none]
}
return "";
} } |
public class class_name {
public ServiceQueryRRLoadBalancer getServiceQueryRRLoadBalancer(
String serviceName, ServiceInstanceQuery query) {
for (ServiceQueryRRLoadBalancer lb : svcQueryLBList) {
if (lb.getServiceName().equals(serviceName)
&& lb.getServiceInstanceQuery().equals(query)) {
return lb;
}
}
ServiceQueryRRLoadBalancer lb = new ServiceQueryRRLoadBalancer(
lookupService, serviceName, query);
svcQueryLBList.add(lb);
return lb;
} } | public class class_name {
public ServiceQueryRRLoadBalancer getServiceQueryRRLoadBalancer(
String serviceName, ServiceInstanceQuery query) {
for (ServiceQueryRRLoadBalancer lb : svcQueryLBList) {
if (lb.getServiceName().equals(serviceName)
&& lb.getServiceInstanceQuery().equals(query)) {
return lb; // depends on control dependency: [if], data = [none]
}
}
ServiceQueryRRLoadBalancer lb = new ServiceQueryRRLoadBalancer(
lookupService, serviceName, query);
svcQueryLBList.add(lb);
return lb;
} } |
public class class_name {
public void shallowScramble(PrefabValues prefabValues, TypeTag enclosingType) {
for (Field field : FieldIterable.ofIgnoringSuper(type)) {
FieldAccessor accessor = new FieldAccessor(object, field);
accessor.changeField(prefabValues, enclosingType);
}
} } | public class class_name {
public void shallowScramble(PrefabValues prefabValues, TypeTag enclosingType) {
for (Field field : FieldIterable.ofIgnoringSuper(type)) {
FieldAccessor accessor = new FieldAccessor(object, field);
accessor.changeField(prefabValues, enclosingType); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static void createIniFile(String... args) {
try {
// open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String wikiid = null;
if (args.length > 0)
wikiid = args[0];
else
wikiid = getInput("wiki id", br);
String username = null;
if (args.length > 1)
username = args[1];
else
username = getInput("username", br);
String password = null;
if (args.length > 2)
password = args[2];
else
password = getInput("password", br);
String email = null;
if (args.length > 3)
email = args[3];
else
email = getInput("email", br);
File propFile = getPropertyFile(wikiid, username);
String remember = null;
if (args.length > 4)
remember = args[4];
else
remember = getInput("shall i store " + username
+ "'s credentials encrypted in " + propFile.getName() + " y/n?",
br);
if (remember.trim().toLowerCase().startsWith("y")) {
Crypt lCrypt = Crypt.getRandomCrypt();
Properties props = new Properties();
props.setProperty("cypher", lCrypt.getCypher());
props.setProperty("salt", lCrypt.getSalt());
props.setProperty("user", username);
props.setProperty("email", email);
props.setProperty("secret", lCrypt.encrypt(password));
if (!propFile.getParentFile().exists()) {
propFile.getParentFile().mkdirs();
}
FileOutputStream propsStream = new FileOutputStream(propFile);
props.store(propsStream, "Mediawiki JAPI credentials for " + wikiid);
propsStream.close();
}
} catch (IOException e1) {
LOGGER.log(Level.SEVERE, e1.getMessage());
} catch (GeneralSecurityException e1) {
LOGGER.log(Level.SEVERE, e1.getMessage());
}
} } | public class class_name {
public static void createIniFile(String... args) {
try {
// open up standard input
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String wikiid = null;
if (args.length > 0)
wikiid = args[0];
else
wikiid = getInput("wiki id", br);
String username = null;
if (args.length > 1)
username = args[1];
else
username = getInput("username", br);
String password = null;
if (args.length > 2)
password = args[2];
else
password = getInput("password", br);
String email = null;
if (args.length > 3)
email = args[3];
else
email = getInput("email", br);
File propFile = getPropertyFile(wikiid, username);
String remember = null;
if (args.length > 4)
remember = args[4];
else
remember = getInput("shall i store " + username
+ "'s credentials encrypted in " + propFile.getName() + " y/n?",
br);
if (remember.trim().toLowerCase().startsWith("y")) {
Crypt lCrypt = Crypt.getRandomCrypt();
Properties props = new Properties();
props.setProperty("cypher", lCrypt.getCypher()); // depends on control dependency: [if], data = [none]
props.setProperty("salt", lCrypt.getSalt()); // depends on control dependency: [if], data = [none]
props.setProperty("user", username); // depends on control dependency: [if], data = [none]
props.setProperty("email", email); // depends on control dependency: [if], data = [none]
props.setProperty("secret", lCrypt.encrypt(password)); // depends on control dependency: [if], data = [none]
if (!propFile.getParentFile().exists()) {
propFile.getParentFile().mkdirs(); // depends on control dependency: [if], data = [none]
}
FileOutputStream propsStream = new FileOutputStream(propFile);
props.store(propsStream, "Mediawiki JAPI credentials for " + wikiid); // depends on control dependency: [if], data = [none]
propsStream.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e1) {
LOGGER.log(Level.SEVERE, e1.getMessage());
} catch (GeneralSecurityException e1) { // depends on control dependency: [catch], data = [none]
LOGGER.log(Level.SEVERE, e1.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(FunctionExecutionConfig functionExecutionConfig, ProtocolMarshaller protocolMarshaller) {
if (functionExecutionConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(functionExecutionConfig.getIsolationMode(), ISOLATIONMODE_BINDING);
protocolMarshaller.marshall(functionExecutionConfig.getRunAs(), RUNAS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(FunctionExecutionConfig functionExecutionConfig, ProtocolMarshaller protocolMarshaller) {
if (functionExecutionConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(functionExecutionConfig.getIsolationMode(), ISOLATIONMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(functionExecutionConfig.getRunAs(), RUNAS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void addRequestedLocalization(final Object node, final String key, final String domain, final String locale, final Localization localization) {
final GenericProperty keyKey = new GenericProperty("key");
final GenericProperty domainKey = new GenericProperty("domain");
final GenericProperty localeKey = new GenericProperty("locale");
final GenericProperty nodeKey = new GenericProperty("node");
boolean notContained = true;
for (GraphObject gom : localizations) {
if (notContained) {
if (gom.getProperty(keyKey).equals(key) && gom.getProperty(domainKey).equals(domain) && gom.getProperty(localeKey).equals(locale)) {
final GraphObject prevNode = (GraphObject)gom.getProperty(nodeKey);
if (prevNode != null && node != null && prevNode.getUuid().equals(((GraphObject)node).getUuid())) {
notContained = false;
}
}
}
}
if (notContained) {
final Map<String, Object> data = new HashMap();
data.put("node", node);
data.put("key", key);
data.put("domain", domain);
data.put("locale", locale);
data.put("localization", localization);
GraphObjectMap converted = GraphObjectMap.fromMap(data);
if (!localizations.contains(converted)) {
localizations.add(converted);
}
}
} } | public class class_name {
public void addRequestedLocalization(final Object node, final String key, final String domain, final String locale, final Localization localization) {
final GenericProperty keyKey = new GenericProperty("key");
final GenericProperty domainKey = new GenericProperty("domain");
final GenericProperty localeKey = new GenericProperty("locale");
final GenericProperty nodeKey = new GenericProperty("node");
boolean notContained = true;
for (GraphObject gom : localizations) {
if (notContained) {
if (gom.getProperty(keyKey).equals(key) && gom.getProperty(domainKey).equals(domain) && gom.getProperty(localeKey).equals(locale)) {
final GraphObject prevNode = (GraphObject)gom.getProperty(nodeKey);
if (prevNode != null && node != null && prevNode.getUuid().equals(((GraphObject)node).getUuid())) {
notContained = false; // depends on control dependency: [if], data = [none]
}
}
}
}
if (notContained) {
final Map<String, Object> data = new HashMap();
data.put("node", node); // depends on control dependency: [if], data = [none]
data.put("key", key); // depends on control dependency: [if], data = [none]
data.put("domain", domain); // depends on control dependency: [if], data = [none]
data.put("locale", locale); // depends on control dependency: [if], data = [none]
data.put("localization", localization); // depends on control dependency: [if], data = [none]
GraphObjectMap converted = GraphObjectMap.fromMap(data);
if (!localizations.contains(converted)) {
localizations.add(converted); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public MoneyKit[] allocate(long[] ratios) {
MoneyKit[] results = new MoneyKit[ratios.length];
long total = 0;
for (long ratio : ratios) {
total += ratio;
}
long remainder = cent;
for (int i = 0; i < results.length; i++) {
results[i] = newMoneyWithSameCurrency((cent * ratios[i]) / total);
remainder -= results[i].cent;
}
for (int i = 0; i < remainder; i++) {
results[i].cent++;
}
return results;
} } | public class class_name {
public MoneyKit[] allocate(long[] ratios) {
MoneyKit[] results = new MoneyKit[ratios.length];
long total = 0;
for (long ratio : ratios) {
total += ratio; // depends on control dependency: [for], data = [ratio]
}
long remainder = cent;
for (int i = 0; i < results.length; i++) {
results[i] = newMoneyWithSameCurrency((cent * ratios[i]) / total); // depends on control dependency: [for], data = [i]
remainder -= results[i].cent; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < remainder; i++) {
results[i].cent++; // depends on control dependency: [for], data = [i]
}
return results;
} } |
public class class_name {
@Override
protected void visitIfNode(IfNode node) {
IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder();
SanitizedContentKind currentContentKind = jsCodeBuilder.getContentKind();
if (!isTextContent(currentContentKind)) {
super.generateNonExpressionIfNode(node);
} else {
super.visitIfNode(node);
}
} } | public class class_name {
@Override
protected void visitIfNode(IfNode node) {
IncrementalDomCodeBuilder jsCodeBuilder = getJsCodeBuilder();
SanitizedContentKind currentContentKind = jsCodeBuilder.getContentKind();
if (!isTextContent(currentContentKind)) {
super.generateNonExpressionIfNode(node); // depends on control dependency: [if], data = [none]
} else {
super.visitIfNode(node); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<MetaDataResult> getMetaDataResultList() {
JSONArray jsonArray = null;
try {
jsonArray = _jsonObject.getJSONArray(DATASETS_ARRAY_FIELD);
List<MetaDataResult> metaDataResults = new ArrayList<MetaDataResult>(jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
metaDataResults.add(MetaDataResult.of(jsonArray.getJSONObject(i)));
}
return metaDataResults;
} catch (JSONException ex) {
s_logger.error("Metadata had unexpected structure - could not extract datasets field, was:\n{}", _jsonObject.toString());
throw new QuandlRuntimeException("Metadata had unexpected structure", ex);
}
} } | public class class_name {
public List<MetaDataResult> getMetaDataResultList() {
JSONArray jsonArray = null;
try {
jsonArray = _jsonObject.getJSONArray(DATASETS_ARRAY_FIELD); // depends on control dependency: [try], data = [none]
List<MetaDataResult> metaDataResults = new ArrayList<MetaDataResult>(jsonArray.length());
for (int i = 0; i < jsonArray.length(); i++) {
metaDataResults.add(MetaDataResult.of(jsonArray.getJSONObject(i))); // depends on control dependency: [for], data = [i]
}
return metaDataResults; // depends on control dependency: [try], data = [none]
} catch (JSONException ex) {
s_logger.error("Metadata had unexpected structure - could not extract datasets field, was:\n{}", _jsonObject.toString());
throw new QuandlRuntimeException("Metadata had unexpected structure", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Matcher<ExpressionTree> isVariable() {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
Symbol symbol = ASTHelpers.getSymbol(expressionTree);
if (symbol == null) {
return false;
}
return symbol.getKind() == ElementKind.LOCAL_VARIABLE
|| symbol.getKind() == ElementKind.PARAMETER;
}
};
} } | public class class_name {
public static Matcher<ExpressionTree> isVariable() {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
Symbol symbol = ASTHelpers.getSymbol(expressionTree);
if (symbol == null) {
return false; // depends on control dependency: [if], data = [none]
}
return symbol.getKind() == ElementKind.LOCAL_VARIABLE
|| symbol.getKind() == ElementKind.PARAMETER;
}
};
} } |
public class class_name {
public Interval intersection(Interval other) {
Objects.requireNonNull(other, "other");
if (isConnected(other) == false) {
throw new DateTimeException("Intervals do not connect: " + this + " and " + other);
}
int cmpStart = start.compareTo(other.start);
int cmpEnd = end.compareTo(other.end);
if (cmpStart >= 0 && cmpEnd <= 0) {
return this;
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return other;
} else {
Instant newStart = (cmpStart >= 0 ? start : other.start);
Instant newEnd = (cmpEnd <= 0 ? end : other.end);
return Interval.of(newStart, newEnd);
}
} } | public class class_name {
public Interval intersection(Interval other) {
Objects.requireNonNull(other, "other");
if (isConnected(other) == false) {
throw new DateTimeException("Intervals do not connect: " + this + " and " + other);
}
int cmpStart = start.compareTo(other.start);
int cmpEnd = end.compareTo(other.end);
if (cmpStart >= 0 && cmpEnd <= 0) {
return this; // depends on control dependency: [if], data = [none]
} else if (cmpStart <= 0 && cmpEnd >= 0) {
return other; // depends on control dependency: [if], data = [none]
} else {
Instant newStart = (cmpStart >= 0 ? start : other.start);
Instant newEnd = (cmpEnd <= 0 ? end : other.end);
return Interval.of(newStart, newEnd); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean determineIfWeShouldExit() {
boolean shouldStop = stop.get();
if (!shouldStop) {
Thread.interrupted();
} else {
System.out.println("Exiting processing loop as requested");
return true;
}
return false;
} } | public class class_name {
private boolean determineIfWeShouldExit() {
boolean shouldStop = stop.get();
if (!shouldStop) {
Thread.interrupted(); // depends on control dependency: [if], data = [none]
} else {
System.out.println("Exiting processing loop as requested"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
@Override
protected JSONObject extractData(MBeanInfo pMBeanInfo, String pNotification) {
JSONObject notMap = new JSONObject();
for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) {
if (pNotification == null || notInfo.getName().equals(pNotification)) {
JSONObject map = new JSONObject();
map.put(NAME.getKey(), notInfo.getName());
map.put(DESCRIPTION.getKey(), notInfo.getDescription());
String[] types = notInfo.getNotifTypes();
JSONArray tList = new JSONArray();
for (String type : types) {
tList.add(type);
}
map.put(TYPES.getKey(), tList);
}
}
return notMap;
} } | public class class_name {
@Override
protected JSONObject extractData(MBeanInfo pMBeanInfo, String pNotification) {
JSONObject notMap = new JSONObject();
for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) {
if (pNotification == null || notInfo.getName().equals(pNotification)) {
JSONObject map = new JSONObject();
map.put(NAME.getKey(), notInfo.getName()); // depends on control dependency: [if], data = [none]
map.put(DESCRIPTION.getKey(), notInfo.getDescription()); // depends on control dependency: [if], data = [none]
String[] types = notInfo.getNotifTypes();
JSONArray tList = new JSONArray();
for (String type : types) {
tList.add(type); // depends on control dependency: [for], data = [type]
}
map.put(TYPES.getKey(), tList); // depends on control dependency: [if], data = [none]
}
}
return notMap;
} } |
public class class_name {
private void minimize()
{
if (timer != null)
{
timer.stop();
timer = null;
}
currentHeight = getHeight();
double steps = (double)durationMS / delayMS;
double delta = currentHeight - minimizedHeight;
final int stepSize = (int)Math.ceil(delta / steps);
//System.out.println("steps " + steps);
//System.out.println("currentHeight " + currentHeight);
//System.out.println("delta " + delta);
//System.out.println("stepSize " + stepSize);
timer = new Timer(delayMS, new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
currentHeight -= stepSize;
currentHeight = Math.max(currentHeight, minimizedHeight);
if (currentHeight <= minimizedHeight)
{
minimized = true;
timer.stop();
timer = null;
}
revalidate();
}
});
timer.setInitialDelay(0);
timer.start();
} } | public class class_name {
private void minimize()
{
if (timer != null)
{
timer.stop();
// depends on control dependency: [if], data = [none]
timer = null;
// depends on control dependency: [if], data = [none]
}
currentHeight = getHeight();
double steps = (double)durationMS / delayMS;
double delta = currentHeight - minimizedHeight;
final int stepSize = (int)Math.ceil(delta / steps);
//System.out.println("steps " + steps);
//System.out.println("currentHeight " + currentHeight);
//System.out.println("delta " + delta);
//System.out.println("stepSize " + stepSize);
timer = new Timer(delayMS, new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
{
currentHeight -= stepSize;
currentHeight = Math.max(currentHeight, minimizedHeight);
if (currentHeight <= minimizedHeight)
{
minimized = true;
// depends on control dependency: [if], data = [none]
timer.stop();
// depends on control dependency: [if], data = [none]
timer = null;
// depends on control dependency: [if], data = [none]
}
revalidate();
}
});
timer.setInitialDelay(0);
timer.start();
} } |
public class class_name {
protected static void constructSignatureForRequestParameters(
List<NameValuePair> params, String secretKey, long currentTimeSeconds) {
// First, inject a 'timestamp=' parameter containing the current time in seconds since Jan 1st 1970
params.add(new BasicNameValuePair(PARAM_TIMESTAMP, Long.toString(currentTimeSeconds)));
Map<String, String> sortedParams = new TreeMap<>();
for (NameValuePair param: params) {
String name = param.getName();
String value = param.getValue();
if (name.equals(PARAM_SIGNATURE))
continue;
if (value == null)
value = "";
if (!value.trim().equals(""))
sortedParams.put(name, value);
}
// Now, walk through the sorted list of parameters and construct a string
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> param: sortedParams.entrySet()) {
String name = param.getKey();
String value = param.getValue();
sb.append("&").append(clean(name)).append("=").append(clean(value));
}
// Now, append the secret key, and calculate an MD5 signature of the resultant string
sb.append(secretKey);
String str = sb.toString();
String md5 = "no signature";
try {
md5 = MD5Util.calculateMd5(str);
} catch (Exception e) {
log.error("error...", e);
}
log.debug("SECURITY-KEY-GENERATION -- String [ " + str + " ] Signature [ " + md5 + " ] ");
params.add(new BasicNameValuePair(PARAM_SIGNATURE, md5));
} } | public class class_name {
protected static void constructSignatureForRequestParameters(
List<NameValuePair> params, String secretKey, long currentTimeSeconds) {
// First, inject a 'timestamp=' parameter containing the current time in seconds since Jan 1st 1970
params.add(new BasicNameValuePair(PARAM_TIMESTAMP, Long.toString(currentTimeSeconds)));
Map<String, String> sortedParams = new TreeMap<>();
for (NameValuePair param: params) {
String name = param.getName();
String value = param.getValue();
if (name.equals(PARAM_SIGNATURE))
continue;
if (value == null)
value = "";
if (!value.trim().equals(""))
sortedParams.put(name, value);
}
// Now, walk through the sorted list of parameters and construct a string
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> param: sortedParams.entrySet()) {
String name = param.getKey();
String value = param.getValue();
sb.append("&").append(clean(name)).append("=").append(clean(value)); // depends on control dependency: [for], data = [none]
}
// Now, append the secret key, and calculate an MD5 signature of the resultant string
sb.append(secretKey);
String str = sb.toString();
String md5 = "no signature";
try {
md5 = MD5Util.calculateMd5(str); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("error...", e);
} // depends on control dependency: [catch], data = [none]
log.debug("SECURITY-KEY-GENERATION -- String [ " + str + " ] Signature [ " + md5 + " ] ");
params.add(new BasicNameValuePair(PARAM_SIGNATURE, md5));
} } |
public class class_name {
public static base_responses update(nitro_service client, onlinkipv6prefix resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
onlinkipv6prefix updateresources[] = new onlinkipv6prefix[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new onlinkipv6prefix();
updateresources[i].ipv6prefix = resources[i].ipv6prefix;
updateresources[i].onlinkprefix = resources[i].onlinkprefix;
updateresources[i].autonomusprefix = resources[i].autonomusprefix;
updateresources[i].depricateprefix = resources[i].depricateprefix;
updateresources[i].decrementprefixlifetimes = resources[i].decrementprefixlifetimes;
updateresources[i].prefixvalidelifetime = resources[i].prefixvalidelifetime;
updateresources[i].prefixpreferredlifetime = resources[i].prefixpreferredlifetime;
}
result = update_bulk_request(client, updateresources);
}
return result;
} } | public class class_name {
public static base_responses update(nitro_service client, onlinkipv6prefix resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
onlinkipv6prefix updateresources[] = new onlinkipv6prefix[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new onlinkipv6prefix(); // depends on control dependency: [for], data = [i]
updateresources[i].ipv6prefix = resources[i].ipv6prefix; // depends on control dependency: [for], data = [i]
updateresources[i].onlinkprefix = resources[i].onlinkprefix; // depends on control dependency: [for], data = [i]
updateresources[i].autonomusprefix = resources[i].autonomusprefix; // depends on control dependency: [for], data = [i]
updateresources[i].depricateprefix = resources[i].depricateprefix; // depends on control dependency: [for], data = [i]
updateresources[i].decrementprefixlifetimes = resources[i].decrementprefixlifetimes; // depends on control dependency: [for], data = [i]
updateresources[i].prefixvalidelifetime = resources[i].prefixvalidelifetime; // depends on control dependency: [for], data = [i]
updateresources[i].prefixpreferredlifetime = resources[i].prefixpreferredlifetime; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} } |
public class class_name {
static int binarySearch(long keys[], int start, int len, long key) {
int high = start + len, low = start - 1, guess;
while (high - low > 1) {
// use >>> for average or we could get an integer overflow.
guess = (high + low) >>> 1;
long guessedKey = keys[guess];
if (guessedKey < key) {
low = guess;
} else {
high = guess;
}
}
if (high == start + len) {
return ~(start + len);
}
long highKey = keys[high];
if (highKey == key) {
return high;
} else {
return ~high;
}
} } | public class class_name {
static int binarySearch(long keys[], int start, int len, long key) {
int high = start + len, low = start - 1, guess;
while (high - low > 1) {
// use >>> for average or we could get an integer overflow.
guess = (high + low) >>> 1; // depends on control dependency: [while], data = [none]
long guessedKey = keys[guess];
if (guessedKey < key) {
low = guess; // depends on control dependency: [if], data = [none]
} else {
high = guess; // depends on control dependency: [if], data = [none]
}
}
if (high == start + len) {
return ~(start + len); // depends on control dependency: [if], data = [start + len)]
}
long highKey = keys[high];
if (highKey == key) {
return high; // depends on control dependency: [if], data = [none]
} else {
return ~high; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getStartupUri() {
String result = getSettings().getViewStartup();
if (result == null) {
// no specific startup URI is set, use view from user settings
result = getSettings().getViewUri();
} else {
// reset the startup URI, so that it is not displayed again on reload of the frameset
getSettings().setViewStartup(null);
}
// add eventual request parameters to startup uri
if (getJsp().getRequest().getParameterMap().size() > 0) {
@SuppressWarnings("unchecked")
Set<Entry<String, String[]>> params = getJsp().getRequest().getParameterMap().entrySet();
Iterator<Entry<String, String[]>> i = params.iterator();
while (i.hasNext()) {
Entry<?, ?> entry = i.next();
result = CmsRequestUtil.appendParameter(
result,
(String)entry.getKey(),
((String[])entry.getValue())[0]);
}
}
// append the frame name to the startup uri
return CmsRequestUtil.appendParameter(result, CmsFrameset.PARAM_WP_FRAME, FRAMES[2]);
} } | public class class_name {
public String getStartupUri() {
String result = getSettings().getViewStartup();
if (result == null) {
// no specific startup URI is set, use view from user settings
result = getSettings().getViewUri(); // depends on control dependency: [if], data = [none]
} else {
// reset the startup URI, so that it is not displayed again on reload of the frameset
getSettings().setViewStartup(null); // depends on control dependency: [if], data = [null)]
}
// add eventual request parameters to startup uri
if (getJsp().getRequest().getParameterMap().size() > 0) {
@SuppressWarnings("unchecked")
Set<Entry<String, String[]>> params = getJsp().getRequest().getParameterMap().entrySet();
Iterator<Entry<String, String[]>> i = params.iterator();
while (i.hasNext()) {
Entry<?, ?> entry = i.next(); // depends on control dependency: [while], data = [none]
result = CmsRequestUtil.appendParameter(
result,
(String)entry.getKey(),
((String[])entry.getValue())[0]); // depends on control dependency: [while], data = [none]
}
}
// append the frame name to the startup uri
return CmsRequestUtil.appendParameter(result, CmsFrameset.PARAM_WP_FRAME, FRAMES[2]);
} } |
public class class_name {
protected void handlePostBatchAsNeeded(
boolean resultSetEndReached,
int recordCount,
int eventCount,
BatchContext batchContext
) {
AtomicBoolean shouldEvict = new AtomicBoolean(resultSetEndReached);
// If we read at least one record, it's safe to drop the starting offsets, otherwise they have to re-used
if(recordCount > 0) {
tableRuntimeContext.getSourceTableContext().clearStartOffset();
}
//Only process batch if there are records or events
if (recordCount > 0 || eventCount > 0) {
TableReadContext tableReadContext = tableReadContextCache.getIfPresent(tableRuntimeContext);
Optional.ofNullable(tableReadContext)
.ifPresent(readContext -> {
readContext.addProcessingMetrics(1, recordCount);
LOG.debug(
"Table {} read batches={} and records={}",
tableRuntimeContext.getQualifiedName(),
readContext.getNumberOfBatches(),
readContext.getNumberOfRecords()
);
calculateEvictTableFlag(shouldEvict, tableReadContext);
});
updateGauge(JdbcBaseRunnable.Status.BATCH_GENERATED);
//Process And Commit offsets
if (tableRuntimeContext.isUsingNonIncrementalLoad()) {
// process the batch now, will handle the offset commit outside this block
context.processBatch(batchContext);
} else {
// for incremental (normal) mode, the offset was already stored in this map
// by the specific subclass's createAndAddRecord method
final String offsetValue = offsets.get(tableRuntimeContext.getOffsetKey());
context.processBatch(batchContext, tableRuntimeContext.getOffsetKey(), offsetValue);
}
}
if (tableRuntimeContext.isUsingNonIncrementalLoad()) {
// for non-incremental mode, the offset is simply a singleton map indicating whether it's finished
final String offsetValue = createNonIncrementalLoadOffsetValue(resultSetEndReached);
context.commitOffset(tableRuntimeContext.getOffsetKey(), offsetValue);
}
//Make sure we close the result set only when there are no more rows in the result set
if (shouldEvict.get()) {
//Invalidate so as to fetch a new result set
//We close the result set/statement in Removal Listener
tableReadContextCache.invalidate(tableRuntimeContext);
tableProvider.releaseOwnedTable(tableRuntimeContext, threadNumber);
tableRuntimeContext = null;
} else if (
tableJdbcConfigBean.batchTableStrategy == BatchTableStrategy.SWITCH_TABLES
&& !tableRuntimeContext.isUsingNonIncrementalLoad()) {
tableRuntimeContext = null;
}
final List<TableRuntimeContext> removedPartitions = tableProvider.getAndClearRemovedPartitions();
if (removedPartitions != null && removedPartitions.size() > 0) {
for (TableRuntimeContext partition : removedPartitions) {
LOG.debug(
"Removing offset entry for partition {} since it has been removed from the table provider",
partition.getDescription()
);
context.commitOffset(partition.getOffsetKey(), null);
}
}
} } | public class class_name {
protected void handlePostBatchAsNeeded(
boolean resultSetEndReached,
int recordCount,
int eventCount,
BatchContext batchContext
) {
AtomicBoolean shouldEvict = new AtomicBoolean(resultSetEndReached);
// If we read at least one record, it's safe to drop the starting offsets, otherwise they have to re-used
if(recordCount > 0) {
tableRuntimeContext.getSourceTableContext().clearStartOffset(); // depends on control dependency: [if], data = [none]
}
//Only process batch if there are records or events
if (recordCount > 0 || eventCount > 0) {
TableReadContext tableReadContext = tableReadContextCache.getIfPresent(tableRuntimeContext);
Optional.ofNullable(tableReadContext)
.ifPresent(readContext -> {
readContext.addProcessingMetrics(1, recordCount); // depends on control dependency: [if], data = [none]
LOG.debug(
"Table {} read batches={} and records={}",
tableRuntimeContext.getQualifiedName(),
readContext.getNumberOfBatches(),
readContext.getNumberOfRecords()
); // depends on control dependency: [if], data = [none]
calculateEvictTableFlag(shouldEvict, tableReadContext); // depends on control dependency: [if], data = [none]
});
updateGauge(JdbcBaseRunnable.Status.BATCH_GENERATED);
//Process And Commit offsets
if (tableRuntimeContext.isUsingNonIncrementalLoad()) {
// process the batch now, will handle the offset commit outside this block
context.processBatch(batchContext); // depends on control dependency: [if], data = [none]
} else {
// for incremental (normal) mode, the offset was already stored in this map
// by the specific subclass's createAndAddRecord method
final String offsetValue = offsets.get(tableRuntimeContext.getOffsetKey());
context.processBatch(batchContext, tableRuntimeContext.getOffsetKey(), offsetValue); // depends on control dependency: [if], data = [none]
}
}
if (tableRuntimeContext.isUsingNonIncrementalLoad()) {
// for non-incremental mode, the offset is simply a singleton map indicating whether it's finished
final String offsetValue = createNonIncrementalLoadOffsetValue(resultSetEndReached);
context.commitOffset(tableRuntimeContext.getOffsetKey(), offsetValue);
}
//Make sure we close the result set only when there are no more rows in the result set
if (shouldEvict.get()) {
//Invalidate so as to fetch a new result set
//We close the result set/statement in Removal Listener
tableReadContextCache.invalidate(tableRuntimeContext);
tableProvider.releaseOwnedTable(tableRuntimeContext, threadNumber);
tableRuntimeContext = null;
} else if (
tableJdbcConfigBean.batchTableStrategy == BatchTableStrategy.SWITCH_TABLES
&& !tableRuntimeContext.isUsingNonIncrementalLoad()) {
tableRuntimeContext = null;
}
final List<TableRuntimeContext> removedPartitions = tableProvider.getAndClearRemovedPartitions();
if (removedPartitions != null && removedPartitions.size() > 0) {
for (TableRuntimeContext partition : removedPartitions) {
LOG.debug(
"Removing offset entry for partition {} since it has been removed from the table provider",
partition.getDescription()
);
context.commitOffset(partition.getOffsetKey(), null);
}
}
} } |
public class class_name {
private final void buildIfNeededMap() {
if ( map == null ) {
map = new HashMap<>( items.length );
for ( Entry<String, Value> miv : items ) {
if ( miv == null ) {
break;
}
map.put( miv.getKey(), miv.getValue() );
}
}
} } | public class class_name {
private final void buildIfNeededMap() {
if ( map == null ) {
map = new HashMap<>( items.length ); // depends on control dependency: [if], data = [none]
for ( Entry<String, Value> miv : items ) {
if ( miv == null ) {
break;
}
map.put( miv.getKey(), miv.getValue() ); // depends on control dependency: [for], data = [miv]
}
}
} } |
public class class_name {
public void marshall(GetMaintenanceWindowRequest getMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) {
if (getMaintenanceWindowRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetMaintenanceWindowRequest getMaintenanceWindowRequest, ProtocolMarshaller protocolMarshaller) {
if (getMaintenanceWindowRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMaintenanceWindowRequest.getWindowId(), WINDOWID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void writeVariableAttributes(BaseType bt, DAS das) {
try {
AttributeTable attr = das.getAttributeTable(bt.getEncodedName());
if (attr != null) {
pWrt.print("<textarea name=\""
+ bt.getLongName().replace('.', '_')
+ "_attr"
+ "\" rows="
+ _attrRows
+ " cols="
+ _attrCols
+ ">\n"
);
writeAttributes(attr);
pWrt.print("</textarea>\n\n");
}
} catch (NoSuchAttributeException nsae) {
}
} } | public class class_name {
public void writeVariableAttributes(BaseType bt, DAS das) {
try {
AttributeTable attr = das.getAttributeTable(bt.getEncodedName());
if (attr != null) {
pWrt.print("<textarea name=\""
+ bt.getLongName().replace('.', '_')
+ "_attr"
+ "\" rows="
+ _attrRows
+ " cols="
+ _attrCols
+ ">\n"
);
// depends on control dependency: [if], data = [none]
writeAttributes(attr);
// depends on control dependency: [if], data = [(attr]
pWrt.print("</textarea>\n\n");
// depends on control dependency: [if], data = [none]
}
} catch (NoSuchAttributeException nsae) {
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static List<X509GeneralName> getX509GeneralNames(GeneralNames genNames)
{
if (genNames == null) {
return null;
}
GeneralName[] names = genNames.getNames();
List<X509GeneralName> x509names = new ArrayList<X509GeneralName>(names.length);
for (GeneralName name : names) {
switch (name.getTagNo()) {
case GeneralName.rfc822Name:
x509names.add(new X509Rfc822Name(name));
break;
case GeneralName.dNSName:
x509names.add(new X509DnsName(name));
break;
case GeneralName.directoryName:
x509names.add(new X509DirectoryName(name));
break;
case GeneralName.uniformResourceIdentifier:
x509names.add(new X509URI(name));
break;
case GeneralName.iPAddress:
x509names.add(new X509IpAddress(name));
break;
default:
x509names.add(new X509GenericName(name));
break;
}
}
return x509names;
} } | public class class_name {
public static List<X509GeneralName> getX509GeneralNames(GeneralNames genNames)
{
if (genNames == null) {
return null; // depends on control dependency: [if], data = [none]
}
GeneralName[] names = genNames.getNames();
List<X509GeneralName> x509names = new ArrayList<X509GeneralName>(names.length);
for (GeneralName name : names) {
switch (name.getTagNo()) {
case GeneralName.rfc822Name:
x509names.add(new X509Rfc822Name(name));
break;
case GeneralName.dNSName:
x509names.add(new X509DnsName(name));
break;
case GeneralName.directoryName:
x509names.add(new X509DirectoryName(name));
break;
case GeneralName.uniformResourceIdentifier:
x509names.add(new X509URI(name));
break;
case GeneralName.iPAddress:
x509names.add(new X509IpAddress(name));
break;
default:
x509names.add(new X509GenericName(name));
break;
}
}
return x509names;
} } |
public class class_name {
public static char[] encode(final byte[] input, final int iOff, final int iLen) {
final int oDataLen = (iLen * CONSTANT_4 + 2) / CONSTANT_3; // output length without padding
final int oLen = ((iLen + 2) / CONSTANT_3) * CONSTANT_4; // output length including padding
char[] out = new char[oLen];
int ipValue = iOff;
final int iEnd = iOff + iLen;
int opValue = 0;
while (ipValue < iEnd) {
final int i0Value = input[ipValue++] & CONSTANT_0XFF;
final int i1Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
final int i2Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
final int o0Value = i0Value >>> 2;
final int o1Value = ((i0Value & CONSTANT_3) << CONSTANT_4) | (i1Value >>> CONSTANT_4);
final int o2Value = ((i1Value & CONSTANT_0XF) << 2) | (i2Value >>> CONSTANT_6);
final int o3Value = i2Value & CONSTANT_0X3F;
out[opValue++] = map1[o0Value];
out[opValue++] = map1[o1Value];
out[opValue] = opValue < oDataLen ? map1[o2Value] : '=';
opValue++;
out[opValue] = opValue < oDataLen ? map1[o3Value] : '=';
opValue++;
}
return out;
} } | public class class_name {
public static char[] encode(final byte[] input, final int iOff, final int iLen) {
final int oDataLen = (iLen * CONSTANT_4 + 2) / CONSTANT_3; // output length without padding
final int oLen = ((iLen + 2) / CONSTANT_3) * CONSTANT_4; // output length including padding
char[] out = new char[oLen];
int ipValue = iOff;
final int iEnd = iOff + iLen;
int opValue = 0;
while (ipValue < iEnd) {
final int i0Value = input[ipValue++] & CONSTANT_0XFF;
final int i1Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
final int i2Value = ipValue < iEnd ? input[ipValue++] & CONSTANT_0XFF : 0;
final int o0Value = i0Value >>> 2;
final int o1Value = ((i0Value & CONSTANT_3) << CONSTANT_4) | (i1Value >>> CONSTANT_4);
final int o2Value = ((i1Value & CONSTANT_0XF) << 2) | (i2Value >>> CONSTANT_6);
final int o3Value = i2Value & CONSTANT_0X3F;
out[opValue++] = map1[o0Value]; // depends on control dependency: [while], data = [none]
out[opValue++] = map1[o1Value]; // depends on control dependency: [while], data = [none]
out[opValue] = opValue < oDataLen ? map1[o2Value] : '='; // depends on control dependency: [while], data = [none]
opValue++; // depends on control dependency: [while], data = [none]
out[opValue] = opValue < oDataLen ? map1[o3Value] : '='; // depends on control dependency: [while], data = [none]
opValue++; // depends on control dependency: [while], data = [none]
}
return out;
} } |
public class class_name {
public boolean overlaps(BoundingBox o, double cutoff) {
if (this==o) return true;
// x dimension
if (!areOverlapping(xmin,xmax,o.xmin,o.xmax,cutoff)) {
return false;
}
// y dimension
if (!areOverlapping(ymin,ymax,o.ymin,o.ymax,cutoff)) {
return false;
}
// z dimension
if (!areOverlapping(zmin,zmax,o.zmin,o.zmax,cutoff)) {
return false;
}
return true;
} } | public class class_name {
public boolean overlaps(BoundingBox o, double cutoff) {
if (this==o) return true;
// x dimension
if (!areOverlapping(xmin,xmax,o.xmin,o.xmax,cutoff)) {
return false; // depends on control dependency: [if], data = [none]
}
// y dimension
if (!areOverlapping(ymin,ymax,o.ymin,o.ymax,cutoff)) {
return false; // depends on control dependency: [if], data = [none]
}
// z dimension
if (!areOverlapping(zmin,zmax,o.zmin,o.zmax,cutoff)) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public final void setContext(Kind c) {
//NOTE: Put context specific link code here.
switch (c) {
case ALL_CLASSES_FRAME:
case PACKAGE_FRAME:
case IMPLEMENTED_CLASSES:
case SUBCLASSES:
case EXECUTABLE_ELEMENT_COPY:
case VARIABLE_ELEMENT_COPY:
case PROPERTY_COPY:
case CLASS_USE_HEADER:
includeTypeInClassLinkLabel = false;
break;
case ANNOTATION:
excludeTypeParameterLinks = true;
excludeTypeBounds = true;
break;
case IMPLEMENTED_INTERFACES:
case SUPER_INTERFACES:
case SUBINTERFACES:
case CLASS_TREE_PARENT:
case TREE:
case CLASS_SIGNATURE_PARENT_NAME:
excludeTypeParameterLinks = true;
excludeTypeBounds = true;
includeTypeInClassLinkLabel = false;
includeTypeAsSepLink = true;
break;
case PACKAGE:
case CLASS_USE:
case CLASS_HEADER:
case CLASS_SIGNATURE:
case RECEIVER_TYPE:
excludeTypeParameterLinks = true;
includeTypeAsSepLink = true;
includeTypeInClassLinkLabel = false;
break;
case MEMBER_TYPE_PARAMS:
includeTypeAsSepLink = true;
includeTypeInClassLinkLabel = false;
break;
case RETURN_TYPE:
case SUMMARY_RETURN_TYPE:
excludeTypeBounds = true;
break;
case EXECUTABLE_MEMBER_PARAM:
excludeTypeBounds = true;
break;
}
context = c;
if (type != null &&
utils.isTypeVariable(type) &&
utils.isExecutableElement(utils.asTypeElement(type).getEnclosingElement())) {
excludeTypeParameterLinks = true;
}
} } | public class class_name {
public final void setContext(Kind c) {
//NOTE: Put context specific link code here.
switch (c) {
case ALL_CLASSES_FRAME:
case PACKAGE_FRAME:
case IMPLEMENTED_CLASSES:
case SUBCLASSES:
case EXECUTABLE_ELEMENT_COPY:
case VARIABLE_ELEMENT_COPY:
case PROPERTY_COPY:
case CLASS_USE_HEADER:
includeTypeInClassLinkLabel = false;
break;
case ANNOTATION:
excludeTypeParameterLinks = true;
excludeTypeBounds = true;
break;
case IMPLEMENTED_INTERFACES:
case SUPER_INTERFACES:
case SUBINTERFACES:
case CLASS_TREE_PARENT:
case TREE:
case CLASS_SIGNATURE_PARENT_NAME:
excludeTypeParameterLinks = true;
excludeTypeBounds = true;
includeTypeInClassLinkLabel = false;
includeTypeAsSepLink = true;
break;
case PACKAGE:
case CLASS_USE:
case CLASS_HEADER:
case CLASS_SIGNATURE:
case RECEIVER_TYPE:
excludeTypeParameterLinks = true;
includeTypeAsSepLink = true;
includeTypeInClassLinkLabel = false;
break;
case MEMBER_TYPE_PARAMS:
includeTypeAsSepLink = true;
includeTypeInClassLinkLabel = false;
break;
case RETURN_TYPE:
case SUMMARY_RETURN_TYPE:
excludeTypeBounds = true;
break;
case EXECUTABLE_MEMBER_PARAM:
excludeTypeBounds = true;
break;
}
context = c;
if (type != null &&
utils.isTypeVariable(type) &&
utils.isExecutableElement(utils.asTypeElement(type).getEnclosingElement())) {
excludeTypeParameterLinks = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void inject(Configuration config) {
Context baseContext = ContextUtils.discover(config.getContext());
Set<Field> fields = config.getInjectionTargets(InjectionCategory.APPLICATION);
for (Field field : fields) {
try {
if(!field.isAccessible()) field.setAccessible(true);
field.set(config.getContext(), baseContext.getApplicationContext());
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
}
}
} } | public class class_name {
@Override
public void inject(Configuration config) {
Context baseContext = ContextUtils.discover(config.getContext());
Set<Field> fields = config.getInjectionTargets(InjectionCategory.APPLICATION);
for (Field field : fields) {
try {
if(!field.isAccessible()) field.setAccessible(true);
field.set(config.getContext(), baseContext.getApplicationContext()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
Log.e(getClass().getName(), "Injection Failed!", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static Map<String, ModelDescription> assigneModelsToViews(Map<ModelDescription,
XLinkConnectorView[]> modelsToViews) {
HashMap<String, ModelDescription> viewsToModels = new HashMap<String, ModelDescription>();
for (ModelDescription modelInfo : modelsToViews.keySet()) {
List<XLinkConnectorView> currentViewList = Arrays.asList(modelsToViews.get(modelInfo));
for (XLinkConnectorView view : currentViewList) {
if (!viewsToModels.containsKey(view.getViewId())) {
viewsToModels.put(view.getViewId(), modelInfo);
}
}
}
return viewsToModels;
} } | public class class_name {
private static Map<String, ModelDescription> assigneModelsToViews(Map<ModelDescription,
XLinkConnectorView[]> modelsToViews) {
HashMap<String, ModelDescription> viewsToModels = new HashMap<String, ModelDescription>();
for (ModelDescription modelInfo : modelsToViews.keySet()) {
List<XLinkConnectorView> currentViewList = Arrays.asList(modelsToViews.get(modelInfo));
for (XLinkConnectorView view : currentViewList) {
if (!viewsToModels.containsKey(view.getViewId())) {
viewsToModels.put(view.getViewId(), modelInfo); // depends on control dependency: [if], data = [none]
}
}
}
return viewsToModels;
} } |
public class class_name {
public NumberExpression<Integer> milliSecond() {
if (milliseconds == null) {
milliseconds = Expressions.numberOperation(Integer.class, Ops.DateTimeOps.MILLISECOND, mixin);
}
return milliseconds;
} } | public class class_name {
public NumberExpression<Integer> milliSecond() {
if (milliseconds == null) {
milliseconds = Expressions.numberOperation(Integer.class, Ops.DateTimeOps.MILLISECOND, mixin); // depends on control dependency: [if], data = [none]
}
return milliseconds;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T> T get(String... path) {
ExtensionAware root = searchRoot;
for (String name : path) {
ExtensionContainer children = root.getExtensions();
root = (ExtensionAware) children.getByName(name);
}
return (T) root; // this is potentially unchecked.
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T> T get(String... path) {
ExtensionAware root = searchRoot;
for (String name : path) {
ExtensionContainer children = root.getExtensions();
root = (ExtensionAware) children.getByName(name); // depends on control dependency: [for], data = [name]
}
return (T) root; // this is potentially unchecked.
} } |
public class class_name {
private static boolean adjustNumber(Class<?>[] paramTypes, Object[] args, int index) {
if (paramTypes[index].isPrimitive()) {
if (paramTypes[index] == int.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]);
return true;
} else if (paramTypes[index] == double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]);
return true;
} else if (paramTypes[index] == long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]);
return true;
} else if (paramTypes[index] == short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]);
return true;
} else if (paramTypes[index] == float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]);
return true;
}
} else {
if (paramTypes[index] == Integer.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]);
return true;
} else if (paramTypes[index] == Double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]);
return true;
} else if (paramTypes[index] == Long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]);
return true;
} else if (paramTypes[index] == Short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]);
return true;
} else if (paramTypes[index] == Float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]);
return true;
}
}
return false;
} } | public class class_name {
private static boolean adjustNumber(Class<?>[] paramTypes, Object[] args, int index) {
if (paramTypes[index].isPrimitive()) {
if (paramTypes[index] == int.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} else {
if (paramTypes[index] == Integer.class) {
args[index] = LdiIntegerConversionUtil.toInteger(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == Double.class) {
args[index] = LdiDoubleConversionUtil.toDouble(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == Long.class) {
args[index] = LdiLongConversionUtil.toLong(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == Short.class) {
args[index] = LdiShortConversionUtil.toShort(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else if (paramTypes[index] == Float.class) {
args[index] = LdiFloatConversionUtil.toFloat(args[index]); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public boolean addTask(Task task) throws SlotNotFoundException, SlotNotActiveException {
Preconditions.checkNotNull(task);
TaskSlot taskSlot = getTaskSlot(task.getAllocationId());
if (taskSlot != null) {
if (taskSlot.isActive(task.getJobID(), task.getAllocationId())) {
if (taskSlot.add(task)) {
taskSlotMappings.put(task.getExecutionId(), new TaskSlotMapping(task, taskSlot));
return true;
} else {
return false;
}
} else {
throw new SlotNotActiveException(task.getJobID(), task.getAllocationId());
}
} else {
throw new SlotNotFoundException(task.getAllocationId());
}
} } | public class class_name {
public boolean addTask(Task task) throws SlotNotFoundException, SlotNotActiveException {
Preconditions.checkNotNull(task);
TaskSlot taskSlot = getTaskSlot(task.getAllocationId());
if (taskSlot != null) {
if (taskSlot.isActive(task.getJobID(), task.getAllocationId())) {
if (taskSlot.add(task)) {
taskSlotMappings.put(task.getExecutionId(), new TaskSlotMapping(task, taskSlot)); // 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]
}
} else {
throw new SlotNotActiveException(task.getJobID(), task.getAllocationId());
}
} else {
throw new SlotNotFoundException(task.getAllocationId());
}
} } |
public class class_name {
public static int lookup(String text, int filter) {
int type = UNKNOWN;
if (LOOKUP.containsKey(text)) {
type = LOOKUP.get(text);
if (filter != UNKNOWN && !ofType(type, filter)) {
type = UNKNOWN;
}
}
return type;
} } | public class class_name {
public static int lookup(String text, int filter) {
int type = UNKNOWN;
if (LOOKUP.containsKey(text)) {
type = LOOKUP.get(text); // depends on control dependency: [if], data = [none]
if (filter != UNKNOWN && !ofType(type, filter)) {
type = UNKNOWN; // depends on control dependency: [if], data = [none]
}
}
return type;
} } |
public class class_name {
public boolean compare( byte buf[], int offset ) {
if ( size == 4 ) {
int checksum = ( (buf[offset+0] & 0xff) << 24 ) |
( (buf[offset+1] & 0xff) << 16 ) |
( (buf[offset+2] & 0xff) << 8 ) |
( (buf[offset+3] & 0xff) );
return checksum == (int) summer.getValue();
}
return size == 0;
} } | public class class_name {
public boolean compare( byte buf[], int offset ) {
if ( size == 4 ) {
int checksum = ( (buf[offset+0] & 0xff) << 24 ) |
( (buf[offset+1] & 0xff) << 16 ) |
( (buf[offset+2] & 0xff) << 8 ) |
( (buf[offset+3] & 0xff) );
return checksum == (int) summer.getValue();
// depends on control dependency: [if], data = [none]
}
return size == 0;
} } |
public class class_name {
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
String redirectUrl = null;
if (useForward) {
if (forceHttps && "http".equals(request.getScheme())) {
// First redirect the current request to HTTPS.
// When that request is received, the forward to the login page will be
// used.
redirectUrl = buildHttpsRedirectUrlForRequest(request);
}
if (redirectUrl == null) {
String loginForm = determineUrlToUseForThisRequest(request, response,
authException);
if (logger.isDebugEnabled()) {
logger.debug("Server side forward to: " + loginForm);
}
RequestDispatcher dispatcher = request.getRequestDispatcher(loginForm);
dispatcher.forward(request, response);
return;
}
}
else {
// redirect to login page. Use https if forceHttps true
redirectUrl = buildRedirectUrlToLoginPage(request, response, authException);
}
redirectStrategy.sendRedirect(request, response, redirectUrl);
} } | public class class_name {
public void commence(HttpServletRequest request, HttpServletResponse response,
AuthenticationException authException) throws IOException, ServletException {
String redirectUrl = null;
if (useForward) {
if (forceHttps && "http".equals(request.getScheme())) {
// First redirect the current request to HTTPS.
// When that request is received, the forward to the login page will be
// used.
redirectUrl = buildHttpsRedirectUrlForRequest(request); // depends on control dependency: [if], data = [none]
}
if (redirectUrl == null) {
String loginForm = determineUrlToUseForThisRequest(request, response,
authException);
if (logger.isDebugEnabled()) {
logger.debug("Server side forward to: " + loginForm); // depends on control dependency: [if], data = [none]
}
RequestDispatcher dispatcher = request.getRequestDispatcher(loginForm);
dispatcher.forward(request, response); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
else {
// redirect to login page. Use https if forceHttps true
redirectUrl = buildRedirectUrlToLoginPage(request, response, authException);
}
redirectStrategy.sendRedirect(request, response, redirectUrl);
} } |
public class class_name {
public Instruction add(Instruction _instruction) {
if (head == null) {
head = _instruction;
} else {
_instruction.setPrevExpr(tail);
tail.setNextExpr(_instruction);
}
tail = _instruction;
logger.log(Level.FINE, "After PUSH of " + _instruction + " tail=" + tail);
return (tail);
} } | public class class_name {
public Instruction add(Instruction _instruction) {
if (head == null) {
head = _instruction; // depends on control dependency: [if], data = [none]
} else {
_instruction.setPrevExpr(tail); // depends on control dependency: [if], data = [none]
tail.setNextExpr(_instruction); // depends on control dependency: [if], data = [none]
}
tail = _instruction;
logger.log(Level.FINE, "After PUSH of " + _instruction + " tail=" + tail);
return (tail);
} } |
public class class_name {
public EClass getIfcMetricValueSelect() {
if (ifcMetricValueSelectEClass == null) {
ifcMetricValueSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(963);
}
return ifcMetricValueSelectEClass;
} } | public class class_name {
public EClass getIfcMetricValueSelect() {
if (ifcMetricValueSelectEClass == null) {
ifcMetricValueSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(963);
// depends on control dependency: [if], data = [none]
}
return ifcMetricValueSelectEClass;
} } |
public class class_name {
protected boolean isDataTableResultType(DefaultResultSetHandler resultSetHandler)
{
MappedStatement mappedStatement= reflect(resultSetHandler);
List<ResultMap> res=mappedStatement.getResultMaps();
if(res.size()==1&&res.get(0).getType().equals(DataTable.class))
{
return true;
}
return false;
} } | public class class_name {
protected boolean isDataTableResultType(DefaultResultSetHandler resultSetHandler)
{
MappedStatement mappedStatement= reflect(resultSetHandler);
List<ResultMap> res=mappedStatement.getResultMaps();
if(res.size()==1&&res.get(0).getType().equals(DataTable.class))
{
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static Class getTypeClass(Type type)
{
Class typeClassClass = null;
if (type instanceof Class) {
typeClassClass = (Class) type;
} else if (type instanceof ParameterizedType) {
typeClassClass = (Class) ((ParameterizedType) type).getRawType();
} else if (type instanceof GenericArrayType) {
Class<?> arrrayParameter = getTypeClass(((GenericArrayType) type).getGenericComponentType());
if (arrrayParameter != null) {
typeClassClass = Array.newInstance(arrrayParameter, 0).getClass();
}
}
return typeClassClass;
} } | public class class_name {
public static Class getTypeClass(Type type)
{
Class typeClassClass = null;
if (type instanceof Class) {
typeClassClass = (Class) type;
} else if (type instanceof ParameterizedType) {
typeClassClass = (Class) ((ParameterizedType) type).getRawType();
} else if (type instanceof GenericArrayType) {
Class<?> arrrayParameter = getTypeClass(((GenericArrayType) type).getGenericComponentType());
if (arrrayParameter != null) {
typeClassClass = Array.newInstance(arrrayParameter, 0).getClass(); // depends on control dependency: [if], data = [(arrrayParameter]
}
}
return typeClassClass;
} } |
public class class_name {
public long getFileOffset(SectionTable table) {
checkArgument(table != null, "section table must not be null");
Optional<SectionHeader> section = maybeGetSectionTableEntry(table);
if (section.isPresent()) {
long sectionRVA = section.get().getAlignedVirtualAddress();
long sectionOffset = section.get().getAlignedPointerToRaw();
return (virtualAddress - sectionRVA) + sectionOffset;
}
return virtualAddress; // TODO should be smaller than file length!
} } | public class class_name {
public long getFileOffset(SectionTable table) {
checkArgument(table != null, "section table must not be null");
Optional<SectionHeader> section = maybeGetSectionTableEntry(table);
if (section.isPresent()) {
long sectionRVA = section.get().getAlignedVirtualAddress();
long sectionOffset = section.get().getAlignedPointerToRaw();
return (virtualAddress - sectionRVA) + sectionOffset; // depends on control dependency: [if], data = [none]
}
return virtualAddress; // TODO should be smaller than file length!
} } |
public class class_name {
public ListDeadLetterSourceQueuesResult withQueueUrls(String... queueUrls) {
if (this.queueUrls == null) {
setQueueUrls(new com.amazonaws.internal.SdkInternalList<String>(queueUrls.length));
}
for (String ele : queueUrls) {
this.queueUrls.add(ele);
}
return this;
} } | public class class_name {
public ListDeadLetterSourceQueuesResult withQueueUrls(String... queueUrls) {
if (this.queueUrls == null) {
setQueueUrls(new com.amazonaws.internal.SdkInternalList<String>(queueUrls.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : queueUrls) {
this.queueUrls.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String extractUserName() {
final String username = getUsername();
if (null != username && !"".equals(username)) {
return username;
}
return extractUserName(getHostname());
} } | public class class_name {
public String extractUserName() {
final String username = getUsername();
if (null != username && !"".equals(username)) {
return username; // depends on control dependency: [if], data = [none]
}
return extractUserName(getHostname());
} } |
public class class_name {
static Proxy parseProxySettings(String spec) {
try {
if (spec == null || spec.length() == 0) {
return null;
}
return new Proxy(spec);
} catch (URISyntaxException e) {
return null;
}
} } | public class class_name {
static Proxy parseProxySettings(String spec) {
try {
if (spec == null || spec.length() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
return new Proxy(spec); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public EClass getIfcShapeModel() {
if (ifcShapeModelEClass == null) {
ifcShapeModelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(596);
}
return ifcShapeModelEClass;
} } | public class class_name {
@Override
public EClass getIfcShapeModel() {
if (ifcShapeModelEClass == null) {
ifcShapeModelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(596);
// depends on control dependency: [if], data = [none]
}
return ifcShapeModelEClass;
} } |
public class class_name {
public static boolean checkProcessWatchdog(final Watchdog watchdogAnnotation, final ProceedingJoinPoint proceedingJoinPoint, final Throwable throwable) {
// check if watchdog aspect processing is deactivated by annotation
if (watchdogAnnotation != null && watchdogAnnotation.isActive()) {
// checks if throws annotations must be suppressed
boolean throwableIsPartOfThrowsDeclaration = WatchdogUtils.checkIfMethodThrowsContainsPassedException(proceedingJoinPoint, throwable);
if (!watchdogAnnotation.suppressThrowsExceptions() || (watchdogAnnotation.suppressThrowsExceptions() && !throwableIsPartOfThrowsDeclaration)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean checkProcessWatchdog(final Watchdog watchdogAnnotation, final ProceedingJoinPoint proceedingJoinPoint, final Throwable throwable) {
// check if watchdog aspect processing is deactivated by annotation
if (watchdogAnnotation != null && watchdogAnnotation.isActive()) {
// checks if throws annotations must be suppressed
boolean throwableIsPartOfThrowsDeclaration = WatchdogUtils.checkIfMethodThrowsContainsPassedException(proceedingJoinPoint, throwable);
if (!watchdogAnnotation.suppressThrowsExceptions() || (watchdogAnnotation.suppressThrowsExceptions() && !throwableIsPartOfThrowsDeclaration)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
protected int _nextsib(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_nextsib.elementAt(identity);
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} } | public class class_name {
protected int _nextsib(int identity)
{
// Boiler-plate code for each of the _xxx functions, except for the array.
int info = (identity >= m_size) ? NOTPROCESSED : m_nextsib.elementAt(identity);
// Check to see if the information requested has been processed, and,
// if not, advance the iterator until we the information has been
// processed.
while (info == NOTPROCESSED)
{
boolean isMore = nextNode();
if (identity >= m_size &&!isMore)
return NULL;
else
{
info = m_nextsib.elementAt(identity); // depends on control dependency: [if], data = [(identity]
if(info == NOTPROCESSED && !isMore)
return NULL;
}
}
return info;
} } |
public class class_name {
public static List<String> getExpressionsNames(ReportLayout layout) {
List<String> expressions = new LinkedList<String>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : list) {
if (be instanceof ExpressionBandElement) {
String expName = ((ExpressionBandElement) be).getExpressionName();
if (!expressions.contains(expName)) {
expressions.add(expName);
}
}
}
}
}
return expressions;
} } | public class class_name {
public static List<String> getExpressionsNames(ReportLayout layout) {
List<String> expressions = new LinkedList<String>();
for (Band band : layout.getBands()) {
for (int i = 0, rows = band.getRowCount(); i < rows; i++) {
List<BandElement> list = band.getRow(i);
for (BandElement be : list) {
if (be instanceof ExpressionBandElement) {
String expName = ((ExpressionBandElement) be).getExpressionName();
if (!expressions.contains(expName)) {
expressions.add(expName); // depends on control dependency: [if], data = [none]
}
}
}
}
}
return expressions;
} } |
public class class_name {
protected boolean podRunning(Json podStatus) {
if(podStatus == null) {
return false;
}
/*
* A pod can only be considered 'running' if the following conditions are all true:
* 1. status.phase == "Running",
* 2. status.message is Undefined (does not exist)
* 3. status.reason is Undefined (does not exist)
* 4. all of status.containerStatuses[*].ready == true
* 5. for conditions[*].type == "Ready" conditions[*].status must be "True"
*/
// walk through each condition step by step
// 1 status.phase
log.trace("Determining pod status");
String phase = Optional.ofNullable(podStatus.at("phase"))
.map(Json::asString)
.orElse("not running");
log.trace(" status.phase=%s", phase);
if(!phase.equalsIgnoreCase("Running")) {
return false;
}
// 2. and 3. status.message and status.reason
String statusMessage = Optional.ofNullable(podStatus.at("message"))
.map(Json::asString)
.orElse(null);
String statusReason = Optional.ofNullable(podStatus.at("reason"))
.map(Json::asString)
.orElse(null);
log.trace(" status.message=%s and status.reason=%s", statusMessage, statusReason);
if(statusMessage != null || statusReason != null) {
return false;
}
// 4. status.containerStatuses.ready
List<Json> containerStatuses = Optional.ofNullable(podStatus.at("containerStatuses"))
.map(Json::asJsonList)
.orElse(Collections.emptyList());
boolean ready = true;
// if we have no containerStatuses, we don't check for it and consider this condition as passed
for(Json containerStatus: containerStatuses) {
ready = ready && containerStatus.at("ready").asBoolean();
}
log.trace(" containerStatuses[].status of all container is %s", Boolean.toString(ready));
if(!ready) {
return false;
}
// 5. ready condition must be "True"
Boolean readyCondition = Boolean.FALSE;
List<Json> conditions = podStatus.at("conditions").asJsonList();
// walk through all the conditions and find type=="Ready" and get the value of the status property
for(Json condition: conditions) {
String type = condition.at("type").asString();
if(type.equalsIgnoreCase("Ready")) {
readyCondition = new Boolean(condition.at("status").asString());
}
}
log.trace( "conditions with type==\"Ready\" has status property value = %s", readyCondition.toString());
if(!readyCondition.booleanValue()) {
return false;
}
return true;
} } | public class class_name {
protected boolean podRunning(Json podStatus) {
if(podStatus == null) {
return false; // depends on control dependency: [if], data = [none]
}
/*
* A pod can only be considered 'running' if the following conditions are all true:
* 1. status.phase == "Running",
* 2. status.message is Undefined (does not exist)
* 3. status.reason is Undefined (does not exist)
* 4. all of status.containerStatuses[*].ready == true
* 5. for conditions[*].type == "Ready" conditions[*].status must be "True"
*/
// walk through each condition step by step
// 1 status.phase
log.trace("Determining pod status");
String phase = Optional.ofNullable(podStatus.at("phase"))
.map(Json::asString)
.orElse("not running");
log.trace(" status.phase=%s", phase);
if(!phase.equalsIgnoreCase("Running")) {
return false; // depends on control dependency: [if], data = [none]
}
// 2. and 3. status.message and status.reason
String statusMessage = Optional.ofNullable(podStatus.at("message"))
.map(Json::asString)
.orElse(null);
String statusReason = Optional.ofNullable(podStatus.at("reason"))
.map(Json::asString)
.orElse(null);
log.trace(" status.message=%s and status.reason=%s", statusMessage, statusReason);
if(statusMessage != null || statusReason != null) {
return false; // depends on control dependency: [if], data = [none]
}
// 4. status.containerStatuses.ready
List<Json> containerStatuses = Optional.ofNullable(podStatus.at("containerStatuses"))
.map(Json::asJsonList)
.orElse(Collections.emptyList());
boolean ready = true;
// if we have no containerStatuses, we don't check for it and consider this condition as passed
for(Json containerStatus: containerStatuses) {
ready = ready && containerStatus.at("ready").asBoolean(); // depends on control dependency: [for], data = [containerStatus]
}
log.trace(" containerStatuses[].status of all container is %s", Boolean.toString(ready));
if(!ready) {
return false; // depends on control dependency: [if], data = [none]
}
// 5. ready condition must be "True"
Boolean readyCondition = Boolean.FALSE;
List<Json> conditions = podStatus.at("conditions").asJsonList();
// walk through all the conditions and find type=="Ready" and get the value of the status property
for(Json condition: conditions) {
String type = condition.at("type").asString();
if(type.equalsIgnoreCase("Ready")) {
readyCondition = new Boolean(condition.at("status").asString()); // depends on control dependency: [if], data = [none]
}
}
log.trace( "conditions with type==\"Ready\" has status property value = %s", readyCondition.toString());
if(!readyCondition.booleanValue()) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void setPeriodBeforeEnd(ReadablePeriod period) {
if (period == null) {
setStartMillis(getEndMillis());
} else {
setStartMillis(getChronology().add(period, getEndMillis(), -1));
}
} } | public class class_name {
public void setPeriodBeforeEnd(ReadablePeriod period) {
if (period == null) {
setStartMillis(getEndMillis()); // depends on control dependency: [if], data = [none]
} else {
setStartMillis(getChronology().add(period, getEndMillis(), -1)); // depends on control dependency: [if], data = [(period]
}
} } |
public class class_name {
static void appendValues(final ResultRow rs,
final Appender ap,
final Charset charset,
final Formatting fmt,
final Iterator<ColumnType> cols,
final int colIndex) {
if (!cols.hasNext()) {
return;
} // end of if
// ---
if (colIndex > 0) {
ap.append(fmt.valueSeparator);
} // end of if
final ColumnType col = cols.next();
if (rs.isNull(colIndex)) {
appendNull(ap, fmt, col);
appendValues(rs, ap, charset, fmt, cols, colIndex+1);
return;
} // end of if
// ---
switch (col) {
case BigDecimal:
ap.append(String.format(fmt.someBigDecimal,
rs.getBigDecimal(colIndex)));
break;
case Boolean:
ap.append(String.format(fmt.someBoolean,
rs.getBoolean(colIndex)));
break;
case Byte:
ap.append(String.format(fmt.someByte,
rs.getByte(colIndex)));
break;
case Short:
ap.append(String.format(fmt.someShort,
rs.getShort(colIndex)));
break;
case Date:
ap.append(String.format(fmt.someDate,
rs.getDate(colIndex).getTime()));
break;
case Double:
ap.append(String.format(fmt.someDouble,
rs.getDouble(colIndex)));
break;
case Float:
ap.append(String.format(fmt.someFloat,
rs.getFloat(colIndex)));
break;
case Int:
ap.append(String.format(fmt.someInt,
rs.getInt(colIndex)));
break;
case Long:
ap.append(String.format(fmt.someLong,
rs.getLong(colIndex)));
break;
case Time:
ap.append(String.format(fmt.someTime,
rs.getTime(colIndex).getTime()));
break;
case Timestamp:
ap.append(String.format(fmt.someTimestamp,
rs.getTimestamp(colIndex).getTime()));
break;
default:
ap.append(String.format(fmt.someString,
new String(rs.getString(colIndex).
getBytes(charset)).
replaceAll("\"", "\\\"")));
break;
} // end of switch
appendValues(rs, ap, charset, fmt, cols, colIndex+1);
} } | public class class_name {
static void appendValues(final ResultRow rs,
final Appender ap,
final Charset charset,
final Formatting fmt,
final Iterator<ColumnType> cols,
final int colIndex) {
if (!cols.hasNext()) {
return; // depends on control dependency: [if], data = [none]
} // end of if
// ---
if (colIndex > 0) {
ap.append(fmt.valueSeparator); // depends on control dependency: [if], data = [none]
} // end of if
final ColumnType col = cols.next();
if (rs.isNull(colIndex)) {
appendNull(ap, fmt, col); // depends on control dependency: [if], data = [none]
appendValues(rs, ap, charset, fmt, cols, colIndex+1); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} // end of if
// ---
switch (col) {
case BigDecimal:
ap.append(String.format(fmt.someBigDecimal,
rs.getBigDecimal(colIndex)));
break;
case Boolean:
ap.append(String.format(fmt.someBoolean,
rs.getBoolean(colIndex)));
break;
case Byte:
ap.append(String.format(fmt.someByte,
rs.getByte(colIndex)));
break;
case Short:
ap.append(String.format(fmt.someShort,
rs.getShort(colIndex)));
break;
case Date:
ap.append(String.format(fmt.someDate,
rs.getDate(colIndex).getTime()));
break;
case Double:
ap.append(String.format(fmt.someDouble,
rs.getDouble(colIndex)));
break;
case Float:
ap.append(String.format(fmt.someFloat,
rs.getFloat(colIndex)));
break;
case Int:
ap.append(String.format(fmt.someInt,
rs.getInt(colIndex)));
break;
case Long:
ap.append(String.format(fmt.someLong,
rs.getLong(colIndex)));
break;
case Time:
ap.append(String.format(fmt.someTime,
rs.getTime(colIndex).getTime()));
break;
case Timestamp:
ap.append(String.format(fmt.someTimestamp,
rs.getTimestamp(colIndex).getTime()));
break;
default:
ap.append(String.format(fmt.someString,
new String(rs.getString(colIndex).
getBytes(charset)).
replaceAll("\"", "\\\"")));
break;
} // end of switch
appendValues(rs, ap, charset, fmt, cols, colIndex+1);
} } |
public class class_name {
public void marshall(ResolveCaseRequest resolveCaseRequest, ProtocolMarshaller protocolMarshaller) {
if (resolveCaseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resolveCaseRequest.getCaseId(), CASEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ResolveCaseRequest resolveCaseRequest, ProtocolMarshaller protocolMarshaller) {
if (resolveCaseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(resolveCaseRequest.getCaseId(), CASEID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EClass getIfcLabel() {
if (ifcLabelEClass == null) {
ifcLabelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(693);
}
return ifcLabelEClass;
} } | public class class_name {
public EClass getIfcLabel() {
if (ifcLabelEClass == null) {
ifcLabelEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(693);
// depends on control dependency: [if], data = [none]
}
return ifcLabelEClass;
} } |
public class class_name {
public ScopeNode callMixin(String name, ArgumentsNode arguments) {
List<ExpressionGroupNode> argumentList = (arguments != null) ? NodeTreeUtils.getChildren(arguments, ExpressionGroupNode.class) : Collections.<ExpressionGroupNode>emptyList();
if (argumentList.size() > _parameterDefinitions.size()) {
throw new IllegalMixinArgumentException(name, _parameterDefinitions.size());
}
// Clone scope and filter out any white space
ScopeNode mixinScope = clone();
NodeTreeUtils.filterLineBreaks(mixinScope);
// If arguments were passed, apply them
for (int i = 0; i < argumentList.size(); i++) {
ExpressionGroupNode argument = argumentList.get(i);
// Replace the value of the definition
VariableDefinitionNode parameter = mixinScope._parameterDefinitions.get(i);
parameter.clearChildren();
parameter.addChild(argument);
}
// Mark this scope's containing rule set as invisible since it has been used as a mixin
getParent().setVisible(false);
return mixinScope;
} } | public class class_name {
public ScopeNode callMixin(String name, ArgumentsNode arguments) {
List<ExpressionGroupNode> argumentList = (arguments != null) ? NodeTreeUtils.getChildren(arguments, ExpressionGroupNode.class) : Collections.<ExpressionGroupNode>emptyList();
if (argumentList.size() > _parameterDefinitions.size()) {
throw new IllegalMixinArgumentException(name, _parameterDefinitions.size());
}
// Clone scope and filter out any white space
ScopeNode mixinScope = clone();
NodeTreeUtils.filterLineBreaks(mixinScope);
// If arguments were passed, apply them
for (int i = 0; i < argumentList.size(); i++) {
ExpressionGroupNode argument = argumentList.get(i);
// Replace the value of the definition
VariableDefinitionNode parameter = mixinScope._parameterDefinitions.get(i);
parameter.clearChildren(); // depends on control dependency: [for], data = [none]
parameter.addChild(argument); // depends on control dependency: [for], data = [none]
}
// Mark this scope's containing rule set as invisible since it has been used as a mixin
getParent().setVisible(false);
return mixinScope;
} } |
public class class_name {
public final Object fe(Object... args) {
if (GWT.getUncaughtExceptionHandler() != null) {
try {
return f(args);
} catch (Exception e) {
GWT.getUncaughtExceptionHandler().onUncaughtException(e);
}
return true;
}
return f(args);
} } | public class class_name {
public final Object fe(Object... args) {
if (GWT.getUncaughtExceptionHandler() != null) {
try {
return f(args); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
GWT.getUncaughtExceptionHandler().onUncaughtException(e);
} // depends on control dependency: [catch], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return f(args);
} } |
public class class_name {
private static boolean isRunningInWAS() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "isRunningInWAS");
}
if (inWAS == null) {
inWAS = Boolean.TRUE;
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "isRunningInWAS", inWAS);
}
return inWAS.booleanValue();
} } | public class class_name {
private static boolean isRunningInWAS() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(TRACE, "isRunningInWAS"); // depends on control dependency: [if], data = [none]
}
if (inWAS == null) {
inWAS = Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(TRACE, "isRunningInWAS", inWAS); // depends on control dependency: [if], data = [none]
}
return inWAS.booleanValue();
} } |
public class class_name {
public static void checkForMisplacedScopeAnnotations(
Class<?> type, Object source, Errors errors) {
if (Classes.isConcrete(type)) {
return;
}
Class<? extends Annotation> scopeAnnotation = findScopeAnnotation(errors, type);
if (scopeAnnotation != null
// We let Dagger Components through to aid migrations.
&& !containsComponentAnnotation(type.getAnnotations())) {
errors.withSource(type).scopeAnnotationOnAbstractType(scopeAnnotation, type, source);
}
} } | public class class_name {
public static void checkForMisplacedScopeAnnotations(
Class<?> type, Object source, Errors errors) {
if (Classes.isConcrete(type)) {
return; // depends on control dependency: [if], data = [none]
}
Class<? extends Annotation> scopeAnnotation = findScopeAnnotation(errors, type);
if (scopeAnnotation != null
// We let Dagger Components through to aid migrations.
&& !containsComponentAnnotation(type.getAnnotations())) {
errors.withSource(type).scopeAnnotationOnAbstractType(scopeAnnotation, type, source); // depends on control dependency: [if], data = [(scopeAnnotation]
}
} } |
public class class_name {
public static List<TZID> getAvailableIDs(String provider) {
if (provider.equals("INCLUDE_ALIAS")) {
return zonalKeys.availablesAndAliases;
}
ZoneModelProvider zp = getProvider(provider);
if (zp == null) {
return Collections.emptyList();
}
List<TZID> result = new ArrayList<>();
for (String id : zp.getAvailableIDs()) {
result.add(resolve(id));
}
result.sort(ID_COMPARATOR);
return Collections.unmodifiableList(result);
} } | public class class_name {
public static List<TZID> getAvailableIDs(String provider) {
if (provider.equals("INCLUDE_ALIAS")) {
return zonalKeys.availablesAndAliases; // depends on control dependency: [if], data = [none]
}
ZoneModelProvider zp = getProvider(provider);
if (zp == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
List<TZID> result = new ArrayList<>();
for (String id : zp.getAvailableIDs()) {
result.add(resolve(id)); // depends on control dependency: [for], data = [id]
}
result.sort(ID_COMPARATOR);
return Collections.unmodifiableList(result);
} } |
public class class_name {
public static String escape(String input, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
for (Character character : special) {
sb.append(character);
}
sb.append(echar);
String s = Matcher.quoteReplacement(new String(new char[]{echar}));
return input.replaceAll("[" + Pattern.quote(sb.toString()) + "]", s + "$0");
} } | public class class_name {
public static String escape(String input, char echar, char[] special) {
StringBuilder sb = new StringBuilder();
for (Character character : special) {
sb.append(character); // depends on control dependency: [for], data = [character]
}
sb.append(echar);
String s = Matcher.quoteReplacement(new String(new char[]{echar}));
return input.replaceAll("[" + Pattern.quote(sb.toString()) + "]", s + "$0");
} } |
public class class_name {
public synchronized List getList() {
if (tc.isEntryEnabled())
SibTr.entry(tc, "getList");
// Remove a List from the pool
List list = (List) listPool.remove();
// If the list is null then there was none available in the pool
// So create a new one
if (list == null) {
if (tc.isDebugEnabled())
SibTr.debug(tc, "No list available from pool - creating a new one");
// We could change the list implementation here if we wanted
list = new ArrayList(5);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "getList");
return list;
} } | public class class_name {
public synchronized List getList() {
if (tc.isEntryEnabled())
SibTr.entry(tc, "getList");
// Remove a List from the pool
List list = (List) listPool.remove();
// If the list is null then there was none available in the pool
// So create a new one
if (list == null) {
if (tc.isDebugEnabled())
SibTr.debug(tc, "No list available from pool - creating a new one");
// We could change the list implementation here if we wanted
list = new ArrayList(5); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "getList");
return list;
} } |
public class class_name {
public DescribeAutoScalingGroupsRequest withAutoScalingGroupNames(String... autoScalingGroupNames) {
if (this.autoScalingGroupNames == null) {
setAutoScalingGroupNames(new com.amazonaws.internal.SdkInternalList<String>(autoScalingGroupNames.length));
}
for (String ele : autoScalingGroupNames) {
this.autoScalingGroupNames.add(ele);
}
return this;
} } | public class class_name {
public DescribeAutoScalingGroupsRequest withAutoScalingGroupNames(String... autoScalingGroupNames) {
if (this.autoScalingGroupNames == null) {
setAutoScalingGroupNames(new com.amazonaws.internal.SdkInternalList<String>(autoScalingGroupNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : autoScalingGroupNames) {
this.autoScalingGroupNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private String createConfiguration() {
CmsResourceManager resManager = OpenCms.getResourceManager();
if (resManager == null) {
// can happen during the OpenCms startup
return "";
}
List<I_CmsResourceType> resTypes = resManager.getResourceTypes();
List<String> options = new ArrayList<String>();
for (I_CmsResourceType resType : resTypes) {
if (resType.isDirectEditable()) {
options.add(resType.getTypeName());
}
}
Collections.sort(options);
return Joiner.on("|").join(options);
} } | public class class_name {
private String createConfiguration() {
CmsResourceManager resManager = OpenCms.getResourceManager();
if (resManager == null) {
// can happen during the OpenCms startup
return "";
// depends on control dependency: [if], data = [none]
}
List<I_CmsResourceType> resTypes = resManager.getResourceTypes();
List<String> options = new ArrayList<String>();
for (I_CmsResourceType resType : resTypes) {
if (resType.isDirectEditable()) {
options.add(resType.getTypeName());
// depends on control dependency: [if], data = [none]
}
}
Collections.sort(options);
return Joiner.on("|").join(options);
} } |
public class class_name {
public List<Long> getOffsets(OffsetRequest offsetRequest) {
ILog log = getLog(offsetRequest.topic, offsetRequest.partition);
if (log != null) {
return log.getOffsetsBefore(offsetRequest);
}
return ILog.EMPTY_OFFSETS;
} } | public class class_name {
public List<Long> getOffsets(OffsetRequest offsetRequest) {
ILog log = getLog(offsetRequest.topic, offsetRequest.partition);
if (log != null) {
return log.getOffsetsBefore(offsetRequest); // depends on control dependency: [if], data = [none]
}
return ILog.EMPTY_OFFSETS;
} } |
public class class_name {
public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(",");
}
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(",");
}
return val.append("id:").append(id).toString();
} } | public class class_name {
public static String getStatusLabelDetailsInString(final String value, final String style, final String id) {
final StringBuilder val = new StringBuilder();
if (!StringUtils.isEmpty(value)) {
val.append("value:").append(value).append(","); // depends on control dependency: [if], data = [none]
}
if (!StringUtils.isEmpty(style)) {
val.append("style:").append(style).append(","); // depends on control dependency: [if], data = [none]
}
return val.append("id:").append(id).toString();
} } |
public class class_name {
private void writeText(String value) {
if(this.rtfParser.isNewGroup()) {
this.rtfDoc.add(new RtfDirectContent("{"));
this.rtfParser.setNewGroup(false);
}
if(value.length() > 0) {
this.rtfDoc.add(new RtfDirectContent(value));
}
} } | public class class_name {
private void writeText(String value) {
if(this.rtfParser.isNewGroup()) {
this.rtfDoc.add(new RtfDirectContent("{")); // depends on control dependency: [if], data = [none]
this.rtfParser.setNewGroup(false); // depends on control dependency: [if], data = [none]
}
if(value.length() > 0) {
this.rtfDoc.add(new RtfDirectContent(value)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void launchTasks(List<LaunchableTask> tasks) {
// Group the tasks by offer
Map<Protos.Offer, List<LaunchableTask>> tasksGroupByOffer = new HashMap<>();
for (LaunchableTask task : tasks) {
List<LaunchableTask> subTasks = tasksGroupByOffer.get(task.offer);
if (subTasks == null) {
subTasks = new LinkedList<>();
}
subTasks.add(task);
tasksGroupByOffer.put(task.offer, subTasks);
}
// Construct the Mesos TaskInfo to launch
for (Map.Entry<Protos.Offer, List<LaunchableTask>> kv : tasksGroupByOffer.entrySet()) {
// We would launch taks for the same offer at one shot
Protos.Offer offer = kv.getKey();
List<LaunchableTask> subTasks = kv.getValue();
List<Protos.TaskInfo> mesosTasks = new LinkedList<>();
for (LaunchableTask task : subTasks) {
Protos.TaskInfo pTask = task.constructMesosTaskInfo(heronConfig, heronRuntime);
mesosTasks.add(pTask);
}
LOG.info("Launching tasks from offer: " + offer + " with tasks: " + mesosTasks);
// Launch the tasks for the same offer
Protos.Status status =
driver.launchTasks(Arrays.asList(new Protos.OfferID[]{offer.getId()}),
mesosTasks);
if (status == Protos.Status.DRIVER_RUNNING) {
LOG.info(String.format("Tasks launched, status: '%s'", status));
} else {
LOG.severe("Other status returned: " + status);
// Handled failed tasks
for (LaunchableTask task : tasks) {
handleMesosFailure(task.taskId);
// No need to decline the offers; mesos master already reclaim them
}
}
}
} } | public class class_name {
protected void launchTasks(List<LaunchableTask> tasks) {
// Group the tasks by offer
Map<Protos.Offer, List<LaunchableTask>> tasksGroupByOffer = new HashMap<>();
for (LaunchableTask task : tasks) {
List<LaunchableTask> subTasks = tasksGroupByOffer.get(task.offer);
if (subTasks == null) {
subTasks = new LinkedList<>(); // depends on control dependency: [if], data = [none]
}
subTasks.add(task); // depends on control dependency: [for], data = [task]
tasksGroupByOffer.put(task.offer, subTasks); // depends on control dependency: [for], data = [task]
}
// Construct the Mesos TaskInfo to launch
for (Map.Entry<Protos.Offer, List<LaunchableTask>> kv : tasksGroupByOffer.entrySet()) {
// We would launch taks for the same offer at one shot
Protos.Offer offer = kv.getKey();
List<LaunchableTask> subTasks = kv.getValue();
List<Protos.TaskInfo> mesosTasks = new LinkedList<>();
for (LaunchableTask task : subTasks) {
Protos.TaskInfo pTask = task.constructMesosTaskInfo(heronConfig, heronRuntime);
mesosTasks.add(pTask); // depends on control dependency: [for], data = [none]
}
LOG.info("Launching tasks from offer: " + offer + " with tasks: " + mesosTasks); // depends on control dependency: [for], data = [none]
// Launch the tasks for the same offer
Protos.Status status =
driver.launchTasks(Arrays.asList(new Protos.OfferID[]{offer.getId()}),
mesosTasks);
if (status == Protos.Status.DRIVER_RUNNING) {
LOG.info(String.format("Tasks launched, status: '%s'", status)); // depends on control dependency: [if], data = [none]
} else {
LOG.severe("Other status returned: " + status); // depends on control dependency: [if], data = [none]
// Handled failed tasks
for (LaunchableTask task : tasks) {
handleMesosFailure(task.taskId); // depends on control dependency: [for], data = [task]
// No need to decline the offers; mesos master already reclaim them
}
}
}
} } |
public class class_name {
@Override
public T next() {
if (hasNext()) {
T current = next;
next = null;
return current;
} else {
throw new NoSuchElementException();
}
} } | public class class_name {
@Override
public T next() {
if (hasNext()) {
T current = next;
next = null; // depends on control dependency: [if], data = [none]
return current; // depends on control dependency: [if], data = [none]
} else {
throw new NoSuchElementException();
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <K,V> Region<K, V> getRegion(String regionName, JMX jmx)
{
Region<K, V> region = getClientCache(jmx).getRegion(regionName);
if (region == null)
{
//check if region exist on server
if(isExistingRegionOnServer(regionName,jmx))
{ // create it locally
region = (Region<K, V>)clientCache.createClientRegionFactory(
ClientRegionShortcut.PROXY).create(regionName);
}
}
return region;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <K,V> Region<K, V> getRegion(String regionName, JMX jmx)
{
Region<K, V> region = getClientCache(jmx).getRegion(regionName);
if (region == null)
{
//check if region exist on server
if(isExistingRegionOnServer(regionName,jmx))
{ // create it locally
region = (Region<K, V>)clientCache.createClientRegionFactory(
ClientRegionShortcut.PROXY).create(regionName); // depends on control dependency: [if], data = [none]
}
}
return region;
} } |
public class class_name {
public static boolean isEqual(Type type1, Type type2)
{
if(type1 == null) {
return type2 == null;
}
if(type2 == null) {
return type1 == null;
}
if(!(type1 instanceof ParameterizedType)) {
return type1.equals(type2);
}
// handle parameterized types
if(!(type2 instanceof ParameterizedType)) {
return false;
}
ParameterizedType ptype1 = (ParameterizedType)type1;
ParameterizedType ptype2 = (ParameterizedType)type2;
if(!ptype1.getRawType().equals(ptype2.getRawType())) {
return false;
}
Type[] atype1 = ptype1.getActualTypeArguments();
Type[] atype2 = ptype2.getActualTypeArguments();
if(atype1.length != atype2.length) {
return false;
}
for(int i = 0; i < atype1.length; ++i) {
if(!isEqual(atype1[i], atype2[i])) {
return false;
}
}
return true;
} } | public class class_name {
public static boolean isEqual(Type type1, Type type2)
{
if(type1 == null) {
return type2 == null;
// depends on control dependency: [if], data = [none]
}
if(type2 == null) {
return type1 == null;
// depends on control dependency: [if], data = [none]
}
if(!(type1 instanceof ParameterizedType)) {
return type1.equals(type2);
// depends on control dependency: [if], data = [none]
}
// handle parameterized types
if(!(type2 instanceof ParameterizedType)) {
return false;
// depends on control dependency: [if], data = [none]
}
ParameterizedType ptype1 = (ParameterizedType)type1;
ParameterizedType ptype2 = (ParameterizedType)type2;
if(!ptype1.getRawType().equals(ptype2.getRawType())) {
return false;
// depends on control dependency: [if], data = [none]
}
Type[] atype1 = ptype1.getActualTypeArguments();
Type[] atype2 = ptype2.getActualTypeArguments();
if(atype1.length != atype2.length) {
return false;
// depends on control dependency: [if], data = [none]
}
for(int i = 0; i < atype1.length; ++i) {
if(!isEqual(atype1[i], atype2[i])) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static void checkId(CmsUUID id, boolean canBeNull) {
if (canBeNull && (id == null)) {
return;
}
if ((!canBeNull && (id == null)) || id.isNullUUID()) {
throw new IllegalArgumentException(Messages.get().key(Messages.ERR_INVALID_UUID_1, id));
}
} } | public class class_name {
public static void checkId(CmsUUID id, boolean canBeNull) {
if (canBeNull && (id == null)) {
return; // depends on control dependency: [if], data = [none]
}
if ((!canBeNull && (id == null)) || id.isNullUUID()) {
throw new IllegalArgumentException(Messages.get().key(Messages.ERR_INVALID_UUID_1, id));
}
} } |
public class class_name {
public RoadPath solve(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint, RoadNetwork network) {
assert network != null && startPoint != null && endPoint != null;
final RoadSegment startSegment = network.getNearestSegment(startPoint);
if (startSegment != null) {
final RoadSegment endSegment = network.getNearestSegment(endPoint);
if (endSegment != null) {
final VirtualPoint start = new VirtualPoint(startPoint, startSegment);
final VirtualPoint end = new VirtualPoint(endPoint, endSegment);
return solve(start, end);
}
}
return null;
} } | public class class_name {
public RoadPath solve(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint, RoadNetwork network) {
assert network != null && startPoint != null && endPoint != null;
final RoadSegment startSegment = network.getNearestSegment(startPoint);
if (startSegment != null) {
final RoadSegment endSegment = network.getNearestSegment(endPoint);
if (endSegment != null) {
final VirtualPoint start = new VirtualPoint(startPoint, startSegment);
final VirtualPoint end = new VirtualPoint(endPoint, endSegment);
return solve(start, end); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public boolean isAuthorized(final String username, final String resource) {
if (username == null || resource == null)
return false;
if (getServerConfig() != null) {
// getUser() will throw an IllegalArgumentException if username is null or empty.
// However, a null or empty username is possible with some security implementations.
if (!username.isEmpty()) {
OServerUserConfiguration userCfg = getServerConfig().getUser(username);
if (userCfg != null) {
// Total Access
if (userCfg.resources.equals("*"))
return true;
String[] resourceParts = userCfg.resources.split(",");
for (String r : resourceParts) {
if (r.equalsIgnoreCase(resource))
return true;
}
}
}
} else {
OLogManager.instance().error(this, "OServerConfigAuthenticator.isAuthorized() ServerConfig is null", null);
}
return false;
} } | public class class_name {
public boolean isAuthorized(final String username, final String resource) {
if (username == null || resource == null)
return false;
if (getServerConfig() != null) {
// getUser() will throw an IllegalArgumentException if username is null or empty.
// However, a null or empty username is possible with some security implementations.
if (!username.isEmpty()) {
OServerUserConfiguration userCfg = getServerConfig().getUser(username);
if (userCfg != null) {
// Total Access
if (userCfg.resources.equals("*"))
return true;
String[] resourceParts = userCfg.resources.split(",");
for (String r : resourceParts) {
if (r.equalsIgnoreCase(resource))
return true;
}
}
}
} else {
OLogManager.instance().error(this, "OServerConfigAuthenticator.isAuthorized() ServerConfig is null", null); // depends on control dependency: [if], data = [null)]
}
return false;
} } |
public class class_name {
public static void parkAndSerialize(final FiberWriter writer) {
try {
Fiber.parkAndSerialize(writer);
} catch (SuspendExecution e) {
throw RuntimeSuspendExecution.of(e);
}
} } | public class class_name {
public static void parkAndSerialize(final FiberWriter writer) {
try {
Fiber.parkAndSerialize(writer); // depends on control dependency: [try], data = [none]
} catch (SuspendExecution e) {
throw RuntimeSuspendExecution.of(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void add(AsciiString name, String value){
if(name==null || value==null)
return;
Header head = entry(name, true);
if(head.value==null)
head.value = value;
else{
Header newHeader = newHeader(name);
newHeader.value = value;
Header tail = head.samePrev;
tail.sameNext = newHeader;
newHeader.samePrev = tail;
head.samePrev = newHeader;
}
assert validateLinks();
} } | public class class_name {
public void add(AsciiString name, String value){
if(name==null || value==null)
return;
Header head = entry(name, true);
if(head.value==null)
head.value = value;
else{
Header newHeader = newHeader(name);
newHeader.value = value; // depends on control dependency: [if], data = [none]
Header tail = head.samePrev;
tail.sameNext = newHeader; // depends on control dependency: [if], data = [none]
newHeader.samePrev = tail; // depends on control dependency: [if], data = [none]
head.samePrev = newHeader; // depends on control dependency: [if], data = [none]
}
assert validateLinks();
} } |
public class class_name {
protected void countTerms(TermedDocument termedDocument,
EntityStatistics entityStatistics) {
entityStatistics.countLabels += termedDocument.getLabels().size();
// for (MonolingualTextValue mtv : termedDocument.getLabels().values())
// {
// countKey(usageStatistics.labelCounts, mtv.getLanguageCode(), 1);
// }
entityStatistics.countDescriptions += termedDocument.getDescriptions()
.size();
// for (MonolingualTextValue mtv : termedDocument.getDescriptions()
// .values()) {
// countKey(usageStatistics.descriptionCounts, mtv.getLanguageCode(),
// 1);
// }
for (String languageKey : termedDocument.getAliases().keySet()) {
int count = termedDocument.getAliases().get(languageKey).size();
entityStatistics.countAliases += count;
// countKey(usageStatistics.aliasCounts, languageKey, count);
}
} } | public class class_name {
protected void countTerms(TermedDocument termedDocument,
EntityStatistics entityStatistics) {
entityStatistics.countLabels += termedDocument.getLabels().size();
// for (MonolingualTextValue mtv : termedDocument.getLabels().values())
// {
// countKey(usageStatistics.labelCounts, mtv.getLanguageCode(), 1);
// }
entityStatistics.countDescriptions += termedDocument.getDescriptions()
.size();
// for (MonolingualTextValue mtv : termedDocument.getDescriptions()
// .values()) {
// countKey(usageStatistics.descriptionCounts, mtv.getLanguageCode(),
// 1);
// }
for (String languageKey : termedDocument.getAliases().keySet()) {
int count = termedDocument.getAliases().get(languageKey).size();
entityStatistics.countAliases += count; // depends on control dependency: [for], data = [none]
// countKey(usageStatistics.aliasCounts, languageKey, count);
}
} } |
public class class_name {
private void doServerShutdown() {
stopConnectionLostTimer();
if( decoders != null ) {
for( WebSocketWorker w : decoders ) {
w.interrupt();
}
}
if( selector != null ) {
try {
selector.close();
} catch ( IOException e ) {
log.error( "IOException during selector.close", e );
onError( null, e );
}
}
if( server != null ) {
try {
server.close();
} catch ( IOException e ) {
log.error( "IOException during server.close", e );
onError( null, e );
}
}
} } | public class class_name {
private void doServerShutdown() {
stopConnectionLostTimer();
if( decoders != null ) {
for( WebSocketWorker w : decoders ) {
w.interrupt(); // depends on control dependency: [for], data = [w]
}
}
if( selector != null ) {
try {
selector.close(); // depends on control dependency: [try], data = [none]
} catch ( IOException e ) {
log.error( "IOException during selector.close", e );
onError( null, e );
} // depends on control dependency: [catch], data = [none]
}
if( server != null ) {
try {
server.close(); // depends on control dependency: [try], data = [none]
} catch ( IOException e ) {
log.error( "IOException during server.close", e );
onError( null, e );
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private Object internalGetSuperType(JvmType rawType) {
if (rawType == type) {
return this;
}
if (isPrimitive() || isPrimitiveVoid()) {
return null;
}
EClass otherEClass = rawType.eClass();
if (otherEClass == TypesPackage.Literals.JVM_PRIMITIVE_TYPE || otherEClass == TypesPackage.Literals.JVM_VOID) {
return null;
}
boolean interfaceType = false;
if (otherEClass != TypesPackage.Literals.JVM_TYPE_PARAMETER) {
if (Object.class.getName().equals(rawType.getIdentifier())) {
return getOwner().newParameterizedTypeReference(rawType);
}
if (otherEClass != TypesPackage.Literals.JVM_ARRAY_TYPE) {
// declared type
JvmDeclaredType declaredType = (JvmDeclaredType) rawType;
if (type.eClass() != TypesPackage.Literals.JVM_TYPE_PARAMETER && declaredType.isFinal()) {
return null;
}
} else if (isInterfaceType()) {
return null;
}
if (otherEClass == TypesPackage.Literals.JVM_GENERIC_TYPE && !(interfaceType = ((JvmGenericType) rawType).isInterface()) && isInterfaceType()) {
return null;
}
}
JvmTypeReference superType = getSuperType(rawType, interfaceType, type, new RecursionGuard<JvmType>());
return superType;
} } | public class class_name {
private Object internalGetSuperType(JvmType rawType) {
if (rawType == type) {
return this; // depends on control dependency: [if], data = [none]
}
if (isPrimitive() || isPrimitiveVoid()) {
return null; // depends on control dependency: [if], data = [none]
}
EClass otherEClass = rawType.eClass();
if (otherEClass == TypesPackage.Literals.JVM_PRIMITIVE_TYPE || otherEClass == TypesPackage.Literals.JVM_VOID) {
return null; // depends on control dependency: [if], data = [none]
}
boolean interfaceType = false;
if (otherEClass != TypesPackage.Literals.JVM_TYPE_PARAMETER) {
if (Object.class.getName().equals(rawType.getIdentifier())) {
return getOwner().newParameterizedTypeReference(rawType); // depends on control dependency: [if], data = [none]
}
if (otherEClass != TypesPackage.Literals.JVM_ARRAY_TYPE) {
// declared type
JvmDeclaredType declaredType = (JvmDeclaredType) rawType;
if (type.eClass() != TypesPackage.Literals.JVM_TYPE_PARAMETER && declaredType.isFinal()) {
return null; // depends on control dependency: [if], data = [none]
}
} else if (isInterfaceType()) {
return null; // depends on control dependency: [if], data = [none]
}
if (otherEClass == TypesPackage.Literals.JVM_GENERIC_TYPE && !(interfaceType = ((JvmGenericType) rawType).isInterface()) && isInterfaceType()) {
return null; // depends on control dependency: [if], data = [none]
}
}
JvmTypeReference superType = getSuperType(rawType, interfaceType, type, new RecursionGuard<JvmType>());
return superType;
} } |
public class class_name {
@Override
public int iamin(INDArray arr) {
if (arr.isSparse()) {
return Nd4j.getSparseBlasWrapper().level1().iamin(arr);
} else {
throw new UnsupportedOperationException();
}
} } | public class class_name {
@Override
public int iamin(INDArray arr) {
if (arr.isSparse()) {
return Nd4j.getSparseBlasWrapper().level1().iamin(arr); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException();
}
} } |
public class class_name {
public static String cutToIndexOf(String string, final String substring) {
int i = string.indexOf(substring);
if (i != -1) {
string = string.substring(0, i);
}
return string;
} } | public class class_name {
public static String cutToIndexOf(String string, final String substring) {
int i = string.indexOf(substring);
if (i != -1) {
string = string.substring(0, i); // depends on control dependency: [if], data = [none]
}
return string;
} } |
public class class_name {
public void addReferencedProperties(String identifier, List<PropertyData> refProperties)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
}
cache.setLocal(true);
Set<Object> set = new HashSet<Object>();
for (PropertyData prop : refProperties)
{
putProperty(prop, ModifyChildOption.NOT_MODIFY);
set.add(prop.getIdentifier());
}
cache.putIfAbsent(new CacheRefsId(getOwnerId(), identifier), set);
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
}
}
} } | public class class_name {
public void addReferencedProperties(String identifier, List<PropertyData> refProperties)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
// depends on control dependency: [if], data = [none]
}
cache.setLocal(true);
// depends on control dependency: [try], data = [none]
Set<Object> set = new HashSet<Object>();
for (PropertyData prop : refProperties)
{
putProperty(prop, ModifyChildOption.NOT_MODIFY);
// depends on control dependency: [for], data = [prop]
set.add(prop.getIdentifier());
// depends on control dependency: [for], data = [prop]
}
cache.putIfAbsent(new CacheRefsId(getOwnerId(), identifier), set);
// depends on control dependency: [try], data = [none]
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
void generateIronjacamarXml(Definition def, String outputDir)
{
try
{
String resourceDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
writeIronjacamarXml(def, resourceDir);
if (def.getBuild().equals("maven"))
{
String rarDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "rar";
writeIronjacamarXml(def, rarDir);
}
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
} } | public class class_name {
void generateIronjacamarXml(Definition def, String outputDir)
{
try
{
String resourceDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
writeIronjacamarXml(def, resourceDir); // depends on control dependency: [try], data = [none]
if (def.getBuild().equals("maven"))
{
String rarDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "rar";
writeIronjacamarXml(def, rarDir); // depends on control dependency: [if], data = [none]
}
}
catch (IOException ioe)
{
ioe.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static MediaType fromString(String text) {
Matcher matcher = MEDIA_TYPE_PATTERN.matcher(text);
if (!matcher.matches()) {
throw new IllegalArgumentException("Invalid media type string: " + text);
}
String type;
String subType;
if (matcher.group(GROUP_INDEX) != null) {
type = matcher.group(GROUP_INDEX);
subType = matcher.group(GROUP_INDEX);
} else {
type = matcher.group(TYPE_INDEX);
subType = matcher.group(SUBTYPE_INDEX);
}
Map<String, String> parametersBuilder = new HashMap<>();
Matcher parametersMatcher = PARAMETER_PATTERN.matcher(matcher.group(GROUP_MATCHER_INDEX));
while (parametersMatcher.find()) {
parametersBuilder.put(parametersMatcher.group(1), parametersMatcher.group(2));
}
return new MediaType(type, subType, Collections.unmodifiableMap(parametersBuilder));
} } | public class class_name {
public static MediaType fromString(String text) {
Matcher matcher = MEDIA_TYPE_PATTERN.matcher(text);
if (!matcher.matches()) {
throw new IllegalArgumentException("Invalid media type string: " + text);
}
String type;
String subType;
if (matcher.group(GROUP_INDEX) != null) {
type = matcher.group(GROUP_INDEX); // depends on control dependency: [if], data = [none]
subType = matcher.group(GROUP_INDEX); // depends on control dependency: [if], data = [none]
} else {
type = matcher.group(TYPE_INDEX); // depends on control dependency: [if], data = [none]
subType = matcher.group(SUBTYPE_INDEX); // depends on control dependency: [if], data = [none]
}
Map<String, String> parametersBuilder = new HashMap<>();
Matcher parametersMatcher = PARAMETER_PATTERN.matcher(matcher.group(GROUP_MATCHER_INDEX));
while (parametersMatcher.find()) {
parametersBuilder.put(parametersMatcher.group(1), parametersMatcher.group(2)); // depends on control dependency: [while], data = [none]
}
return new MediaType(type, subType, Collections.unmodifiableMap(parametersBuilder));
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.