code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public int attemptToSetFileChannelCapable(int value) {
// Can't go from Disabled to enabled.
// Can't go from disabled/enabled to NOT_SET
if (value == FILE_CHANNEL_CAPABLE_DISABLED) {
fileChannelCapable = FILE_CHANNEL_CAPABLE_DISABLED;
} else if (value == FILE_CHANNEL_CAPABLE_ENABLED) {
if (fileChannelCapable == FILE_CHANNEL_CAPABLE_NOT_SET) {
fileChannelCapable = FILE_CHANNEL_CAPABLE_ENABLED;
}
}
// let the user know what the current value is, since it might not be
// what the caller attempted to set it to.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "set file channel capable: " + this.fileChannelCapable);
}
return this.fileChannelCapable;
} } | public class class_name {
@Override
public int attemptToSetFileChannelCapable(int value) {
// Can't go from Disabled to enabled.
// Can't go from disabled/enabled to NOT_SET
if (value == FILE_CHANNEL_CAPABLE_DISABLED) {
fileChannelCapable = FILE_CHANNEL_CAPABLE_DISABLED; // depends on control dependency: [if], data = [none]
} else if (value == FILE_CHANNEL_CAPABLE_ENABLED) {
if (fileChannelCapable == FILE_CHANNEL_CAPABLE_NOT_SET) {
fileChannelCapable = FILE_CHANNEL_CAPABLE_ENABLED; // depends on control dependency: [if], data = [none]
}
}
// let the user know what the current value is, since it might not be
// what the caller attempted to set it to.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "set file channel capable: " + this.fileChannelCapable); // depends on control dependency: [if], data = [none]
}
return this.fileChannelCapable;
} } |
public class class_name {
@RequestMapping(value = "{accountId}/update", method = RequestMethod.GET)
public Form getUpdateForm(@PathVariable ID accountId) {
Account account = accountService.getAccount(accountId);
Form form = getCreationForm();
// Name in read-only mode for the default admin
if (account.isDefaultAdmin()) {
form = form.with(Form.defaultNameField().readOnly());
}
// Password not filled in, and not required on update
form = form.with(Password.of("password").label("Password").length(40).help("Password for the account. Leave blank to keep it unchanged.").optional());
// Groups
form = form.with(
MultiSelection.of("groups").label("Groups")
.items(accountService.getAccountGroupsForSelection(accountId))
);
// OK
return form
.fill("name", account.getName())
.fill("fullName", account.getFullName())
.fill("email", account.getEmail())
;
} } | public class class_name {
@RequestMapping(value = "{accountId}/update", method = RequestMethod.GET)
public Form getUpdateForm(@PathVariable ID accountId) {
Account account = accountService.getAccount(accountId);
Form form = getCreationForm();
// Name in read-only mode for the default admin
if (account.isDefaultAdmin()) {
form = form.with(Form.defaultNameField().readOnly()); // depends on control dependency: [if], data = [none]
}
// Password not filled in, and not required on update
form = form.with(Password.of("password").label("Password").length(40).help("Password for the account. Leave blank to keep it unchanged.").optional());
// Groups
form = form.with(
MultiSelection.of("groups").label("Groups")
.items(accountService.getAccountGroupsForSelection(accountId))
);
// OK
return form
.fill("name", account.getName())
.fill("fullName", account.getFullName())
.fill("email", account.getEmail())
;
} } |
public class class_name {
private static Iterator<int[]> initializeValueIterator(VariableNumMap vars) {
int[] dimensionSizes = new int[vars.size()];
List<DiscreteVariable> discreteVars = vars.getDiscreteVariables();
for (int i = 0; i < discreteVars.size(); i++) {
dimensionSizes[i] = discreteVars.get(i).numValues();
}
return new IntegerArrayIterator(dimensionSizes, new int[0]);
} } | public class class_name {
private static Iterator<int[]> initializeValueIterator(VariableNumMap vars) {
int[] dimensionSizes = new int[vars.size()];
List<DiscreteVariable> discreteVars = vars.getDiscreteVariables();
for (int i = 0; i < discreteVars.size(); i++) {
dimensionSizes[i] = discreteVars.get(i).numValues(); // depends on control dependency: [for], data = [i]
}
return new IntegerArrayIterator(dimensionSizes, new int[0]);
} } |
public class class_name {
public static List<IIOImage> getIIOImageList(File inputFile) throws IOException {
// convert to TIFF if PDF
File imageFile = getImageFile(inputFile);
List<IIOImage> iioImageList = new ArrayList<IIOImage>();
String imageFormat = getImageFileFormat(imageFile);
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFormat);
if (!readers.hasNext()) {
throw new RuntimeException(JAI_IMAGE_READER_MESSAGE);
}
ImageReader reader = readers.next();
try (ImageInputStream iis = ImageIO.createImageInputStream(imageFile)) {
reader.setInput(iis);
int imageTotal = reader.getNumImages(true);
for (int i = 0; i < imageTotal; i++) {
// IIOImage oimage = new IIOImage(reader.read(i), null, reader.getImageMetadata(i));
IIOImage oimage = reader.readAll(i, reader.getDefaultReadParam());
iioImageList.add(oimage);
}
return iioImageList;
} finally {
if (reader != null) {
reader.dispose();
}
// delete temporary TIFF image for PDF
if (imageFile != null && imageFile.exists() && imageFile != inputFile && imageFile.getName().startsWith("multipage") && imageFile.getName().endsWith(TIFF_EXT)) {
imageFile.delete();
}
}
} } | public class class_name {
public static List<IIOImage> getIIOImageList(File inputFile) throws IOException {
// convert to TIFF if PDF
File imageFile = getImageFile(inputFile);
List<IIOImage> iioImageList = new ArrayList<IIOImage>();
String imageFormat = getImageFileFormat(imageFile);
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName(imageFormat);
if (!readers.hasNext()) {
throw new RuntimeException(JAI_IMAGE_READER_MESSAGE);
}
ImageReader reader = readers.next();
try (ImageInputStream iis = ImageIO.createImageInputStream(imageFile)) {
reader.setInput(iis);
int imageTotal = reader.getNumImages(true);
for (int i = 0; i < imageTotal; i++) {
// IIOImage oimage = new IIOImage(reader.read(i), null, reader.getImageMetadata(i));
IIOImage oimage = reader.readAll(i, reader.getDefaultReadParam());
iioImageList.add(oimage); // depends on control dependency: [for], data = [none]
}
return iioImageList;
} finally {
if (reader != null) {
reader.dispose(); // depends on control dependency: [if], data = [none]
}
// delete temporary TIFF image for PDF
if (imageFile != null && imageFile.exists() && imageFile != inputFile && imageFile.getName().startsWith("multipage") && imageFile.getName().endsWith(TIFF_EXT)) {
imageFile.delete(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void addCmsPropertyDefinitions(AbstractTypeDefinition type) {
for (CmsPropertyDefinition propDef : m_cmsPropertyDefinitions) {
type.addPropertyDefinition(createOpenCmsPropertyDefinition(propDef));
type.addPropertyDefinition(
createPropDef(
INHERITED_PREFIX + propDef.getName(),
propDef.getName(),
propDef.getName(),
PropertyType.STRING,
Cardinality.SINGLE,
Updatability.READONLY,
false,
false));
}
type.addPropertyDefinition(
createPropDef(
PROPERTY_RESOURCE_TYPE,
"Resource type",
"Resource type",
PropertyType.STRING,
Cardinality.SINGLE,
Updatability.ONCREATE,
false,
true));
} } | public class class_name {
private void addCmsPropertyDefinitions(AbstractTypeDefinition type) {
for (CmsPropertyDefinition propDef : m_cmsPropertyDefinitions) {
type.addPropertyDefinition(createOpenCmsPropertyDefinition(propDef)); // depends on control dependency: [for], data = [propDef]
type.addPropertyDefinition(
createPropDef(
INHERITED_PREFIX + propDef.getName(),
propDef.getName(),
propDef.getName(),
PropertyType.STRING,
Cardinality.SINGLE,
Updatability.READONLY,
false,
false)); // depends on control dependency: [for], data = [none]
}
type.addPropertyDefinition(
createPropDef(
PROPERTY_RESOURCE_TYPE,
"Resource type",
"Resource type",
PropertyType.STRING,
Cardinality.SINGLE,
Updatability.ONCREATE,
false,
true));
} } |
public class class_name {
private void completeCommits(long previousCommitIndex, long commitIndex) {
for (long i = previousCommitIndex + 1; i <= commitIndex; i++) {
CompletableFuture<Long> future = appendFutures.remove(i);
if (future != null) {
future.complete(i);
}
}
} } | public class class_name {
private void completeCommits(long previousCommitIndex, long commitIndex) {
for (long i = previousCommitIndex + 1; i <= commitIndex; i++) {
CompletableFuture<Long> future = appendFutures.remove(i);
if (future != null) {
future.complete(i); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public String getUrl() {
if (StringUtils.isBlank(url) && !StringUtils.isBlank(name)) {
this.url = AWSQueueUtils.createQueue(name);
}
return url;
} } | public class class_name {
public String getUrl() {
if (StringUtils.isBlank(url) && !StringUtils.isBlank(name)) {
this.url = AWSQueueUtils.createQueue(name); // depends on control dependency: [if], data = [none]
}
return url;
} } |
public class class_name {
public List<String> getList(String key) {
List<String> list = this.parameters.get(key);
if (list == null) {
list = Collections.emptyList();
}
return list;
} } | public class class_name {
public List<String> getList(String key) {
List<String> list = this.parameters.get(key);
if (list == null) {
list = Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
public void setPosition(String position)
{
if (position == null)
{
String message = Logging.getMessage("nullValue.PositionIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
this.position = position;
clearControls();
} } | public class class_name {
public void setPosition(String position)
{
if (position == null)
{
String message = Logging.getMessage("nullValue.PositionIsNull");
Logging.logger().severe(message); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException(message);
}
this.position = position;
clearControls();
} } |
public class class_name {
public static ScannerSupplier fromBugCheckerInfos(Iterable<BugCheckerInfo> checkers) {
ImmutableBiMap.Builder<String, BugCheckerInfo> builder = ImmutableBiMap.builder();
for (BugCheckerInfo checker : checkers) {
builder.put(checker.canonicalName(), checker);
}
ImmutableBiMap<String, BugCheckerInfo> allChecks = builder.build();
return new ScannerSupplierImpl(
allChecks,
defaultSeverities(allChecks.values()),
ImmutableSet.<String>of(),
ErrorProneFlags.empty());
} } | public class class_name {
public static ScannerSupplier fromBugCheckerInfos(Iterable<BugCheckerInfo> checkers) {
ImmutableBiMap.Builder<String, BugCheckerInfo> builder = ImmutableBiMap.builder();
for (BugCheckerInfo checker : checkers) {
builder.put(checker.canonicalName(), checker); // depends on control dependency: [for], data = [checker]
}
ImmutableBiMap<String, BugCheckerInfo> allChecks = builder.build();
return new ScannerSupplierImpl(
allChecks,
defaultSeverities(allChecks.values()),
ImmutableSet.<String>of(),
ErrorProneFlags.empty());
} } |
public class class_name {
public synchronized static void destroy() {
if (isInitialized()) {
Map<String, ProcessEngine> engines = new HashMap<String, ProcessEngine>(processEngines);
processEngines = new HashMap<String, ProcessEngine>();
for (String processEngineName : engines.keySet()) {
ProcessEngine processEngine = engines.get(processEngineName);
try {
processEngine.close();
} catch (Exception e) {
log.error("exception while closing {}", (processEngineName == null ? "the default process engine" : "process engine " + processEngineName), e);
}
}
processEngineInfosByName.clear();
processEngineInfosByResourceUrl.clear();
processEngineInfos.clear();
setInitialized(false);
}
} } | public class class_name {
public synchronized static void destroy() {
if (isInitialized()) {
Map<String, ProcessEngine> engines = new HashMap<String, ProcessEngine>(processEngines);
processEngines = new HashMap<String, ProcessEngine>(); // depends on control dependency: [if], data = [none]
for (String processEngineName : engines.keySet()) {
ProcessEngine processEngine = engines.get(processEngineName);
try {
processEngine.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("exception while closing {}", (processEngineName == null ? "the default process engine" : "process engine " + processEngineName), e);
} // depends on control dependency: [catch], data = [none]
}
processEngineInfosByName.clear(); // depends on control dependency: [if], data = [none]
processEngineInfosByResourceUrl.clear(); // depends on control dependency: [if], data = [none]
processEngineInfos.clear(); // depends on control dependency: [if], data = [none]
setInitialized(false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void main(String[] args) {
int port = 9990;
String host = "localhost";
String protocol = "remote+http";
String config = null;
try {
CommandLine line = parser.parse(options, args, false);
if (line.hasOption("help")) {
formatter.printHelp(usage, NEW_LINE + JdrLogger.ROOT_LOGGER.jdrDescriptionMessage(), options, null);
return;
}
if (line.hasOption("host")) {
host = line.getOptionValue("host");
}
if (line.hasOption("port")) {
port = Integer.parseInt(line.getOptionValue("port"));
}
if (line.hasOption("protocol")) {
protocol = line.getOptionValue("protocol");
}
if (line.hasOption("config")) {
config = line.getOptionValue("config");
}
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp(usage, options);
return;
} catch (NumberFormatException nfe) {
System.out.println(nfe.getMessage());
formatter.printHelp(usage, options);
return;
}
System.out.println("Initializing JBoss Diagnostic Reporter...");
// Try to run JDR on the Wildfly JVM
CLI cli = CLI.newInstance();
boolean embedded = false;
JdrReport report = null;
try {
System.out.println(String.format("Trying to connect to %s %s:%s", protocol, host, port));
cli.connect(protocol, host, port, null, null);
} catch (IllegalStateException ex) {
System.out.println("Starting embedded server");
String startEmbeddedServer = "embed-server --std-out=echo " + ((config != null && ! config.isEmpty()) ? (" --server-config=" + config) : "");
cli.getCommandContext().handleSafe(startEmbeddedServer);
embedded = true;
}
try {
Result cmdResult = cli.cmd("/subsystem=jdr:generate-jdr-report()");
ModelNode response = cmdResult.getResponse();
if(Operations.isSuccessfulOutcome(response) || !embedded) {
reportFailure(response);
ModelNode result = response.get(ClientConstants.RESULT);
report = new JdrReport(result);
} else {
report = standaloneCollect(cli, protocol, host, port);
}
} catch(IllegalStateException ise) {
System.out.println(ise.getMessage());
report = standaloneCollect(cli, protocol, host, port);
} finally {
if(cli != null) {
try {
if(embedded)
cli.getCommandContext().handleSafe("stop-embedded-server");
else
cli.disconnect();
} catch(Exception e) {
System.out.println("Caught exception while disconnecting: " + e.getMessage());
}
}
}
printJdrReportInfo(report);
System.exit(0);
} } | public class class_name {
public static void main(String[] args) {
int port = 9990;
String host = "localhost";
String protocol = "remote+http";
String config = null;
try {
CommandLine line = parser.parse(options, args, false);
if (line.hasOption("help")) {
formatter.printHelp(usage, NEW_LINE + JdrLogger.ROOT_LOGGER.jdrDescriptionMessage(), options, null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (line.hasOption("host")) {
host = line.getOptionValue("host"); // depends on control dependency: [if], data = [none]
}
if (line.hasOption("port")) {
port = Integer.parseInt(line.getOptionValue("port")); // depends on control dependency: [if], data = [none]
}
if (line.hasOption("protocol")) {
protocol = line.getOptionValue("protocol"); // depends on control dependency: [if], data = [none]
}
if (line.hasOption("config")) {
config = line.getOptionValue("config"); // depends on control dependency: [if], data = [none]
}
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp(usage, options);
return;
} catch (NumberFormatException nfe) { // depends on control dependency: [catch], data = [none]
System.out.println(nfe.getMessage());
formatter.printHelp(usage, options);
return;
} // depends on control dependency: [catch], data = [none]
System.out.println("Initializing JBoss Diagnostic Reporter...");
// Try to run JDR on the Wildfly JVM
CLI cli = CLI.newInstance();
boolean embedded = false;
JdrReport report = null;
try {
System.out.println(String.format("Trying to connect to %s %s:%s", protocol, host, port)); // depends on control dependency: [try], data = [none]
cli.connect(protocol, host, port, null, null); // depends on control dependency: [try], data = [none]
} catch (IllegalStateException ex) {
System.out.println("Starting embedded server");
String startEmbeddedServer = "embed-server --std-out=echo " + ((config != null && ! config.isEmpty()) ? (" --server-config=" + config) : "");
cli.getCommandContext().handleSafe(startEmbeddedServer);
embedded = true;
} // depends on control dependency: [catch], data = [none]
try {
Result cmdResult = cli.cmd("/subsystem=jdr:generate-jdr-report()");
ModelNode response = cmdResult.getResponse();
if(Operations.isSuccessfulOutcome(response) || !embedded) {
reportFailure(response); // depends on control dependency: [if], data = [none]
ModelNode result = response.get(ClientConstants.RESULT);
report = new JdrReport(result); // depends on control dependency: [if], data = [none]
} else {
report = standaloneCollect(cli, protocol, host, port); // depends on control dependency: [if], data = [none]
}
} catch(IllegalStateException ise) {
System.out.println(ise.getMessage());
report = standaloneCollect(cli, protocol, host, port);
} finally { // depends on control dependency: [catch], data = [none]
if(cli != null) {
try {
if(embedded)
cli.getCommandContext().handleSafe("stop-embedded-server");
else
cli.disconnect();
} catch(Exception e) {
System.out.println("Caught exception while disconnecting: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
}
printJdrReportInfo(report);
System.exit(0);
} } |
public class class_name {
public void removeServerNotificationListener(RESTRequest request, ServerNotificationRegistration removedRegistration, final boolean removeAll,
JSONConverter converter, boolean cleanupHttpIDs) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, removedRegistration.objectName.getCanonicalName());
//Get the corresponding List for the given ObjectName
List<ServerNotification> notifications = serverNotifications.get(nti);
if (notifications == null) {
//MBean is registered, but listener is not
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("There are no listeners registered for ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
}
Iterator<ServerNotification> notificationsIter = notifications.iterator();
boolean foundMatch = false;
while (notificationsIter.hasNext()) {
ServerNotification currentRegistration = notificationsIter.next();
//Check if we match the Listener
if (currentRegistration.listener.equals(removedRegistration.listener)) {
if (removeAll ||
(currentRegistration.filter == removedRegistration.filterID &&
currentRegistration.handback == removedRegistration.handbackID)) {
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
//Remove from MBeanServer
MBeanServerHelper.removeServerNotification(removedRegistration.objectName, //no need to make another ObjectName
currentRegistration.listener,
(NotificationFilter) getObject(currentRegistration.filter, null, converter),
getObject(currentRegistration.handback, null, converter),
converter);
} else {
// Remove the notification listener from the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.removeRoutedServerNotificationListener(nti,
currentRegistration.listener,
(NotificationFilter) getObject(currentRegistration.filter, null, converter),
getObject(currentRegistration.handback, null, converter),
converter);
}
//Remove from local list (through iterator)
notificationsIter.remove();
if (cleanupHttpIDs) {
removeObject(currentRegistration.filter);
removeObject(currentRegistration.handback);
}
foundMatch = true;
}
}
}
if (!foundMatch) {
if (removeAll) {
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("Could not match given Listener to ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
} else {
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("Could not match given Listener, Filter and Handback to ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
}
}
} } | public class class_name {
public void removeServerNotificationListener(RESTRequest request, ServerNotificationRegistration removedRegistration, final boolean removeAll,
JSONConverter converter, boolean cleanupHttpIDs) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, removedRegistration.objectName.getCanonicalName());
//Get the corresponding List for the given ObjectName
List<ServerNotification> notifications = serverNotifications.get(nti);
if (notifications == null) {
//MBean is registered, but listener is not
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("There are no listeners registered for ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
}
Iterator<ServerNotification> notificationsIter = notifications.iterator();
boolean foundMatch = false;
while (notificationsIter.hasNext()) {
ServerNotification currentRegistration = notificationsIter.next();
//Check if we match the Listener
if (currentRegistration.listener.equals(removedRegistration.listener)) {
if (removeAll ||
(currentRegistration.filter == removedRegistration.filterID &&
currentRegistration.handback == removedRegistration.handbackID)) {
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
//Remove from MBeanServer
MBeanServerHelper.removeServerNotification(removedRegistration.objectName, //no need to make another ObjectName
currentRegistration.listener,
(NotificationFilter) getObject(currentRegistration.filter, null, converter),
getObject(currentRegistration.handback, null, converter),
converter); // depends on control dependency: [if], data = [none]
} else {
// Remove the notification listener from the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.removeRoutedServerNotificationListener(nti,
currentRegistration.listener,
(NotificationFilter) getObject(currentRegistration.filter, null, converter),
getObject(currentRegistration.handback, null, converter),
converter); // depends on control dependency: [if], data = [none]
}
//Remove from local list (through iterator)
notificationsIter.remove(); // depends on control dependency: [if], data = [none]
if (cleanupHttpIDs) {
removeObject(currentRegistration.filter); // depends on control dependency: [if], data = [none]
removeObject(currentRegistration.handback); // depends on control dependency: [if], data = [none]
}
foundMatch = true; // depends on control dependency: [if], data = [none]
}
}
}
if (!foundMatch) {
if (removeAll) {
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("Could not match given Listener to ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
} else {
throw ErrorHelper.createRESTHandlerJsonException(new ListenerNotFoundException("Could not match given Listener, Filter and Handback to ObjectName: "
+ removedRegistration.objectName.getCanonicalName()),
converter,
APIConstants.STATUS_BAD_REQUEST);
}
}
} } |
public class class_name {
public List<Set<K>> repeatedBisection(int nclusters, double limit_eval)
{
Cluster<K> cluster = new Cluster<K>();
List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters > 0 ? nclusters : 16);
for (Document<K> document : documents_.values())
{
cluster.add_document(document);
}
PriorityQueue<Cluster<K>> que = new PriorityQueue<Cluster<K>>();
cluster.section(2);
refine_clusters(cluster.sectioned_clusters());
cluster.set_sectioned_gain();
cluster.composite_vector().clear();
que.add(cluster);
while (!que.isEmpty())
{
if (nclusters > 0 && que.size() >= nclusters)
break;
cluster = que.peek();
if (cluster.sectioned_clusters().size() < 1)
break;
if (limit_eval > 0 && cluster.sectioned_gain() < limit_eval)
break;
que.poll();
List<Cluster<K>> sectioned = cluster.sectioned_clusters();
for (Cluster<K> c : sectioned)
{
c.section(2);
refine_clusters(c.sectioned_clusters());
c.set_sectioned_gain();
if (c.sectioned_gain() < limit_eval)
{
for (Cluster<K> sub : c.sectioned_clusters())
{
sub.clear();
}
}
c.composite_vector().clear();
que.add(c);
}
}
while (!que.isEmpty())
{
clusters_.add(0, que.poll());
}
return toResult(clusters_);
} } | public class class_name {
public List<Set<K>> repeatedBisection(int nclusters, double limit_eval)
{
Cluster<K> cluster = new Cluster<K>();
List<Cluster<K>> clusters_ = new ArrayList<Cluster<K>>(nclusters > 0 ? nclusters : 16);
for (Document<K> document : documents_.values())
{
cluster.add_document(document); // depends on control dependency: [for], data = [document]
}
PriorityQueue<Cluster<K>> que = new PriorityQueue<Cluster<K>>();
cluster.section(2);
refine_clusters(cluster.sectioned_clusters());
cluster.set_sectioned_gain();
cluster.composite_vector().clear();
que.add(cluster);
while (!que.isEmpty())
{
if (nclusters > 0 && que.size() >= nclusters)
break;
cluster = que.peek(); // depends on control dependency: [while], data = [none]
if (cluster.sectioned_clusters().size() < 1)
break;
if (limit_eval > 0 && cluster.sectioned_gain() < limit_eval)
break;
que.poll(); // depends on control dependency: [while], data = [none]
List<Cluster<K>> sectioned = cluster.sectioned_clusters();
for (Cluster<K> c : sectioned)
{
c.section(2); // depends on control dependency: [for], data = [c]
refine_clusters(c.sectioned_clusters()); // depends on control dependency: [for], data = [c]
c.set_sectioned_gain(); // depends on control dependency: [for], data = [c]
if (c.sectioned_gain() < limit_eval)
{
for (Cluster<K> sub : c.sectioned_clusters())
{
sub.clear(); // depends on control dependency: [for], data = [sub]
}
}
c.composite_vector().clear(); // depends on control dependency: [for], data = [c]
que.add(c); // depends on control dependency: [for], data = [c]
}
}
while (!que.isEmpty())
{
clusters_.add(0, que.poll()); // depends on control dependency: [while], data = [none]
}
return toResult(clusters_);
} } |
public class class_name {
public void move(Robot robot) {
if (!robotsPosition.containsKey(robot)) {
throw new IllegalArgumentException("Robot doesn't exist");
}
if (!robot.getData().isMobile()) {
throw new IllegalArgumentException("Robot can't move");
}
Point newPosition = getReferenceField(robot, 1);
if (!isOccupied(newPosition)) {
Point oldPosition = robotsPosition.get(robot);
robotsPosition.put(robot, newPosition);
eventDispatcher.fireEvent(new RobotMovedEvent(robot, oldPosition, newPosition));
}
} } | public class class_name {
public void move(Robot robot) {
if (!robotsPosition.containsKey(robot)) {
throw new IllegalArgumentException("Robot doesn't exist");
}
if (!robot.getData().isMobile()) {
throw new IllegalArgumentException("Robot can't move");
}
Point newPosition = getReferenceField(robot, 1);
if (!isOccupied(newPosition)) {
Point oldPosition = robotsPosition.get(robot);
robotsPosition.put(robot, newPosition); // depends on control dependency: [if], data = [none]
eventDispatcher.fireEvent(new RobotMovedEvent(robot, oldPosition, newPosition)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@VisibleForTesting
static String doExtractResponse(int statusCode, HttpEntity entity) {
String message = null;
if (entity != null) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
entity.writeTo(baos);
message = baos.toString("UTF-8");
}
catch (IOException ex) {
throw new SystemException(ex);
}
}
//if the response is in the 400 range, use IllegalArgumentException, which currently translates to a 400 error
if (statusCode>= HttpStatus.SC_BAD_REQUEST && statusCode < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new IllegalArgumentException("Status code: " + statusCode + " . Error occurred. " + message);
}
//everything else that's not in the 200 range, use SystemException, which translates to a 500 error.
if ((statusCode < HttpStatus.SC_OK) || (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES)) {
throw new SystemException("Status code: " + statusCode + " . Error occurred. " + message);
} else {
return message;
}
} } | public class class_name {
@VisibleForTesting
static String doExtractResponse(int statusCode, HttpEntity entity) {
String message = null;
if (entity != null) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
entity.writeTo(baos);
message = baos.toString("UTF-8"); // depends on control dependency: [if], data = [none]
}
catch (IOException ex) {
throw new SystemException(ex);
}
}
//if the response is in the 400 range, use IllegalArgumentException, which currently translates to a 400 error
if (statusCode>= HttpStatus.SC_BAD_REQUEST && statusCode < HttpStatus.SC_INTERNAL_SERVER_ERROR) {
throw new IllegalArgumentException("Status code: " + statusCode + " . Error occurred. " + message);
}
//everything else that's not in the 200 range, use SystemException, which translates to a 500 error.
if ((statusCode < HttpStatus.SC_OK) || (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES)) {
throw new SystemException("Status code: " + statusCode + " . Error occurred. " + message);
} else {
return message;
}
} } |
public class class_name {
public void setConfigurationTemplates(java.util.Collection<String> configurationTemplates) {
if (configurationTemplates == null) {
this.configurationTemplates = null;
return;
}
this.configurationTemplates = new com.amazonaws.internal.SdkInternalList<String>(configurationTemplates);
} } | public class class_name {
public void setConfigurationTemplates(java.util.Collection<String> configurationTemplates) {
if (configurationTemplates == null) {
this.configurationTemplates = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.configurationTemplates = new com.amazonaws.internal.SdkInternalList<String>(configurationTemplates);
} } |
public class class_name {
public WorkflowTypeInfos withTypeInfos(WorkflowTypeInfo... typeInfos) {
if (this.typeInfos == null) {
setTypeInfos(new java.util.ArrayList<WorkflowTypeInfo>(typeInfos.length));
}
for (WorkflowTypeInfo ele : typeInfos) {
this.typeInfos.add(ele);
}
return this;
} } | public class class_name {
public WorkflowTypeInfos withTypeInfos(WorkflowTypeInfo... typeInfos) {
if (this.typeInfos == null) {
setTypeInfos(new java.util.ArrayList<WorkflowTypeInfo>(typeInfos.length)); // depends on control dependency: [if], data = [none]
}
for (WorkflowTypeInfo ele : typeInfos) {
this.typeInfos.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
Level getLevelProperty(String name, Level defaultValue) {
String val = getProperty(name);
if (val == null) {
return defaultValue;
}
Level l = Level.findLevel(val.trim());
return l != null ? l : defaultValue;
} } | public class class_name {
Level getLevelProperty(String name, Level defaultValue) {
String val = getProperty(name);
if (val == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
Level l = Level.findLevel(val.trim());
return l != null ? l : defaultValue;
} } |
public class class_name {
public EClass getIfcFailureConnectionCondition() {
if (ifcFailureConnectionConditionEClass == null) {
ifcFailureConnectionConditionEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(227);
}
return ifcFailureConnectionConditionEClass;
} } | public class class_name {
public EClass getIfcFailureConnectionCondition() {
if (ifcFailureConnectionConditionEClass == null) {
ifcFailureConnectionConditionEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(227);
// depends on control dependency: [if], data = [none]
}
return ifcFailureConnectionConditionEClass;
} } |
public class class_name {
public void getOffset(long date, boolean local, int[] offsets) {
offsets[0] = getRawOffset();
if (!local) {
date += offsets[0]; // now in local standard millis
}
// When local == true, date might not be in local standard
// millis. getOffset taking 6 parameters used here assume
// the given time in day is local standard time.
// At STD->DST transition, there is a range of time which
// does not exist. When 'date' is in this time range
// (and local == true), this method interprets the specified
// local time as DST. At DST->STD transition, there is a
// range of time which occurs twice. In this case, this
// method interprets the specified local time as STD.
// To support the behavior above, we need to call getOffset
// (with 6 args) twice when local == true and DST is
// detected in the initial call.
int fields[] = new int[6];
for (int pass = 0; ; pass++) {
Grego.timeToFields(date, fields);
offsets[1] = getOffset(GregorianCalendar.AD,
fields[0], fields[1], fields[2],
fields[3], fields[5]) - offsets[0];
if (pass != 0 || !local || offsets[1] == 0) {
break;
}
// adjust to local standard millis
date -= offsets[1];
}
} } | public class class_name {
public void getOffset(long date, boolean local, int[] offsets) {
offsets[0] = getRawOffset();
if (!local) {
date += offsets[0]; // now in local standard millis // depends on control dependency: [if], data = [none]
}
// When local == true, date might not be in local standard
// millis. getOffset taking 6 parameters used here assume
// the given time in day is local standard time.
// At STD->DST transition, there is a range of time which
// does not exist. When 'date' is in this time range
// (and local == true), this method interprets the specified
// local time as DST. At DST->STD transition, there is a
// range of time which occurs twice. In this case, this
// method interprets the specified local time as STD.
// To support the behavior above, we need to call getOffset
// (with 6 args) twice when local == true and DST is
// detected in the initial call.
int fields[] = new int[6];
for (int pass = 0; ; pass++) {
Grego.timeToFields(date, fields); // depends on control dependency: [for], data = [none]
offsets[1] = getOffset(GregorianCalendar.AD,
fields[0], fields[1], fields[2],
fields[3], fields[5]) - offsets[0]; // depends on control dependency: [for], data = [none]
if (pass != 0 || !local || offsets[1] == 0) {
break;
}
// adjust to local standard millis
date -= offsets[1]; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void incrementCounter(String name, int increment) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.incrementCounter(escapedName, increment);
}
}
} } | public class class_name {
public void incrementCounter(String name, int increment) {
if (monitorActive) {
String escapedName = keyHandler.handle(name);
for (MonitorPlugin p : getPlugins()) {
p.incrementCounter(escapedName, increment);
// depends on control dependency: [for], data = [p]
}
}
} } |
public class class_name {
public void onMouseUp(MouseUpEvent event) {
Coordinate worldPosition = getWorldPosition(event);
Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition);
SearchByLocationRequest request = new SearchByLocationRequest();
request.setLocation(GeometryConverter.toDto(point));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_FIRST_LAYER);
request.setBuffer(calculateBufferFromPixelTolerance());
request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
request.setLayerIds(getServerLayerIds(mapWidget.getMapModel()));
for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
if (layer.isShowing() && layer instanceof VectorLayer) {
request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter());
}
}
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
for (String serverLayerId : featureMap.keySet()) {
List<VectorLayer> layers = mapWidget.getMapModel().getVectorLayersByServerId(serverLayerId);
for (VectorLayer vectorLayer : layers) {
List<org.geomajas.layer.feature.Feature> orgFeatures = featureMap.get(serverLayerId);
if (orgFeatures.size() > 0) {
Feature feature = new Feature(orgFeatures.get(0), vectorLayer);
vectorLayer.getFeatureStore().addFeature(feature);
FeatureAttributeWindow window = new FeatureAttributeWindow(feature, false);
window.setPageTop(mapWidget.getAbsoluteTop() + 10);
window.setPageLeft(mapWidget.getAbsoluteLeft() + 10);
window.draw();
}
}
}
}
});
} } | public class class_name {
public void onMouseUp(MouseUpEvent event) {
Coordinate worldPosition = getWorldPosition(event);
Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition);
SearchByLocationRequest request = new SearchByLocationRequest();
request.setLocation(GeometryConverter.toDto(point));
request.setCrs(mapWidget.getMapModel().getCrs());
request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS);
request.setSearchType(SearchByLocationRequest.SEARCH_FIRST_LAYER);
request.setBuffer(calculateBufferFromPixelTolerance());
request.setFeatureIncludes(GwtCommandDispatcher.getInstance().getLazyFeatureIncludesSelect());
request.setLayerIds(getServerLayerIds(mapWidget.getMapModel()));
for (Layer<?> layer : mapWidget.getMapModel().getLayers()) {
if (layer.isShowing() && layer instanceof VectorLayer) {
request.setFilter(layer.getServerLayerId(), ((VectorLayer) layer).getFilter()); // depends on control dependency: [if], data = [none]
}
}
GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND);
commandRequest.setCommandRequest(request);
GwtCommandDispatcher.getInstance().execute(commandRequest,
new AbstractCommandCallback<SearchByLocationResponse>() {
public void execute(SearchByLocationResponse response) {
Map<String, List<org.geomajas.layer.feature.Feature>> featureMap = response.getFeatureMap();
for (String serverLayerId : featureMap.keySet()) {
List<VectorLayer> layers = mapWidget.getMapModel().getVectorLayersByServerId(serverLayerId);
for (VectorLayer vectorLayer : layers) {
List<org.geomajas.layer.feature.Feature> orgFeatures = featureMap.get(serverLayerId);
if (orgFeatures.size() > 0) {
Feature feature = new Feature(orgFeatures.get(0), vectorLayer);
vectorLayer.getFeatureStore().addFeature(feature); // depends on control dependency: [if], data = [none]
FeatureAttributeWindow window = new FeatureAttributeWindow(feature, false);
window.setPageTop(mapWidget.getAbsoluteTop() + 10); // depends on control dependency: [if], data = [0)]
window.setPageLeft(mapWidget.getAbsoluteLeft() + 10); // depends on control dependency: [if], data = [0)]
window.draw(); // depends on control dependency: [if], data = [none]
}
}
}
}
});
} } |
public class class_name {
@Override
public int compareTo(MonetaryAmount o) {
Objects.requireNonNull(o);
int compare;
if (currency.equals(o.getCurrency())) {
compare = asNumberStripped().compareTo(RoundedMoney.from(o).asNumberStripped());
} else {
compare = currency.getCurrencyCode().compareTo(o.getCurrency().getCurrencyCode());
}
return compare;
} } | public class class_name {
@Override
public int compareTo(MonetaryAmount o) {
Objects.requireNonNull(o);
int compare;
if (currency.equals(o.getCurrency())) {
compare = asNumberStripped().compareTo(RoundedMoney.from(o).asNumberStripped()); // depends on control dependency: [if], data = [none]
} else {
compare = currency.getCurrencyCode().compareTo(o.getCurrency().getCurrencyCode()); // depends on control dependency: [if], data = [none]
}
return compare;
} } |
public class class_name {
@Nullable
private static EntropyInjectingFileSystem getEntropyFs(FileSystem fs) {
if (fs instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) fs;
}
else if (fs instanceof SafetyNetWrapperFileSystem) {
FileSystem delegate = ((SafetyNetWrapperFileSystem) fs).getWrappedDelegate();
if (delegate instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) delegate;
}
else {
return null;
}
}
else {
return null;
}
} } | public class class_name {
@Nullable
private static EntropyInjectingFileSystem getEntropyFs(FileSystem fs) {
if (fs instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) fs; // depends on control dependency: [if], data = [none]
}
else if (fs instanceof SafetyNetWrapperFileSystem) {
FileSystem delegate = ((SafetyNetWrapperFileSystem) fs).getWrappedDelegate();
if (delegate instanceof EntropyInjectingFileSystem) {
return (EntropyInjectingFileSystem) delegate; // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean needsSystemTree() {
LocationStepQueryNode[] pathSteps = getPathSteps();
if (pathSteps == null || pathSteps.length == 0) {
return true;
}
InternalQName firstPathStepName = pathSteps[0].getNameTest();
if (firstPathStepName == null) {
// If the first operand of the path steps is a node type query
// we do not need to include the system index if the node type is
// none of the node types that may occur in the system index.
QueryNode[] pathStepOperands = pathSteps[0].getOperands();
if (pathStepOperands.length > 0) {
if (pathStepOperands[0] instanceof NodeTypeQueryNode) {
NodeTypeQueryNode nodeTypeQueryNode = (NodeTypeQueryNode) pathStepOperands[0];
if (!validJcrSystemNodeTypeNames.contains(nodeTypeQueryNode.getValue())) {
return false;
}
}
}
// If the first location step has a null name test we need to include
// the system tree ("*")
return true;
}
// Calculate the first workspace relative location step
LocationStepQueryNode firstWorkspaceRelativeStep = pathSteps[0];
if (firstPathStepName.equals(Constants.ROOT_PATH.getName())){
// path starts with "/jcr:root"
if (pathSteps.length > 1) {
firstWorkspaceRelativeStep = pathSteps[1];
}
}
// First path step starts with "//"
if (firstWorkspaceRelativeStep.getIncludeDescendants()) {
return true;
}
// If the first workspace relative location step is jcr:system we need
// to include the system tree
InternalQName firstWorkspaceRelativeName = firstWorkspaceRelativeStep.getNameTest();
if (firstWorkspaceRelativeName == null
|| firstWorkspaceRelativeName.equals(Constants.JCR_SYSTEM)) {
return true;
}
return super.needsSystemTree();
} } | public class class_name {
public boolean needsSystemTree() {
LocationStepQueryNode[] pathSteps = getPathSteps();
if (pathSteps == null || pathSteps.length == 0) {
return true; // depends on control dependency: [if], data = [none]
}
InternalQName firstPathStepName = pathSteps[0].getNameTest();
if (firstPathStepName == null) {
// If the first operand of the path steps is a node type query
// we do not need to include the system index if the node type is
// none of the node types that may occur in the system index.
QueryNode[] pathStepOperands = pathSteps[0].getOperands();
if (pathStepOperands.length > 0) {
if (pathStepOperands[0] instanceof NodeTypeQueryNode) {
NodeTypeQueryNode nodeTypeQueryNode = (NodeTypeQueryNode) pathStepOperands[0];
if (!validJcrSystemNodeTypeNames.contains(nodeTypeQueryNode.getValue())) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
// If the first location step has a null name test we need to include
// the system tree ("*")
return true; // depends on control dependency: [if], data = [none]
}
// Calculate the first workspace relative location step
LocationStepQueryNode firstWorkspaceRelativeStep = pathSteps[0];
if (firstPathStepName.equals(Constants.ROOT_PATH.getName())){
// path starts with "/jcr:root"
if (pathSteps.length > 1) {
firstWorkspaceRelativeStep = pathSteps[1]; // depends on control dependency: [if], data = [none]
}
}
// First path step starts with "//"
if (firstWorkspaceRelativeStep.getIncludeDescendants()) {
return true; // depends on control dependency: [if], data = [none]
}
// If the first workspace relative location step is jcr:system we need
// to include the system tree
InternalQName firstWorkspaceRelativeName = firstWorkspaceRelativeStep.getNameTest();
if (firstWorkspaceRelativeName == null
|| firstWorkspaceRelativeName.equals(Constants.JCR_SYSTEM)) {
return true; // depends on control dependency: [if], data = [none]
}
return super.needsSystemTree();
} } |
public class class_name {
private <X> AbstractManagedType<X> buildManagedType(Class<X> clazz, boolean isIdClass)
{
AbstractManagedType<X> managedType = null;
if (clazz.isAnnotationPresent(Embeddable.class))
{
validate(clazz, true);
if (!embeddables.containsKey(clazz))
{
managedType = new DefaultEmbeddableType<X>(clazz, PersistenceType.EMBEDDABLE, getType(
clazz.getSuperclass(), isIdClass));
onDeclaredFields(clazz, managedType);
embeddables.put(clazz, managedType);
}
else
{
managedType = (AbstractManagedType<X>) embeddables.get(clazz);
}
}
else if (clazz.isAnnotationPresent(MappedSuperclass.class))
{
validate(clazz, false);
// if (!mappedSuperClassTypes.containsKey(clazz))
// {
managedType = new DefaultMappedSuperClass<X>(clazz, PersistenceType.MAPPED_SUPERCLASS,
(AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass));
onDeclaredFields(clazz, managedType);
mappedSuperClassTypes.put(clazz, (MappedSuperclassType<?>) managedType);
// }
// else
// {
// managedType = (AbstractManagedType<X>)
// mappedSuperClassTypes.get(clazz);
// }
}
else if (clazz.isAnnotationPresent(Entity.class) || isIdClass)
{
if (!managedTypes.containsKey(clazz))
{
managedType = new DefaultEntityType<X>(clazz, PersistenceType.ENTITY,
(AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass));
// in case of @IdClass, it is a temporary managed type.
if (!isIdClass)
{
managedTypes.put(clazz, (EntityType<?>) managedType);
}
}
else
{
managedType = (AbstractManagedType<X>) managedTypes.get(clazz);
}
}
return managedType;
} } | public class class_name {
private <X> AbstractManagedType<X> buildManagedType(Class<X> clazz, boolean isIdClass)
{
AbstractManagedType<X> managedType = null;
if (clazz.isAnnotationPresent(Embeddable.class))
{
validate(clazz, true); // depends on control dependency: [if], data = [none]
if (!embeddables.containsKey(clazz))
{
managedType = new DefaultEmbeddableType<X>(clazz, PersistenceType.EMBEDDABLE, getType(
clazz.getSuperclass(), isIdClass)); // depends on control dependency: [if], data = [none]
onDeclaredFields(clazz, managedType); // depends on control dependency: [if], data = [none]
embeddables.put(clazz, managedType); // depends on control dependency: [if], data = [none]
}
else
{
managedType = (AbstractManagedType<X>) embeddables.get(clazz); // depends on control dependency: [if], data = [none]
}
}
else if (clazz.isAnnotationPresent(MappedSuperclass.class))
{
validate(clazz, false); // depends on control dependency: [if], data = [none]
// if (!mappedSuperClassTypes.containsKey(clazz))
// {
managedType = new DefaultMappedSuperClass<X>(clazz, PersistenceType.MAPPED_SUPERCLASS,
(AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass)); // depends on control dependency: [if], data = [none]
onDeclaredFields(clazz, managedType); // depends on control dependency: [if], data = [none]
mappedSuperClassTypes.put(clazz, (MappedSuperclassType<?>) managedType); // depends on control dependency: [if], data = [none]
// }
// else
// {
// managedType = (AbstractManagedType<X>)
// mappedSuperClassTypes.get(clazz);
// }
}
else if (clazz.isAnnotationPresent(Entity.class) || isIdClass)
{
if (!managedTypes.containsKey(clazz))
{
managedType = new DefaultEntityType<X>(clazz, PersistenceType.ENTITY,
(AbstractIdentifiableType) getType(clazz.getSuperclass(), isIdClass)); // depends on control dependency: [if], data = [none]
// in case of @IdClass, it is a temporary managed type.
if (!isIdClass)
{
managedTypes.put(clazz, (EntityType<?>) managedType); // depends on control dependency: [if], data = [none]
}
}
else
{
managedType = (AbstractManagedType<X>) managedTypes.get(clazz); // depends on control dependency: [if], data = [none]
}
}
return managedType;
} } |
public class class_name {
protected String createResponseBody(TemplateEngine engine, WebContext context, ActionRuntime runtime, NextJourney journey) {
try {
return engine.process(journey.getRoutingPath(), context);
} catch (RuntimeException e) {
return throwRequestForwardFailureException(runtime, journey, e);
}
} } | public class class_name {
protected String createResponseBody(TemplateEngine engine, WebContext context, ActionRuntime runtime, NextJourney journey) {
try {
return engine.process(journey.getRoutingPath(), context); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
return throwRequestForwardFailureException(runtime, journey, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private URI toUri(final String path) {
try {
return new URI(null, null, path, null);
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
} } | public class class_name {
private URI toUri(final String path) {
try {
return new URI(null, null, path, null);
// depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(VirtualRouterData virtualRouterData, ProtocolMarshaller protocolMarshaller) {
if (virtualRouterData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(virtualRouterData.getMeshName(), MESHNAME_BINDING);
protocolMarshaller.marshall(virtualRouterData.getMetadata(), METADATA_BINDING);
protocolMarshaller.marshall(virtualRouterData.getSpec(), SPEC_BINDING);
protocolMarshaller.marshall(virtualRouterData.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(virtualRouterData.getVirtualRouterName(), VIRTUALROUTERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(VirtualRouterData virtualRouterData, ProtocolMarshaller protocolMarshaller) {
if (virtualRouterData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(virtualRouterData.getMeshName(), MESHNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(virtualRouterData.getMetadata(), METADATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(virtualRouterData.getSpec(), SPEC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(virtualRouterData.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(virtualRouterData.getVirtualRouterName(), VIRTUALROUTERNAME_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 void swapSubstring(BitString other, int start, int length)
{
assertValidIndex(start);
other.assertValidIndex(start);
int word = start / WORD_LENGTH;
int partialWordSize = (WORD_LENGTH - start) % WORD_LENGTH;
if (partialWordSize > 0)
{
swapBits(other, word, 0xFFFFFFFF << (WORD_LENGTH - partialWordSize));
++word;
}
int remainingBits = length - partialWordSize;
int stop = remainingBits / WORD_LENGTH;
for (int i = word; i < stop; i++)
{
int temp = data[i];
data[i] = other.data[i];
other.data[i] = temp;
}
remainingBits %= WORD_LENGTH;
if (remainingBits > 0)
{
swapBits(other, word, 0xFFFFFFFF >>> (WORD_LENGTH - remainingBits));
}
} } | public class class_name {
public void swapSubstring(BitString other, int start, int length)
{
assertValidIndex(start);
other.assertValidIndex(start);
int word = start / WORD_LENGTH;
int partialWordSize = (WORD_LENGTH - start) % WORD_LENGTH;
if (partialWordSize > 0)
{
swapBits(other, word, 0xFFFFFFFF << (WORD_LENGTH - partialWordSize)); // depends on control dependency: [if], data = [none]
++word; // depends on control dependency: [if], data = [none]
}
int remainingBits = length - partialWordSize;
int stop = remainingBits / WORD_LENGTH;
for (int i = word; i < stop; i++)
{
int temp = data[i];
data[i] = other.data[i]; // depends on control dependency: [for], data = [i]
other.data[i] = temp; // depends on control dependency: [for], data = [i]
}
remainingBits %= WORD_LENGTH;
if (remainingBits > 0)
{
swapBits(other, word, 0xFFFFFFFF >>> (WORD_LENGTH - remainingBits)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph());
List<String> processorExpressions = expressionUtil
.findProcessorExpressions(paragraph.getText());
for (String processorExpression : processorExpressions) {
String strippedExpression = expressionUtil.stripExpression(processorExpression);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(strippedExpression, contextRootProxy);
placeholderReplacer.replace(paragraph, processorExpression, null);
logger.debug(String.format(
"Processor expression '%s' has been successfully processed by a comment processor.",
processorExpression));
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(strippedExpression, e);
} else {
logger.warn(String.format(
"Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
processorExpression, e.getMessage()));
logger.trace("Reason for skipping processor expression: ", e);
}
} catch (ProxyException e) {
throw new DocxStamperException("Could not create a proxy around context root object", e);
}
}
} } | public class class_name {
private <T> void runProcessorsOnInlineContent(ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
ParagraphWrapper paragraph = new ParagraphWrapper(paragraphCoordinates.getParagraph());
List<String> processorExpressions = expressionUtil
.findProcessorExpressions(paragraph.getText());
for (String processorExpression : processorExpressions) {
String strippedExpression = expressionUtil.stripExpression(processorExpression);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(strippedExpression, contextRootProxy); // depends on control dependency: [try], data = [none]
placeholderReplacer.replace(paragraph, processorExpression, null); // depends on control dependency: [try], data = [none]
logger.debug(String.format(
"Processor expression '%s' has been successfully processed by a comment processor.",
processorExpression)); // depends on control dependency: [try], data = [none]
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(strippedExpression, e);
} else {
logger.warn(String.format(
"Skipping processor expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
processorExpression, e.getMessage())); // depends on control dependency: [if], data = [none]
logger.trace("Reason for skipping processor expression: ", e); // depends on control dependency: [if], data = [none]
}
} catch (ProxyException e) { // depends on control dependency: [catch], data = [none]
throw new DocxStamperException("Could not create a proxy around context root object", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void alarm(Object thandle)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "alarm", thandle);
synchronized (this)
{
if (expiryAlarmHandle != null)
{
expiryAlarmHandle = null;
close();
// call into parent asking it to remove me
parent.removeBrowserSession(key);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "alarm");
} } | public class class_name {
public void alarm(Object thandle)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "alarm", thandle);
synchronized (this)
{
if (expiryAlarmHandle != null)
{
expiryAlarmHandle = null; // depends on control dependency: [if], data = [none]
close(); // depends on control dependency: [if], data = [none]
// call into parent asking it to remove me
parent.removeBrowserSession(key); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "alarm");
} } |
public class class_name {
public void removeByKey(Object key)
{
Object value = keyTable.remove(key);
if (value != null)
{
valueTable.remove(value);
}
} } | public class class_name {
public void removeByKey(Object key)
{
Object value = keyTable.remove(key);
if (value != null)
{
valueTable.remove(value);
// depends on control dependency: [if], data = [(value]
}
} } |
public class class_name {
protected static void writeIterator(Output out, Iterator<Object> it) {
log.trace("writeIterator");
// Create LinkedList of collection we iterate thru and write it out later
LinkedList<Object> list = new LinkedList<Object>();
while (it.hasNext()) {
list.addLast(it.next());
}
// Write out collection
out.writeArray(list);
} } | public class class_name {
protected static void writeIterator(Output out, Iterator<Object> it) {
log.trace("writeIterator");
// Create LinkedList of collection we iterate thru and write it out later
LinkedList<Object> list = new LinkedList<Object>();
while (it.hasNext()) {
list.addLast(it.next()); // depends on control dependency: [while], data = [none]
}
// Write out collection
out.writeArray(list);
} } |
public class class_name {
private List<CmsGitConfiguration> readConfigFiles() {
List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();
// Default configuration file for backwards compatibility
addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));
// All files in the config folder
File configFolder = new File(DEFAULT_CONFIG_FOLDER);
if (configFolder.isDirectory()) {
for (File configFile : configFolder.listFiles()) {
addConfigurationIfValid(configurations, configFile);
}
}
return configurations;
} } | public class class_name {
private List<CmsGitConfiguration> readConfigFiles() {
List<CmsGitConfiguration> configurations = new LinkedList<CmsGitConfiguration>();
// Default configuration file for backwards compatibility
addConfigurationIfValid(configurations, new File(DEFAULT_CONFIG_FILE));
// All files in the config folder
File configFolder = new File(DEFAULT_CONFIG_FOLDER);
if (configFolder.isDirectory()) {
for (File configFile : configFolder.listFiles()) {
addConfigurationIfValid(configurations, configFile); // depends on control dependency: [for], data = [configFile]
}
}
return configurations;
} } |
public class class_name {
public static float getFloat(String name, float defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getFloat(name);
} else {
return defaultVal;
}
} } | public class class_name {
public static float getFloat(String name, float defaultVal){
if(getConfiguration().containsKey(name)){
return getConfiguration().getFloat(name); // depends on control dependency: [if], data = [none]
} else {
return defaultVal; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean containsNone(UnicodeSet b) {
// The specified set is a subset if some of its pairs overlap with some of this set's pairs.
// This implementation accesses the lists directly for speed.
int[] listB = b.list;
boolean needA = true;
boolean needB = true;
int aPtr = 0;
int bPtr = 0;
int aLen = len - 1;
int bLen = b.len - 1;
int startA = 0, startB = 0, limitA = 0, limitB = 0;
while (true) {
// double iterations are such a pain...
if (needA) {
if (aPtr >= aLen) {
// ran out of A: break so we test strings
break;
}
startA = list[aPtr++];
limitA = list[aPtr++];
}
if (needB) {
if (bPtr >= bLen) {
// ran out of B: break so we test strings
break;
}
startB = listB[bPtr++];
limitB = listB[bPtr++];
}
// if B is higher than any part of A, get new A
if (startB >= limitA) {
needA = true;
needB = false;
continue;
}
// if A is higher than any part of B, get new B
if (startA >= limitB) {
needA = false;
needB = true;
continue;
}
// all other combinations mean we fail
return false;
}
if (!SortedSetRelation.hasRelation(strings, SortedSetRelation.DISJOINT, b.strings)) return false;
return true;
} } | public class class_name {
public boolean containsNone(UnicodeSet b) {
// The specified set is a subset if some of its pairs overlap with some of this set's pairs.
// This implementation accesses the lists directly for speed.
int[] listB = b.list;
boolean needA = true;
boolean needB = true;
int aPtr = 0;
int bPtr = 0;
int aLen = len - 1;
int bLen = b.len - 1;
int startA = 0, startB = 0, limitA = 0, limitB = 0;
while (true) {
// double iterations are such a pain...
if (needA) {
if (aPtr >= aLen) {
// ran out of A: break so we test strings
break;
}
startA = list[aPtr++]; // depends on control dependency: [if], data = [none]
limitA = list[aPtr++]; // depends on control dependency: [if], data = [none]
}
if (needB) {
if (bPtr >= bLen) {
// ran out of B: break so we test strings
break;
}
startB = listB[bPtr++]; // depends on control dependency: [if], data = [none]
limitB = listB[bPtr++]; // depends on control dependency: [if], data = [none]
}
// if B is higher than any part of A, get new A
if (startB >= limitA) {
needA = true; // depends on control dependency: [if], data = [none]
needB = false; // depends on control dependency: [if], data = [none]
continue;
}
// if A is higher than any part of B, get new B
if (startA >= limitB) {
needA = false; // depends on control dependency: [if], data = [none]
needB = true; // depends on control dependency: [if], data = [none]
continue;
}
// all other combinations mean we fail
return false; // depends on control dependency: [while], data = [none]
}
if (!SortedSetRelation.hasRelation(strings, SortedSetRelation.DISJOINT, b.strings)) return false;
return true;
} } |
public class class_name {
public void startGui(final Stage mainStage) {
try {
onStageCreated(mainStage);
final Scene mainScene = getScene(mainComponent());
onSceneCreated(mainScene);
mainStage.setScene(mainScene);
mainStage.setTitle(title());
Option.ofOptional(getStylesheet())
.filter(style -> !FxmlStylesheets.DEFAULT_JAVAFX_STYLE.equals(style))
.peek(stylesheet -> this.setTheme(stylesheet, mainStage));
mainStage.show();
} catch (Throwable t) {
LOGGER.error("There was a failure during start-up.", t);
}
} } | public class class_name {
public void startGui(final Stage mainStage) {
try {
onStageCreated(mainStage); // depends on control dependency: [try], data = [none]
final Scene mainScene = getScene(mainComponent());
onSceneCreated(mainScene); // depends on control dependency: [try], data = [none]
mainStage.setScene(mainScene); // depends on control dependency: [try], data = [none]
mainStage.setTitle(title()); // depends on control dependency: [try], data = [none]
Option.ofOptional(getStylesheet())
.filter(style -> !FxmlStylesheets.DEFAULT_JAVAFX_STYLE.equals(style))
.peek(stylesheet -> this.setTheme(stylesheet, mainStage)); // depends on control dependency: [try], data = [none]
mainStage.show(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOGGER.error("There was a failure during start-up.", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unused") // called through reflection by RequestServer
public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
if ("void".equals(docs.schemaname)) {
docs.schemas = new SchemaMetadataV3[0];
return docs;
}
docs.schemas = new SchemaMetadataV3[1];
// NOTE: this will throw an exception if the classname isn't found:
Schema schema = Schema.newInstance(docs.schemaname);
// get defaults
try {
Iced impl = (Iced) schema.getImplClass().newInstance();
schema.fillFromImpl(impl);
}
catch (Exception e) {
// ignore if create fails; this can happen for abstract classes
}
SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
docs.schemas[0] = meta;
return docs;
} } | public class class_name {
@SuppressWarnings("unused") // called through reflection by RequestServer
public MetadataV3 fetchSchemaMetadata(int version, MetadataV3 docs) {
if ("void".equals(docs.schemaname)) {
docs.schemas = new SchemaMetadataV3[0]; // depends on control dependency: [if], data = [none]
return docs; // depends on control dependency: [if], data = [none]
}
docs.schemas = new SchemaMetadataV3[1];
// NOTE: this will throw an exception if the classname isn't found:
Schema schema = Schema.newInstance(docs.schemaname);
// get defaults
try {
Iced impl = (Iced) schema.getImplClass().newInstance();
schema.fillFromImpl(impl); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
// ignore if create fails; this can happen for abstract classes
} // depends on control dependency: [catch], data = [none]
SchemaMetadataV3 meta = new SchemaMetadataV3(new SchemaMetadata(schema));
docs.schemas[0] = meta;
return docs;
} } |
public class class_name {
@Override
boolean checkNodes(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) {
boolean found = false;
if (paramNewRtx.getNode().getDataKey() == paramOldRtx.getNode().getDataKey()) {
if (paramNewRtx.getNode().getKind() == paramOldRtx.getNode().getKind()) {
switch (paramNewRtx.getNode().getKind()) {
case IConstants.ELEMENT:
if (paramNewRtx.getQNameOfCurrentNode().equals(paramOldRtx.getQNameOfCurrentNode())) {
found = true;
}
break;
case IConstants.TEXT:
if (paramNewRtx.getValueOfCurrentNode().equals(paramOldRtx.getValueOfCurrentNode())) {
found = true;
}
break;
}
}
}
return found;
} } | public class class_name {
@Override
boolean checkNodes(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx) {
boolean found = false;
if (paramNewRtx.getNode().getDataKey() == paramOldRtx.getNode().getDataKey()) {
if (paramNewRtx.getNode().getKind() == paramOldRtx.getNode().getKind()) {
switch (paramNewRtx.getNode().getKind()) {
case IConstants.ELEMENT:
if (paramNewRtx.getQNameOfCurrentNode().equals(paramOldRtx.getQNameOfCurrentNode())) {
found = true; // depends on control dependency: [if], data = [none]
}
break;
case IConstants.TEXT:
if (paramNewRtx.getValueOfCurrentNode().equals(paramOldRtx.getValueOfCurrentNode())) {
found = true; // depends on control dependency: [if], data = [none]
}
break;
}
}
}
return found;
} } |
public class class_name {
public java.time.Duration toTemporalAmount() {
if (this.scale == TimeScale.POSIX) {
return java.time.Duration.ofSeconds(this.seconds, this.nanos);
} else {
throw new IllegalStateException(
"Can only convert based on "java.util.concurrent.TimeUnit": " + this);
}
} } | public class class_name {
public java.time.Duration toTemporalAmount() {
if (this.scale == TimeScale.POSIX) {
return java.time.Duration.ofSeconds(this.seconds, this.nanos); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException(
"Can only convert based on "java.util.concurrent.TimeUnit": " + this);
}
} } |
public class class_name {
@Override
public void cacheResult(
List<CPRuleAssetCategoryRel> cpRuleAssetCategoryRels) {
for (CPRuleAssetCategoryRel cpRuleAssetCategoryRel : cpRuleAssetCategoryRels) {
if (entityCache.getResult(
CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class,
cpRuleAssetCategoryRel.getPrimaryKey()) == null) {
cacheResult(cpRuleAssetCategoryRel);
}
else {
cpRuleAssetCategoryRel.resetOriginalValues();
}
}
} } | public class class_name {
@Override
public void cacheResult(
List<CPRuleAssetCategoryRel> cpRuleAssetCategoryRels) {
for (CPRuleAssetCategoryRel cpRuleAssetCategoryRel : cpRuleAssetCategoryRels) {
if (entityCache.getResult(
CPRuleAssetCategoryRelModelImpl.ENTITY_CACHE_ENABLED,
CPRuleAssetCategoryRelImpl.class,
cpRuleAssetCategoryRel.getPrimaryKey()) == null) {
cacheResult(cpRuleAssetCategoryRel); // depends on control dependency: [if], data = [none]
}
else {
cpRuleAssetCategoryRel.resetOriginalValues(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public byte[] getBytes(int key) {
PebbleTuple tuple = getTuple(key, PebbleTuple.TupleType.BYTES);
if (tuple == null) {
return null;
}
return (byte[]) tuple.value;
} } | public class class_name {
public byte[] getBytes(int key) {
PebbleTuple tuple = getTuple(key, PebbleTuple.TupleType.BYTES);
if (tuple == null) {
return null; // depends on control dependency: [if], data = [none]
}
return (byte[]) tuple.value;
} } |
public class class_name {
public void fireRelationWrittenEvent(Relation relation)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.relationWritten(relation);
}
}
} } | public class class_name {
public void fireRelationWrittenEvent(Relation relation)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
listener.relationWritten(relation); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
public List<GridFSDBFile> find(final DBObject query, final DBObject sort, final int firstResult,
final int maxResult)
{
List<GridFSDBFile> files = new ArrayList<GridFSDBFile>();
DBCursor c = null;
try
{
c = getFilesCollection().find(query);
if (sort != null)
{
c.sort(sort);
}
c.skip(firstResult).limit(maxResult);
while (c.hasNext())
{
files.add(findOne(c.next()));
}
}
finally
{
if (c != null)
{
c.close();
}
}
return files;
} } | public class class_name {
public List<GridFSDBFile> find(final DBObject query, final DBObject sort, final int firstResult,
final int maxResult)
{
List<GridFSDBFile> files = new ArrayList<GridFSDBFile>();
DBCursor c = null;
try
{
c = getFilesCollection().find(query); // depends on control dependency: [try], data = [none]
if (sort != null)
{
c.sort(sort); // depends on control dependency: [if], data = [(sort]
}
c.skip(firstResult).limit(maxResult); // depends on control dependency: [try], data = [none]
while (c.hasNext())
{
files.add(findOne(c.next())); // depends on control dependency: [while], data = [none]
}
}
finally
{
if (c != null)
{
c.close(); // depends on control dependency: [if], data = [none]
}
}
return files;
} } |
public class class_name {
public static void setFileHandler(Object target, Method fileHandler) {
setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) {
// Override OSXAdapter.callTarget to send information on the
// file to be opened
public boolean callTarget(Object appleEvent) {
if (appleEvent != null) {
try {
Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null);
String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null);
this.targetMethod.invoke(this.targetObject, new Object[] { filename });
} catch (Exception ex) {
}
}
return true;
}
});
} } | public class class_name {
public static void setFileHandler(Object target, Method fileHandler) {
setHandler(new OSXAdapter("handleOpenFile", target, fileHandler) {
// Override OSXAdapter.callTarget to send information on the
// file to be opened
public boolean callTarget(Object appleEvent) {
if (appleEvent != null) {
try {
Method getFilenameMethod = appleEvent.getClass().getDeclaredMethod("getFilename", (Class[])null);
String filename = (String) getFilenameMethod.invoke(appleEvent, (Object[])null);
this.targetMethod.invoke(this.targetObject, new Object[] { filename }); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
}
return true;
}
});
} } |
public class class_name {
public static Object invokeMethod(Object obj, String name, Object... args) {
if (obj == null)
throw new NullPointerException("Object cannot be null");
if (name == null)
throw new NullPointerException("Method name cannot be null");
Class<?> objClass = obj.getClass();
for (Method method : objClass.getMethods()) {
try {
if (matchMethod(method, name))
return method.invoke(obj, args);
} catch (Throwable t) {
// Ignore exceptions
}
}
return null;
} } | public class class_name {
public static Object invokeMethod(Object obj, String name, Object... args) {
if (obj == null)
throw new NullPointerException("Object cannot be null");
if (name == null)
throw new NullPointerException("Method name cannot be null");
Class<?> objClass = obj.getClass();
for (Method method : objClass.getMethods()) {
try {
if (matchMethod(method, name))
return method.invoke(obj, args);
} catch (Throwable t) {
// Ignore exceptions
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
@ApiOperation(value="Schedules a job and returns the ID for the new job.",
response=Long.class, code=201)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"),
@ApiResponse(code = 201, message = "Successfull response", examples=@Example(value= {
@ExampleProperty(mediaType=JSON, value=CREATE_JOB_RESPONSE_JSON)})) })
@POST
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response scheduleRequest(@javax.ws.rs.core.Context HttpHeaders headers,
@ApiParam(value = "optional container id that the job should be associated with", required = false) @QueryParam("containerId") String containerId,
@ApiParam(value = "asynchronous job definition represented as JobRequestInstance", required = true, examples=@Example(value= {
@ExampleProperty(mediaType=JSON, value=JOB_JSON),
@ExampleProperty(mediaType=XML, value=JOB_XML)})) String payload) {
Variant v = getVariant(headers);
String type = getContentType(headers);
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
try {
String response = executorServiceBase.scheduleRequest(containerId, payload, type);
logger.debug("Returning CREATED response with content '{}'", response);
return createResponse(response, v, Response.Status.CREATED, conversationIdHeader);
} catch (IllegalArgumentException e) {
logger.error("Invalid Command type ", e.getMessage(), e);
return internalServerError( e.getMessage(), v, conversationIdHeader);
} catch (Exception e) {
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
}
} } | public class class_name {
@ApiOperation(value="Schedules a job and returns the ID for the new job.",
response=Long.class, code=201)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Unexpected error"),
@ApiResponse(code = 201, message = "Successfull response", examples=@Example(value= {
@ExampleProperty(mediaType=JSON, value=CREATE_JOB_RESPONSE_JSON)})) })
@POST
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response scheduleRequest(@javax.ws.rs.core.Context HttpHeaders headers,
@ApiParam(value = "optional container id that the job should be associated with", required = false) @QueryParam("containerId") String containerId,
@ApiParam(value = "asynchronous job definition represented as JobRequestInstance", required = true, examples=@Example(value= {
@ExampleProperty(mediaType=JSON, value=JOB_JSON),
@ExampleProperty(mediaType=XML, value=JOB_XML)})) String payload) {
Variant v = getVariant(headers);
String type = getContentType(headers);
// no container id available so only used to transfer conversation id if given by client
Header conversationIdHeader = buildConversationIdHeader("", context, headers);
try {
String response = executorServiceBase.scheduleRequest(containerId, payload, type);
logger.debug("Returning CREATED response with content '{}'", response); // depends on control dependency: [try], data = [none]
return createResponse(response, v, Response.Status.CREATED, conversationIdHeader); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
logger.error("Invalid Command type ", e.getMessage(), e);
return internalServerError( e.getMessage(), v, conversationIdHeader);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
logger.error("Unexpected error during processing {}", e.getMessage(), e);
return internalServerError(errorMessage(e), v, conversationIdHeader);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void handleHttpQuery(final TSDB tsdb, final Channel chan, final HttpRequest req) {
AbstractHttpQuery abstractQuery = null;
try {
abstractQuery = createQueryInstance(tsdb, req, chan);
if (!tsdb.getConfig().enable_chunked_requests() && req.isChunked()) {
logError(abstractQuery, "Received an unsupported chunked request: "
+ abstractQuery.request());
abstractQuery.badRequest(new BadRequestException("Chunked request not supported."));
return;
}
// NOTE: Some methods in HttpQuery have side-effects (getQueryBaseRoute and
// setSerializer for instance) so invocation order is important here.
final String route = abstractQuery.getQueryBaseRoute();
if (abstractQuery.getClass().isAssignableFrom(HttpRpcPluginQuery.class)) {
if (applyCorsConfig(req, abstractQuery)) {
return;
}
final HttpRpcPluginQuery pluginQuery = (HttpRpcPluginQuery) abstractQuery;
final HttpRpcPlugin rpc = rpc_manager.lookupHttpRpcPlugin(route);
if (rpc != null) {
rpc.execute(tsdb, pluginQuery);
} else {
pluginQuery.notFound();
}
} else if (abstractQuery.getClass().isAssignableFrom(HttpQuery.class)) {
final HttpQuery builtinQuery = (HttpQuery) abstractQuery;
builtinQuery.setSerializer();
if (applyCorsConfig(req, abstractQuery)) {
return;
}
final HttpRpc rpc = rpc_manager.lookupHttpRpc(route);
if (rpc != null) {
rpc.execute(tsdb, builtinQuery);
} else {
builtinQuery.notFound();
}
} else {
throw new IllegalStateException("Unknown instance of AbstractHttpQuery: "
+ abstractQuery.getClass().getName());
}
} catch (BadRequestException ex) {
if (abstractQuery == null) {
LOG.warn("{} Unable to create query for {}. Reason: {}", chan, req, ex);
sendStatusAndClose(chan, HttpResponseStatus.BAD_REQUEST);
} else {
abstractQuery.badRequest(ex);
}
} catch (Exception ex) {
exceptions_caught.incrementAndGet();
if (abstractQuery == null) {
LOG.warn("{} Unexpected error handling HTTP request {}. Reason: {} ", chan, req, ex);
sendStatusAndClose(chan, HttpResponseStatus.INTERNAL_SERVER_ERROR);
} else {
abstractQuery.internalError(ex);
}
}
} } | public class class_name {
private void handleHttpQuery(final TSDB tsdb, final Channel chan, final HttpRequest req) {
AbstractHttpQuery abstractQuery = null;
try {
abstractQuery = createQueryInstance(tsdb, req, chan); // depends on control dependency: [try], data = [none]
if (!tsdb.getConfig().enable_chunked_requests() && req.isChunked()) {
logError(abstractQuery, "Received an unsupported chunked request: "
+ abstractQuery.request()); // depends on control dependency: [if], data = [none]
abstractQuery.badRequest(new BadRequestException("Chunked request not supported.")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// NOTE: Some methods in HttpQuery have side-effects (getQueryBaseRoute and
// setSerializer for instance) so invocation order is important here.
final String route = abstractQuery.getQueryBaseRoute();
if (abstractQuery.getClass().isAssignableFrom(HttpRpcPluginQuery.class)) {
if (applyCorsConfig(req, abstractQuery)) {
return; // depends on control dependency: [if], data = [none]
}
final HttpRpcPluginQuery pluginQuery = (HttpRpcPluginQuery) abstractQuery;
final HttpRpcPlugin rpc = rpc_manager.lookupHttpRpcPlugin(route);
if (rpc != null) {
rpc.execute(tsdb, pluginQuery); // depends on control dependency: [if], data = [none]
} else {
pluginQuery.notFound(); // depends on control dependency: [if], data = [none]
}
} else if (abstractQuery.getClass().isAssignableFrom(HttpQuery.class)) {
final HttpQuery builtinQuery = (HttpQuery) abstractQuery;
builtinQuery.setSerializer(); // depends on control dependency: [if], data = [none]
if (applyCorsConfig(req, abstractQuery)) {
return; // depends on control dependency: [if], data = [none]
}
final HttpRpc rpc = rpc_manager.lookupHttpRpc(route);
if (rpc != null) {
rpc.execute(tsdb, builtinQuery); // depends on control dependency: [if], data = [none]
} else {
builtinQuery.notFound(); // depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalStateException("Unknown instance of AbstractHttpQuery: "
+ abstractQuery.getClass().getName());
}
} catch (BadRequestException ex) {
if (abstractQuery == null) {
LOG.warn("{} Unable to create query for {}. Reason: {}", chan, req, ex); // depends on control dependency: [if], data = [none]
sendStatusAndClose(chan, HttpResponseStatus.BAD_REQUEST); // depends on control dependency: [if], data = [none]
} else {
abstractQuery.badRequest(ex); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
exceptions_caught.incrementAndGet();
if (abstractQuery == null) {
LOG.warn("{} Unexpected error handling HTTP request {}. Reason: {} ", chan, req, ex); // depends on control dependency: [if], data = [none]
sendStatusAndClose(chan, HttpResponseStatus.INTERNAL_SERVER_ERROR); // depends on control dependency: [if], data = [none]
} else {
abstractQuery.internalError(ex); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) {
if (scaleParam != null) {
CmsImageScaler cropScaler = null;
// use cropped image as a base for scaling
cropScaler = new CmsImageScaler(scaleParam);
if (scaler.getType() == 5) {
// must reset height / width parameters in crop scaler for type 5
cropScaler.setWidth(cropScaler.getCropWidth());
cropScaler.setHeight(cropScaler.getCropHeight());
}
scaler = cropScaler.getCropScaler(scaler);
}
// calculate target scale dimensions (if required)
if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0))
|| ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) {
// read the image properties for the selected resource
if (original.isValid()) {
scaler = original.getReScaler(scaler);
}
}
return scaler;
} } | public class class_name {
public static CmsImageScaler getScaler(CmsImageScaler scaler, CmsImageScaler original, String scaleParam) {
if (scaleParam != null) {
CmsImageScaler cropScaler = null;
// use cropped image as a base for scaling
cropScaler = new CmsImageScaler(scaleParam); // depends on control dependency: [if], data = [(scaleParam]
if (scaler.getType() == 5) {
// must reset height / width parameters in crop scaler for type 5
cropScaler.setWidth(cropScaler.getCropWidth()); // depends on control dependency: [if], data = [none]
cropScaler.setHeight(cropScaler.getCropHeight()); // depends on control dependency: [if], data = [none]
}
scaler = cropScaler.getCropScaler(scaler); // depends on control dependency: [if], data = [none]
}
// calculate target scale dimensions (if required)
if (((scaler.getHeight() <= 0) || (scaler.getWidth() <= 0))
|| ((scaler.getType() == 5) && scaler.isValid() && !scaler.isCropping())) {
// read the image properties for the selected resource
if (original.isValid()) {
scaler = original.getReScaler(scaler); // depends on control dependency: [if], data = [none]
}
}
return scaler;
} } |
public class class_name {
public static double getSwapAnnuity(double evaluationTime, ScheduleInterface schedule, DiscountCurveInterface discountCurve, AnalyticModelInterface model) {
double value = 0.0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
if(paymentDate <= evaluationTime) {
continue;
}
double periodLength = schedule.getPeriodLength(periodIndex);
double discountFactor = discountCurve.getDiscountFactor(model, paymentDate);
value += periodLength * discountFactor;
}
return value / discountCurve.getDiscountFactor(model, evaluationTime);
} } | public class class_name {
public static double getSwapAnnuity(double evaluationTime, ScheduleInterface schedule, DiscountCurveInterface discountCurve, AnalyticModelInterface model) {
double value = 0.0;
for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) {
double paymentDate = schedule.getPayment(periodIndex);
if(paymentDate <= evaluationTime) {
continue;
}
double periodLength = schedule.getPeriodLength(periodIndex);
double discountFactor = discountCurve.getDiscountFactor(model, paymentDate);
value += periodLength * discountFactor; // depends on control dependency: [for], data = [none]
}
return value / discountCurve.getDiscountFactor(model, evaluationTime);
} } |
public class class_name {
public void addCc(String cc) {
if (this.cc.length() > 0) {
this.cc.append(",");
}
this.cc.append(cc);
} } | public class class_name {
public void addCc(String cc) {
if (this.cc.length() > 0) {
this.cc.append(","); // depends on control dependency: [if], data = [none]
}
this.cc.append(cc);
} } |
public class class_name {
public OvhOptionsBuilder smsCoding(String... smsCoding) {
for (String s : smsCoding) {
if (s != null) {
smsCodings.add(s);
}
}
return this;
} } | public class class_name {
public OvhOptionsBuilder smsCoding(String... smsCoding) {
for (String s : smsCoding) {
if (s != null) {
smsCodings.add(s); // depends on control dependency: [if], data = [(s]
}
}
return this;
} } |
public class class_name {
@Override
protected void onReset() {
if (DEBUG) { Log.v(TAG, "onReset " + this); }
super.onReset();
onStopLoading();
if (receivedResponse != null) {
onReleaseData(receivedResponse);
receivedResponse = null;
}
} } | public class class_name {
@Override
protected void onReset() {
if (DEBUG) { Log.v(TAG, "onReset " + this); } // depends on control dependency: [if], data = [none]
super.onReset();
onStopLoading();
if (receivedResponse != null) {
onReleaseData(receivedResponse); // depends on control dependency: [if], data = [(receivedResponse]
receivedResponse = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<LDAPEntry> search(LDAPConnection ldapConnection,
String baseDN, String query) throws GuacamoleException {
logger.debug("Searching \"{}\" for objects matching \"{}\".", baseDN, query);
try {
// Search within subtree of given base DN
LDAPSearchResults results = ldapConnection.search(baseDN,
LDAPConnection.SCOPE_SUB, query, null, false,
confService.getLDAPSearchConstraints());
// Produce list of all entries in the search result, automatically
// following referrals if configured to do so
List<LDAPEntry> entries = new ArrayList<>(results.getCount());
while (results.hasMore()) {
try {
entries.add(results.next());
}
// Warn if referrals cannot be followed
catch (LDAPReferralException e) {
if (confService.getFollowReferrals()) {
logger.error("Could not follow referral: {}", e.getFailedReferral());
logger.debug("Error encountered trying to follow referral.", e);
throw new GuacamoleServerException("Could not follow LDAP referral.", e);
}
else {
logger.warn("Given a referral, but referrals are disabled. Error was: {}", e.getMessage());
logger.debug("Got a referral, but configured to not follow them.", e);
}
}
catch (LDAPException e) {
logger.warn("Failed to process an LDAP search result. Error was: {}", e.resultCodeToString());
logger.debug("Error processing LDAPEntry search result.", e);
}
}
return entries;
}
catch (LDAPException | GuacamoleException e) {
throw new GuacamoleServerException("Unable to query list of "
+ "objects from LDAP directory.", e);
}
} } | public class class_name {
public List<LDAPEntry> search(LDAPConnection ldapConnection,
String baseDN, String query) throws GuacamoleException {
logger.debug("Searching \"{}\" for objects matching \"{}\".", baseDN, query);
try {
// Search within subtree of given base DN
LDAPSearchResults results = ldapConnection.search(baseDN,
LDAPConnection.SCOPE_SUB, query, null, false,
confService.getLDAPSearchConstraints());
// Produce list of all entries in the search result, automatically
// following referrals if configured to do so
List<LDAPEntry> entries = new ArrayList<>(results.getCount());
while (results.hasMore()) {
try {
entries.add(results.next()); // depends on control dependency: [try], data = [none]
}
// Warn if referrals cannot be followed
catch (LDAPReferralException e) {
if (confService.getFollowReferrals()) {
logger.error("Could not follow referral: {}", e.getFailedReferral()); // depends on control dependency: [if], data = [none]
logger.debug("Error encountered trying to follow referral.", e); // depends on control dependency: [if], data = [none]
throw new GuacamoleServerException("Could not follow LDAP referral.", e);
}
else {
logger.warn("Given a referral, but referrals are disabled. Error was: {}", e.getMessage()); // depends on control dependency: [if], data = [none]
logger.debug("Got a referral, but configured to not follow them.", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
catch (LDAPException e) {
logger.warn("Failed to process an LDAP search result. Error was: {}", e.resultCodeToString());
logger.debug("Error processing LDAPEntry search result.", e);
} // depends on control dependency: [catch], data = [none]
}
return entries;
}
catch (LDAPException | GuacamoleException e) {
throw new GuacamoleServerException("Unable to query list of "
+ "objects from LDAP directory.", e);
}
} } |
public class class_name {
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) {
if(!isMultiple()) {
int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1;
Integer myPrefix = getSegmentPrefixLength();
Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0);
Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1);
if(index >= 0 && index < segs.length) {
segs[index] = creator.createSegment(highByte(), highPrefixBits);
}
if(++index >= 0 && index < segs.length) {
segs[index] = creator.createSegment(lowByte(), lowPrefixBits);
}
} else {
getSplitSegmentsMultiple(segs, index, creator);
}
} } | public class class_name {
public <S extends AddressSegment> void getSplitSegments(S segs[], int index, AddressSegmentCreator<S> creator) {
if(!isMultiple()) {
int bitSizeSplit = IPv6Address.BITS_PER_SEGMENT >>> 1;
Integer myPrefix = getSegmentPrefixLength();
Integer highPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 0);
Integer lowPrefixBits = getSplitSegmentPrefix(bitSizeSplit, myPrefix, 1);
if(index >= 0 && index < segs.length) {
segs[index] = creator.createSegment(highByte(), highPrefixBits);
// depends on control dependency: [if], data = [none]
}
if(++index >= 0 && index < segs.length) {
segs[index] = creator.createSegment(lowByte(), lowPrefixBits);
// depends on control dependency: [if], data = [none]
}
} else {
getSplitSegmentsMultiple(segs, index, creator);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean hasDelimiter(String word, String[] delimiters) {
boolean delim = false;
for (int i = 0; i < delimiters.length; i++) {
if (word.indexOf(delimiters[i]) > -1) {
delim = true;
break;
}
}
return delim;
} } | public class class_name {
private boolean hasDelimiter(String word, String[] delimiters) {
boolean delim = false;
for (int i = 0; i < delimiters.length; i++) {
if (word.indexOf(delimiters[i]) > -1) {
delim = true; // depends on control dependency: [if], data = [none]
break;
}
}
return delim;
} } |
public class class_name {
public EpollServerSocketChannelConfig setTcpDeferAccept(int deferAccept) {
try {
((EpollServerSocketChannel) channel).socket.setTcpDeferAccept(deferAccept);
return this;
} catch (IOException e) {
throw new ChannelException(e);
}
} } | public class class_name {
public EpollServerSocketChannelConfig setTcpDeferAccept(int deferAccept) {
try {
((EpollServerSocketChannel) channel).socket.setTcpDeferAccept(deferAccept); // depends on control dependency: [try], data = [none]
return this; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new ChannelException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static ExpressionInfo expressionInfo(String code, JShell state) {
if (code == null || code.isEmpty()) {
return null;
}
try {
OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodReturnWrap(code));
AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
CompilationUnitTree cu = at.firstCuTree();
if (at.hasErrors() || cu == null) {
return null;
}
return new ExpressionToTypeInfo(at, cu, state).typeOfExpression();
} catch (Exception ex) {
return null;
}
} } | public class class_name {
public static ExpressionInfo expressionInfo(String code, JShell state) {
if (code == null || code.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
try {
OuterWrap codeWrap = state.outerMap.wrapInTrialClass(Wrap.methodReturnWrap(code));
AnalyzeTask at = state.taskFactory.new AnalyzeTask(codeWrap);
CompilationUnitTree cu = at.firstCuTree();
if (at.hasErrors() || cu == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new ExpressionToTypeInfo(at, cu, state).typeOfExpression(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean pollResource() throws AmazonServiceException, WaiterTimedOutException, WaiterUnrecoverableException {
int retriesAttempted = 0;
while (true) {
switch (getCurrentState()) {
case SUCCESS:
return true;
case FAILURE:
throw new WaiterUnrecoverableException("Resource never entered the desired state as it failed.");
case RETRY:
PollingStrategyContext pollingStrategyContext = new PollingStrategyContext(request, retriesAttempted);
if (pollingStrategy.getRetryStrategy().shouldRetry(pollingStrategyContext)) {
safeCustomDelay(pollingStrategyContext);
retriesAttempted++;
} else {
throw new WaiterTimedOutException("Reached maximum attempts without transitioning to the desired state");
}
break;
}
}
} } | public class class_name {
public boolean pollResource() throws AmazonServiceException, WaiterTimedOutException, WaiterUnrecoverableException {
int retriesAttempted = 0;
while (true) {
switch (getCurrentState()) {
case SUCCESS:
return true;
case FAILURE:
throw new WaiterUnrecoverableException("Resource never entered the desired state as it failed.");
case RETRY:
PollingStrategyContext pollingStrategyContext = new PollingStrategyContext(request, retriesAttempted);
if (pollingStrategy.getRetryStrategy().shouldRetry(pollingStrategyContext)) {
safeCustomDelay(pollingStrategyContext); // depends on control dependency: [if], data = [none]
retriesAttempted++; // depends on control dependency: [if], data = [none]
} else {
throw new WaiterTimedOutException("Reached maximum attempts without transitioning to the desired state");
}
break;
}
}
} } |
public class class_name {
public List<JavaInformations> getJavaInformationsByApplication(String application) {
// application peut être null
if (application == null) {
return null;
}
final RemoteCollector remoteCollector = remoteCollectorsByApplication.get(application);
if (remoteCollector == null) {
return null;
}
return remoteCollector.getJavaInformationsList();
} } | public class class_name {
public List<JavaInformations> getJavaInformationsByApplication(String application) {
// application peut être null
if (application == null) {
return null;
// depends on control dependency: [if], data = [none]
}
final RemoteCollector remoteCollector = remoteCollectorsByApplication.get(application);
if (remoteCollector == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return remoteCollector.getJavaInformationsList();
} } |
public class class_name {
public static List<MtgSet> getAllSetsWithCards() {
List<MtgSet> returnList = getList(RESOURCE_PATH, "sets", MtgSet.class);
for(MtgSet set : returnList){
set.setCards(CardAPI.getAllCards(new LinkedList<>(Collections.singletonList("set=" + set.getCode()))));
}
return returnList;
} } | public class class_name {
public static List<MtgSet> getAllSetsWithCards() {
List<MtgSet> returnList = getList(RESOURCE_PATH, "sets", MtgSet.class);
for(MtgSet set : returnList){
set.setCards(CardAPI.getAllCards(new LinkedList<>(Collections.singletonList("set=" + set.getCode())))); // depends on control dependency: [for], data = [set]
}
return returnList;
} } |
public class class_name {
private static void encodeTabAnchorTag(FacesContext context, ResponseWriter writer, Tab tab,
String hiddenInputFieldID, int tabindex, boolean disabled) throws IOException {
writer.startElement("a", tab);
writer.writeAttribute("id", tab.getClientId().replace(":", "_") + "_tab", "id");
writer.writeAttribute("role", "tab", "role");
if (tab.isDisabled() || disabled) {
writer.writeAttribute("onclick", "event.preventDefault(); return false;", null);
} else {
writer.writeAttribute("data-toggle", "tab", "data-toggle");
writer.writeAttribute("href", "#" + tab.getClientId().replace(":", "_") + "_pane", "href");
String onclick = "document.getElementById('" + hiddenInputFieldID + "').value='" + String.valueOf(tabindex)
+ "';";
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, tab, writer, "click", onclick, false, true);
}
R.encodeHTML4DHTMLAttrs(writer, tab.getAttributes(), new String[] { "style", "tabindex" });
UIComponent iconFacet = tab.getFacet("anchor");
if (null != iconFacet) {
iconFacet.encodeAll(FacesContext.getCurrentInstance());
if (null != tab.getTitle()) {
writer.writeText(" " + tab.getTitle(), null);
}
} else {
writer.writeText(tab.getTitle(), null);
}
writer.endElement("a");
} } | public class class_name {
private static void encodeTabAnchorTag(FacesContext context, ResponseWriter writer, Tab tab,
String hiddenInputFieldID, int tabindex, boolean disabled) throws IOException {
writer.startElement("a", tab);
writer.writeAttribute("id", tab.getClientId().replace(":", "_") + "_tab", "id");
writer.writeAttribute("role", "tab", "role");
if (tab.isDisabled() || disabled) {
writer.writeAttribute("onclick", "event.preventDefault(); return false;", null);
} else {
writer.writeAttribute("data-toggle", "tab", "data-toggle");
writer.writeAttribute("href", "#" + tab.getClientId().replace(":", "_") + "_pane", "href");
String onclick = "document.getElementById('" + hiddenInputFieldID + "').value='" + String.valueOf(tabindex)
+ "';";
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, tab, writer, "click", onclick, false, true);
}
R.encodeHTML4DHTMLAttrs(writer, tab.getAttributes(), new String[] { "style", "tabindex" });
UIComponent iconFacet = tab.getFacet("anchor");
if (null != iconFacet) {
iconFacet.encodeAll(FacesContext.getCurrentInstance());
if (null != tab.getTitle()) {
writer.writeText(" " + tab.getTitle(), null); // depends on control dependency: [if], data = [none]
}
} else {
writer.writeText(tab.getTitle(), null);
}
writer.endElement("a");
} } |
public class class_name {
public DeleteMessageResult deleteMessage(DeleteMessageRequest deleteMessageRequest) {
if (deleteMessageRequest == null) {
String errorMessage = "deleteMessageRequest cannot be null.";
LOG.error(errorMessage);
throw new AmazonClientException(errorMessage);
}
deleteMessageRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER);
if (!clientConfiguration.isLargePayloadSupportEnabled()) {
return super.deleteMessage(deleteMessageRequest);
}
String receiptHandle = deleteMessageRequest.getReceiptHandle();
String origReceiptHandle = receiptHandle;
if (isS3ReceiptHandle(receiptHandle)) {
deleteMessagePayloadFromS3(receiptHandle);
origReceiptHandle = getOrigReceiptHandle(receiptHandle);
}
deleteMessageRequest.setReceiptHandle(origReceiptHandle);
return super.deleteMessage(deleteMessageRequest);
} } | public class class_name {
public DeleteMessageResult deleteMessage(DeleteMessageRequest deleteMessageRequest) {
if (deleteMessageRequest == null) {
String errorMessage = "deleteMessageRequest cannot be null.";
LOG.error(errorMessage); // depends on control dependency: [if], data = [none]
throw new AmazonClientException(errorMessage);
}
deleteMessageRequest.getRequestClientOptions().appendUserAgent(SQSExtendedClientConstants.USER_AGENT_HEADER);
if (!clientConfiguration.isLargePayloadSupportEnabled()) {
return super.deleteMessage(deleteMessageRequest); // depends on control dependency: [if], data = [none]
}
String receiptHandle = deleteMessageRequest.getReceiptHandle();
String origReceiptHandle = receiptHandle;
if (isS3ReceiptHandle(receiptHandle)) {
deleteMessagePayloadFromS3(receiptHandle); // depends on control dependency: [if], data = [none]
origReceiptHandle = getOrigReceiptHandle(receiptHandle); // depends on control dependency: [if], data = [none]
}
deleteMessageRequest.setReceiptHandle(origReceiptHandle);
return super.deleteMessage(deleteMessageRequest);
} } |
public class class_name {
public List<org.openprovenance.prov.model.LangString> getLabel() {
if (label == null) {
label = new ArrayList<org.openprovenance.prov.model.LangString>();
}
return this.label;
} } | public class class_name {
public List<org.openprovenance.prov.model.LangString> getLabel() {
if (label == null) {
label = new ArrayList<org.openprovenance.prov.model.LangString>(); // depends on control dependency: [if], data = [none]
}
return this.label;
} } |
public class class_name {
public void setVideoDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
videoConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
}
} } | public class class_name {
public void setVideoDecoderConfiguration(IRTMPEvent decoderConfig) {
if (decoderConfig instanceof IStreamData) {
IoBuffer data = ((IStreamData<?>) decoderConfig).getData().asReadOnlyBuffer();
videoConfigurationTag = ImmutableTag.build(decoderConfig.getDataType(), 0, data, 0);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void validateConfiguration(String configuration) {
try {
JSONObject json = new JSONObject(configuration);
String className = json.optString(CmsDataViewConstants.CONFIG_VIEW_CLASS);
Class<?> cls = Class.forName(className, false, getClass().getClassLoader());
if (!I_CmsDataView.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException(
"Class " + cls.getName() + " does not implement " + I_CmsDataView.class.getName());
}
} catch (Exception e) {
throw new CmsWidgetConfigurationException(e);
}
} } | public class class_name {
public void validateConfiguration(String configuration) {
try {
JSONObject json = new JSONObject(configuration);
String className = json.optString(CmsDataViewConstants.CONFIG_VIEW_CLASS);
Class<?> cls = Class.forName(className, false, getClass().getClassLoader());
if (!I_CmsDataView.class.isAssignableFrom(cls)) {
throw new IllegalArgumentException(
"Class " + cls.getName() + " does not implement " + I_CmsDataView.class.getName());
}
} catch (Exception e) {
throw new CmsWidgetConfigurationException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
Table SYSTEM_PROPERTIES() {
Table t = sysTables[SYSTEM_PROPERTIES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_PROPERTIES]);
addColumn(t, "PROPERTY_SCOPE", CHARACTER_DATA);
addColumn(t, "PROPERTY_NAMESPACE", CHARACTER_DATA);
addColumn(t, "PROPERTY_NAME", CHARACTER_DATA);
addColumn(t, "PROPERTY_VALUE", CHARACTER_DATA);
addColumn(t, "PROPERTY_CLASS", CHARACTER_DATA);
// order PROPERTY_SCOPE, PROPERTY_NAMESPACE, PROPERTY_NAME
// true PK
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[SYSTEM_PROPERTIES].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] {
0, 1, 2
}, true);
return t;
}
// column number mappings
final int iscope = 0;
final int ins = 1;
final int iname = 2;
final int ivalue = 3;
final int iclass = 4;
//
PersistentStore store = database.persistentStoreCollection.getStore(t);
// calculated column values
String scope;
String nameSpace;
// intermediate holders
Object[] row;
HsqlDatabaseProperties props;
// First, we want the names and values for
// all JDBC capabilities constants
scope = "SESSION";
props = database.getProperties();
nameSpace = "database.properties";
// boolean properties
Iterator it = props.getUserDefinedPropertyData().iterator();
while (it.hasNext()) {
Object[] metaData = (Object[]) it.next();
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = metaData[HsqlProperties.indexName];
row[ivalue] = props.getProperty((String) row[iname]);
row[iclass] = metaData[HsqlProperties.indexClass];
t.insertSys(store, row);
}
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "SCRIPTFORMAT";
try {
row[ivalue] =
ScriptWriterBase
.LIST_SCRIPT_FORMATS[database.logger.getScriptType()];
} catch (Exception e) {}
row[iclass] = "java.lang.String";
t.insertSys(store, row);
// write delay
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "WRITE_DELAY";
row[ivalue] = "" + database.logger.getWriteDelay();
row[iclass] = "int";
t.insertSys(store, row);
// ignore case
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "IGNORECASE";
row[ivalue] = database.isIgnoreCase() ? "true"
: "false";
row[iclass] = "boolean";
t.insertSys(store, row);
// referential integrity
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "REFERENTIAL_INTEGRITY";
row[ivalue] = database.isReferentialIntegrity() ? "true"
: "false";
row[iclass] = "boolean";
t.insertSys(store, row);
return t;
} } | public class class_name {
Table SYSTEM_PROPERTIES() {
Table t = sysTables[SYSTEM_PROPERTIES];
if (t == null) {
t = createBlankTable(sysTableHsqlNames[SYSTEM_PROPERTIES]); // depends on control dependency: [if], data = [none]
addColumn(t, "PROPERTY_SCOPE", CHARACTER_DATA); // depends on control dependency: [if], data = [(t]
addColumn(t, "PROPERTY_NAMESPACE", CHARACTER_DATA); // depends on control dependency: [if], data = [(t]
addColumn(t, "PROPERTY_NAME", CHARACTER_DATA); // depends on control dependency: [if], data = [(t]
addColumn(t, "PROPERTY_VALUE", CHARACTER_DATA); // depends on control dependency: [if], data = [(t]
addColumn(t, "PROPERTY_CLASS", CHARACTER_DATA); // depends on control dependency: [if], data = [(t]
// order PROPERTY_SCOPE, PROPERTY_NAMESPACE, PROPERTY_NAME
// true PK
HsqlName name = HsqlNameManager.newInfoSchemaObjectName(
sysTableHsqlNames[SYSTEM_PROPERTIES].name, false,
SchemaObject.INDEX);
t.createPrimaryKey(name, new int[] {
0, 1, 2
}, true); // depends on control dependency: [if], data = [none]
return t; // depends on control dependency: [if], data = [none]
}
// column number mappings
final int iscope = 0;
final int ins = 1;
final int iname = 2;
final int ivalue = 3;
final int iclass = 4;
//
PersistentStore store = database.persistentStoreCollection.getStore(t);
// calculated column values
String scope;
String nameSpace;
// intermediate holders
Object[] row;
HsqlDatabaseProperties props;
// First, we want the names and values for
// all JDBC capabilities constants
scope = "SESSION";
props = database.getProperties();
nameSpace = "database.properties";
// boolean properties
Iterator it = props.getUserDefinedPropertyData().iterator();
while (it.hasNext()) {
Object[] metaData = (Object[]) it.next();
row = t.getEmptyRowData(); // depends on control dependency: [while], data = [none]
row[iscope] = scope; // depends on control dependency: [while], data = [none]
row[ins] = nameSpace; // depends on control dependency: [while], data = [none]
row[iname] = metaData[HsqlProperties.indexName]; // depends on control dependency: [while], data = [none]
row[ivalue] = props.getProperty((String) row[iname]); // depends on control dependency: [while], data = [none]
row[iclass] = metaData[HsqlProperties.indexClass]; // depends on control dependency: [while], data = [none]
t.insertSys(store, row); // depends on control dependency: [while], data = [none]
}
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "SCRIPTFORMAT";
try {
row[ivalue] =
ScriptWriterBase
.LIST_SCRIPT_FORMATS[database.logger.getScriptType()]; // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
row[iclass] = "java.lang.String";
t.insertSys(store, row);
// write delay
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "WRITE_DELAY";
row[ivalue] = "" + database.logger.getWriteDelay();
row[iclass] = "int";
t.insertSys(store, row);
// ignore case
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "IGNORECASE";
row[ivalue] = database.isIgnoreCase() ? "true"
: "false";
row[iclass] = "boolean";
t.insertSys(store, row);
// referential integrity
row = t.getEmptyRowData();
row[iscope] = scope;
row[ins] = nameSpace;
row[iname] = "REFERENTIAL_INTEGRITY";
row[ivalue] = database.isReferentialIntegrity() ? "true"
: "false";
row[iclass] = "boolean";
t.insertSys(store, row);
return t;
} } |
public class class_name {
public void createImage(OutputStream stream, int format) {
SWTGraphics g = null;
GC gc = null;
Image image = null;
LayerManager layerManager = (LayerManager)
getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
Rectangle r = figure.getBounds();
try {
image = new Image(Display.getDefault(), r.width, r.height);
gc = new GC(image);
g = new SWTGraphics(gc);
g.translate(r.x * -1, r.y * -1);
figure.paint(g);
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { image.getImageData() };
imageLoader.save(stream, format);
} catch (Throwable t) {
DroolsEclipsePlugin.log(t);
} finally {
if (g != null) {
g.dispose();
}
if (gc != null) {
gc.dispose();
}
if (image != null) {
image.dispose();
}
}
} } | public class class_name {
public void createImage(OutputStream stream, int format) {
SWTGraphics g = null;
GC gc = null;
Image image = null;
LayerManager layerManager = (LayerManager)
getGraphicalViewer().getEditPartRegistry().get(LayerManager.ID);
IFigure figure = layerManager.getLayer(LayerConstants.PRINTABLE_LAYERS);
Rectangle r = figure.getBounds();
try {
image = new Image(Display.getDefault(), r.width, r.height); // depends on control dependency: [try], data = [none]
gc = new GC(image); // depends on control dependency: [try], data = [none]
g = new SWTGraphics(gc); // depends on control dependency: [try], data = [none]
g.translate(r.x * -1, r.y * -1); // depends on control dependency: [try], data = [none]
figure.paint(g); // depends on control dependency: [try], data = [none]
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[] { image.getImageData() }; // depends on control dependency: [try], data = [none]
imageLoader.save(stream, format); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
DroolsEclipsePlugin.log(t);
} finally { // depends on control dependency: [catch], data = [none]
if (g != null) {
g.dispose(); // depends on control dependency: [if], data = [none]
}
if (gc != null) {
gc.dispose(); // depends on control dependency: [if], data = [none]
}
if (image != null) {
image.dispose(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private <C> Iterator<Column<C>> columnScan(final ByteBuffer rowKey,
final DeltaPlacement placement,
final ColumnFamily<ByteBuffer, C> columnFamily,
final C start,
final C end,
final boolean reversed,
final ColumnInc<C> columnInc,
final long limit,
final long page,
final ReadConsistency consistency) {
return Iterators.concat(new AbstractIterator<Iterator<Column<C>>>() {
private C _from = start;
private long _remaining = limit;
private long _page = page;
@Override
protected Iterator<Column<C>> computeNext() {
if (_remaining <= 0) {
return endOfData();
}
// For page N+1, treat "_from" as exclusive. Since Cassandra doesn't support exclusive column ranges
// bump the from value up to the next possible time UUID (assumes from != null when page != 0).
if (_page > 0) {
if (_from.equals(end)) {
return endOfData();
}
_from = reversed ? columnInc.previous(_from) : columnInc.next(_from);
if (_from == null) {
return endOfData();
}
}
// Execute the query
int batchSize = (int) Math.min(_remaining, MAX_COLUMN_SCAN_BATCH);
ColumnList<C> columns = execute(placement.getKeyspace()
.prepareQuery(columnFamily, SorConsistencies.toAstyanax(consistency))
.getKey(rowKey)
.withColumnRange(_from, end, reversed, batchSize),
"scan columns in placement %s, column family %s, row %s, from %s to %s",
placement.getName(), columnFamily.getName(), rowKey, start, end);
// Update state for the next iteration.
if (columns.size() >= batchSize) {
// Save the last column key so we can use it as the start (exclusive) if we must query to get more data.
_from = columns.getColumnByIndex(columns.size() - 1).getName();
_remaining = _remaining - columns.size();
_page++;
} else {
// If we got fewer columns than we asked for, another query won't find more columns.
_remaining = 0;
}
// Track metrics. For rows w/more than 50 columns, count subsequent reads w/_largeRowReadMeter.
(_page == 0 ? _randomReadMeter : _largeRowReadMeter).mark();
return columns.iterator();
}
});
} } | public class class_name {
private <C> Iterator<Column<C>> columnScan(final ByteBuffer rowKey,
final DeltaPlacement placement,
final ColumnFamily<ByteBuffer, C> columnFamily,
final C start,
final C end,
final boolean reversed,
final ColumnInc<C> columnInc,
final long limit,
final long page,
final ReadConsistency consistency) {
return Iterators.concat(new AbstractIterator<Iterator<Column<C>>>() {
private C _from = start;
private long _remaining = limit;
private long _page = page;
@Override
protected Iterator<Column<C>> computeNext() {
if (_remaining <= 0) {
return endOfData(); // depends on control dependency: [if], data = [none]
}
// For page N+1, treat "_from" as exclusive. Since Cassandra doesn't support exclusive column ranges
// bump the from value up to the next possible time UUID (assumes from != null when page != 0).
if (_page > 0) {
if (_from.equals(end)) {
return endOfData(); // depends on control dependency: [if], data = [none]
}
_from = reversed ? columnInc.previous(_from) : columnInc.next(_from); // depends on control dependency: [if], data = [none]
if (_from == null) {
return endOfData(); // depends on control dependency: [if], data = [none]
}
}
// Execute the query
int batchSize = (int) Math.min(_remaining, MAX_COLUMN_SCAN_BATCH);
ColumnList<C> columns = execute(placement.getKeyspace()
.prepareQuery(columnFamily, SorConsistencies.toAstyanax(consistency))
.getKey(rowKey)
.withColumnRange(_from, end, reversed, batchSize),
"scan columns in placement %s, column family %s, row %s, from %s to %s",
placement.getName(), columnFamily.getName(), rowKey, start, end);
// Update state for the next iteration.
if (columns.size() >= batchSize) {
// Save the last column key so we can use it as the start (exclusive) if we must query to get more data.
_from = columns.getColumnByIndex(columns.size() - 1).getName(); // depends on control dependency: [if], data = [(columns.size()]
_remaining = _remaining - columns.size(); // depends on control dependency: [if], data = [none]
_page++; // depends on control dependency: [if], data = [none]
} else {
// If we got fewer columns than we asked for, another query won't find more columns.
_remaining = 0; // depends on control dependency: [if], data = [none]
}
// Track metrics. For rows w/more than 50 columns, count subsequent reads w/_largeRowReadMeter.
(_page == 0 ? _randomReadMeter : _largeRowReadMeter).mark();
return columns.iterator();
}
});
} } |
public class class_name {
public void marshall(Instance instance, ProtocolMarshaller protocolMarshaller) {
if (instance == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instance.getName(), NAME_BINDING);
protocolMarshaller.marshall(instance.getArn(), ARN_BINDING);
protocolMarshaller.marshall(instance.getSupportCode(), SUPPORTCODE_BINDING);
protocolMarshaller.marshall(instance.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(instance.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(instance.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(instance.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(instance.getBlueprintId(), BLUEPRINTID_BINDING);
protocolMarshaller.marshall(instance.getBlueprintName(), BLUEPRINTNAME_BINDING);
protocolMarshaller.marshall(instance.getBundleId(), BUNDLEID_BINDING);
protocolMarshaller.marshall(instance.getIsStaticIp(), ISSTATICIP_BINDING);
protocolMarshaller.marshall(instance.getPrivateIpAddress(), PRIVATEIPADDRESS_BINDING);
protocolMarshaller.marshall(instance.getPublicIpAddress(), PUBLICIPADDRESS_BINDING);
protocolMarshaller.marshall(instance.getIpv6Address(), IPV6ADDRESS_BINDING);
protocolMarshaller.marshall(instance.getHardware(), HARDWARE_BINDING);
protocolMarshaller.marshall(instance.getNetworking(), NETWORKING_BINDING);
protocolMarshaller.marshall(instance.getState(), STATE_BINDING);
protocolMarshaller.marshall(instance.getUsername(), USERNAME_BINDING);
protocolMarshaller.marshall(instance.getSshKeyName(), SSHKEYNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Instance instance, ProtocolMarshaller protocolMarshaller) {
if (instance == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instance.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getSupportCode(), SUPPORTCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getBlueprintId(), BLUEPRINTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getBlueprintName(), BLUEPRINTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getBundleId(), BUNDLEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getIsStaticIp(), ISSTATICIP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getPrivateIpAddress(), PRIVATEIPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getPublicIpAddress(), PUBLICIPADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getIpv6Address(), IPV6ADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getHardware(), HARDWARE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getNetworking(), NETWORKING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instance.getSshKeyName(), SSHKEYNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean checkForVariables(List<Map<String, String>> values) {
if (values == null || values.isEmpty()) {
return false;
} else {
for (Map<String, String> list : values) {
if (list.containsKey("type") && list.get("type")
.equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
return true;
}
}
}
return false;
} } | public class class_name {
private boolean checkForVariables(List<Map<String, String>> values) {
if (values == null || values.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
} else {
for (Map<String, String> list : values) {
if (list.containsKey("type") && list.get("type")
.equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public String getOriginalString() {
if (this.string != null) {
this.string = new String(this.buffer, this.initialOffset, getLength());
}
return this.string;
} } | public class class_name {
public String getOriginalString() {
if (this.string != null) {
this.string = new String(this.buffer, this.initialOffset, getLength());
// depends on control dependency: [if], data = [none]
}
return this.string;
} } |
public class class_name {
@GuardedBy("writeLock")
private void updateFileList(FileListCacheValue fileList) {
if (writeAsync) {
cacheNoRetrieve.putAsync(fileListCacheKey, fileList);
}
else {
if (trace) {
log.tracef("Updating file listing view from %s", getAddress(cacheNoRetrieve));
}
cacheNoRetrieve.put(fileListCacheKey, fileList);
}
} } | public class class_name {
@GuardedBy("writeLock")
private void updateFileList(FileListCacheValue fileList) {
if (writeAsync) {
cacheNoRetrieve.putAsync(fileListCacheKey, fileList); // depends on control dependency: [if], data = [none]
}
else {
if (trace) {
log.tracef("Updating file listing view from %s", getAddress(cacheNoRetrieve)); // depends on control dependency: [if], data = [none]
}
cacheNoRetrieve.put(fileListCacheKey, fileList); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void changeEntityValue(String value, int valueIndex) {
if (getEntityType().isChoice()) {
CmsEntity choice = m_entity.getAttribute(CmsType.CHOICE_ATTRIBUTE_NAME).getComplexValues().get(valueIndex);
String attributeName = getChoiceName(valueIndex);
if (attributeName != null) {
choice.setAttributeValue(attributeName, value, 0);
}
} else {
m_entity.setAttributeValue(m_attributeName, value, valueIndex);
}
} } | public class class_name {
private void changeEntityValue(String value, int valueIndex) {
if (getEntityType().isChoice()) {
CmsEntity choice = m_entity.getAttribute(CmsType.CHOICE_ATTRIBUTE_NAME).getComplexValues().get(valueIndex);
String attributeName = getChoiceName(valueIndex);
if (attributeName != null) {
choice.setAttributeValue(attributeName, value, 0);
// depends on control dependency: [if], data = [(attributeName]
}
} else {
m_entity.setAttributeValue(m_attributeName, value, valueIndex);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private List<Class<? extends FeatureInstaller>> findInstallers() {
if (scanner != null) {
final List<Class<? extends FeatureInstaller>> installers = Lists.newArrayList();
scanner.scan(new ClassVisitor() {
@Override
public void visit(final Class<?> type) {
if (FeatureUtils.is(type, FeatureInstaller.class)) {
installers.add((Class<? extends FeatureInstaller>) type);
}
}
});
// sort to unify registration order on different systems
installers.sort(Comparator.comparing(Class::getName));
context.registerInstallersFromScan(installers);
}
final List<Class<? extends FeatureInstaller>> installers = context.getEnabledInstallers();
installers.sort(COMPARATOR);
logger.debug("Found {} installers", installers.size());
return installers;
} } | public class class_name {
@SuppressWarnings("unchecked")
private List<Class<? extends FeatureInstaller>> findInstallers() {
if (scanner != null) {
final List<Class<? extends FeatureInstaller>> installers = Lists.newArrayList();
scanner.scan(new ClassVisitor() {
@Override
public void visit(final Class<?> type) {
if (FeatureUtils.is(type, FeatureInstaller.class)) {
installers.add((Class<? extends FeatureInstaller>) type); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
// sort to unify registration order on different systems
installers.sort(Comparator.comparing(Class::getName)); // depends on control dependency: [if], data = [none]
context.registerInstallersFromScan(installers); // depends on control dependency: [if], data = [none]
}
final List<Class<? extends FeatureInstaller>> installers = context.getEnabledInstallers();
installers.sort(COMPARATOR);
logger.debug("Found {} installers", installers.size());
return installers;
} } |
public class class_name {
public static <T> T flattenOption(scala.Option<T> option) {
if (option.isEmpty()) {
return null;
} else {
return option.get();
}
} } | public class class_name {
public static <T> T flattenOption(scala.Option<T> option) {
if (option.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
} else {
return option.get(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Icon getEditIcon() {
Icon icon = null;
if (getFormId() != null) {
icon = getApplicationConfig().iconSource().getIcon(getFormId() + ".shuttleList.edit");
}
if (icon == null) {
icon = getApplicationConfig().iconSource().getIcon("shuttleList.edit");
}
return icon;
} } | public class class_name {
private Icon getEditIcon() {
Icon icon = null;
if (getFormId() != null) {
icon = getApplicationConfig().iconSource().getIcon(getFormId() + ".shuttleList.edit"); // depends on control dependency: [if], data = [(getFormId()]
}
if (icon == null) {
icon = getApplicationConfig().iconSource().getIcon("shuttleList.edit"); // depends on control dependency: [if], data = [none]
}
return icon;
} } |
public class class_name {
@Override
public MultipleObjectsBundle filter(MultipleObjectsBundle objects) {
if(objects.dataLength() == 0) {
return objects;
}
MultipleObjectsBundle bundle = new MultipleObjectsBundle();
final Logging logger = getLogger();
for(int r = 0; r < objects.metaLength(); r++) {
@SuppressWarnings("unchecked")
SimpleTypeInformation<Object> type = (SimpleTypeInformation<Object>) objects.meta(r);
@SuppressWarnings("unchecked")
final List<Object> column = (List<Object>) objects.getColumn(r);
if(!getInputTypeRestriction().isAssignableFromType(type)) {
bundle.appendColumn(type, column);
continue;
}
// Get the replacement type information
@SuppressWarnings("unchecked")
final SimpleTypeInformation<I> castType = (SimpleTypeInformation<I>) type;
// When necessary, perform an initialization scan
if(prepareStart(castType)) {
FiniteProgress pprog = logger.isVerbose() ? new FiniteProgress("Preparing normalization", objects.dataLength(), logger) : null;
for(Object o : column) {
@SuppressWarnings("unchecked")
final I obj = (I) o;
prepareProcessInstance(obj);
logger.incrementProcessed(pprog);
}
logger.ensureCompleted(pprog);
prepareComplete();
}
@SuppressWarnings("unchecked")
final List<O> castColumn = (List<O>) column;
bundle.appendColumn(convertedType(castType), castColumn);
// Normalization scan
FiniteProgress nprog = logger.isVerbose() ? new FiniteProgress("Data normalization", objects.dataLength(), logger) : null;
for(int i = 0; i < objects.dataLength(); i++) {
@SuppressWarnings("unchecked")
final I obj = (I) column.get(i);
final O normalizedObj = filterSingleObject(obj);
castColumn.set(i, normalizedObj);
logger.incrementProcessed(nprog);
}
logger.ensureCompleted(nprog);
}
return bundle;
} } | public class class_name {
@Override
public MultipleObjectsBundle filter(MultipleObjectsBundle objects) {
if(objects.dataLength() == 0) {
return objects; // depends on control dependency: [if], data = [none]
}
MultipleObjectsBundle bundle = new MultipleObjectsBundle();
final Logging logger = getLogger();
for(int r = 0; r < objects.metaLength(); r++) {
@SuppressWarnings("unchecked")
SimpleTypeInformation<Object> type = (SimpleTypeInformation<Object>) objects.meta(r);
@SuppressWarnings("unchecked")
final List<Object> column = (List<Object>) objects.getColumn(r);
if(!getInputTypeRestriction().isAssignableFromType(type)) {
bundle.appendColumn(type, column); // depends on control dependency: [if], data = [none]
continue;
}
// Get the replacement type information
@SuppressWarnings("unchecked")
final SimpleTypeInformation<I> castType = (SimpleTypeInformation<I>) type;
// When necessary, perform an initialization scan
if(prepareStart(castType)) {
FiniteProgress pprog = logger.isVerbose() ? new FiniteProgress("Preparing normalization", objects.dataLength(), logger) : null;
for(Object o : column) {
@SuppressWarnings("unchecked")
final I obj = (I) o;
prepareProcessInstance(obj); // depends on control dependency: [for], data = [o]
logger.incrementProcessed(pprog); // depends on control dependency: [for], data = [o]
}
logger.ensureCompleted(pprog); // depends on control dependency: [if], data = [none]
prepareComplete(); // depends on control dependency: [if], data = [none]
}
@SuppressWarnings("unchecked")
final List<O> castColumn = (List<O>) column;
bundle.appendColumn(convertedType(castType), castColumn); // depends on control dependency: [for], data = [none]
// Normalization scan
FiniteProgress nprog = logger.isVerbose() ? new FiniteProgress("Data normalization", objects.dataLength(), logger) : null;
for(int i = 0; i < objects.dataLength(); i++) {
@SuppressWarnings("unchecked")
final I obj = (I) column.get(i);
final O normalizedObj = filterSingleObject(obj);
castColumn.set(i, normalizedObj); // depends on control dependency: [for], data = [i]
logger.incrementProcessed(nprog); // depends on control dependency: [for], data = [none]
}
logger.ensureCompleted(nprog); // depends on control dependency: [for], data = [none]
}
return bundle;
} } |
public class class_name {
public void prunePoints(int count ) {
// Remove all observations of the Points which are going to be removed
for (int viewIndex = observations.views.length-1; viewIndex >= 0; viewIndex--) {
SceneObservations.View v = observations.views[viewIndex];
for(int pointIndex = v.point.size-1; pointIndex >= 0; pointIndex-- ) {
SceneStructureMetric.Point p = structure.points[v.getPointId(pointIndex)];
if( p.views.size < count ) {
v.remove(pointIndex);
}
}
}
// Create a look up table containing from old to new indexes for each point
int oldToNew[] = new int[ structure.points.length ];
Arrays.fill(oldToNew,-1); // crash is bug
GrowQueue_I32 prune = new GrowQueue_I32(); // List of point ID's which are to be removed.
for (int i = 0; i < structure.points.length; i++) {
if( structure.points[i].views.size < count ) {
prune.add(i);
} else {
oldToNew[i] = i-prune.size;
}
}
pruneUpdatePointID(oldToNew, prune);
} } | public class class_name {
public void prunePoints(int count ) {
// Remove all observations of the Points which are going to be removed
for (int viewIndex = observations.views.length-1; viewIndex >= 0; viewIndex--) {
SceneObservations.View v = observations.views[viewIndex];
for(int pointIndex = v.point.size-1; pointIndex >= 0; pointIndex-- ) {
SceneStructureMetric.Point p = structure.points[v.getPointId(pointIndex)];
if( p.views.size < count ) {
v.remove(pointIndex); // depends on control dependency: [if], data = [none]
}
}
}
// Create a look up table containing from old to new indexes for each point
int oldToNew[] = new int[ structure.points.length ];
Arrays.fill(oldToNew,-1); // crash is bug
GrowQueue_I32 prune = new GrowQueue_I32(); // List of point ID's which are to be removed.
for (int i = 0; i < structure.points.length; i++) {
if( structure.points[i].views.size < count ) {
prune.add(i); // depends on control dependency: [if], data = [none]
} else {
oldToNew[i] = i-prune.size; // depends on control dependency: [if], data = [none]
}
}
pruneUpdatePointID(oldToNew, prune);
} } |
public class class_name {
void appendString(JCTree tree) {
Type t = tree.type.baseType();
if (!t.isPrimitive() && t.tsym != syms.stringType.tsym) {
t = syms.objectType;
}
items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
} } | public class class_name {
void appendString(JCTree tree) {
Type t = tree.type.baseType();
if (!t.isPrimitive() && t.tsym != syms.stringType.tsym) {
t = syms.objectType; // depends on control dependency: [if], data = [none]
}
items.makeMemberItem(getStringBufferAppend(tree, t), false).invoke();
} } |
public class class_name {
public String remainderValue()
{
if (isCharCommand())
{
if (getValue().length() == 1)
return null;
return getValue().substring(1);
}
if (isWordCommand())
return null;
return getValue();
} } | public class class_name {
public String remainderValue()
{
if (isCharCommand())
{
if (getValue().length() == 1)
return null;
return getValue().substring(1); // depends on control dependency: [if], data = [none]
}
if (isWordCommand())
return null;
return getValue();
} } |
public class class_name {
@Override
public double divide(double w1, double w2) {
if (!isMember(w1) || !isMember(w2)) {
return Double.NEGATIVE_INFINITY;
}
if (w2 == zero) {
return Double.NEGATIVE_INFINITY;
} else if (w1 == zero) {
return zero;
}
return w1 - w2;
} } | public class class_name {
@Override
public double divide(double w1, double w2) {
if (!isMember(w1) || !isMember(w2)) {
return Double.NEGATIVE_INFINITY; // depends on control dependency: [if], data = [none]
}
if (w2 == zero) {
return Double.NEGATIVE_INFINITY; // depends on control dependency: [if], data = [none]
} else if (w1 == zero) {
return zero; // depends on control dependency: [if], data = [none]
}
return w1 - w2;
} } |
public class class_name {
protected void addClassEditors (BuilderModel model, String cprefix)
{
List<ComponentClass> classes = model.getComponentClasses();
int size = classes.size();
for (int ii = 0; ii < size; ii++) {
ComponentClass cclass = classes.get(ii);
if (!cclass.name.startsWith(cprefix)) {
continue;
}
List<Integer> ccomps = model.getComponents(cclass);
if (ccomps.size() > 0) {
add(new ClassEditor(model, cclass, ccomps));
} else {
log.info("Not creating editor for empty class " +
"[class=" + cclass + "].");
}
}
} } | public class class_name {
protected void addClassEditors (BuilderModel model, String cprefix)
{
List<ComponentClass> classes = model.getComponentClasses();
int size = classes.size();
for (int ii = 0; ii < size; ii++) {
ComponentClass cclass = classes.get(ii);
if (!cclass.name.startsWith(cprefix)) {
continue;
}
List<Integer> ccomps = model.getComponents(cclass);
if (ccomps.size() > 0) {
add(new ClassEditor(model, cclass, ccomps)); // depends on control dependency: [if], data = [none]
} else {
log.info("Not creating editor for empty class " +
"[class=" + cclass + "]."); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(AddFacetToObjectRequest addFacetToObjectRequest, ProtocolMarshaller protocolMarshaller) {
if (addFacetToObjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addFacetToObjectRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(addFacetToObjectRequest.getSchemaFacet(), SCHEMAFACET_BINDING);
protocolMarshaller.marshall(addFacetToObjectRequest.getObjectAttributeList(), OBJECTATTRIBUTELIST_BINDING);
protocolMarshaller.marshall(addFacetToObjectRequest.getObjectReference(), OBJECTREFERENCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AddFacetToObjectRequest addFacetToObjectRequest, ProtocolMarshaller protocolMarshaller) {
if (addFacetToObjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(addFacetToObjectRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addFacetToObjectRequest.getSchemaFacet(), SCHEMAFACET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addFacetToObjectRequest.getObjectAttributeList(), OBJECTATTRIBUTELIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(addFacetToObjectRequest.getObjectReference(), OBJECTREFERENCE_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 {
@Nonnull
public BugInstance addClassAndMethod(MethodGen methodGen, String sourceFile) {
addClass(methodGen.getClassName());
addMethod(methodGen, sourceFile);
if (!MemberUtils.isUserGenerated(methodGen)) {
foundInAutogeneratedMethod();
}
return this;
} } | public class class_name {
@Nonnull
public BugInstance addClassAndMethod(MethodGen methodGen, String sourceFile) {
addClass(methodGen.getClassName());
addMethod(methodGen, sourceFile);
if (!MemberUtils.isUserGenerated(methodGen)) {
foundInAutogeneratedMethod(); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public boolean addVertex(Vertex<T> v)
{
if( verticies.containsValue(v) == false )
{
verticies.put(v.getName(), v);
return true;
}
return false;
} } | public class class_name {
public boolean addVertex(Vertex<T> v)
{
if( verticies.containsValue(v) == false )
{
verticies.put(v.getName(), v); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public Map<Integer,Integer> getVertexMapping() {
Map<Integer,Integer> vertexMapping = new HashMap<Integer,Integer>();
for (int i = 0, j = 0; i < n1; ++i) {
if (core1[i] != NULL_NODE) {
vertexMapping.put(i, core1[i]);
}
}
return vertexMapping;
} } | public class class_name {
public Map<Integer,Integer> getVertexMapping() {
Map<Integer,Integer> vertexMapping = new HashMap<Integer,Integer>();
for (int i = 0, j = 0; i < n1; ++i) {
if (core1[i] != NULL_NODE) {
vertexMapping.put(i, core1[i]); // depends on control dependency: [if], data = [none]
}
}
return vertexMapping;
} } |
public class class_name {
@Descriptor("Gets the importer available in the platform")
public void importer(@Descriptor("importer [importer name]") String... parameters) {
Map<ServiceReference, ImporterService> importerRefsAndServices = getAllServiceRefsAndServices(ImporterService.class);
StringBuilder sbFinal = new StringBuilder();
if (importerRefsAndServices.isEmpty()) {
sbFinal.append("No importers available.\n");
} else {
for (Map.Entry<ServiceReference, ImporterService> e : importerRefsAndServices.entrySet()) {
StringBuilder sb = new StringBuilder();
sb.append(displayServiceInfo(e.getKey()));
sb.append(String.format("importer name = %s%n", e.getValue().getName()));
sb.append(createASCIIBox("Properties", displayServiceProperties(e.getKey())));
sbFinal.append(createASCIIBox("Importer", sb));
}
}
print(sbFinal.toString());
} } | public class class_name {
@Descriptor("Gets the importer available in the platform")
public void importer(@Descriptor("importer [importer name]") String... parameters) {
Map<ServiceReference, ImporterService> importerRefsAndServices = getAllServiceRefsAndServices(ImporterService.class);
StringBuilder sbFinal = new StringBuilder();
if (importerRefsAndServices.isEmpty()) {
sbFinal.append("No importers available.\n"); // depends on control dependency: [if], data = [none]
} else {
for (Map.Entry<ServiceReference, ImporterService> e : importerRefsAndServices.entrySet()) {
StringBuilder sb = new StringBuilder();
sb.append(displayServiceInfo(e.getKey())); // depends on control dependency: [for], data = [e]
sb.append(String.format("importer name = %s%n", e.getValue().getName())); // depends on control dependency: [for], data = [e]
sb.append(createASCIIBox("Properties", displayServiceProperties(e.getKey()))); // depends on control dependency: [for], data = [e]
sbFinal.append(createASCIIBox("Importer", sb)); // depends on control dependency: [for], data = [e]
}
}
print(sbFinal.toString());
} } |
public class class_name {
private Asset getAsset(Object id, String assetTypeToken) {
Asset result = assetCache.get(id);
if (result == null) {
try {
IAssetType assetType = getMetaModel().getAssetType(
assetTypeToken);
if (id instanceof AssetID) {
AssetID assetId = (AssetID) id;
result = new Asset(Oid.fromToken(assetId.getToken(),
getMetaModel()));
} else {
result = new Asset(assetType);
}
setAsset(id, result);
} catch (OidException e) {
throw new ApplicationUnavailableException(e);
}
}
return result;
} } | public class class_name {
private Asset getAsset(Object id, String assetTypeToken) {
Asset result = assetCache.get(id);
if (result == null) {
try {
IAssetType assetType = getMetaModel().getAssetType(
assetTypeToken);
if (id instanceof AssetID) {
AssetID assetId = (AssetID) id;
result = new Asset(Oid.fromToken(assetId.getToken(),
getMetaModel())); // depends on control dependency: [if], data = [none]
} else {
result = new Asset(assetType); // depends on control dependency: [if], data = [none]
}
setAsset(id, result); // depends on control dependency: [try], data = [none]
} catch (OidException e) {
throw new ApplicationUnavailableException(e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
public FilterSpec addExpression(FilterSpec expr) {
if (expressions == null) {
expressions = new ArrayList<>();
}
expressions.add((FilterSpec) expr);
return this;
} } | public class class_name {
public FilterSpec addExpression(FilterSpec expr) {
if (expressions == null) {
expressions = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
expressions.add((FilterSpec) expr);
return this;
} } |
public class class_name {
public Integer getSelectedRow() {
final Object result = getStateHelper().eval(PropertyKeys.selectedRow);
if (result == null) {
return null;
}
return Integer.valueOf(result.toString());
} } | public class class_name {
public Integer getSelectedRow() {
final Object result = getStateHelper().eval(PropertyKeys.selectedRow);
if (result == null) {
return null; // depends on control dependency: [if], data = [none]
}
return Integer.valueOf(result.toString());
} } |
public class class_name {
public Map<?, ?> formatJSON2Map(String json) {
Map<?, ?> map = null;
try {
map = MAPPER.readValue(json, Map.class);
} catch (Exception e) {
LOGGER.error("formatJsonToMap error, json = " + json, e);
}
return map;
} } | public class class_name {
public Map<?, ?> formatJSON2Map(String json) {
Map<?, ?> map = null;
try {
map = MAPPER.readValue(json, Map.class); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error("formatJsonToMap error, json = " + json, e);
} // depends on control dependency: [catch], data = [none]
return map;
} } |
public class class_name {
@Override
public void fireValueNodeAdded(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeAdded(valueNode);
}
} } | public class class_name {
@Override
public void fireValueNodeAdded(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeAdded(valueNode); // depends on control dependency: [for], data = [iDatabaseListener]
}
} } |
public class class_name {
protected static boolean uninstallAddOnExtension(
AddOn addOn,
Extension extension,
AddOnUninstallationProgressCallback callback) {
boolean uninstalledWithoutErrors = true;
if (extension.isEnabled()) {
String extUiName = extension.getUIName();
if (extension.canUnload()) {
logger.debug("Unloading ext: " + extension.getName());
try {
extension.unload();
Control.getSingleton().getExtensionLoader().removeExtension(extension);
ExtensionFactory.unloadAddOnExtension(extension);
} catch (Exception e) {
logger.error("An error occurred while uninstalling the extension \"" + extension.getName()
+ "\" bundled in the add-on \"" + addOn.getId() + "\":", e);
uninstalledWithoutErrors = false;
}
} else {
logger.debug("Cant dynamically unload ext: " + extension.getName());
uninstalledWithoutErrors = false;
}
callback.extensionRemoved(extUiName);
} else {
ExtensionFactory.unloadAddOnExtension(extension);
}
addOn.removeLoadedExtension(extension);
return uninstalledWithoutErrors;
} } | public class class_name {
protected static boolean uninstallAddOnExtension(
AddOn addOn,
Extension extension,
AddOnUninstallationProgressCallback callback) {
boolean uninstalledWithoutErrors = true;
if (extension.isEnabled()) {
String extUiName = extension.getUIName();
if (extension.canUnload()) {
logger.debug("Unloading ext: " + extension.getName()); // depends on control dependency: [if], data = [none]
try {
extension.unload(); // depends on control dependency: [try], data = [none]
Control.getSingleton().getExtensionLoader().removeExtension(extension); // depends on control dependency: [try], data = [none]
ExtensionFactory.unloadAddOnExtension(extension); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("An error occurred while uninstalling the extension \"" + extension.getName()
+ "\" bundled in the add-on \"" + addOn.getId() + "\":", e);
uninstalledWithoutErrors = false;
} // depends on control dependency: [catch], data = [none]
} else {
logger.debug("Cant dynamically unload ext: " + extension.getName()); // depends on control dependency: [if], data = [none]
uninstalledWithoutErrors = false; // depends on control dependency: [if], data = [none]
}
callback.extensionRemoved(extUiName); // depends on control dependency: [if], data = [none]
} else {
ExtensionFactory.unloadAddOnExtension(extension); // depends on control dependency: [if], data = [none]
}
addOn.removeLoadedExtension(extension);
return uninstalledWithoutErrors;
} } |
public class class_name {
public static void main(String[] args) {
try {
if (args.length != 7) {
Utils.exitWithFailure();
}
String cluster = args[0];
Properties clustersProperties = PropertiesHelper
.stringToProperties(args[1]);
long timeout = Long.parseLong(args[2]);
String regionName = args[3];
boolean debugEnabled = ("true".equals(args[4]) ? true : false);
boolean quiet = ("true".equals(args[5]) ? true : false);
long processingStartedAt = Long.parseLong(args[6]);
GuestNode guestNode = new GuestNode(cluster, clustersProperties,
regionName, debugEnabled, quiet, processingStartedAt);
boolean connected = guestNode.waitFor(timeout);
guestNode.printState(connected);
guestNode.close();
if (connected) {
Utils.exitWithSuccess();
}
Utils.exitWithFailure();
} catch (Throwable t) {
Utils.exitWithFailure();
}
} } | public class class_name {
public static void main(String[] args) {
try {
if (args.length != 7) {
Utils.exitWithFailure(); // depends on control dependency: [if], data = [none]
}
String cluster = args[0];
Properties clustersProperties = PropertiesHelper
.stringToProperties(args[1]);
long timeout = Long.parseLong(args[2]);
String regionName = args[3];
boolean debugEnabled = ("true".equals(args[4]) ? true : false);
boolean quiet = ("true".equals(args[5]) ? true : false);
long processingStartedAt = Long.parseLong(args[6]);
GuestNode guestNode = new GuestNode(cluster, clustersProperties,
regionName, debugEnabled, quiet, processingStartedAt);
boolean connected = guestNode.waitFor(timeout);
guestNode.printState(connected); // depends on control dependency: [try], data = [none]
guestNode.close(); // depends on control dependency: [try], data = [none]
if (connected) {
Utils.exitWithSuccess(); // depends on control dependency: [if], data = [none]
}
Utils.exitWithFailure(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
Utils.exitWithFailure();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(PutBotAliasRequest putBotAliasRequest, ProtocolMarshaller protocolMarshaller) {
if (putBotAliasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putBotAliasRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(putBotAliasRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(putBotAliasRequest.getBotVersion(), BOTVERSION_BINDING);
protocolMarshaller.marshall(putBotAliasRequest.getBotName(), BOTNAME_BINDING);
protocolMarshaller.marshall(putBotAliasRequest.getChecksum(), CHECKSUM_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PutBotAliasRequest putBotAliasRequest, ProtocolMarshaller protocolMarshaller) {
if (putBotAliasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putBotAliasRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putBotAliasRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putBotAliasRequest.getBotVersion(), BOTVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putBotAliasRequest.getBotName(), BOTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putBotAliasRequest.getChecksum(), CHECKSUM_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 {
static String toLowerCamelCaseWithNumericSuffixes(String input) {
// Determine where the numeric suffixes begin
int suffixStart = input.length();
while (suffixStart > 0) {
char ch = '\0';
int numberStart = suffixStart;
while (numberStart > 0) {
ch = input.charAt(numberStart - 1);
if (Character.isDigit(ch)) {
numberStart--;
} else {
break;
}
}
if ((numberStart > 0) && (numberStart < suffixStart) && (ch == '_')) {
suffixStart = numberStart - 1;
} else {
break;
}
}
if (suffixStart == input.length()) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, input);
} else {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,
input.substring(0, suffixStart)) + input.substring(suffixStart);
}
} } | public class class_name {
static String toLowerCamelCaseWithNumericSuffixes(String input) {
// Determine where the numeric suffixes begin
int suffixStart = input.length();
while (suffixStart > 0) {
char ch = '\0';
int numberStart = suffixStart;
while (numberStart > 0) {
ch = input.charAt(numberStart - 1); // depends on control dependency: [while], data = [(numberStart]
if (Character.isDigit(ch)) {
numberStart--; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
if ((numberStart > 0) && (numberStart < suffixStart) && (ch == '_')) {
suffixStart = numberStart - 1; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
if (suffixStart == input.length()) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, input); // depends on control dependency: [if], data = [none]
} else {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL,
input.substring(0, suffixStart)) + input.substring(suffixStart); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void driveRegisteredCallbacks(
RegisteredCallbacks rMonitor,
boolean isEmpty)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"driveRegisteredCallbacks",
new Object[] { rMonitor, new Boolean(isEmpty) });
// Get the list of callbacks
ArrayList callbackList = rMonitor.getWrappedCallbacks();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Iterate over wrapped callbacks");
// Iterate over the callbacks
Iterator iter = callbackList.iterator();
while (iter.hasNext())
{
WrappedConsumerSetChangeCallback wcb = (WrappedConsumerSetChangeCallback)iter.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Drive callback: " + wcb.getCallback());
// set the type of transition into the wrapped callback
wcb.transitionEvent(isEmpty);
try
{
//start up a new thread (from the MP's thread pool)
//to drive the callback
_messageProcessor.startNewThread(new AsynchThread(wcb));
}
catch (InterruptedException e)
{
// No FFDC code needed
//Trace only
SibTr.exception(tc, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "driveRegisteredCallbacks");
} } | public class class_name {
private void driveRegisteredCallbacks(
RegisteredCallbacks rMonitor,
boolean isEmpty)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"driveRegisteredCallbacks",
new Object[] { rMonitor, new Boolean(isEmpty) });
// Get the list of callbacks
ArrayList callbackList = rMonitor.getWrappedCallbacks();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Iterate over wrapped callbacks");
// Iterate over the callbacks
Iterator iter = callbackList.iterator();
while (iter.hasNext())
{
WrappedConsumerSetChangeCallback wcb = (WrappedConsumerSetChangeCallback)iter.next();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Drive callback: " + wcb.getCallback());
// set the type of transition into the wrapped callback
wcb.transitionEvent(isEmpty); // depends on control dependency: [while], data = [none]
try
{
//start up a new thread (from the MP's thread pool)
//to drive the callback
_messageProcessor.startNewThread(new AsynchThread(wcb)); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
// No FFDC code needed
//Trace only
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "driveRegisteredCallbacks");
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.