code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void forModelSave(Table table, Map<String, Object> attrs, StringBuilder sql, List<Object> paras) {
sql.append("insert into ").append(table.getName()).append('(');
StringBuilder temp = new StringBuilder(") values(");
String[] pKeys = table.getPrimaryKey();
int count = 0;
for (Entry<String, Object> e: attrs.entrySet()) {
String colName = e.getKey();
if (table.hasColumnLabel(colName)) {
if (count++ > 0) {
sql.append(", ");
temp.append(", ");
}
sql.append(colName);
Object value = e.getValue();
if (value instanceof String && isPrimaryKey(colName, pKeys) && ((String)value).endsWith(".nextval")) {
temp.append(value);
} else {
temp.append('?');
paras.add(value);
}
}
}
sql.append(temp.toString()).append(')');
} } | public class class_name {
public void forModelSave(Table table, Map<String, Object> attrs, StringBuilder sql, List<Object> paras) {
sql.append("insert into ").append(table.getName()).append('(');
StringBuilder temp = new StringBuilder(") values(");
String[] pKeys = table.getPrimaryKey();
int count = 0;
for (Entry<String, Object> e: attrs.entrySet()) {
String colName = e.getKey();
if (table.hasColumnLabel(colName)) {
if (count++ > 0) {
sql.append(", ");
// depends on control dependency: [if], data = [none]
temp.append(", ");
// depends on control dependency: [if], data = [none]
}
sql.append(colName);
// depends on control dependency: [if], data = [none]
Object value = e.getValue();
if (value instanceof String && isPrimaryKey(colName, pKeys) && ((String)value).endsWith(".nextval")) {
temp.append(value);
// depends on control dependency: [if], data = [none]
} else {
temp.append('?');
// depends on control dependency: [if], data = [none]
paras.add(value);
// depends on control dependency: [if], data = [none]
}
}
}
sql.append(temp.toString()).append(')');
} } |
public class class_name {
public DescribeTrustedAdvisorCheckRefreshStatusesResult withStatuses(TrustedAdvisorCheckRefreshStatus... statuses) {
if (this.statuses == null) {
setStatuses(new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckRefreshStatus>(statuses.length));
}
for (TrustedAdvisorCheckRefreshStatus ele : statuses) {
this.statuses.add(ele);
}
return this;
} } | public class class_name {
public DescribeTrustedAdvisorCheckRefreshStatusesResult withStatuses(TrustedAdvisorCheckRefreshStatus... statuses) {
if (this.statuses == null) {
setStatuses(new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckRefreshStatus>(statuses.length)); // depends on control dependency: [if], data = [none]
}
for (TrustedAdvisorCheckRefreshStatus ele : statuses) {
this.statuses.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static String generateSeed() {
byte[] bytes = new byte[21];
new SecureRandom().nextBytes(bytes);
byte[] rhash = hash(bytes, 0, 20, SHA256);
bytes[20] = rhash[0];
BigInteger rand = new BigInteger(bytes);
BigInteger mask = new BigInteger(new byte[]{0, 0, 7, -1}); // 11 lower bits
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 15; i++) {
sb.append(i > 0 ? ' ' : "")
.append(SEED_WORDS[rand.and(mask).intValue()]);
rand = rand.shiftRight(11);
}
return sb.toString();
} } | public class class_name {
public static String generateSeed() {
byte[] bytes = new byte[21];
new SecureRandom().nextBytes(bytes);
byte[] rhash = hash(bytes, 0, 20, SHA256);
bytes[20] = rhash[0];
BigInteger rand = new BigInteger(bytes);
BigInteger mask = new BigInteger(new byte[]{0, 0, 7, -1}); // 11 lower bits
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 15; i++) {
sb.append(i > 0 ? ' ' : "")
.append(SEED_WORDS[rand.and(mask).intValue()]); // depends on control dependency: [for], data = [i]
rand = rand.shiftRight(11); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
@Override
public boolean visitClass(ClassDescriptor classDescriptor, XClass xclass) {
assert xclass != null;
String methodSignature = xmethod.getSignature();
XMethod bridgedFrom = xmethod.bridgeFrom();
// See if this class has an overridden method
XMethod xm = xclass.findMethod(xmethod.getName(), methodSignature, false);
if (xm == null && bridgedFrom != null && !classDescriptor.equals(xmethod.getClassDescriptor())) {
methodSignature = bridgedFrom.getSignature();
xm = xclass.findMethod(xmethod.getName(), methodSignature, false);
}
if (xm != null) {
return visitOverriddenMethod(xm) || bridgedFrom != null;
} else {
// Even though this particular class doesn't contain the method
// we're
// looking for, a superclass might, so we need to keep going.
return true;
}
} } | public class class_name {
@Override
public boolean visitClass(ClassDescriptor classDescriptor, XClass xclass) {
assert xclass != null;
String methodSignature = xmethod.getSignature();
XMethod bridgedFrom = xmethod.bridgeFrom();
// See if this class has an overridden method
XMethod xm = xclass.findMethod(xmethod.getName(), methodSignature, false);
if (xm == null && bridgedFrom != null && !classDescriptor.equals(xmethod.getClassDescriptor())) {
methodSignature = bridgedFrom.getSignature(); // depends on control dependency: [if], data = [none]
xm = xclass.findMethod(xmethod.getName(), methodSignature, false); // depends on control dependency: [if], data = [(xm]
}
if (xm != null) {
return visitOverriddenMethod(xm) || bridgedFrom != null; // depends on control dependency: [if], data = [(xm]
} else {
// Even though this particular class doesn't contain the method
// we're
// looking for, a superclass might, so we need to keep going.
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isEnum(String className) {
try {
// is it an enum?
TypeElement element = BindTypeSubProcessor.elementUtils.getTypeElement(className);
if (element instanceof TypeElement) {
TypeElement typeElement = element;
TypeMirror superclass = typeElement.getSuperclass();
if (superclass instanceof DeclaredType) {
DeclaredType superclassDeclaredType = (DeclaredType) superclass;
if (JAVA_LANG_ENUM.equals(getCanonicalTypeName(superclassDeclaredType))) {
return true;
}
}
}
return false;
} catch (Throwable e) {
return false;
}
} } | public class class_name {
public static boolean isEnum(String className) {
try {
// is it an enum?
TypeElement element = BindTypeSubProcessor.elementUtils.getTypeElement(className);
if (element instanceof TypeElement) {
TypeElement typeElement = element;
TypeMirror superclass = typeElement.getSuperclass();
if (superclass instanceof DeclaredType) {
DeclaredType superclassDeclaredType = (DeclaredType) superclass;
if (JAVA_LANG_ENUM.equals(getCanonicalTypeName(superclassDeclaredType))) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false; // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static URL buildUrl(URL context, String... relocations) {
URL url = context;
for (String move : relocations) {
try {
url = new URL(url, move);
} catch (MalformedURLException e) {
throw new AssertionError("URL('" + url + "', '" + move + "') isn't valid URL");
}
}
return url;
} } | public class class_name {
public static URL buildUrl(URL context, String... relocations) {
URL url = context;
for (String move : relocations) {
try {
url = new URL(url, move); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new AssertionError("URL('" + url + "', '" + move + "') isn't valid URL");
} // depends on control dependency: [catch], data = [none]
}
return url;
} } |
public class class_name {
public ListSubscribedRuleGroupsResult withRuleGroups(SubscribedRuleGroupSummary... ruleGroups) {
if (this.ruleGroups == null) {
setRuleGroups(new java.util.ArrayList<SubscribedRuleGroupSummary>(ruleGroups.length));
}
for (SubscribedRuleGroupSummary ele : ruleGroups) {
this.ruleGroups.add(ele);
}
return this;
} } | public class class_name {
public ListSubscribedRuleGroupsResult withRuleGroups(SubscribedRuleGroupSummary... ruleGroups) {
if (this.ruleGroups == null) {
setRuleGroups(new java.util.ArrayList<SubscribedRuleGroupSummary>(ruleGroups.length)); // depends on control dependency: [if], data = [none]
}
for (SubscribedRuleGroupSummary ele : ruleGroups) {
this.ruleGroups.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static HashMap<String, ArrayList<String>> getStableCDistribution(HashMap data, String som3_0, String pp, String rd) {
HashMap<String, ArrayList<String>> results = new HashMap<String, ArrayList<String>>();
ArrayList<String> slscArr = new ArrayList();
ArrayList<HashMap> soilLayers;
String k;
String som2_0;
String f;
String som3_fac;
String[] sllbs;
String[] slocs;
// double mid;
String mid;
int finalScale = 2;
LOG.debug("Checkpoint 1");
try {
k = divide(log("0.02") + "", substract(rd, pp), finalScale + 1);
som2_0 = multiply("0.95", substract("1", som3_0));
} catch (Exception e) {
LOG.error("INVALID INPUT FOR NUMBERIC VALUE");
return results;
}
soilLayers = getSoilLayer(data);
if (soilLayers == null) {
return results;
} else if (soilLayers.isEmpty()) {
LOG.error("SOIL LAYER DATA IS EMPTY");
return results;
} else {
try {
sllbs = new String[soilLayers.size()];
slocs = new String[soilLayers.size()];
for (int i = 0; i < soilLayers.size(); i++) {
sllbs[i] = getObjectOr(soilLayers.get(i), "sllb", "");
slocs[i] = getObjectOr(soilLayers.get(i), "sloc", "");
}
} catch (NumberFormatException e) {
LOG.error("INVALID NUMBER FOR SLOC OR SLLB IN DATA [" + e.getMessage() + "]");
return results;
}
}
LOG.debug("Checkpoint 2");
// Check if initial condition layer data is available
// ArrayList<Map> exps = getObjectOr(data, "experiments", new ArrayList());
// if (exps.isEmpty()) {
// LOG.error("NO EXPERIMENT DATA.");
// return;
// } else {
// Map expData = exps.get(0);
// if (expData.isEmpty()) {
// LOG.error("NO EXPERIMENT DATA.");
// return;
// } else {
// Map icData = getObjectOr(data, "soil", new HashMap());
// icLayers = getObjectOr(icData, "soilLayer", new ArrayList());
// if (icLayers.isEmpty()) {
// LOG.error("NO SOIL DATA.");
// return;
// } else if (icLayers.size() != soilLayers.size()) {
// LOG.error("THE LAYER DATA IN THE INITIAL CONDITION SECTION IS NOT MATCHED WITH SOIL SECTION");
// return;
// }
// //}
// //}
LOG.debug("Checkpoint 3");
String last = "0";
for (int i = 0; i < soilLayers.size(); i++) {
mid = average(sllbs[i], last);
last = sllbs[i];
f = getGrowthFactor(mid, pp, k, som2_0);
som3_fac = substract("1", divide(max("0.02", f), "0.95", finalScale + 1));
slscArr.add(round(multiply(slocs[i], som3_fac), finalScale));
// LOG.debug((String)icLayers.get(i).get("icbl") + ", " + (String)icLayers.get(i).get("slsc"));
}
results.put("slsc", slscArr);
return results;
} } | public class class_name {
public static HashMap<String, ArrayList<String>> getStableCDistribution(HashMap data, String som3_0, String pp, String rd) {
HashMap<String, ArrayList<String>> results = new HashMap<String, ArrayList<String>>();
ArrayList<String> slscArr = new ArrayList();
ArrayList<HashMap> soilLayers;
String k;
String som2_0;
String f;
String som3_fac;
String[] sllbs;
String[] slocs;
// double mid;
String mid;
int finalScale = 2;
LOG.debug("Checkpoint 1");
try {
k = divide(log("0.02") + "", substract(rd, pp), finalScale + 1); // depends on control dependency: [try], data = [none]
som2_0 = multiply("0.95", substract("1", som3_0)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("INVALID INPUT FOR NUMBERIC VALUE");
return results;
} // depends on control dependency: [catch], data = [none]
soilLayers = getSoilLayer(data);
if (soilLayers == null) {
return results; // depends on control dependency: [if], data = [none]
} else if (soilLayers.isEmpty()) {
LOG.error("SOIL LAYER DATA IS EMPTY"); // depends on control dependency: [if], data = [none]
return results; // depends on control dependency: [if], data = [none]
} else {
try {
sllbs = new String[soilLayers.size()]; // depends on control dependency: [try], data = [none]
slocs = new String[soilLayers.size()]; // depends on control dependency: [try], data = [none]
for (int i = 0; i < soilLayers.size(); i++) {
sllbs[i] = getObjectOr(soilLayers.get(i), "sllb", ""); // depends on control dependency: [for], data = [i]
slocs[i] = getObjectOr(soilLayers.get(i), "sloc", ""); // depends on control dependency: [for], data = [i]
}
} catch (NumberFormatException e) {
LOG.error("INVALID NUMBER FOR SLOC OR SLLB IN DATA [" + e.getMessage() + "]");
return results;
} // depends on control dependency: [catch], data = [none]
}
LOG.debug("Checkpoint 2");
// Check if initial condition layer data is available
// ArrayList<Map> exps = getObjectOr(data, "experiments", new ArrayList());
// if (exps.isEmpty()) {
// LOG.error("NO EXPERIMENT DATA.");
// return;
// } else {
// Map expData = exps.get(0);
// if (expData.isEmpty()) {
// LOG.error("NO EXPERIMENT DATA.");
// return;
// } else {
// Map icData = getObjectOr(data, "soil", new HashMap());
// icLayers = getObjectOr(icData, "soilLayer", new ArrayList());
// if (icLayers.isEmpty()) {
// LOG.error("NO SOIL DATA.");
// return;
// } else if (icLayers.size() != soilLayers.size()) {
// LOG.error("THE LAYER DATA IN THE INITIAL CONDITION SECTION IS NOT MATCHED WITH SOIL SECTION");
// return;
// }
// //}
// //}
LOG.debug("Checkpoint 3");
String last = "0";
for (int i = 0; i < soilLayers.size(); i++) {
mid = average(sllbs[i], last); // depends on control dependency: [for], data = [i]
last = sllbs[i]; // depends on control dependency: [for], data = [i]
f = getGrowthFactor(mid, pp, k, som2_0); // depends on control dependency: [for], data = [none]
som3_fac = substract("1", divide(max("0.02", f), "0.95", finalScale + 1)); // depends on control dependency: [for], data = [none]
slscArr.add(round(multiply(slocs[i], som3_fac), finalScale)); // depends on control dependency: [for], data = [i]
// LOG.debug((String)icLayers.get(i).get("icbl") + ", " + (String)icLayers.get(i).get("slsc"));
}
results.put("slsc", slscArr);
return results;
} } |
public class class_name {
public static void setTrace(boolean trace) {
FallbackLoggerConfiguration.trace.set(trace);
if (trace) {
debug.set(true);
}
} } | public class class_name {
public static void setTrace(boolean trace) {
FallbackLoggerConfiguration.trace.set(trace);
if (trace) {
debug.set(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean hasMatchingLabels(FlatRow row) {
int inLabelCount = 0;
int outLabelCount = 0;
for (FlatRow.Cell cell : row.getCells()) {
for (String label : cell.getLabels()) {
// TODO(kevinsi4508): Make sure {@code label} is a {@link WhileMatchFilter} label.
// TODO(kevinsi4508): Handle multiple {@link WhileMatchFilter} labels.
if (label.endsWith(WHILE_MATCH_FILTER_IN_LABEL_SUFFIX)) {
inLabelCount++;
} else if (label.endsWith(WHILE_MATCH_FILTER_OUT_LABEL_SUFFIX)) {
outLabelCount++;
}
}
}
// Checks if there is mismatching {@link WhileMatchFilter} label.
if (inLabelCount != outLabelCount) {
return false;
}
return true;
} } | public class class_name {
public static boolean hasMatchingLabels(FlatRow row) {
int inLabelCount = 0;
int outLabelCount = 0;
for (FlatRow.Cell cell : row.getCells()) {
for (String label : cell.getLabels()) {
// TODO(kevinsi4508): Make sure {@code label} is a {@link WhileMatchFilter} label.
// TODO(kevinsi4508): Handle multiple {@link WhileMatchFilter} labels.
if (label.endsWith(WHILE_MATCH_FILTER_IN_LABEL_SUFFIX)) {
inLabelCount++; // depends on control dependency: [if], data = [none]
} else if (label.endsWith(WHILE_MATCH_FILTER_OUT_LABEL_SUFFIX)) {
outLabelCount++; // depends on control dependency: [if], data = [none]
}
}
}
// Checks if there is mismatching {@link WhileMatchFilter} label.
if (inLabelCount != outLabelCount) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void clear() {
/**
* Unfortunately log4j's MDC historically never had a mechanism to block remove keys,
* so we're forced to do this one by one.
*/
for (String key : allKeys()) {
mdcBridge.remove(key);
}
PER_THREAD_CONTEXTS.getUnchecked(Thread.currentThread()).clear();
} } | public class class_name {
public void clear() {
/**
* Unfortunately log4j's MDC historically never had a mechanism to block remove keys,
* so we're forced to do this one by one.
*/
for (String key : allKeys()) {
mdcBridge.remove(key); // depends on control dependency: [for], data = [key]
}
PER_THREAD_CONTEXTS.getUnchecked(Thread.currentThread()).clear();
} } |
public class class_name {
public static void mapJavaBeanProperties(Object bean, Properties beanProps, boolean isStrict)
throws IntrospectionException
{
HashMap<String, PropertyDescriptor> propertyMap = new HashMap<String, PropertyDescriptor>();
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
for (int p = 0; p < props.length; p++)
{
String fieldName = props[p].getName();
propertyMap.put(fieldName, props[p]);
}
boolean trace = log.isTraceEnabled();
Iterator keys = beanProps.keySet().iterator();
if( trace )
log.trace("Mapping properties for bean: "+bean);
while( keys.hasNext() )
{
String name = (String) keys.next();
String text = beanProps.getProperty(name);
PropertyDescriptor pd = propertyMap.get(name);
if (pd == null)
{
/* Try the property name with the first char uppercased to handle
a property name like dLQMaxResent whose expected introspected
property name would be DLQMaxResent since the JavaBean
Introspector would view setDLQMaxResent as the setter for a
DLQMaxResent property whose Introspector.decapitalize() method
would also return "DLQMaxResent".
*/
if (name.length() > 1)
{
char first = name.charAt(0);
String exName = Character.toUpperCase(first) + name.substring(1);
pd = propertyMap.get(exName);
// Be lenient and check the other way around, e.g. ServerName -> serverName
if (pd == null)
{
exName = Character.toLowerCase(first) + name.substring(1);
pd = propertyMap.get(exName);
}
}
if (pd == null)
{
if (isStrict)
{
String msg = "No property found for: "+name+" on JavaBean: "+bean;
throw new IntrospectionException(msg);
}
else
{
// since is not strict, ignore that this property was not found
continue;
}
}
}
Method setter = pd.getWriteMethod();
if( trace )
log.trace("Property editor found for: "+name+", editor: "+pd+", setter: "+setter);
if (setter != null)
{
Class<?> ptype = pd.getPropertyType();
PropertyEditor editor = PropertyEditorManager.findEditor(ptype);
if (editor == null)
{
if( trace )
log.trace("Failed to find property editor for: "+name);
}
try
{
editor.setAsText(text);
Object args[] = {editor.getValue()};
setter.invoke(bean, args);
}
catch (Exception e)
{
if( trace )
log.trace("Failed to write property", e);
}
}
}
} } | public class class_name {
public static void mapJavaBeanProperties(Object bean, Properties beanProps, boolean isStrict)
throws IntrospectionException
{
HashMap<String, PropertyDescriptor> propertyMap = new HashMap<String, PropertyDescriptor>();
BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass());
PropertyDescriptor[] props = beanInfo.getPropertyDescriptors();
for (int p = 0; p < props.length; p++)
{
String fieldName = props[p].getName();
propertyMap.put(fieldName, props[p]);
}
boolean trace = log.isTraceEnabled();
Iterator keys = beanProps.keySet().iterator();
if( trace )
log.trace("Mapping properties for bean: "+bean);
while( keys.hasNext() )
{
String name = (String) keys.next();
String text = beanProps.getProperty(name);
PropertyDescriptor pd = propertyMap.get(name);
if (pd == null)
{
/* Try the property name with the first char uppercased to handle
a property name like dLQMaxResent whose expected introspected
property name would be DLQMaxResent since the JavaBean
Introspector would view setDLQMaxResent as the setter for a
DLQMaxResent property whose Introspector.decapitalize() method
would also return "DLQMaxResent".
*/
if (name.length() > 1)
{
char first = name.charAt(0);
String exName = Character.toUpperCase(first) + name.substring(1);
pd = propertyMap.get(exName); // depends on control dependency: [if], data = [none]
// Be lenient and check the other way around, e.g. ServerName -> serverName
if (pd == null)
{
exName = Character.toLowerCase(first) + name.substring(1); // depends on control dependency: [if], data = [none]
pd = propertyMap.get(exName); // depends on control dependency: [if], data = [none]
}
}
if (pd == null)
{
if (isStrict)
{
String msg = "No property found for: "+name+" on JavaBean: "+bean; // depends on control dependency: [if], data = [none]
throw new IntrospectionException(msg);
}
else
{
// since is not strict, ignore that this property was not found
continue;
}
}
}
Method setter = pd.getWriteMethod();
if( trace )
log.trace("Property editor found for: "+name+", editor: "+pd+", setter: "+setter);
if (setter != null)
{
Class<?> ptype = pd.getPropertyType();
PropertyEditor editor = PropertyEditorManager.findEditor(ptype);
if (editor == null)
{
if( trace )
log.trace("Failed to find property editor for: "+name);
}
try
{
editor.setAsText(text);
Object args[] = {editor.getValue()};
setter.invoke(bean, args);
}
catch (Exception e)
{
if( trace )
log.trace("Failed to write property", e);
}
}
}
} } |
public class class_name {
public void paint (Graphics2D gfx, int layer, Shape clip)
{
for (int ii = 0, nn = _media.size(); ii < nn; ii++) {
AbstractMedia media = _media.get(ii);
int order = media.getRenderOrder();
try {
if (((layer == ALL) || (layer == FRONT && order >= 0) ||
(layer == BACK && order < 0)) && clip.intersects(media.getBounds())) {
media.paint(gfx);
}
} catch (Exception e) {
log.warning("Failed to render media", "media", media, e);
}
}
} } | public class class_name {
public void paint (Graphics2D gfx, int layer, Shape clip)
{
for (int ii = 0, nn = _media.size(); ii < nn; ii++) {
AbstractMedia media = _media.get(ii);
int order = media.getRenderOrder();
try {
if (((layer == ALL) || (layer == FRONT && order >= 0) ||
(layer == BACK && order < 0)) && clip.intersects(media.getBounds())) {
media.paint(gfx); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
log.warning("Failed to render media", "media", media, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void initAuthenticationHeader() {
if (isAuthenticated()) {
// Calculate the v2 signature
// http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html
// #ConstructingTheAuthenticationHeader
// Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be
// within 15 min. of S3 server time. contentMd5 and type are optional
// We can't risk letting our date get clobbered and being inconsistent
final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date());
final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL);
final StringBuilder toSign = new StringBuilder();
final String key = myKey.charAt(0) == '?' ? "" : myKey;
headers().add("X-Amz-Date", xamzdate);
signedHeaders.add("x-amz-date:" + xamzdate);
if (!StringUtils.isEmpty(mySessionToken)) {
headers().add("X-Amz-Security-Token", mySessionToken);
signedHeaders.add("x-amz-security-token:" + mySessionToken);
}
toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL)
.append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key);
try {
final String signature = b64SignHmacSha1(mySecretKey, toSign.toString());
final String authorization = "AWS" + " " + myAccessKey + ":" + signature;
headers().add("Authorization", authorization);
} catch (InvalidKeyException | NoSuchAlgorithmException details) {
LOGGER.error("Failed to sign S3 request due to {}", details);
}
}
} } | public class class_name {
protected void initAuthenticationHeader() {
if (isAuthenticated()) {
// Calculate the v2 signature
// http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html
// #ConstructingTheAuthenticationHeader
// Date should look like Thu, 17 Nov 2005 18:49:58 GMT, and must be
// within 15 min. of S3 server time. contentMd5 and type are optional
// We can't risk letting our date get clobbered and being inconsistent
final String xamzdate = new SimpleDateFormat(DATE_FORMAT, Locale.US).format(new Date());
final StringJoiner signedHeaders = new StringJoiner(EOL, "", EOL);
final StringBuilder toSign = new StringBuilder();
final String key = myKey.charAt(0) == '?' ? "" : myKey;
headers().add("X-Amz-Date", xamzdate); // depends on control dependency: [if], data = [none]
signedHeaders.add("x-amz-date:" + xamzdate); // depends on control dependency: [if], data = [none]
if (!StringUtils.isEmpty(mySessionToken)) {
headers().add("X-Amz-Security-Token", mySessionToken); // depends on control dependency: [if], data = [none]
signedHeaders.add("x-amz-security-token:" + mySessionToken); // depends on control dependency: [if], data = [none]
}
toSign.append(myMethod).append(EOL).append(myContentMd5).append(EOL).append(myContentType).append(EOL)
.append(EOL).append(signedHeaders).append(PATH_SEP).append(myBucket).append(PATH_SEP).append(key); // depends on control dependency: [if], data = [none]
try {
final String signature = b64SignHmacSha1(mySecretKey, toSign.toString());
final String authorization = "AWS" + " " + myAccessKey + ":" + signature;
headers().add("Authorization", authorization); // depends on control dependency: [try], data = [none]
} catch (InvalidKeyException | NoSuchAlgorithmException details) {
LOGGER.error("Failed to sign S3 request due to {}", details);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(DescribeStackProvisioningParametersRequest describeStackProvisioningParametersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeStackProvisioningParametersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeStackProvisioningParametersRequest.getStackId(), STACKID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeStackProvisioningParametersRequest describeStackProvisioningParametersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeStackProvisioningParametersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeStackProvisioningParametersRequest.getStackId(), STACKID_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 {
synchronized void addMappings(HttpContext context)
{
if (context==_notFoundContext)
return;
String[] hosts=context.getVirtualHosts();
if (hosts==null || hosts.length==0)
hosts = __noVirtualHost;
// For each host name
for (int h=0;h<hosts.length;h++)
{
String virtualHost=hosts[h];
addMapping(virtualHost,context);
}
} } | public class class_name {
synchronized void addMappings(HttpContext context)
{
if (context==_notFoundContext)
return;
String[] hosts=context.getVirtualHosts();
if (hosts==null || hosts.length==0)
hosts = __noVirtualHost;
// For each host name
for (int h=0;h<hosts.length;h++)
{
String virtualHost=hosts[h];
addMapping(virtualHost,context); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public LLIndexPage locatePageForKey(long key, long value, boolean allowCreate) {
if (isLeaf) {
return this;
}
if (nEntries == -1 && !allowCreate) {
return null;
}
//The stored value[i] is the min-values of the according page[i+1}
int pos = binarySearch(0, nEntries, key, value);
if (pos >= 0) {
//pos of matching key
pos++;
} else {
pos = -(pos+1);
}
//TODO use weak refs
//read page before that value
LLIndexPage page = (LLIndexPage) readOrCreatePage(pos, allowCreate);
return page.locatePageForKey(key, value, allowCreate);
} } | public class class_name {
public LLIndexPage locatePageForKey(long key, long value, boolean allowCreate) {
if (isLeaf) {
return this; // depends on control dependency: [if], data = [none]
}
if (nEntries == -1 && !allowCreate) {
return null; // depends on control dependency: [if], data = [none]
}
//The stored value[i] is the min-values of the according page[i+1}
int pos = binarySearch(0, nEntries, key, value);
if (pos >= 0) {
//pos of matching key
pos++; // depends on control dependency: [if], data = [none]
} else {
pos = -(pos+1); // depends on control dependency: [if], data = [(pos]
}
//TODO use weak refs
//read page before that value
LLIndexPage page = (LLIndexPage) readOrCreatePage(pos, allowCreate);
return page.locatePageForKey(key, value, allowCreate);
} } |
public class class_name {
public Version checkin() throws VersionException, UnsupportedRepositoryOperationException,
InvalidItemStateException, RepositoryException
{
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
{
throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ session.getUserID() + " item owner " + getACL().getOwner());
}
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException(
"Node.checkin() is not supported for not mix:versionable node ");
}
if (!this.checkedOut())
{
return (Version)dataManager.getItemByIdentifier(property(Constants.JCR_BASEVERSION).getString(), false);
}
if (session.getTransientNodesManager().hasPendingChanges(getInternalPath()))
{
throw new InvalidItemStateException("Node has pending changes " + getPath());
}
if (hasProperty(Constants.JCR_MERGEFAILED))
{
throw new VersionException("Node has jcr:mergeFailed " + getPath());
}
if (!checkLocking())
{
throw new LockException("Node " + getPath() + " is locked ");
}
// the new version identifier
String verIdentifier = IdGenerator.generate();
SessionChangesLog changesLog = new SessionChangesLog(session);
VersionHistoryImpl vh = versionHistory(false);
vh.addVersion(this.nodeData(), verIdentifier, changesLog);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_ISCHECKEDOUT,
new TransientValueData(false))));
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_BASEVERSION, new TransientValueData(
new Identifier(verIdentifier)))));
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS,
new ArrayList<ValueData>())));
dataManager.getTransactManager().save(changesLog);
VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(verIdentifier, true, false);
session.getActionHandler().postCheckin(this);
return version;
} } | public class class_name {
public Version checkin() throws VersionException, UnsupportedRepositoryOperationException,
InvalidItemStateException, RepositoryException
{
checkValid();
if (!session.getAccessManager().hasPermission(getACL(),
new String[]{PermissionType.ADD_NODE, PermissionType.SET_PROPERTY}, session.getUserState().getIdentity()))
{
throw new AccessDeniedException("Access denied: checkin operation " + getPath() + " for: "
+ session.getUserID() + " item owner " + getACL().getOwner());
}
if (!this.isNodeType(Constants.MIX_VERSIONABLE))
{
throw new UnsupportedRepositoryOperationException(
"Node.checkin() is not supported for not mix:versionable node ");
}
if (!this.checkedOut())
{
return (Version)dataManager.getItemByIdentifier(property(Constants.JCR_BASEVERSION).getString(), false); // depends on control dependency: [if], data = [none]
}
if (session.getTransientNodesManager().hasPendingChanges(getInternalPath()))
{
throw new InvalidItemStateException("Node has pending changes " + getPath());
}
if (hasProperty(Constants.JCR_MERGEFAILED))
{
throw new VersionException("Node has jcr:mergeFailed " + getPath());
}
if (!checkLocking())
{
throw new LockException("Node " + getPath() + " is locked ");
}
// the new version identifier
String verIdentifier = IdGenerator.generate();
SessionChangesLog changesLog = new SessionChangesLog(session);
VersionHistoryImpl vh = versionHistory(false);
vh.addVersion(this.nodeData(), verIdentifier, changesLog);
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_ISCHECKEDOUT,
new TransientValueData(false))));
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_BASEVERSION, new TransientValueData(
new Identifier(verIdentifier)))));
changesLog.add(ItemState.createUpdatedState(updatePropertyData(Constants.JCR_PREDECESSORS,
new ArrayList<ValueData>())));
dataManager.getTransactManager().save(changesLog);
VersionImpl version = (VersionImpl)dataManager.getItemByIdentifier(verIdentifier, true, false);
session.getActionHandler().postCheckin(this);
return version;
} } |
public class class_name {
public static void standardize(double[] x) {
double mu = mean(x);
double sigma = sd(x);
if (isZero(sigma)) {
logger.warn("array has variance of 0.");
return;
}
for (int i = 0; i < x.length; i++) {
x[i] = (x[i] - mu) / sigma;
}
} } | public class class_name {
public static void standardize(double[] x) {
double mu = mean(x);
double sigma = sd(x);
if (isZero(sigma)) {
logger.warn("array has variance of 0."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < x.length; i++) {
x[i] = (x[i] - mu) / sigma; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public String replaceLast(CharSequence text){
StringBuilder sb = new StringBuilder();
AutomatonMatcher am = runAutomation.newMatcher(text);
int start = 0;
int end = 0;
while (am.find()){
start = am.start();
end = am.end();
}
if (start != 0 || end != 0){
sb.append(text, 0, start);
sb.append(replacement);
sb.append(text, end, text.length());
}else{
sb.append(text);
}
return sb.toString();
} } | public class class_name {
public String replaceLast(CharSequence text){
StringBuilder sb = new StringBuilder();
AutomatonMatcher am = runAutomation.newMatcher(text);
int start = 0;
int end = 0;
while (am.find()){
start = am.start();
// depends on control dependency: [while], data = [none]
end = am.end();
// depends on control dependency: [while], data = [none]
}
if (start != 0 || end != 0){
sb.append(text, 0, start);
// depends on control dependency: [if], data = [none]
sb.append(replacement);
// depends on control dependency: [if], data = [none]
sb.append(text, end, text.length());
// depends on control dependency: [if], data = [none]
}else{
sb.append(text);
// depends on control dependency: [if], data = [none]
}
return sb.toString();
} } |
public class class_name {
@Override
public boolean handleMessage(SOAPMessageContext context) {
if (!feslAuthZ) {
return true;
}
String service =
((QName) context.get(SOAPMessageContext.WSDL_SERVICE))
.getLocalPart();
String operation =
((QName) context.get(SOAPMessageContext.WSDL_OPERATION))
.getLocalPart();
if (logger.isDebugEnabled()) {
logger.debug("AuthHandler executed: " + service + "/" + operation
+ " [" + m_ts + "]");
}
// // Obtain the service details
// ServiceDesc service = context.getService().getServiceDescription();
// // Obtain the operation details and message type
// OperationDesc operation = context.getOperation();
// Obtain a class to handle our request
OperationHandler operationHandler = getHandler(service, operation);
// there must always be a handler.
if (operationHandler == null) {
logger.error("Missing handler for service/operation: " + service
+ "/" + operation);
throw CXFUtility
.getFault(new PEPException("Missing handler for service/operation: "
+ service + "/" + operation));
}
RequestCtx reqCtx = null;
// if we are on the request pathway, outboundProperty == false. True on
// response pathway
Boolean outboundProperty =
(Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
try {
if (outboundProperty) {
reqCtx = operationHandler.handleResponse(context);
} else {
reqCtx = operationHandler.handleRequest(context);
}
} catch (OperationHandlerException ohe) {
logger.error("Error handling operation: " + operation, ohe);
throw CXFUtility
.getFault(new PEPException("Error handling operation: "
+ operation, ohe));
}
// if handler returns null, then there is no work to do (would have
// thrown exception if things went wrong).
if (reqCtx == null) {
return false;
}
// if we have received a requestContext, we need to hand it over to the
// context handler for resolution.
ResponseCtx resCtx = null;
try {
resCtx = m_ctxHandler.evaluate(reqCtx);
} catch (PEPException pe) {
logger.error("Error evaluating request", pe);
throw CXFUtility
.getFault(new PEPException("Error evaluating request (operation: "
+ operation + ")",
pe));
}
// TODO: set obligations
/*
* Need to set obligations in some sort of map, with UserID/SessionID +
* list of obligationIDs. Enforce will have to check that these
* obligations are met before providing access. There will need to be an
* external obligations service that this PEP can communicate with. Will
* be working on that... This service will throw an 'Obligations need to
* be met' exception for outstanding obligations
*/
// TODO: enforce will need to ensure that obligations are met.
enforce(resCtx);
return true;
} } | public class class_name {
@Override
public boolean handleMessage(SOAPMessageContext context) {
if (!feslAuthZ) {
return true; // depends on control dependency: [if], data = [none]
}
String service =
((QName) context.get(SOAPMessageContext.WSDL_SERVICE))
.getLocalPart();
String operation =
((QName) context.get(SOAPMessageContext.WSDL_OPERATION))
.getLocalPart();
if (logger.isDebugEnabled()) {
logger.debug("AuthHandler executed: " + service + "/" + operation
+ " [" + m_ts + "]"); // depends on control dependency: [if], data = [none]
}
// // Obtain the service details
// ServiceDesc service = context.getService().getServiceDescription();
// // Obtain the operation details and message type
// OperationDesc operation = context.getOperation();
// Obtain a class to handle our request
OperationHandler operationHandler = getHandler(service, operation);
// there must always be a handler.
if (operationHandler == null) {
logger.error("Missing handler for service/operation: " + service
+ "/" + operation); // depends on control dependency: [if], data = [none]
throw CXFUtility
.getFault(new PEPException("Missing handler for service/operation: "
+ service + "/" + operation));
}
RequestCtx reqCtx = null;
// if we are on the request pathway, outboundProperty == false. True on
// response pathway
Boolean outboundProperty =
(Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
try {
if (outboundProperty) {
reqCtx = operationHandler.handleResponse(context); // depends on control dependency: [if], data = [none]
} else {
reqCtx = operationHandler.handleRequest(context); // depends on control dependency: [if], data = [none]
}
} catch (OperationHandlerException ohe) {
logger.error("Error handling operation: " + operation, ohe);
throw CXFUtility
.getFault(new PEPException("Error handling operation: "
+ operation, ohe));
} // depends on control dependency: [catch], data = [none]
// if handler returns null, then there is no work to do (would have
// thrown exception if things went wrong).
if (reqCtx == null) {
return false; // depends on control dependency: [if], data = [none]
}
// if we have received a requestContext, we need to hand it over to the
// context handler for resolution.
ResponseCtx resCtx = null;
try {
resCtx = m_ctxHandler.evaluate(reqCtx); // depends on control dependency: [try], data = [none]
} catch (PEPException pe) {
logger.error("Error evaluating request", pe);
throw CXFUtility
.getFault(new PEPException("Error evaluating request (operation: "
+ operation + ")",
pe));
} // depends on control dependency: [catch], data = [none]
// TODO: set obligations
/*
* Need to set obligations in some sort of map, with UserID/SessionID +
* list of obligationIDs. Enforce will have to check that these
* obligations are met before providing access. There will need to be an
* external obligations service that this PEP can communicate with. Will
* be working on that... This service will throw an 'Obligations need to
* be met' exception for outstanding obligations
*/
// TODO: enforce will need to ensure that obligations are met.
enforce(resCtx);
return true;
} } |
public class class_name {
private Function1D getDerivativeFunc(final RegressionDataSet backingResidsList, final Regressor h)
{
final Function1D fhPrime = (double x) ->
{
double c1 = x;//c2=c1-eps
double eps = 1e-5;
double c1Pc2 = c1 * 2 - eps;//c1+c2 = c1+c1-eps
double result = 0;
/*
* Computing the estimate of the derivative directly, f'(x) approx = f(x)-f(x-eps)
*
* hEst is the output of the new regressor, target is the true residual target value
*
* So we have several
* (hEst_i c1 - target)^2 - (hEst_i c2 -target)^2 //4 muls, 3 subs
* Where c2 = c1-eps
* Which simplifies to
* (c1 - c2) hEst ((c1 + c2) hEst - 2 target)
* =
* eps hEst (c1Pc2 hEst - 2 target)//3 muls, 1 sub, 1 shift (mul by 2)
*
* because eps is on the outside and independent of each
* individual summation, we can move it out and do the eps
* multiplicatio ont he final result. Reducing us to
*
* 2 muls, 1 sub, 1 shift (mul by 2)
*
* per loop
*
* Which reduce computation, and allows us to get the result
* in one pass of the data
*/
for(int i = 0; i < backingResidsList.size(); i++)
{
double hEst = h.regress(backingResidsList.getDataPoint(i));
double target = backingResidsList.getTargetValue(i);
result += hEst * (c1Pc2 * hEst - 2 * target);
}
return result * eps;
};
return fhPrime;
} } | public class class_name {
private Function1D getDerivativeFunc(final RegressionDataSet backingResidsList, final Regressor h)
{
final Function1D fhPrime = (double x) ->
{
double c1 = x;//c2=c1-eps
double eps = 1e-5;
double c1Pc2 = c1 * 2 - eps;//c1+c2 = c1+c1-eps
double result = 0;
/*
* Computing the estimate of the derivative directly, f'(x) approx = f(x)-f(x-eps)
*
* hEst is the output of the new regressor, target is the true residual target value
*
* So we have several
* (hEst_i c1 - target)^2 - (hEst_i c2 -target)^2 //4 muls, 3 subs
* Where c2 = c1-eps
* Which simplifies to
* (c1 - c2) hEst ((c1 + c2) hEst - 2 target)
* =
* eps hEst (c1Pc2 hEst - 2 target)//3 muls, 1 sub, 1 shift (mul by 2)
*
* because eps is on the outside and independent of each
* individual summation, we can move it out and do the eps
* multiplicatio ont he final result. Reducing us to
*
* 2 muls, 1 sub, 1 shift (mul by 2)
*
* per loop
*
* Which reduce computation, and allows us to get the result
* in one pass of the data
*/
for(int i = 0; i < backingResidsList.size(); i++)
{
double hEst = h.regress(backingResidsList.getDataPoint(i));
double target = backingResidsList.getTargetValue(i);
result += hEst * (c1Pc2 * hEst - 2 * target); // depends on control dependency: [for], data = [none]
}
return result * eps;
};
return fhPrime;
} } |
public class class_name {
private void fillScrollBarButtonInteriorColors(Graphics2D g, Shape s, boolean isIncrease, boolean buttonsTogether) {
g.setPaint(getScrollBarButtonBackgroundPaint(s, isIncrease, buttonsTogether));
g.fill(s);
int width = s.getBounds().width;
g.setPaint(getScrollBarButtonLinePaint());
g.drawLine(0, 0, width - 1, 0);
if (state != Which.FOREGROUND_CAP && buttonsTogether) {
int height = s.getBounds().height;
g.setPaint(getScrollBarButtonDividerPaint(isIncrease));
g.drawLine(width - 1, 1, width - 1, height - 1);
}
} } | public class class_name {
private void fillScrollBarButtonInteriorColors(Graphics2D g, Shape s, boolean isIncrease, boolean buttonsTogether) {
g.setPaint(getScrollBarButtonBackgroundPaint(s, isIncrease, buttonsTogether));
g.fill(s);
int width = s.getBounds().width;
g.setPaint(getScrollBarButtonLinePaint());
g.drawLine(0, 0, width - 1, 0);
if (state != Which.FOREGROUND_CAP && buttonsTogether) {
int height = s.getBounds().height;
g.setPaint(getScrollBarButtonDividerPaint(isIncrease)); // depends on control dependency: [if], data = [none]
g.drawLine(width - 1, 1, width - 1, height - 1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void debugTraceTable(String comment)
{
StringBuffer sb = new StringBuffer();
sb.append("table:\n");
Iterator keyIterator = table.keySet().iterator();
if (!keyIterator.hasNext()) sb.append(" <empty>\n");
else while(keyIterator.hasNext())
{
Object key = keyIterator.next();
Object value = table.get(key);
sb.append(" [key: "+key+"] -> [value: "+value+"]\n");
}
SibTr.debug(this, tc, sb.toString());
} } | public class class_name {
private void debugTraceTable(String comment)
{
StringBuffer sb = new StringBuffer();
sb.append("table:\n");
Iterator keyIterator = table.keySet().iterator();
if (!keyIterator.hasNext()) sb.append(" <empty>\n");
else while(keyIterator.hasNext())
{
Object key = keyIterator.next();
Object value = table.get(key);
sb.append(" [key: "+key+"] -> [value: "+value+"]\n"); // depends on control dependency: [while], data = [none]
}
SibTr.debug(this, tc, sb.toString());
} } |
public class class_name {
@Nullable
private Display currentDisplay() {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
return getDisplay();
} else {
Context context = getContext();
if (!(context instanceof Activity)) {
return null;
}
return ((Activity) context).getWindowManager().getDefaultDisplay();
}
} } | public class class_name {
@Nullable
private Display currentDisplay() {
if (Build.VERSION.SDK_INT >= JELLY_BEAN_MR1) {
return getDisplay(); // depends on control dependency: [if], data = [none]
} else {
Context context = getContext();
if (!(context instanceof Activity)) {
return null; // depends on control dependency: [if], data = [none]
}
return ((Activity) context).getWindowManager().getDefaultDisplay(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void parseQueryStatus(boolean lastChunk) {
//some sections don't always come up, unlike status. Take this chance to close said sections' observables here.
querySignatureObservable.onCompleted();
queryRowObservable.onCompleted();
queryErrorObservable.onCompleted();
responseContent.markReaderIndex();
responseContent.skipBytes(findNextChar(responseContent, '"') + 1);
int endStatus = findNextChar(responseContent, '"');
if (endStatus > -1) {
ByteBuf resultSlice = responseContent.readSlice(endStatus);
queryStatusObservable.onNext(resultSlice.toString(CHARSET));
queryStatusObservable.onCompleted();
sectionDone();
queryParsingState = transitionToNextToken(lastChunk);
} else {
responseContent.resetReaderIndex();
return; //need more data
}
} } | public class class_name {
private void parseQueryStatus(boolean lastChunk) {
//some sections don't always come up, unlike status. Take this chance to close said sections' observables here.
querySignatureObservable.onCompleted();
queryRowObservable.onCompleted();
queryErrorObservable.onCompleted();
responseContent.markReaderIndex();
responseContent.skipBytes(findNextChar(responseContent, '"') + 1);
int endStatus = findNextChar(responseContent, '"');
if (endStatus > -1) {
ByteBuf resultSlice = responseContent.readSlice(endStatus);
queryStatusObservable.onNext(resultSlice.toString(CHARSET)); // depends on control dependency: [if], data = [none]
queryStatusObservable.onCompleted(); // depends on control dependency: [if], data = [none]
sectionDone(); // depends on control dependency: [if], data = [none]
queryParsingState = transitionToNextToken(lastChunk); // depends on control dependency: [if], data = [none]
} else {
responseContent.resetReaderIndex(); // depends on control dependency: [if], data = [none]
return; //need more data // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public synchronized void optionsUpdated(IOptions options, long sequence) {
String previousCacheBust = cacheBust;
cacheBust = options.getCacheBust();
if (sequence > 1 && cacheBust != null && !cacheBust.equals(previousCacheBust) && rawConfig != null) {
// Cache bust property has been updated subsequent to server startup
processDeps(false, false, sequence);
}
} } | public class class_name {
@Override
public synchronized void optionsUpdated(IOptions options, long sequence) {
String previousCacheBust = cacheBust;
cacheBust = options.getCacheBust();
if (sequence > 1 && cacheBust != null && !cacheBust.equals(previousCacheBust) && rawConfig != null) {
// Cache bust property has been updated subsequent to server startup
processDeps(false, false, sequence);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void convertLargeParts() {
List<Attachment> newAttachments = new ArrayList<>();
if (!publicParts.isEmpty()) {
try {
List<Part> toLarge = new ArrayList<>();
for (Part p : publicParts) {
if (p.getData() != null && p.getData().length() > maxPartSize) {
String type = p.getType() != null ? p.getType() : "application/octet-stream";
newAttachments.add(Attachment.create(p.getData(), type, Attachment.LOCAL_AUTO_CONVERTED_FOLDER, p.getName()));
toLarge.add(p);
log.w("Message part " + p.getName() + " to large (" + p.getData().length() + ">" + maxPartSize + ") - converting to attachment.");
}
}
if (!toLarge.isEmpty()) {
publicParts.removeAll(toLarge);
}
} catch (Exception e) {
log.f("Error when removing large message parts", e);
}
}
attachments.addAll(newAttachments);
} } | public class class_name {
private void convertLargeParts() {
List<Attachment> newAttachments = new ArrayList<>();
if (!publicParts.isEmpty()) {
try {
List<Part> toLarge = new ArrayList<>();
for (Part p : publicParts) {
if (p.getData() != null && p.getData().length() > maxPartSize) {
String type = p.getType() != null ? p.getType() : "application/octet-stream";
newAttachments.add(Attachment.create(p.getData(), type, Attachment.LOCAL_AUTO_CONVERTED_FOLDER, p.getName())); // depends on control dependency: [if], data = [(p.getData()]
toLarge.add(p); // depends on control dependency: [if], data = [none]
log.w("Message part " + p.getName() + " to large (" + p.getData().length() + ">" + maxPartSize + ") - converting to attachment."); // depends on control dependency: [if], data = [none]
}
}
if (!toLarge.isEmpty()) {
publicParts.removeAll(toLarge); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
log.f("Error when removing large message parts", e);
} // depends on control dependency: [catch], data = [none]
}
attachments.addAll(newAttachments);
} } |
public class class_name {
protected void prepareMandArcDetection() {
// RECYCLING ccTp is used to model the compressed path
ISet nei;
for (int i = 0; i < n; i++) {
ccTp[i] = -1;
}
useful.clear();
useful.set(0);
int k = 1;
useful.set(k);
ccTp[k] = k;
int first = 0;
int last = first;
fifo[last++] = k;
while (first < last) {
k = fifo[first++];
nei = Tree.getNeighOf(k);
for (int s : nei) {
if (ccTp[s] == -1) {
ccTp[s] = k;
map[s][k] = map[k][s] = -1;
if (!useful.get(s)) {
fifo[last++] = s;
useful.set(s);
}
}
}
}
} } | public class class_name {
protected void prepareMandArcDetection() {
// RECYCLING ccTp is used to model the compressed path
ISet nei;
for (int i = 0; i < n; i++) {
ccTp[i] = -1; // depends on control dependency: [for], data = [i]
}
useful.clear();
useful.set(0);
int k = 1;
useful.set(k);
ccTp[k] = k;
int first = 0;
int last = first;
fifo[last++] = k;
while (first < last) {
k = fifo[first++]; // depends on control dependency: [while], data = [none]
nei = Tree.getNeighOf(k); // depends on control dependency: [while], data = [none]
for (int s : nei) {
if (ccTp[s] == -1) {
ccTp[s] = k; // depends on control dependency: [if], data = [none]
map[s][k] = map[k][s] = -1; // depends on control dependency: [if], data = [none]
if (!useful.get(s)) {
fifo[last++] = s; // depends on control dependency: [if], data = [none]
useful.set(s); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public void setFleetIds(java.util.Collection<String> fleetIds) {
if (fleetIds == null) {
this.fleetIds = null;
return;
}
this.fleetIds = new java.util.ArrayList<String>(fleetIds);
} } | public class class_name {
public void setFleetIds(java.util.Collection<String> fleetIds) {
if (fleetIds == null) {
this.fleetIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.fleetIds = new java.util.ArrayList<String>(fleetIds);
} } |
public class class_name {
void doMethod(HttpServletRequest request, HttpServletResponse response, HttpMethod httpMethod) {
// Locate a request handler:
String requestPath = mapRequestPath(request);
Route route = api.get(requestPath);
try {
if (route != null && route.requestHandlers.containsKey(httpMethod)) {
handleRequest(request, response, route, httpMethod);
} else {
handleNotFound(request, response);
}
} catch (Throwable t) {
// Chances are the exception we've actually caught is the reflection
// one from Method.invoke(...)
Throwable caught = t;
if (InvocationTargetException.class.isAssignableFrom(t.getClass())) {
caught = t.getCause();
}
RequestHandler requestHandler = (route == null ? null : route.requestHandlers.get(httpMethod));
handleError(request, response, requestHandler, caught);
}
} } | public class class_name {
void doMethod(HttpServletRequest request, HttpServletResponse response, HttpMethod httpMethod) {
// Locate a request handler:
String requestPath = mapRequestPath(request);
Route route = api.get(requestPath);
try {
if (route != null && route.requestHandlers.containsKey(httpMethod)) {
handleRequest(request, response, route, httpMethod); // depends on control dependency: [if], data = [none]
} else {
handleNotFound(request, response); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
// Chances are the exception we've actually caught is the reflection
// one from Method.invoke(...)
Throwable caught = t;
if (InvocationTargetException.class.isAssignableFrom(t.getClass())) {
caught = t.getCause(); // depends on control dependency: [if], data = [none]
}
RequestHandler requestHandler = (route == null ? null : route.requestHandlers.get(httpMethod));
handleError(request, response, requestHandler, caught);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setMaxNoOfMinorTicks(final int MAX_NO_OF_MINOR_TICKS) {
if (MAX_NO_OF_MINOR_TICKS > 10) {
this.maxNoOfMinorTicks = 10;
} else if (MAX_NO_OF_MINOR_TICKS < 1) {
this.maxNoOfMinorTicks = 1;
} else {
this.maxNoOfMinorTicks = MAX_NO_OF_MINOR_TICKS;
}
calculate();
fireStateChanged();
} } | public class class_name {
public void setMaxNoOfMinorTicks(final int MAX_NO_OF_MINOR_TICKS) {
if (MAX_NO_OF_MINOR_TICKS > 10) {
this.maxNoOfMinorTicks = 10; // depends on control dependency: [if], data = [none]
} else if (MAX_NO_OF_MINOR_TICKS < 1) {
this.maxNoOfMinorTicks = 1; // depends on control dependency: [if], data = [none]
} else {
this.maxNoOfMinorTicks = MAX_NO_OF_MINOR_TICKS; // depends on control dependency: [if], data = [none]
}
calculate();
fireStateChanged();
} } |
public class class_name {
private static void validateIfAvroSchema(SerializerDefinition serializerDef) {
if(serializerDef.getName().equals(AVRO_GENERIC_VERSIONED_TYPE_NAME)
|| serializerDef.getName().equals(AVRO_GENERIC_TYPE_NAME)) {
SchemaEvolutionValidator.validateAllAvroSchemas(serializerDef);
// check backwards compatibility if needed
if(serializerDef.getName().equals(AVRO_GENERIC_VERSIONED_TYPE_NAME)) {
SchemaEvolutionValidator.checkSchemaCompatibility(serializerDef);
}
}
} } | public class class_name {
private static void validateIfAvroSchema(SerializerDefinition serializerDef) {
if(serializerDef.getName().equals(AVRO_GENERIC_VERSIONED_TYPE_NAME)
|| serializerDef.getName().equals(AVRO_GENERIC_TYPE_NAME)) {
SchemaEvolutionValidator.validateAllAvroSchemas(serializerDef); // depends on control dependency: [if], data = [none]
// check backwards compatibility if needed
if(serializerDef.getName().equals(AVRO_GENERIC_VERSIONED_TYPE_NAME)) {
SchemaEvolutionValidator.checkSchemaCompatibility(serializerDef); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void swap(double[] doubleArray1, int array1Index, double[] doubleArray2, int array2Index) {
if(doubleArray1[array1Index] != doubleArray2[array2Index]) {
double hold = doubleArray1[array1Index];
doubleArray1[array1Index] = doubleArray2[array2Index];
doubleArray2[array2Index] = hold;
}
} } | public class class_name {
public static void swap(double[] doubleArray1, int array1Index, double[] doubleArray2, int array2Index) {
if(doubleArray1[array1Index] != doubleArray2[array2Index]) {
double hold = doubleArray1[array1Index];
doubleArray1[array1Index] = doubleArray2[array2Index]; // depends on control dependency: [if], data = [none]
doubleArray2[array2Index] = hold; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Resource addViewingHint(ViewingHint first, ViewingHint... rest) throws IllegalArgumentException {
List<ViewingHint> hints = this.viewingHints;
if (hints == null) {
hints = new ArrayList<>();
}
hints.addAll(Lists.asList(first, rest));
this.setViewingHints(hints);
return this;
} } | public class class_name {
public Resource addViewingHint(ViewingHint first, ViewingHint... rest) throws IllegalArgumentException {
List<ViewingHint> hints = this.viewingHints;
if (hints == null) {
hints = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
hints.addAll(Lists.asList(first, rest));
this.setViewingHints(hints);
return this;
} } |
public class class_name {
public void assertExists(Description description, File actual) {
assertNotNull(description, actual);
if (!actual.exists()) {
String format = "expecting resource in path:<%s> to exist";
throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
}
} } | public class class_name {
public void assertExists(Description description, File actual) {
assertNotNull(description, actual);
if (!actual.exists()) {
String format = "expecting resource in path:<%s> to exist";
// depends on control dependency: [if], data = [none]
throw failures.failure(description, new BasicErrorMessageFactory(format, actual));
}
} } |
public class class_name {
public static boolean shouldIgnoreStatistics(String createdBy, PrimitiveTypeName columnType) {
if (columnType != PrimitiveTypeName.BINARY && columnType != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
// the bug only applies to binary columns
return false;
}
if (Strings.isNullOrEmpty(createdBy)) {
// created_by is not populated, which could have been caused by
// parquet-mr during the same time as PARQUET-251, see PARQUET-297
warnOnce("Ignoring statistics because created_by is null or empty! See PARQUET-251 and PARQUET-297");
return true;
}
try {
ParsedVersion version = VersionParser.parse(createdBy);
if (!"parquet-mr".equals(version.application)) {
// assume other applications don't have this bug
return false;
}
if (Strings.isNullOrEmpty(version.version)) {
warnOnce("Ignoring statistics because created_by did not contain a semver (see PARQUET-251): " + createdBy);
return true;
}
SemanticVersion semver = SemanticVersion.parse(version.version);
if (semver.compareTo(PARQUET_251_FIXED_VERSION) < 0 &&
!(semver.compareTo(CDH_5_PARQUET_251_FIXED_START) >= 0 &&
semver.compareTo(CDH_5_PARQUET_251_FIXED_END) < 0)) {
warnOnce("Ignoring statistics because this file was created prior to "
+ PARQUET_251_FIXED_VERSION
+ ", see PARQUET-251");
return true;
}
// this file was created after the fix
return false;
} catch (RuntimeException e) {
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
} catch (SemanticVersionParseException e) {
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
} catch (VersionParseException e) {
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
}
} } | public class class_name {
public static boolean shouldIgnoreStatistics(String createdBy, PrimitiveTypeName columnType) {
if (columnType != PrimitiveTypeName.BINARY && columnType != PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
// the bug only applies to binary columns
return false; // depends on control dependency: [if], data = [none]
}
if (Strings.isNullOrEmpty(createdBy)) {
// created_by is not populated, which could have been caused by
// parquet-mr during the same time as PARQUET-251, see PARQUET-297
warnOnce("Ignoring statistics because created_by is null or empty! See PARQUET-251 and PARQUET-297"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
try {
ParsedVersion version = VersionParser.parse(createdBy);
if (!"parquet-mr".equals(version.application)) {
// assume other applications don't have this bug
return false; // depends on control dependency: [if], data = [none]
}
if (Strings.isNullOrEmpty(version.version)) {
warnOnce("Ignoring statistics because created_by did not contain a semver (see PARQUET-251): " + createdBy); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
SemanticVersion semver = SemanticVersion.parse(version.version);
if (semver.compareTo(PARQUET_251_FIXED_VERSION) < 0 &&
!(semver.compareTo(CDH_5_PARQUET_251_FIXED_START) >= 0 &&
semver.compareTo(CDH_5_PARQUET_251_FIXED_END) < 0)) {
warnOnce("Ignoring statistics because this file was created prior to "
+ PARQUET_251_FIXED_VERSION
+ ", see PARQUET-251"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// this file was created after the fix
return false; // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
} catch (SemanticVersionParseException e) { // depends on control dependency: [catch], data = [none]
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
} catch (VersionParseException e) { // depends on control dependency: [catch], data = [none]
// couldn't parse the created_by field, log what went wrong, don't trust the stats,
// but don't make this fatal.
warnParseErrorOnce(createdBy, e);
return true;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) {
try {
ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} } | public class class_name {
public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream, boolean isSrcPng) {
try {
ImageIO.write(isSrcPng ? copyImage(srcImage, BufferedImage.TYPE_INT_RGB) : toBufferedImage(srcImage), formatName, destImageStream);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IORuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void iterate(InputStream is, ZipEntryCallback action, Charset charset) {
try {
ZipInputStream in = null;
try {
in = newCloseShieldZipInputStream(is, charset);
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
try {
action.process(in, entry);
}
catch (IOException ze) {
throw new ZipException("Failed to process zip entry '" + entry.getName() + " with action " + action, ze);
}
catch (ZipBreakException ex) {
break;
}
}
}
finally {
if (in != null) {
in.close();
}
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
} } | public class class_name {
public static void iterate(InputStream is, ZipEntryCallback action, Charset charset) {
try {
ZipInputStream in = null;
try {
in = newCloseShieldZipInputStream(is, charset); // depends on control dependency: [try], data = [none]
ZipEntry entry;
while ((entry = in.getNextEntry()) != null) {
try {
action.process(in, entry); // depends on control dependency: [try], data = [none]
}
catch (IOException ze) {
throw new ZipException("Failed to process zip entry '" + entry.getName() + " with action " + action, ze);
} // depends on control dependency: [catch], data = [none]
catch (ZipBreakException ex) {
break;
} // depends on control dependency: [catch], data = [none]
}
}
finally {
if (in != null) {
in.close(); // depends on control dependency: [if], data = [none]
}
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static synchronized PlatformLogger getLogger(String name) {
PlatformLogger log = loggers.get(name);
if (log == null) {
log = new PlatformLogger(name);
loggers.put(name, log);
}
return log;
} } | public class class_name {
public static synchronized PlatformLogger getLogger(String name) {
PlatformLogger log = loggers.get(name);
if (log == null) {
log = new PlatformLogger(name); // depends on control dependency: [if], data = [none]
loggers.put(name, log); // depends on control dependency: [if], data = [none]
}
return log;
} } |
public class class_name {
private void calculate() {
if (niceScale) {
this.niceRange = calcNiceNumber(maxValue - minValue, false);
this.majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true);
this.niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing;
this.niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing;
this.minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true);
this.range = niceMaxValue - niceMinValue;
} else {
this.niceRange = (maxValue - minValue);
this.niceMinValue = minValue;
this.niceMaxValue = maxValue;
this.range = this.niceRange;
}
} } | public class class_name {
private void calculate() {
if (niceScale) {
this.niceRange = calcNiceNumber(maxValue - minValue, false); // depends on control dependency: [if], data = [none]
this.majorTickSpacing = calcNiceNumber(niceRange / (maxNoOfMajorTicks - 1), true); // depends on control dependency: [if], data = [none]
this.niceMinValue = Math.floor(minValue / majorTickSpacing) * majorTickSpacing; // depends on control dependency: [if], data = [none]
this.niceMaxValue = Math.ceil(maxValue / majorTickSpacing) * majorTickSpacing; // depends on control dependency: [if], data = [none]
this.minorTickSpacing = calcNiceNumber(majorTickSpacing / (maxNoOfMinorTicks - 1), true); // depends on control dependency: [if], data = [none]
this.range = niceMaxValue - niceMinValue; // depends on control dependency: [if], data = [none]
} else {
this.niceRange = (maxValue - minValue); // depends on control dependency: [if], data = [none]
this.niceMinValue = minValue; // depends on control dependency: [if], data = [none]
this.niceMaxValue = maxValue; // depends on control dependency: [if], data = [none]
this.range = this.niceRange; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Type createInstance(String name, double min, double max)
{
// Ensure that min is less than or equal to max.
if (min > max)
{
throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
}
synchronized (DOUBLE_RANGE_TYPES)
{
// Add the newly created type to the map of all types.
DoubleRangeType newType = new DoubleRangeType(name, min, max);
// Ensure that the named type does not already exist, unless it has an identical definition already, in which
// case the old definition can be re-used and the new one discarded.
DoubleRangeType oldType = DOUBLE_RANGE_TYPES.get(name);
if ((oldType != null) && !oldType.equals(newType))
{
throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
}
else if ((oldType != null) && oldType.equals(newType))
{
return oldType;
}
else
{
DOUBLE_RANGE_TYPES.put(name, newType);
return newType;
}
}
} } | public class class_name {
public static Type createInstance(String name, double min, double max)
{
// Ensure that min is less than or equal to max.
if (min > max)
{
throw new IllegalArgumentException("'min' must be less than or equal to 'max'.");
}
synchronized (DOUBLE_RANGE_TYPES)
{
// Add the newly created type to the map of all types.
DoubleRangeType newType = new DoubleRangeType(name, min, max);
// Ensure that the named type does not already exist, unless it has an identical definition already, in which
// case the old definition can be re-used and the new one discarded.
DoubleRangeType oldType = DOUBLE_RANGE_TYPES.get(name);
if ((oldType != null) && !oldType.equals(newType))
{
throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined.");
}
else if ((oldType != null) && oldType.equals(newType))
{
return oldType; // depends on control dependency: [if], data = [none]
}
else
{
DOUBLE_RANGE_TYPES.put(name, newType); // depends on control dependency: [if], data = [none]
return newType; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void assertEquals(String message, Object expected, Object actual) {
if (expected == null && actual != null || expected != null && !expected.equals(actual)) {
fail(message);
}
} } | public class class_name {
public static void assertEquals(String message, Object expected, Object actual) {
if (expected == null && actual != null || expected != null && !expected.equals(actual)) {
fail(message); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(StorageDescriptor storageDescriptor, ProtocolMarshaller protocolMarshaller) {
if (storageDescriptor == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(storageDescriptor.getColumns(), COLUMNS_BINDING);
protocolMarshaller.marshall(storageDescriptor.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(storageDescriptor.getInputFormat(), INPUTFORMAT_BINDING);
protocolMarshaller.marshall(storageDescriptor.getOutputFormat(), OUTPUTFORMAT_BINDING);
protocolMarshaller.marshall(storageDescriptor.getCompressed(), COMPRESSED_BINDING);
protocolMarshaller.marshall(storageDescriptor.getNumberOfBuckets(), NUMBEROFBUCKETS_BINDING);
protocolMarshaller.marshall(storageDescriptor.getSerdeInfo(), SERDEINFO_BINDING);
protocolMarshaller.marshall(storageDescriptor.getBucketColumns(), BUCKETCOLUMNS_BINDING);
protocolMarshaller.marshall(storageDescriptor.getSortColumns(), SORTCOLUMNS_BINDING);
protocolMarshaller.marshall(storageDescriptor.getParameters(), PARAMETERS_BINDING);
protocolMarshaller.marshall(storageDescriptor.getSkewedInfo(), SKEWEDINFO_BINDING);
protocolMarshaller.marshall(storageDescriptor.getStoredAsSubDirectories(), STOREDASSUBDIRECTORIES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StorageDescriptor storageDescriptor, ProtocolMarshaller protocolMarshaller) {
if (storageDescriptor == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(storageDescriptor.getColumns(), COLUMNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getInputFormat(), INPUTFORMAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getOutputFormat(), OUTPUTFORMAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getCompressed(), COMPRESSED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getNumberOfBuckets(), NUMBEROFBUCKETS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getSerdeInfo(), SERDEINFO_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getBucketColumns(), BUCKETCOLUMNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getSortColumns(), SORTCOLUMNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getParameters(), PARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getSkewedInfo(), SKEWEDINFO_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(storageDescriptor.getStoredAsSubDirectories(), STOREDASSUBDIRECTORIES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String methodDescriptor(MethodNode mNode) {
StringBuilder sb = new StringBuilder(mNode.getName().length() + mNode.getParameters().length * 10);
sb.append(mNode.getReturnType().getName());
sb.append(' ');
sb.append(mNode.getName());
sb.append('(');
for (int i = 0; i < mNode.getParameters().length; i++) {
if (i > 0) {
sb.append(", ");
}
Parameter p = mNode.getParameters()[i];
sb.append(ClassNodeUtils.formatTypeName(p.getType()));
}
sb.append(')');
return sb.toString();
} } | public class class_name {
public static String methodDescriptor(MethodNode mNode) {
StringBuilder sb = new StringBuilder(mNode.getName().length() + mNode.getParameters().length * 10);
sb.append(mNode.getReturnType().getName());
sb.append(' ');
sb.append(mNode.getName());
sb.append('(');
for (int i = 0; i < mNode.getParameters().length; i++) {
if (i > 0) {
sb.append(", "); // depends on control dependency: [if], data = [none]
}
Parameter p = mNode.getParameters()[i];
sb.append(ClassNodeUtils.formatTypeName(p.getType())); // depends on control dependency: [for], data = [none]
}
sb.append(')');
return sb.toString();
} } |
public class class_name {
public Point toPixels(LatLong in) {
if (in == null || this.mapView.getWidth() <= 0 || this.mapView.getHeight() <= 0) {
return null;
}
MapPosition mapPosition = this.mapView.getModel().mapViewPosition.getMapPosition();
// this means somehow the mapview is not yet properly set up, see issue #308.
if (mapPosition == null) {
return null;
}
// calculate the pixel coordinates of the top left corner
LatLong latLong = mapPosition.latLong;
long mapSize = MercatorProjection.getMapSize(mapPosition.zoomLevel, this.mapView.getModel().displayModel.getTileSize());
double pixelX = MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize);
pixelX -= this.mapView.getWidth() >> 1;
pixelY -= this.mapView.getHeight() >> 1;
// create a new point and return it
return new Point(
(int) (MercatorProjection.longitudeToPixelX(in.longitude, mapSize) - pixelX),
(int) (MercatorProjection.latitudeToPixelY(in.latitude, mapSize) - pixelY));
} } | public class class_name {
public Point toPixels(LatLong in) {
if (in == null || this.mapView.getWidth() <= 0 || this.mapView.getHeight() <= 0) {
return null; // depends on control dependency: [if], data = [none]
}
MapPosition mapPosition = this.mapView.getModel().mapViewPosition.getMapPosition();
// this means somehow the mapview is not yet properly set up, see issue #308.
if (mapPosition == null) {
return null; // depends on control dependency: [if], data = [none]
}
// calculate the pixel coordinates of the top left corner
LatLong latLong = mapPosition.latLong;
long mapSize = MercatorProjection.getMapSize(mapPosition.zoomLevel, this.mapView.getModel().displayModel.getTileSize());
double pixelX = MercatorProjection.longitudeToPixelX(latLong.longitude, mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(latLong.latitude, mapSize);
pixelX -= this.mapView.getWidth() >> 1;
pixelY -= this.mapView.getHeight() >> 1;
// create a new point and return it
return new Point(
(int) (MercatorProjection.longitudeToPixelX(in.longitude, mapSize) - pixelX),
(int) (MercatorProjection.latitudeToPixelY(in.latitude, mapSize) - pixelY));
} } |
public class class_name {
public static String getSelectColumns(Class<?> entityClass) {
EntityTable entityTable = getEntityTable(entityClass);
if (entityTable.getBaseSelect() != null) {
return entityTable.getBaseSelect();
}
Set<EntityColumn> columnList = getColumns(entityClass);
StringBuilder selectBuilder = new StringBuilder();
boolean skipAlias = Map.class.isAssignableFrom(entityClass);
for (EntityColumn entityColumn : columnList) {
selectBuilder.append(entityColumn.getColumn());
if (!skipAlias && !entityColumn.getColumn().equalsIgnoreCase(entityColumn.getProperty())) {
//不等的时候分几种情况,例如`DESC`
if (entityColumn.getColumn().substring(1, entityColumn.getColumn().length() - 1).equalsIgnoreCase(entityColumn.getProperty())) {
selectBuilder.append(",");
} else {
selectBuilder.append(" AS ").append(entityColumn.getProperty()).append(",");
}
} else {
selectBuilder.append(",");
}
}
entityTable.setBaseSelect(selectBuilder.substring(0, selectBuilder.length() - 1));
return entityTable.getBaseSelect();
} } | public class class_name {
public static String getSelectColumns(Class<?> entityClass) {
EntityTable entityTable = getEntityTable(entityClass);
if (entityTable.getBaseSelect() != null) {
return entityTable.getBaseSelect(); // depends on control dependency: [if], data = [none]
}
Set<EntityColumn> columnList = getColumns(entityClass);
StringBuilder selectBuilder = new StringBuilder();
boolean skipAlias = Map.class.isAssignableFrom(entityClass);
for (EntityColumn entityColumn : columnList) {
selectBuilder.append(entityColumn.getColumn()); // depends on control dependency: [for], data = [entityColumn]
if (!skipAlias && !entityColumn.getColumn().equalsIgnoreCase(entityColumn.getProperty())) {
//不等的时候分几种情况,例如`DESC`
if (entityColumn.getColumn().substring(1, entityColumn.getColumn().length() - 1).equalsIgnoreCase(entityColumn.getProperty())) {
selectBuilder.append(","); // depends on control dependency: [if], data = [none]
} else {
selectBuilder.append(" AS ").append(entityColumn.getProperty()).append(","); // depends on control dependency: [if], data = [none]
}
} else {
selectBuilder.append(","); // depends on control dependency: [if], data = [none]
}
}
entityTable.setBaseSelect(selectBuilder.substring(0, selectBuilder.length() - 1));
return entityTable.getBaseSelect();
} } |
public class class_name {
public static Class<?> getRealGenericClass(Class<?> clazz, Type type) {
if(type instanceof TypeVariable) {
TypeVariable<?> tv = (TypeVariable<?>) type;
Type genericFieldType = getInheritGenericType(clazz, tv);
if (genericFieldType != null) {
return Lang.getTypeClass(genericFieldType);
}
}
return Lang.getTypeClass(type);
} } | public class class_name {
public static Class<?> getRealGenericClass(Class<?> clazz, Type type) {
if(type instanceof TypeVariable) {
TypeVariable<?> tv = (TypeVariable<?>) type;
Type genericFieldType = getInheritGenericType(clazz, tv);
if (genericFieldType != null) {
return Lang.getTypeClass(genericFieldType); // depends on control dependency: [if], data = [(genericFieldType]
}
}
return Lang.getTypeClass(type);
} } |
public class class_name {
private List<String> parseNoticiesAttr(String noticesAttr, String outcome) {
List<String> notifiers = new ArrayList<String>();
int columnCount = 4;
int colon = noticesAttr.indexOf(";");
if (colon != -1) {
columnCount = StringHelper.delimiterColumnCount(noticesAttr.substring(0, colon), ",", "\\,") + 1;
}
int notifierClassColIndex = columnCount > 3 ? 3 : 2;
List<String[]> rows = StringHelper.parseTable(noticesAttr, ',', ';', columnCount);
for (String[] row : rows) {
if (!StringHelper.isEmpty(row[1]) && row[0].equals(outcome)) {
StringTokenizer st = new StringTokenizer(row[notifierClassColIndex], ",");
boolean hasCustomClass = false;
String templateVerSpec = columnCount > 3 ? ":" + row[2] : "";
while (st.hasMoreTokens()) {
String className = st.nextToken();
className = getNotifierClassName(className);
notifiers.add(className + ":" + row[1] + templateVerSpec);
hasCustomClass = true;
}
if (!hasCustomClass) {
notifiers.add(NOTIFIER_PACKAGE + ".TaskEmailNotifier:" +":" + row[1] + templateVerSpec);
}
}
}
return notifiers;
} } | public class class_name {
private List<String> parseNoticiesAttr(String noticesAttr, String outcome) {
List<String> notifiers = new ArrayList<String>();
int columnCount = 4;
int colon = noticesAttr.indexOf(";");
if (colon != -1) {
columnCount = StringHelper.delimiterColumnCount(noticesAttr.substring(0, colon), ",", "\\,") + 1; // depends on control dependency: [if], data = [none]
}
int notifierClassColIndex = columnCount > 3 ? 3 : 2;
List<String[]> rows = StringHelper.parseTable(noticesAttr, ',', ';', columnCount);
for (String[] row : rows) {
if (!StringHelper.isEmpty(row[1]) && row[0].equals(outcome)) {
StringTokenizer st = new StringTokenizer(row[notifierClassColIndex], ",");
boolean hasCustomClass = false;
String templateVerSpec = columnCount > 3 ? ":" + row[2] : "";
while (st.hasMoreTokens()) {
String className = st.nextToken();
className = getNotifierClassName(className); // depends on control dependency: [while], data = [none]
notifiers.add(className + ":" + row[1] + templateVerSpec); // depends on control dependency: [while], data = [none]
hasCustomClass = true; // depends on control dependency: [while], data = [none]
}
if (!hasCustomClass) {
notifiers.add(NOTIFIER_PACKAGE + ".TaskEmailNotifier:" +":" + row[1] + templateVerSpec); // depends on control dependency: [if], data = [none]
}
}
}
return notifiers;
} } |
public class class_name {
public List.Entry addEntry(Token token,
Transaction transaction)
throws ObjectManagerException
{
final String methodName = "addEntry";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, new Object[] { token,
transaction });
// This differs from the default ObjectManager
// behaviour because we optimistically add the link to the list and may need to
// undo this if the transaction backs out. Simply restoring before immages is not
// enough because we dont lock the list during the prepare phase and other links
// could be chanied off this one and commit their trandsactions before
// this one.
Link newLink = null;
// Take a lock on transaction then the list itself, this protects the structure of the list
// and prevents deadlock with threads backing out the transaction. During backout the list
// lock is traven in the preBackout call back after the transaction lock has been taken.
synchronized (transaction.internalTransaction) {
synchronized (this) {
// Prevent other transactions using the list until its creation is commited.
if (!(state == stateReady)
&& !((state == stateAdded) && lockedBy(transaction))) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { new Integer(state),
stateNames[state] });
throw new InvalidStateException(this, state, stateNames[state]);
}
// All optimistic replace updates to links in the list must be made
// together, so we construct a single log record for all of them.
managedObjectsToAdd.clear();
managedObjectsToReplace.clear();
reservedSpaceInStore = storeSpaceForAdd();
owningToken.objectStore.reserve((int) reservedSpaceInStore, false);
// Create the new link and add it to its object store.
newLink = new Link(this,
token,
tail,
null,
transaction);
managedObjectsToAdd.add(newLink);
// Chain the new Link in the list. If the transaction backs
// out we will rewrite the links to remove the new one.
if (head == null) // Only element in the list?
{
head = newLink.getToken();
availableHead = head; // PK75215
} else { // In the body of the list.
Link tailLink = (Link) tail.getManagedObject();
tailLink.next = newLink.getToken();
managedObjectsToReplace.add(tailLink);
}
tail = newLink.getToken();
incrementSize(); // Adjust list length assuming we will commit.
managedObjectsToReplace.add(this); // The anchor for the list.
// Harden the updates. If the update fails, because the log is full,
// we have affected the structure of the list so we will have to
// reverse the changes. Reserve enough space to reverse the update if the
// transaction backs out.
// TODO We need another optimistic replace with a more restricted state machine, this one
// will allow an add after we have done prepare.
try {
transaction.optimisticReplace(managedObjectsToAdd,
managedObjectsToReplace,
null, // No tokens to delete.
null, // No tokens to notify.
+logSpaceForDelete());
// Give up reserved space, but keep back enough to remove the entry if we have to.
owningToken.objectStore.reserve((int) (storeSpaceForRemove() - reservedSpaceInStore), false);
} catch (InvalidStateException exception) {
// No FFDC Code Needed, user error.
// Remove the link we just added.
undoAdd(newLink);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, exception);
throw exception;
} catch (LogFileFullException exception) {
// No FFDC Code Needed, InternalTransaction has already done this.
// Remove the link we just added.
undoAdd(newLink);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, exception);
throw exception;
// We should not see ObjectStoreFullException because we have preReserved
// the ObjectStore space.
// } catch (ObjectStoreFullException exception) {
// // No FFDC Code Needed, InternalTransaction has already done this.
// // Remove the link we just added.
// undoAdd(newLink);
//
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this, cclass, methodName, exception);
// throw exception;
} // try.
} // synchronized (this).
} // synchronized (transaction.internalTransaction)
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { newLink });
return (List.Entry) newLink;
} } | public class class_name {
public List.Entry addEntry(Token token,
Transaction transaction)
throws ObjectManagerException
{
final String methodName = "addEntry";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, new Object[] { token,
transaction });
// This differs from the default ObjectManager
// behaviour because we optimistically add the link to the list and may need to
// undo this if the transaction backs out. Simply restoring before immages is not
// enough because we dont lock the list during the prepare phase and other links
// could be chanied off this one and commit their trandsactions before
// this one.
Link newLink = null;
// Take a lock on transaction then the list itself, this protects the structure of the list
// and prevents deadlock with threads backing out the transaction. During backout the list
// lock is traven in the preBackout call back after the transaction lock has been taken.
synchronized (transaction.internalTransaction) {
synchronized (this) {
// Prevent other transactions using the list until its creation is commited.
if (!(state == stateReady)
&& !((state == stateAdded) && lockedBy(transaction))) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { new Integer(state),
stateNames[state] });
throw new InvalidStateException(this, state, stateNames[state]);
}
// All optimistic replace updates to links in the list must be made
// together, so we construct a single log record for all of them.
managedObjectsToAdd.clear();
managedObjectsToReplace.clear();
reservedSpaceInStore = storeSpaceForAdd();
owningToken.objectStore.reserve((int) reservedSpaceInStore, false);
// Create the new link and add it to its object store.
newLink = new Link(this,
token,
tail,
null,
transaction);
managedObjectsToAdd.add(newLink);
// Chain the new Link in the list. If the transaction backs
// out we will rewrite the links to remove the new one.
if (head == null) // Only element in the list?
{
head = newLink.getToken(); // depends on control dependency: [if], data = [none]
availableHead = head; // PK75215 // depends on control dependency: [if], data = [none]
} else { // In the body of the list.
Link tailLink = (Link) tail.getManagedObject();
tailLink.next = newLink.getToken(); // depends on control dependency: [if], data = [none]
managedObjectsToReplace.add(tailLink); // depends on control dependency: [if], data = [none]
}
tail = newLink.getToken();
incrementSize(); // Adjust list length assuming we will commit.
managedObjectsToReplace.add(this); // The anchor for the list.
// Harden the updates. If the update fails, because the log is full,
// we have affected the structure of the list so we will have to
// reverse the changes. Reserve enough space to reverse the update if the
// transaction backs out.
// TODO We need another optimistic replace with a more restricted state machine, this one
// will allow an add after we have done prepare.
try {
transaction.optimisticReplace(managedObjectsToAdd,
managedObjectsToReplace,
null, // No tokens to delete.
null, // No tokens to notify.
+logSpaceForDelete()); // depends on control dependency: [try], data = [none]
// Give up reserved space, but keep back enough to remove the entry if we have to.
owningToken.objectStore.reserve((int) (storeSpaceForRemove() - reservedSpaceInStore), false); // depends on control dependency: [try], data = [none]
} catch (InvalidStateException exception) {
// No FFDC Code Needed, user error.
// Remove the link we just added.
undoAdd(newLink);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, exception);
throw exception;
} catch (LogFileFullException exception) { // depends on control dependency: [catch], data = [none]
// No FFDC Code Needed, InternalTransaction has already done this.
// Remove the link we just added.
undoAdd(newLink);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, exception);
throw exception;
// We should not see ObjectStoreFullException because we have preReserved
// the ObjectStore space.
// } catch (ObjectStoreFullException exception) {
// // No FFDC Code Needed, InternalTransaction has already done this.
// // Remove the link we just added.
// undoAdd(newLink);
//
// if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
// trace.exit(this, cclass, methodName, exception);
// throw exception;
} // try. // depends on control dependency: [catch], data = [none]
} // synchronized (this).
} // synchronized (transaction.internalTransaction)
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { newLink });
return (List.Entry) newLink;
} } |
public class class_name {
@Override
public void backward() {
MVecArray<VarTensor> xs = modIn.getOutput();
MVecArray<VarTensor> xsAdj = modIn.getOutputAdj();
for (int a=0; a<xsAdj.dim(); a++) {
VarTensor xAdj = xsAdj.get(a);
// Compute the product of all the input factors except for a.
// We compute this cavity by brute force, rather than dividing out from the joint.
VarTensor prod = new VarTensor(yAdj);
for (int b=0; b<xsAdj.dim(); b++) {
if (a == b) { continue; }
prod.prod(xs.get(b));
}
xAdj.add(prod.getMarginal(xAdj.getVars(), false));
}
} } | public class class_name {
@Override
public void backward() {
MVecArray<VarTensor> xs = modIn.getOutput();
MVecArray<VarTensor> xsAdj = modIn.getOutputAdj();
for (int a=0; a<xsAdj.dim(); a++) {
VarTensor xAdj = xsAdj.get(a);
// Compute the product of all the input factors except for a.
// We compute this cavity by brute force, rather than dividing out from the joint.
VarTensor prod = new VarTensor(yAdj);
for (int b=0; b<xsAdj.dim(); b++) {
if (a == b) { continue; }
prod.prod(xs.get(b)); // depends on control dependency: [for], data = [b]
}
xAdj.add(prod.getMarginal(xAdj.getVars(), false)); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
int getPagePosition(AbstractIndexPage indexPage) {
//We know that the element exists, so we iterate to list.length instead of nEntires
//(which is not available in this context at the moment.
for (int i = 0; i < subPages.length; i++) {
if (subPages[i] == indexPage) {
return i;
}
}
throw DBLogger.newFatalInternal("Leaf page not found in parent page: " +
indexPage.pageId + " " + Arrays.toString(subPageIds));
} } | public class class_name {
int getPagePosition(AbstractIndexPage indexPage) {
//We know that the element exists, so we iterate to list.length instead of nEntires
//(which is not available in this context at the moment.
for (int i = 0; i < subPages.length; i++) {
if (subPages[i] == indexPage) {
return i; // depends on control dependency: [if], data = [none]
}
}
throw DBLogger.newFatalInternal("Leaf page not found in parent page: " +
indexPage.pageId + " " + Arrays.toString(subPageIds));
} } |
public class class_name {
private Optional<InjectiveVar2VarSubstitution> computeRenamingSubstitution(
DistinctVariableOnlyDataAtom sourceProjectionAtom,
DistinctVariableOnlyDataAtom targetProjectionAtom) {
int arity = sourceProjectionAtom.getEffectiveArity();
if (!sourceProjectionAtom.getPredicate().equals(targetProjectionAtom.getPredicate())
|| (arity != targetProjectionAtom.getEffectiveArity())) {
return Optional.empty();
}
else {
ImmutableMap<Variable, Variable> newMap = FunctionalTools.zip(
sourceProjectionAtom.getArguments(),
targetProjectionAtom.getArguments()).stream()
.distinct()
.filter(e -> !e.getKey().equals(e.getValue()))
.collect(ImmutableCollectors.toMap());
return Optional.of(substitutionFactory.getInjectiveVar2VarSubstitution(newMap));
}
} } | public class class_name {
private Optional<InjectiveVar2VarSubstitution> computeRenamingSubstitution(
DistinctVariableOnlyDataAtom sourceProjectionAtom,
DistinctVariableOnlyDataAtom targetProjectionAtom) {
int arity = sourceProjectionAtom.getEffectiveArity();
if (!sourceProjectionAtom.getPredicate().equals(targetProjectionAtom.getPredicate())
|| (arity != targetProjectionAtom.getEffectiveArity())) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
else {
ImmutableMap<Variable, Variable> newMap = FunctionalTools.zip(
sourceProjectionAtom.getArguments(),
targetProjectionAtom.getArguments()).stream()
.distinct()
.filter(e -> !e.getKey().equals(e.getValue()))
.collect(ImmutableCollectors.toMap());
return Optional.of(substitutionFactory.getInjectiveVar2VarSubstitution(newMap)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void initialize() {
InputStream in;
try {
in = Resources.getResourceAsStream("mybatis.cfg.xml");
sqlSessionFactory = new SqlSessionFactoryBuilder().build(in, ConfigHelper.getProperties());
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
public static void initialize() {
InputStream in;
try {
in = Resources.getResourceAsStream("mybatis.cfg.xml"); // depends on control dependency: [try], data = [none]
sqlSessionFactory = new SqlSessionFactoryBuilder().build(in, ConfigHelper.getProperties()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private ImmutableList<Fact> description() {
String description = null;
boolean descriptionWasDerived = false;
for (Step step : steps) {
if (step.isCheckCall()) {
checkState(description != null);
if (step.descriptionUpdate == null) {
description = null;
descriptionWasDerived = false;
} else {
description = verifyNotNull(step.descriptionUpdate.apply(description));
descriptionWasDerived = true;
}
continue;
}
if (description == null) {
description =
firstNonNull(step.subject.internalCustomName(), step.subject.typeDescription());
}
}
return descriptionWasDerived
? ImmutableList.of(fact("value of", description))
: ImmutableList.<Fact>of();
} } | public class class_name {
private ImmutableList<Fact> description() {
String description = null;
boolean descriptionWasDerived = false;
for (Step step : steps) {
if (step.isCheckCall()) {
checkState(description != null); // depends on control dependency: [if], data = [none]
if (step.descriptionUpdate == null) {
description = null; // depends on control dependency: [if], data = [none]
descriptionWasDerived = false; // depends on control dependency: [if], data = [none]
} else {
description = verifyNotNull(step.descriptionUpdate.apply(description)); // depends on control dependency: [if], data = [(step.descriptionUpdate]
descriptionWasDerived = true; // depends on control dependency: [if], data = [none]
}
continue;
}
if (description == null) {
description =
firstNonNull(step.subject.internalCustomName(), step.subject.typeDescription()); // depends on control dependency: [if], data = [none]
}
}
return descriptionWasDerived
? ImmutableList.of(fact("value of", description))
: ImmutableList.<Fact>of();
} } |
public class class_name {
public static Transform createViewportTransform(double x, double y, final double width, final double height, final double viewportWidth, final double viewportHeight)
{
if ((width <= 0) || (height <= 0))
{
return null;
}
final double scaleX = viewportWidth / width;
final double scaleY = viewportHeight / height;
double scale;
if (scaleX > scaleY)
{
// use scaleY
scale = scaleY;
final double dw = (viewportWidth / scale) - width;
x -= dw / 2;
}
else
{
scale = scaleX;
final double dh = (viewportHeight / scale) - height;
y -= dh / 2;
}
// x' = m[0] + x*m[1] y' = m[2] + y*m[3]
final double m02 = -x * scale;
final double m12 = -y * scale;
return new Transform(scale, 0, 0, scale, m02, m12);
} } | public class class_name {
public static Transform createViewportTransform(double x, double y, final double width, final double height, final double viewportWidth, final double viewportHeight)
{
if ((width <= 0) || (height <= 0))
{
return null; // depends on control dependency: [if], data = [none]
}
final double scaleX = viewportWidth / width;
final double scaleY = viewportHeight / height;
double scale;
if (scaleX > scaleY)
{
// use scaleY
scale = scaleY; // depends on control dependency: [if], data = [none]
final double dw = (viewportWidth / scale) - width;
x -= dw / 2; // depends on control dependency: [if], data = [none]
}
else
{
scale = scaleX; // depends on control dependency: [if], data = [none]
final double dh = (viewportHeight / scale) - height;
y -= dh / 2; // depends on control dependency: [if], data = [none]
}
// x' = m[0] + x*m[1] y' = m[2] + y*m[3]
final double m02 = -x * scale;
final double m12 = -y * scale;
return new Transform(scale, 0, 0, scale, m02, m12);
} } |
public class class_name {
public Observable<ServiceResponse<Page<SecretItem>>> getSecretVersionsNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.getSecretVersionsNext(nextUrl, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SecretItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SecretItem>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SecretItem>> result = getSecretVersionsNextDelegate(response);
return Observable.just(new ServiceResponse<Page<SecretItem>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<SecretItem>>> getSecretVersionsNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
}
String nextUrl = String.format("%s", nextPageLink);
return service.getSecretVersionsNext(nextUrl, this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SecretItem>>>>() {
@Override
public Observable<ServiceResponse<Page<SecretItem>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<SecretItem>> result = getSecretVersionsNextDelegate(response);
return Observable.just(new ServiceResponse<Page<SecretItem>>(result.body(), result.response())); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public XmlValidationResult validate(File xmlFile, EntityResolver entityResolver, XmlErrorHandlerAbstract errorHandler) {
if (xmlFile == null) {
throw new IllegalArgumentException("xmlFile is null");
}
XmlValidationResult result = new XmlValidationResult();
if (errorHandler == null) {
errorHandler = new XmlErrorHandler();
}
errorHandler.reset();
InputStream in = null;
try {
/*
* Test for well-formed-ness.
*/
in = new FileInputStream(xmlFile);
if (builderParsing != null) {
try {
builderParsing.reset();
} catch (UnsupportedOperationException e) {
builderParsing = null;
}
}
if (builderParsing == null) {
try {
builderParsing = factoryParsing.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new IllegalStateException("Could not create a new 'DocumentBuilder'!");
}
}
builderParsing.setErrorHandler(errorHandler);
result.document = builderParsing.parse(in);
in.close();
in = null;
result.bWellformed = !errorHandler.hasErrors();
/*
* Look for references to DTD or XSD.
*/
DocumentType documentType = result.document.getDoctype();
if (documentType != null) {
result.systemId = documentType.getSystemId();
}
if (result.systemId != null) {
result.bDtdUsed = true;
} else {
XPathFactory xpf = XPathFactory.newInstance();
XPath xp = xpf.newXPath();
NodeList nodes;
Node node;
// JDK6 XPath engine supposedly only implements v1.0 of the specs.
nodes = (NodeList)xp.evaluate("//*", result.document.getDocumentElement(), XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
node = nodes.item(i).getAttributes().getNamedItem("xmlns:xsi");
if (node != null) {
result.xsiNamespaces.add(node.getNodeValue());
result.bXsdUsed = true;
}
node = nodes.item(i).getAttributes().getNamedItem("xsi:schemaLocation");
if (node != null) {
// debug
result.schemas.add(node.getNodeValue());
result.bXsdUsed = true;
}
}
}
/*
* Validate against DTD/XSD.
*/
if (result.bDtdUsed || result.bXsdUsed) {
in = new FileInputStream(xmlFile);
if (builderValidating != null) {
try {
builderValidating.reset();
} catch (UnsupportedOperationException e) {
builderValidating = null;
}
}
if (builderValidating == null) {
try {
builderValidating = factoryValidating.newDocumentBuilder();
} catch (ParserConfigurationException e) {
throw new IllegalStateException("Could not create a new 'DocumentBuilder'!");
}
}
builderValidating.setEntityResolver(entityResolver);
builderValidating.setErrorHandler(errorHandler);
result.document = builderValidating.parse(in);
in.close();
in = null;
result.bValid = !errorHandler.hasErrors();
}
} catch (Throwable t) {
logger.error("Exception validating XML stream!", t.toString(), t);
try {
String publicId = "";
String systemId = "";
int lineNumber = -1;
int columnNumber = -1;
Exception sillyApiException = new Exception("XML validation exception!", t);
errorHandler.error(new SAXParseException(t.toString(), publicId, systemId, lineNumber, columnNumber, sillyApiException));
} catch (SAXException e) {
throw new IllegalStateException("Failed to add error to ErrorHandler!", e);
}
result.bWellformed = false;
result.bValid = false;
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
logger.error("Exception closing stream!", e.toString(), e);
}
in = null;
}
}
return result;
} } | public class class_name {
public XmlValidationResult validate(File xmlFile, EntityResolver entityResolver, XmlErrorHandlerAbstract errorHandler) {
if (xmlFile == null) {
throw new IllegalArgumentException("xmlFile is null");
}
XmlValidationResult result = new XmlValidationResult();
if (errorHandler == null) {
errorHandler = new XmlErrorHandler(); // depends on control dependency: [if], data = [none]
}
errorHandler.reset();
InputStream in = null;
try {
/*
* Test for well-formed-ness.
*/
in = new FileInputStream(xmlFile);
if (builderParsing != null) {
try {
builderParsing.reset(); // depends on control dependency: [try], data = [none]
} catch (UnsupportedOperationException e) {
builderParsing = null;
} // depends on control dependency: [catch], data = [none]
}
if (builderParsing == null) {
try {
builderParsing = factoryParsing.newDocumentBuilder(); // depends on control dependency: [try], data = [none]
} catch (ParserConfigurationException e) {
throw new IllegalStateException("Could not create a new 'DocumentBuilder'!");
} // depends on control dependency: [catch], data = [none]
}
builderParsing.setErrorHandler(errorHandler);
result.document = builderParsing.parse(in);
in.close();
in = null;
result.bWellformed = !errorHandler.hasErrors();
/*
* Look for references to DTD or XSD.
*/
DocumentType documentType = result.document.getDoctype();
if (documentType != null) {
result.systemId = documentType.getSystemId(); // depends on control dependency: [if], data = [none]
}
if (result.systemId != null) {
result.bDtdUsed = true; // depends on control dependency: [if], data = [none]
} else {
XPathFactory xpf = XPathFactory.newInstance();
XPath xp = xpf.newXPath();
NodeList nodes;
Node node;
// JDK6 XPath engine supposedly only implements v1.0 of the specs.
nodes = (NodeList)xp.evaluate("//*", result.document.getDocumentElement(), XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++) {
node = nodes.item(i).getAttributes().getNamedItem("xmlns:xsi"); // depends on control dependency: [if], data = [none]
if (node != null) {
result.xsiNamespaces.add(node.getNodeValue()); // depends on control dependency: [if], data = [(node]
result.bXsdUsed = true; // depends on control dependency: [if], data = [none]
}
node = nodes.item(i).getAttributes().getNamedItem("xsi:schemaLocation"); // depends on control dependency: [if], data = [none]
if (node != null) {
// debug
result.schemas.add(node.getNodeValue()); // depends on control dependency: [if], data = [(node]
result.bXsdUsed = true; // depends on control dependency: [if], data = [none]
}
}
}
/*
* Validate against DTD/XSD.
*/
if (result.bDtdUsed || result.bXsdUsed) {
in = new FileInputStream(xmlFile); // depends on control dependency: [if], data = [none]
if (builderValidating != null) {
try {
builderValidating.reset(); // depends on control dependency: [try], data = [none]
} catch (UnsupportedOperationException e) {
builderValidating = null;
} // depends on control dependency: [catch], data = [none]
}
if (builderValidating == null) {
try {
builderValidating = factoryValidating.newDocumentBuilder(); // depends on control dependency: [try], data = [none]
} catch (ParserConfigurationException e) {
throw new IllegalStateException("Could not create a new 'DocumentBuilder'!");
} // depends on control dependency: [catch], data = [none]
}
builderValidating.setEntityResolver(entityResolver); // depends on control dependency: [if], data = [none]
builderValidating.setErrorHandler(errorHandler); // depends on control dependency: [if], data = [none]
result.document = builderValidating.parse(in); // depends on control dependency: [if], data = [none]
in.close(); // depends on control dependency: [if], data = [none]
in = null; // depends on control dependency: [if], data = [none]
result.bValid = !errorHandler.hasErrors(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
logger.error("Exception validating XML stream!", t.toString(), t);
try {
String publicId = "";
String systemId = "";
int lineNumber = -1;
int columnNumber = -1;
Exception sillyApiException = new Exception("XML validation exception!", t);
errorHandler.error(new SAXParseException(t.toString(), publicId, systemId, lineNumber, columnNumber, sillyApiException)); // depends on control dependency: [try], data = [none]
} catch (SAXException e) {
throw new IllegalStateException("Failed to add error to ErrorHandler!", e);
} // depends on control dependency: [catch], data = [none]
result.bWellformed = false;
result.bValid = false;
} finally {
if (in != null) {
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Exception closing stream!", e.toString(), e);
} // depends on control dependency: [catch], data = [none]
in = null; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void doUnload(final Wave wave) {
this.eventList = new ArrayList<>();
final Collection<BallModel> list = new ArrayList<>(this.ballMap.values());
for (final BallModel ballModel : list) {
unregisterBall(ballModel);
}
} } | public class class_name {
public void doUnload(final Wave wave) {
this.eventList = new ArrayList<>();
final Collection<BallModel> list = new ArrayList<>(this.ballMap.values());
for (final BallModel ballModel : list) {
unregisterBall(ballModel); // depends on control dependency: [for], data = [ballModel]
}
} } |
public class class_name {
private void loadMapRelation(Map<?, ?> obj, String path) {
for(Object key : obj.keySet()){
Object val = obj.get(key);
if(val instanceof String){
relation.put(path + space(path) + key.toString(), Lang.list(val.toString()));
continue;
}
loadRelation(obj.get(key), path + space(path) + key.toString());
}
} } | public class class_name {
private void loadMapRelation(Map<?, ?> obj, String path) {
for(Object key : obj.keySet()){
Object val = obj.get(key);
if(val instanceof String){
relation.put(path + space(path) + key.toString(), Lang.list(val.toString())); // depends on control dependency: [if], data = [none]
continue;
}
loadRelation(obj.get(key), path + space(path) + key.toString()); // depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
public static void main(final String[] args) {
if (args.length < 1) {
System.err.printf("$ java ... %s systemProperty [systemProperty]*%n", GetSystemPropertyValue.class.getName());
System.exit(1);
}
Arrays.stream(args).forEach(systemProperty -> System.out.println(newSystemPropertyValue(systemProperty)));
} } | public class class_name {
public static void main(final String[] args) {
if (args.length < 1) {
System.err.printf("$ java ... %s systemProperty [systemProperty]*%n", GetSystemPropertyValue.class.getName()); // depends on control dependency: [if], data = [none]
System.exit(1); // depends on control dependency: [if], data = [1)]
}
Arrays.stream(args).forEach(systemProperty -> System.out.println(newSystemPropertyValue(systemProperty)));
} } |
public class class_name {
public static String substitute(String input, Object model, Map<String,String> imageMap, boolean lenient)
throws MdwException {
StringBuffer substituted = new StringBuffer(input.length());
try {
Matcher matcher = tokenPattern.matcher(input);
int index = 0;
while (matcher.find()) {
String match = matcher.group();
substituted.append(input.substring(index, matcher.start()));
if (imageMap != null && (match.startsWith("${image:") || match.startsWith("#{image:"))) {
String imageFile = match.substring(8, match.length() - 1);
String imageId = imageFile.substring(0, imageFile.lastIndexOf('.'));
substituted.append("cid:" + imageId);
imageMap.put(imageId, imageFile);
}
else if (match.startsWith("#{")) { // ignore #{... in favor of facelets (except images)
substituted.append(match);
}
else {
Object value;
if (lenient) {
try {
value = propUtilsBean.getProperty(model, match.substring(2, match.length() - 1));
if (value == null)
value = match;
} catch (Exception e) {
value = match;
}
} else {
value = propUtilsBean.getProperty(model, match.substring(2, match.length() - 1));
}
if (value != null)
substituted.append(value);
}
index = matcher.end();
}
substituted.append(input.substring(index));
return substituted.toString();
}
catch (Exception ex) {
throw new MdwException("Error substituting expression value(s)", ex);
}
} } | public class class_name {
public static String substitute(String input, Object model, Map<String,String> imageMap, boolean lenient)
throws MdwException {
StringBuffer substituted = new StringBuffer(input.length());
try {
Matcher matcher = tokenPattern.matcher(input);
int index = 0;
while (matcher.find()) {
String match = matcher.group();
substituted.append(input.substring(index, matcher.start())); // depends on control dependency: [while], data = [none]
if (imageMap != null && (match.startsWith("${image:") || match.startsWith("#{image:"))) {
String imageFile = match.substring(8, match.length() - 1);
String imageId = imageFile.substring(0, imageFile.lastIndexOf('.'));
substituted.append("cid:" + imageId); // depends on control dependency: [if], data = [none]
imageMap.put(imageId, imageFile); // depends on control dependency: [if], data = [none]
}
else if (match.startsWith("#{")) { // ignore #{... in favor of facelets (except images)
substituted.append(match); // depends on control dependency: [if], data = [none]
}
else {
Object value;
if (lenient) {
try {
value = propUtilsBean.getProperty(model, match.substring(2, match.length() - 1)); // depends on control dependency: [try], data = [none]
if (value == null)
value = match;
} catch (Exception e) {
value = match;
} // depends on control dependency: [catch], data = [none]
} else {
value = propUtilsBean.getProperty(model, match.substring(2, match.length() - 1)); // depends on control dependency: [if], data = [none]
}
if (value != null)
substituted.append(value);
}
index = matcher.end(); // depends on control dependency: [while], data = [none]
}
substituted.append(input.substring(index));
return substituted.toString();
}
catch (Exception ex) {
throw new MdwException("Error substituting expression value(s)", ex);
}
} } |
public class class_name {
public void marshall(ListInstancesRequest listInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listInstancesRequest.getClusterId(), CLUSTERID_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getInstanceGroupId(), INSTANCEGROUPID_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getInstanceGroupTypes(), INSTANCEGROUPTYPES_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getInstanceFleetId(), INSTANCEFLEETID_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getInstanceFleetType(), INSTANCEFLEETTYPE_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getInstanceStates(), INSTANCESTATES_BINDING);
protocolMarshaller.marshall(listInstancesRequest.getMarker(), MARKER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListInstancesRequest listInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listInstancesRequest.getClusterId(), CLUSTERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getInstanceGroupId(), INSTANCEGROUPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getInstanceGroupTypes(), INSTANCEGROUPTYPES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getInstanceFleetId(), INSTANCEFLEETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getInstanceFleetType(), INSTANCEFLEETTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getInstanceStates(), INSTANCESTATES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listInstancesRequest.getMarker(), MARKER_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public CommerceCountry remove(Serializable primaryKey)
throws NoSuchCountryException {
Session session = null;
try {
session = openSession();
CommerceCountry commerceCountry = (CommerceCountry)session.get(CommerceCountryImpl.class,
primaryKey);
if (commerceCountry == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceCountry);
}
catch (NoSuchCountryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommerceCountry remove(Serializable primaryKey)
throws NoSuchCountryException {
Session session = null;
try {
session = openSession();
CommerceCountry commerceCountry = (CommerceCountry)session.get(CommerceCountryImpl.class,
primaryKey);
if (commerceCountry == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchCountryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceCountry);
}
catch (NoSuchCountryException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
public boolean contains(RoaringBitmap subset) {
if(subset.getCardinality() > getCardinality()) {
return false;
}
final int length1 = this.highLowContainer.size;
final int length2 = subset.highLowContainer.size;
int pos1 = 0, pos2 = 0;
while (pos1 < length1 && pos2 < length2) {
final short s1 = this.highLowContainer.getKeyAtIndex(pos1);
final short s2 = subset.highLowContainer.getKeyAtIndex(pos2);
if (s1 == s2) {
Container c1 = this.highLowContainer.getContainerAtIndex(pos1);
Container c2 = subset.highLowContainer.getContainerAtIndex(pos2);
if(!c1.contains(c2)) {
return false;
}
++pos1;
++pos2;
} else if (Util.compareUnsigned(s1, s2) > 0) {
return false;
} else {
pos1 = subset.highLowContainer.advanceUntil(s2, pos1);
}
}
return pos2 == length2;
} } | public class class_name {
public boolean contains(RoaringBitmap subset) {
if(subset.getCardinality() > getCardinality()) {
return false; // depends on control dependency: [if], data = [none]
}
final int length1 = this.highLowContainer.size;
final int length2 = subset.highLowContainer.size;
int pos1 = 0, pos2 = 0;
while (pos1 < length1 && pos2 < length2) {
final short s1 = this.highLowContainer.getKeyAtIndex(pos1);
final short s2 = subset.highLowContainer.getKeyAtIndex(pos2);
if (s1 == s2) {
Container c1 = this.highLowContainer.getContainerAtIndex(pos1);
Container c2 = subset.highLowContainer.getContainerAtIndex(pos2);
if(!c1.contains(c2)) {
return false; // depends on control dependency: [if], data = [none]
}
++pos1; // depends on control dependency: [if], data = [none]
++pos2; // depends on control dependency: [if], data = [none]
} else if (Util.compareUnsigned(s1, s2) > 0) {
return false; // depends on control dependency: [if], data = [none]
} else {
pos1 = subset.highLowContainer.advanceUntil(s2, pos1); // depends on control dependency: [if], data = [none]
}
}
return pos2 == length2;
} } |
public class class_name {
public T remove(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
try
{
return data.remove(index);
}
finally
{
fireTableDataChanged();
}
}
return null;
} } | public class class_name {
public T remove(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
try
{
return data.remove(index);
// depends on control dependency: [try], data = [none]
}
finally
{
fireTableDataChanged();
}
}
return null;
} } |
public class class_name {
public void setChartEventsLoad(final Options options, final Function function) {
if (options.getChartOptions() == null) {
options.setChartOptions(new ChartOptions());
}
if (options.getChartOptions().getEvents() == null) {
options.getChartOptions().setEvents(new Events());
}
if (options.getChartOptions().getEvents().getLoad() == null) {
options.getChartOptions().getEvents().setLoad(function);
}
} } | public class class_name {
public void setChartEventsLoad(final Options options, final Function function) {
if (options.getChartOptions() == null) {
options.setChartOptions(new ChartOptions()); // depends on control dependency: [if], data = [none]
}
if (options.getChartOptions().getEvents() == null) {
options.getChartOptions().setEvents(new Events()); // depends on control dependency: [if], data = [none]
}
if (options.getChartOptions().getEvents().getLoad() == null) {
options.getChartOptions().getEvents().setLoad(function); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Deprecated
public static Connection getConnection(String dbName) {
final DataSource dataSource = getDataSource(dbName);
try {
final long start = System.currentTimeMillis();
final Connection c = dataSource.getConnection();
lastDatabase = databaseTimes.add(System.currentTimeMillis() - start); // metric
final int current = activeConnections.incrementAndGet();
if (current > maxConnections) {
maxConnections = current;
}
return c;
} catch (SQLException e) {
throw new DataAccessResourceFailureException(
"RDBMServices sql error trying to get connection to " + dbName, e);
}
} } | public class class_name {
@Deprecated
public static Connection getConnection(String dbName) {
final DataSource dataSource = getDataSource(dbName);
try {
final long start = System.currentTimeMillis();
final Connection c = dataSource.getConnection();
lastDatabase = databaseTimes.add(System.currentTimeMillis() - start); // metric // depends on control dependency: [try], data = [none]
final int current = activeConnections.incrementAndGet();
if (current > maxConnections) {
maxConnections = current; // depends on control dependency: [if], data = [none]
}
return c; // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new DataAccessResourceFailureException(
"RDBMServices sql error trying to get connection to " + dbName, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void actionPerformed(ActionEvent ev) {
String s = ev.getActionCommand();
// System.out.println("Action performed " + s);
if (s.equals("ConnectOk")) {
finishCreate();
} else if (s.equals("ConnectCancel")) {
dispose();
}
} } | public class class_name {
public void actionPerformed(ActionEvent ev) {
String s = ev.getActionCommand();
// System.out.println("Action performed " + s);
if (s.equals("ConnectOk")) {
finishCreate(); // depends on control dependency: [if], data = [none]
} else if (s.equals("ConnectCancel")) {
dispose(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T castObject(final Object castObject,
final Class<T> fieldType) {
if(fieldType == null)
return null;
final boolean isTypeString = fieldType.equals(String.class);
if(castObject == null) {
return (isTypeString)
? ((T) "null")
: null;
}
final Class<?> castType = castObject.getClass();
final boolean isTypeAssignable = fieldType.isAssignableFrom(castType);
final boolean isTypeEquals = areEquals(castType, fieldType);
final boolean isTypeObject = fieldType.equals(Object.class);
return castObject(castObject, fieldType,
isTypeAssignable, isTypeEquals,
isTypeObject, isTypeString);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T castObject(final Object castObject,
final Class<T> fieldType) {
if(fieldType == null)
return null;
final boolean isTypeString = fieldType.equals(String.class);
if(castObject == null) {
return (isTypeString)
? ((T) "null")
: null; // depends on control dependency: [if], data = [none]
}
final Class<?> castType = castObject.getClass();
final boolean isTypeAssignable = fieldType.isAssignableFrom(castType);
final boolean isTypeEquals = areEquals(castType, fieldType);
final boolean isTypeObject = fieldType.equals(Object.class);
return castObject(castObject, fieldType,
isTypeAssignable, isTypeEquals,
isTypeObject, isTypeString);
} } |
public class class_name {
public void setFromString(String sectionNumber, int level) {
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast();
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i]));
}
} } | public class class_name {
public void setFromString(String sectionNumber, int level) {
assert level >= 1;
final String[] numbers = sectionNumber.split("[^0-9]+"); //$NON-NLS-1$
final int len = Math.max(0, this.numbers.size() - numbers.length);
for (int i = 0; i < len; ++i) {
this.numbers.removeLast(); // depends on control dependency: [for], data = [none]
}
for (int i = 0; i < numbers.length && i < level; ++i) {
this.numbers.addLast(Integer.valueOf(numbers[i])); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private boolean goToNextStartPosition() throws IOException {
int basicStartPosition;
int basicEndPosition;
if (docId == -1 || docId == NO_MORE_DOCS) {
throw new IOException("no document");
} else {
while ((basicStartPosition = subSpans
.nextStartPosition()) != NO_MORE_POSITIONS) {
basicEndPosition = subSpans.endPosition();
startPosition = Math.max(minPosition,
(basicStartPosition - query.maximumLeft));
endPosition = Math.min(maxPosition + 1,
(basicEndPosition + query.maximumRight));
if (startPosition <= (basicStartPosition - query.minimumLeft)
&& endPosition >= (basicEndPosition + query.minimumRight)) {
return true;
}
}
return false;
}
} } | public class class_name {
private boolean goToNextStartPosition() throws IOException {
int basicStartPosition;
int basicEndPosition;
if (docId == -1 || docId == NO_MORE_DOCS) {
throw new IOException("no document");
} else {
while ((basicStartPosition = subSpans
.nextStartPosition()) != NO_MORE_POSITIONS) {
basicEndPosition = subSpans.endPosition(); // depends on control dependency: [while], data = [none]
startPosition = Math.max(minPosition,
(basicStartPosition - query.maximumLeft)); // depends on control dependency: [while], data = [none]
endPosition = Math.min(maxPosition + 1,
(basicEndPosition + query.maximumRight)); // depends on control dependency: [while], data = [none]
if (startPosition <= (basicStartPosition - query.minimumLeft)
&& endPosition >= (basicEndPosition + query.minimumRight)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
}
} } |
public class class_name {
public void endActivity(HttpClientNIORequestActivityImpl activity) {
final HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId());
if (activities.containsKey(ah)) {
resourceAdaptorContext.getSleeEndpoint().endActivity(ah);
}
} } | public class class_name {
public void endActivity(HttpClientNIORequestActivityImpl activity) {
final HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId());
if (activities.containsKey(ah)) {
resourceAdaptorContext.getSleeEndpoint().endActivity(ah);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@POST
@Path("revoke")
@Consumes(MediaType.APPLICATION_JSON)
public Response revoke(RevocationRequest revocationRequest) {
// Perform all validation here to control the exact error message returned to comply with the Oauth2 standard
String token = revocationRequest.getToken();
String tokenHint = revocationRequest.getToken_type_hint();
if (null != token) {
// Start with the token type hint but always widen the scope if not found
if (null == tokenHint || "access_token".equals(tokenHint)) {
if (!revokeAccessToken(token)) {
revokeRefreshToken(token);
}
} else {
if (!revokeRefreshToken(token)) {
revokeAccessToken(token);
}
}
}
// Always send http 200 according to the specification
return Response.ok().build();
} } | public class class_name {
@POST
@Path("revoke")
@Consumes(MediaType.APPLICATION_JSON)
public Response revoke(RevocationRequest revocationRequest) {
// Perform all validation here to control the exact error message returned to comply with the Oauth2 standard
String token = revocationRequest.getToken();
String tokenHint = revocationRequest.getToken_type_hint();
if (null != token) {
// Start with the token type hint but always widen the scope if not found
if (null == tokenHint || "access_token".equals(tokenHint)) {
if (!revokeAccessToken(token)) {
revokeRefreshToken(token); // depends on control dependency: [if], data = [none]
}
} else {
if (!revokeRefreshToken(token)) {
revokeAccessToken(token); // depends on control dependency: [if], data = [none]
}
}
}
// Always send http 200 according to the specification
return Response.ok().build();
} } |
public class class_name {
@Override
public Element execute(Context context) {
try {
Element[] args = calculateArgs(context);
Property a = (Property) args[0];
Property b = (Property) args[1];
return execute(sourceRange, a, b);
} catch (ClassCastException cce) {
throw new EvaluationException(MessageUtils
.format(MSG_INVALID_ARGS_ADD), sourceRange);
}
} } | public class class_name {
@Override
public Element execute(Context context) {
try {
Element[] args = calculateArgs(context);
Property a = (Property) args[0];
Property b = (Property) args[1];
return execute(sourceRange, a, b); // depends on control dependency: [try], data = [none]
} catch (ClassCastException cce) {
throw new EvaluationException(MessageUtils
.format(MSG_INVALID_ARGS_ADD), sourceRange);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getXmlEditorIncludes() throws JspException {
StringBuffer result = new StringBuffer(1024);
// first include general JQuery JS and UI components
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/packed/jquery.js");
result.append("\"></script>\n");
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/packed/jquery.ui.js");
result.append("\"></script>\n");
// including dialog-helper.js to be used by ADE gallery widgets
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("components/widgets/dialog-helper.js");
result.append("\"></script>\n");
// import the JavaScript for JSON helper functions
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("commons/json2.js");
result.append("\"></script>\n");
result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/css/ui-ocms/jquery.ui.css");
result.append("\">\n");
result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/css/ui-ocms/jquery.ui.ocms.css");
result.append("\">\n");
try {
// iterate over unique widgets from collector
Iterator<I_CmsWidget> i = getWidgetCollector().getUniqueWidgets().iterator();
while (i.hasNext()) {
I_CmsWidget widget = i.next();
result.append(widget.getDialogIncludes(getCms(), this));
result.append("\n");
}
} catch (Exception e) {
showErrorPage(e);
}
return result.toString();
} } | public class class_name {
public String getXmlEditorIncludes() throws JspException {
StringBuffer result = new StringBuffer(1024);
// first include general JQuery JS and UI components
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/packed/jquery.js");
result.append("\"></script>\n");
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/packed/jquery.ui.js");
result.append("\"></script>\n");
// including dialog-helper.js to be used by ADE gallery widgets
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("components/widgets/dialog-helper.js");
result.append("\"></script>\n");
// import the JavaScript for JSON helper functions
result.append("<script type=\"text/javascript\" src=\"");
result.append(CmsWorkplace.getSkinUri()).append("commons/json2.js");
result.append("\"></script>\n");
result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/css/ui-ocms/jquery.ui.css");
result.append("\">\n");
result.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"");
result.append(CmsWorkplace.getSkinUri()).append("jquery/css/ui-ocms/jquery.ui.ocms.css");
result.append("\">\n");
try {
// iterate over unique widgets from collector
Iterator<I_CmsWidget> i = getWidgetCollector().getUniqueWidgets().iterator();
while (i.hasNext()) {
I_CmsWidget widget = i.next();
result.append(widget.getDialogIncludes(getCms(), this)); // depends on control dependency: [while], data = [none]
result.append("\n"); // depends on control dependency: [while], data = [none]
}
} catch (Exception e) {
showErrorPage(e);
}
return result.toString();
} } |
public class class_name {
public void fill(byte value)
{
int offset = 0;
int length = size;
long longValue = Longs.fromBytes(value, value, value, value, value, value, value, value);
while (length >= SizeOf.SIZE_OF_LONG) {
unsafe.putLong(base, address + offset, longValue);
offset += SizeOf.SIZE_OF_LONG;
length -= SizeOf.SIZE_OF_LONG;
}
while (length > 0) {
unsafe.putByte(base, address + offset, value);
offset++;
length--;
}
} } | public class class_name {
public void fill(byte value)
{
int offset = 0;
int length = size;
long longValue = Longs.fromBytes(value, value, value, value, value, value, value, value);
while (length >= SizeOf.SIZE_OF_LONG) {
unsafe.putLong(base, address + offset, longValue); // depends on control dependency: [while], data = [none]
offset += SizeOf.SIZE_OF_LONG; // depends on control dependency: [while], data = [none]
length -= SizeOf.SIZE_OF_LONG; // depends on control dependency: [while], data = [none]
}
while (length > 0) {
unsafe.putByte(base, address + offset, value); // depends on control dependency: [while], data = [none]
offset++; // depends on control dependency: [while], data = [none]
length--; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void marshall(ListProjectsRequest listProjectsRequest, ProtocolMarshaller protocolMarshaller) {
if (listProjectsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listProjectsRequest.getSortBy(), SORTBY_BINDING);
protocolMarshaller.marshall(listProjectsRequest.getSortOrder(), SORTORDER_BINDING);
protocolMarshaller.marshall(listProjectsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListProjectsRequest listProjectsRequest, ProtocolMarshaller protocolMarshaller) {
if (listProjectsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listProjectsRequest.getSortBy(), SORTBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listProjectsRequest.getSortOrder(), SORTORDER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listProjectsRequest.getNextToken(), NEXTTOKEN_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 SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
HttpServletRequest request = requestResponseHolder.getRequest();
HttpServletResponse response = requestResponseHolder.getResponse();
HttpSession httpSession = request.getSession(false);
SecurityContext context = readSecurityContextFromSession(httpSession);
if (context == null) {
if (logger.isDebugEnabled()) {
logger.debug("No SecurityContext was available from the HttpSession: "
+ httpSession + ". " + "A new one will be created.");
}
context = generateNewContext();
}
SaveToSessionResponseWrapper wrappedResponse = new SaveToSessionResponseWrapper(
response, request, httpSession != null, context);
requestResponseHolder.setResponse(wrappedResponse);
requestResponseHolder.setRequest(new SaveToSessionRequestWrapper(
request, wrappedResponse));
return context;
} } | public class class_name {
public SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder) {
HttpServletRequest request = requestResponseHolder.getRequest();
HttpServletResponse response = requestResponseHolder.getResponse();
HttpSession httpSession = request.getSession(false);
SecurityContext context = readSecurityContextFromSession(httpSession);
if (context == null) {
if (logger.isDebugEnabled()) {
logger.debug("No SecurityContext was available from the HttpSession: "
+ httpSession + ". " + "A new one will be created.");
}
context = generateNewContext(); // depends on control dependency: [if], data = [none]
}
SaveToSessionResponseWrapper wrappedResponse = new SaveToSessionResponseWrapper(
response, request, httpSession != null, context);
requestResponseHolder.setResponse(wrappedResponse); // depends on control dependency: [if], data = [none]
requestResponseHolder.setRequest(new SaveToSessionRequestWrapper(
request, wrappedResponse)); // depends on control dependency: [if], data = [none]
return context; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public JsiiObjectRef nativeToObjRef(final Object nativeObject) {
if (nativeObject instanceof JsiiObject) {
return ((JsiiObject) nativeObject).getObjRef();
}
for (String objid : this.objects.keySet()) {
Object obj = this.objects.get(objid);
if (obj == nativeObject) {
return JsiiObjectRef.fromObjId(objid);
}
}
// we don't know of an jsii object that represents this object, so we will need to create it.
return createNewObject(nativeObject);
} } | public class class_name {
public JsiiObjectRef nativeToObjRef(final Object nativeObject) {
if (nativeObject instanceof JsiiObject) {
return ((JsiiObject) nativeObject).getObjRef(); // depends on control dependency: [if], data = [none]
}
for (String objid : this.objects.keySet()) {
Object obj = this.objects.get(objid);
if (obj == nativeObject) {
return JsiiObjectRef.fromObjId(objid); // depends on control dependency: [if], data = [(obj]
}
}
// we don't know of an jsii object that represents this object, so we will need to create it.
return createNewObject(nativeObject);
} } |
public class class_name {
public static List<Field> getAllFields(Class<?> type) {
List<Field> fields = new ArrayList<>();
for (Class<?> currentType = type; currentType != null; currentType = currentType.getSuperclass()) {
fields.addAll(Arrays.asList(currentType.getDeclaredFields()));
}
return fields;
} } | public class class_name {
public static List<Field> getAllFields(Class<?> type) {
List<Field> fields = new ArrayList<>();
for (Class<?> currentType = type; currentType != null; currentType = currentType.getSuperclass()) {
fields.addAll(Arrays.asList(currentType.getDeclaredFields())); // depends on control dependency: [for], data = [currentType]
}
return fields;
} } |
public class class_name {
String[] parseArgs(String[] args) {
int i = 0;
boolean driverArgs = true;
while (driverArgs) {
if (i >= args.length) {
break;
}
String s = args[i];
if (s.equals("-h") ||
s.equals("help") ||
s.equals("-help") ||
s.equals("--help")) {
usage();
}
else if (s.equals("-n") ||
s.equals("-nodes")) {
i++; if (i >= args.length) { usage(); }
numNodes = Integer.parseInt(args[i]);
}
else if (s.equals("-o") ||
s.equals("-output")) {
i++; if (i >= args.length) { usage(); }
outputPath = args[i];
}
else if (s.equals("-jobname")) {
i++; if (i >= args.length) { usage(); }
jobtrackerName = args[i];
}
else if (s.equals("-mapperXmx")) {
i++; if (i >= args.length) { usage(); }
mapperXmx = args[i];
}
else if (s.equals("-extramempercent")) {
i++; if (i >= args.length) { usage(); }
extraMemPercent = Integer.parseInt(args[i]);
}
else if (s.equals("-mapperPermSize")) {
i++; if (i >= args.length) { usage(); }
mapperPermSize = args[i];
}
else if (s.equals("-driverif")) {
i++; if (i >= args.length) { usage(); }
driverCallbackIp = args[i];
}
else if (s.equals("-driverport")) {
i++; if (i >= args.length) { usage(); }
driverCallbackPort = Integer.parseInt(args[i]);
}
else if (s.equals("-driverportrange")) {
i++; if (i >= args.length) { usage(); }
driverCallbackPortRange = PortRange.parse(args[i]);
}
else if (s.equals("-network")) {
i++; if (i >= args.length) { usage(); }
network = args[i];
}
else if (s.equals("-timeout")) {
i++; if (i >= args.length) { usage(); }
cloudFormationTimeoutSeconds = Integer.parseInt(args[i]);
}
else if (s.equals("-disown")) {
disown = true;
}
else if (s.equals("-notify")) {
i++; if (i >= args.length) { usage(); }
clusterReadyFileName = args[i];
}
else if (s.equals("-nthreads")) {
i++; if (i >= args.length) { usage(); }
nthreads = Integer.parseInt(args[i]);
}
else if (s.equals("-context_path")) {
i++; if (i >= args.length) { usage(); }
contextPath = args[i];
}
else if (s.equals("-baseport")) {
i++; if (i >= args.length) { usage(); }
basePort = Integer.parseInt(args[i]);
if ((basePort < 0) || (basePort > 65535)) {
error("Base port must be between 1 and 65535");
}
}
else if (s.equals("-port_offset")) {
i++; if (i >= args.length) { usage(); }
portOffset = Integer.parseInt(args[i]);
if ((portOffset <= 0) || (portOffset > 65534)) {
error("Port offset must be between 1 and 65534");
}
}
else if (s.equals("-beta")) {
beta = true;
}
else if (s.equals("-random_udp_drop")) {
enableRandomUdpDrop = true;
}
else if (s.equals("-ea")) {
enableExceptions = true;
}
else if (s.equals("-verbose:gc") && !JAVA_VERSION.useUnifiedLogging()) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enableVerboseGC = true;
} else {
error("Parameter -verbose:gc is unusable, running on JVM with deprecated GC debugging flags.");
}
} else if (s.equals("-Xlog:gc=info")) {
if (JAVA_VERSION.useUnifiedLogging()) {
enableVerboseGC = true;
} else {
error("Parameter -verbose:gc is unusable, running on JVM without unified JVM logging.");
}
}
else if (s.equals("-verbose:class")) {
enableVerboseClass = true;
}
else if (s.equals("-XX:+PrintCompilation")) {
enablePrintCompilation = true;
}
else if (s.equals("-exclude")) {
enableExcludeMethods = true;
}
else if (s.equals("-Dlog4j.defaultInitOverride=true")) {
enableLog4jDefaultInitOverride = true;
}
else if (s.equals("-debug")) {
enableDebug = true;
}
else if (s.equals("-suspend")) {
enableSuspend = true;
}
else if (s.equals("-debugport")) {
i++; if (i >= args.length) { usage(); }
debugPort = Integer.parseInt(args[i]);
if ((debugPort < 0) || (debugPort > 65535)) {
error("Debug port must be between 1 and 65535");
}
} else if (s.equals("-XX:+PrintGCDetails")) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enablePrintGCDetails = true;
} else {
error("Parameter -XX:+PrintGCDetails is unusable, running on JVM with deprecated GC debugging flags.");
}
}
else if (s.equals("-XX:+PrintGCTimeStamps")) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enablePrintGCDetails = true;
} else {
error("Parameter -XX:+PrintGCTimeStamps is unusable, running on JVM with deprecated GC debugging flags.");
}
}
else if (s.equals("-gc")) {
enableVerboseGC = true;
enablePrintGCDetails = true;
enablePrintGCTimeStamps = true;
}
else if (s.equals("-nogc")) {
enableVerboseGC = false;
enablePrintGCDetails = false;
enablePrintGCTimeStamps = false;
}
else if (s.equals("-flow_dir")) {
i++; if (i >= args.length) { usage(); }
flowDir = args[i];
}
else if (s.equals("-J")) {
i++; if (i >= args.length) { usage(); }
extraArguments.add(args[i]);
}
else if (s.equals("-JJ")) {
i++; if (i >= args.length) { usage(); }
extraJvmArguments.add(args[i]);
}
else if (s.equals("-jks")) {
i++; if (i >= args.length) { usage(); }
jksFileName = args[i];
}
else if (s.equals("-jks_pass")) {
i++; if (i >= args.length) { usage(); }
jksPass = args[i];
}
else if (s.equals("-internal_secure_connections")) {
internal_secure_connections = true;
}
else if (s.equals("-internal_security_conf") || s.equals("-internal_security")) {
if(s.equals("-internal_security")){
System.out.println("The '-internal_security' configuration is deprecated. " +
"Please use '-internal_security_conf' instead.");
}
i++; if (i >= args.length) { usage(); }
securityConf = args[i];
}
else if (s.equals("-hash_login")) {
hashLogin = true;
}
else if (s.equals("-ldap_login")) {
ldapLogin = true;
}
else if (s.equals("-kerberos_login")) {
kerberosLogin = true;
}
else if (s.equals("-pam_login")) {
pamLogin = true;
}
else if (s.equals("-login_conf")) {
i++; if (i >= args.length) { usage(); }
loginConfFileName = args[i];
}
else if (s.equals("-form_auth")) {
formAuth = true;
}
else if (s.equals("-session_timeout")) {
i++; if (i >= args.length) { usage(); }
sessionTimeout = args[i];
}
else if (s.equals("-user_name")) {
i++; if (i >= args.length) { usage(); }
userName = args[i];
}
else if (s.equals("-client")) {
client = true;
driverArgs = false;
}
else if (s.equals("-proxy")) {
proxy = true;
driverArgs = false;
} else if (s.equals("-run_as_user")) {
i++; if (i >= args.length) { usage(); }
runAsUser = args[i];
} else if (s.equals("-principal")) {
i++; if (i >= args.length) { usage(); }
principal = args[i];
} else if (s.equals("-keytab")) {
i++; if (i >= args.length) { usage (); }
keytabPath = args[i];
} else if (s.equals("-report_hostname")) {
reportHostname = true;
} else if (s.equals("-driver_debug")) {
driverDebug = true;
} else if (s.equals("-hiveHost")) {
i++; if (i >= args.length) { usage (); }
hiveHost = args[i];
} else if (s.equals("-hivePrincipal")) {
i++; if (i >= args.length) { usage (); }
hivePrincipal = args[i];
} else if (s.equals("-refreshTokens")) {
refreshTokens = true;
} else {
error("Unrecognized option " + s);
}
i++;
}
String[] otherArgs = new String[Math.max(args.length - i, 0)];
for (int j = 0; j < otherArgs.length; j++)
otherArgs[j] = args[i++];
return otherArgs;
} } | public class class_name {
String[] parseArgs(String[] args) {
int i = 0;
boolean driverArgs = true;
while (driverArgs) {
if (i >= args.length) {
break;
}
String s = args[i];
if (s.equals("-h") ||
s.equals("help") ||
s.equals("-help") ||
s.equals("--help")) {
usage(); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-n") ||
s.equals("-nodes")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
numNodes = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-o") ||
s.equals("-output")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
outputPath = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-jobname")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
jobtrackerName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-mapperXmx")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
mapperXmx = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-extramempercent")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
extraMemPercent = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-mapperPermSize")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
mapperPermSize = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-driverif")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
driverCallbackIp = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-driverport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
driverCallbackPort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-driverportrange")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
driverCallbackPortRange = PortRange.parse(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-network")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
network = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-timeout")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
cloudFormationTimeoutSeconds = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-disown")) {
disown = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-notify")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
clusterReadyFileName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-nthreads")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
nthreads = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-context_path")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
contextPath = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-baseport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
basePort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
if ((basePort < 0) || (basePort > 65535)) {
error("Base port must be between 1 and 65535"); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-port_offset")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
portOffset = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
if ((portOffset <= 0) || (portOffset > 65534)) {
error("Port offset must be between 1 and 65534"); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-beta")) {
beta = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-random_udp_drop")) {
enableRandomUdpDrop = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-ea")) {
enableExceptions = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-verbose:gc") && !JAVA_VERSION.useUnifiedLogging()) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enableVerboseGC = true; // depends on control dependency: [if], data = [none]
} else {
error("Parameter -verbose:gc is unusable, running on JVM with deprecated GC debugging flags."); // depends on control dependency: [if], data = [none]
}
} else if (s.equals("-Xlog:gc=info")) {
if (JAVA_VERSION.useUnifiedLogging()) {
enableVerboseGC = true; // depends on control dependency: [if], data = [none]
} else {
error("Parameter -verbose:gc is unusable, running on JVM without unified JVM logging."); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-verbose:class")) {
enableVerboseClass = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-XX:+PrintCompilation")) {
enablePrintCompilation = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-exclude")) {
enableExcludeMethods = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-Dlog4j.defaultInitOverride=true")) {
enableLog4jDefaultInitOverride = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-debug")) {
enableDebug = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-suspend")) {
enableSuspend = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-debugport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
debugPort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
if ((debugPort < 0) || (debugPort > 65535)) {
error("Debug port must be between 1 and 65535"); // depends on control dependency: [if], data = [none]
}
} else if (s.equals("-XX:+PrintGCDetails")) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enablePrintGCDetails = true; // depends on control dependency: [if], data = [none]
} else {
error("Parameter -XX:+PrintGCDetails is unusable, running on JVM with deprecated GC debugging flags."); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-XX:+PrintGCTimeStamps")) {
if (!JAVA_VERSION.useUnifiedLogging()) {
enablePrintGCDetails = true; // depends on control dependency: [if], data = [none]
} else {
error("Parameter -XX:+PrintGCTimeStamps is unusable, running on JVM with deprecated GC debugging flags."); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-gc")) {
enableVerboseGC = true; // depends on control dependency: [if], data = [none]
enablePrintGCDetails = true; // depends on control dependency: [if], data = [none]
enablePrintGCTimeStamps = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-nogc")) {
enableVerboseGC = false; // depends on control dependency: [if], data = [none]
enablePrintGCDetails = false; // depends on control dependency: [if], data = [none]
enablePrintGCTimeStamps = false; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-flow_dir")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
flowDir = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-J")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
extraArguments.add(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-JJ")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
extraJvmArguments.add(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-jks")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
jksFileName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-jks_pass")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
jksPass = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-internal_secure_connections")) {
internal_secure_connections = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-internal_security_conf") || s.equals("-internal_security")) {
if(s.equals("-internal_security")){
System.out.println("The '-internal_security' configuration is deprecated. " +
"Please use '-internal_security_conf' instead."); // depends on control dependency: [if], data = [none]
}
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
securityConf = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-hash_login")) {
hashLogin = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-ldap_login")) {
ldapLogin = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-kerberos_login")) {
kerberosLogin = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-pam_login")) {
pamLogin = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-login_conf")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
loginConfFileName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-form_auth")) {
formAuth = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-session_timeout")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
sessionTimeout = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-user_name")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
userName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-client")) {
client = true; // depends on control dependency: [if], data = [none]
driverArgs = false; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-proxy")) {
proxy = true; // depends on control dependency: [if], data = [none]
driverArgs = false; // depends on control dependency: [if], data = [none]
} else if (s.equals("-run_as_user")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
runAsUser = args[i]; // depends on control dependency: [if], data = [none]
} else if (s.equals("-principal")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
principal = args[i]; // depends on control dependency: [if], data = [none]
} else if (s.equals("-keytab")) {
i++; if (i >= args.length) { usage (); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
keytabPath = args[i]; // depends on control dependency: [if], data = [none]
} else if (s.equals("-report_hostname")) {
reportHostname = true; // depends on control dependency: [if], data = [none]
} else if (s.equals("-driver_debug")) {
driverDebug = true; // depends on control dependency: [if], data = [none]
} else if (s.equals("-hiveHost")) {
i++; if (i >= args.length) { usage (); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
hiveHost = args[i]; // depends on control dependency: [if], data = [none]
} else if (s.equals("-hivePrincipal")) {
i++; if (i >= args.length) { usage (); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
hivePrincipal = args[i]; // depends on control dependency: [if], data = [none]
} else if (s.equals("-refreshTokens")) {
refreshTokens = true; // depends on control dependency: [if], data = [none]
} else {
error("Unrecognized option " + s); // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [while], data = [none]
}
String[] otherArgs = new String[Math.max(args.length - i, 0)];
for (int j = 0; j < otherArgs.length; j++)
otherArgs[j] = args[i++];
return otherArgs;
} } |
public class class_name {
private void sendHttpRequest(final Request request, final org.boon.core.Handler<Response> responseHandler) {
final HttpClientRequest httpClientRequest = httpClient.request(request.getMethod(), request.uri(),
handleResponse(request, responseHandler));
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (!request.getMethod().equals("GET")) {
httpClientRequest.putHeader("Content-Type", "application/x-www-form-urlencoded").end(request.paramBody());
} else {
httpClientRequest.end();
}
}
};
if (closed.get()) {
this.scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() {
connect();
int retry = 0;
while (closed.get()) {
Sys.sleep(1000);
if (!closed.get()) {
break;
}
retry++;
if (retry>10) {
break;
}
if ( retry % 3 == 0 ) {
connect();
}
}
if (!closed.get()) {
runnable.run();
} else {
responseHandler.handle(new Response("TIMEOUT", -1, new Error(-1, "Timeout", "Timeout", -1L)));
}
}
}, 10, TimeUnit.MILLISECONDS);
} else {
runnable.run();
}
} } | public class class_name {
private void sendHttpRequest(final Request request, final org.boon.core.Handler<Response> responseHandler) {
final HttpClientRequest httpClientRequest = httpClient.request(request.getMethod(), request.uri(),
handleResponse(request, responseHandler));
final Runnable runnable = new Runnable() {
@Override
public void run() {
if (!request.getMethod().equals("GET")) {
httpClientRequest.putHeader("Content-Type", "application/x-www-form-urlencoded").end(request.paramBody()); // depends on control dependency: [if], data = [none]
} else {
httpClientRequest.end(); // depends on control dependency: [if], data = [none]
}
}
};
if (closed.get()) {
this.scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() {
connect();
int retry = 0;
while (closed.get()) {
Sys.sleep(1000); // depends on control dependency: [while], data = [none]
if (!closed.get()) {
break;
}
retry++; // depends on control dependency: [while], data = [none]
if (retry>10) {
break;
}
if ( retry % 3 == 0 ) {
connect(); // depends on control dependency: [if], data = [none]
}
}
if (!closed.get()) {
runnable.run(); // depends on control dependency: [if], data = [none]
} else {
responseHandler.handle(new Response("TIMEOUT", -1, new Error(-1, "Timeout", "Timeout", -1L))); // depends on control dependency: [if], data = [none]
}
}
}, 10, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
} else {
runnable.run(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<RowProcessingConsumer> getOptimizedConsumers() {
List<RowProcessingConsumer> result = new ArrayList<RowProcessingConsumer>(_consumers);
for (FilterConsumer filterConsumer : _optimizedFilters.keySet()) {
if (filterConsumer.isRemoveableUponOptimization()) {
result.remove(filterConsumer);
}
}
return result;
} } | public class class_name {
public List<RowProcessingConsumer> getOptimizedConsumers() {
List<RowProcessingConsumer> result = new ArrayList<RowProcessingConsumer>(_consumers);
for (FilterConsumer filterConsumer : _optimizedFilters.keySet()) {
if (filterConsumer.isRemoveableUponOptimization()) {
result.remove(filterConsumer); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public long saveTrigger(SPFTrigger trigger, String appPackageName) {
trigger = mTriggerTable.saveTrigger(trigger, appPackageName);
if (trigger != null) {
if (mHandler != null)
mHandler.postAddTrigger(trigger);
return trigger.getId();
} else {
return -1;
}
} } | public class class_name {
public long saveTrigger(SPFTrigger trigger, String appPackageName) {
trigger = mTriggerTable.saveTrigger(trigger, appPackageName);
if (trigger != null) {
if (mHandler != null)
mHandler.postAddTrigger(trigger);
return trigger.getId(); // depends on control dependency: [if], data = [none]
} else {
return -1; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void removeChildrenFrom(final Element element) {
if (element != null) {
while (element.getFirstChild() != null) {
element.removeChild(element.getFirstChild());
}
}
} } | public class class_name {
public static void removeChildrenFrom(final Element element) {
if (element != null) {
while (element.getFirstChild() != null) {
element.removeChild(element.getFirstChild()); // depends on control dependency: [while], data = [(element.getFirstChild()]
}
}
} } |
public class class_name {
public double setValue(int idx, double val) {
int vSize = MVecArray.count(varBeliefs);
if (idx < vSize) {
return MVecArray.setValue(idx, val, varBeliefs);
} else {
return MVecArray.setValue(idx - vSize, val, facBeliefs);
}
} } | public class class_name {
public double setValue(int idx, double val) {
int vSize = MVecArray.count(varBeliefs);
if (idx < vSize) {
return MVecArray.setValue(idx, val, varBeliefs); // depends on control dependency: [if], data = [(idx]
} else {
return MVecArray.setValue(idx - vSize, val, facBeliefs); // depends on control dependency: [if], data = [(idx]
}
} } |
public class class_name {
public List getAllCookieValues(String cookieName){
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse();
}
List cookieValues = _request.getAllCookieValues(cookieName);
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getAllCookieValues", " name --> " + cookieName + " values --> " + cookieValues);
}
return cookieValues;
} } | public class class_name {
public List getAllCookieValues(String cookieName){
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse(); // depends on control dependency: [if], data = [none]
}
List cookieValues = _request.getAllCookieValues(cookieName);
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getAllCookieValues", " name --> " + cookieName + " values --> " + cookieValues); // depends on control dependency: [if], data = [none]
}
return cookieValues;
} } |
public class class_name {
<TInput, TOutput> void launchTasklet(final Tasklet<TInput, TOutput> tasklet) {
assert !runningTasklets.containsKey(tasklet.getId());
runningTasklets.put(tasklet.getId(), tasklet);
if (tasklet.getAggregateFunctionId().isPresent()) {
// function is aggregateable.
final TaskletAggregateExecutionRequest<TInput> taskletAggregateExecutionRequest =
new TaskletAggregateExecutionRequest<>(tasklet.getId(), tasklet.getAggregateFunctionId().get(),
tasklet.getInput());
vortexRequestor.sendAsync(reefTask, taskletAggregateExecutionRequest);
} else {
// function is not aggregateable.
final TaskletExecutionRequest<TInput, TOutput> taskletExecutionRequest
= new TaskletExecutionRequest<>(tasklet.getId(), tasklet.getUserFunction(), tasklet.getInput());
vortexRequestor.sendAsync(reefTask, taskletExecutionRequest);
}
} } | public class class_name {
<TInput, TOutput> void launchTasklet(final Tasklet<TInput, TOutput> tasklet) {
assert !runningTasklets.containsKey(tasklet.getId());
runningTasklets.put(tasklet.getId(), tasklet);
if (tasklet.getAggregateFunctionId().isPresent()) {
// function is aggregateable.
final TaskletAggregateExecutionRequest<TInput> taskletAggregateExecutionRequest =
new TaskletAggregateExecutionRequest<>(tasklet.getId(), tasklet.getAggregateFunctionId().get(),
tasklet.getInput());
vortexRequestor.sendAsync(reefTask, taskletAggregateExecutionRequest); // depends on control dependency: [if], data = [none]
} else {
// function is not aggregateable.
final TaskletExecutionRequest<TInput, TOutput> taskletExecutionRequest
= new TaskletExecutionRequest<>(tasklet.getId(), tasklet.getUserFunction(), tasklet.getInput());
vortexRequestor.sendAsync(reefTask, taskletExecutionRequest); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public SwingTerminalFrame setAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) {
this.autoCloseTriggers.clear();
if(autoCloseTrigger != null) {
this.autoCloseTriggers.add(autoCloseTrigger);
}
return this;
} } | public class class_name {
public SwingTerminalFrame setAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) {
this.autoCloseTriggers.clear();
if(autoCloseTrigger != null) {
this.autoCloseTriggers.add(autoCloseTrigger); // depends on control dependency: [if], data = [(autoCloseTrigger]
}
return this;
} } |
public class class_name {
protected void setRequestHeaders(final URLConnection connection, final SyndFeedInfo syndFeedInfo, final String userAgent) {
if (syndFeedInfo != null) {
// set the headers to get feed only if modified
// we support the use of both last modified and eTag headers
if (syndFeedInfo.getLastModified() != null) {
final Object lastModified = syndFeedInfo.getLastModified();
if (lastModified instanceof Long) {
connection.setIfModifiedSince((Long) syndFeedInfo.getLastModified());
}
}
if (syndFeedInfo.getETag() != null) {
connection.setRequestProperty("If-None-Match", syndFeedInfo.getETag());
}
}
// header to retrieve feed gzipped
connection.setRequestProperty("Accept-Encoding", "gzip");
connection.addRequestProperty("User-Agent", userAgent);
if (isUsingDeltaEncoding()) {
connection.addRequestProperty("A-IM", "feed");
}
} } | public class class_name {
protected void setRequestHeaders(final URLConnection connection, final SyndFeedInfo syndFeedInfo, final String userAgent) {
if (syndFeedInfo != null) {
// set the headers to get feed only if modified
// we support the use of both last modified and eTag headers
if (syndFeedInfo.getLastModified() != null) {
final Object lastModified = syndFeedInfo.getLastModified();
if (lastModified instanceof Long) {
connection.setIfModifiedSince((Long) syndFeedInfo.getLastModified()); // depends on control dependency: [if], data = [none]
}
}
if (syndFeedInfo.getETag() != null) {
connection.setRequestProperty("If-None-Match", syndFeedInfo.getETag()); // depends on control dependency: [if], data = [none]
}
}
// header to retrieve feed gzipped
connection.setRequestProperty("Accept-Encoding", "gzip");
connection.addRequestProperty("User-Agent", userAgent);
if (isUsingDeltaEncoding()) {
connection.addRequestProperty("A-IM", "feed"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
int assignDeviceToCursor(final Cursor cursor)
{
int currentPriority = cursor.getCurrentDevicePriority();
IoDevice savedDevice = cursor.getSavedIoDevice();
/*
* Give preference to the saved device for this cursor
*/
if ((savedDevice != null) && (currentPriority < 0))
{
int priority = cursor.getDevicePriority(savedDevice);
cursor.clearSavedIoDevice();
return attachCursorToDevice(cursor, savedDevice, 1, priority);
}
List<IoDevice> availableDevices = getAvailableIoDevices();
for (IoDevice d : availableDevices)
{
IoDevice availableIoDevice = d;
int priority = cursor.getDevicePriority(availableIoDevice);
Log.d(TAG, "Trying to attach available ioDevice:" + IoDeviceFactory.getXmlString(availableIoDevice) + " to cursor:" + cursor.getId());
/*
* If the unused device is compatible with this cursor and
* has a higher priority than the current device associated
* with the cursor, use it instead of the current device.
* If there is no device for this cursor, use the first available.
*/
if (priority > 0)
{
if (currentPriority < 0)
{
return attachCursorToDevice(cursor, availableIoDevice, 1, priority);
}
else if (priority < currentPriority)
{
return attachCursorToDevice(cursor, availableIoDevice, 0, priority);
}
}
}
return -1;
} } | public class class_name {
int assignDeviceToCursor(final Cursor cursor)
{
int currentPriority = cursor.getCurrentDevicePriority();
IoDevice savedDevice = cursor.getSavedIoDevice();
/*
* Give preference to the saved device for this cursor
*/
if ((savedDevice != null) && (currentPriority < 0))
{
int priority = cursor.getDevicePriority(savedDevice);
cursor.clearSavedIoDevice(); // depends on control dependency: [if], data = [none]
return attachCursorToDevice(cursor, savedDevice, 1, priority); // depends on control dependency: [if], data = [none]
}
List<IoDevice> availableDevices = getAvailableIoDevices();
for (IoDevice d : availableDevices)
{
IoDevice availableIoDevice = d;
int priority = cursor.getDevicePriority(availableIoDevice);
Log.d(TAG, "Trying to attach available ioDevice:" + IoDeviceFactory.getXmlString(availableIoDevice) + " to cursor:" + cursor.getId()); // depends on control dependency: [for], data = [d]
/*
* If the unused device is compatible with this cursor and
* has a higher priority than the current device associated
* with the cursor, use it instead of the current device.
* If there is no device for this cursor, use the first available.
*/
if (priority > 0)
{
if (currentPriority < 0)
{
return attachCursorToDevice(cursor, availableIoDevice, 1, priority); // depends on control dependency: [if], data = [none]
}
else if (priority < currentPriority)
{
return attachCursorToDevice(cursor, availableIoDevice, 0, priority); // depends on control dependency: [if], data = [none]
}
}
}
return -1;
} } |
public class class_name {
public void processEvent(LogRecord record) {
byte[] bytes;
SerializationObject serializationObject = pool.getSerializationObject();
try {
bytes = serializationObject.serialize(record);
} finally {
pool.returnSerializationObject(serializationObject);
}
synchronized(this) {
if (traceWriter != null && record.getLevel().intValue() < traceThreshold) {
traceWriter.logRecord(record.getMillis(), bytes);
} else if (logWriter != null) {
logWriter.logRecord(record.getMillis(), bytes);
}
}
} } | public class class_name {
public void processEvent(LogRecord record) {
byte[] bytes;
SerializationObject serializationObject = pool.getSerializationObject();
try {
bytes = serializationObject.serialize(record); // depends on control dependency: [try], data = [none]
} finally {
pool.returnSerializationObject(serializationObject);
}
synchronized(this) {
if (traceWriter != null && record.getLevel().intValue() < traceThreshold) {
traceWriter.logRecord(record.getMillis(), bytes); // depends on control dependency: [if], data = [none]
} else if (logWriter != null) {
logWriter.logRecord(record.getMillis(), bytes); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static int parseType(
final String signature, final int startOffset, final SignatureVisitor signatureVisitor) {
int offset = startOffset; // Current offset in the parsed signature.
char currentChar = signature.charAt(offset++); // The signature character at 'offset'.
// Switch based on the first character of the JavaTypeSignature, which indicates its kind.
switch (currentChar) {
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
case 'F':
case 'J':
case 'D':
case 'V':
// Case of a BaseType or a VoidDescriptor.
signatureVisitor.visitBaseType(currentChar);
return offset;
case '[':
// Case of an ArrayTypeSignature, a '[' followed by a JavaTypeSignature.
return parseType(signature, offset, signatureVisitor.visitArrayType());
case 'T':
// Case of TypeVariableSignature, an identifier between 'T' and ';'.
int endOffset = signature.indexOf(';', offset);
signatureVisitor.visitTypeVariable(signature.substring(offset, endOffset));
return endOffset + 1;
case 'L':
// Case of a ClassTypeSignature, which ends with ';'.
// These signatures have a main class type followed by zero or more inner class types
// (separated by '.'). Each can have type arguments, inside '<' and '>'.
int start = offset; // The start offset of the currently parsed main or inner class name.
boolean visited = false; // Whether the currently parsed class name has been visited.
boolean inner = false; // Whether we are currently parsing an inner class type.
// Parses the signature, one character at a time.
while (true) {
currentChar = signature.charAt(offset++);
if (currentChar == '.' || currentChar == ';') {
// If a '.' or ';' is encountered, this means we have fully parsed the main class name
// or an inner class name. This name may already have been visited it is was followed by
// type arguments between '<' and '>'. If not, we need to visit it here.
if (!visited) {
String name = signature.substring(start, offset - 1);
if (inner) {
signatureVisitor.visitInnerClassType(name);
} else {
signatureVisitor.visitClassType(name);
}
}
// If we reached the end of the ClassTypeSignature return, otherwise start the parsing
// of a new class name, which is necessarily an inner class name.
if (currentChar == ';') {
signatureVisitor.visitEnd();
break;
}
start = offset;
visited = false;
inner = true;
} else if (currentChar == '<') {
// If a '<' is encountered, this means we have fully parsed the main class name or an
// inner class name, and that we now need to parse TypeArguments. First, we need to
// visit the parsed class name.
String name = signature.substring(start, offset - 1);
if (inner) {
signatureVisitor.visitInnerClassType(name);
} else {
signatureVisitor.visitClassType(name);
}
visited = true;
// Now, parse the TypeArgument(s), one at a time.
while ((currentChar = signature.charAt(offset)) != '>') {
switch (currentChar) {
case '*':
// Unbounded TypeArgument.
++offset;
signatureVisitor.visitTypeArgument();
break;
case '+':
case '-':
// Extends or Super TypeArgument. Use offset + 1 to skip the '+' or '-'.
offset =
parseType(
signature, offset + 1, signatureVisitor.visitTypeArgument(currentChar));
break;
default:
// Instanceof TypeArgument. The '=' is implicit.
offset = parseType(signature, offset, signatureVisitor.visitTypeArgument('='));
break;
}
}
}
}
return offset;
default:
throw new IllegalArgumentException();
}
} } | public class class_name {
private static int parseType(
final String signature, final int startOffset, final SignatureVisitor signatureVisitor) {
int offset = startOffset; // Current offset in the parsed signature.
char currentChar = signature.charAt(offset++); // The signature character at 'offset'.
// Switch based on the first character of the JavaTypeSignature, which indicates its kind.
switch (currentChar) {
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
case 'F':
case 'J':
case 'D':
case 'V':
// Case of a BaseType or a VoidDescriptor.
signatureVisitor.visitBaseType(currentChar);
return offset;
case '[':
// Case of an ArrayTypeSignature, a '[' followed by a JavaTypeSignature.
return parseType(signature, offset, signatureVisitor.visitArrayType());
case 'T':
// Case of TypeVariableSignature, an identifier between 'T' and ';'.
int endOffset = signature.indexOf(';', offset);
signatureVisitor.visitTypeVariable(signature.substring(offset, endOffset));
return endOffset + 1;
case 'L':
// Case of a ClassTypeSignature, which ends with ';'.
// These signatures have a main class type followed by zero or more inner class types
// (separated by '.'). Each can have type arguments, inside '<' and '>'.
int start = offset; // The start offset of the currently parsed main or inner class name.
boolean visited = false; // Whether the currently parsed class name has been visited.
boolean inner = false; // Whether we are currently parsing an inner class type.
// Parses the signature, one character at a time.
while (true) {
currentChar = signature.charAt(offset++); // depends on control dependency: [while], data = [none]
if (currentChar == '.' || currentChar == ';') {
// If a '.' or ';' is encountered, this means we have fully parsed the main class name
// or an inner class name. This name may already have been visited it is was followed by
// type arguments between '<' and '>'. If not, we need to visit it here.
if (!visited) {
String name = signature.substring(start, offset - 1);
if (inner) {
signatureVisitor.visitInnerClassType(name); // depends on control dependency: [if], data = [none]
} else {
signatureVisitor.visitClassType(name); // depends on control dependency: [if], data = [none]
}
}
// If we reached the end of the ClassTypeSignature return, otherwise start the parsing
// of a new class name, which is necessarily an inner class name.
if (currentChar == ';') {
signatureVisitor.visitEnd(); // depends on control dependency: [if], data = [none]
break;
}
start = offset; // depends on control dependency: [if], data = [none]
visited = false; // depends on control dependency: [if], data = [none]
inner = true; // depends on control dependency: [if], data = [none]
} else if (currentChar == '<') {
// If a '<' is encountered, this means we have fully parsed the main class name or an
// inner class name, and that we now need to parse TypeArguments. First, we need to
// visit the parsed class name.
String name = signature.substring(start, offset - 1);
if (inner) {
signatureVisitor.visitInnerClassType(name); // depends on control dependency: [if], data = [none]
} else {
signatureVisitor.visitClassType(name); // depends on control dependency: [if], data = [none]
}
visited = true; // depends on control dependency: [if], data = [none]
// Now, parse the TypeArgument(s), one at a time.
while ((currentChar = signature.charAt(offset)) != '>') {
switch (currentChar) {
case '*':
// Unbounded TypeArgument.
++offset;
signatureVisitor.visitTypeArgument();
break;
case '+':
case '-':
// Extends or Super TypeArgument. Use offset + 1 to skip the '+' or '-'.
offset =
parseType(
signature, offset + 1, signatureVisitor.visitTypeArgument(currentChar));
break;
default:
// Instanceof TypeArgument. The '=' is implicit.
offset = parseType(signature, offset, signatureVisitor.visitTypeArgument('='));
break;
}
}
}
}
return offset;
default:
throw new IllegalArgumentException();
}
} } |
public class class_name {
public void clampTexture() {
if (GL.canTextureMirrorClamp()) {
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT);
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT);
} else {
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_CLAMP);
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_CLAMP);
}
} } | public class class_name {
public void clampTexture() {
if (GL.canTextureMirrorClamp()) {
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT);
// depends on control dependency: [if], data = [none]
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_MIRROR_CLAMP_TO_EDGE_EXT);
// depends on control dependency: [if], data = [none]
} else {
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_S, SGL.GL_CLAMP);
// depends on control dependency: [if], data = [none]
GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_WRAP_T, SGL.GL_CLAMP);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public QueryParameters update(int index, QueryParameters params) throws SQLException {
AssertUtils.assertNotNull(params, "Element cannot be null, but values inside of it - can");
if (this.type == Type.READ_ONLY_FORWARD || this.type == Type.READ_ONLY_SCROLL) {
throw new MjdbcSQLException("This Lazy query output cache is initialized as read-only - therefore cannot be updated.");
}
QueryParameters result = get(index);
if (this.type == Type.UPDATE_FORWARD) {
if (this.currentIndex == index) {
updateResultSetCurrentLine(getCurrentResultSet(), params);
} else if (this.currentIndex + 1 == index) {
updateResultSetRow((index + 1) - generatedCacheMap.size(), params);
} else {
throw new MjdbcRuntimeException("Only current/next element can be updated!");
}
getCurrentResultSet().updateRow();
this.currentIndex = index;
} else if (this.type == Type.UPDATE_SCROLL) {
updateResultSetRow((index + 1) - generatedCacheMap.size(), params);
getCurrentResultSet().updateRow();
} else {
throw new MjdbcSQLException("This Lazy query output cache was initialized with unknown type");
}
return result;
} } | public class class_name {
public QueryParameters update(int index, QueryParameters params) throws SQLException {
AssertUtils.assertNotNull(params, "Element cannot be null, but values inside of it - can");
if (this.type == Type.READ_ONLY_FORWARD || this.type == Type.READ_ONLY_SCROLL) {
throw new MjdbcSQLException("This Lazy query output cache is initialized as read-only - therefore cannot be updated.");
}
QueryParameters result = get(index);
if (this.type == Type.UPDATE_FORWARD) {
if (this.currentIndex == index) {
updateResultSetCurrentLine(getCurrentResultSet(), params); // depends on control dependency: [if], data = [none]
} else if (this.currentIndex + 1 == index) {
updateResultSetRow((index + 1) - generatedCacheMap.size(), params); // depends on control dependency: [if], data = [none]
} else {
throw new MjdbcRuntimeException("Only current/next element can be updated!");
}
getCurrentResultSet().updateRow();
this.currentIndex = index;
} else if (this.type == Type.UPDATE_SCROLL) {
updateResultSetRow((index + 1) - generatedCacheMap.size(), params);
getCurrentResultSet().updateRow();
} else {
throw new MjdbcSQLException("This Lazy query output cache was initialized with unknown type");
}
return result;
} } |
public class class_name {
public static JSpinner createSpinner(
SpinnerModel model, final int fractionDigits)
{
return new JSpinner(model)
{
/**
* Serial UID
*/
private static final long serialVersionUID = -9185142711286020504L;
@Override
protected JComponent createEditor(SpinnerModel model)
{
if (model instanceof SpinnerNumberModel)
{
NumberEditor editor = new NumberEditor(this);
DecimalFormat format = editor.getFormat();
format.setMaximumFractionDigits(fractionDigits);
return editor;
}
return super.createEditor(model);
}
};
} } | public class class_name {
public static JSpinner createSpinner(
SpinnerModel model, final int fractionDigits)
{
return new JSpinner(model)
{
/**
* Serial UID
*/
private static final long serialVersionUID = -9185142711286020504L;
@Override
protected JComponent createEditor(SpinnerModel model)
{
if (model instanceof SpinnerNumberModel)
{
NumberEditor editor = new NumberEditor(this);
DecimalFormat format = editor.getFormat();
format.setMaximumFractionDigits(fractionDigits);
// depends on control dependency: [if], data = [none]
return editor;
// depends on control dependency: [if], data = [none]
}
return super.createEditor(model);
}
};
} } |
public class class_name {
private static LogProvider provider() {
Iterable<LogProvider> providers = ServiceLoader.load(LogProvider.class);
for (LogProvider provider : providers) {
// for now ignore multiple implementations and choose blindly the first one
return provider;
}
return new DefaultLogProvider();
} } | public class class_name {
private static LogProvider provider() {
Iterable<LogProvider> providers = ServiceLoader.load(LogProvider.class);
for (LogProvider provider : providers) {
// for now ignore multiple implementations and choose blindly the first one
return provider;
// depends on control dependency: [for], data = [provider]
}
return new DefaultLogProvider();
} } |
public class class_name {
private void addMissingBlanks(final int index) {
if (this.capacity <= index) {
this.capacity = index * 2;
final E[] newArr = (E[]) new Object[this.capacity];
System.arraycopy(this.arr, 0, newArr, 0, this.size);
this.arr = newArr;
}
if (this.blankElement != null) {
Arrays.fill(this.arr, this.size, index, this.blankElement);
}
this.size = index + 1;
} } | public class class_name {
private void addMissingBlanks(final int index) {
if (this.capacity <= index) {
this.capacity = index * 2; // depends on control dependency: [if], data = [none]
final E[] newArr = (E[]) new Object[this.capacity];
System.arraycopy(this.arr, 0, newArr, 0, this.size); // depends on control dependency: [if], data = [none]
this.arr = newArr; // depends on control dependency: [if], data = [none]
}
if (this.blankElement != null) {
Arrays.fill(this.arr, this.size, index, this.blankElement); // depends on control dependency: [if], data = [none]
}
this.size = index + 1;
} } |
public class class_name {
public WordBuilder<I> repeatAppend(int num, Word<I> word) {
if (num == 0) {
return this;
}
int wLen = word.length();
int allLen = wLen * num;
ensureAdditionalCapacity(allLen);
for (int i = num; i > 0; i--) {
word.writeToArray(0, array, length, wLen);
length += wLen;
}
return this;
} } | public class class_name {
public WordBuilder<I> repeatAppend(int num, Word<I> word) {
if (num == 0) {
return this; // depends on control dependency: [if], data = [none]
}
int wLen = word.length();
int allLen = wLen * num;
ensureAdditionalCapacity(allLen);
for (int i = num; i > 0; i--) {
word.writeToArray(0, array, length, wLen); // depends on control dependency: [for], data = [none]
length += wLen; // depends on control dependency: [for], data = [none]
}
return this;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.