code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public boolean startDiscovery(BeanDiscoveryListener listener) {
if (mScanning) {
Log.e(TAG, "Already discovering");
return true;
}
mListener = listener;
return scan();
} }
|
public class class_name {
public boolean startDiscovery(BeanDiscoveryListener listener) {
if (mScanning) {
Log.e(TAG, "Already discovering"); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
mListener = listener;
return scan();
} }
|
public class class_name {
public Concept getConcept(Variable var) {
var = equivalentVars.componentOf(var);
assert var != null;
@Nullable Concept concept = concepts.get(var);
if (concept == null) {
@Nullable ConceptBuilder builder = conceptBuilders.remove(var);
if (builder != null) {
concept = buildConcept(var, builder);
}
}
if (concept != null) {
return concept;
}
LOG.debug("Could not build concept for {}\nconcepts = {}\nconceptBuilders = {}", var, concepts, conceptBuilders);
throw GraqlQueryException.insertUndefinedVariable(printableRepresentation(var));
} }
|
public class class_name {
public Concept getConcept(Variable var) {
var = equivalentVars.componentOf(var);
assert var != null;
@Nullable Concept concept = concepts.get(var);
if (concept == null) {
@Nullable ConceptBuilder builder = conceptBuilders.remove(var);
if (builder != null) {
concept = buildConcept(var, builder); // depends on control dependency: [if], data = [none]
}
}
if (concept != null) {
return concept; // depends on control dependency: [if], data = [none]
}
LOG.debug("Could not build concept for {}\nconcepts = {}\nconceptBuilders = {}", var, concepts, conceptBuilders);
throw GraqlQueryException.insertUndefinedVariable(printableRepresentation(var));
} }
|
public class class_name {
public void addAttributeItemRule(ItemRule itemRule) {
if (attributeItemRuleMap == null) {
attributeItemRuleMap = new ItemRuleMap();
}
attributeItemRuleMap.putItemRule(itemRule);
} }
|
public class class_name {
public void addAttributeItemRule(ItemRule itemRule) {
if (attributeItemRuleMap == null) {
attributeItemRuleMap = new ItemRuleMap(); // depends on control dependency: [if], data = [none]
}
attributeItemRuleMap.putItemRule(itemRule);
} }
|
public class class_name {
public static void main(String[] args)
{
// Use the command line parser to evaluate the command line.
CommandLineParser commandLine =
new CommandLineParser(
new String[][]
{
{
"s", "The sequence definition.", "[m:...:n](:sample=s)(:exp)", "true", MathUtils.SEQUENCE_REGEXP
},
{ "d", "The duration definition.", "dDhHmMsS", "false", MathUtils.DURATION_REGEXP }
});
// Capture the command line arguments or display errors and correct usage and then exit.
ParsedProperties options = null;
try
{
options = new ParsedProperties(commandLine.parseCommandLine(args));
}
catch (IllegalArgumentException e)
{
// It is noted that the command line is illegal, so the exception can be ignored.
e = null;
System.out.println(commandLine.getErrors());
System.out.println(commandLine.getUsage());
System.exit(-1);
}
// Extract the command line options.
String sequence = options.getProperty("s");
String durationString = options.getProperty("d");
System.out.println("Sequence is: " + printArray(parseSequence(sequence)));
if (durationString != null)
{
System.out.println("Duration is: " + parseDuration(durationString));
}
} }
|
public class class_name {
public static void main(String[] args)
{
// Use the command line parser to evaluate the command line.
CommandLineParser commandLine =
new CommandLineParser(
new String[][]
{
{
"s", "The sequence definition.", "[m:...:n](:sample=s)(:exp)", "true", MathUtils.SEQUENCE_REGEXP
},
{ "d", "The duration definition.", "dDhHmMsS", "false", MathUtils.DURATION_REGEXP }
});
// Capture the command line arguments or display errors and correct usage and then exit.
ParsedProperties options = null;
try
{
options = new ParsedProperties(commandLine.parseCommandLine(args)); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException e)
{
// It is noted that the command line is illegal, so the exception can be ignored.
e = null;
System.out.println(commandLine.getErrors());
System.out.println(commandLine.getUsage());
System.exit(-1);
} // depends on control dependency: [catch], data = [none]
// Extract the command line options.
String sequence = options.getProperty("s");
String durationString = options.getProperty("d");
System.out.println("Sequence is: " + printArray(parseSequence(sequence)));
if (durationString != null)
{
System.out.println("Duration is: " + parseDuration(durationString)); // depends on control dependency: [if], data = [(durationString]
}
} }
|
public class class_name {
public static Date[] getSeasonDate(Date date) {
Date[] season = new Date[3];
Calendar c = Calendar.getInstance();
c.setTime(date);
int nSeason = getQuarter(date);
if (nSeason == 1) {// 第一季度
c.set(Calendar.MONTH, Calendar.JANUARY);
season[0] = c.getTime();
c.set(Calendar.MONTH, Calendar.FEBRUARY);
season[1] = c.getTime();
c.set(Calendar.MONTH, Calendar.MARCH);
season[2] = c.getTime();
} else if (nSeason == 2) {// 第二季度
c.set(Calendar.MONTH, Calendar.APRIL);
season[0] = c.getTime();
c.set(Calendar.MONTH, Calendar.MAY);
season[1] = c.getTime();
c.set(Calendar.MONTH, Calendar.JUNE);
season[2] = c.getTime();
} else if (nSeason == 3) {// 第三季度
c.set(Calendar.MONTH, Calendar.JULY);
season[0] = c.getTime();
c.set(Calendar.MONTH, Calendar.AUGUST);
season[1] = c.getTime();
c.set(Calendar.MONTH, Calendar.SEPTEMBER);
season[2] = c.getTime();
} else if (nSeason == 4) {// 第四季度
c.set(Calendar.MONTH, Calendar.OCTOBER);
season[0] = c.getTime();
c.set(Calendar.MONTH, Calendar.NOVEMBER);
season[1] = c.getTime();
c.set(Calendar.MONTH, Calendar.DECEMBER);
season[2] = c.getTime();
}
return season;
} }
|
public class class_name {
public static Date[] getSeasonDate(Date date) {
Date[] season = new Date[3];
Calendar c = Calendar.getInstance();
c.setTime(date);
int nSeason = getQuarter(date);
if (nSeason == 1) {// 第一季度
c.set(Calendar.MONTH, Calendar.JANUARY); // depends on control dependency: [if], data = [none]
season[0] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.FEBRUARY); // depends on control dependency: [if], data = [none]
season[1] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.MARCH); // depends on control dependency: [if], data = [none]
season[2] = c.getTime(); // depends on control dependency: [if], data = [none]
} else if (nSeason == 2) {// 第二季度
c.set(Calendar.MONTH, Calendar.APRIL); // depends on control dependency: [if], data = [none]
season[0] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.MAY); // depends on control dependency: [if], data = [none]
season[1] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.JUNE); // depends on control dependency: [if], data = [none]
season[2] = c.getTime(); // depends on control dependency: [if], data = [none]
} else if (nSeason == 3) {// 第三季度
c.set(Calendar.MONTH, Calendar.JULY); // depends on control dependency: [if], data = [none]
season[0] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.AUGUST); // depends on control dependency: [if], data = [none]
season[1] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.SEPTEMBER); // depends on control dependency: [if], data = [none]
season[2] = c.getTime(); // depends on control dependency: [if], data = [none]
} else if (nSeason == 4) {// 第四季度
c.set(Calendar.MONTH, Calendar.OCTOBER); // depends on control dependency: [if], data = [none]
season[0] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.NOVEMBER); // depends on control dependency: [if], data = [none]
season[1] = c.getTime(); // depends on control dependency: [if], data = [none]
c.set(Calendar.MONTH, Calendar.DECEMBER); // depends on control dependency: [if], data = [none]
season[2] = c.getTime(); // depends on control dependency: [if], data = [none]
}
return season;
} }
|
public class class_name {
public boolean hasCheckMultiActions() {
Iterator<CmsListMultiAction> it = m_multiActions.elementList().iterator();
while (it.hasNext()) {
CmsListMultiAction action = it.next();
if (!(action instanceof CmsListRadioMultiAction)) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean hasCheckMultiActions() {
Iterator<CmsListMultiAction> it = m_multiActions.elementList().iterator();
while (it.hasNext()) {
CmsListMultiAction action = it.next();
if (!(action instanceof CmsListRadioMultiAction)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T getDefaultValue() {
if (this.defaultValue == null || ConfigProperty.NULL_VALUE.equals(this.defaultValue) || ConfigProperty.UNCONFIGURED_VALUE.equals(this.defaultValue)) {
return null;
} else {
return (T) this.defaultValue;
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public T getDefaultValue() {
if (this.defaultValue == null || ConfigProperty.NULL_VALUE.equals(this.defaultValue) || ConfigProperty.UNCONFIGURED_VALUE.equals(this.defaultValue)) {
return null; // depends on control dependency: [if], data = [none]
} else {
return (T) this.defaultValue; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings({ "unchecked" })
public <T> Mapping<T> getMapping(Class<T> clazz,
AnnotationSet<?, ?> annotationSet, boolean includeParentFields) {
Mapping<T> mapping = (Mapping<T>) cache.get(clazz); // cast is safe as
// this instance is
// the one adding to
// the map
if (mapping == null) {
// multiple threads can get here but that's OK
mapping = new Mapping<T>(clazz, annotationSet, includeParentFields);
cache.put(clazz, mapping);
}
return mapping;
} }
|
public class class_name {
@SuppressWarnings({ "unchecked" })
public <T> Mapping<T> getMapping(Class<T> clazz,
AnnotationSet<?, ?> annotationSet, boolean includeParentFields) {
Mapping<T> mapping = (Mapping<T>) cache.get(clazz); // cast is safe as
// this instance is
// the one adding to
// the map
if (mapping == null) {
// multiple threads can get here but that's OK
mapping = new Mapping<T>(clazz, annotationSet, includeParentFields); // depends on control dependency: [if], data = [none]
cache.put(clazz, mapping); // depends on control dependency: [if], data = [none]
}
return mapping;
} }
|
public class class_name {
public static <T> ByteString serialize(final String templateName, T object) {
StringWriter templateResults = new StringWriter();
try {
final Template template = configuration.getTemplate(templateName);
template.process(object, templateResults);
} catch (Exception e) {
throw Throwables.propagate(e);
}
return ByteString.encodeUtf8(templateResults.toString());
} }
|
public class class_name {
public static <T> ByteString serialize(final String templateName, T object) {
StringWriter templateResults = new StringWriter();
try {
final Template template = configuration.getTemplate(templateName);
template.process(object, templateResults); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw Throwables.propagate(e);
} // depends on control dependency: [catch], data = [none]
return ByteString.encodeUtf8(templateResults.toString());
} }
|
public class class_name {
private void verbosePolyCmd(String pCmd, Rectangle pBounds, Polygon pPolygon) {
System.out.println(pCmd + ": " + pBounds);
System.out.print("Polygon points: ");
if (pPolygon != null && pPolygon.npoints > 0) {
System.out.print("(" + pPolygon.xpoints[0] + "," + pPolygon.ypoints[0] + ")");
}
for (int i = 1; pPolygon != null && i < pPolygon.npoints; i++) {
System.out.print(", (" + pPolygon.xpoints[i] + "," + pPolygon.ypoints[i] + ")");
}
System.out.println();
} }
|
public class class_name {
private void verbosePolyCmd(String pCmd, Rectangle pBounds, Polygon pPolygon) {
System.out.println(pCmd + ": " + pBounds);
System.out.print("Polygon points: ");
if (pPolygon != null && pPolygon.npoints > 0) {
System.out.print("(" + pPolygon.xpoints[0] + "," + pPolygon.ypoints[0] + ")"); // depends on control dependency: [if], data = [none]
}
for (int i = 1; pPolygon != null && i < pPolygon.npoints; i++) {
System.out.print(", (" + pPolygon.xpoints[i] + "," + pPolygon.ypoints[i] + ")");
}
System.out.println(); // depends on control dependency: [for], data = [none]
} }
|
public class class_name {
protected void showResource(HttpServletRequest req, HttpServletResponse res) {
CmsObject cms = null;
try {
cms = initCmsObject(req, res);
if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
String uri = cms.getRequestContext().getUri();
if (uri.startsWith(CmsWorkplace.VFS_PATH_SITES)) {
// resources within the sites folder may only be called with their site relative path
// this should prevent showing pages from other sites with their root path
throw new CmsVfsResourceNotFoundException(
org.opencms.main.Messages.get().container(org.opencms.main.Messages.ERR_PATH_NOT_FOUND_1, uri));
}
if (OpenCms.getStaticExportManager().isExportLink(cms, uri)) {
// if we used the request's query string for getRfsName, clients could cause an unlimited number
// of files to be exported just by varying the request parameters!
String url = m_linkManager.getOnlineLink(cms, uri);
res.sendRedirect(url);
return;
}
}
List<CmsSiteMatcher> currentSiteAliase = m_siteManager.getCurrentSite(cms).getAliases();
CmsSiteMatcher currentSiteMatcher = cms.getRequestContext().getRequestMatcher();
if (currentSiteAliase.contains(currentSiteMatcher.forDifferentScheme("http"))
|| currentSiteAliase.contains(currentSiteMatcher.forDifferentScheme("https"))) {
int pos = currentSiteAliase.indexOf(currentSiteMatcher.forDifferentScheme("http"));
if (pos == -1) {
pos = currentSiteAliase.indexOf(currentSiteMatcher.forDifferentScheme("https"));
}
if (currentSiteAliase.get(pos).isRedirect()) {
res.sendRedirect(
m_siteManager.getCurrentSite(cms).getUrl() + req.getContextPath() + req.getPathInfo());
return;
}
}
// user is initialized, now deliver the requested resource
CmsResource resource = initResource(cms, cms.getRequestContext().getUri(), req, res);
if (resource != null) {
// a file was read, go on process it
m_resourceManager.loadResource(cms, resource, req, res);
m_sessionManager.updateSessionInfo(cms, req);
}
} catch (Throwable t) {
errorHandling(cms, req, res, t);
}
} }
|
public class class_name {
protected void showResource(HttpServletRequest req, HttpServletResponse res) {
CmsObject cms = null;
try {
cms = initCmsObject(req, res); // depends on control dependency: [try], data = [none]
if (cms.getRequestContext().getCurrentProject().isOnlineProject()) {
String uri = cms.getRequestContext().getUri();
if (uri.startsWith(CmsWorkplace.VFS_PATH_SITES)) {
// resources within the sites folder may only be called with their site relative path
// this should prevent showing pages from other sites with their root path
throw new CmsVfsResourceNotFoundException(
org.opencms.main.Messages.get().container(org.opencms.main.Messages.ERR_PATH_NOT_FOUND_1, uri));
}
if (OpenCms.getStaticExportManager().isExportLink(cms, uri)) {
// if we used the request's query string for getRfsName, clients could cause an unlimited number
// of files to be exported just by varying the request parameters!
String url = m_linkManager.getOnlineLink(cms, uri);
res.sendRedirect(url); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
List<CmsSiteMatcher> currentSiteAliase = m_siteManager.getCurrentSite(cms).getAliases();
CmsSiteMatcher currentSiteMatcher = cms.getRequestContext().getRequestMatcher();
if (currentSiteAliase.contains(currentSiteMatcher.forDifferentScheme("http"))
|| currentSiteAliase.contains(currentSiteMatcher.forDifferentScheme("https"))) {
int pos = currentSiteAliase.indexOf(currentSiteMatcher.forDifferentScheme("http"));
if (pos == -1) {
pos = currentSiteAliase.indexOf(currentSiteMatcher.forDifferentScheme("https")); // depends on control dependency: [if], data = [none]
}
if (currentSiteAliase.get(pos).isRedirect()) {
res.sendRedirect(
m_siteManager.getCurrentSite(cms).getUrl() + req.getContextPath() + req.getPathInfo()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// user is initialized, now deliver the requested resource
CmsResource resource = initResource(cms, cms.getRequestContext().getUri(), req, res);
if (resource != null) {
// a file was read, go on process it
m_resourceManager.loadResource(cms, resource, req, res); // depends on control dependency: [if], data = [none]
m_sessionManager.updateSessionInfo(cms, req); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
errorHandling(cms, req, res, t);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean match(String rootPath, CmsLock lock) {
boolean match = false;
if (m_includeChildren) {
// safe since rootPath always ends with slash if a folder
match = lock.getResourceName().startsWith(rootPath);
}
if (!match && m_includeParents) {
// since parents can only be folders, check it only for folders
if (lock.getResourceName().endsWith("/")) {
match = rootPath.startsWith(lock.getResourceName());
}
}
if (match && (m_projectId != null) && !m_projectId.isNullUUID() && (lock.getProjectId() != null)) {
match = lock.getProjectId().equals(m_projectId);
}
if (match && (m_ownedByUserId != null) && !m_ownedByUserId.isNullUUID()) {
match = lock.getUserId().equals(m_ownedByUserId);
}
if (match && (m_notOwnedByUserId != null) && !m_notOwnedByUserId.isNullUUID()) {
match = !lock.getUserId().equals(m_notOwnedByUserId);
}
if (match && (m_lockableByUser != null)) {
match = lock.isLockableBy(m_lockableByUser);
}
if (match && (m_notLockableByUser != null)) {
match = !lock.isLockableBy(m_notLockableByUser);
}
if (match && !m_types.isEmpty()) {
match = m_types.contains(lock.getType());
match = match || (m_includeParents && lock.isInherited());
}
// check the related lock if available
if (!match && !lock.getRelatedLock().isNullLock()) {
match = match(rootPath, lock.getRelatedLock());
}
return match;
} }
|
public class class_name {
public boolean match(String rootPath, CmsLock lock) {
boolean match = false;
if (m_includeChildren) {
// safe since rootPath always ends with slash if a folder
match = lock.getResourceName().startsWith(rootPath); // depends on control dependency: [if], data = [none]
}
if (!match && m_includeParents) {
// since parents can only be folders, check it only for folders
if (lock.getResourceName().endsWith("/")) {
match = rootPath.startsWith(lock.getResourceName()); // depends on control dependency: [if], data = [none]
}
}
if (match && (m_projectId != null) && !m_projectId.isNullUUID() && (lock.getProjectId() != null)) {
match = lock.getProjectId().equals(m_projectId); // depends on control dependency: [if], data = [none]
}
if (match && (m_ownedByUserId != null) && !m_ownedByUserId.isNullUUID()) {
match = lock.getUserId().equals(m_ownedByUserId); // depends on control dependency: [if], data = [none]
}
if (match && (m_notOwnedByUserId != null) && !m_notOwnedByUserId.isNullUUID()) {
match = !lock.getUserId().equals(m_notOwnedByUserId); // depends on control dependency: [if], data = [none]
}
if (match && (m_lockableByUser != null)) {
match = lock.isLockableBy(m_lockableByUser); // depends on control dependency: [if], data = [none]
}
if (match && (m_notLockableByUser != null)) {
match = !lock.isLockableBy(m_notLockableByUser); // depends on control dependency: [if], data = [none]
}
if (match && !m_types.isEmpty()) {
match = m_types.contains(lock.getType()); // depends on control dependency: [if], data = [none]
match = match || (m_includeParents && lock.isInherited()); // depends on control dependency: [if], data = [none]
}
// check the related lock if available
if (!match && !lock.getRelatedLock().isNullLock()) {
match = match(rootPath, lock.getRelatedLock()); // depends on control dependency: [if], data = [none]
}
return match;
} }
|
public class class_name {
private List<Record> getBadRecords(ErrorSink errorSink) {
List<Record> badRecords = new ArrayList<>();
for (Map.Entry<String, List<Record>> entry : errorSink.getErrorRecords().entrySet()) {
for (Record record : entry.getValue()) {
RecordImpl errorRecord;
switch (errorRecordPolicy) {
case ORIGINAL_RECORD:
errorRecord = (RecordImpl) ((RecordImpl)record).getHeader().getSourceRecord();
errorRecord.getHeader().copyErrorFrom(record);
break;
case STAGE_RECORD:
errorRecord = (RecordImpl) record;
break;
default:
throw new IllegalArgumentException("Uknown error record policy: " + errorRecordPolicy);
}
errorRecord.getHeader().setErrorContext(runtimeInfo.getId(), pipelineName);
badRecords.add(errorRecord);
}
}
return badRecords;
} }
|
public class class_name {
private List<Record> getBadRecords(ErrorSink errorSink) {
List<Record> badRecords = new ArrayList<>();
for (Map.Entry<String, List<Record>> entry : errorSink.getErrorRecords().entrySet()) {
for (Record record : entry.getValue()) {
RecordImpl errorRecord;
switch (errorRecordPolicy) {
case ORIGINAL_RECORD:
errorRecord = (RecordImpl) ((RecordImpl)record).getHeader().getSourceRecord();
errorRecord.getHeader().copyErrorFrom(record);
break;
case STAGE_RECORD:
errorRecord = (RecordImpl) record;
break;
default:
throw new IllegalArgumentException("Uknown error record policy: " + errorRecordPolicy);
}
errorRecord.getHeader().setErrorContext(runtimeInfo.getId(), pipelineName); // depends on control dependency: [for], data = [none]
badRecords.add(errorRecord); // depends on control dependency: [for], data = [none]
}
}
return badRecords;
} }
|
public class class_name {
@Override
@SuppressFBWarnings(value = "UL_UNRELEASED_LOCK", justification = "False positive from FindBugs")
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
if (!isActive()) {
throw new ContextNotActiveException();
}
checkContextInitialized();
final BeanStore beanStore = getBeanStore();
if (beanStore == null) {
return null;
}
if (contextual == null) {
throw ContextLogger.LOG.contextualIsNull();
}
BeanIdentifier id = getId(contextual);
ContextualInstance<T> beanInstance = beanStore.get(id);
if (beanInstance != null) {
return beanInstance.getInstance();
} else if (creationalContext != null) {
LockedBean lock = null;
try {
if (multithreaded) {
lock = beanStore.lock(id);
beanInstance = beanStore.get(id);
if (beanInstance != null) {
return beanInstance.getInstance();
}
}
T instance = contextual.create(creationalContext);
if (instance != null) {
beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class));
beanStore.put(id, beanInstance);
}
return instance;
} finally {
if (lock != null) {
lock.unlock();
}
}
} else {
return null;
}
} }
|
public class class_name {
@Override
@SuppressFBWarnings(value = "UL_UNRELEASED_LOCK", justification = "False positive from FindBugs")
public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {
if (!isActive()) {
throw new ContextNotActiveException();
}
checkContextInitialized();
final BeanStore beanStore = getBeanStore();
if (beanStore == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (contextual == null) {
throw ContextLogger.LOG.contextualIsNull();
}
BeanIdentifier id = getId(contextual);
ContextualInstance<T> beanInstance = beanStore.get(id);
if (beanInstance != null) {
return beanInstance.getInstance(); // depends on control dependency: [if], data = [none]
} else if (creationalContext != null) {
LockedBean lock = null;
try {
if (multithreaded) {
lock = beanStore.lock(id); // depends on control dependency: [if], data = [none]
beanInstance = beanStore.get(id); // depends on control dependency: [if], data = [none]
if (beanInstance != null) {
return beanInstance.getInstance(); // depends on control dependency: [if], data = [none]
}
}
T instance = contextual.create(creationalContext);
if (instance != null) {
beanInstance = new SerializableContextualInstanceImpl<Contextual<T>, T>(contextual, instance, creationalContext, serviceRegistry.get(ContextualStore.class)); // depends on control dependency: [if], data = [none]
beanStore.put(id, beanInstance); // depends on control dependency: [if], data = [none]
}
return instance; // depends on control dependency: [try], data = [none]
} finally {
if (lock != null) {
lock.unlock(); // depends on control dependency: [if], data = [none]
}
}
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String tableName(String fieldFullyQualifiedName) {
if (fieldFullyQualifiedName.contains(".")) {
return fieldFullyQualifiedName.substring(0, fieldFullyQualifiedName.indexOf("."));
}
return null;
} }
|
public class class_name {
public static String tableName(String fieldFullyQualifiedName) {
if (fieldFullyQualifiedName.contains(".")) {
return fieldFullyQualifiedName.substring(0, fieldFullyQualifiedName.indexOf(".")); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Override
public void restore() {
if (log.isInfoEnabled()) {
log.info("Restoring default locale to [" + originalLocale + "]");
}
try {
Locale.setDefault(originalLocale);
} catch (Exception e) {
log.error("Could not restore locale to [" + originalLocale + "]. Continuing with ["
+ Locale.getDefault() + "]", e);
}
} }
|
public class class_name {
@Override
public void restore() {
if (log.isInfoEnabled()) {
log.info("Restoring default locale to [" + originalLocale + "]"); // depends on control dependency: [if], data = [none]
}
try {
Locale.setDefault(originalLocale); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Could not restore locale to [" + originalLocale + "]. Continuing with ["
+ Locale.getDefault() + "]", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ValueType fromConfig(String property) {
//If the property is valid and we cannot find a "property.type" then the value of the property represents its simple type.
if (Config.hasProperty(property) && !Config.hasProperty(property, TYPE_PROPERTY)) {
return new SimpleValueType(Config.get(property).asClass());
}
if( Config.isBean(property) ){
Object o = Config.get(property);
return new SimpleValueType(o.getClass());
}
//Read in the value type parameters from the configuration using the property as the prefix
Map<String, Class> typeInfo = Config.getMap(property, String.class, Class.class);
//Set the type class to the type property defaulting to String if not found
Class<?> typeClass = typeInfo.getOrDefault(TYPE_PROPERTY, String.class);
//Check for a collection
if (Collection.class.isAssignableFrom(typeClass)) {
return new CollectionValueType(typeClass,
typeInfo.getOrDefault(ELEMENT_TYPE_PROPERTY, String.class)
);
}
//Check for a Map
if (Map.class.isAssignableFrom(typeClass)) {
return new MapValueType(typeClass,
typeInfo.getOrDefault(KEY_TYPE_PROPERTY, String.class),
typeInfo.getOrDefault(VALUE_TYPE_PROPERTY, String.class)
);
}
return new SimpleValueType(typeClass);
} }
|
public class class_name {
public static ValueType fromConfig(String property) {
//If the property is valid and we cannot find a "property.type" then the value of the property represents its simple type.
if (Config.hasProperty(property) && !Config.hasProperty(property, TYPE_PROPERTY)) {
return new SimpleValueType(Config.get(property).asClass()); // depends on control dependency: [if], data = [none]
}
if( Config.isBean(property) ){
Object o = Config.get(property);
return new SimpleValueType(o.getClass()); // depends on control dependency: [if], data = [none]
}
//Read in the value type parameters from the configuration using the property as the prefix
Map<String, Class> typeInfo = Config.getMap(property, String.class, Class.class);
//Set the type class to the type property defaulting to String if not found
Class<?> typeClass = typeInfo.getOrDefault(TYPE_PROPERTY, String.class);
//Check for a collection
if (Collection.class.isAssignableFrom(typeClass)) {
return new CollectionValueType(typeClass,
typeInfo.getOrDefault(ELEMENT_TYPE_PROPERTY, String.class)
); // depends on control dependency: [if], data = [none]
}
//Check for a Map
if (Map.class.isAssignableFrom(typeClass)) {
return new MapValueType(typeClass,
typeInfo.getOrDefault(KEY_TYPE_PROPERTY, String.class),
typeInfo.getOrDefault(VALUE_TYPE_PROPERTY, String.class)
); // depends on control dependency: [if], data = [none]
}
return new SimpleValueType(typeClass);
} }
|
public class class_name {
public static List<String> csvSplit(List<String> list, String s, int off, int len) {
if (list == null)
list = new ArrayList<>();
CsvSplitState state = CsvSplitState.PRE_DATA;
StringBuilder out = new StringBuilder();
int last = -1;
while (len > 0) {
char ch = s.charAt(off++);
len--;
switch (state) {
case PRE_DATA:
if (Character.isWhitespace(ch))
continue;
if ('"' == ch) {
state = CsvSplitState.QUOTE;
continue;
}
if (',' == ch) {
list.add("");
continue;
}
state = CsvSplitState.DATA;
out.append(ch);
continue;
case DATA:
if (Character.isWhitespace(ch)) {
last = out.length();
out.append(ch);
state = CsvSplitState.WHITE;
continue;
}
if (',' == ch) {
list.add(out.toString());
out.setLength(0);
state = CsvSplitState.PRE_DATA;
continue;
}
out.append(ch);
continue;
case WHITE:
if (Character.isWhitespace(ch)) {
out.append(ch);
continue;
}
if (',' == ch) {
out.setLength(last);
list.add(out.toString());
out.setLength(0);
state = CsvSplitState.PRE_DATA;
continue;
}
state = CsvSplitState.DATA;
out.append(ch);
last = -1;
continue;
case QUOTE:
if ('\\' == ch) {
state = CsvSplitState.SLOSH;
continue;
}
if ('"' == ch) {
list.add(out.toString());
out.setLength(0);
state = CsvSplitState.POST_DATA;
continue;
}
out.append(ch);
continue;
case SLOSH:
out.append(ch);
state = CsvSplitState.QUOTE;
continue;
case POST_DATA:
if (',' == ch) {
state = CsvSplitState.PRE_DATA;
}
}
}
switch (state) {
case PRE_DATA:
case POST_DATA:
break;
case DATA:
case QUOTE:
case SLOSH:
list.add(out.toString());
break;
case WHITE:
out.setLength(last);
list.add(out.toString());
break;
}
return list;
} }
|
public class class_name {
public static List<String> csvSplit(List<String> list, String s, int off, int len) {
if (list == null)
list = new ArrayList<>();
CsvSplitState state = CsvSplitState.PRE_DATA;
StringBuilder out = new StringBuilder();
int last = -1;
while (len > 0) {
char ch = s.charAt(off++);
len--;
// depends on control dependency: [while], data = [none]
switch (state) {
case PRE_DATA:
if (Character.isWhitespace(ch))
continue;
if ('"' == ch) {
state = CsvSplitState.QUOTE;
// depends on control dependency: [if], data = [none]
continue;
}
if (',' == ch) {
list.add("");
// depends on control dependency: [if], data = [none]
continue;
}
state = CsvSplitState.DATA;
out.append(ch);
continue;
case DATA:
if (Character.isWhitespace(ch)) {
last = out.length();
// depends on control dependency: [if], data = [none]
out.append(ch);
// depends on control dependency: [if], data = [none]
state = CsvSplitState.WHITE;
// depends on control dependency: [if], data = [none]
continue;
}
if (',' == ch) {
list.add(out.toString());
// depends on control dependency: [if], data = [none]
out.setLength(0);
// depends on control dependency: [if], data = [none]
state = CsvSplitState.PRE_DATA;
// depends on control dependency: [if], data = [none]
continue;
}
out.append(ch);
continue;
case WHITE:
if (Character.isWhitespace(ch)) {
out.append(ch);
// depends on control dependency: [if], data = [none]
continue;
}
if (',' == ch) {
out.setLength(last);
// depends on control dependency: [if], data = [none]
list.add(out.toString());
// depends on control dependency: [if], data = [none]
out.setLength(0);
// depends on control dependency: [if], data = [none]
state = CsvSplitState.PRE_DATA;
// depends on control dependency: [if], data = [none]
continue;
}
state = CsvSplitState.DATA;
out.append(ch);
last = -1;
continue;
case QUOTE:
if ('\\' == ch) {
state = CsvSplitState.SLOSH;
// depends on control dependency: [if], data = [none]
continue;
}
if ('"' == ch) {
list.add(out.toString());
// depends on control dependency: [if], data = [none]
out.setLength(0);
// depends on control dependency: [if], data = [none]
state = CsvSplitState.POST_DATA;
// depends on control dependency: [if], data = [none]
continue;
}
out.append(ch);
continue;
case SLOSH:
out.append(ch);
state = CsvSplitState.QUOTE;
continue;
case POST_DATA:
if (',' == ch) {
state = CsvSplitState.PRE_DATA;
// depends on control dependency: [if], data = [none]
}
}
}
switch (state) {
case PRE_DATA:
case POST_DATA:
break;
case DATA:
case QUOTE:
case SLOSH:
list.add(out.toString());
break;
case WHITE:
out.setLength(last);
list.add(out.toString());
break;
}
return list;
} }
|
public class class_name {
private static String buildOverloadParameterString(Class<?>[] parameterTypes) {
StringBuilder name = new StringBuilder();
if (parameterTypes.length == 0) {
name.append("__");
} else {
for (int i = 0; i < parameterTypes.length; i++) {
Class<?> parameterType = parameterTypes[i];
name.append(buildOverloadParameterString(parameterType));
}
}
int index = -1;
while ((index = name.indexOf(".", index)) > -1) {
name.setCharAt(index, '_');
}
return name.toString();
} }
|
public class class_name {
private static String buildOverloadParameterString(Class<?>[] parameterTypes) {
StringBuilder name = new StringBuilder();
if (parameterTypes.length == 0) {
name.append("__"); // depends on control dependency: [if], data = [none]
} else {
for (int i = 0; i < parameterTypes.length; i++) {
Class<?> parameterType = parameterTypes[i];
name.append(buildOverloadParameterString(parameterType)); // depends on control dependency: [for], data = [none]
}
}
int index = -1;
while ((index = name.indexOf(".", index)) > -1) {
name.setCharAt(index, '_'); // depends on control dependency: [while], data = [none]
}
return name.toString();
} }
|
public class class_name {
public EClass getFNMRG() {
if (fnmrgEClass == null) {
fnmrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(408);
}
return fnmrgEClass;
} }
|
public class class_name {
public EClass getFNMRG() {
if (fnmrgEClass == null) {
fnmrgEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(408); // depends on control dependency: [if], data = [none]
}
return fnmrgEClass;
} }
|
public class class_name {
public void marshall(GetVaultLockRequest getVaultLockRequest, ProtocolMarshaller protocolMarshaller) {
if (getVaultLockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getVaultLockRequest.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(getVaultLockRequest.getVaultName(), VAULTNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetVaultLockRequest getVaultLockRequest, ProtocolMarshaller protocolMarshaller) {
if (getVaultLockRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getVaultLockRequest.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getVaultLockRequest.getVaultName(), VAULTNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String getClassPath() {
StringBuilder buf = new StringBuilder();
for (Entry entry : entryList) {
if (buf.length() > 0) {
buf.append(File.pathSeparator);
}
buf.append(entry.getURL());
}
return buf.toString();
} }
|
public class class_name {
public String getClassPath() {
StringBuilder buf = new StringBuilder();
for (Entry entry : entryList) {
if (buf.length() > 0) {
buf.append(File.pathSeparator); // depends on control dependency: [if], data = [none]
}
buf.append(entry.getURL()); // depends on control dependency: [for], data = [entry]
}
return buf.toString();
} }
|
public class class_name {
public static Object toArray(Collection<?> collection, Class<?> componentType) {
if (componentType.isPrimitive()) {
Object array = Array.newInstance(componentType, collection.size());
int index = 0;
for (Object value : collection) {
Array.set(array, index++, value);
}
return array;
}
return collection.toArray((Object[]) Array.newInstance(componentType, collection.size()));
} }
|
public class class_name {
public static Object toArray(Collection<?> collection, Class<?> componentType) {
if (componentType.isPrimitive()) {
Object array = Array.newInstance(componentType, collection.size());
int index = 0;
for (Object value : collection) {
Array.set(array, index++, value); // depends on control dependency: [for], data = [value]
}
return array; // depends on control dependency: [if], data = [none]
}
return collection.toArray((Object[]) Array.newInstance(componentType, collection.size()));
} }
|
public class class_name {
public Optional<JApiClass> getJApiClass() {
if (oldSuperclassOptional.isPresent() && newSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
CtClass newSuperclass = newSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
String newSuperclassName = newSuperclass.getName();
if (oldSuperclassName.equals(newSuperclassName)) {
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.UNCHANGED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.of(newSuperclass), JApiChangeStatus.UNCHANGED, classType);
return Optional.of(jApiClass);
} else {
return Optional.absent();
}
} else if (oldSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.<JApiClassType.ClassType>absent(), JApiChangeStatus.REMOVED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.<CtClass>absent(), JApiChangeStatus.REMOVED, classType);
return Optional.of(jApiClass);
} else if (newSuperclassOptional.isPresent()) {
CtClass newSuperclass = newSuperclassOptional.get();
String newSuperclassName = newSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.<JApiClassType.ClassType>absent(), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.NEW);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, newSuperclassName, Optional.<CtClass>absent(), Optional.of(newSuperclass), JApiChangeStatus.NEW, classType);
return Optional.of(jApiClass);
}
return Optional.absent();
} }
|
public class class_name {
public Optional<JApiClass> getJApiClass() {
if (oldSuperclassOptional.isPresent() && newSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
CtClass newSuperclass = newSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
String newSuperclassName = newSuperclass.getName();
if (oldSuperclassName.equals(newSuperclassName)) {
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.UNCHANGED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.of(newSuperclass), JApiChangeStatus.UNCHANGED, classType);
return Optional.of(jApiClass); // depends on control dependency: [if], data = [none]
} else {
return Optional.absent(); // depends on control dependency: [if], data = [none]
}
} else if (oldSuperclassOptional.isPresent()) {
CtClass oldSuperclass = oldSuperclassOptional.get();
String oldSuperclassName = oldSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.of(ClassHelper.getType(oldSuperclass)), Optional.<JApiClassType.ClassType>absent(), JApiChangeStatus.REMOVED);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, oldSuperclassName, Optional.of(oldSuperclass), Optional.<CtClass>absent(), JApiChangeStatus.REMOVED, classType);
return Optional.of(jApiClass); // depends on control dependency: [if], data = [none]
} else if (newSuperclassOptional.isPresent()) {
CtClass newSuperclass = newSuperclassOptional.get();
String newSuperclassName = newSuperclass.getName();
JApiClassType classType = new JApiClassType(Optional.<JApiClassType.ClassType>absent(), Optional.of(ClassHelper.getType(newSuperclass)), JApiChangeStatus.NEW);
JApiClass jApiClass = new JApiClass(jarArchiveComparator, newSuperclassName, Optional.<CtClass>absent(), Optional.of(newSuperclass), JApiChangeStatus.NEW, classType);
return Optional.of(jApiClass); // depends on control dependency: [if], data = [none]
}
return Optional.absent();
} }
|
public class class_name {
public static String rpad(String base, int len, String pad) {
if (len < 0 || "".equals(pad)) {
return null;
} else if (len == 0) {
return "";
}
char[] data = new char[len];
char[] baseChars = base.toCharArray();
char[] padChars = pad.toCharArray();
int pos = 0;
// copy the base
while (pos < base.length() && pos < len) {
data[pos] = baseChars[pos];
pos += 1;
}
// copy the padding
while (pos < len) {
int i = 0;
while (i < pad.length() && i < len - pos) {
data[pos + i] = padChars[i];
i += 1;
}
pos += pad.length();
}
return new String(data);
} }
|
public class class_name {
public static String rpad(String base, int len, String pad) {
if (len < 0 || "".equals(pad)) {
return null; // depends on control dependency: [if], data = [none]
} else if (len == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
char[] data = new char[len];
char[] baseChars = base.toCharArray();
char[] padChars = pad.toCharArray();
int pos = 0;
// copy the base
while (pos < base.length() && pos < len) {
data[pos] = baseChars[pos]; // depends on control dependency: [while], data = [none]
pos += 1; // depends on control dependency: [while], data = [none]
}
// copy the padding
while (pos < len) {
int i = 0;
while (i < pad.length() && i < len - pos) {
data[pos + i] = padChars[i]; // depends on control dependency: [while], data = [none]
i += 1; // depends on control dependency: [while], data = [none]
}
pos += pad.length(); // depends on control dependency: [while], data = [none]
}
return new String(data);
} }
|
public class class_name {
public void deleteIndex(String indexName, String designDocId, String type) {
assertNotEmpty(indexName, "indexName");
assertNotEmpty(designDocId, "designDocId");
assertNotNull(type, "type");
if (!designDocId.startsWith("_design")) {
designDocId = "_design/" + designDocId;
}
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").path(designDocId)
.path(type).path(indexName).build();
InputStream response = null;
try {
HttpConnection connection = Http.DELETE(uri);
response = client.couchDbClient.executeToInputStream(connection);
getResponse(response, Response.class, client.getGson());
} finally {
close(response);
}
} }
|
public class class_name {
public void deleteIndex(String indexName, String designDocId, String type) {
assertNotEmpty(indexName, "indexName");
assertNotEmpty(designDocId, "designDocId");
assertNotNull(type, "type");
if (!designDocId.startsWith("_design")) {
designDocId = "_design/" + designDocId; // depends on control dependency: [if], data = [none]
}
URI uri = new DatabaseURIHelper(db.getDBUri()).path("_index").path(designDocId)
.path(type).path(indexName).build();
InputStream response = null;
try {
HttpConnection connection = Http.DELETE(uri);
response = client.couchDbClient.executeToInputStream(connection); // depends on control dependency: [try], data = [none]
getResponse(response, Response.class, client.getGson()); // depends on control dependency: [try], data = [none]
} finally {
close(response);
}
} }
|
public class class_name {
Invoice earliest(final SortedSet<Invoice> unpaidInvoices) {
try {
return unpaidInvoices.first();
} catch (NoSuchElementException e) {
return null;
}
} }
|
public class class_name {
Invoice earliest(final SortedSet<Invoice> unpaidInvoices) {
try {
return unpaidInvoices.first(); // depends on control dependency: [try], data = [none]
} catch (NoSuchElementException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static long[] andI(long[] v, long[] o, int off) {
if(off == 0) {
return andI(v, o);
}
// Break shift into integers to shift and bits to shift
final int shiftWords = off >> LONG_LOG2_SIZE;
final int shiftBits = off & LONG_LOG2_MASK;
if(shiftWords >= v.length) {
return v;
}
// Simple case - multiple of word size
if(shiftBits == 0) {
int i = Math.min(v.length, o.length + shiftWords), j = i - shiftWords;
while(i > 0 && j > 0) {
v[--i] &= o[--j];
}
// Clear bottom words
if(shiftWords > 0) {
Arrays.fill(v, 0, shiftWords, 0);
}
return v;
}
// Overlapping case
final int unshiftBits = Long.SIZE - shiftBits;
int i = Math.min(v.length, o.length + shiftWords), j = i - shiftWords;
long t = o[--j];
if(i < v.length) { // partial word of negative shift
v[i] &= t >>> unshiftBits;
}
while(i > 0 && j > 0) {
v[--i] &= (t << shiftBits) | ((t = o[--j]) >>> unshiftBits);
}
if(i > 0) { // partial word of positive shift
v[--i] &= t << shiftBits;
}
// Clear bottom words
Arrays.fill(v, 0, shiftWords, 0);
return v;
} }
|
public class class_name {
public static long[] andI(long[] v, long[] o, int off) {
if(off == 0) {
return andI(v, o); // depends on control dependency: [if], data = [none]
}
// Break shift into integers to shift and bits to shift
final int shiftWords = off >> LONG_LOG2_SIZE;
final int shiftBits = off & LONG_LOG2_MASK;
if(shiftWords >= v.length) {
return v; // depends on control dependency: [if], data = [none]
}
// Simple case - multiple of word size
if(shiftBits == 0) {
int i = Math.min(v.length, o.length + shiftWords), j = i - shiftWords;
while(i > 0 && j > 0) {
v[--i] &= o[--j]; // depends on control dependency: [while], data = [none]
}
// Clear bottom words
if(shiftWords > 0) {
Arrays.fill(v, 0, shiftWords, 0); // depends on control dependency: [if], data = [0)]
}
return v; // depends on control dependency: [if], data = [none]
}
// Overlapping case
final int unshiftBits = Long.SIZE - shiftBits;
int i = Math.min(v.length, o.length + shiftWords), j = i - shiftWords;
long t = o[--j];
if(i < v.length) { // partial word of negative shift
v[i] &= t >>> unshiftBits; // depends on control dependency: [if], data = [none]
}
while(i > 0 && j > 0) {
v[--i] &= (t << shiftBits) | ((t = o[--j]) >>> unshiftBits); // depends on control dependency: [while], data = [none]
}
if(i > 0) { // partial word of positive shift
v[--i] &= t << shiftBits; // depends on control dependency: [if], data = [none]
}
// Clear bottom words
Arrays.fill(v, 0, shiftWords, 0);
return v;
} }
|
public class class_name {
public static String getAlgorithm(final URI digestUri) {
if (digestUri == null) {
return DEFAULT_ALGORITHM;
}
return DIGEST_ALGORITHM.fromScheme(digestUri.getScheme() + ":" +
digestUri.getSchemeSpecificPart().split(":", 2)[0]).algorithm;
} }
|
public class class_name {
public static String getAlgorithm(final URI digestUri) {
if (digestUri == null) {
return DEFAULT_ALGORITHM; // depends on control dependency: [if], data = [none]
}
return DIGEST_ALGORITHM.fromScheme(digestUri.getScheme() + ":" +
digestUri.getSchemeSpecificPart().split(":", 2)[0]).algorithm;
} }
|
public class class_name {
void setPidToJvm(JVMId jvmId, String pid) {
if (jvmId.isMapJVM()) {
mapJvmManager.jvmIdToPid.put(jvmId, pid);
}
else {
reduceJvmManager.jvmIdToPid.put(jvmId, pid);
}
} }
|
public class class_name {
void setPidToJvm(JVMId jvmId, String pid) {
if (jvmId.isMapJVM()) {
mapJvmManager.jvmIdToPid.put(jvmId, pid); // depends on control dependency: [if], data = [none]
}
else {
reduceJvmManager.jvmIdToPid.put(jvmId, pid); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private ITag createFileMeta() {
// Create tag for onMetaData event
IoBuffer buf = IoBuffer.allocate(192);
buf.setAutoExpand(true);
Output out = new Output(buf);
// Duration property
out.writeString("onMetaData");
Map<Object, Object> props = new HashMap<Object, Object>();
props.put("duration", duration / 1000.0);
if (firstVideoTag != -1) {
long old = getCurrentPosition();
setCurrentPosition(firstVideoTag);
try {
readTagHeader();
fillBuffer(1);
int codecId = in.get() & MASK_VIDEO_CODEC;
// Video codec id
props.put("videocodecid", codecId);
} catch (UnsupportedDataTypeException e) {
log.warn("createFileMeta for video", e);
}
setCurrentPosition(old);
}
if (firstAudioTag != -1) {
long old = getCurrentPosition();
setCurrentPosition(firstAudioTag);
try {
readTagHeader();
fillBuffer(1);
int codecId = (in.get() & MASK_SOUND_FORMAT) >> 4;
// Audio codec id
props.put("audiocodecid", codecId);
} catch (UnsupportedDataTypeException e) {
log.warn("createFileMeta for audio", e);
}
setCurrentPosition(old);
}
props.put("canSeekToEnd", true);
out.writeMap(props);
buf.flip();
ITag result = new Tag(IoConstants.TYPE_METADATA, 0, buf.limit(), null, 0);
result.setBody(buf);
out = null;
return result;
} }
|
public class class_name {
private ITag createFileMeta() {
// Create tag for onMetaData event
IoBuffer buf = IoBuffer.allocate(192);
buf.setAutoExpand(true);
Output out = new Output(buf);
// Duration property
out.writeString("onMetaData");
Map<Object, Object> props = new HashMap<Object, Object>();
props.put("duration", duration / 1000.0);
if (firstVideoTag != -1) {
long old = getCurrentPosition();
setCurrentPosition(firstVideoTag); // depends on control dependency: [if], data = [(firstVideoTag]
try {
readTagHeader(); // depends on control dependency: [try], data = [none]
fillBuffer(1); // depends on control dependency: [try], data = [none]
int codecId = in.get() & MASK_VIDEO_CODEC;
// Video codec id
props.put("videocodecid", codecId); // depends on control dependency: [try], data = [none]
} catch (UnsupportedDataTypeException e) {
log.warn("createFileMeta for video", e);
} // depends on control dependency: [catch], data = [none]
setCurrentPosition(old); // depends on control dependency: [if], data = [none]
}
if (firstAudioTag != -1) {
long old = getCurrentPosition();
setCurrentPosition(firstAudioTag); // depends on control dependency: [if], data = [(firstAudioTag]
try {
readTagHeader(); // depends on control dependency: [try], data = [none]
fillBuffer(1); // depends on control dependency: [try], data = [none]
int codecId = (in.get() & MASK_SOUND_FORMAT) >> 4;
// Audio codec id
props.put("audiocodecid", codecId); // depends on control dependency: [try], data = [none]
} catch (UnsupportedDataTypeException e) {
log.warn("createFileMeta for audio", e);
} // depends on control dependency: [catch], data = [none]
setCurrentPosition(old); // depends on control dependency: [if], data = [none]
}
props.put("canSeekToEnd", true);
out.writeMap(props);
buf.flip();
ITag result = new Tag(IoConstants.TYPE_METADATA, 0, buf.limit(), null, 0);
result.setBody(buf);
out = null;
return result;
} }
|
public class class_name {
@Override
public String getColumnName(int column) {
try {
return metadata.getColumnLabel(column + 1);
} catch (SQLException e) {
e.printStackTrace(System.err);
return e.toString();
}
} }
|
public class class_name {
@Override
public String getColumnName(int column) {
try {
return metadata.getColumnLabel(column + 1); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
e.printStackTrace(System.err);
return e.toString();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final void qualifiedNameList() throws RecognitionException {
int qualifiedNameList_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 55) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:5: ( qualifiedName ( ',' qualifiedName )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:7: qualifiedName ( ',' qualifiedName )*
{
pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList2001);
qualifiedName();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:21: ( ',' qualifiedName )*
loop77:
while (true) {
int alt77=2;
int LA77_0 = input.LA(1);
if ( (LA77_0==43) ) {
alt77=1;
}
switch (alt77) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:22: ',' qualifiedName
{
match(input,43,FOLLOW_43_in_qualifiedNameList2004); if (state.failed) return;
pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList2006);
qualifiedName();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop77;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 55, qualifiedNameList_StartIndex); }
}
} }
|
public class class_name {
public final void qualifiedNameList() throws RecognitionException {
int qualifiedNameList_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 55) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:5: ( qualifiedName ( ',' qualifiedName )* )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:7: qualifiedName ( ',' qualifiedName )*
{
pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList2001);
qualifiedName();
state._fsp--;
if (state.failed) return;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:21: ( ',' qualifiedName )*
loop77:
while (true) {
int alt77=2;
int LA77_0 = input.LA(1);
if ( (LA77_0==43) ) {
alt77=1; // depends on control dependency: [if], data = [none]
}
switch (alt77) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:562:22: ',' qualifiedName
{
match(input,43,FOLLOW_43_in_qualifiedNameList2004); if (state.failed) return;
pushFollow(FOLLOW_qualifiedName_in_qualifiedNameList2006);
qualifiedName();
state._fsp--;
if (state.failed) return;
}
break;
default :
break loop77;
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 55, qualifiedNameList_StartIndex); } // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ResolvableType as(Class<?> type) {
if (this == NONE) {
return NONE;
}
if (ObjectUtils.nullSafeEquals(resolve(), type)) {
return this;
}
for (ResolvableType interfaceType : getInterfaces()) {
ResolvableType interfaceAsType = interfaceType.as(type);
if (interfaceAsType != NONE) {
return interfaceAsType;
}
}
return getSuperType().as(type);
} }
|
public class class_name {
public ResolvableType as(Class<?> type) {
if (this == NONE) {
return NONE; // depends on control dependency: [if], data = [none]
}
if (ObjectUtils.nullSafeEquals(resolve(), type)) {
return this; // depends on control dependency: [if], data = [none]
}
for (ResolvableType interfaceType : getInterfaces()) {
ResolvableType interfaceAsType = interfaceType.as(type);
if (interfaceAsType != NONE) {
return interfaceAsType; // depends on control dependency: [if], data = [none]
}
}
return getSuperType().as(type);
} }
|
public class class_name {
public static WebDriver createDriver(String browserType, String url, String size) {
if (browserType == null) {
browserType = GalenConfig.getConfig().getDefaultBrowser();
}
SeleniumBrowser browser = (SeleniumBrowser) new SeleniumBrowserFactory(browserType).openBrowser();
if (url != null && !url.trim().isEmpty()) {
browser.load(url);
}
if (size != null && !size.trim().isEmpty()) {
browser.changeWindowSize(GalenUtils.readSize(size));
}
return browser.getDriver();
} }
|
public class class_name {
public static WebDriver createDriver(String browserType, String url, String size) {
if (browserType == null) {
browserType = GalenConfig.getConfig().getDefaultBrowser(); // depends on control dependency: [if], data = [none]
}
SeleniumBrowser browser = (SeleniumBrowser) new SeleniumBrowserFactory(browserType).openBrowser();
if (url != null && !url.trim().isEmpty()) {
browser.load(url); // depends on control dependency: [if], data = [(url]
}
if (size != null && !size.trim().isEmpty()) {
browser.changeWindowSize(GalenUtils.readSize(size)); // depends on control dependency: [if], data = [(size]
}
return browser.getDriver();
} }
|
public class class_name {
public IdentityDkimAttributes withDkimTokens(String... dkimTokens) {
if (this.dkimTokens == null) {
setDkimTokens(new com.amazonaws.internal.SdkInternalList<String>(dkimTokens.length));
}
for (String ele : dkimTokens) {
this.dkimTokens.add(ele);
}
return this;
} }
|
public class class_name {
public IdentityDkimAttributes withDkimTokens(String... dkimTokens) {
if (this.dkimTokens == null) {
setDkimTokens(new com.amazonaws.internal.SdkInternalList<String>(dkimTokens.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : dkimTokens) {
this.dkimTokens.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private void registerLocalDirectives(Component annotation, MethodSpec.Builder initBuilder) {
try {
Class<?>[] componentsClass = annotation.directives();
if (componentsClass.length > 0) {
addGetDirectivesStatement(initBuilder);
}
Stream
.of(componentsClass)
.forEach(clazz -> initBuilder.addStatement("directives.set($S, new $T())",
directiveToTagName(clazz.getName()),
directiveOptionsName(clazz)));
} catch (MirroredTypesException mte) {
List<DeclaredType> classTypeMirrors = (List<DeclaredType>) mte.getTypeMirrors();
if (!classTypeMirrors.isEmpty()) {
addGetDirectivesStatement(initBuilder);
}
classTypeMirrors.forEach(classTypeMirror -> {
TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement();
initBuilder.addStatement("directives.set($S, new $T())",
directiveToTagName(classTypeElement.getSimpleName().toString()),
directiveOptionsName(classTypeElement));
});
}
} }
|
public class class_name {
private void registerLocalDirectives(Component annotation, MethodSpec.Builder initBuilder) {
try {
Class<?>[] componentsClass = annotation.directives();
if (componentsClass.length > 0) {
addGetDirectivesStatement(initBuilder); // depends on control dependency: [if], data = [none]
}
Stream
.of(componentsClass)
.forEach(clazz -> initBuilder.addStatement("directives.set($S, new $T())",
directiveToTagName(clazz.getName()),
directiveOptionsName(clazz))); // depends on control dependency: [try], data = [none]
} catch (MirroredTypesException mte) {
List<DeclaredType> classTypeMirrors = (List<DeclaredType>) mte.getTypeMirrors();
if (!classTypeMirrors.isEmpty()) {
addGetDirectivesStatement(initBuilder); // depends on control dependency: [if], data = [none]
}
classTypeMirrors.forEach(classTypeMirror -> {
TypeElement classTypeElement = (TypeElement) classTypeMirror.asElement();
initBuilder.addStatement("directives.set($S, new $T())",
directiveToTagName(classTypeElement.getSimpleName().toString()),
directiveOptionsName(classTypeElement));
}); // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
private void addJavaFXPropertyToClass(SourceUnit source, AnnotationNode node, ClassNode classNode) {
for (PropertyNode propertyNode : classNode.getProperties()) {
FieldNode field = propertyNode.getField();
// look to see if per-field handlers will catch this one...
if (hasFXBindableAnnotation(field)
|| ((field.getModifiers() & Modifier.FINAL) != 0)
|| field.isStatic()) {
// explicitly labeled properties are already handled,
// don't transform final properties
// don't transform static properties
continue;
}
createPropertyGetterSetter(classNode, propertyNode);
}
} }
|
public class class_name {
private void addJavaFXPropertyToClass(SourceUnit source, AnnotationNode node, ClassNode classNode) {
for (PropertyNode propertyNode : classNode.getProperties()) {
FieldNode field = propertyNode.getField();
// look to see if per-field handlers will catch this one...
if (hasFXBindableAnnotation(field)
|| ((field.getModifiers() & Modifier.FINAL) != 0)
|| field.isStatic()) {
// explicitly labeled properties are already handled,
// don't transform final properties
// don't transform static properties
continue;
}
createPropertyGetterSetter(classNode, propertyNode); // depends on control dependency: [for], data = [propertyNode]
}
} }
|
public class class_name {
public static void denoise(double[] t, Wavelet wavelet, boolean soft) {
wavelet.transform(t);
int n = t.length;
int nh = t.length >> 1;
double[] wc = new double[nh];
System.arraycopy(t, nh, wc, 0, nh);
double error = Math.mad(wc) / 0.6745;
double lambda = error * Math.sqrt(2 * Math.log(n));
if (soft) {
for (int i = 2; i < n; i++) {
t[i] = Math.signum(t[i]) * Math.max(Math.abs(t[i]) - lambda, 0.0);
}
} else {
for (int i = 2; i < n; i++) {
if (Math.abs(t[i]) < lambda) {
t[i] = 0.0;
}
}
}
wavelet.inverse(t);
} }
|
public class class_name {
public static void denoise(double[] t, Wavelet wavelet, boolean soft) {
wavelet.transform(t);
int n = t.length;
int nh = t.length >> 1;
double[] wc = new double[nh];
System.arraycopy(t, nh, wc, 0, nh);
double error = Math.mad(wc) / 0.6745;
double lambda = error * Math.sqrt(2 * Math.log(n));
if (soft) {
for (int i = 2; i < n; i++) {
t[i] = Math.signum(t[i]) * Math.max(Math.abs(t[i]) - lambda, 0.0); // depends on control dependency: [for], data = [i]
}
} else {
for (int i = 2; i < n; i++) {
if (Math.abs(t[i]) < lambda) {
t[i] = 0.0; // depends on control dependency: [if], data = [none]
}
}
}
wavelet.inverse(t);
} }
|
public class class_name {
public void setCategoryList(java.util.Collection<Category> categoryList) {
if (categoryList == null) {
this.categoryList = null;
return;
}
this.categoryList = new java.util.ArrayList<Category>(categoryList);
} }
|
public class class_name {
public void setCategoryList(java.util.Collection<Category> categoryList) {
if (categoryList == null) {
this.categoryList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.categoryList = new java.util.ArrayList<Category>(categoryList);
} }
|
public class class_name {
private static boolean printLogInfo(int obj) {
IntBuffer iVal = BufferUtils.createIntBuffer(1);
ARBShaderObjects.glGetObjectParameterARB(obj,
ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal);
int length = iVal.get();
if (length > 1) {
// We have some info we need to output.
ByteBuffer infoLog = BufferUtils.createByteBuffer(length);
iVal.flip();
ARBShaderObjects.glGetInfoLogARB(obj, iVal, infoLog);
byte[] infoBytes = new byte[length];
infoLog.get(infoBytes);
String out = new String(infoBytes);
System.out.println("Info log:\n" + out);
} else {
return true;
}
return false;
} }
|
public class class_name {
private static boolean printLogInfo(int obj) {
IntBuffer iVal = BufferUtils.createIntBuffer(1);
ARBShaderObjects.glGetObjectParameterARB(obj,
ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, iVal);
int length = iVal.get();
if (length > 1) {
// We have some info we need to output.
ByteBuffer infoLog = BufferUtils.createByteBuffer(length);
iVal.flip(); // depends on control dependency: [if], data = [none]
ARBShaderObjects.glGetInfoLogARB(obj, iVal, infoLog); // depends on control dependency: [if], data = [none]
byte[] infoBytes = new byte[length];
infoLog.get(infoBytes); // depends on control dependency: [if], data = [none]
String out = new String(infoBytes);
System.out.println("Info log:\n" + out); // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public String[] getFileSuffixes() {
String[] suffixes = filterEmptyStrings(settings.getStringArray(GroovyPlugin.FILE_SUFFIXES_KEY));
if (suffixes.length == 0) {
suffixes = StringUtils.split(GroovyPlugin.DEFAULT_FILE_SUFFIXES, ",");
}
return addDot(suffixes);
} }
|
public class class_name {
@Override
public String[] getFileSuffixes() {
String[] suffixes = filterEmptyStrings(settings.getStringArray(GroovyPlugin.FILE_SUFFIXES_KEY));
if (suffixes.length == 0) {
suffixes = StringUtils.split(GroovyPlugin.DEFAULT_FILE_SUFFIXES, ","); // depends on control dependency: [if], data = [none]
}
return addDot(suffixes);
} }
|
public class class_name {
private static void initSignCert() {
if(!"01".equals(SDKConfig.getConfig().getSignMethod())){
LogUtil.writeLog("非rsa签名方式,不加载签名证书。");
return;
}
if (SDKConfig.getConfig().getSignCertPath() == null
|| SDKConfig.getConfig().getSignCertPwd() == null
|| SDKConfig.getConfig().getSignCertType() == null) {
LogUtil.writeErrorLog("WARN: " + SDKConfig.SDK_SIGNCERT_PATH + "或" + SDKConfig.SDK_SIGNCERT_PWD
+ "或" + SDKConfig.SDK_SIGNCERT_TYPE + "为空。 停止加载签名证书。");
return;
}
if (null != keyStore) {
keyStore = null;
}
try {
keyStore = getKeyInfo(SDKConfig.getConfig().getSignCertPath(),
SDKConfig.getConfig().getSignCertPwd(), SDKConfig
.getConfig().getSignCertType());
LogUtil.writeLog("InitSignCert Successful. CertId=["
+ getSignCertId() + "]");
} catch (IOException e) {
LogUtil.writeErrorLog("InitSignCert Error", e);
}
} }
|
public class class_name {
private static void initSignCert() {
if(!"01".equals(SDKConfig.getConfig().getSignMethod())){
LogUtil.writeLog("非rsa签名方式,不加载签名证书。"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (SDKConfig.getConfig().getSignCertPath() == null
|| SDKConfig.getConfig().getSignCertPwd() == null
|| SDKConfig.getConfig().getSignCertType() == null) {
LogUtil.writeErrorLog("WARN: " + SDKConfig.SDK_SIGNCERT_PATH + "或" + SDKConfig.SDK_SIGNCERT_PWD
+ "或" + SDKConfig.SDK_SIGNCERT_TYPE + "为空。 停止加载签名证书。"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (null != keyStore) {
keyStore = null; // depends on control dependency: [if], data = [none]
}
try {
keyStore = getKeyInfo(SDKConfig.getConfig().getSignCertPath(),
SDKConfig.getConfig().getSignCertPwd(), SDKConfig
.getConfig().getSignCertType()); // depends on control dependency: [try], data = [none]
LogUtil.writeLog("InitSignCert Successful. CertId=["
+ getSignCertId() + "]"); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LogUtil.writeErrorLog("InitSignCert Error", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponse<CertificatePolicy>> updateCertificatePolicyWithServiceResponseAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (certificateName == null) {
throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
}
if (certificatePolicy == null) {
throw new IllegalArgumentException("Parameter certificatePolicy is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
Validator.validate(certificatePolicy);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.updateCertificatePolicy(certificateName, certificatePolicy, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificatePolicy>>>() {
@Override
public Observable<ServiceResponse<CertificatePolicy>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CertificatePolicy> clientResponse = updateCertificatePolicyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<CertificatePolicy>> updateCertificatePolicyWithServiceResponseAsync(String vaultBaseUrl, String certificateName, CertificatePolicy certificatePolicy) {
if (vaultBaseUrl == null) {
throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
}
if (certificateName == null) {
throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
}
if (certificatePolicy == null) {
throw new IllegalArgumentException("Parameter certificatePolicy is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
Validator.validate(certificatePolicy);
String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
return service.updateCertificatePolicy(certificateName, certificatePolicy, this.apiVersion(), this.acceptLanguage(), parameterizedHost, this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificatePolicy>>>() {
@Override
public Observable<ServiceResponse<CertificatePolicy>> call(Response<ResponseBody> response) {
try {
ServiceResponse<CertificatePolicy> clientResponse = updateCertificatePolicyDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public boolean isModified()
{
gatekeeper.signIn();
try
{
for (ChangeStack<String> stack : properties.values())
{
if (stack.isModified())
{
return true;
}
}
return false;
}
finally
{
gatekeeper.signOut();
}
} }
|
public class class_name {
public boolean isModified()
{
gatekeeper.signIn();
try
{
for (ChangeStack<String> stack : properties.values())
{
if (stack.isModified())
{
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [try], data = [none]
}
finally
{
gatekeeper.signOut();
}
} }
|
public class class_name {
protected void removeStartedApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
appStates.remove(appName);
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
protected void removeStartedApplication(ServiceReference<Application> ref) {
String appName = (String) ref.getProperty(NAME);
lock.writeLock().lock();
try {
appStates.remove(appName); // depends on control dependency: [try], data = [none]
} finally {
lock.writeLock().unlock();
}
} }
|
public class class_name {
public void bind(ActivityContextInterface aci, String aciName)
throws NullPointerException, IllegalArgumentException,
TransactionRequiredLocalException, NameAlreadyBoundException,
FacilityException {
// Check if we are in the context of a transaction.
sleeContainer.getTransactionManager().mandateTransaction();
if (aciName == null)
throw new NullPointerException("null aci name");
else if (aciName.equals(""))
throw new IllegalArgumentException("empty name");
else if (aci == null )
throw new NullPointerException ("Null ACI! ");
try {
org.mobicents.slee.container.activity.ActivityContextInterface sleeAci = (org.mobicents.slee.container.activity.ActivityContextInterface)aci;
ActivityContext ac = sleeAci.getActivityContext();
ActivityContextHandle ach = ac.getActivityContextHandle();
cacheData.bindName(ach,aciName);
ac.addNameBinding(aciName);
if (log.isDebugEnabled()) {
log.debug("aci name "+aciName+" bound to "+ach+" . Tx is "+sleeContainer.getTransactionManager().getTransaction());
}
} catch (NameAlreadyBoundException ex) {
if (log.isDebugEnabled()) {
log.debug("name already bound " + aciName);
}
throw ex;
} catch (Exception e) {
throw new FacilityException("Failed to put ac name binding in cache", e);
}
} }
|
public class class_name {
public void bind(ActivityContextInterface aci, String aciName)
throws NullPointerException, IllegalArgumentException,
TransactionRequiredLocalException, NameAlreadyBoundException,
FacilityException {
// Check if we are in the context of a transaction.
sleeContainer.getTransactionManager().mandateTransaction();
if (aciName == null)
throw new NullPointerException("null aci name");
else if (aciName.equals(""))
throw new IllegalArgumentException("empty name");
else if (aci == null )
throw new NullPointerException ("Null ACI! ");
try {
org.mobicents.slee.container.activity.ActivityContextInterface sleeAci = (org.mobicents.slee.container.activity.ActivityContextInterface)aci;
ActivityContext ac = sleeAci.getActivityContext();
ActivityContextHandle ach = ac.getActivityContextHandle();
cacheData.bindName(ach,aciName);
ac.addNameBinding(aciName);
if (log.isDebugEnabled()) {
log.debug("aci name "+aciName+" bound to "+ach+" . Tx is "+sleeContainer.getTransactionManager().getTransaction()); // depends on control dependency: [if], data = [none]
}
} catch (NameAlreadyBoundException ex) {
if (log.isDebugEnabled()) {
log.debug("name already bound " + aciName); // depends on control dependency: [if], data = [none]
}
throw ex;
} catch (Exception e) {
throw new FacilityException("Failed to put ac name binding in cache", e);
}
} }
|
public class class_name {
public void drawToImageWithAreas(String path, String areaNames)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage());
showAreas(disp, getAreaTree().getRoot(), areaNames);
disp.saveTo(path);
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
}
} }
|
public class class_name {
public void drawToImageWithAreas(String path, String areaNames)
{
try
{
ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight());
disp.drawPage(getPage()); // depends on control dependency: [try], data = [none]
showAreas(disp, getAreaTree().getRoot(), areaNames); // depends on control dependency: [try], data = [none]
disp.saveTo(path); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.error("Couldn't write to " + path + ": " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private final void consumeNonPersistentMessages(java.util.ArrayList consumeList)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "consumeNonPersistentMessages", consumeList);
// use a local transaction to consume all these messages
LocalTransaction tran = parent.getLocalTransaction();
try
{
Transaction msTran = parent.getMessageProcessor().resolveAndEnlistMsgStoreTransaction(tran);
int length = consumeList.size();
for (int i = 0; i < length; i++)
{
AOValue value = (AOValue) consumeList.get(i);
dem.removeTimeoutEntry(value);
SIMPMessage msgItem = consumerDispatcher.getMessageByValue(value);
// PK67067 We may not find a message in the store for this tick, because
// it may have been removed using the SIBQueuePoint MBean
if (msgItem != null) msgItem.remove(msTran, msgItem.getLockID());
}
tran.commit();
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.consumeNonPersistentMessages",
"1:2792:1.80.3.24",
this);
SibTr.exception(tc, e);
// No matter what happens above we try to commit the transaction as we're simply
// trying to get rid of these messages and there's no point keeping them in
// the case of a failure
try
{
tran.commit();
}
catch (SIException e2)
{
// No FFDC code needed
// We really don't care about a problem in this commit
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "commit failed " + e2);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeNonPersistentMessages");
} }
|
public class class_name {
private final void consumeNonPersistentMessages(java.util.ArrayList consumeList)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "consumeNonPersistentMessages", consumeList);
// use a local transaction to consume all these messages
LocalTransaction tran = parent.getLocalTransaction();
try
{
Transaction msTran = parent.getMessageProcessor().resolveAndEnlistMsgStoreTransaction(tran);
int length = consumeList.size();
for (int i = 0; i < length; i++)
{
AOValue value = (AOValue) consumeList.get(i);
dem.removeTimeoutEntry(value); // depends on control dependency: [for], data = [none]
SIMPMessage msgItem = consumerDispatcher.getMessageByValue(value);
// PK67067 We may not find a message in the store for this tick, because
// it may have been removed using the SIBQueuePoint MBean
if (msgItem != null) msgItem.remove(msTran, msgItem.getLockID());
}
tran.commit(); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.consumeNonPersistentMessages",
"1:2792:1.80.3.24",
this);
SibTr.exception(tc, e);
// No matter what happens above we try to commit the transaction as we're simply
// trying to get rid of these messages and there's no point keeping them in
// the case of a failure
try
{
tran.commit(); // depends on control dependency: [try], data = [none]
}
catch (SIException e2)
{
// No FFDC code needed
// We really don't care about a problem in this commit
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "commit failed " + e2);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "consumeNonPersistentMessages");
} }
|
public class class_name {
public synchronized BigDecimal getBigDecimal(int parameterIndex,
int scale) throws SQLException {
if (scale < 0) {
throw Util.outOfRangeArgument();
}
// boucherb@users 20020502 - added conversion
BigDecimal bd = (BigDecimal) getColumnInType(parameterIndex,
Type.SQL_DECIMAL);
if (bd != null) {
bd = bd.setScale(scale, BigDecimal.ROUND_DOWN);
}
return bd;
} }
|
public class class_name {
public synchronized BigDecimal getBigDecimal(int parameterIndex,
int scale) throws SQLException {
if (scale < 0) {
throw Util.outOfRangeArgument();
}
// boucherb@users 20020502 - added conversion
BigDecimal bd = (BigDecimal) getColumnInType(parameterIndex,
Type.SQL_DECIMAL);
if (bd != null) {
bd = bd.setScale(scale, BigDecimal.ROUND_DOWN); // depends on control dependency: [if], data = [none]
}
return bd;
} }
|
public class class_name {
public void marshall(FleetError fleetError, ProtocolMarshaller protocolMarshaller) {
if (fleetError == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(fleetError.getErrorCode(), ERRORCODE_BINDING);
protocolMarshaller.marshall(fleetError.getErrorMessage(), ERRORMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(FleetError fleetError, ProtocolMarshaller protocolMarshaller) {
if (fleetError == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(fleetError.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fleetError.getErrorMessage(), ERRORMESSAGE_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 SimpleDialog messageTextColor(int color){
if(mMessageTextColor != color){
mMessageTextColor = color;
if(mMessage != null)
mMessage.setTextColor(color);
}
return this;
} }
|
public class class_name {
public SimpleDialog messageTextColor(int color){
if(mMessageTextColor != color){
mMessageTextColor = color; // depends on control dependency: [if], data = [none]
if(mMessage != null)
mMessage.setTextColor(color);
}
return this;
} }
|
public class class_name {
protected long determineBalance(final IntervalTreeNode node) {
if (node == null) {
return 0L;
}
return (node.hasLeft() ? node.getLeft().getHeight() : 0) -
(node.hasRight() ? node.getRight().getHeight() : 0);
} }
|
public class class_name {
protected long determineBalance(final IntervalTreeNode node) {
if (node == null) {
return 0L; // depends on control dependency: [if], data = [none]
}
return (node.hasLeft() ? node.getLeft().getHeight() : 0) -
(node.hasRight() ? node.getRight().getHeight() : 0);
} }
|
public class class_name {
public static WebOperation getOperationByName(final String name) throws WebOperationNotFoundException{
if(!cache.containsKey(name)){
WebOperation wo = null;
Map<String,Object> cls = Objects.find((List<Map<String,Object>>)Options.getStorage().getSystem(List.class,"webOperations", new ArrayList()),new Closure<Map<String, Object>, Boolean>() {
@Override
public Boolean call(Map<String, Object> input) {
return name.equals(Objects.get(input, "name"));
}
});
if(!Objects.isNullOrEmpty(cls)){
try{
wo = (WebOperation)Class.forName(Objects.get(String.class,cls,"class")).newInstance();
wo.setConfig(Objects.get(cls, "config", Objects.newHashMap(String.class, Object.class)));
}catch (Exception e){
throw new WebOperationNotFoundException("Cannot initialize WebOperation ("+cls+"): "+e.getMessage(),e);
}
}
if(wo == null)
throw new WebOperationNotFoundException("WebOperation "+name+" not found");
cache.put(name,wo);
}
return cache.get(name);
} }
|
public class class_name {
public static WebOperation getOperationByName(final String name) throws WebOperationNotFoundException{
if(!cache.containsKey(name)){
WebOperation wo = null;
Map<String,Object> cls = Objects.find((List<Map<String,Object>>)Options.getStorage().getSystem(List.class,"webOperations", new ArrayList()),new Closure<Map<String, Object>, Boolean>() {
@Override
public Boolean call(Map<String, Object> input) {
return name.equals(Objects.get(input, "name"));
}
});
if(!Objects.isNullOrEmpty(cls)){
try{
wo = (WebOperation)Class.forName(Objects.get(String.class,cls,"class")).newInstance(); // depends on control dependency: [try], data = [none]
wo.setConfig(Objects.get(cls, "config", Objects.newHashMap(String.class, Object.class))); // depends on control dependency: [try], data = [none]
}catch (Exception e){
throw new WebOperationNotFoundException("Cannot initialize WebOperation ("+cls+"): "+e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
}
if(wo == null)
throw new WebOperationNotFoundException("WebOperation "+name+" not found");
cache.put(name,wo);
}
return cache.get(name);
} }
|
public class class_name {
public void reset() {
endRange = set.getRangeCount() - 1;
range = 0;
endElement = -1;
nextElement = 0;
if (endRange >= 0) {
loadRange(range);
}
stringIterator = null;
if (set.strings != null) {
stringIterator = set.strings.iterator();
if (!stringIterator.hasNext()) {
stringIterator = null;
}
}
} }
|
public class class_name {
public void reset() {
endRange = set.getRangeCount() - 1;
range = 0;
endElement = -1;
nextElement = 0;
if (endRange >= 0) {
loadRange(range); // depends on control dependency: [if], data = [none]
}
stringIterator = null;
if (set.strings != null) {
stringIterator = set.strings.iterator(); // depends on control dependency: [if], data = [none]
if (!stringIterator.hasNext()) {
stringIterator = null; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public java.util.List<VpcEndpoint> getVpcEndpoints() {
if (vpcEndpoints == null) {
vpcEndpoints = new com.amazonaws.internal.SdkInternalList<VpcEndpoint>();
}
return vpcEndpoints;
} }
|
public class class_name {
public java.util.List<VpcEndpoint> getVpcEndpoints() {
if (vpcEndpoints == null) {
vpcEndpoints = new com.amazonaws.internal.SdkInternalList<VpcEndpoint>(); // depends on control dependency: [if], data = [none]
}
return vpcEndpoints;
} }
|
public class class_name {
public void addArtifact(final Artifact artifact) {
if (!artifacts.contains(artifact)) {
if (promoted) {
artifact.setPromoted(promoted);
}
artifacts.add(artifact);
}
} }
|
public class class_name {
public void addArtifact(final Artifact artifact) {
if (!artifacts.contains(artifact)) {
if (promoted) {
artifact.setPromoted(promoted); // depends on control dependency: [if], data = [(promoted)]
}
artifacts.add(artifact); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static OggAudioStreamHeaders create(OggPacket firstPacket) {
if (firstPacket.isBeginningOfStream() &&
firstPacket.getData() != null &&
firstPacket.getData().length > 10) {
int sid = firstPacket.getSid();
if (VorbisPacketFactory.isVorbisStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OGG_VORBIS,
(VorbisInfo)VorbisPacketFactory.create(firstPacket));
}
if (SpeexPacketFactory.isSpeexStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.SPEEX_AUDIO,
(SpeexInfo)SpeexPacketFactory.create(firstPacket));
}
if (OpusPacketFactory.isOpusStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OPUS_AUDIO,
(OpusInfo)OpusPacketFactory.create(firstPacket));
}
if (FlacFirstOggPacket.isFlacStream(firstPacket)) {
FlacFirstOggPacket flac = new FlacFirstOggPacket(firstPacket);
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OGG_FLAC,
flac.getInfo());
}
throw new IllegalArgumentException("Unsupported stream of type " + OggStreamIdentifier.identifyType(firstPacket));
} else {
throw new IllegalArgumentException("May only be called for the first packet in a stream, with data");
}
} }
|
public class class_name {
public static OggAudioStreamHeaders create(OggPacket firstPacket) {
if (firstPacket.isBeginningOfStream() &&
firstPacket.getData() != null &&
firstPacket.getData().length > 10) {
int sid = firstPacket.getSid();
if (VorbisPacketFactory.isVorbisStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OGG_VORBIS,
(VorbisInfo)VorbisPacketFactory.create(firstPacket)); // depends on control dependency: [if], data = [none]
}
if (SpeexPacketFactory.isSpeexStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.SPEEX_AUDIO,
(SpeexInfo)SpeexPacketFactory.create(firstPacket)); // depends on control dependency: [if], data = [none]
}
if (OpusPacketFactory.isOpusStream(firstPacket)) {
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OPUS_AUDIO,
(OpusInfo)OpusPacketFactory.create(firstPacket)); // depends on control dependency: [if], data = [none]
}
if (FlacFirstOggPacket.isFlacStream(firstPacket)) {
FlacFirstOggPacket flac = new FlacFirstOggPacket(firstPacket);
return new OggAudioStreamHeaders(sid,
OggStreamIdentifier.OGG_FLAC,
flac.getInfo()); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Unsupported stream of type " + OggStreamIdentifier.identifyType(firstPacket));
} else {
throw new IllegalArgumentException("May only be called for the first packet in a stream, with data");
}
} }
|
public class class_name {
private PrefixedName findSharedName(String prefix, String localName)
{
HashMap<PrefixedName,PrefixedName> m = mSharedNames;
if (mSharedNames == null) {
mSharedNames = m = new HashMap<PrefixedName,PrefixedName>();
} else {
// Maybe we already have a shared instance... ?
PrefixedName key = mAccessKey;
key.reset(prefix, localName);
key = m.get(key);
if (key != null) { // gotcha
return key;
}
}
// Not found; let's create, cache and return it:
PrefixedName result = new PrefixedName(prefix, localName);
m.put(result, result);
return result;
} }
|
public class class_name {
private PrefixedName findSharedName(String prefix, String localName)
{
HashMap<PrefixedName,PrefixedName> m = mSharedNames;
if (mSharedNames == null) {
mSharedNames = m = new HashMap<PrefixedName,PrefixedName>(); // depends on control dependency: [if], data = [none]
} else {
// Maybe we already have a shared instance... ?
PrefixedName key = mAccessKey;
key.reset(prefix, localName); // depends on control dependency: [if], data = [none]
key = m.get(key); // depends on control dependency: [if], data = [none]
if (key != null) { // gotcha
return key; // depends on control dependency: [if], data = [none]
}
}
// Not found; let's create, cache and return it:
PrefixedName result = new PrefixedName(prefix, localName);
m.put(result, result);
return result;
} }
|
public class class_name {
public CommandLine setUsageHelpWidth(int width) {
getCommandSpec().usageMessage().width(width);
for (CommandLine command : getCommandSpec().subcommands().values()) {
command.setUsageHelpWidth(width);
}
return this;
} }
|
public class class_name {
public CommandLine setUsageHelpWidth(int width) {
getCommandSpec().usageMessage().width(width);
for (CommandLine command : getCommandSpec().subcommands().values()) {
command.setUsageHelpWidth(width); // depends on control dependency: [for], data = [command]
}
return this;
} }
|
public class class_name {
public void marshall(CodeSigningCertificateChain codeSigningCertificateChain, ProtocolMarshaller protocolMarshaller) {
if (codeSigningCertificateChain == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(codeSigningCertificateChain.getCertificateName(), CERTIFICATENAME_BINDING);
protocolMarshaller.marshall(codeSigningCertificateChain.getInlineDocument(), INLINEDOCUMENT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CodeSigningCertificateChain codeSigningCertificateChain, ProtocolMarshaller protocolMarshaller) {
if (codeSigningCertificateChain == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(codeSigningCertificateChain.getCertificateName(), CERTIFICATENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(codeSigningCertificateChain.getInlineDocument(), INLINEDOCUMENT_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 ListInstanceFleetsResult withInstanceFleets(InstanceFleet... instanceFleets) {
if (this.instanceFleets == null) {
setInstanceFleets(new com.amazonaws.internal.SdkInternalList<InstanceFleet>(instanceFleets.length));
}
for (InstanceFleet ele : instanceFleets) {
this.instanceFleets.add(ele);
}
return this;
} }
|
public class class_name {
public ListInstanceFleetsResult withInstanceFleets(InstanceFleet... instanceFleets) {
if (this.instanceFleets == null) {
setInstanceFleets(new com.amazonaws.internal.SdkInternalList<InstanceFleet>(instanceFleets.length)); // depends on control dependency: [if], data = [none]
}
for (InstanceFleet ele : instanceFleets) {
this.instanceFleets.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
static public Type resolveType (Class fromClass, Class toClass, Type type) {
// Explicit type, eg String.
if (type instanceof Class) return (Class)type;
// Type variable, eg T.
if (type instanceof TypeVariable) return resolveTypeVariable(fromClass, toClass, type, true);
// Type which has a type parameter, eg ArrayList<T> or ArrayList<ArrayList<T>>.
if (type instanceof ParameterizedType) return (Class)((ParameterizedType)type).getRawType();
// Array which has a type variable, eg T[] or T[][], and also arrays with a type parameter, eg ArrayList<T>[].
if (type instanceof GenericArrayType) {
int dimensions = 1;
while (true) {
type = ((GenericArrayType)type).getGenericComponentType();
if (!(type instanceof GenericArrayType)) break;
dimensions++;
}
Type componentType = resolveType(fromClass, toClass, type);
if (!(componentType instanceof Class)) return type;
if (dimensions == 1) return Array.newInstance((Class)componentType, 0).getClass();
return Array.newInstance((Class)componentType, new int[dimensions]).getClass();
}
// Type which has a wildcard, eg ArrayList<?>, ArrayList<? extends Number>, or ArrayList<? super Integer>.
if (type instanceof WildcardType) {
// Check upper bound first, it is more likely. There is always an upper bound.
Type upperBound = ((WildcardType)type).getUpperBounds()[0];
if (upperBound != Object.class) return resolveType(fromClass, toClass, upperBound);
Type[] lowerBounds = ((WildcardType)type).getLowerBounds();
if (lowerBounds.length != 0) return resolveType(fromClass, toClass, lowerBounds[0]);
return Object.class;
}
// If this happens, there is a case we need to handle.
throw new KryoException("Unable to resolve type: " + type);
} }
|
public class class_name {
static public Type resolveType (Class fromClass, Class toClass, Type type) {
// Explicit type, eg String.
if (type instanceof Class) return (Class)type;
// Type variable, eg T.
if (type instanceof TypeVariable) return resolveTypeVariable(fromClass, toClass, type, true);
// Type which has a type parameter, eg ArrayList<T> or ArrayList<ArrayList<T>>.
if (type instanceof ParameterizedType) return (Class)((ParameterizedType)type).getRawType();
// Array which has a type variable, eg T[] or T[][], and also arrays with a type parameter, eg ArrayList<T>[].
if (type instanceof GenericArrayType) {
int dimensions = 1;
while (true) {
type = ((GenericArrayType)type).getGenericComponentType(); // depends on control dependency: [while], data = [none]
if (!(type instanceof GenericArrayType)) break;
dimensions++; // depends on control dependency: [while], data = [none]
}
Type componentType = resolveType(fromClass, toClass, type);
if (!(componentType instanceof Class)) return type;
if (dimensions == 1) return Array.newInstance((Class)componentType, 0).getClass();
return Array.newInstance((Class)componentType, new int[dimensions]).getClass(); // depends on control dependency: [if], data = [none]
}
// Type which has a wildcard, eg ArrayList<?>, ArrayList<? extends Number>, or ArrayList<? super Integer>.
if (type instanceof WildcardType) {
// Check upper bound first, it is more likely. There is always an upper bound.
Type upperBound = ((WildcardType)type).getUpperBounds()[0];
if (upperBound != Object.class) return resolveType(fromClass, toClass, upperBound);
Type[] lowerBounds = ((WildcardType)type).getLowerBounds();
if (lowerBounds.length != 0) return resolveType(fromClass, toClass, lowerBounds[0]);
return Object.class; // depends on control dependency: [if], data = [none]
}
// If this happens, there is a case we need to handle.
throw new KryoException("Unable to resolve type: " + type);
} }
|
public class class_name {
@Override
public List<Category> getCategories() throws BlogClientException {
final ArrayList<Category> ret = new ArrayList<Category>();
try {
final Object result = getXmlRpcClient().execute("metaWeblog.getCategories", new Object[] { blogid, userName, password });
if (result != null && result instanceof HashMap) {
// Standard MetaWeblog API style: struct of struts
@SuppressWarnings("unchecked")
final Map<String, Object> catsmap = (Map<String, Object>) result;
final Set<String> keys = catsmap.keySet();
for (final String key : keys) {
@SuppressWarnings("unchecked")
final Map<String, Object> catmap = (Map<String, Object>) catsmap.get(key);
final BlogEntry.Category category = new BlogEntry.Category(key);
final String description = (String) catmap.get("description");
category.setName(description);
// catmap.get("htmlUrl");
// catmap.get("rssUrl");
ret.add(category);
}
} else if (result != null && result instanceof Object[]) {
// Wordpress style: array of structs
final Object[] array = (Object[]) result;
for (final Object map : array) {
@SuppressWarnings("unchecked")
final Map<String, Object> catmap = (Map<String, Object>) map;
final String categoryId = (String) catmap.get("categoryId");
final String categoryName = (String) catmap.get("categoryName");
final BlogEntry.Category category = new BlogEntry.Category(categoryId);
category.setName(categoryName);
ret.add(category);
}
}
} catch (final Exception e) {
e.printStackTrace();
}
return ret;
} }
|
public class class_name {
@Override
public List<Category> getCategories() throws BlogClientException {
final ArrayList<Category> ret = new ArrayList<Category>();
try {
final Object result = getXmlRpcClient().execute("metaWeblog.getCategories", new Object[] { blogid, userName, password });
if (result != null && result instanceof HashMap) {
// Standard MetaWeblog API style: struct of struts
@SuppressWarnings("unchecked")
final Map<String, Object> catsmap = (Map<String, Object>) result;
final Set<String> keys = catsmap.keySet();
for (final String key : keys) {
@SuppressWarnings("unchecked")
final Map<String, Object> catmap = (Map<String, Object>) catsmap.get(key);
final BlogEntry.Category category = new BlogEntry.Category(key);
final String description = (String) catmap.get("description");
category.setName(description); // depends on control dependency: [for], data = [none]
// catmap.get("htmlUrl");
// catmap.get("rssUrl");
ret.add(category); // depends on control dependency: [for], data = [none]
}
} else if (result != null && result instanceof Object[]) {
// Wordpress style: array of structs
final Object[] array = (Object[]) result;
for (final Object map : array) {
@SuppressWarnings("unchecked")
final Map<String, Object> catmap = (Map<String, Object>) map;
final String categoryId = (String) catmap.get("categoryId");
final String categoryName = (String) catmap.get("categoryName");
final BlogEntry.Category category = new BlogEntry.Category(categoryId);
category.setName(categoryName); // depends on control dependency: [for], data = [none]
ret.add(category); // depends on control dependency: [for], data = [none]
}
}
} catch (final Exception e) {
e.printStackTrace();
}
return ret;
} }
|
public class class_name {
protected <R extends Closeable> R registerReporter(final R reporter) {
if (this.reporters == null) {
this.reporters = new HashSet<Closeable>();
}
this.reporters.add(reporter);
return reporter;
} }
|
public class class_name {
protected <R extends Closeable> R registerReporter(final R reporter) {
if (this.reporters == null) {
this.reporters = new HashSet<Closeable>(); // depends on control dependency: [if], data = [none]
}
this.reporters.add(reporter);
return reporter;
} }
|
public class class_name {
public boolean isOverwrite() {
Boolean booleanObject = BooleanUtils.toBooleanObject(System.getProperty(OVERWRITE));
if (booleanObject == null) {
booleanObject = Boolean.FALSE;
}
return booleanObject;
} }
|
public class class_name {
public boolean isOverwrite() {
Boolean booleanObject = BooleanUtils.toBooleanObject(System.getProperty(OVERWRITE));
if (booleanObject == null) {
booleanObject = Boolean.FALSE; // depends on control dependency: [if], data = [none]
}
return booleanObject;
} }
|
public class class_name {
public static Pattern convertToRegex(String excludeStr) {
// make all "." safe decimles then convert ** to .* and /* to /.* to make it regex
if (excludeStr.contains(".")) {
// regex for "." is \. - but we are converting the string to a regex string so need to escape the escape slash...
excludeStr = excludeStr.replace(".", "\\.");
}
//if we exclude a dir (eg /**/) we need to remove the closing slash so our regex is /.*
if (excludeStr.endsWith("/")) {
excludeStr = excludeStr.substring(0, excludeStr.length() - 1);
}
if (excludeStr.contains("**")) {
excludeStr = excludeStr.replace("**", ".*");
}
if (excludeStr.contains("/*")) {
excludeStr = excludeStr.replace("/*", "/.*");
}
//need to escape the file seperators correctly, as / is a regex keychar
if (excludeStr.contains("/")) {
excludeStr = excludeStr.replace("/", "\\/");
}
//at this point we should not have any **, if we do replace with * as all * should be prefixed with a .
if (excludeStr.contains("**")) {
excludeStr = excludeStr.replace("**", "*");
}
if (excludeStr.startsWith("*")) {
excludeStr = "." + excludeStr;
}
if (excludeStr.contains("[")) {
excludeStr = excludeStr.replace("[", "\\[");
}
if (excludeStr.contains("]")) {
excludeStr = excludeStr.replace("]", "\\]");
}
if (excludeStr.contains("-")) {
excludeStr = excludeStr.replace("-", "\\-");
}
return Pattern.compile(excludeStr);
} }
|
public class class_name {
public static Pattern convertToRegex(String excludeStr) {
// make all "." safe decimles then convert ** to .* and /* to /.* to make it regex
if (excludeStr.contains(".")) {
// regex for "." is \. - but we are converting the string to a regex string so need to escape the escape slash...
excludeStr = excludeStr.replace(".", "\\."); // depends on control dependency: [if], data = [none]
}
//if we exclude a dir (eg /**/) we need to remove the closing slash so our regex is /.*
if (excludeStr.endsWith("/")) {
excludeStr = excludeStr.substring(0, excludeStr.length() - 1); // depends on control dependency: [if], data = [none]
}
if (excludeStr.contains("**")) {
excludeStr = excludeStr.replace("**", ".*"); // depends on control dependency: [if], data = [none]
}
if (excludeStr.contains("/*")) {
excludeStr = excludeStr.replace("/*", "/.*"); // depends on control dependency: [if], data = [none]
}
//need to escape the file seperators correctly, as / is a regex keychar
if (excludeStr.contains("/")) {
excludeStr = excludeStr.replace("/", "\\/"); // depends on control dependency: [if], data = [none]
}
//at this point we should not have any **, if we do replace with * as all * should be prefixed with a .
if (excludeStr.contains("**")) {
excludeStr = excludeStr.replace("**", "*"); // depends on control dependency: [if], data = [none]
}
if (excludeStr.startsWith("*")) {
excludeStr = "." + excludeStr; // depends on control dependency: [if], data = [none]
}
if (excludeStr.contains("[")) {
excludeStr = excludeStr.replace("[", "\\["); // depends on control dependency: [if], data = [none]
}
if (excludeStr.contains("]")) {
excludeStr = excludeStr.replace("]", "\\]"); // depends on control dependency: [if], data = [none]
}
if (excludeStr.contains("-")) {
excludeStr = excludeStr.replace("-", "\\-"); // depends on control dependency: [if], data = [none]
}
return Pattern.compile(excludeStr);
} }
|
public class class_name {
public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorkspaceOptions) {
Validator.notNull(updateWorkspaceOptions, "updateWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { updateWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append()));
}
final JsonObject contentJson = new JsonObject();
if (updateWorkspaceOptions.name() != null) {
contentJson.addProperty("name", updateWorkspaceOptions.name());
}
if (updateWorkspaceOptions.description() != null) {
contentJson.addProperty("description", updateWorkspaceOptions.description());
}
if (updateWorkspaceOptions.language() != null) {
contentJson.addProperty("language", updateWorkspaceOptions.language());
}
if (updateWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata()));
}
if (updateWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut());
}
if (updateWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings()));
}
if (updateWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents()));
}
if (updateWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.entities()));
}
if (updateWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.dialogNodes()));
}
if (updateWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples()));
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} }
|
public class class_name {
public ServiceCall<Workspace> updateWorkspace(UpdateWorkspaceOptions updateWorkspaceOptions) {
Validator.notNull(updateWorkspaceOptions, "updateWorkspaceOptions cannot be null");
String[] pathSegments = { "v1/workspaces" };
String[] pathParameters = { updateWorkspaceOptions.workspaceId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "updateWorkspace");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
if (updateWorkspaceOptions.append() != null) {
builder.query("append", String.valueOf(updateWorkspaceOptions.append())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.append()]
}
final JsonObject contentJson = new JsonObject();
if (updateWorkspaceOptions.name() != null) {
contentJson.addProperty("name", updateWorkspaceOptions.name()); // depends on control dependency: [if], data = [none]
}
if (updateWorkspaceOptions.description() != null) {
contentJson.addProperty("description", updateWorkspaceOptions.description()); // depends on control dependency: [if], data = [none]
}
if (updateWorkspaceOptions.language() != null) {
contentJson.addProperty("language", updateWorkspaceOptions.language()); // depends on control dependency: [if], data = [none]
}
if (updateWorkspaceOptions.metadata() != null) {
contentJson.add("metadata", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.metadata())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.metadata()]
}
if (updateWorkspaceOptions.learningOptOut() != null) {
contentJson.addProperty("learning_opt_out", updateWorkspaceOptions.learningOptOut()); // depends on control dependency: [if], data = [none]
}
if (updateWorkspaceOptions.systemSettings() != null) {
contentJson.add("system_settings", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.systemSettings())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.systemSettings()]
}
if (updateWorkspaceOptions.intents() != null) {
contentJson.add("intents", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.intents())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.intents()]
}
if (updateWorkspaceOptions.entities() != null) {
contentJson.add("entities", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.entities())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.entities()]
}
if (updateWorkspaceOptions.dialogNodes() != null) {
contentJson.add("dialog_nodes", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.dialogNodes())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.dialogNodes()]
}
if (updateWorkspaceOptions.counterexamples() != null) {
contentJson.add("counterexamples", GsonSingleton.getGson().toJsonTree(updateWorkspaceOptions.counterexamples())); // depends on control dependency: [if], data = [(updateWorkspaceOptions.counterexamples()]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Workspace.class));
} }
|
public class class_name {
public final Calendar getCalendar() {
Calendar calendar = calendarSelector.getCalendar();
if (calendar == null) {
calendar = entry.getCalendar();
}
return calendar;
} }
|
public class class_name {
public final Calendar getCalendar() {
Calendar calendar = calendarSelector.getCalendar();
if (calendar == null) {
calendar = entry.getCalendar(); // depends on control dependency: [if], data = [none]
}
return calendar;
} }
|
public class class_name {
@Override
public boolean validateObject(InetSocketAddress address, Socket socket) {
if (socket == null) {
log.error("Socket is null [{}]", address);
return false;
}
if (!socket.isBound()) {
log.error("Socket is not bound [{}]", address);
return false;
}
if (socket.isClosed()) {
log.error("Socket is closed [{}]", address);
return false;
}
if (!socket.isConnected()) {
log.error("Socket is not connected [{}]", address);
return false;
}
if (socket.isInputShutdown()) {
log.error("Socket input is shutdown [{}]", address);
return false;
}
if (socket.isOutputShutdown()) {
log.error("Socket output is shutdown [{}]", address);
return false;
}
return true;
} }
|
public class class_name {
@Override
public boolean validateObject(InetSocketAddress address, Socket socket) {
if (socket == null) {
log.error("Socket is null [{}]", address); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (!socket.isBound()) {
log.error("Socket is not bound [{}]", address);
return false; // depends on control dependency: [if], data = [none]
}
if (socket.isClosed()) {
log.error("Socket is closed [{}]", address);
return false; // depends on control dependency: [if], data = [none]
}
if (!socket.isConnected()) {
log.error("Socket is not connected [{}]", address);
return false; // depends on control dependency: [if], data = [none]
}
if (socket.isInputShutdown()) {
log.error("Socket input is shutdown [{}]", address);
return false; // depends on control dependency: [if], data = [none]
}
if (socket.isOutputShutdown()) {
log.error("Socket output is shutdown [{}]", address);
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private static double bcuint(double[] y, double[] y1, double[] y2, double[] y12,
double x1l, double x1u, double x2l, double x2u, double x1p, double x2p) {
if (x1u == x1l) {
throw new IllegalArgumentException("Nearby control points take same value: " + x1u);
}
if (x2u == x2l) {
throw new IllegalArgumentException("Nearby control points take same value: " + x2u);
}
double t, u, d1 = x1u - x1l, d2 = x2u - x2l;
double[][] c = bcucof(y, y1, y2, y12, d1, d2);
t = (x1p - x1l) / d1;
u = (x2p - x2l) / d2;
double ansy = 0.0;
for (int i = 3; i >= 0; i--) {
ansy = t * ansy + ((c[i][3] * u + c[i][2]) * u + c[i][1]) * u + c[i][0];
}
return ansy;
} }
|
public class class_name {
private static double bcuint(double[] y, double[] y1, double[] y2, double[] y12,
double x1l, double x1u, double x2l, double x2u, double x1p, double x2p) {
if (x1u == x1l) {
throw new IllegalArgumentException("Nearby control points take same value: " + x1u);
}
if (x2u == x2l) {
throw new IllegalArgumentException("Nearby control points take same value: " + x2u);
}
double t, u, d1 = x1u - x1l, d2 = x2u - x2l;
double[][] c = bcucof(y, y1, y2, y12, d1, d2);
t = (x1p - x1l) / d1;
u = (x2p - x2l) / d2;
double ansy = 0.0;
for (int i = 3; i >= 0; i--) {
ansy = t * ansy + ((c[i][3] * u + c[i][2]) * u + c[i][1]) * u + c[i][0]; // depends on control dependency: [for], data = [i]
}
return ansy;
} }
|
public class class_name {
private static String internalBind(String message, Object[] args, String argZero, String argOne) {
if (message == null)
return "No message available."; //$NON-NLS-1$
if (args == null || args.length == 0)
args = EMPTY_ARGS;
int length = message.length();
//estimate correct size of string buffer to avoid growth
int bufLen = length + (args.length * 5);
if (argZero != null)
bufLen += argZero.length() - 3;
if (argOne != null)
bufLen += argOne.length() - 3;
StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
for (int i = 0; i < length; i++) {
char c = message.charAt(i);
switch (c) {
case '{' :
int index = message.indexOf('}', i);
// if we don't have a matching closing brace then...
if (index == -1) {
buffer.append(c);
break;
}
i++;
if (i >= length) {
buffer.append(c);
break;
}
// look for a substitution
int number = -1;
try {
number = Integer.parseInt(message.substring(i, index));
} catch (NumberFormatException e) {
throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
}
if (number == 0 && argZero != null)
buffer.append(argZero);
else if (number == 1 && argOne != null)
buffer.append(argOne);
else {
if (number >= args.length || number < 0) {
buffer.append("<missing argument>"); //$NON-NLS-1$
i = index;
break;
}
buffer.append(args[number]);
}
i = index;
break;
case '\'' :
// if a single quote is the last char on the line then skip it
int nextIndex = i + 1;
if (nextIndex >= length) {
buffer.append(c);
break;
}
char next = message.charAt(nextIndex);
// if the next char is another single quote then write out one
if (next == '\'') {
i++;
buffer.append(c);
break;
}
// otherwise we want to read until we get to the next single quote
index = message.indexOf('\'', nextIndex);
// if there are no more in the string, then skip it
if (index == -1) {
buffer.append(c);
break;
}
// otherwise write out the chars inside the quotes
buffer.append(message.substring(nextIndex, index));
i = index;
break;
default :
buffer.append(c);
}
}
return buffer.toString();
} }
|
public class class_name {
private static String internalBind(String message, Object[] args, String argZero, String argOne) {
if (message == null)
return "No message available."; //$NON-NLS-1$
if (args == null || args.length == 0)
args = EMPTY_ARGS;
int length = message.length();
//estimate correct size of string buffer to avoid growth
int bufLen = length + (args.length * 5);
if (argZero != null)
bufLen += argZero.length() - 3;
if (argOne != null)
bufLen += argOne.length() - 3;
StringBuffer buffer = new StringBuffer(bufLen < 0 ? 0 : bufLen);
for (int i = 0; i < length; i++) {
char c = message.charAt(i);
switch (c) {
case '{' :
int index = message.indexOf('}', i);
// if we don't have a matching closing brace then...
if (index == -1) {
buffer.append(c); // depends on control dependency: [if], data = [none]
break;
}
i++;
if (i >= length) {
buffer.append(c); // depends on control dependency: [if], data = [none]
break;
}
// look for a substitution
int number = -1;
try {
number = Integer.parseInt(message.substring(i, index)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw (IllegalArgumentException) new IllegalArgumentException().initCause(e);
} // depends on control dependency: [catch], data = [none]
if (number == 0 && argZero != null)
buffer.append(argZero);
else if (number == 1 && argOne != null)
buffer.append(argOne);
else {
if (number >= args.length || number < 0) {
buffer.append("<missing argument>"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
i = index; // depends on control dependency: [if], data = [none]
break;
}
buffer.append(args[number]); // depends on control dependency: [if], data = [none]
}
i = index;
break;
case '\'' :
// if a single quote is the last char on the line then skip it
int nextIndex = i + 1;
if (nextIndex >= length) {
buffer.append(c); // depends on control dependency: [if], data = [none]
break;
}
char next = message.charAt(nextIndex);
// if the next char is another single quote then write out one
if (next == '\'') {
i++; // depends on control dependency: [if], data = [none]
buffer.append(c); // depends on control dependency: [if], data = [none]
break;
}
// otherwise we want to read until we get to the next single quote
index = message.indexOf('\'', nextIndex);
// if there are no more in the string, then skip it
if (index == -1) {
buffer.append(c); // depends on control dependency: [if], data = [none]
break;
}
// otherwise write out the chars inside the quotes
buffer.append(message.substring(nextIndex, index));
i = index;
break;
default :
buffer.append(c);
}
}
return buffer.toString();
} }
|
public class class_name {
public FileUpload getFile(final String paramName) {
if (requestFiles == null) {
return null;
}
FileUpload[] values = requestFiles.get(paramName);
if ((values != null) && (values.length > 0)) {
return values[0];
}
return null;
} }
|
public class class_name {
public FileUpload getFile(final String paramName) {
if (requestFiles == null) {
return null; // depends on control dependency: [if], data = [none]
}
FileUpload[] values = requestFiles.get(paramName);
if ((values != null) && (values.length > 0)) {
return values[0]; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("checkstyle:all")
protected StringConcatenationClient generateMembers(boolean forInterface, boolean forAppender) {
final TypeReference adapter = getCodeElementExtractor().getInnerBlockDocumentationAdapter();
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
if (!forInterface && !forAppender) {
it.append("\t@"); //$NON-NLS-1$
it.append(Inject.class);
it.newLine();
it.append("\tprivate "); //$NON-NLS-1$
it.append(ITaskTagProvider.class);
it.append(" taskTagProvider;"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Inject.class);
it.newLine();
it.append("\tprivate "); //$NON-NLS-1$
it.append(Provider.class);
it.append("<"); //$NON-NLS-1$
it.append(getExpressionBuilderInterface());
it.append("> expressionProvider;"); //$NON-NLS-1$
it.newLine();
it.append("\tprivate "); //$NON-NLS-1$
it.append(XBlockExpression.class);
it.append(" block;"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the provider of task tags."); //$NON-NLS-1$
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the provider."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\tprotected "); //$NON-NLS-1$
it.append(ITaskTagProvider.class);
it.append(" getTaskTagProvider() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn this.taskTagProvider;"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
} else {
it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the type reference."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append(JvmParameterizedTypeReference.class);
it.append(" newTypeRef(String typeName)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn this.builder.newTypeRef(typeName);"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param context the context for the type reference use"); //$NON-NLS-1$
it.newLine();
it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the type reference."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append(JvmParameterizedTypeReference.class);
it.append(" newTypeRef("); //$NON-NLS-1$
it.append(Notifier.class);
it.append(" context, String typeName)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn this.builder.newTypeRef(context, typeName);"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
}
if (forInterface) {
it.append("\t/** Replies the context for type resolution."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the context or <code>null</code> if the Ecore object is the context."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
it.append(IJvmTypeProvider.class);
it.append(" getTypeResolutionContext();"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
} else if (forAppender) {
it.append("\tpublic "); //$NON-NLS-1$
it.append(IJvmTypeProvider.class);
it.append(" getTypeResolutionContext() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn this.builder.getTypeResolutionContext();"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
it.append("\t/** Create the XBlockExpression."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("void eInit("); //$NON-NLS-1$
it.append(IJvmTypeProvider.class);
it.append(" context)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\tthis.builder.eInit(context);"); //$NON-NLS-1$
} else {
it.append("\t\tsetTypeResolutionContext(context);"); //$NON-NLS-1$
it.newLine();
it.append("\t\tif (this.block == null) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tthis.block = "); //$NON-NLS-1$
it.append(XbaseFactory.class);
it.append(".eINSTANCE.createXBlockExpression();"); //$NON-NLS-1$
it.newLine();
it.append("\t\t}"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the string for \"auto-generated\" comments."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the comment text."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("String getAutoGeneratedActionString()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\treturn this.builder.getAutoGeneratedActionString();"); //$NON-NLS-1$
} else {
it.append("\t\treturn getAutoGeneratedActionString(getXBlockExpression().eResource());"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the string for \"auto-generated\" comments."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param resource the resource for which the comment must be determined."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the comment text."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("String getAutoGeneratedActionString("); //$NON-NLS-1$
it.append(Resource.class);
it.append(" resource)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\treturn this.builder.getAutoGeneratedActionString(resource);"); //$NON-NLS-1$
} else {
it.append("\t\t"); //$NON-NLS-1$
it.append(TaskTags.class);
it.append(" tags = getTaskTagProvider().getTaskTags(resource);"); //$NON-NLS-1$
it.newLine();
it.append("\t\tString taskTag;"); //$NON-NLS-1$
it.newLine();
it.append("\t\tif (tags != null && tags.getTaskTags() != null && !tags.getTaskTags().isEmpty()) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\ttaskTag = tags.getTaskTags().get(0).getName();"); //$NON-NLS-1$
it.newLine();
it.append("\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\ttaskTag = \"TODO\";"); //$NON-NLS-1$
it.newLine();
it.append("\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn taskTag + \" "); //$NON-NLS-1$
it.append(Strings.convertToJavaString(getCodeBuilderConfig().getAutoGeneratedComment()));
it.append("\";"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** An empty block expression."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the block expression."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append(XBlockExpression.class);
it.append(" getXBlockExpression()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\treturn this.builder.getXBlockExpression();"); //$NON-NLS-1$
} else {
it.append("\t\treturn this.block;"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the resource to which the XBlockExpression is attached."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append(Resource.class);
it.append(" eResource()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn getXBlockExpression().eResource();"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append(generateCommentFunction(forInterface, false, "getXBlockExpression()", //$NON-NLS-1$
"setInnerDocumentation", //$NON-NLS-1$
"getXBlockExpression()", //$NON-NLS-1$
adapter));
it.append("\t/** Add an expression inside the block."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the expression builder."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append(getExpressionBuilderInterface());
it.append(" addExpression()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\treturn this.builder.addExpression();"); //$NON-NLS-1$
} else {
it.append("\t\tfinal "); //$NON-NLS-1$
it.append(getExpressionBuilderInterface());
it.append(" builder = this.expressionProvider.get();"); //$NON-NLS-1$
it.newLine();
it.append("\t\tbuilder.eInit(getXBlockExpression(), new "); //$NON-NLS-1$
it.append(Procedures.class);
it.append(".Procedure1<"); //$NON-NLS-1$
it.append(XExpression.class);
it.append(">() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\tprivate int index = -1;"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\tpublic void apply("); //$NON-NLS-1$
it.append(XExpression.class);
it.append(" it) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\tif (this.index >= 0) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tgetXBlockExpression().getExpressions().set(index, it);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tgetXBlockExpression().getExpressions().add(it);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tthis.index = getXBlockExpression().getExpressions().size() - 1;"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t}, getTypeResolutionContext());"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn builder;"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Fill the block with the standard \"auto-generated\" content."); //$NON-NLS-1$
it.newLine();
it.append("\t * <p>Any previously added content is removed."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param type the expected type of the block (the last instruction), or"); //$NON-NLS-1$
it.newLine();
it.append("\t <code>null</code> for no type."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("void setDefaultAutoGeneratedContent(String type)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\tthis.builder.setDefaultAutoGeneratedContent(type);"); //$NON-NLS-1$
} else {
it.append("\t\tgetXBlockExpression().getExpressions().clear();"); //$NON-NLS-1$
it.newLine();
it.append("\t\tif ("); //$NON-NLS-1$
it.append(Strings.class);
it.append(".isEmpty(type)) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tsetInnerDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t"); //$NON-NLS-1$
it.append(getExpressionBuilderInterface());
it.append(" expr = addExpression();"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tString defaultValue = expr.getDefaultValueForType(type);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tif ("); //$NON-NLS-1$
it.append(Strings.class);
it.append(".isEmpty(defaultValue)) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\tsetInnerDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\texpr.setExpression(defaultValue);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\texpr.setDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t}"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
if (!forInterface) {
it.append("\t@"); //$NON-NLS-1$
it.append(Override.class);
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\tpublic "); //$NON-NLS-1$
it.append(String.class);
it.append(" toString() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn "); //$NON-NLS-1$
if (forAppender) {
it.append("this.builder.toString();"); //$NON-NLS-1$
} else {
it.append(EmfFormatter.class);
it.append(".objToStr(getXBlockExpression());"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
if (forInterface) {
it.append("\t/** Dispose the resource."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\tvoid dispose();"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
} else if (forAppender) {
it.append("\t/** Dispose the resource."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\tpublic void dispose() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tthis.builder.dispose();"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
}
};
} }
|
public class class_name {
@SuppressWarnings("checkstyle:all")
protected StringConcatenationClient generateMembers(boolean forInterface, boolean forAppender) {
final TypeReference adapter = getCodeElementExtractor().getInnerBlockDocumentationAdapter();
return new StringConcatenationClient() {
@Override
protected void appendTo(TargetStringConcatenation it) {
if (!forInterface && !forAppender) {
it.append("\t@"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Inject.class); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\tprivate "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(ITaskTagProvider.class); // depends on control dependency: [if], data = [none]
it.append(" taskTagProvider;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t@"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Inject.class); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\tprivate "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Provider.class); // depends on control dependency: [if], data = [none]
it.append("<"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(getExpressionBuilderInterface()); // depends on control dependency: [if], data = [none]
it.append("> expressionProvider;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\tprivate "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(XBlockExpression.class); // depends on control dependency: [if], data = [none]
it.append(" block;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t/** Replies the provider of task tags."); //$NON-NLS-1$
it.newLine();
it.append("\t *"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the provider."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\tprotected "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(ITaskTagProvider.class); // depends on control dependency: [if], data = [none]
it.append(" getTaskTagProvider() {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn this.taskTagProvider;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
} else {
it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the type reference."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append(JvmParameterizedTypeReference.class); // depends on control dependency: [if], data = [none]
it.append(" newTypeRef(String typeName)"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn this.builder.newTypeRef(typeName);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t/** Find the reference to the type with the given name."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param context the context for the type reference use"); //$NON-NLS-1$
it.newLine();
it.append("\t * @param typeName the fully qualified name of the type"); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the type reference."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append(JvmParameterizedTypeReference.class); // depends on control dependency: [if], data = [none]
it.append(" newTypeRef("); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Notifier.class); // depends on control dependency: [if], data = [none]
it.append(" context, String typeName)"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn this.builder.newTypeRef(context, typeName);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
}
if (forInterface) {
it.append("\t/** Replies the context for type resolution."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the context or <code>null</code> if the Ecore object is the context."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(IJvmTypeProvider.class); // depends on control dependency: [if], data = [none]
it.append(" getTypeResolutionContext();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
} else if (forAppender) {
it.append("\tpublic "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(IJvmTypeProvider.class); // depends on control dependency: [if], data = [none]
it.append(" getTypeResolutionContext() {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn this.builder.getTypeResolutionContext();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLineIfNotEmpty(); // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
}
it.append("\t/** Create the XBlockExpression."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append("void eInit("); //$NON-NLS-1$
it.append(IJvmTypeProvider.class);
it.append(" context)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
if (forAppender) {
it.append("\t\tthis.builder.eInit(context);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("\t\tsetTypeResolutionContext(context);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\tif (this.block == null) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\tthis.block = "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(XbaseFactory.class); // depends on control dependency: [if], data = [none]
it.append(".eINSTANCE.createXBlockExpression();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the string for \"auto-generated\" comments."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the comment text."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append("String getAutoGeneratedActionString()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
if (forAppender) {
it.append("\t\treturn this.builder.getAutoGeneratedActionString();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("\t\treturn getAutoGeneratedActionString(getXBlockExpression().eResource());"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the string for \"auto-generated\" comments."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param resource the resource for which the comment must be determined."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the comment text."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append("String getAutoGeneratedActionString("); //$NON-NLS-1$
it.append(Resource.class);
it.append(" resource)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
if (forAppender) {
it.append("\t\treturn this.builder.getAutoGeneratedActionString(resource);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("\t\t"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(TaskTags.class); // depends on control dependency: [if], data = [none]
it.append(" tags = getTaskTagProvider().getTaskTags(resource);"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\tString taskTag;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\tif (tags != null && tags.getTaskTags() != null && !tags.getTaskTags().isEmpty()) {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\ttaskTag = tags.getTaskTags().get(0).getName();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t} else {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t\ttaskTag = \"TODO\";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn taskTag + \" "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.append(Strings.convertToJavaString(getCodeBuilderConfig().getAutoGeneratedComment())); // depends on control dependency: [if], data = [none]
it.append("\";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** An empty block expression."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the block expression."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append(XBlockExpression.class);
it.append(" getXBlockExpression()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
if (forAppender) {
it.append("\t\treturn this.builder.getXBlockExpression();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append("\t\treturn this.block;"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Replies the resource to which the XBlockExpression is attached."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append(Resource.class);
it.append(" eResource()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
it.append(" {"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t\treturn getXBlockExpression().eResource();"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
it.newLine(); // depends on control dependency: [if], data = [none]
it.append("\t}"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.newLineIfNotEmpty();
it.newLine();
it.append(generateCommentFunction(forInterface, false, "getXBlockExpression()", //$NON-NLS-1$
"setInnerDocumentation", //$NON-NLS-1$
"getXBlockExpression()", //$NON-NLS-1$
adapter));
it.append("\t/** Add an expression inside the block."); //$NON-NLS-1$
it.newLine();
it.append("\t * @return the expression builder."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
it.append(getExpressionBuilderInterface());
it.append(" addExpression()"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\treturn this.builder.addExpression();"); //$NON-NLS-1$
} else {
it.append("\t\tfinal "); //$NON-NLS-1$
it.append(getExpressionBuilderInterface());
it.append(" builder = this.expressionProvider.get();"); //$NON-NLS-1$
it.newLine();
it.append("\t\tbuilder.eInit(getXBlockExpression(), new "); //$NON-NLS-1$
it.append(Procedures.class);
it.append(".Procedure1<"); //$NON-NLS-1$
it.append(XExpression.class);
it.append(">() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\tprivate int index = -1;"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\tpublic void apply("); //$NON-NLS-1$
it.append(XExpression.class);
it.append(" it) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\tif (this.index >= 0) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tgetXBlockExpression().getExpressions().set(index, it);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tgetXBlockExpression().getExpressions().add(it);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t\tthis.index = getXBlockExpression().getExpressions().size() - 1;"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\t}, getTypeResolutionContext());"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn builder;"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
it.append("\t/** Fill the block with the standard \"auto-generated\" content."); //$NON-NLS-1$
it.newLine();
it.append("\t * <p>Any previously added content is removed."); //$NON-NLS-1$
it.newLine();
it.append("\t * @param type the expected type of the block (the last instruction), or"); //$NON-NLS-1$
it.newLine();
it.append("\t <code>null</code> for no type."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\t"); //$NON-NLS-1$
if (!forInterface) {
it.append("public "); //$NON-NLS-1$
}
it.append("void setDefaultAutoGeneratedContent(String type)"); //$NON-NLS-1$
if (forInterface) {
it.append(";"); //$NON-NLS-1$
} else {
it.append(" {"); //$NON-NLS-1$
it.newLine();
if (forAppender) {
it.append("\t\tthis.builder.setDefaultAutoGeneratedContent(type);"); //$NON-NLS-1$
} else {
it.append("\t\tgetXBlockExpression().getExpressions().clear();"); //$NON-NLS-1$
it.newLine();
it.append("\t\tif ("); //$NON-NLS-1$
it.append(Strings.class);
it.append(".isEmpty(type)) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tsetInnerDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t"); //$NON-NLS-1$
it.append(getExpressionBuilderInterface());
it.append(" expr = addExpression();"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tString defaultValue = expr.getDefaultValueForType(type);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\tif ("); //$NON-NLS-1$
it.append(Strings.class);
it.append(".isEmpty(defaultValue)) {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\tsetInnerDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t} else {"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\texpr.setExpression(defaultValue);"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t\texpr.setDocumentation(getAutoGeneratedActionString());"); //$NON-NLS-1$
it.newLine();
it.append("\t\t\t}"); //$NON-NLS-1$
it.newLine();
it.append("\t\t}"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
}
it.newLineIfNotEmpty();
it.newLine();
if (!forInterface) {
it.append("\t@"); //$NON-NLS-1$
it.append(Override.class);
it.newLine();
it.append("\t@"); //$NON-NLS-1$
it.append(Pure.class);
it.newLine();
it.append("\tpublic "); //$NON-NLS-1$
it.append(String.class);
it.append(" toString() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\treturn "); //$NON-NLS-1$
if (forAppender) {
it.append("this.builder.toString();"); //$NON-NLS-1$
} else {
it.append(EmfFormatter.class);
it.append(".objToStr(getXBlockExpression());"); //$NON-NLS-1$
}
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
if (forInterface) {
it.append("\t/** Dispose the resource."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\tvoid dispose();"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
} else if (forAppender) {
it.append("\t/** Dispose the resource."); //$NON-NLS-1$
it.newLine();
it.append("\t */"); //$NON-NLS-1$
it.newLine();
it.append("\tpublic void dispose() {"); //$NON-NLS-1$
it.newLine();
it.append("\t\tthis.builder.dispose();"); //$NON-NLS-1$
it.newLine();
it.append("\t}"); //$NON-NLS-1$
it.newLineIfNotEmpty();
it.newLine();
}
}
};
} }
|
public class class_name {
public void smooth(final List<Double> DATA_LIST) {
int size = DATA_LIST.size();
double[] x = new double[size];
double[] y = new double[size];
low = Statistics.getMin(DATA_LIST);
high = Statistics.getMax(DATA_LIST);
if (Double.compare(low, high) == 0) {
low = minValue;
high = maxValue;
}
range = high - low;
double minX = graphBounds.getX();
double maxX = minX + graphBounds.getWidth();
double minY = graphBounds.getY();
double maxY = minY + graphBounds.getHeight();
double stepX = graphBounds.getWidth() / (noOfDatapoints - 1);
double stepY = graphBounds.getHeight() / range;
for (int i = 0 ; i < size ; i++) {
x[i] = minX + i * stepX;
y[i] = maxY - Math.abs(low - DATA_LIST.get(i)) * stepY;
}
Pair<Double[], Double[]> px = computeControlPoints(x);
Pair<Double[], Double[]> py = computeControlPoints(y);
sparkLine.getElements().clear();
for (int i = 0 ; i < size - 1 ; i++) {
sparkLine.getElements().add(new MoveTo(x[i], y[i]));
sparkLine.getElements().add(new CubicCurveTo(px.getKey()[i], py.getKey()[i], px.getValue()[i], py.getValue()[i], x[i + 1], y[i + 1]));
}
dot.setCenterX(maxX);
dot.setCenterY(y[size - 1]);
} }
|
public class class_name {
public void smooth(final List<Double> DATA_LIST) {
int size = DATA_LIST.size();
double[] x = new double[size];
double[] y = new double[size];
low = Statistics.getMin(DATA_LIST);
high = Statistics.getMax(DATA_LIST);
if (Double.compare(low, high) == 0) {
low = minValue; // depends on control dependency: [if], data = [none]
high = maxValue; // depends on control dependency: [if], data = [none]
}
range = high - low;
double minX = graphBounds.getX();
double maxX = minX + graphBounds.getWidth();
double minY = graphBounds.getY();
double maxY = minY + graphBounds.getHeight();
double stepX = graphBounds.getWidth() / (noOfDatapoints - 1);
double stepY = graphBounds.getHeight() / range;
for (int i = 0 ; i < size ; i++) {
x[i] = minX + i * stepX; // depends on control dependency: [for], data = [i]
y[i] = maxY - Math.abs(low - DATA_LIST.get(i)) * stepY; // depends on control dependency: [for], data = [i]
}
Pair<Double[], Double[]> px = computeControlPoints(x);
Pair<Double[], Double[]> py = computeControlPoints(y);
sparkLine.getElements().clear();
for (int i = 0 ; i < size - 1 ; i++) {
sparkLine.getElements().add(new MoveTo(x[i], y[i])); // depends on control dependency: [for], data = [i]
sparkLine.getElements().add(new CubicCurveTo(px.getKey()[i], py.getKey()[i], px.getValue()[i], py.getValue()[i], x[i + 1], y[i + 1])); // depends on control dependency: [for], data = [i]
}
dot.setCenterX(maxX);
dot.setCenterY(y[size - 1]);
} }
|
public class class_name {
public static boolean isSupportedRasterExtension( String name ) {
for( String ext : supportedRasters ) {
if (name.toLowerCase().endsWith(ext)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean isSupportedRasterExtension( String name ) {
for( String ext : supportedRasters ) {
if (name.toLowerCase().endsWith(ext)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public boolean accept(File file) {
if( !WatcherUtils.isInDirectory(file, javaSourceDir) || !WatcherUtils.hasExtension(file,"java")){
return false;
}
// If the file has been deleted by may have been a controller, return true.
// The cleanup will be applied.
if (! file.isFile()) {
return true;
}
//Parse the Java File and check if it's a wisdom Controller
try {
final CompilationUnit parse = JavaParser.parse(file);
// The visitor return a Boolean object, potentially null.
final Boolean accept = parse.accept(CLASS_VISITOR, null);
return accept != null && accept;
} catch (Exception e) {
getLog().error("Cannot parse " + file.getAbsolutePath(), e);
return false;
}
} }
|
public class class_name {
public boolean accept(File file) {
if( !WatcherUtils.isInDirectory(file, javaSourceDir) || !WatcherUtils.hasExtension(file,"java")){
return false; // depends on control dependency: [if], data = [none]
}
// If the file has been deleted by may have been a controller, return true.
// The cleanup will be applied.
if (! file.isFile()) {
return true; // depends on control dependency: [if], data = [none]
}
//Parse the Java File and check if it's a wisdom Controller
try {
final CompilationUnit parse = JavaParser.parse(file);
// The visitor return a Boolean object, potentially null.
final Boolean accept = parse.accept(CLASS_VISITOR, null);
return accept != null && accept; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
getLog().error("Cannot parse " + file.getAbsolutePath(), e);
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static RuleViolation isInputStandard(TransactionInput input) {
for (ScriptChunk chunk : input.getScriptSig().getChunks()) {
if (chunk.data != null && !chunk.isShortestPossiblePushData())
return RuleViolation.SHORTEST_POSSIBLE_PUSHDATA;
if (chunk.isPushData()) {
ECDSASignature signature;
try {
signature = ECKey.ECDSASignature.decodeFromDER(chunk.data);
} catch (SignatureDecodeException x) {
// Doesn't look like a signature.
signature = null;
}
if (signature != null) {
if (!TransactionSignature.isEncodingCanonical(chunk.data))
return RuleViolation.SIGNATURE_CANONICAL_ENCODING;
if (!signature.isCanonical())
return RuleViolation.SIGNATURE_CANONICAL_ENCODING;
}
}
}
return RuleViolation.NONE;
} }
|
public class class_name {
public static RuleViolation isInputStandard(TransactionInput input) {
for (ScriptChunk chunk : input.getScriptSig().getChunks()) {
if (chunk.data != null && !chunk.isShortestPossiblePushData())
return RuleViolation.SHORTEST_POSSIBLE_PUSHDATA;
if (chunk.isPushData()) {
ECDSASignature signature;
try {
signature = ECKey.ECDSASignature.decodeFromDER(chunk.data); // depends on control dependency: [try], data = [none]
} catch (SignatureDecodeException x) {
// Doesn't look like a signature.
signature = null;
} // depends on control dependency: [catch], data = [none]
if (signature != null) {
if (!TransactionSignature.isEncodingCanonical(chunk.data))
return RuleViolation.SIGNATURE_CANONICAL_ENCODING;
if (!signature.isCanonical())
return RuleViolation.SIGNATURE_CANONICAL_ENCODING;
}
}
}
return RuleViolation.NONE;
} }
|
public class class_name {
public static String camelhumpToUnderline(String str) {
final int size;
final char[] chars;
final StringBuilder sb = new StringBuilder(
(size = (chars = str.toCharArray()).length) * 3 / 2 + 1);
char c;
for (int i = 0; i < size; i++) {
c = chars[i];
if (isUppercaseAlpha(c)) {
sb.append('_').append(toLowerAscii(c));
} else {
sb.append(c);
}
}
return sb.charAt(0) == '_' ? sb.substring(1) : sb.toString();
} }
|
public class class_name {
public static String camelhumpToUnderline(String str) {
final int size;
final char[] chars;
final StringBuilder sb = new StringBuilder(
(size = (chars = str.toCharArray()).length) * 3 / 2 + 1);
char c;
for (int i = 0; i < size; i++) {
c = chars[i]; // depends on control dependency: [for], data = [i]
if (isUppercaseAlpha(c)) {
sb.append('_').append(toLowerAscii(c)); // depends on control dependency: [if], data = [none]
} else {
sb.append(c); // depends on control dependency: [if], data = [none]
}
}
return sb.charAt(0) == '_' ? sb.substring(1) : sb.toString();
} }
|
public class class_name {
public synchronized Map<String, Metric> add(CompoundStat stat, MetricConfig config) {
this.stats.add(Utils.notNull(stat));
MetricConfig statConfig = (config == null ? this.config : config);
this.statConfigs.put(stat, statConfig);
Map<String, Metric> addedMetrics = new HashMap<String, Metric>();
for (NamedMeasurable m : stat.stats()) {
TehutiMetric metric = new TehutiMetric(this, m.name(), m.description(), m.stat(), statConfig, time);
this.registry.registerMetric(metric);
this.metrics.add(metric);
addedMetrics.put(metric.name(), metric);
}
return addedMetrics;
} }
|
public class class_name {
public synchronized Map<String, Metric> add(CompoundStat stat, MetricConfig config) {
this.stats.add(Utils.notNull(stat));
MetricConfig statConfig = (config == null ? this.config : config);
this.statConfigs.put(stat, statConfig);
Map<String, Metric> addedMetrics = new HashMap<String, Metric>();
for (NamedMeasurable m : stat.stats()) {
TehutiMetric metric = new TehutiMetric(this, m.name(), m.description(), m.stat(), statConfig, time);
this.registry.registerMetric(metric); // depends on control dependency: [for], data = [m]
this.metrics.add(metric); // depends on control dependency: [for], data = [m]
addedMetrics.put(metric.name(), metric); // depends on control dependency: [for], data = [m]
}
return addedMetrics;
} }
|
public class class_name {
protected InternalRequest createGeneralRequest(String pathPrefix, AbstractBceRequest bceRequest,
HttpMethodName httpMethod, String... pathVariables) {
List<String> pathComponents = new ArrayList<String>();
assertStringNotNullOrEmpty(pathPrefix, "String resourceKey should not be null or empty");
pathComponents.add(pathPrefix);
if (pathVariables != null) {
Collections.addAll(pathComponents, pathVariables);
}
// get a InternalRequest instance
InternalRequest request =
new InternalRequest(httpMethod, HttpUtils.appendUri(this.getEndpoint(),
pathComponents.toArray(new String[pathComponents.size()])));
request.setCredentials(bceRequest.getRequestCredentials());
// set headersToSign
SignOptions options = SignOptions.DEFAULT;
Set<String> headersToSign = new HashSet<String>();
// headersToSign.add("content-type");
headersToSign.add("host");
headersToSign.add("x-bce-date");
headersToSign.add("x-bce-request-id");
options.setHeadersToSign(headersToSign);
new BceV1Signer().sign(request, request.getCredentials(), options);
return request;
} }
|
public class class_name {
protected InternalRequest createGeneralRequest(String pathPrefix, AbstractBceRequest bceRequest,
HttpMethodName httpMethod, String... pathVariables) {
List<String> pathComponents = new ArrayList<String>();
assertStringNotNullOrEmpty(pathPrefix, "String resourceKey should not be null or empty");
pathComponents.add(pathPrefix);
if (pathVariables != null) {
Collections.addAll(pathComponents, pathVariables); // depends on control dependency: [if], data = [none]
}
// get a InternalRequest instance
InternalRequest request =
new InternalRequest(httpMethod, HttpUtils.appendUri(this.getEndpoint(),
pathComponents.toArray(new String[pathComponents.size()])));
request.setCredentials(bceRequest.getRequestCredentials());
// set headersToSign
SignOptions options = SignOptions.DEFAULT;
Set<String> headersToSign = new HashSet<String>();
// headersToSign.add("content-type");
headersToSign.add("host");
headersToSign.add("x-bce-date");
headersToSign.add("x-bce-request-id");
options.setHeadersToSign(headersToSign);
new BceV1Signer().sign(request, request.getCredentials(), options);
return request;
} }
|
public class class_name {
@Override
public int size() {
final Segment<K, V>[] segments = this.segments;
long sum = 0;
long check = 0;
int[] mc = new int[segments.length];
// Try a few times to get accurate count. On failure due to
// continuous async changes in table, resort to locking.
for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
check = 0;
sum = 0;
int mcsum = 0;
for (int i = 0; i < segments.length; ++i) {
sum += segments[i].count;
mcsum += mc[i] = segments[i].modCount;
}
if (mcsum != 0) {
for (int i = 0; i < segments.length; ++i) {
check += segments[i].count;
if (mc[i] != segments[i].modCount) {
check = -1; // force retry
break;
}
}
}
if (check == sum) break;
}
if (check != sum) { // Resort to locking all segments
sum = 0;
for (int i = 0; i < segments.length; ++i)
segments[i].lock();
for (int i = 0; i < segments.length; ++i)
sum += segments[i].count;
for (int i = 0; i < segments.length; ++i)
segments[i].unlock();
}
if (sum > Integer.MAX_VALUE) return Integer.MAX_VALUE;
return (int) sum;
} }
|
public class class_name {
@Override
public int size() {
final Segment<K, V>[] segments = this.segments;
long sum = 0;
long check = 0;
int[] mc = new int[segments.length];
// Try a few times to get accurate count. On failure due to
// continuous async changes in table, resort to locking.
for (int k = 0; k < RETRIES_BEFORE_LOCK; ++k) {
check = 0; // depends on control dependency: [for], data = [none]
sum = 0; // depends on control dependency: [for], data = [none]
int mcsum = 0;
for (int i = 0; i < segments.length; ++i) {
sum += segments[i].count; // depends on control dependency: [for], data = [i]
mcsum += mc[i] = segments[i].modCount; // depends on control dependency: [for], data = [i]
}
if (mcsum != 0) {
for (int i = 0; i < segments.length; ++i) {
check += segments[i].count; // depends on control dependency: [for], data = [i]
if (mc[i] != segments[i].modCount) {
check = -1; // force retry // depends on control dependency: [if], data = [none]
break;
}
}
}
if (check == sum) break;
}
if (check != sum) { // Resort to locking all segments
sum = 0; // depends on control dependency: [if], data = [none]
for (int i = 0; i < segments.length; ++i)
segments[i].lock();
for (int i = 0; i < segments.length; ++i)
sum += segments[i].count;
for (int i = 0; i < segments.length; ++i)
segments[i].unlock();
}
if (sum > Integer.MAX_VALUE) return Integer.MAX_VALUE;
return (int) sum;
} }
|
public class class_name {
@Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate,
int start, int end,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator,
boolean retrieveFromCache) {
boolean pagination = true;
FinderPath finderPath = null;
Object[] finderArgs = null;
finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LTS;
finderArgs = new Object[] {
_getTime(sentDate),
start, end, orderByComparator
};
List<CommerceNotificationQueueEntry> list = null;
if (retrieveFromCache) {
list = (List<CommerceNotificationQueueEntry>)finderCache.getResult(finderPath,
finderArgs, this);
if ((list != null) && !list.isEmpty()) {
for (CommerceNotificationQueueEntry commerceNotificationQueueEntry : list) {
if ((sentDate.getTime() <= commerceNotificationQueueEntry.getSentDate()
.getTime())) {
list = null;
break;
}
}
}
}
if (list == null) {
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(3 +
(orderByComparator.getOrderByFields().length * 2));
}
else {
query = new StringBundler(3);
}
query.append(_SQL_SELECT_COMMERCENOTIFICATIONQUEUEENTRY_WHERE);
boolean bindSentDate = false;
if (sentDate == null) {
query.append(_FINDER_COLUMN_LTS_SENTDATE_1);
}
else {
bindSentDate = true;
query.append(_FINDER_COLUMN_LTS_SENTDATE_2);
}
if (orderByComparator != null) {
appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
orderByComparator);
}
else
if (pagination) {
query.append(CommerceNotificationQueueEntryModelImpl.ORDER_BY_JPQL);
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindSentDate) {
qPos.add(new Timestamp(sentDate.getTime()));
}
if (!pagination) {
list = (List<CommerceNotificationQueueEntry>)QueryUtil.list(q,
getDialect(), start, end, false);
Collections.sort(list);
list = Collections.unmodifiableList(list);
}
else {
list = (List<CommerceNotificationQueueEntry>)QueryUtil.list(q,
getDialect(), start, end);
}
cacheResult(list);
finderCache.putResult(finderPath, finderArgs, list);
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
}
finally {
closeSession(session);
}
}
return list;
} }
|
public class class_name {
@Override
public List<CommerceNotificationQueueEntry> findByLtS(Date sentDate,
int start, int end,
OrderByComparator<CommerceNotificationQueueEntry> orderByComparator,
boolean retrieveFromCache) {
boolean pagination = true;
FinderPath finderPath = null;
Object[] finderArgs = null;
finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_LTS;
finderArgs = new Object[] {
_getTime(sentDate),
start, end, orderByComparator
};
List<CommerceNotificationQueueEntry> list = null;
if (retrieveFromCache) {
list = (List<CommerceNotificationQueueEntry>)finderCache.getResult(finderPath,
finderArgs, this); // depends on control dependency: [if], data = [none]
if ((list != null) && !list.isEmpty()) {
for (CommerceNotificationQueueEntry commerceNotificationQueueEntry : list) {
if ((sentDate.getTime() <= commerceNotificationQueueEntry.getSentDate()
.getTime())) {
list = null; // depends on control dependency: [if], data = [none]
break;
}
}
}
}
if (list == null) {
StringBundler query = null;
if (orderByComparator != null) {
query = new StringBundler(3 +
(orderByComparator.getOrderByFields().length * 2)); // depends on control dependency: [if], data = [none]
}
else {
query = new StringBundler(3); // depends on control dependency: [if], data = [none]
}
query.append(_SQL_SELECT_COMMERCENOTIFICATIONQUEUEENTRY_WHERE); // depends on control dependency: [if], data = [none]
boolean bindSentDate = false;
if (sentDate == null) {
query.append(_FINDER_COLUMN_LTS_SENTDATE_1); // depends on control dependency: [if], data = [none]
}
else {
bindSentDate = true; // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_LTS_SENTDATE_2); // depends on control dependency: [if], data = [none]
}
if (orderByComparator != null) {
appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
orderByComparator); // depends on control dependency: [if], data = [none]
}
else
if (pagination) {
query.append(CommerceNotificationQueueEntryModelImpl.ORDER_BY_JPQL); // depends on control dependency: [if], data = [none]
}
String sql = query.toString();
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindSentDate) {
qPos.add(new Timestamp(sentDate.getTime())); // depends on control dependency: [if], data = [none]
}
if (!pagination) {
list = (List<CommerceNotificationQueueEntry>)QueryUtil.list(q,
getDialect(), start, end, false); // depends on control dependency: [if], data = [none]
Collections.sort(list); // depends on control dependency: [if], data = [none]
list = Collections.unmodifiableList(list); // depends on control dependency: [if], data = [none]
}
else {
list = (List<CommerceNotificationQueueEntry>)QueryUtil.list(q,
getDialect(), start, end); // depends on control dependency: [if], data = [none]
}
cacheResult(list); // depends on control dependency: [try], data = [none]
finderCache.putResult(finderPath, finderArgs, list); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
finderCache.removeResult(finderPath, finderArgs);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return list;
} }
|
public class class_name {
public final void setHint(@Nullable final CharSequence hint) {
this.hint = hint;
if (getAdapter() != null) {
ProxySpinnerAdapter proxyAdapter = (ProxySpinnerAdapter) getAdapter();
setAdapter(proxyAdapter.getAdapter());
}
} }
|
public class class_name {
public final void setHint(@Nullable final CharSequence hint) {
this.hint = hint;
if (getAdapter() != null) {
ProxySpinnerAdapter proxyAdapter = (ProxySpinnerAdapter) getAdapter();
setAdapter(proxyAdapter.getAdapter()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public LastPointQuery parseLastPointQueryV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, LastPointQuery.class);
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} }
|
public class class_name {
public LastPointQuery parseLastPointQueryV1() {
final String json = query.getContent();
if (json == null || json.isEmpty()) {
throw new BadRequestException(HttpResponseStatus.BAD_REQUEST,
"Missing message content",
"Supply valid JSON formatted data in the body of your request");
}
try {
return JSON.parseToObject(json, LastPointQuery.class); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public String getMessage()
{
String locMsg = getLocationDesc();
/* Better not use super's message if we do have location information,
* since parent's message contains (part of) Location
* info; something we can regenerate better...
*/
if (locMsg == null) {
return super.getMessage();
}
StringBuilder sb = new StringBuilder(mMsg.length() + locMsg.length() + 20);
sb.append(mMsg);
StringUtil.appendLF(sb);
sb.append(" at ");
sb.append(locMsg);
return sb.toString();
} }
|
public class class_name {
@Override
public String getMessage()
{
String locMsg = getLocationDesc();
/* Better not use super's message if we do have location information,
* since parent's message contains (part of) Location
* info; something we can regenerate better...
*/
if (locMsg == null) {
return super.getMessage(); // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder(mMsg.length() + locMsg.length() + 20);
sb.append(mMsg);
StringUtil.appendLF(sb);
sb.append(" at ");
sb.append(locMsg);
return sb.toString();
} }
|
public class class_name {
public boolean matchesAllOf(CharSequence sequence) {
for (int i = sequence.length() - 1; i >= 0; i--) {
if (!matches(sequence.charAt(i))) {
return false;
}
}
return true;
} }
|
public class class_name {
public boolean matchesAllOf(CharSequence sequence) {
for (int i = sequence.length() - 1; i >= 0; i--) {
if (!matches(sequence.charAt(i))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
private static String unsignedLongToString(long x, int radix)
{
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
{
throw new IllegalArgumentException("Invalid radix: " + radix);
}
if (x == 0)
{
// Simply return "0"
return "0";
}
else
{
char[] buf = new char[64];
int i = buf.length;
if (x < 0)
{
// Separate off the last digit using unsigned division. That will leave
// a number that is nonnegative as a signed integer.
long quotient = divide(x, radix);
long rem = x - quotient * radix;
buf[--i] = Character.forDigit((int) rem, radix);
x = quotient;
}
// Simple modulo/division approach
while (x > 0)
{
buf[--i] = Character.forDigit((int) (x % radix), radix);
x /= radix;
}
// Generate string
return new String(buf, i, buf.length - i);
}
} }
|
public class class_name {
private static String unsignedLongToString(long x, int radix)
{
if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX)
{
throw new IllegalArgumentException("Invalid radix: " + radix);
}
if (x == 0)
{
// Simply return "0"
return "0"; // depends on control dependency: [if], data = [none]
}
else
{
char[] buf = new char[64];
int i = buf.length;
if (x < 0)
{
// Separate off the last digit using unsigned division. That will leave
// a number that is nonnegative as a signed integer.
long quotient = divide(x, radix);
long rem = x - quotient * radix;
buf[--i] = Character.forDigit((int) rem, radix); // depends on control dependency: [if], data = [none]
x = quotient; // depends on control dependency: [if], data = [none]
}
// Simple modulo/division approach
while (x > 0)
{
buf[--i] = Character.forDigit((int) (x % radix), radix); // depends on control dependency: [while], data = [(x]
x /= radix; // depends on control dependency: [while], data = [none]
}
// Generate string
return new String(buf, i, buf.length - i); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public java.util.List<NatGateway> getNatGateways() {
if (natGateways == null) {
natGateways = new com.amazonaws.internal.SdkInternalList<NatGateway>();
}
return natGateways;
} }
|
public class class_name {
public java.util.List<NatGateway> getNatGateways() {
if (natGateways == null) {
natGateways = new com.amazonaws.internal.SdkInternalList<NatGateway>(); // depends on control dependency: [if], data = [none]
}
return natGateways;
} }
|
public class class_name {
public static Pair<BigInteger,Boolean> midpoint(BigInteger left, BigInteger right, int sigbits)
{
BigInteger midpoint;
boolean remainder;
if (left.compareTo(right) < 0)
{
BigInteger sum = left.add(right);
remainder = sum.testBit(0);
midpoint = sum.shiftRight(1);
}
else
{
BigInteger max = TWO.pow(sigbits);
// wrapping case
BigInteger distance = max.add(right).subtract(left);
remainder = distance.testBit(0);
midpoint = distance.shiftRight(1).add(left).mod(max);
}
return Pair.create(midpoint, remainder);
} }
|
public class class_name {
public static Pair<BigInteger,Boolean> midpoint(BigInteger left, BigInteger right, int sigbits)
{
BigInteger midpoint;
boolean remainder;
if (left.compareTo(right) < 0)
{
BigInteger sum = left.add(right);
remainder = sum.testBit(0); // depends on control dependency: [if], data = [0)]
midpoint = sum.shiftRight(1); // depends on control dependency: [if], data = [none]
}
else
{
BigInteger max = TWO.pow(sigbits);
// wrapping case
BigInteger distance = max.add(right).subtract(left);
remainder = distance.testBit(0); // depends on control dependency: [if], data = [0)]
midpoint = distance.shiftRight(1).add(left).mod(max); // depends on control dependency: [if], data = [none]
}
return Pair.create(midpoint, remainder);
} }
|
public class class_name {
final void percolateDownMinHeap(final int index) {
final int element = elements[index];
final float key = keys[index];
int hole = index;
while (hole * 2 <= size) {
int child = hole * 2;
// if we have a right child and that child can not be percolated
// up then move onto other child
if (child != size && keys[child + 1] < keys[child]) {
child++;
}
// if we found resting place of bubble then terminate search
if (keys[child] >= key) {
break;
}
elements[hole] = elements[child];
keys[hole] = keys[child];
hole = child;
}
elements[hole] = element;
keys[hole] = key;
} }
|
public class class_name {
final void percolateDownMinHeap(final int index) {
final int element = elements[index];
final float key = keys[index];
int hole = index;
while (hole * 2 <= size) {
int child = hole * 2;
// if we have a right child and that child can not be percolated
// up then move onto other child
if (child != size && keys[child + 1] < keys[child]) {
child++; // depends on control dependency: [if], data = [none]
}
// if we found resting place of bubble then terminate search
if (keys[child] >= key) {
break;
}
elements[hole] = elements[child]; // depends on control dependency: [while], data = [none]
keys[hole] = keys[child]; // depends on control dependency: [while], data = [none]
hole = child; // depends on control dependency: [while], data = [none]
}
elements[hole] = element;
keys[hole] = key;
} }
|
public class class_name {
private void addContentTypeRecursively(ContentType contentType) {
addContentType(contentType);
for (ContentType child : contentType.getChildren()) {
addContentTypeRecursively(child);
}
} }
|
public class class_name {
private void addContentTypeRecursively(ContentType contentType) {
addContentType(contentType);
for (ContentType child : contentType.getChildren()) {
addContentTypeRecursively(child);
// depends on control dependency: [for], data = [child]
}
} }
|
public class class_name {
@Override
public ZooNode getNodeRecrusively() {
ZooNode root = new ZooNode(zooConf.getNodePathPrefix(), zooConf.getNodePathPrefix());
root.setOpen(true);
if (zkClient == null || zkClient.getState() != States.CONNECTED) {
LOG.warn("Zookeeper not connected!");
return root;
}
LOG.info("Start to get zoo tree recrusively...");
long start = System.currentTimeMillis();
setNodeRecrusively(root, 0);
LOG.info("Getting zoo tree costs " + (System.currentTimeMillis() - start) + "ms");
return root;
} }
|
public class class_name {
@Override
public ZooNode getNodeRecrusively() {
ZooNode root = new ZooNode(zooConf.getNodePathPrefix(), zooConf.getNodePathPrefix());
root.setOpen(true);
if (zkClient == null || zkClient.getState() != States.CONNECTED) {
LOG.warn("Zookeeper not connected!"); // depends on control dependency: [if], data = [none]
return root; // depends on control dependency: [if], data = [none]
}
LOG.info("Start to get zoo tree recrusively...");
long start = System.currentTimeMillis();
setNodeRecrusively(root, 0);
LOG.info("Getting zoo tree costs " + (System.currentTimeMillis() - start) + "ms");
return root;
} }
|
public class class_name {
public int lastIndexOf(CharSequence target, int fromIndex, int endIndex)
{
if (fromIndex < 0)
throw new IndexOutOfBoundsException("index out of range: " + fromIndex);
if (endIndex < 0)
throw new IndexOutOfBoundsException("index out of range: " + endIndex);
if (fromIndex > length())
throw new IndexOutOfBoundsException("fromIndex > length()");
if (fromIndex > endIndex)
throw new IndexOutOfBoundsException("fromIndex > endIndex");
if (endIndex >= builder.length())
{
endIndex = builder.length() - 1;
}
int targetCount = target.length();
if (targetCount == 0)
{
return endIndex;
}
int rightIndex = endIndex - targetCount;
if (fromIndex > rightIndex)
{
fromIndex = rightIndex;
}
int strLastIndex = targetCount - 1;
char strLastChar = target.charAt(strLastIndex);
int min = fromIndex + targetCount - 1;
lastCharSearch:
for (int i = endIndex; i >= min; i--)
{
if (builder.charAt(i) == strLastChar)
{
for (int j = strLastIndex - 1, k = 1; j >= 0; j--, k++)
{
if (builder.charAt(i - k) != target.charAt(j))
{
continue lastCharSearch;
}
}
return i - target.length() + 1;
}
}
return -1;
} }
|
public class class_name {
public int lastIndexOf(CharSequence target, int fromIndex, int endIndex)
{
if (fromIndex < 0)
throw new IndexOutOfBoundsException("index out of range: " + fromIndex);
if (endIndex < 0)
throw new IndexOutOfBoundsException("index out of range: " + endIndex);
if (fromIndex > length())
throw new IndexOutOfBoundsException("fromIndex > length()");
if (fromIndex > endIndex)
throw new IndexOutOfBoundsException("fromIndex > endIndex");
if (endIndex >= builder.length())
{
endIndex = builder.length() - 1; // depends on control dependency: [if], data = [none]
}
int targetCount = target.length();
if (targetCount == 0)
{
return endIndex; // depends on control dependency: [if], data = [none]
}
int rightIndex = endIndex - targetCount;
if (fromIndex > rightIndex)
{
fromIndex = rightIndex; // depends on control dependency: [if], data = [none]
}
int strLastIndex = targetCount - 1;
char strLastChar = target.charAt(strLastIndex);
int min = fromIndex + targetCount - 1;
lastCharSearch:
for (int i = endIndex; i >= min; i--)
{
if (builder.charAt(i) == strLastChar)
{
for (int j = strLastIndex - 1, k = 1; j >= 0; j--, k++)
{
if (builder.charAt(i - k) != target.charAt(j))
{
continue lastCharSearch;
}
}
return i - target.length() + 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
private String getBaseSymbol() {
String ncNotation = getNotation();
if (!ncNotation.contains("(")) {
return null;
}
int start = ncNotation.indexOf("(");
int end = ncNotation.indexOf(")");
String baseSymbol = ncNotation.substring(start + 1, end);
baseSymbol = baseSymbol.replaceAll("\\[|\\]", "");
return baseSymbol;
} }
|
public class class_name {
private String getBaseSymbol() {
String ncNotation = getNotation();
if (!ncNotation.contains("(")) {
return null; // depends on control dependency: [if], data = [none]
}
int start = ncNotation.indexOf("(");
int end = ncNotation.indexOf(")");
String baseSymbol = ncNotation.substring(start + 1, end);
baseSymbol = baseSymbol.replaceAll("\\[|\\]", "");
return baseSymbol;
} }
|
public class class_name {
public void viewDocument(DocumentEntry entry)
{
InputStream is = null;
try
{
is = new DocumentInputStream(entry);
byte[] data = new byte[is.available()];
is.read(data);
m_model.setData(data);
updateTables();
}
catch (IOException ex)
{
throw new RuntimeException(ex);
}
finally
{
StreamHelper.closeQuietly(is);
}
} }
|
public class class_name {
public void viewDocument(DocumentEntry entry)
{
InputStream is = null;
try
{
is = new DocumentInputStream(entry); // depends on control dependency: [try], data = [none]
byte[] data = new byte[is.available()];
is.read(data); // depends on control dependency: [try], data = [none]
m_model.setData(data); // depends on control dependency: [try], data = [none]
updateTables(); // depends on control dependency: [try], data = [none]
}
catch (IOException ex)
{
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
finally
{
StreamHelper.closeQuietly(is);
}
} }
|
public class class_name {
private boolean isPopulatedMixedValueMap(ResourceFieldSchema schema, int field, Tuple object) {
if (schema.getType() != DataType.MAP) {
// Can't be a mixed value map if it's not a map at all.
return false;
}
try {
Object fieldValue = object.get(field);
Map<?, ?> map = (Map<?, ?>) fieldValue;
return schema.getSchema() == null && !(map == null || map.isEmpty());
} catch (ExecException e) {
throw new EsHadoopIllegalStateException(e);
}
} }
|
public class class_name {
private boolean isPopulatedMixedValueMap(ResourceFieldSchema schema, int field, Tuple object) {
if (schema.getType() != DataType.MAP) {
// Can't be a mixed value map if it's not a map at all.
return false; // depends on control dependency: [if], data = [none]
}
try {
Object fieldValue = object.get(field);
Map<?, ?> map = (Map<?, ?>) fieldValue; // depends on control dependency: [try], data = [none]
return schema.getSchema() == null && !(map == null || map.isEmpty()); // depends on control dependency: [try], data = [none]
} catch (ExecException e) {
throw new EsHadoopIllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected static String valueString(Object value) {
if (value == null) {
return "null";
} else if (value instanceof String) {
return "\"" + ((String) value).codePoints()
.flatMap(cp ->
(cp == '"')
? "\\\"".codePoints()
: (cp < 256)
? charRep[cp].codePoints()
: IntStream.of(cp))
.collect(
StringBuilder::new,
StringBuilder::appendCodePoint,
StringBuilder::append)
.toString() + "\"";
} else if (value instanceof Character) {
char cp = (char) (Character) value;
return "'" + (
(cp == '\'')
? "\\\'"
: (cp < 256)
? charRep[cp]
: String.valueOf(cp)) + "'";
} else if (value.getClass().isArray()) {
int dims = 0;
Class<?> t = value.getClass();
while (true) {
Class<?> ct = t.getComponentType();
if (ct == null) {
break;
}
++dims;
t = ct;
}
String tn = t.getTypeName();
int len = Array.getLength(value);
StringBuilder sb = new StringBuilder();
sb.append(tn.substring(tn.lastIndexOf('.') + 1, tn.length()));
sb.append("[");
sb.append(len);
sb.append("]");
for (int i = 1; i < dims; ++i) {
sb.append("[]");
}
sb.append(" { ");
for (int i = 0; i < len; ++i) {
sb.append(valueString(Array.get(value, i)));
if (i < len - 1) {
sb.append(", ");
}
}
sb.append(" }");
return sb.toString();
} else {
return value.toString();
}
} }
|
public class class_name {
protected static String valueString(Object value) {
if (value == null) {
return "null"; // depends on control dependency: [if], data = [none]
} else if (value instanceof String) {
return "\"" + ((String) value).codePoints()
.flatMap(cp ->
(cp == '"')
? "\\\"".codePoints()
: (cp < 256)
? charRep[cp].codePoints()
: IntStream.of(cp))
.collect(
StringBuilder::new,
StringBuilder::appendCodePoint,
StringBuilder::append)
.toString() + "\""; // depends on control dependency: [if], data = [none]
} else if (value instanceof Character) {
char cp = (char) (Character) value;
return "'" + (
(cp == '\'')
? "\\\'"
: (cp < 256)
? charRep[cp]
: String.valueOf(cp)) + "'"; // depends on control dependency: [if], data = [none]
} else if (value.getClass().isArray()) {
int dims = 0;
Class<?> t = value.getClass();
while (true) {
Class<?> ct = t.getComponentType();
if (ct == null) {
break;
}
++dims; // depends on control dependency: [while], data = [none]
t = ct; // depends on control dependency: [while], data = [none]
}
String tn = t.getTypeName();
int len = Array.getLength(value);
StringBuilder sb = new StringBuilder();
sb.append(tn.substring(tn.lastIndexOf('.') + 1, tn.length())); // depends on control dependency: [if], data = [none]
sb.append("["); // depends on control dependency: [if], data = [none]
sb.append(len); // depends on control dependency: [if], data = [none]
sb.append("]"); // depends on control dependency: [if], data = [none]
for (int i = 1; i < dims; ++i) {
sb.append("[]"); // depends on control dependency: [for], data = [none]
}
sb.append(" { "); // depends on control dependency: [if], data = [none]
for (int i = 0; i < len; ++i) {
sb.append(valueString(Array.get(value, i))); // depends on control dependency: [for], data = [i]
if (i < len - 1) {
sb.append(", "); // depends on control dependency: [if], data = [none]
}
}
sb.append(" }"); // depends on control dependency: [if], data = [none]
return sb.toString(); // depends on control dependency: [if], data = [none]
} else {
return value.toString(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void parsePayload(IAsyncResultHandler<Object> payloadResultHandler) {
// Strip out any content-length header from the request. It will very likely
// no longer be accurate.
request.getHeaders().remove("Content-Length"); //$NON-NLS-1$
// Configure the api's max payload buffer size, if it's not already set.
if (api.getMaxPayloadBufferSize() <= 0) {
api.setMaxPayloadBufferSize(maxPayloadBufferSize);
}
// Now "handle" the inbound request stream, which will cause bytes to be streamed
// to the writeStream we provide (which will store the bytes in a buffer for parsing)
final ByteBuffer buffer = new ByteBuffer(2048);
inboundStreamHandler.handle(new ISignalWriteStream() {
private boolean done = false;
@Override
public void abort(Throwable t) {
done = true;
payloadResultHandler.handle(AsyncResultImpl.create(new RuntimeException("Inbound request stream aborted.", t))); //$NON-NLS-1$
}
@Override
public boolean isFinished() {
return done;
}
@Override
public void write(IApimanBuffer chunk) {
if (done) {
return;
}
if (buffer.length() > api.getMaxPayloadBufferSize()) {
payloadResultHandler.handle(AsyncResultImpl.create(new Exception("Max request payload size exceeded."))); //$NON-NLS-1$
done = true;
return;
}
buffer.append(chunk);
}
@Override
public void end() {
if (done) {
return;
}
// When end() is called, the stream of bytes is done and we can parse them into
// an appropriate payload object.
done = true;
if (buffer.length() == 0) {
payloadResultHandler.handle(AsyncResultImpl.create(null));
} else {
payloadIO = null;
if ("soap".equalsIgnoreCase(api.getEndpointType())) { //$NON-NLS-1$
payloadIO = new SoapPayloadIO();
} else if ("rest".equalsIgnoreCase(api.getEndpointType())) { //$NON-NLS-1$
if ("xml".equalsIgnoreCase(api.getEndpointContentType())) { //$NON-NLS-1$
payloadIO = new XmlPayloadIO();
} else if ("json".equalsIgnoreCase(api.getEndpointContentType())) { //$NON-NLS-1$
payloadIO = new JsonPayloadIO();
}
}
if (payloadIO == null) {
payloadIO = new BytesPayloadIO();
}
try {
Object payload = payloadIO.unmarshall(buffer.getBytes());
payloadResultHandler.handle(AsyncResultImpl.create(payload));
} catch (Exception e) {
payloadResultHandler.handle(AsyncResultImpl.create(new Exception("Failed to parse inbound request payload.", e))); //$NON-NLS-1$
}
}
}
/**
* Because of the way the parsePayload code was written, it's possible
* with async for apiConnection to be +null+ when this is called.
*
* This is because parsePayload invokes inboundStreamHandler before
* policiesLoadedHandler has had a chance to return (and assigned apiConnection).
*
* To work around this we check whether apiConnection is null for #drainHandler
* and #isFull.
*/
@Override
public void drainHandler(IAsyncHandler<Void> drainHandler) {
if (apiConnection != null)
apiConnection.drainHandler(drainHandler);
}
@Override
public boolean isFull() {
if (apiConnection != null) {
return apiConnection.isFull();
} else {
return false;
}
}
});
} }
|
public class class_name {
protected void parsePayload(IAsyncResultHandler<Object> payloadResultHandler) {
// Strip out any content-length header from the request. It will very likely
// no longer be accurate.
request.getHeaders().remove("Content-Length"); //$NON-NLS-1$
// Configure the api's max payload buffer size, if it's not already set.
if (api.getMaxPayloadBufferSize() <= 0) {
api.setMaxPayloadBufferSize(maxPayloadBufferSize); // depends on control dependency: [if], data = [none]
}
// Now "handle" the inbound request stream, which will cause bytes to be streamed
// to the writeStream we provide (which will store the bytes in a buffer for parsing)
final ByteBuffer buffer = new ByteBuffer(2048);
inboundStreamHandler.handle(new ISignalWriteStream() {
private boolean done = false;
@Override
public void abort(Throwable t) {
done = true;
payloadResultHandler.handle(AsyncResultImpl.create(new RuntimeException("Inbound request stream aborted.", t))); //$NON-NLS-1$
}
@Override
public boolean isFinished() {
return done;
}
@Override
public void write(IApimanBuffer chunk) {
if (done) {
return; // depends on control dependency: [if], data = [none]
}
if (buffer.length() > api.getMaxPayloadBufferSize()) {
payloadResultHandler.handle(AsyncResultImpl.create(new Exception("Max request payload size exceeded."))); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
done = true; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
buffer.append(chunk);
}
@Override
public void end() {
if (done) {
return; // depends on control dependency: [if], data = [none]
}
// When end() is called, the stream of bytes is done and we can parse them into
// an appropriate payload object.
done = true;
if (buffer.length() == 0) {
payloadResultHandler.handle(AsyncResultImpl.create(null)); // depends on control dependency: [if], data = [none]
} else {
payloadIO = null; // depends on control dependency: [if], data = [none]
if ("soap".equalsIgnoreCase(api.getEndpointType())) { //$NON-NLS-1$
payloadIO = new SoapPayloadIO(); // depends on control dependency: [if], data = [none]
} else if ("rest".equalsIgnoreCase(api.getEndpointType())) { //$NON-NLS-1$
if ("xml".equalsIgnoreCase(api.getEndpointContentType())) { //$NON-NLS-1$
payloadIO = new XmlPayloadIO(); // depends on control dependency: [if], data = [none]
} else if ("json".equalsIgnoreCase(api.getEndpointContentType())) { //$NON-NLS-1$
payloadIO = new JsonPayloadIO(); // depends on control dependency: [if], data = [none]
}
}
if (payloadIO == null) {
payloadIO = new BytesPayloadIO(); // depends on control dependency: [if], data = [none]
}
try {
Object payload = payloadIO.unmarshall(buffer.getBytes());
payloadResultHandler.handle(AsyncResultImpl.create(payload)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
payloadResultHandler.handle(AsyncResultImpl.create(new Exception("Failed to parse inbound request payload.", e))); //$NON-NLS-1$
} // depends on control dependency: [catch], data = [none]
}
}
/**
* Because of the way the parsePayload code was written, it's possible
* with async for apiConnection to be +null+ when this is called.
*
* This is because parsePayload invokes inboundStreamHandler before
* policiesLoadedHandler has had a chance to return (and assigned apiConnection).
*
* To work around this we check whether apiConnection is null for #drainHandler
* and #isFull.
*/
@Override
public void drainHandler(IAsyncHandler<Void> drainHandler) {
if (apiConnection != null)
apiConnection.drainHandler(drainHandler);
}
@Override
public boolean isFull() {
if (apiConnection != null) {
return apiConnection.isFull(); // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public int optInt( String key, int defaultValue ) {
verifyIsNull();
try{
return getInt( key );
}catch( Exception e ){
return defaultValue;
}
} }
|
public class class_name {
public int optInt( String key, int defaultValue ) {
verifyIsNull();
try{
return getInt( key ); // depends on control dependency: [try], data = [none]
}catch( Exception e ){
return defaultValue;
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.