code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private static InetAddress getInetAddress(String ip) {
if (ip == null)
return null;
InetAddress addr = null;
try {
addr = InetAddress.getByName(ip);
} catch (UnknownHostException e) {
Log.err(e);
H2O.exit(-1);
}
return addr;
} } | public class class_name {
private static InetAddress getInetAddress(String ip) {
if (ip == null)
return null;
InetAddress addr = null;
try {
addr = InetAddress.getByName(ip); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
Log.err(e);
H2O.exit(-1);
} // depends on control dependency: [catch], data = [none]
return addr;
} } |
public class class_name {
private JPanel getPanelHeadline() {
if (panelHeadline == null) {
panelHeadline = new JPanel();
panelHeadline.setLayout(new BorderLayout(0, 0));
txtHeadline = getTxtHeadline();
panelHeadline.add(txtHeadline, BorderLayout.CENTER);
JButton button = getHelpButton();
panelHeadline.add(button, BorderLayout.EAST);
}
return panelHeadline;
} } | public class class_name {
private JPanel getPanelHeadline() {
if (panelHeadline == null) {
panelHeadline = new JPanel();
// depends on control dependency: [if], data = [none]
panelHeadline.setLayout(new BorderLayout(0, 0));
// depends on control dependency: [if], data = [none]
txtHeadline = getTxtHeadline();
// depends on control dependency: [if], data = [none]
panelHeadline.add(txtHeadline, BorderLayout.CENTER);
// depends on control dependency: [if], data = [none]
JButton button = getHelpButton();
panelHeadline.add(button, BorderLayout.EAST);
// depends on control dependency: [if], data = [none]
}
return panelHeadline;
} } |
public class class_name {
public AutoScalingGroup withEnabledMetrics(EnabledMetric... enabledMetrics) {
if (this.enabledMetrics == null) {
setEnabledMetrics(new com.amazonaws.internal.SdkInternalList<EnabledMetric>(enabledMetrics.length));
}
for (EnabledMetric ele : enabledMetrics) {
this.enabledMetrics.add(ele);
}
return this;
} } | public class class_name {
public AutoScalingGroup withEnabledMetrics(EnabledMetric... enabledMetrics) {
if (this.enabledMetrics == null) {
setEnabledMetrics(new com.amazonaws.internal.SdkInternalList<EnabledMetric>(enabledMetrics.length)); // depends on control dependency: [if], data = [none]
}
for (EnabledMetric ele : enabledMetrics) {
this.enabledMetrics.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String getCategoriesAsString() {
List<String> categories = getCategories();
String categoriesStr = "";
if (categories != null && !categories.isEmpty()) {
categoriesStr = StringUtils.join(categories.toArray(), CATEGORY_SEPARATOR);
}
return categoriesStr;
} } | public class class_name {
public String getCategoriesAsString() {
List<String> categories = getCategories();
String categoriesStr = "";
if (categories != null && !categories.isEmpty()) {
categoriesStr = StringUtils.join(categories.toArray(), CATEGORY_SEPARATOR); // depends on control dependency: [if], data = [(categories]
}
return categoriesStr;
} } |
public class class_name {
protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
urls.add(url);
getLog().debug("Added classpathElement URL " + url);
} catch (MalformedURLException e) {
throw new MojoExecutionException("Error in adding the classpath " + pathElem, e);
}
}
ClassLoader jpaRealm =
new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
// set the new ClassLoader as default for this Thread
// will be reverted in the caller method.
Thread.currentThread().setContextClassLoader(jpaRealm);
} } | public class class_name {
protected void extendRealmClasspath()
throws MojoExecutionException {
List<URL> urls = new ArrayList<>();
for (String fileName : compileClasspathElements) {
File pathElem = new File(fileName);
try {
URL url = pathElem.toURI().toURL();
urls.add(url); // depends on control dependency: [try], data = [none]
getLog().debug("Added classpathElement URL " + url); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new MojoExecutionException("Error in adding the classpath " + pathElem, e);
} // depends on control dependency: [catch], data = [none]
}
ClassLoader jpaRealm =
new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader());
// set the new ClassLoader as default for this Thread
// will be reverted in the caller method.
Thread.currentThread().setContextClassLoader(jpaRealm);
} } |
public class class_name {
@Override
public Set<Entry<K, Collection<V>>> entrySet() {
return new AbstractSet<Entry<K, Collection<V>>>() {
@Override
public Iterator<Map.Entry<K, Collection<V>>> iterator() {
Filter<Map.Entry<K, Collection<V>>> filter1 = new Filter<Map.Entry<K, Collection<V>>>() {
private static final long serialVersionUID = -3257173354412718639L;
// only accepts stuff not overwritten by deltaMap
public boolean accept(Map.Entry<K, Collection<V>> e) {
K key = e.getKey();
if (deltaMap.containsKey(key)) {
return false;
}
return true;
}
};
Iterator<Map.Entry<K, Collection<V>>> iter1 = new FilteredIterator<Map.Entry<K, Collection<V>>>(originalMap.entrySet().iterator(), filter1);
Filter<Map.Entry<K, Collection<V>>> filter2 = new Filter<Map.Entry<K, Collection<V>>>() {
private static final long serialVersionUID = 1L;
// only accepts stuff not overwritten by deltaMap
public boolean accept(Map.Entry<K, Collection<V>> e) {
if (e.getValue() == removedValue) {
return false;
}
return true;
}
};
Iterator<Map.Entry<K, Collection<V>>> iter2 = new FilteredIterator<Map.Entry<K, Collection<V>>>(deltaMap.entrySet().iterator(), filter2);
return new ConcatenationIterator<Map.Entry<K, Collection<V>>>(iter1, iter2);
}
@Override
public int size() {
int size = 0;
for (// @SuppressWarnings("unused") // this makes javac v1.5 barf!!
Entry<K, Collection<V>> entry : this) {
ErasureUtils.noop(entry);
size++;
}
return size;
}
};
} } | public class class_name {
@Override
public Set<Entry<K, Collection<V>>> entrySet() {
return new AbstractSet<Entry<K, Collection<V>>>() {
@Override
public Iterator<Map.Entry<K, Collection<V>>> iterator() {
Filter<Map.Entry<K, Collection<V>>> filter1 = new Filter<Map.Entry<K, Collection<V>>>() {
private static final long serialVersionUID = -3257173354412718639L;
// only accepts stuff not overwritten by deltaMap
public boolean accept(Map.Entry<K, Collection<V>> e) {
K key = e.getKey();
if (deltaMap.containsKey(key)) {
return false;
// depends on control dependency: [if], data = [none]
}
return true;
}
};
Iterator<Map.Entry<K, Collection<V>>> iter1 = new FilteredIterator<Map.Entry<K, Collection<V>>>(originalMap.entrySet().iterator(), filter1);
Filter<Map.Entry<K, Collection<V>>> filter2 = new Filter<Map.Entry<K, Collection<V>>>() {
private static final long serialVersionUID = 1L;
// only accepts stuff not overwritten by deltaMap
public boolean accept(Map.Entry<K, Collection<V>> e) {
if (e.getValue() == removedValue) {
return false;
// depends on control dependency: [if], data = [none]
}
return true;
}
};
Iterator<Map.Entry<K, Collection<V>>> iter2 = new FilteredIterator<Map.Entry<K, Collection<V>>>(deltaMap.entrySet().iterator(), filter2);
return new ConcatenationIterator<Map.Entry<K, Collection<V>>>(iter1, iter2);
}
@Override
public int size() {
int size = 0;
for (// @SuppressWarnings("unused") // this makes javac v1.5 barf!!
Entry<K, Collection<V>> entry : this) {
ErasureUtils.noop(entry);
// depends on control dependency: [for], data = [entry]
size++;
// depends on control dependency: [for], data = [none]
}
return size;
}
};
} } |
public class class_name {
private int skipWhitespace() throws IOException {
int c = 0;
do {
c = r.read();
if (c < 0) {
return -1;
}
} while (Character.isWhitespace(c));
return c;
} } | public class class_name {
private int skipWhitespace() throws IOException {
int c = 0;
do {
c = r.read();
if (c < 0) {
return -1; // depends on control dependency: [if], data = [none]
}
} while (Character.isWhitespace(c));
return c;
} } |
public class class_name {
@Override
public Account getAccountByName(String name) {
for (Account account : accountMap.values()) {
if (name.equals(account.getRemarkName())) {
return account;
}
if (name.equals(account.getNickName())) {
return account;
}
}
return null;
} } | public class class_name {
@Override
public Account getAccountByName(String name) {
for (Account account : accountMap.values()) {
if (name.equals(account.getRemarkName())) {
return account; // depends on control dependency: [if], data = [none]
}
if (name.equals(account.getNickName())) {
return account; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@SuppressWarnings({"unchecked"})
Set<Class<? extends TrailExceptionHandler<?>>> findTrailExceptionHandlers() {
Set<Class<? extends TrailExceptionHandler<?>>> trailExceptionHandlers = auditConfig.getExceptionHandlers();
if (trailExceptionHandlers.isEmpty()) {
Collection<Class<?>> scannedTrailExceptionHandlers = auditClasses.get(TrailExceptionHandler.class);
LOGGER.info("No audit TrailExceptionHandler specified, using every handler found");
Set<Class<? extends TrailExceptionHandler<?>>> foundExceptionHandlers = new HashSet<>();
for (Class<?> scannedTrailExceptionHandler : scannedTrailExceptionHandlers) {
foundExceptionHandlers.add((Class<? extends TrailExceptionHandler<?>>) scannedTrailExceptionHandler);
LOGGER.info("Registered audit exception handler {}", scannedTrailExceptionHandler);
}
return foundExceptionHandlers;
} else {
return trailExceptionHandlers;
}
} } | public class class_name {
@SuppressWarnings({"unchecked"})
Set<Class<? extends TrailExceptionHandler<?>>> findTrailExceptionHandlers() {
Set<Class<? extends TrailExceptionHandler<?>>> trailExceptionHandlers = auditConfig.getExceptionHandlers();
if (trailExceptionHandlers.isEmpty()) {
Collection<Class<?>> scannedTrailExceptionHandlers = auditClasses.get(TrailExceptionHandler.class);
LOGGER.info("No audit TrailExceptionHandler specified, using every handler found");
Set<Class<? extends TrailExceptionHandler<?>>> foundExceptionHandlers = new HashSet<>();
for (Class<?> scannedTrailExceptionHandler : scannedTrailExceptionHandlers) {
foundExceptionHandlers.add((Class<? extends TrailExceptionHandler<?>>) scannedTrailExceptionHandler);
LOGGER.info("Registered audit exception handler {}", scannedTrailExceptionHandler); // depends on control dependency: [for], data = [none]
}
return foundExceptionHandlers;
} else {
return trailExceptionHandlers;
}
} } |
public class class_name {
public static List<KeyGroupRange> createKeyGroupPartitions(int numberKeyGroups, int parallelism) {
Preconditions.checkArgument(numberKeyGroups >= parallelism);
List<KeyGroupRange> result = new ArrayList<>(parallelism);
for (int i = 0; i < parallelism; ++i) {
result.add(KeyGroupRangeAssignment.computeKeyGroupRangeForOperatorIndex(numberKeyGroups, parallelism, i));
}
return result;
} } | public class class_name {
public static List<KeyGroupRange> createKeyGroupPartitions(int numberKeyGroups, int parallelism) {
Preconditions.checkArgument(numberKeyGroups >= parallelism);
List<KeyGroupRange> result = new ArrayList<>(parallelism);
for (int i = 0; i < parallelism; ++i) {
result.add(KeyGroupRangeAssignment.computeKeyGroupRangeForOperatorIndex(numberKeyGroups, parallelism, i)); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity" })
protected XExpression _generate(XSwitchExpression switchStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
final String varName;
if (switchStatement.getDeclaredParam() != null) {
varName = it.declareUniqueNameVariable(switchStatement.getDeclaredParam(),
switchStatement.getDeclaredParam().getSimpleName());
} else {
varName = it.declareSyntheticVariable(switchStatement, "___expression"); //$NON-NLS-1$
}
it.openPseudoScope();
it.append(varName).append(" = "); //$NON-NLS-1$
generate(switchStatement.getSwitch(), it, context);
it.newLine();
boolean first = true;
boolean fallThrough = false;
for (final XCasePart caseExpression : switchStatement.getCases()) {
if (fallThrough) {
it.append(") or ("); //$NON-NLS-1$
} else if (first) {
it.append("if ("); //$NON-NLS-1$
first = false;
} else {
it.append("elif ("); //$NON-NLS-1$
}
if (caseExpression.getTypeGuard() != null) {
it.append("isinstance(").append(varName); //$NON-NLS-1$
it.append(", ").append(caseExpression.getTypeGuard().getType()); //$NON-NLS-1$
it.append(")"); //$NON-NLS-1$
if (caseExpression.getCase() != null) {
it.append(" and ("); //$NON-NLS-1$
generate(caseExpression.getCase(), it, context);
it.append(")"); //$NON-NLS-1$
final LightweightTypeReference convertedType = getExpectedType(caseExpression.getCase());
if (!convertedType.isType(Boolean.TYPE) && !convertedType.isType(Boolean.class)) {
it.append(" == ").append(varName); //$NON-NLS-1$
}
}
} else if (caseExpression.getCase() != null) {
it.append("("); //$NON-NLS-1$
generate(caseExpression.getCase(), it, context);
it.append(")"); //$NON-NLS-1$
final LightweightTypeReference convertedType = getExpectedType(caseExpression.getCase());
if (!convertedType.isType(Boolean.TYPE) && !convertedType.isType(Boolean.class)) {
it.append(" == ").append(varName); //$NON-NLS-1$
}
}
fallThrough = caseExpression.isFallThrough();
if (!fallThrough) {
it.append("):"); //$NON-NLS-1$
it.increaseIndentation().newLine();
if (caseExpression.getThen() != null) {
generate(caseExpression.getThen(), it, context);
} else {
it.append("pass"); //$NON-NLS-1$
}
it.decreaseIndentation().newLine();
}
}
if (switchStatement.getDefault() != null) {
if (first) {
generate(switchStatement.getDefault(), it, context);
it.newLine();
} else {
it.append("else:"); //$NON-NLS-1$
it.increaseIndentation().newLine();
generate(switchStatement.getDefault(), it, context);
it.decreaseIndentation().newLine();
}
}
it.closeScope();
return switchStatement;
} } | public class class_name {
@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:cyclomaticcomplexity" })
protected XExpression _generate(XSwitchExpression switchStatement, IAppendable it, IExtraLanguageGeneratorContext context) {
final String varName;
if (switchStatement.getDeclaredParam() != null) {
varName = it.declareUniqueNameVariable(switchStatement.getDeclaredParam(),
switchStatement.getDeclaredParam().getSimpleName()); // depends on control dependency: [if], data = [none]
} else {
varName = it.declareSyntheticVariable(switchStatement, "___expression"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.openPseudoScope();
it.append(varName).append(" = "); //$NON-NLS-1$
generate(switchStatement.getSwitch(), it, context);
it.newLine();
boolean first = true;
boolean fallThrough = false;
for (final XCasePart caseExpression : switchStatement.getCases()) {
if (fallThrough) {
it.append(") or ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else if (first) {
it.append("if ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
first = false; // depends on control dependency: [if], data = [none]
} else {
it.append("elif ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
if (caseExpression.getTypeGuard() != null) {
it.append("isinstance(").append(varName); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(", ").append(caseExpression.getTypeGuard().getType()); //$NON-NLS-1$ // depends on control dependency: [if], data = [(caseExpression.getTypeGuard()]
it.append(")"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
if (caseExpression.getCase() != null) {
it.append(" and ("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
generate(caseExpression.getCase(), it, context); // depends on control dependency: [if], data = [(caseExpression.getCase()]
it.append(")"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
final LightweightTypeReference convertedType = getExpectedType(caseExpression.getCase());
if (!convertedType.isType(Boolean.TYPE) && !convertedType.isType(Boolean.class)) {
it.append(" == ").append(varName); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
}
} else if (caseExpression.getCase() != null) {
it.append("("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
generate(caseExpression.getCase(), it, context); // depends on control dependency: [if], data = [(caseExpression.getCase()]
it.append(")"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
final LightweightTypeReference convertedType = getExpectedType(caseExpression.getCase());
if (!convertedType.isType(Boolean.TYPE) && !convertedType.isType(Boolean.class)) {
it.append(" == ").append(varName); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
}
fallThrough = caseExpression.isFallThrough(); // depends on control dependency: [for], data = [caseExpression]
if (!fallThrough) {
it.append("):"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.increaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
if (caseExpression.getThen() != null) {
generate(caseExpression.getThen(), it, context); // depends on control dependency: [if], data = [(caseExpression.getThen()]
} else {
it.append("pass"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.decreaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
}
}
if (switchStatement.getDefault() != null) {
if (first) {
generate(switchStatement.getDefault(), it, context); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
} else {
it.append("else:"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.increaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
generate(switchStatement.getDefault(), it, context); // depends on control dependency: [if], data = [none]
it.decreaseIndentation().newLine(); // depends on control dependency: [if], data = [none]
}
}
it.closeScope();
return switchStatement;
} } |
public class class_name {
public static Typeface getFont(Context context, String fontName) {
synchronized (cache) {
if (!cache.containsKey(fontName)) {
try {
Typeface t = Typeface.createFromAsset(context.getAssets(), fontName);
cache.put(fontName, t);
} catch (Exception e) {
return null;
}
}
return cache.get(fontName);
}
} } | public class class_name {
public static Typeface getFont(Context context, String fontName) {
synchronized (cache) {
if (!cache.containsKey(fontName)) {
try {
Typeface t = Typeface.createFromAsset(context.getAssets(), fontName);
cache.put(fontName, t); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
}
return cache.get(fontName);
}
} } |
public class class_name {
@Override
public EClass getIfcCompressorType() {
if (ifcCompressorTypeEClass == null) {
ifcCompressorTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(116);
}
return ifcCompressorTypeEClass;
} } | public class class_name {
@Override
public EClass getIfcCompressorType() {
if (ifcCompressorTypeEClass == null) {
ifcCompressorTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(116);
// depends on control dependency: [if], data = [none]
}
return ifcCompressorTypeEClass;
} } |
public class class_name {
public void setListObject(Class<?> listDialog, CmsHtmlList listObject) {
if (listObject == null) {
// null object: remove the entry from the map
getListObjectMap(getSettings()).remove(listDialog.getName());
} else {
if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) {
listObject.setMetadata(null);
}
getListObjectMap(getSettings()).put(listDialog.getName(), listObject);
}
} } | public class class_name {
public void setListObject(Class<?> listDialog, CmsHtmlList listObject) {
if (listObject == null) {
// null object: remove the entry from the map
getListObjectMap(getSettings()).remove(listDialog.getName()); // depends on control dependency: [if], data = [none]
} else {
if ((listObject.getMetadata() != null) && listObject.getMetadata().isVolatile()) {
listObject.setMetadata(null); // depends on control dependency: [if], data = [none]
}
getListObjectMap(getSettings()).put(listDialog.getName(), listObject); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean hasAttribute(String key) {
if(localAttributeHolder.get().containsKey(key)) {
return true;
}
return inheritableAttributeHolder.get().containsKey(key);
} } | public class class_name {
public static boolean hasAttribute(String key) {
if(localAttributeHolder.get().containsKey(key)) {
return true; // depends on control dependency: [if], data = [none]
}
return inheritableAttributeHolder.get().containsKey(key);
} } |
public class class_name {
public BigInteger unpackBigInteger()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return BigInteger.valueOf((long) b);
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return BigInteger.valueOf((long) (u8 & 0xff));
case Code.UINT16: // unsigned int 16
short u16 = readShort();
return BigInteger.valueOf((long) (u16 & 0xffff));
case Code.UINT32: // unsigned int 32
int u32 = readInt();
if (u32 < 0) {
return BigInteger.valueOf((long) (u32 & 0x7fffffff) + 0x80000000L);
}
else {
return BigInteger.valueOf((long) u32);
}
case Code.UINT64: // unsigned int 64
long u64 = readLong();
if (u64 < 0L) {
BigInteger bi = BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63);
return bi;
}
else {
return BigInteger.valueOf(u64);
}
case Code.INT8: // signed int 8
byte i8 = readByte();
return BigInteger.valueOf((long) i8);
case Code.INT16: // signed int 16
short i16 = readShort();
return BigInteger.valueOf((long) i16);
case Code.INT32: // signed int 32
int i32 = readInt();
return BigInteger.valueOf((long) i32);
case Code.INT64: // signed int 64
long i64 = readLong();
return BigInteger.valueOf(i64);
}
throw unexpected("Integer", b);
} } | public class class_name {
public BigInteger unpackBigInteger()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return BigInteger.valueOf((long) b);
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return BigInteger.valueOf((long) (u8 & 0xff));
case Code.UINT16: // unsigned int 16
short u16 = readShort();
return BigInteger.valueOf((long) (u16 & 0xffff));
case Code.UINT32: // unsigned int 32
int u32 = readInt();
if (u32 < 0) {
return BigInteger.valueOf((long) (u32 & 0x7fffffff) + 0x80000000L); // depends on control dependency: [if], data = [(u32]
}
else {
return BigInteger.valueOf((long) u32); // depends on control dependency: [if], data = [none]
}
case Code.UINT64: // unsigned int 64
long u64 = readLong();
if (u64 < 0L) {
BigInteger bi = BigInteger.valueOf(u64 + Long.MAX_VALUE + 1L).setBit(63);
return bi; // depends on control dependency: [if], data = [none]
}
else {
return BigInteger.valueOf(u64); // depends on control dependency: [if], data = [(u64]
}
case Code.INT8: // signed int 8
byte i8 = readByte();
return BigInteger.valueOf((long) i8);
case Code.INT16: // signed int 16
short i16 = readShort();
return BigInteger.valueOf((long) i16);
case Code.INT32: // signed int 32
int i32 = readInt();
return BigInteger.valueOf((long) i32);
case Code.INT64: // signed int 64
long i64 = readLong();
return BigInteger.valueOf(i64);
}
throw unexpected("Integer", b);
} } |
public class class_name {
public List<Double> getDoubles(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Double> doubles = new ArrayList<>(strings.size());
for (String value : strings) {
try {
double i = Double.parseDouble(value);
doubles.add(i);
} catch (NumberFormatException e) {
}
}
return Collections.unmodifiableList(doubles);
} } | public class class_name {
public List<Double> getDoubles(String name, String delimiter) {
List<String> strings = getStrings(name, delimiter);
List<Double> doubles = new ArrayList<>(strings.size());
for (String value : strings) {
try {
double i = Double.parseDouble(value);
doubles.add(i); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
} // depends on control dependency: [catch], data = [none]
}
return Collections.unmodifiableList(doubles);
} } |
public class class_name {
public MethodHandle getStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
try {
return getStatic(lookup, target, name);
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new InvalidTransformException(e);
}
} } | public class class_name {
public MethodHandle getStaticQuiet(MethodHandles.Lookup lookup, Class<?> target, String name) {
try {
return getStatic(lookup, target, name); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | NoSuchFieldException e) {
throw new InvalidTransformException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int getEnd(int index) {
// Test if the last beginning is the new end
if(index == (pastIndex - 1))
{
return previousBegin - 1;
}
// Otherwise find it!
int new_end = 0;
for(int i = 0; i < index + 1; i++) {
new_end += getNodeCount(i);
}
pastIndex = index;
previousEnd = new_end;
return new_end - 1;
} } | public class class_name {
public int getEnd(int index) {
// Test if the last beginning is the new end
if(index == (pastIndex - 1))
{
return previousBegin - 1;
// depends on control dependency: [if], data = [none]
}
// Otherwise find it!
int new_end = 0;
for(int i = 0; i < index + 1; i++) {
new_end += getNodeCount(i);
// depends on control dependency: [for], data = [i]
}
pastIndex = index;
previousEnd = new_end;
return new_end - 1;
} } |
public class class_name {
private void verifyChunks( byte[] dataBuf, int dataOff, int len,
byte[] checksumBuf, int checksumOff,
int firstChunkOffset, int packetVersion)
throws IOException {
int chunkOffset = firstChunkOffset;
while (len > 0) {
int chunkLen = Math.min(len, bytesPerChecksum - chunkOffset);
chunkOffset = 0;
checksum.update(dataBuf, dataOff, chunkLen);
dataOff += chunkLen;
boolean checksumCorrect;
if (packetVersion == DataTransferProtocol.PACKET_VERSION_CHECKSUM_FIRST) {
checksumCorrect = checksum.compare(checksumBuf, checksumOff);
checksumOff += checksumSize;
} else {
// Expect packetVersion == DataTransferProtocol.PACKET_VERSION_CHECKSUM_INLINE
checksumCorrect = checksum.compare(dataBuf, dataOff);
dataOff += checksumSize;
}
if (!checksumCorrect) {
if (srcDataNode != null) {
try {
LOG.info("report corrupt block " + block + " from datanode " +
srcDataNode + " to namenode");
LocatedBlock lb = new LocatedBlock(block,
new DatanodeInfo[] {srcDataNode});
datanode.reportBadBlocks(namespaceId, new LocatedBlock[] {lb});
} catch (IOException e) {
LOG.warn("Failed to report bad block " + block +
" from datanode " + srcDataNode + " to namenode");
}
}
throw new IOException("Unexpected checksum mismatch " +
"while writing " + block + " from " + inAddr);
}
checksum.reset();
len -= chunkLen;
}
} } | public class class_name {
private void verifyChunks( byte[] dataBuf, int dataOff, int len,
byte[] checksumBuf, int checksumOff,
int firstChunkOffset, int packetVersion)
throws IOException {
int chunkOffset = firstChunkOffset;
while (len > 0) {
int chunkLen = Math.min(len, bytesPerChecksum - chunkOffset);
chunkOffset = 0;
checksum.update(dataBuf, dataOff, chunkLen);
dataOff += chunkLen;
boolean checksumCorrect;
if (packetVersion == DataTransferProtocol.PACKET_VERSION_CHECKSUM_FIRST) {
checksumCorrect = checksum.compare(checksumBuf, checksumOff); // depends on control dependency: [if], data = [none]
checksumOff += checksumSize; // depends on control dependency: [if], data = [none]
} else {
// Expect packetVersion == DataTransferProtocol.PACKET_VERSION_CHECKSUM_INLINE
checksumCorrect = checksum.compare(dataBuf, dataOff); // depends on control dependency: [if], data = [none]
dataOff += checksumSize; // depends on control dependency: [if], data = [none]
}
if (!checksumCorrect) {
if (srcDataNode != null) {
try {
LOG.info("report corrupt block " + block + " from datanode " +
srcDataNode + " to namenode"); // depends on control dependency: [try], data = [none]
LocatedBlock lb = new LocatedBlock(block,
new DatanodeInfo[] {srcDataNode});
datanode.reportBadBlocks(namespaceId, new LocatedBlock[] {lb}); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOG.warn("Failed to report bad block " + block +
" from datanode " + srcDataNode + " to namenode");
} // depends on control dependency: [catch], data = [none]
}
throw new IOException("Unexpected checksum mismatch " +
"while writing " + block + " from " + inAddr);
}
checksum.reset();
len -= chunkLen;
}
} } |
public class class_name {
public void write(int c) {
try {
synchronized (lock) {
ensureOpen();
out.write(c);
}
}
catch (InterruptedIOException x) {
Thread.currentThread().interrupt();
}
catch (IOException x) {
trouble = true;
}
} } | public class class_name {
public void write(int c) {
try {
synchronized (lock) { // depends on control dependency: [try], data = [none]
ensureOpen();
out.write(c);
}
}
catch (InterruptedIOException x) {
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
catch (IOException x) {
trouble = true;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Status runQuery(QueryOptions options, QueryRowBlock block) {
if (options == null)
options = new QueryOptions();
// OPT: It would be faster to use separate tables for raw-or ascii-collated views so that
// they could be indexed with the right collation, instead of having to specify it here.
String collationStr = "";
if (collation == View.TDViewCollation.TDViewCollationASCII)
collationStr += " COLLATE JSON_ASCII";
else if (collation == View.TDViewCollation.TDViewCollationRaw)
collationStr += " COLLATE JSON_RAW";
StringBuilder sql = new StringBuilder("SELECT key, value, docid, revs.sequence");
if (options.isIncludeDocs()) {
sql.append(", revid, json");
}
sql.append(String.format(Locale.ENGLISH, " FROM 'maps_%s', revs, docs", mapTableName()));
sql.append(" WHERE 1");
List<String> argsList = new ArrayList<String>();
if (options.getKeys() != null && options.getKeys().size() > 0) {
sql.append(" AND key in (");
String item = "?";
for (Object key : options.getKeys()) {
// null key should be ignored
if (key != null) {
sql.append(item);
item = ", ?";
argsList.add(toJSONString(key));
}
}
sql.append(')');
}
Object minKey = options.getStartKey();
Object maxKey = options.getEndKey();
String minKeyDocId = options.getStartKeyDocId();
String maxKeyDocId = options.getEndKeyDocId();
boolean inclusiveMin = options.isInclusiveStart();
boolean inclusiveMax = options.isInclusiveEnd();
if (options.isDescending()) {
Object min = minKey;
minKey = maxKey;
maxKey = min;
inclusiveMin = inclusiveMax;
inclusiveMax = true;
minKeyDocId = options.getEndKeyDocId();
maxKeyDocId = options.getStartKeyDocId();
}
if (minKey != null) {
String minKeyJSON = toJSONString(minKey);
sql.append(inclusiveMin ? " AND key >= ?" : " AND key > ?");
sql.append(collationStr);
argsList.add(minKeyJSON);
if (minKeyDocId != null && inclusiveMin) {
//OPT: This calls the JSON collator a 2nd time unnecessarily.
sql.append(String.format(Locale.ENGLISH, " AND (key > ? %s OR docid >= ?)", collationStr));
argsList.add(minKeyJSON);
argsList.add(minKeyDocId);
}
}
if (maxKey != null) {
maxKey = View.keyForPrefixMatch(maxKey, options.getPrefixMatchLevel());
String maxKeyJSON = toJSONString(maxKey);
sql.append(inclusiveMax ? " AND key <= ?" : " AND key < ?");
sql.append(collationStr);
argsList.add(maxKeyJSON);
if (maxKeyDocId != null && inclusiveMax) {
sql.append(String.format(Locale.ENGLISH, " AND (key < ? %s OR docid <= ?)", collationStr));
argsList.add(maxKeyJSON);
argsList.add(maxKeyDocId);
}
}
sql.append(String.format(Locale.ENGLISH,
" AND revs.sequence = 'maps_%s'.sequence AND docs.doc_id = revs.doc_id ORDER BY key",
mapTableName()));
sql.append(collationStr);
if (options.isDescending()) {
sql.append(" DESC");
}
sql.append(options.isDescending() ? ", docid DESC" : ", docid");
sql.append(" LIMIT ? OFFSET ?");
argsList.add(Integer.toString(options.getLimit()));
argsList.add(Integer.toString(options.getSkip()));
Log.v(Log.TAG_VIEW, "Query %s: %s | args: %s", name, sql.toString(), argsList);
Status status = new Status(Status.OK);
Cursor cursor = null;
try {
cursor = store.getStorageEngine().rawQuery(sql.toString(),
argsList.toArray(new String[argsList.size()]));
// regular query
cursor.moveToNext();
while (!cursor.isAfterLast()) {
// Call the block!
byte[] keyData = cursor.getBlob(0);
byte[] valueData = cursor.getBlob(1);
String docID = cursor.getString(2);
status = block.onRow(keyData, valueData, docID, cursor);
if (status.isError())
break;
else if (status.getCode() <= 0) {
status = new Status(Status.OK);
break;
}
cursor.moveToNext();
}
} finally {
if (cursor != null)
cursor.close();
}
return status;
} } | public class class_name {
private Status runQuery(QueryOptions options, QueryRowBlock block) {
if (options == null)
options = new QueryOptions();
// OPT: It would be faster to use separate tables for raw-or ascii-collated views so that
// they could be indexed with the right collation, instead of having to specify it here.
String collationStr = "";
if (collation == View.TDViewCollation.TDViewCollationASCII)
collationStr += " COLLATE JSON_ASCII";
else if (collation == View.TDViewCollation.TDViewCollationRaw)
collationStr += " COLLATE JSON_RAW";
StringBuilder sql = new StringBuilder("SELECT key, value, docid, revs.sequence");
if (options.isIncludeDocs()) {
sql.append(", revid, json");
}
sql.append(String.format(Locale.ENGLISH, " FROM 'maps_%s', revs, docs", mapTableName()));
sql.append(" WHERE 1");
List<String> argsList = new ArrayList<String>();
if (options.getKeys() != null && options.getKeys().size() > 0) {
sql.append(" AND key in (");
String item = "?";
for (Object key : options.getKeys()) {
// null key should be ignored
if (key != null) {
sql.append(item);
item = ", ?";
argsList.add(toJSONString(key));
}
}
sql.append(')');
}
Object minKey = options.getStartKey();
Object maxKey = options.getEndKey();
String minKeyDocId = options.getStartKeyDocId();
String maxKeyDocId = options.getEndKeyDocId();
boolean inclusiveMin = options.isInclusiveStart();
boolean inclusiveMax = options.isInclusiveEnd();
if (options.isDescending()) {
Object min = minKey;
minKey = maxKey;
maxKey = min;
inclusiveMin = inclusiveMax;
inclusiveMax = true;
minKeyDocId = options.getEndKeyDocId();
maxKeyDocId = options.getStartKeyDocId();
}
if (minKey != null) {
String minKeyJSON = toJSONString(minKey);
sql.append(inclusiveMin ? " AND key >= ?" : " AND key > ?");
sql.append(collationStr);
argsList.add(minKeyJSON);
if (minKeyDocId != null && inclusiveMin) {
//OPT: This calls the JSON collator a 2nd time unnecessarily.
sql.append(String.format(Locale.ENGLISH, " AND (key > ? %s OR docid >= ?)", collationStr)); // depends on control dependency: [if], data = [none]
argsList.add(minKeyJSON); // depends on control dependency: [if], data = [none]
argsList.add(minKeyDocId); // depends on control dependency: [if], data = [(minKeyDocId]
}
}
if (maxKey != null) {
maxKey = View.keyForPrefixMatch(maxKey, options.getPrefixMatchLevel());
String maxKeyJSON = toJSONString(maxKey);
sql.append(inclusiveMax ? " AND key <= ?" : " AND key < ?");
sql.append(collationStr);
argsList.add(maxKeyJSON);
if (maxKeyDocId != null && inclusiveMax) {
sql.append(String.format(Locale.ENGLISH, " AND (key < ? %s OR docid <= ?)", collationStr));
argsList.add(maxKeyJSON);
argsList.add(maxKeyDocId);
}
}
sql.append(String.format(Locale.ENGLISH,
" AND revs.sequence = 'maps_%s'.sequence AND docs.doc_id = revs.doc_id ORDER BY key",
mapTableName()));
sql.append(collationStr);
if (options.isDescending()) {
sql.append(" DESC");
}
sql.append(options.isDescending() ? ", docid DESC" : ", docid");
sql.append(" LIMIT ? OFFSET ?");
argsList.add(Integer.toString(options.getLimit()));
argsList.add(Integer.toString(options.getSkip()));
Log.v(Log.TAG_VIEW, "Query %s: %s | args: %s", name, sql.toString(), argsList);
Status status = new Status(Status.OK);
Cursor cursor = null;
try {
cursor = store.getStorageEngine().rawQuery(sql.toString(),
argsList.toArray(new String[argsList.size()]));
// regular query
cursor.moveToNext();
while (!cursor.isAfterLast()) {
// Call the block!
byte[] keyData = cursor.getBlob(0);
byte[] valueData = cursor.getBlob(1);
String docID = cursor.getString(2);
status = block.onRow(keyData, valueData, docID, cursor);
if (status.isError())
break;
else if (status.getCode() <= 0) {
status = new Status(Status.OK);
break;
}
cursor.moveToNext();
}
} finally {
if (cursor != null)
cursor.close();
}
return status;
} } |
public class class_name {
public java.util.List<String> getAccess() {
if (access == null) {
access = new com.amazonaws.internal.SdkInternalList<String>();
}
return access;
} } | public class class_name {
public java.util.List<String> getAccess() {
if (access == null) {
access = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return access;
} } |
public class class_name {
@Override
public void removeByCommerceShippingFixedOptionId(
long commerceShippingFixedOptionId) {
for (CommerceShippingFixedOptionRel commerceShippingFixedOptionRel : findByCommerceShippingFixedOptionId(
commerceShippingFixedOptionId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null)) {
remove(commerceShippingFixedOptionRel);
}
} } | public class class_name {
@Override
public void removeByCommerceShippingFixedOptionId(
long commerceShippingFixedOptionId) {
for (CommerceShippingFixedOptionRel commerceShippingFixedOptionRel : findByCommerceShippingFixedOptionId(
commerceShippingFixedOptionId, QueryUtil.ALL_POS,
QueryUtil.ALL_POS, null)) {
remove(commerceShippingFixedOptionRel); // depends on control dependency: [for], data = [commerceShippingFixedOptionRel]
}
} } |
public class class_name {
public Number deserializeNumber(String s) {
if(s.indexOf('.') >= 0 || s.indexOf('e') >= 0 || s.indexOf('E') >= 0) {
return Double.valueOf(s);
} else {
Long l = Long.valueOf(s);
if(l > Integer.MAX_VALUE || l <Integer.MIN_VALUE) {
return l;
} else {
return new Integer(l.intValue());
}
}
} } | public class class_name {
public Number deserializeNumber(String s) {
if(s.indexOf('.') >= 0 || s.indexOf('e') >= 0 || s.indexOf('E') >= 0) {
return Double.valueOf(s); // depends on control dependency: [if], data = [none]
} else {
Long l = Long.valueOf(s);
if(l > Integer.MAX_VALUE || l <Integer.MIN_VALUE) {
return l; // depends on control dependency: [if], data = [none]
} else {
return new Integer(l.intValue()); // depends on control dependency: [if], data = [(l]
}
}
} } |
public class class_name {
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
ScheduledExecutorService executor = getScheduledExecutor();
try {
return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), 0, delay, TimeUnit.MILLISECONDS);
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
}
} } | public class class_name {
@Override
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay) {
ScheduledExecutorService executor = getScheduledExecutor();
try {
return executor.scheduleWithFixedDelay(errorHandlingTask(task, true), 0, delay, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (RejectedExecutionException ex) {
throw new TaskRejectedException("Executor [" + executor + "] did not accept task: " + task, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
final public void setDRSBootstrap(boolean drsBootstrap) {
cache.getCacheConfig().setDrsBootstrapEnabled(drsBootstrap);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "setDRSBootstrap() set DRSBootStrap to " + drsBootstrap + " for cacheName=" + cache.getCacheName());
}
} } | public class class_name {
@Override
final public void setDRSBootstrap(boolean drsBootstrap) {
cache.getCacheConfig().setDrsBootstrapEnabled(drsBootstrap);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "setDRSBootstrap() set DRSBootStrap to " + drsBootstrap + " for cacheName=" + cache.getCacheName()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public byte[] convertToXmlByteArray(BucketLoggingConfiguration loggingConfiguration) {
// Default log file prefix to the empty string if none is specified
String logFilePrefix = loggingConfiguration.getLogFilePrefix();
if (logFilePrefix == null)
logFilePrefix = "";
XmlWriter xml = new XmlWriter();
xml.start("BucketLoggingStatus", "xmlns", Constants.XML_NAMESPACE);
if (loggingConfiguration.isLoggingEnabled()) {
xml.start("LoggingEnabled");
xml.start("TargetBucket").value(loggingConfiguration.getDestinationBucketName()).end();
xml.start("TargetPrefix").value(loggingConfiguration.getLogFilePrefix()).end();
xml.end();
}
xml.end();
return xml.getBytes();
} } | public class class_name {
public byte[] convertToXmlByteArray(BucketLoggingConfiguration loggingConfiguration) {
// Default log file prefix to the empty string if none is specified
String logFilePrefix = loggingConfiguration.getLogFilePrefix();
if (logFilePrefix == null)
logFilePrefix = "";
XmlWriter xml = new XmlWriter();
xml.start("BucketLoggingStatus", "xmlns", Constants.XML_NAMESPACE);
if (loggingConfiguration.isLoggingEnabled()) {
xml.start("LoggingEnabled"); // depends on control dependency: [if], data = [none]
xml.start("TargetBucket").value(loggingConfiguration.getDestinationBucketName()).end(); // depends on control dependency: [if], data = [none]
xml.start("TargetPrefix").value(loggingConfiguration.getLogFilePrefix()).end(); // depends on control dependency: [if], data = [none]
xml.end(); // depends on control dependency: [if], data = [none]
}
xml.end();
return xml.getBytes();
} } |
public class class_name {
private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException {
Metric metric = null;
try {
Map<String, Integer> status = getSlaveStatus(conn);
if (status.isEmpty()) {
mysql.closeConnection(conn);
throw new MetricGatheringException("CHECK_MYSQL - WARNING: No slaves defined. ", Status.CRITICAL, null);
}
// check if slave is running
int slaveIoRunning = status.get("Slave_IO_Running");
int slaveSqlRunning = status.get("Slave_SQL_Running");
int secondsBehindMaster = status.get("Seconds_Behind_Master");
if (slaveIoRunning == 0 || slaveSqlRunning == 0) {
mysql.closeConnection(conn);
throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Slave status unavailable. ", Status.CRITICAL, null);
}
String slaveResult = "Slave IO: " + slaveIoRunning + " Slave SQL: " + slaveSqlRunning + " Seconds Behind Master: " + secondsBehindMaster;
metric = new Metric("secondsBehindMaster", slaveResult, new BigDecimal(secondsBehindMaster), null, null);
} catch (SQLException e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing the CheckMysql plugin: " + message, e);
throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Unable to check slave status: - " + message, Status.CRITICAL, e);
}
return metric;
} } | public class class_name {
private Metric checkSlave(final ICommandLine cl, final Mysql mysql, final Connection conn) throws MetricGatheringException {
Metric metric = null;
try {
Map<String, Integer> status = getSlaveStatus(conn);
if (status.isEmpty()) {
mysql.closeConnection(conn); // depends on control dependency: [if], data = [none]
throw new MetricGatheringException("CHECK_MYSQL - WARNING: No slaves defined. ", Status.CRITICAL, null);
}
// check if slave is running
int slaveIoRunning = status.get("Slave_IO_Running");
int slaveSqlRunning = status.get("Slave_SQL_Running");
int secondsBehindMaster = status.get("Seconds_Behind_Master");
if (slaveIoRunning == 0 || slaveSqlRunning == 0) {
mysql.closeConnection(conn); // depends on control dependency: [if], data = [none]
throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Slave status unavailable. ", Status.CRITICAL, null);
}
String slaveResult = "Slave IO: " + slaveIoRunning + " Slave SQL: " + slaveSqlRunning + " Seconds Behind Master: " + secondsBehindMaster;
metric = new Metric("secondsBehindMaster", slaveResult, new BigDecimal(secondsBehindMaster), null, null);
} catch (SQLException e) {
String message = e.getMessage();
LOG.warn(getContext(), "Error executing the CheckMysql plugin: " + message, e);
throw new MetricGatheringException("CHECK_MYSQL - CRITICAL: Unable to check slave status: - " + message, Status.CRITICAL, e);
}
return metric;
} } |
public class class_name {
public void marshall(GetStaticIpsRequest getStaticIpsRequest, ProtocolMarshaller protocolMarshaller) {
if (getStaticIpsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getStaticIpsRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetStaticIpsRequest getStaticIpsRequest, ProtocolMarshaller protocolMarshaller) {
if (getStaticIpsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getStaticIpsRequest.getPageToken(), PAGETOKEN_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 String putHeader(final String name, final String value) {
if (headers == null) {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
}
return headers.put(name, value);
} } | public class class_name {
public String putHeader(final String name, final String value) {
if (headers == null) {
headers = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); // depends on control dependency: [if], data = [none]
}
return headers.put(name, value);
} } |
public class class_name {
public String get(ConfigKey pKey) {
String value = params.get(pKey);
if (value != null) {
return value;
} else {
return pKey.getDefaultValue();
}
} } | public class class_name {
public String get(ConfigKey pKey) {
String value = params.get(pKey);
if (value != null) {
return value; // depends on control dependency: [if], data = [none]
} else {
return pKey.getDefaultValue(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected List<EndpointInfo> doGetUnboundEndpoints(String tenantId,
List<Trace> fragments, boolean compress) {
List<EndpointInfo> ret = new ArrayList<EndpointInfo>();
Map<String, EndpointInfo> map = new HashMap<String, EndpointInfo>();
// Process the fragments to identify which endpoints are not used in any trace
for (int i = 0; i < fragments.size(); i++) {
Trace trace = fragments.get(i);
if (trace.initialFragment() && !trace.getNodes().isEmpty() && trace.getTransaction() == null) {
// Check if top level node is Consumer
if (trace.getNodes().get(0) instanceof Consumer) {
Consumer consumer = (Consumer) trace.getNodes().get(0);
String endpoint = EndpointUtil.encodeEndpoint(consumer.getUri(),
consumer.getOperation());
// Check whether endpoint already known, and that it did not result
// in a fault (e.g. want to ignore spurious URIs that are not
// associated with a valid transaction)
if (!map.containsKey(endpoint) && consumer.getProperties(Constants.PROP_FAULT).isEmpty()) {
EndpointInfo info = new EndpointInfo();
info.setEndpoint(endpoint);
info.setType(consumer.getEndpointType());
ret.add(info);
map.put(endpoint, info);
}
} else {
obtainProducerEndpoints(trace.getNodes(), ret, map);
}
}
}
// Check whether any of the top level endpoints are already associated with
// a transaction config
if (configService != null) {
Map<String, TransactionConfig> configs = configService.getTransactions(tenantId, 0);
for (TransactionConfig config : configs.values()) {
if (config.getFilter() != null && config.getFilter().getInclusions() != null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Remove unbound URIs associated with btxn config=" + config);
}
for (String filter : config.getFilter().getInclusions()) {
if (filter != null && !filter.trim().isEmpty()) {
Iterator<EndpointInfo> iter = ret.iterator();
while (iter.hasNext()) {
EndpointInfo info = iter.next();
if (Pattern.matches(filter, info.getEndpoint())) {
iter.remove();
}
}
}
}
}
}
}
// Check if the endpoints should be compressed to identify common patterns
if (compress) {
ret = compressEndpointInfo(ret);
}
Collections.sort(ret, new Comparator<EndpointInfo>() {
@Override
public int compare(EndpointInfo arg0, EndpointInfo arg1) {
return arg0.getEndpoint().compareTo(arg1.getEndpoint());
}
});
return ret;
} } | public class class_name {
protected List<EndpointInfo> doGetUnboundEndpoints(String tenantId,
List<Trace> fragments, boolean compress) {
List<EndpointInfo> ret = new ArrayList<EndpointInfo>();
Map<String, EndpointInfo> map = new HashMap<String, EndpointInfo>();
// Process the fragments to identify which endpoints are not used in any trace
for (int i = 0; i < fragments.size(); i++) {
Trace trace = fragments.get(i);
if (trace.initialFragment() && !trace.getNodes().isEmpty() && trace.getTransaction() == null) {
// Check if top level node is Consumer
if (trace.getNodes().get(0) instanceof Consumer) {
Consumer consumer = (Consumer) trace.getNodes().get(0);
String endpoint = EndpointUtil.encodeEndpoint(consumer.getUri(),
consumer.getOperation());
// Check whether endpoint already known, and that it did not result
// in a fault (e.g. want to ignore spurious URIs that are not
// associated with a valid transaction)
if (!map.containsKey(endpoint) && consumer.getProperties(Constants.PROP_FAULT).isEmpty()) {
EndpointInfo info = new EndpointInfo();
info.setEndpoint(endpoint); // depends on control dependency: [if], data = [none]
info.setType(consumer.getEndpointType()); // depends on control dependency: [if], data = [none]
ret.add(info); // depends on control dependency: [if], data = [none]
map.put(endpoint, info); // depends on control dependency: [if], data = [none]
}
} else {
obtainProducerEndpoints(trace.getNodes(), ret, map); // depends on control dependency: [if], data = [none]
}
}
}
// Check whether any of the top level endpoints are already associated with
// a transaction config
if (configService != null) {
Map<String, TransactionConfig> configs = configService.getTransactions(tenantId, 0);
for (TransactionConfig config : configs.values()) {
if (config.getFilter() != null && config.getFilter().getInclusions() != null) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Remove unbound URIs associated with btxn config=" + config); // depends on control dependency: [if], data = [none]
}
for (String filter : config.getFilter().getInclusions()) {
if (filter != null && !filter.trim().isEmpty()) {
Iterator<EndpointInfo> iter = ret.iterator();
while (iter.hasNext()) {
EndpointInfo info = iter.next();
if (Pattern.matches(filter, info.getEndpoint())) {
iter.remove(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
}
// Check if the endpoints should be compressed to identify common patterns
if (compress) {
ret = compressEndpointInfo(ret); // depends on control dependency: [if], data = [none]
}
Collections.sort(ret, new Comparator<EndpointInfo>() {
@Override
public int compare(EndpointInfo arg0, EndpointInfo arg1) {
return arg0.getEndpoint().compareTo(arg1.getEndpoint());
}
});
return ret;
} } |
public class class_name {
@Override
public EClass getIfcElectricApplianceType() {
if (ifcElectricApplianceTypeEClass == null) {
ifcElectricApplianceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(210);
}
return ifcElectricApplianceTypeEClass;
} } | public class class_name {
@Override
public EClass getIfcElectricApplianceType() {
if (ifcElectricApplianceTypeEClass == null) {
ifcElectricApplianceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(210);
// depends on control dependency: [if], data = [none]
}
return ifcElectricApplianceTypeEClass;
} } |
public class class_name {
public void broadcastEvent(final int code, final Bundle payload) {
if (SPFConfig.DEBUG) {
Log.d(TAG, "Broadcasting event " + code + " with payload " + payload);
}
for (final OnEventListener listener : mEventListeners) {//TODO is it thread safe?
mHandler.post(new Runnable() {
@Override
public void run() {
listener.onEvent(code, payload);
}
});
}
} } | public class class_name {
public void broadcastEvent(final int code, final Bundle payload) {
if (SPFConfig.DEBUG) {
Log.d(TAG, "Broadcasting event " + code + " with payload " + payload); // depends on control dependency: [if], data = [none]
}
for (final OnEventListener listener : mEventListeners) {//TODO is it thread safe?
mHandler.post(new Runnable() {
@Override
public void run() {
listener.onEvent(code, payload);
}
}); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
protected static List<Field> getSerializeFields(Class targetClass) {
List<Field> all = new ArrayList<Field>();
for (Class<?> c = targetClass; c != Object.class && c != null; c = c.getSuperclass()) {
Field[] fields = c.getDeclaredFields();
for (Field f : fields) {
int mod = f.getModifiers();
// transient, static, @JSONIgnore : skip
if (Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
continue;
}
JSONIgnore ignore = f.getAnnotation(JSONIgnore.class);
if (ignore != null) {
continue;
}
f.setAccessible(true);
all.add(f);
}
}
return all;
} } | public class class_name {
protected static List<Field> getSerializeFields(Class targetClass) {
List<Field> all = new ArrayList<Field>();
for (Class<?> c = targetClass; c != Object.class && c != null; c = c.getSuperclass()) {
Field[] fields = c.getDeclaredFields();
for (Field f : fields) {
int mod = f.getModifiers();
// transient, static, @JSONIgnore : skip
if (Modifier.isStatic(mod) || Modifier.isTransient(mod)) {
continue;
}
JSONIgnore ignore = f.getAnnotation(JSONIgnore.class);
if (ignore != null) {
continue;
}
f.setAccessible(true); // depends on control dependency: [for], data = [f]
all.add(f); // depends on control dependency: [for], data = [f]
}
}
return all;
} } |
public class class_name {
private void serializeEntityDocument(EntityDocument entityDocument) {
try {
if (this.entityDocumentCount > 0) {
this.outputStream.write(JSON_SEP);
}
mapper.writeValue(this.outputStream, entityDocument);
} catch (IOException e) {
reportException(e);
}
this.entityDocumentCount++;
} } | public class class_name {
private void serializeEntityDocument(EntityDocument entityDocument) {
try {
if (this.entityDocumentCount > 0) {
this.outputStream.write(JSON_SEP); // depends on control dependency: [if], data = [none]
}
mapper.writeValue(this.outputStream, entityDocument); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
reportException(e);
} // depends on control dependency: [catch], data = [none]
this.entityDocumentCount++;
} } |
public class class_name {
@Override
public Set<ByteBuffer> toBytesSet(List<T> list) {
Set<ByteBuffer> bytesList = new HashSet<ByteBuffer>(
computeInitialHashSize(list.size()));
for (T s : list) {
bytesList.add(toByteBuffer(s));
}
return bytesList;
} } | public class class_name {
@Override
public Set<ByteBuffer> toBytesSet(List<T> list) {
Set<ByteBuffer> bytesList = new HashSet<ByteBuffer>(
computeInitialHashSize(list.size()));
for (T s : list) {
bytesList.add(toByteBuffer(s)); // depends on control dependency: [for], data = [s]
}
return bytesList;
} } |
public class class_name {
public SearchOptions setLimit(int limit) {
if (limit <= 0) {
this.limit = MAX_LIMIT;
} else {
this.limit = Math.min(limit, MAX_LIMIT);
}
return this;
} } | public class class_name {
public SearchOptions setLimit(int limit) {
if (limit <= 0) {
this.limit = MAX_LIMIT; // depends on control dependency: [if], data = [none]
} else {
this.limit = Math.min(limit, MAX_LIMIT); // depends on control dependency: [if], data = [(limit]
}
return this;
} } |
public class class_name {
public static NumberMath getMath(Number left, Number right) {
// FloatingPointMath wins according to promotion Matrix
if (isFloatingPoint(left) || isFloatingPoint(right)) {
return FloatingPointMath.INSTANCE;
}
NumberMath leftMath = getMath(left);
NumberMath rightMath = getMath(right);
if (leftMath == BigDecimalMath.INSTANCE || rightMath == BigDecimalMath.INSTANCE) {
return BigDecimalMath.INSTANCE;
}
if (leftMath == BigIntegerMath.INSTANCE || rightMath == BigIntegerMath.INSTANCE) {
return BigIntegerMath.INSTANCE;
}
if (leftMath == LongMath.INSTANCE || rightMath == LongMath.INSTANCE) {
return LongMath.INSTANCE;
}
if (leftMath == IntegerMath.INSTANCE || rightMath == IntegerMath.INSTANCE) {
return IntegerMath.INSTANCE;
}
// also for custom Number implementations
return BigDecimalMath.INSTANCE;
} } | public class class_name {
public static NumberMath getMath(Number left, Number right) {
// FloatingPointMath wins according to promotion Matrix
if (isFloatingPoint(left) || isFloatingPoint(right)) {
return FloatingPointMath.INSTANCE; // depends on control dependency: [if], data = [none]
}
NumberMath leftMath = getMath(left);
NumberMath rightMath = getMath(right);
if (leftMath == BigDecimalMath.INSTANCE || rightMath == BigDecimalMath.INSTANCE) {
return BigDecimalMath.INSTANCE; // depends on control dependency: [if], data = [none]
}
if (leftMath == BigIntegerMath.INSTANCE || rightMath == BigIntegerMath.INSTANCE) {
return BigIntegerMath.INSTANCE; // depends on control dependency: [if], data = [none]
}
if (leftMath == LongMath.INSTANCE || rightMath == LongMath.INSTANCE) {
return LongMath.INSTANCE; // depends on control dependency: [if], data = [none]
}
if (leftMath == IntegerMath.INSTANCE || rightMath == IntegerMath.INSTANCE) {
return IntegerMath.INSTANCE; // depends on control dependency: [if], data = [none]
}
// also for custom Number implementations
return BigDecimalMath.INSTANCE;
} } |
public class class_name {
public synchronized Object remove(Object key) {
int index = keys.indexOf(key);
if (index != -1) {
Object prev = elements.elementAt(index);
keys.removeElementAt(index);
elements.removeElementAt(index);
return prev;
} else {
return null;
}
} } | public class class_name {
public synchronized Object remove(Object key) {
int index = keys.indexOf(key);
if (index != -1) {
Object prev = elements.elementAt(index);
keys.removeElementAt(index);
// depends on control dependency: [if], data = [(index]
elements.removeElementAt(index);
// depends on control dependency: [if], data = [(index]
return prev;
// depends on control dependency: [if], data = [none]
} else {
return null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void checkForUpdate( GosuPanel gosuPanel )
{
try
{
Path userFile = getUserFile( gosuPanel );
if( !PathUtil.exists( userFile ) || getVersion( gosuPanel ) < 2 )
{
PathUtil.delete( getUserGosuEditorDir(), true );
}
}
catch( Exception e )
{
PathUtil.delete( getUserGosuEditorDir(), true );
}
} } | public class class_name {
public void checkForUpdate( GosuPanel gosuPanel )
{
try
{
Path userFile = getUserFile( gosuPanel );
if( !PathUtil.exists( userFile ) || getVersion( gosuPanel ) < 2 )
{
PathUtil.delete( getUserGosuEditorDir(), true ); // depends on control dependency: [if], data = [none]
}
}
catch( Exception e )
{
PathUtil.delete( getUserGosuEditorDir(), true );
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void doValidate() {
List<String> errors = new ArrayList<>();
// Strip off user from repository name
String image = user != null ? repository.substring(user.length() + 1) : repository;
Object[] checks = new Object[] {
"registry", DOMAIN_REGEXP, registry,
"image", IMAGE_NAME_REGEXP, image,
"user", NAME_COMP_REGEXP, user,
"tag", TAG_REGEXP, tag,
"digest", DIGEST_REGEXP, digest
};
for (int i = 0; i < checks.length; i +=3) {
String value = (String) checks[i + 2];
Pattern checkPattern = (Pattern) checks[i + 1];
if (value != null &&
!checkPattern.matcher(value).matches()) {
errors.add(String.format("%s part '%s' doesn't match allowed pattern '%s'",
checks[i], value, checkPattern.pattern()));
}
}
if (errors.size() > 0) {
StringBuilder buf = new StringBuilder();
buf.append(String.format("Given Docker name '%s' is invalid:\n", getFullName()));
for (String error : errors) {
buf.append(String.format(" * %s\n",error));
}
buf.append("See http://bit.ly/docker_image_fmt for more details");
throw new IllegalArgumentException(buf.toString());
}
} } | public class class_name {
private void doValidate() {
List<String> errors = new ArrayList<>();
// Strip off user from repository name
String image = user != null ? repository.substring(user.length() + 1) : repository;
Object[] checks = new Object[] {
"registry", DOMAIN_REGEXP, registry,
"image", IMAGE_NAME_REGEXP, image,
"user", NAME_COMP_REGEXP, user,
"tag", TAG_REGEXP, tag,
"digest", DIGEST_REGEXP, digest
};
for (int i = 0; i < checks.length; i +=3) {
String value = (String) checks[i + 2];
Pattern checkPattern = (Pattern) checks[i + 1];
if (value != null &&
!checkPattern.matcher(value).matches()) {
errors.add(String.format("%s part '%s' doesn't match allowed pattern '%s'",
checks[i], value, checkPattern.pattern()));
}
}
if (errors.size() > 0) {
StringBuilder buf = new StringBuilder();
buf.append(String.format("Given Docker name '%s' is invalid:\n", getFullName())); // depends on control dependency: [if], data = [none]
for (String error : errors) {
buf.append(String.format(" * %s\n",error)); // depends on control dependency: [for], data = [error]
}
buf.append("See http://bit.ly/docker_image_fmt for more details");
throw new IllegalArgumentException(buf.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void resolveTimeFields() {
// simplify fields
if (fieldValues.containsKey(CLOCK_HOUR_OF_DAY)) {
// lenient allows anything, smart allows 0-24, strict allows 1-24
long ch = fieldValues.remove(CLOCK_HOUR_OF_DAY);
if (resolverStyle == ResolverStyle.STRICT || (resolverStyle == ResolverStyle.SMART && ch != 0)) {
CLOCK_HOUR_OF_DAY.checkValidValue(ch);
}
updateCheckConflict(CLOCK_HOUR_OF_DAY, HOUR_OF_DAY, ch == 24 ? 0 : ch);
}
if (fieldValues.containsKey(CLOCK_HOUR_OF_AMPM)) {
// lenient allows anything, smart allows 0-12, strict allows 1-12
long ch = fieldValues.remove(CLOCK_HOUR_OF_AMPM);
if (resolverStyle == ResolverStyle.STRICT || (resolverStyle == ResolverStyle.SMART && ch != 0)) {
CLOCK_HOUR_OF_AMPM.checkValidValue(ch);
}
updateCheckConflict(CLOCK_HOUR_OF_AMPM, HOUR_OF_AMPM, ch == 12 ? 0 : ch);
}
if (fieldValues.containsKey(AMPM_OF_DAY) && fieldValues.containsKey(HOUR_OF_AMPM)) {
long ap = fieldValues.remove(AMPM_OF_DAY);
long hap = fieldValues.remove(HOUR_OF_AMPM);
if (resolverStyle == ResolverStyle.LENIENT) {
updateCheckConflict(AMPM_OF_DAY, HOUR_OF_DAY, Math.addExact(Math.multiplyExact(ap, 12), hap));
} else { // STRICT or SMART
AMPM_OF_DAY.checkValidValue(ap);
HOUR_OF_AMPM.checkValidValue(ap);
updateCheckConflict(AMPM_OF_DAY, HOUR_OF_DAY, ap * 12 + hap);
}
}
if (fieldValues.containsKey(NANO_OF_DAY)) {
long nod = fieldValues.remove(NANO_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
NANO_OF_DAY.checkValidValue(nod);
}
updateCheckConflict(NANO_OF_DAY, HOUR_OF_DAY, nod / 3600_000_000_000L);
updateCheckConflict(NANO_OF_DAY, MINUTE_OF_HOUR, (nod / 60_000_000_000L) % 60);
updateCheckConflict(NANO_OF_DAY, SECOND_OF_MINUTE, (nod / 1_000_000_000L) % 60);
updateCheckConflict(NANO_OF_DAY, NANO_OF_SECOND, nod % 1_000_000_000L);
}
if (fieldValues.containsKey(MICRO_OF_DAY)) {
long cod = fieldValues.remove(MICRO_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MICRO_OF_DAY.checkValidValue(cod);
}
updateCheckConflict(MICRO_OF_DAY, SECOND_OF_DAY, cod / 1_000_000L);
updateCheckConflict(MICRO_OF_DAY, MICRO_OF_SECOND, cod % 1_000_000L);
}
if (fieldValues.containsKey(MILLI_OF_DAY)) {
long lod = fieldValues.remove(MILLI_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MILLI_OF_DAY.checkValidValue(lod);
}
updateCheckConflict(MILLI_OF_DAY, SECOND_OF_DAY, lod / 1_000);
updateCheckConflict(MILLI_OF_DAY, MILLI_OF_SECOND, lod % 1_000);
}
if (fieldValues.containsKey(SECOND_OF_DAY)) {
long sod = fieldValues.remove(SECOND_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
SECOND_OF_DAY.checkValidValue(sod);
}
updateCheckConflict(SECOND_OF_DAY, HOUR_OF_DAY, sod / 3600);
updateCheckConflict(SECOND_OF_DAY, MINUTE_OF_HOUR, (sod / 60) % 60);
updateCheckConflict(SECOND_OF_DAY, SECOND_OF_MINUTE, sod % 60);
}
if (fieldValues.containsKey(MINUTE_OF_DAY)) {
long mod = fieldValues.remove(MINUTE_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MINUTE_OF_DAY.checkValidValue(mod);
}
updateCheckConflict(MINUTE_OF_DAY, HOUR_OF_DAY, mod / 60);
updateCheckConflict(MINUTE_OF_DAY, MINUTE_OF_HOUR, mod % 60);
}
// combine partial second fields strictly, leaving lenient expansion to later
if (fieldValues.containsKey(NANO_OF_SECOND)) {
long nos = fieldValues.get(NANO_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
NANO_OF_SECOND.checkValidValue(nos);
}
if (fieldValues.containsKey(MICRO_OF_SECOND)) {
long cos = fieldValues.remove(MICRO_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
MICRO_OF_SECOND.checkValidValue(cos);
}
nos = cos * 1000 + (nos % 1000);
updateCheckConflict(MICRO_OF_SECOND, NANO_OF_SECOND, nos);
}
if (fieldValues.containsKey(MILLI_OF_SECOND)) {
long los = fieldValues.remove(MILLI_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
MILLI_OF_SECOND.checkValidValue(los);
}
updateCheckConflict(MILLI_OF_SECOND, NANO_OF_SECOND, los * 1_000_000L + (nos % 1_000_000L));
}
}
// convert to time if all four fields available (optimization)
if (fieldValues.containsKey(HOUR_OF_DAY) && fieldValues.containsKey(MINUTE_OF_HOUR) &&
fieldValues.containsKey(SECOND_OF_MINUTE) && fieldValues.containsKey(NANO_OF_SECOND)) {
long hod = fieldValues.remove(HOUR_OF_DAY);
long moh = fieldValues.remove(MINUTE_OF_HOUR);
long som = fieldValues.remove(SECOND_OF_MINUTE);
long nos = fieldValues.remove(NANO_OF_SECOND);
resolveTime(hod, moh, som, nos);
}
} } | public class class_name {
private void resolveTimeFields() {
// simplify fields
if (fieldValues.containsKey(CLOCK_HOUR_OF_DAY)) {
// lenient allows anything, smart allows 0-24, strict allows 1-24
long ch = fieldValues.remove(CLOCK_HOUR_OF_DAY);
if (resolverStyle == ResolverStyle.STRICT || (resolverStyle == ResolverStyle.SMART && ch != 0)) {
CLOCK_HOUR_OF_DAY.checkValidValue(ch); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(CLOCK_HOUR_OF_DAY, HOUR_OF_DAY, ch == 24 ? 0 : ch); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(CLOCK_HOUR_OF_AMPM)) {
// lenient allows anything, smart allows 0-12, strict allows 1-12
long ch = fieldValues.remove(CLOCK_HOUR_OF_AMPM);
if (resolverStyle == ResolverStyle.STRICT || (resolverStyle == ResolverStyle.SMART && ch != 0)) {
CLOCK_HOUR_OF_AMPM.checkValidValue(ch); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(CLOCK_HOUR_OF_AMPM, HOUR_OF_AMPM, ch == 12 ? 0 : ch); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(AMPM_OF_DAY) && fieldValues.containsKey(HOUR_OF_AMPM)) {
long ap = fieldValues.remove(AMPM_OF_DAY);
long hap = fieldValues.remove(HOUR_OF_AMPM);
if (resolverStyle == ResolverStyle.LENIENT) {
updateCheckConflict(AMPM_OF_DAY, HOUR_OF_DAY, Math.addExact(Math.multiplyExact(ap, 12), hap)); // depends on control dependency: [if], data = [none]
} else { // STRICT or SMART
AMPM_OF_DAY.checkValidValue(ap); // depends on control dependency: [if], data = [none]
HOUR_OF_AMPM.checkValidValue(ap); // depends on control dependency: [if], data = [none]
updateCheckConflict(AMPM_OF_DAY, HOUR_OF_DAY, ap * 12 + hap); // depends on control dependency: [if], data = [none]
}
}
if (fieldValues.containsKey(NANO_OF_DAY)) {
long nod = fieldValues.remove(NANO_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
NANO_OF_DAY.checkValidValue(nod); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(NANO_OF_DAY, HOUR_OF_DAY, nod / 3600_000_000_000L); // depends on control dependency: [if], data = [none]
updateCheckConflict(NANO_OF_DAY, MINUTE_OF_HOUR, (nod / 60_000_000_000L) % 60); // depends on control dependency: [if], data = [none]
updateCheckConflict(NANO_OF_DAY, SECOND_OF_MINUTE, (nod / 1_000_000_000L) % 60); // depends on control dependency: [if], data = [none]
updateCheckConflict(NANO_OF_DAY, NANO_OF_SECOND, nod % 1_000_000_000L); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(MICRO_OF_DAY)) {
long cod = fieldValues.remove(MICRO_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MICRO_OF_DAY.checkValidValue(cod); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(MICRO_OF_DAY, SECOND_OF_DAY, cod / 1_000_000L); // depends on control dependency: [if], data = [none]
updateCheckConflict(MICRO_OF_DAY, MICRO_OF_SECOND, cod % 1_000_000L); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(MILLI_OF_DAY)) {
long lod = fieldValues.remove(MILLI_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MILLI_OF_DAY.checkValidValue(lod); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(MILLI_OF_DAY, SECOND_OF_DAY, lod / 1_000); // depends on control dependency: [if], data = [none]
updateCheckConflict(MILLI_OF_DAY, MILLI_OF_SECOND, lod % 1_000); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(SECOND_OF_DAY)) {
long sod = fieldValues.remove(SECOND_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
SECOND_OF_DAY.checkValidValue(sod); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(SECOND_OF_DAY, HOUR_OF_DAY, sod / 3600); // depends on control dependency: [if], data = [none]
updateCheckConflict(SECOND_OF_DAY, MINUTE_OF_HOUR, (sod / 60) % 60); // depends on control dependency: [if], data = [none]
updateCheckConflict(SECOND_OF_DAY, SECOND_OF_MINUTE, sod % 60); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(MINUTE_OF_DAY)) {
long mod = fieldValues.remove(MINUTE_OF_DAY);
if (resolverStyle != ResolverStyle.LENIENT) {
MINUTE_OF_DAY.checkValidValue(mod); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(MINUTE_OF_DAY, HOUR_OF_DAY, mod / 60); // depends on control dependency: [if], data = [none]
updateCheckConflict(MINUTE_OF_DAY, MINUTE_OF_HOUR, mod % 60); // depends on control dependency: [if], data = [none]
}
// combine partial second fields strictly, leaving lenient expansion to later
if (fieldValues.containsKey(NANO_OF_SECOND)) {
long nos = fieldValues.get(NANO_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
NANO_OF_SECOND.checkValidValue(nos); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(MICRO_OF_SECOND)) {
long cos = fieldValues.remove(MICRO_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
MICRO_OF_SECOND.checkValidValue(cos); // depends on control dependency: [if], data = [none]
}
nos = cos * 1000 + (nos % 1000); // depends on control dependency: [if], data = [none]
updateCheckConflict(MICRO_OF_SECOND, NANO_OF_SECOND, nos); // depends on control dependency: [if], data = [none]
}
if (fieldValues.containsKey(MILLI_OF_SECOND)) {
long los = fieldValues.remove(MILLI_OF_SECOND);
if (resolverStyle != ResolverStyle.LENIENT) {
MILLI_OF_SECOND.checkValidValue(los); // depends on control dependency: [if], data = [none]
}
updateCheckConflict(MILLI_OF_SECOND, NANO_OF_SECOND, los * 1_000_000L + (nos % 1_000_000L)); // depends on control dependency: [if], data = [none]
}
}
// convert to time if all four fields available (optimization)
if (fieldValues.containsKey(HOUR_OF_DAY) && fieldValues.containsKey(MINUTE_OF_HOUR) &&
fieldValues.containsKey(SECOND_OF_MINUTE) && fieldValues.containsKey(NANO_OF_SECOND)) {
long hod = fieldValues.remove(HOUR_OF_DAY);
long moh = fieldValues.remove(MINUTE_OF_HOUR);
long som = fieldValues.remove(SECOND_OF_MINUTE);
long nos = fieldValues.remove(NANO_OF_SECOND);
resolveTime(hod, moh, som, nos); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void queueObjects(List<T> objects) {
if (objects == null || objects.size() == 0)
return;
boolean readyToProcess = false;
synchronized (mutex) {
Log.v(Log.TAG_BATCHER, "%s: queueObjects called with %d objects (current inbox size = %d)",
this, objects.size(), inbox.size());
inbox.addAll(objects);
mutex.notifyAll();
if (isFlushing) {
// Skip scheduling as flushing is processing all the queue objects:
return;
}
scheduleBatchProcess(false);
if (inbox.size() >= capacity && isPendingFutureReadyOrInProcessing())
readyToProcess = true;
}
if (readyToProcess) {
// Give work executor chance to work on a scheduled task and to obtain the
// mutex lock when another thread keeps adding objects to the queue fast:
synchronized (processMutex) {
try {
processMutex.wait(5);
} catch (InterruptedException e) {
}
}
}
} } | public class class_name {
public void queueObjects(List<T> objects) {
if (objects == null || objects.size() == 0)
return;
boolean readyToProcess = false;
synchronized (mutex) {
Log.v(Log.TAG_BATCHER, "%s: queueObjects called with %d objects (current inbox size = %d)",
this, objects.size(), inbox.size());
inbox.addAll(objects);
mutex.notifyAll();
if (isFlushing) {
// Skip scheduling as flushing is processing all the queue objects:
return; // depends on control dependency: [if], data = [none]
}
scheduleBatchProcess(false);
if (inbox.size() >= capacity && isPendingFutureReadyOrInProcessing())
readyToProcess = true;
}
if (readyToProcess) {
// Give work executor chance to work on a scheduled task and to obtain the
// mutex lock when another thread keeps adding objects to the queue fast:
synchronized (processMutex) { // depends on control dependency: [if], data = [none]
try {
processMutex.wait(5); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private static Map<Class<?>, SerDeserializer> loadFromClasspath() {
// log errors to System.err, as problems in static initializers can be troublesome to diagnose
Map<Class<?>, SerDeserializer> result = new HashMap<>();
URL url = null;
try {
// this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
loader = RenameHandler.class.getClassLoader();
}
Enumeration<URL> en = loader.getResources("META-INF/org/joda/beans/JodaBeans.ini");
while (en.hasMoreElements()) {
url = en.nextElement();
List<String> lines = loadRenameFile(url);
parseRenameFile(lines, url, result);
}
} catch (Error | Exception ex) {
System.err.println("ERROR: Unable to load JodaBeans.ini: " + url + ": " + ex.getMessage());
ex.printStackTrace();
result.clear();
}
return result;
} } | public class class_name {
private static Map<Class<?>, SerDeserializer> loadFromClasspath() {
// log errors to System.err, as problems in static initializers can be troublesome to diagnose
Map<Class<?>, SerDeserializer> result = new HashMap<>();
URL url = null;
try {
// this is the new location of the file, working on Java 8, Java 9 class path and Java 9 module path
ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null) {
loader = RenameHandler.class.getClassLoader(); // depends on control dependency: [if], data = [none]
}
Enumeration<URL> en = loader.getResources("META-INF/org/joda/beans/JodaBeans.ini");
while (en.hasMoreElements()) {
url = en.nextElement();
List<String> lines = loadRenameFile(url);
parseRenameFile(lines, url, result);
}
} catch (Error | Exception ex) {
System.err.println("ERROR: Unable to load JodaBeans.ini: " + url + ": " + ex.getMessage());
ex.printStackTrace();
result.clear();
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
public List<ActiveRule> getActiveRules(RulePriority severity) {
List<ActiveRule> result = new ArrayList<>();
for (ActiveRule activeRule : activeRules) {
if (activeRule.getSeverity().equals(severity) && activeRule.isEnabled()) {
result.add(activeRule);
}
}
return result;
} } | public class class_name {
public List<ActiveRule> getActiveRules(RulePriority severity) {
List<ActiveRule> result = new ArrayList<>();
for (ActiveRule activeRule : activeRules) {
if (activeRule.getSeverity().equals(severity) && activeRule.isEnabled()) {
result.add(activeRule); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
private static Set<String> getIncludedProjectIdentifiers(final Project project) {
return getCachedReference(project, "thorntail_included_project_identifiers", () -> {
Set<String> identifiers = new HashSet<>();
// Check for included builds as well.
project.getGradle().getIncludedBuilds().forEach(build -> {
// Determine if the given reference has the following method definition,
// org.gradle.internal.build.IncludedBuildState#getAvailableModules()
try {
Method method = build.getClass().getMethod("getAvailableModules");
Class<?> retType = method.getReturnType();
if (Set.class.isAssignableFrom(retType)) {
// We have identified the right method. Get the values out of it.
Set availableModules = (Set) method.invoke(build);
for (Object entry : availableModules) {
Field field = entry.getClass().getField("left");
Object value = field.get(entry);
if (value instanceof ModuleVersionIdentifier) {
ModuleVersionIdentifier mv = (ModuleVersionIdentifier) value;
identifiers.add(String.format("%s:%s:%s", mv.getGroup(), mv.getName(), mv.getVersion()));
} else {
project.getLogger().debug("Unable to determine field type: {}", field);
}
}
} else {
project.getLogger().debug("Unable to determine method return type: {}", retType);
}
} catch (ReflectiveOperationException e) {
project.getLogger().debug("Unable to determine the included projects.", e);
}
});
return identifiers;
});
} } | public class class_name {
private static Set<String> getIncludedProjectIdentifiers(final Project project) {
return getCachedReference(project, "thorntail_included_project_identifiers", () -> {
Set<String> identifiers = new HashSet<>();
// Check for included builds as well.
project.getGradle().getIncludedBuilds().forEach(build -> {
// Determine if the given reference has the following method definition,
// org.gradle.internal.build.IncludedBuildState#getAvailableModules()
try {
Method method = build.getClass().getMethod("getAvailableModules");
Class<?> retType = method.getReturnType();
if (Set.class.isAssignableFrom(retType)) {
// We have identified the right method. Get the values out of it.
Set availableModules = (Set) method.invoke(build);
for (Object entry : availableModules) {
Field field = entry.getClass().getField("left");
Object value = field.get(entry);
if (value instanceof ModuleVersionIdentifier) {
ModuleVersionIdentifier mv = (ModuleVersionIdentifier) value;
identifiers.add(String.format("%s:%s:%s", mv.getGroup(), mv.getName(), mv.getVersion())); // depends on control dependency: [if], data = [none]
} else {
project.getLogger().debug("Unable to determine field type: {}", field); // depends on control dependency: [if], data = [none]
}
}
} else {
project.getLogger().debug("Unable to determine method return type: {}", retType);
}
} catch (ReflectiveOperationException e) {
project.getLogger().debug("Unable to determine the included projects.", e);
}
});
return identifiers;
});
} } |
public class class_name {
private void readColDefinitions() {
// VALUE COLUMNS AND COLUMNS THAT ARE NOT PART OF THE PRIMARY KEY
Statement query = QueryBuilder.select().from("system", "schema_columns")
.where(eq("keyspace_name", keyspaceName))
.and(eq("columnfamily_name", cfName));
ResultSet rs = session.execute(query);
List<Row> rows = rs.all();
if (rows != null && rows.size() > 0) {
List<CqlColumnDefinitionImpl> tmpList = new ArrayList<CqlColumnDefinitionImpl>();
for (Row row : rows) {
CqlColumnDefinitionImpl colDef = new CqlColumnDefinitionImpl(row);
switch (colDef.getColumnType()) {
case partition_key:
partitionKeyList.add(colDef);
allColumnsDefinitionList.add(colDef);
break;
case clustering_key:
tmpList.add(colDef);
allColumnsDefinitionList.add(colDef);
break;
case regular:
regularColumnList.add(colDef);
allColumnsDefinitionList.add(colDef);
break;
case compact_value:
regularColumnList.add(colDef);
allColumnsDefinitionList.add(colDef);
break;
}
}
Collections.sort(tmpList);
clusteringKeyList.addAll(tmpList);
tmpList = null;
List<String> allPrimaryKeyColNames = new ArrayList<String>();
for (ColumnDefinition colDef : partitionKeyList) {
allPrimaryKeyColNames.add(colDef.getName());
}
for (ColumnDefinition colDef : clusteringKeyList) {
allPrimaryKeyColNames.add(colDef.getName());
}
allPkColNames = allPrimaryKeyColNames.toArray(new String[allPrimaryKeyColNames.size()]);
}
} } | public class class_name {
private void readColDefinitions() {
// VALUE COLUMNS AND COLUMNS THAT ARE NOT PART OF THE PRIMARY KEY
Statement query = QueryBuilder.select().from("system", "schema_columns")
.where(eq("keyspace_name", keyspaceName))
.and(eq("columnfamily_name", cfName));
ResultSet rs = session.execute(query);
List<Row> rows = rs.all();
if (rows != null && rows.size() > 0) {
List<CqlColumnDefinitionImpl> tmpList = new ArrayList<CqlColumnDefinitionImpl>();
for (Row row : rows) {
CqlColumnDefinitionImpl colDef = new CqlColumnDefinitionImpl(row);
switch (colDef.getColumnType()) {
case partition_key:
partitionKeyList.add(colDef); // depends on control dependency: [for], data = [none]
allColumnsDefinitionList.add(colDef); // depends on control dependency: [for], data = [none]
break;
case clustering_key:
tmpList.add(colDef); // depends on control dependency: [for], data = [none]
allColumnsDefinitionList.add(colDef); // depends on control dependency: [for], data = [none]
break;
case regular:
regularColumnList.add(colDef); // depends on control dependency: [for], data = [none]
allColumnsDefinitionList.add(colDef); // depends on control dependency: [for], data = [none]
break;
case compact_value:
regularColumnList.add(colDef); // depends on control dependency: [for], data = [none]
allColumnsDefinitionList.add(colDef); // depends on control dependency: [for], data = [none]
break;
}
}
Collections.sort(tmpList);
clusteringKeyList.addAll(tmpList);
tmpList = null;
List<String> allPrimaryKeyColNames = new ArrayList<String>();
for (ColumnDefinition colDef : partitionKeyList) {
allPrimaryKeyColNames.add(colDef.getName()); // depends on control dependency: [for], data = [colDef]
}
for (ColumnDefinition colDef : clusteringKeyList) {
allPrimaryKeyColNames.add(colDef.getName()); // depends on control dependency: [for], data = [colDef]
}
allPkColNames = allPrimaryKeyColNames.toArray(new String[allPrimaryKeyColNames.size()]);
}
} } |
public class class_name {
private boolean notOverriddenIn(Type site, Symbol sym) {
if (sym.kind != MTH || sym.isConstructor() || sym.isStatic())
return true;
else {
Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
return (s2 == null || s2 == sym || sym.owner == s2.owner ||
!types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym)));
}
} } | public class class_name {
private boolean notOverriddenIn(Type site, Symbol sym) {
if (sym.kind != MTH || sym.isConstructor() || sym.isStatic())
return true;
else {
Symbol s2 = ((MethodSymbol)sym).implementation(site.tsym, types, true);
return (s2 == null || s2 == sym || sym.owner == s2.owner ||
!types.isSubSignature(types.memberType(site, s2), types.memberType(site, sym))); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Map<String, MergedVertex> getMergedVertexes(Shape shape)
{
Map<String, MergedVertex> mergedVertexes = new HashMap<>();
for (Face f : shape.getFaces())
{
for (Vertex v : f.getVertexes())
{
MergedVertex mv = mergedVertexes.get(v.baseName());
if (mv == null)
{
mv = new MergedVertex(v);
mergedVertexes.put(v.baseName(), mv);
}
else
mv.addVertex(v);
}
}
return mergedVertexes;
} } | public class class_name {
public static Map<String, MergedVertex> getMergedVertexes(Shape shape)
{
Map<String, MergedVertex> mergedVertexes = new HashMap<>();
for (Face f : shape.getFaces())
{
for (Vertex v : f.getVertexes())
{
MergedVertex mv = mergedVertexes.get(v.baseName());
if (mv == null)
{
mv = new MergedVertex(v); // depends on control dependency: [if], data = [none]
mergedVertexes.put(v.baseName(), mv); // depends on control dependency: [if], data = [none]
}
else
mv.addVertex(v);
}
}
return mergedVertexes;
} } |
public class class_name {
@Override
public void writeObject(Map<Object, Object> map) {
if (!checkWriteReference(map)) {
storeReference(map);
buf.put(AMF.TYPE_OBJECT);
boolean isBeanMap = (map instanceof BeanMap);
for (Map.Entry<Object, Object> entry : map.entrySet()) {
if (isBeanMap && "class".equals(entry.getKey())) {
continue;
}
putString(entry.getKey().toString());
Serializer.serialize(this, entry.getValue());
}
buf.put(AMF.END_OF_OBJECT_SEQUENCE);
}
} } | public class class_name {
@Override
public void writeObject(Map<Object, Object> map) {
if (!checkWriteReference(map)) {
storeReference(map); // depends on control dependency: [if], data = [none]
buf.put(AMF.TYPE_OBJECT); // depends on control dependency: [if], data = [none]
boolean isBeanMap = (map instanceof BeanMap);
for (Map.Entry<Object, Object> entry : map.entrySet()) {
if (isBeanMap && "class".equals(entry.getKey())) {
continue;
}
putString(entry.getKey().toString()); // depends on control dependency: [for], data = [entry]
Serializer.serialize(this, entry.getValue()); // depends on control dependency: [for], data = [entry]
}
buf.put(AMF.END_OF_OBJECT_SEQUENCE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ResponseLaunchTemplateData withElasticInferenceAccelerators(LaunchTemplateElasticInferenceAcceleratorResponse... elasticInferenceAccelerators) {
if (this.elasticInferenceAccelerators == null) {
setElasticInferenceAccelerators(new com.amazonaws.internal.SdkInternalList<LaunchTemplateElasticInferenceAcceleratorResponse>(
elasticInferenceAccelerators.length));
}
for (LaunchTemplateElasticInferenceAcceleratorResponse ele : elasticInferenceAccelerators) {
this.elasticInferenceAccelerators.add(ele);
}
return this;
} } | public class class_name {
public ResponseLaunchTemplateData withElasticInferenceAccelerators(LaunchTemplateElasticInferenceAcceleratorResponse... elasticInferenceAccelerators) {
if (this.elasticInferenceAccelerators == null) {
setElasticInferenceAccelerators(new com.amazonaws.internal.SdkInternalList<LaunchTemplateElasticInferenceAcceleratorResponse>(
elasticInferenceAccelerators.length)); // depends on control dependency: [if], data = [none]
}
for (LaunchTemplateElasticInferenceAcceleratorResponse ele : elasticInferenceAccelerators) {
this.elasticInferenceAccelerators.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static String getTrimmedStackTrace(Throwable exception) {
List<String> trimmedStackTraceLines = getTrimmedStackTraceLines(exception);
if (trimmedStackTraceLines.isEmpty()) {
return getFullStackTrace(exception);
}
StringBuilder result = new StringBuilder(exception.toString());
appendStackTraceLines(trimmedStackTraceLines, result);
appendStackTraceLines(getCauseStackTraceLines(exception), result);
return result.toString();
} } | public class class_name {
public static String getTrimmedStackTrace(Throwable exception) {
List<String> trimmedStackTraceLines = getTrimmedStackTraceLines(exception);
if (trimmedStackTraceLines.isEmpty()) {
return getFullStackTrace(exception); // depends on control dependency: [if], data = [none]
}
StringBuilder result = new StringBuilder(exception.toString());
appendStackTraceLines(trimmedStackTraceLines, result);
appendStackTraceLines(getCauseStackTraceLines(exception), result);
return result.toString();
} } |
public class class_name {
@SuppressWarnings("PMD.NcssCount")
static String escape(String str) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < str.length(); ++i) {
char c = str.charAt(i);
switch (c) {
case '\t': builder.append("\\t"); break;
case '\n': builder.append("\\n"); break;
case '\r': builder.append("\\r"); break;
case '\f': builder.append("\\f"); break;
case '\\': builder.append("\\\\"); break;
case '^': builder.append("\\^"); break;
case '$': builder.append("\\$"); break;
case '.': builder.append("\\."); break;
case '?': builder.append("\\?"); break;
case '*': builder.append("\\*"); break;
case '+': builder.append("\\+"); break;
case '[': builder.append("\\["); break;
case ']': builder.append("\\]"); break;
case '(': builder.append("\\("); break;
case ')': builder.append("\\)"); break;
case '{': builder.append("\\{"); break;
case '}': builder.append("\\}"); break;
default:
if (c <= ' ' || c > '~') {
builder.append(String.format("\\u%04x", (int) c));
} else {
builder.append(c);
}
break;
}
}
return builder.toString();
} } | public class class_name {
@SuppressWarnings("PMD.NcssCount")
static String escape(String str) {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < str.length(); ++i) {
char c = str.charAt(i);
switch (c) {
case '\t': builder.append("\\t"); break;
case '\n': builder.append("\\n"); break;
case '\r': builder.append("\\r"); break;
case '\f': builder.append("\\f"); break;
case '\\': builder.append("\\\\"); break;
case '^': builder.append("\\^"); break;
case '$': builder.append("\\$"); break;
case '.': builder.append("\\."); break;
case '?': builder.append("\\?"); break;
case '*': builder.append("\\*"); break;
case '+': builder.append("\\+"); break;
case '[': builder.append("\\["); break;
case ']': builder.append("\\]"); break;
case '(': builder.append("\\("); break;
case ')': builder.append("\\)"); break;
case '{': builder.append("\\{"); break;
case '}': builder.append("\\}"); break;
default:
if (c <= ' ' || c > '~') {
builder.append(String.format("\\u%04x", (int) c)); // depends on control dependency: [if], data = [none]
} else {
builder.append(c); // depends on control dependency: [if], data = [none]
}
break;
}
}
return builder.toString();
} } |
public class class_name {
public void addSwitchWithOptionalExtraPart(String option, String optionExtraPartSynopsis, String description) {
optionList.add(option);
optionExtraPartSynopsisMap.put(option, optionExtraPartSynopsis);
optionDescriptionMap.put(option, description);
// Option will display as -foo[:extraPartSynopsis]
int length = option.length() + optionExtraPartSynopsis.length() + 3;
if (length > maxWidth) {
maxWidth = length;
}
} } | public class class_name {
public void addSwitchWithOptionalExtraPart(String option, String optionExtraPartSynopsis, String description) {
optionList.add(option);
optionExtraPartSynopsisMap.put(option, optionExtraPartSynopsis);
optionDescriptionMap.put(option, description);
// Option will display as -foo[:extraPartSynopsis]
int length = option.length() + optionExtraPartSynopsis.length() + 3;
if (length > maxWidth) {
maxWidth = length; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected SimpleNumberFormatter<N> createSimpleFormatter(final FieldAccessor field, final Configuration config) {
final Optional<CsvNumberFormat> formatAnno = field.getAnnotation(CsvNumberFormat.class);
if(!formatAnno.isPresent()) {
return new SimpleNumberFormatter<>((Class<N>)field.getType(), false);
}
final boolean lenient = formatAnno.get().lenient();
final RoundingMode roundingMode = formatAnno.get().rounding();
final int precision = formatAnno.get().precision();
final SimpleNumberFormatter<N> formatter;
if(precision >= 0) {
formatter = new SimpleNumberFormatter<>((Class<N>)field.getType(), lenient, new MathContext(precision, roundingMode));
} else {
formatter = new SimpleNumberFormatter<>((Class<N>)field.getType(), lenient);
}
formatter.setValidationMessage(formatAnno.get().message());
return formatter;
} } | public class class_name {
@SuppressWarnings("unchecked")
protected SimpleNumberFormatter<N> createSimpleFormatter(final FieldAccessor field, final Configuration config) {
final Optional<CsvNumberFormat> formatAnno = field.getAnnotation(CsvNumberFormat.class);
if(!formatAnno.isPresent()) {
return new SimpleNumberFormatter<>((Class<N>)field.getType(), false);
// depends on control dependency: [if], data = [none]
}
final boolean lenient = formatAnno.get().lenient();
final RoundingMode roundingMode = formatAnno.get().rounding();
final int precision = formatAnno.get().precision();
final SimpleNumberFormatter<N> formatter;
if(precision >= 0) {
formatter = new SimpleNumberFormatter<>((Class<N>)field.getType(), lenient, new MathContext(precision, roundingMode));
// depends on control dependency: [if], data = [(precision]
} else {
formatter = new SimpleNumberFormatter<>((Class<N>)field.getType(), lenient);
// depends on control dependency: [if], data = [none]
}
formatter.setValidationMessage(formatAnno.get().message());
return formatter;
} } |
public class class_name {
public final EObject rulePredicated() throws RecognitionException {
EObject current = null;
Token this_OPEN_0=null;
Token this_OPEN_1=null;
Token otherlv_3=null;
Token otherlv_4=null;
Token otherlv_6=null;
EObject lv_predicate_2_0 = null;
EObject lv_element_5_0 = null;
enterRule();
try {
// InternalSimpleAntlr.g:1321:28: ( (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' ) )
// InternalSimpleAntlr.g:1322:1: (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' )
{
// InternalSimpleAntlr.g:1322:1: (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' )
// InternalSimpleAntlr.g:1322:2: this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')'
{
this_OPEN_0=(Token)match(input,RULE_OPEN,FOLLOW_24); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(this_OPEN_0, grammarAccess.getPredicatedAccess().getOPENTerminalRuleCall_0());
}
this_OPEN_1=(Token)match(input,RULE_OPEN,FOLLOW_14); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(this_OPEN_1, grammarAccess.getPredicatedAccess().getOPENTerminalRuleCall_1());
}
// InternalSimpleAntlr.g:1330:1: ( (lv_predicate_2_0= ruleAlternatives ) )
// InternalSimpleAntlr.g:1331:1: (lv_predicate_2_0= ruleAlternatives )
{
// InternalSimpleAntlr.g:1331:1: (lv_predicate_2_0= ruleAlternatives )
// InternalSimpleAntlr.g:1332:3: lv_predicate_2_0= ruleAlternatives
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getPredicatedAccess().getPredicateAlternativesParserRuleCall_2_0());
}
pushFollow(FOLLOW_27);
lv_predicate_2_0=ruleAlternatives();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getPredicatedRule());
}
set(
current,
"predicate",
lv_predicate_2_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.Alternatives");
afterParserOrEnumRuleCall();
}
}
}
otherlv_3=(Token)match(input,34,FOLLOW_23); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getPredicatedAccess().getRightParenthesisKeyword_3());
}
otherlv_4=(Token)match(input,30,FOLLOW_18); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getPredicatedAccess().getEqualsSignGreaterThanSignKeyword_4());
}
// InternalSimpleAntlr.g:1356:1: ( (lv_element_5_0= ruleOtherElement ) )
// InternalSimpleAntlr.g:1357:1: (lv_element_5_0= ruleOtherElement )
{
// InternalSimpleAntlr.g:1357:1: (lv_element_5_0= ruleOtherElement )
// InternalSimpleAntlr.g:1358:3: lv_element_5_0= ruleOtherElement
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getPredicatedAccess().getElementOtherElementParserRuleCall_5_0());
}
pushFollow(FOLLOW_27);
lv_element_5_0=ruleOtherElement();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getPredicatedRule());
}
set(
current,
"element",
lv_element_5_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.OtherElement");
afterParserOrEnumRuleCall();
}
}
}
otherlv_6=(Token)match(input,34,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getPredicatedAccess().getRightParenthesisKeyword_6());
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject rulePredicated() throws RecognitionException {
EObject current = null;
Token this_OPEN_0=null;
Token this_OPEN_1=null;
Token otherlv_3=null;
Token otherlv_4=null;
Token otherlv_6=null;
EObject lv_predicate_2_0 = null;
EObject lv_element_5_0 = null;
enterRule();
try {
// InternalSimpleAntlr.g:1321:28: ( (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' ) )
// InternalSimpleAntlr.g:1322:1: (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' )
{
// InternalSimpleAntlr.g:1322:1: (this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')' )
// InternalSimpleAntlr.g:1322:2: this_OPEN_0= RULE_OPEN this_OPEN_1= RULE_OPEN ( (lv_predicate_2_0= ruleAlternatives ) ) otherlv_3= ')' otherlv_4= '=>' ( (lv_element_5_0= ruleOtherElement ) ) otherlv_6= ')'
{
this_OPEN_0=(Token)match(input,RULE_OPEN,FOLLOW_24); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(this_OPEN_0, grammarAccess.getPredicatedAccess().getOPENTerminalRuleCall_0()); // depends on control dependency: [if], data = [none]
}
this_OPEN_1=(Token)match(input,RULE_OPEN,FOLLOW_14); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(this_OPEN_1, grammarAccess.getPredicatedAccess().getOPENTerminalRuleCall_1()); // depends on control dependency: [if], data = [none]
}
// InternalSimpleAntlr.g:1330:1: ( (lv_predicate_2_0= ruleAlternatives ) )
// InternalSimpleAntlr.g:1331:1: (lv_predicate_2_0= ruleAlternatives )
{
// InternalSimpleAntlr.g:1331:1: (lv_predicate_2_0= ruleAlternatives )
// InternalSimpleAntlr.g:1332:3: lv_predicate_2_0= ruleAlternatives
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getPredicatedAccess().getPredicateAlternativesParserRuleCall_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_27);
lv_predicate_2_0=ruleAlternatives();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getPredicatedRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"predicate",
lv_predicate_2_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.Alternatives"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_3=(Token)match(input,34,FOLLOW_23); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_3, grammarAccess.getPredicatedAccess().getRightParenthesisKeyword_3()); // depends on control dependency: [if], data = [none]
}
otherlv_4=(Token)match(input,30,FOLLOW_18); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getPredicatedAccess().getEqualsSignGreaterThanSignKeyword_4()); // depends on control dependency: [if], data = [none]
}
// InternalSimpleAntlr.g:1356:1: ( (lv_element_5_0= ruleOtherElement ) )
// InternalSimpleAntlr.g:1357:1: (lv_element_5_0= ruleOtherElement )
{
// InternalSimpleAntlr.g:1357:1: (lv_element_5_0= ruleOtherElement )
// InternalSimpleAntlr.g:1358:3: lv_element_5_0= ruleOtherElement
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getPredicatedAccess().getElementOtherElementParserRuleCall_5_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_27);
lv_element_5_0=ruleOtherElement();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getPredicatedRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"element",
lv_element_5_0,
"org.eclipse.xtext.generator.parser.antlr.debug.SimpleAntlr.OtherElement"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_6=(Token)match(input,34,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getPredicatedAccess().getRightParenthesisKeyword_6()); // depends on control dependency: [if], data = [none]
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
JSMessageData getCopy() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getCopy");
JSMessageImpl copy;
synchronized (getMessageLockArtefact()) {
// Create a new instance of ourselves
copy = new JSMessageImpl(this);
// Allow the message data to be lazy-copied
copy.lazyCopy(this);
// The copy is a new top-level message
copy.setMaster();
// We must clear our boxed cache at this stage, since items in the
// boxed cache may refer to entries in our now potentially shared cache
// and this could result in consistency problems. By clearing the
// cache here it will get recreated with new copies when required.
if (boxManager != null) {
boxManager.reset();
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getCopy", copy);
return copy;
} } | public class class_name {
JSMessageData getCopy() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "getCopy");
JSMessageImpl copy;
synchronized (getMessageLockArtefact()) {
// Create a new instance of ourselves
copy = new JSMessageImpl(this);
// Allow the message data to be lazy-copied
copy.lazyCopy(this);
// The copy is a new top-level message
copy.setMaster();
// We must clear our boxed cache at this stage, since items in the
// boxed cache may refer to entries in our now potentially shared cache
// and this could result in consistency problems. By clearing the
// cache here it will get recreated with new copies when required.
if (boxManager != null) {
boxManager.reset(); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "getCopy", copy);
return copy;
} } |
public class class_name {
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)
{
Project.Resources resources = project.getResources();
if (resources != null)
{
for (Project.Resources.Resource resource : resources.getResource())
{
readResource(resource, calendarMap);
}
}
} } | public class class_name {
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)
{
Project.Resources resources = project.getResources();
if (resources != null)
{
for (Project.Resources.Resource resource : resources.getResource())
{
readResource(resource, calendarMap); // depends on control dependency: [for], data = [resource]
}
}
} } |
public class class_name {
public static void closeEL(Closeable c) {
try {
if (c != null) c.close();
}
// catch (AlwaysThrow at) {throw at;}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
}
} } | public class class_name {
public static void closeEL(Closeable c) {
try {
if (c != null) c.close();
}
// catch (AlwaysThrow at) {throw at;}
catch (Throwable e) {
ExceptionUtil.rethrowIfNecessary(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public SparseMatrix abmm(SparseMatrix B) {
if (ncols != B.nrows) {
throw new IllegalArgumentException(String.format("Matrix dimensions do not match for matrix multiplication: %d x %d vs %d x %d", nrows(), ncols(), B.nrows(), B.ncols()));
}
int m = nrows;
int anz = size();
int n = B.ncols;
int[] Bp = B.colIndex;
int[] Bi = B.rowIndex;
double[] Bx = B.x;
int bnz = Bp[n];
int[] w = new int[m];
double[] abj = new double[m];
int nzmax = Math.max(anz + bnz, m);
SparseMatrix C = new SparseMatrix(m, n, nzmax);
int[] Cp = C.colIndex;
int[] Ci = C.rowIndex;
double[] Cx = C.x;
int nz = 0;
for (int j = 0; j < n; j++) {
if (nz + m > nzmax) {
nzmax = 2 * nzmax + m;
double[] Cx2 = new double[nzmax];
int[] Ci2 = new int[nzmax];
System.arraycopy(Ci, 0, Ci2, 0, nz);
System.arraycopy(Cx, 0, Cx2, 0, nz);
Ci = Ci2;
Cx = Cx2;
C.rowIndex = Ci;
C.x = Cx;
}
// column j of C starts here
Cp[j] = nz;
for (int p = Bp[j]; p < Bp[j + 1]; p++) {
nz = scatter(this, Bi[p], Bx[p], w, abj, j + 1, C, nz);
}
for (int p = Cp[j]; p < nz; p++) {
Cx[p] = abj[Ci[p]];
}
}
// finalize the last column of C
Cp[n] = nz;
return C;
} } | public class class_name {
@Override
public SparseMatrix abmm(SparseMatrix B) {
if (ncols != B.nrows) {
throw new IllegalArgumentException(String.format("Matrix dimensions do not match for matrix multiplication: %d x %d vs %d x %d", nrows(), ncols(), B.nrows(), B.ncols()));
}
int m = nrows;
int anz = size();
int n = B.ncols;
int[] Bp = B.colIndex;
int[] Bi = B.rowIndex;
double[] Bx = B.x;
int bnz = Bp[n];
int[] w = new int[m];
double[] abj = new double[m];
int nzmax = Math.max(anz + bnz, m);
SparseMatrix C = new SparseMatrix(m, n, nzmax);
int[] Cp = C.colIndex;
int[] Ci = C.rowIndex;
double[] Cx = C.x;
int nz = 0;
for (int j = 0; j < n; j++) {
if (nz + m > nzmax) {
nzmax = 2 * nzmax + m; // depends on control dependency: [if], data = [none]
double[] Cx2 = new double[nzmax];
int[] Ci2 = new int[nzmax];
System.arraycopy(Ci, 0, Ci2, 0, nz); // depends on control dependency: [if], data = [none]
System.arraycopy(Cx, 0, Cx2, 0, nz); // depends on control dependency: [if], data = [none]
Ci = Ci2; // depends on control dependency: [if], data = [none]
Cx = Cx2; // depends on control dependency: [if], data = [none]
C.rowIndex = Ci; // depends on control dependency: [if], data = [none]
C.x = Cx; // depends on control dependency: [if], data = [none]
}
// column j of C starts here
Cp[j] = nz; // depends on control dependency: [for], data = [j]
for (int p = Bp[j]; p < Bp[j + 1]; p++) {
nz = scatter(this, Bi[p], Bx[p], w, abj, j + 1, C, nz); // depends on control dependency: [for], data = [p]
}
for (int p = Cp[j]; p < nz; p++) {
Cx[p] = abj[Ci[p]]; // depends on control dependency: [for], data = [p]
}
}
// finalize the last column of C
Cp[n] = nz;
return C;
} } |
public class class_name {
public static double spearman(float[] x, float[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException("Input vector sizes are different.");
}
int n = x.length;
double[] wksp1 = new double[n];
double[] wksp2 = new double[n];
for (int j = 0; j < n; j++) {
wksp1[j] = x[j];
wksp2[j] = y[j];
}
QuickSort.sort(wksp1, wksp2);
double sf = crank(wksp1);
QuickSort.sort(wksp2, wksp1);
double sg = crank(wksp2);
double d = 0.0;
for (int j = 0; j < n; j++) {
d += Math.sqr(wksp1[j] - wksp2[j]);
}
int en = n;
double en3n = en * en * en - en;
double fac = (1.0 - sf / en3n) * (1.0 - sg / en3n);
double rs = (1.0 - (6.0 / en3n) * (d + (sf + sg) / 12.0)) / Math.sqrt(fac);
return rs;
} } | public class class_name {
public static double spearman(float[] x, float[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException("Input vector sizes are different.");
}
int n = x.length;
double[] wksp1 = new double[n];
double[] wksp2 = new double[n];
for (int j = 0; j < n; j++) {
wksp1[j] = x[j]; // depends on control dependency: [for], data = [j]
wksp2[j] = y[j]; // depends on control dependency: [for], data = [j]
}
QuickSort.sort(wksp1, wksp2);
double sf = crank(wksp1);
QuickSort.sort(wksp2, wksp1);
double sg = crank(wksp2);
double d = 0.0;
for (int j = 0; j < n; j++) {
d += Math.sqr(wksp1[j] - wksp2[j]); // depends on control dependency: [for], data = [j]
}
int en = n;
double en3n = en * en * en - en;
double fac = (1.0 - sf / en3n) * (1.0 - sg / en3n);
double rs = (1.0 - (6.0 / en3n) * (d + (sf + sg) / 12.0)) / Math.sqrt(fac);
return rs;
} } |
public class class_name {
private void updateViewDefaultTemplateWhenGovernanceIsNotInstalled(DbSession dbSession, PermissionTemplateDto template, DefaultTemplates defaultTemplates) {
String viewDefaultTemplateUuid = defaultTemplates.getApplicationsUuid();
if (viewDefaultTemplateUuid != null && viewDefaultTemplateUuid.equals(template.getUuid())) {
defaultTemplates.setApplicationsUuid(null);
dbClient.organizationDao().setDefaultTemplates(dbSession, template.getOrganizationUuid(), defaultTemplates);
}
} } | public class class_name {
private void updateViewDefaultTemplateWhenGovernanceIsNotInstalled(DbSession dbSession, PermissionTemplateDto template, DefaultTemplates defaultTemplates) {
String viewDefaultTemplateUuid = defaultTemplates.getApplicationsUuid();
if (viewDefaultTemplateUuid != null && viewDefaultTemplateUuid.equals(template.getUuid())) {
defaultTemplates.setApplicationsUuid(null); // depends on control dependency: [if], data = [none]
dbClient.organizationDao().setDefaultTemplates(dbSession, template.getOrganizationUuid(), defaultTemplates); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String selectSingleNodeValue(Node node, String xpathQuery) {
Node resultNode = node.selectSingleNode(xpathQuery);
if (resultNode != null) {
return resultNode.getText();
} else {
return null;
}
} } | public class class_name {
public static String selectSingleNodeValue(Node node, String xpathQuery) {
Node resultNode = node.selectSingleNode(xpathQuery);
if (resultNode != null) {
return resultNode.getText(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void turnOnVIVOPush(final AVCallback<Boolean> callback) {
com.vivo.push.PushClient.getInstance(AVOSCloud.getContext()).turnOnPush(new com.vivo.push.IPushActionListener() {
public void onStateChanged(int state) {
if (null == callback) {
AVException exception = null;
if (0 != state) {
exception = new AVException(AVException.UNKNOWN, "VIVO server internal error, state=" + state);
}
callback.internalDone(null == exception, exception);
}
}
});
} } | public class class_name {
public static void turnOnVIVOPush(final AVCallback<Boolean> callback) {
com.vivo.push.PushClient.getInstance(AVOSCloud.getContext()).turnOnPush(new com.vivo.push.IPushActionListener() {
public void onStateChanged(int state) {
if (null == callback) {
AVException exception = null;
if (0 != state) {
exception = new AVException(AVException.UNKNOWN, "VIVO server internal error, state=" + state); // depends on control dependency: [if], data = [state)]
}
callback.internalDone(null == exception, exception); // depends on control dependency: [if], data = [(null]
}
}
});
} } |
public class class_name {
public static Map<Object, Object> getProperties(JComponent component) {
Map<Object, Object> retVal = new HashMap<Object, Object>();
Class<?> clazz = component.getClass();
Method[] methods = clazz.getMethods();
Object value = null;
for (Method method : methods) {
if (method.getName().matches("^(is|get).*") &&
method.getParameterTypes().length == 0) {
try {
Class returnType = method.getReturnType();
if (returnType != void.class &&
!returnType.getName().startsWith("[") &&
!setExclude.contains(method.getName())) {
String key = method.getName();
value = method.invoke(component);
if (value != null && !(value instanceof Component)) {
retVal.put(key, value);
}
}
// ignore exceptions that arise if the property could not be accessed
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) {
} catch (InvocationTargetException ex) {
}
}
}
return retVal;
} } | public class class_name {
public static Map<Object, Object> getProperties(JComponent component) {
Map<Object, Object> retVal = new HashMap<Object, Object>();
Class<?> clazz = component.getClass();
Method[] methods = clazz.getMethods();
Object value = null;
for (Method method : methods) {
if (method.getName().matches("^(is|get).*") &&
method.getParameterTypes().length == 0) {
try {
Class returnType = method.getReturnType();
if (returnType != void.class &&
!returnType.getName().startsWith("[") &&
!setExclude.contains(method.getName())) {
String key = method.getName();
value = method.invoke(component); // depends on control dependency: [if], data = [none]
if (value != null && !(value instanceof Component)) {
retVal.put(key, value); // depends on control dependency: [if], data = [none]
}
}
// ignore exceptions that arise if the property could not be accessed
} catch (IllegalAccessException ex) {
} catch (IllegalArgumentException ex) { // depends on control dependency: [catch], data = [none]
} catch (InvocationTargetException ex) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
}
}
return retVal;
} } |
public class class_name {
private void migrate(DictSegment[] segmentArray , Map<Character , DictSegment> segmentMap){
for(DictSegment segment : segmentArray){
if(segment != null){
segmentMap.put(segment.nodeChar, segment);
}
}
} } | public class class_name {
private void migrate(DictSegment[] segmentArray , Map<Character , DictSegment> segmentMap){
for(DictSegment segment : segmentArray){
if(segment != null){
segmentMap.put(segment.nodeChar, segment); // depends on control dependency: [if], data = [(segment]
}
}
} } |
public class class_name {
@Override
public void removeRequestHeader(String headerName) {
Header[] headers = getRequestHeaderGroup().getHeaders(headerName);
for (int i = 0; i < headers.length; i++) {
getRequestHeaderGroup().removeHeader(headers[i]);
}
} } | public class class_name {
@Override
public void removeRequestHeader(String headerName) {
Header[] headers = getRequestHeaderGroup().getHeaders(headerName);
for (int i = 0; i < headers.length; i++) {
getRequestHeaderGroup().removeHeader(headers[i]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public String removeFileExtension(String fileName) {
int dotIndex = fileName.lastIndexOf(".");
if (dotIndex > 0) {
fileName = fileName.substring(0, dotIndex);
}
return fileName;
} } | public class class_name {
public String removeFileExtension(String fileName) {
int dotIndex = fileName.lastIndexOf(".");
if (dotIndex > 0) {
fileName = fileName.substring(0, dotIndex); // depends on control dependency: [if], data = [none]
}
return fileName;
} } |
public class class_name {
@Override
public EntityIdentifier[] searchForGroups(
String query, SearchMethod searchMethod, Class leafType) throws GroupsException {
List ids = new ArrayList();
File baseDir = getFileRoot(leafType);
if (log.isDebugEnabled())
log.debug(
DEBUG_CLASS_NAME
+ "searchForGroups(): "
+ query
+ " method: "
+ searchMethod
+ " type: "
+ leafType);
if (baseDir != null) {
String nameFilter = null;
switch (searchMethod) {
case DISCRETE:
case DISCRETE_CI:
nameFilter = query;
break;
case STARTS_WITH:
case STARTS_WITH_CI:
nameFilter = query + ".*";
break;
case ENDS_WITH:
case ENDS_WITH_CI:
nameFilter = ".*" + query;
break;
case CONTAINS:
case CONTAINS_CI:
nameFilter = ".*" + query + ".*";
break;
default:
throw new GroupsException(
DEBUG_CLASS_NAME
+ ".searchForGroups(): Unknown search method: "
+ searchMethod);
}
final Pattern namePattern = Pattern.compile(nameFilter);
final FilenameFilter filter =
new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return namePattern.matcher(name).matches();
}
};
Set allDirs = getAllDirectoriesBelow(baseDir);
allDirs.add(baseDir);
for (Iterator itr = allDirs.iterator(); itr.hasNext(); ) {
File[] files = ((File) itr.next()).listFiles(filter);
for (int filesIdx = 0; filesIdx < files.length; filesIdx++) {
String key = getKeyFromFile(files[filesIdx]);
EntityIdentifier ei =
new EntityIdentifier(key, ICompositeGroupService.GROUP_ENTITY_TYPE);
ids.add(ei);
}
}
}
if (log.isDebugEnabled())
log.debug(DEBUG_CLASS_NAME + ".searchForGroups(): found " + ids.size() + " files.");
return (EntityIdentifier[]) ids.toArray(new EntityIdentifier[ids.size()]);
} } | public class class_name {
@Override
public EntityIdentifier[] searchForGroups(
String query, SearchMethod searchMethod, Class leafType) throws GroupsException {
List ids = new ArrayList();
File baseDir = getFileRoot(leafType);
if (log.isDebugEnabled())
log.debug(
DEBUG_CLASS_NAME
+ "searchForGroups(): "
+ query
+ " method: "
+ searchMethod
+ " type: "
+ leafType);
if (baseDir != null) {
String nameFilter = null;
switch (searchMethod) {
case DISCRETE:
case DISCRETE_CI:
nameFilter = query;
break;
case STARTS_WITH:
case STARTS_WITH_CI:
nameFilter = query + ".*";
break;
case ENDS_WITH:
case ENDS_WITH_CI:
nameFilter = ".*" + query;
break;
case CONTAINS:
case CONTAINS_CI:
nameFilter = ".*" + query + ".*";
break;
default:
throw new GroupsException(
DEBUG_CLASS_NAME
+ ".searchForGroups(): Unknown search method: "
+ searchMethod);
}
final Pattern namePattern = Pattern.compile(nameFilter);
final FilenameFilter filter =
new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return namePattern.matcher(name).matches();
}
};
Set allDirs = getAllDirectoriesBelow(baseDir);
allDirs.add(baseDir);
for (Iterator itr = allDirs.iterator(); itr.hasNext(); ) {
File[] files = ((File) itr.next()).listFiles(filter);
for (int filesIdx = 0; filesIdx < files.length; filesIdx++) {
String key = getKeyFromFile(files[filesIdx]);
EntityIdentifier ei =
new EntityIdentifier(key, ICompositeGroupService.GROUP_ENTITY_TYPE);
ids.add(ei); // depends on control dependency: [for], data = [none]
}
}
}
if (log.isDebugEnabled())
log.debug(DEBUG_CLASS_NAME + ".searchForGroups(): found " + ids.size() + " files.");
return (EntityIdentifier[]) ids.toArray(new EntityIdentifier[ids.size()]);
} } |
public class class_name {
static boolean containsUnicodeEscape(String s) {
String esc = REGEXP_ESCAPER.regexpEscape(s);
for (int i = -1; (i = esc.indexOf("\\u", i + 1)) >= 0;) {
int nSlashes = 0;
while (i - nSlashes > 0 && '\\' == esc.charAt(i - nSlashes - 1)) {
++nSlashes;
}
// if there are an even number of slashes before the \ u then it is a
// Unicode literal.
if (0 == (nSlashes & 1)) { return true; }
}
return false;
} } | public class class_name {
static boolean containsUnicodeEscape(String s) {
String esc = REGEXP_ESCAPER.regexpEscape(s);
for (int i = -1; (i = esc.indexOf("\\u", i + 1)) >= 0;) {
int nSlashes = 0;
while (i - nSlashes > 0 && '\\' == esc.charAt(i - nSlashes - 1)) {
++nSlashes; // depends on control dependency: [while], data = [none]
}
// if there are an even number of slashes before the \ u then it is a
// Unicode literal.
if (0 == (nSlashes & 1)) { return true; } // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public Timestamp[] toArray(Timestamp[] a) {
int n = data.size();
if (a.length < n) {
a = new Timestamp[n];
}
for (int i = 0; i < n; i++) {
a[i] = data.get(i).timestamp;
}
for (int i = n; i < a.length; i++) {
a[i] = null;
}
return a;
} } | public class class_name {
public Timestamp[] toArray(Timestamp[] a) {
int n = data.size();
if (a.length < n) {
a = new Timestamp[n]; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < n; i++) {
a[i] = data.get(i).timestamp; // depends on control dependency: [for], data = [i]
}
for (int i = n; i < a.length; i++) {
a[i] = null; // depends on control dependency: [for], data = [i]
}
return a;
} } |
public class class_name {
public void marshall(DeleteBotChannelAssociationRequest deleteBotChannelAssociationRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteBotChannelAssociationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getBotName(), BOTNAME_BINDING);
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getBotAlias(), BOTALIAS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteBotChannelAssociationRequest deleteBotChannelAssociationRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteBotChannelAssociationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getBotName(), BOTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteBotChannelAssociationRequest.getBotAlias(), BOTALIAS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private double valueToPixelValue(GriddedTile griddedTile, double value) {
double pixelValue = value;
if (griddedCoverage != null
&& griddedCoverage.getDataType() == GriddedCoverageDataType.INTEGER) {
pixelValue -= griddedCoverage.getOffset();
pixelValue /= griddedCoverage.getScale();
if (griddedTile != null) {
pixelValue -= griddedTile.getOffset();
pixelValue /= griddedTile.getScale();
}
}
return pixelValue;
} } | public class class_name {
private double valueToPixelValue(GriddedTile griddedTile, double value) {
double pixelValue = value;
if (griddedCoverage != null
&& griddedCoverage.getDataType() == GriddedCoverageDataType.INTEGER) {
pixelValue -= griddedCoverage.getOffset(); // depends on control dependency: [if], data = [none]
pixelValue /= griddedCoverage.getScale(); // depends on control dependency: [if], data = [none]
if (griddedTile != null) {
pixelValue -= griddedTile.getOffset(); // depends on control dependency: [if], data = [none]
pixelValue /= griddedTile.getScale(); // depends on control dependency: [if], data = [none]
}
}
return pixelValue;
} } |
public class class_name {
public void marshall(DocumentClassifierProperties documentClassifierProperties, ProtocolMarshaller protocolMarshaller) {
if (documentClassifierProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(documentClassifierProperties.getDocumentClassifierArn(), DOCUMENTCLASSIFIERARN_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getLanguageCode(), LANGUAGECODE_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getMessage(), MESSAGE_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getSubmitTime(), SUBMITTIME_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getTrainingStartTime(), TRAININGSTARTTIME_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getTrainingEndTime(), TRAININGENDTIME_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getInputDataConfig(), INPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getClassifierMetadata(), CLASSIFIERMETADATA_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING);
protocolMarshaller.marshall(documentClassifierProperties.getVolumeKmsKeyId(), VOLUMEKMSKEYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DocumentClassifierProperties documentClassifierProperties, ProtocolMarshaller protocolMarshaller) {
if (documentClassifierProperties == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(documentClassifierProperties.getDocumentClassifierArn(), DOCUMENTCLASSIFIERARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getLanguageCode(), LANGUAGECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getMessage(), MESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getSubmitTime(), SUBMITTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getTrainingStartTime(), TRAININGSTARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getTrainingEndTime(), TRAININGENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getInputDataConfig(), INPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getOutputDataConfig(), OUTPUTDATACONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getClassifierMetadata(), CLASSIFIERMETADATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getDataAccessRoleArn(), DATAACCESSROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(documentClassifierProperties.getVolumeKmsKeyId(), VOLUMEKMSKEYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Table<String, Integer, ProgramController> createFlowlets(Program program, RunId runId,
FlowSpecification flowSpec) {
Table<String, Integer, ProgramController> flowlets = HashBasedTable.create();
try {
for (Map.Entry<String, FlowletDefinition> entry : flowSpec.getFlowlets().entrySet()) {
int instanceCount = entry.getValue().getInstances();
for (int instanceId = 0; instanceId < instanceCount; instanceId++) {
flowlets.put(entry.getKey(), instanceId,
startFlowlet(program, createFlowletOptions(entry.getKey(), instanceId, instanceCount, runId)));
}
}
} catch (Throwable t) {
try {
// Need to stop all started flowlets
Futures.successfulAsList(Iterables.transform(flowlets.values(),
new Function<ProgramController, ListenableFuture<?>>() {
@Override
public ListenableFuture<?> apply(ProgramController controller) {
return controller.stop();
}
})).get();
} catch (Exception e) {
LOG.error("Fail to stop all flowlets on failure.");
}
throw Throwables.propagate(t);
}
return flowlets;
} } | public class class_name {
private Table<String, Integer, ProgramController> createFlowlets(Program program, RunId runId,
FlowSpecification flowSpec) {
Table<String, Integer, ProgramController> flowlets = HashBasedTable.create();
try {
for (Map.Entry<String, FlowletDefinition> entry : flowSpec.getFlowlets().entrySet()) {
int instanceCount = entry.getValue().getInstances();
for (int instanceId = 0; instanceId < instanceCount; instanceId++) {
flowlets.put(entry.getKey(), instanceId,
startFlowlet(program, createFlowletOptions(entry.getKey(), instanceId, instanceCount, runId))); // depends on control dependency: [for], data = [instanceId]
}
}
} catch (Throwable t) {
try {
// Need to stop all started flowlets
Futures.successfulAsList(Iterables.transform(flowlets.values(),
new Function<ProgramController, ListenableFuture<?>>() {
@Override
public ListenableFuture<?> apply(ProgramController controller) {
return controller.stop();
}
})).get();
} catch (Exception e) {
LOG.error("Fail to stop all flowlets on failure.");
}
throw Throwables.propagate(t);
}
return flowlets;
} } |
public class class_name {
private List<String> getCommand( Element trNode )
{
List<String> result = new ArrayList<String>();
Elements trChildNodes = trNode.getElementsByTag( "TD" );
for ( Element trChild : trChildNodes )
{
result.add( getTableDataValue( trChild ) );
}
if ( result.size() != 1 && result.size() != 3 )
{
throw new RuntimeException( "Something strange" ); // FIXME
}
return result;
} } | public class class_name {
private List<String> getCommand( Element trNode )
{
List<String> result = new ArrayList<String>();
Elements trChildNodes = trNode.getElementsByTag( "TD" );
for ( Element trChild : trChildNodes )
{
result.add( getTableDataValue( trChild ) ); // depends on control dependency: [for], data = [trChild]
}
if ( result.size() != 1 && result.size() != 3 )
{
throw new RuntimeException( "Something strange" ); // FIXME
}
return result;
} } |
public class class_name {
public void gotoNextBlockStart(int index, int xor) { // goto block start pos
if (xor < (1 << 10)) { // level = 1
display0 = (Object[]) display1[(index >> 5) & 31];
} else if (xor < (1 << 15)) { // level = 2
display1 = (Object[]) display2[(index >> 10) & 31];
display0 = (Object[]) display1[0];
} else if (xor < (1 << 20)) { // level = 3
display2 = (Object[]) display3[(index >> 15) & 31];
display1 = (Object[]) display2[0];
display0 = (Object[]) display1[0];
} else if (xor < (1 << 25)) { // level = 4
display3 = (Object[]) display4[(index >> 20) & 31];
display2 = (Object[]) display3[0];
display1 = (Object[]) display2[0];
display0 = (Object[]) display1[0];
} else if (xor < (1 << 30)) { // level = 5
display4 = (Object[]) display5[(index >> 25) & 31];
display3 = (Object[]) display4[0];
display2 = (Object[]) display3[0];
display1 = (Object[]) display2[0];
display0 = (Object[]) display1[0];
} else { // level = 6
throw new IllegalArgumentException();
}
} } | public class class_name {
public void gotoNextBlockStart(int index, int xor) { // goto block start pos
if (xor < (1 << 10)) { // level = 1
display0 = (Object[]) display1[(index >> 5) & 31]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 15)) { // level = 2
display1 = (Object[]) display2[(index >> 10) & 31]; // depends on control dependency: [if], data = [none]
display0 = (Object[]) display1[0]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 20)) { // level = 3
display2 = (Object[]) display3[(index >> 15) & 31]; // depends on control dependency: [if], data = [none]
display1 = (Object[]) display2[0]; // depends on control dependency: [if], data = [none]
display0 = (Object[]) display1[0]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 25)) { // level = 4
display3 = (Object[]) display4[(index >> 20) & 31]; // depends on control dependency: [if], data = [none]
display2 = (Object[]) display3[0]; // depends on control dependency: [if], data = [none]
display1 = (Object[]) display2[0]; // depends on control dependency: [if], data = [none]
display0 = (Object[]) display1[0]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 30)) { // level = 5
display4 = (Object[]) display5[(index >> 25) & 31]; // depends on control dependency: [if], data = [none]
display3 = (Object[]) display4[0]; // depends on control dependency: [if], data = [none]
display2 = (Object[]) display3[0]; // depends on control dependency: [if], data = [none]
display1 = (Object[]) display2[0]; // depends on control dependency: [if], data = [none]
display0 = (Object[]) display1[0]; // depends on control dependency: [if], data = [none]
} else { // level = 6
throw new IllegalArgumentException();
}
} } |
public class class_name {
private List<DoubleIntInt> computeZijs(double[][] averageDistances, final int dim) {
List<DoubleIntInt> z_ijs = new ArrayList<>(averageDistances.length * dim);
for(int i = 0; i < averageDistances.length; i++) {
double[] x_i = averageDistances[i];
// y_i
double y_i = 0;
for(int j = 0; j < dim; j++) {
y_i += x_i[j];
}
y_i /= dim;
// sigma_i
double sigma_i = 0;
for(int j = 0; j < dim; j++) {
double diff = x_i[j] - y_i;
sigma_i += diff * diff;
}
sigma_i /= (dim - 1);
sigma_i = FastMath.sqrt(sigma_i);
for(int j = 0; j < dim; j++) {
z_ijs.add(new DoubleIntInt((x_i[j] - y_i) / sigma_i, i, j));
}
}
Collections.sort(z_ijs);
return z_ijs;
} } | public class class_name {
private List<DoubleIntInt> computeZijs(double[][] averageDistances, final int dim) {
List<DoubleIntInt> z_ijs = new ArrayList<>(averageDistances.length * dim);
for(int i = 0; i < averageDistances.length; i++) {
double[] x_i = averageDistances[i];
// y_i
double y_i = 0;
for(int j = 0; j < dim; j++) {
y_i += x_i[j]; // depends on control dependency: [for], data = [j]
}
y_i /= dim; // depends on control dependency: [for], data = [none]
// sigma_i
double sigma_i = 0;
for(int j = 0; j < dim; j++) {
double diff = x_i[j] - y_i;
sigma_i += diff * diff; // depends on control dependency: [for], data = [none]
}
sigma_i /= (dim - 1); // depends on control dependency: [for], data = [none]
sigma_i = FastMath.sqrt(sigma_i); // depends on control dependency: [for], data = [none]
for(int j = 0; j < dim; j++) {
z_ijs.add(new DoubleIntInt((x_i[j] - y_i) / sigma_i, i, j)); // depends on control dependency: [for], data = [j]
}
}
Collections.sort(z_ijs);
return z_ijs;
} } |
public class class_name {
public void afterResponse(Event event) {
ChaincodeMessage message = messageHelper(event);
try {
sendChannel(message);
logger.debug(String.format("[%s]Received %s, communicated (state:%s)",
shortID(message), message.getType(), fsm.current()));
} catch (Exception e) {
logger.error(String.format("[%s]error sending %s (state:%s): %s", shortID(message),
message.getType(), fsm.current(), e));
}
} } | public class class_name {
public void afterResponse(Event event) {
ChaincodeMessage message = messageHelper(event);
try {
sendChannel(message); // depends on control dependency: [try], data = [none]
logger.debug(String.format("[%s]Received %s, communicated (state:%s)",
shortID(message), message.getType(), fsm.current())); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(String.format("[%s]error sending %s (state:%s): %s", shortID(message),
message.getType(), fsm.current(), e));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public char match(ISense source, ISense target) throws MatcherLibraryException {
char result = IMappingElement.IDK;
try {
String sSynset = source.getGloss();
// get gloss of Immediate ancestor of target node
String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
// get relation frequently occur between gloss of source and extended gloss of target
char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
// get final relation
char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
// get gloss of Immediate descendant of target node
String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
// Compute final relation
if (MGFinal == LGFinal) {
result = MGFinal;
}
if (MGFinal == IMappingElement.IDK) {
result = LGFinal;
}
if (LGFinal == IMappingElement.IDK) {
result = MGFinal;
}
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
return result;
} } | public class class_name {
public char match(ISense source, ISense target) throws MatcherLibraryException {
char result = IMappingElement.IDK;
try {
String sSynset = source.getGloss();
// get gloss of Immediate ancestor of target node
String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
// get relation frequently occur between gloss of source and extended gloss of target
char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
// get final relation
char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
// get gloss of Immediate descendant of target node
String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
// Compute final relation
if (MGFinal == LGFinal) {
result = MGFinal;
// depends on control dependency: [if], data = [none]
}
if (MGFinal == IMappingElement.IDK) {
result = LGFinal;
// depends on control dependency: [if], data = [none]
}
if (LGFinal == IMappingElement.IDK) {
result = MGFinal;
// depends on control dependency: [if], data = [none]
}
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
return result;
} } |
public class class_name {
public void onLeafClick(LeafClickEvent event) {
LayerTreeTreeNode layerTreeNode;
if (event.getLeaf() instanceof LayerTreeLegendItemNode) {
layerTreeNode = ((LayerTreeLegendItemNode) event.getLeaf()).parent;
treeGrid.deselectRecord(event.getLeaf());
treeGrid.selectRecord(layerTreeNode);
} else {
layerTreeNode = (LayerTreeTreeNode) event.getLeaf();
}
// -- update model
mapModel.selectLayer(layerTreeNode.getLayer());
} } | public class class_name {
public void onLeafClick(LeafClickEvent event) {
LayerTreeTreeNode layerTreeNode;
if (event.getLeaf() instanceof LayerTreeLegendItemNode) {
layerTreeNode = ((LayerTreeLegendItemNode) event.getLeaf()).parent; // depends on control dependency: [if], data = [none]
treeGrid.deselectRecord(event.getLeaf()); // depends on control dependency: [if], data = [none]
treeGrid.selectRecord(layerTreeNode); // depends on control dependency: [if], data = [none]
} else {
layerTreeNode = (LayerTreeTreeNode) event.getLeaf(); // depends on control dependency: [if], data = [none]
}
// -- update model
mapModel.selectLayer(layerTreeNode.getLayer());
} } |
public class class_name {
private String getTypeGenericName(Type type)
{
StringBuilder sb = new StringBuilder(getTypeName(type));
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
Type[] generics = parameterizedType.getActualTypeArguments();
if (generics.length > 0) {
sb.append('<');
for (int i = 0; i < generics.length; ++i) {
if (i > 0) {
sb.append(',');
}
sb.append(getTypeGenericName(generics[i]));
}
sb.append('>');
}
}
return sb.toString();
} } | public class class_name {
private String getTypeGenericName(Type type)
{
StringBuilder sb = new StringBuilder(getTypeName(type));
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
Type[] generics = parameterizedType.getActualTypeArguments();
if (generics.length > 0) {
sb.append('<'); // depends on control dependency: [if], data = [none]
for (int i = 0; i < generics.length; ++i) {
if (i > 0) {
sb.append(','); // depends on control dependency: [if], data = [none]
}
sb.append(getTypeGenericName(generics[i])); // depends on control dependency: [for], data = [i]
}
sb.append('>'); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public static boolean isMaintenanceWindowValid(final MaintenanceWindowLayout maintenanceWindowLayout,
final UINotification notification) {
if (maintenanceWindowLayout.isEnabled()) {
try {
MaintenanceScheduleHelper.validateMaintenanceSchedule(maintenanceWindowLayout.getMaintenanceSchedule(),
maintenanceWindowLayout.getMaintenanceDuration(),
maintenanceWindowLayout.getMaintenanceTimeZone());
} catch (final InvalidMaintenanceScheduleException e) {
LOG.error("Maintenance window is not valid", e);
notification.displayValidationError(e.getMessage());
return false;
}
}
return true;
} } | public class class_name {
public static boolean isMaintenanceWindowValid(final MaintenanceWindowLayout maintenanceWindowLayout,
final UINotification notification) {
if (maintenanceWindowLayout.isEnabled()) {
try {
MaintenanceScheduleHelper.validateMaintenanceSchedule(maintenanceWindowLayout.getMaintenanceSchedule(),
maintenanceWindowLayout.getMaintenanceDuration(),
maintenanceWindowLayout.getMaintenanceTimeZone()); // depends on control dependency: [try], data = [none]
} catch (final InvalidMaintenanceScheduleException e) {
LOG.error("Maintenance window is not valid", e);
notification.displayValidationError(e.getMessage());
return false;
} // depends on control dependency: [catch], data = [none]
}
return true;
} } |
public class class_name {
public void play(IPlayItem item, boolean withReset) throws StreamNotFoundException, IllegalStateException, IOException {
IMessageInput in = null;
// cannot play if state is not stopped
switch (subscriberStream.getState()) {
case STOPPED:
in = msgInReference.get();
if (in != null) {
in.unsubscribe(this);
msgInReference.set(null);
}
break;
default:
throw new IllegalStateException("Cannot play from non-stopped state");
}
// Play type determination
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#play()
// The start time, in seconds. Allowed values are -2, -1, 0, or a positive number.
// The default value is -2, which looks for a live stream, then a recorded stream,
// and if it finds neither, opens a live stream.
// If -1, plays only a live stream.
// If 0 or a positive number, plays a recorded stream, beginning start seconds in.
//
// -2: live then recorded, -1: live, >=0: recorded
int type = (int) (item.getStart() / 1000);
log.debug("Type {}", type);
// see if it's a published stream
IScope thisScope = subscriberStream.getScope();
final String itemName = item.getName();
//check for input and type
IProviderService.INPUT_TYPE sourceType = providerService.lookupProviderInput(thisScope, itemName, type);
boolean sendNotifications = true;
// decision: 0 for Live, 1 for File, 2 for Wait, 3 for N/A
switch (type) {
case -2:
if (sourceType == IProviderService.INPUT_TYPE.LIVE) {
playDecision = 0;
} else if (sourceType == IProviderService.INPUT_TYPE.VOD) {
playDecision = 1;
} else if (sourceType == IProviderService.INPUT_TYPE.LIVE_WAIT) {
playDecision = 2;
}
break;
case -1:
if (sourceType == IProviderService.INPUT_TYPE.LIVE) {
playDecision = 0;
} else if (sourceType == IProviderService.INPUT_TYPE.LIVE_WAIT) {
playDecision = 2;
}
break;
default:
if (sourceType == IProviderService.INPUT_TYPE.VOD) {
playDecision = 1;
}
break;
}
IMessage msg = null;
currentItem.set(item);
long itemLength = item.getLength();
if (log.isDebugEnabled()) {
log.debug("Play decision is {} (0=Live, 1=File, 2=Wait, 3=N/A) item length: {}", playDecision, itemLength);
}
switch (playDecision) {
case 0:
// get source input without create
in = providerService.getLiveProviderInput(thisScope, itemName, false);
if (msgInReference.compareAndSet(null, in)) {
// drop all frames up to the next keyframe
videoFrameDropper.reset(IFrameDropper.SEND_KEYFRAMES_CHECK);
if (in instanceof IBroadcastScope) {
IBroadcastStream stream = (IBroadcastStream) ((IBroadcastScope) in).getClientBroadcastStream();
if (stream != null && stream.getCodecInfo() != null) {
IVideoStreamCodec videoCodec = stream.getCodecInfo().getVideoCodec();
if (videoCodec != null) {
if (withReset) {
sendReset();
sendResetStatus(item);
sendStartStatus(item);
}
sendNotifications = false;
if (videoCodec.getNumInterframes() > 0 || videoCodec.getKeyframe() != null) {
bufferedInterframeIdx = 0;
videoFrameDropper.reset(IFrameDropper.SEND_ALL);
}
}
}
}
// subscribe to stream (ClientBroadcastStream.onPipeConnectionEvent)
in.subscribe(this, null);
// execute the processes to get Live playback setup
playLive();
} else {
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
break;
case 2:
// get source input with create
in = providerService.getLiveProviderInput(thisScope, itemName, true);
if (msgInReference.compareAndSet(null, in)) {
if (type == -1 && itemLength >= 0) {
if (log.isDebugEnabled()) {
log.debug("Creating wait job for {}", itemLength);
}
// Wait given timeout for stream to be published
waitLiveJob = schedulingService.addScheduledOnceJob(itemLength, new IScheduledJob() {
public void execute(ISchedulingService service) {
connectToProvider(itemName);
waitLiveJob = null;
subscriberStream.onChange(StreamState.END);
}
});
} else if (type == -2) {
if (log.isDebugEnabled()) {
log.debug("Creating wait job");
}
// Wait x seconds for the stream to be published
waitLiveJob = schedulingService.addScheduledOnceJob(15000, new IScheduledJob() {
public void execute(ISchedulingService service) {
connectToProvider(itemName);
waitLiveJob = null;
}
});
} else {
connectToProvider(itemName);
}
} else if (log.isDebugEnabled()) {
log.debug("Message input already set for {}", itemName);
}
break;
case 1:
in = providerService.getVODProviderInput(thisScope, itemName);
if (msgInReference.compareAndSet(null, in)) {
if (in.subscribe(this, null)) {
// execute the processes to get VOD playback setup
msg = playVOD(withReset, itemLength);
} else {
log.warn("Input source subscribe failed");
throw new IOException(String.format("Subscribe to %s failed", itemName));
}
} else {
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
break;
default:
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
//continue with common play processes (live and vod)
if (sendNotifications) {
if (withReset) {
sendReset();
sendResetStatus(item);
}
sendStartStatus(item);
if (!withReset) {
sendSwitchStatus();
}
// if its dynamic playback send the complete status
if (item instanceof DynamicPlayItem) {
sendTransitionStatus();
}
}
if (msg != null) {
sendMessage((RTMPMessage) msg);
}
subscriberStream.onChange(StreamState.PLAYING, item, !pullMode);
if (withReset) {
log.debug("Resetting times");
long currentTime = System.currentTimeMillis();
playbackStart = currentTime - streamOffset;
nextCheckBufferUnderrun = currentTime + bufferCheckInterval;
if (item.getLength() != 0) {
ensurePullAndPushRunning();
}
}
} } | public class class_name {
public void play(IPlayItem item, boolean withReset) throws StreamNotFoundException, IllegalStateException, IOException {
IMessageInput in = null;
// cannot play if state is not stopped
switch (subscriberStream.getState()) {
case STOPPED:
in = msgInReference.get();
if (in != null) {
in.unsubscribe(this);
msgInReference.set(null);
}
break;
default:
throw new IllegalStateException("Cannot play from non-stopped state");
}
// Play type determination
// https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#play()
// The start time, in seconds. Allowed values are -2, -1, 0, or a positive number.
// The default value is -2, which looks for a live stream, then a recorded stream,
// and if it finds neither, opens a live stream.
// If -1, plays only a live stream.
// If 0 or a positive number, plays a recorded stream, beginning start seconds in.
//
// -2: live then recorded, -1: live, >=0: recorded
int type = (int) (item.getStart() / 1000);
log.debug("Type {}", type);
// see if it's a published stream
IScope thisScope = subscriberStream.getScope();
final String itemName = item.getName();
//check for input and type
IProviderService.INPUT_TYPE sourceType = providerService.lookupProviderInput(thisScope, itemName, type);
boolean sendNotifications = true;
// decision: 0 for Live, 1 for File, 2 for Wait, 3 for N/A
switch (type) {
case -2:
if (sourceType == IProviderService.INPUT_TYPE.LIVE) {
playDecision = 0; // depends on control dependency: [if], data = [none]
} else if (sourceType == IProviderService.INPUT_TYPE.VOD) {
playDecision = 1; // depends on control dependency: [if], data = [none]
} else if (sourceType == IProviderService.INPUT_TYPE.LIVE_WAIT) {
playDecision = 2; // depends on control dependency: [if], data = [none]
}
break;
case -1:
if (sourceType == IProviderService.INPUT_TYPE.LIVE) {
playDecision = 0; // depends on control dependency: [if], data = [none]
} else if (sourceType == IProviderService.INPUT_TYPE.LIVE_WAIT) {
playDecision = 2; // depends on control dependency: [if], data = [none]
}
break;
default:
if (sourceType == IProviderService.INPUT_TYPE.VOD) {
playDecision = 1; // depends on control dependency: [if], data = [none]
}
break;
}
IMessage msg = null;
currentItem.set(item);
long itemLength = item.getLength();
if (log.isDebugEnabled()) {
log.debug("Play decision is {} (0=Live, 1=File, 2=Wait, 3=N/A) item length: {}", playDecision, itemLength);
}
switch (playDecision) {
case 0:
// get source input without create
in = providerService.getLiveProviderInput(thisScope, itemName, false);
if (msgInReference.compareAndSet(null, in)) {
// drop all frames up to the next keyframe
videoFrameDropper.reset(IFrameDropper.SEND_KEYFRAMES_CHECK);
if (in instanceof IBroadcastScope) {
IBroadcastStream stream = (IBroadcastStream) ((IBroadcastScope) in).getClientBroadcastStream();
if (stream != null && stream.getCodecInfo() != null) {
IVideoStreamCodec videoCodec = stream.getCodecInfo().getVideoCodec();
if (videoCodec != null) {
if (withReset) {
sendReset();
sendResetStatus(item);
sendStartStatus(item);
}
sendNotifications = false;
if (videoCodec.getNumInterframes() > 0 || videoCodec.getKeyframe() != null) {
bufferedInterframeIdx = 0;
videoFrameDropper.reset(IFrameDropper.SEND_ALL);
}
}
}
}
// subscribe to stream (ClientBroadcastStream.onPipeConnectionEvent)
in.subscribe(this, null);
// execute the processes to get Live playback setup
playLive();
} else {
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
break;
case 2:
// get source input with create
in = providerService.getLiveProviderInput(thisScope, itemName, true);
if (msgInReference.compareAndSet(null, in)) {
if (type == -1 && itemLength >= 0) {
if (log.isDebugEnabled()) {
log.debug("Creating wait job for {}", itemLength);
}
// Wait given timeout for stream to be published
waitLiveJob = schedulingService.addScheduledOnceJob(itemLength, new IScheduledJob() {
public void execute(ISchedulingService service) {
connectToProvider(itemName);
waitLiveJob = null;
subscriberStream.onChange(StreamState.END);
}
});
} else if (type == -2) {
if (log.isDebugEnabled()) {
log.debug("Creating wait job");
}
// Wait x seconds for the stream to be published
waitLiveJob = schedulingService.addScheduledOnceJob(15000, new IScheduledJob() {
public void execute(ISchedulingService service) {
connectToProvider(itemName);
waitLiveJob = null;
}
});
} else {
connectToProvider(itemName);
}
} else if (log.isDebugEnabled()) {
log.debug("Message input already set for {}", itemName);
}
break;
case 1:
in = providerService.getVODProviderInput(thisScope, itemName);
if (msgInReference.compareAndSet(null, in)) {
if (in.subscribe(this, null)) {
// execute the processes to get VOD playback setup
msg = playVOD(withReset, itemLength);
} else {
log.warn("Input source subscribe failed");
throw new IOException(String.format("Subscribe to %s failed", itemName));
}
} else {
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
break;
default:
sendStreamNotFoundStatus(item);
throw new StreamNotFoundException(itemName);
}
//continue with common play processes (live and vod)
if (sendNotifications) {
if (withReset) {
sendReset();
sendResetStatus(item);
}
sendStartStatus(item);
if (!withReset) {
sendSwitchStatus();
}
// if its dynamic playback send the complete status
if (item instanceof DynamicPlayItem) {
sendTransitionStatus();
}
}
if (msg != null) {
sendMessage((RTMPMessage) msg);
}
subscriberStream.onChange(StreamState.PLAYING, item, !pullMode);
if (withReset) {
log.debug("Resetting times");
long currentTime = System.currentTimeMillis();
playbackStart = currentTime - streamOffset;
nextCheckBufferUnderrun = currentTime + bufferCheckInterval;
if (item.getLength() != 0) {
ensurePullAndPushRunning();
}
}
} } |
public class class_name {
static int getIndent(PropertySheetTable table, Item item) {
int indent;
if (item.isProperty()) {
// it is a property, it has no parent or a category, and no child
if ((item.getParent() == null || !item.getParent().isProperty())
&& !item.hasToggle()) {
indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0;
} else {
// it is a property with children
if (item.hasToggle()) {
indent = item.getDepth() * HOTSPOT_SIZE;
} else {
indent = (item.getDepth() + 1) * HOTSPOT_SIZE;
}
}
if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES
&& table.getWantsExtraIndent()) {
indent += HOTSPOT_SIZE;
}
} else {
// category has no indent
indent = 0;
}
return indent;
} } | public class class_name {
static int getIndent(PropertySheetTable table, Item item) {
int indent;
if (item.isProperty()) {
// it is a property, it has no parent or a category, and no child
if ((item.getParent() == null || !item.getParent().isProperty())
&& !item.hasToggle()) {
indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0;
// depends on control dependency: [if], data = [none]
} else {
// it is a property with children
if (item.hasToggle()) {
indent = item.getDepth() * HOTSPOT_SIZE;
// depends on control dependency: [if], data = [none]
} else {
indent = (item.getDepth() + 1) * HOTSPOT_SIZE;
// depends on control dependency: [if], data = [none]
}
}
if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES
&& table.getWantsExtraIndent()) {
indent += HOTSPOT_SIZE;
// depends on control dependency: [if], data = [none]
}
} else {
// category has no indent
indent = 0;
// depends on control dependency: [if], data = [none]
}
return indent;
} } |
public class class_name {
public List<Person> nextPeople(int num) {
List<Person> names = new ArrayList<Person>(num);
for(int i = 0; i < num; i++) {
names.add(nextPerson());
}
return names;
} } | public class class_name {
public List<Person> nextPeople(int num) {
List<Person> names = new ArrayList<Person>(num);
for(int i = 0; i < num; i++) {
names.add(nextPerson()); // depends on control dependency: [for], data = [none]
}
return names;
} } |
public class class_name {
protected TransactionAnnotationValues readTransactionAnnotation(final Method method) {
for (AnnotationParser annotationParser : annotationParsers) {
TransactionAnnotationValues tad = TransactionAnnotationValues.of(annotationParser, method);
if (tad != null) {
return tad;
}
}
return null;
} } | public class class_name {
protected TransactionAnnotationValues readTransactionAnnotation(final Method method) {
for (AnnotationParser annotationParser : annotationParsers) {
TransactionAnnotationValues tad = TransactionAnnotationValues.of(annotationParser, method);
if (tad != null) {
return tad; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public ManagedObject get(Token token)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
trace.entry(this,
cclass,
"get",
token);
trace.exit(this,
cclass,
"get returns null");
}
return null;
// TODO If the memory object store has been restarted after a restart of the ObjectManager,
// TODO we may have reused an ObjectSequenceNumber, in which case rathet than findingin null
// TODO getManagedObject will find a newly created MAnagedObject instead of null.
// TODO Need some kind of ObjectManagerCycle number in the Token!
// TODO Alternatively we know that any Token trying to find the currentToken after restart
// TODO of the ObjectMAnager must have been restored from previous run so it must return
// TODO null and leave the get method the to throw an exception.
// TODO Alternatively we could occasionally save a safe staer sequencenumber, perhaps on e
// TODO checkpoint when the ObjectStopre is serialized anyway.
} } | public class class_name {
public ManagedObject get(Token token)
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) {
trace.entry(this,
cclass,
"get",
token); // depends on control dependency: [if], data = [none]
trace.exit(this,
cclass,
"get returns null"); // depends on control dependency: [if], data = [none]
}
return null;
// TODO If the memory object store has been restarted after a restart of the ObjectManager,
// TODO we may have reused an ObjectSequenceNumber, in which case rathet than findingin null
// TODO getManagedObject will find a newly created MAnagedObject instead of null.
// TODO Need some kind of ObjectManagerCycle number in the Token!
// TODO Alternatively we know that any Token trying to find the currentToken after restart
// TODO of the ObjectMAnager must have been restored from previous run so it must return
// TODO null and leave the get method the to throw an exception.
// TODO Alternatively we could occasionally save a safe staer sequencenumber, perhaps on e
// TODO checkpoint when the ObjectStopre is serialized anyway.
} } |
public class class_name {
public EClass getIfcConditionCriterionSelect() {
if (ifcConditionCriterionSelectEClass == null) {
ifcConditionCriterionSelectEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(944);
}
return ifcConditionCriterionSelectEClass;
} } | public class class_name {
public EClass getIfcConditionCriterionSelect() {
if (ifcConditionCriterionSelectEClass == null) {
ifcConditionCriterionSelectEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(944);
// depends on control dependency: [if], data = [none]
}
return ifcConditionCriterionSelectEClass;
} } |
public class class_name {
private SoyList newListFromIterable(Iterable<?> items) {
// Create a list backed by a Java list which has eagerly converted each value into a lazy
// value provider. Specifically, the list iteration is done eagerly so that the lazy value
// provider can cache its value.
ImmutableList.Builder<SoyValueProvider> builder = ImmutableList.builder();
for (Object item : items) {
builder.add(convertLazy(item));
}
return ListImpl.forProviderList(builder.build());
} } | public class class_name {
private SoyList newListFromIterable(Iterable<?> items) {
// Create a list backed by a Java list which has eagerly converted each value into a lazy
// value provider. Specifically, the list iteration is done eagerly so that the lazy value
// provider can cache its value.
ImmutableList.Builder<SoyValueProvider> builder = ImmutableList.builder();
for (Object item : items) {
builder.add(convertLazy(item)); // depends on control dependency: [for], data = [item]
}
return ListImpl.forProviderList(builder.build());
} } |
public class class_name {
private int getIntProperty(String key, boolean defaultProvided, int defaultValue, StringBuilder errors) {
String value = getStringProperty(key);
if (null != value) {
try {
int realValue = Integer.parseInt(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + realValue);
}
return realValue;
} catch (NumberFormatException nfe) {
// no FFDC required;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + ", format error in [" + value + "]");
}
}
}
if (!defaultProvided) {
// No default available. This is an error.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " not found. Error being tallied.");
}
errors.append(key);
errors.append(":null \n");
return -1;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " using default " + defaultValue);
}
return defaultValue;
} } | public class class_name {
private int getIntProperty(String key, boolean defaultProvided, int defaultValue, StringBuilder errors) {
String value = getStringProperty(key);
if (null != value) {
try {
int realValue = Integer.parseInt(value);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + realValue); // depends on control dependency: [if], data = [none]
}
return realValue; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
// no FFDC required;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + ", format error in [" + value + "]"); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if (!defaultProvided) {
// No default available. This is an error.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " not found. Error being tallied."); // depends on control dependency: [if], data = [none]
}
errors.append(key); // depends on control dependency: [if], data = [none]
errors.append(":null \n"); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " using default " + defaultValue); // depends on control dependency: [if], data = [none]
}
return defaultValue;
} } |
public class class_name {
@Override
public void addPermissions(Collection<Permission> aPermssions)
{
if (aPermssions == null)
throw new IllegalArgumentException(
"aPermssions required in SecurityAccessControl");
// SecurityPermission element = null;
for (Iterator<Permission> i = aPermssions.iterator(); i.hasNext();)
{
addPermission((SecurityPermission) i.next());
}
} } | public class class_name {
@Override
public void addPermissions(Collection<Permission> aPermssions)
{
if (aPermssions == null)
throw new IllegalArgumentException(
"aPermssions required in SecurityAccessControl");
// SecurityPermission element = null;
for (Iterator<Permission> i = aPermssions.iterator(); i.hasNext();)
{
addPermission((SecurityPermission) i.next());
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static List<Pattern> convert(final List<String> patternStrings, final String prepend) {
// Check sanity
List<String> effectivePatternStrings = patternStrings;
if (patternStrings == null) {
effectivePatternStrings = new ArrayList<String>();
effectivePatternStrings.add(".*");
}
final String effectivePrepend = prepend == null ? "" : prepend;
// Convert
final List<Pattern> toReturn = new ArrayList<Pattern>();
for (String current : effectivePatternStrings) {
toReturn.add(Pattern.compile(effectivePrepend + current, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE));
}
// All done.
return toReturn;
} } | public class class_name {
public static List<Pattern> convert(final List<String> patternStrings, final String prepend) {
// Check sanity
List<String> effectivePatternStrings = patternStrings;
if (patternStrings == null) {
effectivePatternStrings = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
effectivePatternStrings.add(".*"); // depends on control dependency: [if], data = [none]
}
final String effectivePrepend = prepend == null ? "" : prepend;
// Convert
final List<Pattern> toReturn = new ArrayList<Pattern>();
for (String current : effectivePatternStrings) {
toReturn.add(Pattern.compile(effectivePrepend + current, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)); // depends on control dependency: [for], data = [current]
}
// All done.
return toReturn;
} } |
public class class_name {
public UriComponents build(boolean encoded) {
if (this.ssp != null) {
return new OpaqueUriComponents(this.scheme, this.ssp, this.fragment);
}
else {
return new HierarchicalUriComponents(this.scheme, this.userInfo, this.host, this.port,
this.pathBuilder.build(), this.queryParams, this.fragment, encoded, true);
}
} } | public class class_name {
public UriComponents build(boolean encoded) {
if (this.ssp != null) {
return new OpaqueUriComponents(this.scheme, this.ssp, this.fragment); // depends on control dependency: [if], data = [none]
}
else {
return new HierarchicalUriComponents(this.scheme, this.userInfo, this.host, this.port,
this.pathBuilder.build(), this.queryParams, this.fragment, encoded, true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Resource build() {
Resource resource = null;
if (_url != null) {
resource = _kieResources.newUrlResource(_url);
if (resource != null) {
if (_resourceType != null) {
resource.setResourceType(_resourceType);
}
if (_resourceConfiguration != null) {
resource.setConfiguration(_resourceConfiguration);
}
}
}
return resource;
} } | public class class_name {
public Resource build() {
Resource resource = null;
if (_url != null) {
resource = _kieResources.newUrlResource(_url); // depends on control dependency: [if], data = [(_url]
if (resource != null) {
if (_resourceType != null) {
resource.setResourceType(_resourceType); // depends on control dependency: [if], data = [(_resourceType]
}
if (_resourceConfiguration != null) {
resource.setConfiguration(_resourceConfiguration); // depends on control dependency: [if], data = [(_resourceConfiguration]
}
}
}
return resource;
} } |
public class class_name {
public void setSourceIds(java.util.Collection<String> sourceIds) {
if (sourceIds == null) {
this.sourceIds = null;
return;
}
this.sourceIds = new com.amazonaws.internal.SdkInternalList<String>(sourceIds);
} } | public class class_name {
public void setSourceIds(java.util.Collection<String> sourceIds) {
if (sourceIds == null) {
this.sourceIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.sourceIds = new com.amazonaws.internal.SdkInternalList<String>(sourceIds);
} } |
public class class_name {
public long getSessionId() {
long sessionId = 0;
try {
ZooKeeper zk = zooKeeper.getZooKeeper();
if (zk != null) {
sessionId = zk.getSessionId();
}
} catch (Exception e) {
// Ignore the exception
}
return sessionId;
} } | public class class_name {
public long getSessionId() {
long sessionId = 0;
try {
ZooKeeper zk = zooKeeper.getZooKeeper();
if (zk != null) {
sessionId = zk.getSessionId(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
// Ignore the exception
} // depends on control dependency: [catch], data = [none]
return sessionId;
} } |
public class class_name {
public void startElementContents(ElementBox elem)
{
//setup transformations for the contents
AffineTransform at = Transform.createTransform(elem);
if (at != null)
{
savedTransforms.put(elem, g.getTransform());
g.transform(at);
}
} } | public class class_name {
public void startElementContents(ElementBox elem)
{
//setup transformations for the contents
AffineTransform at = Transform.createTransform(elem);
if (at != null)
{
savedTransforms.put(elem, g.getTransform()); // depends on control dependency: [if], data = [none]
g.transform(at); // depends on control dependency: [if], data = [(at]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.