code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private boolean mergeRequests(HttpRequestMessage from, HttpRequestMessage to) {
if (from == null || to == null) {
return false;
}
final URI initialRequestURI = from.getRequestURI();
final URI extendedRequestURI = to.getRequestURI();
boolean uriPathOk = initialRequestURI.getPath().equals(extendedRequestURI.getPath());
if ( !uriPathOk ) {
return false;
}
// Note: the fact that "Host" is an allowance was required by KG-3481.
final String[] allowances = {"Host", "Sec-WebSocket-Protocol", HEADER_SEC_WEBSOCKET_EXTENSIONS, "Connection"};
if ( HttpUtils.containsForbiddenHeaders(to, allowances) ) {
return false;
}
final String[] restrictions = {"Authorization", "X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol",
HEADER_X_WEBSOCKET_EXTENSIONS, HEADER_WEBSOCKET_EXTENSIONS, HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.restrictHeaders(to, restrictions);
final String[] ignoreHeaders = {HEADER_X_WEBSOCKET_EXTENSIONS,
HEADER_WEBSOCKET_EXTENSIONS,
HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.mergeHeaders(from, to, ignoreHeaders);
final String[] protocolHeaders = {"X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol"};
HttpUtils.removeValueFromHeaders(to, protocolHeaders, EXTENDED_HANDSHAKE_PROTOCOL_NAME);
HttpUtils.mergeParameters(from, to);
HttpUtils.mergeCookies(from, to);
return true;
} }
|
public class class_name {
private boolean mergeRequests(HttpRequestMessage from, HttpRequestMessage to) {
if (from == null || to == null) {
return false; // depends on control dependency: [if], data = [none]
}
final URI initialRequestURI = from.getRequestURI();
final URI extendedRequestURI = to.getRequestURI();
boolean uriPathOk = initialRequestURI.getPath().equals(extendedRequestURI.getPath());
if ( !uriPathOk ) {
return false; // depends on control dependency: [if], data = [none]
}
// Note: the fact that "Host" is an allowance was required by KG-3481.
final String[] allowances = {"Host", "Sec-WebSocket-Protocol", HEADER_SEC_WEBSOCKET_EXTENSIONS, "Connection"};
if ( HttpUtils.containsForbiddenHeaders(to, allowances) ) {
return false; // depends on control dependency: [if], data = [none]
}
final String[] restrictions = {"Authorization", "X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol",
HEADER_X_WEBSOCKET_EXTENSIONS, HEADER_WEBSOCKET_EXTENSIONS, HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.restrictHeaders(to, restrictions);
final String[] ignoreHeaders = {HEADER_X_WEBSOCKET_EXTENSIONS,
HEADER_WEBSOCKET_EXTENSIONS,
HEADER_SEC_WEBSOCKET_EXTENSIONS};
HttpUtils.mergeHeaders(from, to, ignoreHeaders);
final String[] protocolHeaders = {"X-WebSocket-Protocol", "WebSocket-Protocol", "Sec-WebSocket-Protocol"};
HttpUtils.removeValueFromHeaders(to, protocolHeaders, EXTENDED_HANDSHAKE_PROTOCOL_NAME);
HttpUtils.mergeParameters(from, to);
HttpUtils.mergeCookies(from, to);
return true;
} }
|
public class class_name {
public void marshall(DescribeProtectionRequest describeProtectionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeProtectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeProtectionRequest.getProtectionId(), PROTECTIONID_BINDING);
protocolMarshaller.marshall(describeProtectionRequest.getResourceArn(), RESOURCEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeProtectionRequest describeProtectionRequest, ProtocolMarshaller protocolMarshaller) {
if (describeProtectionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeProtectionRequest.getProtectionId(), PROTECTIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeProtectionRequest.getResourceArn(), RESOURCEARN_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 void inject(Injector.Configuration config) {
long millis = System.currentTimeMillis();
if(ProfileService.getInstance(config.getContext()).isActive(config.getContext(), Profile.INJECTION)) {
ExplicitInjectors.CONFIGURATION.inject(config);
ExplicitInjectors.LAYOUT.inject(config);
if(config.getInjectionMode().equals(InjectionMode.EXPLICIT)) {
InjectionUtils.injectExplicitly(config);
}
else {
InjectionUtils.injectImplicitly(config);
}
}
millis = System.currentTimeMillis() - millis;
Log.i("INSTRUMENTATION:IckleInjectionProfile#inject()",
InjectionUtils.class.getClass().getSimpleName() + ": " + millis + "ms");
} }
|
public class class_name {
public static void inject(Injector.Configuration config) {
long millis = System.currentTimeMillis();
if(ProfileService.getInstance(config.getContext()).isActive(config.getContext(), Profile.INJECTION)) {
ExplicitInjectors.CONFIGURATION.inject(config); // depends on control dependency: [if], data = [none]
ExplicitInjectors.LAYOUT.inject(config); // depends on control dependency: [if], data = [none]
if(config.getInjectionMode().equals(InjectionMode.EXPLICIT)) {
InjectionUtils.injectExplicitly(config); // depends on control dependency: [if], data = [none]
}
else {
InjectionUtils.injectImplicitly(config); // depends on control dependency: [if], data = [none]
}
}
millis = System.currentTimeMillis() - millis;
Log.i("INSTRUMENTATION:IckleInjectionProfile#inject()",
InjectionUtils.class.getClass().getSimpleName() + ": " + millis + "ms");
} }
|
public class class_name {
public static void initDefaultPool(int numThreads, boolean isDaemon) {
if (numThreads == 1) {
Threads.defaultPool = MoreExecutors.newDirectExecutorService();
Threads.numThreads = 1;
} else {
log.info("Initialized default thread pool to {} threads. (This must be closed by Threads.shutdownDefaultPool)", numThreads);
Threads.defaultPool = Executors.newFixedThreadPool(numThreads, new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(isDaemon);
return t;
}
});
Threads.numThreads = numThreads;
// Shutdown the thread pool on System.exit().
Runtime.getRuntime().addShutdownHook(new Thread(){
@Override
public void run() {
Threads.shutdownDefaultPool();
}
});
}
} }
|
public class class_name {
public static void initDefaultPool(int numThreads, boolean isDaemon) {
if (numThreads == 1) {
Threads.defaultPool = MoreExecutors.newDirectExecutorService(); // depends on control dependency: [if], data = [none]
Threads.numThreads = 1; // depends on control dependency: [if], data = [none]
} else {
log.info("Initialized default thread pool to {} threads. (This must be closed by Threads.shutdownDefaultPool)", numThreads); // depends on control dependency: [if], data = [none]
Threads.defaultPool = Executors.newFixedThreadPool(numThreads, new ThreadFactory() {
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(isDaemon);
return t;
}
}); // depends on control dependency: [if], data = [none]
Threads.numThreads = numThreads; // depends on control dependency: [if], data = [none]
// Shutdown the thread pool on System.exit().
Runtime.getRuntime().addShutdownHook(new Thread(){
@Override
public void run() {
Threads.shutdownDefaultPool();
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("null")
private IntegratorProtocol getIntegratorProtocol(ValueMap properties) {
IntegratorProtocol protocol = IntegratorProtocol.AUTO;
try {
String protocolString = properties.get(IntegratorNameConstants.PN_INTEGRATOR_PROTOCOL, String.class);
if (StringUtils.isNotEmpty(protocolString)) {
protocol = IntegratorProtocol.valueOf(protocolString.toUpperCase());
}
}
catch (IllegalArgumentException ex) {
// ignore
}
return protocol;
} }
|
public class class_name {
@SuppressWarnings("null")
private IntegratorProtocol getIntegratorProtocol(ValueMap properties) {
IntegratorProtocol protocol = IntegratorProtocol.AUTO;
try {
String protocolString = properties.get(IntegratorNameConstants.PN_INTEGRATOR_PROTOCOL, String.class);
if (StringUtils.isNotEmpty(protocolString)) {
protocol = IntegratorProtocol.valueOf(protocolString.toUpperCase()); // depends on control dependency: [if], data = [none]
}
}
catch (IllegalArgumentException ex) {
// ignore
} // depends on control dependency: [catch], data = [none]
return protocol;
} }
|
public class class_name {
public <K, V> Optional<KafkaProducer<K, V>> getProducer(
@NotNull final Serializer<K> keySerializer,
@NotNull final Serializer<V> valueSerializer) {
try {
return partialConfigs.map(
input -> new KafkaProducer<>(input, keySerializer, valueSerializer));
} catch (final Exception e) {
log.warn("error while generating KafkaProducer - {}", e);
return Optional.empty();
}
} }
|
public class class_name {
public <K, V> Optional<KafkaProducer<K, V>> getProducer(
@NotNull final Serializer<K> keySerializer,
@NotNull final Serializer<V> valueSerializer) {
try {
return partialConfigs.map(
input -> new KafkaProducer<>(input, keySerializer, valueSerializer)); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
log.warn("error while generating KafkaProducer - {}", e);
return Optional.empty();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
Result readValueSetSize(int type, Object id) {
final String methodName = "readValueSetSize()";
Result result = getFromResultPool();
ValueSet answer = new ValueSet(4);
HashtableOnDisk cache_instance = null;
HashtableOnDisk vshtod = null;
try {
rwLock.readLock().lock();
if (type == DEP_ID_DATA) {
cache_instance = dependency_cache;
} else {
cache_instance = template_cache;
}
Long vsinstid = (Long) cache_instance.get(id);
if (vsinstid != null) {
long vsinstance = vsinstid.longValue();
FileManager filemgr = cache_instance.getFileManager();
if (vsinstance != -1) {
vshtod = cache_instance.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this);
result.dataSize = vshtod.size();
vshtod.close();
vshtod = null;
} else {
result.dataSize = 0;
}
}
} catch (FileManagerException ex) {
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (HashtableOnDiskException ex) {
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (IOException ex) {
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (Exception ex) {
result.returnCode = OTHER_EXCEPTION;
result.diskException = ex;
} finally {
if (result.returnCode != NO_EXCEPTION) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName, "cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
}
if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.readValueSetSize", "1621", this);
}
try {
if (vshtod != null) {
vshtod.close();
}
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.HTODDynacache.readValueSetSize", "1628", this);
}
rwLock.readLock().unlock();
}
return result;
} }
|
public class class_name {
Result readValueSetSize(int type, Object id) {
final String methodName = "readValueSetSize()";
Result result = getFromResultPool();
ValueSet answer = new ValueSet(4);
HashtableOnDisk cache_instance = null;
HashtableOnDisk vshtod = null;
try {
rwLock.readLock().lock(); // depends on control dependency: [try], data = [none]
if (type == DEP_ID_DATA) {
cache_instance = dependency_cache; // depends on control dependency: [if], data = [none]
} else {
cache_instance = template_cache; // depends on control dependency: [if], data = [none]
}
Long vsinstid = (Long) cache_instance.get(id);
if (vsinstid != null) {
long vsinstance = vsinstid.longValue();
FileManager filemgr = cache_instance.getFileManager();
if (vsinstance != -1) {
vshtod = cache_instance.getInstance(filemgr, valueset_rehash, vsinstance, !HashtableOnDisk.HAS_CACHE_VALUE, this); // depends on control dependency: [if], data = [none]
result.dataSize = vshtod.size(); // depends on control dependency: [if], data = [none]
vshtod.close(); // depends on control dependency: [if], data = [none]
vshtod = null; // depends on control dependency: [if], data = [none]
} else {
result.dataSize = 0; // depends on control dependency: [if], data = [none]
}
}
} catch (FileManagerException ex) {
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (HashtableOnDiskException ex) { // depends on control dependency: [catch], data = [none]
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (IOException ex) { // depends on control dependency: [catch], data = [none]
this.diskCacheException = ex;
result.diskException = ex;
result.returnCode = DISK_EXCEPTION;
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
result.returnCode = OTHER_EXCEPTION;
result.diskException = ex;
} finally { // depends on control dependency: [catch], data = [none]
if (result.returnCode != NO_EXCEPTION) {
if (tc.isDebugEnabled())
Tr.debug(tc, methodName, "cacheName=" + this.cacheName + "\n Exception: " + ExceptionUtility.getStackTrace(result.diskException));
}
if (result.returnCode == DISK_EXCEPTION || result.returnCode == OTHER_EXCEPTION) {
com.ibm.ws.ffdc.FFDCFilter.processException(result.diskException, "com.ibm.ws.cache.HTODDynacache.readValueSetSize", "1621", this); // depends on control dependency: [if], data = [none]
}
try {
if (vshtod != null) {
vshtod.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
com.ibm.ws.ffdc.FFDCFilter.processException(ex, "com.ibm.ws.cache.HTODDynacache.readValueSetSize", "1628", this);
} // depends on control dependency: [catch], data = [none]
rwLock.readLock().unlock();
}
return result;
} }
|
public class class_name {
@JsOverlay
public final void initData(boolean useFactory, Set<String> fieldNames) {
JsPropertyMap<Object> dataFields = JsPropertyMap.of();
dataFieldsToProxy = new HashSet<>();
for (String fieldName : fieldNames) {
dataFields.set(fieldName, null);
// If field name starts with $ or _ Vue.js won't proxify it so we must do it
if (fieldName.startsWith("$") || fieldName.startsWith("_")) {
dataFieldsToProxy.add(fieldName);
}
}
if (useFactory) {
String dataFieldsJSON = JSON.stringify(dataFields);
this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON));
} else {
this.setData((DataFactory) () -> dataFields);
}
} }
|
public class class_name {
@JsOverlay
public final void initData(boolean useFactory, Set<String> fieldNames) {
JsPropertyMap<Object> dataFields = JsPropertyMap.of();
dataFieldsToProxy = new HashSet<>();
for (String fieldName : fieldNames) {
dataFields.set(fieldName, null); // depends on control dependency: [for], data = [fieldName]
// If field name starts with $ or _ Vue.js won't proxify it so we must do it
if (fieldName.startsWith("$") || fieldName.startsWith("_")) {
dataFieldsToProxy.add(fieldName); // depends on control dependency: [if], data = [none]
}
}
if (useFactory) {
String dataFieldsJSON = JSON.stringify(dataFields);
this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON)); // depends on control dependency: [if], data = [none]
} else {
this.setData((DataFactory) () -> dataFields); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(SearchRequest searchRequest, ProtocolMarshaller protocolMarshaller) {
if (searchRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(searchRequest.getResource(), RESOURCE_BINDING);
protocolMarshaller.marshall(searchRequest.getSearchExpression(), SEARCHEXPRESSION_BINDING);
protocolMarshaller.marshall(searchRequest.getSortBy(), SORTBY_BINDING);
protocolMarshaller.marshall(searchRequest.getSortOrder(), SORTORDER_BINDING);
protocolMarshaller.marshall(searchRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(searchRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SearchRequest searchRequest, ProtocolMarshaller protocolMarshaller) {
if (searchRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(searchRequest.getResource(), RESOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(searchRequest.getSearchExpression(), SEARCHEXPRESSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(searchRequest.getSortBy(), SORTBY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(searchRequest.getSortOrder(), SORTORDER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(searchRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(searchRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String fetch(String code) {
String url = WxEndpoint.get("url.template.get");
String json = String.format("{\"template_id_short\":\"%s\"}", code);
logger.debug("template message, get template id: {}", json);
String response = wxClient.post(url, json);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if(result.containsKey("template_id")) {
return result.get("template_id").toString();
} else {
throw new WxRuntimeException(999, "fetch template id failed.");
}
} }
|
public class class_name {
public String fetch(String code) {
String url = WxEndpoint.get("url.template.get");
String json = String.format("{\"template_id_short\":\"%s\"}", code);
logger.debug("template message, get template id: {}", json);
String response = wxClient.post(url, json);
Map<String, Object> result = JsonMapper.defaultMapper().json2Map(response);
if(result.containsKey("template_id")) {
return result.get("template_id").toString();
// depends on control dependency: [if], data = [none]
} else {
throw new WxRuntimeException(999, "fetch template id failed.");
}
} }
|
public class class_name {
public final boolean setScheduledForFlush(boolean flag) {
if (flag) {
// If the current tag is set to false, switch it to true
return scheduledForFlush.compareAndSet(false, true);
}
scheduledForFlush.set(false);
return true;
} }
|
public class class_name {
public final boolean setScheduledForFlush(boolean flag) {
if (flag) {
// If the current tag is set to false, switch it to true
return scheduledForFlush.compareAndSet(false, true); // depends on control dependency: [if], data = [none]
}
scheduledForFlush.set(false);
return true;
} }
|
public class class_name {
private String keyOf(Object obj) {
Object innerObj = obj;
if (obj instanceof Deque) {
Deque<MutablePair<DeltaType, Object>> deltas = (Deque<MutablePair<DeltaType, Object>>) obj;
if (deltas.size() == 0) {
throw new NoSuchElementException("0 length Deltas object; can't get key");
}
innerObj = deltas.peekLast().getRight();
}
if (innerObj instanceof DeletedFinalStateUnknown) {
return ((DeletedFinalStateUnknown) innerObj).key;
}
return keyFunc.apply((ApiType) innerObj);
} }
|
public class class_name {
private String keyOf(Object obj) {
Object innerObj = obj;
if (obj instanceof Deque) {
Deque<MutablePair<DeltaType, Object>> deltas = (Deque<MutablePair<DeltaType, Object>>) obj;
if (deltas.size() == 0) {
throw new NoSuchElementException("0 length Deltas object; can't get key");
}
innerObj = deltas.peekLast().getRight(); // depends on control dependency: [if], data = [none]
}
if (innerObj instanceof DeletedFinalStateUnknown) {
return ((DeletedFinalStateUnknown) innerObj).key; // depends on control dependency: [if], data = [none]
}
return keyFunc.apply((ApiType) innerObj);
} }
|
public class class_name {
@Override
public NamingLookupResponse decode(final byte[] buf) {
final AvroNamingLookupResponse avroResponse = AvroUtils.fromBytes(buf, AvroNamingLookupResponse.class);
final List<NameAssignment> nas = new ArrayList<>(avroResponse.getTuples().size());
for (final AvroNamingAssignment tuple : avroResponse.getTuples()) {
nas.add(
new NameAssignmentTuple(
factory.getNewInstance(tuple.getId().toString()),
new InetSocketAddress(tuple.getHost().toString(), tuple.getPort())
)
);
}
return new NamingLookupResponse(nas);
} }
|
public class class_name {
@Override
public NamingLookupResponse decode(final byte[] buf) {
final AvroNamingLookupResponse avroResponse = AvroUtils.fromBytes(buf, AvroNamingLookupResponse.class);
final List<NameAssignment> nas = new ArrayList<>(avroResponse.getTuples().size());
for (final AvroNamingAssignment tuple : avroResponse.getTuples()) {
nas.add(
new NameAssignmentTuple(
factory.getNewInstance(tuple.getId().toString()),
new InetSocketAddress(tuple.getHost().toString(), tuple.getPort())
)
); // depends on control dependency: [for], data = [none]
}
return new NamingLookupResponse(nas);
} }
|
public class class_name {
List getAssociatedEntitiesFromIndex(Class owningClazz, Object entityId, Class<?> childClass, Client childClient)
{
List associatedEntities;
IndexManager indexManager = childClient.getIndexManager();
Map<String, Object> results = indexManager != null ? indexManager.search(owningClazz, childClass, entityId)
: new HashMap<String, Object>();
Set rsSet = results != null ? new HashSet(results.values()) : new HashSet();
if (childClass.equals(owningClazz))
{
associatedEntities = (List<Object>) childClient.findAll(childClass, null, rsSet.toArray(new Object[] {}));
}
else
{
associatedEntities = (List<Object>) childClient.findAll(childClass, null, rsSet.toArray(new Object[] {}));
}
return associatedEntities;
} }
|
public class class_name {
List getAssociatedEntitiesFromIndex(Class owningClazz, Object entityId, Class<?> childClass, Client childClient)
{
List associatedEntities;
IndexManager indexManager = childClient.getIndexManager();
Map<String, Object> results = indexManager != null ? indexManager.search(owningClazz, childClass, entityId)
: new HashMap<String, Object>();
Set rsSet = results != null ? new HashSet(results.values()) : new HashSet();
if (childClass.equals(owningClazz))
{
associatedEntities = (List<Object>) childClient.findAll(childClass, null, rsSet.toArray(new Object[] {})); // depends on control dependency: [if], data = [none]
}
else
{
associatedEntities = (List<Object>) childClient.findAll(childClass, null, rsSet.toArray(new Object[] {})); // depends on control dependency: [if], data = [none]
}
return associatedEntities;
} }
|
public class class_name {
private void addPostParams(final Request request) {
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName);
}
if (syncServiceSid != null) {
request.addPostParam("SyncServiceSid", syncServiceSid);
}
} }
|
public class class_name {
private void addPostParams(final Request request) {
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none]
}
if (syncServiceSid != null) {
request.addPostParam("SyncServiceSid", syncServiceSid); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void dispose() {
for (int layer = 0; layer < 4; layer++) {
Graphics2D graphics = layeredGraphics[layer];
if (graphics != null) {
graphics.dispose();
layeredGraphics[layer] = null;
}
BufferedImage image = layeredImage[layer];
if (image != null) {
image.flush();
layeredImage[layer] = null;
}
}
} }
|
public class class_name {
public void dispose() {
for (int layer = 0; layer < 4; layer++) {
Graphics2D graphics = layeredGraphics[layer];
if (graphics != null) {
graphics.dispose(); // depends on control dependency: [if], data = [none]
layeredGraphics[layer] = null; // depends on control dependency: [if], data = [none]
}
BufferedImage image = layeredImage[layer];
if (image != null) {
image.flush(); // depends on control dependency: [if], data = [none]
layeredImage[layer] = null; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static String[] toCodePoints(String str) {
int len = str.codePointCount(0, str.length());
String[] codePoints = new String[len];
for (int i = 0, offset = 0; i < len; i++) {
int code = str.codePointAt(offset);
int codeLen = Character.charCount(code);
codePoints[i] = str.substring(offset, offset + codeLen);
offset += codeLen;
}
return codePoints;
} }
|
public class class_name {
private static String[] toCodePoints(String str) {
int len = str.codePointCount(0, str.length());
String[] codePoints = new String[len];
for (int i = 0, offset = 0; i < len; i++) {
int code = str.codePointAt(offset);
int codeLen = Character.charCount(code);
codePoints[i] = str.substring(offset, offset + codeLen); // depends on control dependency: [for], data = [i]
offset += codeLen; // depends on control dependency: [for], data = [none]
}
return codePoints;
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request);
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later);
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState);
}
} }
|
public class class_name {
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return; // depends on control dependency: [if], data = [none]
}
if (isMenuPresent(request)) {
// If current ajax trigger, process menu for current selections
if (AjaxHelper.isCurrentAjaxTrigger(this)) {
WMenu menu = WebUtilities.getAncestorOfClass(WMenu.class, this);
menu.handleRequest(request); // depends on control dependency: [if], data = [none]
// Execute associated action, if set
final Action action = getAction();
if (action != null) {
final ActionEvent event = new ActionEvent(this, this.getActionCommand(),
this.getActionObject());
Runnable later = new Runnable() {
@Override
public void run() {
action.execute(event);
}
};
invokeLater(later); // depends on control dependency: [if], data = [none]
}
}
boolean openState = "true".equals(request.getParameter(getId() + ".open"));
setOpen(openState); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean isToken(String value) {
int len = value.length();
for (int i = 0; i < len; i++) {
char c = value.charAt(i);
if (c < 0x20 || c >= 0x7f || TSPECIALS.indexOf(c) != -1) {
return false;
}
}
return true;
} }
|
public class class_name {
private boolean isToken(String value) {
int len = value.length();
for (int i = 0; i < len; i++) {
char c = value.charAt(i);
if (c < 0x20 || c >= 0x7f || TSPECIALS.indexOf(c) != -1) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
@Override
public StringBuilder getFilterClause() {
StringBuilder builder = new StringBuilder();
builder.append(columnName);
builder.append(" LIKE ");
builder.append(':').append(name);
if (condition != null) {
builder.append(" AND ");
builder.append(condition);
}
return builder;
} }
|
public class class_name {
@Override
public StringBuilder getFilterClause() {
StringBuilder builder = new StringBuilder();
builder.append(columnName);
builder.append(" LIKE ");
builder.append(':').append(name);
if (condition != null) {
builder.append(" AND "); // depends on control dependency: [if], data = [none]
builder.append(condition); // depends on control dependency: [if], data = [(condition]
}
return builder;
} }
|
public class class_name {
protected boolean isExecuteMerge()
{
long elapsedTimeMs = getCurrentTime() - this.previousMergeTime;
if (elapsedTimeMs >= TimeUnit.SECONDS.toMillis(this.mergeInterval))
{
return true;
}
return false;
} }
|
public class class_name {
protected boolean isExecuteMerge()
{
long elapsedTimeMs = getCurrentTime() - this.previousMergeTime;
if (elapsedTimeMs >= TimeUnit.SECONDS.toMillis(this.mergeInterval))
{
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
long parseMemoryLine(final String line) {
final int idx1 = line.indexOf(":");
final int idx2 = line.lastIndexOf("kB");
final String sizeString = line.substring(idx1 + 1, idx2 - 1).trim();
try {
return Long.parseLong(sizeString);
} catch (final NumberFormatException e) {
final String err = "Failed to parse the meminfo file. Line: " + line;
logger.error(err);
return 0;
}
} }
|
public class class_name {
long parseMemoryLine(final String line) {
final int idx1 = line.indexOf(":");
final int idx2 = line.lastIndexOf("kB");
final String sizeString = line.substring(idx1 + 1, idx2 - 1).trim();
try {
return Long.parseLong(sizeString); // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException e) {
final String err = "Failed to parse the meminfo file. Line: " + line;
logger.error(err);
return 0;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final AntlrDatatypeRuleToken ruleOpCompare() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
enterRule();
try {
// InternalPureXbase.g:1498:2: ( (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' ) )
// InternalPureXbase.g:1499:2: (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' )
{
// InternalPureXbase.g:1499:2: (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' )
int alt27=4;
switch ( input.LA(1) ) {
case 30:
{
alt27=1;
}
break;
case 28:
{
int LA27_2 = input.LA(2);
if ( (LA27_2==EOF||(LA27_2>=RULE_STRING && LA27_2<=RULE_ID)||(LA27_2>=14 && LA27_2<=15)||LA27_2==28||(LA27_2>=44 && LA27_2<=45)||LA27_2==50||(LA27_2>=58 && LA27_2<=59)||LA27_2==61||LA27_2==64||LA27_2==66||(LA27_2>=69 && LA27_2<=80)) ) {
alt27=4;
}
else if ( (LA27_2==20) ) {
alt27=2;
}
else {
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 27, 2, input);
throw nvae;
}
}
break;
case 29:
{
alt27=3;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return current;}
NoViableAltException nvae =
new NoViableAltException("", 27, 0, input);
throw nvae;
}
switch (alt27) {
case 1 :
// InternalPureXbase.g:1500:3: kw= '>='
{
kw=(Token)match(input,30,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpCompareAccess().getGreaterThanSignEqualsSignKeyword_0());
}
}
break;
case 2 :
// InternalPureXbase.g:1506:3: (kw= '<' kw= '=' )
{
// InternalPureXbase.g:1506:3: (kw= '<' kw= '=' )
// InternalPureXbase.g:1507:4: kw= '<' kw= '='
{
kw=(Token)match(input,28,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpCompareAccess().getLessThanSignKeyword_1_0());
}
kw=(Token)match(input,20,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpCompareAccess().getEqualsSignKeyword_1_1());
}
}
}
break;
case 3 :
// InternalPureXbase.g:1519:3: kw= '>'
{
kw=(Token)match(input,29,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpCompareAccess().getGreaterThanSignKeyword_2());
}
}
break;
case 4 :
// InternalPureXbase.g:1525:3: kw= '<'
{
kw=(Token)match(input,28,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw);
newLeafNode(kw, grammarAccess.getOpCompareAccess().getLessThanSignKeyword_3());
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final AntlrDatatypeRuleToken ruleOpCompare() throws RecognitionException {
AntlrDatatypeRuleToken current = new AntlrDatatypeRuleToken();
Token kw=null;
enterRule();
try {
// InternalPureXbase.g:1498:2: ( (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' ) )
// InternalPureXbase.g:1499:2: (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' )
{
// InternalPureXbase.g:1499:2: (kw= '>=' | (kw= '<' kw= '=' ) | kw= '>' | kw= '<' )
int alt27=4;
switch ( input.LA(1) ) {
case 30:
{
alt27=1;
}
break;
case 28:
{
int LA27_2 = input.LA(2);
if ( (LA27_2==EOF||(LA27_2>=RULE_STRING && LA27_2<=RULE_ID)||(LA27_2>=14 && LA27_2<=15)||LA27_2==28||(LA27_2>=44 && LA27_2<=45)||LA27_2==50||(LA27_2>=58 && LA27_2<=59)||LA27_2==61||LA27_2==64||LA27_2==66||(LA27_2>=69 && LA27_2<=80)) ) {
alt27=4; // depends on control dependency: [if], data = [none]
}
else if ( (LA27_2==20) ) {
alt27=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 27, 2, input);
throw nvae;
}
}
break;
case 29:
{
alt27=3;
}
break;
default:
if (state.backtracking>0) {state.failed=true; return current;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 27, 0, input);
throw nvae;
}
switch (alt27) {
case 1 :
// InternalPureXbase.g:1500:3: kw= '>='
{
kw=(Token)match(input,30,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpCompareAccess().getGreaterThanSignEqualsSignKeyword_0()); // depends on control dependency: [if], data = [none]
}
}
break;
case 2 :
// InternalPureXbase.g:1506:3: (kw= '<' kw= '=' )
{
// InternalPureXbase.g:1506:3: (kw= '<' kw= '=' )
// InternalPureXbase.g:1507:4: kw= '<' kw= '='
{
kw=(Token)match(input,28,FOLLOW_13); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpCompareAccess().getLessThanSignKeyword_1_0()); // depends on control dependency: [if], data = [none]
}
kw=(Token)match(input,20,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpCompareAccess().getEqualsSignKeyword_1_1()); // depends on control dependency: [if], data = [none]
}
}
}
break;
case 3 :
// InternalPureXbase.g:1519:3: kw= '>'
{
kw=(Token)match(input,29,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpCompareAccess().getGreaterThanSignKeyword_2()); // depends on control dependency: [if], data = [none]
}
}
break;
case 4 :
// InternalPureXbase.g:1525:3: kw= '<'
{
kw=(Token)match(input,28,FOLLOW_2); if (state.failed) return current;
if ( state.backtracking==0 ) {
current.merge(kw); // depends on control dependency: [if], data = [none]
newLeafNode(kw, grammarAccess.getOpCompareAccess().getLessThanSignKeyword_3()); // depends on control dependency: [if], data = [none]
}
}
break;
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private void addManagedPlugins(BaseProfileDescriptor pomDescriptor, BuildBase build, ScannerContext scannerContext) {
if (null == build) {
return;
}
PluginManagement pluginManagement = build.getPluginManagement();
if (null == pluginManagement) {
return;
}
List<MavenPluginDescriptor> pluginDescriptors = createMavenPluginDescriptors(pluginManagement.getPlugins(), scannerContext);
pomDescriptor.getManagedPlugins().addAll(pluginDescriptors);
} }
|
public class class_name {
private void addManagedPlugins(BaseProfileDescriptor pomDescriptor, BuildBase build, ScannerContext scannerContext) {
if (null == build) {
return; // depends on control dependency: [if], data = [none]
}
PluginManagement pluginManagement = build.getPluginManagement();
if (null == pluginManagement) {
return; // depends on control dependency: [if], data = [none]
}
List<MavenPluginDescriptor> pluginDescriptors = createMavenPluginDescriptors(pluginManagement.getPlugins(), scannerContext);
pomDescriptor.getManagedPlugins().addAll(pluginDescriptors);
} }
|
public class class_name {
protected void hidePopup() {
if (CmsDateConverter.validateTime(getTimeText())) {
// before hiding the date picker remove the date box popup from the auto hide partners of the parent popup
if (m_autoHideParent != null) {
m_autoHideParent.removeAutoHidePartner(getElement());
}
m_popup.hide();
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler();
}
m_previewHandlerRegistration = null;
}
} }
|
public class class_name {
protected void hidePopup() {
if (CmsDateConverter.validateTime(getTimeText())) {
// before hiding the date picker remove the date box popup from the auto hide partners of the parent popup
if (m_autoHideParent != null) {
m_autoHideParent.removeAutoHidePartner(getElement()); // depends on control dependency: [if], data = [none]
}
m_popup.hide(); // depends on control dependency: [if], data = [none]
if (m_previewHandlerRegistration != null) {
m_previewHandlerRegistration.removeHandler(); // depends on control dependency: [if], data = [none]
}
m_previewHandlerRegistration = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean offer(ObjectContainer<T> item)
{
final long itemLength = item.getSize();
if (currentMemory.addAndGet(itemLength) <= memoryBound) {
if (queue.offer(item)) {
return true;
}
}
currentMemory.addAndGet(-itemLength);
return false;
} }
|
public class class_name {
public boolean offer(ObjectContainer<T> item)
{
final long itemLength = item.getSize();
if (currentMemory.addAndGet(itemLength) <= memoryBound) {
if (queue.offer(item)) {
return true; // depends on control dependency: [if], data = [none]
}
}
currentMemory.addAndGet(-itemLength);
return false;
} }
|
public class class_name {
public java.util.List<AutoScalingGroup> getAutoScalingGroups() {
if (autoScalingGroups == null) {
autoScalingGroups = new com.amazonaws.internal.SdkInternalList<AutoScalingGroup>();
}
return autoScalingGroups;
} }
|
public class class_name {
public java.util.List<AutoScalingGroup> getAutoScalingGroups() {
if (autoScalingGroups == null) {
autoScalingGroups = new com.amazonaws.internal.SdkInternalList<AutoScalingGroup>(); // depends on control dependency: [if], data = [none]
}
return autoScalingGroups;
} }
|
public class class_name {
public static String[] subtraction(String[] arr1, String[] arr2) {
if (arr1 == null || arr1.length == 0 || arr2 == null || arr2.length == 0) {
return arr1;
}
List<String> list = new ArrayList<String>(Arrays.asList(arr1));
list.removeAll(Arrays.asList(arr2));
return list.toArray(new String[0]);
} }
|
public class class_name {
public static String[] subtraction(String[] arr1, String[] arr2) {
if (arr1 == null || arr1.length == 0 || arr2 == null || arr2.length == 0) {
return arr1; // depends on control dependency: [if], data = [none]
}
List<String> list = new ArrayList<String>(Arrays.asList(arr1));
list.removeAll(Arrays.asList(arr2));
return list.toArray(new String[0]);
} }
|
public class class_name {
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) {
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId)) {
evse.setStatus(status);
}
}
} }
|
public class class_name {
private void updateEvseStatus(ChargingStation chargingStation, String componentId, ComponentStatus status) {
for (Evse evse : chargingStation.getEvses()) {
if (evse.getEvseId().equals(componentId)) {
evse.setStatus(status); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@EventHandler
public void handle(ChargingStationOpeningTimesSetEvent event) {
LOG.info("ChargingStationOpeningTimesSetEvent");
ChargingStation chargingStation = getChargingStation(event.getChargingStationId());
if (chargingStation != null) {
chargingStation.setOpeningTimes(convertFromApiOpeningTimes(event.getOpeningTimes()));
chargingStationRepository.createOrUpdate(chargingStation);
}
} }
|
public class class_name {
@EventHandler
public void handle(ChargingStationOpeningTimesSetEvent event) {
LOG.info("ChargingStationOpeningTimesSetEvent");
ChargingStation chargingStation = getChargingStation(event.getChargingStationId());
if (chargingStation != null) {
chargingStation.setOpeningTimes(convertFromApiOpeningTimes(event.getOpeningTimes())); // depends on control dependency: [if], data = [none]
chargingStationRepository.createOrUpdate(chargingStation); // depends on control dependency: [if], data = [(chargingStation]
}
} }
|
public class class_name {
public void marshall(RemoveFacetFromObjectRequest removeFacetFromObjectRequest, ProtocolMarshaller protocolMarshaller) {
if (removeFacetFromObjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removeFacetFromObjectRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(removeFacetFromObjectRequest.getSchemaFacet(), SCHEMAFACET_BINDING);
protocolMarshaller.marshall(removeFacetFromObjectRequest.getObjectReference(), OBJECTREFERENCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(RemoveFacetFromObjectRequest removeFacetFromObjectRequest, ProtocolMarshaller protocolMarshaller) {
if (removeFacetFromObjectRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removeFacetFromObjectRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removeFacetFromObjectRequest.getSchemaFacet(), SCHEMAFACET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removeFacetFromObjectRequest.getObjectReference(), OBJECTREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final Flux<T> subscribeOn(Scheduler scheduler, boolean requestOnSeparateThread) {
if (this instanceof Callable) {
if (this instanceof Fuseable.ScalarCallable) {
try {
@SuppressWarnings("unchecked") T value = ((Fuseable.ScalarCallable<T>) this).call();
return onAssembly(new FluxSubscribeOnValue<>(value, scheduler));
}
catch (Exception e) {
//leave FluxSubscribeOnCallable defer error
}
}
@SuppressWarnings("unchecked")
Callable<T> c = (Callable<T>)this;
return onAssembly(new FluxSubscribeOnCallable<>(c, scheduler));
}
return onAssembly(new FluxSubscribeOn<>(this, scheduler, requestOnSeparateThread));
} }
|
public class class_name {
public final Flux<T> subscribeOn(Scheduler scheduler, boolean requestOnSeparateThread) {
if (this instanceof Callable) {
if (this instanceof Fuseable.ScalarCallable) {
try {
@SuppressWarnings("unchecked") T value = ((Fuseable.ScalarCallable<T>) this).call();
return onAssembly(new FluxSubscribeOnValue<>(value, scheduler)); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
//leave FluxSubscribeOnCallable defer error
} // depends on control dependency: [catch], data = [none]
}
@SuppressWarnings("unchecked")
Callable<T> c = (Callable<T>)this;
return onAssembly(new FluxSubscribeOnCallable<>(c, scheduler)); // depends on control dependency: [if], data = [none]
}
return onAssembly(new FluxSubscribeOn<>(this, scheduler, requestOnSeparateThread));
} }
|
public class class_name {
private static String encode(String pathElement) {
try {
return URLEncoder.encode(pathElement, Charsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw Throwables.propagate(e); // Should never happen
}
} }
|
public class class_name {
private static String encode(String pathElement) {
try {
return URLEncoder.encode(pathElement, Charsets.UTF_8.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw Throwables.propagate(e); // Should never happen
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected boolean authenticate(ContainerRequestContext requestContext, @Nullable C credentials, String scheme) {
try {
if (credentials == null) {
return false;
}
final Optional<P> principal = authenticator.authenticate(credentials);
if (!principal.isPresent()) {
return false;
}
final P prince = principal.get();
final SecurityContext securityContext = requestContext.getSecurityContext();
final boolean secure = securityContext != null && securityContext.isSecure();
requestContext.setSecurityContext(new SecurityContext() {
@Override
public Principal getUserPrincipal() {
return prince;
}
@Override
public boolean isUserInRole(String role) {
return authorizer.authorize(prince, role);
}
@Override
public boolean isSecure() {
return secure;
}
@Override
public String getAuthenticationScheme() {
return scheme;
}
});
return true;
} catch (AuthenticationException e) {
logger.warn("Error authenticating credentials", e);
throw new InternalServerErrorException();
}
} }
|
public class class_name {
protected boolean authenticate(ContainerRequestContext requestContext, @Nullable C credentials, String scheme) {
try {
if (credentials == null) {
return false; // depends on control dependency: [if], data = [none]
}
final Optional<P> principal = authenticator.authenticate(credentials);
if (!principal.isPresent()) {
return false; // depends on control dependency: [if], data = [none]
}
final P prince = principal.get();
final SecurityContext securityContext = requestContext.getSecurityContext();
final boolean secure = securityContext != null && securityContext.isSecure();
requestContext.setSecurityContext(new SecurityContext() {
@Override
public Principal getUserPrincipal() {
return prince;
}
@Override
public boolean isUserInRole(String role) {
return authorizer.authorize(prince, role);
}
@Override
public boolean isSecure() {
return secure;
}
@Override
public String getAuthenticationScheme() {
return scheme;
}
}); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (AuthenticationException e) {
logger.warn("Error authenticating credentials", e);
throw new InternalServerErrorException();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean containsCycle(int[] parents) {
for (int i=0; i<parents.length; i++) {
int numAncestors = 0;
int parent = parents[i];
while(parent != ParentsArray.WALL_POSITION) {
numAncestors += 1;
if (numAncestors > parents.length - 1) {
return true;
}
parent = parents[parent];
}
}
return false;
} }
|
public class class_name {
public static boolean containsCycle(int[] parents) {
for (int i=0; i<parents.length; i++) {
int numAncestors = 0;
int parent = parents[i];
while(parent != ParentsArray.WALL_POSITION) {
numAncestors += 1; // depends on control dependency: [while], data = [none]
if (numAncestors > parents.length - 1) {
return true; // depends on control dependency: [if], data = [none]
}
parent = parents[parent]; // depends on control dependency: [while], data = [none]
}
}
return false;
} }
|
public class class_name {
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) {
final One<Boolean> valid = new One<>();
if (!StringUtils.hasText(jql))
return result;
valid.value0 = false;
analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() {
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
String parameter;
if (ctx.bind_parameter_name() != null) {
parameter = ctx.bind_parameter_name().getText();
} else {
parameter = ctx.getText();
}
result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter));
}
@Override
public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText()));
}
});
return result;
} }
|
public class class_name {
private <L extends Collection<JQLPlaceHolder>> L extractPlaceHoldersFromVariableStatement(final JQLContext jqlContext, String jql, final L result) {
final One<Boolean> valid = new One<>();
if (!StringUtils.hasText(jql))
return result;
valid.value0 = false;
analyzeVariableStatementInternal(jqlContext, jql, new JqlBaseListener() {
@Override
public void enterBind_parameter(Bind_parameterContext ctx) {
String parameter;
if (ctx.bind_parameter_name() != null) {
parameter = ctx.bind_parameter_name().getText(); // depends on control dependency: [if], data = [none]
} else {
parameter = ctx.getText(); // depends on control dependency: [if], data = [none]
}
result.add(new JQLPlaceHolder(JQLPlaceHolderType.PARAMETER, parameter));
}
@Override
public void enterBind_dynamic_sql(Bind_dynamic_sqlContext ctx) {
result.add(new JQLPlaceHolder(JQLPlaceHolderType.DYNAMIC_SQL, ctx.bind_parameter_name().getText()));
}
});
return result;
} }
|
public class class_name {
private void addRelevantBaseTypes(ClassDescriptorDef curType, ArrayList baseTypes)
{
ClassDescriptorDef baseDef;
for (Iterator it = curType.getDirectBaseTypes(); it.hasNext();)
{
baseDef = (ClassDescriptorDef)it.next();
if (!baseDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true))
{
// the base type has include-inherited set to false which means that
// it does not include base features
// since we do want these base features, we have to traverse its base types
addRelevantBaseTypes(baseDef, baseTypes);
}
baseTypes.add(baseDef);
}
} }
|
public class class_name {
private void addRelevantBaseTypes(ClassDescriptorDef curType, ArrayList baseTypes)
{
ClassDescriptorDef baseDef;
for (Iterator it = curType.getDirectBaseTypes(); it.hasNext();)
{
baseDef = (ClassDescriptorDef)it.next();
// depends on control dependency: [for], data = [it]
if (!baseDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true))
{
// the base type has include-inherited set to false which means that
// it does not include base features
// since we do want these base features, we have to traverse its base types
addRelevantBaseTypes(baseDef, baseTypes);
// depends on control dependency: [if], data = [none]
}
baseTypes.add(baseDef);
// depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public String getMessage()
{
String lastMessage = super.getMessage();
Throwable exception = m_exception;
while (null != exception)
{
String nextMessage = exception.getMessage();
if (null != nextMessage)
lastMessage = nextMessage;
if (exception instanceof TransformerException)
{
TransformerException se = (TransformerException) exception;
Throwable prev = exception;
exception = se.getException();
if (prev == exception)
break;
}
else
{
exception = null;
}
}
return (null != lastMessage) ? lastMessage : "";
} }
|
public class class_name {
public String getMessage()
{
String lastMessage = super.getMessage();
Throwable exception = m_exception;
while (null != exception)
{
String nextMessage = exception.getMessage();
if (null != nextMessage)
lastMessage = nextMessage;
if (exception instanceof TransformerException)
{
TransformerException se = (TransformerException) exception;
Throwable prev = exception;
exception = se.getException(); // depends on control dependency: [if], data = [none]
if (prev == exception)
break;
}
else
{
exception = null; // depends on control dependency: [if], data = [none]
}
}
return (null != lastMessage) ? lastMessage : "";
} }
|
public class class_name {
public List executeQuery(String jsonClause, EntityMetadata entityMetadata)
{
List entities = new ArrayList();
try
{
DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName());
while (cursor.hasNext())
{
DBObject fetchedDocument = cursor.next();
populateEntity(entityMetadata, entities, fetchedDocument);
}
return entities;
}
catch (JSONParseException jex)
{
entities = executeNativeQuery(jsonClause, entityMetadata);
List result = new ArrayList();
if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity))
{
for (Object obj : entities)
{
result.add(((EnhanceEntity) obj).getEntity());
}
return result;
}
return entities;
}
} }
|
public class class_name {
public List executeQuery(String jsonClause, EntityMetadata entityMetadata)
{
List entities = new ArrayList();
try
{
DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName());
while (cursor.hasNext())
{
DBObject fetchedDocument = cursor.next();
populateEntity(entityMetadata, entities, fetchedDocument); // depends on control dependency: [while], data = [none]
}
return entities; // depends on control dependency: [try], data = [none]
}
catch (JSONParseException jex)
{
entities = executeNativeQuery(jsonClause, entityMetadata);
List result = new ArrayList();
if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity))
{
for (Object obj : entities)
{
result.add(((EnhanceEntity) obj).getEntity()); // depends on control dependency: [for], data = [obj]
}
return result; // depends on control dependency: [if], data = [none]
}
return entities;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final void setValue(final String aValue) {
final StringTokenizer t = new StringTokenizer(aValue, ";");
if (t.hasMoreTokens()) {
statusCode = t.nextToken();
}
if (t.hasMoreTokens()) {
description = t.nextToken();
}
if (t.hasMoreTokens()) {
exData = t.nextToken();
}
} }
|
public class class_name {
public final void setValue(final String aValue) {
final StringTokenizer t = new StringTokenizer(aValue, ";");
if (t.hasMoreTokens()) {
statusCode = t.nextToken(); // depends on control dependency: [if], data = [none]
}
if (t.hasMoreTokens()) {
description = t.nextToken(); // depends on control dependency: [if], data = [none]
}
if (t.hasMoreTokens()) {
exData = t.nextToken(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean matches(LinkedList<Node> nodePath) {
if(simplePattern) {
// simple pattern
return items.get(0).matches(nodePath.getLast());
}
// match the full pattern
if(items.size() != nodePath.size()) {
// different size
return false;
}
for(int i=0; i<items.size(); i++) {
if (! items.get(i).matches(nodePath.get(i))) {
// failed a comparison
return false;
}
}
// pass all comparisons
return true;
} }
|
public class class_name {
public boolean matches(LinkedList<Node> nodePath) {
if(simplePattern) {
// simple pattern
return items.get(0).matches(nodePath.getLast()); // depends on control dependency: [if], data = [none]
}
// match the full pattern
if(items.size() != nodePath.size()) {
// different size
return false; // depends on control dependency: [if], data = [none]
}
for(int i=0; i<items.size(); i++) {
if (! items.get(i).matches(nodePath.get(i))) {
// failed a comparison
return false; // depends on control dependency: [if], data = [none]
}
}
// pass all comparisons
return true;
} }
|
public class class_name {
@VisibleForTesting
public static List<FlowEdge> dijkstraBasedPathFindingHelper(ServiceNode sourceNode, ServiceNode targetNode,
DirectedWeightedMultigraph<ServiceNode, FlowEdge> weightedGraph) {
Map<DistancedNode, ArrayList<FlowEdge>> shortestPath = new HashMap<>();
Map<DistancedNode, Double> shortestDist = new HashMap<>();
PriorityQueue<DistancedNode> pq = new PriorityQueue<>(new Comparator<DistancedNode>() {
@Override
public int compare(DistancedNode o1, DistancedNode o2) {
if (o1.getDistToSrc() < o2.getDistToSrc()) {
return -1;
} else {
return 1;
}
}
});
pq.add(new DistancedNode(sourceNode, 0.0));
Set<FlowEdge> visitedEdge = new HashSet<>();
while(!pq.isEmpty()) {
DistancedNode node = pq.poll();
if (node.getNode().getNodeName().equals(targetNode.getNodeName())) {
// Searching finished
return shortestPath.get(node);
}
Set<FlowEdge> outgoingEdges = weightedGraph.outgoingEdgesOf(node.getNode());
for (FlowEdge outGoingEdge:outgoingEdges) {
// Since it is a multi-graph problem, should use edge for deduplicaiton instead of vertex.
if (visitedEdge.contains(outGoingEdge)) {
continue;
}
DistancedNode adjacentNode = new DistancedNode(weightedGraph.getEdgeTarget(outGoingEdge));
if (shortestDist.containsKey(adjacentNode)) {
adjacentNode.setDistToSrc(shortestDist.get(adjacentNode));
}
double newDist = node.getDistToSrc() + ((LoadBasedFlowEdgeImpl) outGoingEdge).getEdgeLoad();
if (newDist < adjacentNode.getDistToSrc()) {
if (pq.contains(adjacentNode)) {
pq.remove(adjacentNode);
}
// Update the shortest path.
ArrayList<FlowEdge> path = shortestPath.containsKey(node)
? new ArrayList<>(shortestPath.get(node)) : new ArrayList<>();
path.add(outGoingEdge);
shortestPath.put(adjacentNode, path);
shortestDist.put(adjacentNode, newDist);
adjacentNode.setDistToSrc(newDist);
pq.add(adjacentNode);
}
visitedEdge.add(outGoingEdge);
}
}
log.error("No path found");
return new ArrayList<>();
} }
|
public class class_name {
@VisibleForTesting
public static List<FlowEdge> dijkstraBasedPathFindingHelper(ServiceNode sourceNode, ServiceNode targetNode,
DirectedWeightedMultigraph<ServiceNode, FlowEdge> weightedGraph) {
Map<DistancedNode, ArrayList<FlowEdge>> shortestPath = new HashMap<>();
Map<DistancedNode, Double> shortestDist = new HashMap<>();
PriorityQueue<DistancedNode> pq = new PriorityQueue<>(new Comparator<DistancedNode>() {
@Override
public int compare(DistancedNode o1, DistancedNode o2) {
if (o1.getDistToSrc() < o2.getDistToSrc()) {
return -1; // depends on control dependency: [if], data = [none]
} else {
return 1; // depends on control dependency: [if], data = [none]
}
}
});
pq.add(new DistancedNode(sourceNode, 0.0));
Set<FlowEdge> visitedEdge = new HashSet<>();
while(!pq.isEmpty()) {
DistancedNode node = pq.poll();
if (node.getNode().getNodeName().equals(targetNode.getNodeName())) {
// Searching finished
return shortestPath.get(node); // depends on control dependency: [if], data = [none]
}
Set<FlowEdge> outgoingEdges = weightedGraph.outgoingEdgesOf(node.getNode());
for (FlowEdge outGoingEdge:outgoingEdges) {
// Since it is a multi-graph problem, should use edge for deduplicaiton instead of vertex.
if (visitedEdge.contains(outGoingEdge)) {
continue;
}
DistancedNode adjacentNode = new DistancedNode(weightedGraph.getEdgeTarget(outGoingEdge));
if (shortestDist.containsKey(adjacentNode)) {
adjacentNode.setDistToSrc(shortestDist.get(adjacentNode)); // depends on control dependency: [if], data = [none]
}
double newDist = node.getDistToSrc() + ((LoadBasedFlowEdgeImpl) outGoingEdge).getEdgeLoad();
if (newDist < adjacentNode.getDistToSrc()) {
if (pq.contains(adjacentNode)) {
pq.remove(adjacentNode); // depends on control dependency: [if], data = [none]
}
// Update the shortest path.
ArrayList<FlowEdge> path = shortestPath.containsKey(node)
? new ArrayList<>(shortestPath.get(node)) : new ArrayList<>();
path.add(outGoingEdge); // depends on control dependency: [if], data = [none]
shortestPath.put(adjacentNode, path); // depends on control dependency: [if], data = [none]
shortestDist.put(adjacentNode, newDist); // depends on control dependency: [if], data = [none]
adjacentNode.setDistToSrc(newDist); // depends on control dependency: [if], data = [(newDist]
pq.add(adjacentNode); // depends on control dependency: [if], data = [none]
}
visitedEdge.add(outGoingEdge); // depends on control dependency: [for], data = [outGoingEdge]
}
}
log.error("No path found");
return new ArrayList<>();
} }
|
public class class_name {
private static byte getNextValidDecodeByte(byte[] in, IntWrapper pos, int maxPos) {
byte base64Byte;
byte decodeByte;
while (pos.value <= maxPos) {
base64Byte = in[pos.value++];
if (base64Byte > -1) {
decodeByte = DECODE_TABLE[base64Byte];
if (decodeByte > -1) {
return decodeByte;
}
}
}
// padding if reached max position
return PADDING;
} }
|
public class class_name {
private static byte getNextValidDecodeByte(byte[] in, IntWrapper pos, int maxPos) {
byte base64Byte;
byte decodeByte;
while (pos.value <= maxPos) {
base64Byte = in[pos.value++];
// depends on control dependency: [while], data = [none]
if (base64Byte > -1) {
decodeByte = DECODE_TABLE[base64Byte];
// depends on control dependency: [if], data = [none]
if (decodeByte > -1) {
return decodeByte;
// depends on control dependency: [if], data = [none]
}
}
}
// padding if reached max position
return PADDING;
} }
|
public class class_name {
public void registerWidget(final ConfiguredPropertyDescriptor propertyDescriptor, final PropertyWidget<?> widget) {
if (widget == null) {
_widgets.remove(propertyDescriptor);
} else {
_widgets.put(propertyDescriptor, widget);
@SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget;
final Object value = _componentBuilder.getConfiguredProperty(objectWidget.getPropertyDescriptor());
objectWidget.initialize(value);
}
} }
|
public class class_name {
public void registerWidget(final ConfiguredPropertyDescriptor propertyDescriptor, final PropertyWidget<?> widget) {
if (widget == null) {
_widgets.remove(propertyDescriptor); // depends on control dependency: [if], data = [none]
} else {
_widgets.put(propertyDescriptor, widget); // depends on control dependency: [if], data = [none]
@SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget;
final Object value = _componentBuilder.getConfiguredProperty(objectWidget.getPropertyDescriptor());
objectWidget.initialize(value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
static ZoneId of(String zoneId, boolean checkAvailable) {
Objects.requireNonNull(zoneId, "zoneId");
if (zoneId.length() <= 1 || zoneId.startsWith("+") || zoneId.startsWith("-")) {
return ZoneOffset.of(zoneId);
} else if (zoneId.startsWith("UTC") || zoneId.startsWith("GMT")) {
return ofWithPrefix(zoneId, 3, checkAvailable);
} else if (zoneId.startsWith("UT")) {
return ofWithPrefix(zoneId, 2, checkAvailable);
}
return ZoneRegion.ofId(zoneId, checkAvailable);
} }
|
public class class_name {
static ZoneId of(String zoneId, boolean checkAvailable) {
Objects.requireNonNull(zoneId, "zoneId");
if (zoneId.length() <= 1 || zoneId.startsWith("+") || zoneId.startsWith("-")) {
return ZoneOffset.of(zoneId); // depends on control dependency: [if], data = [none]
} else if (zoneId.startsWith("UTC") || zoneId.startsWith("GMT")) {
return ofWithPrefix(zoneId, 3, checkAvailable); // depends on control dependency: [if], data = [none]
} else if (zoneId.startsWith("UT")) {
return ofWithPrefix(zoneId, 2, checkAvailable); // depends on control dependency: [if], data = [none]
}
return ZoneRegion.ofId(zoneId, checkAvailable);
} }
|
public class class_name {
public static double getTotalNaturalAbundance(IAtomContainer atomContainer) {
try {
Isotopes isotopes = Isotopes.getInstance();
double abundance = 1.0;
double hAbundance = isotopes.getMajorIsotope(1).getNaturalAbundance();
int nImplH = 0;
for (IAtom atom : atomContainer.atoms()) {
if (atom.getImplicitHydrogenCount() == null)
throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens");
abundance *= atom.getNaturalAbundance();
for (int h = 0; h < atom.getImplicitHydrogenCount(); h++)
abundance *= hAbundance;
nImplH += atom.getImplicitHydrogenCount();
}
return abundance / Math.pow(100, nImplH + atomContainer.getAtomCount());
} catch (IOException e) {
throw new RuntimeException("Isotopes definitions could not be loaded", e);
}
} }
|
public class class_name {
public static double getTotalNaturalAbundance(IAtomContainer atomContainer) {
try {
Isotopes isotopes = Isotopes.getInstance();
double abundance = 1.0;
double hAbundance = isotopes.getMajorIsotope(1).getNaturalAbundance();
int nImplH = 0;
for (IAtom atom : atomContainer.atoms()) {
if (atom.getImplicitHydrogenCount() == null)
throw new IllegalArgumentException("an atom had with unknown (null) implicit hydrogens");
abundance *= atom.getNaturalAbundance(); // depends on control dependency: [for], data = [atom]
for (int h = 0; h < atom.getImplicitHydrogenCount(); h++)
abundance *= hAbundance;
nImplH += atom.getImplicitHydrogenCount(); // depends on control dependency: [for], data = [atom]
}
return abundance / Math.pow(100, nImplH + atomContainer.getAtomCount()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Isotopes definitions could not be loaded", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(LinkAttributeUpdate linkAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (linkAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(linkAttributeUpdate.getAttributeKey(), ATTRIBUTEKEY_BINDING);
protocolMarshaller.marshall(linkAttributeUpdate.getAttributeAction(), ATTRIBUTEACTION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(LinkAttributeUpdate linkAttributeUpdate, ProtocolMarshaller protocolMarshaller) {
if (linkAttributeUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(linkAttributeUpdate.getAttributeKey(), ATTRIBUTEKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(linkAttributeUpdate.getAttributeAction(), ATTRIBUTEACTION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static JsonObject getObject(JSONArray array, int index)
throws IOException {
// We can't just jam an entry into the array without
// checking that earlier indexes exist. Also we need
// to account for 0 versus 1 based indexing.
// Index changed to 0 based
if (index < 1) {
throw new IOException("Invalid index value provided in form data.");
}
index -= 1;
// Nice and easy, it already exists
if (array.size() > index) {
Object object = array.get(index);
if (object instanceof JsonObject) {
return (JsonObject) object;
}
throw new IOException("Non-Object found in array!");
// Slightly more annoying, we need to fill in
// all the indices up to this point
} else {
for (int i = array.size(); i <= index; i++) {
JsonObject object = new JsonObject();
array.add(object);
}
return (JsonObject) array.get(index);
}
} }
|
public class class_name {
private static JsonObject getObject(JSONArray array, int index)
throws IOException {
// We can't just jam an entry into the array without
// checking that earlier indexes exist. Also we need
// to account for 0 versus 1 based indexing.
// Index changed to 0 based
if (index < 1) {
throw new IOException("Invalid index value provided in form data.");
}
index -= 1;
// Nice and easy, it already exists
if (array.size() > index) {
Object object = array.get(index);
if (object instanceof JsonObject) {
return (JsonObject) object; // depends on control dependency: [if], data = [none]
}
throw new IOException("Non-Object found in array!");
// Slightly more annoying, we need to fill in
// all the indices up to this point
} else {
for (int i = array.size(); i <= index; i++) {
JsonObject object = new JsonObject();
array.add(object); // depends on control dependency: [for], data = [none]
}
return (JsonObject) array.get(index);
}
} }
|
public class class_name {
public void zSetAppropriateTextFieldMinimumWidth() {
Integer programmerSuppliedWidth = settings.getSizeTextFieldMinimumWidth();
// Determine the appropriate minimum width for the text field.
int minimumWidthPixels = CalculateMinimumTimeFieldSize.getFormattedTimeWidthInPixels(
settings.getFormatForDisplayTime(), settings.fontValidTime, 0);
if (programmerSuppliedWidth != null) {
if (settings.getSizeTextFieldMinimumWidthDefaultOverride()) {
minimumWidthPixels = Math.max(programmerSuppliedWidth, minimumWidthPixels);
} else {
minimumWidthPixels = programmerSuppliedWidth;
}
}
// Apply the minimum and preferred width to the text field.
// Note that we only change the width, not the height.
Dimension newMinimumSize = timeTextField.getMinimumSize();
newMinimumSize.width = minimumWidthPixels;
timeTextField.setMinimumSize(newMinimumSize);
Dimension newPreferredSize = timeTextField.getPreferredSize();
newPreferredSize.width = minimumWidthPixels;
timeTextField.setPreferredSize(newPreferredSize);
this.validate();
} }
|
public class class_name {
public void zSetAppropriateTextFieldMinimumWidth() {
Integer programmerSuppliedWidth = settings.getSizeTextFieldMinimumWidth();
// Determine the appropriate minimum width for the text field.
int minimumWidthPixels = CalculateMinimumTimeFieldSize.getFormattedTimeWidthInPixels(
settings.getFormatForDisplayTime(), settings.fontValidTime, 0);
if (programmerSuppliedWidth != null) {
if (settings.getSizeTextFieldMinimumWidthDefaultOverride()) {
minimumWidthPixels = Math.max(programmerSuppliedWidth, minimumWidthPixels); // depends on control dependency: [if], data = [none]
} else {
minimumWidthPixels = programmerSuppliedWidth; // depends on control dependency: [if], data = [none]
}
}
// Apply the minimum and preferred width to the text field.
// Note that we only change the width, not the height.
Dimension newMinimumSize = timeTextField.getMinimumSize();
newMinimumSize.width = minimumWidthPixels;
timeTextField.setMinimumSize(newMinimumSize);
Dimension newPreferredSize = timeTextField.getPreferredSize();
newPreferredSize.width = minimumWidthPixels;
timeTextField.setPreferredSize(newPreferredSize);
this.validate();
} }
|
public class class_name {
public void hydrate() {
if (viewSet == null) {
viewSet = createViewSet();
}
if (documentation == null) {
documentation = createDocumentation();
}
hydrateModel();
hydrateViewSet();
hydrateDocumentation();
} }
|
public class class_name {
public void hydrate() {
if (viewSet == null) {
viewSet = createViewSet(); // depends on control dependency: [if], data = [none]
}
if (documentation == null) {
documentation = createDocumentation(); // depends on control dependency: [if], data = [none]
}
hydrateModel();
hydrateViewSet();
hydrateDocumentation();
} }
|
public class class_name {
public void perform(TaskRequest req, TaskResponse res) {
HttpServletRequest hreq = (HttpServletRequest) request.evaluate(req, res);
String myScope = (String) scope.evaluate(req, res);
if (myScope.equalsIgnoreCase("request")) {
hreq.removeAttribute((String) attribute_name.evaluate(req, res));
} else if (myScope.equalsIgnoreCase("session")) {
HttpSession session = hreq.getSession();
session.removeAttribute((String) attribute_name.evaluate(req, res));
} else if (myScope.equalsIgnoreCase("context")) {
ServletContext context = hreq.getSession().getServletContext();
context.removeAttribute((String) attribute_name.evaluate(req, res));
} else {
throw new RuntimeException("Unknown scope [" + myScope + "] for" +
" attribute " + (String) attribute_name.evaluate(req, res));
}
} }
|
public class class_name {
public void perform(TaskRequest req, TaskResponse res) {
HttpServletRequest hreq = (HttpServletRequest) request.evaluate(req, res);
String myScope = (String) scope.evaluate(req, res);
if (myScope.equalsIgnoreCase("request")) {
hreq.removeAttribute((String) attribute_name.evaluate(req, res)); // depends on control dependency: [if], data = [none]
} else if (myScope.equalsIgnoreCase("session")) {
HttpSession session = hreq.getSession();
session.removeAttribute((String) attribute_name.evaluate(req, res)); // depends on control dependency: [if], data = [none]
} else if (myScope.equalsIgnoreCase("context")) {
ServletContext context = hreq.getSession().getServletContext();
context.removeAttribute((String) attribute_name.evaluate(req, res)); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Unknown scope [" + myScope + "] for" +
" attribute " + (String) attribute_name.evaluate(req, res));
}
} }
|
public class class_name {
protected String escapeObjectName(@Nonnull ObjectName objectName) {
/** Add objectName's domain */
StringBuilder result = new StringBuilder();
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), false, result);
/** Walk through (sorted) properties of the ObjectName and add values to the result */
List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
Collections.sort(keys);
for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
String propertyKey = it.next();
result.append('.');
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(propertyKey), false, result);
}
return result.toString();
} }
|
public class class_name {
protected String escapeObjectName(@Nonnull ObjectName objectName) {
/** Add objectName's domain */
StringBuilder result = new StringBuilder();
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getDomain(), false, result);
/** Walk through (sorted) properties of the ObjectName and add values to the result */
List<String> keys = Collections.list(objectName.getKeyPropertyList().keys());
Collections.sort(keys);
for (Iterator<String> it = keys.iterator(); it.hasNext(); ) {
String propertyKey = it.next();
result.append('.'); // depends on control dependency: [for], data = [none]
StringUtils2.appendEscapedNonAlphaNumericChars(objectName.getKeyProperty(propertyKey), false, result); // depends on control dependency: [for], data = [none]
}
return result.toString();
} }
|
public class class_name {
public Projection withNonKeyAttributes(String... nonKeyAttributes) {
if (this.nonKeyAttributes == null) {
setNonKeyAttributes(new java.util.ArrayList<String>(nonKeyAttributes.length));
}
for (String ele : nonKeyAttributes) {
this.nonKeyAttributes.add(ele);
}
return this;
} }
|
public class class_name {
public Projection withNonKeyAttributes(String... nonKeyAttributes) {
if (this.nonKeyAttributes == null) {
setNonKeyAttributes(new java.util.ArrayList<String>(nonKeyAttributes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : nonKeyAttributes) {
this.nonKeyAttributes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private boolean hasViewPermissionWorkaroundForNonExistantPipelineBug_4477(CaseInsensitiveString pipelineName, Username username) {
if (!goConfigService.hasPipelineNamed(pipelineName)) {
throw new RecordNotFoundException(Pipeline, pipelineName);
}
if (securityService.isUserAdmin(username)) {
return true;
}
// we check if pipeline exists because this method returns true in case the group or pipeline does not exist!
return securityService.hasViewPermissionForPipeline(username, pipelineName.toString());
} }
|
public class class_name {
private boolean hasViewPermissionWorkaroundForNonExistantPipelineBug_4477(CaseInsensitiveString pipelineName, Username username) {
if (!goConfigService.hasPipelineNamed(pipelineName)) {
throw new RecordNotFoundException(Pipeline, pipelineName);
}
if (securityService.isUserAdmin(username)) {
return true; // depends on control dependency: [if], data = [none]
}
// we check if pipeline exists because this method returns true in case the group or pipeline does not exist!
return securityService.hasViewPermissionForPipeline(username, pipelineName.toString());
} }
|
public class class_name {
public void realize(ApplicationContext wac, ConfigurableApplicationContext child) {
if (WebApplicationContextUtils.getWebApplicationContext(_context) == null) {
_context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
} else {
_logger.warning("Already realized");
return;
}
if (child != null) wac = child;
ServiceModuleInfo info = new ServiceModuleInfo();
if (wac.containsBean(PERSISTENCE)) { // persistence may not be there if persistent storage is not required
info.persistence.first = info.persistence.second = (Persistence)wac.getBean(PERSISTENCE);
_persistences.put("-", info.persistence.first);
}
_logger.log(Level.CONFIG, "install packaged modules");
wac = install(wac, sort(_context, _packaged), info);
_logger.log(Level.CONFIG, "install extension modules");
wac = install(wac, sort(_context, _extended), info);
_logger.log(Level.CONFIG, "install service augmentations");
for (ServiceAugmentation fi: info.augmentations) {
fi.install(_registry);
}
String hide = System.getProperty("xillium.service.HideDescription");
if (hide == null || hide.length() == 0) {
_registry.put("x!/desc", new Pair<Service, Persistence>(new DescService(info.descriptions), info.persistence.first));
_registry.put("x!/list", new Pair<Service, Persistence>(new ListService(_registry), info.persistence.first));
}
_registry.put("x!/ping", new Pair<Service, Persistence>(new PingService(), info.persistence.first));
if (System.getProperty("xillium.persistence.DisablePrecompilation") == null) {
for (Persistence persistence: _persistences.values()) {
if (persistence.getTransactionManager() != null) {
persistence.doReadWrite(null, new Persistence.Task<Void, Void>() {
public Void run(Void facility, Persistence persistence) throws Exception {
_logger.info("parametric statements compiled: " + persistence.compile());
return null;
}
});
} else {
_logger.warning("Persistence precompilation is ON (default) but TransactionManager is not configured");
}
}
}
} }
|
public class class_name {
public void realize(ApplicationContext wac, ConfigurableApplicationContext child) {
if (WebApplicationContextUtils.getWebApplicationContext(_context) == null) {
_context.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac); // depends on control dependency: [if], data = [none]
} else {
_logger.warning("Already realized"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (child != null) wac = child;
ServiceModuleInfo info = new ServiceModuleInfo();
if (wac.containsBean(PERSISTENCE)) { // persistence may not be there if persistent storage is not required
info.persistence.first = info.persistence.second = (Persistence)wac.getBean(PERSISTENCE); // depends on control dependency: [if], data = [none]
_persistences.put("-", info.persistence.first); // depends on control dependency: [if], data = [none]
}
_logger.log(Level.CONFIG, "install packaged modules");
wac = install(wac, sort(_context, _packaged), info);
_logger.log(Level.CONFIG, "install extension modules");
wac = install(wac, sort(_context, _extended), info);
_logger.log(Level.CONFIG, "install service augmentations");
for (ServiceAugmentation fi: info.augmentations) {
fi.install(_registry); // depends on control dependency: [for], data = [fi]
}
String hide = System.getProperty("xillium.service.HideDescription");
if (hide == null || hide.length() == 0) {
_registry.put("x!/desc", new Pair<Service, Persistence>(new DescService(info.descriptions), info.persistence.first)); // depends on control dependency: [if], data = [none]
_registry.put("x!/list", new Pair<Service, Persistence>(new ListService(_registry), info.persistence.first)); // depends on control dependency: [if], data = [none]
}
_registry.put("x!/ping", new Pair<Service, Persistence>(new PingService(), info.persistence.first));
if (System.getProperty("xillium.persistence.DisablePrecompilation") == null) {
for (Persistence persistence: _persistences.values()) {
if (persistence.getTransactionManager() != null) {
persistence.doReadWrite(null, new Persistence.Task<Void, Void>() {
public Void run(Void facility, Persistence persistence) throws Exception {
_logger.info("parametric statements compiled: " + persistence.compile());
return null;
}
}); // depends on control dependency: [if], data = [none]
} else {
_logger.warning("Persistence precompilation is ON (default) but TransactionManager is not configured"); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
protected void setDefaultInfoWindowLocation() {
int s = mOutline.getPoints().size();
if (s == 0){
mInfoWindowLocation = new GeoPoint(0.0, 0.0);
return;
}
//TODO: as soon as the polygon bounding box will be a class member, don't compute it again here.
mInfoWindowLocation = mOutline.getCenter(null);
} }
|
public class class_name {
protected void setDefaultInfoWindowLocation() {
int s = mOutline.getPoints().size();
if (s == 0){
mInfoWindowLocation = new GeoPoint(0.0, 0.0); // depends on control dependency: [if], data = [0)]
return; // depends on control dependency: [if], data = [none]
}
//TODO: as soon as the polygon bounding box will be a class member, don't compute it again here.
mInfoWindowLocation = mOutline.getCenter(null);
} }
|
public class class_name {
@NotNull
public OptionalBoolean map(@NotNull BooleanPredicate mapper) {
if (!isPresent()) {
return empty();
}
Objects.requireNonNull(mapper);
return OptionalBoolean.of(mapper.test(value));
} }
|
public class class_name {
@NotNull
public OptionalBoolean map(@NotNull BooleanPredicate mapper) {
if (!isPresent()) {
return empty(); // depends on control dependency: [if], data = [none]
}
Objects.requireNonNull(mapper);
return OptionalBoolean.of(mapper.test(value));
} }
|
public class class_name {
@SuppressWarnings("deprecation")
public void setMetaData(SoundCloudTrack track, Bitmap artwork) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// set meta data on the lock screen for pre lollipop.
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING);
RemoteControlClientCompat.MetadataEditorCompat mediaEditorCompat
= mRemoteControlClientCompat.editMetadata(true)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
mediaEditorCompat.putBitmap(
RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK, artwork);
}
mediaEditorCompat.apply();
}
// set meta data to the media session.
MediaMetadataCompat.Builder metadataCompatBuilder = new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
metadataCompatBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, artwork);
}
mMediaSession.setMetadata(metadataCompatBuilder.build());
setMediaSessionCompatPlaybackState(PlaybackStateCompat.STATE_PLAYING);
} }
|
public class class_name {
@SuppressWarnings("deprecation")
public void setMetaData(SoundCloudTrack track, Bitmap artwork) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
// set meta data on the lock screen for pre lollipop.
mRemoteControlClientCompat.setPlaybackState(RemoteControlClient.PLAYSTATE_PLAYING); // depends on control dependency: [if], data = [none]
RemoteControlClientCompat.MetadataEditorCompat mediaEditorCompat
= mRemoteControlClientCompat.editMetadata(true)
.putString(MediaMetadataRetriever.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataRetriever.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
mediaEditorCompat.putBitmap(
RemoteControlClientCompat.MetadataEditorCompat.METADATA_KEY_ARTWORK, artwork); // depends on control dependency: [if], data = [none]
}
mediaEditorCompat.apply(); // depends on control dependency: [if], data = [none]
}
// set meta data to the media session.
MediaMetadataCompat.Builder metadataCompatBuilder = new MediaMetadataCompat.Builder()
.putString(MediaMetadataCompat.METADATA_KEY_TITLE, track.getTitle())
.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, track.getArtist());
if (artwork != null) {
metadataCompatBuilder.putBitmap(MediaMetadataCompat.METADATA_KEY_ART, artwork); // depends on control dependency: [if], data = [none]
}
mMediaSession.setMetadata(metadataCompatBuilder.build());
setMediaSessionCompatPlaybackState(PlaybackStateCompat.STATE_PLAYING);
} }
|
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
public static void setOffset( Symbolizer symbolizer, String text ) {
if (text.indexOf(',') == -1) {
return;
}
String[] split = text.split(",");
if (split.length != 2) {
return;
}
double xOffset = Double.parseDouble(split[0]);
double yOffset = Double.parseDouble(split[1]);
Expression geometry = symbolizer.getGeometry();
if (geometry != null) {
if (geometry instanceof FilterFunction_offset) {
FilterFunction_offset offsetFunction = (FilterFunction_offset) geometry;
List parameters = offsetFunction.getParameters();
parameters.set(1, ff.literal(xOffset));
parameters.set(2, ff.literal(yOffset));
}
} else {
Function function = ff.function("offset", ff.property("the_geom"), ff.literal(xOffset), ff.literal(yOffset));
symbolizer.setGeometry(function);
}
} }
|
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
public static void setOffset( Symbolizer symbolizer, String text ) {
if (text.indexOf(',') == -1) {
return; // depends on control dependency: [if], data = [none]
}
String[] split = text.split(",");
if (split.length != 2) {
return; // depends on control dependency: [if], data = [none]
}
double xOffset = Double.parseDouble(split[0]);
double yOffset = Double.parseDouble(split[1]);
Expression geometry = symbolizer.getGeometry();
if (geometry != null) {
if (geometry instanceof FilterFunction_offset) {
FilterFunction_offset offsetFunction = (FilterFunction_offset) geometry;
List parameters = offsetFunction.getParameters();
parameters.set(1, ff.literal(xOffset)); // depends on control dependency: [if], data = [none]
parameters.set(2, ff.literal(yOffset)); // depends on control dependency: [if], data = [none]
}
} else {
Function function = ff.function("offset", ff.property("the_geom"), ff.literal(xOffset), ff.literal(yOffset)); // depends on control dependency: [if], data = [none]
symbolizer.setGeometry(function); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setUsers(java.util.Collection<TraceUser> users) {
if (users == null) {
this.users = null;
return;
}
this.users = new java.util.ArrayList<TraceUser>(users);
} }
|
public class class_name {
public void setUsers(java.util.Collection<TraceUser> users) {
if (users == null) {
this.users = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.users = new java.util.ArrayList<TraceUser>(users);
} }
|
public class class_name {
public static boolean isValid(@Nullable final String dayOpeningHours) {
if (dayOpeningHours == null) {
return true;
}
final int p = dayOpeningHours.indexOf(' ');
if (p < 0) {
return false;
}
final String dayOfTheWeekStr = dayOpeningHours.substring(0, p);
final String hourRangesStr = dayOpeningHours.substring(p + 1);
return DayOfTheWeek.isValid(dayOfTheWeekStr) && HourRanges.isValid(hourRangesStr);
} }
|
public class class_name {
public static boolean isValid(@Nullable final String dayOpeningHours) {
if (dayOpeningHours == null) {
return true; // depends on control dependency: [if], data = [none]
}
final int p = dayOpeningHours.indexOf(' ');
if (p < 0) {
return false; // depends on control dependency: [if], data = [none]
}
final String dayOfTheWeekStr = dayOpeningHours.substring(0, p);
final String hourRangesStr = dayOpeningHours.substring(p + 1);
return DayOfTheWeek.isValid(dayOfTheWeekStr) && HourRanges.isValid(hourRangesStr);
} }
|
public class class_name {
public final hqlParser.caseExpression_return caseExpression() throws RecognitionException {
hqlParser.caseExpression_return retval = new hqlParser.caseExpression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token CASE207=null;
Token END210=null;
Token CASE211=null;
Token END215=null;
ParserRuleReturnScope whenClause208 =null;
ParserRuleReturnScope elseClause209 =null;
ParserRuleReturnScope unaryExpression212 =null;
ParserRuleReturnScope altWhenClause213 =null;
ParserRuleReturnScope elseClause214 =null;
CommonTree CASE207_tree=null;
CommonTree END210_tree=null;
CommonTree CASE211_tree=null;
CommonTree END215_tree=null;
RewriteRuleTokenStream stream_END=new RewriteRuleTokenStream(adaptor,"token END");
RewriteRuleTokenStream stream_CASE=new RewriteRuleTokenStream(adaptor,"token CASE");
RewriteRuleSubtreeStream stream_whenClause=new RewriteRuleSubtreeStream(adaptor,"rule whenClause");
RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
RewriteRuleSubtreeStream stream_altWhenClause=new RewriteRuleSubtreeStream(adaptor,"rule altWhenClause");
RewriteRuleSubtreeStream stream_elseClause=new RewriteRuleSubtreeStream(adaptor,"rule elseClause");
try {
// hql.g:558:2: ( CASE ( whenClause )+ ( elseClause )? END -> ^( CASE ( whenClause )+ ( elseClause )? ) | CASE unaryExpression ( altWhenClause )+ ( elseClause )? END -> ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? ) )
int alt79=2;
int LA79_0 = input.LA(1);
if ( (LA79_0==CASE) ) {
int LA79_1 = input.LA(2);
if ( (LA79_1==WHEN) ) {
alt79=1;
}
else if ( (LA79_1==ALL||LA79_1==ANY||LA79_1==AVG||LA79_1==CASE||LA79_1==COLON||LA79_1==COUNT||LA79_1==ELEMENTS||LA79_1==EMPTY||LA79_1==EXISTS||LA79_1==FALSE||LA79_1==IDENT||LA79_1==INDICES||LA79_1==MAX||(LA79_1 >= MIN && LA79_1 <= MINUS)||(LA79_1 >= NULL && LA79_1 <= NUM_LONG)||LA79_1==OPEN||(LA79_1 >= PARAM && LA79_1 <= PLUS)||LA79_1==QUOTED_String||LA79_1==SOME||LA79_1==SUM||LA79_1==TRUE) ) {
alt79=2;
}
else {
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae =
new NoViableAltException("", 79, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 79, 0, input);
throw nvae;
}
switch (alt79) {
case 1 :
// hql.g:558:4: CASE ( whenClause )+ ( elseClause )? END
{
CASE207=(Token)match(input,CASE,FOLLOW_CASE_in_caseExpression2576);
stream_CASE.add(CASE207);
// hql.g:558:9: ( whenClause )+
int cnt75=0;
loop75:
while (true) {
int alt75=2;
int LA75_0 = input.LA(1);
if ( (LA75_0==WHEN) ) {
alt75=1;
}
switch (alt75) {
case 1 :
// hql.g:558:10: whenClause
{
pushFollow(FOLLOW_whenClause_in_caseExpression2579);
whenClause208=whenClause();
state._fsp--;
stream_whenClause.add(whenClause208.getTree());
}
break;
default :
if ( cnt75 >= 1 ) break loop75;
EarlyExitException eee = new EarlyExitException(75, input);
throw eee;
}
cnt75++;
}
// hql.g:558:23: ( elseClause )?
int alt76=2;
int LA76_0 = input.LA(1);
if ( (LA76_0==ELSE) ) {
alt76=1;
}
switch (alt76) {
case 1 :
// hql.g:558:24: elseClause
{
pushFollow(FOLLOW_elseClause_in_caseExpression2584);
elseClause209=elseClause();
state._fsp--;
stream_elseClause.add(elseClause209.getTree());
}
break;
}
END210=(Token)match(input,END,FOLLOW_END_in_caseExpression2588);
stream_END.add(END210);
// AST REWRITE
// elements: CASE, elseClause, whenClause
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 559:3: -> ^( CASE ( whenClause )+ ( elseClause )? )
{
// hql.g:559:6: ^( CASE ( whenClause )+ ( elseClause )? )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CASE.nextNode(), root_1);
if ( !(stream_whenClause.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_whenClause.hasNext() ) {
adaptor.addChild(root_1, stream_whenClause.nextTree());
}
stream_whenClause.reset();
// hql.g:559:25: ( elseClause )?
if ( stream_elseClause.hasNext() ) {
adaptor.addChild(root_1, stream_elseClause.nextTree());
}
stream_elseClause.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2 :
// hql.g:560:4: CASE unaryExpression ( altWhenClause )+ ( elseClause )? END
{
CASE211=(Token)match(input,CASE,FOLLOW_CASE_in_caseExpression2608);
stream_CASE.add(CASE211);
pushFollow(FOLLOW_unaryExpression_in_caseExpression2610);
unaryExpression212=unaryExpression();
state._fsp--;
stream_unaryExpression.add(unaryExpression212.getTree());
// hql.g:560:25: ( altWhenClause )+
int cnt77=0;
loop77:
while (true) {
int alt77=2;
int LA77_0 = input.LA(1);
if ( (LA77_0==WHEN) ) {
alt77=1;
}
switch (alt77) {
case 1 :
// hql.g:560:26: altWhenClause
{
pushFollow(FOLLOW_altWhenClause_in_caseExpression2613);
altWhenClause213=altWhenClause();
state._fsp--;
stream_altWhenClause.add(altWhenClause213.getTree());
}
break;
default :
if ( cnt77 >= 1 ) break loop77;
EarlyExitException eee = new EarlyExitException(77, input);
throw eee;
}
cnt77++;
}
// hql.g:560:42: ( elseClause )?
int alt78=2;
int LA78_0 = input.LA(1);
if ( (LA78_0==ELSE) ) {
alt78=1;
}
switch (alt78) {
case 1 :
// hql.g:560:43: elseClause
{
pushFollow(FOLLOW_elseClause_in_caseExpression2618);
elseClause214=elseClause();
state._fsp--;
stream_elseClause.add(elseClause214.getTree());
}
break;
}
END215=(Token)match(input,END,FOLLOW_END_in_caseExpression2622);
stream_END.add(END215);
// AST REWRITE
// elements: altWhenClause, elseClause, unaryExpression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 561:3: -> ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? )
{
// hql.g:561:6: ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(CASE2, "CASE2"), root_1);
adaptor.addChild(root_1, stream_unaryExpression.nextTree());
if ( !(stream_altWhenClause.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_altWhenClause.hasNext() ) {
adaptor.addChild(root_1, stream_altWhenClause.nextTree());
}
stream_altWhenClause.reset();
// hql.g:561:45: ( elseClause )?
if ( stream_elseClause.hasNext() ) {
adaptor.addChild(root_1, stream_elseClause.nextTree());
}
stream_elseClause.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
public final hqlParser.caseExpression_return caseExpression() throws RecognitionException {
hqlParser.caseExpression_return retval = new hqlParser.caseExpression_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token CASE207=null;
Token END210=null;
Token CASE211=null;
Token END215=null;
ParserRuleReturnScope whenClause208 =null;
ParserRuleReturnScope elseClause209 =null;
ParserRuleReturnScope unaryExpression212 =null;
ParserRuleReturnScope altWhenClause213 =null;
ParserRuleReturnScope elseClause214 =null;
CommonTree CASE207_tree=null;
CommonTree END210_tree=null;
CommonTree CASE211_tree=null;
CommonTree END215_tree=null;
RewriteRuleTokenStream stream_END=new RewriteRuleTokenStream(adaptor,"token END");
RewriteRuleTokenStream stream_CASE=new RewriteRuleTokenStream(adaptor,"token CASE");
RewriteRuleSubtreeStream stream_whenClause=new RewriteRuleSubtreeStream(adaptor,"rule whenClause");
RewriteRuleSubtreeStream stream_unaryExpression=new RewriteRuleSubtreeStream(adaptor,"rule unaryExpression");
RewriteRuleSubtreeStream stream_altWhenClause=new RewriteRuleSubtreeStream(adaptor,"rule altWhenClause");
RewriteRuleSubtreeStream stream_elseClause=new RewriteRuleSubtreeStream(adaptor,"rule elseClause");
try {
// hql.g:558:2: ( CASE ( whenClause )+ ( elseClause )? END -> ^( CASE ( whenClause )+ ( elseClause )? ) | CASE unaryExpression ( altWhenClause )+ ( elseClause )? END -> ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? ) )
int alt79=2;
int LA79_0 = input.LA(1);
if ( (LA79_0==CASE) ) {
int LA79_1 = input.LA(2);
if ( (LA79_1==WHEN) ) {
alt79=1; // depends on control dependency: [if], data = [none]
}
else if ( (LA79_1==ALL||LA79_1==ANY||LA79_1==AVG||LA79_1==CASE||LA79_1==COLON||LA79_1==COUNT||LA79_1==ELEMENTS||LA79_1==EMPTY||LA79_1==EXISTS||LA79_1==FALSE||LA79_1==IDENT||LA79_1==INDICES||LA79_1==MAX||(LA79_1 >= MIN && LA79_1 <= MINUS)||(LA79_1 >= NULL && LA79_1 <= NUM_LONG)||LA79_1==OPEN||(LA79_1 >= PARAM && LA79_1 <= PLUS)||LA79_1==QUOTED_String||LA79_1==SOME||LA79_1==SUM||LA79_1==TRUE) ) {
alt79=2; // depends on control dependency: [if], data = [none]
}
else {
int nvaeMark = input.mark();
try {
input.consume(); // depends on control dependency: [try], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 79, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else {
NoViableAltException nvae =
new NoViableAltException("", 79, 0, input);
throw nvae;
}
switch (alt79) {
case 1 :
// hql.g:558:4: CASE ( whenClause )+ ( elseClause )? END
{
CASE207=(Token)match(input,CASE,FOLLOW_CASE_in_caseExpression2576);
stream_CASE.add(CASE207);
// hql.g:558:9: ( whenClause )+
int cnt75=0;
loop75:
while (true) {
int alt75=2;
int LA75_0 = input.LA(1);
if ( (LA75_0==WHEN) ) {
alt75=1; // depends on control dependency: [if], data = [none]
}
switch (alt75) {
case 1 :
// hql.g:558:10: whenClause
{
pushFollow(FOLLOW_whenClause_in_caseExpression2579);
whenClause208=whenClause();
state._fsp--;
stream_whenClause.add(whenClause208.getTree());
}
break;
default :
if ( cnt75 >= 1 ) break loop75;
EarlyExitException eee = new EarlyExitException(75, input);
throw eee;
}
cnt75++; // depends on control dependency: [while], data = [none]
}
// hql.g:558:23: ( elseClause )?
int alt76=2;
int LA76_0 = input.LA(1);
if ( (LA76_0==ELSE) ) {
alt76=1; // depends on control dependency: [if], data = [none]
}
switch (alt76) {
case 1 :
// hql.g:558:24: elseClause
{
pushFollow(FOLLOW_elseClause_in_caseExpression2584);
elseClause209=elseClause();
state._fsp--;
stream_elseClause.add(elseClause209.getTree());
}
break;
}
END210=(Token)match(input,END,FOLLOW_END_in_caseExpression2588);
stream_END.add(END210);
// AST REWRITE
// elements: CASE, elseClause, whenClause
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 559:3: -> ^( CASE ( whenClause )+ ( elseClause )? )
{
// hql.g:559:6: ^( CASE ( whenClause )+ ( elseClause )? )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(stream_CASE.nextNode(), root_1);
if ( !(stream_whenClause.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_whenClause.hasNext() ) {
adaptor.addChild(root_1, stream_whenClause.nextTree()); // depends on control dependency: [while], data = [none]
}
stream_whenClause.reset();
// hql.g:559:25: ( elseClause )?
if ( stream_elseClause.hasNext() ) {
adaptor.addChild(root_1, stream_elseClause.nextTree()); // depends on control dependency: [if], data = [none]
}
stream_elseClause.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
case 2 :
// hql.g:560:4: CASE unaryExpression ( altWhenClause )+ ( elseClause )? END
{
CASE211=(Token)match(input,CASE,FOLLOW_CASE_in_caseExpression2608);
stream_CASE.add(CASE211);
pushFollow(FOLLOW_unaryExpression_in_caseExpression2610);
unaryExpression212=unaryExpression();
state._fsp--;
stream_unaryExpression.add(unaryExpression212.getTree());
// hql.g:560:25: ( altWhenClause )+
int cnt77=0;
loop77:
while (true) {
int alt77=2;
int LA77_0 = input.LA(1);
if ( (LA77_0==WHEN) ) {
alt77=1; // depends on control dependency: [if], data = [none]
}
switch (alt77) {
case 1 :
// hql.g:560:26: altWhenClause
{
pushFollow(FOLLOW_altWhenClause_in_caseExpression2613);
altWhenClause213=altWhenClause();
state._fsp--;
stream_altWhenClause.add(altWhenClause213.getTree());
}
break;
default :
if ( cnt77 >= 1 ) break loop77;
EarlyExitException eee = new EarlyExitException(77, input);
throw eee;
}
cnt77++; // depends on control dependency: [while], data = [none]
}
// hql.g:560:42: ( elseClause )?
int alt78=2;
int LA78_0 = input.LA(1);
if ( (LA78_0==ELSE) ) {
alt78=1; // depends on control dependency: [if], data = [none]
}
switch (alt78) {
case 1 :
// hql.g:560:43: elseClause
{
pushFollow(FOLLOW_elseClause_in_caseExpression2618);
elseClause214=elseClause();
state._fsp--;
stream_elseClause.add(elseClause214.getTree());
}
break;
}
END215=(Token)match(input,END,FOLLOW_END_in_caseExpression2622);
stream_END.add(END215);
// AST REWRITE
// elements: altWhenClause, elseClause, unaryExpression
// token labels:
// rule labels: retval
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 561:3: -> ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? )
{
// hql.g:561:6: ^( CASE2 unaryExpression ( altWhenClause )+ ( elseClause )? )
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(CASE2, "CASE2"), root_1);
adaptor.addChild(root_1, stream_unaryExpression.nextTree());
if ( !(stream_altWhenClause.hasNext()) ) {
throw new RewriteEarlyExitException();
}
while ( stream_altWhenClause.hasNext() ) {
adaptor.addChild(root_1, stream_altWhenClause.nextTree()); // depends on control dependency: [while], data = [none]
}
stream_altWhenClause.reset();
// hql.g:561:45: ( elseClause )?
if ( stream_elseClause.hasNext() ) {
adaptor.addChild(root_1, stream_elseClause.nextTree()); // depends on control dependency: [if], data = [none]
}
stream_elseClause.reset();
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
break;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void createSymbols(String ctDescriptionFile, String ctSymLocation, CtSymKind ctSymKind) throws IOException {
ClassList classes = load(Paths.get(ctDescriptionFile));
splitHeaders(classes);
for (ClassDescription classDescription : classes) {
for (ClassHeaderDescription header : classDescription.header) {
switch (ctSymKind) {
case JOINED_VERSIONS:
Set<String> jointVersions = new HashSet<>();
jointVersions.add(header.versions);
limitJointVersion(jointVersions, classDescription.fields);
limitJointVersion(jointVersions, classDescription.methods);
writeClassesForVersions(ctSymLocation, classDescription, header, jointVersions);
break;
case SEPARATE:
Set<String> versions = new HashSet<>();
for (char v : header.versions.toCharArray()) {
versions.add("" + v);
}
writeClassesForVersions(ctSymLocation, classDescription, header, versions);
break;
}
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void createSymbols(String ctDescriptionFile, String ctSymLocation, CtSymKind ctSymKind) throws IOException {
ClassList classes = load(Paths.get(ctDescriptionFile));
splitHeaders(classes);
for (ClassDescription classDescription : classes) {
for (ClassHeaderDescription header : classDescription.header) {
switch (ctSymKind) {
case JOINED_VERSIONS:
Set<String> jointVersions = new HashSet<>();
jointVersions.add(header.versions);
limitJointVersion(jointVersions, classDescription.fields);
limitJointVersion(jointVersions, classDescription.methods);
writeClassesForVersions(ctSymLocation, classDescription, header, jointVersions);
break;
case SEPARATE:
Set<String> versions = new HashSet<>();
for (char v : header.versions.toCharArray()) {
versions.add("" + v); // depends on control dependency: [for], data = [v]
}
writeClassesForVersions(ctSymLocation, classDescription, header, versions);
break;
}
}
}
} }
|
public class class_name {
public List<PipeKey> put(final DbBatch data, Long nid) throws PipeException {
List<PipeKey> keys = new ArrayList<PipeKey>();
if (isLocal(nid)) {
keys.add(rowDataMemoryPipe.put(data));
} else {
Future<PipeKey> future = null;
Pipeline pipeline = configClientService.findPipeline(data.getRowBatch().getIdentity().getPipelineId());
if (data.getFileBatch() != null && !CollectionUtils.isEmpty(data.getFileBatch().getFiles())) {
future = executorService.submit(new Callable<PipeKey>() {
public PipeKey call() throws Exception {
try {
MDC.put(OtterConstants.splitPipelineLogFileKey,
String.valueOf(data.getFileBatch().getIdentity().getPipelineId()));
return attachmentHttpPipe.put(data.getFileBatch());
} finally {
MDC.remove(OtterConstants.splitPipelineLogFileKey);
}
}
});
}
try {
PipeChooseMode pipeChooseMode = pipeline.getParameters().getPipeChooseType();
if (pipeChooseMode.isAutomatic()) {
if (calculateSize(data) <= sizeThresold) {
keys.add(rowDataRpcPipe.put(data));
} else {
keys.add(rowDataHttpPipe.put(data));
}
} else if (pipeChooseMode.isRpc()) {
keys.add(rowDataRpcPipe.put(data));
} else if (pipeChooseMode.isHttp()) {
keys.add(rowDataHttpPipe.put(data));
} else {
throw new PipeException("pipeChooseMode is error!" + pipeChooseMode);
}
// 等待一下附件处理
if (future != null) {
keys.add(future.get());
}
} catch (Exception e) {
throw new PipeException(e);
}
}
return keys;
} }
|
public class class_name {
public List<PipeKey> put(final DbBatch data, Long nid) throws PipeException {
List<PipeKey> keys = new ArrayList<PipeKey>();
if (isLocal(nid)) {
keys.add(rowDataMemoryPipe.put(data));
} else {
Future<PipeKey> future = null;
Pipeline pipeline = configClientService.findPipeline(data.getRowBatch().getIdentity().getPipelineId());
if (data.getFileBatch() != null && !CollectionUtils.isEmpty(data.getFileBatch().getFiles())) {
future = executorService.submit(new Callable<PipeKey>() {
public PipeKey call() throws Exception {
try {
MDC.put(OtterConstants.splitPipelineLogFileKey,
String.valueOf(data.getFileBatch().getIdentity().getPipelineId()));
return attachmentHttpPipe.put(data.getFileBatch());
} finally {
MDC.remove(OtterConstants.splitPipelineLogFileKey); // depends on control dependency: [if], data = [none]
}
}
});
}
try {
PipeChooseMode pipeChooseMode = pipeline.getParameters().getPipeChooseType();
if (pipeChooseMode.isAutomatic()) {
if (calculateSize(data) <= sizeThresold) {
keys.add(rowDataRpcPipe.put(data));
} else {
keys.add(rowDataHttpPipe.put(data));
}
} else if (pipeChooseMode.isRpc()) {
keys.add(rowDataRpcPipe.put(data));
} else if (pipeChooseMode.isHttp()) {
keys.add(rowDataHttpPipe.put(data));
} else {
throw new PipeException("pipeChooseMode is error!" + pipeChooseMode);
}
// 等待一下附件处理
if (future != null) {
keys.add(future.get());
}
} catch (Exception e) {
throw new PipeException(e);
}
}
return keys;
} }
|
public class class_name {
public void assignType(XAttribute attribute, String type) {
if (type != null && type.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_TYPE.clone();
attr.setValue(type);
attribute.getAttributes().put(KEY_TYPE, attr);
}
} }
|
public class class_name {
public void assignType(XAttribute attribute, String type) {
if (type != null && type.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_TYPE.clone();
attr.setValue(type);
// depends on control dependency: [if], data = [(type]
attribute.getAttributes().put(KEY_TYPE, attr);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String getMimeType(byte[] barr, String defaultValue) {
PrintStream out = System.out;
try {
Tika tika = new Tika();
return tika.detect(barr);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
}
} }
|
public class class_name {
public static String getMimeType(byte[] barr, String defaultValue) {
PrintStream out = System.out;
try {
Tika tika = new Tika();
return tika.detect(barr); // depends on control dependency: [try], data = [none]
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private String escapeForPOFile(final String input, boolean fix) {
if (input == null) return "";
String escapedString = input;
// Publican escapes greater/lesser than to XML entities
if (fix && (input.contains(" < ") || input.contains(" > "))) {
// Loop over and find all the XML Elements as they should remain untouched.
final LinkedList<String> elements = new LinkedList<String>();
if (input.indexOf('<') != -1) {
int index = -1;
while ((index = input.indexOf('<', index + 1)) != -1) {
int endIndex = input.indexOf('>', index);
int nextIndex = input.indexOf('<', index + 1);
/*
* If the next opening tag is less than the next ending tag, than the current opening tag isn't a match for the next
* ending tag, so continue to the next one
*/
if (endIndex == -1 || (nextIndex != -1 && nextIndex < endIndex)) {
continue;
} else if (index + 1 == endIndex) {
// This is a <> sequence, so it should be ignored as well.
continue;
} else {
elements.add(input.substring(index, endIndex + 1));
}
}
}
// Find all the elements and replace them with a marker
for (int count = 0; count < elements.size(); count++) {
escapedString = escapedString.replace(elements.get(count), "###" + count + "###");
}
// Perform the replacements on what's left
escapedString = escapedString.replace("<", "<").replace(">", ">");
// Replace the markers
for (int count = 0; count < elements.size(); count++) {
escapedString = escapedString.replace("###" + count + "###", elements.get(count));
}
}
return escapedString.replace("\\", "\\\\")
.replace("\"", "\\\"")
.replace("\n", "\\n")
.replace("\r", "\\r");
} }
|
public class class_name {
private String escapeForPOFile(final String input, boolean fix) {
if (input == null) return "";
String escapedString = input;
// Publican escapes greater/lesser than to XML entities
if (fix && (input.contains(" < ") || input.contains(" > "))) {
// Loop over and find all the XML Elements as they should remain untouched.
final LinkedList<String> elements = new LinkedList<String>();
if (input.indexOf('<') != -1) {
int index = -1;
while ((index = input.indexOf('<', index + 1)) != -1) {
int endIndex = input.indexOf('>', index);
int nextIndex = input.indexOf('<', index + 1);
/*
* If the next opening tag is less than the next ending tag, than the current opening tag isn't a match for the next
* ending tag, so continue to the next one
*/
if (endIndex == -1 || (nextIndex != -1 && nextIndex < endIndex)) {
continue;
} else if (index + 1 == endIndex) {
// This is a <> sequence, so it should be ignored as well.
continue;
} else {
elements.add(input.substring(index, endIndex + 1)); // depends on control dependency: [if], data = [none]
}
}
}
// Find all the elements and replace them with a marker
for (int count = 0; count < elements.size(); count++) {
escapedString = escapedString.replace(elements.get(count), "###" + count + "###"); // depends on control dependency: [for], data = [count]
}
// Perform the replacements on what's left
escapedString = escapedString.replace("<", "<").replace(">", ">"); // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
// Replace the markers
for (int count = 0; count < elements.size(); count++) {
escapedString = escapedString.replace("###" + count + "###", elements.get(count)); // depends on control dependency: [for], data = [count]
}
}
return escapedString.replace("\\", "\\\\")
.replace("\"", "\\\"")
.replace("\n", "\\n")
.replace("\r", "\\r");
} }
|
public class class_name {
Map<String, String> extractParameters(final String metricName) {
final Matcher matcher = this.pattern.matcher(metricName);
final Map<String, String> params = new HashMap<String, String>();
if (matcher.find()) {
for (int i = 1; i <= matcher.groupCount(); i++) {
params.put(String.format("${%d}", i - 1), matcher.group(i));
}
}
return params;
} }
|
public class class_name {
Map<String, String> extractParameters(final String metricName) {
final Matcher matcher = this.pattern.matcher(metricName);
final Map<String, String> params = new HashMap<String, String>();
if (matcher.find()) {
for (int i = 1; i <= matcher.groupCount(); i++) {
params.put(String.format("${%d}", i - 1), matcher.group(i)); // depends on control dependency: [for], data = [i]
}
}
return params;
} }
|
public class class_name {
public void removeConsumerListForExpression(
String topicExpression,
boolean selector,
boolean isWildcarded)
{
if (tc.isEntryEnabled())
SibTr.entry(tc,
"removeConsumerListForExpression",
new Object[]{topicExpression,
new Boolean(selector),
new Boolean(isWildcarded)});
if(selector)
{
if(isWildcarded)
{
// Selector and wildcarded
ArrayList consumerList = (ArrayList)_wildcardSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:265:1.5",
topicExpression });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:272:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_wildcardSelectorSubs.isEmpty())
_areWildcardSelectorSubs = false;
}
else
{
// Selector but not wildcarded
ArrayList consumerList = (ArrayList)_exactSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:296:1.5",
topicExpression });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:303:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_exactSelectorSubs.isEmpty())
_areExactSelectorSubs = false;
}
}
else
{
// No Selector expression
if(isWildcarded)
{
// No selector and wildcarded
ArrayList consumerList = (ArrayList)_wildcardNonSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:331:1.5",
topicExpression });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:338:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_wildcardNonSelectorSubs.isEmpty())
_areWildcardNonSelectorSubs = false;
}
else
{
// No selector and not wildcarded
ArrayList consumerList = (ArrayList)_exactNonSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:362:1.5",
topicExpression });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:369:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_exactNonSelectorSubs.isEmpty())
_areExactNonSelectorSubs = false;
}
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerListForExpression");
} }
|
public class class_name {
public void removeConsumerListForExpression(
String topicExpression,
boolean selector,
boolean isWildcarded)
{
if (tc.isEntryEnabled())
SibTr.entry(tc,
"removeConsumerListForExpression",
new Object[]{topicExpression,
new Boolean(selector),
new Boolean(isWildcarded)});
if(selector)
{
if(isWildcarded)
{
// Selector and wildcarded
ArrayList consumerList = (ArrayList)_wildcardSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:265:1.5",
topicExpression }); // depends on control dependency: [if], data = [none]
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:272:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_wildcardSelectorSubs.isEmpty())
_areWildcardSelectorSubs = false;
}
else
{
// Selector but not wildcarded
ArrayList consumerList = (ArrayList)_exactSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:296:1.5",
topicExpression }); // depends on control dependency: [if], data = [none]
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:303:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_exactSelectorSubs.isEmpty())
_areExactSelectorSubs = false;
}
}
else
{
// No Selector expression
if(isWildcarded)
{
// No selector and wildcarded
ArrayList consumerList = (ArrayList)_wildcardNonSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:331:1.5",
topicExpression }); // depends on control dependency: [if], data = [none]
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:338:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_wildcardNonSelectorSubs.isEmpty())
_areWildcardNonSelectorSubs = false;
}
else
{
// No selector and not wildcarded
ArrayList consumerList = (ArrayList)_exactNonSelectorSubs.remove(topicExpression);
if(consumerList == null)
{
// Couldn't find the consumerlist. This means we have an internal
// inconsistency in our tables, so throw an SIErrorException
// Build the message for the Exception
if (tc.isEntryEnabled())
SibTr.exit(tc, "removeConsumerListForExpression", topicExpression);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:362:1.5",
topicExpression }); // depends on control dependency: [if], data = [none]
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0005",
new Object[] {
"com.ibm.ws.sib.processor.matching.SubscriptionRegistrar",
"1:369:1.5",
topicExpression },
null));
}
// Test whether table is now empty
if(_exactNonSelectorSubs.isEmpty())
_areExactNonSelectorSubs = false;
}
}
if (tc.isEntryEnabled()) SibTr.exit(tc, "removeConsumerListForExpression");
} }
|
public class class_name {
protected void queueConnectForSelector(ConnectInfo connectInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "queueConnectForSelector");
}
try {
moveIntoPosition(connectCount, connect, connectInfo, CS_CONNECTOR);
} catch (IOException x) {
FFDCFilter.processException(x, getClass().getName(), "140", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught IOException...throwing RuntimeException");
}
throw new RuntimeException(x);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "queueConnectForSelector");
}
} }
|
public class class_name {
protected void queueConnectForSelector(ConnectInfo connectInfo) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "queueConnectForSelector"); // depends on control dependency: [if], data = [none]
}
try {
moveIntoPosition(connectCount, connect, connectInfo, CS_CONNECTOR); // depends on control dependency: [try], data = [none]
} catch (IOException x) {
FFDCFilter.processException(x, getClass().getName(), "140", this);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Caught IOException...throwing RuntimeException"); // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(x);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "queueConnectForSelector"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setHistorySettings(String historyEnabled, String historyVersions, String historyVersionsAfterDeletion) {
m_historyEnabled = Boolean.valueOf(historyEnabled).booleanValue();
m_historyVersions = Integer.valueOf(historyVersions).intValue();
m_historyVersionsAfterDeletion = Integer.valueOf(historyVersionsAfterDeletion).intValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_HISTORY_SETTINGS_3,
Boolean.valueOf(m_historyEnabled),
new Integer(m_historyVersions),
new Integer(m_historyVersionsAfterDeletion)));
}
} }
|
public class class_name {
public void setHistorySettings(String historyEnabled, String historyVersions, String historyVersionsAfterDeletion) {
m_historyEnabled = Boolean.valueOf(historyEnabled).booleanValue();
m_historyVersions = Integer.valueOf(historyVersions).intValue();
m_historyVersionsAfterDeletion = Integer.valueOf(historyVersionsAfterDeletion).intValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_HISTORY_SETTINGS_3,
Boolean.valueOf(m_historyEnabled),
new Integer(m_historyVersions),
new Integer(m_historyVersionsAfterDeletion))); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void to(WebContext context) {
HttpServletResponse response = context.response();
if (!mediaType.isEmpty()) {
response.setHeader("Content-Type", mediaType);
}
if (status > 0) {
response.setStatus(status);
}
if (entity == null) {
return;
}
try {
if (entity instanceof String) {
if (mediaType.isEmpty()) {
response.setHeader("Content-Type", MediaType.TEXT_PLAIN);
}
response.setCharacterEncoding("UTF-8");
response.getWriter().write((String) entity);
} else if (entity instanceof Serializable) {
new ObjectOutputStream(response.getOutputStream()).writeObject(entity);
} else {
if (mediaType.isEmpty()) {
response.setHeader("Content-Type", MediaType.TEXT_PLAIN);
}
response.setCharacterEncoding("UTF-8");
response.getWriter().write(entity.toString());
}
} catch (IOException e) {
throw new UncheckedException(e);
}
} }
|
public class class_name {
public void to(WebContext context) {
HttpServletResponse response = context.response();
if (!mediaType.isEmpty()) {
response.setHeader("Content-Type", mediaType); // depends on control dependency: [if], data = [none]
}
if (status > 0) {
response.setStatus(status); // depends on control dependency: [if], data = [(status]
}
if (entity == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
if (entity instanceof String) {
if (mediaType.isEmpty()) {
response.setHeader("Content-Type", MediaType.TEXT_PLAIN); // depends on control dependency: [if], data = [none]
}
response.setCharacterEncoding("UTF-8"); // depends on control dependency: [if], data = [none]
response.getWriter().write((String) entity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof Serializable) {
new ObjectOutputStream(response.getOutputStream()).writeObject(entity); // depends on control dependency: [if], data = [none]
} else {
if (mediaType.isEmpty()) {
response.setHeader("Content-Type", MediaType.TEXT_PLAIN); // depends on control dependency: [if], data = [none]
}
response.setCharacterEncoding("UTF-8"); // depends on control dependency: [if], data = [none]
response.getWriter().write(entity.toString()); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
throw new UncheckedException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean containsKey(String field) {
try {
return getJedisCommands(groupName).hexists(key, field);
} finally {
getJedisProvider(groupName).release();
}
} }
|
public class class_name {
public boolean containsKey(String field) {
try {
return getJedisCommands(groupName).hexists(key, field); // depends on control dependency: [try], data = [none]
} finally {
getJedisProvider(groupName).release();
}
} }
|
public class class_name {
@Nullable
public String get(int n) {
if (capitalword_) return null;
int len = grams_.length();
if (n < 1 || n > N_GRAM || len < n) return null;
if (n == 1) {
char ch = grams_.charAt(len - 1);
if (ch == ' ') return null;
return Character.toString(ch);
} else {
return grams_.substring(len - n, len);
}
} }
|
public class class_name {
@Nullable
public String get(int n) {
if (capitalword_) return null;
int len = grams_.length();
if (n < 1 || n > N_GRAM || len < n) return null;
if (n == 1) {
char ch = grams_.charAt(len - 1);
if (ch == ' ') return null;
return Character.toString(ch); // depends on control dependency: [if], data = [none]
} else {
return grams_.substring(len - n, len); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(Label label, ProtocolMarshaller protocolMarshaller) {
if (label == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(label.getName(), NAME_BINDING);
protocolMarshaller.marshall(label.getConfidence(), CONFIDENCE_BINDING);
protocolMarshaller.marshall(label.getInstances(), INSTANCES_BINDING);
protocolMarshaller.marshall(label.getParents(), PARENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Label label, ProtocolMarshaller protocolMarshaller) {
if (label == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(label.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(label.getConfidence(), CONFIDENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(label.getInstances(), INSTANCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(label.getParents(), PARENTS_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 {
@SuppressWarnings("UnusedParameters")
protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch) {
LogTemplate<Split> logTemplate;
if (logEnabled) {
logTemplate = everyNSeconds(enabledStopwatchLogTemplate, 60);
} else {
logTemplate = disabled();
}
return logTemplate;
} }
|
public class class_name {
@SuppressWarnings("UnusedParameters")
protected LogTemplate<Split> createLogTemplate(Stopwatch stopwatch) {
LogTemplate<Split> logTemplate;
if (logEnabled) {
logTemplate = everyNSeconds(enabledStopwatchLogTemplate, 60);
// depends on control dependency: [if], data = [none]
} else {
logTemplate = disabled();
// depends on control dependency: [if], data = [none]
}
return logTemplate;
} }
|
public class class_name {
protected void process(final Job job, final String curQueue) {
boolean success = false;
try {
this.processingJob.set(true);
if (threadNameChangingEnabled) {
renameThread("Processing " + curQueue + " since " + System.currentTimeMillis());
}
this.listenerDelegate.fireEvent(JOB_PROCESS, this, curQueue, job, null, null, null);
PoolUtils.doWorkInPool(this.jedisPool, new PoolWork<Jedis, Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void doWork(final Jedis jedis) throws IOException {
jedis.set(key(WORKER, name), statusMsg(curQueue, job));
return null;
}
});
final Object instance = this.jobFactory.materializeJob(job);
final Object result = execute(job, curQueue, instance);
success(job, instance, result, curQueue);
success = true;
} catch (Throwable thrwbl) {
failure(thrwbl, job, curQueue);
} finally {
final boolean skipReque = success;
PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void doWork(final Jedis jedis) {
removeInFlight(jedis, curQueue, skipReque);
jedis.del(key(WORKER, name));
return null;
}
});
this.processingJob.set(false);
}
} }
|
public class class_name {
protected void process(final Job job, final String curQueue) {
boolean success = false;
try {
this.processingJob.set(true); // depends on control dependency: [try], data = [none]
if (threadNameChangingEnabled) {
renameThread("Processing " + curQueue + " since " + System.currentTimeMillis()); // depends on control dependency: [if], data = [none]
}
this.listenerDelegate.fireEvent(JOB_PROCESS, this, curQueue, job, null, null, null); // depends on control dependency: [try], data = [none]
PoolUtils.doWorkInPool(this.jedisPool, new PoolWork<Jedis, Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void doWork(final Jedis jedis) throws IOException {
jedis.set(key(WORKER, name), statusMsg(curQueue, job));
return null;
}
}); // depends on control dependency: [try], data = [none]
final Object instance = this.jobFactory.materializeJob(job);
final Object result = execute(job, curQueue, instance);
success(job, instance, result, curQueue); // depends on control dependency: [try], data = [none]
success = true; // depends on control dependency: [try], data = [none]
} catch (Throwable thrwbl) {
failure(thrwbl, job, curQueue);
} finally { // depends on control dependency: [catch], data = [none]
final boolean skipReque = success;
PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void doWork(final Jedis jedis) {
removeInFlight(jedis, curQueue, skipReque);
jedis.del(key(WORKER, name));
return null;
}
});
this.processingJob.set(false);
}
} }
|
public class class_name {
public static boolean start(RootDoc root) {
try {
String filename = "classes.xmi";
PrintWriter out = new PrintWriter((Writer)new FileWriter(filename));
XMIDoclet doclet = new XMIDoclet(out);
doclet.process(root);
out.flush();
return true;
} catch (Exception e) {
System.err.println(e.toString());
return false;
}
} }
|
public class class_name {
public static boolean start(RootDoc root) {
try {
String filename = "classes.xmi";
PrintWriter out = new PrintWriter((Writer)new FileWriter(filename));
XMIDoclet doclet = new XMIDoclet(out);
doclet.process(root); // depends on control dependency: [try], data = [none]
out.flush(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.err.println(e.toString());
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void accept(Visitor<OptimizerNode> visitor) {
if (visitor.preVisit(this)) {
if (getPredecessorNode() != null) {
getPredecessorNode().accept(visitor);
} else {
throw new CompilerException();
}
visitor.postVisit(this);
}
} }
|
public class class_name {
@Override
public void accept(Visitor<OptimizerNode> visitor) {
if (visitor.preVisit(this)) {
if (getPredecessorNode() != null) {
getPredecessorNode().accept(visitor); // depends on control dependency: [if], data = [none]
} else {
throw new CompilerException();
}
visitor.postVisit(this); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Map<String, String> getProperties() {
HashMap<String, String> props = new HashMap<>();
Properties sysProps = getSystemProperties();
Set<String> keys = sysProps.stringPropertyNames();
for (String key : keys) {
if (key != null) {
String value = sysProps.getProperty(key);
if (value != null) { //it is possible that a property could be removed while we are looking at them
props.put(key, value);
}
}
}
return props;
} }
|
public class class_name {
@Override
public Map<String, String> getProperties() {
HashMap<String, String> props = new HashMap<>();
Properties sysProps = getSystemProperties();
Set<String> keys = sysProps.stringPropertyNames();
for (String key : keys) {
if (key != null) {
String value = sysProps.getProperty(key);
if (value != null) { //it is possible that a property could be removed while we are looking at them
props.put(key, value); // depends on control dependency: [if], data = [none]
}
}
}
return props;
} }
|
public class class_name {
private I_CmsStringModel getStringModel(CmsPathValue pathValue) {
String path = pathValue.getPath();
I_CmsStringModel model = m_models.get(path);
if (model == null) {
String[] tokens = path.split("/");
String id = tokens[0];
String propName = tokens[1];
boolean isStructure = tokens[2].equals("S");
model = createStringModel(new CmsUUID(id), propName, isStructure);
m_models.put(path, model);
}
return model;
} }
|
public class class_name {
private I_CmsStringModel getStringModel(CmsPathValue pathValue) {
String path = pathValue.getPath();
I_CmsStringModel model = m_models.get(path);
if (model == null) {
String[] tokens = path.split("/");
String id = tokens[0];
String propName = tokens[1];
boolean isStructure = tokens[2].equals("S");
model = createStringModel(new CmsUUID(id), propName, isStructure); // depends on control dependency: [if], data = [none]
m_models.put(path, model); // depends on control dependency: [if], data = [none]
}
return model;
} }
|
public class class_name {
private static String getLocalizedValues(final String locale, final List<?> items) {
val foundLocale = findLocale(StringUtils.defaultString(locale, "en"), items);
if (foundLocale.isPresent()) {
return foundLocale.get();
}
if (!items.isEmpty()) {
val item = items.get(0);
var value = StringUtils.EMPTY;
if (item instanceof LocalizedName) {
value = ((LocalizedName) item).getValue();
}
if (item instanceof LocalizedURI) {
value = ((LocalizedURI) item).getValue();
}
if (item instanceof XSString) {
value = ((XSString) item).getValue();
}
LOGGER.trace("Loading first available locale [{}]", value);
return value;
}
return null;
} }
|
public class class_name {
private static String getLocalizedValues(final String locale, final List<?> items) {
val foundLocale = findLocale(StringUtils.defaultString(locale, "en"), items);
if (foundLocale.isPresent()) {
return foundLocale.get(); // depends on control dependency: [if], data = [none]
}
if (!items.isEmpty()) {
val item = items.get(0);
var value = StringUtils.EMPTY;
if (item instanceof LocalizedName) {
value = ((LocalizedName) item).getValue(); // depends on control dependency: [if], data = [none]
}
if (item instanceof LocalizedURI) {
value = ((LocalizedURI) item).getValue(); // depends on control dependency: [if], data = [none]
}
if (item instanceof XSString) {
value = ((XSString) item).getValue(); // depends on control dependency: [if], data = [none]
}
LOGGER.trace("Loading first available locale [{}]", value);
return value; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static <T> List<T> setOrAppend(List<T> list, int index, T element) {
if (index < list.size()) {
list.set(index, element);
} else {
list.add(element);
}
return list;
} }
|
public class class_name {
public static <T> List<T> setOrAppend(List<T> list, int index, T element) {
if (index < list.size()) {
list.set(index, element);
// depends on control dependency: [if], data = [(index]
} else {
list.add(element);
// depends on control dependency: [if], data = [none]
}
return list;
} }
|
public class class_name {
public void setBackgroundColor(int color) {
mBackgroundColor = color;
if (mQuerySection != null && mSuggestionsList != null) {
mQuerySection.setCardBackgroundColor(color);
mSuggestionsList.setBackgroundColor(color);
}
} }
|
public class class_name {
public void setBackgroundColor(int color) {
mBackgroundColor = color;
if (mQuerySection != null && mSuggestionsList != null) {
mQuerySection.setCardBackgroundColor(color); // depends on control dependency: [if], data = [none]
mSuggestionsList.setBackgroundColor(color); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public int addValue(Object[] array) {
int val = hashCode();
for (Object obj : array) {
val = addValue(obj);
}
return val;
} }
|
public class class_name {
public int addValue(Object[] array) {
int val = hashCode();
for (Object obj : array) {
val = addValue(obj); // depends on control dependency: [for], data = [obj]
}
return val;
} }
|
public class class_name {
@Override
public EClass getIfcSpatialZoneType() {
if (ifcSpatialZoneTypeEClass == null) {
ifcSpatialZoneTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(619);
}
return ifcSpatialZoneTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcSpatialZoneType() {
if (ifcSpatialZoneTypeEClass == null) {
ifcSpatialZoneTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(619);
// depends on control dependency: [if], data = [none]
}
return ifcSpatialZoneTypeEClass;
} }
|
public class class_name {
void addPoint(GraphicPoint offPt, int i_src) {
if (m_offsetPtCount == 0) // TODO: can we have this outside of this
// method?
{
addPoint(offPt);
return;
}
int n_src = m_srcPtCount;
GraphicPoint pt1, pt;
pt1 = m_srcPts.get(i_src == 0 ? n_src - 1 : i_src - 1);
pt = m_srcPts.get(i_src);
// calculate scalar product to determine if the offset segment goes in
// the same/opposite direction compared to the original one
double s = scal(pt1, pt, m_offsetPts.get(m_offsetPtCount - 1), offPt);
if (s > 0)
// original segment and offset segment go in the same direction. Just
// add the point
{
addPoint(offPt);
return;
}
if (s < 0) {
// we will add a loop. We need to make sure the points we introduce
// don't generate a "reversed" segment
// let's project the first point of the reversed segment
// (m_offsetPts + m_offsetPtCount - 1) to check
// if it falls on the good side of the original segment (scalar
// product sign again)
if (scal(pt1, pt, pt, m_offsetPts.get(m_offsetPtCount - 1)) > 0) {
GraphicPoint p;
// change value of m_offsetPts + m_offsetPtCount - 1
int k;
if (i_src == 0)
k = n_src - 2;
else if (i_src == 1)
k = n_src - 1;
else
k = i_src - 2;
GraphicPoint pt0 = m_srcPts.get(k);
double a = Math.atan2(pt1.y - pt0.y, pt1.x - pt0.x);
p = new GraphicPoint(pt1, m_distance, a - half_pi);
m_offsetPts.set(m_offsetPtCount - 1, p);
if (m_joins == OperatorOffset.JoinType.Bevel
|| m_joins == OperatorOffset.JoinType.Miter) {
// this block is added as well as the commented BAD_SEG in
// the next block
p = new GraphicPoint(p, pt1);
addPoint(p);
// "bad" segment
p = new GraphicPoint(pt1, m_distance, m_a1 + half_pi);
GraphicPoint p_ = new GraphicPoint(p, pt1);
p_.type |= BAD_SEG;
addPoint(p_);
addPoint(p);
} else {
// the working stuff for round and square
// "bad" segment
p = new GraphicPoint(pt1, m_distance, m_a1 + half_pi);
p.type |= BAD_SEG;
addPoint(p);
}
// add offPt
addPoint(offPt, i_src);
} else {
GraphicPoint p;
// we don't add offPt but the loop containing the "bad" segment
p = new GraphicPoint(pt, m_distance, m_a1 + half_pi);
addPoint(p);
if (m_joins == OperatorOffset.JoinType.Bevel
|| m_joins == OperatorOffset.JoinType.Miter) {
// this block is added as well as the commented BAD_SEG in
// the next block
p = new GraphicPoint(p, pt);
addPoint(p);
p = new GraphicPoint(pt, m_distance, m_a2 - half_pi);
GraphicPoint p_ = new GraphicPoint(p, pt);
p_.type |= BAD_SEG;
addPoint(p_);
addPoint(p);
} else {
// the working stuff for round and square
p = new GraphicPoint(pt, m_distance, m_a2 - half_pi);
p.type |= BAD_SEG;
addPoint(p);
}
}
}
} }
|
public class class_name {
void addPoint(GraphicPoint offPt, int i_src) {
if (m_offsetPtCount == 0) // TODO: can we have this outside of this
// method?
{
addPoint(offPt); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int n_src = m_srcPtCount;
GraphicPoint pt1, pt;
pt1 = m_srcPts.get(i_src == 0 ? n_src - 1 : i_src - 1);
pt = m_srcPts.get(i_src);
// calculate scalar product to determine if the offset segment goes in
// the same/opposite direction compared to the original one
double s = scal(pt1, pt, m_offsetPts.get(m_offsetPtCount - 1), offPt);
if (s > 0)
// original segment and offset segment go in the same direction. Just
// add the point
{
addPoint(offPt); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (s < 0) {
// we will add a loop. We need to make sure the points we introduce
// don't generate a "reversed" segment
// let's project the first point of the reversed segment
// (m_offsetPts + m_offsetPtCount - 1) to check
// if it falls on the good side of the original segment (scalar
// product sign again)
if (scal(pt1, pt, pt, m_offsetPts.get(m_offsetPtCount - 1)) > 0) {
GraphicPoint p;
// change value of m_offsetPts + m_offsetPtCount - 1
int k;
if (i_src == 0)
k = n_src - 2;
else if (i_src == 1)
k = n_src - 1;
else
k = i_src - 2;
GraphicPoint pt0 = m_srcPts.get(k);
double a = Math.atan2(pt1.y - pt0.y, pt1.x - pt0.x);
p = new GraphicPoint(pt1, m_distance, a - half_pi); // depends on control dependency: [if], data = [none]
m_offsetPts.set(m_offsetPtCount - 1, p); // depends on control dependency: [if], data = [none]
if (m_joins == OperatorOffset.JoinType.Bevel
|| m_joins == OperatorOffset.JoinType.Miter) {
// this block is added as well as the commented BAD_SEG in
// the next block
p = new GraphicPoint(p, pt1); // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
// "bad" segment
p = new GraphicPoint(pt1, m_distance, m_a1 + half_pi); // depends on control dependency: [if], data = [none]
GraphicPoint p_ = new GraphicPoint(p, pt1);
p_.type |= BAD_SEG; // depends on control dependency: [if], data = [none]
addPoint(p_); // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
} else {
// the working stuff for round and square
// "bad" segment
p = new GraphicPoint(pt1, m_distance, m_a1 + half_pi); // depends on control dependency: [if], data = [none]
p.type |= BAD_SEG; // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
}
// add offPt
addPoint(offPt, i_src); // depends on control dependency: [if], data = [none]
} else {
GraphicPoint p;
// we don't add offPt but the loop containing the "bad" segment
p = new GraphicPoint(pt, m_distance, m_a1 + half_pi); // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
if (m_joins == OperatorOffset.JoinType.Bevel
|| m_joins == OperatorOffset.JoinType.Miter) {
// this block is added as well as the commented BAD_SEG in
// the next block
p = new GraphicPoint(p, pt); // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
p = new GraphicPoint(pt, m_distance, m_a2 - half_pi); // depends on control dependency: [if], data = [none]
GraphicPoint p_ = new GraphicPoint(p, pt);
p_.type |= BAD_SEG; // depends on control dependency: [if], data = [none]
addPoint(p_); // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
} else {
// the working stuff for round and square
p = new GraphicPoint(pt, m_distance, m_a2 - half_pi); // depends on control dependency: [if], data = [none]
p.type |= BAD_SEG; // depends on control dependency: [if], data = [none]
addPoint(p); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public boolean regionMatches(int thisStart, CharSequence string, int start, int length) {
if (string == null) {
throw new NullPointerException("string");
}
if (start < 0 || string.length() - start < length) {
return false;
}
final int thisLen = length();
if (thisStart < 0 || thisLen - thisStart < length) {
return false;
}
if (length <= 0) {
return true;
}
final int thatEnd = start + length;
for (int i = start, j = thisStart + arrayOffset(); i < thatEnd; i++, j++) {
if (b2c(value[j]) != string.charAt(i)) {
return false;
}
}
return true;
} }
|
public class class_name {
public boolean regionMatches(int thisStart, CharSequence string, int start, int length) {
if (string == null) {
throw new NullPointerException("string");
}
if (start < 0 || string.length() - start < length) {
return false; // depends on control dependency: [if], data = [none]
}
final int thisLen = length();
if (thisStart < 0 || thisLen - thisStart < length) {
return false; // depends on control dependency: [if], data = [none]
}
if (length <= 0) {
return true; // depends on control dependency: [if], data = [none]
}
final int thatEnd = start + length;
for (int i = start, j = thisStart + arrayOffset(); i < thatEnd; i++, j++) {
if (b2c(value[j]) != string.charAt(i)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public void marshall(DeleteServiceRequest deleteServiceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteServiceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteServiceRequest.getId(), ID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteServiceRequest deleteServiceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteServiceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteServiceRequest.getId(), ID_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 {
@Override
public void preProcess(DataSet toPreProcess) {
for (DataSetPreProcessor preProcessor : preProcessors) {
preProcessor.preProcess(toPreProcess);
}
} }
|
public class class_name {
@Override
public void preProcess(DataSet toPreProcess) {
for (DataSetPreProcessor preProcessor : preProcessors) {
preProcessor.preProcess(toPreProcess); // depends on control dependency: [for], data = [preProcessor]
}
} }
|
public class class_name {
public DirectionsApiRequest waypoints(LatLng... waypoints) {
Waypoint[] objWaypoints = new Waypoint[waypoints.length];
for (int i = 0; i < waypoints.length; i++) {
objWaypoints[i] = new Waypoint(waypoints[i]);
}
return waypoints(objWaypoints);
} }
|
public class class_name {
public DirectionsApiRequest waypoints(LatLng... waypoints) {
Waypoint[] objWaypoints = new Waypoint[waypoints.length];
for (int i = 0; i < waypoints.length; i++) {
objWaypoints[i] = new Waypoint(waypoints[i]); // depends on control dependency: [for], data = [i]
}
return waypoints(objWaypoints);
} }
|
public class class_name {
public java.util.List<String> getInstancesToTerminate() {
if (instancesToTerminate == null) {
instancesToTerminate = new com.amazonaws.internal.SdkInternalList<String>();
}
return instancesToTerminate;
} }
|
public class class_name {
public java.util.List<String> getInstancesToTerminate() {
if (instancesToTerminate == null) {
instancesToTerminate = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return instancesToTerminate;
} }
|
public class class_name {
public String groupHtml(CmsWorkplace wp) {
StringBuffer html = new StringBuffer(512);
html.append(htmlStart(wp));
Iterator<CmsAdminMenuItem> itItem = m_container.elementList().iterator();
while (itItem.hasNext()) {
CmsAdminMenuItem item = itItem.next();
html.append(item.itemHtml(wp));
html.append("\n");
}
html.append(htmlEnd());
return html.toString();
} }
|
public class class_name {
public String groupHtml(CmsWorkplace wp) {
StringBuffer html = new StringBuffer(512);
html.append(htmlStart(wp));
Iterator<CmsAdminMenuItem> itItem = m_container.elementList().iterator();
while (itItem.hasNext()) {
CmsAdminMenuItem item = itItem.next();
html.append(item.itemHtml(wp)); // depends on control dependency: [while], data = [none]
html.append("\n"); // depends on control dependency: [while], data = [none]
}
html.append(htmlEnd());
return html.toString();
} }
|
public class class_name {
public void decompose(CharSequence s, int src, int limit, StringBuilder dest,
int destLengthEstimate) {
if(destLengthEstimate<0) {
destLengthEstimate=limit-src;
}
dest.setLength(0);
ReorderingBuffer buffer=new ReorderingBuffer(this, dest, destLengthEstimate);
decompose(s, src, limit, buffer);
} }
|
public class class_name {
public void decompose(CharSequence s, int src, int limit, StringBuilder dest,
int destLengthEstimate) {
if(destLengthEstimate<0) {
destLengthEstimate=limit-src; // depends on control dependency: [if], data = [none]
}
dest.setLength(0);
ReorderingBuffer buffer=new ReorderingBuffer(this, dest, destLengthEstimate);
decompose(s, src, limit, buffer);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> TypeInformation<T> convertToTypeInfo(String avroSchemaString) {
Preconditions.checkNotNull(avroSchemaString, "Avro schema must not be null.");
final Schema schema;
try {
schema = new Schema.Parser().parse(avroSchemaString);
} catch (SchemaParseException e) {
throw new IllegalArgumentException("Could not parse Avro schema string.", e);
}
return (TypeInformation<T>) convertToTypeInfo(schema);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static <T> TypeInformation<T> convertToTypeInfo(String avroSchemaString) {
Preconditions.checkNotNull(avroSchemaString, "Avro schema must not be null.");
final Schema schema;
try {
schema = new Schema.Parser().parse(avroSchemaString); // depends on control dependency: [try], data = [none]
} catch (SchemaParseException e) {
throw new IllegalArgumentException("Could not parse Avro schema string.", e);
} // depends on control dependency: [catch], data = [none]
return (TypeInformation<T>) convertToTypeInfo(schema);
} }
|
public class class_name {
public Map<String, Object> toRepresentation() {
Map<String, Object> representation = new HashMap<>();
if (templated()) {
representation.put("href-template", hrefTemplate);
representation.put("href-vars", hrefVars());
} else {
representation.put("href", href);
}
if (hints != null) {
Map<String, Object> hintsRepresentation = hints.toRepresentation();
if (!hintsRepresentation.isEmpty()) {
representation.put("hints", hintsRepresentation);
}
}
return representation;
} }
|
public class class_name {
public Map<String, Object> toRepresentation() {
Map<String, Object> representation = new HashMap<>();
if (templated()) {
representation.put("href-template", hrefTemplate); // depends on control dependency: [if], data = [none]
representation.put("href-vars", hrefVars()); // depends on control dependency: [if], data = [none]
} else {
representation.put("href", href); // depends on control dependency: [if], data = [none]
}
if (hints != null) {
Map<String, Object> hintsRepresentation = hints.toRepresentation();
if (!hintsRepresentation.isEmpty()) {
representation.put("hints", hintsRepresentation); // depends on control dependency: [if], data = [none]
}
}
return representation;
} }
|
public class class_name {
private static boolean isToken(String value) {
// ----- BEGIN android -----
if (RESERVED_NAMES.contains(value.toLowerCase(Locale.US))) {
return false;
}
// ----- END android -----
int len = value.length();
for (int i = 0; i < len; i++) {
char c = value.charAt(i);
if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
return false;
}
return true;
} }
|
public class class_name {
private static boolean isToken(String value) {
// ----- BEGIN android -----
if (RESERVED_NAMES.contains(value.toLowerCase(Locale.US))) {
return false; // depends on control dependency: [if], data = [none]
}
// ----- END android -----
int len = value.length();
for (int i = 0; i < len; i++) {
char c = value.charAt(i);
if (c < 0x20 || c >= 0x7f || tspecials.indexOf(c) != -1)
return false;
}
return true;
} }
|
public class class_name {
public void addConverter(ValueConverter<?, ?> converter) {
getInitializationState().requireNotInitilized();
if (this.converters == null) {
this.converters = new ArrayList<>();
}
this.converters.add(converter);
} }
|
public class class_name {
public void addConverter(ValueConverter<?, ?> converter) {
getInitializationState().requireNotInitilized();
if (this.converters == null) {
this.converters = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
this.converters.add(converter);
} }
|
public class class_name {
@Override
public EClass getIfcEngine() {
if (ifcEngineEClass == null) {
ifcEngineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(233);
}
return ifcEngineEClass;
} }
|
public class class_name {
@Override
public EClass getIfcEngine() {
if (ifcEngineEClass == null) {
ifcEngineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(233);
// depends on control dependency: [if], data = [none]
}
return ifcEngineEClass;
} }
|
public class class_name {
private void prepareSuperColumn(ThriftRow tr, EntityMetadata m, Object value, byte[] name, long timestamp)
{
if (value != null)
{
if (m.isCounterColumnType())
{
CounterSuperColumn counterSuper = new CounterSuperColumn();
counterSuper.setName(name);
CounterColumn counterColumn = prepareCounterColumn((String) value, name);
List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>();
subCounterColumn.add(counterColumn);
counterSuper.setColumns(subCounterColumn);
tr.addCounterSuperColumn(counterSuper);
}
else
{
SuperColumn superCol = new SuperColumn();
superCol.setName(name);
Column column = prepareColumn((byte[]) value, name, timestamp, 0);
List<Column> subColumn = new ArrayList<Column>();
subColumn.add(column);
superCol.setColumns(subColumn);
tr.addSuperColumn(superCol);
}
}
} }
|
public class class_name {
private void prepareSuperColumn(ThriftRow tr, EntityMetadata m, Object value, byte[] name, long timestamp)
{
if (value != null)
{
if (m.isCounterColumnType())
{
CounterSuperColumn counterSuper = new CounterSuperColumn();
counterSuper.setName(name); // depends on control dependency: [if], data = [none]
CounterColumn counterColumn = prepareCounterColumn((String) value, name);
List<CounterColumn> subCounterColumn = new ArrayList<CounterColumn>();
subCounterColumn.add(counterColumn); // depends on control dependency: [if], data = [none]
counterSuper.setColumns(subCounterColumn); // depends on control dependency: [if], data = [none]
tr.addCounterSuperColumn(counterSuper); // depends on control dependency: [if], data = [none]
}
else
{
SuperColumn superCol = new SuperColumn();
superCol.setName(name); // depends on control dependency: [if], data = [none]
Column column = prepareColumn((byte[]) value, name, timestamp, 0);
List<Column> subColumn = new ArrayList<Column>();
subColumn.add(column); // depends on control dependency: [if], data = [none]
superCol.setColumns(subColumn); // depends on control dependency: [if], data = [none]
tr.addSuperColumn(superCol); // depends on control dependency: [if], data = [none]
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.