code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
protected void handleHoverEvent(Event evt) {
if(evt.getTarget() instanceof Element) {
Element e = (Element) evt.getTarget();
Node next = e.getNextSibling();
if(next instanceof Element) {
toggleTooltip((Element) next, evt.getType());
}
else {
LoggingUtil.warning("Tooltip sibling not found.");
}
}
else {
LoggingUtil.warning("Got event for non-Element?!?");
}
} } | public class class_name {
protected void handleHoverEvent(Event evt) {
if(evt.getTarget() instanceof Element) {
Element e = (Element) evt.getTarget();
Node next = e.getNextSibling();
if(next instanceof Element) {
toggleTooltip((Element) next, evt.getType()); // depends on control dependency: [if], data = [none]
}
else {
LoggingUtil.warning("Tooltip sibling not found."); // depends on control dependency: [if], data = [none]
}
}
else {
LoggingUtil.warning("Got event for non-Element?!?"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void generateSelects(M2MEntity entity, String packageName) {
String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
String methodName = "";
String workId = "";
methodName = "selectBy" + idPart;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName
+ SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName)
.addAnnotation(AnnotationSpec.builder(BindSqlParam.class)
.addMember("value", "$S", entity.idName).build())
.build())
.returns(TypeUtility.className(packageName, entity.name)).build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "selectBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey1, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class),
TypeUtility.className(packageName, entity.name)))
.build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "selectBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey2, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class),
TypeUtility.className(packageName, entity.name)))
.build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
} } | public class class_name {
private void generateSelects(M2MEntity entity, String packageName) {
String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
String methodName = "";
String workId = "";
methodName = "selectBy" + idPart;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName
+ SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName)
.addAnnotation(AnnotationSpec.builder(BindSqlParam.class)
.addMember("value", "$S", entity.idName).build())
.build())
.returns(TypeUtility.className(packageName, entity.name)).build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "selectBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey1, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class),
TypeUtility.className(packageName, entity.name)))
.build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "selectBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlSelect.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey2, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(TypeUtility.parameterizedTypeName(TypeUtility.className(List.class),
TypeUtility.className(packageName, entity.name)))
.build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
boolean addImplementedInterface(JSTypeExpression interfaceName) {
lazyInitInfo();
if (info.implementedInterfaces == null) {
info.implementedInterfaces = new ArrayList<>(2);
}
if (info.implementedInterfaces.contains(interfaceName)) {
return false;
}
info.implementedInterfaces.add(interfaceName);
return true;
} } | public class class_name {
boolean addImplementedInterface(JSTypeExpression interfaceName) {
lazyInitInfo();
if (info.implementedInterfaces == null) {
info.implementedInterfaces = new ArrayList<>(2); // depends on control dependency: [if], data = [none]
}
if (info.implementedInterfaces.contains(interfaceName)) {
return false; // depends on control dependency: [if], data = [none]
}
info.implementedInterfaces.add(interfaceName);
return true;
} } |
public class class_name {
void passf2(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset, final int isign) {
double t1i, t1r;
int iw1;
iw1 = offset;
int idx = ido * l1;
if (ido <= 2) {
for (int k = 0; k < l1; k++) {
int idx0 = k * ido;
int iidx1 = in_off + 2 * idx0;
int iidx2 = iidx1 + ido;
double a1r = in[iidx1];
double a1i = in[iidx1 + 1];
double a2r = in[iidx2];
double a2i = in[iidx2 + 1];
int oidx1 = out_off + idx0;
int oidx2 = oidx1 + idx;
out[oidx1] = a1r + a2r;
out[oidx1 + 1] = a1i + a2i;
out[oidx2] = a1r - a2r;
out[oidx2 + 1] = a1i - a2i;
}
} else {
for (int k = 0; k < l1; k++) {
for (int i = 0; i < ido - 1; i += 2) {
int idx0 = k * ido;
int iidx1 = in_off + i + 2 * idx0;
int iidx2 = iidx1 + ido;
double i1r = in[iidx1];
double i1i = in[iidx1 + 1];
double i2r = in[iidx2];
double i2i = in[iidx2 + 1];
int widx1 = i + iw1;
double w1r = wtable[widx1];
double w1i = isign * wtable[widx1 + 1];
t1r = i1r - i2r;
t1i = i1i - i2i;
int oidx1 = out_off + i + idx0;
int oidx2 = oidx1 + idx;
out[oidx1] = i1r + i2r;
out[oidx1 + 1] = i1i + i2i;
out[oidx2] = w1r * t1r - w1i * t1i;
out[oidx2 + 1] = w1r * t1i + w1i * t1r;
}
}
}
} } | public class class_name {
void passf2(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset, final int isign) {
double t1i, t1r;
int iw1;
iw1 = offset;
int idx = ido * l1;
if (ido <= 2) {
for (int k = 0; k < l1; k++) {
int idx0 = k * ido;
int iidx1 = in_off + 2 * idx0;
int iidx2 = iidx1 + ido;
double a1r = in[iidx1];
double a1i = in[iidx1 + 1];
double a2r = in[iidx2];
double a2i = in[iidx2 + 1];
int oidx1 = out_off + idx0;
int oidx2 = oidx1 + idx;
out[oidx1] = a1r + a2r; // depends on control dependency: [for], data = [none]
out[oidx1 + 1] = a1i + a2i; // depends on control dependency: [for], data = [none]
out[oidx2] = a1r - a2r; // depends on control dependency: [for], data = [none]
out[oidx2 + 1] = a1i - a2i; // depends on control dependency: [for], data = [none]
}
} else {
for (int k = 0; k < l1; k++) {
for (int i = 0; i < ido - 1; i += 2) {
int idx0 = k * ido;
int iidx1 = in_off + i + 2 * idx0;
int iidx2 = iidx1 + ido;
double i1r = in[iidx1];
double i1i = in[iidx1 + 1];
double i2r = in[iidx2];
double i2i = in[iidx2 + 1];
int widx1 = i + iw1;
double w1r = wtable[widx1];
double w1i = isign * wtable[widx1 + 1];
t1r = i1r - i2r; // depends on control dependency: [for], data = [none]
t1i = i1i - i2i; // depends on control dependency: [for], data = [none]
int oidx1 = out_off + i + idx0;
int oidx2 = oidx1 + idx;
out[oidx1] = i1r + i2r; // depends on control dependency: [for], data = [none]
out[oidx1 + 1] = i1i + i2i; // depends on control dependency: [for], data = [none]
out[oidx2] = w1r * t1r - w1i * t1i; // depends on control dependency: [for], data = [none]
out[oidx2 + 1] = w1r * t1i + w1i * t1r; // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
public static String[] splitLongString(
String str, char separator, char quote)
{
int len = (str == null) ? 0 : str.length();
if (str == null || len == 0)
{
return ArrayUtils.EMPTY_STRING_ARRAY;
}
int oldPos = 0;
ArrayList list = new ArrayList();
for (int pos = 0; pos < len; oldPos = ++pos)
{
// Skip quoted text, if any
while ((pos < len) && (str.charAt(pos) == quote))
{
pos = str.indexOf(quote, pos + 1) + 1;
if (pos == 0)
{
throw new IllegalArgumentException(
"Closing quote missing in string '" + str + "'");
}
}
boolean quoted;
if (pos != oldPos)
{
quoted = true;
if ((pos < len) && (str.charAt(pos) != separator))
{
throw new IllegalArgumentException(
"Separator must follow closing quote in string '"
+ str + "'");
}
}
else
{
quoted = false;
pos = str.indexOf(separator, pos);
if (pos < 0)
{
pos = len;
}
}
list.add(
quoted ? dequote(str, oldPos + 1, pos - 1, quote)
: substring(str, oldPos, pos));
}
return (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} } | public class class_name {
public static String[] splitLongString(
String str, char separator, char quote)
{
int len = (str == null) ? 0 : str.length();
if (str == null || len == 0)
{
return ArrayUtils.EMPTY_STRING_ARRAY; // depends on control dependency: [if], data = [none]
}
int oldPos = 0;
ArrayList list = new ArrayList();
for (int pos = 0; pos < len; oldPos = ++pos)
{
// Skip quoted text, if any
while ((pos < len) && (str.charAt(pos) == quote))
{
pos = str.indexOf(quote, pos + 1) + 1; // depends on control dependency: [while], data = [none]
if (pos == 0)
{
throw new IllegalArgumentException(
"Closing quote missing in string '" + str + "'");
}
}
boolean quoted;
if (pos != oldPos)
{
quoted = true; // depends on control dependency: [if], data = [none]
if ((pos < len) && (str.charAt(pos) != separator))
{
throw new IllegalArgumentException(
"Separator must follow closing quote in string '"
+ str + "'");
}
}
else
{
quoted = false; // depends on control dependency: [if], data = [none]
pos = str.indexOf(separator, pos); // depends on control dependency: [if], data = [none]
if (pos < 0)
{
pos = len; // depends on control dependency: [if], data = [none]
}
}
list.add(
quoted ? dequote(str, oldPos + 1, pos - 1, quote)
: substring(str, oldPos, pos)); // depends on control dependency: [for], data = [none]
}
return (String[]) list.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
} } |
public class class_name {
public <T> FluentIterable<T> toFluentIterable(Function<? super Cursor, T> singleRowTransform) {
try {
return Cursors.toFluentIterable(this, singleRowTransform);
} finally {
close();
}
} } | public class class_name {
public <T> FluentIterable<T> toFluentIterable(Function<? super Cursor, T> singleRowTransform) {
try {
return Cursors.toFluentIterable(this, singleRowTransform); // depends on control dependency: [try], data = [none]
} finally {
close();
}
} } |
public class class_name {
protected void writeResultDetailed(Map<BioPAXElement, List<Match>> matches, OutputStream out,
int columns) throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter(out);
// write the header
String header = getHeader();
if (header != null)
{
writer.write(header);
}
else
{
for (int i = 0; i < columns; i++)
{
writer.write("col-" + (i+1));
if (i < columns - 1) writer.write("\t");
}
}
// memory for already written lines
Set<String> mem = new HashSet<String>();
// write values
for (BioPAXElement ele : matches.keySet())
{
for (Match m : matches.get(ele))
{
String line = "";
boolean aborted = false;
for (int i = 0; i < columns; i++)
{
String s = getValue(m, i);
if (s == null)
{
aborted = true;
break;
}
else
{
line += s + "\t";
}
}
if (aborted) continue;
line = line.trim();
if (!mem.contains(line))
{
writer.write("\n" + line);
mem.add(line);
}
}
}
writer.flush();
} } | public class class_name {
protected void writeResultDetailed(Map<BioPAXElement, List<Match>> matches, OutputStream out,
int columns) throws IOException
{
OutputStreamWriter writer = new OutputStreamWriter(out);
// write the header
String header = getHeader();
if (header != null)
{
writer.write(header);
}
else
{
for (int i = 0; i < columns; i++)
{
writer.write("col-" + (i+1)); // depends on control dependency: [for], data = [i]
if (i < columns - 1) writer.write("\t");
}
}
// memory for already written lines
Set<String> mem = new HashSet<String>();
// write values
for (BioPAXElement ele : matches.keySet())
{
for (Match m : matches.get(ele))
{
String line = "";
boolean aborted = false;
for (int i = 0; i < columns; i++)
{
String s = getValue(m, i);
if (s == null)
{
aborted = true; // depends on control dependency: [if], data = [none]
break;
}
else
{
line += s + "\t"; // depends on control dependency: [if], data = [none]
}
}
if (aborted) continue;
line = line.trim();
if (!mem.contains(line))
{
writer.write("\n" + line); // depends on control dependency: [if], data = [none]
mem.add(line); // depends on control dependency: [if], data = [none]
}
}
}
writer.flush();
} } |
public class class_name {
@VisibleForTesting
ByteBuffer allocateMemory() {
if (!Boolean.getBoolean(DISABLE_ALLOCATE_DIRECT_PROPERTY)) {
for (int retries = 0; retries < MEMORY_ALLOCATION_ATTEMPTS; retries++) {
int targetCapacity = getMemoryForSort(retries);
try {
return ByteBuffer.allocateDirect(targetCapacity);
} catch (OutOfMemoryError e) {
log.info("Failed to allocate direct memory for sort: " + targetCapacity
+ " retrying with a smaller buffer.");
}
}
}
Runtime runtime = Runtime.getRuntime();
int targetCapacity = getMemoryForSort(MEMORY_ALLOCATION_ATTEMPTS);
try {
if (targetCapacity < runtime.freeMemory() + (runtime.maxMemory() - runtime.totalMemory())) {
log.info("Using indirect memory allocation.");
return ByteBuffer.allocate(targetCapacity);
} else {
log.info("Skipping indirect memory allocation.");
}
} catch (OutOfMemoryError e) {
log.info("Failed to allocate non-direct memory for sort: " + targetCapacity + " giving up");
}
throw new RejectRequestException("Failed to allocate memory for sort after "
+ MEMORY_ALLOCATION_ATTEMPTS + " attempts. Giving up.");
} } | public class class_name {
@VisibleForTesting
ByteBuffer allocateMemory() {
if (!Boolean.getBoolean(DISABLE_ALLOCATE_DIRECT_PROPERTY)) {
for (int retries = 0; retries < MEMORY_ALLOCATION_ATTEMPTS; retries++) {
int targetCapacity = getMemoryForSort(retries);
try {
return ByteBuffer.allocateDirect(targetCapacity); // depends on control dependency: [try], data = [none]
} catch (OutOfMemoryError e) {
log.info("Failed to allocate direct memory for sort: " + targetCapacity
+ " retrying with a smaller buffer.");
} // depends on control dependency: [catch], data = [none]
}
}
Runtime runtime = Runtime.getRuntime();
int targetCapacity = getMemoryForSort(MEMORY_ALLOCATION_ATTEMPTS);
try {
if (targetCapacity < runtime.freeMemory() + (runtime.maxMemory() - runtime.totalMemory())) {
log.info("Using indirect memory allocation."); // depends on control dependency: [if], data = [none]
return ByteBuffer.allocate(targetCapacity); // depends on control dependency: [if], data = [(targetCapacity]
} else {
log.info("Skipping indirect memory allocation."); // depends on control dependency: [if], data = [none]
}
} catch (OutOfMemoryError e) {
log.info("Failed to allocate non-direct memory for sort: " + targetCapacity + " giving up");
} // depends on control dependency: [catch], data = [none]
throw new RejectRequestException("Failed to allocate memory for sort after "
+ MEMORY_ALLOCATION_ATTEMPTS + " attempts. Giving up.");
} } |
public class class_name {
@Check(CheckType.FAST)
public void checkFieldName(SarlField field) {
final JvmField inferredType = this.associations.getJvmField(field);
final QualifiedName name = Utils.getQualifiedName(inferredType);
if (this.featureNames.isDisallowedName(name)) {
final String validName = Utils.fixHiddenMember(field.getName());
error(MessageFormat.format(
Messages.SARLValidator_41,
field.getName()),
field,
XTEND_FIELD__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
VARIABLE_NAME_DISALLOWED,
validName);
} else if (this.grammarAccess.getOccurrenceKeyword().equals(field.getName())) {
error(MessageFormat.format(
Messages.SARLValidator_41,
this.grammarAccess.getOccurrenceKeyword()),
field,
XTEND_FIELD__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
VARIABLE_NAME_DISALLOWED);
}
} } | public class class_name {
@Check(CheckType.FAST)
public void checkFieldName(SarlField field) {
final JvmField inferredType = this.associations.getJvmField(field);
final QualifiedName name = Utils.getQualifiedName(inferredType);
if (this.featureNames.isDisallowedName(name)) {
final String validName = Utils.fixHiddenMember(field.getName());
error(MessageFormat.format(
Messages.SARLValidator_41,
field.getName()),
field,
XTEND_FIELD__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
VARIABLE_NAME_DISALLOWED,
validName); // depends on control dependency: [if], data = [none]
} else if (this.grammarAccess.getOccurrenceKeyword().equals(field.getName())) {
error(MessageFormat.format(
Messages.SARLValidator_41,
this.grammarAccess.getOccurrenceKeyword()),
field,
XTEND_FIELD__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
VARIABLE_NAME_DISALLOWED); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String unescape(Object content)
{
if (content == null) {
return null;
}
String str = String.valueOf(content);
str = APOS_PATTERN.matcher(str).replaceAll("'");
str = QUOT_PATTERN.matcher(str).replaceAll("\"");
str = LT_PATTERN.matcher(str).replaceAll("<");
str = GT_PATTERN.matcher(str).replaceAll(">");
str = AMP_PATTERN.matcher(str).replaceAll("&");
str = LCURL_PATTERN.matcher(str).replaceAll("{");
return str;
} } | public class class_name {
public static String unescape(Object content)
{
if (content == null) {
return null; // depends on control dependency: [if], data = [none]
}
String str = String.valueOf(content);
str = APOS_PATTERN.matcher(str).replaceAll("'");
str = QUOT_PATTERN.matcher(str).replaceAll("\"");
str = LT_PATTERN.matcher(str).replaceAll("<");
str = GT_PATTERN.matcher(str).replaceAll(">");
str = AMP_PATTERN.matcher(str).replaceAll("&");
str = LCURL_PATTERN.matcher(str).replaceAll("{");
return str;
} } |
public class class_name {
public Bbox getBounds() {
if (isEmpty()) {
return null;
}
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Point point : points) {
if (point.getX() < minX) {
minX = point.getX();
}
if (point.getY() < minY) {
minY = point.getY();
}
if (point.getX() > maxX) {
maxX = point.getX();
}
if (point.getY() > maxY) {
maxY = point.getY();
}
}
return new Bbox(minX, minY, maxX - minX, maxY - minY);
} } | public class class_name {
public Bbox getBounds() {
if (isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
double minX = Double.MAX_VALUE;
double minY = Double.MAX_VALUE;
double maxX = -Double.MAX_VALUE;
double maxY = -Double.MAX_VALUE;
for (Point point : points) {
if (point.getX() < minX) {
minX = point.getX(); // depends on control dependency: [if], data = [none]
}
if (point.getY() < minY) {
minY = point.getY(); // depends on control dependency: [if], data = [none]
}
if (point.getX() > maxX) {
maxX = point.getX(); // depends on control dependency: [if], data = [none]
}
if (point.getY() > maxY) {
maxY = point.getY(); // depends on control dependency: [if], data = [none]
}
}
return new Bbox(minX, minY, maxX - minX, maxY - minY);
} } |
public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL))
return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null);
else if (strCommand.equalsIgnoreCase(MenuConstants.PRINT))
{
LayoutPrint layoutPrint = new LayoutPrint(this.getMainRecord(), null);
return true;
}
else
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} } | public class class_name {
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if (strCommand.equalsIgnoreCase(MenuConstants.FORMDETAIL))
return (this.onForm(null, ScreenConstants.DETAIL_MODE, true, iCommandOptions, null) != null);
else if (strCommand.equalsIgnoreCase(MenuConstants.PRINT))
{
LayoutPrint layoutPrint = new LayoutPrint(this.getMainRecord(), null);
return true; // depends on control dependency: [if], data = [none]
}
else
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} } |
public class class_name {
public static void processAllCounterProbeExtensions(Event event){
List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions();
for (int i = 0; i < probeExtnList.size(); i ++) {
ProbeExtension probeExtension = probeExtnList.get(i);
try{
//Check if this probe extension is interested in
//counter events
if(probeExtension.invokeForCounter()){
probeExtension.processCounter(event);
}
}catch(Exception e){
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "----------------Probe extension invocation failure---------------");
Tr.debug(tc, probeExtension.getClass().getName() + ".processCounterEvent failed because of the following reason:" );
Tr.debug(tc, e.getMessage());
}
FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllCounterProbeExtensions", "215");
}
}
} } | public class class_name {
public static void processAllCounterProbeExtensions(Event event){
List<ProbeExtension> probeExtnList = RequestProbeService.getProbeExtensions();
for (int i = 0; i < probeExtnList.size(); i ++) {
ProbeExtension probeExtension = probeExtnList.get(i);
try{
//Check if this probe extension is interested in
//counter events
if(probeExtension.invokeForCounter()){
probeExtension.processCounter(event); // depends on control dependency: [if], data = [none]
}
}catch(Exception e){
if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()){
Tr.debug(tc, "----------------Probe extension invocation failure---------------"); // depends on control dependency: [if], data = [none]
Tr.debug(tc, probeExtension.getClass().getName() + ".processCounterEvent failed because of the following reason:" ); // depends on control dependency: [if], data = [none]
Tr.debug(tc, e.getMessage()); // depends on control dependency: [if], data = [none]
}
FFDCFilter.processException(e, RequestProbeService.class.getName() + ".processAllCounterProbeExtensions", "215");
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static SuggestedFix.Builder addPrivateConstructor(ClassTree classTree) {
SuggestedFix.Builder fix = SuggestedFix.builder();
String indent = " ";
for (Tree member : classTree.getMembers()) {
if (member.getKind().equals(METHOD) && !isGeneratedConstructor((MethodTree) member)) {
fix.prefixWith(
member,
indent + "private " + classTree.getSimpleName() + "() {} // no instances\n" + indent);
break;
}
if (!member.getKind().equals(METHOD)) {
indent = "";
}
}
return fix;
} } | public class class_name {
private static SuggestedFix.Builder addPrivateConstructor(ClassTree classTree) {
SuggestedFix.Builder fix = SuggestedFix.builder();
String indent = " ";
for (Tree member : classTree.getMembers()) {
if (member.getKind().equals(METHOD) && !isGeneratedConstructor((MethodTree) member)) {
fix.prefixWith(
member,
indent + "private " + classTree.getSimpleName() + "() {} // no instances\n" + indent);
break;
}
if (!member.getKind().equals(METHOD)) {
indent = "";
}
}
return fix; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public void preconfigureInput(InputComponent<?, ?> input, WithAttributes atts)
{
if (atts != null)
{
input.setEnabled(atts.enabled());
input.setLabel(atts.label());
input.setRequired(atts.required());
input.setRequiredMessage(atts.requiredMessage());
input.setDescription(atts.description());
input.setDeprecated(atts.deprecated());
input.setDeprecatedMessage(atts.deprecatedMessage());
// Set input type
if (!InputType.DEFAULT.equals(atts.type()))
{
input.getFacet(HintsFacet.class).setInputType(atts.type());
}
// Set Default Value
if (!atts.defaultValue().isEmpty())
{
InputComponents.setDefaultValueFor(converterFactory, (InputComponent<?, Object>) input,
atts.defaultValue());
}
// Set Note
if (!atts.note().isEmpty())
{
input.setNote(atts.note());
}
}
} } | public class class_name {
public void preconfigureInput(InputComponent<?, ?> input, WithAttributes atts)
{
if (atts != null)
{
input.setEnabled(atts.enabled()); // depends on control dependency: [if], data = [(atts]
input.setLabel(atts.label()); // depends on control dependency: [if], data = [(atts]
input.setRequired(atts.required()); // depends on control dependency: [if], data = [(atts]
input.setRequiredMessage(atts.requiredMessage()); // depends on control dependency: [if], data = [(atts]
input.setDescription(atts.description()); // depends on control dependency: [if], data = [(atts]
input.setDeprecated(atts.deprecated()); // depends on control dependency: [if], data = [(atts]
input.setDeprecatedMessage(atts.deprecatedMessage()); // depends on control dependency: [if], data = [(atts]
// Set input type
if (!InputType.DEFAULT.equals(atts.type()))
{
input.getFacet(HintsFacet.class).setInputType(atts.type()); // depends on control dependency: [if], data = [none]
}
// Set Default Value
if (!atts.defaultValue().isEmpty())
{
InputComponents.setDefaultValueFor(converterFactory, (InputComponent<?, Object>) input,
atts.defaultValue()); // depends on control dependency: [if], data = [none]
}
// Set Note
if (!atts.note().isEmpty())
{
input.setNote(atts.note()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void runIndexing(Session upperSession, Tuple tuple) {
initSession( upperSession );
try {
index( upperSession, entity( upperSession, tuple ) );
}
catch (Throwable e) {
errorHandler.handleException( log.massIndexerUnexpectedErrorMessage(), e );
}
finally {
log.debug( "finished" );
}
} } | public class class_name {
private void runIndexing(Session upperSession, Tuple tuple) {
initSession( upperSession );
try {
index( upperSession, entity( upperSession, tuple ) ); // depends on control dependency: [try], data = [none]
}
catch (Throwable e) {
errorHandler.handleException( log.massIndexerUnexpectedErrorMessage(), e );
} // depends on control dependency: [catch], data = [none]
finally {
log.debug( "finished" );
}
} } |
public class class_name {
public Observable<ServiceResponse<OperationStatus>> updateCompositeEntityWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (cEntityId == null) {
throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null.");
}
if (compositeModelUpdateObject == null) {
throw new IllegalArgumentException("Parameter compositeModelUpdateObject is required and cannot be null.");
}
Validator.validate(compositeModelUpdateObject);
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() {
@Override
public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) {
try {
ServiceResponse<OperationStatus> clientResponse = updateCompositeEntityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<OperationStatus>> updateCompositeEntityWithServiceResponseAsync(UUID appId, String versionId, UUID cEntityId, CompositeEntityModel compositeModelUpdateObject) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (cEntityId == null) {
throw new IllegalArgumentException("Parameter cEntityId is required and cannot be null.");
}
if (compositeModelUpdateObject == null) {
throw new IllegalArgumentException("Parameter compositeModelUpdateObject is required and cannot be null.");
}
Validator.validate(compositeModelUpdateObject);
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.updateCompositeEntity(appId, versionId, cEntityId, compositeModelUpdateObject, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatus>>>() {
@Override
public Observable<ServiceResponse<OperationStatus>> call(Response<ResponseBody> response) {
try {
ServiceResponse<OperationStatus> clientResponse = updateCompositeEntityDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private void validateIfdMP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8, 16});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8,32895});
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1});
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8});
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1);
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
checkRequiredTag(metadata, "PixelIntensityRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1});
} } | public class class_name {
private void validateIfdMP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0}); // depends on control dependency: [if], data = [none]
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8, 16}); // depends on control dependency: [if], data = [none]
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8}); // depends on control dependency: [if], data = [none]
}
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8,32895}); // depends on control dependency: [if], data = [none]
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1}); // depends on control dependency: [if], data = [none]
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8}); // depends on control dependency: [if], data = [none]
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1); // depends on control dependency: [if], data = [none]
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0}); // depends on control dependency: [if], data = [none]
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8}); // depends on control dependency: [if], data = [none]
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1}); // depends on control dependency: [if], data = [none]
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1}); // depends on control dependency: [if], data = [none]
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3}); // depends on control dependency: [if], data = [none]
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255}); // depends on control dependency: [if], data = [none]
checkRequiredTag(metadata, "PixelIntensityRange", 2, new long[]{0, 255}); // depends on control dependency: [if], data = [none]
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1});
} } |
public class class_name {
public synchronized boolean hasNext()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "hasNext");
if(next == null)
{
synchronized(index)
{
next = (Index.Entry) cursor.next();
if(filter != null)
{
while(next != null && !filter.matches(next.type))
{
next = (Index.Entry) cursor.next();
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "hasNext", new Boolean(next != null));
return (next != null);
} } | public class class_name {
public synchronized boolean hasNext()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "hasNext");
if(next == null)
{
synchronized(index) // depends on control dependency: [if], data = [none]
{
next = (Index.Entry) cursor.next();
if(filter != null)
{
while(next != null && !filter.matches(next.type))
{
next = (Index.Entry) cursor.next(); // depends on control dependency: [while], data = [none]
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "hasNext", new Boolean(next != null));
return (next != null);
} } |
public class class_name {
private static Object getValue(Object obj, String propertyPattern, ObjectWrapper options) {
if (propertyPattern == null) {
throw new IllegalArgumentException("Cannot get the value from a property with a 'null' propertyPattern.");
}
if (obj == null) {
// NullPointerException as it is throwed only when traversing a null object (ex: "foo.null.bar")
throw new NullPointerException("Cannot get the value of '" + propertyPattern + "' from a 'null' object.");
}
// '.' position if positive, '[' inverse position if negative
int position = indexOfDotOrSquare(propertyPattern);
// (propertyPattern.contains("."))
if (position > 0) {
String leftPattern = propertyPattern.substring(0, position);
String rightPattern = propertyPattern.substring(position + 1, propertyPattern.length());
Object leftValue = getValue(obj, leftPattern, options);
return getValue(leftValue, rightPattern, options);
// if (propertyPattern.contains("["))
} else if (position < 0) {
int squarePosition = -position;
String leftPattern = propertyPattern.substring(0, squarePosition);
String indexOrKey = propertyPattern.substring(squarePosition + 1, propertyPattern.length() - 1);// removes ']'
Property leftProperty = getPropertyOrThrow(Bean.forClass(obj.getClass()), leftPattern);
if (Map.class.isAssignableFrom(leftProperty.getType())) {
return getMappedValue(obj, leftProperty, indexOrKey);
} else {
try {
return getIndexedValue(obj, leftProperty, Integer.parseInt(indexOrKey), options);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("The pattern '" + indexOrKey + "' for the indexed "
+ leftProperty + " is invalid. Cannot parse the string to a valid integer index.");
}
}
}
return getSimpleValue(obj, getPropertyOrThrow(Bean.forClass(obj.getClass()), propertyPattern));
} } | public class class_name {
private static Object getValue(Object obj, String propertyPattern, ObjectWrapper options) {
if (propertyPattern == null) {
throw new IllegalArgumentException("Cannot get the value from a property with a 'null' propertyPattern.");
}
if (obj == null) {
// NullPointerException as it is throwed only when traversing a null object (ex: "foo.null.bar")
throw new NullPointerException("Cannot get the value of '" + propertyPattern + "' from a 'null' object.");
}
// '.' position if positive, '[' inverse position if negative
int position = indexOfDotOrSquare(propertyPattern);
// (propertyPattern.contains("."))
if (position > 0) {
String leftPattern = propertyPattern.substring(0, position);
String rightPattern = propertyPattern.substring(position + 1, propertyPattern.length());
Object leftValue = getValue(obj, leftPattern, options);
return getValue(leftValue, rightPattern, options); // depends on control dependency: [if], data = [none]
// if (propertyPattern.contains("["))
} else if (position < 0) {
int squarePosition = -position;
String leftPattern = propertyPattern.substring(0, squarePosition);
String indexOrKey = propertyPattern.substring(squarePosition + 1, propertyPattern.length() - 1);// removes ']'
Property leftProperty = getPropertyOrThrow(Bean.forClass(obj.getClass()), leftPattern);
if (Map.class.isAssignableFrom(leftProperty.getType())) {
return getMappedValue(obj, leftProperty, indexOrKey); // depends on control dependency: [if], data = [none]
} else {
try {
return getIndexedValue(obj, leftProperty, Integer.parseInt(indexOrKey), options); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new IllegalArgumentException("The pattern '" + indexOrKey + "' for the indexed "
+ leftProperty + " is invalid. Cannot parse the string to a valid integer index.");
} // depends on control dependency: [catch], data = [none]
}
}
return getSimpleValue(obj, getPropertyOrThrow(Bean.forClass(obj.getClass()), propertyPattern));
} } |
public class class_name {
public void createDataChannel() {
if (null != callReference) {
RespokeCall call = callReference.get();
if (null != call) {
PeerConnection peerConnection = call.getPeerConnection();
dataChannel = peerConnection.createDataChannel("respokeDataChannel", new DataChannel.Init());
dataChannel.registerObserver(this);
}
}
} } | public class class_name {
public void createDataChannel() {
if (null != callReference) {
RespokeCall call = callReference.get();
if (null != call) {
PeerConnection peerConnection = call.getPeerConnection();
dataChannel = peerConnection.createDataChannel("respokeDataChannel", new DataChannel.Init()); // depends on control dependency: [if], data = [none]
dataChannel.registerObserver(this); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <E> E[] toArray(E[] array) {
for (int i = 0, j = 0; i < array.length; ++i) {
int index = -1;
if (j < indices.length && (index = indices[j]) == i) {
array[i] = (E)(Long.valueOf(values[j]));
j++;
}
else
array[i] = (E)(Long.valueOf(0));
}
return array;
} } | public class class_name {
@SuppressWarnings("unchecked")
public <E> E[] toArray(E[] array) {
for (int i = 0, j = 0; i < array.length; ++i) {
int index = -1;
if (j < indices.length && (index = indices[j]) == i) {
array[i] = (E)(Long.valueOf(values[j])); // depends on control dependency: [if], data = [none]
j++; // depends on control dependency: [if], data = [none]
}
else
array[i] = (E)(Long.valueOf(0));
}
return array;
} } |
public class class_name {
public static CmsWorkplaceSettings initUserSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) {
if (settings == null) {
settings = new CmsWorkplaceSettings();
}
// save current workplace user & user settings object
CmsUser user;
if (update) {
try {
// read the user from db to get the latest user information if required
user = cms.readUser(cms.getRequestContext().getCurrentUser().getId());
} catch (CmsException e) {
// can usually be ignored
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage());
}
user = cms.getRequestContext().getCurrentUser();
}
} else {
user = cms.getRequestContext().getCurrentUser();
}
// store the user and it's settings in the Workplace settings
settings.setUser(user);
settings.setUserSettings(new CmsUserSettings(user));
// return the result settings
return settings;
} } | public class class_name {
public static CmsWorkplaceSettings initUserSettings(CmsObject cms, CmsWorkplaceSettings settings, boolean update) {
if (settings == null) {
settings = new CmsWorkplaceSettings(); // depends on control dependency: [if], data = [none]
}
// save current workplace user & user settings object
CmsUser user;
if (update) {
try {
// read the user from db to get the latest user information if required
user = cms.readUser(cms.getRequestContext().getCurrentUser().getId()); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// can usually be ignored
if (LOG.isInfoEnabled()) {
LOG.info(e.getLocalizedMessage()); // depends on control dependency: [if], data = [none]
}
user = cms.getRequestContext().getCurrentUser();
} // depends on control dependency: [catch], data = [none]
} else {
user = cms.getRequestContext().getCurrentUser(); // depends on control dependency: [if], data = [none]
}
// store the user and it's settings in the Workplace settings
settings.setUser(user);
settings.setUserSettings(new CmsUserSettings(user));
// return the result settings
return settings;
} } |
public class class_name {
public static void parse(final HashMap<String, String> tags,
final String tag) {
final String[] kv = splitString(tag, '=');
if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) {
throw new IllegalArgumentException("invalid tag: " + tag);
}
if (kv[1].equals(tags.get(kv[0]))) {
return;
}
if (tags.get(kv[0]) != null) {
throw new IllegalArgumentException("duplicate tag: " + tag
+ ", tags=" + tags);
}
tags.put(kv[0], kv[1]);
} } | public class class_name {
public static void parse(final HashMap<String, String> tags,
final String tag) {
final String[] kv = splitString(tag, '=');
if (kv.length != 2 || kv[0].length() <= 0 || kv[1].length() <= 0) {
throw new IllegalArgumentException("invalid tag: " + tag);
}
if (kv[1].equals(tags.get(kv[0]))) {
return; // depends on control dependency: [if], data = [none]
}
if (tags.get(kv[0]) != null) {
throw new IllegalArgumentException("duplicate tag: " + tag
+ ", tags=" + tags);
}
tags.put(kv[0], kv[1]);
} } |
public class class_name {
public static String toColorString(Color pColor) {
// Not a color...
if (pColor == null) {
return null;
}
StringBuilder str = new StringBuilder(Integer.toHexString(pColor.getRGB()));
// Make sure string is 8 chars
for (int i = str.length(); i < 8; i++) {
str.insert(0, '0');
}
// All opaque is default
if (str.charAt(0) == 'f' && str.charAt(1) == 'f') {
str.delete(0, 2);
}
// Prepend hash
return str.insert(0, '#').toString();
} } | public class class_name {
public static String toColorString(Color pColor) {
// Not a color...
if (pColor == null) {
return null;
// depends on control dependency: [if], data = [none]
}
StringBuilder str = new StringBuilder(Integer.toHexString(pColor.getRGB()));
// Make sure string is 8 chars
for (int i = str.length(); i < 8; i++) {
str.insert(0, '0');
// depends on control dependency: [for], data = [none]
}
// All opaque is default
if (str.charAt(0) == 'f' && str.charAt(1) == 'f') {
str.delete(0, 2);
// depends on control dependency: [if], data = [none]
}
// Prepend hash
return str.insert(0, '#').toString();
} } |
public class class_name {
public static File getFullBackupFile(File restoreDir)
{
Pattern p = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
Matcher m = p.matcher(f.getName());
if (m.matches())
{
return f;
}
}
return null;
} } | public class class_name {
public static File getFullBackupFile(File restoreDir)
{
Pattern p = Pattern.compile(".+\\.0");
for (File f : PrivilegedFileHelper.listFiles(restoreDir, new FileFilter()
{
public boolean accept(File pathname)
{
Pattern p = Pattern.compile(".+\\.[0-9]+");
Matcher m = p.matcher(pathname.getName());
return m.matches();
}
}))
{
Matcher m = p.matcher(f.getName());
if (m.matches())
{
return f;
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private void parseProperties(Element element, BeanDefinitionBuilder builder,
ManagedList<AbstractBeanDefinition> propertyList) {
NodeList properties = element.getChildNodes();
for (int i = 0; i < properties.getLength(); i++) {
Node node = properties.item(i);
if (!(node instanceof Element)) {
continue;
}
Element property = (Element) node;
BeanDefinitionBuilder propertyBuilder = BeanDefinitionBuilder.genericBeanDefinition(PropertyInfo.class);
addProperties(property, propertyBuilder);
parseConfig(property, propertyBuilder);
propertyList.add(propertyBuilder.getBeanDefinition());
}
} } | public class class_name {
private void parseProperties(Element element, BeanDefinitionBuilder builder,
ManagedList<AbstractBeanDefinition> propertyList) {
NodeList properties = element.getChildNodes();
for (int i = 0; i < properties.getLength(); i++) {
Node node = properties.item(i);
if (!(node instanceof Element)) {
continue;
}
Element property = (Element) node;
BeanDefinitionBuilder propertyBuilder = BeanDefinitionBuilder.genericBeanDefinition(PropertyInfo.class);
addProperties(property, propertyBuilder); // depends on control dependency: [for], data = [none]
parseConfig(property, propertyBuilder); // depends on control dependency: [for], data = [none]
propertyList.add(propertyBuilder.getBeanDefinition()); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public Map<String, StringListAttribute> getCustomAttributes() {
Map<String, StringListAttribute> rslt =
new HashMap<String, StringListAttribute>(attributes);
for (Preference p : accountEditAttributes) {
rslt.remove(p.getName());
}
return Collections.unmodifiableMap(rslt);
} } | public class class_name {
public Map<String, StringListAttribute> getCustomAttributes() {
Map<String, StringListAttribute> rslt =
new HashMap<String, StringListAttribute>(attributes);
for (Preference p : accountEditAttributes) {
rslt.remove(p.getName()); // depends on control dependency: [for], data = [p]
}
return Collections.unmodifiableMap(rslt);
} } |
public class class_name {
public static String fromNamedReference(CharSequence s) {
if (s == null) {
return null;
}
final Integer code = SPECIALS.get(s.toString());
if (code != null) {
return "&#" + code + ";";
}
return null;
} } | public class class_name {
public static String fromNamedReference(CharSequence s) {
if (s == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Integer code = SPECIALS.get(s.toString());
if (code != null) {
return "&#" + code + ";"; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private void obtainTextColor(@NonNull final TypedArray typedArray) {
ColorStateList colorStateList =
typedArray.getColorStateList(R.styleable.ActionPreference_android_textColor);
if (colorStateList == null) {
colorStateList = ContextCompat
.getColorStateList(getContext(), R.color.action_preference_text_color);
}
setTextColor(colorStateList);
} } | public class class_name {
private void obtainTextColor(@NonNull final TypedArray typedArray) {
ColorStateList colorStateList =
typedArray.getColorStateList(R.styleable.ActionPreference_android_textColor);
if (colorStateList == null) {
colorStateList = ContextCompat
.getColorStateList(getContext(), R.color.action_preference_text_color); // depends on control dependency: [if], data = [none]
}
setTextColor(colorStateList);
} } |
public class class_name {
@Override
public boolean hasNext() {
try {
if (currentPart != null) {
currentPart.close();
}
if (!fileItemIterator.hasNext()) {
return false;
}
FileItemStream fileItemStream = fileItemIterator.next();
if (fileItemStream.isFormField()) {
currentPart = new FormFieldImpl(fileItemStream);
} else {
currentPart = new UploadStreamImpl(fileItemStream);
}
return true;
} catch (IOException | FileUploadException e) {
log.error(e);
}
return false;
} } | public class class_name {
@Override
public boolean hasNext() {
try {
if (currentPart != null) {
currentPart.close();
// depends on control dependency: [if], data = [none]
}
if (!fileItemIterator.hasNext()) {
return false;
// depends on control dependency: [if], data = [none]
}
FileItemStream fileItemStream = fileItemIterator.next();
if (fileItemStream.isFormField()) {
currentPart = new FormFieldImpl(fileItemStream);
// depends on control dependency: [if], data = [none]
} else {
currentPart = new UploadStreamImpl(fileItemStream);
// depends on control dependency: [if], data = [none]
}
return true;
// depends on control dependency: [try], data = [none]
} catch (IOException | FileUploadException e) {
log.error(e);
}
// depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
private Statement handleTranslationWithPlaceholders(
MsgNode msg,
ImmutableList<SoyPrintDirective> escapingDirectives,
Expression soyMsgParts,
Expression locale,
MsgPartsAndIds partsAndId) {
// We need to render placeholders into a buffer and then pack them into a map to pass to
// Runtime.renderSoyMsgWithPlaceholders.
Map<String, Function<Expression, Statement>> placeholderNameToPutStatement =
new LinkedHashMap<>();
putPlaceholdersIntoMap(msg, partsAndId.parts, placeholderNameToPutStatement);
// sanity check
checkState(!placeholderNameToPutStatement.isEmpty());
ConstructorRef cstruct =
msg.isPlrselMsg() ? ConstructorRef.PLRSEL_MSG_RENDERER : ConstructorRef.MSG_RENDERER;
Statement initRendererStatement =
variables
.getCurrentRenderee()
.putInstanceField(
thisVar,
cstruct.construct(
constant(partsAndId.id),
soyMsgParts,
locale,
constant(placeholderNameToPutStatement.size())));
List<Statement> initializationStatements = new ArrayList<>();
initializationStatements.add(initRendererStatement);
for (Function<Expression, Statement> fn : placeholderNameToPutStatement.values()) {
initializationStatements.add(fn.apply(variables.getCurrentRenderee().accessor(thisVar)));
}
Statement initMsgRenderer = Statement.concat(initializationStatements);
Statement render;
if (areAllPrintDirectivesStreamable(escapingDirectives)) {
AppendableAndOptions wrappedAppendable =
applyStreamingEscapingDirectives(
escapingDirectives,
appendableExpression,
parameterLookup.getPluginContext(),
variables);
FieldRef currentAppendableField = variables.getCurrentAppendable();
Statement initAppendable =
currentAppendableField.putInstanceField(thisVar, wrappedAppendable.appendable());
Expression appendableExpression = currentAppendableField.accessor(thisVar);
Statement clearAppendable =
currentAppendableField.putInstanceField(
thisVar, constantNull(LOGGING_ADVISING_APPENDABLE_TYPE));
if (wrappedAppendable.closeable()) {
clearAppendable =
Statement.concat(
appendableExpression
.checkedCast(BytecodeUtils.CLOSEABLE_TYPE)
.invokeVoid(MethodRef.CLOSEABLE_CLOSE),
clearAppendable);
}
render =
Statement.concat(
initAppendable,
detachState.detachForRender(
variables
.getCurrentRenderee()
.accessor(thisVar)
.invoke(
MethodRef.SOY_VALUE_PROVIDER_RENDER_AND_RESOLVE,
appendableExpression,
// set the isLast field to true since we know this will only be rendered
// once.
/* isLast=*/ constant(true))),
clearAppendable);
} else {
Label start = new Label();
SoyExpression value =
SoyExpression.forSoyValue(
StringType.getInstance(),
detachState
.createExpressionDetacher(start)
.resolveSoyValueProvider(variables.getCurrentRenderee().accessor(thisVar))
.checkedCast(SOY_STRING_TYPE));
for (SoyPrintDirective directive : escapingDirectives) {
value = parameterLookup.getRenderContext().applyPrintDirective(directive, value);
}
render =
appendableExpression.appendString(value.unboxAsString()).toStatement().labelStart(start);
}
return Statement.concat(
initMsgRenderer,
render,
// clear the field
variables
.getCurrentRenderee()
.putInstanceField(
thisVar,
BytecodeUtils.constantNull(ConstructorRef.MSG_RENDERER.instanceClass().type())));
} } | public class class_name {
private Statement handleTranslationWithPlaceholders(
MsgNode msg,
ImmutableList<SoyPrintDirective> escapingDirectives,
Expression soyMsgParts,
Expression locale,
MsgPartsAndIds partsAndId) {
// We need to render placeholders into a buffer and then pack them into a map to pass to
// Runtime.renderSoyMsgWithPlaceholders.
Map<String, Function<Expression, Statement>> placeholderNameToPutStatement =
new LinkedHashMap<>();
putPlaceholdersIntoMap(msg, partsAndId.parts, placeholderNameToPutStatement);
// sanity check
checkState(!placeholderNameToPutStatement.isEmpty());
ConstructorRef cstruct =
msg.isPlrselMsg() ? ConstructorRef.PLRSEL_MSG_RENDERER : ConstructorRef.MSG_RENDERER;
Statement initRendererStatement =
variables
.getCurrentRenderee()
.putInstanceField(
thisVar,
cstruct.construct(
constant(partsAndId.id),
soyMsgParts,
locale,
constant(placeholderNameToPutStatement.size())));
List<Statement> initializationStatements = new ArrayList<>();
initializationStatements.add(initRendererStatement);
for (Function<Expression, Statement> fn : placeholderNameToPutStatement.values()) {
initializationStatements.add(fn.apply(variables.getCurrentRenderee().accessor(thisVar))); // depends on control dependency: [for], data = [fn]
}
Statement initMsgRenderer = Statement.concat(initializationStatements);
Statement render;
if (areAllPrintDirectivesStreamable(escapingDirectives)) {
AppendableAndOptions wrappedAppendable =
applyStreamingEscapingDirectives(
escapingDirectives,
appendableExpression,
parameterLookup.getPluginContext(),
variables);
FieldRef currentAppendableField = variables.getCurrentAppendable();
Statement initAppendable =
currentAppendableField.putInstanceField(thisVar, wrappedAppendable.appendable());
Expression appendableExpression = currentAppendableField.accessor(thisVar);
Statement clearAppendable =
currentAppendableField.putInstanceField(
thisVar, constantNull(LOGGING_ADVISING_APPENDABLE_TYPE));
if (wrappedAppendable.closeable()) {
clearAppendable =
Statement.concat(
appendableExpression
.checkedCast(BytecodeUtils.CLOSEABLE_TYPE)
.invokeVoid(MethodRef.CLOSEABLE_CLOSE),
clearAppendable); // depends on control dependency: [if], data = [none]
}
render =
Statement.concat(
initAppendable,
detachState.detachForRender(
variables
.getCurrentRenderee()
.accessor(thisVar)
.invoke(
MethodRef.SOY_VALUE_PROVIDER_RENDER_AND_RESOLVE,
appendableExpression,
// set the isLast field to true since we know this will only be rendered
// once.
/* isLast=*/ constant(true))),
clearAppendable); // depends on control dependency: [if], data = [none]
} else {
Label start = new Label();
SoyExpression value =
SoyExpression.forSoyValue(
StringType.getInstance(),
detachState
.createExpressionDetacher(start)
.resolveSoyValueProvider(variables.getCurrentRenderee().accessor(thisVar))
.checkedCast(SOY_STRING_TYPE));
for (SoyPrintDirective directive : escapingDirectives) {
value = parameterLookup.getRenderContext().applyPrintDirective(directive, value); // depends on control dependency: [for], data = [directive]
}
render =
appendableExpression.appendString(value.unboxAsString()).toStatement().labelStart(start); // depends on control dependency: [if], data = [none]
}
return Statement.concat(
initMsgRenderer,
render,
// clear the field
variables
.getCurrentRenderee()
.putInstanceField(
thisVar,
BytecodeUtils.constantNull(ConstructorRef.MSG_RENDERER.instanceClass().type())));
} } |
public class class_name {
private static Node makeNewRvalueForDestructuringKey(
Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) {
if (stringKey.getOnlyChild().isDefaultValue()) {
Node defaultValue = stringKey.getFirstChild().getSecondChild().detach();
// Assume `rvalue` has no side effects since it's a qname, and we can create multiple
// references to it. This ignores getters/setters.
Node rvalueForSheq = rvalue.cloneTree();
if (newNodes != null) {
newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq));
}
// `void 0 === rvalue ? defaultValue : rvalue`
rvalue =
IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue)
.srcrefTree(defaultValue);
}
return rvalue;
} } | public class class_name {
private static Node makeNewRvalueForDestructuringKey(
Node stringKey, Node rvalue, Set<AstChange> newNodes, Ref ref) {
if (stringKey.getOnlyChild().isDefaultValue()) {
Node defaultValue = stringKey.getFirstChild().getSecondChild().detach();
// Assume `rvalue` has no side effects since it's a qname, and we can create multiple
// references to it. This ignores getters/setters.
Node rvalueForSheq = rvalue.cloneTree();
if (newNodes != null) {
newNodes.add(new AstChange(ref.module, ref.scope, rvalueForSheq)); // depends on control dependency: [if], data = [none]
}
// `void 0 === rvalue ? defaultValue : rvalue`
rvalue =
IR.hook(IR.sheq(NodeUtil.newUndefinedNode(rvalue), rvalueForSheq), defaultValue, rvalue)
.srcrefTree(defaultValue); // depends on control dependency: [if], data = [none]
}
return rvalue;
} } |
public class class_name {
@Nullable
public DBObject one() {
DBCursor findOneCursor = copy().limit(-1);
try {
return findOneCursor.hasNext() ? findOneCursor.next() : null;
} finally {
findOneCursor.close();
}
} } | public class class_name {
@Nullable
public DBObject one() {
DBCursor findOneCursor = copy().limit(-1);
try {
return findOneCursor.hasNext() ? findOneCursor.next() : null; // depends on control dependency: [try], data = [none]
} finally {
findOneCursor.close();
}
} } |
public class class_name {
private void _sync()
{
if (!mirrored)
throw new IllegalArgumentException("Mirroring not activated on this index");
// Reset statistics.
stats = new SyncStats();
long startTime = System.currentTimeMillis();
// Notify listeners.
getClient().completionExecutor.execute(new Runnable()
{
@Override
public void run()
{
fireSyncDidStart();
}
});
try {
// Create temporary directory.
tmpDir = new File(getClient().getTempDir(), UUID.randomUUID().toString());
tmpDir.mkdirs();
// NOTE: We are doing everything sequentially, because this is a background job: we care more about
// resource consumption than about how long it will take.
// Fetch settings.
{
JSONObject settingsJSON = this.getSettings(1, /* requestOptions: */ null);
settingsFile = new File(tmpDir, "settings.json");
String data = settingsJSON.toString();
Writer writer = new OutputStreamWriter(new FileOutputStream(settingsFile), "UTF-8");
writer.write(data);
writer.close();
}
// Perform data selection queries.
objectFiles = new ArrayList<>();
final DataSelectionQuery[] queries = mirrorSettings.getQueries();
for (DataSelectionQuery query : queries) {
String cursor = null;
int retrievedObjects = 0;
do {
// Make next request.
JSONObject objectsJSON = cursor == null ? this.browse(query.query, /* requestOptions: */ null) : this.browseFrom(cursor, /* requestOptions: */ null);
// Write result to file.
int objectFileNo = objectFiles.size();
File file = new File(tmpDir, String.format("%d.json", objectFileNo));
objectFiles.add(file);
String data = objectsJSON.toString();
Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
writer.write(data);
writer.close();
cursor = objectsJSON.optString("cursor", null);
JSONArray hits = objectsJSON.optJSONArray("hits");
if (hits == null) {
// Something went wrong:
// Report the error, and just abort this batch and proceed with the next query.
Log.e(this.getClass().getName(), "No hits in result for query: " + query.query);
break;
}
retrievedObjects += hits.length();
}
while (retrievedObjects < query.maxObjects && cursor != null);
stats.objectCount += retrievedObjects;
}
// Update statistics.
long afterFetchTime = System.currentTimeMillis();
stats.fetchTime = afterFetchTime - startTime;
stats.fileCount = objectFiles.size();
// Build the index.
_buildOffline(settingsFile, objectFiles.toArray(new File[objectFiles.size()]));
// Update statistics.
long afterBuildTime = System.currentTimeMillis();
stats.buildTime = afterBuildTime - afterFetchTime;
stats.totalTime = afterBuildTime - startTime;
// Remember the last sync date.
mirrorSettings.setLastSyncDate(new Date());
saveMirrorSettings();
// Log statistics.
Log.d(this.getClass().getName(), "Sync stats: " + stats);
}
catch (Exception e) {
Log.e(this.getClass().getName(), "Sync failed", e);
error = e;
}
finally {
// Clean up.
if (tmpDir != null) {
FileUtils.deleteRecursive(tmpDir);
tmpDir = null;
}
settingsFile = null;
objectFiles = null;
// Mark sync as finished.
synchronized (this) {
syncing = false;
}
// Notify listeners.
getClient().completionExecutor.execute(new Runnable()
{
@Override
public void run()
{
fireSyncDidFinish();
}
});
}
} } | public class class_name {
private void _sync()
{
if (!mirrored)
throw new IllegalArgumentException("Mirroring not activated on this index");
// Reset statistics.
stats = new SyncStats();
long startTime = System.currentTimeMillis();
// Notify listeners.
getClient().completionExecutor.execute(new Runnable()
{
@Override
public void run()
{
fireSyncDidStart();
}
});
try {
// Create temporary directory.
tmpDir = new File(getClient().getTempDir(), UUID.randomUUID().toString()); // depends on control dependency: [try], data = [none]
tmpDir.mkdirs(); // depends on control dependency: [try], data = [none]
// NOTE: We are doing everything sequentially, because this is a background job: we care more about
// resource consumption than about how long it will take.
// Fetch settings.
{
JSONObject settingsJSON = this.getSettings(1, /* requestOptions: */ null);
settingsFile = new File(tmpDir, "settings.json");
String data = settingsJSON.toString();
Writer writer = new OutputStreamWriter(new FileOutputStream(settingsFile), "UTF-8");
writer.write(data);
writer.close();
}
// Perform data selection queries.
objectFiles = new ArrayList<>(); // depends on control dependency: [try], data = [none]
final DataSelectionQuery[] queries = mirrorSettings.getQueries();
for (DataSelectionQuery query : queries) {
String cursor = null;
int retrievedObjects = 0;
do {
// Make next request.
JSONObject objectsJSON = cursor == null ? this.browse(query.query, /* requestOptions: */ null) : this.browseFrom(cursor, /* requestOptions: */ null);
// Write result to file.
int objectFileNo = objectFiles.size();
File file = new File(tmpDir, String.format("%d.json", objectFileNo));
objectFiles.add(file);
String data = objectsJSON.toString();
Writer writer = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
writer.write(data);
writer.close();
cursor = objectsJSON.optString("cursor", null);
JSONArray hits = objectsJSON.optJSONArray("hits");
if (hits == null) {
// Something went wrong:
// Report the error, and just abort this batch and proceed with the next query.
Log.e(this.getClass().getName(), "No hits in result for query: " + query.query); // depends on control dependency: [if], data = [none]
break;
}
retrievedObjects += hits.length();
}
while (retrievedObjects < query.maxObjects && cursor != null);
stats.objectCount += retrievedObjects; // depends on control dependency: [for], data = [none]
}
// Update statistics.
long afterFetchTime = System.currentTimeMillis();
stats.fetchTime = afterFetchTime - startTime; // depends on control dependency: [try], data = [none]
stats.fileCount = objectFiles.size(); // depends on control dependency: [try], data = [none]
// Build the index.
_buildOffline(settingsFile, objectFiles.toArray(new File[objectFiles.size()])); // depends on control dependency: [try], data = [none]
// Update statistics.
long afterBuildTime = System.currentTimeMillis();
stats.buildTime = afterBuildTime - afterFetchTime; // depends on control dependency: [try], data = [none]
stats.totalTime = afterBuildTime - startTime; // depends on control dependency: [try], data = [none]
// Remember the last sync date.
mirrorSettings.setLastSyncDate(new Date()); // depends on control dependency: [try], data = [none]
saveMirrorSettings(); // depends on control dependency: [try], data = [none]
// Log statistics.
Log.d(this.getClass().getName(), "Sync stats: " + stats); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
Log.e(this.getClass().getName(), "Sync failed", e);
error = e;
} // depends on control dependency: [catch], data = [none]
finally {
// Clean up.
if (tmpDir != null) {
FileUtils.deleteRecursive(tmpDir); // depends on control dependency: [if], data = [(tmpDir]
tmpDir = null; // depends on control dependency: [if], data = [none]
}
settingsFile = null;
objectFiles = null;
// Mark sync as finished.
synchronized (this) {
syncing = false;
}
// Notify listeners.
getClient().completionExecutor.execute(new Runnable()
{
@Override
public void run()
{
fireSyncDidFinish();
}
});
}
} } |
public class class_name {
public void updateRequestByAddingReplaceVarPair(
ParallelTask task, String replaceVarKey, String replaceVarValue) {
Map<String, NodeReqResponse> taskResult = task.getParallelTaskResult();
for (Entry<String, NodeReqResponse> entry : taskResult.entrySet()) {
NodeReqResponse nodeReqResponse = entry.getValue();
nodeReqResponse.getRequestParameters()
.put(PcConstants.NODE_REQUEST_PREFIX_REPLACE_VAR
+ replaceVarKey, replaceVarValue);
nodeReqResponse.getRequestParameters().put(
PcConstants.NODE_REQUEST_WILL_EXECUTE,
Boolean.toString(true));
}// end for loop
} } | public class class_name {
public void updateRequestByAddingReplaceVarPair(
ParallelTask task, String replaceVarKey, String replaceVarValue) {
Map<String, NodeReqResponse> taskResult = task.getParallelTaskResult();
for (Entry<String, NodeReqResponse> entry : taskResult.entrySet()) {
NodeReqResponse nodeReqResponse = entry.getValue();
nodeReqResponse.getRequestParameters()
.put(PcConstants.NODE_REQUEST_PREFIX_REPLACE_VAR
+ replaceVarKey, replaceVarValue); // depends on control dependency: [for], data = [none]
nodeReqResponse.getRequestParameters().put(
PcConstants.NODE_REQUEST_WILL_EXECUTE,
Boolean.toString(true)); // depends on control dependency: [for], data = [none]
}// end for loop
} } |
public class class_name {
@Override
public final ResourceSnapshot create(ContainerSnapshot container, DataSet representation, WriteSession session) {
Name<?> name=
NamingScheme.
getDefault().
name(id.incrementAndGet());
DataSetHelper helper=
DataSetUtils.newHelper(representation);
ManagedIndividual individual =
helper.
replace(
DataSetHelper.SELF,
ManagedIndividualId.createId(name,PersonHandler.ID),
ManagedIndividual.class);
individual.
addValue(
URI.create("http://www.example.org/vocab#creationDate"),
Literals.of(new Date()).dateTime());
try {
this.handler.add(name, representation);
ResourceSnapshot member = container.addMember(name);
session.saveChanges();
return member;
} catch (Exception e) {
this.handler.remove(name);
throw new ApplicationRuntimeException("Could not create member",e);
}
} } | public class class_name {
@Override
public final ResourceSnapshot create(ContainerSnapshot container, DataSet representation, WriteSession session) {
Name<?> name=
NamingScheme.
getDefault().
name(id.incrementAndGet());
DataSetHelper helper=
DataSetUtils.newHelper(representation);
ManagedIndividual individual =
helper.
replace(
DataSetHelper.SELF,
ManagedIndividualId.createId(name,PersonHandler.ID),
ManagedIndividual.class);
individual.
addValue(
URI.create("http://www.example.org/vocab#creationDate"),
Literals.of(new Date()).dateTime());
try {
this.handler.add(name, representation); // depends on control dependency: [try], data = [none]
ResourceSnapshot member = container.addMember(name);
session.saveChanges(); // depends on control dependency: [try], data = [none]
return member; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
this.handler.remove(name);
throw new ApplicationRuntimeException("Could not create member",e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean toBoundedNext() throws FetchException {
if (!toNext()) {
return false;
}
if (mEndBound != null) {
byte[] currentKey = getCurrentKey();
if (currentKey == null) {
return false;
}
int result = compareKeysPartially(currentKey, mEndBound);
if (result >= 0) {
if (result > 0 || !mInclusiveEnd) {
return false;
}
}
}
return prefixMatches();
} } | public class class_name {
private boolean toBoundedNext() throws FetchException {
if (!toNext()) {
return false;
}
if (mEndBound != null) {
byte[] currentKey = getCurrentKey();
if (currentKey == null) {
return false;
}
int result = compareKeysPartially(currentKey, mEndBound);
if (result >= 0) {
if (result > 0 || !mInclusiveEnd) {
return false;
// depends on control dependency: [if], data = [none]
}
}
}
return prefixMatches();
} } |
public class class_name {
@Override
protected void delete(Object entity, Object pKey)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(entityMetadata.getPersistenceUnit());
EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());
KuduSession session = kuduClient.newSession();
KuduTable table = null;
try
{
table = kuduClient.openTable(entityMetadata.getTableName());
}
catch (Exception e)
{
logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
}
Delete delete = table.newDelete();
PartialRow row = delete.getRow();
String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getName();
Field field = (Field) entityType.getAttribute(idColumnName).getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
Type idType = KuduDBValidationClassMapper.getValidTypeForClass(field.getType());
if (entityType.getAttribute(idColumnName).getJavaType().isAnnotationPresent(Embeddable.class))
{
// Composite Id
EmbeddableType embeddableIdType = metaModel.embeddable(entityType.getAttribute(idColumnName).getJavaType());
Field[] fields = entityType.getAttribute(idColumnName).getJavaType().getDeclaredFields();
addPrimaryKeyToRow(row, embeddableIdType, fields, metaModel, value);
}
else
{
// Simple Id
KuduDBDataHandler.addToRow(row, ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(),
value, idType);
}
try
{
session.apply(delete);
}
catch (Exception e)
{
logger.error("Cannot delete row from table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot delete row from table : " + entityMetadata.getTableName(), e);
}
finally
{
try
{
session.close();
}
catch (Exception e)
{
logger.error("Cannot close session", e);
throw new KunderaException("Cannot close session", e);
}
}
} } | public class class_name {
@Override
protected void delete(Object entity, Object pKey)
{
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(kunderaMetadata, entity.getClass());
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
.getMetamodel(entityMetadata.getPersistenceUnit());
EntityType entityType = metaModel.entity(entityMetadata.getEntityClazz());
KuduSession session = kuduClient.newSession();
KuduTable table = null;
try
{
table = kuduClient.openTable(entityMetadata.getTableName()); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
} // depends on control dependency: [catch], data = [none]
Delete delete = table.newDelete();
PartialRow row = delete.getRow();
String idColumnName = ((AbstractAttribute) entityMetadata.getIdAttribute()).getName();
Field field = (Field) entityType.getAttribute(idColumnName).getJavaMember();
Object value = PropertyAccessorHelper.getObject(entity, field);
Type idType = KuduDBValidationClassMapper.getValidTypeForClass(field.getType());
if (entityType.getAttribute(idColumnName).getJavaType().isAnnotationPresent(Embeddable.class))
{
// Composite Id
EmbeddableType embeddableIdType = metaModel.embeddable(entityType.getAttribute(idColumnName).getJavaType());
Field[] fields = entityType.getAttribute(idColumnName).getJavaType().getDeclaredFields();
addPrimaryKeyToRow(row, embeddableIdType, fields, metaModel, value); // depends on control dependency: [if], data = [none]
}
else
{
// Simple Id
KuduDBDataHandler.addToRow(row, ((AbstractAttribute) entityMetadata.getIdAttribute()).getJPAColumnName(),
value, idType); // depends on control dependency: [if], data = [none]
}
try
{
session.apply(delete); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.error("Cannot delete row from table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot delete row from table : " + entityMetadata.getTableName(), e);
} // depends on control dependency: [catch], data = [none]
finally
{
try
{
session.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
logger.error("Cannot close session", e);
throw new KunderaException("Cannot close session", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static <T> double reduceBy( final double[] array, T object ) {
if (object.getClass().isAnonymousClass()) {
return reduceByR(array, object );
}
try {
ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object);
MethodHandle methodHandle = callSite.dynamicInvoker();
try {
double sum = 0;
for ( double v : array ) {
sum = (double) methodHandle.invokeExact( sum, v );
}
return sum;
} catch (Throwable throwable) {
return handle(Long.class, throwable, "Unable to perform reduceBy");
}
} catch (Exception ex) {
return reduceByR(array, object);
}
} } | public class class_name {
public static <T> double reduceBy( final double[] array, T object ) {
if (object.getClass().isAnonymousClass()) {
return reduceByR(array, object ); // depends on control dependency: [if], data = [none]
}
try {
ConstantCallSite callSite = Invoker.invokeReducerLongIntReturnLongMethodHandle(object);
MethodHandle methodHandle = callSite.dynamicInvoker();
try {
double sum = 0;
for ( double v : array ) {
sum = (double) methodHandle.invokeExact( sum, v ); // depends on control dependency: [for], data = [v]
}
return sum; // depends on control dependency: [try], data = [none]
} catch (Throwable throwable) {
return handle(Long.class, throwable, "Unable to perform reduceBy");
} // depends on control dependency: [catch], data = [none]
} catch (Exception ex) {
return reduceByR(array, object);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig
getCategoricalStatsConfig() {
if (typeCase_ == 2) {
return (com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig) type_;
}
return com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig
getCategoricalStatsConfig() {
if (typeCase_ == 2) {
return (com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig) type_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig.getDefaultInstance();
} } |
public class class_name {
final Serializable restoreMapObject(byte[] mapItemArray) throws IOException, ClassNotFoundException {
Serializable item = null;;
/* If it is a real byte array, we need to return a safe copy with the */
/* header bytes removed. */
if ((mapItemArray[0] == HEADER_BYTE_0) && (mapItemArray[1] == HEADER_BYTE_1)) {
item = new byte[mapItemArray.length - 2];
System.arraycopy(mapItemArray, 2, item, 0, ((byte[]) item).length);
}
/* Anything else needs deserializing. */
else {
ByteArrayInputStream bai = new ByteArrayInputStream(mapItemArray);
ObjectInputStream wsin = null;
if (RuntimeInfo.isThinClient() || RuntimeInfo.isFatClient()) {
//thin client environment. create ObjectInputStream from factory method.
//As of now getting twas factory class.
//Hard coding now.. once when Libery thin client get developed, this can be taken to a factory type class.
Class<?> clazz = Class.forName("com.ibm.ws.util.WsObjectInputStream");
try {
wsin = (ObjectInputStream) clazz.getConstructor(ByteArrayInputStream.class).newInstance(bai);
} catch (Exception e) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", e);
}
} else {
//Liberty server environment
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
@Override
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
});
wsin = new DeserializationObjectInputStream(bai, cl);
}
item = (Serializable) wsin.readObject();
try {
if (wsin != null) {
wsin.close();
}
} catch (IOException ex) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", ex);
}
}
return item;
} } | public class class_name {
final Serializable restoreMapObject(byte[] mapItemArray) throws IOException, ClassNotFoundException {
Serializable item = null;;
/* If it is a real byte array, we need to return a safe copy with the */
/* header bytes removed. */
if ((mapItemArray[0] == HEADER_BYTE_0) && (mapItemArray[1] == HEADER_BYTE_1)) {
item = new byte[mapItemArray.length - 2];
System.arraycopy(mapItemArray, 2, item, 0, ((byte[]) item).length);
}
/* Anything else needs deserializing. */
else {
ByteArrayInputStream bai = new ByteArrayInputStream(mapItemArray);
ObjectInputStream wsin = null;
if (RuntimeInfo.isThinClient() || RuntimeInfo.isFatClient()) {
//thin client environment. create ObjectInputStream from factory method.
//As of now getting twas factory class.
//Hard coding now.. once when Libery thin client get developed, this can be taken to a factory type class.
Class<?> clazz = Class.forName("com.ibm.ws.util.WsObjectInputStream");
try {
wsin = (ObjectInputStream) clazz.getConstructor(ByteArrayInputStream.class).newInstance(bai); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", e);
} // depends on control dependency: [catch], data = [none]
} else {
//Liberty server environment
ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
@Override
public ClassLoader run() {
return Thread.currentThread().getContextClassLoader();
}
});
wsin = new DeserializationObjectInputStream(bai, cl); // depends on control dependency: [if], data = [none]
}
item = (Serializable) wsin.readObject();
try {
if (wsin != null) {
wsin.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ex) {
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Exception closing the ObjectInputStream", ex);
} // depends on control dependency: [catch], data = [none]
}
return item;
} } |
public class class_name {
public EClass getGIMD() {
if (gimdEClass == null) {
gimdEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(453);
}
return gimdEClass;
} } | public class class_name {
public EClass getGIMD() {
if (gimdEClass == null) {
gimdEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(453); // depends on control dependency: [if], data = [none]
}
return gimdEClass;
} } |
public class class_name {
public void buildAllStatistics() {
for (Map<String,?> map : daoService.getAppsAndCountsToTreat()) {
// get the date of older SMS for this app and account
final Application application = (Application) map.get(Sms.PROP_APP);
final Account account = (Account) map.get(Sms.PROP_ACC);
final Date olderSmsDate = daoService.getDateOfOlderSmsByApplicationAndAccount(application, account);
// if there is not at least 1 sms in db for the specified app / account, the
// previous method returns null, so we have to check it.
if (olderSmsDate != null) {
// get the list of month where stats was not computed since the date of the older SMS in DB
for (Date monthToComputeStats : getListOfMarkerDateForNonComputedStats(application, account, olderSmsDate)) {
// compute the stats for this specific app, account and month
buildStatisticForAMonth(application, account, monthToComputeStats);
}
}
}
} } | public class class_name {
public void buildAllStatistics() {
for (Map<String,?> map : daoService.getAppsAndCountsToTreat()) {
// get the date of older SMS for this app and account
final Application application = (Application) map.get(Sms.PROP_APP);
final Account account = (Account) map.get(Sms.PROP_ACC);
final Date olderSmsDate = daoService.getDateOfOlderSmsByApplicationAndAccount(application, account);
// if there is not at least 1 sms in db for the specified app / account, the
// previous method returns null, so we have to check it.
if (olderSmsDate != null) {
// get the list of month where stats was not computed since the date of the older SMS in DB
for (Date monthToComputeStats : getListOfMarkerDateForNonComputedStats(application, account, olderSmsDate)) {
// compute the stats for this specific app, account and month
buildStatisticForAMonth(application, account, monthToComputeStats);
// depends on control dependency: [for], data = [monthToComputeStats]
}
}
}
} } |
public class class_name {
private void close(ManagedConnection mc)
{
log.debugf("Closing managed connection for recovery (%s)", mc);
if (mc != null)
{
try
{
mc.cleanup();
}
catch (ResourceException ire)
{
log.debugf("Error during recovery cleanup", ire);
}
}
if (mc != null)
{
try
{
mc.destroy();
}
catch (ResourceException ire)
{
log.debugf("Error during recovery destroy", ire);
}
}
// The managed connection for recovery is now gone
recoverMC = null;
} } | public class class_name {
private void close(ManagedConnection mc)
{
log.debugf("Closing managed connection for recovery (%s)", mc);
if (mc != null)
{
try
{
mc.cleanup(); // depends on control dependency: [try], data = [none]
}
catch (ResourceException ire)
{
log.debugf("Error during recovery cleanup", ire);
} // depends on control dependency: [catch], data = [none]
}
if (mc != null)
{
try
{
mc.destroy(); // depends on control dependency: [try], data = [none]
}
catch (ResourceException ire)
{
log.debugf("Error during recovery destroy", ire);
} // depends on control dependency: [catch], data = [none]
}
// The managed connection for recovery is now gone
recoverMC = null;
} } |
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
if ("RESIZE".equals(EVENT_TYPE)) {
resize();
redraw();
}else if ("REDRAW".equals(EVENT_TYPE)) {
redraw();
} else if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
Helper.enableNode(unitText, !gauge.getUnit().isEmpty());
redraw();
} else if ("RESIZE".equals(EVENT_TYPE)) {
resize();
} else if ("RECALC".equals(EVENT_TYPE)) {
if (Orientation.VERTICAL == orientation) {
width = height / aspectRatio;
stepSize = (0.79699248 * height) / gauge.getRange();
} else {
height = width / aspectRatio;
stepSize = (0.79699248 * width) / gauge.getRange();
}
resize();
redraw();
updateBar();
} else if ("FINISHED".equals(EVENT_TYPE)) {
barTooltip.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getValue()));
}
} } | public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
if ("RESIZE".equals(EVENT_TYPE)) {
resize(); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
}else if ("REDRAW".equals(EVENT_TYPE)) {
redraw(); // depends on control dependency: [if], data = [none]
} else if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !gauge.getTitle().isEmpty()); // depends on control dependency: [if], data = [none]
Helper.enableNode(unitText, !gauge.getUnit().isEmpty()); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
} else if ("RESIZE".equals(EVENT_TYPE)) {
resize(); // depends on control dependency: [if], data = [none]
} else if ("RECALC".equals(EVENT_TYPE)) {
if (Orientation.VERTICAL == orientation) {
width = height / aspectRatio; // depends on control dependency: [if], data = [none]
stepSize = (0.79699248 * height) / gauge.getRange(); // depends on control dependency: [if], data = [none]
} else {
height = width / aspectRatio; // depends on control dependency: [if], data = [none]
stepSize = (0.79699248 * width) / gauge.getRange(); // depends on control dependency: [if], data = [none]
}
resize(); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
updateBar(); // depends on control dependency: [if], data = [none]
} else if ("FINISHED".equals(EVENT_TYPE)) {
barTooltip.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getValue())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Optional<Board> getOptionalBoard(Object projectIdOrPath, Integer boardId) {
try {
return (Optional.ofNullable(getBoard(projectIdOrPath, boardId)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} } | public class class_name {
public Optional<Board> getOptionalBoard(Object projectIdOrPath, Integer boardId) {
try {
return (Optional.ofNullable(getBoard(projectIdOrPath, boardId))); // depends on control dependency: [try], data = [none]
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean next() {
while (true) {
currentSlot++;
if (!isOverflowing) { // not in an overflow block
// if it reached the end of the block
if (currentSlot >= currentPage.getNumRecords()) {
if (getSiblingFlag(currentPage) != -1) {
moveTo(getSiblingFlag(currentPage), -1);
continue;
}
return false;
// if the key of this slot match what we want
} else if (searchRange.match(getKey(currentPage, currentSlot, keyType.length()))) {
/*
* Move to records in overflow blocks first. An overflow block
* cannot be empty.
*/
if (currentSlot == 0 && getOverflowFlag(currentPage) != -1) {
isOverflowing = true;
overflowFrom = currentPage.currentBlk().number();
moveTo(getOverflowFlag(currentPage), 0);
}
return true;
} else if (searchRange.betweenMinAndMax(getKey(currentPage, currentSlot, keyType.length()))) {
continue;
} else
return false;
} else { // in an overflow block
// All the records in an overflow block have the same key
// so that we do not need to check the key in an overflow block.
if (currentSlot >= currentPage.getNumRecords()) {
moveTo(getOverflowFlag(currentPage), 0);
/*
* Move back to the first record in the regular block finally.
*/
if (currentPage.currentBlk().number() == overflowFrom) {
isOverflowing = false;
overflowFrom = -1;
}
}
return true;
}
}
} } | public class class_name {
public boolean next() {
while (true) {
currentSlot++;
// depends on control dependency: [while], data = [none]
if (!isOverflowing) { // not in an overflow block
// if it reached the end of the block
if (currentSlot >= currentPage.getNumRecords()) {
if (getSiblingFlag(currentPage) != -1) {
moveTo(getSiblingFlag(currentPage), -1);
// depends on control dependency: [if], data = [(getSiblingFlag(currentPage)]
continue;
}
return false;
// depends on control dependency: [if], data = [none]
// if the key of this slot match what we want
} else if (searchRange.match(getKey(currentPage, currentSlot, keyType.length()))) {
/*
* Move to records in overflow blocks first. An overflow block
* cannot be empty.
*/
if (currentSlot == 0 && getOverflowFlag(currentPage) != -1) {
isOverflowing = true;
// depends on control dependency: [if], data = [none]
overflowFrom = currentPage.currentBlk().number();
// depends on control dependency: [if], data = [none]
moveTo(getOverflowFlag(currentPage), 0);
// depends on control dependency: [if], data = [none]
}
return true;
// depends on control dependency: [if], data = [none]
} else if (searchRange.betweenMinAndMax(getKey(currentPage, currentSlot, keyType.length()))) {
continue;
} else
return false;
} else { // in an overflow block
// All the records in an overflow block have the same key
// so that we do not need to check the key in an overflow block.
if (currentSlot >= currentPage.getNumRecords()) {
moveTo(getOverflowFlag(currentPage), 0);
// depends on control dependency: [if], data = [none]
/*
* Move back to the first record in the regular block finally.
*/
if (currentPage.currentBlk().number() == overflowFrom) {
isOverflowing = false;
// depends on control dependency: [if], data = [none]
overflowFrom = -1;
// depends on control dependency: [if], data = [none]
}
}
return true;
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void organizeContent()
{
table = new TableBox(el, g, ctx);
table.adoptParent(this);
table.setStyle(style);
for (Iterator<Box> it = nested.iterator(); it.hasNext(); )
{
Box box = it.next();
if (box instanceof TableCaptionBox)
{
caption = (TableCaptionBox) box;
}
else if (box instanceof BlockBox && ((BlockBox) box).isPositioned())
{
//positioned boxes are ignored
}
else //other elements belong to the table itself
{
table.addSubBox(box);
box.setContainingBlockBox(table);
box.setParent(table);
it.remove();
endChild--;
}
}
addSubBox(table);
} } | public class class_name {
private void organizeContent()
{
table = new TableBox(el, g, ctx);
table.adoptParent(this);
table.setStyle(style);
for (Iterator<Box> it = nested.iterator(); it.hasNext(); )
{
Box box = it.next();
if (box instanceof TableCaptionBox)
{
caption = (TableCaptionBox) box; // depends on control dependency: [if], data = [none]
}
else if (box instanceof BlockBox && ((BlockBox) box).isPositioned())
{
//positioned boxes are ignored
}
else //other elements belong to the table itself
{
table.addSubBox(box); // depends on control dependency: [if], data = [none]
box.setContainingBlockBox(table); // depends on control dependency: [if], data = [none]
box.setParent(table); // depends on control dependency: [if], data = [none]
it.remove(); // depends on control dependency: [if], data = [none]
endChild--; // depends on control dependency: [if], data = [none]
}
}
addSubBox(table);
} } |
public class class_name {
private void enforceCorrectEncodingOfRequest() {
String charset = NinjaConstant.UTF_8;
String contentType = getHeader(CONTENT_TYPE);
if (contentType != null) {
charset = HttpHeaderUtils.getCharsetOfContentTypeOrUtf8(contentType);
}
try {
httpServletRequest.setCharacterEncoding(charset);
} catch (UnsupportedEncodingException e) {
logger.error("Server does not support charset of content type: " + contentType);
}
} } | public class class_name {
private void enforceCorrectEncodingOfRequest() {
String charset = NinjaConstant.UTF_8;
String contentType = getHeader(CONTENT_TYPE);
if (contentType != null) {
charset = HttpHeaderUtils.getCharsetOfContentTypeOrUtf8(contentType); // depends on control dependency: [if], data = [(contentType]
}
try {
httpServletRequest.setCharacterEncoding(charset); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
logger.error("Server does not support charset of content type: " + contentType);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean checkAndLogPropertyDeprecated(HazelcastProperties properties, HazelcastProperty hazelcastProperty) {
if (properties.containsKey(hazelcastProperty)) {
LOGGER.warning(
"Property " + hazelcastProperty.getName() + " is deprecated. Use configuration object/element instead.");
return properties.getBoolean(hazelcastProperty);
}
return false;
} } | public class class_name {
public static boolean checkAndLogPropertyDeprecated(HazelcastProperties properties, HazelcastProperty hazelcastProperty) {
if (properties.containsKey(hazelcastProperty)) {
LOGGER.warning(
"Property " + hazelcastProperty.getName() + " is deprecated. Use configuration object/element instead."); // depends on control dependency: [if], data = [none]
return properties.getBoolean(hazelcastProperty); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private static double computeWastedSpace(
double maxSizeX, double maxSizeY, double aspect)
{
int maxAspectX = (int) (maxSizeY * aspect);
int maxAspectY = (int) (maxSizeX / aspect);
if (maxAspectX > maxSizeX)
{
double sizeX = maxSizeX;
double sizeY = maxAspectY;
double waste = maxSizeY - sizeY;
return waste * sizeX;
}
double sizeX = maxAspectX;
double sizeY = maxSizeY;
double waste = maxSizeX - sizeX;
return waste * sizeY;
} } | public class class_name {
private static double computeWastedSpace(
double maxSizeX, double maxSizeY, double aspect)
{
int maxAspectX = (int) (maxSizeY * aspect);
int maxAspectY = (int) (maxSizeX / aspect);
if (maxAspectX > maxSizeX)
{
double sizeX = maxSizeX;
double sizeY = maxAspectY;
double waste = maxSizeY - sizeY;
return waste * sizeX;
// depends on control dependency: [if], data = [none]
}
double sizeX = maxAspectX;
double sizeY = maxSizeY;
double waste = maxSizeX - sizeX;
return waste * sizeY;
} } |
public class class_name {
public void reportSuccess() {
connectionLock.lock();
try {
state = State.Success;
condition.signalAll();
}
finally {
connectionLock.unlock();
}
} } | public class class_name {
public void reportSuccess() {
connectionLock.lock();
try {
state = State.Success; // depends on control dependency: [try], data = [none]
condition.signalAll(); // depends on control dependency: [try], data = [none]
}
finally {
connectionLock.unlock();
}
} } |
public class class_name {
public static DMatrixRMaj checkZerosLT(DMatrixRMaj A , int numRows , int numCols) {
if( A == null ) {
return new DMatrixRMaj(numRows,numCols);
} else if( numRows != A.numRows || numCols != A.numCols ) {
A.reshape(numRows,numCols);
A.zero();
} else {
for( int i = 0; i < A.numRows; i++ ) {
int index = i*A.numCols;
int end = index + Math.min(i,A.numCols);;
while( index < end ) {
A.data[index++] = 0;
}
}
}
return A;
} } | public class class_name {
public static DMatrixRMaj checkZerosLT(DMatrixRMaj A , int numRows , int numCols) {
if( A == null ) {
return new DMatrixRMaj(numRows,numCols); // depends on control dependency: [if], data = [none]
} else if( numRows != A.numRows || numCols != A.numCols ) {
A.reshape(numRows,numCols); // depends on control dependency: [if], data = [none]
A.zero(); // depends on control dependency: [if], data = [none]
} else {
for( int i = 0; i < A.numRows; i++ ) {
int index = i*A.numCols;
int end = index + Math.min(i,A.numCols);;
while( index < end ) {
A.data[index++] = 0; // depends on control dependency: [while], data = [none]
}
}
}
return A;
} } |
public class class_name {
private static Response getApiResponse(Verbs verb, String methodName, Map<String, String> params) throws IOException {
Response response;
String apiResourceUrl = Constants.OEMBED_URL + methodName;
OAuthRequest request = new OAuthRequest(verb, apiResourceUrl);
// Additional parameters in url
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
if (verb == Verbs.GET) {
request.addQuerystringParameter(entry.getKey(), entry.getValue());
} else {
request.addBodyParameter(entry.getKey(), entry.getValue());
}
}
}
response = request.send();
return response;
} } | public class class_name {
private static Response getApiResponse(Verbs verb, String methodName, Map<String, String> params) throws IOException {
Response response;
String apiResourceUrl = Constants.OEMBED_URL + methodName;
OAuthRequest request = new OAuthRequest(verb, apiResourceUrl);
// Additional parameters in url
if (params != null) {
for (Map.Entry<String, String> entry : params.entrySet()) {
if (verb == Verbs.GET) {
request.addQuerystringParameter(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
} else {
request.addBodyParameter(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
response = request.send();
return response;
} } |
public class class_name {
public List<Alternatives<BeansDescriptor>> getAllAlternatives()
{
List<Alternatives<BeansDescriptor>> list = new ArrayList<Alternatives<BeansDescriptor>>();
List<Node> nodeList = model.get("alternatives");
for (Node node : nodeList)
{
Alternatives<BeansDescriptor> type = new AlternativesImpl<BeansDescriptor>(this, "alternatives", model, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<Alternatives<BeansDescriptor>> getAllAlternatives()
{
List<Alternatives<BeansDescriptor>> list = new ArrayList<Alternatives<BeansDescriptor>>();
List<Node> nodeList = model.get("alternatives");
for (Node node : nodeList)
{
Alternatives<BeansDescriptor> type = new AlternativesImpl<BeansDescriptor>(this, "alternatives", model, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public void setLastSuccessfullyAppliedConfigurations(java.util.Collection<Configuration> lastSuccessfullyAppliedConfigurations) {
if (lastSuccessfullyAppliedConfigurations == null) {
this.lastSuccessfullyAppliedConfigurations = null;
return;
}
this.lastSuccessfullyAppliedConfigurations = new com.amazonaws.internal.SdkInternalList<Configuration>(lastSuccessfullyAppliedConfigurations);
} } | public class class_name {
public void setLastSuccessfullyAppliedConfigurations(java.util.Collection<Configuration> lastSuccessfullyAppliedConfigurations) {
if (lastSuccessfullyAppliedConfigurations == null) {
this.lastSuccessfullyAppliedConfigurations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.lastSuccessfullyAppliedConfigurations = new com.amazonaws.internal.SdkInternalList<Configuration>(lastSuccessfullyAppliedConfigurations);
} } |
public class class_name {
public void setGroupedResourceCounts(java.util.Collection<GroupedResourceCount> groupedResourceCounts) {
if (groupedResourceCounts == null) {
this.groupedResourceCounts = null;
return;
}
this.groupedResourceCounts = new com.amazonaws.internal.SdkInternalList<GroupedResourceCount>(groupedResourceCounts);
} } | public class class_name {
public void setGroupedResourceCounts(java.util.Collection<GroupedResourceCount> groupedResourceCounts) {
if (groupedResourceCounts == null) {
this.groupedResourceCounts = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.groupedResourceCounts = new com.amazonaws.internal.SdkInternalList<GroupedResourceCount>(groupedResourceCounts);
} } |
public class class_name {
public String getMinDateLastModified() {
if (m_searchParams.getMinDateLastModified() == Long.MIN_VALUE) {
return "";
}
return Long.toString(m_searchParams.getMinDateLastModified());
} } | public class class_name {
public String getMinDateLastModified() {
if (m_searchParams.getMinDateLastModified() == Long.MIN_VALUE) {
return ""; // depends on control dependency: [if], data = [none]
}
return Long.toString(m_searchParams.getMinDateLastModified());
} } |
public class class_name {
public static String process(String input, List<Replacer> replacers) {
if (null == input) { return null; }
for (Replacer replacer : replacers) {
input = replacer.process(input);
}
return input;
} } | public class class_name {
public static String process(String input, List<Replacer> replacers) {
if (null == input) { return null; } // depends on control dependency: [if], data = [none]
for (Replacer replacer : replacers) {
input = replacer.process(input); // depends on control dependency: [for], data = [replacer]
}
return input;
} } |
public class class_name {
protected int countComponentContainPaxWicketBeanAnnotatedOneLevel(Class<?> component) {
Class<?> clazz = component;
int numberOfInjectionFields = 0;
for (Field field : clazz.getDeclaredFields()) {
if (field.isAnnotationPresent(Inject.class)) {
numberOfInjectionFields++;
}
}
return numberOfInjectionFields;
} } | public class class_name {
protected int countComponentContainPaxWicketBeanAnnotatedOneLevel(Class<?> component) {
Class<?> clazz = component;
int numberOfInjectionFields = 0;
for (Field field : clazz.getDeclaredFields()) {
if (field.isAnnotationPresent(Inject.class)) {
numberOfInjectionFields++; // depends on control dependency: [if], data = [none]
}
}
return numberOfInjectionFields;
} } |
public class class_name {
public void updateNodeForId(final CmsUUID id) {
final List<CmsSitemapTreeNode> nodes = Lists.newArrayList();
CmsVaadinUtils.visitDescendants(m_currentRootNode, new Predicate<Component>() {
public boolean apply(Component input) {
if (input instanceof CmsSitemapTreeNode) {
CmsSitemapTreeNode node = (CmsSitemapTreeNode)input;
CmsSitemapTreeNodeData data = (CmsSitemapTreeNodeData)node.getData();
if (data.getResource().getStructureId().equals(id)) {
nodes.add(node);
return false;
}
}
return true;
}
});
if (nodes.size() == 1) {
updateNode(nodes.get(0));
}
} } | public class class_name {
public void updateNodeForId(final CmsUUID id) {
final List<CmsSitemapTreeNode> nodes = Lists.newArrayList();
CmsVaadinUtils.visitDescendants(m_currentRootNode, new Predicate<Component>() {
public boolean apply(Component input) {
if (input instanceof CmsSitemapTreeNode) {
CmsSitemapTreeNode node = (CmsSitemapTreeNode)input;
CmsSitemapTreeNodeData data = (CmsSitemapTreeNodeData)node.getData();
if (data.getResource().getStructureId().equals(id)) {
nodes.add(node); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
}
});
if (nodes.size() == 1) {
updateNode(nodes.get(0)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int[] createIntArray(Integer[] integers) {
int[] result;
if (integers != null) {
int count = 0;
int inputLength = integers.length;
int[] tempResult = new int[inputLength];
for (int i = 0; i < inputLength; i++) {
if (integers[i] != null) {
tempResult[count] = integers[i].intValue();
count++;
}
}
result = tempResult;
if (count != inputLength) {
result = new int[count];
System.arraycopy(tempResult, 0, result, 0, count);
}
} else {
result = null;
}
return result;
} } | public class class_name {
public int[] createIntArray(Integer[] integers) {
int[] result;
if (integers != null) {
int count = 0;
int inputLength = integers.length;
int[] tempResult = new int[inputLength];
for (int i = 0; i < inputLength; i++) {
if (integers[i] != null) {
tempResult[count] = integers[i].intValue(); // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
}
result = tempResult; // depends on control dependency: [if], data = [none]
if (count != inputLength) {
result = new int[count]; // depends on control dependency: [if], data = [none]
System.arraycopy(tempResult, 0, result, 0, count); // depends on control dependency: [if], data = [none]
}
} else {
result = null; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void writeBufferedValsToStorage() {
List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,
currBufferedVals);
// log Obsolete versions in debug mode
if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {
logger.debug("updateEntries (Streaming multi-version-put) rejected these versions as obsolete : "
+ StoreUtils.getVersions(obsoleteVals) + " for key " + currBufferedKey);
}
currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);
} } | public class class_name {
private void writeBufferedValsToStorage() {
List<Versioned<byte[]>> obsoleteVals = storageEngine.multiVersionPut(currBufferedKey,
currBufferedVals);
// log Obsolete versions in debug mode
if(logger.isDebugEnabled() && obsoleteVals.size() > 0) {
logger.debug("updateEntries (Streaming multi-version-put) rejected these versions as obsolete : "
+ StoreUtils.getVersions(obsoleteVals) + " for key " + currBufferedKey); // depends on control dependency: [if], data = [none]
}
currBufferedVals = new ArrayList<Versioned<byte[]>>(VALS_BUFFER_EXPECTED_SIZE);
} } |
public class class_name {
private Thumb evalPressedThumb(float touchX) {
Thumb result = null;
boolean minThumbPressed = isInThumbRange(touchX, normalizedMinValue);
boolean maxThumbPressed = isInThumbRange(touchX, normalizedMaxValue);
if (minThumbPressed && maxThumbPressed) {
// if both thumbs are pressed (they lie on top of each other), choose the one with more room to drag. this avoids "stalling" the thumbs in a corner, not being able to drag them apart anymore.
result = (touchX / getWidth() > 0.5f) ? Thumb.MIN : Thumb.MAX;
} else if (minThumbPressed) {
result = Thumb.MIN;
} else if (maxThumbPressed) {
result = Thumb.MAX;
}
return result;
} } | public class class_name {
private Thumb evalPressedThumb(float touchX) {
Thumb result = null;
boolean minThumbPressed = isInThumbRange(touchX, normalizedMinValue);
boolean maxThumbPressed = isInThumbRange(touchX, normalizedMaxValue);
if (minThumbPressed && maxThumbPressed) {
// if both thumbs are pressed (they lie on top of each other), choose the one with more room to drag. this avoids "stalling" the thumbs in a corner, not being able to drag them apart anymore.
result = (touchX / getWidth() > 0.5f) ? Thumb.MIN : Thumb.MAX; // depends on control dependency: [if], data = [none]
} else if (minThumbPressed) {
result = Thumb.MIN; // depends on control dependency: [if], data = [none]
} else if (maxThumbPressed) {
result = Thumb.MAX; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public void applyToFormatters(
Map<CmsUUID, I_CmsFormatterBean> formatters,
CmsFormatterConfigurationCacheState externalFormatters) {
if (m_removeAllNonExplicitlyAdded) {
formatters.clear();
}
for (Map.Entry<CmsUUID, Boolean> updateEntry : m_updateSet.entrySet()) {
CmsUUID key = updateEntry.getKey();
Boolean value = updateEntry.getValue();
if (value.booleanValue()) {
I_CmsFormatterBean addedFormatter = externalFormatters.getFormatters().get(key);
if (addedFormatter != null) {
formatters.put(key, addedFormatter);
}
} else {
formatters.remove(key);
}
}
if (m_pathPattern != null) {
// remove all formatters where the location path does not match the path pattern, this prevents cross site formatter use
Iterator<Entry<CmsUUID, I_CmsFormatterBean>> formattersIt = formatters.entrySet().iterator();
while (formattersIt.hasNext()) {
Entry<CmsUUID, I_CmsFormatterBean> entry = formattersIt.next();
if ((entry.getValue().getLocation() != null)
&& !m_pathPattern.matcher(entry.getValue().getLocation()).matches()) {
formattersIt.remove();
}
}
}
} } | public class class_name {
public void applyToFormatters(
Map<CmsUUID, I_CmsFormatterBean> formatters,
CmsFormatterConfigurationCacheState externalFormatters) {
if (m_removeAllNonExplicitlyAdded) {
formatters.clear(); // depends on control dependency: [if], data = [none]
}
for (Map.Entry<CmsUUID, Boolean> updateEntry : m_updateSet.entrySet()) {
CmsUUID key = updateEntry.getKey();
Boolean value = updateEntry.getValue();
if (value.booleanValue()) {
I_CmsFormatterBean addedFormatter = externalFormatters.getFormatters().get(key);
if (addedFormatter != null) {
formatters.put(key, addedFormatter); // depends on control dependency: [if], data = [none]
}
} else {
formatters.remove(key); // depends on control dependency: [if], data = [none]
}
}
if (m_pathPattern != null) {
// remove all formatters where the location path does not match the path pattern, this prevents cross site formatter use
Iterator<Entry<CmsUUID, I_CmsFormatterBean>> formattersIt = formatters.entrySet().iterator();
while (formattersIt.hasNext()) {
Entry<CmsUUID, I_CmsFormatterBean> entry = formattersIt.next();
if ((entry.getValue().getLocation() != null)
&& !m_pathPattern.matcher(entry.getValue().getLocation()).matches()) {
formattersIt.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static String toHumanReadableSize(final long pSizeInBytes) {
// TODO: Rewrite to use String.format?
if (pSizeInBytes < 1024L) {
return pSizeInBytes + " Bytes";
}
else if (pSizeInBytes < (1024L << 10)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L)) + " KB";
}
else if (pSizeInBytes < (1024L << 20)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 10)) + " MB";
}
else if (pSizeInBytes < (1024L << 30)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 20)) + " GB";
}
else if (pSizeInBytes < (1024L << 40)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 30)) + " TB";
}
else {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 40)) + " PB";
}
} } | public class class_name {
public static String toHumanReadableSize(final long pSizeInBytes) {
// TODO: Rewrite to use String.format?
if (pSizeInBytes < 1024L) {
return pSizeInBytes + " Bytes";
// depends on control dependency: [if], data = [none]
}
else if (pSizeInBytes < (1024L << 10)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L)) + " KB";
// depends on control dependency: [if], data = [(pSizeInBytes]
}
else if (pSizeInBytes < (1024L << 20)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 10)) + " MB";
// depends on control dependency: [if], data = [(pSizeInBytes]
}
else if (pSizeInBytes < (1024L << 30)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 20)) + " GB";
// depends on control dependency: [if], data = [(pSizeInBytes]
}
else if (pSizeInBytes < (1024L << 40)) {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 30)) + " TB";
// depends on control dependency: [if], data = [(pSizeInBytes]
}
else {
return getSizeFormat().format(pSizeInBytes / (double) (1024L << 40)) + " PB";
// depends on control dependency: [if], data = [(pSizeInBytes]
}
} } |
public class class_name {
private void readParamsFromFile()
{
if (initParams != null)
{
ValueParam valParam = initParams.getValueParam(ADMIN_INDENTITY);
if (valParam != null)
{
adminIdentity = valParam.getValue();
LOG.info("Admin identity is read from configuration file");
}
ValueParam defaultIdentityParam = initParams.getValueParam(DEFAULT_INDENTITY);
if (defaultIdentityParam != null)
{
defaultIdentity = defaultIdentityParam.getValue();
LOG.info("Default identity is read from configuration file");
}
}
checkParams();
} } | public class class_name {
private void readParamsFromFile()
{
if (initParams != null)
{
ValueParam valParam = initParams.getValueParam(ADMIN_INDENTITY);
if (valParam != null)
{
adminIdentity = valParam.getValue(); // depends on control dependency: [if], data = [none]
LOG.info("Admin identity is read from configuration file"); // depends on control dependency: [if], data = [none]
}
ValueParam defaultIdentityParam = initParams.getValueParam(DEFAULT_INDENTITY);
if (defaultIdentityParam != null)
{
defaultIdentity = defaultIdentityParam.getValue(); // depends on control dependency: [if], data = [none]
LOG.info("Default identity is read from configuration file"); // depends on control dependency: [if], data = [none]
}
}
checkParams();
} } |
public class class_name {
@CanIgnoreReturnValue
public ServiceManager startAsync() {
for (Service service : services) {
State state = service.state();
checkState(state == NEW, "Service %s is %s, cannot start it.", service, state);
}
for (Service service : services) {
try {
state.tryStartTiming(service);
service.startAsync();
} catch (IllegalStateException e) {
// This can happen if the service has already been started or stopped (e.g. by another
// service or listener). Our contract says it is safe to call this method if
// all services were NEW when it was called, and this has already been verified above, so we
// don't propagate the exception.
logger.log(Level.WARNING, "Unable to start Service " + service, e);
}
}
return this;
} } | public class class_name {
@CanIgnoreReturnValue
public ServiceManager startAsync() {
for (Service service : services) {
State state = service.state();
checkState(state == NEW, "Service %s is %s, cannot start it.", service, state); // depends on control dependency: [for], data = [service]
}
for (Service service : services) {
try {
state.tryStartTiming(service); // depends on control dependency: [try], data = [none]
service.startAsync(); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException e) {
// This can happen if the service has already been started or stopped (e.g. by another
// service or listener). Our contract says it is safe to call this method if
// all services were NEW when it was called, and this has already been verified above, so we
// don't propagate the exception.
logger.log(Level.WARNING, "Unable to start Service " + service, e);
} // depends on control dependency: [catch], data = [none]
}
return this;
} } |
public class class_name {
static byte[] encode(int count) {
// 计算需要填充的位数
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
if (amountToPad == 0) {
amountToPad = BLOCK_SIZE;
}
// 获得补位所用的字符
char padChr = chr(amountToPad);
String tmp = new String();
for (int index = 0; index < amountToPad; index++) {
tmp += padChr;
}
return tmp.getBytes(CHARSET);
} } | public class class_name {
static byte[] encode(int count) {
// 计算需要填充的位数
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
if (amountToPad == 0) {
amountToPad = BLOCK_SIZE;
// depends on control dependency: [if], data = [none]
}
// 获得补位所用的字符
char padChr = chr(amountToPad);
String tmp = new String();
for (int index = 0; index < amountToPad; index++) {
tmp += padChr;
// depends on control dependency: [for], data = [none]
}
return tmp.getBytes(CHARSET);
} } |
public class class_name {
public static void applyTransform(GrayS8 input , int transform[] , int minValue, GrayS8 output ) {
output.reshape(input.width,input.height);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplEnhanceHistogram_MT.applyTransform(input, transform, minValue, output);
} else {
ImplEnhanceHistogram.applyTransform(input, transform, minValue, output);
}
} } | public class class_name {
public static void applyTransform(GrayS8 input , int transform[] , int minValue, GrayS8 output ) {
output.reshape(input.width,input.height);
if( BoofConcurrency.USE_CONCURRENT ) {
ImplEnhanceHistogram_MT.applyTransform(input, transform, minValue, output); // depends on control dependency: [if], data = [none]
} else {
ImplEnhanceHistogram.applyTransform(input, transform, minValue, output); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Iterator<BufferedRow> initialize() {
// Load everthing into the buffer ...
batchSize = loadAll(delegate, extractor, rowsWithNullKey);
remainingRowCount.set(buffer.size() + rowsWithNullKey.size());
// We always return the buffered rows in ascending order of the extracted key ...
if (rowsWithNullKey.isEmpty()) {
return buffer.ascending();
}
// Return the rows with NULL first ...
assert nullOrder != null;
switch (nullOrder) {
case NULLS_FIRST:
return SequentialIterator.create(rowsWithNullKey.iterator(), buffer.ascending());
case NULLS_LAST:
return SequentialIterator.create(buffer.ascending(), rowsWithNullKey.iterator());
}
assert false;
return null;
} } | public class class_name {
protected Iterator<BufferedRow> initialize() {
// Load everthing into the buffer ...
batchSize = loadAll(delegate, extractor, rowsWithNullKey);
remainingRowCount.set(buffer.size() + rowsWithNullKey.size());
// We always return the buffered rows in ascending order of the extracted key ...
if (rowsWithNullKey.isEmpty()) {
return buffer.ascending(); // depends on control dependency: [if], data = [none]
}
// Return the rows with NULL first ...
assert nullOrder != null;
switch (nullOrder) {
case NULLS_FIRST:
return SequentialIterator.create(rowsWithNullKey.iterator(), buffer.ascending());
case NULLS_LAST:
return SequentialIterator.create(buffer.ascending(), rowsWithNullKey.iterator());
}
assert false;
return null;
} } |
public class class_name {
private int parseInteger(String value, int defaultValue)
{
try
{
return Integer.parseInt(value);
}
catch (NumberFormatException e)
{
return defaultValue;
}
} } | public class class_name {
private int parseInteger(String value, int defaultValue)
{
try
{
return Integer.parseInt(value); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e)
{
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void calculate(LPC lpc, long[] R) {
int coeffCount = lpc.order;
//calculate first iteration directly
double[] A = lpc.rawCoefficients;
for(int i = 0; i < coeffCount+1; i++) A[i] = 0.0;
A[0] = 1;
double E = R[0];
//calculate remaining iterations
if(R[0] == 0) {
for(int i = 0; i < coeffCount+1; i++)
A[i] = 0.0;
}
else {
double[] ATemp = lpc.tempCoefficients;
for(int i = 0; i < coeffCount+1; i++) ATemp[i] = 0.0;
for(int k = 0; k < coeffCount; k++) {
double lambda = 0.0;
double temp = 0;
for(int j = 0; j <= k; j++) {
temp += A[j]*R[k+1-j];
}
lambda = -temp/E;
for(int i = 0; i <= k+1; i++) {
ATemp[i] = A[i]+lambda*A[k+1-i];
}
System.arraycopy(ATemp, 0, A, 0, coeffCount+1);
E = (1-lambda*lambda)*E;
}
}
lpc.rawError = E;
} } | public class class_name {
public static void calculate(LPC lpc, long[] R) {
int coeffCount = lpc.order;
//calculate first iteration directly
double[] A = lpc.rawCoefficients;
for(int i = 0; i < coeffCount+1; i++) A[i] = 0.0;
A[0] = 1;
double E = R[0];
//calculate remaining iterations
if(R[0] == 0) {
for(int i = 0; i < coeffCount+1; i++)
A[i] = 0.0;
}
else {
double[] ATemp = lpc.tempCoefficients;
for(int i = 0; i < coeffCount+1; i++) ATemp[i] = 0.0;
for(int k = 0; k < coeffCount; k++) {
double lambda = 0.0;
double temp = 0;
for(int j = 0; j <= k; j++) {
temp += A[j]*R[k+1-j]; // depends on control dependency: [for], data = [j]
}
lambda = -temp/E; // depends on control dependency: [for], data = [none]
for(int i = 0; i <= k+1; i++) {
ATemp[i] = A[i]+lambda*A[k+1-i]; // depends on control dependency: [for], data = [i]
}
System.arraycopy(ATemp, 0, A, 0, coeffCount+1); // depends on control dependency: [for], data = [none]
E = (1-lambda*lambda)*E; // depends on control dependency: [for], data = [none]
}
}
lpc.rawError = E;
} } |
public class class_name {
public FastDoubleBuffer append(final FastDoubleBuffer buff) {
if (buff.offset == 0) {
return this;
}
append(buff.buffer, 0, buff.offset);
return this;
} } | public class class_name {
public FastDoubleBuffer append(final FastDoubleBuffer buff) {
if (buff.offset == 0) {
return this; // depends on control dependency: [if], data = [none]
}
append(buff.buffer, 0, buff.offset);
return this;
} } |
public class class_name {
public <D, F, P> Promise<D, F, P> when(Promise<D, F, P> promise, AndroidExecutionScope scope) {
if (promise instanceof AndroidDeferredObject) {
return promise;
}
return new AndroidDeferredObject<D, F, P>(promise, scope).promise();
} } | public class class_name {
public <D, F, P> Promise<D, F, P> when(Promise<D, F, P> promise, AndroidExecutionScope scope) {
if (promise instanceof AndroidDeferredObject) {
return promise; // depends on control dependency: [if], data = [none]
}
return new AndroidDeferredObject<D, F, P>(promise, scope).promise();
} } |
public class class_name {
public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) {
IBasicScope current = from;
while (current.hasParent()) {
current = current.getParent();
if (current.equals(ancestor)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean isAncestor(IBasicScope from, IBasicScope ancestor) {
IBasicScope current = from;
while (current.hasParent()) {
current = current.getParent(); // depends on control dependency: [while], data = [none]
if (current.equals(ancestor)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private String getSubPath(CmsObject cms, CmsResource xmlPage, String resourcename) {
if (xmlPage != null) {
String rootPath = cms.getRequestContext().addSiteRoot(resourcename);
String path = rootPath.substring(xmlPage.getRootPath().length());
if (path.startsWith("/")) {
path = path.substring(1);
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1);
}
return path;
}
return null;
} } | public class class_name {
private String getSubPath(CmsObject cms, CmsResource xmlPage, String resourcename) {
if (xmlPage != null) {
String rootPath = cms.getRequestContext().addSiteRoot(resourcename);
String path = rootPath.substring(xmlPage.getRootPath().length());
if (path.startsWith("/")) {
path = path.substring(1); // depends on control dependency: [if], data = [none]
}
if (path.endsWith("/")) {
path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none]
}
return path; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException {
/*
* The following valuation code requires in-depth knowledge of the model to calculate the denstiy analytically.
*/
BlackScholesModel blackScholesModel = null;
if(model instanceof MonteCarloAssetModel) {
try {
blackScholesModel = (BlackScholesModel)((MonteCarloAssetModel)model).getModel();
}
catch(Exception e) {}
}
else if(model instanceof MonteCarloBlackScholesModel) {
blackScholesModel = ((MonteCarloBlackScholesModel)model).getModel();
}
if(model == null) {
throw new ClassCastException("This method requires a Black-Scholes type model (MonteCarloBlackScholesModel).");
}
// Get underlying and numeraire
RandomVariable underlyingAtMaturity = model.getAssetValue(maturity,0);
RandomVariable underlyingAtToday = model.getAssetValue(0.0,0);
// Get some model parameters
double T = maturity-evaluationTime;
double r = blackScholesModel.getRiskFreeRate().doubleValue();
double sigma = blackScholesModel.getVolatility().doubleValue();
RandomVariable lr = underlyingAtMaturity.log().sub(underlyingAtToday.log()).sub(r * T - 0.5 * sigma*sigma * T).div(sigma * sigma * T).div(underlyingAtToday);
RandomVariable payoff = underlyingAtMaturity.sub(strike).choose(new Scalar(1.0), new Scalar(0.0));
RandomVariable modifiedPayoff = payoff.mult(lr);
RandomVariable numeraireAtMaturity = model.getNumeraire(maturity);
RandomVariable numeraireAtToday = model.getNumeraire(0);
RandomVariable monteCarloWeightsAtMaturity = model.getMonteCarloWeights(maturity);
RandomVariable monteCarloWeightsAtToday = model.getMonteCarloWeights(maturity);
return modifiedPayoff.div(numeraireAtMaturity).mult(numeraireAtToday).mult(monteCarloWeightsAtMaturity).div(monteCarloWeightsAtToday);
} } | public class class_name {
@Override
public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException {
/*
* The following valuation code requires in-depth knowledge of the model to calculate the denstiy analytically.
*/
BlackScholesModel blackScholesModel = null;
if(model instanceof MonteCarloAssetModel) {
try {
blackScholesModel = (BlackScholesModel)((MonteCarloAssetModel)model).getModel(); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {} // depends on control dependency: [catch], data = [none]
}
else if(model instanceof MonteCarloBlackScholesModel) {
blackScholesModel = ((MonteCarloBlackScholesModel)model).getModel();
}
if(model == null) {
throw new ClassCastException("This method requires a Black-Scholes type model (MonteCarloBlackScholesModel).");
}
// Get underlying and numeraire
RandomVariable underlyingAtMaturity = model.getAssetValue(maturity,0);
RandomVariable underlyingAtToday = model.getAssetValue(0.0,0);
// Get some model parameters
double T = maturity-evaluationTime;
double r = blackScholesModel.getRiskFreeRate().doubleValue();
double sigma = blackScholesModel.getVolatility().doubleValue();
RandomVariable lr = underlyingAtMaturity.log().sub(underlyingAtToday.log()).sub(r * T - 0.5 * sigma*sigma * T).div(sigma * sigma * T).div(underlyingAtToday);
RandomVariable payoff = underlyingAtMaturity.sub(strike).choose(new Scalar(1.0), new Scalar(0.0));
RandomVariable modifiedPayoff = payoff.mult(lr);
RandomVariable numeraireAtMaturity = model.getNumeraire(maturity);
RandomVariable numeraireAtToday = model.getNumeraire(0);
RandomVariable monteCarloWeightsAtMaturity = model.getMonteCarloWeights(maturity);
RandomVariable monteCarloWeightsAtToday = model.getMonteCarloWeights(maturity);
return modifiedPayoff.div(numeraireAtMaturity).mult(numeraireAtToday).mult(monteCarloWeightsAtMaturity).div(monteCarloWeightsAtToday);
} } |
public class class_name {
@Override
protected void findReferencedClassNames(final Set<String> classNames) {
final MethodTypeSignature methodSig = getTypeSignature();
if (methodSig != null) {
methodSig.findReferencedClassNames(classNames);
}
final MethodTypeSignature methodDesc = getTypeDescriptor();
if (methodDesc != null) {
methodDesc.findReferencedClassNames(classNames);
}
if (annotationInfo != null) {
for (final AnnotationInfo ai : annotationInfo) {
ai.findReferencedClassNames(classNames);
}
}
for (final MethodParameterInfo mpi : getParameterInfo()) {
final AnnotationInfo[] aiArr = mpi.annotationInfo;
if (aiArr != null) {
for (final AnnotationInfo ai : aiArr) {
ai.findReferencedClassNames(classNames);
}
}
}
} } | public class class_name {
@Override
protected void findReferencedClassNames(final Set<String> classNames) {
final MethodTypeSignature methodSig = getTypeSignature();
if (methodSig != null) {
methodSig.findReferencedClassNames(classNames); // depends on control dependency: [if], data = [none]
}
final MethodTypeSignature methodDesc = getTypeDescriptor();
if (methodDesc != null) {
methodDesc.findReferencedClassNames(classNames); // depends on control dependency: [if], data = [none]
}
if (annotationInfo != null) {
for (final AnnotationInfo ai : annotationInfo) {
ai.findReferencedClassNames(classNames); // depends on control dependency: [for], data = [ai]
}
}
for (final MethodParameterInfo mpi : getParameterInfo()) {
final AnnotationInfo[] aiArr = mpi.annotationInfo;
if (aiArr != null) {
for (final AnnotationInfo ai : aiArr) {
ai.findReferencedClassNames(classNames); // depends on control dependency: [for], data = [ai]
}
}
}
} } |
public class class_name {
public static byte[] readBytes(@Nonnull final InputStream pInputStream)
throws IOException
{
ByteArrayOutputStream baos = null;
BufferedInputStream bis = null;
try {
baos = new ByteArrayOutputStream(IO_BUFFER_SIZE_BYTES);
bis = new BufferedInputStream(pInputStream, IO_BUFFER_SIZE_BYTES);
byte[] buffer = new byte[IO_BUFFER_SIZE_BYTES];
for (int bytesRead = bis.read(buffer); bytesRead > 0; bytesRead = bis.read(buffer)) {
baos.write(buffer, 0, bytesRead);
}
}
finally {
closeQuietly(bis);
closeQuietly(baos);
}
return baos.toByteArray();
} } | public class class_name {
public static byte[] readBytes(@Nonnull final InputStream pInputStream)
throws IOException
{
ByteArrayOutputStream baos = null;
BufferedInputStream bis = null;
try {
baos = new ByteArrayOutputStream(IO_BUFFER_SIZE_BYTES);
bis = new BufferedInputStream(pInputStream, IO_BUFFER_SIZE_BYTES);
byte[] buffer = new byte[IO_BUFFER_SIZE_BYTES];
for (int bytesRead = bis.read(buffer); bytesRead > 0; bytesRead = bis.read(buffer)) {
baos.write(buffer, 0, bytesRead); // depends on control dependency: [for], data = [bytesRead]
}
}
finally {
closeQuietly(bis);
closeQuietly(baos);
}
return baos.toByteArray();
} } |
public class class_name {
private URL getPXmlRootURL(String appName, String archiveName, Entry pxml) {
URL pxmlUrl = pxml.getResource();
String pxmlStr = pxmlUrl.toString();
String pxmlRootStr = pxmlStr.substring(0, pxmlStr.length() - PERSISTENCE_XML_RESOURCE_NAME.length());
URL pxmlRootUrl = null;
try {
pxmlRootUrl = new URL(pxmlRootStr);
} catch (MalformedURLException e) {
e.getClass(); // findbugs
Tr.error(tc, "INCORRECT_PU_ROOT_URL_SPEC_CWWJP0025E", pxmlRootStr, appName, archiveName);
}
return pxmlRootUrl;
} } | public class class_name {
private URL getPXmlRootURL(String appName, String archiveName, Entry pxml) {
URL pxmlUrl = pxml.getResource();
String pxmlStr = pxmlUrl.toString();
String pxmlRootStr = pxmlStr.substring(0, pxmlStr.length() - PERSISTENCE_XML_RESOURCE_NAME.length());
URL pxmlRootUrl = null;
try {
pxmlRootUrl = new URL(pxmlRootStr); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
e.getClass(); // findbugs
Tr.error(tc, "INCORRECT_PU_ROOT_URL_SPEC_CWWJP0025E", pxmlRootStr, appName, archiveName);
} // depends on control dependency: [catch], data = [none]
return pxmlRootUrl;
} } |
public class class_name {
public static IOException createIOException(List<IOException> exceptions) {
if (exceptions == null || exceptions.isEmpty()) {
return null;
}
if (exceptions.size() == 1) {
return exceptions.get(0);
}
return new MultipleIOException(exceptions);
} } | public class class_name {
public static IOException createIOException(List<IOException> exceptions) {
if (exceptions == null || exceptions.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
if (exceptions.size() == 1) {
return exceptions.get(0); // depends on control dependency: [if], data = [none]
}
return new MultipleIOException(exceptions);
} } |
public class class_name {
public boolean lookup(String identifier) {
try {
SPFError err = new SPFError();
boolean found = getService().lookup(getAccessToken(), identifier, err);
if (err.isOk()) {
return found;
} else {
handleError(err);
return false;
}
} catch (RemoteException e) {
// TODO Error Management
Log.d(TAG, "Remote exception while executing lookup on " + identifier, e);
return false;
}
} } | public class class_name {
public boolean lookup(String identifier) {
try {
SPFError err = new SPFError();
boolean found = getService().lookup(getAccessToken(), identifier, err);
if (err.isOk()) {
return found; // depends on control dependency: [if], data = [none]
} else {
handleError(err); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} catch (RemoteException e) {
// TODO Error Management
Log.d(TAG, "Remote exception while executing lookup on " + identifier, e);
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public java.util.List<MaintenanceWindowExecutionTaskIdentity> getWindowExecutionTaskIdentities() {
if (windowExecutionTaskIdentities == null) {
windowExecutionTaskIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecutionTaskIdentity>();
}
return windowExecutionTaskIdentities;
} } | public class class_name {
public java.util.List<MaintenanceWindowExecutionTaskIdentity> getWindowExecutionTaskIdentities() {
if (windowExecutionTaskIdentities == null) {
windowExecutionTaskIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecutionTaskIdentity>(); // depends on control dependency: [if], data = [none]
}
return windowExecutionTaskIdentities;
} } |
public class class_name {
private void processResponse(Response response) {
// at this point a server response should contain a secure JSON with challenges
JSONObject jsonResponse = Utils.extractSecureJson(response);
JSONObject jsonChallenges = (jsonResponse == null) ? null : jsonResponse.optJSONObject(CHALLENGES_VALUE_NAME);
if (jsonChallenges != null) {
startHandleChallenges(jsonChallenges, response);
} else {
listener.onSuccess(response);
}
} } | public class class_name {
private void processResponse(Response response) {
// at this point a server response should contain a secure JSON with challenges
JSONObject jsonResponse = Utils.extractSecureJson(response);
JSONObject jsonChallenges = (jsonResponse == null) ? null : jsonResponse.optJSONObject(CHALLENGES_VALUE_NAME);
if (jsonChallenges != null) {
startHandleChallenges(jsonChallenges, response); // depends on control dependency: [if], data = [(jsonChallenges]
} else {
listener.onSuccess(response); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean containsLocalVariable(@Nullable final String name) {
if (name == null) {
return false;
}
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
return false;
}
return localVarTable.containsKey(normalized);
} } | public class class_name {
public boolean containsLocalVariable(@Nullable final String name) {
if (name == null) {
return false; // depends on control dependency: [if], data = [none]
}
final String normalized = assertNotNull(PreprocessorUtils.normalizeVariableName(name));
if (normalized.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
return localVarTable.containsKey(normalized);
} } |
public class class_name {
private void setFileSizesAfterRestart(boolean coldStart,
long minimumPermanentStoreSize, long maximumPermanentStoreSize, boolean isPermanentStoreSizeUnlimited,
long minimumTemporaryStoreSize, long maximumTemporaryStoreSize, boolean isTemporaryStoreSizeUnlimited,
long logSize) throws ObjectManagerException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFileSizesAfterRestart", new Object[]{"ColdStart="+coldStart, "LogSize="+logSize,
"MinimumPermanentStoreSize="+minimumPermanentStoreSize, "MaximumPermanentStoreSize="+maximumPermanentStoreSize, "IsPermanentStoreSizeUnlimited="+isPermanentStoreSizeUnlimited,
"MinimumTemporaryStoreSize="+minimumTemporaryStoreSize, "MaximumTemporaryStoreSize="+maximumTemporaryStoreSize, "IsTemporaryStoreSizeUnlimited="+isTemporaryStoreSizeUnlimited});
try
{
// The recommendation is to set the log file size
// before the store file sizes when cold-starting
if (coldStart)
{
long currentLogSize = _objectManager.getLogFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "The current size of the log file is " + Long.valueOf(currentLogSize) + " bytes. The size in the configuration information of the log file is " + Long.valueOf(logSize) + " bytes.");
if (currentLogSize != logSize)
{
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (logSize > maximumPermanentStoreSize)) || // Log larger than permanent store
(!isTemporaryStoreSizeUnlimited && (logSize > maximumTemporaryStoreSize))) // Log larger than temporary store
{
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size not changed!");
}
else
{
_objectManager.setLogFileSize(logSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size changed");
}
}
}
// Change the permanent store file sizes.
SingleFileObjectStore store = (SingleFileObjectStore)_permanentStore;
long currentPermanentStoreUsed = store.getStoreFileUsed();
long currentPermanentStoreSize = store.getStoreFileSize();
long currentMinimumPermanentStoreSize = store.getMinimumStoreFileSize();
long currentMaximumPermanentStoreSize = store.getMaximumStoreFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "currentPermanentStoreUsed = " + currentPermanentStoreUsed);
SibTr.debug(this, tc, "currentPermanentStoreSize = " + currentPermanentStoreSize);
SibTr.debug(this, tc, "currentMinimumPermanentStoreSize = " + currentMinimumPermanentStoreSize);
SibTr.debug(this, tc, "currentMaximumPermanentStoreSize = " + currentMaximumPermanentStoreSize);
// Defect 342044
// Output the current size of the data in the permanent store
SibTr.debug(this, tc, "The data in the permanent store file occupies " + Long.valueOf(currentPermanentStoreUsed) + " bytes.");
// Output the current file size limits.
if (currentMaximumPermanentStoreSize != MAXIMUM_STORE_FILE_SIZE)
{
SibTr.debug(this, tc, "The current minimum reserved size of the permanent store file is " + Long.valueOf(currentMinimumPermanentStoreSize) + " bytes. The current maximum size is " + Long.valueOf(currentMaximumPermanentStoreSize) + " bytes.");
}
else
{
SibTr.debug(this, tc, "The current minimum reserved size of the permanent store file is " + Long.valueOf(currentMinimumPermanentStoreSize) + " bytes. The current maximum size is unlimited");
}
}
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (minimumPermanentStoreSize > maximumPermanentStoreSize))) // Permanent store minimum larger than maximum
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_SIMS1553", new Object[] {Long.valueOf(minimumPermanentStoreSize), Long.valueOf(maximumPermanentStoreSize)});
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Permanent store size not changed!");
}
else
{
if ((currentMinimumPermanentStoreSize != minimumPermanentStoreSize) || /* Minimum is not the same as the current minimum. */
(!isPermanentStoreSizeUnlimited && (currentMaximumPermanentStoreSize != maximumPermanentStoreSize)) || /* Maximum is not the same as current limited maximum. */
(isPermanentStoreSizeUnlimited && (currentMaximumPermanentStoreSize != MAXIMUM_STORE_FILE_SIZE))) /* Maximum is not already set to unlimited. */
{
if (!isPermanentStoreSizeUnlimited)
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_SIMS1553", new Object[] {Long.valueOf(minimumPermanentStoreSize), Long.valueOf(maximumPermanentStoreSize)});
store.setStoreFileSize(minimumPermanentStoreSize, maximumPermanentStoreSize);
}
else
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_UNLIMITED_SIMS1554", new Object[] {Long.valueOf(minimumPermanentStoreSize)});
store.setStoreFileSize(minimumPermanentStoreSize, MAXIMUM_STORE_FILE_SIZE);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Permanent Store size changed");
}
}
// Change the temporary store file sizes.
store = (SingleFileObjectStore)_temporaryStore;
long currentTemporaryStoreUsed = store.getStoreFileUsed();
long currentTemporaryStoreSize = store.getStoreFileSize();
long currentMinimumTemporaryStoreSize = store.getMinimumStoreFileSize();
long currentMaximumTemporaryStoreSize = store.getMaximumStoreFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "currentTemporaryStoreUsed = " + currentTemporaryStoreUsed);
SibTr.debug(this, tc, "currentTemporaryStoreSize = " + currentTemporaryStoreSize);
SibTr.debug(this, tc, "currentMinimumTemporaryStoreSize = " + currentMinimumTemporaryStoreSize);
SibTr.debug(this, tc, "currentMaximumTemporaryStoreSize = " + currentMaximumTemporaryStoreSize);
// Defect 342044
// Output the current size of the data in the temporary store
SibTr.debug(this, tc, "The data in the temporary store file occupies " + Long.valueOf(currentTemporaryStoreUsed) + " bytes.");
// Output the current file size limits.
if (currentMaximumTemporaryStoreSize != MAXIMUM_STORE_FILE_SIZE)
{
SibTr.debug(this, tc, "The current minimum reserved size of the temporary store file is " + Long.valueOf(currentMinimumTemporaryStoreSize) + " bytes. The current maximum size is " + Long.valueOf(currentMaximumTemporaryStoreSize) +" bytes.");
}
else
{
SibTr.debug(this, tc, "The current minimum reserved size of the temporary store file is " + Long.valueOf(currentMinimumTemporaryStoreSize) + " bytes. The current maximum size is unlimited.");
}
}
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isTemporaryStoreSizeUnlimited && (minimumTemporaryStoreSize > maximumTemporaryStoreSize))) // Temporary store minimum larger than maximum
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_SIMS1557", new Object[] {Long.valueOf(minimumTemporaryStoreSize), Long.valueOf(maximumTemporaryStoreSize)});
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Temporary store size not changed!");
}
else
{
if ((currentMinimumTemporaryStoreSize != minimumTemporaryStoreSize) || /* Minimum is not the same as the current minimum. */
(!isTemporaryStoreSizeUnlimited && (currentMaximumTemporaryStoreSize != maximumTemporaryStoreSize)) || /* Maximum is not the same as current limited maximum. */
(isTemporaryStoreSizeUnlimited && (currentMaximumTemporaryStoreSize != MAXIMUM_STORE_FILE_SIZE))) /* Maximum is not already set to unlimited. */
{
if (!isTemporaryStoreSizeUnlimited)
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_SIMS1557", new Object[] {Long.valueOf(minimumTemporaryStoreSize), Long.valueOf(maximumTemporaryStoreSize)});
store.setStoreFileSize(minimumTemporaryStoreSize, maximumTemporaryStoreSize);
}
else
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_UNLIMITED_SIMS1558", new Object[] {Long.valueOf(minimumTemporaryStoreSize)});
store.setStoreFileSize(minimumTemporaryStoreSize, MAXIMUM_STORE_FILE_SIZE);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Temporary Store size changed");
}
}
// The recommendation is to set the log file size
// after the store file sizes when warm-starting
if (!coldStart)
{
long currentLogSize = _objectManager.getLogFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "The current size of the log file is " + Long.valueOf(currentLogSize) + " bytes. The size in the configuration information of the log file is " + Long.valueOf(logSize) + " bytes.");
if (currentLogSize != logSize)
{
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (logSize > maximumPermanentStoreSize)) || // Log larger than permanent store
(!isTemporaryStoreSizeUnlimited && (logSize > maximumTemporaryStoreSize))) // Log larger than temporary store
{
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size not changed!");
}
else
{
_objectManager.setLogFileSize(logSize);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size changed");
}
}
}
}
catch (LogFileSizeTooSmallException lfse) // This is due to the minimum log size not being big
{ // enough for existing data.
com.ibm.ws.ffdc.FFDCFilter.processException(lfse, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2531:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548");
}
catch (IllegalArgumentException iae) // This is due to invalid file sizes i.e. min > max
{
com.ibm.ws.ffdc.FFDCFilter.processException(iae, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2536:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
catch (StoreFileSizeTooSmallException sfse) // This is due to the minimum store size not being big
{ // enough for existing data.
com.ibm.ws.ffdc.FFDCFilter.processException(sfse, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2541:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
catch (PermanentIOException pie) // This is due to an error setting the minimum store size
{ // on the local file system.
com.ibm.ws.ffdc.FFDCFilter.processException(pie, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2546:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFileSizesAfterRestart");
} } | public class class_name {
private void setFileSizesAfterRestart(boolean coldStart,
long minimumPermanentStoreSize, long maximumPermanentStoreSize, boolean isPermanentStoreSizeUnlimited,
long minimumTemporaryStoreSize, long maximumTemporaryStoreSize, boolean isTemporaryStoreSizeUnlimited,
long logSize) throws ObjectManagerException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setFileSizesAfterRestart", new Object[]{"ColdStart="+coldStart, "LogSize="+logSize,
"MinimumPermanentStoreSize="+minimumPermanentStoreSize, "MaximumPermanentStoreSize="+maximumPermanentStoreSize, "IsPermanentStoreSizeUnlimited="+isPermanentStoreSizeUnlimited,
"MinimumTemporaryStoreSize="+minimumTemporaryStoreSize, "MaximumTemporaryStoreSize="+maximumTemporaryStoreSize, "IsTemporaryStoreSizeUnlimited="+isTemporaryStoreSizeUnlimited});
try
{
// The recommendation is to set the log file size
// before the store file sizes when cold-starting
if (coldStart)
{
long currentLogSize = _objectManager.getLogFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "The current size of the log file is " + Long.valueOf(currentLogSize) + " bytes. The size in the configuration information of the log file is " + Long.valueOf(logSize) + " bytes.");
if (currentLogSize != logSize)
{
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (logSize > maximumPermanentStoreSize)) || // Log larger than permanent store
(!isTemporaryStoreSizeUnlimited && (logSize > maximumTemporaryStoreSize))) // Log larger than temporary store
{
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548"); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size not changed!");
}
else
{
_objectManager.setLogFileSize(logSize); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size changed");
}
}
}
// Change the permanent store file sizes.
SingleFileObjectStore store = (SingleFileObjectStore)_permanentStore;
long currentPermanentStoreUsed = store.getStoreFileUsed();
long currentPermanentStoreSize = store.getStoreFileSize();
long currentMinimumPermanentStoreSize = store.getMinimumStoreFileSize();
long currentMaximumPermanentStoreSize = store.getMaximumStoreFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "currentPermanentStoreUsed = " + currentPermanentStoreUsed); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentPermanentStoreSize = " + currentPermanentStoreSize); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentMinimumPermanentStoreSize = " + currentMinimumPermanentStoreSize); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentMaximumPermanentStoreSize = " + currentMaximumPermanentStoreSize); // depends on control dependency: [if], data = [none]
// Defect 342044
// Output the current size of the data in the permanent store
SibTr.debug(this, tc, "The data in the permanent store file occupies " + Long.valueOf(currentPermanentStoreUsed) + " bytes."); // depends on control dependency: [if], data = [none]
// Output the current file size limits.
if (currentMaximumPermanentStoreSize != MAXIMUM_STORE_FILE_SIZE)
{
SibTr.debug(this, tc, "The current minimum reserved size of the permanent store file is " + Long.valueOf(currentMinimumPermanentStoreSize) + " bytes. The current maximum size is " + Long.valueOf(currentMaximumPermanentStoreSize) + " bytes."); // depends on control dependency: [if], data = [(currentMaximumPermanentStoreSize]
}
else
{
SibTr.debug(this, tc, "The current minimum reserved size of the permanent store file is " + Long.valueOf(currentMinimumPermanentStoreSize) + " bytes. The current maximum size is unlimited"); // depends on control dependency: [if], data = [none]
}
}
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (minimumPermanentStoreSize > maximumPermanentStoreSize))) // Permanent store minimum larger than maximum
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_SIMS1553", new Object[] {Long.valueOf(minimumPermanentStoreSize), Long.valueOf(maximumPermanentStoreSize)}); // depends on control dependency: [if], data = [none]
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549"); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Permanent store size not changed!");
}
else
{
if ((currentMinimumPermanentStoreSize != minimumPermanentStoreSize) || /* Minimum is not the same as the current minimum. */
(!isPermanentStoreSizeUnlimited && (currentMaximumPermanentStoreSize != maximumPermanentStoreSize)) || /* Maximum is not the same as current limited maximum. */
(isPermanentStoreSizeUnlimited && (currentMaximumPermanentStoreSize != MAXIMUM_STORE_FILE_SIZE))) /* Maximum is not already set to unlimited. */
{
if (!isPermanentStoreSizeUnlimited)
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_SIMS1553", new Object[] {Long.valueOf(minimumPermanentStoreSize), Long.valueOf(maximumPermanentStoreSize)}); // depends on control dependency: [if], data = [none]
store.setStoreFileSize(minimumPermanentStoreSize, maximumPermanentStoreSize); // depends on control dependency: [if], data = [none]
}
else
{
SibTr.info(tc, "FILE_STORE_PERMANENT_STORE_SIZE_CONFIGURATION_INFO_UNLIMITED_SIMS1554", new Object[] {Long.valueOf(minimumPermanentStoreSize)}); // depends on control dependency: [if], data = [none]
store.setStoreFileSize(minimumPermanentStoreSize, MAXIMUM_STORE_FILE_SIZE); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Permanent Store size changed");
}
}
// Change the temporary store file sizes.
store = (SingleFileObjectStore)_temporaryStore;
long currentTemporaryStoreUsed = store.getStoreFileUsed();
long currentTemporaryStoreSize = store.getStoreFileSize();
long currentMinimumTemporaryStoreSize = store.getMinimumStoreFileSize();
long currentMaximumTemporaryStoreSize = store.getMaximumStoreFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(this, tc, "currentTemporaryStoreUsed = " + currentTemporaryStoreUsed); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentTemporaryStoreSize = " + currentTemporaryStoreSize); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentMinimumTemporaryStoreSize = " + currentMinimumTemporaryStoreSize); // depends on control dependency: [if], data = [none]
SibTr.debug(this, tc, "currentMaximumTemporaryStoreSize = " + currentMaximumTemporaryStoreSize); // depends on control dependency: [if], data = [none]
// Defect 342044
// Output the current size of the data in the temporary store
SibTr.debug(this, tc, "The data in the temporary store file occupies " + Long.valueOf(currentTemporaryStoreUsed) + " bytes."); // depends on control dependency: [if], data = [none]
// Output the current file size limits.
if (currentMaximumTemporaryStoreSize != MAXIMUM_STORE_FILE_SIZE)
{
SibTr.debug(this, tc, "The current minimum reserved size of the temporary store file is " + Long.valueOf(currentMinimumTemporaryStoreSize) + " bytes. The current maximum size is " + Long.valueOf(currentMaximumTemporaryStoreSize) +" bytes."); // depends on control dependency: [if], data = [(currentMaximumTemporaryStoreSize]
}
else
{
SibTr.debug(this, tc, "The current minimum reserved size of the temporary store file is " + Long.valueOf(currentMinimumTemporaryStoreSize) + " bytes. The current maximum size is unlimited."); // depends on control dependency: [if], data = [none]
}
}
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isTemporaryStoreSizeUnlimited && (minimumTemporaryStoreSize > maximumTemporaryStoreSize))) // Temporary store minimum larger than maximum
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_SIMS1557", new Object[] {Long.valueOf(minimumTemporaryStoreSize), Long.valueOf(maximumTemporaryStoreSize)}); // depends on control dependency: [if], data = [none]
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549"); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Temporary store size not changed!");
}
else
{
if ((currentMinimumTemporaryStoreSize != minimumTemporaryStoreSize) || /* Minimum is not the same as the current minimum. */
(!isTemporaryStoreSizeUnlimited && (currentMaximumTemporaryStoreSize != maximumTemporaryStoreSize)) || /* Maximum is not the same as current limited maximum. */
(isTemporaryStoreSizeUnlimited && (currentMaximumTemporaryStoreSize != MAXIMUM_STORE_FILE_SIZE))) /* Maximum is not already set to unlimited. */
{
if (!isTemporaryStoreSizeUnlimited)
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_SIMS1557", new Object[] {Long.valueOf(minimumTemporaryStoreSize), Long.valueOf(maximumTemporaryStoreSize)}); // depends on control dependency: [if], data = [none]
store.setStoreFileSize(minimumTemporaryStoreSize, maximumTemporaryStoreSize); // depends on control dependency: [if], data = [none]
}
else
{
SibTr.info(tc, "FILE_STORE_TEMPORARY_STORE_SIZE_CONFIGURATION_INFO_UNLIMITED_SIMS1558", new Object[] {Long.valueOf(minimumTemporaryStoreSize)}); // depends on control dependency: [if], data = [none]
store.setStoreFileSize(minimumTemporaryStoreSize, MAXIMUM_STORE_FILE_SIZE); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Temporary Store size changed");
}
}
// The recommendation is to set the log file size
// after the store file sizes when warm-starting
if (!coldStart)
{
long currentLogSize = _objectManager.getLogFileSize();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "The current size of the log file is " + Long.valueOf(currentLogSize) + " bytes. The size in the configuration information of the log file is " + Long.valueOf(logSize) + " bytes.");
if (currentLogSize != logSize)
{
// Defect 326589
// Check the values provided to us to make sure we are attempting
// sensible modifications. Each check is only worth doing if the matching
// store size unlimited flag is set to false. If this is true then we are
// going to ignore the maximum store size parameters anyway.
if ((!isPermanentStoreSizeUnlimited && (logSize > maximumPermanentStoreSize)) || // Log larger than permanent store
(!isTemporaryStoreSizeUnlimited && (logSize > maximumTemporaryStoreSize))) // Log larger than temporary store
{
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548"); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size not changed!");
}
else
{
_objectManager.setLogFileSize(logSize); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Log size changed");
}
}
}
}
catch (LogFileSizeTooSmallException lfse) // This is due to the minimum log size not being big
{ // enough for existing data.
com.ibm.ws.ffdc.FFDCFilter.processException(lfse, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2531:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_LOG_SIZE_CHANGE_PREVENTED_SIMS1548");
}
catch (IllegalArgumentException iae) // This is due to invalid file sizes i.e. min > max
{
com.ibm.ws.ffdc.FFDCFilter.processException(iae, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2536:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
catch (StoreFileSizeTooSmallException sfse) // This is due to the minimum store size not being big
{ // enough for existing data.
com.ibm.ws.ffdc.FFDCFilter.processException(sfse, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2541:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
catch (PermanentIOException pie) // This is due to an error setting the minimum store size
{ // on the local file system.
com.ibm.ws.ffdc.FFDCFilter.processException(pie, "com.ibm.ws.sib.msgstore.persistence.objectManager.PersistableMessageStoreImpl.setFileSizesAfterRestart", "1:2546:1.81.1.6", this);
SibTr.warning(tc, "FILE_STORE_STORE_SIZE_CHANGE_PREVENTED_SIMS1549");
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setFileSizesAfterRestart");
} } |
public class class_name {
public void marshall(LabelingJobInputConfig labelingJobInputConfig, ProtocolMarshaller protocolMarshaller) {
if (labelingJobInputConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(labelingJobInputConfig.getDataSource(), DATASOURCE_BINDING);
protocolMarshaller.marshall(labelingJobInputConfig.getDataAttributes(), DATAATTRIBUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LabelingJobInputConfig labelingJobInputConfig, ProtocolMarshaller protocolMarshaller) {
if (labelingJobInputConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(labelingJobInputConfig.getDataSource(), DATASOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(labelingJobInputConfig.getDataAttributes(), DATAATTRIBUTES_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 boolean containsPrimary(Property property, String value)
{
for (Metadata meta : primary.get(property))
{
if (meta.getValue().equals(value))
{
return true;
}
}
return false;
} } | public class class_name {
public boolean containsPrimary(Property property, String value)
{
for (Metadata meta : primary.get(property))
{
if (meta.getValue().equals(value))
{
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
protected void registerWebSocketEndpoint(Binding<?> binding) {//}, ServerEndpoint serverEndpoint) {
Object instance = binding.getProvider().get();
Class<?> instanceClass = instance.getClass();
ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class);
if (serverEndpoint != null) {
try {
// register with the servlet container such that the Guice created singleton instance
// is the instance that is used (and not an instance created per request etc)
log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass);
BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance);
serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator));
} catch (Exception e) {
log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e);
}
}
} } | public class class_name {
protected void registerWebSocketEndpoint(Binding<?> binding) {//}, ServerEndpoint serverEndpoint) {
Object instance = binding.getProvider().get();
Class<?> instanceClass = instance.getClass();
ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class);
if (serverEndpoint != null) {
try {
// register with the servlet container such that the Guice created singleton instance
// is the instance that is used (and not an instance created per request etc)
log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass); // depends on control dependency: [try], data = [none]
BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance);
serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected boolean checkClause(Clause clause, Queue<Notification> notifications) {
Collection<DetectionPoint> windowDetectionPoints = new HashSet<DetectionPoint>();
for (Notification notification : notifications) {
windowDetectionPoints.add(notification.getMonitorPoint());
}
for (DetectionPoint detectionPoint : clause.getMonitorPoints()) {
if (!windowDetectionPoints.contains(detectionPoint)) {
return false;
}
}
return true;
} } | public class class_name {
protected boolean checkClause(Clause clause, Queue<Notification> notifications) {
Collection<DetectionPoint> windowDetectionPoints = new HashSet<DetectionPoint>();
for (Notification notification : notifications) {
windowDetectionPoints.add(notification.getMonitorPoint()); // depends on control dependency: [for], data = [notification]
}
for (DetectionPoint detectionPoint : clause.getMonitorPoints()) {
if (!windowDetectionPoints.contains(detectionPoint)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
protected IIOMetadataNode getStandardTextNode() {
if (!header.getName().isEmpty()) {
IIOMetadataNode text = new IIOMetadataNode("Text");
IIOMetadataNode textEntry = new IIOMetadataNode("TextEntry");
textEntry.setAttribute("keyword", "name");
textEntry.setAttribute("value", header.getName());
text.appendChild(textEntry);
return text;
}
return null;
} } | public class class_name {
@Override
protected IIOMetadataNode getStandardTextNode() {
if (!header.getName().isEmpty()) {
IIOMetadataNode text = new IIOMetadataNode("Text");
IIOMetadataNode textEntry = new IIOMetadataNode("TextEntry");
textEntry.setAttribute("keyword", "name"); // depends on control dependency: [if], data = [none]
textEntry.setAttribute("value", header.getName()); // depends on control dependency: [if], data = [none]
text.appendChild(textEntry); // depends on control dependency: [if], data = [none]
return text; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static void setScriptsExecutable(File dir) {
String os = System.getProperty("os.name");
if (os != null && !os.startsWith("Windows")) {
FileFilter filter = FileUtils.getSuffixFileFilter(".sh");
setExecutable(dir, filter);
}
} } | public class class_name {
public static void setScriptsExecutable(File dir) {
String os = System.getProperty("os.name");
if (os != null && !os.startsWith("Windows")) {
FileFilter filter = FileUtils.getSuffixFileFilter(".sh");
setExecutable(dir, filter); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ElasticLoadBalancer elasticLoadBalancer, ProtocolMarshaller protocolMarshaller) {
if (elasticLoadBalancer == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(elasticLoadBalancer.getElasticLoadBalancerName(), ELASTICLOADBALANCERNAME_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getRegion(), REGION_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getDnsName(), DNSNAME_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getStackId(), STACKID_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getLayerId(), LAYERID_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getVpcId(), VPCID_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getAvailabilityZones(), AVAILABILITYZONES_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(elasticLoadBalancer.getEc2InstanceIds(), EC2INSTANCEIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ElasticLoadBalancer elasticLoadBalancer, ProtocolMarshaller protocolMarshaller) {
if (elasticLoadBalancer == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(elasticLoadBalancer.getElasticLoadBalancerName(), ELASTICLOADBALANCERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getRegion(), REGION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getDnsName(), DNSNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getLayerId(), LAYERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getVpcId(), VPCID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getAvailabilityZones(), AVAILABILITYZONES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getSubnetIds(), SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(elasticLoadBalancer.getEc2InstanceIds(), EC2INSTANCEIDS_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 {
StringBuilder fwdQuote(char q) {
StringBuilder sb = new StringBuilder();
while (hasNext()) {
next();
sb.append(buffer[pos]);
if (isCurr(q)) {
if (isNext(q)) { // consecutive quote sign
next();
}
else {
break;
}
}
}
if (sb.length() > 0) sb.setLength(sb.length() - 1); // remove closing quote sign
return sb;
} } | public class class_name {
StringBuilder fwdQuote(char q) {
StringBuilder sb = new StringBuilder();
while (hasNext()) {
next(); // depends on control dependency: [while], data = [none]
sb.append(buffer[pos]); // depends on control dependency: [while], data = [none]
if (isCurr(q)) {
if (isNext(q)) { // consecutive quote sign
next(); // depends on control dependency: [if], data = [none]
}
else {
break;
}
}
}
if (sb.length() > 0) sb.setLength(sb.length() - 1); // remove closing quote sign
return sb;
} } |
public class class_name {
public final void setVolumeByIncrement(float level) throws IOException {
Volume volume = this.getStatus().volume;
float total = volume.level;
if (volume.increment <= 0f) {
throw new ChromeCastException("Volume.increment is <= 0");
}
// With floating points we always have minor decimal variations, using the Math.min/max
// works around this issue
// Increase volume
if (level > total) {
while (total < level) {
total = Math.min(total + volume.increment, level);
setVolume(total);
}
// Decrease Volume
} else if (level < total) {
while (total > level) {
total = Math.max(total - volume.increment, level);
setVolume(total);
}
}
} } | public class class_name {
public final void setVolumeByIncrement(float level) throws IOException {
Volume volume = this.getStatus().volume;
float total = volume.level;
if (volume.increment <= 0f) {
throw new ChromeCastException("Volume.increment is <= 0");
}
// With floating points we always have minor decimal variations, using the Math.min/max
// works around this issue
// Increase volume
if (level > total) {
while (total < level) {
total = Math.min(total + volume.increment, level); // depends on control dependency: [while], data = [(total]
setVolume(total); // depends on control dependency: [while], data = [(total]
}
// Decrease Volume
} else if (level < total) {
while (total > level) {
total = Math.max(total - volume.increment, level);
setVolume(total);
}
}
} } |
public class class_name {
public static void enableSubsystem(ISubsystem subsystem, boolean enable) {
if (enable_logging) {
if (enable) {
mEnabledSubsystems.add(subsystem);
} else {
mEnabledSubsystems.remove(subsystem);
}
}
} } | public class class_name {
public static void enableSubsystem(ISubsystem subsystem, boolean enable) {
if (enable_logging) {
if (enable) {
mEnabledSubsystems.add(subsystem); // depends on control dependency: [if], data = [none]
} else {
mEnabledSubsystems.remove(subsystem); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public int copy(long srcPos, byte[] data, int destPos, int length) {
int segmentSize = 1 << log2OfSegmentSize;
int remainingBytesInSegment = (int)(segmentSize - (srcPos & bitmask));
int dataPosition = destPos;
while(length > 0) {
byte[] segment = segments[(int)(srcPos >>> log2OfSegmentSize)];
int bytesToCopyFromSegment = Math.min(remainingBytesInSegment, length);
System.arraycopy(segment, (int)(srcPos & bitmask), data, dataPosition, bytesToCopyFromSegment);
dataPosition += bytesToCopyFromSegment;
srcPos += bytesToCopyFromSegment;
remainingBytesInSegment = segmentSize - (int)(srcPos & bitmask);
length -= bytesToCopyFromSegment;
}
return dataPosition - destPos;
} } | public class class_name {
public int copy(long srcPos, byte[] data, int destPos, int length) {
int segmentSize = 1 << log2OfSegmentSize;
int remainingBytesInSegment = (int)(segmentSize - (srcPos & bitmask));
int dataPosition = destPos;
while(length > 0) {
byte[] segment = segments[(int)(srcPos >>> log2OfSegmentSize)];
int bytesToCopyFromSegment = Math.min(remainingBytesInSegment, length);
System.arraycopy(segment, (int)(srcPos & bitmask), data, dataPosition, bytesToCopyFromSegment); // depends on control dependency: [while], data = [none]
dataPosition += bytesToCopyFromSegment; // depends on control dependency: [while], data = [none]
srcPos += bytesToCopyFromSegment; // depends on control dependency: [while], data = [none]
remainingBytesInSegment = segmentSize - (int)(srcPos & bitmask); // depends on control dependency: [while], data = [none]
length -= bytesToCopyFromSegment; // depends on control dependency: [while], data = [none]
}
return dataPosition - destPos;
} } |
public class class_name {
public JsonReader createReader(InputStream input) {
try {
return createReader(new InputStreamReader(input, "UTF-8"));
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public JsonReader createReader(InputStream input) {
try {
return createReader(new InputStreamReader(input, "UTF-8")); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.