code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static Map<String, Message> messageTopics(Message message, String defaultTopic, String dynamicTopicConfigs) {
List<CanalEntry.Entry> entries;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entries = new ArrayList<>(rawEntries.size());
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry;
try {
entry = CanalEntry.Entry.parseFrom(byteString);
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
}
entries.add(entry);
}
} else {
entries = message.getEntries();
}
Map<String, Message> messages = new HashMap<>();
for (CanalEntry.Entry entry : entries) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
String schemaName = entry.getHeader().getSchemaName();
String tableName = entry.getHeader().getTableName();
if (StringUtils.isEmpty(schemaName) || StringUtils.isEmpty(tableName)) {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
} else {
Set<String> topics = matchTopics(schemaName + "." + tableName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
topics = matchTopics(schemaName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry);
}
} else {
put2MapMessage(messages, message.getId(), defaultTopic, entry);
}
}
}
}
return messages;
} }
|
public class class_name {
public static Map<String, Message> messageTopics(Message message, String defaultTopic, String dynamicTopicConfigs) {
List<CanalEntry.Entry> entries;
if (message.isRaw()) {
List<ByteString> rawEntries = message.getRawEntries();
entries = new ArrayList<>(rawEntries.size()); // depends on control dependency: [if], data = [none]
for (ByteString byteString : rawEntries) {
CanalEntry.Entry entry;
try {
entry = CanalEntry.Entry.parseFrom(byteString); // depends on control dependency: [try], data = [none]
} catch (InvalidProtocolBufferException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
entries.add(entry); // depends on control dependency: [for], data = [none]
}
} else {
entries = message.getEntries(); // depends on control dependency: [if], data = [none]
}
Map<String, Message> messages = new HashMap<>();
for (CanalEntry.Entry entry : entries) {
if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN
|| entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) {
continue;
}
String schemaName = entry.getHeader().getSchemaName();
String tableName = entry.getHeader().getTableName();
if (StringUtils.isEmpty(schemaName) || StringUtils.isEmpty(tableName)) {
put2MapMessage(messages, message.getId(), defaultTopic, entry); // depends on control dependency: [if], data = [none]
} else {
Set<String> topics = matchTopics(schemaName + "." + tableName, dynamicTopicConfigs);
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry); // depends on control dependency: [for], data = [topic]
}
} else {
topics = matchTopics(schemaName, dynamicTopicConfigs); // depends on control dependency: [if], data = [none]
if (topics != null) {
for (String topic : topics) {
put2MapMessage(messages, message.getId(), topic, entry); // depends on control dependency: [for], data = [topic]
}
} else {
put2MapMessage(messages, message.getId(), defaultTopic, entry); // depends on control dependency: [if], data = [none]
}
}
}
}
return messages;
} }
|
public class class_name {
public static boolean create(File dest, final boolean isFile, final int retryTimes) {
if (dest == null) {
return false;
}
int totalRetry = retryTimes;
if (retryTimes < 0) {
totalRetry = 1;
}
int retry = 0;
while (retry++ < totalRetry) {
try {
if (true == isFile) {
if ((true == dest.exists()) || (true == dest.createNewFile())) {
return true;
}
} else {
FileUtils.forceMkdir(dest);
return true;
}
} catch (Exception ex) {
// 本次等待时间
int wait = (int) Math.pow(retry, retry) * timeWait;
wait = (wait < timeWait) ? timeWait : wait;
// 尝试等待
if (retry == totalRetry) {
return false;
} else {
// 记录日志
logger.warn(String.format("[%s] create() - retry %s failed : wait [%s] ms , caused by %s",
dest.getAbsolutePath(), retry, wait, ex.getMessage()));
try {
Thread.sleep(wait);
} catch (InterruptedException e) {
return false;
}
}
}
}
return false;
} }
|
public class class_name {
public static boolean create(File dest, final boolean isFile, final int retryTimes) {
if (dest == null) {
return false; // depends on control dependency: [if], data = [none]
}
int totalRetry = retryTimes;
if (retryTimes < 0) {
totalRetry = 1; // depends on control dependency: [if], data = [none]
}
int retry = 0;
while (retry++ < totalRetry) {
try {
if (true == isFile) {
if ((true == dest.exists()) || (true == dest.createNewFile())) {
return true; // depends on control dependency: [if], data = [none]
}
} else {
FileUtils.forceMkdir(dest); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
// 本次等待时间
int wait = (int) Math.pow(retry, retry) * timeWait;
wait = (wait < timeWait) ? timeWait : wait;
// 尝试等待
if (retry == totalRetry) {
return false; // depends on control dependency: [if], data = [none]
} else {
// 记录日志
logger.warn(String.format("[%s] create() - retry %s failed : wait [%s] ms , caused by %s",
dest.getAbsolutePath(), retry, wait, ex.getMessage())); // depends on control dependency: [if], data = [none]
try {
Thread.sleep(wait); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
return false;
} }
|
public class class_name {
public List<RawComponent> removeExperimentalComponents(String name) {
List<RawComponent> all = getExperimentalComponents();
List<RawComponent> toRemove = new ArrayList<RawComponent>();
for (RawComponent property : all) {
if (property.getName().equalsIgnoreCase(name)) {
toRemove.add(property);
}
}
all.removeAll(toRemove);
return Collections.unmodifiableList(toRemove);
} }
|
public class class_name {
public List<RawComponent> removeExperimentalComponents(String name) {
List<RawComponent> all = getExperimentalComponents();
List<RawComponent> toRemove = new ArrayList<RawComponent>();
for (RawComponent property : all) {
if (property.getName().equalsIgnoreCase(name)) {
toRemove.add(property); // depends on control dependency: [if], data = [none]
}
}
all.removeAll(toRemove);
return Collections.unmodifiableList(toRemove);
} }
|
public class class_name {
void execute(final ActivityHandle handle)
throws UnrecognizedActivityHandleException {
final SleeTransaction tx = super.suspendTransaction();
try {
sleeEndpoint._endActivity(handle,tx);
} finally {
if (tx != null) {
super.resumeTransaction(tx);
}
}
} }
|
public class class_name {
void execute(final ActivityHandle handle)
throws UnrecognizedActivityHandleException {
final SleeTransaction tx = super.suspendTransaction();
try {
sleeEndpoint._endActivity(handle,tx);
} finally {
if (tx != null) {
super.resumeTransaction(tx); // depends on control dependency: [if], data = [(tx]
}
}
} }
|
public class class_name {
public Sha256Hash hashForSignature(int inputIndex, byte[] connectedScript, byte sigHashType) {
// The SIGHASH flags are used in the design of contracts, please see this page for a further understanding of
// the purposes of the code in this method:
//
// https://en.bitcoin.it/wiki/Contracts
try {
// Create a copy of this transaction to operate upon because we need make changes to the inputs and outputs.
// It would not be thread-safe to change the attributes of the transaction object itself.
Transaction tx = this.params.getDefaultSerializer().makeTransaction(this.bitcoinSerialize());
// Clear input scripts in preparation for signing. If we're signing a fresh
// transaction that step isn't very helpful, but it doesn't add much cost relative to the actual
// EC math so we'll do it anyway.
for (int i = 0; i < tx.inputs.size(); i++) {
TransactionInput input = tx.inputs.get(i);
input.clearScriptBytes();
input.setWitness(null);
}
// This step has no purpose beyond being synchronized with Bitcoin Core's bugs. OP_CODESEPARATOR
// is a legacy holdover from a previous, broken design of executing scripts that shipped in Bitcoin 0.1.
// It was seriously flawed and would have let anyone take anyone elses money. Later versions switched to
// the design we use today where scripts are executed independently but share a stack. This left the
// OP_CODESEPARATOR instruction having no purpose as it was only meant to be used internally, not actually
// ever put into scripts. Deleting OP_CODESEPARATOR is a step that should never be required but if we don't
// do it, we could split off the best chain.
connectedScript = Script.removeAllInstancesOfOp(connectedScript, ScriptOpCodes.OP_CODESEPARATOR);
// Set the input to the script of its output. Bitcoin Core does this but the step has no obvious purpose as
// the signature covers the hash of the prevout transaction which obviously includes the output script
// already. Perhaps it felt safer to him in some way, or is another leftover from how the code was written.
TransactionInput input = tx.inputs.get(inputIndex);
input.setScriptBytes(connectedScript);
if ((sigHashType & 0x1f) == SigHash.NONE.value) {
// SIGHASH_NONE means no outputs are signed at all - the signature is effectively for a "blank cheque".
tx.outputs = new ArrayList<>(0);
// The signature isn't broken by new versions of the transaction issued by other parties.
for (int i = 0; i < tx.inputs.size(); i++)
if (i != inputIndex)
tx.inputs.get(i).setSequenceNumber(0);
} else if ((sigHashType & 0x1f) == SigHash.SINGLE.value) {
// SIGHASH_SINGLE means only sign the output at the same index as the input (ie, my output).
if (inputIndex >= tx.outputs.size()) {
// The input index is beyond the number of outputs, it's a buggy signature made by a broken
// Bitcoin implementation. Bitcoin Core also contains a bug in handling this case:
// any transaction output that is signed in this case will result in both the signed output
// and any future outputs to this public key being steal-able by anyone who has
// the resulting signature and the public key (both of which are part of the signed tx input).
// Bitcoin Core's bug is that SignatureHash was supposed to return a hash and on this codepath it
// actually returns the constant "1" to indicate an error, which is never checked for. Oops.
return Sha256Hash.wrap("0100000000000000000000000000000000000000000000000000000000000000");
}
// In SIGHASH_SINGLE the outputs after the matching input index are deleted, and the outputs before
// that position are "nulled out". Unintuitively, the value in a "null" transaction is set to -1.
tx.outputs = new ArrayList<>(tx.outputs.subList(0, inputIndex + 1));
for (int i = 0; i < inputIndex; i++)
tx.outputs.set(i, new TransactionOutput(tx.params, tx, Coin.NEGATIVE_SATOSHI, new byte[] {}));
// The signature isn't broken by new versions of the transaction issued by other parties.
for (int i = 0; i < tx.inputs.size(); i++)
if (i != inputIndex)
tx.inputs.get(i).setSequenceNumber(0);
}
if ((sigHashType & SigHash.ANYONECANPAY.value) == SigHash.ANYONECANPAY.value) {
// SIGHASH_ANYONECANPAY means the signature in the input is not broken by changes/additions/removals
// of other inputs. For example, this is useful for building assurance contracts.
tx.inputs = new ArrayList<>();
tx.inputs.add(input);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream(tx.length);
tx.bitcoinSerializeToStream(bos, false);
// We also have to write a hash type (sigHashType is actually an unsigned char)
uint32ToByteStreamLE(0x000000ff & sigHashType, bos);
// Note that this is NOT reversed to ensure it will be signed correctly. If it were to be printed out
// however then we would expect that it is IS reversed.
Sha256Hash hash = Sha256Hash.twiceOf(bos.toByteArray());
bos.close();
return hash;
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen.
}
} }
|
public class class_name {
public Sha256Hash hashForSignature(int inputIndex, byte[] connectedScript, byte sigHashType) {
// The SIGHASH flags are used in the design of contracts, please see this page for a further understanding of
// the purposes of the code in this method:
//
// https://en.bitcoin.it/wiki/Contracts
try {
// Create a copy of this transaction to operate upon because we need make changes to the inputs and outputs.
// It would not be thread-safe to change the attributes of the transaction object itself.
Transaction tx = this.params.getDefaultSerializer().makeTransaction(this.bitcoinSerialize());
// Clear input scripts in preparation for signing. If we're signing a fresh
// transaction that step isn't very helpful, but it doesn't add much cost relative to the actual
// EC math so we'll do it anyway.
for (int i = 0; i < tx.inputs.size(); i++) {
TransactionInput input = tx.inputs.get(i);
input.clearScriptBytes(); // depends on control dependency: [for], data = [none]
input.setWitness(null); // depends on control dependency: [for], data = [none]
}
// This step has no purpose beyond being synchronized with Bitcoin Core's bugs. OP_CODESEPARATOR
// is a legacy holdover from a previous, broken design of executing scripts that shipped in Bitcoin 0.1.
// It was seriously flawed and would have let anyone take anyone elses money. Later versions switched to
// the design we use today where scripts are executed independently but share a stack. This left the
// OP_CODESEPARATOR instruction having no purpose as it was only meant to be used internally, not actually
// ever put into scripts. Deleting OP_CODESEPARATOR is a step that should never be required but if we don't
// do it, we could split off the best chain.
connectedScript = Script.removeAllInstancesOfOp(connectedScript, ScriptOpCodes.OP_CODESEPARATOR); // depends on control dependency: [try], data = [none]
// Set the input to the script of its output. Bitcoin Core does this but the step has no obvious purpose as
// the signature covers the hash of the prevout transaction which obviously includes the output script
// already. Perhaps it felt safer to him in some way, or is another leftover from how the code was written.
TransactionInput input = tx.inputs.get(inputIndex);
input.setScriptBytes(connectedScript); // depends on control dependency: [try], data = [none]
if ((sigHashType & 0x1f) == SigHash.NONE.value) {
// SIGHASH_NONE means no outputs are signed at all - the signature is effectively for a "blank cheque".
tx.outputs = new ArrayList<>(0); // depends on control dependency: [if], data = [none]
// The signature isn't broken by new versions of the transaction issued by other parties.
for (int i = 0; i < tx.inputs.size(); i++)
if (i != inputIndex)
tx.inputs.get(i).setSequenceNumber(0);
} else if ((sigHashType & 0x1f) == SigHash.SINGLE.value) {
// SIGHASH_SINGLE means only sign the output at the same index as the input (ie, my output).
if (inputIndex >= tx.outputs.size()) {
// The input index is beyond the number of outputs, it's a buggy signature made by a broken
// Bitcoin implementation. Bitcoin Core also contains a bug in handling this case:
// any transaction output that is signed in this case will result in both the signed output
// and any future outputs to this public key being steal-able by anyone who has
// the resulting signature and the public key (both of which are part of the signed tx input).
// Bitcoin Core's bug is that SignatureHash was supposed to return a hash and on this codepath it
// actually returns the constant "1" to indicate an error, which is never checked for. Oops.
return Sha256Hash.wrap("0100000000000000000000000000000000000000000000000000000000000000"); // depends on control dependency: [if], data = [none]
}
// In SIGHASH_SINGLE the outputs after the matching input index are deleted, and the outputs before
// that position are "nulled out". Unintuitively, the value in a "null" transaction is set to -1.
tx.outputs = new ArrayList<>(tx.outputs.subList(0, inputIndex + 1)); // depends on control dependency: [if], data = [none]
for (int i = 0; i < inputIndex; i++)
tx.outputs.set(i, new TransactionOutput(tx.params, tx, Coin.NEGATIVE_SATOSHI, new byte[] {}));
// The signature isn't broken by new versions of the transaction issued by other parties.
for (int i = 0; i < tx.inputs.size(); i++)
if (i != inputIndex)
tx.inputs.get(i).setSequenceNumber(0);
}
if ((sigHashType & SigHash.ANYONECANPAY.value) == SigHash.ANYONECANPAY.value) {
// SIGHASH_ANYONECANPAY means the signature in the input is not broken by changes/additions/removals
// of other inputs. For example, this is useful for building assurance contracts.
tx.inputs = new ArrayList<>(); // depends on control dependency: [if], data = [none]
tx.inputs.add(input); // depends on control dependency: [if], data = [none]
}
ByteArrayOutputStream bos = new ByteArrayOutputStream(tx.length);
tx.bitcoinSerializeToStream(bos, false); // depends on control dependency: [try], data = [none]
// We also have to write a hash type (sigHashType is actually an unsigned char)
uint32ToByteStreamLE(0x000000ff & sigHashType, bos); // depends on control dependency: [try], data = [none]
// Note that this is NOT reversed to ensure it will be signed correctly. If it were to be printed out
// however then we would expect that it is IS reversed.
Sha256Hash hash = Sha256Hash.twiceOf(bos.toByteArray());
bos.close(); // depends on control dependency: [try], data = [none]
return hash; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen.
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcUnitaryEquipment() {
if (ifcUnitaryEquipmentEClass == null) {
ifcUnitaryEquipmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(745);
}
return ifcUnitaryEquipmentEClass;
} }
|
public class class_name {
@Override
public EClass getIfcUnitaryEquipment() {
if (ifcUnitaryEquipmentEClass == null) {
ifcUnitaryEquipmentEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(745);
// depends on control dependency: [if], data = [none]
}
return ifcUnitaryEquipmentEClass;
} }
|
public class class_name {
static public void naive4(GrayF32 _intensity , GrayS8 direction , GrayF32 output )
{
final int w = _intensity.width;
final int h = _intensity.height;
ImageBorder_F32 intensity = (ImageBorder_F32)FactoryImageBorderAlgs.value(_intensity, 0);
BoofConcurrency.loopFor(0,h,y->{
for( int x = 0; x < w; x++ ) {
int dir = direction.get(x,y);
int dx,dy;
if( dir == 0 ) {
dx = 1; dy = 0;
} else if( dir == 1 ) {
dx = 1; dy = 1;
} else if( dir == 2 ) {
dx = 0; dy = 1;
} else {
dx = 1; dy = -1;
}
float left = intensity.get(x-dx,y-dy);
float middle = intensity.get(x,y);
float right = intensity.get(x+dx,y+dy);
// suppress the value if either of its neighboring values are more than or equal to it
if( left > middle || right > middle ) {
output.set(x,y,0);
} else {
output.set(x,y,middle);
}
}
});
} }
|
public class class_name {
static public void naive4(GrayF32 _intensity , GrayS8 direction , GrayF32 output )
{
final int w = _intensity.width;
final int h = _intensity.height;
ImageBorder_F32 intensity = (ImageBorder_F32)FactoryImageBorderAlgs.value(_intensity, 0);
BoofConcurrency.loopFor(0,h,y->{
for( int x = 0; x < w; x++ ) {
int dir = direction.get(x,y);
int dx,dy;
if( dir == 0 ) {
dx = 1; dy = 0; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else if( dir == 1 ) {
dx = 1; dy = 1; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else if( dir == 2 ) {
dx = 0; dy = 1; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else {
dx = 1; dy = -1; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
float left = intensity.get(x-dx,y-dy);
float middle = intensity.get(x,y);
float right = intensity.get(x+dx,y+dy);
// suppress the value if either of its neighboring values are more than or equal to it
if( left > middle || right > middle ) {
output.set(x,y,0); // depends on control dependency: [if], data = [none]
} else {
output.set(x,y,middle); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public static EachCommand getEachCommandFromPartsName(
final Map<String, Command> commandIndexMap,
final String[] varparts) {
if (varparts.length == TieConstants.DEFAULT_COMMAND_PART_LENGTH) {
return (EachCommand) commandIndexMap
.get(TieConstants.EACH_COMMAND_FULL_NAME_PREFIX
+ varparts[1]);
}
return null;
} }
|
public class class_name {
public static EachCommand getEachCommandFromPartsName(
final Map<String, Command> commandIndexMap,
final String[] varparts) {
if (varparts.length == TieConstants.DEFAULT_COMMAND_PART_LENGTH) {
return (EachCommand) commandIndexMap
.get(TieConstants.EACH_COMMAND_FULL_NAME_PREFIX
+ varparts[1]);
// depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Nullable
private static DimFilter toSimpleLeafFilter(
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexNode rexNode
)
{
final SqlKind kind = rexNode.getKind();
if (kind == SqlKind.IS_TRUE || kind == SqlKind.IS_NOT_FALSE) {
return toSimpleLeafFilter(
plannerContext,
querySignature,
Iterables.getOnlyElement(((RexCall) rexNode).getOperands())
);
} else if (kind == SqlKind.IS_FALSE || kind == SqlKind.IS_NOT_TRUE) {
return new NotDimFilter(
toSimpleLeafFilter(
plannerContext,
querySignature,
Iterables.getOnlyElement(((RexCall) rexNode).getOperands())
)
);
} else if (kind == SqlKind.IS_NULL || kind == SqlKind.IS_NOT_NULL) {
final RexNode operand = Iterables.getOnlyElement(((RexCall) rexNode).getOperands());
// operand must be translatable to a SimpleExtraction to be simple-filterable
final DruidExpression druidExpression =
toDruidExpression(plannerContext, querySignature.getRowSignature(), operand);
if (druidExpression == null) {
return null;
}
final DimFilter equalFilter;
if (druidExpression.isSimpleExtraction()) {
equalFilter = new SelectorDimFilter(
druidExpression.getSimpleExtraction().getColumn(),
NullHandling.defaultStringValue(),
druidExpression.getSimpleExtraction().getExtractionFn()
);
} else {
final VirtualColumn virtualColumn = querySignature.getOrCreateVirtualColumnForExpression(
plannerContext,
druidExpression,
operand.getType().getSqlTypeName()
);
if (virtualColumn == null) {
return null;
}
equalFilter = new SelectorDimFilter(
virtualColumn.getOutputName(),
NullHandling.defaultStringValue(),
null
);
}
return kind == SqlKind.IS_NOT_NULL ? new NotDimFilter(equalFilter) : equalFilter;
} else if (kind == SqlKind.EQUALS
|| kind == SqlKind.NOT_EQUALS
|| kind == SqlKind.GREATER_THAN
|| kind == SqlKind.GREATER_THAN_OR_EQUAL
|| kind == SqlKind.LESS_THAN
|| kind == SqlKind.LESS_THAN_OR_EQUAL) {
final List<RexNode> operands = ((RexCall) rexNode).getOperands();
Preconditions.checkState(operands.size() == 2, "WTF?! Expected 2 operands, got[%,d]", operands.size());
boolean flip = false;
RexNode lhs = operands.get(0);
RexNode rhs = operands.get(1);
if (lhs.getKind() == SqlKind.LITERAL && rhs.getKind() != SqlKind.LITERAL) {
// swap lhs, rhs
RexNode x = lhs;
lhs = rhs;
rhs = x;
flip = true;
}
// Flip operator, maybe.
final SqlKind flippedKind;
if (flip) {
switch (kind) {
case EQUALS:
case NOT_EQUALS:
flippedKind = kind;
break;
case GREATER_THAN:
flippedKind = SqlKind.LESS_THAN;
break;
case GREATER_THAN_OR_EQUAL:
flippedKind = SqlKind.LESS_THAN_OR_EQUAL;
break;
case LESS_THAN:
flippedKind = SqlKind.GREATER_THAN;
break;
case LESS_THAN_OR_EQUAL:
flippedKind = SqlKind.GREATER_THAN_OR_EQUAL;
break;
default:
throw new ISE("WTF?! Kind[%s] not expected here", kind);
}
} else {
flippedKind = kind;
}
// rhs must be a literal
if (rhs.getKind() != SqlKind.LITERAL) {
return null;
}
// Translate lhs to a DruidExpression.
final DruidExpression lhsExpression = toDruidExpression(plannerContext, querySignature.getRowSignature(), lhs);
if (lhsExpression == null) {
return null;
}
// Special handling for filters on FLOOR(__time TO granularity).
final Granularity queryGranularity = toQueryGranularity(lhsExpression, plannerContext.getExprMacroTable());
if (queryGranularity != null) {
// lhs is FLOOR(__time TO granularity); rhs must be a timestamp
final long rhsMillis = Calcites.calciteDateTimeLiteralToJoda(rhs, plannerContext.getTimeZone()).getMillis();
return buildTimeFloorFilter(ColumnHolder.TIME_COLUMN_NAME, queryGranularity, flippedKind, rhsMillis);
}
final String column;
final ExtractionFn extractionFn;
if (lhsExpression.isSimpleExtraction()) {
column = lhsExpression.getSimpleExtraction().getColumn();
extractionFn = lhsExpression.getSimpleExtraction().getExtractionFn();
} else {
VirtualColumn virtualLhs = querySignature.getOrCreateVirtualColumnForExpression(
plannerContext,
lhsExpression,
lhs.getType().getSqlTypeName()
);
if (virtualLhs == null) {
return null;
}
column = virtualLhs.getOutputName();
extractionFn = null;
}
if (column.equals(ColumnHolder.TIME_COLUMN_NAME) && extractionFn instanceof TimeFormatExtractionFn) {
// Check if we can strip the extractionFn and convert the filter to a direct filter on __time.
// This allows potential conversion to query-level "intervals" later on, which is ideal for Druid queries.
final Granularity granularity = ExtractionFns.toQueryGranularity(extractionFn);
if (granularity != null) {
// lhs is FLOOR(__time TO granularity); rhs must be a timestamp
final long rhsMillis = Calcites.calciteDateTimeLiteralToJoda(rhs, plannerContext.getTimeZone()).getMillis();
final Interval rhsInterval = granularity.bucket(DateTimes.utc(rhsMillis));
// Is rhs aligned on granularity boundaries?
final boolean rhsAligned = rhsInterval.getStartMillis() == rhsMillis;
// Create a BoundRefKey that strips the extractionFn and compares __time as a number.
final BoundRefKey boundRefKey = new BoundRefKey(column, null, StringComparators.NUMERIC);
return getBoundTimeDimFilter(flippedKind, boundRefKey, rhsInterval, rhsAligned);
}
}
final String val;
final RexLiteral rhsLiteral = (RexLiteral) rhs;
if (SqlTypeName.NUMERIC_TYPES.contains(rhsLiteral.getTypeName())) {
val = String.valueOf(RexLiteral.value(rhsLiteral));
} else if (SqlTypeName.CHAR_TYPES.contains(rhsLiteral.getTypeName())) {
val = String.valueOf(RexLiteral.stringValue(rhsLiteral));
} else if (SqlTypeName.TIMESTAMP == rhsLiteral.getTypeName() || SqlTypeName.DATE == rhsLiteral.getTypeName()) {
val = String.valueOf(
Calcites.calciteDateTimeLiteralToJoda(
rhsLiteral,
plannerContext.getTimeZone()
).getMillis()
);
} else {
// Don't know how to filter on this kind of literal.
return null;
}
// Numeric lhs needs a numeric comparison.
final StringComparator comparator = Calcites.getStringComparatorForSqlTypeName(lhs.getType().getSqlTypeName());
final BoundRefKey boundRefKey = new BoundRefKey(column, extractionFn, comparator);
final DimFilter filter;
// Always use BoundDimFilters, to simplify filter optimization later (it helps to remember the comparator).
switch (flippedKind) {
case EQUALS:
filter = Bounds.equalTo(boundRefKey, val);
break;
case NOT_EQUALS:
filter = new NotDimFilter(Bounds.equalTo(boundRefKey, val));
break;
case GREATER_THAN:
filter = Bounds.greaterThan(boundRefKey, val);
break;
case GREATER_THAN_OR_EQUAL:
filter = Bounds.greaterThanOrEqualTo(boundRefKey, val);
break;
case LESS_THAN:
filter = Bounds.lessThan(boundRefKey, val);
break;
case LESS_THAN_OR_EQUAL:
filter = Bounds.lessThanOrEqualTo(boundRefKey, val);
break;
default:
throw new IllegalStateException("WTF?! Shouldn't have got here...");
}
return filter;
} else if (rexNode instanceof RexCall) {
final SqlOperator operator = ((RexCall) rexNode).getOperator();
final SqlOperatorConversion conversion =
plannerContext.getOperatorTable().lookupOperatorConversion(operator);
if (conversion == null) {
return null;
} else {
DimFilter filter =
conversion.toDruidFilter(plannerContext, querySignature, rexNode);
if (filter != null) {
return filter;
}
return null;
}
}
return null;
} }
|
public class class_name {
@Nullable
private static DimFilter toSimpleLeafFilter(
final PlannerContext plannerContext,
final DruidQuerySignature querySignature,
final RexNode rexNode
)
{
final SqlKind kind = rexNode.getKind();
if (kind == SqlKind.IS_TRUE || kind == SqlKind.IS_NOT_FALSE) {
return toSimpleLeafFilter(
plannerContext,
querySignature,
Iterables.getOnlyElement(((RexCall) rexNode).getOperands())
);
} else if (kind == SqlKind.IS_FALSE || kind == SqlKind.IS_NOT_TRUE) {
return new NotDimFilter(
toSimpleLeafFilter(
plannerContext,
querySignature,
Iterables.getOnlyElement(((RexCall) rexNode).getOperands())
)
); // depends on control dependency: [if], data = [none]
} else if (kind == SqlKind.IS_NULL || kind == SqlKind.IS_NOT_NULL) {
final RexNode operand = Iterables.getOnlyElement(((RexCall) rexNode).getOperands());
// operand must be translatable to a SimpleExtraction to be simple-filterable
final DruidExpression druidExpression =
toDruidExpression(plannerContext, querySignature.getRowSignature(), operand);
if (druidExpression == null) {
return null; // depends on control dependency: [if], data = [none]
}
final DimFilter equalFilter;
if (druidExpression.isSimpleExtraction()) {
equalFilter = new SelectorDimFilter(
druidExpression.getSimpleExtraction().getColumn(),
NullHandling.defaultStringValue(),
druidExpression.getSimpleExtraction().getExtractionFn()
); // depends on control dependency: [if], data = [none]
} else {
final VirtualColumn virtualColumn = querySignature.getOrCreateVirtualColumnForExpression(
plannerContext,
druidExpression,
operand.getType().getSqlTypeName()
);
if (virtualColumn == null) {
return null; // depends on control dependency: [if], data = [none]
}
equalFilter = new SelectorDimFilter(
virtualColumn.getOutputName(),
NullHandling.defaultStringValue(),
null
); // depends on control dependency: [if], data = [none]
}
return kind == SqlKind.IS_NOT_NULL ? new NotDimFilter(equalFilter) : equalFilter; // depends on control dependency: [if], data = [none]
} else if (kind == SqlKind.EQUALS
|| kind == SqlKind.NOT_EQUALS
|| kind == SqlKind.GREATER_THAN
|| kind == SqlKind.GREATER_THAN_OR_EQUAL
|| kind == SqlKind.LESS_THAN
|| kind == SqlKind.LESS_THAN_OR_EQUAL) {
final List<RexNode> operands = ((RexCall) rexNode).getOperands();
Preconditions.checkState(operands.size() == 2, "WTF?! Expected 2 operands, got[%,d]", operands.size()); // depends on control dependency: [if], data = [none]
boolean flip = false;
RexNode lhs = operands.get(0);
RexNode rhs = operands.get(1);
if (lhs.getKind() == SqlKind.LITERAL && rhs.getKind() != SqlKind.LITERAL) {
// swap lhs, rhs
RexNode x = lhs;
lhs = rhs; // depends on control dependency: [if], data = [none]
rhs = x; // depends on control dependency: [if], data = [none]
flip = true; // depends on control dependency: [if], data = [none]
}
// Flip operator, maybe.
final SqlKind flippedKind;
if (flip) {
switch (kind) {
case EQUALS:
case NOT_EQUALS:
flippedKind = kind;
break;
case GREATER_THAN:
flippedKind = SqlKind.LESS_THAN;
break;
case GREATER_THAN_OR_EQUAL:
flippedKind = SqlKind.LESS_THAN_OR_EQUAL;
break;
case LESS_THAN:
flippedKind = SqlKind.GREATER_THAN;
break;
case LESS_THAN_OR_EQUAL:
flippedKind = SqlKind.GREATER_THAN_OR_EQUAL;
break;
default:
throw new ISE("WTF?! Kind[%s] not expected here", kind);
}
} else {
flippedKind = kind; // depends on control dependency: [if], data = [none]
}
// rhs must be a literal
if (rhs.getKind() != SqlKind.LITERAL) {
return null; // depends on control dependency: [if], data = [none]
}
// Translate lhs to a DruidExpression.
final DruidExpression lhsExpression = toDruidExpression(plannerContext, querySignature.getRowSignature(), lhs);
if (lhsExpression == null) {
return null; // depends on control dependency: [if], data = [none]
}
// Special handling for filters on FLOOR(__time TO granularity).
final Granularity queryGranularity = toQueryGranularity(lhsExpression, plannerContext.getExprMacroTable());
if (queryGranularity != null) {
// lhs is FLOOR(__time TO granularity); rhs must be a timestamp
final long rhsMillis = Calcites.calciteDateTimeLiteralToJoda(rhs, plannerContext.getTimeZone()).getMillis();
return buildTimeFloorFilter(ColumnHolder.TIME_COLUMN_NAME, queryGranularity, flippedKind, rhsMillis); // depends on control dependency: [if], data = [none]
}
final String column;
final ExtractionFn extractionFn;
if (lhsExpression.isSimpleExtraction()) {
column = lhsExpression.getSimpleExtraction().getColumn(); // depends on control dependency: [if], data = [none]
extractionFn = lhsExpression.getSimpleExtraction().getExtractionFn(); // depends on control dependency: [if], data = [none]
} else {
VirtualColumn virtualLhs = querySignature.getOrCreateVirtualColumnForExpression(
plannerContext,
lhsExpression,
lhs.getType().getSqlTypeName()
);
if (virtualLhs == null) {
return null; // depends on control dependency: [if], data = [none]
}
column = virtualLhs.getOutputName(); // depends on control dependency: [if], data = [none]
extractionFn = null; // depends on control dependency: [if], data = [none]
}
if (column.equals(ColumnHolder.TIME_COLUMN_NAME) && extractionFn instanceof TimeFormatExtractionFn) {
// Check if we can strip the extractionFn and convert the filter to a direct filter on __time.
// This allows potential conversion to query-level "intervals" later on, which is ideal for Druid queries.
final Granularity granularity = ExtractionFns.toQueryGranularity(extractionFn);
if (granularity != null) {
// lhs is FLOOR(__time TO granularity); rhs must be a timestamp
final long rhsMillis = Calcites.calciteDateTimeLiteralToJoda(rhs, plannerContext.getTimeZone()).getMillis();
final Interval rhsInterval = granularity.bucket(DateTimes.utc(rhsMillis));
// Is rhs aligned on granularity boundaries?
final boolean rhsAligned = rhsInterval.getStartMillis() == rhsMillis;
// Create a BoundRefKey that strips the extractionFn and compares __time as a number.
final BoundRefKey boundRefKey = new BoundRefKey(column, null, StringComparators.NUMERIC);
return getBoundTimeDimFilter(flippedKind, boundRefKey, rhsInterval, rhsAligned); // depends on control dependency: [if], data = [none]
}
}
final String val;
final RexLiteral rhsLiteral = (RexLiteral) rhs;
if (SqlTypeName.NUMERIC_TYPES.contains(rhsLiteral.getTypeName())) {
val = String.valueOf(RexLiteral.value(rhsLiteral)); // depends on control dependency: [if], data = [none]
} else if (SqlTypeName.CHAR_TYPES.contains(rhsLiteral.getTypeName())) {
val = String.valueOf(RexLiteral.stringValue(rhsLiteral)); // depends on control dependency: [if], data = [none]
} else if (SqlTypeName.TIMESTAMP == rhsLiteral.getTypeName() || SqlTypeName.DATE == rhsLiteral.getTypeName()) {
val = String.valueOf(
Calcites.calciteDateTimeLiteralToJoda(
rhsLiteral,
plannerContext.getTimeZone()
).getMillis()
); // depends on control dependency: [if], data = [none]
} else {
// Don't know how to filter on this kind of literal.
return null; // depends on control dependency: [if], data = [none]
}
// Numeric lhs needs a numeric comparison.
final StringComparator comparator = Calcites.getStringComparatorForSqlTypeName(lhs.getType().getSqlTypeName());
final BoundRefKey boundRefKey = new BoundRefKey(column, extractionFn, comparator);
final DimFilter filter;
// Always use BoundDimFilters, to simplify filter optimization later (it helps to remember the comparator).
switch (flippedKind) {
case EQUALS:
filter = Bounds.equalTo(boundRefKey, val);
break;
case NOT_EQUALS:
filter = new NotDimFilter(Bounds.equalTo(boundRefKey, val));
break;
case GREATER_THAN:
filter = Bounds.greaterThan(boundRefKey, val);
break;
case GREATER_THAN_OR_EQUAL:
filter = Bounds.greaterThanOrEqualTo(boundRefKey, val);
break;
case LESS_THAN:
filter = Bounds.lessThan(boundRefKey, val);
break;
case LESS_THAN_OR_EQUAL:
filter = Bounds.lessThanOrEqualTo(boundRefKey, val);
break;
default:
throw new IllegalStateException("WTF?! Shouldn't have got here...");
}
return filter;
} else if (rexNode instanceof RexCall) {
final SqlOperator operator = ((RexCall) rexNode).getOperator();
final SqlOperatorConversion conversion =
plannerContext.getOperatorTable().lookupOperatorConversion(operator);
if (conversion == null) {
return null;
} else {
DimFilter filter =
conversion.toDruidFilter(plannerContext, querySignature, rexNode);
if (filter != null) {
return filter;
}
return null;
}
}
return null;
} }
|
public class class_name {
public static void prune(List<Point3D_F64> cloud , int minNeighbors , double radius ) {
if( minNeighbors < 0 )
throw new IllegalArgumentException("minNeighbors must be >= 0");
NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64() );
NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();
nn.setPoints(cloud,false);
FastQueue<NnData<Point3D_F64>> results = new FastQueue(NnData.class,true);
// It will always find itself
minNeighbors += 1;
// distance is Euclidean squared
radius *= radius;
for( int i = cloud.size()-1; i >= 0; i-- ) {
search.findNearest(cloud.get(i),radius,minNeighbors,results);
if( results.size < minNeighbors ) {
cloud.remove(i);
}
}
} }
|
public class class_name {
public static void prune(List<Point3D_F64> cloud , int minNeighbors , double radius ) {
if( minNeighbors < 0 )
throw new IllegalArgumentException("minNeighbors must be >= 0");
NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64() );
NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();
nn.setPoints(cloud,false);
FastQueue<NnData<Point3D_F64>> results = new FastQueue(NnData.class,true);
// It will always find itself
minNeighbors += 1;
// distance is Euclidean squared
radius *= radius;
for( int i = cloud.size()-1; i >= 0; i-- ) {
search.findNearest(cloud.get(i),radius,minNeighbors,results); // depends on control dependency: [for], data = [i]
if( results.size < minNeighbors ) {
cloud.remove(i); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void delete(Object entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entity);
Key nativeKey = Marshaller.marshalKey(entityManager, entity);
nativeWriter.delete(nativeKey);
entityManager.executeEntityListeners(CallbackType.POST_DELETE, entity);
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
}
} }
|
public class class_name {
public void delete(Object entity) {
try {
entityManager.executeEntityListeners(CallbackType.PRE_DELETE, entity); // depends on control dependency: [try], data = [none]
Key nativeKey = Marshaller.marshalKey(entityManager, entity);
nativeWriter.delete(nativeKey); // depends on control dependency: [try], data = [none]
entityManager.executeEntityListeners(CallbackType.POST_DELETE, entity); // depends on control dependency: [try], data = [none]
} catch (DatastoreException exp) {
throw DatastoreUtils.wrap(exp);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure);
}
} }
|
public class class_name {
public static <T> void reverseForEach(List<T> list, Procedure<? super T> procedure)
{
if (!list.isEmpty())
{
ListIterate.forEach(list, list.size() - 1, 0, procedure); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Node getNode(int index)
{
if (index == 0)
{
return this;
}
int leftNodes = left.countNodes();
if (index <= leftNodes)
{
return left.getNode(index - 1);
}
else
{
return right.getNode(index - leftNodes - 1);
}
} }
|
public class class_name {
public Node getNode(int index)
{
if (index == 0)
{
return this; // depends on control dependency: [if], data = [none]
}
int leftNodes = left.countNodes();
if (index <= leftNodes)
{
return left.getNode(index - 1); // depends on control dependency: [if], data = [(index]
}
else
{
return right.getNode(index - leftNodes - 1); // depends on control dependency: [if], data = [(index]
}
} }
|
public class class_name {
private static void setJobConf(Object theObject, Configuration conf) {
//If JobConf and JobConfigurable are in classpath, AND
//theObject is of type JobConfigurable AND
//conf is of type JobConf then
//invoke configure on theObject
try {
Class<?> jobConfClass = conf.getClassByName("org.apache.hadoop.mapred.JobConf");
Class<?> jobConfigurableClass = conf.getClassByName("org.apache.hadoop.mapred.JobConfigurable");
if (jobConfClass.isAssignableFrom(conf.getClass())
&& jobConfigurableClass.isAssignableFrom(theObject.getClass())) {
Method configureMethod = jobConfigurableClass.getMethod("configure", jobConfClass);
configureMethod.invoke(theObject, conf);
}
} catch (ClassNotFoundException e) {
//JobConf/JobConfigurable not in classpath. no need to configure
} catch (Exception e) {
throw new RuntimeException("Error in configuring object", e);
}
} }
|
public class class_name {
private static void setJobConf(Object theObject, Configuration conf) {
//If JobConf and JobConfigurable are in classpath, AND
//theObject is of type JobConfigurable AND
//conf is of type JobConf then
//invoke configure on theObject
try {
Class<?> jobConfClass = conf.getClassByName("org.apache.hadoop.mapred.JobConf");
Class<?> jobConfigurableClass = conf.getClassByName("org.apache.hadoop.mapred.JobConfigurable");
if (jobConfClass.isAssignableFrom(conf.getClass())
&& jobConfigurableClass.isAssignableFrom(theObject.getClass())) {
Method configureMethod = jobConfigurableClass.getMethod("configure", jobConfClass);
configureMethod.invoke(theObject, conf);
}
} catch (ClassNotFoundException e) {
//JobConf/JobConfigurable not in classpath. no need to configure
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Error in configuring object", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public UpdateFlowEntitlementRequest withSubscribers(String... subscribers) {
if (this.subscribers == null) {
setSubscribers(new java.util.ArrayList<String>(subscribers.length));
}
for (String ele : subscribers) {
this.subscribers.add(ele);
}
return this;
} }
|
public class class_name {
public UpdateFlowEntitlementRequest withSubscribers(String... subscribers) {
if (this.subscribers == null) {
setSubscribers(new java.util.ArrayList<String>(subscribers.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : subscribers) {
this.subscribers.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
FieldRef getCurrentRenderee() {
FieldRef local = currentRendereeField;
if (local == null) {
local =
currentRendereeField =
FieldRef.createField(owner, CURRENT_RENDEREE_FIELD, SoyValueProvider.class);
}
return local;
} }
|
public class class_name {
FieldRef getCurrentRenderee() {
FieldRef local = currentRendereeField;
if (local == null) {
local =
currentRendereeField =
FieldRef.createField(owner, CURRENT_RENDEREE_FIELD, SoyValueProvider.class); // depends on control dependency: [if], data = [none]
}
return local;
} }
|
public class class_name {
public static String queryExpInfoPrintStr(String orderNo, String type) {
QueryHeard queryHeard = new QueryHeard(orderNo, type).invoke();
String host = queryHeard.getHost();
String path = queryHeard.getPath();
Map<String, String> headers = queryHeard.getHeaders();
Map<String, String> queries = queryHeard.getQueries();
ExpResultInfoVo dto = null;
try {
dto = getExpResultInfoDto(host, path, headers, queries);
StringBuilder str = new StringBuilder();
for (ExpResultInfoVo.ExpResultListVo.ExpResultListResultVo list : dto.getResult().getList()) {
str.append(list.getTime()).append(" ").append(list.getStatus()).append("\n");
}
return str.toString();
} catch (Exception e) {
}
return dto != null ? dto.getMsg() : null;
} }
|
public class class_name {
public static String queryExpInfoPrintStr(String orderNo, String type) {
QueryHeard queryHeard = new QueryHeard(orderNo, type).invoke();
String host = queryHeard.getHost();
String path = queryHeard.getPath();
Map<String, String> headers = queryHeard.getHeaders();
Map<String, String> queries = queryHeard.getQueries();
ExpResultInfoVo dto = null;
try {
dto = getExpResultInfoDto(host, path, headers, queries); // depends on control dependency: [try], data = [none]
StringBuilder str = new StringBuilder();
for (ExpResultInfoVo.ExpResultListVo.ExpResultListResultVo list : dto.getResult().getList()) {
str.append(list.getTime()).append(" ").append(list.getStatus()).append("\n"); // depends on control dependency: [for], data = [list]
}
return str.toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
return dto != null ? dto.getMsg() : null;
} }
|
public class class_name {
@Override
public Positions merge(Positions other) {
if (other instanceof SinglePosition) {
SinglePosition that = (SinglePosition) other;
return LinearPositions.builder().addSinglePosition(this).addSinglePosition(that).build();
} else {
return other.merge(this);
}
} }
|
public class class_name {
@Override
public Positions merge(Positions other) {
if (other instanceof SinglePosition) {
SinglePosition that = (SinglePosition) other;
return LinearPositions.builder().addSinglePosition(this).addSinglePosition(that).build(); // depends on control dependency: [if], data = [none]
} else {
return other.merge(this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void validateDate(String field, String min, String max, String errorKey, String errorMessage) {
// validateDate(field, Date.valueOf(min), Date.valueOf(max), errorKey, errorMessage); 为了兼容 64位 JDK
try {
SimpleDateFormat sdf = new SimpleDateFormat(getDatePattern());
validateDate(field, sdf.parse(min.trim()), sdf.parse(max.trim()), errorKey, errorMessage);
} catch (Exception e) {
addError(errorKey, errorMessage);
}
} }
|
public class class_name {
protected void validateDate(String field, String min, String max, String errorKey, String errorMessage) {
// validateDate(field, Date.valueOf(min), Date.valueOf(max), errorKey, errorMessage); 为了兼容 64位 JDK
try {
SimpleDateFormat sdf = new SimpleDateFormat(getDatePattern());
validateDate(field, sdf.parse(min.trim()), sdf.parse(max.trim()), errorKey, errorMessage);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
addError(errorKey, errorMessage);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
if (gadget_ == null) {
final ItemsSketch<T> sketch = ItemsSketch.getInstance(maxK_, comparator_);
return sketch.toByteArray(serDe);
}
return gadget_.toByteArray(serDe);
} }
|
public class class_name {
public byte[] toByteArray(final ArrayOfItemsSerDe<T> serDe) {
if (gadget_ == null) {
final ItemsSketch<T> sketch = ItemsSketch.getInstance(maxK_, comparator_);
return sketch.toByteArray(serDe); // depends on control dependency: [if], data = [none]
}
return gadget_.toByteArray(serDe);
} }
|
public class class_name {
private File expandScriptPlugin(final File file) throws IOException {
if (!cachedir.exists()) {
if (!cachedir.mkdirs()) {
log.warn("Unable to create cache dir: " + cachedir.getAbsolutePath());
}
}
final File jardir = getFileCacheDir();
if (!jardir.exists()) {
if (!jardir.mkdir()) {
log.warn("Unable to create cache dir for plugin: " + jardir.getAbsolutePath());
}
}
final String prefix = getFileBasename() + "/contents";
debug("Expand zip " + file.getAbsolutePath() + " to dir: " + jardir + ", prefix: " + prefix);
ZipUtil.extractZip(file.getAbsolutePath(), jardir, prefix, prefix + "/");
return jardir;
} }
|
public class class_name {
private File expandScriptPlugin(final File file) throws IOException {
if (!cachedir.exists()) {
if (!cachedir.mkdirs()) {
log.warn("Unable to create cache dir: " + cachedir.getAbsolutePath()); // depends on control dependency: [if], data = [none]
}
}
final File jardir = getFileCacheDir();
if (!jardir.exists()) {
if (!jardir.mkdir()) {
log.warn("Unable to create cache dir for plugin: " + jardir.getAbsolutePath());
}
}
final String prefix = getFileBasename() + "/contents";
debug("Expand zip " + file.getAbsolutePath() + " to dir: " + jardir + ", prefix: " + prefix);
ZipUtil.extractZip(file.getAbsolutePath(), jardir, prefix, prefix + "/");
return jardir;
} }
|
public class class_name {
public static boolean areTypesCompatible(Class[] typeArguments, List<Class> classToCompare) {
if (classToCompare.size() == 0) {
// in this case the type doesn't specify type arguments, so this is the equivalent of using Object
return true;
} else {
if (classToCompare.size() != typeArguments.length) {
return false;
} else {
for (int i = 0; i < classToCompare.size(); i++) {
Class left = classToCompare.get(i);
Class right = typeArguments[i];
if (right == Object.class) {
continue;
}
if (left != right && !left.isAssignableFrom(right)) {
return false;
}
}
}
}
return true;
} }
|
public class class_name {
public static boolean areTypesCompatible(Class[] typeArguments, List<Class> classToCompare) {
if (classToCompare.size() == 0) {
// in this case the type doesn't specify type arguments, so this is the equivalent of using Object
return true; // depends on control dependency: [if], data = [none]
} else {
if (classToCompare.size() != typeArguments.length) {
return false; // depends on control dependency: [if], data = [none]
} else {
for (int i = 0; i < classToCompare.size(); i++) {
Class left = classToCompare.get(i);
Class right = typeArguments[i];
if (right == Object.class) {
continue;
}
if (left != right && !left.isAssignableFrom(right)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
return true;
} }
|
public class class_name {
public Observable<ServiceResponse<Contacts>> setCertificateContactsWithServiceResponseAsync(String vaultBaseUrl, Contacts contacts) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (contacts == null) {
throw new IllegalArgumentException("Parameter contacts is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
Validator.validate(contacts);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.setCertificateContacts(contacts, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Contacts>>>() {
@Override
public Observable<ServiceResponse<Contacts>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Contacts> clientResponse = setCertificateContactsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Contacts>> setCertificateContactsWithServiceResponseAsync(String vaultBaseUrl, Contacts contacts) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (contacts == null) {
throw new IllegalArgumentException("Parameter contacts is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
Validator.validate(contacts);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.setCertificateContacts(contacts, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Contacts>>>() {
@Override
public Observable<ServiceResponse<Contacts>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Contacts> clientResponse = setCertificateContactsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static void assertSame(String message, Object expected, Object actual) {
if (expected == actual) {
return;
}
failNotSame(message, expected, actual);
} }
|
public class class_name {
public static void assertSame(String message, Object expected, Object actual) {
if (expected == actual) {
return; // depends on control dependency: [if], data = [none]
}
failNotSame(message, expected, actual);
} }
|
public class class_name {
public static void copy(Reader in, Writer out, int num_bytes)
throws IOException
{
if(num_bytes == 0)
return;
int n;
if(num_bytes < 0)
{
char[] b = new char[2048];
while((n = in.read(b, 0, b.length)) > 0)
out.write(b, 0, n);
}
else
{
int offset = 0;
char[] b = new char[num_bytes];
while(num_bytes > 0 && (n = in.read(b, offset, num_bytes)) > 0)
{
offset += n;
num_bytes -= n;
}
out.write(b);
}
} }
|
public class class_name {
public static void copy(Reader in, Writer out, int num_bytes)
throws IOException
{
if(num_bytes == 0)
return;
int n;
if(num_bytes < 0)
{
char[] b = new char[2048];
while((n = in.read(b, 0, b.length)) > 0)
out.write(b, 0, n);
}
else
{
int offset = 0;
char[] b = new char[num_bytes];
while(num_bytes > 0 && (n = in.read(b, offset, num_bytes)) > 0)
{
offset += n; // depends on control dependency: [while], data = [none]
num_bytes -= n; // depends on control dependency: [while], data = [none]
}
out.write(b);
}
} }
|
public class class_name {
public Map<String, String> getPropertiesAsMap(Properties properties) {
Map<String, String> result = new HashMap<String, String>();
for (String key : properties.stringPropertyNames()) {
result.put(key, properties.getProperty(key));
}
return result;
} }
|
public class class_name {
public Map<String, String> getPropertiesAsMap(Properties properties) {
Map<String, String> result = new HashMap<String, String>();
for (String key : properties.stringPropertyNames()) {
result.put(key, properties.getProperty(key)); // depends on control dependency: [for], data = [key]
}
return result;
} }
|
public class class_name {
public static Messaging getMessaging(final Jaxb2Marshaller jaxb2Marshaller, final WebServiceMessage message) {
SoapHeader soapHeader = ((SoapMessage) message).getSoapHeader();
if (soapHeader == null) {
throw new RuntimeException("The ebMS header is missing (no SOAP header found in SOAP request)");
}
Iterator<SoapHeaderElement> soapHeaderElementIterator = soapHeader.examineHeaderElements(MESSAGING_QNAME);
if (!soapHeaderElementIterator.hasNext()) {
throw new RuntimeException("The ebMS header is missing in SOAP header");
}
SoapHeaderElement incomingSoapHeaderElement = soapHeaderElementIterator.next();
try {
return (Messaging) jaxb2Marshaller.unmarshal(incomingSoapHeaderElement.getSource());
} catch (Exception e) {
throw new RuntimeException("The ebMs header failed to unmarshall");
}
} }
|
public class class_name {
public static Messaging getMessaging(final Jaxb2Marshaller jaxb2Marshaller, final WebServiceMessage message) {
SoapHeader soapHeader = ((SoapMessage) message).getSoapHeader();
if (soapHeader == null) {
throw new RuntimeException("The ebMS header is missing (no SOAP header found in SOAP request)");
}
Iterator<SoapHeaderElement> soapHeaderElementIterator = soapHeader.examineHeaderElements(MESSAGING_QNAME);
if (!soapHeaderElementIterator.hasNext()) {
throw new RuntimeException("The ebMS header is missing in SOAP header");
}
SoapHeaderElement incomingSoapHeaderElement = soapHeaderElementIterator.next();
try {
return (Messaging) jaxb2Marshaller.unmarshal(incomingSoapHeaderElement.getSource()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException("The ebMs header failed to unmarshall");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void attachHandler (
String protocol, Class<? extends URLStreamHandler> handlerClass)
{
// set up the factory.
if (_handlers == null) {
_handlers = new HashMap<String,Class<? extends URLStreamHandler>>();
// There are two ways to do this.
// Method 1, which is the only one that seems to work under
// Java Web Start, is to register a factory. This can throw an
// Error if another factory is already registered. We let that
// error bubble on back.
URL.setURLStreamHandlerFactory(new AttachableURLFactory());
// Method 2 seems like a better idea but doesn't work under
// Java Web Start. We add on a property that registers this
// very class as the handler for the resource property. It
// would be instantiated with Class.forName().
// (And I did check, it's not dasho that is preventing this
// from working under JWS, it's something else.)
/*
// dug up from java.net.URL
String HANDLER_PROP = "java.protocol.handler.pkgs";
String prop = System.getProperty(HANDLER_PROP, "");
if (!"".equals(prop)) {
prop += "|";
}
prop += "com.threerings";
System.setProperty(HANDLER_PROP, prop);
*/
}
_handlers.put(protocol.toLowerCase(), handlerClass);
} }
|
public class class_name {
public static void attachHandler (
String protocol, Class<? extends URLStreamHandler> handlerClass)
{
// set up the factory.
if (_handlers == null) {
_handlers = new HashMap<String,Class<? extends URLStreamHandler>>(); // depends on control dependency: [if], data = [none]
// There are two ways to do this.
// Method 1, which is the only one that seems to work under
// Java Web Start, is to register a factory. This can throw an
// Error if another factory is already registered. We let that
// error bubble on back.
URL.setURLStreamHandlerFactory(new AttachableURLFactory()); // depends on control dependency: [if], data = [none]
// Method 2 seems like a better idea but doesn't work under
// Java Web Start. We add on a property that registers this
// very class as the handler for the resource property. It
// would be instantiated with Class.forName().
// (And I did check, it's not dasho that is preventing this
// from working under JWS, it's something else.)
/*
// dug up from java.net.URL
String HANDLER_PROP = "java.protocol.handler.pkgs";
String prop = System.getProperty(HANDLER_PROP, "");
if (!"".equals(prop)) {
prop += "|";
}
prop += "com.threerings";
System.setProperty(HANDLER_PROP, prop);
*/
}
_handlers.put(protocol.toLowerCase(), handlerClass);
} }
|
public class class_name {
public static String escapeShell(final String s) {
if(null==s){
return s;
}
if (s.startsWith("'") && s.endsWith("'")) {
return s;
} else if (s.startsWith("\"") && s.endsWith("\"")) {
return s.replaceAll("([\\\\`])", "\\\\$1");
}
return s.replaceAll("([&><|;\\\\`])", "\\\\$1");
} }
|
public class class_name {
public static String escapeShell(final String s) {
if(null==s){
return s; // depends on control dependency: [if], data = [none]
}
if (s.startsWith("'") && s.endsWith("'")) {
return s; // depends on control dependency: [if], data = [none]
} else if (s.startsWith("\"") && s.endsWith("\"")) {
return s.replaceAll("([\\\\`])", "\\\\$1"); // depends on control dependency: [if], data = [none]
}
return s.replaceAll("([&><|;\\\\`])", "\\\\$1");
} }
|
public class class_name {
private AbstractBaseDTNode<I, D> updateDTTarget(TTTTransition<I, D> transition, boolean hard) {
if (transition.isTree()) {
return transition.getTreeTarget().dtLeaf;
}
AbstractBaseDTNode<I, D> dt = transition.getNonTreeTarget();
dt = dtree.sift(dt, transition.getAccessSequence(), hard);
transition.setNonTreeTarget(dt);
return dt;
} }
|
public class class_name {
private AbstractBaseDTNode<I, D> updateDTTarget(TTTTransition<I, D> transition, boolean hard) {
if (transition.isTree()) {
return transition.getTreeTarget().dtLeaf; // depends on control dependency: [if], data = [none]
}
AbstractBaseDTNode<I, D> dt = transition.getNonTreeTarget();
dt = dtree.sift(dt, transition.getAccessSequence(), hard);
transition.setNonTreeTarget(dt);
return dt;
} }
|
public class class_name {
public int getLastElementCollectionObjectCount(Object rowKey)
{
if (getElementCollectionCache().get(rowKey) == null)
{
log.debug("No element collection object map found in cache for Row key " + rowKey);
return -1;
}
else
{
Map<Object, String> elementCollectionMap = getElementCollectionCache().get(rowKey);
Collection<String> elementCollectionObjectNames = elementCollectionMap.values();
int max = 0;
for (String s : elementCollectionObjectNames)
{
String elementCollectionCountStr = s.substring(s.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) + 1);
int elementCollectionCount = 0;
try
{
elementCollectionCount = Integer.parseInt(elementCollectionCountStr);
}
catch (NumberFormatException e)
{
log.error("Invalid element collection Object name " + s);
throw new CacheException("Invalid element collection Object name " + s,e);
}
if (elementCollectionCount > max)
{
max = elementCollectionCount;
}
}
return max;
}
} }
|
public class class_name {
public int getLastElementCollectionObjectCount(Object rowKey)
{
if (getElementCollectionCache().get(rowKey) == null)
{
log.debug("No element collection object map found in cache for Row key " + rowKey);
// depends on control dependency: [if], data = [none]
return -1;
// depends on control dependency: [if], data = [none]
}
else
{
Map<Object, String> elementCollectionMap = getElementCollectionCache().get(rowKey);
Collection<String> elementCollectionObjectNames = elementCollectionMap.values();
int max = 0;
for (String s : elementCollectionObjectNames)
{
String elementCollectionCountStr = s.substring(s.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) + 1);
int elementCollectionCount = 0;
try
{
elementCollectionCount = Integer.parseInt(elementCollectionCountStr);
// depends on control dependency: [try], data = [none]
}
catch (NumberFormatException e)
{
log.error("Invalid element collection Object name " + s);
throw new CacheException("Invalid element collection Object name " + s,e);
}
// depends on control dependency: [catch], data = [none]
if (elementCollectionCount > max)
{
max = elementCollectionCount;
// depends on control dependency: [if], data = [none]
}
}
return max;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected Response getStubbedResponse(Object requestObject) {
// compatibility
String resp = getStubResponse(externalRequestToString(requestObject));
if (resp != null) {
Response oldStubbed = new Response();
oldStubbed.setObject(resp);
oldStubbed.setContent(externalResponseToString(resp));
return oldStubbed;
}
List<SimulationResponse> responses = new ArrayList<>();
for (Attribute attr : this.getAttributes()) {
if (attr.getAttributeName().startsWith(WorkAttributeConstant.SIMULATION_RESPONSE)) {
SimulationResponse r = new SimulationResponse(attr.getAttributeValue());
responses.add(r);
}
}
String unfilteredResponse = null;
String returnCode = null;
if (responses.size() == 0) {
unfilteredResponse = null;
}
else if (responses.size() == 1) {
unfilteredResponse = responses.get(0).getResponse();
returnCode = responses.get(0).getReturnCode();
}
else { // randomly pick a response based on chances
int total_chances = 0;
for (SimulationResponse r : responses) {
total_chances += r.getChance().intValue();
}
if (random == null)
random = new Random();
int ran = random.nextInt(total_chances);
int k = 0;
for (SimulationResponse r : responses) {
if (ran >= k && ran < k + r.getChance().intValue()) {
unfilteredResponse = r.getResponse();
break;
}
k += r.getChance().intValue();
}
}
Response response = new Response();
String filtered = filter(unfilteredResponse, requestObject);
response.setObject(filtered);
response.setContent(filtered);
if (returnCode != null) {
try {
response.setStatusCode(Integer.parseInt(returnCode));
}
catch (NumberFormatException ex) {
}
}
return response;
} }
|
public class class_name {
protected Response getStubbedResponse(Object requestObject) {
// compatibility
String resp = getStubResponse(externalRequestToString(requestObject));
if (resp != null) {
Response oldStubbed = new Response();
oldStubbed.setObject(resp); // depends on control dependency: [if], data = [(resp]
oldStubbed.setContent(externalResponseToString(resp)); // depends on control dependency: [if], data = [(resp]
return oldStubbed; // depends on control dependency: [if], data = [none]
}
List<SimulationResponse> responses = new ArrayList<>();
for (Attribute attr : this.getAttributes()) {
if (attr.getAttributeName().startsWith(WorkAttributeConstant.SIMULATION_RESPONSE)) {
SimulationResponse r = new SimulationResponse(attr.getAttributeValue());
responses.add(r); // depends on control dependency: [if], data = [none]
}
}
String unfilteredResponse = null;
String returnCode = null;
if (responses.size() == 0) {
unfilteredResponse = null; // depends on control dependency: [if], data = [none]
}
else if (responses.size() == 1) {
unfilteredResponse = responses.get(0).getResponse(); // depends on control dependency: [if], data = [none]
returnCode = responses.get(0).getReturnCode(); // depends on control dependency: [if], data = [none]
}
else { // randomly pick a response based on chances
int total_chances = 0;
for (SimulationResponse r : responses) {
total_chances += r.getChance().intValue(); // depends on control dependency: [for], data = [r]
}
if (random == null)
random = new Random();
int ran = random.nextInt(total_chances);
int k = 0;
for (SimulationResponse r : responses) {
if (ran >= k && ran < k + r.getChance().intValue()) {
unfilteredResponse = r.getResponse(); // depends on control dependency: [if], data = [none]
break;
}
k += r.getChance().intValue(); // depends on control dependency: [for], data = [r]
}
}
Response response = new Response();
String filtered = filter(unfilteredResponse, requestObject);
response.setObject(filtered);
response.setContent(filtered);
if (returnCode != null) {
try {
response.setStatusCode(Integer.parseInt(returnCode)); // depends on control dependency: [try], data = [none]
}
catch (NumberFormatException ex) {
} // depends on control dependency: [catch], data = [none]
}
return response;
} }
|
public class class_name {
public boolean isFloating(ICalProperty property) {
if (containsIdentity(floatingProperties, property)) {
return true;
}
if (propertyTimezones.containsKey(property)) {
return false;
}
return globalFloatingTime;
} }
|
public class class_name {
public boolean isFloating(ICalProperty property) {
if (containsIdentity(floatingProperties, property)) {
return true; // depends on control dependency: [if], data = [none]
}
if (propertyTimezones.containsKey(property)) {
return false; // depends on control dependency: [if], data = [none]
}
return globalFloatingTime;
} }
|
public class class_name {
void addGlobalUniqueProperties(Set<PropertyColumn> properties) {
for (PropertyColumn property : properties) {
property.addToGlobalUniqueIndexes(this);
}
this.properties = properties;
} }
|
public class class_name {
void addGlobalUniqueProperties(Set<PropertyColumn> properties) {
for (PropertyColumn property : properties) {
property.addToGlobalUniqueIndexes(this); // depends on control dependency: [for], data = [property]
}
this.properties = properties;
} }
|
public class class_name {
public void stop(String name)
{
GVRAnimator anim = findAnimation(name);
if (anim != null)
{
mIsRunning = false;
anim.stop();
}
} }
|
public class class_name {
public void stop(String name)
{
GVRAnimator anim = findAnimation(name);
if (anim != null)
{
mIsRunning = false; // depends on control dependency: [if], data = [none]
anim.stop(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void checkForTransaction() throws SystemException {
try {
Transactions transactions = repositoryEnvironment.getTransactions();
javax.transaction.Transaction txn = transactions.getTransactionManager().getTransaction();
if (txn != null && txn.getStatus() == Status.STATUS_ACTIVE) {
WorkspaceCache workspaceCache = getWorkspace();
if (workspaceCache instanceof TransactionalWorkspaceCache) {
// we're already inside a transaction and have a tx workspace cache set
return;
}
// There is an active transaction, so we need a transaction-specific workspace cache ...
setWorkspaceCache(txWorkspaceCaches.getTransactionalCache(workspaceCache));
// only register the function if there's an active ModeShape transaction because we need to run the
// function *only after* the persistent storage has been updated
// if there isn't an active ModeShape transaction, one will become active later during "save"
// otherwise, "save" is never called meaning this cache should be discarded
Transaction modeshapeTx = transactions.currentTransaction();
if (modeshapeTx != null) {
String txId = modeshapeTx.id();
Map<String, Transactions.TransactionFunction> funcsByTxId =
COMPLETE_FUNCTION_BY_TX_AND_WS.computeIfAbsent(txId, transactionId -> new ConcurrentHashMap<>());
funcsByTxId.computeIfAbsent(workspaceName(), wsName -> {
Transactions.TransactionFunction completeFunction = () -> completeTransaction(txId, wsName);
modeshapeTx.uponCompletion(completeFunction);
return completeFunction;
});
}
} else {
// There is no active transaction, so just use the shared workspace cache ...
// reset the ws cache to the shared (global one)
setWorkspaceCache(sharedWorkspaceCache());
}
} catch (SystemException e) {
logger.error(e, JcrI18n.errorDeterminingCurrentTransactionAssumingNone, workspaceName(), e.getMessage());
throw e;
}
} }
|
public class class_name {
@Override
public void checkForTransaction() throws SystemException {
try {
Transactions transactions = repositoryEnvironment.getTransactions();
javax.transaction.Transaction txn = transactions.getTransactionManager().getTransaction();
if (txn != null && txn.getStatus() == Status.STATUS_ACTIVE) {
WorkspaceCache workspaceCache = getWorkspace();
if (workspaceCache instanceof TransactionalWorkspaceCache) {
// we're already inside a transaction and have a tx workspace cache set
return; // depends on control dependency: [if], data = [none]
}
// There is an active transaction, so we need a transaction-specific workspace cache ...
setWorkspaceCache(txWorkspaceCaches.getTransactionalCache(workspaceCache));
// only register the function if there's an active ModeShape transaction because we need to run the
// function *only after* the persistent storage has been updated
// if there isn't an active ModeShape transaction, one will become active later during "save"
// otherwise, "save" is never called meaning this cache should be discarded
Transaction modeshapeTx = transactions.currentTransaction();
if (modeshapeTx != null) {
String txId = modeshapeTx.id();
Map<String, Transactions.TransactionFunction> funcsByTxId =
COMPLETE_FUNCTION_BY_TX_AND_WS.computeIfAbsent(txId, transactionId -> new ConcurrentHashMap<>());
funcsByTxId.computeIfAbsent(workspaceName(), wsName -> {
Transactions.TransactionFunction completeFunction = () -> completeTransaction(txId, wsName);
modeshapeTx.uponCompletion(completeFunction);
return completeFunction;
}); // depends on control dependency: [if], data = [none]
}
} else {
// There is no active transaction, so just use the shared workspace cache ...
// reset the ws cache to the shared (global one)
setWorkspaceCache(sharedWorkspaceCache());
}
} catch (SystemException e) {
logger.error(e, JcrI18n.errorDeterminingCurrentTransactionAssumingNone, workspaceName(), e.getMessage());
throw e;
}
} }
|
public class class_name {
@Override
public synchronized void executionComplete( AsyncTaskProcessorThread thread )
{
// If tasks are waiting, unqueue them
if (!taskQueue.isEmpty())
{
AsyncTask nextTask = taskQueue.removeFirst();
if (nextTask.isMergeable())
taskSet.remove(nextTask);
thread.setTask(nextTask);
thread.execute();
}
else
threadPool.release(thread); // Release the thread
} }
|
public class class_name {
@Override
public synchronized void executionComplete( AsyncTaskProcessorThread thread )
{
// If tasks are waiting, unqueue them
if (!taskQueue.isEmpty())
{
AsyncTask nextTask = taskQueue.removeFirst();
if (nextTask.isMergeable())
taskSet.remove(nextTask);
thread.setTask(nextTask); // depends on control dependency: [if], data = [none]
thread.execute(); // depends on control dependency: [if], data = [none]
}
else
threadPool.release(thread); // Release the thread
} }
|
public class class_name {
@Override
public ResourceBundle newBundle(final String aBaseName, final Locale aLocale, final String aFormat,
final ClassLoader aClassLoader, final boolean aReload) throws IllegalAccessException,
InstantiationException, IOException {
ResourceBundle bundle = null;
checkForNull(aBaseName, aLocale, aFormat, aClassLoader);
if (aFormat.equals(FORMAT)) {
final String bundleName = toBundleName(aBaseName, aLocale);
final String resourceName = toResourceName(bundleName, aFormat);
if (aReload) {
final URL url = aClassLoader.getResource(resourceName);
if (url != null) {
final URLConnection connection = url.openConnection();
connection.setUseCaches(false);
bundle = makeBundle(connection.getInputStream());
}
} else {
final InputStream bundleStream = aClassLoader.getResourceAsStream(resourceName);
bundle = makeBundle(bundleStream);
}
}
return bundle;
} }
|
public class class_name {
@Override
public ResourceBundle newBundle(final String aBaseName, final Locale aLocale, final String aFormat,
final ClassLoader aClassLoader, final boolean aReload) throws IllegalAccessException,
InstantiationException, IOException {
ResourceBundle bundle = null;
checkForNull(aBaseName, aLocale, aFormat, aClassLoader);
if (aFormat.equals(FORMAT)) {
final String bundleName = toBundleName(aBaseName, aLocale);
final String resourceName = toResourceName(bundleName, aFormat);
if (aReload) {
final URL url = aClassLoader.getResource(resourceName);
if (url != null) {
final URLConnection connection = url.openConnection();
connection.setUseCaches(false); // depends on control dependency: [if], data = [none]
bundle = makeBundle(connection.getInputStream()); // depends on control dependency: [if], data = [none]
}
} else {
final InputStream bundleStream = aClassLoader.getResourceAsStream(resourceName);
bundle = makeBundle(bundleStream);
}
}
return bundle;
} }
|
public class class_name {
public void marshall(UpdateSimulationApplicationRequest updateSimulationApplicationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSimulationApplicationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSimulationApplicationRequest.getApplication(), APPLICATION_BINDING);
protocolMarshaller.marshall(updateSimulationApplicationRequest.getSources(), SOURCES_BINDING);
protocolMarshaller.marshall(updateSimulationApplicationRequest.getSimulationSoftwareSuite(), SIMULATIONSOFTWARESUITE_BINDING);
protocolMarshaller.marshall(updateSimulationApplicationRequest.getRobotSoftwareSuite(), ROBOTSOFTWARESUITE_BINDING);
protocolMarshaller.marshall(updateSimulationApplicationRequest.getRenderingEngine(), RENDERINGENGINE_BINDING);
protocolMarshaller.marshall(updateSimulationApplicationRequest.getCurrentRevisionId(), CURRENTREVISIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateSimulationApplicationRequest updateSimulationApplicationRequest, ProtocolMarshaller protocolMarshaller) {
if (updateSimulationApplicationRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateSimulationApplicationRequest.getApplication(), APPLICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSimulationApplicationRequest.getSources(), SOURCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSimulationApplicationRequest.getSimulationSoftwareSuite(), SIMULATIONSOFTWARESUITE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSimulationApplicationRequest.getRobotSoftwareSuite(), ROBOTSOFTWARESUITE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSimulationApplicationRequest.getRenderingEngine(), RENDERINGENGINE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateSimulationApplicationRequest.getCurrentRevisionId(), CURRENTREVISIONID_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 addGroup(Group section) {
if (section != null) {
if (section.isAnyAgent()) {
if (this.defaultSection == null) {
this.defaultSection = section;
} else {
this.defaultSection.getAccessList().importAccess(section.getAccessList());
}
} else {
Group exact = findExactSection(section);
if (exact == null) {
groups.add(section);
} else {
exact.getAccessList().importAccess(section.getAccessList());
}
}
}
} }
|
public class class_name {
public void addGroup(Group section) {
if (section != null) {
if (section.isAnyAgent()) {
if (this.defaultSection == null) {
this.defaultSection = section; // depends on control dependency: [if], data = [none]
} else {
this.defaultSection.getAccessList().importAccess(section.getAccessList()); // depends on control dependency: [if], data = [none]
}
} else {
Group exact = findExactSection(section);
if (exact == null) {
groups.add(section); // depends on control dependency: [if], data = [none]
} else {
exact.getAccessList().importAccess(section.getAccessList()); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class })
public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array) {
if (condition) {
Check.noNullElements(array);
}
} }
|
public class class_name {
@ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class })
public static <T> void noNullElements(final boolean condition, @Nonnull final T[] array) {
if (condition) {
Check.noNullElements(array); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Pure
public Point2d getPosition2D() {
final Point1d p1d5 = getPosition1D();
if (p1d5 != null) {
final Point2d pos = new Point2d();
p1d5.getSegment().projectsOnPlane(
p1d5.getCurvilineCoordinate(),
p1d5.getLateralDistance(),
pos,
null);
return pos;
}
return null;
} }
|
public class class_name {
@Pure
public Point2d getPosition2D() {
final Point1d p1d5 = getPosition1D();
if (p1d5 != null) {
final Point2d pos = new Point2d();
p1d5.getSegment().projectsOnPlane(
p1d5.getCurvilineCoordinate(),
p1d5.getLateralDistance(),
pos,
null); // depends on control dependency: [if], data = [none]
return pos; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Deprecated
public RequestTemplate append(CharSequence value) {
/* proxy to url */
if (this.uriTemplate != null) {
return this.uri(value.toString(), true);
}
return this.uri(value.toString());
} }
|
public class class_name {
@Deprecated
public RequestTemplate append(CharSequence value) {
/* proxy to url */
if (this.uriTemplate != null) {
return this.uri(value.toString(), true); // depends on control dependency: [if], data = [none]
}
return this.uri(value.toString());
} }
|
public class class_name {
private void restartBrokenTransfers(CacheTopology cacheTopology, IntSet addedSegments) {
Set<Address> members = new HashSet<>(cacheTopology.getReadConsistentHash().getMembers());
synchronized (transferMapsLock) {
for (Iterator<Map.Entry<Address, List<InboundTransferTask>>> it = transfersBySource.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<Address, List<InboundTransferTask>> entry = it.next();
Address source = entry.getKey();
if (!members.contains(source)) {
if (trace) {
log.tracef("Removing inbound transfers from source %s for cache %s", source, cacheName);
}
List<InboundTransferTask> inboundTransfers = entry.getValue();
it.remove();
for (InboundTransferTask inboundTransfer : inboundTransfers) {
// these segments will be restarted if they are still in new write CH
if (trace) {
log.tracef("Removing inbound transfers from node %s for segments %s", source, inboundTransfer.getSegments());
}
IntSet unfinishedSegments = inboundTransfer.getUnfinishedSegments();
inboundTransfer.cancel();
addedSegments.addAll(unfinishedSegments);
transfersBySegment.keySet().removeAll(unfinishedSegments);
}
}
}
// exclude those that are already in progress from a valid source
addedSegments.removeAll(transfersBySegment.keySet());
}
} }
|
public class class_name {
private void restartBrokenTransfers(CacheTopology cacheTopology, IntSet addedSegments) {
Set<Address> members = new HashSet<>(cacheTopology.getReadConsistentHash().getMembers());
synchronized (transferMapsLock) {
for (Iterator<Map.Entry<Address, List<InboundTransferTask>>> it = transfersBySource.entrySet().iterator(); it.hasNext(); ) {
Map.Entry<Address, List<InboundTransferTask>> entry = it.next();
Address source = entry.getKey();
if (!members.contains(source)) {
if (trace) {
log.tracef("Removing inbound transfers from source %s for cache %s", source, cacheName); // depends on control dependency: [if], data = [none]
}
List<InboundTransferTask> inboundTransfers = entry.getValue();
it.remove(); // depends on control dependency: [if], data = [none]
for (InboundTransferTask inboundTransfer : inboundTransfers) {
// these segments will be restarted if they are still in new write CH
if (trace) {
log.tracef("Removing inbound transfers from node %s for segments %s", source, inboundTransfer.getSegments()); // depends on control dependency: [if], data = [none]
}
IntSet unfinishedSegments = inboundTransfer.getUnfinishedSegments();
inboundTransfer.cancel(); // depends on control dependency: [for], data = [inboundTransfer]
addedSegments.addAll(unfinishedSegments); // depends on control dependency: [for], data = [none]
transfersBySegment.keySet().removeAll(unfinishedSegments); // depends on control dependency: [for], data = [none]
}
}
}
// exclude those that are already in progress from a valid source
addedSegments.removeAll(transfersBySegment.keySet());
}
} }
|
public class class_name {
private void readKeyStore(Configuration conf) throws IOException, FormatNotUnderstoodException {
if ((this.hocr.getCryptKeystoreFile()!=null) && (!"".equals(this.hocr.getCryptKeystoreFile()))) {
LOG.info("Using keystore to obtain credentials instead of passwords");
HadoopKeyStoreManager hksm = new HadoopKeyStoreManager(conf);
try {
hksm.openKeyStore(new Path(this.hocr.getCryptKeystoreFile()), this.hocr.getCryptKeystoreType(), this.hocr.getCryptKeystorePassword());
String pw="";
if ((this.hocr.getCryptKeystoreAlias()!=null) && (!"".equals(this.hocr.getCryptKeystoreAlias()))) {
pw=hksm.getPassword(this.hocr.getCryptKeystoreAlias(), this.hocr.getCryptKeystorePassword());
} else {
pw=hksm.getPassword(this.hocr.getFileName(), this.hocr.getCryptKeystorePassword());
}
this.hocr.setPassword(pw);
} catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IllegalArgumentException | UnrecoverableEntryException | InvalidKeySpecException e) {
LOG.error("Cannopt read keystore. Exception: ",e);
throw new FormatNotUnderstoodException("Cannot read keystore to obtain credentials to access encrypted documents "+e);
}
}
} }
|
public class class_name {
private void readKeyStore(Configuration conf) throws IOException, FormatNotUnderstoodException {
if ((this.hocr.getCryptKeystoreFile()!=null) && (!"".equals(this.hocr.getCryptKeystoreFile()))) {
LOG.info("Using keystore to obtain credentials instead of passwords");
HadoopKeyStoreManager hksm = new HadoopKeyStoreManager(conf);
try {
hksm.openKeyStore(new Path(this.hocr.getCryptKeystoreFile()), this.hocr.getCryptKeystoreType(), this.hocr.getCryptKeystorePassword());
String pw="";
if ((this.hocr.getCryptKeystoreAlias()!=null) && (!"".equals(this.hocr.getCryptKeystoreAlias()))) {
pw=hksm.getPassword(this.hocr.getCryptKeystoreAlias(), this.hocr.getCryptKeystorePassword()); // depends on control dependency: [if], data = [none]
} else {
pw=hksm.getPassword(this.hocr.getFileName(), this.hocr.getCryptKeystorePassword()); // depends on control dependency: [if], data = [none]
}
this.hocr.setPassword(pw);
} catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IllegalArgumentException | UnrecoverableEntryException | InvalidKeySpecException e) {
LOG.error("Cannopt read keystore. Exception: ",e);
throw new FormatNotUnderstoodException("Cannot read keystore to obtain credentials to access encrypted documents "+e);
}
}
} }
|
public class class_name {
public static Date getDayStartDate(Date date)
{
if (date != null)
{
Calendar cal = popCalendar(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
date = cal.getTime();
pushCalendar(cal);
}
return (date);
} }
|
public class class_name {
public static Date getDayStartDate(Date date)
{
if (date != null)
{
Calendar cal = popCalendar(date);
cal.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cal.set(Calendar.MILLISECOND, 0); // depends on control dependency: [if], data = [none]
date = cal.getTime(); // depends on control dependency: [if], data = [none]
pushCalendar(cal); // depends on control dependency: [if], data = [none]
}
return (date);
} }
|
public class class_name {
private boolean insertGap() throws StructureException,
RefinerFailedException {
// Let gaps only if the repeat is larger than the minimum length
if (repeatCore <= Lmin)
return false;
// Select residue by maximum distance
updateMultipleAlignment();
Matrix residueDistances = MultipleAlignmentTools
.getAverageResidueDistances(msa);
double maxDist = Double.MIN_VALUE;
int su = 0;
int res = 0;
for (int col = 0; col < length; col++) {
for (int s = 0; s < order; s++) {
if (residueDistances.get(s, col) != -1) {
if (residueDistances.get(s, col) > maxDist) {
// geometric distribution
if (rnd.nextDouble() > 0.5) {
su = s;
res = col;
maxDist = residueDistances.get(s, col);
}
}
}
}
}
// Insert the gap at the position
Integer residueL = block.get(su).get(res);
if (residueL != null) {
freePool.add(residueL);
Collections.sort(freePool);
} else
return false; // If there was a gap already in the position.
block.get(su).set(res, null);
checkGaps();
return true;
} }
|
public class class_name {
private boolean insertGap() throws StructureException,
RefinerFailedException {
// Let gaps only if the repeat is larger than the minimum length
if (repeatCore <= Lmin)
return false;
// Select residue by maximum distance
updateMultipleAlignment();
Matrix residueDistances = MultipleAlignmentTools
.getAverageResidueDistances(msa);
double maxDist = Double.MIN_VALUE;
int su = 0;
int res = 0;
for (int col = 0; col < length; col++) {
for (int s = 0; s < order; s++) {
if (residueDistances.get(s, col) != -1) {
if (residueDistances.get(s, col) > maxDist) {
// geometric distribution
if (rnd.nextDouble() > 0.5) {
su = s; // depends on control dependency: [if], data = [none]
res = col; // depends on control dependency: [if], data = [none]
maxDist = residueDistances.get(s, col); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// Insert the gap at the position
Integer residueL = block.get(su).get(res);
if (residueL != null) {
freePool.add(residueL);
Collections.sort(freePool);
} else
return false; // If there was a gap already in the position.
block.get(su).set(res, null);
checkGaps();
return true;
} }
|
public class class_name {
public void marshall(ListTagsRequest listTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (listTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTagsRequest.getResource(), RESOURCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListTagsRequest listTagsRequest, ProtocolMarshaller protocolMarshaller) {
if (listTagsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTagsRequest.getResource(), RESOURCE_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 marshall(ListUploadsRequest listUploadsRequest, ProtocolMarshaller protocolMarshaller) {
if (listUploadsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUploadsRequest.getArn(), ARN_BINDING);
protocolMarshaller.marshall(listUploadsRequest.getType(), TYPE_BINDING);
protocolMarshaller.marshall(listUploadsRequest.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(ListUploadsRequest listUploadsRequest, ProtocolMarshaller protocolMarshaller) {
if (listUploadsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listUploadsRequest.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUploadsRequest.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listUploadsRequest.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 void appendLine( String line) {
if (count >= nlines) {
try {
int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
int offset = ta.getLineEndOffset( remove);
ta.replaceRange( "", 0, offset);
} catch (Exception e) {
log.error("Problem in TextHistoryPane", e);
}
count = nlines - removeIncr;
}
ta.append(line);
ta.append("\n");
count++;
// scroll to end
ta.setCaretPosition(ta.getText().length());
} }
|
public class class_name {
public void appendLine( String line) {
if (count >= nlines) {
try {
int remove = Math.max(removeIncr, count - nlines); // nlines may have changed
int offset = ta.getLineEndOffset( remove);
ta.replaceRange( "", 0, offset); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Problem in TextHistoryPane", e);
} // depends on control dependency: [catch], data = [none]
count = nlines - removeIncr; // depends on control dependency: [if], data = [none]
}
ta.append(line);
ta.append("\n");
count++;
// scroll to end
ta.setCaretPosition(ta.getText().length());
} }
|
public class class_name {
private boolean matchesPrimitive(Class<?> targetType, Class<?> valueType) {
if (!targetType.isPrimitive()) {
return false;
}
try {
// see if there is a "TYPE" field. This is present for primitive wrappers.
Field typeField = valueType.getField("TYPE");
Object primitiveValueType = typeField.get(valueType);
if (targetType == primitiveValueType) {
return true;
}
} catch (NoSuchFieldException e) {
// lacking the TYPE field is a good sign that we're not working with a primitive wrapper.
// we can't match for compatibility
} catch (IllegalAccessException e) {
// an inaccessible TYPE field is a good sign that we're not working with a primitive wrapper.
// nothing to do. we can't match for compatibility
}
return false;
} }
|
public class class_name {
private boolean matchesPrimitive(Class<?> targetType, Class<?> valueType) {
if (!targetType.isPrimitive()) {
return false; // depends on control dependency: [if], data = [none]
}
try {
// see if there is a "TYPE" field. This is present for primitive wrappers.
Field typeField = valueType.getField("TYPE");
Object primitiveValueType = typeField.get(valueType);
if (targetType == primitiveValueType) {
return true; // depends on control dependency: [if], data = [none]
}
} catch (NoSuchFieldException e) {
// lacking the TYPE field is a good sign that we're not working with a primitive wrapper.
// we can't match for compatibility
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
// an inaccessible TYPE field is a good sign that we're not working with a primitive wrapper.
// nothing to do. we can't match for compatibility
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public Set<GrantedAuthority> convertGroupsToGrantedAuthorities(final List<UserGroup> groups) {
// Map the authority information to one or more GrantedAuthority's and add it to mappedAuthorities
final Set<GrantedAuthority> mappedAuthorities = groups.stream().filter(this::isValidUserGroupToGrantAuthority)
.map(userGroup -> new SimpleGrantedAuthority(DEFAULT_ROLE_PREFIX + userGroup.getDisplayName()))
.collect(Collectors.toCollection(LinkedHashSet::new));
if (mappedAuthorities.isEmpty()) {
mappedAuthorities.add(DEFAULT_AUTHORITY);
}
return mappedAuthorities;
} }
|
public class class_name {
public Set<GrantedAuthority> convertGroupsToGrantedAuthorities(final List<UserGroup> groups) {
// Map the authority information to one or more GrantedAuthority's and add it to mappedAuthorities
final Set<GrantedAuthority> mappedAuthorities = groups.stream().filter(this::isValidUserGroupToGrantAuthority)
.map(userGroup -> new SimpleGrantedAuthority(DEFAULT_ROLE_PREFIX + userGroup.getDisplayName()))
.collect(Collectors.toCollection(LinkedHashSet::new));
if (mappedAuthorities.isEmpty()) {
mappedAuthorities.add(DEFAULT_AUTHORITY); // depends on control dependency: [if], data = [none]
}
return mappedAuthorities;
} }
|
public class class_name {
public void release(T item) {
HashMap<String,Object> keys = getKeys(item);
synchronized( this ) {
for( String key : order ) {
ConcurrentCache<Object,T> cache = caches.get(key);
cache.remove(keys.get(key));
}
}
} }
|
public class class_name {
public void release(T item) {
HashMap<String,Object> keys = getKeys(item);
synchronized( this ) {
for( String key : order ) {
ConcurrentCache<Object,T> cache = caches.get(key);
cache.remove(keys.get(key)); // depends on control dependency: [for], data = [key]
}
}
} }
|
public class class_name {
@Override
public <T> StAXProcessor<List<T>> listProcessorForClass(final Class<T> clazz) {
@SuppressWarnings("unchecked")
// listProcessors is private and only contains IdolAnnotationsListProcessor
final IdolAnnotationsListProcessor<T> processor = (IdolAnnotationsListProcessor<T>) listProcessors.get(clazz);
if (processor != null) {
return processor;
} else {
final IdolAnnotationsListProcessor<T> newProcessor = new IdolAnnotationsListProcessor<>(clazz, this, properties.get());
listProcessors.putIfAbsent(clazz, newProcessor);
return newProcessor;
}
} }
|
public class class_name {
@Override
public <T> StAXProcessor<List<T>> listProcessorForClass(final Class<T> clazz) {
@SuppressWarnings("unchecked")
// listProcessors is private and only contains IdolAnnotationsListProcessor
final IdolAnnotationsListProcessor<T> processor = (IdolAnnotationsListProcessor<T>) listProcessors.get(clazz);
if (processor != null) {
return processor; // depends on control dependency: [if], data = [none]
} else {
final IdolAnnotationsListProcessor<T> newProcessor = new IdolAnnotationsListProcessor<>(clazz, this, properties.get());
listProcessors.putIfAbsent(clazz, newProcessor); // depends on control dependency: [if], data = [none]
return newProcessor; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String computeResourceBundleName() {
Logger logger = this;
while (logger != null) {
String name = logger.getResourceBundleName();
if (name != null) {
return name;
}
logger = logger.getParent();
}
return null;
} }
|
public class class_name {
private String computeResourceBundleName() {
Logger logger = this;
while (logger != null) {
String name = logger.getResourceBundleName();
if (name != null) {
return name; // depends on control dependency: [if], data = [none]
}
logger = logger.getParent(); // depends on control dependency: [while], data = [none]
}
return null;
} }
|
public class class_name {
@Override
public EClass getServiceParameter() {
if (serviceParameterEClass == null) {
serviceParameterEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(65);
}
return serviceParameterEClass;
} }
|
public class class_name {
@Override
public EClass getServiceParameter() {
if (serviceParameterEClass == null) {
serviceParameterEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(65);
// depends on control dependency: [if], data = [none]
}
return serviceParameterEClass;
} }
|
public class class_name {
private int[] readTypes(long typeIdsOff, int typeIdsSize) {
Buffers.position(buffer, typeIdsOff);
int[] typeIds = new int[typeIdsSize];
for (int i = 0; i < typeIdsSize; i++) {
typeIds[i] = (int) Buffers.readUInt(buffer);
}
return typeIds;
} }
|
public class class_name {
private int[] readTypes(long typeIdsOff, int typeIdsSize) {
Buffers.position(buffer, typeIdsOff);
int[] typeIds = new int[typeIdsSize];
for (int i = 0; i < typeIdsSize; i++) {
typeIds[i] = (int) Buffers.readUInt(buffer); // depends on control dependency: [for], data = [i]
}
return typeIds;
} }
|
public class class_name {
public static URI applyDefaultPorts(URI uri) throws URISyntaxException {
// contains WSS or WS...
if (containsWebSocketScheme(uri)) {
if (uri.getPort() == -1) {
if (WS_SCHEME.equals(uri.getScheme())) {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 80, uri.getPath(), uri.getQuery(), uri.getFragment());
} else {
// must be WSS...
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 443, uri.getPath(), uri.getQuery(), uri.getFragment());
}
}
// contains a custom port:
return uri;
}
throw new IllegalArgumentException("Can not apply WebSocket ports to invalid URI scheme");
} }
|
public class class_name {
public static URI applyDefaultPorts(URI uri) throws URISyntaxException {
// contains WSS or WS...
if (containsWebSocketScheme(uri)) {
if (uri.getPort() == -1) {
if (WS_SCHEME.equals(uri.getScheme())) {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 80, uri.getPath(), uri.getQuery(), uri.getFragment()); // depends on control dependency: [if], data = [none]
} else {
// must be WSS...
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), 443, uri.getPath(), uri.getQuery(), uri.getFragment()); // depends on control dependency: [if], data = [none]
}
}
// contains a custom port:
return uri;
}
throw new IllegalArgumentException("Can not apply WebSocket ports to invalid URI scheme");
} }
|
public class class_name {
public double computeAccuracy() {
double totalCorrect = 0;
double totalIncorrect = 0;
for (int i = 0; i < actualCounts.length; i++) {
for (int j = 0; j < actualCounts.length; j++) {
if( i == j ) {
totalCorrect += matrix.get(i,j);
} else {
totalIncorrect += matrix.get(i,j);
}
}
}
return totalCorrect/(totalCorrect+totalIncorrect);
} }
|
public class class_name {
public double computeAccuracy() {
double totalCorrect = 0;
double totalIncorrect = 0;
for (int i = 0; i < actualCounts.length; i++) {
for (int j = 0; j < actualCounts.length; j++) {
if( i == j ) {
totalCorrect += matrix.get(i,j); // depends on control dependency: [if], data = [none]
} else {
totalIncorrect += matrix.get(i,j); // depends on control dependency: [if], data = [none]
}
}
}
return totalCorrect/(totalCorrect+totalIncorrect);
} }
|
public class class_name {
public static <S> boolean solutionListsAreEquals(List<S> solutionList,
List<S> newSolutionList) {
boolean found;
for (int i = 0; i < solutionList.size(); i++) {
int j = 0;
found = false;
while (j < newSolutionList.size()) {
if (solutionList.get(i).equals(newSolutionList.get(j))) {
found = true;
}
j++;
}
if (!found) {
return false;
}
}
return true;
} }
|
public class class_name {
public static <S> boolean solutionListsAreEquals(List<S> solutionList,
List<S> newSolutionList) {
boolean found;
for (int i = 0; i < solutionList.size(); i++) {
int j = 0;
found = false; // depends on control dependency: [for], data = [none]
while (j < newSolutionList.size()) {
if (solutionList.get(i).equals(newSolutionList.get(j))) {
found = true; // depends on control dependency: [if], data = [none]
}
j++; // depends on control dependency: [while], data = [none]
}
if (!found) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
@NonNull
public static <T> ObjectAnimator ofArgb(@Nullable T target,
@NonNull Property<T, Integer> property, int... values) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return ObjectAnimatorCompatLollipop.ofArgb(target, property, values);
} else {
return ObjectAnimatorCompatBase.ofArgb(target, property, values);
}
} }
|
public class class_name {
@NonNull
public static <T> ObjectAnimator ofArgb(@Nullable T target,
@NonNull Property<T, Integer> property, int... values) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return ObjectAnimatorCompatLollipop.ofArgb(target, property, values); // depends on control dependency: [if], data = [none]
} else {
return ObjectAnimatorCompatBase.ofArgb(target, property, values); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ArrayList<Integer> trackerTiers() {
int_vector v = p.get_tracker_tiers();
int size = (int) v.size();
ArrayList<Integer> l = new ArrayList<>();
for (int i = 0; i < size; i++) {
l.add(v.get(i));
}
return l;
} }
|
public class class_name {
public ArrayList<Integer> trackerTiers() {
int_vector v = p.get_tracker_tiers();
int size = (int) v.size();
ArrayList<Integer> l = new ArrayList<>();
for (int i = 0; i < size; i++) {
l.add(v.get(i)); // depends on control dependency: [for], data = [i]
}
return l;
} }
|
public class class_name {
public List<ValidationData> getValidationDatas(ParamType paramType, String key) {
if (this.urlMap == null || this.validationDataRuleListMap == null) {
log.info("url map is empty :: " + key );
return null;
}
if (key == null || paramType == null) {
throw new ValidationLibException("any parameter is null", HttpStatus.INTERNAL_SERVER_ERROR);
}
ReqUrl reqUrl = urlMap.get(key);
if (reqUrl == null) {
log.info("reqUrl is null :" + key);
return null;
}
return validationDataRuleListMap.get(paramType.getUniqueKey(reqUrl.getUniqueKey()));
} }
|
public class class_name {
public List<ValidationData> getValidationDatas(ParamType paramType, String key) {
if (this.urlMap == null || this.validationDataRuleListMap == null) {
log.info("url map is empty :: " + key ); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
if (key == null || paramType == null) {
throw new ValidationLibException("any parameter is null", HttpStatus.INTERNAL_SERVER_ERROR);
}
ReqUrl reqUrl = urlMap.get(key);
if (reqUrl == null) {
log.info("reqUrl is null :" + key); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return validationDataRuleListMap.get(paramType.getUniqueKey(reqUrl.getUniqueKey()));
} }
|
public class class_name {
public static Map<String, Type> extractOwnerGenerics(final Class<?> type,
final Map<String, Type> generics) {
final boolean hasOwnerGenerics =
type.isMemberClass() && type.getTypeParameters().length != generics.size();
if (!hasOwnerGenerics) {
return Collections.emptyMap();
}
final LinkedHashMap<String, Type> res = new LinkedHashMap<String, Type>(generics);
// owner generics are all generics not mentioned in signature
for (TypeVariable var : type.getTypeParameters()) {
res.remove(var.getName());
}
return res;
} }
|
public class class_name {
public static Map<String, Type> extractOwnerGenerics(final Class<?> type,
final Map<String, Type> generics) {
final boolean hasOwnerGenerics =
type.isMemberClass() && type.getTypeParameters().length != generics.size();
if (!hasOwnerGenerics) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
final LinkedHashMap<String, Type> res = new LinkedHashMap<String, Type>(generics);
// owner generics are all generics not mentioned in signature
for (TypeVariable var : type.getTypeParameters()) {
res.remove(var.getName()); // depends on control dependency: [for], data = [var]
}
return res;
} }
|
public class class_name {
private static void evaluateSubexpression(final Deque<String> operators, final Deque<String> values) {
String operator = operators.pop();
while (!(operator).equals(SeparatorToken.OPEN_PARENTHESIS.toString())) {
values.push(getBooleanResultAsString(operator,
values.pop(),
values.pop()));
operator = operators.pop();
}
} }
|
public class class_name {
private static void evaluateSubexpression(final Deque<String> operators, final Deque<String> values) {
String operator = operators.pop();
while (!(operator).equals(SeparatorToken.OPEN_PARENTHESIS.toString())) {
values.push(getBooleanResultAsString(operator,
values.pop(),
values.pop())); // depends on control dependency: [while], data = [none]
operator = operators.pop(); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public boolean isPosixManditoryFileLock() {
boolean manditory = POSIX_MANDITORY_FILELOCK_DEFAULT;
try {
manditory = "true".equalsIgnoreCase(
System.getProperty(
POSIX_MANDITORY_FILELOCK_PROPERTY, manditory ? "true"
: "false"));
} catch (Exception e) {}
return manditory;
} }
|
public class class_name {
public boolean isPosixManditoryFileLock() {
boolean manditory = POSIX_MANDITORY_FILELOCK_DEFAULT;
try {
manditory = "true".equalsIgnoreCase(
System.getProperty(
POSIX_MANDITORY_FILELOCK_PROPERTY, manditory ? "true"
: "false")); // depends on control dependency: [try], data = [none]
} catch (Exception e) {} // depends on control dependency: [catch], data = [none]
return manditory;
} }
|
public class class_name {
private Token tryAndMatchAtIndent(boolean terminated, Indent indent, Token.Kind... kinds) {
int start = index;
Indent r = getIndent();
if (r != null && r.equivalent(indent)) {
Token t = tryAndMatch(terminated, kinds);
if (t != null) {
return r;
}
}
// backtrack in all failing cases.
index = start;
return null;
} }
|
public class class_name {
private Token tryAndMatchAtIndent(boolean terminated, Indent indent, Token.Kind... kinds) {
int start = index;
Indent r = getIndent();
if (r != null && r.equivalent(indent)) {
Token t = tryAndMatch(terminated, kinds);
if (t != null) {
return r; // depends on control dependency: [if], data = [none]
}
}
// backtrack in all failing cases.
index = start;
return null;
} }
|
public class class_name {
private CmsResource getResourceForLocale(CmsResource xmlPage, Locale locale) {
CmsWrappedResource wrap = new CmsWrappedResource(xmlPage);
wrap.setRootPath(xmlPage.getRootPath() + "/" + locale.getLanguage() + "/");
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId();
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
}
wrap.setTypeId(plainId);
wrap.setFolder(true);
return wrap.getResource();
} }
|
public class class_name {
private CmsResource getResourceForLocale(CmsResource xmlPage, Locale locale) {
CmsWrappedResource wrap = new CmsWrappedResource(xmlPage);
wrap.setRootPath(xmlPage.getRootPath() + "/" + locale.getLanguage() + "/");
int plainId;
try {
plainId = OpenCms.getResourceManager().getResourceType(
CmsResourceTypePlain.getStaticTypeName()).getTypeId(); // depends on control dependency: [try], data = [none]
} catch (CmsLoaderException e) {
// this should really never happen
plainId = CmsResourceTypePlain.getStaticTypeId();
} // depends on control dependency: [catch], data = [none]
wrap.setTypeId(plainId);
wrap.setFolder(true);
return wrap.getResource();
} }
|
public class class_name {
@Override
public EClass getIfcFlowFittingType() {
if (ifcFlowFittingTypeEClass == null) {
ifcFlowFittingTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(279);
}
return ifcFlowFittingTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcFlowFittingType() {
if (ifcFlowFittingTypeEClass == null) {
ifcFlowFittingTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(279);
// depends on control dependency: [if], data = [none]
}
return ifcFlowFittingTypeEClass;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public Boolean execute() {
try {
SmartFoxServer.getInstance()
.getAPIManager()
.getBuddyApi()
.initBuddyList(CommandUtil.getSfsUser(username, api), fireServerEvent);
} catch (IOException e) {
throw new IllegalStateException(e);
}
return Boolean.TRUE;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public Boolean execute() {
try {
SmartFoxServer.getInstance()
.getAPIManager()
.getBuddyApi()
.initBuddyList(CommandUtil.getSfsUser(username, api), fireServerEvent); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return Boolean.TRUE;
} }
|
public class class_name {
public ApkAssetsCookie GetResource(int resid, boolean may_be_bag,
short density_override, Ref<Res_value> out_value,
final Ref<ResTable_config> out_selected_config,
final Ref<Integer> out_flags) {
final Ref<FindEntryResult> entry = new Ref<>(null);
ApkAssetsCookie cookie =
FindEntry(resid, density_override, false /* stop_at_first_match */, entry);
if (cookie.intValue() == kInvalidCookie) {
return K_INVALID_COOKIE;
}
if (isTruthy(dtohl(entry.get().entry.flags) & ResTable_entry.FLAG_COMPLEX)) {
if (!may_be_bag) {
System.err.println(String.format("Resource %08x is a complex map type.", resid));
return K_INVALID_COOKIE;
}
// Create a reference since we can't represent this complex type as a Res_value.
out_value.set(new Res_value((byte) Res_value.TYPE_REFERENCE, resid));
out_selected_config.set(entry.get().config);
out_flags.set(entry.get().type_flags);
return cookie;
}
// final Res_value device_value = reinterpret_cast<final Res_value>(
// reinterpret_cast<final byte*>(entry.entry) + dtohs(entry.entry.size));
// out_value.copyFrom_dtoh(*device_value);
Res_value device_value = entry.get().entry.getResValue();
out_value.set(device_value.copy());
// Convert the package ID to the runtime assigned package ID.
entry.get().dynamic_ref_table.lookupResourceValue(out_value);
out_selected_config.set(entry.get().config);
out_flags.set(entry.get().type_flags);
return cookie;
} }
|
public class class_name {
public ApkAssetsCookie GetResource(int resid, boolean may_be_bag,
short density_override, Ref<Res_value> out_value,
final Ref<ResTable_config> out_selected_config,
final Ref<Integer> out_flags) {
final Ref<FindEntryResult> entry = new Ref<>(null);
ApkAssetsCookie cookie =
FindEntry(resid, density_override, false /* stop_at_first_match */, entry);
if (cookie.intValue() == kInvalidCookie) {
return K_INVALID_COOKIE; // depends on control dependency: [if], data = [none]
}
if (isTruthy(dtohl(entry.get().entry.flags) & ResTable_entry.FLAG_COMPLEX)) {
if (!may_be_bag) {
System.err.println(String.format("Resource %08x is a complex map type.", resid)); // depends on control dependency: [if], data = [none]
return K_INVALID_COOKIE; // depends on control dependency: [if], data = [none]
}
// Create a reference since we can't represent this complex type as a Res_value.
out_value.set(new Res_value((byte) Res_value.TYPE_REFERENCE, resid)); // depends on control dependency: [if], data = [none]
out_selected_config.set(entry.get().config); // depends on control dependency: [if], data = [none]
out_flags.set(entry.get().type_flags); // depends on control dependency: [if], data = [none]
return cookie; // depends on control dependency: [if], data = [none]
}
// final Res_value device_value = reinterpret_cast<final Res_value>(
// reinterpret_cast<final byte*>(entry.entry) + dtohs(entry.entry.size));
// out_value.copyFrom_dtoh(*device_value);
Res_value device_value = entry.get().entry.getResValue();
out_value.set(device_value.copy());
// Convert the package ID to the runtime assigned package ID.
entry.get().dynamic_ref_table.lookupResourceValue(out_value);
out_selected_config.set(entry.get().config);
out_flags.set(entry.get().type_flags);
return cookie;
} }
|
public class class_name {
public void addChildProperties(NodeData parent, QPathEntryFilter pattern, List<PropertyData> childs)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
}
cache.setLocal(true);
if (childs.size() > 0)
{
// add all new
Set<String> set = new HashSet<String>();
for (PropertyData child : childs)
{
putProperty(child, ModifyChildOption.NOT_MODIFY);
set.add(child.getIdentifier());
}
CachePatternPropsId cacheId = new CachePatternPropsId(getOwnerId(), parent.getIdentifier());
Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
if (patterns == null)
{
patterns = new HashMap<QPathEntryFilter, Set<String>>();
}
patterns.put(pattern, set);
cache.put(cacheId, patterns);
}
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
}
}
} }
|
public class class_name {
public void addChildProperties(NodeData parent, QPathEntryFilter pattern, List<PropertyData> childs)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
// depends on control dependency: [if], data = [none]
}
cache.setLocal(true);
// depends on control dependency: [try], data = [none]
if (childs.size() > 0)
{
// add all new
Set<String> set = new HashSet<String>();
for (PropertyData child : childs)
{
putProperty(child, ModifyChildOption.NOT_MODIFY);
// depends on control dependency: [for], data = [child]
set.add(child.getIdentifier());
// depends on control dependency: [for], data = [child]
}
CachePatternPropsId cacheId = new CachePatternPropsId(getOwnerId(), parent.getIdentifier());
Map<QPathEntryFilter, Set<String>> patterns = (Map<QPathEntryFilter, Set<String>>)cache.get(cacheId);
if (patterns == null)
{
patterns = new HashMap<QPathEntryFilter, Set<String>>();
// depends on control dependency: [if], data = [none]
}
patterns.put(pattern, set);
// depends on control dependency: [if], data = [none]
cache.put(cacheId, patterns);
// depends on control dependency: [if], data = [none]
}
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static void notifyRequestListener(Http2SourceHandler http2SourceHandler, HttpCarbonMessage httpRequestMsg,
int streamId) {
if (http2SourceHandler.getServerConnectorFuture() != null) {
try {
ServerConnectorFuture outboundRespFuture = httpRequestMsg.getHttpResponseFuture();
outboundRespFuture.setHttpConnectorListener(new Http2OutboundRespListener(
http2SourceHandler.getServerChannelInitializer(), httpRequestMsg,
http2SourceHandler.getChannelHandlerContext(), http2SourceHandler.getConnection(),
http2SourceHandler.getEncoder(), streamId, http2SourceHandler.getServerName(),
http2SourceHandler.getRemoteAddress()));
http2SourceHandler.getServerConnectorFuture().notifyHttpListener(httpRequestMsg);
} catch (Exception e) {
LOG.error("Error while notifying listeners", e);
}
} else {
LOG.error("Cannot find registered listener to forward the message");
}
} }
|
public class class_name {
public static void notifyRequestListener(Http2SourceHandler http2SourceHandler, HttpCarbonMessage httpRequestMsg,
int streamId) {
if (http2SourceHandler.getServerConnectorFuture() != null) {
try {
ServerConnectorFuture outboundRespFuture = httpRequestMsg.getHttpResponseFuture();
outboundRespFuture.setHttpConnectorListener(new Http2OutboundRespListener(
http2SourceHandler.getServerChannelInitializer(), httpRequestMsg,
http2SourceHandler.getChannelHandlerContext(), http2SourceHandler.getConnection(),
http2SourceHandler.getEncoder(), streamId, http2SourceHandler.getServerName(),
http2SourceHandler.getRemoteAddress())); // depends on control dependency: [try], data = [none]
http2SourceHandler.getServerConnectorFuture().notifyHttpListener(httpRequestMsg); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Error while notifying listeners", e);
} // depends on control dependency: [catch], data = [none]
} else {
LOG.error("Cannot find registered listener to forward the message"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static int registerDiagnosticModule(DiagnosticModule diagnosticModule, String packageName) {
if (modules.containsKey(packageName)) {
return 1;
}
try {
diagnosticModule.init();
} catch (Throwable th) {
// No FFDC code needed - we're reporting the problem to our caller
// (Note: the server version doesn't FFDC either...)
return 3;
}
modules.put(packageName, diagnosticModule);
return 0;
} }
|
public class class_name {
public static int registerDiagnosticModule(DiagnosticModule diagnosticModule, String packageName) {
if (modules.containsKey(packageName)) {
return 1; // depends on control dependency: [if], data = [none]
}
try {
diagnosticModule.init(); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
// No FFDC code needed - we're reporting the problem to our caller
// (Note: the server version doesn't FFDC either...)
return 3;
} // depends on control dependency: [catch], data = [none]
modules.put(packageName, diagnosticModule);
return 0;
} }
|
public class class_name {
private void setValueForItem(int index, int value) {
if (index == HOUR_INDEX) {
mCurrentHoursOfDay = value;
} else if (index == MINUTE_INDEX) {
mCurrentMinutes = value;
} else if (index == AMPM_INDEX) {
if (value == AM) {
mCurrentHoursOfDay = mCurrentHoursOfDay % 12;
} else if (value == PM) {
mCurrentHoursOfDay = (mCurrentHoursOfDay % 12) + 12;
}
}
} }
|
public class class_name {
private void setValueForItem(int index, int value) {
if (index == HOUR_INDEX) {
mCurrentHoursOfDay = value; // depends on control dependency: [if], data = [none]
} else if (index == MINUTE_INDEX) {
mCurrentMinutes = value; // depends on control dependency: [if], data = [none]
} else if (index == AMPM_INDEX) {
if (value == AM) {
mCurrentHoursOfDay = mCurrentHoursOfDay % 12; // depends on control dependency: [if], data = [none]
} else if (value == PM) {
mCurrentHoursOfDay = (mCurrentHoursOfDay % 12) + 12; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static TaskTemplate getTaskTemplate(String logicalId) {
for (int i = 0; i < taskVoCache.size(); i++) {
TaskTemplate task = taskVoCache.get(i);
if (logicalId.equals(task.getLogicalId())) {
return task;
}
}
return null;
} }
|
public class class_name {
public static TaskTemplate getTaskTemplate(String logicalId) {
for (int i = 0; i < taskVoCache.size(); i++) {
TaskTemplate task = taskVoCache.get(i);
if (logicalId.equals(task.getLogicalId())) {
return task; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public void increment(double coord, double val) {
int bin = getBinNr(coord);
if (bin < 0) {
if (size - bin > data.length) {
// Reallocate. TODO: use an arraylist-like grow strategy!
double[] tmpdata = new double[growSize(data.length, size - bin)];
System.arraycopy(data, 0, tmpdata, -bin, size);
data = tmpdata;
} else {
// Shift in place and clear head
System.arraycopy(data, 0, data, -bin, size);
Arrays.fill(data, 0, -bin, (double) 0);
}
data[0] = val;
// Note that bin is negative, -bin is the shift offset!
assert (data.length >= size - bin);
offset -= bin;
size -= bin;
// TODO: modCounter++; and have iterators fast-fail
} else if (bin >= data.length) {
double[] tmpdata = new double[growSize(data.length, bin + 1)];
System.arraycopy(data, 0, tmpdata, 0, size);
tmpdata[bin] = val;
data = tmpdata;
size = bin + 1;
// TODO: modCounter++; and have iterators fast-fail
// Unset max value when resizing
max = Double.MAX_VALUE;
} else {
if (bin >= size) {
// TODO: reset bins to 0 first?
size = bin + 1;
}
data[bin] += val;
}
} }
|
public class class_name {
public void increment(double coord, double val) {
int bin = getBinNr(coord);
if (bin < 0) {
if (size - bin > data.length) {
// Reallocate. TODO: use an arraylist-like grow strategy!
double[] tmpdata = new double[growSize(data.length, size - bin)];
System.arraycopy(data, 0, tmpdata, -bin, size); // depends on control dependency: [if], data = [none]
data = tmpdata; // depends on control dependency: [if], data = [none]
} else {
// Shift in place and clear head
System.arraycopy(data, 0, data, -bin, size); // depends on control dependency: [if], data = [none]
Arrays.fill(data, 0, -bin, (double) 0); // depends on control dependency: [if], data = [none]
}
data[0] = val; // depends on control dependency: [if], data = [none]
// Note that bin is negative, -bin is the shift offset!
assert (data.length >= size - bin); // depends on control dependency: [if], data = [none]
offset -= bin; // depends on control dependency: [if], data = [none]
size -= bin; // depends on control dependency: [if], data = [none]
// TODO: modCounter++; and have iterators fast-fail
} else if (bin >= data.length) {
double[] tmpdata = new double[growSize(data.length, bin + 1)];
System.arraycopy(data, 0, tmpdata, 0, size); // depends on control dependency: [if], data = [none]
tmpdata[bin] = val; // depends on control dependency: [if], data = [none]
data = tmpdata; // depends on control dependency: [if], data = [none]
size = bin + 1; // depends on control dependency: [if], data = [none]
// TODO: modCounter++; and have iterators fast-fail
// Unset max value when resizing
max = Double.MAX_VALUE; // depends on control dependency: [if], data = [none]
} else {
if (bin >= size) {
// TODO: reset bins to 0 first?
size = bin + 1; // depends on control dependency: [if], data = [none]
}
data[bin] += val; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static double TMScore(Point3d[] x, Point3d[] y, int lengthNative) {
if (x.length != y.length) {
throw new IllegalArgumentException(
"Point arrays are not of the same length.");
}
double d0 = 1.24 * Math.cbrt(x.length - 15.0) - 1.8;
double d0Sq = d0 * d0;
double sum = 0;
for (int i = 0; i < x.length; i++) {
sum += 1.0 / (1.0 + x[i].distanceSquared(y[i]) / d0Sq);
}
return sum / lengthNative;
} }
|
public class class_name {
public static double TMScore(Point3d[] x, Point3d[] y, int lengthNative) {
if (x.length != y.length) {
throw new IllegalArgumentException(
"Point arrays are not of the same length.");
}
double d0 = 1.24 * Math.cbrt(x.length - 15.0) - 1.8;
double d0Sq = d0 * d0;
double sum = 0;
for (int i = 0; i < x.length; i++) {
sum += 1.0 / (1.0 + x[i].distanceSquared(y[i]) / d0Sq); // depends on control dependency: [for], data = [i]
}
return sum / lengthNative;
} }
|
public class class_name {
public static Collection<String> getUnstaticClassFieldNameCollection(Class<?> clazz) {
if (clazz == null) {
throw new NullPointerException("传入的clazz为空对象!");
}
Field[] fields = clazz.getDeclaredFields();
int length = fields.length;
Collection<String> fieldNames = new ArrayList<String>();
for (int i = 0; i < length; i++) {
Field field = fields[i];
if (!Modifier.isStatic(field.getModifiers())) {
fieldNames.add(field.getName());
}
}
return fieldNames;
} }
|
public class class_name {
public static Collection<String> getUnstaticClassFieldNameCollection(Class<?> clazz) {
if (clazz == null) {
throw new NullPointerException("传入的clazz为空对象!");
}
Field[] fields = clazz.getDeclaredFields();
int length = fields.length;
Collection<String> fieldNames = new ArrayList<String>();
for (int i = 0; i < length; i++) {
Field field = fields[i];
if (!Modifier.isStatic(field.getModifiers())) {
fieldNames.add(field.getName()); // depends on control dependency: [if], data = [none]
}
}
return fieldNames;
} }
|
public class class_name {
public List<CmsSolrIndex> getSearchIndexesSolr() {
List<CmsSolrIndex> indexes = new ArrayList<CmsSolrIndex>();
for (I_CmsSearchIndex index : m_indexes) {
if (index instanceof CmsSolrIndex) {
indexes.add((CmsSolrIndex)index);
}
}
return Collections.unmodifiableList(indexes);
} }
|
public class class_name {
public List<CmsSolrIndex> getSearchIndexesSolr() {
List<CmsSolrIndex> indexes = new ArrayList<CmsSolrIndex>();
for (I_CmsSearchIndex index : m_indexes) {
if (index instanceof CmsSolrIndex) {
indexes.add((CmsSolrIndex)index); // depends on control dependency: [if], data = [none]
}
}
return Collections.unmodifiableList(indexes);
} }
|
public class class_name {
public void setUserDefinedText(String desc, String text)
{
if (allow(ID3V2))
{
id3v2.setUserDefinedTextFrame(desc, text);
}
} }
|
public class class_name {
public void setUserDefinedText(String desc, String text)
{
if (allow(ID3V2))
{
id3v2.setUserDefinedTextFrame(desc, text); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void reference (Object object) {
if (copyDepth > 0) {
if (needsCopyReference != null) {
if (object == null) throw new IllegalArgumentException("object cannot be null.");
originalToCopy.put(needsCopyReference, object);
needsCopyReference = null;
}
} else if (references && object != null) {
int id = readReferenceIds.pop();
if (id != NO_REF) referenceResolver.setReadObject(id, object);
}
} }
|
public class class_name {
public void reference (Object object) {
if (copyDepth > 0) {
if (needsCopyReference != null) {
if (object == null) throw new IllegalArgumentException("object cannot be null.");
originalToCopy.put(needsCopyReference, object);
// depends on control dependency: [if], data = [(needsCopyReference]
needsCopyReference = null;
// depends on control dependency: [if], data = [none]
}
} else if (references && object != null) {
int id = readReferenceIds.pop();
if (id != NO_REF) referenceResolver.setReadObject(id, object);
}
} }
|
public class class_name {
public DescribeApplicationsRequest withApplicationNames(String... applicationNames) {
if (this.applicationNames == null) {
setApplicationNames(new com.amazonaws.internal.SdkInternalList<String>(applicationNames.length));
}
for (String ele : applicationNames) {
this.applicationNames.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeApplicationsRequest withApplicationNames(String... applicationNames) {
if (this.applicationNames == null) {
setApplicationNames(new com.amazonaws.internal.SdkInternalList<String>(applicationNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : applicationNames) {
this.applicationNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected void invokeWithCallback(final Connection conn, final RemotingCommand request,
final InvokeCallback invokeCallback, final int timeoutMillis) {
final InvokeFuture future = createInvokeFuture(conn, request, request.getInvokeContext(),
invokeCallback);
conn.addInvokeFuture(future);
final int requestId = request.getId();
try {
Timeout timeout = TimerHolder.getTimer().newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
InvokeFuture future = conn.removeInvokeFuture(requestId);
if (future != null) {
future.putResponse(commandFactory.createTimeoutResponse(conn
.getRemoteAddress()));
future.tryAsyncExecuteInvokeCallbackAbnormally();
}
}
}, timeoutMillis, TimeUnit.MILLISECONDS);
future.addTimeout(timeout);
conn.getChannel().writeAndFlush(request).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture cf) throws Exception {
if (!cf.isSuccess()) {
InvokeFuture f = conn.removeInvokeFuture(requestId);
if (f != null) {
f.cancelTimeout();
f.putResponse(commandFactory.createSendFailedResponse(
conn.getRemoteAddress(), cf.cause()));
f.tryAsyncExecuteInvokeCallbackAbnormally();
}
logger.error("Invoke send failed. The address is {}",
RemotingUtil.parseRemoteAddress(conn.getChannel()), cf.cause());
}
}
});
} catch (Exception e) {
InvokeFuture f = conn.removeInvokeFuture(requestId);
if (f != null) {
f.cancelTimeout();
f.putResponse(commandFactory.createSendFailedResponse(conn.getRemoteAddress(), e));
f.tryAsyncExecuteInvokeCallbackAbnormally();
}
logger.error("Exception caught when sending invocation. The address is {}",
RemotingUtil.parseRemoteAddress(conn.getChannel()), e);
}
} }
|
public class class_name {
protected void invokeWithCallback(final Connection conn, final RemotingCommand request,
final InvokeCallback invokeCallback, final int timeoutMillis) {
final InvokeFuture future = createInvokeFuture(conn, request, request.getInvokeContext(),
invokeCallback);
conn.addInvokeFuture(future);
final int requestId = request.getId();
try {
Timeout timeout = TimerHolder.getTimer().newTimeout(new TimerTask() {
@Override
public void run(Timeout timeout) throws Exception {
InvokeFuture future = conn.removeInvokeFuture(requestId);
if (future != null) {
future.putResponse(commandFactory.createTimeoutResponse(conn
.getRemoteAddress()));
future.tryAsyncExecuteInvokeCallbackAbnormally();
}
}
}, timeoutMillis, TimeUnit.MILLISECONDS);
future.addTimeout(timeout); // depends on control dependency: [try], data = [none]
conn.getChannel().writeAndFlush(request).addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture cf) throws Exception {
if (!cf.isSuccess()) {
InvokeFuture f = conn.removeInvokeFuture(requestId);
if (f != null) {
f.cancelTimeout(); // depends on control dependency: [if], data = [none]
f.putResponse(commandFactory.createSendFailedResponse(
conn.getRemoteAddress(), cf.cause())); // depends on control dependency: [if], data = [none]
f.tryAsyncExecuteInvokeCallbackAbnormally(); // depends on control dependency: [if], data = [none]
}
logger.error("Invoke send failed. The address is {}",
RemotingUtil.parseRemoteAddress(conn.getChannel()), cf.cause());
}
}
}); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
InvokeFuture f = conn.removeInvokeFuture(requestId);
if (f != null) {
f.cancelTimeout(); // depends on control dependency: [if], data = [none]
f.putResponse(commandFactory.createSendFailedResponse(conn.getRemoteAddress(), e)); // depends on control dependency: [if], data = [none]
f.tryAsyncExecuteInvokeCallbackAbnormally(); // depends on control dependency: [if], data = [none]
}
logger.error("Exception caught when sending invocation. The address is {}",
RemotingUtil.parseRemoteAddress(conn.getChannel()), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<CmsModelPageEntry> getModelGroups() {
List<CmsModelPageEntry> result = new ArrayList<CmsModelPageEntry>();
CmsResourceTypeConfig config = m_adeConfig.getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
if ((config != null) && !config.isDisabled()) {
String modelGroupFolderPath = config.getFolderPath(m_cms, m_adeConfig.getBasePath());
if (m_cms.existsResource(modelGroupFolderPath)) {
try {
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
List<CmsResource> modelResources = m_cms.readResources(
modelGroupFolderPath,
CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(
OpenCms.getResourceManager().getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME)),
false);
for (CmsResource model : modelResources) {
CmsModelPageEntry entry = createModelPageEntry(model, false, false, wpLocale);
if (entry != null) {
result.add(entry);
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
return result;
} }
|
public class class_name {
public List<CmsModelPageEntry> getModelGroups() {
List<CmsModelPageEntry> result = new ArrayList<CmsModelPageEntry>();
CmsResourceTypeConfig config = m_adeConfig.getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME);
if ((config != null) && !config.isDisabled()) {
String modelGroupFolderPath = config.getFolderPath(m_cms, m_adeConfig.getBasePath());
if (m_cms.existsResource(modelGroupFolderPath)) {
try {
Locale wpLocale = OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms);
List<CmsResource> modelResources = m_cms.readResources(
modelGroupFolderPath,
CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(
OpenCms.getResourceManager().getResourceType(
CmsResourceTypeXmlContainerPage.MODEL_GROUP_TYPE_NAME)),
false);
for (CmsResource model : modelResources) {
CmsModelPageEntry entry = createModelPageEntry(model, false, false, wpLocale);
if (entry != null) {
result.add(entry); // depends on control dependency: [if], data = [(entry]
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} }
|
public class class_name {
@Override
public PasswordStrengthCheckResult check(String userName, String password, List<PasswordRestriction> restictions) {
try {
this.userName = userName;
this.password = password;
this.passwordLength = this.password.length();
this.adHocRestrictions = restictions;
this.result = new SimplePasswordStrengthCheckResult();
this.checkRestrictions();
// positive checks
result.positive(password.length() * PWD_LEN_WEIGHT);
this.checkSymbols();
this.checkDigits();
this.checkMiddleNonChar();
this.checkAlpha();
// negatives checks
this.checkAlphaOnly();
this.checkNumbersOnly();
this.checkConsecutiveAlpha();
this.checkConsecutiveNumbers();
this.checkConsecutiveSymbols();
this.checkSequential();
// now evaluate.
this.result.calculateStrength();
} finally {
this.password = null;
this.passwordLength = 0;
this.adHocRestrictions = null;
}
return result;
} }
|
public class class_name {
@Override
public PasswordStrengthCheckResult check(String userName, String password, List<PasswordRestriction> restictions) {
try {
this.userName = userName; // depends on control dependency: [try], data = [none]
this.password = password; // depends on control dependency: [try], data = [none]
this.passwordLength = this.password.length(); // depends on control dependency: [try], data = [none]
this.adHocRestrictions = restictions; // depends on control dependency: [try], data = [none]
this.result = new SimplePasswordStrengthCheckResult(); // depends on control dependency: [try], data = [none]
this.checkRestrictions(); // depends on control dependency: [try], data = [none]
// positive checks
result.positive(password.length() * PWD_LEN_WEIGHT); // depends on control dependency: [try], data = [none]
this.checkSymbols(); // depends on control dependency: [try], data = [none]
this.checkDigits(); // depends on control dependency: [try], data = [none]
this.checkMiddleNonChar(); // depends on control dependency: [try], data = [none]
this.checkAlpha(); // depends on control dependency: [try], data = [none]
// negatives checks
this.checkAlphaOnly(); // depends on control dependency: [try], data = [none]
this.checkNumbersOnly(); // depends on control dependency: [try], data = [none]
this.checkConsecutiveAlpha(); // depends on control dependency: [try], data = [none]
this.checkConsecutiveNumbers(); // depends on control dependency: [try], data = [none]
this.checkConsecutiveSymbols(); // depends on control dependency: [try], data = [none]
this.checkSequential(); // depends on control dependency: [try], data = [none]
// now evaluate.
this.result.calculateStrength(); // depends on control dependency: [try], data = [none]
} finally {
this.password = null;
this.passwordLength = 0;
this.adHocRestrictions = null;
}
return result;
} }
|
public class class_name {
public EClass getEndSegmentCommand() {
if (endSegmentCommandEClass == null) {
endSegmentCommandEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(437);
}
return endSegmentCommandEClass;
} }
|
public class class_name {
public EClass getEndSegmentCommand() {
if (endSegmentCommandEClass == null) {
endSegmentCommandEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(437); // depends on control dependency: [if], data = [none]
}
return endSegmentCommandEClass;
} }
|
public class class_name {
public static boolean unlock(int innerId) {
InterProcessMutex mutex = map.remove(innerId);
if (mutex != null) {
if (mutex.isAcquiredInThisProcess()) {
try {
mutex.release();
LOG.debug("解锁成功...");
return true;
} catch (Exception e) {
LOG.error("解锁失败!", e);
return false;
}
} else {
LOG.error(new LockNotOwnedByCurrentThread());
return false;
}
} else {
//这里暂时不抛出异常,只打印日志
LOG.error(new RuntimeException("API误用,根本不存在锁,你解什么锁?"));
return false;
}
} }
|
public class class_name {
public static boolean unlock(int innerId) {
InterProcessMutex mutex = map.remove(innerId);
if (mutex != null) {
if (mutex.isAcquiredInThisProcess()) {
try {
mutex.release(); // depends on control dependency: [try], data = [none]
LOG.debug("解锁成功..."); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("解锁失败!", e);
return false;
} // depends on control dependency: [catch], data = [none]
} else {
LOG.error(new LockNotOwnedByCurrentThread()); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} else {
//这里暂时不抛出异常,只打印日志
LOG.error(new RuntimeException("API误用,根本不存在锁,你解什么锁?")); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public <E extends Enum<?>> String getMessage(E key, Object... args)
throws MessageConveyorException {
String declararingClassName = key.getDeclaringClass().getName();
CAL10NResourceBundle rb = cache.get(declararingClassName);
if (rb == null || rb.hasChanged()) {
rb = lookup(key);
cache.put(declararingClassName, rb);
}
String keyAsStr = key.toString();
String value = rb.getString(keyAsStr);
if (value == null) {
return "?" + keyAsStr + "?";
} else {
if (args == null || args.length == 0) {
return value;
} else {
return format(value, args);
}
}
} }
|
public class class_name {
@Override
public <E extends Enum<?>> String getMessage(E key, Object... args)
throws MessageConveyorException {
String declararingClassName = key.getDeclaringClass().getName();
CAL10NResourceBundle rb = cache.get(declararingClassName);
if (rb == null || rb.hasChanged()) {
rb = lookup(key);
cache.put(declararingClassName, rb);
}
String keyAsStr = key.toString();
String value = rb.getString(keyAsStr);
if (value == null) {
return "?" + keyAsStr + "?";
} else {
if (args == null || args.length == 0) {
return value;
// depends on control dependency: [if], data = [none]
} else {
return format(value, args);
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean includes(T value, boolean inclusive) {
if (inclusive) {
return value.compareTo(getStart()) >= 0 && value.compareTo(getEnd()) <= 0;
} else {
return value.compareTo(getStart()) > 0 && value.compareTo(getEnd()) < 0;
}
} }
|
public class class_name {
public boolean includes(T value, boolean inclusive) {
if (inclusive) {
return value.compareTo(getStart()) >= 0 && value.compareTo(getEnd()) <= 0; // depends on control dependency: [if], data = [none]
} else {
return value.compareTo(getStart()) > 0 && value.compareTo(getEnd()) < 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String urlEncode(String input) {
try {
return URLEncoder.encode(input, "UTF-8");
} catch (UnsupportedEncodingException ex) {
throw new AssertionError("UTF-8 not supported", ex);
}
} }
|
public class class_name {
public static String urlEncode(String input) {
try {
return URLEncoder.encode(input, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException ex) {
throw new AssertionError("UTF-8 not supported", ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, // xsl:apply-templates or xsl:for-each
ElemTemplate template, int child)
throws TransformerException
{
DTM dtm = m_xcontext.getDTM(child);
short nodeType = dtm.getNodeType(child);
boolean isDefaultTextRule = false;
boolean isApplyImports = false;
isApplyImports = ((xslInstruction == null)
? false
: xslInstruction.getXSLToken()
== Constants.ELEMNAME_APPLY_IMPORTS);
if (null == template || isApplyImports)
{
int maxImportLevel, endImportLevel=0;
if (isApplyImports)
{
maxImportLevel =
template.getStylesheetComposed().getImportCountComposed() - 1;
endImportLevel =
template.getStylesheetComposed().getEndImportCountComposed();
}
else
{
maxImportLevel = -1;
}
// If we're trying an xsl:apply-imports at the top level (ie there are no
// imported stylesheets), we need to indicate that there is no matching template.
// The above logic will calculate a maxImportLevel of -1 which indicates
// that we should find any template. This is because a value of -1 for
// maxImportLevel has a special meaning. But we don't want that.
// We want to match -no- templates. See bugzilla bug 1170.
if (isApplyImports && (maxImportLevel == -1))
{
template = null;
}
else
{
// Find the XSL template that is the best match for the
// element.
XPathContext xctxt = m_xcontext;
try
{
xctxt.pushNamespaceContext(xslInstruction);
QName mode = this.getMode();
if (isApplyImports)
template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode,
maxImportLevel, endImportLevel, m_quietConflictWarnings, dtm);
else
template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode,
m_quietConflictWarnings, dtm);
}
finally
{
xctxt.popNamespaceContext();
}
}
// If that didn't locate a node, fall back to a default template rule.
// See http://www.w3.org/TR/xslt#built-in-rule.
if (null == template)
{
switch (nodeType)
{
case DTM.DOCUMENT_FRAGMENT_NODE :
case DTM.ELEMENT_NODE :
template = m_stylesheetRoot.getDefaultRule();
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
case DTM.ATTRIBUTE_NODE :
template = m_stylesheetRoot.getDefaultTextRule();
isDefaultTextRule = true;
break;
case DTM.DOCUMENT_NODE :
template = m_stylesheetRoot.getDefaultRootRule();
break;
default :
// No default rules for processing instructions and the like.
return false;
}
}
}
// If we are processing the default text rule, then just clone
// the value directly to the result tree.
try
{
pushElemTemplateElement(template);
m_xcontext.pushCurrentNode(child);
pushPairCurrentMatched(template, child);
// Fix copy copy29 test.
if (!isApplyImports) {
DTMIterator cnl = new org.apache.xpath.NodeSetDTM(child, m_xcontext.getDTMManager());
m_xcontext.pushContextNodeList(cnl);
}
if (isDefaultTextRule)
{
switch (nodeType)
{
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
ClonerToResultTree.cloneToResultTree(child, nodeType,
dtm, getResultTreeHandler(), false);
break;
case DTM.ATTRIBUTE_NODE :
dtm.dispatchCharactersEvents(child, getResultTreeHandler(), false);
break;
}
}
else
{
// And execute the child templates.
// 9/11/00: If template has been compiled, hand off to it
// since much (most? all?) of the processing has been inlined.
// (It would be nice if there was a single entry point that
// worked for both... but the interpretive system works by
// having the Tranformer execute the children, while the
// compiled obviously has to run its own code. It's
// also unclear that "execute" is really the right name for
// that entry point.)
m_xcontext.setSAXLocator(template);
// m_xcontext.getVarStack().link();
m_xcontext.getVarStack().link(template.m_frameSize);
executeChildTemplates(template, true);
}
}
catch (org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
finally
{
if (!isDefaultTextRule)
m_xcontext.getVarStack().unlink();
m_xcontext.popCurrentNode();
if (!isApplyImports) {
m_xcontext.popContextNodeList();
}
popCurrentMatched();
popElemTemplateElement();
}
return true;
} }
|
public class class_name {
public boolean applyTemplateToNode(ElemTemplateElement xslInstruction, // xsl:apply-templates or xsl:for-each
ElemTemplate template, int child)
throws TransformerException
{
DTM dtm = m_xcontext.getDTM(child);
short nodeType = dtm.getNodeType(child);
boolean isDefaultTextRule = false;
boolean isApplyImports = false;
isApplyImports = ((xslInstruction == null)
? false
: xslInstruction.getXSLToken()
== Constants.ELEMNAME_APPLY_IMPORTS);
if (null == template || isApplyImports)
{
int maxImportLevel, endImportLevel=0;
if (isApplyImports)
{
maxImportLevel =
template.getStylesheetComposed().getImportCountComposed() - 1; // depends on control dependency: [if], data = [none]
endImportLevel =
template.getStylesheetComposed().getEndImportCountComposed(); // depends on control dependency: [if], data = [none]
}
else
{
maxImportLevel = -1; // depends on control dependency: [if], data = [none]
}
// If we're trying an xsl:apply-imports at the top level (ie there are no
// imported stylesheets), we need to indicate that there is no matching template.
// The above logic will calculate a maxImportLevel of -1 which indicates
// that we should find any template. This is because a value of -1 for
// maxImportLevel has a special meaning. But we don't want that.
// We want to match -no- templates. See bugzilla bug 1170.
if (isApplyImports && (maxImportLevel == -1))
{
template = null; // depends on control dependency: [if], data = [none]
}
else
{
// Find the XSL template that is the best match for the
// element.
XPathContext xctxt = m_xcontext;
try
{
xctxt.pushNamespaceContext(xslInstruction); // depends on control dependency: [try], data = [none]
QName mode = this.getMode();
if (isApplyImports)
template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode,
maxImportLevel, endImportLevel, m_quietConflictWarnings, dtm);
else
template = m_stylesheetRoot.getTemplateComposed(xctxt, child, mode,
m_quietConflictWarnings, dtm);
}
finally
{
xctxt.popNamespaceContext();
}
}
// If that didn't locate a node, fall back to a default template rule.
// See http://www.w3.org/TR/xslt#built-in-rule.
if (null == template)
{
switch (nodeType)
{
case DTM.DOCUMENT_FRAGMENT_NODE :
case DTM.ELEMENT_NODE :
template = m_stylesheetRoot.getDefaultRule();
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
case DTM.ATTRIBUTE_NODE :
template = m_stylesheetRoot.getDefaultTextRule();
isDefaultTextRule = true;
break;
case DTM.DOCUMENT_NODE :
template = m_stylesheetRoot.getDefaultRootRule();
break;
default :
// No default rules for processing instructions and the like.
return false;
}
}
}
// If we are processing the default text rule, then just clone
// the value directly to the result tree.
try
{
pushElemTemplateElement(template);
m_xcontext.pushCurrentNode(child);
pushPairCurrentMatched(template, child);
// Fix copy copy29 test.
if (!isApplyImports) {
DTMIterator cnl = new org.apache.xpath.NodeSetDTM(child, m_xcontext.getDTMManager());
m_xcontext.pushContextNodeList(cnl); // depends on control dependency: [if], data = [none]
}
if (isDefaultTextRule)
{
switch (nodeType)
{
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
ClonerToResultTree.cloneToResultTree(child, nodeType,
dtm, getResultTreeHandler(), false);
break;
case DTM.ATTRIBUTE_NODE :
dtm.dispatchCharactersEvents(child, getResultTreeHandler(), false);
break;
}
}
else
{
// And execute the child templates.
// 9/11/00: If template has been compiled, hand off to it
// since much (most? all?) of the processing has been inlined.
// (It would be nice if there was a single entry point that
// worked for both... but the interpretive system works by
// having the Tranformer execute the children, while the
// compiled obviously has to run its own code. It's
// also unclear that "execute" is really the right name for
// that entry point.)
m_xcontext.setSAXLocator(template); // depends on control dependency: [if], data = [none]
// m_xcontext.getVarStack().link();
m_xcontext.getVarStack().link(template.m_frameSize); // depends on control dependency: [if], data = [none]
executeChildTemplates(template, true); // depends on control dependency: [if], data = [none]
}
}
catch (org.xml.sax.SAXException se)
{
throw new TransformerException(se);
}
finally
{
if (!isDefaultTextRule)
m_xcontext.getVarStack().unlink();
m_xcontext.popCurrentNode();
if (!isApplyImports) {
m_xcontext.popContextNodeList(); // depends on control dependency: [if], data = [none]
}
popCurrentMatched();
popElemTemplateElement();
}
return true;
} }
|
public class class_name {
public static String getW3CDate(String d) {
if (d.startsWith("D:"))
d = d.substring(2);
StringBuffer sb = new StringBuffer();
if (d.length() < 4)
return "0000";
sb.append(d.substring(0, 4)); //year
d = d.substring(4);
if (d.length() < 2)
return sb.toString();
sb.append('-').append(d.substring(0, 2)); //month
d = d.substring(2);
if (d.length() < 2)
return sb.toString();
sb.append('-').append(d.substring(0, 2)); //day
d = d.substring(2);
if (d.length() < 2)
return sb.toString();
sb.append('T').append(d.substring(0, 2)); //hour
d = d.substring(2);
if (d.length() < 2) {
sb.append(":00Z");
return sb.toString();
}
sb.append(':').append(d.substring(0, 2)); //minute
d = d.substring(2);
if (d.length() < 2) {
sb.append('Z');
return sb.toString();
}
sb.append(':').append(d.substring(0, 2)); //second
d = d.substring(2);
if (d.startsWith("-") || d.startsWith("+")) {
String sign = d.substring(0, 1);
d = d.substring(1);
String h = "00";
String m = "00";
if (d.length() >= 2) {
h = d.substring(0, 2);
if (d.length() > 2) {
d = d.substring(3);
if (d.length() >= 2)
m = d.substring(0, 2);
}
sb.append(sign).append(h).append(':').append(m);
return sb.toString();
}
}
sb.append('Z');
return sb.toString();
} }
|
public class class_name {
public static String getW3CDate(String d) {
if (d.startsWith("D:"))
d = d.substring(2);
StringBuffer sb = new StringBuffer();
if (d.length() < 4)
return "0000";
sb.append(d.substring(0, 4)); //year
d = d.substring(4);
if (d.length() < 2)
return sb.toString();
sb.append('-').append(d.substring(0, 2)); //month
d = d.substring(2);
if (d.length() < 2)
return sb.toString();
sb.append('-').append(d.substring(0, 2)); //day
d = d.substring(2);
if (d.length() < 2)
return sb.toString();
sb.append('T').append(d.substring(0, 2)); //hour
d = d.substring(2);
if (d.length() < 2) {
sb.append(":00Z"); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
}
sb.append(':').append(d.substring(0, 2)); //minute
d = d.substring(2);
if (d.length() < 2) {
sb.append('Z'); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
}
sb.append(':').append(d.substring(0, 2)); //second
d = d.substring(2);
if (d.startsWith("-") || d.startsWith("+")) {
String sign = d.substring(0, 1);
d = d.substring(1); // depends on control dependency: [if], data = [none]
String h = "00";
String m = "00";
if (d.length() >= 2) {
h = d.substring(0, 2); // depends on control dependency: [if], data = [none]
if (d.length() > 2) {
d = d.substring(3); // depends on control dependency: [if], data = [none]
if (d.length() >= 2)
m = d.substring(0, 2);
}
sb.append(sign).append(h).append(':').append(m); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
}
}
sb.append('Z');
return sb.toString();
} }
|
public class class_name {
@Override
public double similarity(VariantCall call1, VariantCall call2) {
int minNumberOfGenotypes = Math.min(call1.getGenotypeCount(), call2.getGenotypeCount());
int numberOfSharedAlleles = 0;
for (int i = 0; i < minNumberOfGenotypes; ++i) {
if (call1.getGenotype(i) == call2.getGenotype(i)) {
++numberOfSharedAlleles;
}
}
int maxNumberOfGenotypes = Math.max(call1.getGenotypeCount(), call2.getGenotypeCount());
return (double) numberOfSharedAlleles / maxNumberOfGenotypes;
} }
|
public class class_name {
@Override
public double similarity(VariantCall call1, VariantCall call2) {
int minNumberOfGenotypes = Math.min(call1.getGenotypeCount(), call2.getGenotypeCount());
int numberOfSharedAlleles = 0;
for (int i = 0; i < minNumberOfGenotypes; ++i) {
if (call1.getGenotype(i) == call2.getGenotype(i)) {
++numberOfSharedAlleles; // depends on control dependency: [if], data = [none]
}
}
int maxNumberOfGenotypes = Math.max(call1.getGenotypeCount(), call2.getGenotypeCount());
return (double) numberOfSharedAlleles / maxNumberOfGenotypes;
} }
|
public class class_name {
public static EmailAddress[] of(final Address... addresses) {
if (addresses == null) {
return EmailAddress.EMPTY_ARRAY;
}
if (addresses.length == 0) {
return EmailAddress.EMPTY_ARRAY;
}
final EmailAddress[] res = new EmailAddress[addresses.length];
for (int i = 0; i < addresses.length; i++) {
res[i] = EmailAddress.of(addresses[i]);
}
return res;
} }
|
public class class_name {
public static EmailAddress[] of(final Address... addresses) {
if (addresses == null) {
return EmailAddress.EMPTY_ARRAY; // depends on control dependency: [if], data = [none]
}
if (addresses.length == 0) {
return EmailAddress.EMPTY_ARRAY; // depends on control dependency: [if], data = [none]
}
final EmailAddress[] res = new EmailAddress[addresses.length];
for (int i = 0; i < addresses.length; i++) {
res[i] = EmailAddress.of(addresses[i]); // depends on control dependency: [for], data = [i]
}
return res;
} }
|
public class class_name {
private void checkNegativeNumberExpression() {
if ((numberFormat instanceof DecimalFormat) &&
!numberFormat.equals(originalNumberFormat)) {
String numberPattern = ((DecimalFormat)numberFormat).toPattern();
if (!numberPattern.equals(originalNumberPattern)) {
hasFollowingMinusSign = false;
int separatorIndex = numberPattern.indexOf(';');
// If the negative subpattern is not absent, we have to analayze
// it in order to check if it has a following minus sign.
if (separatorIndex > -1) {
int minusIndex = numberPattern.indexOf('-', separatorIndex);
if ((minusIndex > numberPattern.lastIndexOf('0')) &&
(minusIndex > numberPattern.lastIndexOf('#'))) {
hasFollowingMinusSign = true;
minusSign = ((DecimalFormat)numberFormat).getDecimalFormatSymbols().getMinusSign();
}
}
originalNumberPattern = numberPattern;
}
originalNumberFormat = numberFormat;
}
} }
|
public class class_name {
private void checkNegativeNumberExpression() {
if ((numberFormat instanceof DecimalFormat) &&
!numberFormat.equals(originalNumberFormat)) {
String numberPattern = ((DecimalFormat)numberFormat).toPattern();
if (!numberPattern.equals(originalNumberPattern)) {
hasFollowingMinusSign = false; // depends on control dependency: [if], data = [none]
int separatorIndex = numberPattern.indexOf(';');
// If the negative subpattern is not absent, we have to analayze
// it in order to check if it has a following minus sign.
if (separatorIndex > -1) {
int minusIndex = numberPattern.indexOf('-', separatorIndex);
if ((minusIndex > numberPattern.lastIndexOf('0')) &&
(minusIndex > numberPattern.lastIndexOf('#'))) {
hasFollowingMinusSign = true; // depends on control dependency: [if], data = [none]
minusSign = ((DecimalFormat)numberFormat).getDecimalFormatSymbols().getMinusSign(); // depends on control dependency: [if], data = [none]
}
}
originalNumberPattern = numberPattern; // depends on control dependency: [if], data = [none]
}
originalNumberFormat = numberFormat; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static <T> T forkJoinExecution(Callable<T> callable, ConcurrencyConfiguration concurrencyConfiguration, boolean parallelStream) {
if(parallelStream && concurrencyConfiguration.isParallelized()) {
try {
ForkJoinPool pool = new ForkJoinPool(concurrencyConfiguration.getMaxNumberOfThreadsPerTask());
T results = pool.submit(callable).get();
pool.shutdown();
return results;
}
catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
}
}
else {
try {
return callable.call();
}
catch (Exception ex) {
throw new RuntimeException(ex);
}
}
} }
|
public class class_name {
public static <T> T forkJoinExecution(Callable<T> callable, ConcurrencyConfiguration concurrencyConfiguration, boolean parallelStream) {
if(parallelStream && concurrencyConfiguration.isParallelized()) {
try {
ForkJoinPool pool = new ForkJoinPool(concurrencyConfiguration.getMaxNumberOfThreadsPerTask());
T results = pool.submit(callable).get();
pool.shutdown(); // depends on control dependency: [try], data = [none]
return results; // depends on control dependency: [try], data = [none]
}
catch (InterruptedException | ExecutionException ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
}
else {
try {
return callable.call(); // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public ComputeNodeListOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} }
|
public class class_name {
public ComputeNodeListOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} }
|
public class class_name {
public static String determinePluginVersion() {
if (pluginVersion == null) {
final String fileName = "META-INF/gradle-plugins/thorntail.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String version;
try (InputStream stream = loader.getResourceAsStream(fileName)) {
Properties props = new Properties();
props.load(stream);
version = props.getProperty("implementation-version");
} catch (IOException e) {
throw new IllegalStateException("Unable to locate file: " + fileName, e);
}
pluginVersion = version;
}
return pluginVersion;
} }
|
public class class_name {
public static String determinePluginVersion() {
if (pluginVersion == null) {
final String fileName = "META-INF/gradle-plugins/thorntail.properties";
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String version;
try (InputStream stream = loader.getResourceAsStream(fileName)) {
Properties props = new Properties();
props.load(stream); // depends on control dependency: [if], data = [none]
version = props.getProperty("implementation-version"); // depends on control dependency: [if], data = [none]
} catch (IOException e) {
throw new IllegalStateException("Unable to locate file: " + fileName, e);
}
pluginVersion = version;
}
return pluginVersion;
} }
|
public class class_name {
public void marshall(DescribeImagesRequest describeImagesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeImagesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeImagesRequest.getNames(), NAMES_BINDING);
protocolMarshaller.marshall(describeImagesRequest.getArns(), ARNS_BINDING);
protocolMarshaller.marshall(describeImagesRequest.getType(), TYPE_BINDING);
protocolMarshaller.marshall(describeImagesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(describeImagesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeImagesRequest describeImagesRequest, ProtocolMarshaller protocolMarshaller) {
if (describeImagesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeImagesRequest.getNames(), NAMES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeImagesRequest.getArns(), ARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeImagesRequest.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeImagesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeImagesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.