code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public ManagementStage getStage(final int index) {
if (index >= 0 && index < this.stages.size()) {
return this.stages.get(index);
}
return null;
} } | public class class_name {
public ManagementStage getStage(final int index) {
if (index >= 0 && index < this.stages.size()) {
return this.stages.get(index); // depends on control dependency: [if], data = [(index]
}
return null;
} } |
public class class_name {
public static Ix<Integer> range(int start, int count) {
if (count == 0) {
return empty();
}
if (count == 1) {
return just(start);
}
if (count < 0) {
throw new IllegalArgumentException("count >= 0 required but it was " + count);
}
return new IxRange(start, count);
} } | public class class_name {
public static Ix<Integer> range(int start, int count) {
if (count == 0) {
return empty(); // depends on control dependency: [if], data = [none]
}
if (count == 1) {
return just(start); // depends on control dependency: [if], data = [none]
}
if (count < 0) {
throw new IllegalArgumentException("count >= 0 required but it was " + count);
}
return new IxRange(start, count);
} } |
public class class_name {
public void dump(OutputStream out){
hydrate();
PrintWriter p = new PrintWriter(out);
for(Model m : delegate){
p.write(m.toString());
p.write('\n');
}
p.flush();
} } | public class class_name {
public void dump(OutputStream out){
hydrate();
PrintWriter p = new PrintWriter(out);
for(Model m : delegate){
p.write(m.toString()); // depends on control dependency: [for], data = [m]
p.write('\n'); // depends on control dependency: [for], data = [none]
}
p.flush();
} } |
public class class_name {
public BinaryString toUpperCase() {
if (javaObject != null) {
return toUpperCaseSlow();
}
if (sizeInBytes == 0) {
return EMPTY_UTF8;
}
int size = segments[0].size();
SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size);
byte[] bytes = new byte[sizeInBytes];
bytes[0] = (byte) Character.toTitleCase(segmentAndOffset.value());
for (int i = 0; i < sizeInBytes; i++) {
byte b = segmentAndOffset.value();
if (numBytesForFirstByte(b) != 1) {
// fallback
return toUpperCaseSlow();
}
int upper = Character.toUpperCase((int) b);
if (upper > 127) {
// fallback
return toUpperCaseSlow();
}
bytes[i] = (byte) upper;
segmentAndOffset.nextByte(size);
}
return fromBytes(bytes);
} } | public class class_name {
public BinaryString toUpperCase() {
if (javaObject != null) {
return toUpperCaseSlow(); // depends on control dependency: [if], data = [none]
}
if (sizeInBytes == 0) {
return EMPTY_UTF8; // depends on control dependency: [if], data = [none]
}
int size = segments[0].size();
SegmentAndOffset segmentAndOffset = startSegmentAndOffset(size);
byte[] bytes = new byte[sizeInBytes];
bytes[0] = (byte) Character.toTitleCase(segmentAndOffset.value());
for (int i = 0; i < sizeInBytes; i++) {
byte b = segmentAndOffset.value();
if (numBytesForFirstByte(b) != 1) {
// fallback
return toUpperCaseSlow(); // depends on control dependency: [if], data = [none]
}
int upper = Character.toUpperCase((int) b);
if (upper > 127) {
// fallback
return toUpperCaseSlow(); // depends on control dependency: [if], data = [none]
}
bytes[i] = (byte) upper; // depends on control dependency: [for], data = [i]
segmentAndOffset.nextByte(size); // depends on control dependency: [for], data = [none]
}
return fromBytes(bytes);
} } |
public class class_name {
protected void paint(SeaGlassContext context, Graphics g) {
Rectangle clip = g.getClipBounds();
Rectangle bounds = table.getBounds();
// Account for the fact that the graphics has already been translated
// into the table's bounds.
bounds.x = bounds.y = 0;
// This check prevents us from painting the entire table when the clip
// doesn't intersect our bounds at all.
if (table.getRowCount() <= 0 || table.getColumnCount() <= 0 || !bounds.intersects(clip)) {
paintDropLines(context, g);
return;
}
boolean ltr = table.getComponentOrientation().isLeftToRight();
Point upperLeft = clip.getLocation();
if (!ltr) {
upperLeft.x++;
}
Point lowerRight = new Point(clip.x + clip.width - (ltr ? 1 : 0), clip.y + clip.height);
int rMin = table.rowAtPoint(upperLeft);
int rMax = table.rowAtPoint(lowerRight);
// This should never happen (as long as our bounds intersect the clip,
// which is why we bail above if that is the case).
if (rMin == -1) {
rMin = 0;
}
// If the table does not have enough rows to fill the view we'll get -1.
// (We could also get -1 if our bounds don't intersect the clip,
// which is why we bail above if that is the case).
// Replace this with the index of the last row.
if (rMax == -1) {
rMax = table.getRowCount() - 1;
}
int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
// This should never happen.
if (cMin == -1) {
cMin = 0;
}
// If the table does not have enough columns to fill the view we'll get
// -1.
// Replace this with the index of the last column.
if (cMax == -1) {
cMax = table.getColumnCount() - 1;
}
// Paint the grid.
if (!(table.getParent() instanceof JViewport)
|| (table.getParent() != null && !(table.getParent().getParent() instanceof JScrollPane))) {
// FIXME We need to not repaint the entire table any time something
// changes.
// paintGrid(context, g, rMin, rMax, cMin, cMax);
paintStripesAndGrid(context, g, table, table.getWidth(), table.getHeight(), 0);
}
// Paint the cells.
paintCells(context, g, rMin, rMax, cMin, cMax);
paintDropLines(context, g);
} } | public class class_name {
protected void paint(SeaGlassContext context, Graphics g) {
Rectangle clip = g.getClipBounds();
Rectangle bounds = table.getBounds();
// Account for the fact that the graphics has already been translated
// into the table's bounds.
bounds.x = bounds.y = 0;
// This check prevents us from painting the entire table when the clip
// doesn't intersect our bounds at all.
if (table.getRowCount() <= 0 || table.getColumnCount() <= 0 || !bounds.intersects(clip)) {
paintDropLines(context, g); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
boolean ltr = table.getComponentOrientation().isLeftToRight();
Point upperLeft = clip.getLocation();
if (!ltr) {
upperLeft.x++; // depends on control dependency: [if], data = [none]
}
Point lowerRight = new Point(clip.x + clip.width - (ltr ? 1 : 0), clip.y + clip.height);
int rMin = table.rowAtPoint(upperLeft);
int rMax = table.rowAtPoint(lowerRight);
// This should never happen (as long as our bounds intersect the clip,
// which is why we bail above if that is the case).
if (rMin == -1) {
rMin = 0; // depends on control dependency: [if], data = [none]
}
// If the table does not have enough rows to fill the view we'll get -1.
// (We could also get -1 if our bounds don't intersect the clip,
// which is why we bail above if that is the case).
// Replace this with the index of the last row.
if (rMax == -1) {
rMax = table.getRowCount() - 1; // depends on control dependency: [if], data = [none]
}
int cMin = table.columnAtPoint(ltr ? upperLeft : lowerRight);
int cMax = table.columnAtPoint(ltr ? lowerRight : upperLeft);
// This should never happen.
if (cMin == -1) {
cMin = 0; // depends on control dependency: [if], data = [none]
}
// If the table does not have enough columns to fill the view we'll get
// -1.
// Replace this with the index of the last column.
if (cMax == -1) {
cMax = table.getColumnCount() - 1; // depends on control dependency: [if], data = [none]
}
// Paint the grid.
if (!(table.getParent() instanceof JViewport)
|| (table.getParent() != null && !(table.getParent().getParent() instanceof JScrollPane))) {
// FIXME We need to not repaint the entire table any time something
// changes.
// paintGrid(context, g, rMin, rMax, cMin, cMax);
paintStripesAndGrid(context, g, table, table.getWidth(), table.getHeight(), 0); // depends on control dependency: [if], data = [none]
}
// Paint the cells.
paintCells(context, g, rMin, rMax, cMin, cMax);
paintDropLines(context, g);
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void collectDrilldownOptions(final Options options) {
List<? extends IProcessableOption> drilldownPoints = options.getMarkedForProcessing(DrilldownPoint.PROCESSING_KEY);
for (DrilldownPoint drilldownPoint : (List<DrilldownPoint>) drilldownPoints) {
Options drilldownOptions = drilldownPoint.getDrilldownOptions();
if (!getDrilldownOptions().contains(drilldownOptions)) {
getDrilldownOptions().add(drilldownOptions);
collectDrilldownOptions(drilldownOptions);
}
drilldownPoint.setDrilldownOptionsIndex(getDrilldownOptions().indexOf(drilldownOptions));
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void collectDrilldownOptions(final Options options) {
List<? extends IProcessableOption> drilldownPoints = options.getMarkedForProcessing(DrilldownPoint.PROCESSING_KEY);
for (DrilldownPoint drilldownPoint : (List<DrilldownPoint>) drilldownPoints) {
Options drilldownOptions = drilldownPoint.getDrilldownOptions();
if (!getDrilldownOptions().contains(drilldownOptions)) {
getDrilldownOptions().add(drilldownOptions); // depends on control dependency: [if], data = [none]
collectDrilldownOptions(drilldownOptions); // depends on control dependency: [if], data = [none]
}
drilldownPoint.setDrilldownOptionsIndex(getDrilldownOptions().indexOf(drilldownOptions)); // depends on control dependency: [for], data = [drilldownPoint]
}
} } |
public class class_name {
public void onConfigurationChanged() {
final Collection<PropertyWidget<?>> widgets = getWidgets();
if (logger.isDebugEnabled()) {
final StringBuilder sb = new StringBuilder();
sb.append("id=");
sb.append(System.identityHashCode(this));
sb.append(" - onConfigurationChanged() - notifying widgets:");
sb.append(widgets.size());
for (final PropertyWidget<?> widget : widgets) {
final String propertyName = widget.getPropertyDescriptor().getName();
final String propertyWidgetClassName = widget.getClass().getSimpleName();
sb.append("\n - ");
sb.append(propertyName);
sb.append(": ");
sb.append(propertyWidgetClassName);
}
logger.debug(sb.toString());
}
for (final PropertyWidget<?> widget : widgets) {
@SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget;
final ConfiguredPropertyDescriptor propertyDescriptor = objectWidget.getPropertyDescriptor();
final Object value = _componentBuilder.getConfiguredProperty(propertyDescriptor);
objectWidget.onValueTouched(value);
}
} } | public class class_name {
public void onConfigurationChanged() {
final Collection<PropertyWidget<?>> widgets = getWidgets();
if (logger.isDebugEnabled()) {
final StringBuilder sb = new StringBuilder();
sb.append("id="); // depends on control dependency: [if], data = [none]
sb.append(System.identityHashCode(this)); // depends on control dependency: [if], data = [none]
sb.append(" - onConfigurationChanged() - notifying widgets:"); // depends on control dependency: [if], data = [none]
sb.append(widgets.size()); // depends on control dependency: [if], data = [none]
for (final PropertyWidget<?> widget : widgets) {
final String propertyName = widget.getPropertyDescriptor().getName();
final String propertyWidgetClassName = widget.getClass().getSimpleName();
sb.append("\n - "); // depends on control dependency: [for], data = [none]
sb.append(propertyName); // depends on control dependency: [for], data = [none]
sb.append(": "); // depends on control dependency: [for], data = [none]
sb.append(propertyWidgetClassName); // depends on control dependency: [for], data = [none]
}
logger.debug(sb.toString()); // depends on control dependency: [if], data = [none]
}
for (final PropertyWidget<?> widget : widgets) {
@SuppressWarnings("unchecked") final PropertyWidget<Object> objectWidget = (PropertyWidget<Object>) widget;
final ConfiguredPropertyDescriptor propertyDescriptor = objectWidget.getPropertyDescriptor();
final Object value = _componentBuilder.getConfiguredProperty(propertyDescriptor);
objectWidget.onValueTouched(value); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override public float progress(){
if(UKV.get(dest()) == null)return 0;
DeepLearningModel m = UKV.get(dest());
if (m != null && m.model_info()!=null ) {
final float p = (float) Math.min(1, (m.epoch_counter / m.model_info().get_params().epochs));
return cv_progress(p);
}
return 0;
} } | public class class_name {
@Override public float progress(){
if(UKV.get(dest()) == null)return 0;
DeepLearningModel m = UKV.get(dest());
if (m != null && m.model_info()!=null ) {
final float p = (float) Math.min(1, (m.epoch_counter / m.model_info().get_params().epochs));
return cv_progress(p); // depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<B> mutateAll(Collection<M> messages) {
if (messages == null) {
return null;
}
return (List<B>) messages.stream()
.map(PMessage::mutate)
.collect(Collectors.toList());
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <M extends PMessage<M,F>, F extends PField, B extends PMessageBuilder<M,F>>
List<B> mutateAll(Collection<M> messages) {
if (messages == null) {
return null; // depends on control dependency: [if], data = [none]
}
return (List<B>) messages.stream()
.map(PMessage::mutate)
.collect(Collectors.toList());
} } |
public class class_name {
private void configureButtonBarDialogBuilder(
@NonNull final AbstractButtonBarDialogBuilder builder) {
if (shouldNegativeButtonBeShown()) {
builder.setNegativeButton(getNegativeButtonText(), createNegativeButtonListener());
}
if (shouldNeutralButtonBeShown()) {
builder.setNeutralButton(getNeutralButtonText(), createNeutralButtonListener());
}
if (shouldPositiveButtonBeShown()) {
builder.setPositiveButton(getPositiveButtonText(), createPositiveButtonListener());
}
builder.stackButtons(shouldStackButtons());
builder.showButtonBarDivider(shouldButtonBarDividerBeShown());
} } | public class class_name {
private void configureButtonBarDialogBuilder(
@NonNull final AbstractButtonBarDialogBuilder builder) {
if (shouldNegativeButtonBeShown()) {
builder.setNegativeButton(getNegativeButtonText(), createNegativeButtonListener()); // depends on control dependency: [if], data = [none]
}
if (shouldNeutralButtonBeShown()) {
builder.setNeutralButton(getNeutralButtonText(), createNeutralButtonListener()); // depends on control dependency: [if], data = [none]
}
if (shouldPositiveButtonBeShown()) {
builder.setPositiveButton(getPositiveButtonText(), createPositiveButtonListener()); // depends on control dependency: [if], data = [none]
}
builder.stackButtons(shouldStackButtons());
builder.showButtonBarDivider(shouldButtonBarDividerBeShown());
} } |
public class class_name {
public <T> T contextRem(Class<T> key)
{
synchronized (TypeCheckInfo.class)
{
Stack<T> contextStack = lookupListForType(key);
if (contextStack != null)
{
return contextStack.pop();
}
}
return null;
} } | public class class_name {
public <T> T contextRem(Class<T> key)
{
synchronized (TypeCheckInfo.class)
{
Stack<T> contextStack = lookupListForType(key);
if (contextStack != null)
{
return contextStack.pop(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public Element toElement(final CsvDatastore datastore, final String filename) {
final Element datastoreElement = getDocument().createElement("csv-datastore");
datastoreElement.setAttribute("name", datastore.getName());
final String description = datastore.getDescription();
if (!Strings.isNullOrEmpty(description)) {
datastoreElement.setAttribute("description", description);
}
appendElement(datastoreElement, "filename", filename);
appendElement(datastoreElement, "quote-char", datastore.getQuoteChar());
appendElement(datastoreElement, "separator-char", datastore.getSeparatorChar());
appendElement(datastoreElement, "escape-char", datastore.getEscapeChar());
appendElement(datastoreElement, "encoding", datastore.getEncoding());
appendElement(datastoreElement, "fail-on-inconsistencies", datastore.isFailOnInconsistencies());
appendElement(datastoreElement, "multiline-values", datastore.isMultilineValues());
appendElement(datastoreElement, "header-line-number", datastore.getHeaderLineNumber());
if (datastore.getCustomColumnNames() != null && datastore.getCustomColumnNames().size() > 0) {
final Element customColumnNamesElement = getDocument().createElement("custom-column-names");
datastoreElement.appendChild(customColumnNamesElement);
datastore.getCustomColumnNames()
.forEach(columnName -> appendElement(customColumnNamesElement, "column-name", columnName));
}
return datastoreElement;
} } | public class class_name {
public Element toElement(final CsvDatastore datastore, final String filename) {
final Element datastoreElement = getDocument().createElement("csv-datastore");
datastoreElement.setAttribute("name", datastore.getName());
final String description = datastore.getDescription();
if (!Strings.isNullOrEmpty(description)) {
datastoreElement.setAttribute("description", description); // depends on control dependency: [if], data = [none]
}
appendElement(datastoreElement, "filename", filename);
appendElement(datastoreElement, "quote-char", datastore.getQuoteChar());
appendElement(datastoreElement, "separator-char", datastore.getSeparatorChar());
appendElement(datastoreElement, "escape-char", datastore.getEscapeChar());
appendElement(datastoreElement, "encoding", datastore.getEncoding());
appendElement(datastoreElement, "fail-on-inconsistencies", datastore.isFailOnInconsistencies());
appendElement(datastoreElement, "multiline-values", datastore.isMultilineValues());
appendElement(datastoreElement, "header-line-number", datastore.getHeaderLineNumber());
if (datastore.getCustomColumnNames() != null && datastore.getCustomColumnNames().size() > 0) {
final Element customColumnNamesElement = getDocument().createElement("custom-column-names");
datastoreElement.appendChild(customColumnNamesElement); // depends on control dependency: [if], data = [none]
datastore.getCustomColumnNames()
.forEach(columnName -> appendElement(customColumnNamesElement, "column-name", columnName)); // depends on control dependency: [if], data = [none]
}
return datastoreElement;
} } |
public class class_name {
public CmsJspResourceWrapper getFolder() {
CmsJspResourceWrapper result;
if (isFolder()) {
result = this;
} else {
result = readResource(getSitePathFolder());
}
return result;
} } | public class class_name {
public CmsJspResourceWrapper getFolder() {
CmsJspResourceWrapper result;
if (isFolder()) {
result = this; // depends on control dependency: [if], data = [none]
} else {
result = readResource(getSitePathFolder()); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public String[] getParameterValues(String name)
{
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse();
}
parseParameters();
// 321485
String[] values = (String[]) SRTServletRequestThreadData.getInstance().getParameters().get(name);
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " name --> " + name);
}
//PI20210
if (WCCustomProperties.PRESERVE_REQUEST_PARAMETER_VALUES){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " returning a clone of parameter values");
}
return (values == null ? null : values.clone());
}
else{ //PI20210
return values;
}
} } | public class class_name {
public String[] getParameterValues(String name)
{
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse(); // depends on control dependency: [if], data = [none]
}
parseParameters();
// 321485
String[] values = (String[]) SRTServletRequestThreadData.getInstance().getParameters().get(name);
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " name --> " + name); // depends on control dependency: [if], data = [none]
}
//PI20210
if (WCCustomProperties.PRESERVE_REQUEST_PARAMETER_VALUES){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"getParameterValues", " returning a clone of parameter values"); // depends on control dependency: [if], data = [none]
}
return (values == null ? null : values.clone()); // depends on control dependency: [if], data = [none]
}
else{ //PI20210
return values; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final static void replaceMonomer(HELM2Notation helm2notation, String polymerType, String existingMonomerID,
String newMonomerID) throws NotationException, MonomerException,
ChemistryException, CTKException, IOException, JDOMException {
validateMonomerReplacement(polymerType, existingMonomerID, newMonomerID);
/*
* if(newMonomerID.length()> 1){ if( !( newMonomerID.startsWith("[") &&
* newMonomerID.endsWith("]"))){ newMonomerID = "[" + newMonomerID +
* "]"; } }
*/
for (int i = 0; i < helm2notation.getListOfPolymers().size(); i++) {
if (helm2notation.getListOfPolymers().get(i).getPolymerID().getType().equals(polymerType)) {
for (int j = 0; j < helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements()
.size(); j++) {
MonomerNotation monomerNotation = replaceMonomerNotation(
helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements().get(j),
existingMonomerID, newMonomerID);
if (monomerNotation != null) {
helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements().set(j,
monomerNotation);
}
}
}
}
} } | public class class_name {
public final static void replaceMonomer(HELM2Notation helm2notation, String polymerType, String existingMonomerID,
String newMonomerID) throws NotationException, MonomerException,
ChemistryException, CTKException, IOException, JDOMException {
validateMonomerReplacement(polymerType, existingMonomerID, newMonomerID);
/*
* if(newMonomerID.length()> 1){ if( !( newMonomerID.startsWith("[") &&
* newMonomerID.endsWith("]"))){ newMonomerID = "[" + newMonomerID +
* "]"; } }
*/
for (int i = 0; i < helm2notation.getListOfPolymers().size(); i++) {
if (helm2notation.getListOfPolymers().get(i).getPolymerID().getType().equals(polymerType)) {
for (int j = 0; j < helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements()
.size(); j++) {
MonomerNotation monomerNotation = replaceMonomerNotation(
helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements().get(j),
existingMonomerID, newMonomerID);
if (monomerNotation != null) {
helm2notation.getListOfPolymers().get(i).getPolymerElements().getListOfElements().set(j,
monomerNotation);
// depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public void validateCriteriaAndAddStrategy(final IBaseResource theResource) {
String criteria = mySubscriptionCanonicalizer.getCriteria(theResource);
try {
SubscriptionMatchingStrategy strategy = mySubscriptionStrategyEvaluator.determineStrategy(criteria);
mySubscriptionCanonicalizer.setMatchingStrategyTag(theResource, strategy);
} catch (InvalidRequestException | DataFormatException e) {
throw new UnprocessableEntityException("Invalid subscription criteria submitted: " + criteria + " " + e.getMessage());
}
} } | public class class_name {
public void validateCriteriaAndAddStrategy(final IBaseResource theResource) {
String criteria = mySubscriptionCanonicalizer.getCriteria(theResource);
try {
SubscriptionMatchingStrategy strategy = mySubscriptionStrategyEvaluator.determineStrategy(criteria);
mySubscriptionCanonicalizer.setMatchingStrategyTag(theResource, strategy); // depends on control dependency: [try], data = [none]
} catch (InvalidRequestException | DataFormatException e) {
throw new UnprocessableEntityException("Invalid subscription criteria submitted: " + criteria + " " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected List<ConfigIssue> init() {
List<ConfigIssue> issues = super.init();
errorRecordHandler = new DefaultErrorRecordHandler(getContext()); // NOSONAR
conf.basic.init(getContext(), Groups.HTTP.name(), BASIC_CONFIG_PREFIX, issues);
conf.dataFormatConfig.init(getContext(), conf.dataFormat, Groups.HTTP.name(), DATA_FORMAT_CONFIG_PREFIX, issues);
conf.init(getContext(), Groups.HTTP.name(), "conf.", issues);
if (conf.client.tlsConfig.isEnabled()) {
conf.client.tlsConfig.init(getContext(), Groups.TLS.name(), TLS_CONFIG_PREFIX, issues);
}
resourceVars = getContext().createELVars();
resourceEval = getContext().createELEval(RESOURCE_CONFIG_NAME);
bodyVars = getContext().createELVars();
bodyEval = getContext().createELEval(REQUEST_BODY_CONFIG_NAME);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(ZoneId.of(conf.timeZoneID)));
TimeEL.setCalendarInContext(bodyVars, calendar);
headerVars = getContext().createELVars();
headerEval = getContext().createELEval(HEADER_CONFIG_NAME);
stopVars = getContext().createELVars();
stopEval = getContext().createELEval(STOP_CONFIG_NAME);
next = null;
haveMorePages = false;
if (conf.responseStatusActionConfigs != null) {
final String cfgName = "conf.responseStatusActionConfigs";
final EnumSet<ResponseAction> backoffRetries = EnumSet.of(
ResponseAction.RETRY_EXPONENTIAL_BACKOFF,
ResponseAction.RETRY_LINEAR_BACKOFF
);
for (HttpResponseActionConfigBean actionConfig : conf.responseStatusActionConfigs) {
final HttpResponseActionConfigBean prevAction = statusToActionConfigs.put(
actionConfig.getStatusCode(),
actionConfig
);
if (prevAction != null) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_17,
actionConfig.getStatusCode()
)
);
}
if (backoffRetries.contains(actionConfig.getAction()) && actionConfig.getBackoffInterval() <= 0) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_15
)
);
}
if (actionConfig.getStatusCode() >= 200 && actionConfig.getStatusCode() < 300) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_16
)
);
}
}
}
this.timeoutActionConfig = conf.responseTimeoutActionConfig;
// Validation succeeded so configure the client.
if (issues.isEmpty()) {
try {
configureClient(issues);
} catch (StageException e) {
// should not happen on initial connect
ExceptionUtils.throwUndeclared(e);
}
}
return issues;
} } | public class class_name {
@Override
protected List<ConfigIssue> init() {
List<ConfigIssue> issues = super.init();
errorRecordHandler = new DefaultErrorRecordHandler(getContext()); // NOSONAR
conf.basic.init(getContext(), Groups.HTTP.name(), BASIC_CONFIG_PREFIX, issues);
conf.dataFormatConfig.init(getContext(), conf.dataFormat, Groups.HTTP.name(), DATA_FORMAT_CONFIG_PREFIX, issues);
conf.init(getContext(), Groups.HTTP.name(), "conf.", issues);
if (conf.client.tlsConfig.isEnabled()) {
conf.client.tlsConfig.init(getContext(), Groups.TLS.name(), TLS_CONFIG_PREFIX, issues); // depends on control dependency: [if], data = [none]
}
resourceVars = getContext().createELVars();
resourceEval = getContext().createELEval(RESOURCE_CONFIG_NAME);
bodyVars = getContext().createELVars();
bodyEval = getContext().createELEval(REQUEST_BODY_CONFIG_NAME);
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(ZoneId.of(conf.timeZoneID)));
TimeEL.setCalendarInContext(bodyVars, calendar);
headerVars = getContext().createELVars();
headerEval = getContext().createELEval(HEADER_CONFIG_NAME);
stopVars = getContext().createELVars();
stopEval = getContext().createELEval(STOP_CONFIG_NAME);
next = null;
haveMorePages = false;
if (conf.responseStatusActionConfigs != null) {
final String cfgName = "conf.responseStatusActionConfigs";
final EnumSet<ResponseAction> backoffRetries = EnumSet.of(
ResponseAction.RETRY_EXPONENTIAL_BACKOFF,
ResponseAction.RETRY_LINEAR_BACKOFF
);
for (HttpResponseActionConfigBean actionConfig : conf.responseStatusActionConfigs) {
final HttpResponseActionConfigBean prevAction = statusToActionConfigs.put(
actionConfig.getStatusCode(),
actionConfig
);
if (prevAction != null) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_17,
actionConfig.getStatusCode()
)
); // depends on control dependency: [if], data = [none]
}
if (backoffRetries.contains(actionConfig.getAction()) && actionConfig.getBackoffInterval() <= 0) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_15
)
); // depends on control dependency: [if], data = [none]
}
if (actionConfig.getStatusCode() >= 200 && actionConfig.getStatusCode() < 300) {
issues.add(
getContext().createConfigIssue(
Groups.HTTP.name(),
cfgName,
Errors.HTTP_16
)
); // depends on control dependency: [if], data = [none]
}
}
}
this.timeoutActionConfig = conf.responseTimeoutActionConfig;
// Validation succeeded so configure the client.
if (issues.isEmpty()) {
try {
configureClient(issues); // depends on control dependency: [try], data = [none]
} catch (StageException e) {
// should not happen on initial connect
ExceptionUtils.throwUndeclared(e);
} // depends on control dependency: [catch], data = [none]
}
return issues;
} } |
public class class_name {
protected Iterable<ItemHolder> items(final Object socketOrChannel)
{
final CompositePollItem aggregate = items.get(socketOrChannel);
if (aggregate == null) {
return Collections.emptySet();
}
return aggregate.holders;
} } | public class class_name {
protected Iterable<ItemHolder> items(final Object socketOrChannel)
{
final CompositePollItem aggregate = items.get(socketOrChannel);
if (aggregate == null) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
return aggregate.holders;
} } |
public class class_name {
public List<Date> parse(String language)
{
language = words2numbers(language);
List<Date> result = new ArrayList<Date>();
List<com.joestelmach.natty.DateGroup> groups = parser.parse(language);
for (com.joestelmach.natty.DateGroup group : groups) {
result.addAll(group.getDates());
}
return result;
} } | public class class_name {
public List<Date> parse(String language)
{
language = words2numbers(language);
List<Date> result = new ArrayList<Date>();
List<com.joestelmach.natty.DateGroup> groups = parser.parse(language);
for (com.joestelmach.natty.DateGroup group : groups) {
result.addAll(group.getDates()); // depends on control dependency: [for], data = [group]
}
return result;
} } |
public class class_name {
public Content getNonBreakResource(String key) {
String text = configuration.getText(key);
Content c = configuration.newContent();
int start = 0;
int p;
while ((p = text.indexOf(" ", start)) != -1) {
c.addContent(text.substring(start, p));
c.addContent(RawHtml.nbsp);
start = p + 1;
}
c.addContent(text.substring(start));
return c;
} } | public class class_name {
public Content getNonBreakResource(String key) {
String text = configuration.getText(key);
Content c = configuration.newContent();
int start = 0;
int p;
while ((p = text.indexOf(" ", start)) != -1) {
c.addContent(text.substring(start, p)); // depends on control dependency: [while], data = [none]
c.addContent(RawHtml.nbsp); // depends on control dependency: [while], data = [none]
start = p + 1; // depends on control dependency: [while], data = [none]
}
c.addContent(text.substring(start));
return c;
} } |
public class class_name {
@Override
public void logout() {
if (bot.isRunning()) {
String url = String.format("%s/webwxlogout", bot.session().getUrl());
this.client.send(new StringRequest(url)
.add("redirect", 1)
.add("type", 1)
.add("sKey", bot.session().getSKey()));
bot.setRunning(false);
}
this.logging = false;
this.client.cookies().clear();
String file = bot.config().assetsDir() + "/login.json";
new File(file).delete();
} } | public class class_name {
@Override
public void logout() {
if (bot.isRunning()) {
String url = String.format("%s/webwxlogout", bot.session().getUrl());
this.client.send(new StringRequest(url)
.add("redirect", 1)
.add("type", 1)
.add("sKey", bot.session().getSKey())); // depends on control dependency: [if], data = [none]
bot.setRunning(false); // depends on control dependency: [if], data = [none]
}
this.logging = false;
this.client.cookies().clear();
String file = bot.config().assetsDir() + "/login.json";
new File(file).delete();
} } |
public class class_name {
private static void processItems(Map<DisconfKey, List<IDisconfUpdate>> inverseMap,
DisconfUpdateService disconfUpdateService, IDisconfUpdate iDisconfUpdate) {
List<String> itemKeys = Arrays.asList(disconfUpdateService.itemKeys());
// 反索引
for (String key : itemKeys) {
DisconfKey disconfKey = new DisconfKey(DisConfigTypeEnum.ITEM, key);
addOne2InverseMap(disconfKey, inverseMap, iDisconfUpdate);
}
} } | public class class_name {
private static void processItems(Map<DisconfKey, List<IDisconfUpdate>> inverseMap,
DisconfUpdateService disconfUpdateService, IDisconfUpdate iDisconfUpdate) {
List<String> itemKeys = Arrays.asList(disconfUpdateService.itemKeys());
// 反索引
for (String key : itemKeys) {
DisconfKey disconfKey = new DisconfKey(DisConfigTypeEnum.ITEM, key);
addOne2InverseMap(disconfKey, inverseMap, iDisconfUpdate); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public List<String> replaceRunOnWords(final String original) {
final List<String> candidates = new ArrayList<String>();
String wordToCheck = original;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(original, dictionaryMetadata.getInputConversionPairs());
}
if (!isInDictionary(wordToCheck) && dictionaryMetadata.isSupportingRunOnWords()) {
for (int i = 1; i < wordToCheck.length(); i++) {
// chop from left to right
final CharSequence firstCh = wordToCheck.subSequence(0, i);
if (isInDictionary(firstCh) && isInDictionary(wordToCheck.subSequence(i, wordToCheck.length()))) {
if (dictionaryMetadata.getOutputConversionPairs().isEmpty()) {
candidates.add(firstCh + " " + wordToCheck.subSequence(i, wordToCheck.length()));
} else {
candidates.add(DictionaryLookup.applyReplacements(firstCh + " " + wordToCheck.subSequence(i, wordToCheck.length()),
dictionaryMetadata.getOutputConversionPairs()).toString());
}
}
}
}
return candidates;
} } | public class class_name {
public List<String> replaceRunOnWords(final String original) {
final List<String> candidates = new ArrayList<String>();
String wordToCheck = original;
if (!dictionaryMetadata.getInputConversionPairs().isEmpty()) {
wordToCheck = DictionaryLookup.applyReplacements(original, dictionaryMetadata.getInputConversionPairs());
// depends on control dependency: [if], data = [none]
}
if (!isInDictionary(wordToCheck) && dictionaryMetadata.isSupportingRunOnWords()) {
for (int i = 1; i < wordToCheck.length(); i++) {
// chop from left to right
final CharSequence firstCh = wordToCheck.subSequence(0, i);
if (isInDictionary(firstCh) && isInDictionary(wordToCheck.subSequence(i, wordToCheck.length()))) {
if (dictionaryMetadata.getOutputConversionPairs().isEmpty()) {
candidates.add(firstCh + " " + wordToCheck.subSequence(i, wordToCheck.length()));
// depends on control dependency: [if], data = [none]
} else {
candidates.add(DictionaryLookup.applyReplacements(firstCh + " " + wordToCheck.subSequence(i, wordToCheck.length()),
dictionaryMetadata.getOutputConversionPairs()).toString());
// depends on control dependency: [if], data = [none]
}
}
}
}
return candidates;
} } |
public class class_name {
public static CharSequence[] escapeKeys(CharSequence... keys) {
CharSequence[] escapedKeys = new CharSequence[keys.length];
for (int index = 0; index < keys.length; index++) {
escapedKeys[index] = escapeKeys(keys[index]);
}
return escapedKeys;
} } | public class class_name {
public static CharSequence[] escapeKeys(CharSequence... keys) {
CharSequence[] escapedKeys = new CharSequence[keys.length];
for (int index = 0; index < keys.length; index++) {
escapedKeys[index] = escapeKeys(keys[index]); // depends on control dependency: [for], data = [index]
}
return escapedKeys;
} } |
public class class_name {
public synchronized boolean updateNodeFrameParameters(int streamID, int newPriority, int newParentStreamID, boolean exclusive) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateNodeFrameParameters entry: streamID to udpate: " + streamID + " new Priority: " + newPriority
+ " new Parent stream ID: " + newParentStreamID + " exclusive: " + exclusive);
}
Node nodeToChange = root.findNode(streamID);
Node oldParent = nodeToChange.getParent();
if ((nodeToChange == null) || (oldParent == null)) {
return false;
}
int oldParentStreamID = oldParent.getStreamID();
int oldPriority = nodeToChange.getPriority();
// change parent if specified
if ((newParentStreamID != oldParentStreamID) || (exclusive)) {
changeParent(streamID, newPriority, newParentStreamID, exclusive);
} else {
// parent won't change, therefore only change the priority and write counts, if it is different
if (newPriority != oldPriority) {
nodeToChange.setPriority(newPriority);
oldParent.clearDependentsWriteCount();
oldParent.sortDependents();
// special debug - too verbose for big trees
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "updateNodeFrameParameters after sorting: tree is now:" + getTreeDump());
//}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateNodeFrameParameters exit: node changed: " + nodeToChange.toStringDetails());
}
return true;
} } | public class class_name {
public synchronized boolean updateNodeFrameParameters(int streamID, int newPriority, int newParentStreamID, boolean exclusive) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateNodeFrameParameters entry: streamID to udpate: " + streamID + " new Priority: " + newPriority
+ " new Parent stream ID: " + newParentStreamID + " exclusive: " + exclusive); // depends on control dependency: [if], data = [none]
}
Node nodeToChange = root.findNode(streamID);
Node oldParent = nodeToChange.getParent();
if ((nodeToChange == null) || (oldParent == null)) {
return false; // depends on control dependency: [if], data = [none]
}
int oldParentStreamID = oldParent.getStreamID();
int oldPriority = nodeToChange.getPriority();
// change parent if specified
if ((newParentStreamID != oldParentStreamID) || (exclusive)) {
changeParent(streamID, newPriority, newParentStreamID, exclusive); // depends on control dependency: [if], data = [none]
} else {
// parent won't change, therefore only change the priority and write counts, if it is different
if (newPriority != oldPriority) {
nodeToChange.setPriority(newPriority); // depends on control dependency: [if], data = [(newPriority]
oldParent.clearDependentsWriteCount(); // depends on control dependency: [if], data = [none]
oldParent.sortDependents(); // depends on control dependency: [if], data = [none]
// special debug - too verbose for big trees
//if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
// Tr.debug(tc, "updateNodeFrameParameters after sorting: tree is now:" + getTreeDump());
//}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "updateNodeFrameParameters exit: node changed: " + nodeToChange.toStringDetails()); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
private static long getCachedLastModified(ServletContext servletContext, HeaderAndPath hap) {
// Get the cache
@SuppressWarnings("unchecked")
Map<HeaderAndPath,GetLastModifiedCacheValue> cache = (Map<HeaderAndPath,GetLastModifiedCacheValue>)servletContext.getAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME);
if(cache == null) {
// Create new cache
cache = new HashMap<>();
servletContext.setAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME, cache);
}
GetLastModifiedCacheValue cacheValue;
synchronized(cache) {
// Get the cache entry
cacheValue = cache.get(hap);
if(cacheValue==null) {
cacheValue = new GetLastModifiedCacheValue();
cache.put(hap, cacheValue);
}
}
synchronized(cacheValue) {
final long currentTime = System.currentTimeMillis();
if(cacheValue.isValid(currentTime)) {
return cacheValue.lastModified;
} else {
ServletContextCache servletContextCache = ServletContextCache.getCache(servletContext);
long lastModified = 0;
String realPath = servletContextCache.getRealPath(hap.path);
if(realPath != null) {
// Use File first
lastModified = new File(realPath).lastModified();
}
if(lastModified == 0) {
// Try URL
try {
URL resourceUrl = servletContextCache.getResource(hap.path);
if(resourceUrl != null) {
URLConnection conn = resourceUrl.openConnection();
conn.setAllowUserInteraction(false);
conn.setConnectTimeout(10);
conn.setDoInput(false);
conn.setDoOutput(false);
conn.setReadTimeout(10);
conn.setUseCaches(false);
lastModified = conn.getLastModified();
}
} catch(IOException e) {
// lastModified stays unmodified
}
}
// Store in cache
cacheValue.cacheTime = currentTime;
cacheValue.lastModified = lastModified;
return lastModified;
}
}
} } | public class class_name {
private static long getCachedLastModified(ServletContext servletContext, HeaderAndPath hap) {
// Get the cache
@SuppressWarnings("unchecked")
Map<HeaderAndPath,GetLastModifiedCacheValue> cache = (Map<HeaderAndPath,GetLastModifiedCacheValue>)servletContext.getAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME);
if(cache == null) {
// Create new cache
cache = new HashMap<>(); // depends on control dependency: [if], data = [none]
servletContext.setAttribute(GET_LAST_MODIFIED_CACHE_ATTRIBUTE_NAME, cache); // depends on control dependency: [if], data = [none]
}
GetLastModifiedCacheValue cacheValue;
synchronized(cache) {
// Get the cache entry
cacheValue = cache.get(hap);
if(cacheValue==null) {
cacheValue = new GetLastModifiedCacheValue(); // depends on control dependency: [if], data = [none]
cache.put(hap, cacheValue); // depends on control dependency: [if], data = [none]
}
}
synchronized(cacheValue) {
final long currentTime = System.currentTimeMillis();
if(cacheValue.isValid(currentTime)) {
return cacheValue.lastModified; // depends on control dependency: [if], data = [none]
} else {
ServletContextCache servletContextCache = ServletContextCache.getCache(servletContext);
long lastModified = 0;
String realPath = servletContextCache.getRealPath(hap.path);
if(realPath != null) {
// Use File first
lastModified = new File(realPath).lastModified(); // depends on control dependency: [if], data = [(realPath]
}
if(lastModified == 0) {
// Try URL
try {
URL resourceUrl = servletContextCache.getResource(hap.path);
if(resourceUrl != null) {
URLConnection conn = resourceUrl.openConnection();
conn.setAllowUserInteraction(false); // depends on control dependency: [if], data = [none]
conn.setConnectTimeout(10); // depends on control dependency: [if], data = [none]
conn.setDoInput(false); // depends on control dependency: [if], data = [none]
conn.setDoOutput(false); // depends on control dependency: [if], data = [none]
conn.setReadTimeout(10); // depends on control dependency: [if], data = [none]
conn.setUseCaches(false); // depends on control dependency: [if], data = [none]
lastModified = conn.getLastModified(); // depends on control dependency: [if], data = [none]
}
} catch(IOException e) {
// lastModified stays unmodified
} // depends on control dependency: [catch], data = [none]
}
// Store in cache
cacheValue.cacheTime = currentTime; // depends on control dependency: [if], data = [none]
cacheValue.lastModified = lastModified; // depends on control dependency: [if], data = [none]
return lastModified; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void delete(ReflectedHandle<K, V> n) {
if (n.inner == null && free != n) {
throw new IllegalArgumentException("Invalid handle!");
}
if (free == n) {
free = null;
} else {
// delete from inner queue
AddressableHeap.Handle<K, HandleMap<K, V>> nInner = n.inner;
ReflectedHandle<K, V> nOuter = nInner.getValue().outer;
nInner.delete();
nOuter.inner = null;
nOuter.minNotMax = false;
// delete pair from inner queue
AddressableHeap.Handle<K, HandleMap<K, V>> otherInner = nInner.getValue().otherInner;
ReflectedHandle<K, V> otherOuter = otherInner.getValue().outer;
otherInner.delete();
otherOuter.inner = null;
otherOuter.minNotMax = false;
// reinsert either as free or as pair with free
if (free == null) {
free = otherOuter;
} else {
insertPair(otherOuter, free);
free = null;
}
}
size--;
} } | public class class_name {
private void delete(ReflectedHandle<K, V> n) {
if (n.inner == null && free != n) {
throw new IllegalArgumentException("Invalid handle!");
}
if (free == n) {
free = null; // depends on control dependency: [if], data = [none]
} else {
// delete from inner queue
AddressableHeap.Handle<K, HandleMap<K, V>> nInner = n.inner;
ReflectedHandle<K, V> nOuter = nInner.getValue().outer;
nInner.delete(); // depends on control dependency: [if], data = [none]
nOuter.inner = null; // depends on control dependency: [if], data = [none]
nOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
// delete pair from inner queue
AddressableHeap.Handle<K, HandleMap<K, V>> otherInner = nInner.getValue().otherInner;
ReflectedHandle<K, V> otherOuter = otherInner.getValue().outer;
otherInner.delete(); // depends on control dependency: [if], data = [none]
otherOuter.inner = null; // depends on control dependency: [if], data = [none]
otherOuter.minNotMax = false; // depends on control dependency: [if], data = [none]
// reinsert either as free or as pair with free
if (free == null) {
free = otherOuter; // depends on control dependency: [if], data = [none]
} else {
insertPair(otherOuter, free); // depends on control dependency: [if], data = [none]
free = null; // depends on control dependency: [if], data = [none]
}
}
size--;
} } |
public class class_name {
public void addEntry(LocalVariable localVar) {
String varName = localVar.getName();
if (varName != null) {
ConstantUTFInfo name = ConstantUTFInfo.make(mCp, varName);
ConstantUTFInfo descriptor =
ConstantUTFInfo.make(mCp, localVar.getType().toString());
mEntries.add(new Entry(localVar, name, descriptor));
}
mCleanEntries = null;
} } | public class class_name {
public void addEntry(LocalVariable localVar) {
String varName = localVar.getName();
if (varName != null) {
ConstantUTFInfo name = ConstantUTFInfo.make(mCp, varName);
ConstantUTFInfo descriptor =
ConstantUTFInfo.make(mCp, localVar.getType().toString());
mEntries.add(new Entry(localVar, name, descriptor)); // depends on control dependency: [if], data = [none]
}
mCleanEntries = null;
} } |
public class class_name {
public P load(final BaseEntity<?> ent, final LoadContext ctx) {
try {
// The context needs to know the root entity for any given point
ctx.setCurrentRoot(Key.create((com.google.cloud.datastore.Key)ent.getKey()));
final EntityValue entityValue = makeLoadEntityValue(ent);
return translator.load(entityValue, ctx, Path.root());
}
catch (LoadException ex) { throw ex; }
catch (Exception ex) {
throw new LoadException(ent, ex.getMessage(), ex);
}
} } | public class class_name {
public P load(final BaseEntity<?> ent, final LoadContext ctx) {
try {
// The context needs to know the root entity for any given point
ctx.setCurrentRoot(Key.create((com.google.cloud.datastore.Key)ent.getKey())); // depends on control dependency: [try], data = [none]
final EntityValue entityValue = makeLoadEntityValue(ent);
return translator.load(entityValue, ctx, Path.root()); // depends on control dependency: [try], data = [none]
}
catch (LoadException ex) { throw ex; } // depends on control dependency: [catch], data = [none]
catch (Exception ex) {
throw new LoadException(ent, ex.getMessage(), ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void registerAny(Metric2Set metrics) {
for (Map.Entry<MetricName, Metric> entry : metrics.getMetrics().entrySet()) {
registerNewMetrics(entry.getKey(), entry.getValue());
}
} } | public class class_name {
public void registerAny(Metric2Set metrics) {
for (Map.Entry<MetricName, Metric> entry : metrics.getMetrics().entrySet()) {
registerNewMetrics(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public void marshall(AdminRemoveUserFromGroupRequest adminRemoveUserFromGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (adminRemoveUserFromGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getUsername(), USERNAME_BINDING);
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getGroupName(), GROUPNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AdminRemoveUserFromGroupRequest adminRemoveUserFromGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (adminRemoveUserFromGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getUsername(), USERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(adminRemoveUserFromGroupRequest.getGroupName(), GROUPNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getRatioHeightPercentage() {
if (m_ratioHeightPercentage == null) {
m_ratioHeightPercentage = calcRatioHeightPercentage(getScaler().getWidth(), getScaler().getHeight());
}
return m_ratioHeightPercentage;
} } | public class class_name {
public String getRatioHeightPercentage() {
if (m_ratioHeightPercentage == null) {
m_ratioHeightPercentage = calcRatioHeightPercentage(getScaler().getWidth(), getScaler().getHeight()); // depends on control dependency: [if], data = [none]
}
return m_ratioHeightPercentage;
} } |
public class class_name {
public ComplexFloat addi(ComplexFloat c, ComplexFloat result) {
if (this == result) {
r += c.r;
i += c.i;
} else {
result.r = r + c.r;
result.i = i + c.i;
}
return result;
} } | public class class_name {
public ComplexFloat addi(ComplexFloat c, ComplexFloat result) {
if (this == result) {
r += c.r; // depends on control dependency: [if], data = [none]
i += c.i; // depends on control dependency: [if], data = [none]
} else {
result.r = r + c.r; // depends on control dependency: [if], data = [none]
result.i = i + c.i; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void put(PrintStream p, String s) {
if (s == null) {
// nl();
put(p, " ");
return;
}
if (wasPreviousField) {
p.print(separator);
}
if (trim) {
s = s.trim();
}
if (s.indexOf(quote) >= 0) {
/* worst case, needs surrounding quotes and internal quotes doubled */
p.print(quote);
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == quote) {
p.print(quote);
p.print(quote);
} else {
p.print(c);
}
}
p.print(quote);
} else if (quoteLevel == 2 || quoteLevel == 1 && s.indexOf(' ') >= 0
|| s.indexOf(separator) >= 0) {
/* need surrounding quotes */
p.print(quote);
p.print(s);
p.print(quote);
} else {
/* ordinary case, no surrounding quotes needed */
p.print(s);
}
/* make a note to print trailing comma later */
wasPreviousField = true;
} } | public class class_name {
private void put(PrintStream p, String s) {
if (s == null) {
// nl();
put(p, " "); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (wasPreviousField) {
p.print(separator); // depends on control dependency: [if], data = [none]
}
if (trim) {
s = s.trim(); // depends on control dependency: [if], data = [none]
}
if (s.indexOf(quote) >= 0) {
/* worst case, needs surrounding quotes and internal quotes doubled */
p.print(quote); // depends on control dependency: [if], data = [none]
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == quote) {
p.print(quote); // depends on control dependency: [if], data = [quote)]
p.print(quote); // depends on control dependency: [if], data = [quote)]
} else {
p.print(c); // depends on control dependency: [if], data = [(c]
}
}
p.print(quote); // depends on control dependency: [if], data = [none]
} else if (quoteLevel == 2 || quoteLevel == 1 && s.indexOf(' ') >= 0
|| s.indexOf(separator) >= 0) {
/* need surrounding quotes */
p.print(quote); // depends on control dependency: [if], data = [none]
p.print(s); // depends on control dependency: [if], data = [none]
p.print(quote); // depends on control dependency: [if], data = [none]
} else {
/* ordinary case, no surrounding quotes needed */
p.print(s); // depends on control dependency: [if], data = [none]
}
/* make a note to print trailing comma later */
wasPreviousField = true;
} } |
public class class_name {
public ReturnCode go() {
try {
// obtaining a lock for the server (with timeout)
serverLock.obtainServerLock();
// IFF we can obtain the server lock....
// Ensure that the server state directory has been cleared prior to start
clearServerStateDir();
setupJMXOverride();
// Set default to not retry http post requests. See java bug " JDK-6382788 : URLConnection is silently retrying POST request"
setHttpRetryPost();
// Only create resources (like the server dir) if the current return code is ok
setLoggerProperties();
// Create the server running marker file that is automatically deleted when JVM terminates normally
// If the file already exists, it will force a clean start
ServerLock.createServerRunningMarkerFile(bootProps);
// Clear workarea if directed via properties or service
cleanStart();
// Read the bootstrap manifest
BootstrapManifest bootManifest = null;
try {
bootManifest = BootstrapManifest.readBootstrapManifest(libertyBoot);
} catch (IOException e) {
throw new LaunchException("Could not read the jar manifest", BootstrapConstants.messages.getString("error.unknown.kernel.version"), e);
}
// Read the bootstrap defaults (kernel, log provider, os extensions)
BootstrapDefaults bootDefaults = null;
try {
bootDefaults = new BootstrapDefaults(bootProps);
} catch (IOException e) {
throw new LaunchException("Could not read the defaults file", BootstrapConstants.messages.getString("error.unknown.kernel.version"), e);
}
// handle system packages & system.packages.extra -- MAY THROW if
// required system.packages list can't be read from the jar
bootManifest.prepSystemPackages(bootProps);
// Get product version information & retrieve log provider
String kernelVersion = BootstrapConstants.SERVER_NAME_PREFIX + bootManifest.getBundleVersion();
String productInfo = getProductInfoDisplayName();
// Find the bootstrap resources we need to launch the nested framework.
// MAY THROW if these resources can not be found or read
KernelResolver resolver = new KernelResolver(bootProps.getInstallRoot(), bootProps.getWorkareaFile(KernelResolver.CACHE_FILE), bootDefaults.getKernelDefinition(bootProps), bootDefaults.getLogProviderDefinition(bootProps), bootDefaults.getOSExtensionDefinition(bootProps), libertyBoot);
// ISSUE LAUNCH FEEDBACK TO THE CONSOLE -- we've done the cursory validation at least.
String logLevel = bootProps.get("com.ibm.ws.logging.console.log.level");
boolean logVersionInfo = (logLevel == null || !logLevel.equalsIgnoreCase("off"));
processVersion(bootProps, "info.serverLaunch", kernelVersion, productInfo, logVersionInfo);
if (logVersionInfo) {
// if serial filter agent is loaded, log the information.
logSerialFilterMessage();
List<String> cmdArgs = bootProps.getCmdArgs();
if (cmdArgs != null && !cmdArgs.isEmpty()) {
System.out.println("\t" + MessageFormat.format(BootstrapConstants.messages.getString("info.cmdArgs"), cmdArgs));
}
}
//now we have a resolver we should check if a clean start is being forced
//if we already cleaned once because of the cmd line arg, osgi prop or service changes
//then the resolver won't force us to clean again anyway
if (resolver.getForceCleanStart())
KernelUtils.cleanStart(bootProps.getWorkareaFile(null));
//add the service fingerprint
ServiceFingerprint.putInstallDir(null, bootProps.getInstallRoot());
// Find additional/extra system packages from log providers and os extensions
String packages = bootProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE);
packages = resolver.appendExtraSystemPackages(packages);
// save new "extra" packages
if (packages != null)
bootProps.put(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE, packages);
// Create a new classloader with boot.jars on the classpath
// Find the framework launcher, and invoke it
ClassLoader loader;
List<URL> urlList = new ArrayList<URL>();
// for liberty boot all the jars are already on the classpath
if (!libertyBoot) {
// Add bootstrap jar(s)
bootProps.addBootstrapJarURLs(urlList);
// Add OSGi framework, log provider, and/or os extension "boot.jar" elements
resolver.addBootJars(urlList);
}
// Build our new shiny nested classloader
loader = buildClassLoader(urlList, bootProps.get("verifyJarSignature"));
// Find LauncherDelegate, store the instance where we can find it (for server commands)
try {
Class<? extends LauncherDelegate> clazz = getLauncherDelegateClass(loader);
launcherDelegate = clazz.getConstructor(BootstrapConfig.class).newInstance(bootProps);
} catch (Exception e) {
rethrowException("Unable to create OSGi framework due to " + e, e);
}
delegateCreated.countDown();
// Pass some things along that the delegate in the nested classloader will need
bootProps.setFrameworkClassloader(loader);
bootProps.setKernelResolver(resolver);
bootProps.setInstrumentation(getInstrumentation());
if (!!!Boolean.parseBoolean(bootProps.get(BootstrapConstants.INTERNAL_START_SIMULATION))) {
// GO!!! We won't come back from this call until the framework has stopped
launcherDelegate.launchFramework();
}
} catch (LaunchException le) {
// This is one of ours, already packaged correctly, just rethrow
throw le;
} catch (Throwable e) {
rethrowException("Caught unexpected exception " + e, e);
} finally {
delegateCreated.countDown();
if (serverLock != null) {
serverLock.releaseServerLock();
}
}
return ReturnCode.OK;
} } | public class class_name {
public ReturnCode go() {
try {
// obtaining a lock for the server (with timeout)
serverLock.obtainServerLock(); // depends on control dependency: [try], data = [none]
// IFF we can obtain the server lock....
// Ensure that the server state directory has been cleared prior to start
clearServerStateDir(); // depends on control dependency: [try], data = [none]
setupJMXOverride(); // depends on control dependency: [try], data = [none]
// Set default to not retry http post requests. See java bug " JDK-6382788 : URLConnection is silently retrying POST request"
setHttpRetryPost(); // depends on control dependency: [try], data = [none]
// Only create resources (like the server dir) if the current return code is ok
setLoggerProperties(); // depends on control dependency: [try], data = [none]
// Create the server running marker file that is automatically deleted when JVM terminates normally
// If the file already exists, it will force a clean start
ServerLock.createServerRunningMarkerFile(bootProps); // depends on control dependency: [try], data = [none]
// Clear workarea if directed via properties or service
cleanStart(); // depends on control dependency: [try], data = [none]
// Read the bootstrap manifest
BootstrapManifest bootManifest = null;
try {
bootManifest = BootstrapManifest.readBootstrapManifest(libertyBoot); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new LaunchException("Could not read the jar manifest", BootstrapConstants.messages.getString("error.unknown.kernel.version"), e);
} // depends on control dependency: [catch], data = [none]
// Read the bootstrap defaults (kernel, log provider, os extensions)
BootstrapDefaults bootDefaults = null;
try {
bootDefaults = new BootstrapDefaults(bootProps); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new LaunchException("Could not read the defaults file", BootstrapConstants.messages.getString("error.unknown.kernel.version"), e);
} // depends on control dependency: [catch], data = [none]
// handle system packages & system.packages.extra -- MAY THROW if
// required system.packages list can't be read from the jar
bootManifest.prepSystemPackages(bootProps); // depends on control dependency: [try], data = [none]
// Get product version information & retrieve log provider
String kernelVersion = BootstrapConstants.SERVER_NAME_PREFIX + bootManifest.getBundleVersion();
String productInfo = getProductInfoDisplayName();
// Find the bootstrap resources we need to launch the nested framework.
// MAY THROW if these resources can not be found or read
KernelResolver resolver = new KernelResolver(bootProps.getInstallRoot(), bootProps.getWorkareaFile(KernelResolver.CACHE_FILE), bootDefaults.getKernelDefinition(bootProps), bootDefaults.getLogProviderDefinition(bootProps), bootDefaults.getOSExtensionDefinition(bootProps), libertyBoot);
// ISSUE LAUNCH FEEDBACK TO THE CONSOLE -- we've done the cursory validation at least.
String logLevel = bootProps.get("com.ibm.ws.logging.console.log.level");
boolean logVersionInfo = (logLevel == null || !logLevel.equalsIgnoreCase("off"));
processVersion(bootProps, "info.serverLaunch", kernelVersion, productInfo, logVersionInfo); // depends on control dependency: [try], data = [none]
if (logVersionInfo) {
// if serial filter agent is loaded, log the information.
logSerialFilterMessage(); // depends on control dependency: [if], data = [none]
List<String> cmdArgs = bootProps.getCmdArgs();
if (cmdArgs != null && !cmdArgs.isEmpty()) {
System.out.println("\t" + MessageFormat.format(BootstrapConstants.messages.getString("info.cmdArgs"), cmdArgs)); // depends on control dependency: [if], data = [none]
}
}
//now we have a resolver we should check if a clean start is being forced
//if we already cleaned once because of the cmd line arg, osgi prop or service changes
//then the resolver won't force us to clean again anyway
if (resolver.getForceCleanStart())
KernelUtils.cleanStart(bootProps.getWorkareaFile(null));
//add the service fingerprint
ServiceFingerprint.putInstallDir(null, bootProps.getInstallRoot()); // depends on control dependency: [try], data = [none]
// Find additional/extra system packages from log providers and os extensions
String packages = bootProps.get(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE);
packages = resolver.appendExtraSystemPackages(packages); // depends on control dependency: [try], data = [none]
// save new "extra" packages
if (packages != null)
bootProps.put(BootstrapConstants.INITPROP_OSGI_EXTRA_PACKAGE, packages);
// Create a new classloader with boot.jars on the classpath
// Find the framework launcher, and invoke it
ClassLoader loader;
List<URL> urlList = new ArrayList<URL>();
// for liberty boot all the jars are already on the classpath
if (!libertyBoot) {
// Add bootstrap jar(s)
bootProps.addBootstrapJarURLs(urlList); // depends on control dependency: [if], data = [none]
// Add OSGi framework, log provider, and/or os extension "boot.jar" elements
resolver.addBootJars(urlList); // depends on control dependency: [if], data = [none]
}
// Build our new shiny nested classloader
loader = buildClassLoader(urlList, bootProps.get("verifyJarSignature")); // depends on control dependency: [try], data = [none]
// Find LauncherDelegate, store the instance where we can find it (for server commands)
try {
Class<? extends LauncherDelegate> clazz = getLauncherDelegateClass(loader);
launcherDelegate = clazz.getConstructor(BootstrapConfig.class).newInstance(bootProps);
} catch (Exception e) {
rethrowException("Unable to create OSGi framework due to " + e, e);
} // depends on control dependency: [catch], data = [none]
delegateCreated.countDown(); // depends on control dependency: [try], data = [none]
// Pass some things along that the delegate in the nested classloader will need
bootProps.setFrameworkClassloader(loader); // depends on control dependency: [try], data = [none]
bootProps.setKernelResolver(resolver); // depends on control dependency: [try], data = [none]
bootProps.setInstrumentation(getInstrumentation()); // depends on control dependency: [try], data = [none]
if (!!!Boolean.parseBoolean(bootProps.get(BootstrapConstants.INTERNAL_START_SIMULATION))) {
// GO!!! We won't come back from this call until the framework has stopped
launcherDelegate.launchFramework(); // depends on control dependency: [if], data = [none]
}
} catch (LaunchException le) {
// This is one of ours, already packaged correctly, just rethrow
throw le;
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
rethrowException("Caught unexpected exception " + e, e);
} finally { // depends on control dependency: [catch], data = [none]
delegateCreated.countDown();
if (serverLock != null) {
serverLock.releaseServerLock(); // depends on control dependency: [if], data = [none]
}
}
return ReturnCode.OK;
} } |
public class class_name {
public static ImageView createImageInstance(Context context) {
if (sImageClass != null) {
if (imageViewConstructor == null) {
try {
imageViewConstructor = sImageClass.getConstructor(Context.class);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
if (imageViewConstructor != null) {
try {
return (ImageView) imageViewConstructor.newInstance(context);
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
return null;
} } | public class class_name {
public static ImageView createImageInstance(Context context) {
if (sImageClass != null) {
if (imageViewConstructor == null) {
try {
imageViewConstructor = sImageClass.getConstructor(Context.class); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
if (imageViewConstructor != null) {
try {
return (ImageView) imageViewConstructor.newInstance(context); // depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} } |
public class class_name {
public void setUserPolicyList(java.util.Collection<PolicyDetail> userPolicyList) {
if (userPolicyList == null) {
this.userPolicyList = null;
return;
}
this.userPolicyList = new com.amazonaws.internal.SdkInternalList<PolicyDetail>(userPolicyList);
} } | public class class_name {
public void setUserPolicyList(java.util.Collection<PolicyDetail> userPolicyList) {
if (userPolicyList == null) {
this.userPolicyList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.userPolicyList = new com.amazonaws.internal.SdkInternalList<PolicyDetail>(userPolicyList);
} } |
public class class_name {
private Object parseObjectString(Class<?> objectType, final String objectString) {
Object res;
if (ResourceParams.class.isAssignableFrom(objectType)) {
// Setup the default object
if (this.object instanceof List<?>) {
ResourceParams rp = (ResourceParams) ((List<?>) this.object).get(0);
try {
rp = (ResourceParams) rp.clone();
rp.parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
rp.getKey();
} catch (final CloneNotSupportedException e) {
}
res = rp;
} else {
((ResourceParams) this.object).parse(objectString.split(PARAMETER_SEPARATOR_REGEX));
// return the new value
res = this.object;
}
} else if (Class.class.isAssignableFrom(objectType)) {
res = parseClassParameter(objectString);
} else if (Enum.class.isAssignableFrom(objectType)) {
res = parseEnumParameter((Enum<?>) this.object, objectString);
} else if (File.class.isAssignableFrom(objectType)) {
res = parseFileParameter(objectString);
} else if (List.class.isAssignableFrom(objectType)) {
res = parseListParameter(objectString);
} else {
res = parsePrimitive(objectType, objectString);
}
return res;
} } | public class class_name {
private Object parseObjectString(Class<?> objectType, final String objectString) {
Object res;
if (ResourceParams.class.isAssignableFrom(objectType)) {
// Setup the default object
if (this.object instanceof List<?>) {
ResourceParams rp = (ResourceParams) ((List<?>) this.object).get(0);
try {
rp = (ResourceParams) rp.clone(); // depends on control dependency: [try], data = [none]
rp.parse(objectString.split(PARAMETER_SEPARATOR_REGEX)); // depends on control dependency: [try], data = [none]
rp.getKey(); // depends on control dependency: [try], data = [none]
} catch (final CloneNotSupportedException e) {
} // depends on control dependency: [catch], data = [none]
res = rp; // depends on control dependency: [if], data = [none]
} else {
((ResourceParams) this.object).parse(objectString.split(PARAMETER_SEPARATOR_REGEX)); // depends on control dependency: [if], data = [)]
// return the new value
res = this.object; // depends on control dependency: [if], data = [none]
}
} else if (Class.class.isAssignableFrom(objectType)) {
res = parseClassParameter(objectString); // depends on control dependency: [if], data = [none]
} else if (Enum.class.isAssignableFrom(objectType)) {
res = parseEnumParameter((Enum<?>) this.object, objectString); // depends on control dependency: [if], data = [none]
} else if (File.class.isAssignableFrom(objectType)) {
res = parseFileParameter(objectString); // depends on control dependency: [if], data = [none]
} else if (List.class.isAssignableFrom(objectType)) {
res = parseListParameter(objectString); // depends on control dependency: [if], data = [none]
} else {
res = parsePrimitive(objectType, objectString); // depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
private static boolean[] findIncludedColumns(List<OrcProto.Type> types,
Configuration conf) {
String includedStr =
conf.get(ColumnProjectionUtils.READ_COLUMN_IDS_CONF_STR);
if (includedStr == null || includedStr.trim().length() == 0) {
return null;
} else {
int numColumns = types.size();
boolean[] result = new boolean[numColumns];
result[0] = true;
OrcProto.Type root = types.get(0);
List<Integer> included = ColumnProjectionUtils.getReadColumnIDs(conf);
for(int i=0; i < root.getSubtypesCount(); ++i) {
if (included.contains(i)) {
includeColumnRecursive(types, result, root.getSubtypes(i));
}
}
// if we are filtering at least one column, return the boolean array
for(boolean include: result) {
if (!include) {
return result;
}
}
return null;
}
} } | public class class_name {
private static boolean[] findIncludedColumns(List<OrcProto.Type> types,
Configuration conf) {
String includedStr =
conf.get(ColumnProjectionUtils.READ_COLUMN_IDS_CONF_STR);
if (includedStr == null || includedStr.trim().length() == 0) {
return null; // depends on control dependency: [if], data = [none]
} else {
int numColumns = types.size();
boolean[] result = new boolean[numColumns];
result[0] = true; // depends on control dependency: [if], data = [none]
OrcProto.Type root = types.get(0);
List<Integer> included = ColumnProjectionUtils.getReadColumnIDs(conf);
for(int i=0; i < root.getSubtypesCount(); ++i) {
if (included.contains(i)) {
includeColumnRecursive(types, result, root.getSubtypes(i)); // depends on control dependency: [if], data = [none]
}
}
// if we are filtering at least one column, return the boolean array
for(boolean include: result) {
if (!include) {
return result; // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void putInGlobalScope(String name, Object obj) {
if (getGlobalScope() == null) {
initialScopeValues.put(name, obj);
} else {
try {
Context.enter();
getGlobalScope().put(name, programScope, Context.javaToJS(obj, programScope));
} finally {
Context.exit();
}
}
} } | public class class_name {
public void putInGlobalScope(String name, Object obj) {
if (getGlobalScope() == null) {
initialScopeValues.put(name, obj); // depends on control dependency: [if], data = [none]
} else {
try {
Context.enter(); // depends on control dependency: [try], data = [none]
getGlobalScope().put(name, programScope, Context.javaToJS(obj, programScope)); // depends on control dependency: [try], data = [none]
} finally {
Context.exit();
}
}
} } |
public class class_name {
public static void queueException(final Throwable e) {
if (e != null) {
try {
LogAppender<LogEvent> appender = LogManager.getAppender();
if (appender != null) {
appender.append(LogEvent.newBuilder().level("ERROR").message(e.getMessage()).exception(e).build());
}
} catch (Throwable t) {
LOGGER.info("Unable to queue exception to Stackify Log API service: {}", e, t);
}
}
} } | public class class_name {
public static void queueException(final Throwable e) {
if (e != null) {
try {
LogAppender<LogEvent> appender = LogManager.getAppender();
if (appender != null) {
appender.append(LogEvent.newBuilder().level("ERROR").message(e.getMessage()).exception(e).build()); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
LOGGER.info("Unable to queue exception to Stackify Log API service: {}", e, t);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public boolean remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "remove");
boolean reply = iterator.remove();
if (reply)
{
size--;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "remove", "reply=" + reply);
return reply;
} } | public class class_name {
public boolean remove()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "remove");
boolean reply = iterator.remove();
if (reply)
{
size--; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "remove", "reply=" + reply);
return reply;
} } |
public class class_name {
public static boolean isEqualOrNull( Object s1,
Object s2 ) {
if ( s1 == null
&& s2 == null ) {
return true;
} else if ( s1 != null
&& s2 != null
&& s1.equals( s2 ) ) {
return true;
}
return false;
} } | public class class_name {
public static boolean isEqualOrNull( Object s1,
Object s2 ) {
if ( s1 == null
&& s2 == null ) {
return true; // depends on control dependency: [if], data = [none]
} else if ( s1 != null
&& s2 != null
&& s1.equals( s2 ) ) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void sumUp() {
int offset=0;
int tmp=0;
for (int i = 0; i < numChunks; i++) {
int[] chunk = chunks[i];
if (chunk==null) throw new IllegalStateException("Chunks are not continous, null fragement at offset "+i);
for (int j = 0; j < chunkSize; j++) {
tmp = chunk[j];
chunk[j] = offset;
offset += tmp;
}
}
} } | public class class_name {
public void sumUp() {
int offset=0;
int tmp=0;
for (int i = 0; i < numChunks; i++) {
int[] chunk = chunks[i];
if (chunk==null) throw new IllegalStateException("Chunks are not continous, null fragement at offset "+i);
for (int j = 0; j < chunkSize; j++) {
tmp = chunk[j]; // depends on control dependency: [for], data = [j]
chunk[j] = offset; // depends on control dependency: [for], data = [j]
offset += tmp; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private static boolean match(String string, String pattern) {
if (string == null || string.isEmpty()) {
return false;
}
String[] wcs = tokenize(pattern);
boolean anyChars = false;
int textIdx = 0;
int wcsIdx = 0;
Stack<int[]> backtrack = new Stack<int[]>();
// loop around a backtrack stack, to handle complex * matching
do {
if (backtrack.size() > 0) {
int[] array = backtrack.pop();
wcsIdx = array[0];
textIdx = array[1];
anyChars = true;
}
// loop whilst tokens and text left to process
while (wcsIdx < wcs.length) {
if (wcs[wcsIdx].equals("?")) {
// ? so move to next text char
textIdx++;
anyChars = false;
} else if (wcs[wcsIdx].equals("*")) {
// set any chars status
anyChars = true;
if (wcsIdx == wcs.length - 1) {
textIdx = string.length();
}
} else {
// matching text token
if (anyChars) {
// any chars then try to locate text token
textIdx = string.indexOf(wcs[wcsIdx], textIdx);
if (textIdx == -1) {
// token not found
break;
}
int repeat = string.indexOf(wcs[wcsIdx], textIdx + 1);
if (repeat >= 0) {
backtrack.push(new int[] { wcsIdx, repeat });
}
} else {
// matching from current position
if (!string.startsWith(wcs[wcsIdx], textIdx)) {
// couldnt match token
break;
}
}
// matched text token, move text index to end of matched token
textIdx += wcs[wcsIdx].length();
anyChars = false;
}
wcsIdx++;
}
// full match
if (wcsIdx == wcs.length && textIdx == string.length()) {
return true;
}
} while (backtrack.size() > 0);
return false;
} } | public class class_name {
private static boolean match(String string, String pattern) {
if (string == null || string.isEmpty()) {
return false;
// depends on control dependency: [if], data = [none]
}
String[] wcs = tokenize(pattern);
boolean anyChars = false;
int textIdx = 0;
int wcsIdx = 0;
Stack<int[]> backtrack = new Stack<int[]>();
// loop around a backtrack stack, to handle complex * matching
do {
if (backtrack.size() > 0) {
int[] array = backtrack.pop();
wcsIdx = array[0];
// depends on control dependency: [if], data = [none]
textIdx = array[1];
// depends on control dependency: [if], data = [none]
anyChars = true;
// depends on control dependency: [if], data = [none]
}
// loop whilst tokens and text left to process
while (wcsIdx < wcs.length) {
if (wcs[wcsIdx].equals("?")) {
// ? so move to next text char
textIdx++;
// depends on control dependency: [if], data = [none]
anyChars = false;
// depends on control dependency: [if], data = [none]
} else if (wcs[wcsIdx].equals("*")) {
// set any chars status
anyChars = true;
// depends on control dependency: [if], data = [none]
if (wcsIdx == wcs.length - 1) {
textIdx = string.length();
// depends on control dependency: [if], data = [none]
}
} else {
// matching text token
if (anyChars) {
// any chars then try to locate text token
textIdx = string.indexOf(wcs[wcsIdx], textIdx);
// depends on control dependency: [if], data = [none]
if (textIdx == -1) {
// token not found
break;
}
int repeat = string.indexOf(wcs[wcsIdx], textIdx + 1);
if (repeat >= 0) {
backtrack.push(new int[] { wcsIdx, repeat });
// depends on control dependency: [if], data = [none]
}
} else {
// matching from current position
if (!string.startsWith(wcs[wcsIdx], textIdx)) {
// couldnt match token
break;
}
}
// matched text token, move text index to end of matched token
textIdx += wcs[wcsIdx].length();
// depends on control dependency: [if], data = [none]
anyChars = false;
// depends on control dependency: [if], data = [none]
}
wcsIdx++;
// depends on control dependency: [while], data = [none]
}
// full match
if (wcsIdx == wcs.length && textIdx == string.length()) {
return true;
// depends on control dependency: [if], data = [none]
}
} while (backtrack.size() > 0);
return false;
} } |
public class class_name {
public void updateUserProfile(String firstName, String lastName,
boolean married) {
// Get the timestamp we'll use to set the value of the profile_updated
// action.
long ts = System.currentTimeMillis();
// Construct the key we'll use to fetch the user.
PartitionKey key = new PartitionKey(lastName, firstName);
// Get the profile and actions entity from the composite dao.
UserProfileActionsModel profileActionsModel = userProfileActionsDao
.get(key);
// Updating the married status is hairy since our avro compiler isn't setup
// to compile setters for fields. We have to construct a clone through the
// builder.
UserProfileActionsModel updatedProfileActionsModel = UserProfileActionsModel
.newBuilder(profileActionsModel)
.setUserProfileModel(
UserProfileModel
.newBuilder(profileActionsModel.getUserProfileModel())
.setMarried(married).build()).build();
// Since maps are mutable, we can update the actions map without having to
// go through the builder like above.
updatedProfileActionsModel.getUserActionsModel().getActions()
.put("profile_updated", Long.toString(ts));
if (!userProfileActionsDao.put(updatedProfileActionsModel)) {
// If put returns false, a write conflict occurred where someone else
// updated the row between the times we did the get and put.
System.out
.println("Updating the user profile failed due to a write conflict");
}
} } | public class class_name {
public void updateUserProfile(String firstName, String lastName,
boolean married) {
// Get the timestamp we'll use to set the value of the profile_updated
// action.
long ts = System.currentTimeMillis();
// Construct the key we'll use to fetch the user.
PartitionKey key = new PartitionKey(lastName, firstName);
// Get the profile and actions entity from the composite dao.
UserProfileActionsModel profileActionsModel = userProfileActionsDao
.get(key);
// Updating the married status is hairy since our avro compiler isn't setup
// to compile setters for fields. We have to construct a clone through the
// builder.
UserProfileActionsModel updatedProfileActionsModel = UserProfileActionsModel
.newBuilder(profileActionsModel)
.setUserProfileModel(
UserProfileModel
.newBuilder(profileActionsModel.getUserProfileModel())
.setMarried(married).build()).build();
// Since maps are mutable, we can update the actions map without having to
// go through the builder like above.
updatedProfileActionsModel.getUserActionsModel().getActions()
.put("profile_updated", Long.toString(ts));
if (!userProfileActionsDao.put(updatedProfileActionsModel)) {
// If put returns false, a write conflict occurred where someone else
// updated the row between the times we did the get and put.
System.out
.println("Updating the user profile failed due to a write conflict"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setThreatIntelIndicators(java.util.Collection<ThreatIntelIndicator> threatIntelIndicators) {
if (threatIntelIndicators == null) {
this.threatIntelIndicators = null;
return;
}
this.threatIntelIndicators = new java.util.ArrayList<ThreatIntelIndicator>(threatIntelIndicators);
} } | public class class_name {
public void setThreatIntelIndicators(java.util.Collection<ThreatIntelIndicator> threatIntelIndicators) {
if (threatIntelIndicators == null) {
this.threatIntelIndicators = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.threatIntelIndicators = new java.util.ArrayList<ThreatIntelIndicator>(threatIntelIndicators);
} } |
public class class_name {
private void addNewArtifactsItems(List<BaseArtifact> baseArtifacts, List<ArtifactItem> existingArtifactItems, ArtifactoryCollector collector) {
long start = System.currentTimeMillis();
List<BinaryArtifact> binaryArtifacts = new ArrayList<>();
int count = 0;
Set<ArtifactItem> existingSet = new HashSet<>(existingArtifactItems);
for (BaseArtifact baseArtifact : baseArtifacts) {
ArtifactItem newArtifactItem = baseArtifact.getArtifactItem();
if (newArtifactItem != null && !existingSet.contains(newArtifactItem)) {
newArtifactItem.setLastUpdated(System.currentTimeMillis());
newArtifactItem.setCollectorId(collector.getId());
newArtifactItem = artifactItemRepository.save(newArtifactItem);
existingSet.add(newArtifactItem);
BinaryArtifact binaryArtifact = baseArtifact.getBinaryArtifact();
if (binaryArtifact != null) {
binaryArtifact.setCollectorItemId(newArtifactItem.getId());
binaryArtifacts.add(binaryArtifact);
}
count++;
}
}
if (!binaryArtifacts.isEmpty()) {
binaryArtifacts.forEach(binaryArtifact -> binaryArtifactRepository.save(binaryArtifact));
}
log("New artifacts", start, count);
} } | public class class_name {
private void addNewArtifactsItems(List<BaseArtifact> baseArtifacts, List<ArtifactItem> existingArtifactItems, ArtifactoryCollector collector) {
long start = System.currentTimeMillis();
List<BinaryArtifact> binaryArtifacts = new ArrayList<>();
int count = 0;
Set<ArtifactItem> existingSet = new HashSet<>(existingArtifactItems);
for (BaseArtifact baseArtifact : baseArtifacts) {
ArtifactItem newArtifactItem = baseArtifact.getArtifactItem();
if (newArtifactItem != null && !existingSet.contains(newArtifactItem)) {
newArtifactItem.setLastUpdated(System.currentTimeMillis());
// depends on control dependency: [if], data = [none]
newArtifactItem.setCollectorId(collector.getId());
// depends on control dependency: [if], data = [none]
newArtifactItem = artifactItemRepository.save(newArtifactItem);
// depends on control dependency: [if], data = [(newArtifactItem]
existingSet.add(newArtifactItem);
// depends on control dependency: [if], data = [(newArtifactItem]
BinaryArtifact binaryArtifact = baseArtifact.getBinaryArtifact();
if (binaryArtifact != null) {
binaryArtifact.setCollectorItemId(newArtifactItem.getId());
// depends on control dependency: [if], data = [none]
binaryArtifacts.add(binaryArtifact);
// depends on control dependency: [if], data = [(binaryArtifact]
}
count++;
// depends on control dependency: [if], data = [none]
}
}
if (!binaryArtifacts.isEmpty()) {
binaryArtifacts.forEach(binaryArtifact -> binaryArtifactRepository.save(binaryArtifact));
// depends on control dependency: [if], data = [none]
}
log("New artifacts", start, count);
} } |
public class class_name {
protected int computeZoneOffset(long millis, int millisInDay) {
int[] offsets = new int[2];
long wall = millis + millisInDay;
if (zone instanceof BasicTimeZone) {
int duplicatedTimeOpt = (repeatedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_FORMER : BasicTimeZone.LOCAL_LATTER;
int nonExistingTimeOpt = (skippedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_LATTER : BasicTimeZone.LOCAL_FORMER;
((BasicTimeZone)zone).getOffsetFromLocal(wall, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
} else {
// By default, TimeZone#getOffset behaves WALLTIME_LAST for both.
zone.getOffset(wall, true, offsets);
boolean sawRecentNegativeShift = false;
if (repeatedWallTime == WALLTIME_FIRST) {
// Check if the given wall time falls into repeated time range
long tgmt = wall - (offsets[0] + offsets[1]);
// Any negative zone transition within last 6 hours?
// Note: The maximum historic negative zone transition is -3 hours in the tz database.
// 6 hour window would be sufficient for this purpose.
int offsetBefore6 = zone.getOffset(tgmt - 6*60*60*1000);
int offsetDelta = (offsets[0] + offsets[1]) - offsetBefore6;
assert offsetDelta > -6*60*60*1000 : offsetDelta;
if (offsetDelta < 0) {
sawRecentNegativeShift = true;
// Negative shift within last 6 hours. When WALLTIME_FIRST is used and the given wall time falls
// into the repeated time range, use offsets before the transition.
// Note: If it does not fall into the repeated time range, offsets remain unchanged below.
zone.getOffset(wall + offsetDelta, true, offsets);
}
}
if (!sawRecentNegativeShift && skippedWallTime == WALLTIME_FIRST) {
// When skipped wall time option is WALLTIME_FIRST,
// recalculate offsets from the resolved time (non-wall).
// When the given wall time falls into skipped wall time,
// the offsets will be based on the zone offsets AFTER
// the transition (which means, earliest possibe interpretation).
long tgmt = wall - (offsets[0] + offsets[1]);
zone.getOffset(tgmt, false, offsets);
}
}
return offsets[0] + offsets[1];
} } | public class class_name {
protected int computeZoneOffset(long millis, int millisInDay) {
int[] offsets = new int[2];
long wall = millis + millisInDay;
if (zone instanceof BasicTimeZone) {
int duplicatedTimeOpt = (repeatedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_FORMER : BasicTimeZone.LOCAL_LATTER;
int nonExistingTimeOpt = (skippedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_LATTER : BasicTimeZone.LOCAL_FORMER;
((BasicTimeZone)zone).getOffsetFromLocal(wall, nonExistingTimeOpt, duplicatedTimeOpt, offsets); // depends on control dependency: [if], data = [none]
} else {
// By default, TimeZone#getOffset behaves WALLTIME_LAST for both.
zone.getOffset(wall, true, offsets); // depends on control dependency: [if], data = [none]
boolean sawRecentNegativeShift = false;
if (repeatedWallTime == WALLTIME_FIRST) {
// Check if the given wall time falls into repeated time range
long tgmt = wall - (offsets[0] + offsets[1]);
// Any negative zone transition within last 6 hours?
// Note: The maximum historic negative zone transition is -3 hours in the tz database.
// 6 hour window would be sufficient for this purpose.
int offsetBefore6 = zone.getOffset(tgmt - 6*60*60*1000);
int offsetDelta = (offsets[0] + offsets[1]) - offsetBefore6;
assert offsetDelta > -6*60*60*1000 : offsetDelta; // depends on control dependency: [if], data = [none]
if (offsetDelta < 0) {
sawRecentNegativeShift = true; // depends on control dependency: [if], data = [none]
// Negative shift within last 6 hours. When WALLTIME_FIRST is used and the given wall time falls
// into the repeated time range, use offsets before the transition.
// Note: If it does not fall into the repeated time range, offsets remain unchanged below.
zone.getOffset(wall + offsetDelta, true, offsets); // depends on control dependency: [if], data = [none]
}
}
if (!sawRecentNegativeShift && skippedWallTime == WALLTIME_FIRST) {
// When skipped wall time option is WALLTIME_FIRST,
// recalculate offsets from the resolved time (non-wall).
// When the given wall time falls into skipped wall time,
// the offsets will be based on the zone offsets AFTER
// the transition (which means, earliest possibe interpretation).
long tgmt = wall - (offsets[0] + offsets[1]);
zone.getOffset(tgmt, false, offsets); // depends on control dependency: [if], data = [none]
}
}
return offsets[0] + offsets[1];
} } |
public class class_name {
private void addInfoForNoSuchElementException(NoSuchElementException cause) {
if (parent == null) {
throw cause;
}
BasicPageImpl page = this.parent.getCurrentPage();
if (page == null) {
throw cause;
}
String resolvedPageName = page.getClass().getSimpleName();
// Find if page exists: This part is reached after a valid page instance is assigned to page variable. So its
// safe to proceed!
boolean pageExists = page.hasExpectedPageTitle();
if (!pageExists) {
// ParentType: Page does not exist: Sending the cause along with it
throw new ParentNotFoundException(resolvedPageName + " : With Page Title {" + page.getActualPageTitle()
+ "} Not Found.", cause);
}
// The page exists. So lets prepare a detailed error message before throwing the exception.
StringBuilder msg = new StringBuilder("Unable to find webElement ");
if (this.controlName != null) {
msg.append(this.controlName).append(" on ");
}
if (resolvedPageName != null) {
msg.append(resolvedPageName);
}
msg.append(" using the locator {").append(locator).append("}");
throw new NoSuchElementException(msg.toString(), cause);
} } | public class class_name {
private void addInfoForNoSuchElementException(NoSuchElementException cause) {
if (parent == null) {
throw cause;
}
BasicPageImpl page = this.parent.getCurrentPage();
if (page == null) {
throw cause;
}
String resolvedPageName = page.getClass().getSimpleName();
// Find if page exists: This part is reached after a valid page instance is assigned to page variable. So its
// safe to proceed!
boolean pageExists = page.hasExpectedPageTitle();
if (!pageExists) {
// ParentType: Page does not exist: Sending the cause along with it
throw new ParentNotFoundException(resolvedPageName + " : With Page Title {" + page.getActualPageTitle()
+ "} Not Found.", cause);
}
// The page exists. So lets prepare a detailed error message before throwing the exception.
StringBuilder msg = new StringBuilder("Unable to find webElement ");
if (this.controlName != null) {
msg.append(this.controlName).append(" on "); // depends on control dependency: [if], data = [(this.controlName]
}
if (resolvedPageName != null) {
msg.append(resolvedPageName); // depends on control dependency: [if], data = [(resolvedPageName]
}
msg.append(" using the locator {").append(locator).append("}");
throw new NoSuchElementException(msg.toString(), cause);
} } |
public class class_name {
public static String makeRelative(String basePath, String targetPath) {
// Ensure the paths are both absolute or both relative.
if (isAbsolute(basePath) !=
isAbsolute(targetPath)) {
throw new IllegalArgumentException(
"Paths must both be relative or both absolute.\n" +
" basePath: " + basePath + "\n" +
" targetPath: " + targetPath);
}
basePath = collapseDots(basePath);
targetPath = collapseDots(targetPath);
String[] baseFragments = basePath.split("/");
String[] targetFragments = targetPath.split("/");
int i = -1;
do {
i += 1;
if (i == baseFragments.length && i == targetFragments.length) {
// Eg) base: /java/com/google
// target: /java/com/google
// result: . <-- . is better than "" since "" + "/path" = "/path"
return ".";
} else if (i == baseFragments.length) {
// Eg) base: /java/com/google
// target: /java/com/google/c/ui
// result: c/ui
return Joiner.on("/").join(
Lists.newArrayList(
Arrays.asList(targetFragments).listIterator(i)));
} else if (i == targetFragments.length) {
// Eg) base: /java/com/google/c/ui
// target: /java/com/google
// result: ../..
return Strings.repeat("../", baseFragments.length - i - 1) + "..";
}
} while (baseFragments[i].equals(targetFragments[i]));
// Eg) base: /java/com/google/c
// target: /java/com/google/common/base
// result: ../common/base
return Strings.repeat("../", baseFragments.length - i) +
Joiner.on("/").join(
Lists.newArrayList(Arrays.asList(targetFragments).listIterator(i)));
} } | public class class_name {
public static String makeRelative(String basePath, String targetPath) {
// Ensure the paths are both absolute or both relative.
if (isAbsolute(basePath) !=
isAbsolute(targetPath)) {
throw new IllegalArgumentException(
"Paths must both be relative or both absolute.\n" +
" basePath: " + basePath + "\n" +
" targetPath: " + targetPath);
}
basePath = collapseDots(basePath);
targetPath = collapseDots(targetPath);
String[] baseFragments = basePath.split("/");
String[] targetFragments = targetPath.split("/");
int i = -1;
do {
i += 1;
if (i == baseFragments.length && i == targetFragments.length) {
// Eg) base: /java/com/google
// target: /java/com/google
// result: . <-- . is better than "" since "" + "/path" = "/path"
return "."; // depends on control dependency: [if], data = [none]
} else if (i == baseFragments.length) {
// Eg) base: /java/com/google
// target: /java/com/google/c/ui
// result: c/ui
return Joiner.on("/").join(
Lists.newArrayList(
Arrays.asList(targetFragments).listIterator(i))); // depends on control dependency: [if], data = [none]
} else if (i == targetFragments.length) {
// Eg) base: /java/com/google/c/ui
// target: /java/com/google
// result: ../..
return Strings.repeat("../", baseFragments.length - i - 1) + ".."; // depends on control dependency: [if], data = [none]
}
} while (baseFragments[i].equals(targetFragments[i]));
// Eg) base: /java/com/google/c
// target: /java/com/google/common/base
// result: ../common/base
return Strings.repeat("../", baseFragments.length - i) +
Joiner.on("/").join(
Lists.newArrayList(Arrays.asList(targetFragments).listIterator(i)));
} } |
public class class_name {
public synchronized void invalidate(boolean appInvoked) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[INVALIDATE], appInvoked);
}
getSwappableListeners(BackedSession.HTTP_SESSION_BINDING_LISTENER);
if (appInvoked && (!invalInProgress) && isValid())
_storeCallback.sessionCacheDiscard(this);
super.invalidate();
//The session will be invalid, but do we need to worry about these in case we are already processing this session somewhere else?
if (this.appDataChanges != null)
this.appDataChanges.clear();
if (this.appDataRemovals != null)
this.appDataRemovals.clear();
this.update = null;
this.userWriteHit = false;
this.maxInactWriteHit = false;
this.listenCntHit = false;
setSwappableData(null);
this.mNonswappableData = null;
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[INVALIDATE]);
}
} } | public class class_name {
public synchronized void invalidate(boolean appInvoked) {
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[INVALIDATE], appInvoked); // depends on control dependency: [if], data = [none]
}
getSwappableListeners(BackedSession.HTTP_SESSION_BINDING_LISTENER);
if (appInvoked && (!invalInProgress) && isValid())
_storeCallback.sessionCacheDiscard(this);
super.invalidate();
//The session will be invalid, but do we need to worry about these in case we are already processing this session somewhere else?
if (this.appDataChanges != null)
this.appDataChanges.clear();
if (this.appDataRemovals != null)
this.appDataRemovals.clear();
this.update = null;
this.userWriteHit = false;
this.maxInactWriteHit = false;
this.listenCntHit = false;
setSwappableData(null);
this.mNonswappableData = null;
if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
LoggingUtil.SESSION_LOGGER_WAS.exiting(methodClassName, methodNames[INVALIDATE]); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int getColor(Point p1, Point p2) {
float d = distance(p1, p2);
float dx = (p2.getX() - p1.getX()) / d;
float dy = (p2.getY() - p1.getY()) / d;
int error = 0;
float px = p1.getX();
float py = p1.getY();
boolean colorModel = image.get(p1.getX(), p1.getY());
int iMax = (int) Math.ceil(d);
for (int i = 0; i < iMax; i++) {
px += dx;
py += dy;
if (image.get(MathUtils.round(px), MathUtils.round(py)) != colorModel) {
error++;
}
}
float errRatio = error / d;
if (errRatio > 0.1f && errRatio < 0.9f) {
return 0;
}
return (errRatio <= 0.1f) == colorModel ? 1 : -1;
} } | public class class_name {
private int getColor(Point p1, Point p2) {
float d = distance(p1, p2);
float dx = (p2.getX() - p1.getX()) / d;
float dy = (p2.getY() - p1.getY()) / d;
int error = 0;
float px = p1.getX();
float py = p1.getY();
boolean colorModel = image.get(p1.getX(), p1.getY());
int iMax = (int) Math.ceil(d);
for (int i = 0; i < iMax; i++) {
px += dx; // depends on control dependency: [for], data = [none]
py += dy; // depends on control dependency: [for], data = [none]
if (image.get(MathUtils.round(px), MathUtils.round(py)) != colorModel) {
error++; // depends on control dependency: [if], data = [none]
}
}
float errRatio = error / d;
if (errRatio > 0.1f && errRatio < 0.9f) {
return 0; // depends on control dependency: [if], data = [none]
}
return (errRatio <= 0.1f) == colorModel ? 1 : -1;
} } |
public class class_name {
public static boolean matches(Matcher<?> matcher, Object item, Description mismatch) {
if (mismatch instanceof Description.NullDescription) {
return matcher.matches(item);
}
if (matcher instanceof QuickDiagnosingMatcher) {
return ((QuickDiagnosingMatcher<?>) matcher).matches(item, mismatch);
} else if (matcher instanceof DiagnosingMatcher) {
return DiagnosingHack.matches(matcher, item, mismatch);
} else {
return simpleMatch(matcher, item, mismatch);
}
} } | public class class_name {
public static boolean matches(Matcher<?> matcher, Object item, Description mismatch) {
if (mismatch instanceof Description.NullDescription) {
return matcher.matches(item);
// depends on control dependency: [if], data = [none]
}
if (matcher instanceof QuickDiagnosingMatcher) {
return ((QuickDiagnosingMatcher<?>) matcher).matches(item, mismatch);
// depends on control dependency: [if], data = [none]
} else if (matcher instanceof DiagnosingMatcher) {
return DiagnosingHack.matches(matcher, item, mismatch);
// depends on control dependency: [if], data = [none]
} else {
return simpleMatch(matcher, item, mismatch);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void append( int bits , int numberOfBits , boolean swapOrder ) {
if( numberOfBits > 32 )
throw new IllegalArgumentException("Number of bits exceeds the size of bits");
int indexTail = size;
growArray(numberOfBits,true);
if( swapOrder ) {
for (int i = 0; i < numberOfBits; i++) {
set( indexTail + i , ( bits >> i ) & 1 );
}
} else {
for (int i = 0; i < numberOfBits; i++) {
set( indexTail + numberOfBits-i-1 , ( bits >> i ) & 1 );
}
}
} } | public class class_name {
public void append( int bits , int numberOfBits , boolean swapOrder ) {
if( numberOfBits > 32 )
throw new IllegalArgumentException("Number of bits exceeds the size of bits");
int indexTail = size;
growArray(numberOfBits,true);
if( swapOrder ) {
for (int i = 0; i < numberOfBits; i++) {
set( indexTail + i , ( bits >> i ) & 1 ); // depends on control dependency: [for], data = [i]
}
} else {
for (int i = 0; i < numberOfBits; i++) {
set( indexTail + numberOfBits-i-1 , ( bits >> i ) & 1 ); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
@Nonnull
public ConsumerRecords<byte[], byte[]> pollNext() throws Exception {
synchronized (lock) {
while (next == null && error == null) {
lock.wait();
}
ConsumerRecords<byte[], byte[]> n = next;
if (n != null) {
next = null;
lock.notifyAll();
return n;
}
else {
ExceptionUtils.rethrowException(error, error.getMessage());
// this statement cannot be reached since the above method always throws an exception
// this is only here to silence the compiler and any warnings
return ConsumerRecords.empty();
}
}
} } | public class class_name {
@Nonnull
public ConsumerRecords<byte[], byte[]> pollNext() throws Exception {
synchronized (lock) {
while (next == null && error == null) {
lock.wait(); // depends on control dependency: [while], data = [none]
}
ConsumerRecords<byte[], byte[]> n = next;
if (n != null) {
next = null; // depends on control dependency: [if], data = [none]
lock.notifyAll(); // depends on control dependency: [if], data = [none]
return n; // depends on control dependency: [if], data = [none]
}
else {
ExceptionUtils.rethrowException(error, error.getMessage()); // depends on control dependency: [if], data = [none]
// this statement cannot be reached since the above method always throws an exception
// this is only here to silence the compiler and any warnings
return ConsumerRecords.empty(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
protected void visitHtmlCloseTagNode(HtmlCloseTagNode node) {
// This case occurs in the case where we encounter the end of a keyed element. If the open tag
// mapped to this close tag contains a key node, pop the keyCounterStack to return
// to the state before entering the keyed node.
if (node.getTaggedPairs().size() == 1) {
HtmlOpenTagNode openTag = (HtmlOpenTagNode) node.getTaggedPairs().get(0);
if (openTag.getKeyNode() != null) {
keyCounterStack.pop();
getJsCodeBuilder().append(INCREMENTAL_DOM_POP_MANUAL_KEY.call());
}
}
if (!node.getTagName().isDefinitelyVoid()) {
emitClose(getTagNameCodeChunk(node.getTagName()));
}
} } | public class class_name {
@Override
protected void visitHtmlCloseTagNode(HtmlCloseTagNode node) {
// This case occurs in the case where we encounter the end of a keyed element. If the open tag
// mapped to this close tag contains a key node, pop the keyCounterStack to return
// to the state before entering the keyed node.
if (node.getTaggedPairs().size() == 1) {
HtmlOpenTagNode openTag = (HtmlOpenTagNode) node.getTaggedPairs().get(0);
if (openTag.getKeyNode() != null) {
keyCounterStack.pop(); // depends on control dependency: [if], data = [none]
getJsCodeBuilder().append(INCREMENTAL_DOM_POP_MANUAL_KEY.call()); // depends on control dependency: [if], data = [none]
}
}
if (!node.getTagName().isDefinitelyVoid()) {
emitClose(getTagNameCodeChunk(node.getTagName())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void sendStatus(Status status) {
if (connection != null) {
final boolean andReturn = !status.getCode().equals(StatusCodes.NS_DATA_START);
final Invoke event = new Invoke();
if (andReturn) {
final PendingCall call = new PendingCall(null, CALL_ON_STATUS, new Object[] { status });
if (status.getCode().equals(StatusCodes.NS_PLAY_START)) {
IScope scope = connection.getScope();
if (scope.getContext().getApplicationContext().containsBean(IRtmpSampleAccess.BEAN_NAME)) {
IRtmpSampleAccess sampleAccess = (IRtmpSampleAccess) scope.getContext().getApplicationContext().getBean(IRtmpSampleAccess.BEAN_NAME);
boolean videoAccess = sampleAccess.isVideoAllowed(scope);
boolean audioAccess = sampleAccess.isAudioAllowed(scope);
if (videoAccess || audioAccess) {
final Call call2 = new Call(null, "|RtmpSampleAccess", null);
Notify notify = new Notify();
notify.setCall(call2);
notify.setData(IoBuffer.wrap(new byte[] { 0x01, (byte) (audioAccess ? 0x01 : 0x00), 0x01, (byte) (videoAccess ? 0x01 : 0x00) }));
write(notify, connection.getStreamIdForChannelId(id));
}
}
}
event.setCall(call);
} else {
final Call call = new Call(null, CALL_ON_STATUS, new Object[] { status });
event.setCall(call);
}
// send directly to the corresponding stream as for some status codes, no stream has been created and thus "getStreamByChannelId" will fail
write(event, connection.getStreamIdForChannelId(id));
}
} } | public class class_name {
public void sendStatus(Status status) {
if (connection != null) {
final boolean andReturn = !status.getCode().equals(StatusCodes.NS_DATA_START);
final Invoke event = new Invoke();
if (andReturn) {
final PendingCall call = new PendingCall(null, CALL_ON_STATUS, new Object[] { status });
if (status.getCode().equals(StatusCodes.NS_PLAY_START)) {
IScope scope = connection.getScope();
if (scope.getContext().getApplicationContext().containsBean(IRtmpSampleAccess.BEAN_NAME)) {
IRtmpSampleAccess sampleAccess = (IRtmpSampleAccess) scope.getContext().getApplicationContext().getBean(IRtmpSampleAccess.BEAN_NAME);
boolean videoAccess = sampleAccess.isVideoAllowed(scope);
boolean audioAccess = sampleAccess.isAudioAllowed(scope);
if (videoAccess || audioAccess) {
final Call call2 = new Call(null, "|RtmpSampleAccess", null);
Notify notify = new Notify();
notify.setCall(call2);
// depends on control dependency: [if], data = [none]
notify.setData(IoBuffer.wrap(new byte[] { 0x01, (byte) (audioAccess ? 0x01 : 0x00), 0x01, (byte) (videoAccess ? 0x01 : 0x00) }));
// depends on control dependency: [if], data = [(videoAccess]
write(notify, connection.getStreamIdForChannelId(id));
// depends on control dependency: [if], data = [none]
}
}
}
event.setCall(call);
// depends on control dependency: [if], data = [none]
} else {
final Call call = new Call(null, CALL_ON_STATUS, new Object[] { status });
event.setCall(call);
// depends on control dependency: [if], data = [none]
}
// send directly to the corresponding stream as for some status codes, no stream has been created and thus "getStreamByChannelId" will fail
write(event, connection.getStreamIdForChannelId(id));
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void actionEdit(HttpServletRequest request) throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
// save the changes only if resource is properly locked
if (isEditable()) {
performEditOperation(request);
}
} catch (Throwable e) {
// Cms error defining property, show error dialog
includeErrorpage(this, e);
}
} } | public class class_name {
@Override
public void actionEdit(HttpServletRequest request) throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
try {
// save the changes only if resource is properly locked
if (isEditable()) {
performEditOperation(request); // depends on control dependency: [if], data = [none]
}
} catch (Throwable e) {
// Cms error defining property, show error dialog
includeErrorpage(this, e);
}
} } |
public class class_name {
public void stop() {
try {
if (server != null) {
server.stop();
server.join();
}
} catch (Exception e) {
LOG.warn("Got exception shutting down proxy", e);
}
} } | public class class_name {
public void stop() {
try {
if (server != null) {
server.stop(); // depends on control dependency: [if], data = [none]
server.join(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.warn("Got exception shutting down proxy", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Trades adaptTrades(CexIOTrade[] cexioTrades, CurrencyPair currencyPair) {
List<Trade> tradesList = new ArrayList<>();
long lastTradeId = 0;
for (CexIOTrade trade : cexioTrades) {
long tradeId = trade.getTid();
if (tradeId > lastTradeId) {
lastTradeId = tradeId;
}
// Date is reversed order. Insert at index 0 instead of appending
tradesList.add(0, adaptTrade(trade, currencyPair));
}
return new Trades(tradesList, lastTradeId, TradeSortType.SortByID);
} } | public class class_name {
public static Trades adaptTrades(CexIOTrade[] cexioTrades, CurrencyPair currencyPair) {
List<Trade> tradesList = new ArrayList<>();
long lastTradeId = 0;
for (CexIOTrade trade : cexioTrades) {
long tradeId = trade.getTid();
if (tradeId > lastTradeId) {
lastTradeId = tradeId; // depends on control dependency: [if], data = [none]
}
// Date is reversed order. Insert at index 0 instead of appending
tradesList.add(0, adaptTrade(trade, currencyPair)); // depends on control dependency: [for], data = [trade]
}
return new Trades(tradesList, lastTradeId, TradeSortType.SortByID);
} } |
public class class_name {
public BinaryString reverse() {
ensureMaterialized();
if (inFirstSegment()) {
byte[] result = new byte[this.sizeInBytes];
// position in byte
int byteIdx = 0;
while (byteIdx < sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(byteIdx));
segments[0].get(
offset + byteIdx,
result,
result.length - byteIdx - charBytes,
charBytes);
byteIdx += charBytes;
}
return BinaryString.fromBytes(result);
} else {
return reverseSlow();
}
} } | public class class_name {
public BinaryString reverse() {
ensureMaterialized();
if (inFirstSegment()) {
byte[] result = new byte[this.sizeInBytes];
// position in byte
int byteIdx = 0;
while (byteIdx < sizeInBytes) {
int charBytes = numBytesForFirstByte(getByteOneSegment(byteIdx));
segments[0].get(
offset + byteIdx,
result,
result.length - byteIdx - charBytes,
charBytes); // depends on control dependency: [while], data = [none]
byteIdx += charBytes; // depends on control dependency: [while], data = [none]
}
return BinaryString.fromBytes(result); // depends on control dependency: [if], data = [none]
} else {
return reverseSlow(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) {
if (castExpression instanceof SarlCastedExpression) {
final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature();
if (delegate != null) {
return _signature(delegate, typeAtEnd);
}
}
return MessageFormat.format(Messages.SARLHoverSignatureProvider_0,
getTypeName(castExpression.getType()));
} } | public class class_name {
protected String _signature(XCastedExpression castExpression, boolean typeAtEnd) {
if (castExpression instanceof SarlCastedExpression) {
final JvmOperation delegate = ((SarlCastedExpression) castExpression).getFeature();
if (delegate != null) {
return _signature(delegate, typeAtEnd); // depends on control dependency: [if], data = [(delegate]
}
}
return MessageFormat.format(Messages.SARLHoverSignatureProvider_0,
getTypeName(castExpression.getType()));
} } |
public class class_name {
public ResourceEnvRefType<ApplicationDescriptor> getOrCreateResourceEnvRef()
{
List<Node> nodeList = model.get("resource-env-ref");
if (nodeList != null && nodeList.size() > 0)
{
return new ResourceEnvRefTypeImpl<ApplicationDescriptor>(this, "resource-env-ref", model, nodeList.get(0));
}
return createResourceEnvRef();
} } | public class class_name {
public ResourceEnvRefType<ApplicationDescriptor> getOrCreateResourceEnvRef()
{
List<Node> nodeList = model.get("resource-env-ref");
if (nodeList != null && nodeList.size() > 0)
{
return new ResourceEnvRefTypeImpl<ApplicationDescriptor>(this, "resource-env-ref", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createResourceEnvRef();
} } |
public class class_name {
@Override
public void setSortDirection(final SortDirection _sortDirection)
{
super.setSortDirection(_sortDirection);
for (final UIStructurBrowser child : this.children) {
child.setSortDirectionInternal(_sortDirection);
}
} } | public class class_name {
@Override
public void setSortDirection(final SortDirection _sortDirection)
{
super.setSortDirection(_sortDirection);
for (final UIStructurBrowser child : this.children) {
child.setSortDirectionInternal(_sortDirection); // depends on control dependency: [for], data = [child]
}
} } |
public class class_name {
public void setThings(java.util.Collection<ThingDocument> things) {
if (things == null) {
this.things = null;
return;
}
this.things = new java.util.ArrayList<ThingDocument>(things);
} } | public class class_name {
public void setThings(java.util.Collection<ThingDocument> things) {
if (things == null) {
this.things = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.things = new java.util.ArrayList<ThingDocument>(things);
} } |
public class class_name {
public static long syncCurrentTime() throws Exception {
// The time protocol sets the epoch at 1900,
// the java Date class at 1970. This number
// converts between them.
long differenceBetweenEpochs = 2208988800L;
// If you'd rather not use the magic number uncomment
// the following section which calculates it directly.
/*
* TimeZone gmt = TimeZone.getTimeZone("GMT"); Calendar epoch1900 =
* Calendar.getInstance(gmt); epoch1900.set(1900, 01, 01, 00, 00, 00);
* long epoch1900ms = epoch1900.getTime().getTime(); Calendar epoch1970
* = Calendar.getInstance(gmt); epoch1970.set(1970, 01, 01, 00, 00, 00);
* long epoch1970ms = epoch1970.getTime().getTime();
*
* long differenceInMS = epoch1970ms - epoch1900ms; long
* differenceBetweenEpochs = differenceInMS/1000;
*/
InputStream raw = null;
Socket theSocket = null;
try {
theSocket = new Socket(DEFAULT_HOST, DEFAULT_PORT);
raw = theSocket.getInputStream();
long secondsSince1900 = 0;
for (int i = 0; i < 4; i++) {
secondsSince1900 = (secondsSince1900 << 8) | raw.read();
}
long secondsSince1970 = secondsSince1900 - differenceBetweenEpochs;
return secondsSince1970 * 1000;
} finally {
if (raw != null) raw.close();
if (theSocket != null) theSocket.close();
}
} } | public class class_name {
public static long syncCurrentTime() throws Exception {
// The time protocol sets the epoch at 1900,
// the java Date class at 1970. This number
// converts between them.
long differenceBetweenEpochs = 2208988800L;
// If you'd rather not use the magic number uncomment
// the following section which calculates it directly.
/*
* TimeZone gmt = TimeZone.getTimeZone("GMT"); Calendar epoch1900 =
* Calendar.getInstance(gmt); epoch1900.set(1900, 01, 01, 00, 00, 00);
* long epoch1900ms = epoch1900.getTime().getTime(); Calendar epoch1970
* = Calendar.getInstance(gmt); epoch1970.set(1970, 01, 01, 00, 00, 00);
* long epoch1970ms = epoch1970.getTime().getTime();
*
* long differenceInMS = epoch1970ms - epoch1900ms; long
* differenceBetweenEpochs = differenceInMS/1000;
*/
InputStream raw = null;
Socket theSocket = null;
try {
theSocket = new Socket(DEFAULT_HOST, DEFAULT_PORT);
raw = theSocket.getInputStream();
long secondsSince1900 = 0;
for (int i = 0; i < 4; i++) {
secondsSince1900 = (secondsSince1900 << 8) | raw.read(); // depends on control dependency: [for], data = [none]
}
long secondsSince1970 = secondsSince1900 - differenceBetweenEpochs;
return secondsSince1970 * 1000;
} finally {
if (raw != null) raw.close();
if (theSocket != null) theSocket.close();
}
} } |
public class class_name {
public static <K, V> ImmutableListMultimap<K, V> index(
Iterator<V> values, Function<? super V, K> keyFunction) {
checkNotNull(keyFunction);
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
while (values.hasNext()) {
V value = values.next();
checkNotNull(value, values);
builder.put(keyFunction.apply(value), value);
}
return builder.build();
} } | public class class_name {
public static <K, V> ImmutableListMultimap<K, V> index(
Iterator<V> values, Function<? super V, K> keyFunction) {
checkNotNull(keyFunction);
ImmutableListMultimap.Builder<K, V> builder = ImmutableListMultimap.builder();
while (values.hasNext()) {
V value = values.next();
checkNotNull(value, values); // depends on control dependency: [while], data = [none]
builder.put(keyFunction.apply(value), value); // depends on control dependency: [while], data = [none]
}
return builder.build();
} } |
public class class_name {
public int hash(String symbol) {
int code = 0;
int length = symbol.length();
for (int i = 0; i < length; i++) {
code = code * 37 + symbol.charAt(i);
}
return code & 0x7FFFFFF;
} } | public class class_name {
public int hash(String symbol) {
int code = 0;
int length = symbol.length();
for (int i = 0; i < length; i++) {
code = code * 37 + symbol.charAt(i); // depends on control dependency: [for], data = [i]
}
return code & 0x7FFFFFF;
} } |
public class class_name {
@SuppressWarnings("unchecked")
void dispose()
{
log.debug("dispose IndexMerger");
// get mutex for index replacements
try
{
indexReplacement.acquire();
}
catch (InterruptedException e)
{
log.warn("Interrupted while acquiring index replacement sync: " + e);
// try to stop IndexMerger without the sync
}
// clear task queue
mergeTasks.clear();
// send quit
mergeTasks.add(QUIT);
log.debug("quit sent");
try
{
// give the merger thread some time to quit,
// it is possible that the merger is busy working on a large index.
// if that is the case we will just ignore it and the daemon will
// die without being able to finish the merge.
// at this point it is not possible anymore to replace indexes
// on the MultiIndex because we hold the indexReplacement Sync.
this.join(500);
if (isAlive())
{
log.info("Unable to stop IndexMerger. Daemon is busy.");
}
else
{
log.debug("IndexMerger thread stopped");
}
log.debug("merge queue size: " + mergeTasks.size());
}
catch (InterruptedException e)
{
log.warn("Interrupted while waiting for IndexMerger thread to terminate.");
}
} } | public class class_name {
@SuppressWarnings("unchecked")
void dispose()
{
log.debug("dispose IndexMerger");
// get mutex for index replacements
try
{
indexReplacement.acquire(); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
log.warn("Interrupted while acquiring index replacement sync: " + e);
// try to stop IndexMerger without the sync
} // depends on control dependency: [catch], data = [none]
// clear task queue
mergeTasks.clear();
// send quit
mergeTasks.add(QUIT);
log.debug("quit sent");
try
{
// give the merger thread some time to quit,
// it is possible that the merger is busy working on a large index.
// if that is the case we will just ignore it and the daemon will
// die without being able to finish the merge.
// at this point it is not possible anymore to replace indexes
// on the MultiIndex because we hold the indexReplacement Sync.
this.join(500); // depends on control dependency: [try], data = [none]
if (isAlive())
{
log.info("Unable to stop IndexMerger. Daemon is busy."); // depends on control dependency: [if], data = [none]
}
else
{
log.debug("IndexMerger thread stopped"); // depends on control dependency: [if], data = [none]
}
log.debug("merge queue size: " + mergeTasks.size()); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
log.warn("Interrupted while waiting for IndexMerger thread to terminate.");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String fetchPath(){
StringBuffer sb = new StringBuffer();
boolean first = true;
for(String path : paths){
if(!first){
sb.append(".");
}
sb.append(path);
first = false;
}
return sb.toString();
} } | public class class_name {
private String fetchPath(){
StringBuffer sb = new StringBuffer();
boolean first = true;
for(String path : paths){
if(!first){
sb.append("."); // depends on control dependency: [if], data = [none]
}
sb.append(path); // depends on control dependency: [for], data = [path]
first = false; // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
public Bbox applyMargins(Bbox bounds) {
Bbox applied = (Bbox) bounds.clone();
Coordinate c = getUpperLeftCorner();
Double x = c.getX();
Double y = c.getY();
if (null != group && group instanceof MapAddon && group != this) {
Coordinate pc = ((MapAddon) group).getUpperLeftCorner();
x += pc.getX();
y += pc.getY();
}
applied.setX(x + applied.getX());
applied.setY(y + applied.getY());
return applied;
} } | public class class_name {
public Bbox applyMargins(Bbox bounds) {
Bbox applied = (Bbox) bounds.clone();
Coordinate c = getUpperLeftCorner();
Double x = c.getX();
Double y = c.getY();
if (null != group && group instanceof MapAddon && group != this) {
Coordinate pc = ((MapAddon) group).getUpperLeftCorner();
x += pc.getX(); // depends on control dependency: [if], data = [none]
y += pc.getY(); // depends on control dependency: [if], data = [none]
}
applied.setX(x + applied.getX());
applied.setY(y + applied.getY());
return applied;
} } |
public class class_name {
public EEnum getIfcBenchmarkEnum() {
if (ifcBenchmarkEnumEEnum == null) {
ifcBenchmarkEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(785);
}
return ifcBenchmarkEnumEEnum;
} } | public class class_name {
public EEnum getIfcBenchmarkEnum() {
if (ifcBenchmarkEnumEEnum == null) {
ifcBenchmarkEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(785);
// depends on control dependency: [if], data = [none]
}
return ifcBenchmarkEnumEEnum;
} } |
public class class_name {
public @NotNull ByteAssert isGreaterThan(byte other) {
// TODO check for NPE
if (actual > other) {
return this;
}
failIfCustomMessageIsSet();
throw failure(unexpectedLessThanOrEqualTo(actual, other));
} } | public class class_name {
public @NotNull ByteAssert isGreaterThan(byte other) {
// TODO check for NPE
if (actual > other) {
return this; // depends on control dependency: [if], data = [none]
}
failIfCustomMessageIsSet();
throw failure(unexpectedLessThanOrEqualTo(actual, other));
} } |
public class class_name {
public static void addLayerToMap(@NonNull MapboxMap mapboxMap, @NonNull Layer layer,
@Nullable String idBelowLayer) {
if (layer != null && mapboxMap.getStyle().getLayer(layer.getId()) != null) {
return;
}
if (idBelowLayer == null) {
mapboxMap.getStyle().addLayer(layer);
} else {
mapboxMap.getStyle().addLayerBelow(layer, idBelowLayer);
}
} } | public class class_name {
public static void addLayerToMap(@NonNull MapboxMap mapboxMap, @NonNull Layer layer,
@Nullable String idBelowLayer) {
if (layer != null && mapboxMap.getStyle().getLayer(layer.getId()) != null) {
return; // depends on control dependency: [if], data = [none]
}
if (idBelowLayer == null) {
mapboxMap.getStyle().addLayer(layer); // depends on control dependency: [if], data = [none]
} else {
mapboxMap.getStyle().addLayerBelow(layer, idBelowLayer); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setFleetCapacity(java.util.Collection<FleetCapacity> fleetCapacity) {
if (fleetCapacity == null) {
this.fleetCapacity = null;
return;
}
this.fleetCapacity = new java.util.ArrayList<FleetCapacity>(fleetCapacity);
} } | public class class_name {
public void setFleetCapacity(java.util.Collection<FleetCapacity> fleetCapacity) {
if (fleetCapacity == null) {
this.fleetCapacity = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.fleetCapacity = new java.util.ArrayList<FleetCapacity>(fleetCapacity);
} } |
public class class_name {
protected void handleTCPSrvReg(SrvReg srvReg, Socket socket)
{
try
{
boolean update = srvReg.isUpdating();
ServiceInfo givenService = ServiceInfo.from(srvReg);
ServiceInfoCache.Result<ServiceInfo> result = cacheService(givenService, update);
forwardRegistration(givenService, result.getPrevious(), result.getCurrent(), update);
tcpSrvAck.perform(socket, srvReg, SLPError.NO_ERROR);
}
catch (ServiceLocationException x)
{
tcpSrvAck.perform(socket, srvReg, x.getSLPError());
}
} } | public class class_name {
protected void handleTCPSrvReg(SrvReg srvReg, Socket socket)
{
try
{
boolean update = srvReg.isUpdating();
ServiceInfo givenService = ServiceInfo.from(srvReg);
ServiceInfoCache.Result<ServiceInfo> result = cacheService(givenService, update);
forwardRegistration(givenService, result.getPrevious(), result.getCurrent(), update); // depends on control dependency: [try], data = [none]
tcpSrvAck.perform(socket, srvReg, SLPError.NO_ERROR); // depends on control dependency: [try], data = [none]
}
catch (ServiceLocationException x)
{
tcpSrvAck.perform(socket, srvReg, x.getSLPError());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void parseInputAttributes(
final List<CellFormAttributes> clist,
final String controlAttrs) {
// only one type control allowed for one cell.
clist.clear();
if (controlAttrs != null) {
String[] cattrs = controlAttrs.split(
TieConstants.SPLIT_SPACE_SEPERATE_ATTRS_REGX, -1);
for (String cattr : cattrs) {
String[] details = splitByEualSign(cattr);
if (details.length > 1) {
CellFormAttributes attr = new CellFormAttributes();
attr.setType(details[0].trim());
attr.setValue(details[1].replaceAll("\"", ""));
clist.add(attr);
}
}
}
} } | public class class_name {
public static void parseInputAttributes(
final List<CellFormAttributes> clist,
final String controlAttrs) {
// only one type control allowed for one cell.
clist.clear();
if (controlAttrs != null) {
String[] cattrs = controlAttrs.split(
TieConstants.SPLIT_SPACE_SEPERATE_ATTRS_REGX, -1);
for (String cattr : cattrs) {
String[] details = splitByEualSign(cattr);
if (details.length > 1) {
CellFormAttributes attr = new CellFormAttributes();
attr.setType(details[0].trim());
// depends on control dependency: [if], data = [none]
attr.setValue(details[1].replaceAll("\"", ""));
// depends on control dependency: [if], data = [none]
clist.add(attr);
// depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public double nextGaussian() {
// See Knuth, ACP, Section 3.4.1 Algorithm C.
if (haveNextNextGaussian) {
haveNextNextGaussian = false;
return nextNextGaussian;
} else {
double v1, v2, s;
do {
v1 = 2 * nextDouble() - 1; // between -1 and 1
v2 = 2 * nextDouble() - 1; // between -1 and 1
s = v1 * v1 + v2 * v2;
} while (s >= 1 || s == 0);
double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s) / s);
nextNextGaussian = v2 * multiplier;
haveNextNextGaussian = true;
return v1 * multiplier;
}
} } | public class class_name {
public double nextGaussian() {
// See Knuth, ACP, Section 3.4.1 Algorithm C.
if (haveNextNextGaussian) {
haveNextNextGaussian = false; // depends on control dependency: [if], data = [none]
return nextNextGaussian; // depends on control dependency: [if], data = [none]
} else {
double v1, v2, s;
do {
v1 = 2 * nextDouble() - 1; // between -1 and 1
v2 = 2 * nextDouble() - 1; // between -1 and 1
s = v1 * v1 + v2 * v2;
} while (s >= 1 || s == 0);
double multiplier = StrictMath.sqrt(-2 * StrictMath.log(s) / s);
nextNextGaussian = v2 * multiplier; // depends on control dependency: [if], data = [none]
haveNextNextGaussian = true; // depends on control dependency: [if], data = [none]
return v1 * multiplier; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public BitSet getMatchingParameters(BitSet nullArgSet) {
BitSet result = new BitSet();
for (int i = 0; i < 32; ++i) {
result.set(i, nullArgSet.get(i) && hasProperty(i));
}
return result;
} } | public class class_name {
public BitSet getMatchingParameters(BitSet nullArgSet) {
BitSet result = new BitSet();
for (int i = 0; i < 32; ++i) {
result.set(i, nullArgSet.get(i) && hasProperty(i)); // depends on control dependency: [for], data = [i]
}
return result;
} } |
public class class_name {
public void marshall(ListTerminologiesRequest listTerminologiesRequest, ProtocolMarshaller protocolMarshaller) {
if (listTerminologiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTerminologiesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listTerminologiesRequest.getMaxResults(), MAXRESULTS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListTerminologiesRequest listTerminologiesRequest, ProtocolMarshaller protocolMarshaller) {
if (listTerminologiesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTerminologiesRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTerminologiesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private byte[] getMMapBytes(long offset)
throws IOException {
//Read the first 4 bytes to get the size of the data
ByteBuffer buf = getDataBuffer(offset);
int maxLen = (int) Math.min(5, dataSize - offset);
int size;
if (buf.remaining() >= maxLen) {
//Continuous read
int pos = buf.position();
size = LongPacker.unpackInt(buf);
// Used in case of data is spread over multiple buffers
offset += buf.position() - pos;
} else {
//The size of the data is spread over multiple buffers
int len = maxLen;
int off = 0;
sizeBuffer.reset();
while (len > 0) {
buf = getDataBuffer(offset + off);
int count = Math.min(len, buf.remaining());
buf.get(sizeBuffer.getBuf(), off, count);
off += count;
len -= count;
}
size = LongPacker.unpackInt(sizeBuffer);
offset += sizeBuffer.getPos();
buf = getDataBuffer(offset);
}
//Create output bytes
byte[] res = new byte[size];
//Check if the data is one buffer
if (buf.remaining() >= size) {
//Continuous read
buf.get(res, 0, size);
} else {
int len = size;
int off = 0;
while (len > 0) {
buf = getDataBuffer(offset);
int count = Math.min(len, buf.remaining());
buf.get(res, off, count);
offset += count;
off += count;
len -= count;
}
}
return res;
} } | public class class_name {
private byte[] getMMapBytes(long offset)
throws IOException {
//Read the first 4 bytes to get the size of the data
ByteBuffer buf = getDataBuffer(offset);
int maxLen = (int) Math.min(5, dataSize - offset);
int size;
if (buf.remaining() >= maxLen) {
//Continuous read
int pos = buf.position();
size = LongPacker.unpackInt(buf);
// Used in case of data is spread over multiple buffers
offset += buf.position() - pos;
} else {
//The size of the data is spread over multiple buffers
int len = maxLen;
int off = 0;
sizeBuffer.reset();
while (len > 0) {
buf = getDataBuffer(offset + off); // depends on control dependency: [while], data = [none]
int count = Math.min(len, buf.remaining());
buf.get(sizeBuffer.getBuf(), off, count); // depends on control dependency: [while], data = [none]
off += count; // depends on control dependency: [while], data = [none]
len -= count; // depends on control dependency: [while], data = [none]
}
size = LongPacker.unpackInt(sizeBuffer);
offset += sizeBuffer.getPos();
buf = getDataBuffer(offset);
}
//Create output bytes
byte[] res = new byte[size];
//Check if the data is one buffer
if (buf.remaining() >= size) {
//Continuous read
buf.get(res, 0, size);
} else {
int len = size;
int off = 0;
while (len > 0) {
buf = getDataBuffer(offset); // depends on control dependency: [while], data = [none]
int count = Math.min(len, buf.remaining());
buf.get(res, off, count); // depends on control dependency: [while], data = [none]
offset += count; // depends on control dependency: [while], data = [none]
off += count; // depends on control dependency: [while], data = [none]
len -= count; // depends on control dependency: [while], data = [none]
}
}
return res;
} } |
public class class_name {
@GET
@Path("/{dataSourceName}/intervals/{interval}/serverview")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response getSegmentDataSourceSpecificInterval(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("interval") String interval,
@QueryParam("partial") final boolean partial
)
{
TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline(
new TableDataSource(dataSourceName)
);
final Interval theInterval = Intervals.of(interval.replace('_', '/'));
if (timeline == null) {
log.debug("No timeline found for datasource[%s]", dataSourceName);
return Response.ok(new ArrayList<ImmutableSegmentLoadInfo>()).build();
}
Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval);
FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable
.create(lookup).transformCat(
(TimelineObjectHolder<String, SegmentLoadInfo> input) ->
Iterables.transform(
input.getObject(),
(PartitionChunk<SegmentLoadInfo> chunk) ->
chunk.getObject().toImmutableSegmentLoadInfo()
)
);
return Response.ok(retval).build();
} } | public class class_name {
@GET
@Path("/{dataSourceName}/intervals/{interval}/serverview")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response getSegmentDataSourceSpecificInterval(
@PathParam("dataSourceName") String dataSourceName,
@PathParam("interval") String interval,
@QueryParam("partial") final boolean partial
)
{
TimelineLookup<String, SegmentLoadInfo> timeline = serverInventoryView.getTimeline(
new TableDataSource(dataSourceName)
);
final Interval theInterval = Intervals.of(interval.replace('_', '/'));
if (timeline == null) {
log.debug("No timeline found for datasource[%s]", dataSourceName); // depends on control dependency: [if], data = [none]
return Response.ok(new ArrayList<ImmutableSegmentLoadInfo>()).build(); // depends on control dependency: [if], data = [none]
}
Iterable<TimelineObjectHolder<String, SegmentLoadInfo>> lookup = timeline.lookupWithIncompletePartitions(theInterval);
FunctionalIterable<ImmutableSegmentLoadInfo> retval = FunctionalIterable
.create(lookup).transformCat(
(TimelineObjectHolder<String, SegmentLoadInfo> input) ->
Iterables.transform(
input.getObject(),
(PartitionChunk<SegmentLoadInfo> chunk) ->
chunk.getObject().toImmutableSegmentLoadInfo()
)
);
return Response.ok(retval).build();
} } |
public class class_name {
public void destroy() {
try {
super.destroy();
} finally {
try {
saveLastFetchedId(lastFetchedId);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
RocksDbUtils.closeRocksObjects(batchPutToQueue, batchTake, dbOptions);
try {
rocksDbWrapper.close();
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
} } | public class class_name {
public void destroy() {
try {
super.destroy(); // depends on control dependency: [try], data = [none]
} finally {
try {
saveLastFetchedId(lastFetchedId); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
RocksDbUtils.closeRocksObjects(batchPutToQueue, batchTake, dbOptions);
try {
rocksDbWrapper.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected static <P extends ParaObject> Map<String, AttributeValue> toRow(P so, Class<? extends Annotation> filter) {
HashMap<String, AttributeValue> row = new HashMap<>();
if (so == null) {
return row;
}
for (Map.Entry<String, Object> entry : ParaObjectUtils.getAnnotatedFields(so, filter).entrySet()) {
Object value = entry.getValue();
if (value != null && !StringUtils.isBlank(value.toString())) {
row.put(entry.getKey(), new AttributeValue(value.toString()));
}
}
if (so.getVersion() != null && so.getVersion() > 0) {
row.put(Config._VERSION, new AttributeValue().withN(so.getVersion().toString()));
} else {
row.remove(Config._VERSION);
}
return row;
} } | public class class_name {
protected static <P extends ParaObject> Map<String, AttributeValue> toRow(P so, Class<? extends Annotation> filter) {
HashMap<String, AttributeValue> row = new HashMap<>();
if (so == null) {
return row; // depends on control dependency: [if], data = [none]
}
for (Map.Entry<String, Object> entry : ParaObjectUtils.getAnnotatedFields(so, filter).entrySet()) {
Object value = entry.getValue();
if (value != null && !StringUtils.isBlank(value.toString())) {
row.put(entry.getKey(), new AttributeValue(value.toString())); // depends on control dependency: [if], data = [(value]
}
}
if (so.getVersion() != null && so.getVersion() > 0) {
row.put(Config._VERSION, new AttributeValue().withN(so.getVersion().toString())); // depends on control dependency: [if], data = [(so.getVersion()]
} else {
row.remove(Config._VERSION); // depends on control dependency: [if], data = [none]
}
return row;
} } |
public class class_name {
@Override
public Enumeration getEnumeration() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getEnumeration");
Enumeration vEnum = null;
// Synchronize here so that you can't create an enumeration while the
// browser is being closed.
synchronized (enums) {
// By the time we have synchronized on enums we have control of the
// state of the object.
if (state == CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Called getEnumeration on a closed Browser");
// d238447 FFDC Review. App error, no FFDC required.
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"BROWSER_CLOSED_CWSIA0142",
null,
tc
);
}
if (createdFirst) {
// If we haven't yet given the user the upfront one we created.
if (firstEnumeration != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Using the enumeration that was created by the constructor");
// Pass it ready to be returned.
vEnum = firstEnumeration;
// Stop us using it again.
firstEnumeration = null;
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Creating a new enumeration");
// Need to create a new one.
vEnum = instantiateBrowser();
}
}
else {
// We have not created the first one, so do it now. The call to this
// method will have come from the constructor so we don't need to
// return the Enumeration - just stash it away for later use.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Creating the first Enumeration (to check existence etc)");
firstEnumeration = instantiateBrowser();
createdFirst = true;
}
} // release the lock
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getEnumeration", vEnum);
return vEnum;
} } | public class class_name {
@Override
public Enumeration getEnumeration() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getEnumeration");
Enumeration vEnum = null;
// Synchronize here so that you can't create an enumeration while the
// browser is being closed.
synchronized (enums) {
// By the time we have synchronized on enums we have control of the
// state of the object.
if (state == CLOSED) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Called getEnumeration on a closed Browser");
// d238447 FFDC Review. App error, no FFDC required.
throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
"BROWSER_CLOSED_CWSIA0142",
null,
tc
);
}
if (createdFirst) {
// If we haven't yet given the user the upfront one we created.
if (firstEnumeration != null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Using the enumeration that was created by the constructor");
// Pass it ready to be returned.
vEnum = firstEnumeration; // depends on control dependency: [if], data = [none]
// Stop us using it again.
firstEnumeration = null; // depends on control dependency: [if], data = [none]
}
else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Creating a new enumeration");
// Need to create a new one.
vEnum = instantiateBrowser(); // depends on control dependency: [if], data = [none]
}
}
else {
// We have not created the first one, so do it now. The call to this
// method will have come from the constructor so we don't need to
// return the Enumeration - just stash it away for later use.
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(this, tc, "Creating the first Enumeration (to check existence etc)");
firstEnumeration = instantiateBrowser(); // depends on control dependency: [if], data = [none]
createdFirst = true; // depends on control dependency: [if], data = [none]
}
} // release the lock
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getEnumeration", vEnum);
return vEnum;
} } |
public class class_name {
@Override
public EClass getIfcStructuralLoadLinearForce() {
if (ifcStructuralLoadLinearForceEClass == null) {
ifcStructuralLoadLinearForceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(644);
}
return ifcStructuralLoadLinearForceEClass;
} } | public class class_name {
@Override
public EClass getIfcStructuralLoadLinearForce() {
if (ifcStructuralLoadLinearForceEClass == null) {
ifcStructuralLoadLinearForceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(644);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralLoadLinearForceEClass;
} } |
public class class_name {
@Override
public void connectionRecovered(IManagedConnectionEvent<C> event) {
// physical connection is already set free
if (!event.getManagedConnection().hasCoreConnection()) {
return;
}
IPhynixxConnection con = event.getManagedConnection()
.getCoreConnection();
if (con == null || !(con instanceof IXADataRecorderAware)) {
return;
}
IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
// Transaction is close and the logger is destroyed ...
IXADataRecorder xaDataRecorder = messageAwareConnection
.getXADataRecorder();
if (xaDataRecorder == null) {
return;
}
// it's my logger ....
// the logger has to be destroyed ...
else {
xaDataRecorder.destroy();
messageAwareConnection.setXADataRecorder(null);
}
} } | public class class_name {
@Override
public void connectionRecovered(IManagedConnectionEvent<C> event) {
// physical connection is already set free
if (!event.getManagedConnection().hasCoreConnection()) {
return; // depends on control dependency: [if], data = [none]
}
IPhynixxConnection con = event.getManagedConnection()
.getCoreConnection();
if (con == null || !(con instanceof IXADataRecorderAware)) {
return; // depends on control dependency: [if], data = [none]
}
IXADataRecorderAware messageAwareConnection = (IXADataRecorderAware) con;
// Transaction is close and the logger is destroyed ...
IXADataRecorder xaDataRecorder = messageAwareConnection
.getXADataRecorder();
if (xaDataRecorder == null) {
return; // depends on control dependency: [if], data = [none]
}
// it's my logger ....
// the logger has to be destroyed ...
else {
xaDataRecorder.destroy(); // depends on control dependency: [if], data = [none]
messageAwareConnection.setXADataRecorder(null); // depends on control dependency: [if], data = [null)]
}
} } |
public class class_name {
public SkewedInfo withSkewedColumnNames(String... skewedColumnNames) {
if (this.skewedColumnNames == null) {
setSkewedColumnNames(new java.util.ArrayList<String>(skewedColumnNames.length));
}
for (String ele : skewedColumnNames) {
this.skewedColumnNames.add(ele);
}
return this;
} } | public class class_name {
public SkewedInfo withSkewedColumnNames(String... skewedColumnNames) {
if (this.skewedColumnNames == null) {
setSkewedColumnNames(new java.util.ArrayList<String>(skewedColumnNames.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : skewedColumnNames) {
this.skewedColumnNames.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public double dotProduct(ConcatVector other) {
if (loadedNative) {
return dotProductNative(other);
} else {
double sum = 0.0f;
for (int i = 0; i < Math.min(pointers.length, other.pointers.length); i++) {
if (pointers[i] == null || other.pointers[i] == null) continue;
if (sparse[i] && other.sparse[i]) {
outer:
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
for (int k = 0; k < other.pointers[i].length / 2; k++) {
int otherSparseIndex = (int) other.pointers[i][k * 2];
if (sparseIndex == otherSparseIndex) {
sum += pointers[i][(j * 2) + 1] * other.pointers[i][(k * 2) + 1];
continue outer;
}
}
}
} else if (sparse[i] && !other.sparse[i]) {
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0 && sparseIndex < other.pointers[i].length) {
sum += other.pointers[i][sparseIndex] * pointers[i][(j * 2) + 1];
}
}
} else if (!sparse[i] && other.sparse[i]) {
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0 && sparseIndex < pointers[i].length) {
sum += pointers[i][sparseIndex] * other.pointers[i][(j * 2) + 1];
}
}
} else {
for (int j = 0; j < Math.min(pointers[i].length, other.pointers[i].length); j++) {
sum += pointers[i][j] * other.pointers[i][j];
}
}
}
return sum;
}
} } | public class class_name {
public double dotProduct(ConcatVector other) {
if (loadedNative) {
return dotProductNative(other); // depends on control dependency: [if], data = [none]
} else {
double sum = 0.0f;
for (int i = 0; i < Math.min(pointers.length, other.pointers.length); i++) {
if (pointers[i] == null || other.pointers[i] == null) continue;
if (sparse[i] && other.sparse[i]) {
outer:
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
for (int k = 0; k < other.pointers[i].length / 2; k++) {
int otherSparseIndex = (int) other.pointers[i][k * 2];
if (sparseIndex == otherSparseIndex) {
sum += pointers[i][(j * 2) + 1] * other.pointers[i][(k * 2) + 1]; // depends on control dependency: [if], data = [none]
continue outer;
}
}
}
} else if (sparse[i] && !other.sparse[i]) {
for (int j = 0; j < pointers[i].length / 2; j++) {
int sparseIndex = (int) pointers[i][j * 2];
if (sparseIndex >= 0 && sparseIndex < other.pointers[i].length) {
sum += other.pointers[i][sparseIndex] * pointers[i][(j * 2) + 1]; // depends on control dependency: [if], data = [none]
}
}
} else if (!sparse[i] && other.sparse[i]) {
for (int j = 0; j < other.pointers[i].length / 2; j++) {
int sparseIndex = (int) other.pointers[i][j * 2];
if (sparseIndex >= 0 && sparseIndex < pointers[i].length) {
sum += pointers[i][sparseIndex] * other.pointers[i][(j * 2) + 1]; // depends on control dependency: [if], data = [none]
}
}
} else {
for (int j = 0; j < Math.min(pointers[i].length, other.pointers[i].length); j++) {
sum += pointers[i][j] * other.pointers[i][j]; // depends on control dependency: [for], data = [j]
}
}
}
return sum; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean add(int left, int right) {
if (line[left] == null) {
line[left] = new IntBitSet();
} else {
if (line[left].contains(right)) {
return false;
}
}
line[left].add(right);
return true;
} } | public class class_name {
public boolean add(int left, int right) {
if (line[left] == null) {
line[left] = new IntBitSet(); // depends on control dependency: [if], data = [none]
} else {
if (line[left].contains(right)) {
return false; // depends on control dependency: [if], data = [none]
}
}
line[left].add(right);
return true;
} } |
public class class_name {
public EEnum getIfcColumnTypeEnum() {
if (ifcColumnTypeEnumEEnum == null) {
ifcColumnTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(795);
}
return ifcColumnTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcColumnTypeEnum() {
if (ifcColumnTypeEnumEEnum == null) {
ifcColumnTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(795);
// depends on control dependency: [if], data = [none]
}
return ifcColumnTypeEnumEEnum;
} } |
public class class_name {
public TimeSlot insertSlot(long newSlotTimeout, TimeSlot slot) {
// this routine assumes the list is not empty
TimeSlot retSlot = new TimeSlot(newSlotTimeout);
retSlot.nextEntry = slot;
retSlot.prevEntry = slot.prevEntry;
if (retSlot.prevEntry != null) {
retSlot.prevEntry.nextEntry = retSlot;
} else {
// no prev, so this is now the first slot
this.firstSlot = retSlot;
}
slot.prevEntry = retSlot;
return retSlot;
} } | public class class_name {
public TimeSlot insertSlot(long newSlotTimeout, TimeSlot slot) {
// this routine assumes the list is not empty
TimeSlot retSlot = new TimeSlot(newSlotTimeout);
retSlot.nextEntry = slot;
retSlot.prevEntry = slot.prevEntry;
if (retSlot.prevEntry != null) {
retSlot.prevEntry.nextEntry = retSlot; // depends on control dependency: [if], data = [none]
} else {
// no prev, so this is now the first slot
this.firstSlot = retSlot; // depends on control dependency: [if], data = [none]
}
slot.prevEntry = retSlot;
return retSlot;
} } |
public class class_name {
private void cleanupSubscription(SubscriptionItemStream stream)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "cleanupSubscription", stream);
try
{
// Indicate that we don't want the asynch deletion thread restarted if the
// subscription fails to delete, otherwise we might end up in a tight loop trying
// to delete the subscription
stream.deleteIfPossible(false);
}
catch (Exception e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AsynchDeletionThread.cleanupSubscription",
"1:340:1.50",
stream);
if (tc.isDebugEnabled())
{
SibTr.debug(tc, "Failed to delete subscription " + stream);
SibTr.exception(tc, e);
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "cleanupSubscription");
} } | public class class_name {
private void cleanupSubscription(SubscriptionItemStream stream)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "cleanupSubscription", stream);
try
{
// Indicate that we don't want the asynch deletion thread restarted if the
// subscription fails to delete, otherwise we might end up in a tight loop trying
// to delete the subscription
stream.deleteIfPossible(false); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AsynchDeletionThread.cleanupSubscription",
"1:340:1.50",
stream);
if (tc.isDebugEnabled())
{
SibTr.debug(tc, "Failed to delete subscription " + stream); // depends on control dependency: [if], data = [none]
SibTr.exception(tc, e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
if (tc.isEntryEnabled())
SibTr.exit(tc, "cleanupSubscription");
} } |
public class class_name {
public void close() {
if (this.xaConnection != null) {
this.xaConnection.doClose();
}
this.closed = true;
this.notifyClosed();
if (LOG.isDebugEnabled()) {
LOG.debug("PhynixxXAResource[" + this.getId() + "]:closed ");
}
} } | public class class_name {
public void close() {
if (this.xaConnection != null) {
this.xaConnection.doClose(); // depends on control dependency: [if], data = [none]
}
this.closed = true;
this.notifyClosed();
if (LOG.isDebugEnabled()) {
LOG.debug("PhynixxXAResource[" + this.getId() + "]:closed "); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public long expire(long time) {
for (int logSize = (Long.SIZE - 1) - numberOfLeadingZeros(last); logSize >= 0; logSize--) {
boolean live = false;
for (int i = min_l(logSize); i < max_l(logSize); i++) {
long end = boxes[i];
if (end != MIN_VALUE) {
if ((time - end) >= window) {
total -= 1L << logSize;
boxes[i] = MIN_VALUE;
} else {
live = true;
}
}
}
if (live) {
last = 1L << logSize;
return count();
}
}
last = 0;
return 0;
} } | public class class_name {
public long expire(long time) {
for (int logSize = (Long.SIZE - 1) - numberOfLeadingZeros(last); logSize >= 0; logSize--) {
boolean live = false;
for (int i = min_l(logSize); i < max_l(logSize); i++) {
long end = boxes[i];
if (end != MIN_VALUE) {
if ((time - end) >= window) {
total -= 1L << logSize; // depends on control dependency: [if], data = [none]
boxes[i] = MIN_VALUE; // depends on control dependency: [if], data = [none]
} else {
live = true; // depends on control dependency: [if], data = [none]
}
}
}
if (live) {
last = 1L << logSize; // depends on control dependency: [if], data = [none]
return count(); // depends on control dependency: [if], data = [none]
}
}
last = 0;
return 0;
} } |
public class class_name {
void migrateMemberships(Node oldUserNode) throws Exception
{
Session session = oldUserNode.getSession();
NodeIterator iterator = ((ExtendedNode)oldUserNode).getNodesLazily();
while (iterator.hasNext())
{
Node oldMembershipNode = iterator.nextNode();
if (oldMembershipNode.isNodeType(MigrationTool.JOS_USER_MEMBERSHIP))
{
String oldGroupUUID = utils.readString(oldMembershipNode, MigrationTool.JOS_GROUP);
String oldMembershipTypeUUID =
utils.readString(oldMembershipNode, MembershipProperties.JOS_MEMBERSHIP_TYPE);
String userName = oldUserNode.getName();
String groupId = utils.readString(session.getNodeByUUID(oldGroupUUID), MigrationTool.JOS_GROUP_ID);
String membershipTypeName = session.getNodeByUUID(oldMembershipTypeUUID).getName();
User user = service.getUserHandler().findUserByName(userName);
Group group = service.getGroupHandler().findGroupById(groupId);
MembershipType mt = service.getMembershipTypeHandler().findMembershipType(membershipTypeName);
Membership existingMembership = findMembershipByUserGroupAndType(userName, groupId, membershipTypeName);
if (existingMembership != null)
{
removeMembership(existingMembership.getId(), false);
}
linkMembership(user, group, mt, false);
}
}
} } | public class class_name {
void migrateMemberships(Node oldUserNode) throws Exception
{
Session session = oldUserNode.getSession();
NodeIterator iterator = ((ExtendedNode)oldUserNode).getNodesLazily();
while (iterator.hasNext())
{
Node oldMembershipNode = iterator.nextNode();
if (oldMembershipNode.isNodeType(MigrationTool.JOS_USER_MEMBERSHIP))
{
String oldGroupUUID = utils.readString(oldMembershipNode, MigrationTool.JOS_GROUP);
String oldMembershipTypeUUID =
utils.readString(oldMembershipNode, MembershipProperties.JOS_MEMBERSHIP_TYPE);
String userName = oldUserNode.getName();
String groupId = utils.readString(session.getNodeByUUID(oldGroupUUID), MigrationTool.JOS_GROUP_ID);
String membershipTypeName = session.getNodeByUUID(oldMembershipTypeUUID).getName();
User user = service.getUserHandler().findUserByName(userName);
Group group = service.getGroupHandler().findGroupById(groupId);
MembershipType mt = service.getMembershipTypeHandler().findMembershipType(membershipTypeName);
Membership existingMembership = findMembershipByUserGroupAndType(userName, groupId, membershipTypeName);
if (existingMembership != null)
{
removeMembership(existingMembership.getId(), false); // depends on control dependency: [if], data = [(existingMembership]
}
linkMembership(user, group, mt, false);
}
}
} } |
public class class_name {
public static synchronized STSSessionCredentialsProvider getSessionCredentialsProvider(AWSCredentials longTermCredentials,
String serviceEndpoint,
ClientConfiguration stsClientConfiguration) {
Key key = new Key(longTermCredentials.getAWSAccessKeyId(), serviceEndpoint);
if ( !cache.containsKey(key) ) {
cache.put(key, new STSSessionCredentialsProvider(longTermCredentials, stsClientConfiguration));
}
return cache.get(key);
} } | public class class_name {
public static synchronized STSSessionCredentialsProvider getSessionCredentialsProvider(AWSCredentials longTermCredentials,
String serviceEndpoint,
ClientConfiguration stsClientConfiguration) {
Key key = new Key(longTermCredentials.getAWSAccessKeyId(), serviceEndpoint);
if ( !cache.containsKey(key) ) {
cache.put(key, new STSSessionCredentialsProvider(longTermCredentials, stsClientConfiguration));
// depends on control dependency: [if], data = [none]
}
return cache.get(key);
} } |
public class class_name {
public void getGoogleApiClient(final BraintreeResponseListener<GoogleApiClient> listener) {
waitForConfiguration(new ConfigurationListener() {
@Override
public void onConfigurationFetched(Configuration configuration) {
GoogleApiClient googleApiClient = getGoogleApiClient();
if (googleApiClient != null) {
listener.onResponse(googleApiClient);
}
}
});
} } | public class class_name {
public void getGoogleApiClient(final BraintreeResponseListener<GoogleApiClient> listener) {
waitForConfiguration(new ConfigurationListener() {
@Override
public void onConfigurationFetched(Configuration configuration) {
GoogleApiClient googleApiClient = getGoogleApiClient();
if (googleApiClient != null) {
listener.onResponse(googleApiClient); // depends on control dependency: [if], data = [(googleApiClient]
}
}
});
} } |
public class class_name {
public static Collection<CollisionCategory> imports(Xml root)
{
Check.notNull(root);
final Collection<Xml> childrenCategory = root.getChildren(NODE_CATEGORY);
final Collection<CollisionCategory> categories = new ArrayList<>(childrenCategory.size());
for (final Xml node : childrenCategory)
{
final Collection<Xml> childrenGroup = node.getChildren(TileGroupsConfig.NODE_GROUP);
final Collection<CollisionGroup> groups = new ArrayList<>(childrenGroup.size());
for (final Xml group : childrenGroup)
{
final String name = group.getText();
groups.add(new CollisionGroup(name, new ArrayList<CollisionFormula>(0)));
}
final String name = node.readString(ATT_NAME);
final Axis axis = Axis.valueOf(node.readString(ATT_AXIS));
final int x = node.readInteger(ATT_X);
final int y = node.readInteger(ATT_Y);
final boolean glue = node.readBoolean(true, ATT_GLUE);
final CollisionCategory category = new CollisionCategory(name, axis, x, y, glue, groups);
categories.add(category);
}
return categories;
} } | public class class_name {
public static Collection<CollisionCategory> imports(Xml root)
{
Check.notNull(root);
final Collection<Xml> childrenCategory = root.getChildren(NODE_CATEGORY);
final Collection<CollisionCategory> categories = new ArrayList<>(childrenCategory.size());
for (final Xml node : childrenCategory)
{
final Collection<Xml> childrenGroup = node.getChildren(TileGroupsConfig.NODE_GROUP);
final Collection<CollisionGroup> groups = new ArrayList<>(childrenGroup.size());
for (final Xml group : childrenGroup)
{
final String name = group.getText();
groups.add(new CollisionGroup(name, new ArrayList<CollisionFormula>(0)));
// depends on control dependency: [for], data = [group]
}
final String name = node.readString(ATT_NAME);
final Axis axis = Axis.valueOf(node.readString(ATT_AXIS));
final int x = node.readInteger(ATT_X);
final int y = node.readInteger(ATT_Y);
final boolean glue = node.readBoolean(true, ATT_GLUE);
final CollisionCategory category = new CollisionCategory(name, axis, x, y, glue, groups);
categories.add(category);
// depends on control dependency: [for], data = [none]
}
return categories;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.