code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static ServerConnector createSecureSocketConnector(Server server,
String host,
int port,
SslStores sslStores) {
Assert.notNull(server, "'server' must not be null");
Assert.notNull(host, "'host' must not be null");
Assert.notNull(sslStores, "'sslStores' must not be null");
SslContextFactory sslContextFactory = new SslContextFactory(sslStores.keystoreFile());
if (sslStores.keystorePassword() != null) {
sslContextFactory.setKeyStorePassword(sslStores.keystorePassword());
}
if (sslStores.certAlias() != null) {
sslContextFactory.setCertAlias(sslStores.certAlias());
}
if (sslStores.trustStoreFile() != null) {
sslContextFactory.setTrustStorePath(sslStores.trustStoreFile());
}
if (sslStores.trustStorePassword() != null) {
sslContextFactory.setTrustStorePassword(sslStores.trustStorePassword());
}
if (sslStores.needsClientCert()) {
sslContextFactory.setNeedClientAuth(true);
sslContextFactory.setWantClientAuth(true);
}
HttpConnectionFactory httpConnectionFactory = createHttpConnectionFactory();
ServerConnector connector = new ServerConnector(server, sslContextFactory, httpConnectionFactory);
initializeConnector(connector, host, port);
return connector;
} }
|
public class class_name {
public static ServerConnector createSecureSocketConnector(Server server,
String host,
int port,
SslStores sslStores) {
Assert.notNull(server, "'server' must not be null");
Assert.notNull(host, "'host' must not be null");
Assert.notNull(sslStores, "'sslStores' must not be null");
SslContextFactory sslContextFactory = new SslContextFactory(sslStores.keystoreFile());
if (sslStores.keystorePassword() != null) {
sslContextFactory.setKeyStorePassword(sslStores.keystorePassword()); // depends on control dependency: [if], data = [(sslStores.keystorePassword()]
}
if (sslStores.certAlias() != null) {
sslContextFactory.setCertAlias(sslStores.certAlias()); // depends on control dependency: [if], data = [(sslStores.certAlias()]
}
if (sslStores.trustStoreFile() != null) {
sslContextFactory.setTrustStorePath(sslStores.trustStoreFile()); // depends on control dependency: [if], data = [(sslStores.trustStoreFile()]
}
if (sslStores.trustStorePassword() != null) {
sslContextFactory.setTrustStorePassword(sslStores.trustStorePassword()); // depends on control dependency: [if], data = [(sslStores.trustStorePassword()]
}
if (sslStores.needsClientCert()) {
sslContextFactory.setNeedClientAuth(true); // depends on control dependency: [if], data = [none]
sslContextFactory.setWantClientAuth(true); // depends on control dependency: [if], data = [none]
}
HttpConnectionFactory httpConnectionFactory = createHttpConnectionFactory();
ServerConnector connector = new ServerConnector(server, sslContextFactory, httpConnectionFactory);
initializeConnector(connector, host, port);
return connector;
} }
|
public class class_name {
private void updateStyle(RendererState state, Style style)
{
// Now update each style property we know about
if (isSpecified(style, SVG.SPECIFIED_COLOR))
{
state.style.color = style.color;
}
if (isSpecified(style, SVG.SPECIFIED_OPACITY))
{
state.style.opacity = style.opacity;
}
if (isSpecified(style, SVG.SPECIFIED_FILL))
{
state.style.fill = style.fill;
state.hasFill = (style.fill != null && style.fill != Colour.TRANSPARENT);
}
if (isSpecified(style, SVG.SPECIFIED_FILL_OPACITY))
{
state.style.fillOpacity = style.fillOpacity;
}
// If either fill or its opacity has changed, update the fillPaint
if (isSpecified(style, SVG.SPECIFIED_FILL | SVG.SPECIFIED_FILL_OPACITY | SVG.SPECIFIED_COLOR | SVG.SPECIFIED_OPACITY))
{
setPaintColour(state, true, state.style.fill);
}
if (isSpecified(style, SVG.SPECIFIED_FILL_RULE))
{
state.style.fillRule = style.fillRule;
}
if (isSpecified(style, SVG.SPECIFIED_STROKE))
{
state.style.stroke = style.stroke;
state.hasStroke = (style.stroke != null && style.stroke != Colour.TRANSPARENT);
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_OPACITY))
{
state.style.strokeOpacity = style.strokeOpacity;
}
if (isSpecified(style, SVG.SPECIFIED_STROKE | SVG.SPECIFIED_STROKE_OPACITY | SVG.SPECIFIED_COLOR | SVG.SPECIFIED_OPACITY))
{
setPaintColour(state, false, state.style.stroke);
}
if (isSpecified(style, SVG.SPECIFIED_VECTOR_EFFECT))
{
state.style.vectorEffect = style.vectorEffect;
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_WIDTH))
{
state.style.strokeWidth = style.strokeWidth;
state.strokePaint.setStrokeWidth(state.style.strokeWidth.floatValue(this));
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_LINECAP))
{
state.style.strokeLineCap = style.strokeLineCap;
switch (style.strokeLineCap)
{
case Butt:
state.strokePaint.setStrokeCap(Paint.Cap.BUTT);
break;
case Round:
state.strokePaint.setStrokeCap(Paint.Cap.ROUND);
break;
case Square:
state.strokePaint.setStrokeCap(Paint.Cap.SQUARE);
break;
default:
break;
}
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_LINEJOIN))
{
state.style.strokeLineJoin = style.strokeLineJoin;
switch (style.strokeLineJoin)
{
case Miter:
state.strokePaint.setStrokeJoin(Paint.Join.MITER);
break;
case Round:
state.strokePaint.setStrokeJoin(Paint.Join.ROUND);
break;
case Bevel:
state.strokePaint.setStrokeJoin(Paint.Join.BEVEL);
break;
default:
break;
}
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_MITERLIMIT))
{
// FIXME: must be >= 0
state.style.strokeMiterLimit = style.strokeMiterLimit;
state.strokePaint.setStrokeMiter(style.strokeMiterLimit);
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHARRAY))
{
state.style.strokeDashArray = style.strokeDashArray;
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHOFFSET))
{
state.style.strokeDashOffset = style.strokeDashOffset;
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHARRAY | SVG.SPECIFIED_STROKE_DASHOFFSET))
{
// Either the dash array or dash offset has changed.
if (state.style.strokeDashArray == null)
{
state.strokePaint.setPathEffect(null);
}
else
{
float intervalSum = 0f;
int n = state.style.strokeDashArray.length;
// SVG dash arrays can be odd length, whereas Android dash arrays must have an even length.
// So we solve the problem by doubling the array length.
int arrayLen = (n % 2==0) ? n : n*2;
float[] intervals = new float[arrayLen];
for (int i=0; i<arrayLen; i++) {
intervals[i] = state.style.strokeDashArray[i % n].floatValue(this);
intervalSum += intervals[i];
}
if (intervalSum == 0f) {
state.strokePaint.setPathEffect(null);
} else {
float offset = state.style.strokeDashOffset.floatValue(this);
if (offset < 0) {
// SVG offsets can be negative. Not sure if Android ones can be.
// Just in case we will convert it.
offset = intervalSum + (offset % intervalSum);
}
state.strokePaint.setPathEffect( new DashPathEffect(intervals, offset) );
}
}
}
if (isSpecified(style, SVG.SPECIFIED_FONT_SIZE))
{
float currentFontSize = getCurrentFontSize();
state.style.fontSize = style.fontSize;
state.fillPaint.setTextSize(style.fontSize.floatValue(this, currentFontSize));
state.strokePaint.setTextSize(style.fontSize.floatValue(this, currentFontSize));
}
if (isSpecified(style, SVG.SPECIFIED_FONT_FAMILY))
{
state.style.fontFamily = style.fontFamily;
}
if (isSpecified(style, SVG.SPECIFIED_FONT_WEIGHT))
{
// Font weights are 100,200...900
if (style.fontWeight == Style.FONT_WEIGHT_LIGHTER && state.style.fontWeight > 100)
state.style.fontWeight -= 100;
else if (style.fontWeight == Style.FONT_WEIGHT_BOLDER && state.style.fontWeight < 900)
state.style.fontWeight += 100;
else
state.style.fontWeight = style.fontWeight;
}
if (isSpecified(style, SVG.SPECIFIED_FONT_STYLE))
{
state.style.fontStyle = style.fontStyle;
}
// If typeface, weight or style has changed, update the paint typeface
if (isSpecified(style, SVG.SPECIFIED_FONT_FAMILY | SVG.SPECIFIED_FONT_WEIGHT | SVG.SPECIFIED_FONT_STYLE))
{
Typeface font = null;
if (state.style.fontFamily != null && document != null) {
SVGExternalFileResolver fileResolver = SVG.getFileResolver();
for (String fontName: state.style.fontFamily) {
font = checkGenericFont(fontName, state.style.fontWeight, state.style.fontStyle);
if (font == null && fileResolver != null) {
font = fileResolver.resolveFont(fontName, state.style.fontWeight, String.valueOf(state.style.fontStyle));
}
if (font != null)
break;
}
}
if (font == null) {
// Fall back to default font
font = checkGenericFont(DEFAULT_FONT_FAMILY, state.style.fontWeight, state.style.fontStyle);
}
state.fillPaint.setTypeface(font);
state.strokePaint.setTypeface(font);
}
if (isSpecified(style, SVG.SPECIFIED_TEXT_DECORATION))
{
state.style.textDecoration = style.textDecoration;
state.fillPaint.setStrikeThruText(style.textDecoration == TextDecoration.LineThrough);
state.fillPaint.setUnderlineText(style.textDecoration == TextDecoration.Underline);
// There is a bug in Android <= JELLY_BEAN (16) that causes stroked underlines to
// not be drawn properly. See bug (39511). This has been fixed in JELLY_BEAN_MR1 (4.2)
if (android.os.Build.VERSION.SDK_INT >= 17) {
state.strokePaint.setStrikeThruText(style.textDecoration == TextDecoration.LineThrough);
state.strokePaint.setUnderlineText(style.textDecoration == TextDecoration.Underline);
}
}
if (isSpecified(style, SVG.SPECIFIED_DIRECTION))
{
state.style.direction = style.direction;
}
if (isSpecified(style, SVG.SPECIFIED_TEXT_ANCHOR))
{
state.style.textAnchor = style.textAnchor;
}
if (isSpecified(style, SVG.SPECIFIED_OVERFLOW))
{
state.style.overflow = style.overflow;
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_START))
{
state.style.markerStart = style.markerStart;
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_MID))
{
state.style.markerMid = style.markerMid;
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_END))
{
state.style.markerEnd = style.markerEnd;
}
if (isSpecified(style, SVG.SPECIFIED_DISPLAY))
{
state.style.display = style.display;
}
if (isSpecified(style, SVG.SPECIFIED_VISIBILITY))
{
state.style.visibility = style.visibility;
}
if (isSpecified(style, SVG.SPECIFIED_CLIP))
{
state.style.clip = style.clip;
}
if (isSpecified(style, SVG.SPECIFIED_CLIP_PATH))
{
state.style.clipPath = style.clipPath;
}
if (isSpecified(style, SVG.SPECIFIED_CLIP_RULE))
{
state.style.clipRule = style.clipRule;
}
if (isSpecified(style, SVG.SPECIFIED_MASK))
{
state.style.mask = style.mask;
}
if (isSpecified(style, SVG.SPECIFIED_STOP_COLOR))
{
state.style.stopColor = style.stopColor;
}
if (isSpecified(style, SVG.SPECIFIED_STOP_OPACITY))
{
state.style.stopOpacity = style.stopOpacity;
}
if (isSpecified(style, SVG.SPECIFIED_VIEWPORT_FILL))
{
state.style.viewportFill = style.viewportFill;
}
if (isSpecified(style, SVG.SPECIFIED_VIEWPORT_FILL_OPACITY))
{
state.style.viewportFillOpacity = style.viewportFillOpacity;
}
if (isSpecified(style, SVG.SPECIFIED_IMAGE_RENDERING))
{
state.style.imageRendering = style.imageRendering;
}
} }
|
public class class_name {
private void updateStyle(RendererState state, Style style)
{
// Now update each style property we know about
if (isSpecified(style, SVG.SPECIFIED_COLOR))
{
state.style.color = style.color;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_OPACITY))
{
state.style.opacity = style.opacity;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_FILL))
{
state.style.fill = style.fill;
// depends on control dependency: [if], data = [none]
state.hasFill = (style.fill != null && style.fill != Colour.TRANSPARENT);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_FILL_OPACITY))
{
state.style.fillOpacity = style.fillOpacity;
// depends on control dependency: [if], data = [none]
}
// If either fill or its opacity has changed, update the fillPaint
if (isSpecified(style, SVG.SPECIFIED_FILL | SVG.SPECIFIED_FILL_OPACITY | SVG.SPECIFIED_COLOR | SVG.SPECIFIED_OPACITY))
{
setPaintColour(state, true, state.style.fill);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_FILL_RULE))
{
state.style.fillRule = style.fillRule;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE))
{
state.style.stroke = style.stroke;
// depends on control dependency: [if], data = [none]
state.hasStroke = (style.stroke != null && style.stroke != Colour.TRANSPARENT);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_OPACITY))
{
state.style.strokeOpacity = style.strokeOpacity;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE | SVG.SPECIFIED_STROKE_OPACITY | SVG.SPECIFIED_COLOR | SVG.SPECIFIED_OPACITY))
{
setPaintColour(state, false, state.style.stroke);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_VECTOR_EFFECT))
{
state.style.vectorEffect = style.vectorEffect;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_WIDTH))
{
state.style.strokeWidth = style.strokeWidth;
// depends on control dependency: [if], data = [none]
state.strokePaint.setStrokeWidth(state.style.strokeWidth.floatValue(this));
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_LINECAP))
{
state.style.strokeLineCap = style.strokeLineCap;
// depends on control dependency: [if], data = [none]
switch (style.strokeLineCap)
{
case Butt:
state.strokePaint.setStrokeCap(Paint.Cap.BUTT);
break;
case Round:
state.strokePaint.setStrokeCap(Paint.Cap.ROUND);
break;
case Square:
state.strokePaint.setStrokeCap(Paint.Cap.SQUARE);
break;
default:
break;
}
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_LINEJOIN))
{
state.style.strokeLineJoin = style.strokeLineJoin;
// depends on control dependency: [if], data = [none]
switch (style.strokeLineJoin)
{
case Miter:
state.strokePaint.setStrokeJoin(Paint.Join.MITER);
break;
case Round:
state.strokePaint.setStrokeJoin(Paint.Join.ROUND);
break;
case Bevel:
state.strokePaint.setStrokeJoin(Paint.Join.BEVEL);
break;
default:
break;
}
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_MITERLIMIT))
{
// FIXME: must be >= 0
state.style.strokeMiterLimit = style.strokeMiterLimit;
// depends on control dependency: [if], data = [none]
state.strokePaint.setStrokeMiter(style.strokeMiterLimit);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHARRAY))
{
state.style.strokeDashArray = style.strokeDashArray;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHOFFSET))
{
state.style.strokeDashOffset = style.strokeDashOffset;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STROKE_DASHARRAY | SVG.SPECIFIED_STROKE_DASHOFFSET))
{
// Either the dash array or dash offset has changed.
if (state.style.strokeDashArray == null)
{
state.strokePaint.setPathEffect(null);
// depends on control dependency: [if], data = [null)]
}
else
{
float intervalSum = 0f;
int n = state.style.strokeDashArray.length;
// SVG dash arrays can be odd length, whereas Android dash arrays must have an even length.
// So we solve the problem by doubling the array length.
int arrayLen = (n % 2==0) ? n : n*2;
float[] intervals = new float[arrayLen];
for (int i=0; i<arrayLen; i++) {
intervals[i] = state.style.strokeDashArray[i % n].floatValue(this);
// depends on control dependency: [for], data = [i]
intervalSum += intervals[i];
// depends on control dependency: [for], data = [i]
}
if (intervalSum == 0f) {
state.strokePaint.setPathEffect(null);
// depends on control dependency: [if], data = [none]
} else {
float offset = state.style.strokeDashOffset.floatValue(this);
if (offset < 0) {
// SVG offsets can be negative. Not sure if Android ones can be.
// Just in case we will convert it.
offset = intervalSum + (offset % intervalSum);
// depends on control dependency: [if], data = [(offset]
}
state.strokePaint.setPathEffect( new DashPathEffect(intervals, offset) );
// depends on control dependency: [if], data = [none]
}
}
}
if (isSpecified(style, SVG.SPECIFIED_FONT_SIZE))
{
float currentFontSize = getCurrentFontSize();
state.style.fontSize = style.fontSize;
// depends on control dependency: [if], data = [none]
state.fillPaint.setTextSize(style.fontSize.floatValue(this, currentFontSize));
// depends on control dependency: [if], data = [none]
state.strokePaint.setTextSize(style.fontSize.floatValue(this, currentFontSize));
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_FONT_FAMILY))
{
state.style.fontFamily = style.fontFamily;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_FONT_WEIGHT))
{
// Font weights are 100,200...900
if (style.fontWeight == Style.FONT_WEIGHT_LIGHTER && state.style.fontWeight > 100)
state.style.fontWeight -= 100;
else if (style.fontWeight == Style.FONT_WEIGHT_BOLDER && state.style.fontWeight < 900)
state.style.fontWeight += 100;
else
state.style.fontWeight = style.fontWeight;
}
if (isSpecified(style, SVG.SPECIFIED_FONT_STYLE))
{
state.style.fontStyle = style.fontStyle;
// depends on control dependency: [if], data = [none]
}
// If typeface, weight or style has changed, update the paint typeface
if (isSpecified(style, SVG.SPECIFIED_FONT_FAMILY | SVG.SPECIFIED_FONT_WEIGHT | SVG.SPECIFIED_FONT_STYLE))
{
Typeface font = null;
if (state.style.fontFamily != null && document != null) {
SVGExternalFileResolver fileResolver = SVG.getFileResolver();
for (String fontName: state.style.fontFamily) {
font = checkGenericFont(fontName, state.style.fontWeight, state.style.fontStyle);
// depends on control dependency: [for], data = [fontName]
if (font == null && fileResolver != null) {
font = fileResolver.resolveFont(fontName, state.style.fontWeight, String.valueOf(state.style.fontStyle));
// depends on control dependency: [if], data = [(font]
}
if (font != null)
break;
}
}
if (font == null) {
// Fall back to default font
font = checkGenericFont(DEFAULT_FONT_FAMILY, state.style.fontWeight, state.style.fontStyle);
// depends on control dependency: [if], data = [none]
}
state.fillPaint.setTypeface(font);
// depends on control dependency: [if], data = [none]
state.strokePaint.setTypeface(font);
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_TEXT_DECORATION))
{
state.style.textDecoration = style.textDecoration;
// depends on control dependency: [if], data = [none]
state.fillPaint.setStrikeThruText(style.textDecoration == TextDecoration.LineThrough);
// depends on control dependency: [if], data = [none]
state.fillPaint.setUnderlineText(style.textDecoration == TextDecoration.Underline);
// depends on control dependency: [if], data = [none]
// There is a bug in Android <= JELLY_BEAN (16) that causes stroked underlines to
// not be drawn properly. See bug (39511). This has been fixed in JELLY_BEAN_MR1 (4.2)
if (android.os.Build.VERSION.SDK_INT >= 17) {
state.strokePaint.setStrikeThruText(style.textDecoration == TextDecoration.LineThrough);
// depends on control dependency: [if], data = [none]
state.strokePaint.setUnderlineText(style.textDecoration == TextDecoration.Underline);
// depends on control dependency: [if], data = [none]
}
}
if (isSpecified(style, SVG.SPECIFIED_DIRECTION))
{
state.style.direction = style.direction;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_TEXT_ANCHOR))
{
state.style.textAnchor = style.textAnchor;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_OVERFLOW))
{
state.style.overflow = style.overflow;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_START))
{
state.style.markerStart = style.markerStart;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_MID))
{
state.style.markerMid = style.markerMid;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_MARKER_END))
{
state.style.markerEnd = style.markerEnd;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_DISPLAY))
{
state.style.display = style.display;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_VISIBILITY))
{
state.style.visibility = style.visibility;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_CLIP))
{
state.style.clip = style.clip;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_CLIP_PATH))
{
state.style.clipPath = style.clipPath;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_CLIP_RULE))
{
state.style.clipRule = style.clipRule;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_MASK))
{
state.style.mask = style.mask;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STOP_COLOR))
{
state.style.stopColor = style.stopColor;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_STOP_OPACITY))
{
state.style.stopOpacity = style.stopOpacity;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_VIEWPORT_FILL))
{
state.style.viewportFill = style.viewportFill;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_VIEWPORT_FILL_OPACITY))
{
state.style.viewportFillOpacity = style.viewportFillOpacity;
// depends on control dependency: [if], data = [none]
}
if (isSpecified(style, SVG.SPECIFIED_IMAGE_RENDERING))
{
state.style.imageRendering = style.imageRendering;
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void prepareStatus() {
globalLineCounter = new AtomicLong(0);
time = new AtomicLong(System.currentTimeMillis());
startTime = System.currentTimeMillis();
lastCount = 0;
// Status thread regularly reports on what is happening
Thread statusThread = new Thread() {
public void run() {
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
System.out.println("Status thread interrupted");
}
long thisTime = System.currentTimeMillis();
long currentCount = globalLineCounter.get();
if (thisTime - time.get() > 1000) {
long oldTime = time.get();
time.set(thisTime);
double avgRate = 1000.0 * currentCount / (thisTime - startTime);
double instRate = 1000.0 * (currentCount - lastCount) / (thisTime - oldTime);
lastCount = currentCount;
System.out.println(currentCount + " AvgRage:" + ((int) avgRate) + " lines/sec instRate:"
+ ((int) instRate) + " lines/sec Unassigned Work: "
+ remainingBlocks.get() + " blocks");
}
}
}
};
statusThread.start();
} }
|
public class class_name {
public void prepareStatus() {
globalLineCounter = new AtomicLong(0);
time = new AtomicLong(System.currentTimeMillis());
startTime = System.currentTimeMillis();
lastCount = 0;
// Status thread regularly reports on what is happening
Thread statusThread = new Thread() {
public void run() {
while (true) {
try {
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
System.out.println("Status thread interrupted");
} // depends on control dependency: [catch], data = [none]
long thisTime = System.currentTimeMillis();
long currentCount = globalLineCounter.get();
if (thisTime - time.get() > 1000) {
long oldTime = time.get();
time.set(thisTime); // depends on control dependency: [if], data = [none]
double avgRate = 1000.0 * currentCount / (thisTime - startTime);
double instRate = 1000.0 * (currentCount - lastCount) / (thisTime - oldTime);
lastCount = currentCount; // depends on control dependency: [if], data = [none]
System.out.println(currentCount + " AvgRage:" + ((int) avgRate) + " lines/sec instRate:"
+ ((int) instRate) + " lines/sec Unassigned Work: "
+ remainingBlocks.get() + " blocks"); // depends on control dependency: [if], data = [none]
}
}
}
};
statusThread.start();
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions();
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId());
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId());
taskListNextOptions.withOcpDate(taskListOptions.ocpDate());
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> listWithServiceResponseAsync(final String jobId, final TaskListOptions taskListOptions) {
return listSinglePageAsync(jobId, taskListOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders>> call(ServiceResponseWithHeaders<Page<CloudTask>, TaskListHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
TaskListNextOptions taskListNextOptions = null;
if (taskListOptions != null) {
taskListNextOptions = new TaskListNextOptions(); // depends on control dependency: [if], data = [none]
taskListNextOptions.withClientRequestId(taskListOptions.clientRequestId()); // depends on control dependency: [if], data = [(taskListOptions]
taskListNextOptions.withReturnClientRequestId(taskListOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(taskListOptions]
taskListNextOptions.withOcpDate(taskListOptions.ocpDate()); // depends on control dependency: [if], data = [(taskListOptions]
}
return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink, taskListNextOptions));
}
});
} }
|
public class class_name {
public ZMsg configure(ZMsg msg)
{
msg.addFirst(CONFIG);
if (agent.send(msg)) {
// consume the status in the pipe
recvStatus();
ZMsg reply = agent.recv();
assert (reply != null);
// refill the pipe with status
agent.send(STATUS);
return reply;
}
return null;
} }
|
public class class_name {
public ZMsg configure(ZMsg msg)
{
msg.addFirst(CONFIG);
if (agent.send(msg)) {
// consume the status in the pipe
recvStatus(); // depends on control dependency: [if], data = [none]
ZMsg reply = agent.recv();
assert (reply != null); // depends on control dependency: [if], data = [none]
// refill the pipe with status
agent.send(STATUS); // depends on control dependency: [if], data = [none]
return reply; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void initialize() {
if (m_taskFuture != null) {
m_taskFuture.cancel(false);
m_taskFuture = null;
}
reload();
m_taskFuture = OpenCms.getExecutor().scheduleWithFixedDelay(
this::performUpdate,
UPDATE_DELAY_MILLIS,
UPDATE_DELAY_MILLIS,
TimeUnit.MILLISECONDS);
} }
|
public class class_name {
public void initialize() {
if (m_taskFuture != null) {
m_taskFuture.cancel(false); // depends on control dependency: [if], data = [none]
m_taskFuture = null; // depends on control dependency: [if], data = [none]
}
reload();
m_taskFuture = OpenCms.getExecutor().scheduleWithFixedDelay(
this::performUpdate,
UPDATE_DELAY_MILLIS,
UPDATE_DELAY_MILLIS,
TimeUnit.MILLISECONDS);
} }
|
public class class_name {
public void marshall(PutEventsRequestEntry putEventsRequestEntry, ProtocolMarshaller protocolMarshaller) {
if (putEventsRequestEntry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putEventsRequestEntry.getTime(), TIME_BINDING);
protocolMarshaller.marshall(putEventsRequestEntry.getSource(), SOURCE_BINDING);
protocolMarshaller.marshall(putEventsRequestEntry.getResources(), RESOURCES_BINDING);
protocolMarshaller.marshall(putEventsRequestEntry.getDetailType(), DETAILTYPE_BINDING);
protocolMarshaller.marshall(putEventsRequestEntry.getDetail(), DETAIL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutEventsRequestEntry putEventsRequestEntry, ProtocolMarshaller protocolMarshaller) {
if (putEventsRequestEntry == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putEventsRequestEntry.getTime(), TIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putEventsRequestEntry.getSource(), SOURCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putEventsRequestEntry.getResources(), RESOURCES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putEventsRequestEntry.getDetailType(), DETAILTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putEventsRequestEntry.getDetail(), DETAIL_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 byte[] toByteArray()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "toByteArray");
// Just in case you're wondering, if two threads race to create the
// cached arrays, we may end up with two identical arrays, one of which
// is cached, while the other thread uses the second. Since the contents of
// the arrays are identical, this does not cause a problem!
if (_cachedBytes == null)
{
_cachedBytes = new byte[16];
_cachedBytes[0] = (byte) ((_uuidHigh & 0xFF00000000000000L) >>> 56);
_cachedBytes[1] = (byte) ((_uuidHigh & 0x00FF000000000000L) >>> 48);
_cachedBytes[2] = (byte) ((_uuidHigh & 0x0000FF0000000000L) >>> 40);
_cachedBytes[3] = (byte) ((_uuidHigh & 0x000000FF00000000L) >>> 32);
_cachedBytes[4] = (byte) ((_uuidHigh & 0x00000000FF000000L) >>> 24);
_cachedBytes[5] = (byte) ((_uuidHigh & 0x0000000000FF0000L) >>> 16);
_cachedBytes[6] = (byte) ((_uuidHigh & 0x000000000000FF00L) >>> 8);
_cachedBytes[7] = (byte) ((_uuidHigh & 0x00000000000000FFL) >>> 0);
_cachedBytes[8] = (byte) ((_uuidLow & 0xFF00000000000000L) >>> 56);
_cachedBytes[9] = (byte) ((_uuidLow & 0x00FF000000000000L) >>> 48);
_cachedBytes[10] = (byte) ((_uuidLow & 0x0000FF0000000000L) >>> 40);
_cachedBytes[11] = (byte) ((_uuidLow & 0x000000FF00000000L) >>> 32);
_cachedBytes[12] = (byte) ((_uuidLow & 0x00000000FF000000L) >>> 24);
_cachedBytes[13] = (byte) ((_uuidLow & 0x0000000000FF0000L) >>> 16);
_cachedBytes[14] = (byte) ((_uuidLow & 0x000000000000FF00L) >>> 8);
_cachedBytes[15] = (byte) ((_uuidLow & 0x00000000000000FFL) >>> 0);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "toByteArray", com.ibm.ejs.util.Util.toHexString(_cachedBytes));
return _cachedBytes;
} }
|
public class class_name {
public byte[] toByteArray()
{
if (tc.isEntryEnabled())
Tr.entry(tc, "toByteArray");
// Just in case you're wondering, if two threads race to create the
// cached arrays, we may end up with two identical arrays, one of which
// is cached, while the other thread uses the second. Since the contents of
// the arrays are identical, this does not cause a problem!
if (_cachedBytes == null)
{
_cachedBytes = new byte[16]; // depends on control dependency: [if], data = [none]
_cachedBytes[0] = (byte) ((_uuidHigh & 0xFF00000000000000L) >>> 56); // depends on control dependency: [if], data = [none]
_cachedBytes[1] = (byte) ((_uuidHigh & 0x00FF000000000000L) >>> 48); // depends on control dependency: [if], data = [none]
_cachedBytes[2] = (byte) ((_uuidHigh & 0x0000FF0000000000L) >>> 40); // depends on control dependency: [if], data = [none]
_cachedBytes[3] = (byte) ((_uuidHigh & 0x000000FF00000000L) >>> 32); // depends on control dependency: [if], data = [none]
_cachedBytes[4] = (byte) ((_uuidHigh & 0x00000000FF000000L) >>> 24); // depends on control dependency: [if], data = [none]
_cachedBytes[5] = (byte) ((_uuidHigh & 0x0000000000FF0000L) >>> 16); // depends on control dependency: [if], data = [none]
_cachedBytes[6] = (byte) ((_uuidHigh & 0x000000000000FF00L) >>> 8); // depends on control dependency: [if], data = [none]
_cachedBytes[7] = (byte) ((_uuidHigh & 0x00000000000000FFL) >>> 0); // depends on control dependency: [if], data = [none]
_cachedBytes[8] = (byte) ((_uuidLow & 0xFF00000000000000L) >>> 56); // depends on control dependency: [if], data = [none]
_cachedBytes[9] = (byte) ((_uuidLow & 0x00FF000000000000L) >>> 48); // depends on control dependency: [if], data = [none]
_cachedBytes[10] = (byte) ((_uuidLow & 0x0000FF0000000000L) >>> 40); // depends on control dependency: [if], data = [none]
_cachedBytes[11] = (byte) ((_uuidLow & 0x000000FF00000000L) >>> 32); // depends on control dependency: [if], data = [none]
_cachedBytes[12] = (byte) ((_uuidLow & 0x00000000FF000000L) >>> 24); // depends on control dependency: [if], data = [none]
_cachedBytes[13] = (byte) ((_uuidLow & 0x0000000000FF0000L) >>> 16); // depends on control dependency: [if], data = [none]
_cachedBytes[14] = (byte) ((_uuidLow & 0x000000000000FF00L) >>> 8); // depends on control dependency: [if], data = [none]
_cachedBytes[15] = (byte) ((_uuidLow & 0x00000000000000FFL) >>> 0); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, "toByteArray", com.ibm.ejs.util.Util.toHexString(_cachedBytes));
return _cachedBytes;
} }
|
public class class_name {
public ResultMap getResultMap(Configuration configuration) {
if (this.resultMap != null) {
return this.resultMap;
}
if (entityClassColumns == null || entityClassColumns.size() == 0) {
return null;
}
List<ResultMapping> resultMappings = new ArrayList<ResultMapping>();
for (EntityColumn entityColumn : entityClassColumns) {
String column = entityColumn.getColumn();
//去掉可能存在的分隔符
Matcher matcher = DELIMITER.matcher(column);
if(matcher.find()){
column = matcher.group(1);
}
ResultMapping.Builder builder = new ResultMapping.Builder(configuration, entityColumn.getProperty(), column, entityColumn.getJavaType());
if (entityColumn.getJdbcType() != null) {
builder.jdbcType(entityColumn.getJdbcType());
}
if (entityColumn.getTypeHandler() != null) {
try {
builder.typeHandler(getInstance(entityColumn.getJavaType(),entityColumn.getTypeHandler()));
} catch (Exception e) {
throw new MapperException(e);
}
}
List<ResultFlag> flags = new ArrayList<ResultFlag>();
if (entityColumn.isId()) {
flags.add(ResultFlag.ID);
}
builder.flags(flags);
resultMappings.add(builder.build());
}
ResultMap.Builder builder = new ResultMap.Builder(configuration, "BaseMapperResultMap", this.entityClass, resultMappings, true);
this.resultMap = builder.build();
return this.resultMap;
} }
|
public class class_name {
public ResultMap getResultMap(Configuration configuration) {
if (this.resultMap != null) {
return this.resultMap; // depends on control dependency: [if], data = [none]
}
if (entityClassColumns == null || entityClassColumns.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<ResultMapping> resultMappings = new ArrayList<ResultMapping>();
for (EntityColumn entityColumn : entityClassColumns) {
String column = entityColumn.getColumn();
//去掉可能存在的分隔符
Matcher matcher = DELIMITER.matcher(column);
if(matcher.find()){
column = matcher.group(1); // depends on control dependency: [if], data = [none]
}
ResultMapping.Builder builder = new ResultMapping.Builder(configuration, entityColumn.getProperty(), column, entityColumn.getJavaType());
if (entityColumn.getJdbcType() != null) {
builder.jdbcType(entityColumn.getJdbcType()); // depends on control dependency: [if], data = [(entityColumn.getJdbcType()]
}
if (entityColumn.getTypeHandler() != null) {
try {
builder.typeHandler(getInstance(entityColumn.getJavaType(),entityColumn.getTypeHandler())); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new MapperException(e);
} // depends on control dependency: [catch], data = [none]
}
List<ResultFlag> flags = new ArrayList<ResultFlag>();
if (entityColumn.isId()) {
flags.add(ResultFlag.ID); // depends on control dependency: [if], data = [none]
}
builder.flags(flags); // depends on control dependency: [for], data = [none]
resultMappings.add(builder.build()); // depends on control dependency: [for], data = [none]
}
ResultMap.Builder builder = new ResultMap.Builder(configuration, "BaseMapperResultMap", this.entityClass, resultMappings, true);
this.resultMap = builder.build();
return this.resultMap;
} }
|
public class class_name {
public static Iterable<BoxCollaborationWhitelist.Info> getAll(final BoxAPIConnection api, int limit,
String ... fields) {
QueryStringBuilder builder = new QueryStringBuilder();
if (fields.length > 0) {
builder.appendParam("fields", fields);
}
URL url = COLLABORATION_WHITELIST_ENTRIES_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
return new BoxResourceIterable<BoxCollaborationWhitelist.Info>(api, url, limit) {
@Override
protected BoxCollaborationWhitelist.Info factory(JsonObject jsonObject) {
BoxCollaborationWhitelist whitelist = new BoxCollaborationWhitelist(
api, jsonObject.get("id").asString());
return whitelist.new Info(jsonObject);
}
};
} }
|
public class class_name {
public static Iterable<BoxCollaborationWhitelist.Info> getAll(final BoxAPIConnection api, int limit,
String ... fields) {
QueryStringBuilder builder = new QueryStringBuilder();
if (fields.length > 0) {
builder.appendParam("fields", fields); // depends on control dependency: [if], data = [none]
}
URL url = COLLABORATION_WHITELIST_ENTRIES_URL_TEMPLATE.buildWithQuery(api.getBaseURL(), builder.toString());
return new BoxResourceIterable<BoxCollaborationWhitelist.Info>(api, url, limit) {
@Override
protected BoxCollaborationWhitelist.Info factory(JsonObject jsonObject) {
BoxCollaborationWhitelist whitelist = new BoxCollaborationWhitelist(
api, jsonObject.get("id").asString());
return whitelist.new Info(jsonObject);
}
};
} }
|
public class class_name {
private void push(final SymbolTable symbolTable, final String descriptor) {
int typeDescriptorOffset = descriptor.charAt(0) == '(' ? descriptor.indexOf(')') + 1 : 0;
int abstractType = getAbstractTypeFromDescriptor(symbolTable, descriptor, typeDescriptorOffset);
if (abstractType != 0) {
push(abstractType);
if (abstractType == LONG || abstractType == DOUBLE) {
push(TOP);
}
}
} }
|
public class class_name {
private void push(final SymbolTable symbolTable, final String descriptor) {
int typeDescriptorOffset = descriptor.charAt(0) == '(' ? descriptor.indexOf(')') + 1 : 0;
int abstractType = getAbstractTypeFromDescriptor(symbolTable, descriptor, typeDescriptorOffset);
if (abstractType != 0) {
push(abstractType); // depends on control dependency: [if], data = [(abstractType]
if (abstractType == LONG || abstractType == DOUBLE) {
push(TOP); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public java.util.List<SecurityGroupMembership> getSecurityGroups() {
if (securityGroups == null) {
securityGroups = new com.amazonaws.internal.SdkInternalList<SecurityGroupMembership>();
}
return securityGroups;
} }
|
public class class_name {
public java.util.List<SecurityGroupMembership> getSecurityGroups() {
if (securityGroups == null) {
securityGroups = new com.amazonaws.internal.SdkInternalList<SecurityGroupMembership>(); // depends on control dependency: [if], data = [none]
}
return securityGroups;
} }
|
public class class_name {
public void reset()
{
try
{
if(rs.getType() == ResultSet.TYPE_FORWARD_ONLY)
{
throw new UnsupportedOperationException("Can not reset iterator for a ResultSet that is of type \"forward only\"");
}
hasNext = rs.first();
}
catch (SQLException ex)
{
log.error(null, ex);
}
} }
|
public class class_name {
public void reset()
{
try
{
if(rs.getType() == ResultSet.TYPE_FORWARD_ONLY)
{
throw new UnsupportedOperationException("Can not reset iterator for a ResultSet that is of type \"forward only\"");
}
hasNext = rs.first(); // depends on control dependency: [try], data = [none]
}
catch (SQLException ex)
{
log.error(null, ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Supplier<Connection> getConnectionSupplier() {
final boolean startConnection = isStartConnection();
if (connectionSupplier == null) {
if (getUserName() == null) {
connectionSupplier = () -> {
try {
final Connection connection = getConnectionFactory().createConnection();
if (startConnection) {
connection.start();
}
return connection;
} catch (JMSException e) {
throw new JmsNotConnectedException("Unable to create context", e);
}
};
} else {
final String userName = getUserName();
final String password = getPassword();
connectionSupplier = () -> {
try {
final Connection connection = getConnectionFactory().createConnection(userName, password);
if (startConnection) {
connection.start();
}
return connection;
} catch (JMSException e) {
throw new JmsNotConnectedException("Unable to create context for user " + userName, e);
}
};
}
}
return connectionSupplier;
} }
|
public class class_name {
public Supplier<Connection> getConnectionSupplier() {
final boolean startConnection = isStartConnection();
if (connectionSupplier == null) {
if (getUserName() == null) {
connectionSupplier = () -> {
try {
final Connection connection = getConnectionFactory().createConnection();
if (startConnection) {
connection.start(); // depends on control dependency: [if], data = [none]
}
return connection; // depends on control dependency: [try], data = [none]
} catch (JMSException e) {
throw new JmsNotConnectedException("Unable to create context", e);
} // depends on control dependency: [catch], data = [none]
};
} else {
final String userName = getUserName();
final String password = getPassword();
connectionSupplier = () -> {
try {
final Connection connection = getConnectionFactory().createConnection(userName, password);
if (startConnection) {
connection.start(); // depends on control dependency: [if], data = [none]
}
return connection; // depends on control dependency: [try], data = [none]
} catch (JMSException e) {
throw new JmsNotConnectedException("Unable to create context for user " + userName, e);
} // depends on control dependency: [catch], data = [none]
};
}
}
return connectionSupplier;
} }
|
public class class_name {
public DevSource get_source(final Connection connection) throws DevFailed {
if (is_taco(connection)) {
if (connection.taco_device == null) {
connection.taco_device = new TacoTangoDevice(connection.devname,
connection.url.host);
}
return connection.taco_device.get_source();
} else {
return connection.dev_src;
}
} }
|
public class class_name {
public DevSource get_source(final Connection connection) throws DevFailed {
if (is_taco(connection)) {
if (connection.taco_device == null) {
connection.taco_device = new TacoTangoDevice(connection.devname,
connection.url.host); // depends on control dependency: [if], data = [none]
}
return connection.taco_device.get_source();
} else {
return connection.dev_src;
}
} }
|
public class class_name {
protected String getBaseUrl(final HttpServletRequest request) {
if (LOG.isDebugEnabled()) {
LOG.debug("Extract base url from " + request);
}
StringBuilder results = new StringBuilder();
results.append(request.getScheme());
results.append("://");
results.append(request.getServerName());
if ((!("http".equals(request.getScheme()) && (80 == request.getServerPort())))
&& (!("https".equals(request.getScheme()) && (443 == request.getServerPort())))) {
results.append(':');
results.append(request.getServerPort());
}
results.append(request.getContextPath());
// Make sure to strip any trailing slash
if (results.charAt(results.length() - 1) == '/') {
return results.substring(0, results.length() - 1);
}
return results.toString();
} }
|
public class class_name {
protected String getBaseUrl(final HttpServletRequest request) {
if (LOG.isDebugEnabled()) {
LOG.debug("Extract base url from " + request); // depends on control dependency: [if], data = [none]
}
StringBuilder results = new StringBuilder();
results.append(request.getScheme());
results.append("://");
results.append(request.getServerName());
if ((!("http".equals(request.getScheme()) && (80 == request.getServerPort())))
&& (!("https".equals(request.getScheme()) && (443 == request.getServerPort())))) {
results.append(':'); // depends on control dependency: [if], data = [none]
results.append(request.getServerPort()); // depends on control dependency: [if], data = [none]
}
results.append(request.getContextPath());
// Make sure to strip any trailing slash
if (results.charAt(results.length() - 1) == '/') {
return results.substring(0, results.length() - 1); // depends on control dependency: [if], data = [none]
}
return results.toString();
} }
|
public class class_name {
public final DataHash getHash() {
if (outputHash == null) {
byte[] hash = messageDigest.digest();
outputHash = new DataHash(algorithm, hash);
}
return outputHash;
} }
|
public class class_name {
public final DataHash getHash() {
if (outputHash == null) {
byte[] hash = messageDigest.digest();
outputHash = new DataHash(algorithm, hash); // depends on control dependency: [if], data = [none]
}
return outputHash;
} }
|
public class class_name {
public static Double parseDouble(String value, Double defaultValue) {
if (isNullOrEmpty(value)) {
return defaultValue;
}
return Double.parseDouble(value);
} }
|
public class class_name {
public static Double parseDouble(String value, Double defaultValue) {
if (isNullOrEmpty(value)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return Double.parseDouble(value);
} }
|
public class class_name {
public List<VoltXMLElement> findChildrenRecursively(String name)
{
List<VoltXMLElement> retval = new ArrayList<>();
for (VoltXMLElement vxe : children) {
if (name.equals(vxe.name)) {
retval.add(vxe);
}
retval.addAll(vxe.findChildrenRecursively(name));
}
return retval;
} }
|
public class class_name {
public List<VoltXMLElement> findChildrenRecursively(String name)
{
List<VoltXMLElement> retval = new ArrayList<>();
for (VoltXMLElement vxe : children) {
if (name.equals(vxe.name)) {
retval.add(vxe); // depends on control dependency: [if], data = [none]
}
retval.addAll(vxe.findChildrenRecursively(name)); // depends on control dependency: [for], data = [vxe]
}
return retval;
} }
|
public class class_name {
public void unsubscribeFromTopic() {
try {
HttpGet request = new HttpGet(unsubscribeUrl.toURI());
HttpResponse response = httpClient.execute(request);
if (!ApacheUtils.isRequestSuccessful(response)) {
throw new SdkClientException(String.format("Could not unsubscribe from %s: %d %s.%n%s",
getTopicArn(),
response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase(),
IOUtils.toString(response.getEntity().getContent())));
}
} catch (Exception e) {
throw new SdkClientException(e);
}
} }
|
public class class_name {
public void unsubscribeFromTopic() {
try {
HttpGet request = new HttpGet(unsubscribeUrl.toURI());
HttpResponse response = httpClient.execute(request);
if (!ApacheUtils.isRequestSuccessful(response)) {
throw new SdkClientException(String.format("Could not unsubscribe from %s: %d %s.%n%s",
getTopicArn(),
response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase(),
IOUtils.toString(response.getEntity().getContent())));
}
} catch (Exception e) {
throw new SdkClientException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String getSender(final SmsSendRequestDto smsSendRequestDto) {
if (StringUtils.isNotBlank(smsSendRequestDto.getSender())) {
return smsSendRequestDto.getSender();
}
Validate.notEmpty(defaultSender, "defaultSender must not be null or blank");
return defaultSender;
} }
|
public class class_name {
protected String getSender(final SmsSendRequestDto smsSendRequestDto) {
if (StringUtils.isNotBlank(smsSendRequestDto.getSender())) {
return smsSendRequestDto.getSender(); // depends on control dependency: [if], data = [none]
}
Validate.notEmpty(defaultSender, "defaultSender must not be null or blank");
return defaultSender;
} }
|
public class class_name {
public File getNextFile(File pre) {
try {
lock.lockInterruptibly();
if (exception != null) {
throw exception;
}
if (binlogs.size() == 0) {
return null;
} else {
if (pre == null) {// 第一次
return binlogs.get(0);
} else {
int index = seek(pre);
if (index < binlogs.size() - 1) {
return binlogs.get(index + 1);
} else {
return null;
}
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
} finally {
lock.unlock();
}
} }
|
public class class_name {
public File getNextFile(File pre) {
try {
lock.lockInterruptibly(); // depends on control dependency: [try], data = [none]
if (exception != null) {
throw exception;
}
if (binlogs.size() == 0) {
return null; // depends on control dependency: [if], data = [none]
} else {
if (pre == null) {// 第一次
return binlogs.get(0); // depends on control dependency: [if], data = [none]
} else {
int index = seek(pre);
if (index < binlogs.size() - 1) {
return binlogs.get(index + 1); // depends on control dependency: [if], data = [(index]
} else {
return null; // depends on control dependency: [if], data = [none]
}
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
} finally { // depends on control dependency: [catch], data = [none]
lock.unlock();
}
} }
|
public class class_name {
public boolean copyChanges(final Tree tree, final boolean overwrite) {
if (tree == null) {
throw new IllegalArgumentException("Cannot copy a null tree");
}
if (tree_id != tree.tree_id) {
throw new IllegalArgumentException("Tree IDs do not match");
}
if (overwrite || tree.changed.get("name")) {
name = tree.name;
changed.put("name", true);
}
if (overwrite || tree.changed.get("description")) {
description = tree.description;
changed.put("description", true);
}
if (overwrite || tree.changed.get("notes")) {
notes = tree.notes;
changed.put("notes", true);
}
if (overwrite || tree.changed.get("strict_match")) {
strict_match = tree.strict_match;
changed.put("strict_match", true);
}
if (overwrite || tree.changed.get("enabled")) {
enabled = tree.enabled;
changed.put("enabled", true);
}
if (overwrite || tree.changed.get("store_failures")) {
store_failures = tree.store_failures;
changed.put("store_failures", true);
}
for (boolean has_changes : changed.values()) {
if (has_changes) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean copyChanges(final Tree tree, final boolean overwrite) {
if (tree == null) {
throw new IllegalArgumentException("Cannot copy a null tree");
}
if (tree_id != tree.tree_id) {
throw new IllegalArgumentException("Tree IDs do not match");
}
if (overwrite || tree.changed.get("name")) {
name = tree.name; // depends on control dependency: [if], data = [none]
changed.put("name", true); // depends on control dependency: [if], data = [none]
}
if (overwrite || tree.changed.get("description")) {
description = tree.description; // depends on control dependency: [if], data = [none]
changed.put("description", true); // depends on control dependency: [if], data = [none]
}
if (overwrite || tree.changed.get("notes")) {
notes = tree.notes; // depends on control dependency: [if], data = [none]
changed.put("notes", true); // depends on control dependency: [if], data = [none]
}
if (overwrite || tree.changed.get("strict_match")) {
strict_match = tree.strict_match; // depends on control dependency: [if], data = [none]
changed.put("strict_match", true); // depends on control dependency: [if], data = [none]
}
if (overwrite || tree.changed.get("enabled")) {
enabled = tree.enabled; // depends on control dependency: [if], data = [none]
changed.put("enabled", true); // depends on control dependency: [if], data = [none]
}
if (overwrite || tree.changed.get("store_failures")) {
store_failures = tree.store_failures; // depends on control dependency: [if], data = [none]
changed.put("store_failures", true); // depends on control dependency: [if], data = [none]
}
for (boolean has_changes : changed.values()) {
if (has_changes) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private void removeExistingTable(VerticalLayout layout) {
List<Component> tobeRemoved = new ArrayList<Component>();
Iterator<Component> it = layout.iterator();
while (it.hasNext()) {
Component comp = it.next();
if ((comp instanceof FixedHeightPanel) | (comp instanceof TextField) | (comp instanceof VerticalLayout)) {
tobeRemoved.add(comp);
}
}
for (Component c : tobeRemoved) {
layout.removeComponent(c);
}
} }
|
public class class_name {
private void removeExistingTable(VerticalLayout layout) {
List<Component> tobeRemoved = new ArrayList<Component>();
Iterator<Component> it = layout.iterator();
while (it.hasNext()) {
Component comp = it.next();
if ((comp instanceof FixedHeightPanel) | (comp instanceof TextField) | (comp instanceof VerticalLayout)) {
tobeRemoved.add(comp); // depends on control dependency: [if], data = [none]
}
}
for (Component c : tobeRemoved) {
layout.removeComponent(c); // depends on control dependency: [for], data = [c]
}
} }
|
public class class_name {
private boolean isDomainExcludedFromProxy(String domainName) {
if (domainName == null || domainName.isEmpty()) {
return false;
}
for (DomainMatcher excludedDomain : proxyExcludedDomainsEnabled) {
if (excludedDomain.matches(domainName)) {
return true;
}
}
return false;
} }
|
public class class_name {
private boolean isDomainExcludedFromProxy(String domainName) {
if (domainName == null || domainName.isEmpty()) {
return false;
// depends on control dependency: [if], data = [none]
}
for (DomainMatcher excludedDomain : proxyExcludedDomainsEnabled) {
if (excludedDomain.matches(domainName)) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
@Override
public void update(ChannelData cc) {
synchronized (this) {
// can't do two updates at the same time
if (this.config.checkAndSetValues(cc)) {
this.alists = AccessLists.getInstance(this.config);
}
}
} }
|
public class class_name {
@Override
public void update(ChannelData cc) {
synchronized (this) {
// can't do two updates at the same time
if (this.config.checkAndSetValues(cc)) {
this.alists = AccessLists.getInstance(this.config); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static Path getWindupRulesDir()
{
String rulesDir = System.getProperty(WINDUP_RULESETS_DIR_SYSPROP);
if (rulesDir != null)
{
Path path = Paths.get(rulesDir);
if (!path.toFile().exists())
LOG.warning(WINDUP_RULESETS_DIR_SYSPROP + " points to a non-existent directory!" + path.toAbsolutePath().toString());
return path;
}
else
return getWindupSubdirectory(RULES_DIRECTORY_NAME);
} }
|
public class class_name {
public static Path getWindupRulesDir()
{
String rulesDir = System.getProperty(WINDUP_RULESETS_DIR_SYSPROP);
if (rulesDir != null)
{
Path path = Paths.get(rulesDir);
if (!path.toFile().exists())
LOG.warning(WINDUP_RULESETS_DIR_SYSPROP + " points to a non-existent directory!" + path.toAbsolutePath().toString());
return path; // depends on control dependency: [if], data = [none]
}
else
return getWindupSubdirectory(RULES_DIRECTORY_NAME);
} }
|
public class class_name {
public List<Record> handle(Record record) {
StringBuilder b = new StringBuilder();
//--Special case for Exceptions
String[] content;
if (record.content instanceof Throwable) {
//(vars)
List<String> lines = new ArrayList<String>();
StackTraceElement[] trace = null;
StackTraceElement topTraceElement= null;
//(root message)
Throwable exception = (Throwable) record.content;
lines.add(record.content.toString());
trace = exception.getStackTrace();
topTraceElement = trace.length > 0 ? trace[0] : null;
for(StackTraceElement e : exception.getStackTrace()){
lines.add(tab + e.toString());
}
//(causes)
while(exception.getCause() != null){
System.out.println("TOP ELEMENT: " + topTraceElement);
//((variables))
exception = exception.getCause();
trace = exception.getStackTrace();
lines.add("Caused by: " + exception.getClass()+": " + exception.getMessage());
for(int i=0; i<trace.length; i++){
//((add trace element))
StackTraceElement e = trace[i];
lines.add(tab + e.toString());
//((don't print redundant elements))
if(topTraceElement != null &&
e.getClassName().equals(topTraceElement.getClassName()) &&
e.getMethodName().equals(topTraceElement.getMethodName())){
lines.add(tab+"..."+(trace.length-i-1) + " more");
break;
}
}
//((update top element))
topTraceElement = trace.length > 0 ? trace[0] : null;
}
//(set content array)
content = new String[lines.size()];
content = lines.toArray(content);
} else if(record.content == null){
content = new String[]{"null"};
} else {
content = record.content.toString().split("\n"); //would be nice to get rid of this 'split()' call at some point
}
//--Handle Tracks
updateTracks(record.depth);
if(this.missingOpenBracket){
this.style(b, "{\n", trackColor, trackStyle);
this.missingOpenBracket = false;
}
//--Process Record
//(variables)
int cursorPos = 0;
int contentLinesPrinted = 0;
//(loop)
Color color = Color.NONE;
Style style = Style.NONE;
//(get channels)
ArrayList<Object> printableChannels = new ArrayList<Object>();
for(Object chan : record.channels()){
if(chan instanceof Color){ color = (Color) chan; }
else if(chan instanceof Style){ style = (Style) chan; }
else if(chan != Redwood.FORCE){ printableChannels.add(chan); }
}
//--Write Channels
if(leftMargin > 2) { //don't print if not enough space
//((print channels)
if(printableChannels.size() > 0){ b.append("["); cursorPos += 1; }
Object lastChan = null;
for(int i=0; i<printableChannels.size(); i++) {
Object chan = printableChannels.get(i);
if(chan.equals(lastChan)){ continue; } //skip duplicate channels
lastChan = chan;
//(get chan)
String chanToString = chan.toString();
String toPrint = chan.toString();
if(toPrint.length() > leftMargin-1){ toPrint = toPrint.substring(0,leftMargin-2); }
if(cursorPos+toPrint.length() >= leftMargin){
//(case: doesn't fit)
while(cursorPos < leftMargin){ b.append(" "); cursorPos += 1; }
if(contentLinesPrinted < content.length){
writeContent(record.depth, style(new StringBuilder(),content[contentLinesPrinted],color,style).toString(), b);
contentLinesPrinted += 1;
}
b.append("\n ");
cursorPos = 1;
}
//(print flag)
formatChannel(b, toPrint, chanToString);
if(i < printableChannels.size()-1){ b.append(channelSeparatorChar); cursorPos += 1; }
cursorPos += toPrint.length();
}
if(printableChannels.size() > 0){ b.append("]"); cursorPos += 1; }
}
//--Content
//(write content)
while(contentLinesPrinted < content.length) {
while(cursorPos < leftMargin){ b.append(" "); cursorPos += 1; }
writeContent(record.depth, style(new StringBuilder(),content[contentLinesPrinted],color,style).toString(), b);
contentLinesPrinted += 1;
if(contentLinesPrinted < content.length){ b.append("\n"); cursorPos = 0; }
}
//(print)
if (b.length() == 0 || b.charAt(b.length() - 1) != '\n') {
b.append("\n");
}
print(b.toString());
//--Continue
if(info != null){
info.numElementsPrinted += 1;
}
ArrayList<Record> rtn = new ArrayList<Record>();
rtn.add(record);
return rtn;
} }
|
public class class_name {
public List<Record> handle(Record record) {
StringBuilder b = new StringBuilder();
//--Special case for Exceptions
String[] content;
if (record.content instanceof Throwable) {
//(vars)
List<String> lines = new ArrayList<String>();
StackTraceElement[] trace = null;
StackTraceElement topTraceElement= null;
//(root message)
Throwable exception = (Throwable) record.content;
lines.add(record.content.toString());
// depends on control dependency: [if], data = [none]
trace = exception.getStackTrace();
// depends on control dependency: [if], data = [none]
topTraceElement = trace.length > 0 ? trace[0] : null;
// depends on control dependency: [if], data = [none]
for(StackTraceElement e : exception.getStackTrace()){
lines.add(tab + e.toString());
// depends on control dependency: [for], data = [e]
}
//(causes)
while(exception.getCause() != null){
System.out.println("TOP ELEMENT: " + topTraceElement);
// depends on control dependency: [while], data = [none]
//((variables))
exception = exception.getCause();
// depends on control dependency: [while], data = [none]
trace = exception.getStackTrace();
// depends on control dependency: [while], data = [none]
lines.add("Caused by: " + exception.getClass()+": " + exception.getMessage());
// depends on control dependency: [while], data = [none]
for(int i=0; i<trace.length; i++){
//((add trace element))
StackTraceElement e = trace[i];
lines.add(tab + e.toString());
// depends on control dependency: [for], data = [none]
//((don't print redundant elements))
if(topTraceElement != null &&
e.getClassName().equals(topTraceElement.getClassName()) &&
e.getMethodName().equals(topTraceElement.getMethodName())){
lines.add(tab+"..."+(trace.length-i-1) + " more");
// depends on control dependency: [if], data = [none]
break;
}
}
//((update top element))
topTraceElement = trace.length > 0 ? trace[0] : null;
// depends on control dependency: [while], data = [none]
}
//(set content array)
content = new String[lines.size()];
// depends on control dependency: [if], data = [none]
content = lines.toArray(content);
// depends on control dependency: [if], data = [none]
} else if(record.content == null){
content = new String[]{"null"};
// depends on control dependency: [if], data = [none]
} else {
content = record.content.toString().split("\n"); //would be nice to get rid of this 'split()' call at some point
// depends on control dependency: [if], data = [none]
}
//--Handle Tracks
updateTracks(record.depth);
if(this.missingOpenBracket){
this.style(b, "{\n", trackColor, trackStyle);
// depends on control dependency: [if], data = [none]
this.missingOpenBracket = false;
// depends on control dependency: [if], data = [none]
}
//--Process Record
//(variables)
int cursorPos = 0;
int contentLinesPrinted = 0;
//(loop)
Color color = Color.NONE;
Style style = Style.NONE;
//(get channels)
ArrayList<Object> printableChannels = new ArrayList<Object>();
for(Object chan : record.channels()){
if(chan instanceof Color){ color = (Color) chan; }
// depends on control dependency: [if], data = [none]
else if(chan instanceof Style){ style = (Style) chan; }
// depends on control dependency: [if], data = [none]
else if(chan != Redwood.FORCE){ printableChannels.add(chan); }
// depends on control dependency: [if], data = [(chan]
}
//--Write Channels
if(leftMargin > 2) { //don't print if not enough space
//((print channels)
if(printableChannels.size() > 0){ b.append("["); cursorPos += 1; }
// depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
Object lastChan = null;
for(int i=0; i<printableChannels.size(); i++) {
Object chan = printableChannels.get(i);
if(chan.equals(lastChan)){ continue; } //skip duplicate channels
lastChan = chan;
// depends on control dependency: [for], data = [none]
//(get chan)
String chanToString = chan.toString();
String toPrint = chan.toString();
if(toPrint.length() > leftMargin-1){ toPrint = toPrint.substring(0,leftMargin-2); }
// depends on control dependency: [if], data = [none]
if(cursorPos+toPrint.length() >= leftMargin){
//(case: doesn't fit)
while(cursorPos < leftMargin){ b.append(" "); cursorPos += 1; }
// depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none]
if(contentLinesPrinted < content.length){
writeContent(record.depth, style(new StringBuilder(),content[contentLinesPrinted],color,style).toString(), b);
// depends on control dependency: [if], data = [none]
contentLinesPrinted += 1;
// depends on control dependency: [if], data = [none]
}
b.append("\n ");
// depends on control dependency: [if], data = [none]
cursorPos = 1;
// depends on control dependency: [if], data = [none]
}
//(print flag)
formatChannel(b, toPrint, chanToString);
// depends on control dependency: [for], data = [none]
if(i < printableChannels.size()-1){ b.append(channelSeparatorChar); cursorPos += 1; }
// depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
cursorPos += toPrint.length();
// depends on control dependency: [for], data = [none]
}
if(printableChannels.size() > 0){ b.append("]"); cursorPos += 1; }
// depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
//--Content
//(write content)
while(contentLinesPrinted < content.length) {
while(cursorPos < leftMargin){ b.append(" "); cursorPos += 1; }
// depends on control dependency: [while], data = [none] // depends on control dependency: [while], data = [none]
writeContent(record.depth, style(new StringBuilder(),content[contentLinesPrinted],color,style).toString(), b);
// depends on control dependency: [while], data = [none]
contentLinesPrinted += 1;
// depends on control dependency: [while], data = [none]
if(contentLinesPrinted < content.length){ b.append("\n"); cursorPos = 0; }
// depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
//(print)
if (b.length() == 0 || b.charAt(b.length() - 1) != '\n') {
b.append("\n");
// depends on control dependency: [if], data = [none]
}
print(b.toString());
//--Continue
if(info != null){
info.numElementsPrinted += 1;
// depends on control dependency: [if], data = [none]
}
ArrayList<Record> rtn = new ArrayList<Record>();
rtn.add(record);
return rtn;
} }
|
public class class_name {
private void closeStream(final Throwable throwable) {
if (stream != null) {
stream.onCompleted();
stream = null;
}
if (isActive.getAndSet(false)) {
userCallbackExecutor.execute(
new Runnable() {
@Override
public void run() {
listener.onEvent(
null,
throwable instanceof FirestoreException
? (FirestoreException) throwable
: FirestoreException.apiException(
new ApiException(
throwable,
GrpcStatusCode.of(getStatus(throwable).getCode()),
false)));
}
});
}
} }
|
public class class_name {
private void closeStream(final Throwable throwable) {
if (stream != null) {
stream.onCompleted(); // depends on control dependency: [if], data = [none]
stream = null; // depends on control dependency: [if], data = [none]
}
if (isActive.getAndSet(false)) {
userCallbackExecutor.execute(
new Runnable() {
@Override
public void run() {
listener.onEvent(
null,
throwable instanceof FirestoreException
? (FirestoreException) throwable
: FirestoreException.apiException(
new ApiException(
throwable,
GrpcStatusCode.of(getStatus(throwable).getCode()),
false)));
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static TraceEventBatch log(Category cat) {
final VoltTrace tracer = s_tracer;
if (tracer != null && tracer.isCategoryEnabled(cat)) {
final TraceEventBatch batch = new TraceEventBatch(cat);
tracer.queueEvent(batch);
return batch;
} else {
return null;
}
} }
|
public class class_name {
public static TraceEventBatch log(Category cat) {
final VoltTrace tracer = s_tracer;
if (tracer != null && tracer.isCategoryEnabled(cat)) {
final TraceEventBatch batch = new TraceEventBatch(cat);
tracer.queueEvent(batch); // depends on control dependency: [if], data = [none]
return batch; // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private int getErrorCode(Object error) {
if (error instanceof Number) {
return ((Number) error).intValue();
} else if (error instanceof YokeException) {
return ((YokeException) error).getErrorCode().intValue();
} else if (error instanceof JsonObject) {
return ((JsonObject) error).getInteger("errorCode", 500);
} else if (error instanceof Map) {
Integer tmp = (Integer) ((Map) error).get("errorCode");
return tmp != null ? tmp : 500;
} else {
return 500;
}
} }
|
public class class_name {
private int getErrorCode(Object error) {
if (error instanceof Number) {
return ((Number) error).intValue(); // depends on control dependency: [if], data = [none]
} else if (error instanceof YokeException) {
return ((YokeException) error).getErrorCode().intValue(); // depends on control dependency: [if], data = [none]
} else if (error instanceof JsonObject) {
return ((JsonObject) error).getInteger("errorCode", 500); // depends on control dependency: [if], data = [none]
} else if (error instanceof Map) {
Integer tmp = (Integer) ((Map) error).get("errorCode");
return tmp != null ? tmp : 500; // depends on control dependency: [if], data = [none]
} else {
return 500; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void start() {
boolean succeeded = true;
Iterator i = mappingFilesMap.keySet().iterator();
while (i.hasNext()) {
String mappingName = (String) i.next();
String fileName = mappingFilesMap.getProperty(mappingName);
System.out.println(new LogEntry("loading mapping '" + mappingName + "' from '" + fileName + '\''));
//TODO filename sometimes null
IndentedConfigReaderMapping mapping = new IndentedConfigReaderMapping(mappingName, fileName, assembly);
succeeded = succeeded && mapping.isLoaded();
if (!mapping.isLoaded()) {
System.out.println(new LogEntry("loading NOT succeeded", (Serializable) mapping.getLoadMessages()));
}
mappingMap.put(mappingName, mapping);
}
loadSucceeded = succeeded;
isStarted = true;
} }
|
public class class_name {
public void start() {
boolean succeeded = true;
Iterator i = mappingFilesMap.keySet().iterator();
while (i.hasNext()) {
String mappingName = (String) i.next();
String fileName = mappingFilesMap.getProperty(mappingName);
System.out.println(new LogEntry("loading mapping '" + mappingName + "' from '" + fileName + '\'')); // depends on control dependency: [while], data = [none]
//TODO filename sometimes null
IndentedConfigReaderMapping mapping = new IndentedConfigReaderMapping(mappingName, fileName, assembly);
succeeded = succeeded && mapping.isLoaded(); // depends on control dependency: [while], data = [none]
if (!mapping.isLoaded()) {
System.out.println(new LogEntry("loading NOT succeeded", (Serializable) mapping.getLoadMessages())); // depends on control dependency: [if], data = [none]
}
mappingMap.put(mappingName, mapping); // depends on control dependency: [while], data = [none]
}
loadSucceeded = succeeded;
isStarted = true;
} }
|
public class class_name {
public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex;
} else {
nextTableIndex = currentTable.length - 1;
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value));
counter++;
}
}
nextEntry = nextEntry.next;
}
}
return nextTableIndex;
} }
|
public class class_name {
public int fetchEntries(int tableIndex, int size, List<Map.Entry<K, V>> entries) {
final long now = Clock.currentTimeMillis();
final Segment<K, V> segment = segments[0];
final HashEntry<K, V>[] currentTable = segment.table;
int nextTableIndex;
if (tableIndex >= 0 && tableIndex < segment.table.length) {
nextTableIndex = tableIndex; // depends on control dependency: [if], data = [none]
} else {
nextTableIndex = currentTable.length - 1; // depends on control dependency: [if], data = [none]
}
int counter = 0;
while (nextTableIndex >= 0 && counter < size) {
HashEntry<K, V> nextEntry = currentTable[nextTableIndex--];
while (nextEntry != null) {
if (nextEntry.key() != null) {
final V value = nextEntry.value();
if (isValidForFetching(value, now)) {
K key = nextEntry.key();
entries.add(new AbstractMap.SimpleEntry<K, V>(key, value)); // depends on control dependency: [if], data = [none]
counter++; // depends on control dependency: [if], data = [none]
}
}
nextEntry = nextEntry.next; // depends on control dependency: [while], data = [none]
}
}
return nextTableIndex;
} }
|
public class class_name {
public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom) {
ICrystal crystal = chemModel.getCrystal();
if (crystal != null) {
if (crystal.contains(atom)) {
crystal.removeAtom(atom);
}
return;
}
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
MoleculeSetManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom);
}
IReactionSet reactionSet = chemModel.getReactionSet();
if (reactionSet != null) {
ReactionSetManipulator.removeAtomAndConnectedElectronContainers(reactionSet, atom);
}
} }
|
public class class_name {
public static void removeAtomAndConnectedElectronContainers(IChemModel chemModel, IAtom atom) {
ICrystal crystal = chemModel.getCrystal();
if (crystal != null) {
if (crystal.contains(atom)) {
crystal.removeAtom(atom); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
if (moleculeSet != null) {
MoleculeSetManipulator.removeAtomAndConnectedElectronContainers(moleculeSet, atom); // depends on control dependency: [if], data = [(moleculeSet]
}
IReactionSet reactionSet = chemModel.getReactionSet();
if (reactionSet != null) {
ReactionSetManipulator.removeAtomAndConnectedElectronContainers(reactionSet, atom); // depends on control dependency: [if], data = [(reactionSet]
}
} }
|
public class class_name {
public void marshall(DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (decisionTaskStartedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decisionTaskStartedEventAttributes.getIdentity(), IDENTITY_BINDING);
protocolMarshaller.marshall(decisionTaskStartedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DecisionTaskStartedEventAttributes decisionTaskStartedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (decisionTaskStartedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(decisionTaskStartedEventAttributes.getIdentity(), IDENTITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(decisionTaskStartedEventAttributes.getScheduledEventId(), SCHEDULEDEVENTID_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 _cleanChildren() {
//bStatsTreeNeedsUpdate = true;
if (children != null) {
Iterator values = children.values().iterator();
while (values.hasNext()) {
ModuleItem remMI = (ModuleItem) values.next();
remMI.getInstance().cleanup();
//_cleanMBean(remMI);
remMI._cleanChildren();
remMI = null;
}
children.clear();
}
} }
|
public class class_name {
private void _cleanChildren() {
//bStatsTreeNeedsUpdate = true;
if (children != null) {
Iterator values = children.values().iterator();
while (values.hasNext()) {
ModuleItem remMI = (ModuleItem) values.next();
remMI.getInstance().cleanup(); // depends on control dependency: [while], data = [none]
//_cleanMBean(remMI);
remMI._cleanChildren(); // depends on control dependency: [while], data = [none]
remMI = null; // depends on control dependency: [while], data = [none]
}
children.clear(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setRealHeight(int height) {
if (isJB()) {
this.realHeight = height;
} else {
ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
di -> di.logicalHeight = height);
}
} }
|
public class class_name {
public void setRealHeight(int height) {
if (isJB()) {
this.realHeight = height; // depends on control dependency: [if], data = [none]
} else {
ShadowDisplayManager.changeDisplay(realObject.getDisplayId(),
di -> di.logicalHeight = height); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private int getItemViewType(Class prototypeClass) {
int itemViewType = -1;
for (Renderer renderer : prototypes) {
if (renderer.getClass().equals(prototypeClass)) {
itemViewType = getPrototypeIndex(renderer);
break;
}
}
if (itemViewType == -1) {
throw new PrototypeNotFoundException(
"Review your RendererBuilder implementation, you are returning one"
+ " prototype class not found in prototypes collection");
}
return itemViewType;
} }
|
public class class_name {
private int getItemViewType(Class prototypeClass) {
int itemViewType = -1;
for (Renderer renderer : prototypes) {
if (renderer.getClass().equals(prototypeClass)) {
itemViewType = getPrototypeIndex(renderer); // depends on control dependency: [if], data = [none]
break;
}
}
if (itemViewType == -1) {
throw new PrototypeNotFoundException(
"Review your RendererBuilder implementation, you are returning one"
+ " prototype class not found in prototypes collection");
}
return itemViewType;
} }
|
public class class_name {
public static CliArguments parse(String[] args) {
CliArguments arguments = new CliArguments();
if (args != null) {
CmdLineParser parser = new CmdLineParser(arguments);
try {
parser.parseArgument(args);
} catch (CmdLineException e) {
// ignore
}
arguments.usageMode = false;
for (String arg : args) {
for (int i = 0; i < USAGE_TOKENS.length; i++) {
String usageToken = USAGE_TOKENS[i];
if (usageToken.equalsIgnoreCase(arg)) {
arguments.usageMode = true;
break;
}
}
}
}
return arguments;
} }
|
public class class_name {
public static CliArguments parse(String[] args) {
CliArguments arguments = new CliArguments();
if (args != null) {
CmdLineParser parser = new CmdLineParser(arguments);
try {
parser.parseArgument(args); // depends on control dependency: [try], data = [none]
} catch (CmdLineException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
arguments.usageMode = false; // depends on control dependency: [if], data = [none]
for (String arg : args) {
for (int i = 0; i < USAGE_TOKENS.length; i++) {
String usageToken = USAGE_TOKENS[i];
if (usageToken.equalsIgnoreCase(arg)) {
arguments.usageMode = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
}
return arguments;
} }
|
public class class_name {
public void setObjectIds(java.util.Collection<String> objectIds) {
if (objectIds == null) {
this.objectIds = null;
return;
}
this.objectIds = new com.amazonaws.internal.SdkInternalList<String>(objectIds);
} }
|
public class class_name {
public void setObjectIds(java.util.Collection<String> objectIds) {
if (objectIds == null) {
this.objectIds = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.objectIds = new com.amazonaws.internal.SdkInternalList<String>(objectIds);
} }
|
public class class_name {
private String parse(BufferedReader bufferedReader) {
String sectionKey = null;
List<String[]> section;
// Get an ordered list of key->value pairs in array-tuples
do {
section = this.readSection(bufferedReader);
sectionKey = section.get(0)[0];
if (sectionKey == null) {
//if we reach the end of the file, section contains empty strings
if(section.get(0)[1]==null || section.get(0)[1]=="" ||
section.get(0)[1].length()==0) {
throw new ParserException(Messages.ENDOFFILE);
}
throw new ParserException(Messages.SECTIONKEYNULL);
}
// process section-by-section
if (sectionKey.equals(LOCUS_TAG)) {
String loc = section.get(0)[1];
header = loc;
Matcher m = lp.matcher(loc);
if (m.matches()) {
headerParser.setName(m.group(1));
headerParser.setAccession(m.group(1)); // default if no accession found
String lengthUnits = m.group(2);
String type = m.group(5);
if (lengthUnits.equalsIgnoreCase("aa")) {
compoundType = AminoAcidCompoundSet.getAminoAcidCompoundSet();
} else if (lengthUnits.equalsIgnoreCase("bp")) {
if (type != null) {
if (type.contains("RNA")) {
compoundType = RNACompoundSet.getRNACompoundSet();
} else {
compoundType = DNACompoundSet.getDNACompoundSet();
}
} else {
compoundType = DNACompoundSet.getDNACompoundSet();
}
}
log.debug("compound type: {}", compoundType.getClass().getSimpleName());
} else {
throw new ParserException("Bad locus line");
}
} else if (sectionKey.equals(DEFINITION_TAG)) {
headerParser.setDescription(section.get(0)[1]);
} else if (sectionKey.equals(ACCESSION_TAG)) {
// if multiple accessions, store only first as accession,
// and store rest in annotation
String[] accs = section.get(0)[1].split("\\s+");
accession = accs[0].trim();
headerParser.setAccession(accession);
} else if (sectionKey.equals(VERSION_TAG)) {
String ver = section.get(0)[1];
Matcher m = vp.matcher(ver);
if (m.matches()) {
String verAcc = m.group(1);
if (!accession.equals(verAcc)) {
// the version refers to a different accession!
// believe the version line, and store the original
// accession away in the additional accession set
accession = verAcc;
}
if (m.group(3) != null) {
headerParser.setVersion(Integer.parseInt(m.group(3)));
}
if (m.group(5) != null) {
headerParser.setIdentifier(m.group(5));
}
} else {
throw new ParserException("Bad version line");
}
} else if (sectionKey.equals(KEYWORDS_TAG)) {
} else if (sectionKey.equals(SOURCE_TAG)) {
// ignore - can get all this from the first feature
} else if (sectionKey.equals(REFERENCE_TAG)) {
if (!section.isEmpty()) {
GenbankReference genbankReference = new GenbankReference();
for (String[] ref : section) {
if (ref[0].equals(AUTHORS_TAG)) {
genbankReference.setAuthors(ref[1]);
} else if (ref[0].equals(TITLE_TAG)) {
genbankReference.setTitle(ref[1]);
} else if (ref[0].equals(JOURNAL_TAG)) {
genbankReference.setJournal(ref[1]);
}
}
headerParser.addReference(genbankReference);
}
} else if (sectionKey.equals(COMMENT_TAG)) {
// Set up some comments
headerParser.setComment(section.get(0)[1]);
} else if (sectionKey.equals(FEATURE_TAG)) {
// starting from second line of input, start a new feature whenever we come across
// a key that does not start with /
AbstractFeature gbFeature = null;
for (int i = 1; i < section.size(); i++) {
String key = section.get(i)[0];
String val = section.get(i)[1];
if (key.startsWith("/")) {
if (gbFeature == null) {
throw new ParserException("Malformed GenBank file: found a qualifier without feature.");
}
key = key.substring(1); // strip leading slash
val = val.replaceAll("\\s*[\\n\\r]+\\s*", " ").trim();
if (val.endsWith("\"")) {
val = val.substring(1, val.length() - 1); // strip quotes
}
// parameter on old feature
if (key.equals("db_xref")) {
Matcher m = dbxp.matcher(val);
if (m.matches()) {
String dbname = m.group(1);
String raccession = m.group(2);
Qualifier xref = new DBReferenceInfo(dbname, raccession);
gbFeature.addQualifier(key, xref);
ArrayList<DBReferenceInfo> listDBEntry = new ArrayList<DBReferenceInfo>();
listDBEntry.add((DBReferenceInfo) xref);
mapDB.put(key, listDBEntry);
} else {
throw new ParserException("Bad dbxref");
}
} else if (key.equalsIgnoreCase("organism")) {
Qualifier q = new Qualifier(key, val.replace('\n', ' '));
gbFeature.addQualifier(key, q);
} else {
if (key.equalsIgnoreCase("translation")) {
// strip spaces from sequence
val = val.replaceAll("\\s+", "");
Qualifier q = new Qualifier(key, val);
gbFeature.addQualifier(key, q);
} else {
Qualifier q = new Qualifier(key, val);
gbFeature.addQualifier(key, q);
}
}
} else {
// new feature!
gbFeature = new TextFeature(key, val, key, key);
Location l =
locationParser.parse(val);
gbFeature.setLocation((AbstractLocation)l);
if (!featureCollection.containsKey(key)) {
featureCollection.put(key, new ArrayList());
}
featureCollection.get(key).add(gbFeature);
}
}
} else if (sectionKey.equals(BASE_COUNT_TAG)) {
// ignore - can calculate from sequence content later if needed
} else if (sectionKey.equals(START_SEQUENCE_TAG)) {
// our first line is ignorable as it is the ORIGIN tag
// the second line onwards conveniently have the number as
// the [0] tuple, and sequence string as [1] so all we have
// to do is concat the [1] parts and then strip out spaces,
// and replace '.' and '~' with '-' for our parser.
StringBuffer seq = new StringBuffer();
for (int i = 1; i < section.size(); i++) {
seq.append(section.get(i)[1]);
}
seqData = seq.toString().replaceAll("\\s+", "").replaceAll("[\\.|~]", "-").toUpperCase();
} else if(sectionKey.equals(DBSOURCE)) {
//TODO
} else if(sectionKey.equals(PRIMARY)) {
//TODO
} else if(sectionKey.equals(DBLINK)) {
//TODO
} else {
if(!sectionKey.equals(END_SEQUENCE_TAG)) {
log.info("found unknown section key: "+sectionKey);
}
}
} while (!sectionKey.equals(END_SEQUENCE_TAG));
return seqData;
} }
|
public class class_name {
private String parse(BufferedReader bufferedReader) {
String sectionKey = null;
List<String[]> section;
// Get an ordered list of key->value pairs in array-tuples
do {
section = this.readSection(bufferedReader);
sectionKey = section.get(0)[0];
if (sectionKey == null) {
//if we reach the end of the file, section contains empty strings
if(section.get(0)[1]==null || section.get(0)[1]=="" ||
section.get(0)[1].length()==0) {
throw new ParserException(Messages.ENDOFFILE);
}
throw new ParserException(Messages.SECTIONKEYNULL);
}
// process section-by-section
if (sectionKey.equals(LOCUS_TAG)) {
String loc = section.get(0)[1];
header = loc; // depends on control dependency: [if], data = [none]
Matcher m = lp.matcher(loc);
if (m.matches()) {
headerParser.setName(m.group(1)); // depends on control dependency: [if], data = [none]
headerParser.setAccession(m.group(1)); // default if no accession found // depends on control dependency: [if], data = [none]
String lengthUnits = m.group(2);
String type = m.group(5);
if (lengthUnits.equalsIgnoreCase("aa")) {
compoundType = AminoAcidCompoundSet.getAminoAcidCompoundSet(); // depends on control dependency: [if], data = [none]
} else if (lengthUnits.equalsIgnoreCase("bp")) {
if (type != null) {
if (type.contains("RNA")) {
compoundType = RNACompoundSet.getRNACompoundSet(); // depends on control dependency: [if], data = [none]
} else {
compoundType = DNACompoundSet.getDNACompoundSet(); // depends on control dependency: [if], data = [none]
}
} else {
compoundType = DNACompoundSet.getDNACompoundSet(); // depends on control dependency: [if], data = [none]
}
}
log.debug("compound type: {}", compoundType.getClass().getSimpleName()); // depends on control dependency: [if], data = [none]
} else {
throw new ParserException("Bad locus line");
}
} else if (sectionKey.equals(DEFINITION_TAG)) {
headerParser.setDescription(section.get(0)[1]); // depends on control dependency: [if], data = [none]
} else if (sectionKey.equals(ACCESSION_TAG)) {
// if multiple accessions, store only first as accession,
// and store rest in annotation
String[] accs = section.get(0)[1].split("\\s+");
accession = accs[0].trim(); // depends on control dependency: [if], data = [none]
headerParser.setAccession(accession); // depends on control dependency: [if], data = [none]
} else if (sectionKey.equals(VERSION_TAG)) {
String ver = section.get(0)[1];
Matcher m = vp.matcher(ver);
if (m.matches()) {
String verAcc = m.group(1);
if (!accession.equals(verAcc)) {
// the version refers to a different accession!
// believe the version line, and store the original
// accession away in the additional accession set
accession = verAcc; // depends on control dependency: [if], data = [none]
}
if (m.group(3) != null) {
headerParser.setVersion(Integer.parseInt(m.group(3))); // depends on control dependency: [if], data = [(m.group(3)]
}
if (m.group(5) != null) {
headerParser.setIdentifier(m.group(5)); // depends on control dependency: [if], data = [(m.group(5)]
}
} else {
throw new ParserException("Bad version line");
}
} else if (sectionKey.equals(KEYWORDS_TAG)) {
} else if (sectionKey.equals(SOURCE_TAG)) {
// ignore - can get all this from the first feature
} else if (sectionKey.equals(REFERENCE_TAG)) {
if (!section.isEmpty()) {
GenbankReference genbankReference = new GenbankReference();
for (String[] ref : section) {
if (ref[0].equals(AUTHORS_TAG)) {
genbankReference.setAuthors(ref[1]); // depends on control dependency: [if], data = [none]
} else if (ref[0].equals(TITLE_TAG)) {
genbankReference.setTitle(ref[1]); // depends on control dependency: [if], data = [none]
} else if (ref[0].equals(JOURNAL_TAG)) {
genbankReference.setJournal(ref[1]); // depends on control dependency: [if], data = [none]
}
}
headerParser.addReference(genbankReference); // depends on control dependency: [if], data = [none]
}
} else if (sectionKey.equals(COMMENT_TAG)) {
// Set up some comments
headerParser.setComment(section.get(0)[1]); // depends on control dependency: [if], data = [none]
} else if (sectionKey.equals(FEATURE_TAG)) {
// starting from second line of input, start a new feature whenever we come across
// a key that does not start with /
AbstractFeature gbFeature = null;
for (int i = 1; i < section.size(); i++) {
String key = section.get(i)[0];
String val = section.get(i)[1];
if (key.startsWith("/")) {
if (gbFeature == null) {
throw new ParserException("Malformed GenBank file: found a qualifier without feature.");
}
key = key.substring(1); // strip leading slash // depends on control dependency: [if], data = [none]
val = val.replaceAll("\\s*[\\n\\r]+\\s*", " ").trim(); // depends on control dependency: [if], data = [none]
if (val.endsWith("\"")) {
val = val.substring(1, val.length() - 1); // strip quotes // depends on control dependency: [if], data = [none]
}
// parameter on old feature
if (key.equals("db_xref")) {
Matcher m = dbxp.matcher(val);
if (m.matches()) {
String dbname = m.group(1);
String raccession = m.group(2);
Qualifier xref = new DBReferenceInfo(dbname, raccession);
gbFeature.addQualifier(key, xref); // depends on control dependency: [if], data = [none]
ArrayList<DBReferenceInfo> listDBEntry = new ArrayList<DBReferenceInfo>();
listDBEntry.add((DBReferenceInfo) xref); // depends on control dependency: [if], data = [none]
mapDB.put(key, listDBEntry); // depends on control dependency: [if], data = [none]
} else {
throw new ParserException("Bad dbxref");
}
} else if (key.equalsIgnoreCase("organism")) {
Qualifier q = new Qualifier(key, val.replace('\n', ' '));
gbFeature.addQualifier(key, q); // depends on control dependency: [if], data = [none]
} else {
if (key.equalsIgnoreCase("translation")) {
// strip spaces from sequence
val = val.replaceAll("\\s+", ""); // depends on control dependency: [if], data = [none]
Qualifier q = new Qualifier(key, val);
gbFeature.addQualifier(key, q); // depends on control dependency: [if], data = [none]
} else {
Qualifier q = new Qualifier(key, val);
gbFeature.addQualifier(key, q); // depends on control dependency: [if], data = [none]
}
}
} else {
// new feature!
gbFeature = new TextFeature(key, val, key, key); // depends on control dependency: [if], data = [none]
Location l =
locationParser.parse(val);
gbFeature.setLocation((AbstractLocation)l); // depends on control dependency: [if], data = [none]
if (!featureCollection.containsKey(key)) {
featureCollection.put(key, new ArrayList()); // depends on control dependency: [if], data = [none]
}
featureCollection.get(key).add(gbFeature); // depends on control dependency: [if], data = [none]
}
}
} else if (sectionKey.equals(BASE_COUNT_TAG)) {
// ignore - can calculate from sequence content later if needed
} else if (sectionKey.equals(START_SEQUENCE_TAG)) {
// our first line is ignorable as it is the ORIGIN tag
// the second line onwards conveniently have the number as
// the [0] tuple, and sequence string as [1] so all we have
// to do is concat the [1] parts and then strip out spaces,
// and replace '.' and '~' with '-' for our parser.
StringBuffer seq = new StringBuffer();
for (int i = 1; i < section.size(); i++) {
seq.append(section.get(i)[1]); // depends on control dependency: [for], data = [i]
}
seqData = seq.toString().replaceAll("\\s+", "").replaceAll("[\\.|~]", "-").toUpperCase(); // depends on control dependency: [if], data = [none]
} else if(sectionKey.equals(DBSOURCE)) {
//TODO
} else if(sectionKey.equals(PRIMARY)) {
//TODO
} else if(sectionKey.equals(DBLINK)) {
//TODO
} else {
if(!sectionKey.equals(END_SEQUENCE_TAG)) {
log.info("found unknown section key: "+sectionKey); // depends on control dependency: [if], data = [none]
}
}
} while (!sectionKey.equals(END_SEQUENCE_TAG));
return seqData;
} }
|
public class class_name {
private void readSourceDeclaration(LineNumberReader reader) throws IOException {
String line;
dataSourceProperties = new Properties();
while (!(line = reader.readLine()).isEmpty()) {
int lineNumber = reader.getLineNumber();
String[] tokens = line.split("[\t| ]+", 2);
final String parameter = tokens[0].trim();
final String inputParameter = tokens[1].trim();
if (parameter.equals(Label.sourceUri.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_NAME, inputParameter);
} else if (parameter.equals(Label.connectionUrl.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_URL, inputParameter);
} else if (parameter.equals(Label.username.name())) {
dataSourceProperties.put(OntopSQLCredentialSettings.JDBC_USER, inputParameter);
} else if (parameter.equals(Label.password.name())) {
dataSourceProperties.put(OntopSQLCredentialSettings.JDBC_PASSWORD, inputParameter);
} else if (parameter.equals(Label.driverClass.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_DRIVER, inputParameter);
} else {
String msg = String.format("Unknown parameter name \"%s\" at line: %d.", parameter, lineNumber);
throw new IOException(msg);
}
}
} }
|
public class class_name {
private void readSourceDeclaration(LineNumberReader reader) throws IOException {
String line;
dataSourceProperties = new Properties();
while (!(line = reader.readLine()).isEmpty()) {
int lineNumber = reader.getLineNumber();
String[] tokens = line.split("[\t| ]+", 2);
final String parameter = tokens[0].trim();
final String inputParameter = tokens[1].trim();
if (parameter.equals(Label.sourceUri.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_NAME, inputParameter); // depends on control dependency: [if], data = [none]
} else if (parameter.equals(Label.connectionUrl.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_URL, inputParameter); // depends on control dependency: [if], data = [none]
} else if (parameter.equals(Label.username.name())) {
dataSourceProperties.put(OntopSQLCredentialSettings.JDBC_USER, inputParameter); // depends on control dependency: [if], data = [none]
} else if (parameter.equals(Label.password.name())) {
dataSourceProperties.put(OntopSQLCredentialSettings.JDBC_PASSWORD, inputParameter); // depends on control dependency: [if], data = [none]
} else if (parameter.equals(Label.driverClass.name())) {
dataSourceProperties.put(OntopSQLCoreSettings.JDBC_DRIVER, inputParameter); // depends on control dependency: [if], data = [none]
} else {
String msg = String.format("Unknown parameter name \"%s\" at line: %d.", parameter, lineNumber);
throw new IOException(msg);
}
}
} }
|
public class class_name {
public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Object fieldValue = getValue(bean, property);
if (fieldValue instanceof List)
{
List list = (List) fieldValue;
Class[] pt = getParameterTypes(bean, property);
T value = (T)factory.apply(pt[0], hint);
if (value != null && !pt[0].isAssignableFrom(value.getClass()))
{
throw new IllegalArgumentException(pt[0]+" not assignable from "+value);
}
list.add(value);
return value;
}
else
{
throw new IllegalArgumentException(fieldValue+" not List");
}
} }
|
public class class_name {
public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory)
{
Object fieldValue = getValue(bean, property);
if (fieldValue instanceof List)
{
List list = (List) fieldValue;
Class[] pt = getParameterTypes(bean, property);
T value = (T)factory.apply(pt[0], hint);
if (value != null && !pt[0].isAssignableFrom(value.getClass()))
{
throw new IllegalArgumentException(pt[0]+" not assignable from "+value);
}
list.add(value);
// depends on control dependency: [if], data = [none]
return value;
// depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalArgumentException(fieldValue+" not List");
}
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the MediaService.
MediaServiceInterface mediaService =
adWordsServices.get(session, MediaServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(MediaField.MediaId, MediaField.Width, MediaField.Height, MediaField.MimeType)
.orderAscBy(MediaField.MediaId)
.offset(offset)
.limit(PAGE_SIZE)
.in(MediaField.Type, "IMAGE", "VIDEO")
.build();
MediaPage page = null;
do {
// Get all images.
page = mediaService.get(selector);
// Display images.
if (page != null && page.getEntries() != null) {
for (Media media : page.getEntries()) {
Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
System.out.printf("Media with ID %d, dimensions %s, and MIME type '%s' was found.%n",
media.getMediaId(), toString(dimensions.get(MediaSize.FULL)), media.getMediaType());
}
} else {
System.out.println("No images/videos were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
} }
|
public class class_name {
public static void runExample(
AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the MediaService.
MediaServiceInterface mediaService =
adWordsServices.get(session, MediaServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(MediaField.MediaId, MediaField.Width, MediaField.Height, MediaField.MimeType)
.orderAscBy(MediaField.MediaId)
.offset(offset)
.limit(PAGE_SIZE)
.in(MediaField.Type, "IMAGE", "VIDEO")
.build();
MediaPage page = null;
do {
// Get all images.
page = mediaService.get(selector);
// Display images.
if (page != null && page.getEntries() != null) {
for (Media media : page.getEntries()) {
Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
System.out.printf("Media with ID %d, dimensions %s, and MIME type '%s' was found.%n",
media.getMediaId(), toString(dimensions.get(MediaSize.FULL)), media.getMediaType()); // depends on control dependency: [for], data = [none]
}
} else {
System.out.println("No images/videos were found."); // depends on control dependency: [if], data = [none]
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
} }
|
public class class_name {
@Override
public void start(String[] arguments) {
boolean notStarted = !started.getAndSet(true);
if (notStarted) {
start(new SingleInstanceWorkloadStrategy(job, name, arguments, endpointRegistry, execService));
}
} }
|
public class class_name {
@Override
public void start(String[] arguments) {
boolean notStarted = !started.getAndSet(true);
if (notStarted) {
start(new SingleInstanceWorkloadStrategy(job, name, arguments, endpointRegistry, execService)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(PutRecordRequest putRecordRequest, ProtocolMarshaller protocolMarshaller) {
if (putRecordRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putRecordRequest.getStreamName(), STREAMNAME_BINDING);
protocolMarshaller.marshall(putRecordRequest.getData(), DATA_BINDING);
protocolMarshaller.marshall(putRecordRequest.getPartitionKey(), PARTITIONKEY_BINDING);
protocolMarshaller.marshall(putRecordRequest.getExplicitHashKey(), EXPLICITHASHKEY_BINDING);
protocolMarshaller.marshall(putRecordRequest.getSequenceNumberForOrdering(), SEQUENCENUMBERFORORDERING_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutRecordRequest putRecordRequest, ProtocolMarshaller protocolMarshaller) {
if (putRecordRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putRecordRequest.getStreamName(), STREAMNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putRecordRequest.getData(), DATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putRecordRequest.getPartitionKey(), PARTITIONKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putRecordRequest.getExplicitHashKey(), EXPLICITHASHKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putRecordRequest.getSequenceNumberForOrdering(), SEQUENCENUMBERFORORDERING_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setArrayType(JvmArrayType newArrayType)
{
if (newArrayType != arrayType)
{
NotificationChain msgs = null;
if (arrayType != null)
msgs = ((InternalEObject)arrayType).eInverseRemove(this, TypesPackage.JVM_ARRAY_TYPE__COMPONENT_TYPE, JvmArrayType.class, msgs);
if (newArrayType != null)
msgs = ((InternalEObject)newArrayType).eInverseAdd(this, TypesPackage.JVM_ARRAY_TYPE__COMPONENT_TYPE, JvmArrayType.class, msgs);
msgs = basicSetArrayType(newArrayType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE, newArrayType, newArrayType));
} }
|
public class class_name {
public void setArrayType(JvmArrayType newArrayType)
{
if (newArrayType != arrayType)
{
NotificationChain msgs = null;
if (arrayType != null)
msgs = ((InternalEObject)arrayType).eInverseRemove(this, TypesPackage.JVM_ARRAY_TYPE__COMPONENT_TYPE, JvmArrayType.class, msgs);
if (newArrayType != null)
msgs = ((InternalEObject)newArrayType).eInverseAdd(this, TypesPackage.JVM_ARRAY_TYPE__COMPONENT_TYPE, JvmArrayType.class, msgs);
msgs = basicSetArrayType(newArrayType, msgs); // depends on control dependency: [if], data = [(newArrayType]
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.JVM_COMPONENT_TYPE__ARRAY_TYPE, newArrayType, newArrayType));
} }
|
public class class_name {
public static Method getImplementingMethod(Class clazz, Method intfMethod) {
Class<?> declaringClass = intfMethod.getDeclaringClass();
if (declaringClass.equals(clazz))
return intfMethod;
Class[] paramTypes = intfMethod.getParameterTypes();
if (declaringClass.getTypeParameters().length > 0 && paramTypes.length > 0) {
Type[] intfTypes = findParameterizedTypes(clazz, declaringClass);
Map<String, Type> typeVarMap = new HashMap<String, Type>();
TypeVariable<? extends Class<?>>[] vars = declaringClass.getTypeParameters();
for (int i = 0; i < vars.length; i++) {
if (intfTypes != null && i < intfTypes.length) {
typeVarMap.put(vars[i].getName(), intfTypes[i]);
} else {
// Interface type parameters may not have been filled out
typeVarMap.put(vars[i].getName(), vars[i].getGenericDeclaration());
}
}
Type[] paramGenericTypes = intfMethod.getGenericParameterTypes();
paramTypes = new Class[paramTypes.length];
for (int i = 0; i < paramTypes.length; i++) {
if (paramGenericTypes[i] instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) paramGenericTypes[i];
Type t = typeVarMap.get(tv.getName());
if (t == null) {
throw new RuntimeException("Unable to resolve type variable");
}
paramTypes[i] = getRawType(t);
} else {
paramTypes[i] = getRawType(paramGenericTypes[i]);
}
}
}
try {
return clazz.getMethod(intfMethod.getName(), paramTypes);
} catch (NoSuchMethodException e) {
}
try {
Method tmp = clazz.getMethod(intfMethod.getName(), intfMethod.getParameterTypes());
return tmp;
} catch (NoSuchMethodException e) {
}
return intfMethod;
} }
|
public class class_name {
public static Method getImplementingMethod(Class clazz, Method intfMethod) {
Class<?> declaringClass = intfMethod.getDeclaringClass();
if (declaringClass.equals(clazz))
return intfMethod;
Class[] paramTypes = intfMethod.getParameterTypes();
if (declaringClass.getTypeParameters().length > 0 && paramTypes.length > 0) {
Type[] intfTypes = findParameterizedTypes(clazz, declaringClass);
Map<String, Type> typeVarMap = new HashMap<String, Type>();
TypeVariable<? extends Class<?>>[] vars = declaringClass.getTypeParameters();
// depends on control dependency: [if], data = [none]
for (int i = 0; i < vars.length; i++) {
if (intfTypes != null && i < intfTypes.length) {
typeVarMap.put(vars[i].getName(), intfTypes[i]);
// depends on control dependency: [if], data = [none]
} else {
// Interface type parameters may not have been filled out
typeVarMap.put(vars[i].getName(), vars[i].getGenericDeclaration());
// depends on control dependency: [if], data = [none]
}
}
Type[] paramGenericTypes = intfMethod.getGenericParameterTypes();
paramTypes = new Class[paramTypes.length];
// depends on control dependency: [if], data = [none]
for (int i = 0; i < paramTypes.length; i++) {
if (paramGenericTypes[i] instanceof TypeVariable) {
TypeVariable tv = (TypeVariable) paramGenericTypes[i];
Type t = typeVarMap.get(tv.getName());
if (t == null) {
throw new RuntimeException("Unable to resolve type variable");
}
paramTypes[i] = getRawType(t);
// depends on control dependency: [if], data = [none]
} else {
paramTypes[i] = getRawType(paramGenericTypes[i]);
// depends on control dependency: [if], data = [none]
}
}
}
try {
return clazz.getMethod(intfMethod.getName(), paramTypes);
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
}
// depends on control dependency: [catch], data = [none]
try {
Method tmp = clazz.getMethod(intfMethod.getName(), intfMethod.getParameterTypes());
return tmp;
// depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
}
// depends on control dependency: [catch], data = [none]
return intfMethod;
} }
|
public class class_name {
public void remove( int first , int last ) {
if( last < first )
throw new IllegalArgumentException("first <= last");
if( last >= size )
throw new IllegalArgumentException("last must be less than the max size");
int delta = last-first+1;
for( int i = last+1; i < size; i++ ) {
data[i-delta] = data[i];
}
size -= delta;
} }
|
public class class_name {
public void remove( int first , int last ) {
if( last < first )
throw new IllegalArgumentException("first <= last");
if( last >= size )
throw new IllegalArgumentException("last must be less than the max size");
int delta = last-first+1;
for( int i = last+1; i < size; i++ ) {
data[i-delta] = data[i]; // depends on control dependency: [for], data = [i]
}
size -= delta;
} }
|
public class class_name {
private JSONArray readArray() throws JSONException {
JSONArray result = new JSONArray();
/* to cover input that ends with ",]". */
boolean hasTrailingSeparator = false;
while (true) {
switch (nextCleanInternal()) {
case -1:
throw syntaxError("Unterminated array");
case ']':
if (hasTrailingSeparator) {
result.put(null);
}
return result;
case ',':
case ';':
/* A separator without a value first means "null". */
result.put(null);
hasTrailingSeparator = true;
continue;
default:
this.pos--;
}
result.put(nextValue());
switch (nextCleanInternal()) {
case ']':
return result;
case ',':
case ';':
hasTrailingSeparator = true;
continue;
default:
throw syntaxError("Unterminated array");
}
}
} }
|
public class class_name {
private JSONArray readArray() throws JSONException {
JSONArray result = new JSONArray();
/* to cover input that ends with ",]". */
boolean hasTrailingSeparator = false;
while (true) {
switch (nextCleanInternal()) {
case -1:
throw syntaxError("Unterminated array");
case ']':
if (hasTrailingSeparator) {
result.put(null); // depends on control dependency: [if], data = [none]
}
return result;
case ',':
case ';':
/* A separator without a value first means "null". */
result.put(null);
hasTrailingSeparator = true;
continue;
default:
this.pos--;
}
result.put(nextValue());
switch (nextCleanInternal()) {
case ']':
return result;
case ',':
case ';':
hasTrailingSeparator = true;
continue;
default:
throw syntaxError("Unterminated array");
}
}
} }
|
public class class_name {
public static Double toDouble(Object value) {
if (value == null) {
return null;
} else if (value instanceof Double) {
return (Double) value;
} else if (value instanceof Number) {
return ((Number) value).doubleValue();
} else {
try {
return Double.valueOf(value.toString().trim());
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Double", e);
}
}
} }
|
public class class_name {
public static Double toDouble(Object value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (value instanceof Double) {
return (Double) value; // depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
return ((Number) value).doubleValue(); // depends on control dependency: [if], data = [none]
} else {
try {
return Double.valueOf(value.toString().trim()); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new ConversionException("failed to convert: '" + value + "' to Double", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public StoredCredential setRefreshToken(String refreshToken) {
lock.lock();
try {
this.refreshToken = refreshToken;
} finally {
lock.unlock();
}
return this;
} }
|
public class class_name {
public StoredCredential setRefreshToken(String refreshToken) {
lock.lock();
try {
this.refreshToken = refreshToken; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
return this;
} }
|
public class class_name {
@Override
public R scan(DocTree tree, P p) {
if (tree == null)
return null;
DocTreePath prev = path;
path = new DocTreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
} }
|
public class class_name {
@Override
public R scan(DocTree tree, P p) {
if (tree == null)
return null;
DocTreePath prev = path;
path = new DocTreePath(path, tree);
try {
return tree.accept(this, p); // depends on control dependency: [try], data = [none]
} finally {
path = prev;
}
} }
|
public class class_name {
public static <T extends ImageGray<T>>T average( ImageMultiBand input , T output ) {
if( input instanceof Planar ) {
return (T)average((Planar)input,output);
} else if( input instanceof ImageInterleaved ) {
return (T)average((ImageInterleaved)input,output);
} else {
throw new RuntimeException("Unknown multiband image");
}
} }
|
public class class_name {
public static <T extends ImageGray<T>>T average( ImageMultiBand input , T output ) {
if( input instanceof Planar ) {
return (T)average((Planar)input,output); // depends on control dependency: [if], data = [none]
} else if( input instanceof ImageInterleaved ) {
return (T)average((ImageInterleaved)input,output); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Unknown multiband image");
}
} }
|
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void execute(FunctionContext functionContext)
{
Cache cache = CacheFactory.getAnyInstance();
try
{
//Function must be executed on REgion
if(!(functionContext instanceof RegionFunctionContext))
{
throw new FunctionException("Execute on a region");
}
Object args = functionContext.getArguments();
if (args == null)
throw new FunctionException("arguments is required");
TextPageCriteria criteria = null;
if(args instanceof PdxInstance)
{
PdxInstance pdxInstance = (PdxInstance)args;
try
{
criteria = (TextPageCriteria)(pdxInstance.getObject());
}
catch (PdxSerializationException e)
{
throw new FunctionException(e.getMessage()+" JSON:"+JSONFormatter.toJSON(pdxInstance));
}
}
else
{
criteria = (TextPageCriteria)args;
}
Region<String, Collection<Object>> pagingRegion = cache.getRegion(criteria.getPageRegionName());
Region<?,?> region = cache.getRegion(criteria.getRegionName());
GeodePagination pagination = new GeodePagination();
TextPolicySearchStrategy geodeSearch = new TextPolicySearchStrategy(cache);
//Collection<String> keys = (Collection<String>)checkCachedKeysByCriteria(criteria,searchRequest,pagination,pagingRegion);
geodeSearch.saveSearchResultsWithPageKeys(criteria, criteria.getQuery(),null, (Region<String,Collection<Object>>)pagingRegion);
//build results
Collection<Object> collection = pagination.readResultsByPageValues(criteria.getId(),criteria.getSortField(),
criteria.isSortDescending(),
criteria.getBeginIndex(),
(Region<Object,Object>)region, (Region)pagingRegion);
if(collection == null)
{
functionContext.getResultSender().lastResult(null);
return;
}
PagingCollection<Object> pageCollection = new PagingCollection<Object>(collection, criteria);
functionContext.getResultSender().lastResult(pageCollection);
}
catch (RuntimeException e)
{
Logger logger = LogManager.getLogger(LuceneSearchFunction.class);
logger.error(Debugger.stackTrace(e));
throw e;
}
} }
|
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public void execute(FunctionContext functionContext)
{
Cache cache = CacheFactory.getAnyInstance();
try
{
//Function must be executed on REgion
if(!(functionContext instanceof RegionFunctionContext))
{
throw new FunctionException("Execute on a region");
}
Object args = functionContext.getArguments();
if (args == null)
throw new FunctionException("arguments is required");
TextPageCriteria criteria = null;
if(args instanceof PdxInstance)
{
PdxInstance pdxInstance = (PdxInstance)args;
try
{
criteria = (TextPageCriteria)(pdxInstance.getObject()); // depends on control dependency: [try], data = [none]
}
catch (PdxSerializationException e)
{
throw new FunctionException(e.getMessage()+" JSON:"+JSONFormatter.toJSON(pdxInstance));
} // depends on control dependency: [catch], data = [none]
}
else
{
criteria = (TextPageCriteria)args; // depends on control dependency: [if], data = [none]
}
Region<String, Collection<Object>> pagingRegion = cache.getRegion(criteria.getPageRegionName());
Region<?,?> region = cache.getRegion(criteria.getRegionName());
GeodePagination pagination = new GeodePagination();
TextPolicySearchStrategy geodeSearch = new TextPolicySearchStrategy(cache);
//Collection<String> keys = (Collection<String>)checkCachedKeysByCriteria(criteria,searchRequest,pagination,pagingRegion);
geodeSearch.saveSearchResultsWithPageKeys(criteria, criteria.getQuery(),null, (Region<String,Collection<Object>>)pagingRegion); // depends on control dependency: [try], data = [none]
//build results
Collection<Object> collection = pagination.readResultsByPageValues(criteria.getId(),criteria.getSortField(),
criteria.isSortDescending(),
criteria.getBeginIndex(),
(Region<Object,Object>)region, (Region)pagingRegion);
if(collection == null)
{
functionContext.getResultSender().lastResult(null); // depends on control dependency: [if], data = [null)]
return; // depends on control dependency: [if], data = [none]
}
PagingCollection<Object> pageCollection = new PagingCollection<Object>(collection, criteria);
functionContext.getResultSender().lastResult(pageCollection); // depends on control dependency: [try], data = [none]
}
catch (RuntimeException e)
{
Logger logger = LogManager.getLogger(LuceneSearchFunction.class);
logger.error(Debugger.stackTrace(e));
throw e;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public List<CmsDialogElement> computeElements() {
if (m_elementList == null) {
m_elementList = computeElements(getCms(), getParamTempfile(), getElementLocale());
}
return m_elementList;
} }
|
public class class_name {
public List<CmsDialogElement> computeElements() {
if (m_elementList == null) {
m_elementList = computeElements(getCms(), getParamTempfile(), getElementLocale()); // depends on control dependency: [if], data = [none]
}
return m_elementList;
} }
|
public class class_name {
@Override
String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
if (op == OperationType.DELETE_CODE){
String fieldPath = columnsToField.get(columnName);
if (fieldPath == null){
LOG.error("Column name {} is not defined in column-filed mapping", columnName);
return null;
}
return fieldPath.replace("/Data", "/OldData");
}
// For insert and update, ok to use the field name set by column-field mapping
return columnsToField.get(columnName);
} }
|
public class class_name {
@Override
String getFieldPath(String columnName, Map<String, String> columnsToField, int op) {
if (op == OperationType.DELETE_CODE){
String fieldPath = columnsToField.get(columnName);
if (fieldPath == null){
LOG.error("Column name {} is not defined in column-filed mapping", columnName); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return fieldPath.replace("/Data", "/OldData"); // depends on control dependency: [if], data = [none]
}
// For insert and update, ok to use the field name set by column-field mapping
return columnsToField.get(columnName);
} }
|
public class class_name {
private void informStatusCodeListener(@Nullable Response response) {
if (response == null) {
return;
}
ScheduledActions<CreateEvents> actions = onStatusCodeActions.get(response.getStatus());
if (actions != null) {
postHelper.executeCommonActions(actions, sessionChecker.isSameSession());
}
} }
|
public class class_name {
private void informStatusCodeListener(@Nullable Response response) {
if (response == null) {
return; // depends on control dependency: [if], data = [none]
}
ScheduledActions<CreateEvents> actions = onStatusCodeActions.get(response.getStatus());
if (actions != null) {
postHelper.executeCommonActions(actions, sessionChecker.isSameSession()); // depends on control dependency: [if], data = [(actions]
}
} }
|
public class class_name {
public RandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, RandomVariableInterface valueIfTriggerNegative) {
// Set time of this random variable to maximum of time with respect to which measurability is known.
double newTime = Math.max(time, trigger.getFiltrationTime());
newTime = Math.max(newTime, valueIfTriggerNonNegative.getFiltrationTime());
newTime = Math.max(newTime, valueIfTriggerNegative.getFiltrationTime());
if(isDeterministic() && trigger.isDeterministic() && valueIfTriggerNonNegative.isDeterministic() && valueIfTriggerNegative.isDeterministic()) {
double newValueIfNonStochastic = trigger.get(0) >= 0 ? valueIfTriggerNonNegative.get(0) : valueIfTriggerNegative.get(0);
return new RandomVariableLowMemory(newTime, newValueIfNonStochastic);
}
else {
int numberOfPaths = Math.max(Math.max(trigger.size(), valueIfTriggerNonNegative.size()), valueIfTriggerNegative.size());
double[] newRealizations = new double[numberOfPaths];
for(int i=0; i<newRealizations.length; i++) {
newRealizations[i] = trigger.get(i) >= 0.0 ? valueIfTriggerNonNegative.get(i) : valueIfTriggerNegative.get(i);
}
return new RandomVariableLowMemory(newTime, newRealizations);
}
} }
|
public class class_name {
public RandomVariableInterface barrier(RandomVariableInterface trigger, RandomVariableInterface valueIfTriggerNonNegative, RandomVariableInterface valueIfTriggerNegative) {
// Set time of this random variable to maximum of time with respect to which measurability is known.
double newTime = Math.max(time, trigger.getFiltrationTime());
newTime = Math.max(newTime, valueIfTriggerNonNegative.getFiltrationTime());
newTime = Math.max(newTime, valueIfTriggerNegative.getFiltrationTime());
if(isDeterministic() && trigger.isDeterministic() && valueIfTriggerNonNegative.isDeterministic() && valueIfTriggerNegative.isDeterministic()) {
double newValueIfNonStochastic = trigger.get(0) >= 0 ? valueIfTriggerNonNegative.get(0) : valueIfTriggerNegative.get(0);
return new RandomVariableLowMemory(newTime, newValueIfNonStochastic); // depends on control dependency: [if], data = [none]
}
else {
int numberOfPaths = Math.max(Math.max(trigger.size(), valueIfTriggerNonNegative.size()), valueIfTriggerNegative.size());
double[] newRealizations = new double[numberOfPaths];
for(int i=0; i<newRealizations.length; i++) {
newRealizations[i] = trigger.get(i) >= 0.0 ? valueIfTriggerNonNegative.get(i) : valueIfTriggerNegative.get(i); // depends on control dependency: [for], data = [i]
}
return new RandomVariableLowMemory(newTime, newRealizations); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean overlaps(ReadableInterval interval) {
long thisStart = getStartMillis();
long thisEnd = getEndMillis();
if (interval == null) {
long now = DateTimeUtils.currentTimeMillis();
return (thisStart < now && now < thisEnd);
} else {
long otherStart = interval.getStartMillis();
long otherEnd = interval.getEndMillis();
return (thisStart < otherEnd && otherStart < thisEnd);
}
} }
|
public class class_name {
public boolean overlaps(ReadableInterval interval) {
long thisStart = getStartMillis();
long thisEnd = getEndMillis();
if (interval == null) {
long now = DateTimeUtils.currentTimeMillis();
return (thisStart < now && now < thisEnd); // depends on control dependency: [if], data = [none]
} else {
long otherStart = interval.getStartMillis();
long otherEnd = interval.getEndMillis();
return (thisStart < otherEnd && otherStart < thisEnd); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String messageAsText() {
if (protocol.charset().isPresent()) {
return message.decodeString(protocol.charset().get());
} else {
return Base64.getEncoder().encodeToString(message.toArray());
}
} }
|
public class class_name {
public String messageAsText() {
if (protocol.charset().isPresent()) {
return message.decodeString(protocol.charset().get()); // depends on control dependency: [if], data = [none]
} else {
return Base64.getEncoder().encodeToString(message.toArray()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static long periodEnd(long now,
long period,
LocalDateTime cal)
{
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
//cal.setGMTTime(now);
long localTime = cal.toEpochSecond(ZoneOffset.UTC) * 1000;
localTime = localTime + (period - (localTime + 4 * DAY) % period);
//cal.setLocalTime(localTime);
//return cal.getGMTTime();
return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
//cal.setGMTTime(now);
long year = cal.getYear();
int month = cal.getMonthValue();
//cal.setLocalTime(0);
//cal.setDate(year, month + months, 1);
cal.withMonth(month + months);
cal.withDayOfMonth(1);
return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
//cal.setGMTTime(now);
long year = cal.getYear();
//cal.setLocalTime(0);
long newYear = year + (years - year % years);
cal.withYear((int) newYear);
cal.withMonth(1);
cal.withDayOfMonth(1);
return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
}
//cal.setGMTTime(now);
//long localTime = cal.getLocalTime();
//localTime = localTime + (period - (localTime + 4 * DAY) % period);
//cal.setLocalTime(localTime);
//return cal.getGMTTime();
return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
} }
|
public class class_name {
private static long periodEnd(long now,
long period,
LocalDateTime cal)
{
if (period < 0)
return Long.MAX_VALUE;
else if (period == 0)
return now;
if (period < 30 * DAY) {
//cal.setGMTTime(now);
long localTime = cal.toEpochSecond(ZoneOffset.UTC) * 1000;
localTime = localTime + (period - (localTime + 4 * DAY) % period); // depends on control dependency: [if], data = [(period]
//cal.setLocalTime(localTime);
//return cal.getGMTTime();
return cal.toEpochSecond(ZoneOffset.UTC) * 1000; // depends on control dependency: [if], data = [none]
}
if (period % (30 * DAY) == 0) {
int months = (int) (period / (30 * DAY));
//cal.setGMTTime(now);
long year = cal.getYear();
int month = cal.getMonthValue();
//cal.setLocalTime(0);
//cal.setDate(year, month + months, 1);
cal.withMonth(month + months); // depends on control dependency: [if], data = [none]
cal.withDayOfMonth(1); // depends on control dependency: [if], data = [none]
return cal.toEpochSecond(ZoneOffset.UTC) * 1000; // depends on control dependency: [if], data = [none]
}
if (period % (365 * DAY) == 0) {
long years = (period / (365 * DAY));
//cal.setGMTTime(now);
long year = cal.getYear();
//cal.setLocalTime(0);
long newYear = year + (years - year % years);
cal.withYear((int) newYear); // depends on control dependency: [if], data = [none]
cal.withMonth(1); // depends on control dependency: [if], data = [none]
cal.withDayOfMonth(1); // depends on control dependency: [if], data = [none]
return cal.toEpochSecond(ZoneOffset.UTC) * 1000; // depends on control dependency: [if], data = [none]
}
//cal.setGMTTime(now);
//long localTime = cal.getLocalTime();
//localTime = localTime + (period - (localTime + 4 * DAY) % period);
//cal.setLocalTime(localTime);
//return cal.getGMTTime();
return cal.toEpochSecond(ZoneOffset.UTC) * 1000;
} }
|
public class class_name {
public Observable<ServiceResponse<Integer>> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
return service.getUntaggedImageCount(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Integer>>>() {
@Override
public Observable<ServiceResponse<Integer>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Integer> clientResponse = getUntaggedImageCountDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Integer>> getUntaggedImageCountWithServiceResponseAsync(UUID projectId, UUID iterationId) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
return service.getUntaggedImageCount(projectId, iterationId, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Integer>>>() {
@Override
public Observable<ServiceResponse<Integer>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Integer> clientResponse = getUntaggedImageCountDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public void marshall(TrustedAdvisorCostOptimizingSummary trustedAdvisorCostOptimizingSummary, ProtocolMarshaller protocolMarshaller) {
if (trustedAdvisorCostOptimizingSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trustedAdvisorCostOptimizingSummary.getEstimatedMonthlySavings(), ESTIMATEDMONTHLYSAVINGS_BINDING);
protocolMarshaller.marshall(trustedAdvisorCostOptimizingSummary.getEstimatedPercentMonthlySavings(), ESTIMATEDPERCENTMONTHLYSAVINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TrustedAdvisorCostOptimizingSummary trustedAdvisorCostOptimizingSummary, ProtocolMarshaller protocolMarshaller) {
if (trustedAdvisorCostOptimizingSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(trustedAdvisorCostOptimizingSummary.getEstimatedMonthlySavings(), ESTIMATEDMONTHLYSAVINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(trustedAdvisorCostOptimizingSummary.getEstimatedPercentMonthlySavings(), ESTIMATEDPERCENTMONTHLYSAVINGS_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 {
@SuppressWarnings("unchecked")
public void scanForProvidedResources(Object theProvider) {
ProvidesResources annotation = theProvider.getClass().getAnnotation(ProvidesResources.class);
if (annotation == null)
return;
for (Class<?> clazz : annotation.resources()) {
if (IBaseResource.class.isAssignableFrom(clazz)) {
myContext.getResourceDefinition((Class<? extends IBaseResource>) clazz);
} else {
ourLog.warn(clazz.getSimpleName() + "is not assignable from IResource");
}
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public void scanForProvidedResources(Object theProvider) {
ProvidesResources annotation = theProvider.getClass().getAnnotation(ProvidesResources.class);
if (annotation == null)
return;
for (Class<?> clazz : annotation.resources()) {
if (IBaseResource.class.isAssignableFrom(clazz)) {
myContext.getResourceDefinition((Class<? extends IBaseResource>) clazz); // depends on control dependency: [if], data = [none]
} else {
ourLog.warn(clazz.getSimpleName() + "is not assignable from IResource"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void populateExpandedExceptions()
{
if (!m_exceptions.isEmpty() && m_expandedExceptions.isEmpty())
{
for (ProjectCalendarException exception : m_exceptions)
{
RecurringData recurring = exception.getRecurring();
if (recurring == null)
{
m_expandedExceptions.add(exception);
}
else
{
for (Date date : recurring.getDates())
{
Date startDate = DateHelper.getDayStartDate(date);
Date endDate = DateHelper.getDayEndDate(date);
ProjectCalendarException newException = new ProjectCalendarException(startDate, endDate);
int rangeCount = exception.getRangeCount();
for (int rangeIndex = 0; rangeIndex < rangeCount; rangeIndex++)
{
newException.addRange(exception.getRange(rangeIndex));
}
m_expandedExceptions.add(newException);
}
}
}
Collections.sort(m_expandedExceptions);
}
} }
|
public class class_name {
private void populateExpandedExceptions()
{
if (!m_exceptions.isEmpty() && m_expandedExceptions.isEmpty())
{
for (ProjectCalendarException exception : m_exceptions)
{
RecurringData recurring = exception.getRecurring();
if (recurring == null)
{
m_expandedExceptions.add(exception); // depends on control dependency: [if], data = [none]
}
else
{
for (Date date : recurring.getDates())
{
Date startDate = DateHelper.getDayStartDate(date);
Date endDate = DateHelper.getDayEndDate(date);
ProjectCalendarException newException = new ProjectCalendarException(startDate, endDate);
int rangeCount = exception.getRangeCount();
for (int rangeIndex = 0; rangeIndex < rangeCount; rangeIndex++)
{
newException.addRange(exception.getRange(rangeIndex)); // depends on control dependency: [for], data = [rangeIndex]
}
m_expandedExceptions.add(newException); // depends on control dependency: [for], data = [none]
}
}
}
Collections.sort(m_expandedExceptions); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public final Validation getCachedMoveValidation(Move<?> move) {
if(validatedMove == null || !validatedMove.equals(move)){
// cache miss
return null;
} else {
// cache hit
return validation;
}
} }
|
public class class_name {
@Override
public final Validation getCachedMoveValidation(Move<?> move) {
if(validatedMove == null || !validatedMove.equals(move)){
// cache miss
return null; // depends on control dependency: [if], data = [none]
} else {
// cache hit
return validation; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// ====================================== upsert ======================================
Method mUpsert = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable), "record")
);
commentGenerator.addGeneralMethodComment(mUpsert, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsert);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsert方法。");
// ====================================== upsertWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
Method mUpsertWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable), "record")
);
commentGenerator.addGeneralMethodComment(mUpsertWithBLOBs, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertWithBLOBs);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertWithBLOBs方法。");
}
// ====================================== upsertSelective ======================================
// 找出全字段对应的Model
FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass();
Method mUpsertSelective = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(fullFieldModel, "record")
);
commentGenerator.addGeneralMethodComment(mUpsertSelective, introspectedTable);
// hook
if (PluginTools.getHook(IUpsertPluginHook.class).clientUpsertSelectiveMethodGenerated(mUpsertSelective, interfaze, introspectedTable)) {
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertSelective);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertSelective方法。");
}
if (this.allowMultiQueries) {
// ====================================== upsertByExample ======================================
Method mUpsertByExample = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExample, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExample);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExample方法。");
// ====================================== upsertByExampleWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
Method mUpsertByExampleWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExampleWithBLOBs, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExampleWithBLOBs);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExampleWithBLOBs方法。");
}
// ====================================== upsertByExampleSelective ======================================
Method mUpsertByExampleSelective = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(introspectedTable.getRules().calculateAllFieldsClass(), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExampleSelective, introspectedTable);
// hook
if (PluginTools.getHook(IUpsertPluginHook.class).clientUpsertByExampleSelectiveMethodGenerated(mUpsertByExampleSelective, interfaze, introspectedTable)) {
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExampleSelective);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExampleSelective方法。");
}
}
if (this.allowBatchUpsert) {
// ====================================== batchUpsert ======================================
FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance();
returnType.addTypeArgument(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable));
Method mBatchUpsert = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")")
);
commentGenerator.addGeneralMethodComment(mBatchUpsert, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsert);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsert方法。");
// ====================================== batchUpsertWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
returnType = FullyQualifiedJavaType.getNewListInstance();
returnType.addTypeArgument(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable));
Method mBatchUpsertWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")")
);
commentGenerator.addGeneralMethodComment(mBatchUpsertWithBLOBs, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsertWithBLOBs);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsertWithBLOBs方法。");
}
// ====================================== batchUpsertSelective ======================================
returnType = FullyQualifiedJavaType.getNewListInstance();
returnType.addTypeArgument(fullFieldModel);
FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(introspectedTable.getRules().calculateAllFieldsClass().getShortName() + "." + ModelColumnPlugin.ENUM_NAME);
Method mBatchUpsertSelective = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")"),
new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)
);
commentGenerator.addGeneralMethodComment(mBatchUpsertSelective, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsertSelective);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsertSelective方法。");
}
return super.clientGenerated(interfaze, topLevelClass, introspectedTable);
} }
|
public class class_name {
@Override
public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
// ====================================== upsert ======================================
Method mUpsert = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable), "record")
);
commentGenerator.addGeneralMethodComment(mUpsert, introspectedTable);
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsert);
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsert方法。");
// ====================================== upsertWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
Method mUpsertWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable), "record")
);
commentGenerator.addGeneralMethodComment(mUpsertWithBLOBs, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertWithBLOBs); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertWithBLOBs方法。"); // depends on control dependency: [if], data = [none]
}
// ====================================== upsertSelective ======================================
// 找出全字段对应的Model
FullyQualifiedJavaType fullFieldModel = introspectedTable.getRules().calculateAllFieldsClass();
Method mUpsertSelective = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(fullFieldModel, "record")
);
commentGenerator.addGeneralMethodComment(mUpsertSelective, introspectedTable);
// hook
if (PluginTools.getHook(IUpsertPluginHook.class).clientUpsertSelectiveMethodGenerated(mUpsertSelective, interfaze, introspectedTable)) {
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertSelective); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertSelective方法。"); // depends on control dependency: [if], data = [none]
}
if (this.allowMultiQueries) {
// ====================================== upsertByExample ======================================
Method mUpsertByExample = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExample, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExample); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExample方法。"); // depends on control dependency: [if], data = [none]
// ====================================== upsertByExampleWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
Method mUpsertByExampleWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExampleWithBLOBs, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExampleWithBLOBs); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExampleWithBLOBs方法。"); // depends on control dependency: [if], data = [none]
}
// ====================================== upsertByExampleSelective ======================================
Method mUpsertByExampleSelective = JavaElementGeneratorTools.generateMethod(
METHOD_UPSERT_BY_EXAMPLE_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(introspectedTable.getRules().calculateAllFieldsClass(), "record", "@Param(\"record\")"),
new Parameter(new FullyQualifiedJavaType(introspectedTable.getExampleType()), "example", "@Param(\"example\")")
);
commentGenerator.addGeneralMethodComment(mUpsertByExampleSelective, introspectedTable); // depends on control dependency: [if], data = [none]
// hook
if (PluginTools.getHook(IUpsertPluginHook.class).clientUpsertByExampleSelectiveMethodGenerated(mUpsertByExampleSelective, interfaze, introspectedTable)) {
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mUpsertByExampleSelective); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加upsertByExampleSelective方法。"); // depends on control dependency: [if], data = [none]
}
}
if (this.allowBatchUpsert) {
// ====================================== batchUpsert ======================================
FullyQualifiedJavaType returnType = FullyQualifiedJavaType.getNewListInstance();
returnType.addTypeArgument(JavaElementGeneratorTools.getModelTypeWithoutBLOBs(introspectedTable)); // depends on control dependency: [if], data = [none]
Method mBatchUpsert = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")")
);
commentGenerator.addGeneralMethodComment(mBatchUpsert, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsert); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsert方法。"); // depends on control dependency: [if], data = [none]
// ====================================== batchUpsertWithBLOBs ======================================
// !!! 注意这里的行为不以有没有生成Model 的 WithBLOBs类为基准
if (introspectedTable.hasBLOBColumns()) {
returnType = FullyQualifiedJavaType.getNewListInstance(); // depends on control dependency: [if], data = [none]
returnType.addTypeArgument(JavaElementGeneratorTools.getModelTypeWithBLOBs(introspectedTable)); // depends on control dependency: [if], data = [none]
Method mBatchUpsertWithBLOBs = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT_WITH_BLOBS,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")")
);
commentGenerator.addGeneralMethodComment(mBatchUpsertWithBLOBs, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsertWithBLOBs); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsertWithBLOBs方法。"); // depends on control dependency: [if], data = [none]
}
// ====================================== batchUpsertSelective ======================================
returnType = FullyQualifiedJavaType.getNewListInstance(); // depends on control dependency: [if], data = [none]
returnType.addTypeArgument(fullFieldModel); // depends on control dependency: [if], data = [none]
FullyQualifiedJavaType selectiveType = new FullyQualifiedJavaType(introspectedTable.getRules().calculateAllFieldsClass().getShortName() + "." + ModelColumnPlugin.ENUM_NAME);
Method mBatchUpsertSelective = JavaElementGeneratorTools.generateMethod(
METHOD_BATCH_UPSERT_SELECTIVE,
JavaVisibility.DEFAULT,
FullyQualifiedJavaType.getIntInstance(),
new Parameter(returnType, "list", "@Param(\"list\")"),
new Parameter(selectiveType, "selective", "@Param(\"selective\")", true)
);
commentGenerator.addGeneralMethodComment(mBatchUpsertSelective, introspectedTable); // depends on control dependency: [if], data = [none]
// interface 增加方法
FormatTools.addMethodWithBestPosition(interfaze, mBatchUpsertSelective); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(存在即更新插件):" + interfaze.getType().getShortName() + "增加batchUpsertSelective方法。"); // depends on control dependency: [if], data = [none]
}
return super.clientGenerated(interfaze, topLevelClass, introspectedTable);
} }
|
public class class_name {
public MetricFilter metricsFilter() {
if (id() == null) {
return (name, metric) -> false;
}
return new MetricUtils.SingleMetricFilter(metricName);
} }
|
public class class_name {
public MetricFilter metricsFilter() {
if (id() == null) {
return (name, metric) -> false; // depends on control dependency: [if], data = [none]
}
return new MetricUtils.SingleMetricFilter(metricName);
} }
|
public class class_name {
public int colSum(int classindex) {
int s = 0;
for(int i = 0; i < confusion.length; i++) {
s += confusion[i][classindex];
}
return s;
} }
|
public class class_name {
public int colSum(int classindex) {
int s = 0;
for(int i = 0; i < confusion.length; i++) {
s += confusion[i][classindex]; // depends on control dependency: [for], data = [i]
}
return s;
} }
|
public class class_name {
public void setWindowIdentities(java.util.Collection<MaintenanceWindowIdentity> windowIdentities) {
if (windowIdentities == null) {
this.windowIdentities = null;
return;
}
this.windowIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowIdentity>(windowIdentities);
} }
|
public class class_name {
public void setWindowIdentities(java.util.Collection<MaintenanceWindowIdentity> windowIdentities) {
if (windowIdentities == null) {
this.windowIdentities = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.windowIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowIdentity>(windowIdentities);
} }
|
public class class_name {
private List<EdgeTraversal> sortEdges(Map<String, Long> estimatedRootEntries, Pattern pattern, OCommandContext ctx) {
OQueryStats stats = null;
if (ctx != null && ctx.getDatabase() != null) {
stats = OQueryStats.get((ODatabaseDocumentInternal) ctx.getDatabase());
}
//TODO use the stats
List<EdgeTraversal> result = new ArrayList<EdgeTraversal>();
List<OPair<Long, String>> rootWeights = new ArrayList<OPair<Long, String>>();
for (Map.Entry<String, Long> root : estimatedRootEntries.entrySet()) {
rootWeights.add(new OPair<Long, String>(root.getValue(), root.getKey()));
}
Collections.sort(rootWeights);
Set<PatternEdge> traversedEdges = new HashSet<PatternEdge>();
Set<PatternNode> traversedNodes = new HashSet<PatternNode>();
List<PatternNode> nextNodes = new ArrayList<PatternNode>();
while (result.size() < pattern.getNumOfEdges()) {
for (OPair<Long, String> rootPair : rootWeights) {
PatternNode root = pattern.get(rootPair.getValue());
if (root.isOptionalNode()) {
continue;
}
if (!traversedNodes.contains(root)) {
nextNodes.add(root);
break;
}
}
if (nextNodes.isEmpty()) {
break;
}
while (!nextNodes.isEmpty()) {
PatternNode node = nextNodes.remove(0);
traversedNodes.add(node);
for (PatternEdge edge : node.out) {
if (!traversedEdges.contains(edge)) {
result.add(new EdgeTraversal(edge, true));
traversedEdges.add(edge);
if (!traversedNodes.contains(edge.in) && !nextNodes.contains(edge.in)) {
nextNodes.add(edge.in);
}
}
}
for (PatternEdge edge : node.in) {
if (!traversedEdges.contains(edge) && edge.item.isBidirectional()) {
result.add(new EdgeTraversal(edge, false));
traversedEdges.add(edge);
if (!traversedNodes.contains(edge.out) && !nextNodes.contains(edge.out)) {
nextNodes.add(edge.out);
}
}
}
}
}
return result;
} }
|
public class class_name {
private List<EdgeTraversal> sortEdges(Map<String, Long> estimatedRootEntries, Pattern pattern, OCommandContext ctx) {
OQueryStats stats = null;
if (ctx != null && ctx.getDatabase() != null) {
stats = OQueryStats.get((ODatabaseDocumentInternal) ctx.getDatabase()); // depends on control dependency: [if], data = [none]
}
//TODO use the stats
List<EdgeTraversal> result = new ArrayList<EdgeTraversal>();
List<OPair<Long, String>> rootWeights = new ArrayList<OPair<Long, String>>();
for (Map.Entry<String, Long> root : estimatedRootEntries.entrySet()) {
rootWeights.add(new OPair<Long, String>(root.getValue(), root.getKey())); // depends on control dependency: [for], data = [root]
}
Collections.sort(rootWeights);
Set<PatternEdge> traversedEdges = new HashSet<PatternEdge>();
Set<PatternNode> traversedNodes = new HashSet<PatternNode>();
List<PatternNode> nextNodes = new ArrayList<PatternNode>();
while (result.size() < pattern.getNumOfEdges()) {
for (OPair<Long, String> rootPair : rootWeights) {
PatternNode root = pattern.get(rootPair.getValue());
if (root.isOptionalNode()) {
continue;
}
if (!traversedNodes.contains(root)) {
nextNodes.add(root); // depends on control dependency: [if], data = [none]
break;
}
}
if (nextNodes.isEmpty()) {
break;
}
while (!nextNodes.isEmpty()) {
PatternNode node = nextNodes.remove(0);
traversedNodes.add(node); // depends on control dependency: [while], data = [none]
for (PatternEdge edge : node.out) {
if (!traversedEdges.contains(edge)) {
result.add(new EdgeTraversal(edge, true)); // depends on control dependency: [if], data = [none]
traversedEdges.add(edge); // depends on control dependency: [if], data = [none]
if (!traversedNodes.contains(edge.in) && !nextNodes.contains(edge.in)) {
nextNodes.add(edge.in); // depends on control dependency: [if], data = [none]
}
}
}
for (PatternEdge edge : node.in) {
if (!traversedEdges.contains(edge) && edge.item.isBidirectional()) {
result.add(new EdgeTraversal(edge, false)); // depends on control dependency: [if], data = [none]
traversedEdges.add(edge); // depends on control dependency: [if], data = [none]
if (!traversedNodes.contains(edge.out) && !nextNodes.contains(edge.out)) {
nextNodes.add(edge.out); // depends on control dependency: [if], data = [none]
}
}
}
}
}
return result;
} }
|
public class class_name {
public static boolean isDeprecated(Doc doc) {
if (doc.tags("deprecated").length > 0) {
return true;
}
AnnotationDesc[] annotationDescList;
if (doc instanceof PackageDoc)
annotationDescList = ((PackageDoc)doc).annotations();
else
annotationDescList = ((ProgramElementDoc)doc).annotations();
for (int i = 0; i < annotationDescList.length; i++) {
if (annotationDescList[i].annotationType().qualifiedName().equals(
java.lang.Deprecated.class.getName())){
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean isDeprecated(Doc doc) {
if (doc.tags("deprecated").length > 0) {
return true; // depends on control dependency: [if], data = [none]
}
AnnotationDesc[] annotationDescList;
if (doc instanceof PackageDoc)
annotationDescList = ((PackageDoc)doc).annotations();
else
annotationDescList = ((ProgramElementDoc)doc).annotations();
for (int i = 0; i < annotationDescList.length; i++) {
if (annotationDescList[i].annotationType().qualifiedName().equals(
java.lang.Deprecated.class.getName())){
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public static final Collection<String> getDescription(final String pAtr) {
Collection<String> ret = null;
if (StringUtils.isNotBlank(pAtr)) {
String val = StringUtils.deleteWhitespace(pAtr).toUpperCase();
for (String key : MAP.keySet()) {
if (val.matches("^" + key + "$")) {
ret = (Collection<String>) MAP.get(key);
break;
}
}
}
return ret;
} }
|
public class class_name {
public static final Collection<String> getDescription(final String pAtr) {
Collection<String> ret = null;
if (StringUtils.isNotBlank(pAtr)) {
String val = StringUtils.deleteWhitespace(pAtr).toUpperCase();
for (String key : MAP.keySet()) {
if (val.matches("^" + key + "$")) {
ret = (Collection<String>) MAP.get(key); // depends on control dependency: [if], data = [none]
break;
}
}
}
return ret;
} }
|
public class class_name {
private void addStopwatchSplits(Stopwatch stopwatch, int splitWidth) {
final int splits = randomInt(splitWidth / 2, splitWidth);
try {
lock.lock();
System.out.print(stopwatch.getName() + " " + splits + ": ");
for (int i = 0; i < splits; i++) {
System.out.print(addStopwatchSplit(stopwatch) + ",");
}
System.out.println();
} finally {
lock.unlock();
}
} }
|
public class class_name {
private void addStopwatchSplits(Stopwatch stopwatch, int splitWidth) {
final int splits = randomInt(splitWidth / 2, splitWidth);
try {
lock.lock(); // depends on control dependency: [try], data = [none]
System.out.print(stopwatch.getName() + " " + splits + ": "); // depends on control dependency: [try], data = [none]
for (int i = 0; i < splits; i++) {
System.out.print(addStopwatchSplit(stopwatch) + ","); // depends on control dependency: [for], data = [none]
}
System.out.println(); // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} }
|
public class class_name {
private void moveRoles(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<RoleDAO.Data>> rrdc) {
Result<Void> rv;
Result<RoleDAO.Data> rd;
if (rrdc.isOKhasData()) {
for (RoleDAO.Data rdd : rrdc.value) {
String delP2 = rdd.name;
if ("admin".equals(delP2) || "owner".equals(delP2)) {
continue;
}
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<PermDAO.Data>();
for(String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
if(rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd);
q.permDAO.delRole(trans, pdd, rdd);
} else{
trans.error().log(rpdd.errorString());
}
}
// Save off Old keys
String delP1 = rdd.ns;
NsSplit nss = new NsSplit(parent, rdd.fullName());
rdd.ns = nss.ns;
rdd.name = nss.name;
// Use direct Create/Delete, because switching namespaces
if ((rd = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
for(PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd);
}
rdd.ns = delP1;
rdd.name = delP2;
if ((rv = q.roleDAO.delete(trans, rdd, true)).notOK()) {
sb.append(rv.details);
sb.append('\n');
// } else {
// Need to invalidate directly, because we're switching
// places in NS, not normal cache behavior
// q.roleDAO.invalidate(trans,rdd);
}
} else {
sb.append(rd.details);
sb.append('\n');
}
}
}
} }
|
public class class_name {
private void moveRoles(AuthzTrans trans, NsDAO.Data parent,
StringBuilder sb, Result<List<RoleDAO.Data>> rrdc) {
Result<Void> rv;
Result<RoleDAO.Data> rd;
if (rrdc.isOKhasData()) {
for (RoleDAO.Data rdd : rrdc.value) {
String delP2 = rdd.name;
if ("admin".equals(delP2) || "owner".equals(delP2)) {
continue;
}
// Remove old Role from Perms, save them off
List<PermDAO.Data> lpdd = new ArrayList<PermDAO.Data>();
for(String p : rdd.perms(false)) {
Result<PermDAO.Data> rpdd = PermDAO.Data.decode(trans,q,p);
if(rpdd.isOKhasData()) {
PermDAO.Data pdd = rpdd.value;
lpdd.add(pdd); // depends on control dependency: [if], data = [none]
q.permDAO.delRole(trans, pdd, rdd); // depends on control dependency: [if], data = [none]
} else{
trans.error().log(rpdd.errorString()); // depends on control dependency: [if], data = [none]
}
}
// Save off Old keys
String delP1 = rdd.ns;
NsSplit nss = new NsSplit(parent, rdd.fullName());
rdd.ns = nss.ns; // depends on control dependency: [for], data = [rdd]
rdd.name = nss.name; // depends on control dependency: [for], data = [rdd]
// Use direct Create/Delete, because switching namespaces
if ((rd = q.roleDAO.create(trans, rdd)).isOK()) {
// Put Role back into Perm, with correct info
for(PermDAO.Data pdd : lpdd) {
q.permDAO.addRole(trans, pdd, rdd); // depends on control dependency: [for], data = [pdd]
}
rdd.ns = delP1; // depends on control dependency: [if], data = [none]
rdd.name = delP2; // depends on control dependency: [if], data = [none]
if ((rv = q.roleDAO.delete(trans, rdd, true)).notOK()) {
sb.append(rv.details); // depends on control dependency: [if], data = [none]
sb.append('\n'); // depends on control dependency: [if], data = [none]
// } else {
// Need to invalidate directly, because we're switching
// places in NS, not normal cache behavior
// q.roleDAO.invalidate(trans,rdd);
}
} else {
sb.append(rd.details); // depends on control dependency: [if], data = [none]
sb.append('\n'); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static String getObjectURI(ParaObject obj, boolean includeName, boolean includeId) {
if (obj == null) {
return "/";
}
if (includeId && obj.getId() != null) {
return (includeName && !StringUtils.isBlank(obj.getName())) ? obj.getObjectURI().concat("-").
concat(urlEncode(noSpaces(obj.getName(), "-"))) : obj.getObjectURI();
} else {
return obj.getObjectURI();
}
} }
|
public class class_name {
public static String getObjectURI(ParaObject obj, boolean includeName, boolean includeId) {
if (obj == null) {
return "/"; // depends on control dependency: [if], data = [none]
}
if (includeId && obj.getId() != null) {
return (includeName && !StringUtils.isBlank(obj.getName())) ? obj.getObjectURI().concat("-").
concat(urlEncode(noSpaces(obj.getName(), "-"))) : obj.getObjectURI(); // depends on control dependency: [if], data = [none]
} else {
return obj.getObjectURI(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void addVertex(final AbstractJobOutputVertex outputVertex) {
if (!outputVertices.containsKey(outputVertex.getID())) {
outputVertices.put(outputVertex.getID(), outputVertex);
}
} }
|
public class class_name {
public void addVertex(final AbstractJobOutputVertex outputVertex) {
if (!outputVertices.containsKey(outputVertex.getID())) {
outputVertices.put(outputVertex.getID(), outputVertex); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected final List<Date> parseElementListDate(final List<Element> elements, final Locale locale) {
final List<Date> values = new ArrayList<Date>();
for (final Element element : elements) {
values.add(DateParser.parseDate(element.getText(), locale));
}
return values;
} }
|
public class class_name {
protected final List<Date> parseElementListDate(final List<Element> elements, final Locale locale) {
final List<Date> values = new ArrayList<Date>();
for (final Element element : elements) {
values.add(DateParser.parseDate(element.getText(), locale)); // depends on control dependency: [for], data = [element]
}
return values;
} }
|
public class class_name {
public Permission createPermissionObject(String permissionClass, String target, String action, String credential, String principalType, String principalName, String fileName) {
Permission permission = null;
if ((target != null) && (target.equals("ALL FILES") || target.contains("ALL FILES"))) {
target = "<<ALL FILES>>";
}
try {
if (permissionClass != null && !permissionClass.equalsIgnoreCase("null")) {
// If this is a PrivateCredentialPermission
if (permissionClass.equalsIgnoreCase("javax.security.auth.PrivateCredentialPermission")) {
if (target == null || target.equalsIgnoreCase("null")) {
// Create target from the credential and principal details
StringBuilder targetString = new StringBuilder();
targetString.append(credential);
targetString.append(" ");
targetString.append(principalType);
targetString.append(" \"");
targetString.append(principalName);
targetString.append("\"");
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(targetString.toString(), "read");
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, "read");
}
} else {
if (action == null || action.equalsIgnoreCase("null")) {
if (target == null || target.equalsIgnoreCase("null")) {
permission = (Permission) getPermissionClass(permissionClass).newInstance();
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class).newInstance(target);
}
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, action);
}
}
}
} catch (Exception e) {
if (tc.isWarningEnabled()) {
String rootCause = null;
if (e.getCause() != null) {
rootCause = e.getCause().getClass().getName() + "[" + e.getCause().getMessage() + "]";
} else if (e.getMessage() != null) {
rootCause = e.getClass().getName() + "[" + e.getMessage() + "]";
}
if (rootCause == null) {
rootCause = "unknown reasons";
}
if (e instanceof java.lang.ClassNotFoundException) {
Tr.warning(tc, PERMISSION_CLASSNOTFOUND, permissionClass, rootCause, fileName);
} else {
Tr.warning(tc, INCORRECT_PERMISSION_CONFIGURATION, permissionClass, rootCause, fileName);
}
}
if (e instanceof java.lang.ClassNotFoundException) {
permission = new UnresolvedPermission(permissionClass, target, action, null);
}
}
return permission;
} }
|
public class class_name {
public Permission createPermissionObject(String permissionClass, String target, String action, String credential, String principalType, String principalName, String fileName) {
Permission permission = null;
if ((target != null) && (target.equals("ALL FILES") || target.contains("ALL FILES"))) {
target = "<<ALL FILES>>"; // depends on control dependency: [if], data = [none]
}
try {
if (permissionClass != null && !permissionClass.equalsIgnoreCase("null")) {
// If this is a PrivateCredentialPermission
if (permissionClass.equalsIgnoreCase("javax.security.auth.PrivateCredentialPermission")) {
if (target == null || target.equalsIgnoreCase("null")) {
// Create target from the credential and principal details
StringBuilder targetString = new StringBuilder();
targetString.append(credential);
targetString.append(" ");
targetString.append(principalType);
targetString.append(" \"");
targetString.append(principalName);
targetString.append("\"");
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(targetString.toString(), "read");
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, "read");
}
} else {
if (action == null || action.equalsIgnoreCase("null")) {
if (target == null || target.equalsIgnoreCase("null")) {
permission = (Permission) getPermissionClass(permissionClass).newInstance();
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class).newInstance(target);
}
} else {
permission = (Permission) getPermissionClass(permissionClass).getConstructor(String.class, String.class).newInstance(target, action);
}
}
}
} catch (Exception e) {
if (tc.isWarningEnabled()) {
String rootCause = null;
if (e.getCause() != null) {
rootCause = e.getCause().getClass().getName() + "[" + e.getCause().getMessage() + "]";
} else if (e.getMessage() != null) {
rootCause = e.getClass().getName() + "[" + e.getMessage() + "]";
}
if (rootCause == null) {
rootCause = "unknown reasons";
}
if (e instanceof java.lang.ClassNotFoundException) {
Tr.warning(tc, PERMISSION_CLASSNOTFOUND, permissionClass, rootCause, fileName); // depends on control dependency: [if], data = [none]
} else {
Tr.warning(tc, INCORRECT_PERMISSION_CONFIGURATION, permissionClass, rootCause, fileName); // depends on control dependency: [if], data = [none]
}
}
if (e instanceof java.lang.ClassNotFoundException) {
permission = new UnresolvedPermission(permissionClass, target, action, null); // depends on control dependency: [if], data = [none]
}
}
return permission;
} }
|
public class class_name {
public static String subst(final String value, final Properties props) {
try {
return OptionConverter.substVars(value, props);
} catch (IllegalArgumentException e) {
LogLog.warn("Could not perform variable substitution.", e);
return value;
}
} }
|
public class class_name {
public static String subst(final String value, final Properties props) {
try {
return OptionConverter.substVars(value, props); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
LogLog.warn("Could not perform variable substitution.", e);
return value;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public java.util.List<Object> getAddressOrAlternativesOrArray() {
if (addressOrAlternativesOrArray == null) {
addressOrAlternativesOrArray = new ArrayList<Object>();
}
return this.addressOrAlternativesOrArray;
} }
|
public class class_name {
public java.util.List<Object> getAddressOrAlternativesOrArray() {
if (addressOrAlternativesOrArray == null) {
addressOrAlternativesOrArray = new ArrayList<Object>(); // depends on control dependency: [if], data = [none]
}
return this.addressOrAlternativesOrArray;
} }
|
public class class_name {
protected void onServiceInstanceUnavailable(ServiceInstance instance){
if(instance == null){
return ;
}
String serviceName = instance.getServiceName();
List<NotificationHandler> handlerList = new ArrayList<NotificationHandler>();
synchronized (notificationHandlers) {
if (notificationHandlers.containsKey(serviceName)) {
handlerList.addAll(notificationHandlers.get(serviceName));
}
}
for(NotificationHandler h : handlerList) {
h.serviceInstanceUnavailable(instance);
}
} }
|
public class class_name {
protected void onServiceInstanceUnavailable(ServiceInstance instance){
if(instance == null){
return ; // depends on control dependency: [if], data = [none]
}
String serviceName = instance.getServiceName();
List<NotificationHandler> handlerList = new ArrayList<NotificationHandler>();
synchronized (notificationHandlers) {
if (notificationHandlers.containsKey(serviceName)) {
handlerList.addAll(notificationHandlers.get(serviceName)); // depends on control dependency: [if], data = [none]
}
}
for(NotificationHandler h : handlerList) {
h.serviceInstanceUnavailable(instance); // depends on control dependency: [for], data = [h]
}
} }
|
public class class_name {
@WebOperationMethod
public Map<String,Object> download(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws Exception {
String database = Objects.get(params, "database");
String collection = Objects.get(params, "collection", COLLECTION);
String id = Objects.get(params, "id");
FileStorage.FileReadBean b = null;
try{
b = FileStorage.read(new Id(database,collection,id));
response.setContentType(b.getMeta().getContentType());
try {
IOUtils.copy(b.getInputStream(), response.getOutputStream());
} catch (IOException e) {
throw S1SystemError.wrap(e);
}
}catch (NotFoundException e) {
response.setStatus(404);
}finally {
FileStorage.closeAfterRead(b);
}
return null;
} }
|
public class class_name {
@WebOperationMethod
public Map<String,Object> download(Map<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws Exception {
String database = Objects.get(params, "database");
String collection = Objects.get(params, "collection", COLLECTION);
String id = Objects.get(params, "id");
FileStorage.FileReadBean b = null;
try{
b = FileStorage.read(new Id(database,collection,id));
response.setContentType(b.getMeta().getContentType());
try {
IOUtils.copy(b.getInputStream(), response.getOutputStream()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw S1SystemError.wrap(e);
} // depends on control dependency: [catch], data = [none]
}catch (NotFoundException e) {
response.setStatus(404);
}finally {
FileStorage.closeAfterRead(b);
}
return null;
} }
|
public class class_name {
private Object convertToArray(String pType, String pValue) {
// It's an array
String t = pType.substring(1,2);
Class valueType;
if (t.equals("L")) {
// It's an object-type
String oType = pType.substring(2,pType.length()-1).replace('/','.');
valueType = ClassUtil.classForName(oType);
if (valueType == null) {
throw new IllegalArgumentException("No class of type " + oType + "found");
}
} else {
valueType = TYPE_SIGNATURE_MAP.get(t);
if (valueType == null) {
throw new IllegalArgumentException("Cannot convert to unknown array type " + t);
}
}
String[] values = EscapeUtil.splitAsArray(pValue, EscapeUtil.PATH_ESCAPE, ",");
Object ret = Array.newInstance(valueType,values.length);
int i = 0;
for (String value : values) {
Array.set(ret,i++,value.equals("[null]") ? null : convertFromString(valueType.getCanonicalName(),value));
}
return ret;
} }
|
public class class_name {
private Object convertToArray(String pType, String pValue) {
// It's an array
String t = pType.substring(1,2);
Class valueType;
if (t.equals("L")) {
// It's an object-type
String oType = pType.substring(2,pType.length()-1).replace('/','.');
valueType = ClassUtil.classForName(oType); // depends on control dependency: [if], data = [none]
if (valueType == null) {
throw new IllegalArgumentException("No class of type " + oType + "found");
}
} else {
valueType = TYPE_SIGNATURE_MAP.get(t); // depends on control dependency: [if], data = [none]
if (valueType == null) {
throw new IllegalArgumentException("Cannot convert to unknown array type " + t);
}
}
String[] values = EscapeUtil.splitAsArray(pValue, EscapeUtil.PATH_ESCAPE, ",");
Object ret = Array.newInstance(valueType,values.length);
int i = 0;
for (String value : values) {
Array.set(ret,i++,value.equals("[null]") ? null : convertFromString(valueType.getCanonicalName(),value)); // depends on control dependency: [for], data = [value]
}
return ret;
} }
|
public class class_name {
public synchronized boolean addChangeListener(ChangeListener listener) {
if (bEnableListener && listener != null) {
eventSource.addListener(listener);
if (tc.isDebugEnabled()) {
Tr.debug(tc, "addChangeListener() cacheName=" + this.cacheName + " listener=" + eventSource.getChangeListenerCount());
}
return true;
}
return false;
} }
|
public class class_name {
public synchronized boolean addChangeListener(ChangeListener listener) {
if (bEnableListener && listener != null) {
eventSource.addListener(listener); // depends on control dependency: [if], data = [none]
if (tc.isDebugEnabled()) {
Tr.debug(tc, "addChangeListener() cacheName=" + this.cacheName + " listener=" + eventSource.getChangeListenerCount()); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public Action0 getStartAction() {
return new Action0() {
@Override
public void call() {
if (startTime == null) {
startTime = new Date().getTime();
}
}
};
} }
|
public class class_name {
public Action0 getStartAction() {
return new Action0() {
@Override
public void call() {
if (startTime == null) {
startTime = new Date().getTime(); // depends on control dependency: [if], data = [none]
}
}
};
} }
|
public class class_name {
protected String parseDescription(Throwable exception, int status) {
if (exception instanceof UnprocessableEntityException && StringUtils.isNotBlank(exception.getMessage())) {
return exception.getMessage();
}
return ErrorMessage.parseDescription(status);
} }
|
public class class_name {
protected String parseDescription(Throwable exception, int status) {
if (exception instanceof UnprocessableEntityException && StringUtils.isNotBlank(exception.getMessage())) {
return exception.getMessage(); // depends on control dependency: [if], data = [none]
}
return ErrorMessage.parseDescription(status);
} }
|
public class class_name {
protected void init() throws JspException {
// initialize OpenCms access objects
m_controller = CmsFlexController.getController(pageContext.getRequest());
m_cms = m_controller.getCmsObject();
try {
I_CmsSearchConfiguration config = null;
if (m_configFile != null) {
CmsFile configFile = m_cms.readFile(CmsJspElFunctions.convertRawResource(m_cms, m_configFile));
if (m_fileFormat == FileFormat.JSON) {
// read the JSON config file
OpenCms.getLocaleManager();
String configString = new String(
configFile.getContents(),
CmsLocaleManager.getResourceEncoding(m_cms, configFile));
config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(configString));
} else { // assume XML
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(m_cms, configFile);
config = new CmsSearchConfiguration(
new CmsXMLSearchConfigurationParser(xmlContent, m_cms.getRequestContext().getLocale()));
}
}
if (m_configString != null) {
if (m_configString.trim().startsWith("{")) {
config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(m_configString, config));
} else {
config = new CmsSearchConfiguration(
new CmsPlainQuerySearchConfigurationParser(m_configString, config));
}
}
m_searchController = new CmsSearchController(config);
String indexName = m_searchController.getCommon().getConfig().getSolrIndex();
// try to use configured index
if ((indexName != null) && !indexName.trim().isEmpty()) {
m_index = OpenCms.getSearchManager().getIndexSolr(indexName);
}
// if not successful, use the following default
if (m_index == null) {
m_index = OpenCms.getSearchManager().getIndexSolr(
m_cms.getRequestContext().getCurrentProject().isOnlineProject()
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE);
}
storeAttribute(getVar(), getSearchResults());
} catch (Exception e) { // CmsException | UnsupportedEncodingException | JSONException
LOG.error(e.getLocalizedMessage(), e);
m_controller.setThrowable(e, m_cms.getRequestContext().getUri());
throw new JspException(e);
}
} }
|
public class class_name {
protected void init() throws JspException {
// initialize OpenCms access objects
m_controller = CmsFlexController.getController(pageContext.getRequest());
m_cms = m_controller.getCmsObject();
try {
I_CmsSearchConfiguration config = null;
if (m_configFile != null) {
CmsFile configFile = m_cms.readFile(CmsJspElFunctions.convertRawResource(m_cms, m_configFile));
if (m_fileFormat == FileFormat.JSON) {
// read the JSON config file
OpenCms.getLocaleManager(); // depends on control dependency: [if], data = [none]
String configString = new String(
configFile.getContents(),
CmsLocaleManager.getResourceEncoding(m_cms, configFile));
config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(configString)); // depends on control dependency: [if], data = [none]
} else { // assume XML
CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(m_cms, configFile);
config = new CmsSearchConfiguration(
new CmsXMLSearchConfigurationParser(xmlContent, m_cms.getRequestContext().getLocale())); // depends on control dependency: [if], data = [none]
}
}
if (m_configString != null) {
if (m_configString.trim().startsWith("{")) {
config = new CmsSearchConfiguration(new CmsJSONSearchConfigurationParser(m_configString, config)); // depends on control dependency: [if], data = [none]
} else {
config = new CmsSearchConfiguration(
new CmsPlainQuerySearchConfigurationParser(m_configString, config)); // depends on control dependency: [if], data = [none]
}
}
m_searchController = new CmsSearchController(config);
String indexName = m_searchController.getCommon().getConfig().getSolrIndex();
// try to use configured index
if ((indexName != null) && !indexName.trim().isEmpty()) {
m_index = OpenCms.getSearchManager().getIndexSolr(indexName); // depends on control dependency: [if], data = [none]
}
// if not successful, use the following default
if (m_index == null) {
m_index = OpenCms.getSearchManager().getIndexSolr(
m_cms.getRequestContext().getCurrentProject().isOnlineProject()
? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE
: CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE); // depends on control dependency: [if], data = [none]
}
storeAttribute(getVar(), getSearchResults());
} catch (Exception e) { // CmsException | UnsupportedEncodingException | JSONException
LOG.error(e.getLocalizedMessage(), e);
m_controller.setThrowable(e, m_cms.getRequestContext().getUri());
throw new JspException(e);
}
} }
|
public class class_name {
public void marshall(DescribeCertificateRequest describeCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (describeCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeCertificateRequest.getCertificateId(), CERTIFICATEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeCertificateRequest describeCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (describeCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeCertificateRequest.getCertificateId(), CERTIFICATEID_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 <E extends ClassMember> int compare(E lhs, E rhs) {
int cmp;
cmp = lhs.getClassName().compareTo(rhs.getClassName());
if (cmp != 0) {
return cmp;
}
cmp = lhs.getName().compareTo(rhs.getName());
if (cmp != 0) {
return cmp;
}
cmp = lhs.getSignature().compareTo(rhs.getSignature());
if (cmp != 0) {
return cmp;
}
return (lhs.isStatic() ? 1 : 0) - (rhs.isStatic() ? 1 : 0);
} }
|
public class class_name {
public static <E extends ClassMember> int compare(E lhs, E rhs) {
int cmp;
cmp = lhs.getClassName().compareTo(rhs.getClassName());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
cmp = lhs.getName().compareTo(rhs.getName());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
cmp = lhs.getSignature().compareTo(rhs.getSignature());
if (cmp != 0) {
return cmp; // depends on control dependency: [if], data = [none]
}
return (lhs.isStatic() ? 1 : 0) - (rhs.isStatic() ? 1 : 0);
} }
|
public class class_name {
protected void setFileFilter()
{
String[] extensions = m_model.getExtensions();
for (String extension : extensions)
{
m_fileChooser.setFileFilter(new FileNameExtensionFilter(extension.toUpperCase() + " Files", extension));
}
m_fileChooser.setFileFilter(new FileNameExtensionFilter("Project Files", m_model.getExtensions()));
} }
|
public class class_name {
protected void setFileFilter()
{
String[] extensions = m_model.getExtensions();
for (String extension : extensions)
{
m_fileChooser.setFileFilter(new FileNameExtensionFilter(extension.toUpperCase() + " Files", extension)); // depends on control dependency: [for], data = [extension]
}
m_fileChooser.setFileFilter(new FileNameExtensionFilter("Project Files", m_model.getExtensions()));
} }
|
public class class_name {
public Integer getBlockMaskPrefixLength(boolean network) {
int hostLength = getTrailingBitCount(network);
long shifted;
if(network) {
shifted = (~getDivisionValue() & getMaxValue()) >>> hostLength;
} else {
shifted = getDivisionValue() >>> hostLength;
}
return shifted == 0 ? getBitCount() - hostLength : null;
} }
|
public class class_name {
public Integer getBlockMaskPrefixLength(boolean network) {
int hostLength = getTrailingBitCount(network);
long shifted;
if(network) {
shifted = (~getDivisionValue() & getMaxValue()) >>> hostLength; // depends on control dependency: [if], data = [none]
} else {
shifted = getDivisionValue() >>> hostLength; // depends on control dependency: [if], data = [none]
}
return shifted == 0 ? getBitCount() - hostLength : null;
} }
|
public class class_name {
private void replaceArrayPattern(
NodeTraversal t, Node arrayPattern, Node rhs, Node parent, Node nodeToDetach) {
if (rewriteMode == ObjectDestructuringRewriteMode.REWRITE_OBJECT_REST) {
if (patternNestingStack.isEmpty() || !patternNestingStack.peekLast().hasNestedObjectRest) {
return;
}
}
String tempVarName = getTempVariableName();
Node makeIteratorCall = astFactory.createJSCompMakeIteratorCall(rhs.detach(), t.getScope());
Node tempVarModel = astFactory.createName(tempVarName, makeIteratorCall.getJSType());
Node tempDecl = IR.var(tempVarModel.cloneNode(), makeIteratorCall);
tempDecl.useSourceInfoIfMissingFromForTree(arrayPattern);
nodeToDetach.getParent().addChildBefore(tempDecl, nodeToDetach);
for (Node child = arrayPattern.getFirstChild(), next; child != null; child = next) {
next = child.getNext();
if (child.isEmpty()) {
// Just call the next() method to advance the iterator, but throw away the value.
Node nextCall =
IR.exprResult(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")));
nextCall.useSourceInfoIfMissingFromForTree(child);
nodeToDetach.getParent().addChildBefore(nextCall, nodeToDetach);
continue;
}
Node newLHS;
Node newRHS;
if (child.isDefaultValue()) {
// [x = defaultValue] = rhs;
// becomes
// var temp0 = $jscomp.makeIterator(rhs);
// var temp1 = temp.next().value
// x = (temp1 === undefined) ? defaultValue : temp1;
String nextVarName = getTempVariableName();
// `temp.next().value`
Node nextCallDotValue =
astFactory.createGetProp(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
"value");
JSType nextVarType = nextCallDotValue.getJSType();
// `var temp1 = temp.next().value`
Node var = IR.var(astFactory.createName(nextVarName, nextVarType), nextCallDotValue);
var.useSourceInfoIfMissingFromForTree(child);
nodeToDetach.getParent().addChildBefore(var, nodeToDetach);
// `x`
newLHS = child.getFirstChild().detach();
// `(temp1 === undefined) ? defaultValue : temp1;
newRHS =
defaultValueHook(
astFactory.createName(nextVarName, nextVarType), child.getLastChild().detach());
} else if (child.isRest()) {
// [...x] = rhs;
// becomes
// var temp = $jscomp.makeIterator(rhs);
// x = $jscomp.arrayFromIterator(temp);
newLHS = child.getFirstChild().detach();
newRHS =
astFactory.createJscompArrayFromIteratorCall(tempVarModel.cloneNode(), t.getScope());
} else {
// LHS is just a name (or a nested pattern).
// var [x] = rhs;
// becomes
// var temp = $jscomp.makeIterator(rhs);
// var x = temp.next().value;
newLHS = child.detach();
newRHS =
astFactory.createGetProp(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
"value");
}
Node newNode;
if (parent.isAssign()) {
Node assignment = astFactory.createAssign(newLHS, newRHS);
newNode = IR.exprResult(assignment);
} else {
newNode = IR.declaration(newLHS, newRHS, parent.getToken());
}
newNode.useSourceInfoIfMissingFromForTree(arrayPattern);
nodeToDetach.getParent().addChildBefore(newNode, nodeToDetach);
// Explicitly visit the LHS of the new node since it may be a nested
// destructuring pattern.
visit(t, newLHS, newLHS.getParent());
}
nodeToDetach.detach();
t.reportCodeChange();
} }
|
public class class_name {
private void replaceArrayPattern(
NodeTraversal t, Node arrayPattern, Node rhs, Node parent, Node nodeToDetach) {
if (rewriteMode == ObjectDestructuringRewriteMode.REWRITE_OBJECT_REST) {
if (patternNestingStack.isEmpty() || !patternNestingStack.peekLast().hasNestedObjectRest) {
return; // depends on control dependency: [if], data = [none]
}
}
String tempVarName = getTempVariableName();
Node makeIteratorCall = astFactory.createJSCompMakeIteratorCall(rhs.detach(), t.getScope());
Node tempVarModel = astFactory.createName(tempVarName, makeIteratorCall.getJSType());
Node tempDecl = IR.var(tempVarModel.cloneNode(), makeIteratorCall);
tempDecl.useSourceInfoIfMissingFromForTree(arrayPattern);
nodeToDetach.getParent().addChildBefore(tempDecl, nodeToDetach);
for (Node child = arrayPattern.getFirstChild(), next; child != null; child = next) {
next = child.getNext(); // depends on control dependency: [for], data = [child]
if (child.isEmpty()) {
// Just call the next() method to advance the iterator, but throw away the value.
Node nextCall =
IR.exprResult(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")));
nextCall.useSourceInfoIfMissingFromForTree(child); // depends on control dependency: [if], data = [none]
nodeToDetach.getParent().addChildBefore(nextCall, nodeToDetach); // depends on control dependency: [if], data = [none]
continue;
}
Node newLHS;
Node newRHS;
if (child.isDefaultValue()) {
// [x = defaultValue] = rhs;
// becomes
// var temp0 = $jscomp.makeIterator(rhs);
// var temp1 = temp.next().value
// x = (temp1 === undefined) ? defaultValue : temp1;
String nextVarName = getTempVariableName();
// `temp.next().value`
Node nextCallDotValue =
astFactory.createGetProp(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
"value");
JSType nextVarType = nextCallDotValue.getJSType();
// `var temp1 = temp.next().value`
Node var = IR.var(astFactory.createName(nextVarName, nextVarType), nextCallDotValue);
var.useSourceInfoIfMissingFromForTree(child); // depends on control dependency: [if], data = [none]
nodeToDetach.getParent().addChildBefore(var, nodeToDetach); // depends on control dependency: [if], data = [none]
// `x`
newLHS = child.getFirstChild().detach(); // depends on control dependency: [if], data = [none]
// `(temp1 === undefined) ? defaultValue : temp1;
newRHS =
defaultValueHook(
astFactory.createName(nextVarName, nextVarType), child.getLastChild().detach()); // depends on control dependency: [if], data = [none]
} else if (child.isRest()) {
// [...x] = rhs;
// becomes
// var temp = $jscomp.makeIterator(rhs);
// x = $jscomp.arrayFromIterator(temp);
newLHS = child.getFirstChild().detach(); // depends on control dependency: [if], data = [none]
newRHS =
astFactory.createJscompArrayFromIteratorCall(tempVarModel.cloneNode(), t.getScope()); // depends on control dependency: [if], data = [none]
} else {
// LHS is just a name (or a nested pattern).
// var [x] = rhs;
// becomes
// var temp = $jscomp.makeIterator(rhs);
// var x = temp.next().value;
newLHS = child.detach(); // depends on control dependency: [if], data = [none]
newRHS =
astFactory.createGetProp(
astFactory.createCall(astFactory.createGetProp(tempVarModel.cloneNode(), "next")),
"value"); // depends on control dependency: [if], data = [none]
}
Node newNode;
if (parent.isAssign()) {
Node assignment = astFactory.createAssign(newLHS, newRHS);
newNode = IR.exprResult(assignment); // depends on control dependency: [if], data = [none]
} else {
newNode = IR.declaration(newLHS, newRHS, parent.getToken()); // depends on control dependency: [if], data = [none]
}
newNode.useSourceInfoIfMissingFromForTree(arrayPattern); // depends on control dependency: [for], data = [none]
nodeToDetach.getParent().addChildBefore(newNode, nodeToDetach); // depends on control dependency: [for], data = [none]
// Explicitly visit the LHS of the new node since it may be a nested
// destructuring pattern.
visit(t, newLHS, newLHS.getParent()); // depends on control dependency: [for], data = [none]
}
nodeToDetach.detach();
t.reportCodeChange();
} }
|
public class class_name {
public static final XResourceBundle loadResourceBundle(
String className, Locale locale) throws MissingResourceException
{
String suffix = getResourceSuffix(locale);
//System.out.println("resource " + className + suffix);
try
{
// first try with the given locale
String resourceName = className + suffix;
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
}
catch (MissingResourceException e)
{
try // try to fall back to en_US if we can't load
{
// Since we can't find the localized property file,
// fall back to en_US.
return (XResourceBundle) ResourceBundle.getBundle(
XSLT_RESOURCE, new Locale("en", "US"));
}
catch (MissingResourceException e2)
{
// Now we are really in trouble.
// very bad, definitely very bad...not going to get very far
throw new MissingResourceException(
"Could not load any resource bundles.", className, "");
}
}
} }
|
public class class_name {
public static final XResourceBundle loadResourceBundle(
String className, Locale locale) throws MissingResourceException
{
String suffix = getResourceSuffix(locale);
//System.out.println("resource " + className + suffix);
try
{
// first try with the given locale
String resourceName = className + suffix;
return (XResourceBundle) ResourceBundle.getBundle(resourceName, locale);
}
catch (MissingResourceException e)
{
try // try to fall back to en_US if we can't load
{
// Since we can't find the localized property file,
// fall back to en_US.
return (XResourceBundle) ResourceBundle.getBundle(
XSLT_RESOURCE, new Locale("en", "US")); // depends on control dependency: [try], data = [none]
}
catch (MissingResourceException e2)
{
// Now we are really in trouble.
// very bad, definitely very bad...not going to get very far
throw new MissingResourceException(
"Could not load any resource bundles.", className, "");
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public GeneralEmail cc(String cc) {
if (cc != null && cc.length() > 0) {
cc(cc.split(";"));
} else {
return addParameter("cc", null);
}
return getThis();
} }
|
public class class_name {
public GeneralEmail cc(String cc) {
if (cc != null && cc.length() > 0) {
cc(cc.split(";")); // depends on control dependency: [if], data = [(cc]
} else {
return addParameter("cc", null); // depends on control dependency: [if], data = [none]
}
return getThis();
} }
|
public class class_name {
public synchronized static String installedVersion() {
BufferedReader versionReader = null;
try {
versionReader = new BufferedReader(new FileReader(BMP_LOCAL_VERSION_FILE));
// Read version and verify it's there
String version = versionReader.readLine();
if (null == version) throw new Exception();
return version;
} catch(Exception e) {
throw new BMPCLocalNotInstalledException(
"Version file not found: " + BMP_LOCAL_VERSION_FILE);
} finally {
try {
if (null != versionReader) versionReader.close();
} catch (IOException e) {
// Do nothing here
}
}
} }
|
public class class_name {
public synchronized static String installedVersion() {
BufferedReader versionReader = null;
try {
versionReader = new BufferedReader(new FileReader(BMP_LOCAL_VERSION_FILE)); // depends on control dependency: [try], data = [none]
// Read version and verify it's there
String version = versionReader.readLine();
if (null == version) throw new Exception();
return version; // depends on control dependency: [try], data = [none]
} catch(Exception e) {
throw new BMPCLocalNotInstalledException(
"Version file not found: " + BMP_LOCAL_VERSION_FILE);
} finally { // depends on control dependency: [catch], data = [none]
try {
if (null != versionReader) versionReader.close();
} catch (IOException e) {
// Do nothing here
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public S timeout(long timeout, TemporalUnit timeoutUnit) {
if (0 > timeout) {
this.timeout = null;
} else {
this.timeout = Duration.of(timeout, timeoutUnit);
}
return self();
} }
|
public class class_name {
public S timeout(long timeout, TemporalUnit timeoutUnit) {
if (0 > timeout) {
this.timeout = null; // depends on control dependency: [if], data = [none]
} else {
this.timeout = Duration.of(timeout, timeoutUnit); // depends on control dependency: [if], data = [none]
}
return self();
} }
|
public class class_name {
private boolean dispatchWorker(Worker worker) {
ExecutorService executorService = CHFWBundle.getExecutorService();
if (null == executorService) {
if (FrameworkState.isValid()) {
Tr.error(tc, "EXECUTOR_SVC_MISSING");
throw new RuntimeException("Missing executor service");
} else {
// The framework is shutting down: the executor service may be
// missing by the time the async work is dispatched.
return false;
}
}
executorService.execute(worker);
return true;
} }
|
public class class_name {
private boolean dispatchWorker(Worker worker) {
ExecutorService executorService = CHFWBundle.getExecutorService();
if (null == executorService) {
if (FrameworkState.isValid()) {
Tr.error(tc, "EXECUTOR_SVC_MISSING"); // depends on control dependency: [if], data = [none]
throw new RuntimeException("Missing executor service");
} else {
// The framework is shutting down: the executor service may be
// missing by the time the async work is dispatched.
return false; // depends on control dependency: [if], data = [none]
}
}
executorService.execute(worker);
return true;
} }
|
public class class_name {
@Override
public List<ValidationError> validateWithErrors(File f) {
List<SAXParseException> saxErrors;
try {
saxErrors = xv.validateWithErrors(f);
} catch (SAXParseException e) {
final String name = e.getSystemId();
final String msg = e.getMessage();
final int line = e.getLineNumber();
final int column = e.getColumnNumber();
return asList(new ValidationError(name, msg, e, line, column));
} catch (SAXException e) {
final String name = f.toString();
final String msg = e.getMessage();
return asList(new ValidationError(name, msg, e, -1, -1));
} catch (IOException e) {
final String name = f.toString();
final String msg = e.getMessage();
return asList(new ValidationError(name, msg, e, -1, -1));
}
List<ValidationError> ret = sizedArrayList(saxErrors.size());
for (final SAXParseException saxError : saxErrors) {
final String name = saxError.getSystemId();
final String msg = saxError.getMessage();
final int line = saxError.getLineNumber();
final int column = saxError.getColumnNumber();
ret.add(new ValidationError(name, msg, saxError, line, column));
}
return ret;
} }
|
public class class_name {
@Override
public List<ValidationError> validateWithErrors(File f) {
List<SAXParseException> saxErrors;
try {
saxErrors = xv.validateWithErrors(f); // depends on control dependency: [try], data = [none]
} catch (SAXParseException e) {
final String name = e.getSystemId();
final String msg = e.getMessage();
final int line = e.getLineNumber();
final int column = e.getColumnNumber();
return asList(new ValidationError(name, msg, e, line, column));
} catch (SAXException e) { // depends on control dependency: [catch], data = [none]
final String name = f.toString();
final String msg = e.getMessage();
return asList(new ValidationError(name, msg, e, -1, -1));
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
final String name = f.toString();
final String msg = e.getMessage();
return asList(new ValidationError(name, msg, e, -1, -1));
} // depends on control dependency: [catch], data = [none]
List<ValidationError> ret = sizedArrayList(saxErrors.size());
for (final SAXParseException saxError : saxErrors) {
final String name = saxError.getSystemId();
final String msg = saxError.getMessage();
final int line = saxError.getLineNumber();
final int column = saxError.getColumnNumber();
ret.add(new ValidationError(name, msg, saxError, line, column)); // depends on control dependency: [for], data = [saxError]
}
return ret;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.