code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public int[][] toArray() {
int[][] res = new int[14][];
int size = 0;
for (int[] map : this) {
if (size == res.length)
res = Arrays.copyOf(res, size + (size >> 1));
res[size++] = map.clone();
}
return Arrays.copyOf(res, size);
} }
|
public class class_name {
public int[][] toArray() {
int[][] res = new int[14][];
int size = 0;
for (int[] map : this) {
if (size == res.length)
res = Arrays.copyOf(res, size + (size >> 1));
res[size++] = map.clone(); // depends on control dependency: [for], data = [map]
}
return Arrays.copyOf(res, size);
} }
|
public class class_name {
@Override
public synchronized void reschedule(String cronExp, VaryingCronOpCall opLambda) {
verifyCanRescheduleState();
assertArgumentNotNull("cronExp", cronExp);
assertArgumentNotNull("opLambda", opLambda);
if (isNonCromExp(cronExp)) {
throw new IllegalArgumentException("The cronExp for reschedule() should not be non-cron: " + toString());
}
if (unscheduled) {
unscheduled = false; // can revive from unscheduled
}
final String existingCronExp = cron4jTask.getVaryingCron().getCronExp();
cron4jTask.switchCron(cronExp, createCronOption(opLambda));
final Cron4jScheduler cron4jScheduler = cron4jNow.getCron4jScheduler();
cron4jId.ifPresent(id -> {
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Rescheduling {} as cron from '{}' to '{}'", jobKey, existingCronExp, cronExp);
}
if (isNativeScheduledId(cron4jScheduler, id)) {
cron4jScheduler.reschedule(id, cronExp);
} else { // after descheduled
cron4jId = scheduleNative(cronExp, cron4jScheduler);
}
}).orElse(() -> {
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Rescheduling {} as cron from non-cron to '{}'", jobKey, cronExp);
}
cron4jId = scheduleNative(cronExp, cron4jScheduler);
});
} }
|
public class class_name {
@Override
public synchronized void reschedule(String cronExp, VaryingCronOpCall opLambda) {
verifyCanRescheduleState();
assertArgumentNotNull("cronExp", cronExp);
assertArgumentNotNull("opLambda", opLambda);
if (isNonCromExp(cronExp)) {
throw new IllegalArgumentException("The cronExp for reschedule() should not be non-cron: " + toString());
}
if (unscheduled) {
unscheduled = false; // can revive from unscheduled // depends on control dependency: [if], data = [none]
}
final String existingCronExp = cron4jTask.getVaryingCron().getCronExp();
cron4jTask.switchCron(cronExp, createCronOption(opLambda));
final Cron4jScheduler cron4jScheduler = cron4jNow.getCron4jScheduler();
cron4jId.ifPresent(id -> {
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Rescheduling {} as cron from '{}' to '{}'", jobKey, existingCronExp, cronExp);
}
if (isNativeScheduledId(cron4jScheduler, id)) {
cron4jScheduler.reschedule(id, cronExp);
} else { // after descheduled
cron4jId = scheduleNative(cronExp, cron4jScheduler);
}
}).orElse(() -> {
if (JobChangeLog.isEnabled()) {
JobChangeLog.log("#job ...Rescheduling {} as cron from non-cron to '{}'", jobKey, cronExp);
}
cron4jId = scheduleNative(cronExp, cron4jScheduler);
});
} }
|
public class class_name {
public static String toTitleCase(String str) {
if (str.length() == 0) {
return str;
} else {
return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase();
}
} }
|
public class class_name {
public static String toTitleCase(String str) {
if (str.length() == 0) {
return str; // depends on control dependency: [if], data = [none]
} else {
return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase(); // depends on control dependency: [if], data = [0)]
}
} }
|
public class class_name {
public static File findTemplateDirectory( ApplicationTemplate tpl, File configurationDirectory ) {
StringBuilder sb = new StringBuilder( TEMPLATES );
sb.append( "/" );
sb.append( tpl.getName());
if( ! Utils.isEmptyOrWhitespaces( tpl.getVersion())) {
sb.append( " - " );
sb.append( tpl.getVersion());
}
return new File( configurationDirectory, sb.toString());
} }
|
public class class_name {
public static File findTemplateDirectory( ApplicationTemplate tpl, File configurationDirectory ) {
StringBuilder sb = new StringBuilder( TEMPLATES );
sb.append( "/" );
sb.append( tpl.getName());
if( ! Utils.isEmptyOrWhitespaces( tpl.getVersion())) {
sb.append( " - " ); // depends on control dependency: [if], data = [none]
sb.append( tpl.getVersion()); // depends on control dependency: [if], data = [none]
}
return new File( configurationDirectory, sb.toString());
} }
|
public class class_name {
protected void onNewItems(@NonNull List<Model> newItems, int page) {
OnNewItemsListener<Model> onNewItemsListener = this.mOnNewItemsListener;
try {
onNewItemsListener.onNewItems(newItems, page);
} catch (NullPointerException npe) {
// Lazy null checking! If this was our npe, then throw with an appropriate message.
throw onNewItemsListener != null ? npe
: new NullPointerException("You must provide an `OnNewItemsListener`");
}
} }
|
public class class_name {
protected void onNewItems(@NonNull List<Model> newItems, int page) {
OnNewItemsListener<Model> onNewItemsListener = this.mOnNewItemsListener;
try {
onNewItemsListener.onNewItems(newItems, page); // depends on control dependency: [try], data = [none]
} catch (NullPointerException npe) {
// Lazy null checking! If this was our npe, then throw with an appropriate message.
throw onNewItemsListener != null ? npe
: new NullPointerException("You must provide an `OnNewItemsListener`");
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static String encode(String name)
{
// quick check for root node name
if (name.length() == 0)
{
return name;
}
if (XMLChar.isValidName(name) && name.indexOf("_x") < 0)
{
// already valid
return name;
}
else
{
// encode
StringBuilder encoded = new StringBuilder();
for (int i = 0; i < name.length(); i++)
{
if (i == 0)
{
// first character of name
if (XMLChar.isNameStart(name.charAt(i)))
{
if (needsEscaping(name, i))
{
// '_x' must be encoded
encode('_', encoded);
}
else
{
encoded.append(name.charAt(i));
}
}
else
{
// not valid as first character -> encode
encode(name.charAt(i), encoded);
}
}
else if (!XMLChar.isName(name.charAt(i)))
{
encode(name.charAt(i), encoded);
}
else
{
if (needsEscaping(name, i))
{
// '_x' must be encoded
encode('_', encoded);
}
else
{
encoded.append(name.charAt(i));
}
}
}
return encoded.toString();
}
} }
|
public class class_name {
public static String encode(String name)
{
// quick check for root node name
if (name.length() == 0)
{
return name;
// depends on control dependency: [if], data = [none]
}
if (XMLChar.isValidName(name) && name.indexOf("_x") < 0)
{
// already valid
return name;
// depends on control dependency: [if], data = [none]
}
else
{
// encode
StringBuilder encoded = new StringBuilder();
for (int i = 0; i < name.length(); i++)
{
if (i == 0)
{
// first character of name
if (XMLChar.isNameStart(name.charAt(i)))
{
if (needsEscaping(name, i))
{
// '_x' must be encoded
encode('_', encoded);
// depends on control dependency: [if], data = [none]
}
else
{
encoded.append(name.charAt(i));
// depends on control dependency: [if], data = [none]
}
}
else
{
// not valid as first character -> encode
encode(name.charAt(i), encoded);
// depends on control dependency: [if], data = [none]
}
}
else if (!XMLChar.isName(name.charAt(i)))
{
encode(name.charAt(i), encoded);
// depends on control dependency: [if], data = [none]
}
else
{
if (needsEscaping(name, i))
{
// '_x' must be encoded
encode('_', encoded);
// depends on control dependency: [if], data = [none]
}
else
{
encoded.append(name.charAt(i));
// depends on control dependency: [if], data = [none]
}
}
}
return encoded.toString();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Date getDate(String name, String format) {
Object value = get(name);
if (value instanceof Date) {
return (Date)value;
}
if (value != null) {
try {
return new SimpleDateFormat(format).parse(value.toString());
} catch (ParseException e) {
// ignore
}
}
return null;
} }
|
public class class_name {
public Date getDate(String name, String format) {
Object value = get(name);
if (value instanceof Date) {
return (Date)value; // depends on control dependency: [if], data = [none]
}
if (value != null) {
try {
return new SimpleDateFormat(format).parse(value.toString()); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
static List<IA1Address> resolveCellDependencies(IA1Address cellAddress, Sheet sheet, FormulaParsingWorkbook workbook) {
Row row = sheet.getRow(cellAddress.row());
if (row == null) { return emptyList(); }
Cell cell = row.getCell(cellAddress.column());
if (cell == null) { return emptyList(); }
if (CELL_TYPE_FORMULA != cell.getCellType()) { return singletonList(cellAddress); }
List<IA1Address> dependencies = new LinkedList<>();
for (Ptg ptg : parse(cell.getCellFormula(), workbook, CELL, 0)) { /* TODO: only one sheet is supported */
if (ptg instanceof RefPtg) {
RefPtg ref = (RefPtg) ptg;
dependencies.addAll(resolveCellDependencies(fromRowColumn(ref.getRow(), ref.getColumn()), sheet, workbook));
} else if (ptg instanceof AreaPtg) {
AreaPtg area = (AreaPtg) ptg;
for (int r = area.getFirstRow(); r <= area.getLastRow(); r++) {
for (int c = area.getFirstColumn(); c <= area.getLastColumn(); c++) {
dependencies.addAll(resolveCellDependencies(fromRowColumn(r, c), sheet, workbook));
}
}
}
dependencies.add(cellAddress);
}
return dependencies;
} }
|
public class class_name {
static List<IA1Address> resolveCellDependencies(IA1Address cellAddress, Sheet sheet, FormulaParsingWorkbook workbook) {
Row row = sheet.getRow(cellAddress.row());
if (row == null) { return emptyList(); }
// depends on control dependency: [if], data = [none]
Cell cell = row.getCell(cellAddress.column());
if (cell == null) { return emptyList(); }
// depends on control dependency: [if], data = [none]
if (CELL_TYPE_FORMULA != cell.getCellType()) { return singletonList(cellAddress); }
// depends on control dependency: [if], data = [none]
List<IA1Address> dependencies = new LinkedList<>();
for (Ptg ptg : parse(cell.getCellFormula(), workbook, CELL, 0)) { /* TODO: only one sheet is supported */
if (ptg instanceof RefPtg) {
RefPtg ref = (RefPtg) ptg;
dependencies.addAll(resolveCellDependencies(fromRowColumn(ref.getRow(), ref.getColumn()), sheet, workbook));
// depends on control dependency: [if], data = [none]
} else if (ptg instanceof AreaPtg) {
AreaPtg area = (AreaPtg) ptg;
for (int r = area.getFirstRow(); r <= area.getLastRow(); r++) {
for (int c = area.getFirstColumn(); c <= area.getLastColumn(); c++) {
dependencies.addAll(resolveCellDependencies(fromRowColumn(r, c), sheet, workbook));
// depends on control dependency: [for], data = [c]
}
}
}
dependencies.add(cellAddress);
// depends on control dependency: [for], data = [none]
}
return dependencies;
} }
|
public class class_name {
@Nonnull
private String unpackLanguageOrRegion(byte[] value, int base) {
Preconditions.checkState(value.length == 2, "Language or country value must be 2 bytes.");
if (value[0] == 0 && value[1] == 0) {
return "";
}
if (isTruthy(UnsignedBytes.toInt(value[0]) & 0x80)) {
byte[] result = new byte[3];
result[0] = (byte) (base + (value[1] & 0x1F));
result[1] = (byte) (base + ((value[1] & 0xE0) >>> 5) + ((value[0] & 0x03) << 3));
result[2] = (byte) (base + ((value[0] & 0x7C) >>> 2));
return new String(result, US_ASCII);
}
return new String(value, US_ASCII);
} }
|
public class class_name {
@Nonnull
private String unpackLanguageOrRegion(byte[] value, int base) {
Preconditions.checkState(value.length == 2, "Language or country value must be 2 bytes.");
if (value[0] == 0 && value[1] == 0) {
return ""; // depends on control dependency: [if], data = [none]
}
if (isTruthy(UnsignedBytes.toInt(value[0]) & 0x80)) {
byte[] result = new byte[3];
result[0] = (byte) (base + (value[1] & 0x1F)); // depends on control dependency: [if], data = [none]
result[1] = (byte) (base + ((value[1] & 0xE0) >>> 5) + ((value[0] & 0x03) << 3)); // depends on control dependency: [if], data = [none]
result[2] = (byte) (base + ((value[0] & 0x7C) >>> 2)); // depends on control dependency: [if], data = [none]
return new String(result, US_ASCII); // depends on control dependency: [if], data = [none]
}
return new String(value, US_ASCII);
} }
|
public class class_name {
@Override
public void close() {
if (!this.closed.getAndSet(true)) {
if (state() == State.RUNNING) {
Futures.await(Services.stopAsync(this, this.executorService));
}
synchronized (this.clients) {
this.clients.clear();
}
this.metrics.close();
log.info("{} Closed.", TRACE_OBJECT_ID);
}
} }
|
public class class_name {
@Override
public void close() {
if (!this.closed.getAndSet(true)) {
if (state() == State.RUNNING) {
Futures.await(Services.stopAsync(this, this.executorService)); // depends on control dependency: [if], data = [none]
}
synchronized (this.clients) { // depends on control dependency: [if], data = [none]
this.clients.clear();
}
this.metrics.close(); // depends on control dependency: [if], data = [none]
log.info("{} Closed.", TRACE_OBJECT_ID); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX,
final int deltaY, final int scrollY, final int scrollRange, final int fuzzyThreshold,
final float scaleFactor, final boolean isTouchEvent) {
final int deltaValue, currentScrollValue, scrollValue;
switch (view.getPullToRefreshScrollDirection()) {
case HORIZONTAL:
deltaValue = deltaX;
scrollValue = scrollX;
currentScrollValue = view.getScrollX();
break;
case VERTICAL:
default:
deltaValue = deltaY;
scrollValue = scrollY;
currentScrollValue = view.getScrollY();
break;
}
// Check that OverScroll is enabled and that we're not currently
// refreshing.
if (view.isPullToRefreshOverScrollEnabled() && !view.isRefreshing()) {
final Mode mode = view.getMode();
// Check that Pull-to-Refresh is enabled, and the event isn't from
// touch
if (mode.permitsPullToRefresh() && !isTouchEvent && deltaValue != 0) {
final int newScrollValue = (deltaValue + scrollValue);
if (PullToRefreshBase.DEBUG) {
Log.d(LOG_TAG, "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY
+ ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange
+ ", CurrentScroll: " + currentScrollValue);
}
if (newScrollValue < (0 - fuzzyThreshold)) {
// Check the mode supports the overscroll direction, and
// then move scroll
if (mode.showHeaderLoadingLayout()) {
// If we're currently at zero, we're about to start
// overscrolling, so change the state
if (currentScrollValue == 0) {
view.setState(State.OVERSCROLLING);
}
view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue)));
}
} else if (newScrollValue > (scrollRange + fuzzyThreshold)) {
// Check the mode supports the overscroll direction, and
// then move scroll
if (mode.showFooterLoadingLayout()) {
// If we're currently at zero, we're about to start
// overscrolling, so change the state
if (currentScrollValue == 0) {
view.setState(State.OVERSCROLLING);
}
view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue - scrollRange)));
}
} else if (Math.abs(newScrollValue) <= fuzzyThreshold
|| Math.abs(newScrollValue - scrollRange) <= fuzzyThreshold) {
// Means we've stopped overscrolling, so scroll back to 0
view.setState(State.RESET);
}
} else if (isTouchEvent && State.OVERSCROLLING == view.getState()) {
// This condition means that we were overscrolling from a fling,
// but the user has touched the View and is now overscrolling
// from touch instead. We need to just reset.
view.setState(State.RESET);
}
}
} }
|
public class class_name {
public static void overScrollBy(final PullToRefreshBase<?> view, final int deltaX, final int scrollX,
final int deltaY, final int scrollY, final int scrollRange, final int fuzzyThreshold,
final float scaleFactor, final boolean isTouchEvent) {
final int deltaValue, currentScrollValue, scrollValue;
switch (view.getPullToRefreshScrollDirection()) {
case HORIZONTAL:
deltaValue = deltaX;
scrollValue = scrollX;
currentScrollValue = view.getScrollX();
break;
case VERTICAL:
default:
deltaValue = deltaY;
scrollValue = scrollY;
currentScrollValue = view.getScrollY();
break;
}
// Check that OverScroll is enabled and that we're not currently
// refreshing.
if (view.isPullToRefreshOverScrollEnabled() && !view.isRefreshing()) {
final Mode mode = view.getMode();
// Check that Pull-to-Refresh is enabled, and the event isn't from
// touch
if (mode.permitsPullToRefresh() && !isTouchEvent && deltaValue != 0) {
final int newScrollValue = (deltaValue + scrollValue);
if (PullToRefreshBase.DEBUG) {
Log.d(LOG_TAG, "OverScroll. DeltaX: " + deltaX + ", ScrollX: " + scrollX + ", DeltaY: " + deltaY
+ ", ScrollY: " + scrollY + ", NewY: " + newScrollValue + ", ScrollRange: " + scrollRange
+ ", CurrentScroll: " + currentScrollValue); // depends on control dependency: [if], data = [none]
}
if (newScrollValue < (0 - fuzzyThreshold)) {
// Check the mode supports the overscroll direction, and
// then move scroll
if (mode.showHeaderLoadingLayout()) {
// If we're currently at zero, we're about to start
// overscrolling, so change the state
if (currentScrollValue == 0) {
view.setState(State.OVERSCROLLING); // depends on control dependency: [if], data = [none]
}
view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue))); // depends on control dependency: [if], data = [none]
}
} else if (newScrollValue > (scrollRange + fuzzyThreshold)) {
// Check the mode supports the overscroll direction, and
// then move scroll
if (mode.showFooterLoadingLayout()) {
// If we're currently at zero, we're about to start
// overscrolling, so change the state
if (currentScrollValue == 0) {
view.setState(State.OVERSCROLLING); // depends on control dependency: [if], data = [none]
}
view.setHeaderScroll((int) (scaleFactor * (currentScrollValue + newScrollValue - scrollRange))); // depends on control dependency: [if], data = [none]
}
} else if (Math.abs(newScrollValue) <= fuzzyThreshold
|| Math.abs(newScrollValue - scrollRange) <= fuzzyThreshold) {
// Means we've stopped overscrolling, so scroll back to 0
view.setState(State.RESET); // depends on control dependency: [if], data = [none]
}
} else if (isTouchEvent && State.OVERSCROLLING == view.getState()) {
// This condition means that we were overscrolling from a fling,
// but the user has touched the View and is now overscrolling
// from touch instead. We need to just reset.
view.setState(State.RESET);
}
}
} }
|
public class class_name {
public static BigDecimal sub(Number... values) {
if (ArrayUtil.isEmpty(values)) {
return BigDecimal.ZERO;
}
Number value = values[0];
BigDecimal result = new BigDecimal(null == value ? "0" : value.toString());
for (int i = 1; i < values.length; i++) {
value = values[i];
if (null != value) {
result = result.subtract(new BigDecimal(value.toString()));
}
}
return result;
} }
|
public class class_name {
public static BigDecimal sub(Number... values) {
if (ArrayUtil.isEmpty(values)) {
return BigDecimal.ZERO;
// depends on control dependency: [if], data = [none]
}
Number value = values[0];
BigDecimal result = new BigDecimal(null == value ? "0" : value.toString());
for (int i = 1; i < values.length; i++) {
value = values[i];
// depends on control dependency: [for], data = [i]
if (null != value) {
result = result.subtract(new BigDecimal(value.toString()));
// depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception
{
IServletWrapper target = this.cacheTarget;
if (target != null) {
try {
webapp.getFilterManager().invokeFilters((HttpServletRequest) req, (HttpServletResponse) res, webapp, target, CollaboratorHelper.allCollabEnum);
} catch (Throwable th){
if((com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) && th instanceof IOException){
if((th.getMessage()!= null) && th.getMessage().contains("SRVE0918E")){
// dont do anything
// we have already given chance to servlet and filters to handle it
// this is application error but should not be returned to client.
logger.logp(Level.FINE, CLASS_NAME, "handleRequest", "donothandleexception SRVE0918E");
return;
}
}
WebApp webapp = this.webapp;
if (webapp == null) {
FFDCFilter.processException(th, getClass().getName(), "83");
} else {
webapp.handleException(th, req, res, this);
}
}
}
else
throw InvalidCacheTargetException.instance();
} }
|
public class class_name {
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception
{
IServletWrapper target = this.cacheTarget;
if (target != null) {
try {
webapp.getFilterManager().invokeFilters((HttpServletRequest) req, (HttpServletResponse) res, webapp, target, CollaboratorHelper.allCollabEnum);
} catch (Throwable th){
if((com.ibm.ws.webcontainer.osgi.WebContainer.getServletContainerSpecLevel() >= 31) && th instanceof IOException){
if((th.getMessage()!= null) && th.getMessage().contains("SRVE0918E")){
// dont do anything
// we have already given chance to servlet and filters to handle it
// this is application error but should not be returned to client.
logger.logp(Level.FINE, CLASS_NAME, "handleRequest", "donothandleexception SRVE0918E"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
WebApp webapp = this.webapp;
if (webapp == null) {
FFDCFilter.processException(th, getClass().getName(), "83"); // depends on control dependency: [if], data = [none]
} else {
webapp.handleException(th, req, res, this); // depends on control dependency: [if], data = [none]
}
}
}
else
throw InvalidCacheTargetException.instance();
} }
|
public class class_name {
@Override
public void addChildren(List<IDifference> children) {
if (children != null) {
differences.addAll(children);
}
} }
|
public class class_name {
@Override
public void addChildren(List<IDifference> children) {
if (children != null) {
differences.addAll(children); // depends on control dependency: [if], data = [(children]
}
} }
|
public class class_name {
@Override
public T addAsWebResources(Package resourcePackage, String... resourceNames) throws IllegalArgumentException {
Validate.notNull(resourcePackage, "ResourcePackage must be specified");
Validate.notNullAndNoNullValues(resourceNames,
"ResourceNames must be specified and can not container null values");
for (final String resourceName : resourceNames) {
addAsWebResource(resourcePackage, resourceName);
}
return covarientReturn();
} }
|
public class class_name {
@Override
public T addAsWebResources(Package resourcePackage, String... resourceNames) throws IllegalArgumentException {
Validate.notNull(resourcePackage, "ResourcePackage must be specified");
Validate.notNullAndNoNullValues(resourceNames,
"ResourceNames must be specified and can not container null values");
for (final String resourceName : resourceNames) {
addAsWebResource(resourcePackage, resourceName); // depends on control dependency: [for], data = [resourceName]
}
return covarientReturn();
} }
|
public class class_name {
public String getSingleLineUsage(String name) {
for (SubCommand<SubCommandDef> cmd : subCommands) {
if (name.equals(cmd.getName())) {
return cmd.getArgumentParser(cmd.newInstance()).getSingleLineUsage();
}
}
throw new ArgumentException("No such " + getName() + " " + name);
} }
|
public class class_name {
public String getSingleLineUsage(String name) {
for (SubCommand<SubCommandDef> cmd : subCommands) {
if (name.equals(cmd.getName())) {
return cmd.getArgumentParser(cmd.newInstance()).getSingleLineUsage(); // depends on control dependency: [if], data = [none]
}
}
throw new ArgumentException("No such " + getName() + " " + name);
} }
|
public class class_name {
@Deprecated
@SuppressWarnings("unchecked")
public T[] getValues(T[] array) {
Object o = value.get();
if (o == null || NotificationLite.isComplete(o) || NotificationLite.isError(o)) {
if (array.length != 0) {
array[0] = null;
}
return array;
}
T v = NotificationLite.getValue(o);
if (array.length != 0) {
array[0] = v;
if (array.length != 1) {
array[1] = null;
}
} else {
array = (T[])Array.newInstance(array.getClass().getComponentType(), 1);
array[0] = v;
}
return array;
} }
|
public class class_name {
@Deprecated
@SuppressWarnings("unchecked")
public T[] getValues(T[] array) {
Object o = value.get();
if (o == null || NotificationLite.isComplete(o) || NotificationLite.isError(o)) {
if (array.length != 0) {
array[0] = null; // depends on control dependency: [if], data = [none]
}
return array; // depends on control dependency: [if], data = [none]
}
T v = NotificationLite.getValue(o);
if (array.length != 0) {
array[0] = v; // depends on control dependency: [if], data = [none]
if (array.length != 1) {
array[1] = null; // depends on control dependency: [if], data = [none]
}
} else {
array = (T[])Array.newInstance(array.getClass().getComponentType(), 1); // depends on control dependency: [if], data = [none]
array[0] = v; // depends on control dependency: [if], data = [none]
}
return array;
} }
|
public class class_name {
public static FortumoStore initFortumoStore(@NotNull Context context, final boolean checkInventory) {
final FortumoStore[] storeToReturn = {null};
final FortumoStore fortumoStore = new FortumoStore(context);
if (fortumoStore.isBillingAvailable(context.getPackageName())) {
final CountDownLatch latch = new CountDownLatch(1);
fortumoStore.getInAppBillingService().startSetup(new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(@NotNull IabResult setupResult) {
if (setupResult.isSuccess()) {
if (checkInventory) {
try {
final Inventory inventory = fortumoStore.getInAppBillingService().queryInventory(false, null, null);
if (!inventory.getAllPurchases().isEmpty()) {
storeToReturn[0] = fortumoStore;
} else {
Logger.d("Purchases not found");
}
} catch (IabException e) {
Logger.e("Error while requesting purchases", e);
}
} else {
storeToReturn[0] = fortumoStore;
}
}
latch.countDown();
}
});
try {
latch.await();
} catch (InterruptedException e) {
Logger.e("Setup was interrupted", e);
}
}
return storeToReturn[0];
} }
|
public class class_name {
public static FortumoStore initFortumoStore(@NotNull Context context, final boolean checkInventory) {
final FortumoStore[] storeToReturn = {null};
final FortumoStore fortumoStore = new FortumoStore(context);
if (fortumoStore.isBillingAvailable(context.getPackageName())) {
final CountDownLatch latch = new CountDownLatch(1);
fortumoStore.getInAppBillingService().startSetup(new IabHelper.OnIabSetupFinishedListener() {
@Override
public void onIabSetupFinished(@NotNull IabResult setupResult) {
if (setupResult.isSuccess()) {
if (checkInventory) {
try {
final Inventory inventory = fortumoStore.getInAppBillingService().queryInventory(false, null, null);
if (!inventory.getAllPurchases().isEmpty()) {
storeToReturn[0] = fortumoStore; // depends on control dependency: [if], data = [none]
} else {
Logger.d("Purchases not found"); // depends on control dependency: [if], data = [none]
}
} catch (IabException e) {
Logger.e("Error while requesting purchases", e);
} // depends on control dependency: [catch], data = [none]
} else {
storeToReturn[0] = fortumoStore; // depends on control dependency: [if], data = [none]
}
}
latch.countDown();
}
}); // depends on control dependency: [if], data = [none]
try {
latch.await(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Logger.e("Setup was interrupted", e);
} // depends on control dependency: [catch], data = [none]
}
return storeToReturn[0];
} }
|
public class class_name {
public long run(String partitionValue, long maxTotalRows, long targetMaxRowsToDelete) {
if (targetMaxRowsToDelete <= 0) {
throw new VoltAbortException("maxRowsToDeletePerProc must be > 0.");
}
if (maxTotalRows < 0) {
throw new VoltAbortException("maxTotalRows must be >= 0.");
}
// Count the rows in the current partition.
voltQueueSQL(countRows, EXPECT_SCALAR_LONG);
long count = voltExecuteSQL()[0].asScalarLong();
// If partition is smaller than desired, return without deleting rows.
if (count < maxTotalRows) {
// Return 0 deleted rows.
return 0;
}
// If asked to remove all rows, go ahead
if ((maxTotalRows == 0) && (count < targetMaxRowsToDelete)) {
voltQueueSQL(deleteAll, EXPECT_SCALAR_MATCH(count));
voltExecuteSQL(true);
// Total deleted rows = table size.
return count;
}
// Figure out how many rows to try to delete.
long agedOutCount = count - maxTotalRows;
long rowsToConsider = Math.min(agedOutCount, targetMaxRowsToDelete);
// Find the timestamp of the row at position N in the sorted order, where N is the chunk size
voltQueueSQL(getNthOldestTimestamp, EXPECT_SCALAR, rowsToConsider);
TimestampType newestToDiscard = voltExecuteSQL()[0].fetchRow(0).getTimestampAsTimestamp(0);
// Delete all rows >= the timestamp found in the previous statement.
// This will delete AT LEAST N rows, but since timestamps may be non-unique,
// it might delete more than N. In the worst case, it could delete all rows
// if every row has an identical timestamp value. It is guaranteed to make
// progress. If we used strictly less than, it might not make progress.
// This is why the max rows to delete number is a target, not always a perfect max.
voltQueueSQL(deleteOlderThanDate, EXPECT_SCALAR_LONG, newestToDiscard);
long deletedCount = voltExecuteSQL(true)[0].asScalarLong();
return deletedCount;
} }
|
public class class_name {
public long run(String partitionValue, long maxTotalRows, long targetMaxRowsToDelete) {
if (targetMaxRowsToDelete <= 0) {
throw new VoltAbortException("maxRowsToDeletePerProc must be > 0.");
}
if (maxTotalRows < 0) {
throw new VoltAbortException("maxTotalRows must be >= 0.");
}
// Count the rows in the current partition.
voltQueueSQL(countRows, EXPECT_SCALAR_LONG);
long count = voltExecuteSQL()[0].asScalarLong();
// If partition is smaller than desired, return without deleting rows.
if (count < maxTotalRows) {
// Return 0 deleted rows.
return 0; // depends on control dependency: [if], data = [none]
}
// If asked to remove all rows, go ahead
if ((maxTotalRows == 0) && (count < targetMaxRowsToDelete)) {
voltQueueSQL(deleteAll, EXPECT_SCALAR_MATCH(count)); // depends on control dependency: [if], data = [none]
voltExecuteSQL(true); // depends on control dependency: [if], data = [none]
// Total deleted rows = table size.
return count; // depends on control dependency: [if], data = [none]
}
// Figure out how many rows to try to delete.
long agedOutCount = count - maxTotalRows;
long rowsToConsider = Math.min(agedOutCount, targetMaxRowsToDelete);
// Find the timestamp of the row at position N in the sorted order, where N is the chunk size
voltQueueSQL(getNthOldestTimestamp, EXPECT_SCALAR, rowsToConsider);
TimestampType newestToDiscard = voltExecuteSQL()[0].fetchRow(0).getTimestampAsTimestamp(0);
// Delete all rows >= the timestamp found in the previous statement.
// This will delete AT LEAST N rows, but since timestamps may be non-unique,
// it might delete more than N. In the worst case, it could delete all rows
// if every row has an identical timestamp value. It is guaranteed to make
// progress. If we used strictly less than, it might not make progress.
// This is why the max rows to delete number is a target, not always a perfect max.
voltQueueSQL(deleteOlderThanDate, EXPECT_SCALAR_LONG, newestToDiscard);
long deletedCount = voltExecuteSQL(true)[0].asScalarLong();
return deletedCount;
} }
|
public class class_name {
public String getId() {
String id = getPropertyAsString(FIELD_ID);
if (id == null){
return getPropertyAsString(FIELD_ITEM_ID);
}
return id;
} }
|
public class class_name {
public String getId() {
String id = getPropertyAsString(FIELD_ID);
if (id == null){
return getPropertyAsString(FIELD_ITEM_ID); // depends on control dependency: [if], data = [none]
}
return id;
} }
|
public class class_name {
private Node getNode(Object entity, ObjectGraph graph, NodeState initialNodeState)
{
if (entity == null)
{
return null;
}
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
entity.getClass());
// entity metadata could be null.
if (entityMetadata == null)
{
throw new IllegalArgumentException(
"Entity object is invalid, operation failed. Please check previous log message for details");
}
Object id = PropertyAccessorHelper.getId(entity, entityMetadata);
// Generate and set Id if @GeneratedValue present.
if (((Field) entityMetadata.getIdAttribute().getJavaMember()).isAnnotationPresent(GeneratedValue.class))
{
if (!isIdSet(id))
{
id = idGenerator.generateAndSetId(entity, entityMetadata, pd, pd.getKunderaMetadata());
}
}
if (!validator.isValidEntityObject(entity, entityMetadata))
{
throw new IllegalArgumentException(
"Entity object is invalid, operation failed. Please check previous log message for details");
}
// id = PropertyAccessorHelper.getId(entity, entityMetadata);
String nodeId = ObjectGraphUtils.getNodeId(id, entity.getClass());
Node node = graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
if (node != null)
{
if (node.isGraphCompleted())
{
return node;
}
return null;
}
// Construct this Node first, if one not already there in Persistence
// Cache
Node nodeInPersistenceCache = persistenceCache.getMainCache().getNodeFromCache(nodeId, pd);
// Make a deep copy of entity data
if (nodeInPersistenceCache == null)
{
node = new Node(nodeId, entity, initialNodeState, persistenceCache, id, pd);
}
else
{
node = nodeInPersistenceCache;
node.setPersistenceCache(persistenceCache);
// Determine whether this node is dirty based on comparison between
// Node data and entity data
// If dirty, set the entity data into node and mark it as dirty
if (!DeepEquals.deepEquals(node.getData(), entity))
{
node.setDirty(true);
}
else if (node.isProcessed())
{
node.setDirty(false);
}
node.setData(entity);
// If node is NOT in managed state, its data needs to be
// replaced with the one provided in entity object
}
// Put this node into object graph
graph.addNode(nodeId, node);
// Iterate over relations and construct children nodes
for (Relation relation : entityMetadata.getRelations())
{
if (relation != null)
{
// Child Object set in this entity
Object childObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());
if (childObject != null && !ProxyHelper.isProxy(childObject))
{
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
PropertyAccessorHelper.getGenericClass(relation.getProperty()));
if (metadata != null && relation.isJoinedByPrimaryKey())
{
PropertyAccessorHelper.setId(childObject, metadata,
PropertyAccessorHelper.getId(entity, entityMetadata));
}
// This child object could be either an entity(1-1 or M-1)
// or a
// collection/ Map of entities(1-M or M-M)
if (Collection.class.isAssignableFrom(childObject.getClass()))
{
// For each entity in the collection, construct a child
// node and add to graph
Collection childrenObjects = (Collection) childObject;
if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))
for (Object childObj : childrenObjects)
{
if (childObj != null)
{
addChildNodesToGraph(graph, node, relation, childObj,
metadata != null ? getChildNodeState(metadata, childObj) : initialNodeState);
}
}
}
else if (Map.class.isAssignableFrom(childObject.getClass()))
{
Map childrenObjects = (Map) childObject;
if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))
{
for (Map.Entry entry : (Set<Map.Entry>) childrenObjects.entrySet())
{
addChildNodesToGraph(graph, node, relation, entry,
metadata != null ? getChildNodeState(metadata, entry) : initialNodeState);
}
}
}
else
{
// Construct child node and add to graph
addChildNodesToGraph(graph, node, relation, childObject,
metadata != null ? getChildNodeState(metadata, childObject) : initialNodeState);
}
}
}
}
// Means compelte graph is build.
node.setGraphCompleted(true);
return node;
} }
|
public class class_name {
private Node getNode(Object entity, ObjectGraph graph, NodeState initialNodeState)
{
if (entity == null)
{
return null; // depends on control dependency: [if], data = [none]
}
EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
entity.getClass());
// entity metadata could be null.
if (entityMetadata == null)
{
throw new IllegalArgumentException(
"Entity object is invalid, operation failed. Please check previous log message for details");
}
Object id = PropertyAccessorHelper.getId(entity, entityMetadata);
// Generate and set Id if @GeneratedValue present.
if (((Field) entityMetadata.getIdAttribute().getJavaMember()).isAnnotationPresent(GeneratedValue.class))
{
if (!isIdSet(id))
{
id = idGenerator.generateAndSetId(entity, entityMetadata, pd, pd.getKunderaMetadata()); // depends on control dependency: [if], data = [none]
}
}
if (!validator.isValidEntityObject(entity, entityMetadata))
{
throw new IllegalArgumentException(
"Entity object is invalid, operation failed. Please check previous log message for details");
}
// id = PropertyAccessorHelper.getId(entity, entityMetadata);
String nodeId = ObjectGraphUtils.getNodeId(id, entity.getClass());
Node node = graph.getNode(nodeId);
// If this node is already there in graph (may happen for bidirectional
// relationship, do nothing and return null)
if (node != null)
{
if (node.isGraphCompleted())
{
return node; // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
// Construct this Node first, if one not already there in Persistence
// Cache
Node nodeInPersistenceCache = persistenceCache.getMainCache().getNodeFromCache(nodeId, pd);
// Make a deep copy of entity data
if (nodeInPersistenceCache == null)
{
node = new Node(nodeId, entity, initialNodeState, persistenceCache, id, pd); // depends on control dependency: [if], data = [none]
}
else
{
node = nodeInPersistenceCache; // depends on control dependency: [if], data = [none]
node.setPersistenceCache(persistenceCache); // depends on control dependency: [if], data = [none]
// Determine whether this node is dirty based on comparison between
// Node data and entity data
// If dirty, set the entity data into node and mark it as dirty
if (!DeepEquals.deepEquals(node.getData(), entity))
{
node.setDirty(true); // depends on control dependency: [if], data = [none]
}
else if (node.isProcessed())
{
node.setDirty(false); // depends on control dependency: [if], data = [none]
}
node.setData(entity); // depends on control dependency: [if], data = [none]
// If node is NOT in managed state, its data needs to be
// replaced with the one provided in entity object
}
// Put this node into object graph
graph.addNode(nodeId, node);
// Iterate over relations and construct children nodes
for (Relation relation : entityMetadata.getRelations())
{
if (relation != null)
{
// Child Object set in this entity
Object childObject = PropertyAccessorHelper.getObject(entity, relation.getProperty());
if (childObject != null && !ProxyHelper.isProxy(childObject))
{
EntityMetadata metadata = KunderaMetadataManager.getEntityMetadata(pd.getKunderaMetadata(),
PropertyAccessorHelper.getGenericClass(relation.getProperty()));
if (metadata != null && relation.isJoinedByPrimaryKey())
{
PropertyAccessorHelper.setId(childObject, metadata,
PropertyAccessorHelper.getId(entity, entityMetadata)); // depends on control dependency: [if], data = [none]
}
// This child object could be either an entity(1-1 or M-1)
// or a
// collection/ Map of entities(1-M or M-M)
if (Collection.class.isAssignableFrom(childObject.getClass()))
{
// For each entity in the collection, construct a child
// node and add to graph
Collection childrenObjects = (Collection) childObject;
if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))
for (Object childObj : childrenObjects)
{
if (childObj != null)
{
addChildNodesToGraph(graph, node, relation, childObj,
metadata != null ? getChildNodeState(metadata, childObj) : initialNodeState); // depends on control dependency: [if], data = [none]
}
}
}
else if (Map.class.isAssignableFrom(childObject.getClass()))
{
Map childrenObjects = (Map) childObject;
if (childrenObjects != null && !ProxyHelper.isProxyCollection(childrenObjects))
{
for (Map.Entry entry : (Set<Map.Entry>) childrenObjects.entrySet())
{
addChildNodesToGraph(graph, node, relation, entry,
metadata != null ? getChildNodeState(metadata, entry) : initialNodeState); // depends on control dependency: [for], data = [entry]
}
}
}
else
{
// Construct child node and add to graph
addChildNodesToGraph(graph, node, relation, childObject,
metadata != null ? getChildNodeState(metadata, childObject) : initialNodeState); // depends on control dependency: [if], data = [none]
}
}
}
}
// Means compelte graph is build.
node.setGraphCompleted(true);
return node;
} }
|
public class class_name {
static String getIntervalPattern(ChronoParser<?> parser) {
AttributeQuery attrs = parser.getAttributes();
if (attrs.contains(Attributes.LANGUAGE)) {
Locale locale = attrs.get(Attributes.LANGUAGE);
return CalendarText.patternForInterval(locale);
}
return "{0}/{1}";
} }
|
public class class_name {
static String getIntervalPattern(ChronoParser<?> parser) {
AttributeQuery attrs = parser.getAttributes();
if (attrs.contains(Attributes.LANGUAGE)) {
Locale locale = attrs.get(Attributes.LANGUAGE);
return CalendarText.patternForInterval(locale); // depends on control dependency: [if], data = [none]
}
return "{0}/{1}";
} }
|
public class class_name {
public static final Optional<RangeArgs> createFromNode(ForNode node) {
if (node.getExpr().getRoot() instanceof FunctionNode) {
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (fn.getSoyFunction() instanceof RangeFunction) {
return Optional.of(create(fn.getChildren()));
}
}
return Optional.absent();
} }
|
public class class_name {
public static final Optional<RangeArgs> createFromNode(ForNode node) {
if (node.getExpr().getRoot() instanceof FunctionNode) {
FunctionNode fn = (FunctionNode) node.getExpr().getRoot();
if (fn.getSoyFunction() instanceof RangeFunction) {
return Optional.of(create(fn.getChildren())); // depends on control dependency: [if], data = [none]
}
}
return Optional.absent();
} }
|
public class class_name {
public boolean isConstructor(PDefinition def)
{
if (def instanceof AExplicitOperationDefinition)
{
AExplicitOperationDefinition op = (AExplicitOperationDefinition)def;
return op.getIsConstructor();
}
else if (def instanceof AImplicitOperationDefinition)
{
AImplicitOperationDefinition op = (AImplicitOperationDefinition)def;
return op.getIsConstructor();
}
else if (def instanceof AInheritedDefinition)
{
AInheritedDefinition op = (AInheritedDefinition)def;
return isConstructor(op.getSuperdef());
}
return false;
} }
|
public class class_name {
public boolean isConstructor(PDefinition def)
{
if (def instanceof AExplicitOperationDefinition)
{
AExplicitOperationDefinition op = (AExplicitOperationDefinition)def;
return op.getIsConstructor(); // depends on control dependency: [if], data = [none]
}
else if (def instanceof AImplicitOperationDefinition)
{
AImplicitOperationDefinition op = (AImplicitOperationDefinition)def;
return op.getIsConstructor(); // depends on control dependency: [if], data = [none]
}
else if (def instanceof AInheritedDefinition)
{
AInheritedDefinition op = (AInheritedDefinition)def;
return isConstructor(op.getSuperdef()); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
private static int gallopLeft(Comparable<Object> key, Object[] a,
int base, int len, int hint) {
assert len > 0 && hint >= 0 && hint < len;
int lastOfs = 0;
int ofs = 1;
if (key.compareTo(a[base + hint]) > 0) {
// Gallop right until a[base+hint+lastOfs] < key <= a[base+hint+ofs]
int maxOfs = len - hint;
while (ofs < maxOfs && key.compareTo(a[base + hint + ofs]) > 0) {
lastOfs = ofs;
ofs = (ofs << 1) + 1;
if (ofs <= 0) // int overflow
ofs = maxOfs;
}
if (ofs > maxOfs)
ofs = maxOfs;
// Make offsets relative to base
lastOfs += hint;
ofs += hint;
} else { // key <= a[base + hint]
// Gallop left until a[base+hint-ofs] < key <= a[base+hint-lastOfs]
final int maxOfs = hint + 1;
while (ofs < maxOfs && key.compareTo(a[base + hint - ofs]) <= 0) {
lastOfs = ofs;
ofs = (ofs << 1) + 1;
if (ofs <= 0) // int overflow
ofs = maxOfs;
}
if (ofs > maxOfs)
ofs = maxOfs;
// Make offsets relative to base
int tmp = lastOfs;
lastOfs = hint - ofs;
ofs = hint - tmp;
}
assert -1 <= lastOfs && lastOfs < ofs && ofs <= len;
/*
* Now a[base+lastOfs] < key <= a[base+ofs], so key belongs somewhere
* to the right of lastOfs but no farther right than ofs. Do a binary
* search, with invariant a[base + lastOfs - 1] < key <= a[base + ofs].
*/
lastOfs++;
while (lastOfs < ofs) {
int m = lastOfs + ((ofs - lastOfs) >>> 1);
if (key.compareTo(a[base + m]) > 0)
lastOfs = m + 1; // a[base + m] < key
else
ofs = m; // key <= a[base + m]
}
assert lastOfs == ofs; // so a[base + ofs - 1] < key <= a[base + ofs]
return ofs;
} }
|
public class class_name {
private static int gallopLeft(Comparable<Object> key, Object[] a,
int base, int len, int hint) {
assert len > 0 && hint >= 0 && hint < len;
int lastOfs = 0;
int ofs = 1;
if (key.compareTo(a[base + hint]) > 0) {
// Gallop right until a[base+hint+lastOfs] < key <= a[base+hint+ofs]
int maxOfs = len - hint;
while (ofs < maxOfs && key.compareTo(a[base + hint + ofs]) > 0) {
lastOfs = ofs; // depends on control dependency: [while], data = [none]
ofs = (ofs << 1) + 1; // depends on control dependency: [while], data = [none]
if (ofs <= 0) // int overflow
ofs = maxOfs;
}
if (ofs > maxOfs)
ofs = maxOfs;
// Make offsets relative to base
lastOfs += hint; // depends on control dependency: [if], data = [none]
ofs += hint; // depends on control dependency: [if], data = [none]
} else { // key <= a[base + hint]
// Gallop left until a[base+hint-ofs] < key <= a[base+hint-lastOfs]
final int maxOfs = hint + 1;
while (ofs < maxOfs && key.compareTo(a[base + hint - ofs]) <= 0) {
lastOfs = ofs; // depends on control dependency: [while], data = [none]
ofs = (ofs << 1) + 1; // depends on control dependency: [while], data = [(ofs]
if (ofs <= 0) // int overflow
ofs = maxOfs;
}
if (ofs > maxOfs)
ofs = maxOfs;
// Make offsets relative to base
int tmp = lastOfs;
lastOfs = hint - ofs; // depends on control dependency: [if], data = [none]
ofs = hint - tmp; // depends on control dependency: [if], data = [none]
}
assert -1 <= lastOfs && lastOfs < ofs && ofs <= len;
/*
* Now a[base+lastOfs] < key <= a[base+ofs], so key belongs somewhere
* to the right of lastOfs but no farther right than ofs. Do a binary
* search, with invariant a[base + lastOfs - 1] < key <= a[base + ofs].
*/
lastOfs++;
while (lastOfs < ofs) {
int m = lastOfs + ((ofs - lastOfs) >>> 1);
if (key.compareTo(a[base + m]) > 0)
lastOfs = m + 1; // a[base + m] < key
else
ofs = m; // key <= a[base + m]
}
assert lastOfs == ofs; // so a[base + ofs - 1] < key <= a[base + ofs]
return ofs;
} }
|
public class class_name {
public static double det( DMatrixSparseCSC A ) {
LUSparseDecomposition_F64<DMatrixSparseCSC> alg = DecompositionFactory_DSCC.lu(FillReducing.NONE);
if( alg.inputModified() ) {
A = A.copy();
}
if( !alg.decompose(A) )
return 0.0;
return alg.computeDeterminant().real;
} }
|
public class class_name {
public static double det( DMatrixSparseCSC A ) {
LUSparseDecomposition_F64<DMatrixSparseCSC> alg = DecompositionFactory_DSCC.lu(FillReducing.NONE);
if( alg.inputModified() ) {
A = A.copy(); // depends on control dependency: [if], data = [none]
}
if( !alg.decompose(A) )
return 0.0;
return alg.computeDeterminant().real;
} }
|
public class class_name {
private void buildInheritedSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
if (!(inhclass.isPublic() ||
utils.isLinkable(inhclass, configuration))) {
continue;
}
if (inhclass == classDoc) {
continue;
}
List<ProgramElementDoc> inhmembers = visibleMemberMap.getMembersFor(inhclass);
if (inhmembers.size() > 0) {
Collections.sort(inhmembers);
Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
Content linksTree = writer.getInheritedSummaryLinksTree();
for (int j = 0; j < inhmembers.size(); ++j) {
writer.addInheritedMemberSummary(
inhclass.isPackagePrivate() &&
!utils.isLinkable(inhclass, configuration) ?
classDoc : inhclass,
inhmembers.get(j),
j == 0,
j == inhmembers.size() - 1, linksTree);
}
inheritedTree.addContent(linksTree);
summaryTreeList.add(writer.getMemberTree(inheritedTree));
}
}
} }
|
public class class_name {
private void buildInheritedSummary(MemberSummaryWriter writer,
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
if (!(inhclass.isPublic() ||
utils.isLinkable(inhclass, configuration))) {
continue;
}
if (inhclass == classDoc) {
continue;
}
List<ProgramElementDoc> inhmembers = visibleMemberMap.getMembersFor(inhclass);
if (inhmembers.size() > 0) {
Collections.sort(inhmembers); // depends on control dependency: [if], data = [none]
Content inheritedTree = writer.getInheritedSummaryHeader(inhclass);
Content linksTree = writer.getInheritedSummaryLinksTree();
for (int j = 0; j < inhmembers.size(); ++j) {
writer.addInheritedMemberSummary(
inhclass.isPackagePrivate() &&
!utils.isLinkable(inhclass, configuration) ?
classDoc : inhclass,
inhmembers.get(j),
j == 0,
j == inhmembers.size() - 1, linksTree); // depends on control dependency: [for], data = [none]
}
inheritedTree.addContent(linksTree); // depends on control dependency: [if], data = [none]
summaryTreeList.add(writer.getMemberTree(inheritedTree)); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static boolean requiredByPlatformFeature(ContentBasedLocalBundleRepository br, File baseDir, File b) {
try {
Map<String, ProvisioningFeatureDefinition> features = new Product(baseDir).getFeatureDefinitions();
for (ProvisioningFeatureDefinition fd : features.values()) {
if (fd.isKernel()) {
if (requiredByJar(br, fd, b))
return true;
}
}
} catch (Exception e) {
}
return false;
} }
|
public class class_name {
private static boolean requiredByPlatformFeature(ContentBasedLocalBundleRepository br, File baseDir, File b) {
try {
Map<String, ProvisioningFeatureDefinition> features = new Product(baseDir).getFeatureDefinitions();
for (ProvisioningFeatureDefinition fd : features.values()) {
if (fd.isKernel()) {
if (requiredByJar(br, fd, b))
return true;
}
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public boolean setStreamConfiguration(StreamConfiguration sc) {
boolean changed = false;
sc = new StreamConfiguration(sc);
if(sc != null) {
if(flacStreamIsOpen || isEncoding)
changed = false;
else {
streamLock.lock();
try{
if(flacStreamIsOpen || isEncoding) {//can't change streamconfig on open stream.
changed = false;
}
else {
streamConfig = sc;
reset();
frame = new Frame(sc);
prepareThreadManager(sc);
this.setEncodingConfiguration(this.encodingConfig);
clear();
changed = true;
}
}finally {
streamLock.unlock();
}
}
}
return changed;
} }
|
public class class_name {
public boolean setStreamConfiguration(StreamConfiguration sc) {
boolean changed = false;
sc = new StreamConfiguration(sc);
if(sc != null) {
if(flacStreamIsOpen || isEncoding)
changed = false;
else {
streamLock.lock(); // depends on control dependency: [if], data = [none]
try{
if(flacStreamIsOpen || isEncoding) {//can't change streamconfig on open stream.
changed = false; // depends on control dependency: [if], data = [none]
}
else {
streamConfig = sc; // depends on control dependency: [if], data = [none]
reset(); // depends on control dependency: [if], data = [none]
frame = new Frame(sc); // depends on control dependency: [if], data = [none]
prepareThreadManager(sc); // depends on control dependency: [if], data = [none]
this.setEncodingConfiguration(this.encodingConfig); // depends on control dependency: [if], data = [none]
clear(); // depends on control dependency: [if], data = [none]
changed = true; // depends on control dependency: [if], data = [none]
}
}finally {
streamLock.unlock();
}
}
}
return changed;
} }
|
public class class_name {
public static IScope resolveScope(IScope from, String path) {
log.debug("resolveScope from: {} path: {}", from.getName(), path);
IScope current = from;
if (path.startsWith(SLASH)) {
current = ScopeUtils.findRoot(current);
path = path.substring(1, path.length());
}
if (path.endsWith(SLASH)) {
path = path.substring(0, path.length() - 1);
}
log.trace("Current: {}", current);
String[] parts = path.split(SLASH);
if (log.isTraceEnabled()) {
log.trace("Parts: {}", Arrays.toString(parts));
}
for (String part : parts) {
log.trace("Part: {}", part);
if (part.equals(".")) {
continue;
}
if (part.equals("..")) {
if (!current.hasParent()) {
return null;
}
current = current.getParent();
continue;
}
if (!current.hasChildScope(part)) {
return null;
}
current = current.getScope(part);
log.trace("Current: {}", current);
}
return current;
} }
|
public class class_name {
public static IScope resolveScope(IScope from, String path) {
log.debug("resolveScope from: {} path: {}", from.getName(), path);
IScope current = from;
if (path.startsWith(SLASH)) {
current = ScopeUtils.findRoot(current); // depends on control dependency: [if], data = [none]
path = path.substring(1, path.length()); // depends on control dependency: [if], data = [none]
}
if (path.endsWith(SLASH)) {
path = path.substring(0, path.length() - 1); // depends on control dependency: [if], data = [none]
}
log.trace("Current: {}", current);
String[] parts = path.split(SLASH);
if (log.isTraceEnabled()) {
log.trace("Parts: {}", Arrays.toString(parts)); // depends on control dependency: [if], data = [none]
}
for (String part : parts) {
log.trace("Part: {}", part); // depends on control dependency: [for], data = [part]
if (part.equals(".")) {
continue;
}
if (part.equals("..")) {
if (!current.hasParent()) {
return null; // depends on control dependency: [if], data = [none]
}
current = current.getParent(); // depends on control dependency: [if], data = [none]
continue;
}
if (!current.hasChildScope(part)) {
return null; // depends on control dependency: [if], data = [none]
}
current = current.getScope(part); // depends on control dependency: [for], data = [part]
log.trace("Current: {}", current); // depends on control dependency: [for], data = [none]
}
return current;
} }
|
public class class_name {
public void marshall(GetSamplingTargetsRequest getSamplingTargetsRequest, ProtocolMarshaller protocolMarshaller) {
if (getSamplingTargetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSamplingTargetsRequest.getSamplingStatisticsDocuments(), SAMPLINGSTATISTICSDOCUMENTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetSamplingTargetsRequest getSamplingTargetsRequest, ProtocolMarshaller protocolMarshaller) {
if (getSamplingTargetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSamplingTargetsRequest.getSamplingStatisticsDocuments(), SAMPLINGSTATISTICSDOCUMENTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public FilterSupportStatus isFilterSupported(
FilterAdapterContext context,
ColumnPaginationFilter filter) {
// We require a single column family to be specified:
int familyCount = context.getScan().numFamilies();
if (filter.getColumnOffset() != null && familyCount != 1) {
return UNSUPPORTED_STATUS;
}
return FilterSupportStatus.SUPPORTED;
} }
|
public class class_name {
@Override
public FilterSupportStatus isFilterSupported(
FilterAdapterContext context,
ColumnPaginationFilter filter) {
// We require a single column family to be specified:
int familyCount = context.getScan().numFamilies();
if (filter.getColumnOffset() != null && familyCount != 1) {
return UNSUPPORTED_STATUS; // depends on control dependency: [if], data = [none]
}
return FilterSupportStatus.SUPPORTED;
} }
|
public class class_name {
protected Date massageDate (Object arg)
{
if (arg instanceof Long) {
return new Date(((Long)arg).longValue());
} else if (arg instanceof Date) {
return (Date)arg;
} else if (arg instanceof Calendar) {
return ((Calendar)arg).getTime();
} else {
System.err.println("Date provided with invalid argument " +
"[arg=" + arg + ", aclass=" +
StringUtil.shortClassName(arg) + "].");
return null;
}
} }
|
public class class_name {
protected Date massageDate (Object arg)
{
if (arg instanceof Long) {
return new Date(((Long)arg).longValue()); // depends on control dependency: [if], data = [none]
} else if (arg instanceof Date) {
return (Date)arg; // depends on control dependency: [if], data = [none]
} else if (arg instanceof Calendar) {
return ((Calendar)arg).getTime(); // depends on control dependency: [if], data = [none]
} else {
System.err.println("Date provided with invalid argument " +
"[arg=" + arg + ", aclass=" +
StringUtil.shortClassName(arg) + "]."); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static byte[] xorAlignRight(byte[] b1, byte[] b2) {
if (b1.length > b2.length) {
byte[] b2_ = new byte[b1.length];
System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length);
b2 = b2_;
} else if (b2.length > b1.length) {
byte[] b1_ = new byte[b2.length];
System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length);
b1 = b1_;
}
return xor(b1, b2);
} }
|
public class class_name {
public static byte[] xorAlignRight(byte[] b1, byte[] b2) {
if (b1.length > b2.length) {
byte[] b2_ = new byte[b1.length];
System.arraycopy(b2, 0, b2_, b1.length - b2.length, b2.length); // depends on control dependency: [if], data = [b2.length)]
b2 = b2_; // depends on control dependency: [if], data = [none]
} else if (b2.length > b1.length) {
byte[] b1_ = new byte[b2.length];
System.arraycopy(b1, 0, b1_, b2.length - b1.length, b1.length); // depends on control dependency: [if], data = [b1.length)]
b1 = b1_; // depends on control dependency: [if], data = [none]
}
return xor(b1, b2);
} }
|
public class class_name {
@Override
public List<Asset> findAssets(String searchString, Collection<ResourceType> types) throws IOException, RequestFailureException {
String encodedSearchString = URLEncoder.encode(searchString, "UTF-8");
StringBuffer url = new StringBuffer("/assets?q=" + encodedSearchString);
if (types != null && !types.isEmpty()) {
Collection<String> typeValues = new HashSet<String>();
for (ResourceType type : types) {
typeValues.add(type.getValue());
}
url.append("&" + createListFilter(FilterableAttribute.TYPE, typeValues));
}
// Call massive to run the query
HttpURLConnection connection = createHttpURLConnectionToMassive(url.toString());
connection.setRequestMethod("GET");
testResponseCode(connection);
InputStream is = connection.getInputStream();
// take the returned input stream and convert it to assets
List<Asset> assets = JSONAssetConverter.readValues(is);
return assets;
} }
|
public class class_name {
@Override
public List<Asset> findAssets(String searchString, Collection<ResourceType> types) throws IOException, RequestFailureException {
String encodedSearchString = URLEncoder.encode(searchString, "UTF-8");
StringBuffer url = new StringBuffer("/assets?q=" + encodedSearchString);
if (types != null && !types.isEmpty()) {
Collection<String> typeValues = new HashSet<String>();
for (ResourceType type : types) {
typeValues.add(type.getValue()); // depends on control dependency: [for], data = [type]
}
url.append("&" + createListFilter(FilterableAttribute.TYPE, typeValues));
}
// Call massive to run the query
HttpURLConnection connection = createHttpURLConnectionToMassive(url.toString());
connection.setRequestMethod("GET");
testResponseCode(connection);
InputStream is = connection.getInputStream();
// take the returned input stream and convert it to assets
List<Asset> assets = JSONAssetConverter.readValues(is);
return assets;
} }
|
public class class_name {
public static Object simpleDeepCopy( Object object ) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(object);
oos.flush();
oos.close();
bos.close();
byte [] byteData = bos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(byteData);
return new ObjectInputStream(bais).readObject();
}
catch ( IOException ioe ) {
throw new RuntimeException( "DeepCopy IOException", ioe );
}
catch ( ClassNotFoundException cnf ) {
throw new RuntimeException( "DeepCopy ClassNotFoundException", cnf );
}
} }
|
public class class_name {
public static Object simpleDeepCopy( Object object ) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(object); // depends on control dependency: [try], data = [none]
oos.flush(); // depends on control dependency: [try], data = [none]
oos.close(); // depends on control dependency: [try], data = [none]
bos.close(); // depends on control dependency: [try], data = [none]
byte [] byteData = bos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(byteData);
return new ObjectInputStream(bais).readObject(); // depends on control dependency: [try], data = [none]
}
catch ( IOException ioe ) {
throw new RuntimeException( "DeepCopy IOException", ioe );
} // depends on control dependency: [catch], data = [none]
catch ( ClassNotFoundException cnf ) {
throw new RuntimeException( "DeepCopy ClassNotFoundException", cnf );
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static int readSizeT(Pointer ptr) {
// TODO(scottb): make not public.
if (SIZE_T_CLASS == SizeT4.class) {
int result;
result = ptr.getInt(0);
assert result >= 0;
return result;
} else {
long result = ptr.getLong(0);
assert result >= 0;
assert result < Integer.MAX_VALUE;
return (int) result;
}
} }
|
public class class_name {
public static int readSizeT(Pointer ptr) {
// TODO(scottb): make not public.
if (SIZE_T_CLASS == SizeT4.class) {
int result;
result = ptr.getInt(0); // depends on control dependency: [if], data = [none]
assert result >= 0;
return result; // depends on control dependency: [if], data = [none]
} else {
long result = ptr.getLong(0);
assert result >= 0;
assert result < Integer.MAX_VALUE;
return (int) result; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setResourceGroupTags(java.util.Collection<ResourceGroupTag> resourceGroupTags) {
if (resourceGroupTags == null) {
this.resourceGroupTags = null;
return;
}
this.resourceGroupTags = new java.util.ArrayList<ResourceGroupTag>(resourceGroupTags);
} }
|
public class class_name {
public void setResourceGroupTags(java.util.Collection<ResourceGroupTag> resourceGroupTags) {
if (resourceGroupTags == null) {
this.resourceGroupTags = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.resourceGroupTags = new java.util.ArrayList<ResourceGroupTag>(resourceGroupTags);
} }
|
public class class_name {
public static void main(String[] args) throws ClassNotFoundException, IOException {
// When run off the command-line or a build script, this program takes in two arguments: the path containing
// class files to scan, and the output file to generate.
long startTime = System.nanoTime();
String path = args[0];
String outputFile = args[1];
System.out.printf(" [ComponentMetadataPersister] Starting component metadata generation. Scanning classes in %s%n", path);
ComponentMetadataRepo repo = new ComponentMetadataRepo();
File f = new File(path);
process(repo, f.getAbsolutePath(), f);
// Test that all dependencies now exist in the component metadata map.
Map<String, String> dependencies = new HashMap<>(128);
for (ComponentMetadata md : repo.componentMetadataMap.values()) {
if (md.getDependencies() != null) dependencies.putAll(md.getDependencies());
}
if (Boolean.getBoolean("infinispan.isCoreModule")) {
// Perform this sanity check
boolean hasErrors = false;
for (Map.Entry<String, String> e : dependencies.entrySet()) {
if (!repo.componentMetadataMap.containsKey(e.getKey())) {
if (!repo.hasFactory(e.getKey())) {
System.out.printf(" [ComponentMetadataPersister] **** WARNING!!! Missing components or factories for dependency on %s%n", e.getKey());
hasErrors = true;
}
}
}
if (hasErrors && Boolean.getBoolean("infinispan.isCoreModule"))
throw new RuntimeException("Could not pass sanity check of all annotated components and their respective factories/dependencies.");
}
writeMetadata(repo, outputFile);
System.out.printf(" [ComponentMetadataPersister] %s components and %s factories.%n%n",
repo.componentMetadataMap.size(), repo.factories.size());
} }
|
public class class_name {
public static void main(String[] args) throws ClassNotFoundException, IOException {
// When run off the command-line or a build script, this program takes in two arguments: the path containing
// class files to scan, and the output file to generate.
long startTime = System.nanoTime();
String path = args[0];
String outputFile = args[1];
System.out.printf(" [ComponentMetadataPersister] Starting component metadata generation. Scanning classes in %s%n", path);
ComponentMetadataRepo repo = new ComponentMetadataRepo();
File f = new File(path);
process(repo, f.getAbsolutePath(), f);
// Test that all dependencies now exist in the component metadata map.
Map<String, String> dependencies = new HashMap<>(128);
for (ComponentMetadata md : repo.componentMetadataMap.values()) {
if (md.getDependencies() != null) dependencies.putAll(md.getDependencies());
}
if (Boolean.getBoolean("infinispan.isCoreModule")) {
// Perform this sanity check
boolean hasErrors = false;
for (Map.Entry<String, String> e : dependencies.entrySet()) {
if (!repo.componentMetadataMap.containsKey(e.getKey())) {
if (!repo.hasFactory(e.getKey())) {
System.out.printf(" [ComponentMetadataPersister] **** WARNING!!! Missing components or factories for dependency on %s%n", e.getKey()); // depends on control dependency: [if], data = [none]
hasErrors = true; // depends on control dependency: [if], data = [none]
}
}
}
if (hasErrors && Boolean.getBoolean("infinispan.isCoreModule"))
throw new RuntimeException("Could not pass sanity check of all annotated components and their respective factories/dependencies.");
}
writeMetadata(repo, outputFile);
System.out.printf(" [ComponentMetadataPersister] %s components and %s factories.%n%n",
repo.componentMetadataMap.size(), repo.factories.size());
} }
|
public class class_name {
public List<String> getEventTypes() {
ArrayList<String> allEvents = new ArrayList<>();
if (isDelivered()) {
allEvents.add(MessageEvent.DELIVERED);
}
if (!isMessageEventRequest() && isCancelled()) {
allEvents.add(MessageEvent.CANCELLED);
}
if (isComposing()) {
allEvents.add(MessageEvent.COMPOSING);
}
if (isDisplayed()) {
allEvents.add(MessageEvent.DISPLAYED);
}
if (isOffline()) {
allEvents.add(MessageEvent.OFFLINE);
}
return allEvents;
} }
|
public class class_name {
public List<String> getEventTypes() {
ArrayList<String> allEvents = new ArrayList<>();
if (isDelivered()) {
allEvents.add(MessageEvent.DELIVERED); // depends on control dependency: [if], data = [none]
}
if (!isMessageEventRequest() && isCancelled()) {
allEvents.add(MessageEvent.CANCELLED); // depends on control dependency: [if], data = [none]
}
if (isComposing()) {
allEvents.add(MessageEvent.COMPOSING); // depends on control dependency: [if], data = [none]
}
if (isDisplayed()) {
allEvents.add(MessageEvent.DISPLAYED); // depends on control dependency: [if], data = [none]
}
if (isOffline()) {
allEvents.add(MessageEvent.OFFLINE); // depends on control dependency: [if], data = [none]
}
return allEvents;
} }
|
public class class_name {
public void add(LongDoubleVector other) {
if (other instanceof LongDoubleUnsortedVector) {
LongDoubleUnsortedVector vec = (LongDoubleUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for LongDoubleDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd()));
}
} }
|
public class class_name {
public void add(LongDoubleVector other) {
if (other instanceof LongDoubleUnsortedVector) {
LongDoubleUnsortedVector vec = (LongDoubleUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]); // depends on control dependency: [for], data = [i]
}
} else {
// TODO: Add special case for LongDoubleDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.DoubleAdd())); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ClassLoader getCompositeClassLoader()
{
List<ClassLoader> loaders = new ArrayList<>();
AddonFilter filter = new AddonFilter()
{
@Override
public boolean accept(Addon addon)
{
return addonDependsOnGraphApi(addon);
}
};
for (Addon addon : furnace.getAddonRegistry().getAddons(filter))
{
loaders.add(addon.getClassLoader());
}
return new FurnaceCompositeClassLoader(getClass().getClassLoader(), loaders);
} }
|
public class class_name {
public ClassLoader getCompositeClassLoader()
{
List<ClassLoader> loaders = new ArrayList<>();
AddonFilter filter = new AddonFilter()
{
@Override
public boolean accept(Addon addon)
{
return addonDependsOnGraphApi(addon);
}
};
for (Addon addon : furnace.getAddonRegistry().getAddons(filter))
{
loaders.add(addon.getClassLoader()); // depends on control dependency: [for], data = [addon]
}
return new FurnaceCompositeClassLoader(getClass().getClassLoader(), loaders);
} }
|
public class class_name {
public byte[] getEncodedPKCS1() {
try {
if (externalDigest != null)
digest = externalDigest;
else
digest = sig.sign();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream dout = new ASN1OutputStream(bOut);
dout.writeObject(new DEROctetString(digest));
dout.close();
return bOut.toByteArray();
}
catch (Exception e) {
throw new ExceptionConverter(e);
}
} }
|
public class class_name {
public byte[] getEncodedPKCS1() {
try {
if (externalDigest != null)
digest = externalDigest;
else
digest = sig.sign();
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream dout = new ASN1OutputStream(bOut);
dout.writeObject(new DEROctetString(digest)); // depends on control dependency: [try], data = [none]
dout.close(); // depends on control dependency: [try], data = [none]
return bOut.toByteArray(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new ExceptionConverter(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
static String[] split(URI remoteUri, String suffix, @Nullable String defaultBranch) {
final String host = remoteUri.getHost();
if (host == null && !remoteUri.getScheme().endsWith("+file")) {
throw new IllegalArgumentException("no host in remoteUri: " + remoteUri);
}
final String path = remoteUri.getRawPath();
if (path == null) {
throw new IllegalArgumentException("no path in remoteUri: " + remoteUri);
}
final Matcher matcher = Pattern.compile("^(.*?\\." + suffix + ")(?:$|/)").matcher(path);
if (!matcher.find()) {
throw new IllegalArgumentException("no '." + suffix + "' in remoteUri path: " + remoteUri);
}
final String newRemoteUri;
final int port = remoteUri.getPort();
if (host != null) {
if (port > 0) {
newRemoteUri = remoteUri.getScheme() + "://" + host + ':' + port +
matcher.group(1);
} else {
newRemoteUri = remoteUri.getScheme() + "://" + host + matcher.group(1);
}
} else {
newRemoteUri = remoteUri.getScheme() + "://" + matcher.group(1);
}
final String remotePath;
try {
String decoded = URLDecoder.decode(path.substring(matcher.group(1).length()), "UTF-8");
decoded = normalizePath(decoded);
remotePath = decoded;
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
final String fragment = remoteUri.getFragment();
final String remoteBranch = fragment != null ? fragment : defaultBranch;
return new String[] { newRemoteUri, remotePath, remoteBranch };
} }
|
public class class_name {
static String[] split(URI remoteUri, String suffix, @Nullable String defaultBranch) {
final String host = remoteUri.getHost();
if (host == null && !remoteUri.getScheme().endsWith("+file")) {
throw new IllegalArgumentException("no host in remoteUri: " + remoteUri);
}
final String path = remoteUri.getRawPath();
if (path == null) {
throw new IllegalArgumentException("no path in remoteUri: " + remoteUri);
}
final Matcher matcher = Pattern.compile("^(.*?\\." + suffix + ")(?:$|/)").matcher(path);
if (!matcher.find()) {
throw new IllegalArgumentException("no '." + suffix + "' in remoteUri path: " + remoteUri);
}
final String newRemoteUri;
final int port = remoteUri.getPort();
if (host != null) {
if (port > 0) {
newRemoteUri = remoteUri.getScheme() + "://" + host + ':' + port +
matcher.group(1); // depends on control dependency: [if], data = [none]
} else {
newRemoteUri = remoteUri.getScheme() + "://" + host + matcher.group(1);
}
} else {
newRemoteUri = remoteUri.getScheme() + "://" + matcher.group(1);
}
final String remotePath; // depends on control dependency: [if], data = [none]
try {
String decoded = URLDecoder.decode(path.substring(matcher.group(1).length()), "UTF-8");
decoded = normalizePath(decoded); // depends on control dependency: [try], data = [none]
remotePath = decoded; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new Error(e);
} // depends on control dependency: [catch], data = [none]
final String fragment = remoteUri.getFragment();
final String remoteBranch = fragment != null ? fragment : defaultBranch;
return new String[] { newRemoteUri, remotePath, remoteBranch }; // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public JsonObject export() {
JsonObject result = JsonObject.create();
for (MutationToken token : tokens) {
JsonObject bucket = result.getObject(token.bucket());
if (bucket == null) {
bucket = JsonObject.create();
result.put(token.bucket(), bucket);
}
bucket.put(
String.valueOf(token.vbucketID()),
JsonArray.from(token.sequenceNumber(), String.valueOf(token.vbucketUUID()))
);
}
return result;
} }
|
public class class_name {
public JsonObject export() {
JsonObject result = JsonObject.create();
for (MutationToken token : tokens) {
JsonObject bucket = result.getObject(token.bucket());
if (bucket == null) {
bucket = JsonObject.create(); // depends on control dependency: [if], data = [none]
result.put(token.bucket(), bucket); // depends on control dependency: [if], data = [none]
}
bucket.put(
String.valueOf(token.vbucketID()),
JsonArray.from(token.sequenceNumber(), String.valueOf(token.vbucketUUID()))
); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
@Override
protected void visitPrintNode(PrintNode node) {
TranslateToPyExprVisitor translator =
new TranslateToPyExprVisitor(localVarExprs, pluginValueFactory, errorReporter);
PyExpr pyExpr = translator.exec(node.getExpr());
// Process directives.
for (PrintDirectiveNode directiveNode : node.getChildren()) {
// Get directive.
SoyPrintDirective directive = directiveNode.getPrintDirective();
if (!(directive instanceof SoyPySrcPrintDirective)) {
errorReporter.report(
directiveNode.getSourceLocation(),
UNKNOWN_SOY_PY_SRC_PRINT_DIRECTIVE,
directiveNode.getName());
continue;
}
// Get directive args.
List<ExprRootNode> args = directiveNode.getArgs();
// Translate directive args.
List<PyExpr> argsPyExprs = new ArrayList<>(args.size());
for (ExprRootNode arg : args) {
argsPyExprs.add(translator.exec(arg));
}
// Apply directive.
pyExpr = ((SoyPySrcPrintDirective) directive).applyForPySrc(pyExpr, argsPyExprs);
}
pyExprs.add(pyExpr);
} }
|
public class class_name {
@Override
protected void visitPrintNode(PrintNode node) {
TranslateToPyExprVisitor translator =
new TranslateToPyExprVisitor(localVarExprs, pluginValueFactory, errorReporter);
PyExpr pyExpr = translator.exec(node.getExpr());
// Process directives.
for (PrintDirectiveNode directiveNode : node.getChildren()) {
// Get directive.
SoyPrintDirective directive = directiveNode.getPrintDirective();
if (!(directive instanceof SoyPySrcPrintDirective)) {
errorReporter.report(
directiveNode.getSourceLocation(),
UNKNOWN_SOY_PY_SRC_PRINT_DIRECTIVE,
directiveNode.getName()); // depends on control dependency: [if], data = [none]
continue;
}
// Get directive args.
List<ExprRootNode> args = directiveNode.getArgs();
// Translate directive args.
List<PyExpr> argsPyExprs = new ArrayList<>(args.size());
for (ExprRootNode arg : args) {
argsPyExprs.add(translator.exec(arg)); // depends on control dependency: [for], data = [arg]
}
// Apply directive.
pyExpr = ((SoyPySrcPrintDirective) directive).applyForPySrc(pyExpr, argsPyExprs); // depends on control dependency: [for], data = [none]
}
pyExprs.add(pyExpr);
} }
|
public class class_name {
static RedisNodeDescription findNodeByHostAndPort(Collection<RedisNodeDescription> nodes, String host, int port) {
for (RedisNodeDescription node : nodes) {
RedisURI nodeUri = node.getUri();
if (nodeUri.getHost().equals(host) && nodeUri.getPort() == port) {
return node;
}
}
return null;
} }
|
public class class_name {
static RedisNodeDescription findNodeByHostAndPort(Collection<RedisNodeDescription> nodes, String host, int port) {
for (RedisNodeDescription node : nodes) {
RedisURI nodeUri = node.getUri();
if (nodeUri.getHost().equals(host) && nodeUri.getPort() == port) {
return node; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
@Nonnull
public BugInstance addClassAndMethod(JavaClass javaClass, Method method) {
addClass(javaClass.getClassName());
addMethod(javaClass, method);
if (!MemberUtils.isUserGenerated(method)) {
foundInAutogeneratedMethod();
}
return this;
} }
|
public class class_name {
@Nonnull
public BugInstance addClassAndMethod(JavaClass javaClass, Method method) {
addClass(javaClass.getClassName());
addMethod(javaClass, method);
if (!MemberUtils.isUserGenerated(method)) {
foundInAutogeneratedMethod(); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static Base64Url encode(byte[] bytes) {
if (bytes == null) {
return new Base64Url(null);
} else {
return new Base64Url(BaseEncoding.base64Url().omitPadding().encode(bytes));
}
} }
|
public class class_name {
public static Base64Url encode(byte[] bytes) {
if (bytes == null) {
return new Base64Url(null); // depends on control dependency: [if], data = [null)]
} else {
return new Base64Url(BaseEncoding.base64Url().omitPadding().encode(bytes)); // depends on control dependency: [if], data = [(bytes]
}
} }
|
public class class_name {
public void handleStoreInstruction(StoreInstruction obj) {
try {
int numConsumed = obj.consumeStack(cpg);
if (numConsumed == Const.UNPREDICTABLE) {
throw new InvalidBytecodeException("Unpredictable stack consumption");
}
int index = obj.getIndex();
// Store values into consecutive locals corresponding
// to the order in which the values appeared on the stack.
while (numConsumed-- > 0) {
Value value = frame.popValue();
frame.setValue(index++, value);
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException(e.toString());
}
} }
|
public class class_name {
public void handleStoreInstruction(StoreInstruction obj) {
try {
int numConsumed = obj.consumeStack(cpg);
if (numConsumed == Const.UNPREDICTABLE) {
throw new InvalidBytecodeException("Unpredictable stack consumption");
}
int index = obj.getIndex();
// Store values into consecutive locals corresponding
// to the order in which the values appeared on the stack.
while (numConsumed-- > 0) {
Value value = frame.popValue();
frame.setValue(index++, value); // depends on control dependency: [while], data = [none]
}
} catch (DataflowAnalysisException e) {
throw new InvalidBytecodeException(e.toString());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected synchronized BoundingBox getCurBounds() {
if (currBoundingBox == null) {
if (mapView == null) {
throw new NullPointerException("mapView == null");
}
if (mapView.getWidth() <= 0 || mapView.getHeight() <= 0) {
throw new IllegalArgumentException(" mapView.getWidth() <= 0 " +
"|| mapView.getHeight() <= 0 "
+ mapView.getWidth() + " || " + mapView.getHeight());
}
/** North-West geo point of the bound */
LatLong nw_ = mapView.getMapViewProjection().fromPixels(0, 0);
// Log.e(TAG, " nw_.latitude => " + nw_.latitude + " nw_.longitude => " + nw_.longitude );
/** South-East geo point of the bound */
LatLong se_ = mapView.getMapViewProjection().fromPixels(mapView.getWidth(),
mapView.getHeight());
// Log.e(TAG, " se_.latitude => " + se_.latitude + " se_.longitude => " + se_.longitude );
if (nw_ != null && se_ != null) {
if (se_.latitude > nw_.latitude) {
currBoundingBox = new BoundingBox(nw_.latitude, se_.longitude, se_.latitude,
nw_.longitude);
} else {
currBoundingBox = new BoundingBox(se_.latitude, nw_.longitude, nw_.latitude,
se_.longitude);
}
}
}
return currBoundingBox;
} }
|
public class class_name {
protected synchronized BoundingBox getCurBounds() {
if (currBoundingBox == null) {
if (mapView == null) {
throw new NullPointerException("mapView == null");
}
if (mapView.getWidth() <= 0 || mapView.getHeight() <= 0) {
throw new IllegalArgumentException(" mapView.getWidth() <= 0 " +
"|| mapView.getHeight() <= 0 "
+ mapView.getWidth() + " || " + mapView.getHeight());
}
/** North-West geo point of the bound */
LatLong nw_ = mapView.getMapViewProjection().fromPixels(0, 0);
// Log.e(TAG, " nw_.latitude => " + nw_.latitude + " nw_.longitude => " + nw_.longitude );
/** South-East geo point of the bound */
LatLong se_ = mapView.getMapViewProjection().fromPixels(mapView.getWidth(),
mapView.getHeight());
// Log.e(TAG, " se_.latitude => " + se_.latitude + " se_.longitude => " + se_.longitude );
if (nw_ != null && se_ != null) {
if (se_.latitude > nw_.latitude) {
currBoundingBox = new BoundingBox(nw_.latitude, se_.longitude, se_.latitude,
nw_.longitude); // depends on control dependency: [if], data = [none]
} else {
currBoundingBox = new BoundingBox(se_.latitude, nw_.longitude, nw_.latitude,
se_.longitude); // depends on control dependency: [if], data = [none]
}
}
}
return currBoundingBox;
} }
|
public class class_name {
protected List<JoinableResourceBundle> filterBundlesToRender(List<JoinableResourceBundle> bundles) {
List<JoinableResourceBundle> filteredBundles = new ArrayList<>();
for (JoinableResourceBundle bundle : bundles) {
if (!bundle.getInclusionPattern().isIncludeOnlyOnDebug()) {
filteredBundles.add(bundle);
}
}
return filteredBundles;
} }
|
public class class_name {
protected List<JoinableResourceBundle> filterBundlesToRender(List<JoinableResourceBundle> bundles) {
List<JoinableResourceBundle> filteredBundles = new ArrayList<>();
for (JoinableResourceBundle bundle : bundles) {
if (!bundle.getInclusionPattern().isIncludeOnlyOnDebug()) {
filteredBundles.add(bundle); // depends on control dependency: [if], data = [none]
}
}
return filteredBundles;
} }
|
public class class_name {
public void draw(java.awt.Graphics2D g, java.awt.geom.AffineTransform normal2Device) {
if ((project == null) || !posWasCalc) return;
// use world coordinates for position, but draw in screen coordinates
// so that the symbols stay the same size
AffineTransform world2Device = g.getTransform();
g.setTransform(normal2Device); // identity transform for screen coords
// transform World to Normal coords:
// world2Normal = pixelAT-1 * world2Device
// cache for pick closest
AffineTransform world2Normal;
try {
world2Normal = normal2Device.createInverse();
world2Normal.concatenate( world2Device);
} catch ( java.awt.geom.NoninvertibleTransformException e) {
System.out.println(
" RendSurfObs: NoninvertibleTransformException on " +
normal2Device);
return;
}
// we want aliasing; but save previous state to restore at end
Object saveHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
//g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g.setStroke(new java.awt.BasicStroke(1.0f));
/* set up the grid
Rectangle2D bbox = (Rectangle2D) g.getClip(); // clipping area in normal coords
// clear the grid = "no stations are drawn"
stationGrid.clear();
// set the grid size based on typical bounding box
stationGrid.setGrid(bbox, typicalBB.getWidth(), typicalBB.getHeight());
// always draw selected
if (selected != null) {
selected.calcPos( world2Normal);
stationGrid.markIfClear( selected.getBB(), selected);
selected.draw(g);
} */
g.setFont( textFont.getFont());
g.setColor(color);
int count = 0;
int npts = obsUIlist.size();
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, npts);
for (int i=0; i < npts; i++) {
ObservationUI s = (ObservationUI) obsUIlist.get(i);
s.calcPos(world2Normal);
s.draw(g);
if (Double.isNaN( s.screenPos.getX())) {
System.out.println("screenPos="+s.screenPos+" world = "+s.worldPos);
continue;
}
if (count == 0)
path.moveTo( (float) s.screenPos.getX(), (float) s.screenPos.getY());
else
path.lineTo( (float) s.screenPos.getX(), (float) s.screenPos.getY());
count++;
}
g.setColor(color);
if (drawConnectingLine)
g.draw( path);
// draw selected
if (selected != null)
selected.draw(g);
// restore
g.setTransform(world2Device);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, saveHint);
} }
|
public class class_name {
public void draw(java.awt.Graphics2D g, java.awt.geom.AffineTransform normal2Device) {
if ((project == null) || !posWasCalc) return;
// use world coordinates for position, but draw in screen coordinates
// so that the symbols stay the same size
AffineTransform world2Device = g.getTransform();
g.setTransform(normal2Device); // identity transform for screen coords
// transform World to Normal coords:
// world2Normal = pixelAT-1 * world2Device
// cache for pick closest
AffineTransform world2Normal;
try {
world2Normal = normal2Device.createInverse();
// depends on control dependency: [try], data = [none]
world2Normal.concatenate( world2Device);
// depends on control dependency: [try], data = [none]
} catch ( java.awt.geom.NoninvertibleTransformException e) {
System.out.println(
" RendSurfObs: NoninvertibleTransformException on " +
normal2Device);
return;
}
// depends on control dependency: [catch], data = [none]
// we want aliasing; but save previous state to restore at end
Object saveHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
//g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g.setStroke(new java.awt.BasicStroke(1.0f));
/* set up the grid
Rectangle2D bbox = (Rectangle2D) g.getClip(); // clipping area in normal coords
// clear the grid = "no stations are drawn"
stationGrid.clear();
// set the grid size based on typical bounding box
stationGrid.setGrid(bbox, typicalBB.getWidth(), typicalBB.getHeight());
// always draw selected
if (selected != null) {
selected.calcPos( world2Normal);
stationGrid.markIfClear( selected.getBB(), selected);
selected.draw(g);
} */
g.setFont( textFont.getFont());
g.setColor(color);
int count = 0;
int npts = obsUIlist.size();
GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, npts);
for (int i=0; i < npts; i++) {
ObservationUI s = (ObservationUI) obsUIlist.get(i);
s.calcPos(world2Normal);
// depends on control dependency: [for], data = [none]
s.draw(g);
// depends on control dependency: [for], data = [none]
if (Double.isNaN( s.screenPos.getX())) {
System.out.println("screenPos="+s.screenPos+" world = "+s.worldPos);
// depends on control dependency: [if], data = [none]
continue;
}
if (count == 0)
path.moveTo( (float) s.screenPos.getX(), (float) s.screenPos.getY());
else
path.lineTo( (float) s.screenPos.getX(), (float) s.screenPos.getY());
count++;
// depends on control dependency: [for], data = [none]
}
g.setColor(color);
if (drawConnectingLine)
g.draw( path);
// draw selected
if (selected != null)
selected.draw(g);
// restore
g.setTransform(world2Device);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, saveHint);
} }
|
public class class_name {
@Bean(EXECUTOR_SERVICE_BEAN_NAME)
public ExecutorService executorService() {
if (this.properties.getNumberOfThread() == 0) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Use cached thread pool.");
}
return Executors.newCachedThreadPool();
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Use {} fixed thread pool.", this.properties.getNumberOfThread());
}
return Executors.newFixedThreadPool(this.properties.getNumberOfThread());
} }
|
public class class_name {
@Bean(EXECUTOR_SERVICE_BEAN_NAME)
public ExecutorService executorService() {
if (this.properties.getNumberOfThread() == 0) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Use cached thread pool."); // depends on control dependency: [if], data = [none]
}
return Executors.newCachedThreadPool(); // depends on control dependency: [if], data = [none]
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Use {} fixed thread pool.", this.properties.getNumberOfThread()); // depends on control dependency: [if], data = [none]
}
return Executors.newFixedThreadPool(this.properties.getNumberOfThread());
} }
|
public class class_name {
public boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider) {
// todo: for multithreaded usage this block needs to be synchronized
if (!_serviceProviders.containsKey(serviceClass)) {
_serviceProviders.put(serviceClass, new ServiceProvider(serviceProvider));
BeanContextServiceAvailableEvent bcsae = new BeanContextServiceAvailableEvent((BeanContextServices)getPeer(), serviceClass);
fireServiceAvailableEvent(bcsae);
return true;
}
// end synchronized
return false;
} }
|
public class class_name {
public boolean addService(Class serviceClass, BeanContextServiceProvider serviceProvider) {
// todo: for multithreaded usage this block needs to be synchronized
if (!_serviceProviders.containsKey(serviceClass)) {
_serviceProviders.put(serviceClass, new ServiceProvider(serviceProvider)); // depends on control dependency: [if], data = [none]
BeanContextServiceAvailableEvent bcsae = new BeanContextServiceAvailableEvent((BeanContextServices)getPeer(), serviceClass);
fireServiceAvailableEvent(bcsae); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// end synchronized
return false;
} }
|
public class class_name {
private static DateTimeRule toWallTimeRule(DateTimeRule rule, int rawOffset, int dstSavings) {
if (rule.getTimeRuleType() == DateTimeRule.WALL_TIME) {
return rule;
}
int wallt = rule.getRuleMillisInDay();
if (rule.getTimeRuleType() == DateTimeRule.UTC_TIME) {
wallt += (rawOffset + dstSavings);
} else if (rule.getTimeRuleType() == DateTimeRule.STANDARD_TIME) {
wallt += dstSavings;
}
int month = -1, dom = 0, dow = 0, dtype = -1;
int dshift = 0;
if (wallt < 0) {
dshift = -1;
wallt += Grego.MILLIS_PER_DAY;
} else if (wallt >= Grego.MILLIS_PER_DAY) {
dshift = 1;
wallt -= Grego.MILLIS_PER_DAY;
}
month = rule.getRuleMonth();
dom = rule.getRuleDayOfMonth();
dow = rule.getRuleDayOfWeek();
dtype = rule.getDateRuleType();
if (dshift != 0) {
if (dtype == DateTimeRule.DOW) {
// Convert to DOW_GEW_DOM or DOW_LEQ_DOM rule first
int wim = rule.getRuleWeekInMonth();
if (wim > 0) {
dtype = DateTimeRule.DOW_GEQ_DOM;
dom = 7 * (wim - 1) + 1;
} else {
dtype = DateTimeRule.DOW_LEQ_DOM;
dom = MONTHLENGTH[month] + 7 * (wim + 1);
}
}
// Shift one day before or after
dom += dshift;
if (dom == 0) {
month--;
month = month < Calendar.JANUARY ? Calendar.DECEMBER : month;
dom = MONTHLENGTH[month];
} else if (dom > MONTHLENGTH[month]) {
month++;
month = month > Calendar.DECEMBER ? Calendar.JANUARY : month;
dom = 1;
}
if (dtype != DateTimeRule.DOM) {
// Adjust day of week
dow += dshift;
if (dow < Calendar.SUNDAY) {
dow = Calendar.SATURDAY;
} else if (dow > Calendar.SATURDAY) {
dow = Calendar.SUNDAY;
}
}
}
// Create a new rule
DateTimeRule modifiedRule;
if (dtype == DateTimeRule.DOM) {
modifiedRule = new DateTimeRule(month, dom, wallt, DateTimeRule.WALL_TIME);
} else {
modifiedRule = new DateTimeRule(month, dom, dow,
(dtype == DateTimeRule.DOW_GEQ_DOM), wallt, DateTimeRule.WALL_TIME);
}
return modifiedRule;
} }
|
public class class_name {
private static DateTimeRule toWallTimeRule(DateTimeRule rule, int rawOffset, int dstSavings) {
if (rule.getTimeRuleType() == DateTimeRule.WALL_TIME) {
return rule; // depends on control dependency: [if], data = [none]
}
int wallt = rule.getRuleMillisInDay();
if (rule.getTimeRuleType() == DateTimeRule.UTC_TIME) {
wallt += (rawOffset + dstSavings); // depends on control dependency: [if], data = [none]
} else if (rule.getTimeRuleType() == DateTimeRule.STANDARD_TIME) {
wallt += dstSavings; // depends on control dependency: [if], data = [none]
}
int month = -1, dom = 0, dow = 0, dtype = -1;
int dshift = 0;
if (wallt < 0) {
dshift = -1; // depends on control dependency: [if], data = [none]
wallt += Grego.MILLIS_PER_DAY; // depends on control dependency: [if], data = [none]
} else if (wallt >= Grego.MILLIS_PER_DAY) {
dshift = 1; // depends on control dependency: [if], data = [none]
wallt -= Grego.MILLIS_PER_DAY; // depends on control dependency: [if], data = [none]
}
month = rule.getRuleMonth();
dom = rule.getRuleDayOfMonth();
dow = rule.getRuleDayOfWeek();
dtype = rule.getDateRuleType();
if (dshift != 0) {
if (dtype == DateTimeRule.DOW) {
// Convert to DOW_GEW_DOM or DOW_LEQ_DOM rule first
int wim = rule.getRuleWeekInMonth();
if (wim > 0) {
dtype = DateTimeRule.DOW_GEQ_DOM; // depends on control dependency: [if], data = [none]
dom = 7 * (wim - 1) + 1; // depends on control dependency: [if], data = [(wim]
} else {
dtype = DateTimeRule.DOW_LEQ_DOM; // depends on control dependency: [if], data = [none]
dom = MONTHLENGTH[month] + 7 * (wim + 1); // depends on control dependency: [if], data = [(wim]
}
}
// Shift one day before or after
dom += dshift; // depends on control dependency: [if], data = [none]
if (dom == 0) {
month--; // depends on control dependency: [if], data = [none]
month = month < Calendar.JANUARY ? Calendar.DECEMBER : month; // depends on control dependency: [if], data = [none]
dom = MONTHLENGTH[month]; // depends on control dependency: [if], data = [none]
} else if (dom > MONTHLENGTH[month]) {
month++; // depends on control dependency: [if], data = [none]
month = month > Calendar.DECEMBER ? Calendar.JANUARY : month; // depends on control dependency: [if], data = [none]
dom = 1; // depends on control dependency: [if], data = [none]
}
if (dtype != DateTimeRule.DOM) {
// Adjust day of week
dow += dshift; // depends on control dependency: [if], data = [none]
if (dow < Calendar.SUNDAY) {
dow = Calendar.SATURDAY; // depends on control dependency: [if], data = [none]
} else if (dow > Calendar.SATURDAY) {
dow = Calendar.SUNDAY; // depends on control dependency: [if], data = [none]
}
}
}
// Create a new rule
DateTimeRule modifiedRule;
if (dtype == DateTimeRule.DOM) {
modifiedRule = new DateTimeRule(month, dom, wallt, DateTimeRule.WALL_TIME); // depends on control dependency: [if], data = [none]
} else {
modifiedRule = new DateTimeRule(month, dom, dow,
(dtype == DateTimeRule.DOW_GEQ_DOM), wallt, DateTimeRule.WALL_TIME); // depends on control dependency: [if], data = [none]
}
return modifiedRule;
} }
|
public class class_name {
public String format(INDArray arr, boolean summarize) {
this.scientificFormat = "0.";
int addPrecision = this.precision;
while (addPrecision > 0) {
this.scientificFormat += "#";
addPrecision -= 1;
}
this.scientificFormat = this.scientificFormat + "E0";
if (this.scientificFormat.length() + 2 > this.padding) this.padding = this.scientificFormat.length() + 2;
this.maxToPrintWithoutSwitching = Math.pow(10,this.precision);
this.minToPrintWithoutSwitching = 1.0/(this.maxToPrintWithoutSwitching);
if (summarize && arr.length() > 1000) return format(arr, 0, true);
return format(arr, 0, false);
} }
|
public class class_name {
public String format(INDArray arr, boolean summarize) {
this.scientificFormat = "0.";
int addPrecision = this.precision;
while (addPrecision > 0) {
this.scientificFormat += "#";
addPrecision -= 1; // depends on control dependency: [while], data = [none]
}
this.scientificFormat = this.scientificFormat + "E0";
if (this.scientificFormat.length() + 2 > this.padding) this.padding = this.scientificFormat.length() + 2;
this.maxToPrintWithoutSwitching = Math.pow(10,this.precision);
this.minToPrintWithoutSwitching = 1.0/(this.maxToPrintWithoutSwitching);
if (summarize && arr.length() > 1000) return format(arr, 0, true);
return format(arr, 0, false);
} }
|
public class class_name {
public PropertyList<Property> getProperties(final String paramValue) {
PropertyList<Property> properties = index.get(paramValue);
if (properties == null) {
properties = EMPTY_LIST;
}
return properties;
} }
|
public class class_name {
public PropertyList<Property> getProperties(final String paramValue) {
PropertyList<Property> properties = index.get(paramValue);
if (properties == null) {
properties = EMPTY_LIST; // depends on control dependency: [if], data = [none]
}
return properties;
} }
|
public class class_name {
public int getFieldExprIndex(final String _expr)
{
int ret = -1;
if (getAllFieldExpr().containsKey(_expr)) {
final Integer ident = getAllFieldExpr().get(_expr);
ret = ident.intValue();
}
return ret;
} }
|
public class class_name {
public int getFieldExprIndex(final String _expr)
{
int ret = -1;
if (getAllFieldExpr().containsKey(_expr)) {
final Integer ident = getAllFieldExpr().get(_expr);
ret = ident.intValue(); // depends on control dependency: [if], data = [none]
}
return ret;
} }
|
public class class_name {
protected void populateBean(final T resultBean, final String[] nameMapping, final CsvBindingErrors bindingErrors) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final String fieldName = nameMapping[i];
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( fieldName == null || fieldValue == null || bindingErrors.hasFieldErrors(fieldName)) {
continue;
}
// invoke the setter on the bean
final Method setMethod = cache.getSetMethod(resultBean, fieldName, fieldValue.getClass());
try {
setMethod.invoke(resultBean, fieldValue);
} catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e);
}
}
} }
|
public class class_name {
protected void populateBean(final T resultBean, final String[] nameMapping, final CsvBindingErrors bindingErrors) {
// map each column to its associated field on the bean
for( int i = 0; i < nameMapping.length; i++ ) {
final String fieldName = nameMapping[i];
final Object fieldValue = processedColumns.get(i);
// don't call a set-method in the bean if there is no name mapping for the column or no result to store
if( fieldName == null || fieldValue == null || bindingErrors.hasFieldErrors(fieldName)) {
continue;
}
// invoke the setter on the bean
final Method setMethod = cache.getSetMethod(resultBean, fieldName, fieldValue.getClass());
try {
setMethod.invoke(resultBean, fieldValue);
// depends on control dependency: [try], data = [none]
} catch(final Exception e) {
throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e);
}
// depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
static void generateLogForSQL(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
// manage log
if (method.getParent().getParent().generateLog) {
methodBuilder.addCode("\n// manage log\n");
methodBuilder.addStatement("$T.info(_sql)", Logger.class);
}
} }
|
public class class_name {
static void generateLogForSQL(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) {
// manage log
if (method.getParent().getParent().generateLog) {
methodBuilder.addCode("\n// manage log\n");
methodBuilder.addStatement("$T.info(_sql)", Logger.class); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void set_async_reply_model(final int id, final int reply_model) {
final AsyncCallObject aco = async_request_table.get(id);
if (aco != null) {
aco.reply_model = reply_model;
}
} }
|
public class class_name {
public void set_async_reply_model(final int id, final int reply_model) {
final AsyncCallObject aco = async_request_table.get(id);
if (aco != null) {
aco.reply_model = reply_model; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final String normalizeSignature(String deplDescriptorSignature)
{
StringBuilder theSignature = new StringBuilder(deplDescriptorSignature);
int scanIndex = 0;
while (scanIndex < theSignature.length())
{
if (theSignature.charAt(scanIndex) == ' ')
{
char next = theSignature.charAt(scanIndex + 1);
if (next == ' ' | next == '[' | next == ']')
{
theSignature.deleteCharAt(scanIndex);
}
else
{
++scanIndex;
}
}
else
{
++scanIndex;
}
}
return theSignature.toString();
} }
|
public class class_name {
public static final String normalizeSignature(String deplDescriptorSignature)
{
StringBuilder theSignature = new StringBuilder(deplDescriptorSignature);
int scanIndex = 0;
while (scanIndex < theSignature.length())
{
if (theSignature.charAt(scanIndex) == ' ')
{
char next = theSignature.charAt(scanIndex + 1);
if (next == ' ' | next == '[' | next == ']')
{
theSignature.deleteCharAt(scanIndex); // depends on control dependency: [if], data = [none]
}
else
{
++scanIndex; // depends on control dependency: [if], data = [none]
}
}
else
{
++scanIndex; // depends on control dependency: [if], data = [none]
}
}
return theSignature.toString();
} }
|
public class class_name {
protected void appendSQL(final String _tablePrefix,
final StringBuilder _cmd)
{
if (sections.size() > 0) {
if (isStarted()) {
new SQLSelectPart(SQLPart.AND).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
} else {
new SQLSelectPart(SQLPart.WHERE).appendSQL(_cmd);
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd);
}
addSectionsSQL(_tablePrefix, _cmd, sections);
}
} }
|
public class class_name {
protected void appendSQL(final String _tablePrefix,
final StringBuilder _cmd)
{
if (sections.size() > 0) {
if (isStarted()) {
new SQLSelectPart(SQLPart.AND).appendSQL(_cmd); // depends on control dependency: [if], data = [none]
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd); // depends on control dependency: [if], data = [none]
} else {
new SQLSelectPart(SQLPart.WHERE).appendSQL(_cmd); // depends on control dependency: [if], data = [none]
new SQLSelectPart(SQLPart.SPACE).appendSQL(_cmd); // depends on control dependency: [if], data = [none]
}
addSectionsSQL(_tablePrefix, _cmd, sections); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Observable<ServiceResponse<StorageAccountInfoInner>> getStorageAccountWithServiceResponseAsync(String resourceGroupName, String accountName, String storageAccountName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (storageAccountName == null) {
throw new IllegalArgumentException("Parameter storageAccountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getStorageAccount(resourceGroupName, accountName, storageAccountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<StorageAccountInfoInner>>>() {
@Override
public Observable<ServiceResponse<StorageAccountInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<StorageAccountInfoInner> clientResponse = getStorageAccountDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<StorageAccountInfoInner>> getStorageAccountWithServiceResponseAsync(String resourceGroupName, String accountName, String storageAccountName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (storageAccountName == null) {
throw new IllegalArgumentException("Parameter storageAccountName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.getStorageAccount(resourceGroupName, accountName, storageAccountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<StorageAccountInfoInner>>>() {
@Override
public Observable<ServiceResponse<StorageAccountInfoInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<StorageAccountInfoInner> clientResponse = getStorageAccountDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
private static boolean analyse500Response(final String content) {
if (content.contains("error") && content.contains("{not_found, missing_named_view}")) {
LOGGER.debug("Design document not found, error is {}", content);
return false;
}
if (content.contains("error") && content.contains("\"badarg\"")) {
LOGGER.debug("Malformed view query");
return false;
}
return true;
} }
|
public class class_name {
private static boolean analyse500Response(final String content) {
if (content.contains("error") && content.contains("{not_found, missing_named_view}")) {
LOGGER.debug("Design document not found, error is {}", content); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
if (content.contains("error") && content.contains("\"badarg\"")) {
LOGGER.debug("Malformed view query"); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public synchronized void finalReap() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
// Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing
// all the entries no matter if they have timed out or not. Cancel alarm if set. d623593
if (ivFuture != null) {
ivIsCanceled = true;
ivFuture.cancel(false);
ivFuture = null;
}
for (Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator(); iterator.hasNext();) {
RemoteAsyncResultImpl asyncResult = iterator.next();
releaseResources(asyncResult); // d690014.3
iterator.remove();
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
} }
|
public class class_name {
public synchronized void finalReap() {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
// Re-write the finalReap to use the LinkedHashSet, iterating thru the list removing
// all the entries no matter if they have timed out or not. Cancel alarm if set. d623593
if (ivFuture != null) {
ivIsCanceled = true; // depends on control dependency: [if], data = [none]
ivFuture.cancel(false); // depends on control dependency: [if], data = [none]
ivFuture = null; // depends on control dependency: [if], data = [none]
}
for (Iterator<RemoteAsyncResultImpl> iterator = ivAllRemoteAsyncResults.iterator(); iterator.hasNext();) {
RemoteAsyncResultImpl asyncResult = iterator.next();
releaseResources(asyncResult); // d690014.3 // depends on control dependency: [for], data = [none]
iterator.remove(); // depends on control dependency: [for], data = [iterator]
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "finalReap : Remote Async Results = " + ivAllRemoteAsyncResults.size());
} }
|
public class class_name {
private ActiveRule newRule(int ID, RuleActiveRegressionNode node, double[] statistics) {
ActiveRule r=newRule(ID);
if (node!=null)
{
if(node.getPerceptron()!=null)
{
r.getLearningNode().setPerceptron(new Perceptron(node.getPerceptron()));
r.getLearningNode().getPerceptron().setLearningRatio(this.learningRatio);
}
if (statistics==null)
{
double mean;
if(node.getNodeStatistics().getValue(0)>0){
mean=node.getNodeStatistics().getValue(1)/node.getNodeStatistics().getValue(0);
r.getLearningNode().getTargetMean().reset(mean, 1);
}
}
}
if (statistics!=null && ((RuleActiveRegressionNode)r.getLearningNode()).getTargetMean()!=null)
{
double mean;
if(statistics[0]>0){
mean=statistics[1]/statistics[0];
((RuleActiveRegressionNode)r.getLearningNode()).getTargetMean().reset(mean, (long)statistics[0]);
}
}
return r;
} }
|
public class class_name {
private ActiveRule newRule(int ID, RuleActiveRegressionNode node, double[] statistics) {
ActiveRule r=newRule(ID);
if (node!=null)
{
if(node.getPerceptron()!=null)
{
r.getLearningNode().setPerceptron(new Perceptron(node.getPerceptron())); // depends on control dependency: [if], data = [(node.getPerceptron()]
r.getLearningNode().getPerceptron().setLearningRatio(this.learningRatio); // depends on control dependency: [if], data = [none]
}
if (statistics==null)
{
double mean;
if(node.getNodeStatistics().getValue(0)>0){
mean=node.getNodeStatistics().getValue(1)/node.getNodeStatistics().getValue(0); // depends on control dependency: [if], data = [0)]
r.getLearningNode().getTargetMean().reset(mean, 1); // depends on control dependency: [if], data = [none]
}
}
}
if (statistics!=null && ((RuleActiveRegressionNode)r.getLearningNode()).getTargetMean()!=null)
{
double mean;
if(statistics[0]>0){
mean=statistics[1]/statistics[0]; // depends on control dependency: [if], data = [none]
((RuleActiveRegressionNode)r.getLearningNode()).getTargetMean().reset(mean, (long)statistics[0]); // depends on control dependency: [if], data = [none]
}
}
return r;
} }
|
public class class_name {
protected PrimitiveMatrix getViewReturns() {
final int tmpRowDim = myViews.size();
final int tmpColDim = 1;
final PrimitiveMatrix.DenseReceiver retVal = MATRIX_FACTORY.makeDense(tmpRowDim, tmpColDim);
double tmpRet;
final double tmpRAF = this.getRiskAversion().doubleValue();
for (int i = 0; i < tmpRowDim; i++) {
tmpRet = myViews.get(i).getMeanReturn();
retVal.set(i, 0, PrimitiveMath.DIVIDE.invoke(tmpRet, tmpRAF));
}
return retVal.build();
} }
|
public class class_name {
protected PrimitiveMatrix getViewReturns() {
final int tmpRowDim = myViews.size();
final int tmpColDim = 1;
final PrimitiveMatrix.DenseReceiver retVal = MATRIX_FACTORY.makeDense(tmpRowDim, tmpColDim);
double tmpRet;
final double tmpRAF = this.getRiskAversion().doubleValue();
for (int i = 0; i < tmpRowDim; i++) {
tmpRet = myViews.get(i).getMeanReturn(); // depends on control dependency: [for], data = [i]
retVal.set(i, 0, PrimitiveMath.DIVIDE.invoke(tmpRet, tmpRAF)); // depends on control dependency: [for], data = [i]
}
return retVal.build();
} }
|
public class class_name {
public final void ruleJvmLowerBound() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtype.g:271:2: ( ( ( rule__JvmLowerBound__Group__0 ) ) )
// InternalXtype.g:272:2: ( ( rule__JvmLowerBound__Group__0 ) )
{
// InternalXtype.g:272:2: ( ( rule__JvmLowerBound__Group__0 ) )
// InternalXtype.g:273:3: ( rule__JvmLowerBound__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getJvmLowerBoundAccess().getGroup());
}
// InternalXtype.g:274:3: ( rule__JvmLowerBound__Group__0 )
// InternalXtype.g:274:4: rule__JvmLowerBound__Group__0
{
pushFollow(FOLLOW_2);
rule__JvmLowerBound__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getJvmLowerBoundAccess().getGroup());
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} }
|
public class class_name {
public final void ruleJvmLowerBound() throws RecognitionException {
int stackSize = keepStackSize();
try {
// InternalXtype.g:271:2: ( ( ( rule__JvmLowerBound__Group__0 ) ) )
// InternalXtype.g:272:2: ( ( rule__JvmLowerBound__Group__0 ) )
{
// InternalXtype.g:272:2: ( ( rule__JvmLowerBound__Group__0 ) )
// InternalXtype.g:273:3: ( rule__JvmLowerBound__Group__0 )
{
if ( state.backtracking==0 ) {
before(grammarAccess.getJvmLowerBoundAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
// InternalXtype.g:274:3: ( rule__JvmLowerBound__Group__0 )
// InternalXtype.g:274:4: rule__JvmLowerBound__Group__0
{
pushFollow(FOLLOW_2);
rule__JvmLowerBound__Group__0();
state._fsp--;
if (state.failed) return ;
}
if ( state.backtracking==0 ) {
after(grammarAccess.getJvmLowerBoundAccess().getGroup()); // depends on control dependency: [if], data = [none]
}
}
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
restoreStackSize(stackSize);
}
return ;
} }
|
public class class_name {
protected void revalidateLayout() {
for (MaterialIcon icon : iconList) {
icon.removeFromParent();
}
iconList.clear();
// same mouse-out handler for all icons
MouseOutHandler outHandler = event -> {
if (!isEnabled() || !isEditable()) {
return;
}
revalidateSelection(currentRating);
};
for (int i = 0; i < maxRating; i++) {
final int rating = i + 1;
MaterialIcon icon = new MaterialIcon(unselectedRatingIcon);
registerHandler(icon.addClickHandler(event -> {
if (!isEnabled() || !isEditable()) {
return;
}
setValue(rating, true);
}));
registerHandler(icon.addMouseOverHandler(event -> {
if (!isEnabled() || !isEditable()) {
return;
}
revalidateSelection(rating);
}));
registerHandler(icon.addMouseOutHandler(outHandler));
add(icon);
iconList.add(icon);
}
revalidateSelection(currentRating);
} }
|
public class class_name {
protected void revalidateLayout() {
for (MaterialIcon icon : iconList) {
icon.removeFromParent(); // depends on control dependency: [for], data = [icon]
}
iconList.clear();
// same mouse-out handler for all icons
MouseOutHandler outHandler = event -> {
if (!isEnabled() || !isEditable()) {
return;
}
revalidateSelection(currentRating);
};
for (int i = 0; i < maxRating; i++) {
final int rating = i + 1;
MaterialIcon icon = new MaterialIcon(unselectedRatingIcon);
registerHandler(icon.addClickHandler(event -> {
if (!isEnabled() || !isEditable()) {
return;
}
setValue(rating, true);
}));
registerHandler(icon.addMouseOverHandler(event -> {
if (!isEnabled() || !isEditable()) {
return;
}
revalidateSelection(rating);
}));
registerHandler(icon.addMouseOutHandler(outHandler));
add(icon);
iconList.add(icon);
}
revalidateSelection(currentRating);
} }
|
public class class_name {
private void addMessageToSitesTree(final HistoryReference historyReference, final HttpMessage message) {
if (View.isInitialised() && !EventQueue.isDispatchThread()) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
addMessageToSitesTree(historyReference, message);
}
});
return;
}
StructuralNode node = SessionStructure.addPath(
Model.getSingleton().getSession(), historyReference, message, true);
if (node != null) {
try {
addUriToAddedNodesModel(SessionStructure.getNodeName(message),
message.getRequestHeader().getMethod(), "");
} catch (URIException e) {
log.error("Error while adding node to added nodes model: " + e.getMessage(), e);
}
}
} }
|
public class class_name {
private void addMessageToSitesTree(final HistoryReference historyReference, final HttpMessage message) {
if (View.isInitialised() && !EventQueue.isDispatchThread()) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
addMessageToSitesTree(historyReference, message);
}
}); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
StructuralNode node = SessionStructure.addPath(
Model.getSingleton().getSession(), historyReference, message, true);
if (node != null) {
try {
addUriToAddedNodesModel(SessionStructure.getNodeName(message),
message.getRequestHeader().getMethod(), ""); // depends on control dependency: [try], data = [none]
} catch (URIException e) {
log.error("Error while adding node to added nodes model: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static void permute(@Nullable int permRowInv[], DMatrixSparseCSC input, @Nullable int permCol[], DMatrixSparseCSC output) {
if( permRowInv!= null && input.numRows > permRowInv.length )
throw new IllegalArgumentException("rowInv permutation vector must have at least as many elements as input has columns");
if( permCol != null && input.numCols > permCol.length )
throw new IllegalArgumentException("permCol permutation vector must have at least as many elements as input has rows");
output.reshape(input.numRows,input.numCols,input.nz_length);
output.indicesSorted = false;
output.nz_length = input.nz_length;
int N = input.numCols;
// traverse through in order for the output columns
int outputNZ = 0;
for (int i = 0; i < N; i++) {
int inputCol = permCol!=null?permCol[i]:i; // column of input to source from
int inputNZ = input.col_idx[inputCol];
int total = input.col_idx[inputCol+1]- inputNZ; // total nz in this column
output.col_idx[i+1] = output.col_idx[i] + total;
for (int j = 0; j < total; j++) {
int row = input.nz_rows[inputNZ];
output.nz_rows[outputNZ] = permRowInv!=null?permRowInv[row]:row;
output.nz_values[outputNZ++] = input.nz_values[inputNZ++];
}
}
} }
|
public class class_name {
public static void permute(@Nullable int permRowInv[], DMatrixSparseCSC input, @Nullable int permCol[], DMatrixSparseCSC output) {
if( permRowInv!= null && input.numRows > permRowInv.length )
throw new IllegalArgumentException("rowInv permutation vector must have at least as many elements as input has columns");
if( permCol != null && input.numCols > permCol.length )
throw new IllegalArgumentException("permCol permutation vector must have at least as many elements as input has rows");
output.reshape(input.numRows,input.numCols,input.nz_length);
output.indicesSorted = false;
output.nz_length = input.nz_length;
int N = input.numCols;
// traverse through in order for the output columns
int outputNZ = 0;
for (int i = 0; i < N; i++) {
int inputCol = permCol!=null?permCol[i]:i; // column of input to source from
int inputNZ = input.col_idx[inputCol];
int total = input.col_idx[inputCol+1]- inputNZ; // total nz in this column
output.col_idx[i+1] = output.col_idx[i] + total; // depends on control dependency: [for], data = [i]
for (int j = 0; j < total; j++) {
int row = input.nz_rows[inputNZ];
output.nz_rows[outputNZ] = permRowInv!=null?permRowInv[row]:row; // depends on control dependency: [for], data = [none]
output.nz_values[outputNZ++] = input.nz_values[inputNZ++]; // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public HFCACertificateResponse getHFCACertificates(User registrar, HFCACertificateRequest req) throws HFCACertificateException {
try {
logger.debug(format("certificate url: %s, registrar: %s", HFCA_CERTIFICATE, registrar.getName()));
JsonObject result = httpGet(HFCA_CERTIFICATE, registrar, req.getQueryParameters());
int statusCode = result.getInt("statusCode");
Collection<HFCACredential> certs = new ArrayList<>();
if (statusCode < 400) {
JsonArray certificates = result.getJsonArray("certs");
if (certificates != null && !certificates.isEmpty()) {
for (int i = 0; i < certificates.size(); i++) {
String certPEM = certificates.getJsonObject(i).getString("PEM");
certs.add(new HFCAX509Certificate(certPEM));
}
}
logger.debug(format("certificate url: %s, registrar: %s done.", HFCA_CERTIFICATE, registrar));
}
return new HFCACertificateResponse(statusCode, certs);
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while getting certificates from url '%s': %s", e.getStatusCode(), HFCA_CERTIFICATE, e.getMessage());
HFCACertificateException certificateException = new HFCACertificateException(msg, e);
logger.error(msg);
throw certificateException;
} catch (Exception e) {
String msg = format("Error while getting certificates from url '%s': %s", HFCA_CERTIFICATE, e.getMessage());
HFCACertificateException certificateException = new HFCACertificateException(msg, e);
logger.error(msg);
throw certificateException;
}
} }
|
public class class_name {
public HFCACertificateResponse getHFCACertificates(User registrar, HFCACertificateRequest req) throws HFCACertificateException {
try {
logger.debug(format("certificate url: %s, registrar: %s", HFCA_CERTIFICATE, registrar.getName()));
JsonObject result = httpGet(HFCA_CERTIFICATE, registrar, req.getQueryParameters());
int statusCode = result.getInt("statusCode");
Collection<HFCACredential> certs = new ArrayList<>();
if (statusCode < 400) {
JsonArray certificates = result.getJsonArray("certs");
if (certificates != null && !certificates.isEmpty()) {
for (int i = 0; i < certificates.size(); i++) {
String certPEM = certificates.getJsonObject(i).getString("PEM");
certs.add(new HFCAX509Certificate(certPEM)); // depends on control dependency: [for], data = [none]
}
}
logger.debug(format("certificate url: %s, registrar: %s done.", HFCA_CERTIFICATE, registrar));
}
return new HFCACertificateResponse(statusCode, certs);
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while getting certificates from url '%s': %s", e.getStatusCode(), HFCA_CERTIFICATE, e.getMessage());
HFCACertificateException certificateException = new HFCACertificateException(msg, e);
logger.error(msg);
throw certificateException;
} catch (Exception e) {
String msg = format("Error while getting certificates from url '%s': %s", HFCA_CERTIFICATE, e.getMessage());
HFCACertificateException certificateException = new HFCACertificateException(msg, e);
logger.error(msg);
throw certificateException;
}
} }
|
public class class_name {
protected String replaceSimpleGroupNameVariables(String str, List<String> groupNames,
List<String> groupValues, boolean debugPrint) {
String result = str;
int length = Math.min(groupNames.size(), groupValues.size());
for (int i=0; i < length; i++) {
if (groupNames != null && groupNames.get(i) != null &&
groupValues != null && groupValues.get(i) != null) {
result = result.replace("{"+groupNames.get(i)+"}", groupValues.get(i));
}
}
if (debugPrint) {
System.out.println(" In PostgreSQLBackend.replaceSimpleGroupNameVariables:");
System.out.println(" str : " + str);
System.out.println(" groupNames : " + groupNames);
System.out.println(" groupValues: " + groupValues);
System.out.println(" result : " + result);
}
return result;
} }
|
public class class_name {
protected String replaceSimpleGroupNameVariables(String str, List<String> groupNames,
List<String> groupValues, boolean debugPrint) {
String result = str;
int length = Math.min(groupNames.size(), groupValues.size());
for (int i=0; i < length; i++) {
if (groupNames != null && groupNames.get(i) != null &&
groupValues != null && groupValues.get(i) != null) {
result = result.replace("{"+groupNames.get(i)+"}", groupValues.get(i)); // depends on control dependency: [if], data = [none]
}
}
if (debugPrint) {
System.out.println(" In PostgreSQLBackend.replaceSimpleGroupNameVariables:"); // depends on control dependency: [if], data = [none]
System.out.println(" str : " + str); // depends on control dependency: [if], data = [none]
System.out.println(" groupNames : " + groupNames); // depends on control dependency: [if], data = [none]
System.out.println(" groupValues: " + groupValues); // depends on control dependency: [if], data = [none]
System.out.println(" result : " + result); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static <T> T createComponent(Class<T> componentClass, Object... dependencies) {
String fqn = componentClass.getName();
String packageName = componentClass.getPackage().getName();
// Accounts for inner classes, ie MyApplication$Component
String simpleName = fqn.substring(packageName.length() + 1);
String generatedName = (packageName + ".Dagger" + simpleName).replace('$', '_');
try {
Class<?> generatedClass = Class.forName(generatedName);
Object builder = generatedClass.getMethod("builder").invoke(null);
for (Method method : builder.getClass().getDeclaredMethods()) {
Class<?>[] params = method.getParameterTypes();
if (params.length == 1) {
Class<?> dependencyClass = params[0];
for (Object dependency : dependencies) {
if (dependencyClass.isAssignableFrom(dependency.getClass())) {
method.invoke(builder, dependency);
break;
}
}
}
}
//noinspection unchecked
return (T) builder.getClass().getMethod("build").invoke(builder);
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
public static <T> T createComponent(Class<T> componentClass, Object... dependencies) {
String fqn = componentClass.getName();
String packageName = componentClass.getPackage().getName();
// Accounts for inner classes, ie MyApplication$Component
String simpleName = fqn.substring(packageName.length() + 1);
String generatedName = (packageName + ".Dagger" + simpleName).replace('$', '_');
try {
Class<?> generatedClass = Class.forName(generatedName);
Object builder = generatedClass.getMethod("builder").invoke(null); // depends on control dependency: [try], data = [none]
for (Method method : builder.getClass().getDeclaredMethods()) {
Class<?>[] params = method.getParameterTypes();
if (params.length == 1) {
Class<?> dependencyClass = params[0];
for (Object dependency : dependencies) {
if (dependencyClass.isAssignableFrom(dependency.getClass())) {
method.invoke(builder, dependency); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
//noinspection unchecked
return (T) builder.getClass().getMethod("build").invoke(builder); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static ArrayList<Element> isDescendant( Element parent, Element maybeDescendant )
{
ArrayList<Element> res = new ArrayList<>();
Element cur = maybeDescendant;
while( cur != null )
{
res.add( 0, cur );
if( cur == parent )
return res;
cur = cur.getParentElement();
}
return null;
} }
|
public class class_name {
public static ArrayList<Element> isDescendant( Element parent, Element maybeDescendant )
{
ArrayList<Element> res = new ArrayList<>();
Element cur = maybeDescendant;
while( cur != null )
{
res.add( 0, cur ); // depends on control dependency: [while], data = [none]
if( cur == parent )
return res;
cur = cur.getParentElement(); // depends on control dependency: [while], data = [none]
}
return null;
} }
|
public class class_name {
public synchronized String makeEscapedCompactString() {
StringBuffer buffer = new StringBuffer();
for(Group group: this){
buffer.append(group.makeEscapedCompactString());
}
return buffer.toString();
} }
|
public class class_name {
public synchronized String makeEscapedCompactString() {
StringBuffer buffer = new StringBuffer();
for(Group group: this){
buffer.append(group.makeEscapedCompactString()); // depends on control dependency: [for], data = [group]
}
return buffer.toString();
} }
|
public class class_name {
public void run() {
try {
Object result = execute();
if (!aborted) {
this.retval = result;
finished = true;
}
}
catch (InterruptedException ie) {
//
}
catch (Throwable t) {
execException = t;
finished = true;
}
} }
|
public class class_name {
public void run() {
try {
Object result = execute();
if (!aborted) {
this.retval = result; // depends on control dependency: [if], data = [none]
finished = true; // depends on control dependency: [if], data = [none]
}
}
catch (InterruptedException ie) {
//
} // depends on control dependency: [catch], data = [none]
catch (Throwable t) {
execException = t;
finished = true;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) {
// Create the bug/editor link root element
final Element linkElement = document.createElement("para");
if (cssClass != null) {
linkElement.setAttribute("role", cssClass);
}
node.appendChild(linkElement);
return linkElement;
} }
|
public class class_name {
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) {
// Create the bug/editor link root element
final Element linkElement = document.createElement("para");
if (cssClass != null) {
linkElement.setAttribute("role", cssClass); // depends on control dependency: [if], data = [none]
}
node.appendChild(linkElement);
return linkElement;
} }
|
public class class_name {
public static Tag outcome(ClientResponse response) {
try {
if (response != null) {
HttpStatus status = response.statusCode();
if (status.is1xxInformational()) {
return OUTCOME_INFORMATIONAL;
}
if (status.is2xxSuccessful()) {
return OUTCOME_SUCCESS;
}
if (status.is3xxRedirection()) {
return OUTCOME_REDIRECTION;
}
if (status.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR;
}
if (status.is5xxServerError()) {
return OUTCOME_SERVER_ERROR;
}
}
return OUTCOME_UNKNOWN;
}
catch (IllegalArgumentException exc) {
return OUTCOME_UNKNOWN;
}
} }
|
public class class_name {
public static Tag outcome(ClientResponse response) {
try {
if (response != null) {
HttpStatus status = response.statusCode();
if (status.is1xxInformational()) {
return OUTCOME_INFORMATIONAL; // depends on control dependency: [if], data = [none]
}
if (status.is2xxSuccessful()) {
return OUTCOME_SUCCESS; // depends on control dependency: [if], data = [none]
}
if (status.is3xxRedirection()) {
return OUTCOME_REDIRECTION; // depends on control dependency: [if], data = [none]
}
if (status.is4xxClientError()) {
return OUTCOME_CLIENT_ERROR; // depends on control dependency: [if], data = [none]
}
if (status.is5xxServerError()) {
return OUTCOME_SERVER_ERROR; // depends on control dependency: [if], data = [none]
}
}
return OUTCOME_UNKNOWN; // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException exc) {
return OUTCOME_UNKNOWN;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static boolean isCatalogCompatible(String catalogVersionStr)
{
if (catalogVersionStr == null || catalogVersionStr.isEmpty()) {
return false;
}
//Check that it is a properly formed verstion string
Object[] catalogVersion = MiscUtils.parseVersionString(catalogVersionStr);
if (catalogVersion == null) {
throw new IllegalArgumentException("Invalid version string " + catalogVersionStr);
}
if (!catalogVersionStr.equals(VoltDB.instance().getVersionString())) {
return false;
}
return true;
} }
|
public class class_name {
public static boolean isCatalogCompatible(String catalogVersionStr)
{
if (catalogVersionStr == null || catalogVersionStr.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
//Check that it is a properly formed verstion string
Object[] catalogVersion = MiscUtils.parseVersionString(catalogVersionStr);
if (catalogVersion == null) {
throw new IllegalArgumentException("Invalid version string " + catalogVersionStr);
}
if (!catalogVersionStr.equals(VoltDB.instance().getVersionString())) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
@Override
public Class<?> fromComponentNameToClass(final String componentName) { // *important
if (LdiStringUtil.isEmpty(componentName)) {
throw new EmptyRuntimeException("componentName");
}
final String suffix = fromComponentNameToSuffix(componentName);
if (suffix == null) {
return null;
}
final String middlePackageName = fromSuffixToPackageName(suffix);
final String partOfClassName = fromComponentNameToPartOfClassName(componentName);
final boolean subAppSuffix = isSubAppSuffix(suffix);
final boolean webAppSufix = isWebAppSuffix(suffix);
final boolean jobAppSufix = isJobAppSuffix(suffix);
for (int i = 0; i < rootPackageNames.length; ++i) {
final String rootPackageName = rootPackageNames[i];
if (subAppSuffix) { // first search sub application package
Class<?> clazz = null;
if (webAppSufix) {
clazz = findWebClass(rootPackageName, partOfClassName);
} else if (jobAppSufix) {
clazz = findJobClass(rootPackageName, partOfClassName);
}
if (clazz != null) {
return clazz;
}
clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
if (clazz != null) {
return clazz;
}
} else {
Class<?> clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
if (clazz != null) {
return clazz;
}
if (webAppSufix) {
clazz = findWebClass(rootPackageName, partOfClassName);
} else if (jobAppSufix) {
clazz = findJobClass(rootPackageName, partOfClassName);
} else { // e.g. base_login_harborLoginAssist (by "pickup" method)
clazz = findWebClass(rootPackageName, partOfClassName); // find as web at first
if (clazz == null) {
clazz = findJobClass(rootPackageName, partOfClassName); // and job as next
}
}
if (clazz != null) {
return clazz;
}
}
}
return null;
} }
|
public class class_name {
@Override
public Class<?> fromComponentNameToClass(final String componentName) { // *important
if (LdiStringUtil.isEmpty(componentName)) {
throw new EmptyRuntimeException("componentName");
}
final String suffix = fromComponentNameToSuffix(componentName);
if (suffix == null) {
return null;
}
final String middlePackageName = fromSuffixToPackageName(suffix);
final String partOfClassName = fromComponentNameToPartOfClassName(componentName);
final boolean subAppSuffix = isSubAppSuffix(suffix);
final boolean webAppSufix = isWebAppSuffix(suffix);
final boolean jobAppSufix = isJobAppSuffix(suffix);
for (int i = 0; i < rootPackageNames.length; ++i) {
final String rootPackageName = rootPackageNames[i];
if (subAppSuffix) { // first search sub application package
Class<?> clazz = null;
if (webAppSufix) {
clazz = findWebClass(rootPackageName, partOfClassName); // depends on control dependency: [if], data = [none]
} else if (jobAppSufix) {
clazz = findJobClass(rootPackageName, partOfClassName); // depends on control dependency: [if], data = [none]
}
if (clazz != null) {
return clazz; // depends on control dependency: [if], data = [none]
}
clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
if (clazz != null) {
return clazz; // depends on control dependency: [if], data = [none]
}
} else {
Class<?> clazz = findClass(rootPackageName, middlePackageName, partOfClassName);
if (clazz != null) {
return clazz; // depends on control dependency: [if], data = [none]
}
if (webAppSufix) {
clazz = findWebClass(rootPackageName, partOfClassName); // depends on control dependency: [if], data = [none]
} else if (jobAppSufix) {
clazz = findJobClass(rootPackageName, partOfClassName); // depends on control dependency: [if], data = [none]
} else { // e.g. base_login_harborLoginAssist (by "pickup" method)
clazz = findWebClass(rootPackageName, partOfClassName); // find as web at first // depends on control dependency: [if], data = [none]
if (clazz == null) {
clazz = findJobClass(rootPackageName, partOfClassName); // and job as next // depends on control dependency: [if], data = [none]
}
}
if (clazz != null) {
return clazz; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
protected RRSGlobalTransactionWrapper getRRSGlobalTransactionWrapper() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "getRRSGlobalTransactionWrapper");
}
if (rrsGlobalTranWrapper == null) {
rrsGlobalTranWrapper = new RRSGlobalTransactionWrapper(this);
}
if (state == STATE_ACTIVE_INUSE) {
state = STATE_TRAN_WRAPPER_INUSE;
tranWrapperInUse = RRSGLOBALTXWRAPPER;
} else { // state not STATE_ACTIVE_INUSE
if (state != STATE_TRAN_WRAPPER_INUSE) {
IllegalStateException e = new IllegalStateException("getRRSGlobalTransactionWrapper: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Object[] parms = new Object[] { "getRRSGlobalTransactionWrapper", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
} else { // state is STATE_TRAN_WRAPPER_INUSE
if (tranWrapperInUse == NONE) {
tranWrapperInUse = RRSGLOBALTXWRAPPER;
} else { //tranWrapperInUse is NOT NONE
if (tranWrapperInUse != RRSGLOBALTXWRAPPER) {
// Need RAS and Trace here.
IllegalStateException e = new IllegalStateException("getRRSGlobalTransactionWrapper: illegal transaction state exception. State = "
+ getTranWrapperString());
Object[] parms = new Object[] { "getRRSGlobalTransactionWrapper", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms);
throw e;
}
}
}
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "getRRSGlobalTransactionWrapper");
}
return rrsGlobalTranWrapper;
} }
|
public class class_name {
protected RRSGlobalTransactionWrapper getRRSGlobalTransactionWrapper() throws ResourceException {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "getRRSGlobalTransactionWrapper");
}
if (rrsGlobalTranWrapper == null) {
rrsGlobalTranWrapper = new RRSGlobalTransactionWrapper(this);
}
if (state == STATE_ACTIVE_INUSE) {
state = STATE_TRAN_WRAPPER_INUSE;
tranWrapperInUse = RRSGLOBALTXWRAPPER;
} else { // state not STATE_ACTIVE_INUSE
if (state != STATE_TRAN_WRAPPER_INUSE) {
IllegalStateException e = new IllegalStateException("getRRSGlobalTransactionWrapper: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Object[] parms = new Object[] { "getRRSGlobalTransactionWrapper", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); // depends on control dependency: [if], data = [none]
throw e;
} else { // state is STATE_TRAN_WRAPPER_INUSE
if (tranWrapperInUse == NONE) {
tranWrapperInUse = RRSGLOBALTXWRAPPER; // depends on control dependency: [if], data = [none]
} else { //tranWrapperInUse is NOT NONE
if (tranWrapperInUse != RRSGLOBALTXWRAPPER) {
// Need RAS and Trace here.
IllegalStateException e = new IllegalStateException("getRRSGlobalTransactionWrapper: illegal transaction state exception. State = "
+ getTranWrapperString());
Object[] parms = new Object[] { "getRRSGlobalTransactionWrapper", e };
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); // depends on control dependency: [if], data = [none]
throw e;
}
}
}
}
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "getRRSGlobalTransactionWrapper");
}
return rrsGlobalTranWrapper;
} }
|
public class class_name {
@Override
protected Content getClassLink(LinkInfo linkInfo) {
Configuration configuration = m_writer.configuration;
Utils utils = configuration.utils;
LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo;
boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty();
TypeElement typeElement = classLinkInfo.typeElement;
// Create a tool tip if we are linking to a class or interface. Don't
// create one if we are linking to a member.
String title = "";
if (classLinkInfo.where == null || classLinkInfo.where.length() == 0) {
boolean isTypeLink = classLinkInfo.type != null &&
utils.isTypeVariable(utils.getComponentType(classLinkInfo.type));
title = getClassToolTip(typeElement, isTypeLink);
}
Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration);
Content link = new ContentBuilder();
if (utils.isIncluded(typeElement)) {
if (configuration.isGeneratedDoc(typeElement)) {
DocPath filename = getPath(classLinkInfo);
if (linkInfo.linkToSelf ||
!(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) {
link.addContent(m_writer.getHyperLink(
filename.fragment(classLinkInfo.where),
label,
classLinkInfo.isStrong, classLinkInfo.styleName,
title, classLinkInfo.target));
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo));
}
return link;
}
}
} else {
Content crossLink = m_writer.getCrossClassLink(
typeElement.getQualifiedName().toString(), classLinkInfo.where,
label, classLinkInfo.isStrong, classLinkInfo.styleName,
true);
if (crossLink != null) {
link.addContent(crossLink);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo));
}
return link;
}
}
// Can't link so just write label.
link.addContent(label);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo));
}
return link;
} }
|
public class class_name {
@Override
protected Content getClassLink(LinkInfo linkInfo) {
Configuration configuration = m_writer.configuration;
Utils utils = configuration.utils;
LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo;
boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty();
TypeElement typeElement = classLinkInfo.typeElement;
// Create a tool tip if we are linking to a class or interface. Don't
// create one if we are linking to a member.
String title = "";
if (classLinkInfo.where == null || classLinkInfo.where.length() == 0) {
boolean isTypeLink = classLinkInfo.type != null &&
utils.isTypeVariable(utils.getComponentType(classLinkInfo.type));
title = getClassToolTip(typeElement, isTypeLink); // depends on control dependency: [if], data = [none]
}
Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration);
Content link = new ContentBuilder();
if (utils.isIncluded(typeElement)) {
if (configuration.isGeneratedDoc(typeElement)) {
DocPath filename = getPath(classLinkInfo);
if (linkInfo.linkToSelf ||
!(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) {
link.addContent(m_writer.getHyperLink(
filename.fragment(classLinkInfo.where),
label,
classLinkInfo.isStrong, classLinkInfo.styleName,
title, classLinkInfo.target)); // depends on control dependency: [if], data = [none]
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none]
}
return link; // depends on control dependency: [if], data = [none]
}
}
} else {
Content crossLink = m_writer.getCrossClassLink(
typeElement.getQualifiedName().toString(), classLinkInfo.where,
label, classLinkInfo.isStrong, classLinkInfo.styleName,
true);
if (crossLink != null) {
link.addContent(crossLink); // depends on control dependency: [if], data = [(crossLink]
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none]
}
return link; // depends on control dependency: [if], data = [none]
}
}
// Can't link so just write label.
link.addContent(label);
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
link.addContent(getTypeParameterLinks(linkInfo)); // depends on control dependency: [if], data = [none]
}
return link;
} }
|
public class class_name {
private void setupComboBoxFile() {
m_target.setInputPrompt(CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_EXPORT_FILE_NAME_EMPTY_0));
m_target.setNewItemsAllowed(true);
List<String> files = CmsDbManager.getFileListFromServer(true);
for (String file : files) {
m_target.addItem(file);
}
} }
|
public class class_name {
private void setupComboBoxFile() {
m_target.setInputPrompt(CmsVaadinUtils.getMessageText(Messages.GUI_DATABASEAPP_EXPORT_FILE_NAME_EMPTY_0));
m_target.setNewItemsAllowed(true);
List<String> files = CmsDbManager.getFileListFromServer(true);
for (String file : files) {
m_target.addItem(file); // depends on control dependency: [for], data = [file]
}
} }
|
public class class_name {
public void setFrustum(Matrix4f projMatrix)
{
if (projMatrix != null)
{
if (mProjMatrix == null)
{
mProjMatrix = new float[16];
}
mProjMatrix = projMatrix.get(mProjMatrix, 0);
mScene.setPickVisible(false);
if (mCuller != null)
{
mCuller.set(projMatrix);
}
else
{
mCuller = new FrustumIntersection(projMatrix);
}
}
mProjection = projMatrix;
} }
|
public class class_name {
public void setFrustum(Matrix4f projMatrix)
{
if (projMatrix != null)
{
if (mProjMatrix == null)
{
mProjMatrix = new float[16]; // depends on control dependency: [if], data = [none]
}
mProjMatrix = projMatrix.get(mProjMatrix, 0); // depends on control dependency: [if], data = [none]
mScene.setPickVisible(false); // depends on control dependency: [if], data = [none]
if (mCuller != null)
{
mCuller.set(projMatrix); // depends on control dependency: [if], data = [none]
}
else
{
mCuller = new FrustumIntersection(projMatrix); // depends on control dependency: [if], data = [none]
}
}
mProjection = projMatrix;
} }
|
public class class_name {
private Point getDropPoint(QuickWidget element, DropPosition pos) {
Point dropPoint = new Point(element.getCenterLocation().x, element.getCenterLocation().y);
if (pos == DropPosition.CENTER) {
return dropPoint;
}
Point dragPoint = new Point(this.getCenterLocation().x, this.getCenterLocation().y);
// Find the side of the DesktopWindowRect of the widget that as the intersect
Point
dragIntersectPoint =
intersection(dragPoint.x, dragPoint.y, dropPoint.x, dropPoint.y, this.getRect());
if (dragIntersectPoint != null) {
Point
dropIntersectPoint =
intersection(dragPoint.x, dragPoint.y, dropPoint.x, dropPoint.y, element.getRect());
if (dropIntersectPoint != null) {
if (pos == DropPosition.EDGE) {
return dropIntersectPoint;
}
// Get the mid point of the line
return new Point((dragIntersectPoint.x + dropIntersectPoint.x) / 2,
(dragIntersectPoint.y + dropIntersectPoint.y) / 2);
}
}
return null;
} }
|
public class class_name {
private Point getDropPoint(QuickWidget element, DropPosition pos) {
Point dropPoint = new Point(element.getCenterLocation().x, element.getCenterLocation().y);
if (pos == DropPosition.CENTER) {
return dropPoint; // depends on control dependency: [if], data = [none]
}
Point dragPoint = new Point(this.getCenterLocation().x, this.getCenterLocation().y);
// Find the side of the DesktopWindowRect of the widget that as the intersect
Point
dragIntersectPoint =
intersection(dragPoint.x, dragPoint.y, dropPoint.x, dropPoint.y, this.getRect());
if (dragIntersectPoint != null) {
Point
dropIntersectPoint =
intersection(dragPoint.x, dragPoint.y, dropPoint.x, dropPoint.y, element.getRect());
if (dropIntersectPoint != null) {
if (pos == DropPosition.EDGE) {
return dropIntersectPoint; // depends on control dependency: [if], data = [none]
}
// Get the mid point of the line
return new Point((dragIntersectPoint.x + dropIntersectPoint.x) / 2,
(dragIntersectPoint.y + dropIntersectPoint.y) / 2); // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private static Header[] removeHeaders(Header[] headersToClean, String[] headersToRemove) {
ArrayList<Header> headers = new ArrayList<>();
if (headersToClean == null) {
return null;
}
for (Header header : headersToClean) {
if (!StringUtils.equalsAnyIgnoreCase(header.getName(), headersToRemove)) {
headers.add(header);
}
}
LOG.debug("Removed the content-length and content-type headers as the HTTP Client lib will care "
+ "about them as soon as the entity is set on the POST object.");
Header[] headersArray = new Header[headers.size()];
headersArray = headers.toArray(headersArray);
return headersArray;
} }
|
public class class_name {
private static Header[] removeHeaders(Header[] headersToClean, String[] headersToRemove) {
ArrayList<Header> headers = new ArrayList<>();
if (headersToClean == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (Header header : headersToClean) {
if (!StringUtils.equalsAnyIgnoreCase(header.getName(), headersToRemove)) {
headers.add(header); // depends on control dependency: [if], data = [none]
}
}
LOG.debug("Removed the content-length and content-type headers as the HTTP Client lib will care "
+ "about them as soon as the entity is set on the POST object.");
Header[] headersArray = new Header[headers.size()];
headersArray = headers.toArray(headersArray);
return headersArray;
} }
|
public class class_name {
public static String parseWithMetricAndFilters(final String metric,
final List<TagVFilter> filters) {
if (metric == null || metric.isEmpty()) {
throw new IllegalArgumentException("Metric cannot be null or empty");
}
if (filters == null) {
throw new IllegalArgumentException("Filters cannot be null");
}
final int curly = metric.indexOf('{');
if (curly < 0) {
return metric;
}
final int len = metric.length();
if (metric.charAt(len - 1) != '}') { // "foo{"
throw new IllegalArgumentException("Missing '}' at the end of: " + metric);
} else if (curly == len - 2) { // "foo{}"
return metric.substring(0, len - 2);
}
final int close = metric.indexOf('}');
final HashMap<String, String> filter_map = new HashMap<String, String>();
if (close != metric.length() - 1) { // "foo{...}{tagk=filter}"
final int filter_bracket = metric.lastIndexOf('{');
for (final String filter : splitString(metric.substring(filter_bracket + 1,
metric.length() - 1), ',')) {
if (filter.isEmpty()) {
break;
}
filter_map.clear();
try {
parse(filter_map, filter);
TagVFilter.mapToFilters(filter_map, filters, false);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing filter '" + filter
+ "': " + e.getMessage(), e);
}
}
}
// substring the tags out of "foo{a=b,...,x=y}" and parse them.
for (final String tag : splitString(metric.substring(curly + 1, close), ',')) {
try {
if (tag.isEmpty() && close != metric.length() - 1){
break;
}
filter_map.clear();
parse(filter_map, tag);
TagVFilter.tagsToFilters(filter_map, filters);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing tag '" + tag
+ "': " + e.getMessage(), e);
}
}
// Return the "foo" part of "foo{a=b,...,x=y}"
return metric.substring(0, curly);
} }
|
public class class_name {
public static String parseWithMetricAndFilters(final String metric,
final List<TagVFilter> filters) {
if (metric == null || metric.isEmpty()) {
throw new IllegalArgumentException("Metric cannot be null or empty");
}
if (filters == null) {
throw new IllegalArgumentException("Filters cannot be null");
}
final int curly = metric.indexOf('{');
if (curly < 0) {
return metric; // depends on control dependency: [if], data = [none]
}
final int len = metric.length();
if (metric.charAt(len - 1) != '}') { // "foo{"
throw new IllegalArgumentException("Missing '}' at the end of: " + metric);
} else if (curly == len - 2) { // "foo{}"
return metric.substring(0, len - 2); // depends on control dependency: [if], data = [len - 2)]
}
final int close = metric.indexOf('}');
final HashMap<String, String> filter_map = new HashMap<String, String>();
if (close != metric.length() - 1) { // "foo{...}{tagk=filter}"
final int filter_bracket = metric.lastIndexOf('{');
for (final String filter : splitString(metric.substring(filter_bracket + 1,
metric.length() - 1), ',')) {
if (filter.isEmpty()) {
break;
}
filter_map.clear(); // depends on control dependency: [for], data = [filter]
try {
parse(filter_map, filter); // depends on control dependency: [try], data = [none]
TagVFilter.mapToFilters(filter_map, filters, false); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing filter '" + filter
+ "': " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
// substring the tags out of "foo{a=b,...,x=y}" and parse them.
for (final String tag : splitString(metric.substring(curly + 1, close), ',')) {
try {
if (tag.isEmpty() && close != metric.length() - 1){
break;
}
filter_map.clear(); // depends on control dependency: [try], data = [none]
parse(filter_map, tag); // depends on control dependency: [try], data = [none]
TagVFilter.tagsToFilters(filter_map, filters); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing tag '" + tag
+ "': " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
// Return the "foo" part of "foo{a=b,...,x=y}"
return metric.substring(0, curly);
} }
|
public class class_name {
public static RelatedItemInfo[][] relatedIds(RelatedItemInfo[] ids, int length) {
int len = length;
RelatedItemInfo[][] idSets = new RelatedItemInfo[len][len];
for(int j = 0;j<len;j++) {
idSets[0][j] = ids[j];
}
for(int i=1;i<len;i++) {
int k=0;
for(int j=i;j<len;j++) {
idSets[i][k++] = ids[j];
}
for(int j=0;j<i;j++) {
idSets[i][k++] = ids[j];
}
}
return idSets;
} }
|
public class class_name {
public static RelatedItemInfo[][] relatedIds(RelatedItemInfo[] ids, int length) {
int len = length;
RelatedItemInfo[][] idSets = new RelatedItemInfo[len][len];
for(int j = 0;j<len;j++) {
idSets[0][j] = ids[j]; // depends on control dependency: [for], data = [j]
}
for(int i=1;i<len;i++) {
int k=0;
for(int j=i;j<len;j++) {
idSets[i][k++] = ids[j]; // depends on control dependency: [for], data = [j]
}
for(int j=0;j<i;j++) {
idSets[i][k++] = ids[j]; // depends on control dependency: [for], data = [j]
}
}
return idSets;
} }
|
public class class_name {
public Object remove(int index) {
//Check that the index is less than size because the getInternal
//method is being called with index - 1 and its checks will therefore
//not be useful in this case.
if (index >= size()) {
throw new IndexOutOfBoundsException("Index out of bounds: "
+ index + " >= " + size());
}
//Get the node that is previous to the node being removed
Node previousToRemove;
if (index == 0) {
previousToRemove = first;
} else {
previousToRemove = getInternal(index - 1);
}
//previousToRemove.next will never be null because of the check above
//that index < size.
Node toRemove = previousToRemove.next;
previousToRemove.next = toRemove.next;
elementCount--;
//If they removed at the last valid index, then a the last element
//was removed, therfore update the last pointer
if (last == toRemove) {
last = previousToRemove;
}
return toRemove.data;
} }
|
public class class_name {
public Object remove(int index) {
//Check that the index is less than size because the getInternal
//method is being called with index - 1 and its checks will therefore
//not be useful in this case.
if (index >= size()) {
throw new IndexOutOfBoundsException("Index out of bounds: "
+ index + " >= " + size());
}
//Get the node that is previous to the node being removed
Node previousToRemove;
if (index == 0) {
previousToRemove = first; // depends on control dependency: [if], data = [none]
} else {
previousToRemove = getInternal(index - 1); // depends on control dependency: [if], data = [(index]
}
//previousToRemove.next will never be null because of the check above
//that index < size.
Node toRemove = previousToRemove.next;
previousToRemove.next = toRemove.next;
elementCount--;
//If they removed at the last valid index, then a the last element
//was removed, therfore update the last pointer
if (last == toRemove) {
last = previousToRemove; // depends on control dependency: [if], data = [none]
}
return toRemove.data;
} }
|
public class class_name {
public void refreshCache(String cacheName, List<String> excludedFormats) {
CacheService cache = allCaches.get(cacheName);
if (cache != null) {
if (excludedFormats != null && cache instanceof ExcludableCache && excludedFormats.contains(((ExcludableCache)cache).getFormat())) {
logger.debug(" - omitting cache " + cacheName);
}
else {
logger.info(" - refresh cache " + cacheName);
try {
cache.refreshCache();
} catch (Exception e) {
logger.severeException("failed to refresh cache", e);
}
}
}
} }
|
public class class_name {
public void refreshCache(String cacheName, List<String> excludedFormats) {
CacheService cache = allCaches.get(cacheName);
if (cache != null) {
if (excludedFormats != null && cache instanceof ExcludableCache && excludedFormats.contains(((ExcludableCache)cache).getFormat())) {
logger.debug(" - omitting cache " + cacheName); // depends on control dependency: [if], data = [none]
}
else {
logger.info(" - refresh cache " + cacheName); // depends on control dependency: [if], data = [none]
try {
cache.refreshCache(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.severeException("failed to refresh cache", e);
} // depends on control dependency: [catch], data = [none]
}
}
} }
|
public class class_name {
public static String[] extractBundleInfoFromPath(String path, List<String> bundlePrefixes) {
String[] result = new String[4];
String bundlePrefix = null;
String resultPath = null;
try {
int idxGzip = path.indexOf(BundleRenderer.GZIP_PATH_PREFIX);
if (idxGzip != -1) {
if (idxGzip != 0) {
bundlePrefix = PathNormalizer.asDirPath(path.substring(1, idxGzip));
}
resultPath = path.substring(idxGzip + BundleRenderer.GZIP_PATH_PREFIX.length());
} else {
for (String prefix : bundlePrefixes) {
if (path.startsWith(prefix)) {
bundlePrefix = PathNormalizer.asDirPath(prefix);
resultPath = path.substring(bundlePrefix.length());
break;
}
}
if (bundlePrefix == null) {
// Remove first slash
resultPath = path.substring(1);
}
}
// eval the existence of a suffix
int realPathStartIdx = resultPath.indexOf("/");
String prefix = "";
if (realPathStartIdx != -1) {
prefix = resultPath.substring(0, realPathStartIdx);
}
String hashcode = null;
String variantPrefix = null;
// The prefix also contains variant information after a '.'
int hashCodeVariantSeparatorIdx = prefix.indexOf('.');
if (hashCodeVariantSeparatorIdx != -1) {
hashcode = prefix.substring(0, hashCodeVariantSeparatorIdx);
variantPrefix = prefix.substring(hashCodeVariantSeparatorIdx + 1);
resultPath = resultPath.substring(realPathStartIdx);
} else {
hashcode = prefix.substring(0, realPathStartIdx);
resultPath = resultPath.substring(realPathStartIdx);
}
// Remove leading slash if it's a bundle containing a generator
// prefix
if (resultPath.startsWith("/") && resultPath.contains(":")) {
resultPath = resultPath.substring(1);
}
result[0] = bundlePrefix;
result[1] = resultPath;
result[2] = variantPrefix;
result[3] = hashcode;
} catch (Exception e) {
LOGGER.debug("Unable to extract bundle info for path : " + path);
result = null;
}
return result;
} }
|
public class class_name {
public static String[] extractBundleInfoFromPath(String path, List<String> bundlePrefixes) {
String[] result = new String[4];
String bundlePrefix = null;
String resultPath = null;
try {
int idxGzip = path.indexOf(BundleRenderer.GZIP_PATH_PREFIX);
if (idxGzip != -1) {
if (idxGzip != 0) {
bundlePrefix = PathNormalizer.asDirPath(path.substring(1, idxGzip)); // depends on control dependency: [if], data = [none]
}
resultPath = path.substring(idxGzip + BundleRenderer.GZIP_PATH_PREFIX.length()); // depends on control dependency: [if], data = [(idxGzip]
} else {
for (String prefix : bundlePrefixes) {
if (path.startsWith(prefix)) {
bundlePrefix = PathNormalizer.asDirPath(prefix); // depends on control dependency: [if], data = [none]
resultPath = path.substring(bundlePrefix.length()); // depends on control dependency: [if], data = [none]
break;
}
}
if (bundlePrefix == null) {
// Remove first slash
resultPath = path.substring(1); // depends on control dependency: [if], data = [none]
}
}
// eval the existence of a suffix
int realPathStartIdx = resultPath.indexOf("/");
String prefix = "";
if (realPathStartIdx != -1) {
prefix = resultPath.substring(0, realPathStartIdx); // depends on control dependency: [if], data = [none]
}
String hashcode = null;
String variantPrefix = null;
// The prefix also contains variant information after a '.'
int hashCodeVariantSeparatorIdx = prefix.indexOf('.');
if (hashCodeVariantSeparatorIdx != -1) {
hashcode = prefix.substring(0, hashCodeVariantSeparatorIdx); // depends on control dependency: [if], data = [none]
variantPrefix = prefix.substring(hashCodeVariantSeparatorIdx + 1); // depends on control dependency: [if], data = [(hashCodeVariantSeparatorIdx]
resultPath = resultPath.substring(realPathStartIdx); // depends on control dependency: [if], data = [none]
} else {
hashcode = prefix.substring(0, realPathStartIdx); // depends on control dependency: [if], data = [none]
resultPath = resultPath.substring(realPathStartIdx); // depends on control dependency: [if], data = [none]
}
// Remove leading slash if it's a bundle containing a generator
// prefix
if (resultPath.startsWith("/") && resultPath.contains(":")) {
resultPath = resultPath.substring(1); // depends on control dependency: [if], data = [none]
}
result[0] = bundlePrefix; // depends on control dependency: [try], data = [none]
result[1] = resultPath; // depends on control dependency: [try], data = [none]
result[2] = variantPrefix; // depends on control dependency: [try], data = [none]
result[3] = hashcode; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.debug("Unable to extract bundle info for path : " + path);
result = null;
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
private SecretKey generateAESKey(String privateKey, String salt) {
try {
byte[] raw = decodeHex(salt);
KeySpec spec = new PBEKeySpec(privateKey.toCharArray(), raw, iterationCount, keySize);
SecretKeyFactory factory = SecretKeyFactory.getInstance(PBKDF_2_WITH_HMAC_SHA_1);
return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), AES_ECB_ALGORITHM);
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
throw new IllegalStateException(e);
}
} }
|
public class class_name {
private SecretKey generateAESKey(String privateKey, String salt) {
try {
byte[] raw = decodeHex(salt);
KeySpec spec = new PBEKeySpec(privateKey.toCharArray(), raw, iterationCount, keySize);
SecretKeyFactory factory = SecretKeyFactory.getInstance(PBKDF_2_WITH_HMAC_SHA_1);
return new SecretKeySpec(factory.generateSecret(spec).getEncoded(), AES_ECB_ALGORITHM); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public boolean isSatisfiedBy(Proposition proposition) {
if (proposition == null) {
throw new IllegalArgumentException("proposition cannot be null");
}
if (this.valueComp != null && this.propertyName != null) {
Value value = proposition.getProperty(this.propertyName);
if (!valueComp.compare(value, this.value)) {
return false;
}
}
return true;
} }
|
public class class_name {
public boolean isSatisfiedBy(Proposition proposition) {
if (proposition == null) {
throw new IllegalArgumentException("proposition cannot be null");
}
if (this.valueComp != null && this.propertyName != null) {
Value value = proposition.getProperty(this.propertyName);
if (!valueComp.compare(value, this.value)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
public BaseField setupField(int iFieldSeq)
{
BaseField field = null;
if (iFieldSeq == 0)
{
field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null);
field.setHidden(true);
}
//if (iFieldSeq == 1)
//{
// field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
// field.setHidden(true);
//}
//if (iFieldSeq == 2)
//{
// field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false));
// field.setHidden(true);
//}
if (iFieldSeq == 3)
{
field = new StringField(this, FIELD_NAME, 40, null, null);
field.setNullable(false);
}
if (iFieldSeq == 4)
field = new FieldClassField(this, FIELD_CLASS, 40, null, null);
if (iFieldSeq == 5)
field = new StringField(this, BASE_FIELD_NAME, 40, null, null);
if (iFieldSeq == 6)
field = new StringField(this, DEPENDENT_FIELD_NAME, 40, null, null);
if (iFieldSeq == 7)
field = new ShortField(this, MINIMUM_LENGTH, 4, null, null);
if (iFieldSeq == 8)
field = new ShortField(this, MAXIMUM_LENGTH, 5, null, null);
if (iFieldSeq == 9)
field = new StringField(this, DEFAULT_VALUE, 50, null, null);
if (iFieldSeq == 10)
field = new StringField(this, INITIAL_VALUE, 50, null, null);
if (iFieldSeq == 11)
field = new StringField(this, FIELD_DESCRIPTION, 100, null, null);
if (iFieldSeq == 12)
field = new StringField(this, FIELD_DESC_VERTICAL, 14, null, null);
if (iFieldSeq == 13)
field = new FieldTypeField(this, FIELD_TYPE, 1, null, null);
if (iFieldSeq == 14)
field = new ShortField(this, FIELD_DIMENSION, 3, null, null);
if (iFieldSeq == 15)
field = new StringField(this, FIELD_FILE_NAME, 40, null, null);
if (iFieldSeq == 16)
field = new ShortField(this, FIELD_SEQ_NO, 4, null, null);
if (iFieldSeq == 17)
field = new BooleanField(this, FIELD_NOT_NULL, 1, null, null);
if (iFieldSeq == 18)
{
field = new StringField(this, DATA_CLASS, 20, null, null);
field.setVirtual(true);
}
if (iFieldSeq == 19)
field = new BooleanField(this, HIDDEN, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 20)
{
field = new IncludeScopeField(this, INCLUDE_SCOPE, Constants.DEFAULT_FIELD_LENGTH, null, new Integer(0x004));
field.addListener(new InitOnceFieldHandler(null));
}
if (field == null)
field = super.setupField(iFieldSeq);
return field;
} }
|
public class class_name {
public BaseField setupField(int iFieldSeq)
{
BaseField field = null;
if (iFieldSeq == 0)
{
field = new CounterField(this, ID, Constants.DEFAULT_FIELD_LENGTH, null, null); // depends on control dependency: [if], data = [none]
field.setHidden(true); // depends on control dependency: [if], data = [none]
}
//if (iFieldSeq == 1)
//{
// field = new RecordChangedField(this, LAST_CHANGED, Constants.DEFAULT_FIELD_LENGTH, null, null);
// field.setHidden(true);
//}
//if (iFieldSeq == 2)
//{
// field = new BooleanField(this, DELETED, Constants.DEFAULT_FIELD_LENGTH, null, new Boolean(false));
// field.setHidden(true);
//}
if (iFieldSeq == 3)
{
field = new StringField(this, FIELD_NAME, 40, null, null); // depends on control dependency: [if], data = [none]
field.setNullable(false); // depends on control dependency: [if], data = [none]
}
if (iFieldSeq == 4)
field = new FieldClassField(this, FIELD_CLASS, 40, null, null);
if (iFieldSeq == 5)
field = new StringField(this, BASE_FIELD_NAME, 40, null, null);
if (iFieldSeq == 6)
field = new StringField(this, DEPENDENT_FIELD_NAME, 40, null, null);
if (iFieldSeq == 7)
field = new ShortField(this, MINIMUM_LENGTH, 4, null, null);
if (iFieldSeq == 8)
field = new ShortField(this, MAXIMUM_LENGTH, 5, null, null);
if (iFieldSeq == 9)
field = new StringField(this, DEFAULT_VALUE, 50, null, null);
if (iFieldSeq == 10)
field = new StringField(this, INITIAL_VALUE, 50, null, null);
if (iFieldSeq == 11)
field = new StringField(this, FIELD_DESCRIPTION, 100, null, null);
if (iFieldSeq == 12)
field = new StringField(this, FIELD_DESC_VERTICAL, 14, null, null);
if (iFieldSeq == 13)
field = new FieldTypeField(this, FIELD_TYPE, 1, null, null);
if (iFieldSeq == 14)
field = new ShortField(this, FIELD_DIMENSION, 3, null, null);
if (iFieldSeq == 15)
field = new StringField(this, FIELD_FILE_NAME, 40, null, null);
if (iFieldSeq == 16)
field = new ShortField(this, FIELD_SEQ_NO, 4, null, null);
if (iFieldSeq == 17)
field = new BooleanField(this, FIELD_NOT_NULL, 1, null, null);
if (iFieldSeq == 18)
{
field = new StringField(this, DATA_CLASS, 20, null, null); // depends on control dependency: [if], data = [none]
field.setVirtual(true); // depends on control dependency: [if], data = [none]
}
if (iFieldSeq == 19)
field = new BooleanField(this, HIDDEN, Constants.DEFAULT_FIELD_LENGTH, null, null);
if (iFieldSeq == 20)
{
field = new IncludeScopeField(this, INCLUDE_SCOPE, Constants.DEFAULT_FIELD_LENGTH, null, new Integer(0x004)); // depends on control dependency: [if], data = [none]
field.addListener(new InitOnceFieldHandler(null)); // depends on control dependency: [if], data = [none]
}
if (field == null)
field = super.setupField(iFieldSeq);
return field;
} }
|
public class class_name {
@Override
public String getServerID() {
if (serverID == null) {
String serverName = null;
String serverHostName = null;
String serverUserDir = null;
serverName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(ENV_VAR_CONTAINERNAME);
}
});
if (ENV_VAR_CONTAINERNAME.equals(serverName)) {
serverName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_WLPSERVERNAME);
}
});
}
// None of the variables resolved, set the server name back to an empty string.
if (VAR_WLPSERVERNAME.equals(serverName)) {
serverName = "";
}
serverUserDir = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_WLPUSERDIR);
}
});
if (VAR_WLPUSERDIR.equals(serverUserDir)) {
serverUserDir = "";
}
serverHostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(ENV_VAR_CONTAINERHOST);
}
});
if (ENV_VAR_CONTAINERHOST.equals(serverHostName)) {
// env var CONTAINER_HOST did not resolve
serverHostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_DEFAULTHOSTNAME);
}
});
// defaultHostName variable did not resolve or has resolved to "localhost"
if (VAR_DEFAULTHOSTNAME.equals(serverHostName) || serverHostName.equals("localhost")) {
try {
serverHostName = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
@Override
public String run() throws UnknownHostException {
return InetAddress.getLocalHost().getCanonicalHostName();
}
});
} catch (PrivilegedActionException pae) {
serverHostName = "";
}
}
}
serverID = AUDIT_SERVER_ID_PREFIX + serverHostName +
AUDIT_SERVER_ID_SEPARATOR + serverUserDir +
AUDIT_SERVER_ID_SEPARATOR + serverName;
}
return serverID;
} }
|
public class class_name {
@Override
public String getServerID() {
if (serverID == null) {
String serverName = null;
String serverHostName = null;
String serverUserDir = null;
serverName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(ENV_VAR_CONTAINERNAME);
}
}); // depends on control dependency: [if], data = [none]
if (ENV_VAR_CONTAINERNAME.equals(serverName)) {
serverName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_WLPSERVERNAME);
}
}); // depends on control dependency: [if], data = [none]
}
// None of the variables resolved, set the server name back to an empty string.
if (VAR_WLPSERVERNAME.equals(serverName)) {
serverName = ""; // depends on control dependency: [if], data = [none]
}
serverUserDir = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_WLPUSERDIR);
}
}); // depends on control dependency: [if], data = [none]
if (VAR_WLPUSERDIR.equals(serverUserDir)) {
serverUserDir = ""; // depends on control dependency: [if], data = [none]
}
serverHostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(ENV_VAR_CONTAINERHOST);
}
}); // depends on control dependency: [if], data = [none]
if (ENV_VAR_CONTAINERHOST.equals(serverHostName)) {
// env var CONTAINER_HOST did not resolve
serverHostName = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return variableRegistryServiceRef.getService().resolveString(VAR_DEFAULTHOSTNAME);
}
}); // depends on control dependency: [if], data = [none]
// defaultHostName variable did not resolve or has resolved to "localhost"
if (VAR_DEFAULTHOSTNAME.equals(serverHostName) || serverHostName.equals("localhost")) {
try {
serverHostName = AccessController.doPrivileged(new PrivilegedExceptionAction<String>() {
@Override
public String run() throws UnknownHostException {
return InetAddress.getLocalHost().getCanonicalHostName();
}
}); // depends on control dependency: [try], data = [none]
} catch (PrivilegedActionException pae) {
serverHostName = "";
} // depends on control dependency: [catch], data = [none]
}
}
serverID = AUDIT_SERVER_ID_PREFIX + serverHostName +
AUDIT_SERVER_ID_SEPARATOR + serverUserDir +
AUDIT_SERVER_ID_SEPARATOR + serverName; // depends on control dependency: [if], data = [none]
}
return serverID;
} }
|
public class class_name {
public static Region getInstance(int code) {
loadRegionData();
Region r = numericCodeMap.get(code);
if ( r == null ) { // Just in case there's an alias that's numeric, try to find it.
String pad = "";
if ( code < 10 ) {
pad = "00";
} else if ( code < 100 ) {
pad = "0";
}
String id = pad + Integer.toString(code);
r = regionAliases.get(id);
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region code: " + code);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} }
|
public class class_name {
public static Region getInstance(int code) {
loadRegionData();
Region r = numericCodeMap.get(code);
if ( r == null ) { // Just in case there's an alias that's numeric, try to find it.
String pad = "";
if ( code < 10 ) {
pad = "00"; // depends on control dependency: [if], data = [none]
} else if ( code < 100 ) {
pad = "0"; // depends on control dependency: [if], data = [none]
}
String id = pad + Integer.toString(code);
r = regionAliases.get(id); // depends on control dependency: [if], data = [none]
}
if ( r == null ) {
throw new IllegalArgumentException("Unknown region code: " + code);
}
if ( r.type == RegionType.DEPRECATED && r.preferredValues.size() == 1) {
r = r.preferredValues.get(0);
}
return r;
} }
|
public class class_name {
public StackTraceElement[] getCallerData() {
if (callerDataArray == null) {
callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass,
loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages());
}
return callerDataArray;
} }
|
public class class_name {
public StackTraceElement[] getCallerData() {
if (callerDataArray == null) {
callerDataArray = CallerData.extract(new Throwable(), fqnOfLoggerClass,
loggerContext.getMaxCallerDataDepth(), loggerContext.getFrameworkPackages()); // depends on control dependency: [if], data = [none]
}
return callerDataArray;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.