code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static double getDistance(LineString tripGeometry) {
double distance = 0;
for (int i = 0; i < tripGeometry.getNumPoints() - 1; i++) {
try {
distance += JTS.orthodromicDistance(tripGeometry.getCoordinateN(i), tripGeometry.getCoordinateN(i + 1), DefaultGeographicCRS.WGS84);
} catch (TransformException e) {
throw new RuntimeException(e);
}
}
return distance;
} } | public class class_name {
public static double getDistance(LineString tripGeometry) {
double distance = 0;
for (int i = 0; i < tripGeometry.getNumPoints() - 1; i++) {
try {
distance += JTS.orthodromicDistance(tripGeometry.getCoordinateN(i), tripGeometry.getCoordinateN(i + 1), DefaultGeographicCRS.WGS84); // depends on control dependency: [try], data = [none]
} catch (TransformException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
return distance;
} } |
public class class_name {
@Override
public RestartEvaluators getPreviousEvaluators() {
final RestartEvaluators.Builder restartEvaluatorsBuilder = RestartEvaluators.newBuilder();
this.initializeListOfPreviousContainers();
if (this.previousContainers != null && !this.previousContainers.isEmpty()) {
LOG.log(Level.INFO, "Driver restarted, with {0} previous containers", this.previousContainers.size());
final Set<String> expectedContainers = this.evaluatorPreserver.recoverEvaluators();
final int numExpectedContainers = expectedContainers.size();
final int numPreviousContainers = this.previousContainers.size();
if (numExpectedContainers > numPreviousContainers) {
// we expected more containers to be alive, some containers must have died during driver restart
LOG.log(Level.WARNING, "Expected {0} containers while only {1} are still alive",
new Object[]{numExpectedContainers, numPreviousContainers});
final Set<String> previousContainersIds = new HashSet<>();
for (final Container container : this.previousContainers) {
previousContainersIds.add(container.getId().toString());
}
for (final String expectedContainerId : expectedContainers) {
if (!previousContainersIds.contains(expectedContainerId)) {
LOG.log(Level.WARNING, "Expected container [{0}] not alive, must have failed during driver restart.",
expectedContainerId);
restartEvaluatorsBuilder.addRestartEvaluator(
EvaluatorRestartInfo.createFailedEvaluatorInfo(expectedContainerId));
}
}
}
if (numExpectedContainers < numPreviousContainers) {
// somehow we have more alive evaluators, this should not happen
throw new RuntimeException("Expected only [" + numExpectedContainers + "] containers " +
"but resource manager believe that [" + numPreviousContainers + "] are outstanding for driver.");
}
// numExpectedContainers == numPreviousContainers
for (final Container container : this.previousContainers) {
LOG.log(Level.FINE, "Previous container: [{0}]", container.toString());
if (!expectedContainers.contains(container.getId().toString())) {
throw new RuntimeException("Not expecting container " + container.getId().toString());
}
restartEvaluatorsBuilder.addRestartEvaluator(EvaluatorRestartInfo.createExpectedEvaluatorInfo(
ResourceEventImpl.newRecoveryBuilder().setIdentifier(container.getId().toString())
.setNodeId(container.getNodeId().toString()).setRackName(rackNameFormatter.getRackName(container))
.setResourceMemory(container.getResource().getMemory())
.setVirtualCores(container.getResource().getVirtualCores())
.setRuntimeName(RuntimeIdentifier.RUNTIME_NAME).build()));
}
}
return restartEvaluatorsBuilder.build();
} } | public class class_name {
@Override
public RestartEvaluators getPreviousEvaluators() {
final RestartEvaluators.Builder restartEvaluatorsBuilder = RestartEvaluators.newBuilder();
this.initializeListOfPreviousContainers();
if (this.previousContainers != null && !this.previousContainers.isEmpty()) {
LOG.log(Level.INFO, "Driver restarted, with {0} previous containers", this.previousContainers.size()); // depends on control dependency: [if], data = [none]
final Set<String> expectedContainers = this.evaluatorPreserver.recoverEvaluators();
final int numExpectedContainers = expectedContainers.size();
final int numPreviousContainers = this.previousContainers.size();
if (numExpectedContainers > numPreviousContainers) {
// we expected more containers to be alive, some containers must have died during driver restart
LOG.log(Level.WARNING, "Expected {0} containers while only {1} are still alive",
new Object[]{numExpectedContainers, numPreviousContainers}); // depends on control dependency: [if], data = [none]
final Set<String> previousContainersIds = new HashSet<>();
for (final Container container : this.previousContainers) {
previousContainersIds.add(container.getId().toString()); // depends on control dependency: [for], data = [container]
}
for (final String expectedContainerId : expectedContainers) {
if (!previousContainersIds.contains(expectedContainerId)) {
LOG.log(Level.WARNING, "Expected container [{0}] not alive, must have failed during driver restart.",
expectedContainerId); // depends on control dependency: [if], data = [none]
restartEvaluatorsBuilder.addRestartEvaluator(
EvaluatorRestartInfo.createFailedEvaluatorInfo(expectedContainerId)); // depends on control dependency: [if], data = [none]
}
}
}
if (numExpectedContainers < numPreviousContainers) {
// somehow we have more alive evaluators, this should not happen
throw new RuntimeException("Expected only [" + numExpectedContainers + "] containers " +
"but resource manager believe that [" + numPreviousContainers + "] are outstanding for driver.");
}
// numExpectedContainers == numPreviousContainers
for (final Container container : this.previousContainers) {
LOG.log(Level.FINE, "Previous container: [{0}]", container.toString()); // depends on control dependency: [for], data = [container]
if (!expectedContainers.contains(container.getId().toString())) {
throw new RuntimeException("Not expecting container " + container.getId().toString());
}
restartEvaluatorsBuilder.addRestartEvaluator(EvaluatorRestartInfo.createExpectedEvaluatorInfo(
ResourceEventImpl.newRecoveryBuilder().setIdentifier(container.getId().toString())
.setNodeId(container.getNodeId().toString()).setRackName(rackNameFormatter.getRackName(container))
.setResourceMemory(container.getResource().getMemory())
.setVirtualCores(container.getResource().getVirtualCores())
.setRuntimeName(RuntimeIdentifier.RUNTIME_NAME).build())); // depends on control dependency: [for], data = [none]
}
}
return restartEvaluatorsBuilder.build();
} } |
public class class_name {
public void disableCacheSizeInMB() {
this.memoryCacheSizeInMBEnabled = false;
this.cacheConfig.memoryCacheSizeInMB = -1;
this.currentMemoryCacheSizeInBytes = -1;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "disableCacheSizeInMB() cacheName=" + this.cacheName);
}
} } | public class class_name {
public void disableCacheSizeInMB() {
this.memoryCacheSizeInMBEnabled = false;
this.cacheConfig.memoryCacheSizeInMB = -1;
this.currentMemoryCacheSizeInBytes = -1;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "disableCacheSizeInMB() cacheName=" + this.cacheName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static int countBits(long v)
{
//
// the strategy is to shift until we get a non-zero sign bit
// then shift until we have no bits left, counting the difference.
// we do byte shifting as a hack. Hope it helps.
//
if (v == 0L)
return 0;
while ((v & highbyte) == 0L)
{
v <<= 8;
}
while (v > 0L)
{ // i.e. while ((v&highbit) == 0L )
v <<= 1;
}
int n = 0;
while ((v & lowbytes) != 0L)
{
v <<= 8;
n += 8;
}
while (v != 0L)
{
v <<= 1;
n += 1;
}
return n;
} } | public class class_name {
private static int countBits(long v)
{
//
// the strategy is to shift until we get a non-zero sign bit
// then shift until we have no bits left, counting the difference.
// we do byte shifting as a hack. Hope it helps.
//
if (v == 0L)
return 0;
while ((v & highbyte) == 0L)
{
v <<= 8;
// depends on control dependency: [while], data = [none]
}
while (v > 0L)
{ // i.e. while ((v&highbit) == 0L )
v <<= 1;
// depends on control dependency: [while], data = [none]
}
int n = 0;
while ((v & lowbytes) != 0L)
{
v <<= 8;
// depends on control dependency: [while], data = [none]
n += 8;
// depends on control dependency: [while], data = [none]
}
while (v != 0L)
{
v <<= 1;
// depends on control dependency: [while], data = [none]
n += 1;
// depends on control dependency: [while], data = [none]
}
return n;
} } |
public class class_name {
public String getProperty(String base, String modifier, String key)
{
String result = null;
// Loop over the key orderings, from the most specific to the most general, until a matching value is found.
for (Iterator i = getKeyIterator(base, modifier, key); i.hasNext();)
{
String nextKey = (String) i.next();
result = super.getProperty(nextKey);
if (result != null)
{
break;
}
}
return result;
} } | public class class_name {
public String getProperty(String base, String modifier, String key)
{
String result = null;
// Loop over the key orderings, from the most specific to the most general, until a matching value is found.
for (Iterator i = getKeyIterator(base, modifier, key); i.hasNext();)
{
String nextKey = (String) i.next();
result = super.getProperty(nextKey); // depends on control dependency: [for], data = [none]
if (result != null)
{
break;
}
}
return result;
} } |
public class class_name {
public static UIContext getClosestContextForId(final WComponent root, final String id,
final boolean visibleOnly) {
FindComponentByIdVisitor visitor = new FindComponentByIdVisitor(id) {
@Override
public VisitorResult visit(final WComponent comp) {
VisitorResult result = super.visit(comp);
if (result == VisitorResult.CONTINUE) {
// Save closest UIC as processing tree
setResult(new ComponentWithContext(comp, UIContextHolder.getCurrent()));
}
return result;
}
};
doTraverse(root, visibleOnly, visitor);
return visitor.getResult() == null ? null : visitor.getResult().getContext();
} } | public class class_name {
public static UIContext getClosestContextForId(final WComponent root, final String id,
final boolean visibleOnly) {
FindComponentByIdVisitor visitor = new FindComponentByIdVisitor(id) {
@Override
public VisitorResult visit(final WComponent comp) {
VisitorResult result = super.visit(comp);
if (result == VisitorResult.CONTINUE) {
// Save closest UIC as processing tree
setResult(new ComponentWithContext(comp, UIContextHolder.getCurrent())); // depends on control dependency: [if], data = [none]
}
return result;
}
};
doTraverse(root, visibleOnly, visitor);
return visitor.getResult() == null ? null : visitor.getResult().getContext();
} } |
public class class_name {
private void addRemoteCandidates(List<TransportCandidate> rc) {
if (rc != null) {
if (rc.size() > 0) {
for (TransportCandidate aRc : rc) {
addRemoteCandidate(aRc);
}
}
}
} } | public class class_name {
private void addRemoteCandidates(List<TransportCandidate> rc) {
if (rc != null) {
if (rc.size() > 0) {
for (TransportCandidate aRc : rc) {
addRemoteCandidate(aRc); // depends on control dependency: [for], data = [aRc]
}
}
}
} } |
public class class_name {
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) {
List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners);
List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems);
List<R> newUnmodifiable = Collections.unmodifiableList(newItems);
for (ListValueChangeListener<R> listener : listenersCopy) {
listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable);
}
} } | public class class_name {
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) {
List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners);
List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems);
List<R> newUnmodifiable = Collections.unmodifiableList(newItems);
for (ListValueChangeListener<R> listener : listenersCopy) {
listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable); // depends on control dependency: [for], data = [listener]
}
} } |
public class class_name {
public <V> double[] getConfidenceInterval(final double alpha, final Map<V, Double> baselineMetricPerDimension, final Map<V, Double> testMetricPerDimension, final boolean pairedSamples) {
if (pairedSamples) {
Set<V> overlap = new HashSet<V>(baselineMetricPerDimension.keySet());
overlap.retainAll(testMetricPerDimension.keySet());
// paired or matched samples --> analyse distribution of difference scores
SummaryStatistics differences = new SummaryStatistics();
for (V key : overlap) {
double diff = Math.abs(testMetricPerDimension.get(key) - baselineMetricPerDimension.get(key));
differences.addValue(diff);
}
return getConfidenceInterval(alpha / 2, (int) differences.getN() - 1, (int) differences.getN(), differences.getStandardDeviation(), differences.getMean());
} else {
// independent samples --> analyse distribution of differences between means
SummaryStatistics statsBaseline = new SummaryStatistics();
for (double d : baselineMetricPerDimension.values()) {
statsBaseline.addValue(d);
}
SummaryStatistics statsTest = new SummaryStatistics();
for (double d : testMetricPerDimension.values()) {
statsTest.addValue(d);
}
long dfT = statsBaseline.getN() + statsTest.getN() - 2;
double sDif = Math.sqrt((1.0 / statsBaseline.getN() + 1.0 / statsTest.getN())
* (statsBaseline.getVariance()
* (statsBaseline.getN() - 1) + statsTest.getVariance()
* (statsTest.getN() - 1)));
double mDif = Math.abs(statsTest.getMean() - statsBaseline.getMean());
return getConfidenceInterval(alpha, (int) dfT, (int) dfT, sDif, mDif);
}
} } | public class class_name {
public <V> double[] getConfidenceInterval(final double alpha, final Map<V, Double> baselineMetricPerDimension, final Map<V, Double> testMetricPerDimension, final boolean pairedSamples) {
if (pairedSamples) {
Set<V> overlap = new HashSet<V>(baselineMetricPerDimension.keySet());
overlap.retainAll(testMetricPerDimension.keySet()); // depends on control dependency: [if], data = [none]
// paired or matched samples --> analyse distribution of difference scores
SummaryStatistics differences = new SummaryStatistics();
for (V key : overlap) {
double diff = Math.abs(testMetricPerDimension.get(key) - baselineMetricPerDimension.get(key));
differences.addValue(diff); // depends on control dependency: [for], data = [none]
}
return getConfidenceInterval(alpha / 2, (int) differences.getN() - 1, (int) differences.getN(), differences.getStandardDeviation(), differences.getMean()); // depends on control dependency: [if], data = [none]
} else {
// independent samples --> analyse distribution of differences between means
SummaryStatistics statsBaseline = new SummaryStatistics();
for (double d : baselineMetricPerDimension.values()) {
statsBaseline.addValue(d); // depends on control dependency: [for], data = [d]
}
SummaryStatistics statsTest = new SummaryStatistics();
for (double d : testMetricPerDimension.values()) {
statsTest.addValue(d); // depends on control dependency: [for], data = [d]
}
long dfT = statsBaseline.getN() + statsTest.getN() - 2;
double sDif = Math.sqrt((1.0 / statsBaseline.getN() + 1.0 / statsTest.getN())
* (statsBaseline.getVariance()
* (statsBaseline.getN() - 1) + statsTest.getVariance()
* (statsTest.getN() - 1)));
double mDif = Math.abs(statsTest.getMean() - statsBaseline.getMean());
return getConfidenceInterval(alpha, (int) dfT, (int) dfT, sDif, mDif); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void objectAvailable (NodeObject object)
{
// listen for lock and cache updates
nodeobj = object;
nodeobj.addListener(_listener = createListener());
_peermgr.connectedToPeer(this);
String nodeName = getNodeName();
for (ClientInfo clinfo : nodeobj.clients) {
_peermgr.clientLoggedOn(nodeName, clinfo);
}
for (NodeObject.Lock lock : nodeobj.locks) {
_peermgr.peerAddedLock(nodeName, lock);
}
} } | public class class_name {
public void objectAvailable (NodeObject object)
{
// listen for lock and cache updates
nodeobj = object;
nodeobj.addListener(_listener = createListener());
_peermgr.connectedToPeer(this);
String nodeName = getNodeName();
for (ClientInfo clinfo : nodeobj.clients) {
_peermgr.clientLoggedOn(nodeName, clinfo); // depends on control dependency: [for], data = [clinfo]
}
for (NodeObject.Lock lock : nodeobj.locks) {
_peermgr.peerAddedLock(nodeName, lock); // depends on control dependency: [for], data = [lock]
}
} } |
public class class_name {
public boolean supportsLazyUserLists() {
boolean result = "lazy".equalsIgnoreCase(m_userListMode);
if (org.opencms.db.mssql.CmsUserDriver.isInstantiated()) {
LOG.warn("Lazy user lists currently not supported on MSSQL, using classic user list mode as a fallback.");
result = false;
}
return result;
} } | public class class_name {
public boolean supportsLazyUserLists() {
boolean result = "lazy".equalsIgnoreCase(m_userListMode);
if (org.opencms.db.mssql.CmsUserDriver.isInstantiated()) {
LOG.warn("Lazy user lists currently not supported on MSSQL, using classic user list mode as a fallback."); // depends on control dependency: [if], data = [none]
result = false; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private String multilineValueString(String s) {
List<String> lines = new ArrayList<>(List.of(s.split("\n")));
final var sb = new StringBuilder();
var i = 0;
for (final var line : lines) {
sb.append(line.length() <= i || line.charAt(i) == 'A' ? 'B' : 'A');
i++;
}
final var delimiter = sb.toString();
String shortDelimiter = null;
for (int j = 1; j < delimiter.length(); j++) {
if (!lines.contains(delimiter.substring(0, j))) {
shortDelimiter = delimiter.substring(0, j);
break;
}
}
lines.add(0, "<<" + shortDelimiter);
lines.add(shortDelimiter);
return String.join("\n", lines);
} } | public class class_name {
private String multilineValueString(String s) {
List<String> lines = new ArrayList<>(List.of(s.split("\n")));
final var sb = new StringBuilder();
var i = 0;
for (final var line : lines) {
sb.append(line.length() <= i || line.charAt(i) == 'A' ? 'B' : 'A'); // depends on control dependency: [for], data = [line]
i++; // depends on control dependency: [for], data = [none]
}
final var delimiter = sb.toString();
String shortDelimiter = null;
for (int j = 1; j < delimiter.length(); j++) {
if (!lines.contains(delimiter.substring(0, j))) {
shortDelimiter = delimiter.substring(0, j); // depends on control dependency: [if], data = [none]
break;
}
}
lines.add(0, "<<" + shortDelimiter);
lines.add(shortDelimiter);
return String.join("\n", lines);
} } |
public class class_name {
private final void fixReportCpd(final Element root) {
final Collection<Element> elements; // Found elements
elements = root.getElementsByTag("h2");
if (!elements.isEmpty()) {
elements.iterator().next().tagName("h1");
}
} } | public class class_name {
private final void fixReportCpd(final Element root) {
final Collection<Element> elements; // Found elements
elements = root.getElementsByTag("h2");
if (!elements.isEmpty()) {
elements.iterator().next().tagName("h1"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static synchronized void remove(String appname) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "remove", appname);
}
scrSessionContexts.remove(appname);
} } | public class class_name {
public static synchronized void remove(String appname) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "remove", appname); // depends on control dependency: [if], data = [none]
}
scrSessionContexts.remove(appname);
} } |
public class class_name {
private LNGIntVector generateClauseVector(final Collection<Literal> literals) {
final LNGIntVector clauseVec = new LNGIntVector(literals.size());
for (final Literal lit : literals) {
int index = this.solver.idxForName(lit.name());
if (index == -1) {
index = this.solver.newVar(!this.initialPhase, true);
this.solver.addName(lit.name(), index);
}
final int litNum = lit.phase() ? index * 2 : (index * 2) ^ 1;
clauseVec.push(litNum);
}
return clauseVec;
} } | public class class_name {
private LNGIntVector generateClauseVector(final Collection<Literal> literals) {
final LNGIntVector clauseVec = new LNGIntVector(literals.size());
for (final Literal lit : literals) {
int index = this.solver.idxForName(lit.name());
if (index == -1) {
index = this.solver.newVar(!this.initialPhase, true); // depends on control dependency: [if], data = [none]
this.solver.addName(lit.name(), index); // depends on control dependency: [if], data = [none]
}
final int litNum = lit.phase() ? index * 2 : (index * 2) ^ 1;
clauseVec.push(litNum); // depends on control dependency: [for], data = [lit]
}
return clauseVec;
} } |
public class class_name {
public final T setStyle(String styleAttribute, String styleValue) {
// Add style to style map
Map<String, String> styleMap = getStyles();
styleMap.put(styleAttribute, styleValue);
// Serialize style string
StringBuilder styleString = new StringBuilder();
for (Map.Entry style : styleMap.entrySet()) {
styleString.append(style.getKey());
styleString.append(':');
styleString.append(style.getValue());
styleString.append(';');
}
setStyleString(styleString.toString());
return (T)this;
} } | public class class_name {
public final T setStyle(String styleAttribute, String styleValue) {
// Add style to style map
Map<String, String> styleMap = getStyles();
styleMap.put(styleAttribute, styleValue);
// Serialize style string
StringBuilder styleString = new StringBuilder();
for (Map.Entry style : styleMap.entrySet()) {
styleString.append(style.getKey()); // depends on control dependency: [for], data = [style]
styleString.append(':'); // depends on control dependency: [for], data = [style]
styleString.append(style.getValue()); // depends on control dependency: [for], data = [style]
styleString.append(';'); // depends on control dependency: [for], data = [style]
}
setStyleString(styleString.toString());
return (T)this;
} } |
public class class_name {
private static Type[] normalizeUpperBounds(final Type[] bounds) {
Assert.requireNonNull(bounds, "bounds");
// don't bother if there's only one (or none) type
if (bounds.length < 2) {
return bounds;
}
final Set<Type> types = new HashSet<>(bounds.length);
for (final Type type1 : bounds) {
boolean subtypeFound = false;
for (final Type type2 : bounds) {
if (type1 != type2 && isAssignable(type2, type1, null)) {
subtypeFound = true;
break;
}
}
if (!subtypeFound) {
types.add(type1);
}
}
return types.toArray(new Type[types.size()]);
} } | public class class_name {
private static Type[] normalizeUpperBounds(final Type[] bounds) {
Assert.requireNonNull(bounds, "bounds");
// don't bother if there's only one (or none) type
if (bounds.length < 2) {
return bounds; // depends on control dependency: [if], data = [none]
}
final Set<Type> types = new HashSet<>(bounds.length);
for (final Type type1 : bounds) {
boolean subtypeFound = false;
for (final Type type2 : bounds) {
if (type1 != type2 && isAssignable(type2, type1, null)) {
subtypeFound = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!subtypeFound) {
types.add(type1); // depends on control dependency: [if], data = [none]
}
}
return types.toArray(new Type[types.size()]);
} } |
public class class_name {
protected void assertNotDisposed() {
if (this.disposedFlag.get()) {
final AlreadyDisposedError error = new AlreadyDisposedError("Object already disposed");
MetaErrorListeners.fireError("Detected call to disposed object", error);
throw error;
}
} } | public class class_name {
protected void assertNotDisposed() {
if (this.disposedFlag.get()) {
final AlreadyDisposedError error = new AlreadyDisposedError("Object already disposed");
MetaErrorListeners.fireError("Detected call to disposed object", error); // depends on control dependency: [if], data = [none]
throw error;
}
} } |
public class class_name {
public static IPath getSourceBundlePath(Bundle bundle, IPath bundleLocation) {
IPath sourcesPath = null;
// Not an essential functionality, make it robust
try {
final IPath srcFolderPath = getSourceRootProjectFolderPath(bundle);
if (srcFolderPath == null) {
//common case, jar file.
final IPath bundlesParentFolder = bundleLocation.removeLastSegments(1);
final String binaryJarName = bundleLocation.lastSegment();
final String symbolicName = bundle.getSymbolicName();
final String sourceJarName = binaryJarName.replace(symbolicName,
symbolicName.concat(SOURCE_SUFIX));
final IPath potentialSourceJar = bundlesParentFolder.append(sourceJarName);
if (potentialSourceJar.toFile().exists()) {
sourcesPath = potentialSourceJar;
}
} else {
sourcesPath = srcFolderPath;
}
} catch (Throwable t) {
throw new RuntimeException(t);
}
return sourcesPath;
} } | public class class_name {
public static IPath getSourceBundlePath(Bundle bundle, IPath bundleLocation) {
IPath sourcesPath = null;
// Not an essential functionality, make it robust
try {
final IPath srcFolderPath = getSourceRootProjectFolderPath(bundle);
if (srcFolderPath == null) {
//common case, jar file.
final IPath bundlesParentFolder = bundleLocation.removeLastSegments(1);
final String binaryJarName = bundleLocation.lastSegment();
final String symbolicName = bundle.getSymbolicName();
final String sourceJarName = binaryJarName.replace(symbolicName,
symbolicName.concat(SOURCE_SUFIX));
final IPath potentialSourceJar = bundlesParentFolder.append(sourceJarName);
if (potentialSourceJar.toFile().exists()) {
sourcesPath = potentialSourceJar; // depends on control dependency: [if], data = [none]
}
} else {
sourcesPath = srcFolderPath; // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
throw new RuntimeException(t);
} // depends on control dependency: [catch], data = [none]
return sourcesPath;
} } |
public class class_name {
public static AspectranDaemonService create(AspectranConfig aspectranConfig) {
ContextConfig contextConfig = aspectranConfig.touchContextConfig();
String rootFile = contextConfig.getRootFile();
if (!StringUtils.hasText(rootFile)) {
if (!contextConfig.hasAspectranParameters()) {
contextConfig.setRootFile(DEFAULT_APP_CONFIG_ROOT_FILE);
}
}
AspectranDaemonService service = new AspectranDaemonService();
service.prepare(aspectranConfig);
DaemonConfig daemonConfig = aspectranConfig.getDaemonConfig();
if (daemonConfig != null) {
applyDaemonConfig(service, daemonConfig);
}
setServiceStateListener(service);
return service;
} } | public class class_name {
public static AspectranDaemonService create(AspectranConfig aspectranConfig) {
ContextConfig contextConfig = aspectranConfig.touchContextConfig();
String rootFile = contextConfig.getRootFile();
if (!StringUtils.hasText(rootFile)) {
if (!contextConfig.hasAspectranParameters()) {
contextConfig.setRootFile(DEFAULT_APP_CONFIG_ROOT_FILE); // depends on control dependency: [if], data = [none]
}
}
AspectranDaemonService service = new AspectranDaemonService();
service.prepare(aspectranConfig);
DaemonConfig daemonConfig = aspectranConfig.getDaemonConfig();
if (daemonConfig != null) {
applyDaemonConfig(service, daemonConfig); // depends on control dependency: [if], data = [none]
}
setServiceStateListener(service);
return service;
} } |
public class class_name {
public void setTableRestoreStatusDetails(java.util.Collection<TableRestoreStatus> tableRestoreStatusDetails) {
if (tableRestoreStatusDetails == null) {
this.tableRestoreStatusDetails = null;
return;
}
this.tableRestoreStatusDetails = new com.amazonaws.internal.SdkInternalList<TableRestoreStatus>(tableRestoreStatusDetails);
} } | public class class_name {
public void setTableRestoreStatusDetails(java.util.Collection<TableRestoreStatus> tableRestoreStatusDetails) {
if (tableRestoreStatusDetails == null) {
this.tableRestoreStatusDetails = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tableRestoreStatusDetails = new com.amazonaws.internal.SdkInternalList<TableRestoreStatus>(tableRestoreStatusDetails);
} } |
public class class_name {
public void marshall(CaptionSourceSettings captionSourceSettings, ProtocolMarshaller protocolMarshaller) {
if (captionSourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(captionSourceSettings.getAncillarySourceSettings(), ANCILLARYSOURCESETTINGS_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getDvbSubSourceSettings(), DVBSUBSOURCESETTINGS_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getEmbeddedSourceSettings(), EMBEDDEDSOURCESETTINGS_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getFileSourceSettings(), FILESOURCESETTINGS_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getTeletextSourceSettings(), TELETEXTSOURCESETTINGS_BINDING);
protocolMarshaller.marshall(captionSourceSettings.getTrackSourceSettings(), TRACKSOURCESETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CaptionSourceSettings captionSourceSettings, ProtocolMarshaller protocolMarshaller) {
if (captionSourceSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(captionSourceSettings.getAncillarySourceSettings(), ANCILLARYSOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getDvbSubSourceSettings(), DVBSUBSOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getEmbeddedSourceSettings(), EMBEDDEDSOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getFileSourceSettings(), FILESOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getSourceType(), SOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getTeletextSourceSettings(), TELETEXTSOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(captionSourceSettings.getTrackSourceSettings(), TRACKSOURCESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Promise loadLink(final String rel, final String url) {
GQuery link = $("link[rel='" + rel + "'][href^='" + url + "']");
if (link.isEmpty()) {
return new PromiseFunction() {
public void f(final Deferred dfd) {
GQuery link = $("<link rel='" + rel + "' href='" + url + "'/>");
link.on("load", new Function() {
public void f() {
// load event is fired before the imported stuff has actually
// being ready, we delay it to be sure it is ready.
new Timer() {
public void run() {
dfd.resolve();
}
}.schedule(100);
}
});
$(document.getHead()).append(link);
}
};
} else {
return Deferred().resolve().promise();
}
} } | public class class_name {
public static Promise loadLink(final String rel, final String url) {
GQuery link = $("link[rel='" + rel + "'][href^='" + url + "']");
if (link.isEmpty()) {
return new PromiseFunction() {
public void f(final Deferred dfd) {
GQuery link = $("<link rel='" + rel + "' href='" + url + "'/>");
link.on("load", new Function() {
public void f() {
// load event is fired before the imported stuff has actually
// being ready, we delay it to be sure it is ready.
new Timer() {
public void run() {
dfd.resolve();
}
}.schedule(100);
}
});
$(document.getHead()).append(link);
}
}; // depends on control dependency: [if], data = [none]
} else {
return Deferred().resolve().promise(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean handleCloseGroup() {
this.onCloseGroup(); // event handler
if (this.rtfParser.isImport()) {
if (this.buffer.length() > 0) {
writeBuffer();
}
if (dataOS != null) {
addImage();
dataOS = null;
}
this.writeText("}");
return true;
}
if (this.rtfParser.isConvert()) {
if (dataOS != null) {
addImage();
dataOS = null;
}
}
return true;
} } | public class class_name {
public boolean handleCloseGroup() {
this.onCloseGroup(); // event handler
if (this.rtfParser.isImport()) {
if (this.buffer.length() > 0) {
writeBuffer(); // depends on control dependency: [if], data = [none]
}
if (dataOS != null) {
addImage(); // depends on control dependency: [if], data = [none]
dataOS = null; // depends on control dependency: [if], data = [none]
}
this.writeText("}"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
if (this.rtfParser.isConvert()) {
if (dataOS != null) {
addImage(); // depends on control dependency: [if], data = [none]
dataOS = null; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
private static void addDecisionTypeByOrgData(final SimpleDateFormat simpleDateFormat, final DataSeries dataSeries,
final Series series, final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map) {
for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> entry : map.entrySet()) {
if (!EMPTY_STRING.equals(entry.getKey())) {
final XYseries label = new XYseries();
label.setLabel(entry.getKey());
series.addSeries(label);
dataSeries.newSeries();
for (final ViewRiksdagenCommitteeDecisionTypeOrgDailySummary item : entry.getValue()) {
dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()),
item.getTotal());
}
}
}
} } | public class class_name {
private static void addDecisionTypeByOrgData(final SimpleDateFormat simpleDateFormat, final DataSeries dataSeries,
final Series series, final Map<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> map) {
for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeOrgDailySummary>> entry : map.entrySet()) {
if (!EMPTY_STRING.equals(entry.getKey())) {
final XYseries label = new XYseries();
label.setLabel(entry.getKey()); // depends on control dependency: [if], data = [none]
series.addSeries(label); // depends on control dependency: [if], data = [none]
dataSeries.newSeries(); // depends on control dependency: [if], data = [none]
for (final ViewRiksdagenCommitteeDecisionTypeOrgDailySummary item : entry.getValue()) {
dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()),
item.getTotal()); // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
private boolean moveToNext() {
if (last) {
// last has been set to true, so no more rows to iterate - close everything
if (closeOnEnd) {
query.close();
} else {
query.closeResultSet(resultSetMapper.getResultSet());
}
return false;
}
while (true) {
if (!resultSetMapper.next()) {
// no more rows, no more parsing, previousElement is the last one to iterate
last = true;
return entityAwareMode;
}
// parse row
Object[] objects = resultSetMapper.parseObjects(types);
Object row = query.resolveRowResults(objects);
newElement = (T) row;
if (entityAwareMode) {
if (count == 0 && previousElement == null) {
previousElement = newElement;
continue;
}
if (previousElement != null && newElement != null) {
boolean equals;
if (newElement.getClass().isArray()) {
equals = Arrays.equals((Object[]) previousElement, (Object[]) newElement);
} else {
equals = previousElement.equals(newElement);
}
if (equals) {
continue;
}
}
}
break;
}
return true;
} } | public class class_name {
private boolean moveToNext() {
if (last) {
// last has been set to true, so no more rows to iterate - close everything
if (closeOnEnd) {
query.close(); // depends on control dependency: [if], data = [none]
} else {
query.closeResultSet(resultSetMapper.getResultSet()); // depends on control dependency: [if], data = [none]
}
return false; // depends on control dependency: [if], data = [none]
}
while (true) {
if (!resultSetMapper.next()) {
// no more rows, no more parsing, previousElement is the last one to iterate
last = true; // depends on control dependency: [if], data = [none]
return entityAwareMode; // depends on control dependency: [if], data = [none]
}
// parse row
Object[] objects = resultSetMapper.parseObjects(types);
Object row = query.resolveRowResults(objects);
newElement = (T) row; // depends on control dependency: [while], data = [none]
if (entityAwareMode) {
if (count == 0 && previousElement == null) {
previousElement = newElement; // depends on control dependency: [if], data = [none]
continue;
}
if (previousElement != null && newElement != null) {
boolean equals;
if (newElement.getClass().isArray()) {
equals = Arrays.equals((Object[]) previousElement, (Object[]) newElement); // depends on control dependency: [if], data = [none]
} else {
equals = previousElement.equals(newElement); // depends on control dependency: [if], data = [none]
}
if (equals) {
continue;
}
}
}
break;
}
return true;
} } |
public class class_name {
public boolean checkIfChanged(Collection<Host> hostsUp, Collection<Host> hostsDown) {
boolean changed = activeSetChanged(hostsUp) || inactiveSetChanged(hostsUp, hostsDown);
if (changed && logger.isDebugEnabled()) {
Set<Host> changedHostsUp = new HashSet<>(hostsUp);
changedHostsUp.removeAll(activeHosts);
changedHostsUp.forEach(x -> logger.debug("New host up: {}", x.getHostAddress()));
Set<Host> changedHostsDown = new HashSet<>(hostsDown);
changedHostsDown.removeAll(inactiveHosts);
changedHostsDown.forEach(x -> logger.debug("New host down: {}", x.getHostAddress()));
}
return changed;
} } | public class class_name {
public boolean checkIfChanged(Collection<Host> hostsUp, Collection<Host> hostsDown) {
boolean changed = activeSetChanged(hostsUp) || inactiveSetChanged(hostsUp, hostsDown);
if (changed && logger.isDebugEnabled()) {
Set<Host> changedHostsUp = new HashSet<>(hostsUp);
changedHostsUp.removeAll(activeHosts); // depends on control dependency: [if], data = [none]
changedHostsUp.forEach(x -> logger.debug("New host up: {}", x.getHostAddress())); // depends on control dependency: [if], data = [none]
Set<Host> changedHostsDown = new HashSet<>(hostsDown);
changedHostsDown.removeAll(inactiveHosts); // depends on control dependency: [if], data = [none]
changedHostsDown.forEach(x -> logger.debug("New host down: {}", x.getHostAddress())); // depends on control dependency: [if], data = [none]
}
return changed;
} } |
public class class_name {
public boolean recordHiddenness() {
if (!currentInfo.isHidden()) {
currentInfo.setHidden(true);
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordHiddenness() {
if (!currentInfo.isHidden()) {
currentInfo.setHidden(true); // depends on control dependency: [if], data = [none]
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ServiceDirectoryCache<String, ModelService> getCache(){
if(cache == null){
synchronized (this) {
if (this.cache == null) {
this.cache = new ServiceDirectoryCache<String, ModelService>();
}
}
}
return this.cache;
} } | public class class_name {
private ServiceDirectoryCache<String, ModelService> getCache(){
if(cache == null){
synchronized (this) { // depends on control dependency: [if], data = [none]
if (this.cache == null) {
this.cache = new ServiceDirectoryCache<String, ModelService>(); // depends on control dependency: [if], data = [none]
}
}
}
return this.cache;
} } |
public class class_name {
public void exceptionOccured(Throwable throwable)
{
logger.error( "Error: " + throwable.getMessage() );
if (throwable.getCause() != null)
{
logger.error( "Caused by:" );
logger.error( ExceptionUtils.stackTrace( throwable.getCause(), "\n" ) );
}
} } | public class class_name {
public void exceptionOccured(Throwable throwable)
{
logger.error( "Error: " + throwable.getMessage() );
if (throwable.getCause() != null)
{
logger.error( "Caused by:" ); // depends on control dependency: [if], data = [none]
logger.error( ExceptionUtils.stackTrace( throwable.getCause(), "\n" ) ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private <F extends FACETTYPE> F safeGetFacet(Class<F> type)
{
for (FACETTYPE facet : facets)
{
if (type.isInstance(facet))
{
return (F) facet;
}
}
return null;
} } | public class class_name {
@SuppressWarnings("unchecked")
private <F extends FACETTYPE> F safeGetFacet(Class<F> type)
{
for (FACETTYPE facet : facets)
{
if (type.isInstance(facet))
{
return (F) facet; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public List<T> apply(List<T> selectedCandidates, Random rng)
{
List<T> output = new ArrayList<T>(selectedCandidates.size());
for (T candidate : selectedCandidates)
{
output.add(replacementProbability.nextValue().nextEvent(rng)
? factory.generateRandomCandidate(rng)
: candidate);
}
return output;
} } | public class class_name {
public List<T> apply(List<T> selectedCandidates, Random rng)
{
List<T> output = new ArrayList<T>(selectedCandidates.size());
for (T candidate : selectedCandidates)
{
output.add(replacementProbability.nextValue().nextEvent(rng)
? factory.generateRandomCandidate(rng)
: candidate); // depends on control dependency: [for], data = [none]
}
return output;
} } |
public class class_name {
@SuppressWarnings("deprecation")
public boolean acceptPage(@Nullable Page page, @NotNull InternalLinkResolverOptions options) {
if (page == null) {
return false;
}
// check for jcr:content node
if (!page.hasContent()) {
return false;
}
// check if page is valid concerning on/off-time (only in publish environment)
if (RunMode.isPublish(slingSettings.getRunModes()) && !page.isValid()) {
return false;
}
// check if page is acceptable based on link handler config
if (!linkHandlerConfig.isValidLinkTarget(page)) {
return false;
}
return true;
} } | public class class_name {
@SuppressWarnings("deprecation")
public boolean acceptPage(@Nullable Page page, @NotNull InternalLinkResolverOptions options) {
if (page == null) {
return false; // depends on control dependency: [if], data = [none]
}
// check for jcr:content node
if (!page.hasContent()) {
return false; // depends on control dependency: [if], data = [none]
}
// check if page is valid concerning on/off-time (only in publish environment)
if (RunMode.isPublish(slingSettings.getRunModes()) && !page.isValid()) {
return false; // depends on control dependency: [if], data = [none]
}
// check if page is acceptable based on link handler config
if (!linkHandlerConfig.isValidLinkTarget(page)) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
protected List<String> findAvailableLocales(String resource) {
List<String> availableLocales = cachedAvailableLocalePerResource.get(resource);
if (availableLocales == null) {
availableLocales = LocaleUtils.getAvailableLocaleSuffixesForBundle(resource);
cachedAvailableLocalePerResource.put(resource, availableLocales);
}
return availableLocales;
} } | public class class_name {
protected List<String> findAvailableLocales(String resource) {
List<String> availableLocales = cachedAvailableLocalePerResource.get(resource);
if (availableLocales == null) {
availableLocales = LocaleUtils.getAvailableLocaleSuffixesForBundle(resource); // depends on control dependency: [if], data = [none]
cachedAvailableLocalePerResource.put(resource, availableLocales); // depends on control dependency: [if], data = [none]
}
return availableLocales;
} } |
public class class_name {
public Object getSession(HttpServletRequest req) {
if (req.getCookies() == null) {
return null;
}
Cookie cookie = Arrays.stream(req.getCookies()).filter(c -> c.getName().equalsIgnoreCase("ValidationSession")).findFirst().orElse(null);
if (cookie == null) {
return null;
}
return this.sessionMap.get(cookie.getValue());
} } | public class class_name {
public Object getSession(HttpServletRequest req) {
if (req.getCookies() == null) {
return null; // depends on control dependency: [if], data = [none]
}
Cookie cookie = Arrays.stream(req.getCookies()).filter(c -> c.getName().equalsIgnoreCase("ValidationSession")).findFirst().orElse(null);
if (cookie == null) {
return null; // depends on control dependency: [if], data = [none]
}
return this.sessionMap.get(cookie.getValue());
} } |
public class class_name {
public Duration plus(long amountToAdd, TemporalUnit unit) {
Jdk8Methods.requireNonNull(unit, "unit");
if (unit == DAYS) {
return plus(Jdk8Methods.safeMultiply(amountToAdd, SECONDS_PER_DAY), 0);
}
if (unit.isDurationEstimated()) {
throw new DateTimeException("Unit must not have an estimated duration");
}
if (amountToAdd == 0) {
return this;
}
if (unit instanceof ChronoUnit) {
switch ((ChronoUnit) unit) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusSeconds((amountToAdd / (1000000L * 1000)) * 1000).plusNanos((amountToAdd % (1000000L * 1000)) * 1000);
case MILLIS: return plusMillis(amountToAdd);
case SECONDS: return plusSeconds(amountToAdd);
}
return plusSeconds(Jdk8Methods.safeMultiply(unit.getDuration().seconds, amountToAdd));
}
Duration duration = unit.getDuration().multipliedBy(amountToAdd);
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
} } | public class class_name {
public Duration plus(long amountToAdd, TemporalUnit unit) {
Jdk8Methods.requireNonNull(unit, "unit");
if (unit == DAYS) {
return plus(Jdk8Methods.safeMultiply(amountToAdd, SECONDS_PER_DAY), 0); // depends on control dependency: [if], data = [none]
}
if (unit.isDurationEstimated()) {
throw new DateTimeException("Unit must not have an estimated duration");
}
if (amountToAdd == 0) {
return this; // depends on control dependency: [if], data = [none]
}
if (unit instanceof ChronoUnit) {
switch ((ChronoUnit) unit) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusSeconds((amountToAdd / (1000000L * 1000)) * 1000).plusNanos((amountToAdd % (1000000L * 1000)) * 1000);
case MILLIS: return plusMillis(amountToAdd);
case SECONDS: return plusSeconds(amountToAdd);
}
return plusSeconds(Jdk8Methods.safeMultiply(unit.getDuration().seconds, amountToAdd)); // depends on control dependency: [if], data = [none]
}
Duration duration = unit.getDuration().multipliedBy(amountToAdd);
return plusSeconds(duration.getSeconds()).plusNanos(duration.getNano());
} } |
public class class_name {
public long getTotal(final int id) {
BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(id);
if (task == null) {
return FileDownloadServiceProxy.getImpl().getTotal(id);
}
return task.getOrigin().getLargeFileTotalBytes();
} } | public class class_name {
public long getTotal(final int id) {
BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(id);
if (task == null) {
return FileDownloadServiceProxy.getImpl().getTotal(id); // depends on control dependency: [if], data = [none]
}
return task.getOrigin().getLargeFileTotalBytes();
} } |
public class class_name {
public boolean isInstrumentableClass() {
// Don't instrument interfaces
if (isInterface) {
return false;
}
// Don't instrument methods that are not in the source
if (isSynthetic) {
return false;
}
// Stay away from java.lang.Object
if (classInternalName.equals("java/lang/Object")) {
return false;
}
// Don't instrument dynamic proxies
if (classInternalName.startsWith("$Proxy")) {
return false;
}
// Don't instrument package-info
if (classInternalName.endsWith("/package-info")) {
return false;
}
return true;
} } | public class class_name {
public boolean isInstrumentableClass() {
// Don't instrument interfaces
if (isInterface) {
return false; // depends on control dependency: [if], data = [none]
}
// Don't instrument methods that are not in the source
if (isSynthetic) {
return false; // depends on control dependency: [if], data = [none]
}
// Stay away from java.lang.Object
if (classInternalName.equals("java/lang/Object")) {
return false; // depends on control dependency: [if], data = [none]
}
// Don't instrument dynamic proxies
if (classInternalName.startsWith("$Proxy")) {
return false; // depends on control dependency: [if], data = [none]
}
// Don't instrument package-info
if (classInternalName.endsWith("/package-info")) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public static void clearBlacklists(ClassLoader loader)
{
if (isJBossRepositoryClassLoader(loader))
{
for(Method m : loader.getClass().getMethods())
{
if("clearBlackLists".equalsIgnoreCase(m.getName()))
{
try
{
m.invoke(loader);
}
catch (Exception e)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.couldNotClearBlacklist(loader, e);
}
}
}
}
} } | public class class_name {
public static void clearBlacklists(ClassLoader loader)
{
if (isJBossRepositoryClassLoader(loader))
{
for(Method m : loader.getClass().getMethods())
{
if("clearBlackLists".equalsIgnoreCase(m.getName()))
{
try
{
m.invoke(loader); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
if (ROOT_LOGGER.isTraceEnabled()) ROOT_LOGGER.couldNotClearBlacklist(loader, e);
} // depends on control dependency: [catch], data = [none]
}
}
}
} } |
public class class_name {
public static double getDouble(SharedPreferences preferences, String key, double defaultValue) {
String stored = preferences.getString(key, null);
if (TextUtils.isEmpty(stored)) {
return defaultValue;
}
return Double.parseDouble(stored);
} } | public class class_name {
public static double getDouble(SharedPreferences preferences, String key, double defaultValue) {
String stored = preferences.getString(key, null);
if (TextUtils.isEmpty(stored)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return Double.parseDouble(stored);
} } |
public class class_name {
public static DeploymentUnit getTopDeploymentUnit(DeploymentUnit unit) {
Assert.checkNotNullParam("unit", unit);
DeploymentUnit parent = unit.getParent();
while (parent != null) {
unit = parent;
parent = unit.getParent();
}
return unit;
} } | public class class_name {
public static DeploymentUnit getTopDeploymentUnit(DeploymentUnit unit) {
Assert.checkNotNullParam("unit", unit);
DeploymentUnit parent = unit.getParent();
while (parent != null) {
unit = parent; // depends on control dependency: [while], data = [none]
parent = unit.getParent(); // depends on control dependency: [while], data = [none]
}
return unit;
} } |
public class class_name {
@Override
public final void run() {
LOGGER.debug("Executing " + getClass().getSimpleName());
markAsInProgress();
if (!Lists.isNullOrEmpty(listeners)) {
Runnable startUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyUseCaseStart(listener);
}
}
};
if (handler != null) {
handler.post(startUseCaseRunnable);
} else {
startUseCaseRunnable.run();
}
}
Trace trace = null;
if (timingTrackingEnabled()) {
trace = TraceHelper.startTrace(getClass());
}
try {
LOGGER.debug("Started " + getClass().getSimpleName());
executionTime = null;
startTime = DateUtils.nowMillis();
doExecute();
executionTime = DateUtils.nowMillis() - startTime;
LOGGER.debug("Finished " + getClass().getSimpleName() + ". Execution time: " + DateUtils.formatDuration(executionTime));
if (trace != null) {
trace.putAttribute("result", "success");
trace.incrementMetric("successes", 1);
}
markAsSuccessful();
if (!Lists.isNullOrEmpty(listeners)) {
Runnable finishedUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyFinishedUseCase(listener);
}
markAsNotified();
}
};
if (handler != null) {
handler.post(finishedUseCaseRunnable);
} else {
finishedUseCaseRunnable.run();
}
}
} catch (RuntimeException e) {
if (trace != null) {
trace.putAttribute("result", "failure");
trace.incrementMetric("failures", 1);
}
final AbstractException abstractException = wrapException(e);
markAsFailed(abstractException);
logHandledException(abstractException);
if (!Lists.isNullOrEmpty(listeners)) {
Runnable finishedFailedUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyFailedUseCase(abstractException, listener);
}
markAsNotified();
}
};
if (handler != null) {
handler.post(finishedFailedUseCaseRunnable);
} else {
finishedFailedUseCaseRunnable.run();
}
}
} finally {
if (trace != null) {
trace.stop();
}
}
} } | public class class_name {
@Override
public final void run() {
LOGGER.debug("Executing " + getClass().getSimpleName());
markAsInProgress();
if (!Lists.isNullOrEmpty(listeners)) {
Runnable startUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyUseCaseStart(listener); // depends on control dependency: [for], data = [listener]
}
}
};
if (handler != null) {
handler.post(startUseCaseRunnable); // depends on control dependency: [if], data = [none]
} else {
startUseCaseRunnable.run(); // depends on control dependency: [if], data = [none]
}
}
Trace trace = null;
if (timingTrackingEnabled()) {
trace = TraceHelper.startTrace(getClass()); // depends on control dependency: [if], data = [none]
}
try {
LOGGER.debug("Started " + getClass().getSimpleName()); // depends on control dependency: [try], data = [none]
executionTime = null; // depends on control dependency: [try], data = [none]
startTime = DateUtils.nowMillis(); // depends on control dependency: [try], data = [none]
doExecute(); // depends on control dependency: [try], data = [none]
executionTime = DateUtils.nowMillis() - startTime; // depends on control dependency: [try], data = [none]
LOGGER.debug("Finished " + getClass().getSimpleName() + ". Execution time: " + DateUtils.formatDuration(executionTime)); // depends on control dependency: [try], data = [none]
if (trace != null) {
trace.putAttribute("result", "success"); // depends on control dependency: [if], data = [none]
trace.incrementMetric("successes", 1); // depends on control dependency: [if], data = [none]
}
markAsSuccessful(); // depends on control dependency: [try], data = [none]
if (!Lists.isNullOrEmpty(listeners)) {
Runnable finishedUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyFinishedUseCase(listener); // depends on control dependency: [for], data = [listener]
}
markAsNotified();
}
};
if (handler != null) {
handler.post(finishedUseCaseRunnable); // depends on control dependency: [if], data = [none]
} else {
finishedUseCaseRunnable.run(); // depends on control dependency: [if], data = [none]
}
}
} catch (RuntimeException e) {
if (trace != null) {
trace.putAttribute("result", "failure"); // depends on control dependency: [if], data = [none]
trace.incrementMetric("failures", 1); // depends on control dependency: [if], data = [none]
}
final AbstractException abstractException = wrapException(e);
markAsFailed(abstractException);
logHandledException(abstractException);
if (!Lists.isNullOrEmpty(listeners)) {
Runnable finishedFailedUseCaseRunnable = new Runnable() {
@Override
public void run() {
for (UseCaseListener listener : listeners) {
notifyFailedUseCase(abstractException, listener); // depends on control dependency: [for], data = [listener]
}
markAsNotified();
}
};
if (handler != null) {
handler.post(finishedFailedUseCaseRunnable); // depends on control dependency: [if], data = [none]
} else {
finishedFailedUseCaseRunnable.run(); // depends on control dependency: [if], data = [none]
}
}
} finally { // depends on control dependency: [catch], data = [none]
if (trace != null) {
trace.stop(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void callAppenders(LoggingEvent event) {
int writes = 0;
for (Category c = this; c != null; c = c.getParent()) {
if (!(NFLockFreeLogger.class.isInstance(c))) {
continue;
}
if (((NFLockFreeLogger) c).aai != null) {
int appenderWrite = ((NFLockFreeLogger) c).aai
.appendLoopOnAppenders(event);
writes += appenderWrite;
}
if (!c.getAdditivity()) {
break;
}
}
if (writes == 0) {
repository.emitNoAppenderWarning(this);
}
} } | public class class_name {
@Override
public void callAppenders(LoggingEvent event) {
int writes = 0;
for (Category c = this; c != null; c = c.getParent()) {
if (!(NFLockFreeLogger.class.isInstance(c))) {
continue;
}
if (((NFLockFreeLogger) c).aai != null) {
int appenderWrite = ((NFLockFreeLogger) c).aai
.appendLoopOnAppenders(event);
writes += appenderWrite; // depends on control dependency: [if], data = [none]
}
if (!c.getAdditivity()) {
break;
}
}
if (writes == 0) {
repository.emitNoAppenderWarning(this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static List<BeanMappingObject> parseMappingObject(InputStream in) {
Document doc = XmlHelper.createDocument(
in,
Thread.currentThread().getContextClassLoader().getResourceAsStream(
MAPPING_SCHEMA));
Element root = doc.getDocumentElement();
NodeList globalNodeList = root.getElementsByTagName("global-configurations");
if (globalNodeList.getLength() > 1) {
throw new BeanMappingException("global-configurations is exceed one node!");
}
BeanMappingBehavior globalBehavior = BeanMappingConfigHelper.getInstance().getGlobalBehavior();
if (globalNodeList.getLength() == 1) {
globalBehavior = BeanMappingBehaviorParse.parse(globalNodeList.item(0), globalBehavior);
BeanMappingConfigHelper.getInstance().setGlobalBehavior(globalBehavior);
}
NodeList classAliasNodeList = root.getElementsByTagName("class-alias-configurations");
for (int i = 0; i < classAliasNodeList.getLength(); i++) {
ClassAliasParse.parseAndRegister(classAliasNodeList.item(i));
}
NodeList convertorNodeList = root.getElementsByTagName("convertors-configurations");
for (int i = 0; i < convertorNodeList.getLength(); i++) {
ConvertorParse.parseAndRegister(convertorNodeList.item(i));
}
NodeList functionClassNodeList = root.getElementsByTagName("function-class-configurations");
for (int i = 0; i < functionClassNodeList.getLength(); i++) {
FunctionClassParse.parseAndRegister(functionClassNodeList.item(i));
}
NodeList nodeList = root.getElementsByTagName("bean-mapping");
List<BeanMappingObject> mappings = new ArrayList<BeanMappingObject>();
// 解析BeanMappingObject属性
for (int i = 0; i < nodeList.getLength(); i++) {
BeanMappingObject config = BeanMappingParse.parse(nodeList.item(i), globalBehavior);
// 添加到返回结果
mappings.add(config);
}
return mappings;
} } | public class class_name {
private static List<BeanMappingObject> parseMappingObject(InputStream in) {
Document doc = XmlHelper.createDocument(
in,
Thread.currentThread().getContextClassLoader().getResourceAsStream(
MAPPING_SCHEMA));
Element root = doc.getDocumentElement();
NodeList globalNodeList = root.getElementsByTagName("global-configurations");
if (globalNodeList.getLength() > 1) {
throw new BeanMappingException("global-configurations is exceed one node!");
}
BeanMappingBehavior globalBehavior = BeanMappingConfigHelper.getInstance().getGlobalBehavior();
if (globalNodeList.getLength() == 1) {
globalBehavior = BeanMappingBehaviorParse.parse(globalNodeList.item(0), globalBehavior); // depends on control dependency: [if], data = [none]
BeanMappingConfigHelper.getInstance().setGlobalBehavior(globalBehavior); // depends on control dependency: [if], data = [none]
}
NodeList classAliasNodeList = root.getElementsByTagName("class-alias-configurations");
for (int i = 0; i < classAliasNodeList.getLength(); i++) {
ClassAliasParse.parseAndRegister(classAliasNodeList.item(i)); // depends on control dependency: [for], data = [i]
}
NodeList convertorNodeList = root.getElementsByTagName("convertors-configurations");
for (int i = 0; i < convertorNodeList.getLength(); i++) {
ConvertorParse.parseAndRegister(convertorNodeList.item(i)); // depends on control dependency: [for], data = [i]
}
NodeList functionClassNodeList = root.getElementsByTagName("function-class-configurations");
for (int i = 0; i < functionClassNodeList.getLength(); i++) {
FunctionClassParse.parseAndRegister(functionClassNodeList.item(i)); // depends on control dependency: [for], data = [i]
}
NodeList nodeList = root.getElementsByTagName("bean-mapping");
List<BeanMappingObject> mappings = new ArrayList<BeanMappingObject>();
// 解析BeanMappingObject属性
for (int i = 0; i < nodeList.getLength(); i++) {
BeanMappingObject config = BeanMappingParse.parse(nodeList.item(i), globalBehavior);
// 添加到返回结果
mappings.add(config); // depends on control dependency: [for], data = [none]
}
return mappings;
} } |
public class class_name {
@Override
public HttpConnection getConnectionWithTimeout(
HostConfiguration hostConfiguration, long timeout) {
if (httpConnection == null) {
httpConnection = new ZapHttpConnection(hostConfiguration);
httpConnection.setHttpConnectionManager(this);
httpConnection.getParams().setDefaults(this.getParams());
}
return super.getConnectionWithTimeout(hostConfiguration, timeout);
} } | public class class_name {
@Override
public HttpConnection getConnectionWithTimeout(
HostConfiguration hostConfiguration, long timeout) {
if (httpConnection == null) {
httpConnection = new ZapHttpConnection(hostConfiguration); // depends on control dependency: [if], data = [none]
httpConnection.setHttpConnectionManager(this); // depends on control dependency: [if], data = [none]
httpConnection.getParams().setDefaults(this.getParams()); // depends on control dependency: [if], data = [none]
}
return super.getConnectionWithTimeout(hostConfiguration, timeout);
} } |
public class class_name {
private void jobStateChanged(JobStatusChangeEvent event, QueueInfo qi) {
JobInProgress job = event.getJobInProgress();
JobSchedulingInfo oldJobStateInfo =
new JobSchedulingInfo(event.getOldStatus());
// Check if the ordering of the job has changed
// For now priority and start-time can change the job ordering
if (event.getEventType() == EventType.PRIORITY_CHANGED
|| event.getEventType() == EventType.START_TIME_CHANGED) {
// Make a priority change
reorderJobs(job, oldJobStateInfo, qi);
} else if (event.getEventType() == EventType.RUN_STATE_CHANGED) {
// Check if the job is complete
int runState = job.getStatus().getRunState();
if (runState == JobStatus.SUCCEEDED
|| runState == JobStatus.FAILED
|| runState == JobStatus.KILLED) {
jobCompleted(job, oldJobStateInfo, qi);
} else if (runState == JobStatus.RUNNING) {
makeJobRunning(job, oldJobStateInfo, qi);
}
}
} } | public class class_name {
private void jobStateChanged(JobStatusChangeEvent event, QueueInfo qi) {
JobInProgress job = event.getJobInProgress();
JobSchedulingInfo oldJobStateInfo =
new JobSchedulingInfo(event.getOldStatus());
// Check if the ordering of the job has changed
// For now priority and start-time can change the job ordering
if (event.getEventType() == EventType.PRIORITY_CHANGED
|| event.getEventType() == EventType.START_TIME_CHANGED) {
// Make a priority change
reorderJobs(job, oldJobStateInfo, qi); // depends on control dependency: [if], data = [none]
} else if (event.getEventType() == EventType.RUN_STATE_CHANGED) {
// Check if the job is complete
int runState = job.getStatus().getRunState();
if (runState == JobStatus.SUCCEEDED
|| runState == JobStatus.FAILED
|| runState == JobStatus.KILLED) {
jobCompleted(job, oldJobStateInfo, qi); // depends on control dependency: [if], data = [none]
} else if (runState == JobStatus.RUNNING) {
makeJobRunning(job, oldJobStateInfo, qi); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void output(String output)
throws XMLStreamException
{
if (mIsFlattening > 0) {
try {
mWriter.write(output);
} catch (IOException ioe) {
throw new WstxIOException(ioe);
}
}
} } | public class class_name {
public void output(String output)
throws XMLStreamException
{
if (mIsFlattening > 0) {
try {
mWriter.write(output); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw new WstxIOException(ioe);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setEvaluationResults(java.util.Collection<EvaluationResult> evaluationResults) {
if (evaluationResults == null) {
this.evaluationResults = null;
return;
}
this.evaluationResults = new com.amazonaws.internal.SdkInternalList<EvaluationResult>(evaluationResults);
} } | public class class_name {
public void setEvaluationResults(java.util.Collection<EvaluationResult> evaluationResults) {
if (evaluationResults == null) {
this.evaluationResults = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.evaluationResults = new com.amazonaws.internal.SdkInternalList<EvaluationResult>(evaluationResults);
} } |
public class class_name {
public void createRule(Instance inst) {
int remainder = (int)Double.MAX_VALUE;
int numInstanciaObservers = (int)this.observedClassDistribution.sumOfValues();
if (numInstanciaObservers != 0 && this.gracePeriodOption.getValue() != 0) {
remainder = (numInstanciaObservers) % (this.gracePeriodOption.getValue());
}
if (remainder == 0) {
this.saveBestValGlobalEntropy = new ArrayList<ArrayList<Double>>();
this.saveBestGlobalEntropy = new DoubleVector();
this.saveTheBest = new ArrayList<Double>();
this.minEntropyTemp = Double.MAX_VALUE;
this.minEntropyNominalAttrib = Double.MAX_VALUE;
theBestAttributes(inst, this.attributeObservers);
boolean HB = checkBestAttrib(numInstanciaObservers, this.attributeObservers, this.observedClassDistribution);
if (HB == true) {
// System.out.print("this.saveTheBest"+this.saveTheBest+"\n");
double attributeValue = this.saveTheBest.get(3);
double symbol = this.saveTheBest.get(2); // =, <=, > : (0.0, -1.0, 1.0).
double value = this.saveTheBest.get(0); // Value of the attribute
this.pred = new Predicates(attributeValue, symbol, value);
RuleClassification Rl = new RuleClassification(); // Create RuleClassification.
Rl.predicateSet.add(pred);
this.ruleSet.add(Rl);
if (Rl.predicateSet.get(0).getSymbol() == -1.0 ||Rl.predicateSet.get(0).getSymbol() == 1.0) {
double posClassDouble = this.saveTheBest.get(4);
this.ruleClassIndex.setValue(this.ruleSet.size()-1, posClassDouble);
}else{
this.ruleClassIndex.setValue(ruleSet.size()-1, 0.0);
}
this.observedClassDistribution = new DoubleVector();
this.attributeObservers = new AutoExpandVector<AttributeClassObserver>();
this.attributeObserversGauss = new AutoExpandVector<AttributeClassObserver>();
}
}
} } | public class class_name {
public void createRule(Instance inst) {
int remainder = (int)Double.MAX_VALUE;
int numInstanciaObservers = (int)this.observedClassDistribution.sumOfValues();
if (numInstanciaObservers != 0 && this.gracePeriodOption.getValue() != 0) {
remainder = (numInstanciaObservers) % (this.gracePeriodOption.getValue()); // depends on control dependency: [if], data = [(numInstanciaObservers]
}
if (remainder == 0) {
this.saveBestValGlobalEntropy = new ArrayList<ArrayList<Double>>(); // depends on control dependency: [if], data = [none]
this.saveBestGlobalEntropy = new DoubleVector(); // depends on control dependency: [if], data = [none]
this.saveTheBest = new ArrayList<Double>(); // depends on control dependency: [if], data = [none]
this.minEntropyTemp = Double.MAX_VALUE; // depends on control dependency: [if], data = [none]
this.minEntropyNominalAttrib = Double.MAX_VALUE; // depends on control dependency: [if], data = [none]
theBestAttributes(inst, this.attributeObservers); // depends on control dependency: [if], data = [none]
boolean HB = checkBestAttrib(numInstanciaObservers, this.attributeObservers, this.observedClassDistribution);
if (HB == true) {
// System.out.print("this.saveTheBest"+this.saveTheBest+"\n");
double attributeValue = this.saveTheBest.get(3);
double symbol = this.saveTheBest.get(2); // =, <=, > : (0.0, -1.0, 1.0).
double value = this.saveTheBest.get(0); // Value of the attribute
this.pred = new Predicates(attributeValue, symbol, value); // depends on control dependency: [if], data = [none]
RuleClassification Rl = new RuleClassification(); // Create RuleClassification.
Rl.predicateSet.add(pred); // depends on control dependency: [if], data = [none]
this.ruleSet.add(Rl); // depends on control dependency: [if], data = [none]
if (Rl.predicateSet.get(0).getSymbol() == -1.0 ||Rl.predicateSet.get(0).getSymbol() == 1.0) {
double posClassDouble = this.saveTheBest.get(4);
this.ruleClassIndex.setValue(this.ruleSet.size()-1, posClassDouble); // depends on control dependency: [if], data = [none]
}else{
this.ruleClassIndex.setValue(ruleSet.size()-1, 0.0); // depends on control dependency: [if], data = [none]
}
this.observedClassDistribution = new DoubleVector(); // depends on control dependency: [if], data = [none]
this.attributeObservers = new AutoExpandVector<AttributeClassObserver>(); // depends on control dependency: [if], data = [none]
this.attributeObserversGauss = new AutoExpandVector<AttributeClassObserver>(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private boolean isBonded(int i, int j) {
SecStrucState one = getSecStrucState(i);
SecStrucState two = getSecStrucState(j);
double don1e = one.getDonor1().getEnergy();
double don2e = one.getDonor2().getEnergy();
double acc1e = two.getAccept1().getEnergy();
double acc2e = two.getAccept2().getEnergy();
int don1p = one.getDonor1().getPartner();
int don2p = one.getDonor2().getPartner();
int acc1p = two.getAccept1().getPartner();
int acc2p = two.getAccept2().getPartner();
//Either donor from i is j, or accept from j is i
boolean hbond = (don1p == j && don1e < HBONDHIGHENERGY) ||
(don2p == j && don2e < HBONDHIGHENERGY) ||
(acc1p == i && acc1e < HBONDHIGHENERGY) ||
(acc2p == i && acc2e < HBONDHIGHENERGY);
if (hbond){
logger.debug("*** H-bond from CO of {} to NH of {}", i, j);
return true;
}
return false ;
} } | public class class_name {
private boolean isBonded(int i, int j) {
SecStrucState one = getSecStrucState(i);
SecStrucState two = getSecStrucState(j);
double don1e = one.getDonor1().getEnergy();
double don2e = one.getDonor2().getEnergy();
double acc1e = two.getAccept1().getEnergy();
double acc2e = two.getAccept2().getEnergy();
int don1p = one.getDonor1().getPartner();
int don2p = one.getDonor2().getPartner();
int acc1p = two.getAccept1().getPartner();
int acc2p = two.getAccept2().getPartner();
//Either donor from i is j, or accept from j is i
boolean hbond = (don1p == j && don1e < HBONDHIGHENERGY) ||
(don2p == j && don2e < HBONDHIGHENERGY) ||
(acc1p == i && acc1e < HBONDHIGHENERGY) ||
(acc2p == i && acc2e < HBONDHIGHENERGY);
if (hbond){
logger.debug("*** H-bond from CO of {} to NH of {}", i, j); // depends on control dependency: [if], data = [none]
return true;
}
return false ;
} } |
public class class_name {
public boolean getBoolean(String key, boolean defaultValue)
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
properties.put(key, String.valueOf(defaultValue));
return defaultValue;
}
for (int i = 0; i < trueValues.length; i++)
{
if (tmp.equalsIgnoreCase(trueValues[i]))
{
return true;
}
}
for (int i = 0; i < falseValues.length; i++)
{
if (tmp.equalsIgnoreCase(falseValues[i]))
{
return false;
}
}
logger.warn(
"Value \""
+ tmp
+ "\" is illegal for key \""
+ key
+ "\" (should be a boolean, using default value "
+ defaultValue
+ ")");
return defaultValue;
} } | public class class_name {
public boolean getBoolean(String key, boolean defaultValue)
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
// depends on control dependency: [if], data = [none]
properties.put(key, String.valueOf(defaultValue));
// depends on control dependency: [if], data = [none]
return defaultValue;
// depends on control dependency: [if], data = [none]
}
for (int i = 0; i < trueValues.length; i++)
{
if (tmp.equalsIgnoreCase(trueValues[i]))
{
return true;
// depends on control dependency: [if], data = [none]
}
}
for (int i = 0; i < falseValues.length; i++)
{
if (tmp.equalsIgnoreCase(falseValues[i]))
{
return false;
// depends on control dependency: [if], data = [none]
}
}
logger.warn(
"Value \""
+ tmp
+ "\" is illegal for key \""
+ key
+ "\" (should be a boolean, using default value "
+ defaultValue
+ ")");
return defaultValue;
} } |
public class class_name {
public static <T> void fire(final HasItemAddedOnInitHandlers<T> source, T item) {
if (TYPE != null) {
ItemAddedOnInitEvent<T> event = new ItemAddedOnInitEvent<T>(item);
source.fireEvent(event);
}
} } | public class class_name {
public static <T> void fire(final HasItemAddedOnInitHandlers<T> source, T item) {
if (TYPE != null) {
ItemAddedOnInitEvent<T> event = new ItemAddedOnInitEvent<T>(item);
source.fireEvent(event); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void processOtherMappings() {
codeToJavaMapping.clear();
codeToJKTypeMapping.clear();
shortListOfJKTypes.clear();
Set<Class<?>> keySet = javaToCodeMapping.keySet();
for (Class<?> clas : keySet) {
List<Integer> codes = javaToCodeMapping.get(clas);
for (Integer code : codes) {
codeToJavaMapping.put(code, clas);
logger.debug(" Code ({}) class ({}) name ({})", code, clas.getSimpleName(), namesMapping.get(code));
codeToJKTypeMapping.put(code, new JKType(code, clas, namesMapping.get(code)));
}
shortListOfJKTypes.add(new JKType(codes.get(0), clas, namesMapping.get(codes.get(0))));
}
} } | public class class_name {
private static void processOtherMappings() {
codeToJavaMapping.clear();
codeToJKTypeMapping.clear();
shortListOfJKTypes.clear();
Set<Class<?>> keySet = javaToCodeMapping.keySet();
for (Class<?> clas : keySet) {
List<Integer> codes = javaToCodeMapping.get(clas);
for (Integer code : codes) {
codeToJavaMapping.put(code, clas);
// depends on control dependency: [for], data = [code]
logger.debug(" Code ({}) class ({}) name ({})", code, clas.getSimpleName(), namesMapping.get(code));
// depends on control dependency: [for], data = [code]
codeToJKTypeMapping.put(code, new JKType(code, clas, namesMapping.get(code)));
// depends on control dependency: [for], data = [code]
}
shortListOfJKTypes.add(new JKType(codes.get(0), clas, namesMapping.get(codes.get(0))));
// depends on control dependency: [for], data = [clas]
}
} } |
public class class_name {
public static Principal createUser(final SecurityContext securityContext, final PropertyKey credentialKey, final String credentialValue, final Map<String, Object> propertySet, final boolean autoCreate, final Class userClass, final String confKey) {
final PropertyKey<String> confirmationKeyKey = StructrApp.key(User.class, "confirmationKey");
Principal user = null;
try {
// First, search for a person with that e-mail address
user = AuthHelper.getPrincipalForCredential(credentialKey, credentialValue);
if (user != null) {
user = new NodeFactory<Principal>(securityContext).instantiate(user.getNode());
// convert to user
user.unlockSystemPropertiesOnce();
final PropertyMap changedProperties = new PropertyMap();
changedProperties.put(AbstractNode.type, User.class.getSimpleName());
changedProperties.put(confirmationKeyKey, confKey);
user.setProperties(securityContext, changedProperties);
} else if (autoCreate) {
final App app = StructrApp.getInstance(securityContext);
// Clear properties set by us from the user-defined props
propertySet.remove(credentialKey.jsonName());
propertySet.remove("confirmationKey");
PropertyMap props = PropertyMap.inputTypeToJavaType(securityContext, StructrApp.getConfiguration().getNodeEntityClass("Principal"), propertySet);
// Remove any property which is not included in configuration
// eMail is mandatory and necessary
final String customAttributesString = "eMail" + "," + Settings.RegistrationCustomAttributes.getValue();
final List<String> customAttributes = Arrays.asList(customAttributesString.split("[ ,]+"));
final Set<PropertyKey> propsToRemove = new HashSet<>();
for (final PropertyKey key : props.keySet()) {
if (!customAttributes.contains(key.jsonName())) {
propsToRemove.add(key);
}
}
for (final PropertyKey propToRemove : propsToRemove) {
props.remove(propToRemove);
}
props.put(credentialKey, credentialValue);
props.put(confirmationKeyKey, confKey);
user = (Principal) app.create(userClass, props);
} else {
logger.info("User self-registration is not configured yet, cannot create new user.");
}
} catch (FrameworkException ex) {
logger.error("", ex);
}
return user;
} } | public class class_name {
public static Principal createUser(final SecurityContext securityContext, final PropertyKey credentialKey, final String credentialValue, final Map<String, Object> propertySet, final boolean autoCreate, final Class userClass, final String confKey) {
final PropertyKey<String> confirmationKeyKey = StructrApp.key(User.class, "confirmationKey");
Principal user = null;
try {
// First, search for a person with that e-mail address
user = AuthHelper.getPrincipalForCredential(credentialKey, credentialValue); // depends on control dependency: [try], data = [none]
if (user != null) {
user = new NodeFactory<Principal>(securityContext).instantiate(user.getNode()); // depends on control dependency: [if], data = [(user]
// convert to user
user.unlockSystemPropertiesOnce(); // depends on control dependency: [if], data = [none]
final PropertyMap changedProperties = new PropertyMap();
changedProperties.put(AbstractNode.type, User.class.getSimpleName()); // depends on control dependency: [if], data = [none]
changedProperties.put(confirmationKeyKey, confKey); // depends on control dependency: [if], data = [none]
user.setProperties(securityContext, changedProperties); // depends on control dependency: [if], data = [none]
} else if (autoCreate) {
final App app = StructrApp.getInstance(securityContext);
// Clear properties set by us from the user-defined props
propertySet.remove(credentialKey.jsonName()); // depends on control dependency: [if], data = [none]
propertySet.remove("confirmationKey"); // depends on control dependency: [if], data = [none]
PropertyMap props = PropertyMap.inputTypeToJavaType(securityContext, StructrApp.getConfiguration().getNodeEntityClass("Principal"), propertySet);
// Remove any property which is not included in configuration
// eMail is mandatory and necessary
final String customAttributesString = "eMail" + "," + Settings.RegistrationCustomAttributes.getValue();
final List<String> customAttributes = Arrays.asList(customAttributesString.split("[ ,]+"));
final Set<PropertyKey> propsToRemove = new HashSet<>();
for (final PropertyKey key : props.keySet()) {
if (!customAttributes.contains(key.jsonName())) {
propsToRemove.add(key); // depends on control dependency: [if], data = [none]
}
}
for (final PropertyKey propToRemove : propsToRemove) {
props.remove(propToRemove); // depends on control dependency: [for], data = [propToRemove]
}
props.put(credentialKey, credentialValue); // depends on control dependency: [if], data = [none]
props.put(confirmationKeyKey, confKey); // depends on control dependency: [if], data = [none]
user = (Principal) app.create(userClass, props); // depends on control dependency: [if], data = [none]
} else {
logger.info("User self-registration is not configured yet, cannot create new user."); // depends on control dependency: [if], data = [none]
}
} catch (FrameworkException ex) {
logger.error("", ex);
} // depends on control dependency: [catch], data = [none]
return user;
} } |
public class class_name {
private void bindUpstream(BioPAXElement element)
{
AbstractNode node = (AbstractNode) graph.getGraphObject(element);
if (node != null)
{
Edge edge = new EdgeL3(node, this, graph);
node.getDownstreamNoInit().add(edge);
this.getUpstreamNoInit().add(edge);
}
} } | public class class_name {
private void bindUpstream(BioPAXElement element)
{
AbstractNode node = (AbstractNode) graph.getGraphObject(element);
if (node != null)
{
Edge edge = new EdgeL3(node, this, graph);
node.getDownstreamNoInit().add(edge); // depends on control dependency: [if], data = [none]
this.getUpstreamNoInit().add(edge); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) {
TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener);
for (N node : graph) {
if (!vis.hasVisited(node)) {
GraphTraversal.depthFirst(graph, node, vis);
}
}
} } | public class class_name {
public static <N, E> void findSCCs(Graph<N, E> graph, SCCListener<N> listener) {
TarjanSCCVisitor<N, E> vis = new TarjanSCCVisitor<>(graph, listener);
for (N node : graph) {
if (!vis.hasVisited(node)) {
GraphTraversal.depthFirst(graph, node, vis); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public ConsumerManager createConsumerManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createConsumerManager");
ConsumerDispatcher consumerDispatcher = (ConsumerDispatcher) getOutputHandler();
if (consumerDispatcher == null)
{
consumerDispatcher = new ConsumerDispatcher(destinationHandler, this, new ConsumerDispatcherState());
setOutputHandler(consumerDispatcher);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createConsumerManager", consumerDispatcher);
return consumerDispatcher;
} } | public class class_name {
@Override
public ConsumerManager createConsumerManager()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createConsumerManager");
ConsumerDispatcher consumerDispatcher = (ConsumerDispatcher) getOutputHandler();
if (consumerDispatcher == null)
{
consumerDispatcher = new ConsumerDispatcher(destinationHandler, this, new ConsumerDispatcherState()); // depends on control dependency: [if], data = [none]
setOutputHandler(consumerDispatcher); // depends on control dependency: [if], data = [(consumerDispatcher]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createConsumerManager", consumerDispatcher);
return consumerDispatcher;
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "static-method" })
@Pure
final <O> O unwrap(O obj) {
O unwrapped = obj;
if (obj instanceof TerminalConnection) {
unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection();
} else if (obj instanceof WrapSegment) {
unwrapped = (O) ((WrapSegment) obj).getWrappedSegment();
}
assert unwrapped != null;
return unwrapped;
} } | public class class_name {
@SuppressWarnings({ "unchecked", "static-method" })
@Pure
final <O> O unwrap(O obj) {
O unwrapped = obj;
if (obj instanceof TerminalConnection) {
unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection(); // depends on control dependency: [if], data = [none]
} else if (obj instanceof WrapSegment) {
unwrapped = (O) ((WrapSegment) obj).getWrappedSegment(); // depends on control dependency: [if], data = [none]
}
assert unwrapped != null;
return unwrapped;
} } |
public class class_name {
public static CopyState getCopyState(final HttpURLConnection request) throws URISyntaxException, ParseException {
String copyStatusString = request.getHeaderField(Constants.HeaderConstants.COPY_STATUS);
if (!Utility.isNullOrEmpty(copyStatusString)) {
final CopyState copyState = new CopyState();
copyState.setStatus(CopyStatus.parse(copyStatusString));
copyState.setCopyId(request.getHeaderField(Constants.HeaderConstants.COPY_ID));
copyState.setStatusDescription(request.getHeaderField(Constants.HeaderConstants.COPY_STATUS_DESCRIPTION));
final String copyProgressString = request.getHeaderField(Constants.HeaderConstants.COPY_PROGRESS);
if (!Utility.isNullOrEmpty(copyProgressString)) {
String[] progressSequence = copyProgressString.split("/");
copyState.setBytesCopied(Long.parseLong(progressSequence[0]));
copyState.setTotalBytes(Long.parseLong(progressSequence[1]));
}
final String copySourceString = request.getHeaderField(Constants.HeaderConstants.COPY_SOURCE);
if (!Utility.isNullOrEmpty(copySourceString)) {
copyState.setSource(new URI(copySourceString));
}
final String copyCompletionTimeString =
request.getHeaderField(Constants.HeaderConstants.COPY_COMPLETION_TIME);
if (!Utility.isNullOrEmpty(copyCompletionTimeString)) {
copyState.setCompletionTime(Utility.parseRFC1123DateFromStringInGMT(copyCompletionTimeString));
}
return copyState;
}
else {
return null;
}
} } | public class class_name {
public static CopyState getCopyState(final HttpURLConnection request) throws URISyntaxException, ParseException {
String copyStatusString = request.getHeaderField(Constants.HeaderConstants.COPY_STATUS);
if (!Utility.isNullOrEmpty(copyStatusString)) {
final CopyState copyState = new CopyState();
copyState.setStatus(CopyStatus.parse(copyStatusString));
copyState.setCopyId(request.getHeaderField(Constants.HeaderConstants.COPY_ID));
copyState.setStatusDescription(request.getHeaderField(Constants.HeaderConstants.COPY_STATUS_DESCRIPTION));
final String copyProgressString = request.getHeaderField(Constants.HeaderConstants.COPY_PROGRESS);
if (!Utility.isNullOrEmpty(copyProgressString)) {
String[] progressSequence = copyProgressString.split("/");
copyState.setBytesCopied(Long.parseLong(progressSequence[0])); // depends on control dependency: [if], data = [none]
copyState.setTotalBytes(Long.parseLong(progressSequence[1])); // depends on control dependency: [if], data = [none]
}
final String copySourceString = request.getHeaderField(Constants.HeaderConstants.COPY_SOURCE);
if (!Utility.isNullOrEmpty(copySourceString)) {
copyState.setSource(new URI(copySourceString)); // depends on control dependency: [if], data = [none]
}
final String copyCompletionTimeString =
request.getHeaderField(Constants.HeaderConstants.COPY_COMPLETION_TIME);
if (!Utility.isNullOrEmpty(copyCompletionTimeString)) {
copyState.setCompletionTime(Utility.parseRFC1123DateFromStringInGMT(copyCompletionTimeString)); // depends on control dependency: [if], data = [none]
}
return copyState;
}
else {
return null;
}
} } |
public class class_name {
private Map<Feature, Feature> diffFeatures(List<Feature> pcm1Features, List<Feature> pcm2Features, PCMElementComparator comparator, DiffResult result) {
List<Feature> commonFeatures = new ArrayList<Feature>();
List<Feature> featuresOnlyInPCM1 = new ArrayList<Feature>();
List<Feature> featuresOnlyInPCM2 = new ArrayList<Feature>(pcm2Features);
Map<Feature, Feature> equivalentFeatures = new HashMap<Feature, Feature>();
for (Feature f1 : pcm1Features) {
boolean similarFeature = false;
for (Feature f2 : pcm2Features) {
similarFeature = comparator.similarFeature(f1, f2);
if (similarFeature) {
commonFeatures.add(f1);
featuresOnlyInPCM2.remove(f2);
equivalentFeatures.put(f1, f2);
break;
}
}
if (!similarFeature) {
featuresOnlyInPCM1.add(f1);
}
}
result.setCommonFeatures(commonFeatures);
result.setFeaturesOnlyInPCM1(featuresOnlyInPCM1);
result.setFeaturesOnlyInPCM2(featuresOnlyInPCM2);
return equivalentFeatures;
} } | public class class_name {
private Map<Feature, Feature> diffFeatures(List<Feature> pcm1Features, List<Feature> pcm2Features, PCMElementComparator comparator, DiffResult result) {
List<Feature> commonFeatures = new ArrayList<Feature>();
List<Feature> featuresOnlyInPCM1 = new ArrayList<Feature>();
List<Feature> featuresOnlyInPCM2 = new ArrayList<Feature>(pcm2Features);
Map<Feature, Feature> equivalentFeatures = new HashMap<Feature, Feature>();
for (Feature f1 : pcm1Features) {
boolean similarFeature = false;
for (Feature f2 : pcm2Features) {
similarFeature = comparator.similarFeature(f1, f2); // depends on control dependency: [for], data = [f2]
if (similarFeature) {
commonFeatures.add(f1); // depends on control dependency: [if], data = [none]
featuresOnlyInPCM2.remove(f2); // depends on control dependency: [if], data = [none]
equivalentFeatures.put(f1, f2); // depends on control dependency: [if], data = [none]
break;
}
}
if (!similarFeature) {
featuresOnlyInPCM1.add(f1); // depends on control dependency: [if], data = [none]
}
}
result.setCommonFeatures(commonFeatures);
result.setFeaturesOnlyInPCM1(featuresOnlyInPCM1);
result.setFeaturesOnlyInPCM2(featuresOnlyInPCM2);
return equivalentFeatures;
} } |
public class class_name {
final public <T> Property with(Option<T> option, T value) {
if(value != null){
options.addOrSet(option, value);
}
return this;
} } | public class class_name {
final public <T> Property with(Option<T> option, T value) {
if(value != null){
options.addOrSet(option, value); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public Collection<Event> findEvents(SearchCriteria criteria) {
if (criteria == null) {
throw new IllegalArgumentException("criteria must be non-null");
}
try {
return eventRepository.findEventsBySearchCriteria(criteria);
} catch (IOException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@Override
public Collection<Event> findEvents(SearchCriteria criteria) {
if (criteria == null) {
throw new IllegalArgumentException("criteria must be non-null");
}
try {
return eventRepository.findEventsBySearchCriteria(criteria); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> void log(RedwoodChannels channels, String description, Object obj) {
if (obj instanceof Map) {
log(channels, description, (Map)obj);
} else if (obj instanceof PrettyLoggable) {
((PrettyLoggable) obj).prettyLog(channels, description);
} else if (obj instanceof Dictionary) {
log(channels, description, (Dictionary)obj);
} else if (obj instanceof Iterable) {
log(channels, description, (Iterable)obj);
} else if (obj.getClass().isArray()) {
Object[] arrayCopy; // the array to log
if(obj.getClass().getComponentType().isPrimitive()){
//(case: a primitive array)
Class componentClass = obj.getClass().getComponentType();
if(boolean.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((boolean[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((boolean[]) obj)[i]; }
} else if(byte.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((byte[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((byte[]) obj)[i]; }
} else if(char.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((char[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((char[]) obj)[i]; }
} else if(short.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((short[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((short[]) obj)[i]; }
} else if(int.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((int[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((int[]) obj)[i]; }
} else if(long.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((long[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((long[]) obj)[i]; }
} else if(float.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((float[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((float[]) obj)[i]; }
} else if(double.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((double[]) obj).length];
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((double[]) obj)[i]; }
} else {
throw new IllegalStateException("I forgot about the primitive class: " + componentClass);
}
} else {
//(case: a regular array)
arrayCopy = (T[]) obj;
}
log(channels, description, arrayCopy);
} else {
if (!description.equals("")) {
description += ": ";
}
channels.log(description + obj);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> void log(RedwoodChannels channels, String description, Object obj) {
if (obj instanceof Map) {
log(channels, description, (Map)obj);
// depends on control dependency: [if], data = [none]
} else if (obj instanceof PrettyLoggable) {
((PrettyLoggable) obj).prettyLog(channels, description);
// depends on control dependency: [if], data = [none]
} else if (obj instanceof Dictionary) {
log(channels, description, (Dictionary)obj);
// depends on control dependency: [if], data = [none]
} else if (obj instanceof Iterable) {
log(channels, description, (Iterable)obj);
// depends on control dependency: [if], data = [none]
} else if (obj.getClass().isArray()) {
Object[] arrayCopy; // the array to log
if(obj.getClass().getComponentType().isPrimitive()){
//(case: a primitive array)
Class componentClass = obj.getClass().getComponentType();
if(boolean.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((boolean[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((boolean[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(byte.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((byte[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((byte[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(char.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((char[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((char[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(short.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((short[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((short[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(int.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((int[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((int[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(long.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((long[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((long[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(float.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((float[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((float[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else if(double.class.isAssignableFrom(componentClass)){
arrayCopy = new Object[((double[]) obj).length];
// depends on control dependency: [if], data = [none]
for(int i=0; i<arrayCopy.length; i++){ arrayCopy[i] = ((double[]) obj)[i]; }
// depends on control dependency: [for], data = [i]
} else {
throw new IllegalStateException("I forgot about the primitive class: " + componentClass);
}
} else {
//(case: a regular array)
arrayCopy = (T[]) obj;
// depends on control dependency: [if], data = [none]
}
log(channels, description, arrayCopy);
// depends on control dependency: [if], data = [none]
} else {
if (!description.equals("")) {
description += ": ";
// depends on control dependency: [if], data = [none]
}
channels.log(description + obj);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setActiveSession(HttpSession activeSession) {
if (log.isInfoEnabled()) {
log.info("Setting new active session for site '" + site + "': " + activeSession);
}
if (activeSession == null) {
throw new IllegalArgumentException(
"When settting an active session, a non-null session has to be provided.");
}
if (this.activeSession == activeSession) {
return;
}
if (this.activeSession != null) {
this.activeSession.setActive(false);
// If the active session was one with no tokens, delete it, as it will probably not
// match anything from this point forward
if (this.activeSession.getTokenValuesCount() == 0) {
this.removeHttpSession(this.activeSession);
} else {
// Notify the model that the session is updated
model.fireHttpSessionUpdated(this.activeSession);
}
}
this.activeSession = activeSession;
activeSession.setActive(true);
// Notify the model that the session is updated
model.fireHttpSessionUpdated(activeSession);
} } | public class class_name {
public void setActiveSession(HttpSession activeSession) {
if (log.isInfoEnabled()) {
log.info("Setting new active session for site '" + site + "': " + activeSession); // depends on control dependency: [if], data = [none]
}
if (activeSession == null) {
throw new IllegalArgumentException(
"When settting an active session, a non-null session has to be provided.");
}
if (this.activeSession == activeSession) {
return; // depends on control dependency: [if], data = [none]
}
if (this.activeSession != null) {
this.activeSession.setActive(false); // depends on control dependency: [if], data = [none]
// If the active session was one with no tokens, delete it, as it will probably not
// match anything from this point forward
if (this.activeSession.getTokenValuesCount() == 0) {
this.removeHttpSession(this.activeSession); // depends on control dependency: [if], data = [none]
} else {
// Notify the model that the session is updated
model.fireHttpSessionUpdated(this.activeSession); // depends on control dependency: [if], data = [none]
}
}
this.activeSession = activeSession;
activeSession.setActive(true);
// Notify the model that the session is updated
model.fireHttpSessionUpdated(activeSession);
} } |
public class class_name {
public void updateButtons() {
for (Button button : new Button[] {m_forward, m_fastForward}) {
button.setEnabled(m_page < m_lastPage);
}
for (Button button : new Button[] {m_back, m_fastBack}) {
button.setEnabled(m_page > 0);
}
} } | public class class_name {
public void updateButtons() {
for (Button button : new Button[] {m_forward, m_fastForward}) {
button.setEnabled(m_page < m_lastPage); // depends on control dependency: [for], data = [button]
}
for (Button button : new Button[] {m_back, m_fastBack}) {
button.setEnabled(m_page > 0); // depends on control dependency: [for], data = [button]
}
} } |
public class class_name {
protected void checkJavaSerialization(String variableName, TypedValue value) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) {
SerializableValue serializableValue = (SerializableValue) value;
// if Java serialization is prohibited
if (!serializableValue.isDeserialized()) {
String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName();
String requestedDataFormat = serializableValue.getSerializationDataFormat();
if (requestedDataFormat == null) {
// check if Java serializer will be used
final TypedValueSerializer serializerForValue = TypedValueField.getSerializers()
.findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory());
if (serializerForValue != null) {
requestedDataFormat = serializerForValue.getSerializationDataformat();
}
}
if (javaSerializationDataFormat.equals(requestedDataFormat)) {
throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName);
}
}
}
} } | public class class_name {
protected void checkJavaSerialization(String variableName, TypedValue value) {
ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();
if (value instanceof SerializableValue && !processEngineConfiguration.isJavaSerializationFormatEnabled()) {
SerializableValue serializableValue = (SerializableValue) value;
// if Java serialization is prohibited
if (!serializableValue.isDeserialized()) {
String javaSerializationDataFormat = Variables.SerializationDataFormats.JAVA.getName();
String requestedDataFormat = serializableValue.getSerializationDataFormat();
if (requestedDataFormat == null) {
// check if Java serializer will be used
final TypedValueSerializer serializerForValue = TypedValueField.getSerializers()
.findSerializerForValue(serializableValue, processEngineConfiguration.getFallbackSerializerFactory());
if (serializerForValue != null) {
requestedDataFormat = serializerForValue.getSerializationDataformat(); // depends on control dependency: [if], data = [none]
}
}
if (javaSerializationDataFormat.equals(requestedDataFormat)) {
throw ProcessEngineLogger.CORE_LOGGER.javaSerializationProhibitedException(variableName);
}
}
}
} } |
public class class_name {
public String toFtpCmdArgument() {
if (this.sporCommandParam == null && this.vector != null) {
StringBuffer cmd = new StringBuffer();
for (int i = 0; i < this.vector.size(); i ++) {
HostPort hp = (HostPort)this.vector.get(i);
if (i != 0) {
cmd.append(' ');
}
cmd.append(hp.toFtpCmdArgument());
}
this.sporCommandParam = cmd.toString();
}
return this.sporCommandParam;
} } | public class class_name {
public String toFtpCmdArgument() {
if (this.sporCommandParam == null && this.vector != null) {
StringBuffer cmd = new StringBuffer();
for (int i = 0; i < this.vector.size(); i ++) {
HostPort hp = (HostPort)this.vector.get(i);
if (i != 0) {
cmd.append(' '); // depends on control dependency: [if], data = [none]
}
cmd.append(hp.toFtpCmdArgument()); // depends on control dependency: [for], data = [none]
}
this.sporCommandParam = cmd.toString(); // depends on control dependency: [if], data = [none]
}
return this.sporCommandParam;
} } |
public class class_name {
private List<Thread> tryUpdateBlock(int namespaceId,
Block oldblock, Block newblock) throws IOException {
lock.writeLock().lock();
try {
//check ongoing create threads
ArrayList<Thread> activeThreads = getActiveThreads(namespaceId, oldblock);
if (activeThreads != null) {
return activeThreads;
}
DatanodeBlockInfo binfo = volumeMap.get(namespaceId, oldblock);
if (binfo == null) {
throw new IOException("Block " + oldblock
+ " doesn't exist or has been recovered to a new generation ");
}
File blockFile = binfo.getBlockDataFile().getFile();
long oldgs;
File oldMetaFile = null;
if (binfo.isInlineChecksum()) {
oldgs = BlockInlineChecksumReader
.getGenerationStampFromInlineChecksumFile(blockFile.getName());
} else {
oldMetaFile = BlockWithChecksumFileWriter.findMetaFile(blockFile);
oldgs = BlockWithChecksumFileReader.parseGenerationStampInMetaFile(
blockFile, oldMetaFile);
}
// First validate the update
//update generation stamp
if (oldgs > newblock.getGenerationStamp()) {
throw new IOException("Cannot update block (id=" + newblock.getBlockId()
+ ") generation stamp from " + oldgs
+ " to " + newblock.getGenerationStamp());
}
//update length
if (newblock.getNumBytes() > oldblock.getNumBytes()) {
throw new IOException("Cannot update block file (=" + blockFile
+ ") length from " + oldblock.getNumBytes() + " to " + newblock.getNumBytes());
}
// Although we've waited for the active threads all dead before updating
// the map so there should be no data race there, we still create new
// ActiveFile object to make sure in case another thread holds it,
// it won't cause any problem for us.
//
try {
volumeMap.copyOngoingCreates(namespaceId, oldblock);
} catch (CloneNotSupportedException e) {
// It should never happen.
throw new IOException("Cannot clone ActiveFile object", e);
}
// Now perform the update
File tmpMetaFile = null;
if (!binfo.isInlineChecksum()) {
// rename meta file to a tmp file
tmpMetaFile = new File(oldMetaFile.getParent(),
oldMetaFile.getName() + "_tmp" + newblock.getGenerationStamp());
if (!oldMetaFile.renameTo(tmpMetaFile)) {
throw new IOException("Cannot rename block meta file to " + tmpMetaFile);
}
}
long oldBlockLength;
if (!binfo.isInlineChecksum()) {
oldBlockLength = blockFile.length();
} else {
oldBlockLength = BlockInlineChecksumReader.getBlockSizeFromFileLength(
blockFile.length(), binfo.getChecksumType(),
binfo.getBytesPerChecksum());
}
ActiveFile file = null;
if (newblock.getNumBytes() < oldBlockLength) {
if (!binfo.isInlineChecksum()) {
new BlockWithChecksumFileWriter(binfo.getBlockDataFile(), tmpMetaFile)
.truncateBlock(oldBlockLength, newblock.getNumBytes());
} else {
new BlockInlineChecksumWriter(binfo.getBlockDataFile(), binfo.getChecksumType(),
binfo.getBytesPerChecksum(), datanode.writePacketSize)
.truncateBlock(newblock.getNumBytes());
}
file = volumeMap.getOngoingCreates(namespaceId, oldblock);
if (file != null) {
file.setBytesAcked(newblock.getNumBytes());
file.setBytesOnDisk(newblock.getNumBytes());
file.setBytesReceived(newblock.getNumBytes());
} else {
// This should never happen unless called from unit tests.
binfo.syncInMemorySize();
}
}
String newDataFileName;
if (!binfo.isInlineChecksum()) {
//rename the tmp file to the new meta file (with new generation stamp)
File newMetaFile = BlockWithChecksumFileWriter.getMetaFile(blockFile, newblock);
if (!tmpMetaFile.renameTo(newMetaFile)) {
throw new IOException("Cannot rename tmp meta file to " + newMetaFile);
}
} else {
newDataFileName = BlockInlineChecksumWriter.getInlineChecksumFileName(
newblock, binfo.getChecksumType(), binfo.getBytesPerChecksum());
File newDataFile = new File(blockFile.getParent(), newDataFileName);
if (!blockFile.renameTo(newDataFile)) {
throw new IOException("Cannot rename data file to " + newDataFileName);
}
// fsyncIfPossible parent directory to persist rename.
if (datanode.syncOnClose) {
NativeIO.fsyncIfPossible(newDataFile.getParent());
}
setDataFileForBlock(namespaceId, oldblock, newDataFile);
}
if(volumeMap.getOngoingCreates(namespaceId, oldblock) != null){
ActiveFile af = volumeMap.removeOngoingCreates(namespaceId, oldblock);
volumeMap.addOngoingCreates(namespaceId, newblock, af);
}
volumeMap.update(namespaceId, oldblock, newblock);
// paranoia! verify that the contents of the stored block
// matches the block file on disk.
validateBlockMetadata(namespaceId, newblock);
return null;
} finally {
lock.writeLock().unlock();
}
} } | public class class_name {
private List<Thread> tryUpdateBlock(int namespaceId,
Block oldblock, Block newblock) throws IOException {
lock.writeLock().lock();
try {
//check ongoing create threads
ArrayList<Thread> activeThreads = getActiveThreads(namespaceId, oldblock);
if (activeThreads != null) {
return activeThreads; // depends on control dependency: [if], data = [none]
}
DatanodeBlockInfo binfo = volumeMap.get(namespaceId, oldblock);
if (binfo == null) {
throw new IOException("Block " + oldblock
+ " doesn't exist or has been recovered to a new generation ");
}
File blockFile = binfo.getBlockDataFile().getFile();
long oldgs;
File oldMetaFile = null;
if (binfo.isInlineChecksum()) {
oldgs = BlockInlineChecksumReader
.getGenerationStampFromInlineChecksumFile(blockFile.getName());
} else {
oldMetaFile = BlockWithChecksumFileWriter.findMetaFile(blockFile);
oldgs = BlockWithChecksumFileReader.parseGenerationStampInMetaFile(
blockFile, oldMetaFile);
}
// First validate the update
//update generation stamp
if (oldgs > newblock.getGenerationStamp()) {
throw new IOException("Cannot update block (id=" + newblock.getBlockId()
+ ") generation stamp from " + oldgs
+ " to " + newblock.getGenerationStamp());
}
//update length
if (newblock.getNumBytes() > oldblock.getNumBytes()) {
throw new IOException("Cannot update block file (=" + blockFile
+ ") length from " + oldblock.getNumBytes() + " to " + newblock.getNumBytes());
}
// Although we've waited for the active threads all dead before updating
// the map so there should be no data race there, we still create new
// ActiveFile object to make sure in case another thread holds it,
// it won't cause any problem for us.
//
try {
volumeMap.copyOngoingCreates(namespaceId, oldblock);
} catch (CloneNotSupportedException e) {
// It should never happen.
throw new IOException("Cannot clone ActiveFile object", e);
}
// Now perform the update
File tmpMetaFile = null;
if (!binfo.isInlineChecksum()) {
// rename meta file to a tmp file
tmpMetaFile = new File(oldMetaFile.getParent(),
oldMetaFile.getName() + "_tmp" + newblock.getGenerationStamp());
if (!oldMetaFile.renameTo(tmpMetaFile)) {
throw new IOException("Cannot rename block meta file to " + tmpMetaFile);
}
}
long oldBlockLength;
if (!binfo.isInlineChecksum()) {
oldBlockLength = blockFile.length();
} else {
oldBlockLength = BlockInlineChecksumReader.getBlockSizeFromFileLength(
blockFile.length(), binfo.getChecksumType(),
binfo.getBytesPerChecksum());
}
ActiveFile file = null;
if (newblock.getNumBytes() < oldBlockLength) {
if (!binfo.isInlineChecksum()) {
new BlockWithChecksumFileWriter(binfo.getBlockDataFile(), tmpMetaFile)
.truncateBlock(oldBlockLength, newblock.getNumBytes());
} else {
new BlockInlineChecksumWriter(binfo.getBlockDataFile(), binfo.getChecksumType(),
binfo.getBytesPerChecksum(), datanode.writePacketSize)
.truncateBlock(newblock.getNumBytes());
}
file = volumeMap.getOngoingCreates(namespaceId, oldblock);
if (file != null) {
file.setBytesAcked(newblock.getNumBytes());
file.setBytesOnDisk(newblock.getNumBytes());
file.setBytesReceived(newblock.getNumBytes());
} else {
// This should never happen unless called from unit tests.
binfo.syncInMemorySize();
}
}
String newDataFileName;
if (!binfo.isInlineChecksum()) {
//rename the tmp file to the new meta file (with new generation stamp)
File newMetaFile = BlockWithChecksumFileWriter.getMetaFile(blockFile, newblock);
if (!tmpMetaFile.renameTo(newMetaFile)) {
throw new IOException("Cannot rename tmp meta file to " + newMetaFile);
}
} else {
newDataFileName = BlockInlineChecksumWriter.getInlineChecksumFileName(
newblock, binfo.getChecksumType(), binfo.getBytesPerChecksum());
File newDataFile = new File(blockFile.getParent(), newDataFileName);
if (!blockFile.renameTo(newDataFile)) {
throw new IOException("Cannot rename data file to " + newDataFileName);
}
// fsyncIfPossible parent directory to persist rename.
if (datanode.syncOnClose) {
NativeIO.fsyncIfPossible(newDataFile.getParent());
}
setDataFileForBlock(namespaceId, oldblock, newDataFile);
}
if(volumeMap.getOngoingCreates(namespaceId, oldblock) != null){
ActiveFile af = volumeMap.removeOngoingCreates(namespaceId, oldblock);
volumeMap.addOngoingCreates(namespaceId, newblock, af);
}
volumeMap.update(namespaceId, oldblock, newblock);
// paranoia! verify that the contents of the stored block
// matches the block file on disk.
validateBlockMetadata(namespaceId, newblock);
return null;
} finally {
lock.writeLock().unlock();
}
} } |
public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
private static Properties initProperties(String configPath, Properties configProperties) {
Map<String, String> systemProperties = ConfigUtils.filterWithPrefix(HTTL_KEY_PREFIX, (Map) System.getProperties(), false);
Map<String, String> systemEnv = ConfigUtils.filterWithPrefix(HTTL_KEY_PREFIX, System.getenv(), true);
Properties properties = ConfigUtils.mergeProperties(HTTL_DEFAULT_PROPERTIES, configPath, configProperties, systemProperties, systemEnv);
String[] modes = StringUtils.splitByComma(properties.getProperty(MODES_KEY));
if (CollectionUtils.isNotEmpty(modes)) {
Object[] configs = new Object[modes.length + 5];
configs[0] = HTTL_DEFAULT_PROPERTIES;
for (int i = 0; i < modes.length; i++) {
configs[i + 1] = HTTL_PREFIX + modes[i] + PROPERTIES_SUFFIX;
}
configs[modes.length + 1] = configPath;
configs[modes.length + 2] = configProperties;
configs[modes.length + 3] = systemProperties;
configs[modes.length + 4] = systemEnv;
properties = ConfigUtils.mergeProperties(configs);
}
properties.setProperty(ENGINE_NAME, configPath);
return properties;
} } | public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
private static Properties initProperties(String configPath, Properties configProperties) {
Map<String, String> systemProperties = ConfigUtils.filterWithPrefix(HTTL_KEY_PREFIX, (Map) System.getProperties(), false);
Map<String, String> systemEnv = ConfigUtils.filterWithPrefix(HTTL_KEY_PREFIX, System.getenv(), true);
Properties properties = ConfigUtils.mergeProperties(HTTL_DEFAULT_PROPERTIES, configPath, configProperties, systemProperties, systemEnv);
String[] modes = StringUtils.splitByComma(properties.getProperty(MODES_KEY));
if (CollectionUtils.isNotEmpty(modes)) {
Object[] configs = new Object[modes.length + 5];
configs[0] = HTTL_DEFAULT_PROPERTIES; // depends on control dependency: [if], data = [none]
for (int i = 0; i < modes.length; i++) {
configs[i + 1] = HTTL_PREFIX + modes[i] + PROPERTIES_SUFFIX; // depends on control dependency: [for], data = [i]
}
configs[modes.length + 1] = configPath; // depends on control dependency: [if], data = [none]
configs[modes.length + 2] = configProperties; // depends on control dependency: [if], data = [none]
configs[modes.length + 3] = systemProperties; // depends on control dependency: [if], data = [none]
configs[modes.length + 4] = systemEnv; // depends on control dependency: [if], data = [none]
properties = ConfigUtils.mergeProperties(configs); // depends on control dependency: [if], data = [none]
}
properties.setProperty(ENGINE_NAME, configPath);
return properties;
} } |
public class class_name {
public void setResultList(java.util.Collection<BatchDetectSentimentItemResult> resultList) {
if (resultList == null) {
this.resultList = null;
return;
}
this.resultList = new java.util.ArrayList<BatchDetectSentimentItemResult>(resultList);
} } | public class class_name {
public void setResultList(java.util.Collection<BatchDetectSentimentItemResult> resultList) {
if (resultList == null) {
this.resultList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.resultList = new java.util.ArrayList<BatchDetectSentimentItemResult>(resultList);
} } |
public class class_name {
@Override
public INDArray exec(RandomOp op, Random rng) {
if (rng.getStateBuffer() == null)
throw new IllegalStateException(
"You should use one of NativeRandom classes for NativeOperations execution");
long st = profilingHookIn(op);
validateDataType(Nd4j.dataType(), op);
if (op.x() != null && op.y() != null && op.z() != null) {
// triple arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.y().data().addressPointer(),
(LongPointer) op.y().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer());
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.y().data().addressPointer(),
(LongPointer) op.y().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer());
}
} else if (op.x() != null && op.z() != null) {
//double arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer());
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer());
}
} else {
// single arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer());
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer());
}
}
profilingHookOut(op, st);
return op.z();
} } | public class class_name {
@Override
public INDArray exec(RandomOp op, Random rng) {
if (rng.getStateBuffer() == null)
throw new IllegalStateException(
"You should use one of NativeRandom classes for NativeOperations execution");
long st = profilingHookIn(op);
validateDataType(Nd4j.dataType(), op);
if (op.x() != null && op.y() != null && op.z() != null) {
// triple arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.y().data().addressPointer(),
(LongPointer) op.y().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.y().data().addressPointer(),
(LongPointer) op.y().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
}
} else if (op.x() != null && op.z() != null) {
//double arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.x().data().addressPointer(),
(LongPointer) op.x().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
}
} else {
// single arg call
if (Nd4j.dataType() == DataBuffer.Type.FLOAT) {
loop.execRandomFloat(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(FloatPointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(FloatPointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
} else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) {
loop.execRandomDouble(null, op.opNum(), rng.getStatePointer(), // rng state ptr
(DoublePointer) op.z().data().addressPointer(),
(LongPointer) op.z().shapeInfoDataBuffer().addressPointer(),
(DoublePointer) op.extraArgsDataBuff().addressPointer()); // depends on control dependency: [if], data = [none]
}
}
profilingHookOut(op, st);
return op.z();
} } |
public class class_name {
@Override
public void removeByC_S(long commerceOrderId, boolean subscription) {
for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId,
subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrderItem);
}
} } | public class class_name {
@Override
public void removeByC_S(long commerceOrderId, boolean subscription) {
for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId,
subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrderItem); // depends on control dependency: [for], data = [commerceOrderItem]
}
} } |
public class class_name {
public static Vector subtract(Vector vector1, Vector vector2) {
if (vector2.length() != vector1.length())
throw new IllegalArgumentException(
"Vectors of different sizes cannot be added");
if (vector2 instanceof IntegerVector &&
vector1 instanceof DoubleVector)
return subtract(vector1, Vectors.asDouble(vector2));
if (vector2 instanceof SparseVector)
subtractSparseValues(vector1, vector2);
else {
for (int i = 0; i < vector2.length(); ++i) {
double value = vector1.getValue(i).doubleValue() -
vector2.getValue(i).doubleValue();
vector1.set(i, value);
}
}
return vector1;
} } | public class class_name {
public static Vector subtract(Vector vector1, Vector vector2) {
if (vector2.length() != vector1.length())
throw new IllegalArgumentException(
"Vectors of different sizes cannot be added");
if (vector2 instanceof IntegerVector &&
vector1 instanceof DoubleVector)
return subtract(vector1, Vectors.asDouble(vector2));
if (vector2 instanceof SparseVector)
subtractSparseValues(vector1, vector2);
else {
for (int i = 0; i < vector2.length(); ++i) {
double value = vector1.getValue(i).doubleValue() -
vector2.getValue(i).doubleValue();
vector1.set(i, value); // depends on control dependency: [for], data = [i]
}
}
return vector1;
} } |
public class class_name {
public void iterateOverMFileCollection(Visitor visit) throws IOException {
if (debug) System.out.printf(" iterateOverMFileCollection %s ", collectionDir);
int count = 0;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(collectionDir, new MyStreamFilter())) {
for (Path p : ds) {
try {
BasicFileAttributes attr = Files.readAttributes(p, BasicFileAttributes.class);
if (!attr.isDirectory())
visit.consume(new MFileOS7(p));
if (debug) System.out.printf("%d ", count++);
} catch (IOException ioe) {
// catch error and skip file
logger.error("Failed to read attributes from file found in Files.newDirectoryStream ", ioe);
}
}
}
if (debug) System.out.printf("%d%n", count);
} } | public class class_name {
public void iterateOverMFileCollection(Visitor visit) throws IOException {
if (debug) System.out.printf(" iterateOverMFileCollection %s ", collectionDir);
int count = 0;
try (DirectoryStream<Path> ds = Files.newDirectoryStream(collectionDir, new MyStreamFilter())) {
for (Path p : ds) {
try {
BasicFileAttributes attr = Files.readAttributes(p, BasicFileAttributes.class);
if (!attr.isDirectory())
visit.consume(new MFileOS7(p));
if (debug) System.out.printf("%d ", count++);
} catch (IOException ioe) {
// catch error and skip file
logger.error("Failed to read attributes from file found in Files.newDirectoryStream ", ioe);
} // depends on control dependency: [catch], data = [none]
}
}
if (debug) System.out.printf("%d%n", count);
} } |
public class class_name {
final public void andExpression() throws ParseException {
equalityExpression();
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
case 14:
;
break;
default:
jj_la1[11] = jj_gen;
break label_6;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
jj_consume_token(13);
break;
case 14:
jj_consume_token(14);
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ASTBitAnd jjtn001 = new ASTBitAnd(JJTBITAND);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
equalityExpression();
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001);
jjtc001 = false;
} else {
jjtree.popNode();
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, 2);
}
}
}
} } | public class class_name {
final public void andExpression() throws ParseException {
equalityExpression();
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
case 14:
;
break;
default:
jj_la1[11] = jj_gen;
break label_6;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 13:
jj_consume_token(13);
break;
case 14:
jj_consume_token(14);
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ASTBitAnd jjtn001 = new ASTBitAnd(JJTBITAND);
boolean jjtc001 = true;
jjtree.openNodeScope(jjtn001);
try {
equalityExpression();
} catch (Throwable jjte001) {
if (jjtc001) {
jjtree.clearNodeScope(jjtn001); // depends on control dependency: [if], data = [none]
jjtc001 = false; // depends on control dependency: [if], data = [none]
} else {
jjtree.popNode(); // depends on control dependency: [if], data = [none]
}
if (jjte001 instanceof RuntimeException) {
{if (true) throw (RuntimeException)jjte001;}
}
if (jjte001 instanceof ParseException) {
{if (true) throw (ParseException)jjte001;}
}
{if (true) throw (Error)jjte001;}
} finally {
if (jjtc001) {
jjtree.closeNodeScope(jjtn001, 2); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> T retain(T msg) {
if (msg instanceof ReferenceCounted) {
return (T) ((ReferenceCounted) msg).retain();
}
return msg;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> T retain(T msg) {
if (msg instanceof ReferenceCounted) {
return (T) ((ReferenceCounted) msg).retain(); // depends on control dependency: [if], data = [none]
}
return msg;
} } |
public class class_name {
public void marshall(UpdateConfigurationSetEventDestinationRequest updateConfigurationSetEventDestinationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateConfigurationSetEventDestinationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING);
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getEventDestinationName(), EVENTDESTINATIONNAME_BINDING);
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getEventDestination(), EVENTDESTINATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateConfigurationSetEventDestinationRequest updateConfigurationSetEventDestinationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateConfigurationSetEventDestinationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getEventDestinationName(), EVENTDESTINATIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateConfigurationSetEventDestinationRequest.getEventDestination(), EVENTDESTINATION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void changeSign(DMatrixD1 input , DMatrixD1 output)
{
output.reshape(input.numRows,input.numCols);
final int size = input.getNumElements();
for( int i = 0; i < size; i++ ) {
output.data[i] = -input.data[i];
}
} } | public class class_name {
public static void changeSign(DMatrixD1 input , DMatrixD1 output)
{
output.reshape(input.numRows,input.numCols);
final int size = input.getNumElements();
for( int i = 0; i < size; i++ ) {
output.data[i] = -input.data[i]; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void addJobToRunLater(Vector<AutoTask> vJobsToRunLater, AutoTask jobToAdd)
{
if (jobToAdd.getProperty(NO_DUPLICATE) != null)
{
Date timeJobToAdd = (Date)jobToAdd.getProperties().get(TIME_TO_RUN);
for (int iIndex = 0; iIndex < vJobsToRunLater.size(); iIndex++)
{
AutoTask jobAtIndex = vJobsToRunLater.elementAt(iIndex);
if (this.sameJob(jobAtIndex, jobToAdd))
{
Date timeJobAtIndex = (Date)jobAtIndex.getProperties().get(TIME_TO_RUN);
if (timeJobAtIndex.getTime() > timeJobToAdd.getTime())
{
jobAtIndex.free(); // Being careful (this may have been added to application)
vJobsToRunLater.setElementAt(jobToAdd, iIndex); // This job is earlier, replace the one in the list
}
else
jobToAdd.free();
return; // Either way, this duplicate has been resolved
}
}
}
// No match, add this one to the end.
vJobsToRunLater.add(jobToAdd);
} } | public class class_name {
public void addJobToRunLater(Vector<AutoTask> vJobsToRunLater, AutoTask jobToAdd)
{
if (jobToAdd.getProperty(NO_DUPLICATE) != null)
{
Date timeJobToAdd = (Date)jobToAdd.getProperties().get(TIME_TO_RUN);
for (int iIndex = 0; iIndex < vJobsToRunLater.size(); iIndex++)
{
AutoTask jobAtIndex = vJobsToRunLater.elementAt(iIndex);
if (this.sameJob(jobAtIndex, jobToAdd))
{
Date timeJobAtIndex = (Date)jobAtIndex.getProperties().get(TIME_TO_RUN);
if (timeJobAtIndex.getTime() > timeJobToAdd.getTime())
{
jobAtIndex.free(); // Being careful (this may have been added to application) // depends on control dependency: [if], data = [none]
vJobsToRunLater.setElementAt(jobToAdd, iIndex); // This job is earlier, replace the one in the list // depends on control dependency: [if], data = [none]
}
else
jobToAdd.free();
return; // Either way, this duplicate has been resolved // depends on control dependency: [if], data = [none]
}
}
}
// No match, add this one to the end.
vJobsToRunLater.add(jobToAdd);
} } |
public class class_name {
protected void setInheritContainerData(Map<String, CmsContainerElementData> elementsData) {
m_elementData = elementsData.get(getGroupContainerWidget().getId());
if (m_elementData != null) {
m_inputDescription.setFormValueAsString(m_elementData.getDescription());
m_inputTitle.setFormValueAsString(m_elementData.getTitle());
removeAllChildren();
CmsContainerpageUtil util = getController().getContainerpageUtil();
for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
if (info.isVisible()) {
CmsContainerElementData element = getController().getCachedElement(info.getClientId());
try {
CmsContainerPageElementPanel elementWidget = util.createElement(
element,
getGroupContainerWidget(),
false);
elementWidget.setInheritanceInfo(info);
setOptionBar(elementWidget);
getGroupContainerWidget().add(elementWidget);
} catch (Exception e) {
CmsDebugLog.getInstance().printLine(e.getMessage());
}
}
}
boolean hasInvisible = false;
for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
if (!info.isVisible()) {
CmsContainerElementData element = getController().getCachedElement(info.getClientId());
try {
CmsContainerPageElementPanel elementWidget = util.createElement(
element,
getGroupContainerWidget(),
false);
elementWidget.setInheritanceInfo(info);
elementWidget.addStyleName(HIDDEN_ELEMENT_CLASS);
setOptionBar(elementWidget);
getGroupContainerWidget().add(elementWidget);
Element elementOverlay = DOM.createDiv();
elementOverlay.setClassName(HIDDEN_ELEMENT_OVERLAY_CLASS);
elementWidget.getElement().appendChild(elementOverlay);
hasInvisible = true;
} catch (Exception e) {
CmsDebugLog.getInstance().printLine(e.getMessage());
}
}
}
if (hasInvisible) {
m_showElementsButton.enable();
}
}
getGroupContainerWidget().refreshHighlighting();
setSaveEnabled(true, null);
} } | public class class_name {
protected void setInheritContainerData(Map<String, CmsContainerElementData> elementsData) {
m_elementData = elementsData.get(getGroupContainerWidget().getId());
if (m_elementData != null) {
m_inputDescription.setFormValueAsString(m_elementData.getDescription());
// depends on control dependency: [if], data = [(m_elementData]
m_inputTitle.setFormValueAsString(m_elementData.getTitle());
// depends on control dependency: [if], data = [(m_elementData]
removeAllChildren();
// depends on control dependency: [if], data = [none]
CmsContainerpageUtil util = getController().getContainerpageUtil();
for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
if (info.isVisible()) {
CmsContainerElementData element = getController().getCachedElement(info.getClientId());
try {
CmsContainerPageElementPanel elementWidget = util.createElement(
element,
getGroupContainerWidget(),
false);
elementWidget.setInheritanceInfo(info);
// depends on control dependency: [try], data = [none]
setOptionBar(elementWidget);
// depends on control dependency: [try], data = [none]
getGroupContainerWidget().add(elementWidget);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
CmsDebugLog.getInstance().printLine(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
}
}
boolean hasInvisible = false;
for (CmsInheritanceInfo info : m_elementData.getInheritanceInfos()) {
if (!info.isVisible()) {
CmsContainerElementData element = getController().getCachedElement(info.getClientId());
try {
CmsContainerPageElementPanel elementWidget = util.createElement(
element,
getGroupContainerWidget(),
false);
elementWidget.setInheritanceInfo(info);
// depends on control dependency: [try], data = [none]
elementWidget.addStyleName(HIDDEN_ELEMENT_CLASS);
// depends on control dependency: [try], data = [none]
setOptionBar(elementWidget);
// depends on control dependency: [try], data = [none]
getGroupContainerWidget().add(elementWidget);
// depends on control dependency: [try], data = [none]
Element elementOverlay = DOM.createDiv();
elementOverlay.setClassName(HIDDEN_ELEMENT_OVERLAY_CLASS);
// depends on control dependency: [try], data = [none]
elementWidget.getElement().appendChild(elementOverlay);
// depends on control dependency: [try], data = [none]
hasInvisible = true;
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
CmsDebugLog.getInstance().printLine(e.getMessage());
}
// depends on control dependency: [catch], data = [none]
}
}
if (hasInvisible) {
m_showElementsButton.enable();
// depends on control dependency: [if], data = [none]
}
}
getGroupContainerWidget().refreshHighlighting();
setSaveEnabled(true, null);
} } |
public class class_name {
public org.jbundle.util.osgi.ClassFinder getClassFinder(Object context)
{
if (!classServiceAvailable)
return null;
try {
if (classFinder == null)
{
Class.forName("org.osgi.framework.BundleActivator"); // This tests to see if osgi exists
//classFinder = (org.jbundle.util.osgi.ClassFinder)org.jbundle.util.osgi.finder.ClassFinderActivator.getClassFinder(context, -1);
try { // Use reflection so the smart jvm's don't try to retrieve this class.
Class<?> clazz = Class.forName("org.jbundle.util.osgi.finder.ClassFinderActivator"); // This tests to see if osgi exists
if (clazz != null)
{
java.lang.reflect.Method method = clazz.getMethod("getClassFinder", Object.class, int.class);
if (method != null)
classFinder = (org.jbundle.util.osgi.ClassFinder)method.invoke(null, context, -1);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return classFinder;
} catch (ClassNotFoundException ex) {
classServiceAvailable = false; // Osgi is not installed, no need to keep trying
return null;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
} } | public class class_name {
public org.jbundle.util.osgi.ClassFinder getClassFinder(Object context)
{
if (!classServiceAvailable)
return null;
try {
if (classFinder == null)
{
Class.forName("org.osgi.framework.BundleActivator"); // This tests to see if osgi exists
//classFinder = (org.jbundle.util.osgi.ClassFinder)org.jbundle.util.osgi.finder.ClassFinderActivator.getClassFinder(context, -1);
try { // Use reflection so the smart jvm's don't try to retrieve this class.
Class<?> clazz = Class.forName("org.jbundle.util.osgi.finder.ClassFinderActivator"); // This tests to see if osgi exists
if (clazz != null)
{
java.lang.reflect.Method method = clazz.getMethod("getClassFinder", Object.class, int.class);
if (method != null)
classFinder = (org.jbundle.util.osgi.ClassFinder)method.invoke(null, context, -1);
}
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return classFinder; // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException ex) {
classServiceAvailable = false; // Osgi is not installed, no need to keep trying
return null;
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
ex.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void configSchema() {
TableNamingStrategy namingStrategy = null;
if (getNamingStrategy() instanceof RailsNamingStrategy) {
namingStrategy = ((RailsNamingStrategy) getNamingStrategy()).getTableNamingStrategy();
}
if (null == namingStrategy) return;
else {
// Update SeqGenerator's static variable.
// Because generator is init by hibernate,cannot inject namingStrategy.
TableSeqGenerator.namingStrategy = namingStrategy;
}
if (namingStrategy.isMultiSchema()) {
for (PersistentClass clazz : classes.values()) {
if (Strings.isEmpty(clazz.getTable().getSchema())) {
String schema = namingStrategy.getSchema(clazz.getEntityName());
if (null != schema) clazz.getTable().setSchema(schema);
}
}
for (Collection collection : collections.values()) {
final Table table = collection.getCollectionTable();
if (null == table) continue;
if (Strings.isBlank(table.getSchema())) {
String schema = namingStrategy.getSchema(collection.getOwnerEntityName());
if (null != schema) table.setSchema(schema);
}
}
}
} } | public class class_name {
private void configSchema() {
TableNamingStrategy namingStrategy = null;
if (getNamingStrategy() instanceof RailsNamingStrategy) {
namingStrategy = ((RailsNamingStrategy) getNamingStrategy()).getTableNamingStrategy(); // depends on control dependency: [if], data = [none]
}
if (null == namingStrategy) return;
else {
// Update SeqGenerator's static variable.
// Because generator is init by hibernate,cannot inject namingStrategy.
TableSeqGenerator.namingStrategy = namingStrategy; // depends on control dependency: [if], data = [none]
}
if (namingStrategy.isMultiSchema()) {
for (PersistentClass clazz : classes.values()) {
if (Strings.isEmpty(clazz.getTable().getSchema())) {
String schema = namingStrategy.getSchema(clazz.getEntityName());
if (null != schema) clazz.getTable().setSchema(schema);
}
}
for (Collection collection : collections.values()) {
final Table table = collection.getCollectionTable();
if (null == table) continue;
if (Strings.isBlank(table.getSchema())) {
String schema = namingStrategy.getSchema(collection.getOwnerEntityName());
if (null != schema) table.setSchema(schema);
}
}
}
} } |
public class class_name {
public static String toSQLNameDefault(String camelCased) {
if (camelCased.equalsIgnoreCase("_id")) {
return "_id";
}
StringBuilder sb = new StringBuilder();
char[] buf = camelCased.toCharArray();
for (int i = 0; i < buf.length; i++) {
char prevChar = (i > 0) ? buf[i - 1] : 0;
char c = buf[i];
char nextChar = (i < buf.length - 1) ? buf[i + 1] : 0;
boolean isFirstChar = (i == 0);
if (isFirstChar || Character.isLowerCase(c) || Character.isDigit(c)) {
sb.append(Character.toUpperCase(c));
} else if (Character.isUpperCase(c)) {
if (Character.isLetterOrDigit(prevChar)) {
if (Character.isLowerCase(prevChar)) {
sb.append('_').append(c);
} else if (nextChar > 0 && Character.isLowerCase(nextChar)) {
sb.append('_').append(c);
} else {
sb.append(c);
}
} else {
sb.append(c);
}
}
}
return sb.toString();
} } | public class class_name {
public static String toSQLNameDefault(String camelCased) {
if (camelCased.equalsIgnoreCase("_id")) {
return "_id"; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
char[] buf = camelCased.toCharArray();
for (int i = 0; i < buf.length; i++) {
char prevChar = (i > 0) ? buf[i - 1] : 0;
char c = buf[i];
char nextChar = (i < buf.length - 1) ? buf[i + 1] : 0;
boolean isFirstChar = (i == 0);
if (isFirstChar || Character.isLowerCase(c) || Character.isDigit(c)) {
sb.append(Character.toUpperCase(c)); // depends on control dependency: [if], data = [none]
} else if (Character.isUpperCase(c)) {
if (Character.isLetterOrDigit(prevChar)) {
if (Character.isLowerCase(prevChar)) {
sb.append('_').append(c); // depends on control dependency: [if], data = [none]
} else if (nextChar > 0 && Character.isLowerCase(nextChar)) {
sb.append('_').append(c); // depends on control dependency: [if], data = [none]
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
}
}
return sb.toString();
} } |
public class class_name {
public QueryHints with(QueryHint hint, Object value) {
if (hint == null) {
throw new IllegalArgumentException("Null hint");
}
if (value == null) {
throw new IllegalArgumentException("Null value");
}
EnumMap<QueryHint, Object> map;
if (mMap == null) {
map = new EnumMap<QueryHint, Object>(QueryHint.class);
} else {
map = mMap.clone();
}
map.put(hint, value);
return new QueryHints(map);
} } | public class class_name {
public QueryHints with(QueryHint hint, Object value) {
if (hint == null) {
throw new IllegalArgumentException("Null hint");
}
if (value == null) {
throw new IllegalArgumentException("Null value");
}
EnumMap<QueryHint, Object> map;
if (mMap == null) {
map = new EnumMap<QueryHint, Object>(QueryHint.class);
// depends on control dependency: [if], data = [none]
} else {
map = mMap.clone();
// depends on control dependency: [if], data = [none]
}
map.put(hint, value);
return new QueryHints(map);
} } |
public class class_name {
public static void crud(@NotNull String path, @NotNull CrudHandler crudHandler, @NotNull Set<Role> permittedRoles) {
path = path.startsWith("/") ? path : "/" + path;
if (path.startsWith("/:")) {
throw new IllegalArgumentException("CrudHandler requires a resource base at the beginning of the provided path e.g. '/users/:user-id'");
}
if (!path.contains("/:") || path.lastIndexOf("/") > path.lastIndexOf("/:")) {
throw new IllegalArgumentException("CrudHandler requires a path-parameter at the end of the provided path e.g. '/users/:user-id'");
}
String SEPARATOR = "/:";
String resourceBase = path.substring(0, path.lastIndexOf(SEPARATOR));
String resourceId = path.substring(path.lastIndexOf(SEPARATOR) + SEPARATOR.length());
staticInstance().get(prefixPath(path), ctx -> crudHandler.getOne(ctx, ctx.pathParam(resourceId)), permittedRoles);
staticInstance().get(prefixPath(resourceBase), crudHandler::getAll, permittedRoles);
staticInstance().post(prefixPath(resourceBase), crudHandler::create, permittedRoles);
staticInstance().patch(prefixPath(path), ctx -> crudHandler.update(ctx, ctx.pathParam(resourceId)), permittedRoles);
staticInstance().delete(prefixPath(path), ctx -> crudHandler.delete(ctx, ctx.pathParam(resourceId)), permittedRoles);
} } | public class class_name {
public static void crud(@NotNull String path, @NotNull CrudHandler crudHandler, @NotNull Set<Role> permittedRoles) {
path = path.startsWith("/") ? path : "/" + path;
if (path.startsWith("/:")) {
throw new IllegalArgumentException("CrudHandler requires a resource base at the beginning of the provided path e.g. '/users/:user-id'");
}
if (!path.contains("/:") || path.lastIndexOf("/") > path.lastIndexOf("/:")) {
throw new IllegalArgumentException("CrudHandler requires a path-parameter at the end of the provided path e.g. '/users/:user-id'");
}
String SEPARATOR = "/:";
String resourceBase = path.substring(0, path.lastIndexOf(SEPARATOR));
String resourceId = path.substring(path.lastIndexOf(SEPARATOR) + SEPARATOR.length());
staticInstance().get(prefixPath(path), ctx -> crudHandler.getOne(ctx, ctx.pathParam(resourceId)), permittedRoles); // depends on control dependency: [if], data = [none]
staticInstance().get(prefixPath(resourceBase), crudHandler::getAll, permittedRoles); // depends on control dependency: [if], data = [none]
staticInstance().post(prefixPath(resourceBase), crudHandler::create, permittedRoles); // depends on control dependency: [if], data = [none]
staticInstance().patch(prefixPath(path), ctx -> crudHandler.update(ctx, ctx.pathParam(resourceId)), permittedRoles); // depends on control dependency: [if], data = [none]
staticInstance().delete(prefixPath(path), ctx -> crudHandler.delete(ctx, ctx.pathParam(resourceId)), permittedRoles); // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public static String newTag(final String tagname, final String value,
final Map<String, String> attributes)
{
final StringBuilder xmlTag = new StringBuilder();
xmlTag.append("<").append(tagname);
if (attributes != null && !attributes.isEmpty())
{
xmlTag.append(" ");
int count = 1;
for (final Map.Entry<String, String> attributte : attributes.entrySet())
{
xmlTag.append(attributte.getKey());
xmlTag.append("=");
xmlTag.append("\"").append(attributte.getValue()).append("\"");
if (count != attributes.size())
{
xmlTag.append(" ");
}
count++;
}
}
xmlTag.append(">");
xmlTag.append(value);
xmlTag.append("</").append(tagname).append(">");
return xmlTag.toString();
} } | public class class_name {
public static String newTag(final String tagname, final String value,
final Map<String, String> attributes)
{
final StringBuilder xmlTag = new StringBuilder();
xmlTag.append("<").append(tagname);
if (attributes != null && !attributes.isEmpty())
{
xmlTag.append(" "); // depends on control dependency: [if], data = [none]
int count = 1;
for (final Map.Entry<String, String> attributte : attributes.entrySet())
{
xmlTag.append(attributte.getKey()); // depends on control dependency: [for], data = [attributte]
xmlTag.append("="); // depends on control dependency: [for], data = [none]
xmlTag.append("\"").append(attributte.getValue()).append("\""); // depends on control dependency: [for], data = [attributte]
if (count != attributes.size())
{
xmlTag.append(" "); // depends on control dependency: [if], data = [none]
}
count++; // depends on control dependency: [for], data = [none]
}
}
xmlTag.append(">");
xmlTag.append(value);
xmlTag.append("</").append(tagname).append(">");
return xmlTag.toString();
} } |
public class class_name {
public HistoryEvent createFormPropertyUpdateEvt(ExecutionEntity execution, String propertyId, String propertyValue, String taskId) {
final IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
HistoricFormPropertyEventEntity historicFormPropertyEntity = newHistoricFormPropertyEvent();
historicFormPropertyEntity.setId(idGenerator.getNextId());
historicFormPropertyEntity.setEventType(HistoryEventTypes.FORM_PROPERTY_UPDATE.getEventName());
historicFormPropertyEntity.setTimestamp(ClockUtil.getCurrentTime());
historicFormPropertyEntity.setActivityInstanceId(execution.getActivityInstanceId());
historicFormPropertyEntity.setExecutionId(execution.getId());
historicFormPropertyEntity.setProcessDefinitionId(execution.getProcessDefinitionId());
historicFormPropertyEntity.setProcessInstanceId(execution.getProcessInstanceId());
historicFormPropertyEntity.setPropertyId(propertyId);
historicFormPropertyEntity.setPropertyValue(propertyValue);
historicFormPropertyEntity.setTaskId(taskId);
historicFormPropertyEntity.setTenantId(execution.getTenantId());
historicFormPropertyEntity.setUserOperationId(Context.getCommandContext().getOperationId());
historicFormPropertyEntity.setRootProcessInstanceId(execution.getRootProcessInstanceId());
if (isHistoryRemovalTimeStrategyStart()) {
provideRemovalTime(historicFormPropertyEntity);
}
ProcessDefinitionEntity definition = execution.getProcessDefinition();
if (definition != null) {
historicFormPropertyEntity.setProcessDefinitionKey(definition.getKey());
}
// initialize sequence counter
initSequenceCounter(execution, historicFormPropertyEntity);
return historicFormPropertyEntity;
} } | public class class_name {
public HistoryEvent createFormPropertyUpdateEvt(ExecutionEntity execution, String propertyId, String propertyValue, String taskId) {
final IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
HistoricFormPropertyEventEntity historicFormPropertyEntity = newHistoricFormPropertyEvent();
historicFormPropertyEntity.setId(idGenerator.getNextId());
historicFormPropertyEntity.setEventType(HistoryEventTypes.FORM_PROPERTY_UPDATE.getEventName());
historicFormPropertyEntity.setTimestamp(ClockUtil.getCurrentTime());
historicFormPropertyEntity.setActivityInstanceId(execution.getActivityInstanceId());
historicFormPropertyEntity.setExecutionId(execution.getId());
historicFormPropertyEntity.setProcessDefinitionId(execution.getProcessDefinitionId());
historicFormPropertyEntity.setProcessInstanceId(execution.getProcessInstanceId());
historicFormPropertyEntity.setPropertyId(propertyId);
historicFormPropertyEntity.setPropertyValue(propertyValue);
historicFormPropertyEntity.setTaskId(taskId);
historicFormPropertyEntity.setTenantId(execution.getTenantId());
historicFormPropertyEntity.setUserOperationId(Context.getCommandContext().getOperationId());
historicFormPropertyEntity.setRootProcessInstanceId(execution.getRootProcessInstanceId());
if (isHistoryRemovalTimeStrategyStart()) {
provideRemovalTime(historicFormPropertyEntity); // depends on control dependency: [if], data = [none]
}
ProcessDefinitionEntity definition = execution.getProcessDefinition();
if (definition != null) {
historicFormPropertyEntity.setProcessDefinitionKey(definition.getKey()); // depends on control dependency: [if], data = [(definition]
}
// initialize sequence counter
initSequenceCounter(execution, historicFormPropertyEntity);
return historicFormPropertyEntity;
} } |
public class class_name {
public static void insertOrCreate(String key, String keyword, String nature, int freq) {
Forest dic = get(key);
if(dic==null){
dic = new Forest() ;
put(key,key,dic);
}
String[] paramers = new String[2];
paramers[0] = nature;
paramers[1] = String.valueOf(freq);
Value value = new Value(keyword, paramers);
Library.insertWord(dic, value);
} } | public class class_name {
public static void insertOrCreate(String key, String keyword, String nature, int freq) {
Forest dic = get(key);
if(dic==null){
dic = new Forest() ; // depends on control dependency: [if], data = [none]
put(key,key,dic); // depends on control dependency: [if], data = [none]
}
String[] paramers = new String[2];
paramers[0] = nature;
paramers[1] = String.valueOf(freq);
Value value = new Value(keyword, paramers);
Library.insertWord(dic, value);
} } |
public class class_name {
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) {
Object returnObject = invokeJavascript(function);
if (returnObject instanceof JSObject) {
try {
Constructor<T> constructor = returnType.getConstructor(JSObject.class);
return constructor.newInstance((JSObject) returnObject);
} catch (Exception ex) {
throw new IllegalStateException(ex);
}
} else {
return (T) returnObject;
}
} } | public class class_name {
protected <T> T invokeJavascriptReturnValue(String function, Class<T> returnType) {
Object returnObject = invokeJavascript(function);
if (returnObject instanceof JSObject) {
try {
Constructor<T> constructor = returnType.getConstructor(JSObject.class);
return constructor.newInstance((JSObject) returnObject); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new IllegalStateException(ex);
} // depends on control dependency: [catch], data = [none]
} else {
return (T) returnObject; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static String getStackTrace(final Throwable cause) {
if (cause == null) {
return null;
} else {
final StringWriter writer = new StringWriter();
cause.printStackTrace(new PrintWriter(writer));
return writer.toString();
}
} } | public class class_name {
protected static String getStackTrace(final Throwable cause) {
if (cause == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
final StringWriter writer = new StringWriter();
cause.printStackTrace(new PrintWriter(writer)); // depends on control dependency: [if], data = [none]
return writer.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void putMap(Map<String, String> map)
{
if (map == null) {
putNumber1(0);
}
else {
Utils.checkArgument(map.size() < 256, "Map has to be smaller than 256 elements");
putNumber1(map.size());
for (Entry<String, String> entry : map.entrySet()) {
if (entry.getKey().contains("=")) {
throw new IllegalArgumentException("Keys cannot contain '=' sign. " + entry);
}
if (entry.getValue().contains("=")) {
throw new IllegalArgumentException("Values cannot contain '=' sign. " + entry);
}
String val = entry.getKey() + "=" + entry.getValue();
putString(val);
}
}
} } | public class class_name {
public void putMap(Map<String, String> map)
{
if (map == null) {
putNumber1(0); // depends on control dependency: [if], data = [none]
}
else {
Utils.checkArgument(map.size() < 256, "Map has to be smaller than 256 elements"); // depends on control dependency: [if], data = [(map]
putNumber1(map.size()); // depends on control dependency: [if], data = [(map]
for (Entry<String, String> entry : map.entrySet()) {
if (entry.getKey().contains("=")) {
throw new IllegalArgumentException("Keys cannot contain '=' sign. " + entry);
}
if (entry.getValue().contains("=")) {
throw new IllegalArgumentException("Values cannot contain '=' sign. " + entry);
}
String val = entry.getKey() + "=" + entry.getValue();
putString(val); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public String getSeverityName(Severity severity) {
if (severity.equals(FacesMessage.SEVERITY_INFO)) {
return "info";
} else if (severity.equals(FacesMessage.SEVERITY_WARN)) {
return "warn";
} else if (severity.equals(FacesMessage.SEVERITY_ERROR)) {
return "error";
} else if (severity.equals(FacesMessage.SEVERITY_FATAL)) {
return "fatal";
}
throw new IllegalStateException();
} } | public class class_name {
public String getSeverityName(Severity severity) {
if (severity.equals(FacesMessage.SEVERITY_INFO)) {
return "info"; // depends on control dependency: [if], data = [none]
} else if (severity.equals(FacesMessage.SEVERITY_WARN)) {
return "warn"; // depends on control dependency: [if], data = [none]
} else if (severity.equals(FacesMessage.SEVERITY_ERROR)) {
return "error"; // depends on control dependency: [if], data = [none]
} else if (severity.equals(FacesMessage.SEVERITY_FATAL)) {
return "fatal"; // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException();
} } |
public class class_name {
public static boolean matches(AnnotatedElement annotatedElement) {
Annotation[] annotations = annotatedElement.getDeclaredAnnotations();
for (Annotation anno : annotations) {
if (anno instanceof RequireProfile) {
RequireProfile profile = (RequireProfile) anno;
if (!matches(profile)) {
return false;
}
} else if (anno instanceof RequireMode) {
RequireMode mode = (RequireMode) anno;
if (!matches(mode)) {
return false;
}
} else if (anno instanceof RequireGroup) {
RequireGroup group = (RequireGroup) anno;
if (!matches(group)) {
return false;
}
} else if (anno instanceof Profile) {
Profile profile = (Profile)anno;
if (!matches(profile)) {
return false;
}
} else if (anno instanceof Group) {
Group group = (Group) anno;
if (!matches(group)) {
return false;
}
} else if (anno instanceof Mode) {
Mode mode = (Mode) anno;
if (!matches(mode)) {
return false;
}
}
}
return true;
} } | public class class_name {
public static boolean matches(AnnotatedElement annotatedElement) {
Annotation[] annotations = annotatedElement.getDeclaredAnnotations();
for (Annotation anno : annotations) {
if (anno instanceof RequireProfile) {
RequireProfile profile = (RequireProfile) anno;
if (!matches(profile)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (anno instanceof RequireMode) {
RequireMode mode = (RequireMode) anno;
if (!matches(mode)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (anno instanceof RequireGroup) {
RequireGroup group = (RequireGroup) anno;
if (!matches(group)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (anno instanceof Profile) {
Profile profile = (Profile)anno;
if (!matches(profile)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (anno instanceof Group) {
Group group = (Group) anno;
if (!matches(group)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (anno instanceof Mode) {
Mode mode = (Mode) anno;
if (!matches(mode)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public void setPublicIpv4Pools(java.util.Collection<PublicIpv4Pool> publicIpv4Pools) {
if (publicIpv4Pools == null) {
this.publicIpv4Pools = null;
return;
}
this.publicIpv4Pools = new com.amazonaws.internal.SdkInternalList<PublicIpv4Pool>(publicIpv4Pools);
} } | public class class_name {
public void setPublicIpv4Pools(java.util.Collection<PublicIpv4Pool> publicIpv4Pools) {
if (publicIpv4Pools == null) {
this.publicIpv4Pools = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.publicIpv4Pools = new com.amazonaws.internal.SdkInternalList<PublicIpv4Pool>(publicIpv4Pools);
} } |
public class class_name {
static StringBuffer buildHTTPURL(final HttpServletRequest pRequest) {
StringBuffer resultURL = new StringBuffer();
// Scheme, as in http, https, ftp etc
String scheme = pRequest.getScheme();
resultURL.append(scheme);
resultURL.append("://");
resultURL.append(pRequest.getServerName());
// Append port only if not default port
int port = pRequest.getServerPort();
if (port > 0 &&
!(("http".equals(scheme) && port == 80) ||
("https".equals(scheme) && port == 443))) {
resultURL.append(":");
resultURL.append(port);
}
// Append URI
resultURL.append(pRequest.getRequestURI());
// If present, append extra path info
String pathInfo = pRequest.getPathInfo();
if (pathInfo != null) {
resultURL.append(pathInfo);
}
return resultURL;
} } | public class class_name {
static StringBuffer buildHTTPURL(final HttpServletRequest pRequest) {
StringBuffer resultURL = new StringBuffer();
// Scheme, as in http, https, ftp etc
String scheme = pRequest.getScheme();
resultURL.append(scheme);
resultURL.append("://");
resultURL.append(pRequest.getServerName());
// Append port only if not default port
int port = pRequest.getServerPort();
if (port > 0 &&
!(("http".equals(scheme) && port == 80) ||
("https".equals(scheme) && port == 443))) {
resultURL.append(":");
// depends on control dependency: [if], data = [none]
resultURL.append(port);
// depends on control dependency: [if], data = [(port]
}
// Append URI
resultURL.append(pRequest.getRequestURI());
// If present, append extra path info
String pathInfo = pRequest.getPathInfo();
if (pathInfo != null) {
resultURL.append(pathInfo);
// depends on control dependency: [if], data = [(pathInfo]
}
return resultURL;
} } |
public class class_name {
@Override
public Temporal addTo(Temporal temporal) {
Jdk8Methods.requireNonNull(temporal, "temporal");
if (years != 0) {
if (months != 0) {
temporal = temporal.plus(toTotalMonths(), MONTHS);
} else {
temporal = temporal.plus(years, YEARS);
}
} else if (months != 0) {
temporal = temporal.plus(months, MONTHS);
}
if (days != 0) {
temporal = temporal.plus(days, DAYS);
}
return temporal;
} } | public class class_name {
@Override
public Temporal addTo(Temporal temporal) {
Jdk8Methods.requireNonNull(temporal, "temporal");
if (years != 0) {
if (months != 0) {
temporal = temporal.plus(toTotalMonths(), MONTHS); // depends on control dependency: [if], data = [none]
} else {
temporal = temporal.plus(years, YEARS); // depends on control dependency: [if], data = [none]
}
} else if (months != 0) {
temporal = temporal.plus(months, MONTHS); // depends on control dependency: [if], data = [(months]
}
if (days != 0) {
temporal = temporal.plus(days, DAYS); // depends on control dependency: [if], data = [(days]
}
return temporal;
} } |
public class class_name {
private void touch(CmsObject cms, CmsResource resource) {
if (resource.getState().isUnchanged()) {
try {
CmsLock lock = cms.getLock(resource);
if (lock.isUnlocked() || !lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
cms.lockResourceTemporary(resource);
long now = System.currentTimeMillis();
resource.setDateLastModified(now);
cms.writeResource(resource);
if (lock.isUnlocked()) {
cms.unlockResource(resource);
}
}
} catch (CmsException e) {
LOG.warn("Could not touch resource after alias modification: " + resource.getRootPath(), e);
}
}
} } | public class class_name {
private void touch(CmsObject cms, CmsResource resource) {
if (resource.getState().isUnchanged()) {
try {
CmsLock lock = cms.getLock(resource);
if (lock.isUnlocked() || !lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) {
cms.lockResourceTemporary(resource);
// depends on control dependency: [if], data = [none]
long now = System.currentTimeMillis();
resource.setDateLastModified(now);
// depends on control dependency: [if], data = [none]
cms.writeResource(resource);
// depends on control dependency: [if], data = [none]
if (lock.isUnlocked()) {
cms.unlockResource(resource);
// depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
LOG.warn("Could not touch resource after alias modification: " + resource.getRootPath(), e);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void marshall(CreateBuildRequest createBuildRequest, ProtocolMarshaller protocolMarshaller) {
if (createBuildRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createBuildRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createBuildRequest.getVersion(), VERSION_BINDING);
protocolMarshaller.marshall(createBuildRequest.getStorageLocation(), STORAGELOCATION_BINDING);
protocolMarshaller.marshall(createBuildRequest.getOperatingSystem(), OPERATINGSYSTEM_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateBuildRequest createBuildRequest, ProtocolMarshaller protocolMarshaller) {
if (createBuildRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createBuildRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createBuildRequest.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createBuildRequest.getStorageLocation(), STORAGELOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createBuildRequest.getOperatingSystem(), OPERATINGSYSTEM_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public String getName() {
String name;
if (getSoftwareSystem() != null) {
name = getSoftwareSystem().getName() + " - Deployment";
} else {
name = "Deployment";
}
if (!StringUtils.isNullOrEmpty(getEnvironment())) {
name = name + " - " + getEnvironment();
}
return name;
} } | public class class_name {
@Override
public String getName() {
String name;
if (getSoftwareSystem() != null) {
name = getSoftwareSystem().getName() + " - Deployment"; // depends on control dependency: [if], data = [none]
} else {
name = "Deployment"; // depends on control dependency: [if], data = [none]
}
if (!StringUtils.isNullOrEmpty(getEnvironment())) {
name = name + " - " + getEnvironment(); // depends on control dependency: [if], data = [none]
}
return name;
} } |
public class class_name {
public final synchronized void remove(String name, L listener) {
if (this.map != null) {
L[] array = this.map.get(name);
if (array != null) {
for (int i = 0; i < array.length; i++) {
if (listener.equals(array[i])) {
int size = array.length - 1;
if (size > 0) {
L[] clone = newArray(size);
System.arraycopy(array, 0, clone, 0, i);
System.arraycopy(array, i + 1, clone, i, size - i);
this.map.put(name, clone);
}
else {
this.map.remove(name);
if (this.map.isEmpty()) {
this.map = null;
}
}
break;
}
}
}
}
} } | public class class_name {
public final synchronized void remove(String name, L listener) {
if (this.map != null) {
L[] array = this.map.get(name);
if (array != null) {
for (int i = 0; i < array.length; i++) {
if (listener.equals(array[i])) {
int size = array.length - 1;
if (size > 0) {
L[] clone = newArray(size);
System.arraycopy(array, 0, clone, 0, i); // depends on control dependency: [if], data = [none]
System.arraycopy(array, i + 1, clone, i, size - i); // depends on control dependency: [if], data = [none]
this.map.put(name, clone); // depends on control dependency: [if], data = [none]
}
else {
this.map.remove(name); // depends on control dependency: [if], data = [none]
if (this.map.isEmpty()) {
this.map = null; // depends on control dependency: [if], data = [none]
}
}
break;
}
}
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.