code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private void commitContexts(boolean accept, boolean all) {
Stack<IManagedContext<?>> stack = commitStack;
commitStack = new Stack<>();
// First, commit or cancel all pending context changes.
for (IManagedContext<?> managedContext : stack) {
if (managedContext.isPending()) {
managedContext.commit(accept);
}
}
// Then notify subscribers of the changes.
while (!stack.isEmpty()) {
stack.pop().notifySubscribers(accept, all);
}
} }
|
public class class_name {
private void commitContexts(boolean accept, boolean all) {
Stack<IManagedContext<?>> stack = commitStack;
commitStack = new Stack<>();
// First, commit or cancel all pending context changes.
for (IManagedContext<?> managedContext : stack) {
if (managedContext.isPending()) {
managedContext.commit(accept); // depends on control dependency: [if], data = [none]
}
}
// Then notify subscribers of the changes.
while (!stack.isEmpty()) {
stack.pop().notifySubscribers(accept, all); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public GenomicsDataSource<Read, ReadGroupSet, Reference> get(String rootUrl) {
Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl);
if (data == null) {
data = new Data<Read, ReadGroupSet, Reference>(new Settings(), null);
dataSources.put(rootUrl, data);
}
if (data.dataSource == null) {
data.dataSource = makeDataSource(rootUrl, data.settings);
}
return data.dataSource;
} }
|
public class class_name {
public GenomicsDataSource<Read, ReadGroupSet, Reference> get(String rootUrl) {
Data<Read, ReadGroupSet, Reference> data = dataSources.get(rootUrl);
if (data == null) {
data = new Data<Read, ReadGroupSet, Reference>(new Settings(), null); // depends on control dependency: [if], data = [null)]
dataSources.put(rootUrl, data); // depends on control dependency: [if], data = [none]
}
if (data.dataSource == null) {
data.dataSource = makeDataSource(rootUrl, data.settings); // depends on control dependency: [if], data = [none]
}
return data.dataSource;
} }
|
public class class_name {
@Override
public void signal(String signalName, Object signalData) {
if (getActivity() == null) {
throw new PvmException("cannot signal execution " + this.id + ": it has no current activity");
}
SignallableActivityBehavior activityBehavior = (SignallableActivityBehavior) activity.getActivityBehavior();
try {
activityBehavior.signal(this, signalName, signalData);
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new PvmException("couldn't process signal '" + signalName + "' on activity '" + activity.getId() + "': " + e.getMessage(), e);
}
} }
|
public class class_name {
@Override
public void signal(String signalName, Object signalData) {
if (getActivity() == null) {
throw new PvmException("cannot signal execution " + this.id + ": it has no current activity");
}
SignallableActivityBehavior activityBehavior = (SignallableActivityBehavior) activity.getActivityBehavior();
try {
activityBehavior.signal(this, signalName, signalData); // depends on control dependency: [try], data = [none]
} catch (RuntimeException e) {
throw e;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
throw new PvmException("couldn't process signal '" + signalName + "' on activity '" + activity.getId() + "': " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void login(String userName, String password, String projectName) {
HttpSession session = null;
m_loginException = null;
try {
// login the user and create a new session
CmsUser user = getCmsObject().readUser(userName);
OpenCms.getSessionManager().checkCreateSessionForUser(user);
getCmsObject().loginUser(userName, password, getRequestContext().getRemoteAddress());
// make sure we have a new session after login for security reasons
session = getRequest().getSession(false);
if (session != null) {
session.invalidate();
}
session = getRequest().getSession(true);
if (projectName != null) {
// if this fails, the login is regarded as a failure as well
getCmsObject().getRequestContext().setCurrentProject(getCmsObject().readProject(projectName));
}
if (!getCmsObject().getRequestContext().getCurrentProject().isOnlineProject()) {
// in case the user is logged into an offline project, send any available login message
CmsLoginMessage loginMessage = OpenCms.getLoginManager().getLoginMessage();
if ((loginMessage != null) && loginMessage.isActive()) {
OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getRequest());
OpenCms.getSessionManager().sendBroadcast(null, loginMessage.getMessage(), user);
}
}
} catch (CmsException e) {
// the login has failed
m_loginException = e;
}
if (m_loginException == null) {
// login was successful
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_LOGIN_SUCCESSFUL_3,
userName,
getRequestContext().addSiteRoot(getRequestContext().getUri()),
getRequestContext().getRemoteAddress()));
}
} else {
// login was not successful
if (session != null) {
session.invalidate();
}
CmsException currentLoginException = m_loginException;
logLoginException(getRequestContext(), userName, currentLoginException);
}
} }
|
public class class_name {
public void login(String userName, String password, String projectName) {
HttpSession session = null;
m_loginException = null;
try {
// login the user and create a new session
CmsUser user = getCmsObject().readUser(userName);
OpenCms.getSessionManager().checkCreateSessionForUser(user); // depends on control dependency: [try], data = [none]
getCmsObject().loginUser(userName, password, getRequestContext().getRemoteAddress()); // depends on control dependency: [try], data = [none]
// make sure we have a new session after login for security reasons
session = getRequest().getSession(false); // depends on control dependency: [try], data = [none]
if (session != null) {
session.invalidate(); // depends on control dependency: [if], data = [none]
}
session = getRequest().getSession(true); // depends on control dependency: [try], data = [none]
if (projectName != null) {
// if this fails, the login is regarded as a failure as well
getCmsObject().getRequestContext().setCurrentProject(getCmsObject().readProject(projectName)); // depends on control dependency: [if], data = [(projectName]
}
if (!getCmsObject().getRequestContext().getCurrentProject().isOnlineProject()) {
// in case the user is logged into an offline project, send any available login message
CmsLoginMessage loginMessage = OpenCms.getLoginManager().getLoginMessage();
if ((loginMessage != null) && loginMessage.isActive()) {
OpenCms.getSessionManager().updateSessionInfo(getCmsObject(), getRequest()); // depends on control dependency: [if], data = [none]
OpenCms.getSessionManager().sendBroadcast(null, loginMessage.getMessage(), user); // depends on control dependency: [if], data = [none]
}
}
} catch (CmsException e) {
// the login has failed
m_loginException = e;
} // depends on control dependency: [catch], data = [none]
if (m_loginException == null) {
// login was successful
if (LOG.isInfoEnabled()) {
LOG.info(
Messages.get().getBundle().key(
Messages.LOG_LOGIN_SUCCESSFUL_3,
userName,
getRequestContext().addSiteRoot(getRequestContext().getUri()),
getRequestContext().getRemoteAddress())); // depends on control dependency: [if], data = [none]
}
} else {
// login was not successful
if (session != null) {
session.invalidate(); // depends on control dependency: [if], data = [none]
}
CmsException currentLoginException = m_loginException;
logLoginException(getRequestContext(), userName, currentLoginException); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void checkKeyVisibilityConvention(Node key, Node parent) {
JSDocInfo info = key.getJSDocInfo();
if (info == null) {
return;
}
if (!isPrivateByConvention(key.getString())) {
return;
}
Node assign = parent.getParent();
if (assign == null || !assign.isAssign()) {
return;
}
Node left = assign.getFirstChild();
if (!left.isGetProp()
|| !left.getLastChild().getString().equals("prototype")) {
return;
}
Visibility declaredVisibility = info.getVisibility();
// Visibility is declared to be something other than private.
if (declaredVisibility != Visibility.INHERITED
&& declaredVisibility != Visibility.PRIVATE) {
compiler.report(JSError.make(key, CONVENTION_MISMATCH));
}
} }
|
public class class_name {
private void checkKeyVisibilityConvention(Node key, Node parent) {
JSDocInfo info = key.getJSDocInfo();
if (info == null) {
return; // depends on control dependency: [if], data = [none]
}
if (!isPrivateByConvention(key.getString())) {
return; // depends on control dependency: [if], data = [none]
}
Node assign = parent.getParent();
if (assign == null || !assign.isAssign()) {
return; // depends on control dependency: [if], data = [none]
}
Node left = assign.getFirstChild();
if (!left.isGetProp()
|| !left.getLastChild().getString().equals("prototype")) {
return; // depends on control dependency: [if], data = [none]
}
Visibility declaredVisibility = info.getVisibility();
// Visibility is declared to be something other than private.
if (declaredVisibility != Visibility.INHERITED
&& declaredVisibility != Visibility.PRIVATE) {
compiler.report(JSError.make(key, CONVENTION_MISMATCH)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@POST
@Path("{guid}")
@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response updateEntityByGuid(@PathParam("guid") String guid, @QueryParam("property") String attribute,
@Context HttpServletRequest request) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> EntityResource.updateEntityByGuid({}, {})", guid, attribute);
}
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityResource.updateEntityByGuid(" + guid + ", " + attribute + ")");
}
if (StringUtils.isEmpty(attribute)) {
return partialUpdateEntityByGuid(guid, request);
} else {
return partialUpdateEntityAttrByGuid(guid, attribute, request);
}
} finally {
AtlasPerfTracer.log(perf);
if (LOG.isDebugEnabled()) {
LOG.debug("<== EntityResource.updateEntityByGuid({}, {})", guid, attribute);
}
}
} }
|
public class class_name {
@POST
@Path("{guid}")
@Consumes({Servlets.JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON})
@Produces(Servlets.JSON_MEDIA_TYPE)
public Response updateEntityByGuid(@PathParam("guid") String guid, @QueryParam("property") String attribute,
@Context HttpServletRequest request) {
if (LOG.isDebugEnabled()) {
LOG.debug("==> EntityResource.updateEntityByGuid({}, {})", guid, attribute); // depends on control dependency: [if], data = [none]
}
AtlasPerfTracer perf = null;
try {
if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "EntityResource.updateEntityByGuid(" + guid + ", " + attribute + ")");
}
if (StringUtils.isEmpty(attribute)) {
return partialUpdateEntityByGuid(guid, request);
} else {
return partialUpdateEntityAttrByGuid(guid, attribute, request);
}
} finally {
AtlasPerfTracer.log(perf);
if (LOG.isDebugEnabled()) {
LOG.debug("<== EntityResource.updateEntityByGuid({}, {})", guid, attribute); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public long getLong(String name, long defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Long.parseLong(value.trim());
}
} catch (NumberFormatException e) {
log.warn("Failed to parse long for " + name + USING_DEFAULT_OF
+ defaultValue);
}
return defaultValue;
} }
|
public class class_name {
public long getLong(String name, long defaultValue) {
try {
String value = getString(name, null);
if (!StringUtils.isNullOrEmpty(value)) {
return Long.parseLong(value.trim()); // depends on control dependency: [if], data = [none]
}
} catch (NumberFormatException e) {
log.warn("Failed to parse long for " + name + USING_DEFAULT_OF
+ defaultValue);
} // depends on control dependency: [catch], data = [none]
return defaultValue;
} }
|
public class class_name {
public Collection<String> predictSeveral(@NonNull LabelledDocument document, int limit) {
if (document.getReferencedContent() != null) {
return predictSeveral(document.getReferencedContent(), limit);
} else
return predictSeveral(document.getContent(), limit);
} }
|
public class class_name {
public Collection<String> predictSeveral(@NonNull LabelledDocument document, int limit) {
if (document.getReferencedContent() != null) {
return predictSeveral(document.getReferencedContent(), limit); // depends on control dependency: [if], data = [(document.getReferencedContent()]
} else
return predictSeveral(document.getContent(), limit);
} }
|
public class class_name {
public static String resolveIpAddress(final String hostname) {
try {
InetAddress netAddress;
if (hostname == null || hostname.equalsIgnoreCase(LOCAL_HOST)) {
netAddress = InetAddress.getLocalHost();
} else {
netAddress = Inet4Address.getByName(hostname);
}
return netAddress.getHostAddress();
} catch (UnknownHostException ignore) {
return null;
}
} }
|
public class class_name {
public static String resolveIpAddress(final String hostname) {
try {
InetAddress netAddress;
if (hostname == null || hostname.equalsIgnoreCase(LOCAL_HOST)) {
netAddress = InetAddress.getLocalHost(); // depends on control dependency: [if], data = [none]
} else {
netAddress = Inet4Address.getByName(hostname); // depends on control dependency: [if], data = [(hostname]
}
return netAddress.getHostAddress(); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException ignore) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void executeDirectly(String jobId) {
final CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)getJob(jobId).clone();
if (jobInfo == null) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_JOB_1, "null"));
return;
}
Thread thread = new Thread() {
/**
* @see java.lang.Thread#run()
*/
@Override
public void run() {
executeJob(jobInfo);
}
};
thread.start();
} }
|
public class class_name {
public void executeDirectly(String jobId) {
final CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)getJob(jobId).clone();
if (jobInfo == null) {
LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_JOB_1, "null")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Thread thread = new Thread() {
/**
* @see java.lang.Thread#run()
*/
@Override
public void run() {
executeJob(jobInfo);
}
};
thread.start();
} }
|
public class class_name {
public OrderableDBInstanceOption withAvailableProcessorFeatures(AvailableProcessorFeature... availableProcessorFeatures) {
if (this.availableProcessorFeatures == null) {
setAvailableProcessorFeatures(new com.amazonaws.internal.SdkInternalList<AvailableProcessorFeature>(availableProcessorFeatures.length));
}
for (AvailableProcessorFeature ele : availableProcessorFeatures) {
this.availableProcessorFeatures.add(ele);
}
return this;
} }
|
public class class_name {
public OrderableDBInstanceOption withAvailableProcessorFeatures(AvailableProcessorFeature... availableProcessorFeatures) {
if (this.availableProcessorFeatures == null) {
setAvailableProcessorFeatures(new com.amazonaws.internal.SdkInternalList<AvailableProcessorFeature>(availableProcessorFeatures.length)); // depends on control dependency: [if], data = [none]
}
for (AvailableProcessorFeature ele : availableProcessorFeatures) {
this.availableProcessorFeatures.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static PartitionReader createReader(Settings settings, PartitionDefinition partition, Log log) {
if (!SettingsUtils.hasPinnedNode(settings) && partition.getLocations().length > 0) {
String pinAddress = checkLocality(partition.getLocations(), log);
if (pinAddress != null) {
if (log.isDebugEnabled()) {
log.debug(String.format("Partition reader instance [%s] assigned to [%s]", partition, pinAddress));
}
SettingsUtils.pinNode(settings, pinAddress);
}
}
ClusterInfo clusterInfo = InitializationUtils.discoverClusterInfo(settings, log);
ValueReader reader = ObjectUtils.instantiate(settings.getSerializerValueReaderClassName(), settings);
// initialize REST client
RestRepository repository = new RestRepository(settings);
Mapping fieldMapping = null;
if (StringUtils.hasText(partition.getSerializedMapping())) {
fieldMapping = IOUtils.deserializeFromBase64(partition.getSerializedMapping());
}
else {
log.warn(String.format("No mapping found for [%s] - either no index exists or the partition configuration has been corrupted", partition));
}
ScrollReader scrollReader = new ScrollReader(ScrollReaderConfigBuilder.builder(reader, fieldMapping, settings));
if (settings.getNodesClientOnly()) {
String clientNode = repository.getRestClient().getCurrentNode();
if (log.isDebugEnabled()) {
log.debug(String.format("Client-node routing detected; partition reader instance [%s] assigned to [%s]",
partition, clientNode));
}
SettingsUtils.pinNode(settings, clientNode);
}
// take into account client node routing
boolean includeVersion = settings.getReadMetadata() && settings.getReadMetadataVersion();
Resource read = new Resource(settings, true);
SearchRequestBuilder requestBuilder =
new SearchRequestBuilder(clusterInfo.getMajorVersion(), includeVersion)
.resource(read)
// Overwrite the index name from the resource to be that of the concrete index in the partition definition
.indices(partition.getIndex())
.query(QueryUtils.parseQuery(settings))
.scroll(settings.getScrollKeepAlive())
.size(settings.getScrollSize())
.limit(settings.getScrollLimit())
.fields(SettingsUtils.determineSourceFields(settings))
.filters(QueryUtils.parseFilters(settings))
.shard(Integer.toString(partition.getShardId()))
.readMetadata(settings.getReadMetadata())
.local(true)
.preference(settings.getShardPreference())
.excludeSource(settings.getExcludeSource());
if (partition.getSlice() != null && partition.getSlice().max > 1) {
requestBuilder.slice(partition.getSlice().id, partition.getSlice().max);
}
String[] indices = read.index().split(",");
if (QueryUtils.isExplicitlyRequested(partition.getIndex(), indices) == false) {
IndicesAliases indicesAliases =
new GetAliasesRequestBuilder(repository.getRestClient())
.indices(partition.getIndex())
.execute().getIndices();
Map<String, IndicesAliases.Alias> aliases = indicesAliases.getAliases(partition.getIndex());
if (aliases != null && aliases.size() > 0) {
requestBuilder = applyAliasMetadata(clusterInfo.getMajorVersion(), aliases, requestBuilder, partition.getIndex(), indices);
}
}
return new PartitionReader(scrollReader, repository, requestBuilder);
} }
|
public class class_name {
public static PartitionReader createReader(Settings settings, PartitionDefinition partition, Log log) {
if (!SettingsUtils.hasPinnedNode(settings) && partition.getLocations().length > 0) {
String pinAddress = checkLocality(partition.getLocations(), log);
if (pinAddress != null) {
if (log.isDebugEnabled()) {
log.debug(String.format("Partition reader instance [%s] assigned to [%s]", partition, pinAddress)); // depends on control dependency: [if], data = [none]
}
SettingsUtils.pinNode(settings, pinAddress); // depends on control dependency: [if], data = [none]
}
}
ClusterInfo clusterInfo = InitializationUtils.discoverClusterInfo(settings, log);
ValueReader reader = ObjectUtils.instantiate(settings.getSerializerValueReaderClassName(), settings);
// initialize REST client
RestRepository repository = new RestRepository(settings);
Mapping fieldMapping = null;
if (StringUtils.hasText(partition.getSerializedMapping())) {
fieldMapping = IOUtils.deserializeFromBase64(partition.getSerializedMapping()); // depends on control dependency: [if], data = [none]
}
else {
log.warn(String.format("No mapping found for [%s] - either no index exists or the partition configuration has been corrupted", partition)); // depends on control dependency: [if], data = [none]
}
ScrollReader scrollReader = new ScrollReader(ScrollReaderConfigBuilder.builder(reader, fieldMapping, settings));
if (settings.getNodesClientOnly()) {
String clientNode = repository.getRestClient().getCurrentNode();
if (log.isDebugEnabled()) {
log.debug(String.format("Client-node routing detected; partition reader instance [%s] assigned to [%s]",
partition, clientNode));
}
SettingsUtils.pinNode(settings, clientNode);
}
// take into account client node routing
boolean includeVersion = settings.getReadMetadata() && settings.getReadMetadataVersion();
Resource read = new Resource(settings, true);
SearchRequestBuilder requestBuilder =
new SearchRequestBuilder(clusterInfo.getMajorVersion(), includeVersion)
.resource(read)
// Overwrite the index name from the resource to be that of the concrete index in the partition definition
.indices(partition.getIndex())
.query(QueryUtils.parseQuery(settings))
.scroll(settings.getScrollKeepAlive())
.size(settings.getScrollSize())
.limit(settings.getScrollLimit())
.fields(SettingsUtils.determineSourceFields(settings))
.filters(QueryUtils.parseFilters(settings))
.shard(Integer.toString(partition.getShardId()))
.readMetadata(settings.getReadMetadata())
.local(true)
.preference(settings.getShardPreference())
.excludeSource(settings.getExcludeSource());
if (partition.getSlice() != null && partition.getSlice().max > 1) { // depends on control dependency: [if], data = [none]
requestBuilder.slice(partition.getSlice().id, partition.getSlice().max);
}
String[] indices = read.index().split(",");
if (QueryUtils.isExplicitlyRequested(partition.getIndex(), indices) == false) {
IndicesAliases indicesAliases =
new GetAliasesRequestBuilder(repository.getRestClient())
.indices(partition.getIndex())
.execute().getIndices();
Map<String, IndicesAliases.Alias> aliases = indicesAliases.getAliases(partition.getIndex());
if (aliases != null && aliases.size() > 0) {
requestBuilder = applyAliasMetadata(clusterInfo.getMajorVersion(), aliases, requestBuilder, partition.getIndex(), indices); // depends on control dependency: [if], data = [none]
}
}
return new PartitionReader(scrollReader, repository, requestBuilder); // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public static <K,V> Map<K,V> minus(Map<K,V> self, Map removeMe) {
final Map<K,V> ansMap = createSimilarMap(self);
ansMap.putAll(self);
if (removeMe != null && removeMe.size() > 0) {
for (Map.Entry<K, V> e1 : self.entrySet()) {
for (Object e2 : removeMe.entrySet()) {
if (DefaultTypeTransformation.compareEqual(e1, e2)) {
ansMap.remove(e1.getKey());
}
}
}
}
return ansMap;
} }
|
public class class_name {
public static <K,V> Map<K,V> minus(Map<K,V> self, Map removeMe) {
final Map<K,V> ansMap = createSimilarMap(self);
ansMap.putAll(self);
if (removeMe != null && removeMe.size() > 0) {
for (Map.Entry<K, V> e1 : self.entrySet()) {
for (Object e2 : removeMe.entrySet()) {
if (DefaultTypeTransformation.compareEqual(e1, e2)) {
ansMap.remove(e1.getKey()); // depends on control dependency: [if], data = [none]
}
}
}
}
return ansMap;
} }
|
public class class_name {
public int filterObject(CaptureSearchResult r) {
String httpCode = r.getHttpCode();
// only filter real 3XX http response codes:
if(httpCode.startsWith("3")) {
String redirect = r.getRedirectUrl();
if(redirect.compareTo("-") != 0) {
String urlKey = r.getUrlKey();
try {
String redirectKey = canonicalizer.urlStringToKey(redirect);
if((redirectKey != null) && (urlKey != null) &&
(redirectKey.compareTo(urlKey) == 0)) {
// only omit if same scheme:
String origScheme =
UrlOperations.urlToScheme(r.getOriginalUrl());
String redirScheme =
UrlOperations.urlToScheme(redirect);
if((origScheme != null) && (redirScheme != null) &&
(origScheme.compareTo(redirScheme) == 0)) {
return FILTER_EXCLUDE;
}
}
} catch (URIException e) {
// emit message (is that right?) and continue
LOGGER.info("Bad redirectURL:" + redirect +
" urlKey:"+ urlKey +
" date:"+ r.getCaptureTimestamp());
}
}
}
return FILTER_INCLUDE;
} }
|
public class class_name {
public int filterObject(CaptureSearchResult r) {
String httpCode = r.getHttpCode();
// only filter real 3XX http response codes:
if(httpCode.startsWith("3")) {
String redirect = r.getRedirectUrl();
if(redirect.compareTo("-") != 0) {
String urlKey = r.getUrlKey();
try {
String redirectKey = canonicalizer.urlStringToKey(redirect);
if((redirectKey != null) && (urlKey != null) &&
(redirectKey.compareTo(urlKey) == 0)) {
// only omit if same scheme:
String origScheme =
UrlOperations.urlToScheme(r.getOriginalUrl());
String redirScheme =
UrlOperations.urlToScheme(redirect);
if((origScheme != null) && (redirScheme != null) &&
(origScheme.compareTo(redirScheme) == 0)) {
return FILTER_EXCLUDE; // depends on control dependency: [if], data = [none]
}
}
} catch (URIException e) {
// emit message (is that right?) and continue
LOGGER.info("Bad redirectURL:" + redirect +
" urlKey:"+ urlKey +
" date:"+ r.getCaptureTimestamp());
} // depends on control dependency: [catch], data = [none]
}
}
return FILTER_INCLUDE;
} }
|
public class class_name {
@Override protected void readRow(int uniqueID, byte[] data)
{
if (data[0] != (byte) 0xFF)
{
Map<String, Object> map = new HashMap<String, Object>();
map.put("UNIQUE_ID", Integer.valueOf(uniqueID));
map.put("TASK_ID_1", Integer.valueOf(PEPUtility.getShort(data, 1)));
map.put("TASK_ID_2", Integer.valueOf(PEPUtility.getShort(data, 3)));
map.put("TYPE", getRelationType(PEPUtility.getShort(data, 9)));
map.put("LAG", Duration.getInstance(PEPUtility.getShort(data, 11), TimeUnit.DAYS));
addRow(uniqueID, map);
}
} }
|
public class class_name {
@Override protected void readRow(int uniqueID, byte[] data)
{
if (data[0] != (byte) 0xFF)
{
Map<String, Object> map = new HashMap<String, Object>();
map.put("UNIQUE_ID", Integer.valueOf(uniqueID)); // depends on control dependency: [if], data = [none]
map.put("TASK_ID_1", Integer.valueOf(PEPUtility.getShort(data, 1))); // depends on control dependency: [if], data = [none]
map.put("TASK_ID_2", Integer.valueOf(PEPUtility.getShort(data, 3))); // depends on control dependency: [if], data = [none]
map.put("TYPE", getRelationType(PEPUtility.getShort(data, 9))); // depends on control dependency: [if], data = [none]
map.put("LAG", Duration.getInstance(PEPUtility.getShort(data, 11), TimeUnit.DAYS)); // depends on control dependency: [if], data = [none]
addRow(uniqueID, map); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
void unlockBucketsRead(long i1, long i2) {
int bucket1LockIdx = getBucketLock(i1);
int bucket2LockIdx = getBucketLock(i2);
// always unlock segments in same order to avoid deadlocks
if (bucket1LockIdx == bucket2LockIdx) {
lockAry[bucket1LockIdx].tryUnlockRead();
return;
}
lockAry[bucket1LockIdx].tryUnlockRead();
lockAry[bucket2LockIdx].tryUnlockRead();
} }
|
public class class_name {
void unlockBucketsRead(long i1, long i2) {
int bucket1LockIdx = getBucketLock(i1);
int bucket2LockIdx = getBucketLock(i2);
// always unlock segments in same order to avoid deadlocks
if (bucket1LockIdx == bucket2LockIdx) {
lockAry[bucket1LockIdx].tryUnlockRead();
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
lockAry[bucket1LockIdx].tryUnlockRead();
lockAry[bucket2LockIdx].tryUnlockRead();
} }
|
public class class_name {
public long getSoFar(final int downloadId) {
BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(downloadId);
if (task == null) {
return FileDownloadServiceProxy.getImpl().getSofar(downloadId);
}
return task.getOrigin().getLargeFileSoFarBytes();
} }
|
public class class_name {
public long getSoFar(final int downloadId) {
BaseDownloadTask.IRunningTask task = FileDownloadList.getImpl().get(downloadId);
if (task == null) {
return FileDownloadServiceProxy.getImpl().getSofar(downloadId); // depends on control dependency: [if], data = [none]
}
return task.getOrigin().getLargeFileSoFarBytes();
} }
|
public class class_name {
private void updateGAdsParams() {
BRANCH_API_VERSION version = getBranchRemoteAPIVersion();
int LATVal = DeviceInfo.getInstance().getSystemObserver().getLATVal();
String gaid = DeviceInfo.getInstance().getSystemObserver().getGAID();
if (!TextUtils.isEmpty(gaid)) {
try {
if (version == BRANCH_API_VERSION.V2) {
JSONObject userDataObj = params_.optJSONObject(Defines.Jsonkey.UserData.getKey());
if (userDataObj != null) {
userDataObj.put(Defines.Jsonkey.AAID.getKey(), gaid);
userDataObj.put(Defines.Jsonkey.LimitedAdTracking.getKey(), LATVal);
userDataObj.remove(Defines.Jsonkey.UnidentifiedDevice.getKey());
}
} else {
params_.put(Defines.Jsonkey.GoogleAdvertisingID.getKey(), gaid);
params_.put(Defines.Jsonkey.LATVal.getKey(), LATVal);
}
} catch (JSONException e) {
e.printStackTrace();
}
} else { // Add unidentified_device when neither GAID nor AndroidID are present
if (version == BRANCH_API_VERSION.V2) {
try {
if (version == BRANCH_API_VERSION.V2) {
JSONObject userDataObj = params_.optJSONObject(Defines.Jsonkey.UserData.getKey());
if (userDataObj != null) {
if (!userDataObj.has(Defines.Jsonkey.AndroidID.getKey())) {
userDataObj.put(Defines.Jsonkey.UnidentifiedDevice.getKey(), true);
}
}
}
} catch (JSONException ignore) {
}
}
}
} }
|
public class class_name {
private void updateGAdsParams() {
BRANCH_API_VERSION version = getBranchRemoteAPIVersion();
int LATVal = DeviceInfo.getInstance().getSystemObserver().getLATVal();
String gaid = DeviceInfo.getInstance().getSystemObserver().getGAID();
if (!TextUtils.isEmpty(gaid)) {
try {
if (version == BRANCH_API_VERSION.V2) {
JSONObject userDataObj = params_.optJSONObject(Defines.Jsonkey.UserData.getKey());
if (userDataObj != null) {
userDataObj.put(Defines.Jsonkey.AAID.getKey(), gaid); // depends on control dependency: [if], data = [none]
userDataObj.put(Defines.Jsonkey.LimitedAdTracking.getKey(), LATVal); // depends on control dependency: [if], data = [none]
userDataObj.remove(Defines.Jsonkey.UnidentifiedDevice.getKey()); // depends on control dependency: [if], data = [none]
}
} else {
params_.put(Defines.Jsonkey.GoogleAdvertisingID.getKey(), gaid); // depends on control dependency: [if], data = [none]
params_.put(Defines.Jsonkey.LATVal.getKey(), LATVal); // depends on control dependency: [if], data = [none]
}
} catch (JSONException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} else { // Add unidentified_device when neither GAID nor AndroidID are present
if (version == BRANCH_API_VERSION.V2) {
try {
if (version == BRANCH_API_VERSION.V2) {
JSONObject userDataObj = params_.optJSONObject(Defines.Jsonkey.UserData.getKey());
if (userDataObj != null) {
if (!userDataObj.has(Defines.Jsonkey.AndroidID.getKey())) {
userDataObj.put(Defines.Jsonkey.UnidentifiedDevice.getKey(), true); // depends on control dependency: [if], data = [none]
}
}
}
} catch (JSONException ignore) {
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
@Deprecated
public static String getServerAddress(Configuration conf,
String oldBindAddressName,
String oldPortName,
String newBindAddressName) {
String oldAddr = conf.get(oldBindAddressName);
int oldPort = conf.getInt(oldPortName, 0);
String newAddrPort = conf.get(newBindAddressName);
if (oldAddr == null && oldPort == 0) {
return toIpPort(createSocketAddr(newAddrPort));
}
InetSocketAddress newAddr = NetUtils.createSocketAddr(newAddrPort);
if (oldAddr == null) {
oldAddr = newAddr.getAddress().getHostAddress();
} else {
LOG.warn("Configuration parameter " + oldBindAddressName +
" is deprecated. Use " + newBindAddressName + " instead.");
}
if (oldPort == 0) {
oldPort = newAddr.getPort();
} else {
LOG.warn("Configuration parameter " + oldPortName +
" is deprecated. Use " + newBindAddressName + " instead.");
}
try {
return toIpPort(oldAddr, oldPort);
} catch (UnknownHostException e) {
LOG.error("DNS not supported.");
LOG.fatal(e);
}
return oldAddr + ":" + oldPort;
} }
|
public class class_name {
@Deprecated
public static String getServerAddress(Configuration conf,
String oldBindAddressName,
String oldPortName,
String newBindAddressName) {
String oldAddr = conf.get(oldBindAddressName);
int oldPort = conf.getInt(oldPortName, 0);
String newAddrPort = conf.get(newBindAddressName);
if (oldAddr == null && oldPort == 0) {
return toIpPort(createSocketAddr(newAddrPort)); // depends on control dependency: [if], data = [none]
}
InetSocketAddress newAddr = NetUtils.createSocketAddr(newAddrPort);
if (oldAddr == null) {
oldAddr = newAddr.getAddress().getHostAddress(); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("Configuration parameter " + oldBindAddressName +
" is deprecated. Use " + newBindAddressName + " instead."); // depends on control dependency: [if], data = [none]
}
if (oldPort == 0) {
oldPort = newAddr.getPort(); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("Configuration parameter " + oldPortName +
" is deprecated. Use " + newBindAddressName + " instead."); // depends on control dependency: [if], data = [none]
}
try {
return toIpPort(oldAddr, oldPort); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
LOG.error("DNS not supported.");
LOG.fatal(e);
} // depends on control dependency: [catch], data = [none]
return oldAddr + ":" + oldPort;
} }
|
public class class_name {
public final List<FieldTextInfo> createFieldInfos(@NotNull final Class<?> clasz, @NotNull final Locale locale,
@NotNull final Class<? extends Annotation> annotationClasz) {
Contract.requireArgNotNull("clasz", clasz);
Contract.requireArgNotNull("locale", locale);
Contract.requireArgNotNull("annotationClasz", annotationClasz);
final List<FieldTextInfo> infos = new ArrayList<FieldTextInfo>();
final Field[] fields = clasz.getDeclaredFields();
for (final Field field : fields) {
final Annotation annotation = field.getAnnotation(annotationClasz);
if (annotation != null) {
try {
final ResourceBundle bundle = getResourceBundle(annotation, locale, field.getDeclaringClass());
final String text = getText(bundle, annotation, field.getName() + "." + annotationClasz.getSimpleName());
infos.add(new FieldTextInfo(field, text));
} catch (final MissingResourceException ex) {
final String text = toNullableString(getValue(annotation));
infos.add(new FieldTextInfo(field, text));
}
}
}
Class<?> parent = clasz;
while ((parent = parent.getSuperclass()) != Object.class) {
infos.addAll(createFieldInfos(parent, locale, annotationClasz));
}
return infos;
} }
|
public class class_name {
public final List<FieldTextInfo> createFieldInfos(@NotNull final Class<?> clasz, @NotNull final Locale locale,
@NotNull final Class<? extends Annotation> annotationClasz) {
Contract.requireArgNotNull("clasz", clasz);
Contract.requireArgNotNull("locale", locale);
Contract.requireArgNotNull("annotationClasz", annotationClasz);
final List<FieldTextInfo> infos = new ArrayList<FieldTextInfo>();
final Field[] fields = clasz.getDeclaredFields();
for (final Field field : fields) {
final Annotation annotation = field.getAnnotation(annotationClasz);
if (annotation != null) {
try {
final ResourceBundle bundle = getResourceBundle(annotation, locale, field.getDeclaringClass());
final String text = getText(bundle, annotation, field.getName() + "." + annotationClasz.getSimpleName());
infos.add(new FieldTextInfo(field, text));
// depends on control dependency: [try], data = [none]
} catch (final MissingResourceException ex) {
final String text = toNullableString(getValue(annotation));
infos.add(new FieldTextInfo(field, text));
}
// depends on control dependency: [catch], data = [none]
}
}
Class<?> parent = clasz;
while ((parent = parent.getSuperclass()) != Object.class) {
infos.addAll(createFieldInfos(parent, locale, annotationClasz));
// depends on control dependency: [while], data = [none]
}
return infos;
} }
|
public class class_name {
public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block,
final VersionTally tally, final Integer height) {
final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class);
if (block.isBIP34()) {
final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34);
if (null != count && count >= getMajorityEnforceBlockUpgrade()) {
flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE);
}
}
return flags;
} }
|
public class class_name {
public EnumSet<Block.VerifyFlag> getBlockVerificationFlags(final Block block,
final VersionTally tally, final Integer height) {
final EnumSet<Block.VerifyFlag> flags = EnumSet.noneOf(Block.VerifyFlag.class);
if (block.isBIP34()) {
final Integer count = tally.getCountAtOrAbove(Block.BLOCK_VERSION_BIP34);
if (null != count && count >= getMajorityEnforceBlockUpgrade()) {
flags.add(Block.VerifyFlag.HEIGHT_IN_COINBASE); // depends on control dependency: [if], data = [none]
}
}
return flags;
} }
|
public class class_name {
public String getVocab(MixinSource mixinSource, Object bean, Class<?> mixInClass) {
if (proxyUnwrapper != null) {
bean = proxyUnwrapper.unwrapProxy(bean);
}
// determine vocab in context
String classVocab = bean == null ? null : vocabFromClassOrPackage(bean.getClass());
final Vocab mixinVocab = findAnnotation(mixInClass, Vocab.class);
Object nestedContextProviderFromMixin = getNestedContextProviderFromMixin(mixinSource, bean, mixInClass);
String contextProviderVocab = null;
if (nestedContextProviderFromMixin != null) {
contextProviderVocab = getVocab(mixinSource, nestedContextProviderFromMixin, null);
}
String vocab;
if (mixinVocab != null) {
vocab = mixinVocab.value(); // wins over class
} else if (classVocab != null) {
vocab = classVocab; // wins over context provider
} else if (contextProviderVocab != null) {
vocab = contextProviderVocab; // wins over last resort
} else {
vocab = HTTP_SCHEMA_ORG;
}
return vocab;
} }
|
public class class_name {
public String getVocab(MixinSource mixinSource, Object bean, Class<?> mixInClass) {
if (proxyUnwrapper != null) {
bean = proxyUnwrapper.unwrapProxy(bean); // depends on control dependency: [if], data = [none]
}
// determine vocab in context
String classVocab = bean == null ? null : vocabFromClassOrPackage(bean.getClass());
final Vocab mixinVocab = findAnnotation(mixInClass, Vocab.class);
Object nestedContextProviderFromMixin = getNestedContextProviderFromMixin(mixinSource, bean, mixInClass);
String contextProviderVocab = null;
if (nestedContextProviderFromMixin != null) {
contextProviderVocab = getVocab(mixinSource, nestedContextProviderFromMixin, null); // depends on control dependency: [if], data = [null)]
}
String vocab;
if (mixinVocab != null) {
vocab = mixinVocab.value(); // wins over class // depends on control dependency: [if], data = [none]
} else if (classVocab != null) {
vocab = classVocab; // wins over context provider // depends on control dependency: [if], data = [none]
} else if (contextProviderVocab != null) {
vocab = contextProviderVocab; // wins over last resort // depends on control dependency: [if], data = [none]
} else {
vocab = HTTP_SCHEMA_ORG; // depends on control dependency: [if], data = [none]
}
return vocab;
} }
|
public class class_name {
public void run(Runnable runnable)
{
if (this.goForward())
{
for (int i = this.from; i <= this.to; i += this.step)
{
runnable.run();
}
}
else
{
for (int i = this.from; i >= this.to; i += this.step)
{
runnable.run();
}
}
} }
|
public class class_name {
public void run(Runnable runnable)
{
if (this.goForward())
{
for (int i = this.from; i <= this.to; i += this.step)
{
runnable.run(); // depends on control dependency: [for], data = [none]
}
}
else
{
for (int i = this.from; i >= this.to; i += this.step)
{
runnable.run(); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
@Override
public final void process(final Class<?> entityClass, EntityMetadata metadata)
{
Cacheable cacheable = (Cacheable) entityClass.getAnnotation(Cacheable.class);
if (null != cacheable)
{
metadata.setCacheable(cacheable.value());
}
} }
|
public class class_name {
@Override
public final void process(final Class<?> entityClass, EntityMetadata metadata)
{
Cacheable cacheable = (Cacheable) entityClass.getAnnotation(Cacheable.class);
if (null != cacheable)
{
metadata.setCacheable(cacheable.value());
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean free(T obj)
{
int top = _top.get();
if (top < _freeStack.length()) {
boolean isFree = _freeStack.compareAndSet(top, null, obj);
_top.compareAndSet(top, top + 1);
return isFree;
}
else
return false;
} }
|
public class class_name {
public boolean free(T obj)
{
int top = _top.get();
if (top < _freeStack.length()) {
boolean isFree = _freeStack.compareAndSet(top, null, obj);
_top.compareAndSet(top, top + 1); // depends on control dependency: [if], data = [(top]
return isFree; // depends on control dependency: [if], data = [none]
}
else
return false;
} }
|
public class class_name {
private static double similarity(BufferedImage var, BufferedImage cont) {
double[] varArr = new double[var.getWidth()*var.getHeight()*3];
double[] contArr = new double[cont.getWidth()*cont.getHeight()*3];
if (varArr.length!=contArr.length)
throw new IllegalStateException("The pictures are different sizes!");
//unroll pixels
for(int i = 0; i < var.getHeight(); i++) {
for(int j = 0; j < var.getWidth(); j++) {
varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed();
contArr[i*cont.getWidth() + j + 0] = new Color(cont.getRGB(j, i)).getRed();
varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen();
contArr[i*cont.getWidth() + j + 1] = new Color(cont.getRGB(j, i)).getGreen();
varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue();
contArr[i*cont.getWidth() + j + 2] = new Color(cont.getRGB(j, i)).getBlue();
}
}
double mins=0;
double maxs=0;
for(int i=0;i!=varArr.length;i++){
if (varArr[i]>contArr[i]){
mins+=contArr[i];
maxs+=varArr[i];
} else {
mins+=varArr[i];
maxs+=contArr[i];
}
}
return mins/maxs;
} }
|
public class class_name {
private static double similarity(BufferedImage var, BufferedImage cont) {
double[] varArr = new double[var.getWidth()*var.getHeight()*3];
double[] contArr = new double[cont.getWidth()*cont.getHeight()*3];
if (varArr.length!=contArr.length)
throw new IllegalStateException("The pictures are different sizes!");
//unroll pixels
for(int i = 0; i < var.getHeight(); i++) {
for(int j = 0; j < var.getWidth(); j++) {
varArr[i*var.getWidth() + j + 0] = new Color(var.getRGB(j, i)).getRed(); // depends on control dependency: [for], data = [j]
contArr[i*cont.getWidth() + j + 0] = new Color(cont.getRGB(j, i)).getRed(); // depends on control dependency: [for], data = [j]
varArr[i*var.getWidth() + j + 1] = new Color(var.getRGB(j, i)).getGreen(); // depends on control dependency: [for], data = [j]
contArr[i*cont.getWidth() + j + 1] = new Color(cont.getRGB(j, i)).getGreen(); // depends on control dependency: [for], data = [j]
varArr[i*var.getWidth() + j + 2] = new Color(var.getRGB(j, i)).getBlue(); // depends on control dependency: [for], data = [j]
contArr[i*cont.getWidth() + j + 2] = new Color(cont.getRGB(j, i)).getBlue(); // depends on control dependency: [for], data = [j]
}
}
double mins=0;
double maxs=0;
for(int i=0;i!=varArr.length;i++){
if (varArr[i]>contArr[i]){
mins+=contArr[i]; // depends on control dependency: [if], data = [none]
maxs+=varArr[i]; // depends on control dependency: [if], data = [none]
} else {
mins+=varArr[i]; // depends on control dependency: [if], data = [none]
maxs+=contArr[i]; // depends on control dependency: [if], data = [none]
}
}
return mins/maxs;
} }
|
public class class_name {
private boolean addChineseIndexCharacters() {
UnicodeSet contractions = new UnicodeSet();
try {
collatorPrimaryOnly.internalAddContractions(BASE.charAt(0), contractions);
} catch (Exception e) {
return false;
}
if (contractions.isEmpty()) { return false; }
initialLabels.addAll(contractions);
for (String s : contractions) {
assert(s.startsWith(BASE));
char c = s.charAt(s.length() - 1);
if (0x41 <= c && c <= 0x5A) { // A-Z
// There are Pinyin labels, add ASCII A-Z labels as well.
initialLabels.add(0x41, 0x5A); // A-Z
break;
}
}
return true;
} }
|
public class class_name {
private boolean addChineseIndexCharacters() {
UnicodeSet contractions = new UnicodeSet();
try {
collatorPrimaryOnly.internalAddContractions(BASE.charAt(0), contractions); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return false;
} // depends on control dependency: [catch], data = [none]
if (contractions.isEmpty()) { return false; } // depends on control dependency: [if], data = [none]
initialLabels.addAll(contractions);
for (String s : contractions) {
assert(s.startsWith(BASE)); // depends on control dependency: [for], data = [s]
char c = s.charAt(s.length() - 1);
if (0x41 <= c && c <= 0x5A) { // A-Z
// There are Pinyin labels, add ASCII A-Z labels as well.
initialLabels.add(0x41, 0x5A); // A-Z // depends on control dependency: [if], data = [(0x41]
break;
}
}
return true;
} }
|
public class class_name {
private void injectInto(final Object target, final boolean oneMatch) throws AssertionError {
boolean success = false;
for (final Field field : this.collectFieldCandidates(target)) {
if (this.isMatching(field)) {
Object val = getValue(field);
try {
field.setAccessible(true);
this.inject(target, field, val);
success = true;
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new AssertionError("Injection of " + val + " into " + target + " failed", e);
}
if (oneMatch) {
return;
}
}
}
assertTrue("No matching field for injection found", success);
} }
|
public class class_name {
private void injectInto(final Object target, final boolean oneMatch) throws AssertionError {
boolean success = false;
for (final Field field : this.collectFieldCandidates(target)) {
if (this.isMatching(field)) {
Object val = getValue(field);
try {
field.setAccessible(true); // depends on control dependency: [try], data = [none]
this.inject(target, field, val); // depends on control dependency: [try], data = [none]
success = true; // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new AssertionError("Injection of " + val + " into " + target + " failed", e);
} // depends on control dependency: [catch], data = [none]
if (oneMatch) {
return; // depends on control dependency: [if], data = [none]
}
}
}
assertTrue("No matching field for injection found", success);
} }
|
public class class_name {
protected double kNNDistance() {
double result = getEntry(0).getKnnDistance();
for(int i = 1; i < getNumEntries(); i++) {
double knnDistance = getEntry(i).getKnnDistance();
result = (result < knnDistance) ? knnDistance : result;
}
return result;
} }
|
public class class_name {
protected double kNNDistance() {
double result = getEntry(0).getKnnDistance();
for(int i = 1; i < getNumEntries(); i++) {
double knnDistance = getEntry(i).getKnnDistance();
result = (result < knnDistance) ? knnDistance : result; // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
public java.util.List<VolumeConfiguration> getVolumeConfigurations() {
if (volumeConfigurations == null) {
volumeConfigurations = new com.amazonaws.internal.SdkInternalList<VolumeConfiguration>();
}
return volumeConfigurations;
} }
|
public class class_name {
public java.util.List<VolumeConfiguration> getVolumeConfigurations() {
if (volumeConfigurations == null) {
volumeConfigurations = new com.amazonaws.internal.SdkInternalList<VolumeConfiguration>(); // depends on control dependency: [if], data = [none]
}
return volumeConfigurations;
} }
|
public class class_name {
public void remove(final Long pipelineId) {
Assert.assertNotNull(pipelineId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
PipelineDO pipelineDO = pipelineDao.findById(pipelineId);
if (pipelineDO != null) {
pipelineDao.delete(pipelineId);
pipelineNodeRelationDao.deleteByPipelineId(pipelineId);
// 删除历史cursor
String destination = pipelineDO.getParameters().getDestinationName();
short clientId = pipelineDO.getId().shortValue();
arbitrateViewService.removeCanal(destination, clientId);
arbitrateManageService.pipelineEvent().destory(pipelineDO.getChannelId(), pipelineId);
}
} catch (Exception e) {
logger.error("ERROR ## remove the pipeline(" + pipelineId + ") has an exception!");
throw new ManagerException(e);
}
}
});
} }
|
public class class_name {
public void remove(final Long pipelineId) {
Assert.assertNotNull(pipelineId);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
try {
PipelineDO pipelineDO = pipelineDao.findById(pipelineId);
if (pipelineDO != null) {
pipelineDao.delete(pipelineId); // depends on control dependency: [if], data = [none]
pipelineNodeRelationDao.deleteByPipelineId(pipelineId); // depends on control dependency: [if], data = [none]
// 删除历史cursor
String destination = pipelineDO.getParameters().getDestinationName();
short clientId = pipelineDO.getId().shortValue();
arbitrateViewService.removeCanal(destination, clientId); // depends on control dependency: [if], data = [none]
arbitrateManageService.pipelineEvent().destory(pipelineDO.getChannelId(), pipelineId); // depends on control dependency: [if], data = [(pipelineDO]
}
} catch (Exception e) {
logger.error("ERROR ## remove the pipeline(" + pipelineId + ") has an exception!");
throw new ManagerException(e);
}
}
});
} } // depends on control dependency: [catch], data = [none]
|
public class class_name {
public void marshall(TimerFiredEventAttributes timerFiredEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (timerFiredEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timerFiredEventAttributes.getTimerId(), TIMERID_BINDING);
protocolMarshaller.marshall(timerFiredEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TimerFiredEventAttributes timerFiredEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (timerFiredEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timerFiredEventAttributes.getTimerId(), TIMERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(timerFiredEventAttributes.getStartedEventId(), STARTEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static <T> Qualifier<T> byAnnotation(AnnotationMetadata metadata, Class<? extends Annotation> type) {
if (Type.class == type) {
Optional<Class> aClass = metadata.classValue(type);
if (aClass.isPresent()) {
return byType(aClass.get());
}
} else if (Named.class == type) {
Optional<String> value = metadata.getValue(type, String.class);
if (value.isPresent()) {
return byName(value.get());
}
}
return new AnnotationMetadataQualifier<>(metadata, type);
} }
|
public class class_name {
public static <T> Qualifier<T> byAnnotation(AnnotationMetadata metadata, Class<? extends Annotation> type) {
if (Type.class == type) {
Optional<Class> aClass = metadata.classValue(type);
if (aClass.isPresent()) {
return byType(aClass.get()); // depends on control dependency: [if], data = [none]
}
} else if (Named.class == type) {
Optional<String> value = metadata.getValue(type, String.class);
if (value.isPresent()) {
return byName(value.get()); // depends on control dependency: [if], data = [none]
}
}
return new AnnotationMetadataQualifier<>(metadata, type);
} }
|
public class class_name {
public final void assignmentOperator() throws RecognitionException {
int assignmentOperator_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 109) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1123:5: ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' )
int alt141=12;
switch ( input.LA(1) ) {
case 54:
{
alt141=1;
}
break;
case 42:
{
alt141=2;
}
break;
case 46:
{
alt141=3;
}
break;
case 39:
{
alt141=4;
}
break;
case 50:
{
alt141=5;
}
break;
case 35:
{
alt141=6;
}
break;
case 123:
{
alt141=7;
}
break;
case 62:
{
alt141=8;
}
break;
case 32:
{
alt141=9;
}
break;
case 53:
{
alt141=10;
}
break;
case 56:
{
int LA141_11 = input.LA(2);
if ( (LA141_11==56) ) {
int LA141_12 = input.LA(3);
if ( (synpred212_Java()) ) {
alt141=11;
}
else if ( (true) ) {
alt141=12;
}
}
else {
if (state.backtracking>0) {state.failed=true; return;}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae =
new NoViableAltException("", 141, 11, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
break;
default:
if (state.backtracking>0) {state.failed=true; return;}
NoViableAltException nvae =
new NoViableAltException("", 141, 0, input);
throw nvae;
}
switch (alt141) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1123:7: '='
{
match(input,54,FOLLOW_54_in_assignmentOperator4899); if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1124:9: '+='
{
match(input,42,FOLLOW_42_in_assignmentOperator4909); if (state.failed) return;
}
break;
case 3 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1125:9: '-='
{
match(input,46,FOLLOW_46_in_assignmentOperator4919); if (state.failed) return;
}
break;
case 4 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1126:9: '*='
{
match(input,39,FOLLOW_39_in_assignmentOperator4929); if (state.failed) return;
}
break;
case 5 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1127:9: '/='
{
match(input,50,FOLLOW_50_in_assignmentOperator4939); if (state.failed) return;
}
break;
case 6 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1128:9: '&='
{
match(input,35,FOLLOW_35_in_assignmentOperator4949); if (state.failed) return;
}
break;
case 7 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1129:9: '|='
{
match(input,123,FOLLOW_123_in_assignmentOperator4959); if (state.failed) return;
}
break;
case 8 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1130:9: '^='
{
match(input,62,FOLLOW_62_in_assignmentOperator4969); if (state.failed) return;
}
break;
case 9 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1131:9: '%='
{
match(input,32,FOLLOW_32_in_assignmentOperator4979); if (state.failed) return;
}
break;
case 10 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1132:9: '<' '<' '='
{
match(input,53,FOLLOW_53_in_assignmentOperator4989); if (state.failed) return;
match(input,53,FOLLOW_53_in_assignmentOperator4991); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator4993); if (state.failed) return;
}
break;
case 11 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1133:9: '>' '>' '='
{
match(input,56,FOLLOW_56_in_assignmentOperator5003); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5005); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator5007); if (state.failed) return;
}
break;
case 12 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1134:9: '>' '>' '>' '='
{
match(input,56,FOLLOW_56_in_assignmentOperator5017); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5019); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5021); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator5023); if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 109, assignmentOperator_StartIndex); }
}
} }
|
public class class_name {
public final void assignmentOperator() throws RecognitionException {
int assignmentOperator_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 109) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1123:5: ( '=' | '+=' | '-=' | '*=' | '/=' | '&=' | '|=' | '^=' | '%=' | '<' '<' '=' | '>' '>' '=' | '>' '>' '>' '=' )
int alt141=12;
switch ( input.LA(1) ) {
case 54:
{
alt141=1;
}
break;
case 42:
{
alt141=2;
}
break;
case 46:
{
alt141=3;
}
break;
case 39:
{
alt141=4;
}
break;
case 50:
{
alt141=5;
}
break;
case 35:
{
alt141=6;
}
break;
case 123:
{
alt141=7;
}
break;
case 62:
{
alt141=8;
}
break;
case 32:
{
alt141=9;
}
break;
case 53:
{
alt141=10;
}
break;
case 56:
{
int LA141_11 = input.LA(2);
if ( (LA141_11==56) ) {
int LA141_12 = input.LA(3);
if ( (synpred212_Java()) ) {
alt141=11; // depends on control dependency: [if], data = [none]
}
else if ( (true) ) {
alt141=12; // depends on control dependency: [if], data = [none]
}
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
int nvaeMark = input.mark();
try {
input.consume(); // depends on control dependency: [try], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 141, 11, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
break;
default:
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 141, 0, input);
throw nvae;
}
switch (alt141) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1123:7: '='
{
match(input,54,FOLLOW_54_in_assignmentOperator4899); if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1124:9: '+='
{
match(input,42,FOLLOW_42_in_assignmentOperator4909); if (state.failed) return;
}
break;
case 3 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1125:9: '-='
{
match(input,46,FOLLOW_46_in_assignmentOperator4919); if (state.failed) return;
}
break;
case 4 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1126:9: '*='
{
match(input,39,FOLLOW_39_in_assignmentOperator4929); if (state.failed) return;
}
break;
case 5 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1127:9: '/='
{
match(input,50,FOLLOW_50_in_assignmentOperator4939); if (state.failed) return;
}
break;
case 6 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1128:9: '&='
{
match(input,35,FOLLOW_35_in_assignmentOperator4949); if (state.failed) return;
}
break;
case 7 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1129:9: '|='
{
match(input,123,FOLLOW_123_in_assignmentOperator4959); if (state.failed) return;
}
break;
case 8 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1130:9: '^='
{
match(input,62,FOLLOW_62_in_assignmentOperator4969); if (state.failed) return;
}
break;
case 9 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1131:9: '%='
{
match(input,32,FOLLOW_32_in_assignmentOperator4979); if (state.failed) return;
}
break;
case 10 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1132:9: '<' '<' '='
{
match(input,53,FOLLOW_53_in_assignmentOperator4989); if (state.failed) return;
match(input,53,FOLLOW_53_in_assignmentOperator4991); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator4993); if (state.failed) return;
}
break;
case 11 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1133:9: '>' '>' '='
{
match(input,56,FOLLOW_56_in_assignmentOperator5003); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5005); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator5007); if (state.failed) return;
}
break;
case 12 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1134:9: '>' '>' '>' '='
{
match(input,56,FOLLOW_56_in_assignmentOperator5017); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5019); if (state.failed) return;
match(input,56,FOLLOW_56_in_assignmentOperator5021); if (state.failed) return;
match(input,54,FOLLOW_54_in_assignmentOperator5023); if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 109, assignmentOperator_StartIndex); }
}
} }
|
public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
assert lo < hi;
int runHi = lo + 1;
if (runHi == hi)
return 1;
// Find end of run, and reverse range if descending
if (((Comparable) a[runHi++]).compareTo(a[lo]) < 0) { // Descending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi);
} else { // Ascending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) >= 0)
runHi++;
}
return runHi - lo;
} }
|
public class class_name {
@SuppressWarnings({"unchecked", "rawtypes"})
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
assert lo < hi;
int runHi = lo + 1;
if (runHi == hi)
return 1;
// Find end of run, and reverse range if descending
if (((Comparable) a[runHi++]).compareTo(a[lo]) < 0) { // Descending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi); // depends on control dependency: [if], data = [none]
} else { // Ascending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) >= 0)
runHi++;
}
return runHi - lo;
} }
|
public class class_name {
long purge(final int sampleSize) {
final int limit = Math.min(sampleSize, getNumActive());
int numSamples = 0;
int i = 0;
final long[] samples = new long[limit];
while (numSamples < limit) {
if (isActive(i)) {
samples[numSamples] = values[i];
numSamples++;
}
i++;
}
final long val = QuickSelect.select(samples, 0, numSamples - 1, limit / 2);
adjustAllValuesBy(-1 * val);
keepOnlyPositiveCounts();
return val;
} }
|
public class class_name {
long purge(final int sampleSize) {
final int limit = Math.min(sampleSize, getNumActive());
int numSamples = 0;
int i = 0;
final long[] samples = new long[limit];
while (numSamples < limit) {
if (isActive(i)) {
samples[numSamples] = values[i]; // depends on control dependency: [if], data = [none]
numSamples++; // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [while], data = [none]
}
final long val = QuickSelect.select(samples, 0, numSamples - 1, limit / 2);
adjustAllValuesBy(-1 * val);
keepOnlyPositiveCounts();
return val;
} }
|
public class class_name {
private boolean hasToShowNotice(String versionDownloadable) {
SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0);
String prefKey = SUCCESSFUL_CHEKS_PREF_KEY + versionDownloadable;
int mChecksMade = prefs.getInt(prefKey, 0);
if (mChecksMade % mSuccessfulChecksRequired == 0 || mChecksMade == 0) {
saveNumberOfChecksForUpdatedVersion(versionDownloadable, mChecksMade);
return true;
} else {
saveNumberOfChecksForUpdatedVersion(versionDownloadable, mChecksMade);
return false;
}
} }
|
public class class_name {
private boolean hasToShowNotice(String versionDownloadable) {
SharedPreferences prefs = mActivity.getSharedPreferences(PREFS_FILENAME, 0);
String prefKey = SUCCESSFUL_CHEKS_PREF_KEY + versionDownloadable;
int mChecksMade = prefs.getInt(prefKey, 0);
if (mChecksMade % mSuccessfulChecksRequired == 0 || mChecksMade == 0) {
saveNumberOfChecksForUpdatedVersion(versionDownloadable, mChecksMade); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
saveNumberOfChecksForUpdatedVersion(versionDownloadable, mChecksMade); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static int getSymmetryOrder(Map<Integer, Integer> alignment, Map<Integer,Integer> identity,
final int maxSymmetry, final float minimumMetricChange) {
List<Integer> preimage = new ArrayList<Integer>(alignment.keySet()); // currently unmodified
List<Integer> image = new ArrayList<Integer>(preimage);
int bestSymmetry = 1;
double bestMetric = Double.POSITIVE_INFINITY; //lower is better
boolean foundSymmetry = false;
if(debug) {
logger.trace("Symm\tPos\tDelta");
}
for(int n=1;n<=maxSymmetry;n++) {
int deltasSq = 0;
int numDeltas = 0;
// apply alignment
for(int i=0;i<image.size();i++) {
Integer pre = image.get(i);
Integer intermediate = (pre==null?null: alignment.get(pre));
Integer post = (intermediate==null?null: identity.get(intermediate));
image.set(i, post);
if(post != null) {
int delta = post-preimage.get(i);
deltasSq += delta*delta;
numDeltas++;
if(debug) {
logger.debug("%d\t%d\t%d\n",n,preimage.get(i),delta);
}
}
}
// Metrics: RMS compensates for the trend of smaller numDeltas with higher order
// Not normalizing by numDeltas favors smaller orders
double metric = Math.sqrt((double)deltasSq/numDeltas); // root mean squared distance
if(!foundSymmetry && metric < bestMetric * minimumMetricChange) {
// n = 1 is never the best symmetry
if(bestMetric < Double.POSITIVE_INFINITY) {
foundSymmetry = true;
}
bestSymmetry = n;
bestMetric = metric;
}
// When debugging need to loop over everything. Unneeded in production
if(!debug && foundSymmetry) {
break;
}
}
if(foundSymmetry) {
return bestSymmetry;
} else {
return 1;
}
} }
|
public class class_name {
public static int getSymmetryOrder(Map<Integer, Integer> alignment, Map<Integer,Integer> identity,
final int maxSymmetry, final float minimumMetricChange) {
List<Integer> preimage = new ArrayList<Integer>(alignment.keySet()); // currently unmodified
List<Integer> image = new ArrayList<Integer>(preimage);
int bestSymmetry = 1;
double bestMetric = Double.POSITIVE_INFINITY; //lower is better
boolean foundSymmetry = false;
if(debug) {
logger.trace("Symm\tPos\tDelta"); // depends on control dependency: [if], data = [none]
}
for(int n=1;n<=maxSymmetry;n++) {
int deltasSq = 0;
int numDeltas = 0;
// apply alignment
for(int i=0;i<image.size();i++) {
Integer pre = image.get(i);
Integer intermediate = (pre==null?null: alignment.get(pre));
Integer post = (intermediate==null?null: identity.get(intermediate));
image.set(i, post); // depends on control dependency: [for], data = [i]
if(post != null) {
int delta = post-preimage.get(i);
deltasSq += delta*delta; // depends on control dependency: [if], data = [none]
numDeltas++; // depends on control dependency: [if], data = [none]
if(debug) {
logger.debug("%d\t%d\t%d\n",n,preimage.get(i),delta); // depends on control dependency: [if], data = [none]
}
}
}
// Metrics: RMS compensates for the trend of smaller numDeltas with higher order
// Not normalizing by numDeltas favors smaller orders
double metric = Math.sqrt((double)deltasSq/numDeltas); // root mean squared distance
if(!foundSymmetry && metric < bestMetric * minimumMetricChange) {
// n = 1 is never the best symmetry
if(bestMetric < Double.POSITIVE_INFINITY) {
foundSymmetry = true; // depends on control dependency: [if], data = [none]
}
bestSymmetry = n; // depends on control dependency: [if], data = [none]
bestMetric = metric; // depends on control dependency: [if], data = [none]
}
// When debugging need to loop over everything. Unneeded in production
if(!debug && foundSymmetry) {
break;
}
}
if(foundSymmetry) {
return bestSymmetry; // depends on control dependency: [if], data = [none]
} else {
return 1; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public <T> T getValue(Class<T> type)
{
Params.notNull(type, "Value type");
if(value == null) {
return null;
}
return converter.asObject(value, type);
} }
|
public class class_name {
public <T> T getValue(Class<T> type)
{
Params.notNull(type, "Value type");
if(value == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return converter.asObject(value, type);
} }
|
public class class_name {
@Pure
@Inline("((($1) == null) ? null : ($1).getName())")
public static String largeBasename(File filename) {
if (filename == null) {
return null;
}
return filename.getName();
} }
|
public class class_name {
@Pure
@Inline("((($1) == null) ? null : ($1).getName())")
public static String largeBasename(File filename) {
if (filename == null) {
return null; // depends on control dependency: [if], data = [none]
}
return filename.getName();
} }
|
public class class_name {
public static List<String> linesFromFile(String filename,String encoding) {
try {
List<String> lines = new ArrayList<String>();
BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding));
String line;
while ((line = in.readLine()) != null) {
lines.add(line);
}
in.close();
return lines;
}
catch (IOException e) {
e.printStackTrace();
return null;
}
} }
|
public class class_name {
public static List<String> linesFromFile(String filename,String encoding) {
try {
List<String> lines = new ArrayList<String>();
BufferedReader in = new BufferedReader(new EncodingFileReader(filename,encoding));
String line;
while ((line = in.readLine()) != null) {
lines.add(line);
// depends on control dependency: [while], data = [none]
}
in.close();
// depends on control dependency: [try], data = [none]
return lines;
// depends on control dependency: [try], data = [none]
}
catch (IOException e) {
e.printStackTrace();
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static boolean printResult(final ArrayList<KeyValue> row,
final byte[] family,
final boolean formard) {
if (null == row || row.isEmpty()) {
return false;
}
final byte[] key = row.get(0).key();
String name = formard ? CliUtils.fromBytes(key) : null;
String id = formard ? null : Arrays.toString(key);
boolean printed = false;
for (final KeyValue kv : row) {
if (!Bytes.equals(kv.family(), family)) {
continue;
}
printed = true;
if (formard) {
id = Arrays.toString(kv.value());
} else {
name = CliUtils.fromBytes(kv.value());
}
System.out.println(CliUtils.fromBytes(kv.qualifier()) + ' ' + name + ": " + id);
}
return printed;
} }
|
public class class_name {
private static boolean printResult(final ArrayList<KeyValue> row,
final byte[] family,
final boolean formard) {
if (null == row || row.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
final byte[] key = row.get(0).key();
String name = formard ? CliUtils.fromBytes(key) : null;
String id = formard ? null : Arrays.toString(key);
boolean printed = false;
for (final KeyValue kv : row) {
if (!Bytes.equals(kv.family(), family)) {
continue;
}
printed = true; // depends on control dependency: [for], data = [none]
if (formard) {
id = Arrays.toString(kv.value()); // depends on control dependency: [if], data = [none]
} else {
name = CliUtils.fromBytes(kv.value()); // depends on control dependency: [if], data = [none]
}
System.out.println(CliUtils.fromBytes(kv.qualifier()) + ' ' + name + ": " + id); // depends on control dependency: [for], data = [kv]
}
return printed;
} }
|
public class class_name {
public Collection<String> getInstalledFeatureNames() {
if (installAssets == null)
return null;
Collection<String> installed = new ArrayList<String>();
for (List<InstallAsset> iaList : installAssets) {
for (InstallAsset asset : iaList) {
if (asset.isFeature()) {
ESAAsset esa = (ESAAsset) asset;
if (esa.isPublic()) {
String esaName = esa.getShortName();
if (esaName == null || esaName.isEmpty())
esaName = esa.getFeatureName();
installed.add(esaName);
}
}
}
}
return installed;
} }
|
public class class_name {
public Collection<String> getInstalledFeatureNames() {
if (installAssets == null)
return null;
Collection<String> installed = new ArrayList<String>();
for (List<InstallAsset> iaList : installAssets) {
for (InstallAsset asset : iaList) {
if (asset.isFeature()) {
ESAAsset esa = (ESAAsset) asset;
if (esa.isPublic()) {
String esaName = esa.getShortName();
if (esaName == null || esaName.isEmpty())
esaName = esa.getFeatureName();
installed.add(esaName); // depends on control dependency: [if], data = [none]
}
}
}
}
return installed;
} }
|
public class class_name {
private synchronized boolean expungeStaleEntries()
{
if (this.size == 0) return false;
Object r;
boolean result = false;
while ( (r = queue.poll()) != null)
{
result = true;
SingleEntry e = (SingleEntry)r;
this.size -= e.cleanupPkTable(this.table);
this.nonDatedEntryCount -= e.cleanupSemiUniqueTable(this.nonDatedTable);
}
return result;
} }
|
public class class_name {
private synchronized boolean expungeStaleEntries()
{
if (this.size == 0) return false;
Object r;
boolean result = false;
while ( (r = queue.poll()) != null)
{
result = true;
// depends on control dependency: [while], data = [none]
SingleEntry e = (SingleEntry)r;
this.size -= e.cleanupPkTable(this.table);
// depends on control dependency: [while], data = [none]
this.nonDatedEntryCount -= e.cleanupSemiUniqueTable(this.nonDatedTable);
// depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public DescribeRulesRequest withRuleArns(String... ruleArns) {
if (this.ruleArns == null) {
setRuleArns(new java.util.ArrayList<String>(ruleArns.length));
}
for (String ele : ruleArns) {
this.ruleArns.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeRulesRequest withRuleArns(String... ruleArns) {
if (this.ruleArns == null) {
setRuleArns(new java.util.ArrayList<String>(ruleArns.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : ruleArns) {
this.ruleArns.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public ArrayList<String> parseColumnNames()
{
ArrayList<String> columns = new ArrayList<String>();
Token token = scanToken();
if (token == Token.LPAREN) {
do {
columns.add(parseIdentifier());
token = scanToken();
} while (token == Token.COMMA);
if (token != Token.RPAREN) {
throw error("expected ')' at '{0}'", token);
}
}
else if (token == Token.IDENTIFIER) {
columns.add(_lexeme);
_token = token;
}
else {
throw error("expected '(' at '{0}'", token);
}
return columns;
} }
|
public class class_name {
public ArrayList<String> parseColumnNames()
{
ArrayList<String> columns = new ArrayList<String>();
Token token = scanToken();
if (token == Token.LPAREN) {
do {
columns.add(parseIdentifier());
token = scanToken();
} while (token == Token.COMMA);
if (token != Token.RPAREN) {
throw error("expected ')' at '{0}'", token);
}
}
else if (token == Token.IDENTIFIER) {
columns.add(_lexeme); // depends on control dependency: [if], data = [none]
_token = token; // depends on control dependency: [if], data = [none]
}
else {
throw error("expected '(' at '{0}'", token);
}
return columns;
} }
|
public class class_name {
protected void completeSarlCapacities(boolean allowCapacityType, boolean isExtensionFilter, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
if (isSarlProposalEnabled()) {
completeSubJavaTypes(Capacity.class, allowCapacityType, context,
TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
getQualifiedNameValueConverter(),
isExtensionFilter ? createExtensionFilter(context, IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE)
: createVisibilityFilter(context, IJavaSearchConstants.INTERFACE), acceptor);
}
} }
|
public class class_name {
protected void completeSarlCapacities(boolean allowCapacityType, boolean isExtensionFilter, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
if (isSarlProposalEnabled()) {
completeSubJavaTypes(Capacity.class, allowCapacityType, context,
TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
getQualifiedNameValueConverter(),
isExtensionFilter ? createExtensionFilter(context, IJavaSearchConstants.INSTANCEOF_TYPE_REFERENCE)
: createVisibilityFilter(context, IJavaSearchConstants.INTERFACE), acceptor); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public final <T extends AItemSpecifics<?, ?>> List<T>
retrieveItemSpecificsList(final Map<String, Object> pRqVs,
final TradingSettings pTs, final Long pItemId, final Class<T> pItemSpecCl,
final String pItemSn) throws Exception {
//HTML templates full
pRqVs.put(pItemSpecCl.getSimpleName() + "specificsdeepLevel", 3);
HashSet<String> goodsFldNms = new HashSet<String>();
goodsFldNms.add("itsId");
goodsFldNms.add("itsName");
pRqVs.put(pItemSn + "neededFields", goodsFldNms);
HashSet<String> soiFldNms = new HashSet<String>();
soiFldNms.add("itsId");
soiFldNms.add("itsName");
soiFldNms.add("isShowInList");
soiFldNms.add("itsType");
soiFldNms.add("itsGroop");
soiFldNms.add("tempHtml");
pRqVs.put("SpecificsOfItemneededFields", soiFldNms);
HashSet<String> soigFldNms = new HashSet<String>();
soigFldNms.add("itsId");
soigFldNms.add("itsName");
soigFldNms.add("templateStart");
soigFldNms.add("templateEnd");
soigFldNms.add("templateDetail");
pRqVs.put("SpecificsOfItemGroupneededFields", soigFldNms);
HashSet<String> htmTmFldNms = new HashSet<String>();
htmTmFldNms.add("itsId");
htmTmFldNms.add("htmlTemplate");
pRqVs.put("HtmlTemplateneededFields", htmTmFldNms);
List<T> result = null;
if (pTs.getUseAdvancedI18n()) {
String lang = (String) pRqVs.get("lang");
String langDef = (String) pRqVs.get("langDef");
if (!lang.equals(langDef)) {
String qd;
if (pItemSpecCl == GoodsSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "GOODSSPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang);
} else if (pItemSpecCl == ServiceSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SERVICESPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang);
} else if (pItemSpecCl == SeGoodsSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SEGOODSSPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang);
} else if (pItemSpecCl == SeServiceSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SESERVICESPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang);
} else {
throw new Exception("NYI for " + pItemSpecCl);
}
result = getSrvOrm().retrieveListByQuery(pRqVs,
pItemSpecCl, qd);
}
}
if (result == null) {
result = getSrvOrm().retrieveListWithConditions(pRqVs,
pItemSpecCl, " where " + pItemSpecCl.getSimpleName()
.toUpperCase() + ".ITEM=" + pItemId + " order by SPECIFICS.ITSINDEX");
}
pRqVs.remove(pItemSpecCl.getSimpleName() + "specificsdeepLevel");
pRqVs.remove(pItemSn + "neededFields");
pRqVs.remove("SpecificsOfItemneededFields");
pRqVs.remove("SpecificsOfItemGroupneededFields");
pRqVs.remove("HtmlTemplateneededFields");
return result;
} }
|
public class class_name {
public final <T extends AItemSpecifics<?, ?>> List<T>
retrieveItemSpecificsList(final Map<String, Object> pRqVs,
final TradingSettings pTs, final Long pItemId, final Class<T> pItemSpecCl,
final String pItemSn) throws Exception {
//HTML templates full
pRqVs.put(pItemSpecCl.getSimpleName() + "specificsdeepLevel", 3);
HashSet<String> goodsFldNms = new HashSet<String>();
goodsFldNms.add("itsId");
goodsFldNms.add("itsName");
pRqVs.put(pItemSn + "neededFields", goodsFldNms);
HashSet<String> soiFldNms = new HashSet<String>();
soiFldNms.add("itsId");
soiFldNms.add("itsName");
soiFldNms.add("isShowInList");
soiFldNms.add("itsType");
soiFldNms.add("itsGroop");
soiFldNms.add("tempHtml");
pRqVs.put("SpecificsOfItemneededFields", soiFldNms);
HashSet<String> soigFldNms = new HashSet<String>();
soigFldNms.add("itsId");
soigFldNms.add("itsName");
soigFldNms.add("templateStart");
soigFldNms.add("templateEnd");
soigFldNms.add("templateDetail");
pRqVs.put("SpecificsOfItemGroupneededFields", soigFldNms);
HashSet<String> htmTmFldNms = new HashSet<String>();
htmTmFldNms.add("itsId");
htmTmFldNms.add("htmlTemplate");
pRqVs.put("HtmlTemplateneededFields", htmTmFldNms);
List<T> result = null;
if (pTs.getUseAdvancedI18n()) {
String lang = (String) pRqVs.get("lang");
String langDef = (String) pRqVs.get("langDef");
if (!lang.equals(langDef)) {
String qd;
if (pItemSpecCl == GoodsSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "GOODSSPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang); // depends on control dependency: [if], data = [none]
} else if (pItemSpecCl == ServiceSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SERVICESPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang); // depends on control dependency: [if], data = [none]
} else if (pItemSpecCl == SeGoodsSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SEGOODSSPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang); // depends on control dependency: [if], data = [none]
} else if (pItemSpecCl == SeServiceSpecifics.class) {
qd = lazyGetQuItSpDeIn().replace(":TITSPEC", "SESERVICESPECIFICS")
.replace(":TITEM", "SESERVICE").replace(":T18NIT", "I18NSESERVICE")
.replace(":ITEMID", pItemId.toString()).replace(":LANG", lang); // depends on control dependency: [if], data = [none]
} else {
throw new Exception("NYI for " + pItemSpecCl);
}
result = getSrvOrm().retrieveListByQuery(pRqVs,
pItemSpecCl, qd);
}
}
if (result == null) {
result = getSrvOrm().retrieveListWithConditions(pRqVs,
pItemSpecCl, " where " + pItemSpecCl.getSimpleName()
.toUpperCase() + ".ITEM=" + pItemId + " order by SPECIFICS.ITSINDEX");
}
pRqVs.remove(pItemSpecCl.getSimpleName() + "specificsdeepLevel");
pRqVs.remove(pItemSn + "neededFields");
pRqVs.remove("SpecificsOfItemneededFields");
pRqVs.remove("SpecificsOfItemGroupneededFields");
pRqVs.remove("HtmlTemplateneededFields");
return result;
} }
|
public class class_name {
public java.util.List<ServiceRegistry> getServiceRegistries() {
if (serviceRegistries == null) {
serviceRegistries = new com.amazonaws.internal.SdkInternalList<ServiceRegistry>();
}
return serviceRegistries;
} }
|
public class class_name {
public java.util.List<ServiceRegistry> getServiceRegistries() {
if (serviceRegistries == null) {
serviceRegistries = new com.amazonaws.internal.SdkInternalList<ServiceRegistry>(); // depends on control dependency: [if], data = [none]
}
return serviceRegistries;
} }
|
public class class_name {
private ZonedDateTime resolveOffset(ZoneOffset offset) {
if (offset.equals(this.offset) == false && zone.getRules().isValidOffset(dateTime, offset)) {
return new ZonedDateTime(dateTime, offset, zone);
}
return this;
} }
|
public class class_name {
private ZonedDateTime resolveOffset(ZoneOffset offset) {
if (offset.equals(this.offset) == false && zone.getRules().isValidOffset(dateTime, offset)) {
return new ZonedDateTime(dateTime, offset, zone); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (firstSet.remove(streamElementQueueEntry)) {
completedQueue.offer(streamElementQueueEntry);
while (firstSet.isEmpty() && firstSet != lastSet) {
firstSet = uncompletedQueue.poll();
Iterator<StreamElementQueueEntry<?>> it = firstSet.iterator();
while (it.hasNext()) {
StreamElementQueueEntry<?> bufferEntry = it.next();
if (bufferEntry.isDone()) {
completedQueue.offer(bufferEntry);
it.remove();
}
}
}
LOG.debug("Signal unordered stream element queue has completed entries.");
hasCompletedEntries.signalAll();
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
public void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (firstSet.remove(streamElementQueueEntry)) {
completedQueue.offer(streamElementQueueEntry); // depends on control dependency: [if], data = [none]
while (firstSet.isEmpty() && firstSet != lastSet) {
firstSet = uncompletedQueue.poll(); // depends on control dependency: [while], data = [none]
Iterator<StreamElementQueueEntry<?>> it = firstSet.iterator(); // depends on control dependency: [while], data = [none]
while (it.hasNext()) {
StreamElementQueueEntry<?> bufferEntry = it.next();
if (bufferEntry.isDone()) {
completedQueue.offer(bufferEntry); // depends on control dependency: [if], data = [none]
it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
LOG.debug("Signal unordered stream element queue has completed entries."); // depends on control dependency: [if], data = [none]
hasCompletedEntries.signalAll(); // depends on control dependency: [if], data = [none]
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
public Map<String, CmsJspContentAccessBean> getReadXml() {
if (m_xmlContent == null) {
// create lazy map only on demand
m_xmlContent = CmsCollectionsGenericWrapper.createLazyMap(new CmsXmlContentAccessTransformer());
}
return m_xmlContent;
} }
|
public class class_name {
public Map<String, CmsJspContentAccessBean> getReadXml() {
if (m_xmlContent == null) {
// create lazy map only on demand
m_xmlContent = CmsCollectionsGenericWrapper.createLazyMap(new CmsXmlContentAccessTransformer()); // depends on control dependency: [if], data = [none]
}
return m_xmlContent;
} }
|
public class class_name {
public void addSection(String pstrSection, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setSecComments(delRemChars(pstrComments));
objSec = null;
} }
|
public class class_name {
public void addSection(String pstrSection, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
// depends on control dependency: [if], data = [none]
this.mhmapSections.put(pstrSection, objSec);
// depends on control dependency: [if], data = [none]
}
objSec.setSecComments(delRemChars(pstrComments));
objSec = null;
} }
|
public class class_name {
public static <E extends Enum<E>> LinkedHashMap<String, E> getEnumMap(final Class<E> enumClass) {
final LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
for (final E e : enumClass.getEnumConstants()) {
map.put(e.name(), e);
}
return map;
} }
|
public class class_name {
public static <E extends Enum<E>> LinkedHashMap<String, E> getEnumMap(final Class<E> enumClass) {
final LinkedHashMap<String, E> map = new LinkedHashMap<String, E>();
for (final E e : enumClass.getEnumConstants()) {
map.put(e.name(), e);
// depends on control dependency: [for], data = [e]
}
return map;
} }
|
public class class_name {
public @NotNull FloatAssert isNotEqualTo(float other) {
if (compareTo(other) != 0) {
return this;
}
failIfCustomMessageIsSet();
throw failure(unexpectedEqual(actual, other));
} }
|
public class class_name {
public @NotNull FloatAssert isNotEqualTo(float other) {
if (compareTo(other) != 0) {
return this; // depends on control dependency: [if], data = [none]
}
failIfCustomMessageIsSet();
throw failure(unexpectedEqual(actual, other));
} }
|
public class class_name {
public EClass getGSMT() {
if (gsmtEClass == null) {
gsmtEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(481);
}
return gsmtEClass;
} }
|
public class class_name {
public EClass getGSMT() {
if (gsmtEClass == null) {
gsmtEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(481); // depends on control dependency: [if], data = [none]
}
return gsmtEClass;
} }
|
public class class_name {
public void abortPendingCheckpoints(CheckpointException exception) {
synchronized (lock) {
for (PendingCheckpoint p : pendingCheckpoints.values()) {
p.abort(exception.getCheckpointFailureReason());
}
pendingCheckpoints.clear();
}
} }
|
public class class_name {
public void abortPendingCheckpoints(CheckpointException exception) {
synchronized (lock) {
for (PendingCheckpoint p : pendingCheckpoints.values()) {
p.abort(exception.getCheckpointFailureReason()); // depends on control dependency: [for], data = [p]
}
pendingCheckpoints.clear();
}
} }
|
public class class_name {
protected void parseSql() {
String sql = tokenizer.getToken();
Node node = peek();
if ((node instanceof IfNode || node instanceof ElseNode) && node.getChildSize() == 0) {
SqlTokenizer st = new SqlTokenizerImpl(sql);
st.skipWhitespace();
String token = st.skipToken();
st.skipWhitespace();
if ("AND".equalsIgnoreCase(token) || "OR".equalsIgnoreCase(token)) {
node.addChild(new PrefixSqlNode(this.position, st.getBefore(), st.getAfter()));
} else {
node.addChild(new SqlNode(this.position, sql));
}
} else {
node.addChild(new SqlNode(this.position, sql));
}
this.position = this.tokenizer.getPosition();
} }
|
public class class_name {
protected void parseSql() {
String sql = tokenizer.getToken();
Node node = peek();
if ((node instanceof IfNode || node instanceof ElseNode) && node.getChildSize() == 0) {
SqlTokenizer st = new SqlTokenizerImpl(sql);
st.skipWhitespace(); // depends on control dependency: [if], data = [none]
String token = st.skipToken();
st.skipWhitespace(); // depends on control dependency: [if], data = [none]
if ("AND".equalsIgnoreCase(token) || "OR".equalsIgnoreCase(token)) {
node.addChild(new PrefixSqlNode(this.position, st.getBefore(), st.getAfter())); // depends on control dependency: [if], data = [none]
} else {
node.addChild(new SqlNode(this.position, sql)); // depends on control dependency: [if], data = [none]
}
} else {
node.addChild(new SqlNode(this.position, sql)); // depends on control dependency: [if], data = [none]
}
this.position = this.tokenizer.getPosition();
} }
|
public class class_name {
Set<Locale> getAllImplementationBoundLocales() {
Set<Locale> res = new HashSet<Locale>();
for (C10NImplementationBinder<?> binder : binders.values()) {
res.addAll(binder.bindings.keySet());
}
return res;
} }
|
public class class_name {
Set<Locale> getAllImplementationBoundLocales() {
Set<Locale> res = new HashSet<Locale>();
for (C10NImplementationBinder<?> binder : binders.values()) {
res.addAll(binder.bindings.keySet()); // depends on control dependency: [for], data = [binder]
}
return res;
} }
|
public class class_name {
@Nonnegative
static int _decode4to3 (@Nonnull final byte [] source,
final int srcOffset,
@Nonnull final byte [] destination,
final int destOffset,
final int options)
{
// Lots of error checking and exception throwing
ValueEnforcer.notNull (source, "Source");
ValueEnforcer.notNull (destination, "Destination");
if (srcOffset < 0 || srcOffset + 3 >= source.length)
{
throw new IllegalArgumentException ("Source array with length " +
source.length +
" cannot have offset of " +
srcOffset +
" and still process four bytes.");
}
if (destOffset < 0 || destOffset + 2 >= destination.length)
{
throw new IllegalArgumentException ("Destination array with length " +
destination.length +
" cannot have offset of " +
destOffset +
" and still store three bytes.");
}
final byte [] aDecodabet = _getDecodabet (options);
// Example: Dk==
if (source[srcOffset + 2] == EQUALS_SIGN)
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12);
destination[destOffset] = (byte) (outBuff >>> 16);
return 1;
}
// Example: DkL=
if (source[srcOffset + 3] == EQUALS_SIGN)
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12) |
((aDecodabet[source[srcOffset + 2]] & 0xFF) << 6);
destination[destOffset] = (byte) (outBuff >>> 16);
destination[destOffset + 1] = (byte) (outBuff >>> 8);
return 2;
}
// Example: DkLE
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12) |
((aDecodabet[source[srcOffset + 2]] & 0xFF) << 6) |
(aDecodabet[source[srcOffset + 3]] & 0xFF);
destination[destOffset] = (byte) (outBuff >> 16);
destination[destOffset + 1] = (byte) (outBuff >> 8);
destination[destOffset + 2] = (byte) (outBuff);
return 3;
}
} }
|
public class class_name {
@Nonnegative
static int _decode4to3 (@Nonnull final byte [] source,
final int srcOffset,
@Nonnull final byte [] destination,
final int destOffset,
final int options)
{
// Lots of error checking and exception throwing
ValueEnforcer.notNull (source, "Source");
ValueEnforcer.notNull (destination, "Destination");
if (srcOffset < 0 || srcOffset + 3 >= source.length)
{
throw new IllegalArgumentException ("Source array with length " +
source.length +
" cannot have offset of " +
srcOffset +
" and still process four bytes.");
}
if (destOffset < 0 || destOffset + 2 >= destination.length)
{
throw new IllegalArgumentException ("Destination array with length " +
destination.length +
" cannot have offset of " +
destOffset +
" and still store three bytes.");
}
final byte [] aDecodabet = _getDecodabet (options);
// Example: Dk==
if (source[srcOffset + 2] == EQUALS_SIGN)
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1] ] << 24 ) >>> 12 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12);
destination[destOffset] = (byte) (outBuff >>> 16); // depends on control dependency: [if], data = [none]
return 1; // depends on control dependency: [if], data = [none]
}
// Example: DkL=
if (source[srcOffset + 3] == EQUALS_SIGN)
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12) |
((aDecodabet[source[srcOffset + 2]] & 0xFF) << 6);
destination[destOffset] = (byte) (outBuff >>> 16); // depends on control dependency: [if], data = [none]
destination[destOffset + 1] = (byte) (outBuff >>> 8); // depends on control dependency: [if], data = [none]
return 2; // depends on control dependency: [if], data = [none]
}
// Example: DkLE
{
// Two ways to do the same thing. Don't know which way I like best.
// int outBuff = ( ( DECODABET[ source[ srcOffset ] ] << 24 ) >>> 6 )
// | ( ( DECODABET[ source[ srcOffset + 1 ] ] << 24 ) >>> 12 )
// | ( ( DECODABET[ source[ srcOffset + 2 ] ] << 24 ) >>> 18 )
// | ( ( DECODABET[ source[ srcOffset + 3 ] ] << 24 ) >>> 24 );
final int outBuff = ((aDecodabet[source[srcOffset]] & 0xFF) << 18) |
((aDecodabet[source[srcOffset + 1]] & 0xFF) << 12) |
((aDecodabet[source[srcOffset + 2]] & 0xFF) << 6) |
(aDecodabet[source[srcOffset + 3]] & 0xFF);
destination[destOffset] = (byte) (outBuff >> 16);
destination[destOffset + 1] = (byte) (outBuff >> 8);
destination[destOffset + 2] = (byte) (outBuff);
return 3;
}
} }
|
public class class_name {
public void clearCache()
{
ZipFile zipFile = _zipFileRef.getAndSet(null);
if (zipFile != null)
try {
zipFile.close();
} catch (Exception e) {
}
} }
|
public class class_name {
public void clearCache()
{
ZipFile zipFile = _zipFileRef.getAndSet(null);
if (zipFile != null)
try {
zipFile.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentConstructor, constructorDocTree);
}
} }
|
public class class_name {
public void buildConstructorComments(XMLNode node, Content constructorDocTree) {
if (!configuration.nocomment) {
writer.addComments(currentConstructor, constructorDocTree); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public IStorageProvider build()
{
if ( appInfoRepo == null ) {
throw new IllegalStateException( "Undefined application information repository" );
}
if ( userCredentialsRepo == null ) {
throw new IllegalStateException( "Undefined user credentials repository" );
}
try {
Constructor providerConstructor = providerClass.getConstructor( StorageBuilder.class );
StorageProvider providerInstance = ( StorageProvider ) providerConstructor.newInstance( this );
return providerInstance;
} catch ( InvocationTargetException itex ) {
Throwable cause = itex.getCause();
if ( cause instanceof RuntimeException ) {
throw ( RuntimeException ) cause;
}
// should not happen, providers constructors do not throw checked exceptions:
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), itex );
} catch ( Exception ex ) {
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), ex );
}
} }
|
public class class_name {
public IStorageProvider build()
{
if ( appInfoRepo == null ) {
throw new IllegalStateException( "Undefined application information repository" );
}
if ( userCredentialsRepo == null ) {
throw new IllegalStateException( "Undefined user credentials repository" );
}
try {
Constructor providerConstructor = providerClass.getConstructor( StorageBuilder.class );
StorageProvider providerInstance = ( StorageProvider ) providerConstructor.newInstance( this );
return providerInstance; // depends on control dependency: [try], data = [none]
} catch ( InvocationTargetException itex ) {
Throwable cause = itex.getCause();
if ( cause instanceof RuntimeException ) {
throw ( RuntimeException ) cause;
}
// should not happen, providers constructors do not throw checked exceptions:
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), itex );
} catch ( Exception ex ) { // depends on control dependency: [catch], data = [none]
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), ex );
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static MapReference decode(final Datastore datastore, final Mapper mapper, final MappedField mappedField,
final DBObject dbObject) {
final Class subType = mappedField.getTypeParameters().get(0).getSubClass();
final Map<String, Object> ids = (Map<String, Object>) mappedField.getDbObjectValue(dbObject);
MapReference reference = null;
if (ids != null) {
reference = new MapReference(datastore, mapper.getMappedClass(subType), ids);
}
return reference;
} }
|
public class class_name {
public static MapReference decode(final Datastore datastore, final Mapper mapper, final MappedField mappedField,
final DBObject dbObject) {
final Class subType = mappedField.getTypeParameters().get(0).getSubClass();
final Map<String, Object> ids = (Map<String, Object>) mappedField.getDbObjectValue(dbObject);
MapReference reference = null;
if (ids != null) {
reference = new MapReference(datastore, mapper.getMappedClass(subType), ids); // depends on control dependency: [if], data = [none]
}
return reference;
} }
|
public class class_name {
private Set<JmxTreeNode> getMatchingChildren(String nameFilter, ObjectNode objectNode) {
AttributesNode attributesNode = null;
OperationsNode operationsNode = null;
NotificationsNode notificationsNode = null;
Set<JmxTreeNode> objectChildren = new TreeSet<JmxTreeNode>();
for(JmxTreeNode child : objectNode.getChildren()) {
if(child instanceof AttributesNode) {
Set<AttributeNode> attributes = getMatchingAttributes((AttributesNode) child, nameFilter);
if(!attributes.isEmpty()) {
attributesNode = new AttributesNode(ObjectNode.LABEL_ATTRIBUTES, attributes);
}
} else if (child instanceof OperationsNode) {
Set<OperationNode> operations = getMatchingOperations((OperationsNode) child, nameFilter);
if(!operations.isEmpty()) {
operationsNode = new OperationsNode(ObjectNode.LABEL_OPERATIONS, operations);
}
} else if (child instanceof NotificationsNode) {
Set<NotificationNode> notifications = getMatchingNotifications((NotificationsNode) child, nameFilter);
if(!notifications.isEmpty()) {
notificationsNode = new NotificationsNode(ObjectNode.LABEL_NOTIFICATIONS, notifications);
}
}
}
if(attributesNode != null) {
objectChildren.add(attributesNode);
}
if(operationsNode != null) {
objectChildren.add(operationsNode);
}
if(notificationsNode != null) {
objectChildren.add(notificationsNode);
}
return objectChildren;
} }
|
public class class_name {
private Set<JmxTreeNode> getMatchingChildren(String nameFilter, ObjectNode objectNode) {
AttributesNode attributesNode = null;
OperationsNode operationsNode = null;
NotificationsNode notificationsNode = null;
Set<JmxTreeNode> objectChildren = new TreeSet<JmxTreeNode>();
for(JmxTreeNode child : objectNode.getChildren()) {
if(child instanceof AttributesNode) {
Set<AttributeNode> attributes = getMatchingAttributes((AttributesNode) child, nameFilter);
if(!attributes.isEmpty()) {
attributesNode = new AttributesNode(ObjectNode.LABEL_ATTRIBUTES, attributes); // depends on control dependency: [if], data = [none]
}
} else if (child instanceof OperationsNode) {
Set<OperationNode> operations = getMatchingOperations((OperationsNode) child, nameFilter);
if(!operations.isEmpty()) {
operationsNode = new OperationsNode(ObjectNode.LABEL_OPERATIONS, operations); // depends on control dependency: [if], data = [none]
}
} else if (child instanceof NotificationsNode) {
Set<NotificationNode> notifications = getMatchingNotifications((NotificationsNode) child, nameFilter);
if(!notifications.isEmpty()) {
notificationsNode = new NotificationsNode(ObjectNode.LABEL_NOTIFICATIONS, notifications); // depends on control dependency: [if], data = [none]
}
}
}
if(attributesNode != null) {
objectChildren.add(attributesNode); // depends on control dependency: [if], data = [(attributesNode]
}
if(operationsNode != null) {
objectChildren.add(operationsNode); // depends on control dependency: [if], data = [(operationsNode]
}
if(notificationsNode != null) {
objectChildren.add(notificationsNode); // depends on control dependency: [if], data = [(notificationsNode]
}
return objectChildren;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T[] toArray(Set<T> set) {
if (set == null) {
return null;
}
return (T[]) set.toArray(new Object[set.size()]);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> T[] toArray(Set<T> set) {
if (set == null) {
return null; // depends on control dependency: [if], data = [none]
}
return (T[]) set.toArray(new Object[set.size()]);
} }
|
public class class_name {
public static List<ParameterSpace> getUniqueObjects(List<ParameterSpace> allLeaves) {
List<ParameterSpace> unique = new ArrayList<>();
for (ParameterSpace p : allLeaves) {
//This isn't especially efficient, but small number of parameters in general means it's fine
boolean found = false;
for (ParameterSpace q : unique) {
if (p == q) {
found = true;
}
}
if (!found) {
unique.add(p);
}
}
return unique;
} }
|
public class class_name {
public static List<ParameterSpace> getUniqueObjects(List<ParameterSpace> allLeaves) {
List<ParameterSpace> unique = new ArrayList<>();
for (ParameterSpace p : allLeaves) {
//This isn't especially efficient, but small number of parameters in general means it's fine
boolean found = false;
for (ParameterSpace q : unique) {
if (p == q) {
found = true; // depends on control dependency: [if], data = [none]
}
}
if (!found) {
unique.add(p); // depends on control dependency: [if], data = [none]
}
}
return unique;
} }
|
public class class_name {
@Override
public Hashtable<String, Object> getDataAsHashtable() {
logger.entering();
Hashtable<String, Object> hashTable = new Hashtable<>();
Sheet sheet = excelReader.fetchSheet(resource.getCls().getSimpleName());
int numRows = sheet.getPhysicalNumberOfRows();
for (int i = 2; i <= numRows; i++) {
Row row = sheet.getRow(i - 1);
if ((row != null) && (row.getCell(0) != null)) {
Object obj;
obj = getSingleExcelRow(getObject(), i, false);
String key = row.getCell(0).toString();
if ((key != null) && (obj != null)) {
hashTable.put(key, obj);
}
}
}
logger.exiting(hashTable);
return hashTable;
} }
|
public class class_name {
@Override
public Hashtable<String, Object> getDataAsHashtable() {
logger.entering();
Hashtable<String, Object> hashTable = new Hashtable<>();
Sheet sheet = excelReader.fetchSheet(resource.getCls().getSimpleName());
int numRows = sheet.getPhysicalNumberOfRows();
for (int i = 2; i <= numRows; i++) {
Row row = sheet.getRow(i - 1);
if ((row != null) && (row.getCell(0) != null)) {
Object obj;
obj = getSingleExcelRow(getObject(), i, false); // depends on control dependency: [if], data = [none]
String key = row.getCell(0).toString();
if ((key != null) && (obj != null)) {
hashTable.put(key, obj); // depends on control dependency: [if], data = [none]
}
}
}
logger.exiting(hashTable);
return hashTable;
} }
|
public class class_name {
public void marshall(SqlApplicationConfiguration sqlApplicationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (sqlApplicationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sqlApplicationConfiguration.getInputs(), INPUTS_BINDING);
protocolMarshaller.marshall(sqlApplicationConfiguration.getOutputs(), OUTPUTS_BINDING);
protocolMarshaller.marshall(sqlApplicationConfiguration.getReferenceDataSources(), REFERENCEDATASOURCES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(SqlApplicationConfiguration sqlApplicationConfiguration, ProtocolMarshaller protocolMarshaller) {
if (sqlApplicationConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(sqlApplicationConfiguration.getInputs(), INPUTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sqlApplicationConfiguration.getOutputs(), OUTPUTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(sqlApplicationConfiguration.getReferenceDataSources(), REFERENCEDATASOURCES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public String getScheme() {
try {
collaborator.preInvoke(componentMetaData);
return request.getScheme();
} finally {
collaborator.postInvoke();
}
} }
|
public class class_name {
@Override
public String getScheme() {
try {
collaborator.preInvoke(componentMetaData); // depends on control dependency: [try], data = [none]
return request.getScheme(); // depends on control dependency: [try], data = [none]
} finally {
collaborator.postInvoke();
}
} }
|
public class class_name {
public boolean isDataValid() {
boolean valid = false;
for (Object value : values.values()) {
if (value instanceof String) {
String tt = (String) value;
if (Strings.isNotBlank(tt)) {
valid = true;
break;
}
} else {
if (null != value) {
valid = true;
break;
}
}
}
return valid;
} }
|
public class class_name {
public boolean isDataValid() {
boolean valid = false;
for (Object value : values.values()) {
if (value instanceof String) {
String tt = (String) value;
if (Strings.isNotBlank(tt)) {
valid = true; // depends on control dependency: [if], data = [none]
break;
}
} else {
if (null != value) {
valid = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
return valid;
} }
|
public class class_name {
private static String getExtension(String fileName) {
// play it safe and get rid of any fragment id
// that might be there
int length = fileName.length();
int newEnd = fileName.lastIndexOf('#');
if (newEnd == -1) {
newEnd = length;
}
int i = fileName.lastIndexOf('.', newEnd);
if (i != -1) {
return fileName.substring(i + 1, newEnd);
} else {
// no extension, no content type
return null;
}
} }
|
public class class_name {
private static String getExtension(String fileName) {
// play it safe and get rid of any fragment id
// that might be there
int length = fileName.length();
int newEnd = fileName.lastIndexOf('#');
if (newEnd == -1) {
newEnd = length; // depends on control dependency: [if], data = [none]
}
int i = fileName.lastIndexOf('.', newEnd);
if (i != -1) {
return fileName.substring(i + 1, newEnd); // depends on control dependency: [if], data = [(i]
} else {
// no extension, no content type
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<Object> getTaskFieldValues(ProjectProperties properties, FieldType field, byte[] data)
{
if (field == null || data == null || data.length == 0)
{
return null;
}
List<Object> list = new LinkedList<Object>();
int offset = 0;
switch (field.getDataType())
{
case DATE:
while (offset + 4 <= data.length)
{
Date date = MPPUtility.getTimestamp(data, offset);
list.add(date);
offset += 4;
}
break;
case CURRENCY:
while (offset + 8 <= data.length)
{
Double number = NumberHelper.getDouble(MPPUtility.getDouble(data, offset) / 100.0);
list.add(number);
offset += 8;
}
break;
case NUMERIC:
while (offset + 8 <= data.length)
{
Double number = NumberHelper.getDouble(MPPUtility.getDouble(data, offset));
list.add(number);
offset += 8;
}
break;
case DURATION:
while (offset + 6 <= data.length)
{
Duration duration = MPPUtility.getAdjustedDuration(properties, MPPUtility.getInt(data, offset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, offset + 4)));
list.add(duration);
offset += 6;
}
break;
case STRING:
while (offset < data.length)
{
String s = MPPUtility.getUnicodeString(data, offset);
list.add(s);
offset += s.length() * 2 + 2;
}
break;
case BOOLEAN:
while (offset + 2 <= data.length)
{
boolean b = (MPPUtility.getShort(data, offset) == 0x01);
list.add(Boolean.valueOf(b));
offset += 2;
}
break;
default:
return null;
}
return list;
} }
|
public class class_name {
public List<Object> getTaskFieldValues(ProjectProperties properties, FieldType field, byte[] data)
{
if (field == null || data == null || data.length == 0)
{
return null; // depends on control dependency: [if], data = [none]
}
List<Object> list = new LinkedList<Object>();
int offset = 0;
switch (field.getDataType())
{
case DATE:
while (offset + 4 <= data.length)
{
Date date = MPPUtility.getTimestamp(data, offset);
list.add(date); // depends on control dependency: [while], data = [none]
offset += 4; // depends on control dependency: [while], data = [none]
}
break;
case CURRENCY:
while (offset + 8 <= data.length)
{
Double number = NumberHelper.getDouble(MPPUtility.getDouble(data, offset) / 100.0);
list.add(number); // depends on control dependency: [while], data = [none]
offset += 8; // depends on control dependency: [while], data = [none]
}
break;
case NUMERIC:
while (offset + 8 <= data.length)
{
Double number = NumberHelper.getDouble(MPPUtility.getDouble(data, offset));
list.add(number); // depends on control dependency: [while], data = [none]
offset += 8; // depends on control dependency: [while], data = [none]
}
break;
case DURATION:
while (offset + 6 <= data.length)
{
Duration duration = MPPUtility.getAdjustedDuration(properties, MPPUtility.getInt(data, offset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, offset + 4)));
list.add(duration); // depends on control dependency: [while], data = [none]
offset += 6; // depends on control dependency: [while], data = [none]
}
break;
case STRING:
while (offset < data.length)
{
String s = MPPUtility.getUnicodeString(data, offset);
list.add(s); // depends on control dependency: [while], data = [none]
offset += s.length() * 2 + 2; // depends on control dependency: [while], data = [none]
}
break;
case BOOLEAN:
while (offset + 2 <= data.length)
{
boolean b = (MPPUtility.getShort(data, offset) == 0x01);
list.add(Boolean.valueOf(b)); // depends on control dependency: [while], data = [none]
offset += 2; // depends on control dependency: [while], data = [none]
}
break;
default:
return null;
}
return list;
} }
|
public class class_name {
@Deprecated
private boolean hasServiceEndpoint(String endpoint) {
for(Service s : services.values()) {
if (s.getEndpoints().containsKey(endpoint)) {
return true;
}
}
return false;
} }
|
public class class_name {
@Deprecated
private boolean hasServiceEndpoint(String endpoint) {
for(Service s : services.values()) {
if (s.getEndpoints().containsKey(endpoint)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public void interpret( Specification table )
{
Example row = table.nextExample();
Example reject = row.firstChild();
Action action = Action.parse( actionCells(row) );
Example first = CollectionUtil.first(keywordCells(row));
try
{
Call call = action.checkAgainst( fixture );
call.expect( ShouldBe.either( FALSE ).or( instanceOf( Exception.class ) ) );
call.will( Annotate.right( reject ) ).when( ResultIs.right() );
call.will( Annotate.wrong( reject ) ).when( ResultIs.wrong() );
call.will( Annotate.exception(first) ).when( ResultIs.exception() );
call.will( tallyStatistics( table ) );
call.execute();
}
catch (Exception e)
{
reportException( table );
if (first != null) {
first.annotate( Annotations.exception( e ) );
} else {
reject.annotate( Annotations.exception(e) );
}
}
} }
|
public class class_name {
public void interpret( Specification table )
{
Example row = table.nextExample();
Example reject = row.firstChild();
Action action = Action.parse( actionCells(row) );
Example first = CollectionUtil.first(keywordCells(row));
try
{
Call call = action.checkAgainst( fixture );
call.expect( ShouldBe.either( FALSE ).or( instanceOf( Exception.class ) ) ); // depends on control dependency: [try], data = [none]
call.will( Annotate.right( reject ) ).when( ResultIs.right() ); // depends on control dependency: [try], data = [none]
call.will( Annotate.wrong( reject ) ).when( ResultIs.wrong() ); // depends on control dependency: [try], data = [none]
call.will( Annotate.exception(first) ).when( ResultIs.exception() ); // depends on control dependency: [try], data = [exception]
call.will( tallyStatistics( table ) ); // depends on control dependency: [try], data = [none]
call.execute(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
reportException( table );
if (first != null) {
first.annotate( Annotations.exception( e ) ); // depends on control dependency: [if], data = [none]
} else {
reject.annotate( Annotations.exception(e) ); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void registerSourceRoots()
{
if ( sourceRoot != null )
{
getLog().info( "Registering compile source root " + sourceRoot );
project.addCompileSourceRoot( sourceRoot.toString() );
}
if ( testSourceRoot != null )
{
getLog().info( "Registering compile test source root " + testSourceRoot );
project.addTestCompileSourceRoot( testSourceRoot.toString() );
}
} }
|
public class class_name {
protected void registerSourceRoots()
{
if ( sourceRoot != null )
{
getLog().info( "Registering compile source root " + sourceRoot ); // depends on control dependency: [if], data = [none]
project.addCompileSourceRoot( sourceRoot.toString() ); // depends on control dependency: [if], data = [( sourceRoot]
}
if ( testSourceRoot != null )
{
getLog().info( "Registering compile test source root " + testSourceRoot ); // depends on control dependency: [if], data = [none]
project.addTestCompileSourceRoot( testSourceRoot.toString() ); // depends on control dependency: [if], data = [( testSourceRoot]
}
} }
|
public class class_name {
protected Collection<BioPAXElement> generate(Conversion conv, Direction direction,
Set<Entity> taboo)
{
if (direction == null) throw new IllegalArgumentException("Direction cannot be null");
if (!(direction == Direction.BOTHSIDERS || direction == Direction.ONESIDERS))
{
Set<BioPAXElement> simples = new HashSet<BioPAXElement>();
for (Entity part : direction == Direction.ANY ? conv.getParticipant() :
direction == Direction.LEFT ? conv.getLeft() : conv.getRight())
{
if (part instanceof PhysicalEntity && !taboo.contains(part))
{
simples.addAll(linker.getLinkedElements((PhysicalEntity) part));
}
}
return pe2ER.getValueFromBeans(simples);
}
else
{
Set<BioPAXElement> leftSimples = new HashSet<BioPAXElement>();
Set<BioPAXElement> rightSimples = new HashSet<BioPAXElement>();
for (PhysicalEntity pe : conv.getLeft())
{
if (!taboo.contains(pe)) leftSimples.addAll(linker.getLinkedElements(pe));
}
for (PhysicalEntity pe : conv.getRight())
{
if (!taboo.contains(pe)) rightSimples.addAll(linker.getLinkedElements(pe));
}
Set leftERs = pe2ER.getValueFromBeans(leftSimples);
Set rightERs = pe2ER.getValueFromBeans(rightSimples);
if (direction == Direction.ONESIDERS)
{
// get all but intersection
Set temp = new HashSet(leftERs);
leftERs.removeAll(rightERs);
rightERs.removeAll(temp);
leftERs.addAll(rightERs);
}
else // BOTHSIDERS
{
// get intersection
leftERs.retainAll(rightERs);
}
return leftERs;
}
} }
|
public class class_name {
protected Collection<BioPAXElement> generate(Conversion conv, Direction direction,
Set<Entity> taboo)
{
if (direction == null) throw new IllegalArgumentException("Direction cannot be null");
if (!(direction == Direction.BOTHSIDERS || direction == Direction.ONESIDERS))
{
Set<BioPAXElement> simples = new HashSet<BioPAXElement>();
for (Entity part : direction == Direction.ANY ? conv.getParticipant() :
direction == Direction.LEFT ? conv.getLeft() : conv.getRight())
{
if (part instanceof PhysicalEntity && !taboo.contains(part))
{
simples.addAll(linker.getLinkedElements((PhysicalEntity) part)); // depends on control dependency: [if], data = [none]
}
}
return pe2ER.getValueFromBeans(simples); // depends on control dependency: [if], data = [none]
}
else
{
Set<BioPAXElement> leftSimples = new HashSet<BioPAXElement>();
Set<BioPAXElement> rightSimples = new HashSet<BioPAXElement>();
for (PhysicalEntity pe : conv.getLeft())
{
if (!taboo.contains(pe)) leftSimples.addAll(linker.getLinkedElements(pe));
}
for (PhysicalEntity pe : conv.getRight())
{
if (!taboo.contains(pe)) rightSimples.addAll(linker.getLinkedElements(pe));
}
Set leftERs = pe2ER.getValueFromBeans(leftSimples);
Set rightERs = pe2ER.getValueFromBeans(rightSimples);
if (direction == Direction.ONESIDERS)
{
// get all but intersection
Set temp = new HashSet(leftERs);
leftERs.removeAll(rightERs); // depends on control dependency: [if], data = [none]
rightERs.removeAll(temp); // depends on control dependency: [if], data = [none]
leftERs.addAll(rightERs); // depends on control dependency: [if], data = [none]
}
else // BOTHSIDERS
{
// get intersection
leftERs.retainAll(rightERs); // depends on control dependency: [if], data = [none]
}
return leftERs; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception {
String activityInstanceId = execution.getActivityInstanceId();
try {
toExecute.call();
} catch (Exception ex) {
if (activityInstanceId.equals(execution.getActivityInstanceId())) {
try {
propagateException(execution, ex);
}
catch (ErrorPropagationException e) {
LOG.errorPropagationException(activityInstanceId, e.getCause());
// re-throw the original exception so that it is logged
// and set as cause of the failure
throw ex;
}
}
else {
throw ex;
}
}
} }
|
public class class_name {
protected void executeWithErrorPropagation(ActivityExecution execution, Callable<Void> toExecute) throws Exception {
String activityInstanceId = execution.getActivityInstanceId();
try {
toExecute.call();
} catch (Exception ex) {
if (activityInstanceId.equals(execution.getActivityInstanceId())) {
try {
propagateException(execution, ex); // depends on control dependency: [try], data = [none]
}
catch (ErrorPropagationException e) {
LOG.errorPropagationException(activityInstanceId, e.getCause());
// re-throw the original exception so that it is logged
// and set as cause of the failure
throw ex;
} // depends on control dependency: [catch], data = [none]
}
else {
throw ex;
}
}
} }
|
public class class_name {
public void marshall(TagFilter tagFilter, ProtocolMarshaller protocolMarshaller) {
if (tagFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tagFilter.getTagKey(), TAGKEY_BINDING);
protocolMarshaller.marshall(tagFilter.getTagValues(), TAGVALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TagFilter tagFilter, ProtocolMarshaller protocolMarshaller) {
if (tagFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tagFilter.getTagKey(), TAGKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tagFilter.getTagValues(), TAGVALUES_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 Later<JsonNode> getRawBatchResult() {
if (this.rawBatchResult == null) {
// Use LaterWrapper to cache the result so we don't fetch over and over
this.rawBatchResult = new LaterWrapper<JsonNode, JsonNode>(this.createFetcher());
// Also let the master know it's time to kick off any other batches and
// remove us as a valid batch to add to.
// This must be called *after* the rawBatchResult is set otherwise we
// will have endless recursion when the master tries to execute us.
this.master.execute();
}
return this.rawBatchResult;
} }
|
public class class_name {
private Later<JsonNode> getRawBatchResult() {
if (this.rawBatchResult == null) {
// Use LaterWrapper to cache the result so we don't fetch over and over
this.rawBatchResult = new LaterWrapper<JsonNode, JsonNode>(this.createFetcher());
// depends on control dependency: [if], data = [none]
// Also let the master know it's time to kick off any other batches and
// remove us as a valid batch to add to.
// This must be called *after* the rawBatchResult is set otherwise we
// will have endless recursion when the master tries to execute us.
this.master.execute();
// depends on control dependency: [if], data = [none]
}
return this.rawBatchResult;
} }
|
public class class_name {
public String getGroupName() {
if (TabSetType.ACCORDION.equals(getType())) {
CollapsibleGroup group = getComponentModel().group;
return (group == null ? null : group.getGroupName());
}
return null;
} }
|
public class class_name {
public String getGroupName() {
if (TabSetType.ACCORDION.equals(getType())) {
CollapsibleGroup group = getComponentModel().group;
return (group == null ? null : group.getGroupName()); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void markMarshallable(Class<?> type, boolean isMarshallable) {
MarshallingType marshallType = typeHints.get(type);
if (marshallableUpdateRequired(isMarshallable, marshallType)) {
boolean replaced = typeHints.replace(type, marshallType, new MarshallingType(
Boolean.valueOf(isMarshallable), marshallType.sizePredictor));
if (replaced && trace) {
log.tracef("Replacing '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
} else if (marshallType == null) {
if (trace) {
log.tracef("Cache '%s' type to be marshallable=%b",
type.getName(), isMarshallable);
}
typeHints.put(type, new MarshallingType(
Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor()));
}
} }
|
public class class_name {
public void markMarshallable(Class<?> type, boolean isMarshallable) {
MarshallingType marshallType = typeHints.get(type);
if (marshallableUpdateRequired(isMarshallable, marshallType)) {
boolean replaced = typeHints.replace(type, marshallType, new MarshallingType(
Boolean.valueOf(isMarshallable), marshallType.sizePredictor));
if (replaced && trace) {
log.tracef("Replacing '%s' type to be marshallable=%b",
type.getName(), isMarshallable); // depends on control dependency: [if], data = [none]
}
} else if (marshallType == null) {
if (trace) {
log.tracef("Cache '%s' type to be marshallable=%b",
type.getName(), isMarshallable); // depends on control dependency: [if], data = [none]
}
typeHints.put(type, new MarshallingType(
Boolean.valueOf(isMarshallable), new AdaptiveBufferSizePredictor())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void dispose() {
try {
connection.close();
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
} finally {
isActive = false;
connection = null;
JdbcRepository.TX.set(null);
}
} }
|
public class class_name {
public void dispose() {
try {
connection.close(); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
} finally { // depends on control dependency: [catch], data = [none]
isActive = false;
connection = null;
JdbcRepository.TX.set(null);
}
} }
|
public class class_name {
private static JavaScriptObject[] toNativeErrorArray(List<JSError> errors) {
JavaScriptObject[] out = new JavaScriptObject[errors.size()];
for (int i = 0; i < errors.size(); ++i) {
JSError error = errors.get(i);
DiagnosticType type = error.getType();
out[i] = createError(error.sourceName, error.description, type != null ? type.key : null,
error.lineNumber, error.getCharno());
}
return out;
} }
|
public class class_name {
private static JavaScriptObject[] toNativeErrorArray(List<JSError> errors) {
JavaScriptObject[] out = new JavaScriptObject[errors.size()];
for (int i = 0; i < errors.size(); ++i) {
JSError error = errors.get(i);
DiagnosticType type = error.getType();
out[i] = createError(error.sourceName, error.description, type != null ? type.key : null,
error.lineNumber, error.getCharno()); // depends on control dependency: [for], data = [i]
}
return out;
} }
|
public class class_name {
public static synchronized XDataManager getInstanceFor(XMPPConnection connection) {
XDataManager xDataManager = INSTANCES.get(connection);
if (xDataManager == null) {
xDataManager = new XDataManager(connection);
INSTANCES.put(connection, xDataManager);
}
return xDataManager;
} }
|
public class class_name {
public static synchronized XDataManager getInstanceFor(XMPPConnection connection) {
XDataManager xDataManager = INSTANCES.get(connection);
if (xDataManager == null) {
xDataManager = new XDataManager(connection); // depends on control dependency: [if], data = [none]
INSTANCES.put(connection, xDataManager); // depends on control dependency: [if], data = [none]
}
return xDataManager;
} }
|
public class class_name {
public void performRecovery(ObjectManagerState objectManagerState)
throws ObjectManagerException {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"performRecovery",
new Object[] { objectManagerState, logicalUnitOfWork, new Integer(transactionState)
, tokensToOptimisticReplace, serializedManagedObjectBytes, tokensToDelete, tokensToNotify }
);
// Replace the objects using their original transaction.
Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);
java.util.Iterator serializedObjectIterator = serializedManagedObjectBytes.iterator();
// A list of ManagedObjects to add, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToAdd = new java.util.ArrayList(tokensToAdd.size());
for (java.util.Iterator tokenIterator = tokensToAdd.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
// Recover the ManagedObject from the serialized bytes.
byte managedObjectBytes[] = (byte[]) serializedObjectIterator.next();
ManagedObject managedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
ManagedObject managedObjectToAdd = token.setManagedObject(managedObject);
managedObjectToAdd.state = ManagedObject.stateConstructed;
managedObjectsToAdd.add(managedObjectToAdd);
} // for ...tokensToAdd.
// A list of ManagedObjects to optimistic replace, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToOptimisticReplace = new java.util.ArrayList(tokensToOptimisticReplace.size());
for (java.util.Iterator tokenIterator = tokensToOptimisticReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
// Recover the ManagedObject from the serialized bytes.
byte managedObjectBytes[] = (byte[]) serializedObjectIterator.next();
ManagedObject managedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
ManagedObject managedObjectToReplace = token.setManagedObject(managedObject);
managedObjectsToOptimisticReplace.add(managedObjectToReplace);
} // for ...tokensToOptimisticReplace.
// A list of ManagedObjects to delete, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToDelete = new java.util.ArrayList(tokensToDelete.size());
// Check that the tokensToDelete all have an underlying managedObject because they may have been deleted
// from the ObjectStore already.
for (java.util.Iterator tokenIterator = tokensToDelete.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
if (existingManagedObject == null) {
// The object may have already been deleted from the ObjectStore,
// so create a dummy object to keep the transaction happy.
// The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
// ObjectStore can take place.
DummyManagedObject dummyManagedObject = new DummyManagedObject("Created by TransactionOptimisticReplaceLogRecord.performRecovery() (Delete)");
existingManagedObject = token.setManagedObject(dummyManagedObject);
existingManagedObject.state = ManagedObject.stateReady;
} // if(existingManagedObject == null).
managedObjectsToDelete.add(existingManagedObject);
} // for tokensToDelete...
// Check that the tokensToNotify all have an underlying managedObject because they may have been deleted
// by a subsequent transaction. If we create any dummy objects we must hold a strong reference to them
// until after the transactionForRecovery.optimisticReplace method has run, otherwise the garbage
// collector might remove them from the weak reference in Token, and it wont be in. the ObjectStore.
java.util.List dummyManagedObjectsToNotify = new java.util.ArrayList();
for (java.util.Iterator tokenIterator = tokensToNotify.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
if (existingManagedObject == null) {
// The object may have already been deleted from the ObjectStore,
// so create a dummy object to keep the transaction happy.
// The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
// ObjectStore can take place.
DummyManagedObject dummyManagedObject = new DummyManagedObject("Created by TransactionOptimisticReplaceLogRecord.performRecovery() (Notify)");
dummyManagedObject.state = ManagedObject.stateReady;
dummyManagedObjectsToNotify.add(dummyManagedObject);
token.setManagedObject(dummyManagedObject);
} // if(existingManagedObject == null).
} // for tokensToNotify...
transactionForRecovery.optimisticReplace(managedObjectsToAdd,
managedObjectsToOptimisticReplace,
managedObjectsToDelete,
tokensToNotify);
transactionForRecovery.internalTransaction.resetState(transactionState);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"performRecovery");
} }
|
public class class_name {
public void performRecovery(ObjectManagerState objectManagerState)
throws ObjectManagerException {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"performRecovery",
new Object[] { objectManagerState, logicalUnitOfWork, new Integer(transactionState)
, tokensToOptimisticReplace, serializedManagedObjectBytes, tokensToDelete, tokensToNotify }
);
// Replace the objects using their original transaction.
Transaction transactionForRecovery = objectManagerState.getTransaction(logicalUnitOfWork);
java.util.Iterator serializedObjectIterator = serializedManagedObjectBytes.iterator();
// A list of ManagedObjects to add, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToAdd = new java.util.ArrayList(tokensToAdd.size());
for (java.util.Iterator tokenIterator = tokensToAdd.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
// Recover the ManagedObject from the serialized bytes.
byte managedObjectBytes[] = (byte[]) serializedObjectIterator.next();
ManagedObject managedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
ManagedObject managedObjectToAdd = token.setManagedObject(managedObject);
managedObjectToAdd.state = ManagedObject.stateConstructed;
managedObjectsToAdd.add(managedObjectToAdd);
} // for ...tokensToAdd.
// A list of ManagedObjects to optimistic replace, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToOptimisticReplace = new java.util.ArrayList(tokensToOptimisticReplace.size());
for (java.util.Iterator tokenIterator = tokensToOptimisticReplace.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
// Recover the ManagedObject from the serialized bytes.
byte managedObjectBytes[] = (byte[]) serializedObjectIterator.next();
ManagedObject managedObject = ManagedObject.restoreFromSerializedBytes(managedObjectBytes,
objectManagerState);
ManagedObject managedObjectToReplace = token.setManagedObject(managedObject);
managedObjectsToOptimisticReplace.add(managedObjectToReplace);
} // for ...tokensToOptimisticReplace.
// A list of ManagedObjects to delete, this lists forces the ManagedObjects to
// remain in storage while we give them to the Transaction.
java.util.List managedObjectsToDelete = new java.util.ArrayList(tokensToDelete.size());
// Check that the tokensToDelete all have an underlying managedObject because they may have been deleted
// from the ObjectStore already.
for (java.util.Iterator tokenIterator = tokensToDelete.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
if (existingManagedObject == null) {
// The object may have already been deleted from the ObjectStore,
// so create a dummy object to keep the transaction happy.
// The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
// ObjectStore can take place.
DummyManagedObject dummyManagedObject = new DummyManagedObject("Created by TransactionOptimisticReplaceLogRecord.performRecovery() (Delete)");
existingManagedObject = token.setManagedObject(dummyManagedObject); // depends on control dependency: [if], data = [none]
existingManagedObject.state = ManagedObject.stateReady; // depends on control dependency: [if], data = [none]
} // if(existingManagedObject == null).
managedObjectsToDelete.add(existingManagedObject);
} // for tokensToDelete...
// Check that the tokensToNotify all have an underlying managedObject because they may have been deleted
// by a subsequent transaction. If we create any dummy objects we must hold a strong reference to them
// until after the transactionForRecovery.optimisticReplace method has run, otherwise the garbage
// collector might remove them from the weak reference in Token, and it wont be in. the ObjectStore.
java.util.List dummyManagedObjectsToNotify = new java.util.ArrayList();
for (java.util.Iterator tokenIterator = tokensToNotify.iterator(); tokenIterator.hasNext();) {
Token token = (Token) tokenIterator.next();
ManagedObject existingManagedObject = token.getManagedObject();
if (existingManagedObject == null) {
// The object may have already been deleted from the ObjectStore,
// so create a dummy object to keep the transaction happy.
// The Token will have the ObjecStore and storedObjectIdentifier so the the correct delete in the
// ObjectStore can take place.
DummyManagedObject dummyManagedObject = new DummyManagedObject("Created by TransactionOptimisticReplaceLogRecord.performRecovery() (Notify)");
dummyManagedObject.state = ManagedObject.stateReady;
dummyManagedObjectsToNotify.add(dummyManagedObject);
token.setManagedObject(dummyManagedObject);
} // if(existingManagedObject == null).
} // for tokensToNotify...
transactionForRecovery.optimisticReplace(managedObjectsToAdd,
managedObjectsToOptimisticReplace,
managedObjectsToDelete,
tokensToNotify);
transactionForRecovery.internalTransaction.resetState(transactionState);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"performRecovery");
} }
|
public class class_name {
private void append(StringBuffer result, String string,
FieldDelegate delegate,
FieldPosition[] positions,
Format.Field signAttribute) {
int start = result.length();
if (string.length() > 0) {
result.append(string);
for (int counter = 0, max = positions.length; counter < max;
counter++) {
FieldPosition fp = positions[counter];
Format.Field attribute = fp.getFieldAttribute();
if (attribute == Field.SIGN) {
attribute = signAttribute;
}
delegate.formatted(attribute, attribute,
start + fp.getBeginIndex(),
start + fp.getEndIndex(), result);
}
}
} }
|
public class class_name {
private void append(StringBuffer result, String string,
FieldDelegate delegate,
FieldPosition[] positions,
Format.Field signAttribute) {
int start = result.length();
if (string.length() > 0) {
result.append(string); // depends on control dependency: [if], data = [none]
for (int counter = 0, max = positions.length; counter < max;
counter++) {
FieldPosition fp = positions[counter];
Format.Field attribute = fp.getFieldAttribute();
if (attribute == Field.SIGN) {
attribute = signAttribute; // depends on control dependency: [if], data = [none]
}
delegate.formatted(attribute, attribute,
start + fp.getBeginIndex(),
start + fp.getEndIndex(), result); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public static void setXSLTVersion(String s) {
try {
Number n = NumberFormat.getInstance(Locale.US).parse(s);
if (n.doubleValue() < 0) {
throw new ConfigurationException(s + " doesn't reperesent a"
+ " positive number.");
}
} catch (ParseException e) {
throw new ConfigurationException(e);
}
xsltVersion = s;
} }
|
public class class_name {
public static void setXSLTVersion(String s) {
try {
Number n = NumberFormat.getInstance(Locale.US).parse(s);
if (n.doubleValue() < 0) {
throw new ConfigurationException(s + " doesn't reperesent a"
+ " positive number.");
}
} catch (ParseException e) {
throw new ConfigurationException(e);
} // depends on control dependency: [catch], data = [none]
xsltVersion = s;
} }
|
public class class_name {
public static void append(ByteBuffer to, byte b) {
int pos = flipToFill(to);
try {
to.put(b);
} finally {
flipToFlush(to, pos);
}
} }
|
public class class_name {
public static void append(ByteBuffer to, byte b) {
int pos = flipToFill(to);
try {
to.put(b); // depends on control dependency: [try], data = [none]
} finally {
flipToFlush(to, pos);
}
} }
|
public class class_name {
public void setEntries(List<E> entries) {
if (entries == null) {
this.entries = new ArrayList<>();
} else {
this.entries = entries;
}
} }
|
public class class_name {
public void setEntries(List<E> entries) {
if (entries == null) {
this.entries = new ArrayList<>(); // depends on control dependency: [if], data = [none]
} else {
this.entries = entries; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response listAllPushApplications(@QueryParam("page") Integer page,
@QueryParam("per_page") Integer pageSize,
@QueryParam("includeDeviceCount") @DefaultValue("false") boolean includeDeviceCount,
@QueryParam("includeActivity") @DefaultValue("false") boolean includeActivity) {
if (pageSize != null) {
pageSize = Math.min(MAX_PAGE_SIZE, pageSize);
} else {
pageSize = DEFAULT_PAGE_SIZE;
}
if (page == null) {
page = 0;
}
logger.trace("Query paged push applications with {} items for page {}", pageSize, page);
final PageResult<PushApplication, Count> pageResult = getSearch().findAllPushApplicationsForDeveloper(page, pageSize);
ResponseBuilder response = Response.ok(pageResult.getResultList());
response.header("total", pageResult.getAggregate().getCount());
for (PushApplication app : pageResult.getResultList()) {
if (includeActivity) {
logger.trace("Include activity header");
putActivityIntoResponseHeaders(app, response);
}
if (includeDeviceCount) {
logger.trace("Include device count header");
putDeviceCountIntoResponseHeaders(app, response);
}
}
return response.build();
} }
|
public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response listAllPushApplications(@QueryParam("page") Integer page,
@QueryParam("per_page") Integer pageSize,
@QueryParam("includeDeviceCount") @DefaultValue("false") boolean includeDeviceCount,
@QueryParam("includeActivity") @DefaultValue("false") boolean includeActivity) {
if (pageSize != null) {
pageSize = Math.min(MAX_PAGE_SIZE, pageSize); // depends on control dependency: [if], data = [none]
} else {
pageSize = DEFAULT_PAGE_SIZE; // depends on control dependency: [if], data = [none]
}
if (page == null) {
page = 0; // depends on control dependency: [if], data = [none]
}
logger.trace("Query paged push applications with {} items for page {}", pageSize, page);
final PageResult<PushApplication, Count> pageResult = getSearch().findAllPushApplicationsForDeveloper(page, pageSize);
ResponseBuilder response = Response.ok(pageResult.getResultList());
response.header("total", pageResult.getAggregate().getCount());
for (PushApplication app : pageResult.getResultList()) {
if (includeActivity) {
logger.trace("Include activity header"); // depends on control dependency: [if], data = [none]
putActivityIntoResponseHeaders(app, response); // depends on control dependency: [if], data = [none]
}
if (includeDeviceCount) {
logger.trace("Include device count header"); // depends on control dependency: [if], data = [none]
putDeviceCountIntoResponseHeaders(app, response); // depends on control dependency: [if], data = [none]
}
}
return response.build();
} }
|
public class class_name {
protected Container findContainer(ContainerContext ctx, StringBuilder dump) {
Container container = null;
// 1. Custom container class
String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS);
if (containerClassName != null) {
try {
Class<Container> containerClass = Reflections.classForName(resourceLoader, containerClassName);
container = SecurityActions.newInstance(containerClass);
WeldServletLogger.LOG.containerDetectionSkipped(containerClassName);
} catch (Exception e) {
WeldServletLogger.LOG.unableToInstantiateCustomContainerClass(containerClassName);
WeldServletLogger.LOG.catchingDebug(e);
}
}
if (container == null) {
// 2. Service providers
Iterable<Container> extContainers = ServiceLoader.load(Container.class, getClass().getClassLoader());
container = checkContainers(ctx, dump, extContainers);
if (container == null) {
// 3. Built-in containers in predefined order
container = checkContainers(ctx, dump,
Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE));
}
}
return container;
} }
|
public class class_name {
protected Container findContainer(ContainerContext ctx, StringBuilder dump) {
Container container = null;
// 1. Custom container class
String containerClassName = ctx.getServletContext().getInitParameter(Container.CONTEXT_PARAM_CONTAINER_CLASS);
if (containerClassName != null) {
try {
Class<Container> containerClass = Reflections.classForName(resourceLoader, containerClassName);
container = SecurityActions.newInstance(containerClass);
WeldServletLogger.LOG.containerDetectionSkipped(containerClassName);
} catch (Exception e) {
WeldServletLogger.LOG.unableToInstantiateCustomContainerClass(containerClassName);
WeldServletLogger.LOG.catchingDebug(e);
} // depends on control dependency: [catch], data = [none]
}
if (container == null) {
// 2. Service providers
Iterable<Container> extContainers = ServiceLoader.load(Container.class, getClass().getClassLoader());
container = checkContainers(ctx, dump, extContainers); // depends on control dependency: [if], data = [none]
if (container == null) {
// 3. Built-in containers in predefined order
container = checkContainers(ctx, dump,
Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE)); // depends on control dependency: [if], data = [none]
}
}
return container;
} }
|
public class class_name {
public static ObjectName createObjectName(String domain, String type) {
try {
return new ObjectName(domain + ":type=" + type);
} catch(MalformedObjectNameException e) {
throw new VoldemortException(e);
}
} }
|
public class class_name {
public static ObjectName createObjectName(String domain, String type) {
try {
return new ObjectName(domain + ":type=" + type); // depends on control dependency: [try], data = [none]
} catch(MalformedObjectNameException e) {
throw new VoldemortException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void handleException(final Throwable e)
{
if ( errorListeners.size() == 0 )
{
LOG.error("", e);
}
else
{
errorListeners.forEach(new Function<UnhandledErrorListener, Void>()
{
@Override
public Void apply(UnhandledErrorListener listener)
{
try
{
listener.unhandledError("", e);
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
LOG.error("Exception handling exception", e);
}
return null;
}
});
}
} }
|
public class class_name {
private void handleException(final Throwable e)
{
if ( errorListeners.size() == 0 )
{
LOG.error("", e); // depends on control dependency: [if], data = [none]
}
else
{
errorListeners.forEach(new Function<UnhandledErrorListener, Void>()
{
@Override
public Void apply(UnhandledErrorListener listener)
{
try
{
listener.unhandledError("", e); // depends on control dependency: [try], data = [none]
}
catch ( Exception e )
{
ThreadUtils.checkInterrupted(e);
LOG.error("Exception handling exception", e);
} // depends on control dependency: [catch], data = [none]
return null;
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void removeLast() {
if (this.numTypesProperty.get()>0) {
switch(this.types[this.numTypesProperty.get()-1]) {
case CLOSE:
// no coord to remove
break;
case MOVE_TO:
case LINE_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-3);
break;
case CURVE_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-9);
this.isPolylineProperty = null;
break;
case QUAD_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-6);
this.isPolylineProperty = null;
break;
default:
throw new IllegalStateException();
}
this.numTypesProperty.set(this.numTypesProperty.get()-1);
this.isEmptyProperty = null;
this.graphicalBounds = null;
this.logicalBounds = null;
}
} }
|
public class class_name {
public void removeLast() {
if (this.numTypesProperty.get()>0) {
switch(this.types[this.numTypesProperty.get()-1]) {
case CLOSE:
// no coord to remove
break;
case MOVE_TO:
case LINE_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-3);
break;
case CURVE_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-9);
this.isPolylineProperty = null;
break;
case QUAD_TO:
this.numCoordsProperty.set(this.numCoordsProperty.get()-6);
this.isPolylineProperty = null;
break;
default:
throw new IllegalStateException();
}
this.numTypesProperty.set(this.numTypesProperty.get()-1); // depends on control dependency: [if], data = [(this.numTypesProperty.get()]
this.isEmptyProperty = null; // depends on control dependency: [if], data = [none]
this.graphicalBounds = null; // depends on control dependency: [if], data = [none]
this.logicalBounds = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected SessionNode removeChildFromNode( AbstractSessionCache session,
NodeKey childKey ) {
// First, manipulate the child node. But we have to see whether this node is a primary parent or an additional parent ...
SessionNode child = session.mutable(childKey);
NodeKey parentKey = child.getParentKey(session);
if (parentKey != null) {
if (parentKey.equals(this.key)) {
// The child's parent is this node. If there are additional parents, then we should pick the first additional parent
// and use it as the new primary parent ...
Set<NodeKey> additionalParentKeys = child.getAdditionalParentKeys(session);
if (additionalParentKeys.isEmpty()) {
child.newParent = null;
} else {
// There are additional parents, and we're removing the primary parent
NodeKey newParentKey = additionalParentKeys.iterator().next();
child.replaceParentWithAdditionalParent(session, this.key, newParentKey);
}
} else {
// The child's parent is NOT this node, so this node must be an additional parent...
boolean removed = child.removeAdditionalParent(session, this.key);
if (!removed) {
// Not a primary or additional parent ...
if (!getChildReferences(session).hasChild(childKey)) {
throw new NodeNotFoundException(childKey);
}
}
}
} else {
LOGGER.warn(JcrI18n.warnCorruptedChildParentRef, childKey);
}
// Now, update this node (the parent) ...
MutableChildReferences appended = this.appended.get();
ChildReference removed = null;
if (appended != null) {
removed = appended.remove(childKey); // The node may have been appended to this node but not yet persisted ...
}
if (removed == null) {
changedChildren.remove(childKey);
}
return child;
} }
|
public class class_name {
protected SessionNode removeChildFromNode( AbstractSessionCache session,
NodeKey childKey ) {
// First, manipulate the child node. But we have to see whether this node is a primary parent or an additional parent ...
SessionNode child = session.mutable(childKey);
NodeKey parentKey = child.getParentKey(session);
if (parentKey != null) {
if (parentKey.equals(this.key)) {
// The child's parent is this node. If there are additional parents, then we should pick the first additional parent
// and use it as the new primary parent ...
Set<NodeKey> additionalParentKeys = child.getAdditionalParentKeys(session);
if (additionalParentKeys.isEmpty()) {
child.newParent = null; // depends on control dependency: [if], data = [none]
} else {
// There are additional parents, and we're removing the primary parent
NodeKey newParentKey = additionalParentKeys.iterator().next();
child.replaceParentWithAdditionalParent(session, this.key, newParentKey); // depends on control dependency: [if], data = [none]
}
} else {
// The child's parent is NOT this node, so this node must be an additional parent...
boolean removed = child.removeAdditionalParent(session, this.key);
if (!removed) {
// Not a primary or additional parent ...
if (!getChildReferences(session).hasChild(childKey)) {
throw new NodeNotFoundException(childKey);
}
}
}
} else {
LOGGER.warn(JcrI18n.warnCorruptedChildParentRef, childKey); // depends on control dependency: [if], data = [none]
}
// Now, update this node (the parent) ...
MutableChildReferences appended = this.appended.get();
ChildReference removed = null;
if (appended != null) {
removed = appended.remove(childKey); // The node may have been appended to this node but not yet persisted ... // depends on control dependency: [if], data = [none]
}
if (removed == null) {
changedChildren.remove(childKey); // depends on control dependency: [if], data = [none]
}
return child;
} }
|
public class class_name {
public String toJson(Map<?, ?> map) {
StringWriter stringWriter = new StringWriter();
try {
toJson(map, stringWriter);
} catch (IOException e) {
throw new AssertionError(e); // No I/O writing to a Buffer.
}
return stringWriter.toString();
} }
|
public class class_name {
public String toJson(Map<?, ?> map) {
StringWriter stringWriter = new StringWriter();
try {
toJson(map, stringWriter); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new AssertionError(e); // No I/O writing to a Buffer.
} // depends on control dependency: [catch], data = [none]
return stringWriter.toString();
} }
|
public class class_name {
public ProxyPolicyHandler setProxyPolicyHandler(String id,
ProxyPolicyHandler handler) {
if (id == null) {
throw new IllegalArgumentException(i18n.getMessage("proxyPolicyId"));
}
if (handler == null) {
throw new IllegalArgumentException(i18n.
getMessage("proxyPolicyHandler"));
}
if (this.proxyPolicyHandlers == null) {
this.proxyPolicyHandlers = new Hashtable();
}
return (ProxyPolicyHandler)this.proxyPolicyHandlers.put(id, handler);
} }
|
public class class_name {
public ProxyPolicyHandler setProxyPolicyHandler(String id,
ProxyPolicyHandler handler) {
if (id == null) {
throw new IllegalArgumentException(i18n.getMessage("proxyPolicyId"));
}
if (handler == null) {
throw new IllegalArgumentException(i18n.
getMessage("proxyPolicyHandler"));
}
if (this.proxyPolicyHandlers == null) {
this.proxyPolicyHandlers = new Hashtable(); // depends on control dependency: [if], data = [none]
}
return (ProxyPolicyHandler)this.proxyPolicyHandlers.put(id, handler);
} }
|
public class class_name {
@Override
public RoundedMoney divide(Number divisor) {
BigDecimal bd = MoneyUtils.getBigDecimal(divisor);
if (isOne(bd)) {
return this;
}
BigDecimal dec = number.divide(bd, Optional.ofNullable(monetaryContext.get(RoundingMode.class)).
orElse(RoundingMode.HALF_EVEN));
return new RoundedMoney(dec, currency, rounding).with(rounding);
} }
|
public class class_name {
@Override
public RoundedMoney divide(Number divisor) {
BigDecimal bd = MoneyUtils.getBigDecimal(divisor);
if (isOne(bd)) {
return this; // depends on control dependency: [if], data = [none]
}
BigDecimal dec = number.divide(bd, Optional.ofNullable(monetaryContext.get(RoundingMode.class)).
orElse(RoundingMode.HALF_EVEN));
return new RoundedMoney(dec, currency, rounding).with(rounding);
} }
|
public class class_name {
ThrowableInformation getException(Connection connection, long id)
throws SQLException {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sqlException);
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
Vector v = new Vector();
while (rs.next()) {
//int i = rs.getShort(1);
v.add(rs.getString(1));
}
int len = v.size();
String[] strRep = new String[len];
for (int i = 0; i < len; i++) {
strRep[i] = (String) v.get(i);
}
// we've filled strRep, we now attach it to the event
return new ThrowableInformation(strRep);
} finally {
if (statement != null) {
statement.close();
}
}
} }
|
public class class_name {
ThrowableInformation getException(Connection connection, long id)
throws SQLException {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sqlException);
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
Vector v = new Vector();
while (rs.next()) {
//int i = rs.getShort(1);
v.add(rs.getString(1)); // depends on control dependency: [while], data = [none]
}
int len = v.size();
String[] strRep = new String[len];
for (int i = 0; i < len; i++) {
strRep[i] = (String) v.get(i); // depends on control dependency: [for], data = [i]
}
// we've filled strRep, we now attach it to the event
return new ThrowableInformation(strRep);
} finally {
if (statement != null) {
statement.close(); // depends on control dependency: [if], data = [none]
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.