code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private void parseStructuralVariationAttributes(String key, String value) {
if (key == null || value == null) {
return;
}
switch (key) {
case SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
// SVINSSEQ contains the sequence inserted AFTER the reference.
// To represent correctly the alternate, given that reference, we need to add the reference as allele context
// If the variant is normalized, the alleles will be trimmed, removing this "context"
if (alternates.size() > 1) {
throw new IllegalArgumentException("Found SVINSSEQ in a multi allelic variant!");
} else {
setCall(start + ":" + reference + ":" + alternates.get(0) + ":" + 0);
setAlternate(reference + value);
}
}
break;
case LEFT_SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
sv.setLeftSvInsSeq(value);
}
break;
case RIGHT_SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
sv.setRightSvInsSeq(value);
}
break;
case CIPOS_INFO:
String[] parts = value.split(",");
sv.setCiStartLeft(start + Integer.parseInt(parts[0]));
sv.setCiStartRight(start + Integer.parseInt(parts[1]));
break;
case CIEND_INFO:
parts = value.split(",");
sv.setCiEndLeft(end + Integer.parseInt(parts[0]));
sv.setCiEndRight(end + Integer.parseInt(parts[1]));
break;
}
} }
|
public class class_name {
private void parseStructuralVariationAttributes(String key, String value) {
if (key == null || value == null) {
return; // depends on control dependency: [if], data = [none]
}
switch (key) {
case SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
// SVINSSEQ contains the sequence inserted AFTER the reference.
// To represent correctly the alternate, given that reference, we need to add the reference as allele context
// If the variant is normalized, the alleles will be trimmed, removing this "context"
if (alternates.size() > 1) {
throw new IllegalArgumentException("Found SVINSSEQ in a multi allelic variant!");
} else {
setCall(start + ":" + reference + ":" + alternates.get(0) + ":" + 0); // depends on control dependency: [if], data = [none]
setAlternate(reference + value); // depends on control dependency: [if], data = [none]
}
}
break;
case LEFT_SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
sv.setLeftSvInsSeq(value); // depends on control dependency: [if], data = [none]
}
break;
case RIGHT_SVINSSEQ_INFO:
// Seen DELETIONS with this field set. Makes no sense
if (VariantType.INSERTION.equals(type)) {
sv.setRightSvInsSeq(value); // depends on control dependency: [if], data = [none]
}
break;
case CIPOS_INFO:
String[] parts = value.split(",");
sv.setCiStartLeft(start + Integer.parseInt(parts[0]));
sv.setCiStartRight(start + Integer.parseInt(parts[1]));
break;
case CIEND_INFO:
parts = value.split(",");
sv.setCiEndLeft(end + Integer.parseInt(parts[0]));
sv.setCiEndRight(end + Integer.parseInt(parts[1]));
break;
}
} }
|
public class class_name {
public static RuntimeException onRejectedExecution(Throwable original,
@Nullable Subscription subscription,
@Nullable Throwable suppressed,
@Nullable Object dataSignal,
Context context) {
//we "cheat" to apply the special key for onRejectedExecution in onOperatorError
if (context.hasKey(Hooks.KEY_ON_REJECTED_EXECUTION)) {
context = context.put(Hooks.KEY_ON_OPERATOR_ERROR, context.get(Hooks.KEY_ON_REJECTED_EXECUTION));
}
//don't create REE if original is a reactor-produced REE (not including singletons)
RejectedExecutionException ree = Exceptions.failWithRejected(original);
if (suppressed != null) {
ree.addSuppressed(suppressed);
}
if (dataSignal != null) {
return Exceptions.propagate(Operators.onOperatorError(subscription, ree,
dataSignal, context));
}
return Exceptions.propagate(Operators.onOperatorError(subscription, ree, context));
} }
|
public class class_name {
public static RuntimeException onRejectedExecution(Throwable original,
@Nullable Subscription subscription,
@Nullable Throwable suppressed,
@Nullable Object dataSignal,
Context context) {
//we "cheat" to apply the special key for onRejectedExecution in onOperatorError
if (context.hasKey(Hooks.KEY_ON_REJECTED_EXECUTION)) {
context = context.put(Hooks.KEY_ON_OPERATOR_ERROR, context.get(Hooks.KEY_ON_REJECTED_EXECUTION)); // depends on control dependency: [if], data = [none]
}
//don't create REE if original is a reactor-produced REE (not including singletons)
RejectedExecutionException ree = Exceptions.failWithRejected(original);
if (suppressed != null) {
ree.addSuppressed(suppressed); // depends on control dependency: [if], data = [(suppressed]
}
if (dataSignal != null) {
return Exceptions.propagate(Operators.onOperatorError(subscription, ree,
dataSignal, context)); // depends on control dependency: [if], data = [none]
}
return Exceptions.propagate(Operators.onOperatorError(subscription, ree, context));
} }
|
public class class_name {
private boolean shouldCreateInverse(Relation forward) {
if (forward.isIntermediate()) {
AssociationDirection direction = forward.getMiddleEntity().getEntityConfig().getAssociationDirection();
ColumnConfig leftCc = forward.getMiddleToLeft().getFromAttribute().getColumnConfig();
return AssociationDirection.BIDIRECTIONAL == direction //
|| (forward.isManyToMany() && leftCc.getManyToManyConfig() != null) //
|| (forward.isManyToOne() && leftCc.getOneToManyConfig() != null) //
|| (forward.isOneToOne() && leftCc.getInverseOneToOneConfig() != null);
} else {
ColumnConfig cc = forward.getFromAttribute().getColumnConfig();
return AssociationDirection.BIDIRECTIONAL == cc.getAssociationDirection() //
|| (forward.isManyToOne() && cc.getOneToManyConfig() != null) //
|| (forward.isOneToOne() && cc.getInverseOneToOneConfig() != null);
}
} }
|
public class class_name {
private boolean shouldCreateInverse(Relation forward) {
if (forward.isIntermediate()) {
AssociationDirection direction = forward.getMiddleEntity().getEntityConfig().getAssociationDirection();
ColumnConfig leftCc = forward.getMiddleToLeft().getFromAttribute().getColumnConfig();
return AssociationDirection.BIDIRECTIONAL == direction //
|| (forward.isManyToMany() && leftCc.getManyToManyConfig() != null) //
|| (forward.isManyToOne() && leftCc.getOneToManyConfig() != null) //
|| (forward.isOneToOne() && leftCc.getInverseOneToOneConfig() != null); // depends on control dependency: [if], data = [none]
} else {
ColumnConfig cc = forward.getFromAttribute().getColumnConfig();
return AssociationDirection.BIDIRECTIONAL == cc.getAssociationDirection() //
|| (forward.isManyToOne() && cc.getOneToManyConfig() != null) //
|| (forward.isOneToOne() && cc.getInverseOneToOneConfig() != null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized void shutdown() {
if (isActive()) {
// mark this as no longer running
setActive(false);
if (topicConnection != null) {
try {
topicConnection.close();
} catch (Exception e) {
// do nothing
}
topicConnection = null;
}
}
} }
|
public class class_name {
public synchronized void shutdown() {
if (isActive()) {
// mark this as no longer running
setActive(false); // depends on control dependency: [if], data = [none]
if (topicConnection != null) {
try {
topicConnection.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// do nothing
} // depends on control dependency: [catch], data = [none]
topicConnection = null; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setLocationEngineRequest(@NonNull LocationEngineRequest locationEngineRequest) {
this.locationEngineRequest = locationEngineRequest;
if (isServiceAvailable()) {
navigationService.updateLocationEngineRequest(locationEngineRequest);
}
} }
|
public class class_name {
public void setLocationEngineRequest(@NonNull LocationEngineRequest locationEngineRequest) {
this.locationEngineRequest = locationEngineRequest;
if (isServiceAvailable()) {
navigationService.updateLocationEngineRequest(locationEngineRequest); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionInput) {
try {
log.debug("Executing request. operation name: '{}'. query: '{}'. variables '{}'", executionInput.getOperationName(), executionInput.getQuery(), executionInput.getVariables());
InstrumentationState instrumentationState = instrumentation.createState(new InstrumentationCreateStateParameters(this.graphQLSchema, executionInput));
InstrumentationExecutionParameters inputInstrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState);
executionInput = instrumentation.instrumentExecutionInput(executionInput, inputInstrumentationParameters);
InstrumentationExecutionParameters instrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState);
InstrumentationContext<ExecutionResult> executionInstrumentation = instrumentation.beginExecution(instrumentationParameters);
GraphQLSchema graphQLSchema = instrumentation.instrumentSchema(this.graphQLSchema, instrumentationParameters);
CompletableFuture<ExecutionResult> executionResult = parseValidateAndExecute(executionInput, graphQLSchema, instrumentationState);
//
// finish up instrumentation
executionResult = executionResult.whenComplete(executionInstrumentation::onCompleted);
//
// allow instrumentation to tweak the result
executionResult = executionResult.thenCompose(result -> instrumentation.instrumentExecutionResult(result, instrumentationParameters));
return executionResult;
} catch (AbortExecutionException abortException) {
return CompletableFuture.completedFuture(abortException.toExecutionResult());
}
} }
|
public class class_name {
public CompletableFuture<ExecutionResult> executeAsync(ExecutionInput executionInput) {
try {
log.debug("Executing request. operation name: '{}'. query: '{}'. variables '{}'", executionInput.getOperationName(), executionInput.getQuery(), executionInput.getVariables()); // depends on control dependency: [try], data = [none]
InstrumentationState instrumentationState = instrumentation.createState(new InstrumentationCreateStateParameters(this.graphQLSchema, executionInput));
InstrumentationExecutionParameters inputInstrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState);
executionInput = instrumentation.instrumentExecutionInput(executionInput, inputInstrumentationParameters); // depends on control dependency: [try], data = [none]
InstrumentationExecutionParameters instrumentationParameters = new InstrumentationExecutionParameters(executionInput, this.graphQLSchema, instrumentationState);
InstrumentationContext<ExecutionResult> executionInstrumentation = instrumentation.beginExecution(instrumentationParameters);
GraphQLSchema graphQLSchema = instrumentation.instrumentSchema(this.graphQLSchema, instrumentationParameters);
CompletableFuture<ExecutionResult> executionResult = parseValidateAndExecute(executionInput, graphQLSchema, instrumentationState);
//
// finish up instrumentation
executionResult = executionResult.whenComplete(executionInstrumentation::onCompleted); // depends on control dependency: [try], data = [none]
//
// allow instrumentation to tweak the result
executionResult = executionResult.thenCompose(result -> instrumentation.instrumentExecutionResult(result, instrumentationParameters)); // depends on control dependency: [try], data = [none]
return executionResult; // depends on control dependency: [try], data = [none]
} catch (AbortExecutionException abortException) {
return CompletableFuture.completedFuture(abortException.toExecutionResult());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int safeMultiply(int a, int b)
{
if (a == 0 || b == 0) {
return 0;
}
long max = a < 0 == b < 0 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
if ((b > 0 && b > max / a) || (b < 0 && b < max / a)) {
throw new ArithmeticException(
"Int overflow: " + a + " * " + b);
}
return a * b;
} }
|
public class class_name {
public static int safeMultiply(int a, int b)
{
if (a == 0 || b == 0) {
return 0; // depends on control dependency: [if], data = [none]
}
long max = a < 0 == b < 0 ? Integer.MAX_VALUE : Integer.MIN_VALUE;
if ((b > 0 && b > max / a) || (b < 0 && b < max / a)) {
throw new ArithmeticException(
"Int overflow: " + a + " * " + b);
}
return a * b;
} }
|
public class class_name {
private static boolean assertManagedBeanClassValidity(final ClassInfo managedBeanClass) {
final short flags = managedBeanClass.flags();
final String className = managedBeanClass.name().toString();
// must *not* be an interface
if (Modifier.isInterface(flags)) {
ROOT_LOGGER.invalidManagedBeanInterface("MB.2.1.1", className);
return false;
}
// bean class must *not* be abstract or final
if (Modifier.isAbstract(flags) || Modifier.isFinal(flags)) {
ROOT_LOGGER.invalidManagedBeanAbstractOrFinal("MB.2.1.1", className);
return false;
}
// valid class
return true;
} }
|
public class class_name {
private static boolean assertManagedBeanClassValidity(final ClassInfo managedBeanClass) {
final short flags = managedBeanClass.flags();
final String className = managedBeanClass.name().toString();
// must *not* be an interface
if (Modifier.isInterface(flags)) {
ROOT_LOGGER.invalidManagedBeanInterface("MB.2.1.1", className); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// bean class must *not* be abstract or final
if (Modifier.isAbstract(flags) || Modifier.isFinal(flags)) {
ROOT_LOGGER.invalidManagedBeanAbstractOrFinal("MB.2.1.1", className); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// valid class
return true;
} }
|
public class class_name {
public void marshall(ActionConfigurationProperty actionConfigurationProperty, ProtocolMarshaller protocolMarshaller) {
if (actionConfigurationProperty == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(actionConfigurationProperty.getName(), NAME_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getRequired(), REQUIRED_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getKey(), KEY_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getSecret(), SECRET_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getQueryable(), QUERYABLE_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(actionConfigurationProperty.getType(), TYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ActionConfigurationProperty actionConfigurationProperty, ProtocolMarshaller protocolMarshaller) {
if (actionConfigurationProperty == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(actionConfigurationProperty.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getRequired(), REQUIRED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getSecret(), SECRET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getQueryable(), QUERYABLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(actionConfigurationProperty.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int birthdayCompare (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
if (EqualsHelper.identityEqual (aDate1, aDate2))
return 0;
if (aDate1 == null)
return -1;
if (aDate2 == null)
return 1;
// first compare month
int ret = aDate1.getMonth ().compareTo (aDate2.getMonth ());
if (ret == 0)
{
// on equal month, compare day of month
ret = aDate1.getDayOfMonth () - aDate2.getDayOfMonth ();
}
return ret;
} }
|
public class class_name {
public static int birthdayCompare (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
if (EqualsHelper.identityEqual (aDate1, aDate2))
return 0;
if (aDate1 == null)
return -1;
if (aDate2 == null)
return 1;
// first compare month
int ret = aDate1.getMonth ().compareTo (aDate2.getMonth ());
if (ret == 0)
{
// on equal month, compare day of month
ret = aDate1.getDayOfMonth () - aDate2.getDayOfMonth (); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
public static CodecFactory getCodecFactory(Optional<String> codecName, Optional<String> deflateLevel) {
if (!codecName.isPresent()) {
return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL);
} else if (codecName.get().equalsIgnoreCase(DataFileConstants.DEFLATE_CODEC)) {
if (!deflateLevel.isPresent()) {
return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL);
}
return CodecFactory.deflateCodec(Integer.parseInt(deflateLevel.get()));
} else {
return CodecFactory.fromString(codecName.get().toLowerCase());
}
} }
|
public class class_name {
public static CodecFactory getCodecFactory(Optional<String> codecName, Optional<String> deflateLevel) {
if (!codecName.isPresent()) {
return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); // depends on control dependency: [if], data = [none]
} else if (codecName.get().equalsIgnoreCase(DataFileConstants.DEFLATE_CODEC)) {
if (!deflateLevel.isPresent()) {
return CodecFactory.deflateCodec(ConfigurationKeys.DEFAULT_DEFLATE_LEVEL); // depends on control dependency: [if], data = [none]
}
return CodecFactory.deflateCodec(Integer.parseInt(deflateLevel.get())); // depends on control dependency: [if], data = [none]
} else {
return CodecFactory.fromString(codecName.get().toLowerCase()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public java.util.List<ResourcePolicy> getResourcePolicies() {
if (resourcePolicies == null) {
resourcePolicies = new com.amazonaws.internal.SdkInternalList<ResourcePolicy>();
}
return resourcePolicies;
} }
|
public class class_name {
public java.util.List<ResourcePolicy> getResourcePolicies() {
if (resourcePolicies == null) {
resourcePolicies = new com.amazonaws.internal.SdkInternalList<ResourcePolicy>(); // depends on control dependency: [if], data = [none]
}
return resourcePolicies;
} }
|
public class class_name {
public void statementGuaranteesDeterminism(boolean hasLimitOrOffset,
boolean order,
String contentDeterminismDetail) {
m_statementHasLimitOrOffset = hasLimitOrOffset;
m_statementIsOrderDeterministic = order;
if (contentDeterminismDetail != null) {
m_contentDeterminismDetail = contentDeterminismDetail;
}
} }
|
public class class_name {
public void statementGuaranteesDeterminism(boolean hasLimitOrOffset,
boolean order,
String contentDeterminismDetail) {
m_statementHasLimitOrOffset = hasLimitOrOffset;
m_statementIsOrderDeterministic = order;
if (contentDeterminismDetail != null) {
m_contentDeterminismDetail = contentDeterminismDetail; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void initRemoteStub(ObjectOutputStream daOut)
{
try {
daOut.writeUTF(fieldNameToCheck != null ? fieldNameToCheck : ProxyConstants.NULL);
daOut.writeObject(m_strToCompare);
daOut.writeUTF(m_strSeekSign);
this.writeField(daOut, m_convFlag);
daOut.writeBoolean(m_bDontFilterIfNullCompare);
this.writeField(daOut, m_fldToCheck);
this.writeField(daOut, m_fldToCompare);
String strFieldNameToCheck = DBConstants.BLANK;
if (m_fldToCheck != null)
strFieldNameToCheck = m_fldToCheck.getFieldName(false, true); // Full file.fieldname
daOut.writeUTF(strFieldNameToCheck);
} catch (IOException ex) {
ex.printStackTrace();
}
} }
|
public class class_name {
public void initRemoteStub(ObjectOutputStream daOut)
{
try {
daOut.writeUTF(fieldNameToCheck != null ? fieldNameToCheck : ProxyConstants.NULL); // depends on control dependency: [try], data = [none]
daOut.writeObject(m_strToCompare); // depends on control dependency: [try], data = [none]
daOut.writeUTF(m_strSeekSign); // depends on control dependency: [try], data = [none]
this.writeField(daOut, m_convFlag); // depends on control dependency: [try], data = [none]
daOut.writeBoolean(m_bDontFilterIfNullCompare); // depends on control dependency: [try], data = [none]
this.writeField(daOut, m_fldToCheck); // depends on control dependency: [try], data = [none]
this.writeField(daOut, m_fldToCompare); // depends on control dependency: [try], data = [none]
String strFieldNameToCheck = DBConstants.BLANK;
if (m_fldToCheck != null)
strFieldNameToCheck = m_fldToCheck.getFieldName(false, true); // Full file.fieldname
daOut.writeUTF(strFieldNameToCheck); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public OutlierResult run(Database database, Relation<N> spatial, Relation<O> relation) {
final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(database, spatial);
DistanceQuery<O> distFunc = getNonSpatialDistanceFunction().instantiate(relation);
WritableDoubleDataStore lrds = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_TEMP | DataStoreFactory.HINT_HOT);
WritableDoubleDataStore lofs = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
DoubleMinMax lofminmax = new DoubleMinMax();
// Compute densities
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DBIDs neighbors = npred.getNeighborDBIDs(iditer);
double avg = 0;
for(DBIDIter iter = neighbors.iter(); iter.valid(); iter.advance()) {
avg += distFunc.distance(iditer, iter);
}
double lrd = 1 / (avg / neighbors.size());
if(Double.isNaN(lrd)) {
lrd = 0;
}
lrds.putDouble(iditer, lrd);
}
// Compute density quotients
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DBIDs neighbors = npred.getNeighborDBIDs(iditer);
double avg = 0;
for(DBIDIter iter = neighbors.iter(); iter.valid(); iter.advance()) {
avg += lrds.doubleValue(iter);
}
final double lrd = (avg / neighbors.size()) / lrds.doubleValue(iditer);
if(!Double.isNaN(lrd)) {
lofs.putDouble(iditer, lrd);
lofminmax.put(lrd);
}
else {
lofs.putDouble(iditer, 0.0);
}
}
// Build result representation.
DoubleRelation scoreResult = new MaterializedDoubleRelation("Spatial Outlier Factor", "sof-outlier", lofs, relation.getDBIDs());
OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(lofminmax.getMin(), lofminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0);
OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
or.addChildResult(npred);
return or;
} }
|
public class class_name {
public OutlierResult run(Database database, Relation<N> spatial, Relation<O> relation) {
final NeighborSetPredicate npred = getNeighborSetPredicateFactory().instantiate(database, spatial);
DistanceQuery<O> distFunc = getNonSpatialDistanceFunction().instantiate(relation);
WritableDoubleDataStore lrds = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_TEMP | DataStoreFactory.HINT_HOT);
WritableDoubleDataStore lofs = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
DoubleMinMax lofminmax = new DoubleMinMax();
// Compute densities
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DBIDs neighbors = npred.getNeighborDBIDs(iditer);
double avg = 0;
for(DBIDIter iter = neighbors.iter(); iter.valid(); iter.advance()) {
avg += distFunc.distance(iditer, iter); // depends on control dependency: [for], data = [iter]
}
double lrd = 1 / (avg / neighbors.size());
if(Double.isNaN(lrd)) {
lrd = 0; // depends on control dependency: [if], data = [none]
}
lrds.putDouble(iditer, lrd); // depends on control dependency: [for], data = [iditer]
}
// Compute density quotients
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
DBIDs neighbors = npred.getNeighborDBIDs(iditer);
double avg = 0;
for(DBIDIter iter = neighbors.iter(); iter.valid(); iter.advance()) {
avg += lrds.doubleValue(iter); // depends on control dependency: [for], data = [iter]
}
final double lrd = (avg / neighbors.size()) / lrds.doubleValue(iditer);
if(!Double.isNaN(lrd)) {
lofs.putDouble(iditer, lrd); // depends on control dependency: [if], data = [none]
lofminmax.put(lrd); // depends on control dependency: [if], data = [none]
}
else {
lofs.putDouble(iditer, 0.0); // depends on control dependency: [if], data = [none]
}
}
// Build result representation.
DoubleRelation scoreResult = new MaterializedDoubleRelation("Spatial Outlier Factor", "sof-outlier", lofs, relation.getDBIDs());
OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta(lofminmax.getMin(), lofminmax.getMax(), 0.0, Double.POSITIVE_INFINITY, 1.0);
OutlierResult or = new OutlierResult(scoreMeta, scoreResult);
or.addChildResult(npred);
return or;
} }
|
public class class_name {
public void leave(DelegateExecution childExecution) {
DelegateExecution multiInstanceRootExecution = getMultiInstanceRootExecution(childExecution);
int nrOfInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_INSTANCES);
int loopCounter = getLoopVariable(childExecution, getCollectionElementIndexVariable()) + 1;
int nrOfCompletedInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
int nrOfActiveInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_ACTIVE_INSTANCES);
setLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
setLoopVariable(childExecution, getCollectionElementIndexVariable(), loopCounter);
logLoopDetails(childExecution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);
Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) childExecution, null);
callActivityEndListeners(childExecution);
//executeCompensationBoundaryEvents(execution.getCurrentFlowElement(), execution);
if (loopCounter >= nrOfInstances || completionConditionSatisfied(multiInstanceRootExecution)) {
removeLocalLoopVariable(childExecution, getCollectionElementIndexVariable());
multiInstanceRootExecution.setMultiInstanceRoot(false);
multiInstanceRootExecution.setScope(false);
multiInstanceRootExecution.setCurrentFlowElement(childExecution.getCurrentFlowElement());
Context.getCommandContext().getExecutionEntityManager().deleteChildExecutions((ExecutionEntity) multiInstanceRootExecution, "MI_END", false);
super.leave(multiInstanceRootExecution);
} else {
try {
if (childExecution.getCurrentFlowElement() instanceof SubProcess) {
ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager();
ExecutionEntity executionToContinue = executionEntityManager.createChildExecution((ExecutionEntity) multiInstanceRootExecution);
executionToContinue.setCurrentFlowElement(childExecution.getCurrentFlowElement());
executionToContinue.setScope(true);
setLoopVariable(executionToContinue, getCollectionElementIndexVariable(), loopCounter);
executeOriginalBehavior(executionToContinue, loopCounter);
} else {
executeOriginalBehavior(childExecution, loopCounter);
}
} catch (BpmnError error) {
// re-throw business fault so that it can be caught by an Error
// Intermediate Event or Error Event Sub-Process in the process
throw error;
} catch (Exception e) {
throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e);
}
}
} }
|
public class class_name {
public void leave(DelegateExecution childExecution) {
DelegateExecution multiInstanceRootExecution = getMultiInstanceRootExecution(childExecution);
int nrOfInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_INSTANCES);
int loopCounter = getLoopVariable(childExecution, getCollectionElementIndexVariable()) + 1;
int nrOfCompletedInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
int nrOfActiveInstances = getLoopVariable(multiInstanceRootExecution, NUMBER_OF_ACTIVE_INSTANCES);
setLoopVariable(multiInstanceRootExecution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
setLoopVariable(childExecution, getCollectionElementIndexVariable(), loopCounter);
logLoopDetails(childExecution, "instance completed", loopCounter, nrOfCompletedInstances, nrOfActiveInstances, nrOfInstances);
Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) childExecution, null);
callActivityEndListeners(childExecution);
//executeCompensationBoundaryEvents(execution.getCurrentFlowElement(), execution);
if (loopCounter >= nrOfInstances || completionConditionSatisfied(multiInstanceRootExecution)) {
removeLocalLoopVariable(childExecution, getCollectionElementIndexVariable()); // depends on control dependency: [if], data = [none]
multiInstanceRootExecution.setMultiInstanceRoot(false); // depends on control dependency: [if], data = [none]
multiInstanceRootExecution.setScope(false); // depends on control dependency: [if], data = [none]
multiInstanceRootExecution.setCurrentFlowElement(childExecution.getCurrentFlowElement()); // depends on control dependency: [if], data = [none]
Context.getCommandContext().getExecutionEntityManager().deleteChildExecutions((ExecutionEntity) multiInstanceRootExecution, "MI_END", false); // depends on control dependency: [if], data = [none]
super.leave(multiInstanceRootExecution); // depends on control dependency: [if], data = [none]
} else {
try {
if (childExecution.getCurrentFlowElement() instanceof SubProcess) {
ExecutionEntityManager executionEntityManager = Context.getCommandContext().getExecutionEntityManager();
ExecutionEntity executionToContinue = executionEntityManager.createChildExecution((ExecutionEntity) multiInstanceRootExecution);
executionToContinue.setCurrentFlowElement(childExecution.getCurrentFlowElement()); // depends on control dependency: [if], data = [none]
executionToContinue.setScope(true); // depends on control dependency: [if], data = [none]
setLoopVariable(executionToContinue, getCollectionElementIndexVariable(), loopCounter); // depends on control dependency: [if], data = [none]
executeOriginalBehavior(executionToContinue, loopCounter); // depends on control dependency: [if], data = [none]
} else {
executeOriginalBehavior(childExecution, loopCounter); // depends on control dependency: [if], data = [none]
}
} catch (BpmnError error) {
// re-throw business fault so that it can be caught by an Error
// Intermediate Event or Error Event Sub-Process in the process
throw error;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new ActivitiException("Could not execute inner activity behavior of multi instance behavior", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
boolean unregisterConnection(ConnectionManager cm, ConnectionListener cl, Object c)
{
if (clToC != null && clToC.get(cl) != null)
{
List<Object> l = clToC.get(cl);
return l.remove(c);
}
return false;
} }
|
public class class_name {
boolean unregisterConnection(ConnectionManager cm, ConnectionListener cl, Object c)
{
if (clToC != null && clToC.get(cl) != null)
{
List<Object> l = clToC.get(cl);
return l.remove(c); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static double rootMeansSquaredError(double[] real, double[] predicted) {
double ret = 0.0;
for (int i = 0; i < real.length; i++) {
ret += Math.pow((real[i] - predicted[i]), 2);
}
return Math.sqrt(ret / real.length);
} }
|
public class class_name {
public static double rootMeansSquaredError(double[] real, double[] predicted) {
double ret = 0.0;
for (int i = 0; i < real.length; i++) {
ret += Math.pow((real[i] - predicted[i]), 2); // depends on control dependency: [for], data = [i]
}
return Math.sqrt(ret / real.length);
} }
|
public class class_name {
public File[] getFiles() {
String path = mRequest.getParameter("path");
if (path == null) {
path = mApp.getInitParameter("defaultPath");
}
if (path == null) {
path = "/";
}
File activefile = new File(path);
if( activefile.isDirectory()) {
return activefile.listFiles();
} else {
return null;
}
} }
|
public class class_name {
public File[] getFiles() {
String path = mRequest.getParameter("path");
if (path == null) {
path = mApp.getInitParameter("defaultPath"); // depends on control dependency: [if], data = [none]
}
if (path == null) {
path = "/"; // depends on control dependency: [if], data = [none]
}
File activefile = new File(path);
if( activefile.isDirectory()) {
return activefile.listFiles(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String getCurrentStyle(Element elem, String name) {
name = hyphenize(name);
String propVal = getComputedStyle(elem, name);
if (CmsDomUtil.Style.opacity.name().equals(name) && ((propVal == null) || (propVal.trim().length() == 0))) {
propVal = "1";
}
return propVal;
} }
|
public class class_name {
public String getCurrentStyle(Element elem, String name) {
name = hyphenize(name);
String propVal = getComputedStyle(elem, name);
if (CmsDomUtil.Style.opacity.name().equals(name) && ((propVal == null) || (propVal.trim().length() == 0))) {
propVal = "1"; // depends on control dependency: [if], data = [none]
}
return propVal;
} }
|
public class class_name {
public static long pow(final long b, final long e) {
long base = b;
long exp = e;
long result = 1;
while (exp != 0) {
if ((exp & 1) != 0) {
result *= base;
}
exp >>>= 1;
base *= base;
}
return result;
} }
|
public class class_name {
public static long pow(final long b, final long e) {
long base = b;
long exp = e;
long result = 1;
while (exp != 0) {
if ((exp & 1) != 0) {
result *= base; // depends on control dependency: [if], data = [none]
}
exp >>>= 1; // depends on control dependency: [while], data = [none]
base *= base; // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public InputStream getInputStream() throws IOException, RepositoryException
{
final PipedInputStream pin = new PipedInputStream();
final PipedOutputStream pout = new PipedOutputStream(pin);
try
{
new Thread()
{
/*
* (non-Javadoc)
*
* @see java.lang.Thread#run()
*/
public void run()
{
try
{
if (isSystem)
{
node.getSession().exportSystemView(node.getPath(), pout, false, false);
}
else
{
node.getSession().exportDocumentView(node.getPath(), pout, false, false);
}
}
catch (Exception e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
finally
{
try
{
pout.flush();
pout.close();
}
catch (Exception e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
}
}.start();
return pin;
}
catch (Exception e)
{
LOG.error(e.getLocalizedMessage(), e);
throw new IOException("can't get input stream", e);
}
} }
|
public class class_name {
public InputStream getInputStream() throws IOException, RepositoryException
{
final PipedInputStream pin = new PipedInputStream();
final PipedOutputStream pout = new PipedOutputStream(pin);
try
{
new Thread()
{
/*
* (non-Javadoc)
*
* @see java.lang.Thread#run()
*/
public void run()
{
try
{
if (isSystem)
{
node.getSession().exportSystemView(node.getPath(), pout, false, false); // depends on control dependency: [if], data = [none]
}
else
{
node.getSession().exportDocumentView(node.getPath(), pout, false, false); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
finally
{
try
{
pout.flush(); // depends on control dependency: [try], data = [none]
pout.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage()); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
}.start();
return pin;
}
catch (Exception e)
{
LOG.error(e.getLocalizedMessage(), e);
throw new IOException("can't get input stream", e);
}
} }
|
public class class_name {
public INDArray[] eval(Map<String, INDArray> inputs) {
SameDiff execPipeline = dup();
List<DifferentialFunction> opExecAction = execPipeline.exec().getRight();
if (opExecAction.isEmpty())
throw new IllegalStateException("No ops found to execute.");
INDArray[] ret = new INDArray[opExecAction.size()];
for (int i = 0; i < ret.length; i++) {
val varName = opExecAction.get(i).outputVariables()[0].getVarName();
ret[i] = execPipeline.getArrForVarName(varName);
}
return ret;
} }
|
public class class_name {
public INDArray[] eval(Map<String, INDArray> inputs) {
SameDiff execPipeline = dup();
List<DifferentialFunction> opExecAction = execPipeline.exec().getRight();
if (opExecAction.isEmpty())
throw new IllegalStateException("No ops found to execute.");
INDArray[] ret = new INDArray[opExecAction.size()];
for (int i = 0; i < ret.length; i++) {
val varName = opExecAction.get(i).outputVariables()[0].getVarName();
ret[i] = execPipeline.getArrForVarName(varName); // depends on control dependency: [for], data = [i]
}
return ret;
} }
|
public class class_name {
public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.get(ATTACHED_PROPERTY_SOURCE_NAME);
if (attached != null && attached.getSource() != sources) {
sources.remove(ATTACHED_PROPERTY_SOURCE_NAME);
attached = null;
}
if (attached == null) {
sources.addFirst(new ConfigurationPropertySourcesPropertySource(
ATTACHED_PROPERTY_SOURCE_NAME,
new SpringConfigurationPropertySources(sources)));
}
} }
|
public class class_name {
public static void attach(Environment environment) {
Assert.isInstanceOf(ConfigurableEnvironment.class, environment);
MutablePropertySources sources = ((ConfigurableEnvironment) environment)
.getPropertySources();
PropertySource<?> attached = sources.get(ATTACHED_PROPERTY_SOURCE_NAME);
if (attached != null && attached.getSource() != sources) {
sources.remove(ATTACHED_PROPERTY_SOURCE_NAME); // depends on control dependency: [if], data = [none]
attached = null; // depends on control dependency: [if], data = [none]
}
if (attached == null) {
sources.addFirst(new ConfigurationPropertySourcesPropertySource(
ATTACHED_PROPERTY_SOURCE_NAME,
new SpringConfigurationPropertySources(sources))); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public long getStreamSegmentId(String streamSegmentName, boolean updateLastUsed) {
synchronized (this.lock) {
StreamSegmentMetadata metadata = this.metadataByName.getOrDefault(streamSegmentName, null);
if (updateLastUsed && metadata != null) {
metadata.setLastUsed(getOperationSequenceNumber());
}
return metadata != null ? metadata.getId() : NO_STREAM_SEGMENT_ID;
}
} }
|
public class class_name {
@Override
public long getStreamSegmentId(String streamSegmentName, boolean updateLastUsed) {
synchronized (this.lock) {
StreamSegmentMetadata metadata = this.metadataByName.getOrDefault(streamSegmentName, null);
if (updateLastUsed && metadata != null) {
metadata.setLastUsed(getOperationSequenceNumber()); // depends on control dependency: [if], data = [none]
}
return metadata != null ? metadata.getId() : NO_STREAM_SEGMENT_ID;
}
} }
|
public class class_name {
public static Object getComponentInstance(String name, HttpServletRequest request) {
ServletContext sc = request.getSession().getServletContext();
ContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));
if (!containerWrapper.isStart()) {
Debug.logError("JdonFramework not yet started, please try later ", module);
return null;
}
return containerWrapper.lookup(name);
} }
|
public class class_name {
public static Object getComponentInstance(String name, HttpServletRequest request) {
ServletContext sc = request.getSession().getServletContext();
ContainerWrapper containerWrapper = scf.findContainer(new ServletContextWrapper(sc));
if (!containerWrapper.isStart()) {
Debug.logError("JdonFramework not yet started, please try later ", module);
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
return containerWrapper.lookup(name);
} }
|
public class class_name {
@Nonnull
public Word<I> canonicalNext(Alphabet<I> sigma) {
int len = length();
Object[] symbols = new Object[len];
writeToArray(0, symbols, 0, len);
int alphabetSize = sigma.size();
int i = 0;
boolean overflow = true;
for (I sym : this) {
int nextIdx = (sigma.getSymbolIndex(sym) + 1) % alphabetSize;
symbols[i++] = sigma.getSymbol(nextIdx);
if (nextIdx != 0) {
overflow = false;
break;
}
}
while (i < len) {
symbols[i] = getSymbol(i);
i++;
}
if (overflow) {
Object[] newSymbols = new Object[len + 1];
newSymbols[0] = sigma.getSymbol(0);
System.arraycopy(symbols, 0, newSymbols, 1, len);
symbols = newSymbols;
}
return new SharedWord<>(symbols);
} }
|
public class class_name {
@Nonnull
public Word<I> canonicalNext(Alphabet<I> sigma) {
int len = length();
Object[] symbols = new Object[len];
writeToArray(0, symbols, 0, len);
int alphabetSize = sigma.size();
int i = 0;
boolean overflow = true;
for (I sym : this) {
int nextIdx = (sigma.getSymbolIndex(sym) + 1) % alphabetSize;
symbols[i++] = sigma.getSymbol(nextIdx); // depends on control dependency: [for], data = [sym]
if (nextIdx != 0) {
overflow = false; // depends on control dependency: [if], data = [none]
break;
}
}
while (i < len) {
symbols[i] = getSymbol(i); // depends on control dependency: [while], data = [(i]
i++; // depends on control dependency: [while], data = [none]
}
if (overflow) {
Object[] newSymbols = new Object[len + 1];
newSymbols[0] = sigma.getSymbol(0); // depends on control dependency: [if], data = [none]
System.arraycopy(symbols, 0, newSymbols, 1, len); // depends on control dependency: [if], data = [none]
symbols = newSymbols; // depends on control dependency: [if], data = [none]
}
return new SharedWord<>(symbols);
} }
|
public class class_name {
@Override
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
throws RepositoryException
{
List<PropertyData> props = getReferencedPropertiesData(identifier);
if (skipVersionStorage)
{
List<PropertyData> result = new ArrayList<PropertyData>();
for (int i = 0, length = props.size(); i < length; i++)
{
PropertyData prop = props.get(i);
if (!prop.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
{
result.add(prop);
}
}
return result;
}
return props;
} }
|
public class class_name {
@Override
public List<PropertyData> getReferencesData(String identifier, boolean skipVersionStorage)
throws RepositoryException
{
List<PropertyData> props = getReferencedPropertiesData(identifier);
if (skipVersionStorage)
{
List<PropertyData> result = new ArrayList<PropertyData>();
for (int i = 0, length = props.size(); i < length; i++)
{
PropertyData prop = props.get(i);
if (!prop.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
{
result.add(prop); // depends on control dependency: [if], data = [none]
}
}
return result;
}
return props;
} }
|
public class class_name {
protected Logger getLogger() {
Logger l = this.logger;
if (l == null) {
l = LoggerFactory.getLogger(LOGGER_NAME);
this.logger = l;
}
return l;
} }
|
public class class_name {
protected Logger getLogger() {
Logger l = this.logger;
if (l == null) {
l = LoggerFactory.getLogger(LOGGER_NAME); // depends on control dependency: [if], data = [none]
this.logger = l; // depends on control dependency: [if], data = [none]
}
return l;
} }
|
public class class_name {
public java.util.Map<String, String> getEncryptionContextSubset() {
if (encryptionContextSubset == null) {
encryptionContextSubset = new com.amazonaws.internal.SdkInternalMap<String, String>();
}
return encryptionContextSubset;
} }
|
public class class_name {
public java.util.Map<String, String> getEncryptionContextSubset() {
if (encryptionContextSubset == null) {
encryptionContextSubset = new com.amazonaws.internal.SdkInternalMap<String, String>(); // depends on control dependency: [if], data = [none]
}
return encryptionContextSubset;
} }
|
public class class_name {
static boolean requiresUnicodeUnescape(final char[] text, final int offset, final int len) {
if (text == null) {
return false;
}
final int max = (offset + len);
for (int i = offset; i < max; i++) {
final char c = text[i];
if (c != ESCAPE_PREFIX || (i + 1) >= max) {
continue;
}
if (c == ESCAPE_PREFIX) {
final char c1 = text[i + 1];
if (c1 == ESCAPE_UHEXA_PREFIX2) {
// This can be a uhexa escape
return true;
}
}
}
return false;
} }
|
public class class_name {
static boolean requiresUnicodeUnescape(final char[] text, final int offset, final int len) {
if (text == null) {
return false; // depends on control dependency: [if], data = [none]
}
final int max = (offset + len);
for (int i = offset; i < max; i++) {
final char c = text[i];
if (c != ESCAPE_PREFIX || (i + 1) >= max) {
continue;
}
if (c == ESCAPE_PREFIX) {
final char c1 = text[i + 1];
if (c1 == ESCAPE_UHEXA_PREFIX2) {
// This can be a uhexa escape
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
private void fireUpdated(Object source) {
for (int i=0;i<listeners.size();i++) {
((InputPanelListener) listeners.get(i)).valueUpdated(this);
}
} }
|
public class class_name {
private void fireUpdated(Object source) {
for (int i=0;i<listeners.size();i++) {
((InputPanelListener) listeners.get(i)).valueUpdated(this);
// depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
@Override
public void publishData(Collection<? extends WorkUnitState> states) throws IOException {
LOG.info("Start publishing data");
int branches = this.state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1);
Set<String> emptiedDestTables = Sets.newHashSet();
final Connection conn = createConnection();
final JdbcWriterCommands commands = this.jdbcWriterCommandsFactory.newInstance(this.state, conn);
try {
conn.setAutoCommit(false);
for (int i = 0; i < branches; i++) {
final String destinationTable = this.state
.getProp(ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_FINAL_TABLE_NAME, branches, i));
final String databaseName =
this.state.getProp(ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_DATABASE_NAME, branches, i));
Preconditions.checkNotNull(destinationTable);
if (this.state.getPropAsBoolean(
ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_REPLACE_FINAL_TABLE, branches, i), false)
&& !emptiedDestTables.contains(destinationTable)) {
LOG.info("Deleting table " + destinationTable);
commands.deleteAll(databaseName, destinationTable);
emptiedDestTables.add(destinationTable);
}
Map<String, List<WorkUnitState>> stagingTables = getStagingTables(states, branches, i);
for (Map.Entry<String, List<WorkUnitState>> entry : stagingTables.entrySet()) {
String stagingTable = entry.getKey();
LOG.info("Copying data from staging table " + stagingTable + " into destination table " + destinationTable);
commands.copyTable(databaseName, stagingTable, destinationTable);
for (WorkUnitState workUnitState : entry.getValue()) {
workUnitState.setWorkingState(WorkUnitState.WorkingState.COMMITTED);
}
}
}
LOG.info("Commit publish data");
conn.commit();
} catch (Exception e) {
try {
LOG.error("Failed publishing. Rolling back.");
conn.rollback();
} catch (SQLException se) {
LOG.error("Failed rolling back.", se);
}
throw new RuntimeException("Failed publishing", e);
} finally {
try {
conn.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
} }
|
public class class_name {
@Override
public void publishData(Collection<? extends WorkUnitState> states) throws IOException {
LOG.info("Start publishing data");
int branches = this.state.getPropAsInt(ConfigurationKeys.FORK_BRANCHES_KEY, 1);
Set<String> emptiedDestTables = Sets.newHashSet();
final Connection conn = createConnection();
final JdbcWriterCommands commands = this.jdbcWriterCommandsFactory.newInstance(this.state, conn);
try {
conn.setAutoCommit(false);
for (int i = 0; i < branches; i++) {
final String destinationTable = this.state
.getProp(ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_FINAL_TABLE_NAME, branches, i));
final String databaseName =
this.state.getProp(ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_DATABASE_NAME, branches, i));
Preconditions.checkNotNull(destinationTable); // depends on control dependency: [for], data = [none]
if (this.state.getPropAsBoolean(
ForkOperatorUtils.getPropertyNameForBranch(JDBC_PUBLISHER_REPLACE_FINAL_TABLE, branches, i), false)
&& !emptiedDestTables.contains(destinationTable)) {
LOG.info("Deleting table " + destinationTable); // depends on control dependency: [if], data = [none]
commands.deleteAll(databaseName, destinationTable); // depends on control dependency: [if], data = [none]
emptiedDestTables.add(destinationTable); // depends on control dependency: [if], data = [none]
}
Map<String, List<WorkUnitState>> stagingTables = getStagingTables(states, branches, i);
for (Map.Entry<String, List<WorkUnitState>> entry : stagingTables.entrySet()) {
String stagingTable = entry.getKey();
LOG.info("Copying data from staging table " + stagingTable + " into destination table " + destinationTable); // depends on control dependency: [for], data = [none]
commands.copyTable(databaseName, stagingTable, destinationTable); // depends on control dependency: [for], data = [none]
for (WorkUnitState workUnitState : entry.getValue()) {
workUnitState.setWorkingState(WorkUnitState.WorkingState.COMMITTED); // depends on control dependency: [for], data = [workUnitState]
}
}
}
LOG.info("Commit publish data");
conn.commit();
} catch (Exception e) {
try {
LOG.error("Failed publishing. Rolling back."); // depends on control dependency: [try], data = [none]
conn.rollback(); // depends on control dependency: [try], data = [none]
} catch (SQLException se) {
LOG.error("Failed rolling back.", se);
} // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Failed publishing", e);
} finally {
try {
conn.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public void setSelectedInternalItem(User user) {
User internalUser = null;
int index = getIndexOf(user);
if (index != -1) {
internalUser = getElementAt(index);
} else if (getSize() > 0) {
internalUser = getElementAt(0);
}
setSelectedItemImpl(internalUser);
} }
|
public class class_name {
public void setSelectedInternalItem(User user) {
User internalUser = null;
int index = getIndexOf(user);
if (index != -1) {
internalUser = getElementAt(index); // depends on control dependency: [if], data = [(index]
} else if (getSize() > 0) {
internalUser = getElementAt(0); // depends on control dependency: [if], data = [0)]
}
setSelectedItemImpl(internalUser);
} }
|
public class class_name {
public boolean hasUnhandled() {
for(int i = 0; i < getNumEntries(); i++) {
boolean handled = getEntry(i).hasUnhandled();
if(handled) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean hasUnhandled() {
for(int i = 0; i < getNumEntries(); i++) {
boolean handled = getEntry(i).hasUnhandled();
if(handled) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static List getClasspathDirectories()
{
List directories = new ArrayList();
List components = getClasspathComponents();
for (Iterator i = components.iterator(); i.hasNext();)
{
String possibleDir = (String) i.next();
File file = new File(possibleDir);
if (file.isDirectory())
{
directories.add(possibleDir);
}
}
List tomcatPaths = getTomcatPaths();
if (tomcatPaths != null)
{
directories.addAll(tomcatPaths);
}
return directories;
} }
|
public class class_name {
public static List getClasspathDirectories()
{
List directories = new ArrayList();
List components = getClasspathComponents();
for (Iterator i = components.iterator(); i.hasNext();)
{
String possibleDir = (String) i.next();
File file = new File(possibleDir);
if (file.isDirectory())
{
directories.add(possibleDir); // depends on control dependency: [if], data = [none]
}
}
List tomcatPaths = getTomcatPaths();
if (tomcatPaths != null)
{
directories.addAll(tomcatPaths); // depends on control dependency: [if], data = [(tomcatPaths]
}
return directories;
} }
|
public class class_name {
public static void createIDs(IChemObject chemObject) {
if (chemObject == null) return;
resetCounters();
if (chemObject instanceof IAtomContainer) {
createIDsForAtomContainer((IAtomContainer) chemObject, null);
} else if (chemObject instanceof IAtomContainerSet) {
createIDsForAtomContainerSet((IAtomContainerSet) chemObject, null);
} else if (chemObject instanceof IReaction) {
createIDsForReaction((IReaction) chemObject, null);
} else if (chemObject instanceof IReactionSet) {
createIDsForReactionSet((IReactionSet) chemObject, null);
} else if (chemObject instanceof IChemFile) {
createIDsForChemFile((IChemFile) chemObject, null);
} else if (chemObject instanceof IChemSequence) {
createIDsForChemSequence((IChemSequence) chemObject, null);
} else if (chemObject instanceof IChemModel) {
createIDsForChemModel((IChemModel) chemObject, null);
}
} }
|
public class class_name {
public static void createIDs(IChemObject chemObject) {
if (chemObject == null) return;
resetCounters();
if (chemObject instanceof IAtomContainer) {
createIDsForAtomContainer((IAtomContainer) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IAtomContainerSet) {
createIDsForAtomContainerSet((IAtomContainerSet) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IReaction) {
createIDsForReaction((IReaction) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IReactionSet) {
createIDsForReactionSet((IReactionSet) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IChemFile) {
createIDsForChemFile((IChemFile) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IChemSequence) {
createIDsForChemSequence((IChemSequence) chemObject, null); // depends on control dependency: [if], data = [none]
} else if (chemObject instanceof IChemModel) {
createIDsForChemModel((IChemModel) chemObject, null); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public I_CmsSessionStorageProvider getSessionStorageProvider() {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_sessionStorageProvider)) {
return new CmsDefaultSessionStorageProvider();
}
try {
I_CmsSessionStorageProvider sessionCacheProvider = (I_CmsSessionStorageProvider)Class.forName(
m_sessionStorageProvider).newInstance();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SESSION_STORAGEPROVIDER_SUCCESS_1,
m_sessionStorageProvider));
}
return sessionCacheProvider;
} catch (Throwable t) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_INIT_SESSION_STORAGEPROVIDER_FAILURE_1,
m_sessionStorageProvider),
t);
return new CmsDefaultSessionStorageProvider();
}
} }
|
public class class_name {
public I_CmsSessionStorageProvider getSessionStorageProvider() {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_sessionStorageProvider)) {
return new CmsDefaultSessionStorageProvider(); // depends on control dependency: [if], data = [none]
}
try {
I_CmsSessionStorageProvider sessionCacheProvider = (I_CmsSessionStorageProvider)Class.forName(
m_sessionStorageProvider).newInstance();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SESSION_STORAGEPROVIDER_SUCCESS_1,
m_sessionStorageProvider)); // depends on control dependency: [if], data = [none]
}
return sessionCacheProvider; // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOG.error(
Messages.get().getBundle().key(
Messages.LOG_INIT_SESSION_STORAGEPROVIDER_FAILURE_1,
m_sessionStorageProvider),
t);
return new CmsDefaultSessionStorageProvider();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean parse(ByteBuffer buffer) {
while (buffer.hasRemaining()) {
switch (state) {
case LENGTH: {
int octet = buffer.get() & 0xFF;
length = (length << 8) + octet;
if (++cursor == 3) {
length &= Frame.MAX_MAX_LENGTH;
state = State.TYPE;
}
break;
}
case TYPE: {
type = buffer.get() & 0xFF;
state = State.FLAGS;
break;
}
case FLAGS: {
flags = buffer.get() & 0xFF;
state = State.STREAM_ID;
break;
}
case STREAM_ID: {
if (buffer.remaining() >= 4) {
streamId = buffer.getInt();
// Most significant bit MUST be ignored as per specification.
streamId &= 0x7F_FF_FF_FF;
return true;
} else {
state = State.STREAM_ID_BYTES;
cursor = 4;
}
break;
}
case STREAM_ID_BYTES: {
int currByte = buffer.get() & 0xFF;
--cursor;
streamId += currByte << (8 * cursor);
if (cursor == 0) {
// Most significant bit MUST be ignored as per specification.
streamId &= 0x7F_FF_FF_FF;
return true;
}
break;
}
default: {
throw new IllegalStateException();
}
}
}
return false;
} }
|
public class class_name {
public boolean parse(ByteBuffer buffer) {
while (buffer.hasRemaining()) {
switch (state) {
case LENGTH: {
int octet = buffer.get() & 0xFF;
length = (length << 8) + octet;
if (++cursor == 3) {
length &= Frame.MAX_MAX_LENGTH; // depends on control dependency: [if], data = [none]
state = State.TYPE; // depends on control dependency: [if], data = [none]
}
break;
}
case TYPE: {
type = buffer.get() & 0xFF;
state = State.FLAGS; // depends on control dependency: [while], data = [none]
break;
}
case FLAGS: {
flags = buffer.get() & 0xFF;
state = State.STREAM_ID;
break;
}
case STREAM_ID: {
if (buffer.remaining() >= 4) {
streamId = buffer.getInt();
// Most significant bit MUST be ignored as per specification.
streamId &= 0x7F_FF_FF_FF;
return true;
} else {
state = State.STREAM_ID_BYTES;
cursor = 4;
}
break;
}
case STREAM_ID_BYTES: {
int currByte = buffer.get() & 0xFF;
--cursor;
streamId += currByte << (8 * cursor);
if (cursor == 0) {
// Most significant bit MUST be ignored as per specification.
streamId &= 0x7F_FF_FF_FF;
return true;
}
break;
}
default: {
throw new IllegalStateException();
}
}
}
return false;
} }
|
public class class_name {
public void addReference(final String propertyName, final Collection<BeanId> refs) {
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>();
list.addAll(refs);
references.put(propertyName, list);
} else {
list.addAll(refs);
}
} }
|
public class class_name {
public void addReference(final String propertyName, final Collection<BeanId> refs) {
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>(); // depends on control dependency: [if], data = [none]
list.addAll(refs); // depends on control dependency: [if], data = [none]
references.put(propertyName, list); // depends on control dependency: [if], data = [none]
} else {
list.addAll(refs); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
Image fillImage() {
if (fillImage == null) {
CanvasImage image = platform.graphics().createImage(1, 1);
image.canvas().setFillColor(0xFFFFFFFF).fillRect(0, 0, image.width(), image.height());
fillImage = image;
}
return fillImage;
} }
|
public class class_name {
Image fillImage() {
if (fillImage == null) {
CanvasImage image = platform.graphics().createImage(1, 1);
image.canvas().setFillColor(0xFFFFFFFF).fillRect(0, 0, image.width(), image.height()); // depends on control dependency: [if], data = [none]
fillImage = image; // depends on control dependency: [if], data = [none]
}
return fillImage;
} }
|
public class class_name {
@Override
public boolean removeAttribute(String name) {
boolean success = false;
// begin update of shared object
beginUpdate();
try {
// try to remove attribute
success = so.removeAttribute(name);
} catch (Exception ex) {
log.warn("Exception on so.removeAttribute", ex);
} finally {
// end update of SO
endUpdate();
}
// notify listeners on success and return true
if (success) {
for (ISharedObjectListener listener : serverListeners) {
listener.onSharedObjectDelete(this, name);
}
}
return success;
} }
|
public class class_name {
@Override
public boolean removeAttribute(String name) {
boolean success = false;
// begin update of shared object
beginUpdate();
try {
// try to remove attribute
success = so.removeAttribute(name);
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
log.warn("Exception on so.removeAttribute", ex);
} finally {
// depends on control dependency: [catch], data = [none]
// end update of SO
endUpdate();
}
// notify listeners on success and return true
if (success) {
for (ISharedObjectListener listener : serverListeners) {
listener.onSharedObjectDelete(this, name);
// depends on control dependency: [for], data = [listener]
}
}
return success;
} }
|
public class class_name {
public boolean bind ()
{
// open our TCP listening ports
int successes = 0;
for (int port : _ports) {
try {
acceptConnections(port);
successes++;
} catch (IOException ioe) {
log.warning("Failure listening to socket", "hostname", _bindHostname,
"port", port, ioe);
}
}
return successes > 0;
} }
|
public class class_name {
public boolean bind ()
{
// open our TCP listening ports
int successes = 0;
for (int port : _ports) {
try {
acceptConnections(port); // depends on control dependency: [try], data = [none]
successes++; // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
log.warning("Failure listening to socket", "hostname", _bindHostname,
"port", port, ioe);
} // depends on control dependency: [catch], data = [none]
}
return successes > 0;
} }
|
public class class_name {
public static String createRegex(String value, boolean ignoreCase)
{
if (value == null)
{
throw new IllegalArgumentException("String cannot be null");
}
int len = value.length();
if (len == 0)
{
return "";
}
StringBuilder sb = new StringBuilder(len * 2);
if (ignoreCase)
{
sb.append("(?i)");
}
sb.append("^");
for (int i = 0; i < len; i++)
{
char c = value.charAt(i);
if ("[](){}.*+?$^|#\\".indexOf(c) != -1)
{
sb.append("\\");
}
sb.append(c);
}
sb.append("$");
return sb.toString();
} }
|
public class class_name {
public static String createRegex(String value, boolean ignoreCase)
{
if (value == null)
{
throw new IllegalArgumentException("String cannot be null");
}
int len = value.length();
if (len == 0)
{
return ""; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder(len * 2);
if (ignoreCase)
{
sb.append("(?i)");
}
sb.append("^"); // depends on control dependency: [if], data = [none]
for (int i = 0; i < len; i++)
{
char c = value.charAt(i);
if ("[](){}.*+?$^|#\\".indexOf(c) != -1)
{
sb.append("\\");
}
sb.append(c); // depends on control dependency: [if], data = [none]
}
sb.append("$");
return sb.toString();
} }
|
public class class_name {
public String toXYZString() {
StringBuilder str = new StringBuilder();
for(int i=0;i<3;i++) { //for each row
boolean emptyRow = true;
double coef; // TODO work with rational numbers
// X
coef = matTransform.getElement(i, 0);
// Three cases for coef: zero, one, non-one
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-");
}
} else {
str.append(formatCoef(coef));
str.append("*");
}
str.append("x");
emptyRow = false;
}
// Y
coef = matTransform.getElement(i, 1);
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-");
} else if( !emptyRow ) {
str.append("+");
}
} else {
if( !emptyRow && coef > 0) {
str.append("+");
}
str.append(formatCoef(coef));
str.append("*");
}
str.append("y");
emptyRow = false;
}
// Z
coef = matTransform.getElement(i, 2);
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-");
} else if( !emptyRow ) {
str.append("+");
}
} else {
if( !emptyRow && coef > 0) {
str.append("+");
}
str.append(formatCoef(coef));
str.append("*");
}
str.append("z");
emptyRow = false;
}
// Intercept
coef = matTransform.getElement(i, 3);
if(abs(coef) > 1e-6 ) { // Non-zero
if( !emptyRow && coef > 0) {
str.append("+");
}
str.append(formatCoef(coef));
}
if(i<2) {
str.append(",");
}
}
return str.toString();
} }
|
public class class_name {
public String toXYZString() {
StringBuilder str = new StringBuilder();
for(int i=0;i<3;i++) { //for each row
boolean emptyRow = true;
double coef; // TODO work with rational numbers
// X
coef = matTransform.getElement(i, 0); // depends on control dependency: [for], data = [i]
// Three cases for coef: zero, one, non-one
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-"); // depends on control dependency: [if], data = [none]
}
} else {
str.append(formatCoef(coef)); // depends on control dependency: [if], data = [none]
str.append("*"); // depends on control dependency: [if], data = [none]
}
str.append("x"); // depends on control dependency: [if], data = [none]
emptyRow = false; // depends on control dependency: [if], data = [none]
}
// Y
coef = matTransform.getElement(i, 1); // depends on control dependency: [for], data = [i]
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-"); // depends on control dependency: [if], data = [none]
} else if( !emptyRow ) {
str.append("+"); // depends on control dependency: [if], data = [none]
}
} else {
if( !emptyRow && coef > 0) {
str.append("+"); // depends on control dependency: [if], data = [none]
}
str.append(formatCoef(coef)); // depends on control dependency: [if], data = [none]
str.append("*"); // depends on control dependency: [if], data = [none]
}
str.append("y"); // depends on control dependency: [if], data = [none]
emptyRow = false; // depends on control dependency: [if], data = [none]
}
// Z
coef = matTransform.getElement(i, 2); // depends on control dependency: [for], data = [i]
if(abs(coef) > 1e-6 ) { // Non-zero
if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1
if( coef < 0 ) {
str.append("-"); // depends on control dependency: [if], data = [none]
} else if( !emptyRow ) {
str.append("+"); // depends on control dependency: [if], data = [none]
}
} else {
if( !emptyRow && coef > 0) {
str.append("+"); // depends on control dependency: [if], data = [none]
}
str.append(formatCoef(coef)); // depends on control dependency: [if], data = [none]
str.append("*"); // depends on control dependency: [if], data = [none]
}
str.append("z"); // depends on control dependency: [if], data = [none]
emptyRow = false; // depends on control dependency: [if], data = [none]
}
// Intercept
coef = matTransform.getElement(i, 3); // depends on control dependency: [for], data = [i]
if(abs(coef) > 1e-6 ) { // Non-zero
if( !emptyRow && coef > 0) {
str.append("+"); // depends on control dependency: [if], data = [none]
}
str.append(formatCoef(coef)); // depends on control dependency: [if], data = [none]
}
if(i<2) {
str.append(","); // depends on control dependency: [if], data = [none]
}
}
return str.toString();
} }
|
public class class_name {
private void addI18nListener() {
model.translationServiceProperty().addListener((observable, oldValue, newValue) -> {
if (oldValue != newValue) {
form.i18n(newValue);
newValue.addListener(categoryModel::updateGroupDescriptions);
if (!Objects.equals(breadCrumbPresenter, null)) {
newValue.addListener(breadCrumbPresenter::setupBreadCrumbBar);
}
categoryModel.updateGroupDescriptions();
}
});
} }
|
public class class_name {
private void addI18nListener() {
model.translationServiceProperty().addListener((observable, oldValue, newValue) -> {
if (oldValue != newValue) {
form.i18n(newValue); // depends on control dependency: [if], data = [newValue)]
newValue.addListener(categoryModel::updateGroupDescriptions); // depends on control dependency: [if], data = [none]
if (!Objects.equals(breadCrumbPresenter, null)) {
newValue.addListener(breadCrumbPresenter::setupBreadCrumbBar); // depends on control dependency: [if], data = [none]
}
categoryModel.updateGroupDescriptions(); // depends on control dependency: [if], data = [none]
}
});
} }
|
public class class_name {
public I_CmsSearchDocument getDocument(int docId) {
try {
IndexSearcher searcher = getSearcher();
return new CmsLuceneDocument(searcher.doc(docId));
} catch (IOException e) {
// ignore, return null and assume document was not found
}
return null;
} }
|
public class class_name {
public I_CmsSearchDocument getDocument(int docId) {
try {
IndexSearcher searcher = getSearcher();
return new CmsLuceneDocument(searcher.doc(docId)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// ignore, return null and assume document was not found
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
protected String fixOffset(String offsetColumn, String offset) {
com.sforce.soap.partner.Field sfdcField = getFieldMetadata(sobjectType, offsetColumn);
if (SobjectRecordCreator.DECIMAL_TYPES.contains(sfdcField.getType().toString())
&& offset.contains("E")) {
BigDecimal val = new BigDecimal(offset);
offset = val.toPlainString();
if (val.compareTo(MAX_OFFSET_INT) > 0 && !offset.contains(".")) {
// We need the ".0" suffix since Salesforce doesn't like integer
// bigger than 2147483647
offset += ".0";
}
}
return offset;
} }
|
public class class_name {
protected String fixOffset(String offsetColumn, String offset) {
com.sforce.soap.partner.Field sfdcField = getFieldMetadata(sobjectType, offsetColumn);
if (SobjectRecordCreator.DECIMAL_TYPES.contains(sfdcField.getType().toString())
&& offset.contains("E")) {
BigDecimal val = new BigDecimal(offset);
offset = val.toPlainString(); // depends on control dependency: [if], data = [none]
if (val.compareTo(MAX_OFFSET_INT) > 0 && !offset.contains(".")) {
// We need the ".0" suffix since Salesforce doesn't like integer
// bigger than 2147483647
offset += ".0"; // depends on control dependency: [if], data = [none]
}
}
return offset;
} }
|
public class class_name {
public void setFleetSummaryList(java.util.Collection<FleetSummary> fleetSummaryList) {
if (fleetSummaryList == null) {
this.fleetSummaryList = null;
return;
}
this.fleetSummaryList = new java.util.ArrayList<FleetSummary>(fleetSummaryList);
} }
|
public class class_name {
public void setFleetSummaryList(java.util.Collection<FleetSummary> fleetSummaryList) {
if (fleetSummaryList == null) {
this.fleetSummaryList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.fleetSummaryList = new java.util.ArrayList<FleetSummary>(fleetSummaryList);
} }
|
public class class_name {
@Override
public $.Option<T> reduce($.Func2<T, T, T> accumulator) {
Iterator<T> itr = iterator();
if (!itr.hasNext()) {
return $.none();
}
T ret = itr.next();
while (itr.hasNext()) {
ret = accumulator.apply(ret, itr.next());
}
return $.some(ret);
} }
|
public class class_name {
@Override
public $.Option<T> reduce($.Func2<T, T, T> accumulator) {
Iterator<T> itr = iterator();
if (!itr.hasNext()) {
return $.none(); // depends on control dependency: [if], data = [none]
}
T ret = itr.next();
while (itr.hasNext()) {
ret = accumulator.apply(ret, itr.next()); // depends on control dependency: [while], data = [none]
}
return $.some(ret);
} }
|
public class class_name {
public static Result<TokenResponse> getSignResult(SignRequest signRequest, String envTag) {
final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>();
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final ClientConnection connection;
try {
if(signRequest.getServerUrl() != null) {
connection = client.connect(new URI(signRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, signRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get();
} else if(signRequest.getServiceId() != null) {
Cluster cluster = SingletonServiceFactory.getBean(Cluster.class);
String url = cluster.serviceToUrl("https", signRequest.getServiceId(), envTag, null);
connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, signRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get();
} else {
// both server_url and serviceId are empty in the config.
logger.error("Error: both server_url and serviceId are not configured in client.yml for " + signRequest.getClass());
throw new ClientException("both server_url and serviceId are not configured in client.yml for " + signRequest.getClass());
}
} catch (Exception e) {
logger.error("cannot establish connection:", e);
return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, signRequest.getServerUrl() != null ? signRequest.getServerUrl() : signRequest.getServiceId()));
}
try {
Map<String, Object> map = new HashMap<>();
map.put("expires", signRequest.getExpires());
map.put("payload", signRequest.getPayload());
String requestBody = Config.getInstance().getMapper().writeValueAsString(map);
connection.getIoThread().execute(() -> {
final ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(signRequest.getUri());
request.getRequestHeaders().put(Headers.HOST, "localhost");
request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");
request.getRequestHeaders().put(Headers.CONTENT_TYPE, "application/x-www-form-urlencoded");
request.getRequestHeaders().put(Headers.AUTHORIZATION, getBasicAuthHeader(signRequest.getClientId(), signRequest.getClientSecret()));
connection.sendRequest(request, new ClientCallback<ClientExchange>() {
@Override
public void completed(ClientExchange result) {
new StringWriteChannelListener(requestBody).setup(result.getRequestChannel());
result.setResponseListener(new ClientCallback<ClientExchange>() {
@Override
public void completed(ClientExchange result) {
new StringReadChannelListener(Http2Client.BUFFER_POOL) {
@Override
protected void stringDone(String string) {
logger.debug("getToken response = " + string);
reference.set(handleResponse(getContentTypeFromExchange(result), string));
latch.countDown();
}
@Override
protected void error(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
}.setup(result.getResponseChannel());
}
@Override
public void failed(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
});
}
@Override
public void failed(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
});
});
latch.await(signRequest.getTimeout(), TimeUnit.MILLISECONDS);
} catch (Exception e) {
logger.error("IOException: ", e);
return Failure.of(new Status(FAIL_TO_SEND_REQUEST));
} finally {
IoUtils.safeClose(connection);
}
//if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout.
return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get();
} }
|
public class class_name {
public static Result<TokenResponse> getSignResult(SignRequest signRequest, String envTag) {
final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>();
final Http2Client client = Http2Client.getInstance();
final CountDownLatch latch = new CountDownLatch(1);
final ClientConnection connection;
try {
if(signRequest.getServerUrl() != null) {
connection = client.connect(new URI(signRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, signRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); // depends on control dependency: [if], data = [(signRequest.getServerUrl()]
} else if(signRequest.getServiceId() != null) {
Cluster cluster = SingletonServiceFactory.getBean(Cluster.class);
String url = cluster.serviceToUrl("https", signRequest.getServiceId(), envTag, null);
connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, signRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); // depends on control dependency: [if], data = [none]
} else {
// both server_url and serviceId are empty in the config.
logger.error("Error: both server_url and serviceId are not configured in client.yml for " + signRequest.getClass()); // depends on control dependency: [if], data = [none]
throw new ClientException("both server_url and serviceId are not configured in client.yml for " + signRequest.getClass());
}
} catch (Exception e) {
logger.error("cannot establish connection:", e);
return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, signRequest.getServerUrl() != null ? signRequest.getServerUrl() : signRequest.getServiceId()));
} // depends on control dependency: [catch], data = [none]
try {
Map<String, Object> map = new HashMap<>();
map.put("expires", signRequest.getExpires()); // depends on control dependency: [try], data = [none]
map.put("payload", signRequest.getPayload()); // depends on control dependency: [try], data = [none]
String requestBody = Config.getInstance().getMapper().writeValueAsString(map);
connection.getIoThread().execute(() -> {
final ClientRequest request = new ClientRequest().setMethod(Methods.POST).setPath(signRequest.getUri());
request.getRequestHeaders().put(Headers.HOST, "localhost");
request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");
request.getRequestHeaders().put(Headers.CONTENT_TYPE, "application/x-www-form-urlencoded");
request.getRequestHeaders().put(Headers.AUTHORIZATION, getBasicAuthHeader(signRequest.getClientId(), signRequest.getClientSecret()));
connection.sendRequest(request, new ClientCallback<ClientExchange>() {
@Override
public void completed(ClientExchange result) {
new StringWriteChannelListener(requestBody).setup(result.getRequestChannel());
result.setResponseListener(new ClientCallback<ClientExchange>() {
@Override
public void completed(ClientExchange result) {
new StringReadChannelListener(Http2Client.BUFFER_POOL) {
@Override
protected void stringDone(String string) {
logger.debug("getToken response = " + string);
reference.set(handleResponse(getContentTypeFromExchange(result), string));
latch.countDown();
}
@Override
protected void error(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
}.setup(result.getResponseChannel());
}
@Override
public void failed(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
});
}
@Override
public void failed(IOException e) {
logger.error("IOException:", e);
reference.set(Failure.of(new Status(FAIL_TO_SEND_REQUEST)));
latch.countDown();
}
});
});
latch.await(signRequest.getTimeout(), TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("IOException: ", e);
return Failure.of(new Status(FAIL_TO_SEND_REQUEST));
} finally { // depends on control dependency: [catch], data = [none]
IoUtils.safeClose(connection);
}
//if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout.
return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get();
} }
|
public class class_name {
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onCreateOptionsMenu(menu);
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
MenuInflater inflater = getSupportMenuInflater();
boolean show = false;
ArrayList<Fragment> newMenus = null;
if (mFragments.mAdded != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnCreateOptionsMenuListener) {
show = true;
((OnCreateOptionsMenuListener)f).onCreateOptionsMenu(menu, inflater);
if (newMenus == null) {
newMenus = new ArrayList<Fragment>();
}
newMenus.add(f);
}
}
}
if (mCreatedMenus != null) {
for (int i = 0; i < mCreatedMenus.size(); i++) {
Fragment f = mCreatedMenus.get(i);
if (newMenus == null || !newMenus.contains(f)) {
f.onDestroyOptionsMenu();
}
}
}
mCreatedMenus = newMenus;
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
result |= show;
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result;
}
return false;
} }
|
public class class_name {
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] featureId: " + featureId + ", menu: " + menu);
if (featureId == Window.FEATURE_OPTIONS_PANEL) {
boolean result = onCreateOptionsMenu(menu);
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] activity create result: " + result);
MenuInflater inflater = getSupportMenuInflater();
boolean show = false;
ArrayList<Fragment> newMenus = null;
if (mFragments.mAdded != null) {
for (int i = 0; i < mFragments.mAdded.size(); i++) {
Fragment f = mFragments.mAdded.get(i);
if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible && f instanceof OnCreateOptionsMenuListener) {
show = true; // depends on control dependency: [if], data = [none]
((OnCreateOptionsMenuListener)f).onCreateOptionsMenu(menu, inflater); // depends on control dependency: [if], data = [none]
if (newMenus == null) {
newMenus = new ArrayList<Fragment>(); // depends on control dependency: [if], data = [none]
}
newMenus.add(f); // depends on control dependency: [if], data = [(f]
}
}
}
if (mCreatedMenus != null) {
for (int i = 0; i < mCreatedMenus.size(); i++) {
Fragment f = mCreatedMenus.get(i);
if (newMenus == null || !newMenus.contains(f)) {
f.onDestroyOptionsMenu(); // depends on control dependency: [if], data = [none]
}
}
}
mCreatedMenus = newMenus; // depends on control dependency: [if], data = [none]
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] fragments create result: " + show);
result |= show; // depends on control dependency: [if], data = [none]
if (ActionBarSherlock.DEBUG) Log.d(TAG, "[onCreatePanelMenu] returning " + result);
return result; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public void wipeProperty(String propertyName)
{
if (propertyName != null)
{
propertyNames.remove(propertyName);
if (properties.containsKey(propertyName))
{
properties.remove(propertyName);
}
}
} }
|
public class class_name {
public void wipeProperty(String propertyName)
{
if (propertyName != null)
{
propertyNames.remove(propertyName); // depends on control dependency: [if], data = [(propertyName]
if (properties.containsKey(propertyName))
{
properties.remove(propertyName); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public void propagate(int evtmask) throws ContradictionException {
int min = 0;
int max = 0;
ISet nodes = g.getPotentialNodes();
for (int i : nodes) {
if (g.getMandSuccOrNeighOf(i).contains(i)) {
min++;
max++;
} else if (g.getPotSuccOrNeighOf(i).contains(i)) {
max++;
}
}
k.updateLowerBound(min, this);
k.updateUpperBound(max, this);
if (min == max) {
setPassive();
} else if (k.isInstantiated()) {
if (k.getValue() == max) {
for (int i : nodes) {
if (g.getPotSuccOrNeighOf(i).contains(i)) {
g.enforceArc(i, i, this);
}
}
setPassive();
} else if (k.getValue() == min) {
for (int i : nodes) {
if (!g.getMandSuccOrNeighOf(i).contains(i)) {
g.removeArc(i, i, this);
}
}
setPassive();
}
}
} }
|
public class class_name {
@Override
public void propagate(int evtmask) throws ContradictionException {
int min = 0;
int max = 0;
ISet nodes = g.getPotentialNodes();
for (int i : nodes) {
if (g.getMandSuccOrNeighOf(i).contains(i)) {
min++; // depends on control dependency: [if], data = [none]
max++; // depends on control dependency: [if], data = [none]
} else if (g.getPotSuccOrNeighOf(i).contains(i)) {
max++; // depends on control dependency: [if], data = [none]
}
}
k.updateLowerBound(min, this);
k.updateUpperBound(max, this);
if (min == max) {
setPassive();
} else if (k.isInstantiated()) {
if (k.getValue() == max) {
for (int i : nodes) {
if (g.getPotSuccOrNeighOf(i).contains(i)) {
g.enforceArc(i, i, this); // depends on control dependency: [if], data = [none]
}
}
setPassive();
} else if (k.getValue() == min) {
for (int i : nodes) {
if (!g.getMandSuccOrNeighOf(i).contains(i)) {
g.removeArc(i, i, this); // depends on control dependency: [if], data = [none]
}
}
setPassive();
}
}
} }
|
public class class_name {
private void tryEliminateOptionalArgs(ArrayList<Node> refs) {
// Count the maximum number of arguments passed into this function all
// all points of the program.
int maxArgs = -1;
for (Node n : refs) {
if (ReferenceMap.isCallOrNewTarget(n)) {
int numArgs = 0;
Node firstArg = ReferenceMap.getFirstArgumentForCallOrNewOrDotCall(n);
for (Node c = firstArg; c != null; c = c.getNext()) {
numArgs++;
if (c.isSpread()) {
// Bail: with spread we must assume all parameters are used, don't waste
// any more time.
return;
}
}
if (numArgs > maxArgs) {
maxArgs = numArgs;
}
}
}
for (Node fn : ReferenceMap.getFunctionNodes(refs).values()) {
eliminateParamsAfter(fn, maxArgs);
}
} }
|
public class class_name {
private void tryEliminateOptionalArgs(ArrayList<Node> refs) {
// Count the maximum number of arguments passed into this function all
// all points of the program.
int maxArgs = -1;
for (Node n : refs) {
if (ReferenceMap.isCallOrNewTarget(n)) {
int numArgs = 0;
Node firstArg = ReferenceMap.getFirstArgumentForCallOrNewOrDotCall(n);
for (Node c = firstArg; c != null; c = c.getNext()) {
numArgs++; // depends on control dependency: [for], data = [none]
if (c.isSpread()) {
// Bail: with spread we must assume all parameters are used, don't waste
// any more time.
return; // depends on control dependency: [if], data = [none]
}
}
if (numArgs > maxArgs) {
maxArgs = numArgs; // depends on control dependency: [if], data = [none]
}
}
}
for (Node fn : ReferenceMap.getFunctionNodes(refs).values()) {
eliminateParamsAfter(fn, maxArgs); // depends on control dependency: [for], data = [fn]
}
} }
|
public class class_name {
public void removeLocalTx(Xid xid) {
EmbeddedTransaction tx = localTxTable.remove(xid);
if (trace) {
log.tracef("[%s] Removed tx=%s", xid, tx);
}
} }
|
public class class_name {
public void removeLocalTx(Xid xid) {
EmbeddedTransaction tx = localTxTable.remove(xid);
if (trace) {
log.tracef("[%s] Removed tx=%s", xid, tx); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void withConnection(StatementRunnable runnable, Object argument) {
Connection connection = null;
try{
connection = open();
runnable.run(connection, argument);
} catch (Throwable t) {
throw new Sql2oException("An error occurred while executing StatementRunnable", t);
} finally{
if (connection != null) {
connection.close();
}
}
} }
|
public class class_name {
public void withConnection(StatementRunnable runnable, Object argument) {
Connection connection = null;
try{
connection = open(); // depends on control dependency: [try], data = [none]
runnable.run(connection, argument); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
throw new Sql2oException("An error occurred while executing StatementRunnable", t);
} finally{ // depends on control dependency: [catch], data = [none]
if (connection != null) {
connection.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, SortedSet<TempPropertyData>> properties)
throws SQLException, IllegalACLException, IOException
{
List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
Set<TempPropertyData> permValues = properties.get(Constants.EXO_PERMISSIONS.getAsString());
if (permValues != null)
{
for (TempPropertyData value : permValues)
{
AccessControlEntry ace;
try
{
ace = AccessControlEntry.parse(ValueDataUtil.getString(value.getValueData()));
}
catch (RepositoryException e)
{
throw new IOException(e.getMessage(), e);
}
naPermissions.add(ace);
}
return naPermissions;
}
else
{
throw new IllegalACLException("Property exo:permissions is not found for node with id: " + getIdentifier(cid));
}
} }
|
public class class_name {
protected List<AccessControlEntry> readACLPermisions(String cid, Map<String, SortedSet<TempPropertyData>> properties)
throws SQLException, IllegalACLException, IOException
{
List<AccessControlEntry> naPermissions = new ArrayList<AccessControlEntry>();
Set<TempPropertyData> permValues = properties.get(Constants.EXO_PERMISSIONS.getAsString());
if (permValues != null)
{
for (TempPropertyData value : permValues)
{
AccessControlEntry ace;
try
{
ace = AccessControlEntry.parse(ValueDataUtil.getString(value.getValueData())); // depends on control dependency: [try], data = [none]
}
catch (RepositoryException e)
{
throw new IOException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
naPermissions.add(ace);
}
return naPermissions;
}
else
{
throw new IllegalACLException("Property exo:permissions is not found for node with id: " + getIdentifier(cid));
}
} }
|
public class class_name {
public static List<UIUserSession> getUIUserSessions()
{
final List<UIUserSession> ret = new ArrayList<>();
final Collection<UserSession> userSessions = RegistryManager.getUserSessions();
for (final UserSession userSession : userSessions) {
ret.add(new UIUserSession(userSession.getUserName(), userSession.getSessionId(), userSession
.getLastActivity()));
}
return ret;
} }
|
public class class_name {
public static List<UIUserSession> getUIUserSessions()
{
final List<UIUserSession> ret = new ArrayList<>();
final Collection<UserSession> userSessions = RegistryManager.getUserSessions();
for (final UserSession userSession : userSessions) {
ret.add(new UIUserSession(userSession.getUserName(), userSession.getSessionId(), userSession
.getLastActivity())); // depends on control dependency: [for], data = [userSession]
}
return ret;
} }
|
public class class_name {
private boolean check( int x , int y , EdgeSegment parent , boolean match ) {
if( intensity.isInBounds(x,y) ) {
int index = intensity.getIndex(x,y);
if( intensity.data[index] >= lower ) {
intensity.data[index] = MARK_TRAVERSED;
if( !match ) {
Point2D_I32 p = queuePoints.grow();
p.set(x,y);
parent.points.add(p);
} else {
// a match was found so it can't just be added to the current edge
startNewSegment(x,y,parent);
}
return true;
}
}
return false;
} }
|
public class class_name {
private boolean check( int x , int y , EdgeSegment parent , boolean match ) {
if( intensity.isInBounds(x,y) ) {
int index = intensity.getIndex(x,y);
if( intensity.data[index] >= lower ) {
intensity.data[index] = MARK_TRAVERSED; // depends on control dependency: [if], data = [none]
if( !match ) {
Point2D_I32 p = queuePoints.grow();
p.set(x,y); // depends on control dependency: [if], data = [none]
parent.points.add(p); // depends on control dependency: [if], data = [none]
} else {
// a match was found so it can't just be added to the current edge
startNewSegment(x,y,parent); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@FFDCIgnore(Exception.class)
final void shutdownFramework() {
Tr.audit(tc, "httpChain.error.shutdown", name);
try {
Bundle bundle = bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION);
if (bundle != null)
bundle.stop();
} catch (Exception e) {
// do not FFDC this.
// exceptions during bundle stop occur if framework is already stopping or stopped
}
} }
|
public class class_name {
@FFDCIgnore(Exception.class)
final void shutdownFramework() {
Tr.audit(tc, "httpChain.error.shutdown", name);
try {
Bundle bundle = bundleContext.getBundle(Constants.SYSTEM_BUNDLE_LOCATION);
if (bundle != null)
bundle.stop();
} catch (Exception e) {
// do not FFDC this.
// exceptions during bundle stop occur if framework is already stopping or stopped
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int flipToFill(ByteBuffer buffer) {
int position = buffer.position();
int limit = buffer.limit();
if (position == limit) {
buffer.position(0);
buffer.limit(buffer.capacity());
return 0;
}
int capacity = buffer.capacity();
if (limit == capacity) {
buffer.compact();
return 0;
}
buffer.position(limit);
buffer.limit(capacity);
return position;
} }
|
public class class_name {
public static int flipToFill(ByteBuffer buffer) {
int position = buffer.position();
int limit = buffer.limit();
if (position == limit) {
buffer.position(0); // depends on control dependency: [if], data = [none]
buffer.limit(buffer.capacity()); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
int capacity = buffer.capacity();
if (limit == capacity) {
buffer.compact(); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
buffer.position(limit);
buffer.limit(capacity);
return position;
} }
|
public class class_name {
@Override
public <T> Future<T> execute(final Executable<T> executable) {
final Promise<T> promise = Promise();
return execute(promise, () -> {
try {
executable.execute(promise);
// if the implementation didn't respond to the Promise we mark it as a failure.
if (!promise.isCompleted()) {
promise.failure(new IllegalStateException("No response was provided by the Promise"));
}
} catch (Exception ex) {
promise.failure(ex);
}
});
} }
|
public class class_name {
@Override
public <T> Future<T> execute(final Executable<T> executable) {
final Promise<T> promise = Promise();
return execute(promise, () -> {
try {
executable.execute(promise);
// if the implementation didn't respond to the Promise we mark it as a failure.
if (!promise.isCompleted()) {
promise.failure(new IllegalStateException("No response was provided by the Promise")); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
promise.failure(ex);
}
});
} }
|
public class class_name {
void chooseFirstProvider() {
if (spi != null) {
return;
}
synchronized (lock) {
if (spi != null) {
return;
}
/* Android-removed: this debugging mechanism is not used in Android.
if (debug != null) {
int w = --warnCount;
if (w >= 0) {
debug.println("KeyAgreement.init() not first method "
+ "called, disabling delayed provider selection");
if (w == 0) {
debug.println("Further warnings of this type will "
+ "be suppressed");
}
new Exception("Call trace").printStackTrace();
}
}
*/
Exception lastException = null;
for (Service s : GetInstance.getServices("KeyAgreement", algorithm)) {
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
continue;
}
try {
Object obj = s.newInstance(null);
if (obj instanceof KeyAgreementSpi == false) {
continue;
}
spi = (KeyAgreementSpi)obj;
provider = s.getProvider();
// not needed any more
return;
} catch (Exception e) {
lastException = e;
}
}
ProviderException e = new ProviderException
("Could not construct KeyAgreementSpi instance");
if (lastException != null) {
e.initCause(lastException);
}
throw e;
}
} }
|
public class class_name {
void chooseFirstProvider() {
if (spi != null) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (lock) {
if (spi != null) {
return; // depends on control dependency: [if], data = [none]
}
/* Android-removed: this debugging mechanism is not used in Android.
if (debug != null) {
int w = --warnCount;
if (w >= 0) {
debug.println("KeyAgreement.init() not first method "
+ "called, disabling delayed provider selection");
if (w == 0) {
debug.println("Further warnings of this type will "
+ "be suppressed");
}
new Exception("Call trace").printStackTrace();
}
}
*/
Exception lastException = null;
for (Service s : GetInstance.getServices("KeyAgreement", algorithm)) {
if (JceSecurity.canUseProvider(s.getProvider()) == false) {
continue;
}
try {
Object obj = s.newInstance(null);
if (obj instanceof KeyAgreementSpi == false) {
continue;
}
spi = (KeyAgreementSpi)obj; // depends on control dependency: [try], data = [none]
provider = s.getProvider(); // depends on control dependency: [try], data = [none]
// not needed any more
return; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
lastException = e;
} // depends on control dependency: [catch], data = [none]
}
ProviderException e = new ProviderException
("Could not construct KeyAgreementSpi instance");
if (lastException != null) {
e.initCause(lastException); // depends on control dependency: [if], data = [(lastException]
}
throw e;
}
} }
|
public class class_name {
@Nullable
private String getPastTenseVerbSuggestion(String word) {
if (word.endsWith("e")) {
// strip trailing "e"
String wordStem = word.substring(0, word.length()-1);
try {
String lemma = baseForThirdPersonSingularVerb(wordStem);
if (lemma != null) {
AnalyzedToken token = new AnalyzedToken(lemma, null, lemma);
String[] forms = synthesizer.synthesize(token, "VER:3:SIN:PRT:.*", true);
if (forms.length > 0) {
return forms[0];
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return null;
} }
|
public class class_name {
@Nullable
private String getPastTenseVerbSuggestion(String word) {
if (word.endsWith("e")) {
// strip trailing "e"
String wordStem = word.substring(0, word.length()-1);
try {
String lemma = baseForThirdPersonSingularVerb(wordStem);
if (lemma != null) {
AnalyzedToken token = new AnalyzedToken(lemma, null, lemma);
String[] forms = synthesizer.synthesize(token, "VER:3:SIN:PRT:.*", true);
if (forms.length > 0) {
return forms[0]; // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
@Override
public Properties createProperties() {
//Merge Properties file content with the filterConfig content.
final Properties merged = new Properties();
try {
final Properties props = newDefaultProperties();
if (props != null) {
merged.putAll(props);
}
} catch (final Exception e) {
LOG.warn("Cannot load properties from default location. Load propertis from filterConfig", e);
}
final Properties props = createPropertiesFromFilterConfig();
merged.putAll(props);
return merged;
} }
|
public class class_name {
@Override
public Properties createProperties() {
//Merge Properties file content with the filterConfig content.
final Properties merged = new Properties();
try {
final Properties props = newDefaultProperties();
if (props != null) {
merged.putAll(props); // depends on control dependency: [if], data = [(props]
}
} catch (final Exception e) {
LOG.warn("Cannot load properties from default location. Load propertis from filterConfig", e);
} // depends on control dependency: [catch], data = [none]
final Properties props = createPropertiesFromFilterConfig();
merged.putAll(props);
return merged;
} }
|
public class class_name {
public Object readValue(InputStream is, Class<Object> clazz) {
try {
return this.mapper.readValue(is, clazz);
}
catch (Exception e) {
LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e);
return null;
}
} }
|
public class class_name {
public Object readValue(InputStream is, Class<Object> clazz) {
try {
return this.mapper.readValue(is, clazz); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e);
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(ListDeploymentInstancesRequest listDeploymentInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDeploymentInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDeploymentInstancesRequest.getDeploymentId(), DEPLOYMENTID_BINDING);
protocolMarshaller.marshall(listDeploymentInstancesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listDeploymentInstancesRequest.getInstanceStatusFilter(), INSTANCESTATUSFILTER_BINDING);
protocolMarshaller.marshall(listDeploymentInstancesRequest.getInstanceTypeFilter(), INSTANCETYPEFILTER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListDeploymentInstancesRequest listDeploymentInstancesRequest, ProtocolMarshaller protocolMarshaller) {
if (listDeploymentInstancesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listDeploymentInstancesRequest.getDeploymentId(), DEPLOYMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDeploymentInstancesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDeploymentInstancesRequest.getInstanceStatusFilter(), INSTANCESTATUSFILTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listDeploymentInstancesRequest.getInstanceTypeFilter(), INSTANCETYPEFILTER_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 ISymbol removeSymbol( CharSequence name )
{
for( int i = _stackScopes.size() - 1; i >= 0; i-- )
{
IScope scope = (IScope)_stackScopes.get( i );
Object symbol = scope.get( name );
if( symbol != null )
{
return (ISymbol)scope.remove( name );
}
}
return null;
} }
|
public class class_name {
public ISymbol removeSymbol( CharSequence name )
{
for( int i = _stackScopes.size() - 1; i >= 0; i-- )
{
IScope scope = (IScope)_stackScopes.get( i );
Object symbol = scope.get( name );
if( symbol != null )
{
return (ISymbol)scope.remove( name ); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static double checkPostconditionD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(
e,
Double.valueOf(value),
singleViolation(failedPredicate(e)));
}
return innerCheckD(value, ok, describer);
} }
|
public class class_name {
public static double checkPostconditionD(
final double value,
final DoublePredicate predicate,
final DoubleFunction<String> describer)
{
final boolean ok;
try {
ok = predicate.test(value); // depends on control dependency: [try], data = [none]
} catch (final Throwable e) {
throw failed(
e,
Double.valueOf(value),
singleViolation(failedPredicate(e)));
} // depends on control dependency: [catch], data = [none]
return innerCheckD(value, ok, describer);
} }
|
public class class_name {
public static <T> Supplier<T> once(final Supplier<T> function) {
return new Supplier<T>() {
private volatile boolean executed;
private T result;
@Override
public T get() {
if (!executed) {
executed = true;
result = function.get();
}
return result;
}
};
} }
|
public class class_name {
public static <T> Supplier<T> once(final Supplier<T> function) {
return new Supplier<T>() {
private volatile boolean executed;
private T result;
@Override
public T get() {
if (!executed) {
executed = true; // depends on control dependency: [if], data = [none]
result = function.get(); // depends on control dependency: [if], data = [none]
}
return result;
}
};
} }
|
public class class_name {
public static HttpHandler configureCompression(Compression compression,
HttpHandler httpHandler) {
if (compression == null || !compression.getEnabled()) {
return httpHandler;
}
ContentEncodingRepository repository = new ContentEncodingRepository();
repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50,
Predicates.and(getCompressionPredicates(compression)));
return new EncodingHandler(repository).setNext(httpHandler);
} }
|
public class class_name {
public static HttpHandler configureCompression(Compression compression,
HttpHandler httpHandler) {
if (compression == null || !compression.getEnabled()) {
return httpHandler; // depends on control dependency: [if], data = [none]
}
ContentEncodingRepository repository = new ContentEncodingRepository();
repository.addEncodingHandler("gzip", new GzipEncodingProvider(), 50,
Predicates.and(getCompressionPredicates(compression)));
return new EncodingHandler(repository).setNext(httpHandler);
} }
|
public class class_name {
public static String displayType(String className, Object value) {
if (className == null) {
return null;
}
boolean array = false;
if (className.equals("[J")) {
array = true;
if (value == null) {
className = "unknown";
} else if (value instanceof boolean[]) {
className = "boolean";
} else if (value instanceof byte[]) {
className = "byte";
} else if (value instanceof char[]) {
className = "char";
} else if (value instanceof short[]) {
className = "short";
} else if (value instanceof int[]) {
className = "int";
} else if (value instanceof long[]) {
className = "long";
} else if (value instanceof float[]) {
className = "float";
} else if (value instanceof double[]) {
className = "double";
} else {
className = "unknown";
}
} else if (className.startsWith("[L")) {
className = className.substring(2, className.length() - 1);
}
if (className.startsWith("java.lang.")) {
className = className.substring(10);
} else if (className.startsWith("javax.management.openmbean.")) {
className = className.substring(27);
}
if (array) {
return "array of " + className;
} else {
return className;
}
} }
|
public class class_name {
public static String displayType(String className, Object value) {
if (className == null) {
return null; // depends on control dependency: [if], data = [none]
}
boolean array = false;
if (className.equals("[J")) {
array = true; // depends on control dependency: [if], data = [none]
if (value == null) {
className = "unknown"; // depends on control dependency: [if], data = [none]
} else if (value instanceof boolean[]) {
className = "boolean"; // depends on control dependency: [if], data = [none]
} else if (value instanceof byte[]) {
className = "byte"; // depends on control dependency: [if], data = [none]
} else if (value instanceof char[]) {
className = "char"; // depends on control dependency: [if], data = [none]
} else if (value instanceof short[]) {
className = "short"; // depends on control dependency: [if], data = [none]
} else if (value instanceof int[]) {
className = "int"; // depends on control dependency: [if], data = [none]
} else if (value instanceof long[]) {
className = "long"; // depends on control dependency: [if], data = [none]
} else if (value instanceof float[]) {
className = "float"; // depends on control dependency: [if], data = [none]
} else if (value instanceof double[]) {
className = "double"; // depends on control dependency: [if], data = [none]
} else {
className = "unknown"; // depends on control dependency: [if], data = [none]
}
} else if (className.startsWith("[L")) {
className = className.substring(2, className.length() - 1); // depends on control dependency: [if], data = [none]
}
if (className.startsWith("java.lang.")) {
className = className.substring(10);
} else if (className.startsWith("javax.management.openmbean.")) {
className = className.substring(27);
}
if (array) {
return "array of " + className;
} else {
return className;
}
} }
|
public class class_name {
@PostMapping("/etl/{type}/{key}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task,
@RequestParam(name = "params", required = false) String params) {
OuterAdapter adapter = loader.getExtension(type, key);
String destination = adapter.getDestination(task);
String lockKey = destination == null ? task : destination;
boolean locked = etlLock.tryLock(ETL_LOCK_ZK_NODE + type + "-" + lockKey);
if (!locked) {
EtlResult result = new EtlResult();
result.setSucceeded(false);
result.setErrorMessage(task + " 有其他进程正在导入中, 请稍后再试");
return result;
}
try {
boolean oriSwitchStatus;
if (destination != null) {
oriSwitchStatus = syncSwitch.status(destination);
if (oriSwitchStatus) {
syncSwitch.off(destination);
}
} else {
// task可能为destination,直接锁task
oriSwitchStatus = syncSwitch.status(task);
if (oriSwitchStatus) {
syncSwitch.off(task);
}
}
try {
List<String> paramArray = null;
if (params != null) {
paramArray = Arrays.asList(params.trim().split(";"));
}
return adapter.etl(task, paramArray);
} finally {
if (destination != null && oriSwitchStatus) {
syncSwitch.on(destination);
} else if (destination == null && oriSwitchStatus) {
syncSwitch.on(task);
}
}
} finally {
etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + lockKey);
}
} }
|
public class class_name {
@PostMapping("/etl/{type}/{key}/{task}")
public EtlResult etl(@PathVariable String type, @PathVariable String key, @PathVariable String task,
@RequestParam(name = "params", required = false) String params) {
OuterAdapter adapter = loader.getExtension(type, key);
String destination = adapter.getDestination(task);
String lockKey = destination == null ? task : destination;
boolean locked = etlLock.tryLock(ETL_LOCK_ZK_NODE + type + "-" + lockKey);
if (!locked) {
EtlResult result = new EtlResult();
result.setSucceeded(false); // depends on control dependency: [if], data = [none]
result.setErrorMessage(task + " 有其他进程正在导入中, 请稍后再试"); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
try {
boolean oriSwitchStatus;
if (destination != null) {
oriSwitchStatus = syncSwitch.status(destination); // depends on control dependency: [if], data = [(destination]
if (oriSwitchStatus) {
syncSwitch.off(destination); // depends on control dependency: [if], data = [none]
}
} else {
// task可能为destination,直接锁task
oriSwitchStatus = syncSwitch.status(task); // depends on control dependency: [if], data = [none]
if (oriSwitchStatus) {
syncSwitch.off(task); // depends on control dependency: [if], data = [none]
}
}
try {
List<String> paramArray = null;
if (params != null) {
paramArray = Arrays.asList(params.trim().split(";")); // depends on control dependency: [if], data = [(params]
}
return adapter.etl(task, paramArray); // depends on control dependency: [try], data = [none]
} finally {
if (destination != null && oriSwitchStatus) {
syncSwitch.on(destination); // depends on control dependency: [if], data = [(destination]
} else if (destination == null && oriSwitchStatus) {
syncSwitch.on(task); // depends on control dependency: [if], data = [none]
}
}
} finally {
etlLock.unlock(ETL_LOCK_ZK_NODE + type + "-" + lockKey);
}
} }
|
public class class_name {
public boolean registerConsumerSetMonitor(
ConnectionImpl connection,
DestinationHandler topicSpace,
SIBUuid12 topicSpaceUuid,
String discriminatorExpression,
String combinedExpression,
ConsumerSetChangeCallback callback,
boolean isWildcarded,
String wildcardStem,
MessageProcessorMatching mpm)
throws
SIDiscriminatorSyntaxException,
SIErrorException
{
if (tc.isEntryEnabled())
SibTr.entry(
tc,
"registerConsumerSetMonitor",
new Object[] { connection,
topicSpace,
topicSpaceUuid,
discriminatorExpression,
combinedExpression,
callback,
new Boolean(isWildcarded),
wildcardStem });
boolean areConsumers = false;
// Test whether there are existing registrations on this topicspace. If so,
// we will match the existing set of subscriptions associated with it.
if(_consumerMonitorRegistrar.checkExistingExpression(combinedExpression, isWildcarded))
{
// topic expression has been used by another registration, in this case
// we need to add our callback entry to the registrations table only
areConsumers =
_consumerMonitorRegistrar.
registerCallbackOnExistingExpression(connection,
combinedExpression,
isWildcarded,
callback);
}
else
{
// A new topic expression. We'll have to find the set of consumers that map
// to it.
Set localConsumers = new HashSet(); // We'll use these sets where we have
Set remoteConsumers = new HashSet(); // searched the matchspace
// The style of processing depends on whether the discriminator in the
// registration is wildcarded
if(!isWildcarded)
{
mpm.retrieveNonSelectorConsumers(topicSpace,
discriminatorExpression,
localConsumers,
remoteConsumers);
// Now we need to check whether there are any subscriptions with selectors
// that "might" match this expression.
_subscriptionRegistrar.findMatchingSelectorSubs(combinedExpression, localConsumers);
}
else
{
// If wildcarded use MatchSpace direct evaluation code and string matching
_subscriptionRegistrar.findCandidateSubsForWildcardExpr(combinedExpression, wildcardStem, localConsumers);
}
// Now we perform the actual registration of our monitor
areConsumers = registerCallbackOnNewExpression(connection,
combinedExpression,
isWildcarded,
callback,
localConsumers,
remoteConsumers);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "registerConsumerSetMonitor", new Boolean(areConsumers));
return areConsumers;
} }
|
public class class_name {
public boolean registerConsumerSetMonitor(
ConnectionImpl connection,
DestinationHandler topicSpace,
SIBUuid12 topicSpaceUuid,
String discriminatorExpression,
String combinedExpression,
ConsumerSetChangeCallback callback,
boolean isWildcarded,
String wildcardStem,
MessageProcessorMatching mpm)
throws
SIDiscriminatorSyntaxException,
SIErrorException
{
if (tc.isEntryEnabled())
SibTr.entry(
tc,
"registerConsumerSetMonitor",
new Object[] { connection,
topicSpace,
topicSpaceUuid,
discriminatorExpression,
combinedExpression,
callback,
new Boolean(isWildcarded),
wildcardStem });
boolean areConsumers = false;
// Test whether there are existing registrations on this topicspace. If so,
// we will match the existing set of subscriptions associated with it.
if(_consumerMonitorRegistrar.checkExistingExpression(combinedExpression, isWildcarded))
{
// topic expression has been used by another registration, in this case
// we need to add our callback entry to the registrations table only
areConsumers =
_consumerMonitorRegistrar.
registerCallbackOnExistingExpression(connection,
combinedExpression,
isWildcarded,
callback);
}
else
{
// A new topic expression. We'll have to find the set of consumers that map
// to it.
Set localConsumers = new HashSet(); // We'll use these sets where we have
Set remoteConsumers = new HashSet(); // searched the matchspace
// The style of processing depends on whether the discriminator in the
// registration is wildcarded
if(!isWildcarded)
{
mpm.retrieveNonSelectorConsumers(topicSpace,
discriminatorExpression,
localConsumers,
remoteConsumers); // depends on control dependency: [if], data = [none]
// Now we need to check whether there are any subscriptions with selectors
// that "might" match this expression.
_subscriptionRegistrar.findMatchingSelectorSubs(combinedExpression, localConsumers); // depends on control dependency: [if], data = [none]
}
else
{
// If wildcarded use MatchSpace direct evaluation code and string matching
_subscriptionRegistrar.findCandidateSubsForWildcardExpr(combinedExpression, wildcardStem, localConsumers); // depends on control dependency: [if], data = [none]
}
// Now we perform the actual registration of our monitor
areConsumers = registerCallbackOnNewExpression(connection,
combinedExpression,
isWildcarded,
callback,
localConsumers,
remoteConsumers);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "registerConsumerSetMonitor", new Boolean(areConsumers));
return areConsumers;
} }
|
public class class_name {
@Deprecated
@Override
MapMaker expireAfterWrite(long duration, TimeUnit unit) {
checkExpiration(duration, unit);
this.expireAfterWriteNanos = unit.toNanos(duration);
if (duration == 0 && this.nullRemovalCause == null) {
// SIZE trumps EXPIRED
this.nullRemovalCause = RemovalCause.EXPIRED;
}
useCustomMap = true;
return this;
} }
|
public class class_name {
@Deprecated
@Override
MapMaker expireAfterWrite(long duration, TimeUnit unit) {
checkExpiration(duration, unit);
this.expireAfterWriteNanos = unit.toNanos(duration);
if (duration == 0 && this.nullRemovalCause == null) {
// SIZE trumps EXPIRED
this.nullRemovalCause = RemovalCause.EXPIRED; // depends on control dependency: [if], data = [none]
}
useCustomMap = true;
return this;
} }
|
public class class_name {
public long unpackLong()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (long) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (long) (u8 & 0xff);
case Code.UINT16: // unsigned int 16
short u16 = readShort();
return (long) (u16 & 0xffff);
case Code.UINT32: // unsigned int 32
int u32 = readInt();
if (u32 < 0) {
return (long) (u32 & 0x7fffffff) + 0x80000000L;
}
else {
return (long) u32;
}
case Code.UINT64: // unsigned int 64
long u64 = readLong();
if (u64 < 0L) {
throw overflowU64(u64);
}
return u64;
case Code.INT8: // signed int 8
byte i8 = readByte();
return (long) i8;
case Code.INT16: // signed int 16
short i16 = readShort();
return (long) i16;
case Code.INT32: // signed int 32
int i32 = readInt();
return (long) i32;
case Code.INT64: // signed int 64
long i64 = readLong();
return i64;
}
throw unexpected("Integer", b);
} }
|
public class class_name {
public long unpackLong()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (long) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (long) (u8 & 0xff);
case Code.UINT16: // unsigned int 16
short u16 = readShort();
return (long) (u16 & 0xffff);
case Code.UINT32: // unsigned int 32
int u32 = readInt();
if (u32 < 0) {
return (long) (u32 & 0x7fffffff) + 0x80000000L; // depends on control dependency: [if], data = [(u32]
}
else {
return (long) u32; // depends on control dependency: [if], data = [none]
}
case Code.UINT64: // unsigned int 64
long u64 = readLong();
if (u64 < 0L) {
throw overflowU64(u64);
}
return u64;
case Code.INT8: // signed int 8
byte i8 = readByte();
return (long) i8;
case Code.INT16: // signed int 16
short i16 = readShort();
return (long) i16;
case Code.INT32: // signed int 32
int i32 = readInt();
return (long) i32;
case Code.INT64: // signed int 64
long i64 = readLong();
return i64;
}
throw unexpected("Integer", b);
} }
|
public class class_name {
@Override
public PersistEntry[] list(String path) {
final String bk[] = split(path);
int substrLen = bk.length == 2 ? bk[1].length() : 0;
List<PersistEntry> results = new ArrayList<>();
try {
for (Blob b : storageProvider.getStorage().list(bk[0]).iterateAll()) {
if (bk.length == 1 || (bk.length == 2 && b.getName().startsWith(bk[1]))) {
String relativeName = b.getName().substring(substrLen);
if (relativeName.startsWith("/")) {
relativeName = relativeName.substring(1);
}
results.add(new PersistEntry(relativeName, b.getSize(), b.getUpdateTime()));
}
}
} catch (StorageException e) {
Log.err(e);
}
return results.toArray(new PersistEntry[results.size()]);
} }
|
public class class_name {
@Override
public PersistEntry[] list(String path) {
final String bk[] = split(path);
int substrLen = bk.length == 2 ? bk[1].length() : 0;
List<PersistEntry> results = new ArrayList<>();
try {
for (Blob b : storageProvider.getStorage().list(bk[0]).iterateAll()) {
if (bk.length == 1 || (bk.length == 2 && b.getName().startsWith(bk[1]))) {
String relativeName = b.getName().substring(substrLen);
if (relativeName.startsWith("/")) {
relativeName = relativeName.substring(1); // depends on control dependency: [if], data = [none]
}
results.add(new PersistEntry(relativeName, b.getSize(), b.getUpdateTime())); // depends on control dependency: [if], data = [none]
}
}
} catch (StorageException e) {
Log.err(e);
} // depends on control dependency: [catch], data = [none]
return results.toArray(new PersistEntry[results.size()]);
} }
|
public class class_name {
public boolean getIsNew() {
String projectPath = getProjectPath();
if(projectPath == null) {
return true;
}
File projectDir = new File(projectPath);
if(!projectDir.exists()) {
return true;
}
File projectDescriptor = new File(projectPath + File.separator + DESCRIPTOR_FILE_NAME);
return !projectDescriptor.exists();
} }
|
public class class_name {
public boolean getIsNew() {
String projectPath = getProjectPath();
if(projectPath == null) {
return true; // depends on control dependency: [if], data = [none]
}
File projectDir = new File(projectPath);
if(!projectDir.exists()) {
return true; // depends on control dependency: [if], data = [none]
}
File projectDescriptor = new File(projectPath + File.separator + DESCRIPTOR_FILE_NAME);
return !projectDescriptor.exists();
} }
|
public class class_name {
public void addUniqueConstraint(UniqueConstraint uc) {
if (uc.isPrimaryKey()) {
if (pk != null)
throw new IllegalArgumentException("Duplicate PK " + pk + " " + uc);
pk = uc;
}
else {
if (pk != null)
if (uc.getAttributes().equals(pk.getAttributes()))
// ignore the unique index created for the primary key
return;
}
ucs.add(uc);
} }
|
public class class_name {
public void addUniqueConstraint(UniqueConstraint uc) {
if (uc.isPrimaryKey()) {
if (pk != null)
throw new IllegalArgumentException("Duplicate PK " + pk + " " + uc);
pk = uc; // depends on control dependency: [if], data = [none]
}
else {
if (pk != null)
if (uc.getAttributes().equals(pk.getAttributes()))
// ignore the unique index created for the primary key
return;
}
ucs.add(uc);
} }
|
public class class_name {
@SuppressWarnings ("unchecked")
protected <X> ASet<X> createInternal (Iterable<X> elements) {
AMap result = inner.clear ();
for (X el: elements) {
result = result.updated (el, Boolean.TRUE);
}
return (ASet) wrapAsSet (result);
} }
|
public class class_name {
@SuppressWarnings ("unchecked")
protected <X> ASet<X> createInternal (Iterable<X> elements) {
AMap result = inner.clear ();
for (X el: elements) {
result = result.updated (el, Boolean.TRUE); // depends on control dependency: [for], data = [el]
}
return (ASet) wrapAsSet (result);
} }
|
public class class_name {
public static String getPath(Treenode item, boolean useLabels) {
StringBuilder sb = new StringBuilder();
boolean needsDelim = false;
while (item != null) {
if (needsDelim) {
sb.insert(0, '\\');
} else {
needsDelim = true;
}
sb.insert(0, useLabels ? item.getLabel() : item.getIndex());
item = (Treenode) item.getParent();
}
return sb.toString();
} }
|
public class class_name {
public static String getPath(Treenode item, boolean useLabels) {
StringBuilder sb = new StringBuilder();
boolean needsDelim = false;
while (item != null) {
if (needsDelim) {
sb.insert(0, '\\'); // depends on control dependency: [if], data = [none]
} else {
needsDelim = true; // depends on control dependency: [if], data = [none]
}
sb.insert(0, useLabels ? item.getLabel() : item.getIndex()); // depends on control dependency: [while], data = [none]
item = (Treenode) item.getParent(); // depends on control dependency: [while], data = [none]
}
return sb.toString();
} }
|
public class class_name {
public List<ServiceRefHandlerType<ServiceRefType<T>>> getAllHandler()
{
List<ServiceRefHandlerType<ServiceRefType<T>>> list = new ArrayList<ServiceRefHandlerType<ServiceRefType<T>>>();
List<Node> nodeList = childNode.get("handler");
for(Node node: nodeList)
{
ServiceRefHandlerType<ServiceRefType<T>> type = new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, node);
list.add(type);
}
return list;
} }
|
public class class_name {
public List<ServiceRefHandlerType<ServiceRefType<T>>> getAllHandler()
{
List<ServiceRefHandlerType<ServiceRefType<T>>> list = new ArrayList<ServiceRefHandlerType<ServiceRefType<T>>>();
List<Node> nodeList = childNode.get("handler");
for(Node node: nodeList)
{
ServiceRefHandlerType<ServiceRefType<T>> type = new ServiceRefHandlerTypeImpl<ServiceRefType<T>>(this, "handler", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
public RequestInvoker resolve(Map<String, ?> templateValues) {
final Uri resolvedUri;
try {
resolvedUri = uriBuilder.build(templateValues);
} catch (Exception e) {
throw new IllegalArgumentException("Could not build the URI with the supplied template values.", e);
}
return createRequest(resolvedUri.toString());
} }
|
public class class_name {
public RequestInvoker resolve(Map<String, ?> templateValues) {
final Uri resolvedUri;
try {
resolvedUri = uriBuilder.build(templateValues); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IllegalArgumentException("Could not build the URI with the supplied template values.", e);
} // depends on control dependency: [catch], data = [none]
return createRequest(resolvedUri.toString());
} }
|
public class class_name {
private void lazyRefresh() {
Runnable pr = new Runnable() {
@Override
public void run() {
if(pendingRefresh.compareAndSet(this, null)) {
refresh();
}
}
};
pendingRefresh.set(pr);
scheduleUpdate(pr);
} }
|
public class class_name {
private void lazyRefresh() {
Runnable pr = new Runnable() {
@Override
public void run() {
if(pendingRefresh.compareAndSet(this, null)) {
refresh(); // depends on control dependency: [if], data = [none]
}
}
};
pendingRefresh.set(pr);
scheduleUpdate(pr);
} }
|
public class class_name {
public static Map<String, Object> getAnnotationValueMap(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method[] methods = ReflectUtil.getMethods(annotationType, new Filter<Method>() {
@Override
public boolean accept(Method t) {
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
// 只读取无参方法
final String name = t.getName();
if ("hashCode".equals(name) || "toString".equals(name) || "annotationType".equals(name)) {
// 跳过自有的几个方法
return false;
}
return true;
}
return false;
}
});
final HashMap<String, Object> result = new HashMap<>(methods.length, 1);
for (Method method : methods) {
result.put(method.getName(), ReflectUtil.invoke(annotation, method));
}
return result;
} }
|
public class class_name {
public static Map<String, Object> getAnnotationValueMap(AnnotatedElement annotationEle, Class<? extends Annotation> annotationType) throws UtilException {
final Annotation annotation = getAnnotation(annotationEle, annotationType);
if (null == annotation) {
return null;
}
final Method[] methods = ReflectUtil.getMethods(annotationType, new Filter<Method>() {
@Override
public boolean accept(Method t) {
if (ArrayUtil.isEmpty(t.getParameterTypes())) {
// 只读取无参方法
final String name = t.getName();
if ("hashCode".equals(name) || "toString".equals(name) || "annotationType".equals(name)) {
// 跳过自有的几个方法
return false;
// depends on control dependency: [if], data = [none]
}
return true;
// depends on control dependency: [if], data = [none]
}
return false;
}
});
final HashMap<String, Object> result = new HashMap<>(methods.length, 1);
for (Method method : methods) {
result.put(method.getName(), ReflectUtil.invoke(annotation, method));
}
return result;
} }
|
public class class_name {
public FlowStepRule createFlowStepViewRule(FlowStepRule flowStepRuleParam)
{
if(flowStepRuleParam != null && this.serviceTicket != null)
{
flowStepRuleParam.setServiceTicket(this.serviceTicket);
}
return new FlowStepRule(this.putJson(
flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleViewCreate()));
} }
|
public class class_name {
public FlowStepRule createFlowStepViewRule(FlowStepRule flowStepRuleParam)
{
if(flowStepRuleParam != null && this.serviceTicket != null)
{
flowStepRuleParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
return new FlowStepRule(this.putJson(
flowStepRuleParam, WS.Path.FlowStepRule.Version1.flowStepRuleViewCreate()));
} }
|
public class class_name {
public String getJndiName() {
String returnValue = simpleJndiBindingName;
if ((returnValue == null) || (returnValue.equals(""))) {
returnValue = ivRemoteHomeJndiName;
if ((returnValue == null) || (returnValue.equals(""))) {
returnValue = ivLocalHomeJndiName;
}
}
return returnValue;
} }
|
public class class_name {
public String getJndiName() {
String returnValue = simpleJndiBindingName;
if ((returnValue == null) || (returnValue.equals(""))) {
returnValue = ivRemoteHomeJndiName; // depends on control dependency: [if], data = [none]
if ((returnValue == null) || (returnValue.equals(""))) {
returnValue = ivLocalHomeJndiName; // depends on control dependency: [if], data = [none]
}
}
return returnValue;
} }
|
public class class_name {
@Override
protected void processNode(ArchivePath path, Node node) {
// Get path to file
final String assetFilePath = path.get();
// Create a file for the asset
final File assetFile = new File(outputDirectory, assetFilePath);
// Get the assets parent parent directory and make sure it exists
final File assetParent = assetFile.getParentFile();
if (!assetParent.exists()) {
if (!assetParent.mkdirs()) {
throw new ArchiveExportException("Failed to write asset. Unable to create parent directory.");
}
}
// Handle Archive assets separately
if (node != null && node.getAsset() instanceof ArchiveAsset) {
ArchiveAsset nesteArchiveAsset = ArchiveAsset.class.cast(node.getAsset());
processArchiveAsset(assetParent, nesteArchiveAsset);
return;
}
// Handle directory assets separately
try {
final boolean isDirectory = (node.getAsset() == null);
if (isDirectory) {
// If doesn't already exist
if (!assetFile.exists()) {
// Attempt a create
if (!assetFile.mkdirs()) {
// Some error in writing
throw new ArchiveExportException("Failed to write directory: " + assetFile.getAbsolutePath());
}
}
}
// Only handle non-directory assets, otherwise the path is handled above
else {
try {
if (log.isLoggable(Level.FINE)) {
log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath());
}
// Get the asset streams
final InputStream assetInputStream = node.getAsset().openStream();
final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
final BufferedOutputStream assetBufferedOutputStream = new BufferedOutputStream(
assetFileOutputStream, 8192);
// Write contents
IOUtil.copyWithClose(assetInputStream, assetBufferedOutputStream);
} catch (final Exception e) {
// Provide a more detailed exception than the outer block
throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile, e);
}
}
} catch (final Exception e) {
throw new ArchiveExportException("Unexpected error encountered in export of " + node, e);
}
} }
|
public class class_name {
@Override
protected void processNode(ArchivePath path, Node node) {
// Get path to file
final String assetFilePath = path.get();
// Create a file for the asset
final File assetFile = new File(outputDirectory, assetFilePath);
// Get the assets parent parent directory and make sure it exists
final File assetParent = assetFile.getParentFile();
if (!assetParent.exists()) {
if (!assetParent.mkdirs()) {
throw new ArchiveExportException("Failed to write asset. Unable to create parent directory.");
}
}
// Handle Archive assets separately
if (node != null && node.getAsset() instanceof ArchiveAsset) {
ArchiveAsset nesteArchiveAsset = ArchiveAsset.class.cast(node.getAsset());
processArchiveAsset(assetParent, nesteArchiveAsset); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Handle directory assets separately
try {
final boolean isDirectory = (node.getAsset() == null);
if (isDirectory) {
// If doesn't already exist
if (!assetFile.exists()) {
// Attempt a create
if (!assetFile.mkdirs()) {
// Some error in writing
throw new ArchiveExportException("Failed to write directory: " + assetFile.getAbsolutePath());
}
}
}
// Only handle non-directory assets, otherwise the path is handled above
else {
try {
if (log.isLoggable(Level.FINE)) {
log.fine("Writing asset " + path.get() + " to " + assetFile.getAbsolutePath()); // depends on control dependency: [if], data = [none]
}
// Get the asset streams
final InputStream assetInputStream = node.getAsset().openStream();
final FileOutputStream assetFileOutputStream = new FileOutputStream(assetFile);
final BufferedOutputStream assetBufferedOutputStream = new BufferedOutputStream(
assetFileOutputStream, 8192);
// Write contents
IOUtil.copyWithClose(assetInputStream, assetBufferedOutputStream); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
// Provide a more detailed exception than the outer block
throw new ArchiveExportException("Failed to write asset " + path + " to " + assetFile, e);
} // depends on control dependency: [catch], data = [none]
}
} catch (final Exception e) {
throw new ArchiveExportException("Unexpected error encountered in export of " + node, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected boolean parametersMatch(Type requiredParameter, Type beanParameter) {
if (Types.isActualType(requiredParameter) && Types.isActualType(beanParameter)) {
/*
* the required type parameter and the bean type parameter are actual types with identical raw
* type, and, if the type is parameterized, the bean type parameter is assignable to the required
* type parameter according to these rules, or
*/
return matches(requiredParameter, beanParameter);
}
if (requiredParameter instanceof WildcardType && Types.isActualType(beanParameter)) {
/*
* the required type parameter is a wildcard, the bean type parameter is an actual type and the
* actual type is assignable to the upper bound, if any, of the wildcard and assignable from the
* lower bound, if any, of the wildcard, or
*/
return parametersMatch((WildcardType) requiredParameter, beanParameter);
}
if (requiredParameter instanceof WildcardType && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter is a wildcard, the bean type parameter is a type variable and the
* upper bound of the type variable is assignable to or assignable from the upper bound, if any, of
* the wildcard and assignable from the lower bound, if any, of the wildcard, or
*/
return parametersMatch((WildcardType) requiredParameter, (TypeVariable<?>) beanParameter);
}
if (Types.isActualType(requiredParameter) && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter is an actual type, the bean type parameter is a type variable and
* the actual type is assignable to the upper bound, if any, of the type variable, or
*/
return parametersMatch(requiredParameter, (TypeVariable<?>) beanParameter);
}
if (requiredParameter instanceof TypeVariable<?> && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter and the bean type parameter are both type variables and the upper
* bound of the required type parameter is assignable to the upper bound, if any, of the bean type
* parameter
*/
return parametersMatch((TypeVariable<?>) requiredParameter, (TypeVariable<?>) beanParameter);
}
return false;
} }
|
public class class_name {
protected boolean parametersMatch(Type requiredParameter, Type beanParameter) {
if (Types.isActualType(requiredParameter) && Types.isActualType(beanParameter)) {
/*
* the required type parameter and the bean type parameter are actual types with identical raw
* type, and, if the type is parameterized, the bean type parameter is assignable to the required
* type parameter according to these rules, or
*/
return matches(requiredParameter, beanParameter); // depends on control dependency: [if], data = [none]
}
if (requiredParameter instanceof WildcardType && Types.isActualType(beanParameter)) {
/*
* the required type parameter is a wildcard, the bean type parameter is an actual type and the
* actual type is assignable to the upper bound, if any, of the wildcard and assignable from the
* lower bound, if any, of the wildcard, or
*/
return parametersMatch((WildcardType) requiredParameter, beanParameter); // depends on control dependency: [if], data = [none]
}
if (requiredParameter instanceof WildcardType && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter is a wildcard, the bean type parameter is a type variable and the
* upper bound of the type variable is assignable to or assignable from the upper bound, if any, of
* the wildcard and assignable from the lower bound, if any, of the wildcard, or
*/
return parametersMatch((WildcardType) requiredParameter, (TypeVariable<?>) beanParameter); // depends on control dependency: [if], data = [)]
}
if (Types.isActualType(requiredParameter) && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter is an actual type, the bean type parameter is a type variable and
* the actual type is assignable to the upper bound, if any, of the type variable, or
*/
return parametersMatch(requiredParameter, (TypeVariable<?>) beanParameter); // depends on control dependency: [if], data = [)]
}
if (requiredParameter instanceof TypeVariable<?> && beanParameter instanceof TypeVariable<?>) {
/*
* the required type parameter and the bean type parameter are both type variables and the upper
* bound of the required type parameter is assignable to the upper bound, if any, of the bean type
* parameter
*/
return parametersMatch((TypeVariable<?>) requiredParameter, (TypeVariable<?>) beanParameter); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public String getFrameData() {
if (SockJsFrameType.OPEN == getType() || SockJsFrameType.HEARTBEAT == getType()) {
return null;
} else {
return getContent().substring(1);
}
} }
|
public class class_name {
public String getFrameData() {
if (SockJsFrameType.OPEN == getType() || SockJsFrameType.HEARTBEAT == getType()) {
return null; // depends on control dependency: [if], data = [none]
} else {
return getContent().substring(1); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ProcessorConfig extractEnricherConfig() {
try {
return ProfileUtil.blendProfileWithConfiguration(ProfileUtil.ENRICHER_CONFIG, profile, ResourceDirCreator.getFinalResourceDir(resourceDir, environment), enricher);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot extract enricher config: " + e,e);
}
} }
|
public class class_name {
private ProcessorConfig extractEnricherConfig() {
try {
return ProfileUtil.blendProfileWithConfiguration(ProfileUtil.ENRICHER_CONFIG, profile, ResourceDirCreator.getFinalResourceDir(resourceDir, environment), enricher); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException("Cannot extract enricher config: " + e,e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String getReportUpdate() {
for (I_CmsReport report : m_delegates) {
if (report.getClass().getName().toLowerCase().contains("html")) {
return report.getReportUpdate();
}
}
return "";
} }
|
public class class_name {
public String getReportUpdate() {
for (I_CmsReport report : m_delegates) {
if (report.getClass().getName().toLowerCase().contains("html")) {
return report.getReportUpdate(); // depends on control dependency: [if], data = [none]
}
}
return "";
} }
|
public class class_name {
public static QueryableStateConfiguration fromConfiguration(Configuration config) {
if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
return null;
}
final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.SERVER_PORT_RANGE));
final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);
final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);
return new QueryableStateConfiguration(
proxyPorts,
serverPorts,
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
numStateServerNetworkThreads,
numStateServerQueryThreads);
} }
|
public class class_name {
public static QueryableStateConfiguration fromConfiguration(Configuration config) {
if (!config.getBoolean(QueryableStateOptions.ENABLE_QUERYABLE_STATE_PROXY_SERVER)) {
return null; // depends on control dependency: [if], data = [none]
}
final Iterator<Integer> proxyPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.PROXY_PORT_RANGE));
final Iterator<Integer> serverPorts = NetUtils.getPortRangeFromString(
config.getString(QueryableStateOptions.SERVER_PORT_RANGE));
final int numProxyServerNetworkThreads = config.getInteger(QueryableStateOptions.PROXY_NETWORK_THREADS);
final int numProxyServerQueryThreads = config.getInteger(QueryableStateOptions.PROXY_ASYNC_QUERY_THREADS);
final int numStateServerNetworkThreads = config.getInteger(QueryableStateOptions.SERVER_NETWORK_THREADS);
final int numStateServerQueryThreads = config.getInteger(QueryableStateOptions.SERVER_ASYNC_QUERY_THREADS);
return new QueryableStateConfiguration(
proxyPorts,
serverPorts,
numProxyServerNetworkThreads,
numProxyServerQueryThreads,
numStateServerNetworkThreads,
numStateServerQueryThreads);
} }
|
public class class_name {
public void setIPRanges(java.util.Collection<IPRange> iPRanges) {
if (iPRanges == null) {
this.iPRanges = null;
return;
}
this.iPRanges = new com.amazonaws.internal.SdkInternalList<IPRange>(iPRanges);
} }
|
public class class_name {
public void setIPRanges(java.util.Collection<IPRange> iPRanges) {
if (iPRanges == null) {
this.iPRanges = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.iPRanges = new com.amazonaws.internal.SdkInternalList<IPRange>(iPRanges);
} }
|
public class class_name {
public static boolean lock(CacheConfigBean cacheConfigBean, String key, Object valueObj, int expireTimeInSecond, long timeOutInSecond) {
final LockData lockData = LOCK_THREAD_DATA.get();
if (lockData != null) {
lockData.getLockCount().incrementAndGet();
return true;
}
long startNano = System.nanoTime();
// 重试间隔等待时间
final int retryAwait = (int) timeOutInSecond * 1000 / TRY_NUM;
int autoIncrementTryNum = 0;
do {
autoIncrementTryNum++;
String result = "nil";
try (Jedis jedis = Redis.useDataSource(cacheConfigBean).getResource()) {
if (jedis != null)
result = ObjectCacheOperate.set(jedis, key, valueObj, "EX", expireTimeInSecond, "NX");
} catch (Exception e) {
LOG.error(e);
}
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
LOG.info(String.format("SET %s \"%s\" EX %s NX = result: %s, 第 %s 次尝试", key, valueObj, expireTimeInSecond, result, autoIncrementTryNum));
if ("OK".equals(result)) {
LOCK_THREAD_DATA.set(new LockData(key, FormatUtil.formatValue(valueObj)));
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION)) {
long endNano = System.nanoTime();
long consumeTime = (endNano - startNano) / 1000000;
LOG.info(String.format("key: %s, 分布式加锁, 尝试次数: %s, 累计耗时: %s 纳秒", key, autoIncrementTryNum, consumeTime));
}
return true;
}
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
LOG.info(String.format("key: %s, 分布式加锁, 目前尝试次数: %s, 暂停: %s 毫秒后继续尝试", key, autoIncrementTryNum, retryAwait));
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(retryAwait));
} while (autoIncrementTryNum < TRY_NUM);
return false;
} }
|
public class class_name {
public static boolean lock(CacheConfigBean cacheConfigBean, String key, Object valueObj, int expireTimeInSecond, long timeOutInSecond) {
final LockData lockData = LOCK_THREAD_DATA.get();
if (lockData != null) {
lockData.getLockCount().incrementAndGet(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
long startNano = System.nanoTime();
// 重试间隔等待时间
final int retryAwait = (int) timeOutInSecond * 1000 / TRY_NUM;
int autoIncrementTryNum = 0;
do {
autoIncrementTryNum++;
String result = "nil";
try (Jedis jedis = Redis.useDataSource(cacheConfigBean).getResource()) {
if (jedis != null)
result = ObjectCacheOperate.set(jedis, key, valueObj, "EX", expireTimeInSecond, "NX");
} catch (Exception e) {
LOG.error(e);
}
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
LOG.info(String.format("SET %s \"%s\" EX %s NX = result: %s, 第 %s 次尝试", key, valueObj, expireTimeInSecond, result, autoIncrementTryNum));
if ("OK".equals(result)) {
LOCK_THREAD_DATA.set(new LockData(key, FormatUtil.formatValue(valueObj)));
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION)) {
long endNano = System.nanoTime();
long consumeTime = (endNano - startNano) / 1000000;
LOG.info(String.format("key: %s, 分布式加锁, 尝试次数: %s, 累计耗时: %s 纳秒", key, autoIncrementTryNum, consumeTime)); // depends on control dependency: [if], data = [none]
}
return true;
}
if (!EnvUtil.getEnv().equals(EnvUtil.PRODUCTION))
LOG.info(String.format("key: %s, 分布式加锁, 目前尝试次数: %s, 暂停: %s 毫秒后继续尝试", key, autoIncrementTryNum, retryAwait));
LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(retryAwait));
} while (autoIncrementTryNum < TRY_NUM);
return false;
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId,
Long criterionId) throws RemoteException {
// Get the DataService.
DataServiceInterface dataService = adWordsServices.get(session, DataServiceInterface.class);
// Create a query to select all keyword bid simulations for the ad group.
ServiceQuery query =
new ServiceQuery.Builder()
.fields(
DataField.AdGroupId,
DataField.CriterionId,
DataField.StartDate,
DataField.EndDate,
DataField.Bid,
DataField.BiddableConversions,
DataField.BiddableConversionsValue,
DataField.LocalClicks,
DataField.LocalCost,
DataField.LocalImpressions)
.where(DataField.AdGroupId)
.equalTo(adGroupId)
.where(DataField.CriterionId)
.equalTo(criterionId)
.limit(0, PAGE_SIZE)
.build();
// Display bid landscapes.
CriterionBidLandscapePage page = null;
do {
query.nextPage(page);
// Retrieve keyword bid simulations one page at a time, continuing to request pages until all
// of them have been retrieved.
page = dataService.queryCriterionBidLandscape(query.toString());
if (page.getEntries() != null) {
for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) {
System.out.printf(
"Criterion bid landscape with ad group ID %d, criterion ID %d, "
+ "start date %s, end date %s, with landscape points:%n",
criterionBidLandscape.getAdGroupId(),
criterionBidLandscape.getCriterionId(),
criterionBidLandscape.getStartDate(),
criterionBidLandscape.getEndDate());
for (BidLandscapeLandscapePoint bidLanscapePoint :
criterionBidLandscape.getLandscapePoints()) {
System.out.printf(
"\t{bid: %d clicks: %d cost: %d impressions: %d, biddable conversions: %.2f, "
+ "biddable conversions value: %.2f}%n",
bidLanscapePoint.getBid().getMicroAmount(),
bidLanscapePoint.getClicks(),
bidLanscapePoint.getCost().getMicroAmount(),
bidLanscapePoint.getImpressions(),
bidLanscapePoint.getBiddableConversions(),
bidLanscapePoint.getBiddableConversionsValue());
}
System.out.println(" was found.");
}
}
} while (query.hasNext(page));
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId,
Long criterionId) throws RemoteException {
// Get the DataService.
DataServiceInterface dataService = adWordsServices.get(session, DataServiceInterface.class);
// Create a query to select all keyword bid simulations for the ad group.
ServiceQuery query =
new ServiceQuery.Builder()
.fields(
DataField.AdGroupId,
DataField.CriterionId,
DataField.StartDate,
DataField.EndDate,
DataField.Bid,
DataField.BiddableConversions,
DataField.BiddableConversionsValue,
DataField.LocalClicks,
DataField.LocalCost,
DataField.LocalImpressions)
.where(DataField.AdGroupId)
.equalTo(adGroupId)
.where(DataField.CriterionId)
.equalTo(criterionId)
.limit(0, PAGE_SIZE)
.build();
// Display bid landscapes.
CriterionBidLandscapePage page = null;
do {
query.nextPage(page);
// Retrieve keyword bid simulations one page at a time, continuing to request pages until all
// of them have been retrieved.
page = dataService.queryCriterionBidLandscape(query.toString());
if (page.getEntries() != null) {
for (CriterionBidLandscape criterionBidLandscape : page.getEntries()) {
System.out.printf(
"Criterion bid landscape with ad group ID %d, criterion ID %d, "
+ "start date %s, end date %s, with landscape points:%n",
criterionBidLandscape.getAdGroupId(),
criterionBidLandscape.getCriterionId(),
criterionBidLandscape.getStartDate(),
criterionBidLandscape.getEndDate()); // depends on control dependency: [for], data = [none]
for (BidLandscapeLandscapePoint bidLanscapePoint :
criterionBidLandscape.getLandscapePoints()) {
System.out.printf(
"\t{bid: %d clicks: %d cost: %d impressions: %d, biddable conversions: %.2f, "
+ "biddable conversions value: %.2f}%n",
bidLanscapePoint.getBid().getMicroAmount(),
bidLanscapePoint.getClicks(),
bidLanscapePoint.getCost().getMicroAmount(),
bidLanscapePoint.getImpressions(),
bidLanscapePoint.getBiddableConversions(),
bidLanscapePoint.getBiddableConversionsValue()); // depends on control dependency: [for], data = [none]
}
System.out.println(" was found."); // depends on control dependency: [for], data = [none]
}
}
} while (query.hasNext(page));
} }
|
public class class_name {
private double link(double d1, double d2) {
if (isScoreMatrix) {
return Math.max(d1,d2);
} else {
return Math.min(d1,d2);
}
} }
|
public class class_name {
private double link(double d1, double d2) {
if (isScoreMatrix) {
return Math.max(d1,d2); // depends on control dependency: [if], data = [none]
} else {
return Math.min(d1,d2); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private Collection<ClassDoc> subclasses(ClassDoc cd) {
Collection<ClassDoc> ret = classToSubclass.get(cd.qualifiedName());
if (ret == null) {
ret = new TreeSet<ClassDoc>();
List<ClassDoc> subs = classtree.subclasses(cd);
if (subs != null) {
ret.addAll(subs);
for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
ret.addAll(subclasses(it.next()));
}
}
addAll(classToSubclass, cd, ret);
}
return ret;
} }
|
public class class_name {
private Collection<ClassDoc> subclasses(ClassDoc cd) {
Collection<ClassDoc> ret = classToSubclass.get(cd.qualifiedName());
if (ret == null) {
ret = new TreeSet<ClassDoc>(); // depends on control dependency: [if], data = [none]
List<ClassDoc> subs = classtree.subclasses(cd);
if (subs != null) {
ret.addAll(subs); // depends on control dependency: [if], data = [(subs]
for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
ret.addAll(subclasses(it.next())); // depends on control dependency: [for], data = [it]
}
}
addAll(classToSubclass, cd, ret); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
static public Object readData(PositioningDataInputStream raf, Layout index, DataType dataType, Object arr) throws java.io.IOException {
if (showLayoutTypes) System.out.println("***PositioningDataInputStream LayoutType=" + index.getClass().getName());
if (dataType.getPrimitiveClassType() == byte.class || dataType == DataType.CHAR) {
byte[] pa = (byte[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
//return (dataType == DataType.CHAR) ? convertByteToChar(pa) : pa;
if (dataType == DataType.CHAR) return convertByteToChar(pa);
else return pa;
} else if (dataType.getPrimitiveClassType() == short.class) {
short[] pa = (short[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readShort(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType.getPrimitiveClassType() == int.class) {
int[] pa = (int[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readInt(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType == DataType.FLOAT) {
float[] pa = (float[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readFloat(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType == DataType.DOUBLE) {
double[] pa = (double[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readDouble(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType.getPrimitiveClassType() == long.class) {
long[] pa = (long[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readLong(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType == DataType.STRUCTURE) {
int recsize = index.getElemSize();
byte[] pa = (byte[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem() * recsize, chunk.getNelems() * recsize);
}
return pa;
}
throw new IllegalStateException();
} }
|
public class class_name {
static public Object readData(PositioningDataInputStream raf, Layout index, DataType dataType, Object arr) throws java.io.IOException {
if (showLayoutTypes) System.out.println("***PositioningDataInputStream LayoutType=" + index.getClass().getName());
if (dataType.getPrimitiveClassType() == byte.class || dataType == DataType.CHAR) {
byte[] pa = (byte[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
// depends on control dependency: [while], data = [none]
}
//return (dataType == DataType.CHAR) ? convertByteToChar(pa) : pa;
if (dataType == DataType.CHAR) return convertByteToChar(pa);
else return pa;
} else if (dataType.getPrimitiveClassType() == short.class) {
short[] pa = (short[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readShort(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
// depends on control dependency: [while], data = [none]
}
return pa;
} else if (dataType.getPrimitiveClassType() == int.class) {
int[] pa = (int[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readInt(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
// depends on control dependency: [while], data = [none]
}
return pa;
} else if (dataType == DataType.FLOAT) {
float[] pa = (float[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readFloat(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType == DataType.DOUBLE) {
double[] pa = (double[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readDouble(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType.getPrimitiveClassType() == long.class) {
long[] pa = (long[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.readLong(chunk.getSrcPos(), pa, (int) chunk.getDestElem(), chunk.getNelems());
}
return pa;
} else if (dataType == DataType.STRUCTURE) {
int recsize = index.getElemSize();
byte[] pa = (byte[]) arr;
while (index.hasNext()) {
Layout.Chunk chunk = index.next();
raf.read(chunk.getSrcPos(), pa, (int) chunk.getDestElem() * recsize, chunk.getNelems() * recsize);
}
return pa;
}
throw new IllegalStateException();
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.