code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Beta
public EventGridEvent[] deserializeEventGridEvents(final String requestContent, final SerializerAdapter<ObjectMapper> serializerAdapter) throws IOException {
EventGridEvent[] eventGridEvents = serializerAdapter.<EventGridEvent[]>deserialize(requestContent, EventGridEvent[].class);
for (EventGridEvent receivedEvent : eventGridEvents) {
if (receivedEvent.data() == null) {
continue;
} else {
final String eventType = receivedEvent.eventType();
final Type eventDataType;
if (SystemEventTypeMappings.containsMappingFor(eventType)) {
eventDataType = SystemEventTypeMappings.getMapping(eventType);
} else if (containsCustomEventMappingFor(eventType)) {
eventDataType = getCustomEventMapping(eventType);
} else {
eventDataType = null;
}
if (eventDataType != null) {
final String eventDataAsString = serializerAdapter.serializeRaw(receivedEvent.data());
final Object eventData = serializerAdapter.<Object>deserialize(eventDataAsString, eventDataType);
setEventData(receivedEvent, eventData);
}
}
}
return eventGridEvents;
} } | public class class_name {
@Beta
public EventGridEvent[] deserializeEventGridEvents(final String requestContent, final SerializerAdapter<ObjectMapper> serializerAdapter) throws IOException {
EventGridEvent[] eventGridEvents = serializerAdapter.<EventGridEvent[]>deserialize(requestContent, EventGridEvent[].class);
for (EventGridEvent receivedEvent : eventGridEvents) {
if (receivedEvent.data() == null) {
continue;
} else {
final String eventType = receivedEvent.eventType();
final Type eventDataType;
if (SystemEventTypeMappings.containsMappingFor(eventType)) {
eventDataType = SystemEventTypeMappings.getMapping(eventType); // depends on control dependency: [if], data = [none]
} else if (containsCustomEventMappingFor(eventType)) {
eventDataType = getCustomEventMapping(eventType); // depends on control dependency: [if], data = [none]
} else {
eventDataType = null; // depends on control dependency: [if], data = [none]
}
if (eventDataType != null) {
final String eventDataAsString = serializerAdapter.serializeRaw(receivedEvent.data());
final Object eventData = serializerAdapter.<Object>deserialize(eventDataAsString, eventDataType);
setEventData(receivedEvent, eventData); // depends on control dependency: [if], data = [none]
}
}
}
return eventGridEvents;
} } |
public class class_name {
public String getNameAsSingleString() {
List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix());
nameParts.addAll(getGiven());
nameParts.add(getFamilyElement());
nameParts.addAll(getSuffix());
if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts);
} else {
return getTextElement().getValue();
}
} } | public class class_name {
public String getNameAsSingleString() {
List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix());
nameParts.addAll(getGiven());
nameParts.add(getFamilyElement());
nameParts.addAll(getSuffix());
if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts);
// depends on control dependency: [if], data = [none]
} else {
return getTextElement().getValue();
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static double cdf(double val, double shape, double location, double scale) {
if(val < location) {
return 0;
}
val = (val - location) / scale;
return 1. / (1. + FastMath.pow(val, -shape));
} } | public class class_name {
public static double cdf(double val, double shape, double location, double scale) {
if(val < location) {
return 0; // depends on control dependency: [if], data = [none]
}
val = (val - location) / scale;
return 1. / (1. + FastMath.pow(val, -shape));
} } |
public class class_name {
public IpSet withIpAddresses(String... ipAddresses) {
if (this.ipAddresses == null) {
setIpAddresses(new java.util.ArrayList<String>(ipAddresses.length));
}
for (String ele : ipAddresses) {
this.ipAddresses.add(ele);
}
return this;
} } | public class class_name {
public IpSet withIpAddresses(String... ipAddresses) {
if (this.ipAddresses == null) {
setIpAddresses(new java.util.ArrayList<String>(ipAddresses.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : ipAddresses) {
this.ipAddresses.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public boolean process(LogProcessContext logCtx){
Boolean currentTrxStatus = logCtx.getFinalMasterTransStatus();
logCtx.getMasterTransactionStatusVotter().setTransactionStatus(currentTrxStatus);
LogCollection logCollection = logCtx.getLogCollection();
List<Content> orderedContents = logCollection.getOrderedContents();
//依次调用LOG对应的processor里的preProcess
//目前preProcess中其中一个任务就是确定主控事务状态,另外一个就是执行SAGA的 正向调用/TRY 等方法
//若主控事务状态未知,则部分LOG对应的preProcess操作里将会投票表决主控事务状态,若有表示不能提交的话,则事务状态为回滚
//根据preProcess的数据更新主控事务状态(主控事务状态确定,才能往下执行,)
for(int i = 0;i < orderedContents.size() ; i++){
Content content = orderedContents.get(i);
//check log order
Assert.isTrue(content.getcId() != null && content.getcId().equals(i + 1),"content list did not sort or contentId is null");
Class<? extends LogProcessor> proccessorClass = ContentType.getById(content.getLogType()).getProccessorClass();
if(proccessorClass == null){
if(LOG.isDebugEnabled()){
LOG.debug("processor not set,continue" + content);
}
continue;
}
LogProcessor processor = proccessorMap.get(proccessorClass);
if(!processor.preLogProcess(logCtx, content)){
LOG.warn( "log pre-Processor return false,end proccesing and retry later." + content);
return false;
}
}
// 事务状态未知,且本事务为主控事务,则更新主控事务状态
if (currentTrxStatus == null
&& MetaDataFilter.getMetaData(EasytransConstant.CallHeadKeys.PARENT_TRX_ID_KEY) == null) {
boolean allowCommit = logCtx.getMasterTransactionStatusVotter().getCurrentVoteStatusCommited();
int updateCount = transChecker.updateMasterTransactionStatus(logCtx.getTransactionId(),
allowCommit ? TransactionStatus.COMMITTED : TransactionStatus.ROLLBACKED);
//concurrent modify check
if(updateCount == 0) {
throw new RuntimeException("can not find the trx,or the status of Transaction is not UNKOWN!");
}
logCtx.setFinalMasterTransStatus(allowCommit);
}
//依次调用LOG对应的Processor的logProcess
//统计并发布SemiLog事件
//发布ProcessEnd事件
for(int i = 0;i < orderedContents.size() ; i++){
Content content = orderedContents.get(i);
//check log order
Assert.isTrue(content.getcId() != null && content.getcId().equals(i + 1),"content list did not sort or contentId is null");
if(content instanceof DemiLeftContent){
logCtx.getDemiLogManager().registerLeftDemiLog((DemiLeftContent)content);
}else if(content instanceof DemiRightContent){
logCtx.getDemiLogManager().registerRightDemiLog((DemiRightContent)content);
}
Class<? extends LogProcessor> proccessorClass = ContentType.getById(content.getLogType()).getProccessorClass();
if(proccessorClass == null){
if(LOG.isDebugEnabled()){
LOG.debug("processor not set,continue" + content);
}
continue;
}
LogProcessor processor = proccessorMap.get(proccessorClass);
if(!processor.logProcess(logCtx, content)){
LOG.warn( "log processor return false,end proccesing and retry later." + content);
return false;
}
}
if(!logCtx.getDemiLogManager().pubulishDemiLogEvent()){
LOG.warn("DemiLogEvent Process return false,end proccesing and retry later." + logCollection);
}
if(!logCtx.getProcessEndManager().publish()){
LOG.warn("End process return false,end proccesing and retry later." + logCollection);
}
//end and flush log
if(leastLogModel){
logCtx.getLogCache().clearCacheLogs();
}
logCtx.getLogCache().flush(true);
return true;
} } | public class class_name {
public boolean process(LogProcessContext logCtx){
Boolean currentTrxStatus = logCtx.getFinalMasterTransStatus();
logCtx.getMasterTransactionStatusVotter().setTransactionStatus(currentTrxStatus);
LogCollection logCollection = logCtx.getLogCollection();
List<Content> orderedContents = logCollection.getOrderedContents();
//依次调用LOG对应的processor里的preProcess
//目前preProcess中其中一个任务就是确定主控事务状态,另外一个就是执行SAGA的 正向调用/TRY 等方法
//若主控事务状态未知,则部分LOG对应的preProcess操作里将会投票表决主控事务状态,若有表示不能提交的话,则事务状态为回滚
//根据preProcess的数据更新主控事务状态(主控事务状态确定,才能往下执行,)
for(int i = 0;i < orderedContents.size() ; i++){
Content content = orderedContents.get(i);
//check log order
Assert.isTrue(content.getcId() != null && content.getcId().equals(i + 1),"content list did not sort or contentId is null");
// depends on control dependency: [for], data = [i]
Class<? extends LogProcessor> proccessorClass = ContentType.getById(content.getLogType()).getProccessorClass();
if(proccessorClass == null){
if(LOG.isDebugEnabled()){
LOG.debug("processor not set,continue" + content);
// depends on control dependency: [if], data = [none]
}
continue;
}
LogProcessor processor = proccessorMap.get(proccessorClass);
if(!processor.preLogProcess(logCtx, content)){
LOG.warn( "log pre-Processor return false,end proccesing and retry later." + content);
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
}
// 事务状态未知,且本事务为主控事务,则更新主控事务状态
if (currentTrxStatus == null
&& MetaDataFilter.getMetaData(EasytransConstant.CallHeadKeys.PARENT_TRX_ID_KEY) == null) {
boolean allowCommit = logCtx.getMasterTransactionStatusVotter().getCurrentVoteStatusCommited();
int updateCount = transChecker.updateMasterTransactionStatus(logCtx.getTransactionId(),
allowCommit ? TransactionStatus.COMMITTED : TransactionStatus.ROLLBACKED);
//concurrent modify check
if(updateCount == 0) {
throw new RuntimeException("can not find the trx,or the status of Transaction is not UNKOWN!");
}
logCtx.setFinalMasterTransStatus(allowCommit);
// depends on control dependency: [if], data = [none]
}
//依次调用LOG对应的Processor的logProcess
//统计并发布SemiLog事件
//发布ProcessEnd事件
for(int i = 0;i < orderedContents.size() ; i++){
Content content = orderedContents.get(i);
//check log order
Assert.isTrue(content.getcId() != null && content.getcId().equals(i + 1),"content list did not sort or contentId is null");
// depends on control dependency: [for], data = [i]
if(content instanceof DemiLeftContent){
logCtx.getDemiLogManager().registerLeftDemiLog((DemiLeftContent)content);
// depends on control dependency: [if], data = [none]
}else if(content instanceof DemiRightContent){
logCtx.getDemiLogManager().registerRightDemiLog((DemiRightContent)content);
// depends on control dependency: [if], data = [none]
}
Class<? extends LogProcessor> proccessorClass = ContentType.getById(content.getLogType()).getProccessorClass();
if(proccessorClass == null){
if(LOG.isDebugEnabled()){
LOG.debug("processor not set,continue" + content);
// depends on control dependency: [if], data = [none]
}
continue;
}
LogProcessor processor = proccessorMap.get(proccessorClass);
if(!processor.logProcess(logCtx, content)){
LOG.warn( "log processor return false,end proccesing and retry later." + content);
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
}
if(!logCtx.getDemiLogManager().pubulishDemiLogEvent()){
LOG.warn("DemiLogEvent Process return false,end proccesing and retry later." + logCollection);
// depends on control dependency: [if], data = [none]
}
if(!logCtx.getProcessEndManager().publish()){
LOG.warn("End process return false,end proccesing and retry later." + logCollection);
// depends on control dependency: [if], data = [none]
}
//end and flush log
if(leastLogModel){
logCtx.getLogCache().clearCacheLogs();
// depends on control dependency: [if], data = [none]
}
logCtx.getLogCache().flush(true);
return true;
} } |
public class class_name {
public void autoMap(final Datastore datastore) {
setDatastore(datastore);
try (DatastoreConnection con = datastore.openConnection()) {
final SchemaNavigator schemaNavigator = con.getSchemaNavigator();
for (final Entry<String, Column> entry : _map.entrySet()) {
if (entry.getValue() == null) {
final String path = entry.getKey();
final Column column = schemaNavigator.convertToColumn(path);
entry.setValue(column);
}
}
}
} } | public class class_name {
public void autoMap(final Datastore datastore) {
setDatastore(datastore);
try (DatastoreConnection con = datastore.openConnection()) {
final SchemaNavigator schemaNavigator = con.getSchemaNavigator();
for (final Entry<String, Column> entry : _map.entrySet()) {
if (entry.getValue() == null) {
final String path = entry.getKey();
final Column column = schemaNavigator.convertToColumn(path);
entry.setValue(column); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public boolean put(T item) {
BucketAndTag pos = hasher.generate(item);
long curTag = pos.tag;
long curIndex = pos.index;
long altIndex = hasher.altIndex(curIndex, curTag);
bucketLocker.lockBucketsWrite(curIndex, altIndex);
try {
if (table.insertToBucket(curIndex, curTag) || table.insertToBucket(altIndex, curTag)) {
count.incrementAndGet();
return true;
}
} finally {
bucketLocker.unlockBucketsWrite(curIndex, altIndex);
}
// don't do insertion loop if victim slot is already filled
long victimLockStamp = writeLockVictimIfClear();
if (victimLockStamp == 0L)
// victim was set...can't insert
return false;
try {
// fill victim slot and run fun insert method below
victim.setTag(curTag);
victim.setI1(curIndex);
victim.setI2(altIndex);
hasVictim = true;
for (int i = 0; i <= INSERT_ATTEMPTS; i++) {
if (trySwapVictimIntoEmptySpot())
break;
}
/*
* count is incremented here because we should never increase count
* when not locking buckets or victim. Reason is because otherwise
* count may be inconsistent across threads when doing operations
* that lock the whole table like hashcode() or equals()
*/
count.getAndIncrement();
} finally {
victimLock.unlock(victimLockStamp);
}
// if we get here, we either managed to insert victim using retries or
// it's in victim slot from another thread. Either way, it's in the
// table.
return true;
} } | public class class_name {
public boolean put(T item) {
BucketAndTag pos = hasher.generate(item);
long curTag = pos.tag;
long curIndex = pos.index;
long altIndex = hasher.altIndex(curIndex, curTag);
bucketLocker.lockBucketsWrite(curIndex, altIndex);
try {
if (table.insertToBucket(curIndex, curTag) || table.insertToBucket(altIndex, curTag)) {
count.incrementAndGet();
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
} finally {
bucketLocker.unlockBucketsWrite(curIndex, altIndex);
}
// don't do insertion loop if victim slot is already filled
long victimLockStamp = writeLockVictimIfClear();
if (victimLockStamp == 0L)
// victim was set...can't insert
return false;
try {
// fill victim slot and run fun insert method below
victim.setTag(curTag);
// depends on control dependency: [try], data = [none]
victim.setI1(curIndex);
// depends on control dependency: [try], data = [none]
victim.setI2(altIndex);
// depends on control dependency: [try], data = [none]
hasVictim = true;
// depends on control dependency: [try], data = [none]
for (int i = 0; i <= INSERT_ATTEMPTS; i++) {
if (trySwapVictimIntoEmptySpot())
break;
}
/*
* count is incremented here because we should never increase count
* when not locking buckets or victim. Reason is because otherwise
* count may be inconsistent across threads when doing operations
* that lock the whole table like hashcode() or equals()
*/
count.getAndIncrement();
// depends on control dependency: [try], data = [none]
} finally {
victimLock.unlock(victimLockStamp);
}
// if we get here, we either managed to insert victim using retries or
// it's in victim slot from another thread. Either way, it's in the
// table.
return true;
} } |
public class class_name {
@Deprecated
public static PatternInfo genPatternInfo(String intervalPattern,
boolean laterDateFirst) {
int splitPoint = splitPatternInto2Part(intervalPattern);
String firstPart = intervalPattern.substring(0, splitPoint);
String secondPart = null;
if ( splitPoint < intervalPattern.length() ) {
secondPart = intervalPattern.substring(splitPoint, intervalPattern.length());
}
return new PatternInfo(firstPart, secondPart, laterDateFirst);
} } | public class class_name {
@Deprecated
public static PatternInfo genPatternInfo(String intervalPattern,
boolean laterDateFirst) {
int splitPoint = splitPatternInto2Part(intervalPattern);
String firstPart = intervalPattern.substring(0, splitPoint);
String secondPart = null;
if ( splitPoint < intervalPattern.length() ) {
secondPart = intervalPattern.substring(splitPoint, intervalPattern.length()); // depends on control dependency: [if], data = [none]
}
return new PatternInfo(firstPart, secondPart, laterDateFirst);
} } |
public class class_name {
@Override
public void rot(long N, INDArray X, INDArray Y, double c, double s) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, X, Y);
if (X.isSparse() && !Y.isSparse()) {
Nd4j.getSparseBlasWrapper().level1().rot(N, X, Y, c, s);
} else if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, X, Y);
drot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), c, s);
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, X, Y);
srot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), (float) c, (float) s);
}
} } | public class class_name {
@Override
public void rot(long N, INDArray X, INDArray Y, double c, double s) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, X, Y);
if (X.isSparse() && !Y.isSparse()) {
Nd4j.getSparseBlasWrapper().level1().rot(N, X, Y, c, s); // depends on control dependency: [if], data = [none]
} else if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, X, Y); // depends on control dependency: [if], data = [none]
drot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), c, s); // depends on control dependency: [if], data = [none]
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, X, Y); // depends on control dependency: [if], data = [none]
srot(N, X, BlasBufferUtil.getBlasStride(X), Y, BlasBufferUtil.getBlasStride(X), (float) c, (float) s); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void addWorker(final VortexWorkerManager vortexWorkerManager) {
lock.lock();
try {
if (!terminated) {
if (!removedBeforeAddedWorkers.contains(vortexWorkerManager.getId())) {
this.runningWorkers.put(vortexWorkerManager.getId(), vortexWorkerManager);
this.schedulingPolicy.workerAdded(vortexWorkerManager);
this.workerAggregateFunctionMap.put(vortexWorkerManager.getId(), new HashSet<Integer>());
// Notify (possibly) waiting scheduler
noWorkerOrResource.signal();
}
} else {
// Terminate the worker
vortexWorkerManager.terminate();
}
} finally {
lock.unlock();
}
} } | public class class_name {
void addWorker(final VortexWorkerManager vortexWorkerManager) {
lock.lock();
try {
if (!terminated) {
if (!removedBeforeAddedWorkers.contains(vortexWorkerManager.getId())) {
this.runningWorkers.put(vortexWorkerManager.getId(), vortexWorkerManager); // depends on control dependency: [if], data = [none]
this.schedulingPolicy.workerAdded(vortexWorkerManager); // depends on control dependency: [if], data = [none]
this.workerAggregateFunctionMap.put(vortexWorkerManager.getId(), new HashSet<Integer>()); // depends on control dependency: [if], data = [none]
// Notify (possibly) waiting scheduler
noWorkerOrResource.signal(); // depends on control dependency: [if], data = [none]
}
} else {
// Terminate the worker
vortexWorkerManager.terminate(); // depends on control dependency: [if], data = [none]
}
} finally {
lock.unlock();
}
} } |
public class class_name {
public static Set<JType> getPossibleTypes(FieldOutline fieldOutline,
Aspect aspect) {
Validate.notNull(fieldOutline);
final ClassOutline classOutline = fieldOutline.parent();
final Outline outline = classOutline.parent();
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Set<JType> types = new HashSet<JType>();
if (propertyInfo.getAdapter() != null) {
types.add(propertyInfo.getAdapter().customType.toType(fieldOutline
.parent().parent(), aspect));
} else if (propertyInfo.baseType != null) {
types.add(propertyInfo.baseType);
} else {
Collection<? extends CTypeInfo> typeInfos = propertyInfo.ref();
for (CTypeInfo typeInfo : typeInfos) {
types.addAll(getPossibleTypes(outline, aspect, typeInfo));
}
}
return types;
} } | public class class_name {
public static Set<JType> getPossibleTypes(FieldOutline fieldOutline,
Aspect aspect) {
Validate.notNull(fieldOutline);
final ClassOutline classOutline = fieldOutline.parent();
final Outline outline = classOutline.parent();
final CPropertyInfo propertyInfo = fieldOutline.getPropertyInfo();
final Set<JType> types = new HashSet<JType>();
if (propertyInfo.getAdapter() != null) {
types.add(propertyInfo.getAdapter().customType.toType(fieldOutline
.parent().parent(), aspect)); // depends on control dependency: [if], data = [none]
} else if (propertyInfo.baseType != null) {
types.add(propertyInfo.baseType); // depends on control dependency: [if], data = [(propertyInfo.baseType]
} else {
Collection<? extends CTypeInfo> typeInfos = propertyInfo.ref(); // depends on control dependency: [if], data = [none]
for (CTypeInfo typeInfo : typeInfos) {
types.addAll(getPossibleTypes(outline, aspect, typeInfo)); // depends on control dependency: [for], data = [typeInfo]
}
}
return types;
} } |
public class class_name {
public static final boolean homeMethodEquals(Method homeMethod,
Properties beanMethodProps)
{
if ((homeMethod == null) || (beanMethodProps == null)) {
return false;
}
//----------------------
// Compare method names
//----------------------
String homeMethodName = homeMethod.getName();
String beanMethodName = (String) beanMethodProps.get("Name");
if (!homeMethodName.equals(beanMethodName)) {
return false;
}
//-------------------------
// Compare parameter types
//-------------------------
Class<?> homeMethodParamTypes[] = homeMethod.getParameterTypes();
String beanMethodParamTypes[] =
(String[]) beanMethodProps.get("ArgumentTypes");
if (homeMethodParamTypes.length != beanMethodParamTypes.length) {
return false;
}
for (int i = 0; i < homeMethodParamTypes.length; i++) {
if (!homeMethodParamTypes[i].getName().equals(beanMethodParamTypes[i])) {
return false;
}
}
//-----------------------------------------------------------------
// If method names are equal and parameter types match then the
// methods are equal for our purposes. Java does not allow methods
// with the same name and parameter types that differ only in
// return type and/or exception signature.
//-----------------------------------------------------------------
return true;
} } | public class class_name {
public static final boolean homeMethodEquals(Method homeMethod,
Properties beanMethodProps)
{
if ((homeMethod == null) || (beanMethodProps == null)) {
return false; // depends on control dependency: [if], data = [none]
}
//----------------------
// Compare method names
//----------------------
String homeMethodName = homeMethod.getName();
String beanMethodName = (String) beanMethodProps.get("Name");
if (!homeMethodName.equals(beanMethodName)) {
return false; // depends on control dependency: [if], data = [none]
}
//-------------------------
// Compare parameter types
//-------------------------
Class<?> homeMethodParamTypes[] = homeMethod.getParameterTypes();
String beanMethodParamTypes[] =
(String[]) beanMethodProps.get("ArgumentTypes");
if (homeMethodParamTypes.length != beanMethodParamTypes.length) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < homeMethodParamTypes.length; i++) {
if (!homeMethodParamTypes[i].getName().equals(beanMethodParamTypes[i])) {
return false; // depends on control dependency: [if], data = [none]
}
}
//-----------------------------------------------------------------
// If method names are equal and parameter types match then the
// methods are equal for our purposes. Java does not allow methods
// with the same name and parameter types that differ only in
// return type and/or exception signature.
//-----------------------------------------------------------------
return true;
} } |
public class class_name {
public void marshall(TracingConfig tracingConfig, ProtocolMarshaller protocolMarshaller) {
if (tracingConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tracingConfig.getMode(), MODE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TracingConfig tracingConfig, ProtocolMarshaller protocolMarshaller) {
if (tracingConfig == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tracingConfig.getMode(), MODE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void cacheThreadLocalRawStore() {
Long threadId = this.getId();
RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore();
if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) {
LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " +
this.getName() + " to threadRawStoreMap for future cleanup.");
threadRawStoreMap.put(threadId, threadLocalRawStore);
}
} } | public class class_name {
public void cacheThreadLocalRawStore() {
Long threadId = this.getId();
RawStore threadLocalRawStore = HiveMetaStore.HMSHandler.getRawStore();
if (threadLocalRawStore != null && !threadRawStoreMap.containsKey(threadId)) {
LOG.debug("Adding RawStore: " + threadLocalRawStore + ", for the thread: " +
this.getName() + " to threadRawStoreMap for future cleanup."); // depends on control dependency: [if], data = [none]
threadRawStoreMap.put(threadId, threadLocalRawStore); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String latencyHistoReport() {
ByteArrayOutputStream baos= new ByteArrayOutputStream();
PrintStream pw = null;
try {
pw = new PrintStream(baos, false, Charsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
Throwables.propagate(e);
}
//Get a latency report in milliseconds
m_latencyHistogram.outputPercentileDistributionVolt(pw, 1, 1000.0);
return new String(baos.toByteArray(), Charsets.UTF_8);
} } | public class class_name {
public String latencyHistoReport() {
ByteArrayOutputStream baos= new ByteArrayOutputStream();
PrintStream pw = null;
try {
pw = new PrintStream(baos, false, Charsets.UTF_8.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
//Get a latency report in milliseconds
m_latencyHistogram.outputPercentileDistributionVolt(pw, 1, 1000.0);
return new String(baos.toByteArray(), Charsets.UTF_8);
} } |
public class class_name {
private void callOnTextMessage(byte[] data)
{
if (mWebSocket.isDirectTextMessage())
{
mWebSocket.getListenerManager().callOnTextMessage(data);
return;
}
try
{
// Interpret the byte array as a string.
// OutOfMemoryError may happen when the size of data is too big.
String message = Misc.toStringUTF8(data);
// Call onTextMessage() method of the listeners.
callOnTextMessage(message);
}
catch (Throwable t)
{
// Failed to convert payload data into a string.
WebSocketException wse = new WebSocketException(
WebSocketError.TEXT_MESSAGE_CONSTRUCTION_ERROR,
"Failed to convert payload data into a string: " + t.getMessage(), t);
// Notify the listeners that text message construction failed.
callOnError(wse);
callOnTextMessageError(wse, data);
}
} } | public class class_name {
private void callOnTextMessage(byte[] data)
{
if (mWebSocket.isDirectTextMessage())
{
mWebSocket.getListenerManager().callOnTextMessage(data); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try
{
// Interpret the byte array as a string.
// OutOfMemoryError may happen when the size of data is too big.
String message = Misc.toStringUTF8(data);
// Call onTextMessage() method of the listeners.
callOnTextMessage(message); // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
// Failed to convert payload data into a string.
WebSocketException wse = new WebSocketException(
WebSocketError.TEXT_MESSAGE_CONSTRUCTION_ERROR,
"Failed to convert payload data into a string: " + t.getMessage(), t);
// Notify the listeners that text message construction failed.
callOnError(wse);
callOnTextMessageError(wse, data);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
HtmlTag attr(String name, String value) {
if (attrs == null) {
attrs = new HashMap<>();
}
attrs.put(name, value);
return this;
} } | public class class_name {
HtmlTag attr(String name, String value) {
if (attrs == null) {
attrs = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
attrs.put(name, value);
return this;
} } |
public class class_name {
public Set<String> getSelected() {
Set<String> result = new HashSet<String>();
int i = 0;
for (Map.Entry<String, String> entry : m_items.entrySet()) {
String key = entry.getKey();
CmsCheckBox checkBox = m_checkboxes.get(i);
if (checkBox.isChecked()) {
result.add(key);
}
i += 1;
}
return result;
} } | public class class_name {
public Set<String> getSelected() {
Set<String> result = new HashSet<String>();
int i = 0;
for (Map.Entry<String, String> entry : m_items.entrySet()) {
String key = entry.getKey();
CmsCheckBox checkBox = m_checkboxes.get(i);
if (checkBox.isChecked()) {
result.add(key);
// depends on control dependency: [if], data = [none]
}
i += 1;
// depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
protected boolean findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder) {
boolean annotationFound = false;
PojoDescriptor<?> descriptor = descriptorBuilder.getDescriptor(getStateClass());
for (PojoPropertyDescriptor propertyDescriptor : descriptor.getPropertyDescriptors()) {
PojoPropertyAccessorOneArg setter = propertyDescriptor.getAccessor(PojoPropertyAccessorOneArgMode.SET);
if (setter != null) {
AccessibleObject accessible = setter.getAccessibleObject();
CliOption option = accessible.getAnnotation(CliOption.class);
CliArgument argument = accessible.getAnnotation(CliArgument.class);
if ((option != null) && (argument != null)) {
// property can not both be option and argument
throw new CliOptionAndArgumentAnnotationException(propertyDescriptor.getName());
} else if ((option != null) || (argument != null)) {
annotationFound = true;
PojoPropertyAccessorNonArg getter = propertyDescriptor.getAccessor(PojoPropertyAccessorNonArgMode.GET);
ValueValidator<?> validator = this.validatorBuilder.newValidator(getStateClass(), propertyDescriptor.getName());
if (option != null) {
CliOptionContainer optionContainer = new CliOptionContainer(option, setter, getter, validator);
addOption(optionContainer);
} else {
assert (argument != null);
CliArgumentContainer argumentContainer = new CliArgumentContainer(argument, setter, getter, validator);
addArgument(argumentContainer);
}
}
}
}
return annotationFound;
} } | public class class_name {
protected boolean findPropertyAnnotations(PojoDescriptorBuilder descriptorBuilder) {
boolean annotationFound = false;
PojoDescriptor<?> descriptor = descriptorBuilder.getDescriptor(getStateClass());
for (PojoPropertyDescriptor propertyDescriptor : descriptor.getPropertyDescriptors()) {
PojoPropertyAccessorOneArg setter = propertyDescriptor.getAccessor(PojoPropertyAccessorOneArgMode.SET);
if (setter != null) {
AccessibleObject accessible = setter.getAccessibleObject();
CliOption option = accessible.getAnnotation(CliOption.class);
CliArgument argument = accessible.getAnnotation(CliArgument.class);
if ((option != null) && (argument != null)) {
// property can not both be option and argument
throw new CliOptionAndArgumentAnnotationException(propertyDescriptor.getName());
} else if ((option != null) || (argument != null)) {
annotationFound = true; // depends on control dependency: [if], data = [none]
PojoPropertyAccessorNonArg getter = propertyDescriptor.getAccessor(PojoPropertyAccessorNonArgMode.GET);
ValueValidator<?> validator = this.validatorBuilder.newValidator(getStateClass(), propertyDescriptor.getName());
if (option != null) {
CliOptionContainer optionContainer = new CliOptionContainer(option, setter, getter, validator);
addOption(optionContainer); // depends on control dependency: [if], data = [(option]
} else {
assert (argument != null); // depends on control dependency: [if], data = [null)]
CliArgumentContainer argumentContainer = new CliArgumentContainer(argument, setter, getter, validator);
addArgument(argumentContainer); // depends on control dependency: [if], data = [none]
}
}
}
}
return annotationFound;
} } |
public class class_name {
public void setDiskContainers(java.util.Collection<ImageDiskContainer> diskContainers) {
if (diskContainers == null) {
this.diskContainers = null;
return;
}
this.diskContainers = new com.amazonaws.internal.SdkInternalList<ImageDiskContainer>(diskContainers);
} } | public class class_name {
public void setDiskContainers(java.util.Collection<ImageDiskContainer> diskContainers) {
if (diskContainers == null) {
this.diskContainers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.diskContainers = new com.amazonaws.internal.SdkInternalList<ImageDiskContainer>(diskContainers);
} } |
public class class_name {
public DescribeServices getAvailableServices() {
if (services == null) {
Set<String> keys = this.getRegisteredConfigurations().keySet();
Iterator<String> it = keys.iterator();
String id = null;
services = new DescribeServices();
while (it.hasNext()) {
id = it.next();
services.put(id, this.getServiceConfiguration(id));
}
}
return services;
} } | public class class_name {
public DescribeServices getAvailableServices() {
if (services == null) {
Set<String> keys = this.getRegisteredConfigurations().keySet();
Iterator<String> it = keys.iterator();
String id = null;
services = new DescribeServices(); // depends on control dependency: [if], data = [none]
while (it.hasNext()) {
id = it.next(); // depends on control dependency: [while], data = [none]
services.put(id, this.getServiceConfiguration(id)); // depends on control dependency: [while], data = [none]
}
}
return services;
} } |
public class class_name {
@Override
public Object getData() {
BeanAndProviderBoundComponentModel model = getComponentModel();
Object data = model.getData();
String beanProperty = getBeanProperty();
if (beanProperty != null) {
Object sharedData = ((BeanAndProviderBoundComponentModel) getDefaultModel()).getData();
if (!isFlagSet(ComponentModel.USER_DATA_SET) && Util.equals(data, sharedData)) {
Object bean = getBean();
if (bean != null) {
data = getBeanValue();
}
}
}
return data;
} } | public class class_name {
@Override
public Object getData() {
BeanAndProviderBoundComponentModel model = getComponentModel();
Object data = model.getData();
String beanProperty = getBeanProperty();
if (beanProperty != null) {
Object sharedData = ((BeanAndProviderBoundComponentModel) getDefaultModel()).getData();
if (!isFlagSet(ComponentModel.USER_DATA_SET) && Util.equals(data, sharedData)) {
Object bean = getBean();
if (bean != null) {
data = getBeanValue(); // depends on control dependency: [if], data = [none]
}
}
}
return data;
} } |
public class class_name {
private void compress() {
if (sample.size() < 2) {
return;
}
ListIterator<Item> it = sample.listIterator();
int removed = 0;
Item prev = null;
Item next = it.next();
while (it.hasNext()) {
prev = next;
next = it.next();
if (prev.g + next.g + next.delta <= allowableError(it.previousIndex())) {
next.g += prev.g;
// Remove prev. it.remove() kills the last thing returned.
it.previous();
it.previous();
it.remove();
// it.next() is now equal to next, skip it back forward again
it.next();
removed++;
}
}
} } | public class class_name {
private void compress() {
if (sample.size() < 2) {
return; // depends on control dependency: [if], data = [none]
}
ListIterator<Item> it = sample.listIterator();
int removed = 0;
Item prev = null;
Item next = it.next();
while (it.hasNext()) {
prev = next; // depends on control dependency: [while], data = [none]
next = it.next(); // depends on control dependency: [while], data = [none]
if (prev.g + next.g + next.delta <= allowableError(it.previousIndex())) {
next.g += prev.g; // depends on control dependency: [if], data = [none]
// Remove prev. it.remove() kills the last thing returned.
it.previous(); // depends on control dependency: [if], data = [none]
it.previous(); // depends on control dependency: [if], data = [none]
it.remove(); // depends on control dependency: [if], data = [none]
// it.next() is now equal to next, skip it back forward again
it.next(); // depends on control dependency: [if], data = [none]
removed++; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void restoreState(FacesContext context, Object state)
{
if (state != null)
{
methodExpression = (MethodExpression) state;
}
} } | public class class_name {
public void restoreState(FacesContext context, Object state)
{
if (state != null)
{
methodExpression = (MethodExpression) state; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Boolean toBoolean(final Object value, final Boolean defaultValue) {
final Boolean result = toBoolean(value);
if (result == null) {
return defaultValue;
}
return result;
} } | public class class_name {
public Boolean toBoolean(final Object value, final Boolean defaultValue) {
final Boolean result = toBoolean(value);
if (result == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private boolean nextSearchItemset(BitVector bv, int[] scratchi, int[] iters) {
final int last = scratchi.length - 1;
for(int j = last; j >= 0; j--) {
int n = bv.iterAdvance(iters[j]);
if(n >= 0 && (j == last || n != iters[j + 1])) {
iters[j] = n;
scratchi[j] = bv.iterDim(n);
return true; // Success
}
}
return false;
} } | public class class_name {
private boolean nextSearchItemset(BitVector bv, int[] scratchi, int[] iters) {
final int last = scratchi.length - 1;
for(int j = last; j >= 0; j--) {
int n = bv.iterAdvance(iters[j]);
if(n >= 0 && (j == last || n != iters[j + 1])) {
iters[j] = n; // depends on control dependency: [if], data = [none]
scratchi[j] = bv.iterDim(n); // depends on control dependency: [if], data = [none]
return true; // Success // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void parseLinkHeader(final String link) {
final String [] links = link.split(",");
for (final String part : links) {
final String[] segments = part.split(";");
if (segments.length < 2)
continue;
String linkPart = segments[0].trim();
if (!linkPart.startsWith("<") || !linkPart.endsWith(">")) {
continue;
}
linkPart = linkPart.substring(1, linkPart.length() - 1);
for (int i = 1; i < segments.length; i++) {
final String[] rel = segments[i].trim().split("=");
if (rel.length < 2 || !"rel".equals(rel[0]))
continue;
String relValue = rel[1];
if (relValue.startsWith("\"") && relValue.endsWith("\"")) {
relValue = relValue.substring(1, relValue.length() - 1);
}
if ("first".equals(relValue)) {
firstLink = linkPart;
}
else if ("last".equals(relValue)) {
lastLink = linkPart;
}
else if ("next".equals(relValue)) {
nextLink = linkPart;
}
else if ("previous".equals(relValue)) {
previousLink = linkPart;
}
}
}
} } | public class class_name {
public void parseLinkHeader(final String link) {
final String [] links = link.split(",");
for (final String part : links) {
final String[] segments = part.split(";");
if (segments.length < 2)
continue;
String linkPart = segments[0].trim();
if (!linkPart.startsWith("<") || !linkPart.endsWith(">")) {
continue;
}
linkPart = linkPart.substring(1, linkPart.length() - 1); // depends on control dependency: [for], data = [none]
for (int i = 1; i < segments.length; i++) {
final String[] rel = segments[i].trim().split("=");
if (rel.length < 2 || !"rel".equals(rel[0]))
continue;
String relValue = rel[1];
if (relValue.startsWith("\"") && relValue.endsWith("\"")) {
relValue = relValue.substring(1, relValue.length() - 1); // depends on control dependency: [if], data = [none]
}
if ("first".equals(relValue)) {
firstLink = linkPart; // depends on control dependency: [if], data = [none]
}
else if ("last".equals(relValue)) {
lastLink = linkPart; // depends on control dependency: [if], data = [none]
}
else if ("next".equals(relValue)) {
nextLink = linkPart; // depends on control dependency: [if], data = [none]
}
else if ("previous".equals(relValue)) {
previousLink = linkPart; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public ArrayList<JTSFeature> getFeaturesByCategory(String category, double lon, double lat, double distanceInMeters,
List<Param> optionalParams) throws Exception {
List<String> ids = serviceManager.getAvailableServices().getServicesIDByCategory(category);
ArrayList<JTSFeature> features = new ArrayList<JTSFeature>();
for (String id : ids) {
try {
features.addAll(this.getFeatures(id, lon, lat, distanceInMeters, optionalParams));
} catch (Exception e) {
logger.error("POIProxy", e);
}
}
return features;
} } | public class class_name {
public ArrayList<JTSFeature> getFeaturesByCategory(String category, double lon, double lat, double distanceInMeters,
List<Param> optionalParams) throws Exception {
List<String> ids = serviceManager.getAvailableServices().getServicesIDByCategory(category);
ArrayList<JTSFeature> features = new ArrayList<JTSFeature>();
for (String id : ids) {
try {
features.addAll(this.getFeatures(id, lon, lat, distanceInMeters, optionalParams)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error("POIProxy", e);
} // depends on control dependency: [catch], data = [none]
}
return features;
} } |
public class class_name {
public void initialize(OnNavigationReadyCallback onNavigationReadyCallback,
@NonNull CameraPosition initialMapCameraPosition) {
this.onNavigationReadyCallback = onNavigationReadyCallback;
this.initialMapCameraPosition = initialMapCameraPosition;
if (!isMapInitialized) {
mapView.getMapAsync(this);
} else {
onNavigationReadyCallback.onNavigationReady(navigationViewModel.isRunning());
}
} } | public class class_name {
public void initialize(OnNavigationReadyCallback onNavigationReadyCallback,
@NonNull CameraPosition initialMapCameraPosition) {
this.onNavigationReadyCallback = onNavigationReadyCallback;
this.initialMapCameraPosition = initialMapCameraPosition;
if (!isMapInitialized) {
mapView.getMapAsync(this); // depends on control dependency: [if], data = [none]
} else {
onNavigationReadyCallback.onNavigationReady(navigationViewModel.isRunning()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void closeQuietly(final Session session)
{
if (session != null) {
try {
session.close();
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedException");
}
if (je.getCause() instanceof InterruptedIOException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedIOException");
}
else {
LOG.warnDebug(je, "While closing session");
}
}
}
} } | public class class_name {
public static void closeQuietly(final Session session)
{
if (session != null) {
try {
session.close(); // depends on control dependency: [try], data = [none]
}
catch (JMSException je) {
if (je.getCause() instanceof InterruptedException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedException"); // depends on control dependency: [if], data = [none]
}
if (je.getCause() instanceof InterruptedIOException) {
LOG.trace("ActiveMQ caught and wrapped InterruptedIOException"); // depends on control dependency: [if], data = [none]
}
else {
LOG.warnDebug(je, "While closing session"); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private final void step4() {
switch (b[k]) {
case 'e':
if (endWith("icate")) {
r("ic");
break;
}
if (endWith("ative")) {
r("");
break;
}
if (endWith("alize")) {
r("al");
break;
}
break;
case 'i':
if (endWith("iciti")) {
r("ic");
break;
}
break;
case 'l':
if (endWith("ical")) {
r("ic");
break;
}
if (endWith("ful")) {
r("");
break;
}
break;
case 's':
if (endWith("ness")) {
r("");
break;
}
break;
}
} } | public class class_name {
private final void step4() {
switch (b[k]) {
case 'e':
if (endWith("icate")) {
r("ic"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ative")) {
r(""); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("alize")) {
r("al"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'i':
if (endWith("iciti")) {
r("ic"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'l':
if (endWith("ical")) {
r("ic"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ful")) {
r(""); // depends on control dependency: [if], data = [none]
break;
}
break;
case 's':
if (endWith("ness")) {
r(""); // depends on control dependency: [if], data = [none]
break;
}
break;
}
} } |
public class class_name {
public boolean merge(Row other) throws IllegalArgumentException
{
if(canMerge(other))
{
occupancySet.or(other.occupancySet);
for(GridEvent e : other.events)
{
events.add(e);
}
return true;
}
else
{
return false;
}
} } | public class class_name {
public boolean merge(Row other) throws IllegalArgumentException
{
if(canMerge(other))
{
occupancySet.or(other.occupancySet);
for(GridEvent e : other.events)
{
events.add(e); // depends on control dependency: [for], data = [e]
}
return true;
}
else
{
return false;
}
} } |
public class class_name {
public void marshall(DescribeOrganizationalUnitRequest describeOrganizationalUnitRequest, ProtocolMarshaller protocolMarshaller) {
if (describeOrganizationalUnitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeOrganizationalUnitRequest.getOrganizationalUnitId(), ORGANIZATIONALUNITID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeOrganizationalUnitRequest describeOrganizationalUnitRequest, ProtocolMarshaller protocolMarshaller) {
if (describeOrganizationalUnitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeOrganizationalUnitRequest.getOrganizationalUnitId(), ORGANIZATIONALUNITID_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 CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig(
CmsObject cms,
CmsListManager.ListConfigurationBean config) {
try {
return new CmsSimpleSearchConfigurationParser(cms, config, null);
} catch (JSONException e) {
return null;
}
} } | public class class_name {
public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig(
CmsObject cms,
CmsListManager.ListConfigurationBean config) {
try {
return new CmsSimpleSearchConfigurationParser(cms, config, null); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addPrivateCredential(final Subject subject, final Object credential) {
if (!WildFlySecurityManager.isChecking()) {
subject.getPrivateCredentials().add(credential);
}
else {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
subject.getPrivateCredentials().add(credential);
return null;
});
}
} } | public class class_name {
private void addPrivateCredential(final Subject subject, final Object credential) {
if (!WildFlySecurityManager.isChecking()) {
subject.getPrivateCredentials().add(credential); // depends on control dependency: [if], data = [none]
}
else {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
subject.getPrivateCredentials().add(credential);
return null;
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final EObject ruleXSwitchExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
Token otherlv_8=null;
Token otherlv_10=null;
Token otherlv_12=null;
Token otherlv_13=null;
Token otherlv_15=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_switch_5_0 = null;
EObject lv_declaredParam_7_0 = null;
EObject lv_switch_9_0 = null;
EObject lv_cases_11_0 = null;
EObject lv_default_14_0 = null;
enterRule();
try {
// InternalPureXbase.g:3641:2: ( ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' ) )
// InternalPureXbase.g:3642:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
{
// InternalPureXbase.g:3642:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
// InternalPureXbase.g:3643:3: () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}'
{
// InternalPureXbase.g:3643:3: ()
// InternalPureXbase.g:3644:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXSwitchExpressionAccess().getXSwitchExpressionAction_0(),
current);
}
}
otherlv_1=(Token)match(input,66,FOLLOW_51); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXSwitchExpressionAccess().getSwitchKeyword_1());
}
// InternalPureXbase.g:3654:3: ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) )
int alt66=2;
alt66 = dfa66.predict(input);
switch (alt66) {
case 1 :
// InternalPureXbase.g:3655:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
{
// InternalPureXbase.g:3655:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
// InternalPureXbase.g:3656:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')'
{
// InternalPureXbase.g:3656:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalPureXbase.g:3657:6: ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalPureXbase.g:3667:6: (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalPureXbase.g:3668:7: otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
otherlv_2=(Token)match(input,15,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXSwitchExpressionAccess().getLeftParenthesisKeyword_2_0_0_0_0());
}
// InternalPureXbase.g:3672:7: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalPureXbase.g:3673:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalPureXbase.g:3673:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalPureXbase.g:3674:9: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_0_0_0_1_0());
}
pushFollow(FOLLOW_52);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_4=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_0_0_0_2());
}
}
}
// InternalPureXbase.g:3697:5: ( (lv_switch_5_0= ruleXExpression ) )
// InternalPureXbase.g:3698:6: (lv_switch_5_0= ruleXExpression )
{
// InternalPureXbase.g:3698:6: (lv_switch_5_0= ruleXExpression )
// InternalPureXbase.g:3699:7: lv_switch_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_0_1_0());
}
pushFollow(FOLLOW_8);
lv_switch_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"switch",
lv_switch_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
otherlv_6=(Token)match(input,16,FOLLOW_40); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXSwitchExpressionAccess().getRightParenthesisKeyword_2_0_2());
}
}
}
break;
case 2 :
// InternalPureXbase.g:3722:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:3722:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
// InternalPureXbase.g:3723:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) )
{
// InternalPureXbase.g:3723:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )?
int alt65=2;
alt65 = dfa65.predict(input);
switch (alt65) {
case 1 :
// InternalPureXbase.g:3724:6: ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
{
// InternalPureXbase.g:3733:6: ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
// InternalPureXbase.g:3734:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':'
{
// InternalPureXbase.g:3734:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) )
// InternalPureXbase.g:3735:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
{
// InternalPureXbase.g:3735:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
// InternalPureXbase.g:3736:9: lv_declaredParam_7_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_1_0_0_0_0());
}
pushFollow(FOLLOW_52);
lv_declaredParam_7_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"declaredParam",
lv_declaredParam_7_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_8=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_1_0_0_1());
}
}
}
break;
}
// InternalPureXbase.g:3759:5: ( (lv_switch_9_0= ruleXExpression ) )
// InternalPureXbase.g:3760:6: (lv_switch_9_0= ruleXExpression )
{
// InternalPureXbase.g:3760:6: (lv_switch_9_0= ruleXExpression )
// InternalPureXbase.g:3761:7: lv_switch_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_1_1_0());
}
pushFollow(FOLLOW_40);
lv_switch_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"switch",
lv_switch_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
break;
}
otherlv_10=(Token)match(input,59,FOLLOW_53); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXSwitchExpressionAccess().getLeftCurlyBracketKeyword_3());
}
// InternalPureXbase.g:3784:3: ( (lv_cases_11_0= ruleXCasePart ) )*
loop67:
do {
int alt67=2;
int LA67_0 = input.LA(1);
if ( (LA67_0==RULE_ID||LA67_0==15||LA67_0==22||LA67_0==41||LA67_0==57||LA67_0==68) ) {
alt67=1;
}
switch (alt67) {
case 1 :
// InternalPureXbase.g:3785:4: (lv_cases_11_0= ruleXCasePart )
{
// InternalPureXbase.g:3785:4: (lv_cases_11_0= ruleXCasePart )
// InternalPureXbase.g:3786:5: lv_cases_11_0= ruleXCasePart
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getCasesXCasePartParserRuleCall_4_0());
}
pushFollow(FOLLOW_53);
lv_cases_11_0=ruleXCasePart();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
add(
current,
"cases",
lv_cases_11_0,
"org.eclipse.xtext.xbase.Xbase.XCasePart");
afterParserOrEnumRuleCall();
}
}
}
break;
default :
break loop67;
}
} while (true);
// InternalPureXbase.g:3803:3: (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )?
int alt68=2;
int LA68_0 = input.LA(1);
if ( (LA68_0==67) ) {
alt68=1;
}
switch (alt68) {
case 1 :
// InternalPureXbase.g:3804:4: otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) )
{
otherlv_12=(Token)match(input,67,FOLLOW_52); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXSwitchExpressionAccess().getDefaultKeyword_5_0());
}
otherlv_13=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_5_1());
}
// InternalPureXbase.g:3812:4: ( (lv_default_14_0= ruleXExpression ) )
// InternalPureXbase.g:3813:5: (lv_default_14_0= ruleXExpression )
{
// InternalPureXbase.g:3813:5: (lv_default_14_0= ruleXExpression )
// InternalPureXbase.g:3814:6: lv_default_14_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDefaultXExpressionParserRuleCall_5_2_0());
}
pushFollow(FOLLOW_54);
lv_default_14_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule());
}
set(
current,
"default",
lv_default_14_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
}
otherlv_15=(Token)match(input,60,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_15, grammarAccess.getXSwitchExpressionAccess().getRightCurlyBracketKeyword_6());
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXSwitchExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
Token otherlv_8=null;
Token otherlv_10=null;
Token otherlv_12=null;
Token otherlv_13=null;
Token otherlv_15=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_switch_5_0 = null;
EObject lv_declaredParam_7_0 = null;
EObject lv_switch_9_0 = null;
EObject lv_cases_11_0 = null;
EObject lv_default_14_0 = null;
enterRule();
try {
// InternalPureXbase.g:3641:2: ( ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' ) )
// InternalPureXbase.g:3642:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
{
// InternalPureXbase.g:3642:2: ( () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}' )
// InternalPureXbase.g:3643:3: () otherlv_1= 'switch' ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) ) otherlv_10= '{' ( (lv_cases_11_0= ruleXCasePart ) )* (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )? otherlv_15= '}'
{
// InternalPureXbase.g:3643:3: ()
// InternalPureXbase.g:3644:4:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXSwitchExpressionAccess().getXSwitchExpressionAction_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_1=(Token)match(input,66,FOLLOW_51); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXSwitchExpressionAccess().getSwitchKeyword_1()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3654:3: ( ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' ) | ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) ) )
int alt66=2;
alt66 = dfa66.predict(input);
switch (alt66) {
case 1 :
// InternalPureXbase.g:3655:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
{
// InternalPureXbase.g:3655:4: ( ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')' )
// InternalPureXbase.g:3656:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_switch_5_0= ruleXExpression ) ) otherlv_6= ')'
{
// InternalPureXbase.g:3656:5: ( ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalPureXbase.g:3657:6: ( ( '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalPureXbase.g:3667:6: (otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalPureXbase.g:3668:7: otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
otherlv_2=(Token)match(input,15,FOLLOW_11); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXSwitchExpressionAccess().getLeftParenthesisKeyword_2_0_0_0_0()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3672:7: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalPureXbase.g:3673:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalPureXbase.g:3673:8: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalPureXbase.g:3674:9: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_0_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_52);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_4=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_0_0_0_2()); // depends on control dependency: [if], data = [none]
}
}
}
// InternalPureXbase.g:3697:5: ( (lv_switch_5_0= ruleXExpression ) )
// InternalPureXbase.g:3698:6: (lv_switch_5_0= ruleXExpression )
{
// InternalPureXbase.g:3698:6: (lv_switch_5_0= ruleXExpression )
// InternalPureXbase.g:3699:7: lv_switch_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_8);
lv_switch_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"switch",
lv_switch_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_6=(Token)match(input,16,FOLLOW_40); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXSwitchExpressionAccess().getRightParenthesisKeyword_2_0_2()); // depends on control dependency: [if], data = [none]
}
}
}
break;
case 2 :
// InternalPureXbase.g:3722:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
{
// InternalPureXbase.g:3722:4: ( ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) ) )
// InternalPureXbase.g:3723:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )? ( (lv_switch_9_0= ruleXExpression ) )
{
// InternalPureXbase.g:3723:5: ( ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' ) )?
int alt65=2;
alt65 = dfa65.predict(input);
switch (alt65) {
case 1 :
// InternalPureXbase.g:3724:6: ( ( ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
{
// InternalPureXbase.g:3733:6: ( ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':' )
// InternalPureXbase.g:3734:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) ) otherlv_8= ':'
{
// InternalPureXbase.g:3734:7: ( (lv_declaredParam_7_0= ruleJvmFormalParameter ) )
// InternalPureXbase.g:3735:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
{
// InternalPureXbase.g:3735:8: (lv_declaredParam_7_0= ruleJvmFormalParameter )
// InternalPureXbase.g:3736:9: lv_declaredParam_7_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_2_1_0_0_0_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_52);
lv_declaredParam_7_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_7_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_8=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_8, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_2_1_0_0_1()); // depends on control dependency: [if], data = [none]
}
}
}
break;
}
// InternalPureXbase.g:3759:5: ( (lv_switch_9_0= ruleXExpression ) )
// InternalPureXbase.g:3760:6: (lv_switch_9_0= ruleXExpression )
{
// InternalPureXbase.g:3760:6: (lv_switch_9_0= ruleXExpression )
// InternalPureXbase.g:3761:7: lv_switch_9_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getSwitchXExpressionParserRuleCall_2_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_40);
lv_switch_9_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"switch",
lv_switch_9_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
break;
}
otherlv_10=(Token)match(input,59,FOLLOW_53); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_10, grammarAccess.getXSwitchExpressionAccess().getLeftCurlyBracketKeyword_3()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3784:3: ( (lv_cases_11_0= ruleXCasePart ) )*
loop67:
do {
int alt67=2;
int LA67_0 = input.LA(1);
if ( (LA67_0==RULE_ID||LA67_0==15||LA67_0==22||LA67_0==41||LA67_0==57||LA67_0==68) ) {
alt67=1; // depends on control dependency: [if], data = [none]
}
switch (alt67) {
case 1 :
// InternalPureXbase.g:3785:4: (lv_cases_11_0= ruleXCasePart )
{
// InternalPureXbase.g:3785:4: (lv_cases_11_0= ruleXCasePart )
// InternalPureXbase.g:3786:5: lv_cases_11_0= ruleXCasePart
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getCasesXCasePartParserRuleCall_4_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_53);
lv_cases_11_0=ruleXCasePart();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
add(
current,
"cases",
lv_cases_11_0,
"org.eclipse.xtext.xbase.Xbase.XCasePart"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
break;
default :
break loop67;
}
} while (true);
// InternalPureXbase.g:3803:3: (otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) ) )?
int alt68=2;
int LA68_0 = input.LA(1);
if ( (LA68_0==67) ) {
alt68=1; // depends on control dependency: [if], data = [none]
}
switch (alt68) {
case 1 :
// InternalPureXbase.g:3804:4: otherlv_12= 'default' otherlv_13= ':' ( (lv_default_14_0= ruleXExpression ) )
{
otherlv_12=(Token)match(input,67,FOLLOW_52); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_12, grammarAccess.getXSwitchExpressionAccess().getDefaultKeyword_5_0()); // depends on control dependency: [if], data = [none]
}
otherlv_13=(Token)match(input,22,FOLLOW_3); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_13, grammarAccess.getXSwitchExpressionAccess().getColonKeyword_5_1()); // depends on control dependency: [if], data = [none]
}
// InternalPureXbase.g:3812:4: ( (lv_default_14_0= ruleXExpression ) )
// InternalPureXbase.g:3813:5: (lv_default_14_0= ruleXExpression )
{
// InternalPureXbase.g:3813:5: (lv_default_14_0= ruleXExpression )
// InternalPureXbase.g:3814:6: lv_default_14_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXSwitchExpressionAccess().getDefaultXExpressionParserRuleCall_5_2_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_54);
lv_default_14_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXSwitchExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"default",
lv_default_14_0,
"org.eclipse.xtext.xbase.Xbase.XExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
}
otherlv_15=(Token)match(input,60,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_15, grammarAccess.getXSwitchExpressionAccess().getRightCurlyBracketKeyword_6()); // depends on control dependency: [if], data = [none]
}
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
protected static String getCaptureTime(Metadata metadata) {
String captureTimeMillis = metadata.getFirstValue(REQUEST_TIME_KEY);
Instant capturedAt = Instant.now();
if (captureTimeMillis != null) {
try {
long millis = Long.parseLong(captureTimeMillis);
capturedAt = Instant.ofEpochMilli(millis);
} catch (NumberFormatException | DateTimeException e) {
LOG.warn("Failed to parse capture time:", e);
}
}
return WARC_DF.format(capturedAt);
} } | public class class_name {
protected static String getCaptureTime(Metadata metadata) {
String captureTimeMillis = metadata.getFirstValue(REQUEST_TIME_KEY);
Instant capturedAt = Instant.now();
if (captureTimeMillis != null) {
try {
long millis = Long.parseLong(captureTimeMillis);
capturedAt = Instant.ofEpochMilli(millis); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException | DateTimeException e) {
LOG.warn("Failed to parse capture time:", e);
} // depends on control dependency: [catch], data = [none]
}
return WARC_DF.format(capturedAt);
} } |
public class class_name {
protected void checkAndReplaceInput(List<IntrospectedColumn> columns, XmlElement xe){
for(Element element : xe.getElements()){
if(element instanceof XmlElement){
checkAndReplaceInput(columns, (XmlElement) element);
}
if(element instanceof TextElement){
TextElement te = (TextElement) element;
checkAndReplaceInput(columns, te);
}
}
} } | public class class_name {
protected void checkAndReplaceInput(List<IntrospectedColumn> columns, XmlElement xe){
for(Element element : xe.getElements()){
if(element instanceof XmlElement){
checkAndReplaceInput(columns, (XmlElement) element); // depends on control dependency: [if], data = [none]
}
if(element instanceof TextElement){
TextElement te = (TextElement) element;
checkAndReplaceInput(columns, te); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private <T> Observable<T> asObservable(Executor<T> transaction) {
return Observable.create(emitter -> storeFactory.execute(new StoreTransaction<ChatStore>() {
@Override
protected void execute(ChatStore store) {
try {
transaction.execute(store, emitter);
} finally {
emitter.onCompleted();
}
}
}), Emitter.BackpressureMode.BUFFER);
} } | public class class_name {
private <T> Observable<T> asObservable(Executor<T> transaction) {
return Observable.create(emitter -> storeFactory.execute(new StoreTransaction<ChatStore>() {
@Override
protected void execute(ChatStore store) {
try {
transaction.execute(store, emitter); // depends on control dependency: [try], data = [none]
} finally {
emitter.onCompleted();
}
}
}), Emitter.BackpressureMode.BUFFER);
} } |
public class class_name {
public T getMaximum() {
if (this.isEmpty()) {
throw new NoSuchElementException(
"Empty time windows have no maximum.");
}
int n = this.intervals.size();
Boundary<T> upper = this.intervals.get(n - 1).getEnd();
T max = upper.getTemporal();
if (upper.isInfinite()) {
return null;
}
if (this.isCalendrical()) {
if (upper.isOpen()) {
max = this.getTimeLine().stepBackwards(max);
}
for (int i = n - 2; i >= 0; i--) {
Boundary<T> test = this.intervals.get(i).getEnd();
T candidate = test.getTemporal();
if (test.isInfinite()) {
return null;
} else if (test.isOpen()) {
candidate = this.getTimeLine().stepBackwards(candidate);
}
if (this.isAfter(candidate, max)) {
max = candidate;
}
}
} else {
T last = null;
if (upper.isClosed()) {
T next = this.getTimeLine().stepForward(max);
if (next == null) {
last = max;
} else {
max = next;
}
}
for (int i = n - 2; i >= 0; i--) {
Boundary<T> test = this.intervals.get(i).getEnd();
T candidate = test.getTemporal();
if (test.isInfinite()) {
return null;
} else if (last != null) {
continue;
} else if (test.isClosed()) {
T next = this.getTimeLine().stepForward(candidate);
if (next == null) {
last = candidate;
continue;
} else {
candidate = next;
}
}
if (this.isAfter(candidate, max)) {
max = candidate;
}
}
if (last != null) {
max = last;
} else {
max = this.getTimeLine().stepBackwards(max);
}
}
return max;
} } | public class class_name {
public T getMaximum() {
if (this.isEmpty()) {
throw new NoSuchElementException(
"Empty time windows have no maximum.");
}
int n = this.intervals.size();
Boundary<T> upper = this.intervals.get(n - 1).getEnd();
T max = upper.getTemporal();
if (upper.isInfinite()) {
return null; // depends on control dependency: [if], data = [none]
}
if (this.isCalendrical()) {
if (upper.isOpen()) {
max = this.getTimeLine().stepBackwards(max); // depends on control dependency: [if], data = [none]
}
for (int i = n - 2; i >= 0; i--) {
Boundary<T> test = this.intervals.get(i).getEnd();
T candidate = test.getTemporal();
if (test.isInfinite()) {
return null; // depends on control dependency: [if], data = [none]
} else if (test.isOpen()) {
candidate = this.getTimeLine().stepBackwards(candidate); // depends on control dependency: [if], data = [none]
}
if (this.isAfter(candidate, max)) {
max = candidate; // depends on control dependency: [if], data = [none]
}
}
} else {
T last = null;
if (upper.isClosed()) {
T next = this.getTimeLine().stepForward(max);
if (next == null) {
last = max; // depends on control dependency: [if], data = [none]
} else {
max = next; // depends on control dependency: [if], data = [none]
}
}
for (int i = n - 2; i >= 0; i--) {
Boundary<T> test = this.intervals.get(i).getEnd();
T candidate = test.getTemporal();
if (test.isInfinite()) {
return null; // depends on control dependency: [if], data = [none]
} else if (last != null) {
continue;
} else if (test.isClosed()) {
T next = this.getTimeLine().stepForward(candidate);
if (next == null) {
last = candidate; // depends on control dependency: [if], data = [none]
continue;
} else {
candidate = next; // depends on control dependency: [if], data = [none]
}
}
if (this.isAfter(candidate, max)) {
max = candidate; // depends on control dependency: [if], data = [none]
}
}
if (last != null) {
max = last; // depends on control dependency: [if], data = [none]
} else {
max = this.getTimeLine().stepBackwards(max); // depends on control dependency: [if], data = [none]
}
}
return max;
} } |
public class class_name {
protected void sendPageBreakToBottom(JRDesignBand band) {
JRElement[] elems = band.getElements();
JRElement aux = null;
for (JRElement elem : elems) {
if (("" + elem.getKey()).startsWith(PAGE_BREAK_FOR_)) {
aux = elem;
break;
}
}
if (aux != null)
((JRDesignElement)aux).setY(band.getHeight());
} } | public class class_name {
protected void sendPageBreakToBottom(JRDesignBand band) {
JRElement[] elems = band.getElements();
JRElement aux = null;
for (JRElement elem : elems) {
if (("" + elem.getKey()).startsWith(PAGE_BREAK_FOR_)) {
aux = elem; // depends on control dependency: [if], data = [none]
break;
}
}
if (aux != null)
((JRDesignElement)aux).setY(band.getHeight());
} } |
public class class_name {
public static Class<?> getPrototypeClass(ItemRule ir, Object value) {
ItemValueType valueType = ir.getValueType();
if (ir.getType() == ItemType.ARRAY) {
if (valueType == ItemValueType.STRING) {
return String[].class;
} else if (valueType == ItemValueType.INT) {
return Integer[].class;
} else if (valueType == ItemValueType.LONG) {
return Long[].class;
} else if (valueType == ItemValueType.FLOAT) {
return Float[].class;
} else if (valueType == ItemValueType.DOUBLE) {
return Double[].class;
} else if (valueType == ItemValueType.BOOLEAN) {
return Boolean[].class;
} else if (valueType == ItemValueType.PARAMETERS) {
return Parameters[].class;
} else if (valueType == ItemValueType.FILE) {
return File[].class;
} else if (valueType == ItemValueType.MULTIPART_FILE) {
return FileParameter[].class;
} else {
return (value != null ? value.getClass() : String[].class);
}
} else if (ir.getType() == ItemType.LIST) {
return (value != null ? value.getClass() : List.class);
} else if (ir.getType() == ItemType.MAP) {
return (value != null ? value.getClass() : Map.class);
} else if (ir.getType() == ItemType.SET) {
return (value != null ? value.getClass() : Set.class);
} else if (ir.getType() == ItemType.PROPERTIES) {
return (value != null ? value.getClass() : Properties.class);
} else {
if (valueType == ItemValueType.STRING) {
return String.class;
} else if (valueType == ItemValueType.INT) {
return Integer.class;
} else if (valueType == ItemValueType.LONG) {
return Long.class;
} else if (valueType == ItemValueType.FLOAT) {
return Float.class;
} else if (valueType == ItemValueType.DOUBLE) {
return Double.class;
} else if (valueType == ItemValueType.BOOLEAN) {
return Boolean.class;
} else if (valueType == ItemValueType.PARAMETERS) {
return Parameters.class;
} else if (valueType == ItemValueType.FILE) {
return File.class;
} else if (valueType == ItemValueType.MULTIPART_FILE) {
return FileParameter.class;
} else {
return (value != null ? value.getClass() : String.class);
}
}
} } | public class class_name {
public static Class<?> getPrototypeClass(ItemRule ir, Object value) {
ItemValueType valueType = ir.getValueType();
if (ir.getType() == ItemType.ARRAY) {
if (valueType == ItemValueType.STRING) {
return String[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.INT) {
return Integer[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.LONG) {
return Long[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.FLOAT) {
return Float[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.DOUBLE) {
return Double[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.BOOLEAN) {
return Boolean[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.PARAMETERS) {
return Parameters[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.FILE) {
return File[].class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.MULTIPART_FILE) {
return FileParameter[].class; // depends on control dependency: [if], data = [none]
} else {
return (value != null ? value.getClass() : String[].class); // depends on control dependency: [if], data = [none]
}
} else if (ir.getType() == ItemType.LIST) {
return (value != null ? value.getClass() : List.class);
} else if (ir.getType() == ItemType.MAP) {
return (value != null ? value.getClass() : Map.class);
} else if (ir.getType() == ItemType.SET) {
return (value != null ? value.getClass() : Set.class);
} else if (ir.getType() == ItemType.PROPERTIES) {
return (value != null ? value.getClass() : Properties.class);
} else {
if (valueType == ItemValueType.STRING) {
return String.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.INT) {
return Integer.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.LONG) {
return Long.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.FLOAT) {
return Float.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.DOUBLE) {
return Double.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.BOOLEAN) {
return Boolean.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.PARAMETERS) {
return Parameters.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.FILE) {
return File.class; // depends on control dependency: [if], data = [none]
} else if (valueType == ItemValueType.MULTIPART_FILE) {
return FileParameter.class; // depends on control dependency: [if], data = [none]
} else {
return (value != null ? value.getClass() : String.class); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public OobResponse getOobResponse(HttpServletRequest req, String gitkitToken)
throws GitkitServerException {
try {
String action = req.getParameter("action");
if ("resetPassword".equals(action)) {
String oobLink = buildOobLink(buildPasswordResetRequest(req), action);
return new OobResponse(
req.getParameter("email"),
null,
oobLink,
OobAction.RESET_PASSWORD);
} else if ("changeEmail".equals(action)) {
if (gitkitToken == null) {
return new OobResponse("login is required");
} else {
String oobLink = buildOobLink(buildChangeEmailRequest(req, gitkitToken), action);
return new OobResponse(
req.getParameter("oldEmail"),
req.getParameter("newEmail"),
oobLink,
OobAction.CHANGE_EMAIL);
}
} else {
return new OobResponse("unknown request");
}
} catch (GitkitClientException e) {
return new OobResponse(e.getMessage());
}
} } | public class class_name {
public OobResponse getOobResponse(HttpServletRequest req, String gitkitToken)
throws GitkitServerException {
try {
String action = req.getParameter("action");
if ("resetPassword".equals(action)) {
String oobLink = buildOobLink(buildPasswordResetRequest(req), action);
return new OobResponse(
req.getParameter("email"),
null,
oobLink,
OobAction.RESET_PASSWORD);
} else if ("changeEmail".equals(action)) {
if (gitkitToken == null) {
return new OobResponse("login is required"); // depends on control dependency: [if], data = [none]
} else {
String oobLink = buildOobLink(buildChangeEmailRequest(req, gitkitToken), action);
return new OobResponse(
req.getParameter("oldEmail"),
req.getParameter("newEmail"),
oobLink,
OobAction.CHANGE_EMAIL); // depends on control dependency: [if], data = [none]
}
} else {
return new OobResponse("unknown request");
}
} catch (GitkitClientException e) {
return new OobResponse(e.getMessage());
}
} } |
public class class_name {
public void marshall(UpdateUserRequest updateUserRequest, ProtocolMarshaller protocolMarshaller) {
if (updateUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateUserRequest.getUserName(), USERNAME_BINDING);
protocolMarshaller.marshall(updateUserRequest.getAwsAccountId(), AWSACCOUNTID_BINDING);
protocolMarshaller.marshall(updateUserRequest.getNamespace(), NAMESPACE_BINDING);
protocolMarshaller.marshall(updateUserRequest.getEmail(), EMAIL_BINDING);
protocolMarshaller.marshall(updateUserRequest.getRole(), ROLE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateUserRequest updateUserRequest, ProtocolMarshaller protocolMarshaller) {
if (updateUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateUserRequest.getUserName(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserRequest.getAwsAccountId(), AWSACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserRequest.getNamespace(), NAMESPACE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserRequest.getEmail(), EMAIL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserRequest.getRole(), ROLE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setFilterGUIDs(List<String> filterGUIDs)
{
int i = 0;
for (String filterGUID : filterGUIDs)
{
// Remove filters (we're replacing them)
removeFilter("Filter_" + i);
// Build a new Filter_0 element
Element filter = buildFilterElement("Filter_" + i, filterGUID);
element.addContent(filter);
i++;
}
} } | public class class_name {
public void setFilterGUIDs(List<String> filterGUIDs)
{
int i = 0;
for (String filterGUID : filterGUIDs)
{
// Remove filters (we're replacing them)
removeFilter("Filter_" + i); // depends on control dependency: [for], data = [none]
// Build a new Filter_0 element
Element filter = buildFilterElement("Filter_" + i, filterGUID);
element.addContent(filter); // depends on control dependency: [for], data = [none]
i++; // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
void showStopLine(Dim.StackFrame frame) {
String sourceName = frame.getUrl();
if (sourceName == null || sourceName.equals("<stdin>")) {
if (console.isVisible()) {
console.show();
}
} else {
showFileWindow(sourceName, -1);
int lineNumber = frame.getLineNumber();
FileWindow w = getFileWindow(sourceName);
if (w != null) {
setFilePosition(w, lineNumber);
}
}
} } | public class class_name {
void showStopLine(Dim.StackFrame frame) {
String sourceName = frame.getUrl();
if (sourceName == null || sourceName.equals("<stdin>")) {
if (console.isVisible()) {
console.show(); // depends on control dependency: [if], data = [none]
}
} else {
showFileWindow(sourceName, -1); // depends on control dependency: [if], data = [(sourceName]
int lineNumber = frame.getLineNumber();
FileWindow w = getFileWindow(sourceName);
if (w != null) {
setFilePosition(w, lineNumber); // depends on control dependency: [if], data = [(w]
}
}
} } |
public class class_name {
public static Object parsePattern(String pattern) {
// Unfortunately, this method shares a fair amount of logic with Topic.parsePattern
// but it is hard to figure out how to factor them.
char[] accum = new char[pattern.length()];
int finger = 0;
List tokens = new ArrayList();
boolean trivial = true;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == '*')
{
finger = flush(accum, finger, tokens);
tokens.add(matchOne);
trivial = false;
}
else if (c == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// It's a normal character unless followed by another separator
// or a "."
if(i == pattern.length() - 1)
{
accum[finger++] = c;
}
else
{
// Check to see if we have a double slash
if(pattern.charAt(i+1) == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// Double slash
finger = flush(accum, finger, tokens);
tokens.add(matchMany);
trivial = false;
// Skip the second slash
i++;
// If the next char is a '.', then we skip that too
if(pattern.charAt(i+1) == '.')
{
// Skip the dot
i++;
// Defect 307231, handle the allowable "//./" case
if( (i+1) < pattern.length() &&
pattern.charAt(i+1) == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// Skip a subsequent slash
i++;
}
}
}
// Check for special "/." case which we jump over. Note that topic syntax
// checking will already have disallowed invalid expressions such as "a/.b"
// so if a "." follows a slash then it must be the final character, or it
// must be followed by a separator.
else if(pattern.charAt(i+1) == '.')
{
// skip the slash and the dot
i++;
}
else
{
accum[finger++] = c;
}
}
}
else
accum[finger++] = c;
}
if (trivial)
return new String(accum, 0, finger);
flush(accum, finger, tokens);
return new TopicPattern(tokens.iterator());
} } | public class class_name {
public static Object parsePattern(String pattern) {
// Unfortunately, this method shares a fair amount of logic with Topic.parsePattern
// but it is hard to figure out how to factor them.
char[] accum = new char[pattern.length()];
int finger = 0;
List tokens = new ArrayList();
boolean trivial = true;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == '*')
{
finger = flush(accum, finger, tokens); // depends on control dependency: [if], data = [none]
tokens.add(matchOne); // depends on control dependency: [if], data = [none]
trivial = false; // depends on control dependency: [if], data = [none]
}
else if (c == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// It's a normal character unless followed by another separator
// or a "."
if(i == pattern.length() - 1)
{
accum[finger++] = c; // depends on control dependency: [if], data = [none]
}
else
{
// Check to see if we have a double slash
if(pattern.charAt(i+1) == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// Double slash
finger = flush(accum, finger, tokens); // depends on control dependency: [if], data = [none]
tokens.add(matchMany); // depends on control dependency: [if], data = [none]
trivial = false; // depends on control dependency: [if], data = [none]
// Skip the second slash
i++; // depends on control dependency: [if], data = [none]
// If the next char is a '.', then we skip that too
if(pattern.charAt(i+1) == '.')
{
// Skip the dot
i++; // depends on control dependency: [if], data = [none]
// Defect 307231, handle the allowable "//./" case
if( (i+1) < pattern.length() &&
pattern.charAt(i+1) == MatchSpace.SUBTOPIC_SEPARATOR_CHAR)
{
// Skip a subsequent slash
i++; // depends on control dependency: [if], data = [none]
}
}
}
// Check for special "/." case which we jump over. Note that topic syntax
// checking will already have disallowed invalid expressions such as "a/.b"
// so if a "." follows a slash then it must be the final character, or it
// must be followed by a separator.
else if(pattern.charAt(i+1) == '.')
{
// skip the slash and the dot
i++; // depends on control dependency: [if], data = [none]
}
else
{
accum[finger++] = c; // depends on control dependency: [if], data = [none]
}
}
}
else
accum[finger++] = c;
}
if (trivial)
return new String(accum, 0, finger);
flush(accum, finger, tokens);
return new TopicPattern(tokens.iterator());
} } |
public class class_name {
private List<CmsSelectWidgetOption> getSites() {
List<CmsSelectWidgetOption> sites = new ArrayList<CmsSelectWidgetOption>();
List<CmsSite> sitesList = OpenCms.getSiteManager().getAvailableSites(getCms(), true, false, getParamOufqn());
String defSite = null;
if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
defSite = new CmsUserSettings(m_user).getStartSite();
}
if (defSite == null) {
defSite = getCms().getRequestContext().getSiteRoot();
}
if (!defSite.endsWith("/")) {
defSite += "/";
}
Iterator<CmsSite> itSites = sitesList.iterator();
while (itSites.hasNext()) {
CmsSite site = itSites.next();
String siteRoot = site.getSiteRoot();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)) {
if (sitesList.size() > 1) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
if (!OpenCms.getRoleManager().hasRole(getCms(), m_user.getName(), CmsRole.VFS_MANAGER)) {
// skip the root site if not accessible
continue;
}
}
}
}
if (!siteRoot.endsWith("/")) {
siteRoot += "/";
}
boolean selected = defSite.equals(siteRoot);
sites.add(new CmsSelectWidgetOption(siteRoot, selected, substituteSiteTitle(site.getTitle()), null));
}
return sites;
} } | public class class_name {
private List<CmsSelectWidgetOption> getSites() {
List<CmsSelectWidgetOption> sites = new ArrayList<CmsSelectWidgetOption>();
List<CmsSite> sitesList = OpenCms.getSiteManager().getAvailableSites(getCms(), true, false, getParamOufqn());
String defSite = null;
if ((m_user != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
defSite = new CmsUserSettings(m_user).getStartSite(); // depends on control dependency: [if], data = [none]
}
if (defSite == null) {
defSite = getCms().getRequestContext().getSiteRoot(); // depends on control dependency: [if], data = [none]
}
if (!defSite.endsWith("/")) {
defSite += "/"; // depends on control dependency: [if], data = [none]
}
Iterator<CmsSite> itSites = sitesList.iterator();
while (itSites.hasNext()) {
CmsSite site = itSites.next();
String siteRoot = site.getSiteRoot();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(siteRoot)) {
if (sitesList.size() > 1) {
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_user.getName())) {
if (!OpenCms.getRoleManager().hasRole(getCms(), m_user.getName(), CmsRole.VFS_MANAGER)) {
// skip the root site if not accessible
continue;
}
}
}
}
if (!siteRoot.endsWith("/")) {
siteRoot += "/"; // depends on control dependency: [if], data = [none]
}
boolean selected = defSite.equals(siteRoot);
sites.add(new CmsSelectWidgetOption(siteRoot, selected, substituteSiteTitle(site.getTitle()), null)); // depends on control dependency: [while], data = [none]
}
return sites;
} } |
public class class_name {
private void convertOptions() throws TreeException {
options = new Properties();
ParseTreeNode optionList = parserTree.getChild("GrammarOptions").getChild(
"GrammarOptionList");
for (ParseTreeNode option : optionList.getChildren("GrammarOption")) {
String name = option.getChild("PropertyIdentifier").getText();
String value = option.getChild("Literal").getText();
if (value.startsWith("'") || value.startsWith("\"")) {
value = value.substring(1, value.length() - 1);
}
options.put(name, value);
}
// normalizeToBNF = Boolean.valueOf(options.getProperty(
// "grammar.normalize_to_bnf", "true"));
} } | public class class_name {
private void convertOptions() throws TreeException {
options = new Properties();
ParseTreeNode optionList = parserTree.getChild("GrammarOptions").getChild(
"GrammarOptionList");
for (ParseTreeNode option : optionList.getChildren("GrammarOption")) {
String name = option.getChild("PropertyIdentifier").getText();
String value = option.getChild("Literal").getText();
if (value.startsWith("'") || value.startsWith("\"")) {
value = value.substring(1, value.length() - 1); // depends on control dependency: [if], data = [none]
}
options.put(name, value);
}
// normalizeToBNF = Boolean.valueOf(options.getProperty(
// "grammar.normalize_to_bnf", "true"));
} } |
public class class_name {
public static byte[] fromHexByteArray(final byte[] buffer)
{
final byte[] outputBuffer = new byte[buffer.length >> 1];
for (int i = 0; i < buffer.length; i += 2)
{
final int hi = FROM_HEX_DIGIT_TABLE[buffer[i]] << 4;
final int lo = FROM_HEX_DIGIT_TABLE[buffer[i + 1]]; // lgtm [java/index-out-of-bounds]
outputBuffer[i >> 1] = (byte)(hi | lo);
}
return outputBuffer;
} } | public class class_name {
public static byte[] fromHexByteArray(final byte[] buffer)
{
final byte[] outputBuffer = new byte[buffer.length >> 1];
for (int i = 0; i < buffer.length; i += 2)
{
final int hi = FROM_HEX_DIGIT_TABLE[buffer[i]] << 4;
final int lo = FROM_HEX_DIGIT_TABLE[buffer[i + 1]]; // lgtm [java/index-out-of-bounds]
outputBuffer[i >> 1] = (byte)(hi | lo); // depends on control dependency: [for], data = [i]
}
return outputBuffer;
} } |
public class class_name {
public String lastWord() {
int size = 1;
while (pos - size > 0 && lcText[pos - size] == ' ') {
size++;
}
while (pos - size > 0 && lcText[pos - size] != ' ' && lcText[pos - size] != ';') {
size++;
}
return this.substring((pos - size + 1), (pos - 1));
} } | public class class_name {
public String lastWord() {
int size = 1;
while (pos - size > 0 && lcText[pos - size] == ' ') {
size++; // depends on control dependency: [while], data = [none]
}
while (pos - size > 0 && lcText[pos - size] != ' ' && lcText[pos - size] != ';') {
size++; // depends on control dependency: [while], data = [none]
}
return this.substring((pos - size + 1), (pos - 1));
} } |
public class class_name {
public static Period from(TemporalAmount amount) {
if (amount instanceof Period) {
return (Period) amount;
}
if (amount instanceof ChronoPeriod) {
if (IsoChronology.INSTANCE.equals(((ChronoPeriod) amount).getChronology()) == false) {
throw new DateTimeException("Period requires ISO chronology: " + amount);
}
}
Objects.requireNonNull(amount, "amount");
int years = 0;
int months = 0;
int days = 0;
for (TemporalUnit unit : amount.getUnits()) {
long unitAmount = amount.get(unit);
if (unit == ChronoUnit.YEARS) {
years = Math.toIntExact(unitAmount);
} else if (unit == ChronoUnit.MONTHS) {
months = Math.toIntExact(unitAmount);
} else if (unit == ChronoUnit.DAYS) {
days = Math.toIntExact(unitAmount);
} else {
throw new DateTimeException("Unit must be Years, Months or Days, but was " + unit);
}
}
return create(years, months, days);
} } | public class class_name {
public static Period from(TemporalAmount amount) {
if (amount instanceof Period) {
return (Period) amount; // depends on control dependency: [if], data = [none]
}
if (amount instanceof ChronoPeriod) {
if (IsoChronology.INSTANCE.equals(((ChronoPeriod) amount).getChronology()) == false) {
throw new DateTimeException("Period requires ISO chronology: " + amount);
}
}
Objects.requireNonNull(amount, "amount");
int years = 0;
int months = 0;
int days = 0;
for (TemporalUnit unit : amount.getUnits()) {
long unitAmount = amount.get(unit);
if (unit == ChronoUnit.YEARS) {
years = Math.toIntExact(unitAmount); // depends on control dependency: [if], data = [(unit]
} else if (unit == ChronoUnit.MONTHS) {
months = Math.toIntExact(unitAmount); // depends on control dependency: [if], data = [(unit]
} else if (unit == ChronoUnit.DAYS) {
days = Math.toIntExact(unitAmount); // depends on control dependency: [if], data = [(unit]
} else {
throw new DateTimeException("Unit must be Years, Months or Days, but was " + unit);
}
}
return create(years, months, days);
} } |
public class class_name {
public boolean process( T left , T right ) {
if( first ) {
associateL2R(left, right);
first = false;
} else {
// long time0 = System.currentTimeMillis();
associateL2R(left, right);
// long time1 = System.currentTimeMillis();
associateF2F();
// long time2 = System.currentTimeMillis();
cyclicConsistency();
// long time3 = System.currentTimeMillis();
if( !estimateMotion() )
return false;
// long time4 = System.currentTimeMillis();
// System.out.println("timing: "+(time1-time0)+" "+(time2-time1)+" "+(time3-time2)+" "+(time4-time3));
}
return true;
} } | public class class_name {
public boolean process( T left , T right ) {
if( first ) {
associateL2R(left, right); // depends on control dependency: [if], data = [none]
first = false; // depends on control dependency: [if], data = [none]
} else {
// long time0 = System.currentTimeMillis();
associateL2R(left, right); // depends on control dependency: [if], data = [none]
// long time1 = System.currentTimeMillis();
associateF2F(); // depends on control dependency: [if], data = [none]
// long time2 = System.currentTimeMillis();
cyclicConsistency(); // depends on control dependency: [if], data = [none]
// long time3 = System.currentTimeMillis();
if( !estimateMotion() )
return false;
// long time4 = System.currentTimeMillis();
// System.out.println("timing: "+(time1-time0)+" "+(time2-time1)+" "+(time3-time2)+" "+(time4-time3));
}
return true;
} } |
public class class_name {
public void setPriority(FaxJobPriority priority)
{
try
{
if(priority==FaxJobPriority.HIGH_PRIORITY)
{
this.JOB.setPriority(Job.PRIORITY_HIGH);
}
else
{
this.JOB.setPriority(Job.PRIORITY_NORMAL);
}
}
catch(Exception exception)
{
throw new FaxException("Error while setting job priority.",exception);
}
} } | public class class_name {
public void setPriority(FaxJobPriority priority)
{
try
{
if(priority==FaxJobPriority.HIGH_PRIORITY)
{
this.JOB.setPriority(Job.PRIORITY_HIGH); // depends on control dependency: [if], data = [none]
}
else
{
this.JOB.setPriority(Job.PRIORITY_NORMAL); // depends on control dependency: [if], data = [none]
}
}
catch(Exception exception)
{
throw new FaxException("Error while setting job priority.",exception);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String generateTraceIndent(int delta)
{
if (!useIndent)
{
return "";
}
else
{
if (delta >= 1)
{
indentStack.push(delta);
}
else if (delta < 0)
{
indentStack.pop();
}
StringBuffer result = new StringBuffer();
traceIndent += (delta < 0) ? delta : 0;
for (int i = 0; i < traceIndent; i++)
{
result.append(" ");
}
traceIndent += (delta > 0) ? delta : 0;
return result.toString();
}
} } | public class class_name {
public String generateTraceIndent(int delta)
{
if (!useIndent)
{
return ""; // depends on control dependency: [if], data = [none]
}
else
{
if (delta >= 1)
{
indentStack.push(delta); // depends on control dependency: [if], data = [(delta]
}
else if (delta < 0)
{
indentStack.pop(); // depends on control dependency: [if], data = [none]
}
StringBuffer result = new StringBuffer();
traceIndent += (delta < 0) ? delta : 0; // depends on control dependency: [if], data = [none]
for (int i = 0; i < traceIndent; i++)
{
result.append(" "); // depends on control dependency: [for], data = [none]
}
traceIndent += (delta > 0) ? delta : 0; // depends on control dependency: [if], data = [none]
return result.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected int serializeKeyValue(final JsonContext jsonContext, final Path currentPath, final Object key, final Object value, int count) {
if ((value == null) && jsonContext.isExcludeNulls()) {
return count;
}
if (key != null) {
currentPath.push(key.toString());
} else {
currentPath.push(StringPool.NULL);
}
// check if we should include the field
boolean include = true;
if (value != null) {
// + all collections are not serialized by default
include = jsonContext.matchIgnoredPropertyTypes(value.getClass(), false, include);
// + path queries: excludes/includes
include = jsonContext.matchPathToQueries(include);
}
// done
if (!include) {
currentPath.pop();
return count;
}
if (key == null) {
jsonContext.pushName(null, count > 0);
} else {
jsonContext.pushName(key.toString(), count > 0);
}
jsonContext.serialize(value);
if (jsonContext.isNamePopped()) {
count++;
}
currentPath.pop();
return count;
} } | public class class_name {
protected int serializeKeyValue(final JsonContext jsonContext, final Path currentPath, final Object key, final Object value, int count) {
if ((value == null) && jsonContext.isExcludeNulls()) {
return count; // depends on control dependency: [if], data = [none]
}
if (key != null) {
currentPath.push(key.toString()); // depends on control dependency: [if], data = [(key]
} else {
currentPath.push(StringPool.NULL); // depends on control dependency: [if], data = [none]
}
// check if we should include the field
boolean include = true;
if (value != null) {
// + all collections are not serialized by default
include = jsonContext.matchIgnoredPropertyTypes(value.getClass(), false, include); // depends on control dependency: [if], data = [(value]
// + path queries: excludes/includes
include = jsonContext.matchPathToQueries(include); // depends on control dependency: [if], data = [none]
}
// done
if (!include) {
currentPath.pop(); // depends on control dependency: [if], data = [none]
return count; // depends on control dependency: [if], data = [none]
}
if (key == null) {
jsonContext.pushName(null, count > 0); // depends on control dependency: [if], data = [none]
} else {
jsonContext.pushName(key.toString(), count > 0); // depends on control dependency: [if], data = [(key]
}
jsonContext.serialize(value);
if (jsonContext.isNamePopped()) {
count++; // depends on control dependency: [if], data = [none]
}
currentPath.pop();
return count;
} } |
public class class_name {
public static Optional<MethodUsage> getFunctionalMethod(ResolvedType type) {
if (type.isReferenceType() && type.asReferenceType().getTypeDeclaration().isInterface()) {
return getFunctionalMethod(type.asReferenceType().getTypeDeclaration());
} else {
return Optional.empty();
}
} } | public class class_name {
public static Optional<MethodUsage> getFunctionalMethod(ResolvedType type) {
if (type.isReferenceType() && type.asReferenceType().getTypeDeclaration().isInterface()) {
return getFunctionalMethod(type.asReferenceType().getTypeDeclaration()); // depends on control dependency: [if], data = [none]
} else {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static Object getEntityFromJson(Class<?> entityClass, EntityMetadata m, JsonObject jsonObj, List<String> relations,
final KunderaMetadata kunderaMetadata)
{// Entity object
Object entity = null;
// Map to hold property-name=>foreign-entity relations
try
{
entity = KunderaCoreUtils.createNewInstance(entityClass);
// Populate primary key column
JsonElement rowKey = jsonObj.get(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName());
if (rowKey == null)
{
return null;
}
Class<?> idClass = null;
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
Map<String, Object> relationValue = null;
idClass = m.getIdAttribute().getJavaType();
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
Class javaType = m.getIdAttribute().getBindableJavaType();
PropertyAccessorHelper.setId(
entity,
m,
getObjectFromJson(rowKey.getAsJsonObject(), javaType, metaModel.embeddable(javaType)
.getAttributes()));
}
else
{
PropertyAccessorHelper.setId(entity, m,
PropertyAccessorHelper.fromSourceToTargetClass(idClass, String.class, rowKey.getAsString()));
}
EntityType entityType = metaModel.entity(entityClass);
String discriminatorColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
Set<Attribute> columns = entityType.getAttributes();
for (Attribute column : columns)
{
JsonElement value = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
if (!column.equals(m.getIdAttribute())
&& !((AbstractAttribute) column).getJPAColumnName().equals(discriminatorColumn)
&& value != null && !value.equals(JsonNull.INSTANCE))
{
String fieldName = ((AbstractAttribute) column).getJPAColumnName();
Class javaType = ((AbstractAttribute) column).getBindableJavaType();
if (metaModel.isEmbeddable(javaType))
{
onViaEmbeddable(entityType, column, m, entity, metaModel.embeddable(javaType), jsonObj);
}
else if (!column.isAssociation())
{
setFieldValue(entity, column, value);
}
else if (relations != null)
{
if (relationValue == null)
{
relationValue = new HashMap<String, Object>();
}
if (relations.contains(fieldName)
&& !fieldName.equals(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()))
{
JsonElement colValue = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
if (colValue != null)
{
String colFieldName = m.getFieldName(fieldName);
Attribute attribute = entityType.getAttribute(colFieldName);
EntityMetadata relationMetadata = KunderaMetadataManager.getEntityMetadata(
kunderaMetadata, attribute.getJavaType());
Object colVal = PropertyAccessorHelper.fromSourceToTargetClass(relationMetadata
.getIdAttribute().getJavaType(), String.class, colValue.getAsString());
relationValue.put(fieldName, colVal);
}
}
}
}
}
if (relationValue != null && !relationValue.isEmpty())
{
EnhanceEntity e = new EnhanceEntity(entity, PropertyAccessorHelper.getId(entity, m), relationValue);
return e;
}
else
{
return entity;
}
}
catch (Exception e)
{
log.error("Error while extracting entity object from json, caused by {}.", e);
throw new KunderaException(e);
}
} } | public class class_name {
static Object getEntityFromJson(Class<?> entityClass, EntityMetadata m, JsonObject jsonObj, List<String> relations,
final KunderaMetadata kunderaMetadata)
{// Entity object
Object entity = null;
// Map to hold property-name=>foreign-entity relations
try
{
entity = KunderaCoreUtils.createNewInstance(entityClass);
// Populate primary key column
JsonElement rowKey = jsonObj.get(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName());
if (rowKey == null)
{
return null; // depends on control dependency: [if], data = [none]
}
Class<?> idClass = null;
MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
Map<String, Object> relationValue = null;
idClass = m.getIdAttribute().getJavaType();
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
Class javaType = m.getIdAttribute().getBindableJavaType();
PropertyAccessorHelper.setId(
entity,
m,
getObjectFromJson(rowKey.getAsJsonObject(), javaType, metaModel.embeddable(javaType)
.getAttributes()));
}
else
{
PropertyAccessorHelper.setId(entity, m,
PropertyAccessorHelper.fromSourceToTargetClass(idClass, String.class, rowKey.getAsString()));
}
EntityType entityType = metaModel.entity(entityClass);
String discriminatorColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();
Set<Attribute> columns = entityType.getAttributes();
for (Attribute column : columns)
{
JsonElement value = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
if (!column.equals(m.getIdAttribute())
&& !((AbstractAttribute) column).getJPAColumnName().equals(discriminatorColumn)
&& value != null && !value.equals(JsonNull.INSTANCE))
{
String fieldName = ((AbstractAttribute) column).getJPAColumnName();
Class javaType = ((AbstractAttribute) column).getBindableJavaType(); // depends on control dependency: [if], data = [none]
if (metaModel.isEmbeddable(javaType))
{
onViaEmbeddable(entityType, column, m, entity, metaModel.embeddable(javaType), jsonObj); // depends on control dependency: [if], data = [none]
}
else if (!column.isAssociation())
{
setFieldValue(entity, column, value); // depends on control dependency: [if], data = [none]
}
else if (relations != null)
{
if (relationValue == null)
{
relationValue = new HashMap<String, Object>(); // depends on control dependency: [if], data = [none]
}
if (relations.contains(fieldName)
&& !fieldName.equals(((AbstractAttribute) m.getIdAttribute()).getJPAColumnName()))
{
JsonElement colValue = jsonObj.get(((AbstractAttribute) column).getJPAColumnName());
if (colValue != null)
{
String colFieldName = m.getFieldName(fieldName);
Attribute attribute = entityType.getAttribute(colFieldName);
EntityMetadata relationMetadata = KunderaMetadataManager.getEntityMetadata(
kunderaMetadata, attribute.getJavaType());
Object colVal = PropertyAccessorHelper.fromSourceToTargetClass(relationMetadata
.getIdAttribute().getJavaType(), String.class, colValue.getAsString());
relationValue.put(fieldName, colVal); // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (relationValue != null && !relationValue.isEmpty())
{
EnhanceEntity e = new EnhanceEntity(entity, PropertyAccessorHelper.getId(entity, m), relationValue);
return e; // depends on control dependency: [if], data = [none]
}
else
{
return entity; // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
log.error("Error while extracting entity object from json, caused by {}.", e);
throw new KunderaException(e);
}
} } |
public class class_name {
private void loadClasspathInfo()
{
List<IDirectory> javaClassPath = _module.getJavaClassPath();
IDirectory[] paths = javaClassPath.toArray(new IDirectory[javaClassPath.size()]);
for (int i = paths.length - 1; i >= 0; i--) {
IDirectory path = paths[i];
addClassNames(path, path, _filter);
}
} } | public class class_name {
private void loadClasspathInfo()
{
List<IDirectory> javaClassPath = _module.getJavaClassPath();
IDirectory[] paths = javaClassPath.toArray(new IDirectory[javaClassPath.size()]);
for (int i = paths.length - 1; i >= 0; i--) {
IDirectory path = paths[i];
addClassNames(path, path, _filter); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static String unStudlyName (String name)
{
boolean seenLower = false;
StringBuilder nname = new StringBuilder();
int nlen = name.length();
for (int i = 0; i < nlen; i++) {
char c = name.charAt(i);
// if we see an upper case character and we've seen a lower case character since the
// last time we did so, slip in an _
if (Character.isUpperCase(c)) {
if (seenLower) {
nname.append("_");
}
seenLower = false;
nname.append(c);
} else {
seenLower = true;
nname.append(Character.toUpperCase(c));
}
}
return nname.toString();
} } | public class class_name {
public static String unStudlyName (String name)
{
boolean seenLower = false;
StringBuilder nname = new StringBuilder();
int nlen = name.length();
for (int i = 0; i < nlen; i++) {
char c = name.charAt(i);
// if we see an upper case character and we've seen a lower case character since the
// last time we did so, slip in an _
if (Character.isUpperCase(c)) {
if (seenLower) {
nname.append("_"); // depends on control dependency: [if], data = [none]
}
seenLower = false; // depends on control dependency: [if], data = [none]
nname.append(c); // depends on control dependency: [if], data = [none]
} else {
seenLower = true; // depends on control dependency: [if], data = [none]
nname.append(Character.toUpperCase(c)); // depends on control dependency: [if], data = [none]
}
}
return nname.toString();
} } |
public class class_name {
private String contextName(Annotation annotation) {
if (annotation.annotationType().isAssignableFrom(FromContext.class)) {
return ((FromContext) annotation).value();
} else {
return null;
}
} } | public class class_name {
private String contextName(Annotation annotation) {
if (annotation.annotationType().isAssignableFrom(FromContext.class)) {
return ((FromContext) annotation).value(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static <Input extends ImageBase<Input>>
ImageGradient<Input,GrayF32> createGradient( ImageType<Input> imageType ) {
ImageGradient<Input,GrayF32> gradient;
ImageType<GrayF32> typeF32 = ImageType.single(GrayF32.class);
if( imageType.getDataType() != ImageDataType.F32 )
throw new IllegalArgumentException("Input image type must be F32");
if( imageType.getFamily() == ImageType.Family.GRAY) {
gradient = FactoryDerivative.gradient(DerivativeType.THREE,imageType, typeF32);
} else if( imageType.getFamily() == ImageType.Family.PLANAR ) {
ImageType<Planar<GrayF32>> typePF32 = ImageType.pl(imageType.getNumBands(),GrayF32.class);
ImageGradient<Planar<GrayF32>,Planar<GrayF32>> gradientMB =
FactoryDerivative.gradient(DerivativeType.THREE,typePF32, typePF32);
gradient = (ImageGradient)FactoryDerivative.gradientReduce(gradientMB, DerivativeReduceType.MAX_F, GrayF32.class);
} else {
throw new IllegalArgumentException("Unsupported image type "+imageType);
}
return gradient;
} } | public class class_name {
static <Input extends ImageBase<Input>>
ImageGradient<Input,GrayF32> createGradient( ImageType<Input> imageType ) {
ImageGradient<Input,GrayF32> gradient;
ImageType<GrayF32> typeF32 = ImageType.single(GrayF32.class);
if( imageType.getDataType() != ImageDataType.F32 )
throw new IllegalArgumentException("Input image type must be F32");
if( imageType.getFamily() == ImageType.Family.GRAY) {
gradient = FactoryDerivative.gradient(DerivativeType.THREE,imageType, typeF32); // depends on control dependency: [if], data = [none]
} else if( imageType.getFamily() == ImageType.Family.PLANAR ) {
ImageType<Planar<GrayF32>> typePF32 = ImageType.pl(imageType.getNumBands(),GrayF32.class);
ImageGradient<Planar<GrayF32>,Planar<GrayF32>> gradientMB =
FactoryDerivative.gradient(DerivativeType.THREE,typePF32, typePF32);
gradient = (ImageGradient)FactoryDerivative.gradientReduce(gradientMB, DerivativeReduceType.MAX_F, GrayF32.class); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported image type "+imageType);
}
return gradient;
} } |
public class class_name {
private static void bisectTokeRange(
DeepTokenRange range, final IPartitioner partitioner, final int bisectFactor,
final List<DeepTokenRange> accumulator) {
final AbstractType tkValidator = partitioner.getTokenValidator();
Token leftToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getStartToken()));
Token rightToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getEndToken()));
Token midToken = partitioner.midpoint(leftToken, rightToken);
Comparable midpoint = (Comparable) tkValidator.compose(tkValidator.fromString(midToken.toString()));
DeepTokenRange left = new DeepTokenRange(range.getStartToken(), midpoint, range.getReplicas());
DeepTokenRange right = new DeepTokenRange(midpoint, range.getEndToken(), range.getReplicas());
if (bisectFactor / 2 <= 1) {
accumulator.add(left);
accumulator.add(right);
} else {
bisectTokeRange(left, partitioner, bisectFactor / 2, accumulator);
bisectTokeRange(right, partitioner, bisectFactor / 2, accumulator);
}
} } | public class class_name {
private static void bisectTokeRange(
DeepTokenRange range, final IPartitioner partitioner, final int bisectFactor,
final List<DeepTokenRange> accumulator) {
final AbstractType tkValidator = partitioner.getTokenValidator();
Token leftToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getStartToken()));
Token rightToken = partitioner.getTokenFactory().fromByteArray(tkValidator.decompose(range.getEndToken()));
Token midToken = partitioner.midpoint(leftToken, rightToken);
Comparable midpoint = (Comparable) tkValidator.compose(tkValidator.fromString(midToken.toString()));
DeepTokenRange left = new DeepTokenRange(range.getStartToken(), midpoint, range.getReplicas());
DeepTokenRange right = new DeepTokenRange(midpoint, range.getEndToken(), range.getReplicas());
if (bisectFactor / 2 <= 1) {
accumulator.add(left); // depends on control dependency: [if], data = [none]
accumulator.add(right); // depends on control dependency: [if], data = [none]
} else {
bisectTokeRange(left, partitioner, bisectFactor / 2, accumulator); // depends on control dependency: [if], data = [none]
bisectTokeRange(right, partitioner, bisectFactor / 2, accumulator); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public long getPrice(Configuration configuration) {
long total = 0;
for (KnapsackItem knapsackItem : getKnapsackItems()) {
if (configuration.valueAt(knapsackItem.getIndex()) == 1) {
total += knapsackItem.getPrice();
}
}
return total;
} } | public class class_name {
public long getPrice(Configuration configuration) {
long total = 0;
for (KnapsackItem knapsackItem : getKnapsackItems()) {
if (configuration.valueAt(knapsackItem.getIndex()) == 1) {
total += knapsackItem.getPrice(); // depends on control dependency: [if], data = [none]
}
}
return total;
} } |
public class class_name {
public static String validador(final String paraValidar, final String info, Integer tamanho, Boolean exatamente, Boolean numerico) {
tamanho = ObjectUtils.defaultIfNull(tamanho, 1);
exatamente = ObjectUtils.defaultIfNull(exatamente, false);
numerico = ObjectUtils.defaultIfNull(numerico, true);
if (paraValidar != null) {
if (numerico) {
StringValidador.apenasNumerico(paraValidar, info);
}
if (exatamente) {
StringValidador.validaTamanhoExato(paraValidar, tamanho, info);
} else {
StringValidador.validaTamanhoMaximo(paraValidar, tamanho, info);
}
}
return paraValidar;
} } | public class class_name {
public static String validador(final String paraValidar, final String info, Integer tamanho, Boolean exatamente, Boolean numerico) {
tamanho = ObjectUtils.defaultIfNull(tamanho, 1);
exatamente = ObjectUtils.defaultIfNull(exatamente, false);
numerico = ObjectUtils.defaultIfNull(numerico, true);
if (paraValidar != null) {
if (numerico) {
StringValidador.apenasNumerico(paraValidar, info); // depends on control dependency: [if], data = [none]
}
if (exatamente) {
StringValidador.validaTamanhoExato(paraValidar, tamanho, info); // depends on control dependency: [if], data = [none]
} else {
StringValidador.validaTamanhoMaximo(paraValidar, tamanho, info); // depends on control dependency: [if], data = [none]
}
}
return paraValidar;
} } |
public class class_name {
@Override
public void notifyChanged() {
if (getNotification() && getListenerCount() > 0) {
List<IChemObjectListener> listeners = lazyChemObjectListeners();
for (Object listener : listeners) {
((IChemObjectListener) listener).stateChanged(new QueryChemObjectChangeEvent(this));
}
}
} } | public class class_name {
@Override
public void notifyChanged() {
if (getNotification() && getListenerCount() > 0) {
List<IChemObjectListener> listeners = lazyChemObjectListeners();
for (Object listener : listeners) {
((IChemObjectListener) listener).stateChanged(new QueryChemObjectChangeEvent(this)); // depends on control dependency: [for], data = [listener]
}
}
} } |
public class class_name {
public void setZoomFactor(double newZoomFactor) {
if (zoomFactor==newZoomFactor) return;
if (newZoomFactor<=0 || Double.isInfinite(newZoomFactor) || Double.isNaN(newZoomFactor))
throw new IllegalArgumentException("Invalid zoom factor: "+newZoomFactor);
if (getResizeStrategy()==ResizeStrategy.CUSTOM_ZOOM) {
rescroller.prepare();
}
double oldZoomFactor=zoomFactor;
zoomFactor=newZoomFactor;
boolean canRescroll=viewer.getSynchronizer().zoomFactorChangedCanIRescroll(viewer);
if (getResizeStrategy()==ResizeStrategy.CUSTOM_ZOOM) {
resizeNow();
// do not rescroll if we're following another viewer; the scrolling will be synchronized later
if (canRescroll) {
rescroller.rescroll();
viewer.getSynchronizer().doneRescrolling(viewer);
}
} else {
// no rescrolling is necessary, actually
if (canRescroll)
viewer.getSynchronizer().doneRescrolling(viewer);
}
propertyChangeSupport.firePropertyChange("zoomFactor", oldZoomFactor, newZoomFactor);
} } | public class class_name {
public void setZoomFactor(double newZoomFactor) {
if (zoomFactor==newZoomFactor) return;
if (newZoomFactor<=0 || Double.isInfinite(newZoomFactor) || Double.isNaN(newZoomFactor))
throw new IllegalArgumentException("Invalid zoom factor: "+newZoomFactor);
if (getResizeStrategy()==ResizeStrategy.CUSTOM_ZOOM) {
rescroller.prepare(); // depends on control dependency: [if], data = [none]
}
double oldZoomFactor=zoomFactor;
zoomFactor=newZoomFactor;
boolean canRescroll=viewer.getSynchronizer().zoomFactorChangedCanIRescroll(viewer);
if (getResizeStrategy()==ResizeStrategy.CUSTOM_ZOOM) {
resizeNow(); // depends on control dependency: [if], data = [none]
// do not rescroll if we're following another viewer; the scrolling will be synchronized later
if (canRescroll) {
rescroller.rescroll(); // depends on control dependency: [if], data = [none]
viewer.getSynchronizer().doneRescrolling(viewer); // depends on control dependency: [if], data = [none]
}
} else {
// no rescrolling is necessary, actually
if (canRescroll)
viewer.getSynchronizer().doneRescrolling(viewer);
}
propertyChangeSupport.firePropertyChange("zoomFactor", oldZoomFactor, newZoomFactor);
} } |
public class class_name {
private void addDefaultServices(Set<String> serviceSet) {
List<String> defaultServices = ServerParams.instance().getModuleParamList("DoradusServer", "default_services");
if (defaultServices != null) {
serviceSet.addAll(defaultServices);
}
} } | public class class_name {
private void addDefaultServices(Set<String> serviceSet) {
List<String> defaultServices = ServerParams.instance().getModuleParamList("DoradusServer", "default_services");
if (defaultServices != null) {
serviceSet.addAll(defaultServices);
// depends on control dependency: [if], data = [(defaultServices]
}
} } |
public class class_name {
public void startup(@Observes(precedence = -100) final BeforeSuite event) {
if (extensionEnabled()) {
debug("Catching BeforeSuite event {0}", event.toString());
executeInClassScope(new Callable<Void>() {
@Override
public Void call() {
generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass)));
suiteDeploymentScenario = classDeploymentScenario.get();
return null;
}
});
deployDeployments = true;
extendedSuiteContext.get().activate();
suiteDeploymentScenarioInstanceProducer.set(suiteDeploymentScenario);
}
} } | public class class_name {
public void startup(@Observes(precedence = -100) final BeforeSuite event) {
if (extensionEnabled()) {
debug("Catching BeforeSuite event {0}", event.toString()); // depends on control dependency: [if], data = [none]
executeInClassScope(new Callable<Void>() {
@Override
public Void call() {
generateDeploymentEvent.fire(new GenerateDeployment(new TestClass(deploymentClass)));
suiteDeploymentScenario = classDeploymentScenario.get();
return null;
}
}); // depends on control dependency: [if], data = [none]
deployDeployments = true; // depends on control dependency: [if], data = [none]
extendedSuiteContext.get().activate(); // depends on control dependency: [if], data = [none]
suiteDeploymentScenarioInstanceProducer.set(suiteDeploymentScenario); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ChartSeries buildChartSeriesInList(final ThemesTable themeTable,
final ChartObject ctObj, final Object ctObjSer, final int index) {
ChartSeries ctSer = new ChartSeries();
ctSer.setSeriesLabel(new ParsedCell(
ctObj.getSeriesLabelFromCTSer(ctObjSer)));
ctSer.setSeriesColor(ColorUtility.geColorFromSpPr(index,
ctObj.getShapePropertiesFromCTSer(ctObjSer),
themeTable, ctObj.isLineColor()));
List<ParsedCell> cells = new ArrayList<>();
String fullRangeName = (ctObj
.getCTNumDataSourceFromCTSer(ctObjSer)).getNumRef()
.getF();
String sheetName = WebSheetUtility
.getSheetNameFromFullCellRefName(fullRangeName);
CellRangeAddress region = CellRangeAddress
.valueOf(WebSheetUtility
.removeSheetNameFromFullCellRefName(
fullRangeName));
for (int row = region.getFirstRow(); row <= region
.getLastRow(); row++) {
for (int col = region.getFirstColumn(); col <= region
.getLastColumn(); col++) {
cells.add(new ParsedCell(sheetName, row, col));
}
}
ctSer.setValueList(cells);
ctSer.setValueColorList(getColorListFromDPTWithValueList(
ctObj.getDPtListFromCTSer(ctObjSer), cells,
themeTable, ctObj));
return ctSer;
} } | public class class_name {
private ChartSeries buildChartSeriesInList(final ThemesTable themeTable,
final ChartObject ctObj, final Object ctObjSer, final int index) {
ChartSeries ctSer = new ChartSeries();
ctSer.setSeriesLabel(new ParsedCell(
ctObj.getSeriesLabelFromCTSer(ctObjSer)));
ctSer.setSeriesColor(ColorUtility.geColorFromSpPr(index,
ctObj.getShapePropertiesFromCTSer(ctObjSer),
themeTable, ctObj.isLineColor()));
List<ParsedCell> cells = new ArrayList<>();
String fullRangeName = (ctObj
.getCTNumDataSourceFromCTSer(ctObjSer)).getNumRef()
.getF();
String sheetName = WebSheetUtility
.getSheetNameFromFullCellRefName(fullRangeName);
CellRangeAddress region = CellRangeAddress
.valueOf(WebSheetUtility
.removeSheetNameFromFullCellRefName(
fullRangeName));
for (int row = region.getFirstRow(); row <= region
.getLastRow(); row++) {
for (int col = region.getFirstColumn(); col <= region
.getLastColumn(); col++) {
cells.add(new ParsedCell(sheetName, row, col));
// depends on control dependency: [for], data = [col]
}
}
ctSer.setValueList(cells);
ctSer.setValueColorList(getColorListFromDPTWithValueList(
ctObj.getDPtListFromCTSer(ctObjSer), cells,
themeTable, ctObj));
return ctSer;
} } |
public class class_name {
private static String getWellFormPath(String path) {
if(null != path){
//去掉项目名部分,不去开头的"/"
final String contextPath = ActionContext.getContextPath();
if(null != contextPath && false == StrUtil.SLASH.equals(contextPath)){
path = StrUtil.removePrefix(path, contextPath);
}
//去掉尾部"/",如果path为"/"不处理
if(path.length() > 1) {
path = StrUtil.removeSuffix(path, StrUtil.SLASH);
}
}
return path;
} } | public class class_name {
private static String getWellFormPath(String path) {
if(null != path){
//去掉项目名部分,不去开头的"/"
final String contextPath = ActionContext.getContextPath();
if(null != contextPath && false == StrUtil.SLASH.equals(contextPath)){
path = StrUtil.removePrefix(path, contextPath);
// depends on control dependency: [if], data = [none]
}
//去掉尾部"/",如果path为"/"不处理
if(path.length() > 1) {
path = StrUtil.removeSuffix(path, StrUtil.SLASH);
// depends on control dependency: [if], data = [none]
}
}
return path;
} } |
public class class_name {
public Observable<ServiceResponse<LocationCapabilitiesInner>> listByLocationWithServiceResponseAsync(String locationName) {
if (locationName == null) {
throw new IllegalArgumentException("Parameter locationName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final CapabilityGroup include = null;
return service.listByLocation(locationName, this.client.subscriptionId(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LocationCapabilitiesInner>>>() {
@Override
public Observable<ServiceResponse<LocationCapabilitiesInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<LocationCapabilitiesInner> clientResponse = listByLocationDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<LocationCapabilitiesInner>> listByLocationWithServiceResponseAsync(String locationName) {
if (locationName == null) {
throw new IllegalArgumentException("Parameter locationName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
final CapabilityGroup include = null;
return service.listByLocation(locationName, this.client.subscriptionId(), include, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<LocationCapabilitiesInner>>>() {
@Override
public Observable<ServiceResponse<LocationCapabilitiesInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<LocationCapabilitiesInner> clientResponse = listByLocationDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public static int findEndOfSubExpression(String expression, int start) {
int count = 0;
for (int i = start; i < expression.length(); i++) {
switch (expression.charAt(i)) {
case '(': {
count++;
break;
}
case ')': {
count--;
if (count == 0) {
return i;
}
break;
}
}
}
throw new IllegalArgumentException("can't parse expression [" + expression + "]: end of subexpression not found");
} } | public class class_name {
public static int findEndOfSubExpression(String expression, int start) {
int count = 0;
for (int i = start; i < expression.length(); i++) {
switch (expression.charAt(i)) {
case '(': {
count++;
break;
}
case ')': {
count--;
if (count == 0) {
return i; // depends on control dependency: [if], data = [none]
}
break;
}
}
}
throw new IllegalArgumentException("can't parse expression [" + expression + "]: end of subexpression not found");
} } |
public class class_name {
@SuppressWarnings("unchecked")
public Collection<V> getValues(Object src) {
ArrayList<V> values = new ArrayList<V>();
if( src instanceof String ) {
String[] words = ((String)src).split(",");
if( words.length < 1 ) {
values.add(getValue(src));
}
else {
for( String word : words ) {
values.add(getValue(word));
}
}
return values;
}
else if( src instanceof Collection ) {
for( Object ob : (Collection<Object>)src ) {
values.add(getValue(ob));
}
return values;
}
throw new InvalidAttributeException("Invalid attribute: " + src);
} } | public class class_name {
@SuppressWarnings("unchecked")
public Collection<V> getValues(Object src) {
ArrayList<V> values = new ArrayList<V>();
if( src instanceof String ) {
String[] words = ((String)src).split(",");
if( words.length < 1 ) {
values.add(getValue(src)); // depends on control dependency: [if], data = [none]
}
else {
for( String word : words ) {
values.add(getValue(word)); // depends on control dependency: [for], data = [word]
}
}
return values; // depends on control dependency: [if], data = [none]
}
else if( src instanceof Collection ) {
for( Object ob : (Collection<Object>)src ) {
values.add(getValue(ob)); // depends on control dependency: [for], data = [ob]
}
return values; // depends on control dependency: [if], data = [none]
}
throw new InvalidAttributeException("Invalid attribute: " + src);
} } |
public class class_name {
private static List<java.awt.Component> findComponents(java.awt.Container container,
Class<? extends java.awt.Component> componentClass) {
List<java.awt.Component> list = new ArrayList<java.awt.Component>();
for (java.awt.Component component : container.getComponents()) {
if (component.isVisible() && componentClass.isAssignableFrom(component.getClass())) {
list.add(component);
}
if (component instanceof java.awt.Container) {
List<java.awt.Component> children = findComponents((java.awt.Container) component,
componentClass);
list.addAll(children);
}
}
return list;
} } | public class class_name {
private static List<java.awt.Component> findComponents(java.awt.Container container,
Class<? extends java.awt.Component> componentClass) {
List<java.awt.Component> list = new ArrayList<java.awt.Component>();
for (java.awt.Component component : container.getComponents()) {
if (component.isVisible() && componentClass.isAssignableFrom(component.getClass())) {
list.add(component); // depends on control dependency: [if], data = [none]
}
if (component instanceof java.awt.Container) {
List<java.awt.Component> children = findComponents((java.awt.Container) component,
componentClass);
list.addAll(children); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
public void setInputImage( BufferedImage image ) {
inputImage = image;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if( inputImage == null ) {
originalCheck.setEnabled(false);
} else {
originalCheck.setEnabled(true);
origPanel.setImage(inputImage);
origPanel.setPreferredSize(new Dimension(inputImage.getWidth(),inputImage.getHeight()));
origPanel.repaint();
}
}});
} } | public class class_name {
public void setInputImage( BufferedImage image ) {
inputImage = image;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
if( inputImage == null ) {
originalCheck.setEnabled(false); // depends on control dependency: [if], data = [none]
} else {
originalCheck.setEnabled(true); // depends on control dependency: [if], data = [none]
origPanel.setImage(inputImage); // depends on control dependency: [if], data = [none]
origPanel.setPreferredSize(new Dimension(inputImage.getWidth(),inputImage.getHeight())); // depends on control dependency: [if], data = [none]
origPanel.repaint(); // depends on control dependency: [if], data = [none]
}
}});
} } |
public class class_name {
private boolean isOneOfOurSupertypes(String type) {
String stypeName = typeDescriptor.getSupertypeName();
while (stypeName != null) {
// TODO [bug] should stop at the first one that has a field in it? and check the field is protected, yada yada yada
if (stypeName.equals(type)) {
return true;
}
stypeName = typeDescriptor.getTypeRegistry().getDescriptorFor(stypeName).getSupertypeName();
}
return false;
} } | public class class_name {
private boolean isOneOfOurSupertypes(String type) {
String stypeName = typeDescriptor.getSupertypeName();
while (stypeName != null) {
// TODO [bug] should stop at the first one that has a field in it? and check the field is protected, yada yada yada
if (stypeName.equals(type)) {
return true; // depends on control dependency: [if], data = [none]
}
stypeName = typeDescriptor.getTypeRegistry().getDescriptorFor(stypeName).getSupertypeName(); // depends on control dependency: [while], data = [(stypeName]
}
return false;
} } |
public class class_name {
protected CmsXmlContentTypeManager getXmlContentTypeManager() {
if (m_xmlContentTypeManager != null) {
return m_xmlContentTypeManager;
}
if (getRunLevel() == OpenCms.RUNLEVEL_1_CORE_OBJECT) {
// this is only to enable test cases to run
m_xmlContentTypeManager = CmsXmlContentTypeManager.createTypeManagerForTestCases();
}
return m_xmlContentTypeManager;
} } | public class class_name {
protected CmsXmlContentTypeManager getXmlContentTypeManager() {
if (m_xmlContentTypeManager != null) {
return m_xmlContentTypeManager; // depends on control dependency: [if], data = [none]
}
if (getRunLevel() == OpenCms.RUNLEVEL_1_CORE_OBJECT) {
// this is only to enable test cases to run
m_xmlContentTypeManager = CmsXmlContentTypeManager.createTypeManagerForTestCases(); // depends on control dependency: [if], data = [none]
}
return m_xmlContentTypeManager;
} } |
public class class_name {
public static <T> T assertValid(T context, Validator<T> validator) {
assertNotNull(context);
if(validator != null) {
validator.validate(context);
}
return context;
} } | public class class_name {
public static <T> T assertValid(T context, Validator<T> validator) {
assertNotNull(context);
if(validator != null) {
validator.validate(context); // depends on control dependency: [if], data = [none]
}
return context;
} } |
public class class_name {
private static Document loadXML(InputSource source, boolean useNamespace) {
try {
org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).parse(source);
return new DocumentImpl(doc);
} catch (Exception e) {
throw new DomException(e);
} finally {
close(source);
}
} } | public class class_name {
private static Document loadXML(InputSource source, boolean useNamespace) {
try {
org.w3c.dom.Document doc = getDocumentBuilder(null, useNamespace).parse(source);
return new DocumentImpl(doc);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new DomException(e);
} finally {
// depends on control dependency: [catch], data = [none]
close(source);
}
} } |
public class class_name {
public java.util.List<CharacterSet> getSupportedCharacterSets() {
if (supportedCharacterSets == null) {
supportedCharacterSets = new com.amazonaws.internal.SdkInternalList<CharacterSet>();
}
return supportedCharacterSets;
} } | public class class_name {
public java.util.List<CharacterSet> getSupportedCharacterSets() {
if (supportedCharacterSets == null) {
supportedCharacterSets = new com.amazonaws.internal.SdkInternalList<CharacterSet>(); // depends on control dependency: [if], data = [none]
}
return supportedCharacterSets;
} } |
public class class_name {
@SuppressWarnings("static-method")
protected void translateAnnotationsTo(List<JvmAnnotationReference> annotations, JvmAnnotationTarget target,
Class<?>... exceptions) {
final Set<String> excepts = new HashSet<>();
for (final Class<?> type : exceptions) {
excepts.add(type.getName());
}
final List<JvmAnnotationReference> addition = new ArrayList<>();
for (final JvmAnnotationReference annotation : Iterables.filter(annotations, an -> {
if (!ANNOTATION_TRANSLATION_FILTER.apply(an)) {
return false;
}
return !excepts.contains(an.getAnnotation().getIdentifier());
})) {
addition.add(annotation);
}
target.getAnnotations().addAll(addition);
} } | public class class_name {
@SuppressWarnings("static-method")
protected void translateAnnotationsTo(List<JvmAnnotationReference> annotations, JvmAnnotationTarget target,
Class<?>... exceptions) {
final Set<String> excepts = new HashSet<>();
for (final Class<?> type : exceptions) {
excepts.add(type.getName()); // depends on control dependency: [for], data = [type]
}
final List<JvmAnnotationReference> addition = new ArrayList<>();
for (final JvmAnnotationReference annotation : Iterables.filter(annotations, an -> {
if (!ANNOTATION_TRANSLATION_FILTER.apply(an)) {
return false;
}
return !excepts.contains(an.getAnnotation().getIdentifier());
})) {
addition.add(annotation); // depends on control dependency: [for], data = [annotation]
}
target.getAnnotations().addAll(addition);
} } |
public class class_name {
private void cleanLogFilesIfNecessary() {
File logDir = new File(folderPath);
File[] files = logDir.listFiles();
if (files == null) {
return;
}
for (File file : files) {
if (cleanStrategy.shouldClean(file)) {
file.delete();
}
}
} } | public class class_name {
private void cleanLogFilesIfNecessary() {
File logDir = new File(folderPath);
File[] files = logDir.listFiles();
if (files == null) {
return; // depends on control dependency: [if], data = [none]
}
for (File file : files) {
if (cleanStrategy.shouldClean(file)) {
file.delete(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private List<String> getSchemaStringsFromDir(File dir) {
List<String> schemaStrings = new ArrayList<String>();
Collection<File> schemaFiles = FileUtils.listFiles(dir,
new SuffixFileFilter(".avsc"), TrueFileFilter.INSTANCE);
for (File schemaFile : schemaFiles) {
schemaStrings.add(getSchemaStringFromFile(schemaFile));
}
return schemaStrings;
} } | public class class_name {
private List<String> getSchemaStringsFromDir(File dir) {
List<String> schemaStrings = new ArrayList<String>();
Collection<File> schemaFiles = FileUtils.listFiles(dir,
new SuffixFileFilter(".avsc"), TrueFileFilter.INSTANCE);
for (File schemaFile : schemaFiles) {
schemaStrings.add(getSchemaStringFromFile(schemaFile)); // depends on control dependency: [for], data = [schemaFile]
}
return schemaStrings;
} } |
public class class_name {
@Override
public void executeDemo(final String text) {
EntityUtils.getEntity(this, text, new EntityGetListener() {
@Override
public void onGet(Entity entity) {
handleBasicSocializeResult(entity);
}
@Override
public void onError(SocializeException error) {
if(isNotFoundError(error)) {
handleResult("No entity found with key [" +
text +
"]");
}
else {
handleError(GetEntityByKeyActivity.this, error);
}
}
});
} } | public class class_name {
@Override
public void executeDemo(final String text) {
EntityUtils.getEntity(this, text, new EntityGetListener() {
@Override
public void onGet(Entity entity) {
handleBasicSocializeResult(entity);
}
@Override
public void onError(SocializeException error) {
if(isNotFoundError(error)) {
handleResult("No entity found with key [" +
text +
"]"); // depends on control dependency: [if], data = [none]
}
else {
handleError(GetEntityByKeyActivity.this, error); // depends on control dependency: [if], data = [none]
}
}
});
} } |
public class class_name {
public void addParameter(String pName, Object pValue) {
// Check that we haven't already saved this parameter
if (!parameterNames.contains(pName)) {
parameterNames.add(pName);
// Now check if this parameter already exists in the page.
Object obj = getRequest().getAttribute(pName);
if (obj != null) {
oldParameters.put(pName, obj);
}
}
// Finally, insert the parameter in the request scope.
getRequest().setAttribute(pName, pValue);
} } | public class class_name {
public void addParameter(String pName, Object pValue) {
// Check that we haven't already saved this parameter
if (!parameterNames.contains(pName)) {
parameterNames.add(pName);
// depends on control dependency: [if], data = [none]
// Now check if this parameter already exists in the page.
Object obj = getRequest().getAttribute(pName);
if (obj != null) {
oldParameters.put(pName, obj);
// depends on control dependency: [if], data = [none]
}
}
// Finally, insert the parameter in the request scope.
getRequest().setAttribute(pName, pValue);
} } |
public class class_name {
public void releaseService(BeanContextChild child, Object requestor, Object service) {
if (!contains(child)) {
throw new IllegalArgumentException(child + "is not a child of this context!");
}
// todo: for multithreaded usage this block needs to be synchronized
Class serviceClass = findServiceClass(service);
ServiceProvider sp = _serviceProviders.get(serviceClass);
sp.removeChildReference(requestor);
// if this is a delegated service, delegate the release request
// delegated services are removed from the _serviceProviders table
// as soon as their reference count drops to zero
if (sp.isDelegated()) {
BeanContextServices bcs = (BeanContextServices) getBeanContext();
bcs.releaseService(this, requestor, service);
if (!sp.hasRequestors()) {
_serviceProviders.remove(serviceClass);
}
}
else {
sp.getBCServiceProvider().releaseService((BeanContextServices)getPeer(), requestor, service);
}
// end synchronized
} } | public class class_name {
public void releaseService(BeanContextChild child, Object requestor, Object service) {
if (!contains(child)) {
throw new IllegalArgumentException(child + "is not a child of this context!");
}
// todo: for multithreaded usage this block needs to be synchronized
Class serviceClass = findServiceClass(service);
ServiceProvider sp = _serviceProviders.get(serviceClass);
sp.removeChildReference(requestor);
// if this is a delegated service, delegate the release request
// delegated services are removed from the _serviceProviders table
// as soon as their reference count drops to zero
if (sp.isDelegated()) {
BeanContextServices bcs = (BeanContextServices) getBeanContext();
bcs.releaseService(this, requestor, service); // depends on control dependency: [if], data = [none]
if (!sp.hasRequestors()) {
_serviceProviders.remove(serviceClass); // depends on control dependency: [if], data = [none]
}
}
else {
sp.getBCServiceProvider().releaseService((BeanContextServices)getPeer(), requestor, service); // depends on control dependency: [if], data = [none]
}
// end synchronized
} } |
public class class_name {
public static void copyAttributes(Map<String, String> source, Element dest) {
for (Entry<String, String> entry : source.entrySet()) {
dest.setAttribute(entry.getKey(), entry.getValue());
}
} } | public class class_name {
public static void copyAttributes(Map<String, String> source, Element dest) {
for (Entry<String, String> entry : source.entrySet()) {
dest.setAttribute(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public Row select(Example example)
{
if (isARow(identifier(example)))
return instantiateRow(example);
try
{
if (Fit.isAnActionFitInterpreter(sud, identifier(example)))
{
timed = Fit.isATimedActionFitInterpreter(sud, identifier(example));
if(timed)
{
example.addChild().setContent("time");
example.addChild().setContent("split");
}
fitFixture = sud.getFixture(identifier(example));
return new SkipRow();
}
if (Fit.isAFitInterpreter(sud, identifier(example)))
return new FitInterpretRow(sud, fixture);
}
catch (Throwable e)
{
}
return new FitDefaultRow(fitFixture, fixture, timed);
} } | public class class_name {
public Row select(Example example)
{
if (isARow(identifier(example)))
return instantiateRow(example);
try
{
if (Fit.isAnActionFitInterpreter(sud, identifier(example)))
{
timed = Fit.isATimedActionFitInterpreter(sud, identifier(example)); // depends on control dependency: [if], data = [none]
if(timed)
{
example.addChild().setContent("time"); // depends on control dependency: [if], data = [none]
example.addChild().setContent("split"); // depends on control dependency: [if], data = [none]
}
fitFixture = sud.getFixture(identifier(example)); // depends on control dependency: [if], data = [none]
return new SkipRow(); // depends on control dependency: [if], data = [none]
}
if (Fit.isAFitInterpreter(sud, identifier(example)))
return new FitInterpretRow(sud, fixture);
}
catch (Throwable e)
{
} // depends on control dependency: [catch], data = [none]
return new FitDefaultRow(fitFixture, fixture, timed);
} } |
public class class_name {
public synchronized void enableAutomaticReconnection() {
if (automaticReconnectEnabled) {
return;
}
XMPPConnection connection = weakRefConnection.get();
if (connection == null) {
throw new IllegalStateException("Connection instance no longer available");
}
connection.addConnectionListener(connectionListener);
automaticReconnectEnabled = true;
} } | public class class_name {
public synchronized void enableAutomaticReconnection() {
if (automaticReconnectEnabled) {
return; // depends on control dependency: [if], data = [none]
}
XMPPConnection connection = weakRefConnection.get();
if (connection == null) {
throw new IllegalStateException("Connection instance no longer available");
}
connection.addConnectionListener(connectionListener);
automaticReconnectEnabled = true;
} } |
public class class_name {
@Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE:
c.putInts(rowId, n, currentValue);
break;
case PACKED:
c.putInts(rowId, n, currentBuffer, currentBufferIdx);
currentBufferIdx += n;
break;
}
rowId += n;
left -= n;
currentCount -= n;
}
} } | public class class_name {
@Override
public void readIntegers(int total, WritableColumnVector c, int rowId) {
int left = total;
while (left > 0) {
if (this.currentCount == 0) this.readNextGroup();
int n = Math.min(left, this.currentCount);
switch (mode) {
case RLE:
c.putInts(rowId, n, currentValue);
break;
case PACKED:
c.putInts(rowId, n, currentBuffer, currentBufferIdx);
currentBufferIdx += n;
break;
}
rowId += n; // depends on control dependency: [while], data = [none]
left -= n; // depends on control dependency: [while], data = [none]
currentCount -= n; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
protected FieldDescriptor resolvePayloadField(Message message) {
for (FieldDescriptor field : message.getDescriptorForType().getFields()) {
if (message.hasField(field)) {
return field;
}
}
throw new RuntimeException("No payload found in message " + message);
} } | public class class_name {
protected FieldDescriptor resolvePayloadField(Message message) {
for (FieldDescriptor field : message.getDescriptorForType().getFields()) {
if (message.hasField(field)) {
return field; // depends on control dependency: [if], data = [none]
}
}
throw new RuntimeException("No payload found in message " + message);
} } |
public class class_name {
public void run(R row, String value, int distinctCount) {
final List<Token> tokens;
boolean match = false;
try {
tokens = _tokenizer.tokenize(value);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
}
final String patternCode = getPatternCode(tokens);
Set<TokenPattern> patterns;
synchronized (this) {
patterns = _patterns.get(patternCode);
if (patterns == null) {
patterns = new HashSet<TokenPattern>();
_patterns.put(patternCode, patterns);
}
for (TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount);
match = true;
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration);
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
}
storeNewPattern(pattern, row, value, distinctCount);
patterns.add(pattern);
}
}
} } | public class class_name {
public void run(R row, String value, int distinctCount) {
final List<Token> tokens;
boolean match = false;
try {
tokens = _tokenizer.tokenize(value); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while tokenizing value: " + value, e);
} // depends on control dependency: [catch], data = [none]
final String patternCode = getPatternCode(tokens);
Set<TokenPattern> patterns;
synchronized (this) {
patterns = _patterns.get(patternCode);
if (patterns == null) {
patterns = new HashSet<TokenPattern>(); // depends on control dependency: [if], data = [none]
_patterns.put(patternCode, patterns); // depends on control dependency: [if], data = [none]
}
for (TokenPattern pattern : patterns) {
if (pattern.match(tokens)) {
storeMatch(pattern, row, value, distinctCount); // depends on control dependency: [if], data = [none]
match = true; // depends on control dependency: [if], data = [none]
}
}
if (!match) {
final TokenPattern pattern;
try {
pattern = new TokenPatternImpl(value, tokens, _configuration); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw new IllegalStateException("Error occurred while creating pattern for: " + tokens, e);
} // depends on control dependency: [catch], data = [none]
storeNewPattern(pattern, row, value, distinctCount); // depends on control dependency: [if], data = [none]
patterns.add(pattern); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected String getHeaderValueText(Object value) {
if (value == null) {
return null;
}
// TODO: Type conversion based on provided config
if (value.getClass() == String.class) {
return (String) value;
} else if (value instanceof List) {
List<?> list = (List<?>) value;
if (list.size() == 1) {
return getHeaderValueText(list.get(0));
} else {
return list.toString();
}
}
return null;
} } | public class class_name {
protected String getHeaderValueText(Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
// TODO: Type conversion based on provided config
if (value.getClass() == String.class) {
return (String) value; // depends on control dependency: [if], data = [none]
} else if (value instanceof List) {
List<?> list = (List<?>) value;
if (list.size() == 1) {
return getHeaderValueText(list.get(0)); // depends on control dependency: [if], data = [none]
} else {
return list.toString(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private Role calculateRole() {
boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId);
boolean isMapNamePartition = partitionId == mapNamePartition;
boolean isMapNamePartitionFirstReplica = false;
if (hasBackup && isMapNamePartition) {
IPartition partition = partitionService.getPartition(partitionId);
Address firstReplicaAddress = partition.getReplicaAddress(1);
Member member = clusterService.getMember(firstReplicaAddress);
if (member != null) {
isMapNamePartitionFirstReplica = member.localMember();
}
}
return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica);
} } | public class class_name {
private Role calculateRole() {
boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId);
boolean isMapNamePartition = partitionId == mapNamePartition;
boolean isMapNamePartitionFirstReplica = false;
if (hasBackup && isMapNamePartition) {
IPartition partition = partitionService.getPartition(partitionId);
Address firstReplicaAddress = partition.getReplicaAddress(1);
Member member = clusterService.getMember(firstReplicaAddress);
if (member != null) {
isMapNamePartitionFirstReplica = member.localMember(); // depends on control dependency: [if], data = [none]
}
}
return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica);
} } |
public class class_name {
public MessageControl getMessageControl()
{
if (m_recMessageControl == null)
{
RecordOwner recordOwner = this.findRecordOwner();
m_recMessageControl = new MessageControl(recordOwner);
if (recordOwner != null)
recordOwner.removeRecord(m_recMessageControl); // Set it is not on the recordowner's list
this.addListener(new FreeOnFreeHandler(m_recMessageControl));
}
return m_recMessageControl;
} } | public class class_name {
public MessageControl getMessageControl()
{
if (m_recMessageControl == null)
{
RecordOwner recordOwner = this.findRecordOwner();
m_recMessageControl = new MessageControl(recordOwner); // depends on control dependency: [if], data = [none]
if (recordOwner != null)
recordOwner.removeRecord(m_recMessageControl); // Set it is not on the recordowner's list
this.addListener(new FreeOnFreeHandler(m_recMessageControl)); // depends on control dependency: [if], data = [(m_recMessageControl]
}
return m_recMessageControl;
} } |
public class class_name {
private void cmdDuplicateMappingActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_duplicateMappingButtonActionPerformed
Object[] currentSelection = mappingList.getSelectedValues();
if (currentSelection == null) {
JOptionPane.showMessageDialog(this, "No mappings have been selected", "ERROR", JOptionPane.ERROR_MESSAGE);
return;
}
int confirm = JOptionPane.showConfirmDialog(
this,
"This will create copies of the selected mappings. \nNumber of mappings selected = "
+ currentSelection.length + "\nContinue? ",
"Copy confirmation",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (confirm == JOptionPane.NO_OPTION || confirm == JOptionPane.CANCEL_OPTION || confirm == JOptionPane.CLOSED_OPTION) {
return;
}
OBDAModel controller = apic;
URI current_srcuri = selectedSource.getSourceID();
for (int i = 0; i < currentSelection.length; i++) {
SQLPPTriplesMap mapping = (SQLPPTriplesMap) currentSelection[i];
String id = mapping.getId();
// Computing the next available ID
int new_index = -1;
for (int index = 0; index < 999999999; index++) {
if (controller.indexOf(current_srcuri, id + "(" + index + ")") == -1) {
new_index = index;
break;
}
}
String newId = id + "(" + new_index + ")";
// inserting the new mapping
try {
SQLPPTriplesMap oldmapping = controller.getTriplesMap(id);
SQLPPTriplesMap newmapping = new OntopNativeSQLPPTriplesMap(newId, oldmapping.getSourceQuery(),
oldmapping.getTargetAtoms());
controller.addTriplesMap(current_srcuri, newmapping, false);
} catch (DuplicateMappingException e) {
JOptionPane.showMessageDialog(this, "Duplicate Mapping: " + newId);
return;
}
}
} } | public class class_name {
private void cmdDuplicateMappingActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_duplicateMappingButtonActionPerformed
Object[] currentSelection = mappingList.getSelectedValues();
if (currentSelection == null) {
JOptionPane.showMessageDialog(this, "No mappings have been selected", "ERROR", JOptionPane.ERROR_MESSAGE); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int confirm = JOptionPane.showConfirmDialog(
this,
"This will create copies of the selected mappings. \nNumber of mappings selected = "
+ currentSelection.length + "\nContinue? ",
"Copy confirmation",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (confirm == JOptionPane.NO_OPTION || confirm == JOptionPane.CANCEL_OPTION || confirm == JOptionPane.CLOSED_OPTION) {
return; // depends on control dependency: [if], data = [none]
}
OBDAModel controller = apic;
URI current_srcuri = selectedSource.getSourceID();
for (int i = 0; i < currentSelection.length; i++) {
SQLPPTriplesMap mapping = (SQLPPTriplesMap) currentSelection[i];
String id = mapping.getId();
// Computing the next available ID
int new_index = -1;
for (int index = 0; index < 999999999; index++) {
if (controller.indexOf(current_srcuri, id + "(" + index + ")") == -1) {
new_index = index; // depends on control dependency: [if], data = [none]
break;
}
}
String newId = id + "(" + new_index + ")";
// inserting the new mapping
try {
SQLPPTriplesMap oldmapping = controller.getTriplesMap(id);
SQLPPTriplesMap newmapping = new OntopNativeSQLPPTriplesMap(newId, oldmapping.getSourceQuery(),
oldmapping.getTargetAtoms());
controller.addTriplesMap(current_srcuri, newmapping, false); // depends on control dependency: [try], data = [none]
} catch (DuplicateMappingException e) {
JOptionPane.showMessageDialog(this, "Duplicate Mapping: " + newId);
return;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private void findSelections(final Request request, final MenuSelectContainer selectContainer,
final List<MenuItemSelectable> selections) {
// Don't bother checking disabled or invisible containers
if (!selectContainer.isVisible()
|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).isDisabled())) {
return;
}
// Get any selectable children of this container
List<MenuItemSelectable> selectableItems = getSelectableItems(selectContainer);
// Now add the selections (if in the request)
for (MenuItemSelectable selectableItem : selectableItems) {
// Check if the item is on the request
if (request.getParameter(selectableItem.getId() + ".selected") != null) {
selections.add(selectableItem);
if (SelectionMode.SINGLE.equals(selectContainer.getSelectionMode())) {
// Only select the first item at this level.
// We still need to check other levels of the menu for selection.
break;
}
}
}
// We need to recurse through and check for other selectable containers
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (groupItem instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) groupItem, selections);
}
}
} else if (item instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) item, selections);
}
}
} } | public class class_name {
private void findSelections(final Request request, final MenuSelectContainer selectContainer,
final List<MenuItemSelectable> selections) {
// Don't bother checking disabled or invisible containers
if (!selectContainer.isVisible()
|| (selectContainer instanceof Disableable && ((Disableable) selectContainer).isDisabled())) {
return; // depends on control dependency: [if], data = [none]
}
// Get any selectable children of this container
List<MenuItemSelectable> selectableItems = getSelectableItems(selectContainer);
// Now add the selections (if in the request)
for (MenuItemSelectable selectableItem : selectableItems) {
// Check if the item is on the request
if (request.getParameter(selectableItem.getId() + ".selected") != null) {
selections.add(selectableItem); // depends on control dependency: [if], data = [none]
if (SelectionMode.SINGLE.equals(selectContainer.getSelectionMode())) {
// Only select the first item at this level.
// We still need to check other levels of the menu for selection.
break;
}
}
}
// We need to recurse through and check for other selectable containers
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (groupItem instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) groupItem, selections); // depends on control dependency: [if], data = [none]
}
}
} else if (item instanceof MenuSelectContainer) {
findSelections(request, (MenuSelectContainer) item, selections); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)
throws SQLException {
@SuppressWarnings("unchecked")
ID id = (ID) idField.extractJavaFieldValue(data);
// we don't care about the cache here
T result = super.execute(databaseConnection, id, null);
if (result == null) {
return 0;
}
// copy each field from the result into the passed in object
for (FieldType fieldType : resultsFieldTypes) {
if (fieldType != idField) {
fieldType.assignField(connectionSource, data, fieldType.extractJavaFieldValue(result), false,
objectCache);
}
}
return 1;
} } | public class class_name {
public int executeRefresh(DatabaseConnection databaseConnection, T data, ObjectCache objectCache)
throws SQLException {
@SuppressWarnings("unchecked")
ID id = (ID) idField.extractJavaFieldValue(data);
// we don't care about the cache here
T result = super.execute(databaseConnection, id, null);
if (result == null) {
return 0;
}
// copy each field from the result into the passed in object
for (FieldType fieldType : resultsFieldTypes) {
if (fieldType != idField) {
fieldType.assignField(connectionSource, data, fieldType.extractJavaFieldValue(result), false,
objectCache); // depends on control dependency: [if], data = [none]
}
}
return 1;
} } |
public class class_name {
public void run() {
pollThread = Thread.currentThread();
if ( underway )
return;
underway = true;
try {
int count = 1;
while( count > 0 ) { // as long there are messages, keep sending them
count = onePoll();
if ( sendJobs.size() > 0 ) {
if ( count > 0 ) {
int debug =1;
}
else {
if ( remoteRefCounter == 0 ) // no remote actors registered
{
Actor.current().delayed(100, this); // backoff massively
} else {
Actor.current().delayed(1, this); // backoff a bit (remoteactors present, no messages)
}
}
} else {
// no schedule entries (== no clients)
Actor.current().delayed(100, this );
}
}
} finally {
underway = false;
}
} } | public class class_name {
public void run() {
pollThread = Thread.currentThread();
if ( underway )
return;
underway = true;
try {
int count = 1;
while( count > 0 ) { // as long there are messages, keep sending them
count = onePoll(); // depends on control dependency: [while], data = [none]
if ( sendJobs.size() > 0 ) {
if ( count > 0 ) {
int debug =1;
}
else {
if ( remoteRefCounter == 0 ) // no remote actors registered
{
Actor.current().delayed(100, this); // backoff massively // depends on control dependency: [if], data = [none]
} else {
Actor.current().delayed(1, this); // backoff a bit (remoteactors present, no messages) // depends on control dependency: [if], data = [none]
}
}
} else {
// no schedule entries (== no clients)
Actor.current().delayed(100, this ); // depends on control dependency: [if], data = [none]
}
}
} finally {
underway = false;
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.