code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static boolean packageInstalled(@NotNull final Context context, @NotNull final String packageName) {
final PackageManager packageManager = context.getPackageManager();
boolean result = false;
try {
packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
result = true;
} catch (PackageManager.NameNotFoundException ignore) {
}
Logger.d("packageInstalled() is ", result, " for ", packageName);
return result;
} }
|
public class class_name {
public static boolean packageInstalled(@NotNull final Context context, @NotNull final String packageName) {
final PackageManager packageManager = context.getPackageManager();
boolean result = false;
try {
packageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES); // depends on control dependency: [try], data = [none]
result = true; // depends on control dependency: [try], data = [none]
} catch (PackageManager.NameNotFoundException ignore) {
} // depends on control dependency: [catch], data = [none]
Logger.d("packageInstalled() is ", result, " for ", packageName);
return result;
} }
|
public class class_name {
static public String getLongFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days));
ret.append(" day");
if(days > 1)
ret.append("s");
}
long hours = millis/3600000L;
millis = millis-(hours*3600000L);
if(hours > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(hours));
ret.append(" hour");
if(hours > 1)
ret.append("s");
}
long minutes = millis/60000L;
millis = millis-(minutes*60000L);
if(minutes > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(minutes));
ret.append(" minute");
if(minutes > 1)
ret.append("s");
}
long seconds = millis/1000L;
if(seconds > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(seconds));
ret.append(" second");
if(seconds > 1)
ret.append("s");
}
return ret.toString();
} }
|
public class class_name {
static public String getLongFormattedDays(long dt)
{
StringBuffer ret = new StringBuffer();
long days = dt/86400000L;
long millis = dt-(days*86400000L);
if(days > 0)
{
ret.append(Long.toString(days)); // depends on control dependency: [if], data = [(days]
ret.append(" day"); // depends on control dependency: [if], data = [none]
if(days > 1)
ret.append("s");
}
long hours = millis/3600000L;
millis = millis-(hours*3600000L);
if(hours > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(hours)); // depends on control dependency: [if], data = [(hours]
ret.append(" hour"); // depends on control dependency: [if], data = [none]
if(hours > 1)
ret.append("s");
}
long minutes = millis/60000L;
millis = millis-(minutes*60000L);
if(minutes > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(minutes)); // depends on control dependency: [if], data = [(minutes]
ret.append(" minute"); // depends on control dependency: [if], data = [none]
if(minutes > 1)
ret.append("s");
}
long seconds = millis/1000L;
if(seconds > 0)
{
if(ret.length() > 0)
ret.append(" ");
ret.append(Long.toString(seconds)); // depends on control dependency: [if], data = [(seconds]
ret.append(" second"); // depends on control dependency: [if], data = [none]
if(seconds > 1)
ret.append("s");
}
return ret.toString();
} }
|
public class class_name {
public List<List<IWord>> getComplexSentenceList()
{
List<List<IWord>> complexList = new LinkedList<List<IWord>>();
for (Sentence sentence : sentenceList)
{
complexList.add(sentence.wordList);
}
return complexList;
} }
|
public class class_name {
public List<List<IWord>> getComplexSentenceList()
{
List<List<IWord>> complexList = new LinkedList<List<IWord>>();
for (Sentence sentence : sentenceList)
{
complexList.add(sentence.wordList); // depends on control dependency: [for], data = [sentence]
}
return complexList;
} }
|
public class class_name {
private static Set<ClassLoader> allDeploymentModuleClassLoaders(DeploymentUnit deploymentUnit) {
Set<ClassLoader> deploymentClassLoaders = new HashSet<ClassLoader>();
final DeploymentUnit topDeploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
final Module toplevelModule = topDeploymentUnit.getAttachment(Attachments.MODULE);
if (toplevelModule != null) {
deploymentClassLoaders.add(toplevelModule.getClassLoader());
final List<DeploymentUnit> subDeployments = topDeploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
for (DeploymentUnit subDeploymentUnit: subDeployments) {
final Module subDeploymentModule = subDeploymentUnit.getAttachment(Attachments.MODULE);
if (subDeploymentModule != null) {
deploymentClassLoaders.add(subDeploymentModule.getClassLoader());
}
}
}
return deploymentClassLoaders;
} }
|
public class class_name {
private static Set<ClassLoader> allDeploymentModuleClassLoaders(DeploymentUnit deploymentUnit) {
Set<ClassLoader> deploymentClassLoaders = new HashSet<ClassLoader>();
final DeploymentUnit topDeploymentUnit = DeploymentUtils.getTopDeploymentUnit(deploymentUnit);
final Module toplevelModule = topDeploymentUnit.getAttachment(Attachments.MODULE);
if (toplevelModule != null) {
deploymentClassLoaders.add(toplevelModule.getClassLoader()); // depends on control dependency: [if], data = [(toplevelModule]
final List<DeploymentUnit> subDeployments = topDeploymentUnit.getAttachmentList(Attachments.SUB_DEPLOYMENTS);
for (DeploymentUnit subDeploymentUnit: subDeployments) {
final Module subDeploymentModule = subDeploymentUnit.getAttachment(Attachments.MODULE);
if (subDeploymentModule != null) {
deploymentClassLoaders.add(subDeploymentModule.getClassLoader()); // depends on control dependency: [if], data = [(subDeploymentModule]
}
}
}
return deploymentClassLoaders;
} }
|
public class class_name {
private void handleDelete() {
log.debug(String.format("%s - Network configuration removed from cluster: %s", NetworkManager.this, cluster.address()));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
unready(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause());
}
if (currentContext != null) {
log.info(String.format("%s - Undeploying network", NetworkManager.this));
undeployNetwork(currentContext, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause());
task.complete();
} else {
// Once we've finished undeploying all the components of the
// network, set the network's status to nothing in order to
// indicate that the manager (this) can be undeployed.
data.put(currentContext.status(), "", new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
log.error(result.cause());
} else {
log.info(String.format("%s - Successfully undeployed all components", NetworkManager.this));
}
task.complete();
}
});
}
}
});
} else {
task.complete();
}
}
});
}
});
} }
|
public class class_name {
private void handleDelete() {
log.debug(String.format("%s - Network configuration removed from cluster: %s", NetworkManager.this, cluster.address()));
tasks.runTask(new Handler<Task>() {
@Override
public void handle(final Task task) {
unready(new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause()); // depends on control dependency: [if], data = [none]
}
if (currentContext != null) {
log.info(String.format("%s - Undeploying network", NetworkManager.this)); // depends on control dependency: [if], data = [none]
undeployNetwork(currentContext, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
log.error(result.cause()); // depends on control dependency: [if], data = [none]
task.complete(); // depends on control dependency: [if], data = [none]
} else {
// Once we've finished undeploying all the components of the
// network, set the network's status to nothing in order to
// indicate that the manager (this) can be undeployed.
data.put(currentContext.status(), "", new Handler<AsyncResult<String>>() {
@Override
public void handle(AsyncResult<String> result) {
if (result.failed()) {
log.error(result.cause()); // depends on control dependency: [if], data = [none]
} else {
log.info(String.format("%s - Successfully undeployed all components", NetworkManager.this)); // depends on control dependency: [if], data = [none]
}
task.complete();
}
}); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
} else {
task.complete(); // depends on control dependency: [if], data = [none]
}
}
});
}
});
} }
|
public class class_name {
private void validateTableCompatibility(String theName, String otherName,
Table theTable, Table otherTable, FailureMessage failureMessage) {
if (theTable.getIsdred() != otherTable.getIsdred()) {
failureMessage.addReason("To swap table " + theName + " with table " + otherName +
" both tables must be DR enabled or both tables must not be DR enabled.");
}
if (theTable.getIsreplicated() != otherTable.getIsreplicated()) {
failureMessage.addReason("one table is partitioned and the other is not");
}
if (theTable.getTuplelimit() != otherTable.getTuplelimit()) {
failureMessage.addReason("the tables differ in the LIMIT PARTITION ROWS constraint");
}
if ((theTable.getMaterializer() != null ||
! theTable.getMvhandlerinfo().isEmpty()) ||
(otherTable.getMaterializer() != null ||
! otherTable.getMvhandlerinfo().isEmpty())) {
failureMessage.addReason("one or both of the tables is actually a view");
}
StringBuilder viewNames = new StringBuilder();
if (viewsDependOn(theTable, viewNames)) {
failureMessage.addReason(theName + " is referenced in views " + viewNames.toString());
}
viewNames.setLength(0);
if (viewsDependOn(otherTable, viewNames)) {
failureMessage.addReason(otherName + " is referenced in views " + viewNames.toString());
}
} }
|
public class class_name {
private void validateTableCompatibility(String theName, String otherName,
Table theTable, Table otherTable, FailureMessage failureMessage) {
if (theTable.getIsdred() != otherTable.getIsdred()) {
failureMessage.addReason("To swap table " + theName + " with table " + otherName +
" both tables must be DR enabled or both tables must not be DR enabled."); // depends on control dependency: [if], data = [none]
}
if (theTable.getIsreplicated() != otherTable.getIsreplicated()) {
failureMessage.addReason("one table is partitioned and the other is not"); // depends on control dependency: [if], data = [none]
}
if (theTable.getTuplelimit() != otherTable.getTuplelimit()) {
failureMessage.addReason("the tables differ in the LIMIT PARTITION ROWS constraint"); // depends on control dependency: [if], data = [none]
}
if ((theTable.getMaterializer() != null ||
! theTable.getMvhandlerinfo().isEmpty()) ||
(otherTable.getMaterializer() != null ||
! otherTable.getMvhandlerinfo().isEmpty())) {
failureMessage.addReason("one or both of the tables is actually a view"); // depends on control dependency: [if], data = [none]
}
StringBuilder viewNames = new StringBuilder();
if (viewsDependOn(theTable, viewNames)) {
failureMessage.addReason(theName + " is referenced in views " + viewNames.toString()); // depends on control dependency: [if], data = [none]
}
viewNames.setLength(0);
if (viewsDependOn(otherTable, viewNames)) {
failureMessage.addReason(otherName + " is referenced in views " + viewNames.toString()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nonnull
@MustNotContainNull
public static Topic[] removeSuccessorsAndDuplications(@Nonnull @MustNotContainNull final Topic... topics) {
final List<Topic> result = new ArrayList<Topic>();
for (final Topic t : topics) {
final Iterator<Topic> iterator = result.iterator();
while (iterator.hasNext()) {
final Topic listed = iterator.next();
if (listed == t || listed.hasAncestor(t)) {
iterator.remove();
}
}
result.add(t);
}
return result.toArray(new Topic[result.size()]);
} }
|
public class class_name {
@Nonnull
@MustNotContainNull
public static Topic[] removeSuccessorsAndDuplications(@Nonnull @MustNotContainNull final Topic... topics) {
final List<Topic> result = new ArrayList<Topic>();
for (final Topic t : topics) {
final Iterator<Topic> iterator = result.iterator();
while (iterator.hasNext()) {
final Topic listed = iterator.next();
if (listed == t || listed.hasAncestor(t)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
result.add(t); // depends on control dependency: [for], data = [t]
}
return result.toArray(new Topic[result.size()]);
} }
|
public class class_name {
public static BitSet getBitSet(IAtomContainer atomContainer) {
BitSet bitSet;
int size = atomContainer.getBondCount();
if (size != 0) {
bitSet = new BitSet(size);
for (int i = 0; i < size; i++) {
bitSet.set(i);
}
} else {
bitSet = new BitSet();
}
return bitSet;
} }
|
public class class_name {
public static BitSet getBitSet(IAtomContainer atomContainer) {
BitSet bitSet;
int size = atomContainer.getBondCount();
if (size != 0) {
bitSet = new BitSet(size); // depends on control dependency: [if], data = [(size]
for (int i = 0; i < size; i++) {
bitSet.set(i); // depends on control dependency: [for], data = [i]
}
} else {
bitSet = new BitSet(); // depends on control dependency: [if], data = [none]
}
return bitSet;
} }
|
public class class_name {
public static synchronized OmemoManager getInstanceFor(XMPPConnection connection) {
TreeMap<Integer, OmemoManager> managers = INSTANCES.get(connection);
if (managers == null) {
managers = new TreeMap<>();
INSTANCES.put(connection, managers);
}
OmemoManager manager;
if (managers.size() == 0) {
manager = new OmemoManager(connection, UNKNOWN_DEVICE_ID);
managers.put(UNKNOWN_DEVICE_ID, manager);
} else {
manager = managers.get(managers.firstKey());
}
return manager;
} }
|
public class class_name {
public static synchronized OmemoManager getInstanceFor(XMPPConnection connection) {
TreeMap<Integer, OmemoManager> managers = INSTANCES.get(connection);
if (managers == null) {
managers = new TreeMap<>(); // depends on control dependency: [if], data = [none]
INSTANCES.put(connection, managers); // depends on control dependency: [if], data = [none]
}
OmemoManager manager;
if (managers.size() == 0) {
manager = new OmemoManager(connection, UNKNOWN_DEVICE_ID); // depends on control dependency: [if], data = [none]
managers.put(UNKNOWN_DEVICE_ID, manager); // depends on control dependency: [if], data = [none]
} else {
manager = managers.get(managers.firstKey()); // depends on control dependency: [if], data = [none]
}
return manager;
} }
|
public class class_name {
public void clearOutputs() {
unCache();
for (TransactionOutput output : outputs) {
output.setParent(null);
}
outputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} }
|
public class class_name {
public void clearOutputs() {
unCache();
for (TransactionOutput output : outputs) {
output.setParent(null); // depends on control dependency: [for], data = [output]
}
outputs.clear();
// You wanted to reserialize, right?
this.length = this.unsafeBitcoinSerialize().length;
} }
|
public class class_name {
@Override
public EClass getIfcModulusOfElasticityMeasure() {
if (ifcModulusOfElasticityMeasureEClass == null) {
ifcModulusOfElasticityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(838);
}
return ifcModulusOfElasticityMeasureEClass;
} }
|
public class class_name {
@Override
public EClass getIfcModulusOfElasticityMeasure() {
if (ifcModulusOfElasticityMeasureEClass == null) {
ifcModulusOfElasticityMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(838);
// depends on control dependency: [if], data = [none]
}
return ifcModulusOfElasticityMeasureEClass;
} }
|
public class class_name {
public void validateCompletely (@Nonnull final IPSErrorHandler aErrorHandler)
{
ValueEnforcer.notNull (aErrorHandler, "ErrorHandler");
try
{
getOrCreateBoundSchema ().getOriginalSchema ().validateCompletely (aErrorHandler);
}
catch (final RuntimeException ex)
{
// May happen when XPath errors are contained
}
} }
|
public class class_name {
public void validateCompletely (@Nonnull final IPSErrorHandler aErrorHandler)
{
ValueEnforcer.notNull (aErrorHandler, "ErrorHandler");
try
{
getOrCreateBoundSchema ().getOriginalSchema ().validateCompletely (aErrorHandler); // depends on control dependency: [try], data = [none]
}
catch (final RuntimeException ex)
{
// May happen when XPath errors are contained
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String getGeneSymbol(ProteinReference pr)
{
for (Xref xr : pr.getXref())
{
String db = xr.getDb();
if (db != null)
{
db = db.toLowerCase();
if (db.startsWith("hgnc"))
{
String id = xr.getId();
if (id != null)
{
String symbol = HGNC.getSymbol(id);
if (symbol != null && !symbol.isEmpty())
{
return symbol;
}
}
}
}
}
return null;
} }
|
public class class_name {
protected String getGeneSymbol(ProteinReference pr)
{
for (Xref xr : pr.getXref())
{
String db = xr.getDb();
if (db != null)
{
db = db.toLowerCase(); // depends on control dependency: [if], data = [none]
if (db.startsWith("hgnc"))
{
String id = xr.getId();
if (id != null)
{
String symbol = HGNC.getSymbol(id);
if (symbol != null && !symbol.isEmpty())
{
return symbol; // depends on control dependency: [if], data = [none]
}
}
}
}
}
return null;
} }
|
public class class_name {
private Map<String, String> replaceInMapValues(Map<String, String> map,
String oldVal,
String newVal) {
for (String key : map.keySet()) {
String value = map.get(key);
if (value.contains(oldVal)) {
value = StringUtils.replace(value, oldVal, newVal);
map.put(key, value);
}
}
return map;
} }
|
public class class_name {
private Map<String, String> replaceInMapValues(Map<String, String> map,
String oldVal,
String newVal) {
for (String key : map.keySet()) {
String value = map.get(key);
if (value.contains(oldVal)) {
value = StringUtils.replace(value, oldVal, newVal); // depends on control dependency: [if], data = [none]
map.put(key, value); // depends on control dependency: [if], data = [none]
}
}
return map;
} }
|
public class class_name {
public void remove(String key) {
Map<String, String> map = inheritableThreadLocal.get();
if (map != null) {
map.remove(key);
}
} }
|
public class class_name {
public void remove(String key) {
Map<String, String> map = inheritableThreadLocal.get();
if (map != null) {
map.remove(key); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Set<SuppressedEvent> getSuppressedEvents() {
if (this.suppressedEvents == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(this.suppressedEvents);
} }
|
public class class_name {
public Set<SuppressedEvent> getSuppressedEvents() {
if (this.suppressedEvents == null) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(this.suppressedEvents);
} }
|
public class class_name {
@Override
public EClass getIfcBuildingElementProxyType() {
if (ifcBuildingElementProxyTypeEClass == null) {
ifcBuildingElementProxyTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(62);
}
return ifcBuildingElementProxyTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcBuildingElementProxyType() {
if (ifcBuildingElementProxyTypeEClass == null) {
ifcBuildingElementProxyTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(62);
// depends on control dependency: [if], data = [none]
}
return ifcBuildingElementProxyTypeEClass;
} }
|
public class class_name {
public Set<String> getIdsPerName(final String surname, final String name) {
if (surname == null || name == null) {
return Collections.emptySet();
}
final Map<String, SortedSet<String>> namesPerSurname =
getNamesPerSurnameMap(surname);
if (!namesPerSurname.containsKey(name)) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(namesPerSurname.get(name));
} }
|
public class class_name {
public Set<String> getIdsPerName(final String surname, final String name) {
if (surname == null || name == null) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
final Map<String, SortedSet<String>> namesPerSurname =
getNamesPerSurnameMap(surname);
if (!namesPerSurname.containsKey(name)) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(namesPerSurname.get(name));
} }
|
public class class_name {
@Override
public void close() {
synchronized (lock) {
closed = true;
while (leaseCount > 0) {
try {
lock.wait();
} catch (InterruptedException ignore) {
// Even on interruption, we cannot terminate the loop until all open leases are closed.
}
}
}
} }
|
public class class_name {
@Override
public void close() {
synchronized (lock) {
closed = true;
while (leaseCount > 0) {
try {
lock.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ignore) {
// Even on interruption, we cannot terminate the loop until all open leases are closed.
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public final VoltTableRow fetchRow(int index) {
assert(verifyTableInvariants());
// check bounds
if ((index < 0) || (index >= m_rowCount)) {
throw new IndexOutOfBoundsException("index = " + index + "; rows = " + m_rowCount);
}
// if no memoized value or looking in front of the memoized value, reset
if ((m_memoizedRowOffset == NO_MEMOIZED_ROW_OFFSET) || (index < m_memoizedRowOffset)) {
m_memoizedRowOffset = 0; m_memoizedBufferOffset = m_rowStart + ROW_COUNT_SIZE;
}
while (m_memoizedRowOffset < index) {
// add 4 bytes as the row size is non-inclusive
m_memoizedBufferOffset += m_buffer.getInt(m_memoizedBufferOffset) + ROW_HEADER_SIZE;
m_memoizedRowOffset++;
}
Row retval = new Row(m_memoizedBufferOffset + ROW_HEADER_SIZE);
retval.m_activeRowIndex = index;
return retval;
} }
|
public class class_name {
public final VoltTableRow fetchRow(int index) {
assert(verifyTableInvariants());
// check bounds
if ((index < 0) || (index >= m_rowCount)) {
throw new IndexOutOfBoundsException("index = " + index + "; rows = " + m_rowCount);
}
// if no memoized value or looking in front of the memoized value, reset
if ((m_memoizedRowOffset == NO_MEMOIZED_ROW_OFFSET) || (index < m_memoizedRowOffset)) {
m_memoizedRowOffset = 0; m_memoizedBufferOffset = m_rowStart + ROW_COUNT_SIZE; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
while (m_memoizedRowOffset < index) {
// add 4 bytes as the row size is non-inclusive
m_memoizedBufferOffset += m_buffer.getInt(m_memoizedBufferOffset) + ROW_HEADER_SIZE; // depends on control dependency: [while], data = [none]
m_memoizedRowOffset++; // depends on control dependency: [while], data = [none]
}
Row retval = new Row(m_memoizedBufferOffset + ROW_HEADER_SIZE);
retval.m_activeRowIndex = index;
return retval;
} }
|
public class class_name {
void considerConnect(SquareNode node0, SquareNode node1) {
// Find the side on each line which intersects the line connecting the two centers
lineA.a = node0.center;
lineA.b = node1.center;
int intersection0 = graph.findSideIntersect(node0,lineA,intersection,lineB);
connectLine.a.set(intersection);
int intersection1 = graph.findSideIntersect(node1,lineA,intersection,lineB);
connectLine.b.set(intersection);
if( intersection1 < 0 || intersection0 < 0 ) {
return;
}
double side0 = node0.sideLengths[intersection0];
double side1 = node1.sideLengths[intersection1];
// it should intersect about in the middle of the line
double sideLoc0 = connectLine.a.distance(node0.square.get(intersection0))/side0;
double sideLoc1 = connectLine.b.distance(node1.square.get(intersection1))/side1;
if( Math.abs(sideLoc0-0.5)>0.35 || Math.abs(sideLoc1-0.5)>0.35 )
return;
// see if connecting sides are of similar size
if( Math.abs(side0-side1)/Math.max(side0,side1) > 0.25 ) {
return;
}
// Checks to see if the two sides selected above are closest to being parallel to each other.
// Perspective distortion will make the lines not parallel, but will still have a smaller
// acute angle than the adjacent sides
if( !graph.almostParallel(node0, intersection0, node1, intersection1)) {
return;
}
double ratio = Math.max(node0.smallestSide/node1.largestSide ,
node1.smallestSide/node0.largestSide);
// System.out.println("ratio "+ratio);
if( ratio > 1.3 )
return;
double angle = graph.acuteAngle(node0, intersection0, node1, intersection1);
double score = lineA.getLength()*(1.0+angle/0.1);
graph.checkConnect(node0,intersection0,node1,intersection1,score);
} }
|
public class class_name {
void considerConnect(SquareNode node0, SquareNode node1) {
// Find the side on each line which intersects the line connecting the two centers
lineA.a = node0.center;
lineA.b = node1.center;
int intersection0 = graph.findSideIntersect(node0,lineA,intersection,lineB);
connectLine.a.set(intersection);
int intersection1 = graph.findSideIntersect(node1,lineA,intersection,lineB);
connectLine.b.set(intersection);
if( intersection1 < 0 || intersection0 < 0 ) {
return; // depends on control dependency: [if], data = [none]
}
double side0 = node0.sideLengths[intersection0];
double side1 = node1.sideLengths[intersection1];
// it should intersect about in the middle of the line
double sideLoc0 = connectLine.a.distance(node0.square.get(intersection0))/side0;
double sideLoc1 = connectLine.b.distance(node1.square.get(intersection1))/side1;
if( Math.abs(sideLoc0-0.5)>0.35 || Math.abs(sideLoc1-0.5)>0.35 )
return;
// see if connecting sides are of similar size
if( Math.abs(side0-side1)/Math.max(side0,side1) > 0.25 ) {
return; // depends on control dependency: [if], data = [none]
}
// Checks to see if the two sides selected above are closest to being parallel to each other.
// Perspective distortion will make the lines not parallel, but will still have a smaller
// acute angle than the adjacent sides
if( !graph.almostParallel(node0, intersection0, node1, intersection1)) {
return; // depends on control dependency: [if], data = [none]
}
double ratio = Math.max(node0.smallestSide/node1.largestSide ,
node1.smallestSide/node0.largestSide);
// System.out.println("ratio "+ratio);
if( ratio > 1.3 )
return;
double angle = graph.acuteAngle(node0, intersection0, node1, intersection1);
double score = lineA.getLength()*(1.0+angle/0.1);
graph.checkConnect(node0,intersection0,node1,intersection1,score);
} }
|
public class class_name {
boolean matchStandaloneElement(
final boolean blockMatching,
final int markupLevel, final int markupBlockIndex, final SelectorElementBuffer elementBuffer) {
checkMarkupLevel(markupLevel);
if (this.markupSelectorItem.anyLevel() || markupLevel == 0 || (this.prev != null && this.prev.matchedMarkupLevels[markupLevel - 1])) {
// This element has not matched yet, but might match, so we should check
this.matchesThisLevel = this.markupSelectorItem.matchesElement(markupBlockIndex, elementBuffer, this.markupBlockMatchingCounter);
if (matchesPreviousOrCurrentLevel(markupLevel)) {
// This filter was already matched by a previous level (through an "open" event), so just delegate to next.
if (this.next != null) {
return this.next.matchStandaloneElement(blockMatching, markupLevel, markupBlockIndex, elementBuffer);
}
return (blockMatching? true : this.matchesThisLevel);
} else if (this.matchesThisLevel) {
// This filter was not matched before. So the fact that it matches now means we need to consume it,
// therefore not delegating.
return (this.next == null);
}
} else if (matchesPreviousOrCurrentLevel(markupLevel)) {
// This filter was already matched by a previous level (through an "open" event), so just delegate to next.
if (this.next != null) {
return this.next.matchStandaloneElement(blockMatching, markupLevel, markupBlockIndex, elementBuffer);
}
return blockMatching;
}
return false;
} }
|
public class class_name {
boolean matchStandaloneElement(
final boolean blockMatching,
final int markupLevel, final int markupBlockIndex, final SelectorElementBuffer elementBuffer) {
checkMarkupLevel(markupLevel);
if (this.markupSelectorItem.anyLevel() || markupLevel == 0 || (this.prev != null && this.prev.matchedMarkupLevels[markupLevel - 1])) {
// This element has not matched yet, but might match, so we should check
this.matchesThisLevel = this.markupSelectorItem.matchesElement(markupBlockIndex, elementBuffer, this.markupBlockMatchingCounter); // depends on control dependency: [if], data = [none]
if (matchesPreviousOrCurrentLevel(markupLevel)) {
// This filter was already matched by a previous level (through an "open" event), so just delegate to next.
if (this.next != null) {
return this.next.matchStandaloneElement(blockMatching, markupLevel, markupBlockIndex, elementBuffer); // depends on control dependency: [if], data = [none]
}
return (blockMatching? true : this.matchesThisLevel); // depends on control dependency: [if], data = [none]
} else if (this.matchesThisLevel) {
// This filter was not matched before. So the fact that it matches now means we need to consume it,
// therefore not delegating.
return (this.next == null); // depends on control dependency: [if], data = [none]
}
} else if (matchesPreviousOrCurrentLevel(markupLevel)) {
// This filter was already matched by a previous level (through an "open" event), so just delegate to next.
if (this.next != null) {
return this.next.matchStandaloneElement(blockMatching, markupLevel, markupBlockIndex, elementBuffer); // depends on control dependency: [if], data = [none]
}
return blockMatching; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static <T> boolean arrayContainsRef(T[] array, T value) {
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
}
}
return false;
} }
|
public class class_name {
public static <T> boolean arrayContainsRef(T[] array, T value) {
for (int i = 0; i < array.length; i++) {
if (array[i] == value) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public List readAll(final String tableName, Class clazz, EntityMetadata m, final List<Object> rowKey,
List<String> relationNames, String... columns) throws IOException
{
List output = null;
Object entity = null;
HTableInterface hTable = null;
hTable = gethTable(tableName);
// Load raw data from HBase
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz());
// For secondary tables.
List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
.getSecondaryTablesName();
secondaryTables.add(m.getTableName());
List<HBaseData> results = new ArrayList<HBaseData>();
for (String colTableName : secondaryTables)
{
List table = ((HBaseReader) hbaseReader).loadAll(hTable, rowKey, colTableName, columns);
// null check for 'table'. addAll method throws exception if table
// is null
if (table != null)
{
results.addAll(table);
}
}
output = onRead(tableName, clazz, m, output, hTable, entity, relationNames, results);
return output;
} }
|
public class class_name {
@Override
public List readAll(final String tableName, Class clazz, EntityMetadata m, final List<Object> rowKey,
List<String> relationNames, String... columns) throws IOException
{
List output = null;
Object entity = null;
HTableInterface hTable = null;
hTable = gethTable(tableName);
// Load raw data from HBase
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
AbstractManagedType managedType = (AbstractManagedType) metaModel.entity(m.getEntityClazz());
// For secondary tables.
List<String> secondaryTables = ((DefaultEntityAnnotationProcessor) managedType.getEntityAnnotation())
.getSecondaryTablesName();
secondaryTables.add(m.getTableName());
List<HBaseData> results = new ArrayList<HBaseData>();
for (String colTableName : secondaryTables)
{
List table = ((HBaseReader) hbaseReader).loadAll(hTable, rowKey, colTableName, columns);
// null check for 'table'. addAll method throws exception if table
// is null
if (table != null)
{
results.addAll(table); // depends on control dependency: [if], data = [(table]
}
}
output = onRead(tableName, clazz, m, output, hTable, entity, relationNames, results);
return output;
} }
|
public class class_name {
public void createBlob(String key, InputStream in, SettableBlobMeta meta) throws KeyAlreadyExistsException, IOException {
AtomicOutputStream out = null;
try {
out = createBlob(key, meta);
byte[] buffer = new byte[2048];
int len = 0;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
out.close();
} catch (IOException | RuntimeException e) {
if (out !=null) {
out.cancel();
}
} finally {
in.close();
}
} }
|
public class class_name {
public void createBlob(String key, InputStream in, SettableBlobMeta meta) throws KeyAlreadyExistsException, IOException {
AtomicOutputStream out = null;
try {
out = createBlob(key, meta);
byte[] buffer = new byte[2048];
int len = 0;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len); // depends on control dependency: [while], data = [none]
}
out.close();
} catch (IOException | RuntimeException e) {
if (out !=null) {
out.cancel(); // depends on control dependency: [if], data = [none]
}
} finally {
in.close();
}
} }
|
public class class_name {
public static Panel vertical(Component... components) {
Panel panel = new Panel();
panel.setLayoutManager(new LinearLayout(Direction.VERTICAL));
for(Component component: components) {
panel.addComponent(component);
}
return panel;
} }
|
public class class_name {
public static Panel vertical(Component... components) {
Panel panel = new Panel();
panel.setLayoutManager(new LinearLayout(Direction.VERTICAL));
for(Component component: components) {
panel.addComponent(component); // depends on control dependency: [for], data = [component]
}
return panel;
} }
|
public class class_name {
public void marshall(Subnet subnet, ProtocolMarshaller protocolMarshaller) {
if (subnet == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(subnet.getSubnetIdentifier(), SUBNETIDENTIFIER_BINDING);
protocolMarshaller.marshall(subnet.getSubnetAvailabilityZone(), SUBNETAVAILABILITYZONE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Subnet subnet, ProtocolMarshaller protocolMarshaller) {
if (subnet == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(subnet.getSubnetIdentifier(), SUBNETIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(subnet.getSubnetAvailabilityZone(), SUBNETAVAILABILITYZONE_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 String stripDelimiters(final String value) {
if (value != null && value.length() > 1) {
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\'')) {
return value.substring(1, value.length() - 1);
}
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\"')) {
return value.substring(1, value.length() - 1);
}
}
return value;
} }
|
public class class_name {
public static String stripDelimiters(final String value) {
if (value != null && value.length() > 1) {
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\'')) {
return value.substring(1, value.length() - 1); // depends on control dependency: [if], data = [none]
}
if (value.charAt(0) == value.charAt(value.length() - 1)
&& (value.charAt(0) == '\"')) {
return value.substring(1, value.length() - 1); // depends on control dependency: [if], data = [none]
}
}
return value;
} }
|
public class class_name {
static String shortenPathName(Path path, int bytes) {
String pathString = path.toUri().getPath();
String replaced = pathString.replace("/", "_");
if (replaced.length() <= bytes) {
return replaced;
}
int bytesPerHalf = (bytes - 3) / 2;
return replaced.substring(0, bytesPerHalf) + "..." + replaced.substring(replaced.length() - bytesPerHalf);
} }
|
public class class_name {
static String shortenPathName(Path path, int bytes) {
String pathString = path.toUri().getPath();
String replaced = pathString.replace("/", "_");
if (replaced.length() <= bytes) {
return replaced; // depends on control dependency: [if], data = [none]
}
int bytesPerHalf = (bytes - 3) / 2;
return replaced.substring(0, bytesPerHalf) + "..." + replaced.substring(replaced.length() - bytesPerHalf);
} }
|
public class class_name {
public void marshall(ParameterHistory parameterHistory, ProtocolMarshaller protocolMarshaller) {
if (parameterHistory == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(parameterHistory.getName(), NAME_BINDING);
protocolMarshaller.marshall(parameterHistory.getType(), TYPE_BINDING);
protocolMarshaller.marshall(parameterHistory.getKeyId(), KEYID_BINDING);
protocolMarshaller.marshall(parameterHistory.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(parameterHistory.getLastModifiedUser(), LASTMODIFIEDUSER_BINDING);
protocolMarshaller.marshall(parameterHistory.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(parameterHistory.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(parameterHistory.getAllowedPattern(), ALLOWEDPATTERN_BINDING);
protocolMarshaller.marshall(parameterHistory.getVersion(), VERSION_BINDING);
protocolMarshaller.marshall(parameterHistory.getLabels(), LABELS_BINDING);
protocolMarshaller.marshall(parameterHistory.getTier(), TIER_BINDING);
protocolMarshaller.marshall(parameterHistory.getPolicies(), POLICIES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ParameterHistory parameterHistory, ProtocolMarshaller protocolMarshaller) {
if (parameterHistory == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(parameterHistory.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getKeyId(), KEYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getLastModifiedUser(), LASTMODIFIEDUSER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getAllowedPattern(), ALLOWEDPATTERN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getLabels(), LABELS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getTier(), TIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(parameterHistory.getPolicies(), POLICIES_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 {
void analyze(JCStatement statement, Env<AttrContext> env) {
AnalysisContext context = new AnalysisContext();
StatementScanner statementScanner = new StatementScanner(context);
statementScanner.scan(statement);
if (!context.treesToAnalyzer.isEmpty()) {
//add a block to hoist potential dangling variable declarations
JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
TreeMapper treeMapper = new TreeMapper(context);
//TODO: to further refine the analysis, try all rewriting combinations
deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
t -> new AnalyzeDeferredDiagHandler(context),
argumentAttr.withLocalCacheContext());
context.treeMap.entrySet().forEach(e -> {
context.treesToAnalyzer.get(e.getKey())
.process(e.getKey(), e.getValue(), context.errors.nonEmpty());
});
}
} }
|
public class class_name {
void analyze(JCStatement statement, Env<AttrContext> env) {
AnalysisContext context = new AnalysisContext();
StatementScanner statementScanner = new StatementScanner(context);
statementScanner.scan(statement);
if (!context.treesToAnalyzer.isEmpty()) {
//add a block to hoist potential dangling variable declarations
JCBlock fakeBlock = make.Block(SYNTHETIC, List.of(statement));
TreeMapper treeMapper = new TreeMapper(context);
//TODO: to further refine the analysis, try all rewriting combinations
deferredAttr.attribSpeculative(fakeBlock, env, attr.statInfo, treeMapper,
t -> new AnalyzeDeferredDiagHandler(context),
argumentAttr.withLocalCacheContext()); // depends on control dependency: [if], data = [none]
context.treeMap.entrySet().forEach(e -> {
context.treesToAnalyzer.get(e.getKey())
.process(e.getKey(), e.getValue(), context.errors.nonEmpty()); // depends on control dependency: [if], data = [none]
});
}
} }
|
public class class_name {
public static <First extends Comparable<? super First>, Second extends Comparable<? super Second>>
int compare(
final First firstOfLeft, final Second secondOfLeft,
final First firstOfRight, final Second secondOfRight) {
// (?, ?) and (?, ?)
if (firstOfLeft == null) {
// (null, ?) and (?, ?)
if (firstOfRight == null) {
// (null, ?) and (null, ?)
if (secondOfLeft == null) {
// (null, null) and (null, ?)
if (secondOfRight == null) {
// (null, null) and (null, null)
return 0;
} else {
// (null, null) and (null, /something/)
return -1;
}
} else {
if (secondOfRight == null) {
// (null, /something/) and (null, null)
return 1;
} else {
// (null, /something/) and (null, /something/)
return secondOfLeft.compareTo(secondOfRight);
}
}
}
// (null, ?) and (/something/, ?)
return 1;
}
// (/something/, ?) and (/something/, ?)
final int comparisonOfFirsts = firstOfLeft.compareTo(firstOfRight);
if (comparisonOfFirsts != 0) {
return comparisonOfFirsts;
}
// (x, ?) and (x, ?)
if (secondOfLeft == null) {
// (x, null) and (x, ?)
if (secondOfRight == null) {
// (x, null) and (x, null)
return 0;
} else {
// (x, null) and (x, /something/)
return -1;
}
}
// (x, /something/) and (x, ?)
if (secondOfRight == null) {
return 1;
}
// (x, /something/) and (x, /something/)
return secondOfLeft.compareTo(secondOfRight);
} }
|
public class class_name {
public static <First extends Comparable<? super First>, Second extends Comparable<? super Second>>
int compare(
final First firstOfLeft, final Second secondOfLeft,
final First firstOfRight, final Second secondOfRight) {
// (?, ?) and (?, ?)
if (firstOfLeft == null) {
// (null, ?) and (?, ?)
if (firstOfRight == null) {
// (null, ?) and (null, ?)
if (secondOfLeft == null) {
// (null, null) and (null, ?)
if (secondOfRight == null) {
// (null, null) and (null, null)
return 0; // depends on control dependency: [if], data = [none]
} else {
// (null, null) and (null, /something/)
return -1; // depends on control dependency: [if], data = [none]
}
} else {
if (secondOfRight == null) {
// (null, /something/) and (null, null)
return 1; // depends on control dependency: [if], data = [none]
} else {
// (null, /something/) and (null, /something/)
return secondOfLeft.compareTo(secondOfRight); // depends on control dependency: [if], data = [(secondOfRight]
}
}
}
// (null, ?) and (/something/, ?)
return 1; // depends on control dependency: [if], data = [none]
}
// (/something/, ?) and (/something/, ?)
final int comparisonOfFirsts = firstOfLeft.compareTo(firstOfRight);
if (comparisonOfFirsts != 0) {
return comparisonOfFirsts; // depends on control dependency: [if], data = [none]
}
// (x, ?) and (x, ?)
if (secondOfLeft == null) {
// (x, null) and (x, ?)
if (secondOfRight == null) {
// (x, null) and (x, null)
return 0; // depends on control dependency: [if], data = [none]
} else {
// (x, null) and (x, /something/)
return -1; // depends on control dependency: [if], data = [none]
}
}
// (x, /something/) and (x, ?)
if (secondOfRight == null) {
return 1; // depends on control dependency: [if], data = [none]
}
// (x, /something/) and (x, /something/)
return secondOfLeft.compareTo(secondOfRight);
} }
|
public class class_name {
public static void recordDefaultAnnotationHandlerMappingInstance(Object obj) {
if (debug) {
System.out.println("SPRING_PLUGIN: Recording new instance of DefaultAnnotationHandlerMappingInstance");
}
defaultAnnotationHandlerMappingInstances.add(obj);
} }
|
public class class_name {
public static void recordDefaultAnnotationHandlerMappingInstance(Object obj) {
if (debug) {
System.out.println("SPRING_PLUGIN: Recording new instance of DefaultAnnotationHandlerMappingInstance"); // depends on control dependency: [if], data = [none]
}
defaultAnnotationHandlerMappingInstances.add(obj);
} }
|
public class class_name {
public final Throwable[] determineCauseChain(Throwable throwable) {
if (throwable == null) {
throw new IllegalArgumentException("Invalid throwable: null");
}
List<Throwable> chain = new ArrayList<>();
Throwable currentThrowable = throwable;
while (currentThrowable != null) {
chain.add(currentThrowable);
currentThrowable = extractCause(currentThrowable);
}
return chain.toArray(new Throwable[chain.size()]);
} }
|
public class class_name {
public final Throwable[] determineCauseChain(Throwable throwable) {
if (throwable == null) {
throw new IllegalArgumentException("Invalid throwable: null");
}
List<Throwable> chain = new ArrayList<>();
Throwable currentThrowable = throwable;
while (currentThrowable != null) {
chain.add(currentThrowable); // depends on control dependency: [while], data = [(currentThrowable]
currentThrowable = extractCause(currentThrowable); // depends on control dependency: [while], data = [(currentThrowable]
}
return chain.toArray(new Throwable[chain.size()]);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static Response get(String url, Object... params) throws HttpException {
try {
Map<String, Object> map = new HashMap<>();
for (Object bean : params) {
if (bean instanceof Parameter) {
Parameter p = (Parameter) bean;
map.put(p.getName(), p.getValue());
} else if (bean instanceof Map) {
map.putAll((Map<String, Object>) bean);
} else {
map.putAll(BeanUtils.convert(bean));
}
}
return get(url, map);
} catch (BeanException e) {
throw new HttpException("Failed to convert bean fields into request parameters", e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static Response get(String url, Object... params) throws HttpException {
try {
Map<String, Object> map = new HashMap<>();
for (Object bean : params) {
if (bean instanceof Parameter) {
Parameter p = (Parameter) bean;
map.put(p.getName(), p.getValue()); // depends on control dependency: [if], data = [none]
} else if (bean instanceof Map) {
map.putAll((Map<String, Object>) bean); // depends on control dependency: [if], data = [none]
} else {
map.putAll(BeanUtils.convert(bean)); // depends on control dependency: [if], data = [none]
}
}
return get(url, map); // depends on control dependency: [try], data = [none]
} catch (BeanException e) {
throw new HttpException("Failed to convert bean fields into request parameters", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public MessageEvent parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
MessageEvent messageEvent = new MessageEvent();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("id"))
messageEvent.setStanzaId(parser.nextText());
if (parser.getName().equals(MessageEvent.COMPOSING))
messageEvent.setComposing(true);
if (parser.getName().equals(MessageEvent.DELIVERED))
messageEvent.setDelivered(true);
if (parser.getName().equals(MessageEvent.DISPLAYED))
messageEvent.setDisplayed(true);
if (parser.getName().equals(MessageEvent.OFFLINE))
messageEvent.setOffline(true);
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("x")) {
done = true;
}
}
}
return messageEvent;
} }
|
public class class_name {
@Override
public MessageEvent parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
MessageEvent messageEvent = new MessageEvent();
boolean done = false;
while (!done) {
int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("id"))
messageEvent.setStanzaId(parser.nextText());
if (parser.getName().equals(MessageEvent.COMPOSING))
messageEvent.setComposing(true);
if (parser.getName().equals(MessageEvent.DELIVERED))
messageEvent.setDelivered(true);
if (parser.getName().equals(MessageEvent.DISPLAYED))
messageEvent.setDisplayed(true);
if (parser.getName().equals(MessageEvent.OFFLINE))
messageEvent.setOffline(true);
} else if (eventType == XmlPullParser.END_TAG) {
if (parser.getName().equals("x")) {
done = true; // depends on control dependency: [if], data = [none]
}
}
}
return messageEvent;
} }
|
public class class_name {
public static SparseBitmap bitmapOf(int... k) {
SparseBitmap s = new SparseBitmap();
for (int i : k) {
s.set(i);
}
return s;
} }
|
public class class_name {
public static SparseBitmap bitmapOf(int... k) {
SparseBitmap s = new SparseBitmap();
for (int i : k) {
s.set(i); // depends on control dependency: [for], data = [i]
}
return s;
} }
|
public class class_name {
public static <T extends BioPAXElement> Set<T> searchAndCollect(
Collection<? extends BioPAXElement> eles, Pattern pattern, int index, Class<T> c)
{
Set<T> set = new HashSet<T>();
for (Match match : searchPlain(eles, pattern))
{
set.add((T) match.get(index));
}
return set;
} }
|
public class class_name {
public static <T extends BioPAXElement> Set<T> searchAndCollect(
Collection<? extends BioPAXElement> eles, Pattern pattern, int index, Class<T> c)
{
Set<T> set = new HashSet<T>();
for (Match match : searchPlain(eles, pattern))
{
set.add((T) match.get(index)); // depends on control dependency: [for], data = [match]
}
return set;
} }
|
public class class_name {
protected boolean moduleCanHandlePath( ModuleConfig moduleConfig, RequestProcessor rp, String servletPath )
{
if ( moduleConfig.getPrefix().equals( "" ) && servletPath.lastIndexOf( '/' ) > 0
&& rp instanceof PageFlowRequestProcessor )
{
return false;
}
return true;
} }
|
public class class_name {
protected boolean moduleCanHandlePath( ModuleConfig moduleConfig, RequestProcessor rp, String servletPath )
{
if ( moduleConfig.getPrefix().equals( "" ) && servletPath.lastIndexOf( '/' ) > 0
&& rp instanceof PageFlowRequestProcessor )
{
return false; // depends on control dependency: [if], data = [se]
}
return true;
} }
|
public class class_name {
private void addPostParams(final Request request) {
if (username != null) {
request.addPostParam("Username", username);
}
if (password != null) {
request.addPostParam("Password", password);
}
} }
|
public class class_name {
private void addPostParams(final Request request) {
if (username != null) {
request.addPostParam("Username", username); // depends on control dependency: [if], data = [none]
}
if (password != null) {
request.addPostParam("Password", password); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void setKeyEvent(KeyEvent keyEvent) {
if (gvrCursorController instanceof GVRExternalCursorController) {
GVRExternalCursorController controller = (GVRExternalCursorController)
gvrCursorController;
controller.setKeyEvent(keyEvent);
} else {
throw new UnsupportedOperationException("setKeyEvent not supported");
}
} }
|
public class class_name {
protected void setKeyEvent(KeyEvent keyEvent) {
if (gvrCursorController instanceof GVRExternalCursorController) {
GVRExternalCursorController controller = (GVRExternalCursorController)
gvrCursorController;
controller.setKeyEvent(keyEvent); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException("setKeyEvent not supported");
}
} }
|
public class class_name {
private void writeResp(ServletResponse response, SolrQueryRequest queryRequest, SolrQueryResponse queryResponse)
throws IOException, UnsupportedEncodingException {
if (m_solr instanceof EmbeddedSolrServer) {
SolrCore core = ((EmbeddedSolrServer)m_solr).getCoreContainer().getCore(getCoreName());
Writer out = null;
try {
QueryResponseWriter responseWriter = core.getQueryResponseWriter(queryRequest);
final String ct = responseWriter.getContentType(queryRequest, queryResponse);
if (null != ct) {
response.setContentType(ct);
}
if (responseWriter instanceof BinaryQueryResponseWriter) {
BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter)responseWriter;
binWriter.write(response.getOutputStream(), queryRequest, queryResponse);
} else {
String charset = ContentStreamBase.getCharsetFromContentType(ct);
out = ((charset == null) || charset.equalsIgnoreCase(UTF8.toString()))
? new OutputStreamWriter(response.getOutputStream(), UTF8)
: new OutputStreamWriter(response.getOutputStream(), charset);
out = new FastWriter(out);
responseWriter.write(out, queryRequest, queryResponse);
out.flush();
}
} finally {
core.close();
if (out != null) {
out.close();
}
}
} else {
throw new UnsupportedOperationException();
}
} }
|
public class class_name {
private void writeResp(ServletResponse response, SolrQueryRequest queryRequest, SolrQueryResponse queryResponse)
throws IOException, UnsupportedEncodingException {
if (m_solr instanceof EmbeddedSolrServer) {
SolrCore core = ((EmbeddedSolrServer)m_solr).getCoreContainer().getCore(getCoreName());
Writer out = null;
try {
QueryResponseWriter responseWriter = core.getQueryResponseWriter(queryRequest);
final String ct = responseWriter.getContentType(queryRequest, queryResponse);
if (null != ct) {
response.setContentType(ct);
// depends on control dependency: [if], data = [ct)]
}
if (responseWriter instanceof BinaryQueryResponseWriter) {
BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter)responseWriter;
binWriter.write(response.getOutputStream(), queryRequest, queryResponse);
// depends on control dependency: [if], data = [none]
} else {
String charset = ContentStreamBase.getCharsetFromContentType(ct);
out = ((charset == null) || charset.equalsIgnoreCase(UTF8.toString()))
? new OutputStreamWriter(response.getOutputStream(), UTF8)
: new OutputStreamWriter(response.getOutputStream(), charset);
// depends on control dependency: [if], data = [none]
out = new FastWriter(out);
// depends on control dependency: [if], data = [none]
responseWriter.write(out, queryRequest, queryResponse);
// depends on control dependency: [if], data = [none]
out.flush();
// depends on control dependency: [if], data = [none]
}
} finally {
core.close();
if (out != null) {
out.close();
// depends on control dependency: [if], data = [none]
}
}
} else {
throw new UnsupportedOperationException();
}
} }
|
public class class_name {
public void addWarning(SQLWarning warn) {
// Add the warning to the chain
if (firstWarning != null) {
firstWarning.setNextWarning(warn);
} else {
firstWarning = warn;
}
} }
|
public class class_name {
public void addWarning(SQLWarning warn) {
// Add the warning to the chain
if (firstWarning != null) {
firstWarning.setNextWarning(warn); // depends on control dependency: [if], data = [none]
} else {
firstWarning = warn; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static void closeQuietly(State state) {
// ensure only closed once and avoid race conditions
if (state.closed.compareAndSet(false, true)) {
// set the state fields to null after closing for garbage
// collection purposes
log.debug("closing rs");
Util.closeQuietly(state.rs);
log.debug("closing ps");
Util.closeQuietly(state.ps);
log.debug("closing con");
Util.closeQuietlyIfAutoCommit(state.con);
log.debug("closed");
}
} }
|
public class class_name {
private static void closeQuietly(State state) {
// ensure only closed once and avoid race conditions
if (state.closed.compareAndSet(false, true)) {
// set the state fields to null after closing for garbage
// collection purposes
log.debug("closing rs"); // depends on control dependency: [if], data = [none]
Util.closeQuietly(state.rs); // depends on control dependency: [if], data = [none]
log.debug("closing ps"); // depends on control dependency: [if], data = [none]
Util.closeQuietly(state.ps); // depends on control dependency: [if], data = [none]
log.debug("closing con"); // depends on control dependency: [if], data = [none]
Util.closeQuietlyIfAutoCommit(state.con); // depends on control dependency: [if], data = [none]
log.debug("closed"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Signature getSignatureBySigner(String email, String name) {
if (email == null || name == null) {
return null;
}
for (Signature s : getSignatures()) {
if (name.equalsIgnoreCase(s.getName()) && email.equalsIgnoreCase(s.getEmail())) {
return s;
}
}
return null;
} }
|
public class class_name {
public Signature getSignatureBySigner(String email, String name) {
if (email == null || name == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (Signature s : getSignatures()) {
if (name.equalsIgnoreCase(s.getName()) && email.equalsIgnoreCase(s.getEmail())) {
return s; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public void marshall(StartLoggingRequest startLoggingRequest, ProtocolMarshaller protocolMarshaller) {
if (startLoggingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startLoggingRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StartLoggingRequest startLoggingRequest, ProtocolMarshaller protocolMarshaller) {
if (startLoggingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(startLoggingRequest.getName(), NAME_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 CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) {
if (s != null && s.length() > 0) {
if (!(s instanceof Spannable)) {
s = new SpannableString(s);
}
((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
return s;
} }
|
public class class_name {
public static CharSequence applyTypefaceSpan(CharSequence s, Typeface typeface) {
if (s != null && s.length() > 0) {
if (!(s instanceof Spannable)) {
s = new SpannableString(s); // depends on control dependency: [if], data = [none]
}
((Spannable) s).setSpan(TypefaceUtils.getSpan(typeface), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // depends on control dependency: [if], data = [none]
}
return s;
} }
|
public class class_name {
public ClassPool getClassPool() {
if (classPool == null) {
if (classLoader == null) {
throw new IllegalStateException("can't init javassit classpool, there is no class loader set for the component");
}
classPool = new ClassPool();
// add class path for domain and dependencies
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain));
for(ClassLoader domainDependencies : classLoaderDomain.getAllDependencies()) {
classPool.appendClassPath(new LoaderClassPath(domainDependencies));
}
// add class path also for slee
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain.getParent()));
}
return classPool;
} }
|
public class class_name {
public ClassPool getClassPool() {
if (classPool == null) {
if (classLoader == null) {
throw new IllegalStateException("can't init javassit classpool, there is no class loader set for the component");
}
classPool = new ClassPool(); // depends on control dependency: [if], data = [none]
// add class path for domain and dependencies
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain)); // depends on control dependency: [if], data = [none]
for(ClassLoader domainDependencies : classLoaderDomain.getAllDependencies()) {
classPool.appendClassPath(new LoaderClassPath(domainDependencies)); // depends on control dependency: [for], data = [domainDependencies]
}
// add class path also for slee
classPool.appendClassPath(new LoaderClassPath(classLoaderDomain.getParent())); // depends on control dependency: [if], data = [none]
}
return classPool;
} }
|
public class class_name {
public GetApiKeysResult withWarnings(String... warnings) {
if (this.warnings == null) {
setWarnings(new java.util.ArrayList<String>(warnings.length));
}
for (String ele : warnings) {
this.warnings.add(ele);
}
return this;
} }
|
public class class_name {
public GetApiKeysResult withWarnings(String... warnings) {
if (this.warnings == null) {
setWarnings(new java.util.ArrayList<String>(warnings.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : warnings) {
this.warnings.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private FieldIndex registerFieldIndex(final int index,
final InternalReadAccessor fieldExtractor) {
FieldIndex fieldIndex = null;
// is linkedlist null, if so create and add
if ( this.hashedFieldIndexes == null ) {
this.hashedFieldIndexes = new LinkedList<FieldIndex>();
fieldIndex = new FieldIndex( index,
fieldExtractor );
this.hashedFieldIndexes.add( fieldIndex );
}
// still null, so see if it already exists
if ( fieldIndex == null ) {
fieldIndex = findFieldIndex( index );
}
// doesn't exist so create it
if ( fieldIndex == null ) {
fieldIndex = new FieldIndex( index,
fieldExtractor );
this.hashedFieldIndexes.add( fieldIndex );
}
fieldIndex.increaseCounter();
return fieldIndex;
} }
|
public class class_name {
private FieldIndex registerFieldIndex(final int index,
final InternalReadAccessor fieldExtractor) {
FieldIndex fieldIndex = null;
// is linkedlist null, if so create and add
if ( this.hashedFieldIndexes == null ) {
this.hashedFieldIndexes = new LinkedList<FieldIndex>(); // depends on control dependency: [if], data = [none]
fieldIndex = new FieldIndex( index,
fieldExtractor ); // depends on control dependency: [if], data = [none]
this.hashedFieldIndexes.add( fieldIndex ); // depends on control dependency: [if], data = [none]
}
// still null, so see if it already exists
if ( fieldIndex == null ) {
fieldIndex = findFieldIndex( index ); // depends on control dependency: [if], data = [none]
}
// doesn't exist so create it
if ( fieldIndex == null ) {
fieldIndex = new FieldIndex( index,
fieldExtractor ); // depends on control dependency: [if], data = [none]
this.hashedFieldIndexes.add( fieldIndex ); // depends on control dependency: [if], data = [( fieldIndex]
}
fieldIndex.increaseCounter();
return fieldIndex;
} }
|
public class class_name {
public @Nullable Info lookup(String httpMethod, String url) {
httpMethod = httpMethod.toLowerCase();
if (url.startsWith("/")) {
url = url.substring(1);
}
url = StringUtils.stripTrailingSlash(url);
List<Info> infos = infosByHttpMethod.get(httpMethod);
if (infos == null) {
log.atFine().log(
"no information about any urls for HTTP method %s when checking %s", httpMethod, url);
return null;
}
for (Info info : infos) {
log.atFine().log("trying %s with template %s", url, info.getTemplate());
if (info.getTemplate().matches(url)) {
log.atFine().log("%s matched %s", url, info.getTemplate());
return info;
} else {
log.atFine().log("%s did not matched %s", url, info.getTemplate());
}
}
return null;
} }
|
public class class_name {
public @Nullable Info lookup(String httpMethod, String url) {
httpMethod = httpMethod.toLowerCase();
if (url.startsWith("/")) {
url = url.substring(1); // depends on control dependency: [if], data = [none]
}
url = StringUtils.stripTrailingSlash(url);
List<Info> infos = infosByHttpMethod.get(httpMethod);
if (infos == null) {
log.atFine().log(
"no information about any urls for HTTP method %s when checking %s", httpMethod, url); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
for (Info info : infos) {
log.atFine().log("trying %s with template %s", url, info.getTemplate()); // depends on control dependency: [for], data = [info]
if (info.getTemplate().matches(url)) {
log.atFine().log("%s matched %s", url, info.getTemplate()); // depends on control dependency: [if], data = [none]
return info; // depends on control dependency: [if], data = [none]
} else {
log.atFine().log("%s did not matched %s", url, info.getTemplate()); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public void removeDocumentFromCache(int n)
{
if(DTM.NULL ==n)
return;
for(int i=m_sourceTree.size()-1;i>=0;--i)
{
SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
if(st!=null && st.m_root==n)
{
m_sourceTree.removeElementAt(i);
return;
}
}
} }
|
public class class_name {
public void removeDocumentFromCache(int n)
{
if(DTM.NULL ==n)
return;
for(int i=m_sourceTree.size()-1;i>=0;--i)
{
SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
if(st!=null && st.m_root==n)
{
m_sourceTree.removeElementAt(i); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static boolean isLetter(String string) {
boolean result = isNotEmpty(string);
int idx = 0;
int len = string.length();
while (result) {
if (idx >= len) {
break;
}
result = isLetter(string.charAt(idx));
idx++;
}
return result;
} }
|
public class class_name {
public static boolean isLetter(String string) {
boolean result = isNotEmpty(string);
int idx = 0;
int len = string.length();
while (result) {
if (idx >= len) {
break;
}
result = isLetter(string.charAt(idx)); // depends on control dependency: [while], data = [none]
idx++; // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public void marshall(StageDeclaration stageDeclaration, ProtocolMarshaller protocolMarshaller) {
if (stageDeclaration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stageDeclaration.getName(), NAME_BINDING);
protocolMarshaller.marshall(stageDeclaration.getBlockers(), BLOCKERS_BINDING);
protocolMarshaller.marshall(stageDeclaration.getActions(), ACTIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StageDeclaration stageDeclaration, ProtocolMarshaller protocolMarshaller) {
if (stageDeclaration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stageDeclaration.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stageDeclaration.getBlockers(), BLOCKERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stageDeclaration.getActions(), ACTIONS_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 ModifyVpcEndpointRequest withRemoveSubnetIds(String... removeSubnetIds) {
if (this.removeSubnetIds == null) {
setRemoveSubnetIds(new com.amazonaws.internal.SdkInternalList<String>(removeSubnetIds.length));
}
for (String ele : removeSubnetIds) {
this.removeSubnetIds.add(ele);
}
return this;
} }
|
public class class_name {
public ModifyVpcEndpointRequest withRemoveSubnetIds(String... removeSubnetIds) {
if (this.removeSubnetIds == null) {
setRemoveSubnetIds(new com.amazonaws.internal.SdkInternalList<String>(removeSubnetIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : removeSubnetIds) {
this.removeSubnetIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
public boolean contains(Object key)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "contains", key);
Bucket bucket = getBucketForKey(key);
Element element = null; // d173022.12
if (bucket != null) // d739870
{
synchronized (bucket)
{
element = bucket.findByKey(key);
} // d173022.12
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "contains", new Boolean(element != null));
return element != null;
} }
|
public class class_name {
@Override
public boolean contains(Object key)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "contains", key);
Bucket bucket = getBucketForKey(key);
Element element = null; // d173022.12
if (bucket != null) // d739870
{
synchronized (bucket) // depends on control dependency: [if], data = [(bucket]
{
element = bucket.findByKey(key);
} // d173022.12
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "contains", new Boolean(element != null));
return element != null;
} }
|
public class class_name {
public void close()
{
if (_socket!=null) {
try {
_socket.close();
_socket = null;
} catch (IOException e) {
System.err.println("Exception: " + e);
// throw new SoccomException(SoccomException.RECV_ERROR);
}
_in = null;
_out = null;
}
} }
|
public class class_name {
public void close()
{
if (_socket!=null) {
try {
_socket.close(); // depends on control dependency: [try], data = [none]
_socket = null; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
System.err.println("Exception: " + e);
// throw new SoccomException(SoccomException.RECV_ERROR);
} // depends on control dependency: [catch], data = [none]
_in = null; // depends on control dependency: [if], data = [none]
_out = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private int getMatchedDepth(String exceptionType, Throwable ex) {
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t);
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0);
}
} }
|
public class class_name {
private int getMatchedDepth(String exceptionType, Throwable ex) {
Throwable t = ex.getCause();
if (t != null) {
return getMatchedDepth(exceptionType, t); // depends on control dependency: [if], data = [none]
} else {
return getMatchedDepth(exceptionType, ex.getClass(), 0); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void updated(Dictionary<?, ?> props) {
String value = (String) props.get(PROP_IDNAME);
if (null != value) {
this.idName = value.trim();
}
value = (String) props.get(PROP_USE_URLS);
if (null != value && Boolean.parseBoolean(value.trim())) {
this.urlRewritingMarker = ";" + getIDName() + "=" + getSessionVersion();
}
value = (String) props.get(PROP_USE_COOKIES);
if (null != value) {
this.enableCookies = Boolean.parseBoolean(value.trim());
}
if (this.enableCookies) {
// we're using cookies for session information
value = (String) props.get(PROP_COOKIE_SECURE);
if (null != value) {
this.cookieSecure = Boolean.parseBoolean(value.trim());
}
value = (String) props.get(PROP_COOKIE_PATH);
if (null != value) {
this.cookiePath = value.trim();
}
value = (String) props.get(PROP_COOKIE_DOMAIN);
if (null != value) {
this.cookieDomain = value.trim();
}
value = (String) props.get(PROP_COOKIE_MAXAGE);
if (null != value) {
try {
this.cookieMaxAge = Integer.parseInt(value.trim());
} catch (NumberFormatException nfe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Ignoring incorrect max-age [" + value + "]", nfe.getMessage());
}
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: id name [" + this.idName + "]");
if (isURLRewriting()) {
Tr.event(tc, "Config: use URL rewriting [" + this.urlRewritingMarker + "]");
}
if (this.enableCookies) {
Tr.event(tc, "Config: cookie max-age [" + this.cookieMaxAge + "]");
Tr.event(tc, "Config: cookie secure [" + this.cookieSecure + "]");
Tr.event(tc, "Config: cookie domain [" + this.cookieDomain + "]");
Tr.event(tc, "Config: cookie path [" + this.cookiePath + "]");
} else {
Tr.event(tc, "Config: cookies disabled");
}
}
} }
|
public class class_name {
public void updated(Dictionary<?, ?> props) {
String value = (String) props.get(PROP_IDNAME);
if (null != value) {
this.idName = value.trim(); // depends on control dependency: [if], data = [none]
}
value = (String) props.get(PROP_USE_URLS);
if (null != value && Boolean.parseBoolean(value.trim())) {
this.urlRewritingMarker = ";" + getIDName() + "=" + getSessionVersion(); // depends on control dependency: [if], data = [none]
}
value = (String) props.get(PROP_USE_COOKIES);
if (null != value) {
this.enableCookies = Boolean.parseBoolean(value.trim()); // depends on control dependency: [if], data = [none]
}
if (this.enableCookies) {
// we're using cookies for session information
value = (String) props.get(PROP_COOKIE_SECURE); // depends on control dependency: [if], data = [none]
if (null != value) {
this.cookieSecure = Boolean.parseBoolean(value.trim()); // depends on control dependency: [if], data = [none]
}
value = (String) props.get(PROP_COOKIE_PATH); // depends on control dependency: [if], data = [none]
if (null != value) {
this.cookiePath = value.trim(); // depends on control dependency: [if], data = [none]
}
value = (String) props.get(PROP_COOKIE_DOMAIN); // depends on control dependency: [if], data = [none]
if (null != value) {
this.cookieDomain = value.trim(); // depends on control dependency: [if], data = [none]
}
value = (String) props.get(PROP_COOKIE_MAXAGE); // depends on control dependency: [if], data = [none]
if (null != value) {
try {
this.cookieMaxAge = Integer.parseInt(value.trim()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Ignoring incorrect max-age [" + value + "]", nfe.getMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: id name [" + this.idName + "]"); // depends on control dependency: [if], data = [none]
if (isURLRewriting()) {
Tr.event(tc, "Config: use URL rewriting [" + this.urlRewritingMarker + "]"); // depends on control dependency: [if], data = [none]
}
if (this.enableCookies) {
Tr.event(tc, "Config: cookie max-age [" + this.cookieMaxAge + "]"); // depends on control dependency: [if], data = [none]
Tr.event(tc, "Config: cookie secure [" + this.cookieSecure + "]"); // depends on control dependency: [if], data = [none]
Tr.event(tc, "Config: cookie domain [" + this.cookieDomain + "]"); // depends on control dependency: [if], data = [none]
Tr.event(tc, "Config: cookie path [" + this.cookiePath + "]"); // depends on control dependency: [if], data = [none]
} else {
Tr.event(tc, "Config: cookies disabled"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public PassthroughResources passthroughResources() {
if (passthrough.get() == null) {
passthrough.compareAndSet(null, new PassthroughResourcesImpl(this));
}
return passthrough.get();
} }
|
public class class_name {
public PassthroughResources passthroughResources() {
if (passthrough.get() == null) {
passthrough.compareAndSet(null, new PassthroughResourcesImpl(this)); // depends on control dependency: [if], data = [none]
}
return passthrough.get();
} }
|
public class class_name {
private static void setConfigurationFromSystemProperties(Configuration configuration,
PropertyKey[] propertyNames) {
for (PropertyKey propertyName : propertyNames) {
setConfigurationFromSystemProperty(configuration, propertyName.toString());
}
} }
|
public class class_name {
private static void setConfigurationFromSystemProperties(Configuration configuration,
PropertyKey[] propertyNames) {
for (PropertyKey propertyName : propertyNames) {
setConfigurationFromSystemProperty(configuration, propertyName.toString()); // depends on control dependency: [for], data = [propertyName]
}
} }
|
public class class_name {
public void finishSpan() {
TraceState ts = traceState.get();
if (ts != null) {
Span span = ts.popSpan();
if (log.isLoggable(Level.FINEST)) {
log.finest("Finish span = " + span + " trace state = " + ts);
}
span.finish();
if (ts.isFinished()) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Remove trace state = " + ts);
}
traceState.remove();
}
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Finish span requested but no trace state");
}
} }
|
public class class_name {
public void finishSpan() {
TraceState ts = traceState.get();
if (ts != null) {
Span span = ts.popSpan();
if (log.isLoggable(Level.FINEST)) {
log.finest("Finish span = " + span + " trace state = " + ts); // depends on control dependency: [if], data = [none]
}
span.finish(); // depends on control dependency: [if], data = [none]
if (ts.isFinished()) {
if (log.isLoggable(Level.FINEST)) {
log.finest("Remove trace state = " + ts); // depends on control dependency: [if], data = [none]
}
traceState.remove(); // depends on control dependency: [if], data = [none]
}
} else if (log.isLoggable(Level.FINEST)) {
log.finest("Finish span requested but no trace state"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public <T extends IGeneratorParameter<S>, S> S getDefault(Class<T> param) {
if (renderingParameters.containsKey(param.getName())) return getParameter(param).getDefault();
// OK, this parameter is not registered, but that's fine, as we are
// only to return the default value anyway...
try {
return param.newInstance().getDefault();
} catch (InstantiationException exception) {
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
} catch (IllegalAccessException exception) {
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
}
} }
|
public class class_name {
public <T extends IGeneratorParameter<S>, S> S getDefault(Class<T> param) {
if (renderingParameters.containsKey(param.getName())) return getParameter(param).getDefault();
// OK, this parameter is not registered, but that's fine, as we are
// only to return the default value anyway...
try {
return param.newInstance().getDefault(); // depends on control dependency: [try], data = [none]
} catch (InstantiationException exception) {
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
} catch (IllegalAccessException exception) { // depends on control dependency: [catch], data = [none]
throw new IllegalArgumentException("Could not instantiate a default " + param.getClass().getName(),
exception);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponse<WorkItemConfigurationInner>> getDefaultWithServiceResponseAsync(String resourceGroupName, String resourceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getDefault(resourceGroupName, this.client.subscriptionId(), resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WorkItemConfigurationInner>>>() {
@Override
public Observable<ServiceResponse<WorkItemConfigurationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<WorkItemConfigurationInner> result = getDefaultDelegate(response);
ServiceResponse<WorkItemConfigurationInner> clientResponse = new ServiceResponse<WorkItemConfigurationInner>(result.body(), result.response());
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<WorkItemConfigurationInner>> getDefaultWithServiceResponseAsync(String resourceGroupName, String resourceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceName == null) {
throw new IllegalArgumentException("Parameter resourceName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getDefault(resourceGroupName, this.client.subscriptionId(), resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WorkItemConfigurationInner>>>() {
@Override
public Observable<ServiceResponse<WorkItemConfigurationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<WorkItemConfigurationInner> result = getDefaultDelegate(response);
ServiceResponse<WorkItemConfigurationInner> clientResponse = new ServiceResponse<WorkItemConfigurationInner>(result.body(), result.response());
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public int[] getOccurrences() {
int[] res = new int[this.occurrences.size()];
for (int i = 0; i < this.occurrences.size(); i++) {
res[i] = this.occurrences.get(i);
}
return res;
} }
|
public class class_name {
public int[] getOccurrences() {
int[] res = new int[this.occurrences.size()];
for (int i = 0; i < this.occurrences.size(); i++) {
res[i] = this.occurrences.get(i); // depends on control dependency: [for], data = [i]
}
return res;
} }
|
public class class_name {
public static List<String> split(String string, char... separators)
{
if(string == null) {
return null;
}
class ItemsList
{
List<String> list = new ArrayList<String>();
void add(StringBuilder wordBuilder)
{
String value = wordBuilder.toString().trim();
if(!value.isEmpty()) {
list.add(value);
}
}
}
ItemsList itemsList = new ItemsList();
StringBuilder itemBuilder = new StringBuilder();
for(int i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
// append to on building item all characters that are not separators
if(!isSeparator(c, separators)) {
itemBuilder.append(c);
}
// if separator found add item to list and reset builder
if(itemBuilder.length() > 0) {
if(isSeparator(c, separators)) {
itemsList.add(itemBuilder);
itemBuilder.setLength(0);
}
}
}
itemsList.add(itemBuilder);
return itemsList.list;
} }
|
public class class_name {
public static List<String> split(String string, char... separators)
{
if(string == null) {
return null;
// depends on control dependency: [if], data = [none]
}
class ItemsList
{
List<String> list = new ArrayList<String>();
void add(StringBuilder wordBuilder)
{
String value = wordBuilder.toString().trim();
if(!value.isEmpty()) {
list.add(value);
// depends on control dependency: [if], data = [none]
}
}
}
ItemsList itemsList = new ItemsList();
StringBuilder itemBuilder = new StringBuilder();
for(int i = 0; i < string.length(); ++i) {
char c = string.charAt(i);
// append to on building item all characters that are not separators
if(!isSeparator(c, separators)) {
itemBuilder.append(c);
// depends on control dependency: [if], data = [none]
}
// if separator found add item to list and reset builder
if(itemBuilder.length() > 0) {
if(isSeparator(c, separators)) {
itemsList.add(itemBuilder);
// depends on control dependency: [if], data = [none]
itemBuilder.setLength(0);
// depends on control dependency: [if], data = [none]
}
}
}
itemsList.add(itemBuilder);
return itemsList.list;
} }
|
public class class_name {
public void marshall(ListViolationEventsRequest listViolationEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (listViolationEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listViolationEventsRequest.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(listViolationEventsRequest.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(listViolationEventsRequest.getThingName(), THINGNAME_BINDING);
protocolMarshaller.marshall(listViolationEventsRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING);
protocolMarshaller.marshall(listViolationEventsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listViolationEventsRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListViolationEventsRequest listViolationEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (listViolationEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listViolationEventsRequest.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listViolationEventsRequest.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listViolationEventsRequest.getThingName(), THINGNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listViolationEventsRequest.getSecurityProfileName(), SECURITYPROFILENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listViolationEventsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listViolationEventsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void main(final String[] args) {
Switch help = new Switch("h", "help", "display help message");
FileArgument aInputFile = new FileArgument("a", "a-input-file", "A input BED file, default stdin", false);
FileArgument bInputFile = new FileArgument("b", "b-input-file", "B input BED file", true);
FileArgument outputFile = new FileArgument("o", "output-file", "output BED file, default stdout", false);
StringArgument strategy = new StringArgument("s", "strategy", "strategy { range-list, range-set, centered-range-tree, r-tree, r-star-tree }, default range-set", false);
ArgumentList arguments = new ArgumentList(help, aInputFile, bInputFile, outputFile, strategy);
CommandLine commandLine = new CommandLine(args);
IntersectBed intersectBed = null;
try
{
CommandLineParser.parse(commandLine, arguments);
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
intersectBed = new IntersectBed(aInputFile.getValue(), bInputFile.getValue(), outputFile.getValue(), strategies.get(strategy.getValue(DEFAULT_STRATEGY)));
}
catch (CommandLineParseException | NullPointerException e) {
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(intersectBed.call());
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
} }
|
public class class_name {
public static void main(final String[] args) {
Switch help = new Switch("h", "help", "display help message");
FileArgument aInputFile = new FileArgument("a", "a-input-file", "A input BED file, default stdin", false);
FileArgument bInputFile = new FileArgument("b", "b-input-file", "B input BED file", true);
FileArgument outputFile = new FileArgument("o", "output-file", "output BED file, default stdout", false);
StringArgument strategy = new StringArgument("s", "strategy", "strategy { range-list, range-set, centered-range-tree, r-tree, r-star-tree }, default range-set", false);
ArgumentList arguments = new ArgumentList(help, aInputFile, bInputFile, outputFile, strategy);
CommandLine commandLine = new CommandLine(args);
IntersectBed intersectBed = null;
try
{
CommandLineParser.parse(commandLine, arguments); // depends on control dependency: [try], data = [none]
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out); // depends on control dependency: [if], data = [none]
System.exit(0); // depends on control dependency: [if], data = [none]
}
intersectBed = new IntersectBed(aInputFile.getValue(), bInputFile.getValue(), outputFile.getValue(), strategies.get(strategy.getValue(DEFAULT_STRATEGY))); // depends on control dependency: [try], data = [none]
}
catch (CommandLineParseException | NullPointerException e) {
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out); // depends on control dependency: [if], data = [none]
System.exit(0); // depends on control dependency: [if], data = [none]
}
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
try {
System.exit(intersectBed.call()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
e.printStackTrace();
System.exit(1);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void fireAction(ActionListener action) {
int modifiers = 0;
AWTEvent currentEvent = EventQueue.getCurrentEvent();
if (currentEvent instanceof InputEvent) {
modifiers = ((InputEvent) currentEvent).getModifiers();
} else if (currentEvent instanceof ActionEvent) {
modifiers = ((ActionEvent) currentEvent).getModifiers();
}
ActionEvent e = new ActionEvent(getComponent(), ActionEvent.ACTION_PERFORMED, getComponent().getText(),
EventQueue.getMostRecentEventTime(), modifiers);
action.actionPerformed(e);
} }
|
public class class_name {
protected void fireAction(ActionListener action) {
int modifiers = 0;
AWTEvent currentEvent = EventQueue.getCurrentEvent();
if (currentEvent instanceof InputEvent) {
modifiers = ((InputEvent) currentEvent).getModifiers(); // depends on control dependency: [if], data = [none]
} else if (currentEvent instanceof ActionEvent) {
modifiers = ((ActionEvent) currentEvent).getModifiers(); // depends on control dependency: [if], data = [none]
}
ActionEvent e = new ActionEvent(getComponent(), ActionEvent.ACTION_PERFORMED, getComponent().getText(),
EventQueue.getMostRecentEventTime(), modifiers);
action.actionPerformed(e);
} }
|
public class class_name {
@Override
public String sendAlignmentRequest(String query, RemotePairwiseAlignmentProperties alignmentProperties) throws Exception {
Map<String, String> params = new HashMap<String, String>();
for (String key : alignmentProperties.getAlignmentOptions()) {
params.put(key, alignmentProperties.getAlignmentOption(key));
}
if (query == null || query.isEmpty()) {
throw new IllegalArgumentException("Impossible to execute QBlast request. The sequence has not been set.");
}
if (!params.containsKey(PROGRAM.name())) {
throw new IllegalArgumentException("Impossible to execute QBlast request. Parameter PROGRAM has not been set.");
}
if (!params.containsKey(DATABASE.name())) {
throw new IllegalArgumentException("Impossible to execute QBlast request. Parameter DATABASE has not been set.");
}
params.put(CMD.name(), "Put");
params.put(QUERY.name(), query);
params.put(TOOL.name(), getTool());
params.put(EMAIL.name(), getEmail());
String putCmd = MAP_TO_STRING_TRANSFORMER.transform(params);
OutputStreamWriter writer = null;
BufferedReader reader = null;
try {
URLConnection serviceConnection = setQBlastServiceProperties(serviceUrl.openConnection());
writer = new OutputStreamWriter(serviceConnection.getOutputStream());
writer.write(putCmd);
writer.flush();
// Get the response
reader = new BufferedReader(new InputStreamReader(serviceConnection.getInputStream()));
// find request id and time of execution
BlastJob job = new BlastJob();
String line;
while ((line = reader.readLine()) != null) {
if (!line.contains("class=\"error\"") && !line.contains("Message ID#")) {
// if there is no error, capture RID and RTOE
if (line.contains("RID = ")) {
String[] arr = line.split("=");
job.setId(arr[1].trim());
} else if (line.contains("RTOE = ")) {
String[] arr = line.split("=");
job.setStartTimestamp(System.currentTimeMillis());
job.setExpectedExecutionTime(Long.parseLong(arr[1].trim()) * 1000);
}
jobs.put(job.getId(), job);
} else {
// handle QBlast error message
// Capture everything to the left of this HTML statement...
String[] tmp = line.split("</p></li></ul>");
// Only the error message is on the right side of this...
String[] moreTmp = tmp[0].split("<p class=\"error\">");
throw new Exception("NCBI QBlast refused this request because: " + moreTmp[1].trim());
}
}
if (job != null && job.getId() != null) {
return job.getId();
} else {
throw new Exception("Unable to retrieve request ID");
}
} catch (IOException e) {
throw new IOException("An error occured submiting sequence to BLAST server. Cause: " + e.getMessage(), e);
} finally {
IOUtils.close(reader);
IOUtils.close(writer);
}
} }
|
public class class_name {
@Override
public String sendAlignmentRequest(String query, RemotePairwiseAlignmentProperties alignmentProperties) throws Exception {
Map<String, String> params = new HashMap<String, String>();
for (String key : alignmentProperties.getAlignmentOptions()) {
params.put(key, alignmentProperties.getAlignmentOption(key));
}
if (query == null || query.isEmpty()) {
throw new IllegalArgumentException("Impossible to execute QBlast request. The sequence has not been set.");
}
if (!params.containsKey(PROGRAM.name())) {
throw new IllegalArgumentException("Impossible to execute QBlast request. Parameter PROGRAM has not been set.");
}
if (!params.containsKey(DATABASE.name())) {
throw new IllegalArgumentException("Impossible to execute QBlast request. Parameter DATABASE has not been set.");
}
params.put(CMD.name(), "Put");
params.put(QUERY.name(), query);
params.put(TOOL.name(), getTool());
params.put(EMAIL.name(), getEmail());
String putCmd = MAP_TO_STRING_TRANSFORMER.transform(params);
OutputStreamWriter writer = null;
BufferedReader reader = null;
try {
URLConnection serviceConnection = setQBlastServiceProperties(serviceUrl.openConnection());
writer = new OutputStreamWriter(serviceConnection.getOutputStream());
writer.write(putCmd);
writer.flush();
// Get the response
reader = new BufferedReader(new InputStreamReader(serviceConnection.getInputStream()));
// find request id and time of execution
BlastJob job = new BlastJob();
String line;
while ((line = reader.readLine()) != null) {
if (!line.contains("class=\"error\"") && !line.contains("Message ID#")) {
// if there is no error, capture RID and RTOE
if (line.contains("RID = ")) {
String[] arr = line.split("=");
job.setId(arr[1].trim()); // depends on control dependency: [if], data = [none]
} else if (line.contains("RTOE = ")) {
String[] arr = line.split("=");
job.setStartTimestamp(System.currentTimeMillis()); // depends on control dependency: [if], data = [none]
job.setExpectedExecutionTime(Long.parseLong(arr[1].trim()) * 1000); // depends on control dependency: [if], data = [none]
}
jobs.put(job.getId(), job); // depends on control dependency: [if], data = [none]
} else {
// handle QBlast error message
// Capture everything to the left of this HTML statement...
String[] tmp = line.split("</p></li></ul>");
// Only the error message is on the right side of this...
String[] moreTmp = tmp[0].split("<p class=\"error\">");
throw new Exception("NCBI QBlast refused this request because: " + moreTmp[1].trim());
}
}
if (job != null && job.getId() != null) {
return job.getId(); // depends on control dependency: [if], data = [none]
} else {
throw new Exception("Unable to retrieve request ID");
}
} catch (IOException e) {
throw new IOException("An error occured submiting sequence to BLAST server. Cause: " + e.getMessage(), e);
} finally {
IOUtils.close(reader);
IOUtils.close(writer);
}
} }
|
public class class_name {
public FileScanner setSearchTypes(String... srTypes) {
if (srTypes == null || srTypes.length == 0) {
this.srTypes = new String[0];
} else {
this.srTypes = srTypes;
}
return this;
} }
|
public class class_name {
public FileScanner setSearchTypes(String... srTypes) {
if (srTypes == null || srTypes.length == 0) {
this.srTypes = new String[0]; // depends on control dependency: [if], data = [none]
} else {
this.srTypes = srTypes; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
protected void sendErrorIfSender(Throwable throwable) {
if (!getSender().equals(ActorRef.noSender())) {
getSender().tell(new Status.Failure(throwable), getSelf());
}
} }
|
public class class_name {
protected void sendErrorIfSender(Throwable throwable) {
if (!getSender().equals(ActorRef.noSender())) {
getSender().tell(new Status.Failure(throwable), getSelf()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void sendMembershipList(LocalGossipMember me, List<LocalGossipMember> memberList) {
GossipService.LOGGER.debug("Send sendMembershipList() is called.");
me.setHeartbeat(System.currentTimeMillis());
LocalGossipMember member = selectPartner(memberList);
if (member == null) {
return;
}
try (DatagramSocket socket = new DatagramSocket()) {
socket.setSoTimeout(gossipManager.getSettings().getGossipInterval());
InetAddress dest = InetAddress.getByName(member.getHost());
ActiveGossipMessage message = new ActiveGossipMessage();
message.getMembers().add(convert(me));
for (LocalGossipMember other : memberList) {
message.getMembers().add(convert(other));
}
byte[] json_bytes = om.writeValueAsString(message).getBytes();
int packet_length = json_bytes.length;
if (packet_length < GossipManager.MAX_PACKET_SIZE) {
byte[] buf = createBuffer(packet_length, json_bytes);
DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length, dest, member.getPort());
socket.send(datagramPacket);
} else {
GossipService.LOGGER.error("The length of the to be send message is too large ("
+ packet_length + " > " + GossipManager.MAX_PACKET_SIZE + ").");
}
} catch (IOException e1) {
GossipService.LOGGER.warn(e1);
}
} }
|
public class class_name {
protected void sendMembershipList(LocalGossipMember me, List<LocalGossipMember> memberList) {
GossipService.LOGGER.debug("Send sendMembershipList() is called.");
me.setHeartbeat(System.currentTimeMillis());
LocalGossipMember member = selectPartner(memberList);
if (member == null) {
return; // depends on control dependency: [if], data = [none]
}
try (DatagramSocket socket = new DatagramSocket()) {
socket.setSoTimeout(gossipManager.getSettings().getGossipInterval());
InetAddress dest = InetAddress.getByName(member.getHost());
ActiveGossipMessage message = new ActiveGossipMessage();
message.getMembers().add(convert(me));
for (LocalGossipMember other : memberList) {
message.getMembers().add(convert(other)); // depends on control dependency: [for], data = [other]
}
byte[] json_bytes = om.writeValueAsString(message).getBytes();
int packet_length = json_bytes.length;
if (packet_length < GossipManager.MAX_PACKET_SIZE) {
byte[] buf = createBuffer(packet_length, json_bytes);
DatagramPacket datagramPacket = new DatagramPacket(buf, buf.length, dest, member.getPort());
socket.send(datagramPacket); // depends on control dependency: [if], data = [none]
} else {
GossipService.LOGGER.error("The length of the to be send message is too large ("
+ packet_length + " > " + GossipManager.MAX_PACKET_SIZE + ")."); // depends on control dependency: [if], data = [none]
}
} catch (IOException e1) {
GossipService.LOGGER.warn(e1);
}
} }
|
public class class_name {
public void marshall(RdsHttpEndpointConfig rdsHttpEndpointConfig, ProtocolMarshaller protocolMarshaller) {
if (rdsHttpEndpointConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(rdsHttpEndpointConfig.getAwsRegion(), AWSREGION_BINDING);
protocolMarshaller.marshall(rdsHttpEndpointConfig.getDbClusterIdentifier(), DBCLUSTERIDENTIFIER_BINDING);
protocolMarshaller.marshall(rdsHttpEndpointConfig.getDatabaseName(), DATABASENAME_BINDING);
protocolMarshaller.marshall(rdsHttpEndpointConfig.getSchema(), SCHEMA_BINDING);
protocolMarshaller.marshall(rdsHttpEndpointConfig.getAwsSecretStoreArn(), AWSSECRETSTOREARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RdsHttpEndpointConfig rdsHttpEndpointConfig, ProtocolMarshaller protocolMarshaller) {
if (rdsHttpEndpointConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(rdsHttpEndpointConfig.getAwsRegion(), AWSREGION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(rdsHttpEndpointConfig.getDbClusterIdentifier(), DBCLUSTERIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(rdsHttpEndpointConfig.getDatabaseName(), DATABASENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(rdsHttpEndpointConfig.getSchema(), SCHEMA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(rdsHttpEndpointConfig.getAwsSecretStoreArn(), AWSSECRETSTOREARN_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 EClass getIfcReal() {
if (ifcRealEClass == null) {
ifcRealEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(729);
}
return ifcRealEClass;
} }
|
public class class_name {
public EClass getIfcReal() {
if (ifcRealEClass == null) {
ifcRealEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers()
.get(729);
// depends on control dependency: [if], data = [none]
}
return ifcRealEClass;
} }
|
public class class_name {
@Override
@InterfaceAudience.Public
public Map<String, Object> getProperties() {
Map<String, Object> properties = revisionInternal.getProperties();
if (!checkedProperties) {
if (properties == null) {
if (loadProperties() == true) {
properties = revisionInternal.getProperties();
}
}
checkedProperties = true;
}
return properties != null ? Collections.unmodifiableMap(properties) : null;
} }
|
public class class_name {
@Override
@InterfaceAudience.Public
public Map<String, Object> getProperties() {
Map<String, Object> properties = revisionInternal.getProperties();
if (!checkedProperties) {
if (properties == null) {
if (loadProperties() == true) {
properties = revisionInternal.getProperties(); // depends on control dependency: [if], data = [none]
}
}
checkedProperties = true; // depends on control dependency: [if], data = [none]
}
return properties != null ? Collections.unmodifiableMap(properties) : null;
} }
|
public class class_name {
public ListStepsRequest withStepIds(String... stepIds) {
if (this.stepIds == null) {
setStepIds(new com.amazonaws.internal.SdkInternalList<String>(stepIds.length));
}
for (String ele : stepIds) {
this.stepIds.add(ele);
}
return this;
} }
|
public class class_name {
public ListStepsRequest withStepIds(String... stepIds) {
if (this.stepIds == null) {
setStepIds(new com.amazonaws.internal.SdkInternalList<String>(stepIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : stepIds) {
this.stepIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public String[] readNext() throws IOException {
String[] result = null;
do {
String nextLine = getNextLine();
if (!hasNext) {
return validateResult(result);
}
String[] r = parser.parseLineMulti(nextLine);
if (r.length > 0) {
if (result == null) {
result = r;
} else {
result = combineResultsFromMultipleReads(result, r);
}
}
} while (parser.isPending());
return validateResult(result);
} }
|
public class class_name {
public String[] readNext() throws IOException {
String[] result = null;
do {
String nextLine = getNextLine();
if (!hasNext) {
return validateResult(result); // depends on control dependency: [if], data = [none]
}
String[] r = parser.parseLineMulti(nextLine);
if (r.length > 0) {
if (result == null) {
result = r; // depends on control dependency: [if], data = [none]
} else {
result = combineResultsFromMultipleReads(result, r); // depends on control dependency: [if], data = [(result]
}
}
} while (parser.isPending());
return validateResult(result);
} }
|
public class class_name {
public TableModel toDistinctValuesTableModel(InputColumn<?> inputColumnOfInterest) {
final Map<Object, Integer> valueCounts;
final RowAnnotationFactory annotationFactory = _annotationFactoryRef.get();
if (annotationFactory == null) {
valueCounts = Collections.emptyMap();
} else {
valueCounts = annotationFactory.getValueCounts(getAnnotation(), inputColumnOfInterest);
}
DefaultTableModel tableModel = new DefaultTableModel(new String[] { inputColumnOfInterest.getName(),
"Count in dataset" }, valueCounts.size());
// sort the set
TreeSet<Entry<Object, Integer>> set = new TreeSet<Entry<Object, Integer>>(
new Comparator<Entry<Object, Integer>>() {
@Override
public int compare(Entry<Object, Integer> o1, Entry<Object, Integer> o2) {
int countDiff = o2.getValue().intValue() - o1.getValue().intValue();
if (countDiff == 0) {
return -1;
}
return countDiff;
}
});
set.addAll(valueCounts.entrySet());
int i = 0;
for (Entry<Object, Integer> entry : set) {
tableModel.setValueAt(entry.getKey(), i, 0);
tableModel.setValueAt(entry.getValue(), i, 1);
i++;
}
return tableModel;
} }
|
public class class_name {
public TableModel toDistinctValuesTableModel(InputColumn<?> inputColumnOfInterest) {
final Map<Object, Integer> valueCounts;
final RowAnnotationFactory annotationFactory = _annotationFactoryRef.get();
if (annotationFactory == null) {
valueCounts = Collections.emptyMap(); // depends on control dependency: [if], data = [none]
} else {
valueCounts = annotationFactory.getValueCounts(getAnnotation(), inputColumnOfInterest); // depends on control dependency: [if], data = [none]
}
DefaultTableModel tableModel = new DefaultTableModel(new String[] { inputColumnOfInterest.getName(),
"Count in dataset" }, valueCounts.size());
// sort the set
TreeSet<Entry<Object, Integer>> set = new TreeSet<Entry<Object, Integer>>(
new Comparator<Entry<Object, Integer>>() {
@Override
public int compare(Entry<Object, Integer> o1, Entry<Object, Integer> o2) {
int countDiff = o2.getValue().intValue() - o1.getValue().intValue();
if (countDiff == 0) {
return -1; // depends on control dependency: [if], data = [none]
}
return countDiff;
}
});
set.addAll(valueCounts.entrySet());
int i = 0;
for (Entry<Object, Integer> entry : set) {
tableModel.setValueAt(entry.getKey(), i, 0); // depends on control dependency: [for], data = [entry]
tableModel.setValueAt(entry.getValue(), i, 1); // depends on control dependency: [for], data = [entry]
i++; // depends on control dependency: [for], data = [none]
}
return tableModel;
} }
|
public class class_name {
private ResourceException closeHandles() {
ResourceException firstX = null;
Object conn = null;
// Indicate that we are cleaning up handles, so we know not to send events for
// operations done in the cleanup.
cleaningUpHandles = true;
for (int i = numHandlesInUse; i > 0;)
{
conn = handlesInUse[--i];
handlesInUse[i] = null;
try {
((WSJdbcConnection) conn).close();
} catch (SQLException closeX) {
FFDCFilter.processException(closeX,
getClass().getName() + ".closeHandles", "1414", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc,
"Error closing handle. Continuing...", conn);
ResourceException resX = new DataStoreAdapterException(
"DSA_ERROR", closeX, getClass());
if (firstX == null)
firstX = resX;
}
}
numHandlesInUse = 0;
cleaningUpHandles = false;
return firstX;
} }
|
public class class_name {
private ResourceException closeHandles() {
ResourceException firstX = null;
Object conn = null;
// Indicate that we are cleaning up handles, so we know not to send events for
// operations done in the cleanup.
cleaningUpHandles = true;
for (int i = numHandlesInUse; i > 0;)
{
conn = handlesInUse[--i]; // depends on control dependency: [for], data = [i]
handlesInUse[i] = null; // depends on control dependency: [for], data = [i]
try {
((WSJdbcConnection) conn).close(); // depends on control dependency: [try], data = [none]
} catch (SQLException closeX) {
FFDCFilter.processException(closeX,
getClass().getName() + ".closeHandles", "1414", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
Tr.event(this, tc,
"Error closing handle. Continuing...", conn);
ResourceException resX = new DataStoreAdapterException(
"DSA_ERROR", closeX, getClass());
if (firstX == null)
firstX = resX;
} // depends on control dependency: [catch], data = [none]
}
numHandlesInUse = 0;
cleaningUpHandles = false;
return firstX;
} }
|
public class class_name {
public void showErrors(final Set<String> messages) {
final InputElement inputElement = this.getInputElement();
if (messages.isEmpty()) {
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(StringUtils.EMPTY);
}
if (this.validationMessageElement == null) {
inputElement.setTitle(StringUtils.EMPTY);
} else {
this.validationMessageElement.getElement().removeAllChildren();
}
} else {
final String messagesAsString = ErrorMessageFormater.messagesToString(messages);
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(messagesAsString);
}
if (this.validationMessageElement == null) {
inputElement.setTitle(messagesAsString);
} else {
this.validationMessageElement.getElement()
.setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages));
}
}
} }
|
public class class_name {
public void showErrors(final Set<String> messages) {
final InputElement inputElement = this.getInputElement();
if (messages.isEmpty()) {
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(StringUtils.EMPTY); // depends on control dependency: [if], data = [none]
}
if (this.validationMessageElement == null) {
inputElement.setTitle(StringUtils.EMPTY); // depends on control dependency: [if], data = [none]
} else {
this.validationMessageElement.getElement().removeAllChildren(); // depends on control dependency: [if], data = [none]
}
} else {
final String messagesAsString = ErrorMessageFormater.messagesToString(messages);
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(messagesAsString); // depends on control dependency: [if], data = [none]
}
if (this.validationMessageElement == null) {
inputElement.setTitle(messagesAsString); // depends on control dependency: [if], data = [none]
} else {
this.validationMessageElement.getElement()
.setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setResultValue(String actionId, Object resultValue) {
if (actionId == null || !actionId.contains(ActivityContext.ID_SEPARATOR)) {
this.actionId = actionId;
this.resultValue = resultValue;
} else {
String[] ids = StringUtils.tokenize(actionId, ActivityContext.ID_SEPARATOR, true);
if (ids.length == 1) {
this.actionId = null;
this.resultValue = resultValue;
} else if (ids.length == 2) {
ResultValueMap resultValueMap = new ResultValueMap();
resultValueMap.put(ids[1], resultValue);
this.actionId = ids[0];
this.resultValue = resultValueMap;
} else {
ResultValueMap resultValueMap = new ResultValueMap();
for (int i = 1; i < ids.length - 1; i++) {
ResultValueMap resultValueMap2 = new ResultValueMap();
resultValueMap.put(ids[i], resultValueMap2);
resultValueMap = resultValueMap2;
}
resultValueMap.put(ids[ids.length - 1], resultValue);
this.actionId = actionId;
this.resultValue = resultValueMap;
}
}
} }
|
public class class_name {
public void setResultValue(String actionId, Object resultValue) {
if (actionId == null || !actionId.contains(ActivityContext.ID_SEPARATOR)) {
this.actionId = actionId; // depends on control dependency: [if], data = [none]
this.resultValue = resultValue; // depends on control dependency: [if], data = [none]
} else {
String[] ids = StringUtils.tokenize(actionId, ActivityContext.ID_SEPARATOR, true);
if (ids.length == 1) {
this.actionId = null; // depends on control dependency: [if], data = [none]
this.resultValue = resultValue; // depends on control dependency: [if], data = [none]
} else if (ids.length == 2) {
ResultValueMap resultValueMap = new ResultValueMap();
resultValueMap.put(ids[1], resultValue); // depends on control dependency: [if], data = [none]
this.actionId = ids[0]; // depends on control dependency: [if], data = [none]
this.resultValue = resultValueMap; // depends on control dependency: [if], data = [none]
} else {
ResultValueMap resultValueMap = new ResultValueMap();
for (int i = 1; i < ids.length - 1; i++) {
ResultValueMap resultValueMap2 = new ResultValueMap();
resultValueMap.put(ids[i], resultValueMap2); // depends on control dependency: [for], data = [i]
resultValueMap = resultValueMap2; // depends on control dependency: [for], data = [none]
}
resultValueMap.put(ids[ids.length - 1], resultValue); // depends on control dependency: [if], data = [none]
this.actionId = actionId; // depends on control dependency: [if], data = [none]
this.resultValue = resultValueMap; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
static @NotNull Resource get(String path, ResourceResolver resolver) {
Resource resource = resolver.getResource(path);
if (resource != null) {
return resource;
}
return new SyntheticNavigatableResource(path, resolver);
} }
|
public class class_name {
static @NotNull Resource get(String path, ResourceResolver resolver) {
Resource resource = resolver.getResource(path);
if (resource != null) {
return resource; // depends on control dependency: [if], data = [none]
}
return new SyntheticNavigatableResource(path, resolver);
} }
|
public class class_name {
public static void removeVirtualTokenizationUsingNamespace(SDocumentGraph graph)
{
if(graph.getTimeline() != null)
{
// do nothing if the graph does not contain any virtual tokenization
return;
}
TimelineReconstructor reconstructor = new TimelineReconstructor(graph, true);
reconstructor.addTimeline();
reconstructor.createTokenFromSOrder();
reconstructor.cleanup();
} }
|
public class class_name {
public static void removeVirtualTokenizationUsingNamespace(SDocumentGraph graph)
{
if(graph.getTimeline() != null)
{
// do nothing if the graph does not contain any virtual tokenization
return; // depends on control dependency: [if], data = [none]
}
TimelineReconstructor reconstructor = new TimelineReconstructor(graph, true);
reconstructor.addTimeline();
reconstructor.createTokenFromSOrder();
reconstructor.cleanup();
} }
|
public class class_name {
private DeepPartition[] calculateShardChunks(DBCollection collection) {
DBCursor chuncks = getChunks(collection);
Map<String, String[]> shards = getShards(collection);
MongoPartition[] deepPartitions = new MongoPartition[chuncks.count()];
int i = 0;
boolean keyAssigned = false;
String key = null;
while (chuncks.hasNext()) {
DBObject dbObject = chuncks.next();
if (!keyAssigned) {
Set<String> keySet = ((DBObject) dbObject.get("min")).keySet();
for (String s : keySet) {
key = s;
keyAssigned = true;
}
}
deepPartitions[i] = new MongoPartition(mongoDeepJobConfig.getRddId(), i,
new DeepTokenRange(shards.get(dbObject.get
("shard")),
((DBObject) dbObject.get
("min")).get(key),
((DBObject) dbObject.get("max")).get(key)), key);
i++;
}
List<MongoPartition> mongoPartitions = Arrays.asList(deepPartitions);
Collections.shuffle(mongoPartitions);
return mongoPartitions.toArray(new MongoPartition[mongoPartitions.size()]);
} }
|
public class class_name {
private DeepPartition[] calculateShardChunks(DBCollection collection) {
DBCursor chuncks = getChunks(collection);
Map<String, String[]> shards = getShards(collection);
MongoPartition[] deepPartitions = new MongoPartition[chuncks.count()];
int i = 0;
boolean keyAssigned = false;
String key = null;
while (chuncks.hasNext()) {
DBObject dbObject = chuncks.next();
if (!keyAssigned) {
Set<String> keySet = ((DBObject) dbObject.get("min")).keySet();
for (String s : keySet) {
key = s; // depends on control dependency: [for], data = [s]
keyAssigned = true; // depends on control dependency: [for], data = [s]
}
}
deepPartitions[i] = new MongoPartition(mongoDeepJobConfig.getRddId(), i,
new DeepTokenRange(shards.get(dbObject.get
("shard")),
((DBObject) dbObject.get
("min")).get(key),
((DBObject) dbObject.get("max")).get(key)), key); // depends on control dependency: [while], data = [none]
i++; // depends on control dependency: [while], data = [none]
}
List<MongoPartition> mongoPartitions = Arrays.asList(deepPartitions);
Collections.shuffle(mongoPartitions);
return mongoPartitions.toArray(new MongoPartition[mongoPartitions.size()]);
} }
|
public class class_name {
public void marshall(UpdateIntegrationResponseRequest updateIntegrationResponseRequest, ProtocolMarshaller protocolMarshaller) {
if (updateIntegrationResponseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateIntegrationResponseRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getContentHandlingStrategy(), CONTENTHANDLINGSTRATEGY_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationId(), INTEGRATIONID_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationResponseId(), INTEGRATIONRESPONSEID_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationResponseKey(), INTEGRATIONRESPONSEKEY_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getResponseParameters(), RESPONSEPARAMETERS_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getResponseTemplates(), RESPONSETEMPLATES_BINDING);
protocolMarshaller.marshall(updateIntegrationResponseRequest.getTemplateSelectionExpression(), TEMPLATESELECTIONEXPRESSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateIntegrationResponseRequest updateIntegrationResponseRequest, ProtocolMarshaller protocolMarshaller) {
if (updateIntegrationResponseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateIntegrationResponseRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getContentHandlingStrategy(), CONTENTHANDLINGSTRATEGY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationId(), INTEGRATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationResponseId(), INTEGRATIONRESPONSEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getIntegrationResponseKey(), INTEGRATIONRESPONSEKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getResponseParameters(), RESPONSEPARAMETERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getResponseTemplates(), RESPONSETEMPLATES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateIntegrationResponseRequest.getTemplateSelectionExpression(), TEMPLATESELECTIONEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean isValidUserAgent(final String agent) {
if (!validateUserAgent) {
return true;
}
final Matcher matcher = AGENT_PATTERN.matcher(agent);
return matcher.matches();
} }
|
public class class_name {
public boolean isValidUserAgent(final String agent) {
if (!validateUserAgent) {
return true; // depends on control dependency: [if], data = [none]
}
final Matcher matcher = AGENT_PATTERN.matcher(agent);
return matcher.matches();
} }
|
public class class_name {
@Override
public void visitMethod(Method obj) {
Attribute[] attributes = obj.getAttributes();
for (Attribute a : attributes) {
if ("Signature".equals(a.getName())) {
TemplateSignature ts = parseSignatureAttribute((Signature) a);
if (ts != null) {
for (TemplateItem templateParm : ts.templateParameters) {
if (!ts.signature.contains(Values.SIG_GENERIC_TEMPLATE + templateParm.templateType + Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR)
&& !isTemplateParent(templateParm.templateType, ts.templateParameters)) {
bugReporter.reportBug(new BugInstance(this, BugType.UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addString("Template Parameter: " + templateParm.templateType));
return;
}
}
}
return;
}
}
} }
|
public class class_name {
@Override
public void visitMethod(Method obj) {
Attribute[] attributes = obj.getAttributes();
for (Attribute a : attributes) {
if ("Signature".equals(a.getName())) {
TemplateSignature ts = parseSignatureAttribute((Signature) a);
if (ts != null) {
for (TemplateItem templateParm : ts.templateParameters) {
if (!ts.signature.contains(Values.SIG_GENERIC_TEMPLATE + templateParm.templateType + Values.SIG_QUALIFIED_CLASS_SUFFIX_CHAR)
&& !isTemplateParent(templateParm.templateType, ts.templateParameters)) {
bugReporter.reportBug(new BugInstance(this, BugType.UMTP_UNBOUND_METHOD_TEMPLATE_PARAMETER.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this).addString("Template Parameter: " + templateParm.templateType)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
}
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static IntList from(Collection<Integer> c) {
if (N.isNullOrEmpty(c)) {
return new IntList();
}
return from(c, 0);
} }
|
public class class_name {
public static IntList from(Collection<Integer> c) {
if (N.isNullOrEmpty(c)) {
return new IntList();
// depends on control dependency: [if], data = [none]
}
return from(c, 0);
} }
|
public class class_name {
@Override
public Optional<String> getLogin() {
return getAuthentication().map(auth -> {
Object principal = auth.getPrincipal();
if (principal instanceof UserDetails) {
UserDetails springSecurityUser = UserDetails.class.cast(principal);
return springSecurityUser.getUsername();
} else if (principal instanceof String) {
return (String) principal;
}
return null;
});
} }
|
public class class_name {
@Override
public Optional<String> getLogin() {
return getAuthentication().map(auth -> {
Object principal = auth.getPrincipal();
if (principal instanceof UserDetails) {
UserDetails springSecurityUser = UserDetails.class.cast(principal);
return springSecurityUser.getUsername(); // depends on control dependency: [if], data = [none]
} else if (principal instanceof String) {
return (String) principal; // depends on control dependency: [if], data = [none]
}
return null;
});
} }
|
public class class_name {
private String printPDBConnections(){
StringBuilder str = new StringBuilder();
for (Chain c:structure.getChains()) {
for (Group g:c.getAtomGroups()) {
for (Atom a:g.getAtoms()) {
if (a.getBonds()!=null) {
for (Bond b:a.getBonds()) { //7890123456789012345678901234567890123456789012345678901234567890
str.append(String.format("CONECT%5d%5d "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial()));
}
}
}
}
}
return str.toString();
} }
|
public class class_name {
private String printPDBConnections(){
StringBuilder str = new StringBuilder();
for (Chain c:structure.getChains()) {
for (Group g:c.getAtomGroups()) {
for (Atom a:g.getAtoms()) {
if (a.getBonds()!=null) {
for (Bond b:a.getBonds()) { //7890123456789012345678901234567890123456789012345678901234567890
str.append(String.format("CONECT%5d%5d "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial())); // depends on control dependency: [for], data = [b]
}
}
}
}
}
return str.toString();
} }
|
public class class_name {
private static boolean isValidAddress(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false;
}
String name = address.getHostAddress();
return (name != null
&& !isAnyHost(name)
&& !isLocalHost(name)
&& isIPv4Host(name));
} }
|
public class class_name {
private static boolean isValidAddress(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false; // depends on control dependency: [if], data = [none]
}
String name = address.getHostAddress();
return (name != null
&& !isAnyHost(name)
&& !isLocalHost(name)
&& isIPv4Host(name));
} }
|
public class class_name {
@Override
public boolean isAllowed(int code, long vendorId) {
AvpRepresentation avpRep = new AvpRepresentationImpl(code, vendorId);
avpRep = this.unmuttableMessageAvps.get(avpRep);
if (avpRep == null) {
return true;
}
return avpRep.isAllowed();
} }
|
public class class_name {
@Override
public boolean isAllowed(int code, long vendorId) {
AvpRepresentation avpRep = new AvpRepresentationImpl(code, vendorId);
avpRep = this.unmuttableMessageAvps.get(avpRep);
if (avpRep == null) {
return true;
// depends on control dependency: [if], data = [none]
}
return avpRep.isAllowed();
} }
|
public class class_name {
private int getNumOfLenBytes(int len) {
int numOfLenBytes = 0;
if (len < 128) {
numOfLenBytes = 1;
} else if (len < (1 << 8)) {
numOfLenBytes = 2;
} else if (len < (1 << 16)) {
numOfLenBytes = 3;
} else if (len < (1 << 24)) {
numOfLenBytes = 4;
} else {
numOfLenBytes = 5;
}
return numOfLenBytes;
} }
|
public class class_name {
private int getNumOfLenBytes(int len) {
int numOfLenBytes = 0;
if (len < 128) {
numOfLenBytes = 1; // depends on control dependency: [if], data = [none]
} else if (len < (1 << 8)) {
numOfLenBytes = 2; // depends on control dependency: [if], data = [none]
} else if (len < (1 << 16)) {
numOfLenBytes = 3; // depends on control dependency: [if], data = [none]
} else if (len < (1 << 24)) {
numOfLenBytes = 4; // depends on control dependency: [if], data = [none]
} else {
numOfLenBytes = 5; // depends on control dependency: [if], data = [none]
}
return numOfLenBytes;
} }
|
public class class_name {
private void addChangeListener(JavaScriptObject changeListener, String changeScope) {
try {
System.out.println("Adding native listener for scope " + changeScope);
m_entityObserver.addEntityChangeListener(new CmsEntityChangeListenerWrapper(changeListener), changeScope);
} catch (Exception e) {
CmsDebugLog.getInstance().printLine("Exception occured during listener registration" + e.getMessage());
}
} }
|
public class class_name {
private void addChangeListener(JavaScriptObject changeListener, String changeScope) {
try {
System.out.println("Adding native listener for scope " + changeScope);
// depends on control dependency: [try], data = [none]
m_entityObserver.addEntityChangeListener(new CmsEntityChangeListenerWrapper(changeListener), changeScope);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
CmsDebugLog.getInstance().printLine("Exception occured during listener registration" + e.getMessage());
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void putLong(int pos, long l) {
adaptSize(pos + 8);
ByteBuffer bb = getBuffer(pos);
int index = pos % _bufferSize;
if (bb.limit() - index >= 8) {
bb.putLong(index, l);
} else {
byte b0 = (byte)l;
byte b1 = (byte)(l >> 8);
byte b2 = (byte)(l >> 16);
byte b3 = (byte)(l >> 24);
byte b4 = (byte)(l >> 32);
byte b5 = (byte)(l >> 40);
byte b6 = (byte)(l >> 48);
byte b7 = (byte)(l >> 56);
if (_order == ByteOrder.BIG_ENDIAN) {
putBytes(pos, b7, b6, b5, b4, b3, b2, b1, b0);
} else {
putBytes(pos, b0, b1, b2, b3, b4, b5, b6, b7);
}
}
} }
|
public class class_name {
public void putLong(int pos, long l) {
adaptSize(pos + 8);
ByteBuffer bb = getBuffer(pos);
int index = pos % _bufferSize;
if (bb.limit() - index >= 8) {
bb.putLong(index, l); // depends on control dependency: [if], data = [none]
} else {
byte b0 = (byte)l;
byte b1 = (byte)(l >> 8);
byte b2 = (byte)(l >> 16);
byte b3 = (byte)(l >> 24);
byte b4 = (byte)(l >> 32);
byte b5 = (byte)(l >> 40);
byte b6 = (byte)(l >> 48);
byte b7 = (byte)(l >> 56);
if (_order == ByteOrder.BIG_ENDIAN) {
putBytes(pos, b7, b6, b5, b4, b3, b2, b1, b0); // depends on control dependency: [if], data = [none]
} else {
putBytes(pos, b0, b1, b2, b3, b4, b5, b6, b7); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static String[] toResources(final Object[] args) {
val object = args[0];
if (object instanceof AuthenticationTransaction) {
val transaction = AuthenticationTransaction.class.cast(object);
return new String[]{SUPPLIED_CREDENTIALS + transaction.getCredentials()};
}
return new String[]{SUPPLIED_CREDENTIALS + CollectionUtils.wrap(object)};
} }
|
public class class_name {
private static String[] toResources(final Object[] args) {
val object = args[0];
if (object instanceof AuthenticationTransaction) {
val transaction = AuthenticationTransaction.class.cast(object);
return new String[]{SUPPLIED_CREDENTIALS + transaction.getCredentials()}; // depends on control dependency: [if], data = [none]
}
return new String[]{SUPPLIED_CREDENTIALS + CollectionUtils.wrap(object)};
} }
|
public class class_name {
public static TraceComponent register(Class<?> aClass) {
TraceComponent tc;
/*
* Check for TraceOptions annotations to specify trace groups and/or
* message bundle name. Class-level annotation takes priority over
* package-level.
*/
TraceOptions options = aClass.getAnnotation(TraceOptions.class);
if (options == null) {
options = aClass.getPackage().getAnnotation(TraceOptions.class);
}
String name = aClass.getName();
if (options == null) {
tc = new TraceComponent(name, aClass, (String) null, null);
} else {
String[] traceGroups = options.traceGroups();
if (traceGroups.length == 0) {
String traceGroup = options.traceGroup();
if (traceGroup.trim().isEmpty()) {
traceGroups = TraceComponent.EMPTY_STRING_ARRAY;
} else {
traceGroups = new String[] { traceGroup };
}
}
tc = new TraceComponent(name, aClass, traceGroups, false, options.messageBundle());
}
registerTraceComponent(tc);
return tc;
} }
|
public class class_name {
public static TraceComponent register(Class<?> aClass) {
TraceComponent tc;
/*
* Check for TraceOptions annotations to specify trace groups and/or
* message bundle name. Class-level annotation takes priority over
* package-level.
*/
TraceOptions options = aClass.getAnnotation(TraceOptions.class);
if (options == null) {
options = aClass.getPackage().getAnnotation(TraceOptions.class); // depends on control dependency: [if], data = [none]
}
String name = aClass.getName();
if (options == null) {
tc = new TraceComponent(name, aClass, (String) null, null); // depends on control dependency: [if], data = [null)]
} else {
String[] traceGroups = options.traceGroups();
if (traceGroups.length == 0) {
String traceGroup = options.traceGroup();
if (traceGroup.trim().isEmpty()) {
traceGroups = TraceComponent.EMPTY_STRING_ARRAY; // depends on control dependency: [if], data = [none]
} else {
traceGroups = new String[] { traceGroup }; // depends on control dependency: [if], data = [none]
}
}
tc = new TraceComponent(name, aClass, traceGroups, false, options.messageBundle()); // depends on control dependency: [if], data = [none]
}
registerTraceComponent(tc);
return tc;
} }
|
public class class_name {
@Nullable
protected MentionSpan getTouchedSpan(MotionEvent event) {
Layout layout = getLayout();
// Note: Layout can be null if text or width has recently changed, see MOB-38193
if (event == null || layout == null) {
return null;
}
int x = (int) event.getX();
int y = (int) event.getY();
x -= getTotalPaddingLeft();
y -= getTotalPaddingTop();
x += getScrollX();
y += getScrollY();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
Editable text = getText();
if (text != null && off >= getText().length()) {
return null;
}
// Get the MentionSpans in the area that the user tapped
// If one exists, call the onClick method manually
MentionSpan[] spans = getText().getSpans(off, off, MentionSpan.class);
if (spans.length > 0) {
return spans[0];
}
return null;
} }
|
public class class_name {
@Nullable
protected MentionSpan getTouchedSpan(MotionEvent event) {
Layout layout = getLayout();
// Note: Layout can be null if text or width has recently changed, see MOB-38193
if (event == null || layout == null) {
return null; // depends on control dependency: [if], data = [none]
}
int x = (int) event.getX();
int y = (int) event.getY();
x -= getTotalPaddingLeft();
y -= getTotalPaddingTop();
x += getScrollX();
y += getScrollY();
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
Editable text = getText();
if (text != null && off >= getText().length()) {
return null; // depends on control dependency: [if], data = [none]
}
// Get the MentionSpans in the area that the user tapped
// If one exists, call the onClick method manually
MentionSpan[] spans = getText().getSpans(off, off, MentionSpan.class);
if (spans.length > 0) {
return spans[0]; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void setBody(byte[] contents) {
if (contents == null) {
return;
}
cachedString = null;
body = new byte[contents.length];
System.arraycopy(contents, 0, body, 0, contents.length);
pos = body.length;
} }
|
public class class_name {
public void setBody(byte[] contents) {
if (contents == null) {
return;
// depends on control dependency: [if], data = [none]
}
cachedString = null;
body = new byte[contents.length];
System.arraycopy(contents, 0, body, 0, contents.length);
pos = body.length;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.