code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public int[] extractUShortArray() throws DevFailed {
manageExceptions("extractUShortArray");
if (use_union) {
final short[] argOut = attributeValue_5.value.ushort_att_value();
final int[] val = new int[argOut.length];
for (int i = 0; i < argOut.length; i++) {
val[i] = 0xFFFF & argOut[i];
}
return val;
} else {
return deviceAttribute_3.extractUShortArray();
}
} }
|
public class class_name {
public int[] extractUShortArray() throws DevFailed {
manageExceptions("extractUShortArray");
if (use_union) {
final short[] argOut = attributeValue_5.value.ushort_att_value();
final int[] val = new int[argOut.length];
for (int i = 0; i < argOut.length; i++) {
val[i] = 0xFFFF & argOut[i]; // depends on control dependency: [for], data = [i]
}
return val;
} else {
return deviceAttribute_3.extractUShortArray();
}
} }
|
public class class_name {
public java.util.List<String> getEnableCloudwatchLogsExports() {
if (enableCloudwatchLogsExports == null) {
enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>();
}
return enableCloudwatchLogsExports;
} }
|
public class class_name {
public java.util.List<String> getEnableCloudwatchLogsExports() {
if (enableCloudwatchLogsExports == null) {
enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return enableCloudwatchLogsExports;
} }
|
public class class_name {
public void setWorkingSet(Set<K> workingSet) {
synchronized(workingSet) {
for (K key : workingSet) {
this.get(key);
}
}
} }
|
public class class_name {
public void setWorkingSet(Set<K> workingSet) {
synchronized(workingSet) {
for (K key : workingSet) {
this.get(key); // depends on control dependency: [for], data = [key]
}
}
} }
|
public class class_name {
public boolean defines(MethodMember method) {
for (MethodMember existingMethod : methods) {
// make sure it *really* defines it (i.e. it is not a catcher)
if (!MethodMember.isCatcher(existingMethod) && existingMethod.equals(method)) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean defines(MethodMember method) {
for (MethodMember existingMethod : methods) {
// make sure it *really* defines it (i.e. it is not a catcher)
if (!MethodMember.isCatcher(existingMethod) && existingMethod.equals(method)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public String performTask(String taskParameters) {
GetUrlTaskParameters taskParams =
GetUrlTaskParameters.deserialize(taskParameters);
String spaceId = taskParams.getSpaceId();
String contentId = taskParams.getContentId();
String resourcePrefix = taskParams.getResourcePrefix();
log.info("Performing " + TASK_NAME + " task with parameters: spaceId=" + spaceId +
", contentId=" + contentId + ", resourcePrefix=" + resourcePrefix);
// Will throw if bucket does not exist
String bucketName = unwrappedS3Provider.getBucketName(spaceId);
GetUrlTaskResult taskResult = new GetUrlTaskResult();
// Ensure that streaming service is on
checkThatStreamingServiceIsEnabled(spaceId, TASK_NAME);
// Retrieve the existing distribution for the given space
StreamingDistributionSummary existingDist =
getExistingDistribution(bucketName);
if (null == existingDist) {
throw new UnsupportedTaskException(TASK_NAME,
"The " + TASK_NAME + " task can only be used after a space has " +
"been configured to enable open streaming. Use " +
StorageTaskConstants.ENABLE_STREAMING_TASK_NAME +
" to enable open streaming on this space.");
}
String domainName = existingDist.getDomainName();
// Verify that this is an open distribution
if (!existingDist.getTrustedSigners().getItems().isEmpty()) {
throw new UnsupportedTaskException(TASK_NAME,
"The " + TASK_NAME + " task cannot be used to request a stream " +
"from a secure distribution. Use " +
StorageTaskConstants.GET_SIGNED_URL_TASK_NAME + " instead.");
}
// Create the resource Id, which may or may not require a prefix
// (such as "mp4:" for an mp4 file) depending on the intended player
String resourceId = contentId;
if (null != resourcePrefix && !resourcePrefix.equals("")) {
resourceId = resourcePrefix + contentId;
}
taskResult.setStreamUrl("rtmp://" + domainName + "/cfx/st/" + resourceId);
String toReturn = taskResult.serialize();
log.info("Result of " + TASK_NAME + " task: " + toReturn);
return toReturn;
} }
|
public class class_name {
public String performTask(String taskParameters) {
GetUrlTaskParameters taskParams =
GetUrlTaskParameters.deserialize(taskParameters);
String spaceId = taskParams.getSpaceId();
String contentId = taskParams.getContentId();
String resourcePrefix = taskParams.getResourcePrefix();
log.info("Performing " + TASK_NAME + " task with parameters: spaceId=" + spaceId +
", contentId=" + contentId + ", resourcePrefix=" + resourcePrefix);
// Will throw if bucket does not exist
String bucketName = unwrappedS3Provider.getBucketName(spaceId);
GetUrlTaskResult taskResult = new GetUrlTaskResult();
// Ensure that streaming service is on
checkThatStreamingServiceIsEnabled(spaceId, TASK_NAME);
// Retrieve the existing distribution for the given space
StreamingDistributionSummary existingDist =
getExistingDistribution(bucketName);
if (null == existingDist) {
throw new UnsupportedTaskException(TASK_NAME,
"The " + TASK_NAME + " task can only be used after a space has " +
"been configured to enable open streaming. Use " +
StorageTaskConstants.ENABLE_STREAMING_TASK_NAME +
" to enable open streaming on this space.");
}
String domainName = existingDist.getDomainName();
// Verify that this is an open distribution
if (!existingDist.getTrustedSigners().getItems().isEmpty()) {
throw new UnsupportedTaskException(TASK_NAME,
"The " + TASK_NAME + " task cannot be used to request a stream " +
"from a secure distribution. Use " +
StorageTaskConstants.GET_SIGNED_URL_TASK_NAME + " instead.");
}
// Create the resource Id, which may or may not require a prefix
// (such as "mp4:" for an mp4 file) depending on the intended player
String resourceId = contentId;
if (null != resourcePrefix && !resourcePrefix.equals("")) {
resourceId = resourcePrefix + contentId; // depends on control dependency: [if], data = [none]
}
taskResult.setStreamUrl("rtmp://" + domainName + "/cfx/st/" + resourceId);
String toReturn = taskResult.serialize();
log.info("Result of " + TASK_NAME + " task: " + toReturn);
return toReturn;
} }
|
public class class_name {
public void setEndpoints(java.util.Collection<Endpoint> endpoints) {
if (endpoints == null) {
this.endpoints = null;
return;
}
this.endpoints = new java.util.ArrayList<Endpoint>(endpoints);
} }
|
public class class_name {
public void setEndpoints(java.util.Collection<Endpoint> endpoints) {
if (endpoints == null) {
this.endpoints = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.endpoints = new java.util.ArrayList<Endpoint>(endpoints);
} }
|
public class class_name {
public void closeAllEmpty() {
CmsDebugLog.getInstance().printLine("closing all empty");
int childCount = getWidgetCount();
for (int index = 0; index < childCount; index++) {
CmsTreeItem item = getItem(index);
if (item.isOpen()) {
item.closeAllEmptyChildren();
}
}
} }
|
public class class_name {
public void closeAllEmpty() {
CmsDebugLog.getInstance().printLine("closing all empty");
int childCount = getWidgetCount();
for (int index = 0; index < childCount; index++) {
CmsTreeItem item = getItem(index);
if (item.isOpen()) {
item.closeAllEmptyChildren(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static File getFile(String resourceOrFile, Class<?> cls,
boolean deleteTmpOnExit) throws FileNotFoundException {
try {
// jar:file:/home/.../blue.jar!/path/to/file.xml
URI uri = getURL(resourceOrFile, cls).toURI();
String uriStr = uri.toString();
if (uriStr.startsWith("jar")) {
if (uriStr.endsWith("/")) {
throw new UnsupportedOperationException(
"cannot unjar directories, only files");
}
String jarPath = uriStr.substring(4, uriStr.indexOf("!"))
.replace("file:", "");
String filePath = uriStr.substring(uriStr.indexOf("!") + 2);
JarFile jarFile = new JarFile(jarPath);
assert (jarFile.size() > 0) : "no jarFile at " + jarPath;
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
if (jarEntry.toString().equals(filePath)) {
InputStream input = jarFile.getInputStream(jarEntry);
assert (input != null) : "empty is for " + jarEntry;
return tmpFileFromStream(input, filePath,
deleteTmpOnExit);
}
}
assert (false) : "file" + filePath + " not found in " + jarPath;
return null;
} else {
return new File(uri);
}
} catch (URISyntaxException e) {
throw new FileNotFoundException(resourceOrFile);
} catch (IOException e) {
throw new FileNotFoundException(resourceOrFile);
}
} }
|
public class class_name {
public static File getFile(String resourceOrFile, Class<?> cls,
boolean deleteTmpOnExit) throws FileNotFoundException {
try {
// jar:file:/home/.../blue.jar!/path/to/file.xml
URI uri = getURL(resourceOrFile, cls).toURI();
String uriStr = uri.toString();
if (uriStr.startsWith("jar")) {
if (uriStr.endsWith("/")) {
throw new UnsupportedOperationException(
"cannot unjar directories, only files");
}
String jarPath = uriStr.substring(4, uriStr.indexOf("!"))
.replace("file:", "");
String filePath = uriStr.substring(uriStr.indexOf("!") + 2);
JarFile jarFile = new JarFile(jarPath);
assert (jarFile.size() > 0) : "no jarFile at " + jarPath;
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
if (jarEntry.toString().equals(filePath)) {
InputStream input = jarFile.getInputStream(jarEntry);
assert (input != null) : "empty is for " + jarEntry; // depends on control dependency: [if], data = [none]
return tmpFileFromStream(input, filePath,
deleteTmpOnExit); // depends on control dependency: [if], data = [none]
}
}
assert (false) : "file" + filePath + " not found in " + jarPath;
return null;
} else {
return new File(uri);
}
} catch (URISyntaxException e) {
throw new FileNotFoundException(resourceOrFile);
} catch (IOException e) {
throw new FileNotFoundException(resourceOrFile);
}
} }
|
public class class_name {
private static void populateSuperTypeArgs(final Type[] types, final Map<TypeVariable<?>, Type> map,
boolean depthFirst) {
for (Type type : types) {
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
if (!depthFirst)
populateTypeArgs(parameterizedType, map, depthFirst);
Type rawType = parameterizedType.getRawType();
if (rawType instanceof Class)
populateSuperTypeArgs(((Class<?>) rawType).getGenericInterfaces(), map, depthFirst);
if (depthFirst)
populateTypeArgs(parameterizedType, map, depthFirst);
} else if (type instanceof Class) {
populateSuperTypeArgs(((Class<?>) type).getGenericInterfaces(), map, depthFirst);
}
}
} }
|
public class class_name {
private static void populateSuperTypeArgs(final Type[] types, final Map<TypeVariable<?>, Type> map,
boolean depthFirst) {
for (Type type : types) {
if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) type;
if (!depthFirst)
populateTypeArgs(parameterizedType, map, depthFirst);
Type rawType = parameterizedType.getRawType();
if (rawType instanceof Class)
populateSuperTypeArgs(((Class<?>) rawType).getGenericInterfaces(), map, depthFirst);
if (depthFirst)
populateTypeArgs(parameterizedType, map, depthFirst);
} else if (type instanceof Class) {
populateSuperTypeArgs(((Class<?>) type).getGenericInterfaces(), map, depthFirst); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void removePartition( MCollection partition) {
for (MFile mfile : partIndexFiles) {
if (mfile.getName().equalsIgnoreCase(partition.getCollectionName())) {
List<MFile> part = new ArrayList<>(partIndexFiles);
part.remove(mfile);
partIndexFiles = part;
return;
}
}
} }
|
public class class_name {
public void removePartition( MCollection partition) {
for (MFile mfile : partIndexFiles) {
if (mfile.getName().equalsIgnoreCase(partition.getCollectionName())) {
List<MFile> part = new ArrayList<>(partIndexFiles);
part.remove(mfile); // depends on control dependency: [if], data = [none]
partIndexFiles = part; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void clearMenus()
{
for (final Featurable menu : menus)
{
menu.getFeature(Identifiable.class).destroy();
handler.remove(menu);
}
menus.clear();
} }
|
public class class_name {
private void clearMenus()
{
for (final Featurable menu : menus)
{
menu.getFeature(Identifiable.class).destroy();
// depends on control dependency: [for], data = [menu]
handler.remove(menu);
// depends on control dependency: [for], data = [menu]
}
menus.clear();
} }
|
public class class_name {
public static BodyQName createWithPrefix(
final String uri,
final String local,
final String prefix) {
if (uri == null || uri.length() == 0) {
throw(new IllegalArgumentException(
"URI is required and may not be null/empty"));
}
if (local == null || local.length() == 0) {
throw(new IllegalArgumentException(
"Local arg is required and may not be null/empty"));
}
if (prefix == null || prefix.length() == 0) {
return new BodyQName(new QName(uri, local));
} else {
return new BodyQName(new QName(uri, local, prefix));
}
} }
|
public class class_name {
public static BodyQName createWithPrefix(
final String uri,
final String local,
final String prefix) {
if (uri == null || uri.length() == 0) {
throw(new IllegalArgumentException(
"URI is required and may not be null/empty"));
}
if (local == null || local.length() == 0) {
throw(new IllegalArgumentException(
"Local arg is required and may not be null/empty"));
}
if (prefix == null || prefix.length() == 0) {
return new BodyQName(new QName(uri, local)); // depends on control dependency: [if], data = [none]
} else {
return new BodyQName(new QName(uri, local, prefix)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
@ConstantTime
@SuppressWarnings("unchecked")
public K findMin() {
if (size + insertionBufferSize == 0) {
throw new NoSuchElementException();
}
if (insertionBufferSize == 0) {
return array[0];
} else if (size == 0) {
return insertionBuffer[insertionBufferMinPos];
} else {
K insertionBufferMin = insertionBuffer[insertionBufferMinPos];
if (comparator == null) {
if (((Comparable<? super K>) array[0]).compareTo(insertionBufferMin) <= 0) {
return array[0];
} else {
return insertionBufferMin;
}
} else {
if (comparator.compare(array[0], insertionBufferMin) <= 0) {
return array[0];
} else {
return insertionBufferMin;
}
}
}
} }
|
public class class_name {
@Override
@ConstantTime
@SuppressWarnings("unchecked")
public K findMin() {
if (size + insertionBufferSize == 0) {
throw new NoSuchElementException();
}
if (insertionBufferSize == 0) {
return array[0]; // depends on control dependency: [if], data = [none]
} else if (size == 0) {
return insertionBuffer[insertionBufferMinPos]; // depends on control dependency: [if], data = [none]
} else {
K insertionBufferMin = insertionBuffer[insertionBufferMinPos];
if (comparator == null) {
if (((Comparable<? super K>) array[0]).compareTo(insertionBufferMin) <= 0) {
return array[0]; // depends on control dependency: [if], data = [none]
} else {
return insertionBufferMin; // depends on control dependency: [if], data = [none]
}
} else {
if (comparator.compare(array[0], insertionBufferMin) <= 0) {
return array[0]; // depends on control dependency: [if], data = [none]
} else {
return insertionBufferMin; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
@Override
public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
Set<String> coTasks = coTasksGetter.call(taskRequest.getId());
String targetHostAttrVal = AttributeUtilities.getAttrValue(targetVM.getCurrAvailableResources(), hostAttributeName);
if(targetHostAttrVal==null || targetHostAttrVal.isEmpty()) {
return new Result(false, hostAttributeName + " attribute unavailable on host " + targetVM.getCurrAvailableResources().hostname());
}
for(String coTask: coTasks) {
TaskTracker.ActiveTask activeTask = taskTrackerState.getAllRunningTasks().get(coTask);
if(activeTask==null)
activeTask = taskTrackerState.getAllCurrentlyAssignedTasks().get(coTask);
if(activeTask!=null) {
String usedAttrVal = AttributeUtilities.getAttrValue(activeTask.getTotalLease(), hostAttributeName);
if(usedAttrVal==null || usedAttrVal.isEmpty())
return new Result(false, hostAttributeName+" attribute unavailable on host " + activeTask.getTotalLease().hostname() +
" running co-task " + coTask);
if(usedAttrVal.equals(targetHostAttrVal)) {
return new Result(false, hostAttributeName+" " + targetHostAttrVal + " already used for another co-task " + coTask);
}
}
}
return new Result(true, "");
} }
|
public class class_name {
@Override
public Result evaluate(TaskRequest taskRequest, VirtualMachineCurrentState targetVM, TaskTrackerState taskTrackerState) {
Set<String> coTasks = coTasksGetter.call(taskRequest.getId());
String targetHostAttrVal = AttributeUtilities.getAttrValue(targetVM.getCurrAvailableResources(), hostAttributeName);
if(targetHostAttrVal==null || targetHostAttrVal.isEmpty()) {
return new Result(false, hostAttributeName + " attribute unavailable on host " + targetVM.getCurrAvailableResources().hostname()); // depends on control dependency: [if], data = [none]
}
for(String coTask: coTasks) {
TaskTracker.ActiveTask activeTask = taskTrackerState.getAllRunningTasks().get(coTask);
if(activeTask==null)
activeTask = taskTrackerState.getAllCurrentlyAssignedTasks().get(coTask);
if(activeTask!=null) {
String usedAttrVal = AttributeUtilities.getAttrValue(activeTask.getTotalLease(), hostAttributeName);
if(usedAttrVal==null || usedAttrVal.isEmpty())
return new Result(false, hostAttributeName+" attribute unavailable on host " + activeTask.getTotalLease().hostname() +
" running co-task " + coTask);
if(usedAttrVal.equals(targetHostAttrVal)) {
return new Result(false, hostAttributeName+" " + targetHostAttrVal + " already used for another co-task " + coTask); // depends on control dependency: [if], data = [none]
}
}
}
return new Result(true, "");
} }
|
public class class_name {
@SafeVarargs
public static <T, X extends Throwable> Try<T, X> withCatch(final CheckedSupplier<T, X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
return Try.success(cf.get());
} catch (final Throwable t) {
if (classes.length == 0)
return Try.failure((X) t);
val error = Stream.of(classes)
.filter(c -> c.isAssignableFrom(t.getClass()))
.findFirst();
if (error.isPresent())
return Try.failure((X) t);
else
throw ExceptionSoftener.throwSoftenedException(t);
}
} }
|
public class class_name {
@SafeVarargs
public static <T, X extends Throwable> Try<T, X> withCatch(final CheckedSupplier<T, X> cf, final Class<? extends X>... classes) {
Objects.requireNonNull(cf);
try {
return Try.success(cf.get()); // depends on control dependency: [try], data = [none]
} catch (final Throwable t) {
if (classes.length == 0)
return Try.failure((X) t);
val error = Stream.of(classes)
.filter(c -> c.isAssignableFrom(t.getClass()))
.findFirst();
if (error.isPresent())
return Try.failure((X) t);
else
throw ExceptionSoftener.throwSoftenedException(t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void set(String value)
{
char[] cha = value.toCharArray();
for ( int i = 0; i < getN() && i < value.length(); i++ )
{
setChar(cha[i], i);
}
} }
|
public class class_name {
public void set(String value)
{
char[] cha = value.toCharArray();
for ( int i = 0; i < getN() && i < value.length(); i++ )
{
setChar(cha[i], i); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void marshall(PutDeliveryChannelRequest putDeliveryChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (putDeliveryChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putDeliveryChannelRequest.getDeliveryChannel(), DELIVERYCHANNEL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutDeliveryChannelRequest putDeliveryChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (putDeliveryChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putDeliveryChannelRequest.getDeliveryChannel(), DELIVERYCHANNEL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void storeAttribute(Attr attribute) {
// examine the attributes in namespace xmlns
if (attribute.getNamespaceURI() != null
&& attribute.getNamespaceURI().equals(
XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
// Default namespace xmlns="uri goes here"
if (attribute.getNodeName().equals(XMLConstants.XMLNS_ATTRIBUTE)) {
putInCache(DEFAULT_NS, attribute.getNodeValue());
} else {
// Here are the defined prefixes stored
putInCache(attribute.getLocalName(), attribute.getNodeValue());
}
}
} }
|
public class class_name {
private void storeAttribute(Attr attribute) {
// examine the attributes in namespace xmlns
if (attribute.getNamespaceURI() != null
&& attribute.getNamespaceURI().equals(
XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
// Default namespace xmlns="uri goes here"
if (attribute.getNodeName().equals(XMLConstants.XMLNS_ATTRIBUTE)) {
putInCache(DEFAULT_NS, attribute.getNodeValue()); // depends on control dependency: [if], data = [none]
} else {
// Here are the defined prefixes stored
putInCache(attribute.getLocalName(), attribute.getNodeValue()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
void setScanResult(final ScanResult scanResult) {
super.setScanResult(scanResult);
if (elementTypeSignature != null) {
elementTypeSignature.setScanResult(scanResult);
}
} }
|
public class class_name {
@Override
void setScanResult(final ScanResult scanResult) {
super.setScanResult(scanResult);
if (elementTypeSignature != null) {
elementTypeSignature.setScanResult(scanResult); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Nullable
protected String getParentPath(String path) {
// Root does not have a parent.
if (isRoot(path)) {
return null;
}
int separatorIndex = path.lastIndexOf(PATH_SEPARATOR);
if (separatorIndex < 0) {
return null;
}
return path.substring(0, separatorIndex);
} }
|
public class class_name {
@Nullable
protected String getParentPath(String path) {
// Root does not have a parent.
if (isRoot(path)) {
return null; // depends on control dependency: [if], data = [none]
}
int separatorIndex = path.lastIndexOf(PATH_SEPARATOR);
if (separatorIndex < 0) {
return null; // depends on control dependency: [if], data = [none]
}
return path.substring(0, separatorIndex);
} }
|
public class class_name {
private Bundle buildAppLinkDataForNavigation(Context context) {
Bundle data = new Bundle();
Bundle refererAppLinkData = new Bundle();
if (context != null) {
String refererAppPackage = context.getPackageName();
if (refererAppPackage != null) {
refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_PACKAGE, refererAppPackage);
}
ApplicationInfo appInfo = context.getApplicationInfo();
if (appInfo != null) {
String refererAppName = context.getString(appInfo.labelRes);
if (refererAppName != null) {
refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_APP_NAME, refererAppName);
}
}
}
data.putAll(getAppLinkData());
data.putString(AppLinks.KEY_NAME_TARGET, getAppLink().getSourceUrl().toString());
data.putString(KEY_NAME_VERSION, VERSION);
data.putString(KEY_NAME_USER_AGENT, "Bolts Android " + Bolts.VERSION);
data.putBundle(KEY_NAME_REFERER_APP_LINK, refererAppLinkData);
data.putBundle(AppLinks.KEY_NAME_EXTRAS, getExtras());
return data;
} }
|
public class class_name {
private Bundle buildAppLinkDataForNavigation(Context context) {
Bundle data = new Bundle();
Bundle refererAppLinkData = new Bundle();
if (context != null) {
String refererAppPackage = context.getPackageName();
if (refererAppPackage != null) {
refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_PACKAGE, refererAppPackage); // depends on control dependency: [if], data = [none]
}
ApplicationInfo appInfo = context.getApplicationInfo();
if (appInfo != null) {
String refererAppName = context.getString(appInfo.labelRes);
if (refererAppName != null) {
refererAppLinkData.putString(KEY_NAME_REFERER_APP_LINK_APP_NAME, refererAppName); // depends on control dependency: [if], data = [none]
}
}
}
data.putAll(getAppLinkData());
data.putString(AppLinks.KEY_NAME_TARGET, getAppLink().getSourceUrl().toString());
data.putString(KEY_NAME_VERSION, VERSION);
data.putString(KEY_NAME_USER_AGENT, "Bolts Android " + Bolts.VERSION);
data.putBundle(KEY_NAME_REFERER_APP_LINK, refererAppLinkData);
data.putBundle(AppLinks.KEY_NAME_EXTRAS, getExtras());
return data;
} }
|
public class class_name {
private String parseHadoopOutputCommitter(Path fullPath,
boolean addTaskIdCompositeName, String hostNameScheme) throws IOException {
String path = fullPath.toString();
String noPrefix = path;
if (path.startsWith(hostNameScheme)) {
noPrefix = path.substring(hostNameScheme.length());
}
int npIdx = noPrefix.indexOf(HADOOP_TEMPORARY);
String objectName;
if (npIdx >= 0) {
if (npIdx == 0 || npIdx == 1 && noPrefix.startsWith("/")) {
//no object name present, for example
//schema://tone1.lvm/_temporary/0/_temporary/attempt_201610038_0001_m_000007_15/part-0007
//schema://tone1.lvm_temporary/0/_temporary/attempt_201610038_0001_m_000007_15/part-0007
throw new IOException("Object name is missing");
} else {
// Will give: schema://tone1.lvm/aa/bb/cc/one3.txt/
objectName = noPrefix.substring(0, npIdx - 1);
if (addTaskIdCompositeName) {
String objName = null;
String taskAttempt = Utils.extractTaskID(path, HADOOP_ATTEMPT);
if (taskAttempt != null) {
int fIndex = fullPath.toString().indexOf(taskAttempt + "/");
if (fIndex > 0) {
fIndex = fIndex + taskAttempt.length() + 1;
}
if (fIndex < fullPath.toString().length()) {
objName = fullPath.toString().substring(fIndex);
}
}
if (objName == null) {
objName = fullPath.getName();
}
if (taskAttempt != null && !objName.startsWith(HADOOP_ATTEMPT)) {
// We want to prepend the attempt before the extension
String extension = extractExtension(objName);
objName = objName.replace("." + extension, "") + "-" + taskAttempt;
if (!extension.equals("")) {
objName += "." + extension;
}
}
objectName = objectName + "/" + objName;
}
}
return objectName;
}
return noPrefix;
} }
|
public class class_name {
private String parseHadoopOutputCommitter(Path fullPath,
boolean addTaskIdCompositeName, String hostNameScheme) throws IOException {
String path = fullPath.toString();
String noPrefix = path;
if (path.startsWith(hostNameScheme)) {
noPrefix = path.substring(hostNameScheme.length());
}
int npIdx = noPrefix.indexOf(HADOOP_TEMPORARY);
String objectName;
if (npIdx >= 0) {
if (npIdx == 0 || npIdx == 1 && noPrefix.startsWith("/")) {
//no object name present, for example
//schema://tone1.lvm/_temporary/0/_temporary/attempt_201610038_0001_m_000007_15/part-0007
//schema://tone1.lvm_temporary/0/_temporary/attempt_201610038_0001_m_000007_15/part-0007
throw new IOException("Object name is missing");
} else {
// Will give: schema://tone1.lvm/aa/bb/cc/one3.txt/
objectName = noPrefix.substring(0, npIdx - 1); // depends on control dependency: [if], data = [none]
if (addTaskIdCompositeName) {
String objName = null;
String taskAttempt = Utils.extractTaskID(path, HADOOP_ATTEMPT);
if (taskAttempt != null) {
int fIndex = fullPath.toString().indexOf(taskAttempt + "/");
if (fIndex > 0) {
fIndex = fIndex + taskAttempt.length() + 1; // depends on control dependency: [if], data = [none]
}
if (fIndex < fullPath.toString().length()) {
objName = fullPath.toString().substring(fIndex); // depends on control dependency: [if], data = [(fIndex]
}
}
if (objName == null) {
objName = fullPath.getName(); // depends on control dependency: [if], data = [none]
}
if (taskAttempt != null && !objName.startsWith(HADOOP_ATTEMPT)) {
// We want to prepend the attempt before the extension
String extension = extractExtension(objName);
objName = objName.replace("." + extension, "") + "-" + taskAttempt; // depends on control dependency: [if], data = [none]
if (!extension.equals("")) {
objName += "." + extension; // depends on control dependency: [if], data = [none]
}
}
objectName = objectName + "/" + objName; // depends on control dependency: [if], data = [none]
}
}
return objectName;
}
return noPrefix;
} }
|
public class class_name {
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>[] declaredExceptions) {
if (!isCheckedException(ex)) {
return true;
}
if (declaredExceptions != null) {
int i = 0;
while (i < declaredExceptions.length) {
if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {
return true;
}
i++;
}
}
return false;
} }
|
public class class_name {
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>[] declaredExceptions) {
if (!isCheckedException(ex)) {
return true; // depends on control dependency: [if], data = [none]
}
if (declaredExceptions != null) {
int i = 0;
while (i < declaredExceptions.length) {
if (declaredExceptions[i].isAssignableFrom(ex.getClass())) {
return true; // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [while], data = [none]
}
}
return false;
} }
|
public class class_name {
private CmsObject getOnlineCmsObject(CmsObject cms) {
CmsObject res = null;
try {
res = OpenCms.initCmsObject(cms);
res.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
} catch (CmsException e) {
LOG.error("Cannot create CmsObject", e);
}
return res;
} }
|
public class class_name {
private CmsObject getOnlineCmsObject(CmsObject cms) {
CmsObject res = null;
try {
res = OpenCms.initCmsObject(cms); // depends on control dependency: [try], data = [none]
res.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("Cannot create CmsObject", e);
} // depends on control dependency: [catch], data = [none]
return res;
} }
|
public class class_name {
public void init() {
// load the filter mappings (copy of the list in case add is called while we iterate)
List fMappings = new ArrayList(webAppConfig.getFilterMappings());
// if the list isn't empty, show that this web app has filters
if (!fMappings.isEmpty()) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "init", "filter mappings at init time ->" + fMappings);
_filtersDefined = true;
// add the filter mappings to the uri or servlet mapping lists
Iterator iter = fMappings.iterator();
while (iter.hasNext()) {
FilterMapping fMapping = (FilterMapping) iter.next();
addFilterMapping(fMapping);
//PK86553 - start
if (WCCustomProperties.INVOKE_FILTER_INIT_AT_START_UP){
String filterName = fMapping.getFilterConfig().getFilterName();
if (_filterWrappers.get(filterName) == null){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"init", "load filter init at startup, filter ->"+ filterName);
try{
loadFilter(filterName);
}
catch (Throwable th) {
//logger.logp(Level.FINE, CLASS_NAME, "init", "Can not initialize filter ["+filterName+"] at startup.");//596191
LoggerHelper.logParamsAndException(logger, Level.SEVERE, CLASS_NAME,"init", "init.exception.thrown.by.filter.at.startup", new Object[]{filterName} , th );
}
}
}
//PK86553 - end
}
} else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "init", "no filter mappings at init time");
}
} }
|
public class class_name {
public void init() {
// load the filter mappings (copy of the list in case add is called while we iterate)
List fMappings = new ArrayList(webAppConfig.getFilterMappings());
// if the list isn't empty, show that this web app has filters
if (!fMappings.isEmpty()) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE))
logger.logp(Level.FINE, CLASS_NAME, "init", "filter mappings at init time ->" + fMappings);
_filtersDefined = true; // depends on control dependency: [if], data = [none]
// add the filter mappings to the uri or servlet mapping lists
Iterator iter = fMappings.iterator();
while (iter.hasNext()) {
FilterMapping fMapping = (FilterMapping) iter.next();
addFilterMapping(fMapping); // depends on control dependency: [while], data = [none]
//PK86553 - start
if (WCCustomProperties.INVOKE_FILTER_INIT_AT_START_UP){
String filterName = fMapping.getFilterConfig().getFilterName();
if (_filterWrappers.get(filterName) == null){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE))
logger.logp(Level.FINE, CLASS_NAME,"init", "load filter init at startup, filter ->"+ filterName);
try{
loadFilter(filterName); // depends on control dependency: [try], data = [none]
}
catch (Throwable th) {
//logger.logp(Level.FINE, CLASS_NAME, "init", "Can not initialize filter ["+filterName+"] at startup.");//596191
LoggerHelper.logParamsAndException(logger, Level.SEVERE, CLASS_NAME,"init", "init.exception.thrown.by.filter.at.startup", new Object[]{filterName} , th );
} // depends on control dependency: [catch], data = [none]
}
}
//PK86553 - end
}
} else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "init", "no filter mappings at init time"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void initEventAdaptors()
{
if ( _implDecl == null || _implDecl.getMethods() == null )
return;
for (MethodDeclaration implMethod : _implDecl.getMethods())
{
//
// Do a quick check for the presence of the EventHandler annotation on methods
//
if (implMethod.getAnnotation(EventHandler.class) == null ||
implMethod.toString().equals("<clinit>()"))
continue;
//
// EventHandler annotations on private methods cause compilation error.
//
if (isPrivateMethod(implMethod))
{
_ap.printError(implMethod, "eventhandler.method.is.private");
continue;
}
//
// If found, we must actually read the value using an AnnotationMirror, since it
// contains a Class element (eventSet) that cannot be loaded
//
AnnotationMirror handlerMirror = null;
for (AnnotationMirror annot : implMethod.getAnnotationMirrors())
{
if ( annot == null ||
annot.getAnnotationType() == null ||
annot.getAnnotationType().getDeclaration() == null ||
annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
return;
if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
"org.apache.beehive.controls.api.events.EventHandler"))
{
handlerMirror = annot;
break;
}
}
if (handlerMirror == null)
{
throw new CodeGenerationException("Unable to find EventHandler annotation on " +
implMethod);
}
AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);
//
// Locate the EventField based upon the field element value
//
String fieldName = (String)handlerAnnot.getObjectValue("field");
AptEventField eventField = (AptEventField)getField(fieldName);
if (eventField == null)
{
// eventField == null means this field isn't interesting for the purposes
// of this processor (control impls). However, only emit an error message
// if the field isn't on a nested control
if ( getControlField(fieldName) == null )
_ap.printError( implMethod, "eventhandler.field.not.found", fieldName );
continue;
}
//
// Locate the EventSet based upon the eventSet element value
//
TypeMirror tm = (TypeMirror)( handlerAnnot.getObjectValue("eventSet") );
if ( tm == null )
continue;
String setName = tm.toString();
AptControlInterface controlIntf = eventField.getControlInterface();
// todo: remove workaround once bug has been resolved.
/* Workaround for JIRA issue BEEHIVE-1143, eventset name may
contain a '$' seperator between the outer class and inner class.
Should be a '.' seperator. Only applies to Eclipse APT. This
workaround is also present in AptControlClient.initEventAdapters
*/
if (tm.getClass().getName().startsWith("org.eclipse.")) {
setName = setName.replace('$', '.');
}
// end of workaround
AptEventSet eventSet = controlIntf.getEventSet(setName);
if (eventSet == null)
{
_ap.printError( implMethod, "eventhandler.eventset.not.found", setName );
continue;
}
//
// Register a new EventAdaptor for the EventSet, if none exists already
//
EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
if (adaptor == null)
{
adaptor = new EventAdaptor(eventField, eventSet);
eventField.addEventAdaptor(eventSet, adaptor);
}
//
// Locate the EventSet method based upon the eventName element value. Once
// found, add a new AptEventHandler to the adaptor for this event.
//
boolean found = false;
String eventName = (String)handlerAnnot.getObjectValue("eventName");
AptMethod handlerMethod = new AptMethod(implMethod, _ap);
for (AptEvent controlEvent : eventSet.getEvents())
{
if (controlEvent == null || controlEvent.getName() == null ||
!controlEvent.getName().equals(eventName))
continue;
if ( controlEvent.getArgTypes() == null )
continue;
//
// BUGBUG: If the arguments are parameterized, then the event handler
// might declare a specific bound version of the type, so a direct
// comparison will fail. If parameterized, we don't validate.
//
if (controlEvent.hasParameterizedArguments() ||
controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
{
adaptor.addHandler(controlEvent,
new AptEventHandler(controlEvent, implMethod, _ap));
found = true;
break;
}
}
if (!found)
{
_ap.printError( implMethod, "eventhandler.method.not.found", setName );
}
}
} }
|
public class class_name {
protected void initEventAdaptors()
{
if ( _implDecl == null || _implDecl.getMethods() == null )
return;
for (MethodDeclaration implMethod : _implDecl.getMethods())
{
//
// Do a quick check for the presence of the EventHandler annotation on methods
//
if (implMethod.getAnnotation(EventHandler.class) == null ||
implMethod.toString().equals("<clinit>()"))
continue;
//
// EventHandler annotations on private methods cause compilation error.
//
if (isPrivateMethod(implMethod))
{
_ap.printError(implMethod, "eventhandler.method.is.private"); // depends on control dependency: [if], data = [none]
continue;
}
//
// If found, we must actually read the value using an AnnotationMirror, since it
// contains a Class element (eventSet) that cannot be loaded
//
AnnotationMirror handlerMirror = null;
for (AnnotationMirror annot : implMethod.getAnnotationMirrors())
{
if ( annot == null ||
annot.getAnnotationType() == null ||
annot.getAnnotationType().getDeclaration() == null ||
annot.getAnnotationType().getDeclaration().getQualifiedName() == null )
return;
if ( annot.getAnnotationType().getDeclaration().getQualifiedName().equals(
"org.apache.beehive.controls.api.events.EventHandler"))
{
handlerMirror = annot;
break;
}
}
if (handlerMirror == null)
{
throw new CodeGenerationException("Unable to find EventHandler annotation on " +
implMethod);
}
AptAnnotationHelper handlerAnnot = new AptAnnotationHelper(handlerMirror);
//
// Locate the EventField based upon the field element value
//
String fieldName = (String)handlerAnnot.getObjectValue("field");
AptEventField eventField = (AptEventField)getField(fieldName);
if (eventField == null)
{
// eventField == null means this field isn't interesting for the purposes
// of this processor (control impls). However, only emit an error message
// if the field isn't on a nested control
if ( getControlField(fieldName) == null )
_ap.printError( implMethod, "eventhandler.field.not.found", fieldName );
continue;
}
//
// Locate the EventSet based upon the eventSet element value
//
TypeMirror tm = (TypeMirror)( handlerAnnot.getObjectValue("eventSet") );
if ( tm == null )
continue;
String setName = tm.toString();
AptControlInterface controlIntf = eventField.getControlInterface();
// todo: remove workaround once bug has been resolved.
/* Workaround for JIRA issue BEEHIVE-1143, eventset name may
contain a '$' seperator between the outer class and inner class.
Should be a '.' seperator. Only applies to Eclipse APT. This
workaround is also present in AptControlClient.initEventAdapters
*/
if (tm.getClass().getName().startsWith("org.eclipse.")) {
setName = setName.replace('$', '.');
}
// end of workaround
AptEventSet eventSet = controlIntf.getEventSet(setName);
if (eventSet == null)
{
_ap.printError( implMethod, "eventhandler.eventset.not.found", setName );
continue;
}
//
// Register a new EventAdaptor for the EventSet, if none exists already
//
EventAdaptor adaptor = eventField.getEventAdaptor(eventSet);
if (adaptor == null)
{
adaptor = new EventAdaptor(eventField, eventSet);
eventField.addEventAdaptor(eventSet, adaptor);
}
//
// Locate the EventSet method based upon the eventName element value. Once
// found, add a new AptEventHandler to the adaptor for this event.
//
boolean found = false;
String eventName = (String)handlerAnnot.getObjectValue("eventName");
AptMethod handlerMethod = new AptMethod(implMethod, _ap);
for (AptEvent controlEvent : eventSet.getEvents())
{
if (controlEvent == null || controlEvent.getName() == null ||
!controlEvent.getName().equals(eventName))
continue;
if ( controlEvent.getArgTypes() == null )
continue;
//
// BUGBUG: If the arguments are parameterized, then the event handler
// might declare a specific bound version of the type, so a direct
// comparison will fail. If parameterized, we don't validate.
//
if (controlEvent.hasParameterizedArguments() ||
controlEvent.getArgTypes().equals(handlerMethod.getArgTypes()))
{
adaptor.addHandler(controlEvent,
new AptEventHandler(controlEvent, implMethod, _ap));
found = true;
break;
}
}
if (!found)
{
_ap.printError( implMethod, "eventhandler.method.not.found", setName );
}
}
} }
|
public class class_name {
public String getQualifiedName() {
if (prefixManager != null) {
String shortName = prefixManager.getShortForm(getFullName());
if (shortName.startsWith(":")) {
return shortName.substring(1, shortName.length());
} else {
return shortName;
}
} else {
return getFullName();
}
} }
|
public class class_name {
public String getQualifiedName() {
if (prefixManager != null) {
String shortName = prefixManager.getShortForm(getFullName());
if (shortName.startsWith(":")) {
return shortName.substring(1, shortName.length()); // depends on control dependency: [if], data = [none]
} else {
return shortName; // depends on control dependency: [if], data = [none]
}
} else {
return getFullName(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setLoggedOutIndicatorPattern(String loggedOutIndicatorPattern) {
if (loggedOutIndicatorPattern == null || loggedOutIndicatorPattern.trim().length() == 0) {
this.loggedOutIndicatorPattern = null;
} else {
this.loggedOutIndicatorPattern = Pattern.compile(loggedOutIndicatorPattern);
}
} }
|
public class class_name {
public void setLoggedOutIndicatorPattern(String loggedOutIndicatorPattern) {
if (loggedOutIndicatorPattern == null || loggedOutIndicatorPattern.trim().length() == 0) {
this.loggedOutIndicatorPattern = null; // depends on control dependency: [if], data = [none]
} else {
this.loggedOutIndicatorPattern = Pattern.compile(loggedOutIndicatorPattern); // depends on control dependency: [if], data = [(loggedOutIndicatorPattern]
}
} }
|
public class class_name {
private WyalFile.Stmt flatten(AssumptionSet assumptions) {
WyalFile.Stmt result = flattenUpto(assumptions, null);
if (result == null) {
return new Expr.Constant(new Value.Bool(true));
} else {
return result;
}
} }
|
public class class_name {
private WyalFile.Stmt flatten(AssumptionSet assumptions) {
WyalFile.Stmt result = flattenUpto(assumptions, null);
if (result == null) {
return new Expr.Constant(new Value.Bool(true)); // depends on control dependency: [if], data = [none]
} else {
return result; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private boolean containsNull(Object[] arguments) {
for (Object argument : arguments) {
if (argument == null) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean containsNull(Object[] arguments) {
for (Object argument : arguments) {
if (argument == null) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private void initRestTemplate() {
boolean isContainsConverter = false;
for (HttpMessageConverter<?> httpMessageConverter : this.restTemplate.getMessageConverters()) {
if (MappingJacksonRPC2HttpMessageConverter.class.isAssignableFrom(httpMessageConverter.getClass())) {
isContainsConverter = true;
break;
}
}
if (!isContainsConverter) {
final MappingJacksonRPC2HttpMessageConverter messageConverter = new MappingJacksonRPC2HttpMessageConverter();
messageConverter.setObjectMapper(this.getObjectMapper());
final List<HttpMessageConverter<?>> restMessageConverters = new ArrayList<>();
restMessageConverters.addAll(this.restTemplate.getMessageConverters());
// Place JSON-RPC converter on the first place!
restMessageConverters.add(0, messageConverter);
this.restTemplate.setMessageConverters(restMessageConverters);
}
// use specific JSON-RPC error handler if it has not been changed to custom
if (restTemplate.getErrorHandler() instanceof org.springframework.web.client.DefaultResponseErrorHandler) {
restTemplate.setErrorHandler(JsonRpcResponseErrorHandler.INSTANCE);
}
} }
|
public class class_name {
private void initRestTemplate() {
boolean isContainsConverter = false;
for (HttpMessageConverter<?> httpMessageConverter : this.restTemplate.getMessageConverters()) {
if (MappingJacksonRPC2HttpMessageConverter.class.isAssignableFrom(httpMessageConverter.getClass())) {
isContainsConverter = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!isContainsConverter) {
final MappingJacksonRPC2HttpMessageConverter messageConverter = new MappingJacksonRPC2HttpMessageConverter();
messageConverter.setObjectMapper(this.getObjectMapper()); // depends on control dependency: [if], data = [none]
final List<HttpMessageConverter<?>> restMessageConverters = new ArrayList<>(); // depends on control dependency: [if], data = [none]
restMessageConverters.addAll(this.restTemplate.getMessageConverters()); // depends on control dependency: [if], data = [none]
// Place JSON-RPC converter on the first place!
restMessageConverters.add(0, messageConverter); // depends on control dependency: [if], data = [none]
this.restTemplate.setMessageConverters(restMessageConverters); // depends on control dependency: [if], data = [none]
}
// use specific JSON-RPC error handler if it has not been changed to custom
if (restTemplate.getErrorHandler() instanceof org.springframework.web.client.DefaultResponseErrorHandler) {
restTemplate.setErrorHandler(JsonRpcResponseErrorHandler.INSTANCE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void setOutputs(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) {
try {
setOutputsOrFaults(message, operation.getOutputExpressionMappings(), contextOverrides, RESULT, false);
} catch (Exception e) {
setOutputsOrFaults(message, operation.getOutputExpressionMappings(), contextOverrides, RESULT, true);
}
} }
|
public class class_name {
public static void setOutputs(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) {
try {
setOutputsOrFaults(message, operation.getOutputExpressionMappings(), contextOverrides, RESULT, false); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
setOutputsOrFaults(message, operation.getOutputExpressionMappings(), contextOverrides, RESULT, true);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void clusterToBinary( List<List<Point2D_I32>> clusters ,
GrayU8 binary )
{
ImageMiscOps.fill(binary, 0);
for( List<Point2D_I32> l : clusters ) {
for( Point2D_I32 p : l ) {
binary.set(p.x,p.y,1);
}
}
} }
|
public class class_name {
public static void clusterToBinary( List<List<Point2D_I32>> clusters ,
GrayU8 binary )
{
ImageMiscOps.fill(binary, 0);
for( List<Point2D_I32> l : clusters ) {
for( Point2D_I32 p : l ) {
binary.set(p.x,p.y,1); // depends on control dependency: [for], data = [p]
}
}
} }
|
public class class_name {
@Override
public Event doExecute(final RequestContext requestContext) {
val tgtId = WebUtils.getTicketGrantingTicketId(requestContext);
if (StringUtils.isBlank(tgtId)) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_NOT_EXISTS);
}
try {
val ticket = this.centralAuthenticationService.getTicket(tgtId, Ticket.class);
if (ticket != null && !ticket.isExpired()) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_VALID);
}
} catch (final AbstractTicketException e) {
LOGGER.trace("Could not retrieve ticket id [{}] from registry.", e.getMessage());
}
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_INVALID);
} }
|
public class class_name {
@Override
public Event doExecute(final RequestContext requestContext) {
val tgtId = WebUtils.getTicketGrantingTicketId(requestContext);
if (StringUtils.isBlank(tgtId)) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_NOT_EXISTS); // depends on control dependency: [if], data = [none]
}
try {
val ticket = this.centralAuthenticationService.getTicket(tgtId, Ticket.class);
if (ticket != null && !ticket.isExpired()) {
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_VALID); // depends on control dependency: [if], data = [none]
}
} catch (final AbstractTicketException e) {
LOGGER.trace("Could not retrieve ticket id [{}] from registry.", e.getMessage());
} // depends on control dependency: [catch], data = [none]
return new Event(this, CasWebflowConstants.TRANSITION_ID_TGT_INVALID);
} }
|
public class class_name {
@Override
public Map<String, String> getMetadataMap() {
String metadataNamespace = namespace + INSTANCE_METADATA_PREFIX + ".";
Map<String, String> metadataMap = new LinkedHashMap<String, String>();
Configuration config = (Configuration) configInstance.getBackingConfigurationSource();
String subsetPrefix = metadataNamespace.charAt(metadataNamespace.length() - 1) == '.'
? metadataNamespace.substring(0, metadataNamespace.length() - 1)
: metadataNamespace;
for (Iterator<String> iter = config.subset(subsetPrefix).getKeys(); iter.hasNext(); ) {
String key = iter.next();
String value = config.getString(subsetPrefix + "." + key);
metadataMap.put(key, value);
}
return metadataMap;
} }
|
public class class_name {
@Override
public Map<String, String> getMetadataMap() {
String metadataNamespace = namespace + INSTANCE_METADATA_PREFIX + ".";
Map<String, String> metadataMap = new LinkedHashMap<String, String>();
Configuration config = (Configuration) configInstance.getBackingConfigurationSource();
String subsetPrefix = metadataNamespace.charAt(metadataNamespace.length() - 1) == '.'
? metadataNamespace.substring(0, metadataNamespace.length() - 1)
: metadataNamespace;
for (Iterator<String> iter = config.subset(subsetPrefix).getKeys(); iter.hasNext(); ) {
String key = iter.next();
String value = config.getString(subsetPrefix + "." + key);
metadataMap.put(key, value); // depends on control dependency: [for], data = [none]
}
return metadataMap;
} }
|
public class class_name {
protected void appendCopiesUntil(RoaringArray sourceArray, short stoppingKey) {
int stopKey = Util.toIntUnsigned(stoppingKey);
for (int i = 0; i < sourceArray.size; ++i) {
if (Util.toIntUnsigned(sourceArray.keys[i]) >= stopKey) {
break;
}
extendArray(1);
this.keys[this.size] = sourceArray.keys[i];
this.values[this.size] = sourceArray.values[i].clone();
this.size++;
}
} }
|
public class class_name {
protected void appendCopiesUntil(RoaringArray sourceArray, short stoppingKey) {
int stopKey = Util.toIntUnsigned(stoppingKey);
for (int i = 0; i < sourceArray.size; ++i) {
if (Util.toIntUnsigned(sourceArray.keys[i]) >= stopKey) {
break;
}
extendArray(1); // depends on control dependency: [for], data = [none]
this.keys[this.size] = sourceArray.keys[i]; // depends on control dependency: [for], data = [i]
this.values[this.size] = sourceArray.values[i].clone(); // depends on control dependency: [for], data = [i]
this.size++; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
@Override
public void ack(long batchId)
{
if (logger.isDebugEnabled() == true)
{
logger.debug("acked. taskIndex=" + this.taskIndex + ", batchId=" + batchId);
}
} }
|
public class class_name {
@Override
public void ack(long batchId)
{
if (logger.isDebugEnabled() == true)
{
logger.debug("acked. taskIndex=" + this.taskIndex + ", batchId=" + batchId); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setPluginList(Path src) {
if (pluginList == null) {
pluginList = src;
} else {
pluginList.append(src);
}
} }
|
public class class_name {
public void setPluginList(Path src) {
if (pluginList == null) {
pluginList = src; // depends on control dependency: [if], data = [none]
} else {
pluginList.append(src); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String insert(final String str, final String given, final int begin, final int end) {
if (begin < 1 || end > str.length() || end < begin) { return str; }
return str.substring(0, begin - 1) + given + str.substring(end);
} }
|
public class class_name {
public static String insert(final String str, final String given, final int begin, final int end) {
if (begin < 1 || end > str.length() || end < begin) { return str; } // depends on control dependency: [if], data = [none]
return str.substring(0, begin - 1) + given + str.substring(end);
} }
|
public class class_name {
public void concat(AbstractLinkedList<? extends E, ? extends T> other) {
if (other.isEmpty()) {
return;
}
if (isEmpty()) {
head = other.head;
last = other.last;
} else {
T otherHead = other.head;
last.setNext(otherHead);
otherHead.setPrev(last);
last = other.last;
}
size += other.size;
other.clear();
} }
|
public class class_name {
public void concat(AbstractLinkedList<? extends E, ? extends T> other) {
if (other.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
if (isEmpty()) {
head = other.head; // depends on control dependency: [if], data = [none]
last = other.last; // depends on control dependency: [if], data = [none]
} else {
T otherHead = other.head;
last.setNext(otherHead); // depends on control dependency: [if], data = [none]
otherHead.setPrev(last); // depends on control dependency: [if], data = [none]
last = other.last; // depends on control dependency: [if], data = [none]
}
size += other.size;
other.clear();
} }
|
public class class_name {
public static LinePolar2D_F32 polar(List<Point2D_I32> points , int start , int length , LinePolar2D_F32 ret ) {
if( ret == null )
ret = new LinePolar2D_F32();
int sumX = 0;
int sumY = 0;
final int N = length;
for( int i = 0; i < N; i++ ) {
Point2D_I32 p = points.get(start+i);
sumX += p.x;
sumY += p.y;
}
float meanX = sumX / (float)N;
float meanY = sumY / (float)N;
float top = 0;
float bottom = 0;
for( int i = 0; i < N; i++ ) {
Point2D_I32 p = points.get(start+i);
float dx = meanX - p.x;
float dy = meanY - p.y;
top += dx*dy;
bottom += dy*dy - dx*dx;
}
ret.angle = (float)Math.atan2(-2.0f*top , bottom)/2.0f;
ret.distance = (float)( meanX*Math.cos(ret.angle) + meanY*Math.sin(ret.angle));
return ret;
} }
|
public class class_name {
public static LinePolar2D_F32 polar(List<Point2D_I32> points , int start , int length , LinePolar2D_F32 ret ) {
if( ret == null )
ret = new LinePolar2D_F32();
int sumX = 0;
int sumY = 0;
final int N = length;
for( int i = 0; i < N; i++ ) {
Point2D_I32 p = points.get(start+i);
sumX += p.x; // depends on control dependency: [for], data = [none]
sumY += p.y; // depends on control dependency: [for], data = [none]
}
float meanX = sumX / (float)N;
float meanY = sumY / (float)N;
float top = 0;
float bottom = 0;
for( int i = 0; i < N; i++ ) {
Point2D_I32 p = points.get(start+i);
float dx = meanX - p.x;
float dy = meanY - p.y;
top += dx*dy; // depends on control dependency: [for], data = [none]
bottom += dy*dy - dx*dx; // depends on control dependency: [for], data = [none]
}
ret.angle = (float)Math.atan2(-2.0f*top , bottom)/2.0f;
ret.distance = (float)( meanX*Math.cos(ret.angle) + meanY*Math.sin(ret.angle));
return ret;
} }
|
public class class_name {
@Override
public void handle(T result, HttpResponse response) {
String transitionHeader = response.getHeaders().get(Headers.IBM_TRANSITION);
if (transitionHeader != null) {
result.setTransitionDate(parseDate(transitionHeader));
String transition = parseTransition(transitionHeader);
if (transition != null) {
result.setTransition(transition);
}
}
} }
|
public class class_name {
@Override
public void handle(T result, HttpResponse response) {
String transitionHeader = response.getHeaders().get(Headers.IBM_TRANSITION);
if (transitionHeader != null) {
result.setTransitionDate(parseDate(transitionHeader)); // depends on control dependency: [if], data = [(transitionHeader]
String transition = parseTransition(transitionHeader);
if (transition != null) {
result.setTransition(transition); // depends on control dependency: [if], data = [(transition]
}
}
} }
|
public class class_name {
private static String md5(byte[] buffer) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buffer);
byte[] digest = md.digest();
return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), StandardCharsets.US_ASCII);
} catch (NoSuchAlgorithmException e) {
// Should never happen
throw new InternalError("MD5 not supported on this platform");
}
} }
|
public class class_name {
private static String md5(byte[] buffer) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buffer); // depends on control dependency: [try], data = [none]
byte[] digest = md.digest();
return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), StandardCharsets.US_ASCII); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
// Should never happen
throw new InternalError("MD5 not supported on this platform");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Node searchNode(Object key, EntityMetadata m, GraphDatabaseService graphDb, boolean skipProxy)
{
Node node = null;
String idColumnName = ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName();
final MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
key = serializeIdAttributeValue(m, metaModel, key);
}
if (indexer.isNodeAutoIndexingEnabled(graphDb))
{
// Get the Node auto index
ReadableIndex<Node> autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
IndexHits<Node> nodesFound = autoNodeIndex.get(idColumnName, key);
node = getMatchingNodeFromIndexHits(nodesFound, skipProxy);
}
else
{
// Searching within manually created indexes
Index<Node> nodeIndex = graphDb.index().forNodes(m.getIndexName());
IndexHits<Node> nodesFound = nodeIndex.get(idColumnName, key);
node = getMatchingNodeFromIndexHits(nodesFound, skipProxy);
}
return node;
} }
|
public class class_name {
public Node searchNode(Object key, EntityMetadata m, GraphDatabaseService graphDb, boolean skipProxy)
{
Node node = null;
String idColumnName = ((AbstractAttribute) m.getIdAttribute()).getJPAColumnName();
final MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
m.getPersistenceUnit());
if (metaModel.isEmbeddable(m.getIdAttribute().getBindableJavaType()))
{
key = serializeIdAttributeValue(m, metaModel, key); // depends on control dependency: [if], data = [none]
}
if (indexer.isNodeAutoIndexingEnabled(graphDb))
{
// Get the Node auto index
ReadableIndex<Node> autoNodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
IndexHits<Node> nodesFound = autoNodeIndex.get(idColumnName, key);
node = getMatchingNodeFromIndexHits(nodesFound, skipProxy); // depends on control dependency: [if], data = [none]
}
else
{
// Searching within manually created indexes
Index<Node> nodeIndex = graphDb.index().forNodes(m.getIndexName());
IndexHits<Node> nodesFound = nodeIndex.get(idColumnName, key);
node = getMatchingNodeFromIndexHits(nodesFound, skipProxy); // depends on control dependency: [if], data = [none]
}
return node;
} }
|
public class class_name {
public static Projection project(Projection... projection) {
if (projection.length == 1) {
return projection[0];
} else {
Projection x = new Projection(true);
for (Projection p : projection) {
x.addToArray(p.toJson());
}
return x;
}
} }
|
public class class_name {
public static Projection project(Projection... projection) {
if (projection.length == 1) {
return projection[0]; // depends on control dependency: [if], data = [none]
} else {
Projection x = new Projection(true);
for (Projection p : projection) {
x.addToArray(p.toJson()); // depends on control dependency: [for], data = [p]
}
return x; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(ReportTaskProgressRequest reportTaskProgressRequest, ProtocolMarshaller protocolMarshaller) {
if (reportTaskProgressRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reportTaskProgressRequest.getTaskId(), TASKID_BINDING);
protocolMarshaller.marshall(reportTaskProgressRequest.getFields(), FIELDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ReportTaskProgressRequest reportTaskProgressRequest, ProtocolMarshaller protocolMarshaller) {
if (reportTaskProgressRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(reportTaskProgressRequest.getTaskId(), TASKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(reportTaskProgressRequest.getFields(), FIELDS_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 JSONObject sameHqAddUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SAME_HQ_ADD);
postOperation(request);
return requestServer(request);
} }
|
public class class_name {
public JSONObject sameHqAddUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(ImageSearchConsts.SAME_HQ_ADD);
postOperation(request);
return requestServer(request);
} }
|
public class class_name {
public static SyntaxFactory getInstance() {
if(SyntaxFactory.syntaxFactory == null) {
SyntaxFactory.syntaxFactory = new SyntaxFactory();
}
return SyntaxFactory.syntaxFactory;
} }
|
public class class_name {
public static SyntaxFactory getInstance() {
if(SyntaxFactory.syntaxFactory == null) {
SyntaxFactory.syntaxFactory = new SyntaxFactory(); // depends on control dependency: [if], data = [none]
}
return SyntaxFactory.syntaxFactory;
} }
|
public class class_name {
public ArrayList<String> getRows() {
ArrayList<String> rows = new ArrayList<String>();
for (String row : rowLookup.keySet()) {
HeaderInfo hi = rowLookup.get(row);
if (!hi.isHide()) {
rows.add(row);
}
}
return rows;
} }
|
public class class_name {
public ArrayList<String> getRows() {
ArrayList<String> rows = new ArrayList<String>();
for (String row : rowLookup.keySet()) {
HeaderInfo hi = rowLookup.get(row);
if (!hi.isHide()) {
rows.add(row); // depends on control dependency: [if], data = [none]
}
}
return rows;
} }
|
public class class_name {
@Pure
public DoubleProperty maxYProperty() {
if (this.maxY == null) {
this.maxY = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_Y) {
@Override
protected void invalidated() {
final double currentMax = get();
final double currentMin = getMinY();
if (currentMin > currentMax) {
// min-max constrain is broken
minYProperty().set(currentMax);
}
}
};
}
return this.maxY;
} }
|
public class class_name {
@Pure
public DoubleProperty maxYProperty() {
if (this.maxY == null) {
this.maxY = new SimpleDoubleProperty(this, MathFXAttributeNames.MAXIMUM_Y) {
@Override
protected void invalidated() {
final double currentMax = get();
final double currentMin = getMinY();
if (currentMin > currentMax) {
// min-max constrain is broken
minYProperty().set(currentMax); // depends on control dependency: [if], data = [currentMax)]
}
}
}; // depends on control dependency: [if], data = [none]
}
return this.maxY;
} }
|
public class class_name {
public void marshall(PutWebhookRequest putWebhookRequest, ProtocolMarshaller protocolMarshaller) {
if (putWebhookRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putWebhookRequest.getWebhook(), WEBHOOK_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutWebhookRequest putWebhookRequest, ProtocolMarshaller protocolMarshaller) {
if (putWebhookRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putWebhookRequest.getWebhook(), WEBHOOK_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void doSimpleMatching() {
for (int i = 0; i < equalElements.size(); i++) {
if (!alreadyMatched.get(i)) {
List<Integer> equalTo = equalElements.get(i);
if (equalTo.size() > 0) {
List<Integer> equivalentElements = getEquivalentElements(equalTo);
// We have the same set matching as is equivalent, we can remove them all
if (equalTo.size() == equivalentElements.size()) {
for (int j = 0; j < equivalentElements.size(); j++) {
recordMatch(equivalentElements.get(j), equalTo.get(j));
}
} else if (equivalentElements.size() > 1 && equalTo.size() > 1) {
List<Integer> equalToUsedOnlyInEquivalentElements = getEqualToUsedOnlyInEquivalentElements(equalTo, equivalentElements);
for (int j = 0; j < min(equivalentElements.size(), equalToUsedOnlyInEquivalentElements.size()); j++) {
recordMatch(equivalentElements.get(j), equalTo.get(j));
}
}
}
}
}
} }
|
public class class_name {
private void doSimpleMatching() {
for (int i = 0; i < equalElements.size(); i++) {
if (!alreadyMatched.get(i)) {
List<Integer> equalTo = equalElements.get(i);
if (equalTo.size() > 0) {
List<Integer> equivalentElements = getEquivalentElements(equalTo);
// We have the same set matching as is equivalent, we can remove them all
if (equalTo.size() == equivalentElements.size()) {
for (int j = 0; j < equivalentElements.size(); j++) {
recordMatch(equivalentElements.get(j), equalTo.get(j)); // depends on control dependency: [for], data = [j]
}
} else if (equivalentElements.size() > 1 && equalTo.size() > 1) {
List<Integer> equalToUsedOnlyInEquivalentElements = getEqualToUsedOnlyInEquivalentElements(equalTo, equivalentElements);
for (int j = 0; j < min(equivalentElements.size(), equalToUsedOnlyInEquivalentElements.size()); j++) {
recordMatch(equivalentElements.get(j), equalTo.get(j)); // depends on control dependency: [for], data = [j]
}
}
}
}
}
} }
|
public class class_name {
protected void layoutInline()
{
int x1 = fleft.getWidth(floatY) - floatXl; //available width with considering floats
int x2 = fright.getWidth(floatY) - floatXr;
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
int wlimit = getAvailableContentWidth();
int minx1 = 0 - floatXl; //maximal available width if there were no floats
int minx2 = 0 - floatXr;
if (minx1 < 0) minx1 = 0;
if (minx2 < 0) minx2 = 0;
int x = x1; //current x
int y = 0; //current y
int lnstr = 0; //the index of the first subbox on current line
int lastbreak = 0; //last possible position of a line break
//apply indentation
x += indent;
//line boxes
Vector<LineBox> lines = new Vector<LineBox>();
LineBox curline = firstLine;
if (curline == null)
curline = new LineBox(this, 0, 0);
lines.add(curline);
for (int i = 0; i < getSubBoxNumber(); i++)
{
Box subbox = getSubBox(i);
//if we find a block here, it must be an out-of-flow box
//make the positioning and continue
if (subbox.isBlock())
{
BlockBox sb = (BlockBox) subbox;
BlockLayoutStatus stat = new BlockLayoutStatus();
stat.inlineWidth = x - x1;
stat.y = y;
stat.maxh = 0;
boolean atstart = (x <= x1); //check if the line has already started
//clear set - try to find the first possible Y value
if (sb.getClearing() != CLEAR_NONE)
{
int ny = stat.y;
if (sb.getClearing() == CLEAR_LEFT)
ny = fleft.getMaxY() - floatY;
else if (sb.getClearing() == CLEAR_RIGHT)
ny = fright.getMaxY() - floatY;
else if (sb.getClearing() == CLEAR_BOTH)
ny = Math.max(fleft.getMaxY(), fright.getMaxY()) - floatY;
if (stat.y < ny) stat.y = ny;
}
if (sb.getFloating() == FLOAT_LEFT || sb.getFloating() == FLOAT_RIGHT) //floating boxes
{
layoutBlockFloating(sb, wlimit, stat);
//if there were some boxes before the float on the line, move them behind
if (sb.getFloating() == FLOAT_LEFT && stat.inlineWidth > 0 && curline.getStart() < i)
{
for (int j = curline.getStart(); j < i; j++)
{
Box child = getSubBox(j);
if (!child.isBlock())
child.moveRight(sb.getWidth());
}
x += sb.getWidth();
}
}
else //absolute or fixed positioning
{
layoutBlockPositioned(sb, stat);
}
//in case the block was floating, we need to update the bounds
x1 = fleft.getWidth(y + floatY) - floatXl;
x2 = fright.getWidth(y + floatY) - floatXr;
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
//if the line hasn't started yet, update its start
if (atstart && x < x1)
x = x1;
//continue with next subboxes
continue;
}
//process inline elements
if (subbox.canSplitBefore())
lastbreak = i;
boolean split;
do //repeat while the box is being split to sub-boxes
{
split = false;
int space = wlimit - x1 - x2; //total space on the line
boolean narrowed = (x1 > minx1 || x2 > minx2); //the space is narrowed by floats and it may be enough space somewhere below
//force: we're at the leftmost position or the line cannot be broken
// if there is no space on the line because of the floats, do not force
boolean f = (x == x1 || lastbreak == lnstr || !allowsWrapping()) && !narrowed;
//do the layout
boolean fit = false;
if (space >= INFLOW_SPACE_THRESHOLD || !narrowed)
fit = subbox.doLayout(wlimit - x - x2, f, x == x1);
if (fit) //positioning succeeded, at least a part fit -- set the x coordinate
{
if (subbox.isInFlow())
{
subbox.setPosition(x, 0); //y position will be determined during the line box vertical alignment
x += subbox.getWidth();
}
//update current line metrics
curline.considerBox((Inline) subbox);
}
//check line overflows
boolean over = (x > wlimit - x2); //space overflow?
boolean linebreak = (subbox instanceof Inline && ((Inline) subbox).finishedByLineBreak()); //finished by a line break?
if (!fit && narrowed && (x == x1 || lastbreak == lnstr)) //failed because of no space caused by floats
{
//finish the line if there are already some boxes on the line
if (lnstr < i)
{
lnstr = i; //new line starts here
curline.setEnd(lnstr); //finish the old line
curline = new LineBox(this, lnstr, y); //create the new line
lines.add(curline);
}
//go to the new line
y += getLineHeight();
curline.setY(y);
x1 = fleft.getWidth(y + floatY) - floatXl;
x2 = fright.getWidth(y + floatY) - floatXr;
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
x = x1;
//force repeating the same once again unless line height is non-positive (prevent infinite loop)
if (getLineHeight() > 0)
split = true;
}
else if ((!fit && lastbreak > lnstr) //line overflow and the line can be broken
|| (fit && (over || linebreak || subbox.getRest() != null))) //or something fit but something has left
{
//the width and height for text alignment
curline.setWidth(x - x1);
curline.setLimits(x1, x2);
//go to the new line
y += curline.getMaxBoxHeight();
x1 = fleft.getWidth(y + floatY) - floatXl;
x2 = fright.getWidth(y + floatY) - floatXr;
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
x = x1;
//create a new line
if (!fit) //not fit - try again with a new line
{
lnstr = i; //new line starts here
curline.setEnd(lnstr); //finish the old line
curline = new LineBox(this, lnstr, y); //create the new line
lines.add(curline);
split = true; //force repeating the same once again
}
else if (over || linebreak || subbox.getRest() != null) //something fit but not everything placed or line exceeded - create a new empty line
{
if (subbox.getRest() != null)
insertSubBox(i+1, subbox.getRest()); //insert a new subbox with the rest
lnstr = i+1; //new line starts with the next subbox
curline.setEnd(lnstr); //finish the old line
curline = new LineBox(this, lnstr, y); //create the new line
lines.add(curline);
}
}
} while (split);
if (subbox.canSplitAfter())
lastbreak = i+1;
}
//block height
if (!hasFixedHeight())
{
y += curline.getMaxBoxHeight(); //last unfinished line
if (encloseFloats())
{
//enclose all floating boxes we own
int mfy = getFloatHeight() - floatY;
if (mfy > y) y = mfy;
}
//the total height is the last Y coordinate
setContentHeight(y);
updateSizes();
updateChildSizes();
}
setSize(totalWidth(), totalHeight());
//finish the last line
curline.setWidth(x - x1);
curline.setLimits(x1, x2);
curline.setEnd(getSubBoxNumber());
//align the lines according to the real box width
for (Iterator<LineBox> it = lines.iterator(); it.hasNext();)
{
LineBox line = it.next();
alignLineHorizontally(line, !it.hasNext());
alignLineVertically(line);
}
} }
|
public class class_name {
protected void layoutInline()
{
int x1 = fleft.getWidth(floatY) - floatXl; //available width with considering floats
int x2 = fright.getWidth(floatY) - floatXr;
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
int wlimit = getAvailableContentWidth();
int minx1 = 0 - floatXl; //maximal available width if there were no floats
int minx2 = 0 - floatXr;
if (minx1 < 0) minx1 = 0;
if (minx2 < 0) minx2 = 0;
int x = x1; //current x
int y = 0; //current y
int lnstr = 0; //the index of the first subbox on current line
int lastbreak = 0; //last possible position of a line break
//apply indentation
x += indent;
//line boxes
Vector<LineBox> lines = new Vector<LineBox>();
LineBox curline = firstLine;
if (curline == null)
curline = new LineBox(this, 0, 0);
lines.add(curline);
for (int i = 0; i < getSubBoxNumber(); i++)
{
Box subbox = getSubBox(i);
//if we find a block here, it must be an out-of-flow box
//make the positioning and continue
if (subbox.isBlock())
{
BlockBox sb = (BlockBox) subbox;
BlockLayoutStatus stat = new BlockLayoutStatus();
stat.inlineWidth = x - x1; // depends on control dependency: [if], data = [none]
stat.y = y; // depends on control dependency: [if], data = [none]
stat.maxh = 0; // depends on control dependency: [if], data = [none]
boolean atstart = (x <= x1); //check if the line has already started
//clear set - try to find the first possible Y value
if (sb.getClearing() != CLEAR_NONE)
{
int ny = stat.y;
if (sb.getClearing() == CLEAR_LEFT)
ny = fleft.getMaxY() - floatY;
else if (sb.getClearing() == CLEAR_RIGHT)
ny = fright.getMaxY() - floatY;
else if (sb.getClearing() == CLEAR_BOTH)
ny = Math.max(fleft.getMaxY(), fright.getMaxY()) - floatY;
if (stat.y < ny) stat.y = ny;
}
if (sb.getFloating() == FLOAT_LEFT || sb.getFloating() == FLOAT_RIGHT) //floating boxes
{
layoutBlockFloating(sb, wlimit, stat); // depends on control dependency: [if], data = [none]
//if there were some boxes before the float on the line, move them behind
if (sb.getFloating() == FLOAT_LEFT && stat.inlineWidth > 0 && curline.getStart() < i)
{
for (int j = curline.getStart(); j < i; j++)
{
Box child = getSubBox(j);
if (!child.isBlock())
child.moveRight(sb.getWidth());
}
x += sb.getWidth(); // depends on control dependency: [if], data = [none]
}
}
else //absolute or fixed positioning
{
layoutBlockPositioned(sb, stat); // depends on control dependency: [if], data = [none]
}
//in case the block was floating, we need to update the bounds
x1 = fleft.getWidth(y + floatY) - floatXl; // depends on control dependency: [if], data = [none]
x2 = fright.getWidth(y + floatY) - floatXr; // depends on control dependency: [if], data = [none]
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
//if the line hasn't started yet, update its start
if (atstart && x < x1)
x = x1;
//continue with next subboxes
continue;
}
//process inline elements
if (subbox.canSplitBefore())
lastbreak = i;
boolean split;
do //repeat while the box is being split to sub-boxes
{
split = false;
int space = wlimit - x1 - x2; //total space on the line
boolean narrowed = (x1 > minx1 || x2 > minx2); //the space is narrowed by floats and it may be enough space somewhere below
//force: we're at the leftmost position or the line cannot be broken
// if there is no space on the line because of the floats, do not force
boolean f = (x == x1 || lastbreak == lnstr || !allowsWrapping()) && !narrowed;
//do the layout
boolean fit = false;
if (space >= INFLOW_SPACE_THRESHOLD || !narrowed)
fit = subbox.doLayout(wlimit - x - x2, f, x == x1);
if (fit) //positioning succeeded, at least a part fit -- set the x coordinate
{
if (subbox.isInFlow())
{
subbox.setPosition(x, 0); //y position will be determined during the line box vertical alignment // depends on control dependency: [if], data = [none]
x += subbox.getWidth(); // depends on control dependency: [if], data = [none]
}
//update current line metrics
curline.considerBox((Inline) subbox); // depends on control dependency: [if], data = [none]
}
//check line overflows
boolean over = (x > wlimit - x2); //space overflow?
boolean linebreak = (subbox instanceof Inline && ((Inline) subbox).finishedByLineBreak()); //finished by a line break?
if (!fit && narrowed && (x == x1 || lastbreak == lnstr)) //failed because of no space caused by floats
{
//finish the line if there are already some boxes on the line
if (lnstr < i)
{
lnstr = i; //new line starts here // depends on control dependency: [if], data = [none]
curline.setEnd(lnstr); //finish the old line // depends on control dependency: [if], data = [(lnstr]
curline = new LineBox(this, lnstr, y); //create the new line // depends on control dependency: [if], data = [none]
lines.add(curline); // depends on control dependency: [if], data = [none]
}
//go to the new line
y += getLineHeight(); // depends on control dependency: [if], data = [none]
curline.setY(y); // depends on control dependency: [if], data = [none]
x1 = fleft.getWidth(y + floatY) - floatXl; // depends on control dependency: [if], data = [none]
x2 = fright.getWidth(y + floatY) - floatXr; // depends on control dependency: [if], data = [none]
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
x = x1; // depends on control dependency: [if], data = [none]
//force repeating the same once again unless line height is non-positive (prevent infinite loop)
if (getLineHeight() > 0)
split = true;
}
else if ((!fit && lastbreak > lnstr) //line overflow and the line can be broken
|| (fit && (over || linebreak || subbox.getRest() != null))) //or something fit but something has left
{
//the width and height for text alignment
curline.setWidth(x - x1); // depends on control dependency: [if], data = [none]
curline.setLimits(x1, x2); // depends on control dependency: [if], data = [none]
//go to the new line
y += curline.getMaxBoxHeight(); // depends on control dependency: [if], data = [none]
x1 = fleft.getWidth(y + floatY) - floatXl; // depends on control dependency: [if], data = [none]
x2 = fright.getWidth(y + floatY) - floatXr; // depends on control dependency: [if], data = [none]
if (x1 < 0) x1 = 0;
if (x2 < 0) x2 = 0;
x = x1; // depends on control dependency: [if], data = [none]
//create a new line
if (!fit) //not fit - try again with a new line
{
lnstr = i; //new line starts here // depends on control dependency: [if], data = [none]
curline.setEnd(lnstr); //finish the old line // depends on control dependency: [if], data = [none]
curline = new LineBox(this, lnstr, y); //create the new line // depends on control dependency: [if], data = [none]
lines.add(curline); // depends on control dependency: [if], data = [none]
split = true; //force repeating the same once again // depends on control dependency: [if], data = [none]
}
else if (over || linebreak || subbox.getRest() != null) //something fit but not everything placed or line exceeded - create a new empty line
{
if (subbox.getRest() != null)
insertSubBox(i+1, subbox.getRest()); //insert a new subbox with the rest
lnstr = i+1; //new line starts with the next subbox // depends on control dependency: [if], data = [none]
curline.setEnd(lnstr); //finish the old line // depends on control dependency: [if], data = [none]
curline = new LineBox(this, lnstr, y); //create the new line // depends on control dependency: [if], data = [none]
lines.add(curline); // depends on control dependency: [if], data = [none]
}
}
} while (split);
if (subbox.canSplitAfter())
lastbreak = i+1;
}
//block height
if (!hasFixedHeight())
{
y += curline.getMaxBoxHeight(); //last unfinished line // depends on control dependency: [if], data = [none]
if (encloseFloats())
{
//enclose all floating boxes we own
int mfy = getFloatHeight() - floatY;
if (mfy > y) y = mfy;
}
//the total height is the last Y coordinate
setContentHeight(y); // depends on control dependency: [if], data = [none]
updateSizes(); // depends on control dependency: [if], data = [none]
updateChildSizes(); // depends on control dependency: [if], data = [none]
}
setSize(totalWidth(), totalHeight());
//finish the last line
curline.setWidth(x - x1);
curline.setLimits(x1, x2);
curline.setEnd(getSubBoxNumber());
//align the lines according to the real box width
for (Iterator<LineBox> it = lines.iterator(); it.hasNext();)
{
LineBox line = it.next();
alignLineHorizontally(line, !it.hasNext()); // depends on control dependency: [for], data = [it]
alignLineVertically(line); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public static boolean respondsTo(Object object, String methodName) {
MetaClass metaClass = DefaultGroovyMethods.getMetaClass(object);
if (!metaClass.respondsTo(object, methodName).isEmpty()) {
return true;
}
Map properties = DefaultGroovyMethods.getProperties(object);
return properties.containsKey(methodName);
} }
|
public class class_name {
public static boolean respondsTo(Object object, String methodName) {
MetaClass metaClass = DefaultGroovyMethods.getMetaClass(object);
if (!metaClass.respondsTo(object, methodName).isEmpty()) {
return true;
// depends on control dependency: [if], data = [none]
}
Map properties = DefaultGroovyMethods.getProperties(object);
return properties.containsKey(methodName);
} }
|
public class class_name {
private double getSurfaceSums4Sorting(int minEntries, int maxEntries, int[] entrySorting, int dim) {
// avoid multiple MBR calculations by updating min/max-logs for the two
// collections' bounds:
// the first entries' maximum upper bounds
double[] pqUBFirst = new double[dim];
Arrays.fill(pqUBFirst, Double.NEGATIVE_INFINITY);
// maintain the second entries' upper bounds
List<Heap<DoubleIntPair>> pqUBSecond = new ArrayList<>(dim);
for(int i = 0; i < dim; i++) {
// Descending heap
pqUBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries, Collections.reverseOrder()));
}
// the first entries' minimum lower bounds
double[] pqLBFirst = new double[dim];
Arrays.fill(pqLBFirst, Double.POSITIVE_INFINITY);
// maintain the second entries' minimum lower bounds
List<Heap<DoubleIntPair>> pqLBSecond = new ArrayList<>(dim);
for(int i = 0; i < dim; i++) {
// Ascending heap
pqLBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries));
}
// initialize bounds for first entry collection
for(int index = 0; index < minEntries; index++) {
add2MBR(entrySorting, pqUBFirst, pqLBFirst, index);
}
HyperBoundingBox mbr1 = new HyperBoundingBox(pqLBFirst, pqUBFirst);
// fill bounding queues for the second entry collection
double[] minSecond = new double[dim];
double[] maxSecond = new double[dim];
Arrays.fill(maxSecond, Double.NEGATIVE_INFINITY);
Arrays.fill(minSecond, Double.POSITIVE_INFINITY);
assert entrySorting.length - maxEntries == minEntries;
// initialize min/max entries of the second collections' tail
for(int index = maxEntries; index < entrySorting.length; index++) {
add2MBR(entrySorting, maxSecond, minSecond, index);
}
for(int i = 0; i < dim; i++) {
// with index entrySorting.length => never to be removed
pqLBSecond.get(i).add(new DoubleIntPair(minSecond[i], entrySorting.length));
pqUBSecond.get(i).add(new DoubleIntPair(maxSecond[i], entrySorting.length));
}
// add the entries to be removed later on
for(int index = minEntries; index < maxEntries; index++) {
add2MBR(entrySorting, pqUBSecond, pqLBSecond, index);
}
for(int i = 0; i < minSecond.length; i++) {
minSecond[i] = pqLBSecond.get(i).peek().first;
maxSecond[i] = pqUBSecond.get(i).peek().first;
}
ModifiableHyperBoundingBox mbr2 = new ModifiableHyperBoundingBox(minSecond, maxSecond);
double surfaceSum = SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2);
// generate the other distributions and file the surface sums
for(int limit = minEntries; limit < maxEntries; limit++) {
// extend first MBR by entry at position entrySorting[limit]:
add2MBR(entrySorting, pqUBFirst, pqLBFirst, limit);
// shrink entry at position entrySorting[limit] from second MBR:
removeFromMBR(pqUBSecond, pqLBSecond, limit, mbr2);
surfaceSum += SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2);
}
return surfaceSum;
} }
|
public class class_name {
private double getSurfaceSums4Sorting(int minEntries, int maxEntries, int[] entrySorting, int dim) {
// avoid multiple MBR calculations by updating min/max-logs for the two
// collections' bounds:
// the first entries' maximum upper bounds
double[] pqUBFirst = new double[dim];
Arrays.fill(pqUBFirst, Double.NEGATIVE_INFINITY);
// maintain the second entries' upper bounds
List<Heap<DoubleIntPair>> pqUBSecond = new ArrayList<>(dim);
for(int i = 0; i < dim; i++) {
// Descending heap
pqUBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries, Collections.reverseOrder())); // depends on control dependency: [for], data = [none]
}
// the first entries' minimum lower bounds
double[] pqLBFirst = new double[dim];
Arrays.fill(pqLBFirst, Double.POSITIVE_INFINITY);
// maintain the second entries' minimum lower bounds
List<Heap<DoubleIntPair>> pqLBSecond = new ArrayList<>(dim);
for(int i = 0; i < dim; i++) {
// Ascending heap
pqLBSecond.add(new TopBoundedHeap<DoubleIntPair>(maxEntries)); // depends on control dependency: [for], data = [none]
}
// initialize bounds for first entry collection
for(int index = 0; index < minEntries; index++) {
add2MBR(entrySorting, pqUBFirst, pqLBFirst, index); // depends on control dependency: [for], data = [index]
}
HyperBoundingBox mbr1 = new HyperBoundingBox(pqLBFirst, pqUBFirst);
// fill bounding queues for the second entry collection
double[] minSecond = new double[dim];
double[] maxSecond = new double[dim];
Arrays.fill(maxSecond, Double.NEGATIVE_INFINITY);
Arrays.fill(minSecond, Double.POSITIVE_INFINITY);
assert entrySorting.length - maxEntries == minEntries;
// initialize min/max entries of the second collections' tail
for(int index = maxEntries; index < entrySorting.length; index++) {
add2MBR(entrySorting, maxSecond, minSecond, index); // depends on control dependency: [for], data = [index]
}
for(int i = 0; i < dim; i++) {
// with index entrySorting.length => never to be removed
pqLBSecond.get(i).add(new DoubleIntPair(minSecond[i], entrySorting.length)); // depends on control dependency: [for], data = [i]
pqUBSecond.get(i).add(new DoubleIntPair(maxSecond[i], entrySorting.length)); // depends on control dependency: [for], data = [i]
}
// add the entries to be removed later on
for(int index = minEntries; index < maxEntries; index++) {
add2MBR(entrySorting, pqUBSecond, pqLBSecond, index); // depends on control dependency: [for], data = [index]
}
for(int i = 0; i < minSecond.length; i++) {
minSecond[i] = pqLBSecond.get(i).peek().first; // depends on control dependency: [for], data = [i]
maxSecond[i] = pqUBSecond.get(i).peek().first; // depends on control dependency: [for], data = [i]
}
ModifiableHyperBoundingBox mbr2 = new ModifiableHyperBoundingBox(minSecond, maxSecond);
double surfaceSum = SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2);
// generate the other distributions and file the surface sums
for(int limit = minEntries; limit < maxEntries; limit++) {
// extend first MBR by entry at position entrySorting[limit]:
add2MBR(entrySorting, pqUBFirst, pqLBFirst, limit); // depends on control dependency: [for], data = [limit]
// shrink entry at position entrySorting[limit] from second MBR:
removeFromMBR(pqUBSecond, pqLBSecond, limit, mbr2); // depends on control dependency: [for], data = [limit]
surfaceSum += SpatialUtil.perimeter(mbr1) + SpatialUtil.perimeter(mbr2); // depends on control dependency: [for], data = [none]
}
return surfaceSum;
} }
|
public class class_name {
protected LoopItem newTabContainer(final int tabIndex)
{
return new LoopItem(tabIndex)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected void onComponentTag(final ComponentTag tag)
{
super.onComponentTag(tag);
String cssClass = tag.getAttribute("class");
if (cssClass == null)
{
cssClass = " ";
}
cssClass += " tab" + getIndex();
if (getIndex() == getSelectedTab())
{
cssClass += ' ' + getSelectedTabCssClass();
}
if (getVisiblityCache().getLastVisible() == getIndex())
{
cssClass += ' ' + getLastTabCssClass();
}
tag.put("class", cssClass.trim());
}
/**
* {@inheritDoc}
*/
@Override
protected void onConfigure()
{
super.onConfigure();
setVisible(getVisiblityCache().isVisible(tabIndex));
}
};
} }
|
public class class_name {
protected LoopItem newTabContainer(final int tabIndex)
{
return new LoopItem(tabIndex)
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected void onComponentTag(final ComponentTag tag)
{
super.onComponentTag(tag);
String cssClass = tag.getAttribute("class");
if (cssClass == null)
{
cssClass = " "; // depends on control dependency: [if], data = [none]
}
cssClass += " tab" + getIndex();
if (getIndex() == getSelectedTab())
{
cssClass += ' ' + getSelectedTabCssClass(); // depends on control dependency: [if], data = [none]
}
if (getVisiblityCache().getLastVisible() == getIndex())
{
cssClass += ' ' + getLastTabCssClass(); // depends on control dependency: [if], data = [none]
}
tag.put("class", cssClass.trim());
}
/**
* {@inheritDoc}
*/
@Override
protected void onConfigure()
{
super.onConfigure();
setVisible(getVisiblityCache().isVisible(tabIndex));
}
};
} }
|
public class class_name {
protected void releaseResources()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "releaseResources : State = " + stateStrs[state]);
// If the state is not complete, then the ContainerTx should not
// be cleared, and should not be returned to the pool. This is common
// for BMT, where a method may begin the tx, but not complete it
// until a subsequent method call. d157262
if (state != COMMITTED && state != ROLLEDBACK)
{
return;
}
// Simply clear all instance variables that may hold a reference to
// another object. d215317
afterList = null;
beanOList = null;
beanOs = null;
cmdAccessor = null;
containerAS = null;
currentBeanOs = null;
finderSyncList = null;
homesForPMManagedBeans = null;
ivContainer = null;
ivPostProcessingException = null; // PQ90221
ivTxKey = null;
tempList = null;
txListener = null;
uowCtrl = null;
timersQueuedToStart = null; // F743-425.CodRev
timersCanceled = null; // F743-425.CodRev
} }
|
public class class_name {
protected void releaseResources()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "releaseResources : State = " + stateStrs[state]);
// If the state is not complete, then the ContainerTx should not
// be cleared, and should not be returned to the pool. This is common
// for BMT, where a method may begin the tx, but not complete it
// until a subsequent method call. d157262
if (state != COMMITTED && state != ROLLEDBACK)
{
return; // depends on control dependency: [if], data = [none]
}
// Simply clear all instance variables that may hold a reference to
// another object. d215317
afterList = null;
beanOList = null;
beanOs = null;
cmdAccessor = null;
containerAS = null;
currentBeanOs = null;
finderSyncList = null;
homesForPMManagedBeans = null;
ivContainer = null;
ivPostProcessingException = null; // PQ90221
ivTxKey = null;
tempList = null;
txListener = null;
uowCtrl = null;
timersQueuedToStart = null; // F743-425.CodRev
timersCanceled = null; // F743-425.CodRev
} }
|
public class class_name {
public boolean inOrder() {
SortedSet<Integer> prev = null;
for (SortedSet<Integer> cell : cells) {
if (prev == null) {
prev = cell;
} else {
int first = cell.first();
int last = cell.last();
if (first > prev.first() && last > prev.last()) {
prev = cell;
} else {
return false;
}
}
}
return true;
} }
|
public class class_name {
public boolean inOrder() {
SortedSet<Integer> prev = null;
for (SortedSet<Integer> cell : cells) {
if (prev == null) {
prev = cell; // depends on control dependency: [if], data = [none]
} else {
int first = cell.first();
int last = cell.last();
if (first > prev.first() && last > prev.last()) {
prev = cell; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} }
|
public class class_name {
private void broadcast() {
try (LongStream events = eventStream()) {
LongArrayList batch = new LongArrayList(batchSize);
for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) {
batch.add(i.nextLong());
if (batch.size() == batchSize) {
router.route(batch, self());
batch = new LongArrayList(batchSize);
}
}
router.route(batch, self());
router.route(FINISH, self());
} catch (Exception e) {
context().system().log().error(e, "");
context().stop(self());
}
} }
|
public class class_name {
private void broadcast() {
try (LongStream events = eventStream()) {
LongArrayList batch = new LongArrayList(batchSize);
for (PrimitiveIterator.OfLong i = events.iterator(); i.hasNext();) {
batch.add(i.nextLong()); // depends on control dependency: [for], data = [i]
if (batch.size() == batchSize) {
router.route(batch, self()); // depends on control dependency: [if], data = [none]
batch = new LongArrayList(batchSize); // depends on control dependency: [if], data = [batchSize)]
}
}
router.route(batch, self());
router.route(FINISH, self());
} catch (Exception e) {
context().system().log().error(e, "");
context().stop(self());
}
} }
|
public class class_name {
public static List<TypePathEntry> getTypePathFromBinary(java.util.List<Integer> list) {
ListBuffer<TypePathEntry> loc = new ListBuffer<>();
Iterator<Integer> iter = list.iterator();
while (iter.hasNext()) {
Integer fst = iter.next();
Assert.check(iter.hasNext());
Integer snd = iter.next();
loc = loc.append(TypePathEntry.fromBinary(fst, snd));
}
return loc.toList();
} }
|
public class class_name {
public static List<TypePathEntry> getTypePathFromBinary(java.util.List<Integer> list) {
ListBuffer<TypePathEntry> loc = new ListBuffer<>();
Iterator<Integer> iter = list.iterator();
while (iter.hasNext()) {
Integer fst = iter.next();
Assert.check(iter.hasNext()); // depends on control dependency: [while], data = [(iter.hasNext())]
Integer snd = iter.next();
loc = loc.append(TypePathEntry.fromBinary(fst, snd)); // depends on control dependency: [while], data = [none]
}
return loc.toList();
} }
|
public class class_name {
protected static BoxCollaboration.Info create(BoxAPIConnection api, JsonObject accessibleBy, JsonObject item,
BoxCollaboration.Role role, Boolean notify, Boolean canViewPath) {
String queryString = "";
if (notify != null) {
queryString = new QueryStringBuilder().appendParam("notify", notify.toString()).toString();
}
URL url;
if (queryString.length() > 0) {
url = COLLABORATIONS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), queryString);
} else {
url = COLLABORATIONS_URL_TEMPLATE.build(api.getBaseURL());
}
JsonObject requestJSON = new JsonObject();
requestJSON.add("item", item);
requestJSON.add("accessible_by", accessibleBy);
requestJSON.add("role", role.toJSONString());
if (canViewPath != null) {
requestJSON.add("can_view_path", canViewPath.booleanValue());
}
BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxCollaboration newCollaboration = new BoxCollaboration(api, responseJSON.get("id").asString());
return newCollaboration.new Info(responseJSON);
} }
|
public class class_name {
protected static BoxCollaboration.Info create(BoxAPIConnection api, JsonObject accessibleBy, JsonObject item,
BoxCollaboration.Role role, Boolean notify, Boolean canViewPath) {
String queryString = "";
if (notify != null) {
queryString = new QueryStringBuilder().appendParam("notify", notify.toString()).toString(); // depends on control dependency: [if], data = [none]
}
URL url;
if (queryString.length() > 0) {
url = COLLABORATIONS_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), queryString); // depends on control dependency: [if], data = [none]
} else {
url = COLLABORATIONS_URL_TEMPLATE.build(api.getBaseURL()); // depends on control dependency: [if], data = [none]
}
JsonObject requestJSON = new JsonObject();
requestJSON.add("item", item);
requestJSON.add("accessible_by", accessibleBy);
requestJSON.add("role", role.toJSONString());
if (canViewPath != null) {
requestJSON.add("can_view_path", canViewPath.booleanValue()); // depends on control dependency: [if], data = [none]
}
BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxCollaboration newCollaboration = new BoxCollaboration(api, responseJSON.get("id").asString());
return newCollaboration.new Info(responseJSON);
} }
|
public class class_name {
boolean removeUntil(int index, boolean inclusive) {
if (index >= 0) {
boolean changed = false;
PT startPoint = this.startingPoint;
ST segment;
int limit = index;
if (inclusive) {
++limit;
}
for (int i = 0; i < limit; ++i) {
segment = this.segmentList.remove(0);
this.length -= segment.getLength();
if (this.length < 0) {
this.length = 0;
}
startPoint = segment.getOtherSidePoint(startPoint);
changed = true;
}
if (changed) {
if (this.segmentList.isEmpty()) {
this.startingPoint = null;
this.endingPoint = null;
this.isReversable = true;
} else {
this.startingPoint = startPoint;
}
return true;
}
}
return false;
} }
|
public class class_name {
boolean removeUntil(int index, boolean inclusive) {
if (index >= 0) {
boolean changed = false;
PT startPoint = this.startingPoint;
ST segment;
int limit = index;
if (inclusive) {
++limit; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < limit; ++i) {
segment = this.segmentList.remove(0); // depends on control dependency: [for], data = [none]
this.length -= segment.getLength(); // depends on control dependency: [for], data = [none]
if (this.length < 0) {
this.length = 0; // depends on control dependency: [if], data = [none]
}
startPoint = segment.getOtherSidePoint(startPoint); // depends on control dependency: [for], data = [none]
changed = true; // depends on control dependency: [for], data = [none]
}
if (changed) {
if (this.segmentList.isEmpty()) {
this.startingPoint = null; // depends on control dependency: [if], data = [none]
this.endingPoint = null; // depends on control dependency: [if], data = [none]
this.isReversable = true; // depends on control dependency: [if], data = [none]
} else {
this.startingPoint = startPoint; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public final void setLocation(String loc) {
if (location == null && loc == null) {
// no unnecessary property creation if everything is null
return;
}
locationProperty().set(loc);
} }
|
public class class_name {
public final void setLocation(String loc) {
if (location == null && loc == null) {
// no unnecessary property creation if everything is null
return; // depends on control dependency: [if], data = [none]
}
locationProperty().set(loc);
} }
|
public class class_name {
public ACallObjectExpStmIR consInstanceCallStm(STypeIR instanceType,
String instanceName, String memberName, SExpIR... args)
{
AIdentifierVarExpIR instance = new AIdentifierVarExpIR();
instance.setName(instanceName);
instance.setType(instanceType.clone());
instance.setIsLocal(true);
ACallObjectExpStmIR call = new ACallObjectExpStmIR();
call.setType(new AVoidTypeIR());
call.setFieldName(memberName);
call.setObj(instance);
for (SExpIR arg : args)
{
call.getArgs().add(arg);
}
return call;
} }
|
public class class_name {
public ACallObjectExpStmIR consInstanceCallStm(STypeIR instanceType,
String instanceName, String memberName, SExpIR... args)
{
AIdentifierVarExpIR instance = new AIdentifierVarExpIR();
instance.setName(instanceName);
instance.setType(instanceType.clone());
instance.setIsLocal(true);
ACallObjectExpStmIR call = new ACallObjectExpStmIR();
call.setType(new AVoidTypeIR());
call.setFieldName(memberName);
call.setObj(instance);
for (SExpIR arg : args)
{
call.getArgs().add(arg); // depends on control dependency: [for], data = [arg]
}
return call;
} }
|
public class class_name {
private void findDeploymentAddress(final String deploymentID, Handler<AsyncResult<String>> resultHandler) {
context.execute(new Action<String>() {
@Override
public String perform() {
synchronized (deployments) {
JsonObject locatedInfo = null;
Collection<String> sdeploymentsInfo = deployments.get(cluster);
for (String sdeploymentInfo : sdeploymentsInfo) {
JsonObject deploymentInfo = new JsonObject(sdeploymentInfo);
if (deploymentInfo.getString("id").equals(deploymentID)) {
locatedInfo = deploymentInfo;
break;
}
}
if (locatedInfo != null) {
return locatedInfo.getString("address");
}
return null;
}
}
}, resultHandler);
} }
|
public class class_name {
private void findDeploymentAddress(final String deploymentID, Handler<AsyncResult<String>> resultHandler) {
context.execute(new Action<String>() {
@Override
public String perform() {
synchronized (deployments) {
JsonObject locatedInfo = null;
Collection<String> sdeploymentsInfo = deployments.get(cluster);
for (String sdeploymentInfo : sdeploymentsInfo) {
JsonObject deploymentInfo = new JsonObject(sdeploymentInfo);
if (deploymentInfo.getString("id").equals(deploymentID)) {
locatedInfo = deploymentInfo; // depends on control dependency: [if], data = [none]
break;
}
}
if (locatedInfo != null) {
return locatedInfo.getString("address"); // depends on control dependency: [if], data = [none]
}
return null;
}
}
}, resultHandler);
} }
|
public class class_name {
public ChartConfiguration<T> setSimpleTitle(String title) {
if (title == null) {
this.title = new Title(title);
} else {
this.title.setText(title);
}
return this;
} }
|
public class class_name {
public ChartConfiguration<T> setSimpleTitle(String title) {
if (title == null) {
this.title = new Title(title); // depends on control dependency: [if], data = [(title]
} else {
this.title.setText(title); // depends on control dependency: [if], data = [(title]
}
return this;
} }
|
public class class_name {
public ListAssessmentTemplatesResult withAssessmentTemplateArns(String... assessmentTemplateArns) {
if (this.assessmentTemplateArns == null) {
setAssessmentTemplateArns(new java.util.ArrayList<String>(assessmentTemplateArns.length));
}
for (String ele : assessmentTemplateArns) {
this.assessmentTemplateArns.add(ele);
}
return this;
} }
|
public class class_name {
public ListAssessmentTemplatesResult withAssessmentTemplateArns(String... assessmentTemplateArns) {
if (this.assessmentTemplateArns == null) {
setAssessmentTemplateArns(new java.util.ArrayList<String>(assessmentTemplateArns.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : assessmentTemplateArns) {
this.assessmentTemplateArns.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void marshall(UpdateProductRequest updateProductRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProductRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProductRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING);
protocolMarshaller.marshall(updateProductRequest.getId(), ID_BINDING);
protocolMarshaller.marshall(updateProductRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateProductRequest.getOwner(), OWNER_BINDING);
protocolMarshaller.marshall(updateProductRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(updateProductRequest.getDistributor(), DISTRIBUTOR_BINDING);
protocolMarshaller.marshall(updateProductRequest.getSupportDescription(), SUPPORTDESCRIPTION_BINDING);
protocolMarshaller.marshall(updateProductRequest.getSupportEmail(), SUPPORTEMAIL_BINDING);
protocolMarshaller.marshall(updateProductRequest.getSupportUrl(), SUPPORTURL_BINDING);
protocolMarshaller.marshall(updateProductRequest.getAddTags(), ADDTAGS_BINDING);
protocolMarshaller.marshall(updateProductRequest.getRemoveTags(), REMOVETAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateProductRequest updateProductRequest, ProtocolMarshaller protocolMarshaller) {
if (updateProductRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateProductRequest.getAcceptLanguage(), ACCEPTLANGUAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getOwner(), OWNER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getDistributor(), DISTRIBUTOR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getSupportDescription(), SUPPORTDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getSupportEmail(), SUPPORTEMAIL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getSupportUrl(), SUPPORTURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getAddTags(), ADDTAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateProductRequest.getRemoveTags(), REMOVETAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void maybeCollapseIntoForStatements(Node n, Node parent) {
// Only SCRIPT, BLOCK, and LABELs can have FORs that can be collapsed into.
// LABELs are not supported here.
if (parent == null || !NodeUtil.isStatementBlock(parent)) {
return;
}
// Is the current node something that can be in a for loop initializer?
if (!n.isExprResult() && !n.isVar()) {
return;
}
// Is the next statement a valid FOR?
Node nextSibling = n.getNext();
if (nextSibling == null) {
return;
} else if (nextSibling.isForIn() || nextSibling.isForOf()) {
Node forNode = nextSibling;
Node forVar = forNode.getFirstChild();
if (forVar.isName()
&& n.isVar() && n.hasOneChild()) {
Node name = n.getFirstChild();
if (!name.hasChildren()
&& forVar.getString().equals(name.getString())) {
// OK, the names match, and the var declaration does not have an
// initializer. Move it into the loop.
parent.removeChild(n);
forNode.replaceChild(forVar, n);
compiler.reportChangeToEnclosingScope(parent);
}
}
} else if (nextSibling.isVanillaFor() && nextSibling.getFirstChild().isEmpty()) {
// Does the current node contain an in operator? If so, embedding
// the expression in a for loop can cause some JavaScript parsers (such
// as the PlayStation 3's browser based on Access's NetFront
// browser) to fail to parse the code.
// See bug 1778863 for details.
if (NodeUtil.containsType(n, Token.IN)) {
return;
}
// Move the current node into the FOR loop initializer.
Node forNode = nextSibling;
Node oldInitializer = forNode.getFirstChild();
parent.removeChild(n);
Node newInitializer;
if (n.isVar()) {
newInitializer = n;
} else {
// Extract the expression from EXPR_RESULT node.
checkState(n.hasOneChild(), n);
newInitializer = n.getFirstChild();
n.removeChild(newInitializer);
}
forNode.replaceChild(oldInitializer, newInitializer);
compiler.reportChangeToEnclosingScope(forNode);
}
} }
|
public class class_name {
private void maybeCollapseIntoForStatements(Node n, Node parent) {
// Only SCRIPT, BLOCK, and LABELs can have FORs that can be collapsed into.
// LABELs are not supported here.
if (parent == null || !NodeUtil.isStatementBlock(parent)) {
return; // depends on control dependency: [if], data = [none]
}
// Is the current node something that can be in a for loop initializer?
if (!n.isExprResult() && !n.isVar()) {
return; // depends on control dependency: [if], data = [none]
}
// Is the next statement a valid FOR?
Node nextSibling = n.getNext();
if (nextSibling == null) {
return; // depends on control dependency: [if], data = [none]
} else if (nextSibling.isForIn() || nextSibling.isForOf()) {
Node forNode = nextSibling;
Node forVar = forNode.getFirstChild();
if (forVar.isName()
&& n.isVar() && n.hasOneChild()) {
Node name = n.getFirstChild();
if (!name.hasChildren()
&& forVar.getString().equals(name.getString())) {
// OK, the names match, and the var declaration does not have an
// initializer. Move it into the loop.
parent.removeChild(n); // depends on control dependency: [if], data = [none]
forNode.replaceChild(forVar, n); // depends on control dependency: [if], data = [none]
compiler.reportChangeToEnclosingScope(parent); // depends on control dependency: [if], data = [none]
}
}
} else if (nextSibling.isVanillaFor() && nextSibling.getFirstChild().isEmpty()) {
// Does the current node contain an in operator? If so, embedding
// the expression in a for loop can cause some JavaScript parsers (such
// as the PlayStation 3's browser based on Access's NetFront
// browser) to fail to parse the code.
// See bug 1778863 for details.
if (NodeUtil.containsType(n, Token.IN)) {
return; // depends on control dependency: [if], data = [none]
}
// Move the current node into the FOR loop initializer.
Node forNode = nextSibling;
Node oldInitializer = forNode.getFirstChild();
parent.removeChild(n); // depends on control dependency: [if], data = [none]
Node newInitializer;
if (n.isVar()) {
newInitializer = n; // depends on control dependency: [if], data = [none]
} else {
// Extract the expression from EXPR_RESULT node.
checkState(n.hasOneChild(), n); // depends on control dependency: [if], data = [none]
newInitializer = n.getFirstChild(); // depends on control dependency: [if], data = [none]
n.removeChild(newInitializer); // depends on control dependency: [if], data = [none]
}
forNode.replaceChild(oldInitializer, newInitializer); // depends on control dependency: [if], data = [none]
compiler.reportChangeToEnclosingScope(forNode); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String compXmlStringAt(byte[] arr, int strOff) {
int strLen = arr[strOff + 1] << 8 & 0xff00 | arr[strOff] & 0xff;
byte[] chars = new byte[strLen];
for (int ii = 0; ii < strLen; ii++) {
chars[ii] = arr[strOff + 2 + ii * 2];
}
return new String(chars); // Hack, just use 8 byte chars
} }
|
public class class_name {
private String compXmlStringAt(byte[] arr, int strOff) {
int strLen = arr[strOff + 1] << 8 & 0xff00 | arr[strOff] & 0xff;
byte[] chars = new byte[strLen];
for (int ii = 0; ii < strLen; ii++) {
chars[ii] = arr[strOff + 2 + ii * 2]; // depends on control dependency: [for], data = [ii]
}
return new String(chars); // Hack, just use 8 byte chars
} }
|
public class class_name {
@Override
public <T> Single<RestClientResponse<T>> request(HttpMethod method, String uri, Class<T> responseClass, Action1<RestClientRequest<T>> requestBuilder) {
return Single.fromEmitter(emitter -> {
final RestClientRequest<T> callbackRequest = restClient.request(method, uri, responseClass, restClientResponse -> emitter.onSuccess(new DefaultRxRestClientResponse<>(restClientResponse)))
.exceptionHandler(emitter::onError);
try {
final DefaultRxRestClientRequest<T> rxDecoratedRequest = new DefaultRxRestClientRequest<>(callbackRequest);
requestBuilder.call(rxDecoratedRequest);
} catch (Exception e) {
emitter.onError(e);
}
});
} }
|
public class class_name {
@Override
public <T> Single<RestClientResponse<T>> request(HttpMethod method, String uri, Class<T> responseClass, Action1<RestClientRequest<T>> requestBuilder) {
return Single.fromEmitter(emitter -> {
final RestClientRequest<T> callbackRequest = restClient.request(method, uri, responseClass, restClientResponse -> emitter.onSuccess(new DefaultRxRestClientResponse<>(restClientResponse)))
.exceptionHandler(emitter::onError);
try {
final DefaultRxRestClientRequest<T> rxDecoratedRequest = new DefaultRxRestClientRequest<>(callbackRequest);
requestBuilder.call(rxDecoratedRequest); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
emitter.onError(e);
} // depends on control dependency: [catch], data = [none]
});
} }
|
public class class_name {
static <V> LookupProcessor create(
ChronoElement<V> element,
Map<V, String> resources
) {
Map<V, String> map;
Class<V> keyType = element.getType();
if (keyType.isEnum()) {
if (resources.size() < keyType.getEnumConstants().length) {
throw new IllegalArgumentException("Not enough text resources defined for enum: " + keyType.getName());
}
map = createMap(keyType);
} else {
map = new HashMap<>(resources.size());
}
map.putAll(resources);
return new LookupProcessor<>(element, map);
} }
|
public class class_name {
static <V> LookupProcessor create(
ChronoElement<V> element,
Map<V, String> resources
) {
Map<V, String> map;
Class<V> keyType = element.getType();
if (keyType.isEnum()) {
if (resources.size() < keyType.getEnumConstants().length) {
throw new IllegalArgumentException("Not enough text resources defined for enum: " + keyType.getName());
}
map = createMap(keyType); // depends on control dependency: [if], data = [none]
} else {
map = new HashMap<>(resources.size()); // depends on control dependency: [if], data = [none]
}
map.putAll(resources);
return new LookupProcessor<>(element, map);
} }
|
public class class_name {
private CanInlineResult canInlineReferenceAsStatementBlock(
Reference ref, Node fnNode, ImmutableSet<String> namesToAlias) {
CallSiteType callSiteType = classifyCallSite(ref);
if (callSiteType == CallSiteType.UNSUPPORTED) {
return CanInlineResult.NO;
}
if (!allowDecomposition
&& (callSiteType == CallSiteType.DECOMPOSABLE_EXPRESSION
|| callSiteType == CallSiteType.EXPRESSION)) {
return CanInlineResult.NO;
}
if (!callMeetsBlockInliningRequirements(ref, fnNode, namesToAlias)) {
return CanInlineResult.NO;
}
if (callSiteType == CallSiteType.DECOMPOSABLE_EXPRESSION
|| callSiteType == CallSiteType.EXPRESSION) {
return CanInlineResult.AFTER_PREPARATION;
} else {
return CanInlineResult.YES;
}
} }
|
public class class_name {
private CanInlineResult canInlineReferenceAsStatementBlock(
Reference ref, Node fnNode, ImmutableSet<String> namesToAlias) {
CallSiteType callSiteType = classifyCallSite(ref);
if (callSiteType == CallSiteType.UNSUPPORTED) {
return CanInlineResult.NO; // depends on control dependency: [if], data = [none]
}
if (!allowDecomposition
&& (callSiteType == CallSiteType.DECOMPOSABLE_EXPRESSION
|| callSiteType == CallSiteType.EXPRESSION)) {
return CanInlineResult.NO; // depends on control dependency: [if], data = [none]
}
if (!callMeetsBlockInliningRequirements(ref, fnNode, namesToAlias)) {
return CanInlineResult.NO; // depends on control dependency: [if], data = [none]
}
if (callSiteType == CallSiteType.DECOMPOSABLE_EXPRESSION
|| callSiteType == CallSiteType.EXPRESSION) {
return CanInlineResult.AFTER_PREPARATION; // depends on control dependency: [if], data = [none]
} else {
return CanInlineResult.YES; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean load(GVRScene scene)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (scene == null)
{
scene = getGVRContext().getMainScene();
}
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, scene, null);
}
else
{
loader.loadModel(getOwnerObject(), mVolume, mImportSettings, scene);
}
return true;
} }
|
public class class_name {
public boolean load(GVRScene scene)
{
GVRAssetLoader loader = getGVRContext().getAssetLoader();
if (scene == null)
{
scene = getGVRContext().getMainScene(); // depends on control dependency: [if], data = [none]
}
if (mReplaceScene)
{
loader.loadScene(getOwnerObject(), mVolume, mImportSettings, scene, null); // depends on control dependency: [if], data = [none]
}
else
{
loader.loadModel(getOwnerObject(), mVolume, mImportSettings, scene); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public static void wave(View[] layers, float scale, int duration, float offset) {
int step = 0;
for (View l : layers) {
wave(l, scale, duration, ((float) 1 / layers.length) * step * offset);
step++;
}
} }
|
public class class_name {
public static void wave(View[] layers, float scale, int duration, float offset) {
int step = 0;
for (View l : layers) {
wave(l, scale, duration, ((float) 1 / layers.length) * step * offset); // depends on control dependency: [for], data = [l]
step++; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private String cloud_hgt2_meters(String height) {
if (height.equals("999")) {
return "30000";
} else {
// $meters = 30 * $height ;
return Integer.toString(30 * Integer.parseInt(height));
}
} }
|
public class class_name {
private String cloud_hgt2_meters(String height) {
if (height.equals("999")) {
return "30000"; // depends on control dependency: [if], data = [none]
} else {
// $meters = 30 * $height ;
return Integer.toString(30 * Integer.parseInt(height)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setAveragingPeriod(final int PERIOD) {
if (null == averagingPeriod) {
_averagingPeriod = PERIOD;
movingAverage = new MovingAverage(PERIOD); // MAX 1000 values
fireUpdateEvent(REDRAW_EVENT);
} else {
averagingPeriod.set(PERIOD);
}
} }
|
public class class_name {
public void setAveragingPeriod(final int PERIOD) {
if (null == averagingPeriod) {
_averagingPeriod = PERIOD; // depends on control dependency: [if], data = [none]
movingAverage = new MovingAverage(PERIOD); // MAX 1000 values // depends on control dependency: [if], data = [none]
fireUpdateEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
averagingPeriod.set(PERIOD); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void goTo(final ContentScene contentScene) {
Log.d(TAG, "Go to %s", contentScene.getName());
if (!goBackTo(contentScene)) {
mContentSceneViewStack.push(contentScene);
}
executeHideShowCycle(contentScene);
} }
|
public class class_name {
public void goTo(final ContentScene contentScene) {
Log.d(TAG, "Go to %s", contentScene.getName());
if (!goBackTo(contentScene)) {
mContentSceneViewStack.push(contentScene); // depends on control dependency: [if], data = [none]
}
executeHideShowCycle(contentScene);
} }
|
public class class_name {
@Nullable
public static String decode (@Nullable final String sValue)
{
if (sValue == null)
return null;
try
{
// try BCodec first
return new RFC1522BCodec ().getDecoded (sValue);
}
catch (final DecodeException de)
{
// try QCodec next
try
{
return new RFC1522QCodec ().getDecoded (sValue);
}
catch (final Exception ex)
{
return sValue;
}
}
catch (final Exception e)
{
return sValue;
}
} }
|
public class class_name {
@Nullable
public static String decode (@Nullable final String sValue)
{
if (sValue == null)
return null;
try
{
// try BCodec first
return new RFC1522BCodec ().getDecoded (sValue); // depends on control dependency: [try], data = [none]
}
catch (final DecodeException de)
{
// try QCodec next
try
{
return new RFC1522QCodec ().getDecoded (sValue); // depends on control dependency: [try], data = [none]
}
catch (final Exception ex)
{
return sValue;
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
catch (final Exception e)
{
return sValue;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
void putAnnotations(final int attributeNameIndex, final ByteVector output) {
int attributeLength = 2; // For num_annotations.
int numAnnotations = 0;
AnnotationWriter annotationWriter = this;
AnnotationWriter firstAnnotation = null;
while (annotationWriter != null) {
// In case the user forgot to call visitEnd().
annotationWriter.visitEnd();
attributeLength += annotationWriter.annotation.length;
numAnnotations++;
firstAnnotation = annotationWriter;
annotationWriter = annotationWriter.previousAnnotation;
}
output.putShort(attributeNameIndex);
output.putInt(attributeLength);
output.putShort(numAnnotations);
annotationWriter = firstAnnotation;
while (annotationWriter != null) {
output.putByteArray(annotationWriter.annotation.data, 0, annotationWriter.annotation.length);
annotationWriter = annotationWriter.nextAnnotation;
}
} }
|
public class class_name {
void putAnnotations(final int attributeNameIndex, final ByteVector output) {
int attributeLength = 2; // For num_annotations.
int numAnnotations = 0;
AnnotationWriter annotationWriter = this;
AnnotationWriter firstAnnotation = null;
while (annotationWriter != null) {
// In case the user forgot to call visitEnd().
annotationWriter.visitEnd(); // depends on control dependency: [while], data = [none]
attributeLength += annotationWriter.annotation.length; // depends on control dependency: [while], data = [none]
numAnnotations++; // depends on control dependency: [while], data = [none]
firstAnnotation = annotationWriter; // depends on control dependency: [while], data = [none]
annotationWriter = annotationWriter.previousAnnotation; // depends on control dependency: [while], data = [none]
}
output.putShort(attributeNameIndex);
output.putInt(attributeLength);
output.putShort(numAnnotations);
annotationWriter = firstAnnotation;
while (annotationWriter != null) {
output.putByteArray(annotationWriter.annotation.data, 0, annotationWriter.annotation.length); // depends on control dependency: [while], data = [(annotationWriter]
annotationWriter = annotationWriter.nextAnnotation; // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public static void flushAll(long now) {
if (MetricsManager.instance != null) {
MetricsManager.instance.metricsLoggers.values().forEach(MetricsManager::flushMetricsLogger);
flushToServer(now);
}
} }
|
public class class_name {
public static void flushAll(long now) {
if (MetricsManager.instance != null) {
MetricsManager.instance.metricsLoggers.values().forEach(MetricsManager::flushMetricsLogger); // depends on control dependency: [if], data = [none]
flushToServer(now); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public int getOpcode(final int opcode) {
if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) {
// the offset for IALOAD or IASTORE is in byte 1 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF00) >> 8 : 4);
} else {
// the offset for other instructions is in byte 2 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF0000) >> 16 : 4);
}
} }
|
public class class_name {
public int getOpcode(final int opcode) {
if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) {
// the offset for IALOAD or IASTORE is in byte 1 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF00) >> 8 : 4); // depends on control dependency: [if], data = [none]
} else {
// the offset for other instructions is in byte 2 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF0000) >> 16 : 4); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ZapTable getTableExtension() {
if (tableExt == null) {
tableExt = new ZapTable() {
private static final long serialVersionUID = 1L;
@Override
protected AutoScrollAction createAutoScrollAction() {
return null;
}
};
tableExt.setAutoScrollOnNewValues(false);
tableExt.setModel(getExtensionModel());
tableExt.setRowHeight(DisplayUtils.getScaledSize(18));
tableExt.getColumnModel().getColumn(0).setPreferredWidth(DisplayUtils.getScaledSize(70));
tableExt.getColumnModel().getColumn(1).setPreferredWidth(DisplayUtils.getScaledSize(70));
tableExt.getColumnModel().getColumn(2).setPreferredWidth(DisplayUtils.getScaledSize(120));
tableExt.getColumnModel().getColumn(3).setPreferredWidth(DisplayUtils.getScaledSize(220));
tableExt.setSortOrder(3, SortOrder.ASCENDING);
ListSelectionListener sl = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent arg0) {
int selectedRow = tableExt.getSelectedRow();
if (selectedRow > -1) {
Extension ext = getExtensionModel().getExtension(tableExt.convertRowIndexToModel(selectedRow));
if (ext != null) {
try {
extName.setText(ext.getUIName());
boolean addOnExtension = ext.getAddOn() != null;
addOnNameLabel.setVisible(addOnExtension);
addOnName.setVisible(addOnExtension);
addOnName.setText(addOnExtension ? ext.getAddOn().getName() : "");
extDescription.setText(ext.getDescription());
if (ext.getAuthor() != null) {
extAuthor.setText(ext.getAuthor());
} else {
extAuthor.setText("");
}
if (ext.getURL() != null) {
extURL.setText(ext.getURL().toString());
getUrlLaunchButton().setEnabled(true);
} else {
extURL.setText("");
getUrlLaunchButton().setEnabled(false);
}
} catch (Exception e) {
// Just to be safe
log.error(e.getMessage(), e);
}
}
}
}};
tableExt.getSelectionModel().addListSelectionListener(sl);
tableExt.setColumnControlVisible(true);
}
return tableExt;
} }
|
public class class_name {
private ZapTable getTableExtension() {
if (tableExt == null) {
tableExt = new ZapTable() {
private static final long serialVersionUID = 1L;
@Override
protected AutoScrollAction createAutoScrollAction() {
return null;
}
};
// depends on control dependency: [if], data = [none]
tableExt.setAutoScrollOnNewValues(false);
// depends on control dependency: [if], data = [none]
tableExt.setModel(getExtensionModel());
// depends on control dependency: [if], data = [none]
tableExt.setRowHeight(DisplayUtils.getScaledSize(18));
// depends on control dependency: [if], data = [none]
tableExt.getColumnModel().getColumn(0).setPreferredWidth(DisplayUtils.getScaledSize(70));
// depends on control dependency: [if], data = [none]
tableExt.getColumnModel().getColumn(1).setPreferredWidth(DisplayUtils.getScaledSize(70));
// depends on control dependency: [if], data = [none]
tableExt.getColumnModel().getColumn(2).setPreferredWidth(DisplayUtils.getScaledSize(120));
// depends on control dependency: [if], data = [none]
tableExt.getColumnModel().getColumn(3).setPreferredWidth(DisplayUtils.getScaledSize(220));
// depends on control dependency: [if], data = [none]
tableExt.setSortOrder(3, SortOrder.ASCENDING);
// depends on control dependency: [if], data = [none]
ListSelectionListener sl = new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent arg0) {
int selectedRow = tableExt.getSelectedRow();
if (selectedRow > -1) {
Extension ext = getExtensionModel().getExtension(tableExt.convertRowIndexToModel(selectedRow));
if (ext != null) {
try {
extName.setText(ext.getUIName());
// depends on control dependency: [try], data = [none]
boolean addOnExtension = ext.getAddOn() != null;
addOnNameLabel.setVisible(addOnExtension);
// depends on control dependency: [try], data = [none]
addOnName.setVisible(addOnExtension);
// depends on control dependency: [try], data = [none]
addOnName.setText(addOnExtension ? ext.getAddOn().getName() : "");
extDescription.setText(ext.getDescription());
// depends on control dependency: [try], data = [none]
if (ext.getAuthor() != null) {
extAuthor.setText(ext.getAuthor());
// depends on control dependency: [if], data = [(ext.getAuthor()]
} else {
extAuthor.setText("");
// depends on control dependency: [if], data = [none]
}
if (ext.getURL() != null) {
extURL.setText(ext.getURL().toString());
// depends on control dependency: [if], data = [(ext.getURL()]
getUrlLaunchButton().setEnabled(true);
// depends on control dependency: [if], data = [none]
} else {
extURL.setText("");
// depends on control dependency: [if], data = [none]
getUrlLaunchButton().setEnabled(false);
// depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
// Just to be safe
log.error(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
}
}
}};
tableExt.getSelectionModel().addListSelectionListener(sl);
// depends on control dependency: [if], data = [none]
tableExt.setColumnControlVisible(true);
// depends on control dependency: [if], data = [none]
}
return tableExt;
} }
|
public class class_name {
private Page getTargetPage(String targetPath, InternalLinkResolverOptions options) {
if (StringUtils.isEmpty(targetPath)) {
return null;
}
// Rewrite target to current site context
String rewrittenPath;
if (options.isRewritePathToContext() && !useTargetContext(options)) {
rewrittenPath = urlHandler.rewritePathToContext(SyntheticNavigatableResource.get(targetPath, resourceResolver));
}
else {
rewrittenPath = targetPath;
}
if (StringUtils.isEmpty(rewrittenPath)) {
return null;
}
// Get target page referenced by target path and check for acceptance
Page targetPage = pageManager.getPage(rewrittenPath);
if (acceptPage(targetPage, options)) {
return targetPage;
}
else {
return null;
}
} }
|
public class class_name {
private Page getTargetPage(String targetPath, InternalLinkResolverOptions options) {
if (StringUtils.isEmpty(targetPath)) {
return null; // depends on control dependency: [if], data = [none]
}
// Rewrite target to current site context
String rewrittenPath;
if (options.isRewritePathToContext() && !useTargetContext(options)) {
rewrittenPath = urlHandler.rewritePathToContext(SyntheticNavigatableResource.get(targetPath, resourceResolver)); // depends on control dependency: [if], data = [none]
}
else {
rewrittenPath = targetPath; // depends on control dependency: [if], data = [none]
}
if (StringUtils.isEmpty(rewrittenPath)) {
return null; // depends on control dependency: [if], data = [none]
}
// Get target page referenced by target path and check for acceptance
Page targetPage = pageManager.getPage(rewrittenPath);
if (acceptPage(targetPage, options)) {
return targetPage; // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean selectItem(int dataIndex, boolean select) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select);
if (dataIndex < 0 || dataIndex >= mContent.size()) {
throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!");
}
updateSelectedItemsList(dataIndex, select);
ListItemHostWidget hostWidget = getHostView(dataIndex, false);
if (hostWidget != null) {
hostWidget.setSelected(select);
hostWidget.requestLayout();
return true;
}
return false;
} }
|
public class class_name {
public boolean selectItem(int dataIndex, boolean select) {
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "selectItem [%d] select [%b]", dataIndex, select);
if (dataIndex < 0 || dataIndex >= mContent.size()) {
throw new IndexOutOfBoundsException("Selection index [" + dataIndex + "] is out of bounds!");
}
updateSelectedItemsList(dataIndex, select);
ListItemHostWidget hostWidget = getHostView(dataIndex, false);
if (hostWidget != null) {
hostWidget.setSelected(select); // depends on control dependency: [if], data = [none]
hostWidget.requestLayout(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static boolean isWhitespace(CharSequence string) {
if (string == null) {
return true;
}
return StringUtil.trimToNull(string.toString()) == null;
} }
|
public class class_name {
public static boolean isWhitespace(CharSequence string) {
if (string == null) {
return true; // depends on control dependency: [if], data = [none]
}
return StringUtil.trimToNull(string.toString()) == null;
} }
|
public class class_name {
private static int _getDistance111 (@Nonnull final char [] aStr1,
@Nonnegative final int nLen1,
@Nonnull final char [] aStr2,
@Nonnegative final int nLen2)
{
// previous cost array, horizontally
int [] aPrevRow = new int [nLen1 + 1];
// cost array, horizontally
int [] aCurRow = new int [nLen1 + 1];
// init
for (int i = 0; i <= nLen1; i++)
aPrevRow[i] = i;
for (int j = 0; j < nLen2; j++)
{
final int ch2 = aStr2[j];
aCurRow[0] = j + 1;
for (int i = 0; i < nLen1; i++)
{
final int nSubstVal = aStr1[i] == ch2 ? 0 : 1;
aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + 1, aPrevRow[i + 1] + 1), aPrevRow[i] + nSubstVal);
}
// swap current distance counts to 'previous row' distance counts
final int [] tmp = aPrevRow;
aPrevRow = aCurRow;
aCurRow = tmp;
}
// our last action in the above loop was to switch d and p, so p now
// actually has the most recent cost counts
return aPrevRow[nLen1];
} }
|
public class class_name {
private static int _getDistance111 (@Nonnull final char [] aStr1,
@Nonnegative final int nLen1,
@Nonnull final char [] aStr2,
@Nonnegative final int nLen2)
{
// previous cost array, horizontally
int [] aPrevRow = new int [nLen1 + 1];
// cost array, horizontally
int [] aCurRow = new int [nLen1 + 1];
// init
for (int i = 0; i <= nLen1; i++)
aPrevRow[i] = i;
for (int j = 0; j < nLen2; j++)
{
final int ch2 = aStr2[j];
aCurRow[0] = j + 1; // depends on control dependency: [for], data = [j]
for (int i = 0; i < nLen1; i++)
{
final int nSubstVal = aStr1[i] == ch2 ? 0 : 1;
aCurRow[i + 1] = Math.min (Math.min (aCurRow[i] + 1, aPrevRow[i + 1] + 1), aPrevRow[i] + nSubstVal); // depends on control dependency: [for], data = [i]
}
// swap current distance counts to 'previous row' distance counts
final int [] tmp = aPrevRow;
aPrevRow = aCurRow; // depends on control dependency: [for], data = [none]
aCurRow = tmp; // depends on control dependency: [for], data = [none]
}
// our last action in the above loop was to switch d and p, so p now
// actually has the most recent cost counts
return aPrevRow[nLen1];
} }
|
public class class_name {
protected void notifyListenersDatabaseOpen(Collection<DatabaseListener> listeners, DatabaseServer databaseServer)
throws DatabaseException {
for (DatabaseListener databaseListener : listeners) {
try {
databaseListener.databaseOpen(databaseServer);
} catch (DatabaseUnsupportedException e) {
logger.error(e.getMessage(), e);
}
}
} }
|
public class class_name {
protected void notifyListenersDatabaseOpen(Collection<DatabaseListener> listeners, DatabaseServer databaseServer)
throws DatabaseException {
for (DatabaseListener databaseListener : listeners) {
try {
databaseListener.databaseOpen(databaseServer); // depends on control dependency: [try], data = [none]
} catch (DatabaseUnsupportedException e) {
logger.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public ArrayList<String> getAllColumns() {
ArrayList<String> columns = new ArrayList<String>();
for (String col : columnLookup.keySet()) {
columns.add(col);
}
return columns;
} }
|
public class class_name {
public ArrayList<String> getAllColumns() {
ArrayList<String> columns = new ArrayList<String>();
for (String col : columnLookup.keySet()) {
columns.add(col); // depends on control dependency: [for], data = [col]
}
return columns;
} }
|
public class class_name {
public boolean contains(final float k) {
int intKey = Float.floatToIntBits(k);
if (intKey == 0) {
return this.containsZero;
} else {
float[] key = this.key;
int curr;
int pos;
if ((curr = Float.floatToIntBits(key[pos = MurmurHashUtil.fmix(intKey) & this.mask])) == 0) {
return false;
} else if (intKey == curr) {
return true;
} else {
while ((curr = Float.floatToIntBits(key[pos = pos + 1 & this.mask])) != 0) {
if (intKey == curr) {
return true;
}
}
return false;
}
}
} }
|
public class class_name {
public boolean contains(final float k) {
int intKey = Float.floatToIntBits(k);
if (intKey == 0) {
return this.containsZero; // depends on control dependency: [if], data = [none]
} else {
float[] key = this.key;
int curr;
int pos;
if ((curr = Float.floatToIntBits(key[pos = MurmurHashUtil.fmix(intKey) & this.mask])) == 0) {
return false; // depends on control dependency: [if], data = [none]
} else if (intKey == curr) {
return true; // depends on control dependency: [if], data = [none]
} else {
while ((curr = Float.floatToIntBits(key[pos = pos + 1 & this.mask])) != 0) {
if (intKey == curr) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Descriptor("Send event admin messages")
public void sendmessage(@Descriptor("sendmessage BUS [KEY=VALUE ]*") String... parameters) {
assert parameters[0] != null;
String bus = parameters[0];
Dictionary eventAdminPayload = new Hashtable();
for (String m : parameters) {
if (m.contains("=")) {
StringTokenizer st = new StringTokenizer(m, "=");
assert st.countTokens() == 2;
String key = st.nextToken();
String value = st.nextToken();
eventAdminPayload.put(key, value);
}
}
Event eventAdminMessage = new Event(bus, eventAdminPayload);
print(String.format("Sending message to the bus %s with the arguments %s", bus, eventAdminPayload));
print("Event admin message sent");
eventAdmin.sendEvent(eventAdminMessage);
} }
|
public class class_name {
@Descriptor("Send event admin messages")
public void sendmessage(@Descriptor("sendmessage BUS [KEY=VALUE ]*") String... parameters) {
assert parameters[0] != null;
String bus = parameters[0];
Dictionary eventAdminPayload = new Hashtable();
for (String m : parameters) {
if (m.contains("=")) {
StringTokenizer st = new StringTokenizer(m, "=");
assert st.countTokens() == 2;
String key = st.nextToken();
String value = st.nextToken();
eventAdminPayload.put(key, value); // depends on control dependency: [if], data = [none]
}
}
Event eventAdminMessage = new Event(bus, eventAdminPayload);
print(String.format("Sending message to the bus %s with the arguments %s", bus, eventAdminPayload));
print("Event admin message sent");
eventAdmin.sendEvent(eventAdminMessage);
} }
|
public class class_name {
public boolean checkForDangerousProps() {
final Map<String, String> dangerousProps = new HashMap<>();
dangerousProps.put("ro.debuggable", "1");
dangerousProps.put("ro.secure", "0");
boolean result = false;
String[] lines = propsReader();
if (lines == null){
// Could not read, assume false;
return false;
}
for (String line : lines) {
for (String key : dangerousProps.keySet()) {
if (line.contains(key)) {
String badValue = dangerousProps.get(key);
badValue = "[" + badValue + "]";
if (line.contains(badValue)) {
QLog.v(key + " = " + badValue + " detected!");
result = true;
}
}
}
}
return result;
} }
|
public class class_name {
public boolean checkForDangerousProps() {
final Map<String, String> dangerousProps = new HashMap<>();
dangerousProps.put("ro.debuggable", "1");
dangerousProps.put("ro.secure", "0");
boolean result = false;
String[] lines = propsReader();
if (lines == null){
// Could not read, assume false;
return false; // depends on control dependency: [if], data = [none]
}
for (String line : lines) {
for (String key : dangerousProps.keySet()) {
if (line.contains(key)) {
String badValue = dangerousProps.get(key);
badValue = "[" + badValue + "]"; // depends on control dependency: [if], data = [none]
if (line.contains(badValue)) {
QLog.v(key + " = " + badValue + " detected!"); // depends on control dependency: [if], data = [none]
result = true; // depends on control dependency: [if], data = [none]
}
}
}
}
return result;
} }
|
public class class_name {
static <T> T runWithRetries(Callable<T> callable) {
// Use same backoff setting as abort, somewhat arbitrarily.
Span span = tracer.getCurrentSpan();
ExponentialBackOff backOff = newBackOff();
Context context = Context.current();
int attempt = 0;
while (true) {
attempt++;
try {
span.addAnnotation(
"Starting operation",
ImmutableMap.of("Attempt", AttributeValue.longAttributeValue(attempt)));
T result = callable.call();
return result;
} catch (SpannerException e) {
if (!e.isRetryable()) {
throw e;
}
logger.log(Level.FINE, "Retryable exception, will sleep and retry", e);
long delay = e.getRetryDelayInMillis();
if (delay != -1) {
backoffSleep(context, delay);
} else {
backoffSleep(context, backOff);
}
} catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw newSpannerException(ErrorCode.INTERNAL, "Unexpected exception thrown", e);
}
}
} }
|
public class class_name {
static <T> T runWithRetries(Callable<T> callable) {
// Use same backoff setting as abort, somewhat arbitrarily.
Span span = tracer.getCurrentSpan();
ExponentialBackOff backOff = newBackOff();
Context context = Context.current();
int attempt = 0;
while (true) {
attempt++; // depends on control dependency: [while], data = [none]
try {
span.addAnnotation(
"Starting operation",
ImmutableMap.of("Attempt", AttributeValue.longAttributeValue(attempt))); // depends on control dependency: [try], data = [none]
T result = callable.call();
return result; // depends on control dependency: [try], data = [none]
} catch (SpannerException e) {
if (!e.isRetryable()) {
throw e;
}
logger.log(Level.FINE, "Retryable exception, will sleep and retry", e);
long delay = e.getRetryDelayInMillis();
if (delay != -1) {
backoffSleep(context, delay); // depends on control dependency: [if], data = [none]
} else {
backoffSleep(context, backOff); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
Throwables.throwIfUnchecked(e);
throw newSpannerException(ErrorCode.INTERNAL, "Unexpected exception thrown", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static int[] stride(INDArray arr, INDArrayIndex[] indexes, int... shape) {
List<Integer> strides = new ArrayList<>();
int strideIndex = 0;
//list of indexes to prepend to for new axes
//if all is encountered
List<Integer> prependNewAxes = new ArrayList<>();
for (int i = 0; i < indexes.length; i++) {
//just like the shape, drops the stride
if (indexes[i] instanceof PointIndex) {
strideIndex++;
continue;
} else if (indexes[i] instanceof NewAxis) {
}
}
/**
* For each dimension
* where we want to prepend a dimension
* we need to add it at the index such that
* we account for the offset of the number of indexes
* added up to that point.
*
* We do this by doing an offset
* for each item added "so far"
*
* Note that we also have an offset of - 1
* because we want to prepend to the given index.
*
* When prepend new axes for in the middle is triggered
* i is already > 0
*/
for (int i = 0; i < prependNewAxes.size(); i++) {
strides.add(prependNewAxes.get(i) - i, 1);
}
return Ints.toArray(strides);
} }
|
public class class_name {
public static int[] stride(INDArray arr, INDArrayIndex[] indexes, int... shape) {
List<Integer> strides = new ArrayList<>();
int strideIndex = 0;
//list of indexes to prepend to for new axes
//if all is encountered
List<Integer> prependNewAxes = new ArrayList<>();
for (int i = 0; i < indexes.length; i++) {
//just like the shape, drops the stride
if (indexes[i] instanceof PointIndex) {
strideIndex++; // depends on control dependency: [if], data = [none]
continue;
} else if (indexes[i] instanceof NewAxis) {
}
}
/**
* For each dimension
* where we want to prepend a dimension
* we need to add it at the index such that
* we account for the offset of the number of indexes
* added up to that point.
*
* We do this by doing an offset
* for each item added "so far"
*
* Note that we also have an offset of - 1
* because we want to prepend to the given index.
*
* When prepend new axes for in the middle is triggered
* i is already > 0
*/
for (int i = 0; i < prependNewAxes.size(); i++) {
strides.add(prependNewAxes.get(i) - i, 1); // depends on control dependency: [for], data = [i]
}
return Ints.toArray(strides);
} }
|
public class class_name {
private Object[] getTable()
{
expungeCount++;
if (expungeCount >= MAX_EXPUNGE_COUNT)
{
forceWeak = this.size() > weakThreshold;
expungeCount = 0;
if (expungerUpdater.compareAndSet(this, 0, 1))
{
MithraConcurrentEvictorThread.getInstance().queueEviction(this);
}
}
return table;
} }
|
public class class_name {
private Object[] getTable()
{
expungeCount++;
if (expungeCount >= MAX_EXPUNGE_COUNT)
{
forceWeak = this.size() > weakThreshold;
// depends on control dependency: [if], data = [none]
expungeCount = 0;
// depends on control dependency: [if], data = [none]
if (expungerUpdater.compareAndSet(this, 0, 1))
{
MithraConcurrentEvictorThread.getInstance().queueEviction(this);
// depends on control dependency: [if], data = [none]
}
}
return table;
} }
|
public class class_name {
protected static <R extends AddressSection, S extends AddressSegment> R fastIncrement(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(increment >= 0) {
BigInteger count = section.getCount();
if(count.compareTo(LONG_MAX) <= 0) {
long longCount = count.longValue();
if(longCount > increment) {
if(longCount == increment + 1) {
return upperProducer.get();
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength);
}
BigInteger value = section.getValue();
BigInteger upperValue;
if(value.compareTo(LONG_MAX) <= 0 && (upperValue = section.getUpperValue()).compareTo(LONG_MAX) <= 0) {
return increment(
section,
increment,
addrCreator,
count.longValue(),
value.longValue(),
upperValue.longValue(),
lowerProducer,
upperProducer,
prefixLength);
}
}
} else {
BigInteger value = section.getValue();
if(value.compareTo(LONG_MAX) <= 0) {
return add(lowerProducer.get(), value.longValue(), increment, addrCreator, prefixLength);
}
}
return null;
} }
|
public class class_name {
protected static <R extends AddressSection, S extends AddressSegment> R fastIncrement(
R section,
long increment,
AddressCreator<?, R, ?, S> addrCreator,
Supplier<R> lowerProducer,
Supplier<R> upperProducer,
Integer prefixLength) {
if(increment >= 0) {
BigInteger count = section.getCount();
if(count.compareTo(LONG_MAX) <= 0) {
long longCount = count.longValue();
if(longCount > increment) {
if(longCount == increment + 1) {
return upperProducer.get(); // depends on control dependency: [if], data = [none]
}
return incrementRange(section, increment, addrCreator, lowerProducer, prefixLength); // depends on control dependency: [if], data = [none]
}
BigInteger value = section.getValue();
BigInteger upperValue;
if(value.compareTo(LONG_MAX) <= 0 && (upperValue = section.getUpperValue()).compareTo(LONG_MAX) <= 0) {
return increment(
section,
increment,
addrCreator,
count.longValue(),
value.longValue(),
upperValue.longValue(),
lowerProducer,
upperProducer,
prefixLength); // depends on control dependency: [if], data = [none]
}
}
} else {
BigInteger value = section.getValue();
if(value.compareTo(LONG_MAX) <= 0) {
return add(lowerProducer.get(), value.longValue(), increment, addrCreator, prefixLength); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public static IReaction getReactionByReactionID(IReactionSet reactionSet, String id) {
Iterable<IReaction> reactionIter = reactionSet.reactions();
for (IReaction reaction : reactionIter) {
if (reaction.getID() != null && reaction.getID().equals(id)) {
return reaction;
}
}
return null;
} }
|
public class class_name {
public static IReaction getReactionByReactionID(IReactionSet reactionSet, String id) {
Iterable<IReaction> reactionIter = reactionSet.reactions();
for (IReaction reaction : reactionIter) {
if (reaction.getID() != null && reaction.getID().equals(id)) {
return reaction; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
public <A> List<A> addToBatchGetKeys(Class<A> klass){
this.addToBatch();
if (this.currentBatchRecords == 0) {
return this.connection.getKeys(klass);
} else {
return Collections.emptyList();
}
} }
|
public class class_name {
public <A> List<A> addToBatchGetKeys(Class<A> klass){
this.addToBatch();
if (this.currentBatchRecords == 0) {
return this.connection.getKeys(klass); // depends on control dependency: [if], data = [none]
} else {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected Stylesheet resolve(String sheet) {
try {
sheet = sheet.replace("\\", "/");
if (!sheet.endsWith(".scss")) {
sheet += ".scss";
}
try (InputStream is = resolveIntoStream(sheet)) {
if (is == null) {
warn("Cannot resolve '" + sheet + "'. Skipping import.");
return null;
}
Parser p = new Parser(sheet, new InputStreamReader(is));
return p.parse();
}
} catch (ParseException e) {
warn(String.format("Error parsing: %s%n%s", sheet, e.toString()));
} catch (Exception e) {
warn(String.format("Error importing: %s: %s (%s)", sheet, e.getMessage(), e.getClass().getName()));
}
return null;
} }
|
public class class_name {
protected Stylesheet resolve(String sheet) {
try {
sheet = sheet.replace("\\", "/"); // depends on control dependency: [try], data = [none]
if (!sheet.endsWith(".scss")) {
sheet += ".scss"; // depends on control dependency: [if], data = [none]
}
try (InputStream is = resolveIntoStream(sheet)) {
if (is == null) {
warn("Cannot resolve '" + sheet + "'. Skipping import."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
Parser p = new Parser(sheet, new InputStreamReader(is));
return p.parse(); // depends on control dependency: [try], data = [none]
}
} catch (ParseException e) {
warn(String.format("Error parsing: %s%n%s", sheet, e.toString()));
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
warn(String.format("Error importing: %s: %s (%s)", sheet, e.getMessage(), e.getClass().getName()));
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
@Private
@Override
public void threwException(final int taskletId, final Exception exception) {
try {
failedTasklets(exception, Collections.singletonList(taskletId));
} catch (final InterruptedException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
@Private
@Override
public void threwException(final int taskletId, final Exception exception) {
try {
failedTasklets(exception, Collections.singletonList(taskletId)); // depends on control dependency: [try], data = [exception]
} catch (final InterruptedException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.