code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private AttributeType getCommonType(AttributeType existingGuess, AttributeType newGuess) {
if (existingGuess == null && newGuess == null) {
return null;
}
if (existingGuess == null) {
return newGuess;
}
if (newGuess == null) {
return existingGuess;
}
if (existingGuess.equals(newGuess)) {
return existingGuess;
}
switch (existingGuess) {
case INT:
//noinspection Duplicates
if (newGuess.equals(DECIMAL)) {
return DECIMAL;
} else if (newGuess.equals(LONG)) {
return LONG;
} else {
return STRING;
}
case DECIMAL:
if (newGuess.equals(INT) || newGuess.equals(LONG)) {
return DECIMAL;
} else {
return STRING;
}
case LONG:
//noinspection Duplicates
if (newGuess.equals(INT)) {
return LONG;
} else if (newGuess.equals(DECIMAL)) {
return DECIMAL;
} else {
return STRING;
}
default:
return STRING;
}
} }
|
public class class_name {
private AttributeType getCommonType(AttributeType existingGuess, AttributeType newGuess) {
if (existingGuess == null && newGuess == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (existingGuess == null) {
return newGuess; // depends on control dependency: [if], data = [none]
}
if (newGuess == null) {
return existingGuess; // depends on control dependency: [if], data = [none]
}
if (existingGuess.equals(newGuess)) {
return existingGuess; // depends on control dependency: [if], data = [none]
}
switch (existingGuess) {
case INT:
//noinspection Duplicates
if (newGuess.equals(DECIMAL)) {
return DECIMAL; // depends on control dependency: [if], data = [none]
} else if (newGuess.equals(LONG)) {
return LONG; // depends on control dependency: [if], data = [none]
} else {
return STRING; // depends on control dependency: [if], data = [none]
}
case DECIMAL:
if (newGuess.equals(INT) || newGuess.equals(LONG)) {
return DECIMAL; // depends on control dependency: [if], data = [none]
} else {
return STRING; // depends on control dependency: [if], data = [none]
}
case LONG:
//noinspection Duplicates
if (newGuess.equals(INT)) {
return LONG; // depends on control dependency: [if], data = [none]
} else if (newGuess.equals(DECIMAL)) {
return DECIMAL; // depends on control dependency: [if], data = [none]
} else {
return STRING; // depends on control dependency: [if], data = [none]
}
default:
return STRING;
}
} }
|
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (accessType != null) {
addFieldToSource(sourceMap, "accessType", accessType);
}
if (clientIp != null) {
addFieldToSource(sourceMap, "clientIp", clientIp);
}
if (hitCount != null) {
addFieldToSource(sourceMap, "hitCount", hitCount);
}
if (hitCountRelation != null) {
addFieldToSource(sourceMap, "hitCountRelation", hitCountRelation);
}
if (languages != null) {
addFieldToSource(sourceMap, "languages", languages);
}
if (queryId != null) {
addFieldToSource(sourceMap, "queryId", queryId);
}
if (queryOffset != null) {
addFieldToSource(sourceMap, "queryOffset", queryOffset);
}
if (queryPageSize != null) {
addFieldToSource(sourceMap, "queryPageSize", queryPageSize);
}
if (queryTime != null) {
addFieldToSource(sourceMap, "queryTime", queryTime);
}
if (referer != null) {
addFieldToSource(sourceMap, "referer", referer);
}
if (requestedAt != null) {
addFieldToSource(sourceMap, "requestedAt", requestedAt);
}
if (responseTime != null) {
addFieldToSource(sourceMap, "responseTime", responseTime);
}
if (roles != null) {
addFieldToSource(sourceMap, "roles", roles);
}
if (searchWord != null) {
addFieldToSource(sourceMap, "searchWord", searchWord);
}
if (user != null) {
addFieldToSource(sourceMap, "user", user);
}
if (userAgent != null) {
addFieldToSource(sourceMap, "userAgent", userAgent);
}
if (userInfoId != null) {
addFieldToSource(sourceMap, "userInfoId", userInfoId);
}
if (userSessionId != null) {
addFieldToSource(sourceMap, "userSessionId", userSessionId);
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost);
}
return sourceMap;
} }
|
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (accessType != null) {
addFieldToSource(sourceMap, "accessType", accessType); // depends on control dependency: [if], data = [none]
}
if (clientIp != null) {
addFieldToSource(sourceMap, "clientIp", clientIp); // depends on control dependency: [if], data = [none]
}
if (hitCount != null) {
addFieldToSource(sourceMap, "hitCount", hitCount); // depends on control dependency: [if], data = [none]
}
if (hitCountRelation != null) {
addFieldToSource(sourceMap, "hitCountRelation", hitCountRelation); // depends on control dependency: [if], data = [none]
}
if (languages != null) {
addFieldToSource(sourceMap, "languages", languages); // depends on control dependency: [if], data = [none]
}
if (queryId != null) {
addFieldToSource(sourceMap, "queryId", queryId); // depends on control dependency: [if], data = [none]
}
if (queryOffset != null) {
addFieldToSource(sourceMap, "queryOffset", queryOffset); // depends on control dependency: [if], data = [none]
}
if (queryPageSize != null) {
addFieldToSource(sourceMap, "queryPageSize", queryPageSize); // depends on control dependency: [if], data = [none]
}
if (queryTime != null) {
addFieldToSource(sourceMap, "queryTime", queryTime); // depends on control dependency: [if], data = [none]
}
if (referer != null) {
addFieldToSource(sourceMap, "referer", referer); // depends on control dependency: [if], data = [none]
}
if (requestedAt != null) {
addFieldToSource(sourceMap, "requestedAt", requestedAt); // depends on control dependency: [if], data = [none]
}
if (responseTime != null) {
addFieldToSource(sourceMap, "responseTime", responseTime); // depends on control dependency: [if], data = [none]
}
if (roles != null) {
addFieldToSource(sourceMap, "roles", roles); // depends on control dependency: [if], data = [none]
}
if (searchWord != null) {
addFieldToSource(sourceMap, "searchWord", searchWord); // depends on control dependency: [if], data = [none]
}
if (user != null) {
addFieldToSource(sourceMap, "user", user); // depends on control dependency: [if], data = [none]
}
if (userAgent != null) {
addFieldToSource(sourceMap, "userAgent", userAgent); // depends on control dependency: [if], data = [none]
}
if (userInfoId != null) {
addFieldToSource(sourceMap, "userInfoId", userInfoId); // depends on control dependency: [if], data = [none]
}
if (userSessionId != null) {
addFieldToSource(sourceMap, "userSessionId", userSessionId); // depends on control dependency: [if], data = [none]
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost); // depends on control dependency: [if], data = [none]
}
return sourceMap;
} }
|
public class class_name {
private CommonsPoolFactory getCommonsPoolFactory(TargetMetaDef targetMetaDef) {
try {
ContainerWrapper containerWrapper = containerCallback.getContainerWrapper();
InstanceCache instanceCache = (InstanceCache) containerWrapper.lookup(ComponentKeys.INSTANCE_CACHE);
String key = targetMetaDef.getCacheKey() + " CommonsPoolFactory";
CommonsPoolFactory commonsPoolFactoryExist = (CommonsPoolFactory) instanceCache.get(key);
CommonsPoolFactory commonsPoolFactoryNew = null;
if (commonsPoolFactoryExist == null) {
Debug.logVerbose("[JdonFramework] first time call commonsPoolFactory, create it:" + key, module);
commonsPoolFactoryNew = create(targetServiceFactory, poolConfigure.getMaxPoolSize());
commonsPoolFactoryExist = (CommonsPoolFactory)instanceCache.putIfAbsent(key, commonsPoolFactoryNew);
}
return commonsPoolFactoryExist != null?commonsPoolFactoryExist:commonsPoolFactoryNew;
} catch (Exception ex) {
Debug.logError(ex, module);
return null;
}
} }
|
public class class_name {
private CommonsPoolFactory getCommonsPoolFactory(TargetMetaDef targetMetaDef) {
try {
ContainerWrapper containerWrapper = containerCallback.getContainerWrapper();
InstanceCache instanceCache = (InstanceCache) containerWrapper.lookup(ComponentKeys.INSTANCE_CACHE);
String key = targetMetaDef.getCacheKey() + " CommonsPoolFactory";
CommonsPoolFactory commonsPoolFactoryExist = (CommonsPoolFactory) instanceCache.get(key);
CommonsPoolFactory commonsPoolFactoryNew = null;
if (commonsPoolFactoryExist == null) {
Debug.logVerbose("[JdonFramework] first time call commonsPoolFactory, create it:" + key, module);
// depends on control dependency: [if], data = [none]
commonsPoolFactoryNew = create(targetServiceFactory, poolConfigure.getMaxPoolSize());
// depends on control dependency: [if], data = [none]
commonsPoolFactoryExist = (CommonsPoolFactory)instanceCache.putIfAbsent(key, commonsPoolFactoryNew);
// depends on control dependency: [if], data = [none]
}
return commonsPoolFactoryExist != null?commonsPoolFactoryExist:commonsPoolFactoryNew;
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Debug.logError(ex, module);
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static List<String> readLines(String filename) {
List<String> lines = Lists.newArrayList();
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
while ((line = in.readLine()) != null) {
// Ignore blank lines.
if (line.trim().length() > 0) {
lines.add(line);
}
}
in.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
return lines;
} }
|
public class class_name {
public static List<String> readLines(String filename) {
List<String> lines = Lists.newArrayList();
try {
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
while ((line = in.readLine()) != null) {
// Ignore blank lines.
if (line.trim().length() > 0) {
lines.add(line); // depends on control dependency: [if], data = [none]
}
}
in.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
return lines;
} }
|
public class class_name {
public ProviderDefinition[] resolve(final Class type, final String name) {
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
MethodDescriptor[] methods = cd.getAllMethodDescriptors();
List<ProviderDefinition> list = new ArrayList<>();
for (MethodDescriptor methodDescriptor : methods) {
Method method = methodDescriptor.getMethod();
PetiteProvider petiteProvider = method.getAnnotation(PetiteProvider.class);
if (petiteProvider == null) {
continue;
}
String providerName = petiteProvider.value();
if (StringUtil.isBlank(providerName)) {
// default provider name
providerName = method.getName();
if (providerName.endsWith("Provider")) {
providerName = StringUtil.substring(providerName, 0, -8);
}
}
ProviderDefinition providerDefinition;
if (Modifier.isStatic(method.getModifiers())) {
providerDefinition = new ProviderDefinition(providerName, method);
} else {
providerDefinition = new ProviderDefinition(providerName, name, method);
}
list.add(providerDefinition);
}
ProviderDefinition[] providers;
if (list.isEmpty()) {
providers = ProviderDefinition.EMPTY;
} else {
providers = list.toArray(new ProviderDefinition[0]);
}
return providers;
} }
|
public class class_name {
public ProviderDefinition[] resolve(final Class type, final String name) {
ClassDescriptor cd = ClassIntrospector.get().lookup(type);
MethodDescriptor[] methods = cd.getAllMethodDescriptors();
List<ProviderDefinition> list = new ArrayList<>();
for (MethodDescriptor methodDescriptor : methods) {
Method method = methodDescriptor.getMethod();
PetiteProvider petiteProvider = method.getAnnotation(PetiteProvider.class);
if (petiteProvider == null) {
continue;
}
String providerName = petiteProvider.value();
if (StringUtil.isBlank(providerName)) {
// default provider name
providerName = method.getName(); // depends on control dependency: [if], data = [none]
if (providerName.endsWith("Provider")) {
providerName = StringUtil.substring(providerName, 0, -8); // depends on control dependency: [if], data = [none]
}
}
ProviderDefinition providerDefinition;
if (Modifier.isStatic(method.getModifiers())) {
providerDefinition = new ProviderDefinition(providerName, method); // depends on control dependency: [if], data = [none]
} else {
providerDefinition = new ProviderDefinition(providerName, name, method); // depends on control dependency: [if], data = [none]
}
list.add(providerDefinition); // depends on control dependency: [for], data = [none]
}
ProviderDefinition[] providers;
if (list.isEmpty()) {
providers = ProviderDefinition.EMPTY; // depends on control dependency: [if], data = [none]
} else {
providers = list.toArray(new ProviderDefinition[0]); // depends on control dependency: [if], data = [none]
}
return providers;
} }
|
public class class_name {
@Override
public void initialize() {
String adminUsername = "admin";
String adminPassword = "123456";
User param = new User();
param.setUserName(adminUsername);
User admin = baseDao.getUnique(User.class, param);
if (admin != null) {
LoggerHelper.info("database has been initialized.");
return;
}
LoggerHelper.info("begin init database.");
admin = new User();
admin.setUserName(adminUsername);
admin.setUserPassword(HashHelper.getHashedPassword(adminPassword, adminUsername));
admin.setPasswordSalt(adminUsername);
Role role = new Role();
role.setRoleName("ROLE_ADMIN");
role.setRoleDescription("Administrator");
baseDao.save(role);
admin.setRoleList(Arrays.asList(role));
baseDao.save(admin);
LoggerHelper.info("init database successfully.");
} }
|
public class class_name {
@Override
public void initialize() {
String adminUsername = "admin";
String adminPassword = "123456";
User param = new User();
param.setUserName(adminUsername);
User admin = baseDao.getUnique(User.class, param);
if (admin != null) {
LoggerHelper.info("database has been initialized."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LoggerHelper.info("begin init database.");
admin = new User();
admin.setUserName(adminUsername);
admin.setUserPassword(HashHelper.getHashedPassword(adminPassword, adminUsername));
admin.setPasswordSalt(adminUsername);
Role role = new Role();
role.setRoleName("ROLE_ADMIN");
role.setRoleDescription("Administrator");
baseDao.save(role);
admin.setRoleList(Arrays.asList(role));
baseDao.save(admin);
LoggerHelper.info("init database successfully.");
} }
|
public class class_name {
public void setAnchorColor(int index, Color color) {
if (index <= 0) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.startColor = color;
} else if (index >= 1) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.endColor = color;
}
} }
|
public class class_name {
public void setAnchorColor(int index, Color color) {
if (index <= 0) {
if (startColor == null) {
startColor = new RGBColor(0.0, 0.0, 0.0); // depends on control dependency: [if], data = [none]
}
setGradation(true); // depends on control dependency: [if], data = [none]
this.startColor = color; // depends on control dependency: [if], data = [none]
} else if (index >= 1) {
if (endColor == null) {
endColor = new RGBColor(0.0, 0.0, 0.0); // depends on control dependency: [if], data = [none]
}
setGradation(true); // depends on control dependency: [if], data = [none]
this.endColor = color; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i);
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> void sort(Arr arr, Comparator<T> c) {
int l = arr.getLength();
Object[] objs = new Object[l];
for (int i=0; i<l; i++) {
objs[i] = arr.get(i); // depends on control dependency: [for], data = [i]
}
Arrays.sort((T[])objs, c);
for (int i=0; i<l; i++) {
arr.put(i, objs[i]); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void marshall(MotionImageInsertionOffset motionImageInsertionOffset, ProtocolMarshaller protocolMarshaller) {
if (motionImageInsertionOffset == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(motionImageInsertionOffset.getImageX(), IMAGEX_BINDING);
protocolMarshaller.marshall(motionImageInsertionOffset.getImageY(), IMAGEY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(MotionImageInsertionOffset motionImageInsertionOffset, ProtocolMarshaller protocolMarshaller) {
if (motionImageInsertionOffset == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(motionImageInsertionOffset.getImageX(), IMAGEX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(motionImageInsertionOffset.getImageY(), IMAGEY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public final DtEnd getEndDate(final boolean deriveFromDuration) {
DtEnd dtEnd = getProperty(Property.DTEND);
// No DTEND? No problem, we'll use the DURATION.
if (dtEnd == null && deriveFromDuration && getStartDate() != null) {
final DtStart dtStart = getStartDate();
final Duration vEventDuration;
if (getDuration() != null) {
vEventDuration = getDuration();
} else if (dtStart.getDate() instanceof DateTime) {
// If "DTSTART" is a DATE-TIME, then the event's duration is zero (see: RFC 5545, 3.6.1 Event Component)
vEventDuration = new Duration(java.time.Duration.ZERO);
} else {
// If "DTSTART" is a DATE, then the event's duration is one day (see: RFC 5545, 3.6.1 Event Component)
vEventDuration = new Duration(java.time.Duration.ofDays(1));
}
dtEnd = new DtEnd(Dates.getInstance(Date.from(dtStart.getDate().toInstant().plus(vEventDuration.getDuration())),
dtStart.getParameter(Parameter.VALUE)));
if (dtStart.isUtc()) {
dtEnd.setUtc(true);
} else {
dtEnd.setTimeZone(dtStart.getTimeZone());
}
}
return dtEnd;
} }
|
public class class_name {
public final DtEnd getEndDate(final boolean deriveFromDuration) {
DtEnd dtEnd = getProperty(Property.DTEND);
// No DTEND? No problem, we'll use the DURATION.
if (dtEnd == null && deriveFromDuration && getStartDate() != null) {
final DtStart dtStart = getStartDate();
final Duration vEventDuration;
if (getDuration() != null) {
vEventDuration = getDuration(); // depends on control dependency: [if], data = [none]
} else if (dtStart.getDate() instanceof DateTime) {
// If "DTSTART" is a DATE-TIME, then the event's duration is zero (see: RFC 5545, 3.6.1 Event Component)
vEventDuration = new Duration(java.time.Duration.ZERO); // depends on control dependency: [if], data = [none]
} else {
// If "DTSTART" is a DATE, then the event's duration is one day (see: RFC 5545, 3.6.1 Event Component)
vEventDuration = new Duration(java.time.Duration.ofDays(1)); // depends on control dependency: [if], data = [none]
}
dtEnd = new DtEnd(Dates.getInstance(Date.from(dtStart.getDate().toInstant().plus(vEventDuration.getDuration())),
dtStart.getParameter(Parameter.VALUE))); // depends on control dependency: [if], data = [none]
if (dtStart.isUtc()) {
dtEnd.setUtc(true); // depends on control dependency: [if], data = [none]
} else {
dtEnd.setTimeZone(dtStart.getTimeZone()); // depends on control dependency: [if], data = [none]
}
}
return dtEnd;
} }
|
public class class_name {
void handleQuotesInCommands(String line, BitSet quoteBitSet,
BitSet doubleQuoteBitSet) {
int doubleQuoteStart = -1;
int quoteStart = -1;
for (int pos = 0; pos < line.length(); pos++) {
char ch = line.charAt(pos);
if (doubleQuoteStart > -1) {
doubleQuoteBitSet.set(pos);
if (ch == '"') {
doubleQuoteStart = -1;
}
continue;
} else if (quoteStart > -1) {
quoteBitSet.set(pos);
if (ch == '\'') {
quoteStart = -1;
}
continue;
}
// so far doubleQuoteBitSet MUST BE -1 and quoteStart MUST BE -1
if (ch == '"') {
doubleQuoteBitSet.set(pos);
doubleQuoteStart = pos;
}
// so far quoteStart MUST BE -1
if (doubleQuoteStart == -1 && ch == '\'') {
quoteBitSet.set(pos);
quoteStart = pos;
}
}
} }
|
public class class_name {
void handleQuotesInCommands(String line, BitSet quoteBitSet,
BitSet doubleQuoteBitSet) {
int doubleQuoteStart = -1;
int quoteStart = -1;
for (int pos = 0; pos < line.length(); pos++) {
char ch = line.charAt(pos);
if (doubleQuoteStart > -1) {
doubleQuoteBitSet.set(pos); // depends on control dependency: [if], data = [none]
if (ch == '"') {
doubleQuoteStart = -1; // depends on control dependency: [if], data = [none]
}
continue;
} else if (quoteStart > -1) {
quoteBitSet.set(pos); // depends on control dependency: [if], data = [none]
if (ch == '\'') {
quoteStart = -1; // depends on control dependency: [if], data = [none]
}
continue;
}
// so far doubleQuoteBitSet MUST BE -1 and quoteStart MUST BE -1
if (ch == '"') {
doubleQuoteBitSet.set(pos); // depends on control dependency: [if], data = [none]
doubleQuoteStart = pos; // depends on control dependency: [if], data = [none]
}
// so far quoteStart MUST BE -1
if (doubleQuoteStart == -1 && ch == '\'') {
quoteBitSet.set(pos); // depends on control dependency: [if], data = [none]
quoteStart = pos; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private ShareTarget toShareTarget(ResolveInfo resolveInfo) {
if (resolveInfo == null || resolveInfo.activityInfo == null) {
return null;
}
ActivityInfo info = resolveInfo.activityInfo;
ShareTarget target = new ShareTarget(info.loadLabel(mPackageManager), info.loadIcon(mPackageManager), null);
target.packageName = info.packageName;
target.className = info.name;
return target;
} }
|
public class class_name {
private ShareTarget toShareTarget(ResolveInfo resolveInfo) {
if (resolveInfo == null || resolveInfo.activityInfo == null) {
return null; // depends on control dependency: [if], data = [none]
}
ActivityInfo info = resolveInfo.activityInfo;
ShareTarget target = new ShareTarget(info.loadLabel(mPackageManager), info.loadIcon(mPackageManager), null);
target.packageName = info.packageName;
target.className = info.name;
return target;
} }
|
public class class_name {
@Override
public RuleBasedCollator setMaxVariable(int group) {
// Convert the reorder code into a MaxVariable number, or UCOL_DEFAULT=-1.
int value;
if(group == Collator.ReorderCodes.DEFAULT) {
value = -1; // UCOL_DEFAULT
} else if(Collator.ReorderCodes.FIRST <= group && group <= Collator.ReorderCodes.CURRENCY) {
value = group - Collator.ReorderCodes.FIRST;
} else {
throw new IllegalArgumentException("illegal max variable group " + group);
}
int oldValue = settings.readOnly().getMaxVariable();
if(value == oldValue) {
return this;
}
CollationSettings defaultSettings = getDefaultSettings();
if(settings.readOnly() == defaultSettings) {
if(value < 0) { // UCOL_DEFAULT
return this;
}
}
CollationSettings ownedSettings = getOwnedSettings();
if(group == Collator.ReorderCodes.DEFAULT) {
group = Collator.ReorderCodes.FIRST + defaultSettings.getMaxVariable();
}
long varTop = data.getLastPrimaryForGroup(group);
assert(varTop != 0);
ownedSettings.setMaxVariable(value, defaultSettings.options);
ownedSettings.variableTop = varTop;
setFastLatinOptions(ownedSettings);
return this;
} }
|
public class class_name {
@Override
public RuleBasedCollator setMaxVariable(int group) {
// Convert the reorder code into a MaxVariable number, or UCOL_DEFAULT=-1.
int value;
if(group == Collator.ReorderCodes.DEFAULT) {
value = -1; // UCOL_DEFAULT // depends on control dependency: [if], data = [none]
} else if(Collator.ReorderCodes.FIRST <= group && group <= Collator.ReorderCodes.CURRENCY) {
value = group - Collator.ReorderCodes.FIRST; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("illegal max variable group " + group);
}
int oldValue = settings.readOnly().getMaxVariable();
if(value == oldValue) {
return this; // depends on control dependency: [if], data = [none]
}
CollationSettings defaultSettings = getDefaultSettings();
if(settings.readOnly() == defaultSettings) {
if(value < 0) { // UCOL_DEFAULT
return this; // depends on control dependency: [if], data = [none]
}
}
CollationSettings ownedSettings = getOwnedSettings();
if(group == Collator.ReorderCodes.DEFAULT) {
group = Collator.ReorderCodes.FIRST + defaultSettings.getMaxVariable(); // depends on control dependency: [if], data = [none]
}
long varTop = data.getLastPrimaryForGroup(group);
assert(varTop != 0);
ownedSettings.setMaxVariable(value, defaultSettings.options);
ownedSettings.variableTop = varTop;
setFastLatinOptions(ownedSettings);
return this;
} }
|
public class class_name {
public ArrayList getSignatureNames() {
if (sigNames != null)
return new ArrayList(sigNames.keySet());
sigNames = new HashMap();
ArrayList sorter = new ArrayList();
for (Iterator it = fields.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry)it.next();
Item item = (Item)entry.getValue();
PdfDictionary merged = item.getMerged(0);
if (!PdfName.SIG.equals(merged.get(PdfName.FT)))
continue;
PdfDictionary v = merged.getAsDict(PdfName.V);
if (v == null)
continue;
PdfString contents = v.getAsString(PdfName.CONTENTS);
if (contents == null)
continue;
PdfArray ro = v.getAsArray(PdfName.BYTERANGE);
if (ro == null)
continue;
int rangeSize = ro.size();
if (rangeSize < 2)
continue;
/*
* From the PDF32000_2008 spec: Byterange: An array of pairs of integers
* (starting byte offset, length in bytes) Also see:
* https://pdf-insecurity.org/download/paper.pdf
*/
int lengthOfSignedBlocks = 0;
for (int i = rangeSize - 1; i > 0; i = i - 2) {
lengthOfSignedBlocks += ro.getAsNumber(i).intValue();
}
int unsignedBlock = contents.getOriginalBytes().length * 2 + 2;
int length = lengthOfSignedBlocks + unsignedBlock;
sorter.add(new Object[]{entry.getKey(), new int[]{length, 0}});
}
Collections.sort(sorter, new AcroFields.SorterComparator());
if (!sorter.isEmpty()) {
if (((int[])((Object[])sorter.get(sorter.size() - 1))[1])[0] == reader.getFileLength())
totalRevisions = sorter.size();
else
totalRevisions = sorter.size() + 1;
for (int k = 0; k < sorter.size(); ++k) {
Object objs[] = (Object[])sorter.get(k);
String name = (String)objs[0];
int p[] = (int[])objs[1];
p[1] = k + 1;
sigNames.put(name, p);
}
}
return new ArrayList(sigNames.keySet());
} }
|
public class class_name {
public ArrayList getSignatureNames() {
if (sigNames != null)
return new ArrayList(sigNames.keySet());
sigNames = new HashMap();
ArrayList sorter = new ArrayList();
for (Iterator it = fields.entrySet().iterator(); it.hasNext();) {
Map.Entry entry = (Map.Entry)it.next();
Item item = (Item)entry.getValue();
PdfDictionary merged = item.getMerged(0);
if (!PdfName.SIG.equals(merged.get(PdfName.FT)))
continue;
PdfDictionary v = merged.getAsDict(PdfName.V);
if (v == null)
continue;
PdfString contents = v.getAsString(PdfName.CONTENTS);
if (contents == null)
continue;
PdfArray ro = v.getAsArray(PdfName.BYTERANGE);
if (ro == null)
continue;
int rangeSize = ro.size();
if (rangeSize < 2)
continue;
/*
* From the PDF32000_2008 spec: Byterange: An array of pairs of integers
* (starting byte offset, length in bytes) Also see:
* https://pdf-insecurity.org/download/paper.pdf
*/
int lengthOfSignedBlocks = 0;
for (int i = rangeSize - 1; i > 0; i = i - 2) {
lengthOfSignedBlocks += ro.getAsNumber(i).intValue(); // depends on control dependency: [for], data = [i]
}
int unsignedBlock = contents.getOriginalBytes().length * 2 + 2;
int length = lengthOfSignedBlocks + unsignedBlock;
sorter.add(new Object[]{entry.getKey(), new int[]{length, 0}}); // depends on control dependency: [for], data = [none]
}
Collections.sort(sorter, new AcroFields.SorterComparator());
if (!sorter.isEmpty()) {
if (((int[])((Object[])sorter.get(sorter.size() - 1))[1])[0] == reader.getFileLength())
totalRevisions = sorter.size();
else
totalRevisions = sorter.size() + 1;
for (int k = 0; k < sorter.size(); ++k) {
Object objs[] = (Object[])sorter.get(k);
String name = (String)objs[0];
int p[] = (int[])objs[1];
p[1] = k + 1; // depends on control dependency: [for], data = [k]
sigNames.put(name, p); // depends on control dependency: [for], data = [none]
}
}
return new ArrayList(sigNames.keySet());
} }
|
public class class_name {
public static boolean checkFileForPackaging(String fileName, String extension) {
// ignore hidden files and backup files
if (fileName.charAt(0) == '.' || fileName.charAt(fileName.length()-1) == '~') {
return false;
}
return !"aidl".equalsIgnoreCase(extension) && // Aidl files
!"rs".equalsIgnoreCase(extension) && // RenderScript files
!"fs".equalsIgnoreCase(extension) && // FilterScript files
!"rsh".equalsIgnoreCase(extension) && // RenderScript header files
!"d".equalsIgnoreCase(extension) && // Dependency files
!"java".equalsIgnoreCase(extension) && // Java files
!"scala".equalsIgnoreCase(extension) && // Scala files
!"class".equalsIgnoreCase(extension) && // Java class files
!"scc".equalsIgnoreCase(extension) && // VisualSourceSafe
!"swp".equalsIgnoreCase(extension) && // vi swap file
!"thumbs.db".equalsIgnoreCase(fileName) && // image index file
!"picasa.ini".equalsIgnoreCase(fileName) && // image index file
!"package.html".equalsIgnoreCase(fileName) && // Javadoc
!"overview.html".equalsIgnoreCase(fileName); // Javadoc
} }
|
public class class_name {
public static boolean checkFileForPackaging(String fileName, String extension) {
// ignore hidden files and backup files
if (fileName.charAt(0) == '.' || fileName.charAt(fileName.length()-1) == '~') {
return false; // depends on control dependency: [if], data = [none]
}
return !"aidl".equalsIgnoreCase(extension) && // Aidl files
!"rs".equalsIgnoreCase(extension) && // RenderScript files
!"fs".equalsIgnoreCase(extension) && // FilterScript files
!"rsh".equalsIgnoreCase(extension) && // RenderScript header files
!"d".equalsIgnoreCase(extension) && // Dependency files
!"java".equalsIgnoreCase(extension) && // Java files
!"scala".equalsIgnoreCase(extension) && // Scala files
!"class".equalsIgnoreCase(extension) && // Java class files
!"scc".equalsIgnoreCase(extension) && // VisualSourceSafe
!"swp".equalsIgnoreCase(extension) && // vi swap file
!"thumbs.db".equalsIgnoreCase(fileName) && // image index file
!"picasa.ini".equalsIgnoreCase(fileName) && // image index file
!"package.html".equalsIgnoreCase(fileName) && // Javadoc
!"overview.html".equalsIgnoreCase(fileName); // Javadoc
} }
|
public class class_name {
public void setEnableCloudwatchLogsExports(java.util.Collection<String> enableCloudwatchLogsExports) {
if (enableCloudwatchLogsExports == null) {
this.enableCloudwatchLogsExports = null;
return;
}
this.enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>(enableCloudwatchLogsExports);
} }
|
public class class_name {
public void setEnableCloudwatchLogsExports(java.util.Collection<String> enableCloudwatchLogsExports) {
if (enableCloudwatchLogsExports == null) {
this.enableCloudwatchLogsExports = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.enableCloudwatchLogsExports = new com.amazonaws.internal.SdkInternalList<String>(enableCloudwatchLogsExports);
} }
|
public class class_name {
private void resetStoreDefinitions(Set<String> storeNamesToDelete) {
// Clear entries in the metadata cache
for(String storeName: storeNamesToDelete) {
this.metadataCache.remove(storeName);
this.storeDefinitionsStorageEngine.delete(storeName, null);
this.storeNames.remove(storeName);
}
} }
|
public class class_name {
private void resetStoreDefinitions(Set<String> storeNamesToDelete) {
// Clear entries in the metadata cache
for(String storeName: storeNamesToDelete) {
this.metadataCache.remove(storeName); // depends on control dependency: [for], data = [storeName]
this.storeDefinitionsStorageEngine.delete(storeName, null); // depends on control dependency: [for], data = [storeName]
this.storeNames.remove(storeName); // depends on control dependency: [for], data = [storeName]
}
} }
|
public class class_name {
protected void setColumnsFinalWidth() {
log.debug("Setting columns final width.");
float factor;
int printableArea = report.getOptions().getColumnWidth();
//Create a list with only the visible columns.
List visibleColums = getVisibleColumns();
if (report.getOptions().isUseFullPageWidth()) {
int columnsWidth = 0;
int notRezisableWidth = 0;
//Store in a variable the total with of all visible columns
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
columnsWidth += col.getWidth();
if (col.isFixedWidth())
notRezisableWidth += col.getWidth();
}
factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth);
log.debug("printableArea = " + printableArea
+ ", columnsWidth = " + columnsWidth
+ ", columnsWidth = " + columnsWidth
+ ", notRezisableWidth = " + notRezisableWidth
+ ", factor = " + factor);
int acumulated = 0;
int colFinalWidth;
//Select the non-resizable columns
Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {
public boolean evaluate(Object arg0) {
return !((AbstractColumn) arg0).isFixedWidth();
}
});
//Finally, set the new width to the resizable columns
for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {
AbstractColumn col = (AbstractColumn) iter.next();
if (!iter.hasNext()) {
col.setWidth(printableArea - notRezisableWidth - acumulated);
} else {
colFinalWidth = (new Float(col.getWidth() * factor)).intValue();
acumulated += colFinalWidth;
col.setWidth(colFinalWidth);
}
}
}
// If the columns width changed, the X position must be setted again.
int posx = 0;
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
col.setPosX(posx);
posx += col.getWidth();
}
} }
|
public class class_name {
protected void setColumnsFinalWidth() {
log.debug("Setting columns final width.");
float factor;
int printableArea = report.getOptions().getColumnWidth();
//Create a list with only the visible columns.
List visibleColums = getVisibleColumns();
if (report.getOptions().isUseFullPageWidth()) {
int columnsWidth = 0;
int notRezisableWidth = 0;
//Store in a variable the total with of all visible columns
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
columnsWidth += col.getWidth(); // depends on control dependency: [for], data = [none]
if (col.isFixedWidth())
notRezisableWidth += col.getWidth();
}
factor = (float) (printableArea - notRezisableWidth) / (float) (columnsWidth - notRezisableWidth); // depends on control dependency: [if], data = [none]
log.debug("printableArea = " + printableArea
+ ", columnsWidth = " + columnsWidth
+ ", columnsWidth = " + columnsWidth
+ ", notRezisableWidth = " + notRezisableWidth
+ ", factor = " + factor); // depends on control dependency: [if], data = [none]
int acumulated = 0;
int colFinalWidth;
//Select the non-resizable columns
Collection resizableColumns = CollectionUtils.select(visibleColums, new Predicate() {
public boolean evaluate(Object arg0) {
return !((AbstractColumn) arg0).isFixedWidth();
}
});
//Finally, set the new width to the resizable columns
for (Iterator iter = resizableColumns.iterator(); iter.hasNext(); ) {
AbstractColumn col = (AbstractColumn) iter.next();
if (!iter.hasNext()) {
col.setWidth(printableArea - notRezisableWidth - acumulated); // depends on control dependency: [if], data = [none]
} else {
colFinalWidth = (new Float(col.getWidth() * factor)).intValue(); // depends on control dependency: [if], data = [none]
acumulated += colFinalWidth; // depends on control dependency: [if], data = [none]
col.setWidth(colFinalWidth); // depends on control dependency: [if], data = [none]
}
}
}
// If the columns width changed, the X position must be setted again.
int posx = 0;
for (Object visibleColum : visibleColums) {
AbstractColumn col = (AbstractColumn) visibleColum;
col.setPosX(posx); // depends on control dependency: [for], data = [none]
posx += col.getWidth(); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public void showInfo(Formatter f) {
if (dcm == null) {
if (spec == null) return;
dcm = scanCollection(spec, f);
if (dcm == null) return;
}
// just a list of the files
f.format("dcm = %s%n", dcm);
try {
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath());
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
// show nrecords, data size
int nrecords = 0;
long dataSize = 0;
long msgSize = 0;
for (Object o : param2BeanTable.getBeans()) {
Grib2ParameterBean p = (Grib2ParameterBean) o;
for (Grib2RecordBean r : p.getRecordBeans()) {
nrecords++;
dataSize += r.getDataLength();
msgSize += r.getMsgLength();
}
}
f.format("nrecords = %d, total grib data size = %d, total grib msg sizes = %d", nrecords, dataSize, msgSize);
} }
|
public class class_name {
public void showInfo(Formatter f) {
if (dcm == null) {
if (spec == null) return;
dcm = scanCollection(spec, f); // depends on control dependency: [if], data = [none]
if (dcm == null) return;
}
// just a list of the files
f.format("dcm = %s%n", dcm);
try {
for (MFile mfile : dcm.getFilesSorted()) {
f.format(" %s%n", mfile.getPath()); // depends on control dependency: [for], data = [mfile]
}
} catch (IOException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
} // depends on control dependency: [catch], data = [none]
// show nrecords, data size
int nrecords = 0;
long dataSize = 0;
long msgSize = 0;
for (Object o : param2BeanTable.getBeans()) {
Grib2ParameterBean p = (Grib2ParameterBean) o;
for (Grib2RecordBean r : p.getRecordBeans()) {
nrecords++; // depends on control dependency: [for], data = [r]
dataSize += r.getDataLength(); // depends on control dependency: [for], data = [r]
msgSize += r.getMsgLength(); // depends on control dependency: [for], data = [r]
}
}
f.format("nrecords = %d, total grib data size = %d, total grib msg sizes = %d", nrecords, dataSize, msgSize);
} }
|
public class class_name {
public EClass getIfcTerminatorSymbol() {
if (ifcTerminatorSymbolEClass == null) {
ifcTerminatorSymbolEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(600);
}
return ifcTerminatorSymbolEClass;
} }
|
public class class_name {
public EClass getIfcTerminatorSymbol() {
if (ifcTerminatorSymbolEClass == null) {
ifcTerminatorSymbolEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(600);
// depends on control dependency: [if], data = [none]
}
return ifcTerminatorSymbolEClass;
} }
|
public class class_name {
private long newYearOnOrBefore(long utcDays) {
long ny = this.newYearInSui(utcDays);
if (utcDays >= ny) {
return ny;
} else {
return this.newYearInSui(utcDays - 180); // previous sui
}
} }
|
public class class_name {
private long newYearOnOrBefore(long utcDays) {
long ny = this.newYearInSui(utcDays);
if (utcDays >= ny) {
return ny; // depends on control dependency: [if], data = [none]
} else {
return this.newYearInSui(utcDays - 180); // previous sui // depends on control dependency: [if], data = [(utcDays]
}
} }
|
public class class_name {
public T extract(Object target) {
if (target == null) {
return null;
}
if (!(target instanceof DynamicObject)) {
throw new IllegalArgumentException(
"Extraction target is not a DynamicObject");
}
return (T) ((DynamicObject) target).getValue(key);
} }
|
public class class_name {
public T extract(Object target) {
if (target == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (!(target instanceof DynamicObject)) {
throw new IllegalArgumentException(
"Extraction target is not a DynamicObject");
}
return (T) ((DynamicObject) target).getValue(key);
} }
|
public class class_name {
public void marshall(CreateUserRequest createUserRequest, ProtocolMarshaller protocolMarshaller) {
if (createUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createUserRequest.getBrokerId(), BROKERID_BINDING);
protocolMarshaller.marshall(createUserRequest.getConsoleAccess(), CONSOLEACCESS_BINDING);
protocolMarshaller.marshall(createUserRequest.getGroups(), GROUPS_BINDING);
protocolMarshaller.marshall(createUserRequest.getPassword(), PASSWORD_BINDING);
protocolMarshaller.marshall(createUserRequest.getUsername(), USERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateUserRequest createUserRequest, ProtocolMarshaller protocolMarshaller) {
if (createUserRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createUserRequest.getBrokerId(), BROKERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createUserRequest.getConsoleAccess(), CONSOLEACCESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createUserRequest.getGroups(), GROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createUserRequest.getPassword(), PASSWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createUserRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean configEqual(Object entity1, Object entity2) {
if (entity1 == entity2) {
return true;
} else if (entity1 == null || entity2 == null) {
return false;
} else if (entity1 instanceof Map) {
return configEqualMap((Map) entity1, castTo(Map.class, entity2));
} else if (entity2 instanceof Map) {
return configEqualMap((Map) entity1, castTo(Map.class, entity2));
} else if (entity2 instanceof ObjectMeta) {
return configEqualObjectMeta((ObjectMeta) entity1, castTo(ObjectMeta.class, entity2));
} else if (entity1 instanceof Collection && entity2 instanceof Collection) {
return collectionsEqual((Collection) entity1, (Collection) entity2);
} else {
Class<?> aClass = getCommonDenominator(entity1.getClass(), entity2.getClass());
if (aClass != null) {
Object castEntity2 = castTo(aClass, entity2);
if (castEntity2 == null) {
return false;
} else if (aClass.getPackage().getName().startsWith("io.fabric8")) {
return configEqualKubernetesDTO(entity1, entity2, aClass);
}
}
return java.util.Objects.equals(entity1, entity2);
}
} }
|
public class class_name {
public static boolean configEqual(Object entity1, Object entity2) {
if (entity1 == entity2) {
return true; // depends on control dependency: [if], data = [none]
} else if (entity1 == null || entity2 == null) {
return false; // depends on control dependency: [if], data = [none]
} else if (entity1 instanceof Map) {
return configEqualMap((Map) entity1, castTo(Map.class, entity2)); // depends on control dependency: [if], data = [none]
} else if (entity2 instanceof Map) {
return configEqualMap((Map) entity1, castTo(Map.class, entity2)); // depends on control dependency: [if], data = [none]
} else if (entity2 instanceof ObjectMeta) {
return configEqualObjectMeta((ObjectMeta) entity1, castTo(ObjectMeta.class, entity2)); // depends on control dependency: [if], data = [none]
} else if (entity1 instanceof Collection && entity2 instanceof Collection) {
return collectionsEqual((Collection) entity1, (Collection) entity2); // depends on control dependency: [if], data = [none]
} else {
Class<?> aClass = getCommonDenominator(entity1.getClass(), entity2.getClass());
if (aClass != null) {
Object castEntity2 = castTo(aClass, entity2);
if (castEntity2 == null) {
return false; // depends on control dependency: [if], data = [none]
} else if (aClass.getPackage().getName().startsWith("io.fabric8")) {
return configEqualKubernetesDTO(entity1, entity2, aClass);
}
}
return java.util.Objects.equals(entity1, entity2);
}
} }
|
public class class_name {
public long[] getSamples() {
if (itemsSeen_ == 0) {
return null;
}
final int numSamples = (int) Math.min(reservoirSize_, itemsSeen_);
return java.util.Arrays.copyOf(data_, numSamples);
} }
|
public class class_name {
public long[] getSamples() {
if (itemsSeen_ == 0) {
return null; // depends on control dependency: [if], data = [none]
}
final int numSamples = (int) Math.min(reservoirSize_, itemsSeen_);
return java.util.Arrays.copyOf(data_, numSamples);
} }
|
public class class_name {
protected RejectedExecutionHandler getRejectedExecutionHandler(Dsn dsn) {
String overflowName = ASYNC_QUEUE_OVERFLOW_DEFAULT;
String asyncQueueOverflowOption = Lookup.lookup(ASYNC_QUEUE_OVERFLOW_OPTION, dsn);
if (!Util.isNullOrEmpty(asyncQueueOverflowOption)) {
overflowName = asyncQueueOverflowOption.toLowerCase();
}
RejectedExecutionHandler handler = REJECT_EXECUTION_HANDLERS.get(overflowName);
if (handler == null) {
String options = Arrays.toString(REJECT_EXECUTION_HANDLERS.keySet().toArray());
throw new RuntimeException("RejectedExecutionHandler not found: '" + overflowName
+ "', valid choices are: " + options);
}
return handler;
} }
|
public class class_name {
protected RejectedExecutionHandler getRejectedExecutionHandler(Dsn dsn) {
String overflowName = ASYNC_QUEUE_OVERFLOW_DEFAULT;
String asyncQueueOverflowOption = Lookup.lookup(ASYNC_QUEUE_OVERFLOW_OPTION, dsn);
if (!Util.isNullOrEmpty(asyncQueueOverflowOption)) {
overflowName = asyncQueueOverflowOption.toLowerCase(); // depends on control dependency: [if], data = [none]
}
RejectedExecutionHandler handler = REJECT_EXECUTION_HANDLERS.get(overflowName);
if (handler == null) {
String options = Arrays.toString(REJECT_EXECUTION_HANDLERS.keySet().toArray());
throw new RuntimeException("RejectedExecutionHandler not found: '" + overflowName
+ "', valid choices are: " + options);
}
return handler;
} }
|
public class class_name {
public RangeInfo subListBorders(int size) {
if (inclusive == null) throw new IllegalStateException("Should not call subListBorders on a non-inclusive aware IntRange");
int tempFrom = from;
if (tempFrom < 0) {
tempFrom += size;
}
int tempTo = to;
if (tempTo < 0) {
tempTo += size;
}
if (tempFrom > tempTo) {
return new RangeInfo(inclusive ? tempTo : tempTo + 1, tempFrom + 1, true);
}
return new RangeInfo(tempFrom, inclusive ? tempTo + 1 : tempTo, false);
} }
|
public class class_name {
public RangeInfo subListBorders(int size) {
if (inclusive == null) throw new IllegalStateException("Should not call subListBorders on a non-inclusive aware IntRange");
int tempFrom = from;
if (tempFrom < 0) {
tempFrom += size; // depends on control dependency: [if], data = [none]
}
int tempTo = to;
if (tempTo < 0) {
tempTo += size; // depends on control dependency: [if], data = [none]
}
if (tempFrom > tempTo) {
return new RangeInfo(inclusive ? tempTo : tempTo + 1, tempFrom + 1, true); // depends on control dependency: [if], data = [none]
}
return new RangeInfo(tempFrom, inclusive ? tempTo + 1 : tempTo, false);
} }
|
public class class_name {
public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// if not the label will not be shown
for (BaseModel model : _Models) {
if (!model.isIgnore()) {
Rect textBounds = new Rect();
RectF legendBounds = model.getLegendBounds();
_Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds);
model.setTextBounds(textBounds);
float centerX = legendBounds.centerX();
float centeredTextPos = centerX - (textBounds.width() / 2);
float textStartPos = centeredTextPos - textMargin;
// check if the text is too big to fit on the screen
if (centeredTextPos + textBounds.width() > _EndX - textMargin) {
model.setShowLabel(false);
} else {
// check if the current legend label overrides the label before
// if the label overrides the label before, the current label will not be shown.
// If not the label will be shown and the label position is calculated
if (textStartPos < lastX) {
if (lastX + textMargin < legendBounds.left) {
model.setLegendLabelPosition((int) (lastX + textMargin));
model.setShowLabel(true);
lastX = lastX + textMargin + textBounds.width();
} else {
model.setShowLabel(false);
}
} else {
model.setShowLabel(true);
model.setLegendLabelPosition((int) centeredTextPos);
lastX = centerX + (textBounds.width() / 2);
}
}
}
}
} }
|
public class class_name {
public static void calculateLegendInformation(List<? extends BaseModel> _Models, float _StartX, float _EndX, Paint _Paint) {
float textMargin = Utils.dpToPx(10.f);
float lastX = _StartX;
// calculate the legend label positions and check if there is enough space to display the label,
// if not the label will not be shown
for (BaseModel model : _Models) {
if (!model.isIgnore()) {
Rect textBounds = new Rect();
RectF legendBounds = model.getLegendBounds();
_Paint.getTextBounds(model.getLegendLabel(), 0, model.getLegendLabel().length(), textBounds); // depends on control dependency: [if], data = [none]
model.setTextBounds(textBounds); // depends on control dependency: [if], data = [none]
float centerX = legendBounds.centerX();
float centeredTextPos = centerX - (textBounds.width() / 2);
float textStartPos = centeredTextPos - textMargin;
// check if the text is too big to fit on the screen
if (centeredTextPos + textBounds.width() > _EndX - textMargin) {
model.setShowLabel(false); // depends on control dependency: [if], data = [none]
} else {
// check if the current legend label overrides the label before
// if the label overrides the label before, the current label will not be shown.
// If not the label will be shown and the label position is calculated
if (textStartPos < lastX) {
if (lastX + textMargin < legendBounds.left) {
model.setLegendLabelPosition((int) (lastX + textMargin)); // depends on control dependency: [if], data = [(lastX + textMargin]
model.setShowLabel(true); // depends on control dependency: [if], data = [none]
lastX = lastX + textMargin + textBounds.width(); // depends on control dependency: [if], data = [none]
} else {
model.setShowLabel(false); // depends on control dependency: [if], data = [none]
}
} else {
model.setShowLabel(true); // depends on control dependency: [if], data = [none]
model.setLegendLabelPosition((int) centeredTextPos); // depends on control dependency: [if], data = [none]
lastX = centerX + (textBounds.width() / 2); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
private boolean isDefinitelyCougarResponse(CougarHttpResponse response) {
String ident = response.getServerIdentity();
if (ident != null && ident.contains("Cougar 2")) {
return true;
}
return false;
} }
|
public class class_name {
private boolean isDefinitelyCougarResponse(CougarHttpResponse response) {
String ident = response.getServerIdentity();
if (ident != null && ident.contains("Cougar 2")) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public Object[] toArray() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
final Object[] items = this.items;
final int end = takeIndex + count;
final Object[] a = Arrays.copyOfRange(items, takeIndex, end);
if (end != putIndex)
System.arraycopy(items, 0, a, items.length - takeIndex, putIndex);
return a;
} finally {
lock.unlock();
}
} }
|
public class class_name {
public Object[] toArray() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
final Object[] items = this.items;
final int end = takeIndex + count;
final Object[] a = Arrays.copyOfRange(items, takeIndex, end);
if (end != putIndex)
System.arraycopy(items, 0, a, items.length - takeIndex, putIndex);
return a; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} }
|
public class class_name {
private void updateModelAccordingToDocker() {
try {
final ModelHelper modelHelper = new ModelHelper(context.getNodeName(), docker, factory);
final ContainerRoot dockerModel = modelHelper.docker2model(modelService.getCurrentModel());
modelService.update(dockerModel, e -> {
if (e == null) {
Log.info("Model updated based on the local Docker engine configuration");
} else {
Log.warn("Failed to update model based on the local Docker engine configuration", e);
}
});
} catch (Exception e) {
Log.warn("Failed to update model based on the local Docker engine configuration", e);
}
} }
|
public class class_name {
private void updateModelAccordingToDocker() {
try {
final ModelHelper modelHelper = new ModelHelper(context.getNodeName(), docker, factory);
final ContainerRoot dockerModel = modelHelper.docker2model(modelService.getCurrentModel());
modelService.update(dockerModel, e -> {
if (e == null) {
Log.info("Model updated based on the local Docker engine configuration"); // depends on control dependency: [try], data = [none]
} else {
Log.warn("Failed to update model based on the local Docker engine configuration", e);
}
});
} catch (Exception e) {
Log.warn("Failed to update model based on the local Docker engine configuration", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ProducerSnapshot createSnapshot(IStatsProducer producer, String intervalName){
ProducerSnapshot ret = new ProducerSnapshot();
ret.setCategory(producer.getCategory());
ret.setSubsystem(producer.getSubsystem());
ret.setProducerId(producer.getProducerId());
ret.setIntervalName(intervalName);
List<IStats> stats = producer.getStats();
if (stats!=null && stats.size()>0)
ret.setStatClassName(stats.get(0).getClass().getName());
//optimization
if (stats==null || stats.size()==0)
return ret;
List<String> cachedValueNames = stats.get(0).getAvailableValueNames();
for (IStats stat : stats){
ret.addSnapshot(createStatSnapshot(stat, intervalName, cachedValueNames));
}
return ret;
} }
|
public class class_name {
public static ProducerSnapshot createSnapshot(IStatsProducer producer, String intervalName){
ProducerSnapshot ret = new ProducerSnapshot();
ret.setCategory(producer.getCategory());
ret.setSubsystem(producer.getSubsystem());
ret.setProducerId(producer.getProducerId());
ret.setIntervalName(intervalName);
List<IStats> stats = producer.getStats();
if (stats!=null && stats.size()>0)
ret.setStatClassName(stats.get(0).getClass().getName());
//optimization
if (stats==null || stats.size()==0)
return ret;
List<String> cachedValueNames = stats.get(0).getAvailableValueNames();
for (IStats stat : stats){
ret.addSnapshot(createStatSnapshot(stat, intervalName, cachedValueNames)); // depends on control dependency: [for], data = [stat]
}
return ret;
} }
|
public class class_name {
private static String getDefaultRealm(UserRegistry _userRegistry) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "getDefaultRealm");
}
String realm = DEFAULT_REALM;
if (_userRegistry != null) {
realm = _userRegistry.getRealm();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "getDefaultRealm", realm);
}
return realm;
} }
|
public class class_name {
private static String getDefaultRealm(UserRegistry _userRegistry) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, CLASS_NAME + "getDefaultRealm"); // depends on control dependency: [if], data = [none]
}
String realm = DEFAULT_REALM;
if (_userRegistry != null) {
realm = _userRegistry.getRealm(); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, CLASS_NAME + "getDefaultRealm", realm); // depends on control dependency: [if], data = [none]
}
return realm;
} }
|
public class class_name {
public void addAliases(Map<String, String> aliases) {
notNull(aliases, "Aliases must not be null");
for (Map.Entry<String, String> entry : aliases.entrySet()) {
addAlias(entry.getKey(), entry.getValue());
}
} }
|
public class class_name {
public void addAliases(Map<String, String> aliases) {
notNull(aliases, "Aliases must not be null");
for (Map.Entry<String, String> entry : aliases.entrySet()) {
addAlias(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public ModelNode fromEntity(T entity)
{
ModelNode operation = new ModelNode();
List<PropertyBinding> properties = metaData.getBeanMetaData(getType()).getProperties();
Mutator mutator = metaData.getMutator(getType());
for(PropertyBinding property : properties)
{
String[] splitDetypedName = property.getDetypedName().split("/");
/**
* KEYS
*/
// if(property.isKey()) continue;
Object propertyValue = mutator.getValue(entity, property.getJavaName());
/**
* EXPRESSIONS
*/
if(property.doesSupportExpression())
{
String exprValue = ExpressionAdapter.getExpressionValue(
entity, property.getJavaName()
);
if(exprValue!=null)
{
operation.get(splitDetypedName).setExpression(exprValue);
continue; // expression have precedence over real values
}
}
/**
* VALUES
*/
if(propertyValue!=null)
{
try {
ModelType modelType = resolveModelType(property.getJavaTypeName());
if ((modelType == ModelType.LIST) && (property.getListType() == PropertyBinding.class)) {
operation.get(splitDetypedName).set(modelType, property.getEntityAdapterForList().fromEntityPropertyList((List) propertyValue));
} else if (modelType == ModelType.LIST) {
operation.get(splitDetypedName).set(modelType,
property.getEntityAdapterForList().fromEntityList((List) propertyValue));
} else if (modelType == ModelType.OBJECT) {
// Only Map<String, String> is supported!
Map<String, String> map = (Map<String, String>) propertyValue;
for (Map.Entry<String, String> entry : map.entrySet()) {
operation.get(splitDetypedName).get(entry.getKey()).set(entry.getValue());
}
} else {
operation.get(splitDetypedName).set(modelType, propertyValue);
}
} catch (RuntimeException e) {
throw new RuntimeException("Failed to get value "+property.getJavaName(), e);
}
}
}
return operation;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public ModelNode fromEntity(T entity)
{
ModelNode operation = new ModelNode();
List<PropertyBinding> properties = metaData.getBeanMetaData(getType()).getProperties();
Mutator mutator = metaData.getMutator(getType());
for(PropertyBinding property : properties)
{
String[] splitDetypedName = property.getDetypedName().split("/");
/**
* KEYS
*/
// if(property.isKey()) continue;
Object propertyValue = mutator.getValue(entity, property.getJavaName());
/**
* EXPRESSIONS
*/
if(property.doesSupportExpression())
{
String exprValue = ExpressionAdapter.getExpressionValue(
entity, property.getJavaName()
);
if(exprValue!=null)
{
operation.get(splitDetypedName).setExpression(exprValue);
// depends on control dependency: [if], data = [(exprValue]
continue; // expression have precedence over real values
}
}
/**
* VALUES
*/
if(propertyValue!=null)
{
try {
ModelType modelType = resolveModelType(property.getJavaTypeName());
if ((modelType == ModelType.LIST) && (property.getListType() == PropertyBinding.class)) {
operation.get(splitDetypedName).set(modelType, property.getEntityAdapterForList().fromEntityPropertyList((List) propertyValue));
// depends on control dependency: [if], data = [none]
} else if (modelType == ModelType.LIST) {
operation.get(splitDetypedName).set(modelType,
property.getEntityAdapterForList().fromEntityList((List) propertyValue));
// depends on control dependency: [if], data = [(modelType]
} else if (modelType == ModelType.OBJECT) {
// Only Map<String, String> is supported!
Map<String, String> map = (Map<String, String>) propertyValue;
for (Map.Entry<String, String> entry : map.entrySet()) {
operation.get(splitDetypedName).get(entry.getKey()).set(entry.getValue());
// depends on control dependency: [for], data = [entry]
}
} else {
operation.get(splitDetypedName).set(modelType, propertyValue);
// depends on control dependency: [if], data = [(modelType]
}
} catch (RuntimeException e) {
throw new RuntimeException("Failed to get value "+property.getJavaName(), e);
}
// depends on control dependency: [catch], data = [none]
}
}
return operation;
} }
|
public class class_name {
private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException {
Folder childFolder = null;
// get existing if any
ItemIterable<CmisObject> children = parentFolder.getChildren();
if (children.iterator().hasNext()) {
for (CmisObject cmisObject : children) {
if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) {
log.debug("Found '{}' folder.", folderName);
return childFolder = (Folder)cmisObject;
}
}
}
// Create new folder (requires at least type id and name of the folder)
log.debug("'{}' folder not found, about to create...", folderName);
Map<String, String> folderProps = new HashMap<String, String>();
folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProps.put(PropertyIds.NAME, folderName);
childFolder = parentFolder.createFolder(folderProps);
log.info("'{}' folder created!", folderName);
return childFolder;
} }
|
public class class_name {
private static Folder getOrCreateFolder(final Folder parentFolder, final String folderName) throws IOException {
Folder childFolder = null;
// get existing if any
ItemIterable<CmisObject> children = parentFolder.getChildren();
if (children.iterator().hasNext()) {
for (CmisObject cmisObject : children) {
if (cmisObject instanceof Folder && cmisObject.getName().equals(folderName)) {
log.debug("Found '{}' folder.", folderName); // depends on control dependency: [if], data = [none]
return childFolder = (Folder)cmisObject; // depends on control dependency: [if], data = [none]
}
}
}
// Create new folder (requires at least type id and name of the folder)
log.debug("'{}' folder not found, about to create...", folderName);
Map<String, String> folderProps = new HashMap<String, String>();
folderProps.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
folderProps.put(PropertyIds.NAME, folderName);
childFolder = parentFolder.createFolder(folderProps);
log.info("'{}' folder created!", folderName);
return childFolder;
} }
|
public class class_name {
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL));
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading);
writer.printedAnnotationHeading = true;
}
} }
|
public class class_name {
public void addAnnotationDetailsTreeHeader(ClassDoc classDoc,
Content memberDetailsTree) {
if (!writer.printedAnnotationHeading) {
memberDetailsTree.addContent(writer.getMarkerAnchor(
SectionName.ANNOTATION_TYPE_ELEMENT_DETAIL)); // depends on control dependency: [if], data = [none]
Content heading = HtmlTree.HEADING(HtmlConstants.DETAILS_HEADING,
writer.annotationTypeDetailsLabel);
memberDetailsTree.addContent(heading); // depends on control dependency: [if], data = [none]
writer.printedAnnotationHeading = true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void require(int len)
{
int offset = _offset;
int length = _length;
if (offset + len < length) {
return;
}
flush(_offset);
} }
|
public class class_name {
private void require(int len)
{
int offset = _offset;
int length = _length;
if (offset + len < length) {
return; // depends on control dependency: [if], data = [none]
}
flush(_offset);
} }
|
public class class_name {
public static double select(final double[] arr, int lo, int hi, final int pivot) {
while (hi > lo) {
final int j = partition(arr, lo, hi);
if (j == pivot) {
return arr[pivot];
}
if (j > pivot) {
hi = j - 1;
}
else {
lo = j + 1;
}
}
return arr[pivot];
} }
|
public class class_name {
public static double select(final double[] arr, int lo, int hi, final int pivot) {
while (hi > lo) {
final int j = partition(arr, lo, hi);
if (j == pivot) {
return arr[pivot]; // depends on control dependency: [if], data = [none]
}
if (j > pivot) {
hi = j - 1; // depends on control dependency: [if], data = [none]
}
else {
lo = j + 1; // depends on control dependency: [if], data = [none]
}
}
return arr[pivot];
} }
|
public class class_name {
public Nullness getComputedNullness(ExpressionTree e) {
if (computedNullnessMap.containsKey(e)) {
return computedNullnessMap.get(e);
} else {
return Nullness.NULLABLE;
}
} }
|
public class class_name {
public Nullness getComputedNullness(ExpressionTree e) {
if (computedNullnessMap.containsKey(e)) {
return computedNullnessMap.get(e); // depends on control dependency: [if], data = [none]
} else {
return Nullness.NULLABLE; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Deprecated
public static void changeValueCommand(final List<Command> response, final ServerAttribute attribute, final Object value) {
if (response == null) {
return;
}
if (attribute == null) {
LOG.error("Cannot change value on a null attribute to '{}'", value);
return;
}
forceChangeValue(value, response, attribute);
} }
|
public class class_name {
@Deprecated
public static void changeValueCommand(final List<Command> response, final ServerAttribute attribute, final Object value) {
if (response == null) {
return; // depends on control dependency: [if], data = [none]
}
if (attribute == null) {
LOG.error("Cannot change value on a null attribute to '{}'", value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
forceChangeValue(value, response, attribute);
} }
|
public class class_name {
public void show(int gravity, int x, int y) {
initializePopupWindow();
mPopupWindow.showAtLocation(mTrigger, gravity, x, y);
mPopupWindow.update();
// 此处如果ContentView有入场动画的话,显示动画
if (null != contentInAnimation) {
mContentView.startAnimation(contentInAnimation);
}
} }
|
public class class_name {
public void show(int gravity, int x, int y) {
initializePopupWindow();
mPopupWindow.showAtLocation(mTrigger, gravity, x, y);
mPopupWindow.update();
// 此处如果ContentView有入场动画的话,显示动画
if (null != contentInAnimation) {
mContentView.startAnimation(contentInAnimation); // depends on control dependency: [if], data = [contentInAnimation)]
}
} }
|
public class class_name {
int writeFlagAttrs(long flags) {
int acount = 0;
if ((flags & DEPRECATED) != 0) {
int alenIdx = writeAttr(names.Deprecated);
endAttr(alenIdx);
acount++;
}
return acount;
} }
|
public class class_name {
int writeFlagAttrs(long flags) {
int acount = 0;
if ((flags & DEPRECATED) != 0) {
int alenIdx = writeAttr(names.Deprecated);
endAttr(alenIdx); // depends on control dependency: [if], data = [none]
acount++; // depends on control dependency: [if], data = [none]
}
return acount;
} }
|
public class class_name {
protected void generateMethodSignature(SQLiteModelMethod method, MethodSpec.Builder methodBuilder, TypeName returnTypeName, ParameterSpec... additionalParameterSpec) {
boolean finalParameter = false;
if (method.hasLiveData() && returnTypeName.equals(method.liveDataReturnClass)) {
finalParameter = true;
}
// add parameter for method
for (Pair<String, TypeName> item : method.getParameters()) {
ParameterSpec.Builder builder = ParameterSpec.builder(item.value1, item.value0);
if (finalParameter) {
builder.addModifiers(Modifier.FINAL);
}
methodBuilder.addParameter(builder.build());
}
// add additional params
for (ParameterSpec item : additionalParameterSpec) {
methodBuilder.addParameter(item);
}
// add return type
methodBuilder.returns(returnTypeName);
} }
|
public class class_name {
protected void generateMethodSignature(SQLiteModelMethod method, MethodSpec.Builder methodBuilder, TypeName returnTypeName, ParameterSpec... additionalParameterSpec) {
boolean finalParameter = false;
if (method.hasLiveData() && returnTypeName.equals(method.liveDataReturnClass)) {
finalParameter = true; // depends on control dependency: [if], data = [none]
}
// add parameter for method
for (Pair<String, TypeName> item : method.getParameters()) {
ParameterSpec.Builder builder = ParameterSpec.builder(item.value1, item.value0);
if (finalParameter) {
builder.addModifiers(Modifier.FINAL); // depends on control dependency: [if], data = [none]
}
methodBuilder.addParameter(builder.build()); // depends on control dependency: [for], data = [none]
}
// add additional params
for (ParameterSpec item : additionalParameterSpec) {
methodBuilder.addParameter(item); // depends on control dependency: [for], data = [item]
}
// add return type
methodBuilder.returns(returnTypeName);
} }
|
public class class_name {
public static <E> int remove(List<E> list, Comparator<? super E> comparator, E data) {
assert list != null;
assert comparator != null;
assert data != null;
int first = 0;
int last = list.size() - 1;
while (last >= first) {
final int center = (first + last) / 2;
final E dt = list.get(center);
final int cmpR = comparator.compare(data, dt);
if (cmpR == 0) {
list.remove(center);
return center;
} else if (cmpR < 0) {
last = center - 1;
} else {
first = center + 1;
}
}
return -1;
} }
|
public class class_name {
public static <E> int remove(List<E> list, Comparator<? super E> comparator, E data) {
assert list != null;
assert comparator != null;
assert data != null;
int first = 0;
int last = list.size() - 1;
while (last >= first) {
final int center = (first + last) / 2;
final E dt = list.get(center);
final int cmpR = comparator.compare(data, dt);
if (cmpR == 0) {
list.remove(center); // depends on control dependency: [if], data = [none]
return center; // depends on control dependency: [if], data = [none]
} else if (cmpR < 0) {
last = center - 1; // depends on control dependency: [if], data = [none]
} else {
first = center + 1; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
public static byte[] readFully(InputStream in, int size, boolean closeStream) throws IOException {
// create the byte array to hold the data
byte[] bytes = new byte[size];
// read in the bytes
int offset = 0;
try {
int numRead = 0;
while (offset < size) {
numRead = in.read(bytes, offset, size - offset);
if (numRead >= 0) {
offset += numRead;
} else {
break;
}
}
} finally {
// close the input stream
if (closeStream) {
in.close();
}
}
// ensure all the bytes have been read in
if (offset < bytes.length) {
throw new IOException("Could not read requested " + size + " bytes from input stream");
}
return bytes;
} }
|
public class class_name {
public static byte[] readFully(InputStream in, int size, boolean closeStream) throws IOException {
// create the byte array to hold the data
byte[] bytes = new byte[size];
// read in the bytes
int offset = 0;
try {
int numRead = 0;
while (offset < size) {
numRead = in.read(bytes, offset, size - offset); // depends on control dependency: [while], data = [none]
if (numRead >= 0) {
offset += numRead; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
} finally {
// close the input stream
if (closeStream) {
in.close(); // depends on control dependency: [if], data = [none]
}
}
// ensure all the bytes have been read in
if (offset < bytes.length) {
throw new IOException("Could not read requested " + size + " bytes from input stream");
}
return bytes;
} }
|
public class class_name {
public EClass getEMO() {
if (emoEClass == null) {
emoEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(250);
}
return emoEClass;
} }
|
public class class_name {
public EClass getEMO() {
if (emoEClass == null) {
emoEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(250); // depends on control dependency: [if], data = [none]
}
return emoEClass;
} }
|
public class class_name {
@CheckReturnValue
private boolean loadMasterKillSwitchFile(@Nonnull File f) {
try {
if (!f.exists()) return true;
return Boolean.parseBoolean(FileUtils.readFileToString(f).trim());
} catch (IOException e) {
LOGGER.log(WARNING, "Failed to read "+f, e);
return false;
}
} }
|
public class class_name {
@CheckReturnValue
private boolean loadMasterKillSwitchFile(@Nonnull File f) {
try {
if (!f.exists()) return true;
return Boolean.parseBoolean(FileUtils.readFileToString(f).trim()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.log(WARNING, "Failed to read "+f, e);
return false;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected long calculateSize(Object msg) {
if (msg instanceof ByteBuf) {
return ((ByteBuf) msg).readableBytes();
}
if (msg instanceof ByteBufHolder) {
return ((ByteBufHolder) msg).content().readableBytes();
}
return -1;
} }
|
public class class_name {
protected long calculateSize(Object msg) {
if (msg instanceof ByteBuf) {
return ((ByteBuf) msg).readableBytes(); // depends on control dependency: [if], data = [none]
}
if (msg instanceof ByteBufHolder) {
return ((ByteBufHolder) msg).content().readableBytes(); // depends on control dependency: [if], data = [none]
}
return -1;
} }
|
public class class_name {
@FFDCIgnore(InvocationTargetException.class)
Object getDB(String databaseName) throws Exception {
final boolean trace = TraceComponent.isAnyTracingEnabled();
lock.readLock().lock();
try {
if (mongoClient == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
try {
if (mongoClient == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Object db = MongoClient_getDB.invoke(mongoClient, databaseName);
// authentication
String user = (String) props.get(USER);
if (user != null) {
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "already authenticated");
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "authenticate as: " + user);
SerializableProtectedString password = (SerializableProtectedString) props.get(PASSWORD);
String pwdStr = password == null ? null : String.valueOf(password.getChars());
pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr);
char[] pwdChars = pwdStr == null ? null : pwdStr.toCharArray();
try {
if (!(Boolean) DB_authenticate.invoke(db, user, pwdChars))
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first");
} else
throw new IllegalArgumentException(Tr.formatMessage(tc, "CWKKD0012.authentication.error", MONGO, id, databaseName));
} catch (InvocationTargetException x) {
// If already authenticated, Mongo raises:
// IllegalStateException: can't authenticate twice on the same database
// Maybe another thread did the authentication right after we checked, so check again.
Throwable cause = x.getCause();
if (cause instanceof IllegalStateException && (Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first", cause);
} else
throw cause;
}
}
} else if (useCertAuth) {
// If we specified a certificate we will already have used the client constructor that
// specified the credential so if we have got to here we are already authenticated and
// JIT should remove this so it will not be an overhead.
}
return db;
} catch (Throwable x) {
// rethrowing the exception allows it to be captured in FFDC and traced automatically
x = x instanceof InvocationTargetException ? x.getCause() : x;
if (x instanceof Exception)
throw (Exception) x;
else if (x instanceof Error)
throw (Error) x;
else
throw new RuntimeException(x);
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
@FFDCIgnore(InvocationTargetException.class)
Object getDB(String databaseName) throws Exception {
final boolean trace = TraceComponent.isAnyTracingEnabled();
lock.readLock().lock();
try {
if (mongoClient == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock(); // depends on control dependency: [if], data = [none]
lock.writeLock().lock(); // depends on control dependency: [if], data = [none]
try {
if (mongoClient == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Object db = MongoClient_getDB.invoke(mongoClient, databaseName);
// authentication
String user = (String) props.get(USER);
if (user != null) {
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "already authenticated");
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "authenticate as: " + user);
SerializableProtectedString password = (SerializableProtectedString) props.get(PASSWORD);
String pwdStr = password == null ? null : String.valueOf(password.getChars());
pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr); // depends on control dependency: [if], data = [none]
char[] pwdChars = pwdStr == null ? null : pwdStr.toCharArray();
try {
if (!(Boolean) DB_authenticate.invoke(db, user, pwdChars))
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first");
} else
throw new IllegalArgumentException(Tr.formatMessage(tc, "CWKKD0012.authentication.error", MONGO, id, databaseName));
} catch (InvocationTargetException x) {
// If already authenticated, Mongo raises:
// IllegalStateException: can't authenticate twice on the same database
// Maybe another thread did the authentication right after we checked, so check again.
Throwable cause = x.getCause();
if (cause instanceof IllegalStateException && (Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first", cause);
} else
throw cause;
} // depends on control dependency: [catch], data = [none]
}
} else if (useCertAuth) {
// If we specified a certificate we will already have used the client constructor that
// specified the credential so if we have got to here we are already authenticated and
// JIT should remove this so it will not be an overhead.
}
return db;
} catch (Throwable x) {
// rethrowing the exception allows it to be captured in FFDC and traced automatically
x = x instanceof InvocationTargetException ? x.getCause() : x;
if (x instanceof Exception)
throw (Exception) x;
else if (x instanceof Error)
throw (Error) x;
else
throw new RuntimeException(x);
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
protected String[] getSpringConfigLocations() {
String[] locations = getStandardConfigLocations();
for (int i = 0; i < locations.length; i++) {
String extension = StringUtils.getFilenameExtension(locations[i]);
locations[i] = locations[i].substring(0,
locations[i].length() - extension.length() - 1) + "-spring."
+ extension;
}
return locations;
} }
|
public class class_name {
protected String[] getSpringConfigLocations() {
String[] locations = getStandardConfigLocations();
for (int i = 0; i < locations.length; i++) {
String extension = StringUtils.getFilenameExtension(locations[i]);
locations[i] = locations[i].substring(0,
locations[i].length() - extension.length() - 1) + "-spring."
+ extension; // depends on control dependency: [for], data = [i]
}
return locations;
} }
|
public class class_name {
public void marshall(DescribeCertificateAuthorityRequest describeCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) {
if (describeCertificateAuthorityRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeCertificateAuthorityRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeCertificateAuthorityRequest describeCertificateAuthorityRequest, ProtocolMarshaller protocolMarshaller) {
if (describeCertificateAuthorityRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeCertificateAuthorityRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_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 Deque<QueueItem> getItemQueue() {
if (itemQueue == null) {
itemQueue = new LinkedList<QueueItem>();
if (backupMap != null && !backupMap.isEmpty()) {
List<QueueItem> values = new ArrayList<QueueItem>(backupMap.values());
Collections.sort(values);
itemQueue.addAll(values);
QueueItem lastItem = itemQueue.peekLast();
if (lastItem != null) {
setId(lastItem.itemId + ID_PROMOTION_OFFSET);
}
backupMap.clear();
backupMap = null;
}
if (!txMap.isEmpty()) {
long maxItemId = Long.MIN_VALUE;
for (TxQueueItem item : txMap.values()) {
maxItemId = Math.max(maxItemId, item.itemId);
}
setId(maxItemId + ID_PROMOTION_OFFSET);
}
}
return itemQueue;
} }
|
public class class_name {
public Deque<QueueItem> getItemQueue() {
if (itemQueue == null) {
itemQueue = new LinkedList<QueueItem>(); // depends on control dependency: [if], data = [none]
if (backupMap != null && !backupMap.isEmpty()) {
List<QueueItem> values = new ArrayList<QueueItem>(backupMap.values());
Collections.sort(values); // depends on control dependency: [if], data = [none]
itemQueue.addAll(values); // depends on control dependency: [if], data = [none]
QueueItem lastItem = itemQueue.peekLast();
if (lastItem != null) {
setId(lastItem.itemId + ID_PROMOTION_OFFSET); // depends on control dependency: [if], data = [(lastItem]
}
backupMap.clear(); // depends on control dependency: [if], data = [none]
backupMap = null; // depends on control dependency: [if], data = [none]
}
if (!txMap.isEmpty()) {
long maxItemId = Long.MIN_VALUE;
for (TxQueueItem item : txMap.values()) {
maxItemId = Math.max(maxItemId, item.itemId); // depends on control dependency: [for], data = [item]
}
setId(maxItemId + ID_PROMOTION_OFFSET); // depends on control dependency: [if], data = [none]
}
}
return itemQueue;
} }
|
public class class_name {
public ModifyFpgaImageAttributeRequest withUserIds(String... userIds) {
if (this.userIds == null) {
setUserIds(new com.amazonaws.internal.SdkInternalList<String>(userIds.length));
}
for (String ele : userIds) {
this.userIds.add(ele);
}
return this;
} }
|
public class class_name {
public ModifyFpgaImageAttributeRequest withUserIds(String... userIds) {
if (this.userIds == null) {
setUserIds(new com.amazonaws.internal.SdkInternalList<String>(userIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : userIds) {
this.userIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static String getCodePoint(final StatusFontIcon statusFontIcon) {
if (statusFontIcon == null) {
return null;
}
return statusFontIcon.getFontIcon() != null ? Integer.toString(statusFontIcon.getFontIcon().getCodepoint())
: null;
} }
|
public class class_name {
public static String getCodePoint(final StatusFontIcon statusFontIcon) {
if (statusFontIcon == null) {
return null; // depends on control dependency: [if], data = [none]
}
return statusFontIcon.getFontIcon() != null ? Integer.toString(statusFontIcon.getFontIcon().getCodepoint())
: null;
} }
|
public class class_name {
public static boolean checkDependencyPlugin(Context context, Class... plugins) {
for (Class plugin : plugins) {
if (getPluginIndex(context, plugin) < 0) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean checkDependencyPlugin(Context context, Class... plugins) {
for (Class plugin : plugins) {
if (getPluginIndex(context, plugin) < 0) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
// Propogate the stop stimulus to the destination handlers...
DestinationTypeFilter destFilter = new DestinationTypeFilter();
destFilter.LOCAL = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
//busses
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
//links
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start();
}
itr.finished();
// Explicitly start the async deletion thread.
startAsynchDeletion();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} }
|
public class class_name {
public void start()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "start");
// Propogate the stop stimulus to the destination handlers...
DestinationTypeFilter destFilter = new DestinationTypeFilter();
destFilter.LOCAL = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start(); // depends on control dependency: [while], data = [none]
}
itr.finished();
//busses
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start(); // depends on control dependency: [while], data = [none]
}
itr.finished();
//links
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.start(); // depends on control dependency: [while], data = [none]
}
itr.finished();
// Explicitly start the async deletion thread.
startAsynchDeletion();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "start");
} }
|
public class class_name {
public static boolean hasQuotes( String input ) {
if( input == null || input.length() < 2 ){
return false;
}
return input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ||
input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DOUBLE_QUOTE );
} }
|
public class class_name {
public static boolean hasQuotes( String input ) {
if( input == null || input.length() < 2 ){
return false; // depends on control dependency: [if], data = [none]
}
return input.startsWith( SINGLE_QUOTE ) && input.endsWith( SINGLE_QUOTE ) ||
input.startsWith( DOUBLE_QUOTE ) && input.endsWith( DOUBLE_QUOTE );
} }
|
public class class_name {
@Override
public void resolve(InjectionBinding<EJB> binding)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolve : " + binding);
Reference ref = null;
EJBInjectionBinding ejbBinding = (EJBInjectionBinding) binding;
String refJndiName = ejbBinding.getJndiName();
String interfaceName = ejbBinding.getInjectionClassTypeName();
// -----------------------------------------------------------------------
// First, check the ejb-ref binding map to see if a binding was provided
// for this reference/injection. If a binding was provided, then an
// IndirectJndiLookup Reference is bound into naming... to re-direct
// the lookup to the 'bound' name. d440604.2
// -----------------------------------------------------------------------
String boundToJndiName = ejbBinding.ivBindingName; // d681743
// -----------------------------------------------------------------------
// If a JNDI name was not provided in the binding file, then also check
// the new lookup attribute on @EJB (or lookup-name in xml). F743-21028.4
// -----------------------------------------------------------------------
if (boundToJndiName == null)
{
boundToJndiName = ejbBinding.ivLookup;
// An empty string may be 'normal' here... since it is the annotation
// default, but also a customer may specify it in XML to disable the
// annotation setting. If empty, use ejb-link or auto-link.
if (boundToJndiName != null && boundToJndiName.equals("")) {
boundToJndiName = null;
}
}
// -----------------------------------------------------------------------
// If override reference factories have been registered for this processor
// then call each factory until one of them provides an override (i.e. a
// non-null value). If none of the factories provide an override, then
// fall through and perform normal resolve processing. F1339-9050
// -----------------------------------------------------------------------
if (ivOverrideReferenceFactories != null &&
// F743-32443 - We can only check for override processors if we have
// an interface name and a class loader. Otherwise, we defer the
// checking and use a different object factory. See below.
interfaceName != null && ejbBinding.ivClassLoader != null)
{
Class<?> injectType = ejbBinding.getInjectionClassTypeWithException();
for (OverrideReferenceFactory<EJB> factory : ivOverrideReferenceFactories)
{
// d696076 - Use J2EEName for runtime data structures. We know
// J2EEName is non-null with non-null app/module because injectType
// is checked for null above, which means we have a class loader,
// which means this is not a non-java:comp code path.
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
ref = factory.createReference(j2eeName.getApplication(),
j2eeName.getModule(),
ejbBinding.ivBeanName,
refJndiName,
injectType,
boundToJndiName,
ejbBinding.getAnnotation());
if (ref != null)
{
binding.setObjects(null, ref);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
return;
}
}
}
// -----------------------------------------------------------------------
// If a binding was provided, then an IndirectJndiLookup Reference is
// bound into naming... to re-direct the lookup to the 'bound' name.
// -----------------------------------------------------------------------
if (boundToJndiName != null)
{
if (ejbBinding.ivEjbLocalRef &&
!boundToJndiName.startsWith("java:") && // F743-21028.4
!boundToJndiName.startsWith("ejblocal:"))
{
boundToJndiName = "ejblocal:".concat(boundToJndiName);
}
String beanInterfaceName = ejbBinding.getInjectionClassTypeName();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "resolve : binding : " + refJndiName +
" -> " + boundToJndiName + " : type = " + beanInterfaceName);
ref = ivIndirectLookupFactory.createIndirectJndiLookup(refJndiName,
boundToJndiName,
beanInterfaceName);
binding.setObjects(null, ref); // F48603.4
// Save the binding and IndirectLookupFactory. If the binding name is
// later found to be ambiguous, we can try to disambiguate by
// appending the interface name.
ejbBinding.ivBoundToJndiName = boundToJndiName;
ejbBinding.ivIndirectLookupFactory = ivIndirectLookupFactory;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
return;
}
// -----------------------------------------------------------------------
// Second, no binding, so this ejb ref will be resolved either through
// ejblink/beanName or auto-link. Process the ref data and bind an
// EJBLinkObjectFactory Reference.
// -----------------------------------------------------------------------
if (ejbBinding.getInjectionScope() == InjectionScope.GLOBAL) // d696076
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve: missing binding");
super.ivMissingBindings.add(refJndiName);
return;
}
if (ejbBinding.ivBeanInterface ||
ejbBinding.ivHomeInterface) // F743-32443
{
String beanInterfaceName;
String homeInterfaceName;
if (ejbBinding.ivHomeInterface)
{
beanInterfaceName = null;
homeInterfaceName = interfaceName;
}
else
{
beanInterfaceName = interfaceName != null ? interfaceName : "java.lang.Object"; // d668376
homeInterfaceName = null;
}
// Use the EJBLink Reference factory (which may be overridden) to
// create the Reference object that will be bound into Naming and
// to resolve the object to inject. d440604.2
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
ref = ivEJBLinkRefFactory.createEJBLinkReference
(refJndiName, // d655264.1
j2eeName.getApplication(),
j2eeName.getModule(),
j2eeName.getComponent(),
ejbBinding.ivBeanName,
beanInterfaceName,
homeInterfaceName,
ejbBinding.ivEjbLocalRef,
ejbBinding.ivEjbRef);
/**
* If the injection type is specified and we have no class loader, we
* were unable to check OverrideReferenceFactory. Wrap the reference
* just created in another reference that will check the override
* factories when looked up.
*/
if (ivOverrideReferenceFactories != null &&
interfaceName != null && ejbBinding.ivClassLoader == null)
{
throw new UnsupportedOperationException();
}
binding.setObjects(null, ref);
}
else
{
// This may occur if the customer has incorrectly coded either no
// home or interface class, or the class names were coded incorrectly
// and do not exist / cannot be loaded. d448539
Tr.error(tc, "EJB_REF_OR_EJB_LOCAL_REF_IS_NOT_SPECIFIED_CORRECTLY_CWNEN0026E", refJndiName);
throw new InjectionConfigurationException("The " + refJndiName + " Enterprise JavaBean (EJB) home and " +
"remote or local-home and local elements are either missing " +
"or could not be resolved");
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
} }
|
public class class_name {
@Override
public void resolve(InjectionBinding<EJB> binding)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolve : " + binding);
Reference ref = null;
EJBInjectionBinding ejbBinding = (EJBInjectionBinding) binding;
String refJndiName = ejbBinding.getJndiName();
String interfaceName = ejbBinding.getInjectionClassTypeName();
// -----------------------------------------------------------------------
// First, check the ejb-ref binding map to see if a binding was provided
// for this reference/injection. If a binding was provided, then an
// IndirectJndiLookup Reference is bound into naming... to re-direct
// the lookup to the 'bound' name. d440604.2
// -----------------------------------------------------------------------
String boundToJndiName = ejbBinding.ivBindingName; // d681743
// -----------------------------------------------------------------------
// If a JNDI name was not provided in the binding file, then also check
// the new lookup attribute on @EJB (or lookup-name in xml). F743-21028.4
// -----------------------------------------------------------------------
if (boundToJndiName == null)
{
boundToJndiName = ejbBinding.ivLookup;
// An empty string may be 'normal' here... since it is the annotation
// default, but also a customer may specify it in XML to disable the
// annotation setting. If empty, use ejb-link or auto-link.
if (boundToJndiName != null && boundToJndiName.equals("")) {
boundToJndiName = null;
}
}
// -----------------------------------------------------------------------
// If override reference factories have been registered for this processor
// then call each factory until one of them provides an override (i.e. a
// non-null value). If none of the factories provide an override, then
// fall through and perform normal resolve processing. F1339-9050
// -----------------------------------------------------------------------
if (ivOverrideReferenceFactories != null &&
// F743-32443 - We can only check for override processors if we have
// an interface name and a class loader. Otherwise, we defer the
// checking and use a different object factory. See below.
interfaceName != null && ejbBinding.ivClassLoader != null)
{
Class<?> injectType = ejbBinding.getInjectionClassTypeWithException();
for (OverrideReferenceFactory<EJB> factory : ivOverrideReferenceFactories)
{
// d696076 - Use J2EEName for runtime data structures. We know
// J2EEName is non-null with non-null app/module because injectType
// is checked for null above, which means we have a class loader,
// which means this is not a non-java:comp code path.
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
ref = factory.createReference(j2eeName.getApplication(),
j2eeName.getModule(),
ejbBinding.ivBeanName,
refJndiName,
injectType,
boundToJndiName,
ejbBinding.getAnnotation());
if (ref != null)
{
binding.setObjects(null, ref);
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
return;
}
}
}
// -----------------------------------------------------------------------
// If a binding was provided, then an IndirectJndiLookup Reference is
// bound into naming... to re-direct the lookup to the 'bound' name.
// -----------------------------------------------------------------------
if (boundToJndiName != null)
{
if (ejbBinding.ivEjbLocalRef &&
!boundToJndiName.startsWith("java:") && // F743-21028.4
!boundToJndiName.startsWith("ejblocal:"))
{
boundToJndiName = "ejblocal:".concat(boundToJndiName); // depends on control dependency: [if], data = [none]
}
String beanInterfaceName = ejbBinding.getInjectionClassTypeName();
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "resolve : binding : " + refJndiName +
" -> " + boundToJndiName + " : type = " + beanInterfaceName);
ref = ivIndirectLookupFactory.createIndirectJndiLookup(refJndiName,
boundToJndiName,
beanInterfaceName);
binding.setObjects(null, ref); // F48603.4
// Save the binding and IndirectLookupFactory. If the binding name is
// later found to be ambiguous, we can try to disambiguate by
// appending the interface name.
ejbBinding.ivBoundToJndiName = boundToJndiName;
ejbBinding.ivIndirectLookupFactory = ivIndirectLookupFactory;
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
return;
}
// -----------------------------------------------------------------------
// Second, no binding, so this ejb ref will be resolved either through
// ejblink/beanName or auto-link. Process the ref data and bind an
// EJBLinkObjectFactory Reference.
// -----------------------------------------------------------------------
if (ejbBinding.getInjectionScope() == InjectionScope.GLOBAL) // d696076
{
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve: missing binding");
super.ivMissingBindings.add(refJndiName);
return;
}
if (ejbBinding.ivBeanInterface ||
ejbBinding.ivHomeInterface) // F743-32443
{
String beanInterfaceName;
String homeInterfaceName;
if (ejbBinding.ivHomeInterface)
{
beanInterfaceName = null; // depends on control dependency: [if], data = [none]
homeInterfaceName = interfaceName; // depends on control dependency: [if], data = [none]
}
else
{
beanInterfaceName = interfaceName != null ? interfaceName : "java.lang.Object"; // d668376 // depends on control dependency: [if], data = [none]
homeInterfaceName = null; // depends on control dependency: [if], data = [none]
}
// Use the EJBLink Reference factory (which may be overridden) to
// create the Reference object that will be bound into Naming and
// to resolve the object to inject. d440604.2
J2EEName j2eeName = ivNameSpaceConfig.getJ2EEName();
ref = ivEJBLinkRefFactory.createEJBLinkReference
(refJndiName, // d655264.1
j2eeName.getApplication(),
j2eeName.getModule(),
j2eeName.getComponent(),
ejbBinding.ivBeanName,
beanInterfaceName,
homeInterfaceName,
ejbBinding.ivEjbLocalRef,
ejbBinding.ivEjbRef);
/**
* If the injection type is specified and we have no class loader, we
* were unable to check OverrideReferenceFactory. Wrap the reference
* just created in another reference that will check the override
* factories when looked up.
*/
if (ivOverrideReferenceFactories != null &&
interfaceName != null && ejbBinding.ivClassLoader == null)
{
throw new UnsupportedOperationException();
}
binding.setObjects(null, ref);
}
else
{
// This may occur if the customer has incorrectly coded either no
// home or interface class, or the class names were coded incorrectly
// and do not exist / cannot be loaded. d448539
Tr.error(tc, "EJB_REF_OR_EJB_LOCAL_REF_IS_NOT_SPECIFIED_CORRECTLY_CWNEN0026E", refJndiName);
throw new InjectionConfigurationException("The " + refJndiName + " Enterprise JavaBean (EJB) home and " +
"remote or local-home and local elements are either missing " +
"or could not be resolved");
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolve", binding);
} }
|
public class class_name {
public void computeIndicators ()
{
Map<SceneObject, SceneObjectIndicator> _unupdated = Maps.newHashMap(_indicators);
for (int ii = 0, nn = _vizobjs.size(); ii < nn; ii++) {
SceneObject scobj = _vizobjs.get(ii);
String action = scobj.info.action;
// if the object has no action, skip it
if (StringUtil.isBlank(action)) {
continue;
}
// if we have an object action handler, possibly let them veto
// the display of this tooltip and action
ObjectActionHandler oah = ObjectActionHandler.lookup(action);
if (oah != null && !oah.isVisible(action)) {
continue;
}
String tiptext = getTipText(scobj, action);
if (tiptext != null) {
Icon icon = getTipIcon(scobj, action);
SceneObjectIndicator indic = _unupdated.remove(scobj);
if (indic == null) {
// let the object action handler create the indicator if it exists, otherwise
// just use a regular tip
if (oah != null) {
indic = oah.createIndicator(this, tiptext, icon);
} else {
indic = new SceneObjectTip(tiptext, icon);
}
_indicators.put(scobj, indic);
} else {
indic.update(icon, tiptext);
}
dirtyIndicator(indic);
}
}
// clear out any no longer used indicators
for (SceneObject toremove : _unupdated.keySet()) {
SceneObjectIndicator indic = _indicators.remove(toremove);
indic.removed();
dirtyIndicator(indic);
}
_indicatorsLaidOut = false;
} }
|
public class class_name {
public void computeIndicators ()
{
Map<SceneObject, SceneObjectIndicator> _unupdated = Maps.newHashMap(_indicators);
for (int ii = 0, nn = _vizobjs.size(); ii < nn; ii++) {
SceneObject scobj = _vizobjs.get(ii);
String action = scobj.info.action;
// if the object has no action, skip it
if (StringUtil.isBlank(action)) {
continue;
}
// if we have an object action handler, possibly let them veto
// the display of this tooltip and action
ObjectActionHandler oah = ObjectActionHandler.lookup(action);
if (oah != null && !oah.isVisible(action)) {
continue;
}
String tiptext = getTipText(scobj, action);
if (tiptext != null) {
Icon icon = getTipIcon(scobj, action);
SceneObjectIndicator indic = _unupdated.remove(scobj);
if (indic == null) {
// let the object action handler create the indicator if it exists, otherwise
// just use a regular tip
if (oah != null) {
indic = oah.createIndicator(this, tiptext, icon); // depends on control dependency: [if], data = [none]
} else {
indic = new SceneObjectTip(tiptext, icon); // depends on control dependency: [if], data = [none]
}
_indicators.put(scobj, indic); // depends on control dependency: [if], data = [none]
} else {
indic.update(icon, tiptext); // depends on control dependency: [if], data = [none]
}
dirtyIndicator(indic); // depends on control dependency: [if], data = [none]
}
}
// clear out any no longer used indicators
for (SceneObject toremove : _unupdated.keySet()) {
SceneObjectIndicator indic = _indicators.remove(toremove);
indic.removed(); // depends on control dependency: [for], data = [none]
dirtyIndicator(indic); // depends on control dependency: [for], data = [none]
}
_indicatorsLaidOut = false;
} }
|
public class class_name {
private void traceWriterInfo( Object value, JsonWriter writer ) {
if ( getLogger().isLoggable( Level.INFO ) ) {
getLogger().log( Level.INFO, "Error on value <" + value + ">. Current output : <" + writer.getOutput() + ">" );
}
} }
|
public class class_name {
private void traceWriterInfo( Object value, JsonWriter writer ) {
if ( getLogger().isLoggable( Level.INFO ) ) {
getLogger().log( Level.INFO, "Error on value <" + value + ">. Current output : <" + writer.getOutput() + ">" ); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void sendOutgoingMessages (long iterStamp)
{
// first attempt to send any messages waiting on the overflow queues
if (_oflowqs.size() > 0) {
// do this on a snapshot as a network failure writing oflow queue messages will result
// in the queue being removed from _oflowqs via the connectionFailed() code path
for (OverflowQueue oq : _oflowqs.values().toArray(new OverflowQueue[_oflowqs.size()])) {
try {
// try writing the messages in this overflow queue
if (oq.writeOverflowMessages(iterStamp)) {
// if they were all written, we can remove it
_oflowqs.remove(oq.conn);
}
} catch (IOException ioe) {
oq.conn.networkFailure(ioe);
}
}
}
// then send any new messages
Tuple<Connection, byte[]> tup;
while ((tup = _outq.getNonBlocking()) != null) {
Connection conn = tup.left;
// if an overflow queue exists for this client, go ahead and slap the message on there
// because we can't send it until all other messages in their queue have gone out
OverflowQueue oqueue = _oflowqs.get(conn);
if (oqueue != null) {
int size = oqueue.size();
if ((size > 500) && (size % 50 == 0)) {
log.warning("Aiya, big overflow queue for " + conn + "", "size", size,
"bytes", tup.right.length);
}
oqueue.add(tup.right);
continue;
}
// otherwise write the message out to the client directly
writeMessage(conn, tup.right, _oflowHandler);
}
} }
|
public class class_name {
protected void sendOutgoingMessages (long iterStamp)
{
// first attempt to send any messages waiting on the overflow queues
if (_oflowqs.size() > 0) {
// do this on a snapshot as a network failure writing oflow queue messages will result
// in the queue being removed from _oflowqs via the connectionFailed() code path
for (OverflowQueue oq : _oflowqs.values().toArray(new OverflowQueue[_oflowqs.size()])) {
try {
// try writing the messages in this overflow queue
if (oq.writeOverflowMessages(iterStamp)) {
// if they were all written, we can remove it
_oflowqs.remove(oq.conn); // depends on control dependency: [if], data = [none]
}
} catch (IOException ioe) {
oq.conn.networkFailure(ioe);
} // depends on control dependency: [catch], data = [none]
}
}
// then send any new messages
Tuple<Connection, byte[]> tup;
while ((tup = _outq.getNonBlocking()) != null) {
Connection conn = tup.left;
// if an overflow queue exists for this client, go ahead and slap the message on there
// because we can't send it until all other messages in their queue have gone out
OverflowQueue oqueue = _oflowqs.get(conn);
if (oqueue != null) {
int size = oqueue.size();
if ((size > 500) && (size % 50 == 0)) {
log.warning("Aiya, big overflow queue for " + conn + "", "size", size,
"bytes", tup.right.length); // depends on control dependency: [if], data = [none]
}
oqueue.add(tup.right); // depends on control dependency: [if], data = [none]
continue;
}
// otherwise write the message out to the client directly
writeMessage(conn, tup.right, _oflowHandler); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<TelSonstige> getTelSonstige() {
if (telSonstige == null) {
telSonstige = new ArrayList<TelSonstige>();
}
return this.telSonstige;
} }
|
public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:50:55+02:00", comments = "JAXB RI v2.2.11")
public List<TelSonstige> getTelSonstige() {
if (telSonstige == null) {
telSonstige = new ArrayList<TelSonstige>(); // depends on control dependency: [if], data = [none]
}
return this.telSonstige;
} }
|
public class class_name {
public void insert_ul(final DeviceData deviceData, final long[] argin) {
final int[] val = new int[argin.length];
for (int i = 0 ; i<argin.length ; i++) {
val[i] = (int) (argin[i] & 0xFFFFFFFF);
}
DevVarULongArrayHelper.insert(deviceData.getAny(), val);
} }
|
public class class_name {
public void insert_ul(final DeviceData deviceData, final long[] argin) {
final int[] val = new int[argin.length];
for (int i = 0 ; i<argin.length ; i++) {
val[i] = (int) (argin[i] & 0xFFFFFFFF); // depends on control dependency: [for], data = [i]
}
DevVarULongArrayHelper.insert(deviceData.getAny(), val);
} }
|
public class class_name {
public void marshall(StepExecutionFilter stepExecutionFilter, ProtocolMarshaller protocolMarshaller) {
if (stepExecutionFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stepExecutionFilter.getKey(), KEY_BINDING);
protocolMarshaller.marshall(stepExecutionFilter.getValues(), VALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(StepExecutionFilter stepExecutionFilter, ProtocolMarshaller protocolMarshaller) {
if (stepExecutionFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stepExecutionFilter.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stepExecutionFilter.getValues(), VALUES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcStructuralPointAction() {
if (ifcStructuralPointActionEClass == null) {
ifcStructuralPointActionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(655);
}
return ifcStructuralPointActionEClass;
} }
|
public class class_name {
@Override
public EClass getIfcStructuralPointAction() {
if (ifcStructuralPointActionEClass == null) {
ifcStructuralPointActionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(655);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralPointActionEClass;
} }
|
public class class_name {
public void add(final OrchestrationShardingSchema orchestrationShardingSchema) {
String schemaName = orchestrationShardingSchema.getSchemaName();
if (!schemaGroup.containsKey(schemaName)) {
schemaGroup.put(schemaName, new LinkedList<String>());
}
schemaGroup.get(schemaName).add(orchestrationShardingSchema.getDataSourceName());
} }
|
public class class_name {
public void add(final OrchestrationShardingSchema orchestrationShardingSchema) {
String schemaName = orchestrationShardingSchema.getSchemaName();
if (!schemaGroup.containsKey(schemaName)) {
schemaGroup.put(schemaName, new LinkedList<String>()); // depends on control dependency: [if], data = [none]
}
schemaGroup.get(schemaName).add(orchestrationShardingSchema.getDataSourceName());
} }
|
public class class_name {
protected KafkaQueueFactory<T, ID, DATA> setDefaultKafkaClient(KafkaClient kafkaClient,
boolean setMyOwnKafkaClient) {
if (this.defaultKafkaClient != null && myOwnKafkaClient) {
this.defaultKafkaClient.destroy();
}
this.defaultKafkaClient = kafkaClient;
myOwnKafkaClient = setMyOwnKafkaClient;
return this;
} }
|
public class class_name {
protected KafkaQueueFactory<T, ID, DATA> setDefaultKafkaClient(KafkaClient kafkaClient,
boolean setMyOwnKafkaClient) {
if (this.defaultKafkaClient != null && myOwnKafkaClient) {
this.defaultKafkaClient.destroy(); // depends on control dependency: [if], data = [none]
}
this.defaultKafkaClient = kafkaClient;
myOwnKafkaClient = setMyOwnKafkaClient;
return this;
} }
|
public class class_name {
public static <K,V> Map<K,V> mergeMaps(Map<K, V> map1, Map<K, V> map2) {
Map<K, V> answer = new HashMap<>();
if (map2 != null) {
answer.putAll(map2);
}
if (map1 != null) {
answer.putAll(map1);
}
return answer;
} }
|
public class class_name {
public static <K,V> Map<K,V> mergeMaps(Map<K, V> map1, Map<K, V> map2) {
Map<K, V> answer = new HashMap<>();
if (map2 != null) {
answer.putAll(map2); // depends on control dependency: [if], data = [(map2]
}
if (map1 != null) {
answer.putAll(map1); // depends on control dependency: [if], data = [(map1]
}
return answer;
} }
|
public class class_name {
protected void resolveAndDispatch (final ChatChannel channel)
{
NodeObject.Lock lock = new NodeObject.Lock("ChatChannel", channel.getLockName());
_peerMan.performWithLock(lock, new PeerManager.LockedOperation() {
public void run () {
((CrowdNodeObject)_peerMan.getNodeObject()).addToHostedChannels(channel);
finishResolveAndDispatch(channel);
}
public void fail (String peerName) {
final List<UserMessage> msgs = _resolving.remove(channel);
if (peerName == null) {
log.warning("Failed to resolve chat channel due to lock failure",
"channel", channel);
} else {
// some other peer resolved this channel first, so forward any queued messages
// directly to that node
_peerMan.invokeNodeAction(peerName, new ChannelAction(channel) {
@Override protected void execute () {
for (final UserMessage msg : msgs) {
_channelMan.dispatchSpeak(_channel, msg);
}
}
});
}
}
});
} }
|
public class class_name {
protected void resolveAndDispatch (final ChatChannel channel)
{
NodeObject.Lock lock = new NodeObject.Lock("ChatChannel", channel.getLockName());
_peerMan.performWithLock(lock, new PeerManager.LockedOperation() {
public void run () {
((CrowdNodeObject)_peerMan.getNodeObject()).addToHostedChannels(channel);
finishResolveAndDispatch(channel);
}
public void fail (String peerName) {
final List<UserMessage> msgs = _resolving.remove(channel);
if (peerName == null) {
log.warning("Failed to resolve chat channel due to lock failure",
"channel", channel); // depends on control dependency: [if], data = [none]
} else {
// some other peer resolved this channel first, so forward any queued messages
// directly to that node
_peerMan.invokeNodeAction(peerName, new ChannelAction(channel) {
@Override protected void execute () {
for (final UserMessage msg : msgs) {
_channelMan.dispatchSpeak(_channel, msg); // depends on control dependency: [for], data = [msg]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
public void notifyReceiveAllowed(DestinationHandler destinationHandler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notifyReceiveAllowed", new Object[] {destinationHandler});
if(isPubSub())
{
// Notify consumers on this localization
SubscriptionTypeFilter filter = new SubscriptionTypeFilter();
filter.LOCAL = Boolean.TRUE;
SIMPIterator itr = getSubscriptionIndex().iterator(filter);
while(itr.hasNext())
{
ControllableSubscription subscription = (ControllableSubscription)itr.next();
ConsumerDispatcher cd = (ConsumerDispatcher)subscription.getOutputHandler();
if(cd != null)
cd.notifyReceiveAllowed(destinationHandler);
}
itr.finished();
}
else
{
//tell the local consumer dispatcher that this destinations receiveAllowed has changed
ConsumerDispatcher cm = (ConsumerDispatcher)getLocalPtoPConsumerManager();
if (cm != null)
{
cm.notifyReceiveAllowed(destinationHandler);
}
}
//tell the any RME remote consumer dispatchers that this destinations receiveAllowed has changed
notifyReceiveAllowedRCD(destinationHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notifyReceiveAllowed");
} }
|
public class class_name {
public void notifyReceiveAllowed(DestinationHandler destinationHandler)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "notifyReceiveAllowed", new Object[] {destinationHandler});
if(isPubSub())
{
// Notify consumers on this localization
SubscriptionTypeFilter filter = new SubscriptionTypeFilter();
filter.LOCAL = Boolean.TRUE; // depends on control dependency: [if], data = [none]
SIMPIterator itr = getSubscriptionIndex().iterator(filter);
while(itr.hasNext())
{
ControllableSubscription subscription = (ControllableSubscription)itr.next();
ConsumerDispatcher cd = (ConsumerDispatcher)subscription.getOutputHandler();
if(cd != null)
cd.notifyReceiveAllowed(destinationHandler);
}
itr.finished(); // depends on control dependency: [if], data = [none]
}
else
{
//tell the local consumer dispatcher that this destinations receiveAllowed has changed
ConsumerDispatcher cm = (ConsumerDispatcher)getLocalPtoPConsumerManager();
if (cm != null)
{
cm.notifyReceiveAllowed(destinationHandler); // depends on control dependency: [if], data = [none]
}
}
//tell the any RME remote consumer dispatchers that this destinations receiveAllowed has changed
notifyReceiveAllowedRCD(destinationHandler);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "notifyReceiveAllowed");
} }
|
public class class_name {
@Override
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(file, baseURI, dataFormat, contexts);
}else{
getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts);
}
} }
|
public class class_name {
@Override
public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
if(notNull(baseURI)) {
getClient().sendAdd(file, baseURI, dataFormat, contexts); // depends on control dependency: [if], data = [none]
}else{
getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void doFinally() {
try {
// If we exposed a Reader in doStartTag(), close it.
if (varReader != null) {
// 'r' can be null if an exception was thrown...
if (r != null) {
r.close();
}
pageContext.removeAttribute(varReader, PageContext.PAGE_SCOPE);
}
} catch (IOException ex) {
// ignore it; close() failed, but there's nothing more we can do
}
} }
|
public class class_name {
public void doFinally() {
try {
// If we exposed a Reader in doStartTag(), close it.
if (varReader != null) {
// 'r' can be null if an exception was thrown...
if (r != null) {
r.close(); // depends on control dependency: [if], data = [none]
}
pageContext.removeAttribute(varReader, PageContext.PAGE_SCOPE); // depends on control dependency: [if], data = [(varReader]
}
} catch (IOException ex) {
// ignore it; close() failed, but there's nothing more we can do
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public XMLSerializer startTag(String namespace, String name) throws IOException {
if (startTagIncomplete) {
closeStartTag();
}
seenBracket = seenBracketBracket = false;
++depth;
if (doIndent && depth > 0 && seenTag) {
writeIndent();
}
seenTag = true;
setPrefixCalled = false;
startTagIncomplete = true;
if ((depth + 1) >= elName.length) {
ensureElementsCapacity();
}
//// assert namespace != null;
if (checkNamesInterned && namesInterned)
checkInterning(namespace);
elNamespace[depth] = (namesInterned || namespace == null) ? namespace : namespace.intern();
// assert name != null;
// elName[ depth ] = name;
if (checkNamesInterned && namesInterned)
checkInterning(name);
elName[depth] = (namesInterned || name == null) ? name : name.intern();
if (out == null) {
throw new IllegalStateException("setOutput() must called set before serialization can start");
}
out.write('<');
if (namespace != null) {
if (namespace.length() > 0) {
// ALEK: in future make this algo a feature on serializer
String prefix = null;
if (depth > 0 && (namespaceEnd - elNamespaceCount[depth - 1]) == 1) {
// if only one prefix was declared un-declare it if the
// prefix is already declared on parent el with the same URI
String uri = namespaceUri[namespaceEnd - 1];
if (uri == namespace || uri.equals(namespace)) {
String elPfx = namespacePrefix[namespaceEnd - 1];
// 2 == to skip predefined namesapces (xml and xmlns
// ...)
for (int pos = elNamespaceCount[depth - 1] - 1; pos >= 2; --pos) {
String pf = namespacePrefix[pos];
if (pf == elPfx || pf.equals(elPfx)) {
String n = namespaceUri[pos];
if (n == uri || n.equals(uri)) {
--namespaceEnd; // un-declare namespace:
// this is kludge!
prefix = elPfx;
}
break;
}
}
}
}
if (prefix == null) {
prefix = lookupOrDeclarePrefix(namespace);
}
// assert prefix != null;
// make sure that default ("") namespace to not print ":"
if (prefix.length() > 0) {
elPrefix[depth] = prefix;
out.write(prefix);
out.write(':');
} else {
elPrefix[depth] = "";
}
} else {
// make sure that default namespace can be declared
for (int i = namespaceEnd - 1; i >= 0; --i) {
if ("".equals(namespacePrefix[i])) {
final String uri = namespaceUri[i];
if (uri == null) {
// declare default namespace
setPrefix("", "");
} else if (uri.length() > 0) {
throw new IllegalStateException("start tag can not be written in empty default namespace " + "as default namespace is currently bound to '" + uri + "'" + getLocation());
}
break;
}
}
elPrefix[depth] = "";
}
} else {
elPrefix[depth] = "";
}
out.write(name);
return this;
} }
|
public class class_name {
public XMLSerializer startTag(String namespace, String name) throws IOException {
if (startTagIncomplete) {
closeStartTag();
}
seenBracket = seenBracketBracket = false;
++depth;
if (doIndent && depth > 0 && seenTag) {
writeIndent();
}
seenTag = true;
setPrefixCalled = false;
startTagIncomplete = true;
if ((depth + 1) >= elName.length) {
ensureElementsCapacity();
}
//// assert namespace != null;
if (checkNamesInterned && namesInterned)
checkInterning(namespace);
elNamespace[depth] = (namesInterned || namespace == null) ? namespace : namespace.intern();
// assert name != null;
// elName[ depth ] = name;
if (checkNamesInterned && namesInterned)
checkInterning(name);
elName[depth] = (namesInterned || name == null) ? name : name.intern();
if (out == null) {
throw new IllegalStateException("setOutput() must called set before serialization can start");
}
out.write('<');
if (namespace != null) {
if (namespace.length() > 0) {
// ALEK: in future make this algo a feature on serializer
String prefix = null;
if (depth > 0 && (namespaceEnd - elNamespaceCount[depth - 1]) == 1) {
// if only one prefix was declared un-declare it if the
// prefix is already declared on parent el with the same URI
String uri = namespaceUri[namespaceEnd - 1];
if (uri == namespace || uri.equals(namespace)) {
String elPfx = namespacePrefix[namespaceEnd - 1];
// 2 == to skip predefined namesapces (xml and xmlns
// ...)
for (int pos = elNamespaceCount[depth - 1] - 1; pos >= 2; --pos) {
String pf = namespacePrefix[pos];
if (pf == elPfx || pf.equals(elPfx)) {
String n = namespaceUri[pos];
if (n == uri || n.equals(uri)) {
--namespaceEnd; // un-declare namespace: // depends on control dependency: [if], data = [none]
// this is kludge!
prefix = elPfx; // depends on control dependency: [if], data = [none]
}
break;
}
}
}
}
if (prefix == null) {
prefix = lookupOrDeclarePrefix(namespace); // depends on control dependency: [if], data = [none]
}
// assert prefix != null;
// make sure that default ("") namespace to not print ":"
if (prefix.length() > 0) {
elPrefix[depth] = prefix; // depends on control dependency: [if], data = [none]
out.write(prefix); // depends on control dependency: [if], data = [none]
out.write(':'); // depends on control dependency: [if], data = [none]
} else {
elPrefix[depth] = ""; // depends on control dependency: [if], data = [none]
}
} else {
// make sure that default namespace can be declared
for (int i = namespaceEnd - 1; i >= 0; --i) {
if ("".equals(namespacePrefix[i])) {
final String uri = namespaceUri[i];
if (uri == null) {
// declare default namespace
setPrefix("", ""); // depends on control dependency: [if], data = [none]
} else if (uri.length() > 0) {
throw new IllegalStateException("start tag can not be written in empty default namespace " + "as default namespace is currently bound to '" + uri + "'" + getLocation());
}
break;
}
}
elPrefix[depth] = "";
}
} else {
elPrefix[depth] = "";
}
out.write(name);
return this;
} }
|
public class class_name {
public void set(@Nullable T value) {
try {
descriptor.getWriteMethod().invoke(target, value);
} catch (Exception e) {
String format = "Failed to set value %s in property '%s'";
String msg = String.format(format, String.valueOf(value), descriptor.getName());
throw new ReflectionError(msg, e);
}
} }
|
public class class_name {
public void set(@Nullable T value) {
try {
descriptor.getWriteMethod().invoke(target, value); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
String format = "Failed to set value %s in property '%s'";
String msg = String.format(format, String.valueOf(value), descriptor.getName());
throw new ReflectionError(msg, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public String[] getLabels(Matcher matcher) {
if ((matcher instanceof AnyOfMatcher) && ((AnyOfMatcher)matcher).characters.toString().equals(matcher.getLabel())) {
AnyOfMatcher cMatcher = (AnyOfMatcher) matcher;
if (!cMatcher.characters.isSubtractive()) {
String[] labels = new String[cMatcher.characters.getChars().length];
for (int i = 0; i < labels.length; i++) {
labels[i] = '\'' + String.valueOf(cMatcher.characters.getChars()[i]) + '\'';
}
return labels;
}
}
return new String[] {matcher.getLabel()};
} }
|
public class class_name {
public String[] getLabels(Matcher matcher) {
if ((matcher instanceof AnyOfMatcher) && ((AnyOfMatcher)matcher).characters.toString().equals(matcher.getLabel())) {
AnyOfMatcher cMatcher = (AnyOfMatcher) matcher;
if (!cMatcher.characters.isSubtractive()) {
String[] labels = new String[cMatcher.characters.getChars().length];
for (int i = 0; i < labels.length; i++) {
labels[i] = '\'' + String.valueOf(cMatcher.characters.getChars()[i]) + '\''; // depends on control dependency: [for], data = [i]
}
return labels; // depends on control dependency: [if], data = [none]
}
}
return new String[] {matcher.getLabel()};
} }
|
public class class_name {
public static Calendar parseCalendar(final String calendar, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(calendar) || (calendar.length() == 4 && "null".equalsIgnoreCase(calendar))) {
return null;
}
return createCalendar(parse(calendar, format, timeZone));
} }
|
public class class_name {
public static Calendar parseCalendar(final String calendar, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(calendar) || (calendar.length() == 4 && "null".equalsIgnoreCase(calendar))) {
return null;
// depends on control dependency: [if], data = [none]
}
return createCalendar(parse(calendar, format, timeZone));
} }
|
public class class_name {
public void no(int existingNodeID, int newNodeID, String newQuestAns, Decision decision) {
// If no root node do nothing
if (rootNode == null) {
System.out.println("ERROR: No root node!");
return;
}
// Search tree
if (searchTreeAndAddNoNode(rootNode,existingNodeID,newNodeID,newQuestAns, decision)) {
//System.out.println("Added node " + newNodeID +
// " onto \"no\" branch of node " + existingNodeID);
}
else System.out.println("Node " + existingNodeID + " not found");
} }
|
public class class_name {
public void no(int existingNodeID, int newNodeID, String newQuestAns, Decision decision) {
// If no root node do nothing
if (rootNode == null) {
System.out.println("ERROR: No root node!"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Search tree
if (searchTreeAndAddNoNode(rootNode,existingNodeID,newNodeID,newQuestAns, decision)) {
//System.out.println("Added node " + newNodeID +
// " onto \"no\" branch of node " + existingNodeID);
}
else System.out.println("Node " + existingNodeID + " not found");
} }
|
public class class_name {
@Override
public void execute(ExecutionContext context){
final String[] args = context.getArguments();
String clusterValue = getArgumentValue(ARG_CLUSTER_NAME,args,null);
if(clusterValue != null){
// Add all the arguments which need to be validated
this.createCollectiveArgumentsValues();
this.validateArgumentList(args, true);
String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
if(serverValues == null){
throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG ,
"["+ARG_SERVER_ADDRESS + "]"));
}
String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);
GeneratePluginForCollective collectiveTask =
new GeneratePluginForCollective(serverValues, clusterValue ,targetPathValue,commandConsole);
ParseLoginAddress controllerAddress = null;
try {
controllerAddress = collectiveTask.parseCollectiveAddressValue();
} catch (IllegalArgumentException e) {
throw e;
}
invokeGeneratePluginCfgMBean(controllerAddress, collectiveTask.getCluster(),targetPathValue,"collective");
}
else{
// Add all the arguments which need to be validated
this.createServerArgumentsValues();
String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
if(serverValues == null){
throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG ,
"["+ARG_SERVER_ADDRESS + "]" ));
}
this.validateArgumentList(args, true);
String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);
GeneratePluginForServer serverTask =
new GeneratePluginForServer(serverValues, targetPathValue, commandConsole);
ParseLoginAddress serverAddress = null;
try {
serverAddress = serverTask.parseServerAddressValue();
} catch (IllegalArgumentException e) {
throw e;
}
this.invokeGeneratePluginCfgMBean(serverAddress, null, targetPathValue,"server");
}
} }
|
public class class_name {
@Override
public void execute(ExecutionContext context){
final String[] args = context.getArguments();
String clusterValue = getArgumentValue(ARG_CLUSTER_NAME,args,null);
if(clusterValue != null){
// Add all the arguments which need to be validated
this.createCollectiveArgumentsValues(); // depends on control dependency: [if], data = [none]
this.validateArgumentList(args, true); // depends on control dependency: [if], data = [none]
String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
if(serverValues == null){
throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG ,
"["+ARG_SERVER_ADDRESS + "]"));
}
String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);
GeneratePluginForCollective collectiveTask =
new GeneratePluginForCollective(serverValues, clusterValue ,targetPathValue,commandConsole);
ParseLoginAddress controllerAddress = null;
try {
controllerAddress = collectiveTask.parseCollectiveAddressValue(); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw e;
} // depends on control dependency: [catch], data = [none]
invokeGeneratePluginCfgMBean(controllerAddress, collectiveTask.getCluster(),targetPathValue,"collective"); // depends on control dependency: [if], data = [none]
}
else{
// Add all the arguments which need to be validated
this.createServerArgumentsValues(); // depends on control dependency: [if], data = [none]
String serverValues = getArgumentValue(ARG_SERVER_ADDRESS, args, null);
if(serverValues == null){
throw new IllegalArgumentException(getMessage(MISSING_VALUE_MSG ,
"["+ARG_SERVER_ADDRESS + "]" ));
}
this.validateArgumentList(args, true); // depends on control dependency: [if], data = [none]
String targetPathValue = getArgumentValue(ARG_OPT_TARGET_PATH, args, null);
GeneratePluginForServer serverTask =
new GeneratePluginForServer(serverValues, targetPathValue, commandConsole);
ParseLoginAddress serverAddress = null;
try {
serverAddress = serverTask.parseServerAddressValue(); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw e;
} // depends on control dependency: [catch], data = [none]
this.invokeGeneratePluginCfgMBean(serverAddress, null, targetPathValue,"server"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected final void broadcastCompleted(final ServerResponse response) {
final boolean successfulUpload = response.getHttpCode() >= 200 && response.getHttpCode() < 400;
if (successfulUpload) {
onSuccessfulUpload();
if (params.autoDeleteSuccessfullyUploadedFiles && !successfullyUploadedFiles.isEmpty()) {
for (String filePath : successfullyUploadedFiles) {
deleteFile(new File(filePath));
}
}
}
Logger.debug(LOG_TAG, "Broadcasting upload " + (successfulUpload ? "completed" : "error")
+ " for " + params.id);
final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes,
totalBytes, (attempts - 1),
successfullyUploadedFiles,
pathStringListFrom(params.files));
final UploadNotificationConfig notificationConfig = params.notificationConfig;
if (notificationConfig != null) {
if (successfulUpload && notificationConfig.getCompleted().message != null) {
updateNotification(uploadInfo, notificationConfig.getCompleted());
} else if (notificationConfig.getError().message != null) {
updateNotification(uploadInfo, notificationConfig.getError());
}
}
final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id);
if (delegate != null) {
mainThreadHandler.post(new Runnable() {
@Override
public void run() {
if (successfulUpload) {
delegate.onCompleted(service, uploadInfo, response);
} else {
delegate.onError(service, uploadInfo, response, null);
}
}
});
} else {
BroadcastData data = new BroadcastData()
.setStatus(successfulUpload ? BroadcastData.Status.COMPLETED : BroadcastData.Status.ERROR)
.setUploadInfo(uploadInfo)
.setServerResponse(response);
service.sendBroadcast(data.getIntent());
}
service.taskCompleted(params.id);
} }
|
public class class_name {
protected final void broadcastCompleted(final ServerResponse response) {
final boolean successfulUpload = response.getHttpCode() >= 200 && response.getHttpCode() < 400;
if (successfulUpload) {
onSuccessfulUpload(); // depends on control dependency: [if], data = [none]
if (params.autoDeleteSuccessfullyUploadedFiles && !successfullyUploadedFiles.isEmpty()) {
for (String filePath : successfullyUploadedFiles) {
deleteFile(new File(filePath)); // depends on control dependency: [for], data = [filePath]
}
}
}
Logger.debug(LOG_TAG, "Broadcasting upload " + (successfulUpload ? "completed" : "error")
+ " for " + params.id);
final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes,
totalBytes, (attempts - 1),
successfullyUploadedFiles,
pathStringListFrom(params.files));
final UploadNotificationConfig notificationConfig = params.notificationConfig;
if (notificationConfig != null) {
if (successfulUpload && notificationConfig.getCompleted().message != null) {
updateNotification(uploadInfo, notificationConfig.getCompleted()); // depends on control dependency: [if], data = [none]
} else if (notificationConfig.getError().message != null) {
updateNotification(uploadInfo, notificationConfig.getError()); // depends on control dependency: [if], data = [none]
}
}
final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id);
if (delegate != null) {
mainThreadHandler.post(new Runnable() {
@Override
public void run() {
if (successfulUpload) {
delegate.onCompleted(service, uploadInfo, response); // depends on control dependency: [if], data = [none]
} else {
delegate.onError(service, uploadInfo, response, null); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
} else {
BroadcastData data = new BroadcastData()
.setStatus(successfulUpload ? BroadcastData.Status.COMPLETED : BroadcastData.Status.ERROR)
.setUploadInfo(uploadInfo)
.setServerResponse(response);
service.sendBroadcast(data.getIntent()); // depends on control dependency: [if], data = [none]
}
service.taskCompleted(params.id);
} }
|
public class class_name {
public static void forEachOperator(BiConsumer<String, Helper> consumer) {
for (Operator operator : Operator.values()) {
consumer.accept(operator.toString().toLowerCase(), new NumericExpressionHelper(operator));
}
} }
|
public class class_name {
public static void forEachOperator(BiConsumer<String, Helper> consumer) {
for (Operator operator : Operator.values()) {
consumer.accept(operator.toString().toLowerCase(), new NumericExpressionHelper(operator)); // depends on control dependency: [for], data = [operator]
}
} }
|
public class class_name {
private void set(double value)
{
cur = value;
if (!overMax && cur > max)
{
cur = max;
}
if (cur < Alterable.MIN)
{
cur = Alterable.MIN;
}
} }
|
public class class_name {
private void set(double value)
{
cur = value;
if (!overMax && cur > max)
{
cur = max; // depends on control dependency: [if], data = [none]
}
if (cur < Alterable.MIN)
{
cur = Alterable.MIN; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public char[] toCharArray(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY;
}
final char chars[] = new char[len];
System.arraycopy(buffer, startIndex, chars, 0, len);
return chars;
} }
|
public class class_name {
public char[] toCharArray(final int startIndex, int endIndex) {
endIndex = validateRange(startIndex, endIndex);
final int len = endIndex - startIndex;
if (len == 0) {
return ArrayUtils.EMPTY_CHAR_ARRAY; // depends on control dependency: [if], data = [none]
}
final char chars[] = new char[len];
System.arraycopy(buffer, startIndex, chars, 0, len);
return chars;
} }
|
public class class_name {
protected boolean containsEOLDelimiters(byte[] data) {
int numCRLFs = 0;
for (int i = 0; i < data.length; i++) {
if ('\r' == data[i] || '\n' == data[i]) {
numCRLFs++;
if (4 == numCRLFs) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "contains 4 consecutive CRs and/or LFs: true");
}
return true;
}
if ((i > 0) && ('\n' == data[i])) {
if ('\n' == data[i - 1]) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "contains LF-LF: true");
}
return true;
}
}
} else {
// must be in a row, reset counter
numCRLFs = 0;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "containsEOLDelimiters: false count=" + numCRLFs);
}
return false;
} }
|
public class class_name {
protected boolean containsEOLDelimiters(byte[] data) {
int numCRLFs = 0;
for (int i = 0; i < data.length; i++) {
if ('\r' == data[i] || '\n' == data[i]) {
numCRLFs++; // depends on control dependency: [if], data = [none]
if (4 == numCRLFs) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "contains 4 consecutive CRs and/or LFs: true"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
if ((i > 0) && ('\n' == data[i])) {
if ('\n' == data[i - 1]) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "contains LF-LF: true"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
} else {
// must be in a row, reset counter
numCRLFs = 0; // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "containsEOLDelimiters: false count=" + numCRLFs); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public EEnum getIfcObjectTypeEnum() {
if (ifcObjectTypeEnumEEnum == null) {
ifcObjectTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1021);
}
return ifcObjectTypeEnumEEnum;
} }
|
public class class_name {
@Override
public EEnum getIfcObjectTypeEnum() {
if (ifcObjectTypeEnumEEnum == null) {
ifcObjectTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1021);
// depends on control dependency: [if], data = [none]
}
return ifcObjectTypeEnumEEnum;
} }
|
public class class_name {
protected Object getInjectedObjectFromCXF(Class<?> classType,
Type genericType,
Annotation[] memberAnnotations,
ParamInjectionMetadata paramInjectionMetadata) {
Parameter p = ResourceUtils.getParameter(0, memberAnnotations, classType);
Object injectedObject = null;
Message message = paramInjectionMetadata.getInMessage();
OperationResourceInfo ori = paramInjectionMetadata.getOperationResourceInfo();
BeanResourceInfo cri = ori.getClassResourceInfo();
MultivaluedMap<String, String> values = (MultivaluedMap<String, String>) message.get(URITemplate.TEMPLATE_PARAMETERS);
if (p.getType() == ParameterType.BEAN && cri instanceof ClassResourceInfo) {
injectedObject = JAXRSUtils.createBeanParamValue(message, classType, ori);
} else {
injectedObject = JAXRSUtils.createHttpParameterValue(p,
classType,
genericType,
memberAnnotations,
message,
values,
ori);
}
return injectedObject;
} }
|
public class class_name {
protected Object getInjectedObjectFromCXF(Class<?> classType,
Type genericType,
Annotation[] memberAnnotations,
ParamInjectionMetadata paramInjectionMetadata) {
Parameter p = ResourceUtils.getParameter(0, memberAnnotations, classType);
Object injectedObject = null;
Message message = paramInjectionMetadata.getInMessage();
OperationResourceInfo ori = paramInjectionMetadata.getOperationResourceInfo();
BeanResourceInfo cri = ori.getClassResourceInfo();
MultivaluedMap<String, String> values = (MultivaluedMap<String, String>) message.get(URITemplate.TEMPLATE_PARAMETERS);
if (p.getType() == ParameterType.BEAN && cri instanceof ClassResourceInfo) {
injectedObject = JAXRSUtils.createBeanParamValue(message, classType, ori); // depends on control dependency: [if], data = [none]
} else {
injectedObject = JAXRSUtils.createHttpParameterValue(p,
classType,
genericType,
memberAnnotations,
message,
values,
ori); // depends on control dependency: [if], data = [none]
}
return injectedObject;
} }
|
public class class_name {
@Override
public void afterDisconnect(SlaveComputer slaveComputer, final TaskListener listener) {
if (connection == null) {
// Nothing to do here, the connection is not established
return;
}
ExecutorService srv = launcherExecutorService;
if (srv != null) {
// If the service is still running, shut it down and interrupt the operations if any
srv.shutdown();
}
if (tearingDownConnection) {
// tear down operation is in progress, do not even try to synchronize the call.
//TODO: what if reconnect attempts collide? It should not be possible due to locks, but maybe it worth investigation
LOGGER.log(Level.FINE, "There is already a tear down operation in progress for connection {0}. Skipping the call", connection);
return;
}
tearDownConnection(slaveComputer, listener);
} }
|
public class class_name {
@Override
public void afterDisconnect(SlaveComputer slaveComputer, final TaskListener listener) {
if (connection == null) {
// Nothing to do here, the connection is not established
return; // depends on control dependency: [if], data = [none]
}
ExecutorService srv = launcherExecutorService;
if (srv != null) {
// If the service is still running, shut it down and interrupt the operations if any
srv.shutdown(); // depends on control dependency: [if], data = [none]
}
if (tearingDownConnection) {
// tear down operation is in progress, do not even try to synchronize the call.
//TODO: what if reconnect attempts collide? It should not be possible due to locks, but maybe it worth investigation
LOGGER.log(Level.FINE, "There is already a tear down operation in progress for connection {0}. Skipping the call", connection); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
tearDownConnection(slaveComputer, listener);
} }
|
public class class_name {
private PartialUriTemplateComponents getUriTemplateComponents(Map<String, ?> parameters, List<String>
requiredArgs) {
Assert.notNull(parameters, "Parameters must not be null!");
final StringBuilder baseUrl = new StringBuilder(urlComponents.get(0));
final StringBuilder queryHead = new StringBuilder();
final StringBuilder queryTail = new StringBuilder();
final StringBuilder fragmentIdentifier = new StringBuilder();
for (int i = 1; i < urlComponents.size(); i++) {
final String part = urlComponents.get(i);
final List<Integer> variablesInPart = variableIndices.get(i);
if (variablesInPart.isEmpty()) {
if (part.startsWith("?") || part.startsWith("&")) {
queryHead.append(part);
} else if (part.startsWith("#")) {
fragmentIdentifier.append(part);
} else {
baseUrl.append(part);
}
} else {
for (Integer variableInPart : variablesInPart) {
final TemplateVariable variable = variables.get(variableInPart);
final Object value = parameters.get(variable.getName());
if (value == null) {
switch (variable.getType()) {
case REQUEST_PARAM:
case REQUEST_PARAM_CONTINUED:
if (requiredArgs.isEmpty() || requiredArgs.contains(variable.getName())) {
// query vars without value always go last (query tail)
if (queryTail.length() > 0) {
queryTail.append(',');
}
queryTail.append(variable.getName());
}
break;
case FRAGMENT:
fragmentIdentifier.append(variable.toString());
break;
case PATH_VARIABLE:
if (queryHead.length() != 0) {
// level 1 variable in query
queryHead.append(variable.toString());
} else {
baseUrl.append(variable.toString());
}
break;
case SEGMENT:
baseUrl.append(variable.toString());
}
} else {
switch (variable.getType()) {
case REQUEST_PARAM:
case REQUEST_PARAM_CONTINUED:
if (queryHead.length() == 0) {
queryHead.append('?');
} else {
queryHead.append('&');
}
queryHead.append(variable.getName())
.append('=')
.append(urlEncode(value.toString()));
break;
case SEGMENT:
baseUrl.append('/');
// fall through
case PATH_VARIABLE:
if (queryHead.length() != 0) {
// level 1 variable in query
queryHead.append(urlEncode(value.toString()));
} else {
baseUrl.append(urlEncode(value.toString()));
}
break;
case FRAGMENT:
fragmentIdentifier.append('#');
fragmentIdentifier.append(urlEncode(value.toString()));
break;
}
}
}
}
}
return new PartialUriTemplateComponents(baseUrl.toString(), queryHead.toString(), queryTail.toString(),
fragmentIdentifier.toString(), variableNames);
} }
|
public class class_name {
private PartialUriTemplateComponents getUriTemplateComponents(Map<String, ?> parameters, List<String>
requiredArgs) {
Assert.notNull(parameters, "Parameters must not be null!");
final StringBuilder baseUrl = new StringBuilder(urlComponents.get(0));
final StringBuilder queryHead = new StringBuilder();
final StringBuilder queryTail = new StringBuilder();
final StringBuilder fragmentIdentifier = new StringBuilder();
for (int i = 1; i < urlComponents.size(); i++) {
final String part = urlComponents.get(i);
final List<Integer> variablesInPart = variableIndices.get(i);
if (variablesInPart.isEmpty()) {
if (part.startsWith("?") || part.startsWith("&")) {
queryHead.append(part); // depends on control dependency: [if], data = [none]
} else if (part.startsWith("#")) {
fragmentIdentifier.append(part); // depends on control dependency: [if], data = [none]
} else {
baseUrl.append(part); // depends on control dependency: [if], data = [none]
}
} else {
for (Integer variableInPart : variablesInPart) {
final TemplateVariable variable = variables.get(variableInPart);
final Object value = parameters.get(variable.getName());
if (value == null) {
switch (variable.getType()) {
case REQUEST_PARAM:
case REQUEST_PARAM_CONTINUED:
if (requiredArgs.isEmpty() || requiredArgs.contains(variable.getName())) {
// query vars without value always go last (query tail)
if (queryTail.length() > 0) {
queryTail.append(','); // depends on control dependency: [if], data = [none]
}
queryTail.append(variable.getName()); // depends on control dependency: [if], data = [none]
}
break;
case FRAGMENT:
fragmentIdentifier.append(variable.toString());
break;
case PATH_VARIABLE:
if (queryHead.length() != 0) {
// level 1 variable in query
queryHead.append(variable.toString()); // depends on control dependency: [if], data = [none]
} else {
baseUrl.append(variable.toString()); // depends on control dependency: [if], data = [none]
}
break;
case SEGMENT:
baseUrl.append(variable.toString());
}
} else {
switch (variable.getType()) {
case REQUEST_PARAM:
case REQUEST_PARAM_CONTINUED:
if (queryHead.length() == 0) {
queryHead.append('?'); // depends on control dependency: [if], data = [none]
} else {
queryHead.append('&'); // depends on control dependency: [if], data = [none]
}
queryHead.append(variable.getName())
.append('=')
.append(urlEncode(value.toString()));
break;
case SEGMENT:
baseUrl.append('/');
// fall through
case PATH_VARIABLE:
if (queryHead.length() != 0) {
// level 1 variable in query
queryHead.append(urlEncode(value.toString())); // depends on control dependency: [if], data = [none]
} else {
baseUrl.append(urlEncode(value.toString())); // depends on control dependency: [if], data = [none]
}
break;
case FRAGMENT:
fragmentIdentifier.append('#');
fragmentIdentifier.append(urlEncode(value.toString()));
break;
}
}
}
}
}
return new PartialUriTemplateComponents(baseUrl.toString(), queryHead.toString(), queryTail.toString(),
fragmentIdentifier.toString(), variableNames);
} }
|
public class class_name {
public void info(String message, Object... args) {
if (DEBUG.equals(this.logLevel) || INFO.equals(this.logLevel)) {
System.out.println(String.format(message, args));
}
} }
|
public class class_name {
public void info(String message, Object... args) {
if (DEBUG.equals(this.logLevel) || INFO.equals(this.logLevel)) {
System.out.println(String.format(message, args)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String getRealPath(final WebApplication application, final String path)
{
final String realPath = application.getServletContext().getRealPath(path);
if ((null != realPath) && !realPath.isEmpty())
{
return realPath;
}
return "";
} }
|
public class class_name {
public static String getRealPath(final WebApplication application, final String path)
{
final String realPath = application.getServletContext().getRealPath(path);
if ((null != realPath) && !realPath.isEmpty())
{
return realPath; // depends on control dependency: [if], data = [none]
}
return "";
} }
|
public class class_name {
@Override
public org.fcrepo.server.types.gen.FieldSearchResult resumeFindObjects(String sessionToken) {
MessageContext ctx = context.getMessageContext();
Context context = ReadOnlyContext.getSoapContext(ctx);
assertInitialized();
try {
org.fcrepo.server.search.FieldSearchResult result =
m_access.resumeFindObjects(context, sessionToken);
return TypeUtility
.convertFieldSearchResultToGenFieldSearchResult(result);
} catch (Throwable th) {
LOG.error("Error resuming finding objects", th);
throw CXFUtility.getFault(th);
}
} }
|
public class class_name {
@Override
public org.fcrepo.server.types.gen.FieldSearchResult resumeFindObjects(String sessionToken) {
MessageContext ctx = context.getMessageContext();
Context context = ReadOnlyContext.getSoapContext(ctx);
assertInitialized();
try {
org.fcrepo.server.search.FieldSearchResult result =
m_access.resumeFindObjects(context, sessionToken);
return TypeUtility
.convertFieldSearchResultToGenFieldSearchResult(result); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
LOG.error("Error resuming finding objects", th);
throw CXFUtility.getFault(th);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Boolean getGlobalParam(Map property) {
Boolean global = null;
Object globalObj = property.get("global");
if (globalObj == null) {
// default behaviour before liquibase 3.4
global = true;
} else {
global = (Boolean) globalObj;
}
return global;
} }
|
public class class_name {
private Boolean getGlobalParam(Map property) {
Boolean global = null;
Object globalObj = property.get("global");
if (globalObj == null) {
// default behaviour before liquibase 3.4
global = true; // depends on control dependency: [if], data = [none]
} else {
global = (Boolean) globalObj; // depends on control dependency: [if], data = [none]
}
return global;
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> addVideoFrameStreamWithServiceResponseAsync(String teamName, String reviewId, String contentType, byte[] frameImageZip, String frameMetadata, Integer timescale) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (teamName == null) {
throw new IllegalArgumentException("Parameter teamName is required and cannot be null.");
}
if (reviewId == null) {
throw new IllegalArgumentException("Parameter reviewId is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (frameImageZip == null) {
throw new IllegalArgumentException("Parameter frameImageZip is required and cannot be null.");
}
if (frameMetadata == null) {
throw new IllegalArgumentException("Parameter frameMetadata is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
RequestBody frameImageZipConverted = RequestBody.create(MediaType.parse("multipart/form-data"), frameImageZip);
return service.addVideoFrameStream(teamName, reviewId, contentType, timescale, frameImageZipConverted, frameMetadata, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = addVideoFrameStreamDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Void>> addVideoFrameStreamWithServiceResponseAsync(String teamName, String reviewId, String contentType, byte[] frameImageZip, String frameMetadata, Integer timescale) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (teamName == null) {
throw new IllegalArgumentException("Parameter teamName is required and cannot be null.");
}
if (reviewId == null) {
throw new IllegalArgumentException("Parameter reviewId is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (frameImageZip == null) {
throw new IllegalArgumentException("Parameter frameImageZip is required and cannot be null.");
}
if (frameMetadata == null) {
throw new IllegalArgumentException("Parameter frameMetadata is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
RequestBody frameImageZipConverted = RequestBody.create(MediaType.parse("multipart/form-data"), frameImageZip);
return service.addVideoFrameStream(teamName, reviewId, contentType, timescale, frameImageZipConverted, frameMetadata, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = addVideoFrameStreamDelegate(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 {
@Override public void init(boolean expensive) {
super.init(expensive);
// Initialize response based on given distribution family.
// Regression: initially predict the response mean
// Binomial: just class 0 (class 1 in the exact inverse prediction)
// Multinomial: Class distribution which is not a single value.
// However there is this weird tension on the initial value for
// classification: If you guess 0's (no class is favored over another),
// then with your first GBM tree you'll typically move towards the correct
// answer a little bit (assuming you have decent predictors) - and
// immediately the Confusion Matrix shows good results which gradually
// improve... BUT the Means Squared Error will suck for unbalanced sets,
// even as the CM is good. That's because we want the predictions for the
// common class to be large and positive, and the rare class to be negative
// and instead they start around 0. Guessing initial zero's means the MSE
// is so bad, that the R^2 metric is typically negative (usually it's
// between 0 and 1).
// If instead you guess the mean (reversed through the loss function), then
// the zero-tree GBM model reports an MSE equal to the response variance -
// and an initial R^2 of zero. More trees gradually improves the R^2 as
// expected. However, all the minority classes have large guesses in the
// wrong direction, and it takes a long time (lotsa trees) to correct that
// - so your CM sucks for a long time.
if (expensive) {
if (error_count() > 0)
throw H2OModelBuilderIllegalArgumentException.makeFromBuilder(GBM.this);
if (_parms._distribution == DistributionFamily.AUTO) {
if (_nclass == 1) _parms._distribution = DistributionFamily.gaussian;
if (_nclass == 2) _parms._distribution = DistributionFamily.bernoulli;
if (_nclass >= 3) _parms._distribution = DistributionFamily.multinomial;
}
checkDistributions();
if (hasOffsetCol() && isClassifier() && _parms._distribution == DistributionFamily.multinomial) {
error("_offset_column", "Offset is not supported for multinomial distribution.");
}
if (_parms._monotone_constraints != null && _parms._monotone_constraints.length > 0 &&
!(DistributionFamily.gaussian.equals(_parms._distribution) || DistributionFamily.bernoulli.equals(_parms._distribution))) {
error("_monotone_constraints", "Monotone constraints are only supported for Gaussian and Bernoulli distributions, your distribution: " + _parms._distribution + ".");
}
}
switch( _parms._distribution) {
case bernoulli:
if( _nclass != 2 /*&& !couldBeBool(_response)*/)
error("_distribution", H2O.technote(2, "Binomial requires the response to be a 2-class categorical"));
break;
case quasibinomial:
if ( !_response.isNumeric() )
error("_distribution", H2O.technote(2, "Quasibinomial requires the response to be numeric."));
if ( _nclass != 2)
error("_distribution", H2O.technote(2, "Quasibinomial requires the response to be binary."));
break;
case modified_huber:
if( _nclass != 2 /*&& !couldBeBool(_response)*/)
error("_distribution", H2O.technote(2, "Modified Huber requires the response to be a 2-class categorical."));
break;
case multinomial:
if (!isClassifier()) error("_distribution", H2O.technote(2, "Multinomial requires an categorical response."));
break;
case huber:
if (isClassifier()) error("_distribution", H2O.technote(2, "Huber requires the response to be numeric."));
break;
case poisson:
if (isClassifier()) error("_distribution", H2O.technote(2, "Poisson requires the response to be numeric."));
break;
case gamma:
if (isClassifier()) error("_distribution", H2O.technote(2, "Gamma requires the response to be numeric."));
break;
case tweedie:
if (isClassifier()) error("_distribution", H2O.technote(2, "Tweedie requires the response to be numeric."));
break;
case gaussian:
if (isClassifier()) error("_distribution", H2O.technote(2, "Gaussian requires the response to be numeric."));
break;
case laplace:
if (isClassifier()) error("_distribution", H2O.technote(2, "Laplace requires the response to be numeric."));
break;
case quantile:
if (isClassifier()) error("_distribution", H2O.technote(2, "Quantile requires the response to be numeric."));
break;
case AUTO:
break;
default:
error("_distribution","Invalid distribution: " + _parms._distribution);
}
if( !(0. < _parms._learn_rate && _parms._learn_rate <= 1.0) )
error("_learn_rate", "learn_rate must be between 0 and 1");
if( !(0. < _parms._learn_rate_annealing && _parms._learn_rate_annealing <= 1.0) )
error("_learn_rate_annealing", "learn_rate_annealing must be between 0 and 1");
if( !(0. < _parms._col_sample_rate && _parms._col_sample_rate <= 1.0) )
error("_col_sample_rate", "col_sample_rate must be between 0 and 1");
if (_parms._max_abs_leafnode_pred <= 0)
error("_max_abs_leafnode_pred", "max_abs_leafnode_pred must be larger than 0.");
if (_parms._pred_noise_bandwidth < 0)
error("_pred_noise_bandwidth", "pred_noise_bandwidth must be >= 0.");
if ((_train != null) && (_parms._monotone_constraints != null)) {
TreeUtils.checkMonotoneConstraints(this, _train, _parms._monotone_constraints);
}
} }
|
public class class_name {
@Override public void init(boolean expensive) {
super.init(expensive);
// Initialize response based on given distribution family.
// Regression: initially predict the response mean
// Binomial: just class 0 (class 1 in the exact inverse prediction)
// Multinomial: Class distribution which is not a single value.
// However there is this weird tension on the initial value for
// classification: If you guess 0's (no class is favored over another),
// then with your first GBM tree you'll typically move towards the correct
// answer a little bit (assuming you have decent predictors) - and
// immediately the Confusion Matrix shows good results which gradually
// improve... BUT the Means Squared Error will suck for unbalanced sets,
// even as the CM is good. That's because we want the predictions for the
// common class to be large and positive, and the rare class to be negative
// and instead they start around 0. Guessing initial zero's means the MSE
// is so bad, that the R^2 metric is typically negative (usually it's
// between 0 and 1).
// If instead you guess the mean (reversed through the loss function), then
// the zero-tree GBM model reports an MSE equal to the response variance -
// and an initial R^2 of zero. More trees gradually improves the R^2 as
// expected. However, all the minority classes have large guesses in the
// wrong direction, and it takes a long time (lotsa trees) to correct that
// - so your CM sucks for a long time.
if (expensive) {
if (error_count() > 0)
throw H2OModelBuilderIllegalArgumentException.makeFromBuilder(GBM.this);
if (_parms._distribution == DistributionFamily.AUTO) {
if (_nclass == 1) _parms._distribution = DistributionFamily.gaussian;
if (_nclass == 2) _parms._distribution = DistributionFamily.bernoulli;
if (_nclass >= 3) _parms._distribution = DistributionFamily.multinomial;
}
checkDistributions(); // depends on control dependency: [if], data = [none]
if (hasOffsetCol() && isClassifier() && _parms._distribution == DistributionFamily.multinomial) {
error("_offset_column", "Offset is not supported for multinomial distribution."); // depends on control dependency: [if], data = [none]
}
if (_parms._monotone_constraints != null && _parms._monotone_constraints.length > 0 &&
!(DistributionFamily.gaussian.equals(_parms._distribution) || DistributionFamily.bernoulli.equals(_parms._distribution))) {
error("_monotone_constraints", "Monotone constraints are only supported for Gaussian and Bernoulli distributions, your distribution: " + _parms._distribution + "."); // depends on control dependency: [if], data = [none]
}
}
switch( _parms._distribution) {
case bernoulli:
if( _nclass != 2 /*&& !couldBeBool(_response)*/)
error("_distribution", H2O.technote(2, "Binomial requires the response to be a 2-class categorical"));
break;
case quasibinomial:
if ( !_response.isNumeric() )
error("_distribution", H2O.technote(2, "Quasibinomial requires the response to be numeric."));
if ( _nclass != 2)
error("_distribution", H2O.technote(2, "Quasibinomial requires the response to be binary."));
break;
case modified_huber:
if( _nclass != 2 /*&& !couldBeBool(_response)*/)
error("_distribution", H2O.technote(2, "Modified Huber requires the response to be a 2-class categorical."));
break;
case multinomial:
if (!isClassifier()) error("_distribution", H2O.technote(2, "Multinomial requires an categorical response."));
break;
case huber:
if (isClassifier()) error("_distribution", H2O.technote(2, "Huber requires the response to be numeric."));
break;
case poisson:
if (isClassifier()) error("_distribution", H2O.technote(2, "Poisson requires the response to be numeric."));
break;
case gamma:
if (isClassifier()) error("_distribution", H2O.technote(2, "Gamma requires the response to be numeric."));
break;
case tweedie:
if (isClassifier()) error("_distribution", H2O.technote(2, "Tweedie requires the response to be numeric."));
break;
case gaussian:
if (isClassifier()) error("_distribution", H2O.technote(2, "Gaussian requires the response to be numeric."));
break;
case laplace:
if (isClassifier()) error("_distribution", H2O.technote(2, "Laplace requires the response to be numeric."));
break;
case quantile:
if (isClassifier()) error("_distribution", H2O.technote(2, "Quantile requires the response to be numeric."));
break;
case AUTO:
break;
default:
error("_distribution","Invalid distribution: " + _parms._distribution);
}
if( !(0. < _parms._learn_rate && _parms._learn_rate <= 1.0) )
error("_learn_rate", "learn_rate must be between 0 and 1");
if( !(0. < _parms._learn_rate_annealing && _parms._learn_rate_annealing <= 1.0) )
error("_learn_rate_annealing", "learn_rate_annealing must be between 0 and 1");
if( !(0. < _parms._col_sample_rate && _parms._col_sample_rate <= 1.0) )
error("_col_sample_rate", "col_sample_rate must be between 0 and 1");
if (_parms._max_abs_leafnode_pred <= 0)
error("_max_abs_leafnode_pred", "max_abs_leafnode_pred must be larger than 0.");
if (_parms._pred_noise_bandwidth < 0)
error("_pred_noise_bandwidth", "pred_noise_bandwidth must be >= 0.");
if ((_train != null) && (_parms._monotone_constraints != null)) {
TreeUtils.checkMonotoneConstraints(this, _train, _parms._monotone_constraints); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) {
Preconditions.checkNotNull(targetType, "The target type class must not be null.");
if (!Tuple.class.isAssignableFrom(targetType)) {
throw new IllegalArgumentException("The target type must be a subclass of " + Tuple.class.getName());
}
@SuppressWarnings("unchecked")
TupleTypeInfo<T> typeInfo = (TupleTypeInfo<T>) TypeExtractor.createTypeInfo(targetType);
CsvInputFormat<T> inputFormat = new TupleCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, typeInfo, this.includedMask);
Class<?>[] classes = new Class<?>[typeInfo.getArity()];
for (int i = 0; i < typeInfo.getArity(); i++) {
classes[i] = typeInfo.getTypeAt(i).getTypeClass();
}
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, typeInfo, Utils.getCallLocationName());
} }
|
public class class_name {
public <T extends Tuple> DataSource<T> tupleType(Class<T> targetType) {
Preconditions.checkNotNull(targetType, "The target type class must not be null.");
if (!Tuple.class.isAssignableFrom(targetType)) {
throw new IllegalArgumentException("The target type must be a subclass of " + Tuple.class.getName());
}
@SuppressWarnings("unchecked")
TupleTypeInfo<T> typeInfo = (TupleTypeInfo<T>) TypeExtractor.createTypeInfo(targetType);
CsvInputFormat<T> inputFormat = new TupleCsvInputFormat<T>(path, this.lineDelimiter, this.fieldDelimiter, typeInfo, this.includedMask);
Class<?>[] classes = new Class<?>[typeInfo.getArity()];
for (int i = 0; i < typeInfo.getArity(); i++) {
classes[i] = typeInfo.getTypeAt(i).getTypeClass(); // depends on control dependency: [for], data = [i]
}
configureInputFormat(inputFormat);
return new DataSource<T>(executionContext, inputFormat, typeInfo, Utils.getCallLocationName());
} }
|
public class class_name {
public static Object executeExpression(String jexlExpression, Map<String, Object> map) {
JexlExpression expression = jexlEngine.createExpression(jexlExpression);
JexlContext context = new MapContext();
if (Checker.isNotEmpty(map)) {
map.forEach(context::set);
}
return expression.evaluate(context);
} }
|
public class class_name {
public static Object executeExpression(String jexlExpression, Map<String, Object> map) {
JexlExpression expression = jexlEngine.createExpression(jexlExpression);
JexlContext context = new MapContext();
if (Checker.isNotEmpty(map)) {
map.forEach(context::set); // depends on control dependency: [if], data = [none]
}
return expression.evaluate(context);
} }
|
public class class_name {
public Map<String,BeanDefinition> getBeanDefinitions() {
Map<String,BeanDefinition> beanDefinitions = new HashMap<>();
for (String beanName : getSpringConfig().getBeanNames()) {
BeanDefinition bd = getSpringConfig()
.getBeanConfig(beanName)
.getBeanDefinition();
beanDefinitions.put(beanName, bd);
}
return beanDefinitions;
} }
|
public class class_name {
public Map<String,BeanDefinition> getBeanDefinitions() {
Map<String,BeanDefinition> beanDefinitions = new HashMap<>();
for (String beanName : getSpringConfig().getBeanNames()) {
BeanDefinition bd = getSpringConfig()
.getBeanConfig(beanName)
.getBeanDefinition();
beanDefinitions.put(beanName, bd); // depends on control dependency: [for], data = [beanName]
}
return beanDefinitions;
} }
|
public class class_name {
@Override
public void runFinallyRoutes() {
while (iterator.hasNext()) {
Route route = iterator.next().getRoute();
if (route.isRunAsFinally()) {
try {
handleRoute(route);
} catch (Exception e) {
log.error("Unexpected error in Finally Route", e);
}
} else if (log.isDebugEnabled()) {
if (StringUtils.isNullOrEmpty(route.getName())) {
log.debug("context.next() not called, skipping handler for {} '{}'", route.getRequestMethod(),
route.getUriPattern());
} else {
log.debug("context.next() not called, skipping '{}' for {} '{}'", route.getName(),
route.getRequestMethod(), route.getUriPattern());
}
}
}
} }
|
public class class_name {
@Override
public void runFinallyRoutes() {
while (iterator.hasNext()) {
Route route = iterator.next().getRoute();
if (route.isRunAsFinally()) {
try {
handleRoute(route); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Unexpected error in Finally Route", e);
} // depends on control dependency: [catch], data = [none]
} else if (log.isDebugEnabled()) {
if (StringUtils.isNullOrEmpty(route.getName())) {
log.debug("context.next() not called, skipping handler for {} '{}'", route.getRequestMethod(),
route.getUriPattern()); // depends on control dependency: [if], data = [none]
} else {
log.debug("context.next() not called, skipping '{}' for {} '{}'", route.getName(),
route.getRequestMethod(), route.getUriPattern()); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public ListLayerVersionsResult withLayerVersions(LayerVersionsListItem... layerVersions) {
if (this.layerVersions == null) {
setLayerVersions(new com.amazonaws.internal.SdkInternalList<LayerVersionsListItem>(layerVersions.length));
}
for (LayerVersionsListItem ele : layerVersions) {
this.layerVersions.add(ele);
}
return this;
} }
|
public class class_name {
public ListLayerVersionsResult withLayerVersions(LayerVersionsListItem... layerVersions) {
if (this.layerVersions == null) {
setLayerVersions(new com.amazonaws.internal.SdkInternalList<LayerVersionsListItem>(layerVersions.length)); // depends on control dependency: [if], data = [none]
}
for (LayerVersionsListItem ele : layerVersions) {
this.layerVersions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public static <K, V> ImmutableSetMultimap<K, V> indexToSetMultimapWithMultipleKeys(
Iterable<? extends V> values, Function<? super V, ? extends Collection<? extends K>> keyFunction) {
final ImmutableSetMultimap.Builder<K,V> ret = ImmutableSetMultimap.builder();
for (final V value : values) {
// nulls banned by contract
//noinspection ConstantConditions
for (K key : keyFunction.apply(value)) {
ret.put(key, value);
}
}
return ret.build();
} }
|
public class class_name {
public static <K, V> ImmutableSetMultimap<K, V> indexToSetMultimapWithMultipleKeys(
Iterable<? extends V> values, Function<? super V, ? extends Collection<? extends K>> keyFunction) {
final ImmutableSetMultimap.Builder<K,V> ret = ImmutableSetMultimap.builder();
for (final V value : values) {
// nulls banned by contract
//noinspection ConstantConditions
for (K key : keyFunction.apply(value)) {
ret.put(key, value); // depends on control dependency: [for], data = [key]
}
}
return ret.build();
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.