code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void setContentMinHeight(int height) {
if ((0.9 * Page.getCurrent().getBrowserWindowHeight()) < height) {
m_contentPanel.getContent().setHeight(height + "px");
} else {
m_contentPanel.getContent().setHeight("100%");
}
} } | public class class_name {
public void setContentMinHeight(int height) {
if ((0.9 * Page.getCurrent().getBrowserWindowHeight()) < height) {
m_contentPanel.getContent().setHeight(height + "px"); // depends on control dependency: [if], data = [none]
} else {
m_contentPanel.getContent().setHeight("100%"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected <Y> T getUniqueByAttribute(SingularAttribute<T, Y> attribute,
Y value) {
try {
return getDatabaseSupport().getUniqueByAttribute(getEntityClass(), attribute, value);
} catch (NoResultException ex) {
return null;
}
} } | public class class_name {
protected <Y> T getUniqueByAttribute(SingularAttribute<T, Y> attribute,
Y value) {
try {
return getDatabaseSupport().getUniqueByAttribute(getEntityClass(), attribute, value); // depends on control dependency: [try], data = [none]
} catch (NoResultException ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void loadClassPath() throws IOException
{
Class<?> dClass = this.getClass();
CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource();
if ( codeSrc == null ) {
return;
}
String codePath = codeSrc.getLocation().getPath();
if ( codePath.toLowerCase().endsWith(".jar") ) {
ZipInputStream zip = new ZipInputStream(codeSrc.getLocation().openStream());
while ( true ) {
ZipEntry e = zip.getNextEntry();
if ( e == null ) {
break;
}
String fileName = e.getName();
if ( fileName.endsWith(".lex")
&& fileName.startsWith("lexicon/lex-") ) {
load(dClass.getResourceAsStream("/"+fileName));
}
}
} else {
//now, the classpath is an IDE directory
// like eclipse ./bin or maven ./target/classes/
loadDirectory(codePath+"/lexicon");
}
} } | public class class_name {
public void loadClassPath() throws IOException
{
Class<?> dClass = this.getClass();
CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource();
if ( codeSrc == null ) {
return;
}
String codePath = codeSrc.getLocation().getPath();
if ( codePath.toLowerCase().endsWith(".jar") ) {
ZipInputStream zip = new ZipInputStream(codeSrc.getLocation().openStream());
while ( true ) {
ZipEntry e = zip.getNextEntry();
if ( e == null ) {
break;
}
String fileName = e.getName();
if ( fileName.endsWith(".lex")
&& fileName.startsWith("lexicon/lex-") ) {
load(dClass.getResourceAsStream("/"+fileName)); // depends on control dependency: [if], data = [none]
}
}
} else {
//now, the classpath is an IDE directory
// like eclipse ./bin or maven ./target/classes/
loadDirectory(codePath+"/lexicon");
}
} } |
public class class_name {
private int resolveFlats( int pitsCount ) {
int stillPitsCount;
currentPitsCount = pitsCount;
do {
if (pm.isCanceled()) {
return -1;
}
pitsCount = currentPitsCount;
currentPitsCount = 0;
for( int ip = 1; ip <= pitsCount; ip++ ) {
dn[ip] = 0;
}
for( int k = 1; k <= 8; k++ ) {
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
double elevDelta = pitIter.getSampleDouble(currentPitCols[pitIndex], currentPitRows[pitIndex], 0)
- pitIter.getSampleDouble(currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0],
currentPitRows[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][1], 0);
if ((elevDelta >= 0.)
&& ((dir[currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0]][currentPitRows[pitIndex]
+ DIR_WITHFLOW_EXITING_INVERTED[k][1]] != 0) && (dn[pitIndex] == 0)))
dn[pitIndex] = k;
}
}
stillPitsCount = 1; /* location of point on stack with lowest elevation */
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
if (dn[pitIndex] > 0) {
dir[currentPitCols[pitIndex]][currentPitRows[pitIndex]] = dn[pitIndex];
} else {
currentPitsCount++;
currentPitRows[currentPitsCount] = currentPitRows[pitIndex];
currentPitCols[currentPitsCount] = currentPitCols[pitIndex];
if (pitIter.getSampleDouble(currentPitCols[currentPitsCount], currentPitRows[currentPitsCount], 0) < pitIter
.getSampleDouble(currentPitCols[stillPitsCount], currentPitRows[stillPitsCount], 0))
stillPitsCount = currentPitsCount;
}
}
// out.println("vdn n = " + n + "nis = " + nis);
} while( currentPitsCount < pitsCount );
return stillPitsCount;
} } | public class class_name {
private int resolveFlats( int pitsCount ) {
int stillPitsCount;
currentPitsCount = pitsCount;
do {
if (pm.isCanceled()) {
return -1; // depends on control dependency: [if], data = [none]
}
pitsCount = currentPitsCount;
currentPitsCount = 0;
for( int ip = 1; ip <= pitsCount; ip++ ) {
dn[ip] = 0; // depends on control dependency: [for], data = [ip]
}
for( int k = 1; k <= 8; k++ ) {
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
double elevDelta = pitIter.getSampleDouble(currentPitCols[pitIndex], currentPitRows[pitIndex], 0)
- pitIter.getSampleDouble(currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0],
currentPitRows[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][1], 0);
if ((elevDelta >= 0.)
&& ((dir[currentPitCols[pitIndex] + DIR_WITHFLOW_EXITING_INVERTED[k][0]][currentPitRows[pitIndex]
+ DIR_WITHFLOW_EXITING_INVERTED[k][1]] != 0) && (dn[pitIndex] == 0)))
dn[pitIndex] = k;
}
}
stillPitsCount = 1; /* location of point on stack with lowest elevation */
for( int pitIndex = 1; pitIndex <= pitsCount; pitIndex++ ) {
if (dn[pitIndex] > 0) {
dir[currentPitCols[pitIndex]][currentPitRows[pitIndex]] = dn[pitIndex]; // depends on control dependency: [if], data = [none]
} else {
currentPitsCount++; // depends on control dependency: [if], data = [none]
currentPitRows[currentPitsCount] = currentPitRows[pitIndex]; // depends on control dependency: [if], data = [none]
currentPitCols[currentPitsCount] = currentPitCols[pitIndex]; // depends on control dependency: [if], data = [none]
if (pitIter.getSampleDouble(currentPitCols[currentPitsCount], currentPitRows[currentPitsCount], 0) < pitIter
.getSampleDouble(currentPitCols[stillPitsCount], currentPitRows[stillPitsCount], 0))
stillPitsCount = currentPitsCount;
}
}
// out.println("vdn n = " + n + "nis = " + nis);
} while( currentPitsCount < pitsCount );
return stillPitsCount;
} } |
public class class_name {
public static <T> List<T> asList(Iterable<T> self) {
if (self instanceof List) {
return (List<T>) self;
} else {
return toList(self);
}
} } | public class class_name {
public static <T> List<T> asList(Iterable<T> self) {
if (self instanceof List) {
return (List<T>) self; // depends on control dependency: [if], data = [none]
} else {
return toList(self); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String tokenReplaceSysProps(CharSequence text) {
if(text==null) return null;
Matcher m = SYS_PROP_PATTERN.matcher(text);
StringBuffer ret = new StringBuffer();
while(m.find()) {
String replacement = decodeToken(m.group(1), m.group(2)==null ? "<null>" : m.group(2));
if(replacement==null) {
throw new IllegalArgumentException("Failed to fill in SystemProperties for expression with no default [" + text + "]");
}
if(IS_WINDOWS) {
replacement = replacement.replace(File.separatorChar , '/');
}
m.appendReplacement(ret, replacement);
}
m.appendTail(ret);
return ret.toString();
} } | public class class_name {
public static String tokenReplaceSysProps(CharSequence text) {
if(text==null) return null;
Matcher m = SYS_PROP_PATTERN.matcher(text);
StringBuffer ret = new StringBuffer();
while(m.find()) {
String replacement = decodeToken(m.group(1), m.group(2)==null ? "<null>" : m.group(2));
if(replacement==null) {
throw new IllegalArgumentException("Failed to fill in SystemProperties for expression with no default [" + text + "]");
}
if(IS_WINDOWS) {
replacement = replacement.replace(File.separatorChar , '/'); // depends on control dependency: [if], data = [none]
}
m.appendReplacement(ret, replacement); // depends on control dependency: [while], data = [none]
}
m.appendTail(ret);
return ret.toString();
} } |
public class class_name {
private Set<String> getRelatedElementIds(String id) {
Set<String> result = new HashSet<String>();
if (id != null) {
result.add(id);
String serverId = getServerId(id);
Iterator<String> it = m_elements.keySet().iterator();
while (it.hasNext()) {
String elId = it.next();
if (elId.startsWith(serverId)) {
result.add(elId);
}
}
Iterator<org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel> itEl = getAllDragElements().iterator();
while (itEl.hasNext()) {
org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel element = itEl.next();
if (element.getId().startsWith(serverId)) {
result.add(element.getId());
}
}
}
return result;
} } | public class class_name {
private Set<String> getRelatedElementIds(String id) {
Set<String> result = new HashSet<String>();
if (id != null) {
result.add(id); // depends on control dependency: [if], data = [(id]
String serverId = getServerId(id);
Iterator<String> it = m_elements.keySet().iterator();
while (it.hasNext()) {
String elId = it.next();
if (elId.startsWith(serverId)) {
result.add(elId); // depends on control dependency: [if], data = [none]
}
}
Iterator<org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel> itEl = getAllDragElements().iterator();
while (itEl.hasNext()) {
org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel element = itEl.next();
if (element.getId().startsWith(serverId)) {
result.add(element.getId()); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
public void setValueExpression(String name, ValueExpression binding) {
if (name == null) {
throw new NullPointerException();
} else if ("id".equals(name) || "parent".equals(name)) {
throw new IllegalArgumentException();
}
if (binding != null) {
if (!binding.isLiteralText()) {
//if (bindings == null) {
// //noinspection CollectionWithoutInitialCapacity
// bindings = new HashMap<String, ValueExpression>();
//}
// add this binding name to the 'attributesThatAreSet' list
//List<String> sProperties = (List<String>)
// getStateHelper().get(PropertyKeysPrivate.attributesThatAreSet);
List<String> sProperties =
(List<String>) getStateHelper().get(PropertyKeysPrivate.attributesThatAreSet);
if (sProperties == null) {
getStateHelper().add(PropertyKeysPrivate.attributesThatAreSet, name);
} else if (!sProperties.contains(name)) {
getStateHelper().add(PropertyKeysPrivate.attributesThatAreSet, name);
}
getStateHelper().put(UIComponentBase.PropertyKeys.bindings,
name,
binding);
//bindings.put(name, binding);
} else {
ELContext context =
FacesContext.getCurrentInstance().getELContext();
try {
getAttributes().put(name, binding.getValue(context));
} catch (ELException ele) {
throw new FacesException(ele);
}
}
} else {
//if (bindings != null) {
// remove this binding name from the 'attributesThatAreSet' list
// List<String> sProperties = getAttributesThatAreSet(false);
// if (sProperties != null) {
// sProperties.remove(name);
// }
getStateHelper().remove(PropertyKeysPrivate.attributesThatAreSet,
name);
getStateHelper().remove(UIComponentBase.PropertyKeys.bindings, name);
//bindings.remove(name);
// if (bindings.isEmpty()) {
// bindings = null;
// }
}
// }
} } | public class class_name {
public void setValueExpression(String name, ValueExpression binding) {
if (name == null) {
throw new NullPointerException();
} else if ("id".equals(name) || "parent".equals(name)) {
throw new IllegalArgumentException();
}
if (binding != null) {
if (!binding.isLiteralText()) {
//if (bindings == null) {
// //noinspection CollectionWithoutInitialCapacity
// bindings = new HashMap<String, ValueExpression>();
//}
// add this binding name to the 'attributesThatAreSet' list
//List<String> sProperties = (List<String>)
// getStateHelper().get(PropertyKeysPrivate.attributesThatAreSet);
List<String> sProperties =
(List<String>) getStateHelper().get(PropertyKeysPrivate.attributesThatAreSet);
if (sProperties == null) {
getStateHelper().add(PropertyKeysPrivate.attributesThatAreSet, name); // depends on control dependency: [if], data = [none]
} else if (!sProperties.contains(name)) {
getStateHelper().add(PropertyKeysPrivate.attributesThatAreSet, name); // depends on control dependency: [if], data = [none]
}
getStateHelper().put(UIComponentBase.PropertyKeys.bindings,
name,
binding); // depends on control dependency: [if], data = [none]
//bindings.put(name, binding);
} else {
ELContext context =
FacesContext.getCurrentInstance().getELContext();
try {
getAttributes().put(name, binding.getValue(context)); // depends on control dependency: [try], data = [none]
} catch (ELException ele) {
throw new FacesException(ele);
} // depends on control dependency: [catch], data = [none]
}
} else {
//if (bindings != null) {
// remove this binding name from the 'attributesThatAreSet' list
// List<String> sProperties = getAttributesThatAreSet(false);
// if (sProperties != null) {
// sProperties.remove(name);
// }
getStateHelper().remove(PropertyKeysPrivate.attributesThatAreSet,
name); // depends on control dependency: [if], data = [none]
getStateHelper().remove(UIComponentBase.PropertyKeys.bindings, name); // depends on control dependency: [if], data = [none]
//bindings.remove(name);
// if (bindings.isEmpty()) {
// bindings = null;
// }
}
// }
} } |
public class class_name {
public SeriesColorMarkerLineStyle getNextSeriesColorMarkerLineStyle() {
// 1. Color - cycle through colors one by one
if (colorCounter >= seriesColorList.length) {
colorCounter = 0;
strokeCounter++;
}
Color seriesColor = seriesColorList[colorCounter++];
// 2. Stroke - cycle through strokes one by one but only after a color cycle
if (strokeCounter >= seriesLineStyleList.length) {
strokeCounter = 0;
}
BasicStroke seriesLineStyle = seriesLineStyleList[strokeCounter];
// 3. Marker - cycle through markers one by one
if (markerCounter >= seriesMarkerList.length) {
markerCounter = 0;
}
Marker marker = seriesMarkerList[markerCounter++];
return new SeriesColorMarkerLineStyle(seriesColor, marker, seriesLineStyle);
} } | public class class_name {
public SeriesColorMarkerLineStyle getNextSeriesColorMarkerLineStyle() {
// 1. Color - cycle through colors one by one
if (colorCounter >= seriesColorList.length) {
colorCounter = 0; // depends on control dependency: [if], data = [none]
strokeCounter++; // depends on control dependency: [if], data = [none]
}
Color seriesColor = seriesColorList[colorCounter++];
// 2. Stroke - cycle through strokes one by one but only after a color cycle
if (strokeCounter >= seriesLineStyleList.length) {
strokeCounter = 0; // depends on control dependency: [if], data = [none]
}
BasicStroke seriesLineStyle = seriesLineStyleList[strokeCounter];
// 3. Marker - cycle through markers one by one
if (markerCounter >= seriesMarkerList.length) {
markerCounter = 0; // depends on control dependency: [if], data = [none]
}
Marker marker = seriesMarkerList[markerCounter++];
return new SeriesColorMarkerLineStyle(seriesColor, marker, seriesLineStyle);
} } |
public class class_name {
private Object getComponentProperty(_PropertyDescriptorHolder propertyDescriptor)
{
Method readMethod = propertyDescriptor.getReadMethod();
if (readMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not readable");
}
try
{
return readMethod.invoke(_component, EMPTY_ARGS);
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not get property " + propertyDescriptor.getName() + " of component "
+ _component.getClientId(facesContext), e);
}
} } | public class class_name {
private Object getComponentProperty(_PropertyDescriptorHolder propertyDescriptor)
{
Method readMethod = propertyDescriptor.getReadMethod();
if (readMethod == null)
{
throw new IllegalArgumentException("Component property " + propertyDescriptor.getName()
+ " is not readable");
}
try
{
return readMethod.invoke(_component, EMPTY_ARGS); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FacesContext facesContext = _component.getFacesContext();
throw new FacesException("Could not get property " + propertyDescriptor.getName() + " of component "
+ _component.getClientId(facesContext), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Bitmap drawTile(int tileWidth, int tileHeight, String text) {
// Create bitmap and canvas
Bitmap bitmap = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
// Draw the tile fill paint
if (tileFillPaint != null) {
canvas.drawRect(0, 0, tileWidth, tileHeight, tileFillPaint);
}
// Draw the tile border
if (tileBorderPaint != null) {
canvas.drawRect(0, 0, tileWidth, tileHeight, tileBorderPaint);
}
// Determine the text bounds
Rect textBounds = new Rect();
textPaint.getTextBounds(text, 0, text.length(), textBounds);
// Determine the center of the tile
int centerX = (int) (bitmap.getWidth() / 2.0f);
int centerY = (int) (bitmap.getHeight() / 2.0f);
// Draw the circle
if (circlePaint != null || circleFillPaint != null) {
int diameter = Math.max(textBounds.width(), textBounds.height());
float radius = diameter / 2.0f;
radius = radius + (diameter * circlePaddingPercentage);
// Draw the filled circle
if (circleFillPaint != null) {
canvas.drawCircle(centerX, centerY, radius, circleFillPaint);
}
// Draw the circle
if (circlePaint != null) {
canvas.drawCircle(centerX, centerY, radius, circlePaint);
}
}
// Draw the text
canvas.drawText(text, centerX - textBounds.exactCenterX(), centerY - textBounds.exactCenterY(), textPaint);
return bitmap;
} } | public class class_name {
private Bitmap drawTile(int tileWidth, int tileHeight, String text) {
// Create bitmap and canvas
Bitmap bitmap = Bitmap.createBitmap(tileWidth,
tileHeight, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
// Draw the tile fill paint
if (tileFillPaint != null) {
canvas.drawRect(0, 0, tileWidth, tileHeight, tileFillPaint); // depends on control dependency: [if], data = [none]
}
// Draw the tile border
if (tileBorderPaint != null) {
canvas.drawRect(0, 0, tileWidth, tileHeight, tileBorderPaint); // depends on control dependency: [if], data = [none]
}
// Determine the text bounds
Rect textBounds = new Rect();
textPaint.getTextBounds(text, 0, text.length(), textBounds);
// Determine the center of the tile
int centerX = (int) (bitmap.getWidth() / 2.0f);
int centerY = (int) (bitmap.getHeight() / 2.0f);
// Draw the circle
if (circlePaint != null || circleFillPaint != null) {
int diameter = Math.max(textBounds.width(), textBounds.height());
float radius = diameter / 2.0f;
radius = radius + (diameter * circlePaddingPercentage); // depends on control dependency: [if], data = [none]
// Draw the filled circle
if (circleFillPaint != null) {
canvas.drawCircle(centerX, centerY, radius, circleFillPaint); // depends on control dependency: [if], data = [none]
}
// Draw the circle
if (circlePaint != null) {
canvas.drawCircle(centerX, centerY, radius, circlePaint); // depends on control dependency: [if], data = [none]
}
}
// Draw the text
canvas.drawText(text, centerX - textBounds.exactCenterX(), centerY - textBounds.exactCenterY(), textPaint);
return bitmap;
} } |
public class class_name {
private boolean isUpload(String action) {
if (StringUtils.hasText(action) && action.equals(OperationType.UPLOAD.toString())) {
return true;
}
return false;
} } | public class class_name {
private boolean isUpload(String action) {
if (StringUtils.hasText(action) && action.equals(OperationType.UPLOAD.toString())) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected void initDecorations() {
for (int x = 0; x < 7; x++) {
days[x].setContentAreaFilled(decorationBackgroundVisible);
days[x].setBorderPainted(decorationBordersVisible);
days[x].invalidate();
days[x].repaint();
weeks[x].setContentAreaFilled(decorationBackgroundVisible);
weeks[x].setBorderPainted(decorationBordersVisible);
weeks[x].invalidate();
weeks[x].repaint();
}
} } | public class class_name {
protected void initDecorations() {
for (int x = 0; x < 7; x++) {
days[x].setContentAreaFilled(decorationBackgroundVisible); // depends on control dependency: [for], data = [x]
days[x].setBorderPainted(decorationBordersVisible); // depends on control dependency: [for], data = [x]
days[x].invalidate(); // depends on control dependency: [for], data = [x]
days[x].repaint(); // depends on control dependency: [for], data = [x]
weeks[x].setContentAreaFilled(decorationBackgroundVisible); // depends on control dependency: [for], data = [x]
weeks[x].setBorderPainted(decorationBordersVisible); // depends on control dependency: [for], data = [x]
weeks[x].invalidate(); // depends on control dependency: [for], data = [x]
weeks[x].repaint(); // depends on control dependency: [for], data = [x]
}
} } |
public class class_name {
public static long countUnorderedPairs(int minI, int maxI, int minJ, int maxJ) {
long maxPairs = 0;
int min = Math.min(minI, minJ);
int max = Math.max(maxI, maxJ);
for (int i=min; i<max; i++) {
for (int j=i; j<max; j++) {
if ((minI <= i && i < maxI && minJ <= j && j < maxJ) ||
(minJ <= i && i < maxJ && minI <= j && j < maxI)) {
maxPairs++;
}
}
}
return maxPairs;
} } | public class class_name {
public static long countUnorderedPairs(int minI, int maxI, int minJ, int maxJ) {
long maxPairs = 0;
int min = Math.min(minI, minJ);
int max = Math.max(maxI, maxJ);
for (int i=min; i<max; i++) {
for (int j=i; j<max; j++) {
if ((minI <= i && i < maxI && minJ <= j && j < maxJ) ||
(minJ <= i && i < maxJ && minI <= j && j < maxI)) {
maxPairs++; // depends on control dependency: [if], data = [none]
}
}
}
return maxPairs;
} } |
public class class_name {
@Override
public void setMinX(double x) {
double o = this.maxxProperty.doubleValue();
if (o<x) {
this.minxProperty.set(o);
this.maxxProperty.set(x);
}
else {
this.minxProperty.set(x);
}
} } | public class class_name {
@Override
public void setMinX(double x) {
double o = this.maxxProperty.doubleValue();
if (o<x) {
this.minxProperty.set(o); // depends on control dependency: [if], data = [(o]
this.maxxProperty.set(x); // depends on control dependency: [if], data = [x)]
}
else {
this.minxProperty.set(x); // depends on control dependency: [if], data = [x)]
}
} } |
public class class_name {
public static void equalizeLocalCol( GrayU16 input , int radius , int startX , GrayU16 output ,
IWorkArrays workArrays) {
int width = 2*radius+1;
int area = width*width;
int maxValue = workArrays.length()-1;
int[] histogram = workArrays.pop();
int[] transform = workArrays.pop();
// specify the top and bottom of the histogram window and make sure it is inside bounds
int hist0 = startX;
int hist1 = startX+width;
if( hist1 > input.width ) {
hist1 = input.width;
hist0 = hist1 - width;
}
// initialize the histogram. ignore top border
localHistogram(input,hist0,0,hist1,width,histogram);
// compute transformation table
int sum = 0;
for( int i = 0; i < histogram.length; i++ ) {
transform[i] = sum += histogram[i];
}
// compute the output across the row
int indexIn = input.startIndex + radius*input.stride + startX;
int indexOut = output.startIndex + radius*output.stride + startX;
for( int x = 0; x < radius; x++ ) {
int inputValue = input.data[indexIn++] & 0xff;
output.data[indexOut++] = (short)((transform[ inputValue ]*maxValue)/area);
}
// move down while equalizing the rows one at a time
for( int y = radius+1; y < input.height-radius; y++ ) {
// remove the top most row
indexIn = input.startIndex + (y-radius-1)*input.stride;
for( int x = hist0; x < hist1; x++ ) {
histogram[input.data[indexIn + x] & 0xFFFF]--;
}
// add the bottom most row
indexIn += width*input.stride;
for( int x = hist0; x < hist1; x++ ) {
histogram[input.data[indexIn + x] & 0xFFFF]++;
}
// compute transformation table
sum = 0;
for( int i = 0; i < histogram.length; i++ ) {
transform[i] = sum += histogram[i];
}
// compute the output across the row
indexIn = input.startIndex + y*input.stride + startX;
indexOut = output.startIndex + y*output.stride + startX;
for( int x = 0; x < radius; x++ ) {
int inputValue = input.data[indexIn++] & 0xff;
output.data[indexOut++] = (short)((transform[ inputValue ]*maxValue)/area);
}
}
workArrays.recycle(histogram);
workArrays.recycle(transform);
} } | public class class_name {
public static void equalizeLocalCol( GrayU16 input , int radius , int startX , GrayU16 output ,
IWorkArrays workArrays) {
int width = 2*radius+1;
int area = width*width;
int maxValue = workArrays.length()-1;
int[] histogram = workArrays.pop();
int[] transform = workArrays.pop();
// specify the top and bottom of the histogram window and make sure it is inside bounds
int hist0 = startX;
int hist1 = startX+width;
if( hist1 > input.width ) {
hist1 = input.width; // depends on control dependency: [if], data = [none]
hist0 = hist1 - width; // depends on control dependency: [if], data = [none]
}
// initialize the histogram. ignore top border
localHistogram(input,hist0,0,hist1,width,histogram);
// compute transformation table
int sum = 0;
for( int i = 0; i < histogram.length; i++ ) {
transform[i] = sum += histogram[i]; // depends on control dependency: [for], data = [i]
}
// compute the output across the row
int indexIn = input.startIndex + radius*input.stride + startX;
int indexOut = output.startIndex + radius*output.stride + startX;
for( int x = 0; x < radius; x++ ) {
int inputValue = input.data[indexIn++] & 0xff;
output.data[indexOut++] = (short)((transform[ inputValue ]*maxValue)/area); // depends on control dependency: [for], data = [none]
}
// move down while equalizing the rows one at a time
for( int y = radius+1; y < input.height-radius; y++ ) {
// remove the top most row
indexIn = input.startIndex + (y-radius-1)*input.stride; // depends on control dependency: [for], data = [y]
for( int x = hist0; x < hist1; x++ ) {
histogram[input.data[indexIn + x] & 0xFFFF]--; // depends on control dependency: [for], data = [x]
}
// add the bottom most row
indexIn += width*input.stride; // depends on control dependency: [for], data = [none]
for( int x = hist0; x < hist1; x++ ) {
histogram[input.data[indexIn + x] & 0xFFFF]++; // depends on control dependency: [for], data = [x]
}
// compute transformation table
sum = 0; // depends on control dependency: [for], data = [none]
for( int i = 0; i < histogram.length; i++ ) {
transform[i] = sum += histogram[i]; // depends on control dependency: [for], data = [i]
}
// compute the output across the row
indexIn = input.startIndex + y*input.stride + startX; // depends on control dependency: [for], data = [y]
indexOut = output.startIndex + y*output.stride + startX; // depends on control dependency: [for], data = [y]
for( int x = 0; x < radius; x++ ) {
int inputValue = input.data[indexIn++] & 0xff;
output.data[indexOut++] = (short)((transform[ inputValue ]*maxValue)/area); // depends on control dependency: [for], data = [none]
}
}
workArrays.recycle(histogram);
workArrays.recycle(transform);
} } |
public class class_name {
public static void init() {
try {
FastProtocolRegister.register(FastProtocolId.SERIAL_VERSION_ID_1,
QJournalProtocol.class.getMethod("journal",
JournalRequestInfo.class));
} catch (Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static void init() {
try {
FastProtocolRegister.register(FastProtocolId.SERIAL_VERSION_ID_1,
QJournalProtocol.class.getMethod("journal",
JournalRequestInfo.class)); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public final OUTPUT run(InvocationContext context, INPUT input) {
try {
return serialize(context, input);
}
catch(Exception e) {
throw new SerializerException(e);
}
} } | public class class_name {
@Override
public final OUTPUT run(InvocationContext context, INPUT input) {
try {
return serialize(context, input); // depends on control dependency: [try], data = [none]
}
catch(Exception e) {
throw new SerializerException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public List<InterceptorType<InterceptorsType<T>>> getAllInterceptor()
{
List<InterceptorType<InterceptorsType<T>>> list = new ArrayList<InterceptorType<InterceptorsType<T>>>();
List<Node> nodeList = childNode.get("interceptor");
for(Node node: nodeList)
{
InterceptorType<InterceptorsType<T>> type = new InterceptorTypeImpl<InterceptorsType<T>>(this, "interceptor", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<InterceptorType<InterceptorsType<T>>> getAllInterceptor()
{
List<InterceptorType<InterceptorsType<T>>> list = new ArrayList<InterceptorType<InterceptorsType<T>>>();
List<Node> nodeList = childNode.get("interceptor");
for(Node node: nodeList)
{
InterceptorType<InterceptorsType<T>> type = new InterceptorTypeImpl<InterceptorsType<T>>(this, "interceptor", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters) {
if (connectionFactory instanceof OAuth1ConnectionFactory) {
return buildOAuth1Url((OAuth1ConnectionFactory<?>) connectionFactory, request, additionalParameters);
} else if (connectionFactory instanceof OAuth2ConnectionFactory) {
return buildOAuth2Url((OAuth2ConnectionFactory<?>) connectionFactory, request, additionalParameters);
} else {
throw new IllegalArgumentException("ConnectionFactory not supported");
}
} } | public class class_name {
public String buildOAuthUrl(ConnectionFactory<?> connectionFactory, NativeWebRequest request, MultiValueMap<String, String> additionalParameters) {
if (connectionFactory instanceof OAuth1ConnectionFactory) {
return buildOAuth1Url((OAuth1ConnectionFactory<?>) connectionFactory, request, additionalParameters); // depends on control dependency: [if], data = [none]
} else if (connectionFactory instanceof OAuth2ConnectionFactory) {
return buildOAuth2Url((OAuth2ConnectionFactory<?>) connectionFactory, request, additionalParameters); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("ConnectionFactory not supported");
}
} } |
public class class_name {
public static long getDaysBetweenIgnoreTime(String startDate, String endDate, Format format) {
SimpleDateFormat localFormat = (SimpleDateFormat) format;
try {
java.util.Date startDay = localFormat.parse(startDate);
java.util.Date endDay = localFormat.parse(endDate);
return getDaysBetweenIgnoreTime(startDay, endDay);
} catch (Exception e) {
return 0;
}
} } | public class class_name {
public static long getDaysBetweenIgnoreTime(String startDate, String endDate, Format format) {
SimpleDateFormat localFormat = (SimpleDateFormat) format;
try {
java.util.Date startDay = localFormat.parse(startDate);
java.util.Date endDay = localFormat.parse(endDate);
return getDaysBetweenIgnoreTime(startDay, endDay); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return 0;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public I_CmsWidget getWidget(String name) {
// first look up by class name
I_CmsWidget result = m_registeredWidgets.get(name);
if (result == null) {
// not found by class name, look up an alias
String className = m_widgetAliases.get(name);
if (className != null) {
result = m_registeredWidgets.get(className);
}
}
if (result != null) {
result = result.newInstance();
}
return result;
} } | public class class_name {
public I_CmsWidget getWidget(String name) {
// first look up by class name
I_CmsWidget result = m_registeredWidgets.get(name);
if (result == null) {
// not found by class name, look up an alias
String className = m_widgetAliases.get(name);
if (className != null) {
result = m_registeredWidgets.get(className); // depends on control dependency: [if], data = [(className]
}
}
if (result != null) {
result = result.newInstance(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d);
} else {
v.setBackground(d);
}
} } | public class class_name {
@SuppressLint("NewApi")
public static void setBackground(View v, Drawable d) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
v.setBackgroundDrawable(d); // depends on control dependency: [if], data = [none]
} else {
v.setBackground(d); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private List<Entry<V>> filterEntryListLowerBound(List<Entry<V>> entryList, long scn) {
List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size());
for (Entry<V> e : entryList) {
if (scn <= e.getMinScn()) {
result.add(e);
}
}
return result;
} } | public class class_name {
private List<Entry<V>> filterEntryListLowerBound(List<Entry<V>> entryList, long scn) {
List<Entry<V>> result = new ArrayList<Entry<V>>(entryList.size());
for (Entry<V> e : entryList) {
if (scn <= e.getMinScn()) {
result.add(e); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static String read(Reader reader) throws IORuntimeException {
final StringBuilder builder = StrUtil.builder();
final CharBuffer buffer = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
try {
while (-1 != reader.read(buffer)) {
builder.append(buffer.flip().toString());
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
return builder.toString();
} } | public class class_name {
public static String read(Reader reader) throws IORuntimeException {
final StringBuilder builder = StrUtil.builder();
final CharBuffer buffer = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
try {
while (-1 != reader.read(buffer)) {
builder.append(buffer.flip().toString());
// depends on control dependency: [while], data = [none]
}
} catch (IOException e) {
throw new IORuntimeException(e);
}
return builder.toString();
} } |
public class class_name {
private Type evalMainType(final Collection<Type> _baseTypes)
throws EFapsException
{
final Type ret;
if (_baseTypes.size() == 1) {
ret = _baseTypes.iterator().next();
} else {
final List<List<Type>> typeLists = new ArrayList<>();
for (final Type type : _baseTypes) {
final List<Type> typesTmp = new ArrayList<>();
typeLists.add(typesTmp);
Type tmpType = type;
while (tmpType != null) {
typesTmp.add(tmpType);
tmpType = tmpType.getParentType();
}
}
final Set<Type> common = new LinkedHashSet<>();
if (!typeLists.isEmpty()) {
final Iterator<List<Type>> iterator = typeLists.iterator();
common.addAll(iterator.next());
while (iterator.hasNext()) {
common.retainAll(iterator.next());
}
}
if (common.isEmpty()) {
throw new EFapsException(Selection.class, "noCommon", _baseTypes);
} else {
// first common type
ret = common.iterator().next();
}
}
return ret;
} } | public class class_name {
private Type evalMainType(final Collection<Type> _baseTypes)
throws EFapsException
{
final Type ret;
if (_baseTypes.size() == 1) {
ret = _baseTypes.iterator().next();
} else {
final List<List<Type>> typeLists = new ArrayList<>();
for (final Type type : _baseTypes) {
final List<Type> typesTmp = new ArrayList<>();
typeLists.add(typesTmp);
Type tmpType = type;
while (tmpType != null) {
typesTmp.add(tmpType); // depends on control dependency: [while], data = [(tmpType]
tmpType = tmpType.getParentType(); // depends on control dependency: [while], data = [none]
}
}
final Set<Type> common = new LinkedHashSet<>();
if (!typeLists.isEmpty()) {
final Iterator<List<Type>> iterator = typeLists.iterator();
common.addAll(iterator.next());
while (iterator.hasNext()) {
common.retainAll(iterator.next());
}
}
if (common.isEmpty()) {
throw new EFapsException(Selection.class, "noCommon", _baseTypes);
} else {
// first common type
ret = common.iterator().next();
}
}
return ret;
} } |
public class class_name {
@Override
public BundleEntry getEntry(String path) {
path = preSlashify(path);
if (path.equals("/")) {
return new RootModuleEntry(container);
}
Entry entry = container.getEntry(path);
return entry == null ? null : new ModuleEntry(entry, postSlashify(path, entry));
} } | public class class_name {
@Override
public BundleEntry getEntry(String path) {
path = preSlashify(path);
if (path.equals("/")) {
return new RootModuleEntry(container); // depends on control dependency: [if], data = [none]
}
Entry entry = container.getEntry(path);
return entry == null ? null : new ModuleEntry(entry, postSlashify(path, entry));
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void processJavaLoggerDiscovery(ClassTraceInfo info) {
List<FieldNode> loggerFields = getFieldsByDesc(LOGGER_TYPE.getDescriptor(), info.classNode.fields);
if (!loggerFields.isEmpty()) {
// Remove references to non-static Loggers
for (int i = loggerFields.size() - 1; i >= 0; i--) {
FieldNode fn = loggerFields.get(i);
if ((fn.access & Opcodes.ACC_STATIC) != Opcodes.ACC_STATIC) {
loggerFields.remove(i);
StringBuilder sb = new StringBuilder();
sb.append("WARNING: Non-static java.util.logging.Logger field declared on class ");
sb.append(info.classNode.name.replaceAll("/", "\\.")).append(": ");
sb.append(fn.name);
info.warnings.add(sb.toString());
}
}
if (loggerFields.size() > 1) {
StringBuilder sb = new StringBuilder();
sb.append("WARNING: Multiple java.util.logging.Logger fields declared on class ");
sb.append(info.classNode.name.replaceAll("/", "\\.")).append(": ");
for (int i = 0; i < loggerFields.size(); i++) {
sb.append(loggerFields.get(i).name);
if (i + 1 != loggerFields.size()) {
sb.append(", ");
}
}
info.warnings.add(sb.toString());
}
// Keep track of the first static Logger
if (loggerFields.size() > 0) {
info.loggerFieldNode = loggerFields.get(0);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void processJavaLoggerDiscovery(ClassTraceInfo info) {
List<FieldNode> loggerFields = getFieldsByDesc(LOGGER_TYPE.getDescriptor(), info.classNode.fields);
if (!loggerFields.isEmpty()) {
// Remove references to non-static Loggers
for (int i = loggerFields.size() - 1; i >= 0; i--) {
FieldNode fn = loggerFields.get(i);
if ((fn.access & Opcodes.ACC_STATIC) != Opcodes.ACC_STATIC) {
loggerFields.remove(i); // depends on control dependency: [if], data = [none]
StringBuilder sb = new StringBuilder();
sb.append("WARNING: Non-static java.util.logging.Logger field declared on class "); // depends on control dependency: [if], data = [none]
sb.append(info.classNode.name.replaceAll("/", "\\.")).append(": "); // depends on control dependency: [if], data = [none]
sb.append(fn.name); // depends on control dependency: [if], data = [none]
info.warnings.add(sb.toString()); // depends on control dependency: [if], data = [none]
}
}
if (loggerFields.size() > 1) {
StringBuilder sb = new StringBuilder();
sb.append("WARNING: Multiple java.util.logging.Logger fields declared on class "); // depends on control dependency: [if], data = [none]
sb.append(info.classNode.name.replaceAll("/", "\\.")).append(": "); // depends on control dependency: [if], data = [none]
for (int i = 0; i < loggerFields.size(); i++) {
sb.append(loggerFields.get(i).name); // depends on control dependency: [for], data = [i]
if (i + 1 != loggerFields.size()) {
sb.append(", "); // depends on control dependency: [if], data = [none]
}
}
info.warnings.add(sb.toString()); // depends on control dependency: [if], data = [none]
}
// Keep track of the first static Logger
if (loggerFields.size() > 0) {
info.loggerFieldNode = loggerFields.get(0); // depends on control dependency: [if], data = [0)]
}
}
} } |
public class class_name {
public static base_responses save(nitro_service client, cachecontentgroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
cachecontentgroup saveresources[] = new cachecontentgroup[resources.length];
for (int i=0;i<resources.length;i++){
saveresources[i] = new cachecontentgroup();
saveresources[i].name = resources[i].name;
}
result = perform_operation_bulk_request(client, saveresources,"save");
}
return result;
} } | public class class_name {
public static base_responses save(nitro_service client, cachecontentgroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
cachecontentgroup saveresources[] = new cachecontentgroup[resources.length];
for (int i=0;i<resources.length;i++){
saveresources[i] = new cachecontentgroup(); // depends on control dependency: [for], data = [i]
saveresources[i].name = resources[i].name; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, saveresources,"save");
}
return result;
} } |
public class class_name {
private void renderMatrix(Graphics2D g2, double fontSize) {
int numCategories = confusion.getNumRows();
Font fontNumber = new Font("Serif", Font.BOLD, (int)(0.6*fontSize + 0.5));
g2.setFont(fontNumber);
FontMetrics metrics = g2.getFontMetrics(fontNumber);
for (int i = 0; i < numCategories; i++) {
int y0 = i*gridHeight/numCategories;
int y1 = (i+1)*gridHeight/numCategories;
for (int j = 0; j < numCategories; j++) {
int x0 = j*gridWidth/numCategories;
int x1 = (j+1)*gridWidth/numCategories;
double value = confusion.unsafe_get(i,j);
int red,green,blue;
if( gray ) {
red = green = blue = (int)(255*(1.0-value));
} else {
green = 0;
red = (int)(255*value);
blue = (int)(255*(1.0-value));
}
g2.setColor(new Color(red, green, blue));
g2.fillRect(x0,y0,x1-x0,y1-y0);
// Render numbers inside the squares. Pick a color so that the number is visible no matter what
// the color of the square is
if( showNumbers && (showZeros || value != 0 )) {
int a = (red+green+blue)/3;
String text = ""+(int)(value*100.0+0.5);
Rectangle2D r = metrics.getStringBounds(text,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((x1+x0)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
int gray = a > 127 ? 0 : 255;
g2.setColor(new Color(gray,gray,gray));
g2.drawString(text,x,y);
}
}
}
} } | public class class_name {
private void renderMatrix(Graphics2D g2, double fontSize) {
int numCategories = confusion.getNumRows();
Font fontNumber = new Font("Serif", Font.BOLD, (int)(0.6*fontSize + 0.5));
g2.setFont(fontNumber);
FontMetrics metrics = g2.getFontMetrics(fontNumber);
for (int i = 0; i < numCategories; i++) {
int y0 = i*gridHeight/numCategories;
int y1 = (i+1)*gridHeight/numCategories;
for (int j = 0; j < numCategories; j++) {
int x0 = j*gridWidth/numCategories;
int x1 = (j+1)*gridWidth/numCategories;
double value = confusion.unsafe_get(i,j);
int red,green,blue;
if( gray ) {
red = green = blue = (int)(255*(1.0-value)); // depends on control dependency: [if], data = [none]
} else {
green = 0; // depends on control dependency: [if], data = [none]
red = (int)(255*value); // depends on control dependency: [if], data = [none]
blue = (int)(255*(1.0-value)); // depends on control dependency: [if], data = [none]
}
g2.setColor(new Color(red, green, blue)); // depends on control dependency: [for], data = [none]
g2.fillRect(x0,y0,x1-x0,y1-y0); // depends on control dependency: [for], data = [none]
// Render numbers inside the squares. Pick a color so that the number is visible no matter what
// the color of the square is
if( showNumbers && (showZeros || value != 0 )) {
int a = (red+green+blue)/3;
String text = ""+(int)(value*100.0+0.5);
Rectangle2D r = metrics.getStringBounds(text,null);
float adjX = (float)(r.getX()*2 + r.getWidth())/2.0f;
float adjY = (float)(r.getY()*2 + r.getHeight())/2.0f;
float x = ((x1+x0)/2f-adjX);
float y = ((y1+y0)/2f-adjY);
int gray = a > 127 ? 0 : 255;
g2.setColor(new Color(gray,gray,gray)); // depends on control dependency: [if], data = [none]
g2.drawString(text,x,y); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static List<TypeName> getTypeArguments(TypeElement element) {
final List<TypeName> result = new ArrayList<>();
if (element.getKind() == ElementKind.CLASS) {
if (element.getSuperclass() instanceof DeclaredType) {
result.addAll(convert(((DeclaredType) element.getSuperclass()).getTypeArguments()));
}
} else if (element.getKind() == ElementKind.INTERFACE) {
List<? extends TypeMirror> interfaces = element.getInterfaces();
for (TypeMirror item : interfaces) {
item.accept(new SimpleTypeVisitor7<Void, Void>() {
@Override
public Void visitDeclared(DeclaredType t, Void p) {
result.addAll(convert(t.getTypeArguments()));
return null;
}
}, null);
}
}
return result;
} } | public class class_name {
public static List<TypeName> getTypeArguments(TypeElement element) {
final List<TypeName> result = new ArrayList<>();
if (element.getKind() == ElementKind.CLASS) {
if (element.getSuperclass() instanceof DeclaredType) {
result.addAll(convert(((DeclaredType) element.getSuperclass()).getTypeArguments())); // depends on control dependency: [if], data = [none]
}
} else if (element.getKind() == ElementKind.INTERFACE) {
List<? extends TypeMirror> interfaces = element.getInterfaces(); // depends on control dependency: [if], data = [none]
for (TypeMirror item : interfaces) {
item.accept(new SimpleTypeVisitor7<Void, Void>() {
@Override
public Void visitDeclared(DeclaredType t, Void p) {
result.addAll(convert(t.getTypeArguments()));
return null;
}
}, null); // depends on control dependency: [for], data = [item]
}
}
return result;
} } |
public class class_name {
static private String fixupPropertyString(String s, boolean doClipping)
{
int index;
if (doClipping && s.startsWith(S_XSLT_PREFIX))
{
s = s.substring(S_XSLT_PREFIX_LEN);
}
if (s.startsWith(S_XALAN_PREFIX))
{
s =
S_BUILTIN_EXTENSIONS_UNIVERSAL
+ s.substring(S_XALAN_PREFIX_LEN);
}
if ((index = s.indexOf("\\u003a")) > 0)
{
String temp = s.substring(index + 6);
s = s.substring(0, index) + ":" + temp;
}
return s;
} } | public class class_name {
static private String fixupPropertyString(String s, boolean doClipping)
{
int index;
if (doClipping && s.startsWith(S_XSLT_PREFIX))
{
s = s.substring(S_XSLT_PREFIX_LEN); // depends on control dependency: [if], data = [none]
}
if (s.startsWith(S_XALAN_PREFIX))
{
s =
S_BUILTIN_EXTENSIONS_UNIVERSAL
+ s.substring(S_XALAN_PREFIX_LEN); // depends on control dependency: [if], data = [none]
}
if ((index = s.indexOf("\\u003a")) > 0)
{
String temp = s.substring(index + 6);
s = s.substring(0, index) + ":" + temp; // depends on control dependency: [if], data = [none]
}
return s;
} } |
public class class_name {
protected void dispatch(final MapEvent event) {
// cancel any pending callback
if (callback != null) {
handler.removeCallbacks(callback);
}
callback = new CallbackTask(event);
// set timer
handler.postDelayed(callback, delay);
} } | public class class_name {
protected void dispatch(final MapEvent event) {
// cancel any pending callback
if (callback != null) {
handler.removeCallbacks(callback); // depends on control dependency: [if], data = [(callback]
}
callback = new CallbackTask(event);
// set timer
handler.postDelayed(callback, delay);
} } |
public class class_name {
public void nextDoubles(double[] d, double lo, double hi) {
real.nextDoubles(d);
double l = hi - lo;
int n = d.length;
for (int i = 0; i < n; i++) {
d[i] = lo + l * d[i];
}
} } | public class class_name {
public void nextDoubles(double[] d, double lo, double hi) {
real.nextDoubles(d);
double l = hi - lo;
int n = d.length;
for (int i = 0; i < n; i++) {
d[i] = lo + l * d[i]; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static final StringBuffer asStringBuffer(WsByteBuffer[] list) {
StringBuffer sb = new StringBuffer();
String data = asString(list);
if (null != data) {
sb.append(data);
}
return sb;
} } | public class class_name {
public static final StringBuffer asStringBuffer(WsByteBuffer[] list) {
StringBuffer sb = new StringBuffer();
String data = asString(list);
if (null != data) {
sb.append(data); // depends on control dependency: [if], data = [data)]
}
return sb;
} } |
public class class_name {
protected void setDragAndDropMessage() {
if (m_dragAndDropMessage == null) {
m_dragAndDropMessage = new HTML();
m_dragAndDropMessage.setStyleName(I_CmsLayoutBundle.INSTANCE.uploadCss().dragAndDropMessage());
m_dragAndDropMessage.setText(Messages.get().key(Messages.GUI_UPLOAD_DRAG_AND_DROP_DISABLED_0));
}
getContentWrapper().add(m_dragAndDropMessage);
getContentWrapper().getElement().getStyle().setBackgroundColor(
I_CmsConstantsBundle.INSTANCE.css().notificationErrorBg());
doResize();
} } | public class class_name {
protected void setDragAndDropMessage() {
if (m_dragAndDropMessage == null) {
m_dragAndDropMessage = new HTML(); // depends on control dependency: [if], data = [none]
m_dragAndDropMessage.setStyleName(I_CmsLayoutBundle.INSTANCE.uploadCss().dragAndDropMessage()); // depends on control dependency: [if], data = [none]
m_dragAndDropMessage.setText(Messages.get().key(Messages.GUI_UPLOAD_DRAG_AND_DROP_DISABLED_0)); // depends on control dependency: [if], data = [none]
}
getContentWrapper().add(m_dragAndDropMessage);
getContentWrapper().getElement().getStyle().setBackgroundColor(
I_CmsConstantsBundle.INSTANCE.css().notificationErrorBg());
doResize();
} } |
public class class_name {
public void onTransformChanged() {
Log.v(Log.SUBSYSTEM.WIDGET, TAG, "onTransformChanged(): %s mPreventTransformChanged = %b",
getName(), mPreventTransformChanged);
// Even if the calling code that altered the transform doesn't request a
// layout, we'll do a layout the next time a layout is requested on our
// part of the scene graph.
if (!mPreventTransformChanged) {
mChanged = true;
// Clear this to indicate that the bounding box has been invalidated and
// needs to be constructed and transformed anew.
mBoundingBox = null;
}
} } | public class class_name {
public void onTransformChanged() {
Log.v(Log.SUBSYSTEM.WIDGET, TAG, "onTransformChanged(): %s mPreventTransformChanged = %b",
getName(), mPreventTransformChanged);
// Even if the calling code that altered the transform doesn't request a
// layout, we'll do a layout the next time a layout is requested on our
// part of the scene graph.
if (!mPreventTransformChanged) {
mChanged = true; // depends on control dependency: [if], data = [none]
// Clear this to indicate that the bounding box has been invalidated and
// needs to be constructed and transformed anew.
mBoundingBox = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public byte[] toByteArray()
{
final byte[] buf = super.toByteArray();
int i = 2;
for (final Iterator it = map.entrySet().iterator(); it.hasNext();) {
final Map.Entry e = (Map.Entry) it.next();
buf[i++] = ((Short) e.getKey()).byteValue();
buf[i++] = ((Short) e.getValue()).byteValue();
}
return buf;
} } | public class class_name {
public byte[] toByteArray()
{
final byte[] buf = super.toByteArray();
int i = 2;
for (final Iterator it = map.entrySet().iterator(); it.hasNext();) {
final Map.Entry e = (Map.Entry) it.next();
buf[i++] = ((Short) e.getKey()).byteValue();
// depends on control dependency: [for], data = [none]
buf[i++] = ((Short) e.getValue()).byteValue();
// depends on control dependency: [for], data = [none]
}
return buf;
} } |
public class class_name {
private boolean closeAll(Context context)
{
boolean unclosed = false;
CloseConnectionSynchronization ccs = getCloseConnectionSynchronization(true);
for (org.ironjacamar.core.connectionmanager.ConnectionManager cm : context.getConnectionManagers())
{
for (org.ironjacamar.core.connectionmanager.listener.ConnectionListener cl :
context.getConnectionListeners(cm))
{
for (Object c : context.getConnections(cl))
{
if (ccs == null)
{
unclosed = true;
if (Tracer.isEnabled())
{
Tracer.closeCCMConnection(cl.getManagedConnectionPool().getPool()
.getConfiguration().getId(),
cl.getManagedConnectionPool(),
cl, c, context.toString());
}
closeConnection(c);
}
else
{
ccs.add(c);
}
}
}
}
return unclosed;
} } | public class class_name {
private boolean closeAll(Context context)
{
boolean unclosed = false;
CloseConnectionSynchronization ccs = getCloseConnectionSynchronization(true);
for (org.ironjacamar.core.connectionmanager.ConnectionManager cm : context.getConnectionManagers())
{
for (org.ironjacamar.core.connectionmanager.listener.ConnectionListener cl :
context.getConnectionListeners(cm))
{
for (Object c : context.getConnections(cl))
{
if (ccs == null)
{
unclosed = true; // depends on control dependency: [if], data = [none]
if (Tracer.isEnabled())
{
Tracer.closeCCMConnection(cl.getManagedConnectionPool().getPool()
.getConfiguration().getId(),
cl.getManagedConnectionPool(),
cl, c, context.toString()); // depends on control dependency: [if], data = [none]
}
closeConnection(c); // depends on control dependency: [if], data = [none]
}
else
{
ccs.add(c); // depends on control dependency: [if], data = [none]
}
}
}
}
return unclosed;
} } |
public class class_name {
public static int sizeOfSimpleStatementValues(
SimpleStatement simpleStatement,
ProtocolVersion protocolVersion,
CodecRegistry codecRegistry) {
int size = 0;
if (!simpleStatement.getPositionalValues().isEmpty()) {
List<ByteBuffer> positionalValues =
new ArrayList<>(simpleStatement.getPositionalValues().size());
for (Object value : simpleStatement.getPositionalValues()) {
positionalValues.add(Conversions.encode(value, codecRegistry, protocolVersion));
}
size += Values.sizeOfPositionalValues(positionalValues);
} else if (!simpleStatement.getNamedValues().isEmpty()) {
Map<String, ByteBuffer> namedValues = new HashMap<>(simpleStatement.getNamedValues().size());
for (Map.Entry<CqlIdentifier, Object> value : simpleStatement.getNamedValues().entrySet()) {
namedValues.put(
value.getKey().asInternal(),
Conversions.encode(value.getValue(), codecRegistry, protocolVersion));
}
size += Values.sizeOfNamedValues(namedValues);
}
return size;
} } | public class class_name {
public static int sizeOfSimpleStatementValues(
SimpleStatement simpleStatement,
ProtocolVersion protocolVersion,
CodecRegistry codecRegistry) {
int size = 0;
if (!simpleStatement.getPositionalValues().isEmpty()) {
List<ByteBuffer> positionalValues =
new ArrayList<>(simpleStatement.getPositionalValues().size());
for (Object value : simpleStatement.getPositionalValues()) {
positionalValues.add(Conversions.encode(value, codecRegistry, protocolVersion)); // depends on control dependency: [for], data = [value]
}
size += Values.sizeOfPositionalValues(positionalValues); // depends on control dependency: [if], data = [none]
} else if (!simpleStatement.getNamedValues().isEmpty()) {
Map<String, ByteBuffer> namedValues = new HashMap<>(simpleStatement.getNamedValues().size());
for (Map.Entry<CqlIdentifier, Object> value : simpleStatement.getNamedValues().entrySet()) {
namedValues.put(
value.getKey().asInternal(),
Conversions.encode(value.getValue(), codecRegistry, protocolVersion)); // depends on control dependency: [for], data = [none]
}
size += Values.sizeOfNamedValues(namedValues); // depends on control dependency: [if], data = [none]
}
return size;
} } |
public class class_name {
public double getCumulativeElapsedTimeAllGlobal() {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
double sum = 0;
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += accumulatedTimesHolder[i];
}
return sum;
} } | public class class_name {
public double getCumulativeElapsedTimeAllGlobal() {
final long[] accumulatedTimesHolder = new long[NUM_EVENTS];
globalAcc.consultAccumulatedTimes(accumulatedTimesHolder);
double sum = 0;
for (int i = 1; i <= ProfilingEvent.EXECUTED.ordinal(); ++i) {
sum += accumulatedTimesHolder[i]; // depends on control dependency: [for], data = [i]
}
return sum;
} } |
public class class_name {
public void marshall(ListClustersRequest listClustersRequest, ProtocolMarshaller protocolMarshaller) {
if (listClustersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listClustersRequest.getCreatedAfter(), CREATEDAFTER_BINDING);
protocolMarshaller.marshall(listClustersRequest.getCreatedBefore(), CREATEDBEFORE_BINDING);
protocolMarshaller.marshall(listClustersRequest.getClusterStates(), CLUSTERSTATES_BINDING);
protocolMarshaller.marshall(listClustersRequest.getMarker(), MARKER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListClustersRequest listClustersRequest, ProtocolMarshaller protocolMarshaller) {
if (listClustersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listClustersRequest.getCreatedAfter(), CREATEDAFTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listClustersRequest.getCreatedBefore(), CREATEDBEFORE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listClustersRequest.getClusterStates(), CLUSTERSTATES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listClustersRequest.getMarker(), MARKER_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 {
void fireBeforeTriggers(Session session, int trigVecIndex,
Object[] oldData, Object[] newData, int[] cols) {
if (!database.isReferentialIntegrity()) {
return;
}
TriggerDef[] trigVec = triggerLists[trigVecIndex];
for (int i = 0, size = trigVec.length; i < size; i++) {
TriggerDef td = trigVec[i];
boolean sqlTrigger = td instanceof TriggerDefSQL;
if (cols != null && td.getUpdateColumnIndexes() != null
&& !ArrayUtil.haveCommonElement(
td.getUpdateColumnIndexes(), cols, cols.length)) {
continue;
}
if (td.isForEachRow()) {
switch (td.triggerType) {
case Trigger.UPDATE_BEFORE_ROW :
case Trigger.DELETE_BEFORE_ROW :
if (!sqlTrigger) {
oldData =
(Object[]) ArrayUtil.duplicateArray(oldData);
}
break;
}
td.pushPair(session, oldData, newData);
} else {
td.pushPair(session, null, null);
}
}
} } | public class class_name {
void fireBeforeTriggers(Session session, int trigVecIndex,
Object[] oldData, Object[] newData, int[] cols) {
if (!database.isReferentialIntegrity()) {
return; // depends on control dependency: [if], data = [none]
}
TriggerDef[] trigVec = triggerLists[trigVecIndex];
for (int i = 0, size = trigVec.length; i < size; i++) {
TriggerDef td = trigVec[i];
boolean sqlTrigger = td instanceof TriggerDefSQL;
if (cols != null && td.getUpdateColumnIndexes() != null
&& !ArrayUtil.haveCommonElement(
td.getUpdateColumnIndexes(), cols, cols.length)) {
continue;
}
if (td.isForEachRow()) {
switch (td.triggerType) {
case Trigger.UPDATE_BEFORE_ROW :
case Trigger.DELETE_BEFORE_ROW :
if (!sqlTrigger) {
oldData =
(Object[]) ArrayUtil.duplicateArray(oldData); // depends on control dependency: [if], data = [none]
}
break;
}
td.pushPair(session, oldData, newData); // depends on control dependency: [if], data = [none]
} else {
td.pushPair(session, null, null); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(AccessLog accessLog, ProtocolMarshaller protocolMarshaller) {
if (accessLog == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(accessLog.getFile(), FILE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(AccessLog accessLog, ProtocolMarshaller protocolMarshaller) {
if (accessLog == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(accessLog.getFile(), FILE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public String getAttributeName() {
if (delegate instanceof AttributeDefinitionSpecification) {
return ((AttributeDefinitionSpecification) delegate).getAttributeName();
}
return delegate.getName();
} } | public class class_name {
@Override
public String getAttributeName() {
if (delegate instanceof AttributeDefinitionSpecification) {
return ((AttributeDefinitionSpecification) delegate).getAttributeName(); // depends on control dependency: [if], data = [none]
}
return delegate.getName();
} } |
public class class_name {
static boolean functionCallHasSideEffects(
Node callNode, @Nullable AbstractCompiler compiler) {
checkState(callNode.isCall() || callNode.isTaggedTemplateLit(), callNode);
if (callNode.isNoSideEffectsCall()) {
return false;
}
if (callNode.isOnlyModifiesArgumentsCall()
&& allArgsUnescapedLocal(callNode)) {
return false;
}
Node callee = callNode.getFirstChild();
// Built-in functions with no side effects.
if (callee.isName()) {
String name = callee.getString();
if (BUILTIN_FUNCTIONS_WITHOUT_SIDEEFFECTS.contains(name)) {
return false;
}
} else if (callee.isGetProp()) {
if (callNode.hasOneChild()
&& OBJECT_METHODS_WITHOUT_SIDEEFFECTS.contains(callee.getLastChild().getString())) {
return false;
}
if (callNode.isOnlyModifiesThisCall()
&& evaluatesToLocalValue(callee.getFirstChild())) {
return false;
}
// Many common Math functions have no side-effects.
// TODO(nicksantos): This is a terrible terrible hack, until
// I create a definitionProvider that understands namespacing.
if (callee.getFirstChild().isName() && callee.isQualifiedName()
&& callee.getFirstChild().getString().equals("Math")) {
switch(callee.getLastChild().getString()) {
case "abs":
case "acos":
case "acosh":
case "asin":
case "asinh":
case "atan":
case "atanh":
case "atan2":
case "cbrt":
case "ceil":
case "cos":
case "cosh":
case "exp":
case "expm1":
case "floor":
case "hypot":
case "log":
case "log10":
case "log1p":
case "log2":
case "max":
case "min":
case "pow":
case "round":
case "sign":
case "sin":
case "sinh":
case "sqrt":
case "tan":
case "tanh":
case "trunc":
return false;
case "random":
return !callNode.hasOneChild(); // no parameters
default:
// Unknown Math.* function, so fall out of this switch statement.
}
}
if (compiler != null && !compiler.hasRegExpGlobalReferences()) {
if (callee.getFirstChild().isRegExp()
&& REGEXP_METHODS.contains(callee.getLastChild().getString())) {
return false;
} else if (isTypedAsString(callee.getFirstChild(), compiler)) {
// Unlike regexs, string methods don't need to be hosted on a string literal
// to avoid leaking mutating global state changes, it is just necessary that
// the regex object can't be referenced.
String method = callee.getLastChild().getString();
Node param = callee.getNext();
if (param != null) {
if (param.isString()) {
if (STRING_REGEXP_METHODS.contains(method)) {
return false;
}
} else if (param.isRegExp()) {
if ("replace".equals(method)) {
// Assume anything but a string constant has side-effects
return !param.getNext().isString();
} else if (STRING_REGEXP_METHODS.contains(method)) {
return false;
}
}
}
}
}
}
return true;
} } | public class class_name {
static boolean functionCallHasSideEffects(
Node callNode, @Nullable AbstractCompiler compiler) {
checkState(callNode.isCall() || callNode.isTaggedTemplateLit(), callNode);
if (callNode.isNoSideEffectsCall()) {
return false; // depends on control dependency: [if], data = [none]
}
if (callNode.isOnlyModifiesArgumentsCall()
&& allArgsUnescapedLocal(callNode)) {
return false; // depends on control dependency: [if], data = [none]
}
Node callee = callNode.getFirstChild();
// Built-in functions with no side effects.
if (callee.isName()) {
String name = callee.getString();
if (BUILTIN_FUNCTIONS_WITHOUT_SIDEEFFECTS.contains(name)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (callee.isGetProp()) {
if (callNode.hasOneChild()
&& OBJECT_METHODS_WITHOUT_SIDEEFFECTS.contains(callee.getLastChild().getString())) {
return false; // depends on control dependency: [if], data = [none]
}
if (callNode.isOnlyModifiesThisCall()
&& evaluatesToLocalValue(callee.getFirstChild())) {
return false; // depends on control dependency: [if], data = [none]
}
// Many common Math functions have no side-effects.
// TODO(nicksantos): This is a terrible terrible hack, until
// I create a definitionProvider that understands namespacing.
if (callee.getFirstChild().isName() && callee.isQualifiedName()
&& callee.getFirstChild().getString().equals("Math")) {
switch(callee.getLastChild().getString()) {
case "abs":
case "acos":
case "acosh":
case "asin":
case "asinh":
case "atan":
case "atanh":
case "atan2":
case "cbrt":
case "ceil":
case "cos":
case "cosh":
case "exp":
case "expm1":
case "floor":
case "hypot":
case "log":
case "log10":
case "log1p":
case "log2":
case "max":
case "min":
case "pow":
case "round":
case "sign":
case "sin":
case "sinh":
case "sqrt":
case "tan":
case "tanh":
case "trunc":
return false;
case "random":
return !callNode.hasOneChild(); // no parameters
default:
// Unknown Math.* function, so fall out of this switch statement.
}
}
if (compiler != null && !compiler.hasRegExpGlobalReferences()) {
if (callee.getFirstChild().isRegExp()
&& REGEXP_METHODS.contains(callee.getLastChild().getString())) {
return false; // depends on control dependency: [if], data = [none]
} else if (isTypedAsString(callee.getFirstChild(), compiler)) {
// Unlike regexs, string methods don't need to be hosted on a string literal
// to avoid leaking mutating global state changes, it is just necessary that
// the regex object can't be referenced.
String method = callee.getLastChild().getString();
Node param = callee.getNext();
if (param != null) {
if (param.isString()) {
if (STRING_REGEXP_METHODS.contains(method)) {
return false; // depends on control dependency: [if], data = [none]
}
} else if (param.isRegExp()) {
if ("replace".equals(method)) {
// Assume anything but a string constant has side-effects
return !param.getNext().isString(); // depends on control dependency: [if], data = [none]
} else if (STRING_REGEXP_METHODS.contains(method)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
}
}
}
return true;
} } |
public class class_name {
public void marshall(DeleteListenerRequest deleteListenerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteListenerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteListenerRequest.getListenerArn(), LISTENERARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteListenerRequest deleteListenerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteListenerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteListenerRequest.getListenerArn(), LISTENERARN_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 Selection add(Selection operand) {
Function[] fns;
if (operand.isEmpty()) {
return this;
} else if (this.isEmpty()) {
return operand;
} else {
fns = new Function[size() + operand.size()];
System.arraycopy(functions, 0, fns, 0, size());
System.arraycopy(operand.functions, 0, fns, size(), operand.size());
return new Selection(fns);
}
} } | public class class_name {
public Selection add(Selection operand) {
Function[] fns;
if (operand.isEmpty()) {
return this; // depends on control dependency: [if], data = [none]
} else if (this.isEmpty()) {
return operand; // depends on control dependency: [if], data = [none]
} else {
fns = new Function[size() + operand.size()]; // depends on control dependency: [if], data = [none]
System.arraycopy(functions, 0, fns, 0, size()); // depends on control dependency: [if], data = [none]
System.arraycopy(operand.functions, 0, fns, size(), operand.size()); // depends on control dependency: [if], data = [none]
return new Selection(fns); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void printStackTrace(PrintWriter printWriter) {
if (mStackTrace == null) {
printWriter.print(getMessage());
}
else {
printWriter.print(mStackTrace);
}
} } | public class class_name {
public void printStackTrace(PrintWriter printWriter) {
if (mStackTrace == null) {
printWriter.print(getMessage()); // depends on control dependency: [if], data = [none]
}
else {
printWriter.print(mStackTrace); // depends on control dependency: [if], data = [(mStackTrace]
}
} } |
public class class_name {
public void marshall(UpdateResourceShareRequest updateResourceShareRequest, ProtocolMarshaller protocolMarshaller) {
if (updateResourceShareRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateResourceShareRequest.getResourceShareArn(), RESOURCESHAREARN_BINDING);
protocolMarshaller.marshall(updateResourceShareRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateResourceShareRequest.getAllowExternalPrincipals(), ALLOWEXTERNALPRINCIPALS_BINDING);
protocolMarshaller.marshall(updateResourceShareRequest.getClientToken(), CLIENTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateResourceShareRequest updateResourceShareRequest, ProtocolMarshaller protocolMarshaller) {
if (updateResourceShareRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateResourceShareRequest.getResourceShareArn(), RESOURCESHAREARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateResourceShareRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateResourceShareRequest.getAllowExternalPrincipals(), ALLOWEXTERNALPRINCIPALS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateResourceShareRequest.getClientToken(), CLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Set<BeanDefinitionHolder> doScan(String... basePackages) {
Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);
if (beanDefinitions.isEmpty()) {
logger.warn("No MyBatis mapper was found in '" + Arrays.toString(basePackages) + "' package. Please check your configuration.");
} else {
for (BeanDefinitionHolder holder : beanDefinitions) {
GenericBeanDefinition definition = (GenericBeanDefinition) holder.getBeanDefinition();
if (logger.isDebugEnabled()) {
logger.debug("Creating MapperFactoryBean with name '" + holder.getBeanName() + "' and '" + definition.getBeanClassName() + "' mapperInterface");
}
// the mapper interface is the original class of the bean
// but, the actual class of the bean is MapperFactoryBean
definition.getPropertyValues().add("mapperInterface", definition.getBeanClassName());
definition.setBeanClass(MapperFactoryBean.class);
definition.getPropertyValues().add("addToConfig", this.addToConfig);
boolean explicitFactoryUsed = false;
if (StringUtils.hasText(this.sqlSessionFactoryBeanName)) {
definition.getPropertyValues().add("sqlSessionFactory", new RuntimeBeanReference(this.sqlSessionFactoryBeanName));
explicitFactoryUsed = true;
} else if (this.sqlSessionFactory != null) {
definition.getPropertyValues().add("sqlSessionFactory", this.sqlSessionFactory);
explicitFactoryUsed = true;
}
if (StringUtils.hasText(this.sqlSessionTemplateBeanName)) {
if (explicitFactoryUsed) {
logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
}
definition.getPropertyValues().add("sqlSessionTemplate", new RuntimeBeanReference(this.sqlSessionTemplateBeanName));
explicitFactoryUsed = true;
} else if (this.sqlSessionTemplate != null) {
if (explicitFactoryUsed) {
logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
}
definition.getPropertyValues().add("sqlSessionTemplate", this.sqlSessionTemplate);
explicitFactoryUsed = true;
}
if (!explicitFactoryUsed) {
if (logger.isDebugEnabled()) {
logger.debug("Enabling autowire by type for MapperFactoryBean with name '" + holder.getBeanName() + "'.");
}
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
}
}
}
return beanDefinitions;
} } | public class class_name {
@Override
public Set<BeanDefinitionHolder> doScan(String... basePackages) {
Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);
if (beanDefinitions.isEmpty()) {
logger.warn("No MyBatis mapper was found in '" + Arrays.toString(basePackages) + "' package. Please check your configuration."); // depends on control dependency: [if], data = [none]
} else {
for (BeanDefinitionHolder holder : beanDefinitions) {
GenericBeanDefinition definition = (GenericBeanDefinition) holder.getBeanDefinition();
if (logger.isDebugEnabled()) {
logger.debug("Creating MapperFactoryBean with name '" + holder.getBeanName() + "' and '" + definition.getBeanClassName() + "' mapperInterface"); // depends on control dependency: [if], data = [none]
}
// the mapper interface is the original class of the bean
// but, the actual class of the bean is MapperFactoryBean
definition.getPropertyValues().add("mapperInterface", definition.getBeanClassName()); // depends on control dependency: [for], data = [none]
definition.setBeanClass(MapperFactoryBean.class); // depends on control dependency: [for], data = [none]
definition.getPropertyValues().add("addToConfig", this.addToConfig); // depends on control dependency: [for], data = [none]
boolean explicitFactoryUsed = false;
if (StringUtils.hasText(this.sqlSessionFactoryBeanName)) {
definition.getPropertyValues().add("sqlSessionFactory", new RuntimeBeanReference(this.sqlSessionFactoryBeanName)); // depends on control dependency: [if], data = [none]
explicitFactoryUsed = true; // depends on control dependency: [if], data = [none]
} else if (this.sqlSessionFactory != null) {
definition.getPropertyValues().add("sqlSessionFactory", this.sqlSessionFactory); // depends on control dependency: [if], data = [none]
explicitFactoryUsed = true; // depends on control dependency: [if], data = [none]
}
if (StringUtils.hasText(this.sqlSessionTemplateBeanName)) {
if (explicitFactoryUsed) {
logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored."); // depends on control dependency: [if], data = [none]
}
definition.getPropertyValues().add("sqlSessionTemplate", new RuntimeBeanReference(this.sqlSessionTemplateBeanName)); // depends on control dependency: [if], data = [none]
explicitFactoryUsed = true; // depends on control dependency: [if], data = [none]
} else if (this.sqlSessionTemplate != null) {
if (explicitFactoryUsed) {
logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored."); // depends on control dependency: [if], data = [none]
}
definition.getPropertyValues().add("sqlSessionTemplate", this.sqlSessionTemplate); // depends on control dependency: [if], data = [none]
explicitFactoryUsed = true; // depends on control dependency: [if], data = [none]
}
if (!explicitFactoryUsed) {
if (logger.isDebugEnabled()) {
logger.debug("Enabling autowire by type for MapperFactoryBean with name '" + holder.getBeanName() + "'."); // depends on control dependency: [if], data = [none]
}
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE); // depends on control dependency: [if], data = [none]
}
}
}
return beanDefinitions;
} } |
public class class_name {
protected void createDefaultLevels() {
this.listLevels = new ArrayList(); // listlevels
for(int i=0; i<=8; i++) {
// create a list level
RtfListLevel ll = new RtfListLevel(this.document);
ll.setListType(RtfListLevel.LIST_TYPE_NUMBERED);
ll.setFirstIndent(0);
ll.setLeftIndent(0);
ll.setLevelTextNumber(i);
ll.setTentative(true);
ll.correctIndentation();
this.listLevels.add(ll);
}
} } | public class class_name {
protected void createDefaultLevels() {
this.listLevels = new ArrayList(); // listlevels
for(int i=0; i<=8; i++) {
// create a list level
RtfListLevel ll = new RtfListLevel(this.document);
ll.setListType(RtfListLevel.LIST_TYPE_NUMBERED); // depends on control dependency: [for], data = [none]
ll.setFirstIndent(0); // depends on control dependency: [for], data = [none]
ll.setLeftIndent(0); // depends on control dependency: [for], data = [none]
ll.setLevelTextNumber(i); // depends on control dependency: [for], data = [i]
ll.setTentative(true); // depends on control dependency: [for], data = [none]
ll.correctIndentation(); // depends on control dependency: [for], data = [none]
this.listLevels.add(ll); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public int updateObjByCondition(String tableName, String condition,String setStr) {
//JdbcTemplate jdbcTemplate = (JdbcTemplate) MicroDbHolder.getDbSource(dbName);
//String tableName=changeTableNameCase(otableName);
JdbcTemplate jdbcTemplate =getMicroJdbcTemplate();
String timeName=getTimeName();
if(autoOperTime){
setStr="update_time="+timeName+","+setStr;
}
String sql = "update " + tableName +" set "+setStr+ " where "+condition;
logger.debug(sql);
Integer retStatus=jdbcTemplate.update(sql);
return retStatus;
} } | public class class_name {
public int updateObjByCondition(String tableName, String condition,String setStr) {
//JdbcTemplate jdbcTemplate = (JdbcTemplate) MicroDbHolder.getDbSource(dbName);
//String tableName=changeTableNameCase(otableName);
JdbcTemplate jdbcTemplate =getMicroJdbcTemplate();
String timeName=getTimeName();
if(autoOperTime){
setStr="update_time="+timeName+","+setStr;
// depends on control dependency: [if], data = [none]
}
String sql = "update " + tableName +" set "+setStr+ " where "+condition;
logger.debug(sql);
Integer retStatus=jdbcTemplate.update(sql);
return retStatus;
} } |
public class class_name {
public void marshall(RemovePermissionRequest removePermissionRequest, ProtocolMarshaller protocolMarshaller) {
if (removePermissionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removePermissionRequest.getFunctionName(), FUNCTIONNAME_BINDING);
protocolMarshaller.marshall(removePermissionRequest.getStatementId(), STATEMENTID_BINDING);
protocolMarshaller.marshall(removePermissionRequest.getQualifier(), QUALIFIER_BINDING);
protocolMarshaller.marshall(removePermissionRequest.getRevisionId(), REVISIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RemovePermissionRequest removePermissionRequest, ProtocolMarshaller protocolMarshaller) {
if (removePermissionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removePermissionRequest.getFunctionName(), FUNCTIONNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removePermissionRequest.getStatementId(), STATEMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removePermissionRequest.getQualifier(), QUALIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removePermissionRequest.getRevisionId(), REVISIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public int getItemViewType(int position) {
Pair<AdapterDataObserver, Adapter> p = findAdapterByPosition(position);
if (p == null) {
return RecyclerView.INVALID_TYPE;
}
int subItemType = p.second.getItemViewType(position - p.first.mStartPosition);
if (subItemType < 0) {
// negative integer, invalid, just return
return subItemType;
}
if (mHasConsistItemType) {
mItemTypeAry.put(subItemType, p.second);
return subItemType;
}
int index = p.first.mIndex;
return (int) Cantor.getCantor(subItemType, index);
} } | public class class_name {
@Override
public int getItemViewType(int position) {
Pair<AdapterDataObserver, Adapter> p = findAdapterByPosition(position);
if (p == null) {
return RecyclerView.INVALID_TYPE; // depends on control dependency: [if], data = [none]
}
int subItemType = p.second.getItemViewType(position - p.first.mStartPosition);
if (subItemType < 0) {
// negative integer, invalid, just return
return subItemType; // depends on control dependency: [if], data = [none]
}
if (mHasConsistItemType) {
mItemTypeAry.put(subItemType, p.second); // depends on control dependency: [if], data = [none]
return subItemType; // depends on control dependency: [if], data = [none]
}
int index = p.first.mIndex;
return (int) Cantor.getCantor(subItemType, index);
} } |
public class class_name {
@Override
public Set<String> getJcrRepositoryNames() {
try {
return ((ModeshapeRepositoryFactory) repositoryFactory).getRepositoryNames();
} catch (RepositoryException e) {
LOGGER.error(WebJcrI18n.cannotLoadRepositoryNames.text(), e);
return Collections.emptySet();
}
} } | public class class_name {
@Override
public Set<String> getJcrRepositoryNames() {
try {
return ((ModeshapeRepositoryFactory) repositoryFactory).getRepositoryNames(); // depends on control dependency: [try], data = [none]
} catch (RepositoryException e) {
LOGGER.error(WebJcrI18n.cannotLoadRepositoryNames.text(), e);
return Collections.emptySet();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void learn(double[] x, double y) {
if (x.length != p) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, p));
}
System.arraycopy(x, 0, x1, 0, p);
double v = 1 + V.xax(x1);
// If 1/v is NaN, then the update to V will no longer be invertible.
// See https://en.wikipedia.org/wiki/Sherman%E2%80%93Morrison_formula#Statement
if (Double.isNaN(1/v)){
throw new IllegalStateException("The updated V matrix is no longer invertible.");
}
V.ax(x1, Vx);
for (int j = 0; j <= p; j++) {
for (int i = 0; i <= p; i++) {
double tmp = V.get(i, j) - ((Vx[i] * Vx[j])/v);
V.set(i, j, tmp/lambda);
}
}
// V has been updated. Compute Vx again.
V.ax(x1, Vx);
double err = y - predict(x);
for (int i = 0; i <= p; i++){
w[i] += Vx[i] * err;
}
} } | public class class_name {
@Override
public void learn(double[] x, double y) {
if (x.length != p) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d, expected: %d", x.length, p));
}
System.arraycopy(x, 0, x1, 0, p);
double v = 1 + V.xax(x1);
// If 1/v is NaN, then the update to V will no longer be invertible.
// See https://en.wikipedia.org/wiki/Sherman%E2%80%93Morrison_formula#Statement
if (Double.isNaN(1/v)){
throw new IllegalStateException("The updated V matrix is no longer invertible.");
}
V.ax(x1, Vx);
for (int j = 0; j <= p; j++) {
for (int i = 0; i <= p; i++) {
double tmp = V.get(i, j) - ((Vx[i] * Vx[j])/v);
V.set(i, j, tmp/lambda); // depends on control dependency: [for], data = [i]
}
}
// V has been updated. Compute Vx again.
V.ax(x1, Vx);
double err = y - predict(x);
for (int i = 0; i <= p; i++){
w[i] += Vx[i] * err; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public MetricResponse getMetrics(
MetricRequest request, MetricsFilter metricNameType) {
LOG.fine("received query: " + request.toString());
synchronized (CacheCore.class) {
List<MetricDatum> response = new LinkedList<>();
// candidate metric names
Set<String> metricNameFilter = request.getMetricNames();
if (metricNameFilter == null) {
metricNameFilter = idxMetricName.keySet();
}
// candidate component names
Map<String, Set<String>> componentInstanceMap = request.getComponentNameInstanceId();
Set<String> componentNameFilter;
if (componentInstanceMap == null) {
componentNameFilter = idxComponentInstance.keySet();
} else {
componentNameFilter = componentInstanceMap.keySet();
}
for (String metricName : metricNameFilter) {
if (!metricExists(metricName)) {
continue;
}
MetricsFilter.MetricAggregationType type = metricNameType.getAggregationType(metricName);
for (String componentName : componentNameFilter) {
// candidate instance ids
Set<String> instanceIdFilter;
if (componentInstanceMap == null
|| componentInstanceMap.get(componentName) == null) {
instanceIdFilter = idxComponentInstance.get(componentName).keySet();
} else {
instanceIdFilter = componentInstanceMap.get(componentName);
}
for (String instanceId : instanceIdFilter) {
LOG.fine(componentName + "; " + instanceId + "; " + metricName + "; " + type);
// get bucket_id
int idx1 = idxComponentInstance.get(componentName).get(instanceId);
int idx2 = idxMetricName.get(metricName);
long bucketId = makeBucketId(idx1, idx2);
// iterate buckets: the result may be empty due to the bucketId/hash filter
List<MetricTimeRangeValue> metricValue = new LinkedList<>();
switch (request.getAggregationGranularity()) {
case AGGREGATE_ALL_METRICS:
case AGGREGATE_BY_BUCKET:
getAggregatedMetrics(metricValue,
request.getStartTime()/*when*/, request.getEndTime()/*when*/,
bucketId/*where*/, type/*how*/, request.getAggregationGranularity());
break;
case RAW:
getRawMetrics(metricValue,
request.getStartTime(), request.getEndTime(), bucketId, type);
break;
default:
LOG.warning("unknown aggregationGranularity type "
+ request.getAggregationGranularity());
}
// make metric list in response
response.add(new MetricDatum(componentName, instanceId, metricName, metricValue));
} // end for: instance
} // end for: component
} // end for: metric
return new MetricResponse(response);
}
} } | public class class_name {
public MetricResponse getMetrics(
MetricRequest request, MetricsFilter metricNameType) {
LOG.fine("received query: " + request.toString());
synchronized (CacheCore.class) {
List<MetricDatum> response = new LinkedList<>();
// candidate metric names
Set<String> metricNameFilter = request.getMetricNames();
if (metricNameFilter == null) {
metricNameFilter = idxMetricName.keySet(); // depends on control dependency: [if], data = [none]
}
// candidate component names
Map<String, Set<String>> componentInstanceMap = request.getComponentNameInstanceId();
Set<String> componentNameFilter;
if (componentInstanceMap == null) {
componentNameFilter = idxComponentInstance.keySet(); // depends on control dependency: [if], data = [none]
} else {
componentNameFilter = componentInstanceMap.keySet(); // depends on control dependency: [if], data = [none]
}
for (String metricName : metricNameFilter) {
if (!metricExists(metricName)) {
continue;
}
MetricsFilter.MetricAggregationType type = metricNameType.getAggregationType(metricName);
for (String componentName : componentNameFilter) {
// candidate instance ids
Set<String> instanceIdFilter;
if (componentInstanceMap == null
|| componentInstanceMap.get(componentName) == null) {
instanceIdFilter = idxComponentInstance.get(componentName).keySet(); // depends on control dependency: [if], data = [none]
} else {
instanceIdFilter = componentInstanceMap.get(componentName); // depends on control dependency: [if], data = [none]
}
for (String instanceId : instanceIdFilter) {
LOG.fine(componentName + "; " + instanceId + "; " + metricName + "; " + type); // depends on control dependency: [for], data = [instanceId]
// get bucket_id
int idx1 = idxComponentInstance.get(componentName).get(instanceId);
int idx2 = idxMetricName.get(metricName);
long bucketId = makeBucketId(idx1, idx2);
// iterate buckets: the result may be empty due to the bucketId/hash filter
List<MetricTimeRangeValue> metricValue = new LinkedList<>();
switch (request.getAggregationGranularity()) {
case AGGREGATE_ALL_METRICS:
case AGGREGATE_BY_BUCKET:
getAggregatedMetrics(metricValue,
request.getStartTime()/*when*/, request.getEndTime()/*when*/,
bucketId/*where*/, type/*how*/, request.getAggregationGranularity());
break;
case RAW:
getRawMetrics(metricValue,
request.getStartTime(), request.getEndTime(), bucketId, type);
break;
default:
LOG.warning("unknown aggregationGranularity type "
+ request.getAggregationGranularity());
}
// make metric list in response
response.add(new MetricDatum(componentName, instanceId, metricName, metricValue)); // depends on control dependency: [for], data = [componentName]
} // end for: instance
} // end for: component
} // end for: metric
return new MetricResponse(response);
}
} } |
public class class_name {
public void marshall(DeviceData deviceData, ProtocolMarshaller protocolMarshaller) {
if (deviceData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceData.getDeviceArn(), DEVICEARN_BINDING);
protocolMarshaller.marshall(deviceData.getDeviceSerialNumber(), DEVICESERIALNUMBER_BINDING);
protocolMarshaller.marshall(deviceData.getDeviceType(), DEVICETYPE_BINDING);
protocolMarshaller.marshall(deviceData.getDeviceName(), DEVICENAME_BINDING);
protocolMarshaller.marshall(deviceData.getSoftwareVersion(), SOFTWAREVERSION_BINDING);
protocolMarshaller.marshall(deviceData.getMacAddress(), MACADDRESS_BINDING);
protocolMarshaller.marshall(deviceData.getDeviceStatus(), DEVICESTATUS_BINDING);
protocolMarshaller.marshall(deviceData.getRoomArn(), ROOMARN_BINDING);
protocolMarshaller.marshall(deviceData.getRoomName(), ROOMNAME_BINDING);
protocolMarshaller.marshall(deviceData.getDeviceStatusInfo(), DEVICESTATUSINFO_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeviceData deviceData, ProtocolMarshaller protocolMarshaller) {
if (deviceData == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deviceData.getDeviceArn(), DEVICEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getDeviceSerialNumber(), DEVICESERIALNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getDeviceType(), DEVICETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getDeviceName(), DEVICENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getSoftwareVersion(), SOFTWAREVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getMacAddress(), MACADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getDeviceStatus(), DEVICESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getRoomArn(), ROOMARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getRoomName(), ROOMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deviceData.getDeviceStatusInfo(), DEVICESTATUSINFO_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void generateMapRecursive(final List<NavigationEntryInterface> pnavigationEntries) {
for (final NavigationEntryInterface entryToAdd : pnavigationEntries) {
String token = entryToAdd.getToken();
if (entryToAdd.getMenuValue() != null && token != null) {
if (token.endsWith("/" + StringUtils.removeStart(loginToken, "/"))) {
token = loginToken;
}
if (!placeMap.containsKey(token)) {
placeMap.put(token, entryToAdd);
}
}
if (entryToAdd instanceof NavigationEntryFolder) {
generateMapRecursive(((NavigationEntryFolder) entryToAdd).getSubEntries());
}
}
} } | public class class_name {
private void generateMapRecursive(final List<NavigationEntryInterface> pnavigationEntries) {
for (final NavigationEntryInterface entryToAdd : pnavigationEntries) {
String token = entryToAdd.getToken();
if (entryToAdd.getMenuValue() != null && token != null) {
if (token.endsWith("/" + StringUtils.removeStart(loginToken, "/"))) {
token = loginToken; // depends on control dependency: [if], data = [none]
}
if (!placeMap.containsKey(token)) {
placeMap.put(token, entryToAdd); // depends on control dependency: [if], data = [none]
}
}
if (entryToAdd instanceof NavigationEntryFolder) {
generateMapRecursive(((NavigationEntryFolder) entryToAdd).getSubEntries()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void addPackageName(String parsedPackageName, Content summariesTree, boolean first) {
Content pkgNameContent;
if (!first && configuration.allowTag(HtmlTag.SECTION)) {
summariesTree.addContent(summaryTree);
}
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
SectionName.UNNAMED_PACKAGE_ANCHOR));
pkgNameContent = defaultPackageLabel;
} else {
summariesTree.addContent(getMarkerAnchor(
parsedPackageName));
pkgNameContent = getPackageLabel(parsedPackageName);
}
Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
if (configuration.allowTag(HtmlTag.SECTION)) {
summaryTree = HtmlTree.SECTION(heading);
} else {
summariesTree.addContent(heading);
}
} } | public class class_name {
public void addPackageName(String parsedPackageName, Content summariesTree, boolean first) {
Content pkgNameContent;
if (!first && configuration.allowTag(HtmlTag.SECTION)) {
summariesTree.addContent(summaryTree); // depends on control dependency: [if], data = [none]
}
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
SectionName.UNNAMED_PACKAGE_ANCHOR)); // depends on control dependency: [if], data = [none]
pkgNameContent = defaultPackageLabel; // depends on control dependency: [if], data = [none]
} else {
summariesTree.addContent(getMarkerAnchor(
parsedPackageName)); // depends on control dependency: [if], data = [none]
pkgNameContent = getPackageLabel(parsedPackageName); // depends on control dependency: [if], data = [none]
}
Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
if (configuration.allowTag(HtmlTag.SECTION)) {
summaryTree = HtmlTree.SECTION(heading); // depends on control dependency: [if], data = [none]
} else {
summariesTree.addContent(heading); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration) {
Nd4j.getExecutioner().commit();
FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
val idCounter = new AtomicInteger(0);
val flatVariables = new ArrayList<Integer>();
val flatOffsets = new ArrayList<Integer>();
val flatNodes = new ArrayList<Integer>();
// first of all we build VariableSpace dump
List<SDVariable> variableList = new ArrayList<>(variables());
val reverseMap = new LinkedHashMap<String, Integer>();
val forwardMap = new LinkedHashMap<String, Integer>();
val framesMap = new LinkedHashMap<String, Integer>();
int idx = 0;
for (val variable : variables()) {
log.debug("Exporting variable: [{}]", variable.getVarName());
if (variable.getArr() == null || variable.getShape() == null) {
//putArrayForVarName(variable.getVarName(), Nd4j.scalar(1.0));
//addAsPlaceHolder(variable.getVarName());
continue;
}
val pair = parseVariable(variable.getVarName());
reverseMap.put(pair.getFirst(), idCounter.incrementAndGet());
log.debug("Adding [{}] as [{}]", pair.getFirst(), idCounter.get());
val arr = variable.getArr();
int name = bufferBuilder.createString(variable.getVarName());
int array = arr.toFlatArray(bufferBuilder);
int id = IntPair.createIntPair(bufferBuilder, idCounter.get(), 0);
int flatVariable = FlatVariable.createFlatVariable(bufferBuilder, id, name, 0, array, -1);
flatVariables.add(flatVariable);
}
//add functions
for (val func : functionInstancesById.values()) {
flatNodes.add(asFlatNode(func, bufferBuilder, variableList, reverseMap, forwardMap, framesMap, idCounter));
}
// we're dumping scopes now
for (val scope : sameDiffFunctionInstances.entrySet()) {
flatNodes.add(asFlatNode(scope.getKey(), scope.getValue(), bufferBuilder));
val currVarList = new ArrayList<SDVariable>(scope.getValue().variables());
// converting all ops from node
for (val node : scope.getValue().variables()) {
INDArray arr = node.getArr();
if (arr == null) {
//val otherArr = Nd4j.scalar(1.0);
//scope.getValue().putArrayForVarName(node.getVarName(), otherArr);
//log.warn("Adding placeholder for export for var name {}", node.getVarName());
//arr = otherArr;
continue;
}
int name = bufferBuilder.createString(node.getVarName());
int array = arr.toFlatArray(bufferBuilder);
int id = IntPair.createIntPair(bufferBuilder, ++idx, 0);
val pair = parseVariable(node.getVarName());
reverseMap.put(pair.getFirst(), idx);
log.debug("Adding [{}] as [{}]", pair.getFirst(), idx);
int flatVariable = FlatVariable.createFlatVariable(bufferBuilder, id, name, 0, array, -1);
flatVariables.add(flatVariable);
}
//add functions
for (val func : scope.getValue().functionInstancesById.values()) {
flatNodes.add(asFlatNode(func, bufferBuilder, currVarList, reverseMap, forwardMap, framesMap, idCounter));
}
}
int outputsOffset = FlatGraph.createVariablesVector(bufferBuilder, Ints.toArray(flatOffsets));
int variablesOffset = FlatGraph.createVariablesVector(bufferBuilder, Ints.toArray(flatVariables));
int nodesOffset = FlatGraph.createNodesVector(bufferBuilder, Ints.toArray(flatNodes));
int fg = FlatGraph.createFlatGraph(bufferBuilder, 119, variablesOffset, nodesOffset, outputsOffset, configuration.getFlatConfiguration(bufferBuilder));
bufferBuilder.finish(fg);
return bufferBuilder.dataBuffer();
} } | public class class_name {
public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration) {
Nd4j.getExecutioner().commit();
FlatBufferBuilder bufferBuilder = new FlatBufferBuilder(1024);
val idCounter = new AtomicInteger(0);
val flatVariables = new ArrayList<Integer>();
val flatOffsets = new ArrayList<Integer>();
val flatNodes = new ArrayList<Integer>();
// first of all we build VariableSpace dump
List<SDVariable> variableList = new ArrayList<>(variables());
val reverseMap = new LinkedHashMap<String, Integer>();
val forwardMap = new LinkedHashMap<String, Integer>();
val framesMap = new LinkedHashMap<String, Integer>();
int idx = 0;
for (val variable : variables()) {
log.debug("Exporting variable: [{}]", variable.getVarName()); // depends on control dependency: [for], data = [variable]
if (variable.getArr() == null || variable.getShape() == null) {
//putArrayForVarName(variable.getVarName(), Nd4j.scalar(1.0));
//addAsPlaceHolder(variable.getVarName());
continue;
}
val pair = parseVariable(variable.getVarName());
reverseMap.put(pair.getFirst(), idCounter.incrementAndGet()); // depends on control dependency: [for], data = [none]
log.debug("Adding [{}] as [{}]", pair.getFirst(), idCounter.get()); // depends on control dependency: [for], data = [none]
val arr = variable.getArr();
int name = bufferBuilder.createString(variable.getVarName());
int array = arr.toFlatArray(bufferBuilder);
int id = IntPair.createIntPair(bufferBuilder, idCounter.get(), 0);
int flatVariable = FlatVariable.createFlatVariable(bufferBuilder, id, name, 0, array, -1);
flatVariables.add(flatVariable); // depends on control dependency: [for], data = [none]
}
//add functions
for (val func : functionInstancesById.values()) {
flatNodes.add(asFlatNode(func, bufferBuilder, variableList, reverseMap, forwardMap, framesMap, idCounter)); // depends on control dependency: [for], data = [func]
}
// we're dumping scopes now
for (val scope : sameDiffFunctionInstances.entrySet()) {
flatNodes.add(asFlatNode(scope.getKey(), scope.getValue(), bufferBuilder)); // depends on control dependency: [for], data = [scope]
val currVarList = new ArrayList<SDVariable>(scope.getValue().variables());
// converting all ops from node
for (val node : scope.getValue().variables()) {
INDArray arr = node.getArr();
if (arr == null) {
//val otherArr = Nd4j.scalar(1.0);
//scope.getValue().putArrayForVarName(node.getVarName(), otherArr);
//log.warn("Adding placeholder for export for var name {}", node.getVarName());
//arr = otherArr;
continue;
}
int name = bufferBuilder.createString(node.getVarName());
int array = arr.toFlatArray(bufferBuilder);
int id = IntPair.createIntPair(bufferBuilder, ++idx, 0);
val pair = parseVariable(node.getVarName());
reverseMap.put(pair.getFirst(), idx); // depends on control dependency: [for], data = [none]
log.debug("Adding [{}] as [{}]", pair.getFirst(), idx); // depends on control dependency: [for], data = [none]
int flatVariable = FlatVariable.createFlatVariable(bufferBuilder, id, name, 0, array, -1);
flatVariables.add(flatVariable); // depends on control dependency: [for], data = [none]
}
//add functions
for (val func : scope.getValue().functionInstancesById.values()) {
flatNodes.add(asFlatNode(func, bufferBuilder, currVarList, reverseMap, forwardMap, framesMap, idCounter)); // depends on control dependency: [for], data = [func]
}
}
int outputsOffset = FlatGraph.createVariablesVector(bufferBuilder, Ints.toArray(flatOffsets));
int variablesOffset = FlatGraph.createVariablesVector(bufferBuilder, Ints.toArray(flatVariables));
int nodesOffset = FlatGraph.createNodesVector(bufferBuilder, Ints.toArray(flatNodes));
int fg = FlatGraph.createFlatGraph(bufferBuilder, 119, variablesOffset, nodesOffset, outputsOffset, configuration.getFlatConfiguration(bufferBuilder));
bufferBuilder.finish(fg);
return bufferBuilder.dataBuffer();
} } |
public class class_name {
public Rectangle getRectangleByCoordinatesPreferBack(double x, double y) {
for (Node node : this.getChildren()) {
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle;
}
}
}
// nothing found, return null
return null;
} } | public class class_name {
public Rectangle getRectangleByCoordinatesPreferBack(double x, double y) {
for (Node node : this.getChildren()) {
if (node instanceof Rectangle) {
Rectangle rectangle = (Rectangle) node;
if (x >= rectangle.getX() && x <= (rectangle.getX() + rectangle.getWidth()) && y >= rectangle.getY() && y <= (rectangle.getY() + rectangle.getHeight())) {
// region is correct
return rectangle; // depends on control dependency: [if], data = [none]
}
}
}
// nothing found, return null
return null;
} } |
public class class_name {
public NotificationConfig withNotificationEvents(String... notificationEvents) {
if (this.notificationEvents == null) {
setNotificationEvents(new com.amazonaws.internal.SdkInternalList<String>(notificationEvents.length));
}
for (String ele : notificationEvents) {
this.notificationEvents.add(ele);
}
return this;
} } | public class class_name {
public NotificationConfig withNotificationEvents(String... notificationEvents) {
if (this.notificationEvents == null) {
setNotificationEvents(new com.amazonaws.internal.SdkInternalList<String>(notificationEvents.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : notificationEvents) {
this.notificationEvents.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public final long getAttributeValueAsLong(String attributeName) {
Attribute attribute = getAttribute(attributeName);
if (attribute == null) {
return 0;
}
else {
try {
return attribute.getLongValue();
}
catch (DataConversionException ex) {
return 0;
}
}
} } | public class class_name {
public final long getAttributeValueAsLong(String attributeName) {
Attribute attribute = getAttribute(attributeName);
if (attribute == null) {
return 0; // depends on control dependency: [if], data = [none]
}
else {
try {
return attribute.getLongValue(); // depends on control dependency: [try], data = [none]
}
catch (DataConversionException ex) {
return 0;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static boolean parseXMLChildElems(Element elem, List<UNode> childUNodeList) {
assert elem != null;
assert childUNodeList != null;
// Scan for Element nodes (there could be Comment and other nodes).
boolean bDupNodeNames = false;
Set<String> nodeNameSet = new HashSet<String>();
NodeList nodeList = elem.getChildNodes();
for (int index = 0; index < nodeList.getLength(); index++) {
Node childNode = nodeList.item(index);
if (childNode instanceof Element) {
// Create the appropriate child UNode for this element.
UNode childUNode = parseXMLElement((Element)childNode);
childUNodeList.add(childUNode);
if (nodeNameSet.contains(childUNode.getName())) {
bDupNodeNames = true;
} else {
nodeNameSet.add(childUNode.getName());
}
}
}
return bDupNodeNames;
} } | public class class_name {
private static boolean parseXMLChildElems(Element elem, List<UNode> childUNodeList) {
assert elem != null;
assert childUNodeList != null;
// Scan for Element nodes (there could be Comment and other nodes).
boolean bDupNodeNames = false;
Set<String> nodeNameSet = new HashSet<String>();
NodeList nodeList = elem.getChildNodes();
for (int index = 0; index < nodeList.getLength(); index++) {
Node childNode = nodeList.item(index);
if (childNode instanceof Element) {
// Create the appropriate child UNode for this element.
UNode childUNode = parseXMLElement((Element)childNode);
childUNodeList.add(childUNode);
// depends on control dependency: [if], data = [none]
if (nodeNameSet.contains(childUNode.getName())) {
bDupNodeNames = true;
// depends on control dependency: [if], data = [none]
} else {
nodeNameSet.add(childUNode.getName());
// depends on control dependency: [if], data = [none]
}
}
}
return bDupNodeNames;
} } |
public class class_name {
public static String normalize(String value) {
try {
StringBuilder builder = new StringBuilder();
for (byte b : value.getBytes(DEFAULT_ENCODING)) {
if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
builder.append((char) b);
} else {
builder.append(PERCENT_ENCODED_STRINGS[b & 0xFF]);
}
}
return builder.toString();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static String normalize(String value) {
try {
StringBuilder builder = new StringBuilder();
for (byte b : value.getBytes(DEFAULT_ENCODING)) {
if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
builder.append((char) b); // depends on control dependency: [if], data = [none]
} else {
builder.append(PERCENT_ENCODED_STRINGS[b & 0xFF]); // depends on control dependency: [if], data = [none]
}
}
return builder.toString(); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double fastNormP2( DMatrixRMaj A ) {
if( MatrixFeatures_DDRM.isVector(A)) {
return fastNormF(A);
} else {
return inducedP2(A);
}
} } | public class class_name {
public static double fastNormP2( DMatrixRMaj A ) {
if( MatrixFeatures_DDRM.isVector(A)) {
return fastNormF(A); // depends on control dependency: [if], data = [none]
} else {
return inducedP2(A); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private SpecialSection getOrThrow(
Optional<? extends SpecialSection> optional, String message) {
if (optional.isPresent()) {
return optional.get();
}
throw new IllegalStateException(message);
} } | public class class_name {
private SpecialSection getOrThrow(
Optional<? extends SpecialSection> optional, String message) {
if (optional.isPresent()) {
return optional.get(); // depends on control dependency: [if], data = [none]
}
throw new IllegalStateException(message);
} } |
public class class_name {
public QueryableEntriesSegment run(String mapName, Predicate predicate, int partitionId, int tableIndex, int fetchSize) {
int lastIndex = tableIndex;
final List<QueryableEntry> resultList = new LinkedList<>();
final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId);
final RecordStore recordStore = partitionContainer.getRecordStore(mapName);
final Extractors extractors = mapServiceContext.getExtractors(mapName);
while (resultList.size() < fetchSize && lastIndex >= 0) {
final MapEntriesWithCursor cursor = recordStore.fetchEntries(lastIndex, fetchSize - resultList.size());
lastIndex = cursor.getNextTableIndexToReadFrom();
final Collection<? extends Entry<Data, Data>> entries = cursor.getBatch();
if (entries.isEmpty()) {
break;
}
for (Entry<Data, Data> entry : entries) {
QueryableEntry queryEntry = new LazyMapEntry(entry.getKey(), entry.getValue(), serializationService, extractors);
if (predicate.apply(queryEntry)) {
resultList.add(queryEntry);
}
}
}
return new QueryableEntriesSegment(resultList, lastIndex);
} } | public class class_name {
public QueryableEntriesSegment run(String mapName, Predicate predicate, int partitionId, int tableIndex, int fetchSize) {
int lastIndex = tableIndex;
final List<QueryableEntry> resultList = new LinkedList<>();
final PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId);
final RecordStore recordStore = partitionContainer.getRecordStore(mapName);
final Extractors extractors = mapServiceContext.getExtractors(mapName);
while (resultList.size() < fetchSize && lastIndex >= 0) {
final MapEntriesWithCursor cursor = recordStore.fetchEntries(lastIndex, fetchSize - resultList.size());
lastIndex = cursor.getNextTableIndexToReadFrom(); // depends on control dependency: [while], data = [none]
final Collection<? extends Entry<Data, Data>> entries = cursor.getBatch();
if (entries.isEmpty()) {
break;
}
for (Entry<Data, Data> entry : entries) {
QueryableEntry queryEntry = new LazyMapEntry(entry.getKey(), entry.getValue(), serializationService, extractors);
if (predicate.apply(queryEntry)) {
resultList.add(queryEntry); // depends on control dependency: [if], data = [none]
}
}
}
return new QueryableEntriesSegment(resultList, lastIndex);
} } |
public class class_name {
public synchronized void appendToSetProp(String key, String value) {
Set<String> set = value == null ? Sets.<String>newHashSet() : Sets.newHashSet(LIST_SPLITTER.splitToList(value));
if (contains(key)) {
set.addAll(getPropAsSet(key));
}
setProp(key, LIST_JOINER.join(set));
} } | public class class_name {
public synchronized void appendToSetProp(String key, String value) {
Set<String> set = value == null ? Sets.<String>newHashSet() : Sets.newHashSet(LIST_SPLITTER.splitToList(value));
if (contains(key)) {
set.addAll(getPropAsSet(key)); // depends on control dependency: [if], data = [none]
}
setProp(key, LIST_JOINER.join(set));
} } |
public class class_name {
public String capitalize(String string) {
if (string == null || string.length() < 1) {
return "";
}
return string.substring(0, 1).toUpperCase() + string.substring(1);
} } | public class class_name {
public String capitalize(String string) {
if (string == null || string.length() < 1) {
return ""; // depends on control dependency: [if], data = [none]
}
return string.substring(0, 1).toUpperCase() + string.substring(1);
} } |
public class class_name {
public Matrix3f set(Matrix3fc m) {
if (m instanceof Matrix3f) {
MemUtil.INSTANCE.copy((Matrix3f) m, this);
} else {
setMatrix3fc(m);
}
return this;
} } | public class class_name {
public Matrix3f set(Matrix3fc m) {
if (m instanceof Matrix3f) {
MemUtil.INSTANCE.copy((Matrix3f) m, this); // depends on control dependency: [if], data = [none]
} else {
setMatrix3fc(m); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
protected void closeConnection(final String meUuid, boolean alreadyClosed) {
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object [] { meUuid, alreadyClosed });
}
final SibRaMessagingEngineConnection connection;
synchronized (_connections) {
connection = (SibRaMessagingEngineConnection) _connections
.remove(meUuid);
}
if (connection != null) {
connection.close(alreadyClosed);
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName);
}
} } | public class class_name {
protected void closeConnection(final String meUuid, boolean alreadyClosed) {
final String methodName = "closeConnection";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, methodName, new Object [] { meUuid, alreadyClosed }); // depends on control dependency: [if], data = [none]
}
final SibRaMessagingEngineConnection connection;
synchronized (_connections) {
connection = (SibRaMessagingEngineConnection) _connections
.remove(meUuid);
}
if (connection != null) {
connection.close(alreadyClosed); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private <T> Class<? extends Annotation> matchAnnotationToScope(Annotation[] annotations) {
for (Annotation next : annotations) {
Class<? extends Annotation> nextType = next.annotationType();
if (nextType.getAnnotation(BindingScope.class) != null) {
return nextType;
}
}
return DefaultBinding.class;
} } | public class class_name {
private <T> Class<? extends Annotation> matchAnnotationToScope(Annotation[] annotations) {
for (Annotation next : annotations) {
Class<? extends Annotation> nextType = next.annotationType();
if (nextType.getAnnotation(BindingScope.class) != null) {
return nextType;
// depends on control dependency: [if], data = [none]
}
}
return DefaultBinding.class;
} } |
public class class_name {
public <T> T call(ObjectName pObjectName, MBeanAction<T> pMBeanAction, Object ... pExtraArgs)
throws IOException, ReflectionException, MBeanException, AttributeNotFoundException, InstanceNotFoundException {
InstanceNotFoundException objNotFoundException = null;
for (MBeanServerConnection server : getMBeanServers()) {
// Only the first MBeanServer holding the MBean wins
try {
// Still to decide: Should we check eagerly or let an InstanceNotFound Exception
// bubble ? Exception bubbling was the former behaviour, so it is left in. However,
// it would be interesting how large the performance impact is here. All unit tests BTW are
// prepared for switching the guard below on or off.
//if (server.isRegistered(pObjectName)) {
return pMBeanAction.execute(server, pObjectName, pExtraArgs);
//}
} catch (InstanceNotFoundException exp) {
// Remember exceptions for later use
objNotFoundException = exp;
}
}
// Must be != null, otherwise we would not have left the loop
throw objNotFoundException;
// When we reach this, no MBeanServer know about the requested MBean.
// Hence, we throw our own InstanceNotFoundException here
//throw exception != null ?
// new IllegalArgumentException(errorMsg + ": " + exception,exception) :
// new IllegalArgumentException(errorMsg);
} } | public class class_name {
public <T> T call(ObjectName pObjectName, MBeanAction<T> pMBeanAction, Object ... pExtraArgs)
throws IOException, ReflectionException, MBeanException, AttributeNotFoundException, InstanceNotFoundException {
InstanceNotFoundException objNotFoundException = null;
for (MBeanServerConnection server : getMBeanServers()) {
// Only the first MBeanServer holding the MBean wins
try {
// Still to decide: Should we check eagerly or let an InstanceNotFound Exception
// bubble ? Exception bubbling was the former behaviour, so it is left in. However,
// it would be interesting how large the performance impact is here. All unit tests BTW are
// prepared for switching the guard below on or off.
//if (server.isRegistered(pObjectName)) {
return pMBeanAction.execute(server, pObjectName, pExtraArgs); // depends on control dependency: [try], data = [none]
//}
} catch (InstanceNotFoundException exp) {
// Remember exceptions for later use
objNotFoundException = exp;
} // depends on control dependency: [catch], data = [none]
}
// Must be != null, otherwise we would not have left the loop
throw objNotFoundException;
// When we reach this, no MBeanServer know about the requested MBean.
// Hence, we throw our own InstanceNotFoundException here
//throw exception != null ?
// new IllegalArgumentException(errorMsg + ": " + exception,exception) :
// new IllegalArgumentException(errorMsg);
} } |
public class class_name {
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException,
RepositoryException
{
checkValid();
JCRName jcrLabelName = locationFactory.parseJCRName(label);
InternalQName labelQName = jcrLabelName.getInternalName();
NodeData labels = getVersionLabelsData();
List<PropertyData> labelsList = dataManager.getChildPropertiesData(labels);
for (PropertyData prop : labelsList)
{
if (prop.getQPath().getName().equals(labelQName))
{
// label is found
if (moveLabel)
{
removeVersionLabel(label);
break;
}
throw new VersionException("Label " + label + " is already exists and moveLabel=false");
}
}
NodeData versionData = getVersionData(versionName);
SessionChangesLog changesLog = new SessionChangesLog(session);
PropertyData labelData =
TransientPropertyData.createPropertyData(labels, labelQName, PropertyType.REFERENCE, false,
new TransientValueData(versionData.getIdentifier()));
changesLog.add(ItemState.createAddedState(labelData));
dataManager.getTransactManager().save(changesLog);
} } | public class class_name {
public void addVersionLabel(String versionName, String label, boolean moveLabel) throws VersionException,
RepositoryException
{
checkValid();
JCRName jcrLabelName = locationFactory.parseJCRName(label);
InternalQName labelQName = jcrLabelName.getInternalName();
NodeData labels = getVersionLabelsData();
List<PropertyData> labelsList = dataManager.getChildPropertiesData(labels);
for (PropertyData prop : labelsList)
{
if (prop.getQPath().getName().equals(labelQName))
{
// label is found
if (moveLabel)
{
removeVersionLabel(label); // depends on control dependency: [if], data = [none]
break;
}
throw new VersionException("Label " + label + " is already exists and moveLabel=false");
}
}
NodeData versionData = getVersionData(versionName);
SessionChangesLog changesLog = new SessionChangesLog(session);
PropertyData labelData =
TransientPropertyData.createPropertyData(labels, labelQName, PropertyType.REFERENCE, false,
new TransientValueData(versionData.getIdentifier()));
changesLog.add(ItemState.createAddedState(labelData));
dataManager.getTransactManager().save(changesLog);
} } |
public class class_name {
@Override
public List<Future<Boolean>> getPendingFutures() {
final List<Future<Boolean>> returnFutures = new ArrayList<Future<Boolean>>(expectedCompleteCount);
for (Future<Boolean> future : futures) {
if (!future.isDone()) {
returnFutures.add(future);
}
}
return returnFutures;
} } | public class class_name {
@Override
public List<Future<Boolean>> getPendingFutures() {
final List<Future<Boolean>> returnFutures = new ArrayList<Future<Boolean>>(expectedCompleteCount);
for (Future<Boolean> future : futures) {
if (!future.isDone()) {
returnFutures.add(future); // depends on control dependency: [if], data = [none]
}
}
return returnFutures;
} } |
public class class_name {
public BigDecimal getBigDecimalFrom(JsonValue json) {
if (json.isString()) {
return new BigDecimal(json.asString());
} else {
return new BigDecimal(json.toString());
}
} } | public class class_name {
public BigDecimal getBigDecimalFrom(JsonValue json) {
if (json.isString()) {
return new BigDecimal(json.asString()); // depends on control dependency: [if], data = [none]
} else {
return new BigDecimal(json.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static byte kuz_mul_gf256(byte x, byte y) {
// uint8_t z;
// z = 0;
byte z = 0;
// while (y) {
while ((y & 0xFF) != 0) {
// if (y & 1)
if ((y & 1) != 0) {
// z ^= x;
z ^= x;
}
// x = (x << 1) ^ (x & 0x80 ? 0xC3 : 0x00);
x = (byte) (((x & 0xFF) << 1) ^ ((x & 0x80) != 0 ? 0xC3 : 0x00));
// y >>= 1;
y = (byte) ((y & 0xFF) >> 1);
}
// return z;
return z;
} } | public class class_name {
public static byte kuz_mul_gf256(byte x, byte y) {
// uint8_t z;
// z = 0;
byte z = 0;
// while (y) {
while ((y & 0xFF) != 0) {
// if (y & 1)
if ((y & 1) != 0) {
// z ^= x;
z ^= x; // depends on control dependency: [if], data = [none]
}
// x = (x << 1) ^ (x & 0x80 ? 0xC3 : 0x00);
x = (byte) (((x & 0xFF) << 1) ^ ((x & 0x80) != 0 ? 0xC3 : 0x00)); // depends on control dependency: [while], data = [0)]
// y >>= 1;
y = (byte) ((y & 0xFF) >> 1); // depends on control dependency: [while], data = [((y & 0xFF)]
}
// return z;
return z;
} } |
public class class_name {
@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.linsert(key, JedisConverters.toListPosition(where), pivot, value)));
return null;
}
return client.linsert(key, JedisConverters.toListPosition(where), pivot, value);
} catch (Exception ex) {
throw convertException(ex);
}
} } | public class class_name {
@Override
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
try {
if (isPipelined()) {
pipeline(new JedisResult(pipeline.linsert(key, JedisConverters.toListPosition(where), pivot, value))); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return client.linsert(key, JedisConverters.toListPosition(where), pivot, value); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw convertException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public FilterList getFilter(XPath condition, boolean passAll,
String []famNames, String []qualNames, String []params) {
FilterList list = new FilterList((passAll)?FilterList.Operator.MUST_PASS_ALL:
FilterList.Operator.MUST_PASS_ONE);
for (int iCont = 0; iCont < famNames.length; iCont ++) {
SingleColumnValueFilter filterTmp = new SingleColumnValueFilter(
Bytes.toBytes(famNames[iCont]),
Bytes.toBytes(qualNames[iCont]),
CompareOp.EQUAL,
Bytes.toBytes(params[iCont])
);
list.addFilter(filterTmp);
}
return list;
} } | public class class_name {
public FilterList getFilter(XPath condition, boolean passAll,
String []famNames, String []qualNames, String []params) {
FilterList list = new FilterList((passAll)?FilterList.Operator.MUST_PASS_ALL:
FilterList.Operator.MUST_PASS_ONE);
for (int iCont = 0; iCont < famNames.length; iCont ++) {
SingleColumnValueFilter filterTmp = new SingleColumnValueFilter(
Bytes.toBytes(famNames[iCont]),
Bytes.toBytes(qualNames[iCont]),
CompareOp.EQUAL,
Bytes.toBytes(params[iCont])
);
list.addFilter(filterTmp); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public static Set<String> retainMatchingKeys(Counter<String> counter, List<Pattern> matchPatterns) {
Set<String> removed = new HashSet<String>();
for (String key : counter.keySet()) {
boolean matched = false;
for (Pattern pattern : matchPatterns) {
if (pattern.matcher(key).matches()) {
matched = true;
break;
}
}
if (!matched) {
removed.add(key);
}
}
for (String key : removed) {
counter.remove(key);
}
return removed;
} } | public class class_name {
public static Set<String> retainMatchingKeys(Counter<String> counter, List<Pattern> matchPatterns) {
Set<String> removed = new HashSet<String>();
for (String key : counter.keySet()) {
boolean matched = false;
for (Pattern pattern : matchPatterns) {
if (pattern.matcher(key).matches()) {
matched = true;
// depends on control dependency: [if], data = [none]
break;
}
}
if (!matched) {
removed.add(key);
// depends on control dependency: [if], data = [none]
}
}
for (String key : removed) {
counter.remove(key);
// depends on control dependency: [for], data = [key]
}
return removed;
} } |
public class class_name {
public void marshall(ModifyInstanceFleetRequest modifyInstanceFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyInstanceFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyInstanceFleetRequest.getClusterId(), CLUSTERID_BINDING);
protocolMarshaller.marshall(modifyInstanceFleetRequest.getInstanceFleet(), INSTANCEFLEET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ModifyInstanceFleetRequest modifyInstanceFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (modifyInstanceFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(modifyInstanceFleetRequest.getClusterId(), CLUSTERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(modifyInstanceFleetRequest.getInstanceFleet(), INSTANCEFLEET_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double[] toDouble(int[] array) {
double[] rv = new double[array.length];
for (int i = 0; i < array.length; i++) {
rv[i] = array[i];
}
return rv;
} } | public class class_name {
public static double[] toDouble(int[] array) {
double[] rv = new double[array.length];
for (int i = 0; i < array.length; i++) {
rv[i] = array[i];
// depends on control dependency: [for], data = [i]
}
return rv;
} } |
public class class_name {
@Override
public int getMaxInactiveInterval() {
HttpSession session = backing.getSession(false);
if (session == null) {
return -1;
}
return session.getMaxInactiveInterval();
} } | public class class_name {
@Override
public int getMaxInactiveInterval() {
HttpSession session = backing.getSession(false);
if (session == null) {
return -1; // depends on control dependency: [if], data = [none]
}
return session.getMaxInactiveInterval();
} } |
public class class_name {
public static String getCollationKey(String name) {
byte [] arr = getCollationKeyInBytes(name);
try {
return new String(arr, 0, getKeyLen(arr), "ISO8859_1");
} catch (Exception ex) {
return "";
}
} } | public class class_name {
public static String getCollationKey(String name) {
byte [] arr = getCollationKeyInBytes(name);
try {
return new String(arr, 0, getKeyLen(arr), "ISO8859_1"); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
return "";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CqlDuration from(@NonNull String input) {
boolean isNegative = input.startsWith("-");
String source = isNegative ? input.substring(1) : input;
if (source.startsWith("P")) {
if (source.endsWith("W")) {
return parseIso8601WeekFormat(isNegative, source);
}
if (source.contains("-")) {
return parseIso8601AlternativeFormat(isNegative, source);
}
return parseIso8601Format(isNegative, source);
}
return parseStandardFormat(isNegative, source);
} } | public class class_name {
public static CqlDuration from(@NonNull String input) {
boolean isNegative = input.startsWith("-");
String source = isNegative ? input.substring(1) : input;
if (source.startsWith("P")) {
if (source.endsWith("W")) {
return parseIso8601WeekFormat(isNegative, source); // depends on control dependency: [if], data = [none]
}
if (source.contains("-")) {
return parseIso8601AlternativeFormat(isNegative, source); // depends on control dependency: [if], data = [none]
}
return parseIso8601Format(isNegative, source); // depends on control dependency: [if], data = [none]
}
return parseStandardFormat(isNegative, source);
} } |
public class class_name {
public RootNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (c != CROSSED_OUT) {
ixMap[clean.length()] = i;
clean.append(c);
}
}
ixMap[clean.length()] = chars.length;
// run inner parse
char[] cleaned = new char[clean.length()];
clean.getChars(0, cleaned.length, cleaned, 0);
RootNode rootNode = parseInternal(cleaned);
// correct AST indices with index map
fixIndices(rootNode, ixMap);
return rootNode;
} } | public class class_name {
public RootNode parseInternal(StringBuilderVar block) {
char[] chars = block.getChars();
int[] ixMap = new int[chars.length + 1]; // map of cleaned indices to original indices
// strip out CROSSED_OUT characters and build index map
StringBuilder clean = new StringBuilder();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
if (c != CROSSED_OUT) {
ixMap[clean.length()] = i; // depends on control dependency: [if], data = [none]
clean.append(c); // depends on control dependency: [if], data = [(c]
}
}
ixMap[clean.length()] = chars.length;
// run inner parse
char[] cleaned = new char[clean.length()];
clean.getChars(0, cleaned.length, cleaned, 0);
RootNode rootNode = parseInternal(cleaned);
// correct AST indices with index map
fixIndices(rootNode, ixMap);
return rootNode;
} } |
public class class_name {
public long getHeaderFieldDate(String name, long Default) {
String value = getHeaderField(name);
try {
return Date.parse(value);
} catch (Exception e) { }
return Default;
} } | public class class_name {
public long getHeaderFieldDate(String name, long Default) {
String value = getHeaderField(name);
try {
return Date.parse(value); // depends on control dependency: [try], data = [none]
} catch (Exception e) { } // depends on control dependency: [catch], data = [none]
return Default;
} } |
public class class_name {
public static <E extends Comparable<E>> void recursiveQuickSort(List<E> array, int startIdx,
int endIdx) {
int idx = partition(array, startIdx, endIdx);
// Recursively call quicksort with left part of the partitioned array
if (startIdx < idx - 1) {
recursiveQuickSort(array, startIdx, idx - 1);
}
// Recursively call quick sort with right part of the partitioned array
if (endIdx > idx) {
recursiveQuickSort(array, idx, endIdx);
}
} } | public class class_name {
public static <E extends Comparable<E>> void recursiveQuickSort(List<E> array, int startIdx,
int endIdx) {
int idx = partition(array, startIdx, endIdx);
// Recursively call quicksort with left part of the partitioned array
if (startIdx < idx - 1) {
recursiveQuickSort(array, startIdx, idx - 1); // depends on control dependency: [if], data = [idx - 1)]
}
// Recursively call quick sort with right part of the partitioned array
if (endIdx > idx) {
recursiveQuickSort(array, idx, endIdx); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean translateReadyOps(int ops, int initialOps,
SelectionKeyImpl sk) {
int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
int oldOps = sk.nioReadyOps();
int newOps = initialOps;
if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return false;
}
if ((ops & (PollArrayWrapper.POLLERR
| PollArrayWrapper.POLLHUP)) != 0) {
newOps = intOps;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
}
if (((ops & PollArrayWrapper.POLLIN) != 0) &&
((intOps & SelectionKey.OP_ACCEPT) != 0))
newOps |= SelectionKey.OP_ACCEPT;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
} } | public class class_name {
public boolean translateReadyOps(int ops, int initialOps,
SelectionKeyImpl sk) {
int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
int oldOps = sk.nioReadyOps();
int newOps = initialOps;
if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return false; // depends on control dependency: [if], data = [none]
}
if ((ops & (PollArrayWrapper.POLLERR
| PollArrayWrapper.POLLHUP)) != 0) {
newOps = intOps; // depends on control dependency: [if], data = [none]
sk.nioReadyOps(newOps); // depends on control dependency: [if], data = [none]
return (newOps & ~oldOps) != 0; // depends on control dependency: [if], data = [none]
}
if (((ops & PollArrayWrapper.POLLIN) != 0) &&
((intOps & SelectionKey.OP_ACCEPT) != 0))
newOps |= SelectionKey.OP_ACCEPT;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
} } |
public class class_name {
ValidationResult cleanMultiValuePropertyKey(String name) {
ValidationResult vr = cleanObjectKey(name);
name = (String) vr.getObject();
// make sure its not a known property key (reserved in the case of multi-value)
try {
RestrictedMultiValueFields rf = RestrictedMultiValueFields.valueOf(name);
//noinspection ConstantConditions
if (rf != null) {
vr.setErrorDesc(name + "... is a restricted key for multi-value properties. Operation aborted.");
vr.setErrorCode(523);
vr.setObject(null);
}
} catch (Throwable t) {
//no-op
}
return vr;
} } | public class class_name {
ValidationResult cleanMultiValuePropertyKey(String name) {
ValidationResult vr = cleanObjectKey(name);
name = (String) vr.getObject();
// make sure its not a known property key (reserved in the case of multi-value)
try {
RestrictedMultiValueFields rf = RestrictedMultiValueFields.valueOf(name);
//noinspection ConstantConditions
if (rf != null) {
vr.setErrorDesc(name + "... is a restricted key for multi-value properties. Operation aborted."); // depends on control dependency: [if], data = [none]
vr.setErrorCode(523); // depends on control dependency: [if], data = [none]
vr.setObject(null); // depends on control dependency: [if], data = [null)]
}
} catch (Throwable t) {
//no-op
} // depends on control dependency: [catch], data = [none]
return vr;
} } |
public class class_name {
public TypePair getTypesUnderEquality(JSType that) {
// unions types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderEquality(this);
return new TypePair(p.typeB, p.typeA);
}
// other types
switch (testForEquality(that)) {
case FALSE:
return new TypePair(null, null);
case TRUE:
case UNKNOWN:
return new TypePair(this, that);
}
// switch case is exhaustive
throw new IllegalStateException();
} } | public class class_name {
public TypePair getTypesUnderEquality(JSType that) {
// unions types
if (that.isUnionType()) {
TypePair p = that.toMaybeUnionType().getTypesUnderEquality(this);
return new TypePair(p.typeB, p.typeA); // depends on control dependency: [if], data = [none]
}
// other types
switch (testForEquality(that)) {
case FALSE:
return new TypePair(null, null);
case TRUE:
case UNKNOWN:
return new TypePair(this, that);
}
// switch case is exhaustive
throw new IllegalStateException();
} } |
public class class_name {
public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) {
final Item item = targetTable.getItem(itemId);
if (item != null) {
final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item
.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue");
if (updateStatus == TargetUpdateStatus.ERROR) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED);
} else if (updateStatus == TargetUpdateStatus.UNKNOWN) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE);
} else if (updateStatus == TargetUpdateStatus.IN_SYNC) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN);
} else if (updateStatus == TargetUpdateStatus.PENDING) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW);
} else if (updateStatus == TargetUpdateStatus.REGISTERED) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE);
}
}
} } | public class class_name {
public static void applyStatusLblStyle(final Table targetTable, final Button pinBtn, final Object itemId) {
final Item item = targetTable.getItem(itemId);
if (item != null) {
final TargetUpdateStatus updateStatus = (TargetUpdateStatus) item
.getItemProperty(SPUILabelDefinitions.VAR_TARGET_STATUS).getValue();
pinBtn.removeStyleName("statusIconRed statusIconBlue statusIconGreen statusIconYellow statusIconLightBlue"); // depends on control dependency: [if], data = [none]
if (updateStatus == TargetUpdateStatus.ERROR) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_RED); // depends on control dependency: [if], data = [none]
} else if (updateStatus == TargetUpdateStatus.UNKNOWN) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_BLUE); // depends on control dependency: [if], data = [none]
} else if (updateStatus == TargetUpdateStatus.IN_SYNC) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_GREEN); // depends on control dependency: [if], data = [none]
} else if (updateStatus == TargetUpdateStatus.PENDING) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_YELLOW); // depends on control dependency: [if], data = [none]
} else if (updateStatus == TargetUpdateStatus.REGISTERED) {
pinBtn.addStyleName(SPUIStyleDefinitions.STATUS_ICON_LIGHT_BLUE); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final void begin() {
this.file = this.getAppender().getIoFile();
if (this.file == null) {
this.getAppender().getErrorHandler()
.error("Scavenger not started: missing log file name");
return;
}
if (this.getProperties().getScavengeInterval() > -1) {
final Thread thread = new Thread(this, "Log4J File Scavenger");
thread.setDaemon(true);
thread.start();
this.threadRef = thread;
}
} } | public class class_name {
public final void begin() {
this.file = this.getAppender().getIoFile();
if (this.file == null) {
this.getAppender().getErrorHandler()
.error("Scavenger not started: missing log file name"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (this.getProperties().getScavengeInterval() > -1) {
final Thread thread = new Thread(this, "Log4J File Scavenger");
thread.setDaemon(true); // depends on control dependency: [if], data = [none]
thread.start(); // depends on control dependency: [if], data = [none]
this.threadRef = thread; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setMax(final String pmax) {
try {
this.setMax(this.numberParser.parse(pmax));
} catch (final ParseException e) {
this.setMax((T) null);
}
} } | public class class_name {
public void setMax(final String pmax) {
try {
this.setMax(this.numberParser.parse(pmax)); // depends on control dependency: [try], data = [none]
} catch (final ParseException e) {
this.setMax((T) null);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(PartOfSpeechTag partOfSpeechTag, ProtocolMarshaller protocolMarshaller) {
if (partOfSpeechTag == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(partOfSpeechTag.getTag(), TAG_BINDING);
protocolMarshaller.marshall(partOfSpeechTag.getScore(), SCORE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PartOfSpeechTag partOfSpeechTag, ProtocolMarshaller protocolMarshaller) {
if (partOfSpeechTag == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(partOfSpeechTag.getTag(), TAG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(partOfSpeechTag.getScore(), SCORE_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 static Capabilities dropCapabilities(Capabilities capabilities) {
if (capabilities == null) {
return new ImmutableCapabilities();
}
MutableCapabilities caps;
if (isLegacy(capabilities)) {
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
} else {
caps = new MutableCapabilities(capabilities);
}
// Ensure that the proxy is in a state fit to be sent to the extension
Proxy proxy = Proxy.extractFrom(capabilities);
if (proxy != null) {
caps.setCapability(PROXY, proxy);
}
return caps;
} } | public class class_name {
private static Capabilities dropCapabilities(Capabilities capabilities) {
if (capabilities == null) {
return new ImmutableCapabilities(); // depends on control dependency: [if], data = [none]
}
MutableCapabilities caps;
if (isLegacy(capabilities)) {
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key))); // depends on control dependency: [if], data = [none]
} else {
caps = new MutableCapabilities(capabilities); // depends on control dependency: [if], data = [none]
}
// Ensure that the proxy is in a state fit to be sent to the extension
Proxy proxy = Proxy.extractFrom(capabilities);
if (proxy != null) {
caps.setCapability(PROXY, proxy); // depends on control dependency: [if], data = [none]
}
return caps;
} } |
public class class_name {
public void cleanExpiredCallbacks() {
long now = System.currentTimeMillis();
// Cuncurrency could be possible for multiple instantiations
synchronized(regCallbacks) {
Iterator<Map.Entry<String, RegisteredCallback>> it = regCallbacks.entrySet().iterator();
Map.Entry<String, RegisteredCallback> entry;
while (it.hasNext()) {
entry = it.next();
if (now - entry.getValue().getTimestamp() > CALLBACK_EXPIRE_TIME) {
it.remove();
}
}
}
} } | public class class_name {
public void cleanExpiredCallbacks() {
long now = System.currentTimeMillis();
// Cuncurrency could be possible for multiple instantiations
synchronized(regCallbacks) {
Iterator<Map.Entry<String, RegisteredCallback>> it = regCallbacks.entrySet().iterator();
Map.Entry<String, RegisteredCallback> entry;
while (it.hasNext()) {
entry = it.next(); // depends on control dependency: [while], data = [none]
if (now - entry.getValue().getTimestamp() > CALLBACK_EXPIRE_TIME) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.