code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static TokenType resolveTypeAsSymbol(char symbol) {
TokenType type;
if (symbol == Token.BEAN_SYMBOL) {
type = TokenType.BEAN;
} else if (symbol == Token.TEMPLATE_SYMBOL) {
type = TokenType.TEMPLATE;
} else if (symbol == Token.PARAMETER_SYMBOL) {
type = TokenType.PARAMETER;
} else if (symbol == Token.ATTRIBUTE_SYMBOL) {
type = TokenType.ATTRIBUTE;
} else if (symbol == Token.PROPERTY_SYMBOL) {
type = TokenType.PROPERTY;
} else {
throw new IllegalArgumentException("Unknown token symbol: " + symbol);
}
return type;
} }
|
public class class_name {
public static TokenType resolveTypeAsSymbol(char symbol) {
TokenType type;
if (symbol == Token.BEAN_SYMBOL) {
type = TokenType.BEAN; // depends on control dependency: [if], data = [none]
} else if (symbol == Token.TEMPLATE_SYMBOL) {
type = TokenType.TEMPLATE; // depends on control dependency: [if], data = [none]
} else if (symbol == Token.PARAMETER_SYMBOL) {
type = TokenType.PARAMETER; // depends on control dependency: [if], data = [none]
} else if (symbol == Token.ATTRIBUTE_SYMBOL) {
type = TokenType.ATTRIBUTE; // depends on control dependency: [if], data = [none]
} else if (symbol == Token.PROPERTY_SYMBOL) {
type = TokenType.PROPERTY; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown token symbol: " + symbol);
}
return type;
} }
|
public class class_name {
@Override
public LogEvent createEvent(final String loggerName, final Marker marker,
final String fqcn, final Level level, final Message message,
final List<Property> properties, final Throwable t) {
WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get();
MutableLogEvent result = refResult == null ? null : refResult.get();
if (result == null || result.reserved) {
final boolean initThreadLocal = result == null;
result = new MutableLogEvent();
// usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal
result.setThreadId(Thread.currentThread().getId());
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
if (initThreadLocal) {
refResult = new WeakReference<>(result);
mutableLogEventThreadLocal.set(refResult);
}
}
result.reserved = true;
result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared
result.setLoggerName(loggerName);
result.setMarker(marker);
result.setLoggerFqcn(fqcn);
result.setLevel(level == null ? Level.OFF : level);
result.setMessage(message);
result.setThrown(t);
result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData()));
result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy
result.setTimeMillis(message instanceof TimestampMessage
? ((TimestampMessage) message).getTimestamp()
: CLOCK.currentTimeMillis());
result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime());
if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) {
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call
result.setThreadPriority(Thread.currentThread().getPriority());
}
return result;
} }
|
public class class_name {
@Override
public LogEvent createEvent(final String loggerName, final Marker marker,
final String fqcn, final Level level, final Message message,
final List<Property> properties, final Throwable t) {
WeakReference<MutableLogEvent> refResult = mutableLogEventThreadLocal.get();
MutableLogEvent result = refResult == null ? null : refResult.get();
if (result == null || result.reserved) {
final boolean initThreadLocal = result == null;
result = new MutableLogEvent(); // depends on control dependency: [if], data = [none]
// usually no need to re-initialize thread-specific fields since the event is stored in a ThreadLocal
result.setThreadId(Thread.currentThread().getId()); // depends on control dependency: [if], data = [none]
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call // depends on control dependency: [if], data = [none]
result.setThreadPriority(Thread.currentThread().getPriority()); // depends on control dependency: [if], data = [none]
if (initThreadLocal) {
refResult = new WeakReference<>(result); // depends on control dependency: [if], data = [none]
mutableLogEventThreadLocal.set(refResult); // depends on control dependency: [if], data = [none]
}
}
result.reserved = true;
result.clear(); // ensure any previously cached values (thrownProxy, source, etc.) are cleared
result.setLoggerName(loggerName);
result.setMarker(marker);
result.setLoggerFqcn(fqcn);
result.setLevel(level == null ? Level.OFF : level);
result.setMessage(message);
result.setThrown(t);
result.setContextData(injector.injectContextData(properties, (StringMap) result.getContextData()));
result.setContextStack(ThreadContext.getDepth() == 0 ? ThreadContext.EMPTY_STACK : ThreadContext.cloneStack());// mutable copy
result.setTimeMillis(message instanceof TimestampMessage
? ((TimestampMessage) message).getTimestamp()
: CLOCK.currentTimeMillis());
result.setNanoTime(Log4jLogEvent.getNanoClock().nanoTime());
if (THREAD_NAME_CACHING_STRATEGY == ThreadNameCachingStrategy.UNCACHED) {
result.setThreadName(Thread.currentThread().getName()); // Thread.getName() allocates Objects on each call // depends on control dependency: [if], data = [none]
result.setThreadPriority(Thread.currentThread().getPriority()); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
protected Object getMacroBeanValue(Object bean, String property) {
Object result = null;
if ((bean != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(property)) {
try {
PropertyUtilsBean propBean = BeanUtilsBean.getInstance().getPropertyUtils();
result = propBean.getProperty(bean, property);
} catch (Exception e) {
LOG.error("Unable to access property '" + property + "' of '" + bean + "'.", e);
}
} else {
LOG.info("Invalid parameters: property='" + property + "' bean='" + bean + "'.");
}
return result;
} }
|
public class class_name {
protected Object getMacroBeanValue(Object bean, String property) {
Object result = null;
if ((bean != null) && CmsStringUtil.isNotEmptyOrWhitespaceOnly(property)) {
try {
PropertyUtilsBean propBean = BeanUtilsBean.getInstance().getPropertyUtils();
result = propBean.getProperty(bean, property); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Unable to access property '" + property + "' of '" + bean + "'.", e);
} // depends on control dependency: [catch], data = [none]
} else {
LOG.info("Invalid parameters: property='" + property + "' bean='" + bean + "'."); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findLastEntry(Map<CSNodeWrapper, T> map) {
Map.Entry<CSNodeWrapper, T> nodeEntry = null;
// Find the initial entry
for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) {
if (entry.getKey().getNextNode() == null) {
nodeEntry = entry;
break;
}
}
return nodeEntry;
} }
|
public class class_name {
private static <T extends Node> Map.Entry<CSNodeWrapper, T> findLastEntry(Map<CSNodeWrapper, T> map) {
Map.Entry<CSNodeWrapper, T> nodeEntry = null;
// Find the initial entry
for (final Map.Entry<CSNodeWrapper, T> entry : map.entrySet()) {
if (entry.getKey().getNextNode() == null) {
nodeEntry = entry; // depends on control dependency: [if], data = [none]
break;
}
}
return nodeEntry;
} }
|
public class class_name {
private void addMenuItems(Menu mMenu, boolean subMenu) {
int groupId = R.id.material_drawer_menu_default_group;
for (int i = 0; i < mMenu.size(); i++) {
MenuItem mMenuItem = mMenu.getItem(i);
IDrawerItem iDrawerItem;
if (!subMenu && mMenuItem.getGroupId() != groupId && mMenuItem.getGroupId() != 0) {
groupId = mMenuItem.getGroupId();
iDrawerItem = new DividerDrawerItem();
getItemAdapter().add(iDrawerItem);
}
if (mMenuItem.hasSubMenu()) {
iDrawerItem = new PrimaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled())
.withSelectable(false);
getItemAdapter().add(iDrawerItem);
addMenuItems(mMenuItem.getSubMenu(), true);
} else if (mMenuItem.getGroupId() != 0 || subMenu) {
iDrawerItem = new SecondaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled());
getItemAdapter().add(iDrawerItem);
} else {
iDrawerItem = new PrimaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled());
getItemAdapter().add(iDrawerItem);
}
}
} }
|
public class class_name {
private void addMenuItems(Menu mMenu, boolean subMenu) {
int groupId = R.id.material_drawer_menu_default_group;
for (int i = 0; i < mMenu.size(); i++) {
MenuItem mMenuItem = mMenu.getItem(i);
IDrawerItem iDrawerItem;
if (!subMenu && mMenuItem.getGroupId() != groupId && mMenuItem.getGroupId() != 0) {
groupId = mMenuItem.getGroupId(); // depends on control dependency: [if], data = [none]
iDrawerItem = new DividerDrawerItem(); // depends on control dependency: [if], data = [none]
getItemAdapter().add(iDrawerItem); // depends on control dependency: [if], data = [none]
}
if (mMenuItem.hasSubMenu()) {
iDrawerItem = new PrimaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled())
.withSelectable(false); // depends on control dependency: [if], data = [none]
getItemAdapter().add(iDrawerItem); // depends on control dependency: [if], data = [none]
addMenuItems(mMenuItem.getSubMenu(), true); // depends on control dependency: [if], data = [none]
} else if (mMenuItem.getGroupId() != 0 || subMenu) {
iDrawerItem = new SecondaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled()); // depends on control dependency: [if], data = [none]
getItemAdapter().add(iDrawerItem); // depends on control dependency: [if], data = [none]
} else {
iDrawerItem = new PrimaryDrawerItem()
.withName(mMenuItem.getTitle().toString())
.withIcon(mMenuItem.getIcon())
.withIdentifier(mMenuItem.getItemId())
.withEnabled(mMenuItem.isEnabled()); // depends on control dependency: [if], data = [none]
getItemAdapter().add(iDrawerItem); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static boolean resourceExist(ExternalContext externalContext, String path)
{
if ("/".equals(path))
{
// The root context exists always
return true;
}
Object ctx = externalContext.getContext();
if (ctx instanceof ServletContext)
{
ServletContext servletContext = (ServletContext) ctx;
InputStream stream = servletContext.getResourceAsStream(path);
if (stream != null)
{
try
{
stream.close();
}
catch (IOException e)
{
// Ignore here, since we donnot wanted to read from this
// resource anyway
}
return true;
}
}
return false;
} }
|
public class class_name {
private static boolean resourceExist(ExternalContext externalContext, String path)
{
if ("/".equals(path))
{
// The root context exists always
return true; // depends on control dependency: [if], data = [none]
}
Object ctx = externalContext.getContext();
if (ctx instanceof ServletContext)
{
ServletContext servletContext = (ServletContext) ctx;
InputStream stream = servletContext.getResourceAsStream(path);
if (stream != null)
{
try
{
stream.close(); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
// Ignore here, since we donnot wanted to read from this
// resource anyway
} // depends on control dependency: [catch], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public void setDominantLanguageDetectionJobPropertiesList(
java.util.Collection<DominantLanguageDetectionJobProperties> dominantLanguageDetectionJobPropertiesList) {
if (dominantLanguageDetectionJobPropertiesList == null) {
this.dominantLanguageDetectionJobPropertiesList = null;
return;
}
this.dominantLanguageDetectionJobPropertiesList = new java.util.ArrayList<DominantLanguageDetectionJobProperties>(
dominantLanguageDetectionJobPropertiesList);
} }
|
public class class_name {
public void setDominantLanguageDetectionJobPropertiesList(
java.util.Collection<DominantLanguageDetectionJobProperties> dominantLanguageDetectionJobPropertiesList) {
if (dominantLanguageDetectionJobPropertiesList == null) {
this.dominantLanguageDetectionJobPropertiesList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dominantLanguageDetectionJobPropertiesList = new java.util.ArrayList<DominantLanguageDetectionJobProperties>(
dominantLanguageDetectionJobPropertiesList);
} }
|
public class class_name {
public String assignFoundation(IceCandidate candidate) {
String identifier = computeIdentifier(candidate);
synchronized (this.foundations) {
String foundation = this.foundations.get(identifier);
if (foundation == null) {
this.currentFoundation++;
foundation = String.valueOf(this.currentFoundation);
this.foundations.put(identifier, foundation);
}
candidate.setFoundation(foundation);
return foundation;
}
} }
|
public class class_name {
public String assignFoundation(IceCandidate candidate) {
String identifier = computeIdentifier(candidate);
synchronized (this.foundations) {
String foundation = this.foundations.get(identifier);
if (foundation == null) {
this.currentFoundation++; // depends on control dependency: [if], data = [none]
foundation = String.valueOf(this.currentFoundation); // depends on control dependency: [if], data = [none]
this.foundations.put(identifier, foundation); // depends on control dependency: [if], data = [none]
}
candidate.setFoundation(foundation);
return foundation;
}
} }
|
public class class_name {
public static String analysisFileName(String url) {
if (StringUtils.isNullOrEmpty(url))
return url;
String result = url;
int idx = url.lastIndexOf("/");
int idx2 = url.lastIndexOf("?");
if (idx != -1) {
if (idx2 != -1) {
result = url.substring(idx + 1, idx2);
} else {
result = url.substring(idx + 1);
}
} else {
if (idx2 != -1) {
result = url.substring(0, idx2);
}
}
return result;
} }
|
public class class_name {
public static String analysisFileName(String url) {
if (StringUtils.isNullOrEmpty(url))
return url;
String result = url;
int idx = url.lastIndexOf("/");
int idx2 = url.lastIndexOf("?");
if (idx != -1) {
if (idx2 != -1) {
result = url.substring(idx + 1, idx2); // depends on control dependency: [if], data = [none]
} else {
result = url.substring(idx + 1); // depends on control dependency: [if], data = [none]
}
} else {
if (idx2 != -1) {
result = url.substring(0, idx2); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the ReportDefinitionService.
ReportDefinitionServiceInterface reportDefinitionService =
adWordsServices.get(session, ReportDefinitionServiceInterface.class);
// Get report fields.
ReportDefinitionField[] reportDefinitionFields =
reportDefinitionService
.getReportFields(ReportDefinitionReportType.KEYWORDS_PERFORMANCE_REPORT);
// Display report fields.
System.out.println("Available fields for report:");
for (ReportDefinitionField reportDefinitionField : reportDefinitionFields) {
System.out.printf("\t %s(%s) := [", reportDefinitionField.getFieldName(),
reportDefinitionField.getFieldType());
if (reportDefinitionField.getEnumValues() != null) {
for (String enumValue : reportDefinitionField.getEnumValues()) {
System.out.printf("%s, ", enumValue);
}
}
System.out.println("]");
}
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the ReportDefinitionService.
ReportDefinitionServiceInterface reportDefinitionService =
adWordsServices.get(session, ReportDefinitionServiceInterface.class);
// Get report fields.
ReportDefinitionField[] reportDefinitionFields =
reportDefinitionService
.getReportFields(ReportDefinitionReportType.KEYWORDS_PERFORMANCE_REPORT);
// Display report fields.
System.out.println("Available fields for report:");
for (ReportDefinitionField reportDefinitionField : reportDefinitionFields) {
System.out.printf("\t %s(%s) := [", reportDefinitionField.getFieldName(),
reportDefinitionField.getFieldType());
if (reportDefinitionField.getEnumValues() != null) {
for (String enumValue : reportDefinitionField.getEnumValues()) {
System.out.printf("%s, ", enumValue); // depends on control dependency: [for], data = [enumValue]
}
}
System.out.println("]");
}
} }
|
public class class_name {
@Override
public TemporalDataModelIF<Long, Long> parseTemporalData(final File f, final String mapIdsPrefix) throws IOException {
TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel();
Map<String, Long> mapUserIds = new HashMap<>();
Map<String, Long> mapItemIds = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
long curUser = getIndexMap(new File(mapIdsPrefix + "_userId.txt"), mapUserIds);
long curItem = getIndexMap(new File(mapIdsPrefix + "_itemId.txt"), mapItemIds);
BufferedReader br = SimpleParser.getBufferedReader(f);
String line;
while ((line = br.readLine()) != null) {
String[] toks = line.split("\t");
// user
String user = toks[USER_TOK];
if (!mapUserIds.containsKey(user)) {
mapUserIds.put(user, curUser);
curUser++;
}
long userId = mapUserIds.get(user);
// item
String artist = toks[ARTIST_TOK];
String track = toks[TRACK_TOK];
String item;
if (isUseArtists()) {
item = artist;
} else {
item = artist + "_" + track;
}
if (!mapItemIds.containsKey(item)) {
mapItemIds.put(item, curItem);
curItem++;
}
long itemId = mapItemIds.get(item);
// timestamp
long timestamp = -1;
if (TIME_TOK != -1) {
try {
timestamp = sdf.parse(toks[TIME_TOK]).getTime();
} catch (ParseException e) {
e.printStackTrace();
}
}
// preference
double preference = 1.0;
//////
// update information
//////
dataset.addPreference(userId, itemId, preference);
if (timestamp != -1) {
dataset.addTimestamp(userId, itemId, timestamp);
}
}
br.close();
// save map ids?
if (mapIdsPrefix != null) {
// save user map
PrintStream outUser = new PrintStream(mapIdsPrefix + "_userId.txt", "UTF-8");
for (Entry<String, Long> e : mapUserIds.entrySet()) {
outUser.println(e.getKey() + "\t" + e.getValue());
}
outUser.close();
// save item map
PrintStream outItem = new PrintStream(mapIdsPrefix + "_itemId.txt", "UTF-8");
for (Entry<String, Long> e : mapItemIds.entrySet()) {
outItem.println(e.getKey() + "\t" + e.getValue());
}
outItem.close();
}
return dataset;
} }
|
public class class_name {
@Override
public TemporalDataModelIF<Long, Long> parseTemporalData(final File f, final String mapIdsPrefix) throws IOException {
TemporalDataModelIF<Long, Long> dataset = DataModelFactory.getDefaultTemporalModel();
Map<String, Long> mapUserIds = new HashMap<>();
Map<String, Long> mapItemIds = new HashMap<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
long curUser = getIndexMap(new File(mapIdsPrefix + "_userId.txt"), mapUserIds);
long curItem = getIndexMap(new File(mapIdsPrefix + "_itemId.txt"), mapItemIds);
BufferedReader br = SimpleParser.getBufferedReader(f);
String line;
while ((line = br.readLine()) != null) {
String[] toks = line.split("\t");
// user
String user = toks[USER_TOK];
if (!mapUserIds.containsKey(user)) {
mapUserIds.put(user, curUser); // depends on control dependency: [if], data = [none]
curUser++; // depends on control dependency: [if], data = [none]
}
long userId = mapUserIds.get(user);
// item
String artist = toks[ARTIST_TOK];
String track = toks[TRACK_TOK];
String item;
if (isUseArtists()) {
item = artist; // depends on control dependency: [if], data = [none]
} else {
item = artist + "_" + track; // depends on control dependency: [if], data = [none]
}
if (!mapItemIds.containsKey(item)) {
mapItemIds.put(item, curItem); // depends on control dependency: [if], data = [none]
curItem++; // depends on control dependency: [if], data = [none]
}
long itemId = mapItemIds.get(item);
// timestamp
long timestamp = -1;
if (TIME_TOK != -1) {
try {
timestamp = sdf.parse(toks[TIME_TOK]).getTime(); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
// preference
double preference = 1.0;
//////
// update information
//////
dataset.addPreference(userId, itemId, preference);
if (timestamp != -1) {
dataset.addTimestamp(userId, itemId, timestamp); // depends on control dependency: [if], data = [none]
}
}
br.close();
// save map ids?
if (mapIdsPrefix != null) {
// save user map
PrintStream outUser = new PrintStream(mapIdsPrefix + "_userId.txt", "UTF-8");
for (Entry<String, Long> e : mapUserIds.entrySet()) {
outUser.println(e.getKey() + "\t" + e.getValue());
}
outUser.close();
// save item map
PrintStream outItem = new PrintStream(mapIdsPrefix + "_itemId.txt", "UTF-8");
for (Entry<String, Long> e : mapItemIds.entrySet()) {
outItem.println(e.getKey() + "\t" + e.getValue());
}
outItem.close();
}
return dataset;
} }
|
public class class_name {
@Override
public void setConstraintMappings(Configuration<?> config) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setConstraintMappings", config);
}
InputStream inputStream = null;
ClassLoader ccl = getContextClassLoader();
for (String fileName : getConstraintMapping()) {
// get an inputstream to the file
inputStream = ccl.getResource(fileName).openStream();
// if debugging then dump out the input stream to make sure it is valid
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
inputStream = dumpInputStream(inputStream);
if (inputStream == null) {
// we ran into trouble while dumping the stream... try again
inputStream = ccl.getResource(fileName).openStream();
}
}
config.addMapping(inputStream);
// add to list so we can close the inputStreams later.
mapFileInputStreams.add(inputStream);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setConstraintMappings");
}
} }
|
public class class_name {
@Override
public void setConstraintMappings(Configuration<?> config) throws IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "setConstraintMappings", config);
}
InputStream inputStream = null;
ClassLoader ccl = getContextClassLoader();
for (String fileName : getConstraintMapping()) {
// get an inputstream to the file
inputStream = ccl.getResource(fileName).openStream();
// if debugging then dump out the input stream to make sure it is valid
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
inputStream = dumpInputStream(inputStream);
if (inputStream == null) {
// we ran into trouble while dumping the stream... try again
inputStream = ccl.getResource(fileName).openStream(); // depends on control dependency: [if], data = [none]
}
}
config.addMapping(inputStream);
// add to list so we can close the inputStreams later.
mapFileInputStreams.add(inputStream);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "setConstraintMappings");
}
} }
|
public class class_name {
public static Duration parse(String value) {
/*
* Implementation note: Regular expressions are not used to improve
* performance.
*/
if (value.length() == 0) {
throw parseError(value);
}
int index = 0;
char first = value.charAt(index);
boolean prior = (first == '-');
if (first == '-' || first == '+') {
index++;
}
if (value.charAt(index) != 'P') {
throw parseError(value);
}
Builder builder = new Builder();
builder.prior(prior);
StringBuilder buffer = new StringBuilder();
for (int i = index + 1; i < value.length(); i++) {
char c = value.charAt(i);
if (c == 'T') {
/*
* A "T" character is supposed to immediately precede the time
* component value(s). It is required by the syntax, but not
* really necessary. Ignore it.
*/
continue;
}
if (c >= '0' && c <= '9') {
buffer.append(c);
continue;
}
if (buffer.length() == 0) {
throw parseError(value);
}
Integer num = Integer.valueOf(buffer.toString());
buffer.setLength(0);
switch (c) {
case 'W':
builder.weeks(num);
break;
case 'D':
builder.days(num);
break;
case 'H':
builder.hours(num);
break;
case 'M':
builder.minutes(num);
break;
case 'S':
builder.seconds(num);
break;
default:
throw parseError(value);
}
}
return builder.build();
} }
|
public class class_name {
public static Duration parse(String value) {
/*
* Implementation note: Regular expressions are not used to improve
* performance.
*/
if (value.length() == 0) {
throw parseError(value);
}
int index = 0;
char first = value.charAt(index);
boolean prior = (first == '-');
if (first == '-' || first == '+') {
index++; // depends on control dependency: [if], data = [none]
}
if (value.charAt(index) != 'P') {
throw parseError(value);
}
Builder builder = new Builder();
builder.prior(prior);
StringBuilder buffer = new StringBuilder();
for (int i = index + 1; i < value.length(); i++) {
char c = value.charAt(i);
if (c == 'T') {
/*
* A "T" character is supposed to immediately precede the time
* component value(s). It is required by the syntax, but not
* really necessary. Ignore it.
*/
continue;
}
if (c >= '0' && c <= '9') {
buffer.append(c); // depends on control dependency: [if], data = [(c]
continue;
}
if (buffer.length() == 0) {
throw parseError(value);
}
Integer num = Integer.valueOf(buffer.toString());
buffer.setLength(0); // depends on control dependency: [for], data = [none]
switch (c) {
case 'W':
builder.weeks(num);
break;
case 'D':
builder.days(num);
break;
case 'H':
builder.hours(num);
break;
case 'M':
builder.minutes(num);
break;
case 'S':
builder.seconds(num);
break;
default:
throw parseError(value);
}
}
return builder.build();
} }
|
public class class_name {
public void beginUpdate() {
if (log.isTraceEnabled()) {
log.trace("beginUpdate - locked: {} owner: {}", lock.isLocked(), lock.isHeldByCurrentThread());
}
// make sure only one thread can update the SO
lock.lock();
so.beginUpdate();
} }
|
public class class_name {
public void beginUpdate() {
if (log.isTraceEnabled()) {
log.trace("beginUpdate - locked: {} owner: {}", lock.isLocked(), lock.isHeldByCurrentThread());
// depends on control dependency: [if], data = [none]
}
// make sure only one thread can update the SO
lock.lock();
so.beginUpdate();
} }
|
public class class_name {
public long wrapRecords(ChunkStream<byte[], BytesReference> stream,
boolean withCollection) throws IOException {
final AtomicInteger l = new AtomicInteger();
try {
// keep reference to our record listener here, because builder will
// enforce an internal record listener
MarcRecordListener marcRecordListener = builder.getMarcRecordListener();
if (withCollection) {
// write XML declaration if required
if (marcRecordListener instanceof ContentHandler) {
((ContentHandler) marcRecordListener).startDocument();
}
marcRecordListener.beginCollection();
}
if (builder.marcGenerator == null) {
builder.marcGenerator = builder.createGenerator();
}
// short-circuit: set MARC listener of the MARC generator to builder to capture records
builder.marcGenerator.setMarcListener(builder);
builder.marcGenerator.setCharset(builder.getCharset());
builder.stream = stream;
// voila: now we can stream records
builder.recordStream().forEach(record -> {
marcRecordListener.record(record);
l.incrementAndGet();
});
stream.close();
builder.marcGenerator.flush();
if (withCollection) {
marcRecordListener.endCollection();
if (marcRecordListener instanceof ContentHandler) {
((ContentHandler) marcRecordListener).endDocument();
}
}
} catch (SAXException e) {
throw new IOException(e);
} finally {
// we close input stream always
if (builder.getInputStream() != null) {
builder.getInputStream().close();
}
}
return l.get();
} }
|
public class class_name {
public long wrapRecords(ChunkStream<byte[], BytesReference> stream,
boolean withCollection) throws IOException {
final AtomicInteger l = new AtomicInteger();
try {
// keep reference to our record listener here, because builder will
// enforce an internal record listener
MarcRecordListener marcRecordListener = builder.getMarcRecordListener();
if (withCollection) {
// write XML declaration if required
if (marcRecordListener instanceof ContentHandler) {
((ContentHandler) marcRecordListener).startDocument(); // depends on control dependency: [if], data = [none]
}
marcRecordListener.beginCollection(); // depends on control dependency: [if], data = [none]
}
if (builder.marcGenerator == null) {
builder.marcGenerator = builder.createGenerator(); // depends on control dependency: [if], data = [none]
}
// short-circuit: set MARC listener of the MARC generator to builder to capture records
builder.marcGenerator.setMarcListener(builder);
builder.marcGenerator.setCharset(builder.getCharset());
builder.stream = stream;
// voila: now we can stream records
builder.recordStream().forEach(record -> {
marcRecordListener.record(record);
l.incrementAndGet();
});
stream.close();
builder.marcGenerator.flush();
if (withCollection) {
marcRecordListener.endCollection();
if (marcRecordListener instanceof ContentHandler) {
((ContentHandler) marcRecordListener).endDocument(); // depends on control dependency: [if], data = [none]
}
}
} catch (SAXException e) {
throw new IOException(e);
} finally {
// we close input stream always
if (builder.getInputStream() != null) {
builder.getInputStream().close();
}
}
return l.get();
} }
|
public class class_name {
private boolean checkConsumerDiscriminatorAccess(DestinationHandler destination,
String discriminator,
SecurityContext secContext)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkConsumerDiscriminatorAccess",
new Object[] { destination,
discriminator,
secContext });
boolean allowed = true;
// If the discriminator is non-wildcarded, we can check authority to consume on
// the discriminator.
if (discriminator != null &&
!_messageProcessor.getMessageProcessorMatching().isWildCarded(discriminator))
{
// set the discriminator into the security context
secContext.setDiscriminator(discriminator);
if (!destination.checkDiscriminatorAccess(secContext,
OperationType.RECEIVE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", "not authorized to consume from this destination's discriminator");
// Write an audit record if access is denied
SibTr.audit(tc, nls.getFormattedMessage(
"USER_NOT_AUTH_RECEIVE_ERROR_CWSIP0310",
new Object[] { destination.getName(),
discriminator,
secContext.getUserName(false) },
null));
allowed = false;
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", Boolean.valueOf(allowed));
return allowed;
} }
|
public class class_name {
private boolean checkConsumerDiscriminatorAccess(DestinationHandler destination,
String discriminator,
SecurityContext secContext)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkConsumerDiscriminatorAccess",
new Object[] { destination,
discriminator,
secContext });
boolean allowed = true;
// If the discriminator is non-wildcarded, we can check authority to consume on
// the discriminator.
if (discriminator != null &&
!_messageProcessor.getMessageProcessorMatching().isWildCarded(discriminator))
{
// set the discriminator into the security context
secContext.setDiscriminator(discriminator); // depends on control dependency: [if], data = [(discriminator]
if (!destination.checkDiscriminatorAccess(secContext,
OperationType.RECEIVE))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", "not authorized to consume from this destination's discriminator");
// Write an audit record if access is denied
SibTr.audit(tc, nls.getFormattedMessage(
"USER_NOT_AUTH_RECEIVE_ERROR_CWSIP0310",
new Object[] { destination.getName(),
discriminator,
secContext.getUserName(false) },
null)); // depends on control dependency: [if], data = [none]
allowed = false; // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkConsumerDiscriminatorAccess", Boolean.valueOf(allowed));
return allowed;
} }
|
public class class_name {
private static String truncateAsJson(String s, int maxSerializedLength) {
int resultLength = 0;
int spaceLeft = maxSerializedLength - 2; // enclosing quotes always consume 2 slots
for (char c : s.toCharArray()) {
final boolean charNeedsEscape = c == '\\' || c == '"' || c == '\t';
spaceLeft -= charNeedsEscape ? 2 : 1;
if (spaceLeft < 0) {
break;
}
resultLength++;
}
return truncate(s, resultLength);
} }
|
public class class_name {
private static String truncateAsJson(String s, int maxSerializedLength) {
int resultLength = 0;
int spaceLeft = maxSerializedLength - 2; // enclosing quotes always consume 2 slots
for (char c : s.toCharArray()) {
final boolean charNeedsEscape = c == '\\' || c == '"' || c == '\t';
spaceLeft -= charNeedsEscape ? 2 : 1; // depends on control dependency: [for], data = [c]
if (spaceLeft < 0) {
break;
}
resultLength++; // depends on control dependency: [for], data = [none]
}
return truncate(s, resultLength);
} }
|
public class class_name {
AlignmentPattern find() throws NotFoundException {
int startX = this.startX;
int height = this.height;
int maxJ = startX + width;
int middleI = startY + (height / 2);
// We are looking for black/white/black modules in 1:1:1 ratio;
// this tracks the number of black/white/black modules seen so far
int[] stateCount = new int[3];
for (int iGen = 0; iGen < height; iGen++) {
// Search from middle outwards
int i = middleI + ((iGen & 0x01) == 0 ? (iGen + 1) / 2 : -((iGen + 1) / 2));
stateCount[0] = 0;
stateCount[1] = 0;
stateCount[2] = 0;
int j = startX;
// Burn off leading white pixels before anything else; if we start in the middle of
// a white run, it doesn't make sense to count its length, since we don't know if the
// white run continued to the left of the start point
while (j < maxJ && !image.get(j, i)) {
j++;
}
int currentState = 0;
while (j < maxJ) {
if (image.get(j, i)) {
// Black pixel
if (currentState == 1) { // Counting black pixels
stateCount[1]++;
} else { // Counting white pixels
if (currentState == 2) { // A winner?
if (foundPatternCross(stateCount)) { // Yes
AlignmentPattern confirmed = handlePossibleCenter(stateCount, i, j);
if (confirmed != null) {
return confirmed;
}
}
stateCount[0] = stateCount[2];
stateCount[1] = 1;
stateCount[2] = 0;
currentState = 1;
} else {
stateCount[++currentState]++;
}
}
} else { // White pixel
if (currentState == 1) { // Counting black pixels
currentState++;
}
stateCount[currentState]++;
}
j++;
}
if (foundPatternCross(stateCount)) {
AlignmentPattern confirmed = handlePossibleCenter(stateCount, i, maxJ);
if (confirmed != null) {
return confirmed;
}
}
}
// Hmm, nothing we saw was observed and confirmed twice. If we had
// any guess at all, return it.
if (!possibleCenters.isEmpty()) {
return possibleCenters.get(0);
}
throw NotFoundException.getNotFoundInstance();
} }
|
public class class_name {
AlignmentPattern find() throws NotFoundException {
int startX = this.startX;
int height = this.height;
int maxJ = startX + width;
int middleI = startY + (height / 2);
// We are looking for black/white/black modules in 1:1:1 ratio;
// this tracks the number of black/white/black modules seen so far
int[] stateCount = new int[3];
for (int iGen = 0; iGen < height; iGen++) {
// Search from middle outwards
int i = middleI + ((iGen & 0x01) == 0 ? (iGen + 1) / 2 : -((iGen + 1) / 2));
stateCount[0] = 0;
stateCount[1] = 0;
stateCount[2] = 0;
int j = startX;
// Burn off leading white pixels before anything else; if we start in the middle of
// a white run, it doesn't make sense to count its length, since we don't know if the
// white run continued to the left of the start point
while (j < maxJ && !image.get(j, i)) {
j++;
}
int currentState = 0;
while (j < maxJ) {
if (image.get(j, i)) {
// Black pixel
if (currentState == 1) { // Counting black pixels
stateCount[1]++;
} else { // Counting white pixels
if (currentState == 2) { // A winner?
if (foundPatternCross(stateCount)) { // Yes
AlignmentPattern confirmed = handlePossibleCenter(stateCount, i, j);
if (confirmed != null) {
return confirmed; // depends on control dependency: [if], data = [none]
}
}
stateCount[0] = stateCount[2];
stateCount[1] = 1;
stateCount[2] = 0;
currentState = 1;
} else {
stateCount[++currentState]++;
}
}
} else { // White pixel
if (currentState == 1) { // Counting black pixels
currentState++;
}
stateCount[currentState]++;
}
j++;
}
if (foundPatternCross(stateCount)) {
AlignmentPattern confirmed = handlePossibleCenter(stateCount, i, maxJ);
if (confirmed != null) {
return confirmed;
}
}
}
// Hmm, nothing we saw was observed and confirmed twice. If we had
// any guess at all, return it.
if (!possibleCenters.isEmpty()) {
return possibleCenters.get(0);
}
throw NotFoundException.getNotFoundInstance();
} }
|
public class class_name {
public static HistoryDTO transformToDto(History history) {
if (history == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
HistoryDTO historyDto = new HistoryDTO();
try {
BeanUtils.copyProperties(historyDto, history);
} catch (Exception ex) {
throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR);
}
return historyDto;
} }
|
public class class_name {
public static HistoryDTO transformToDto(History history) {
if (history == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
HistoryDTO historyDto = new HistoryDTO();
try {
BeanUtils.copyProperties(historyDto, history); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR);
} // depends on control dependency: [catch], data = [none]
return historyDto;
} }
|
public class class_name {
public static String packSchedule(String quartzExpr) {
if (quartzExpr == null) return null;
String[] exprElems = quartzExpr.trim().split("\\s+");
if (exprElems.length > 5) {
// Quartz cron expression contains secs, mins, hours, dates, months, days [, years]
// 1. Change days of week numbering
exprElems[5] = decreaseDoW(exprElems[5]);
// 2. Add interval in repeated items
exprElems[1] = extendRepeating(exprElems[1], "59");
exprElems[2] = extendRepeating(exprElems[2], "23");
exprElems[3] = extendRepeating(exprElems[3], "L");
exprElems[4] = extendRepeating(exprElems[4], "12");
exprElems[5] = extendRepeating(exprElems[5], "SAT");
// 3. Replace "working days" to "MON-FRI"
if (exprElems[3].indexOf('W') >= 0) {
exprElems[3] = exprElems[3].replaceAll("W", "");
exprElems[5] = "MON-FRI";
}
// 4. Replace "last day of week" to dates interval 24-L
if (exprElems[5].indexOf('L') >= 0) {
exprElems[5] = exprElems[5].replaceAll("L", "");
exprElems[3] = "24-L";
}
// 5. Ignore #n in days of week
int indSharp = exprElems[5].indexOf('#');
if (indSharp >= 0) exprElems[5] = exprElems[5].substring(0, indSharp);
// 6. Change all question marks to asterisks
if ("?".equals(exprElems[3])) exprElems[3] = "*";
if ("?".equals(exprElems[5])) exprElems[5] = "*";
// 7. Ignore seconds and years
return concat(' ', exprElems[1], exprElems[2], exprElems[3], exprElems[4], exprElems[5]);
} else {
return quartzExpr;
}
} }
|
public class class_name {
public static String packSchedule(String quartzExpr) {
if (quartzExpr == null) return null;
String[] exprElems = quartzExpr.trim().split("\\s+");
if (exprElems.length > 5) {
// Quartz cron expression contains secs, mins, hours, dates, months, days [, years]
// 1. Change days of week numbering
exprElems[5] = decreaseDoW(exprElems[5]);
// depends on control dependency: [if], data = [none]
// 2. Add interval in repeated items
exprElems[1] = extendRepeating(exprElems[1], "59");
// depends on control dependency: [if], data = [none]
exprElems[2] = extendRepeating(exprElems[2], "23");
// depends on control dependency: [if], data = [none]
exprElems[3] = extendRepeating(exprElems[3], "L");
// depends on control dependency: [if], data = [none]
exprElems[4] = extendRepeating(exprElems[4], "12");
// depends on control dependency: [if], data = [none]
exprElems[5] = extendRepeating(exprElems[5], "SAT");
// depends on control dependency: [if], data = [none]
// 3. Replace "working days" to "MON-FRI"
if (exprElems[3].indexOf('W') >= 0) {
exprElems[3] = exprElems[3].replaceAll("W", "");
// depends on control dependency: [if], data = [none]
exprElems[5] = "MON-FRI";
// depends on control dependency: [if], data = [none]
}
// 4. Replace "last day of week" to dates interval 24-L
if (exprElems[5].indexOf('L') >= 0) {
exprElems[5] = exprElems[5].replaceAll("L", "");
// depends on control dependency: [if], data = [none]
exprElems[3] = "24-L";
// depends on control dependency: [if], data = [none]
}
// 5. Ignore #n in days of week
int indSharp = exprElems[5].indexOf('#');
if (indSharp >= 0) exprElems[5] = exprElems[5].substring(0, indSharp);
// 6. Change all question marks to asterisks
if ("?".equals(exprElems[3])) exprElems[3] = "*";
if ("?".equals(exprElems[5])) exprElems[5] = "*";
// 7. Ignore seconds and years
return concat(' ', exprElems[1], exprElems[2], exprElems[3], exprElems[4], exprElems[5]);
// depends on control dependency: [if], data = [none]
} else {
return quartzExpr;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void swapType() {
if (type.equals(TYPE_AND)) {
type = TYPE_OR;
} else if (type.equals(TYPE_OR)) {
type = TYPE_AND;
} else {
throw new Error("unknown type");
}
swapNot();
List<MtasSpanQuery> queryList = positiveQueryList;
positiveQueryList = negativeQueryList;
negativeQueryList = queryList;
for (MtasCQLParserWordCondition c : conditionList) {
c.swapNot();
}
simplified = false;
} }
|
public class class_name {
public void swapType() {
if (type.equals(TYPE_AND)) {
type = TYPE_OR; // depends on control dependency: [if], data = [none]
} else if (type.equals(TYPE_OR)) {
type = TYPE_AND; // depends on control dependency: [if], data = [none]
} else {
throw new Error("unknown type");
}
swapNot();
List<MtasSpanQuery> queryList = positiveQueryList;
positiveQueryList = negativeQueryList;
negativeQueryList = queryList;
for (MtasCQLParserWordCondition c : conditionList) {
c.swapNot(); // depends on control dependency: [for], data = [c]
}
simplified = false;
} }
|
public class class_name {
@Override
public int getCount() {
if (mAdapter != null) {
/* Cnt of currently fetched ads, as long as it isn't more than no of max ads that can
fit dataset. */
int noOfAds = AdapterCalculator.getAdsCountToPublish(adFetcher.getFetchingAdsCount(), mAdapter.getCount());
return mAdapter.getCount() > 0 ? mAdapter.getCount() + noOfAds : 0;
} else {
return 0;
}
} }
|
public class class_name {
@Override
public int getCount() {
if (mAdapter != null) {
/* Cnt of currently fetched ads, as long as it isn't more than no of max ads that can
fit dataset. */
int noOfAds = AdapterCalculator.getAdsCountToPublish(adFetcher.getFetchingAdsCount(), mAdapter.getCount());
return mAdapter.getCount() > 0 ? mAdapter.getCount() + noOfAds : 0; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setWarningPeriod(final int warningPeriod) {
if (0 != warningPeriod && warningPeriod < MINIMUM_WARNING) {
throw new IllegalArgumentException("Warning period must be at least " + String.valueOf(
MINIMUM_WARNING));
}
if (warningPeriod != getWarningPeriod()) {
getOrCreateComponentModel().warningPeriod = warningPeriod;
}
} }
|
public class class_name {
public void setWarningPeriod(final int warningPeriod) {
if (0 != warningPeriod && warningPeriod < MINIMUM_WARNING) {
throw new IllegalArgumentException("Warning period must be at least " + String.valueOf(
MINIMUM_WARNING));
}
if (warningPeriod != getWarningPeriod()) {
getOrCreateComponentModel().warningPeriod = warningPeriod; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Double getDouble(int index) {
Number n = (Number) content.get(index);
if (n == null) {
return null;
} else if (n instanceof Double) {
return (Double) n;
} else {
return n.doubleValue(); //autoboxing to Double
}
} }
|
public class class_name {
public Double getDouble(int index) {
Number n = (Number) content.get(index);
if (n == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (n instanceof Double) {
return (Double) n; // depends on control dependency: [if], data = [none]
} else {
return n.doubleValue(); //autoboxing to Double // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean next() {
if (!this.iteratingBrlw.next()) {
if (!this.masterIterator.hasNext()) {
return false;
} else {
this.iteratingBrlw = new IteratingBufferedRunningLengthWord(this.masterIterator.next());
}
}
return true;
} }
|
public class class_name {
@Override
public boolean next() {
if (!this.iteratingBrlw.next()) {
if (!this.masterIterator.hasNext()) {
return false; // depends on control dependency: [if], data = [none]
} else {
this.iteratingBrlw = new IteratingBufferedRunningLengthWord(this.masterIterator.next()); // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, int value)
throws NoEnumFoundException {
for (Object oneEnumRaw : EnumSet.allOf(enumClass)) {
// This is an awkward hack: we _know_ T oneEnumRaw is of type T, since allOf(TClass)
// only returns T-type enums, but allOf doesn't guarantee this
//noinspection unchecked
T oneEnum = (T) oneEnumRaw;
if (value == oneEnum.getRawValue()) {
return oneEnum;
}
}
throw new NoEnumFoundException(String.format(
"No enum found for class %s with raw value %d", enumClass.getName(), value));
} }
|
public class class_name {
public static <T extends Enum & ParsableEnum> T enumWithRawValue(Class<T> enumClass, int value)
throws NoEnumFoundException {
for (Object oneEnumRaw : EnumSet.allOf(enumClass)) {
// This is an awkward hack: we _know_ T oneEnumRaw is of type T, since allOf(TClass)
// only returns T-type enums, but allOf doesn't guarantee this
//noinspection unchecked
T oneEnum = (T) oneEnumRaw;
if (value == oneEnum.getRawValue()) {
return oneEnum; // depends on control dependency: [if], data = [none]
}
}
throw new NoEnumFoundException(String.format(
"No enum found for class %s with raw value %d", enumClass.getName(), value));
} }
|
public class class_name {
public Area findBasicAreas()
{
AreaImpl rootarea = new AreaImpl(0, 0, 0, 0);
setRoot(rootarea);
rootarea.setAreaTree(this);
rootarea.setPage(page);
for (int i = 0; i < page.getRoot().getChildCount(); i++)
{
Box cbox = page.getRoot().getChildAt(i);
Area sub = new AreaImpl(cbox);
if (sub.getWidth() > 1 || sub.getHeight() > 1)
{
findStandaloneAreas(page.getRoot().getChildAt(i), sub);
rootarea.appendChild(sub);
}
}
createGrids(rootarea);
return rootarea;
} }
|
public class class_name {
public Area findBasicAreas()
{
AreaImpl rootarea = new AreaImpl(0, 0, 0, 0);
setRoot(rootarea);
rootarea.setAreaTree(this);
rootarea.setPage(page);
for (int i = 0; i < page.getRoot().getChildCount(); i++)
{
Box cbox = page.getRoot().getChildAt(i);
Area sub = new AreaImpl(cbox);
if (sub.getWidth() > 1 || sub.getHeight() > 1)
{
findStandaloneAreas(page.getRoot().getChildAt(i), sub); // depends on control dependency: [if], data = [none]
rootarea.appendChild(sub); // depends on control dependency: [if], data = [none]
}
}
createGrids(rootarea);
return rootarea;
} }
|
public class class_name {
private List<Float> interpolateEmpty(int steps) {
List<Float> result = new ArrayList<Float>();
for (int i = 0; i < steps; i++) {
result.add(new Float(1 + i));
}
return result;
} }
|
public class class_name {
private List<Float> interpolateEmpty(int steps) {
List<Float> result = new ArrayList<Float>();
for (int i = 0; i < steps; i++) {
result.add(new Float(1 + i));
// depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
public static void setCalendarData(Calendar calendar, Locale locale)
{
int[] array = (int[])localeData.get(locale);
if(array == null)
{
Calendar c = Calendar.getInstance(locale);
array = new int[2];
array[0] = c.getFirstDayOfWeek();
array[1] = c.getMinimalDaysInFirstWeek();
localeData.putIfAbsent(locale, array);
}
calendar.setFirstDayOfWeek(array[0]);
calendar.setMinimalDaysInFirstWeek(array[1]);
} }
|
public class class_name {
public static void setCalendarData(Calendar calendar, Locale locale)
{
int[] array = (int[])localeData.get(locale);
if(array == null)
{
Calendar c = Calendar.getInstance(locale);
array = new int[2]; // depends on control dependency: [if], data = [none]
array[0] = c.getFirstDayOfWeek(); // depends on control dependency: [if], data = [none]
array[1] = c.getMinimalDaysInFirstWeek(); // depends on control dependency: [if], data = [none]
localeData.putIfAbsent(locale, array); // depends on control dependency: [if], data = [none]
}
calendar.setFirstDayOfWeek(array[0]);
calendar.setMinimalDaysInFirstWeek(array[1]);
} }
|
public class class_name {
protected final String getForSave(final Class<?> pClass) {
if (this.sharedEntities.contains(pClass)) {
return null;
} else if (SeServiceSpecifics.class == pClass) {
return PrcSeServiceSpecSave.class.getSimpleName();
} else if (SeGoodsSpecifics.class == pClass) {
return PrcSeGoodsSpecSave.class.getSimpleName();
} else if (IHasSeSeller.class.isAssignableFrom(pClass)) {
return PrcHasSeSellerSave.class.getSimpleName();
}
return null;
} }
|
public class class_name {
protected final String getForSave(final Class<?> pClass) {
if (this.sharedEntities.contains(pClass)) {
return null; // depends on control dependency: [if], data = [none]
} else if (SeServiceSpecifics.class == pClass) {
return PrcSeServiceSpecSave.class.getSimpleName(); // depends on control dependency: [if], data = [none]
} else if (SeGoodsSpecifics.class == pClass) {
return PrcSeGoodsSpecSave.class.getSimpleName(); // depends on control dependency: [if], data = [none]
} else if (IHasSeSeller.class.isAssignableFrom(pClass)) {
return PrcHasSeSellerSave.class.getSimpleName(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public PT getStartingPointFor(int index) {
if ((index < 1) || (this.segmentList.size() <= 1)) {
if (this.startingPoint != null) {
return this.startingPoint;
}
} else {
int idx = index;
ST currentSegment = this.segmentList.get(idx);
ST previousSegment = this.segmentList.get(--idx);
// Because the two segments are the same
// we must go deeper in the path elements
// to detect the right segment
int count = 0;
while ((previousSegment != null) && (previousSegment.equals(currentSegment))) {
currentSegment = previousSegment;
idx--;
previousSegment = (idx >= 0) ? this.segmentList.get(idx) : null;
count++;
}
if (count > 0) {
PT sp = null;
if (previousSegment != null) {
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
sp = p1;
} else if (p2.equals(p3) || p2.equals(p4)) {
sp = p2;
}
} else {
sp = this.startingPoint;
}
if (sp != null) {
return ((count % 2) == 0) ? sp : currentSegment.getOtherSidePoint(sp);
}
} else if ((currentSegment != null) && (previousSegment != null)) {
// if the two segments are different
// it is simple to detect the
// common point
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
return p1;
}
if (p2.equals(p3) || p2.equals(p4)) {
return p2;
}
}
}
return null;
} }
|
public class class_name {
@Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public PT getStartingPointFor(int index) {
if ((index < 1) || (this.segmentList.size() <= 1)) {
if (this.startingPoint != null) {
return this.startingPoint; // depends on control dependency: [if], data = [none]
}
} else {
int idx = index;
ST currentSegment = this.segmentList.get(idx);
ST previousSegment = this.segmentList.get(--idx);
// Because the two segments are the same
// we must go deeper in the path elements
// to detect the right segment
int count = 0;
while ((previousSegment != null) && (previousSegment.equals(currentSegment))) {
currentSegment = previousSegment; // depends on control dependency: [while], data = [none]
idx--; // depends on control dependency: [while], data = [none]
previousSegment = (idx >= 0) ? this.segmentList.get(idx) : null; // depends on control dependency: [while], data = [none]
count++; // depends on control dependency: [while], data = [none]
}
if (count > 0) {
PT sp = null;
if (previousSegment != null) {
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null; // depends on control dependency: [if], data = [none]
if (p1.equals(p3) || p1.equals(p4)) {
sp = p1; // depends on control dependency: [if], data = [none]
} else if (p2.equals(p3) || p2.equals(p4)) {
sp = p2; // depends on control dependency: [if], data = [none]
}
} else {
sp = this.startingPoint; // depends on control dependency: [if], data = [none]
}
if (sp != null) {
return ((count % 2) == 0) ? sp : currentSegment.getOtherSidePoint(sp); // depends on control dependency: [if], data = [(sp]
}
} else if ((currentSegment != null) && (previousSegment != null)) {
// if the two segments are different
// it is simple to detect the
// common point
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null; // depends on control dependency: [if], data = [none]
if (p1.equals(p3) || p1.equals(p4)) {
return p1; // depends on control dependency: [if], data = [none]
}
if (p2.equals(p3) || p2.equals(p4)) {
return p2; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
protected <T> URI buidURI(Request<T> request){
URL url = null;
try {
url = api.getURL();
} catch (MalformedURLException e) {
throw new ClientException(e);
}
String path = inquirePath(request);
Map<String,String> qry = RequestUtil.resolveQueryPart(request);
Set<String> keys = qry.keySet();
String query = "";
if(!keys.isEmpty()){
for(String key : keys){
query += (!query.isEmpty()?"&":"?")+key+"="+qry.get(key);
}
}
String fqrn = url.toString() + path + query;
try {
return new URI(fqrn);
} catch (URISyntaxException e) {
throw new ClientException(e);
}
} }
|
public class class_name {
protected <T> URI buidURI(Request<T> request){
URL url = null;
try {
url = api.getURL(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
throw new ClientException(e);
} // depends on control dependency: [catch], data = [none]
String path = inquirePath(request);
Map<String,String> qry = RequestUtil.resolveQueryPart(request);
Set<String> keys = qry.keySet();
String query = "";
if(!keys.isEmpty()){
for(String key : keys){
query += (!query.isEmpty()?"&":"?")+key+"="+qry.get(key); // depends on control dependency: [for], data = [key]
}
}
String fqrn = url.toString() + path + query;
try {
return new URI(fqrn); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
throw new ClientException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public java.util.List<String> getTokenNameList() {
if (tokenNameList == null) {
tokenNameList = new com.amazonaws.internal.SdkInternalList<String>();
}
return tokenNameList;
} }
|
public class class_name {
public java.util.List<String> getTokenNameList() {
if (tokenNameList == null) {
tokenNameList = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return tokenNameList;
} }
|
public class class_name {
public static String format(String s, Map<String, String> map) {
StringBuilder sb = new StringBuilder((int)(s.length() * 1.5));
int cursor = 0;
for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf('}', start)) != -1;) {
sb.append(s.substring(cursor, start));
String key = s.substring(start + 2, end);
sb.append(map.get(StringUtils.trim(key)));
cursor = end + 1;
}
sb.append(s.substring(cursor, s.length()));
return sb.toString();
} }
|
public class class_name {
public static String format(String s, Map<String, String> map) {
StringBuilder sb = new StringBuilder((int)(s.length() * 1.5));
int cursor = 0;
for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf('}', start)) != -1;) {
sb.append(s.substring(cursor, start)); // depends on control dependency: [for], data = [none]
String key = s.substring(start + 2, end);
sb.append(map.get(StringUtils.trim(key))); // depends on control dependency: [for], data = [none]
cursor = end + 1; // depends on control dependency: [for], data = [none]
}
sb.append(s.substring(cursor, s.length()));
return sb.toString();
} }
|
public class class_name {
@Override
public void initializeParts() {
super.initializeParts();
getStyleClass().addAll("simple-integer-control");
final SpinnerValueFactory.IntegerSpinnerValueFactory factory =
new SpinnerValueFactory.IntegerSpinnerValueFactory(
Integer.MIN_VALUE, Integer.MAX_VALUE, field.getValue()
);
// override old converter (IntegerStringConverter) because it throws
// NumberFormatException if value can not be parsed to Integer
factory.setConverter(new NoExceptionStringConverter());
editableSpinner.setValueFactory(factory);
editableSpinner.focusedProperty().addListener((observable, wasFocused, isFocused) -> {
if (wasFocused && !isFocused) {
overrideNonIntegerSpinnerValues();
}
});
editableSpinner.addEventHandler(KeyEvent.ANY, event -> {
if (event.getCode() == KeyCode.ENTER) {
overrideNonIntegerSpinnerValues();
}
});
} }
|
public class class_name {
@Override
public void initializeParts() {
super.initializeParts();
getStyleClass().addAll("simple-integer-control");
final SpinnerValueFactory.IntegerSpinnerValueFactory factory =
new SpinnerValueFactory.IntegerSpinnerValueFactory(
Integer.MIN_VALUE, Integer.MAX_VALUE, field.getValue()
);
// override old converter (IntegerStringConverter) because it throws
// NumberFormatException if value can not be parsed to Integer
factory.setConverter(new NoExceptionStringConverter());
editableSpinner.setValueFactory(factory);
editableSpinner.focusedProperty().addListener((observable, wasFocused, isFocused) -> {
if (wasFocused && !isFocused) {
overrideNonIntegerSpinnerValues(); // depends on control dependency: [if], data = [none]
}
});
editableSpinner.addEventHandler(KeyEvent.ANY, event -> {
if (event.getCode() == KeyCode.ENTER) {
overrideNonIntegerSpinnerValues();
}
});
} }
|
public class class_name {
public void setBundleActivator(String bundleActivator) {
String old = mainAttributes.get(BUNDLE_ACTIVATOR);
if (!bundleActivator.equals(old)) {
this.mainAttributes.put(BUNDLE_ACTIVATOR, bundleActivator);
this.modified = true;
this.bundleActivator = bundleActivator;
}
} }
|
public class class_name {
public void setBundleActivator(String bundleActivator) {
String old = mainAttributes.get(BUNDLE_ACTIVATOR);
if (!bundleActivator.equals(old)) {
this.mainAttributes.put(BUNDLE_ACTIVATOR, bundleActivator); // depends on control dependency: [if], data = [none]
this.modified = true; // depends on control dependency: [if], data = [none]
this.bundleActivator = bundleActivator; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public VariantStudyMetadata getVariantStudyMetadata(String studyId) {
if (studyId != null) {
if (variantMetadata.getStudies() == null) {
variantMetadata.setStudies(new ArrayList<>());
}
for (VariantStudyMetadata study : variantMetadata.getStudies()) {
if (studyId.equals(study.getId())) {
return study;
}
}
} else {
logger.error("Study ID is null");
}
return null;
} }
|
public class class_name {
public VariantStudyMetadata getVariantStudyMetadata(String studyId) {
if (studyId != null) {
if (variantMetadata.getStudies() == null) {
variantMetadata.setStudies(new ArrayList<>()); // depends on control dependency: [if], data = [none]
}
for (VariantStudyMetadata study : variantMetadata.getStudies()) {
if (studyId.equals(study.getId())) {
return study; // depends on control dependency: [if], data = [none]
}
}
} else {
logger.error("Study ID is null"); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public Expr[] translateExpressions(Tuple<WyilFile.Expr> loc, LocalEnvironment environment) {
ArrayList<Expr> results = new ArrayList<>();
for (int i = 0; i != loc.size(); ++i) {
WyilFile.Expr operand = loc.get(i);
Tuple<Type> types = operand.getTypes();
if (types == null) {
results.add(translateExpression(loc.get(i), null, environment));
} else {
for (int j = 0; j != types.size(); ++j) {
results.add(translateExpression(operand, j, environment));
}
}
}
return results.toArray(new Expr[results.size()]);
} }
|
public class class_name {
public Expr[] translateExpressions(Tuple<WyilFile.Expr> loc, LocalEnvironment environment) {
ArrayList<Expr> results = new ArrayList<>();
for (int i = 0; i != loc.size(); ++i) {
WyilFile.Expr operand = loc.get(i);
Tuple<Type> types = operand.getTypes();
if (types == null) {
results.add(translateExpression(loc.get(i), null, environment)); // depends on control dependency: [if], data = [none]
} else {
for (int j = 0; j != types.size(); ++j) {
results.add(translateExpression(operand, j, environment)); // depends on control dependency: [for], data = [j]
}
}
}
return results.toArray(new Expr[results.size()]);
} }
|
public class class_name {
public void appendSkippedUnit(StringBuffer sb) {
if (dr.skippedUnitMarker != null) {
sb.append(dr.skippedUnitMarker);
}
} }
|
public class class_name {
public void appendSkippedUnit(StringBuffer sb) {
if (dr.skippedUnitMarker != null) {
sb.append(dr.skippedUnitMarker); // depends on control dependency: [if], data = [(dr.skippedUnitMarker]
}
} }
|
public class class_name {
public BufferedImage drawTile(int[][] unsignedPixelValues) {
int tileWidth = unsignedPixelValues[0].length;
int tileHeight = unsignedPixelValues.length;
BufferedImage image = createImage(tileWidth, tileHeight);
WritableRaster raster = image.getRaster();
for (int x = 0; x < tileWidth; x++) {
for (int y = 0; y < tileHeight; y++) {
int unsignedPixelValue = unsignedPixelValues[y][x];
setPixelValue(raster, x, y, unsignedPixelValue);
}
}
return image;
} }
|
public class class_name {
public BufferedImage drawTile(int[][] unsignedPixelValues) {
int tileWidth = unsignedPixelValues[0].length;
int tileHeight = unsignedPixelValues.length;
BufferedImage image = createImage(tileWidth, tileHeight);
WritableRaster raster = image.getRaster();
for (int x = 0; x < tileWidth; x++) {
for (int y = 0; y < tileHeight; y++) {
int unsignedPixelValue = unsignedPixelValues[y][x];
setPixelValue(raster, x, y, unsignedPixelValue); // depends on control dependency: [for], data = [y]
}
}
return image;
} }
|
public class class_name {
public void sendMessage(ABaseFluidJSONObject aBaseFluidJSONObjectParam) {
if(aBaseFluidJSONObjectParam == null) {
throw new FluidClientException(
"No JSON Object to send.",
FluidClientException.ErrorCode.IO_ERROR);
} else {
this.sendMessage(aBaseFluidJSONObjectParam.toJsonObject().toString());
}
} }
|
public class class_name {
public void sendMessage(ABaseFluidJSONObject aBaseFluidJSONObjectParam) {
if(aBaseFluidJSONObjectParam == null) {
throw new FluidClientException(
"No JSON Object to send.",
FluidClientException.ErrorCode.IO_ERROR);
} else {
this.sendMessage(aBaseFluidJSONObjectParam.toJsonObject().toString()); // depends on control dependency: [if], data = [(aBaseFluidJSONObjectParam]
}
} }
|
public class class_name {
public Observable<ServiceResponse<AgentRegistrationInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String automationAccountName, AgentRegistrationRegenerateKeyParameter parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (automationAccountName == null) {
throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2015-10-31";
return service.regenerateKey(resourceGroupName, automationAccountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<AgentRegistrationInner>>>() {
@Override
public Observable<ServiceResponse<AgentRegistrationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<AgentRegistrationInner> clientResponse = regenerateKeyDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<AgentRegistrationInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String automationAccountName, AgentRegistrationRegenerateKeyParameter parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (automationAccountName == null) {
throw new IllegalArgumentException("Parameter automationAccountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2015-10-31";
return service.regenerateKey(resourceGroupName, automationAccountName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<AgentRegistrationInner>>>() {
@Override
public Observable<ServiceResponse<AgentRegistrationInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<AgentRegistrationInner> clientResponse = regenerateKeyDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public List<List<T>> split(Predicate<? super T> predicate) {
final List<T> a = Lists.newArrayList(), b = Lists.newArrayList();
for (T elt: each()) {
(predicate.apply(elt) ? a : b).add(elt);
}
List<List<T>> result = Lists.newArrayList();
result.add(a);
result.add(b);
return result;
} }
|
public class class_name {
public List<List<T>> split(Predicate<? super T> predicate) {
final List<T> a = Lists.newArrayList(), b = Lists.newArrayList();
for (T elt: each()) {
(predicate.apply(elt) ? a : b).add(elt); // depends on control dependency: [for], data = [elt]
}
List<List<T>> result = Lists.newArrayList();
result.add(a);
result.add(b);
return result;
} }
|
public class class_name {
public ContainerTx getCurrentContainerTx() {
ContainerTx result = null;
SynchronizationRegistryUOWScope currTxKey = null;
try {
currTxKey = uowCtrl.getCurrentTransactionalUOW(false);
} catch (CSITransactionRolledbackException ex) {
// (not expected, since passing false on getCurrentTransactionalUOW)
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCurrentContainerTx: " + ex);
}
if (currTxKey != null) {
result = (ContainerTx) currTxKey.getResource(containerTxResourceKey);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCurrentContainerTx() : " + result);
return result;
} }
|
public class class_name {
public ContainerTx getCurrentContainerTx() {
ContainerTx result = null;
SynchronizationRegistryUOWScope currTxKey = null;
try {
currTxKey = uowCtrl.getCurrentTransactionalUOW(false); // depends on control dependency: [try], data = [none]
} catch (CSITransactionRolledbackException ex) {
// (not expected, since passing false on getCurrentTransactionalUOW)
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCurrentContainerTx: " + ex);
} // depends on control dependency: [catch], data = [none]
if (currTxKey != null) {
result = (ContainerTx) currTxKey.getResource(containerTxResourceKey); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getCurrentContainerTx() : " + result);
return result;
} }
|
public class class_name {
public GetServiceLastAccessedDetailsResult withServicesLastAccessed(ServiceLastAccessed... servicesLastAccessed) {
if (this.servicesLastAccessed == null) {
setServicesLastAccessed(new com.amazonaws.internal.SdkInternalList<ServiceLastAccessed>(servicesLastAccessed.length));
}
for (ServiceLastAccessed ele : servicesLastAccessed) {
this.servicesLastAccessed.add(ele);
}
return this;
} }
|
public class class_name {
public GetServiceLastAccessedDetailsResult withServicesLastAccessed(ServiceLastAccessed... servicesLastAccessed) {
if (this.servicesLastAccessed == null) {
setServicesLastAccessed(new com.amazonaws.internal.SdkInternalList<ServiceLastAccessed>(servicesLastAccessed.length)); // depends on control dependency: [if], data = [none]
}
for (ServiceLastAccessed ele : servicesLastAccessed) {
this.servicesLastAccessed.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
public void removeRole(String username, String oldrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (roles_of_user.contains(oldrole)) {
// Update our user list
roles_of_user.remove(oldrole);
user_list.put(username, roles_of_user);
// Update our roles list
if (role_list.containsKey(oldrole))
users_with_role = role_list.get(oldrole);
users_with_role.remove(username);
if (users_with_role.size() < 1) {
role_list.remove(oldrole);
} else {
role_list.put(oldrole, users_with_role);
}
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles);
// And commit the file_store to disk
try {
saveRoles();
} catch (IOException e) {
throw new RolesException(e);
}
} else {
throw new RolesException("User '" + username + "' does not have the role '" + oldrole + "'!");
}
} else {
throw new RolesException("User '" + username + "' does not exist!");
}
} }
|
public class class_name {
@Override
public void removeRole(String username, String oldrole) throws RolesException {
List<String> users_with_role = new ArrayList<String>();
if (user_list.containsKey(username)) {
List<String> roles_of_user = user_list.get(username);
if (roles_of_user.contains(oldrole)) {
// Update our user list
roles_of_user.remove(oldrole); // depends on control dependency: [if], data = [none]
user_list.put(username, roles_of_user); // depends on control dependency: [if], data = [none]
// Update our roles list
if (role_list.containsKey(oldrole))
users_with_role = role_list.get(oldrole);
users_with_role.remove(username); // depends on control dependency: [if], data = [none]
if (users_with_role.size() < 1) {
role_list.remove(oldrole); // depends on control dependency: [if], data = [none]
} else {
role_list.put(oldrole, users_with_role); // depends on control dependency: [if], data = [none]
}
// Don't forget to update our file_store
String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
file_store.setProperty(username, roles); // depends on control dependency: [if], data = [none]
// And commit the file_store to disk
try {
saveRoles(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RolesException(e);
} // depends on control dependency: [catch], data = [none]
} else {
throw new RolesException("User '" + username + "' does not have the role '" + oldrole + "'!");
}
} else {
throw new RolesException("User '" + username + "' does not exist!");
}
} }
|
public class class_name {
private static void printPluginList(final IPluginRepository pr) {
System.out.println("List of installed plugins : ");
for (PluginDefinition pd : pr.getAllPlugins()) {
System.out.println(" * " + pd.getName());
}
System.exit(0);
} }
|
public class class_name {
private static void printPluginList(final IPluginRepository pr) {
System.out.println("List of installed plugins : ");
for (PluginDefinition pd : pr.getAllPlugins()) {
System.out.println(" * " + pd.getName()); // depends on control dependency: [for], data = [pd]
}
System.exit(0);
} }
|
public class class_name {
protected ArrayModifiableDBIDs initialMedoids(DistanceQuery<V> distQ, DBIDs ids) {
if(getLogger().isStatistics()) {
getLogger().statistics(new StringStatistic(getClass().getName() + ".initialization", initializer.toString()));
}
Duration initd = getLogger().newDuration(getClass().getName() + ".initialization-time").begin();
ArrayModifiableDBIDs medoids = DBIDUtil.newArray(initializer.chooseInitialMedoids(k, ids, distQ));
getLogger().statistics(initd.end());
if(medoids.size() != k) {
throw new AbortException("Initializer " + initializer.toString() + " did not return " + k + " means, but " + medoids.size());
}
return medoids;
} }
|
public class class_name {
protected ArrayModifiableDBIDs initialMedoids(DistanceQuery<V> distQ, DBIDs ids) {
if(getLogger().isStatistics()) {
getLogger().statistics(new StringStatistic(getClass().getName() + ".initialization", initializer.toString())); // depends on control dependency: [if], data = [none]
}
Duration initd = getLogger().newDuration(getClass().getName() + ".initialization-time").begin();
ArrayModifiableDBIDs medoids = DBIDUtil.newArray(initializer.chooseInitialMedoids(k, ids, distQ));
getLogger().statistics(initd.end());
if(medoids.size() != k) {
throw new AbortException("Initializer " + initializer.toString() + " did not return " + k + " means, but " + medoids.size());
}
return medoids;
} }
|
public class class_name {
List<Long> findWayNodesByWayID(long id) {
try {
this.pStmtWayNodesR.setLong(1, id);
ResultSet rs = this.pStmtWayNodesR.executeQuery();
Map<Integer, Long> nodeList = new TreeMap<>();
while (rs.next()) {
// way, node, position
Long nodeID = rs.getLong(1);
Integer pos = rs.getInt(2);
nodeList.put(pos, nodeID);
}
rs.close();
return new ArrayList<>(nodeList.values());
} catch (SQLException e) {
e.printStackTrace();
}
return null;
} }
|
public class class_name {
List<Long> findWayNodesByWayID(long id) {
try {
this.pStmtWayNodesR.setLong(1, id); // depends on control dependency: [try], data = [none]
ResultSet rs = this.pStmtWayNodesR.executeQuery();
Map<Integer, Long> nodeList = new TreeMap<>();
while (rs.next()) {
// way, node, position
Long nodeID = rs.getLong(1);
Integer pos = rs.getInt(2);
nodeList.put(pos, nodeID); // depends on control dependency: [while], data = [none]
}
rs.close(); // depends on control dependency: [try], data = [none]
return new ArrayList<>(nodeList.values()); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public File createDirectory(String directoryName) {
Path path = Paths.get(rootFolder.getPath(), directoryName);
try {
return Files.createDirectory(path).toFile();
} catch (IOException ex) {
throw new TemporaryFolderException(
String.format("Failed to create directory: '%s'", path.toString()), ex);
}
} }
|
public class class_name {
public File createDirectory(String directoryName) {
Path path = Paths.get(rootFolder.getPath(), directoryName);
try {
return Files.createDirectory(path).toFile(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new TemporaryFolderException(
String.format("Failed to create directory: '%s'", path.toString()), ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String convertMethodSignature(String className, String methodName, String methodSig, String pkgName) {
StringBuilder args = new StringBuilder();
SignatureConverter converter = new SignatureConverter(methodSig);
converter.skip();
args.append('(');
while (converter.getFirst() != ')') {
if (args.length() > 1) {
args.append(", ");
}
args.append(shorten(pkgName, converter.parseNext()));
}
converter.skip();
args.append(')');
// Ignore return type
StringBuilder result = new StringBuilder();
result.append(className);
result.append('.');
result.append(methodName);
result.append(args.toString());
return result.toString();
} }
|
public class class_name {
public static String convertMethodSignature(String className, String methodName, String methodSig, String pkgName) {
StringBuilder args = new StringBuilder();
SignatureConverter converter = new SignatureConverter(methodSig);
converter.skip();
args.append('(');
while (converter.getFirst() != ')') {
if (args.length() > 1) {
args.append(", "); // depends on control dependency: [if], data = [none]
}
args.append(shorten(pkgName, converter.parseNext())); // depends on control dependency: [while], data = [none]
}
converter.skip();
args.append(')');
// Ignore return type
StringBuilder result = new StringBuilder();
result.append(className);
result.append('.');
result.append(methodName);
result.append(args.toString());
return result.toString();
} }
|
public class class_name {
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
} }
|
public class class_name {
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); // depends on control dependency: [for], data = [attrib]
}
} }
|
public class class_name {
public KeePassFile openDatabase(String password) {
if (password == null) {
throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY);
}
try {
byte[] passwordBytes = password.getBytes(UTF_8);
byte[] hashedPassword = Sha256.hash(passwordBytes);
return new KeePassDatabaseReader(keepassHeader).decryptAndParseDatabase(hashedPassword, keepassFile);
} catch (UnsupportedEncodingException e) {
throw new UnsupportedOperationException(MSG_UTF8_NOT_SUPPORTED, e);
}
} }
|
public class class_name {
public KeePassFile openDatabase(String password) {
if (password == null) {
throw new IllegalArgumentException(MSG_EMPTY_MASTER_KEY);
}
try {
byte[] passwordBytes = password.getBytes(UTF_8);
byte[] hashedPassword = Sha256.hash(passwordBytes);
return new KeePassDatabaseReader(keepassHeader).decryptAndParseDatabase(hashedPassword, keepassFile);
// depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new UnsupportedOperationException(MSG_UTF8_NOT_SUPPORTED, e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) {
boolean altColor = true;
for (ModuleElement mdle : modules) {
if (!mdle.isUnnamed()) {
Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast);
addSummaryComment(mdle, tdSummary);
HtmlTree tr = HtmlTree.TR(thModule);
tr.addContent(tdSummary);
tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
tbody.addContent(tr);
}
altColor = !altColor;
}
} }
|
public class class_name {
protected void addModulesList(Collection<ModuleElement> modules, Content tbody) {
boolean altColor = true;
for (ModuleElement mdle : modules) {
if (!mdle.isUnnamed()) {
Content moduleLinkContent = getModuleLink(mdle, new StringContent(mdle.getQualifiedName().toString()));
Content thModule = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, moduleLinkContent);
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
tdSummary.addStyle(HtmlStyle.colLast); // depends on control dependency: [if], data = [none]
addSummaryComment(mdle, tdSummary); // depends on control dependency: [if], data = [none]
HtmlTree tr = HtmlTree.TR(thModule);
tr.addContent(tdSummary); // depends on control dependency: [if], data = [none]
tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor); // depends on control dependency: [if], data = [none]
tbody.addContent(tr); // depends on control dependency: [if], data = [none]
}
altColor = !altColor; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
static public ByteBuffer
encodeArray(DapType vtype, Object values, ByteOrder order)
throws IOException
{
TypeSort atomtype = vtype.getAtomicType();
assert values != null && values.getClass().isArray();
int count = Array.getLength(values);
int total = (int) TypeSort.getSize(atomtype) * count;
ByteBuffer buf = ByteBuffer.allocate(total).order(order);
switch (atomtype) {
case Char:
char[] datac = (char[]) values;
for(int i = 0; i < datac.length; i++) {
byte b = (byte) (0xFFL & (long) (datac[i]));
buf.put(b);
}
break;
case UInt8:
case Int8:
byte[] data8 = (byte[]) values;
buf.put(data8);
break;
case Int16:
case UInt16:
short[] data16 = (short[]) values;
buf.asShortBuffer().put(data16);
buf.position(total); // because we are using asXXXBuffer
break;
case Int32:
case UInt32:
int[] data32 = (int[]) values;
buf.asIntBuffer().put(data32);
buf.position(total); // because we are using asXXXBuffer
break;
case Int64:
case UInt64:
long[] data64 = (long[]) values;
buf.asLongBuffer().put(data64);
buf.position(total); // because we are using asXXXBuffer
break;
case Float32:
float[] dataf = (float[]) values;
buf.asFloatBuffer().put(dataf);
buf.position(total); // because we are using asXXXBuffer
break;
case Float64:
double[] datad = (double[]) values;
buf.asDoubleBuffer().put(datad);
buf.position(total); // because we are using asXXXBuffer
break;
case URL:
case String:
// Convert the string to a counted UTF-8 bytestring
String[] datas = (String[]) values;
// Pass 1: get total size
total = 0;
for(int i = 0; i < datas.length; i++) {
String content = datas[i];
byte[] bytes = content.getBytes(DapUtil.UTF8);
total += (bytes.length + COUNTSIZE);
}
buf = ByteBuffer.allocate(total).order(order);
// Pass 2: write the strings
for(int i = 0; i < datas.length; i++) {
String content = datas[i];
byte[] bytes = content.getBytes(DapUtil.UTF8);
buf.putLong(bytes.length);
buf.put(bytes);
}
break;
case Opaque:
// Unfortunately, Array.get1d does not produce
// a ByteBuffer[].
Object[] datao = (Object[]) values;
// Pass 1: get total size
total = 0;
int size = 0;
for(int i = 0; i < datao.length; i++) {
ByteBuffer opaquedata = (ByteBuffer) datao[i];
// the data may be at an offset in the buffer
size = opaquedata.remaining(); // should be limit - pos
total += (size + COUNTSIZE);
}
buf = ByteBuffer.allocate(total).order(order);
// Pass 2: write the opaque elements
for(int i = 0; i < datao.length; i++) {
ByteBuffer opaquedata = (ByteBuffer) datao[i];
size = opaquedata.remaining(); // should be limit - pos
buf.putLong(size);
int savepos = opaquedata.position();
buf.put(opaquedata);
opaquedata.position(savepos);
}
break;
case Enum: // handled by getPrimitiveType() above
assert false : "Unexpected ENUM type";
default:
throw new DapException("Unknown type: " + vtype.getTypeName());
}
return buf;
} }
|
public class class_name {
static public ByteBuffer
encodeArray(DapType vtype, Object values, ByteOrder order)
throws IOException
{
TypeSort atomtype = vtype.getAtomicType();
assert values != null && values.getClass().isArray();
int count = Array.getLength(values);
int total = (int) TypeSort.getSize(atomtype) * count;
ByteBuffer buf = ByteBuffer.allocate(total).order(order);
switch (atomtype) {
case Char:
char[] datac = (char[]) values;
for(int i = 0; i < datac.length; i++) {
byte b = (byte) (0xFFL & (long) (datac[i]));
buf.put(b); // depends on control dependency: [for], data = [none]
}
break;
case UInt8:
case Int8:
byte[] data8 = (byte[]) values;
buf.put(data8);
break;
case Int16:
case UInt16:
short[] data16 = (short[]) values;
buf.asShortBuffer().put(data16);
buf.position(total); // because we are using asXXXBuffer
break;
case Int32:
case UInt32:
int[] data32 = (int[]) values;
buf.asIntBuffer().put(data32);
buf.position(total); // because we are using asXXXBuffer
break;
case Int64:
case UInt64:
long[] data64 = (long[]) values;
buf.asLongBuffer().put(data64);
buf.position(total); // because we are using asXXXBuffer
break;
case Float32:
float[] dataf = (float[]) values;
buf.asFloatBuffer().put(dataf);
buf.position(total); // because we are using asXXXBuffer
break;
case Float64:
double[] datad = (double[]) values;
buf.asDoubleBuffer().put(datad);
buf.position(total); // because we are using asXXXBuffer
break;
case URL:
case String:
// Convert the string to a counted UTF-8 bytestring
String[] datas = (String[]) values;
// Pass 1: get total size
total = 0;
for(int i = 0; i < datas.length; i++) {
String content = datas[i];
byte[] bytes = content.getBytes(DapUtil.UTF8);
total += (bytes.length + COUNTSIZE); // depends on control dependency: [for], data = [none]
}
buf = ByteBuffer.allocate(total).order(order);
// Pass 2: write the strings
for(int i = 0; i < datas.length; i++) {
String content = datas[i];
byte[] bytes = content.getBytes(DapUtil.UTF8);
buf.putLong(bytes.length); // depends on control dependency: [for], data = [none]
buf.put(bytes); // depends on control dependency: [for], data = [none]
}
break;
case Opaque:
// Unfortunately, Array.get1d does not produce
// a ByteBuffer[].
Object[] datao = (Object[]) values;
// Pass 1: get total size
total = 0;
int size = 0;
for(int i = 0; i < datao.length; i++) {
ByteBuffer opaquedata = (ByteBuffer) datao[i];
// the data may be at an offset in the buffer
size = opaquedata.remaining(); // should be limit - pos // depends on control dependency: [for], data = [none]
total += (size + COUNTSIZE); // depends on control dependency: [for], data = [none]
}
buf = ByteBuffer.allocate(total).order(order);
// Pass 2: write the opaque elements
for(int i = 0; i < datao.length; i++) {
ByteBuffer opaquedata = (ByteBuffer) datao[i];
size = opaquedata.remaining(); // should be limit - pos // depends on control dependency: [for], data = [none]
buf.putLong(size); // depends on control dependency: [for], data = [none]
int savepos = opaquedata.position();
buf.put(opaquedata); // depends on control dependency: [for], data = [none]
opaquedata.position(savepos); // depends on control dependency: [for], data = [none]
}
break;
case Enum: // handled by getPrimitiveType() above
assert false : "Unexpected ENUM type";
default:
throw new DapException("Unknown type: " + vtype.getTypeName());
}
return buf;
} }
|
public class class_name {
public String elementCachingHash() {
String result = "";
if (m_element != null) {
result = m_element.editorHash();
if (m_container != null) {
result += "w:"
+ m_container.getWidth()
+ "cName:"
+ m_container.getName()
+ "cType:"
+ m_container.getType();
}
}
return result;
} }
|
public class class_name {
public String elementCachingHash() {
String result = "";
if (m_element != null) {
result = m_element.editorHash(); // depends on control dependency: [if], data = [none]
if (m_container != null) {
result += "w:"
+ m_container.getWidth()
+ "cName:"
+ m_container.getName()
+ "cType:"
+ m_container.getType(); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public void associateEnvironmentToJndi(JNDIResourceModel resource, EnvironmentReferenceModel ref)
{
LOG.info("Associating JNDI: " + resource + " to Environmental Ref: " + ref.getName() + ", " + ref.getReferenceId() + ", "
+ ref.getReferenceType());
// hook up the JNDI resource to the environment reference
if (ref.getJndiReference() == null)
{
ref.setJndiReference(resource);
}
jndiResourceService.associateTypeJndiResource(resource, ref.getReferenceType());
} }
|
public class class_name {
public void associateEnvironmentToJndi(JNDIResourceModel resource, EnvironmentReferenceModel ref)
{
LOG.info("Associating JNDI: " + resource + " to Environmental Ref: " + ref.getName() + ", " + ref.getReferenceId() + ", "
+ ref.getReferenceType());
// hook up the JNDI resource to the environment reference
if (ref.getJndiReference() == null)
{
ref.setJndiReference(resource); // depends on control dependency: [if], data = [none]
}
jndiResourceService.associateTypeJndiResource(resource, ref.getReferenceType());
} }
|
public class class_name {
private void setAdditionalInformation(AdditionalInformation additionalInformation) {
Boolean hasInvestigator = false;
additionalInformation.addNewFellowshipTrainingAndCareerGoals();
additionalInformation.addNewActivitiesPlannedUnderThisAward();
ProposalPersonContract principalInvestigator = s2SProposalPersonService.getPrincipalInvestigator(pdDoc);
for (ProposalPersonContract proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) {
if (proposalPerson.isPrincipalInvestigator()) {
hasInvestigator = true;
CitizenshipType citizenShip = s2SProposalPersonService.getCitizenship(proposalPerson);
if(citizenShip!=null && StringUtils.isNotBlank(citizenShip.getCitizenShip())){
if (citizenShip.getCitizenShip().trim().equals(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA);
}
else if (citizenShip.getCitizenShip().trim().equals(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S);
}
else if (citizenShip.getCitizenShip().trim().equals(
CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL);
}
else if (citizenShip.getCitizenShip().trim().equals(
CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING);
}
}
else{
additionalInformation.setCitizenship(null);
}
}
}
if (principalInvestigator != null && principalInvestigator.getMobilePhoneNumber() != null) {
additionalInformation.setAlernatePhoneNumber(principalInvestigator.getMobilePhoneNumber());
}
if(!hasInvestigator){
additionalInformation.setCitizenship(null);
}
additionalInformation.setConcurrentSupport(YesNoDataType.N_NO);
AttachedFileDataType attachedFileDataType = null;
for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) {
if (narrative.getNarrativeType().getCode() != null) {
switch (Integer.parseInt(narrative.getNarrativeType().getCode())) {
case CONCURRENT_SUPPORT:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
ConcurrentSupportDescription concurrentSupportDescription = ConcurrentSupportDescription.Factory
.newInstance();
concurrentSupportDescription.setAttFile(attachedFileDataType);
additionalInformation.setConcurrentSupport(YesNoDataType.Y_YES);
additionalInformation.setConcurrentSupportDescription(concurrentSupportDescription);
break;
case FELLOWSHIP:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
FellowshipTrainingAndCareerGoals fellowshipTrainingAndCareerGoals = FellowshipTrainingAndCareerGoals.Factory
.newInstance();
fellowshipTrainingAndCareerGoals.setAttFile(attachedFileDataType);
additionalInformation.setFellowshipTrainingAndCareerGoals(fellowshipTrainingAndCareerGoals);
break;
case DISSERTATION:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
DissertationAndResearchExperience dissertationAndResearchExperience = DissertationAndResearchExperience.Factory
.newInstance();
dissertationAndResearchExperience.setAttFile(attachedFileDataType);
additionalInformation.setDissertationAndResearchExperience(dissertationAndResearchExperience);
break;
case ACTIVITIES:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
ActivitiesPlannedUnderThisAward activitiesPlannedUnderThisAward = ActivitiesPlannedUnderThisAward.Factory
.newInstance();
activitiesPlannedUnderThisAward.setAttFile(attachedFileDataType);
additionalInformation.setActivitiesPlannedUnderThisAward(activitiesPlannedUnderThisAward);
break;
default:
break;
}
}
}
} }
|
public class class_name {
private void setAdditionalInformation(AdditionalInformation additionalInformation) {
Boolean hasInvestigator = false;
additionalInformation.addNewFellowshipTrainingAndCareerGoals();
additionalInformation.addNewActivitiesPlannedUnderThisAward();
ProposalPersonContract principalInvestigator = s2SProposalPersonService.getPrincipalInvestigator(pdDoc);
for (ProposalPersonContract proposalPerson : pdDoc.getDevelopmentProposal().getProposalPersons()) {
if (proposalPerson.isPrincipalInvestigator()) {
hasInvestigator = true; // depends on control dependency: [if], data = [none]
CitizenshipType citizenShip = s2SProposalPersonService.getCitizenship(proposalPerson);
if(citizenShip!=null && StringUtils.isNotBlank(citizenShip.getCitizenShip())){
if (citizenShip.getCitizenShip().trim().equals(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.NON_U_S_CITIZEN_WITH_TEMPORARY_VISA); // depends on control dependency: [if], data = [none]
}
else if (citizenShip.getCitizenShip().trim().equals(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S); // depends on control dependency: [if], data = [none]
}
else if (citizenShip.getCitizenShip().trim().equals(
CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.U_S_CITIZEN_OR_NONCITIZEN_NATIONAL); // depends on control dependency: [if], data = [none]
}
else if (citizenShip.getCitizenShip().trim().equals(
CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING.toString())) {
additionalInformation.setCitizenship(CitizenshipDataType.PERMANENT_RESIDENT_OF_U_S_PENDING); // depends on control dependency: [if], data = [none]
}
}
else{
additionalInformation.setCitizenship(null); // depends on control dependency: [if], data = [none]
}
}
}
if (principalInvestigator != null && principalInvestigator.getMobilePhoneNumber() != null) {
additionalInformation.setAlernatePhoneNumber(principalInvestigator.getMobilePhoneNumber()); // depends on control dependency: [if], data = [(principalInvestigator]
}
if(!hasInvestigator){
additionalInformation.setCitizenship(null); // depends on control dependency: [if], data = [none]
}
additionalInformation.setConcurrentSupport(YesNoDataType.N_NO);
AttachedFileDataType attachedFileDataType = null;
for (NarrativeContract narrative : pdDoc.getDevelopmentProposal().getNarratives()) {
if (narrative.getNarrativeType().getCode() != null) {
switch (Integer.parseInt(narrative.getNarrativeType().getCode())) {
case CONCURRENT_SUPPORT:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
ConcurrentSupportDescription concurrentSupportDescription = ConcurrentSupportDescription.Factory
.newInstance();
concurrentSupportDescription.setAttFile(attachedFileDataType);
additionalInformation.setConcurrentSupport(YesNoDataType.Y_YES);
additionalInformation.setConcurrentSupportDescription(concurrentSupportDescription);
break;
case FELLOWSHIP:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
FellowshipTrainingAndCareerGoals fellowshipTrainingAndCareerGoals = FellowshipTrainingAndCareerGoals.Factory
.newInstance();
fellowshipTrainingAndCareerGoals.setAttFile(attachedFileDataType);
additionalInformation.setFellowshipTrainingAndCareerGoals(fellowshipTrainingAndCareerGoals);
break;
case DISSERTATION:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
DissertationAndResearchExperience dissertationAndResearchExperience = DissertationAndResearchExperience.Factory
.newInstance();
dissertationAndResearchExperience.setAttFile(attachedFileDataType);
additionalInformation.setDissertationAndResearchExperience(dissertationAndResearchExperience);
break;
case ACTIVITIES:
attachedFileDataType = getAttachedFileType(narrative);
if (attachedFileDataType == null) {
continue;
}
ActivitiesPlannedUnderThisAward activitiesPlannedUnderThisAward = ActivitiesPlannedUnderThisAward.Factory
.newInstance();
activitiesPlannedUnderThisAward.setAttFile(attachedFileDataType);
additionalInformation.setActivitiesPlannedUnderThisAward(activitiesPlannedUnderThisAward);
break;
default:
break;
}
}
}
} }
|
public class class_name {
public static boolean isValidAccessorName(String accessorName) {
if (accessorName.startsWith("get") || accessorName.startsWith("is") || accessorName.startsWith("set")) {
int prefixLength = accessorName.startsWith("is") ? 2 : 3;
return accessorName.length() > prefixLength;
};
return false;
} }
|
public class class_name {
public static boolean isValidAccessorName(String accessorName) {
if (accessorName.startsWith("get") || accessorName.startsWith("is") || accessorName.startsWith("set")) {
int prefixLength = accessorName.startsWith("is") ? 2 : 3;
return accessorName.length() > prefixLength; // depends on control dependency: [if], data = [none]
};
return false;
} }
|
public class class_name {
void outputComplementDirect(StringBuffer buf) {
if (!surrogatesDirect && getContainsBmp() == NONE)
buf.append("[\u0000-\uFFFF]");
else {
buf.append("[^");
inClassOutputDirect(buf);
buf.append(']');
}
} }
|
public class class_name {
void outputComplementDirect(StringBuffer buf) {
if (!surrogatesDirect && getContainsBmp() == NONE)
buf.append("[\u0000-\uFFFF]");
else {
buf.append("[^"); // depends on control dependency: [if], data = [none]
inClassOutputDirect(buf); // depends on control dependency: [if], data = [none]
buf.append(']'); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private Element getMavenPluginElement() {
try {
final Element pluginsRoot = document.getRootElement().element("build").element("plugins");
for (final Element element : pluginsRoot.elements()) {
final String groupId = XMLUtils.getChildValue("groupId", element);
final String artifactId = XMLUtils.getChildValue("artifactId", element);
if (PLUGIN_GROUPID.equals(groupId) && PLUGIN_ARTIFACTID.equals(artifactId)) {
return element;
}
}
} catch (NullPointerException e) {
return null;
}
return null;
} }
|
public class class_name {
private Element getMavenPluginElement() {
try {
final Element pluginsRoot = document.getRootElement().element("build").element("plugins");
for (final Element element : pluginsRoot.elements()) {
final String groupId = XMLUtils.getChildValue("groupId", element);
final String artifactId = XMLUtils.getChildValue("artifactId", element);
if (PLUGIN_GROUPID.equals(groupId) && PLUGIN_ARTIFACTID.equals(artifactId)) {
return element; // depends on control dependency: [if], data = [none]
}
}
} catch (NullPointerException e) {
return null;
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public void setDriver(Driver driver) {
this.driver = driver;
try {
DriverManager.registerDriver(driver);
} catch (SQLException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
}
} }
|
public class class_name {
public void setDriver(Driver driver) {
this.driver = driver;
try {
DriverManager.registerDriver(driver); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GenException(Message.DOMAGEN9001, e, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int getStatusCode() {
int code;
/* TODO: eine Exception als Fehler einzustufen ist gefaehrlich: wenn
* ein GV bei einer Bank eingereicht wird und von der Bank erfolgreich
* verarbeitet wird, beim Entgegennehmen der Antwort-Nachricht jedoch
* eine Exception auftritt, sieht der Job aus wie "fehlgeschlagen" -
* dabei ist nur das Parsen der Erfolgsnachricht fehlgeschlagen */
if (hasExceptions() || hasErrors()) {
code = STATUS_ERR;
} else if (hasSuccess() || hasWarnings()) {
code = STATUS_OK;
} else {
code = STATUS_UNKNOWN;
}
return code;
} }
|
public class class_name {
public int getStatusCode() {
int code;
/* TODO: eine Exception als Fehler einzustufen ist gefaehrlich: wenn
* ein GV bei einer Bank eingereicht wird und von der Bank erfolgreich
* verarbeitet wird, beim Entgegennehmen der Antwort-Nachricht jedoch
* eine Exception auftritt, sieht der Job aus wie "fehlgeschlagen" -
* dabei ist nur das Parsen der Erfolgsnachricht fehlgeschlagen */
if (hasExceptions() || hasErrors()) {
code = STATUS_ERR; // depends on control dependency: [if], data = [none]
} else if (hasSuccess() || hasWarnings()) {
code = STATUS_OK; // depends on control dependency: [if], data = [none]
} else {
code = STATUS_UNKNOWN; // depends on control dependency: [if], data = [none]
}
return code;
} }
|
public class class_name {
@GET
@Path(WEBUI_CONFIG)
@ReturnType("alluxio.wire.MasterWebUIConfiguration")
public Response getWebUIConfiguration() {
return RestUtils.call(() -> {
MasterWebUIConfiguration response = new MasterWebUIConfiguration();
response.setWhitelist(mFileSystemMaster.getWhiteList());
TreeSet<Triple<String, String, String>> sortedProperties = new TreeSet<>();
Set<String> alluxioConfExcludes = Sets.newHashSet(PropertyKey.MASTER_WHITELIST.toString());
for (ConfigProperty configProperty : mMetaMaster
.getConfiguration(GetConfigurationPOptions.newBuilder().setRawValue(true).build())) {
String confName = configProperty.getName();
if (!alluxioConfExcludes.contains(confName)) {
sortedProperties.add(new ImmutableTriple<>(confName,
ConfigurationUtils.valueAsString(configProperty.getValue()),
configProperty.getSource()));
}
}
response.setConfiguration(sortedProperties);
return response;
}, ServerConfiguration.global());
} }
|
public class class_name {
@GET
@Path(WEBUI_CONFIG)
@ReturnType("alluxio.wire.MasterWebUIConfiguration")
public Response getWebUIConfiguration() {
return RestUtils.call(() -> {
MasterWebUIConfiguration response = new MasterWebUIConfiguration();
response.setWhitelist(mFileSystemMaster.getWhiteList());
TreeSet<Triple<String, String, String>> sortedProperties = new TreeSet<>();
Set<String> alluxioConfExcludes = Sets.newHashSet(PropertyKey.MASTER_WHITELIST.toString());
for (ConfigProperty configProperty : mMetaMaster
.getConfiguration(GetConfigurationPOptions.newBuilder().setRawValue(true).build())) {
String confName = configProperty.getName();
if (!alluxioConfExcludes.contains(confName)) {
sortedProperties.add(new ImmutableTriple<>(confName,
ConfigurationUtils.valueAsString(configProperty.getValue()),
configProperty.getSource())); // depends on control dependency: [if], data = [none]
}
}
response.setConfiguration(sortedProperties);
return response;
}, ServerConfiguration.global());
} }
|
public class class_name {
protected boolean accept(String path) {
// GWT Development Mode files
if (path.equals("hosted.html") || path.endsWith(".devmode.js")) {
return false;
}
// Default or welcome file
if (path.equals("/")) {
return true;
}
// Whitelisted file extension
int pos = path.lastIndexOf('.');
if (pos != -1) {
String extension = path.substring(pos + 1);
if (DEFAULT_EXTENSION_WHITELIST.contains(extension)) {
return true;
}
}
// Not included by default
return false;
} }
|
public class class_name {
protected boolean accept(String path) {
// GWT Development Mode files
if (path.equals("hosted.html") || path.endsWith(".devmode.js")) {
return false; // depends on control dependency: [if], data = [none]
}
// Default or welcome file
if (path.equals("/")) {
return true; // depends on control dependency: [if], data = [none]
}
// Whitelisted file extension
int pos = path.lastIndexOf('.');
if (pos != -1) {
String extension = path.substring(pos + 1);
if (DEFAULT_EXTENSION_WHITELIST.contains(extension)) {
return true; // depends on control dependency: [if], data = [none]
}
}
// Not included by default
return false;
} }
|
public class class_name {
protected void expect(Token.TokenType type, String trigger) {
if (tokenizer.current().matches(type, trigger)) {
tokenizer.consume();
} else {
errors.add(ParseError.error(tokenizer.current(),
String.format("Unexpected token '%s'. Expected: '%s'",
tokenizer.current().getSource(),
trigger)));
}
} }
|
public class class_name {
protected void expect(Token.TokenType type, String trigger) {
if (tokenizer.current().matches(type, trigger)) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
} else {
errors.add(ParseError.error(tokenizer.current(),
String.format("Unexpected token '%s'. Expected: '%s'",
tokenizer.current().getSource(),
trigger))); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static List<Pair> toPairs(List<Double> xyValues, double missingValue) {
List<Pair> result = new ArrayList<Pair>((xyValues.size() + 1) / 2);
Iterator<Double> it = xyValues.iterator();
while (it.hasNext()) {
result.add(new Pair(it.next(), it.hasNext() ? it.next() : missingValue));
}
return result;
} }
|
public class class_name {
public static List<Pair> toPairs(List<Double> xyValues, double missingValue) {
List<Pair> result = new ArrayList<Pair>((xyValues.size() + 1) / 2);
Iterator<Double> it = xyValues.iterator();
while (it.hasNext()) {
result.add(new Pair(it.next(), it.hasNext() ? it.next() : missingValue)); // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public ServerTransaction getAssociatedServerTransaction(ClientTransaction ct) {
if(ct == null) {
throw new NullPointerException("Passed Client Transaction is null!");
}
final ClientTransactionWrapper ctw = (ClientTransactionWrapper) ct;
final String associatedServerTransactionId = ctw.getAssociatedServerTransactionId();
if (associatedServerTransactionId != null) {
SIPServerTransaction st = (SIPServerTransaction) ra.getProviderWrapper().getSipStackImpl().findTransaction(associatedServerTransactionId, true);
return (ServerTransaction) ra.getTransactionWrapper(st);
}
else {
return null;
}
} }
|
public class class_name {
public ServerTransaction getAssociatedServerTransaction(ClientTransaction ct) {
if(ct == null) {
throw new NullPointerException("Passed Client Transaction is null!");
}
final ClientTransactionWrapper ctw = (ClientTransactionWrapper) ct;
final String associatedServerTransactionId = ctw.getAssociatedServerTransactionId();
if (associatedServerTransactionId != null) {
SIPServerTransaction st = (SIPServerTransaction) ra.getProviderWrapper().getSipStackImpl().findTransaction(associatedServerTransactionId, true);
return (ServerTransaction) ra.getTransactionWrapper(st); // depends on control dependency: [if], data = [none]
}
else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String displayable(String query) {
if (query == null ||
query.length() == 0) {
return query;
}
StringBuilder buff = new StringBuilder(query);
// handle two character transforms first
subst(buff, SQL_NE, NOT_EQUAL__);
subst(buff, NE_BANG, BANG_NOT_EQUAL__);
subst(buff, NE_HAT, HAT_NOT_EQUAL__);
subst(buff, LE, LESS_THAN_EQUAL__);
subst(buff, GE, GREATER_THAN_EQUAL__);
subst(buff, CONCAT, CONCAT__);
subst(buff, LT, LESS_THAN__);
subst(buff, EQ, EQUAL__);
subst(buff, GT, GREATER__);
subst(buff, OPEN, LEFT_PAREN__);
subst(buff, CLOSE, RIGHT_PAREN__);
subst(buff, OPEN_BRACKET, LEFT_BRACKET__);
subst(buff, CLOSE_BRACKET, RIGHT_BRACKET__);
subst(buff, PLUS, PLUS__);
subst(buff, MINUS, MINUS__);
subst(buff, STAR, STAR__);
subst(buff, DIV, DIVIDE__);
subst(buff, MOD, MODULUS__);
subst(buff, COLON, COLON__);
subst(buff, PARAM, PARAM__);
subst(buff, COMMA, COMMA__);
subst(buff, SPACE, SPACE__);
subst(buff, TAB, TAB__);
subst(buff, NEWLINE, NEWLINE__);
subst(buff, LINEFEED, LINEFEED__);
subst(buff, QUOTE, QUOTE__);
subst(buff, DQUOTE, DQUOTE__);
subst(buff, TICK, TICK__);
subst(buff, OPEN_BRACE, OPEN_BRACE__);
subst(buff, CLOSE_BRACE, CLOSE_BRACE__);
subst(buff, HAT, HAT__);
subst(buff, AMPERSAND, AMPERSAND__);
return buff.toString();
} }
|
public class class_name {
private String displayable(String query) {
if (query == null ||
query.length() == 0) {
return query; // depends on control dependency: [if], data = [none]
}
StringBuilder buff = new StringBuilder(query);
// handle two character transforms first
subst(buff, SQL_NE, NOT_EQUAL__);
subst(buff, NE_BANG, BANG_NOT_EQUAL__);
subst(buff, NE_HAT, HAT_NOT_EQUAL__);
subst(buff, LE, LESS_THAN_EQUAL__);
subst(buff, GE, GREATER_THAN_EQUAL__);
subst(buff, CONCAT, CONCAT__);
subst(buff, LT, LESS_THAN__);
subst(buff, EQ, EQUAL__);
subst(buff, GT, GREATER__);
subst(buff, OPEN, LEFT_PAREN__);
subst(buff, CLOSE, RIGHT_PAREN__);
subst(buff, OPEN_BRACKET, LEFT_BRACKET__);
subst(buff, CLOSE_BRACKET, RIGHT_BRACKET__);
subst(buff, PLUS, PLUS__);
subst(buff, MINUS, MINUS__);
subst(buff, STAR, STAR__);
subst(buff, DIV, DIVIDE__);
subst(buff, MOD, MODULUS__);
subst(buff, COLON, COLON__);
subst(buff, PARAM, PARAM__);
subst(buff, COMMA, COMMA__);
subst(buff, SPACE, SPACE__);
subst(buff, TAB, TAB__);
subst(buff, NEWLINE, NEWLINE__);
subst(buff, LINEFEED, LINEFEED__);
subst(buff, QUOTE, QUOTE__);
subst(buff, DQUOTE, DQUOTE__);
subst(buff, TICK, TICK__);
subst(buff, OPEN_BRACE, OPEN_BRACE__);
subst(buff, CLOSE_BRACE, CLOSE_BRACE__);
subst(buff, HAT, HAT__);
subst(buff, AMPERSAND, AMPERSAND__);
return buff.toString();
} }
|
public class class_name {
public void doFinally() {
if (conn != null) {
try {
if ((isolation != Connection.TRANSACTION_NONE)
&& (isolation != origIsolation)) {
conn.setTransactionIsolation(origIsolation);
}
conn.setAutoCommit(true);
conn.close();
} catch (SQLException e) {
// Not much we can do
}
}
conn = null;
isolation = Connection.TRANSACTION_NONE;
} }
|
public class class_name {
public void doFinally() {
if (conn != null) {
try {
if ((isolation != Connection.TRANSACTION_NONE)
&& (isolation != origIsolation)) {
conn.setTransactionIsolation(origIsolation); // depends on control dependency: [if], data = [none]
}
conn.setAutoCommit(true); // depends on control dependency: [try], data = [none]
conn.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
// Not much we can do
} // depends on control dependency: [catch], data = [none]
}
conn = null;
isolation = Connection.TRANSACTION_NONE;
} }
|
public class class_name {
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
public static void validatePublicNoArg(Method method, List<Throwable> errors)
{
if (!Modifier.isPublic(method.getModifiers()))
{
errors.add(new Exception("Method " + method.getName() + "() should be public"));
}
if (method.getParameterTypes().length != 0)
{
errors.add(new Exception("Method " + method.getName() + " should have no parameters"));
}
} }
|
public class class_name {
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
public static void validatePublicNoArg(Method method, List<Throwable> errors)
{
if (!Modifier.isPublic(method.getModifiers()))
{
errors.add(new Exception("Method " + method.getName() + "() should be public"));
}
if (method.getParameterTypes().length != 0)
{
errors.add(new Exception("Method " + method.getName() + " should have no parameters")); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static RestRepositoryConnectionProxy getProxyInfo(Properties repoProperties) throws InstallException {
RestRepositoryConnectionProxy proxyInfo = null;
URL proxyURL = null;
if (repoProperties != null) {
//Retrieve proxy settings properties
String proxyHost = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_HOST);
String proxyPort = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_PORT);
String proxyUser = getProxyUser(repoProperties);
String proxyPwd = getProxyPwd(repoProperties);
try {
//Construct proxy URL object from proxy host and port
if ((proxyHost != null && !proxyHost.isEmpty()) && (proxyPort != null && !proxyPort.isEmpty())) {
//Trim any trailing whitespaces
proxyHost = proxyHost.trim();
proxyPort = proxyPort.trim();
logger.log(Level.FINEST, "proxyHost: " + proxyHost);
logger.log(Level.FINEST, "proxyPort: " + proxyPort);
logger.log(Level.FINEST, "proxyUser: " + proxyUser);
logger.log(Level.FINEST, "proxyPassword: ********");
if (proxyHost.toLowerCase().startsWith("http://"))
proxyURL = new URL(proxyHost + ":" + proxyPort);
else
proxyURL = new URL("http://" + proxyHost + ":" + proxyPort);
//Check proxy port number in range
if (proxyURL.getPort() < 0 || proxyURL.getPort() > 0xFFFF)
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", String.valueOf(proxyURL.getPort())));
} else {
if ((proxyHost == null || proxyHost.isEmpty()) && proxyPort != null) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_HOST_MISSING"), InstallException.MISSING_CONTENT);
} else if (proxyHost != null && (proxyPort == null || proxyPort.isEmpty())) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PORT_MISSING"), InstallException.MISSING_CONTENT);
}
}
} catch (MalformedURLException e) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", proxyPort), e, InstallException.RUNTIME_EXCEPTION);
}
if (proxyURL != null) {
if ((proxyUser != null && !proxyUser.isEmpty()) && (proxyPwd != null && !proxyPwd.isEmpty())) {
//Trim any trailing whitespaces
proxyUser = proxyUser.trim();
proxyPwd = proxyPwd.trim();
String decodedPwd = proxyPwd;
try {
//Decode encrypted proxy server password
decodedPwd = PasswordUtil.decode(proxyPwd);
//Check proxy server credentials for Authentication
setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd);
} catch (InvalidPasswordDecodingException ipde) {
decodedPwd = proxyPwd;
logger.log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_PASSWORD_NOT_ENCODED_PROXY", proxyURL) + InstallUtils.NEWLINE);
setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd);
} catch (UnsupportedCryptoAlgorithmException ucae) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PWD_CRYPTO_UNSUPPORTED"), ucae, InstallException.RUNTIME_EXCEPTION);
}
}
try {
proxyInfo = new RestRepositoryConnectionProxy(proxyURL);
} catch (RepositoryException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
if (sw.toString().contains("com.ibm.websphere.ssl.protocol.SSLSocketFactory"))
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT_JDK_WRONG"), e, InstallException.RUNTIME_EXCEPTION);
else
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT"), e, InstallException.RUNTIME_EXCEPTION);
}
}
}
return proxyInfo;
} }
|
public class class_name {
public static RestRepositoryConnectionProxy getProxyInfo(Properties repoProperties) throws InstallException {
RestRepositoryConnectionProxy proxyInfo = null;
URL proxyURL = null;
if (repoProperties != null) {
//Retrieve proxy settings properties
String proxyHost = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_HOST);
String proxyPort = repoProperties.getProperty(InstallConstants.REPO_PROPERTIES_PROXY_PORT);
String proxyUser = getProxyUser(repoProperties);
String proxyPwd = getProxyPwd(repoProperties);
try {
//Construct proxy URL object from proxy host and port
if ((proxyHost != null && !proxyHost.isEmpty()) && (proxyPort != null && !proxyPort.isEmpty())) {
//Trim any trailing whitespaces
proxyHost = proxyHost.trim(); // depends on control dependency: [if], data = [none]
proxyPort = proxyPort.trim(); // depends on control dependency: [if], data = [none]
logger.log(Level.FINEST, "proxyHost: " + proxyHost); // depends on control dependency: [if], data = [none]
logger.log(Level.FINEST, "proxyPort: " + proxyPort); // depends on control dependency: [if], data = [none]
logger.log(Level.FINEST, "proxyUser: " + proxyUser); // depends on control dependency: [if], data = [none]
logger.log(Level.FINEST, "proxyPassword: ********"); // depends on control dependency: [if], data = [none]
if (proxyHost.toLowerCase().startsWith("http://"))
proxyURL = new URL(proxyHost + ":" + proxyPort);
else
proxyURL = new URL("http://" + proxyHost + ":" + proxyPort);
//Check proxy port number in range
if (proxyURL.getPort() < 0 || proxyURL.getPort() > 0xFFFF)
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", String.valueOf(proxyURL.getPort())));
} else {
if ((proxyHost == null || proxyHost.isEmpty()) && proxyPort != null) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_HOST_MISSING"), InstallException.MISSING_CONTENT);
} else if (proxyHost != null && (proxyPort == null || proxyPort.isEmpty())) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PORT_MISSING"), InstallException.MISSING_CONTENT);
}
}
} catch (MalformedURLException e) {
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_INVALID_PROXY_PORT", proxyPort), e, InstallException.RUNTIME_EXCEPTION);
}
if (proxyURL != null) {
if ((proxyUser != null && !proxyUser.isEmpty()) && (proxyPwd != null && !proxyPwd.isEmpty())) {
//Trim any trailing whitespaces
proxyUser = proxyUser.trim();
proxyPwd = proxyPwd.trim();
String decodedPwd = proxyPwd;
try {
//Decode encrypted proxy server password
decodedPwd = PasswordUtil.decode(proxyPwd); // depends on control dependency: [try], data = [none]
//Check proxy server credentials for Authentication
setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd); // depends on control dependency: [try], data = [none]
} catch (InvalidPasswordDecodingException ipde) {
decodedPwd = proxyPwd;
logger.log(Level.FINE, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("LOG_PASSWORD_NOT_ENCODED_PROXY", proxyURL) + InstallUtils.NEWLINE);
setProxyAuthenticator(proxyHost, proxyPort, proxyUser, decodedPwd);
} catch (UnsupportedCryptoAlgorithmException ucae) { // depends on control dependency: [catch], data = [none]
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_TOOL_PROXY_PWD_CRYPTO_UNSUPPORTED"), ucae, InstallException.RUNTIME_EXCEPTION);
} // depends on control dependency: [catch], data = [none]
}
try {
proxyInfo = new RestRepositoryConnectionProxy(proxyURL);
} catch (RepositoryException e) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
if (sw.toString().contains("com.ibm.websphere.ssl.protocol.SSLSocketFactory"))
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT_JDK_WRONG"), e, InstallException.RUNTIME_EXCEPTION);
else
throw new InstallException(Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("ERROR_FAILED_TO_CONNECT"), e, InstallException.RUNTIME_EXCEPTION);
}
}
}
return proxyInfo;
} }
|
public class class_name {
public static boolean contains(List<LatLong> latLongs, LatLong latLong) {
boolean result = false;
for (int i = 0, j = latLongs.size() - 1; i < latLongs.size(); j = i++) {
if ((latLongs.get(i).latitude > latLong.latitude) != (latLongs.get(j).latitude > latLong.latitude)
&& (latLong.longitude < (latLongs.get(j).longitude - latLongs.get(i).longitude) * (latLong.latitude - latLongs.get(i).latitude)
/ (latLongs.get(j).latitude - latLongs.get(i).latitude) + latLongs.get(i).longitude)) {
result = !result;
}
}
return result;
} }
|
public class class_name {
public static boolean contains(List<LatLong> latLongs, LatLong latLong) {
boolean result = false;
for (int i = 0, j = latLongs.size() - 1; i < latLongs.size(); j = i++) {
if ((latLongs.get(i).latitude > latLong.latitude) != (latLongs.get(j).latitude > latLong.latitude)
&& (latLong.longitude < (latLongs.get(j).longitude - latLongs.get(i).longitude) * (latLong.latitude - latLongs.get(i).latitude)
/ (latLongs.get(j).latitude - latLongs.get(i).latitude) + latLongs.get(i).longitude)) {
result = !result; // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public static Rdn getRdn(Name name, String key) {
Assert.notNull(name, "name must not be null");
Assert.hasText(key, "key must not be blank");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
List<Rdn> rdns = ldapName.getRdns();
for (Rdn rdn : rdns) {
NamingEnumeration<String> ids = rdn.toAttributes().getIDs();
while (ids.hasMoreElements()) {
String id = ids.nextElement();
if(key.equalsIgnoreCase(id)) {
return rdn;
}
}
}
throw new NoSuchElementException("No Rdn with the requested key: '" + key + "'");
} }
|
public class class_name {
public static Rdn getRdn(Name name, String key) {
Assert.notNull(name, "name must not be null");
Assert.hasText(key, "key must not be blank");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
List<Rdn> rdns = ldapName.getRdns();
for (Rdn rdn : rdns) {
NamingEnumeration<String> ids = rdn.toAttributes().getIDs();
while (ids.hasMoreElements()) {
String id = ids.nextElement();
if(key.equalsIgnoreCase(id)) {
return rdn; // depends on control dependency: [if], data = [none]
}
}
}
throw new NoSuchElementException("No Rdn with the requested key: '" + key + "'");
} }
|
public class class_name {
public List<State> getPrefixStates(Path path) {
List<State> result = new LinkedList<>();
for (State state : stateMap.values()) {
if (state.getPath().isPrefixOf(path)) {
result.add(state);
}
}
return result;
} }
|
public class class_name {
public List<State> getPrefixStates(Path path) {
List<State> result = new LinkedList<>();
for (State state : stateMap.values()) {
if (state.getPath().isPrefixOf(path)) {
result.add(state); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public void writeToStream(final OutputStream out) {
InputStream input = null;
try {
input = getDataSource().getInputStream();
StreamUtil.copy(input, out);
}
catch (final IOException ioex) {
throw new MailException(ioex);
}
finally {
StreamUtil.close(input);
}
} }
|
public class class_name {
public void writeToStream(final OutputStream out) {
InputStream input = null;
try {
input = getDataSource().getInputStream(); // depends on control dependency: [try], data = [none]
StreamUtil.copy(input, out); // depends on control dependency: [try], data = [none]
}
catch (final IOException ioex) {
throw new MailException(ioex);
} // depends on control dependency: [catch], data = [none]
finally {
StreamUtil.close(input);
}
} }
|
public class class_name {
@Override
public void startingService(ServiceContext serviceContext) {
// NOTE: the session initializer ultimately will create a management filter
// to add to the session filter chain. Creating that filter requires that
// the service management bean actually exist, which means that the first
// line in the block to add the bean MUST come first, and the two lines
// must exist together. Adding the bean before startingService doesn't work
// as explained above.
if (!(serviceContext.getService() instanceof ManagementService)) {
managementContext.addServiceManagementBean(serviceContext);
addSessionInitializer(serviceContext.getService(), serviceContext);
}
} }
|
public class class_name {
@Override
public void startingService(ServiceContext serviceContext) {
// NOTE: the session initializer ultimately will create a management filter
// to add to the session filter chain. Creating that filter requires that
// the service management bean actually exist, which means that the first
// line in the block to add the bean MUST come first, and the two lines
// must exist together. Adding the bean before startingService doesn't work
// as explained above.
if (!(serviceContext.getService() instanceof ManagementService)) {
managementContext.addServiceManagementBean(serviceContext); // depends on control dependency: [if], data = [none]
addSessionInitializer(serviceContext.getService(), serviceContext); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static SessionManagerConfig getServerSessionManagerConfig() {
SessionMgrComponentImpl service = INSTANCE.get().get();
if (service == null) {
// no session manager service is available
return null;
}
return service.getServerConfig();
} }
|
public class class_name {
public static SessionManagerConfig getServerSessionManagerConfig() {
SessionMgrComponentImpl service = INSTANCE.get().get();
if (service == null) {
// no session manager service is available
return null; // depends on control dependency: [if], data = [none]
}
return service.getServerConfig();
} }
|
public class class_name {
public String markAfter(@Nullable Dir dir, String str, boolean isHtml) {
if (dir == null) {
dir = estimateDirection(str, isHtml);
}
// BidiUtils.getExitDir() is called only if needed (short-circuit).
if (contextDir == Dir.LTR && (dir == Dir.RTL || BidiUtils.getExitDir(str, isHtml) == Dir.RTL)) {
return BidiUtils.Format.LRM_STRING;
}
if (contextDir == Dir.RTL && (dir == Dir.LTR || BidiUtils.getExitDir(str, isHtml) == Dir.LTR)) {
return BidiUtils.Format.RLM_STRING;
}
return "";
} }
|
public class class_name {
public String markAfter(@Nullable Dir dir, String str, boolean isHtml) {
if (dir == null) {
dir = estimateDirection(str, isHtml); // depends on control dependency: [if], data = [none]
}
// BidiUtils.getExitDir() is called only if needed (short-circuit).
if (contextDir == Dir.LTR && (dir == Dir.RTL || BidiUtils.getExitDir(str, isHtml) == Dir.RTL)) {
return BidiUtils.Format.LRM_STRING; // depends on control dependency: [if], data = [none]
}
if (contextDir == Dir.RTL && (dir == Dir.LTR || BidiUtils.getExitDir(str, isHtml) == Dir.LTR)) {
return BidiUtils.Format.RLM_STRING; // depends on control dependency: [if], data = [none]
}
return "";
} }
|
public class class_name {
public void marshall(EncoderSettings encoderSettings, ProtocolMarshaller protocolMarshaller) {
if (encoderSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(encoderSettings.getAudioDescriptions(), AUDIODESCRIPTIONS_BINDING);
protocolMarshaller.marshall(encoderSettings.getAvailBlanking(), AVAILBLANKING_BINDING);
protocolMarshaller.marshall(encoderSettings.getAvailConfiguration(), AVAILCONFIGURATION_BINDING);
protocolMarshaller.marshall(encoderSettings.getBlackoutSlate(), BLACKOUTSLATE_BINDING);
protocolMarshaller.marshall(encoderSettings.getCaptionDescriptions(), CAPTIONDESCRIPTIONS_BINDING);
protocolMarshaller.marshall(encoderSettings.getGlobalConfiguration(), GLOBALCONFIGURATION_BINDING);
protocolMarshaller.marshall(encoderSettings.getOutputGroups(), OUTPUTGROUPS_BINDING);
protocolMarshaller.marshall(encoderSettings.getTimecodeConfig(), TIMECODECONFIG_BINDING);
protocolMarshaller.marshall(encoderSettings.getVideoDescriptions(), VIDEODESCRIPTIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(EncoderSettings encoderSettings, ProtocolMarshaller protocolMarshaller) {
if (encoderSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(encoderSettings.getAudioDescriptions(), AUDIODESCRIPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getAvailBlanking(), AVAILBLANKING_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getAvailConfiguration(), AVAILCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getBlackoutSlate(), BLACKOUTSLATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getCaptionDescriptions(), CAPTIONDESCRIPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getGlobalConfiguration(), GLOBALCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getOutputGroups(), OUTPUTGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getTimecodeConfig(), TIMECODECONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encoderSettings.getVideoDescriptions(), VIDEODESCRIPTIONS_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 CommerceCurrency fetchByG_P_A_First(long groupId, boolean primary,
boolean active, OrderByComparator<CommerceCurrency> orderByComparator) {
List<CommerceCurrency> list = findByG_P_A(groupId, primary, active, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} }
|
public class class_name {
@Override
public CommerceCurrency fetchByG_P_A_First(long groupId, boolean primary,
boolean active, OrderByComparator<CommerceCurrency> orderByComparator) {
List<CommerceCurrency> list = findByG_P_A(groupId, primary, active, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("signature") // conversion routine
public static @ClassGetName String binaryNameToClassGetName(/*BinaryName*/ String bn) {
if (bn.endsWith("[]")) {
return binaryNameToFieldDescriptor(bn).replace('/', '.');
} else {
return bn;
}
} }
|
public class class_name {
@SuppressWarnings("signature") // conversion routine
public static @ClassGetName String binaryNameToClassGetName(/*BinaryName*/ String bn) {
if (bn.endsWith("[]")) {
return binaryNameToFieldDescriptor(bn).replace('/', '.'); // depends on control dependency: [if], data = [none]
} else {
return bn; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static boolean isExplicitlyRequested(String candidate, String... indices) {
boolean result = false;
for (String indexOrAlias : indices) {
boolean include = true;
if (indexOrAlias.charAt(0) == '+' || indexOrAlias.charAt(0) == '-') {
include = indexOrAlias.charAt(0) == '+';
indexOrAlias = indexOrAlias.substring(1);
}
if (indexOrAlias.equals("*") || indexOrAlias.equals("_all")) {
return false;
}
if (Regex.isSimpleMatchPattern(indexOrAlias)) {
if (Regex.simpleMatch(indexOrAlias, candidate)) {
if (include) {
result = true;
} else {
return false;
}
}
} else {
if (candidate.equals(indexOrAlias)) {
if (include) {
result = true;
} else {
return false;
}
}
}
}
return result;
} }
|
public class class_name {
public static boolean isExplicitlyRequested(String candidate, String... indices) {
boolean result = false;
for (String indexOrAlias : indices) {
boolean include = true;
if (indexOrAlias.charAt(0) == '+' || indexOrAlias.charAt(0) == '-') {
include = indexOrAlias.charAt(0) == '+'; // depends on control dependency: [if], data = [none]
indexOrAlias = indexOrAlias.substring(1); // depends on control dependency: [if], data = [none]
}
if (indexOrAlias.equals("*") || indexOrAlias.equals("_all")) {
return false; // depends on control dependency: [if], data = [none]
}
if (Regex.isSimpleMatchPattern(indexOrAlias)) {
if (Regex.simpleMatch(indexOrAlias, candidate)) {
if (include) {
result = true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
} else {
if (candidate.equals(indexOrAlias)) {
if (include) {
result = true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
return result;
} }
|
public class class_name {
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) {
Iterator<JsonElement> iterator = jsonArray.iterator();
if (iterator.hasNext()) {
JsonElement jsonElement = iterator.next();
if (jsonElement.isJsonArray()) {
JsonArray shapeArray = jsonElement.getAsJsonArray();
dimensions.add(shapeArray.size());
getSizeMultiDimensionalArray(shapeArray, dimensions);
}
}
} }
|
public class class_name {
private static void getSizeMultiDimensionalArray(JsonArray jsonArray, List<Integer> dimensions) {
Iterator<JsonElement> iterator = jsonArray.iterator();
if (iterator.hasNext()) {
JsonElement jsonElement = iterator.next();
if (jsonElement.isJsonArray()) {
JsonArray shapeArray = jsonElement.getAsJsonArray();
dimensions.add(shapeArray.size()); // depends on control dependency: [if], data = [none]
getSizeMultiDimensionalArray(shapeArray, dimensions); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Object applyToParentContainer ( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = getMatch( inputKey, walkedPath );
if ( thisLevel == null ) {
return null;
}
return performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel );
} }
|
public class class_name {
public Object applyToParentContainer ( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = getMatch( inputKey, walkedPath );
if ( thisLevel == null ) {
return null; // depends on control dependency: [if], data = [none]
}
return performCardinalityAdjustment( inputKey, input, walkedPath, (Map) parentContainer, thisLevel );
} }
|
public class class_name {
public static String getPropertyOrDefault(
Class<?> referenceClass,
String propertyFile,
String key,
String defaultValue) {
try (InputStream stream = referenceClass.getResourceAsStream(propertyFile)) {
if (stream == null) {
logger.atSevere().log("Could not load properties file '%s'", propertyFile);
return defaultValue;
}
Properties properties = new Properties();
properties.load(stream);
String value = properties.getProperty(key);
if (value == null) {
logger.atSevere().log("Key %s not found in properties file %s.", key, propertyFile);
return defaultValue;
}
return value;
} catch (IOException e) {
logger.atSevere().withCause(e).log(
"Error while trying to get property value for key %s", key);
return defaultValue;
}
} }
|
public class class_name {
public static String getPropertyOrDefault(
Class<?> referenceClass,
String propertyFile,
String key,
String defaultValue) {
try (InputStream stream = referenceClass.getResourceAsStream(propertyFile)) {
if (stream == null) {
logger.atSevere().log("Could not load properties file '%s'", propertyFile); // depends on control dependency: [if], data = [none]
return defaultValue; // depends on control dependency: [if], data = [none]
}
Properties properties = new Properties();
properties.load(stream);
String value = properties.getProperty(key);
if (value == null) {
logger.atSevere().log("Key %s not found in properties file %s.", key, propertyFile); // depends on control dependency: [if], data = [none]
return defaultValue; // depends on control dependency: [if], data = [none]
}
return value;
} catch (IOException e) {
logger.atSevere().withCause(e).log(
"Error while trying to get property value for key %s", key);
return defaultValue;
}
} }
|
public class class_name {
@Override
public List<Team> getTeams() {
List<Team> result = new ArrayList<>();
try {
String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/")
+ TEMPO_TEAMS_REST_SUFFIX;
ResponseEntity<String> responseEntity = makeRestCall(url);
String responseBody = responseEntity.getBody();
JSONArray teamsJson = (JSONArray) parser.parse(responseBody);
if (teamsJson != null) {
for (Object obj : teamsJson) {
JSONObject jo = (JSONObject) obj;
String teamId = getString(jo, "id");
String teamName = getString(jo, "name");
Team team = new Team(teamId, teamName);
team.setChangeDate("");
team.setTeamType("");
team.setAssetState("Active");
team.setIsDeleted("False");
result.add(team);
}
}
} catch (ParseException pe) {
LOGGER.error("Parser exception when parsing teams", pe);
} catch (HygieiaException e) {
LOGGER.error("Error in calling JIRA API", e);
}
return result;
} }
|
public class class_name {
@Override
public List<Team> getTeams() {
List<Team> result = new ArrayList<>();
try {
String url = featureSettings.getJiraBaseUrl() + (featureSettings.getJiraBaseUrl().endsWith("/") ? "" : "/")
+ TEMPO_TEAMS_REST_SUFFIX;
ResponseEntity<String> responseEntity = makeRestCall(url);
String responseBody = responseEntity.getBody();
JSONArray teamsJson = (JSONArray) parser.parse(responseBody);
if (teamsJson != null) {
for (Object obj : teamsJson) {
JSONObject jo = (JSONObject) obj;
String teamId = getString(jo, "id");
String teamName = getString(jo, "name");
Team team = new Team(teamId, teamName);
team.setChangeDate(""); // depends on control dependency: [for], data = [none]
team.setTeamType(""); // depends on control dependency: [for], data = [none]
team.setAssetState("Active"); // depends on control dependency: [for], data = [none]
team.setIsDeleted("False"); // depends on control dependency: [for], data = [none]
result.add(team); // depends on control dependency: [for], data = [none]
}
}
} catch (ParseException pe) {
LOGGER.error("Parser exception when parsing teams", pe);
} catch (HygieiaException e) { // depends on control dependency: [catch], data = [none]
LOGGER.error("Error in calling JIRA API", e);
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
public void add(Chunks c) {
assert c.chunkBits == chunkBits;
assert c.defaultValue == defaultValue;
int[][] oChunks = c.chunks;
if (c.numChunks > numChunks) growTo(c.numChunks-1);
for (int i = 0; i < oChunks.length; i++) {
int[] oChunk = oChunks[i];
if (oChunk!=null) {
if (chunks[i]==null) {
chunks[i]=oChunk.clone();
} else {
int[] chunk = chunks[i];
for (int j = 0; j < oChunk.length; j++) {
chunk[j] += oChunk[j];
}
}
}
}
this.maxIndex = Math.max(this.maxIndex,c.maxIndex);
} }
|
public class class_name {
public void add(Chunks c) {
assert c.chunkBits == chunkBits;
assert c.defaultValue == defaultValue;
int[][] oChunks = c.chunks;
if (c.numChunks > numChunks) growTo(c.numChunks-1);
for (int i = 0; i < oChunks.length; i++) {
int[] oChunk = oChunks[i];
if (oChunk!=null) {
if (chunks[i]==null) {
chunks[i]=oChunk.clone(); // depends on control dependency: [if], data = [none]
} else {
int[] chunk = chunks[i];
for (int j = 0; j < oChunk.length; j++) {
chunk[j] += oChunk[j]; // depends on control dependency: [for], data = [j]
}
}
}
}
this.maxIndex = Math.max(this.maxIndex,c.maxIndex);
} }
|
public class class_name {
private void printBand(GroupCache gc, Band staticBand, boolean hasFunction, boolean usePrevious)
throws QueryException {
Band band;
List<FunctionCache> fCache = null;
isDetail = false;
boolean isPageHeaderFooter = false;
if (gc == null) {
if (staticBand != null) {
band = staticBand;
if (ReportLayout.PAGE_HEADER_BAND_NAME.equals(band.getName()) || ReportLayout.PAGE_FOOTER_BAND_NAME.equals(band.getName())) {
isPageHeaderFooter = true;
}
} else {
isDetail = true;
band = getReportLayout().getDetailBand();
}
} else {
fCache = gc.getFuncCache();
if (hasFunction) {
band = gc.getFgBand();
} else {
band = gc.getHgBand();
}
}
currentBandName = band.getName();
int rows = band.getRowCount();
int cols = band.getColumnCount();
Set<CellElement> ignored = getIgnoredCells(band);
int lastRow = -1;
for (int i = 0; i < rows; i++) {
// hide when expression
// a hidden cell is considered to be rendered with null value (but value is taken
// into account in functions)
// if all cells from a row are hidden , we consider the entire row hidden (hideAll)
// and no cell from that row is rendered
boolean[] hide = new boolean[cols];
boolean hideAll = false;
int count = 0;
boolean rowWithHideExpression = false;
boolean hideExpressionForEmptyData = false;
for (int j = 0; j < cols; j++) {
BandElement bandElement = band.getElementAt(i, j);
if ((bandElement != null) && (bandElement.getHideWhenExpression() != null)) {
rowWithHideExpression = true;
if (hideExpressionForEmptyData(bandElement.getHideWhenExpression())) {
hideExpressionForEmptyData = true;
}
}
}
if (rowWithHideExpression) {
for (int j = 0; j < cols; j++) {
BandElement bandElement = band.getElementAt(i, j);
if ((bandElement != null) && (bandElement.getHideWhenExpression() != null)) {
String expression = bandElement.getHideWhenExpression();
Boolean result = (Boolean) evaluateExpression("", expression, currentBandName, null, gc);
hide[j] = result;
} else {
// bandElement can be null in older version of reports (previous to 4.1)
hide[j] = (bandElement == null) || "".equals(bandElement.getText());
}
if (hide[j]) {
count++;
}
}
if (count == cols) {
hideAll = true;
}
}
if (printRowsForEmptyData && !hideExpressionForEmptyData) {
continue;
}
for (int j = 0; j < cols; j++) {
if (findIgnoredCellElement(ignored, i, j)) {
//System.out.println("*** header ignored i="+i + " j="+j);
continue;
}
// newRow is computed relative to cells that are renedered through exportCell
// ignored cells are not taken into account
if (i > lastRow) {
newRow = true;
} else {
newRow = false;
}
BandElement bandElement = band.getElementAt(i, j);
if (bandElement != null) {
newRowCount = Math.max(newRowCount, bandElement.getRowSpan());
}
if (newRow) {
int gridRow = getReportLayout().getGridRow(band.getName(), i);
RowElement re = getRowElement(getReportLayout(), gridRow);
// if new page is put for the first row in the layout, we should not create a new page
if (re.isStartOnNewPage() && !start ) {
if (!startNewPage) {
// if header on every page, must not use header rows inside pageRow count
if (getReportLayout().isHeaderOnEveryPage()) {
if (pageRow - headerRow > 0) {
createNewPage();
}
} else {
createNewPage();
}
} else {
// we create new page excepting only for first group or in case there are no header rows
if ( (getReportLayout().getHeaderBand().getRowCount() == 0) ||
!(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + "1").equals(band.getName())) {
createNewPage();
}
startNewPage = false;
}
}
}
// subreports with parameters can be used only inside detail band
// we must update values for subreport parameters
// parameter name used in subreport must be the column alias from parent report !
//
// !!! we may have a subreport with parameters inside another subreport, so we always try yo add parameters from subreports
if (isDetail && ((bandElement instanceof ReportBandElement) || (bandElement instanceof ChartBandElement))) {
Map<String, QueryParameter> params = bean.getParametersBean().getSubreportParams();
if (params.size() == 0) {
// first time we have to look for subreports and add parameters of subreports that are not yet found in master report
List<Report> subreports = ReportUtil.getDetailSubreports(bean.getReportLayout());
for (Report subreport : subreports) {
bean.getParametersBean().addNotFoundSubreportParameters(subreport.getParameters());
}
// similar for charts
List<Chart> charts = ReportUtil.getDetailCharts(bean.getReportLayout());
for (Chart chart : charts) {
bean.getParametersBean().addNotFoundSubreportParameters(chart.getReport().getParameters());
}
}
for (QueryParameter qp : params.values()) {
try {
Object pValue = getResult().nextValue(qp.getName());
bean.getParametersBean().setParameterValue(qp.getName(), pValue);
} catch (QueryException ex) {
// if parameter is in third level (report->subreport->subreport:param) it won't be found in first level report
if (!bean.isSubreport()) {
throw new QueryException("Invalid column for parameter: " + qp.getName(), ex);
}
}
}
}
Object value = getBandElementValue(fCache, gc, staticBand, hasFunction, usePrevious, bandElement);
// hide when expression
if (!hideAll && hide[j]) {
value = null;
}
int rowSpan = 1, colSpan = 1;
if (bandElement != null) {
rowSpan = bandElement.getRowSpan();
colSpan = bandElement.getColSpan();
}
int gridRow = getReportLayout().getGridRow(band.getName(), i);
boolean isImage = bandElement instanceof ImageBandElement;
if (!hideAll) {
exportCell(band.getName(), bandElement, value, gridRow, i, j, cols, rowSpan, colSpan, isImage);
}
lastRow = i;
// after exportCell where we may use newRow and newRowCount variables
// we need to reset newRowCount
if (newRow) {
newRowCount = 1;
}
}
// page header and page footer do not count for row computation
if (!isPageHeaderFooter) {
exporterRow++;
if (!hideAll) {
if (ReportLayout.HEADER_BAND_NAME.equals(band.getName())) {
headerRow++;
}
pageRow++;
}
start = false;
}
}
} }
|
public class class_name {
private void printBand(GroupCache gc, Band staticBand, boolean hasFunction, boolean usePrevious)
throws QueryException {
Band band;
List<FunctionCache> fCache = null;
isDetail = false;
boolean isPageHeaderFooter = false;
if (gc == null) {
if (staticBand != null) {
band = staticBand;
if (ReportLayout.PAGE_HEADER_BAND_NAME.equals(band.getName()) || ReportLayout.PAGE_FOOTER_BAND_NAME.equals(band.getName())) {
isPageHeaderFooter = true; // depends on control dependency: [if], data = [none]
}
} else {
isDetail = true;
band = getReportLayout().getDetailBand();
}
} else {
fCache = gc.getFuncCache();
if (hasFunction) {
band = gc.getFgBand();
} else {
band = gc.getHgBand();
}
}
currentBandName = band.getName();
int rows = band.getRowCount();
int cols = band.getColumnCount();
Set<CellElement> ignored = getIgnoredCells(band);
int lastRow = -1;
for (int i = 0; i < rows; i++) {
// hide when expression
// a hidden cell is considered to be rendered with null value (but value is taken
// into account in functions)
// if all cells from a row are hidden , we consider the entire row hidden (hideAll)
// and no cell from that row is rendered
boolean[] hide = new boolean[cols];
boolean hideAll = false;
int count = 0;
boolean rowWithHideExpression = false;
boolean hideExpressionForEmptyData = false;
for (int j = 0; j < cols; j++) {
BandElement bandElement = band.getElementAt(i, j);
if ((bandElement != null) && (bandElement.getHideWhenExpression() != null)) {
rowWithHideExpression = true;
if (hideExpressionForEmptyData(bandElement.getHideWhenExpression())) {
hideExpressionForEmptyData = true;
}
}
}
if (rowWithHideExpression) {
for (int j = 0; j < cols; j++) {
BandElement bandElement = band.getElementAt(i, j);
if ((bandElement != null) && (bandElement.getHideWhenExpression() != null)) {
String expression = bandElement.getHideWhenExpression();
Boolean result = (Boolean) evaluateExpression("", expression, currentBandName, null, gc);
hide[j] = result;
} else {
// bandElement can be null in older version of reports (previous to 4.1)
hide[j] = (bandElement == null) || "".equals(bandElement.getText());
}
if (hide[j]) {
count++;
}
}
if (count == cols) {
hideAll = true;
}
}
if (printRowsForEmptyData && !hideExpressionForEmptyData) {
continue;
}
for (int j = 0; j < cols; j++) {
if (findIgnoredCellElement(ignored, i, j)) {
//System.out.println("*** header ignored i="+i + " j="+j);
continue;
}
// newRow is computed relative to cells that are renedered through exportCell
// ignored cells are not taken into account
if (i > lastRow) {
newRow = true;
} else {
newRow = false;
}
BandElement bandElement = band.getElementAt(i, j);
if (bandElement != null) {
newRowCount = Math.max(newRowCount, bandElement.getRowSpan());
}
if (newRow) {
int gridRow = getReportLayout().getGridRow(band.getName(), i);
RowElement re = getRowElement(getReportLayout(), gridRow);
// if new page is put for the first row in the layout, we should not create a new page
if (re.isStartOnNewPage() && !start ) {
if (!startNewPage) {
// if header on every page, must not use header rows inside pageRow count
if (getReportLayout().isHeaderOnEveryPage()) {
if (pageRow - headerRow > 0) {
createNewPage();
}
} else {
createNewPage();
}
} else {
// we create new page excepting only for first group or in case there are no header rows
if ( (getReportLayout().getHeaderBand().getRowCount() == 0) ||
!(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + "1").equals(band.getName())) {
createNewPage();
}
startNewPage = false;
}
}
}
// subreports with parameters can be used only inside detail band
// we must update values for subreport parameters
// parameter name used in subreport must be the column alias from parent report !
//
// !!! we may have a subreport with parameters inside another subreport, so we always try yo add parameters from subreports
if (isDetail && ((bandElement instanceof ReportBandElement) || (bandElement instanceof ChartBandElement))) {
Map<String, QueryParameter> params = bean.getParametersBean().getSubreportParams();
if (params.size() == 0) {
// first time we have to look for subreports and add parameters of subreports that are not yet found in master report
List<Report> subreports = ReportUtil.getDetailSubreports(bean.getReportLayout());
for (Report subreport : subreports) {
bean.getParametersBean().addNotFoundSubreportParameters(subreport.getParameters());
}
// similar for charts
List<Chart> charts = ReportUtil.getDetailCharts(bean.getReportLayout());
for (Chart chart : charts) {
bean.getParametersBean().addNotFoundSubreportParameters(chart.getReport().getParameters());
}
}
for (QueryParameter qp : params.values()) {
try {
Object pValue = getResult().nextValue(qp.getName());
bean.getParametersBean().setParameterValue(qp.getName(), pValue);
} catch (QueryException ex) {
// if parameter is in third level (report->subreport->subreport:param) it won't be found in first level report
if (!bean.isSubreport()) {
throw new QueryException("Invalid column for parameter: " + qp.getName(), ex);
}
}
}
}
Object value = getBandElementValue(fCache, gc, staticBand, hasFunction, usePrevious, bandElement);
// hide when expression
if (!hideAll && hide[j]) {
value = null;
}
int rowSpan = 1, colSpan = 1;
if (bandElement != null) {
rowSpan = bandElement.getRowSpan();
colSpan = bandElement.getColSpan();
}
int gridRow = getReportLayout().getGridRow(band.getName(), i);
boolean isImage = bandElement instanceof ImageBandElement;
if (!hideAll) {
exportCell(band.getName(), bandElement, value, gridRow, i, j, cols, rowSpan, colSpan, isImage);
}
lastRow = i;
// after exportCell where we may use newRow and newRowCount variables
// we need to reset newRowCount
if (newRow) {
newRowCount = 1;
}
}
// page header and page footer do not count for row computation
if (!isPageHeaderFooter) {
exporterRow++;
if (!hideAll) {
if (ReportLayout.HEADER_BAND_NAME.equals(band.getName())) {
headerRow++;
}
pageRow++;
}
start = false;
}
}
} }
|
public class class_name {
public static String join(String separator, Collection<String> stringsToJoin) {
StringBuilder builder = new StringBuilder();
// Check if there is at least 1 element then use do/while to avoid trailing separator
int index = stringsToJoin.size();
for (String str : stringsToJoin) {
index--;
if (str != null) {
builder.append(str);
if (index > 0) {
builder.append(separator);
}
}
}
return builder.toString();
} }
|
public class class_name {
public static String join(String separator, Collection<String> stringsToJoin) {
StringBuilder builder = new StringBuilder();
// Check if there is at least 1 element then use do/while to avoid trailing separator
int index = stringsToJoin.size();
for (String str : stringsToJoin) {
index--; // depends on control dependency: [for], data = [none]
if (str != null) {
builder.append(str); // depends on control dependency: [if], data = [(str]
if (index > 0) {
builder.append(separator); // depends on control dependency: [if], data = [none]
}
}
}
return builder.toString();
} }
|
public class class_name {
private int readAnnotationTarget(final Context context, int u) {
int target = readInt(u);
switch (target >>> 24) {
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
target &= 0xFFFF0000;
u += 2;
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
target &= 0xFF000000;
u += 1;
break;
case 0x40: // LOCAL_VARIABLE
case 0x41: { // RESOURCE_VARIABLE
target &= 0xFF000000;
int n = readUnsignedShort(u + 1);
context.start = new Label[n];
context.end = new Label[n];
context.index = new int[n];
u += 3;
for (int i = 0; i < n; ++i) {
int start = readUnsignedShort(u);
int length = readUnsignedShort(u + 2);
context.start[i] = createLabel(start, context.labels);
context.end[i] = createLabel(start + length, context.labels);
context.index[i] = readUnsignedShort(u + 4);
u += 6;
}
break;
}
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
target &= 0xFF0000FF;
u += 4;
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
target &= (target >>> 24) < 0x43 ? 0xFFFFFF00 : 0xFF000000;
u += 3;
break;
}
int pathLength = readByte(u);
context.typeRef = target;
context.typePath = pathLength == 0 ? null : new TypePath(b, u);
return u + 1 + 2 * pathLength;
} }
|
public class class_name {
private int readAnnotationTarget(final Context context, int u) {
int target = readInt(u);
switch (target >>> 24) {
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
target &= 0xFFFF0000;
u += 2;
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
target &= 0xFF000000;
u += 1;
break;
case 0x40: // LOCAL_VARIABLE
case 0x41: { // RESOURCE_VARIABLE
target &= 0xFF000000;
int n = readUnsignedShort(u + 1);
context.start = new Label[n];
context.end = new Label[n];
context.index = new int[n];
u += 3;
for (int i = 0; i < n; ++i) {
int start = readUnsignedShort(u);
int length = readUnsignedShort(u + 2);
context.start[i] = createLabel(start, context.labels); // depends on control dependency: [for], data = [i]
context.end[i] = createLabel(start + length, context.labels); // depends on control dependency: [for], data = [i]
context.index[i] = readUnsignedShort(u + 4); // depends on control dependency: [for], data = [i]
u += 6; // depends on control dependency: [for], data = [none]
}
break;
}
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
target &= 0xFF0000FF;
u += 4;
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
target &= (target >>> 24) < 0x43 ? 0xFFFFFF00 : 0xFF000000;
u += 3;
break;
}
int pathLength = readByte(u);
context.typeRef = target;
context.typePath = pathLength == 0 ? null : new TypePath(b, u);
return u + 1 + 2 * pathLength;
} }
|
public class class_name {
public void marshall(DeleteReplicationJobRequest deleteReplicationJobRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteReplicationJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteReplicationJobRequest.getReplicationJobId(), REPLICATIONJOBID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteReplicationJobRequest deleteReplicationJobRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteReplicationJobRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteReplicationJobRequest.getReplicationJobId(), REPLICATIONJOBID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void exposeExposedFieldsToJs() {
if (fieldsWithNameExposed.isEmpty()) {
return;
}
MethodSpec.Builder exposeFieldMethod = MethodSpec
.methodBuilder("vg$ef")
.addAnnotation(JsMethod.class);
fieldsWithNameExposed
.forEach(field -> exposeFieldMethod
.addStatement("this.$L = $T.v()",
field.getName(),
FieldsExposer.class)
);
exposeFieldMethod
.addStatement(
"$T.e($L)",
FieldsExposer.class,
String.join(
",",
fieldsWithNameExposed.stream()
.map(ExposedField::getName)
.collect(Collectors.toList())
)
);
componentExposedTypeBuilder.addMethod(exposeFieldMethod.build());
} }
|
public class class_name {
private void exposeExposedFieldsToJs() {
if (fieldsWithNameExposed.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
MethodSpec.Builder exposeFieldMethod = MethodSpec
.methodBuilder("vg$ef")
.addAnnotation(JsMethod.class);
fieldsWithNameExposed
.forEach(field -> exposeFieldMethod
.addStatement("this.$L = $T.v()",
field.getName(),
FieldsExposer.class)
);
exposeFieldMethod
.addStatement(
"$T.e($L)",
FieldsExposer.class,
String.join(
",",
fieldsWithNameExposed.stream()
.map(ExposedField::getName)
.collect(Collectors.toList())
)
);
componentExposedTypeBuilder.addMethod(exposeFieldMethod.build());
} }
|
public class class_name {
public DescribeProvisioningParametersResult withProvisioningArtifactParameters(ProvisioningArtifactParameter... provisioningArtifactParameters) {
if (this.provisioningArtifactParameters == null) {
setProvisioningArtifactParameters(new java.util.ArrayList<ProvisioningArtifactParameter>(provisioningArtifactParameters.length));
}
for (ProvisioningArtifactParameter ele : provisioningArtifactParameters) {
this.provisioningArtifactParameters.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeProvisioningParametersResult withProvisioningArtifactParameters(ProvisioningArtifactParameter... provisioningArtifactParameters) {
if (this.provisioningArtifactParameters == null) {
setProvisioningArtifactParameters(new java.util.ArrayList<ProvisioningArtifactParameter>(provisioningArtifactParameters.length)); // depends on control dependency: [if], data = [none]
}
for (ProvisioningArtifactParameter ele : provisioningArtifactParameters) {
this.provisioningArtifactParameters.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public final boolean isStarted() {
String thisMethodName = "isStarted";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
boolean retVal = (_state == STATE_STARTED);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(retVal));
}
return retVal;
} }
|
public class class_name {
public final boolean isStarted() {
String thisMethodName = "isStarted";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this); // depends on control dependency: [if], data = [none]
}
boolean retVal = (_state == STATE_STARTED);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, Boolean.toString(retVal)); // depends on control dependency: [if], data = [none]
}
return retVal;
} }
|
public class class_name {
public void marshall(DeletePermissionPolicyRequest deletePermissionPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (deletePermissionPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deletePermissionPolicyRequest.getResourceArn(), RESOURCEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeletePermissionPolicyRequest deletePermissionPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (deletePermissionPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deletePermissionPolicyRequest.getResourceArn(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public WeightedIndexEvaluation evaluate(SolutionType solution, DataType data) {
// initialize evaluation object
WeightedIndexEvaluation eval = new WeightedIndexEvaluation();
// add evaluations produced by contained objectives
weights.keySet().forEach(obj -> {
// evaluate solution using objective
Evaluation objEval = obj.evaluate(solution, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w;
}
// register in weighted index evaluation
eval.addEvaluation(obj, objEval, w);
});
// return weighted index evaluation
return eval;
} }
|
public class class_name {
@Override
public WeightedIndexEvaluation evaluate(SolutionType solution, DataType data) {
// initialize evaluation object
WeightedIndexEvaluation eval = new WeightedIndexEvaluation();
// add evaluations produced by contained objectives
weights.keySet().forEach(obj -> {
// evaluate solution using objective
Evaluation objEval = obj.evaluate(solution, data);
// flip weight sign if minimizing
double w = weights.get(obj);
if(obj.isMinimizing()){
w = -w; // depends on control dependency: [if], data = [none]
}
// register in weighted index evaluation
eval.addEvaluation(obj, objEval, w);
});
// return weighted index evaluation
return eval;
} }
|
public class class_name {
public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());
for(Integer serverId: serverIds) {
clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue));
}
return new VectorClock(clockEntries, timestamp);
} }
|
public class class_name {
public static VectorClock makeClock(Set<Integer> serverIds, long clockValue, long timestamp) {
List<ClockEntry> clockEntries = new ArrayList<ClockEntry>(serverIds.size());
for(Integer serverId: serverIds) {
clockEntries.add(new ClockEntry(serverId.shortValue(), clockValue)); // depends on control dependency: [for], data = [serverId]
}
return new VectorClock(clockEntries, timestamp);
} }
|
public class class_name {
protected void handleInstallResponse(RaftMemberContext member, InstallRequest request, InstallResponse response, long timestamp) {
if (response.status() == RaftResponse.Status.OK) {
handleInstallResponseOk(member, request, response);
} else {
handleInstallResponseError(member, request, response);
}
} }
|
public class class_name {
protected void handleInstallResponse(RaftMemberContext member, InstallRequest request, InstallResponse response, long timestamp) {
if (response.status() == RaftResponse.Status.OK) {
handleInstallResponseOk(member, request, response); // depends on control dependency: [if], data = [none]
} else {
handleInstallResponseError(member, request, response); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<T> getRoots() {
List<T> roots = new ArrayList<>();
for (DirectedAcyclicGraphNode<T> root : mRoots) {
roots.add(root.getPayload());
}
return roots;
} }
|
public class class_name {
public List<T> getRoots() {
List<T> roots = new ArrayList<>();
for (DirectedAcyclicGraphNode<T> root : mRoots) {
roots.add(root.getPayload()); // depends on control dependency: [for], data = [root]
}
return roots;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.