code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private boolean getBooleanProperty(String key, String defaultValue, StringBuilder errors) {
boolean booleanValue = false;
String stringValue = null;
boolean valueCorrect = false;
// Pull the key from the property map
Object objectValue = this.properties.get(key);
if (objectValue != null) {
if (objectValue instanceof Boolean) {
booleanValue = ((Boolean) objectValue).booleanValue();
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + booleanValue);
}
return booleanValue;
} else if (objectValue instanceof String) {
stringValue = (String) objectValue;
}
} else {
// Key is not in map.
if (defaultValue != null) {
stringValue = defaultValue;
} else {
// No default provided. Error.
errors.append(key);
errors.append(':');
errors.append(stringValue);
errors.append('\n');
return false;
}
}
// If we get this far, we have a non null string value to work with. May be the default.
// Verify the value.
if (stringValue != null) {
if (stringValue.equals("true")) {
booleanValue = true;
valueCorrect = true;
} else if (stringValue.equals("false")) {
booleanValue = false;
valueCorrect = true;
}
}
if (valueCorrect) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + booleanValue);
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " has invalid value " + stringValue);
}
errors.append(key);
errors.append(':');
errors.append(stringValue);
errors.append('\n');
}
return booleanValue;
} } | public class class_name {
private boolean getBooleanProperty(String key, String defaultValue, StringBuilder errors) {
boolean booleanValue = false;
String stringValue = null;
boolean valueCorrect = false;
// Pull the key from the property map
Object objectValue = this.properties.get(key);
if (objectValue != null) {
if (objectValue instanceof Boolean) {
booleanValue = ((Boolean) objectValue).booleanValue(); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + booleanValue); // depends on control dependency: [if], data = [none]
}
return booleanValue; // depends on control dependency: [if], data = [none]
} else if (objectValue instanceof String) {
stringValue = (String) objectValue; // depends on control dependency: [if], data = [none]
}
} else {
// Key is not in map.
if (defaultValue != null) {
stringValue = defaultValue; // depends on control dependency: [if], data = [none]
} else {
// No default provided. Error.
errors.append(key); // depends on control dependency: [if], data = [none]
errors.append(':'); // depends on control dependency: [if], data = [none]
errors.append(stringValue); // depends on control dependency: [if], data = [none]
errors.append('\n'); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
// If we get this far, we have a non null string value to work with. May be the default.
// Verify the value.
if (stringValue != null) {
if (stringValue.equals("true")) {
booleanValue = true; // depends on control dependency: [if], data = [none]
valueCorrect = true; // depends on control dependency: [if], data = [none]
} else if (stringValue.equals("false")) {
booleanValue = false; // depends on control dependency: [if], data = [none]
valueCorrect = true; // depends on control dependency: [if], data = [none]
}
}
if (valueCorrect) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " set to " + booleanValue); // depends on control dependency: [if], data = [none]
}
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Property " + key + " has invalid value " + stringValue); // depends on control dependency: [if], data = [none]
}
errors.append(key); // depends on control dependency: [if], data = [none]
errors.append(':'); // depends on control dependency: [if], data = [none]
errors.append(stringValue); // depends on control dependency: [if], data = [none]
errors.append('\n'); // depends on control dependency: [if], data = [none]
}
return booleanValue;
} } |
public class class_name {
public static Method tryGetMethod(String id) {
if (id.length() != NAME_LEN) {
// we use it to fast discard the request without doing map lookup
return null;
}
return idToMethod.get(id);
} } | public class class_name {
public static Method tryGetMethod(String id) {
if (id.length() != NAME_LEN) {
// we use it to fast discard the request without doing map lookup
return null; // depends on control dependency: [if], data = [none]
}
return idToMethod.get(id);
} } |
public class class_name {
@Override
public String fromComponentNameToPartOfClassName(final String componentName) {
if (componentName == null) {
throw new EmptyRuntimeException("componentName");
}
String[] names = LdiStringUtil.split(componentName, PACKAGE_SEPARATOR_STR);
StringBuffer buf = new StringBuffer(50);
for (int i = 0; i < names.length; ++i) {
if (i == names.length - 1) {
buf.append(LdiStringUtil.capitalize(names[i]));
} else {
buf.append(names[i]).append(".");
}
}
return buf.toString();
} } | public class class_name {
@Override
public String fromComponentNameToPartOfClassName(final String componentName) {
if (componentName == null) {
throw new EmptyRuntimeException("componentName");
}
String[] names = LdiStringUtil.split(componentName, PACKAGE_SEPARATOR_STR);
StringBuffer buf = new StringBuffer(50);
for (int i = 0; i < names.length; ++i) {
if (i == names.length - 1) {
buf.append(LdiStringUtil.capitalize(names[i])); // depends on control dependency: [if], data = [none]
} else {
buf.append(names[i]).append("."); // depends on control dependency: [if], data = [none]
}
}
return buf.toString();
} } |
public class class_name {
public String getParent() {
int length = path.length(), firstInPath = 0;
if (separatorChar == '\\' && length > 2 && path.charAt(1) == ':') {
firstInPath = 2;
}
int index = path.lastIndexOf(separatorChar);
if (index == -1 && firstInPath > 0) {
index = 2;
}
if (index == -1 || path.charAt(length - 1) == separatorChar) {
return null;
}
if (path.indexOf(separatorChar) == index
&& path.charAt(firstInPath) == separatorChar) {
return path.substring(0, index + 1);
}
return path.substring(0, index);
} } | public class class_name {
public String getParent() {
int length = path.length(), firstInPath = 0;
if (separatorChar == '\\' && length > 2 && path.charAt(1) == ':') {
firstInPath = 2; // depends on control dependency: [if], data = [none]
}
int index = path.lastIndexOf(separatorChar);
if (index == -1 && firstInPath > 0) {
index = 2; // depends on control dependency: [if], data = [none]
}
if (index == -1 || path.charAt(length - 1) == separatorChar) {
return null; // depends on control dependency: [if], data = [none]
}
if (path.indexOf(separatorChar) == index
&& path.charAt(firstInPath) == separatorChar) {
return path.substring(0, index + 1); // depends on control dependency: [if], data = [index]
}
return path.substring(0, index);
} } |
public class class_name {
public static DiscordianDate from(TemporalAccessor temporal) {
if (temporal instanceof DiscordianDate) {
return (DiscordianDate) temporal;
}
return DiscordianDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
} } | public class class_name {
public static DiscordianDate from(TemporalAccessor temporal) {
if (temporal instanceof DiscordianDate) {
return (DiscordianDate) temporal; // depends on control dependency: [if], data = [none]
}
return DiscordianDate.ofEpochDay(temporal.getLong(EPOCH_DAY));
} } |
public class class_name {
@Override
public List<EntityDeclaration> getEntities()
{
if (mEntities == null && (mSubset != null)) {
/* Better make a copy, so that caller can not modify list
* DTD has, which may be shared (since DTD subset instances
* are cached and reused)
*/
mEntities = new ArrayList<EntityDeclaration>(mSubset.getGeneralEntityList());
}
return mEntities;
} } | public class class_name {
@Override
public List<EntityDeclaration> getEntities()
{
if (mEntities == null && (mSubset != null)) {
/* Better make a copy, so that caller can not modify list
* DTD has, which may be shared (since DTD subset instances
* are cached and reused)
*/
mEntities = new ArrayList<EntityDeclaration>(mSubset.getGeneralEntityList()); // depends on control dependency: [if], data = [none]
}
return mEntities;
} } |
public class class_name {
private Collection<SSTableReader> doAntiCompaction(ColumnFamilyStore cfs, Collection<Range<Token>> ranges, Collection<SSTableReader> repairedSSTables, long repairedAt)
{
List<SSTableReader> anticompactedSSTables = new ArrayList<>();
int repairedKeyCount = 0;
int unrepairedKeyCount = 0;
logger.info("Performing anticompaction on {} sstables", repairedSSTables.size());
// iterate over sstables to check if the repaired / unrepaired ranges intersect them.
for (SSTableReader sstable : repairedSSTables)
{
// check that compaction hasn't stolen any sstables used in previous repair sessions
// if we need to skip the anticompaction, it will be carried out by the next repair
if (!new File(sstable.getFilename()).exists())
{
logger.info("Skipping anticompaction for {}, required sstable was compacted and is no longer available.", sstable);
continue;
}
logger.info("Anticompacting {}", sstable);
Set<SSTableReader> sstableAsSet = new HashSet<>();
sstableAsSet.add(sstable);
File destination = cfs.directories.getWriteableLocationAsFile(cfs.getExpectedCompactedFileSize(sstableAsSet, OperationType.ANTICOMPACTION));
SSTableRewriter repairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false);
SSTableRewriter unRepairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false);
try (AbstractCompactionStrategy.ScannerList scanners = cfs.getCompactionStrategy().getScanners(new HashSet<>(Collections.singleton(sstable)));
CompactionController controller = new CompactionController(cfs, sstableAsSet, CFMetaData.DEFAULT_GC_GRACE_SECONDS))
{
int expectedBloomFilterSize = Math.max(cfs.metadata.getMinIndexInterval(), (int)sstable.estimatedKeys());
repairedSSTableWriter.switchWriter(CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, repairedAt, sstable));
unRepairedSSTableWriter.switchWriter(CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, ActiveRepairService.UNREPAIRED_SSTABLE, sstable));
CompactionIterable ci = new CompactionIterable(OperationType.ANTICOMPACTION, scanners.scanners, controller);
Iterator<AbstractCompactedRow> iter = ci.iterator();
metrics.beginCompaction(ci);
try
{
while (iter.hasNext())
{
AbstractCompactedRow row = iter.next();
// if current range from sstable is repaired, save it into the new repaired sstable
if (Range.isInRanges(row.key.getToken(), ranges))
{
repairedSSTableWriter.append(row);
repairedKeyCount++;
}
// otherwise save into the new 'non-repaired' table
else
{
unRepairedSSTableWriter.append(row);
unrepairedKeyCount++;
}
}
}
finally
{
metrics.finishCompaction(ci);
}
anticompactedSSTables.addAll(repairedSSTableWriter.finish(repairedAt));
anticompactedSSTables.addAll(unRepairedSSTableWriter.finish(ActiveRepairService.UNREPAIRED_SSTABLE));
cfs.getDataTracker().markCompactedSSTablesReplaced(sstableAsSet, anticompactedSSTables, OperationType.ANTICOMPACTION);
}
catch (Throwable e)
{
JVMStabilityInspector.inspectThrowable(e);
logger.error("Error anticompacting " + sstable, e);
repairedSSTableWriter.abort();
unRepairedSSTableWriter.abort();
}
}
String format = "Repaired {} keys of {} for {}/{}";
logger.debug(format, repairedKeyCount, (repairedKeyCount + unrepairedKeyCount), cfs.keyspace, cfs.getColumnFamilyName());
String format2 = "Anticompaction completed successfully, anticompacted from {} to {} sstable(s).";
logger.info(format2, repairedSSTables.size(), anticompactedSSTables.size());
return anticompactedSSTables;
} } | public class class_name {
private Collection<SSTableReader> doAntiCompaction(ColumnFamilyStore cfs, Collection<Range<Token>> ranges, Collection<SSTableReader> repairedSSTables, long repairedAt)
{
List<SSTableReader> anticompactedSSTables = new ArrayList<>();
int repairedKeyCount = 0;
int unrepairedKeyCount = 0;
logger.info("Performing anticompaction on {} sstables", repairedSSTables.size());
// iterate over sstables to check if the repaired / unrepaired ranges intersect them.
for (SSTableReader sstable : repairedSSTables)
{
// check that compaction hasn't stolen any sstables used in previous repair sessions
// if we need to skip the anticompaction, it will be carried out by the next repair
if (!new File(sstable.getFilename()).exists())
{
logger.info("Skipping anticompaction for {}, required sstable was compacted and is no longer available.", sstable); // depends on control dependency: [if], data = [none]
continue;
}
logger.info("Anticompacting {}", sstable); // depends on control dependency: [for], data = [sstable]
Set<SSTableReader> sstableAsSet = new HashSet<>();
sstableAsSet.add(sstable); // depends on control dependency: [for], data = [sstable]
File destination = cfs.directories.getWriteableLocationAsFile(cfs.getExpectedCompactedFileSize(sstableAsSet, OperationType.ANTICOMPACTION));
SSTableRewriter repairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false);
SSTableRewriter unRepairedSSTableWriter = new SSTableRewriter(cfs, sstableAsSet, sstable.maxDataAge, false);
try (AbstractCompactionStrategy.ScannerList scanners = cfs.getCompactionStrategy().getScanners(new HashSet<>(Collections.singleton(sstable)));
CompactionController controller = new CompactionController(cfs, sstableAsSet, CFMetaData.DEFAULT_GC_GRACE_SECONDS))
{
int expectedBloomFilterSize = Math.max(cfs.metadata.getMinIndexInterval(), (int)sstable.estimatedKeys());
repairedSSTableWriter.switchWriter(CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, repairedAt, sstable)); // depends on control dependency: [for], data = [sstable]
unRepairedSSTableWriter.switchWriter(CompactionManager.createWriter(cfs, destination, expectedBloomFilterSize, ActiveRepairService.UNREPAIRED_SSTABLE, sstable)); // depends on control dependency: [for], data = [sstable]
CompactionIterable ci = new CompactionIterable(OperationType.ANTICOMPACTION, scanners.scanners, controller);
Iterator<AbstractCompactedRow> iter = ci.iterator();
metrics.beginCompaction(ci); // depends on control dependency: [for], data = [none]
try
{
while (iter.hasNext())
{
AbstractCompactedRow row = iter.next();
// if current range from sstable is repaired, save it into the new repaired sstable
if (Range.isInRanges(row.key.getToken(), ranges))
{
repairedSSTableWriter.append(row); // depends on control dependency: [if], data = [none]
repairedKeyCount++; // depends on control dependency: [if], data = [none]
}
// otherwise save into the new 'non-repaired' table
else
{
unRepairedSSTableWriter.append(row); // depends on control dependency: [if], data = [none]
unrepairedKeyCount++; // depends on control dependency: [if], data = [none]
}
}
}
finally
{
metrics.finishCompaction(ci);
}
anticompactedSSTables.addAll(repairedSSTableWriter.finish(repairedAt)); // depends on control dependency: [for], data = [none]
anticompactedSSTables.addAll(unRepairedSSTableWriter.finish(ActiveRepairService.UNREPAIRED_SSTABLE)); // depends on control dependency: [for], data = [none]
cfs.getDataTracker().markCompactedSSTablesReplaced(sstableAsSet, anticompactedSSTables, OperationType.ANTICOMPACTION); // depends on control dependency: [for], data = [sstable]
}
catch (Throwable e)
{
JVMStabilityInspector.inspectThrowable(e);
logger.error("Error anticompacting " + sstable, e);
repairedSSTableWriter.abort();
unRepairedSSTableWriter.abort();
}
}
String format = "Repaired {} keys of {} for {}/{}";
logger.debug(format, repairedKeyCount, (repairedKeyCount + unrepairedKeyCount), cfs.keyspace, cfs.getColumnFamilyName());
String format2 = "Anticompaction completed successfully, anticompacted from {} to {} sstable(s).";
logger.info(format2, repairedSSTables.size(), anticompactedSSTables.size());
return anticompactedSSTables;
} } |
public class class_name {
private void handleShutdownQueue() throws IOException {
for (MemcachedNode qa : nodesToShutdown) {
if (!addedQueue.contains(qa)) {
nodesToShutdown.remove(qa);
metrics.decrementCounter(SHUTD_QUEUE_METRIC);
Collection<Operation> notCompletedOperations = qa.destroyInputQueue();
if (qa.getChannel() != null) {
qa.getChannel().close();
qa.setSk(null);
if (qa.getBytesRemainingToWrite() > 0) {
getLogger().warn("Shut down with %d bytes remaining to write",
qa.getBytesRemainingToWrite());
}
getLogger().debug("Shut down channel %s", qa.getChannel());
}
redistributeOperations(notCompletedOperations);
}
}
} } | public class class_name {
private void handleShutdownQueue() throws IOException {
for (MemcachedNode qa : nodesToShutdown) {
if (!addedQueue.contains(qa)) {
nodesToShutdown.remove(qa); // depends on control dependency: [if], data = [none]
metrics.decrementCounter(SHUTD_QUEUE_METRIC); // depends on control dependency: [if], data = [none]
Collection<Operation> notCompletedOperations = qa.destroyInputQueue();
if (qa.getChannel() != null) {
qa.getChannel().close(); // depends on control dependency: [if], data = [none]
qa.setSk(null); // depends on control dependency: [if], data = [null)]
if (qa.getBytesRemainingToWrite() > 0) {
getLogger().warn("Shut down with %d bytes remaining to write",
qa.getBytesRemainingToWrite()); // depends on control dependency: [if], data = [none]
}
getLogger().debug("Shut down channel %s", qa.getChannel()); // depends on control dependency: [if], data = [none]
}
redistributeOperations(notCompletedOperations); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private ResourceXMLParser.Entity createEntity(final INodeEntry node) {
final ResourceXMLParser.Entity ent = new ResourceXMLParser.Entity();
ent.setName(node.getNodename());
ent.setResourceType(NODE_ENTITY_TAG);
if(null!=node.getAttributes()){
for (final String setName : node.getAttributes().keySet()) {
String value = node.getAttributes().get(setName);
ent.setProperty(setName, value);
}
}
if(null!=node.getTags()){
ent.setProperty("tags", joinStrings(node.getTags(), ", "));
}
return ent;
} } | public class class_name {
private ResourceXMLParser.Entity createEntity(final INodeEntry node) {
final ResourceXMLParser.Entity ent = new ResourceXMLParser.Entity();
ent.setName(node.getNodename());
ent.setResourceType(NODE_ENTITY_TAG);
if(null!=node.getAttributes()){
for (final String setName : node.getAttributes().keySet()) {
String value = node.getAttributes().get(setName);
ent.setProperty(setName, value); // depends on control dependency: [for], data = [setName]
}
}
if(null!=node.getTags()){
ent.setProperty("tags", joinStrings(node.getTags(), ", ")); // depends on control dependency: [if], data = [none]
}
return ent;
} } |
public class class_name {
protected void addItem(ItemState item)
{
index.put(item.getData().getIdentifier(), item);
index.put(item.getData().getQPath(), item);
index.put(new ParentIDQPathBasedKey(item), item);
index.put(new IDStateBasedKey(item.getData().getIdentifier(), item.getState()), item);
if (item.getData().isNode())
{
Map<String, ItemState> children = lastChildNodeStates.get(item.getData().getParentIdentifier());
if (children == null)
{
children = new HashMap<String, ItemState>();
lastChildNodeStates.put(item.getData().getParentIdentifier(), children);
}
children.put(item.getData().getIdentifier(), item);
List<ItemState> listItemState = childNodeStates.get(item.getData().getParentIdentifier());
if (listItemState == null)
{
listItemState = new ArrayList<ItemState>();
childNodeStates.put(item.getData().getParentIdentifier(), listItemState);
}
listItemState.add(item);
if (item.isPathChanged())
{
if (allPathsChanged == null)
{
allPathsChanged = new ArrayList<ItemState>();
}
allPathsChanged.add(item);
}
}
else
{
Map<String, ItemState> children = lastChildPropertyStates.get(item.getData().getParentIdentifier());
if (children == null)
{
children = new HashMap<String, ItemState>();
lastChildPropertyStates.put(item.getData().getParentIdentifier(), children);
}
children.put(item.getData().getIdentifier(), item);
List<ItemState> listItemState = childPropertyStates.get(item.getData().getParentIdentifier());
if (listItemState == null)
{
listItemState = new ArrayList<ItemState>();
childPropertyStates.put(item.getData().getParentIdentifier(), listItemState);
}
listItemState.add(item);
}
if (item.isNode() && item.isPersisted())
{
int[] childInfo = childNodesInfo.get(item.getData().getParentIdentifier());
if (childInfo == null)
{
childInfo = new int[2];
}
if (item.isDeleted())
{
--childInfo[CHILD_NODES_COUNT];
}
else if (item.isAdded())
{
++childInfo[CHILD_NODES_COUNT];
childInfo[CHILD_NODES_LAST_ORDER_NUMBER] = ((NodeData)item.getData()).getOrderNumber();
}
childNodesInfo.put(item.getData().getParentIdentifier(), childInfo);
}
} } | public class class_name {
protected void addItem(ItemState item)
{
index.put(item.getData().getIdentifier(), item);
index.put(item.getData().getQPath(), item);
index.put(new ParentIDQPathBasedKey(item), item);
index.put(new IDStateBasedKey(item.getData().getIdentifier(), item.getState()), item);
if (item.getData().isNode())
{
Map<String, ItemState> children = lastChildNodeStates.get(item.getData().getParentIdentifier());
if (children == null)
{
children = new HashMap<String, ItemState>(); // depends on control dependency: [if], data = [none]
lastChildNodeStates.put(item.getData().getParentIdentifier(), children); // depends on control dependency: [if], data = [none]
}
children.put(item.getData().getIdentifier(), item); // depends on control dependency: [if], data = [none]
List<ItemState> listItemState = childNodeStates.get(item.getData().getParentIdentifier());
if (listItemState == null)
{
listItemState = new ArrayList<ItemState>(); // depends on control dependency: [if], data = [none]
childNodeStates.put(item.getData().getParentIdentifier(), listItemState); // depends on control dependency: [if], data = [none]
}
listItemState.add(item); // depends on control dependency: [if], data = [none]
if (item.isPathChanged())
{
if (allPathsChanged == null)
{
allPathsChanged = new ArrayList<ItemState>(); // depends on control dependency: [if], data = [none]
}
allPathsChanged.add(item); // depends on control dependency: [if], data = [none]
}
}
else
{
Map<String, ItemState> children = lastChildPropertyStates.get(item.getData().getParentIdentifier());
if (children == null)
{
children = new HashMap<String, ItemState>(); // depends on control dependency: [if], data = [none]
lastChildPropertyStates.put(item.getData().getParentIdentifier(), children); // depends on control dependency: [if], data = [none]
}
children.put(item.getData().getIdentifier(), item); // depends on control dependency: [if], data = [none]
List<ItemState> listItemState = childPropertyStates.get(item.getData().getParentIdentifier());
if (listItemState == null)
{
listItemState = new ArrayList<ItemState>(); // depends on control dependency: [if], data = [none]
childPropertyStates.put(item.getData().getParentIdentifier(), listItemState); // depends on control dependency: [if], data = [none]
}
listItemState.add(item); // depends on control dependency: [if], data = [none]
}
if (item.isNode() && item.isPersisted())
{
int[] childInfo = childNodesInfo.get(item.getData().getParentIdentifier());
if (childInfo == null)
{
childInfo = new int[2]; // depends on control dependency: [if], data = [none]
}
if (item.isDeleted())
{
--childInfo[CHILD_NODES_COUNT]; // depends on control dependency: [if], data = [none]
}
else if (item.isAdded())
{
++childInfo[CHILD_NODES_COUNT]; // depends on control dependency: [if], data = [none]
childInfo[CHILD_NODES_LAST_ORDER_NUMBER] = ((NodeData)item.getData()).getOrderNumber(); // depends on control dependency: [if], data = [none]
}
childNodesInfo.put(item.getData().getParentIdentifier(), childInfo); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int handleOpenGroup() {
int result = errOK;
this.openGroupCount++; // stats
this.groupLevel++; // current group level in tokeniser
this.docGroupLevel++; // current group level in document
if (this.getTokeniserState() == TOKENISER_SKIP_GROUP) {
this.groupSkippedCount++;
}
RtfDestination dest = this.getCurrentDestination();
boolean handled = false;
if(dest != null) {
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: before dest.handleOpeningSubGroup()");
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: destination=" + dest.toString());
}
handled = dest.handleOpeningSubGroup();
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: after dest.handleOpeningSubGroup()");
}
}
this.stackState.push(this.currentState);
this.currentState = new RtfParserState(this.currentState);
// do not set this true until after the state is pushed
// otherwise it inserts a { where one does not belong.
this.currentState.newGroup = true;
dest = this.getCurrentDestination();
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: handleOpenGroup()");
if(this.lastCtrlWordParam != null)
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: LastCtrlWord=" + this.lastCtrlWordParam.ctrlWord);
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: grouplevel=" + Integer.toString(groupLevel));
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: destination=" + dest.toString());
}
if(dest != null) {
handled = dest.handleOpenGroup();
}
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: after dest.handleOpenGroup(); handled=" + Boolean.toString(handled));
}
return result;
} } | public class class_name {
public int handleOpenGroup() {
int result = errOK;
this.openGroupCount++; // stats
this.groupLevel++; // current group level in tokeniser
this.docGroupLevel++; // current group level in document
if (this.getTokeniserState() == TOKENISER_SKIP_GROUP) {
this.groupSkippedCount++;
// depends on control dependency: [if], data = [none]
}
RtfDestination dest = this.getCurrentDestination();
boolean handled = false;
if(dest != null) {
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: before dest.handleOpeningSubGroup()");
// depends on control dependency: [if], data = [none]
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: destination=" + dest.toString());
// depends on control dependency: [if], data = [none]
}
handled = dest.handleOpeningSubGroup();
// depends on control dependency: [if], data = [none]
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: after dest.handleOpeningSubGroup()");
// depends on control dependency: [if], data = [none]
}
}
this.stackState.push(this.currentState);
this.currentState = new RtfParserState(this.currentState);
// do not set this true until after the state is pushed
// otherwise it inserts a { where one does not belong.
this.currentState.newGroup = true;
dest = this.getCurrentDestination();
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: handleOpenGroup()");
// depends on control dependency: [if], data = [none]
if(this.lastCtrlWordParam != null)
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: LastCtrlWord=" + this.lastCtrlWordParam.ctrlWord);
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: grouplevel=" + Integer.toString(groupLevel));
// depends on control dependency: [if], data = [none]
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: destination=" + dest.toString());
// depends on control dependency: [if], data = [none]
}
if(dest != null) {
handled = dest.handleOpenGroup();
// depends on control dependency: [if], data = [none]
}
if(debugParser) {
RtfParser.outputDebug(this.rtfDoc, groupLevel, "DEBUG: after dest.handleOpenGroup(); handled=" + Boolean.toString(handled));
// depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static String[] trimItems(String[] arr) {
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i].trim();
}
return arr;
} } | public class class_name {
public static String[] trimItems(String[] arr) {
for (int i = 0; i < arr.length; i++) {
arr[i] = arr[i].trim(); // depends on control dependency: [for], data = [i]
}
return arr;
} } |
public class class_name {
public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> itemDataFilters)
throws RepositoryException
{
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getChildPropertiesData(" + parent.getQPath().getAsString() + ") >>>>>");
}
try
{
List<PropertyData> childProperties =
(isNew(parent.getIdentifier())) ? new ArrayList<PropertyData>() : transactionableManager
.getChildPropertiesData(parent, itemDataFilters);
return (List<PropertyData>)mergeProps(parent, childProperties, transactionableManager);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getChildPropertiesData(" + parent.getQPath().getAsString() + ") <<<<< "
+ ((System.currentTimeMillis() - start) / 1000d) + "sec");
}
}
} } | public class class_name {
public List<PropertyData> getChildPropertiesData(NodeData parent, List<QPathEntryFilter> itemDataFilters)
throws RepositoryException
{
long start = 0;
if (LOG.isDebugEnabled())
{
start = System.currentTimeMillis();
LOG.debug("getChildPropertiesData(" + parent.getQPath().getAsString() + ") >>>>>");
}
try
{
List<PropertyData> childProperties =
(isNew(parent.getIdentifier())) ? new ArrayList<PropertyData>() : transactionableManager
.getChildPropertiesData(parent, itemDataFilters);
return (List<PropertyData>)mergeProps(parent, childProperties, transactionableManager);
}
finally
{
if (LOG.isDebugEnabled())
{
LOG.debug("getChildPropertiesData(" + parent.getQPath().getAsString() + ") <<<<< "
+ ((System.currentTimeMillis() - start) / 1000d) + "sec"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public String getBasePath() {
if (basePath == null) {
try {
basePath = getMainClass().getProtectionDomain().getCodeSource().getLocation().getPath();
int lastIndex = basePath.lastIndexOf('/');
if (lastIndex < 0) {
lastIndex = basePath.lastIndexOf('\\');
}
basePath = basePath.substring(0, lastIndex);
basePath = URLDecoder.decode(basePath, Encoding.UTF8);
} catch (Throwable e) {
basePath = ".";
}
}
return basePath;
} } | public class class_name {
public String getBasePath() {
if (basePath == null) {
try {
basePath = getMainClass().getProtectionDomain().getCodeSource().getLocation().getPath(); // depends on control dependency: [try], data = [none]
int lastIndex = basePath.lastIndexOf('/');
if (lastIndex < 0) {
lastIndex = basePath.lastIndexOf('\\'); // depends on control dependency: [if], data = [none]
}
basePath = basePath.substring(0, lastIndex); // depends on control dependency: [try], data = [none]
basePath = URLDecoder.decode(basePath, Encoding.UTF8); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
basePath = ".";
} // depends on control dependency: [catch], data = [none]
}
return basePath;
} } |
public class class_name {
public static Token parseToken(byte[] secret, String token) {
Token tk = new Token();
if (S.blank(token)) return tk;
String s = "";
try {
s = Crypto.decryptAES(token, secret);
} catch (Exception e) {
return tk;
}
String[] sa = s.split("\\|");
if (sa.length < 2) return tk;
tk.id = sa[0];
try {
tk.due = Long.parseLong(sa[1]);
if (tk.expired()) {
return tk;
}
} catch (Exception e) {
tk.due = $.ms() - 1000 * 60 * 60 * 24;
return tk;
}
if (sa.length > 2) {
sa = Arrays.copyOfRange(sa, 2, sa.length);
tk.payload.addAll(C.listOf(sa));
}
return tk;
} } | public class class_name {
public static Token parseToken(byte[] secret, String token) {
Token tk = new Token();
if (S.blank(token)) return tk;
String s = "";
try {
s = Crypto.decryptAES(token, secret); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return tk;
} // depends on control dependency: [catch], data = [none]
String[] sa = s.split("\\|");
if (sa.length < 2) return tk;
tk.id = sa[0];
try {
tk.due = Long.parseLong(sa[1]); // depends on control dependency: [try], data = [none]
if (tk.expired()) {
return tk; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
tk.due = $.ms() - 1000 * 60 * 60 * 24;
return tk;
} // depends on control dependency: [catch], data = [none]
if (sa.length > 2) {
sa = Arrays.copyOfRange(sa, 2, sa.length); // depends on control dependency: [if], data = [none]
tk.payload.addAll(C.listOf(sa)); // depends on control dependency: [if], data = [none]
}
return tk;
} } |
public class class_name {
public static Collection<InetAddress> getAllByName(String host, boolean allowIPv6) {
Enumeration<NetworkInterface> networkInterfaces = cloneInterfaces(ResolutionUtils.networkInterfaces);
List<String> resolvedAddresses = resolveDeviceAddress(host, networkInterfaces, allowIPv6);
List<InetAddress> resolvedDeviceURIs = new ArrayList<>();
List<InetAddress> resolvedHosts = resolvedDeviceURIs;
for (String resolvedAddress : resolvedAddresses) {
try {
resolvedHosts.addAll(asList(InetAddress.getAllByName(resolvedAddress)));
} catch (UnknownHostException e) {
e.printStackTrace();
}
}
return resolvedHosts;
} } | public class class_name {
public static Collection<InetAddress> getAllByName(String host, boolean allowIPv6) {
Enumeration<NetworkInterface> networkInterfaces = cloneInterfaces(ResolutionUtils.networkInterfaces);
List<String> resolvedAddresses = resolveDeviceAddress(host, networkInterfaces, allowIPv6);
List<InetAddress> resolvedDeviceURIs = new ArrayList<>();
List<InetAddress> resolvedHosts = resolvedDeviceURIs;
for (String resolvedAddress : resolvedAddresses) {
try {
resolvedHosts.addAll(asList(InetAddress.getAllByName(resolvedAddress))); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return resolvedHosts;
} } |
public class class_name {
public void setId(long id)
{
// Find the enumeration node for this enumeration value.
EnumerationNode node = null;
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
// Fetch the string value from the attribute class array of finalized values.
node = attributeClass.lookupValue[value];
}
else
{
// The attribute class has not been finalized yet.
// Fetch the string value from the attribute class list of unfinalized values.
node = attributeClass.lookupValueList.get(value);
}
// Extract the id from it.
long existingId = node.id;
// Do nothing if the new id matches the existing one.
if (id == existingId)
{
return;
}
// Check if the type is finalized.
if (attributeClass.finalized)
{
// Raise an illegal argument exception if the id is not known.
EnumeratedStringAttribute newValue = attributeClass.getAttributeFromId(id);
// Otherwise, change the value of this attribute to that of the new id.
this.value = newValue.value;
}
else
{
// The type is un-finalized.
// Check if another instance of the type already has the id and raise an exception if so.
EnumerationNode existingNode = attributeClass.idMap.get(id);
if (existingNode != null)
{
throw new IllegalArgumentException("The id value, " + id +
", cannot be set because another instance of this type with that " + "id already exists.");
}
// Assign it to this instance if the type is unfinalized. Also removing the old id mapping from the id
// map and replacing it with the new one.
node.id = id;
attributeClass.idMap.remove(existingId);
attributeClass.idMap.put(id, node);
}
} } | public class class_name {
public void setId(long id)
{
// Find the enumeration node for this enumeration value.
EnumerationNode node = null;
// Check if the attribute class has been finalized yet.
if (attributeClass.finalized)
{
// Fetch the string value from the attribute class array of finalized values.
node = attributeClass.lookupValue[value]; // depends on control dependency: [if], data = [none]
}
else
{
// The attribute class has not been finalized yet.
// Fetch the string value from the attribute class list of unfinalized values.
node = attributeClass.lookupValueList.get(value); // depends on control dependency: [if], data = [none]
}
// Extract the id from it.
long existingId = node.id;
// Do nothing if the new id matches the existing one.
if (id == existingId)
{
return; // depends on control dependency: [if], data = [none]
}
// Check if the type is finalized.
if (attributeClass.finalized)
{
// Raise an illegal argument exception if the id is not known.
EnumeratedStringAttribute newValue = attributeClass.getAttributeFromId(id);
// Otherwise, change the value of this attribute to that of the new id.
this.value = newValue.value; // depends on control dependency: [if], data = [none]
}
else
{
// The type is un-finalized.
// Check if another instance of the type already has the id and raise an exception if so.
EnumerationNode existingNode = attributeClass.idMap.get(id);
if (existingNode != null)
{
throw new IllegalArgumentException("The id value, " + id +
", cannot be set because another instance of this type with that " + "id already exists.");
}
// Assign it to this instance if the type is unfinalized. Also removing the old id mapping from the id
// map and replacing it with the new one.
node.id = id; // depends on control dependency: [if], data = [none]
attributeClass.idMap.remove(existingId); // depends on control dependency: [if], data = [none]
attributeClass.idMap.put(id, node); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Configuration getConfiguration() {
if(configuration == null){
try {
configuration = (Configuration) getContext().getBean("configuration");
} catch (BeansException e) {
LOGGER.error("Can't load config. Error: {}",e ,e);
}
}
return configuration;
} } | public class class_name {
public static Configuration getConfiguration() {
if(configuration == null){
try {
configuration = (Configuration) getContext().getBean("configuration"); // depends on control dependency: [try], data = [none]
} catch (BeansException e) {
LOGGER.error("Can't load config. Error: {}",e ,e);
} // depends on control dependency: [catch], data = [none]
}
return configuration;
} } |
public class class_name {
public static Ipv6 parse(final String ipv6Address) {
try {
String ipv6String = Validate.notNull(ipv6Address).trim();
Validate.isTrue(!ipv6String.isEmpty());
final boolean isIpv6AddressWithEmbeddedIpv4 = ipv6String.contains(".");
if (isIpv6AddressWithEmbeddedIpv4) {
ipv6String = getIpv6AddressWithIpv4SectionInIpv6Notation(ipv6String);
}
final int indexOfDoubleColons = ipv6String.indexOf("::");
final boolean isShortened = indexOfDoubleColons != -1;
if (isShortened) {
Validate.isTrue(indexOfDoubleColons == ipv6String.lastIndexOf("::"));
ipv6String = expandMissingColons(ipv6String, indexOfDoubleColons);
}
final String[] split = ipv6String.split(COLON, TOTAL_OCTETS);
Validate.isTrue(split.length == TOTAL_OCTETS);
BigInteger ipv6value = BigInteger.ZERO;
for (String part : split) {
Validate.isTrue(part.length() <= MAX_PART_LENGTH);
Validate.checkRange(Integer.parseInt(part, BITS_PER_PART), MIN_PART_VALUE, MAX_PART_VALUE);
ipv6value = ipv6value.shiftLeft(BITS_PER_PART).add(new BigInteger(part, BITS_PER_PART));
}
return new Ipv6(ipv6value);
} catch (Exception e) {
throw new IllegalArgumentException(String.format(DEFAULT_PARSING_ERROR_MESSAGE, ipv6Address), e);
}
} } | public class class_name {
public static Ipv6 parse(final String ipv6Address) {
try {
String ipv6String = Validate.notNull(ipv6Address).trim();
Validate.isTrue(!ipv6String.isEmpty()); // depends on control dependency: [try], data = [none]
final boolean isIpv6AddressWithEmbeddedIpv4 = ipv6String.contains(".");
if (isIpv6AddressWithEmbeddedIpv4) {
ipv6String = getIpv6AddressWithIpv4SectionInIpv6Notation(ipv6String); // depends on control dependency: [if], data = [none]
}
final int indexOfDoubleColons = ipv6String.indexOf("::");
final boolean isShortened = indexOfDoubleColons != -1;
if (isShortened) {
Validate.isTrue(indexOfDoubleColons == ipv6String.lastIndexOf("::")); // depends on control dependency: [if], data = [none]
ipv6String = expandMissingColons(ipv6String, indexOfDoubleColons); // depends on control dependency: [if], data = [none]
}
final String[] split = ipv6String.split(COLON, TOTAL_OCTETS);
Validate.isTrue(split.length == TOTAL_OCTETS); // depends on control dependency: [try], data = [none]
BigInteger ipv6value = BigInteger.ZERO;
for (String part : split) {
Validate.isTrue(part.length() <= MAX_PART_LENGTH); // depends on control dependency: [for], data = [part]
Validate.checkRange(Integer.parseInt(part, BITS_PER_PART), MIN_PART_VALUE, MAX_PART_VALUE); // depends on control dependency: [for], data = [part]
ipv6value = ipv6value.shiftLeft(BITS_PER_PART).add(new BigInteger(part, BITS_PER_PART)); // depends on control dependency: [for], data = [part]
}
return new Ipv6(ipv6value); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException(String.format(DEFAULT_PARSING_ERROR_MESSAGE, ipv6Address), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void delete(String key) {
final String KEY = calcCacheKey(key);
try {
if (keyMode == KeyMode.HASH) {
getJedis().hdel(getName(), KEY);
} else {
getJedis().del(KEY);
}
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
}
} } | public class class_name {
@Override
public void delete(String key) {
final String KEY = calcCacheKey(key);
try {
if (keyMode == KeyMode.HASH) {
getJedis().hdel(getName(), KEY); // depends on control dependency: [if], data = [none]
} else {
getJedis().del(KEY); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw e instanceof CacheException ? (CacheException) e : new CacheException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getName(int ch, int choice)
{
if (ch < UCharacter.MIN_VALUE || ch > UCharacter.MAX_VALUE ||
choice > UCharacterNameChoice.CHAR_NAME_CHOICE_COUNT) {
return null;
}
String result = null;
result = getAlgName(ch, choice);
// getting normal character name
if (result == null || result.length() == 0) {
if (choice == UCharacterNameChoice.EXTENDED_CHAR_NAME) {
result = getExtendedName(ch);
} else {
result = getGroupName(ch, choice);
}
}
return result;
} } | public class class_name {
public String getName(int ch, int choice)
{
if (ch < UCharacter.MIN_VALUE || ch > UCharacter.MAX_VALUE ||
choice > UCharacterNameChoice.CHAR_NAME_CHOICE_COUNT) {
return null; // depends on control dependency: [if], data = [none]
}
String result = null;
result = getAlgName(ch, choice);
// getting normal character name
if (result == null || result.length() == 0) {
if (choice == UCharacterNameChoice.EXTENDED_CHAR_NAME) {
result = getExtendedName(ch); // depends on control dependency: [if], data = [none]
} else {
result = getGroupName(ch, choice); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public void updateFrontFacingRotation(float rotation) {
if (!Float.isNaN(rotation) && !equal(rotation, frontFacingRotation)) {
final float oldRotation = frontFacingRotation;
frontFacingRotation = rotation % 360;
for (OnFrontRotationChangedListener listener : mOnFrontRotationChangedListeners) {
try {
listener.onFrontRotationChanged(this, frontFacingRotation, oldRotation);
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e, "updateFrontFacingRotation()");
}
}
}
} } | public class class_name {
public void updateFrontFacingRotation(float rotation) {
if (!Float.isNaN(rotation) && !equal(rotation, frontFacingRotation)) {
final float oldRotation = frontFacingRotation;
frontFacingRotation = rotation % 360; // depends on control dependency: [if], data = [none]
for (OnFrontRotationChangedListener listener : mOnFrontRotationChangedListeners) {
try {
listener.onFrontRotationChanged(this, frontFacingRotation, oldRotation); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, e, "updateFrontFacingRotation()");
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public AnnotationVisitor visitParameterAnnotation(int parameter,
String desc, boolean visible) {
if (mv != null) {
return mv.visitParameterAnnotation(parameter, desc, visible);
}
return null;
} } | public class class_name {
public AnnotationVisitor visitParameterAnnotation(int parameter,
String desc, boolean visible) {
if (mv != null) {
return mv.visitParameterAnnotation(parameter, desc, visible); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private Object[] stubWaitForResult(Stub stub, long waitTime)
throws ExecutionException, InterruptedException, RemoteException { // F16043
while (true) {
if (!Util.isLocal(stub)) {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
try {
OutputStream out = stub._request("waitForResult", true);
out.write_longlong(waitTime);
in = (org.omg.CORBA_2_3.portable.InputStream) stub._invoke(out);
return (Object[]) in.read_value(Object[].class);
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
if (id.equals("IDL:java/util/concurrent/ExecutionEx:1.0")) {
throw (ExecutionException) in.read_value(ExecutionException.class);
}
if (id.equals("IDL:java/lang/InterruptedEx:1.0")) {
throw (InterruptedException) in.read_value(InterruptedException.class);
}
throw new UnexpectedException(id);
} catch (RemarshalException ex) {
continue;
}
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
stub._releaseReply(in);
}
}
ServantObject so = stub._servant_preinvoke("waitForResult", RemoteAsyncResultExtended.class);
if (so == null) {
continue;
}
try {
Object[] result = ((RemoteAsyncResultExtended) so.servant).waitForResult(waitTime);
return (Object[]) Util.copyObject(result, stub._orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable) Util.copyObject(ex, stub._orb());
if (exCopy instanceof ExecutionException) {
throw (ExecutionException) exCopy;
}
if (exCopy instanceof InterruptedException) {
throw (InterruptedException) exCopy;
}
throw Util.wrapException(exCopy);
} finally {
stub._servant_postinvoke(so);
}
}
} } | public class class_name {
private Object[] stubWaitForResult(Stub stub, long waitTime)
throws ExecutionException, InterruptedException, RemoteException { // F16043
while (true) {
if (!Util.isLocal(stub)) {
org.omg.CORBA_2_3.portable.InputStream in = null;
try {
try {
OutputStream out = stub._request("waitForResult", true);
out.write_longlong(waitTime); // depends on control dependency: [try], data = [none]
in = (org.omg.CORBA_2_3.portable.InputStream) stub._invoke(out); // depends on control dependency: [try], data = [none]
return (Object[]) in.read_value(Object[].class); // depends on control dependency: [try], data = [none]
} catch (ApplicationException ex) {
in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream();
String id = in.read_string();
if (id.equals("IDL:java/util/concurrent/ExecutionEx:1.0")) {
throw (ExecutionException) in.read_value(ExecutionException.class);
}
if (id.equals("IDL:java/lang/InterruptedEx:1.0")) {
throw (InterruptedException) in.read_value(InterruptedException.class);
}
throw new UnexpectedException(id);
} catch (RemarshalException ex) { // depends on control dependency: [catch], data = [none]
continue;
} // depends on control dependency: [catch], data = [none]
} catch (SystemException ex) {
throw Util.mapSystemException(ex);
} finally {
stub._releaseReply(in);
}
}
ServantObject so = stub._servant_preinvoke("waitForResult", RemoteAsyncResultExtended.class);
if (so == null) {
continue;
}
try {
Object[] result = ((RemoteAsyncResultExtended) so.servant).waitForResult(waitTime);
return (Object[]) Util.copyObject(result, stub._orb());
} catch (Throwable ex) {
Throwable exCopy = (Throwable) Util.copyObject(ex, stub._orb());
if (exCopy instanceof ExecutionException) {
throw (ExecutionException) exCopy;
}
if (exCopy instanceof InterruptedException) {
throw (InterruptedException) exCopy;
}
throw Util.wrapException(exCopy);
} finally {
stub._servant_postinvoke(so);
}
}
} } |
public class class_name {
public boolean eq(IntIntSortedVector other) {
// This is slow, but correct.
IntIntSortedVector v1 = IntIntSortedVector.getWithNoZeroValues(this);
IntIntSortedVector v2 = IntIntSortedVector.getWithNoZeroValues(other);
if (v2.size() != v1.size()) {
return false;
}
for (IntIntEntry ve : v1) {
if (!Primitives.equals(ve.get(), v2.get(ve.index()))) {
return false;
}
}
for (IntIntEntry ve : v2) {
if (!Primitives.equals(ve.get(), v1.get(ve.index()))) {
return false;
}
}
return true;
} } | public class class_name {
public boolean eq(IntIntSortedVector other) {
// This is slow, but correct.
IntIntSortedVector v1 = IntIntSortedVector.getWithNoZeroValues(this);
IntIntSortedVector v2 = IntIntSortedVector.getWithNoZeroValues(other);
if (v2.size() != v1.size()) {
return false; // depends on control dependency: [if], data = [none]
}
for (IntIntEntry ve : v1) {
if (!Primitives.equals(ve.get(), v2.get(ve.index()))) {
return false; // depends on control dependency: [if], data = [none]
}
}
for (IntIntEntry ve : v2) {
if (!Primitives.equals(ve.get(), v1.get(ve.index()))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static void logout() {
GwtCommandDispatcher dispatcher = GwtCommandDispatcher.getInstance();
if (null != dispatcher.getUserToken()) {
GwtCommand command = new GwtCommand(LogoutRequest.COMMAND);
dispatcher.logout();
dispatcher.execute(command);
}
} } | public class class_name {
public static void logout() {
GwtCommandDispatcher dispatcher = GwtCommandDispatcher.getInstance();
if (null != dispatcher.getUserToken()) {
GwtCommand command = new GwtCommand(LogoutRequest.COMMAND);
dispatcher.logout(); // depends on control dependency: [if], data = [none]
dispatcher.execute(command); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void issueDepthIntervalMessage(long depth)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "issueDepthIntervalMessage", new Long(depth));
if(destinationHandler.isLink())
{
// {0} messages queued for transmission from messaging engine {1} to foreign bus {2} on link {3}.
SibTr.info(tc, "REMOTE_LINK_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0789",
new Object[] {new Long(depth),
destinationHandler.getMessageProcessor().getMessagingEngineName(),
((LinkHandler)destinationHandler).getBusName(),
destinationHandler.getName()});
}
else
{
// {0} messages queued for transmission on messaging engine {1} to destination {2} on messaging engine {3}.
SibTr.info(tc, "REMOTE_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0788",
new Object[] {new Long(depth),
destinationHandler.getMessageProcessor().getMessagingEngineName(),
destinationHandler.getName(),
SIMPUtils.getMENameFromUuid(((PtoPOutputHandler)getOutputHandler()).getTargetMEUuid().toString())});
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "issueDepthIntervalMessage");
} } | public class class_name {
protected void issueDepthIntervalMessage(long depth)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "issueDepthIntervalMessage", new Long(depth));
if(destinationHandler.isLink())
{
// {0} messages queued for transmission from messaging engine {1} to foreign bus {2} on link {3}.
SibTr.info(tc, "REMOTE_LINK_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0789",
new Object[] {new Long(depth),
destinationHandler.getMessageProcessor().getMessagingEngineName(),
((LinkHandler)destinationHandler).getBusName(),
destinationHandler.getName()}); // depends on control dependency: [if], data = [none]
}
else
{
// {0} messages queued for transmission on messaging engine {1} to destination {2} on messaging engine {3}.
SibTr.info(tc, "REMOTE_DESTINATION_DEPTH_INTERVAL_REACHED_CWSIP0788",
new Object[] {new Long(depth),
destinationHandler.getMessageProcessor().getMessagingEngineName(),
destinationHandler.getName(),
SIMPUtils.getMENameFromUuid(((PtoPOutputHandler)getOutputHandler()).getTargetMEUuid().toString())}); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "issueDepthIntervalMessage");
} } |
public class class_name {
public void authenticate() {
URL url;
try {
url = new URL(this.getTokenURL());
} catch (MalformedURLException e) {
assert false : "An invalid token URL indicates a bug in the SDK.";
throw new RuntimeException("An invalid token URL indicates a bug in the SDK.", e);
}
String jwtAssertion = this.constructJWTAssertion();
String urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);
BoxAPIRequest request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
String json;
try {
BoxJSONResponse response = (BoxJSONResponse) request.send();
json = response.getJSON();
} catch (BoxAPIException ex) {
// Use the Date advertised by the Box server as the current time to synchronize clocks
List<String> responseDates = ex.getHeaders().get("Date");
NumericDate currentTime;
if (responseDates != null) {
String responseDate = responseDates.get(0);
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
try {
Date date = dateFormat.parse(responseDate);
currentTime = NumericDate.fromMilliseconds(date.getTime());
} catch (ParseException e) {
currentTime = NumericDate.now();
}
} else {
currentTime = NumericDate.now();
}
// Reconstruct the JWT assertion, which regenerates the jti claim, with the new "current" time
jwtAssertion = this.constructJWTAssertion(currentTime);
urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);
// Re-send the updated request
request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
BoxJSONResponse response = (BoxJSONResponse) request.send();
json = response.getJSON();
}
JsonObject jsonObject = JsonObject.readFrom(json);
this.setAccessToken(jsonObject.get("access_token").asString());
this.setLastRefresh(System.currentTimeMillis());
this.setExpires(jsonObject.get("expires_in").asLong() * 1000);
//if token cache is specified, save to cache
if (this.accessTokenCache != null) {
String key = this.getAccessTokenCacheKey();
JsonObject accessTokenCacheInfo = new JsonObject()
.add("accessToken", this.getAccessToken())
.add("lastRefresh", this.getLastRefresh())
.add("expires", this.getExpires());
this.accessTokenCache.put(key, accessTokenCacheInfo.toString());
}
} } | public class class_name {
public void authenticate() {
URL url;
try {
url = new URL(this.getTokenURL()); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
assert false : "An invalid token URL indicates a bug in the SDK.";
throw new RuntimeException("An invalid token URL indicates a bug in the SDK.", e);
} // depends on control dependency: [catch], data = [none]
String jwtAssertion = this.constructJWTAssertion();
String urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);
BoxAPIRequest request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
String json;
try {
BoxJSONResponse response = (BoxJSONResponse) request.send();
json = response.getJSON(); // depends on control dependency: [try], data = [none]
} catch (BoxAPIException ex) {
// Use the Date advertised by the Box server as the current time to synchronize clocks
List<String> responseDates = ex.getHeaders().get("Date");
NumericDate currentTime;
if (responseDates != null) {
String responseDate = responseDates.get(0);
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz");
try {
Date date = dateFormat.parse(responseDate);
currentTime = NumericDate.fromMilliseconds(date.getTime()); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
currentTime = NumericDate.now();
} // depends on control dependency: [catch], data = [none]
} else {
currentTime = NumericDate.now(); // depends on control dependency: [if], data = [none]
}
// Reconstruct the JWT assertion, which regenerates the jti claim, with the new "current" time
jwtAssertion = this.constructJWTAssertion(currentTime);
urlParameters = String.format(JWT_GRANT_TYPE, this.getClientID(), this.getClientSecret(), jwtAssertion);
// Re-send the updated request
request = new BoxAPIRequest(this, url, "POST");
request.shouldAuthenticate(false);
request.setBody(urlParameters);
BoxJSONResponse response = (BoxJSONResponse) request.send();
json = response.getJSON();
} // depends on control dependency: [catch], data = [none]
JsonObject jsonObject = JsonObject.readFrom(json);
this.setAccessToken(jsonObject.get("access_token").asString());
this.setLastRefresh(System.currentTimeMillis());
this.setExpires(jsonObject.get("expires_in").asLong() * 1000);
//if token cache is specified, save to cache
if (this.accessTokenCache != null) {
String key = this.getAccessTokenCacheKey();
JsonObject accessTokenCacheInfo = new JsonObject()
.add("accessToken", this.getAccessToken())
.add("lastRefresh", this.getLastRefresh())
.add("expires", this.getExpires());
this.accessTokenCache.put(key, accessTokenCacheInfo.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public T execute(final Task<T> taskToWrap) throws DevFailed {
int triesLeft = tries;
do {
try {
return taskToWrap.call();
} catch (final DevFailed e) {
triesLeft--;
// Are we allowed to try again?
if (triesLeft <= 0) {
// No -- throw
logger.error("Caught exception, all retries done for error: {}", DevFailedUtils.toString(e));
throw e;
}
// Yes -- log and allow to loop
logger.info("Caught exception, retrying... Error was: {}" + DevFailedUtils.toString(e));
try {
Thread.sleep(delay);
} catch (final InterruptedException e1) {
}
}
} while (triesLeft > 0);
return null;
} } | public class class_name {
public T execute(final Task<T> taskToWrap) throws DevFailed {
int triesLeft = tries;
do {
try {
return taskToWrap.call(); // depends on control dependency: [try], data = [none]
} catch (final DevFailed e) {
triesLeft--;
// Are we allowed to try again?
if (triesLeft <= 0) {
// No -- throw
logger.error("Caught exception, all retries done for error: {}", DevFailedUtils.toString(e)); // depends on control dependency: [if], data = [none]
throw e;
}
// Yes -- log and allow to loop
logger.info("Caught exception, retrying... Error was: {}" + DevFailedUtils.toString(e));
try {
Thread.sleep(delay); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException e1) {
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} while (triesLeft > 0);
return null;
} } |
public class class_name {
private static void resetMapperForThrift(boolean isCql3Enabled)
{
if (isCql3Enabled)
{
validationClassMapper.put(Byte.class, BytesType.class);
validationClassMapper.put(byte.class, BytesType.class);
validationClassMapper.put(Short.class, IntegerType.class);
validationClassMapper.put(short.class, IntegerType.class);
validationClassMapper.put(java.sql.Time.class, DateType.class);
validationClassMapper.put(java.sql.Date.class, DateType.class);
validationClassMapper.put(java.util.Date.class, DateType.class);
validationClassMapper.put(java.sql.Timestamp.class, DateType.class);
}
} } | public class class_name {
private static void resetMapperForThrift(boolean isCql3Enabled)
{
if (isCql3Enabled)
{
validationClassMapper.put(Byte.class, BytesType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(byte.class, BytesType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(Short.class, IntegerType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(short.class, IntegerType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(java.sql.Time.class, DateType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(java.sql.Date.class, DateType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(java.util.Date.class, DateType.class); // depends on control dependency: [if], data = [none]
validationClassMapper.put(java.sql.Timestamp.class, DateType.class); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Class<?>[] toClassesFromObjects(final Object[] params) {
final Class<?>[] classes = new Class<?>[params.length];
int i = 0;
for (final Object object : params) {
if (object != null) {
classes[i++] = object.getClass();
} else {
classes[i++] = Object.class;
}
}
return classes;
} } | public class class_name {
public static Class<?>[] toClassesFromObjects(final Object[] params) {
final Class<?>[] classes = new Class<?>[params.length];
int i = 0;
for (final Object object : params) {
if (object != null) {
classes[i++] = object.getClass();
// depends on control dependency: [if], data = [none]
} else {
classes[i++] = Object.class;
// depends on control dependency: [if], data = [none]
}
}
return classes;
} } |
public class class_name {
public PoolEnableAutoScaleOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null;
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince);
}
return this;
} } | public class class_name {
public PoolEnableAutoScaleOptions withIfUnmodifiedSince(DateTime ifUnmodifiedSince) {
if (ifUnmodifiedSince == null) {
this.ifUnmodifiedSince = null; // depends on control dependency: [if], data = [none]
} else {
this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); // depends on control dependency: [if], data = [(ifUnmodifiedSince]
}
return this;
} } |
public class class_name {
public static long ipToLong(String ip) {
if (!isValidIp(ip)) {
throw new IllegalArgumentException("Invalid IP address: " + ip);
}
long result = 0;
String[] ipArr = ip.split("\\.");
for (int i = 3; i >= 0; i--) {
long part = Long.parseLong(ipArr[3 - i]);
result |= part << (i * 8);
}
return result;
} } | public class class_name {
public static long ipToLong(String ip) {
if (!isValidIp(ip)) {
throw new IllegalArgumentException("Invalid IP address: " + ip);
}
long result = 0;
String[] ipArr = ip.split("\\.");
for (int i = 3; i >= 0; i--) {
long part = Long.parseLong(ipArr[3 - i]);
result |= part << (i * 8); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
static String extractStyle(String style, String attribute) {
if (style == null) {
return "";
}
StringTokenizer tokens = new StringTokenizer(style,";");
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken();
String key = token.substring(0,token.indexOf(':'));
if (key.equals(attribute)) {
return token.substring(token.indexOf(':')+1);
}
}
return "";
} } | public class class_name {
static String extractStyle(String style, String attribute) {
if (style == null) {
return "";
// depends on control dependency: [if], data = [none]
}
StringTokenizer tokens = new StringTokenizer(style,";");
while (tokens.hasMoreTokens()) {
String token = tokens.nextToken();
String key = token.substring(0,token.indexOf(':'));
if (key.equals(attribute)) {
return token.substring(token.indexOf(':')+1);
// depends on control dependency: [if], data = [none]
}
}
return "";
} } |
public class class_name {
private void expand(int newCapacity) {
byte[][] newNamesAndValues = new byte[newCapacity][];
if (!isEmpty()) {
System.arraycopy(namesAndValues, 0, newNamesAndValues, 0, len());
}
namesAndValues = newNamesAndValues;
} } | public class class_name {
private void expand(int newCapacity) {
byte[][] newNamesAndValues = new byte[newCapacity][];
if (!isEmpty()) {
System.arraycopy(namesAndValues, 0, newNamesAndValues, 0, len()); // depends on control dependency: [if], data = [none]
}
namesAndValues = newNamesAndValues;
} } |
public class class_name {
private void showSystemMenu() {
Insets insets = frame.getInsets();
if (!frame.isIcon()) {
systemPopupMenu.show(frame, insets.left, getY() + getHeight());
} else {
systemPopupMenu.show(menuButton, getX() - insets.left - insets.right,
getY() - systemPopupMenu.getPreferredSize().height - insets.bottom - insets.top);
}
} } | public class class_name {
private void showSystemMenu() {
Insets insets = frame.getInsets();
if (!frame.isIcon()) {
systemPopupMenu.show(frame, insets.left, getY() + getHeight()); // depends on control dependency: [if], data = [none]
} else {
systemPopupMenu.show(menuButton, getX() - insets.left - insets.right,
getY() - systemPopupMenu.getPreferredSize().height - insets.bottom - insets.top); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public DBInstance withDBParameterGroups(DBParameterGroupStatus... dBParameterGroups) {
if (this.dBParameterGroups == null) {
setDBParameterGroups(new java.util.ArrayList<DBParameterGroupStatus>(dBParameterGroups.length));
}
for (DBParameterGroupStatus ele : dBParameterGroups) {
this.dBParameterGroups.add(ele);
}
return this;
} } | public class class_name {
public DBInstance withDBParameterGroups(DBParameterGroupStatus... dBParameterGroups) {
if (this.dBParameterGroups == null) {
setDBParameterGroups(new java.util.ArrayList<DBParameterGroupStatus>(dBParameterGroups.length)); // depends on control dependency: [if], data = [none]
}
for (DBParameterGroupStatus ele : dBParameterGroups) {
this.dBParameterGroups.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static Minutes minutesIn(ReadableInterval interval) {
if (interval == null) {
return Minutes.ZERO;
}
int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.minutes());
return Minutes.minutes(amount);
} } | public class class_name {
public static Minutes minutesIn(ReadableInterval interval) {
if (interval == null) {
return Minutes.ZERO; // depends on control dependency: [if], data = [none]
}
int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.minutes());
return Minutes.minutes(amount);
} } |
public class class_name {
public void prapareForInferred() {
log.info("Adding additional axioms to calculate inferred axioms");
int key = 0;
int numNf3 = 0;
int numNf8 = 0;
for(final IntIterator itr = ontologyNF2.keyIterator(); itr.hasNext();) {
MonotonicCollection<NF2> nf2s = ontologyNF2.get(itr.next());
for(final Iterator<NF2> itr2 = nf2s.iterator(); itr2.hasNext();) {
NF2 nf2 = itr2.next();
// TODO remove
if(factory.lookupConceptId(nf2.lhsA).equals("287402001")) {
System.err.println(nf2);
key = nf2.rhsB;
}
// TODO remove
// The problem is likely to be in this method call!
if(!containsExistentialInNF3s(nf2.rhsR, nf2.rhsB, nf2.lhsA)) {
NF3 nnf = NF3.getInstance(nf2.rhsR, nf2.rhsB, factory.getConcept(new Existential(nf2.rhsR,
new au.csiro.snorocket.core.model.Concept(nf2.rhsB))));
//as.addAxiom(nnf); // Needed for incremental
addTerm(nnf);
numNf3++;
if(factory.lookupConceptId(nf2.lhsA).equals("287402001")) {
System.err.println("Added "+nnf);
}
}
}
}
System.out.println(key);
// TODO remove
for(NF2 nn : ontologyNF2.get(key)) {
System.err.println(nn);
}
// TODO remove
for(final IntIterator itr = ontologyNF7.keyIterator(); itr.hasNext();) {
MonotonicCollection<NF7> nf7s = ontologyNF7.get(itr.next());
for(final Iterator<NF7> itr2 = nf7s.iterator(); itr2.hasNext();) {
NF7 nf7 = itr2.next();
Datatype rhs = nf7.getD();
if(!containsDatatypeInNF8s(rhs)) {
NF8 nnf = NF8.getInstance(rhs, factory.getConcept(rhs));
//as.addAxiom(nnf); // Needed for incremental
addTerm(nnf);
numNf8++;
}
}
}
log.info("Added "+numNf3+" NF3 axioms and "+numNf8+" NF8 axioms.");
// FIXME: there seems to be an issue with incremental classification and these axioms. For now these will be
// excluded because there is no need for these for SNOMED CT and AMT.
/*
// try introducing a new axiom for each NF1b new concept [ A1 + A2 - add the conjunction object as key
for(NF1b nf1b : getNF1bs()) {
Object a1 = factory.lookupConceptId(nf1b.lhsA1());
Object a2 = factory.lookupConceptId(nf1b.lhsA2());
AbstractConcept ac1 = null;
AbstractConcept ac2 = null;
// We assume these are either Strings or Existentials
if(a1 instanceof String) {
ac1 = new au.csiro.snorocket.core.model.Concept(nf1b.lhsA1());
} else {
// This will throw a ClassCastException if an object outside of the internal model is found
ac1 = (AbstractConcept) a1;
}
if(a2 instanceof String) {
ac2 = new au.csiro.snorocket.core.model.Concept(nf1b.lhsA2());
} else {
// This will throw a ClassCastException if an object outside of the internal model is found
ac2 = (AbstractConcept) a2;
}
Conjunction con = new Conjunction(new AbstractConcept[] { ac1, ac2 });
int nid = factory.getConcept(con);
NF1a nf1a1 = NF1a.getInstance(nid, nf1b.lhsA1());
NF1a nf1a2 = NF1a.getInstance(nid, nf1b.lhsA2());
addTerm(nf1a1);
addTerm(nf1a2);
}
*/
} } | public class class_name {
public void prapareForInferred() {
log.info("Adding additional axioms to calculate inferred axioms");
int key = 0;
int numNf3 = 0;
int numNf8 = 0;
for(final IntIterator itr = ontologyNF2.keyIterator(); itr.hasNext();) {
MonotonicCollection<NF2> nf2s = ontologyNF2.get(itr.next());
for(final Iterator<NF2> itr2 = nf2s.iterator(); itr2.hasNext();) {
NF2 nf2 = itr2.next();
// TODO remove
if(factory.lookupConceptId(nf2.lhsA).equals("287402001")) {
System.err.println(nf2); // depends on control dependency: [if], data = [none]
key = nf2.rhsB; // depends on control dependency: [if], data = [none]
}
// TODO remove
// The problem is likely to be in this method call!
if(!containsExistentialInNF3s(nf2.rhsR, nf2.rhsB, nf2.lhsA)) {
NF3 nnf = NF3.getInstance(nf2.rhsR, nf2.rhsB, factory.getConcept(new Existential(nf2.rhsR,
new au.csiro.snorocket.core.model.Concept(nf2.rhsB))));
//as.addAxiom(nnf); // Needed for incremental
addTerm(nnf); // depends on control dependency: [if], data = [none]
numNf3++; // depends on control dependency: [if], data = [none]
if(factory.lookupConceptId(nf2.lhsA).equals("287402001")) {
System.err.println("Added "+nnf); // depends on control dependency: [if], data = [none]
}
}
}
}
System.out.println(key);
// TODO remove
for(NF2 nn : ontologyNF2.get(key)) {
System.err.println(nn); // depends on control dependency: [for], data = [nn]
}
// TODO remove
for(final IntIterator itr = ontologyNF7.keyIterator(); itr.hasNext();) {
MonotonicCollection<NF7> nf7s = ontologyNF7.get(itr.next());
for(final Iterator<NF7> itr2 = nf7s.iterator(); itr2.hasNext();) {
NF7 nf7 = itr2.next();
Datatype rhs = nf7.getD();
if(!containsDatatypeInNF8s(rhs)) {
NF8 nnf = NF8.getInstance(rhs, factory.getConcept(rhs));
//as.addAxiom(nnf); // Needed for incremental
addTerm(nnf); // depends on control dependency: [if], data = [none]
numNf8++; // depends on control dependency: [if], data = [none]
}
}
}
log.info("Added "+numNf3+" NF3 axioms and "+numNf8+" NF8 axioms.");
// FIXME: there seems to be an issue with incremental classification and these axioms. For now these will be
// excluded because there is no need for these for SNOMED CT and AMT.
/*
// try introducing a new axiom for each NF1b new concept [ A1 + A2 - add the conjunction object as key
for(NF1b nf1b : getNF1bs()) {
Object a1 = factory.lookupConceptId(nf1b.lhsA1());
Object a2 = factory.lookupConceptId(nf1b.lhsA2());
AbstractConcept ac1 = null;
AbstractConcept ac2 = null;
// We assume these are either Strings or Existentials
if(a1 instanceof String) {
ac1 = new au.csiro.snorocket.core.model.Concept(nf1b.lhsA1());
} else {
// This will throw a ClassCastException if an object outside of the internal model is found
ac1 = (AbstractConcept) a1;
}
if(a2 instanceof String) {
ac2 = new au.csiro.snorocket.core.model.Concept(nf1b.lhsA2());
} else {
// This will throw a ClassCastException if an object outside of the internal model is found
ac2 = (AbstractConcept) a2;
}
Conjunction con = new Conjunction(new AbstractConcept[] { ac1, ac2 });
int nid = factory.getConcept(con);
NF1a nf1a1 = NF1a.getInstance(nid, nf1b.lhsA1());
NF1a nf1a2 = NF1a.getInstance(nid, nf1b.lhsA2());
addTerm(nf1a1);
addTerm(nf1a2);
}
*/
} } |
public class class_name {
@Override
protected Object createPoolOrConnection()
{
PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(getPersistenceUnit());
Properties props = persistenceUnitMetadata.getProperties();
String host = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_NODES)
: null;
String port = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_PORT)
: null;
if (host == null)
{
host = props.getProperty(PersistenceProperties.KUNDERA_NODES);
}
if (port == null)
{
port = props.getProperty(PersistenceProperties.KUNDERA_PORT);
}
String[] hosts = getHosts(host);
Properties properties = ((ESClientPropertyReader) propertyReader).getConnectionProperties();
Builder builder = Settings.settingsBuilder();
builder.put("client.transport.sniff", true);
if (properties != null)
{
builder.put(properties);
}
Settings settings = builder.build();
TransportClient client = TransportClient.builder().settings(settings).build();
for (String h : hosts)
{
client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress(h, new Integer(port))));
}
return client;
} } | public class class_name {
@Override
protected Object createPoolOrConnection()
{
PersistenceUnitMetadata persistenceUnitMetadata = kunderaMetadata.getApplicationMetadata()
.getPersistenceUnitMetadata(getPersistenceUnit());
Properties props = persistenceUnitMetadata.getProperties();
String host = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_NODES)
: null;
String port = externalProperties != null ? (String) externalProperties.get(PersistenceProperties.KUNDERA_PORT)
: null;
if (host == null)
{
host = props.getProperty(PersistenceProperties.KUNDERA_NODES); // depends on control dependency: [if], data = [none]
}
if (port == null)
{
port = props.getProperty(PersistenceProperties.KUNDERA_PORT); // depends on control dependency: [if], data = [none]
}
String[] hosts = getHosts(host);
Properties properties = ((ESClientPropertyReader) propertyReader).getConnectionProperties();
Builder builder = Settings.settingsBuilder();
builder.put("client.transport.sniff", true);
if (properties != null)
{
builder.put(properties); // depends on control dependency: [if], data = [(properties]
}
Settings settings = builder.build();
TransportClient client = TransportClient.builder().settings(settings).build();
for (String h : hosts)
{
client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress(h, new Integer(port)))); // depends on control dependency: [for], data = [h]
}
return client;
} } |
public class class_name {
public void marshall(DescribeConfigurationRequest describeConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (describeConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeConfigurationRequest.getConfigurationId(), CONFIGURATIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeConfigurationRequest describeConfigurationRequest, ProtocolMarshaller protocolMarshaller) {
if (describeConfigurationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeConfigurationRequest.getConfigurationId(), CONFIGURATIONID_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 void recvAlert() throws IOException {
byte level = (byte)inputRecord.read();
byte description = (byte)inputRecord.read();
if (description == -1) { // check for short message
fatal(Alerts.alert_illegal_parameter, "Short alert message");
}
if (debug != null && (Debug.isOn("record") ||
Debug.isOn("handshake"))) {
synchronized (System.out) {
System.out.print(threadName());
System.out.print(", RECV " + protocolVersion + " ALERT: ");
if (level == Alerts.alert_fatal) {
System.out.print("fatal, ");
} else if (level == Alerts.alert_warning) {
System.out.print("warning, ");
} else {
System.out.print("<level " + (0x0ff & level) + ">, ");
}
System.out.println(Alerts.alertDescription(description));
}
}
if (level == Alerts.alert_warning) {
if (description == Alerts.alert_close_notify) {
if (connectionState == cs_HANDSHAKE) {
fatal(Alerts.alert_unexpected_message,
"Received close_notify during handshake");
} else {
recvCN = true;
closeInboundInternal(); // reply to close
}
} else {
//
// The other legal warnings relate to certificates,
// e.g. no_certificate, bad_certificate, etc; these
// are important to the handshaking code, which can
// also handle illegal protocol alerts if needed.
//
if (handshaker != null) {
handshaker.handshakeAlert(description);
}
}
} else { // fatal or unknown level
String reason = "Received fatal alert: "
+ Alerts.alertDescription(description);
if (closeReason == null) {
closeReason = Alerts.getSSLException(description, reason);
}
fatal(Alerts.alert_unexpected_message, reason);
}
} } | public class class_name {
private void recvAlert() throws IOException {
byte level = (byte)inputRecord.read();
byte description = (byte)inputRecord.read();
if (description == -1) { // check for short message
fatal(Alerts.alert_illegal_parameter, "Short alert message");
}
if (debug != null && (Debug.isOn("record") ||
Debug.isOn("handshake"))) {
synchronized (System.out) {
System.out.print(threadName());
System.out.print(", RECV " + protocolVersion + " ALERT: ");
if (level == Alerts.alert_fatal) {
System.out.print("fatal, "); // depends on control dependency: [if], data = [none]
} else if (level == Alerts.alert_warning) {
System.out.print("warning, "); // depends on control dependency: [if], data = [none]
} else {
System.out.print("<level " + (0x0ff & level) + ">, "); // depends on control dependency: [if], data = [none]
}
System.out.println(Alerts.alertDescription(description));
}
}
if (level == Alerts.alert_warning) {
if (description == Alerts.alert_close_notify) {
if (connectionState == cs_HANDSHAKE) {
fatal(Alerts.alert_unexpected_message,
"Received close_notify during handshake"); // depends on control dependency: [if], data = [none]
} else {
recvCN = true; // depends on control dependency: [if], data = [none]
closeInboundInternal(); // reply to close // depends on control dependency: [if], data = [none]
}
} else {
//
// The other legal warnings relate to certificates,
// e.g. no_certificate, bad_certificate, etc; these
// are important to the handshaking code, which can
// also handle illegal protocol alerts if needed.
//
if (handshaker != null) {
handshaker.handshakeAlert(description); // depends on control dependency: [if], data = [none]
}
}
} else { // fatal or unknown level
String reason = "Received fatal alert: "
+ Alerts.alertDescription(description);
if (closeReason == null) {
closeReason = Alerts.getSSLException(description, reason); // depends on control dependency: [if], data = [none]
}
fatal(Alerts.alert_unexpected_message, reason);
}
} } |
public class class_name {
public FieldAccessor create(final Method method) {
ArgUtils.notNull(method, "method");
final FieldAccessor accessor = new FieldAccessor();
final String methodName = method.getName();
if(ClassUtils.isGetterMethod(method) || ClassUtils.isBooleanGetterMethod(method)) {
final String propertyName;
if(methodName.startsWith("get")) {
propertyName = Utils.uncapitalize(methodName.substring(3));
} else {
propertyName = Utils.uncapitalize(methodName.substring(2));
}
// 共通情報の設定
accessor.name = propertyName;
accessor.targetType = method.getReturnType();
accessor.declaringClass = method.getDeclaringClass();
// getter情報の設定
setupWithGetter(accessor, method);
// フィールド情報の設定
ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(field -> setupWithFiled(accessor, field));
// setter情報の設定
ClassUtils.extractSetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(setter -> setupWithSetter(accessor, setter));
// コンポーネントタイプの設定
if(Collection.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);
} else if(accessor.getType().isArray()) {
accessor.componentType = Optional.of(accessor.getType().getComponentType());
} else if(Map.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
}
} else if(ClassUtils.isSetterMethod(method)) {
final String propertyName = Utils.uncapitalize(methodName.substring(3));
// 共通情報の設定
accessor.name = propertyName;
accessor.targetType = method.getParameterTypes()[0];
accessor.declaringClass = method.getDeclaringClass();
// setter情報の設定
setupWithSetter(accessor, method);
// フィールド情報の設定
ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(field -> setupWithFiled(accessor, field));
// getter情報の設定
if(ClassUtils.isPrimitiveBoolean(accessor.getType())) {
ClassUtils.extractBooleanGetter(accessor.getDeclaringClass(), accessor.getName())
.ifPresent(getter -> setupWithGetter(accessor, getter));
} else {
ClassUtils.extractGetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(getter -> setupWithGetter(accessor, getter));
}
// コンポーネントタイプの設定
if(Collection.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);
} else if(accessor.getType().isArray()) {
accessor.componentType = Optional.of(accessor.getType().getComponentType());
} else if(Map.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
}
} else {
throw new IllegalArgumentException(MessageBuilder.create("method.noAccessor")
.varWithClass("className", method.getDeclaringClass())
.var("methodName", methodName)
.format());
}
// 位置・ラベル情報のアクセッサの設定
if(accessor.hasAnnotation(XlsMapColumns.class)) {
accessor.mapPositionSetter = mapPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
accessor.mapLabelSetter = mapLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
} else if(accessor.hasAnnotation(XlsArrayColumns.class)
|| accessor.hasAnnotation(XlsArrayCells.class)
|| accessor.hasAnnotation(XlsLabelledArrayCells.class)
|| accessor.hasAnnotation(XlsIterateTables.class)){
// リストや配列形式の場合
accessor.arrayPositionSetter = arrayPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
accessor.arrayLabelSetter = arrayLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
if(accessor.hasAnnotation(XlsArrayColumns.class)
|| accessor.hasAnnotation(XlsLabelledArrayCells.class)) {
// インデックスが付いていないラベルの設定
accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
}
} else {
// XlsMapColumnsを持たない通常のプロパティの場合
accessor.positionSetter = positionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
accessor.positionGetter = positionGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
accessor.labelGetter = labelGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
}
return accessor;
} } | public class class_name {
public FieldAccessor create(final Method method) {
ArgUtils.notNull(method, "method");
final FieldAccessor accessor = new FieldAccessor();
final String methodName = method.getName();
if(ClassUtils.isGetterMethod(method) || ClassUtils.isBooleanGetterMethod(method)) {
final String propertyName;
if(methodName.startsWith("get")) {
propertyName = Utils.uncapitalize(methodName.substring(3));
// depends on control dependency: [if], data = [none]
} else {
propertyName = Utils.uncapitalize(methodName.substring(2));
// depends on control dependency: [if], data = [none]
}
// 共通情報の設定
accessor.name = propertyName;
// depends on control dependency: [if], data = [none]
accessor.targetType = method.getReturnType();
// depends on control dependency: [if], data = [none]
accessor.declaringClass = method.getDeclaringClass();
// depends on control dependency: [if], data = [none]
// getter情報の設定
setupWithGetter(accessor, method);
// depends on control dependency: [if], data = [none]
// フィールド情報の設定
ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(field -> setupWithFiled(accessor, field));
// depends on control dependency: [if], data = [none]
// setter情報の設定
ClassUtils.extractSetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(setter -> setupWithSetter(accessor, setter));
// depends on control dependency: [if], data = [none]
// コンポーネントタイプの設定
if(Collection.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);
// depends on control dependency: [if], data = [none]
} else if(accessor.getType().isArray()) {
accessor.componentType = Optional.of(accessor.getType().getComponentType());
// depends on control dependency: [if], data = [none]
} else if(Map.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericReturnType();
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
// depends on control dependency: [if], data = [none]
}
} else if(ClassUtils.isSetterMethod(method)) {
final String propertyName = Utils.uncapitalize(methodName.substring(3));
// 共通情報の設定
accessor.name = propertyName;
// depends on control dependency: [if], data = [none]
accessor.targetType = method.getParameterTypes()[0];
// depends on control dependency: [if], data = [none]
accessor.declaringClass = method.getDeclaringClass();
// depends on control dependency: [if], data = [none]
// setter情報の設定
setupWithSetter(accessor, method);
// depends on control dependency: [if], data = [none]
// フィールド情報の設定
ClassUtils.extractField(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(field -> setupWithFiled(accessor, field));
// depends on control dependency: [if], data = [none]
// getter情報の設定
if(ClassUtils.isPrimitiveBoolean(accessor.getType())) {
ClassUtils.extractBooleanGetter(accessor.getDeclaringClass(), accessor.getName())
.ifPresent(getter -> setupWithGetter(accessor, getter));
// depends on control dependency: [if], data = [none]
} else {
ClassUtils.extractGetter(accessor.getDeclaringClass(), accessor.getName(), accessor.getType())
.ifPresent(getter -> setupWithGetter(accessor, getter));
// depends on control dependency: [if], data = [none]
}
// コンポーネントタイプの設定
if(Collection.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[0]);
// depends on control dependency: [if], data = [none]
} else if(accessor.getType().isArray()) {
accessor.componentType = Optional.of(accessor.getType().getComponentType());
// depends on control dependency: [if], data = [none]
} else if(Map.class.isAssignableFrom(accessor.getType())) {
ParameterizedType type = (ParameterizedType) method.getGenericParameterTypes()[0];
accessor.componentType = Optional.of((Class<?>) type.getActualTypeArguments()[1]);
// depends on control dependency: [if], data = [none]
}
} else {
throw new IllegalArgumentException(MessageBuilder.create("method.noAccessor")
.varWithClass("className", method.getDeclaringClass())
.var("methodName", methodName)
.format());
}
// 位置・ラベル情報のアクセッサの設定
if(accessor.hasAnnotation(XlsMapColumns.class)) {
accessor.mapPositionSetter = mapPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
accessor.mapLabelSetter = mapLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
} else if(accessor.hasAnnotation(XlsArrayColumns.class)
|| accessor.hasAnnotation(XlsArrayCells.class)
|| accessor.hasAnnotation(XlsLabelledArrayCells.class)
|| accessor.hasAnnotation(XlsIterateTables.class)){
// リストや配列形式の場合
accessor.arrayPositionSetter = arrayPositionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
accessor.arrayLabelSetter = arrayLabelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
if(accessor.hasAnnotation(XlsArrayColumns.class)
|| accessor.hasAnnotation(XlsLabelledArrayCells.class)) {
// インデックスが付いていないラベルの設定
accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
}
} else {
// XlsMapColumnsを持たない通常のプロパティの場合
accessor.positionSetter = positionSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
accessor.positionGetter = positionGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
accessor.labelSetter = labelSetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
accessor.labelGetter = labelGetterFactory.create(accessor.getDeclaringClass(), accessor.getName());
// depends on control dependency: [if], data = [none]
}
return accessor;
} } |
public class class_name {
public void printOb(int row, int col) {
int stnIndex = (getFileSubType().equals(CLIMATE))
? row
: col;
List<GempakStation> stations = getStations();
if (stations.isEmpty() || stnIndex > stations.size()) {
System.out.println("\nNo data available");
return;
}
GempakStation station = getStations().get(stnIndex - 1);
StringBuilder builder = new StringBuilder();
builder.append("\nStation:\n");
builder.append(station.toString());
builder.append("\nObs\n\t");
List<GempakParameter> params = getParameters(SFDT);
for (GempakParameter parm : params) {
builder.append(StringUtil2.padLeft(parm.getName(), 7));
builder.append("\t");
}
builder.append("\n");
RData rd;
try {
rd = DM_RDTR(row, col, SFDT);
} catch (IOException ioe) {
ioe.printStackTrace();
rd = null;
}
if (rd == null) {
builder.append("No Data Available");
} else {
builder.append("\t");
float[] data = rd.data;
for (int i = 0; i < data.length; i++) {
builder.append( StringUtil2.padLeft( Format.formatDouble(data[i], 7, 1), 7));
builder.append("\t");
}
int[] header = rd.header;
if (header.length > 0) {
builder.append("\nOb Time = ");
builder.append(header[0]);
}
}
System.out.println(builder.toString());
} } | public class class_name {
public void printOb(int row, int col) {
int stnIndex = (getFileSubType().equals(CLIMATE))
? row
: col;
List<GempakStation> stations = getStations();
if (stations.isEmpty() || stnIndex > stations.size()) {
System.out.println("\nNo data available");
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
GempakStation station = getStations().get(stnIndex - 1);
StringBuilder builder = new StringBuilder();
builder.append("\nStation:\n");
builder.append(station.toString());
builder.append("\nObs\n\t");
List<GempakParameter> params = getParameters(SFDT);
for (GempakParameter parm : params) {
builder.append(StringUtil2.padLeft(parm.getName(), 7));
// depends on control dependency: [for], data = [parm]
builder.append("\t");
// depends on control dependency: [for], data = [none]
}
builder.append("\n");
RData rd;
try {
rd = DM_RDTR(row, col, SFDT);
// depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
ioe.printStackTrace();
rd = null;
}
// depends on control dependency: [catch], data = [none]
if (rd == null) {
builder.append("No Data Available");
// depends on control dependency: [if], data = [none]
} else {
builder.append("\t");
// depends on control dependency: [if], data = [none]
float[] data = rd.data;
for (int i = 0; i < data.length; i++) {
builder.append( StringUtil2.padLeft( Format.formatDouble(data[i], 7, 1), 7));
// depends on control dependency: [for], data = [i]
builder.append("\t");
// depends on control dependency: [for], data = [none]
}
int[] header = rd.header;
if (header.length > 0) {
builder.append("\nOb Time = ");
// depends on control dependency: [if], data = [none]
builder.append(header[0]);
// depends on control dependency: [if], data = [none]
}
}
System.out.println(builder.toString());
} } |
public class class_name {
@SuppressWarnings("unchecked")
static <T> TypeInfoImpl<T> typeInfoFor(Class<T> sourceType, InheritingConfiguration configuration) {
TypeInfoKey pair = new TypeInfoKey(sourceType, configuration);
TypeInfoImpl<T> typeInfo = (TypeInfoImpl<T>) cache.get(pair);
if (typeInfo == null) {
synchronized (cache) {
typeInfo = (TypeInfoImpl<T>) cache.get(pair);
if (typeInfo == null) {
typeInfo = new TypeInfoImpl<T>(null, sourceType, configuration);
cache.put(pair, typeInfo);
}
}
}
return typeInfo;
} } | public class class_name {
@SuppressWarnings("unchecked")
static <T> TypeInfoImpl<T> typeInfoFor(Class<T> sourceType, InheritingConfiguration configuration) {
TypeInfoKey pair = new TypeInfoKey(sourceType, configuration);
TypeInfoImpl<T> typeInfo = (TypeInfoImpl<T>) cache.get(pair);
if (typeInfo == null) {
synchronized (cache) {
// depends on control dependency: [if], data = [none]
typeInfo = (TypeInfoImpl<T>) cache.get(pair);
if (typeInfo == null) {
typeInfo = new TypeInfoImpl<T>(null, sourceType, configuration);
// depends on control dependency: [if], data = [none]
cache.put(pair, typeInfo);
// depends on control dependency: [if], data = [none]
}
}
}
return typeInfo;
} } |
public class class_name {
public static byte[] readRAM(final File f) throws IOException {
final int total = (int) f.length();
final byte[] ret = new byte[total];
final InputStream in = new FileInputStream(f);
try {
int offset = 0;
int read = 0;
do {
read = in.read(ret, offset, total - read);
if (read > 0) {
offset += read;
}
} while ((read != -1) && (offset != total));
return ret;
} finally {
in.close();
}
} } | public class class_name {
public static byte[] readRAM(final File f) throws IOException {
final int total = (int) f.length();
final byte[] ret = new byte[total];
final InputStream in = new FileInputStream(f);
try {
int offset = 0;
int read = 0;
do {
read = in.read(ret, offset, total - read);
if (read > 0) {
offset += read; // depends on control dependency: [if], data = [none]
}
} while ((read != -1) && (offset != total));
return ret;
} finally {
in.close();
}
} } |
public class class_name {
public Snapshot withRestorableNodeTypes(String... restorableNodeTypes) {
if (this.restorableNodeTypes == null) {
setRestorableNodeTypes(new com.amazonaws.internal.SdkInternalList<String>(restorableNodeTypes.length));
}
for (String ele : restorableNodeTypes) {
this.restorableNodeTypes.add(ele);
}
return this;
} } | public class class_name {
public Snapshot withRestorableNodeTypes(String... restorableNodeTypes) {
if (this.restorableNodeTypes == null) {
setRestorableNodeTypes(new com.amazonaws.internal.SdkInternalList<String>(restorableNodeTypes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : restorableNodeTypes) {
this.restorableNodeTypes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) {
CmsResource res = null;
try {
res = cms.readResource(
CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()),
filter);
} catch (CmsException ex) {
return null;
}
if (checkTypeId(res.getTypeId())) {
return res;
}
return null;
} } | public class class_name {
private CmsResource getResource(CmsObject cms, String resourcename, CmsResourceFilter filter) {
CmsResource res = null;
try {
res = cms.readResource(
CmsResourceWrapperUtils.removeFileExtension(cms, resourcename, getExtension()),
filter); // depends on control dependency: [try], data = [none]
} catch (CmsException ex) {
return null;
} // depends on control dependency: [catch], data = [none]
if (checkTypeId(res.getTypeId())) {
return res; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public Result<Integer> updateSlicedFindPath(int maxIter) {
if (!m_query.status.isInProgress()) {
return Result.of(m_query.status, 0);
}
// Make sure the request is still valid.
if (!m_nav.isValidPolyRef(m_query.startRef) || !m_nav.isValidPolyRef(m_query.endRef)) {
m_query.status = Status.FAILURE;
return Result.of(m_query.status, 0);
}
int iter = 0;
while (iter < maxIter && !m_openList.isEmpty()) {
iter++;
// Remove node from open list and put it in closed list.
Node bestNode = m_openList.pop();
bestNode.flags &= ~Node.DT_NODE_OPEN;
bestNode.flags |= Node.DT_NODE_CLOSED;
// Reached the goal, stop searching.
if (bestNode.id == m_query.endRef) {
m_query.lastBestNode = bestNode;
m_query.status = Status.SUCCSESS;
return Result.of(m_query.status, iter);
}
// Get current poly and tile.
// The API input has been cheked already, skip checking internal
// data.
long bestRef = bestNode.id;
Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(bestRef);
if (tileAndPoly.failed()) {
m_query.status = Status.FAILURE;
// The polygon has disappeared during the sliced query, fail.
return Result.of(m_query.status, iter);
}
MeshTile bestTile = tileAndPoly.result.first;
Poly bestPoly = tileAndPoly.result.second;
// Get parent and grand parent poly and tile.
long parentRef = 0, grandpaRef = 0;
MeshTile parentTile = null;
Poly parentPoly = null;
Node parentNode = null;
if (bestNode.pidx != 0) {
parentNode = m_nodePool.getNodeAtIdx(bestNode.pidx);
parentRef = parentNode.id;
if (parentNode.pidx != 0) {
grandpaRef = m_nodePool.getNodeAtIdx(parentNode.pidx).id;
}
}
if (parentRef != 0) {
boolean invalidParent = false;
tileAndPoly = m_nav.getTileAndPolyByRef(parentRef);
invalidParent = tileAndPoly.failed();
if (invalidParent || (grandpaRef != 0 && !m_nav.isValidPolyRef(grandpaRef))) {
// The polygon has disappeared during the sliced query,
// fail.
m_query.status = Status.FAILURE;
return Result.of(m_query.status, iter);
}
parentTile = tileAndPoly.result.first;
parentPoly = tileAndPoly.result.second;
}
// decide whether to test raycast to previous nodes
boolean tryLOS = false;
if ((m_query.options & DT_FINDPATH_ANY_ANGLE) != 0) {
if ((parentRef != 0) && (vDistSqr(parentNode.pos, bestNode.pos) < m_query.raycastLimitSqr)) {
tryLOS = true;
}
}
for (int i = bestPoly.firstLink; i != NavMesh.DT_NULL_LINK; i = bestTile.links.get(i).next) {
long neighbourRef = bestTile.links.get(i).ref;
// Skip invalid ids and do not expand back to where we came
// from.
if (neighbourRef == 0 || neighbourRef == parentRef) {
continue;
}
// Get neighbour poly and tile.
// The API input has been cheked already, skip checking internal
// data.
Tupple2<MeshTile, Poly> tileAndPolyUns = m_nav.getTileAndPolyByRefUnsafe(neighbourRef);
MeshTile neighbourTile = tileAndPolyUns.first;
Poly neighbourPoly = tileAndPolyUns.second;
if (!m_query.filter.passFilter(neighbourRef, neighbourTile, neighbourPoly)) {
continue;
}
// get the neighbor node
Node neighbourNode = m_nodePool.getNode(neighbourRef, 0);
// do not expand to nodes that were already visited from the
// same parent
if (neighbourNode.pidx != 0 && neighbourNode.pidx == bestNode.pidx) {
continue;
}
// If the node is visited the first time, calculate node
// position.
if (neighbourNode.flags == 0) {
Result<float[]> midpod = getEdgeMidPoint(bestRef, bestPoly, bestTile, neighbourRef, neighbourPoly,
neighbourTile);
if (!midpod.failed()) {
neighbourNode.pos = midpod.result;
}
}
// Calculate cost and heuristic.
float cost = 0;
float heuristic = 0;
// raycast parent
boolean foundShortCut = false;
if (tryLOS) {
Result<RaycastHit> rayHit = raycast(parentRef, parentNode.pos, neighbourNode.pos, m_query.filter,
DT_RAYCAST_USE_COSTS, grandpaRef);
if (rayHit.succeeded()) {
foundShortCut = rayHit.result.t >= 1.0f;
if (foundShortCut) {
// shortcut found using raycast. Using shorter cost
// instead
cost = parentNode.cost + rayHit.result.pathCost;
}
}
}
// update move cost
if (!foundShortCut) {
// No shortcut found.
float curCost = m_query.filter.getCost(bestNode.pos, neighbourNode.pos, parentRef, parentTile,
parentPoly, bestRef, bestTile, bestPoly, neighbourRef, neighbourTile, neighbourPoly);
cost = bestNode.cost + curCost;
}
// Special case for last node.
if (neighbourRef == m_query.endRef) {
float endCost = m_query.filter.getCost(neighbourNode.pos, m_query.endPos, bestRef, bestTile,
bestPoly, neighbourRef, neighbourTile, neighbourPoly, 0, null, null);
cost = cost + endCost;
heuristic = 0;
} else {
heuristic = vDist(neighbourNode.pos, m_query.endPos) * H_SCALE;
}
float total = cost + heuristic;
// The node is already in open list and the new result is worse,
// skip.
if ((neighbourNode.flags & Node.DT_NODE_OPEN) != 0 && total >= neighbourNode.total) {
continue;
}
// The node is already visited and process, and the new result
// is worse, skip.
if ((neighbourNode.flags & Node.DT_NODE_CLOSED) != 0 && total >= neighbourNode.total) {
continue;
}
// Add or update the node.
neighbourNode.pidx = foundShortCut ? bestNode.pidx : m_nodePool.getNodeIdx(bestNode);
neighbourNode.id = neighbourRef;
neighbourNode.flags = (neighbourNode.flags & ~(Node.DT_NODE_CLOSED | Node.DT_NODE_PARENT_DETACHED));
neighbourNode.cost = cost;
neighbourNode.total = total;
if (foundShortCut) {
neighbourNode.flags = (neighbourNode.flags | Node.DT_NODE_PARENT_DETACHED);
}
if ((neighbourNode.flags & Node.DT_NODE_OPEN) != 0) {
// Already in open, update node location.
m_openList.modify(neighbourNode);
} else {
// Put the node in open list.
neighbourNode.flags |= Node.DT_NODE_OPEN;
m_openList.push(neighbourNode);
}
// Update nearest node to target so far.
if (heuristic < m_query.lastBestNodeCost) {
m_query.lastBestNodeCost = heuristic;
m_query.lastBestNode = neighbourNode;
}
}
}
// Exhausted all nodes, but could not find path.
if (m_openList.isEmpty()) {
m_query.status = Status.PARTIAL_RESULT;
}
return Result.of(m_query.status, iter);
} } | public class class_name {
public Result<Integer> updateSlicedFindPath(int maxIter) {
if (!m_query.status.isInProgress()) {
return Result.of(m_query.status, 0); // depends on control dependency: [if], data = [none]
}
// Make sure the request is still valid.
if (!m_nav.isValidPolyRef(m_query.startRef) || !m_nav.isValidPolyRef(m_query.endRef)) {
m_query.status = Status.FAILURE; // depends on control dependency: [if], data = [none]
return Result.of(m_query.status, 0); // depends on control dependency: [if], data = [none]
}
int iter = 0;
while (iter < maxIter && !m_openList.isEmpty()) {
iter++; // depends on control dependency: [while], data = [none]
// Remove node from open list and put it in closed list.
Node bestNode = m_openList.pop();
bestNode.flags &= ~Node.DT_NODE_OPEN; // depends on control dependency: [while], data = [none]
bestNode.flags |= Node.DT_NODE_CLOSED; // depends on control dependency: [while], data = [none]
// Reached the goal, stop searching.
if (bestNode.id == m_query.endRef) {
m_query.lastBestNode = bestNode; // depends on control dependency: [if], data = [none]
m_query.status = Status.SUCCSESS; // depends on control dependency: [if], data = [none]
return Result.of(m_query.status, iter); // depends on control dependency: [if], data = [none]
}
// Get current poly and tile.
// The API input has been cheked already, skip checking internal
// data.
long bestRef = bestNode.id;
Result<Tupple2<MeshTile, Poly>> tileAndPoly = m_nav.getTileAndPolyByRef(bestRef);
if (tileAndPoly.failed()) {
m_query.status = Status.FAILURE; // depends on control dependency: [if], data = [none]
// The polygon has disappeared during the sliced query, fail.
return Result.of(m_query.status, iter); // depends on control dependency: [if], data = [none]
}
MeshTile bestTile = tileAndPoly.result.first;
Poly bestPoly = tileAndPoly.result.second;
// Get parent and grand parent poly and tile.
long parentRef = 0, grandpaRef = 0;
MeshTile parentTile = null;
Poly parentPoly = null;
Node parentNode = null;
if (bestNode.pidx != 0) {
parentNode = m_nodePool.getNodeAtIdx(bestNode.pidx); // depends on control dependency: [if], data = [(bestNode.pidx]
parentRef = parentNode.id; // depends on control dependency: [if], data = [none]
if (parentNode.pidx != 0) {
grandpaRef = m_nodePool.getNodeAtIdx(parentNode.pidx).id; // depends on control dependency: [if], data = [(parentNode.pidx]
}
}
if (parentRef != 0) {
boolean invalidParent = false;
tileAndPoly = m_nav.getTileAndPolyByRef(parentRef); // depends on control dependency: [if], data = [(parentRef]
invalidParent = tileAndPoly.failed(); // depends on control dependency: [if], data = [none]
if (invalidParent || (grandpaRef != 0 && !m_nav.isValidPolyRef(grandpaRef))) {
// The polygon has disappeared during the sliced query,
// fail.
m_query.status = Status.FAILURE; // depends on control dependency: [if], data = [none]
return Result.of(m_query.status, iter); // depends on control dependency: [if], data = [none]
}
parentTile = tileAndPoly.result.first; // depends on control dependency: [if], data = [none]
parentPoly = tileAndPoly.result.second; // depends on control dependency: [if], data = [none]
}
// decide whether to test raycast to previous nodes
boolean tryLOS = false;
if ((m_query.options & DT_FINDPATH_ANY_ANGLE) != 0) {
if ((parentRef != 0) && (vDistSqr(parentNode.pos, bestNode.pos) < m_query.raycastLimitSqr)) {
tryLOS = true; // depends on control dependency: [if], data = [none]
}
}
for (int i = bestPoly.firstLink; i != NavMesh.DT_NULL_LINK; i = bestTile.links.get(i).next) {
long neighbourRef = bestTile.links.get(i).ref;
// Skip invalid ids and do not expand back to where we came
// from.
if (neighbourRef == 0 || neighbourRef == parentRef) {
continue;
}
// Get neighbour poly and tile.
// The API input has been cheked already, skip checking internal
// data.
Tupple2<MeshTile, Poly> tileAndPolyUns = m_nav.getTileAndPolyByRefUnsafe(neighbourRef);
MeshTile neighbourTile = tileAndPolyUns.first;
Poly neighbourPoly = tileAndPolyUns.second;
if (!m_query.filter.passFilter(neighbourRef, neighbourTile, neighbourPoly)) {
continue;
}
// get the neighbor node
Node neighbourNode = m_nodePool.getNode(neighbourRef, 0);
// do not expand to nodes that were already visited from the
// same parent
if (neighbourNode.pidx != 0 && neighbourNode.pidx == bestNode.pidx) {
continue;
}
// If the node is visited the first time, calculate node
// position.
if (neighbourNode.flags == 0) {
Result<float[]> midpod = getEdgeMidPoint(bestRef, bestPoly, bestTile, neighbourRef, neighbourPoly,
neighbourTile);
if (!midpod.failed()) {
neighbourNode.pos = midpod.result; // depends on control dependency: [if], data = [none]
}
}
// Calculate cost and heuristic.
float cost = 0;
float heuristic = 0;
// raycast parent
boolean foundShortCut = false;
if (tryLOS) {
Result<RaycastHit> rayHit = raycast(parentRef, parentNode.pos, neighbourNode.pos, m_query.filter,
DT_RAYCAST_USE_COSTS, grandpaRef);
if (rayHit.succeeded()) {
foundShortCut = rayHit.result.t >= 1.0f; // depends on control dependency: [if], data = [none]
if (foundShortCut) {
// shortcut found using raycast. Using shorter cost
// instead
cost = parentNode.cost + rayHit.result.pathCost; // depends on control dependency: [if], data = [none]
}
}
}
// update move cost
if (!foundShortCut) {
// No shortcut found.
float curCost = m_query.filter.getCost(bestNode.pos, neighbourNode.pos, parentRef, parentTile,
parentPoly, bestRef, bestTile, bestPoly, neighbourRef, neighbourTile, neighbourPoly);
cost = bestNode.cost + curCost; // depends on control dependency: [if], data = [none]
}
// Special case for last node.
if (neighbourRef == m_query.endRef) {
float endCost = m_query.filter.getCost(neighbourNode.pos, m_query.endPos, bestRef, bestTile,
bestPoly, neighbourRef, neighbourTile, neighbourPoly, 0, null, null);
cost = cost + endCost; // depends on control dependency: [if], data = [none]
heuristic = 0; // depends on control dependency: [if], data = [none]
} else {
heuristic = vDist(neighbourNode.pos, m_query.endPos) * H_SCALE; // depends on control dependency: [if], data = [none]
}
float total = cost + heuristic;
// The node is already in open list and the new result is worse,
// skip.
if ((neighbourNode.flags & Node.DT_NODE_OPEN) != 0 && total >= neighbourNode.total) {
continue;
}
// The node is already visited and process, and the new result
// is worse, skip.
if ((neighbourNode.flags & Node.DT_NODE_CLOSED) != 0 && total >= neighbourNode.total) {
continue;
}
// Add or update the node.
neighbourNode.pidx = foundShortCut ? bestNode.pidx : m_nodePool.getNodeIdx(bestNode); // depends on control dependency: [for], data = [none]
neighbourNode.id = neighbourRef; // depends on control dependency: [for], data = [none]
neighbourNode.flags = (neighbourNode.flags & ~(Node.DT_NODE_CLOSED | Node.DT_NODE_PARENT_DETACHED)); // depends on control dependency: [for], data = [none]
neighbourNode.cost = cost; // depends on control dependency: [for], data = [none]
neighbourNode.total = total; // depends on control dependency: [for], data = [none]
if (foundShortCut) {
neighbourNode.flags = (neighbourNode.flags | Node.DT_NODE_PARENT_DETACHED); // depends on control dependency: [if], data = [none]
}
if ((neighbourNode.flags & Node.DT_NODE_OPEN) != 0) {
// Already in open, update node location.
m_openList.modify(neighbourNode); // depends on control dependency: [if], data = [none]
} else {
// Put the node in open list.
neighbourNode.flags |= Node.DT_NODE_OPEN; // depends on control dependency: [if], data = [none]
m_openList.push(neighbourNode); // depends on control dependency: [if], data = [none]
}
// Update nearest node to target so far.
if (heuristic < m_query.lastBestNodeCost) {
m_query.lastBestNodeCost = heuristic; // depends on control dependency: [if], data = [none]
m_query.lastBestNode = neighbourNode; // depends on control dependency: [if], data = [none]
}
}
}
// Exhausted all nodes, but could not find path.
if (m_openList.isEmpty()) {
m_query.status = Status.PARTIAL_RESULT; // depends on control dependency: [if], data = [none]
}
return Result.of(m_query.status, iter);
} } |
public class class_name {
private static byte[] extract(byte[] result, int length) {
if (length == result.length) {
return result;
} else {
byte[] trunc = new byte[length];
System.arraycopy(result, 0, trunc, 0, length);
return trunc;
}
} } | public class class_name {
private static byte[] extract(byte[] result, int length) {
if (length == result.length) {
return result; // depends on control dependency: [if], data = [none]
} else {
byte[] trunc = new byte[length];
System.arraycopy(result, 0, trunc, 0, length); // depends on control dependency: [if], data = [none]
return trunc; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isPermanent(ResourceModel resourceModel) {
Object resource = resourceModel.getResource();
try {
return (Boolean) resource;
} catch (ClassCastException e) {
return false;
}
} } | public class class_name {
public static boolean isPermanent(ResourceModel resourceModel) {
Object resource = resourceModel.getResource();
try {
return (Boolean) resource; // depends on control dependency: [try], data = [none]
} catch (ClassCastException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void processSecurityIdentity(BeanMetaData bmd) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processSecurityIdentity");
}
EnterpriseBean ejbBean = bmd.wccm.enterpriseBean;
boolean runAsSet = false;
if (ejbBean != null) {
// get runAs identity
SecurityIdentity secIdentity = ejbBean.getSecurityIdentity();
if (secIdentity != null) {
runAsSet = true;
if (secIdentity.isUseCallerIdentity()) {
bmd.ivUseCallerIdentity = true;
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "RunAs set to Caller Identity ");
} else {
bmd.ivRunAs = secIdentity.getRunAs().getRoleName();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "RunAs set to " + bmd.ivRunAs);
}
} // if (secIdentity != null)
} // if (ejbBean != null)
//Only check for @runAs annotation if it is not set by XML. //446358
if (!runAsSet) {
//check for @RunAs annotation
RunAs runAs = bmd.enterpriseBeanClass.getAnnotation(javax.annotation.security.RunAs.class);
if (runAs != null) {
bmd.ivRunAs = runAs.value();
}
} // if (!runAsSet)
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processSecurityIdentity: useCallerIdentity = " +
bmd.ivUseCallerIdentity + ": Use Role = " +
bmd.ivRunAs);
}
} } | public class class_name {
private void processSecurityIdentity(BeanMetaData bmd) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled()) {
Tr.entry(tc, "processSecurityIdentity"); // depends on control dependency: [if], data = [none]
}
EnterpriseBean ejbBean = bmd.wccm.enterpriseBean;
boolean runAsSet = false;
if (ejbBean != null) {
// get runAs identity
SecurityIdentity secIdentity = ejbBean.getSecurityIdentity();
if (secIdentity != null) {
runAsSet = true; // depends on control dependency: [if], data = [none]
if (secIdentity.isUseCallerIdentity()) {
bmd.ivUseCallerIdentity = true; // depends on control dependency: [if], data = [none]
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "RunAs set to Caller Identity ");
} else {
bmd.ivRunAs = secIdentity.getRunAs().getRoleName(); // depends on control dependency: [if], data = [none]
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "RunAs set to " + bmd.ivRunAs);
}
} // if (secIdentity != null)
} // if (ejbBean != null)
//Only check for @runAs annotation if it is not set by XML. //446358
if (!runAsSet) {
//check for @RunAs annotation
RunAs runAs = bmd.enterpriseBeanClass.getAnnotation(javax.annotation.security.RunAs.class);
if (runAs != null) {
bmd.ivRunAs = runAs.value(); // depends on control dependency: [if], data = [none]
}
} // if (!runAsSet)
if (isTraceOn && tc.isEntryEnabled()) {
Tr.exit(tc, "processSecurityIdentity: useCallerIdentity = " +
bmd.ivUseCallerIdentity + ": Use Role = " +
bmd.ivRunAs); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void updateProgressRate(long currentTime) {
double bestProgressRate = 0;
for (TaskStatus ts : taskStatuses.values()){
if (ts.getRunState() == TaskStatus.State.RUNNING ||
ts.getRunState() == TaskStatus.State.SUCCEEDED ||
ts.getRunState() == TaskStatus.State.COMMIT_PENDING) {
double tsProgressRate = ts.getProgress()/Math.max(1,
currentTime - getDispatchTime(ts.getTaskID()));
if (tsProgressRate > bestProgressRate){
bestProgressRate = tsProgressRate;
}
}
}
DataStatistics taskStats = job.getRunningTaskStatistics(isMapTask());
taskStats.updateStatistics(progressRate, bestProgressRate);
progressRate = bestProgressRate;
} } | public class class_name {
public void updateProgressRate(long currentTime) {
double bestProgressRate = 0;
for (TaskStatus ts : taskStatuses.values()){
if (ts.getRunState() == TaskStatus.State.RUNNING ||
ts.getRunState() == TaskStatus.State.SUCCEEDED ||
ts.getRunState() == TaskStatus.State.COMMIT_PENDING) {
double tsProgressRate = ts.getProgress()/Math.max(1,
currentTime - getDispatchTime(ts.getTaskID()));
if (tsProgressRate > bestProgressRate){
bestProgressRate = tsProgressRate; // depends on control dependency: [if], data = [none]
}
}
}
DataStatistics taskStats = job.getRunningTaskStatistics(isMapTask());
taskStats.updateStatistics(progressRate, bestProgressRate);
progressRate = bestProgressRate;
} } |
public class class_name {
public static String getPackageCanonicalName(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY;
}
return getPackageCanonicalName(cls.getName());
} } | public class class_name {
public static String getPackageCanonicalName(final Class<?> cls) {
if (cls == null) {
return StringUtils.EMPTY; // depends on control dependency: [if], data = [none]
}
return getPackageCanonicalName(cls.getName());
} } |
public class class_name {
public OMVRBTreeEntry<K, V> getPreviousInMemory() {
OMVRBTreeEntry<K, V> t = this;
OMVRBTreeEntry<K, V> p = null;
if (t.getLeftInMemory() != null) {
p = t.getLeftInMemory();
while (p.getRightInMemory() != null)
p = p.getRightInMemory();
} else {
p = t.getParentInMemory();
while (p != null && t == p.getLeftInMemory()) {
t = p;
p = p.getParentInMemory();
}
}
return p;
} } | public class class_name {
public OMVRBTreeEntry<K, V> getPreviousInMemory() {
OMVRBTreeEntry<K, V> t = this;
OMVRBTreeEntry<K, V> p = null;
if (t.getLeftInMemory() != null) {
p = t.getLeftInMemory();
// depends on control dependency: [if], data = [none]
while (p.getRightInMemory() != null)
p = p.getRightInMemory();
} else {
p = t.getParentInMemory();
// depends on control dependency: [if], data = [none]
while (p != null && t == p.getLeftInMemory()) {
t = p;
// depends on control dependency: [while], data = [none]
p = p.getParentInMemory();
// depends on control dependency: [while], data = [none]
}
}
return p;
} } |
public class class_name {
@NullSafe
public static int sum(final int... numbers) {
int sum = 0;
if (numbers != null) {
for (int number : numbers) {
sum += number;
}
}
return sum;
} } | public class class_name {
@NullSafe
public static int sum(final int... numbers) {
int sum = 0;
if (numbers != null) {
for (int number : numbers) {
sum += number; // depends on control dependency: [for], data = [number]
}
}
return sum;
} } |
public class class_name {
@Override
public Object remove(String name) {
final HttpSession session = this.getPortalSesion(false);
if (session == null) {
return null;
}
final Object sessionMutex = WebUtils.getSessionMutex(session);
synchronized (sessionMutex) {
final Object attribute = session.getAttribute(name);
if (attribute != null) {
session.removeAttribute(name);
}
return attribute;
}
} } | public class class_name {
@Override
public Object remove(String name) {
final HttpSession session = this.getPortalSesion(false);
if (session == null) {
return null; // depends on control dependency: [if], data = [none]
}
final Object sessionMutex = WebUtils.getSessionMutex(session);
synchronized (sessionMutex) {
final Object attribute = session.getAttribute(name);
if (attribute != null) {
session.removeAttribute(name); // depends on control dependency: [if], data = [none]
}
return attribute;
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void setDefaults(Class<T> realClass) {
this.realClass = realClass;
this.keyDef = new KeyDefinition();
// find the "effective" class - skipping up the hierarchy over inner classes
effectiveClass = realClass;
boolean entityFound;
while (!(entityFound = (null != effectiveClass.getAnnotation(Entity.class)))) {
// TODO:BTB this might should be isSynthetic
if (!effectiveClass.isAnonymousClass()) {
break;
} else {
effectiveClass = (Class<T>) effectiveClass.getSuperclass();
}
}
// if class is missing @Entity, then proceed no further
if (!entityFound) {
throw new HomMissingEntityAnnotationException("class, " + realClass.getName()
+ ", not annotated with @" + Entity.class.getSimpleName());
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void setDefaults(Class<T> realClass) {
this.realClass = realClass;
this.keyDef = new KeyDefinition();
// find the "effective" class - skipping up the hierarchy over inner classes
effectiveClass = realClass;
boolean entityFound;
while (!(entityFound = (null != effectiveClass.getAnnotation(Entity.class)))) {
// TODO:BTB this might should be isSynthetic
if (!effectiveClass.isAnonymousClass()) {
break;
} else {
effectiveClass = (Class<T>) effectiveClass.getSuperclass(); // depends on control dependency: [if], data = [none]
}
}
// if class is missing @Entity, then proceed no further
if (!entityFound) {
throw new HomMissingEntityAnnotationException("class, " + realClass.getName()
+ ", not annotated with @" + Entity.class.getSimpleName());
}
} } |
public class class_name {
@Override
public boolean hasNext() {
if (next == null) {
try {
next = readNextFromStream();
} catch (Exception e) {
throw new RuntimeException("Failed to receive next element: " + e.getMessage(), e);
}
}
return next != null;
} } | public class class_name {
@Override
public boolean hasNext() {
if (next == null) {
try {
next = readNextFromStream(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("Failed to receive next element: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
return next != null;
} } |
public class class_name {
public static ServerAddress fromString(String string) {
String tokens[] = string.split(":");
if (tokens.length == 1) {
return new ServerAddress(tokens[0], null);
}
return new ServerAddress(tokens[0], Integer.valueOf(tokens[1]));
} } | public class class_name {
public static ServerAddress fromString(String string) {
String tokens[] = string.split(":");
if (tokens.length == 1) {
return new ServerAddress(tokens[0], null); // depends on control dependency: [if], data = [none]
}
return new ServerAddress(tokens[0], Integer.valueOf(tokens[1]));
} } |
public class class_name {
public void stop() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "CommsInboundChain Stop");
//stopchain() first quiesce's(invokes chainQuiesced) depending on the chainQuiesceTimeOut
//Once the chain is quiesced StopChainTask is initiated.Hence we block until the actual stopChain is invoked
try {
ChainData cd = _cfw.getChain(_chainName);
if (cd != null) {
_cfw.stopChain(cd, _cfw.getDefaultChainQuiesceTimeout());
stopWait.waitForStop(_cfw.getDefaultChainQuiesceTimeout()); //BLOCK till stopChain actually completes from StopChainTask
_cfw.destroyChain(cd);
_cfw.removeChain(cd);
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Failed in successfully cleaning(i.e stopping/destorying/removing) chain: ", e);
} finally {
_isChainStarted = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "CommsServerServiceFacade JfapChainStop");
} } | public class class_name {
public void stop() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "CommsInboundChain Stop");
//stopchain() first quiesce's(invokes chainQuiesced) depending on the chainQuiesceTimeOut
//Once the chain is quiesced StopChainTask is initiated.Hence we block until the actual stopChain is invoked
try {
ChainData cd = _cfw.getChain(_chainName);
if (cd != null) {
_cfw.stopChain(cd, _cfw.getDefaultChainQuiesceTimeout()); // depends on control dependency: [if], data = [(cd]
stopWait.waitForStop(_cfw.getDefaultChainQuiesceTimeout()); //BLOCK till stopChain actually completes from StopChainTask // depends on control dependency: [if], data = [none]
_cfw.destroyChain(cd); // depends on control dependency: [if], data = [(cd]
_cfw.removeChain(cd); // depends on control dependency: [if], data = [(cd]
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Failed in successfully cleaning(i.e stopping/destorying/removing) chain: ", e);
} finally { // depends on control dependency: [catch], data = [none]
_isChainStarted = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "CommsServerServiceFacade JfapChainStop");
} } |
public class class_name {
@SuppressWarnings("rawtypes")
@Override
public storm.trident.spout.ITridentSpout.Emitter<Object> getEmitter(String txStateId, Map conf,
TopologyContext context)
{
DrpcTridentEmitter emitter = null;
try
{
emitter = this.emitterClassType.newInstance();
emitter.initialize(conf, context, this.function);
}
catch (Exception ex)
{
logger.error("Emitter create failed.", ex);
}
return emitter;
} } | public class class_name {
@SuppressWarnings("rawtypes")
@Override
public storm.trident.spout.ITridentSpout.Emitter<Object> getEmitter(String txStateId, Map conf,
TopologyContext context)
{
DrpcTridentEmitter emitter = null;
try
{
emitter = this.emitterClassType.newInstance(); // depends on control dependency: [try], data = [none]
emitter.initialize(conf, context, this.function); // depends on control dependency: [try], data = [none]
}
catch (Exception ex)
{
logger.error("Emitter create failed.", ex);
} // depends on control dependency: [catch], data = [none]
return emitter;
} } |
public class class_name {
private void doGCMRefresh() {
final DeviceInfo _deviceInfo = this.deviceInfo;
postAsyncSafely("GcmManager#doGCMRefresh", new Runnable() {
@Override
public void run() {
try {
if(getConfig().isAnalyticsOnly()){
getConfigLogger().debug(getAccountId(),"Instance is set for Analytics only, will not request push token");
return;
}
String freshToken = GCMGetFreshToken(_deviceInfo.getGCMSenderID());
if (freshToken == null) return;
cacheGCMToken(freshToken);
// better safe to always force a push from here
pushGCMDeviceToken(freshToken, true, true);
try {
deviceTokenDidRefresh(freshToken, PushType.GCM);
} catch (Throwable t) {
//no-op
}
} catch (Throwable t) {
getConfigLogger().verbose(getAccountId(),"GcmManager: GCM Token error", t);
}
}
});
} } | public class class_name {
private void doGCMRefresh() {
final DeviceInfo _deviceInfo = this.deviceInfo;
postAsyncSafely("GcmManager#doGCMRefresh", new Runnable() {
@Override
public void run() {
try {
if(getConfig().isAnalyticsOnly()){
getConfigLogger().debug(getAccountId(),"Instance is set for Analytics only, will not request push token"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
String freshToken = GCMGetFreshToken(_deviceInfo.getGCMSenderID());
if (freshToken == null) return;
cacheGCMToken(freshToken); // depends on control dependency: [try], data = [none]
// better safe to always force a push from here
pushGCMDeviceToken(freshToken, true, true); // depends on control dependency: [try], data = [none]
try {
deviceTokenDidRefresh(freshToken, PushType.GCM); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
//no-op
} // depends on control dependency: [catch], data = [none]
} catch (Throwable t) {
getConfigLogger().verbose(getAccountId(),"GcmManager: GCM Token error", t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public static void mult(ZMatrixRMaj a, ZMatrixRMaj b, ZMatrixRMaj c)
{
if( b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH) {
MatrixMatrixMult_ZDRM.mult_reorder(a, b, c);
} else {
MatrixMatrixMult_ZDRM.mult_small(a, b, c);
}
} } | public class class_name {
public static void mult(ZMatrixRMaj a, ZMatrixRMaj b, ZMatrixRMaj c)
{
if( b.numCols >= EjmlParameters.CMULT_COLUMN_SWITCH) {
MatrixMatrixMult_ZDRM.mult_reorder(a, b, c); // depends on control dependency: [if], data = [none]
} else {
MatrixMatrixMult_ZDRM.mult_small(a, b, c); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void useProfile(final String profile) {
if (profile == null) {
return;
}
if (this.enabledProfiles == null) {
this.enabledProfiles = new HashSet<>();
}
this.enabledProfiles.add(profile);
} } | public class class_name {
public void useProfile(final String profile) {
if (profile == null) {
return; // depends on control dependency: [if], data = [none]
}
if (this.enabledProfiles == null) {
this.enabledProfiles = new HashSet<>(); // depends on control dependency: [if], data = [none]
}
this.enabledProfiles.add(profile);
} } |
public class class_name {
public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
}
}
notifyOnValueChange();
} } | public class class_name {
public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue(); // depends on control dependency: [if], data = [none]
} else {
try {
tryToSetParsedValue(value); // depends on control dependency: [try], data = [none]
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
} // depends on control dependency: [catch], data = [none]
}
notifyOnValueChange();
} } |
public class class_name {
public synchronized String[] list()
{
if(isDirectory() && _list==null)
{
ArrayList list = new ArrayList(32);
checkConnection();
JarFile jarFile=_jarFile;
if(jarFile==null)
{
try
{
jarFile=((JarURLConnection)
((new URL(_jarUrl)).openConnection())).getJarFile();
}
catch(Exception e)
{
LogSupport.ignore(log,e);
}
}
Enumeration e=jarFile.entries();
String dir=_urlString.substring(_urlString.indexOf("!/")+2);
while(e.hasMoreElements())
{
JarEntry entry = (JarEntry) e.nextElement();
String name=entry.getName().replace('\\','/');
if(!name.startsWith(dir) || name.length()==dir.length())
continue;
String listName=name.substring(dir.length());
int dash=listName.indexOf('/');
if (dash>=0)
{
listName=listName.substring(0,dash+1);
if (list.contains(listName))
continue;
}
list.add(listName);
}
_list=new String[list.size()];
list.toArray(_list);
}
return _list;
} } | public class class_name {
public synchronized String[] list()
{
if(isDirectory() && _list==null)
{
ArrayList list = new ArrayList(32);
checkConnection(); // depends on control dependency: [if], data = [none]
JarFile jarFile=_jarFile;
if(jarFile==null)
{
try
{
jarFile=((JarURLConnection)
((new URL(_jarUrl)).openConnection())).getJarFile(); // depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
LogSupport.ignore(log,e);
} // depends on control dependency: [catch], data = [none]
}
Enumeration e=jarFile.entries();
String dir=_urlString.substring(_urlString.indexOf("!/")+2);
while(e.hasMoreElements())
{
JarEntry entry = (JarEntry) e.nextElement();
String name=entry.getName().replace('\\','/');
if(!name.startsWith(dir) || name.length()==dir.length())
continue;
String listName=name.substring(dir.length());
int dash=listName.indexOf('/');
if (dash>=0)
{
listName=listName.substring(0,dash+1); // depends on control dependency: [if], data = [none]
if (list.contains(listName))
continue;
}
list.add(listName); // depends on control dependency: [while], data = [none]
}
_list=new String[list.size()]; // depends on control dependency: [if], data = [none]
list.toArray(_list); // depends on control dependency: [if], data = [none]
}
return _list;
} } |
public class class_name {
private int pruneToRemove() {
final Iterator<IndexedClass> iter = toRemove_.iterator();
int size = 0;
while (iter.hasNext()) {
final IndexedClass cls = iter.next();
/* @formatter:off
*
* Should be pruned when
* it is not in taxonomy, or
* it is in the bottom class.
*
* @formatter:on
*/
final TaxonomyNode<ElkClass> node = taxonomy_
.getNode(cls.getElkEntity());
if (node == null) {
iter.remove();
continue;
}
// else
if (cls == ontologyIndex_.getOwlNothing()) {
iter.remove();
continue;
}
size++;
}
return size;
} } | public class class_name {
private int pruneToRemove() {
final Iterator<IndexedClass> iter = toRemove_.iterator();
int size = 0;
while (iter.hasNext()) {
final IndexedClass cls = iter.next();
/* @formatter:off
*
* Should be pruned when
* it is not in taxonomy, or
* it is in the bottom class.
*
* @formatter:on
*/
final TaxonomyNode<ElkClass> node = taxonomy_
.getNode(cls.getElkEntity());
if (node == null) {
iter.remove(); // depends on control dependency: [if], data = [none]
continue;
}
// else
if (cls == ontologyIndex_.getOwlNothing()) {
iter.remove(); // depends on control dependency: [if], data = [none]
continue;
}
size++; // depends on control dependency: [while], data = [none]
}
return size;
} } |
public class class_name {
@Nullable
public static PDBusinessCard parseBusinessCard (@Nonnull final byte [] aData, @Nullable final Charset aCharset)
{
ValueEnforcer.notNull (aData, "Data");
{
// Read version 1
final PD1BusinessCardMarshaller aMarshaller1 = new PD1BusinessCardMarshaller ();
aMarshaller1.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller1.setCharset (aCharset);
final PD1BusinessCardType aBC1 = aMarshaller1.read (aData);
if (aBC1 != null)
try
{
return PD1APIHelper.createBusinessCard (aBC1);
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
}
}
{
// Read as version 2
final PD2BusinessCardMarshaller aMarshaller2 = new PD2BusinessCardMarshaller ();
aMarshaller2.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller2.setCharset (aCharset);
final PD2BusinessCardType aBC2 = aMarshaller2.read (aData);
if (aBC2 != null)
try
{
return PD2APIHelper.createBusinessCard (aBC2);
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
}
}
{
// Read as version 3
final PD3BusinessCardMarshaller aMarshaller3 = new PD3BusinessCardMarshaller ();
aMarshaller3.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller3.setCharset (aCharset);
final PD3BusinessCardType aBC3 = aMarshaller3.read (aData);
if (aBC3 != null)
try
{
return PD3APIHelper.createBusinessCard (aBC3);
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
}
}
// Unsupported version
return null;
} } | public class class_name {
@Nullable
public static PDBusinessCard parseBusinessCard (@Nonnull final byte [] aData, @Nullable final Charset aCharset)
{
ValueEnforcer.notNull (aData, "Data");
{
// Read version 1
final PD1BusinessCardMarshaller aMarshaller1 = new PD1BusinessCardMarshaller ();
aMarshaller1.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller1.setCharset (aCharset);
final PD1BusinessCardType aBC1 = aMarshaller1.read (aData);
if (aBC1 != null)
try
{
return PD1APIHelper.createBusinessCard (aBC1); // depends on control dependency: [try], data = [none]
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
} // depends on control dependency: [catch], data = [none]
}
{
// Read as version 2
final PD2BusinessCardMarshaller aMarshaller2 = new PD2BusinessCardMarshaller ();
aMarshaller2.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller2.setCharset (aCharset);
final PD2BusinessCardType aBC2 = aMarshaller2.read (aData);
if (aBC2 != null)
try
{
return PD2APIHelper.createBusinessCard (aBC2); // depends on control dependency: [try], data = [none]
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
} // depends on control dependency: [catch], data = [none]
}
{
// Read as version 3
final PD3BusinessCardMarshaller aMarshaller3 = new PD3BusinessCardMarshaller ();
aMarshaller3.readExceptionCallbacks ().removeAll ();
if (aCharset != null)
aMarshaller3.setCharset (aCharset);
final PD3BusinessCardType aBC3 = aMarshaller3.read (aData);
if (aBC3 != null)
try
{
return PD3APIHelper.createBusinessCard (aBC3); // depends on control dependency: [try], data = [none]
}
catch (final IllegalArgumentException ex)
{
// If the BC does not adhere to the XSD
// Happens if e.g. name is null
return null;
} // depends on control dependency: [catch], data = [none]
}
// Unsupported version
return null;
} } |
public class class_name {
public void marshall(Folder folder, ProtocolMarshaller protocolMarshaller) {
if (folder == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(folder.getTreeId(), TREEID_BINDING);
protocolMarshaller.marshall(folder.getAbsolutePath(), ABSOLUTEPATH_BINDING);
protocolMarshaller.marshall(folder.getRelativePath(), RELATIVEPATH_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Folder folder, ProtocolMarshaller protocolMarshaller) {
if (folder == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(folder.getTreeId(), TREEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(folder.getAbsolutePath(), ABSOLUTEPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(folder.getRelativePath(), RELATIVEPATH_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 compile() {
// Treat media queries as "normal" sections as they are supported by CSS
sections.addAll(mediaQueries.values());
for (Section section : new ArrayList<Section>(sections)) {
compileSection(section);
}
// Delete empty selectors
sections.removeIf(section -> section.getSubSections().isEmpty() && section.getAttributes().isEmpty());
} } | public class class_name {
public void compile() {
// Treat media queries as "normal" sections as they are supported by CSS
sections.addAll(mediaQueries.values());
for (Section section : new ArrayList<Section>(sections)) {
compileSection(section); // depends on control dependency: [for], data = [section]
}
// Delete empty selectors
sections.removeIf(section -> section.getSubSections().isEmpty() && section.getAttributes().isEmpty());
} } |
public class class_name {
public Long pexpireAt(Object key, long millisecondsTimestamp) {
Jedis jedis = getJedis();
try {
return jedis.pexpireAt(keyToBytes(key), millisecondsTimestamp);
}
finally {close(jedis);}
} } | public class class_name {
public Long pexpireAt(Object key, long millisecondsTimestamp) {
Jedis jedis = getJedis();
try {
return jedis.pexpireAt(keyToBytes(key), millisecondsTimestamp);
// depends on control dependency: [try], data = [none]
}
finally {close(jedis);}
} } |
public class class_name {
@Override
public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {
if (tc.isEntryEnabled()) {
Tr.entry(tc, "getObjectInstance: o=" + o + ",name=" + n + ",context=" + c + ",evnmt=" + envmt);
}
if (!(o instanceof Reference)) {
if (tc.isEntryEnabled()) {
Tr.exit(tc, "Object " + o + " is not an instance of javax.naming.Reference. Returning null.");
}
return null;
}
Reference ref = (Reference) o;
final Class<?> contextClass = Class.forName(ref.getClassName());
if (tc.isDebugEnabled())
Tr.debug(tc, "Creating a proxy for type {0}", contextClass);
Object proxy = null;
if (Application.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an Application sub-class being injected. Injecting an instance of ApplicationInjectionProxy.");
}
proxy = new ApplicationInjectionProxy();
} else if (HttpServletRequest.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an HttpServletRequest sub-class being injected. Injecting an instance of HttpServletRequestInjectionProxy.");
}
proxy = new HttpServletRequestInjectionProxy();
} else if (HttpServletResponse.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an HttpServletResponse sub-class being injected. Injecting an instance of HttpServletResponseInjectionProxy.");
}
proxy = new HttpServletResponseInjectionProxy();
} else {
proxy = Proxy.newProxyInstance(priv.getClassLoader(contextClass),
new Class[] { contextClass },
new InvocationHandler() {
@Override
public Object invoke(Object proxy,
Method method,
Object[] args) throws Throwable {
// Without these entry and exit calls RAS uses bytecode injection
// to insert Tr.entry on first line of this method and then Tr.exit
// on last lie. Tr.entry attempts to call proxy.toString(), which
// loops back to the invoke method again--hence resulting in a
// StackOverflowError
if (tc.isEntryEnabled()) {
Tr.entry(tc, "invoke");
}
Object result = null;
// use runtimeContext from TLS
InjectionRuntimeContext runtimeContext = InjectionRuntimeContextHelper.getRuntimeContext();
if ("toString".equals(method.getName()) && (method.getParameterTypes().length == 0)) {
result = "Proxy for " + contextClass.getName();
if (tc.isEntryEnabled()) {
Tr.exit(tc, "invoke", result);
}
return result;
}
// get the real context from the RuntimeContext
Object context = runtimeContext.getRuntimeCtxObject(contextClass.getName());
if (context != null) {
result = method.invoke(context, args);
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "invoke", result);
}
// invoke the method on the real context
return result;
}
});
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "getObjectInstance", proxy);
}
return proxy;
} } | public class class_name {
@Override
public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {
if (tc.isEntryEnabled()) {
Tr.entry(tc, "getObjectInstance: o=" + o + ",name=" + n + ",context=" + c + ",evnmt=" + envmt);
}
if (!(o instanceof Reference)) {
if (tc.isEntryEnabled()) {
Tr.exit(tc, "Object " + o + " is not an instance of javax.naming.Reference. Returning null.");
}
return null;
}
Reference ref = (Reference) o;
final Class<?> contextClass = Class.forName(ref.getClassName());
if (tc.isDebugEnabled())
Tr.debug(tc, "Creating a proxy for type {0}", contextClass);
Object proxy = null;
if (Application.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an Application sub-class being injected. Injecting an instance of ApplicationInjectionProxy.");
}
proxy = new ApplicationInjectionProxy();
} else if (HttpServletRequest.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an HttpServletRequest sub-class being injected. Injecting an instance of HttpServletRequestInjectionProxy.");
}
proxy = new HttpServletRequestInjectionProxy();
} else if (HttpServletResponse.class.equals(contextClass)) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "This is an HttpServletResponse sub-class being injected. Injecting an instance of HttpServletResponseInjectionProxy.");
}
proxy = new HttpServletResponseInjectionProxy();
} else {
proxy = Proxy.newProxyInstance(priv.getClassLoader(contextClass),
new Class[] { contextClass },
new InvocationHandler() {
@Override
public Object invoke(Object proxy,
Method method,
Object[] args) throws Throwable {
// Without these entry and exit calls RAS uses bytecode injection
// to insert Tr.entry on first line of this method and then Tr.exit
// on last lie. Tr.entry attempts to call proxy.toString(), which
// loops back to the invoke method again--hence resulting in a
// StackOverflowError
if (tc.isEntryEnabled()) {
Tr.entry(tc, "invoke");
}
Object result = null;
// use runtimeContext from TLS
InjectionRuntimeContext runtimeContext = InjectionRuntimeContextHelper.getRuntimeContext();
if ("toString".equals(method.getName()) && (method.getParameterTypes().length == 0)) {
result = "Proxy for " + contextClass.getName();
if (tc.isEntryEnabled()) {
Tr.exit(tc, "invoke", result); // depends on control dependency: [if], data = [none]
}
return result;
}
// get the real context from the RuntimeContext
Object context = runtimeContext.getRuntimeCtxObject(contextClass.getName());
if (context != null) {
result = method.invoke(context, args);
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "invoke", result);
}
// invoke the method on the real context
return result;
}
});
}
if (tc.isEntryEnabled()) {
Tr.exit(tc, "getObjectInstance", proxy);
}
return proxy;
} } |
public class class_name {
public static long decode(String s) {
long n = 0;
for (int i = 0, max = s.length(); i < max; i++) {
n = (n * 62) + encoding.indexOf(s.charAt(i));
}
return n;
} } | public class class_name {
public static long decode(String s) {
long n = 0;
for (int i = 0, max = s.length(); i < max; i++) {
n = (n * 62) + encoding.indexOf(s.charAt(i)); // depends on control dependency: [for], data = [i]
}
return n;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected <T extends Closeable> void forEachCloseable(Predicate<? super Closeable> selector, Consumer<T> function) {
for (Closeable c : closeableResources) {
if (selector.test(c)) {
function.accept((T) c);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
protected <T extends Closeable> void forEachCloseable(Predicate<? super Closeable> selector, Consumer<T> function) {
for (Closeable c : closeableResources) {
if (selector.test(c)) {
function.accept((T) c); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void setOptionsToRemove(java.util.Collection<OptionSpecification> optionsToRemove) {
if (optionsToRemove == null) {
this.optionsToRemove = null;
return;
}
this.optionsToRemove = new com.amazonaws.internal.SdkInternalList<OptionSpecification>(optionsToRemove);
} } | public class class_name {
public void setOptionsToRemove(java.util.Collection<OptionSpecification> optionsToRemove) {
if (optionsToRemove == null) {
this.optionsToRemove = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.optionsToRemove = new com.amazonaws.internal.SdkInternalList<OptionSpecification>(optionsToRemove);
} } |
public class class_name {
public static alluxio.grpc.LocalityTier toProto(TieredIdentity.LocalityTier localityTier) {
alluxio.grpc.LocalityTier.Builder tier =
alluxio.grpc.LocalityTier.newBuilder().setTierName(localityTier.getTierName());
if (localityTier.getValue() != null) {
tier.setValue(localityTier.getValue());
}
return tier.build();
} } | public class class_name {
public static alluxio.grpc.LocalityTier toProto(TieredIdentity.LocalityTier localityTier) {
alluxio.grpc.LocalityTier.Builder tier =
alluxio.grpc.LocalityTier.newBuilder().setTierName(localityTier.getTierName());
if (localityTier.getValue() != null) {
tier.setValue(localityTier.getValue()); // depends on control dependency: [if], data = [(localityTier.getValue()]
}
return tier.build();
} } |
public class class_name {
public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0);
}
return (result);
} } | public class class_name {
public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0); // depends on control dependency: [if], data = [(item]
}
return (result);
} } |
public class class_name {
public static TermColor getColorByFunction(TermFunction func) {
List<Term<?>> args = func.getSeparatedValues(CSSFactory.getTermFactory().createOperator(','), false);
if (args != null)
{
if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT)
|| COLOR_RGBA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
boolean percVals = false;
boolean intVals = false;
int[] rgb = new int[COLOR_PARAMS_COUNT];
for(int i = 0; i < COLOR_PARAMS_COUNT; i++) {
Term<?> term = args.get(i);
// term is number and numeric
if(term instanceof TermInteger ) {
rgb[i] = ((TermInteger)term).getIntValue();
intVals = true;
}
// term is percent
else if(term instanceof TermPercent) {
final int value = ((TermPercent) term).getValue().intValue();
rgb[i] = (value * MAX_VALUE) / PERCENT_CONVERSION;
percVals = true;
}
// not valid term
else {
return null;
}
}
if (percVals && intVals) //do not allow both percentages and int values combined
return null;
// limits
for(int i = 0; i < rgb.length; i++) {
if(rgb[i] < MIN_VALUE) rgb[i] = MIN_VALUE;
if(rgb[i] > MAX_VALUE) rgb[i] = MAX_VALUE;
}
//alpha
int a = MAX_VALUE;
if (args.size() > COLOR_PARAMS_COUNT)
{
Term<?> term = args.get(COLOR_PARAMS_COUNT);
if (term instanceof TermNumber || term instanceof TermInteger) {
float alpha = getFloatValue(term);
a = Math.round(alpha * MAX_VALUE);
if (a < MIN_VALUE) a = MIN_VALUE;
if (a > MAX_VALUE) a = MAX_VALUE;
}
else
return null; //unacceptable alpha value
}
return new TermColorImpl(rgb[0], rgb[1], rgb[2], a);
}
else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT)
|| COLOR_HSLA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
float h, s, l;
Term<?> hterm = args.get(0);
if (hterm instanceof TermNumber || hterm instanceof TermInteger) {
h = getFloatValue(hterm);
while (h >= MAX_HUE) h -= MAX_HUE;
while (h < 0) h += MAX_HUE;
h = h / MAX_HUE; //normalize to 0..1
}
else
return null;
Term<?> sterm = args.get(1);
if (sterm instanceof TermPercent) {
int is = ((TermPercent) sterm).getValue().intValue();
if (is > 100) is = 100;
else if (is < 0) is = 0;
s = is / 100.0f;
}
else
return null;
Term<?> lterm = args.get(2);
if (lterm instanceof TermPercent) {
int il = ((TermPercent) lterm).getValue().intValue();
if (il > 100) il = 100;
else if (il < 0) il = 0;
l = il / 100.0f;
}
else
return null;
int[] rgb = hslToRgb(h, s, l);
// alpha
int a = MAX_VALUE;
if (args.size() > COLOR_PARAMS_COUNT)
{
Term<?> term = args.get(3);
if (term instanceof TermNumber || term instanceof TermInteger) {
float alpha = getFloatValue(term);
a = Math.round(alpha * MAX_VALUE);
if (a < MIN_VALUE) a = MIN_VALUE;
if (a > MAX_VALUE) a = MAX_VALUE;
}
else
return null; // unacceptable alpha value
}
return new TermColorImpl(rgb[0], rgb[1], rgb[2], a);
}
// invalid function
else
return null;
}
else
return null; //couldn't parse arguments
} } | public class class_name {
public static TermColor getColorByFunction(TermFunction func) {
List<Term<?>> args = func.getSeparatedValues(CSSFactory.getTermFactory().createOperator(','), false);
if (args != null)
{
if ((COLOR_RGB_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT)
|| COLOR_RGBA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
boolean percVals = false;
boolean intVals = false;
int[] rgb = new int[COLOR_PARAMS_COUNT];
for(int i = 0; i < COLOR_PARAMS_COUNT; i++) {
Term<?> term = args.get(i);
// term is number and numeric
if(term instanceof TermInteger ) {
rgb[i] = ((TermInteger)term).getIntValue(); // depends on control dependency: [if], data = [none]
intVals = true; // depends on control dependency: [if], data = [none]
}
// term is percent
else if(term instanceof TermPercent) {
final int value = ((TermPercent) term).getValue().intValue();
rgb[i] = (value * MAX_VALUE) / PERCENT_CONVERSION; // depends on control dependency: [if], data = [none]
percVals = true; // depends on control dependency: [if], data = [none]
}
// not valid term
else {
return null; // depends on control dependency: [if], data = [none]
}
}
if (percVals && intVals) //do not allow both percentages and int values combined
return null;
// limits
for(int i = 0; i < rgb.length; i++) {
if(rgb[i] < MIN_VALUE) rgb[i] = MIN_VALUE;
if(rgb[i] > MAX_VALUE) rgb[i] = MAX_VALUE;
}
//alpha
int a = MAX_VALUE;
if (args.size() > COLOR_PARAMS_COUNT)
{
Term<?> term = args.get(COLOR_PARAMS_COUNT);
if (term instanceof TermNumber || term instanceof TermInteger) {
float alpha = getFloatValue(term);
a = Math.round(alpha * MAX_VALUE); // depends on control dependency: [if], data = [none]
if (a < MIN_VALUE) a = MIN_VALUE;
if (a > MAX_VALUE) a = MAX_VALUE;
}
else
return null; //unacceptable alpha value
}
return new TermColorImpl(rgb[0], rgb[1], rgb[2], a); // depends on control dependency: [if], data = [none]
}
else if ((COLOR_HSL_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT)
|| COLOR_HSLA_NAME.equals(func.getFunctionName()) && args.size() == COLOR_PARAMS_COUNT + 1) {
float h, s, l;
Term<?> hterm = args.get(0);
if (hterm instanceof TermNumber || hterm instanceof TermInteger) {
h = getFloatValue(hterm); // depends on control dependency: [if], data = [none]
while (h >= MAX_HUE) h -= MAX_HUE;
while (h < 0) h += MAX_HUE;
h = h / MAX_HUE; //normalize to 0..1 // depends on control dependency: [if], data = [none]
}
else
return null;
Term<?> sterm = args.get(1);
if (sterm instanceof TermPercent) {
int is = ((TermPercent) sterm).getValue().intValue();
if (is > 100) is = 100;
else if (is < 0) is = 0;
s = is / 100.0f; // depends on control dependency: [if], data = [none]
}
else
return null;
Term<?> lterm = args.get(2);
if (lterm instanceof TermPercent) {
int il = ((TermPercent) lterm).getValue().intValue();
if (il > 100) il = 100;
else if (il < 0) il = 0;
l = il / 100.0f; // depends on control dependency: [if], data = [none]
}
else
return null;
int[] rgb = hslToRgb(h, s, l);
// alpha
int a = MAX_VALUE;
if (args.size() > COLOR_PARAMS_COUNT)
{
Term<?> term = args.get(3);
if (term instanceof TermNumber || term instanceof TermInteger) {
float alpha = getFloatValue(term);
a = Math.round(alpha * MAX_VALUE); // depends on control dependency: [if], data = [none]
if (a < MIN_VALUE) a = MIN_VALUE;
if (a > MAX_VALUE) a = MAX_VALUE;
}
else
return null; // unacceptable alpha value
}
return new TermColorImpl(rgb[0], rgb[1], rgb[2], a); // depends on control dependency: [if], data = [none]
}
// invalid function
else
return null;
}
else
return null; //couldn't parse arguments
} } |
public class class_name {
public final EObject ruleJvmArgumentTypeReference() throws RecognitionException {
EObject current = null;
EObject this_JvmTypeReference_0 = null;
EObject this_JvmWildcardTypeReference_1 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:6299:2: ( (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference ) )
// InternalXbaseWithAnnotations.g:6300:2: (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference )
{
// InternalXbaseWithAnnotations.g:6300:2: (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference )
int alt114=2;
int LA114_0 = input.LA(1);
if ( (LA114_0==RULE_ID||LA114_0==14||LA114_0==39) ) {
alt114=1;
}
else if ( (LA114_0==86) ) {
alt114=2;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 114, 0, input);
throw nvae;
}
switch (alt114) {
case 1 :
// InternalXbaseWithAnnotations.g:6301:3: this_JvmTypeReference_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceAccess().getJvmTypeReferenceParserRuleCall_0());
}
pushFollow(FOLLOW_2);
this_JvmTypeReference_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_JvmTypeReference_0;
afterParserOrEnumRuleCall();
}
}
break;
case 2 :
// InternalXbaseWithAnnotations.g:6310:3: this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceAccess().getJvmWildcardTypeReferenceParserRuleCall_1());
}
pushFollow(FOLLOW_2);
this_JvmWildcardTypeReference_1=ruleJvmWildcardTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_JvmWildcardTypeReference_1;
afterParserOrEnumRuleCall();
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleJvmArgumentTypeReference() throws RecognitionException {
EObject current = null;
EObject this_JvmTypeReference_0 = null;
EObject this_JvmWildcardTypeReference_1 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:6299:2: ( (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference ) )
// InternalXbaseWithAnnotations.g:6300:2: (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference )
{
// InternalXbaseWithAnnotations.g:6300:2: (this_JvmTypeReference_0= ruleJvmTypeReference | this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference )
int alt114=2;
int LA114_0 = input.LA(1);
if ( (LA114_0==RULE_ID||LA114_0==14||LA114_0==39) ) {
alt114=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA114_0==86) ) {
alt114=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 114, 0, input);
throw nvae;
}
switch (alt114) {
case 1 :
// InternalXbaseWithAnnotations.g:6301:3: this_JvmTypeReference_0= ruleJvmTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceAccess().getJvmTypeReferenceParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
this_JvmTypeReference_0=ruleJvmTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_JvmTypeReference_0; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
break;
case 2 :
// InternalXbaseWithAnnotations.g:6310:3: this_JvmWildcardTypeReference_1= ruleJvmWildcardTypeReference
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getJvmArgumentTypeReferenceAccess().getJvmWildcardTypeReferenceParserRuleCall_1()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
this_JvmWildcardTypeReference_1=ruleJvmWildcardTypeReference();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_JvmWildcardTypeReference_1; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private void writeDocument(String fullDocument, String filename) {
// create output file handle
File outFile = new File(mOutputDir, filename+".xml");
BufferedWriter bw = null;
try {
// create a buffered writer for the output file
bw = new BufferedWriter(new FileWriter(outFile));
bw.append(fullDocument);
} catch (IOException e) { // something went wrong with the bufferedwriter
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written.");
} finally { // clean up for the bufferedwriter
try {
bw.close();
} catch(IOException e) {
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed.");
}
}
} } | public class class_name {
private void writeDocument(String fullDocument, String filename) {
// create output file handle
File outFile = new File(mOutputDir, filename+".xml");
BufferedWriter bw = null;
try {
// create a buffered writer for the output file
bw = new BufferedWriter(new FileWriter(outFile)); // depends on control dependency: [try], data = [none]
bw.append(fullDocument); // depends on control dependency: [try], data = [none]
} catch (IOException e) { // something went wrong with the bufferedwriter
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be written.");
} finally { // clean up for the bufferedwriter // depends on control dependency: [catch], data = [none]
try {
bw.close(); // depends on control dependency: [try], data = [none]
} catch(IOException e) {
e.printStackTrace();
Logger.printError(component, "File "+outFile.getAbsolutePath()+" could not be closed.");
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public String getPartition(String url, Metadata metadata) {
String partitionKey = null;
String host = "";
// IP in metadata?
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_IP)) {
String ip_provided = metadata.getFirstValue("ip");
if (StringUtils.isNotBlank(ip_provided)) {
partitionKey = ip_provided;
}
}
if (partitionKey == null) {
URL u;
try {
u = new URL(url);
host = u.getHost();
} catch (MalformedURLException e1) {
LOG.warn("Invalid URL: {}", url);
return null;
}
}
// partition by hostname
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_HOST))
partitionKey = host;
// partition by domain : needs fixing
else if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_DOMAIN)) {
partitionKey = PaidLevelDomain.getPLD(host);
}
// partition by IP
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_IP)
&& partitionKey == null) {
try {
long start = System.currentTimeMillis();
final InetAddress addr = InetAddress.getByName(host);
partitionKey = addr.getHostAddress();
long end = System.currentTimeMillis();
LOG.debug("Resolved IP {} in {} msec for : {}", partitionKey,
end - start, url);
} catch (final Exception e) {
LOG.warn("Unable to resolve IP for: {}", host);
return null;
}
}
LOG.debug("Partition Key for: {} > {}", url, partitionKey);
return partitionKey;
} } | public class class_name {
public String getPartition(String url, Metadata metadata) {
String partitionKey = null;
String host = "";
// IP in metadata?
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_IP)) {
String ip_provided = metadata.getFirstValue("ip");
if (StringUtils.isNotBlank(ip_provided)) {
partitionKey = ip_provided; // depends on control dependency: [if], data = [none]
}
}
if (partitionKey == null) {
URL u;
try {
u = new URL(url); // depends on control dependency: [try], data = [none]
host = u.getHost(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e1) {
LOG.warn("Invalid URL: {}", url);
return null;
} // depends on control dependency: [catch], data = [none]
}
// partition by hostname
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_HOST))
partitionKey = host;
// partition by domain : needs fixing
else if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_DOMAIN)) {
partitionKey = PaidLevelDomain.getPLD(host); // depends on control dependency: [if], data = [none]
}
// partition by IP
if (mode.equalsIgnoreCase(Constants.PARTITION_MODE_IP)
&& partitionKey == null) {
try {
long start = System.currentTimeMillis();
final InetAddress addr = InetAddress.getByName(host);
partitionKey = addr.getHostAddress(); // depends on control dependency: [try], data = [none]
long end = System.currentTimeMillis();
LOG.debug("Resolved IP {} in {} msec for : {}", partitionKey,
end - start, url); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOG.warn("Unable to resolve IP for: {}", host);
return null;
} // depends on control dependency: [catch], data = [none]
}
LOG.debug("Partition Key for: {} > {}", url, partitionKey);
return partitionKey;
} } |
public class class_name {
public void setScheduledInstanceIds(java.util.Collection<String> scheduledInstanceIds) {
if (scheduledInstanceIds == null) {
this.scheduledInstanceIds = null;
return;
}
this.scheduledInstanceIds = new com.amazonaws.internal.SdkInternalList<String>(scheduledInstanceIds);
} } | public class class_name {
public void setScheduledInstanceIds(java.util.Collection<String> scheduledInstanceIds) {
if (scheduledInstanceIds == null) {
this.scheduledInstanceIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.scheduledInstanceIds = new com.amazonaws.internal.SdkInternalList<String>(scheduledInstanceIds);
} } |
public class class_name {
public void setWindowMinFullHeight(int minHeight) {
Window window = CmsVaadinUtils.getWindow(this);
if (window == null) {
return;
}
window.setHeight("90%");
setHeight("100%");
setContentMinHeight(minHeight);
window.center();
} } | public class class_name {
public void setWindowMinFullHeight(int minHeight) {
Window window = CmsVaadinUtils.getWindow(this);
if (window == null) {
return; // depends on control dependency: [if], data = [none]
}
window.setHeight("90%");
setHeight("100%");
setContentMinHeight(minHeight);
window.center();
} } |
public class class_name {
protected <I extends AdminToolValidationInterceptor<O>> void sortInterceptors(List<I> interceptors) {
if (!CollectionUtils.isEmpty(interceptors)) {
int amount = interceptors != null ? interceptors.size() : 0;
LOGGER.debug(amount + " interceptors configured for " + getMessageArea());
Collections.sort(interceptors, new Comparator<I>() {
@Override
public int compare(I o1, I o2) {
return Integer.compare(o1.getPrecedence(), o2.getPrecedence());
}
});
for (AdminToolValidationInterceptor<O> interceptor : interceptors) {
LOGGER.debug(" precedence: " + interceptor.getPrecedence() + ", class: " + interceptor.getClass().getSimpleName());
}
}
} } | public class class_name {
protected <I extends AdminToolValidationInterceptor<O>> void sortInterceptors(List<I> interceptors) {
if (!CollectionUtils.isEmpty(interceptors)) {
int amount = interceptors != null ? interceptors.size() : 0;
LOGGER.debug(amount + " interceptors configured for " + getMessageArea());
// depends on control dependency: [if], data = [none]
Collections.sort(interceptors, new Comparator<I>() {
@Override
public int compare(I o1, I o2) {
return Integer.compare(o1.getPrecedence(), o2.getPrecedence());
}
});
// depends on control dependency: [if], data = [none]
for (AdminToolValidationInterceptor<O> interceptor : interceptors) {
LOGGER.debug(" precedence: " + interceptor.getPrecedence() + ", class: " + interceptor.getClass().getSimpleName());
// depends on control dependency: [for], data = [interceptor]
}
}
} } |
public class class_name {
public DMatrixRMaj getH(DMatrixRMaj H ) {
H = UtilDecompositons_DDRM.checkZeros(H,N,N);
// copy the first row
System.arraycopy(QH.data, 0, H.data, 0, N);
for( int i = 1; i < N; i++ ) {
for( int j = i-1; j < N; j++ ) {
H.set(i,j, QH.get(i,j));
}
}
return H;
} } | public class class_name {
public DMatrixRMaj getH(DMatrixRMaj H ) {
H = UtilDecompositons_DDRM.checkZeros(H,N,N);
// copy the first row
System.arraycopy(QH.data, 0, H.data, 0, N);
for( int i = 1; i < N; i++ ) {
for( int j = i-1; j < N; j++ ) {
H.set(i,j, QH.get(i,j)); // depends on control dependency: [for], data = [j]
}
}
return H;
} } |
public class class_name {
public byte[] toByteArray() {
if (state != State.PASS) {
logger.log(Level.WARNING, "Failed to instrument class " + className + " because " + message);
return original;
}
return cw.toByteArray();
} } | public class class_name {
public byte[] toByteArray() {
if (state != State.PASS) {
logger.log(Level.WARNING, "Failed to instrument class " + className + " because " + message); // depends on control dependency: [if], data = [none]
return original; // depends on control dependency: [if], data = [none]
}
return cw.toByteArray();
} } |
public class class_name {
public TagHandler createTagHandler(String ns, String localName, TagConfig tag) throws FacesException
{
if (containsNamespace(ns))
{
TagHandlerFactory f = _factories.get(localName);
if (f != null)
{
return f.createHandler(tag);
}
}
return null;
} } | public class class_name {
public TagHandler createTagHandler(String ns, String localName, TagConfig tag) throws FacesException
{
if (containsNamespace(ns))
{
TagHandlerFactory f = _factories.get(localName);
if (f != null)
{
return f.createHandler(tag); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private String trimTo1(String string) {
while (string.startsWith("\"\"") && string.endsWith("\"\"")) {
string = string.substring(1, string.length() - 1);
}
return string;
} } | public class class_name {
private String trimTo1(String string) {
while (string.startsWith("\"\"") && string.endsWith("\"\"")) {
string = string.substring(1, string.length() - 1); // depends on control dependency: [while], data = [none]
}
return string;
} } |
public class class_name {
private static <T> Method tryGetSetMethod(Class<T> clazz, Field field, String methodName) {
try {
return clazz.getDeclaredMethod(methodName, field.getType());
} catch (Exception e) {
return null;
}
} } | public class class_name {
private static <T> Method tryGetSetMethod(Class<T> clazz, Field field, String methodName) {
try {
return clazz.getDeclaredMethod(methodName, field.getType()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Expression unboxAsMessage() {
if (soyType().getKind() == Kind.NULL) {
// If this is a null literal, return a Messaged-typed null literal.
return BytecodeUtils.constantNull(BytecodeUtils.MESSAGE_TYPE);
}
// Attempting to unbox an unboxed proto
// (We compare the non-nullable type because being null doesn't impact unboxability,
// and if we didn't remove null then isKnownProtoOrUnionOfProtos would fail.)
if (soyRuntimeType.asNonNullable().isKnownProtoOrUnionOfProtos() && !isBoxed()) {
return this;
}
if (delegate.isNonNullable()) {
return delegate.invoke(MethodRef.SOY_PROTO_VALUE_GET_PROTO);
}
return new Expression(BytecodeUtils.MESSAGE_TYPE, features()) {
@Override
protected void doGen(CodeBuilder adapter) {
Label end = new Label();
delegate.gen(adapter);
BytecodeUtils.nullCoalesce(adapter, end);
MethodRef.SOY_PROTO_VALUE_GET_PROTO.invokeUnchecked(adapter);
adapter.mark(end);
}
};
} } | public class class_name {
public Expression unboxAsMessage() {
if (soyType().getKind() == Kind.NULL) {
// If this is a null literal, return a Messaged-typed null literal.
return BytecodeUtils.constantNull(BytecodeUtils.MESSAGE_TYPE); // depends on control dependency: [if], data = [none]
}
// Attempting to unbox an unboxed proto
// (We compare the non-nullable type because being null doesn't impact unboxability,
// and if we didn't remove null then isKnownProtoOrUnionOfProtos would fail.)
if (soyRuntimeType.asNonNullable().isKnownProtoOrUnionOfProtos() && !isBoxed()) {
return this; // depends on control dependency: [if], data = [none]
}
if (delegate.isNonNullable()) {
return delegate.invoke(MethodRef.SOY_PROTO_VALUE_GET_PROTO); // depends on control dependency: [if], data = [none]
}
return new Expression(BytecodeUtils.MESSAGE_TYPE, features()) {
@Override
protected void doGen(CodeBuilder adapter) {
Label end = new Label();
delegate.gen(adapter);
BytecodeUtils.nullCoalesce(adapter, end);
MethodRef.SOY_PROTO_VALUE_GET_PROTO.invokeUnchecked(adapter);
adapter.mark(end);
}
};
} } |
public class class_name {
public static IConjunct either( IConjunct conjunct1, IConjunct conjunct2)
{
IConjunct conjunct;
if( conjunct1.getDisjunctCount() == 0)
{
conjunct = conjunct2;
}
else if( conjunct2.getDisjunctCount() == 0)
{
conjunct = conjunct1;
}
else
{
Conjunction conjunction = new Conjunction();
for( Iterator<IDisjunct> disjuncts1 = conjunct1.getDisjuncts();
disjuncts1.hasNext();)
{
IDisjunct disjunct1 = disjuncts1.next();
for( Iterator<IDisjunct> disjuncts2 = conjunct2.getDisjuncts();
disjuncts2.hasNext();)
{
IDisjunct disjunct = new Disjunction( disjunct1, disjuncts2.next());
if( !isTautology( disjunct))
{
conjunction.add( simplify( disjunct));
}
}
}
conjunct = simplify( conjunction);
}
return conjunct;
} } | public class class_name {
public static IConjunct either( IConjunct conjunct1, IConjunct conjunct2)
{
IConjunct conjunct;
if( conjunct1.getDisjunctCount() == 0)
{
conjunct = conjunct2; // depends on control dependency: [if], data = [none]
}
else if( conjunct2.getDisjunctCount() == 0)
{
conjunct = conjunct1; // depends on control dependency: [if], data = [none]
}
else
{
Conjunction conjunction = new Conjunction();
for( Iterator<IDisjunct> disjuncts1 = conjunct1.getDisjuncts();
disjuncts1.hasNext();)
{
IDisjunct disjunct1 = disjuncts1.next();
for( Iterator<IDisjunct> disjuncts2 = conjunct2.getDisjuncts();
disjuncts2.hasNext();)
{
IDisjunct disjunct = new Disjunction( disjunct1, disjuncts2.next());
if( !isTautology( disjunct))
{
conjunction.add( simplify( disjunct)); // depends on control dependency: [if], data = [none]
}
}
}
conjunct = simplify( conjunction); // depends on control dependency: [if], data = [none]
}
return conjunct;
} } |
public class class_name {
public CmsGalleryFolderBean getGalleryInfo(String galleryPath) {
CmsGalleryFolderBean result = null;
for (CmsGalleryFolderBean folderBean : getAvailableGalleries()) {
if (folderBean.getPath().equals(galleryPath)) {
result = folderBean;
break;
}
}
return result;
} } | public class class_name {
public CmsGalleryFolderBean getGalleryInfo(String galleryPath) {
CmsGalleryFolderBean result = null;
for (CmsGalleryFolderBean folderBean : getAvailableGalleries()) {
if (folderBean.getPath().equals(galleryPath)) {
result = folderBean; // depends on control dependency: [if], data = [none]
break;
}
}
return result;
} } |
public class class_name {
private void fillDetailMimetypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of mime types
Iterator<String> itMimetypes = docType.getMimeTypes().iterator();
html.append("<ul>\n");
while (itMimetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itMimetypes.next()).append("\n");
html.append(" </li>");
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} } | public class class_name {
private void fillDetailMimetypes(CmsListItem item, String detailId) {
CmsSearchManager searchManager = OpenCms.getSearchManager();
StringBuffer html = new StringBuffer();
String doctypeName = (String)item.get(LIST_COLUMN_NAME);
CmsSearchDocumentType docType = searchManager.getDocumentTypeConfig(doctypeName);
// output of mime types
Iterator<String> itMimetypes = docType.getMimeTypes().iterator();
html.append("<ul>\n");
while (itMimetypes.hasNext()) {
html.append(" <li>\n").append(" ").append(itMimetypes.next()).append("\n"); // depends on control dependency: [while], data = [none]
html.append(" </li>"); // depends on control dependency: [while], data = [none]
}
html.append("</ul>\n");
item.set(detailId, html.toString());
} } |
public class class_name {
public void marshall(ListDiscoveredResourcesRequest listDiscoveredResourcesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDiscoveredResourcesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceIds(), RESOURCEIDS_BINDING);
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceName(), RESOURCENAME_BINDING);
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getIncludeDeletedResources(), INCLUDEDELETEDRESOURCES_BINDING);
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListDiscoveredResourcesRequest listDiscoveredResourcesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDiscoveredResourcesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceIds(), RESOURCEIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getResourceName(), RESOURCENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getIncludeDeletedResources(), INCLUDEDELETEDRESOURCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDiscoveredResourcesRequest.getNextToken(), NEXTTOKEN_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 ChannelFuture close(final ChannelPromise promise) {
ChannelHandlerContext ctx = ctx();
EventExecutor executor = ctx.executor();
if (executor.inEventLoop()) {
return finishEncode(ctx, promise);
} else {
executor.execute(new Runnable() {
@Override
public void run() {
ChannelFuture f = finishEncode(ctx(), promise);
f.addListener(new ChannelPromiseNotifier(promise));
}
});
return promise;
}
} } | public class class_name {
public ChannelFuture close(final ChannelPromise promise) {
ChannelHandlerContext ctx = ctx();
EventExecutor executor = ctx.executor();
if (executor.inEventLoop()) {
return finishEncode(ctx, promise); // depends on control dependency: [if], data = [none]
} else {
executor.execute(new Runnable() {
@Override
public void run() {
ChannelFuture f = finishEncode(ctx(), promise);
f.addListener(new ChannelPromiseNotifier(promise));
}
}); // depends on control dependency: [if], data = [none]
return promise; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void insert(
final UnsafeBuffer termBuffer, final int termOffset, final UnsafeBuffer packet, final int length)
{
if (0 == termBuffer.getInt(termOffset))
{
termBuffer.putBytes(termOffset + HEADER_LENGTH, packet, HEADER_LENGTH, length - HEADER_LENGTH);
termBuffer.putLong(termOffset + 24, packet.getLong(24));
termBuffer.putLong(termOffset + 16, packet.getLong(16));
termBuffer.putLong(termOffset + 8, packet.getLong(8));
termBuffer.putLongOrdered(termOffset, packet.getLong(0));
}
} } | public class class_name {
public static void insert(
final UnsafeBuffer termBuffer, final int termOffset, final UnsafeBuffer packet, final int length)
{
if (0 == termBuffer.getInt(termOffset))
{
termBuffer.putBytes(termOffset + HEADER_LENGTH, packet, HEADER_LENGTH, length - HEADER_LENGTH); // depends on control dependency: [if], data = [none]
termBuffer.putLong(termOffset + 24, packet.getLong(24)); // depends on control dependency: [if], data = [none]
termBuffer.putLong(termOffset + 16, packet.getLong(16)); // depends on control dependency: [if], data = [none]
termBuffer.putLong(termOffset + 8, packet.getLong(8)); // depends on control dependency: [if], data = [none]
termBuffer.putLongOrdered(termOffset, packet.getLong(0)); // depends on control dependency: [if], data = [(0]
}
} } |
public class class_name {
public static boolean implementsEquals(Type type, VisitorState state) {
Name equalsName = state.getName("equals");
Symbol objectEquals = getOnlyMember(state, state.getSymtab().objectType, "equals");
for (Type sup : state.getTypes().closure(type)) {
if (sup.tsym.isInterface()) {
continue;
}
if (ASTHelpers.isSameType(sup, state.getSymtab().objectType, state)) {
return false;
}
Scope scope = sup.tsym.members();
if (scope == null) {
continue;
}
for (Symbol sym : scope.getSymbolsByName(equalsName)) {
if (sym.overrides(objectEquals, type.tsym, state.getTypes(), /* checkResult= */ false)) {
return true;
}
}
}
return false;
} } | public class class_name {
public static boolean implementsEquals(Type type, VisitorState state) {
Name equalsName = state.getName("equals");
Symbol objectEquals = getOnlyMember(state, state.getSymtab().objectType, "equals");
for (Type sup : state.getTypes().closure(type)) {
if (sup.tsym.isInterface()) {
continue;
}
if (ASTHelpers.isSameType(sup, state.getSymtab().objectType, state)) {
return false; // depends on control dependency: [if], data = [none]
}
Scope scope = sup.tsym.members();
if (scope == null) {
continue;
}
for (Symbol sym : scope.getSymbolsByName(equalsName)) {
if (sym.overrides(objectEquals, type.tsym, state.getTypes(), /* checkResult= */ false)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
public static Short extractToShort(final DeviceData deviceDataArgout) throws DevFailed {
final Object value = CommandHelper.extract(deviceDataArgout);
Short argout = null;
if (value instanceof Short) {
argout = (Short) value;
} else if (value instanceof String) {
try {
argout = Short.valueOf((String) value);
} catch (final Exception e) {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
+ " is not a numerical", "CommandHelper.extractToShort(deviceDataArgin)");
}
} else if (value instanceof Integer) {
argout = Short.valueOf(((Integer) value).shortValue());
} else if (value instanceof Long) {
argout = Short.valueOf(((Long) value).shortValue());
} else if (value instanceof Float) {
argout = Short.valueOf(((Float) value).shortValue());
} else if (value instanceof Boolean) {
if (((Boolean) value).booleanValue()) {
argout = Short.valueOf((short) 1);
} else {
argout = Short.valueOf((short) 0);
}
} else if (value instanceof Double) {
argout = Short.valueOf(((Double) value).shortValue());
} else if (value instanceof DevState) {
argout = Short.valueOf(Integer.valueOf(((DevState) value).value()).shortValue());
} else {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
+ " not supported",
"CommandHelper.extractToShort(Object value,deviceDataArgin)");
}
return argout;
} } | public class class_name {
public static Short extractToShort(final DeviceData deviceDataArgout) throws DevFailed {
final Object value = CommandHelper.extract(deviceDataArgout);
Short argout = null;
if (value instanceof Short) {
argout = (Short) value;
} else if (value instanceof String) {
try {
argout = Short.valueOf((String) value); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value
+ " is not a numerical", "CommandHelper.extractToShort(deviceDataArgin)");
} // depends on control dependency: [catch], data = [none]
} else if (value instanceof Integer) {
argout = Short.valueOf(((Integer) value).shortValue());
} else if (value instanceof Long) {
argout = Short.valueOf(((Long) value).shortValue());
} else if (value instanceof Float) {
argout = Short.valueOf(((Float) value).shortValue());
} else if (value instanceof Boolean) {
if (((Boolean) value).booleanValue()) {
argout = Short.valueOf((short) 1); // depends on control dependency: [if], data = [none]
} else {
argout = Short.valueOf((short) 0); // depends on control dependency: [if], data = [none]
}
} else if (value instanceof Double) {
argout = Short.valueOf(((Double) value).shortValue());
} else if (value instanceof DevState) {
argout = Short.valueOf(Integer.valueOf(((DevState) value).value()).shortValue());
} else {
Except.throw_exception("TANGO_WRONG_DATA_ERROR", "output type " + value.getClass()
+ " not supported",
"CommandHelper.extractToShort(Object value,deviceDataArgin)");
}
return argout;
} } |
public class class_name {
public static void main(String args[]) {
try {
Display display = Display.getDefault();
WebcamPanelShell shell = new WebcamPanelShell(display);
shell.open();
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
} catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public static void main(String args[]) {
try {
Display display = Display.getDefault();
WebcamPanelShell shell = new WebcamPanelShell(display);
shell.open(); // depends on control dependency: [try], data = [none]
shell.layout(); // depends on control dependency: [try], data = [none]
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep(); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.