code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private String[] enabledProtocols(String[] supportedProtocols,
String[] defaultProtocols) {
if (enabledProtocols == null) {
// we're assuming that the same engine is used for all configurables
// so once we determine the enabled set, we won't do it again
if (OptionHelper.isEmpty(getIncludedProtocols())
&& OptionHelper.isEmpty(getExcludedProtocols())) {
enabledProtocols = Arrays.copyOf(defaultProtocols,
defaultProtocols.length);
}
else {
enabledProtocols = includedStrings(supportedProtocols,
getIncludedProtocols(), getExcludedProtocols());
}
for (String protocol : enabledProtocols) {
addInfo("enabled protocol: " + protocol);
}
}
return enabledProtocols;
} } | public class class_name {
private String[] enabledProtocols(String[] supportedProtocols,
String[] defaultProtocols) {
if (enabledProtocols == null) {
// we're assuming that the same engine is used for all configurables
// so once we determine the enabled set, we won't do it again
if (OptionHelper.isEmpty(getIncludedProtocols())
&& OptionHelper.isEmpty(getExcludedProtocols())) {
enabledProtocols = Arrays.copyOf(defaultProtocols,
defaultProtocols.length); // depends on control dependency: [if], data = [none]
}
else {
enabledProtocols = includedStrings(supportedProtocols,
getIncludedProtocols(), getExcludedProtocols()); // depends on control dependency: [if], data = [none]
}
for (String protocol : enabledProtocols) {
addInfo("enabled protocol: " + protocol); // depends on control dependency: [for], data = [protocol]
}
}
return enabledProtocols;
} } |
public class class_name {
public static double chisquareInverseCdf(double p, int df) {
final double CHI_EPSILON = 0.000001; /* Accuracy of critchi approximation */
final double CHI_MAX = 99999.0; /* Maximum chi-square value */
double minchisq = 0.0;
double maxchisq = CHI_MAX;
if (p <= 0.0) {
return CHI_MAX;
}
else if (p >= 1.0) {
return 0.0;
}
double chisqval = df/Math.sqrt(p); /* fair first value */
while ((maxchisq - minchisq) > CHI_EPSILON) {
if (1-chisquareCdf(chisqval, df) < p) {
maxchisq = chisqval;
}
else {
minchisq = chisqval;
}
chisqval = (maxchisq + minchisq) * 0.5;
}
return chisqval;
} } | public class class_name {
public static double chisquareInverseCdf(double p, int df) {
final double CHI_EPSILON = 0.000001; /* Accuracy of critchi approximation */
final double CHI_MAX = 99999.0; /* Maximum chi-square value */
double minchisq = 0.0;
double maxchisq = CHI_MAX;
if (p <= 0.0) {
return CHI_MAX; // depends on control dependency: [if], data = [none]
}
else if (p >= 1.0) {
return 0.0; // depends on control dependency: [if], data = [none]
}
double chisqval = df/Math.sqrt(p); /* fair first value */
while ((maxchisq - minchisq) > CHI_EPSILON) {
if (1-chisquareCdf(chisqval, df) < p) {
maxchisq = chisqval; // depends on control dependency: [if], data = [none]
}
else {
minchisq = chisqval; // depends on control dependency: [if], data = [none]
}
chisqval = (maxchisq + minchisq) * 0.5; // depends on control dependency: [while], data = [none]
}
return chisqval;
} } |
public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(hashAlg);
sb.append(' ');
sb.append(flags);
sb.append(' ');
sb.append(iterations);
sb.append(' ');
if (salt == null)
sb.append('-');
else
sb.append(base16.toString(salt));
sb.append(' ');
sb.append(b32.toString(next));
if (!types.empty()) {
sb.append(' ');
sb.append(types.toString());
}
return sb.toString();
} } | public class class_name {
String
rrToString() {
StringBuffer sb = new StringBuffer();
sb.append(hashAlg);
sb.append(' ');
sb.append(flags);
sb.append(' ');
sb.append(iterations);
sb.append(' ');
if (salt == null)
sb.append('-');
else
sb.append(base16.toString(salt));
sb.append(' ');
sb.append(b32.toString(next));
if (!types.empty()) {
sb.append(' '); // depends on control dependency: [if], data = [none]
sb.append(types.toString()); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} } |
public class class_name {
public void marshall(ListConfigurationSetsRequest listConfigurationSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listConfigurationSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listConfigurationSetsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listConfigurationSetsRequest.getPageSize(), PAGESIZE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListConfigurationSetsRequest listConfigurationSetsRequest, ProtocolMarshaller protocolMarshaller) {
if (listConfigurationSetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listConfigurationSetsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listConfigurationSetsRequest.getPageSize(), PAGESIZE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CmsInheritanceContainerEditor openInheritanceContainerEditor(
CmsGroupContainerElementPanel groupContainer,
CmsContainerpageController controller,
CmsContainerpageHandler handler) {
// making sure only a single instance of the group-container editor is open
if (INSTANCE != null) {
CmsDebugLog.getInstance().printLine("group-container editor already open");
} else {
CmsInheritanceContainerEditor editor = new CmsInheritanceContainerEditor(
groupContainer,
controller,
handler);
RootPanel.get().add(editor);
editor.openDialog(Messages.get().key(Messages.GUI_INHERITANCECONTAINER_CAPTION_0));
groupContainer.refreshHighlighting();
INSTANCE = editor;
}
return INSTANCE;
} } | public class class_name {
public static CmsInheritanceContainerEditor openInheritanceContainerEditor(
CmsGroupContainerElementPanel groupContainer,
CmsContainerpageController controller,
CmsContainerpageHandler handler) {
// making sure only a single instance of the group-container editor is open
if (INSTANCE != null) {
CmsDebugLog.getInstance().printLine("group-container editor already open");
// depends on control dependency: [if], data = [none]
} else {
CmsInheritanceContainerEditor editor = new CmsInheritanceContainerEditor(
groupContainer,
controller,
handler);
RootPanel.get().add(editor);
// depends on control dependency: [if], data = [none]
editor.openDialog(Messages.get().key(Messages.GUI_INHERITANCECONTAINER_CAPTION_0));
// depends on control dependency: [if], data = [none]
groupContainer.refreshHighlighting();
// depends on control dependency: [if], data = [none]
INSTANCE = editor;
// depends on control dependency: [if], data = [none]
}
return INSTANCE;
} } |
public class class_name {
@Override
public boolean retainAll(IntSet c)
{
if (c == null || c.isEmpty()) {
return false;
}
boolean res = false;
for (int i = 0; i < cells.length; i++) {
if (cells[i] >= 0 && !c.contains(cells[i])) {
cells[i] = REMOVED;
res = true;
size--;
}
}
if (res) {
modCount++;
}
return res;
} } | public class class_name {
@Override
public boolean retainAll(IntSet c)
{
if (c == null || c.isEmpty()) {
return false;
// depends on control dependency: [if], data = [none]
}
boolean res = false;
for (int i = 0; i < cells.length; i++) {
if (cells[i] >= 0 && !c.contains(cells[i])) {
cells[i] = REMOVED;
// depends on control dependency: [if], data = [none]
res = true;
// depends on control dependency: [if], data = [none]
size--;
// depends on control dependency: [if], data = [none]
}
}
if (res) {
modCount++;
// depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
public Date getTimeAfter(Date afterTime) {
// Computation is based on Gregorian year only.
Calendar cl = new java.util.GregorianCalendar(getTimeZone());
// move ahead one second, since we're computing the time *after* the
// given time
afterTime = new Date(afterTime.getTime() + 1000);
// CronTrigger does not deal with milliseconds
cl.setTime(afterTime);
cl.set(Calendar.MILLISECOND, 0);
boolean gotOne = false;
// loop until we've computed the next time, or we've past the endTime
while (!gotOne) {
//if (endTime != null && cl.getTime().after(endTime)) return null;
if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
return null;
}
SortedSet<Integer> st = null;
int t = 0;
int sec = cl.get(Calendar.SECOND);
int min = cl.get(Calendar.MINUTE);
// get second.................................................
st = seconds.tailSet(Integer.valueOf(sec));
if (st != null && st.size() != 0) {
sec = st.first().intValue();
} else {
sec = seconds.first().intValue();
min++;
cl.set(Calendar.MINUTE, min);
}
cl.set(Calendar.SECOND, sec);
min = cl.get(Calendar.MINUTE);
int hr = cl.get(Calendar.HOUR_OF_DAY);
t = -1;
// get minute.................................................
st = minutes.tailSet(Integer.valueOf(min));
if (st != null && st.size() != 0) {
t = min;
min = st.first().intValue();
} else {
min = minutes.first().intValue();
hr++;
}
if (min != t) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, min);
setCalendarHour(cl, hr);
continue;
}
cl.set(Calendar.MINUTE, min);
hr = cl.get(Calendar.HOUR_OF_DAY);
int day = cl.get(Calendar.DAY_OF_MONTH);
t = -1;
// get hour...................................................
st = hours.tailSet(Integer.valueOf(hr));
if (st != null && st.size() != 0) {
t = hr;
hr = st.first().intValue();
} else {
hr = hours.first().intValue();
day++;
}
if (hr != t) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.DAY_OF_MONTH, day);
setCalendarHour(cl, hr);
continue;
}
cl.set(Calendar.HOUR_OF_DAY, hr);
day = cl.get(Calendar.DAY_OF_MONTH);
int mon = cl.get(Calendar.MONTH) + 1;
// '+ 1' because calendar is 0-based for this field, and we are
// 1-based
t = -1;
int tmon = mon;
// get day...................................................
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
st = daysOfMonth.tailSet(Integer.valueOf(day));
if (lastdayOfMonth) {
if(!nearestWeekday) {
t = day;
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
day -= lastdayOffset;
} else {
t = day;
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
day -= lastdayOffset;
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0);
tcal.set(Calendar.MINUTE, 0);
tcal.set(Calendar.HOUR_OF_DAY, 0);
tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1);
tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR));
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) {
day += 2;
} else if(dow == Calendar.SATURDAY) {
day -= 1;
} else if(dow == Calendar.SUNDAY && day == ldom) {
day -= 2;
} else if(dow == Calendar.SUNDAY) {
day += 1;
}
tcal.set(Calendar.SECOND, sec);
tcal.set(Calendar.MINUTE, min);
tcal.set(Calendar.HOUR_OF_DAY, hr);
tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1);
Date nTime = tcal.getTime();
if(nTime.before(afterTime)) {
day = 1;
mon++;
}
}
} else if(nearestWeekday) {
t = day;
day = ((Integer) daysOfMonth.first()).intValue();
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0);
tcal.set(Calendar.MINUTE, 0);
tcal.set(Calendar.HOUR_OF_DAY, 0);
tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1);
tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR));
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) {
day += 2;
} else if(dow == Calendar.SATURDAY) {
day -= 1;
} else if(dow == Calendar.SUNDAY && day == ldom) {
day -= 2;
} else if(dow == Calendar.SUNDAY) {
day += 1;
}
tcal.set(Calendar.SECOND, sec);
tcal.set(Calendar.MINUTE, min);
tcal.set(Calendar.HOUR_OF_DAY, hr);
tcal.set(Calendar.DAY_OF_MONTH, day);
tcal.set(Calendar.MONTH, mon - 1);
Date nTime = tcal.getTime();
if(nTime.before(afterTime)) {
day = ((Integer) daysOfMonth.first()).intValue();
mon++;
}
} else if (st != null && st.size() != 0) {
t = day;
day = st.first().intValue();
// make sure we don't over-run a short month, such as february
int lastDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day > lastDay) {
day = ((Integer) daysOfMonth.first()).intValue();
mon++;
}
} else {
day = ((Integer) daysOfMonth.first()).intValue();
mon++;
}
if (day != t || mon != tmon) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, day);
cl.set(Calendar.MONTH, mon - 1);
// '- 1' because calendar is 0-based for this field, and we
// are 1-based
continue;
}
} else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
if (lastdayOfWeek) { // are we looking for the last XXX day of
// the month?
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow;
}
if (cDow > dow) {
daysToAdd = dow + (7 - cDow);
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // did we already miss the
// last one?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, 1);
cl.set(Calendar.MONTH, mon);
// no '- 1' here because we are promoting the month
continue;
}
// find date of last occurrence of this day in this month...
while ((day + daysToAdd + 7) <= lDay) {
daysToAdd += 7;
}
day += daysToAdd;
if (daysToAdd > 0) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, day);
cl.set(Calendar.MONTH, mon - 1);
// '- 1' here because we are not promoting the month
continue;
}
} else if (nthdayOfWeek != 0) {
// are we looking for the Nth XXX day in the month?
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow;
} else if (cDow > dow) {
daysToAdd = dow + (7 - cDow);
}
boolean dayShifted = false;
if (daysToAdd > 0) {
dayShifted = true;
}
day += daysToAdd;
int weekOfMonth = day / 7;
if (day % 7 > 0) {
weekOfMonth++;
}
daysToAdd = (nthdayOfWeek - weekOfMonth) * 7;
day += daysToAdd;
if (daysToAdd < 0
|| day > getLastDayOfMonth(mon, cl
.get(Calendar.YEAR))) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, 1);
cl.set(Calendar.MONTH, mon);
// no '- 1' here because we are promoting the month
continue;
} else if (daysToAdd > 0 || dayShifted) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, day);
cl.set(Calendar.MONTH, mon - 1);
// '- 1' here because we are NOT promoting the month
continue;
}
} else {
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
st = daysOfWeek.tailSet(Integer.valueOf(cDow));
if (st != null && st.size() > 0) {
dow = st.first().intValue();
}
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow;
}
if (cDow > dow) {
daysToAdd = dow + (7 - cDow);
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // will we pass the end of
// the month?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, 1);
cl.set(Calendar.MONTH, mon);
// no '- 1' here because we are promoting the month
continue;
} else if (daysToAdd > 0) { // are we swithing days?
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, day + daysToAdd);
cl.set(Calendar.MONTH, mon - 1);
// '- 1' because calendar is 0-based for this field,
// and we are 1-based
continue;
}
}
} else { // dayOfWSpec && !dayOfMSpec
throw new UnsupportedOperationException(
"Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.");
// TODO:
}
cl.set(Calendar.DAY_OF_MONTH, day);
mon = cl.get(Calendar.MONTH) + 1;
// '+ 1' because calendar is 0-based for this field, and we are
// 1-based
int year = cl.get(Calendar.YEAR);
t = -1;
// test for expressions that never generate a valid fire date,
// but keep looping...
if (year > MAX_YEAR) {
return null;
}
// get month...................................................
st = months.tailSet(Integer.valueOf(mon));
if (st != null && st.size() != 0) {
t = mon;
mon = st.first().intValue();
} else {
mon = months.first().intValue();
year++;
}
if (mon != t) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, 1);
cl.set(Calendar.MONTH, mon - 1);
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
cl.set(Calendar.YEAR, year);
continue;
}
cl.set(Calendar.MONTH, mon - 1);
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
year = cl.get(Calendar.YEAR);
t = -1;
// get year...................................................
st = years.tailSet(Integer.valueOf(year));
if (st != null && st.size() != 0) {
t = year;
year = st.first().intValue();
} else {
return null; // ran out of years...
}
if (year != t) {
cl.set(Calendar.SECOND, 0);
cl.set(Calendar.MINUTE, 0);
cl.set(Calendar.HOUR_OF_DAY, 0);
cl.set(Calendar.DAY_OF_MONTH, 1);
cl.set(Calendar.MONTH, 0);
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
cl.set(Calendar.YEAR, year);
continue;
}
cl.set(Calendar.YEAR, year);
gotOne = true;
} // while( !done )
return cl.getTime();
} } | public class class_name {
public Date getTimeAfter(Date afterTime) {
// Computation is based on Gregorian year only.
Calendar cl = new java.util.GregorianCalendar(getTimeZone());
// move ahead one second, since we're computing the time *after* the
// given time
afterTime = new Date(afterTime.getTime() + 1000);
// CronTrigger does not deal with milliseconds
cl.setTime(afterTime);
cl.set(Calendar.MILLISECOND, 0);
boolean gotOne = false;
// loop until we've computed the next time, or we've past the endTime
while (!gotOne) {
//if (endTime != null && cl.getTime().after(endTime)) return null;
if(cl.get(Calendar.YEAR) > 2999) { // prevent endless loop...
return null; // depends on control dependency: [if], data = [none]
}
SortedSet<Integer> st = null;
int t = 0;
int sec = cl.get(Calendar.SECOND);
int min = cl.get(Calendar.MINUTE);
// get second.................................................
st = seconds.tailSet(Integer.valueOf(sec)); // depends on control dependency: [while], data = [none]
if (st != null && st.size() != 0) {
sec = st.first().intValue(); // depends on control dependency: [if], data = [none]
} else {
sec = seconds.first().intValue(); // depends on control dependency: [if], data = [none]
min++; // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, min); // depends on control dependency: [if], data = [none]
}
cl.set(Calendar.SECOND, sec); // depends on control dependency: [while], data = [none]
min = cl.get(Calendar.MINUTE); // depends on control dependency: [while], data = [none]
int hr = cl.get(Calendar.HOUR_OF_DAY);
t = -1; // depends on control dependency: [while], data = [none]
// get minute.................................................
st = minutes.tailSet(Integer.valueOf(min)); // depends on control dependency: [while], data = [none]
if (st != null && st.size() != 0) {
t = min; // depends on control dependency: [if], data = [none]
min = st.first().intValue(); // depends on control dependency: [if], data = [none]
} else {
min = minutes.first().intValue(); // depends on control dependency: [if], data = [none]
hr++; // depends on control dependency: [if], data = [none]
}
if (min != t) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, min); // depends on control dependency: [if], data = [none]
setCalendarHour(cl, hr); // depends on control dependency: [if], data = [none]
continue;
}
cl.set(Calendar.MINUTE, min); // depends on control dependency: [while], data = [none]
hr = cl.get(Calendar.HOUR_OF_DAY); // depends on control dependency: [while], data = [none]
int day = cl.get(Calendar.DAY_OF_MONTH);
t = -1; // depends on control dependency: [while], data = [none]
// get hour...................................................
st = hours.tailSet(Integer.valueOf(hr)); // depends on control dependency: [while], data = [none]
if (st != null && st.size() != 0) {
t = hr; // depends on control dependency: [if], data = [none]
hr = st.first().intValue(); // depends on control dependency: [if], data = [none]
} else {
hr = hours.first().intValue(); // depends on control dependency: [if], data = [none]
day++; // depends on control dependency: [if], data = [none]
}
if (hr != t) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
setCalendarHour(cl, hr); // depends on control dependency: [if], data = [none]
continue;
}
cl.set(Calendar.HOUR_OF_DAY, hr); // depends on control dependency: [while], data = [none]
day = cl.get(Calendar.DAY_OF_MONTH); // depends on control dependency: [while], data = [none]
int mon = cl.get(Calendar.MONTH) + 1;
// '+ 1' because calendar is 0-based for this field, and we are
// 1-based
t = -1; // depends on control dependency: [while], data = [none]
int tmon = mon;
// get day...................................................
boolean dayOfMSpec = !daysOfMonth.contains(NO_SPEC);
boolean dayOfWSpec = !daysOfWeek.contains(NO_SPEC);
if (dayOfMSpec && !dayOfWSpec) { // get day by day of month rule
st = daysOfMonth.tailSet(Integer.valueOf(day)); // depends on control dependency: [if], data = [none]
if (lastdayOfMonth) {
if(!nearestWeekday) {
t = day; // depends on control dependency: [if], data = [none]
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); // depends on control dependency: [if], data = [none]
day -= lastdayOffset; // depends on control dependency: [if], data = [none]
} else {
t = day; // depends on control dependency: [if], data = [none]
day = getLastDayOfMonth(mon, cl.get(Calendar.YEAR)); // depends on control dependency: [if], data = [none]
day -= lastdayOffset; // depends on control dependency: [if], data = [none]
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR)); // depends on control dependency: [if], data = [none]
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) {
day += 2; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SATURDAY) {
day -= 1; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SUNDAY && day == ldom) {
day -= 2; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SUNDAY) {
day += 1; // depends on control dependency: [if], data = [none]
}
tcal.set(Calendar.SECOND, sec); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MINUTE, min); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.HOUR_OF_DAY, hr); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
Date nTime = tcal.getTime();
if(nTime.before(afterTime)) {
day = 1; // depends on control dependency: [if], data = [none]
mon++; // depends on control dependency: [if], data = [none]
}
}
} else if(nearestWeekday) {
t = day; // depends on control dependency: [if], data = [none]
day = ((Integer) daysOfMonth.first()).intValue(); // depends on control dependency: [if], data = [none]
java.util.Calendar tcal = java.util.Calendar.getInstance(getTimeZone());
tcal.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.YEAR, cl.get(Calendar.YEAR)); // depends on control dependency: [if], data = [none]
int ldom = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
int dow = tcal.get(Calendar.DAY_OF_WEEK);
if(dow == Calendar.SATURDAY && day == 1) {
day += 2; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SATURDAY) {
day -= 1; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SUNDAY && day == ldom) {
day -= 2; // depends on control dependency: [if], data = [none]
} else if(dow == Calendar.SUNDAY) {
day += 1; // depends on control dependency: [if], data = [none]
}
tcal.set(Calendar.SECOND, sec); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MINUTE, min); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.HOUR_OF_DAY, hr); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
tcal.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
Date nTime = tcal.getTime();
if(nTime.before(afterTime)) {
day = ((Integer) daysOfMonth.first()).intValue(); // depends on control dependency: [if], data = [none]
mon++; // depends on control dependency: [if], data = [none]
}
} else if (st != null && st.size() != 0) {
t = day; // depends on control dependency: [if], data = [none]
day = st.first().intValue(); // depends on control dependency: [if], data = [none]
// make sure we don't over-run a short month, such as february
int lastDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day > lastDay) {
day = ((Integer) daysOfMonth.first()).intValue(); // depends on control dependency: [if], data = [none]
mon++; // depends on control dependency: [if], data = [none]
}
} else {
day = ((Integer) daysOfMonth.first()).intValue(); // depends on control dependency: [if], data = [none]
mon++; // depends on control dependency: [if], data = [none]
}
if (day != t || mon != tmon) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
// '- 1' because calendar is 0-based for this field, and we
// are 1-based
continue;
}
} else if (dayOfWSpec && !dayOfMSpec) { // get day by day of week rule
if (lastdayOfWeek) { // are we looking for the last XXX day of
// the month?
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow; // depends on control dependency: [if], data = [none]
}
if (cDow > dow) {
daysToAdd = dow + (7 - cDow); // depends on control dependency: [if], data = [none]
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // did we already miss the
// last one?
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, 1); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon); // depends on control dependency: [if], data = [none]
// no '- 1' here because we are promoting the month
continue;
}
// find date of last occurrence of this day in this month...
while ((day + daysToAdd + 7) <= lDay) {
daysToAdd += 7; // depends on control dependency: [while], data = [none]
}
day += daysToAdd; // depends on control dependency: [if], data = [none]
if (daysToAdd > 0) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
// '- 1' here because we are not promoting the month
continue;
}
} else if (nthdayOfWeek != 0) {
// are we looking for the Nth XXX day in the month?
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow; // depends on control dependency: [if], data = [none]
} else if (cDow > dow) {
daysToAdd = dow + (7 - cDow); // depends on control dependency: [if], data = [none]
}
boolean dayShifted = false;
if (daysToAdd > 0) {
dayShifted = true; // depends on control dependency: [if], data = [none]
}
day += daysToAdd; // depends on control dependency: [if], data = [none]
int weekOfMonth = day / 7;
if (day % 7 > 0) {
weekOfMonth++; // depends on control dependency: [if], data = [none]
}
daysToAdd = (nthdayOfWeek - weekOfMonth) * 7; // depends on control dependency: [if], data = [(nthdayOfWeek]
day += daysToAdd; // depends on control dependency: [if], data = [none]
if (daysToAdd < 0
|| day > getLastDayOfMonth(mon, cl
.get(Calendar.YEAR))) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [0]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [0]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [0]
cl.set(Calendar.DAY_OF_MONTH, 1); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon); // depends on control dependency: [if], data = [none]
// no '- 1' here because we are promoting the month
continue;
} else if (daysToAdd > 0 || dayShifted) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
// '- 1' here because we are NOT promoting the month
continue;
}
} else {
int cDow = cl.get(Calendar.DAY_OF_WEEK); // current d-o-w
int dow = ((Integer) daysOfWeek.first()).intValue(); // desired
// d-o-w
st = daysOfWeek.tailSet(Integer.valueOf(cDow)); // depends on control dependency: [if], data = [none]
if (st != null && st.size() > 0) {
dow = st.first().intValue(); // depends on control dependency: [if], data = [none]
}
int daysToAdd = 0;
if (cDow < dow) {
daysToAdd = dow - cDow; // depends on control dependency: [if], data = [none]
}
if (cDow > dow) {
daysToAdd = dow + (7 - cDow); // depends on control dependency: [if], data = [none]
}
int lDay = getLastDayOfMonth(mon, cl.get(Calendar.YEAR));
if (day + daysToAdd > lDay) { // will we pass the end of
// the month?
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, 1); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon); // depends on control dependency: [if], data = [none]
// no '- 1' here because we are promoting the month
continue;
} else if (daysToAdd > 0) { // are we swithing days?
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [0)]
cl.set(Calendar.DAY_OF_MONTH, day + daysToAdd); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
// '- 1' because calendar is 0-based for this field,
// and we are 1-based
continue;
}
}
} else { // dayOfWSpec && !dayOfMSpec
throw new UnsupportedOperationException(
"Support for specifying both a day-of-week AND a day-of-month parameter is not implemented.");
// TODO:
}
cl.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [while], data = [none]
mon = cl.get(Calendar.MONTH) + 1; // depends on control dependency: [while], data = [none]
// '+ 1' because calendar is 0-based for this field, and we are
// 1-based
int year = cl.get(Calendar.YEAR);
t = -1; // depends on control dependency: [while], data = [none]
// test for expressions that never generate a valid fire date,
// but keep looping...
if (year > MAX_YEAR) {
return null; // depends on control dependency: [if], data = [none]
}
// get month...................................................
st = months.tailSet(Integer.valueOf(mon)); // depends on control dependency: [while], data = [none]
if (st != null && st.size() != 0) {
t = mon; // depends on control dependency: [if], data = [none]
mon = st.first().intValue(); // depends on control dependency: [if], data = [none]
} else {
mon = months.first().intValue(); // depends on control dependency: [if], data = [none]
year++; // depends on control dependency: [if], data = [none]
}
if (mon != t) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, 1); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [if], data = [none]
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
cl.set(Calendar.YEAR, year); // depends on control dependency: [if], data = [none]
continue;
}
cl.set(Calendar.MONTH, mon - 1); // depends on control dependency: [while], data = [none]
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
year = cl.get(Calendar.YEAR); // depends on control dependency: [while], data = [none]
t = -1; // depends on control dependency: [while], data = [none]
// get year...................................................
st = years.tailSet(Integer.valueOf(year)); // depends on control dependency: [while], data = [none]
if (st != null && st.size() != 0) {
t = year; // depends on control dependency: [if], data = [none]
year = st.first().intValue(); // depends on control dependency: [if], data = [none]
} else {
return null; // ran out of years... // depends on control dependency: [if], data = [none]
}
if (year != t) {
cl.set(Calendar.SECOND, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MINUTE, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.HOUR_OF_DAY, 0); // depends on control dependency: [if], data = [none]
cl.set(Calendar.DAY_OF_MONTH, 1); // depends on control dependency: [if], data = [none]
cl.set(Calendar.MONTH, 0); // depends on control dependency: [if], data = [none]
// '- 1' because calendar is 0-based for this field, and we are
// 1-based
cl.set(Calendar.YEAR, year); // depends on control dependency: [if], data = [none]
continue;
}
cl.set(Calendar.YEAR, year); // depends on control dependency: [while], data = [none]
gotOne = true; // depends on control dependency: [while], data = [none]
} // while( !done )
return cl.getTime();
} } |
public class class_name {
public List<C> findAllChildren() {
List<String> objects = getChildrenList();
List<C> children = new ArrayList<C>();
try {
Model dummy = (Model) childClazz.newInstance();
dummy.setContext(context);
for (String id : objects) {
children.add((C) dummy.find(id));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
return children;
} } | public class class_name {
public List<C> findAllChildren() {
List<String> objects = getChildrenList();
List<C> children = new ArrayList<C>();
try {
Model dummy = (Model) childClazz.newInstance();
dummy.setContext(context); // depends on control dependency: [try], data = [none]
for (String id : objects) {
children.add((C) dummy.find(id)); // depends on control dependency: [for], data = [id]
}
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return children;
} } |
public class class_name {
public final void byte_key() throws RecognitionException {
Token id=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:768:5: ({...}? =>id= ID )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:768:12: {...}? =>id= ID
{
if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))) ) {
if (state.backtracking>0) {state.failed=true; return;}
throw new FailedPredicateException(input, "byte_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.BYTE))");
}
id=(Token)match(input,ID,FOLLOW_ID_in_byte_key4882); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); }
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void byte_key() throws RecognitionException {
Token id=null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:768:5: ({...}? =>id= ID )
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:768:12: {...}? =>id= ID
{
if ( !(((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))) ) {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
throw new FailedPredicateException(input, "byte_key", "(helper.validateIdentifierKey(DroolsSoftKeywords.BYTE))");
}
id=(Token)match(input,ID,FOLLOW_ID_in_byte_key4882); if (state.failed) return;
if ( state.backtracking==0 ) { helper.emit(id, DroolsEditorType.KEYWORD); } // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
public void removeServiceInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) {
ServiceInstanceUtils.validateServiceName(serviceName);
if (listener == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"ServiceInstanceChangeListener");
}
List<InstanceChangeListener<ModelServiceInstance>> list = changeListenerMap.get(serviceName);
if (list != null) {
boolean found = false;
for (InstanceChangeListener<ModelServiceInstance> l : list) {
if (l instanceof ServiceInstanceChangeListenerAdapter
&& ((ServiceInstanceChangeListenerAdapter) l).getAdapter() == listener) {
list.remove(l);
found = true;
break;
}
}
if (!found) {
LOGGER.error(ErrorCode.SERVICE_INSTANCE_LISTENER_DOES_NOT_EXIST.getMessageTemplate());
}
if (list.isEmpty()) {
changeListenerMap.remove(serviceName);
}
} else {
LOGGER.error(String.format(ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(), serviceName));
}
} } | public class class_name {
public void removeServiceInstanceChangeListener(String serviceName, ServiceInstanceChangeListener listener) {
ServiceInstanceUtils.validateServiceName(serviceName);
if (listener == null) {
throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR,
ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(),
"ServiceInstanceChangeListener");
}
List<InstanceChangeListener<ModelServiceInstance>> list = changeListenerMap.get(serviceName);
if (list != null) {
boolean found = false;
for (InstanceChangeListener<ModelServiceInstance> l : list) {
if (l instanceof ServiceInstanceChangeListenerAdapter
&& ((ServiceInstanceChangeListenerAdapter) l).getAdapter() == listener) {
list.remove(l); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
LOGGER.error(ErrorCode.SERVICE_INSTANCE_LISTENER_DOES_NOT_EXIST.getMessageTemplate()); // depends on control dependency: [if], data = [none]
}
if (list.isEmpty()) {
changeListenerMap.remove(serviceName); // depends on control dependency: [if], data = [none]
}
} else {
LOGGER.error(String.format(ErrorCode.SERVICE_DOES_NOT_EXIST.getMessageTemplate(), serviceName)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ClusterNode getRunnableNode(RequestedNode requestedNode,
LocalityLevel maxLevel,
ResourceType type,
Set<String> excluded) {
ClusterNode node = null;
RunnableIndices r = typeToIndices.get(type);
// find host local
node = r.getRunnableNodeForHost(requestedNode);
if (maxLevel == LocalityLevel.NODE || node != null) {
return node;
}
node = r.getRunnableNodeForRack(requestedNode, excluded);
if (maxLevel == LocalityLevel.RACK || node != null) {
return node;
}
// find any node
node = r.getRunnableNodeForAny(excluded);
return node;
} } | public class class_name {
public ClusterNode getRunnableNode(RequestedNode requestedNode,
LocalityLevel maxLevel,
ResourceType type,
Set<String> excluded) {
ClusterNode node = null;
RunnableIndices r = typeToIndices.get(type);
// find host local
node = r.getRunnableNodeForHost(requestedNode);
if (maxLevel == LocalityLevel.NODE || node != null) {
return node; // depends on control dependency: [if], data = [none]
}
node = r.getRunnableNodeForRack(requestedNode, excluded);
if (maxLevel == LocalityLevel.RACK || node != null) {
return node; // depends on control dependency: [if], data = [none]
}
// find any node
node = r.getRunnableNodeForAny(excluded);
return node;
} } |
public class class_name {
private String getProcShortName() {
// could later be extended to some sort of fake numeric PID, e.g. "mysqld-1", from a static
// Map<String execName, Integer id)
if (procShortName == null) {
File exec = getExecutableFile();
procShortName = exec.getName();
}
return procShortName;
} } | public class class_name {
private String getProcShortName() {
// could later be extended to some sort of fake numeric PID, e.g. "mysqld-1", from a static
// Map<String execName, Integer id)
if (procShortName == null) {
File exec = getExecutableFile();
procShortName = exec.getName(); // depends on control dependency: [if], data = [none]
}
return procShortName;
} } |
public class class_name {
public List<Post> selectPosts(final EnumSet<Post.Type> types,
final Post.Status status,
final Post.Sort sort,
final Paging paging,
final boolean withResolve) throws SQLException {
if(paging.limit < 1 || paging.start < 0) {
return ImmutableList.of();
}
List<Post.Builder> builders = Lists.newArrayListWithExpectedSize(paging.limit < 1024 ? paging.limit : 1024);
StringBuilder sql = new StringBuilder(selectPostSQL);
sql.append(postsTableName);
sql.append(" WHERE post_status=?");
appendPostTypes(types, sql);
appendPagingSortSQL(sql, sort, paging);
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Timer.Context ctx = metrics.selectPostsTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(sql.toString());
stmt.setString(1, status.toString().toLowerCase());
if(paging.interval != null) {
stmt.setTimestamp(2, new Timestamp(paging.interval.getStartMillis()));
stmt.setTimestamp(3, new Timestamp(paging.interval.getEndMillis()));
stmt.setInt(4, paging.start);
stmt.setInt(5, paging.limit);
} else {
stmt.setInt(2, paging.start);
stmt.setInt(3, paging.limit);
}
rs = stmt.executeQuery();
while(rs.next()) {
builders.add(postFromResultSet(rs));
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
List<Post> posts = Lists.newArrayListWithExpectedSize(builders.size());
for(Post.Builder builder : builders) {
if(withResolve) {
posts.add(resolve(builder).build());
} else {
posts.add(builder.build());
}
}
return posts;
} } | public class class_name {
public List<Post> selectPosts(final EnumSet<Post.Type> types,
final Post.Status status,
final Post.Sort sort,
final Paging paging,
final boolean withResolve) throws SQLException {
if(paging.limit < 1 || paging.start < 0) {
return ImmutableList.of();
}
List<Post.Builder> builders = Lists.newArrayListWithExpectedSize(paging.limit < 1024 ? paging.limit : 1024);
StringBuilder sql = new StringBuilder(selectPostSQL);
sql.append(postsTableName);
sql.append(" WHERE post_status=?");
appendPostTypes(types, sql);
appendPagingSortSQL(sql, sort, paging);
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
Timer.Context ctx = metrics.selectPostsTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(sql.toString());
stmt.setString(1, status.toString().toLowerCase());
if(paging.interval != null) {
stmt.setTimestamp(2, new Timestamp(paging.interval.getStartMillis())); // depends on control dependency: [if], data = [(paging.interval]
stmt.setTimestamp(3, new Timestamp(paging.interval.getEndMillis())); // depends on control dependency: [if], data = [(paging.interval]
stmt.setInt(4, paging.start); // depends on control dependency: [if], data = [none]
stmt.setInt(5, paging.limit); // depends on control dependency: [if], data = [none]
} else {
stmt.setInt(2, paging.start); // depends on control dependency: [if], data = [none]
stmt.setInt(3, paging.limit); // depends on control dependency: [if], data = [none]
}
rs = stmt.executeQuery();
while(rs.next()) {
builders.add(postFromResultSet(rs)); // depends on control dependency: [while], data = [none]
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
List<Post> posts = Lists.newArrayListWithExpectedSize(builders.size());
for(Post.Builder builder : builders) {
if(withResolve) {
posts.add(resolve(builder).build()); // depends on control dependency: [if], data = [none]
} else {
posts.add(builder.build()); // depends on control dependency: [if], data = [none]
}
}
return posts;
} } |
public class class_name {
public void setResourceAdaptorContext(ResourceAdaptorContext raContext) {
this.raContext = raContext;
this.tracer = raContext.getTracer(getClass().getSimpleName());
this.sleeEndpoint = (SleeEndpoint) raContext.getSleeEndpoint();
this.eventLookupFacility = raContext.getEventLookupFacility();
this.providerWrapper = new SleeSipProviderImpl(this);
try {
this.defaultUsageParameters =
(SipResourceAdaptorStatisticsUsageParameters) raContext.getDefaultUsageParameterSet();
} catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public void setResourceAdaptorContext(ResourceAdaptorContext raContext) {
this.raContext = raContext;
this.tracer = raContext.getTracer(getClass().getSimpleName());
this.sleeEndpoint = (SleeEndpoint) raContext.getSleeEndpoint();
this.eventLookupFacility = raContext.getEventLookupFacility();
this.providerWrapper = new SleeSipProviderImpl(this);
try {
this.defaultUsageParameters =
(SipResourceAdaptorStatisticsUsageParameters) raContext.getDefaultUsageParameterSet(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob)
{
//get template name
String templateName=templateNameEnum.toString();
//get template
String template=this.getTemplate(templateName);
String command=null;
if(template!=null)
{
//format template
command=this.formatTemplate(template,faxJob);
}
return command;
} } | public class class_name {
protected String createProcessCommand(Enum<?> templateNameEnum,FaxJob faxJob)
{
//get template name
String templateName=templateNameEnum.toString();
//get template
String template=this.getTemplate(templateName);
String command=null;
if(template!=null)
{
//format template
command=this.formatTemplate(template,faxJob); // depends on control dependency: [if], data = [(template]
}
return command;
} } |
public class class_name {
public Node selectFirst(final String query) {
List<Node> selectedNodes = select(query);
if (selectedNodes.isEmpty()) {
return null;
}
return selectedNodes.get(0);
} } | public class class_name {
public Node selectFirst(final String query) {
List<Node> selectedNodes = select(query);
if (selectedNodes.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return selectedNodes.get(0);
} } |
public class class_name {
public int getBytesBigEndian(int i, int j) {
int result = 0;
for (int k = i; k < i + j; k++) {
result += value.get(k).toUint();
if (k + 1 < i + j)
result <<= 8;
}
return result;
} } | public class class_name {
public int getBytesBigEndian(int i, int j) {
int result = 0;
for (int k = i; k < i + j; k++) {
result += value.get(k).toUint(); // depends on control dependency: [for], data = [k]
if (k + 1 < i + j)
result <<= 8;
}
return result;
} } |
public class class_name {
public void showGridInfo(boolean printGrids) {
List gridList = gridIndex.getGridRecords();
System.out.println("\nGRID FILE: " + getFilename() + "\n");
printNavBlock();
System.out.println("");
printAnalBlock();
System.out.println("\nNumber of grids in file: " + gridList.size());
System.out.println("\nMaximum number of grids in file: " + dmLabel.kcol);
System.out.println("");
if (printGrids) {
printGrids();
}
} } | public class class_name {
public void showGridInfo(boolean printGrids) {
List gridList = gridIndex.getGridRecords();
System.out.println("\nGRID FILE: " + getFilename() + "\n");
printNavBlock();
System.out.println("");
printAnalBlock();
System.out.println("\nNumber of grids in file: " + gridList.size());
System.out.println("\nMaximum number of grids in file: " + dmLabel.kcol);
System.out.println("");
if (printGrids) {
printGrids(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Object getApiValue(Value value) {
if (value instanceof BooleanValue) {
return ((BooleanValue) value).getValue();
} else if (value instanceof NumberValue) {
if (Strings.isNullOrEmpty(((NumberValue) value).getValue())) {
return null;
} else {
try {
return NumberFormat.getInstance().parse(((NumberValue) value).getValue());
} catch (ParseException e) {
throw new IllegalStateException(
"Received invalid number format from API: " + ((NumberValue) value).getValue());
}
}
} else if (value instanceof TextValue) {
return ((TextValue) value).getValue();
} else if (value instanceof DateTimeValue) {
return ((DateTimeValue) value).getValue();
} else if (value instanceof DateValue) {
return ((DateValue) value).getValue();
} else if (value instanceof TargetingValue) {
return ((TargetingValue) value).getValue();
} else if (value instanceof SetValue) {
Value[] setValues = ((SetValue) value).getValues();
Set<Object> apiValue = new LinkedHashSet<Object>();
if (setValues != null) {
for (Value setValue : setValues) {
validateSetValueEntryForSet(getApiValue(setValue), apiValue);
apiValue.add(getApiValue(setValue));
}
}
return apiValue;
} else {
throw new IllegalArgumentException("Unsupported Value type [" + value.getClass() + "]");
}
} } | public class class_name {
public static Object getApiValue(Value value) {
if (value instanceof BooleanValue) {
return ((BooleanValue) value).getValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof NumberValue) {
if (Strings.isNullOrEmpty(((NumberValue) value).getValue())) {
return null; // depends on control dependency: [if], data = [none]
} else {
try {
return NumberFormat.getInstance().parse(((NumberValue) value).getValue()); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
throw new IllegalStateException(
"Received invalid number format from API: " + ((NumberValue) value).getValue());
} // depends on control dependency: [catch], data = [none]
}
} else if (value instanceof TextValue) {
return ((TextValue) value).getValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof DateTimeValue) {
return ((DateTimeValue) value).getValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof DateValue) {
return ((DateValue) value).getValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof TargetingValue) {
return ((TargetingValue) value).getValue(); // depends on control dependency: [if], data = [none]
} else if (value instanceof SetValue) {
Value[] setValues = ((SetValue) value).getValues();
Set<Object> apiValue = new LinkedHashSet<Object>();
if (setValues != null) {
for (Value setValue : setValues) {
validateSetValueEntryForSet(getApiValue(setValue), apiValue); // depends on control dependency: [for], data = [setValue]
apiValue.add(getApiValue(setValue)); // depends on control dependency: [for], data = [setValue]
}
}
return apiValue; // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unsupported Value type [" + value.getClass() + "]");
}
} } |
public class class_name {
private LinkedHashMap<String, String> getSortList(boolean includeType) {
LinkedHashMap<String, String> list = new LinkedHashMap<String, String>();
list.put(SortParams.title_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TITLE_ASC_0));
list.put(SortParams.title_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TITLE_DECS_0));
list.put(
SortParams.dateLastModified_asc.name(),
Messages.get().key(Messages.GUI_SORT_LABEL_DATELASTMODIFIED_ASC_0));
list.put(
SortParams.dateLastModified_desc.name(),
Messages.get().key(Messages.GUI_SORT_LABEL_DATELASTMODIFIED_DESC_0));
list.put(SortParams.path_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_PATH_ASC_0));
list.put(SortParams.path_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_PATH_DESC_0));
if (includeType) {
list.put(SortParams.type_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TYPE_ASC_0));
list.put(SortParams.type_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TYPE_DESC_0));
}
return list;
} } | public class class_name {
private LinkedHashMap<String, String> getSortList(boolean includeType) {
LinkedHashMap<String, String> list = new LinkedHashMap<String, String>();
list.put(SortParams.title_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TITLE_ASC_0));
list.put(SortParams.title_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TITLE_DECS_0));
list.put(
SortParams.dateLastModified_asc.name(),
Messages.get().key(Messages.GUI_SORT_LABEL_DATELASTMODIFIED_ASC_0));
list.put(
SortParams.dateLastModified_desc.name(),
Messages.get().key(Messages.GUI_SORT_LABEL_DATELASTMODIFIED_DESC_0));
list.put(SortParams.path_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_PATH_ASC_0));
list.put(SortParams.path_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_PATH_DESC_0));
if (includeType) {
list.put(SortParams.type_asc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TYPE_ASC_0)); // depends on control dependency: [if], data = [none]
list.put(SortParams.type_desc.name(), Messages.get().key(Messages.GUI_SORT_LABEL_TYPE_DESC_0)); // depends on control dependency: [if], data = [none]
}
return list;
} } |
public class class_name {
@Override
public final OperationEntry getOperationEntry(final PathAddress pathAddress, final String operationName) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getOperationEntry(ri.pathAddress.append(pathAddress), operationName);
}
// else we are the root
OperationEntry inheritable = getInheritableOperationEntry(operationName);
return getOperationEntry(pathAddress.iterator(), operationName, inheritable);
} } | public class class_name {
@Override
public final OperationEntry getOperationEntry(final PathAddress pathAddress, final String operationName) {
if (parent != null) {
RootInvocation ri = getRootInvocation();
return ri.root.getOperationEntry(ri.pathAddress.append(pathAddress), operationName); // depends on control dependency: [if], data = [none]
}
// else we are the root
OperationEntry inheritable = getInheritableOperationEntry(operationName);
return getOperationEntry(pathAddress.iterator(), operationName, inheritable);
} } |
public class class_name {
public void marshall(CreateRobotApplicationVersionRequest createRobotApplicationVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (createRobotApplicationVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createRobotApplicationVersionRequest.getApplication(), APPLICATION_BINDING);
protocolMarshaller.marshall(createRobotApplicationVersionRequest.getCurrentRevisionId(), CURRENTREVISIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateRobotApplicationVersionRequest createRobotApplicationVersionRequest, ProtocolMarshaller protocolMarshaller) {
if (createRobotApplicationVersionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createRobotApplicationVersionRequest.getApplication(), APPLICATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createRobotApplicationVersionRequest.getCurrentRevisionId(), CURRENTREVISIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean matchesBrowser(String currentBrowser) {
if (currentBrowser == null) {
return false;
}
for (int i = 0; i < getBrowserPattern().size(); i++) {
boolean matches = getBrowserPattern().get(i).matcher(currentBrowser.trim()).matches();
if (matches) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_BROWSER_MATCHES_CONFIG_1, currentBrowser));
}
return true;
}
}
return false;
} } | public class class_name {
public boolean matchesBrowser(String currentBrowser) {
if (currentBrowser == null) {
return false; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < getBrowserPattern().size(); i++) {
boolean matches = getBrowserPattern().get(i).matcher(currentBrowser.trim()).matches();
if (matches) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_BROWSER_MATCHES_CONFIG_1, currentBrowser)); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void addDecomposes(IfcObjectDefinition parent, IfcObjectDefinition... children) throws IfcModelInterfaceException {
IfcRelAggregates ifcRelAggregates = this.create(IfcRelAggregates.class);
ifcRelAggregates.setRelatingObject(parent);
for (IfcObjectDefinition child: children) {
ifcRelAggregates.getRelatedObjects().add(child);
}
} } | public class class_name {
public void addDecomposes(IfcObjectDefinition parent, IfcObjectDefinition... children) throws IfcModelInterfaceException {
IfcRelAggregates ifcRelAggregates = this.create(IfcRelAggregates.class);
ifcRelAggregates.setRelatingObject(parent);
for (IfcObjectDefinition child: children) {
ifcRelAggregates.getRelatedObjects().add(child);
// depends on control dependency: [for], data = [child]
}
} } |
public class class_name {
public void marshall(DeveloperInfo developerInfo, ProtocolMarshaller protocolMarshaller) {
if (developerInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(developerInfo.getDeveloperName(), DEVELOPERNAME_BINDING);
protocolMarshaller.marshall(developerInfo.getPrivacyPolicy(), PRIVACYPOLICY_BINDING);
protocolMarshaller.marshall(developerInfo.getEmail(), EMAIL_BINDING);
protocolMarshaller.marshall(developerInfo.getUrl(), URL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeveloperInfo developerInfo, ProtocolMarshaller protocolMarshaller) {
if (developerInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(developerInfo.getDeveloperName(), DEVELOPERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(developerInfo.getPrivacyPolicy(), PRIVACYPOLICY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(developerInfo.getEmail(), EMAIL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(developerInfo.getUrl(), URL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void prepareRequestServerErrorHandlingIfApi(ActionRuntime runtime, ActionResponseReflector reflector) {
if (runtime.isApiExecute()) {
registerServerErrorHandler(runtime, reflector);
}
} } | public class class_name {
public void prepareRequestServerErrorHandlingIfApi(ActionRuntime runtime, ActionResponseReflector reflector) {
if (runtime.isApiExecute()) {
registerServerErrorHandler(runtime, reflector); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static IdRange parseRange(String range) {
int pos = range.indexOf(':');
try {
if (pos == -1) {
long value = parseLong(range);
return new IdRange(value);
} else {
long lowVal = parseLong(range.substring(0, pos));
long highVal = parseLong(range.substring(pos + 1));
return new IdRange(lowVal, highVal);
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid message set " + range);
}
} } | public class class_name {
public static IdRange parseRange(String range) {
int pos = range.indexOf(':');
try {
if (pos == -1) {
long value = parseLong(range);
return new IdRange(value);
// depends on control dependency: [if], data = [none]
} else {
long lowVal = parseLong(range.substring(0, pos));
long highVal = parseLong(range.substring(pos + 1));
return new IdRange(lowVal, highVal);
// depends on control dependency: [if], data = [none]
}
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid message set " + range);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private ArrayList<IIOMetadata> readExif( IIOMetadataNode app1EXIFNode ) {
// Set up input skipping EXIF ID 6-byte sequence.
byte[] app1Params = (byte[]) app1EXIFNode.getUserObject();
MemoryCacheImageInputStream app1EXIFInput = new MemoryCacheImageInputStream(new ByteArrayInputStream(app1Params, 6,
app1Params.length - 6));
// only the tiff reader knows how to interpret the exif metadata
ImageReader tiffReader = null;
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("tiff");
while( readers.hasNext() ) {
tiffReader = (ImageReader) readers.next();
if (tiffReader.getClass().getName().startsWith("com.sun.media")) {
// Break on finding the core provider.
break;
}
}
if (tiffReader == null) {
throw new RuntimeException("Cannot find core TIFF reader!");
}
ArrayList<IIOMetadata> out = new ArrayList<IIOMetadata>(1);
tiffReader.setInput(app1EXIFInput);
IIOMetadata tiffMetadata = null;
try {
tiffMetadata = tiffReader.getImageMetadata(0);
// IIOMetadata meta = tiffReader.getImageMetadata(0);
TIFFImageReadParam rParam = (TIFFImageReadParam) tiffReader.getDefaultReadParam();
rParam.setTIFFDecompressor(null);
} catch (IOException e) {
e.printStackTrace();
};
tiffReader.dispose();
out.add(0, tiffMetadata);
return out;
} } | public class class_name {
private ArrayList<IIOMetadata> readExif( IIOMetadataNode app1EXIFNode ) {
// Set up input skipping EXIF ID 6-byte sequence.
byte[] app1Params = (byte[]) app1EXIFNode.getUserObject();
MemoryCacheImageInputStream app1EXIFInput = new MemoryCacheImageInputStream(new ByteArrayInputStream(app1Params, 6,
app1Params.length - 6));
// only the tiff reader knows how to interpret the exif metadata
ImageReader tiffReader = null;
Iterator<ImageReader> readers = ImageIO.getImageReadersByFormatName("tiff");
while( readers.hasNext() ) {
tiffReader = (ImageReader) readers.next(); // depends on control dependency: [while], data = [none]
if (tiffReader.getClass().getName().startsWith("com.sun.media")) {
// Break on finding the core provider.
break;
}
}
if (tiffReader == null) {
throw new RuntimeException("Cannot find core TIFF reader!");
}
ArrayList<IIOMetadata> out = new ArrayList<IIOMetadata>(1);
tiffReader.setInput(app1EXIFInput);
IIOMetadata tiffMetadata = null;
try {
tiffMetadata = tiffReader.getImageMetadata(0);
// IIOMetadata meta = tiffReader.getImageMetadata(0);
TIFFImageReadParam rParam = (TIFFImageReadParam) tiffReader.getDefaultReadParam();
rParam.setTIFFDecompressor(null);
} catch (IOException e) {
e.printStackTrace();
};
tiffReader.dispose();
out.add(0, tiffMetadata);
return out;
} } |
public class class_name {
private void play(Media media, Align alignment)
{
try (Playback playback = createPlayback(media, alignment, volume))
{
if (opened.containsKey(media))
{
opened.get(media).close();
}
opened.put(media, playback);
final AudioInputStream input = openStream(media);
final SourceDataLine dataLine = playback.getDataLine();
dataLine.start();
readSound(input, dataLine);
close(input, dataLine);
}
catch (final IOException exception)
{
if (last == null || !exception.getMessage().equals(last.getMessage()))
{
Verbose.exception(exception, media.toString());
last = exception;
}
}
} } | public class class_name {
private void play(Media media, Align alignment)
{
try (Playback playback = createPlayback(media, alignment, volume))
{
if (opened.containsKey(media))
{
opened.get(media).close(); // depends on control dependency: [if], data = [none]
}
opened.put(media, playback);
final AudioInputStream input = openStream(media);
final SourceDataLine dataLine = playback.getDataLine();
dataLine.start();
readSound(input, dataLine);
close(input, dataLine);
}
catch (final IOException exception)
{
if (last == null || !exception.getMessage().equals(last.getMessage()))
{
Verbose.exception(exception, media.toString()); // depends on control dependency: [if], data = [none]
last = exception; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean cut() {
boolean result = false;
WebElement element = getActiveElement();
if (element != null) {
if (connectedToMac()) {
element.sendKeys(Keys.chord(Keys.CONTROL, Keys.INSERT), Keys.BACK_SPACE);
} else {
element.sendKeys(Keys.CONTROL, "x");
}
result = true;
}
return result;
} } | public class class_name {
public boolean cut() {
boolean result = false;
WebElement element = getActiveElement();
if (element != null) {
if (connectedToMac()) {
element.sendKeys(Keys.chord(Keys.CONTROL, Keys.INSERT), Keys.BACK_SPACE); // depends on control dependency: [if], data = [none]
} else {
element.sendKeys(Keys.CONTROL, "x"); // depends on control dependency: [if], data = [none]
}
result = true; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public void checkFrameParticipation ()
{
// Determine whether or not the timer should participate in
// media ticks
boolean participate = _host.isShowing();
// Start participating if necessary
if (participate && !_participating)
{
_fmgr.registerFrameParticipant(this);
_participating = true;
}
// Stop participating if necessary
else if (!participate && _participating)
{
_fmgr.removeFrameParticipant(this);
_participating = false;
}
} } | public class class_name {
public void checkFrameParticipation ()
{
// Determine whether or not the timer should participate in
// media ticks
boolean participate = _host.isShowing();
// Start participating if necessary
if (participate && !_participating)
{
_fmgr.registerFrameParticipant(this); // depends on control dependency: [if], data = [none]
_participating = true; // depends on control dependency: [if], data = [none]
}
// Stop participating if necessary
else if (!participate && _participating)
{
_fmgr.removeFrameParticipant(this); // depends on control dependency: [if], data = [none]
_participating = false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
void firePropertyChildRemoved(TreeNodeRemovedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildRemoved(event);
}
}
}
final N parentNode = getParentNode();
if (parentNode != null) {
parentNode.firePropertyChildRemoved(event);
}
} } | public class class_name {
void firePropertyChildRemoved(TreeNodeRemovedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildRemoved(event); // depends on control dependency: [if], data = [none]
}
}
}
final N parentNode = getParentNode();
if (parentNode != null) {
parentNode.firePropertyChildRemoved(event); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<StepAdjustment> getStepAdjustments() {
if (stepAdjustments == null) {
stepAdjustments = new com.amazonaws.internal.SdkInternalList<StepAdjustment>();
}
return stepAdjustments;
} } | public class class_name {
public java.util.List<StepAdjustment> getStepAdjustments() {
if (stepAdjustments == null) {
stepAdjustments = new com.amazonaws.internal.SdkInternalList<StepAdjustment>(); // depends on control dependency: [if], data = [none]
}
return stepAdjustments;
} } |
public class class_name {
public static SnakerEngine getEngine() {
AssertHelper.notNull(context, "未注册服务上下文");
if(engine == null) {
engine = context.find(SnakerEngine.class);
}
return engine;
} } | public class class_name {
public static SnakerEngine getEngine() {
AssertHelper.notNull(context, "未注册服务上下文");
if(engine == null) {
engine = context.find(SnakerEngine.class); // depends on control dependency: [if], data = [none]
}
return engine;
} } |
public class class_name {
private <T> T send(String method, TypeReference<T> responseType, @Nullable Object entity) {
try {
InputStream responseStream = entity == null ?
builder().method(method, InputStream.class) :
builder().method(method, InputStream.class, entity);
return EntityHelper.getEntity(responseStream, responseType);
} catch (UniformInterfaceException e) {
throw asEmoClientException(e);
}
} } | public class class_name {
private <T> T send(String method, TypeReference<T> responseType, @Nullable Object entity) {
try {
InputStream responseStream = entity == null ?
builder().method(method, InputStream.class) :
builder().method(method, InputStream.class, entity);
return EntityHelper.getEntity(responseStream, responseType); // depends on control dependency: [try], data = [none]
} catch (UniformInterfaceException e) {
throw asEmoClientException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public AnnotationDesc[] annotations() {
if (!type.isAnnotated()) {
return new AnnotationDesc[0];
}
List<? extends TypeCompound> tas = type.getAnnotationMirrors();
AnnotationDesc res[] = new AnnotationDesc[tas.length()];
int i = 0;
for (Attribute.Compound a : tas) {
res[i++] = new AnnotationDescImpl(env, a);
}
return res;
} } | public class class_name {
public AnnotationDesc[] annotations() {
if (!type.isAnnotated()) {
return new AnnotationDesc[0]; // depends on control dependency: [if], data = [none]
}
List<? extends TypeCompound> tas = type.getAnnotationMirrors();
AnnotationDesc res[] = new AnnotationDesc[tas.length()];
int i = 0;
for (Attribute.Compound a : tas) {
res[i++] = new AnnotationDescImpl(env, a); // depends on control dependency: [for], data = [a]
}
return res;
} } |
public class class_name {
public static PluginManager getInstance() {
if (_instance == null) {
_instance = new PluginManager();
_instance.classInformation = new HashMap<String, ClassInformation>();
_instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>();
_instance.jarInformation = new ArrayList<String>();
if (_instance.proxyLibPath == null) {
//Get the System Classloader
ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();
//Get the URLs
URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
for (int i = 0; i < urls.length; i++) {
if (urls[i].getFile().contains("proxylib")) {
// store the path to the proxylib
_instance.proxyLibPath = urls[i].getFile();
break;
}
}
}
_instance.initializePlugins();
}
return _instance;
} } | public class class_name {
public static PluginManager getInstance() {
if (_instance == null) {
_instance = new PluginManager(); // depends on control dependency: [if], data = [none]
_instance.classInformation = new HashMap<String, ClassInformation>(); // depends on control dependency: [if], data = [none]
_instance.methodInformation = new HashMap<String, com.groupon.odo.proxylib.models.Method>(); // depends on control dependency: [if], data = [none]
_instance.jarInformation = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
if (_instance.proxyLibPath == null) {
//Get the System Classloader
ClassLoader sysClassLoader = Thread.currentThread().getContextClassLoader();
//Get the URLs
URL[] urls = ((URLClassLoader) sysClassLoader).getURLs();
for (int i = 0; i < urls.length; i++) {
if (urls[i].getFile().contains("proxylib")) {
// store the path to the proxylib
_instance.proxyLibPath = urls[i].getFile(); // depends on control dependency: [if], data = [none]
break;
}
}
}
_instance.initializePlugins(); // depends on control dependency: [if], data = [none]
}
return _instance;
} } |
public class class_name {
public Properties configureJavaMailSessionProperties(Properties properties, boolean debug) {
Properties props = new Properties();
if (debug) {
props.setProperty("mail.debug", "true");
// System.setProperty("mail.socket.debug", "true");
}
// Set local host address (makes tests much faster. If this is not set java mail always looks for the address)
props.setProperty(MAIL_DOT + getProtocol() + ".localaddress", String.valueOf(ServerSetup.getLocalHostAddress()));
props.setProperty(MAIL_DOT + getProtocol() + ".port", String.valueOf(getPort()));
props.setProperty(MAIL_DOT + getProtocol() + ".host", String.valueOf(getBindAddress()));
if (isSecure()) {
props.put(MAIL_DOT + getProtocol() + ".starttls.enable", Boolean.TRUE);
props.setProperty(MAIL_DOT + getProtocol() + ".socketFactory.class", DummySSLSocketFactory.class.getName());
props.setProperty(MAIL_DOT + getProtocol() + ".socketFactory.fallback", "false");
}
// Timeouts
props.setProperty(MAIL_DOT + getProtocol() + ".connectiontimeout",
Long.toString(getConnectionTimeout() < 0L ? ServerSetup.CONNECTION_TIMEOUT : getConnectionTimeout()));
props.setProperty(MAIL_DOT + getProtocol() + ".timeout",
Long.toString(getReadTimeout() < 0L ? ServerSetup.READ_TIMEOUT : getReadTimeout()));
// Note: "mail." + setup.getProtocol() + ".writetimeout" breaks TLS/SSL Dummy Socket and makes tests run 6x slower!!!
// Therefore we do not by default configure writetimeout.
if (getWriteTimeout() >= 0L) {
props.setProperty(MAIL_DOT + getProtocol() + ".writetimeout", Long.toString(getWriteTimeout()));
}
// Protocol specific extensions
if (getProtocol().startsWith(PROTOCOL_SMTP)) {
props.setProperty("mail.transport.protocol", getProtocol());
props.setProperty("mail.transport.protocol.rfc822", getProtocol());
}
// Auto configure stores.
props.setProperty("mail.store.protocol", getProtocol());
// Merge with optional additional properties
if (null != properties && !properties.isEmpty()) {
props.putAll(properties);
}
return props;
} } | public class class_name {
public Properties configureJavaMailSessionProperties(Properties properties, boolean debug) {
Properties props = new Properties();
if (debug) {
props.setProperty("mail.debug", "true");
// depends on control dependency: [if], data = [none]
// System.setProperty("mail.socket.debug", "true");
}
// Set local host address (makes tests much faster. If this is not set java mail always looks for the address)
props.setProperty(MAIL_DOT + getProtocol() + ".localaddress", String.valueOf(ServerSetup.getLocalHostAddress()));
props.setProperty(MAIL_DOT + getProtocol() + ".port", String.valueOf(getPort()));
props.setProperty(MAIL_DOT + getProtocol() + ".host", String.valueOf(getBindAddress()));
if (isSecure()) {
props.put(MAIL_DOT + getProtocol() + ".starttls.enable", Boolean.TRUE);
// depends on control dependency: [if], data = [none]
props.setProperty(MAIL_DOT + getProtocol() + ".socketFactory.class", DummySSLSocketFactory.class.getName());
// depends on control dependency: [if], data = [none]
props.setProperty(MAIL_DOT + getProtocol() + ".socketFactory.fallback", "false");
// depends on control dependency: [if], data = [none]
}
// Timeouts
props.setProperty(MAIL_DOT + getProtocol() + ".connectiontimeout",
Long.toString(getConnectionTimeout() < 0L ? ServerSetup.CONNECTION_TIMEOUT : getConnectionTimeout()));
props.setProperty(MAIL_DOT + getProtocol() + ".timeout",
Long.toString(getReadTimeout() < 0L ? ServerSetup.READ_TIMEOUT : getReadTimeout()));
// Note: "mail." + setup.getProtocol() + ".writetimeout" breaks TLS/SSL Dummy Socket and makes tests run 6x slower!!!
// Therefore we do not by default configure writetimeout.
if (getWriteTimeout() >= 0L) {
props.setProperty(MAIL_DOT + getProtocol() + ".writetimeout", Long.toString(getWriteTimeout()));
// depends on control dependency: [if], data = [(getWriteTimeout()]
}
// Protocol specific extensions
if (getProtocol().startsWith(PROTOCOL_SMTP)) {
props.setProperty("mail.transport.protocol", getProtocol());
// depends on control dependency: [if], data = [none]
props.setProperty("mail.transport.protocol.rfc822", getProtocol());
// depends on control dependency: [if], data = [none]
}
// Auto configure stores.
props.setProperty("mail.store.protocol", getProtocol());
// Merge with optional additional properties
if (null != properties && !properties.isEmpty()) {
props.putAll(properties);
// depends on control dependency: [if], data = [none]
}
return props;
} } |
public class class_name {
private void makeSingularPositive() {
numSingular = qralg.getNumberOfSingularValues();
singularValues = qralg.getSingularValues();
for( int i = 0; i < numSingular; i++ ) {
double val = qralg.getSingularValue(i);
if( val < 0 ) {
singularValues[i] = 0.0 - val;
if( computeU ) {
// compute the results of multiplying it by an element of -1 at this location in
// a diagonal matrix.
int start = i* Ut.numCols;
int stop = start+ Ut.numCols;
for( int j = start; j < stop; j++ ) {
Ut.set(j, 0.0 - Ut.get(j));
}
}
} else {
singularValues[i] = val;
}
}
} } | public class class_name {
private void makeSingularPositive() {
numSingular = qralg.getNumberOfSingularValues();
singularValues = qralg.getSingularValues();
for( int i = 0; i < numSingular; i++ ) {
double val = qralg.getSingularValue(i);
if( val < 0 ) {
singularValues[i] = 0.0 - val; // depends on control dependency: [if], data = [none]
if( computeU ) {
// compute the results of multiplying it by an element of -1 at this location in
// a diagonal matrix.
int start = i* Ut.numCols;
int stop = start+ Ut.numCols;
for( int j = start; j < stop; j++ ) {
Ut.set(j, 0.0 - Ut.get(j)); // depends on control dependency: [for], data = [j]
}
}
} else {
singularValues[i] = val; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private MapController createVertexController(GeometryEditService editService, GeometryIndex index) {
CompositeGeometryIndexController controller = new CompositeGeometryIndexController(editService, index,
editService.getEditingState() == GeometryEditState.DRAGGING);
for (VertexMapHandlerFactory factory : vertexFactories) {
controller.addMapHandler(factory.create());
}
return controller;
} } | public class class_name {
private MapController createVertexController(GeometryEditService editService, GeometryIndex index) {
CompositeGeometryIndexController controller = new CompositeGeometryIndexController(editService, index,
editService.getEditingState() == GeometryEditState.DRAGGING);
for (VertexMapHandlerFactory factory : vertexFactories) {
controller.addMapHandler(factory.create()); // depends on control dependency: [for], data = [factory]
}
return controller;
} } |
public class class_name {
@Override
public void recover() throws JMSException {
checkClosed();
//let's get all unacknowledged message identifiers
List<SQSMessageIdentifier> unAckedMessages = acknowledger.getUnAckMessages();
acknowledger.forgetUnAckMessages();
//let's summarize which queues and which message groups we're nacked
//we have to purge all prefetched messages and queued up callback entries for affected queues and groups
//if not, we would end up consuming messages out of order
Map<String, Set<String>> queueToGroupsMapping = getAffectedGroupsPerQueueUrl(unAckedMessages);
for (SQSMessageConsumer consumer : this.messageConsumers) {
SQSQueueDestination sqsQueue = (SQSQueueDestination)consumer.getQueue();
Set<String> affectedGroups = queueToGroupsMapping.get(sqsQueue.getQueueUrl());
if (affectedGroups != null) {
unAckedMessages.addAll(consumer.purgePrefetchedMessagesWithGroups(affectedGroups));
}
}
unAckedMessages.addAll(sqsSessionRunnable.purgeScheduledCallbacksForQueuesAndGroups(queueToGroupsMapping));
if (!unAckedMessages.isEmpty()) {
negativeAcknowledger.bulkAction(unAckedMessages, unAckedMessages.size());
}
} } | public class class_name {
@Override
public void recover() throws JMSException {
checkClosed();
//let's get all unacknowledged message identifiers
List<SQSMessageIdentifier> unAckedMessages = acknowledger.getUnAckMessages();
acknowledger.forgetUnAckMessages();
//let's summarize which queues and which message groups we're nacked
//we have to purge all prefetched messages and queued up callback entries for affected queues and groups
//if not, we would end up consuming messages out of order
Map<String, Set<String>> queueToGroupsMapping = getAffectedGroupsPerQueueUrl(unAckedMessages);
for (SQSMessageConsumer consumer : this.messageConsumers) {
SQSQueueDestination sqsQueue = (SQSQueueDestination)consumer.getQueue();
Set<String> affectedGroups = queueToGroupsMapping.get(sqsQueue.getQueueUrl());
if (affectedGroups != null) {
unAckedMessages.addAll(consumer.purgePrefetchedMessagesWithGroups(affectedGroups)); // depends on control dependency: [if], data = [(affectedGroups]
}
}
unAckedMessages.addAll(sqsSessionRunnable.purgeScheduledCallbacksForQueuesAndGroups(queueToGroupsMapping));
if (!unAckedMessages.isEmpty()) {
negativeAcknowledger.bulkAction(unAckedMessages, unAckedMessages.size());
}
} } |
public class class_name {
public static void updateLookAndFeel(Container container, PropertyOwner propertyOwner, Map<String,Object> properties)
{
String lookAndFeelClassName = ScreenUtil.getPropery(ScreenUtil.LOOK_AND_FEEL, propertyOwner, properties, null);
if (lookAndFeelClassName == null)
lookAndFeelClassName = ScreenUtil.DEFAULT;
if (ScreenUtil.DEFAULT.equalsIgnoreCase(lookAndFeelClassName))
{
// lookAndFeelClassName = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
lookAndFeelClassName = UIManager.getCrossPlatformLookAndFeelClassName();
}
if (ScreenUtil.SYSTEM.equalsIgnoreCase(lookAndFeelClassName))
lookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
String themeClassName = ScreenUtil.getPropery(ScreenUtil.THEME, propertyOwner, properties, null);
MetalTheme theme = null;
FontUIResource font = ScreenUtil.getFont(propertyOwner, properties, false);
ColorUIResource colorText = ScreenUtil.getColor(ScreenUtil.TEXT_COLOR, propertyOwner, properties);
ColorUIResource colorControl = ScreenUtil.getColor(ScreenUtil.CONTROL_COLOR, propertyOwner, properties);
ColorUIResource colorBackground = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties);
if ((themeClassName == null) || (themeClassName.equalsIgnoreCase(ScreenUtil.DEFAULT)))
if (font == null)
font = ScreenUtil.getFont(propertyOwner, properties, true);
if ((font != null) || (colorControl != null) || (colorText != null))
{
if (!(theme instanceof CustomTheme))
theme = new CustomTheme();
if (font != null)
((CustomTheme)theme).setDefaultFont(font);
if (colorControl != null)
((CustomTheme)theme).setWhite(colorControl);
if (colorText != null)
((CustomTheme)theme).setBlack(colorText);
if (colorBackground != null)
{
((CustomTheme)theme).setSecondaryColor(colorBackground);
((CustomTheme)theme).setPrimaryColor(colorBackground);
}
}
else
{
if ((themeClassName == null) || (themeClassName.equalsIgnoreCase(ScreenUtil.DEFAULT)))
theme = null; //? createDefaultTheme();
else
theme = (MetalTheme)ClassServiceUtility.getClassService().makeObjectFromClassName(themeClassName);
}
if (MetalLookAndFeel.class.getName().equals(lookAndFeelClassName))
{
if (theme == null)
theme = new OceanTheme();
MetalLookAndFeel.setCurrentTheme(theme);
}
try {
UIManager.setLookAndFeel(lookAndFeelClassName);
} catch (Exception ex) {
ex.printStackTrace();
}
SwingUtilities.updateComponentTreeUI(container);
} } | public class class_name {
public static void updateLookAndFeel(Container container, PropertyOwner propertyOwner, Map<String,Object> properties)
{
String lookAndFeelClassName = ScreenUtil.getPropery(ScreenUtil.LOOK_AND_FEEL, propertyOwner, properties, null);
if (lookAndFeelClassName == null)
lookAndFeelClassName = ScreenUtil.DEFAULT;
if (ScreenUtil.DEFAULT.equalsIgnoreCase(lookAndFeelClassName))
{
// lookAndFeelClassName = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel";
lookAndFeelClassName = UIManager.getCrossPlatformLookAndFeelClassName(); // depends on control dependency: [if], data = [none]
}
if (ScreenUtil.SYSTEM.equalsIgnoreCase(lookAndFeelClassName))
lookAndFeelClassName = UIManager.getSystemLookAndFeelClassName();
String themeClassName = ScreenUtil.getPropery(ScreenUtil.THEME, propertyOwner, properties, null);
MetalTheme theme = null;
FontUIResource font = ScreenUtil.getFont(propertyOwner, properties, false);
ColorUIResource colorText = ScreenUtil.getColor(ScreenUtil.TEXT_COLOR, propertyOwner, properties);
ColorUIResource colorControl = ScreenUtil.getColor(ScreenUtil.CONTROL_COLOR, propertyOwner, properties);
ColorUIResource colorBackground = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties);
if ((themeClassName == null) || (themeClassName.equalsIgnoreCase(ScreenUtil.DEFAULT)))
if (font == null)
font = ScreenUtil.getFont(propertyOwner, properties, true);
if ((font != null) || (colorControl != null) || (colorText != null))
{
if (!(theme instanceof CustomTheme))
theme = new CustomTheme();
if (font != null)
((CustomTheme)theme).setDefaultFont(font);
if (colorControl != null)
((CustomTheme)theme).setWhite(colorControl);
if (colorText != null)
((CustomTheme)theme).setBlack(colorText);
if (colorBackground != null)
{
((CustomTheme)theme).setSecondaryColor(colorBackground); // depends on control dependency: [if], data = [(colorBackground]
((CustomTheme)theme).setPrimaryColor(colorBackground); // depends on control dependency: [if], data = [(colorBackground]
}
}
else
{
if ((themeClassName == null) || (themeClassName.equalsIgnoreCase(ScreenUtil.DEFAULT)))
theme = null; //? createDefaultTheme();
else
theme = (MetalTheme)ClassServiceUtility.getClassService().makeObjectFromClassName(themeClassName);
}
if (MetalLookAndFeel.class.getName().equals(lookAndFeelClassName))
{
if (theme == null)
theme = new OceanTheme();
MetalLookAndFeel.setCurrentTheme(theme); // depends on control dependency: [if], data = [none]
}
try {
UIManager.setLookAndFeel(lookAndFeelClassName); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
SwingUtilities.updateComponentTreeUI(container);
} } |
public class class_name {
public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null;
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} } | public class class_name {
public String getType(TypeElement element, TypeMirror type) {
if (type == null) {
return null; // depends on control dependency: [if], data = [none]
}
return type.accept(this.typeExtractor, createTypeDescriptor(element));
} } |
public class class_name {
public static UrlBuilder getUrlBuilder(final URL baseUrl) {
URL url = null;
try {
url = new URL(decode(requireNonNull(baseUrl).toString(), defaultCharset().name()));
} catch (MalformedURLException | UnsupportedEncodingException e) {
throw new IllegalArgumentException(new StringBuilder("Cannot create a URI from the provided URL: ")
.append(baseUrl != null ? baseUrl.toString() : "null").toString(), e);
}
return new UrlBuilder(url);
} } | public class class_name {
public static UrlBuilder getUrlBuilder(final URL baseUrl) {
URL url = null;
try {
url = new URL(decode(requireNonNull(baseUrl).toString(), defaultCharset().name())); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException | UnsupportedEncodingException e) {
throw new IllegalArgumentException(new StringBuilder("Cannot create a URI from the provided URL: ")
.append(baseUrl != null ? baseUrl.toString() : "null").toString(), e);
} // depends on control dependency: [catch], data = [none]
return new UrlBuilder(url);
} } |
public class class_name {
public URI changesUri(Map<String, Object> query) {
//lets find the since parameter
if(query.containsKey("since")){
Object since = query.get("since");
if(!(since instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
query.put("since",gson.toJson(since));
}
}
return this.path("_changes").query(query).build();
} } | public class class_name {
public URI changesUri(Map<String, Object> query) {
//lets find the since parameter
if(query.containsKey("since")){
Object since = query.get("since");
if(!(since instanceof String)){
//json encode the seq number since it isn't a string
Gson gson = new Gson();
query.put("since",gson.toJson(since)); // depends on control dependency: [if], data = [none]
}
}
return this.path("_changes").query(query).build();
} } |
public class class_name {
public EClass getIfcSectionedSpine() {
if (ifcSectionedSpineEClass == null) {
ifcSectionedSpineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(506);
}
return ifcSectionedSpineEClass;
} } | public class class_name {
public EClass getIfcSectionedSpine() {
if (ifcSectionedSpineEClass == null) {
ifcSectionedSpineEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(506);
// depends on control dependency: [if], data = [none]
}
return ifcSectionedSpineEClass;
} } |
public class class_name {
protected DataType parseExactNumericType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
String typeName = null;
if (tokens.matchesAnyOf("INTEGER", "INT", "SMALLINT")) {
dataType = new DataType();
typeName = consume(tokens, dataType, false);
dataType.setName(typeName);
} else if (tokens.matchesAnyOf("NUMERIC", "DECIMAL", "DEC")) {
dataType = new DataType();
typeName = consume(tokens, dataType, false);
dataType.setName(typeName);
int precision = 0;
int scale = 0;
if (tokens.matches(L_PAREN)) {
consume(tokens, dataType, false, L_PAREN);
precision = (int)parseLong(tokens, dataType);
if (canConsume(tokens, dataType, false, COMMA)) {
scale = (int)parseLong(tokens, dataType);
} else {
scale = getDefaultScale();
}
consume(tokens, dataType, false, R_PAREN);
} else {
precision = getDefaultPrecision();
scale = getDefaultScale();
}
dataType.setPrecision(precision);
dataType.setScale(scale);
}
return dataType;
} } | public class class_name {
protected DataType parseExactNumericType( DdlTokenStream tokens ) throws ParsingException {
DataType dataType = null;
String typeName = null;
if (tokens.matchesAnyOf("INTEGER", "INT", "SMALLINT")) {
dataType = new DataType();
typeName = consume(tokens, dataType, false);
dataType.setName(typeName);
} else if (tokens.matchesAnyOf("NUMERIC", "DECIMAL", "DEC")) {
dataType = new DataType();
typeName = consume(tokens, dataType, false);
dataType.setName(typeName);
int precision = 0;
int scale = 0;
if (tokens.matches(L_PAREN)) {
consume(tokens, dataType, false, L_PAREN); // depends on control dependency: [if], data = [none]
precision = (int)parseLong(tokens, dataType); // depends on control dependency: [if], data = [none]
if (canConsume(tokens, dataType, false, COMMA)) {
scale = (int)parseLong(tokens, dataType); // depends on control dependency: [if], data = [none]
} else {
scale = getDefaultScale(); // depends on control dependency: [if], data = [none]
}
consume(tokens, dataType, false, R_PAREN); // depends on control dependency: [if], data = [none]
} else {
precision = getDefaultPrecision(); // depends on control dependency: [if], data = [none]
scale = getDefaultScale(); // depends on control dependency: [if], data = [none]
}
dataType.setPrecision(precision);
dataType.setScale(scale);
}
return dataType;
} } |
public class class_name {
public Map<Long, Map<String, ClientStats>> getCompleteStats() {
Map<Long, Map<String, ClientStats>> retval =
new TreeMap<Long, Map<String, ClientStats>>();
for (Entry<Long, Map<String, ClientStats>> e : m_current.entrySet()) {
if (m_baseline.containsKey(e.getKey())) {
retval.put(e.getKey(), diff(e.getValue(), m_baseline.get(e.getKey())));
}
else {
retval.put(e.getKey(), dup(e.getValue()));
}
}
// reset the timestamp fields to reflect the difference
for (Entry<Long, Map<String, ClientStats>> e : retval.entrySet()) {
for (Entry<String, ClientStats> e2 : e.getValue().entrySet()) {
ClientStats cs = e2.getValue();
cs.m_startTS = m_baselineTS;
cs.m_endTS = m_currentTS;
assert(cs.m_startTS != Long.MAX_VALUE);
assert(cs.m_endTS != Long.MIN_VALUE);
}
}
return retval;
} } | public class class_name {
public Map<Long, Map<String, ClientStats>> getCompleteStats() {
Map<Long, Map<String, ClientStats>> retval =
new TreeMap<Long, Map<String, ClientStats>>();
for (Entry<Long, Map<String, ClientStats>> e : m_current.entrySet()) {
if (m_baseline.containsKey(e.getKey())) {
retval.put(e.getKey(), diff(e.getValue(), m_baseline.get(e.getKey()))); // depends on control dependency: [if], data = [none]
}
else {
retval.put(e.getKey(), dup(e.getValue())); // depends on control dependency: [if], data = [none]
}
}
// reset the timestamp fields to reflect the difference
for (Entry<Long, Map<String, ClientStats>> e : retval.entrySet()) {
for (Entry<String, ClientStats> e2 : e.getValue().entrySet()) {
ClientStats cs = e2.getValue();
cs.m_startTS = m_baselineTS; // depends on control dependency: [for], data = [none]
cs.m_endTS = m_currentTS; // depends on control dependency: [for], data = [none]
assert(cs.m_startTS != Long.MAX_VALUE); // depends on control dependency: [for], data = [none]
assert(cs.m_endTS != Long.MIN_VALUE); // depends on control dependency: [for], data = [none]
}
}
return retval;
} } |
public class class_name {
private void initialize() {
// enables the options dialog to be in front, but an modal dialog
// stays on top of the main application window, but doesn't block childs
// Examples of childs: help window and client certificate viewer
this.setModalityType(ModalityType.DOCUMENT_MODAL);
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(500, 375);
}
this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setContentPane(getJContentPane());
} } | public class class_name {
private void initialize() {
// enables the options dialog to be in front, but an modal dialog
// stays on top of the main application window, but doesn't block childs
// Examples of childs: help window and client certificate viewer
this.setModalityType(ModalityType.DOCUMENT_MODAL);
if (Model.getSingleton().getOptionsParam().getViewParam().getWmUiHandlingOption() == 0) {
this.setSize(500, 375); // depends on control dependency: [if], data = [none]
}
this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setContentPane(getJContentPane());
} } |
public class class_name {
static URL getSharedClassCacheURL(URL resourceURL, String resourceName) {
URL sharedClassCacheURL;
if (resourceURL == null) {
sharedClassCacheURL = null;
} else {
String protocol = resourceURL.getProtocol();
if ("jar".equals(protocol)) {
sharedClassCacheURL = resourceURL;
} else if ("wsjar".equals(protocol)) {
try {
sharedClassCacheURL = new URL(resourceURL.toExternalForm().substring(2));
} catch (MalformedURLException e) {
sharedClassCacheURL = null;
}
} else if (!"file".equals(protocol)) {
sharedClassCacheURL = null;
} else {
String externalForm = resourceURL.toExternalForm();
if (externalForm.endsWith(resourceName)) {
try {
sharedClassCacheURL = new URL(externalForm.substring(0, externalForm.length() - resourceName.length()));
} catch (MalformedURLException e) {
sharedClassCacheURL = null;
}
} else {
sharedClassCacheURL = null;
}
}
}
return sharedClassCacheURL;
} } | public class class_name {
static URL getSharedClassCacheURL(URL resourceURL, String resourceName) {
URL sharedClassCacheURL;
if (resourceURL == null) {
sharedClassCacheURL = null; // depends on control dependency: [if], data = [none]
} else {
String protocol = resourceURL.getProtocol();
if ("jar".equals(protocol)) {
sharedClassCacheURL = resourceURL; // depends on control dependency: [if], data = [none]
} else if ("wsjar".equals(protocol)) {
try {
sharedClassCacheURL = new URL(resourceURL.toExternalForm().substring(2)); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
sharedClassCacheURL = null;
} // depends on control dependency: [catch], data = [none]
} else if (!"file".equals(protocol)) {
sharedClassCacheURL = null; // depends on control dependency: [if], data = [none]
} else {
String externalForm = resourceURL.toExternalForm();
if (externalForm.endsWith(resourceName)) {
try {
sharedClassCacheURL = new URL(externalForm.substring(0, externalForm.length() - resourceName.length())); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {
sharedClassCacheURL = null;
} // depends on control dependency: [catch], data = [none]
} else {
sharedClassCacheURL = null; // depends on control dependency: [if], data = [none]
}
}
}
return sharedClassCacheURL;
} } |
public class class_name {
@Override
public void setValue(final Object value) {
if (value == null) {
this.setText(null);
} else {
if (value instanceof Number) {
// Number inclue Double, Float, Integer, BigDecimal ...
this.setText(getNumberFormat().format(((Number) value).doubleValue()));
} else {
this.setText("??");
}
}
} } | public class class_name {
@Override
public void setValue(final Object value) {
if (value == null) {
this.setText(null);
// depends on control dependency: [if], data = [null)]
} else {
if (value instanceof Number) {
// Number inclue Double, Float, Integer, BigDecimal ...
this.setText(getNumberFormat().format(((Number) value).doubleValue()));
// depends on control dependency: [if], data = [none]
} else {
this.setText("??");
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private String getCustomFieldsCSV() {
String toReturn = "";
if (this.featureBranchFieldname != null && !this.featureBranchFieldname.isEmpty()) {
toReturn += "," + this.featureBranchFieldname;
}
if (this.originalBranchFieldname != null && !this.originalBranchFieldname.isEmpty()) {
toReturn += "," + this.originalBranchFieldname;
}
if (this.targetBranchFieldname != null && !this.targetBranchFieldname.isEmpty()) {
toReturn += "," + this.targetBranchFieldname;
}
if (this.approvedRevisionFieldname != null && !this.approvedRevisionFieldname.isEmpty()) {
toReturn += "," + this.approvedRevisionFieldname;
}
if (this.ciProjectFieldName != null && !this.ciProjectFieldName.isEmpty()) {
toReturn += "," + this.ciProjectFieldName;
}
return toReturn;
} } | public class class_name {
private String getCustomFieldsCSV() {
String toReturn = "";
if (this.featureBranchFieldname != null && !this.featureBranchFieldname.isEmpty()) {
toReturn += "," + this.featureBranchFieldname; // depends on control dependency: [if], data = [none]
}
if (this.originalBranchFieldname != null && !this.originalBranchFieldname.isEmpty()) {
toReturn += "," + this.originalBranchFieldname; // depends on control dependency: [if], data = [none]
}
if (this.targetBranchFieldname != null && !this.targetBranchFieldname.isEmpty()) {
toReturn += "," + this.targetBranchFieldname; // depends on control dependency: [if], data = [none]
}
if (this.approvedRevisionFieldname != null && !this.approvedRevisionFieldname.isEmpty()) {
toReturn += "," + this.approvedRevisionFieldname; // depends on control dependency: [if], data = [none]
}
if (this.ciProjectFieldName != null && !this.ciProjectFieldName.isEmpty()) {
toReturn += "," + this.ciProjectFieldName; // depends on control dependency: [if], data = [none]
}
return toReturn;
} } |
public class class_name {
public Weld extensions(Extension... extensions) {
this.extensions.clear();
for (Extension extension : extensions) {
addExtension(extension);
}
return this;
} } | public class class_name {
public Weld extensions(Extension... extensions) {
this.extensions.clear();
for (Extension extension : extensions) {
addExtension(extension); // depends on control dependency: [for], data = [extension]
}
return this;
} } |
public class class_name {
public void marshall(BatchUpdateLinkAttributes batchUpdateLinkAttributes, ProtocolMarshaller protocolMarshaller) {
if (batchUpdateLinkAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchUpdateLinkAttributes.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING);
protocolMarshaller.marshall(batchUpdateLinkAttributes.getAttributeUpdates(), ATTRIBUTEUPDATES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BatchUpdateLinkAttributes batchUpdateLinkAttributes, ProtocolMarshaller protocolMarshaller) {
if (batchUpdateLinkAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchUpdateLinkAttributes.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchUpdateLinkAttributes.getAttributeUpdates(), ATTRIBUTEUPDATES_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 convertLink2Record(final Object iKey) {
if (status == MULTIVALUE_CONTENT_TYPE.ALL_RECORDS)
return;
final Object value;
if (iKey instanceof ORID)
value = iKey;
else
value = super.get(iKey);
if (value != null && value instanceof ORID) {
final ORID rid = (ORID) value;
marshalling = true;
try {
try {
// OVERWRITE IT
super.put(iKey, rid.getRecord());
} catch (ORecordNotFoundException e) {
// IGNORE THIS
}
} finally {
marshalling = false;
}
}
} } | public class class_name {
private void convertLink2Record(final Object iKey) {
if (status == MULTIVALUE_CONTENT_TYPE.ALL_RECORDS)
return;
final Object value;
if (iKey instanceof ORID)
value = iKey;
else
value = super.get(iKey);
if (value != null && value instanceof ORID) {
final ORID rid = (ORID) value;
marshalling = true;
// depends on control dependency: [if], data = [none]
try {
try {
// OVERWRITE IT
super.put(iKey, rid.getRecord());
// depends on control dependency: [try], data = [none]
} catch (ORecordNotFoundException e) {
// IGNORE THIS
}
// depends on control dependency: [catch], data = [none]
} finally {
marshalling = false;
}
}
} } |
public class class_name {
public List<Serializable> getValues(String text, String type) throws NumberFormatException {
List<Serializable> list = new ArrayList<Serializable>();
String[] values = text.split(DELIM);
for (String v : values) {
Serializable value;
if (QueryParameter.INTEGER_VALUE.equals(type)) {
value = Integer.parseInt(v);
} else if (QueryParameter.BYTE_VALUE.equals(type)) {
value = Byte.parseByte(v);
} else if (QueryParameter.SHORT_VALUE.equals(type)) {
value = Short.parseShort(v);
} else if (QueryParameter.LONG_VALUE.equals(type)) {
value = Long.parseLong(v);
} else if (QueryParameter.FLOAT_VALUE.equals(type)) {
value = Float.parseFloat(v);
} else if (QueryParameter.DOUBLE_VALUE.equals(type)) {
value = Double.parseDouble(v);
} else if (QueryParameter.BIGDECIMAL_VALUE.equals(type)) {
value = new BigDecimal(v);
} else { // String
value = v;
}
list.add(value);
}
return list;
} } | public class class_name {
public List<Serializable> getValues(String text, String type) throws NumberFormatException {
List<Serializable> list = new ArrayList<Serializable>();
String[] values = text.split(DELIM);
for (String v : values) {
Serializable value;
if (QueryParameter.INTEGER_VALUE.equals(type)) {
value = Integer.parseInt(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.BYTE_VALUE.equals(type)) {
value = Byte.parseByte(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.SHORT_VALUE.equals(type)) {
value = Short.parseShort(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.LONG_VALUE.equals(type)) {
value = Long.parseLong(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.FLOAT_VALUE.equals(type)) {
value = Float.parseFloat(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.DOUBLE_VALUE.equals(type)) {
value = Double.parseDouble(v); // depends on control dependency: [if], data = [none]
} else if (QueryParameter.BIGDECIMAL_VALUE.equals(type)) {
value = new BigDecimal(v); // depends on control dependency: [if], data = [none]
} else { // String
value = v; // depends on control dependency: [if], data = [none]
}
list.add(value);
}
return list;
} } |
public class class_name {
public UpdateLicenseSpecificationsForResourceRequest withRemoveLicenseSpecifications(LicenseSpecification... removeLicenseSpecifications) {
if (this.removeLicenseSpecifications == null) {
setRemoveLicenseSpecifications(new java.util.ArrayList<LicenseSpecification>(removeLicenseSpecifications.length));
}
for (LicenseSpecification ele : removeLicenseSpecifications) {
this.removeLicenseSpecifications.add(ele);
}
return this;
} } | public class class_name {
public UpdateLicenseSpecificationsForResourceRequest withRemoveLicenseSpecifications(LicenseSpecification... removeLicenseSpecifications) {
if (this.removeLicenseSpecifications == null) {
setRemoveLicenseSpecifications(new java.util.ArrayList<LicenseSpecification>(removeLicenseSpecifications.length)); // depends on control dependency: [if], data = [none]
}
for (LicenseSpecification ele : removeLicenseSpecifications) {
this.removeLicenseSpecifications.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected PlanNode attachCriteria( final QueryContext context,
PlanNode plan,
Constraint constraint,
List<? extends Column> columns,
Map<String, Subquery> subqueriesByVariableName ) {
if (constraint == null) return plan;
context.getHints().hasCriteria = true;
// Extract the list of Constraint objects that all must be satisfied ...
LinkedList<Constraint> andableConstraints = new LinkedList<Constraint>();
separateAndConstraints(constraint, andableConstraints);
assert !andableConstraints.isEmpty();
// Build up the map of aliases for the properties used in the criteria ...
Map<String, String> propertyNameByAlias = new HashMap<String, String>();
for (Column column : columns) {
if (column.getColumnName() != null && !column.getColumnName().equals(column.getPropertyName())) {
propertyNameByAlias.put(column.getColumnName(), column.getPropertyName());
}
}
// For each of these constraints, create a criteria (SELECT) node above the supplied (JOIN or SOURCE) node.
// Do this in reverse order so that the top-most SELECT node corresponds to the first constraint.
while (!andableConstraints.isEmpty()) {
Constraint criteria = andableConstraints.removeLast();
// Replace any subqueries with bind variables ...
criteria = PlanUtil.replaceSubqueriesWithBindVariables(context, criteria, subqueriesByVariableName);
// Replace any use of aliases with the actual properties ...
criteria = PlanUtil.replaceAliasesWithProperties(context, criteria, propertyNameByAlias);
// Create the select node ...
PlanNode criteriaNode = new PlanNode(Type.SELECT);
criteriaNode.setProperty(Property.SELECT_CRITERIA, criteria);
// Add selectors to the criteria node ...
criteriaNode.addSelectors(Visitors.getSelectorsReferencedBy(criteria));
// Is there at least one full-text search or subquery ...
Visitors.visitAll(criteria, new Visitors.AbstractVisitor() {
@Override
public void visit( FullTextSearch obj ) {
context.getHints().hasFullTextSearch = true;
}
});
criteriaNode.addFirstChild(plan);
plan = criteriaNode;
}
if (!subqueriesByVariableName.isEmpty()) {
context.getHints().hasSubqueries = true;
}
return plan;
} } | public class class_name {
protected PlanNode attachCriteria( final QueryContext context,
PlanNode plan,
Constraint constraint,
List<? extends Column> columns,
Map<String, Subquery> subqueriesByVariableName ) {
if (constraint == null) return plan;
context.getHints().hasCriteria = true;
// Extract the list of Constraint objects that all must be satisfied ...
LinkedList<Constraint> andableConstraints = new LinkedList<Constraint>();
separateAndConstraints(constraint, andableConstraints);
assert !andableConstraints.isEmpty();
// Build up the map of aliases for the properties used in the criteria ...
Map<String, String> propertyNameByAlias = new HashMap<String, String>();
for (Column column : columns) {
if (column.getColumnName() != null && !column.getColumnName().equals(column.getPropertyName())) {
propertyNameByAlias.put(column.getColumnName(), column.getPropertyName()); // depends on control dependency: [if], data = [(column.getColumnName()]
}
}
// For each of these constraints, create a criteria (SELECT) node above the supplied (JOIN or SOURCE) node.
// Do this in reverse order so that the top-most SELECT node corresponds to the first constraint.
while (!andableConstraints.isEmpty()) {
Constraint criteria = andableConstraints.removeLast();
// Replace any subqueries with bind variables ...
criteria = PlanUtil.replaceSubqueriesWithBindVariables(context, criteria, subqueriesByVariableName); // depends on control dependency: [while], data = [none]
// Replace any use of aliases with the actual properties ...
criteria = PlanUtil.replaceAliasesWithProperties(context, criteria, propertyNameByAlias); // depends on control dependency: [while], data = [none]
// Create the select node ...
PlanNode criteriaNode = new PlanNode(Type.SELECT);
criteriaNode.setProperty(Property.SELECT_CRITERIA, criteria); // depends on control dependency: [while], data = [none]
// Add selectors to the criteria node ...
criteriaNode.addSelectors(Visitors.getSelectorsReferencedBy(criteria)); // depends on control dependency: [while], data = [none]
// Is there at least one full-text search or subquery ...
Visitors.visitAll(criteria, new Visitors.AbstractVisitor() {
@Override
public void visit( FullTextSearch obj ) {
context.getHints().hasFullTextSearch = true;
}
}); // depends on control dependency: [while], data = [none]
criteriaNode.addFirstChild(plan); // depends on control dependency: [while], data = [none]
plan = criteriaNode; // depends on control dependency: [while], data = [none]
}
if (!subqueriesByVariableName.isEmpty()) {
context.getHints().hasSubqueries = true; // depends on control dependency: [if], data = [none]
}
return plan;
} } |
public class class_name {
public StringGrabber insertIntoHead(String str) {
if (str != null) {
try {
sb.insert(0, str);
} catch (Exception e) {
e.printStackTrace();
}
}
return StringGrabber.this;
} } | public class class_name {
public StringGrabber insertIntoHead(String str) {
if (str != null) {
try {
sb.insert(0, str); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return StringGrabber.this;
} } |
public class class_name {
public Double getMemoryMetric(ID metricToCollect) {
GlobalMemory mem = getMemory();
if (PlatformMetricType.MEMORY_AVAILABLE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(mem.getAvailable());
} else if (PlatformMetricType.MEMORY_TOTAL.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(mem.getTotal());
} else {
throw new UnsupportedOperationException("Invalid memory metric to collect: " + metricToCollect);
}
} } | public class class_name {
public Double getMemoryMetric(ID metricToCollect) {
GlobalMemory mem = getMemory();
if (PlatformMetricType.MEMORY_AVAILABLE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(mem.getAvailable()); // depends on control dependency: [if], data = [none]
} else if (PlatformMetricType.MEMORY_TOTAL.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(mem.getTotal()); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException("Invalid memory metric to collect: " + metricToCollect);
}
} } |
public class class_name {
@Override
public DimensionTable getDimensionByName(String dimensionName, String tzNameAlias) {
DimensionTable dimensionTable;
if (StringUtils.isBlank(tzNameAlias) || (StringUtils.isNotBlank(tzNameAlias) && tzNameAlias.equals(getDefaultTimezone()))) {
dimensionTable = dimensions.get(dimensionName.toUpperCase());
} else {
if (!isTimeZoneSupported(tzNameAlias)) {
LOG.error(tzNameAlias + " TZ is not supported, do not consider it.");
dimensionTable = dimensions.get(dimensionName.toUpperCase());
} else {
String tzName = tzNamesAliases.get(tzNameAlias);
dimensionTable = alternateDimensions.get(Pair.of(dimensionName.toUpperCase(), tzName));
if (dimensionTable == null) {
// No alternateTable for this dimension/tz pair
dimensionTable = dimensions.get(dimensionName.toUpperCase());
}
}
}
if (dimensionTable == null) {
throw new IllegalArgumentException("Invalid SqlTable for the dimension: " + dimensionName);
}
return dimensionTable;
} } | public class class_name {
@Override
public DimensionTable getDimensionByName(String dimensionName, String tzNameAlias) {
DimensionTable dimensionTable;
if (StringUtils.isBlank(tzNameAlias) || (StringUtils.isNotBlank(tzNameAlias) && tzNameAlias.equals(getDefaultTimezone()))) {
dimensionTable = dimensions.get(dimensionName.toUpperCase()); // depends on control dependency: [if], data = [none]
} else {
if (!isTimeZoneSupported(tzNameAlias)) {
LOG.error(tzNameAlias + " TZ is not supported, do not consider it."); // depends on control dependency: [if], data = [none]
dimensionTable = dimensions.get(dimensionName.toUpperCase()); // depends on control dependency: [if], data = [none]
} else {
String tzName = tzNamesAliases.get(tzNameAlias);
dimensionTable = alternateDimensions.get(Pair.of(dimensionName.toUpperCase(), tzName)); // depends on control dependency: [if], data = [none]
if (dimensionTable == null) {
// No alternateTable for this dimension/tz pair
dimensionTable = dimensions.get(dimensionName.toUpperCase()); // depends on control dependency: [if], data = [none]
}
}
}
if (dimensionTable == null) {
throw new IllegalArgumentException("Invalid SqlTable for the dimension: " + dimensionName);
}
return dimensionTable;
} } |
public class class_name {
public boolean understands(SoapHeaderElement header) {
//see if header is accepted
if (header.getName() != null && acceptedHeaders.contains(header.getName().toString())) {
return true;
}
return false;
} } | public class class_name {
public boolean understands(SoapHeaderElement header) {
//see if header is accepted
if (header.getName() != null && acceptedHeaders.contains(header.getName().toString())) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected static List<String> formatMessageParameters(Object[] parameters) {
List<String> arguments = new ArrayList<>(parameters.length);
for (Object argument : parameters) {
arguments.add((argument != null) ? argument.toString() : null);
}
return arguments;
} } | public class class_name {
protected static List<String> formatMessageParameters(Object[] parameters) {
List<String> arguments = new ArrayList<>(parameters.length);
for (Object argument : parameters) {
arguments.add((argument != null) ? argument.toString() : null); // depends on control dependency: [for], data = [argument]
}
return arguments;
} } |
public class class_name {
private static Collection<URLClassLoader> getClassLoaders(ClassLoader baseClassLoader) {
Collection<URLClassLoader> loaders = new ArrayList<URLClassLoader>(8);
ClassLoader loader = baseClassLoader;
while (loader != null) {
if ("sun.misc.Launcher$ExtClassLoader".equals(loader.getClass().getName())) {
break;
}
if (loader instanceof URLClassLoader) {
loaders.add((URLClassLoader) loader);
}
loader = loader.getParent();
}
return loaders;
} } | public class class_name {
private static Collection<URLClassLoader> getClassLoaders(ClassLoader baseClassLoader) {
Collection<URLClassLoader> loaders = new ArrayList<URLClassLoader>(8);
ClassLoader loader = baseClassLoader;
while (loader != null) {
if ("sun.misc.Launcher$ExtClassLoader".equals(loader.getClass().getName())) {
break;
}
if (loader instanceof URLClassLoader) {
loaders.add((URLClassLoader) loader); // depends on control dependency: [if], data = [none]
}
loader = loader.getParent(); // depends on control dependency: [while], data = [none]
}
return loaders;
} } |
public class class_name {
public void registerPool(ManagedConnectionPool mcp, long mcpInterval)
{
try
{
lock.lock();
synchronized (registeredPools)
{
registeredPools.put(new Key(System.identityHashCode(mcp), System.currentTimeMillis(), mcpInterval), mcp);
}
if (mcpInterval > 1 && mcpInterval / 2 < interval)
{
interval = interval / 2;
long maybeNext = System.currentTimeMillis() + interval;
if (next > maybeNext && maybeNext > 0)
{
next = maybeNext;
condition.signal();
}
}
}
finally
{
lock.unlock();
}
} } | public class class_name {
public void registerPool(ManagedConnectionPool mcp, long mcpInterval)
{
try
{
lock.lock(); // depends on control dependency: [try], data = [none]
synchronized (registeredPools) // depends on control dependency: [try], data = [none]
{
registeredPools.put(new Key(System.identityHashCode(mcp), System.currentTimeMillis(), mcpInterval), mcp);
}
if (mcpInterval > 1 && mcpInterval / 2 < interval)
{
interval = interval / 2; // depends on control dependency: [if], data = [none]
long maybeNext = System.currentTimeMillis() + interval;
if (next > maybeNext && maybeNext > 0)
{
next = maybeNext; // depends on control dependency: [if], data = [none]
condition.signal(); // depends on control dependency: [if], data = [none]
}
}
}
finally
{
lock.unlock();
}
} } |
public class class_name {
private boolean isCategorySystemService(Field field) {
if(!(field.getName().endsWith("_service")
|| field.getName().endsWith("_SERVICE"))) {
return false;
}
Field[] declaredFields = Context.class.getDeclaredFields();
for (Field declaredField : declaredFields) {
if(String.class.isAssignableFrom(declaredField.getType())
&& declaredField.getName().equalsIgnoreCase(field.getName())) {
return true;
}
}
return false;
} } | public class class_name {
private boolean isCategorySystemService(Field field) {
if(!(field.getName().endsWith("_service")
|| field.getName().endsWith("_SERVICE"))) {
return false; // depends on control dependency: [if], data = [none]
}
Field[] declaredFields = Context.class.getDeclaredFields();
for (Field declaredField : declaredFields) {
if(String.class.isAssignableFrom(declaredField.getType())
&& declaredField.getName().equalsIgnoreCase(field.getName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static double mad(int[] x) {
int m = median(x);
for (int i = 0; i < x.length; i++) {
x[i] = Math.abs(x[i] - m);
}
return median(x);
} } | public class class_name {
public static double mad(int[] x) {
int m = median(x);
for (int i = 0; i < x.length; i++) {
x[i] = Math.abs(x[i] - m); // depends on control dependency: [for], data = [i]
}
return median(x);
} } |
public class class_name {
public static base_responses add(nitro_service client, lbvserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
lbvserver addresources[] = new lbvserver[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new lbvserver();
addresources[i].name = resources[i].name;
addresources[i].servicetype = resources[i].servicetype;
addresources[i].ipv46 = resources[i].ipv46;
addresources[i].ippattern = resources[i].ippattern;
addresources[i].ipmask = resources[i].ipmask;
addresources[i].port = resources[i].port;
addresources[i].range = resources[i].range;
addresources[i].persistencetype = resources[i].persistencetype;
addresources[i].timeout = resources[i].timeout;
addresources[i].persistencebackup = resources[i].persistencebackup;
addresources[i].backuppersistencetimeout = resources[i].backuppersistencetimeout;
addresources[i].lbmethod = resources[i].lbmethod;
addresources[i].hashlength = resources[i].hashlength;
addresources[i].netmask = resources[i].netmask;
addresources[i].v6netmasklen = resources[i].v6netmasklen;
addresources[i].cookiename = resources[i].cookiename;
addresources[i].rule = resources[i].rule;
addresources[i].listenpolicy = resources[i].listenpolicy;
addresources[i].listenpriority = resources[i].listenpriority;
addresources[i].resrule = resources[i].resrule;
addresources[i].persistmask = resources[i].persistmask;
addresources[i].v6persistmasklen = resources[i].v6persistmasklen;
addresources[i].pq = resources[i].pq;
addresources[i].sc = resources[i].sc;
addresources[i].rtspnat = resources[i].rtspnat;
addresources[i].m = resources[i].m;
addresources[i].tosid = resources[i].tosid;
addresources[i].datalength = resources[i].datalength;
addresources[i].dataoffset = resources[i].dataoffset;
addresources[i].sessionless = resources[i].sessionless;
addresources[i].state = resources[i].state;
addresources[i].connfailover = resources[i].connfailover;
addresources[i].redirurl = resources[i].redirurl;
addresources[i].cacheable = resources[i].cacheable;
addresources[i].clttimeout = resources[i].clttimeout;
addresources[i].somethod = resources[i].somethod;
addresources[i].sopersistence = resources[i].sopersistence;
addresources[i].sopersistencetimeout = resources[i].sopersistencetimeout;
addresources[i].healththreshold = resources[i].healththreshold;
addresources[i].sothreshold = resources[i].sothreshold;
addresources[i].sobackupaction = resources[i].sobackupaction;
addresources[i].redirectportrewrite = resources[i].redirectportrewrite;
addresources[i].downstateflush = resources[i].downstateflush;
addresources[i].backupvserver = resources[i].backupvserver;
addresources[i].disableprimaryondown = resources[i].disableprimaryondown;
addresources[i].insertvserveripport = resources[i].insertvserveripport;
addresources[i].vipheader = resources[i].vipheader;
addresources[i].authenticationhost = resources[i].authenticationhost;
addresources[i].authentication = resources[i].authentication;
addresources[i].authn401 = resources[i].authn401;
addresources[i].authnvsname = resources[i].authnvsname;
addresources[i].push = resources[i].push;
addresources[i].pushvserver = resources[i].pushvserver;
addresources[i].pushlabel = resources[i].pushlabel;
addresources[i].pushmulticlients = resources[i].pushmulticlients;
addresources[i].tcpprofilename = resources[i].tcpprofilename;
addresources[i].httpprofilename = resources[i].httpprofilename;
addresources[i].dbprofilename = resources[i].dbprofilename;
addresources[i].comment = resources[i].comment;
addresources[i].l2conn = resources[i].l2conn;
addresources[i].mssqlserverversion = resources[i].mssqlserverversion;
addresources[i].mysqlprotocolversion = resources[i].mysqlprotocolversion;
addresources[i].mysqlserverversion = resources[i].mysqlserverversion;
addresources[i].mysqlcharacterset = resources[i].mysqlcharacterset;
addresources[i].mysqlservercapabilities = resources[i].mysqlservercapabilities;
addresources[i].appflowlog = resources[i].appflowlog;
addresources[i].netprofile = resources[i].netprofile;
addresources[i].icmpvsrresponse = resources[i].icmpvsrresponse;
addresources[i].newservicerequest = resources[i].newservicerequest;
addresources[i].newservicerequestunit = resources[i].newservicerequestunit;
addresources[i].newservicerequestincrementinterval = resources[i].newservicerequestincrementinterval;
addresources[i].minautoscalemembers = resources[i].minautoscalemembers;
addresources[i].maxautoscalemembers = resources[i].maxautoscalemembers;
addresources[i].persistavpno = resources[i].persistavpno;
addresources[i].skippersistency = resources[i].skippersistency;
addresources[i].td = resources[i].td;
addresources[i].authnprofile = resources[i].authnprofile;
addresources[i].macmoderetainvlan = resources[i].macmoderetainvlan;
addresources[i].dbslb = resources[i].dbslb;
addresources[i].dns64 = resources[i].dns64;
addresources[i].bypassaaaa = resources[i].bypassaaaa;
addresources[i].recursionavailable = resources[i].recursionavailable;
}
result = add_bulk_request(client, addresources);
}
return result;
} } | public class class_name {
public static base_responses add(nitro_service client, lbvserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
lbvserver addresources[] = new lbvserver[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new lbvserver(); // depends on control dependency: [for], data = [i]
addresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
addresources[i].servicetype = resources[i].servicetype; // depends on control dependency: [for], data = [i]
addresources[i].ipv46 = resources[i].ipv46; // depends on control dependency: [for], data = [i]
addresources[i].ippattern = resources[i].ippattern; // depends on control dependency: [for], data = [i]
addresources[i].ipmask = resources[i].ipmask; // depends on control dependency: [for], data = [i]
addresources[i].port = resources[i].port; // depends on control dependency: [for], data = [i]
addresources[i].range = resources[i].range; // depends on control dependency: [for], data = [i]
addresources[i].persistencetype = resources[i].persistencetype; // depends on control dependency: [for], data = [i]
addresources[i].timeout = resources[i].timeout; // depends on control dependency: [for], data = [i]
addresources[i].persistencebackup = resources[i].persistencebackup; // depends on control dependency: [for], data = [i]
addresources[i].backuppersistencetimeout = resources[i].backuppersistencetimeout; // depends on control dependency: [for], data = [i]
addresources[i].lbmethod = resources[i].lbmethod; // depends on control dependency: [for], data = [i]
addresources[i].hashlength = resources[i].hashlength; // depends on control dependency: [for], data = [i]
addresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i]
addresources[i].v6netmasklen = resources[i].v6netmasklen; // depends on control dependency: [for], data = [i]
addresources[i].cookiename = resources[i].cookiename; // depends on control dependency: [for], data = [i]
addresources[i].rule = resources[i].rule; // depends on control dependency: [for], data = [i]
addresources[i].listenpolicy = resources[i].listenpolicy; // depends on control dependency: [for], data = [i]
addresources[i].listenpriority = resources[i].listenpriority; // depends on control dependency: [for], data = [i]
addresources[i].resrule = resources[i].resrule; // depends on control dependency: [for], data = [i]
addresources[i].persistmask = resources[i].persistmask; // depends on control dependency: [for], data = [i]
addresources[i].v6persistmasklen = resources[i].v6persistmasklen; // depends on control dependency: [for], data = [i]
addresources[i].pq = resources[i].pq; // depends on control dependency: [for], data = [i]
addresources[i].sc = resources[i].sc; // depends on control dependency: [for], data = [i]
addresources[i].rtspnat = resources[i].rtspnat; // depends on control dependency: [for], data = [i]
addresources[i].m = resources[i].m; // depends on control dependency: [for], data = [i]
addresources[i].tosid = resources[i].tosid; // depends on control dependency: [for], data = [i]
addresources[i].datalength = resources[i].datalength; // depends on control dependency: [for], data = [i]
addresources[i].dataoffset = resources[i].dataoffset; // depends on control dependency: [for], data = [i]
addresources[i].sessionless = resources[i].sessionless; // depends on control dependency: [for], data = [i]
addresources[i].state = resources[i].state; // depends on control dependency: [for], data = [i]
addresources[i].connfailover = resources[i].connfailover; // depends on control dependency: [for], data = [i]
addresources[i].redirurl = resources[i].redirurl; // depends on control dependency: [for], data = [i]
addresources[i].cacheable = resources[i].cacheable; // depends on control dependency: [for], data = [i]
addresources[i].clttimeout = resources[i].clttimeout; // depends on control dependency: [for], data = [i]
addresources[i].somethod = resources[i].somethod; // depends on control dependency: [for], data = [i]
addresources[i].sopersistence = resources[i].sopersistence; // depends on control dependency: [for], data = [i]
addresources[i].sopersistencetimeout = resources[i].sopersistencetimeout; // depends on control dependency: [for], data = [i]
addresources[i].healththreshold = resources[i].healththreshold; // depends on control dependency: [for], data = [i]
addresources[i].sothreshold = resources[i].sothreshold; // depends on control dependency: [for], data = [i]
addresources[i].sobackupaction = resources[i].sobackupaction; // depends on control dependency: [for], data = [i]
addresources[i].redirectportrewrite = resources[i].redirectportrewrite; // depends on control dependency: [for], data = [i]
addresources[i].downstateflush = resources[i].downstateflush; // depends on control dependency: [for], data = [i]
addresources[i].backupvserver = resources[i].backupvserver; // depends on control dependency: [for], data = [i]
addresources[i].disableprimaryondown = resources[i].disableprimaryondown; // depends on control dependency: [for], data = [i]
addresources[i].insertvserveripport = resources[i].insertvserveripport; // depends on control dependency: [for], data = [i]
addresources[i].vipheader = resources[i].vipheader; // depends on control dependency: [for], data = [i]
addresources[i].authenticationhost = resources[i].authenticationhost; // depends on control dependency: [for], data = [i]
addresources[i].authentication = resources[i].authentication; // depends on control dependency: [for], data = [i]
addresources[i].authn401 = resources[i].authn401; // depends on control dependency: [for], data = [i]
addresources[i].authnvsname = resources[i].authnvsname; // depends on control dependency: [for], data = [i]
addresources[i].push = resources[i].push; // depends on control dependency: [for], data = [i]
addresources[i].pushvserver = resources[i].pushvserver; // depends on control dependency: [for], data = [i]
addresources[i].pushlabel = resources[i].pushlabel; // depends on control dependency: [for], data = [i]
addresources[i].pushmulticlients = resources[i].pushmulticlients; // depends on control dependency: [for], data = [i]
addresources[i].tcpprofilename = resources[i].tcpprofilename; // depends on control dependency: [for], data = [i]
addresources[i].httpprofilename = resources[i].httpprofilename; // depends on control dependency: [for], data = [i]
addresources[i].dbprofilename = resources[i].dbprofilename; // depends on control dependency: [for], data = [i]
addresources[i].comment = resources[i].comment; // depends on control dependency: [for], data = [i]
addresources[i].l2conn = resources[i].l2conn; // depends on control dependency: [for], data = [i]
addresources[i].mssqlserverversion = resources[i].mssqlserverversion; // depends on control dependency: [for], data = [i]
addresources[i].mysqlprotocolversion = resources[i].mysqlprotocolversion; // depends on control dependency: [for], data = [i]
addresources[i].mysqlserverversion = resources[i].mysqlserverversion; // depends on control dependency: [for], data = [i]
addresources[i].mysqlcharacterset = resources[i].mysqlcharacterset; // depends on control dependency: [for], data = [i]
addresources[i].mysqlservercapabilities = resources[i].mysqlservercapabilities; // depends on control dependency: [for], data = [i]
addresources[i].appflowlog = resources[i].appflowlog; // depends on control dependency: [for], data = [i]
addresources[i].netprofile = resources[i].netprofile; // depends on control dependency: [for], data = [i]
addresources[i].icmpvsrresponse = resources[i].icmpvsrresponse; // depends on control dependency: [for], data = [i]
addresources[i].newservicerequest = resources[i].newservicerequest; // depends on control dependency: [for], data = [i]
addresources[i].newservicerequestunit = resources[i].newservicerequestunit; // depends on control dependency: [for], data = [i]
addresources[i].newservicerequestincrementinterval = resources[i].newservicerequestincrementinterval; // depends on control dependency: [for], data = [i]
addresources[i].minautoscalemembers = resources[i].minautoscalemembers; // depends on control dependency: [for], data = [i]
addresources[i].maxautoscalemembers = resources[i].maxautoscalemembers; // depends on control dependency: [for], data = [i]
addresources[i].persistavpno = resources[i].persistavpno; // depends on control dependency: [for], data = [i]
addresources[i].skippersistency = resources[i].skippersistency; // depends on control dependency: [for], data = [i]
addresources[i].td = resources[i].td; // depends on control dependency: [for], data = [i]
addresources[i].authnprofile = resources[i].authnprofile; // depends on control dependency: [for], data = [i]
addresources[i].macmoderetainvlan = resources[i].macmoderetainvlan; // depends on control dependency: [for], data = [i]
addresources[i].dbslb = resources[i].dbslb; // depends on control dependency: [for], data = [i]
addresources[i].dns64 = resources[i].dns64; // depends on control dependency: [for], data = [i]
addresources[i].bypassaaaa = resources[i].bypassaaaa; // depends on control dependency: [for], data = [i]
addresources[i].recursionavailable = resources[i].recursionavailable; // depends on control dependency: [for], data = [i]
}
result = add_bulk_request(client, addresources);
}
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T extends TypesafeEnum<T>> Set<T> values(Class<T> clazz) {
Set<T> set = new HashSet<T>();
if (constants.containsKey(clazz)) {
set.addAll((Set<T>) constants.get(clazz));
}
return set;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T extends TypesafeEnum<T>> Set<T> values(Class<T> clazz) {
Set<T> set = new HashSet<T>();
if (constants.containsKey(clazz)) {
set.addAll((Set<T>) constants.get(clazz)); // depends on control dependency: [if], data = [none]
}
return set;
} } |
public class class_name {
void processXmlContributor() throws XMLStreamException,
MwDumpFormatException {
this.xmlReader.next(); // skip current start tag
while (this.xmlReader.hasNext()) {
switch (this.xmlReader.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
switch (this.xmlReader.getLocalName()) {
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_NAME:
this.mwRevision.contributor = this.xmlReader
.getElementText();
break;
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_ID:
this.mwRevision.contributorId = Integer.parseInt(this.xmlReader.getElementText());
break;
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_IP:
this.mwRevision.contributor = this.xmlReader
.getElementText();
this.mwRevision.contributorId = -1;
break;
default:
throw new MwDumpFormatException("Unexpected element \""
+ this.xmlReader.getLocalName()
+ "\" in contributor.");
}
break;
case XMLStreamConstants.END_ELEMENT:
if (MwRevisionDumpFileProcessor.E_REV_CONTRIBUTOR
.equals(this.xmlReader.getLocalName())) {
return;
}
break;
}
this.xmlReader.next();
}
} } | public class class_name {
void processXmlContributor() throws XMLStreamException,
MwDumpFormatException {
this.xmlReader.next(); // skip current start tag
while (this.xmlReader.hasNext()) {
switch (this.xmlReader.getEventType()) {
case XMLStreamConstants.START_ELEMENT:
switch (this.xmlReader.getLocalName()) {
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_NAME:
this.mwRevision.contributor = this.xmlReader
.getElementText();
break;
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_ID:
this.mwRevision.contributorId = Integer.parseInt(this.xmlReader.getElementText());
break;
case MwRevisionDumpFileProcessor.E_CONTRIBUTOR_IP:
this.mwRevision.contributor = this.xmlReader
.getElementText();
this.mwRevision.contributorId = -1;
break;
default:
throw new MwDumpFormatException("Unexpected element \""
+ this.xmlReader.getLocalName()
+ "\" in contributor.");
}
break;
case XMLStreamConstants.END_ELEMENT:
if (MwRevisionDumpFileProcessor.E_REV_CONTRIBUTOR
.equals(this.xmlReader.getLocalName())) {
return; // depends on control dependency: [if], data = [none]
}
break;
}
this.xmlReader.next();
}
} } |
public class class_name {
public static ComboBox decorate(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String prompt) {
final ComboBox spUICombo = new ComboBox();
// Default settings
spUICombo.setRequired(required);
spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);
if (!StringUtils.isEmpty(caption)) {
spUICombo.setCaption(caption);
}
// Add style
if (!StringUtils.isEmpty(style)) {
spUICombo.setStyleName(style);
}
// Add style Name
if (!StringUtils.isEmpty(styleName)) {
spUICombo.addStyleName(styleName);
}
// AddWidth
if (!StringUtils.isEmpty(width)) {
spUICombo.setWidth(width);
}
// Set prompt
if (!StringUtils.isEmpty(prompt)) {
spUICombo.setInputPrompt(prompt);
}
// Set Data
if (!StringUtils.isEmpty(data)) {
spUICombo.setData(data);
}
return spUICombo;
} } | public class class_name {
public static ComboBox decorate(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String prompt) {
final ComboBox spUICombo = new ComboBox();
// Default settings
spUICombo.setRequired(required);
spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);
if (!StringUtils.isEmpty(caption)) {
spUICombo.setCaption(caption); // depends on control dependency: [if], data = [none]
}
// Add style
if (!StringUtils.isEmpty(style)) {
spUICombo.setStyleName(style); // depends on control dependency: [if], data = [none]
}
// Add style Name
if (!StringUtils.isEmpty(styleName)) {
spUICombo.addStyleName(styleName); // depends on control dependency: [if], data = [none]
}
// AddWidth
if (!StringUtils.isEmpty(width)) {
spUICombo.setWidth(width); // depends on control dependency: [if], data = [none]
}
// Set prompt
if (!StringUtils.isEmpty(prompt)) {
spUICombo.setInputPrompt(prompt); // depends on control dependency: [if], data = [none]
}
// Set Data
if (!StringUtils.isEmpty(data)) {
spUICombo.setData(data); // depends on control dependency: [if], data = [none]
}
return spUICombo;
} } |
public class class_name {
public void record (ChatChannel channel, String source, UserMessage msg, Name ...usernames)
{
// fill in the message's time stamp if necessary
if (msg.timestamp == 0L) {
msg.timestamp = System.currentTimeMillis();
}
Entry entry = new Entry(channel, source, msg);
for (Name username : usernames) {
// add the message to this user's chat history
List<Entry> history = getList(username);
if (history == null) {
continue;
}
history.add(entry);
// if the history is big enough, potentially prune it (we always prune when asked for
// the history, so this is just to balance memory usage with CPU expense)
if (history.size() > 15) {
prune(msg.timestamp, history);
}
}
} } | public class class_name {
public void record (ChatChannel channel, String source, UserMessage msg, Name ...usernames)
{
// fill in the message's time stamp if necessary
if (msg.timestamp == 0L) {
msg.timestamp = System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
}
Entry entry = new Entry(channel, source, msg);
for (Name username : usernames) {
// add the message to this user's chat history
List<Entry> history = getList(username);
if (history == null) {
continue;
}
history.add(entry); // depends on control dependency: [for], data = [none]
// if the history is big enough, potentially prune it (we always prune when asked for
// the history, so this is just to balance memory usage with CPU expense)
if (history.size() > 15) {
prune(msg.timestamp, history); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public com.google.protobuf.ByteString
getSaveTensorNameBytes() {
java.lang.Object ref = saveTensorName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
saveTensorName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} } | public class class_name {
public com.google.protobuf.ByteString
getSaveTensorNameBytes() {
java.lang.Object ref = saveTensorName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
saveTensorName_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void throwing (String msg, Throwable t) {
StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement ();
if (caller != null) {
logger.logp (Level.FINER, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), msg, t);
} else {
logger.logp (Level.FINER, "(UnknownSourceClass)", "(unknownSourceMethod)", msg, t);
}
} } | public class class_name {
public void throwing (String msg, Throwable t) {
StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement ();
if (caller != null) {
logger.logp (Level.FINER, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), msg, t); // depends on control dependency: [if], data = [none]
} else {
logger.logp (Level.FINER, "(UnknownSourceClass)", "(unknownSourceMethod)", msg, t); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String preProcessPattern(String pattern) {
int index = pattern.indexOf('\\');
if (index < 0) {
return pattern;
}
StringBuilder sb = new StringBuilder();
for (int pos = 0; pos < pattern.length();) {
char ch = pattern.charAt(pos);
if (ch != '\\') {
sb.append(ch);
pos++;
continue;
}
if (pos + 1 >= pattern.length()) {
// we'll end the pattern with a '\\' char
sb.append(ch);
break;
}
ch = pattern.charAt(++pos);
switch (ch) {
case 'b':
sb.append('\b');
pos++;
break;
case 'f':
sb.append('\f');
pos++;
break;
case 'n':
sb.append('\n');
pos++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
// 1-3 octal characters: \1 \01 or \017
pos += radixCharsToChar(sb, pattern, pos, 3, 8);
break;
}
case 'r':
sb.append('\r');
pos++;
break;
case 't':
sb.append('\t');
pos++;
break;
case 'x': {
// 1-2 hex characters: \xD or \xD9
int adjust = radixCharsToChar(sb, pattern, pos + 1, 2, 16);
if (adjust > 0) {
// adjust by 1 for the x
pos += 1 + adjust;
} else {
sb.append(ch);
pos++;
}
break;
}
case ' ':
case '\\':
default:
sb.append(ch);
pos++;
break;
}
}
return sb.toString();
} } | public class class_name {
public static String preProcessPattern(String pattern) {
int index = pattern.indexOf('\\');
if (index < 0) {
return pattern; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for (int pos = 0; pos < pattern.length();) {
char ch = pattern.charAt(pos);
if (ch != '\\') {
sb.append(ch); // depends on control dependency: [if], data = [(ch]
pos++; // depends on control dependency: [if], data = [none]
continue;
}
if (pos + 1 >= pattern.length()) {
// we'll end the pattern with a '\\' char
sb.append(ch); // depends on control dependency: [if], data = [none]
break;
}
ch = pattern.charAt(++pos); // depends on control dependency: [for], data = [pos]
switch (ch) {
case 'b':
sb.append('\b');
pos++;
break;
case 'f':
sb.append('\f');
pos++;
break;
case 'n':
sb.append('\n');
pos++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
// 1-3 octal characters: \1 \01 or \017
pos += radixCharsToChar(sb, pattern, pos, 3, 8);
break;
}
case 'r':
sb.append('\r');
pos++;
break;
case 't':
sb.append('\t');
pos++;
break;
case 'x': {
// 1-2 hex characters: \xD or \xD9
int adjust = radixCharsToChar(sb, pattern, pos + 1, 2, 16);
if (adjust > 0) {
// adjust by 1 for the x
pos += 1 + adjust; // depends on control dependency: [if], data = [none]
} else {
sb.append(ch); // depends on control dependency: [if], data = [none]
pos++; // depends on control dependency: [if], data = [none]
}
break;
}
case ' ':
case '\\':
default:
sb.append(ch);
pos++;
break;
}
}
return sb.toString();
} } |
public class class_name {
public static String getRequestHeadersOutput(HTTP http) {
if (http == null) {
return "";
}
StringBuilder requestHeaders = new StringBuilder();
String uuid = getUUID();
requestHeaders.append(ONCLICK_TOGGLE).append(uuid).append("\")'>Toggle Headers</a> ");
requestHeaders.append(SPAN_ID).append(uuid).append(DISPLAY_NONE);
requestHeaders.append(formatKeyPair(http.getHeaders()));
requestHeaders.append(END_SPAN);
return requestHeaders.toString();
} } | public class class_name {
public static String getRequestHeadersOutput(HTTP http) {
if (http == null) {
return ""; // depends on control dependency: [if], data = [none]
}
StringBuilder requestHeaders = new StringBuilder();
String uuid = getUUID();
requestHeaders.append(ONCLICK_TOGGLE).append(uuid).append("\")'>Toggle Headers</a> ");
requestHeaders.append(SPAN_ID).append(uuid).append(DISPLAY_NONE);
requestHeaders.append(formatKeyPair(http.getHeaders()));
requestHeaders.append(END_SPAN);
return requestHeaders.toString();
} } |
public class class_name {
public Object getValue()
{
try
{
String text = getAsText();
if (text == null)
{
return null;
}
if (text.startsWith("/"))
{
// seems like localhost sometimes will look like:
// /127.0.0.1 and the getByNames barfs on the slash - JGH
text = text.substring(1);
}
return InetAddress.getByName(StringPropertyReplacer.replaceProperties(text));
}
catch (UnknownHostException e)
{
throw new NestedRuntimeException(e);
}
} } | public class class_name {
public Object getValue()
{
try
{
String text = getAsText();
if (text == null)
{
return null; // depends on control dependency: [if], data = [none]
}
if (text.startsWith("/"))
{
// seems like localhost sometimes will look like:
// /127.0.0.1 and the getByNames barfs on the slash - JGH
text = text.substring(1); // depends on control dependency: [if], data = [none]
}
return InetAddress.getByName(StringPropertyReplacer.replaceProperties(text)); // depends on control dependency: [try], data = [none]
}
catch (UnknownHostException e)
{
throw new NestedRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final BatchInsertMeta insertHStmnt() throws RecognitionException {
BatchInsertMeta bMeta = null;
Token id=null;
Token paths=null;
Token gran=null;
Token delim=null;
Token listDelim=null;
Token type=null;
Token size=null;
Token boundary=null;
List<Interval> i =null;
bMeta = new BatchInsertMeta();
try {
// druidG.g:107:2: ( ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? ) FROM WS (paths= SINGLE_QUOTE_STRING ) WS ( WHERE WS i= intervalClause ) ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )? ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )? ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )? ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )? )
// druidG.g:107:3: ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? ) FROM WS (paths= SINGLE_QUOTE_STRING ) WS ( WHERE WS i= intervalClause ) ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )? ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )? ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )? ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )?
{
// druidG.g:107:3: ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? )
// druidG.g:107:4: INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )?
{
match(input,INSERT_HADOOP,FOLLOW_INSERT_HADOOP_in_insertHStmnt616);
match(input,WS,FOLLOW_WS_in_insertHStmnt618);
match(input,INTO,FOLLOW_INTO_in_insertHStmnt620);
match(input,WS,FOLLOW_WS_in_insertHStmnt622);
// druidG.g:107:29: (id= ID )
// druidG.g:107:30: id= ID
{
id=(Token)match(input,ID,FOLLOW_ID_in_insertHStmnt627);
bMeta.dataSource = (id!=null?id.getText():null);
}
// druidG.g:107:69: ( WS )?
int alt39=2;
int LA39_0 = input.LA(1);
if ( (LA39_0==WS) ) {
alt39=1;
}
switch (alt39) {
case 1 :
// druidG.g:107:69: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt632);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt635);
// druidG.g:107:80: ( WS )?
int alt40=2;
int LA40_0 = input.LA(1);
if ( (LA40_0==WS) ) {
alt40=1;
}
switch (alt40) {
case 1 :
// druidG.g:107:80: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt637);
}
break;
}
pushFollow(FOLLOW_selectItems_in_insertHStmnt640);
selectItems(bMeta);
state._fsp--;
// druidG.g:107:103: ( ( WS )? ',' ( WS )? selectItems[bMeta] )*
loop43:
while (true) {
int alt43=2;
int LA43_0 = input.LA(1);
if ( (LA43_0==WS) ) {
int LA43_1 = input.LA(2);
if ( (LA43_1==91) ) {
alt43=1;
}
}
else if ( (LA43_0==91) ) {
alt43=1;
}
switch (alt43) {
case 1 :
// druidG.g:107:104: ( WS )? ',' ( WS )? selectItems[bMeta]
{
// druidG.g:107:104: ( WS )?
int alt41=2;
int LA41_0 = input.LA(1);
if ( (LA41_0==WS) ) {
alt41=1;
}
switch (alt41) {
case 1 :
// druidG.g:107:104: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt644);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt647);
// druidG.g:107:112: ( WS )?
int alt42=2;
int LA42_0 = input.LA(1);
if ( (LA42_0==WS) ) {
alt42=1;
}
switch (alt42) {
case 1 :
// druidG.g:107:112: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt649);
}
break;
}
pushFollow(FOLLOW_selectItems_in_insertHStmnt652);
selectItems(bMeta);
state._fsp--;
}
break;
default :
break loop43;
}
}
// druidG.g:107:137: ( WS )?
int alt44=2;
int LA44_0 = input.LA(1);
if ( (LA44_0==WS) ) {
alt44=1;
}
switch (alt44) {
case 1 :
// druidG.g:107:137: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt657);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt660);
// druidG.g:107:148: ( WS )?
int alt45=2;
int LA45_0 = input.LA(1);
if ( (LA45_0==WS) ) {
alt45=1;
}
switch (alt45) {
case 1 :
// druidG.g:107:148: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt662);
}
break;
}
}
match(input,FROM,FOLLOW_FROM_in_insertHStmnt669);
match(input,WS,FOLLOW_WS_in_insertHStmnt671);
// druidG.g:108:11: (paths= SINGLE_QUOTE_STRING )
// druidG.g:108:12: paths= SINGLE_QUOTE_STRING
{
paths=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt676);
bMeta.inputSpec.setPath(unquote((paths!=null?paths.getText():null)));bMeta.inferFormat(unquote((paths!=null?paths.getText():null)));
}
match(input,WS,FOLLOW_WS_in_insertHStmnt681);
// druidG.g:109:3: ( WHERE WS i= intervalClause )
// druidG.g:109:4: WHERE WS i= intervalClause
{
match(input,WHERE,FOLLOW_WHERE_in_insertHStmnt686);
match(input,WS,FOLLOW_WS_in_insertHStmnt688);
pushFollow(FOLLOW_intervalClause_in_insertHStmnt692);
i=intervalClause();
state._fsp--;
}
// druidG.g:110:4: ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )?
int alt46=2;
int LA46_0 = input.LA(1);
if ( (LA46_0==WS) ) {
int LA46_1 = input.LA(2);
if ( (LA46_1==BREAK) ) {
alt46=1;
}
}
switch (alt46) {
case 1 :
// druidG.g:110:5: WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING
{
match(input,WS,FOLLOW_WS_in_insertHStmnt699);
match(input,BREAK,FOLLOW_BREAK_in_insertHStmnt701);
match(input,WS,FOLLOW_WS_in_insertHStmnt703);
match(input,BY,FOLLOW_BY_in_insertHStmnt705);
match(input,WS,FOLLOW_WS_in_insertHStmnt707);
gran=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt711);
bMeta.granularitySpec = new GranularitySpec(unquote((gran!=null?gran.getText():null)));
}
break;
}
// We set this later after granularitySpec object is fully formed.
if (i!= null && !i.isEmpty()) {
bMeta.granularitySpec.interval = i.get(0);// We already checked for list's emptiness(it is safe to access get(0).
}
// druidG.g:116:3: ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )?
int alt54=2;
int LA54_0 = input.LA(1);
if ( (LA54_0==WS) ) {
int LA54_1 = input.LA(2);
if ( (LA54_1==DELIMITER) ) {
alt54=1;
}
}
switch (alt54) {
case 1 :
// druidG.g:116:4: WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt726);
match(input,DELIMITER,FOLLOW_DELIMITER_in_insertHStmnt728);
// druidG.g:116:17: ( WS )?
int alt47=2;
int LA47_0 = input.LA(1);
if ( (LA47_0==WS) ) {
alt47=1;
}
switch (alt47) {
case 1 :
// druidG.g:116:17: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt730);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt733);
// druidG.g:116:28: ( WS )?
int alt48=2;
int LA48_0 = input.LA(1);
if ( (LA48_0==WS) ) {
alt48=1;
}
switch (alt48) {
case 1 :
// druidG.g:116:28: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt735);
}
break;
}
delim=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt740);
bMeta.delimiter=unicode(unquote((delim!=null?delim.getText():null)));
// druidG.g:116:106: ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )?
int alt51=2;
int LA51_0 = input.LA(1);
if ( (LA51_0==WS) ) {
int LA51_1 = input.LA(2);
if ( (LA51_1==91) ) {
alt51=1;
}
}
else if ( (LA51_0==91) ) {
alt51=1;
}
switch (alt51) {
case 1 :
// druidG.g:116:107: ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING
{
// druidG.g:116:107: ( WS )?
int alt49=2;
int LA49_0 = input.LA(1);
if ( (LA49_0==WS) ) {
alt49=1;
}
switch (alt49) {
case 1 :
// druidG.g:116:107: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt744);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt747);
// druidG.g:116:115: ( WS )?
int alt50=2;
int LA50_0 = input.LA(1);
if ( (LA50_0==WS) ) {
alt50=1;
}
switch (alt50) {
case 1 :
// druidG.g:116:115: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt749);
}
break;
}
listDelim=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt754);
bMeta.listDelimiter=unicode(unquote((listDelim!=null?listDelim.getText():null)));
}
break;
}
// druidG.g:116:208: ( WS )?
int alt52=2;
int LA52_0 = input.LA(1);
if ( (LA52_0==WS) ) {
alt52=1;
}
switch (alt52) {
case 1 :
// druidG.g:116:208: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt760);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt763);
// druidG.g:116:219: ( WS )?
int alt53=2;
int LA53_0 = input.LA(1);
if ( (LA53_0==WS) ) {
int LA53_1 = input.LA(2);
if ( (LA53_1==EOF||LA53_1==WS) ) {
alt53=1;
}
}
switch (alt53) {
case 1 :
// druidG.g:116:219: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt765);
}
break;
}
}
break;
}
// druidG.g:117:3: ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )?
int alt61=2;
int LA61_0 = input.LA(1);
if ( (LA61_0==WS) ) {
int LA61_1 = input.LA(2);
if ( (LA61_1==PARTITION) ) {
alt61=1;
}
}
switch (alt61) {
case 1 :
// druidG.g:117:4: WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt774);
match(input,PARTITION,FOLLOW_PARTITION_in_insertHStmnt776);
// druidG.g:117:17: ( WS )?
int alt55=2;
int LA55_0 = input.LA(1);
if ( (LA55_0==WS) ) {
alt55=1;
}
switch (alt55) {
case 1 :
// druidG.g:117:17: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt778);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt781);
// druidG.g:117:28: ( WS )?
int alt56=2;
int LA56_0 = input.LA(1);
if ( (LA56_0==WS) ) {
alt56=1;
}
switch (alt56) {
case 1 :
// druidG.g:117:28: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt783);
}
break;
}
type=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt788);
// druidG.g:117:57: ( WS )?
int alt57=2;
int LA57_0 = input.LA(1);
if ( (LA57_0==WS) ) {
alt57=1;
}
switch (alt57) {
case 1 :
// druidG.g:117:57: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt790);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt793);
// druidG.g:117:65: ( WS )?
int alt58=2;
int LA58_0 = input.LA(1);
if ( (LA58_0==WS) ) {
alt58=1;
}
switch (alt58) {
case 1 :
// druidG.g:117:65: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt795);
}
break;
}
size=(Token)match(input,LONG,FOLLOW_LONG_in_insertHStmnt800);
bMeta.partitionsSpec.type=unquote((type!=null?type.getText():null));bMeta.partitionsSpec.targetPartitionSize=Long.valueOf((size!=null?size.getText():null));
// druidG.g:117:195: ( WS )?
int alt59=2;
int LA59_0 = input.LA(1);
if ( (LA59_0==WS) ) {
alt59=1;
}
switch (alt59) {
case 1 :
// druidG.g:117:195: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt804);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt807);
// druidG.g:117:206: ( WS )?
int alt60=2;
int LA60_0 = input.LA(1);
if ( (LA60_0==WS) ) {
int LA60_1 = input.LA(2);
if ( (LA60_1==EOF||LA60_1==WS) ) {
alt60=1;
}
}
switch (alt60) {
case 1 :
// druidG.g:117:206: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt809);
}
break;
}
}
break;
}
// druidG.g:118:3: ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )?
int alt68=2;
int LA68_0 = input.LA(1);
if ( (LA68_0==WS) ) {
alt68=1;
}
switch (alt68) {
case 1 :
// druidG.g:118:4: WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt817);
match(input,ROLLUP,FOLLOW_ROLLUP_in_insertHStmnt819);
// druidG.g:118:14: ( WS )?
int alt62=2;
int LA62_0 = input.LA(1);
if ( (LA62_0==WS) ) {
alt62=1;
}
switch (alt62) {
case 1 :
// druidG.g:118:14: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt821);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt824);
// druidG.g:118:25: ( WS )?
int alt63=2;
int LA63_0 = input.LA(1);
if ( (LA63_0==WS) ) {
alt63=1;
}
switch (alt63) {
case 1 :
// druidG.g:118:25: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt826);
}
break;
}
gran=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt831);
// druidG.g:118:54: ( WS )?
int alt64=2;
int LA64_0 = input.LA(1);
if ( (LA64_0==WS) ) {
alt64=1;
}
switch (alt64) {
case 1 :
// druidG.g:118:54: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt833);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt836);
// druidG.g:118:62: ( WS )?
int alt65=2;
int LA65_0 = input.LA(1);
if ( (LA65_0==WS) ) {
alt65=1;
}
switch (alt65) {
case 1 :
// druidG.g:118:62: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt838);
}
break;
}
boundary=(Token)match(input,LONG,FOLLOW_LONG_in_insertHStmnt843);
bMeta.rollupSpec.rollupGranularity=unquote((gran!=null?gran.getText():null));bMeta.rollupSpec.rowFlushBoundary=Long.valueOf((boundary!=null?boundary.getText():null));
// druidG.g:118:202: ( WS )?
int alt66=2;
int LA66_0 = input.LA(1);
if ( (LA66_0==WS) ) {
alt66=1;
}
switch (alt66) {
case 1 :
// druidG.g:118:202: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt847);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt850);
// druidG.g:118:213: ( WS )?
int alt67=2;
int LA67_0 = input.LA(1);
if ( (LA67_0==WS) ) {
alt67=1;
}
switch (alt67) {
case 1 :
// druidG.g:118:213: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt852);
}
break;
}
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return bMeta;
} } | public class class_name {
public final BatchInsertMeta insertHStmnt() throws RecognitionException {
BatchInsertMeta bMeta = null;
Token id=null;
Token paths=null;
Token gran=null;
Token delim=null;
Token listDelim=null;
Token type=null;
Token size=null;
Token boundary=null;
List<Interval> i =null;
bMeta = new BatchInsertMeta();
try {
// druidG.g:107:2: ( ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? ) FROM WS (paths= SINGLE_QUOTE_STRING ) WS ( WHERE WS i= intervalClause ) ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )? ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )? ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )? ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )? )
// druidG.g:107:3: ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? ) FROM WS (paths= SINGLE_QUOTE_STRING ) WS ( WHERE WS i= intervalClause ) ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )? ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )? ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )? ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )?
{
// druidG.g:107:3: ( INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )? )
// druidG.g:107:4: INSERT_HADOOP WS INTO WS (id= ID ) ( WS )? LPARAN ( WS )? selectItems[bMeta] ( ( WS )? ',' ( WS )? selectItems[bMeta] )* ( WS )? RPARAN ( WS )?
{
match(input,INSERT_HADOOP,FOLLOW_INSERT_HADOOP_in_insertHStmnt616);
match(input,WS,FOLLOW_WS_in_insertHStmnt618);
match(input,INTO,FOLLOW_INTO_in_insertHStmnt620);
match(input,WS,FOLLOW_WS_in_insertHStmnt622);
// druidG.g:107:29: (id= ID )
// druidG.g:107:30: id= ID
{
id=(Token)match(input,ID,FOLLOW_ID_in_insertHStmnt627);
bMeta.dataSource = (id!=null?id.getText():null);
}
// druidG.g:107:69: ( WS )?
int alt39=2;
int LA39_0 = input.LA(1);
if ( (LA39_0==WS) ) {
alt39=1; // depends on control dependency: [if], data = [none]
}
switch (alt39) {
case 1 :
// druidG.g:107:69: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt632);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt635);
// druidG.g:107:80: ( WS )?
int alt40=2;
int LA40_0 = input.LA(1);
if ( (LA40_0==WS) ) {
alt40=1; // depends on control dependency: [if], data = [none]
}
switch (alt40) {
case 1 :
// druidG.g:107:80: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt637);
}
break;
}
pushFollow(FOLLOW_selectItems_in_insertHStmnt640);
selectItems(bMeta);
state._fsp--;
// druidG.g:107:103: ( ( WS )? ',' ( WS )? selectItems[bMeta] )*
loop43:
while (true) {
int alt43=2;
int LA43_0 = input.LA(1);
if ( (LA43_0==WS) ) {
int LA43_1 = input.LA(2);
if ( (LA43_1==91) ) {
alt43=1; // depends on control dependency: [if], data = [none]
}
}
else if ( (LA43_0==91) ) {
alt43=1; // depends on control dependency: [if], data = [none]
}
switch (alt43) {
case 1 :
// druidG.g:107:104: ( WS )? ',' ( WS )? selectItems[bMeta]
{
// druidG.g:107:104: ( WS )?
int alt41=2;
int LA41_0 = input.LA(1);
if ( (LA41_0==WS) ) {
alt41=1; // depends on control dependency: [if], data = [none]
}
switch (alt41) {
case 1 :
// druidG.g:107:104: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt644);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt647);
// druidG.g:107:112: ( WS )?
int alt42=2;
int LA42_0 = input.LA(1);
if ( (LA42_0==WS) ) {
alt42=1; // depends on control dependency: [if], data = [none]
}
switch (alt42) {
case 1 :
// druidG.g:107:112: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt649);
}
break;
}
pushFollow(FOLLOW_selectItems_in_insertHStmnt652);
selectItems(bMeta);
state._fsp--;
}
break;
default :
break loop43;
}
}
// druidG.g:107:137: ( WS )?
int alt44=2;
int LA44_0 = input.LA(1);
if ( (LA44_0==WS) ) {
alt44=1; // depends on control dependency: [if], data = [none]
}
switch (alt44) {
case 1 :
// druidG.g:107:137: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt657);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt660);
// druidG.g:107:148: ( WS )?
int alt45=2;
int LA45_0 = input.LA(1);
if ( (LA45_0==WS) ) {
alt45=1; // depends on control dependency: [if], data = [none]
}
switch (alt45) {
case 1 :
// druidG.g:107:148: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt662);
}
break;
}
}
match(input,FROM,FOLLOW_FROM_in_insertHStmnt669);
match(input,WS,FOLLOW_WS_in_insertHStmnt671);
// druidG.g:108:11: (paths= SINGLE_QUOTE_STRING )
// druidG.g:108:12: paths= SINGLE_QUOTE_STRING
{
paths=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt676);
bMeta.inputSpec.setPath(unquote((paths!=null?paths.getText():null)));bMeta.inferFormat(unquote((paths!=null?paths.getText():null)));
}
match(input,WS,FOLLOW_WS_in_insertHStmnt681);
// druidG.g:109:3: ( WHERE WS i= intervalClause )
// druidG.g:109:4: WHERE WS i= intervalClause
{
match(input,WHERE,FOLLOW_WHERE_in_insertHStmnt686);
match(input,WS,FOLLOW_WS_in_insertHStmnt688);
pushFollow(FOLLOW_intervalClause_in_insertHStmnt692);
i=intervalClause();
state._fsp--;
}
// druidG.g:110:4: ( WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING )?
int alt46=2;
int LA46_0 = input.LA(1);
if ( (LA46_0==WS) ) {
int LA46_1 = input.LA(2);
if ( (LA46_1==BREAK) ) {
alt46=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt46) {
case 1 :
// druidG.g:110:5: WS BREAK WS BY WS gran= SINGLE_QUOTE_STRING
{
match(input,WS,FOLLOW_WS_in_insertHStmnt699);
match(input,BREAK,FOLLOW_BREAK_in_insertHStmnt701);
match(input,WS,FOLLOW_WS_in_insertHStmnt703);
match(input,BY,FOLLOW_BY_in_insertHStmnt705);
match(input,WS,FOLLOW_WS_in_insertHStmnt707);
gran=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt711);
bMeta.granularitySpec = new GranularitySpec(unquote((gran!=null?gran.getText():null)));
}
break;
}
// We set this later after granularitySpec object is fully formed.
if (i!= null && !i.isEmpty()) {
bMeta.granularitySpec.interval = i.get(0);// We already checked for list's emptiness(it is safe to access get(0). // depends on control dependency: [if], data = [none]
}
// druidG.g:116:3: ( WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )? )?
int alt54=2;
int LA54_0 = input.LA(1);
if ( (LA54_0==WS) ) {
int LA54_1 = input.LA(2);
if ( (LA54_1==DELIMITER) ) {
alt54=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt54) {
case 1 :
// druidG.g:116:4: WS DELIMITER ( WS )? LPARAN ( WS )? delim= SINGLE_QUOTE_STRING ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )? ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt726);
match(input,DELIMITER,FOLLOW_DELIMITER_in_insertHStmnt728);
// druidG.g:116:17: ( WS )?
int alt47=2;
int LA47_0 = input.LA(1);
if ( (LA47_0==WS) ) {
alt47=1; // depends on control dependency: [if], data = [none]
}
switch (alt47) {
case 1 :
// druidG.g:116:17: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt730);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt733);
// druidG.g:116:28: ( WS )?
int alt48=2;
int LA48_0 = input.LA(1);
if ( (LA48_0==WS) ) {
alt48=1; // depends on control dependency: [if], data = [none]
}
switch (alt48) {
case 1 :
// druidG.g:116:28: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt735);
}
break;
}
delim=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt740);
bMeta.delimiter=unicode(unquote((delim!=null?delim.getText():null)));
// druidG.g:116:106: ( ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING )?
int alt51=2;
int LA51_0 = input.LA(1);
if ( (LA51_0==WS) ) {
int LA51_1 = input.LA(2);
if ( (LA51_1==91) ) {
alt51=1; // depends on control dependency: [if], data = [none]
}
}
else if ( (LA51_0==91) ) {
alt51=1; // depends on control dependency: [if], data = [none]
}
switch (alt51) {
case 1 :
// druidG.g:116:107: ( WS )? ',' ( WS )? listDelim= SINGLE_QUOTE_STRING
{
// druidG.g:116:107: ( WS )?
int alt49=2;
int LA49_0 = input.LA(1);
if ( (LA49_0==WS) ) {
alt49=1; // depends on control dependency: [if], data = [none]
}
switch (alt49) {
case 1 :
// druidG.g:116:107: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt744);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt747);
// druidG.g:116:115: ( WS )?
int alt50=2;
int LA50_0 = input.LA(1);
if ( (LA50_0==WS) ) {
alt50=1; // depends on control dependency: [if], data = [none]
}
switch (alt50) {
case 1 :
// druidG.g:116:115: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt749);
}
break;
}
listDelim=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt754);
bMeta.listDelimiter=unicode(unquote((listDelim!=null?listDelim.getText():null)));
}
break;
}
// druidG.g:116:208: ( WS )?
int alt52=2;
int LA52_0 = input.LA(1);
if ( (LA52_0==WS) ) {
alt52=1; // depends on control dependency: [if], data = [none]
}
switch (alt52) {
case 1 :
// druidG.g:116:208: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt760);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt763);
// druidG.g:116:219: ( WS )?
int alt53=2;
int LA53_0 = input.LA(1);
if ( (LA53_0==WS) ) {
int LA53_1 = input.LA(2);
if ( (LA53_1==EOF||LA53_1==WS) ) {
alt53=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt53) {
case 1 :
// druidG.g:116:219: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt765);
}
break;
}
}
break;
}
// druidG.g:117:3: ( WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )? )?
int alt61=2;
int LA61_0 = input.LA(1);
if ( (LA61_0==WS) ) {
int LA61_1 = input.LA(2);
if ( (LA61_1==PARTITION) ) {
alt61=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt61) {
case 1 :
// druidG.g:117:4: WS PARTITION ( WS )? LPARAN ( WS )? type= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? size= LONG ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt774);
match(input,PARTITION,FOLLOW_PARTITION_in_insertHStmnt776);
// druidG.g:117:17: ( WS )?
int alt55=2;
int LA55_0 = input.LA(1);
if ( (LA55_0==WS) ) {
alt55=1; // depends on control dependency: [if], data = [none]
}
switch (alt55) {
case 1 :
// druidG.g:117:17: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt778);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt781);
// druidG.g:117:28: ( WS )?
int alt56=2;
int LA56_0 = input.LA(1);
if ( (LA56_0==WS) ) {
alt56=1; // depends on control dependency: [if], data = [none]
}
switch (alt56) {
case 1 :
// druidG.g:117:28: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt783);
}
break;
}
type=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt788);
// druidG.g:117:57: ( WS )?
int alt57=2;
int LA57_0 = input.LA(1);
if ( (LA57_0==WS) ) {
alt57=1; // depends on control dependency: [if], data = [none]
}
switch (alt57) {
case 1 :
// druidG.g:117:57: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt790);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt793);
// druidG.g:117:65: ( WS )?
int alt58=2;
int LA58_0 = input.LA(1);
if ( (LA58_0==WS) ) {
alt58=1; // depends on control dependency: [if], data = [none]
}
switch (alt58) {
case 1 :
// druidG.g:117:65: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt795);
}
break;
}
size=(Token)match(input,LONG,FOLLOW_LONG_in_insertHStmnt800);
bMeta.partitionsSpec.type=unquote((type!=null?type.getText():null));bMeta.partitionsSpec.targetPartitionSize=Long.valueOf((size!=null?size.getText():null));
// druidG.g:117:195: ( WS )?
int alt59=2;
int LA59_0 = input.LA(1);
if ( (LA59_0==WS) ) {
alt59=1; // depends on control dependency: [if], data = [none]
}
switch (alt59) {
case 1 :
// druidG.g:117:195: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt804);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt807);
// druidG.g:117:206: ( WS )?
int alt60=2;
int LA60_0 = input.LA(1);
if ( (LA60_0==WS) ) {
int LA60_1 = input.LA(2);
if ( (LA60_1==EOF||LA60_1==WS) ) {
alt60=1; // depends on control dependency: [if], data = [none]
}
}
switch (alt60) {
case 1 :
// druidG.g:117:206: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt809);
}
break;
}
}
break;
}
// druidG.g:118:3: ( WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )? )?
int alt68=2;
int LA68_0 = input.LA(1);
if ( (LA68_0==WS) ) {
alt68=1; // depends on control dependency: [if], data = [none]
}
switch (alt68) {
case 1 :
// druidG.g:118:4: WS ROLLUP ( WS )? LPARAN ( WS )? gran= SINGLE_QUOTE_STRING ( WS )? ',' ( WS )? boundary= LONG ( WS )? RPARAN ( WS )?
{
match(input,WS,FOLLOW_WS_in_insertHStmnt817);
match(input,ROLLUP,FOLLOW_ROLLUP_in_insertHStmnt819);
// druidG.g:118:14: ( WS )?
int alt62=2;
int LA62_0 = input.LA(1);
if ( (LA62_0==WS) ) {
alt62=1; // depends on control dependency: [if], data = [none]
}
switch (alt62) {
case 1 :
// druidG.g:118:14: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt821);
}
break;
}
match(input,LPARAN,FOLLOW_LPARAN_in_insertHStmnt824);
// druidG.g:118:25: ( WS )?
int alt63=2;
int LA63_0 = input.LA(1);
if ( (LA63_0==WS) ) {
alt63=1; // depends on control dependency: [if], data = [none]
}
switch (alt63) {
case 1 :
// druidG.g:118:25: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt826);
}
break;
}
gran=(Token)match(input,SINGLE_QUOTE_STRING,FOLLOW_SINGLE_QUOTE_STRING_in_insertHStmnt831);
// druidG.g:118:54: ( WS )?
int alt64=2;
int LA64_0 = input.LA(1);
if ( (LA64_0==WS) ) {
alt64=1; // depends on control dependency: [if], data = [none]
}
switch (alt64) {
case 1 :
// druidG.g:118:54: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt833);
}
break;
}
match(input,91,FOLLOW_91_in_insertHStmnt836);
// druidG.g:118:62: ( WS )?
int alt65=2;
int LA65_0 = input.LA(1);
if ( (LA65_0==WS) ) {
alt65=1; // depends on control dependency: [if], data = [none]
}
switch (alt65) {
case 1 :
// druidG.g:118:62: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt838);
}
break;
}
boundary=(Token)match(input,LONG,FOLLOW_LONG_in_insertHStmnt843);
bMeta.rollupSpec.rollupGranularity=unquote((gran!=null?gran.getText():null));bMeta.rollupSpec.rowFlushBoundary=Long.valueOf((boundary!=null?boundary.getText():null));
// druidG.g:118:202: ( WS )?
int alt66=2;
int LA66_0 = input.LA(1);
if ( (LA66_0==WS) ) {
alt66=1; // depends on control dependency: [if], data = [none]
}
switch (alt66) {
case 1 :
// druidG.g:118:202: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt847);
}
break;
}
match(input,RPARAN,FOLLOW_RPARAN_in_insertHStmnt850);
// druidG.g:118:213: ( WS )?
int alt67=2;
int LA67_0 = input.LA(1);
if ( (LA67_0==WS) ) {
alt67=1; // depends on control dependency: [if], data = [none]
}
switch (alt67) {
case 1 :
// druidG.g:118:213: WS
{
match(input,WS,FOLLOW_WS_in_insertHStmnt852);
}
break;
}
}
break;
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
}
return bMeta;
} } |
public class class_name {
public Optional<BigDecimal> getMin() {
if (property instanceof BaseIntegerProperty) {
BaseIntegerProperty integerProperty = (BaseIntegerProperty) property;
return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null);
} else if (property instanceof AbstractNumericProperty) {
AbstractNumericProperty numericProperty = (AbstractNumericProperty) property;
return Optional.ofNullable(numericProperty.getMinimum());
}
return Optional.empty();
} } | public class class_name {
public Optional<BigDecimal> getMin() {
if (property instanceof BaseIntegerProperty) {
BaseIntegerProperty integerProperty = (BaseIntegerProperty) property;
return Optional.ofNullable(integerProperty.getMinimum() != null ? integerProperty.getMinimum() : null); // depends on control dependency: [if], data = [none]
} else if (property instanceof AbstractNumericProperty) {
AbstractNumericProperty numericProperty = (AbstractNumericProperty) property;
return Optional.ofNullable(numericProperty.getMinimum()); // depends on control dependency: [if], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public final void addPathManagerResources(Resource resource) {
synchronized (pathEntries) {
for (PathEntry pathEntry : pathEntries.values()) {
resource.registerChild(PathElement.pathElement(PATH, pathEntry.getName()), new HardcodedPathResource(PATH, pathEntry));
}
}
} } | public class class_name {
public final void addPathManagerResources(Resource resource) {
synchronized (pathEntries) {
for (PathEntry pathEntry : pathEntries.values()) {
resource.registerChild(PathElement.pathElement(PATH, pathEntry.getName()), new HardcodedPathResource(PATH, pathEntry)); // depends on control dependency: [for], data = [pathEntry]
}
}
} } |
public class class_name {
protected Icon getHeaderRendererIcon(boolean bCurrentOrder) {
// Get current classloader
ClassLoader cl = this.getClass().getClassLoader();
// Create icons
try {
if (ASCENDING_ICON == null)
{
ASCENDING_ICON = new ImageIcon(cl.getResource("images/buttons/" + ASCENDING_ICON_NAME + ".gif"));
DESCENDING_ICON = new ImageIcon(cl.getResource("images/buttons/" + DESCENDING_ICON_NAME + ".gif"));
}
return bCurrentOrder ? ASCENDING_ICON : DESCENDING_ICON;
} catch (Exception ex) {
}
return null;
} } | public class class_name {
protected Icon getHeaderRendererIcon(boolean bCurrentOrder) {
// Get current classloader
ClassLoader cl = this.getClass().getClassLoader();
// Create icons
try {
if (ASCENDING_ICON == null)
{
ASCENDING_ICON = new ImageIcon(cl.getResource("images/buttons/" + ASCENDING_ICON_NAME + ".gif")); // depends on control dependency: [if], data = [none]
DESCENDING_ICON = new ImageIcon(cl.getResource("images/buttons/" + DESCENDING_ICON_NAME + ".gif")); // depends on control dependency: [if], data = [none]
}
return bCurrentOrder ? ASCENDING_ICON : DESCENDING_ICON; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private void processDependencies()
{
Set<Task> tasksWithBars = new HashSet<Task>();
FastTrackTable table = m_data.getTable(FastTrackTableType.ACTBARS);
for (MapRow row : table)
{
Task task = m_project.getTaskByUniqueID(row.getInteger(ActBarField._ACTIVITY));
if (task == null || tasksWithBars.contains(task))
{
continue;
}
tasksWithBars.add(task);
String predecessors = row.getString(ActBarField.PREDECESSORS);
if (predecessors == null || predecessors.isEmpty())
{
continue;
}
for (String predecessor : predecessors.split(", "))
{
Matcher matcher = RELATION_REGEX.matcher(predecessor);
matcher.matches();
Integer id = Integer.valueOf(matcher.group(1));
RelationType type = RELATION_TYPE_MAP.get(matcher.group(3));
if (type == null)
{
type = RelationType.FINISH_START;
}
String sign = matcher.group(4);
double lag = NumberHelper.getDouble(matcher.group(5));
if ("-".equals(sign))
{
lag = -lag;
}
Task targetTask = m_project.getTaskByID(id);
if (targetTask != null)
{
Duration lagDuration = Duration.getInstance(lag, m_data.getDurationTimeUnit());
Relation relation = task.addPredecessor(targetTask, type, lagDuration);
m_eventManager.fireRelationReadEvent(relation);
}
}
}
} } | public class class_name {
private void processDependencies()
{
Set<Task> tasksWithBars = new HashSet<Task>();
FastTrackTable table = m_data.getTable(FastTrackTableType.ACTBARS);
for (MapRow row : table)
{
Task task = m_project.getTaskByUniqueID(row.getInteger(ActBarField._ACTIVITY));
if (task == null || tasksWithBars.contains(task))
{
continue;
}
tasksWithBars.add(task); // depends on control dependency: [for], data = [none]
String predecessors = row.getString(ActBarField.PREDECESSORS);
if (predecessors == null || predecessors.isEmpty())
{
continue;
}
for (String predecessor : predecessors.split(", "))
{
Matcher matcher = RELATION_REGEX.matcher(predecessor);
matcher.matches(); // depends on control dependency: [for], data = [none]
Integer id = Integer.valueOf(matcher.group(1));
RelationType type = RELATION_TYPE_MAP.get(matcher.group(3));
if (type == null)
{
type = RelationType.FINISH_START; // depends on control dependency: [if], data = [none]
}
String sign = matcher.group(4);
double lag = NumberHelper.getDouble(matcher.group(5));
if ("-".equals(sign))
{
lag = -lag; // depends on control dependency: [if], data = [none]
}
Task targetTask = m_project.getTaskByID(id);
if (targetTask != null)
{
Duration lagDuration = Duration.getInstance(lag, m_data.getDurationTimeUnit());
Relation relation = task.addPredecessor(targetTask, type, lagDuration);
m_eventManager.fireRelationReadEvent(relation); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public int cardinality() {
int w = value;
int c = 0;
while (w != 0) {
c += T[w & 255];
w >>= 8;
}
return c;
} } | public class class_name {
public int cardinality() {
int w = value;
int c = 0;
while (w != 0) {
c += T[w & 255]; // depends on control dependency: [while], data = [none]
w >>= 8; // depends on control dependency: [while], data = [none]
}
return c;
} } |
public class class_name {
public String getTileProperty(int tileID, String propertyName, String def) {
if (tileID == 0) {
return def;
}
TileSet set = findTileSet(tileID);
Properties props = set.getProperties(tileID);
if (props == null) {
return def;
}
return props.getProperty(propertyName, def);
} } | public class class_name {
public String getTileProperty(int tileID, String propertyName, String def) {
if (tileID == 0) {
return def;
// depends on control dependency: [if], data = [none]
}
TileSet set = findTileSet(tileID);
Properties props = set.getProperties(tileID);
if (props == null) {
return def;
// depends on control dependency: [if], data = [none]
}
return props.getProperty(propertyName, def);
} } |
public class class_name {
public ListDomainsResult withDomains(DomainSummary... domains) {
if (this.domains == null) {
setDomains(new java.util.ArrayList<DomainSummary>(domains.length));
}
for (DomainSummary ele : domains) {
this.domains.add(ele);
}
return this;
} } | public class class_name {
public ListDomainsResult withDomains(DomainSummary... domains) {
if (this.domains == null) {
setDomains(new java.util.ArrayList<DomainSummary>(domains.length)); // depends on control dependency: [if], data = [none]
}
for (DomainSummary ele : domains) {
this.domains.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
static BackoffSpec parse(String specification) {
requireNonNull(specification, "specification");
final BackoffSpec spec = new BackoffSpec(specification);
for (String option : OPTION_SPLITTER.split(specification)) {
spec.parseOption(option);
}
return spec;
} } | public class class_name {
static BackoffSpec parse(String specification) {
requireNonNull(specification, "specification");
final BackoffSpec spec = new BackoffSpec(specification);
for (String option : OPTION_SPLITTER.split(specification)) {
spec.parseOption(option); // depends on control dependency: [for], data = [option]
}
return spec;
} } |
public class class_name {
private void handleBrowse() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
"Select new file container");
if (dialog.open() == ContainerSelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
projectText.setText(((Path) result[0]).toString());
}
}
} } | public class class_name {
private void handleBrowse() {
ContainerSelectionDialog dialog = new ContainerSelectionDialog(
getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
"Select new file container");
if (dialog.open() == ContainerSelectionDialog.OK) {
Object[] result = dialog.getResult();
if (result.length == 1) {
projectText.setText(((Path) result[0]).toString()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void createSchemaOnDb() {
StringBuilder sql = new StringBuilder();
sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name));
if (this.sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";");
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString());
}
Connection conn = this.sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
logger.error("schema creation failed " + this.sqlgGraph.toString(), e);
throw new RuntimeException(e);
}
} } | public class class_name {
private void createSchemaOnDb() {
StringBuilder sql = new StringBuilder();
sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name));
if (this.sqlgGraph.getSqlDialect().needsSemicolon()) {
sql.append(";"); // depends on control dependency: [if], data = [none]
}
if (logger.isDebugEnabled()) {
logger.debug(sql.toString()); // depends on control dependency: [if], data = [none]
}
Connection conn = this.sqlgGraph.tx().getConnection();
try (Statement stmt = conn.createStatement()) {
stmt.execute(sql.toString());
} catch (SQLException e) {
logger.error("schema creation failed " + this.sqlgGraph.toString(), e);
throw new RuntimeException(e);
}
} } |
public class class_name {
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> listPremierAddOnOffersSinglePageAsync() {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
return service.listPremierAddOnOffers(this.subscriptionId(), this.apiVersion(), this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PremierAddOnOfferInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PremierAddOnOfferInner>> result = listPremierAddOnOffersDelegate(response);
return Observable.just(new ServiceResponse<Page<PremierAddOnOfferInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> listPremierAddOnOffersSinglePageAsync() {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
return service.listPremierAddOnOffers(this.subscriptionId(), this.apiVersion(), this.acceptLanguage(), this.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<PremierAddOnOfferInner>>>>() {
@Override
public Observable<ServiceResponse<Page<PremierAddOnOfferInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<PremierAddOnOfferInner>> result = listPremierAddOnOffersDelegate(response);
return Observable.just(new ServiceResponse<Page<PremierAddOnOfferInner>>(result.body(), result.response())); // 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 static String generateArgline(final String scriptpath, final String[] args, final String separator, final Boolean unsafe) {
final StringBuilder sb = new StringBuilder();
final ArrayList<String> list = new ArrayList<String>();
if (null != scriptpath) {
list.add(scriptpath);
}
if (null != args) {
list.addAll(Arrays.asList(args));
}
for (final String arg : list) {
if(null==arg){
continue;
}
if (sb.length() > 0) {
sb.append(separator);
}
if(unsafe) {
/* DEPRECATED SECURITY RISK: Exists for backwards compatibility only. */
if (arg.indexOf(" ") >= 0 && !(0 == arg.indexOf("'") && (arg.length() - 1) == arg.lastIndexOf("'"))) {
sb.append("'").append(arg).append("'");
} else {
sb.append(arg);
}
} else {
quoteUnixShellArg(sb, arg);
}
}
return sb.toString();
} } | public class class_name {
public static String generateArgline(final String scriptpath, final String[] args, final String separator, final Boolean unsafe) {
final StringBuilder sb = new StringBuilder();
final ArrayList<String> list = new ArrayList<String>();
if (null != scriptpath) {
list.add(scriptpath); // depends on control dependency: [if], data = [scriptpath)]
}
if (null != args) {
list.addAll(Arrays.asList(args)); // depends on control dependency: [if], data = [args)]
}
for (final String arg : list) {
if(null==arg){
continue;
}
if (sb.length() > 0) {
sb.append(separator); // depends on control dependency: [if], data = [none]
}
if(unsafe) {
/* DEPRECATED SECURITY RISK: Exists for backwards compatibility only. */
if (arg.indexOf(" ") >= 0 && !(0 == arg.indexOf("'") && (arg.length() - 1) == arg.lastIndexOf("'"))) {
sb.append("'").append(arg).append("'"); // depends on control dependency: [if], data = [none]
} else {
sb.append(arg); // depends on control dependency: [if], data = [none]
}
} else {
quoteUnixShellArg(sb, arg); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public void addInjectionTarget(Member member)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "addInjectionTarget: " + member);
// -----------------------------------------------------------------------
// First, determine if the target being added is already in the list.
// This may occur if the target is specified in both XML and annotations
// (an override) or if multiple interceptors inherit from a base class
// where the base class contains an injection annotation. d457733
//
// Next, determine if the customer has incorrectly attempted to inject
// into both the field and corresponding java beans property method.
// This is not allowed per the JavaEE, EJB 3.0 Specifications. d447011.2
//
// Finally, note that if the XML target resulted in the method, but the
// annotation is on the field, then the XML should really be considered
// to be overriding the field injection, so don't throw an exception
// and instead just remove the previous target from XML. d510950
// -----------------------------------------------------------------------
boolean containsTarget = false;
String existingMemberName = null;
String toAddMemberName = null;
InjectionTarget injectionTarget = null;
if (ivInjectionTargets != null)
{
for (InjectionTarget target : ivInjectionTargets)
{
Member targetMember = target.getMember();
if (targetMember.equals(member))
{
// Reset 'fromXML' since it also matches an annotation. Reseting
// this allows us to detect when they have annotations on both
// the field and set method. PK92087
target.ivFromXML = false;
// Already in list, break out and check for error below, or ignore
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "found: " + target);
injectionTarget = target; // save for trace d643444
containsTarget = true;
break;
}
// If both are from the same class, then check for 'double' injection
// into both the field and method for a 'property. d510950
if (targetMember.getDeclaringClass() == member.getDeclaringClass())
{
// Obtain the 'property' method name from the existing target
if (targetMember instanceof Method) {
existingMemberName = targetMember.getName();
} else {
existingMemberName = getMethodFromProperty(targetMember.getName());
}
// Obtain the 'property' method name from the target being added
if (member instanceof Method) {
toAddMemberName = member.getName();
} else {
toAddMemberName = getMethodFromProperty(member.getName());
}
// When equal, injection has been specified for both field an method.
if (existingMemberName.equals(toAddMemberName))
{
if (target.ivFromXML)
{
// If the existing one came from XML, then it must be the
// method, but is really intended to be an override of the
// field annotation... so just remove the method target
// and let the field target be added below. d510950
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "removing: " + targetMember.getName());
ivInjectionTargets.remove(target);
break;
}
// Annotation present on both the field and method... error.
Tr.error(tc, "INJECTION_DECLARED_IN_BOTH_THE_FIELD_AND_METHOD_OF_A_BEAN_CWNEN0056E",
ivJndiName,
member.getDeclaringClass().getName(),
ivNameSpaceConfig.getModuleName(),
ivNameSpaceConfig.getApplicationName());
throw new InjectionConfigurationException("Injection of the " + ivJndiName +
" resource was specified for both a property instance" +
" variable and its corresponding set method on the " +
member.getDeclaringClass().getName() + " class in the " +
ivNameSpaceConfig.getModuleName() + " module of the " +
ivNameSpaceConfig.getApplicationName() + " application.");
}
}
}
}
// -----------------------------------------------------------------------
// The following is stated in the EJB Specification overriding rules:
//
// The injection target, if specified, must name exactly the annotated
// field or property method.
//
// Previously (EJB 3.0 Feature Pack and WAS 7.0) this was interpreted to
// mean that if any targets were specified in XML, then the XML must
// contain targets for every annotation. So, if the target being added
// due to an annotation is NOT present in the list, then it was not
// specified in XML, which would have been an error. WAS did support
// adding additional targets from XML, but there had to also be a target
// for every annotation.
//
// Since that time, it has been realized that this can be quite annoying
// to customers, as they must duplicate annotation information just to
// specify an extra injection target. Also, this could be quite difficult
// to enforce for EJBs in WAR modules, where targets and EJB references
// can now be defined in many different locations.
//
// Beginning in WAS 8.0, the above rule is now being interpreted to mean
// only that if a target in XML matches an annotation, then that target
// is considered an override of that annotation and has really very
// little effect. Additional targets in XML are not considered overrides
// of any annotations, and are just additional targets. Thus, targets
// from XML do not globally replace all targets from annotations, but
// just add to them. d643444
//
// Also note that the rule indicates it is an override when they are an
// exact match, so if the target was in XML, but was for a set method,
// and the annotation was for the field... then it is assumed the XML
// target was really the field (there is no way to indicate field in XML),
// so the above code would have removed the method target, and will
// expect the code below to add the field target; this is not an error.
// To not assume these are an exact match would otherwise always result
// in an error, since injection may not occur into both the field and
// corresponding set method.
//
// Otherwise, if the XML specified no targets, then this is just an add
// due to an annotation. As long as the target is not already in the
// list, then just add it (i.e. no duplicates).
//
// In this scenario, the target may already be in the list if multiple
// classes being injected both inherit from the same base class. The
// target will only be added once, and later will be 'collected' into
// the InjectionTarget arrays for both subclasses. d457733
// -----------------------------------------------------------------------
if (!containsTarget)
{
if (member instanceof Field)
{
injectionTarget = new InjectionTargetField((Field) member, this);
}
else
{
injectionTarget = createInjectionTarget((Method) member, this);
}
injectionTarget.setInjectionBinding(this);
addInjectionTarget(injectionTarget);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "addInjectionTarget : " +
((containsTarget) ? "(duplicate) " : "") + injectionTarget);
} } | public class class_name {
public void addInjectionTarget(Member member)
throws InjectionException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "addInjectionTarget: " + member);
// -----------------------------------------------------------------------
// First, determine if the target being added is already in the list.
// This may occur if the target is specified in both XML and annotations
// (an override) or if multiple interceptors inherit from a base class
// where the base class contains an injection annotation. d457733
//
// Next, determine if the customer has incorrectly attempted to inject
// into both the field and corresponding java beans property method.
// This is not allowed per the JavaEE, EJB 3.0 Specifications. d447011.2
//
// Finally, note that if the XML target resulted in the method, but the
// annotation is on the field, then the XML should really be considered
// to be overriding the field injection, so don't throw an exception
// and instead just remove the previous target from XML. d510950
// -----------------------------------------------------------------------
boolean containsTarget = false;
String existingMemberName = null;
String toAddMemberName = null;
InjectionTarget injectionTarget = null;
if (ivInjectionTargets != null)
{
for (InjectionTarget target : ivInjectionTargets)
{
Member targetMember = target.getMember();
if (targetMember.equals(member))
{
// Reset 'fromXML' since it also matches an annotation. Reseting
// this allows us to detect when they have annotations on both
// the field and set method. PK92087
target.ivFromXML = false; // depends on control dependency: [if], data = [none]
// Already in list, break out and check for error below, or ignore
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "found: " + target);
injectionTarget = target; // save for trace d643444 // depends on control dependency: [if], data = [none]
containsTarget = true; // depends on control dependency: [if], data = [none]
break;
}
// If both are from the same class, then check for 'double' injection
// into both the field and method for a 'property. d510950
if (targetMember.getDeclaringClass() == member.getDeclaringClass())
{
// Obtain the 'property' method name from the existing target
if (targetMember instanceof Method) {
existingMemberName = targetMember.getName(); // depends on control dependency: [if], data = [none]
} else {
existingMemberName = getMethodFromProperty(targetMember.getName()); // depends on control dependency: [if], data = [none]
}
// Obtain the 'property' method name from the target being added
if (member instanceof Method) {
toAddMemberName = member.getName(); // depends on control dependency: [if], data = [none]
} else {
toAddMemberName = getMethodFromProperty(member.getName()); // depends on control dependency: [if], data = [none]
}
// When equal, injection has been specified for both field an method.
if (existingMemberName.equals(toAddMemberName))
{
if (target.ivFromXML)
{
// If the existing one came from XML, then it must be the
// method, but is really intended to be an override of the
// field annotation... so just remove the method target
// and let the field target be added below. d510950
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "removing: " + targetMember.getName());
ivInjectionTargets.remove(target); // depends on control dependency: [if], data = [none]
break;
}
// Annotation present on both the field and method... error.
Tr.error(tc, "INJECTION_DECLARED_IN_BOTH_THE_FIELD_AND_METHOD_OF_A_BEAN_CWNEN0056E",
ivJndiName,
member.getDeclaringClass().getName(),
ivNameSpaceConfig.getModuleName(),
ivNameSpaceConfig.getApplicationName()); // depends on control dependency: [if], data = [none]
throw new InjectionConfigurationException("Injection of the " + ivJndiName +
" resource was specified for both a property instance" +
" variable and its corresponding set method on the " +
member.getDeclaringClass().getName() + " class in the " +
ivNameSpaceConfig.getModuleName() + " module of the " +
ivNameSpaceConfig.getApplicationName() + " application.");
}
}
}
}
// -----------------------------------------------------------------------
// The following is stated in the EJB Specification overriding rules:
//
// The injection target, if specified, must name exactly the annotated
// field or property method.
//
// Previously (EJB 3.0 Feature Pack and WAS 7.0) this was interpreted to
// mean that if any targets were specified in XML, then the XML must
// contain targets for every annotation. So, if the target being added
// due to an annotation is NOT present in the list, then it was not
// specified in XML, which would have been an error. WAS did support
// adding additional targets from XML, but there had to also be a target
// for every annotation.
//
// Since that time, it has been realized that this can be quite annoying
// to customers, as they must duplicate annotation information just to
// specify an extra injection target. Also, this could be quite difficult
// to enforce for EJBs in WAR modules, where targets and EJB references
// can now be defined in many different locations.
//
// Beginning in WAS 8.0, the above rule is now being interpreted to mean
// only that if a target in XML matches an annotation, then that target
// is considered an override of that annotation and has really very
// little effect. Additional targets in XML are not considered overrides
// of any annotations, and are just additional targets. Thus, targets
// from XML do not globally replace all targets from annotations, but
// just add to them. d643444
//
// Also note that the rule indicates it is an override when they are an
// exact match, so if the target was in XML, but was for a set method,
// and the annotation was for the field... then it is assumed the XML
// target was really the field (there is no way to indicate field in XML),
// so the above code would have removed the method target, and will
// expect the code below to add the field target; this is not an error.
// To not assume these are an exact match would otherwise always result
// in an error, since injection may not occur into both the field and
// corresponding set method.
//
// Otherwise, if the XML specified no targets, then this is just an add
// due to an annotation. As long as the target is not already in the
// list, then just add it (i.e. no duplicates).
//
// In this scenario, the target may already be in the list if multiple
// classes being injected both inherit from the same base class. The
// target will only be added once, and later will be 'collected' into
// the InjectionTarget arrays for both subclasses. d457733
// -----------------------------------------------------------------------
if (!containsTarget)
{
if (member instanceof Field)
{
injectionTarget = new InjectionTargetField((Field) member, this);
}
else
{
injectionTarget = createInjectionTarget((Method) member, this);
}
injectionTarget.setInjectionBinding(this);
addInjectionTarget(injectionTarget);
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "addInjectionTarget : " +
((containsTarget) ? "(duplicate) " : "") + injectionTarget);
} } |
public class class_name {
public ReplicatedData<K, V> getReplicateData(
boolean activateDataRemovedCallback) {
if (replicatedData == null) {
replicatedData = new ReplicatedDataImpl<K, V>(REPLICATED_DATA_NAME,
raEntity, sleeContainer.getCluster(), ra,
activateDataRemovedCallback);
}
return replicatedData;
} } | public class class_name {
public ReplicatedData<K, V> getReplicateData(
boolean activateDataRemovedCallback) {
if (replicatedData == null) {
replicatedData = new ReplicatedDataImpl<K, V>(REPLICATED_DATA_NAME,
raEntity, sleeContainer.getCluster(), ra,
activateDataRemovedCallback); // depends on control dependency: [if], data = [none]
}
return replicatedData;
} } |
public class class_name {
@Override
public final void encodeBegin(final FacesContext context)
throws IOException {
webSheetBean = (TieWebSheetBean) this.getAttributes()
.get(TieConstants.ATTRS_WEBSHEETBEAN);
if ((webSheetBean != null)
&& (webSheetBean.getWebFormClientId() == null)) {
LOG.fine("WebSheet component parameter setup");
webSheetBean.setClientId(this.getClientId());
webSheetBean.setWebFormClientId(
this.getClientId() + ":" + TieConstants.COMPONENT_ID);
String maxrows = (String) this.getAttributes()
.get("maxRowsPerPage");
if ((maxrows != null) && (!maxrows.isEmpty())) {
webSheetBean.setMaxRowsPerPage(Integer.valueOf(maxrows));
}
Boolean hideSingleSheetTabTitle = (Boolean) this.getAttributes()
.get("hideSingleSheetTabTitle");
if (hideSingleSheetTabTitle != null) {
webSheetBean.setHideSingleSheetTabTitle(
hideSingleSheetTabTitle);
}
}
super.encodeBegin(context);
} } | public class class_name {
@Override
public final void encodeBegin(final FacesContext context)
throws IOException {
webSheetBean = (TieWebSheetBean) this.getAttributes()
.get(TieConstants.ATTRS_WEBSHEETBEAN);
if ((webSheetBean != null)
&& (webSheetBean.getWebFormClientId() == null)) {
LOG.fine("WebSheet component parameter setup");
webSheetBean.setClientId(this.getClientId());
webSheetBean.setWebFormClientId(
this.getClientId() + ":" + TieConstants.COMPONENT_ID);
String maxrows = (String) this.getAttributes()
.get("maxRowsPerPage");
if ((maxrows != null) && (!maxrows.isEmpty())) {
webSheetBean.setMaxRowsPerPage(Integer.valueOf(maxrows));
// depends on control dependency: [if], data = [none]
}
Boolean hideSingleSheetTabTitle = (Boolean) this.getAttributes()
.get("hideSingleSheetTabTitle");
if (hideSingleSheetTabTitle != null) {
webSheetBean.setHideSingleSheetTabTitle(
hideSingleSheetTabTitle);
// depends on control dependency: [if], data = [none]
}
}
super.encodeBegin(context);
} } |
public class class_name {
public double getConvertFactor(CalendarPeriod from) {
if (field == CalendarPeriod.Field.Month || field == CalendarPeriod.Field.Year) {
log.warn(" CalendarDate.convert on Month or Year");
}
return (double) from.millisecs() / millisecs();
} } | public class class_name {
public double getConvertFactor(CalendarPeriod from) {
if (field == CalendarPeriod.Field.Month || field == CalendarPeriod.Field.Year) {
log.warn(" CalendarDate.convert on Month or Year");
// depends on control dependency: [if], data = [none]
}
return (double) from.millisecs() / millisecs();
} } |
public class class_name {
protected Integer getSrid() throws IOException {
Map<String, Object> crsContent = getTypedParam("crs", null, Map.class);
if (crsContent != null) {
if (crsContent.get("type") == null || !"name".equals(crsContent.get("type"))) {
throw new IOException("If the crs is specified the type must be specified. Currently, only named crses are supported.");
}
Object properties = crsContent.get("properties");
if (properties == null || !(properties instanceof Map) || (!((Map) properties).containsKey("name"))) {
throw new IOException("A crs specification requires a properties value containing a name value.");
}
String sridString = ((Map) properties).get("name").toString();
if (sridString.startsWith("EPSG:")) {
Integer srid = parseDefault(sridString.substring(5), (Integer) null);
if (srid == null) {
throw new IOException("Unable to derive SRID from crs name");
} else {
return srid;
}
} else if (sridString.startsWith("urn:ogc:def:crs:EPSG:")) {
String[] splits = sridString.split(":");
if (splits.length != 7) {
throw new IOException("Unable to derive SRID from crs name");
} else {
Integer srid = parseDefault(splits[6], (Integer) null);
if (srid == null) {
throw new IOException("Unable to derive SRID from crs name");
}
return srid;
}
} else {
throw new IOException("Unable to derive SRID from crs name");
}
}
return null;
} } | public class class_name {
protected Integer getSrid() throws IOException {
Map<String, Object> crsContent = getTypedParam("crs", null, Map.class);
if (crsContent != null) {
if (crsContent.get("type") == null || !"name".equals(crsContent.get("type"))) {
throw new IOException("If the crs is specified the type must be specified. Currently, only named crses are supported.");
}
Object properties = crsContent.get("properties");
if (properties == null || !(properties instanceof Map) || (!((Map) properties).containsKey("name"))) {
throw new IOException("A crs specification requires a properties value containing a name value.");
}
String sridString = ((Map) properties).get("name").toString();
if (sridString.startsWith("EPSG:")) {
Integer srid = parseDefault(sridString.substring(5), (Integer) null);
if (srid == null) {
throw new IOException("Unable to derive SRID from crs name");
} else {
return srid; // depends on control dependency: [if], data = [none]
}
} else if (sridString.startsWith("urn:ogc:def:crs:EPSG:")) {
String[] splits = sridString.split(":");
if (splits.length != 7) {
throw new IOException("Unable to derive SRID from crs name");
} else {
Integer srid = parseDefault(splits[6], (Integer) null);
if (srid == null) {
throw new IOException("Unable to derive SRID from crs name");
}
return srid; // depends on control dependency: [if], data = [none]
}
} else {
throw new IOException("Unable to derive SRID from crs name");
}
}
return null;
} } |
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId)
throws RemoteException {
// Get the AdGroupAdService.
AdGroupAdServiceInterface adGroupAdService =
adWordsServices.get(session, AdGroupAdServiceInterface.class);
ServiceQuery serviceQuery =
new ServiceQuery.Builder()
.fields(AdGroupAdField.Id, AdGroupAdField.PolicySummary)
.where(AdGroupAdField.AdGroupId).equalTo(adGroupId)
.where(AdGroupAdField.CombinedApprovalStatus)
.equalTo(PolicyApprovalStatus.DISAPPROVED.getValue())
.orderBy(AdGroupAdField.Id, SortOrder.ASCENDING)
.limit(0, PAGE_SIZE)
.build();
// Get all disapproved ads.
AdGroupAdPage page = null;
int disapprovedAdsCount = 0;
do {
serviceQuery.nextPage(page);
page = adGroupAdService.query(serviceQuery.toString());
// Display ads.
for (AdGroupAd adGroupAd : page) {
disapprovedAdsCount++;
AdGroupAdPolicySummary policySummary = adGroupAd.getPolicySummary();
System.out.printf(
"Ad with ID %d and type '%s' was disapproved with the following "
+ "policy topic entries:%n",
adGroupAd.getAd().getId(), adGroupAd.getAd().getAdType());
// Display the policy topic entries related to the ad disapproval.
for (PolicyTopicEntry policyTopicEntry : policySummary.getPolicyTopicEntries()) {
System.out.printf(
" topic id: %s, topic name: '%s'%n",
policyTopicEntry.getPolicyTopicId(), policyTopicEntry.getPolicyTopicName());
// Display the attributes and values that triggered the policy topic.
if (policyTopicEntry.getPolicyTopicEvidences() != null) {
for (PolicyTopicEvidence evidence : policyTopicEntry.getPolicyTopicEvidences()) {
System.out.printf(" evidence type: %s%n", evidence.getPolicyTopicEvidenceType());
if (evidence.getEvidenceTextList() != null) {
for (int i = 0; i < evidence.getEvidenceTextList().length; i++) {
System.out.printf(
" evidence text[%d]: %s%n", i, evidence.getEvidenceTextList(i));
}
}
}
}
}
}
} while (serviceQuery.hasNext(page));
System.out.printf("%d disapproved ads were found.%n", disapprovedAdsCount);
} } | public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session, Long adGroupId)
throws RemoteException {
// Get the AdGroupAdService.
AdGroupAdServiceInterface adGroupAdService =
adWordsServices.get(session, AdGroupAdServiceInterface.class);
ServiceQuery serviceQuery =
new ServiceQuery.Builder()
.fields(AdGroupAdField.Id, AdGroupAdField.PolicySummary)
.where(AdGroupAdField.AdGroupId).equalTo(adGroupId)
.where(AdGroupAdField.CombinedApprovalStatus)
.equalTo(PolicyApprovalStatus.DISAPPROVED.getValue())
.orderBy(AdGroupAdField.Id, SortOrder.ASCENDING)
.limit(0, PAGE_SIZE)
.build();
// Get all disapproved ads.
AdGroupAdPage page = null;
int disapprovedAdsCount = 0;
do {
serviceQuery.nextPage(page);
page = adGroupAdService.query(serviceQuery.toString());
// Display ads.
for (AdGroupAd adGroupAd : page) {
disapprovedAdsCount++; // depends on control dependency: [for], data = [none]
AdGroupAdPolicySummary policySummary = adGroupAd.getPolicySummary();
System.out.printf(
"Ad with ID %d and type '%s' was disapproved with the following "
+ "policy topic entries:%n",
adGroupAd.getAd().getId(), adGroupAd.getAd().getAdType()); // depends on control dependency: [for], data = [none]
// Display the policy topic entries related to the ad disapproval.
for (PolicyTopicEntry policyTopicEntry : policySummary.getPolicyTopicEntries()) {
System.out.printf(
" topic id: %s, topic name: '%s'%n",
policyTopicEntry.getPolicyTopicId(), policyTopicEntry.getPolicyTopicName()); // depends on control dependency: [for], data = [none]
// Display the attributes and values that triggered the policy topic.
if (policyTopicEntry.getPolicyTopicEvidences() != null) {
for (PolicyTopicEvidence evidence : policyTopicEntry.getPolicyTopicEvidences()) {
System.out.printf(" evidence type: %s%n", evidence.getPolicyTopicEvidenceType()); // depends on control dependency: [for], data = [evidence]
if (evidence.getEvidenceTextList() != null) {
for (int i = 0; i < evidence.getEvidenceTextList().length; i++) {
System.out.printf(
" evidence text[%d]: %s%n", i, evidence.getEvidenceTextList(i)); // depends on control dependency: [for], data = [none]
}
}
}
}
}
}
} while (serviceQuery.hasNext(page));
System.out.printf("%d disapproved ads were found.%n", disapprovedAdsCount);
} } |
public class class_name {
SocketInterface createSocket(@NonNull final String token, @NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
WebSocket socket = null;
WebSocketFactory factory = new WebSocketFactory();
// Configure proxy if provided
if (proxyAddress != null) {
ProxySettings settings = factory.getProxySettings();
settings.setServer(proxyAddress);
}
try {
socket = factory.createSocket(uri, TIMEOUT);
} catch (IOException e) {
log.f("Creating socket failed", e);
}
if (socket != null) {
String header = AuthManager.AUTH_PREFIX + token;
socket.addHeader("Authorization", header);
socket.addListener(createWebSocketAdapter(stateListenerWeakReference));
socket.setPingInterval(PING_INTERVAL);
return new SocketWrapperImpl(socket);
}
return null;
} } | public class class_name {
SocketInterface createSocket(@NonNull final String token, @NonNull final WeakReference<SocketStateListener> stateListenerWeakReference) {
WebSocket socket = null;
WebSocketFactory factory = new WebSocketFactory();
// Configure proxy if provided
if (proxyAddress != null) {
ProxySettings settings = factory.getProxySettings();
settings.setServer(proxyAddress); // depends on control dependency: [if], data = [(proxyAddress]
}
try {
socket = factory.createSocket(uri, TIMEOUT); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.f("Creating socket failed", e);
} // depends on control dependency: [catch], data = [none]
if (socket != null) {
String header = AuthManager.AUTH_PREFIX + token;
socket.addHeader("Authorization", header); // depends on control dependency: [if], data = [none]
socket.addListener(createWebSocketAdapter(stateListenerWeakReference)); // depends on control dependency: [if], data = [none]
socket.setPingInterval(PING_INTERVAL); // depends on control dependency: [if], data = [none]
return new SocketWrapperImpl(socket); // depends on control dependency: [if], data = [(socket]
}
return null;
} } |
public class class_name {
public boolean harmonize(NodeSchema otherSchema, String schemaKindName) {
if (size() != otherSchema.size()) {
throw new PlanningErrorException(
"The "
+ schemaKindName + "schema and the statement output schemas have different lengths.");
}
boolean changedSomething = false;
for (int idx = 0; idx < size(); idx += 1) {
SchemaColumn myColumn = getColumn(idx);
SchemaColumn otherColumn = otherSchema.getColumn(idx);
VoltType myType = myColumn.getValueType();
VoltType otherType = otherColumn.getValueType();
VoltType commonType = myType;
if (! myType.canExactlyRepresentAnyValueOf(otherType)) {
if (otherType.canExactlyRepresentAnyValueOf(myType)) {
commonType = otherType;
}
else {
throw new PlanningErrorException(
"The "
+ schemaKindName
+ " column type and the statement output type for column "
+ idx
+ " are incompatible.");
}
}
if (myType != commonType) {
changedSomething = true;
myColumn.setValueType(commonType);
}
// Now determine the length, and the "in bytes" flag if needed
assert (myType.isVariableLength() == otherType.isVariableLength());
// The type will be one of:
// - fixed size
// - VARCHAR (need special logic for bytes vs. chars)
// - Some other variable length type
int commonSize;
if (! myType.isVariableLength()) {
commonSize = myType.getLengthInBytesForFixedTypesWithoutCheck();
}
else if (myType == VoltType.STRING) {
boolean myInBytes = myColumn.getInBytes();
boolean otherInBytes = otherColumn.getInBytes();
if (myInBytes == otherInBytes) {
commonSize = Math.max(myColumn.getValueSize(), otherColumn.getValueSize());
}
else {
// one is in bytes and the other is in characters
int mySizeInBytes = (myColumn.getInBytes() ? 1 : 4) * myColumn.getValueSize();
int otherSizeInBytes = (otherColumn.getInBytes() ? 1 : 4) * otherColumn.getValueSize();
if (! myColumn.getInBytes()) {
myColumn.setInBytes(true);
changedSomething = true;
}
commonSize = Math.max(mySizeInBytes, otherSizeInBytes);
if (commonSize > VoltType.MAX_VALUE_LENGTH) {
commonSize = VoltType.MAX_VALUE_LENGTH;
}
}
}
else {
commonSize = Math.max(myColumn.getValueSize(), otherColumn.getValueSize());
}
if (commonSize != myColumn.getValueSize()) {
myColumn.setValueSize(commonSize);
changedSomething = true;
}
}
return changedSomething;
} } | public class class_name {
public boolean harmonize(NodeSchema otherSchema, String schemaKindName) {
if (size() != otherSchema.size()) {
throw new PlanningErrorException(
"The "
+ schemaKindName + "schema and the statement output schemas have different lengths.");
}
boolean changedSomething = false;
for (int idx = 0; idx < size(); idx += 1) {
SchemaColumn myColumn = getColumn(idx);
SchemaColumn otherColumn = otherSchema.getColumn(idx);
VoltType myType = myColumn.getValueType();
VoltType otherType = otherColumn.getValueType();
VoltType commonType = myType;
if (! myType.canExactlyRepresentAnyValueOf(otherType)) {
if (otherType.canExactlyRepresentAnyValueOf(myType)) {
commonType = otherType; // depends on control dependency: [if], data = [none]
}
else {
throw new PlanningErrorException(
"The "
+ schemaKindName
+ " column type and the statement output type for column "
+ idx
+ " are incompatible.");
}
}
if (myType != commonType) {
changedSomething = true; // depends on control dependency: [if], data = [none]
myColumn.setValueType(commonType); // depends on control dependency: [if], data = [commonType)]
}
// Now determine the length, and the "in bytes" flag if needed
assert (myType.isVariableLength() == otherType.isVariableLength()); // depends on control dependency: [for], data = [none]
// The type will be one of:
// - fixed size
// - VARCHAR (need special logic for bytes vs. chars)
// - Some other variable length type
int commonSize;
if (! myType.isVariableLength()) {
commonSize = myType.getLengthInBytesForFixedTypesWithoutCheck(); // depends on control dependency: [if], data = [none]
}
else if (myType == VoltType.STRING) {
boolean myInBytes = myColumn.getInBytes();
boolean otherInBytes = otherColumn.getInBytes();
if (myInBytes == otherInBytes) {
commonSize = Math.max(myColumn.getValueSize(), otherColumn.getValueSize()); // depends on control dependency: [if], data = [none]
}
else {
// one is in bytes and the other is in characters
int mySizeInBytes = (myColumn.getInBytes() ? 1 : 4) * myColumn.getValueSize();
int otherSizeInBytes = (otherColumn.getInBytes() ? 1 : 4) * otherColumn.getValueSize();
if (! myColumn.getInBytes()) {
myColumn.setInBytes(true); // depends on control dependency: [if], data = [none]
changedSomething = true; // depends on control dependency: [if], data = [none]
}
commonSize = Math.max(mySizeInBytes, otherSizeInBytes); // depends on control dependency: [if], data = [none]
if (commonSize > VoltType.MAX_VALUE_LENGTH) {
commonSize = VoltType.MAX_VALUE_LENGTH; // depends on control dependency: [if], data = [none]
}
}
}
else {
commonSize = Math.max(myColumn.getValueSize(), otherColumn.getValueSize()); // depends on control dependency: [if], data = [none]
}
if (commonSize != myColumn.getValueSize()) {
myColumn.setValueSize(commonSize); // depends on control dependency: [if], data = [(commonSize]
changedSomething = true; // depends on control dependency: [if], data = [none]
}
}
return changedSomething;
} } |
public class class_name {
private String getQueue(final Configuration driverConfiguration) {
try {
return Tang.Factory.getTang().newInjector(driverConfiguration).getNamedInstance(JobQueue.class);
} catch (final InjectionException e) {
return this.defaultQueueName;
}
} } | public class class_name {
private String getQueue(final Configuration driverConfiguration) {
try {
return Tang.Factory.getTang().newInjector(driverConfiguration).getNamedInstance(JobQueue.class); // depends on control dependency: [try], data = [none]
} catch (final InjectionException e) {
return this.defaultQueueName;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void render(final ActionRequest actionRequest, final Object resultValue) throws Exception {
final PathResult pathResult;
if (resultValue == null) {
pathResult = resultOf(StringPool.EMPTY);
} else {
if (resultValue instanceof String) {
pathResult = resultOf(resultValue);
}
else {
pathResult = (PathResult) resultValue;
}
}
final String resultBasePath = actionRequest.getActionRuntime().getResultBasePath();
final String path = pathResult != null ? pathResult.path() : StringPool.EMPTY;
final String actionAndResultPath = resultBasePath + (pathResult != null ? ':' + path : StringPool.EMPTY);
String target = targetCache.get(actionAndResultPath);
if (target == null) {
if (log.isDebugEnabled()) {
log.debug("new target: " + actionAndResultPath);
}
target = resolveTarget(actionRequest, path);
if (target == null) {
targetNotFound(actionRequest, actionAndResultPath);
return;
}
if (log.isDebugEnabled()) {
log.debug("target found: " + target);
}
// store target in cache
targetCache.put(actionAndResultPath, target);
}
// the target exists, continue
renderView(actionRequest, target);
} } | public class class_name {
@Override
public void render(final ActionRequest actionRequest, final Object resultValue) throws Exception {
final PathResult pathResult;
if (resultValue == null) {
pathResult = resultOf(StringPool.EMPTY);
} else {
if (resultValue instanceof String) {
pathResult = resultOf(resultValue); // depends on control dependency: [if], data = [none]
}
else {
pathResult = (PathResult) resultValue; // depends on control dependency: [if], data = [none]
}
}
final String resultBasePath = actionRequest.getActionRuntime().getResultBasePath();
final String path = pathResult != null ? pathResult.path() : StringPool.EMPTY;
final String actionAndResultPath = resultBasePath + (pathResult != null ? ':' + path : StringPool.EMPTY);
String target = targetCache.get(actionAndResultPath);
if (target == null) {
if (log.isDebugEnabled()) {
log.debug("new target: " + actionAndResultPath);
}
target = resolveTarget(actionRequest, path);
if (target == null) {
targetNotFound(actionRequest, actionAndResultPath);
return;
}
if (log.isDebugEnabled()) {
log.debug("target found: " + target);
}
// store target in cache
targetCache.put(actionAndResultPath, target);
}
// the target exists, continue
renderView(actionRequest, target);
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.