code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private HashMap<SecretKey, SecureContainer> retrieveContainers() {
HashMap<SecretKey, SecureContainer> containers = null;
String workingDir = getMain().getFileSystemManager().getSystemDataLocation().getAbsolutePath();
final String containerFile = workingDir + File.separator
+ "containers.ser";
try {
FileInputStream fileIn = new FileInputStream(containerFile);
ObjectInputStream in = new ObjectInputStream(fileIn);
Object o = in.readObject();
if (o instanceof HashMap) {
containers = (HashMap) o;
}
in.close();
fileIn.close();
} catch (FileNotFoundException e) {
return null;
} catch(IOException | ClassNotFoundException e) {
logger.error("Unable to retrieve containers from file", e);
}
return containers;
} } | public class class_name {
private HashMap<SecretKey, SecureContainer> retrieveContainers() {
HashMap<SecretKey, SecureContainer> containers = null;
String workingDir = getMain().getFileSystemManager().getSystemDataLocation().getAbsolutePath();
final String containerFile = workingDir + File.separator
+ "containers.ser";
try {
FileInputStream fileIn = new FileInputStream(containerFile);
ObjectInputStream in = new ObjectInputStream(fileIn);
Object o = in.readObject();
if (o instanceof HashMap) {
containers = (HashMap) o; // depends on control dependency: [if], data = [none]
}
in.close(); // depends on control dependency: [try], data = [none]
fileIn.close(); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
return null;
} catch(IOException | ClassNotFoundException e) { // depends on control dependency: [catch], data = [none]
logger.error("Unable to retrieve containers from file", e);
} // depends on control dependency: [catch], data = [none]
return containers;
} } |
public class class_name {
public static Future<?> execute(final CuratorFramework client, final Runnable runAfterConnection) throws Exception
{
//Block until connected
final ExecutorService executor = ThreadUtils.newSingleThreadExecutor(ThreadUtils.getProcessName(runAfterConnection.getClass()));
Runnable internalCall = new Runnable()
{
@Override
public void run()
{
try
{
client.blockUntilConnected();
runAfterConnection.run();
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
log.error("An error occurred blocking until a connection is available", e);
}
finally
{
executor.shutdown();
}
}
};
return executor.submit(internalCall);
} } | public class class_name {
public static Future<?> execute(final CuratorFramework client, final Runnable runAfterConnection) throws Exception
{
//Block until connected
final ExecutorService executor = ThreadUtils.newSingleThreadExecutor(ThreadUtils.getProcessName(runAfterConnection.getClass()));
Runnable internalCall = new Runnable()
{
@Override
public void run()
{
try
{
client.blockUntilConnected(); // depends on control dependency: [try], data = [none]
runAfterConnection.run(); // depends on control dependency: [try], data = [none]
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
log.error("An error occurred blocking until a connection is available", e);
} // depends on control dependency: [catch], data = [none]
finally
{
executor.shutdown();
}
}
};
return executor.submit(internalCall);
} } |
public class class_name {
public void update(final String datum) {
if ((datum == null) || datum.isEmpty()) { return; }
final byte[] data = datum.getBytes(UTF_8);
couponUpdate(coupon(hash(data, DEFAULT_UPDATE_SEED)));
} } | public class class_name {
public void update(final String datum) {
if ((datum == null) || datum.isEmpty()) { return; } // depends on control dependency: [if], data = [none]
final byte[] data = datum.getBytes(UTF_8);
couponUpdate(coupon(hash(data, DEFAULT_UPDATE_SEED)));
} } |
public class class_name {
private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) {
for (int i = 0; i < typeInfo.getArity(); i++) {
TypeInformation<?> type = typeInfo.getTypeAt(i);
if (type instanceof CompositeType) {
getContainedGenericTypes((CompositeType<?>) type, target);
} else if (type instanceof GenericTypeInfo) {
if (!target.contains(type)) {
target.add((GenericTypeInfo<?>) type);
}
}
}
} } | public class class_name {
private static void getContainedGenericTypes(CompositeType<?> typeInfo, List<GenericTypeInfo<?>> target) {
for (int i = 0; i < typeInfo.getArity(); i++) {
TypeInformation<?> type = typeInfo.getTypeAt(i);
if (type instanceof CompositeType) {
getContainedGenericTypes((CompositeType<?>) type, target);
} else if (type instanceof GenericTypeInfo) {
if (!target.contains(type)) {
target.add((GenericTypeInfo<?>) type); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static void recognition(List<Vertex> segResult, WordNet wordNetOptimum, WordNet wordNetAll)
{
StringBuilder sbName = new StringBuilder();
int appendTimes = 0;
char[] charArray = wordNetAll.charArray;
DoubleArrayTrie<Character>.LongestSearcher searcher = JapanesePersonDictionary.getSearcher(charArray);
int activeLine = 1;
int preOffset = 0;
while (searcher.next())
{
Character label = searcher.value;
int offset = searcher.begin;
String key = new String(charArray, offset, searcher.length);
if (preOffset != offset)
{
if (appendTimes > 1 && sbName.length() > 2) // 日本人名最短为3字
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
sbName.setLength(0);
appendTimes = 0;
}
if (appendTimes == 0)
{
if (label == JapanesePersonDictionary.X)
{
sbName.append(key);
++appendTimes;
activeLine = offset + 1;
}
}
else
{
if (label == JapanesePersonDictionary.M)
{
sbName.append(key);
++appendTimes;
}
else
{
if (appendTimes > 1 && sbName.length() > 2)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
sbName.setLength(0);
appendTimes = 0;
}
}
preOffset = offset + key.length();
}
if (sbName.length() > 0)
{
if (appendTimes > 1)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll);
}
}
} } | public class class_name {
public static void recognition(List<Vertex> segResult, WordNet wordNetOptimum, WordNet wordNetAll)
{
StringBuilder sbName = new StringBuilder();
int appendTimes = 0;
char[] charArray = wordNetAll.charArray;
DoubleArrayTrie<Character>.LongestSearcher searcher = JapanesePersonDictionary.getSearcher(charArray);
int activeLine = 1;
int preOffset = 0;
while (searcher.next())
{
Character label = searcher.value;
int offset = searcher.begin;
String key = new String(charArray, offset, searcher.length);
if (preOffset != offset)
{
if (appendTimes > 1 && sbName.length() > 2) // 日本人名最短为3字
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll); // depends on control dependency: [if], data = [none]
}
sbName.setLength(0); // depends on control dependency: [if], data = [none]
appendTimes = 0; // depends on control dependency: [if], data = [none]
}
if (appendTimes == 0)
{
if (label == JapanesePersonDictionary.X)
{
sbName.append(key); // depends on control dependency: [if], data = [none]
++appendTimes; // depends on control dependency: [if], data = [none]
activeLine = offset + 1; // depends on control dependency: [if], data = [none]
}
}
else
{
if (label == JapanesePersonDictionary.M)
{
sbName.append(key); // depends on control dependency: [if], data = [none]
++appendTimes; // depends on control dependency: [if], data = [none]
}
else
{
if (appendTimes > 1 && sbName.length() > 2)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll); // depends on control dependency: [if], data = [none]
}
sbName.setLength(0); // depends on control dependency: [if], data = [none]
appendTimes = 0; // depends on control dependency: [if], data = [none]
}
}
preOffset = offset + key.length(); // depends on control dependency: [while], data = [none]
}
if (sbName.length() > 0)
{
if (appendTimes > 1)
{
insertName(sbName.toString(), activeLine, wordNetOptimum, wordNetAll); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Currency getInstance(String currencyCode) {
synchronized (codesToCurrencies) {
Currency currency = codesToCurrencies.get(currencyCode);
if (currency == null) {
currency = new Currency(currencyCode);
codesToCurrencies.put(currencyCode, currency);
}
return currency;
}
} } | public class class_name {
public static Currency getInstance(String currencyCode) {
synchronized (codesToCurrencies) {
Currency currency = codesToCurrencies.get(currencyCode);
if (currency == null) {
currency = new Currency(currencyCode); // depends on control dependency: [if], data = [(currency]
codesToCurrencies.put(currencyCode, currency); // depends on control dependency: [if], data = [(currency]
}
return currency;
}
} } |
public class class_name {
private static void addBuySellSignals(TimeSeries series, Strategy strategy, XYPlot plot) {
// Running the strategy
TimeSeriesManager seriesManager = new TimeSeriesManager(series);
List<Trade> trades = seriesManager.run(strategy).getTrades();
// Adding markers to plot
for (Trade trade : trades) {
// Buy signal
double buySignalTickTime = new Minute(Date.from(series.getTick(trade.getEntry().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker buyMarker = new ValueMarker(buySignalTickTime);
buyMarker.setPaint(Color.GREEN);
buyMarker.setLabel("B");
plot.addDomainMarker(buyMarker);
// Sell signal
double sellSignalTickTime = new Minute(Date.from(series.getTick(trade.getExit().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker sellMarker = new ValueMarker(sellSignalTickTime);
sellMarker.setPaint(Color.RED);
sellMarker.setLabel("S");
plot.addDomainMarker(sellMarker);
}
} } | public class class_name {
private static void addBuySellSignals(TimeSeries series, Strategy strategy, XYPlot plot) {
// Running the strategy
TimeSeriesManager seriesManager = new TimeSeriesManager(series);
List<Trade> trades = seriesManager.run(strategy).getTrades();
// Adding markers to plot
for (Trade trade : trades) {
// Buy signal
double buySignalTickTime = new Minute(Date.from(series.getTick(trade.getEntry().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker buyMarker = new ValueMarker(buySignalTickTime);
buyMarker.setPaint(Color.GREEN); // depends on control dependency: [for], data = [none]
buyMarker.setLabel("B"); // depends on control dependency: [for], data = [none]
plot.addDomainMarker(buyMarker); // depends on control dependency: [for], data = [none]
// Sell signal
double sellSignalTickTime = new Minute(Date.from(series.getTick(trade.getExit().getIndex()).getEndTime().toInstant())).getFirstMillisecond();
Marker sellMarker = new ValueMarker(sellSignalTickTime);
sellMarker.setPaint(Color.RED); // depends on control dependency: [for], data = [none]
sellMarker.setLabel("S"); // depends on control dependency: [for], data = [none]
plot.addDomainMarker(sellMarker); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Nonnull
@Override
public String getProviderTermForIpAddress(@Nonnull Locale locale) {
try {
return getCapabilities().getProviderTermForIpAddress(locale);
} catch (CloudException e) {
throw new RuntimeException("Unexpected problem with capabilities", e);
} catch (InternalException e) {
throw new RuntimeException("Unexpected problem with capabilities", e);
}
} } | public class class_name {
@Nonnull
@Override
public String getProviderTermForIpAddress(@Nonnull Locale locale) {
try {
return getCapabilities().getProviderTermForIpAddress(locale); // depends on control dependency: [try], data = [none]
} catch (CloudException e) {
throw new RuntimeException("Unexpected problem with capabilities", e);
} catch (InternalException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Unexpected problem with capabilities", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <T extends ImageGray<T>>
PyramidFloat<T> scaleSpacePyramid( double scaleSpace[], Class<T> imageType ) {
double[] sigmas = new double[ scaleSpace.length ];
sigmas[0] = scaleSpace[0];
for( int i = 1; i < scaleSpace.length; i++ ) {
// the desired amount of blur
double c = scaleSpace[i];
// the effective amount of blur applied to the last level
double b = scaleSpace[i-1];
// the amount of additional blur which is needed
sigmas[i] = Math.sqrt(c*c-b*b);
// take in account the change in image scale
sigmas[i] /= scaleSpace[i-1];
}
return floatGaussian(scaleSpace,sigmas,imageType);
} } | public class class_name {
public static <T extends ImageGray<T>>
PyramidFloat<T> scaleSpacePyramid( double scaleSpace[], Class<T> imageType ) {
double[] sigmas = new double[ scaleSpace.length ];
sigmas[0] = scaleSpace[0];
for( int i = 1; i < scaleSpace.length; i++ ) {
// the desired amount of blur
double c = scaleSpace[i];
// the effective amount of blur applied to the last level
double b = scaleSpace[i-1];
// the amount of additional blur which is needed
sigmas[i] = Math.sqrt(c*c-b*b); // depends on control dependency: [for], data = [i]
// take in account the change in image scale
sigmas[i] /= scaleSpace[i-1]; // depends on control dependency: [for], data = [i]
}
return floatGaussian(scaleSpace,sigmas,imageType);
} } |
public class class_name {
private void notifyDisconnected(Peer peer) {
for(Listener listener : new HashSet<>(listeners)) {
listener.onDisconnected(peer);
}
} } | public class class_name {
private void notifyDisconnected(Peer peer) {
for(Listener listener : new HashSet<>(listeners)) {
listener.onDisconnected(peer); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
public static void postTaskError(final TaskCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} } | public class class_name {
public static void postTaskError(final TaskCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
private void setBar( final double VALUE ) {
currentValueAngle = Helper.clamp(90.0, 270.0, ( VALUE - minValue ) * angleStep + 90.0);
double smallHeight = 0.675 * height;
double tinyHeight = 0.3 * height;
double currentValueSin = Math.sin(-Math.toRadians(currentValueAngle));
double currentValueCos = Math.cos(-Math.toRadians(currentValueAngle));
dataBarOuterArc.setX(centerX + smallHeight * currentValueSin);
dataBarOuterArc.setY(centerX + smallHeight * currentValueCos);
dataBarLineToInnerArc.setX(centerX + tinyHeight * currentValueSin);
dataBarLineToInnerArc.setY(centerX + tinyHeight * currentValueCos);
if (gauge.isStartFromZero()) {
double min = gauge.getMinValue();
double max = gauge.getMaxValue();
if ( ( VALUE > min || min < 0 ) && ( VALUE < max || max > 0 ) ) {
if ( max < 0 ) {
dataBarStart.setX(centerX + smallHeight);
dataBarStart.setY(smallHeight);
dataBarOuterArc.setSweepFlag(false);
dataBarInnerArc.setX(centerX + tinyHeight);
dataBarInnerArc.setY(smallHeight);
dataBarInnerArc.setSweepFlag(true);
} else if ( min > 0 ) {
dataBarStart.setX(0);
dataBarStart.setY(smallHeight);
dataBarOuterArc.setSweepFlag(true);
dataBarInnerArc.setX(0.27778 * width);
dataBarInnerArc.setY(smallHeight);
dataBarInnerArc.setSweepFlag(false);
} else {
double zeroAngle = Helper.clamp(90.0, 270.0, 90.0 - minValue * angleStep);
double zeroSin = Math.sin(-Math.toRadians(zeroAngle));
double zeroCos = Math.cos(-Math.toRadians(zeroAngle));
dataBarStart.setX(centerX + smallHeight * zeroSin);
dataBarStart.setY(centerX + smallHeight * zeroCos);
dataBarInnerArc.setX(centerX + tinyHeight * zeroSin);
dataBarInnerArc.setY(centerX + tinyHeight * zeroCos);
if ( VALUE < 0 ) {
dataBarOuterArc.setSweepFlag(false);
dataBarInnerArc.setSweepFlag(true);
} else {
dataBarOuterArc.setSweepFlag(true);
dataBarInnerArc.setSweepFlag(false);
}
}
}
} else {
dataBarStart.setX(0);
dataBarStart.setY(smallHeight);
dataBarOuterArc.setSweepFlag(true);
dataBarInnerArc.setX(0.27778 * width);
dataBarInnerArc.setY(smallHeight);
dataBarInnerArc.setSweepFlag(false);
}
setBarColor(VALUE);
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
if ( valueText.getLayoutBounds().getWidth() > 0.28 * width ) {
Helper.adjustTextSize(valueText, 0.28 * width, size * 0.24);
}
valueText.relocate(( width - valueText.getLayoutBounds().getWidth() ) * 0.5, 0.615 * height + ( 0.3 * height - valueText.getLayoutBounds().getHeight() ) * 0.5);
} } | public class class_name {
private void setBar( final double VALUE ) {
currentValueAngle = Helper.clamp(90.0, 270.0, ( VALUE - minValue ) * angleStep + 90.0);
double smallHeight = 0.675 * height;
double tinyHeight = 0.3 * height;
double currentValueSin = Math.sin(-Math.toRadians(currentValueAngle));
double currentValueCos = Math.cos(-Math.toRadians(currentValueAngle));
dataBarOuterArc.setX(centerX + smallHeight * currentValueSin);
dataBarOuterArc.setY(centerX + smallHeight * currentValueCos);
dataBarLineToInnerArc.setX(centerX + tinyHeight * currentValueSin);
dataBarLineToInnerArc.setY(centerX + tinyHeight * currentValueCos);
if (gauge.isStartFromZero()) {
double min = gauge.getMinValue();
double max = gauge.getMaxValue();
if ( ( VALUE > min || min < 0 ) && ( VALUE < max || max > 0 ) ) {
if ( max < 0 ) {
dataBarStart.setX(centerX + smallHeight); // depends on control dependency: [if], data = [none]
dataBarStart.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarOuterArc.setSweepFlag(false); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setX(centerX + tinyHeight); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setSweepFlag(true); // depends on control dependency: [if], data = [none]
} else if ( min > 0 ) {
dataBarStart.setX(0); // depends on control dependency: [if], data = [none]
dataBarStart.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarOuterArc.setSweepFlag(true); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setX(0.27778 * width); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setSweepFlag(false); // depends on control dependency: [if], data = [none]
} else {
double zeroAngle = Helper.clamp(90.0, 270.0, 90.0 - minValue * angleStep);
double zeroSin = Math.sin(-Math.toRadians(zeroAngle));
double zeroCos = Math.cos(-Math.toRadians(zeroAngle));
dataBarStart.setX(centerX + smallHeight * zeroSin); // depends on control dependency: [if], data = [none]
dataBarStart.setY(centerX + smallHeight * zeroCos); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setX(centerX + tinyHeight * zeroSin); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setY(centerX + tinyHeight * zeroCos); // depends on control dependency: [if], data = [none]
if ( VALUE < 0 ) {
dataBarOuterArc.setSweepFlag(false); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setSweepFlag(true); // depends on control dependency: [if], data = [none]
} else {
dataBarOuterArc.setSweepFlag(true); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setSweepFlag(false); // depends on control dependency: [if], data = [none]
}
}
}
} else {
dataBarStart.setX(0); // depends on control dependency: [if], data = [none]
dataBarStart.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarOuterArc.setSweepFlag(true); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setX(0.27778 * width); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setY(smallHeight); // depends on control dependency: [if], data = [none]
dataBarInnerArc.setSweepFlag(false); // depends on control dependency: [if], data = [none]
}
setBarColor(VALUE);
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
if ( valueText.getLayoutBounds().getWidth() > 0.28 * width ) {
Helper.adjustTextSize(valueText, 0.28 * width, size * 0.24); // depends on control dependency: [if], data = [none]
}
valueText.relocate(( width - valueText.getLayoutBounds().getWidth() ) * 0.5, 0.615 * height + ( 0.3 * height - valueText.getLayoutBounds().getHeight() ) * 0.5);
} } |
public class class_name {
protected int handleComputeMonthStart(int year, int month, boolean useMonth) {
//month is 0 based; converting it to 1-based
int imonth;
// If the month is out of range, adjust it into range, and adjust the extended year accordingly
if (month < 0 || month > 11) {
year += month / 12;
month %= 12;
}
imonth = month + 1;
double jd = IndianToJD(year ,imonth, 1);
return (int)jd;
} } | public class class_name {
protected int handleComputeMonthStart(int year, int month, boolean useMonth) {
//month is 0 based; converting it to 1-based
int imonth;
// If the month is out of range, adjust it into range, and adjust the extended year accordingly
if (month < 0 || month > 11) {
year += month / 12; // depends on control dependency: [if], data = [none]
month %= 12; // depends on control dependency: [if], data = [none]
}
imonth = month + 1;
double jd = IndianToJD(year ,imonth, 1);
return (int)jd;
} } |
public class class_name {
public void handleAnnotation(JCCompilationUnit unit, JavacNode node, JCAnnotation annotation, long priority) {
TypeResolver resolver = new TypeResolver(node.getImportList());
String rawType = annotation.annotationType.toString();
String fqn = resolver.typeRefToFullyQualifiedName(node, typeLibrary, rawType);
if (fqn == null) return;
List<AnnotationHandlerContainer<?>> containers = annotationHandlers.get(fqn);
if (containers == null) return;
for (AnnotationHandlerContainer<?> container : containers) {
try {
if (container.getPriority() == priority) {
if (checkAndSetHandled(annotation)) {
container.handle(node);
} else {
if (container.isEvenIfAlreadyHandled()) container.handle(node);
}
}
} catch (AnnotationValueDecodeFail fail) {
fail.owner.setError(fail.getMessage(), fail.idx);
} catch (Throwable t) {
String sourceName = "(unknown).java";
if (unit != null && unit.sourcefile != null) sourceName = unit.sourcefile.getName();
javacError(String.format("Lombok annotation handler %s failed on " + sourceName, container.handler.getClass()), t);
}
}
} } | public class class_name {
public void handleAnnotation(JCCompilationUnit unit, JavacNode node, JCAnnotation annotation, long priority) {
TypeResolver resolver = new TypeResolver(node.getImportList());
String rawType = annotation.annotationType.toString();
String fqn = resolver.typeRefToFullyQualifiedName(node, typeLibrary, rawType);
if (fqn == null) return;
List<AnnotationHandlerContainer<?>> containers = annotationHandlers.get(fqn);
if (containers == null) return;
for (AnnotationHandlerContainer<?> container : containers) {
try {
if (container.getPriority() == priority) {
if (checkAndSetHandled(annotation)) {
container.handle(node); // depends on control dependency: [if], data = [none]
} else {
if (container.isEvenIfAlreadyHandled()) container.handle(node);
}
}
} catch (AnnotationValueDecodeFail fail) {
fail.owner.setError(fail.getMessage(), fail.idx);
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
String sourceName = "(unknown).java";
if (unit != null && unit.sourcefile != null) sourceName = unit.sourcefile.getName();
javacError(String.format("Lombok annotation handler %s failed on " + sourceName, container.handler.getClass()), t);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public java.lang.String getRequestMethod() {
java.lang.Object ref = requestMethod_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
requestMethod_ = s;
return s;
}
} } | public class class_name {
public java.lang.String getRequestMethod() {
java.lang.Object ref = requestMethod_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
requestMethod_ = s; // depends on control dependency: [if], data = [none]
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void jobFinished(Throwable error)
{
this.lock.lock();
try {
if (this.status instanceof AbstractJobStatus) {
// Store error
((AbstractJobStatus) this.status).setError(error);
}
// Give a chance to any listener to do custom action associated to the job
this.observationManager.notify(new JobFinishingEvent(getRequest().getId(), getType(), this.request), this,
error);
if (getRequest().isVerbose()) {
if (getStatus().getRequest().getId() != null) {
this.logger.info(LOG_END_ID, "Finished job of type [{}] with identifier [{}]", getType(),
getStatus().getRequest().getId());
} else {
this.logger.info(LOG_END, "Finished job of type [{}]", getType());
}
}
if (this.status instanceof AbstractJobStatus) {
// Indicate when the job ended
((AbstractJobStatus) this.status).setEndDate(new Date());
// Stop updating job status (progress, log, etc.)
((AbstractJobStatus) this.status).stopListening();
// Update job state
((AbstractJobStatus) this.status).setState(JobStatus.State.FINISHED);
}
// Release threads waiting for job being done
this.finishedCondition.signalAll();
// Remove the job from the current jobs context
this.jobContext.popCurrentJob();
// Store the job status
try {
if (this.request.getId() != null) {
this.store.storeAsync(this.status);
}
} catch (Throwable t) {
this.logger.warn(LOG_STATUS_STORE_FAILED, "Failed to store job status [{}]", this.status, t);
}
} finally {
this.lock.unlock();
// Notify listener that job is fully finished
this.observationManager.notify(new JobFinishedEvent(getRequest().getId(), getType(), this.request), this,
error);
}
} } | public class class_name {
protected void jobFinished(Throwable error)
{
this.lock.lock();
try {
if (this.status instanceof AbstractJobStatus) {
// Store error
((AbstractJobStatus) this.status).setError(error); // depends on control dependency: [if], data = [none]
}
// Give a chance to any listener to do custom action associated to the job
this.observationManager.notify(new JobFinishingEvent(getRequest().getId(), getType(), this.request), this,
error); // depends on control dependency: [try], data = [none]
if (getRequest().isVerbose()) {
if (getStatus().getRequest().getId() != null) {
this.logger.info(LOG_END_ID, "Finished job of type [{}] with identifier [{}]", getType(),
getStatus().getRequest().getId()); // depends on control dependency: [if], data = [none]
} else {
this.logger.info(LOG_END, "Finished job of type [{}]", getType()); // depends on control dependency: [if], data = [none]
}
}
if (this.status instanceof AbstractJobStatus) {
// Indicate when the job ended
((AbstractJobStatus) this.status).setEndDate(new Date()); // depends on control dependency: [if], data = [none]
// Stop updating job status (progress, log, etc.)
((AbstractJobStatus) this.status).stopListening(); // depends on control dependency: [if], data = [none]
// Update job state
((AbstractJobStatus) this.status).setState(JobStatus.State.FINISHED); // depends on control dependency: [if], data = [none]
}
// Release threads waiting for job being done
this.finishedCondition.signalAll(); // depends on control dependency: [try], data = [none]
// Remove the job from the current jobs context
this.jobContext.popCurrentJob(); // depends on control dependency: [try], data = [none]
// Store the job status
try {
if (this.request.getId() != null) {
this.store.storeAsync(this.status); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
this.logger.warn(LOG_STATUS_STORE_FAILED, "Failed to store job status [{}]", this.status, t);
} // depends on control dependency: [catch], data = [none]
} finally {
this.lock.unlock();
// Notify listener that job is fully finished
this.observationManager.notify(new JobFinishedEvent(getRequest().getId(), getType(), this.request), this,
error);
}
} } |
public class class_name {
public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) {
// perform a transformation on the number that is dependent
// on the type of substitution this is, then just call its
// rule set's format() method to format the result
long numberToFormat = transformNumber(number);
if (ruleSet != null) {
ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount);
} else {
toInsertInto.insert(position + pos, numberFormat.format(numberToFormat));
}
} } | public class class_name {
public void doSubstitution(long number, StringBuilder toInsertInto, int position, int recursionCount) {
// perform a transformation on the number that is dependent
// on the type of substitution this is, then just call its
// rule set's format() method to format the result
long numberToFormat = transformNumber(number);
if (ruleSet != null) {
ruleSet.format(numberToFormat, toInsertInto, position + pos, recursionCount); // depends on control dependency: [if], data = [none]
} else {
toInsertInto.insert(position + pos, numberFormat.format(numberToFormat)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void undeploy(DeploymentUnit context) {
AbstractSecurityDeployer<?> deployer = null;
if (DeploymentTypeMarker.isType(DeploymentType.EAR, context)) {
deployer = new EarSecurityDeployer();
deployer.undeploy(context);
}
} } | public class class_name {
@Override
public void undeploy(DeploymentUnit context) {
AbstractSecurityDeployer<?> deployer = null;
if (DeploymentTypeMarker.isType(DeploymentType.EAR, context)) {
deployer = new EarSecurityDeployer(); // depends on control dependency: [if], data = [none]
deployer.undeploy(context); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean contains(CmsPublishJobInfoBean publishJob) {
List<CmsPublishJobInfoBean> l = OpenCms.getMemoryMonitor().getAllCachedPublishJobs();
if (l != null) {
for (int i = 0; i < l.size(); i++) {
CmsPublishJobInfoBean b = l.get(i);
if (b == publishJob) {
return true;
}
}
}
return false;
} } | public class class_name {
protected boolean contains(CmsPublishJobInfoBean publishJob) {
List<CmsPublishJobInfoBean> l = OpenCms.getMemoryMonitor().getAllCachedPublishJobs();
if (l != null) {
for (int i = 0; i < l.size(); i++) {
CmsPublishJobInfoBean b = l.get(i);
if (b == publishJob) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) {
logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic);
Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic));
if(!select.isUnsatisfied()) {
logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic);
return select.get();
}
return null;
} } | public class class_name {
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) {
logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic);
Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic));
if(!select.isUnsatisfied()) {
logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic); // depends on control dependency: [if], data = [none]
return select.get(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Override
protected void encode() {
int l = content.length();
String localstr;
int zeroes, count = 0, check_digit;
Code3Of9 c = new Code3Of9();
if (l > 7) {
throw new OkapiException("Input data too long");
}
if (!content.matches("[0-9]+")) {
throw new OkapiException("Invalid characters in input");
}
localstr = "-";
zeroes = 7 - l + 1;
for (int i = 1; i < zeroes; i++)
localstr += '0';
localstr += content;
for (int i = 1; i < 8; i++) {
count += i * Character.getNumericValue(localstr.charAt(i));
}
check_digit = count % 11;
if (check_digit == 11) {
check_digit = 0;
}
if (check_digit == 10) {
throw new OkapiException("Not a valid PZN identifier");
}
encodeInfo += "Check Digit: " + check_digit + "\n";
localstr += (char)(check_digit + '0');
c.setContent(localstr);
readable = "PZN" + localstr;
pattern = new String[1];
pattern[0] = c.pattern[0];
row_count = 1;
row_height = new int[1];
row_height[0] = -1;
} } | public class class_name {
@Override
protected void encode() {
int l = content.length();
String localstr;
int zeroes, count = 0, check_digit;
Code3Of9 c = new Code3Of9();
if (l > 7) {
throw new OkapiException("Input data too long");
}
if (!content.matches("[0-9]+")) {
throw new OkapiException("Invalid characters in input");
}
localstr = "-";
zeroes = 7 - l + 1;
for (int i = 1; i < zeroes; i++)
localstr += '0';
localstr += content;
for (int i = 1; i < 8; i++) {
count += i * Character.getNumericValue(localstr.charAt(i));
// depends on control dependency: [for], data = [i]
}
check_digit = count % 11;
if (check_digit == 11) {
check_digit = 0;
// depends on control dependency: [if], data = [none]
}
if (check_digit == 10) {
throw new OkapiException("Not a valid PZN identifier");
}
encodeInfo += "Check Digit: " + check_digit + "\n";
localstr += (char)(check_digit + '0');
c.setContent(localstr);
readable = "PZN" + localstr;
pattern = new String[1];
pattern[0] = c.pattern[0];
row_count = 1;
row_height = new int[1];
row_height[0] = -1;
} } |
public class class_name {
public static RedissonReactiveClient createReactive(Config config) {
RedissonReactive react = new RedissonReactive(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport();
}
return react;
} } | public class class_name {
public static RedissonReactiveClient createReactive(Config config) {
RedissonReactive react = new RedissonReactive(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport(); // depends on control dependency: [if], data = [none]
}
return react;
} } |
public class class_name {
public MonthDay withChronologyRetainFields(Chronology newChronology) {
newChronology = DateTimeUtils.getChronology(newChronology);
newChronology = newChronology.withUTC();
if (newChronology == getChronology()) {
return this;
} else {
MonthDay newMonthDay = new MonthDay(this, newChronology);
newChronology.validate(newMonthDay, getValues());
return newMonthDay;
}
} } | public class class_name {
public MonthDay withChronologyRetainFields(Chronology newChronology) {
newChronology = DateTimeUtils.getChronology(newChronology);
newChronology = newChronology.withUTC();
if (newChronology == getChronology()) {
return this; // depends on control dependency: [if], data = [none]
} else {
MonthDay newMonthDay = new MonthDay(this, newChronology);
newChronology.validate(newMonthDay, getValues()); // depends on control dependency: [if], data = [none]
return newMonthDay; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Object convertIfNeed(Object arg) { // #date_parade
if (propertyType.isPrimitive()) {
return convertPrimitiveWrapper(arg);
} else if (Number.class.isAssignableFrom(propertyType)) {
return convertNumber(arg);
} else if (java.util.Date.class.isAssignableFrom(propertyType)) {
return convertDate(arg);
// no prepared conversion logic so cannot, while no need to convert heres
//} else if (LocalDate.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDate(arg);
//} else if (LocalDate.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDate(arg);
//} else if (LocalDateTime.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDateTime(arg);
} else if (Boolean.class.isAssignableFrom(propertyType)) {
return LdiBooleanConversionUtil.toBoolean(arg);
} else if (arg != null && arg.getClass() != String.class && String.class == propertyType) {
return arg.toString();
} else if (arg instanceof String && !String.class.equals(propertyType)) {
return convertWithString(arg);
} else if (java.util.Calendar.class.isAssignableFrom(propertyType)) {
return LdiCalendarConversionUtil.toCalendar(arg);
}
return arg;
} } | public class class_name {
public Object convertIfNeed(Object arg) { // #date_parade
if (propertyType.isPrimitive()) {
return convertPrimitiveWrapper(arg); // depends on control dependency: [if], data = [none]
} else if (Number.class.isAssignableFrom(propertyType)) {
return convertNumber(arg); // depends on control dependency: [if], data = [none]
} else if (java.util.Date.class.isAssignableFrom(propertyType)) {
return convertDate(arg); // depends on control dependency: [if], data = [none]
// no prepared conversion logic so cannot, while no need to convert heres
//} else if (LocalDate.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDate(arg);
//} else if (LocalDate.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDate(arg);
//} else if (LocalDateTime.class.isAssignableFrom(propertyType)) {
// return DfTypeUtil.toLocalDateTime(arg);
} else if (Boolean.class.isAssignableFrom(propertyType)) {
return LdiBooleanConversionUtil.toBoolean(arg); // depends on control dependency: [if], data = [none]
} else if (arg != null && arg.getClass() != String.class && String.class == propertyType) {
return arg.toString(); // depends on control dependency: [if], data = [none]
} else if (arg instanceof String && !String.class.equals(propertyType)) {
return convertWithString(arg); // depends on control dependency: [if], data = [none]
} else if (java.util.Calendar.class.isAssignableFrom(propertyType)) {
return LdiCalendarConversionUtil.toCalendar(arg); // depends on control dependency: [if], data = [none]
}
return arg;
} } |
public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void run()
{
IProcess process = fConsole.getProcess();
if (process != null)
{
List targets = collectTargets(process);
targets.add(process);
DebugCommandService service = DebugCommandService.getService(fWindow);
service.executeCommand(ITerminateHandler.class, targets.toArray(), null);
}
} } | public class class_name {
@SuppressWarnings({ "rawtypes", "unchecked" })
public void run()
{
IProcess process = fConsole.getProcess();
if (process != null)
{
List targets = collectTargets(process);
targets.add(process); // depends on control dependency: [if], data = [(process]
DebugCommandService service = DebugCommandService.getService(fWindow);
service.executeCommand(ITerminateHandler.class, targets.toArray(), null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
private long updateBufferChronologically() {
long minTimestamp = Long.MAX_VALUE;
long timestamp = 0;
// Mark the internal timestamp buffer as done, when we have reached the end of that time series
for (int i = current; i < iterators.length; i++) {
if (timestamps[i] != 0L && timestamps[i + iterators.length] == MARK_END_TIME_SERIES) {
timestamps[i] = 0L;
}
}
current = -1;
boolean isMultipleSeriesWithMinimum = false;
for (int i = 0; i < iterators.length; i++) {
timestamp = timestamps[iterators.length + i];
if (timestamp < minTimestamp) {
minTimestamp = timestamp;
current = i;
isMultipleSeriesWithMinimum = false;
} else if (timestamp == minTimestamp) {
isMultipleSeriesWithMinimum = true;
}
}
updateCurrentAndNextSectionOfBuffer(current);
if (isMultipleSeriesWithMinimum) {
for (int i = current + 1; i < iterators.length; i++) {
timestamp = timestamps[iterators.length + i];
if (timestamp == minTimestamp) {
updateCurrentAndNextSectionOfBuffer(i);
}
}
}
return minTimestamp;
} } | public class class_name {
private long updateBufferChronologically() {
long minTimestamp = Long.MAX_VALUE;
long timestamp = 0;
// Mark the internal timestamp buffer as done, when we have reached the end of that time series
for (int i = current; i < iterators.length; i++) {
if (timestamps[i] != 0L && timestamps[i + iterators.length] == MARK_END_TIME_SERIES) {
timestamps[i] = 0L; // depends on control dependency: [if], data = [none]
}
}
current = -1;
boolean isMultipleSeriesWithMinimum = false;
for (int i = 0; i < iterators.length; i++) {
timestamp = timestamps[iterators.length + i]; // depends on control dependency: [for], data = [i]
if (timestamp < minTimestamp) {
minTimestamp = timestamp; // depends on control dependency: [if], data = [none]
current = i; // depends on control dependency: [if], data = [none]
isMultipleSeriesWithMinimum = false; // depends on control dependency: [if], data = [none]
} else if (timestamp == minTimestamp) {
isMultipleSeriesWithMinimum = true; // depends on control dependency: [if], data = [none]
}
}
updateCurrentAndNextSectionOfBuffer(current);
if (isMultipleSeriesWithMinimum) {
for (int i = current + 1; i < iterators.length; i++) {
timestamp = timestamps[iterators.length + i]; // depends on control dependency: [for], data = [i]
if (timestamp == minTimestamp) {
updateCurrentAndNextSectionOfBuffer(i); // depends on control dependency: [if], data = [none]
}
}
}
return minTimestamp;
} } |
public class class_name {
public void marshall(ListThingsInBillingGroupRequest listThingsInBillingGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (listThingsInBillingGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getBillingGroupName(), BILLINGGROUPNAME_BINDING);
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListThingsInBillingGroupRequest listThingsInBillingGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (listThingsInBillingGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getBillingGroupName(), BILLINGGROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listThingsInBillingGroupRequest.getMaxResults(), MAXRESULTS_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 {
Field dereference(Field self, String field) {
if (field.startsWith("[") && field.endsWith("]")) {
field = field.substring(1, field.length() - 1);
}
Type type = protoTypeNames.get(self.type().toString());
if (type instanceof MessageType) {
MessageType messageType = (MessageType) type;
Field messageField = messageType.field(field);
if (messageField != null) return messageField;
Map<String, Field> typeExtensions = messageType.extensionFieldsMap();
Field extensionField = resolve(field, typeExtensions);
if (extensionField != null) return extensionField;
}
return null; // Unable to traverse this field path.
} } | public class class_name {
Field dereference(Field self, String field) {
if (field.startsWith("[") && field.endsWith("]")) {
field = field.substring(1, field.length() - 1); // depends on control dependency: [if], data = [none]
}
Type type = protoTypeNames.get(self.type().toString());
if (type instanceof MessageType) {
MessageType messageType = (MessageType) type;
Field messageField = messageType.field(field);
if (messageField != null) return messageField;
Map<String, Field> typeExtensions = messageType.extensionFieldsMap();
Field extensionField = resolve(field, typeExtensions);
if (extensionField != null) return extensionField;
}
return null; // Unable to traverse this field path.
} } |
public class class_name {
private void detectCandidateFeatures(T image, double sigma ) {
// adjust corner intensity threshold based upon the current scale factor
float scaleThreshold = (float) (baseThreshold / Math.pow(sigma, scalePower));
detector.setThreshold(scaleThreshold);
computeDerivative.setInput(image);
D derivX = null, derivY = null;
D derivXX = null, derivYY = null, derivXY = null;
if (detector.getRequiresGradient()) {
derivX = computeDerivative.getDerivative(true);
derivY = computeDerivative.getDerivative(false);
}
if (detector.getRequiresHessian()) {
derivXX = computeDerivative.getDerivative(true, true);
derivYY = computeDerivative.getDerivative(false, false);
derivXY = computeDerivative.getDerivative(true, false);
}
detector.process(image, derivX, derivY, derivXX, derivYY, derivXY);
List<Point2D_I16> m = maximums;
m.clear();
if( detector.isDetectMaximums() ) {
QueueCorner q = detector.getMaximums();
for (int i = 0; i < q.size; i++) {
m.add(q.get(i).copy());
}
}
if( detector.isDetectMinimums() ) {
QueueCorner q = detector.getMinimums();
for (int i = 0; i < q.size; i++) {
m.add(q.get(i).copy());
}
}
} } | public class class_name {
private void detectCandidateFeatures(T image, double sigma ) {
// adjust corner intensity threshold based upon the current scale factor
float scaleThreshold = (float) (baseThreshold / Math.pow(sigma, scalePower));
detector.setThreshold(scaleThreshold);
computeDerivative.setInput(image);
D derivX = null, derivY = null;
D derivXX = null, derivYY = null, derivXY = null;
if (detector.getRequiresGradient()) {
derivX = computeDerivative.getDerivative(true); // depends on control dependency: [if], data = [none]
derivY = computeDerivative.getDerivative(false); // depends on control dependency: [if], data = [none]
}
if (detector.getRequiresHessian()) {
derivXX = computeDerivative.getDerivative(true, true); // depends on control dependency: [if], data = [none]
derivYY = computeDerivative.getDerivative(false, false); // depends on control dependency: [if], data = [none]
derivXY = computeDerivative.getDerivative(true, false); // depends on control dependency: [if], data = [none]
}
detector.process(image, derivX, derivY, derivXX, derivYY, derivXY);
List<Point2D_I16> m = maximums;
m.clear();
if( detector.isDetectMaximums() ) {
QueueCorner q = detector.getMaximums();
for (int i = 0; i < q.size; i++) {
m.add(q.get(i).copy()); // depends on control dependency: [for], data = [i]
}
}
if( detector.isDetectMinimums() ) {
QueueCorner q = detector.getMinimums();
for (int i = 0; i < q.size; i++) {
m.add(q.get(i).copy()); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
@Override
public EClass getIfcHeatFluxDensityMeasure() {
if (ifcHeatFluxDensityMeasureEClass == null) {
ifcHeatFluxDensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(812);
}
return ifcHeatFluxDensityMeasureEClass;
} } | public class class_name {
@Override
public EClass getIfcHeatFluxDensityMeasure() {
if (ifcHeatFluxDensityMeasureEClass == null) {
ifcHeatFluxDensityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(812);
// depends on control dependency: [if], data = [none]
}
return ifcHeatFluxDensityMeasureEClass;
} } |
public class class_name {
public static SoyType tryRemoveNull(SoyType soyType) {
if (soyType == NullType.getInstance()) {
return NullType.getInstance();
}
return removeNull(soyType);
} } | public class class_name {
public static SoyType tryRemoveNull(SoyType soyType) {
if (soyType == NullType.getInstance()) {
return NullType.getInstance(); // depends on control dependency: [if], data = [none]
}
return removeNull(soyType);
} } |
public class class_name {
@Override
public V put(K key, V value) {
LinkedHashMapSegment<K, V> seg = segmentFor(key.hashCode());
try {
seg.lock.lock();
return mapEventListener.onPutEntry(key, value, seg.put(key, value));
} finally {
seg.lock.unlock();
}
} } | public class class_name {
@Override
public V put(K key, V value) {
LinkedHashMapSegment<K, V> seg = segmentFor(key.hashCode());
try {
seg.lock.lock(); // depends on control dependency: [try], data = [none]
return mapEventListener.onPutEntry(key, value, seg.put(key, value)); // depends on control dependency: [try], data = [none]
} finally {
seg.lock.unlock();
}
} } |
public class class_name {
private static <T> T extractSingleton(Collection<T> collection) {
if (collection == null || collection.isEmpty()) {
return null;
}
if (collection.size() == 1) {
return collection.iterator().next();
} else {
throw new IllegalStateException("Expected singleton collection, but found size: " + collection.size());
}
} } | public class class_name {
private static <T> T extractSingleton(Collection<T> collection) {
if (collection == null || collection.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
if (collection.size() == 1) {
return collection.iterator().next(); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("Expected singleton collection, but found size: " + collection.size());
}
} } |
public class class_name {
@Override
public void addRequestHeader(Header header) {
LOG.trace("HttpMethodBase.addRequestHeader(Header)");
if (header == null) {
LOG.debug("null header value ignored");
} else {
getRequestHeaderGroup().addHeader(header);
}
} } | public class class_name {
@Override
public void addRequestHeader(Header header) {
LOG.trace("HttpMethodBase.addRequestHeader(Header)");
if (header == null) {
LOG.debug("null header value ignored"); // depends on control dependency: [if], data = [none]
} else {
getRequestHeaderGroup().addHeader(header); // depends on control dependency: [if], data = [(header]
}
} } |
public class class_name {
@SuppressWarnings("squid:S1244")
public HSL getHSL() {
// Convert the RGB values to the range 0-1
double red = r / 255.0;
double green = g / 255.0;
double blue = b / 255.0;
// Find the minimum and maximum values of R, G and B.
double min = Math.min(red, Math.min(green, blue));
double max = Math.max(red, Math.max(green, blue));
double delta = max - min;
// Now calculate the luminace value by adding the max and min values and divide by 2.
double l = (min + max) / 2;
// The next step is to find the Saturation.
double s = 0;
// If the min and max value are the same, it means that there is no saturation.
// If all RGB values are equal you have a shade of grey.
if (Math.abs(delta) > EPSILON) {
// Now we know that there is Saturation we need to do check the level of the Luminance
// in order to select the correct formula.
if (l < 0.5) {
s = delta / (max + min);
} else {
s = delta / (2.0 - max - min);
}
}
// The Hue formula is depending on what RGB color channel is the max value.
double h = 0;
if (delta > 0) {
if (red == max) {
h = (green - blue) / delta;
} else if (green == max) {
h = ((blue - red) / delta) + 2.0;
} else {
h = ((red - green) / delta) + 4.0;
}
}
// The Hue value you get needs to be multiplied by 60 to convert it to degrees on the color circle
// If Hue becomes negative you need to add 360 to, because a circle has 360 degrees.
h = h * 60;
return new HSL((int) Math.round(h), s, l);
} } | public class class_name {
@SuppressWarnings("squid:S1244")
public HSL getHSL() {
// Convert the RGB values to the range 0-1
double red = r / 255.0;
double green = g / 255.0;
double blue = b / 255.0;
// Find the minimum and maximum values of R, G and B.
double min = Math.min(red, Math.min(green, blue));
double max = Math.max(red, Math.max(green, blue));
double delta = max - min;
// Now calculate the luminace value by adding the max and min values and divide by 2.
double l = (min + max) / 2;
// The next step is to find the Saturation.
double s = 0;
// If the min and max value are the same, it means that there is no saturation.
// If all RGB values are equal you have a shade of grey.
if (Math.abs(delta) > EPSILON) {
// Now we know that there is Saturation we need to do check the level of the Luminance
// in order to select the correct formula.
if (l < 0.5) {
s = delta / (max + min); // depends on control dependency: [if], data = [none]
} else {
s = delta / (2.0 - max - min); // depends on control dependency: [if], data = [none]
}
}
// The Hue formula is depending on what RGB color channel is the max value.
double h = 0;
if (delta > 0) {
if (red == max) {
h = (green - blue) / delta; // depends on control dependency: [if], data = [none]
} else if (green == max) {
h = ((blue - red) / delta) + 2.0; // depends on control dependency: [if], data = [none]
} else {
h = ((red - green) / delta) + 4.0; // depends on control dependency: [if], data = [none]
}
}
// The Hue value you get needs to be multiplied by 60 to convert it to degrees on the color circle
// If Hue becomes negative you need to add 360 to, because a circle has 360 degrees.
h = h * 60;
return new HSL((int) Math.round(h), s, l);
} } |
public class class_name {
public List<T> parse(MappingStrategy<T> mapper, CSVReader csv, CsvToBeanFilter filter) {
long lineProcessed = 0;
String[] line = null;
try {
mapper.captureHeader(csv);
} catch (Exception e) {
throw new RuntimeException("Error capturing CSV header!", e);
}
try {
List<T> list = new ArrayList<>();
while (null != (line = csv.readNext())) {
lineProcessed++;
processLine(mapper, filter, line, list);
}
return list;
} catch (Exception e) {
throw new RuntimeException("Error parsing CSV line: " + lineProcessed + " values: " + Arrays.toString(line), e);
}
} } | public class class_name {
public List<T> parse(MappingStrategy<T> mapper, CSVReader csv, CsvToBeanFilter filter) {
long lineProcessed = 0;
String[] line = null;
try {
mapper.captureHeader(csv); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Error capturing CSV header!", e);
} // depends on control dependency: [catch], data = [none]
try {
List<T> list = new ArrayList<>();
while (null != (line = csv.readNext())) {
lineProcessed++; // depends on control dependency: [while], data = [none]
processLine(mapper, filter, line, list); // depends on control dependency: [while], data = [none]
}
return list; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Error parsing CSV line: " + lineProcessed + " values: " + Arrays.toString(line), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean registerForNotifications(
ArtifactNotification newListenerPaths,
ArtifactListener newListener) {
if ( newListenerPaths.getContainer().getRoot() != rootContainer ) {
throw new IllegalArgumentException();
}
synchronized ( listenersLock ) {
boolean addedUncoveredPaths = false;
for ( String newListenerPath : newListenerPaths.getPaths() ) {
// Handle non-recursive listener registration as recursive registration.
if ( newListenerPath.startsWith("!") ) {
newListenerPath = newListenerPath.substring(1);
}
ArtifactListenerSelector artifactSelectorCallback = new ArtifactListenerSelector(newListener);
if ( registerListener(newListenerPath, artifactSelectorCallback) ) {
addedUncoveredPaths = true;
}
}
if ( addedUncoveredPaths ) {
updateMonitor();
}
}
return true;
} } | public class class_name {
@Override
public boolean registerForNotifications(
ArtifactNotification newListenerPaths,
ArtifactListener newListener) {
if ( newListenerPaths.getContainer().getRoot() != rootContainer ) {
throw new IllegalArgumentException();
}
synchronized ( listenersLock ) {
boolean addedUncoveredPaths = false;
for ( String newListenerPath : newListenerPaths.getPaths() ) {
// Handle non-recursive listener registration as recursive registration.
if ( newListenerPath.startsWith("!") ) {
newListenerPath = newListenerPath.substring(1); // depends on control dependency: [if], data = [none]
}
ArtifactListenerSelector artifactSelectorCallback = new ArtifactListenerSelector(newListener);
if ( registerListener(newListenerPath, artifactSelectorCallback) ) {
addedUncoveredPaths = true; // depends on control dependency: [if], data = [none]
}
}
if ( addedUncoveredPaths ) {
updateMonitor(); // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public List<CmsAdditionalInfoBean> getFormatedIndividualSettings(String containerId) {
List<CmsAdditionalInfoBean> result = new ArrayList<CmsAdditionalInfoBean>();
CmsFormatterConfig config = getFormatterConfig(containerId);
if ((m_settings != null) && (config != null)) {
for (Entry<String, String> settingEntry : m_settings.entrySet()) {
String settingKey = settingEntry.getKey();
if (config.getSettingConfig().containsKey(settingEntry.getKey())) {
String niceName = config.getSettingConfig().get(settingEntry.getKey()).getNiceName();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(
config.getSettingConfig().get(settingEntry.getKey()).getNiceName())) {
settingKey = niceName;
}
}
result.add(new CmsAdditionalInfoBean(settingKey, settingEntry.getValue(), null));
}
}
return result;
} } | public class class_name {
public List<CmsAdditionalInfoBean> getFormatedIndividualSettings(String containerId) {
List<CmsAdditionalInfoBean> result = new ArrayList<CmsAdditionalInfoBean>();
CmsFormatterConfig config = getFormatterConfig(containerId);
if ((m_settings != null) && (config != null)) {
for (Entry<String, String> settingEntry : m_settings.entrySet()) {
String settingKey = settingEntry.getKey();
if (config.getSettingConfig().containsKey(settingEntry.getKey())) {
String niceName = config.getSettingConfig().get(settingEntry.getKey()).getNiceName();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(
config.getSettingConfig().get(settingEntry.getKey()).getNiceName())) {
settingKey = niceName; // depends on control dependency: [if], data = [none]
}
}
result.add(new CmsAdditionalInfoBean(settingKey, settingEntry.getValue(), null)); // depends on control dependency: [for], data = [settingEntry]
}
}
return result;
} } |
public class class_name {
protected String[] resolveProperties(final Object bean, final boolean declared) {
String[] properties;
if (bean instanceof Map) {
Set keys = ((Map) bean).keySet();
properties = new String[keys.size()];
int ndx = 0;
for (Object key : keys) {
properties[ndx] = key.toString();
ndx++;
}
} else {
properties = getAllBeanPropertyNames(bean.getClass(), declared);
}
return properties;
} } | public class class_name {
protected String[] resolveProperties(final Object bean, final boolean declared) {
String[] properties;
if (bean instanceof Map) {
Set keys = ((Map) bean).keySet();
properties = new String[keys.size()]; // depends on control dependency: [if], data = [none]
int ndx = 0;
for (Object key : keys) {
properties[ndx] = key.toString(); // depends on control dependency: [for], data = [key]
ndx++; // depends on control dependency: [for], data = [none]
}
} else {
properties = getAllBeanPropertyNames(bean.getClass(), declared); // depends on control dependency: [if], data = [none]
}
return properties;
} } |
public class class_name {
public void start()
{
if (!state.compareAndSet(State.LATENT, State.STARTING)) {
throw new IllegalStateException("System already starting");
}
for (LifeCycleListener listener : listeners) {
listener.startingLifeCycle();
}
for (Object obj : managedInstances) {
LifeCycleMethods methods = methodsMap.get(obj.getClass());
if (!methods.hasFor(PreDestroy.class)) {
managedInstances.remove(obj); // remove reference to instances that aren't needed anymore
}
}
state.set(State.STARTED);
for (LifeCycleListener listener : listeners) {
listener.startedLifeCycle();
}
} } | public class class_name {
public void start()
{
if (!state.compareAndSet(State.LATENT, State.STARTING)) {
throw new IllegalStateException("System already starting");
}
for (LifeCycleListener listener : listeners) {
listener.startingLifeCycle(); // depends on control dependency: [for], data = [listener]
}
for (Object obj : managedInstances) {
LifeCycleMethods methods = methodsMap.get(obj.getClass());
if (!methods.hasFor(PreDestroy.class)) {
managedInstances.remove(obj); // remove reference to instances that aren't needed anymore // depends on control dependency: [if], data = [none]
}
}
state.set(State.STARTED);
for (LifeCycleListener listener : listeners) {
listener.startedLifeCycle(); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
private ReactorListener buildReactorListener() throws IOException {
List<ReactorListener> r = Lists.newArrayList(ServiceLoader.load(InitReactorListener.class, Thread.currentThread().getContextClassLoader()));
r.add(new ReactorListener() {
final Level level = Level.parse( Configuration.getStringConfigParameter("initLogLevel", "FINE") );
public void onTaskStarted(Task t) {
LOGGER.log(level, "Started {0}", getDisplayName(t));
}
public void onTaskCompleted(Task t) {
LOGGER.log(level, "Completed {0}", getDisplayName(t));
}
public void onTaskFailed(Task t, Throwable err, boolean fatal) {
LOGGER.log(SEVERE, "Failed " + getDisplayName(t), err);
}
public void onAttained(Milestone milestone) {
Level lv = level;
String s = "Attained "+milestone.toString();
if (milestone instanceof InitMilestone) {
lv = Level.INFO; // noteworthy milestones --- at least while we debug problems further
onInitMilestoneAttained((InitMilestone) milestone);
s = milestone.toString();
}
LOGGER.log(lv,s);
}
});
return new ReactorListener.Aggregator(r);
} } | public class class_name {
private ReactorListener buildReactorListener() throws IOException {
List<ReactorListener> r = Lists.newArrayList(ServiceLoader.load(InitReactorListener.class, Thread.currentThread().getContextClassLoader()));
r.add(new ReactorListener() {
final Level level = Level.parse( Configuration.getStringConfigParameter("initLogLevel", "FINE") );
public void onTaskStarted(Task t) {
LOGGER.log(level, "Started {0}", getDisplayName(t));
}
public void onTaskCompleted(Task t) {
LOGGER.log(level, "Completed {0}", getDisplayName(t));
}
public void onTaskFailed(Task t, Throwable err, boolean fatal) {
LOGGER.log(SEVERE, "Failed " + getDisplayName(t), err);
}
public void onAttained(Milestone milestone) {
Level lv = level;
String s = "Attained "+milestone.toString();
if (milestone instanceof InitMilestone) {
lv = Level.INFO; // noteworthy milestones --- at least while we debug problems further // depends on control dependency: [if], data = [none]
onInitMilestoneAttained((InitMilestone) milestone); // depends on control dependency: [if], data = [none]
s = milestone.toString(); // depends on control dependency: [if], data = [none]
}
LOGGER.log(lv,s);
}
});
return new ReactorListener.Aggregator(r);
} } |
public class class_name {
@Pure
public static boolean isAssignableFrom(Class<?> assignementTarget, Class<?> assignementSource) {
assert assignementSource != null;
assert assignementTarget != null;
// Test according to the Class's behaviour
if (assignementTarget.isAssignableFrom(assignementSource)) {
return true;
}
// Test according to autoboxing
if (assignementTarget.isPrimitive() && assignementSource.isPrimitive()
&& assignementTarget != Void.class && assignementTarget != void.class
&& assignementSource != Void.class && assignementSource != void.class) {
return true;
}
return false;
} } | public class class_name {
@Pure
public static boolean isAssignableFrom(Class<?> assignementTarget, Class<?> assignementSource) {
assert assignementSource != null;
assert assignementTarget != null;
// Test according to the Class's behaviour
if (assignementTarget.isAssignableFrom(assignementSource)) {
return true; // depends on control dependency: [if], data = [none]
}
// Test according to autoboxing
if (assignementTarget.isPrimitive() && assignementSource.isPrimitive()
&& assignementTarget != Void.class && assignementTarget != void.class
&& assignementSource != Void.class && assignementSource != void.class) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected boolean hasRole(CmsRole role, List<CmsGroup> roles) {
// iterates the role groups the user is in
for (CmsGroup group : roles) {
String groupName = group.getName();
// iterate the role hierarchy
for (String distictGroupName : role.getDistinctGroupNames()) {
if (distictGroupName.startsWith(CmsOrganizationalUnit.SEPARATOR)) {
// this is a ou independent role
// we need an exact match, and we ignore the ou parameter
if (groupName.equals(distictGroupName.substring(1))) {
return true;
}
} else {
// first check if the user has the role at all
if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + distictGroupName)
|| groupName.equals(distictGroupName)) {
// this is a ou dependent role
if (role.getOuFqn() == null) {
// ou parameter is null, so the user needs to have the role in at least one ou does not matter which
return true;
} else {
// the user needs to have the role in the given ou or in a parent ou
// now check that the ou matches
String groupFqn = CmsOrganizationalUnit.getParentFqn(groupName);
if (role.getOuFqn().startsWith(groupFqn)) {
return true;
}
}
}
}
}
}
return false;
} } | public class class_name {
protected boolean hasRole(CmsRole role, List<CmsGroup> roles) {
// iterates the role groups the user is in
for (CmsGroup group : roles) {
String groupName = group.getName();
// iterate the role hierarchy
for (String distictGroupName : role.getDistinctGroupNames()) {
if (distictGroupName.startsWith(CmsOrganizationalUnit.SEPARATOR)) {
// this is a ou independent role
// we need an exact match, and we ignore the ou parameter
if (groupName.equals(distictGroupName.substring(1))) {
return true; // depends on control dependency: [if], data = [none]
}
} else {
// first check if the user has the role at all
if (groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + distictGroupName)
|| groupName.equals(distictGroupName)) {
// this is a ou dependent role
if (role.getOuFqn() == null) {
// ou parameter is null, so the user needs to have the role in at least one ou does not matter which
return true; // depends on control dependency: [if], data = [none]
} else {
// the user needs to have the role in the given ou or in a parent ou
// now check that the ou matches
String groupFqn = CmsOrganizationalUnit.getParentFqn(groupName);
if (role.getOuFqn().startsWith(groupFqn)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
return false;
} } |
public class class_name {
@SuppressWarnings("unchecked")
static <T extends SAMLObject> MessageContext<T> toSamlObject(
AggregatedHttpMessage msg, String name,
Map<String, SamlIdentityProviderConfig> idpConfigs,
@Nullable SamlIdentityProviderConfig defaultIdpConfig) {
requireNonNull(msg, "msg");
requireNonNull(name, "name");
requireNonNull(idpConfigs, "idpConfigs");
final SamlParameters parameters = new SamlParameters(msg);
final T message = (T) fromDeflatedBase64(parameters.getFirstValue(name));
final MessageContext<T> messageContext = new MessageContext<>();
messageContext.setMessage(message);
final Issuer issuer;
if (message instanceof RequestAbstractType) {
issuer = ((RequestAbstractType) message).getIssuer();
} else if (message instanceof StatusResponseType) {
issuer = ((StatusResponseType) message).getIssuer();
} else {
throw new SamlException("invalid message type: " + message.getClass().getSimpleName());
}
// Use the default identity provider config if there's no issuer.
final SamlIdentityProviderConfig config;
if (issuer != null) {
final String idpEntityId = issuer.getValue();
config = idpConfigs.get(idpEntityId);
if (config == null) {
throw new SamlException("a message from unknown identity provider: " + idpEntityId);
}
} else {
if (defaultIdpConfig == null) {
throw new SamlException("failed to get an Issuer element");
}
config = defaultIdpConfig;
}
// If this message is sent via HTTP-redirect binding protocol, its signature parameter should
// be validated.
validateSignature(config.signingCredential(), parameters, name);
final String relayState = parameters.getFirstValueOrNull(RELAY_STATE);
if (relayState != null) {
final SAMLBindingContext context = messageContext.getSubcontext(SAMLBindingContext.class, true);
assert context != null;
context.setRelayState(relayState);
}
return messageContext;
} } | public class class_name {
@SuppressWarnings("unchecked")
static <T extends SAMLObject> MessageContext<T> toSamlObject(
AggregatedHttpMessage msg, String name,
Map<String, SamlIdentityProviderConfig> idpConfigs,
@Nullable SamlIdentityProviderConfig defaultIdpConfig) {
requireNonNull(msg, "msg");
requireNonNull(name, "name");
requireNonNull(idpConfigs, "idpConfigs");
final SamlParameters parameters = new SamlParameters(msg);
final T message = (T) fromDeflatedBase64(parameters.getFirstValue(name));
final MessageContext<T> messageContext = new MessageContext<>();
messageContext.setMessage(message);
final Issuer issuer;
if (message instanceof RequestAbstractType) {
issuer = ((RequestAbstractType) message).getIssuer(); // depends on control dependency: [if], data = [none]
} else if (message instanceof StatusResponseType) {
issuer = ((StatusResponseType) message).getIssuer(); // depends on control dependency: [if], data = [none]
} else {
throw new SamlException("invalid message type: " + message.getClass().getSimpleName());
}
// Use the default identity provider config if there's no issuer.
final SamlIdentityProviderConfig config;
if (issuer != null) {
final String idpEntityId = issuer.getValue();
config = idpConfigs.get(idpEntityId); // depends on control dependency: [if], data = [none]
if (config == null) {
throw new SamlException("a message from unknown identity provider: " + idpEntityId);
}
} else {
if (defaultIdpConfig == null) {
throw new SamlException("failed to get an Issuer element");
}
config = defaultIdpConfig; // depends on control dependency: [if], data = [none]
}
// If this message is sent via HTTP-redirect binding protocol, its signature parameter should
// be validated.
validateSignature(config.signingCredential(), parameters, name);
final String relayState = parameters.getFirstValueOrNull(RELAY_STATE);
if (relayState != null) {
final SAMLBindingContext context = messageContext.getSubcontext(SAMLBindingContext.class, true);
assert context != null;
context.setRelayState(relayState); // depends on control dependency: [if], data = [(relayState]
}
return messageContext;
} } |
public class class_name {
public EEnum getMappingOptionMapValue() {
if (mappingOptionMapValueEEnum == null) {
mappingOptionMapValueEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(91);
}
return mappingOptionMapValueEEnum;
} } | public class class_name {
public EEnum getMappingOptionMapValue() {
if (mappingOptionMapValueEEnum == null) {
mappingOptionMapValueEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(91); // depends on control dependency: [if], data = [none]
}
return mappingOptionMapValueEEnum;
} } |
public class class_name {
private void processMessageReceipt(String msgId, String conversationId, int convType, long timestamp) {
Object messageCache =
MessageReceiptCache.get(session.getSelfPeerId(), msgId);
if (messageCache == null) {
return;
}
Message m = (Message) messageCache;
AVIMMessage msg =
new AVIMMessage(conversationId, session.getSelfPeerId(), m.timestamp, timestamp);
msg.setMessageId(m.id);
msg.setContent(m.msg);
msg.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusReceipt);
AVConversationHolder conversation = session.getConversationHolder(conversationId, convType);
conversation.onMessageReceipt(msg);
} } | public class class_name {
private void processMessageReceipt(String msgId, String conversationId, int convType, long timestamp) {
Object messageCache =
MessageReceiptCache.get(session.getSelfPeerId(), msgId);
if (messageCache == null) {
return; // depends on control dependency: [if], data = [none]
}
Message m = (Message) messageCache;
AVIMMessage msg =
new AVIMMessage(conversationId, session.getSelfPeerId(), m.timestamp, timestamp);
msg.setMessageId(m.id);
msg.setContent(m.msg);
msg.setMessageStatus(AVIMMessage.AVIMMessageStatus.AVIMMessageStatusReceipt);
AVConversationHolder conversation = session.getConversationHolder(conversationId, convType);
conversation.onMessageReceipt(msg);
} } |
public class class_name {
public TreeData children(TreeData... treeDatas) {
if (treeDatas == null || treeDatas.length == 0) {
return this;
}
this.children().addAll(Arrays.asList(treeDatas));
return this;
} } | public class class_name {
public TreeData children(TreeData... treeDatas) {
if (treeDatas == null || treeDatas.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
this.children().addAll(Arrays.asList(treeDatas));
return this;
} } |
public class class_name {
private Metric predictAnomalies() {
Metric predictions = new Metric(getResultScopeName(), getResultMetricName());
Map<Long, Double> predictionDatapoints = new HashMap<>();
double[][] noiseMatrix = rpca.getE().getData();
double[] noiseVector = matrixToVector(noiseMatrix);
for (int i = 0; i < noiseVector.length; i++) {
Long timestamp = timestamps[i];
double noiseValue = noiseVector[i];
double anomalyScore = calculateAnomalyScore(noiseValue);
predictionDatapoints.put(timestamp, anomalyScore);
}
predictions.setDatapoints(predictionDatapoints);
return predictions;
} } | public class class_name {
private Metric predictAnomalies() {
Metric predictions = new Metric(getResultScopeName(), getResultMetricName());
Map<Long, Double> predictionDatapoints = new HashMap<>();
double[][] noiseMatrix = rpca.getE().getData();
double[] noiseVector = matrixToVector(noiseMatrix);
for (int i = 0; i < noiseVector.length; i++) {
Long timestamp = timestamps[i];
double noiseValue = noiseVector[i];
double anomalyScore = calculateAnomalyScore(noiseValue);
predictionDatapoints.put(timestamp, anomalyScore); // depends on control dependency: [for], data = [none]
}
predictions.setDatapoints(predictionDatapoints);
return predictions;
} } |
public class class_name {
public static void populate(Object instance, Map<String, Object> values) {
try {
BeanUtilsBean beanUtilBean = new BeanUtilsBean();
for (String key : values.keySet()) {
Object value = values.get(key);
beanUtilBean.setProperty(instance, key, value);
}
} catch (Exception e) {
JKExceptionUtil.handle(e);
}
} } | public class class_name {
public static void populate(Object instance, Map<String, Object> values) {
try {
BeanUtilsBean beanUtilBean = new BeanUtilsBean();
for (String key : values.keySet()) {
Object value = values.get(key);
beanUtilBean.setProperty(instance, key, value);
// depends on control dependency: [for], data = [key]
}
} catch (Exception e) {
JKExceptionUtil.handle(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final WritableRaster filter(final Raster pSource, WritableRaster pDest, IndexColorModel pColorModel) {
int width = pSource.getWidth();
int height = pSource.getHeight();
// Create destination raster if needed
if (pDest == null) {
pDest = createCompatibleDestRaster(pSource, pColorModel);
}
// Initialize Floyd-Steinberg error vectors.
// +2 to handle the previous pixel and next pixel case minimally
// When reference for column, add 1 to reference as this buffer is
// offset from actual column position by one to allow FS to not check
// left/right edge conditions
int[][] currErr = new int[width + 2][3];
int[][] nextErr = new int[width + 2][3];
// Random errors in [-1 .. 1] - for first row
for (int i = 0; i < width + 2; i++) {
// Note: This is broken for the strange cases where nextInt returns Integer.MIN_VALUE
currErr[i][0] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
currErr[i][1] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
currErr[i][2] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
}
// Temp buffers
final int[] diff = new int[3]; // No alpha
final int[] inRGB = new int[4];
final int[] outRGB = new int[4];
Object pixel = null;
boolean forward = true;
// Loop through image data
for (int y = 0; y < height; y++) {
// Clear out next error rows for colour errors
for (int i = nextErr.length; --i >= 0;) {
nextErr[i][0] = 0;
nextErr[i][1] = 0;
nextErr[i][2] = 0;
}
// Set up start column and limit
int x;
int limit;
if (forward) {
x = 0;
limit = width;
}
else {
x = width - 1;
limit = -1;
}
// TODO: Use getPixels instead of getPixel for better performance?
// Loop over row
while (true) {
// Get RGB from original raster
// DON'T KNOW IF THIS WILL WORK FOR ALL TYPES.
pSource.getPixel(x, y, inRGB);
// Get error for this pixel & add error to rgb
for (int i = 0; i < 3; i++) {
// Make a 28.4 FP number, add Error (with fraction),
// rounding and truncate to int
inRGB[i] = ((inRGB[i] << 4) + currErr[x + 1][i] + 0x08) >> 4;
// Clamp
if (inRGB[i] > 255) {
inRGB[i] = 255;
}
else if (inRGB[i] < 0) {
inRGB[i] = 0;
}
}
// Get pixel value...
// It is VERY important that we are using a IndexColorModel that
// support reverse color lookup for speed.
pixel = pColorModel.getDataElements(toIntARGB(inRGB), pixel);
// ...set it...
pDest.setDataElements(x, y, pixel);
// ..and get back the closet match
pDest.getPixel(x, y, outRGB);
// Convert the value to default sRGB
// Should work for all transfertypes supported by IndexColorModel
toRGBArray(pColorModel.getRGB(outRGB[0]), outRGB);
// Find diff
diff[0] = inRGB[0] - outRGB[0];
diff[1] = inRGB[1] - outRGB[1];
diff[2] = inRGB[2] - outRGB[2];
// Apply F-S error diffusion
// Serpentine scan: left-right
if (forward) {
// Row 1 (y)
// Update error in this pixel (x + 1)
currErr[x + 2][0] += diff[0] * 7;
currErr[x + 2][1] += diff[1] * 7;
currErr[x + 2][2] += diff[2] * 7;
// Row 2 (y + 1)
// Update error in this pixel (x - 1)
nextErr[x][0] += diff[0] * 3;
nextErr[x][1] += diff[1] * 3;
nextErr[x][2] += diff[2] * 3;
// Update error in this pixel (x)
nextErr[x + 1][0] += diff[0] * 5;
nextErr[x + 1][1] += diff[1] * 5;
nextErr[x + 1][2] += diff[2] * 5;
// Update error in this pixel (x + 1)
// TODO: Consider calculating this using
// error term = error - sum(error terms 1, 2 and 3)
// See Computer Graphics (Foley et al.), p. 573
nextErr[x + 2][0] += diff[0]; // * 1;
nextErr[x + 2][1] += diff[1]; // * 1;
nextErr[x + 2][2] += diff[2]; // * 1;
// Next
x++;
// Done?
if (x >= limit) {
break;
}
}
else {
// Row 1 (y)
// Update error in this pixel (x - 1)
currErr[x][0] += diff[0] * 7;
currErr[x][1] += diff[1] * 7;
currErr[x][2] += diff[2] * 7;
// Row 2 (y + 1)
// Update error in this pixel (x + 1)
nextErr[x + 2][0] += diff[0] * 3;
nextErr[x + 2][1] += diff[1] * 3;
nextErr[x + 2][2] += diff[2] * 3;
// Update error in this pixel (x)
nextErr[x + 1][0] += diff[0] * 5;
nextErr[x + 1][1] += diff[1] * 5;
nextErr[x + 1][2] += diff[2] * 5;
// Update error in this pixel (x - 1)
// TODO: Consider calculating this using
// error term = error - sum(error terms 1, 2 and 3)
// See Computer Graphics (Foley et al.), p. 573
nextErr[x][0] += diff[0]; // * 1;
nextErr[x][1] += diff[1]; // * 1;
nextErr[x][2] += diff[2]; // * 1;
// Previous
x--;
// Done?
if (x <= limit) {
break;
}
}
}
// Make next error info current for next iteration
int[][] temperr;
temperr = currErr;
currErr = nextErr;
nextErr = temperr;
// Toggle direction
if (alternateScans) {
forward = !forward;
}
}
return pDest;
} } | public class class_name {
public final WritableRaster filter(final Raster pSource, WritableRaster pDest, IndexColorModel pColorModel) {
int width = pSource.getWidth();
int height = pSource.getHeight();
// Create destination raster if needed
if (pDest == null) {
pDest = createCompatibleDestRaster(pSource, pColorModel);
// depends on control dependency: [if], data = [none]
}
// Initialize Floyd-Steinberg error vectors.
// +2 to handle the previous pixel and next pixel case minimally
// When reference for column, add 1 to reference as this buffer is
// offset from actual column position by one to allow FS to not check
// left/right edge conditions
int[][] currErr = new int[width + 2][3];
int[][] nextErr = new int[width + 2][3];
// Random errors in [-1 .. 1] - for first row
for (int i = 0; i < width + 2; i++) {
// Note: This is broken for the strange cases where nextInt returns Integer.MIN_VALUE
currErr[i][0] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
// depends on control dependency: [for], data = [i]
currErr[i][1] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
// depends on control dependency: [for], data = [i]
currErr[i][2] = RANDOM.nextInt(FS_SCALE * 2) - FS_SCALE;
// depends on control dependency: [for], data = [i]
}
// Temp buffers
final int[] diff = new int[3]; // No alpha
final int[] inRGB = new int[4];
final int[] outRGB = new int[4];
Object pixel = null;
boolean forward = true;
// Loop through image data
for (int y = 0; y < height; y++) {
// Clear out next error rows for colour errors
for (int i = nextErr.length; --i >= 0;) {
nextErr[i][0] = 0;
// depends on control dependency: [for], data = [i]
nextErr[i][1] = 0;
// depends on control dependency: [for], data = [i]
nextErr[i][2] = 0;
// depends on control dependency: [for], data = [i]
}
// Set up start column and limit
int x;
int limit;
if (forward) {
x = 0;
// depends on control dependency: [if], data = [none]
limit = width;
// depends on control dependency: [if], data = [none]
}
else {
x = width - 1;
// depends on control dependency: [if], data = [none]
limit = -1;
// depends on control dependency: [if], data = [none]
}
// TODO: Use getPixels instead of getPixel for better performance?
// Loop over row
while (true) {
// Get RGB from original raster
// DON'T KNOW IF THIS WILL WORK FOR ALL TYPES.
pSource.getPixel(x, y, inRGB);
// depends on control dependency: [while], data = [none]
// Get error for this pixel & add error to rgb
for (int i = 0; i < 3; i++) {
// Make a 28.4 FP number, add Error (with fraction),
// rounding and truncate to int
inRGB[i] = ((inRGB[i] << 4) + currErr[x + 1][i] + 0x08) >> 4;
// depends on control dependency: [for], data = [i]
// Clamp
if (inRGB[i] > 255) {
inRGB[i] = 255;
// depends on control dependency: [if], data = [none]
}
else if (inRGB[i] < 0) {
inRGB[i] = 0;
// depends on control dependency: [if], data = [none]
}
}
// Get pixel value...
// It is VERY important that we are using a IndexColorModel that
// support reverse color lookup for speed.
pixel = pColorModel.getDataElements(toIntARGB(inRGB), pixel);
// depends on control dependency: [while], data = [none]
// ...set it...
pDest.setDataElements(x, y, pixel);
// depends on control dependency: [while], data = [none]
// ..and get back the closet match
pDest.getPixel(x, y, outRGB);
// depends on control dependency: [while], data = [none]
// Convert the value to default sRGB
// Should work for all transfertypes supported by IndexColorModel
toRGBArray(pColorModel.getRGB(outRGB[0]), outRGB);
// depends on control dependency: [while], data = [none]
// Find diff
diff[0] = inRGB[0] - outRGB[0];
// depends on control dependency: [while], data = [none]
diff[1] = inRGB[1] - outRGB[1];
// depends on control dependency: [while], data = [none]
diff[2] = inRGB[2] - outRGB[2];
// depends on control dependency: [while], data = [none]
// Apply F-S error diffusion
// Serpentine scan: left-right
if (forward) {
// Row 1 (y)
// Update error in this pixel (x + 1)
currErr[x + 2][0] += diff[0] * 7;
// depends on control dependency: [if], data = [none]
currErr[x + 2][1] += diff[1] * 7;
// depends on control dependency: [if], data = [none]
currErr[x + 2][2] += diff[2] * 7;
// depends on control dependency: [if], data = [none]
// Row 2 (y + 1)
// Update error in this pixel (x - 1)
nextErr[x][0] += diff[0] * 3;
// depends on control dependency: [if], data = [none]
nextErr[x][1] += diff[1] * 3;
// depends on control dependency: [if], data = [none]
nextErr[x][2] += diff[2] * 3;
// depends on control dependency: [if], data = [none]
// Update error in this pixel (x)
nextErr[x + 1][0] += diff[0] * 5;
// depends on control dependency: [if], data = [none]
nextErr[x + 1][1] += diff[1] * 5;
// depends on control dependency: [if], data = [none]
nextErr[x + 1][2] += diff[2] * 5;
// depends on control dependency: [if], data = [none]
// Update error in this pixel (x + 1)
// TODO: Consider calculating this using
// error term = error - sum(error terms 1, 2 and 3)
// See Computer Graphics (Foley et al.), p. 573
nextErr[x + 2][0] += diff[0]; // * 1;
// depends on control dependency: [if], data = [none]
nextErr[x + 2][1] += diff[1]; // * 1;
// depends on control dependency: [if], data = [none]
nextErr[x + 2][2] += diff[2]; // * 1;
// depends on control dependency: [if], data = [none]
// Next
x++;
// depends on control dependency: [if], data = [none]
// Done?
if (x >= limit) {
break;
}
}
else {
// Row 1 (y)
// Update error in this pixel (x - 1)
currErr[x][0] += diff[0] * 7;
// depends on control dependency: [if], data = [none]
currErr[x][1] += diff[1] * 7;
// depends on control dependency: [if], data = [none]
currErr[x][2] += diff[2] * 7;
// depends on control dependency: [if], data = [none]
// Row 2 (y + 1)
// Update error in this pixel (x + 1)
nextErr[x + 2][0] += diff[0] * 3;
// depends on control dependency: [if], data = [none]
nextErr[x + 2][1] += diff[1] * 3;
// depends on control dependency: [if], data = [none]
nextErr[x + 2][2] += diff[2] * 3;
// depends on control dependency: [if], data = [none]
// Update error in this pixel (x)
nextErr[x + 1][0] += diff[0] * 5;
// depends on control dependency: [if], data = [none]
nextErr[x + 1][1] += diff[1] * 5;
// depends on control dependency: [if], data = [none]
nextErr[x + 1][2] += diff[2] * 5;
// depends on control dependency: [if], data = [none]
// Update error in this pixel (x - 1)
// TODO: Consider calculating this using
// error term = error - sum(error terms 1, 2 and 3)
// See Computer Graphics (Foley et al.), p. 573
nextErr[x][0] += diff[0]; // * 1;
// depends on control dependency: [if], data = [none]
nextErr[x][1] += diff[1]; // * 1;
// depends on control dependency: [if], data = [none]
nextErr[x][2] += diff[2]; // * 1;
// depends on control dependency: [if], data = [none]
// Previous
x--;
// depends on control dependency: [if], data = [none]
// Done?
if (x <= limit) {
break;
}
}
}
// Make next error info current for next iteration
int[][] temperr;
temperr = currErr;
// depends on control dependency: [for], data = [none]
currErr = nextErr;
// depends on control dependency: [for], data = [none]
nextErr = temperr;
// depends on control dependency: [for], data = [none]
// Toggle direction
if (alternateScans) {
forward = !forward;
// depends on control dependency: [if], data = [none]
}
}
return pDest;
} } |
public class class_name {
private int getPrototypeIndex(Renderer renderer) {
int index = 0;
for (Renderer prototype : prototypes) {
if (prototype.getClass().equals(renderer.getClass())) {
break;
}
index++;
}
return index;
} } | public class class_name {
private int getPrototypeIndex(Renderer renderer) {
int index = 0;
for (Renderer prototype : prototypes) {
if (prototype.getClass().equals(renderer.getClass())) {
break;
}
index++; // depends on control dependency: [for], data = [none]
}
return index;
} } |
public class class_name {
public static boolean isEmpty(String target, String... specialValueAsEmpty) {
if (isEmpty(target)) {
return true;
}
return matcher(target).isEmpty(specialValueAsEmpty);
} } | public class class_name {
public static boolean isEmpty(String target, String... specialValueAsEmpty) {
if (isEmpty(target)) {
return true; // depends on control dependency: [if], data = [none]
}
return matcher(target).isEmpty(specialValueAsEmpty);
} } |
public class class_name {
protected void handleInboundSoapHeaders(final org.springframework.ws.soap.SoapMessage soapMessage,
final SoapMessage message) {
try {
final SoapHeader soapHeader = soapMessage.getSoapHeader();
if (soapHeader != null) {
final Iterator<?> iter = soapHeader.examineAllHeaderElements();
while (iter.hasNext()) {
final SoapHeaderElement headerEntry = (SoapHeaderElement) iter.next();
MessageHeaderUtils.setHeader(message, headerEntry.getName().getLocalPart(), headerEntry.getText());
}
if (soapHeader.getSource() != null) {
final StringResult headerData = new StringResult();
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
final Transformer transformer = transformerFactory.newTransformer();
transformer.transform(soapHeader.getSource(), headerData);
message.addHeaderData(headerData.toString());
}
}
if (StringUtils.hasText(soapMessage.getSoapAction())) {
if (soapMessage.getSoapAction().equals("\"\"")) {
message.setHeader(SoapMessageHeaders.SOAP_ACTION, "");
} else {
if (soapMessage.getSoapAction().startsWith("\"") && soapMessage.getSoapAction().endsWith("\"")) {
message.setHeader(SoapMessageHeaders.SOAP_ACTION,
soapMessage.getSoapAction().substring(1, soapMessage.getSoapAction().length() - 1));
} else {
message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction());
}
}
}
} catch (final TransformerException e) {
throw new CitrusRuntimeException("Failed to read SOAP header source", e);
}
} } | public class class_name {
protected void handleInboundSoapHeaders(final org.springframework.ws.soap.SoapMessage soapMessage,
final SoapMessage message) {
try {
final SoapHeader soapHeader = soapMessage.getSoapHeader();
if (soapHeader != null) {
final Iterator<?> iter = soapHeader.examineAllHeaderElements();
while (iter.hasNext()) {
final SoapHeaderElement headerEntry = (SoapHeaderElement) iter.next();
MessageHeaderUtils.setHeader(message, headerEntry.getName().getLocalPart(), headerEntry.getText()); // depends on control dependency: [while], data = [none]
}
if (soapHeader.getSource() != null) {
final StringResult headerData = new StringResult();
final TransformerFactory transformerFactory = TransformerFactory.newInstance();
final Transformer transformer = transformerFactory.newTransformer();
transformer.transform(soapHeader.getSource(), headerData); // depends on control dependency: [if], data = [(soapHeader.getSource()]
message.addHeaderData(headerData.toString()); // depends on control dependency: [if], data = [none]
}
}
if (StringUtils.hasText(soapMessage.getSoapAction())) {
if (soapMessage.getSoapAction().equals("\"\"")) {
message.setHeader(SoapMessageHeaders.SOAP_ACTION, ""); // depends on control dependency: [if], data = [none]
} else {
if (soapMessage.getSoapAction().startsWith("\"") && soapMessage.getSoapAction().endsWith("\"")) {
message.setHeader(SoapMessageHeaders.SOAP_ACTION,
soapMessage.getSoapAction().substring(1, soapMessage.getSoapAction().length() - 1)); // depends on control dependency: [if], data = [none]
} else {
message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction()); // depends on control dependency: [if], data = [none]
}
}
}
} catch (final TransformerException e) {
throw new CitrusRuntimeException("Failed to read SOAP header source", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void classify() {
long start = System.currentTimeMillis();
if(log.isInfoEnabled())
log.info("Classifying with " + numThreads + " threads");
// Create contexts for init concepts in the ontology
int numConcepts = factory.getTotalConcepts();
for (int i = 0; i < numConcepts; i++) {
Context c = new Context(i, this);
contextIndex.put(i, c);
if (c.activate()) {
todo.add(c);
}
if(log.isTraceEnabled()) {
log.trace("Added context " + i);
}
}
if(log.isInfoEnabled())
log.info("Running saturation");
ExecutorService executor = Executors.newFixedThreadPool(numThreads, THREAD_FACTORY);
for (int j = 0; j < numThreads; j++) {
Runnable worker = new Worker(todo);
executor.execute(worker);
}
executor.shutdown();
while (!executor.isTerminated()) {
try {
executor.awaitTermination(100, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
assert (todo.isEmpty());
if (log.isTraceEnabled()) {
log.trace("Processed " + contextIndex.size() + " contexts");
}
hasBeenIncrementallyClassified = false;
Statistics.INSTANCE.setTime("classification",
System.currentTimeMillis() - start);
} } | public class class_name {
public void classify() {
long start = System.currentTimeMillis();
if(log.isInfoEnabled())
log.info("Classifying with " + numThreads + " threads");
// Create contexts for init concepts in the ontology
int numConcepts = factory.getTotalConcepts();
for (int i = 0; i < numConcepts; i++) {
Context c = new Context(i, this);
contextIndex.put(i, c); // depends on control dependency: [for], data = [i]
if (c.activate()) {
todo.add(c); // depends on control dependency: [if], data = [none]
}
if(log.isTraceEnabled()) {
log.trace("Added context " + i); // depends on control dependency: [if], data = [none]
}
}
if(log.isInfoEnabled())
log.info("Running saturation");
ExecutorService executor = Executors.newFixedThreadPool(numThreads, THREAD_FACTORY);
for (int j = 0; j < numThreads; j++) {
Runnable worker = new Worker(todo);
executor.execute(worker); // depends on control dependency: [for], data = [none]
}
executor.shutdown();
while (!executor.isTerminated()) {
try {
executor.awaitTermination(100, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
assert (todo.isEmpty());
if (log.isTraceEnabled()) {
log.trace("Processed " + contextIndex.size() + " contexts"); // depends on control dependency: [if], data = [none]
}
hasBeenIncrementallyClassified = false;
Statistics.INSTANCE.setTime("classification",
System.currentTimeMillis() - start);
} } |
public class class_name {
public Observable<ServiceResponse<CognitiveServicesAccountKeysInner>> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listKeys(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CognitiveServicesAccountKeysInner>>>() {
@Override
public Observable<ServiceResponse<CognitiveServicesAccountKeysInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CognitiveServicesAccountKeysInner> clientResponse = listKeysDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<CognitiveServicesAccountKeysInner>> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listKeys(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CognitiveServicesAccountKeysInner>>>() {
@Override
public Observable<ServiceResponse<CognitiveServicesAccountKeysInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CognitiveServicesAccountKeysInner> clientResponse = listKeysDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public AbstractPolicy parse(InputStream policyStream,
boolean schemaValidate)
throws ValidationException {
// Parse; die if not well-formed
Document doc = null;
DocumentBuilder domParser = null;
try {
domParser = XmlTransformUtility.borrowDocumentBuilder();
domParser.setErrorHandler(THROW_ALL);
doc = domParser.parse(policyStream);
} catch (Exception e) {
throw new ValidationException("Policy invalid; malformed XML", e);
} finally {
if (domParser != null) {
XmlTransformUtility.returnDocumentBuilder(domParser);
}
}
if (schemaValidate) {
// XSD-validate; die if not schema-valid
Validator validator = null;
try {
validator = m_validators.borrowObject();
validator.validate(new DOMSource(doc));
} catch (Exception e) {
throw new ValidationException("Policy invalid; schema"
+ " validation failed", e);
} finally {
if (validator != null) try {
m_validators.returnObject(validator);
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
// Construct AbstractPolicy from doc; die if root isn't "Policy[Set]"
Element root = doc.getDocumentElement();
String rootName = root.getTagName();
try {
if (rootName.equals("Policy")) {
return Policy.getInstance(root);
} else if (rootName.equals("PolicySet")) {
return PolicySet.getInstance(root);
} else {
throw new ValidationException("Policy invalid; root element is "
+ rootName + ", but should be "
+ "Policy or PolicySet");
}
} catch (ParsingException e) {
throw new ValidationException("Policy invalid; failed parsing by "
+ "Sun XACML implementation", e);
}
} } | public class class_name {
public AbstractPolicy parse(InputStream policyStream,
boolean schemaValidate)
throws ValidationException {
// Parse; die if not well-formed
Document doc = null;
DocumentBuilder domParser = null;
try {
domParser = XmlTransformUtility.borrowDocumentBuilder();
domParser.setErrorHandler(THROW_ALL);
doc = domParser.parse(policyStream);
} catch (Exception e) {
throw new ValidationException("Policy invalid; malformed XML", e);
} finally {
if (domParser != null) {
XmlTransformUtility.returnDocumentBuilder(domParser); // depends on control dependency: [if], data = [(domParser]
}
}
if (schemaValidate) {
// XSD-validate; die if not schema-valid
Validator validator = null;
try {
validator = m_validators.borrowObject(); // depends on control dependency: [try], data = [none]
validator.validate(new DOMSource(doc)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ValidationException("Policy invalid; schema"
+ " validation failed", e);
} finally { // depends on control dependency: [catch], data = [none]
if (validator != null) try {
m_validators.returnObject(validator); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
// Construct AbstractPolicy from doc; die if root isn't "Policy[Set]"
Element root = doc.getDocumentElement();
String rootName = root.getTagName();
try {
if (rootName.equals("Policy")) {
return Policy.getInstance(root); // depends on control dependency: [if], data = [none]
} else if (rootName.equals("PolicySet")) {
return PolicySet.getInstance(root); // depends on control dependency: [if], data = [none]
} else {
throw new ValidationException("Policy invalid; root element is "
+ rootName + ", but should be "
+ "Policy or PolicySet");
}
} catch (ParsingException e) {
throw new ValidationException("Policy invalid; failed parsing by "
+ "Sun XACML implementation", e);
}
} } |
public class class_name {
public Email to(String... to) {
for (String t : to) {
to(new EmailAddress(t));
}
return this;
} } | public class class_name {
public Email to(String... to) {
for (String t : to) {
to(new EmailAddress(t)); // depends on control dependency: [for], data = [t]
}
return this;
} } |
public class class_name {
private static void swap(long[] values, int[] index, int i, int j) {
if (i != j) {
swap(values, i, j);
swap(index, i, j);
numSwaps ++;
}
} } | public class class_name {
private static void swap(long[] values, int[] index, int i, int j) {
if (i != j) {
swap(values, i, j); // depends on control dependency: [if], data = [j)]
swap(index, i, j); // depends on control dependency: [if], data = [(i]
numSwaps ++; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DirectoryDescription directoryDescription, ProtocolMarshaller protocolMarshaller) {
if (directoryDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(directoryDescription.getDirectoryId(), DIRECTORYID_BINDING);
protocolMarshaller.marshall(directoryDescription.getName(), NAME_BINDING);
protocolMarshaller.marshall(directoryDescription.getShortName(), SHORTNAME_BINDING);
protocolMarshaller.marshall(directoryDescription.getSize(), SIZE_BINDING);
protocolMarshaller.marshall(directoryDescription.getEdition(), EDITION_BINDING);
protocolMarshaller.marshall(directoryDescription.getAlias(), ALIAS_BINDING);
protocolMarshaller.marshall(directoryDescription.getAccessUrl(), ACCESSURL_BINDING);
protocolMarshaller.marshall(directoryDescription.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(directoryDescription.getDnsIpAddrs(), DNSIPADDRS_BINDING);
protocolMarshaller.marshall(directoryDescription.getStage(), STAGE_BINDING);
protocolMarshaller.marshall(directoryDescription.getShareStatus(), SHARESTATUS_BINDING);
protocolMarshaller.marshall(directoryDescription.getShareMethod(), SHAREMETHOD_BINDING);
protocolMarshaller.marshall(directoryDescription.getShareNotes(), SHARENOTES_BINDING);
protocolMarshaller.marshall(directoryDescription.getLaunchTime(), LAUNCHTIME_BINDING);
protocolMarshaller.marshall(directoryDescription.getStageLastUpdatedDateTime(), STAGELASTUPDATEDDATETIME_BINDING);
protocolMarshaller.marshall(directoryDescription.getType(), TYPE_BINDING);
protocolMarshaller.marshall(directoryDescription.getVpcSettings(), VPCSETTINGS_BINDING);
protocolMarshaller.marshall(directoryDescription.getConnectSettings(), CONNECTSETTINGS_BINDING);
protocolMarshaller.marshall(directoryDescription.getRadiusSettings(), RADIUSSETTINGS_BINDING);
protocolMarshaller.marshall(directoryDescription.getRadiusStatus(), RADIUSSTATUS_BINDING);
protocolMarshaller.marshall(directoryDescription.getStageReason(), STAGEREASON_BINDING);
protocolMarshaller.marshall(directoryDescription.getSsoEnabled(), SSOENABLED_BINDING);
protocolMarshaller.marshall(directoryDescription.getDesiredNumberOfDomainControllers(), DESIREDNUMBEROFDOMAINCONTROLLERS_BINDING);
protocolMarshaller.marshall(directoryDescription.getOwnerDirectoryDescription(), OWNERDIRECTORYDESCRIPTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DirectoryDescription directoryDescription, ProtocolMarshaller protocolMarshaller) {
if (directoryDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(directoryDescription.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getShortName(), SHORTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getSize(), SIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getEdition(), EDITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getAlias(), ALIAS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getAccessUrl(), ACCESSURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getDnsIpAddrs(), DNSIPADDRS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getStage(), STAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getShareStatus(), SHARESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getShareMethod(), SHAREMETHOD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getShareNotes(), SHARENOTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getLaunchTime(), LAUNCHTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getStageLastUpdatedDateTime(), STAGELASTUPDATEDDATETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getVpcSettings(), VPCSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getConnectSettings(), CONNECTSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getRadiusSettings(), RADIUSSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getRadiusStatus(), RADIUSSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getStageReason(), STAGEREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getSsoEnabled(), SSOENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getDesiredNumberOfDomainControllers(), DESIREDNUMBEROFDOMAINCONTROLLERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(directoryDescription.getOwnerDirectoryDescription(), OWNERDIRECTORYDESCRIPTION_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 {
@Then("^I check that table '(.+?)' is iqual to$")
public void comparetable(String tableName, DataTable dataTable) throws Exception {
Statement myStatement = null;
java.sql.ResultSet rs = null;
//from postgres table
List<String> sqlTable = new ArrayList<String>();
List<String> sqlTableAux = new ArrayList<String>();
//from Cucumber Datatable
List<String> tablePattern = new ArrayList<String>();
//comparison is by lists of string
tablePattern = dataTable.asList(String.class);
Connection myConnection = this.commonspec.getConnection();
String query = "SELECT * FROM " + tableName + " order by " + "id" + ";";
try {
myStatement = myConnection.createStatement();
rs = myStatement.executeQuery(query);
//takes column names and culumn count
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int count = resultSetMetaData.getColumnCount();
for (int i = 1; i <= count; i++) {
sqlTable.add(resultSetMetaData.getColumnName(i).toString());
}
//takes column names and culumn count
while (rs.next()) {
for (int i = 1; i <= count; i++) {
//aux list without column names
sqlTableAux.add(rs.getObject(i).toString());
}
}
sqlTable.addAll(sqlTableAux);
assertThat(sqlTable).as("Not equal elements!").isEqualTo(tablePattern);
rs.close();
myStatement.close();
} catch (Exception e) {
e.printStackTrace();
assertThat(rs).as("There are no table " + tableName).isNotNull();
}
} } | public class class_name {
@Then("^I check that table '(.+?)' is iqual to$")
public void comparetable(String tableName, DataTable dataTable) throws Exception {
Statement myStatement = null;
java.sql.ResultSet rs = null;
//from postgres table
List<String> sqlTable = new ArrayList<String>();
List<String> sqlTableAux = new ArrayList<String>();
//from Cucumber Datatable
List<String> tablePattern = new ArrayList<String>();
//comparison is by lists of string
tablePattern = dataTable.asList(String.class);
Connection myConnection = this.commonspec.getConnection();
String query = "SELECT * FROM " + tableName + " order by " + "id" + ";";
try {
myStatement = myConnection.createStatement();
rs = myStatement.executeQuery(query);
//takes column names and culumn count
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int count = resultSetMetaData.getColumnCount();
for (int i = 1; i <= count; i++) {
sqlTable.add(resultSetMetaData.getColumnName(i).toString()); // depends on control dependency: [for], data = [i]
}
//takes column names and culumn count
while (rs.next()) {
for (int i = 1; i <= count; i++) {
//aux list without column names
sqlTableAux.add(rs.getObject(i).toString()); // depends on control dependency: [for], data = [i]
}
}
sqlTable.addAll(sqlTableAux);
assertThat(sqlTable).as("Not equal elements!").isEqualTo(tablePattern);
rs.close();
myStatement.close();
} catch (Exception e) {
e.printStackTrace();
assertThat(rs).as("There are no table " + tableName).isNotNull();
}
} } |
public class class_name {
private int getInitializedType(final SymbolTable symbolTable, final int abstractType) {
if (abstractType == UNINITIALIZED_THIS
|| (abstractType & (DIM_MASK | KIND_MASK)) == UNINITIALIZED_KIND) {
for (int i = 0; i < initializationCount; ++i) {
int initializedType = initializations[i];
int dim = initializedType & DIM_MASK;
int kind = initializedType & KIND_MASK;
int value = initializedType & VALUE_MASK;
if (kind == LOCAL_KIND) {
initializedType = dim + inputLocals[value];
} else if (kind == STACK_KIND) {
initializedType = dim + inputStack[inputStack.length - value];
}
if (abstractType == initializedType) {
if (abstractType == UNINITIALIZED_THIS) {
return REFERENCE_KIND | symbolTable.addType(symbolTable.getClassName());
} else {
return REFERENCE_KIND
| symbolTable.addType(symbolTable.getType(abstractType & VALUE_MASK).value);
}
}
}
}
return abstractType;
} } | public class class_name {
private int getInitializedType(final SymbolTable symbolTable, final int abstractType) {
if (abstractType == UNINITIALIZED_THIS
|| (abstractType & (DIM_MASK | KIND_MASK)) == UNINITIALIZED_KIND) {
for (int i = 0; i < initializationCount; ++i) {
int initializedType = initializations[i];
int dim = initializedType & DIM_MASK;
int kind = initializedType & KIND_MASK;
int value = initializedType & VALUE_MASK;
if (kind == LOCAL_KIND) {
initializedType = dim + inputLocals[value]; // depends on control dependency: [if], data = [none]
} else if (kind == STACK_KIND) {
initializedType = dim + inputStack[inputStack.length - value]; // depends on control dependency: [if], data = [none]
}
if (abstractType == initializedType) {
if (abstractType == UNINITIALIZED_THIS) {
return REFERENCE_KIND | symbolTable.addType(symbolTable.getClassName()); // depends on control dependency: [if], data = [none]
} else {
return REFERENCE_KIND
| symbolTable.addType(symbolTable.getType(abstractType & VALUE_MASK).value); // depends on control dependency: [if], data = [none]
}
}
}
}
return abstractType;
} } |
public class class_name {
@Override
public void setAtom(int idx, IAtom atom) {
if (idx >= atomCount)
throw new IndexOutOfBoundsException("No atom at index: " + idx);
int aidx = indexOf(atom);
if (aidx >= 0)
throw new IllegalArgumentException("Atom already in container at index: " + idx);
final IAtom oldAtom = atoms[idx];
atoms[idx] = atom;
// update electron containers
for (IBond bond : bonds()) {
for (int i = 0; i < bond.getAtomCount(); i++) {
if (oldAtom.equals(bond.getAtom(i))) {
bond.setAtom(atom, i);
}
}
}
for (ISingleElectron ec : singleElectrons()) {
if (oldAtom.equals(ec.getAtom()))
ec.setAtom(atom);
}
for (ILonePair lp : lonePairs()) {
if (oldAtom.equals(lp.getAtom()))
lp.setAtom(atom);
}
// update stereo
List<IStereoElement> oldStereo = null;
List<IStereoElement> newStereo = null;
for (IStereoElement se : stereoElements()) {
if (se.contains(oldAtom)) {
if (oldStereo == null) {
oldStereo = new ArrayList<>();
newStereo = new ArrayList<>();
}
oldStereo.add(se);
Map<IAtom, IAtom> amap = Collections.singletonMap(oldAtom, atom);
Map<IBond, IBond> bmap = Collections.emptyMap();
newStereo.add(se.map(amap, bmap));
}
}
if (oldStereo != null) {
stereoElements.removeAll(oldStereo);
stereoElements.addAll(newStereo);
}
} } | public class class_name {
@Override
public void setAtom(int idx, IAtom atom) {
if (idx >= atomCount)
throw new IndexOutOfBoundsException("No atom at index: " + idx);
int aidx = indexOf(atom);
if (aidx >= 0)
throw new IllegalArgumentException("Atom already in container at index: " + idx);
final IAtom oldAtom = atoms[idx];
atoms[idx] = atom;
// update electron containers
for (IBond bond : bonds()) {
for (int i = 0; i < bond.getAtomCount(); i++) {
if (oldAtom.equals(bond.getAtom(i))) {
bond.setAtom(atom, i); // depends on control dependency: [if], data = [none]
}
}
}
for (ISingleElectron ec : singleElectrons()) {
if (oldAtom.equals(ec.getAtom()))
ec.setAtom(atom);
}
for (ILonePair lp : lonePairs()) {
if (oldAtom.equals(lp.getAtom()))
lp.setAtom(atom);
}
// update stereo
List<IStereoElement> oldStereo = null;
List<IStereoElement> newStereo = null;
for (IStereoElement se : stereoElements()) {
if (se.contains(oldAtom)) {
if (oldStereo == null) {
oldStereo = new ArrayList<>(); // depends on control dependency: [if], data = [none]
newStereo = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
oldStereo.add(se); // depends on control dependency: [if], data = [none]
Map<IAtom, IAtom> amap = Collections.singletonMap(oldAtom, atom);
Map<IBond, IBond> bmap = Collections.emptyMap();
newStereo.add(se.map(amap, bmap)); // depends on control dependency: [if], data = [none]
}
}
if (oldStereo != null) {
stereoElements.removeAll(oldStereo); // depends on control dependency: [if], data = [(oldStereo]
stereoElements.addAll(newStereo); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
@Nonnull
protected Word<I> concatInternal(Word<? extends I>... words) {
if (words.length == 0) {
return this;
}
int len = length();
int totalSize = len;
for (Word<? extends I> word : words) {
totalSize += word.length();
}
Object[] array = new Object[totalSize];
writeToArray(0, array, 0, len);
int currOfs = len;
for (Word<? extends I> w : words) {
int wLen = w.length();
w.writeToArray(0, array, currOfs, wLen);
currOfs += wLen;
}
return new SharedWord<>(array);
} } | public class class_name {
@SuppressWarnings("unchecked")
@Nonnull
protected Word<I> concatInternal(Word<? extends I>... words) {
if (words.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
int len = length();
int totalSize = len;
for (Word<? extends I> word : words) {
totalSize += word.length();
}
Object[] array = new Object[totalSize];
writeToArray(0, array, 0, len);
int currOfs = len;
for (Word<? extends I> w : words) {
int wLen = w.length();
w.writeToArray(0, array, currOfs, wLen);
currOfs += wLen;
}
return new SharedWord<>(array);
} } |
public class class_name {
public ListUploadsResult withUploads(Upload... uploads) {
if (this.uploads == null) {
setUploads(new java.util.ArrayList<Upload>(uploads.length));
}
for (Upload ele : uploads) {
this.uploads.add(ele);
}
return this;
} } | public class class_name {
public ListUploadsResult withUploads(Upload... uploads) {
if (this.uploads == null) {
setUploads(new java.util.ArrayList<Upload>(uploads.length)); // depends on control dependency: [if], data = [none]
}
for (Upload ele : uploads) {
this.uploads.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public void add(final WComponent component) {
super.add(component);
if (component instanceof Input) {
setForComponent(component);
}
} } | public class class_name {
@Override
public void add(final WComponent component) {
super.add(component);
if (component instanceof Input) {
setForComponent(component); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final Map<String, SheetConfiguration> buildConfiguration() {
Map<String, SheetConfiguration> sheetConfigMap = new LinkedHashMap<>();
// in buildsheet, it's possible to add sheets in workbook.
// so cache the sheetname first here.
List<String> sheetNames = new ArrayList<>();
String sname;
for (int i = 0; i < parent.getWb().getNumberOfSheets(); i++) {
sname = parent.getWb().getSheetName(i);
if (!sname.startsWith(org.tiefaces.common.TieConstants.COPY_SHEET_PREFIX)) {
sheetNames.add(sname);
}
}
for (String sheetName : sheetNames) {
Sheet sheet = parent.getWb().getSheet(sheetName);
ConfigurationUtility.buildSheetCommentFromAlias(sheet, parent.getTieCommandAliasList());
buildSheet(sheet, sheetConfigMap, parent.getCellAttributesMap());
}
return sheetConfigMap;
} } | public class class_name {
public final Map<String, SheetConfiguration> buildConfiguration() {
Map<String, SheetConfiguration> sheetConfigMap = new LinkedHashMap<>();
// in buildsheet, it's possible to add sheets in workbook.
// so cache the sheetname first here.
List<String> sheetNames = new ArrayList<>();
String sname;
for (int i = 0; i < parent.getWb().getNumberOfSheets(); i++) {
sname = parent.getWb().getSheetName(i);
// depends on control dependency: [for], data = [i]
if (!sname.startsWith(org.tiefaces.common.TieConstants.COPY_SHEET_PREFIX)) {
sheetNames.add(sname);
// depends on control dependency: [if], data = [none]
}
}
for (String sheetName : sheetNames) {
Sheet sheet = parent.getWb().getSheet(sheetName);
ConfigurationUtility.buildSheetCommentFromAlias(sheet, parent.getTieCommandAliasList());
// depends on control dependency: [for], data = [none]
buildSheet(sheet, sheetConfigMap, parent.getCellAttributesMap());
// depends on control dependency: [for], data = [none]
}
return sheetConfigMap;
} } |
public class class_name {
public static final Box getBox(View v)
{
if (v instanceof CSSBoxView) return getBox((CSSBoxView) v);
AttributeSet attr = v.getAttributes();
if (attr == null)
{
throw new NullPointerException("AttributeSet of " + v.getClass().getName() + "@"
+ Integer.toHexString(v.hashCode()) + " is set to NULL.");
}
Object obj = attr.getAttribute(Constants.ATTRIBUTE_BOX_REFERENCE);
if (obj != null && obj instanceof Box)
{
return (Box) obj;
}
else
{
throw new IllegalArgumentException("Box reference in attributes is not an instance of a Box.");
}
} } | public class class_name {
public static final Box getBox(View v)
{
if (v instanceof CSSBoxView) return getBox((CSSBoxView) v);
AttributeSet attr = v.getAttributes();
if (attr == null)
{
throw new NullPointerException("AttributeSet of " + v.getClass().getName() + "@"
+ Integer.toHexString(v.hashCode()) + " is set to NULL.");
}
Object obj = attr.getAttribute(Constants.ATTRIBUTE_BOX_REFERENCE);
if (obj != null && obj instanceof Box)
{
return (Box) obj; // depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalArgumentException("Box reference in attributes is not an instance of a Box.");
}
} } |
public class class_name {
@Override
public V get(Object key)
{
BinarySet<Entry<K,V>> es = (BinarySet<Entry<K,V>>) entrySet;
Entry<K, V> entry = entry((K) key, null);
Entry<K, V> res = es.get(entry);
if (res != null)
{
return res.getValue();
}
return null;
} } | public class class_name {
@Override
public V get(Object key)
{
BinarySet<Entry<K,V>> es = (BinarySet<Entry<K,V>>) entrySet;
Entry<K, V> entry = entry((K) key, null);
Entry<K, V> res = es.get(entry);
if (res != null)
{
return res.getValue();
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
@Nonnull
static String decodeUTF16(@Nonnull final String mapcode) {
String result;
final StringBuilder asciiBuf = new StringBuilder();
for (final char ch : mapcode.toCharArray()) {
if (ch == '.') {
asciiBuf.append(ch);
} else if ((ch >= 1) && (ch <= 'z')) {
// normal ascii
asciiBuf.append(ch);
} else {
boolean found = false;
for (final Unicode2Ascii unicode2Ascii : UNICODE2ASCII) {
if ((ch >= unicode2Ascii.min) && (ch <= unicode2Ascii.max)) {
final int pos = ((int) ch) - (int) unicode2Ascii.min;
asciiBuf.append(unicode2Ascii.convert.charAt(pos));
found = true;
break;
}
}
if (!found) {
asciiBuf.append('?');
break;
}
}
}
result = asciiBuf.toString();
// Repack if this was a Greek 'alpha' code. This will have been converted to a regular 'A' after one iteration.
if (mapcode.startsWith(String.valueOf(GREEK_CAPITAL_ALPHA))) {
final String unpacked = aeuUnpack(result);
if (unpacked.isEmpty()) {
throw new AssertionError("decodeUTF16: cannot decode " + mapcode);
}
result = Encoder.aeuPack(unpacked, false);
}
if (isAbjadScript(mapcode)) {
return convertFromAbjad(result);
} else {
return result;
}
} } | public class class_name {
@Nonnull
static String decodeUTF16(@Nonnull final String mapcode) {
String result;
final StringBuilder asciiBuf = new StringBuilder();
for (final char ch : mapcode.toCharArray()) {
if (ch == '.') {
asciiBuf.append(ch); // depends on control dependency: [if], data = [(ch]
} else if ((ch >= 1) && (ch <= 'z')) {
// normal ascii
asciiBuf.append(ch); // depends on control dependency: [if], data = [none]
} else {
boolean found = false;
for (final Unicode2Ascii unicode2Ascii : UNICODE2ASCII) {
if ((ch >= unicode2Ascii.min) && (ch <= unicode2Ascii.max)) {
final int pos = ((int) ch) - (int) unicode2Ascii.min;
asciiBuf.append(unicode2Ascii.convert.charAt(pos)); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
asciiBuf.append('?'); // depends on control dependency: [if], data = [none]
break;
}
}
}
result = asciiBuf.toString();
// Repack if this was a Greek 'alpha' code. This will have been converted to a regular 'A' after one iteration.
if (mapcode.startsWith(String.valueOf(GREEK_CAPITAL_ALPHA))) {
final String unpacked = aeuUnpack(result);
if (unpacked.isEmpty()) {
throw new AssertionError("decodeUTF16: cannot decode " + mapcode);
}
result = Encoder.aeuPack(unpacked, false); // depends on control dependency: [if], data = [none]
}
if (isAbjadScript(mapcode)) {
return convertFromAbjad(result); // depends on control dependency: [if], data = [none]
} else {
return result; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public IterableSubject factKeys() {
if (!(actual() instanceof ErrorWithFacts)) {
failWithActual(simpleFact("expected a failure thrown by Truth's new failure API"));
return ignoreCheck().that(ImmutableList.of());
}
ErrorWithFacts error = (ErrorWithFacts) actual();
return check("factKeys()").that(getFactKeys(error));
} } | public class class_name {
public IterableSubject factKeys() {
if (!(actual() instanceof ErrorWithFacts)) {
failWithActual(simpleFact("expected a failure thrown by Truth's new failure API")); // depends on control dependency: [if], data = [none]
return ignoreCheck().that(ImmutableList.of()); // depends on control dependency: [if], data = [none]
}
ErrorWithFacts error = (ErrorWithFacts) actual();
return check("factKeys()").that(getFactKeys(error));
} } |
public class class_name {
public static Flux<ByteBuf> split(final ByteBuf whole, final int chunkSize) {
return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> {
final int writerIndex = whole.writerIndex();
//
if (readFromIndex >= writerIndex) {
synchronousSync.complete();
return writerIndex;
} else {
int readSize = Math.min(writerIndex - readFromIndex, chunkSize);
// Netty slice operation will not increment the ref count.
//
// Here we invoke 'retain' on each slice, since
// consumer of the returned Flux stream is responsible for
// releasing each chunk as it gets consumed.
//
synchronousSync.next(whole.slice(readFromIndex, readSize).retain());
return readFromIndex + readSize;
}
});
} } | public class class_name {
public static Flux<ByteBuf> split(final ByteBuf whole, final int chunkSize) {
return Flux.generate(whole::readerIndex, (readFromIndex, synchronousSync) -> {
final int writerIndex = whole.writerIndex();
//
if (readFromIndex >= writerIndex) {
synchronousSync.complete(); // depends on control dependency: [if], data = [none]
return writerIndex; // depends on control dependency: [if], data = [none]
} else {
int readSize = Math.min(writerIndex - readFromIndex, chunkSize);
// Netty slice operation will not increment the ref count.
//
// Here we invoke 'retain' on each slice, since
// consumer of the returned Flux stream is responsible for
// releasing each chunk as it gets consumed.
//
synchronousSync.next(whole.slice(readFromIndex, readSize).retain()); // depends on control dependency: [if], data = [(readFromIndex]
return readFromIndex + readSize; // depends on control dependency: [if], data = [none]
}
});
} } |
public class class_name {
private String buildTranslateCSChapter(final BuildData buildData) {
final ContentSpec contentSpec = buildData.getContentSpec();
final TranslatedContentSpecWrapper translatedContentSpec = EntityUtilities.getClosestTranslatedContentSpecById(providerFactory,
contentSpec.getId(), contentSpec.getRevision());
final String para;
if (translatedContentSpec != null) {
final String url = translatedContentSpec.getEditorURL(buildData.getZanataDetails(), buildData.getBuildLocale());
if (url != null) {
para = DocBookUtilities.wrapInPara(DocBookUtilities.buildULink(url, "Translate this Content Spec"));
} else {
para = DocBookUtilities.wrapInPara(
"No editor link available as this Content Specification hasn't been pushed for Translation.");
}
} else {
para = DocBookUtilities.wrapInPara(
"No editor link available as this Content Specification hasn't been pushed for Translation.");
}
if (contentSpec.getBookType() == BookType.ARTICLE || contentSpec.getBookType() == BookType.ARTICLE_DRAFT) {
return DocBookUtilities.buildSection(para, "Content Specification");
} else {
return DocBookUtilities.buildChapter(para, "Content Specification");
}
} } | public class class_name {
private String buildTranslateCSChapter(final BuildData buildData) {
final ContentSpec contentSpec = buildData.getContentSpec();
final TranslatedContentSpecWrapper translatedContentSpec = EntityUtilities.getClosestTranslatedContentSpecById(providerFactory,
contentSpec.getId(), contentSpec.getRevision());
final String para;
if (translatedContentSpec != null) {
final String url = translatedContentSpec.getEditorURL(buildData.getZanataDetails(), buildData.getBuildLocale());
if (url != null) {
para = DocBookUtilities.wrapInPara(DocBookUtilities.buildULink(url, "Translate this Content Spec")); // depends on control dependency: [if], data = [(url]
} else {
para = DocBookUtilities.wrapInPara(
"No editor link available as this Content Specification hasn't been pushed for Translation."); // depends on control dependency: [if], data = [none]
}
} else {
para = DocBookUtilities.wrapInPara(
"No editor link available as this Content Specification hasn't been pushed for Translation."); // depends on control dependency: [if], data = [none]
}
if (contentSpec.getBookType() == BookType.ARTICLE || contentSpec.getBookType() == BookType.ARTICLE_DRAFT) {
return DocBookUtilities.buildSection(para, "Content Specification"); // depends on control dependency: [if], data = [none]
} else {
return DocBookUtilities.buildChapter(para, "Content Specification"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private WaitChecker getUrlWaitChecker(String imageConfigDesc,
Properties projectProperties,
WaitConfiguration wait) {
String waitUrl = StrSubstitutor.replace(wait.getUrl(), projectProperties);
WaitConfiguration.HttpConfiguration httpConfig = wait.getHttp();
HttpPingChecker checker;
if (httpConfig != null) {
checker = new HttpPingChecker(waitUrl, httpConfig.getMethod(), httpConfig.getStatus(), httpConfig.isAllowAllHosts());
log.info("%s: Waiting on url %s with method %s for status %s.",
imageConfigDesc, waitUrl, httpConfig.getMethod(), httpConfig.getStatus());
} else {
checker = new HttpPingChecker(waitUrl);
log.info("%s: Waiting on url %s.", imageConfigDesc, waitUrl);
}
return checker;
} } | public class class_name {
private WaitChecker getUrlWaitChecker(String imageConfigDesc,
Properties projectProperties,
WaitConfiguration wait) {
String waitUrl = StrSubstitutor.replace(wait.getUrl(), projectProperties);
WaitConfiguration.HttpConfiguration httpConfig = wait.getHttp();
HttpPingChecker checker;
if (httpConfig != null) {
checker = new HttpPingChecker(waitUrl, httpConfig.getMethod(), httpConfig.getStatus(), httpConfig.isAllowAllHosts()); // depends on control dependency: [if], data = [none]
log.info("%s: Waiting on url %s with method %s for status %s.",
imageConfigDesc, waitUrl, httpConfig.getMethod(), httpConfig.getStatus()); // depends on control dependency: [if], data = [none]
} else {
checker = new HttpPingChecker(waitUrl); // depends on control dependency: [if], data = [none]
log.info("%s: Waiting on url %s.", imageConfigDesc, waitUrl); // depends on control dependency: [if], data = [none]
}
return checker;
} } |
public class class_name {
public static <T extends ImageGray<T>>T average(ImageInterleaved input , T output ) {
ImageDataType type = input.getImageType().getDataType();
if( type == ImageDataType.U8) {
return (T)ConvertImage.average((InterleavedU8)input,(GrayU8)output);
} else if( type == ImageDataType.S8) {
return (T)ConvertImage.average((InterleavedS8)input,(GrayS8)output);
} else if( type == ImageDataType.U16 ) {
return (T)ConvertImage.average((InterleavedU16)input,(GrayU16)output);
} else if( type == ImageDataType.S16 ) {
return (T)ConvertImage.average((InterleavedS16)input,(GrayS16)output);
} else if( type == ImageDataType.S32 ) {
return (T)ConvertImage.average((InterleavedS32)input,(GrayS32)output);
} else if( type == ImageDataType.S64 ) {
return (T)ConvertImage.average((InterleavedS64)input,(GrayS64)output);
} else if( type == ImageDataType.F32 ) {
return (T)ConvertImage.average((InterleavedF32)input,(GrayF32)output);
} else if( type == ImageDataType.F64 ) {
return (T)ConvertImage.average((InterleavedF64)input,(GrayF64)output);
} else {
throw new IllegalArgumentException("Unknown image type: " + type);
}
} } | public class class_name {
public static <T extends ImageGray<T>>T average(ImageInterleaved input , T output ) {
ImageDataType type = input.getImageType().getDataType();
if( type == ImageDataType.U8) {
return (T)ConvertImage.average((InterleavedU8)input,(GrayU8)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.S8) {
return (T)ConvertImage.average((InterleavedS8)input,(GrayS8)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.U16 ) {
return (T)ConvertImage.average((InterleavedU16)input,(GrayU16)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.S16 ) {
return (T)ConvertImage.average((InterleavedS16)input,(GrayS16)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.S32 ) {
return (T)ConvertImage.average((InterleavedS32)input,(GrayS32)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.S64 ) {
return (T)ConvertImage.average((InterleavedS64)input,(GrayS64)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.F32 ) {
return (T)ConvertImage.average((InterleavedF32)input,(GrayF32)output); // depends on control dependency: [if], data = [none]
} else if( type == ImageDataType.F64 ) {
return (T)ConvertImage.average((InterleavedF64)input,(GrayF64)output); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown image type: " + type);
}
} } |
public class class_name {
private void doGetAll() throws PageException {
if (name == null) throw new ApplicationException("attribute name is required for tag registry, when action is [getAll]");
try {
RegistryEntry[] entries = RegistryQuery.getValues(branch, type);
if (entries != null) {
lucee.runtime.type.Query qry = new QueryImpl(new String[] { "entry", "type", "value" }, new String[] { "VARCHAR", "VARCHAR", "OTHER" }, entries.length, "query");
for (int i = 0; i < entries.length; i++) {
RegistryEntry e = entries[i];
int row = i + 1;
qry.setAt(KeyConstants._entry, row, e.getKey());
qry.setAt(KeyConstants._type, row, RegistryEntry.toCFStringType(e.getType()));
qry.setAt(KeyConstants._value, row, e.getValue());
}
// sort
if (sort != null) {
String[] arr = sort.toLowerCase().split(",");
for (int i = arr.length - 1; i >= 0; i--) {
String[] col = arr[i].trim().split("\\s+");
if (col.length == 1) qry.sort(KeyImpl.init(col[0].trim()));
else if (col.length == 2) {
String order = col[1].toLowerCase().trim();
if (order.equals("asc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_ASC);
else if (order.equals("desc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_DESC);
else throw new ApplicationException("invalid order type [" + col[1] + "]");
}
}
}
pageContext.setVariable(name, qry);
}
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} } | public class class_name {
private void doGetAll() throws PageException {
if (name == null) throw new ApplicationException("attribute name is required for tag registry, when action is [getAll]");
try {
RegistryEntry[] entries = RegistryQuery.getValues(branch, type);
if (entries != null) {
lucee.runtime.type.Query qry = new QueryImpl(new String[] { "entry", "type", "value" }, new String[] { "VARCHAR", "VARCHAR", "OTHER" }, entries.length, "query");
for (int i = 0; i < entries.length; i++) {
RegistryEntry e = entries[i];
int row = i + 1;
qry.setAt(KeyConstants._entry, row, e.getKey()); // depends on control dependency: [for], data = [none]
qry.setAt(KeyConstants._type, row, RegistryEntry.toCFStringType(e.getType())); // depends on control dependency: [for], data = [none]
qry.setAt(KeyConstants._value, row, e.getValue()); // depends on control dependency: [for], data = [none]
}
// sort
if (sort != null) {
String[] arr = sort.toLowerCase().split(",");
for (int i = arr.length - 1; i >= 0; i--) {
String[] col = arr[i].trim().split("\\s+");
if (col.length == 1) qry.sort(KeyImpl.init(col[0].trim()));
else if (col.length == 2) {
String order = col[1].toLowerCase().trim();
if (order.equals("asc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_ASC);
else if (order.equals("desc")) qry.sort(KeyImpl.init(col[0]), lucee.runtime.type.Query.ORDER_DESC);
else throw new ApplicationException("invalid order type [" + col[1] + "]");
}
}
}
pageContext.setVariable(name, qry); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} } |
public class class_name {
private List[] findEquatedIdentifiers() {
List[] ans = null;
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(null);
}
else {
Object candValue = cand.getValue();
if (candValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName());
ans[1].add(candValue);
}
}
}
return ans;
} } | public class class_name {
private List[] findEquatedIdentifiers() {
List[] ans = null;
for (int i = 0; i < tmpSimpleTests.size(); i++) {
SimpleTest cand = (SimpleTest) tmpSimpleTests.get(i);
if (cand.getKind() == SimpleTest.NULL) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName()); // depends on control dependency: [if], data = [none]
ans[1].add(null); // depends on control dependency: [if], data = [none]
}
else {
Object candValue = cand.getValue();
if (candValue != null) {
if (ans == null)
ans = new List[] { new ArrayList(), new ArrayList() };
ans[0].add(cand.getIdentifier().getName()); // depends on control dependency: [if], data = [none]
ans[1].add(candValue); // depends on control dependency: [if], data = [(candValue]
}
}
}
return ans;
} } |
public class class_name {
public void removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
if (eventType == null) {
throw new NullPointerException("Argument eventType must not be null");
}
if (eventHandler == null) {
throw new NullPointerException("Argument eventHandler must not be null");
}
List<EventHandler<? super PreferencesFxEvent>> list = this.eventHandlers.get(eventType);
if (list != null) {
list.remove(eventHandler);
}
} } | public class class_name {
public void removeEventHandler(EventType<PreferencesFxEvent> eventType,
EventHandler<? super PreferencesFxEvent> eventHandler) {
if (eventType == null) {
throw new NullPointerException("Argument eventType must not be null");
}
if (eventHandler == null) {
throw new NullPointerException("Argument eventHandler must not be null");
}
List<EventHandler<? super PreferencesFxEvent>> list = this.eventHandlers.get(eventType);
if (list != null) {
list.remove(eventHandler); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object set(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, Object parentPojo, Object value) {
Object result;
String functionName = currentPath.getFunction();
if (functionName != null) {
// current segment is a function...
PojoPathFunction function = getFunction(functionName, context);
Class<?> valueClass = function.getValueClass();
currentPath.pojoClass = valueClass;
Object convertedValue = convert(currentPath, context, value, valueClass, null);
result = function.set(parentPojo, functionName, convertedValue, context);
} else {
// current segment is NOT a function
if (parentPojo instanceof Map) {
Map map = (Map) parentPojo;
String key = currentPath.getSegment();
Object convertedKey = key;
Object convertedValue = value;
if (currentPath.parent != null) {
GenericType<?> mapType = currentPath.parent.pojoType;
if (mapType != null) {
GenericType<?> valueType = mapType.getComponentType();
convertedValue = convert(currentPath, context, value, valueType.getAssignmentClass(), valueType);
GenericType<?> keyType = mapType.getKeyType();
convertedKey = convert(currentPath, context, key, keyType.getAssignmentClass(), keyType);
}
}
result = map.put(convertedKey, convertedValue);
} else {
Integer index = currentPath.getIndex();
if (index != null) {
// handle indexed segment for list or array...
result = setInList(currentPath, context, state, parentPojo, value, index.intValue());
} else {
// in all other cases get via reflection from POJO...
result = setInPojo(currentPath, context, state, parentPojo, value);
}
}
}
return result;
} } | public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object set(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, Object parentPojo, Object value) {
Object result;
String functionName = currentPath.getFunction();
if (functionName != null) {
// current segment is a function...
PojoPathFunction function = getFunction(functionName, context);
Class<?> valueClass = function.getValueClass();
currentPath.pojoClass = valueClass;
Object convertedValue = convert(currentPath, context, value, valueClass, null);
result = function.set(parentPojo, functionName, convertedValue, context);
} else {
// current segment is NOT a function
if (parentPojo instanceof Map) {
Map map = (Map) parentPojo;
String key = currentPath.getSegment();
Object convertedKey = key;
Object convertedValue = value;
if (currentPath.parent != null) {
GenericType<?> mapType = currentPath.parent.pojoType;
if (mapType != null) {
GenericType<?> valueType = mapType.getComponentType();
convertedValue = convert(currentPath, context, value, valueType.getAssignmentClass(), valueType); // depends on control dependency: [if], data = [none]
GenericType<?> keyType = mapType.getKeyType();
convertedKey = convert(currentPath, context, key, keyType.getAssignmentClass(), keyType); // depends on control dependency: [if], data = [none]
}
}
result = map.put(convertedKey, convertedValue);
} else {
Integer index = currentPath.getIndex();
if (index != null) {
// handle indexed segment for list or array...
result = setInList(currentPath, context, state, parentPojo, value, index.intValue()); // depends on control dependency: [if], data = [none]
} else {
// in all other cases get via reflection from POJO...
result = setInPojo(currentPath, context, state, parentPojo, value); // depends on control dependency: [if], data = [none]
}
}
}
return result; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
@Override
public void close() {
LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress);
final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close();
final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close();
final ChannelFuture acceptorFuture = this.acceptor.close();
final ArrayList<Future> eventLoopGroupFutures = new ArrayList<>(3);
eventLoopGroupFutures.add(this.clientWorkerGroup.shutdownGracefully());
eventLoopGroupFutures.add(this.serverBossGroup.shutdownGracefully());
eventLoopGroupFutures.add(this.serverWorkerGroup.shutdownGracefully());
clientChannelGroupFuture.awaitUninterruptibly();
serverChannelGroupFuture.awaitUninterruptibly();
try {
acceptorFuture.sync();
} catch (final Exception ex) {
LOG.log(Level.SEVERE, "Error closing the acceptor channel for " + this.localAddress, ex);
}
for (final Future eventLoopGroupFuture : eventLoopGroupFutures) {
eventLoopGroupFuture.awaitUninterruptibly();
}
LOG.log(Level.FINE, "Closing netty transport socket address: {0} done", this.localAddress);
} } | public class class_name {
@Override
public void close() {
LOG.log(Level.FINE, "Closing netty transport socket address: {0}", this.localAddress);
final ChannelGroupFuture clientChannelGroupFuture = this.clientChannelGroup.close();
final ChannelGroupFuture serverChannelGroupFuture = this.serverChannelGroup.close();
final ChannelFuture acceptorFuture = this.acceptor.close();
final ArrayList<Future> eventLoopGroupFutures = new ArrayList<>(3);
eventLoopGroupFutures.add(this.clientWorkerGroup.shutdownGracefully());
eventLoopGroupFutures.add(this.serverBossGroup.shutdownGracefully());
eventLoopGroupFutures.add(this.serverWorkerGroup.shutdownGracefully());
clientChannelGroupFuture.awaitUninterruptibly();
serverChannelGroupFuture.awaitUninterruptibly();
try {
acceptorFuture.sync(); // depends on control dependency: [try], data = [none]
} catch (final Exception ex) {
LOG.log(Level.SEVERE, "Error closing the acceptor channel for " + this.localAddress, ex);
} // depends on control dependency: [catch], data = [none]
for (final Future eventLoopGroupFuture : eventLoopGroupFutures) {
eventLoopGroupFuture.awaitUninterruptibly(); // depends on control dependency: [for], data = [eventLoopGroupFuture]
}
LOG.log(Level.FINE, "Closing netty transport socket address: {0} done", this.localAddress);
} } |
public class class_name {
public static String getClassType(Class expectedType) {
String classType = expectedType.getName();
if (expectedType.isPrimitive()) {
if (expectedType.equals(Boolean.TYPE)) {
classType = Boolean.class.getName();
}
else if (expectedType.equals(Byte.TYPE)) {
classType = Byte.class.getName();
}
else if (expectedType.equals(Character.TYPE)) {
classType = Character.class.getName();
}
else if (expectedType.equals(Short.TYPE)) {
classType = Short.class.getName();
}
else if (expectedType.equals(Integer.TYPE)) {
classType = Integer.class.getName();
}
else if (expectedType.equals(Long.TYPE)) {
classType = Long.class.getName();
}
else if (expectedType.equals(Float.TYPE)) {
classType = Float.class.getName();
}
else if (expectedType.equals(Double.TYPE)) {
classType = Double.class.getName();
}
}
classType = toJavaSourceType(classType);
return classType;
} } | public class class_name {
public static String getClassType(Class expectedType) {
String classType = expectedType.getName();
if (expectedType.isPrimitive()) {
if (expectedType.equals(Boolean.TYPE)) {
classType = Boolean.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Byte.TYPE)) {
classType = Byte.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Character.TYPE)) {
classType = Character.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Short.TYPE)) {
classType = Short.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Integer.TYPE)) {
classType = Integer.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Long.TYPE)) {
classType = Long.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Float.TYPE)) {
classType = Float.class.getName(); // depends on control dependency: [if], data = [none]
}
else if (expectedType.equals(Double.TYPE)) {
classType = Double.class.getName(); // depends on control dependency: [if], data = [none]
}
}
classType = toJavaSourceType(classType);
return classType;
} } |
public class class_name {
public java.util.List<StaleSecurityGroup> getStaleSecurityGroupSet() {
if (staleSecurityGroupSet == null) {
staleSecurityGroupSet = new com.amazonaws.internal.SdkInternalList<StaleSecurityGroup>();
}
return staleSecurityGroupSet;
} } | public class class_name {
public java.util.List<StaleSecurityGroup> getStaleSecurityGroupSet() {
if (staleSecurityGroupSet == null) {
staleSecurityGroupSet = new com.amazonaws.internal.SdkInternalList<StaleSecurityGroup>(); // depends on control dependency: [if], data = [none]
}
return staleSecurityGroupSet;
} } |
public class class_name {
public static <T extends Comparable<T>> RangeSet<T> unionRangeSets(final Iterable<RangeSet<T>> rangeSets)
{
final RangeSet<T> rangeSet = TreeRangeSet.create();
for (RangeSet<T> set : rangeSets) {
rangeSet.addAll(set);
}
return rangeSet;
} } | public class class_name {
public static <T extends Comparable<T>> RangeSet<T> unionRangeSets(final Iterable<RangeSet<T>> rangeSets)
{
final RangeSet<T> rangeSet = TreeRangeSet.create();
for (RangeSet<T> set : rangeSets) {
rangeSet.addAll(set); // depends on control dependency: [for], data = [set]
}
return rangeSet;
} } |
public class class_name {
@Override
public Set<ScriptArchive> getScriptArchives(Set<ModuleId> moduleIds) throws IOException {
Set<ScriptArchive> archives = new LinkedHashSet<ScriptArchive>(moduleIds.size()*2);
Path archiveOuputDir = getConfig().getArchiveOutputDirectory();
List<ModuleId> moduleIdList = new LinkedList<ModuleId>(moduleIds);
int batchSize = getConfig().getArchiveFetchBatchSize();
int start = 0;
try {
while (start < moduleIdList.size()) {
int end = Math.min(moduleIdList.size(), start + batchSize);
List<ModuleId> batchModuleIds = moduleIdList.subList(start, end);
List<String> rowKeys = new ArrayList<String>(batchModuleIds.size());
for (ModuleId batchModuleId:batchModuleIds) {
rowKeys.add(batchModuleId.toString());
}
Rows<String, String> rows = cassandra.getRows(rowKeys.toArray(new String[0]));
for (Row<String, String> row : rows) {
String moduleId = row.getKey();
ColumnList<String> columns = row.getColumns();
Column<String> lastUpdateColumn = columns.getColumnByName(Columns.last_update.name());
Column<String> hashColumn = columns.getColumnByName(Columns.archive_content_hash.name());
Column<String> contentColumn = columns.getColumnByName(Columns.archive_content.name());
if (lastUpdateColumn == null || hashColumn == null || contentColumn == null) {
continue;
}
ScriptModuleSpec moduleSpec = getModuleSpec(columns);
long lastUpdateTime = lastUpdateColumn.getLongValue();
byte[] hash = hashColumn.getByteArrayValue();
byte[] content = contentColumn.getByteArrayValue();
// verify the hash
if (hash != null && hash.length > 0 && !verifyHash(hash, content)) {
logger.warn("Content hash validation failed for moduleId {}. size: {}", moduleId, content.length);
continue;
}
String fileName = new StringBuilder().append(moduleId).append("-").append(lastUpdateTime).append(".jar").toString();
Path jarFile = archiveOuputDir.resolve(fileName);
Files.write(jarFile, content);
JarScriptArchive scriptArchive = new JarScriptArchive.Builder(jarFile)
.setModuleSpec(moduleSpec)
.setCreateTime(lastUpdateTime)
.build();
archives.add(scriptArchive);
}
start = end;
}
} catch (Exception e) {
throw new IOException(e);
}
return archives;
} } | public class class_name {
@Override
public Set<ScriptArchive> getScriptArchives(Set<ModuleId> moduleIds) throws IOException {
Set<ScriptArchive> archives = new LinkedHashSet<ScriptArchive>(moduleIds.size()*2);
Path archiveOuputDir = getConfig().getArchiveOutputDirectory();
List<ModuleId> moduleIdList = new LinkedList<ModuleId>(moduleIds);
int batchSize = getConfig().getArchiveFetchBatchSize();
int start = 0;
try {
while (start < moduleIdList.size()) {
int end = Math.min(moduleIdList.size(), start + batchSize);
List<ModuleId> batchModuleIds = moduleIdList.subList(start, end);
List<String> rowKeys = new ArrayList<String>(batchModuleIds.size());
for (ModuleId batchModuleId:batchModuleIds) {
rowKeys.add(batchModuleId.toString()); // depends on control dependency: [for], data = [batchModuleId]
}
Rows<String, String> rows = cassandra.getRows(rowKeys.toArray(new String[0]));
for (Row<String, String> row : rows) {
String moduleId = row.getKey();
ColumnList<String> columns = row.getColumns();
Column<String> lastUpdateColumn = columns.getColumnByName(Columns.last_update.name());
Column<String> hashColumn = columns.getColumnByName(Columns.archive_content_hash.name());
Column<String> contentColumn = columns.getColumnByName(Columns.archive_content.name());
if (lastUpdateColumn == null || hashColumn == null || contentColumn == null) {
continue;
}
ScriptModuleSpec moduleSpec = getModuleSpec(columns);
long lastUpdateTime = lastUpdateColumn.getLongValue();
byte[] hash = hashColumn.getByteArrayValue();
byte[] content = contentColumn.getByteArrayValue();
// verify the hash
if (hash != null && hash.length > 0 && !verifyHash(hash, content)) {
logger.warn("Content hash validation failed for moduleId {}. size: {}", moduleId, content.length); // depends on control dependency: [if], data = [none]
continue;
}
String fileName = new StringBuilder().append(moduleId).append("-").append(lastUpdateTime).append(".jar").toString();
Path jarFile = archiveOuputDir.resolve(fileName);
Files.write(jarFile, content); // depends on control dependency: [for], data = [none]
JarScriptArchive scriptArchive = new JarScriptArchive.Builder(jarFile)
.setModuleSpec(moduleSpec)
.setCreateTime(lastUpdateTime)
.build();
archives.add(scriptArchive); // depends on control dependency: [for], data = [none]
}
start = end; // depends on control dependency: [while], data = [none]
}
} catch (Exception e) {
throw new IOException(e);
}
return archives;
} } |
public class class_name {
private <T extends Snippet> Stream<T> argsOptionsToSnippets(Supplier<Stream<T>> snippetSupplier,
Predicate<Snippet> defFilter, String rawargs, String cmd) {
ArgTokenizer at = new ArgTokenizer(cmd, rawargs.trim());
at.allowedOptions("-all", "-start");
List<String> args = new ArrayList<>();
String s;
while ((s = at.next()) != null) {
args.add(s);
}
if (!checkOptionsAndRemainingInput(at)) {
return null;
}
if (at.optionCount() > 0 && args.size() > 0) {
errormsg("jshell.err.may.not.specify.options.and.snippets", at.whole());
return null;
}
if (at.optionCount() > 1) {
errormsg("jshell.err.conflicting.options", at.whole());
return null;
}
if (at.hasOption("-all")) {
// all snippets including start-up, failed, and overwritten
return snippetSupplier.get();
}
if (at.hasOption("-start")) {
// start-up snippets
return snippetSupplier.get()
.filter(this::inStartUp);
}
if (args.isEmpty()) {
// Default is all active user snippets
return snippetSupplier.get()
.filter(defFilter);
}
return argsToSnippets(snippetSupplier, args);
} } | public class class_name {
private <T extends Snippet> Stream<T> argsOptionsToSnippets(Supplier<Stream<T>> snippetSupplier,
Predicate<Snippet> defFilter, String rawargs, String cmd) {
ArgTokenizer at = new ArgTokenizer(cmd, rawargs.trim());
at.allowedOptions("-all", "-start");
List<String> args = new ArrayList<>();
String s;
while ((s = at.next()) != null) {
args.add(s); // depends on control dependency: [while], data = [none]
}
if (!checkOptionsAndRemainingInput(at)) {
return null; // depends on control dependency: [if], data = [none]
}
if (at.optionCount() > 0 && args.size() > 0) {
errormsg("jshell.err.may.not.specify.options.and.snippets", at.whole()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (at.optionCount() > 1) {
errormsg("jshell.err.conflicting.options", at.whole()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (at.hasOption("-all")) {
// all snippets including start-up, failed, and overwritten
return snippetSupplier.get(); // depends on control dependency: [if], data = [none]
}
if (at.hasOption("-start")) {
// start-up snippets
return snippetSupplier.get()
.filter(this::inStartUp); // depends on control dependency: [if], data = [none]
}
if (args.isEmpty()) {
// Default is all active user snippets
return snippetSupplier.get()
.filter(defFilter); // depends on control dependency: [if], data = [none]
}
return argsToSnippets(snippetSupplier, args);
} } |
public class class_name {
public AxisAngle4f set(Matrix3fc m) {
double nm00 = m.m00(), nm01 = m.m01(), nm02 = m.m02();
double nm10 = m.m10(), nm11 = m.m11(), nm12 = m.m12();
double nm20 = m.m20(), nm21 = m.m21(), nm22 = m.m22();
double lenX = 1.0 / Math.sqrt(m.m00() * m.m00() + m.m01() * m.m01() + m.m02() * m.m02());
double lenY = 1.0 / Math.sqrt(m.m10() * m.m10() + m.m11() * m.m11() + m.m12() * m.m12());
double lenZ = 1.0 / Math.sqrt(m.m20() * m.m20() + m.m21() * m.m21() + m.m22() * m.m22());
nm00 *= lenX; nm01 *= lenX; nm02 *= lenX;
nm10 *= lenY; nm11 *= lenY; nm12 *= lenY;
nm20 *= lenZ; nm21 *= lenZ; nm22 *= lenZ;
double epsilon = 1E-4;
if ((Math.abs(nm10 - nm01) < epsilon) && (Math.abs(nm20 - nm02) < epsilon) && (Math.abs(nm21 - nm12) < epsilon)) {
angle = (float) Math.PI;
double xx = (nm00 + 1) / 2;
double yy = (nm11 + 1) / 2;
double zz = (nm22 + 1) / 2;
double xy = (nm10 + nm01) / 4;
double xz = (nm20 + nm02) / 4;
double yz = (nm21 + nm12) / 4;
if ((xx > yy) && (xx > zz)) {
x = (float) Math.sqrt(xx);
y = (float) (xy / x);
z = (float) (xz / x);
} else if (yy > zz) {
y = (float) Math.sqrt(yy);
x = (float) (xy / y);
z = (float) (yz / y);
} else {
z = (float) Math.sqrt(zz);
x = (float) (xz / z);
y = (float) (yz / z);
}
return this;
}
double s = Math.sqrt((nm12 - nm21) * (nm12 - nm21) + (nm20 - nm02) * (nm20 - nm02) + (nm01 - nm10) * (nm01 - nm10));
angle = (float) safeAcos((nm00 + nm11 + nm22 - 1) / 2);
x = (float) ((nm12 - nm21) / s);
y = (float) ((nm20 - nm02) / s);
z = (float) ((nm01 - nm10) / s);
return this;
} } | public class class_name {
public AxisAngle4f set(Matrix3fc m) {
double nm00 = m.m00(), nm01 = m.m01(), nm02 = m.m02();
double nm10 = m.m10(), nm11 = m.m11(), nm12 = m.m12();
double nm20 = m.m20(), nm21 = m.m21(), nm22 = m.m22();
double lenX = 1.0 / Math.sqrt(m.m00() * m.m00() + m.m01() * m.m01() + m.m02() * m.m02());
double lenY = 1.0 / Math.sqrt(m.m10() * m.m10() + m.m11() * m.m11() + m.m12() * m.m12());
double lenZ = 1.0 / Math.sqrt(m.m20() * m.m20() + m.m21() * m.m21() + m.m22() * m.m22());
nm00 *= lenX; nm01 *= lenX; nm02 *= lenX;
nm10 *= lenY; nm11 *= lenY; nm12 *= lenY;
nm20 *= lenZ; nm21 *= lenZ; nm22 *= lenZ;
double epsilon = 1E-4;
if ((Math.abs(nm10 - nm01) < epsilon) && (Math.abs(nm20 - nm02) < epsilon) && (Math.abs(nm21 - nm12) < epsilon)) {
angle = (float) Math.PI; // depends on control dependency: [if], data = [none]
double xx = (nm00 + 1) / 2;
double yy = (nm11 + 1) / 2;
double zz = (nm22 + 1) / 2;
double xy = (nm10 + nm01) / 4;
double xz = (nm20 + nm02) / 4;
double yz = (nm21 + nm12) / 4;
if ((xx > yy) && (xx > zz)) {
x = (float) Math.sqrt(xx); // depends on control dependency: [if], data = [none]
y = (float) (xy / x); // depends on control dependency: [if], data = [none]
z = (float) (xz / x); // depends on control dependency: [if], data = [none]
} else if (yy > zz) {
y = (float) Math.sqrt(yy); // depends on control dependency: [if], data = [(yy]
x = (float) (xy / y); // depends on control dependency: [if], data = [none]
z = (float) (yz / y); // depends on control dependency: [if], data = [none]
} else {
z = (float) Math.sqrt(zz); // depends on control dependency: [if], data = [zz)]
x = (float) (xz / z); // depends on control dependency: [if], data = [none]
y = (float) (yz / z); // depends on control dependency: [if], data = [none]
}
return this; // depends on control dependency: [if], data = [none]
}
double s = Math.sqrt((nm12 - nm21) * (nm12 - nm21) + (nm20 - nm02) * (nm20 - nm02) + (nm01 - nm10) * (nm01 - nm10));
angle = (float) safeAcos((nm00 + nm11 + nm22 - 1) / 2);
x = (float) ((nm12 - nm21) / s);
y = (float) ((nm20 - nm02) / s);
z = (float) ((nm01 - nm10) / s);
return this;
} } |
public class class_name {
public boolean isArtefact(@SuppressWarnings("rawtypes") Class theClazz) {
String className = theClazz.getName();
for (Class<?> artefactClass : allArtefactClasses) {
if (className.equals(artefactClass.getName())) {
return true;
}
}
return false;
} } | public class class_name {
public boolean isArtefact(@SuppressWarnings("rawtypes") Class theClazz) {
String className = theClazz.getName();
for (Class<?> artefactClass : allArtefactClasses) {
if (className.equals(artefactClass.getName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public int getInteger(final int index) {
try {
return statement.getInt(index);
} catch (SQLException sex) {
throw newGetParamError(index, sex);
}
} } | public class class_name {
public int getInteger(final int index) {
try {
return statement.getInt(index); // depends on control dependency: [try], data = [none]
} catch (SQLException sex) {
throw newGetParamError(index, sex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static base_responses create(nitro_service client, sslcrl resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslcrl createresources[] = new sslcrl[resources.length];
for (int i=0;i<resources.length;i++){
createresources[i] = new sslcrl();
createresources[i].cacertfile = resources[i].cacertfile;
createresources[i].cakeyfile = resources[i].cakeyfile;
createresources[i].indexfile = resources[i].indexfile;
createresources[i].revoke = resources[i].revoke;
createresources[i].gencrl = resources[i].gencrl;
createresources[i].password = resources[i].password;
}
result = perform_operation_bulk_request(client, createresources,"create");
}
return result;
} } | public class class_name {
public static base_responses create(nitro_service client, sslcrl resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslcrl createresources[] = new sslcrl[resources.length];
for (int i=0;i<resources.length;i++){
createresources[i] = new sslcrl(); // depends on control dependency: [for], data = [i]
createresources[i].cacertfile = resources[i].cacertfile; // depends on control dependency: [for], data = [i]
createresources[i].cakeyfile = resources[i].cakeyfile; // depends on control dependency: [for], data = [i]
createresources[i].indexfile = resources[i].indexfile; // depends on control dependency: [for], data = [i]
createresources[i].revoke = resources[i].revoke; // depends on control dependency: [for], data = [i]
createresources[i].gencrl = resources[i].gencrl; // depends on control dependency: [for], data = [i]
createresources[i].password = resources[i].password; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, createresources,"create");
}
return result;
} } |
public class class_name {
public static double cdf(double x, double k, double theta, double shift) {
if(x == Double.NEGATIVE_INFINITY) {
return 0.;
}
if(x == Double.POSITIVE_INFINITY) {
return 1.;
}
if(x != x) {
return Double.NaN;
}
final double e = FastMath.exp((x - shift) * theta);
return e < Double.POSITIVE_INFINITY ? GammaDistribution.regularizedGammaP(k, e) : 1.;
} } | public class class_name {
public static double cdf(double x, double k, double theta, double shift) {
if(x == Double.NEGATIVE_INFINITY) {
return 0.; // depends on control dependency: [if], data = [none]
}
if(x == Double.POSITIVE_INFINITY) {
return 1.; // depends on control dependency: [if], data = [none]
}
if(x != x) {
return Double.NaN; // depends on control dependency: [if], data = [none]
}
final double e = FastMath.exp((x - shift) * theta);
return e < Double.POSITIVE_INFINITY ? GammaDistribution.regularizedGammaP(k, e) : 1.;
} } |
public class class_name {
public void updateChangeLog(final Principal user, final Verb verb, final String object) {
if ((Settings.ChangelogEnabled.getValue() || Settings.UserChangelogEnabled.getValue())) {
final JsonObject obj = new JsonObject();
obj.add("time", toElement(System.currentTimeMillis()));
if (user != null) {
obj.add("userId", toElement(user.getUuid()));
obj.add("userName", toElement(user.getName()));
} else {
obj.add("userId", JsonNull.INSTANCE);
obj.add("userName", JsonNull.INSTANCE);
}
obj.add("verb", toElement(verb));
obj.add("target", toElement(object));
if (Settings.ChangelogEnabled.getValue()) {
if (changeLog.length() > 0 && verb.equals(Verb.create)) {
// ensure that node creation appears first in the log
changeLog.insert(0, "\n");
changeLog.insert(0, obj.toString());
} else {
changeLog.append(obj.toString());
changeLog.append("\n");
}
}
if (Settings.UserChangelogEnabled.getValue() && user != null) {
// remove user for user-centric logging to reduce redundancy
obj.remove("userId");
obj.remove("userName");
appendUserChangelog(user.getUuid(), obj.toString());
}
}
} } | public class class_name {
public void updateChangeLog(final Principal user, final Verb verb, final String object) {
if ((Settings.ChangelogEnabled.getValue() || Settings.UserChangelogEnabled.getValue())) {
final JsonObject obj = new JsonObject();
obj.add("time", toElement(System.currentTimeMillis())); // depends on control dependency: [if], data = [none]
if (user != null) {
obj.add("userId", toElement(user.getUuid())); // depends on control dependency: [if], data = [(user]
obj.add("userName", toElement(user.getName())); // depends on control dependency: [if], data = [(user]
} else {
obj.add("userId", JsonNull.INSTANCE); // depends on control dependency: [if], data = [none]
obj.add("userName", JsonNull.INSTANCE); // depends on control dependency: [if], data = [none]
}
obj.add("verb", toElement(verb)); // depends on control dependency: [if], data = [none]
obj.add("target", toElement(object)); // depends on control dependency: [if], data = [none]
if (Settings.ChangelogEnabled.getValue()) {
if (changeLog.length() > 0 && verb.equals(Verb.create)) {
// ensure that node creation appears first in the log
changeLog.insert(0, "\n"); // depends on control dependency: [if], data = [none]
changeLog.insert(0, obj.toString()); // depends on control dependency: [if], data = [none]
} else {
changeLog.append(obj.toString()); // depends on control dependency: [if], data = [none]
changeLog.append("\n"); // depends on control dependency: [if], data = [none]
}
}
if (Settings.UserChangelogEnabled.getValue() && user != null) {
// remove user for user-centric logging to reduce redundancy
obj.remove("userId"); // depends on control dependency: [if], data = [none]
obj.remove("userName"); // depends on control dependency: [if], data = [none]
appendUserChangelog(user.getUuid(), obj.toString()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public double magnitude() {
if (magnitude < 0) {
magnitude = 0;
TDoubleIterator iter = vector.valueCollection().iterator();
while (iter.hasNext()) {
double d = iter.next();
magnitude += d*d;
}
magnitude = Math.sqrt(magnitude);
}
return magnitude;
} } | public class class_name {
public double magnitude() {
if (magnitude < 0) {
magnitude = 0; // depends on control dependency: [if], data = [none]
TDoubleIterator iter = vector.valueCollection().iterator();
while (iter.hasNext()) {
double d = iter.next();
magnitude += d*d; // depends on control dependency: [while], data = [none]
}
magnitude = Math.sqrt(magnitude); // depends on control dependency: [if], data = [(magnitude]
}
return magnitude;
} } |
public class class_name {
public void run(Object job) throws InterruptedException
{
if(job==null)
return;
try
{
PoolThread thread=(PoolThread)_pool.get(getMaxIdleTimeMs());
if(thread!=null)
thread.run(this,job);
else
{
log.warn("No thread for "+job);
stopJob(null,job);
}
}
catch(InterruptedException e)
{
throw e;
}
catch(Exception e)
{
log.warn(LogSupport.EXCEPTION,e);
}
} } | public class class_name {
public void run(Object job) throws InterruptedException
{
if(job==null)
return;
try
{
PoolThread thread=(PoolThread)_pool.get(getMaxIdleTimeMs());
if(thread!=null)
thread.run(this,job);
else
{
log.warn("No thread for "+job); // depends on control dependency: [if], data = [none]
stopJob(null,job); // depends on control dependency: [if], data = [none]
}
}
catch(InterruptedException e)
{
throw e;
}
catch(Exception e)
{
log.warn(LogSupport.EXCEPTION,e);
}
} } |
public class class_name {
public void shutdown() {
for (ShutdownListener shutdownListener : shutdownListeners) {
try {
shutdownListener.shutdown();
} catch(Exception e) {
LOGGER.severe("failed shutdown"+e.getMessage());
}
}
} } | public class class_name {
public void shutdown() {
for (ShutdownListener shutdownListener : shutdownListeners) {
try {
shutdownListener.shutdown(); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
LOGGER.severe("failed shutdown"+e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public WebDriverExecutor getWebDriverExecutor() {
if (webDriverExecutor == null) {
if (webDriverProvider == null) {
webDriverExecutor = new WebDriverExecutor();
} else {
webDriverExecutor = new WebDriverExecutor(webDriverProvider);
}
}
return webDriverExecutor;
} } | public class class_name {
public WebDriverExecutor getWebDriverExecutor() {
if (webDriverExecutor == null) {
if (webDriverProvider == null) {
webDriverExecutor = new WebDriverExecutor(); // depends on control dependency: [if], data = [none]
} else {
webDriverExecutor = new WebDriverExecutor(webDriverProvider); // depends on control dependency: [if], data = [(webDriverProvider]
}
}
return webDriverExecutor;
} } |
public class class_name {
private boolean adjustLabels()
{
Iterator<GridCluster> gridClusIter = this.cluster_list.iterator();
// a. For each cluster c
while (gridClusIter.hasNext())
{
GridCluster c = gridClusIter.next();
//System.out.print("Adjusting from cluster "+c.getClusterLabel()+", standby...");
// b. for each grid, dg, of c
for (Map.Entry<DensityGrid, Boolean> grid : c.getGrids().entrySet())
{
DensityGrid dg = grid.getKey();
Boolean inside = grid.getValue();
//System.out.print(" Inspecting density grid, dg:"+dg.toString()+", standby...");
// b. for each OUTSIDE grid, dg, of c
if (!inside)
{
//System.out.println(" Density grid dg is outside!");
// c. for each neighbouring grid, dgprime, of dg
Iterator<DensityGrid> dgNeighbourhood = dg.getNeighbours().iterator();
while(dgNeighbourhood.hasNext())
{
DensityGrid dgprime = dgNeighbourhood.next();
//System.out.print("Inspecting neighbour, dgprime:"+dgprime.toString()+", standby...");
if(this.grid_list.containsKey(dgprime))
{
CharacteristicVector cv1 = this.grid_list.get(dg);
CharacteristicVector cv2 = this.grid_list.get(dgprime);
//System.out.print(" 1: "+cv1.toString()+", 2: "+cv2.toString());
int class1 = cv1.getLabel();
int class2 = cv2.getLabel();
//System.out.println(" // classes "+class1+" and "+class2+".");
// ...and if dgprime isn't already in the same cluster as dg...
if (class1 != class2)
{
// If dgprime is in cluster c', merge c and c' into the larger of the two
if (class2 != NO_CLASS)
{
//System.out.println("C is "+class1+" and C' is "+class2+".");
if (this.cluster_list.get(class1).getWeight() < this.cluster_list.get(class2).getWeight())
mergeClusters(class1, class2);
else
mergeClusters(class2, class1);
return true;
}
// If dgprime is transitional and outside of c, assign it to c
else if (cv2.isTransitional(dm, dl))
{
//System.out.println("h is transitional and is assigned to cluster "+class1);
cv2.setLabel(class1);
c.addGrid(dgprime);
this.cluster_list.set(class1, c);
this.grid_list.put(dg, cv2);
return true;
}
}
}
}
}
}
}
return false;
} } | public class class_name {
private boolean adjustLabels()
{
Iterator<GridCluster> gridClusIter = this.cluster_list.iterator();
// a. For each cluster c
while (gridClusIter.hasNext())
{
GridCluster c = gridClusIter.next();
//System.out.print("Adjusting from cluster "+c.getClusterLabel()+", standby...");
// b. for each grid, dg, of c
for (Map.Entry<DensityGrid, Boolean> grid : c.getGrids().entrySet())
{
DensityGrid dg = grid.getKey();
Boolean inside = grid.getValue();
//System.out.print(" Inspecting density grid, dg:"+dg.toString()+", standby...");
// b. for each OUTSIDE grid, dg, of c
if (!inside)
{
//System.out.println(" Density grid dg is outside!");
// c. for each neighbouring grid, dgprime, of dg
Iterator<DensityGrid> dgNeighbourhood = dg.getNeighbours().iterator();
while(dgNeighbourhood.hasNext())
{
DensityGrid dgprime = dgNeighbourhood.next();
//System.out.print("Inspecting neighbour, dgprime:"+dgprime.toString()+", standby...");
if(this.grid_list.containsKey(dgprime))
{
CharacteristicVector cv1 = this.grid_list.get(dg);
CharacteristicVector cv2 = this.grid_list.get(dgprime);
//System.out.print(" 1: "+cv1.toString()+", 2: "+cv2.toString());
int class1 = cv1.getLabel();
int class2 = cv2.getLabel();
//System.out.println(" // classes "+class1+" and "+class2+".");
// ...and if dgprime isn't already in the same cluster as dg...
if (class1 != class2)
{
// If dgprime is in cluster c', merge c and c' into the larger of the two
if (class2 != NO_CLASS)
{
//System.out.println("C is "+class1+" and C' is "+class2+".");
if (this.cluster_list.get(class1).getWeight() < this.cluster_list.get(class2).getWeight())
mergeClusters(class1, class2);
else
mergeClusters(class2, class1);
return true; // depends on control dependency: [if], data = [none]
}
// If dgprime is transitional and outside of c, assign it to c
else if (cv2.isTransitional(dm, dl))
{
//System.out.println("h is transitional and is assigned to cluster "+class1);
cv2.setLabel(class1); // depends on control dependency: [if], data = [none]
c.addGrid(dgprime); // depends on control dependency: [if], data = [none]
this.cluster_list.set(class1, c); // depends on control dependency: [if], data = [none]
this.grid_list.put(dg, cv2); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
}
return false;
} } |
public class class_name {
private void processJournal() throws IOException {
FileUtils.deleteIfExists(mJournalFileTmp);
for (Iterator<CacheEntry> i = mLruEntries.values().iterator(); i.hasNext(); ) {
CacheEntry cacheEntry = i.next();
if (!cacheEntry.isUnderEdit()) {
mSize += cacheEntry.getSize();
} else {
cacheEntry.delete();
i.remove();
}
}
} } | public class class_name {
private void processJournal() throws IOException {
FileUtils.deleteIfExists(mJournalFileTmp);
for (Iterator<CacheEntry> i = mLruEntries.values().iterator(); i.hasNext(); ) {
CacheEntry cacheEntry = i.next();
if (!cacheEntry.isUnderEdit()) {
mSize += cacheEntry.getSize(); // depends on control dependency: [if], data = [none]
} else {
cacheEntry.delete(); // depends on control dependency: [if], data = [none]
i.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public CatalogBuilder makeCatalogBuilder() {
CatalogBuilder builder = new CatalogBuilder(this);
for (Dataset ds : getDatasetsLocal()) {
builder.addDataset(makeDatasetBuilder(null, ds));
}
return builder;
} } | public class class_name {
public CatalogBuilder makeCatalogBuilder() {
CatalogBuilder builder = new CatalogBuilder(this);
for (Dataset ds : getDatasetsLocal()) {
builder.addDataset(makeDatasetBuilder(null, ds)); // depends on control dependency: [for], data = [ds]
}
return builder;
} } |
public class class_name {
private void setStylePinBox(EditText editText) {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)});
if (mMaskPassword) {
editText.setTransformationMethod(PasswordTransformationMethod.getInstance());
}
else{
editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
}
if (mNativePinBox) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
//noinspection deprecation
editText.setBackgroundDrawable(new EditText(getContext()).getBackground());
} else {
editText.setBackground(new EditText(getContext()).getBackground());
}
} else {
editText.setBackgroundResource(mCustomDrawablePinBox);
}
if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) {
editText.setTextColor(mColorTextPinBoxes);
}
editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes));
} } | public class class_name {
private void setStylePinBox(EditText editText) {
editText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(mNumberCharacters)});
if (mMaskPassword) {
editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); // depends on control dependency: [if], data = [none]
}
else{
editText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); // depends on control dependency: [if], data = [none]
}
if (mNativePinBox) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
//noinspection deprecation
editText.setBackgroundDrawable(new EditText(getContext()).getBackground()); // depends on control dependency: [if], data = [none]
} else {
editText.setBackground(new EditText(getContext()).getBackground()); // depends on control dependency: [if], data = [none]
}
} else {
editText.setBackgroundResource(mCustomDrawablePinBox); // depends on control dependency: [if], data = [none]
}
if (mColorTextPinBoxes != PinViewSettings.DEFAULT_TEXT_COLOR_PIN_BOX) {
editText.setTextColor(mColorTextPinBoxes); // depends on control dependency: [if], data = [(mColorTextPinBoxes]
}
editText.setTextSize(PinViewUtils.convertPixelToDp(getContext(), mTextSizePinBoxes));
} } |
public class class_name {
int dumprarcs(Arc a, State s, int pos, StringBuilder sb) {
if (a.outchain != null) {
pos = dumprarcs(a.outchain, s, pos, sb);
}
dumparc(a, s, sb);
if (pos == 5) {
sb.append("\n");
pos = 1;
} else {
pos++;
}
return pos;
} } | public class class_name {
int dumprarcs(Arc a, State s, int pos, StringBuilder sb) {
if (a.outchain != null) {
pos = dumprarcs(a.outchain, s, pos, sb); // depends on control dependency: [if], data = [(a.outchain]
}
dumparc(a, s, sb);
if (pos == 5) {
sb.append("\n"); // depends on control dependency: [if], data = [none]
pos = 1; // depends on control dependency: [if], data = [none]
} else {
pos++; // depends on control dependency: [if], data = [none]
}
return pos;
} } |
public class class_name {
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
final String[] data = issue.getData();
if (data != null && data.length > 0) {
final String expectedType = data[0];
final ReturnTypeReplaceModification modification = new ReturnTypeReplaceModification(expectedType);
modification.setIssue(issue);
modification.setTools(provider);
acceptor.accept(issue,
MessageFormat.format(Messages.SARLQuickfixProvider_15, expectedType),
Messages.SARLQuickfixProvider_16,
JavaPluginImages.IMG_CORRECTION_CHANGE,
modification,
IProposalRelevance.CHANGE_RETURN_TYPE);
}
} } | public class class_name {
public static void accept(SARLQuickfixProvider provider, Issue issue, IssueResolutionAcceptor acceptor) {
final String[] data = issue.getData();
if (data != null && data.length > 0) {
final String expectedType = data[0];
final ReturnTypeReplaceModification modification = new ReturnTypeReplaceModification(expectedType);
modification.setIssue(issue); // depends on control dependency: [if], data = [none]
modification.setTools(provider); // depends on control dependency: [if], data = [none]
acceptor.accept(issue,
MessageFormat.format(Messages.SARLQuickfixProvider_15, expectedType),
Messages.SARLQuickfixProvider_16,
JavaPluginImages.IMG_CORRECTION_CHANGE,
modification,
IProposalRelevance.CHANGE_RETURN_TYPE); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.