code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private void rotateLeft(int n) {
final int r = right(n);
final int lr = left(r);
right(n, lr);
if (lr != NIL) {
parent(lr, n);
}
final int p = parent(n);
parent(r, p);
if (p == NIL) {
root = r;
} else if (left(p) == n) {
left(p, r);
} else {
assert right(p) == n;
right(p, r);
}
left(r, n);
parent(n, r);
fixAggregates(n);
fixAggregates(parent(n));
} } | public class class_name {
private void rotateLeft(int n) {
final int r = right(n);
final int lr = left(r);
right(n, lr);
if (lr != NIL) {
parent(lr, n); // depends on control dependency: [if], data = [(lr]
}
final int p = parent(n);
parent(r, p);
if (p == NIL) {
root = r; // depends on control dependency: [if], data = [none]
} else if (left(p) == n) {
left(p, r); // depends on control dependency: [if], data = [none]
} else {
assert right(p) == n; // depends on control dependency: [if], data = [none]
right(p, r); // depends on control dependency: [if], data = [none]
}
left(r, n);
parent(n, r);
fixAggregates(n);
fixAggregates(parent(n));
} } |
public class class_name {
public void afterDeploy(@Observes AfterUnDeploy event) {
try {
if (!event.getDeployment().testable()) {
log.debug("Starting Citrus after suite lifecycle");
citrusInstance.get().afterSuite(configurationInstance.get().getSuiteName());
closeApplicationContext();
}
} catch (Exception e) {
log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e);
throw e;
}
} } | public class class_name {
public void afterDeploy(@Observes AfterUnDeploy event) {
try {
if (!event.getDeployment().testable()) {
log.debug("Starting Citrus after suite lifecycle"); // depends on control dependency: [if], data = [none]
citrusInstance.get().afterSuite(configurationInstance.get().getSuiteName()); // depends on control dependency: [if], data = [none]
closeApplicationContext(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e);
throw e;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setHsmList(java.util.Collection<String> hsmList) {
if (hsmList == null) {
this.hsmList = null;
return;
}
this.hsmList = new com.amazonaws.internal.SdkInternalList<String>(hsmList);
} } | public class class_name {
public void setHsmList(java.util.Collection<String> hsmList) {
if (hsmList == null) {
this.hsmList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.hsmList = new com.amazonaws.internal.SdkInternalList<String>(hsmList);
} } |
public class class_name {
protected org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateToDataFlow(Operator<T> input) {
String name = "Partition at " + partitionLocationName;
// distinguish between partition types
if (pMethod == PartitionMethod.REBALANCE) {
UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType());
PartitionOperatorBase<T> rebalancedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, name);
rebalancedInput.setInput(input);
rebalancedInput.setParallelism(getParallelism());
return rebalancedInput;
}
else if (pMethod == PartitionMethod.HASH || pMethod == PartitionMethod.CUSTOM || pMethod == PartitionMethod.RANGE) {
if (pKeys instanceof Keys.ExpressionKeys) {
int[] logicalKeyPositions = pKeys.computeLogicalKeyPositions();
UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType());
PartitionOperatorBase<T> partitionedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, logicalKeyPositions, name);
partitionedInput.setInput(input);
partitionedInput.setParallelism(getParallelism());
partitionedInput.setDistribution(distribution);
partitionedInput.setCustomPartitioner(customPartitioner);
partitionedInput.setOrdering(computeOrdering(pKeys, orders));
return partitionedInput;
}
else if (pKeys instanceof Keys.SelectorFunctionKeys) {
@SuppressWarnings("unchecked")
Keys.SelectorFunctionKeys<T, ?> selectorKeys = (Keys.SelectorFunctionKeys<T, ?>) pKeys;
return translateSelectorFunctionPartitioner(selectorKeys, pMethod, name, input, getParallelism(),
customPartitioner, orders);
}
else {
throw new UnsupportedOperationException("Unrecognized key type.");
}
}
else {
throw new UnsupportedOperationException("Unsupported partitioning method: " + pMethod.name());
}
} } | public class class_name {
protected org.apache.flink.api.common.operators.SingleInputOperator<?, T, ?> translateToDataFlow(Operator<T> input) {
String name = "Partition at " + partitionLocationName;
// distinguish between partition types
if (pMethod == PartitionMethod.REBALANCE) {
UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType());
PartitionOperatorBase<T> rebalancedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, name);
rebalancedInput.setInput(input); // depends on control dependency: [if], data = [none]
rebalancedInput.setParallelism(getParallelism()); // depends on control dependency: [if], data = [none]
return rebalancedInput; // depends on control dependency: [if], data = [none]
}
else if (pMethod == PartitionMethod.HASH || pMethod == PartitionMethod.CUSTOM || pMethod == PartitionMethod.RANGE) {
if (pKeys instanceof Keys.ExpressionKeys) {
int[] logicalKeyPositions = pKeys.computeLogicalKeyPositions();
UnaryOperatorInformation<T, T> operatorInfo = new UnaryOperatorInformation<>(getType(), getType());
PartitionOperatorBase<T> partitionedInput = new PartitionOperatorBase<>(operatorInfo, pMethod, logicalKeyPositions, name);
partitionedInput.setInput(input); // depends on control dependency: [if], data = [none]
partitionedInput.setParallelism(getParallelism()); // depends on control dependency: [if], data = [none]
partitionedInput.setDistribution(distribution); // depends on control dependency: [if], data = [none]
partitionedInput.setCustomPartitioner(customPartitioner); // depends on control dependency: [if], data = [none]
partitionedInput.setOrdering(computeOrdering(pKeys, orders)); // depends on control dependency: [if], data = [none]
return partitionedInput; // depends on control dependency: [if], data = [none]
}
else if (pKeys instanceof Keys.SelectorFunctionKeys) {
@SuppressWarnings("unchecked")
Keys.SelectorFunctionKeys<T, ?> selectorKeys = (Keys.SelectorFunctionKeys<T, ?>) pKeys;
return translateSelectorFunctionPartitioner(selectorKeys, pMethod, name, input, getParallelism(),
customPartitioner, orders); // depends on control dependency: [if], data = [none]
}
else {
throw new UnsupportedOperationException("Unrecognized key type.");
}
}
else {
throw new UnsupportedOperationException("Unsupported partitioning method: " + pMethod.name());
}
} } |
public class class_name {
private JScrollPane getScrollPane() {
if (scrollPane == null) {
scrollPane = new JScrollPane();
scrollPane.setViewportView(getTable());
}
return scrollPane;
} } | public class class_name {
private JScrollPane getScrollPane() {
if (scrollPane == null) {
scrollPane = new JScrollPane(); // depends on control dependency: [if], data = [none]
scrollPane.setViewportView(getTable()); // depends on control dependency: [if], data = [none]
}
return scrollPane;
} } |
public class class_name {
protected Class replaceWithMappedTypeForPath(final Class target) {
if (mappings == null) {
return target;
}
Class newType;
// first try alt paths
Path altPath = path.getAltPath();
if (altPath != null) {
if (!altPath.equals(path)) {
newType = mappings.get(altPath);
if (newType != null) {
return newType;
}
}
}
// now check regular paths
newType = mappings.get(path);
if (newType != null) {
return newType;
}
return target;
} } | public class class_name {
protected Class replaceWithMappedTypeForPath(final Class target) {
if (mappings == null) {
return target;
}
Class newType;
// first try alt paths
Path altPath = path.getAltPath();
if (altPath != null) {
if (!altPath.equals(path)) {
newType = mappings.get(altPath);
if (newType != null) {
return newType; // depends on control dependency: [if], data = [none]
}
}
}
// now check regular paths
newType = mappings.get(path);
if (newType != null) {
return newType;
}
return target;
} } |
public class class_name {
public void terminateAllConnections(){
this.terminationLock.lock();
try{
// close off all connections.
for (int i=0; i < this.pool.partitionCount; i++) {
this.pool.partitions[i].setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization
List<ConnectionHandle> clist = new LinkedList<ConnectionHandle>();
this.pool.partitions[i].getFreeConnections().drainTo(clist);
for (ConnectionHandle c: clist){
this.pool.destroyConnection(c);
}
}
} finally {
this.terminationLock.unlock();
}
} } | public class class_name {
public void terminateAllConnections(){
this.terminationLock.lock();
try{
// close off all connections.
for (int i=0; i < this.pool.partitionCount; i++) {
this.pool.partitions[i].setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization
// depends on control dependency: [for], data = [i]
List<ConnectionHandle> clist = new LinkedList<ConnectionHandle>();
this.pool.partitions[i].getFreeConnections().drainTo(clist);
// depends on control dependency: [for], data = [i]
for (ConnectionHandle c: clist){
this.pool.destroyConnection(c);
// depends on control dependency: [for], data = [c]
}
}
} finally {
this.terminationLock.unlock();
}
} } |
public class class_name {
private String listToString(VariableAndFunctorInterner interner, boolean isFirst, boolean printVarName,
boolean printBindings)
{
String result = "";
if (isFirst)
{
result += "[";
}
result += arguments[0].toString(interner, printVarName, printBindings);
Term consArgument = arguments[1].getValue();
if (consArgument instanceof Cons)
{
result += ", " + ((Cons) consArgument).listToString(interner, false, printVarName, printBindings);
}
if (isFirst)
{
result += "]";
}
return result;
} } | public class class_name {
private String listToString(VariableAndFunctorInterner interner, boolean isFirst, boolean printVarName,
boolean printBindings)
{
String result = "";
if (isFirst)
{
result += "["; // depends on control dependency: [if], data = [none]
}
result += arguments[0].toString(interner, printVarName, printBindings);
Term consArgument = arguments[1].getValue();
if (consArgument instanceof Cons)
{
result += ", " + ((Cons) consArgument).listToString(interner, false, printVarName, printBindings); // depends on control dependency: [if], data = [none]
}
if (isFirst)
{
result += "]"; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public boolean convert(File source, File destination) {
boolean result = true;
if (source.isDirectory()) {
if (source.getName().startsWith(".")) {
// skip "hidden" directories
return result;
}
if (destination.exists()) {
result = result && destination.isDirectory();
} else {
result = result && destination.mkdirs();
}
File[] children = source.listFiles();
for (File element : children) {
String inName = element.getName();
String outName;
if (element.isDirectory()) {
outName = inName;
} else {
outName = inName.substring(0, inName.lastIndexOf('.') + 1)
+ m_outExt;
}
result = result && convert(new File(source, inName),
new File(destination, outName));
}
return result;
} else {
try {
if (!source.getName().endsWith("." + m_inExt)) {
return result;
}
InputStream in = new FileInputStream(source);
if (!destination.getParentFile().exists()) {
destination.getParentFile().mkdirs();
}
OutputStream out = new FileOutputStream(destination);
result = result && convert(in, out);
out.close();
in.close();
return result;
} catch (IOException e) {
return false;
}
}
} } | public class class_name {
public boolean convert(File source, File destination) {
boolean result = true;
if (source.isDirectory()) {
if (source.getName().startsWith(".")) {
// skip "hidden" directories
return result; // depends on control dependency: [if], data = [none]
}
if (destination.exists()) {
result = result && destination.isDirectory(); // depends on control dependency: [if], data = [none]
} else {
result = result && destination.mkdirs(); // depends on control dependency: [if], data = [none]
}
File[] children = source.listFiles();
for (File element : children) {
String inName = element.getName();
String outName;
if (element.isDirectory()) {
outName = inName; // depends on control dependency: [if], data = [none]
} else {
outName = inName.substring(0, inName.lastIndexOf('.') + 1)
+ m_outExt; // depends on control dependency: [if], data = [none]
}
result = result && convert(new File(source, inName),
new File(destination, outName)); // depends on control dependency: [for], data = [none]
}
return result; // depends on control dependency: [if], data = [none]
} else {
try {
if (!source.getName().endsWith("." + m_inExt)) {
return result; // depends on control dependency: [if], data = [none]
}
InputStream in = new FileInputStream(source);
if (!destination.getParentFile().exists()) {
destination.getParentFile().mkdirs(); // depends on control dependency: [if], data = [none]
}
OutputStream out = new FileOutputStream(destination);
result = result && convert(in, out); // depends on control dependency: [try], data = [none]
out.close(); // depends on control dependency: [try], data = [none]
in.close(); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static void generate(ConfigurationImpl configuration,
ClassTree classtree) {
TreeWriter treegen;
DocPath filename = DocPaths.OVERVIEW_TREE;
try {
treegen = new TreeWriter(configuration, filename, classtree);
treegen.generateTreeFile();
treegen.close();
} catch (IOException exc) {
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
throw new DocletAbortException(exc);
}
} } | public class class_name {
public static void generate(ConfigurationImpl configuration,
ClassTree classtree) {
TreeWriter treegen;
DocPath filename = DocPaths.OVERVIEW_TREE;
try {
treegen = new TreeWriter(configuration, filename, classtree); // depends on control dependency: [try], data = [none]
treegen.generateTreeFile(); // depends on control dependency: [try], data = [none]
treegen.close(); // depends on control dependency: [try], data = [none]
} catch (IOException exc) {
configuration.standardmessage.error(
"doclet.exception_encountered",
exc.toString(), filename);
throw new DocletAbortException(exc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
if (pendingFacebookDialogCall != null) {
// If one is already pending, cancel it; we don't allow multiple pending calls.
Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call.");
cancelPendingAppCall(null);
}
pendingFacebookDialogCall = pendingCall;
} } | public class class_name {
public void trackPendingDialogCall(FacebookDialog.PendingCall pendingCall) {
if (pendingFacebookDialogCall != null) {
// If one is already pending, cancel it; we don't allow multiple pending calls.
Log.i("Facebook", "Tracking new app call while one is still pending; canceling pending call."); // depends on control dependency: [if], data = [none]
cancelPendingAppCall(null); // depends on control dependency: [if], data = [null)]
}
pendingFacebookDialogCall = pendingCall;
} } |
public class class_name {
protected synchronized void fireTrackPositionChangeEvent(long newTime) {
TrackPositionChangeEvent tpce = new TrackPositionChangeEvent(this, newTime);
for (TrackPositionChangeListener tpcl : trackListeners) {
tpcl.trackPositionChanged(tpce);
}
} } | public class class_name {
protected synchronized void fireTrackPositionChangeEvent(long newTime) {
TrackPositionChangeEvent tpce = new TrackPositionChangeEvent(this, newTime);
for (TrackPositionChangeListener tpcl : trackListeners) {
tpcl.trackPositionChanged(tpce); // depends on control dependency: [for], data = [tpcl]
}
} } |
public class class_name {
public void add(int index, E element) {
try {
listIterator(index).add(element);
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
}
} } | public class class_name {
public void add(int index, E element) {
try {
listIterator(index).add(element); // depends on control dependency: [try], data = [none]
} catch (NoSuchElementException exc) {
throw new IndexOutOfBoundsException("Index: "+index);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void start () {
if (semaphore == null) {
semaphore = NonBlockingSemaphoreRepository.getSemaphore(name);
}
semaphoreAcquired = semaphore.acquire();
super.start();
} } | public class class_name {
@Override
public void start () {
if (semaphore == null) {
semaphore = NonBlockingSemaphoreRepository.getSemaphore(name); // depends on control dependency: [if], data = [none]
}
semaphoreAcquired = semaphore.acquire();
super.start();
} } |
public class class_name {
public void importBeans(String resourcePattern) {
try {
Resource[] resources = resourcePatternResolver.getResources(resourcePattern);
for (Resource resource : resources) {
importBeans(resource);
}
} catch (IOException e) {
LOG.error("Error loading beans for resource pattern: " + resourcePattern, e);
}
} } | public class class_name {
public void importBeans(String resourcePattern) {
try {
Resource[] resources = resourcePatternResolver.getResources(resourcePattern);
for (Resource resource : resources) {
importBeans(resource); // depends on control dependency: [for], data = [resource]
}
} catch (IOException e) {
LOG.error("Error loading beans for resource pattern: " + resourcePattern, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final String resource = request.getParameter("resource");
if (resource != null && customResources.get(resource) != null) {
final String customResource = customResources.get(resource);
final HttpServletResponse httpResponse = (HttpServletResponse) response;
MonitoringController.addHeadersForResource(httpResponse, customResource);
if (customResources.get("useForward") == null) {
request.getRequestDispatcher(customResource).include(request, response);
} else {
request.getRequestDispatcher(customResource).forward(request, response);
}
} else {
chain.doFilter(request, response);
}
} } | public class class_name {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final String resource = request.getParameter("resource");
if (resource != null && customResources.get(resource) != null) {
final String customResource = customResources.get(resource);
final HttpServletResponse httpResponse = (HttpServletResponse) response;
MonitoringController.addHeadersForResource(httpResponse, customResource);
if (customResources.get("useForward") == null) {
request.getRequestDispatcher(customResource).include(request, response);
// depends on control dependency: [if], data = [none]
} else {
request.getRequestDispatcher(customResource).forward(request, response);
// depends on control dependency: [if], data = [none]
}
} else {
chain.doFilter(request, response);
}
} } |
public class class_name {
public double[] foldNonZeroInRows(VectorAccumulator accumulator) {
double[] result = new double[rows];
for (int i = 0; i < rows; i++) {
result[i] = foldNonZeroInRow(i, accumulator);
}
return result;
} } | public class class_name {
public double[] foldNonZeroInRows(VectorAccumulator accumulator) {
double[] result = new double[rows];
for (int i = 0; i < rows; i++) {
result[i] = foldNonZeroInRow(i, accumulator); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
@Override
public boolean returnConnection(Connection<CL> connection) {
returnedCount.incrementAndGet();
monitor.incConnectionReturned(host);
ConnectionException ce = connection.getLastException();
if (ce != null) {
if (ce instanceof IsDeadConnectionException) {
noteError(ce);
internalCloseConnection(connection);
return true;
}
}
errorsSinceLastSuccess.set(0);
// Still within the number of max active connection
if (activeCount.get() <= config.getMaxConnsPerHost()) {
availableConnections.add(connection);
if (isShutdown()) {
discardIdleConnections();
return true;
}
}
else {
// maxConnsPerHost was reduced. This may end up closing too many
// connections, but that's ok. We'll open them later.
internalCloseConnection(connection);
return true;
}
return false;
} } | public class class_name {
@Override
public boolean returnConnection(Connection<CL> connection) {
returnedCount.incrementAndGet();
monitor.incConnectionReturned(host);
ConnectionException ce = connection.getLastException();
if (ce != null) {
if (ce instanceof IsDeadConnectionException) {
noteError(ce); // depends on control dependency: [if], data = [none]
internalCloseConnection(connection); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
errorsSinceLastSuccess.set(0);
// Still within the number of max active connection
if (activeCount.get() <= config.getMaxConnsPerHost()) {
availableConnections.add(connection); // depends on control dependency: [if], data = [none]
if (isShutdown()) {
discardIdleConnections(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
else {
// maxConnsPerHost was reduced. This may end up closing too many
// connections, but that's ok. We'll open them later.
internalCloseConnection(connection); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public int getEvictionIndex() {
/*
* If the table has been shrunk then it's possible for the clock-hand to
* point past the end of the table. We cannot allow the initial-hand to
* be equal to this otherwise we may never be able to terminate this loop.
*/
if (clockHand >= hashtable.capacity()) {
clockHand = 0;
}
int initialHand = clockHand;
int loops = 0;
while (true) {
if ((clockHand += ENTRY_SIZE) + STATUS >= hashtable.capacity()) {
clockHand = 0;
}
int hand = hashtable.get(clockHand + STATUS);
if (evictable(hand) && ((hand & PRESENT_CLOCK) == 0)) {
return clockHand;
} else if ((hand & PRESENT_CLOCK) == PRESENT_CLOCK) {
hashtable.put(clockHand + STATUS, hand & ~PRESENT_CLOCK);
}
if (initialHand == clockHand && ++loops == 2) {
return -1;
}
}
} } | public class class_name {
public int getEvictionIndex() {
/*
* If the table has been shrunk then it's possible for the clock-hand to
* point past the end of the table. We cannot allow the initial-hand to
* be equal to this otherwise we may never be able to terminate this loop.
*/
if (clockHand >= hashtable.capacity()) {
clockHand = 0; // depends on control dependency: [if], data = [none]
}
int initialHand = clockHand;
int loops = 0;
while (true) {
if ((clockHand += ENTRY_SIZE) + STATUS >= hashtable.capacity()) {
clockHand = 0; // depends on control dependency: [if], data = [none]
}
int hand = hashtable.get(clockHand + STATUS);
if (evictable(hand) && ((hand & PRESENT_CLOCK) == 0)) {
return clockHand; // depends on control dependency: [if], data = [none]
} else if ((hand & PRESENT_CLOCK) == PRESENT_CLOCK) {
hashtable.put(clockHand + STATUS, hand & ~PRESENT_CLOCK); // depends on control dependency: [if], data = [PRESENT_CLOCK)]
}
if (initialHand == clockHand && ++loops == 2) {
return -1; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void run() {
/**
* Ensure we start fresh.
*/
getLogger().debug("performing socket cleanup prior to entering loop for {}", name);
closeServerSocket();
closeAllAcceptedSockets();
getLogger().debug("socket cleanup complete for {}", name);
active = true;
// start the server socket
try {
serverSocket = new ServerSocket(port);
} catch (Exception e) {
getLogger().error(
"error starting SocketReceiver (" + this.getName()
+ "), receiver did not start", e);
active = false;
doShutdown();
return;
}
Socket socket = null;
try {
getLogger().debug("in run-about to enter while isactiveloop");
active = true;
while (!rThread.isInterrupted()) {
// if we have a socket, start watching it
if (socket != null) {
getLogger().debug("socket not null - creating and starting socketnode");
socketList.add(socket);
XMLSocketNode node = new XMLSocketNode(decoder, socket, this);
node.setLoggerRepository(this.repository);
new Thread(node).start();
socket = null;
}
getLogger().debug("waiting to accept socket");
// wait for a socket to open, then loop to start it
socket = serverSocket.accept();
getLogger().debug("accepted socket");
}
// socket not watched because we a no longer running
// so close it now.
if (socket != null) {
socket.close();
}
} catch (Exception e) {
getLogger().warn(
"socket server disconnected, stopping");
}
} } | public class class_name {
public void run() {
/**
* Ensure we start fresh.
*/
getLogger().debug("performing socket cleanup prior to entering loop for {}", name);
closeServerSocket();
closeAllAcceptedSockets();
getLogger().debug("socket cleanup complete for {}", name);
active = true;
// start the server socket
try {
serverSocket = new ServerSocket(port); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
getLogger().error(
"error starting SocketReceiver (" + this.getName()
+ "), receiver did not start", e);
active = false;
doShutdown();
return;
} // depends on control dependency: [catch], data = [none]
Socket socket = null;
try {
getLogger().debug("in run-about to enter while isactiveloop"); // depends on control dependency: [try], data = [none]
active = true; // depends on control dependency: [try], data = [none]
while (!rThread.isInterrupted()) {
// if we have a socket, start watching it
if (socket != null) {
getLogger().debug("socket not null - creating and starting socketnode"); // depends on control dependency: [if], data = [none]
socketList.add(socket); // depends on control dependency: [if], data = [(socket]
XMLSocketNode node = new XMLSocketNode(decoder, socket, this);
node.setLoggerRepository(this.repository); // depends on control dependency: [if], data = [none]
new Thread(node).start(); // depends on control dependency: [if], data = [none]
socket = null; // depends on control dependency: [if], data = [none]
}
getLogger().debug("waiting to accept socket"); // depends on control dependency: [while], data = [none]
// wait for a socket to open, then loop to start it
socket = serverSocket.accept(); // depends on control dependency: [while], data = [none]
getLogger().debug("accepted socket"); // depends on control dependency: [while], data = [none]
}
// socket not watched because we a no longer running
// so close it now.
if (socket != null) {
socket.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
getLogger().warn(
"socket server disconnected, stopping");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public WindupConfiguration addInputPath(Path inputPath)
{
Set<Path> inputPaths = getOptionValue(InputPathOption.NAME);
if (inputPaths == null)
{
inputPaths = new LinkedHashSet<>();
setOptionValue(InputPathOption.NAME, inputPaths);
}
inputPaths.add(inputPath);
return this;
} } | public class class_name {
public WindupConfiguration addInputPath(Path inputPath)
{
Set<Path> inputPaths = getOptionValue(InputPathOption.NAME);
if (inputPaths == null)
{
inputPaths = new LinkedHashSet<>(); // depends on control dependency: [if], data = [none]
setOptionValue(InputPathOption.NAME, inputPaths); // depends on control dependency: [if], data = [none]
}
inputPaths.add(inputPath);
return this;
} } |
public class class_name {
boolean isOptional(Field field) {
if(field.schema().getType() == Type.UNION) {
for(Schema nestedType: field.schema().getTypes()) {
if(nestedType.getType() == Type.NULL) {
return true;
}
}
}
return false;
} } | public class class_name {
boolean isOptional(Field field) {
if(field.schema().getType() == Type.UNION) {
for(Schema nestedType: field.schema().getTypes()) {
if(nestedType.getType() == Type.NULL) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static void reloadLibrary(String key) {
if (key.startsWith(DicLibrary.DEFAULT)) {
DicLibrary.reload(key);
} else if (key.startsWith(StopLibrary.DEFAULT)) {
StopLibrary.reload(key);
} else if (key.startsWith(SynonymsLibrary.DEFAULT)) {
SynonymsLibrary.reload(key);
} else if (key.startsWith(AmbiguityLibrary.DEFAULT)) {
AmbiguityLibrary.reload(key);
} else if (key.startsWith(CrfLibrary.DEFAULT)) {
CrfLibrary.reload(key);
} else {
throw new LibraryException(key + " type err must start with dic,stop,ambiguity,synonyms");
}
} } | public class class_name {
public static void reloadLibrary(String key) {
if (key.startsWith(DicLibrary.DEFAULT)) {
DicLibrary.reload(key); // depends on control dependency: [if], data = [none]
} else if (key.startsWith(StopLibrary.DEFAULT)) {
StopLibrary.reload(key); // depends on control dependency: [if], data = [none]
} else if (key.startsWith(SynonymsLibrary.DEFAULT)) {
SynonymsLibrary.reload(key); // depends on control dependency: [if], data = [none]
} else if (key.startsWith(AmbiguityLibrary.DEFAULT)) {
AmbiguityLibrary.reload(key); // depends on control dependency: [if], data = [none]
} else if (key.startsWith(CrfLibrary.DEFAULT)) {
CrfLibrary.reload(key); // depends on control dependency: [if], data = [none]
} else {
throw new LibraryException(key + " type err must start with dic,stop,ambiguity,synonyms");
}
} } |
public class class_name {
public Observable<ServiceResponse<Integer>> addSubListWithServiceResponseAsync(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (clEntityId == null) {
throw new IllegalArgumentException("Parameter clEntityId is required and cannot be null.");
}
if (wordListCreateObject == null) {
throw new IllegalArgumentException("Parameter wordListCreateObject is required and cannot be null.");
}
Validator.validate(wordListCreateObject);
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.addSubList(appId, versionId, clEntityId, wordListCreateObject, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Integer>>>() {
@Override
public Observable<ServiceResponse<Integer>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Integer> clientResponse = addSubListDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Integer>> addSubListWithServiceResponseAsync(UUID appId, String versionId, UUID clEntityId, WordListObject wordListCreateObject) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (clEntityId == null) {
throw new IllegalArgumentException("Parameter clEntityId is required and cannot be null.");
}
if (wordListCreateObject == null) {
throw new IllegalArgumentException("Parameter wordListCreateObject is required and cannot be null.");
}
Validator.validate(wordListCreateObject);
String parameterizedHost = Joiner.on(", ").join("{Endpoint}", this.client.endpoint());
return service.addSubList(appId, versionId, clEntityId, wordListCreateObject, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Integer>>>() {
@Override
public Observable<ServiceResponse<Integer>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Integer> clientResponse = addSubListDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private void initializeMimeExtensionArrays() throws OSException {
// lazy initialization
if (extensionMime == null || mimeExtension == null) {
extensionMime = new HashMap<>();
mimeExtension = new HashMap<>();
// list all files in all directories in MIME_TYPE_FILES
for (String dir : MIME_TYPE_FILES) {
File d = new File(dir);
if (d.exists() && d.isDirectory()) {
for (final File fileEntry : d.listFiles()) {
if (fileEntry.isFile() && fileEntry.canRead()) {
Set<String> tmpExtensions = new HashSet<>();
Set<String> tmpMimeTypes = new HashSet<>();
try {
String content = new String(Files.readAllBytes(fileEntry.toPath()));
Matcher extMatcher = MIME_TYPE_FILE_EXTENSION_PATTERN.matcher(content);
while (extMatcher.find()) {
tmpExtensions.add(extMatcher.group(1).toLowerCase());
}
Matcher mimeMatcher = MIME_TYPE_FILE_MIME_PATTERN.matcher(content);
while (mimeMatcher.find()) {
tmpMimeTypes.add(mimeMatcher.group(1).toLowerCase());
}
} catch (IOException ex) {
throw new OSException(ex);
}
// fill arrays
for (String ext : tmpExtensions) {
if (extensionMime.containsKey(ext)) {
Set<String> tmp = extensionMime.get(ext);
tmp.addAll(tmpMimeTypes);
extensionMime.put(ext, tmp);
} else {
extensionMime.put(ext, tmpMimeTypes);
}
}
for (String mime : tmpMimeTypes) {
if (mimeExtension.containsKey(mime)) {
Set<String> tmp = mimeExtension.get(mime);
tmp.addAll(tmpExtensions);
mimeExtension.put(mime, tmp);
} else {
mimeExtension.put(mime, tmpExtensions);
}
}
}
}
}
}
}
} } | public class class_name {
private void initializeMimeExtensionArrays() throws OSException {
// lazy initialization
if (extensionMime == null || mimeExtension == null) {
extensionMime = new HashMap<>();
mimeExtension = new HashMap<>();
// list all files in all directories in MIME_TYPE_FILES
for (String dir : MIME_TYPE_FILES) {
File d = new File(dir);
if (d.exists() && d.isDirectory()) {
for (final File fileEntry : d.listFiles()) {
if (fileEntry.isFile() && fileEntry.canRead()) {
Set<String> tmpExtensions = new HashSet<>();
Set<String> tmpMimeTypes = new HashSet<>();
try {
String content = new String(Files.readAllBytes(fileEntry.toPath()));
Matcher extMatcher = MIME_TYPE_FILE_EXTENSION_PATTERN.matcher(content);
while (extMatcher.find()) {
tmpExtensions.add(extMatcher.group(1).toLowerCase()); // depends on control dependency: [while], data = [none]
}
Matcher mimeMatcher = MIME_TYPE_FILE_MIME_PATTERN.matcher(content);
while (mimeMatcher.find()) {
tmpMimeTypes.add(mimeMatcher.group(1).toLowerCase()); // depends on control dependency: [while], data = [none]
}
} catch (IOException ex) {
throw new OSException(ex);
} // depends on control dependency: [catch], data = [none]
// fill arrays
for (String ext : tmpExtensions) {
if (extensionMime.containsKey(ext)) {
Set<String> tmp = extensionMime.get(ext);
tmp.addAll(tmpMimeTypes); // depends on control dependency: [if], data = [none]
extensionMime.put(ext, tmp); // depends on control dependency: [if], data = [none]
} else {
extensionMime.put(ext, tmpMimeTypes); // depends on control dependency: [if], data = [none]
}
}
for (String mime : tmpMimeTypes) {
if (mimeExtension.containsKey(mime)) {
Set<String> tmp = mimeExtension.get(mime);
tmp.addAll(tmpExtensions); // depends on control dependency: [if], data = [none]
mimeExtension.put(mime, tmp); // depends on control dependency: [if], data = [none]
} else {
mimeExtension.put(mime, tmpExtensions); // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
}
} } |
public class class_name {
public DescribeSpotFleetRequestsResult withSpotFleetRequestConfigs(SpotFleetRequestConfig... spotFleetRequestConfigs) {
if (this.spotFleetRequestConfigs == null) {
setSpotFleetRequestConfigs(new com.amazonaws.internal.SdkInternalList<SpotFleetRequestConfig>(spotFleetRequestConfigs.length));
}
for (SpotFleetRequestConfig ele : spotFleetRequestConfigs) {
this.spotFleetRequestConfigs.add(ele);
}
return this;
} } | public class class_name {
public DescribeSpotFleetRequestsResult withSpotFleetRequestConfigs(SpotFleetRequestConfig... spotFleetRequestConfigs) {
if (this.spotFleetRequestConfigs == null) {
setSpotFleetRequestConfigs(new com.amazonaws.internal.SdkInternalList<SpotFleetRequestConfig>(spotFleetRequestConfigs.length)); // depends on control dependency: [if], data = [none]
}
for (SpotFleetRequestConfig ele : spotFleetRequestConfigs) {
this.spotFleetRequestConfigs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public TimeZoneGenericNames setFormatPattern(Pattern patType, String patStr) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
// Changing pattern will invalidates cached names
if (!_genericLocationNamesMap.isEmpty()) {
_genericLocationNamesMap = new ConcurrentHashMap<String, String>();
}
if (!_genericPartialLocationNamesMap.isEmpty()) {
_genericPartialLocationNamesMap = new ConcurrentHashMap<String, String>();
}
_gnamesTrie = null;
_gnamesTrieFullyLoaded = false;
if (_patternFormatters == null) {
_patternFormatters = new MessageFormat[Pattern.values().length];
}
_patternFormatters[patType.ordinal()] = new MessageFormat(patStr);
return this;
} } | public class class_name {
public TimeZoneGenericNames setFormatPattern(Pattern patType, String patStr) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
// Changing pattern will invalidates cached names
if (!_genericLocationNamesMap.isEmpty()) {
_genericLocationNamesMap = new ConcurrentHashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
if (!_genericPartialLocationNamesMap.isEmpty()) {
_genericPartialLocationNamesMap = new ConcurrentHashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
_gnamesTrie = null;
_gnamesTrieFullyLoaded = false;
if (_patternFormatters == null) {
_patternFormatters = new MessageFormat[Pattern.values().length]; // depends on control dependency: [if], data = [none]
}
_patternFormatters[patType.ordinal()] = new MessageFormat(patStr);
return this;
} } |
public class class_name {
public static boolean scan(final char[] input)
{
int surLow = 0xD800;
int surHgh = 0xDFFF;
int end = input.length;
for (int i = 0; i < end; i++) {
if ((int) input[i] >= surLow && input[i] <= surHgh) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean scan(final char[] input)
{
int surLow = 0xD800;
int surHgh = 0xDFFF;
int end = input.length;
for (int i = 0; i < end; i++) {
if ((int) input[i] >= surLow && input[i] <= surHgh) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static void startFinalizer(
Class<?> finalizableReferenceClass,
ReferenceQueue<Object> queue,
PhantomReference<Object> frqReference) {
/*
* We use FinalizableReference.class for two things:
*
* 1) To invoke FinalizableReference.finalizeReferent()
*
* 2) To detect when FinalizableReference's class loader has to be garbage collected, at which
* point, Finalizer can stop running
*/
if (!finalizableReferenceClass.getName().equals(FINALIZABLE_REFERENCE)) {
throw new IllegalArgumentException("Expected " + FINALIZABLE_REFERENCE + ".");
}
Finalizer finalizer = new Finalizer(finalizableReferenceClass, queue, frqReference);
String threadName = Finalizer.class.getName();
Thread thread = null;
if (bigThreadConstructor != null) {
try {
boolean inheritThreadLocals = false;
long defaultStackSize = 0;
thread =
bigThreadConstructor.newInstance(
(ThreadGroup) null, finalizer, threadName, defaultStackSize, inheritThreadLocals);
} catch (Throwable t) {
logger.log(
Level.INFO, "Failed to create a thread without inherited thread-local values", t);
}
}
if (thread == null) {
thread = new Thread((ThreadGroup) null, finalizer, threadName);
}
thread.setDaemon(true);
try {
if (inheritableThreadLocals != null) {
inheritableThreadLocals.set(thread, null);
}
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to clear thread local values inherited by reference finalizer thread.",
t);
}
thread.start();
} } | public class class_name {
public static void startFinalizer(
Class<?> finalizableReferenceClass,
ReferenceQueue<Object> queue,
PhantomReference<Object> frqReference) {
/*
* We use FinalizableReference.class for two things:
*
* 1) To invoke FinalizableReference.finalizeReferent()
*
* 2) To detect when FinalizableReference's class loader has to be garbage collected, at which
* point, Finalizer can stop running
*/
if (!finalizableReferenceClass.getName().equals(FINALIZABLE_REFERENCE)) {
throw new IllegalArgumentException("Expected " + FINALIZABLE_REFERENCE + ".");
}
Finalizer finalizer = new Finalizer(finalizableReferenceClass, queue, frqReference);
String threadName = Finalizer.class.getName();
Thread thread = null;
if (bigThreadConstructor != null) {
try {
boolean inheritThreadLocals = false;
long defaultStackSize = 0;
thread =
bigThreadConstructor.newInstance(
(ThreadGroup) null, finalizer, threadName, defaultStackSize, inheritThreadLocals); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
logger.log(
Level.INFO, "Failed to create a thread without inherited thread-local values", t);
} // depends on control dependency: [catch], data = [none]
}
if (thread == null) {
thread = new Thread((ThreadGroup) null, finalizer, threadName); // depends on control dependency: [if], data = [none]
}
thread.setDaemon(true);
try {
if (inheritableThreadLocals != null) {
inheritableThreadLocals.set(thread, null); // depends on control dependency: [if], data = [null)]
}
} catch (Throwable t) {
logger.log(
Level.INFO,
"Failed to clear thread local values inherited by reference finalizer thread.",
t);
} // depends on control dependency: [catch], data = [none]
thread.start();
} } |
public class class_name {
public void setExecutableUsers(java.util.Collection<String> executableUsers) {
if (executableUsers == null) {
this.executableUsers = null;
return;
}
this.executableUsers = new com.amazonaws.internal.SdkInternalList<String>(executableUsers);
} } | public class class_name {
public void setExecutableUsers(java.util.Collection<String> executableUsers) {
if (executableUsers == null) {
this.executableUsers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.executableUsers = new com.amazonaws.internal.SdkInternalList<String>(executableUsers);
} } |
public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
protected void copyNonStaticPublicJvmOperations(JvmGenericType source, JvmGenericType target,
Set<ActionPrototype> createdActions, Procedure2<? super JvmOperation, ? super ITreeAppendable> bodyBuilder) {
final Iterable<JvmOperation> operations = Iterables.transform(Iterables.filter(source.getMembers(), it -> {
if (it instanceof JvmOperation) {
final JvmOperation op = (JvmOperation) it;
return !op.isStatic() && op.getVisibility() == JvmVisibility.PUBLIC;
}
return false;
}), it -> (JvmOperation) it);
for (final JvmOperation operation : operations) {
final ActionParameterTypes types = this.sarlSignatureProvider.createParameterTypesFromJvmModel(
operation.isVarArgs(), operation.getParameters());
final ActionPrototype actSigKey = this.sarlSignatureProvider.createActionPrototype(
operation.getSimpleName(), types);
if (createdActions.add(actSigKey)) {
final JvmOperation newOp = this.typesFactory.createJvmOperation();
target.getMembers().add(newOp);
newOp.setAbstract(false);
newOp.setFinal(false);
newOp.setNative(false);
newOp.setStatic(false);
newOp.setSynchronized(false);
newOp.setVisibility(JvmVisibility.PUBLIC);
newOp.setDefault(operation.isDefault());
newOp.setDeprecated(operation.isDeprecated());
newOp.setSimpleName(operation.getSimpleName());
newOp.setStrictFloatingPoint(operation.isStrictFloatingPoint());
copyTypeParametersFromJvmOperation(operation, newOp);
for (final JvmTypeReference exception : operation.getExceptions()) {
newOp.getExceptions().add(cloneWithTypeParametersAndProxies(exception, newOp));
}
for (final JvmFormalParameter parameter : operation.getParameters()) {
final JvmFormalParameter newParam = this.typesFactory.createJvmFormalParameter();
newOp.getParameters().add(newParam);
newParam.setName(parameter.getSimpleName());
newParam.setParameterType(cloneWithTypeParametersAndProxies(parameter.getParameterType(), newOp));
}
newOp.setVarArgs(operation.isVarArgs());
newOp.setReturnType(cloneWithTypeParametersAndProxies(operation.getReturnType(), newOp));
setBody(newOp, it -> bodyBuilder.apply(operation, it));
}
}
} } | public class class_name {
@SuppressWarnings("checkstyle:npathcomplexity")
protected void copyNonStaticPublicJvmOperations(JvmGenericType source, JvmGenericType target,
Set<ActionPrototype> createdActions, Procedure2<? super JvmOperation, ? super ITreeAppendable> bodyBuilder) {
final Iterable<JvmOperation> operations = Iterables.transform(Iterables.filter(source.getMembers(), it -> {
if (it instanceof JvmOperation) {
final JvmOperation op = (JvmOperation) it;
return !op.isStatic() && op.getVisibility() == JvmVisibility.PUBLIC;
}
return false;
}), it -> (JvmOperation) it);
for (final JvmOperation operation : operations) {
final ActionParameterTypes types = this.sarlSignatureProvider.createParameterTypesFromJvmModel(
operation.isVarArgs(), operation.getParameters());
final ActionPrototype actSigKey = this.sarlSignatureProvider.createActionPrototype(
operation.getSimpleName(), types);
if (createdActions.add(actSigKey)) {
final JvmOperation newOp = this.typesFactory.createJvmOperation();
target.getMembers().add(newOp); // depends on control dependency: [if], data = [none]
newOp.setAbstract(false); // depends on control dependency: [if], data = [none]
newOp.setFinal(false); // depends on control dependency: [if], data = [none]
newOp.setNative(false); // depends on control dependency: [if], data = [none]
newOp.setStatic(false); // depends on control dependency: [if], data = [none]
newOp.setSynchronized(false); // depends on control dependency: [if], data = [none]
newOp.setVisibility(JvmVisibility.PUBLIC); // depends on control dependency: [if], data = [none]
newOp.setDefault(operation.isDefault()); // depends on control dependency: [if], data = [none]
newOp.setDeprecated(operation.isDeprecated()); // depends on control dependency: [if], data = [none]
newOp.setSimpleName(operation.getSimpleName()); // depends on control dependency: [if], data = [none]
newOp.setStrictFloatingPoint(operation.isStrictFloatingPoint()); // depends on control dependency: [if], data = [none]
copyTypeParametersFromJvmOperation(operation, newOp); // depends on control dependency: [if], data = [none]
for (final JvmTypeReference exception : operation.getExceptions()) {
newOp.getExceptions().add(cloneWithTypeParametersAndProxies(exception, newOp)); // depends on control dependency: [for], data = [exception]
}
for (final JvmFormalParameter parameter : operation.getParameters()) {
final JvmFormalParameter newParam = this.typesFactory.createJvmFormalParameter();
newOp.getParameters().add(newParam); // depends on control dependency: [for], data = [none]
newParam.setName(parameter.getSimpleName()); // depends on control dependency: [for], data = [parameter]
newParam.setParameterType(cloneWithTypeParametersAndProxies(parameter.getParameterType(), newOp)); // depends on control dependency: [for], data = [parameter]
}
newOp.setVarArgs(operation.isVarArgs()); // depends on control dependency: [if], data = [none]
newOp.setReturnType(cloneWithTypeParametersAndProxies(operation.getReturnType(), newOp)); // depends on control dependency: [if], data = [none]
setBody(newOp, it -> bodyBuilder.apply(operation, it)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfBuildingPart() {
if (_GenericApplicationPropertyOfBuildingPart == null) {
_GenericApplicationPropertyOfBuildingPart = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfBuildingPart;
} } | public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfBuildingPart() {
if (_GenericApplicationPropertyOfBuildingPart == null) {
_GenericApplicationPropertyOfBuildingPart = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfBuildingPart;
} } |
public class class_name {
public Object prepare(final Object value) {
if (value == null || value instanceof String || !stringify) {
return value;
} else {
if (value instanceof Boolean) {
return PREFIX_BOOLEAN.concat(value.toString());
} else if (value instanceof Integer) {
return PREFIX_INT.concat(value.toString());
} else if (value instanceof Long) {
return PREFIX_LONG.concat(value.toString());
} else if (value instanceof Date) {
return PREFIX_DATE.concat(newSdf().format((Date) value));
} else if (value instanceof URI) {
return PREFIX_URI.concat(value.toString());
} else {
return PREFIX_SB64.concat(serializationHelper.serializeToBase64((Serializable) value));
}
}
} } | public class class_name {
public Object prepare(final Object value) {
if (value == null || value instanceof String || !stringify) {
return value; // depends on control dependency: [if], data = [none]
} else {
if (value instanceof Boolean) {
return PREFIX_BOOLEAN.concat(value.toString()); // depends on control dependency: [if], data = [none]
} else if (value instanceof Integer) {
return PREFIX_INT.concat(value.toString()); // depends on control dependency: [if], data = [none]
} else if (value instanceof Long) {
return PREFIX_LONG.concat(value.toString()); // depends on control dependency: [if], data = [none]
} else if (value instanceof Date) {
return PREFIX_DATE.concat(newSdf().format((Date) value)); // depends on control dependency: [if], data = [none]
} else if (value instanceof URI) {
return PREFIX_URI.concat(value.toString()); // depends on control dependency: [if], data = [none]
} else {
return PREFIX_SB64.concat(serializationHelper.serializeToBase64((Serializable) value)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean isValidProperty(String strProperty)
{
if (m_rgstrValidParams != null)
{
for (int i = 0; i < m_rgstrValidParams.length; i++)
{
if (m_rgstrValidParams[i].equalsIgnoreCase(strProperty))
{ // Valid property
if (m_strCurrentProperty != strProperty)
{
return true; // Valid property
}
}
}
}
return false; // Not a valid property
} } | public class class_name {
public boolean isValidProperty(String strProperty)
{
if (m_rgstrValidParams != null)
{
for (int i = 0; i < m_rgstrValidParams.length; i++)
{
if (m_rgstrValidParams[i].equalsIgnoreCase(strProperty))
{ // Valid property
if (m_strCurrentProperty != strProperty)
{
return true; // Valid property // depends on control dependency: [if], data = [none]
}
}
}
}
return false; // Not a valid property
} } |
public class class_name {
private ServerEventHandler createServerEventHandler(
SFSEventType type, Class<?> clazz) {
try {
return (ServerEventHandler)
ReflectClassUtil.newInstance(
clazz, BaseAppContext.class, context);
} catch (ExtensionException e) {
getLogger().error("Error when create server event handlers", e);
throw new RuntimeException("Can not create event handler of class "
+ clazz, e);
}
} } | public class class_name {
private ServerEventHandler createServerEventHandler(
SFSEventType type, Class<?> clazz) {
try {
return (ServerEventHandler)
ReflectClassUtil.newInstance(
clazz, BaseAppContext.class, context); // depends on control dependency: [try], data = [none]
} catch (ExtensionException e) {
getLogger().error("Error when create server event handlers", e);
throw new RuntimeException("Can not create event handler of class "
+ clazz, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void merge(LinkedPair closestPair) {
int first = closestPair.getFirst();
int second = closestPair.getSecond();
for (int other=0;other<numItems;other++) {
matrix[Math.min(first,other)][Math.max(first, other)] = link(getDistance(first, other), getDistance(second, other));
}
} } | public class class_name {
private void merge(LinkedPair closestPair) {
int first = closestPair.getFirst();
int second = closestPair.getSecond();
for (int other=0;other<numItems;other++) {
matrix[Math.min(first,other)][Math.max(first, other)] = link(getDistance(first, other), getDistance(second, other)); // depends on control dependency: [for], data = [other]
}
} } |
public class class_name {
public final void close()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "close");
ArrayList<AORequestedTick> expiredTicks = new ArrayList<AORequestedTick>(tableOfRequests.size()); // approximately allocate correct size
closeInternal(expiredTicks);
int length = expiredTicks.size();
for (int i = 0; i < length; i++)
{
AORequestedTick rt = (AORequestedTick) expiredTicks.get(i);
parent.expiredRequest(rt.tick);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "close");
} } | public class class_name {
public final void close()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "close");
ArrayList<AORequestedTick> expiredTicks = new ArrayList<AORequestedTick>(tableOfRequests.size()); // approximately allocate correct size
closeInternal(expiredTicks);
int length = expiredTicks.size();
for (int i = 0; i < length; i++)
{
AORequestedTick rt = (AORequestedTick) expiredTicks.get(i);
parent.expiredRequest(rt.tick); // depends on control dependency: [for], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "close");
} } |
public class class_name {
public String getClusterId(final String nodeId)
{
if (nodeId == null)
{
return null;
}
int dot = nodeId.lastIndexOf('.');
return (dot > 0) ? nodeId.substring(0, dot) : nodeId;
} } | public class class_name {
public String getClusterId(final String nodeId)
{
if (nodeId == null)
{
return null; // depends on control dependency: [if], data = [none]
}
int dot = nodeId.lastIndexOf('.');
return (dot > 0) ? nodeId.substring(0, dot) : nodeId;
} } |
public class class_name {
@Nullable
public static String concatenateWithAnd(@Nullable String s1, @Nullable String s2) {
if (s1 != null) {
return s2 == null ? s1 : s1 + " and " + s2;
}
else {
return s2;
}
} } | public class class_name {
@Nullable
public static String concatenateWithAnd(@Nullable String s1, @Nullable String s2) {
if (s1 != null) {
return s2 == null ? s1 : s1 + " and " + s2; // depends on control dependency: [if], data = [none]
}
else {
return s2; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final List<WarningsGroup> validate(List<ICalComponent> hierarchy, ICalVersion version) {
List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
//validate this component
List<ValidationWarning> warningsBuf = new ArrayList<ValidationWarning>(0);
validate(hierarchy, version, warningsBuf);
if (!warningsBuf.isEmpty()) {
warnings.add(new WarningsGroup(this, hierarchy, warningsBuf));
}
//add this component to the hierarchy list
//copy the list so other validate() calls aren't effected
hierarchy = new ArrayList<ICalComponent>(hierarchy);
hierarchy.add(this);
//validate properties
for (ICalProperty property : properties.values()) {
List<ValidationWarning> propWarnings = property.validate(hierarchy, version);
if (!propWarnings.isEmpty()) {
warnings.add(new WarningsGroup(property, hierarchy, propWarnings));
}
}
//validate sub-components
for (ICalComponent component : components.values()) {
warnings.addAll(component.validate(hierarchy, version));
}
return warnings;
} } | public class class_name {
public final List<WarningsGroup> validate(List<ICalComponent> hierarchy, ICalVersion version) {
List<WarningsGroup> warnings = new ArrayList<WarningsGroup>();
//validate this component
List<ValidationWarning> warningsBuf = new ArrayList<ValidationWarning>(0);
validate(hierarchy, version, warningsBuf);
if (!warningsBuf.isEmpty()) {
warnings.add(new WarningsGroup(this, hierarchy, warningsBuf)); // depends on control dependency: [if], data = [none]
}
//add this component to the hierarchy list
//copy the list so other validate() calls aren't effected
hierarchy = new ArrayList<ICalComponent>(hierarchy);
hierarchy.add(this);
//validate properties
for (ICalProperty property : properties.values()) {
List<ValidationWarning> propWarnings = property.validate(hierarchy, version);
if (!propWarnings.isEmpty()) {
warnings.add(new WarningsGroup(property, hierarchy, propWarnings)); // depends on control dependency: [if], data = [none]
}
}
//validate sub-components
for (ICalComponent component : components.values()) {
warnings.addAll(component.validate(hierarchy, version)); // depends on control dependency: [for], data = [component]
}
return warnings;
} } |
public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
Helper.enableNode(text, tile.isTextVisible());
Helper.enableNode(dateText, tile.isDateVisible());
Helper.enableNode(second, tile.isSecondsVisible());
Helper.enableNode(sectionsPane, tile.getSectionsVisible());
} else if ("SECTION".equals(EVENT_TYPE)) {
sectionMap.clear();
for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); }
sectionsPane.getChildren().setAll(sectionMap.values());
resize();
redraw();
}
} } | public class class_name {
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty()); // depends on control dependency: [if], data = [none]
Helper.enableNode(text, tile.isTextVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(dateText, tile.isDateVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(second, tile.isSecondsVisible()); // depends on control dependency: [if], data = [none]
Helper.enableNode(sectionsPane, tile.getSectionsVisible()); // depends on control dependency: [if], data = [none]
} else if ("SECTION".equals(EVENT_TYPE)) {
sectionMap.clear(); // depends on control dependency: [if], data = [none]
for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); } // depends on control dependency: [for], data = [section]
sectionsPane.getChildren().setAll(sectionMap.values()); // depends on control dependency: [if], data = [none]
resize(); // depends on control dependency: [if], data = [none]
redraw(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void buildAuthorizationConfig() {
Properties loaded = new Properties();
InputStream configuration = this.getClass().getResourceAsStream("/case-authorization.properties");
if (configuration != null) {
try {
loaded.load(configuration);
} catch (IOException e) {
logger.error("Error loading case autorization config from file due to {}", e.getMessage(), e);
}
}
Stream.of(ProtectedOperation.values()).forEach(operation -> {
List<String> roles = new ArrayList<>();
String grantedRoles = loaded.getProperty(operation.toString());
if (grantedRoles != null) {
roles.addAll(Arrays.asList(grantedRoles.split(",")));
}
operationAuthorization.put(operation, roles);
});
} } | public class class_name {
protected void buildAuthorizationConfig() {
Properties loaded = new Properties();
InputStream configuration = this.getClass().getResourceAsStream("/case-authorization.properties");
if (configuration != null) {
try {
loaded.load(configuration); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Error loading case autorization config from file due to {}", e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
Stream.of(ProtectedOperation.values()).forEach(operation -> {
List<String> roles = new ArrayList<>();
String grantedRoles = loaded.getProperty(operation.toString());
if (grantedRoles != null) {
roles.addAll(Arrays.asList(grantedRoles.split(","))); // depends on control dependency: [if], data = [(grantedRoles]
}
operationAuthorization.put(operation, roles);
});
} } |
public class class_name {
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) {
addConverters(mc);
if (validate && !mc.isInterface()) {
mc.validate(this);
}
mappedClasses.put(mc.getClazz().getName(), mc);
Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName());
if (mcs == null) {
mcs = new CopyOnWriteArraySet<MappedClass>();
final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs);
if (temp != null) {
mcs = temp;
}
}
mcs.add(mc);
return mc;
} } | public class class_name {
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) {
addConverters(mc);
if (validate && !mc.isInterface()) {
mc.validate(this); // depends on control dependency: [if], data = [none]
}
mappedClasses.put(mc.getClazz().getName(), mc);
Set<MappedClass> mcs = mappedClassesByCollection.get(mc.getCollectionName());
if (mcs == null) {
mcs = new CopyOnWriteArraySet<MappedClass>(); // depends on control dependency: [if], data = [none]
final Set<MappedClass> temp = mappedClassesByCollection.putIfAbsent(mc.getCollectionName(), mcs);
if (temp != null) {
mcs = temp; // depends on control dependency: [if], data = [none]
}
}
mcs.add(mc);
return mc;
} } |
public class class_name {
@Override
protected final void prepareSocket(final SSLSocket socket) {
String[] supported = socket.getSupportedProtocols();
String[] enabled = socket.getEnabledProtocols();
if (LOG.isDebugEnabled()) {
LOG.debug("socket.getSupportedProtocols(): " + Arrays.toString(supported)
+ ", socket.getEnabledProtocols(): " + Arrays.toString(enabled));
}
List<String> target = new ArrayList<String>();
if (supported != null) {
// Append the preferred protocols in descending order of preference
// but only do so if the protocols are supported
TLSProtocol[] values = TLSProtocol.values();
for (int i = 0; i < values.length; i++) {
final String pname = values[i].getProtocolName();
if (existsIn(pname, supported)) {
target.add(pname);
}
}
}
if (enabled != null) {
// Append the rest of the already enabled protocols to the end
// if not already included in the list
for (String pname : enabled) {
if (!target.contains(pname)) {
target.add(pname);
}
}
}
if (target.size() > 0) {
String[] enabling = target.toArray(new String[target.size()]);
socket.setEnabledProtocols(enabling);
if (LOG.isDebugEnabled()) {
LOG.debug("TLS protocol enabled for SSL handshake: " + Arrays.toString(enabling));
}
}
} } | public class class_name {
@Override
protected final void prepareSocket(final SSLSocket socket) {
String[] supported = socket.getSupportedProtocols();
String[] enabled = socket.getEnabledProtocols();
if (LOG.isDebugEnabled()) {
LOG.debug("socket.getSupportedProtocols(): " + Arrays.toString(supported)
+ ", socket.getEnabledProtocols(): " + Arrays.toString(enabled)); // depends on control dependency: [if], data = [none]
}
List<String> target = new ArrayList<String>();
if (supported != null) {
// Append the preferred protocols in descending order of preference
// but only do so if the protocols are supported
TLSProtocol[] values = TLSProtocol.values();
for (int i = 0; i < values.length; i++) {
final String pname = values[i].getProtocolName();
if (existsIn(pname, supported)) {
target.add(pname); // depends on control dependency: [if], data = [none]
}
}
}
if (enabled != null) {
// Append the rest of the already enabled protocols to the end
// if not already included in the list
for (String pname : enabled) {
if (!target.contains(pname)) {
target.add(pname); // depends on control dependency: [if], data = [none]
}
}
}
if (target.size() > 0) {
String[] enabling = target.toArray(new String[target.size()]);
socket.setEnabledProtocols(enabling); // depends on control dependency: [if], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug("TLS protocol enabled for SSL handshake: " + Arrays.toString(enabling)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone()));
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} } | public class class_name {
protected AForAllExp makeRelContext(ATypeDefinition node, AVariableExp... exps){
AForAllExp forall_exp = new AForAllExp();
forall_exp.setType(new ABooleanBasicType());
ATypeMultipleBind tmb = new ATypeMultipleBind();
List<PPattern> pats = new LinkedList<>();
for (AVariableExp exp : exps)
{
pats.add(AstFactory.newAIdentifierPattern(exp.getName().clone())); // depends on control dependency: [for], data = [exp]
}
tmb.setPlist(pats);
tmb.setType(node.getType().clone());
List<PMultipleBind> binds = new LinkedList<>();
binds.add(tmb);
forall_exp.setBindList(binds);
return forall_exp;
} } |
public class class_name {
public List<MeasureType.MeasureRelationship> getMeasureRelationship() {
if (measureRelationship == null) {
measureRelationship = new ArrayList<MeasureType.MeasureRelationship>();
}
return this.measureRelationship;
} } | public class class_name {
public List<MeasureType.MeasureRelationship> getMeasureRelationship() {
if (measureRelationship == null) {
measureRelationship = new ArrayList<MeasureType.MeasureRelationship>(); // depends on control dependency: [if], data = [none]
}
return this.measureRelationship;
} } |
public class class_name {
public void onManagerEvent(ManagerEvent event)
{
// Handle Channel related events
if (event instanceof ConnectEvent)
{
handleConnectEvent((ConnectEvent) event);
}
else if (event instanceof DisconnectEvent)
{
handleDisconnectEvent((DisconnectEvent) event);
}
else if (event instanceof NewChannelEvent)
{
channelManager.handleNewChannelEvent((NewChannelEvent) event);
}
else if (event instanceof NewExtenEvent)
{
channelManager.handleNewExtenEvent((NewExtenEvent) event);
}
else if (event instanceof NewStateEvent)
{
channelManager.handleNewStateEvent((NewStateEvent) event);
}
else if (event instanceof NewCallerIdEvent)
{
channelManager.handleNewCallerIdEvent((NewCallerIdEvent) event);
}
else if (event instanceof DialEvent)
{
channelManager.handleDialEvent((DialEvent) event);
}
else if (event instanceof BridgeEvent)
{
channelManager.handleBridgeEvent((BridgeEvent) event);
}
else if (event instanceof RenameEvent)
{
channelManager.handleRenameEvent((RenameEvent) event);
}
else if (event instanceof HangupEvent)
{
channelManager.handleHangupEvent((HangupEvent) event);
}
else if (event instanceof CdrEvent)
{
channelManager.handleCdrEvent((CdrEvent) event);
}
else if (event instanceof VarSetEvent)
{
channelManager.handleVarSetEvent((VarSetEvent) event);
}
else if (event instanceof DtmfEvent)
{
channelManager.handleDtmfEvent((DtmfEvent) event);
}
else if (event instanceof MonitorStartEvent)
{
channelManager.handleMonitorStartEvent((MonitorStartEvent) event);
}
else if (event instanceof MonitorStopEvent)
{
channelManager.handleMonitorStopEvent((MonitorStopEvent) event);
}
// End of channel related events
// Handle parking related event
else if (event instanceof ParkedCallEvent)
{
channelManager.handleParkedCallEvent((ParkedCallEvent) event);
}
else if (event instanceof ParkedCallGiveUpEvent)
{
channelManager.handleParkedCallGiveUpEvent((ParkedCallGiveUpEvent) event);
}
else if (event instanceof ParkedCallTimeOutEvent)
{
channelManager.handleParkedCallTimeOutEvent((ParkedCallTimeOutEvent) event);
}
else if (event instanceof UnparkedCallEvent)
{
channelManager.handleUnparkedCallEvent((UnparkedCallEvent) event);
}
// End of parking related events
// Handle queue related event
else if (event instanceof JoinEvent)
{
queueManager.handleJoinEvent((JoinEvent) event);
}
else if (event instanceof LeaveEvent)
{
queueManager.handleLeaveEvent((LeaveEvent) event);
}
else if (event instanceof QueueMemberStatusEvent)
{
queueManager.handleQueueMemberStatusEvent((QueueMemberStatusEvent) event);
}
else if (event instanceof QueueMemberPenaltyEvent)
{
queueManager.handleQueueMemberPenaltyEvent((QueueMemberPenaltyEvent) event);
}
else if (event instanceof QueueMemberAddedEvent)
{
queueManager.handleQueueMemberAddedEvent((QueueMemberAddedEvent) event);
}
else if (event instanceof QueueMemberRemovedEvent)
{
queueManager.handleQueueMemberRemovedEvent((QueueMemberRemovedEvent) event);
}
else if (event instanceof QueueMemberPausedEvent)
{
queueManager.handleQueueMemberPausedEvent((QueueMemberPausedEvent) event);
}
// >>>>>> AJ 94
// Handle meetMeEvents
else if (event instanceof AbstractMeetMeEvent)
{
meetMeManager.handleMeetMeEvent((AbstractMeetMeEvent) event);
}
else if (event instanceof OriginateResponseEvent)
{
handleOriginateEvent((OriginateResponseEvent) event);
}
// Handle agents-related events
else if (event instanceof AgentsEvent)
{
agentManager.handleAgentsEvent((AgentsEvent) event);
}
else if (event instanceof AgentCalledEvent)
{
agentManager.handleAgentCalledEvent((AgentCalledEvent) event);
}
else if (event instanceof AgentConnectEvent)
{
agentManager.handleAgentConnectEvent((AgentConnectEvent) event);
}
else if (event instanceof AgentCompleteEvent)
{
agentManager.handleAgentCompleteEvent((AgentCompleteEvent) event);
}
else if (event instanceof AgentCallbackLoginEvent)
{
agentManager.handleAgentCallbackLoginEvent((AgentCallbackLoginEvent) event);
}
else if (event instanceof AgentCallbackLogoffEvent)
{
agentManager.handleAgentCallbackLogoffEvent((AgentCallbackLogoffEvent) event);
}
else if (event instanceof AgentLoginEvent)
{
agentManager.handleAgentLoginEvent((AgentLoginEvent) event);
}
else if (event instanceof AgentLogoffEvent)
{
agentManager.handleAgentLogoffEvent((AgentLogoffEvent) event);
}
// End of agent-related events
// dispatch the events to the chainListener if they exist.
fireChainListeners(event);
} } | public class class_name {
public void onManagerEvent(ManagerEvent event)
{
// Handle Channel related events
if (event instanceof ConnectEvent)
{
handleConnectEvent((ConnectEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof DisconnectEvent)
{
handleDisconnectEvent((DisconnectEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof NewChannelEvent)
{
channelManager.handleNewChannelEvent((NewChannelEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof NewExtenEvent)
{
channelManager.handleNewExtenEvent((NewExtenEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof NewStateEvent)
{
channelManager.handleNewStateEvent((NewStateEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof NewCallerIdEvent)
{
channelManager.handleNewCallerIdEvent((NewCallerIdEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof DialEvent)
{
channelManager.handleDialEvent((DialEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof BridgeEvent)
{
channelManager.handleBridgeEvent((BridgeEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof RenameEvent)
{
channelManager.handleRenameEvent((RenameEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof HangupEvent)
{
channelManager.handleHangupEvent((HangupEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof CdrEvent)
{
channelManager.handleCdrEvent((CdrEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof VarSetEvent)
{
channelManager.handleVarSetEvent((VarSetEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof DtmfEvent)
{
channelManager.handleDtmfEvent((DtmfEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof MonitorStartEvent)
{
channelManager.handleMonitorStartEvent((MonitorStartEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof MonitorStopEvent)
{
channelManager.handleMonitorStopEvent((MonitorStopEvent) event); // depends on control dependency: [if], data = [none]
}
// End of channel related events
// Handle parking related event
else if (event instanceof ParkedCallEvent)
{
channelManager.handleParkedCallEvent((ParkedCallEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof ParkedCallGiveUpEvent)
{
channelManager.handleParkedCallGiveUpEvent((ParkedCallGiveUpEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof ParkedCallTimeOutEvent)
{
channelManager.handleParkedCallTimeOutEvent((ParkedCallTimeOutEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof UnparkedCallEvent)
{
channelManager.handleUnparkedCallEvent((UnparkedCallEvent) event); // depends on control dependency: [if], data = [none]
}
// End of parking related events
// Handle queue related event
else if (event instanceof JoinEvent)
{
queueManager.handleJoinEvent((JoinEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof LeaveEvent)
{
queueManager.handleLeaveEvent((LeaveEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof QueueMemberStatusEvent)
{
queueManager.handleQueueMemberStatusEvent((QueueMemberStatusEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof QueueMemberPenaltyEvent)
{
queueManager.handleQueueMemberPenaltyEvent((QueueMemberPenaltyEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof QueueMemberAddedEvent)
{
queueManager.handleQueueMemberAddedEvent((QueueMemberAddedEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof QueueMemberRemovedEvent)
{
queueManager.handleQueueMemberRemovedEvent((QueueMemberRemovedEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof QueueMemberPausedEvent)
{
queueManager.handleQueueMemberPausedEvent((QueueMemberPausedEvent) event); // depends on control dependency: [if], data = [none]
}
// >>>>>> AJ 94
// Handle meetMeEvents
else if (event instanceof AbstractMeetMeEvent)
{
meetMeManager.handleMeetMeEvent((AbstractMeetMeEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof OriginateResponseEvent)
{
handleOriginateEvent((OriginateResponseEvent) event); // depends on control dependency: [if], data = [none]
}
// Handle agents-related events
else if (event instanceof AgentsEvent)
{
agentManager.handleAgentsEvent((AgentsEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentCalledEvent)
{
agentManager.handleAgentCalledEvent((AgentCalledEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentConnectEvent)
{
agentManager.handleAgentConnectEvent((AgentConnectEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentCompleteEvent)
{
agentManager.handleAgentCompleteEvent((AgentCompleteEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentCallbackLoginEvent)
{
agentManager.handleAgentCallbackLoginEvent((AgentCallbackLoginEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentCallbackLogoffEvent)
{
agentManager.handleAgentCallbackLogoffEvent((AgentCallbackLogoffEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentLoginEvent)
{
agentManager.handleAgentLoginEvent((AgentLoginEvent) event); // depends on control dependency: [if], data = [none]
}
else if (event instanceof AgentLogoffEvent)
{
agentManager.handleAgentLogoffEvent((AgentLogoffEvent) event); // depends on control dependency: [if], data = [none]
}
// End of agent-related events
// dispatch the events to the chainListener if they exist.
fireChainListeners(event);
} } |
public class class_name {
private void _processMetadata(HashMap<String, Object> result) {
// the collections in the result can be either an object[] or a HashSet<object>, depending on the serializer that is used
Object methods = result.get("methods");
Object attrs = result.get("attrs");
Object oneways = result.get("oneways");
if(methods instanceof Object[]) {
Object[] methods_array = (Object[]) methods;
this.pyroMethods = new HashSet<String>();
for(int i=0; i<methods_array.length; ++i) {
this.pyroMethods.add((String) methods_array[i]);
}
} else if(methods!=null) {
this.pyroMethods = getSetOfStrings(methods);
}
if(attrs instanceof Object[]) {
Object[] attrs_array = (Object[]) attrs;
this.pyroAttrs = new HashSet<String>();
for(int i=0; i<attrs_array.length; ++i) {
this.pyroAttrs.add((String) attrs_array[i]);
}
} else if(attrs!=null) {
this.pyroAttrs = getSetOfStrings(attrs);
}
if(oneways instanceof Object[]) {
Object[] oneways_array = (Object[]) oneways;
this.pyroOneway = new HashSet<String>();
for(int i=0; i<oneways_array.length; ++i) {
this.pyroOneway.add((String) oneways_array[i]);
}
} else if(oneways!=null) {
this.pyroOneway = getSetOfStrings(oneways);
}
if(pyroMethods.isEmpty() && pyroAttrs.isEmpty()) {
throw new PyroException("remote object doesn't expose any methods or attributes");
}
} } | public class class_name {
private void _processMetadata(HashMap<String, Object> result) {
// the collections in the result can be either an object[] or a HashSet<object>, depending on the serializer that is used
Object methods = result.get("methods");
Object attrs = result.get("attrs");
Object oneways = result.get("oneways");
if(methods instanceof Object[]) {
Object[] methods_array = (Object[]) methods;
this.pyroMethods = new HashSet<String>(); // depends on control dependency: [if], data = [none]
for(int i=0; i<methods_array.length; ++i) {
this.pyroMethods.add((String) methods_array[i]); // depends on control dependency: [for], data = [i]
}
} else if(methods!=null) {
this.pyroMethods = getSetOfStrings(methods); // depends on control dependency: [if], data = [(methods]
}
if(attrs instanceof Object[]) {
Object[] attrs_array = (Object[]) attrs;
this.pyroAttrs = new HashSet<String>(); // depends on control dependency: [if], data = [none]
for(int i=0; i<attrs_array.length; ++i) {
this.pyroAttrs.add((String) attrs_array[i]); // depends on control dependency: [for], data = [i]
}
} else if(attrs!=null) {
this.pyroAttrs = getSetOfStrings(attrs); // depends on control dependency: [if], data = [(attrs]
}
if(oneways instanceof Object[]) {
Object[] oneways_array = (Object[]) oneways;
this.pyroOneway = new HashSet<String>(); // depends on control dependency: [if], data = [none]
for(int i=0; i<oneways_array.length; ++i) {
this.pyroOneway.add((String) oneways_array[i]); // depends on control dependency: [for], data = [i]
}
} else if(oneways!=null) {
this.pyroOneway = getSetOfStrings(oneways); // depends on control dependency: [if], data = [(oneways]
}
if(pyroMethods.isEmpty() && pyroAttrs.isEmpty()) {
throw new PyroException("remote object doesn't expose any methods or attributes");
}
} } |
public class class_name {
private static JQL buildJQLUpdate(final SQLiteModelMethod method, final JQL result, final Map<JQLDynamicStatementType, String> dynamicReplace, String preparedJql) {
final Class<? extends Annotation> annotation = BindSqlUpdate.class;
// extract some informaction from method and bean
// use annotation's attribute value and exclude and bean definition to
// define field list
// final Set<String> fields = defineFields(JQLType.UPDATE, method,
// annotation, false);
if (StringUtils.hasText(preparedJql)) {
result.value = preparedJql;
// UPDATE can contains bind parameter in column values and select
// statement
final One<Boolean> inWhereCondition = new One<Boolean>(false);
final One<Boolean> inColumnsToUpdate = new One<Boolean>(false);
JQLChecker.getInstance().analyze(method, result, new JqlBaseListener() {
@Override
public void enterProjected_columns(Projected_columnsContext ctx) {
if (inColumnsToUpdate.value0) {
result.containsSelectOperation = true;
}
}
@Override
public void enterConflict_algorithm(Conflict_algorithmContext ctx) {
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(ctx.getText().toUpperCase());
}
@Override
public void enterWhere_stmt(Where_stmtContext ctx) {
inWhereCondition.value0 = true;
}
@Override
public void exitWhere_stmt_clauses(Where_stmt_clausesContext ctx) {
inWhereCondition.value0 = false;
}
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
if (inWhereCondition.value0) {
result.bindParameterOnWhereStatementCounter++;
} else {
result.bindParameterAsColumnValueCounter++;
}
}
@Override
public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
JQLDynamicStatementType dynamicType = JQLDynamicStatementType.valueOf(ctx.bind_parameter_name().getText().toUpperCase());
int start = ctx.getStart().getStartIndex() - 1;
int stop = ctx.getStop().getStopIndex() + 1;
String dynamicWhere = result.value.substring(start, stop);
dynamicReplace.put(dynamicType, dynamicWhere);
// super.enterBind_dynamic_sql(ctx);
}
@Override
public void enterColumns_to_update(Columns_to_updateContext ctx) {
inColumnsToUpdate.value0 = true;
}
@Override
public void exitColumns_to_update(Columns_to_updateContext ctx) {
inColumnsToUpdate.value0 = false;
}
});
JQLChecker.getInstance().replaceVariableStatements(method, preparedJql, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
result.annotatedWhere = true;
result.staticWhereConditions = true;
return null;
}
});
if (result.containsSelectOperation) {
AssertKripton.assertTrueOrInvalidMethodSignException(method.getReturnClass().equals(TypeName.VOID), method, "defined JQL requires that method's return type is void");
}
} else {
final SQLiteDaoDefinition dao = method.getParent();
Set<String> fields;
ModifyType modifyType = SqlModifyBuilder.detectModifyType(method, JQLType.UPDATE);
if (modifyType == ModifyType.UPDATE_BEAN) {
fields = extractFieldsFromAnnotation(method, annotation, false);
} else {
fields = extractFieldsFromMethodParameters(method, annotation);
}
AssertKripton.assertTrueOrInvalidMethodSignException(fields.size() > 0, method, "no field was specified for update");
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(AnnotationUtility.extractAsEnumerationValue(method.getElement(), annotation, AnnotationAttributeType.CONFLICT_ALGORITHM_TYPE));
StringBuilder builder = new StringBuilder();
builder.append(UPDATE_KEYWORD);
builder.append(" " + result.conflictAlgorithmType.getSqlForInsert());
// entity name
builder.append(dao.getEntitySimplyClassName());
// recreate fields
final One<String> prefix = new One<>("");
if (result.hasParamBean()) {
prefix.value0 = result.paramBean + ".";
}
builder.append(" " + SET_KEYWORD + " ");
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return item + "=" + SqlAnalyzer.PARAM_PREFIX + prefix.value0 + item + SqlAnalyzer.PARAM_SUFFIX;
}
}));
builder.append(defineWhereStatement(method, result, annotation, dynamicReplace));
result.value = builder.toString();
}
result.operationType = JQLType.UPDATE;
result.dynamicReplace = dynamicReplace;
return result;
} } | public class class_name {
private static JQL buildJQLUpdate(final SQLiteModelMethod method, final JQL result, final Map<JQLDynamicStatementType, String> dynamicReplace, String preparedJql) {
final Class<? extends Annotation> annotation = BindSqlUpdate.class;
// extract some informaction from method and bean
// use annotation's attribute value and exclude and bean definition to
// define field list
// final Set<String> fields = defineFields(JQLType.UPDATE, method,
// annotation, false);
if (StringUtils.hasText(preparedJql)) {
result.value = preparedJql; // depends on control dependency: [if], data = [none]
// UPDATE can contains bind parameter in column values and select
// statement
final One<Boolean> inWhereCondition = new One<Boolean>(false);
final One<Boolean> inColumnsToUpdate = new One<Boolean>(false);
JQLChecker.getInstance().analyze(method, result, new JqlBaseListener() {
@Override
public void enterProjected_columns(Projected_columnsContext ctx) {
if (inColumnsToUpdate.value0) {
result.containsSelectOperation = true; // depends on control dependency: [if], data = [none]
}
}
@Override
public void enterConflict_algorithm(Conflict_algorithmContext ctx) {
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(ctx.getText().toUpperCase());
}
@Override
public void enterWhere_stmt(Where_stmtContext ctx) {
inWhereCondition.value0 = true;
}
@Override
public void exitWhere_stmt_clauses(Where_stmt_clausesContext ctx) {
inWhereCondition.value0 = false;
}
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
if (inWhereCondition.value0) {
result.bindParameterOnWhereStatementCounter++; // depends on control dependency: [if], data = [none]
} else {
result.bindParameterAsColumnValueCounter++; // depends on control dependency: [if], data = [none]
}
}
@Override
public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
JQLDynamicStatementType dynamicType = JQLDynamicStatementType.valueOf(ctx.bind_parameter_name().getText().toUpperCase());
int start = ctx.getStart().getStartIndex() - 1;
int stop = ctx.getStop().getStopIndex() + 1;
String dynamicWhere = result.value.substring(start, stop);
dynamicReplace.put(dynamicType, dynamicWhere);
// super.enterBind_dynamic_sql(ctx);
}
@Override
public void enterColumns_to_update(Columns_to_updateContext ctx) {
inColumnsToUpdate.value0 = true;
}
@Override
public void exitColumns_to_update(Columns_to_updateContext ctx) {
inColumnsToUpdate.value0 = false;
}
}); // depends on control dependency: [if], data = [none]
JQLChecker.getInstance().replaceVariableStatements(method, preparedJql, new JQLReplaceVariableStatementListenerImpl() {
@Override
public String onWhere(String statement) {
result.annotatedWhere = true;
result.staticWhereConditions = true;
return null;
}
}); // depends on control dependency: [if], data = [none]
if (result.containsSelectOperation) {
AssertKripton.assertTrueOrInvalidMethodSignException(method.getReturnClass().equals(TypeName.VOID), method, "defined JQL requires that method's return type is void"); // depends on control dependency: [if], data = [none]
}
} else {
final SQLiteDaoDefinition dao = method.getParent();
Set<String> fields;
ModifyType modifyType = SqlModifyBuilder.detectModifyType(method, JQLType.UPDATE);
if (modifyType == ModifyType.UPDATE_BEAN) {
fields = extractFieldsFromAnnotation(method, annotation, false); // depends on control dependency: [if], data = [none]
} else {
fields = extractFieldsFromMethodParameters(method, annotation); // depends on control dependency: [if], data = [none]
}
AssertKripton.assertTrueOrInvalidMethodSignException(fields.size() > 0, method, "no field was specified for update");
result.conflictAlgorithmType = ConflictAlgorithmType.valueOf(AnnotationUtility.extractAsEnumerationValue(method.getElement(), annotation, AnnotationAttributeType.CONFLICT_ALGORITHM_TYPE)); // depends on control dependency: [if], data = [none]
StringBuilder builder = new StringBuilder();
builder.append(UPDATE_KEYWORD); // depends on control dependency: [if], data = [none]
builder.append(" " + result.conflictAlgorithmType.getSqlForInsert()); // depends on control dependency: [if], data = [none]
// entity name
builder.append(dao.getEntitySimplyClassName()); // depends on control dependency: [if], data = [none]
// recreate fields
final One<String> prefix = new One<>("");
if (result.hasParamBean()) {
prefix.value0 = result.paramBean + "."; // depends on control dependency: [if], data = [none]
}
builder.append(" " + SET_KEYWORD + " "); // depends on control dependency: [if], data = [none]
builder.append(forEachFields(fields, new OnFieldListener() {
@Override
public String onField(String item) {
return item + "=" + SqlAnalyzer.PARAM_PREFIX + prefix.value0 + item + SqlAnalyzer.PARAM_SUFFIX;
}
})); // depends on control dependency: [if], data = [none]
builder.append(defineWhereStatement(method, result, annotation, dynamicReplace)); // depends on control dependency: [if], data = [none]
result.value = builder.toString(); // depends on control dependency: [if], data = [none]
}
result.operationType = JQLType.UPDATE;
result.dynamicReplace = dynamicReplace;
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public V get(Object key) {
Object k = maskNull(key);
Object[] tab = table;
int len = tab.length;
int i = hash(k, len);
while (true) {
Object item = tab[i];
if (item == k)
return (V) tab[i + 1];
if (item == null)
return null;
i = nextKeyIndex(i, len);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public V get(Object key) {
Object k = maskNull(key);
Object[] tab = table;
int len = tab.length;
int i = hash(k, len);
while (true) {
Object item = tab[i];
if (item == k)
return (V) tab[i + 1];
if (item == null)
return null;
i = nextKeyIndex(i, len); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private void stopWriterAndClearMasterServerList() {
for (Server server : this.masterServersList) {
for (OutputWriter writer : server.getOutputWriters()) {
try {
writer.close();
} catch (LifecycleException ex) {
log.error("Eror stopping writer: {}", writer);
}
}
for (Query query : server.getQueries()) {
for (OutputWriter writer : query.getOutputWriterInstances()) {
try {
writer.close();
log.debug("Stopped writer: {} for query: {}", writer, query);
} catch (LifecycleException ex) {
log.error("Error stopping writer: {} for query: {}", writer, query, ex);
}
}
}
}
this.masterServersList = ImmutableList.of();
} } | public class class_name {
private void stopWriterAndClearMasterServerList() {
for (Server server : this.masterServersList) {
for (OutputWriter writer : server.getOutputWriters()) {
try {
writer.close(); // depends on control dependency: [try], data = [none]
} catch (LifecycleException ex) {
log.error("Eror stopping writer: {}", writer);
} // depends on control dependency: [catch], data = [none]
}
for (Query query : server.getQueries()) {
for (OutputWriter writer : query.getOutputWriterInstances()) {
try {
writer.close(); // depends on control dependency: [try], data = [none]
log.debug("Stopped writer: {} for query: {}", writer, query); // depends on control dependency: [try], data = [none]
} catch (LifecycleException ex) {
log.error("Error stopping writer: {} for query: {}", writer, query, ex);
} // depends on control dependency: [catch], data = [none]
}
}
}
this.masterServersList = ImmutableList.of();
} } |
public class class_name {
private void addSelfToAtoms() {
List<Bond> bonds = atomA.getBonds();
if (bonds==null) {
bonds = new ArrayList<Bond>(AtomImpl.BONDS_INITIAL_CAPACITY);
atomA.setBonds(bonds);
}
boolean exists = false;
for (Bond bond : bonds) {
// TODO is it equals() what we want here, or is it == ? - JD 2016-03-02
if (bond.getOther(atomA).equals(atomB)) {
exists = true;
break;
}
}
if (!exists) {
atomA.addBond(this);
atomB.addBond(this);
}
} } | public class class_name {
private void addSelfToAtoms() {
List<Bond> bonds = atomA.getBonds();
if (bonds==null) {
bonds = new ArrayList<Bond>(AtomImpl.BONDS_INITIAL_CAPACITY); // depends on control dependency: [if], data = [none]
atomA.setBonds(bonds); // depends on control dependency: [if], data = [(bonds]
}
boolean exists = false;
for (Bond bond : bonds) {
// TODO is it equals() what we want here, or is it == ? - JD 2016-03-02
if (bond.getOther(atomA).equals(atomB)) {
exists = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!exists) {
atomA.addBond(this); // depends on control dependency: [if], data = [none]
atomB.addBond(this); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Object convertReference(Object fieldValue) {
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue));
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue;
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} } | public class class_name {
private Object convertReference(Object fieldValue) {
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue)); // depends on control dependency: [if], data = [none]
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} } |
public class class_name {
@Override
public Element readElement(final int index) throws IOException {
if (index < 0) {
throw new IndexOutOfBoundsException("Index is negative.");
}
if (closed) {
throw new IllegalStateException("Reader is closed.");
}
while (index >= buffer.size()) {
Element element = reader.readElement();
if (element == null) {
throw new IndexOutOfBoundsException(
"Index is larger or equal to the number of elements.");
} else {
buffer.add(element);
}
}
return buffer.get(index);
} } | public class class_name {
@Override
public Element readElement(final int index) throws IOException {
if (index < 0) {
throw new IndexOutOfBoundsException("Index is negative.");
}
if (closed) {
throw new IllegalStateException("Reader is closed.");
}
while (index >= buffer.size()) {
Element element = reader.readElement();
if (element == null) {
throw new IndexOutOfBoundsException(
"Index is larger or equal to the number of elements.");
} else {
buffer.add(element); // depends on control dependency: [if], data = [(element]
}
}
return buffer.get(index);
} } |
public class class_name {
public void setETag(String eTag) {
if (eTag != null) {
Assert.isTrue(eTag.startsWith("\"") || eTag.startsWith("W/"),
"Invalid eTag, does not start with W/ or \"");
Assert.isTrue(eTag.endsWith("\""), "Invalid eTag, does not end with \"");
}
set(ETAG, eTag);
} } | public class class_name {
public void setETag(String eTag) {
if (eTag != null) {
Assert.isTrue(eTag.startsWith("\"") || eTag.startsWith("W/"),
"Invalid eTag, does not start with W/ or \""); // depends on control dependency: [if], data = [(eTag]
Assert.isTrue(eTag.endsWith("\""), "Invalid eTag, does not end with \""); // depends on control dependency: [if], data = [(eTag]
}
set(ETAG, eTag);
} } |
public class class_name {
public String ruleMatchesToXmlSnippet(List<RuleMatch> ruleMatches, String text, int contextSize) {
StringBuilder xml = new StringBuilder(CAPACITY);
//
// IMPORTANT: people rely on this format, don't change it!
//
ContextTools contextTools = new ContextTools();
contextTools.setEscapeHtml(false);
contextTools.setContextSize(contextSize);
String startMarker = "__languagetool_start_marker";
contextTools.setErrorMarkerStart(startMarker);
contextTools.setErrorMarkerEnd("");
for (RuleMatch match : ruleMatches) {
String subId = "";
if (match.getRule() instanceof AbstractPatternRule) {
AbstractPatternRule pRule = (AbstractPatternRule) match.getRule();
if (pRule.getSubId() != null) {
subId = " subId=\"" + escapeXMLForAPIOutput(pRule.getSubId()) + "\" ";
}
}
xml.append("<error fromy=\"").append(match.getLine()).append('"')
.append(" fromx=\"").append(match.getColumn() - 1).append('"')
.append(" toy=\"").append(match.getEndLine()).append('"')
.append(" tox=\"").append(match.getEndColumn() - 1).append('"')
.append(" ruleId=\"").append(match.getRule().getId()).append('"');
xml.append(subId);
String msg = match.getMessage().replaceAll("</?suggestion>", "'");
xml.append(" msg=\"").append(escapeXMLForAPIOutput(msg)).append('"');
if (!match.getShortMessage().isEmpty()) {
xml.append(" shortmsg=\"").append(escapeXMLForAPIOutput(match.getShortMessage())).append('"');
}
xml.append(" replacements=\"").append(escapeXMLForAPIOutput(
String.join("#", match.getSuggestedReplacements()))).append('"');
String context = contextTools.getContext(match.getFromPos(), match.getToPos(), text);
// get position of error in context and remove artificial marker again:
int contextOffset = context.indexOf(startMarker);
context = context.replaceFirst(startMarker, "");
context = context.replaceAll("[\n\r]", " ");
xml.append(" context=\"").append(escapeForXmlAttribute(context)).append('"')
.append(" contextoffset=\"").append(contextOffset).append('"')
.append(" offset=\"").append(match.getFromPos()).append('"')
.append(" errorlength=\"").append(match.getToPos() - match.getFromPos()).append('"');
if (match.getRule().getUrl() != null) {
xml.append(" url=\"").append(escapeXMLForAPIOutput(match.getRule().getUrl().toString())).append('"');
}
Category category = match.getRule().getCategory();
if (category != null) {
xml.append(" category=\"").append(escapeXMLForAPIOutput(category.getName())).append('"');
CategoryId id = category.getId();
if (id != null) {
xml.append(" categoryid=\"").append(escapeXMLForAPIOutput(id.toString())).append('"');
}
}
ITSIssueType type = match.getRule().getLocQualityIssueType();
if (type != null) {
xml.append(" locqualityissuetype=\"").append(escapeXMLForAPIOutput(type.toString())).append('"');
}
xml.append("/>\n");
}
return xml.toString();
} } | public class class_name {
public String ruleMatchesToXmlSnippet(List<RuleMatch> ruleMatches, String text, int contextSize) {
StringBuilder xml = new StringBuilder(CAPACITY);
//
// IMPORTANT: people rely on this format, don't change it!
//
ContextTools contextTools = new ContextTools();
contextTools.setEscapeHtml(false);
contextTools.setContextSize(contextSize);
String startMarker = "__languagetool_start_marker";
contextTools.setErrorMarkerStart(startMarker);
contextTools.setErrorMarkerEnd("");
for (RuleMatch match : ruleMatches) {
String subId = "";
if (match.getRule() instanceof AbstractPatternRule) {
AbstractPatternRule pRule = (AbstractPatternRule) match.getRule();
if (pRule.getSubId() != null) {
subId = " subId=\"" + escapeXMLForAPIOutput(pRule.getSubId()) + "\" "; // depends on control dependency: [if], data = [(pRule.getSubId()]
}
}
xml.append("<error fromy=\"").append(match.getLine()).append('"')
.append(" fromx=\"").append(match.getColumn() - 1).append('"')
.append(" toy=\"").append(match.getEndLine()).append('"')
.append(" tox=\"").append(match.getEndColumn() - 1).append('"')
.append(" ruleId=\"").append(match.getRule().getId()).append('"'); // depends on control dependency: [for], data = [match]
xml.append(subId); // depends on control dependency: [for], data = [none]
String msg = match.getMessage().replaceAll("</?suggestion>", "'");
xml.append(" msg=\"").append(escapeXMLForAPIOutput(msg)).append('"'); // depends on control dependency: [for], data = [none]
if (!match.getShortMessage().isEmpty()) {
xml.append(" shortmsg=\"").append(escapeXMLForAPIOutput(match.getShortMessage())).append('"'); // depends on control dependency: [if], data = [none]
}
xml.append(" replacements=\"").append(escapeXMLForAPIOutput(
String.join("#", match.getSuggestedReplacements()))).append('"'); // depends on control dependency: [for], data = [none]
String context = contextTools.getContext(match.getFromPos(), match.getToPos(), text);
// get position of error in context and remove artificial marker again:
int contextOffset = context.indexOf(startMarker);
context = context.replaceFirst(startMarker, ""); // depends on control dependency: [for], data = [none]
context = context.replaceAll("[\n\r]", " "); // depends on control dependency: [for], data = [none]
xml.append(" context=\"").append(escapeForXmlAttribute(context)).append('"')
.append(" contextoffset=\"").append(contextOffset).append('"')
.append(" offset=\"").append(match.getFromPos()).append('"')
.append(" errorlength=\"").append(match.getToPos() - match.getFromPos()).append('"'); // depends on control dependency: [for], data = [none]
if (match.getRule().getUrl() != null) {
xml.append(" url=\"").append(escapeXMLForAPIOutput(match.getRule().getUrl().toString())).append('"'); // depends on control dependency: [if], data = [(match.getRule().getUrl()]
}
Category category = match.getRule().getCategory();
if (category != null) {
xml.append(" category=\"").append(escapeXMLForAPIOutput(category.getName())).append('"'); // depends on control dependency: [if], data = [(category]
CategoryId id = category.getId();
if (id != null) {
xml.append(" categoryid=\"").append(escapeXMLForAPIOutput(id.toString())).append('"'); // depends on control dependency: [if], data = [(id]
}
}
ITSIssueType type = match.getRule().getLocQualityIssueType();
if (type != null) {
xml.append(" locqualityissuetype=\"").append(escapeXMLForAPIOutput(type.toString())).append('"'); // depends on control dependency: [if], data = [(type]
}
xml.append("/>\n"); // depends on control dependency: [for], data = [none]
}
return xml.toString();
} } |
public class class_name {
public static <R> ImmutableGrid<R> copyOfDeriveCounts(Iterable<? extends Cell<R>> cells) {
if (cells == null) {
throw new IllegalArgumentException("Cells must not be null");
}
if (!cells.iterator().hasNext()) {
return new EmptyGrid<R>();
}
int rowCount = 0;
int columnCount = 0;
for (Cell<R> cell : cells) {
rowCount = Math.max(rowCount, cell.getRow());
columnCount = Math.max(columnCount, cell.getColumn());
}
return new SparseImmutableGrid<R>(rowCount + 1, columnCount + 1, cells);
} } | public class class_name {
public static <R> ImmutableGrid<R> copyOfDeriveCounts(Iterable<? extends Cell<R>> cells) {
if (cells == null) {
throw new IllegalArgumentException("Cells must not be null");
}
if (!cells.iterator().hasNext()) {
return new EmptyGrid<R>(); // depends on control dependency: [if], data = [none]
}
int rowCount = 0;
int columnCount = 0;
for (Cell<R> cell : cells) {
rowCount = Math.max(rowCount, cell.getRow()); // depends on control dependency: [for], data = [cell]
columnCount = Math.max(columnCount, cell.getColumn()); // depends on control dependency: [for], data = [cell]
}
return new SparseImmutableGrid<R>(rowCount + 1, columnCount + 1, cells);
} } |
public class class_name {
@Override
public void close() {
if (!closed) {
closed = true;
try {
response.getOutputStream().close();
HttpServletRequest req = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
if (req != null) {
req.getAsyncContext().complete();
}
} catch (Exception ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Failed to close response stream", ex);
}
} finally {
ServerProviderFactory.releaseRequestState(message);
}
//TODO: remove from all broadcasters
}
} } | public class class_name {
@Override
public void close() {
if (!closed) {
closed = true; // depends on control dependency: [if], data = [none]
try {
response.getOutputStream().close(); // depends on control dependency: [try], data = [none]
HttpServletRequest req = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
if (req != null) {
req.getAsyncContext().complete(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Failed to close response stream", ex); // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
ServerProviderFactory.releaseRequestState(message);
}
//TODO: remove from all broadcasters
}
} } |
public class class_name {
static <T extends ContentMeta> boolean matches(Path path, T content, PathSelector pathSelector1, boolean default1,
ResourceSelector<T> resourceSelector1, boolean default2) {
boolean result;
if (null != pathSelector1) {
result = pathSelector1.matchesPath(path);
} else {
result = default1;
}
boolean result1;
if (null != resourceSelector1 && null != content) {
result1 = resourceSelector1.matchesContent(content);
} else {
result1 = default2;
}
return result && result1;
} } | public class class_name {
static <T extends ContentMeta> boolean matches(Path path, T content, PathSelector pathSelector1, boolean default1,
ResourceSelector<T> resourceSelector1, boolean default2) {
boolean result;
if (null != pathSelector1) {
result = pathSelector1.matchesPath(path); // depends on control dependency: [if], data = [none]
} else {
result = default1; // depends on control dependency: [if], data = [none]
}
boolean result1;
if (null != resourceSelector1 && null != content) {
result1 = resourceSelector1.matchesContent(content); // depends on control dependency: [if], data = [none]
} else {
result1 = default2; // depends on control dependency: [if], data = [none]
}
return result && result1;
} } |
public class class_name {
public List<BaseDownloadTask> shutdown() {
DownloadTask[] tasks = serialQueue.shutdown();
List<BaseDownloadTask> notRunningTasks = new ArrayList<>();
for (DownloadTask task : tasks) {
final DownloadTaskAdapter notRunningTask =
FileDownloadUtils.findDownloadTaskAdapter(task);
if (notRunningTask != null) {
notRunningTasks.add(notRunningTask);
FileDownloadList.getImpl().remove(notRunningTask);
}
}
return notRunningTasks;
} } | public class class_name {
public List<BaseDownloadTask> shutdown() {
DownloadTask[] tasks = serialQueue.shutdown();
List<BaseDownloadTask> notRunningTasks = new ArrayList<>();
for (DownloadTask task : tasks) {
final DownloadTaskAdapter notRunningTask =
FileDownloadUtils.findDownloadTaskAdapter(task);
if (notRunningTask != null) {
notRunningTasks.add(notRunningTask); // depends on control dependency: [if], data = [(notRunningTask]
FileDownloadList.getImpl().remove(notRunningTask); // depends on control dependency: [if], data = [(notRunningTask]
}
}
return notRunningTasks;
} } |
public class class_name {
public java.util.List<String> getListenerArns() {
if (listenerArns == null) {
listenerArns = new com.amazonaws.internal.SdkInternalList<String>();
}
return listenerArns;
} } | public class class_name {
public java.util.List<String> getListenerArns() {
if (listenerArns == null) {
listenerArns = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return listenerArns;
} } |
public class class_name {
public static String getValueForPath(CmsEntity entity, String[] pathElements) {
String result = null;
if ((pathElements != null) && (pathElements.length >= 1)) {
String attributeName = pathElements[0];
int index = CmsContentDefinition.extractIndex(attributeName);
if (index > 0) {
index--;
}
attributeName = entity.getTypeName() + "/" + CmsContentDefinition.removeIndex(attributeName);
CmsEntityAttribute attribute = entity.getAttribute(attributeName);
if (!((attribute == null) || (attribute.isComplexValue() && (pathElements.length == 1)))) {
if (attribute.isSimpleValue()) {
if ((pathElements.length == 1) && (attribute.getValueCount() > 0)) {
List<String> values = attribute.getSimpleValues();
result = values.get(index);
}
} else if (attribute.getValueCount() > (index)) {
String[] childPathElements = new String[pathElements.length - 1];
for (int i = 1; i < pathElements.length; i++) {
childPathElements[i - 1] = pathElements[i];
}
List<CmsEntity> values = attribute.getComplexValues();
result = getValueForPath(values.get(index), childPathElements);
}
}
}
return result;
} } | public class class_name {
public static String getValueForPath(CmsEntity entity, String[] pathElements) {
String result = null;
if ((pathElements != null) && (pathElements.length >= 1)) {
String attributeName = pathElements[0];
int index = CmsContentDefinition.extractIndex(attributeName);
if (index > 0) {
index--;
// depends on control dependency: [if], data = [none]
}
attributeName = entity.getTypeName() + "/" + CmsContentDefinition.removeIndex(attributeName);
// depends on control dependency: [if], data = [none]
CmsEntityAttribute attribute = entity.getAttribute(attributeName);
if (!((attribute == null) || (attribute.isComplexValue() && (pathElements.length == 1)))) {
if (attribute.isSimpleValue()) {
if ((pathElements.length == 1) && (attribute.getValueCount() > 0)) {
List<String> values = attribute.getSimpleValues();
result = values.get(index);
// depends on control dependency: [if], data = [none]
}
} else if (attribute.getValueCount() > (index)) {
String[] childPathElements = new String[pathElements.length - 1];
for (int i = 1; i < pathElements.length; i++) {
childPathElements[i - 1] = pathElements[i];
// depends on control dependency: [for], data = [i]
}
List<CmsEntity> values = attribute.getComplexValues();
result = getValueForPath(values.get(index), childPathElements);
// depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public static String minus(CharSequence self, Object target) {
String s = self.toString();
String text = DefaultGroovyMethods.toString(target);
int index = s.indexOf(text);
if (index == -1) return s;
int end = index + text.length();
if (s.length() > end) {
return s.substring(0, index) + s.substring(end);
}
return s.substring(0, index);
} } | public class class_name {
public static String minus(CharSequence self, Object target) {
String s = self.toString();
String text = DefaultGroovyMethods.toString(target);
int index = s.indexOf(text);
if (index == -1) return s;
int end = index + text.length();
if (s.length() > end) {
return s.substring(0, index) + s.substring(end); // depends on control dependency: [if], data = [end)]
}
return s.substring(0, index);
} } |
public class class_name {
public JobViewListing getJobViewsByLoggedInUser()
{
FlowStep flowStep = new FlowStep();
if(this.serviceTicket != null)
{
flowStep.setServiceTicket(this.serviceTicket);
}
return new JobViewListing(this.postJson(
flowStep, WS.Path.FlowStep.Version1.getAllViewsByLoggedInUser()));
} } | public class class_name {
public JobViewListing getJobViewsByLoggedInUser()
{
FlowStep flowStep = new FlowStep();
if(this.serviceTicket != null)
{
flowStep.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket]
}
return new JobViewListing(this.postJson(
flowStep, WS.Path.FlowStep.Version1.getAllViewsByLoggedInUser()));
} } |
public class class_name {
@Override
public boolean buyNumber(PhoneNumber phoneNumberObject, PhoneNumberParameters phoneNumberParameters) {
String phoneNumber = phoneNumberObject.getPhoneNumber();
phoneNumber = phoneNumber.substring(2);
// Provision the number from VoIP Innovations if they own it.
if (isValidDid(phoneNumber)) {
if (phoneNumber != null && !phoneNumber.isEmpty()) {
final StringBuilder buffer = new StringBuilder();
buffer.append("<request id=\""+generateId()+"\">");
buffer.append(header);
buffer.append("<body>");
buffer.append("<requesttype>").append("assignDID").append("</requesttype>");
buffer.append("<item>");
buffer.append("<did>").append(phoneNumber).append("</did>");
buffer.append("<endpointgroup>").append(endpoint).append("</endpointgroup>");
buffer.append("</item>");
buffer.append("</body>");
buffer.append("</request>");
final String body = buffer.toString();
final HttpPost post = new HttpPost(uri);
try {
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("apidata", body));
post.setEntity(new UrlEncodedFormEntity(parameters));
final DefaultHttpClient client = new DefaultHttpClient();
if(telestaxProxyEnabled) {
addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.ASSIGNDID.name());
}
final HttpResponse response = client.execute(post);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
final String content = StringUtils.toString(response.getEntity().getContent());
if (content.contains("<statuscode>100</statuscode>")) {
return true;
}
}
} catch (final Exception ignored) {
}
}
}
return false;
} } | public class class_name {
@Override
public boolean buyNumber(PhoneNumber phoneNumberObject, PhoneNumberParameters phoneNumberParameters) {
String phoneNumber = phoneNumberObject.getPhoneNumber();
phoneNumber = phoneNumber.substring(2);
// Provision the number from VoIP Innovations if they own it.
if (isValidDid(phoneNumber)) {
if (phoneNumber != null && !phoneNumber.isEmpty()) {
final StringBuilder buffer = new StringBuilder();
buffer.append("<request id=\""+generateId()+"\">"); // depends on control dependency: [if], data = [none]
buffer.append(header); // depends on control dependency: [if], data = [none]
buffer.append("<body>"); // depends on control dependency: [if], data = [none]
buffer.append("<requesttype>").append("assignDID").append("</requesttype>"); // depends on control dependency: [if], data = [none]
buffer.append("<item>"); // depends on control dependency: [if], data = [none]
buffer.append("<did>").append(phoneNumber).append("</did>"); // depends on control dependency: [if], data = [(phoneNumber]
buffer.append("<endpointgroup>").append(endpoint).append("</endpointgroup>"); // depends on control dependency: [if], data = [none]
buffer.append("</item>"); // depends on control dependency: [if], data = [none]
buffer.append("</body>"); // depends on control dependency: [if], data = [none]
buffer.append("</request>"); // depends on control dependency: [if], data = [none]
final String body = buffer.toString();
final HttpPost post = new HttpPost(uri);
try {
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("apidata", body)); // depends on control dependency: [try], data = [none]
post.setEntity(new UrlEncodedFormEntity(parameters)); // depends on control dependency: [try], data = [none]
final DefaultHttpClient client = new DefaultHttpClient();
if(telestaxProxyEnabled) {
addTelestaxProxyHeaders(post, ProvisionProvider.REQUEST_TYPE.ASSIGNDID.name()); // depends on control dependency: [if], data = [none]
}
final HttpResponse response = client.execute(post);
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
final String content = StringUtils.toString(response.getEntity().getContent());
if (content.contains("<statuscode>100</statuscode>")) {
return true; // depends on control dependency: [if], data = [none]
}
}
} catch (final Exception ignored) {
} // depends on control dependency: [catch], data = [none]
}
}
return false;
} } |
public class class_name {
private void validateExtension(LocalExtension localExtension, boolean dependencies)
{
Collection<String> namespaces = DefaultInstalledExtension.getNamespaces(localExtension);
if (namespaces == null) {
if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, null)) {
try {
validateExtension(localExtension, null, Collections.emptyMap());
} catch (InvalidExtensionException e) {
if (this.logger.isDebugEnabled()) {
this.logger.warn("Invalid extension [{}]", localExtension.getId(), e);
} else {
this.logger.warn("Invalid extension [{}] ({})", localExtension.getId(),
ExceptionUtils.getRootCauseMessage(e));
}
addInstalledExtension(localExtension, null, false);
}
}
} else {
for (String namespace : namespaces) {
if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, namespace)) {
try {
validateExtension(localExtension, namespace, Collections.emptyMap());
} catch (InvalidExtensionException e) {
if (this.logger.isDebugEnabled()) {
this.logger.warn("Invalid extension [{}] on namespace [{}]", localExtension.getId(),
namespace, e);
} else {
this.logger.warn("Invalid extension [{}] on namespace [{}] ({})", localExtension.getId(),
namespace, ExceptionUtils.getRootCauseMessage(e));
}
addInstalledExtension(localExtension, namespace, false);
}
}
}
}
} } | public class class_name {
private void validateExtension(LocalExtension localExtension, boolean dependencies)
{
Collection<String> namespaces = DefaultInstalledExtension.getNamespaces(localExtension);
if (namespaces == null) {
if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, null)) {
try {
validateExtension(localExtension, null, Collections.emptyMap()); // depends on control dependency: [try], data = [none]
} catch (InvalidExtensionException e) {
if (this.logger.isDebugEnabled()) {
this.logger.warn("Invalid extension [{}]", localExtension.getId(), e); // depends on control dependency: [if], data = [none]
} else {
this.logger.warn("Invalid extension [{}] ({})", localExtension.getId(),
ExceptionUtils.getRootCauseMessage(e)); // depends on control dependency: [if], data = [none]
}
addInstalledExtension(localExtension, null, false);
} // depends on control dependency: [catch], data = [none]
}
} else {
for (String namespace : namespaces) {
if (dependencies || !DefaultInstalledExtension.isDependency(localExtension, namespace)) {
try {
validateExtension(localExtension, namespace, Collections.emptyMap()); // depends on control dependency: [try], data = [none]
} catch (InvalidExtensionException e) {
if (this.logger.isDebugEnabled()) {
this.logger.warn("Invalid extension [{}] on namespace [{}]", localExtension.getId(),
namespace, e); // depends on control dependency: [if], data = [none]
} else {
this.logger.warn("Invalid extension [{}] on namespace [{}] ({})", localExtension.getId(),
namespace, ExceptionUtils.getRootCauseMessage(e)); // depends on control dependency: [if], data = [none]
}
addInstalledExtension(localExtension, namespace, false);
} // depends on control dependency: [catch], data = [none]
}
}
}
} } |
public class class_name {
@Override
public EntityManagerFactory getEntityManagerFactory(ServiceDomain domain) {
try {
final Bundle bundle = getApplicationBundle(domain);
if (bundle != null) {
Collection<ServiceReference<EntityManagerFactory>> refs = bundle.getBundleContext().getServiceReferences(EntityManagerFactory.class,
"(osgi.unit.name=org.jbpm.persistence.jpa)");
if (refs != null && refs.size() > 0) {
EntityManagerFactory emf = bundle.getBundleContext().getService(refs.iterator().next());
if (emf != null) {
return emf;
}
}
}
} catch (Exception e) {
e.fillInStackTrace();
}
// try the default
return super.getEntityManagerFactory(domain);
} } | public class class_name {
@Override
public EntityManagerFactory getEntityManagerFactory(ServiceDomain domain) {
try {
final Bundle bundle = getApplicationBundle(domain);
if (bundle != null) {
Collection<ServiceReference<EntityManagerFactory>> refs = bundle.getBundleContext().getServiceReferences(EntityManagerFactory.class,
"(osgi.unit.name=org.jbpm.persistence.jpa)");
if (refs != null && refs.size() > 0) {
EntityManagerFactory emf = bundle.getBundleContext().getService(refs.iterator().next());
if (emf != null) {
return emf; // depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
e.fillInStackTrace();
} // depends on control dependency: [catch], data = [none]
// try the default
return super.getEntityManagerFactory(domain);
} } |
public class class_name {
public String getAsText() {
Object theValue = getValue();
if (theValue == null) {
return null;
}
else {
return ((DistinguishedName) theValue).toString();
}
} } | public class class_name {
public String getAsText() {
Object theValue = getValue();
if (theValue == null) {
return null;
// depends on control dependency: [if], data = [none]
}
else {
return ((DistinguishedName) theValue).toString();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void outputVerb(final ByteArrayOutputStream baos, final String str) {
if (str.length() == 1) {
baos.write(254);
baos.write(str.toCharArray()[0]);
} else {
final byte[] bytes = str.getBytes(Charsets.UTF_8);
baos.write(255);
baos.write(str.length());
baos.write(bytes, 0, bytes.length);
}
} } | public class class_name {
private static void outputVerb(final ByteArrayOutputStream baos, final String str) {
if (str.length() == 1) {
baos.write(254); // depends on control dependency: [if], data = [none]
baos.write(str.toCharArray()[0]); // depends on control dependency: [if], data = [none]
} else {
final byte[] bytes = str.getBytes(Charsets.UTF_8);
baos.write(255); // depends on control dependency: [if], data = [none]
baos.write(str.length()); // depends on control dependency: [if], data = [(str.length()]
baos.write(bytes, 0, bytes.length); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean validate(HttpRequestMessage request, boolean isPostMethodAllowed) {
WebSocketWireProtocol wireProtocolVersion = guessWireProtocolVersion(request);
if ( wireProtocolVersion == null ) {
return false;
}
final WsHandshakeValidator validator = handshakeValidatorsByWireProtocolVersion.get(wireProtocolVersion);
return validator != null && validator.doValidate(request, isPostMethodAllowed);
} } | public class class_name {
public boolean validate(HttpRequestMessage request, boolean isPostMethodAllowed) {
WebSocketWireProtocol wireProtocolVersion = guessWireProtocolVersion(request);
if ( wireProtocolVersion == null ) {
return false; // depends on control dependency: [if], data = [none]
}
final WsHandshakeValidator validator = handshakeValidatorsByWireProtocolVersion.get(wireProtocolVersion);
return validator != null && validator.doValidate(request, isPostMethodAllowed);
} } |
public class class_name {
public Object asConstantPoolValue() {
StringBuilder stringBuilder = new StringBuilder().append('(');
for (TypeDescription parameterType : getParameterTypes()) {
stringBuilder.append(parameterType.getDescriptor());
}
String descriptor = stringBuilder.append(')').append(getReturnType().getDescriptor()).toString();
return new Handle(getHandleType().getIdentifier(), getOwnerType().getInternalName(), getName(), descriptor, getOwnerType().isInterface());
} } | public class class_name {
public Object asConstantPoolValue() {
StringBuilder stringBuilder = new StringBuilder().append('(');
for (TypeDescription parameterType : getParameterTypes()) {
stringBuilder.append(parameterType.getDescriptor()); // depends on control dependency: [for], data = [parameterType]
}
String descriptor = stringBuilder.append(')').append(getReturnType().getDescriptor()).toString();
return new Handle(getHandleType().getIdentifier(), getOwnerType().getInternalName(), getName(), descriptor, getOwnerType().isInterface());
} } |
public class class_name {
public static ImmutableList<String> path(String path) {
int i = path.indexOf(HttpSpecification.PARAMETERS_START);
if (i < 0) {
i = path.indexOf(HttpSpecification.HASH_SEPARATOR);
} else {
int j = path.indexOf(HttpSpecification.HASH_SEPARATOR);
if ((j >= 0) && (j < i)) {
i = j;
}
}
if (i < 0) {
i = path.length();
}
String p = path.substring(0, i);
if (p.charAt(0) != HttpSpecification.PATH_SEPARATOR) {
throw new IllegalArgumentException("Path must start with '" + HttpSpecification.PATH_SEPARATOR + "': " + p);
}
String s = p.substring(1);
Deque<String> l = new LinkedList<>();
for (String k : Splitter.on(HttpSpecification.PATH_SEPARATOR).splitToList(s)) {
if (k.isEmpty()) {
continue;
}
if (k.equals(".")) {
continue;
}
if (k.equals("..")) {
if (!l.isEmpty()) {
l.removeLast();
}
continue;
}
l.add(k);
}
return ImmutableList.copyOf(l);
} } | public class class_name {
public static ImmutableList<String> path(String path) {
int i = path.indexOf(HttpSpecification.PARAMETERS_START);
if (i < 0) {
i = path.indexOf(HttpSpecification.HASH_SEPARATOR); // depends on control dependency: [if], data = [none]
} else {
int j = path.indexOf(HttpSpecification.HASH_SEPARATOR);
if ((j >= 0) && (j < i)) {
i = j; // depends on control dependency: [if], data = [none]
}
}
if (i < 0) {
i = path.length(); // depends on control dependency: [if], data = [none]
}
String p = path.substring(0, i);
if (p.charAt(0) != HttpSpecification.PATH_SEPARATOR) {
throw new IllegalArgumentException("Path must start with '" + HttpSpecification.PATH_SEPARATOR + "': " + p);
}
String s = p.substring(1);
Deque<String> l = new LinkedList<>();
for (String k : Splitter.on(HttpSpecification.PATH_SEPARATOR).splitToList(s)) {
if (k.isEmpty()) {
continue;
}
if (k.equals(".")) {
continue;
}
if (k.equals("..")) {
if (!l.isEmpty()) {
l.removeLast(); // depends on control dependency: [if], data = [none]
}
continue;
}
l.add(k); // depends on control dependency: [for], data = [k]
}
return ImmutableList.copyOf(l);
} } |
public class class_name {
@Override
protected void runChild(ScenarioSpec child, RunNotifier notifier) {
final Description description = Description.createTestDescription(testClass, child.getScenarioName());
// ----------------------------------------------
// Notify that this single test has been started.
// Supply the scenario/journey name
// ----------------------------------------------
notifier.fireTestStarted(description);
passed = zeroCodeMultiStepsScenarioRunner.runScenario(child, notifier, description);
testRunCompleted = true;
if (passed) {
LOGGER.info(String.format("\nPackageRunner- **FINISHED executing all Steps for [%s] **.\nSteps were:%s",
child.getScenarioName(),
child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList())));
}
notifier.fireTestFinished(description);
} } | public class class_name {
@Override
protected void runChild(ScenarioSpec child, RunNotifier notifier) {
final Description description = Description.createTestDescription(testClass, child.getScenarioName());
// ----------------------------------------------
// Notify that this single test has been started.
// Supply the scenario/journey name
// ----------------------------------------------
notifier.fireTestStarted(description);
passed = zeroCodeMultiStepsScenarioRunner.runScenario(child, notifier, description);
testRunCompleted = true;
if (passed) {
LOGGER.info(String.format("\nPackageRunner- **FINISHED executing all Steps for [%s] **.\nSteps were:%s",
child.getScenarioName(),
child.getSteps().stream().map(step -> step.getName()).collect(Collectors.toList()))); // depends on control dependency: [if], data = [none]
}
notifier.fireTestFinished(description);
} } |
public class class_name {
public void marshall(DescribeBrokerRequest describeBrokerRequest, ProtocolMarshaller protocolMarshaller) {
if (describeBrokerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeBrokerRequest.getBrokerId(), BROKERID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeBrokerRequest describeBrokerRequest, ProtocolMarshaller protocolMarshaller) {
if (describeBrokerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeBrokerRequest.getBrokerId(), BROKERID_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 byte[] values(Byte[] array) {
byte[] dest = new byte[array.length];
for (int i = 0; i < array.length; i++) {
Byte v = array[i];
if (v != null) {
dest[i] = v.byteValue();
}
}
return dest;
} } | public class class_name {
public static byte[] values(Byte[] array) {
byte[] dest = new byte[array.length];
for (int i = 0; i < array.length; i++) {
Byte v = array[i];
if (v != null) {
dest[i] = v.byteValue(); // depends on control dependency: [if], data = [none]
}
}
return dest;
} } |
public class class_name {
public static final UUID parseUUID(String value)
{
UUID result = null;
if (value != null && !value.isEmpty())
{
if (value.charAt(0) == '{')
{
// PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID>
result = UUID.fromString(value.substring(1, value.length() - 1));
}
else
{
// XER representation: CrkTPqCalki5irI4SJSsRA
byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "==");
long msb = 0;
long lsb = 0;
for (int i = 0; i < 8; i++)
{
msb = (msb << 8) | (data[i] & 0xff);
}
for (int i = 8; i < 16; i++)
{
lsb = (lsb << 8) | (data[i] & 0xff);
}
result = new UUID(msb, lsb);
}
}
return result;
} } | public class class_name {
public static final UUID parseUUID(String value)
{
UUID result = null;
if (value != null && !value.isEmpty())
{
if (value.charAt(0) == '{')
{
// PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID>
result = UUID.fromString(value.substring(1, value.length() - 1)); // depends on control dependency: [if], data = [none]
}
else
{
// XER representation: CrkTPqCalki5irI4SJSsRA
byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "==");
long msb = 0;
long lsb = 0;
for (int i = 0; i < 8; i++)
{
msb = (msb << 8) | (data[i] & 0xff); // depends on control dependency: [for], data = [i]
}
for (int i = 8; i < 16; i++)
{
lsb = (lsb << 8) | (data[i] & 0xff); // depends on control dependency: [for], data = [i]
}
result = new UUID(msb, lsb); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void setParameterFilters(java.util.Collection<ParameterStringFilter> parameterFilters) {
if (parameterFilters == null) {
this.parameterFilters = null;
return;
}
this.parameterFilters = new com.amazonaws.internal.SdkInternalList<ParameterStringFilter>(parameterFilters);
} } | public class class_name {
public void setParameterFilters(java.util.Collection<ParameterStringFilter> parameterFilters) {
if (parameterFilters == null) {
this.parameterFilters = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.parameterFilters = new com.amazonaws.internal.SdkInternalList<ParameterStringFilter>(parameterFilters);
} } |
public class class_name {
private boolean hasHeader(List<String> contents) {
boolean headerValid = true;
boolean statusFound = false;
boolean typeFound = false;
if (!headerSeparatorDemarcatesHeader(contents)) {
return false;
}
for (String line : contents) {
if (hasHeaderSeparator(line)) {
LOGGER.debug("Header separator found");
break;
}
if (isTypeProperty(line)) {
LOGGER.debug("Type property found");
typeFound = true;
}
if (isStatusProperty(line)) {
LOGGER.debug("Status property found");
statusFound = true;
}
if (!line.isEmpty() && !line.contains("=")) {
LOGGER.error("Property found without assignment [{}]", line);
headerValid = false;
}
}
return headerValid && (statusFound || hasDefaultStatus()) && (typeFound || hasDefaultType());
} } | public class class_name {
private boolean hasHeader(List<String> contents) {
boolean headerValid = true;
boolean statusFound = false;
boolean typeFound = false;
if (!headerSeparatorDemarcatesHeader(contents)) {
return false; // depends on control dependency: [if], data = [none]
}
for (String line : contents) {
if (hasHeaderSeparator(line)) {
LOGGER.debug("Header separator found"); // depends on control dependency: [if], data = [none]
break;
}
if (isTypeProperty(line)) {
LOGGER.debug("Type property found"); // depends on control dependency: [if], data = [none]
typeFound = true; // depends on control dependency: [if], data = [none]
}
if (isStatusProperty(line)) {
LOGGER.debug("Status property found"); // depends on control dependency: [if], data = [none]
statusFound = true; // depends on control dependency: [if], data = [none]
}
if (!line.isEmpty() && !line.contains("=")) {
LOGGER.error("Property found without assignment [{}]", line);
headerValid = false; // depends on control dependency: [if], data = [none]
}
}
return headerValid && (statusFound || hasDefaultStatus()) && (typeFound || hasDefaultType());
} } |
public class class_name {
@Override
public synchronized void removeHost(Host host) {
if( log.isDebugEnabled() )
log.debug("Removing host[" + host.getName() + "]");
// Is this Host actually among those that are defined?
boolean found = false;
for (int i = 0; i < engines.length; i++) {
Container hosts[] = engines[i].findChildren();
for (int j = 0; j < hosts.length; j++) {
if (host == (Host) hosts[j]) {
found = true;
break;
}
}
if (found)
break;
}
if (!found)
return;
// Remove this Host from the associated Engine
if( log.isDebugEnabled() )
log.debug(" Removing this Host");
host.getParent().removeChild(host);
} } | public class class_name {
@Override
public synchronized void removeHost(Host host) {
if( log.isDebugEnabled() )
log.debug("Removing host[" + host.getName() + "]");
// Is this Host actually among those that are defined?
boolean found = false;
for (int i = 0; i < engines.length; i++) {
Container hosts[] = engines[i].findChildren();
for (int j = 0; j < hosts.length; j++) {
if (host == (Host) hosts[j]) {
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (found)
break;
}
if (!found)
return;
// Remove this Host from the associated Engine
if( log.isDebugEnabled() )
log.debug(" Removing this Host");
host.getParent().removeChild(host);
} } |
public class class_name {
protected <JavaTypeT> TypeCodec<JavaTypeT> codecFor(
GenericType<JavaTypeT> javaType, boolean isJavaCovariant) {
LOG.trace(
"[{}] Looking up codec for Java type {} (covariant = {})",
logPrefix,
javaType,
isJavaCovariant);
for (TypeCodec<?> primitiveCodec : primitiveCodecs) {
if (matches(primitiveCodec, javaType, isJavaCovariant)) {
LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec);
return uncheckedCast(primitiveCodec);
}
}
for (TypeCodec<?> userCodec : userCodecs) {
if (matches(userCodec, javaType, isJavaCovariant)) {
LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec);
return uncheckedCast(userCodec);
}
}
return uncheckedCast(getCachedCodec(null, javaType, isJavaCovariant));
} } | public class class_name {
protected <JavaTypeT> TypeCodec<JavaTypeT> codecFor(
GenericType<JavaTypeT> javaType, boolean isJavaCovariant) {
LOG.trace(
"[{}] Looking up codec for Java type {} (covariant = {})",
logPrefix,
javaType,
isJavaCovariant);
for (TypeCodec<?> primitiveCodec : primitiveCodecs) {
if (matches(primitiveCodec, javaType, isJavaCovariant)) {
LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); // depends on control dependency: [if], data = [none]
return uncheckedCast(primitiveCodec); // depends on control dependency: [if], data = [none]
}
}
for (TypeCodec<?> userCodec : userCodecs) {
if (matches(userCodec, javaType, isJavaCovariant)) {
LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); // depends on control dependency: [if], data = [none]
return uncheckedCast(userCodec); // depends on control dependency: [if], data = [none]
}
}
return uncheckedCast(getCachedCodec(null, javaType, isJavaCovariant));
} } |
public class class_name {
@Deprecated
public static void permute(final int[] arr, final int[] permutation) {
checkArgument(arr.length == permutation.length);
final int[] tmp = new int[arr.length];
for (int i = 0; i < tmp.length; ++i) {
tmp[i] = arr[permutation[i]];
}
System.arraycopy(tmp, 0, arr, 0, arr.length);
} } | public class class_name {
@Deprecated
public static void permute(final int[] arr, final int[] permutation) {
checkArgument(arr.length == permutation.length);
final int[] tmp = new int[arr.length];
for (int i = 0; i < tmp.length; ++i) {
tmp[i] = arr[permutation[i]]; // depends on control dependency: [for], data = [i]
}
System.arraycopy(tmp, 0, arr, 0, arr.length);
} } |
public class class_name {
public void go(DocListener document, InputSource is) {
try {
parser.parse(is, new SAXiTextHandler(document));
}
catch(SAXException se) {
throw new ExceptionConverter(se);
}
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
}
} } | public class class_name {
public void go(DocListener document, InputSource is) {
try {
parser.parse(is, new SAXiTextHandler(document)); // depends on control dependency: [try], data = [none]
}
catch(SAXException se) {
throw new ExceptionConverter(se);
} // depends on control dependency: [catch], data = [none]
catch(IOException ioe) {
throw new ExceptionConverter(ioe);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String formatSQL(Object obj, Object expr) {
String sql = null;
// Check whether an SQL statement has been provided
if (expr instanceof String) {
sql = (String)expr;
if (log.isLoggable(Level.FINEST)) {
log.finest("SQL retrieved from state = "+sql);
}
} else if (obj != null) {
sql = toString(obj);
if (sql != null) {
if (sql.startsWith("prep")) {
sql = sql.replaceFirst("prep[0-9]*: ", "");
}
sql = sql.replaceAll("X'.*'", BINARY_SQL_MARKER);
}
if (log.isLoggable(Level.FINEST)) {
log.finest("SQL derived from context = "+sql);
}
}
return sql;
} } | public class class_name {
public String formatSQL(Object obj, Object expr) {
String sql = null;
// Check whether an SQL statement has been provided
if (expr instanceof String) {
sql = (String)expr; // depends on control dependency: [if], data = [none]
if (log.isLoggable(Level.FINEST)) {
log.finest("SQL retrieved from state = "+sql); // depends on control dependency: [if], data = [none]
}
} else if (obj != null) {
sql = toString(obj); // depends on control dependency: [if], data = [(obj]
if (sql != null) {
if (sql.startsWith("prep")) {
sql = sql.replaceFirst("prep[0-9]*: ", ""); // depends on control dependency: [if], data = [none]
}
sql = sql.replaceAll("X'.*'", BINARY_SQL_MARKER); // depends on control dependency: [if], data = [none]
}
if (log.isLoggable(Level.FINEST)) {
log.finest("SQL derived from context = "+sql); // depends on control dependency: [if], data = [none]
}
}
return sql;
} } |
public class class_name {
public long getMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += maps_[i].getMemoryUsageBytes();
}
}
return total;
} } | public class class_name {
public long getMemoryUsageBytes() {
long total = 0;
for (int i = 0; i < maps_.length; i++) {
if (maps_[i] != null) {
total += maps_[i].getMemoryUsageBytes(); // depends on control dependency: [if], data = [none]
}
}
return total;
} } |
public class class_name {
public void marshall(VideoCodecSettings videoCodecSettings, ProtocolMarshaller protocolMarshaller) {
if (videoCodecSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(videoCodecSettings.getFrameCaptureSettings(), FRAMECAPTURESETTINGS_BINDING);
protocolMarshaller.marshall(videoCodecSettings.getH264Settings(), H264SETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(VideoCodecSettings videoCodecSettings, ProtocolMarshaller protocolMarshaller) {
if (videoCodecSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(videoCodecSettings.getFrameCaptureSettings(), FRAMECAPTURESETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(videoCodecSettings.getH264Settings(), H264SETTINGS_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 {
protected static boolean addRow (SmartTable table, List<Widget> widgets)
{
if (widgets == null) {
return false;
}
int row = table.getRowCount();
for (int col=0; col<widgets.size(); ++col) {
table.setWidget(row, col, widgets.get(col));
table.getFlexCellFormatter().setStyleName(row, col, "col"+col);
}
return true;
} } | public class class_name {
protected static boolean addRow (SmartTable table, List<Widget> widgets)
{
if (widgets == null) {
return false; // depends on control dependency: [if], data = [none]
}
int row = table.getRowCount();
for (int col=0; col<widgets.size(); ++col) {
table.setWidget(row, col, widgets.get(col)); // depends on control dependency: [for], data = [col]
table.getFlexCellFormatter().setStyleName(row, col, "col"+col); // depends on control dependency: [for], data = [col]
}
return true;
} } |
public class class_name {
private void addToTotalCount(final List<TotalTargetCountActionStatus> targetCountActionStatus) {
if (targetCountActionStatus == null) {
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount);
return;
}
statusTotalCountMap.put(Status.RUNNING, 0L);
Long notStartedTargetCount = totalTargetCount;
for (final TotalTargetCountActionStatus item : targetCountActionStatus) {
addToTotalCount(item);
notStartedTargetCount -= item.getCount();
}
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount);
} } | public class class_name {
private void addToTotalCount(final List<TotalTargetCountActionStatus> targetCountActionStatus) {
if (targetCountActionStatus == null) {
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
statusTotalCountMap.put(Status.RUNNING, 0L);
Long notStartedTargetCount = totalTargetCount;
for (final TotalTargetCountActionStatus item : targetCountActionStatus) {
addToTotalCount(item); // depends on control dependency: [for], data = [item]
notStartedTargetCount -= item.getCount(); // depends on control dependency: [for], data = [item]
}
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount);
} } |
public class class_name {
protected String getSubstituteTypeName(String typeName)
{
if (typeNameMap == null)
{
return typeName;
}
String shortName = typeNameMap.get(typeName);
return shortName == null ? typeName : shortName;
} } | public class class_name {
protected String getSubstituteTypeName(String typeName)
{
if (typeNameMap == null)
{
return typeName; // depends on control dependency: [if], data = [none]
}
String shortName = typeNameMap.get(typeName);
return shortName == null ? typeName : shortName;
} } |
public class class_name {
private static boolean isValidSequence(List<ExpandedPair> pairs) {
for (int[] sequence : FINDER_PATTERN_SEQUENCES) {
if (pairs.size() > sequence.length) {
continue;
}
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {
stop = false;
break;
}
}
if (stop) {
return true;
}
}
return false;
} } | public class class_name {
private static boolean isValidSequence(List<ExpandedPair> pairs) {
for (int[] sequence : FINDER_PATTERN_SEQUENCES) {
if (pairs.size() > sequence.length) {
continue;
}
boolean stop = true;
for (int j = 0; j < pairs.size(); j++) {
if (pairs.get(j).getFinderPattern().getValue() != sequence[j]) {
stop = false; // depends on control dependency: [if], data = [none]
break;
}
}
if (stop) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private String getNewAreaResourceType(String componentPath) {
Resource componentResource = resolver.getResource(componentPath);
if (componentResource != null) {
if (componentResource.getChild(NEWAREA_CHILD_NAME) != null) {
return componentPath + "/" + NEWAREA_CHILD_NAME;
}
String resourceSuperType = componentResource.getResourceSuperType();
if (StringUtils.isNotEmpty(resourceSuperType)) {
return getNewAreaResourceType(resourceSuperType);
}
}
return FALLBACK_NEWAREA_RESOURCE_TYPE;
} } | public class class_name {
private String getNewAreaResourceType(String componentPath) {
Resource componentResource = resolver.getResource(componentPath);
if (componentResource != null) {
if (componentResource.getChild(NEWAREA_CHILD_NAME) != null) {
return componentPath + "/" + NEWAREA_CHILD_NAME; // depends on control dependency: [if], data = [none]
}
String resourceSuperType = componentResource.getResourceSuperType();
if (StringUtils.isNotEmpty(resourceSuperType)) {
return getNewAreaResourceType(resourceSuperType); // depends on control dependency: [if], data = [none]
}
}
return FALLBACK_NEWAREA_RESOURCE_TYPE;
} } |
public class class_name {
void serializeUpdate(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, TableKey.NO_VERSION);
}
} } | public class class_name {
void serializeUpdate(@NonNull Collection<TableEntry> entries, byte[] target) {
int offset = 0;
for (TableEntry e : entries) {
offset = serializeUpdate(e, target, offset, TableKey.NO_VERSION); // depends on control dependency: [for], data = [e]
}
} } |
public class class_name {
@Override
public ByteBuffer next() throws IOException, NoSuchElementException {
Record record = readPhysicalRecord(true);
while (record.type().equals(RecordType.NONE)) {
validateBufferIsZeros(record.data());
record = readPhysicalRecord(true);
}
if (record.type().equals(RecordType.FULL)) {
return record.data();
}
if (record.type().equals(RecordType.FIRST)) {
ArrayList<ByteBuffer> result = new ArrayList<>();
result.add(record.data());
record = readPhysicalRecord(false);
while (record.type().equals(RecordType.MIDDLE)) {
result.add(record.data());
record = readPhysicalRecord(false);
}
if (!record.type().equals(RecordType.LAST)) {
throw new CorruptDataException("Unterminated first block. Found: " + record.type.value());
}
result.add(record.data());
return copyAll(result);
}
throw new CorruptDataException("Unexpected RecordType: " + record.type.value());
} } | public class class_name {
@Override
public ByteBuffer next() throws IOException, NoSuchElementException {
Record record = readPhysicalRecord(true);
while (record.type().equals(RecordType.NONE)) {
validateBufferIsZeros(record.data());
record = readPhysicalRecord(true);
}
if (record.type().equals(RecordType.FULL)) {
return record.data();
}
if (record.type().equals(RecordType.FIRST)) {
ArrayList<ByteBuffer> result = new ArrayList<>();
result.add(record.data());
record = readPhysicalRecord(false);
while (record.type().equals(RecordType.MIDDLE)) {
result.add(record.data()); // depends on control dependency: [while], data = [none]
record = readPhysicalRecord(false); // depends on control dependency: [while], data = [none]
}
if (!record.type().equals(RecordType.LAST)) {
throw new CorruptDataException("Unterminated first block. Found: " + record.type.value());
}
result.add(record.data());
return copyAll(result);
}
throw new CorruptDataException("Unexpected RecordType: " + record.type.value());
} } |
public class class_name {
public static Annotation[] readAnnotations(String p_expression) {
Field declaredField = getField(p_expression);
if (null != declaredField) {
if (declaredField.getAnnotations() != null)
return declaredField.getAnnotations();
}
Method getter = getGetter(p_expression);
if (null != getter) {
return getter.getAnnotations();
}
return null;
} } | public class class_name {
public static Annotation[] readAnnotations(String p_expression) {
Field declaredField = getField(p_expression);
if (null != declaredField) {
if (declaredField.getAnnotations() != null)
return declaredField.getAnnotations();
}
Method getter = getGetter(p_expression);
if (null != getter) {
return getter.getAnnotations(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static String toIdentityVariableName(String varName) {
char[] chars = varName.toCharArray();
long changes = 0;
StringBuilder rtn = new StringBuilder(chars.length + 2);
rtn.append("CF");
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c);
else {
rtn.append('_');
changes += (c * (i + 1));
}
}
return rtn.append(changes).toString();
} } | public class class_name {
public static String toIdentityVariableName(String varName) {
char[] chars = varName.toCharArray();
long changes = 0;
StringBuilder rtn = new StringBuilder(chars.length + 2);
rtn.append("CF");
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c);
else {
rtn.append('_'); // depends on control dependency: [if], data = [none]
changes += (c * (i + 1)); // depends on control dependency: [if], data = [none]
}
}
return rtn.append(changes).toString();
} } |
public class class_name {
public long getApproximateLength() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getApproximateLength");
long length=0;
try
{
SIMPMessage msg = getSIMPMessage();
if(msg!=null)
{
length = msg.getMessage().getApproximateLength();
}
}
catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getApproximateLength", Long.valueOf(length));
return length;
} } | public class class_name {
public long getApproximateLength() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getApproximateLength");
long length=0;
try
{
SIMPMessage msg = getSIMPMessage();
if(msg!=null)
{
length = msg.getMessage().getApproximateLength(); // depends on control dependency: [if], data = [none]
}
}
catch (SIResourceException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getApproximateLength", Long.valueOf(length));
return length;
} } |
public class class_name {
public List<Node> link() {
List<Module> dependencies;
Module module;
Module resolved;
StringBuilder problems;
List<Node> result;
problems = new StringBuilder();
for (Map.Entry<Module, List<String>> entry : notLinked.entrySet()) {
module = entry.getKey();
dependencies = module.dependencies();
for (String name : entry.getValue()) {
resolved = lookup(name);
if (resolved == null) {
problems.append("module '" + module.getName() + "': cannot resolve dependency '" + name + "'\n");
} else {
dependencies.add(resolved);
}
}
}
if (problems.length() > 0) {
throw new IllegalArgumentException(problems.toString());
}
result = reloadFiles;
notLinked = null;
reloadFiles = null;
return result;
} } | public class class_name {
public List<Node> link() {
List<Module> dependencies;
Module module;
Module resolved;
StringBuilder problems;
List<Node> result;
problems = new StringBuilder();
for (Map.Entry<Module, List<String>> entry : notLinked.entrySet()) {
module = entry.getKey(); // depends on control dependency: [for], data = [entry]
dependencies = module.dependencies(); // depends on control dependency: [for], data = [none]
for (String name : entry.getValue()) {
resolved = lookup(name); // depends on control dependency: [for], data = [name]
if (resolved == null) {
problems.append("module '" + module.getName() + "': cannot resolve dependency '" + name + "'\n"); // depends on control dependency: [if], data = [none]
} else {
dependencies.add(resolved); // depends on control dependency: [if], data = [(resolved]
}
}
}
if (problems.length() > 0) {
throw new IllegalArgumentException(problems.toString());
}
result = reloadFiles;
notLinked = null;
reloadFiles = null;
return result;
} } |
public class class_name {
public void marshall(GetBlueprintsRequest getBlueprintsRequest, ProtocolMarshaller protocolMarshaller) {
if (getBlueprintsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBlueprintsRequest.getIncludeInactive(), INCLUDEINACTIVE_BINDING);
protocolMarshaller.marshall(getBlueprintsRequest.getPageToken(), PAGETOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetBlueprintsRequest getBlueprintsRequest, ProtocolMarshaller protocolMarshaller) {
if (getBlueprintsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBlueprintsRequest.getIncludeInactive(), INCLUDEINACTIVE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getBlueprintsRequest.getPageToken(), PAGETOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public org.modeshape.jcr.api.Problems restoreRepository( final JcrRepository repository,
final File backupDirectory,
final RestoreOptions options) throws RepositoryException {
final String backupLocString = backupDirectory.getAbsolutePath();
LOGGER.debug("Beginning restore of '{0}' repository from {1} with options {2}", repository.getName(), backupLocString,
options);
// Put the repository into the 'restoring' state ...
repository.prepareToRestore();
// Create the activity ...
final RestoreActivity restoreActivity = createRestoreActivity(backupDirectory, options);
org.modeshape.jcr.api.Problems problems = null;
try {
if (runningState.suspendExistingUserTransaction()) {
LOGGER.debug("Suspended existing active user transaction before the restore operation starts");
}
problems = new JcrProblems(restoreActivity.execute());
if (!problems.hasProblems()) {
// restart the repository ...
try {
repository.completeRestore(options);
} catch (Throwable t) {
restoreActivity.problems.addError(t, JcrI18n.repositoryCannotBeRestartedAfterRestore, repository.getName(),
t.getMessage());
} finally {
runningState.resumeExistingUserTransaction();
}
}
} catch (SystemException e) {
throw new RuntimeException(e);
}
LOGGER.debug("Completed restore of '{0}' repository from {1}", repository.getName(), backupLocString);
return problems;
} } | public class class_name {
public org.modeshape.jcr.api.Problems restoreRepository( final JcrRepository repository,
final File backupDirectory,
final RestoreOptions options) throws RepositoryException {
final String backupLocString = backupDirectory.getAbsolutePath();
LOGGER.debug("Beginning restore of '{0}' repository from {1} with options {2}", repository.getName(), backupLocString,
options);
// Put the repository into the 'restoring' state ...
repository.prepareToRestore();
// Create the activity ...
final RestoreActivity restoreActivity = createRestoreActivity(backupDirectory, options);
org.modeshape.jcr.api.Problems problems = null;
try {
if (runningState.suspendExistingUserTransaction()) {
LOGGER.debug("Suspended existing active user transaction before the restore operation starts"); // depends on control dependency: [if], data = [none]
}
problems = new JcrProblems(restoreActivity.execute());
if (!problems.hasProblems()) {
// restart the repository ...
try {
repository.completeRestore(options); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
restoreActivity.problems.addError(t, JcrI18n.repositoryCannotBeRestartedAfterRestore, repository.getName(),
t.getMessage());
} finally { // depends on control dependency: [catch], data = [none]
runningState.resumeExistingUserTransaction();
}
}
} catch (SystemException e) {
throw new RuntimeException(e);
}
LOGGER.debug("Completed restore of '{0}' repository from {1}", repository.getName(), backupLocString);
return problems;
} } |
public class class_name {
public FutureData<PushLogMessages> log(String id, int page, int perPage, String orderBy, String orderDirection) {
FutureData<PushLogMessages> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(LOG));
POST request = config.http()
.POST(uri, new PageReader(newRequestCallback(future, new PushLogMessages(), config)));
if (id != null && !id.isEmpty()) {
request.form("id", id);
}
if (page > 0) {
request.form("page", page);
}
if (perPage > 0) {
request.form("per_page", perPage);
}
if (orderBy != null && !orderBy.isEmpty()) {
request.form("order_by", orderBy);
}
if (orderDirection != null && !orderDirection.isEmpty()) {
request.form("order_dir", orderDirection);
}
performRequest(future, request);
return future;
} } | public class class_name {
public FutureData<PushLogMessages> log(String id, int page, int perPage, String orderBy, String orderDirection) {
FutureData<PushLogMessages> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(LOG));
POST request = config.http()
.POST(uri, new PageReader(newRequestCallback(future, new PushLogMessages(), config)));
if (id != null && !id.isEmpty()) {
request.form("id", id); // depends on control dependency: [if], data = [none]
}
if (page > 0) {
request.form("page", page); // depends on control dependency: [if], data = [none]
}
if (perPage > 0) {
request.form("per_page", perPage); // depends on control dependency: [if], data = [none]
}
if (orderBy != null && !orderBy.isEmpty()) {
request.form("order_by", orderBy); // depends on control dependency: [if], data = [none]
}
if (orderDirection != null && !orderDirection.isEmpty()) {
request.form("order_dir", orderDirection); // depends on control dependency: [if], data = [none]
}
performRequest(future, request);
return future;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private static Filter<ArchivePath> getFilterInstance(final String filterClassName, final Class<?>[] ctorTypes,
final Object[] ctorArguments) {
// Precondition checks
assert filterClassName != null && filterClassName.length() > 0 : "Filter class name must be specified";
assert ctorTypes != null : "Construction types must be specified";
assert ctorArguments != null : "Construction arguments must be specified";
assert ctorTypes.length == ctorArguments.length : "The number of ctor arguments and their types must match";
// Find the filter impl class in the configured CLs
final Class<Filter<ArchivePath>> filterClass;
try {
filterClass = (Class<Filter<ArchivePath>>) ClassLoaderSearchUtil.findClassFromClassLoaders(filterClassName,
ShrinkWrap.getDefaultDomain().getConfiguration().getClassLoaders());
} catch (final ClassNotFoundException cnfe) {
throw new IllegalStateException("Could not find filter implementation class " + filterClassName
+ " in any of the configured CLs", cnfe);
}
// Make the new instance
return SecurityActions.newInstance(filterClass, ctorTypes, ctorArguments, Filter.class);
} } | public class class_name {
@SuppressWarnings("unchecked")
private static Filter<ArchivePath> getFilterInstance(final String filterClassName, final Class<?>[] ctorTypes,
final Object[] ctorArguments) {
// Precondition checks
assert filterClassName != null && filterClassName.length() > 0 : "Filter class name must be specified";
assert ctorTypes != null : "Construction types must be specified";
assert ctorArguments != null : "Construction arguments must be specified";
assert ctorTypes.length == ctorArguments.length : "The number of ctor arguments and their types must match";
// Find the filter impl class in the configured CLs
final Class<Filter<ArchivePath>> filterClass;
try {
filterClass = (Class<Filter<ArchivePath>>) ClassLoaderSearchUtil.findClassFromClassLoaders(filterClassName,
ShrinkWrap.getDefaultDomain().getConfiguration().getClassLoaders()); // depends on control dependency: [try], data = [none]
} catch (final ClassNotFoundException cnfe) {
throw new IllegalStateException("Could not find filter implementation class " + filterClassName
+ " in any of the configured CLs", cnfe);
} // depends on control dependency: [catch], data = [none]
// Make the new instance
return SecurityActions.newInstance(filterClass, ctorTypes, ctorArguments, Filter.class);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.