code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public CharSequence readSource(JavaFileObject filename) {
try {
inputFiles.add(filename);
return filename.getCharContent(false);
} catch (IOException e) {
log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
return null;
}
} } | public class class_name {
public CharSequence readSource(JavaFileObject filename) {
try {
inputFiles.add(filename); // depends on control dependency: [try], data = [none]
return filename.getCharContent(false); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.error("error.reading.file", filename, JavacFileManager.getMessage(e));
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public SDVariable[] generateOutputVariableForOp(DifferentialFunction function, String baseName, boolean isImport) {
//xyz ops only have 1 output
//if there is already a base name defined, use that
if (baseName == null || baseName.isEmpty() && getBaseNameForFunction(function) != null)
baseName = getBaseNameForFunction(function);
if (baseName == null)
baseName = function.opName();
//First: calculate output data types. We can always calculate output data types, even if the input arrays
//are not available - *except for sometimes during import, until all ops/variables have been added*
List<org.nd4j.linalg.api.buffer.DataType> outputDataTypes = null;
if(!isImport) {
List<org.nd4j.linalg.api.buffer.DataType> inputDataTypes = new ArrayList<>();
List<String> fnInputs = ops.get(function.getOwnName()).getInputsToOp();
if (fnInputs != null) {
for (String var : fnInputs) {
inputDataTypes.add(variables.get(var).getVariable().dataType());
}
}
outputDataTypes = function.calculateOutputDataTypes(inputDataTypes);
}
val outputShape = function.calculateOutputShape();
if (outputShape == null || outputShape.isEmpty()) {
if (function instanceof CustomOp) {
CustomOp customOp = (CustomOp) function;
//can't guess number of outputs, variable
int num_outputs = function.getNumOutputs(); //Use this in preference - if set. Descriptor might specify 2, but it can sometimes be 2+
if (num_outputs <= 0) {
val descriptor = customOp.getDescriptor();
if (descriptor != null) {
num_outputs = descriptor.getNumOutputs();
}
if (num_outputs <= 0) {
throw new ND4UnresolvedOutputVariables("Could not determine number of output variables for op "
+ function.getOwnName() + " - " + function.getClass().getSimpleName() + ". Ops can override" +
" getNumOutputs() to specify number of outputs if required");
}
}
char ordering = 'c';
SDVariable[] args = function.args();
if (args != null && args.length > 0 && args[0].getArr() != null) { //Args may be null or length 0 for some ops, like eye
ordering = function.args()[0].getArr().ordering();
}
SDVariable[] ret = new SDVariable[num_outputs];
//Infer the output types: we can always determine datatype but not always shapes
Preconditions.checkState(isImport || num_outputs == 0 || (outputDataTypes != null && outputDataTypes.size() == num_outputs),
"Incorrect number of output datatypes: got %s but expected datatypes for %s outputs - %s (op: %s)",
(outputDataTypes == null ? null : outputDataTypes.size()), num_outputs, outputDataTypes, function.getClass().getSimpleName());
//dynamic shapes
//When importing from TF: convention is "unstack", "unstack:1", "unstack:2", ...
for (int i = 0; i < ret.length; i++) {
SDVariable var = (i == 0 ? getVariable(baseName) : getVariable(baseName + ":" + i));
if (var == null) {
//Generate new variable name if one with the specified name doesn't exist
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = isImport ? null : outputDataTypes.get(i);
var = var(generateNewVarName(baseName, i), VariableType.ARRAY, null, dataType, (long[])null);
}
var.setOutputIndex(i);
var.setCreator(function);
ret[i] = var;
}
//Update the internal state: outgoing variables for function
if (getOutputsForFunction(function) == null)
addOutgoingFor(ret, function);
return ret;
}
//this is for unresolved shapes, we know xyz is always 1 output
else if (function instanceof BaseOp && outputShape.isEmpty()) {
SDVariable[] ret = new SDVariable[1];
SDVariable checkGet = getVariable(baseName);
char ordering = 'c';
SDVariable[] args = function.args();
if (args != null && args.length > 0 && function.args()[0].getArr() != null) { //Args may be null or length 0 for some ops, like eye
ordering = function.args()[0].getArr().ordering();
}
if (checkGet == null) {
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = outputDataTypes.get(0);
checkGet = var(baseName, VariableType.ARRAY, null, dataType, (long[])null);
}
if (checkGet == null) {
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = outputDataTypes.get(0);
checkGet = var(baseName, VariableType.ARRAY, null, dataType, (long[])null);
}
checkGet.setOutputIndex(0);
checkGet.setCreator(function);
ret[0] = checkGet;
//Update the internal state: outgoing variables for function
if (getOutputsForFunction(function) == null)
addOutgoingFor(ret, function);
return ret;
}
}
//Check that output shapes and output dtypes actually match (they should)
if(!isImport) {
for (int i = 0; i < outputShape.size(); i++) {
org.nd4j.linalg.api.buffer.DataType shapeDataType = outputShape.get(i).dataType();
org.nd4j.linalg.api.buffer.DataType calcType = outputDataTypes.get(i);
Preconditions.checkState(calcType == shapeDataType, "Calculated output data types do not match for shape calculation vs. datatype calculation:" +
" %s vs %s for op %s output %s", shapeDataType, calcType, function.getClass().getName(), i);
}
}
char ordering = 'c';
if (function.args() != null && function.args().length > 0 && function.args()[0].getArr() != null) {
ordering = function.args()[0].getArr().ordering();
}
SDVariable[] ret = new SDVariable[outputShape.size()];
// ownName/baseName will be used to get variables names
val ownName = function.getOwnName();
val rootName = baseName;
for (int i = 0; i < ret.length; i++) {
LongShapeDescriptor shape = outputShape.get(i);
// it should be: rootName:index. i.e.: split:1, split:2, split:3, split:4 etc
baseName = rootName + (i > 0 ? ":" + i : "");
SDVariable checkGet = getVariable(baseName);
if (checkGet == null) {
// obviously - there's no such var, just add it
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
checkGet = var(baseName, VariableType.ARRAY, null, shape.dataType(), shape.getShape());
} else if (shape != null && !shapeAlreadyExistsForVarName(checkGet.getVarName())) {
// var exists, let's update its shape
putShapeForVarName(checkGet.getVarName(), shape);
} else if (shape != null && shapeAlreadyExistsForVarName(checkGet.getVarName())) {
// no-op.
// TODO: maybe we should check shapes equality here?
// it's either var that already exist, or something bad happening
}
if (checkGet == null) {
org.nd4j.linalg.api.buffer.DataType dataType = org.nd4j.linalg.api.buffer.DataType.FLOAT; //TODO FIX THIS
checkGet = var(baseName + (i > 0 ? ":" + i : ""), new ZeroInitScheme(ordering), dataType, shape.getShape());
}
checkGet.setOutputIndex(i);
checkGet.setCreator(function);
ret[i] = checkGet;
}
return ret;
} } | public class class_name {
public SDVariable[] generateOutputVariableForOp(DifferentialFunction function, String baseName, boolean isImport) {
//xyz ops only have 1 output
//if there is already a base name defined, use that
if (baseName == null || baseName.isEmpty() && getBaseNameForFunction(function) != null)
baseName = getBaseNameForFunction(function);
if (baseName == null)
baseName = function.opName();
//First: calculate output data types. We can always calculate output data types, even if the input arrays
//are not available - *except for sometimes during import, until all ops/variables have been added*
List<org.nd4j.linalg.api.buffer.DataType> outputDataTypes = null;
if(!isImport) {
List<org.nd4j.linalg.api.buffer.DataType> inputDataTypes = new ArrayList<>();
List<String> fnInputs = ops.get(function.getOwnName()).getInputsToOp();
if (fnInputs != null) {
for (String var : fnInputs) {
inputDataTypes.add(variables.get(var).getVariable().dataType()); // depends on control dependency: [for], data = [var]
}
}
outputDataTypes = function.calculateOutputDataTypes(inputDataTypes); // depends on control dependency: [if], data = [none]
}
val outputShape = function.calculateOutputShape();
if (outputShape == null || outputShape.isEmpty()) {
if (function instanceof CustomOp) {
CustomOp customOp = (CustomOp) function;
//can't guess number of outputs, variable
int num_outputs = function.getNumOutputs(); //Use this in preference - if set. Descriptor might specify 2, but it can sometimes be 2+
if (num_outputs <= 0) {
val descriptor = customOp.getDescriptor();
if (descriptor != null) {
num_outputs = descriptor.getNumOutputs(); // depends on control dependency: [if], data = [none]
}
if (num_outputs <= 0) {
throw new ND4UnresolvedOutputVariables("Could not determine number of output variables for op "
+ function.getOwnName() + " - " + function.getClass().getSimpleName() + ". Ops can override" +
" getNumOutputs() to specify number of outputs if required");
}
}
char ordering = 'c';
SDVariable[] args = function.args();
if (args != null && args.length > 0 && args[0].getArr() != null) { //Args may be null or length 0 for some ops, like eye
ordering = function.args()[0].getArr().ordering(); // depends on control dependency: [if], data = [none]
}
SDVariable[] ret = new SDVariable[num_outputs];
//Infer the output types: we can always determine datatype but not always shapes
Preconditions.checkState(isImport || num_outputs == 0 || (outputDataTypes != null && outputDataTypes.size() == num_outputs),
"Incorrect number of output datatypes: got %s but expected datatypes for %s outputs - %s (op: %s)",
(outputDataTypes == null ? null : outputDataTypes.size()), num_outputs, outputDataTypes, function.getClass().getSimpleName()); // depends on control dependency: [if], data = [none]
//dynamic shapes
//When importing from TF: convention is "unstack", "unstack:1", "unstack:2", ...
for (int i = 0; i < ret.length; i++) {
SDVariable var = (i == 0 ? getVariable(baseName) : getVariable(baseName + ":" + i));
if (var == null) {
//Generate new variable name if one with the specified name doesn't exist
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = isImport ? null : outputDataTypes.get(i);
var = var(generateNewVarName(baseName, i), VariableType.ARRAY, null, dataType, (long[])null); // depends on control dependency: [if], data = [null)]
}
var.setOutputIndex(i); // depends on control dependency: [for], data = [i]
var.setCreator(function); // depends on control dependency: [for], data = [none]
ret[i] = var; // depends on control dependency: [for], data = [i]
}
//Update the internal state: outgoing variables for function
if (getOutputsForFunction(function) == null)
addOutgoingFor(ret, function);
return ret; // depends on control dependency: [if], data = [none]
}
//this is for unresolved shapes, we know xyz is always 1 output
else if (function instanceof BaseOp && outputShape.isEmpty()) {
SDVariable[] ret = new SDVariable[1];
SDVariable checkGet = getVariable(baseName);
char ordering = 'c';
SDVariable[] args = function.args();
if (args != null && args.length > 0 && function.args()[0].getArr() != null) { //Args may be null or length 0 for some ops, like eye
ordering = function.args()[0].getArr().ordering(); // depends on control dependency: [if], data = [none]
}
if (checkGet == null) {
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = outputDataTypes.get(0);
checkGet = var(baseName, VariableType.ARRAY, null, dataType, (long[])null); // depends on control dependency: [if], data = [null)]
}
if (checkGet == null) {
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
org.nd4j.linalg.api.buffer.DataType dataType = outputDataTypes.get(0);
checkGet = var(baseName, VariableType.ARRAY, null, dataType, (long[])null); // depends on control dependency: [if], data = [null)]
}
checkGet.setOutputIndex(0); // depends on control dependency: [if], data = [none]
checkGet.setCreator(function); // depends on control dependency: [if], data = [none]
ret[0] = checkGet; // depends on control dependency: [if], data = [none]
//Update the internal state: outgoing variables for function
if (getOutputsForFunction(function) == null)
addOutgoingFor(ret, function);
return ret; // depends on control dependency: [if], data = [none]
}
}
//Check that output shapes and output dtypes actually match (they should)
if(!isImport) {
for (int i = 0; i < outputShape.size(); i++) {
org.nd4j.linalg.api.buffer.DataType shapeDataType = outputShape.get(i).dataType();
org.nd4j.linalg.api.buffer.DataType calcType = outputDataTypes.get(i);
Preconditions.checkState(calcType == shapeDataType, "Calculated output data types do not match for shape calculation vs. datatype calculation:" +
" %s vs %s for op %s output %s", shapeDataType, calcType, function.getClass().getName(), i); // depends on control dependency: [for], data = [none]
}
}
char ordering = 'c';
if (function.args() != null && function.args().length > 0 && function.args()[0].getArr() != null) {
ordering = function.args()[0].getArr().ordering(); // depends on control dependency: [if], data = [none]
}
SDVariable[] ret = new SDVariable[outputShape.size()];
// ownName/baseName will be used to get variables names
val ownName = function.getOwnName();
val rootName = baseName;
for (int i = 0; i < ret.length; i++) {
LongShapeDescriptor shape = outputShape.get(i);
// it should be: rootName:index. i.e.: split:1, split:2, split:3, split:4 etc
baseName = rootName + (i > 0 ? ":" + i : ""); // depends on control dependency: [for], data = [i]
SDVariable checkGet = getVariable(baseName);
if (checkGet == null) {
// obviously - there's no such var, just add it
//Note: output of an op is ARRAY type - activations, not a trainable parameter. Thus has no weight init scheme
checkGet = var(baseName, VariableType.ARRAY, null, shape.dataType(), shape.getShape()); // depends on control dependency: [if], data = [none]
} else if (shape != null && !shapeAlreadyExistsForVarName(checkGet.getVarName())) {
// var exists, let's update its shape
putShapeForVarName(checkGet.getVarName(), shape); // depends on control dependency: [if], data = [none]
} else if (shape != null && shapeAlreadyExistsForVarName(checkGet.getVarName())) {
// no-op.
// TODO: maybe we should check shapes equality here?
// it's either var that already exist, or something bad happening
}
if (checkGet == null) {
org.nd4j.linalg.api.buffer.DataType dataType = org.nd4j.linalg.api.buffer.DataType.FLOAT; //TODO FIX THIS
checkGet = var(baseName + (i > 0 ? ":" + i : ""), new ZeroInitScheme(ordering), dataType, shape.getShape()); // depends on control dependency: [if], data = [none]
}
checkGet.setOutputIndex(i); // depends on control dependency: [for], data = [i]
checkGet.setCreator(function); // depends on control dependency: [for], data = [none]
ret[i] = checkGet; // depends on control dependency: [for], data = [i]
}
return ret;
} } |
public class class_name {
protected void repaint(final int ms, final Rectangle bounds)
{
if (container != null)
{
container.repaint(ms, bounds.x, bounds.y, bounds.width, bounds.height);
}
} } | public class class_name {
protected void repaint(final int ms, final Rectangle bounds)
{
if (container != null)
{
container.repaint(ms, bounds.x, bounds.y, bounds.width, bounds.height); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void invokeWriteMethodOptional(
Object bean, String propertyName, Object value)
{
Class<?> c = bean.getClass();
Method method = getWriteMethodOptional(c, propertyName);
if (method != null)
{
Methods.invokeOptional(method, bean, value);
}
} } | public class class_name {
public static void invokeWriteMethodOptional(
Object bean, String propertyName, Object value)
{
Class<?> c = bean.getClass();
Method method = getWriteMethodOptional(c, propertyName);
if (method != null)
{
Methods.invokeOptional(method, bean, value);
// depends on control dependency: [if], data = [(method]
}
} } |
public class class_name {
public static Object getPrimitiveDefaultValue(final Class<?> type) {
Objects.requireNonNull(type, "type should not be null.");
if(!type.isPrimitive()) {
return null;
} else if(boolean.class.isAssignableFrom(type)) {
return false;
} else if(char.class.isAssignableFrom(type)) {
return '\u0000';
} else if(byte.class.isAssignableFrom(type)) {
return (byte)0;
} else if(short.class.isAssignableFrom(type)) {
return (short)0;
} else if(int.class.isAssignableFrom(type)) {
return 0;
} else if(long.class.isAssignableFrom(type)) {
return 0l;
} else if(float.class.isAssignableFrom(type)) {
return 0.0f;
} else if(double.class.isAssignableFrom(type)) {
return 0.0d;
}
return null;
} } | public class class_name {
public static Object getPrimitiveDefaultValue(final Class<?> type) {
Objects.requireNonNull(type, "type should not be null.");
if(!type.isPrimitive()) {
return null;
// depends on control dependency: [if], data = [none]
} else if(boolean.class.isAssignableFrom(type)) {
return false;
// depends on control dependency: [if], data = [none]
} else if(char.class.isAssignableFrom(type)) {
return '\u0000';
// depends on control dependency: [if], data = [none]
} else if(byte.class.isAssignableFrom(type)) {
return (byte)0;
// depends on control dependency: [if], data = [none]
} else if(short.class.isAssignableFrom(type)) {
return (short)0;
// depends on control dependency: [if], data = [none]
} else if(int.class.isAssignableFrom(type)) {
return 0;
// depends on control dependency: [if], data = [none]
} else if(long.class.isAssignableFrom(type)) {
return 0l;
// depends on control dependency: [if], data = [none]
} else if(float.class.isAssignableFrom(type)) {
return 0.0f;
// depends on control dependency: [if], data = [none]
} else if(double.class.isAssignableFrom(type)) {
return 0.0d;
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public GoogleMapShapeMarkers addShapeToMapAsMarkers(GoogleMap map,
GoogleMapShape shape, MarkerOptions markerOptions,
MarkerOptions polylineMarkerOptions,
MarkerOptions polygonMarkerOptions,
MarkerOptions polygonMarkerHoleOptions,
PolylineOptions globalPolylineOptions,
PolygonOptions globalPolygonOptions) {
GoogleMapShapeMarkers shapeMarkers = new GoogleMapShapeMarkers();
GoogleMapShape addedShape = null;
switch (shape.getShapeType()) {
case LAT_LNG:
if (markerOptions == null) {
markerOptions = new MarkerOptions();
}
Marker latLngMarker = addLatLngToMap(map,
(LatLng) shape.getShape(), markerOptions);
shapeMarkers.add(latLngMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MARKER, latLngMarker);
break;
case MARKER_OPTIONS:
MarkerOptions shapeMarkerOptions = (MarkerOptions) shape.getShape();
if (markerOptions != null) {
shapeMarkerOptions.icon(markerOptions.getIcon());
shapeMarkerOptions.anchor(markerOptions.getAnchorU(),
markerOptions.getAnchorV());
shapeMarkerOptions.draggable(markerOptions.isDraggable());
shapeMarkerOptions.visible(markerOptions.isVisible());
shapeMarkerOptions.zIndex(markerOptions.getZIndex());
}
Marker markerOptionsMarker = addMarkerOptionsToMap(map,
shapeMarkerOptions);
shapeMarkers.add(markerOptionsMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MARKER, markerOptionsMarker);
break;
case POLYLINE_OPTIONS:
PolylineMarkers polylineMarkers = addPolylineToMapAsMarkers(map,
(PolylineOptions) shape.getShape(), polylineMarkerOptions,
globalPolylineOptions);
shapeMarkers.add(polylineMarkers);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.POLYLINE_MARKERS, polylineMarkers);
break;
case POLYGON_OPTIONS:
PolygonMarkers polygonMarkers = addPolygonToMapAsMarkers(
shapeMarkers, map, (PolygonOptions) shape.getShape(),
polygonMarkerOptions, polygonMarkerHoleOptions,
globalPolygonOptions);
shapeMarkers.add(polygonMarkers);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.POLYGON_MARKERS, polygonMarkers);
break;
case MULTI_LAT_LNG:
MultiLatLng multiLatLng = (MultiLatLng) shape.getShape();
if (markerOptions != null) {
multiLatLng.setMarkerOptions(markerOptions);
}
MultiMarker multiMarker = addLatLngsToMap(map, multiLatLng);
shapeMarkers.add(multiMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_MARKER, multiMarker);
break;
case MULTI_POLYLINE_OPTIONS:
MultiPolylineMarkers multiPolylineMarkers = addMultiPolylineToMapAsMarkers(
shapeMarkers, map, (MultiPolylineOptions) shape.getShape(),
polylineMarkerOptions, globalPolylineOptions);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_POLYLINE_MARKERS,
multiPolylineMarkers);
break;
case MULTI_POLYGON_OPTIONS:
MultiPolygonMarkers multiPolygonMarkers = addMultiPolygonToMapAsMarkers(
shapeMarkers, map, (MultiPolygonOptions) shape.getShape(),
polygonMarkerOptions, polygonMarkerHoleOptions,
globalPolygonOptions);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_POLYGON_MARKERS,
multiPolygonMarkers);
break;
case COLLECTION:
List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>();
@SuppressWarnings("unchecked")
List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape
.getShape();
for (GoogleMapShape shapeListItem : shapeList) {
GoogleMapShapeMarkers shapeListItemMarkers = addShapeToMapAsMarkers(
map, shapeListItem, markerOptions,
polylineMarkerOptions, polygonMarkerOptions,
polygonMarkerHoleOptions, globalPolylineOptions,
globalPolygonOptions);
shapeMarkers.add(shapeListItemMarkers);
addedShapeList.add(shapeListItemMarkers.getShape());
}
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.COLLECTION, addedShapeList);
break;
default:
throw new GeoPackageException("Unsupported Shape Type: "
+ shape.getShapeType());
}
shapeMarkers.setShape(addedShape);
return shapeMarkers;
} } | public class class_name {
public GoogleMapShapeMarkers addShapeToMapAsMarkers(GoogleMap map,
GoogleMapShape shape, MarkerOptions markerOptions,
MarkerOptions polylineMarkerOptions,
MarkerOptions polygonMarkerOptions,
MarkerOptions polygonMarkerHoleOptions,
PolylineOptions globalPolylineOptions,
PolygonOptions globalPolygonOptions) {
GoogleMapShapeMarkers shapeMarkers = new GoogleMapShapeMarkers();
GoogleMapShape addedShape = null;
switch (shape.getShapeType()) {
case LAT_LNG:
if (markerOptions == null) {
markerOptions = new MarkerOptions(); // depends on control dependency: [if], data = [none]
}
Marker latLngMarker = addLatLngToMap(map,
(LatLng) shape.getShape(), markerOptions);
shapeMarkers.add(latLngMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MARKER, latLngMarker);
break;
case MARKER_OPTIONS:
MarkerOptions shapeMarkerOptions = (MarkerOptions) shape.getShape();
if (markerOptions != null) {
shapeMarkerOptions.icon(markerOptions.getIcon()); // depends on control dependency: [if], data = [(markerOptions]
shapeMarkerOptions.anchor(markerOptions.getAnchorU(),
markerOptions.getAnchorV()); // depends on control dependency: [if], data = [none]
shapeMarkerOptions.draggable(markerOptions.isDraggable()); // depends on control dependency: [if], data = [(markerOptions]
shapeMarkerOptions.visible(markerOptions.isVisible()); // depends on control dependency: [if], data = [(markerOptions]
shapeMarkerOptions.zIndex(markerOptions.getZIndex()); // depends on control dependency: [if], data = [(markerOptions]
}
Marker markerOptionsMarker = addMarkerOptionsToMap(map,
shapeMarkerOptions);
shapeMarkers.add(markerOptionsMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MARKER, markerOptionsMarker);
break;
case POLYLINE_OPTIONS:
PolylineMarkers polylineMarkers = addPolylineToMapAsMarkers(map,
(PolylineOptions) shape.getShape(), polylineMarkerOptions,
globalPolylineOptions);
shapeMarkers.add(polylineMarkers);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.POLYLINE_MARKERS, polylineMarkers);
break;
case POLYGON_OPTIONS:
PolygonMarkers polygonMarkers = addPolygonToMapAsMarkers(
shapeMarkers, map, (PolygonOptions) shape.getShape(),
polygonMarkerOptions, polygonMarkerHoleOptions,
globalPolygonOptions);
shapeMarkers.add(polygonMarkers);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.POLYGON_MARKERS, polygonMarkers);
break;
case MULTI_LAT_LNG:
MultiLatLng multiLatLng = (MultiLatLng) shape.getShape();
if (markerOptions != null) {
multiLatLng.setMarkerOptions(markerOptions); // depends on control dependency: [if], data = [(markerOptions]
}
MultiMarker multiMarker = addLatLngsToMap(map, multiLatLng);
shapeMarkers.add(multiMarker);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_MARKER, multiMarker);
break;
case MULTI_POLYLINE_OPTIONS:
MultiPolylineMarkers multiPolylineMarkers = addMultiPolylineToMapAsMarkers(
shapeMarkers, map, (MultiPolylineOptions) shape.getShape(),
polylineMarkerOptions, globalPolylineOptions);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_POLYLINE_MARKERS,
multiPolylineMarkers);
break;
case MULTI_POLYGON_OPTIONS:
MultiPolygonMarkers multiPolygonMarkers = addMultiPolygonToMapAsMarkers(
shapeMarkers, map, (MultiPolygonOptions) shape.getShape(),
polygonMarkerOptions, polygonMarkerHoleOptions,
globalPolygonOptions);
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.MULTI_POLYGON_MARKERS,
multiPolygonMarkers);
break;
case COLLECTION:
List<GoogleMapShape> addedShapeList = new ArrayList<GoogleMapShape>();
@SuppressWarnings("unchecked")
List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape
.getShape();
for (GoogleMapShape shapeListItem : shapeList) {
GoogleMapShapeMarkers shapeListItemMarkers = addShapeToMapAsMarkers(
map, shapeListItem, markerOptions,
polylineMarkerOptions, polygonMarkerOptions,
polygonMarkerHoleOptions, globalPolylineOptions,
globalPolygonOptions);
shapeMarkers.add(shapeListItemMarkers); // depends on control dependency: [for], data = [shapeListItem]
addedShapeList.add(shapeListItemMarkers.getShape()); // depends on control dependency: [for], data = [shapeListItem]
}
addedShape = new GoogleMapShape(shape.getGeometryType(),
GoogleMapShapeType.COLLECTION, addedShapeList);
break;
default:
throw new GeoPackageException("Unsupported Shape Type: "
+ shape.getShapeType());
}
shapeMarkers.setShape(addedShape);
return shapeMarkers;
} } |
public class class_name {
@SuppressWarnings("resource")
public static <R> Stream<R> zip(final Collection<? extends CharStream> c, final CharNFunction<R> zipFunction) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
}
final int len = c.size();
final CharIterator[] iters = new CharIterator[len];
int i = 0;
for (CharStream s : c) {
iters[i++] = s.iteratorEx();
}
return new IteratorStream<>(new ObjIteratorEx<R>() {
@Override
public boolean hasNext() {
for (int i = 0; i < len; i++) {
if (iters[i].hasNext() == false) {
return false;
}
}
return true;
}
@Override
public R next() {
final char[] args = new char[len];
for (int i = 0; i < len; i++) {
args[i] = iters[i].nextChar();
}
return zipFunction.apply(args);
}
}).onClose(newCloseHandler(c));
} } | public class class_name {
@SuppressWarnings("resource")
public static <R> Stream<R> zip(final Collection<? extends CharStream> c, final CharNFunction<R> zipFunction) {
if (N.isNullOrEmpty(c)) {
return Stream.empty();
// depends on control dependency: [if], data = [none]
}
final int len = c.size();
final CharIterator[] iters = new CharIterator[len];
int i = 0;
for (CharStream s : c) {
iters[i++] = s.iteratorEx();
// depends on control dependency: [for], data = [s]
}
return new IteratorStream<>(new ObjIteratorEx<R>() {
@Override
public boolean hasNext() {
for (int i = 0; i < len; i++) {
if (iters[i].hasNext() == false) {
return false;
// depends on control dependency: [if], data = [none]
}
}
return true;
}
@Override
public R next() {
final char[] args = new char[len];
for (int i = 0; i < len; i++) {
args[i] = iters[i].nextChar();
// depends on control dependency: [for], data = [i]
}
return zipFunction.apply(args);
}
}).onClose(newCloseHandler(c));
} } |
public class class_name {
public static long getEstimatedMemoryUsage (Iterator<BufferedImage> iter)
{
long size = 0;
while (iter.hasNext()) {
BufferedImage image = iter.next();
size += getEstimatedMemoryUsage(image);
}
return size;
} } | public class class_name {
public static long getEstimatedMemoryUsage (Iterator<BufferedImage> iter)
{
long size = 0;
while (iter.hasNext()) {
BufferedImage image = iter.next();
size += getEstimatedMemoryUsage(image); // depends on control dependency: [while], data = [none]
}
return size;
} } |
public class class_name {
@CheckForNull
public static String getFirstIdent(@Nonnull final DetailAST pAst)
{
String result = null;
DetailAST ast = pAst.findFirstToken(TokenTypes.IDENT);
if (ast != null) {
result = ast.getText();
}
return result;
} } | public class class_name {
@CheckForNull
public static String getFirstIdent(@Nonnull final DetailAST pAst)
{
String result = null;
DetailAST ast = pAst.findFirstToken(TokenTypes.IDENT);
if (ast != null) {
result = ast.getText(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static void setBeanInfoSearchPath(String[] path) {
if (System.getSecurityManager() != null) {
System.getSecurityManager().checkPropertiesAccess();
}
searchPath = path;
} } | public class class_name {
public static void setBeanInfoSearchPath(String[] path) {
if (System.getSecurityManager() != null) {
System.getSecurityManager().checkPropertiesAccess(); // depends on control dependency: [if], data = [none]
}
searchPath = path;
} } |
public class class_name {
public Observable<ServiceResponse<Page<UsageInner>>> listMultiRoleUsagesNextWithServiceResponseAsync(final String nextPageLink) {
return listMultiRoleUsagesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listMultiRoleUsagesNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<UsageInner>>> listMultiRoleUsagesNextWithServiceResponseAsync(final String nextPageLink) {
return listMultiRoleUsagesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listMultiRoleUsagesNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
public BsonNumber getNumber(final Object key, final BsonNumber defaultValue) {
if (!containsKey(key)) {
return defaultValue;
}
return get(key).asNumber();
} } | public class class_name {
public BsonNumber getNumber(final Object key, final BsonNumber defaultValue) {
if (!containsKey(key)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return get(key).asNumber();
} } |
public class class_name {
public Collection<Parameter<?>> getParameters(Metadata... characteristics) {
if ((characteristics == null) || (characteristics.length == 0)) {
return Collections.<Parameter<?>>emptySet();
}
EnumSet<Metadata> metadataSet = null;
int length = characteristics.length;
if (length == 1) {
metadataSet = EnumSet.of(characteristics[0]);
}
else {
Metadata[] array = new Metadata[length -1];
// Start from the second(0-based index) element onwards to populate
// the array.
for (int i = 1; i < length; i++) {
array[i - 1] = characteristics[i];
}
metadataSet = EnumSet.of(characteristics[0], array);
}
Collection<Parameter<?>> extnParameters = getParameters();
Collection<Parameter<?>> result = new ArrayList<Parameter<?>>();
for (Parameter<?> extnParameter : extnParameters) {
EnumSet<Metadata> paramMetadata = extnParameter.metadata();
if (paramMetadata.containsAll(metadataSet)) {
result.add(extnParameter);
}
}
return result;
} } | public class class_name {
public Collection<Parameter<?>> getParameters(Metadata... characteristics) {
if ((characteristics == null) || (characteristics.length == 0)) {
return Collections.<Parameter<?>>emptySet();
}
EnumSet<Metadata> metadataSet = null;
int length = characteristics.length;
if (length == 1) {
metadataSet = EnumSet.of(characteristics[0]);
}
else {
Metadata[] array = new Metadata[length -1];
// Start from the second(0-based index) element onwards to populate
// the array.
for (int i = 1; i < length; i++) {
array[i - 1] = characteristics[i]; // depends on control dependency: [for], data = [i]
}
metadataSet = EnumSet.of(characteristics[0], array);
}
Collection<Parameter<?>> extnParameters = getParameters();
Collection<Parameter<?>> result = new ArrayList<Parameter<?>>();
for (Parameter<?> extnParameter : extnParameters) {
EnumSet<Metadata> paramMetadata = extnParameter.metadata();
if (paramMetadata.containsAll(metadataSet)) {
result.add(extnParameter);
}
}
return result;
} } |
public class class_name {
public String getTitle() {
String operationName = operation.getSummary();
if (isBlank(operationName)) {
operationName = getMethod().toString() + " " + getPath();
}
return operationName;
} } | public class class_name {
public String getTitle() {
String operationName = operation.getSummary();
if (isBlank(operationName)) {
operationName = getMethod().toString() + " " + getPath(); // depends on control dependency: [if], data = [none]
}
return operationName;
} } |
public class class_name {
protected void sendMessage(String dest, Message message) {
if (LOG.isTraceEnabled()) {
LOG.trace("Sends message {} to {}.",
TextFormat.shortDebugString(message),
dest);
}
this.transport.send(dest, message);
} } | public class class_name {
protected void sendMessage(String dest, Message message) {
if (LOG.isTraceEnabled()) {
LOG.trace("Sends message {} to {}.",
TextFormat.shortDebugString(message),
dest); // depends on control dependency: [if], data = [none]
}
this.transport.send(dest, message);
} } |
public class class_name {
public static boolean isEmpty(final String test) {
boolean result;
if (test == null) {
result = true;
} else {
result = test.trim().length() == 0;
}
return result;
} } | public class class_name {
public static boolean isEmpty(final String test) {
boolean result;
if (test == null) {
result = true; // depends on control dependency: [if], data = [none]
} else {
result = test.trim().length() == 0; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) {
setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING);
if (additionalContexts != null && additionalContexts.length > 0) {
for (Object additionContext : additionalContexts) {
setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING);
}
}
} } | public class class_name {
public static void setInternalStateFromContext(Object object, Object context, Object[] additionalContexts) {
setInternalStateFromContext(object, context, FieldMatchingStrategy.MATCHING);
if (additionalContexts != null && additionalContexts.length > 0) {
for (Object additionContext : additionalContexts) {
setInternalStateFromContext(object, additionContext, FieldMatchingStrategy.MATCHING); // depends on control dependency: [for], data = [additionContext]
}
}
} } |
public class class_name {
@TargetApi(24)
public String getMobileNetworkType() {
String resultUnknown = "unknown";
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return resultUnknown;
}
if (getTelephonyManager() == null) {
return resultUnknown;
}
switch (getTelephonyManager().getDataNetworkType()) {
case TelephonyManager.NETWORK_TYPE_LTE:
return "4G";
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
return "3G";
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
return "2G";
default:
return resultUnknown;
}
} } | public class class_name {
@TargetApi(24)
public String getMobileNetworkType() {
String resultUnknown = "unknown";
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
return resultUnknown; // depends on control dependency: [if], data = [none]
}
if (getTelephonyManager() == null) {
return resultUnknown; // depends on control dependency: [if], data = [none]
}
switch (getTelephonyManager().getDataNetworkType()) {
case TelephonyManager.NETWORK_TYPE_LTE:
return "4G";
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
return "3G";
case TelephonyManager.NETWORK_TYPE_GPRS:
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
return "2G";
default:
return resultUnknown;
}
} } |
public class class_name {
public static String substringBefore(final String str, final String separator) {
if (Strings.isNullOrEmpty(str)) {
return str;
}
final int pos = str.indexOf(separator);
if (pos == -1) {
return str;
}
return str.substring(0, pos);
} } | public class class_name {
public static String substringBefore(final String str, final String separator) {
if (Strings.isNullOrEmpty(str)) {
return str; // depends on control dependency: [if], data = [none]
}
final int pos = str.indexOf(separator);
if (pos == -1) {
return str; // depends on control dependency: [if], data = [none]
}
return str.substring(0, pos);
} } |
public class class_name {
public void addHostEventHandler(IHostEventHandler hostEventHandler) {
synchronized (hostEventHandlers) {
if (!hostEventHandlers.contains(hostEventHandler)) {
hostEventHandlers.add(hostEventHandler);
}
}
} } | public class class_name {
public void addHostEventHandler(IHostEventHandler hostEventHandler) {
synchronized (hostEventHandlers) {
if (!hostEventHandlers.contains(hostEventHandler)) {
hostEventHandlers.add(hostEventHandler); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "path", style);
if (line != null) {
Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(line));
}
}
} } | public class class_name {
public void drawLine(Object parent, String name, LineString line, ShapeStyle style) {
if (isAttached()) {
Element element = helper.createOrUpdateElement(parent, name, "path", style);
if (line != null) {
Dom.setElementAttribute(element, "d", SvgPathDecoder.decode(line)); // depends on control dependency: [if], data = [(line]
}
}
} } |
public class class_name {
public static boolean delete(final File aDir) {
if (aDir.exists() && aDir.listFiles() != null) {
for (final File file : aDir.listFiles()) {
if (file.isDirectory()) {
if (!delete(file)) {
LOGGER.error(MessageCodes.UTIL_012, file);
}
} else {
if (file.exists() && !file.delete()) {
LOGGER.error(MessageCodes.UTIL_012, file);
}
}
}
} else if (LOGGER.isDebugEnabled() && aDir.listFiles() == null) {
LOGGER.debug(MessageCodes.UTIL_013, aDir);
}
return aDir.delete();
} } | public class class_name {
public static boolean delete(final File aDir) {
if (aDir.exists() && aDir.listFiles() != null) {
for (final File file : aDir.listFiles()) {
if (file.isDirectory()) {
if (!delete(file)) {
LOGGER.error(MessageCodes.UTIL_012, file); // depends on control dependency: [if], data = [none]
}
} else {
if (file.exists() && !file.delete()) {
LOGGER.error(MessageCodes.UTIL_012, file); // depends on control dependency: [if], data = [none]
}
}
}
} else if (LOGGER.isDebugEnabled() && aDir.listFiles() == null) {
LOGGER.debug(MessageCodes.UTIL_013, aDir); // depends on control dependency: [if], data = [none]
}
return aDir.delete();
} } |
public class class_name {
@Override
public int getNumberSubscribers(String topic) {
if (map.containsKey(topic)) {
return map.get(topic).size();
}
return 0;
} } | public class class_name {
@Override
public int getNumberSubscribers(String topic) {
if (map.containsKey(topic)) {
return map.get(topic).size();
// depends on control dependency: [if], data = [none]
}
return 0;
} } |
public class class_name {
private static String[] decodeAuthAmqPlain(String response) {
Logger logger = LoggerFactory.getLogger(SERVICE_AMQP_PROXY_LOGGER);
String[] credentials = null;
if ((response != null) && (response.trim().length() > 0)) {
ByteBuffer buffer = ByteBuffer.wrap(response.getBytes());
@SuppressWarnings("unused")
String loginKey = getShortString(buffer);
@SuppressWarnings("unused")
AmqpType ltype = getType(buffer);
String username = getLongString(buffer);
@SuppressWarnings("unused")
String passwordKey = getShortString(buffer);
@SuppressWarnings("unused")
AmqpType ptype = getType(buffer);
String password = getLongString(buffer);
if (logger.isDebugEnabled()) {
String s = ".decodeAuthAmqPlain(): Username = " + username;
logger.debug(CLASS_NAME + s);
}
credentials = new String[] { username, password };
}
return credentials;
} } | public class class_name {
private static String[] decodeAuthAmqPlain(String response) {
Logger logger = LoggerFactory.getLogger(SERVICE_AMQP_PROXY_LOGGER);
String[] credentials = null;
if ((response != null) && (response.trim().length() > 0)) {
ByteBuffer buffer = ByteBuffer.wrap(response.getBytes());
@SuppressWarnings("unused")
String loginKey = getShortString(buffer);
@SuppressWarnings("unused")
AmqpType ltype = getType(buffer);
String username = getLongString(buffer);
@SuppressWarnings("unused")
String passwordKey = getShortString(buffer);
@SuppressWarnings("unused")
AmqpType ptype = getType(buffer);
String password = getLongString(buffer);
if (logger.isDebugEnabled()) {
String s = ".decodeAuthAmqPlain(): Username = " + username;
logger.debug(CLASS_NAME + s); // depends on control dependency: [if], data = [none]
}
credentials = new String[] { username, password }; // depends on control dependency: [if], data = [none]
}
return credentials;
} } |
public class class_name {
@Nullable
public static <T> T getLast(Iterable<? extends T> iterable, @Nullable T defaultValue) {
if (iterable instanceof Collection) {
Collection<? extends T> c = Collections2.cast(iterable);
if (c.isEmpty()) {
return defaultValue;
} else if (iterable instanceof List) {
return getLastInNonemptyList(Lists.cast(iterable));
}
}
return Iterators.getLast(iterable.iterator(), defaultValue);
} } | public class class_name {
@Nullable
public static <T> T getLast(Iterable<? extends T> iterable, @Nullable T defaultValue) {
if (iterable instanceof Collection) {
Collection<? extends T> c = Collections2.cast(iterable); // depends on control dependency: [if], data = [none]
if (c.isEmpty()) {
return defaultValue; // depends on control dependency: [if], data = [none]
} else if (iterable instanceof List) {
return getLastInNonemptyList(Lists.cast(iterable)); // depends on control dependency: [if], data = [none]
}
}
return Iterators.getLast(iterable.iterator(), defaultValue);
} } |
public class class_name {
protected Criterion addToCriteria(Criterion c) {
if (!logicalExpressionStack.isEmpty()) {
logicalExpressionStack.get(logicalExpressionStack.size() - 1).args.add(c);
}
else {
criteria.add(c);
}
return c;
} } | public class class_name {
protected Criterion addToCriteria(Criterion c) {
if (!logicalExpressionStack.isEmpty()) {
logicalExpressionStack.get(logicalExpressionStack.size() - 1).args.add(c); // depends on control dependency: [if], data = [none]
}
else {
criteria.add(c); // depends on control dependency: [if], data = [none]
}
return c;
} } |
public class class_name {
public String nextGroup() {
int currentPosition = this.position;
do {
char currentCharacter = this.characters[currentPosition];
if (currentCharacter == '[') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '[', ']');
} else if (currentCharacter == '(') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '(', ')');
} else if (currentCharacter != '.') {
currentPosition++;
}
if (currentPosition < 0) {
currentPosition = this.characters.length;
}
} while ((currentPosition < this.characters.length)
&& (this.characters[currentPosition] != '.'));
String token = this.notationString.substring(this.position, currentPosition);
this.position = currentPosition + 1;
return token;
} } | public class class_name {
public String nextGroup() {
int currentPosition = this.position;
do {
char currentCharacter = this.characters[currentPosition];
if (currentCharacter == '[') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '[', ']'); // depends on control dependency: [if], data = [none]
} else if (currentCharacter == '(') {
currentPosition = NucleotideParser.getMatchingBracketPosition(this.characters, currentPosition, '(', ')'); // depends on control dependency: [if], data = [none]
} else if (currentCharacter != '.') {
currentPosition++; // depends on control dependency: [if], data = [none]
}
if (currentPosition < 0) {
currentPosition = this.characters.length; // depends on control dependency: [if], data = [none]
}
} while ((currentPosition < this.characters.length)
&& (this.characters[currentPosition] != '.'));
String token = this.notationString.substring(this.position, currentPosition);
this.position = currentPosition + 1;
return token;
} } |
public class class_name {
public static Throwable getRootCause(Throwable throwable) {
// Keep a second pointer that slowly walks the causal chain. If the fast pointer ever catches
// the slower pointer, then there's a loop.
Throwable slowPointer = throwable;
boolean advanceSlowPointer = false;
Throwable cause;
while ((cause = throwable.getCause()) != null) {
throwable = cause;
if (throwable == slowPointer) {
throw new IllegalArgumentException("Loop in causal chain detected.", throwable);
}
if (advanceSlowPointer) {
slowPointer = slowPointer.getCause();
}
advanceSlowPointer = !advanceSlowPointer; // only advance every other iteration
}
return throwable;
} } | public class class_name {
public static Throwable getRootCause(Throwable throwable) {
// Keep a second pointer that slowly walks the causal chain. If the fast pointer ever catches
// the slower pointer, then there's a loop.
Throwable slowPointer = throwable;
boolean advanceSlowPointer = false;
Throwable cause;
while ((cause = throwable.getCause()) != null) {
throwable = cause; // depends on control dependency: [while], data = [none]
if (throwable == slowPointer) {
throw new IllegalArgumentException("Loop in causal chain detected.", throwable);
}
if (advanceSlowPointer) {
slowPointer = slowPointer.getCause(); // depends on control dependency: [if], data = [none]
}
advanceSlowPointer = !advanceSlowPointer; // only advance every other iteration // depends on control dependency: [while], data = [none]
}
return throwable;
} } |
public class class_name {
public static String stackTraceToString(Throwable cause) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream pout = new PrintStream(out);
cause.printStackTrace(pout);
pout.flush();
try {
return new String(out.toByteArray());
} finally {
try {
out.close();
} catch (IOException ignore) {
// ignore as should never happen
}
}
} } | public class class_name {
public static String stackTraceToString(Throwable cause) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PrintStream pout = new PrintStream(out);
cause.printStackTrace(pout);
pout.flush();
try {
return new String(out.toByteArray()); // depends on control dependency: [try], data = [none]
} finally {
try {
out.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ignore) {
// ignore as should never happen
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static Object getMapEntry(final Map<String, ?> iMap, final Object iKey) {
if (iMap == null || iKey == null)
return null;
if (iKey instanceof String) {
String iName = (String) iKey;
int pos = iName.indexOf('.');
if (pos > -1)
iName = iName.substring(0, pos);
final Object value = iMap.get(iName);
if (value == null)
return null;
if (pos > -1) {
final String restFieldName = iName.substring(pos + 1);
if (value instanceof ODocument)
return getFieldValue(value, restFieldName);
else if (value instanceof Map<?, ?>)
return getMapEntry((Map<String, ?>) value, restFieldName);
}
return value;
} else
return iMap.get(iKey);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static Object getMapEntry(final Map<String, ?> iMap, final Object iKey) {
if (iMap == null || iKey == null)
return null;
if (iKey instanceof String) {
String iName = (String) iKey;
int pos = iName.indexOf('.');
if (pos > -1)
iName = iName.substring(0, pos);
final Object value = iMap.get(iName);
if (value == null)
return null;
if (pos > -1) {
final String restFieldName = iName.substring(pos + 1);
if (value instanceof ODocument)
return getFieldValue(value, restFieldName);
else if (value instanceof Map<?, ?>)
return getMapEntry((Map<String, ?>) value, restFieldName);
}
return value;
// depends on control dependency: [if], data = [none]
} else
return iMap.get(iKey);
} } |
public class class_name {
@Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose();
} catch (SaslException e) {
// ignore
} finally {
saslServer = null;
}
}
} } | public class class_name {
@Override
public synchronized void dispose() {
if (saslServer != null) {
try {
saslServer.dispose(); // depends on control dependency: [try], data = [none]
} catch (SaslException e) {
// ignore
} finally { // depends on control dependency: [catch], data = [none]
saslServer = null;
}
}
} } |
public class class_name {
public static Element removeScriptTags(Element element) {
NodeList<Element> scriptTags = element.getElementsByTagName(Tag.script.name());
// iterate backwards over list to ensure all tags get removed
for (int i = scriptTags.getLength() - 1; i >= 0; i--) {
scriptTags.getItem(i).removeFromParent();
}
return element;
} } | public class class_name {
public static Element removeScriptTags(Element element) {
NodeList<Element> scriptTags = element.getElementsByTagName(Tag.script.name());
// iterate backwards over list to ensure all tags get removed
for (int i = scriptTags.getLength() - 1; i >= 0; i--) {
scriptTags.getItem(i).removeFromParent(); // depends on control dependency: [for], data = [i]
}
return element;
} } |
public class class_name {
public void close()
{
CloseHelper.close(sharedRunner);
CloseHelper.close(sharedNetworkRunner);
CloseHelper.close(receiverRunner);
CloseHelper.close(senderRunner);
CloseHelper.close(conductorRunner);
CloseHelper.close(sharedInvoker);
if (ctx.useWindowsHighResTimer() && SystemUtil.osName().startsWith("win"))
{
if (!wasHighResTimerEnabled)
{
HighResolutionTimer.disable();
}
}
} } | public class class_name {
public void close()
{
CloseHelper.close(sharedRunner);
CloseHelper.close(sharedNetworkRunner);
CloseHelper.close(receiverRunner);
CloseHelper.close(senderRunner);
CloseHelper.close(conductorRunner);
CloseHelper.close(sharedInvoker);
if (ctx.useWindowsHighResTimer() && SystemUtil.osName().startsWith("win"))
{
if (!wasHighResTimerEnabled)
{
HighResolutionTimer.disable(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static MultiPolygon of(Iterable<Polygon> polygons) {
MultiDimensionalPositions.Builder positionsBuilder = MultiDimensionalPositions.builder();
for(Polygon polygon : polygons) {
positionsBuilder.addAreaPosition(polygon.positions());
}
return new MultiPolygon(positionsBuilder.build());
} } | public class class_name {
public static MultiPolygon of(Iterable<Polygon> polygons) {
MultiDimensionalPositions.Builder positionsBuilder = MultiDimensionalPositions.builder();
for(Polygon polygon : polygons) {
positionsBuilder.addAreaPosition(polygon.positions()); // depends on control dependency: [for], data = [polygon]
}
return new MultiPolygon(positionsBuilder.build());
} } |
public class class_name {
private void copyCookies(final Message message) {
if (message instanceof HttpMessage) {
this.cookies.putAll(((HttpMessage) message).getCookiesMap());
}
} } | public class class_name {
private void copyCookies(final Message message) {
if (message instanceof HttpMessage) {
this.cookies.putAll(((HttpMessage) message).getCookiesMap()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DeregisterInstanceRequest deregisterInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterInstanceRequest.getInstanceId(), INSTANCEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeregisterInstanceRequest deregisterInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (deregisterInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deregisterInstanceRequest.getInstanceId(), INSTANCEID_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 void main(String[] args) {
try{
if (args.length < 1 || args.length > 3){
System.out.println("Usage: PdfContentReaderTool <pdf file> [<output file>|stdout] [<page num>]");
return;
}
PrintWriter writer = new PrintWriter(System.out);
if (args.length >= 2){
if (args[1].compareToIgnoreCase("stdout") != 0){
System.out.println("Writing PDF content to " + args[1]);
writer = new PrintWriter(new FileOutputStream(new File(args[1])));
}
}
int pageNum = -1;
if (args.length >= 3){
pageNum = Integer.parseInt(args[2]);
}
if (pageNum == -1){
listContentStream(new File(args[0]), writer);
} else {
listContentStream(new File(args[0]), pageNum, writer);
}
writer.flush();
if (args.length >= 2){
writer.close();
System.out.println("Finished writing content to " + args[1]);
}
} catch (Exception e){
e.printStackTrace(System.err);
}
} } | public class class_name {
public static void main(String[] args) {
try{
if (args.length < 1 || args.length > 3){
System.out.println("Usage: PdfContentReaderTool <pdf file> [<output file>|stdout] [<page num>]");
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
PrintWriter writer = new PrintWriter(System.out);
if (args.length >= 2){
if (args[1].compareToIgnoreCase("stdout") != 0){
System.out.println("Writing PDF content to " + args[1]);
// depends on control dependency: [if], data = [none]
writer = new PrintWriter(new FileOutputStream(new File(args[1])));
// depends on control dependency: [if], data = [none]
}
}
int pageNum = -1;
if (args.length >= 3){
pageNum = Integer.parseInt(args[2]);
// depends on control dependency: [if], data = [none]
}
if (pageNum == -1){
listContentStream(new File(args[0]), writer);
// depends on control dependency: [if], data = [none]
} else {
listContentStream(new File(args[0]), pageNum, writer);
// depends on control dependency: [if], data = [none]
}
writer.flush();
// depends on control dependency: [try], data = [none]
if (args.length >= 2){
writer.close();
// depends on control dependency: [if], data = [none]
System.out.println("Finished writing content to " + args[1]);
// depends on control dependency: [if], data = [none]
}
} catch (Exception e){
e.printStackTrace(System.err);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Clustering<Model> run(Database database, Relation<O> relation) {
StepProgress stepprog = LOG.isVerbose() ? new StepProgress("LSDBC", 3) : null;
final int dim = RelationUtil.dimensionality(relation);
final double factor = FastMath.pow(2., alpha / dim);
final DBIDs ids = relation.getDBIDs();
LOG.beginStep(stepprog, 1, "Materializing kNN neighborhoods");
KNNQuery<O> knnq = DatabaseUtil.precomputedKNNQuery(database, relation, getDistanceFunction(), k);
LOG.beginStep(stepprog, 2, "Sorting by density");
WritableDoubleDataStore dens = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
fillDensities(knnq, ids, dens);
ArrayModifiableDBIDs sids = DBIDUtil.newArray(ids);
sids.sort(new DataStoreUtil.AscendingByDoubleDataStore(dens));
LOG.beginStep(stepprog, 3, "Computing clusters");
// Setup progress logging
final FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("LSDBC Clustering", ids.size(), LOG) : null;
final IndefiniteProgress clusprogress = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters found", LOG) : null;
// (Temporary) store the cluster ID assigned.
final WritableIntegerDataStore clusterids = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_TEMP, UNPROCESSED);
// Note: these are not exact, as objects may be stolen from noise.
final IntArrayList clustersizes = new IntArrayList();
clustersizes.add(0); // Unprocessed dummy value.
clustersizes.add(0); // Noise counter.
// Implementation Note: using Integer objects should result in
// reduced memory use in the HashMap!
int clusterid = NOISE + 1;
// Iterate over all objects in the database.
for(DBIDIter id = sids.iter(); id.valid(); id.advance()) {
// Skip already processed ids.
if(clusterids.intValue(id) != UNPROCESSED) {
continue;
}
// Evaluate Neighborhood predicate
final KNNList neighbors = knnq.getKNNForDBID(id, k);
// Evaluate Core-Point predicate:
if(isLocalMaximum(neighbors.getKNNDistance(), neighbors, dens)) {
double mindens = factor * neighbors.getKNNDistance();
clusterids.putInt(id, clusterid);
clustersizes.add(expandCluster(clusterid, clusterids, knnq, neighbors, mindens, progress));
// start next cluster on next iteration.
++clusterid;
if(clusprogress != null) {
clusprogress.setProcessed(clusterid, LOG);
}
}
else {
// otherwise, it's a noise point
clusterids.putInt(id, NOISE);
clustersizes.set(NOISE, clustersizes.getInt(NOISE) + 1);
}
// We've completed this element
LOG.incrementProcessed(progress);
}
// Finish progress logging.
LOG.ensureCompleted(progress);
LOG.setCompleted(clusprogress);
LOG.setCompleted(stepprog);
// Transform cluster ID mapping into a clustering result:
ArrayList<ArrayModifiableDBIDs> clusterlists = new ArrayList<>(clusterid);
// add storage containers for clusters
for(int i = 0; i < clustersizes.size(); i++) {
clusterlists.add(DBIDUtil.newArray(clustersizes.getInt(i)));
}
// do the actual inversion
for(DBIDIter id = ids.iter(); id.valid(); id.advance()) {
// Negative values are non-core points:
int cid = clusterids.intValue(id);
int cluster = Math.abs(cid);
clusterlists.get(cluster).add(id);
}
clusterids.destroy();
Clustering<Model> result = new Clustering<>("LSDBC", "lsdbc-clustering");
for(int cid = NOISE; cid < clusterlists.size(); cid++) {
boolean isNoise = (cid == NOISE);
Cluster<Model> c;
c = new Cluster<Model>(clusterlists.get(cid), isNoise, ClusterModel.CLUSTER);
result.addToplevelCluster(c);
}
return result;
} } | public class class_name {
public Clustering<Model> run(Database database, Relation<O> relation) {
StepProgress stepprog = LOG.isVerbose() ? new StepProgress("LSDBC", 3) : null;
final int dim = RelationUtil.dimensionality(relation);
final double factor = FastMath.pow(2., alpha / dim);
final DBIDs ids = relation.getDBIDs();
LOG.beginStep(stepprog, 1, "Materializing kNN neighborhoods");
KNNQuery<O> knnq = DatabaseUtil.precomputedKNNQuery(database, relation, getDistanceFunction(), k);
LOG.beginStep(stepprog, 2, "Sorting by density");
WritableDoubleDataStore dens = DataStoreUtil.makeDoubleStorage(ids, DataStoreFactory.HINT_HOT | DataStoreFactory.HINT_TEMP);
fillDensities(knnq, ids, dens);
ArrayModifiableDBIDs sids = DBIDUtil.newArray(ids);
sids.sort(new DataStoreUtil.AscendingByDoubleDataStore(dens));
LOG.beginStep(stepprog, 3, "Computing clusters");
// Setup progress logging
final FiniteProgress progress = LOG.isVerbose() ? new FiniteProgress("LSDBC Clustering", ids.size(), LOG) : null;
final IndefiniteProgress clusprogress = LOG.isVerbose() ? new IndefiniteProgress("Number of clusters found", LOG) : null;
// (Temporary) store the cluster ID assigned.
final WritableIntegerDataStore clusterids = DataStoreUtil.makeIntegerStorage(ids, DataStoreFactory.HINT_TEMP, UNPROCESSED);
// Note: these are not exact, as objects may be stolen from noise.
final IntArrayList clustersizes = new IntArrayList();
clustersizes.add(0); // Unprocessed dummy value.
clustersizes.add(0); // Noise counter.
// Implementation Note: using Integer objects should result in
// reduced memory use in the HashMap!
int clusterid = NOISE + 1;
// Iterate over all objects in the database.
for(DBIDIter id = sids.iter(); id.valid(); id.advance()) {
// Skip already processed ids.
if(clusterids.intValue(id) != UNPROCESSED) {
continue;
}
// Evaluate Neighborhood predicate
final KNNList neighbors = knnq.getKNNForDBID(id, k);
// Evaluate Core-Point predicate:
if(isLocalMaximum(neighbors.getKNNDistance(), neighbors, dens)) {
double mindens = factor * neighbors.getKNNDistance();
clusterids.putInt(id, clusterid); // depends on control dependency: [if], data = [none]
clustersizes.add(expandCluster(clusterid, clusterids, knnq, neighbors, mindens, progress)); // depends on control dependency: [if], data = [none]
// start next cluster on next iteration.
++clusterid; // depends on control dependency: [if], data = [none]
if(clusprogress != null) {
clusprogress.setProcessed(clusterid, LOG); // depends on control dependency: [if], data = [none]
}
}
else {
// otherwise, it's a noise point
clusterids.putInt(id, NOISE); // depends on control dependency: [if], data = [none]
clustersizes.set(NOISE, clustersizes.getInt(NOISE) + 1); // depends on control dependency: [if], data = [none]
}
// We've completed this element
LOG.incrementProcessed(progress); // depends on control dependency: [for], data = [none]
}
// Finish progress logging.
LOG.ensureCompleted(progress);
LOG.setCompleted(clusprogress);
LOG.setCompleted(stepprog);
// Transform cluster ID mapping into a clustering result:
ArrayList<ArrayModifiableDBIDs> clusterlists = new ArrayList<>(clusterid);
// add storage containers for clusters
for(int i = 0; i < clustersizes.size(); i++) {
clusterlists.add(DBIDUtil.newArray(clustersizes.getInt(i))); // depends on control dependency: [for], data = [i]
}
// do the actual inversion
for(DBIDIter id = ids.iter(); id.valid(); id.advance()) {
// Negative values are non-core points:
int cid = clusterids.intValue(id);
int cluster = Math.abs(cid);
clusterlists.get(cluster).add(id); // depends on control dependency: [for], data = [id]
}
clusterids.destroy();
Clustering<Model> result = new Clustering<>("LSDBC", "lsdbc-clustering");
for(int cid = NOISE; cid < clusterlists.size(); cid++) {
boolean isNoise = (cid == NOISE);
Cluster<Model> c;
c = new Cluster<Model>(clusterlists.get(cid), isNoise, ClusterModel.CLUSTER); // depends on control dependency: [for], data = [cid]
result.addToplevelCluster(c); // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
public static byte[] encode(Serializable object)
{
Parameters.checkNotNull(object);
ObjectOutputStream oos = null;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
oos = new ObjectOutputStream(out);
oos.writeObject(object);
oos.flush();
return out.toByteArray();
} catch (IOException ex) {
throw new EncodingException(ex);
} finally {
IO.close(oos);
}
} } | public class class_name {
public static byte[] encode(Serializable object)
{
Parameters.checkNotNull(object);
ObjectOutputStream oos = null;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
oos = new ObjectOutputStream(out); // depends on control dependency: [try], data = [none]
oos.writeObject(object); // depends on control dependency: [try], data = [none]
oos.flush(); // depends on control dependency: [try], data = [none]
return out.toByteArray(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new EncodingException(ex);
} finally { // depends on control dependency: [catch], data = [none]
IO.close(oos);
}
} } |
public class class_name {
public SyntacticCategory getWithoutFeatures() {
if (isAtomic()) {
return createAtomic(value, DEFAULT_FEATURE_VALUE, -1);
} else {
return createFunctional(getDirection(), returnType.getWithoutFeatures(),
argumentType.getWithoutFeatures());
}
} } | public class class_name {
public SyntacticCategory getWithoutFeatures() {
if (isAtomic()) {
return createAtomic(value, DEFAULT_FEATURE_VALUE, -1); // depends on control dependency: [if], data = [none]
} else {
return createFunctional(getDirection(), returnType.getWithoutFeatures(),
argumentType.getWithoutFeatures()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr,
final CIMsgPhrase... _ciMsgPhrases)
throws EFapsException
{
final Set<MsgPhrase> msgPhrases = new HashSet<>();
for (final CIMsgPhrase ciMsgPhrase : _ciMsgPhrases) {
msgPhrases.add(ciMsgPhrase.getMsgPhrase());
}
return addMsgPhrase(_selectBldr, msgPhrases.toArray(new MsgPhrase[msgPhrases.size()]));
} } | public class class_name {
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr,
final CIMsgPhrase... _ciMsgPhrases)
throws EFapsException
{
final Set<MsgPhrase> msgPhrases = new HashSet<>();
for (final CIMsgPhrase ciMsgPhrase : _ciMsgPhrases) {
msgPhrases.add(ciMsgPhrase.getMsgPhrase()); // depends on control dependency: [for], data = [ciMsgPhrase]
}
return addMsgPhrase(_selectBldr, msgPhrases.toArray(new MsgPhrase[msgPhrases.size()]));
} } |
public class class_name {
public EClass getIfcBoxedHalfSpace() {
if (ifcBoxedHalfSpaceEClass == null) {
ifcBoxedHalfSpaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(53);
}
return ifcBoxedHalfSpaceEClass;
} } | public class class_name {
public EClass getIfcBoxedHalfSpace() {
if (ifcBoxedHalfSpaceEClass == null) {
ifcBoxedHalfSpaceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(53);
// depends on control dependency: [if], data = [none]
}
return ifcBoxedHalfSpaceEClass;
} } |
public class class_name {
protected void expandDependency(IntDependency dependency, double count) {
//if (Test.prunePunc && pruneTW(dependency.arg))
// return;
if (dependency.head == null || dependency.arg == null) {
return;
}
if (dependency.arg.word != STOP_WORD_INT) {
expandArg(dependency, valenceBin(dependency.distance), count);
}
expandStop(dependency, distanceBin(dependency.distance), count, true);
} } | public class class_name {
protected void expandDependency(IntDependency dependency, double count) {
//if (Test.prunePunc && pruneTW(dependency.arg))
// return;
if (dependency.head == null || dependency.arg == null) {
return;
// depends on control dependency: [if], data = [none]
}
if (dependency.arg.word != STOP_WORD_INT) {
expandArg(dependency, valenceBin(dependency.distance), count);
// depends on control dependency: [if], data = [none]
}
expandStop(dependency, distanceBin(dependency.distance), count, true);
} } |
public class class_name {
public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int midy = screenPos[1] + height / 2;
int referenceX = screenPos[0] + width / 2;
if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_LTR) {
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
referenceX = screenWidth - referenceX; // mirror
}
StringBuilder hint = new StringBuilder("#");
if (Color.alpha(color) != 255) {
hint.append(Integer.toHexString(color).toUpperCase(Locale.ENGLISH));
} else {
hint.append(String.format("%06X", 0xFFFFFF & color).toUpperCase(Locale.ENGLISH));
}
Toast cheatSheet = Toast.makeText(context, hint.toString(), Toast.LENGTH_SHORT);
if (midy < displayFrame.height()) {
// Show along the top; follow action buttons
cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, referenceX, screenPos[1] + height - displayFrame.top);
} else {
// Show along the bottom center
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
}
cheatSheet.show();
} } | public class class_name {
public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int midy = screenPos[1] + height / 2;
int referenceX = screenPos[0] + width / 2;
if (ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_LTR) {
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
referenceX = screenWidth - referenceX; // mirror // depends on control dependency: [if], data = [none]
}
StringBuilder hint = new StringBuilder("#");
if (Color.alpha(color) != 255) {
hint.append(Integer.toHexString(color).toUpperCase(Locale.ENGLISH)); // depends on control dependency: [if], data = [none]
} else {
hint.append(String.format("%06X", 0xFFFFFF & color).toUpperCase(Locale.ENGLISH)); // depends on control dependency: [if], data = [none]
}
Toast cheatSheet = Toast.makeText(context, hint.toString(), Toast.LENGTH_SHORT);
if (midy < displayFrame.height()) {
// Show along the top; follow action buttons
cheatSheet.setGravity(Gravity.TOP | GravityCompat.END, referenceX, screenPos[1] + height - displayFrame.top); // depends on control dependency: [if], data = [none]
} else {
// Show along the bottom center
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height); // depends on control dependency: [if], data = [none]
}
cheatSheet.show();
} } |
public class class_name {
public static final byte[] asByteArray(long sampleCount, double[] sample) {
int b_len = (int) sampleCount
* (SC_AUDIO_FORMAT.getSampleSizeInBits() / 8);
byte[] buffer = new byte[b_len];
int in;
for (int i = 0; i < sample.length; i++) {
in = (int) (sample[i] * 32767);
buffer[2 * i] = (byte) (in & 255);
buffer[2 * i + 1] = (byte) (in >> 8);
}
return buffer;
} } | public class class_name {
public static final byte[] asByteArray(long sampleCount, double[] sample) {
int b_len = (int) sampleCount
* (SC_AUDIO_FORMAT.getSampleSizeInBits() / 8);
byte[] buffer = new byte[b_len];
int in;
for (int i = 0; i < sample.length; i++) {
in = (int) (sample[i] * 32767); // depends on control dependency: [for], data = [i]
buffer[2 * i] = (byte) (in & 255); // depends on control dependency: [for], data = [i]
buffer[2 * i + 1] = (byte) (in >> 8); // depends on control dependency: [for], data = [i]
}
return buffer;
} } |
public class class_name {
static void createRegularGrid( List<List<NodeInfo>> gridByRows , Grid g) {
g.reset();
g.columns = gridByRows.get(0).size();
g.rows = gridByRows.size();
for (int row = 0; row < g.rows; row++) {
List<NodeInfo> list = gridByRows.get(row);
for (int i = 0; i < g.columns; i++) {
g.ellipses.add(list.get(i).ellipse );
}
}
} } | public class class_name {
static void createRegularGrid( List<List<NodeInfo>> gridByRows , Grid g) {
g.reset();
g.columns = gridByRows.get(0).size();
g.rows = gridByRows.size();
for (int row = 0; row < g.rows; row++) {
List<NodeInfo> list = gridByRows.get(row);
for (int i = 0; i < g.columns; i++) {
g.ellipses.add(list.get(i).ellipse ); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
public static <T extends TemporalProposition> List<T> getView(
List<T> params, Long minValid, Long maxValid) {
if (params != null) {
if (minValid == null && maxValid == null) {
return params;
} else {
int min = minValid != null ? binarySearchMinStart(params,
minValid.longValue()) : 0;
int max = maxValid != null ? binarySearchMaxFinish(params,
maxValid.longValue()) : params.size();
return params.subList(min, max);
}
} else {
return null;
}
} } | public class class_name {
public static <T extends TemporalProposition> List<T> getView(
List<T> params, Long minValid, Long maxValid) {
if (params != null) {
if (minValid == null && maxValid == null) {
return params; // depends on control dependency: [if], data = [none]
} else {
int min = minValid != null ? binarySearchMinStart(params,
minValid.longValue()) : 0;
int max = maxValid != null ? binarySearchMaxFinish(params,
maxValid.longValue()) : params.size();
return params.subList(min, max); // depends on control dependency: [if], data = [none]
}
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void flushIfPossible() throws IOException {
// TODO: do not flush if wasn't requested by underlying application
if (null != bufferedServletOutputStream) bufferedServletOutputStream.setLastChunk();
if (null != writer) writer.flushIfOpen();
else if (null != outputStream) outputStream.flushIfOpen();
else {
if (!isCommitted()) {
notifyBeforeCommit();
}
notifyBeforeClose();
}
} } | public class class_name {
protected void flushIfPossible() throws IOException {
// TODO: do not flush if wasn't requested by underlying application
if (null != bufferedServletOutputStream) bufferedServletOutputStream.setLastChunk();
if (null != writer) writer.flushIfOpen();
else if (null != outputStream) outputStream.flushIfOpen();
else {
if (!isCommitted()) {
notifyBeforeCommit(); // depends on control dependency: [if], data = [none]
}
notifyBeforeClose();
}
} } |
public class class_name {
public static boolean loadDat(String path, String customDicPath[], DoubleArrayTrie<CoreDictionary.Attribute> dat)
{
try
{
if (isDicNeedUpdate(path, customDicPath))
{
return false;
}
ByteArray byteArray = ByteArray.createByteArray(path + Predefine.BIN_EXT);
if (byteArray == null) return false;
int size = byteArray.nextInt();
if (size < 0) // 一种兼容措施,当size小于零表示文件头部储存了-size个用户词性
{
while (++size <= 0)
{
Nature.create(byteArray.nextString());
}
size = byteArray.nextInt();
}
CoreDictionary.Attribute[] attributes = new CoreDictionary.Attribute[size];
final Nature[] natureIndexArray = Nature.values();
for (int i = 0; i < size; ++i)
{
// 第一个是全部频次,第二个是词性个数
int currentTotalFrequency = byteArray.nextInt();
int length = byteArray.nextInt();
attributes[i] = new CoreDictionary.Attribute(length);
attributes[i].totalFrequency = currentTotalFrequency;
for (int j = 0; j < length; ++j)
{
attributes[i].nature[j] = natureIndexArray[byteArray.nextInt()];
attributes[i].frequency[j] = byteArray.nextInt();
}
}
if (!dat.load(byteArray, attributes)) return false;
}
catch (Exception e)
{
logger.warning("读取失败,问题发生在" + TextUtility.exceptionToString(e));
return false;
}
return true;
} } | public class class_name {
public static boolean loadDat(String path, String customDicPath[], DoubleArrayTrie<CoreDictionary.Attribute> dat)
{
try
{
if (isDicNeedUpdate(path, customDicPath))
{
return false; // depends on control dependency: [if], data = [none]
}
ByteArray byteArray = ByteArray.createByteArray(path + Predefine.BIN_EXT);
if (byteArray == null) return false;
int size = byteArray.nextInt();
if (size < 0) // 一种兼容措施,当size小于零表示文件头部储存了-size个用户词性
{
while (++size <= 0)
{
Nature.create(byteArray.nextString()); // depends on control dependency: [while], data = [none]
}
size = byteArray.nextInt(); // depends on control dependency: [if], data = [none]
}
CoreDictionary.Attribute[] attributes = new CoreDictionary.Attribute[size];
final Nature[] natureIndexArray = Nature.values();
for (int i = 0; i < size; ++i)
{
// 第一个是全部频次,第二个是词性个数
int currentTotalFrequency = byteArray.nextInt();
int length = byteArray.nextInt();
attributes[i] = new CoreDictionary.Attribute(length); // depends on control dependency: [for], data = [i]
attributes[i].totalFrequency = currentTotalFrequency; // depends on control dependency: [for], data = [i]
for (int j = 0; j < length; ++j)
{
attributes[i].nature[j] = natureIndexArray[byteArray.nextInt()]; // depends on control dependency: [for], data = [j]
attributes[i].frequency[j] = byteArray.nextInt(); // depends on control dependency: [for], data = [j]
}
}
if (!dat.load(byteArray, attributes)) return false;
}
catch (Exception e)
{
logger.warning("读取失败,问题发生在" + TextUtility.exceptionToString(e));
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public void evaluateAndSet(Object target, Object value) {
try {
Ognl.setValue(getCompiledExpression(), target, value);
}
catch (OgnlException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public void evaluateAndSet(Object target, Object value) {
try {
Ognl.setValue(getCompiledExpression(), target, value); // depends on control dependency: [try], data = [none]
}
catch (OgnlException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public CPMeasurementUnit fetchByG_P_T_First(long groupId, boolean primary,
int type, OrderByComparator<CPMeasurementUnit> orderByComparator) {
List<CPMeasurementUnit> list = findByG_P_T(groupId, primary, type, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CPMeasurementUnit fetchByG_P_T_First(long groupId, boolean primary,
int type, OrderByComparator<CPMeasurementUnit> orderByComparator) {
List<CPMeasurementUnit> list = findByG_P_T(groupId, primary, type, 0,
1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private int renderStructured() {
if(LOGGER.isDebugEnabled() && _padContext != null)
LOGGER.debug("\ncurrentIndex: " + _currentIndex + "\n" +
"checkMaxRepeat: " + _padContext.checkMaxRepeat(_currentIndex) + "\n" +
"checkMinRepeat: " + _padContext.checkMinRepeat(_currentIndex) + "\n");
if(_renderState == INIT) {
_renderState = HEADER;
return EVAL_BODY_AGAIN;
}
if(_renderState == HEADER) {
assert _renderedItems == 0;
/* this would only happen if Pad.maxRepeat == 0 */
if(_padContext != null && _padContext.checkMaxRepeat(_renderedItems)) {
_renderState = FOOTER;
return EVAL_BODY_AGAIN;
}
if(_currentItem == null && _ignoreNulls) {
advanceToNonNullItem();
/* no non-null item was found; render the footer */
if(_currentItem == null) {
doPadding();
// render the header
_renderState = FOOTER;
}
/* non-null item found; it's not the 0th item; render it */
else _renderState = ITEM;
}
/* 0th item is non-null; render it */
else _renderState = ITEM;
return EVAL_BODY_AGAIN;
}
if(_renderState == ITEM) {
_renderedItems++;
/* check that the maximum number of items to render has *not* been reached */
if(_iterator.hasNext() && (_padContext == null || (_padContext != null && !_padContext.checkMaxRepeat(_renderedItems)))) {
_currentIndex++;
_currentItem = _iterator.next();
if(_ignoreNulls && _currentItem == null) {
advanceToNonNullItem();
/* last item */
if(_currentItem == null) {
doPadding();
/* render the header */
_renderState = FOOTER;
return EVAL_BODY_AGAIN;
}
}
/* if _ignoreNulls is false, the _currentItem may be null here */
return EVAL_BODY_AGAIN;
}
/*
have finished rendering items for some reason:
1) there isn't a next item
2) reached the maximum number of items to render
So:
1) pad if necessary
2) render the footer
*/
else {
doPadding();
_renderState = FOOTER;
return EVAL_BODY_AGAIN;
}
}
if(_renderState == FOOTER) {
_renderState = END;
return SKIP_BODY;
}
return SKIP_BODY;
} } | public class class_name {
private int renderStructured() {
if(LOGGER.isDebugEnabled() && _padContext != null)
LOGGER.debug("\ncurrentIndex: " + _currentIndex + "\n" +
"checkMaxRepeat: " + _padContext.checkMaxRepeat(_currentIndex) + "\n" +
"checkMinRepeat: " + _padContext.checkMinRepeat(_currentIndex) + "\n");
if(_renderState == INIT) {
_renderState = HEADER; // depends on control dependency: [if], data = [none]
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
if(_renderState == HEADER) {
assert _renderedItems == 0;
/* this would only happen if Pad.maxRepeat == 0 */
if(_padContext != null && _padContext.checkMaxRepeat(_renderedItems)) {
_renderState = FOOTER; // depends on control dependency: [if], data = [none]
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
if(_currentItem == null && _ignoreNulls) {
advanceToNonNullItem(); // depends on control dependency: [if], data = [none]
/* no non-null item was found; render the footer */
if(_currentItem == null) {
doPadding(); // depends on control dependency: [if], data = [none]
// render the header
_renderState = FOOTER; // depends on control dependency: [if], data = [none]
}
/* non-null item found; it's not the 0th item; render it */
else _renderState = ITEM;
}
/* 0th item is non-null; render it */
else _renderState = ITEM;
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
if(_renderState == ITEM) {
_renderedItems++; // depends on control dependency: [if], data = [none]
/* check that the maximum number of items to render has *not* been reached */
if(_iterator.hasNext() && (_padContext == null || (_padContext != null && !_padContext.checkMaxRepeat(_renderedItems)))) {
_currentIndex++; // depends on control dependency: [if], data = [none]
_currentItem = _iterator.next(); // depends on control dependency: [if], data = [none]
if(_ignoreNulls && _currentItem == null) {
advanceToNonNullItem(); // depends on control dependency: [if], data = [none]
/* last item */
if(_currentItem == null) {
doPadding(); // depends on control dependency: [if], data = [none]
/* render the header */
_renderState = FOOTER; // depends on control dependency: [if], data = [none]
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
}
/* if _ignoreNulls is false, the _currentItem may be null here */
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
/*
have finished rendering items for some reason:
1) there isn't a next item
2) reached the maximum number of items to render
So:
1) pad if necessary
2) render the footer
*/
else {
doPadding(); // depends on control dependency: [if], data = [none]
_renderState = FOOTER; // depends on control dependency: [if], data = [none]
return EVAL_BODY_AGAIN; // depends on control dependency: [if], data = [none]
}
}
if(_renderState == FOOTER) {
_renderState = END; // depends on control dependency: [if], data = [none]
return SKIP_BODY; // depends on control dependency: [if], data = [none]
}
return SKIP_BODY;
} } |
public class class_name {
public void marshall(DeleteEntityRecognizerRequest deleteEntityRecognizerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteEntityRecognizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteEntityRecognizerRequest.getEntityRecognizerArn(), ENTITYRECOGNIZERARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteEntityRecognizerRequest deleteEntityRecognizerRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteEntityRecognizerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteEntityRecognizerRequest.getEntityRecognizerArn(), ENTITYRECOGNIZERARN_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 {
@Nullable
private static AnonymousSocks5Server configureSessionWithProxy(@Nonnull final ProxyConfig proxyConfig,
@Nonnull final Session session,
@Nullable final TransportStrategy transportStrategy) {
if (!proxyConfig.requiresProxy()) {
LOGGER.trace("No proxy set, skipping proxy.");
} else {
if (transportStrategy == TransportStrategy.SMTPS) {
throw new MailSenderException(MailSenderException.INVALID_PROXY_SLL_COMBINATION);
}
final Properties sessionProperties = session.getProperties();
if (transportStrategy != null) {
sessionProperties.put(transportStrategy.propertyNameSocksHost(), assumeNonNull(proxyConfig.getRemoteProxyHost()));
sessionProperties.put(transportStrategy.propertyNameSocksPort(), String.valueOf(proxyConfig.getRemoteProxyPort()));
} else {
LOGGER.debug("no transport strategy provided, expecting mail.smtp(s).socks.host and .port properties to be set to proxy " +
"config on Session");
}
if (proxyConfig.requiresAuthentication()) {
if (transportStrategy != null) {
// wire anonymous proxy request to our own proxy bridge so we can perform authentication to the actual proxy
sessionProperties.put(transportStrategy.propertyNameSocksHost(), "localhost");
sessionProperties.put(transportStrategy.propertyNameSocksPort(), String.valueOf(proxyConfig.getProxyBridgePort()));
} else {
LOGGER.debug("no transport strategy provided but authenticated proxy required, expecting mail.smtp(s).socks.host and .port " +
"properties to be set to localhost and port " + proxyConfig.getProxyBridgePort());
}
return ModuleLoader.loadAuthenticatedSocksModule().createAnonymousSocks5Server(proxyConfig);
}
}
return null;
} } | public class class_name {
@Nullable
private static AnonymousSocks5Server configureSessionWithProxy(@Nonnull final ProxyConfig proxyConfig,
@Nonnull final Session session,
@Nullable final TransportStrategy transportStrategy) {
if (!proxyConfig.requiresProxy()) {
LOGGER.trace("No proxy set, skipping proxy."); // depends on control dependency: [if], data = [none]
} else {
if (transportStrategy == TransportStrategy.SMTPS) {
throw new MailSenderException(MailSenderException.INVALID_PROXY_SLL_COMBINATION);
}
final Properties sessionProperties = session.getProperties();
if (transportStrategy != null) {
sessionProperties.put(transportStrategy.propertyNameSocksHost(), assumeNonNull(proxyConfig.getRemoteProxyHost())); // depends on control dependency: [if], data = [(transportStrategy]
sessionProperties.put(transportStrategy.propertyNameSocksPort(), String.valueOf(proxyConfig.getRemoteProxyPort())); // depends on control dependency: [if], data = [(transportStrategy]
} else {
LOGGER.debug("no transport strategy provided, expecting mail.smtp(s).socks.host and .port properties to be set to proxy " +
"config on Session"); // depends on control dependency: [if], data = [none]
}
if (proxyConfig.requiresAuthentication()) {
if (transportStrategy != null) {
// wire anonymous proxy request to our own proxy bridge so we can perform authentication to the actual proxy
sessionProperties.put(transportStrategy.propertyNameSocksHost(), "localhost"); // depends on control dependency: [if], data = [(transportStrategy]
sessionProperties.put(transportStrategy.propertyNameSocksPort(), String.valueOf(proxyConfig.getProxyBridgePort())); // depends on control dependency: [if], data = [(transportStrategy]
} else {
LOGGER.debug("no transport strategy provided but authenticated proxy required, expecting mail.smtp(s).socks.host and .port " +
"properties to be set to localhost and port " + proxyConfig.getProxyBridgePort()); // depends on control dependency: [if], data = [none]
}
return ModuleLoader.loadAuthenticatedSocksModule().createAnonymousSocks5Server(proxyConfig); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
return; // Skip it if it has not been marked
}
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
return; // Skip deployments with no module
}
AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
List<String> serviceAcitvatorList = new ArrayList<String>();
if (duList!=null && !duList.isEmpty()) {
for (DeploymentUnit du : duList) {
ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);
for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
serviceAcitvatorList.add(serv);
}
}
}
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
if (WildFlySecurityManager.isChecking()) {
//service registry allows you to modify internal server state across all deployments
//if a security manager is present we use a version that has permission checks
serviceRegistry = new SecuredServiceRegistry(serviceRegistry);
}
final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {
try {
for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {
serviceActivator.activate(serviceActivatorContext);
break;
}
}
} catch (ServiceRegistryException e) {
throw new DeploymentUnitProcessingException(e);
}
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
} } | public class class_name {
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES);
if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) {
return; // Skip it if it has not been marked
}
final Module module = deploymentUnit.getAttachment(Attachments.MODULE);
if (module == null) {
return; // Skip deployments with no module
}
AttachmentList<DeploymentUnit> duList = deploymentUnit.getAttachment(Attachments.SUB_DEPLOYMENTS);
List<String> serviceAcitvatorList = new ArrayList<String>();
if (duList!=null && !duList.isEmpty()) {
for (DeploymentUnit du : duList) {
ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES);
for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
serviceAcitvatorList.add(serv); // depends on control dependency: [for], data = [serv]
}
}
}
ServiceRegistry serviceRegistry = phaseContext.getServiceRegistry();
if (WildFlySecurityManager.isChecking()) {
//service registry allows you to modify internal server state across all deployments
//if a security manager is present we use a version that has permission checks
serviceRegistry = new SecuredServiceRegistry(serviceRegistry);
}
final ServiceActivatorContext serviceActivatorContext = new ServiceActivatorContextImpl(phaseContext.getServiceTarget(), serviceRegistry);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) {
try {
for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) {
if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) {
serviceActivator.activate(serviceActivatorContext); // depends on control dependency: [if], data = [none]
break;
}
}
} catch (ServiceRegistryException e) {
throw new DeploymentUnitProcessingException(e);
} // depends on control dependency: [catch], data = [none]
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
} } |
public class class_name {
static <K>
MapMakerInternalMap<K, Dummy, ? extends InternalEntry<K, Dummy, ?>, ?> createWithDummyValues(
MapMaker builder) {
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, StrongKeyDummyValueEntry.Helper.<K>instance());
}
if (builder.getKeyStrength() == Strength.WEAK
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, WeakKeyDummyValueEntry.Helper.<K>instance());
}
if (builder.getValueStrength() == Strength.WEAK) {
throw new IllegalArgumentException("Map cannot have both weak and dummy values");
}
throw new AssertionError();
} } | public class class_name {
static <K>
MapMakerInternalMap<K, Dummy, ? extends InternalEntry<K, Dummy, ?>, ?> createWithDummyValues(
MapMaker builder) {
if (builder.getKeyStrength() == Strength.STRONG
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, StrongKeyDummyValueEntry.Helper.<K>instance()); // depends on control dependency: [if], data = [none]
}
if (builder.getKeyStrength() == Strength.WEAK
&& builder.getValueStrength() == Strength.STRONG) {
return new MapMakerInternalMap<>(builder, WeakKeyDummyValueEntry.Helper.<K>instance()); // depends on control dependency: [if], data = [none]
}
if (builder.getValueStrength() == Strength.WEAK) {
throw new IllegalArgumentException("Map cannot have both weak and dummy values");
}
throw new AssertionError();
} } |
public class class_name {
public Trie lookup(CharSequence s) {
Trie t = this;
for (int i = 0, n = s.length(); i < n; ++i) {
t = t.lookup(s.charAt(i));
if (null == t) { break; }
}
return t;
} } | public class class_name {
public Trie lookup(CharSequence s) {
Trie t = this;
for (int i = 0, n = s.length(); i < n; ++i) {
t = t.lookup(s.charAt(i)); // depends on control dependency: [for], data = [i]
if (null == t) { break; }
}
return t;
} } |
public class class_name {
private boolean isNotInput(String action, String expected, String extra) {
// wait for element to be displayed
if (!is.input()) {
reporter.fail(action, expected, extra + prettyOutput() + NOT_AN_INPUT);
// indicates element not an input
return true;
}
return false;
} } | public class class_name {
private boolean isNotInput(String action, String expected, String extra) {
// wait for element to be displayed
if (!is.input()) {
reporter.fail(action, expected, extra + prettyOutput() + NOT_AN_INPUT); // depends on control dependency: [if], data = [none]
// indicates element not an input
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static boolean checkMergePolicySupportsInMemoryFormat(String name, Object mergePolicy, InMemoryFormat inMemoryFormat,
boolean failFast, ILogger logger) {
if (inMemoryFormat != NATIVE) {
return true;
}
if (mergePolicy instanceof SplitBrainMergePolicy) {
return true;
}
if (failFast) {
throw new InvalidConfigurationException(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
}
logger.warning(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
return false;
} } | public class class_name {
public static boolean checkMergePolicySupportsInMemoryFormat(String name, Object mergePolicy, InMemoryFormat inMemoryFormat,
boolean failFast, ILogger logger) {
if (inMemoryFormat != NATIVE) {
return true; // depends on control dependency: [if], data = [none]
}
if (mergePolicy instanceof SplitBrainMergePolicy) {
return true; // depends on control dependency: [if], data = [none]
}
if (failFast) {
throw new InvalidConfigurationException(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
}
logger.warning(createSplitRecoveryWarningMsg(name, mergePolicy.getClass().getName()));
return false;
} } |
public class class_name {
private final String nGetLoaderPath() {
ClassLoader currentLoader = this;
final StringBuffer buffer = new StringBuffer();
buffer.append(this.name);
while ((currentLoader = currentLoader.getParent()) != null) {
if (currentLoader.getClass() == CClassLoader.class) {
buffer.insert(0, "/");
buffer.insert(0, ((CClassLoader) currentLoader).name);
} else {
break;
}
}
return buffer.toString();
} } | public class class_name {
private final String nGetLoaderPath() {
ClassLoader currentLoader = this;
final StringBuffer buffer = new StringBuffer();
buffer.append(this.name);
while ((currentLoader = currentLoader.getParent()) != null) {
if (currentLoader.getClass() == CClassLoader.class) {
buffer.insert(0, "/"); // depends on control dependency: [if], data = [none]
buffer.insert(0, ((CClassLoader) currentLoader).name); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
return buffer.toString();
} } |
public class class_name {
static boolean compareValues(Object v1, Object v2) {
if (v1.equals(v2)) {
return true;
}
if (isValue(v1) && isValue(v2)
&& Obj.equals(((Map<String, Object>) v1).get("@value"),
((Map<String, Object>) v2).get("@value"))
&& Obj.equals(((Map<String, Object>) v1).get("@type"),
((Map<String, Object>) v2).get("@type"))
&& Obj.equals(((Map<String, Object>) v1).get("@language"),
((Map<String, Object>) v2).get("@language"))
&& Obj.equals(((Map<String, Object>) v1).get("@index"),
((Map<String, Object>) v2).get("@index"))) {
return true;
}
if ((v1 instanceof Map && ((Map<String, Object>) v1).containsKey("@id"))
&& (v2 instanceof Map && ((Map<String, Object>) v2).containsKey("@id"))
&& ((Map<String, Object>) v1).get("@id")
.equals(((Map<String, Object>) v2).get("@id"))) {
return true;
}
return false;
} } | public class class_name {
static boolean compareValues(Object v1, Object v2) {
if (v1.equals(v2)) {
return true; // depends on control dependency: [if], data = [none]
}
if (isValue(v1) && isValue(v2)
&& Obj.equals(((Map<String, Object>) v1).get("@value"),
((Map<String, Object>) v2).get("@value"))
&& Obj.equals(((Map<String, Object>) v1).get("@type"),
((Map<String, Object>) v2).get("@type"))
&& Obj.equals(((Map<String, Object>) v1).get("@language"),
((Map<String, Object>) v2).get("@language"))
&& Obj.equals(((Map<String, Object>) v1).get("@index"),
((Map<String, Object>) v2).get("@index"))) {
return true; // depends on control dependency: [if], data = [none]
}
if ((v1 instanceof Map && ((Map<String, Object>) v1).containsKey("@id"))
&& (v2 instanceof Map && ((Map<String, Object>) v2).containsKey("@id"))
&& ((Map<String, Object>) v1).get("@id")
.equals(((Map<String, Object>) v2).get("@id"))) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public Versioned<V> addChild(String name, V newValue, long newVersion) {
DefaultDocumentTreeNode<V> child = (DefaultDocumentTreeNode<V>) children.get(name);
if (child != null) {
return child.value();
}
children.put(name, new DefaultDocumentTreeNode<>(
new DocumentPath(name, path()), newValue, newVersion, ordering, this));
return null;
} } | public class class_name {
public Versioned<V> addChild(String name, V newValue, long newVersion) {
DefaultDocumentTreeNode<V> child = (DefaultDocumentTreeNode<V>) children.get(name);
if (child != null) {
return child.value(); // depends on control dependency: [if], data = [none]
}
children.put(name, new DefaultDocumentTreeNode<>(
new DocumentPath(name, path()), newValue, newVersion, ordering, this));
return null;
} } |
public class class_name {
private void parseExtras(Bundle icicle){
Intent intent = getIntent();
if(intent != null){
mXmlConfigId = intent.getIntExtra(EXTRA_CONFIG, -1);
mTitle = intent.getStringExtra(EXTRA_TITLE);
}
if(icicle != null){
mXmlConfigId = icicle.getInt(EXTRA_CONFIG, -1);
mTitle = icicle.getString(EXTRA_TITLE);
}
if(mXmlConfigId == -1) finish();
// Set title
if(!TextUtils.isEmpty(mTitle)) getSupportActionBar().setTitle(mTitle);
// Apply Configuration
List<com.ftinc.kit.attributr.model.Library> libs = com.ftinc.kit.attributr.internal.Parser.parse(this, mXmlConfigId);
mAdapter = new com.ftinc.kit.attributr.ui.LibraryAdapter();
mAdapter.addAll(libs);
mAdapter.sort(new com.ftinc.kit.attributr.model.Library.LibraryComparator());
mAdapter.notifyDataSetChanged();
} } | public class class_name {
private void parseExtras(Bundle icicle){
Intent intent = getIntent();
if(intent != null){
mXmlConfigId = intent.getIntExtra(EXTRA_CONFIG, -1); // depends on control dependency: [if], data = [none]
mTitle = intent.getStringExtra(EXTRA_TITLE); // depends on control dependency: [if], data = [none]
}
if(icicle != null){
mXmlConfigId = icicle.getInt(EXTRA_CONFIG, -1); // depends on control dependency: [if], data = [none]
mTitle = icicle.getString(EXTRA_TITLE); // depends on control dependency: [if], data = [none]
}
if(mXmlConfigId == -1) finish();
// Set title
if(!TextUtils.isEmpty(mTitle)) getSupportActionBar().setTitle(mTitle);
// Apply Configuration
List<com.ftinc.kit.attributr.model.Library> libs = com.ftinc.kit.attributr.internal.Parser.parse(this, mXmlConfigId);
mAdapter = new com.ftinc.kit.attributr.ui.LibraryAdapter();
mAdapter.addAll(libs);
mAdapter.sort(new com.ftinc.kit.attributr.model.Library.LibraryComparator());
mAdapter.notifyDataSetChanged();
} } |
public class class_name {
public void init(Record recLayout, PrintWriter out)
{
boolean bFirstTime = false;
boolean bNewRecord = false;
if (out == null)
{ // First time
bFirstTime = true;
if (recLayout == null)
{
recLayout = new Layout((Record.findRecordOwner(null)));
bNewRecord = true;
}
recLayout.getField(Layout.ID).setValue(1);
try {
if (!recLayout.seek("="))
{ // Error - top level not found?
}
} catch (DBException ex) {
ex.printStackTrace();
return;
}
String strFileName = recLayout.getField(Layout.NAME).toString() + ".idl";
try {
FileOutputStream outStream = new FileOutputStream(strFileName);
BufferedOutputStream buffOut = new BufferedOutputStream(outStream);
out = new PrintWriter(buffOut);
} catch (IOException ex) {
ex.printStackTrace();
return;
}
}
this.printIt(recLayout, out, 0, ";");
if (bFirstTime)
out.close();
if (bNewRecord)
recLayout.free();
} } | public class class_name {
public void init(Record recLayout, PrintWriter out)
{
boolean bFirstTime = false;
boolean bNewRecord = false;
if (out == null)
{ // First time
bFirstTime = true; // depends on control dependency: [if], data = [none]
if (recLayout == null)
{
recLayout = new Layout((Record.findRecordOwner(null))); // depends on control dependency: [if], data = [null)]
bNewRecord = true; // depends on control dependency: [if], data = [none]
}
recLayout.getField(Layout.ID).setValue(1); // depends on control dependency: [if], data = [none]
try {
if (!recLayout.seek("="))
{ // Error - top level not found?
}
} catch (DBException ex) {
ex.printStackTrace();
return;
} // depends on control dependency: [catch], data = [none]
String strFileName = recLayout.getField(Layout.NAME).toString() + ".idl";
try {
FileOutputStream outStream = new FileOutputStream(strFileName);
BufferedOutputStream buffOut = new BufferedOutputStream(outStream);
out = new PrintWriter(buffOut); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
ex.printStackTrace();
return;
} // depends on control dependency: [catch], data = [none]
}
this.printIt(recLayout, out, 0, ";");
if (bFirstTime)
out.close();
if (bNewRecord)
recLayout.free();
} } |
public class class_name {
@Override
public void incrementDocCount(String word, long howMuch) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.incrementSequencesCount();
}
} } | public class class_name {
@Override
public void incrementDocCount(String word, long howMuch) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.incrementSequencesCount(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static WebSocketExtension parse(String string)
{
if (string == null)
{
return null;
}
// Split the string by semi-colons.
String[] elements = string.trim().split("\\s*;\\s*");
if (elements.length == 0)
{
// Even an extension name is not included.
return null;
}
// The first element is the extension name.
String name = elements[0];
if (Token.isValid(name) == false)
{
// The extension name is not a valid token.
return null;
}
// Create an instance for the extension name.
WebSocketExtension extension = createInstance(name);
// For each "{key}[={value}]".
for (int i = 1; i < elements.length; ++i)
{
// Split by '=' to get the key and the value.
String[] pair = elements[i].split("\\s*=\\s*", 2);
// If {key} is not contained.
if (pair.length == 0 || pair[0].length() == 0)
{
// Ignore.
continue;
}
// The name of the parameter.
String key = pair[0];
if (Token.isValid(key) == false)
{
// The parameter name is not a valid token.
// Ignore this parameter.
continue;
}
// The value of the parameter.
String value = extractValue(pair);
if (value != null)
{
if (Token.isValid(value) == false)
{
// The parameter value is not a valid token.
// Ignore this parameter.
continue;
}
}
// Add the pair of the key and the value.
extension.setParameter(key, value);
}
return extension;
} } | public class class_name {
public static WebSocketExtension parse(String string)
{
if (string == null)
{
return null; // depends on control dependency: [if], data = [none]
}
// Split the string by semi-colons.
String[] elements = string.trim().split("\\s*;\\s*");
if (elements.length == 0)
{
// Even an extension name is not included.
return null; // depends on control dependency: [if], data = [none]
}
// The first element is the extension name.
String name = elements[0];
if (Token.isValid(name) == false)
{
// The extension name is not a valid token.
return null; // depends on control dependency: [if], data = [none]
}
// Create an instance for the extension name.
WebSocketExtension extension = createInstance(name);
// For each "{key}[={value}]".
for (int i = 1; i < elements.length; ++i)
{
// Split by '=' to get the key and the value.
String[] pair = elements[i].split("\\s*=\\s*", 2);
// If {key} is not contained.
if (pair.length == 0 || pair[0].length() == 0)
{
// Ignore.
continue;
}
// The name of the parameter.
String key = pair[0];
if (Token.isValid(key) == false)
{
// The parameter name is not a valid token.
// Ignore this parameter.
continue;
}
// The value of the parameter.
String value = extractValue(pair);
if (value != null)
{
if (Token.isValid(value) == false)
{
// The parameter value is not a valid token.
// Ignore this parameter.
continue;
}
}
// Add the pair of the key and the value.
extension.setParameter(key, value); // depends on control dependency: [for], data = [none]
}
return extension;
} } |
public class class_name {
public ExcelWriter autoSizeColumnAll() {
final int columnCount = this.getColumnCount();
for (int i = 0; i < columnCount; i++) {
autoSizeColumn(i);
}
return this;
} } | public class class_name {
public ExcelWriter autoSizeColumnAll() {
final int columnCount = this.getColumnCount();
for (int i = 0; i < columnCount; i++) {
autoSizeColumn(i);
// depends on control dependency: [for], data = [i]
}
return this;
} } |
public class class_name {
public <T> Collector<T> createSegmentBasedCollector(long id, Map<Address, Collection<Integer>> backups, int topologyId) {
if (backups.isEmpty()) {
return new PrimaryOwnerOnlyCollector<>();
}
SegmentBasedCollector<T> collector = new SegmentBasedCollector<>(id, backups, topologyId);
BaseAckTarget prev = collectorMap.put(id, collector);
//is it possible the have a previous collector when the topology changes after the first collector is created
//in that case, the previous collector must have a lower topology id
assert prev == null || prev.topologyId < topologyId : format("replaced old collector '%s' by '%s'", prev, collector);
if (trace) {
log.tracef("Created new collector for %s. BackupSegments=%s", id, backups);
}
return collector;
} } | public class class_name {
public <T> Collector<T> createSegmentBasedCollector(long id, Map<Address, Collection<Integer>> backups, int topologyId) {
if (backups.isEmpty()) {
return new PrimaryOwnerOnlyCollector<>(); // depends on control dependency: [if], data = [none]
}
SegmentBasedCollector<T> collector = new SegmentBasedCollector<>(id, backups, topologyId);
BaseAckTarget prev = collectorMap.put(id, collector);
//is it possible the have a previous collector when the topology changes after the first collector is created
//in that case, the previous collector must have a lower topology id
assert prev == null || prev.topologyId < topologyId : format("replaced old collector '%s' by '%s'", prev, collector);
if (trace) {
log.tracef("Created new collector for %s. BackupSegments=%s", id, backups);
}
return collector;
} } |
public class class_name {
public String stripPluralParticiple(String word) {
b = word.toCharArray();
k = word.length() - 1;
if (k > 1 && !word.equalsIgnoreCase("is") && !word.equalsIgnoreCase("was") && !word.equalsIgnoreCase("has") && !word.equalsIgnoreCase("his") && !word.equalsIgnoreCase("this")) {
step1(true);
return new String(b, 0, k+1);
}
return word;
} } | public class class_name {
public String stripPluralParticiple(String word) {
b = word.toCharArray();
k = word.length() - 1;
if (k > 1 && !word.equalsIgnoreCase("is") && !word.equalsIgnoreCase("was") && !word.equalsIgnoreCase("has") && !word.equalsIgnoreCase("his") && !word.equalsIgnoreCase("this")) {
step1(true); // depends on control dependency: [if], data = [none]
return new String(b, 0, k+1); // depends on control dependency: [if], data = [none]
}
return word;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void loadCache() {
if (!cacheManager.isNeedPersist()) {
return;
}
File file = getSaveFile();
if (null == file) {
return;
}
if (!file.exists()) {
return;
}
BufferedInputStream bis = null;
try {
FileInputStream fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024];
int len = -1;
while ((len = bis.read(buf)) != -1) {
baos.write(buf, 0, len);
}
byte retArr[] = baos.toByteArray();
Object obj = getPersistSerializer().deserialize(retArr, null);
if (null != obj && obj instanceof ConcurrentHashMap) {
cacheManager.getCache().putAll((ConcurrentHashMap<String, Object>) obj);
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
if (null != bis) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void loadCache() {
if (!cacheManager.isNeedPersist()) {
return;
// depends on control dependency: [if], data = [none]
}
File file = getSaveFile();
if (null == file) {
return;
// depends on control dependency: [if], data = [none]
}
if (!file.exists()) {
return;
// depends on control dependency: [if], data = [none]
}
BufferedInputStream bis = null;
try {
FileInputStream fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
// depends on control dependency: [try], data = [none]
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[1024];
int len = -1;
while ((len = bis.read(buf)) != -1) {
baos.write(buf, 0, len);
// depends on control dependency: [while], data = [none]
}
byte retArr[] = baos.toByteArray();
Object obj = getPersistSerializer().deserialize(retArr, null);
if (null != obj && obj instanceof ConcurrentHashMap) {
cacheManager.getCache().putAll((ConcurrentHashMap<String, Object>) obj);
// depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
// depends on control dependency: [catch], data = [none]
if (null != bis) {
try {
bis.close();
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
protected void updateResourceType(Window window) {
if (!((CmsModuleRow)m_table.getValue()).equals(
new CmsModuleRow(OpenCms.getModuleManager().getModule(m_type.getModuleName())))) {
CmsModule newModule = ((CmsModuleRow)m_table.getValue()).getModule().clone();
CmsModule oldModule = OpenCms.getModuleManager().getModule(m_type.getModuleName()).clone();
m_type.setModuleName(newModule.getName());
List<I_CmsResourceType> newTypes = Lists.newArrayList(newModule.getResourceTypes());
newTypes.add(m_type);
newModule.setResourceTypes(newTypes);
List<CmsExplorerTypeSettings> oldSettings = new ArrayList<CmsExplorerTypeSettings>(
oldModule.getExplorerTypes());
CmsExplorerTypeSettings settings = new CmsExplorerTypeSettings();
settings.setName(m_type.getTypeName());
settings = oldSettings.get(oldSettings.indexOf(settings));
oldSettings.remove(settings);
List<CmsExplorerTypeSettings> newSettings = new ArrayList<CmsExplorerTypeSettings>(
newModule.getExplorerTypes());
newSettings.add(settings);
oldModule.setExplorerTypes(oldSettings);
newModule.setExplorerTypes(newSettings);
List<I_CmsResourceType> oldTypes = Lists.newArrayList(oldModule.getResourceTypes());
oldTypes.remove(m_type);
oldModule.setResourceTypes(oldTypes);
if (m_schemaOK) {
List<String> oldResources = Lists.newArrayList(oldModule.getResources());
oldResources.remove(m_typeXML.getSchema());
oldModule.setResources(oldResources);
List<String> newResources = Lists.newArrayList(newModule.getResources());
newResources.add(m_typeXML.getSchema());
newModule.setResources(newResources);
}
try {
OpenCms.getModuleManager().updateModule(A_CmsUI.getCmsObject(), oldModule);
OpenCms.getModuleManager().updateModule(A_CmsUI.getCmsObject(), newModule);
OpenCms.getResourceManager().initialize(A_CmsUI.getCmsObject());
OpenCms.getWorkplaceManager().removeExplorerTypeSettings(oldModule);
OpenCms.getWorkplaceManager().addExplorerTypeSettings(newModule);
OpenCms.getWorkplaceManager().initialize(A_CmsUI.getCmsObject());
} catch (CmsException e) {
LOG.error("Unable to move resource type", e);
}
}
window.close();
A_CmsUI.get().reload();
} } | public class class_name {
protected void updateResourceType(Window window) {
if (!((CmsModuleRow)m_table.getValue()).equals(
new CmsModuleRow(OpenCms.getModuleManager().getModule(m_type.getModuleName())))) {
CmsModule newModule = ((CmsModuleRow)m_table.getValue()).getModule().clone();
CmsModule oldModule = OpenCms.getModuleManager().getModule(m_type.getModuleName()).clone();
m_type.setModuleName(newModule.getName()); // depends on control dependency: [if], data = [none]
List<I_CmsResourceType> newTypes = Lists.newArrayList(newModule.getResourceTypes());
newTypes.add(m_type); // depends on control dependency: [if], data = [none]
newModule.setResourceTypes(newTypes); // depends on control dependency: [if], data = [none]
List<CmsExplorerTypeSettings> oldSettings = new ArrayList<CmsExplorerTypeSettings>(
oldModule.getExplorerTypes());
CmsExplorerTypeSettings settings = new CmsExplorerTypeSettings();
settings.setName(m_type.getTypeName()); // depends on control dependency: [if], data = [none]
settings = oldSettings.get(oldSettings.indexOf(settings)); // depends on control dependency: [if], data = [none]
oldSettings.remove(settings); // depends on control dependency: [if], data = [none]
List<CmsExplorerTypeSettings> newSettings = new ArrayList<CmsExplorerTypeSettings>(
newModule.getExplorerTypes());
newSettings.add(settings); // depends on control dependency: [if], data = [none]
oldModule.setExplorerTypes(oldSettings); // depends on control dependency: [if], data = [none]
newModule.setExplorerTypes(newSettings); // depends on control dependency: [if], data = [none]
List<I_CmsResourceType> oldTypes = Lists.newArrayList(oldModule.getResourceTypes());
oldTypes.remove(m_type); // depends on control dependency: [if], data = [none]
oldModule.setResourceTypes(oldTypes); // depends on control dependency: [if], data = [none]
if (m_schemaOK) {
List<String> oldResources = Lists.newArrayList(oldModule.getResources());
oldResources.remove(m_typeXML.getSchema()); // depends on control dependency: [if], data = [none]
oldModule.setResources(oldResources); // depends on control dependency: [if], data = [none]
List<String> newResources = Lists.newArrayList(newModule.getResources());
newResources.add(m_typeXML.getSchema()); // depends on control dependency: [if], data = [none]
newModule.setResources(newResources); // depends on control dependency: [if], data = [none]
}
try {
OpenCms.getModuleManager().updateModule(A_CmsUI.getCmsObject(), oldModule); // depends on control dependency: [try], data = [none]
OpenCms.getModuleManager().updateModule(A_CmsUI.getCmsObject(), newModule); // depends on control dependency: [try], data = [none]
OpenCms.getResourceManager().initialize(A_CmsUI.getCmsObject()); // depends on control dependency: [try], data = [none]
OpenCms.getWorkplaceManager().removeExplorerTypeSettings(oldModule); // depends on control dependency: [try], data = [none]
OpenCms.getWorkplaceManager().addExplorerTypeSettings(newModule); // depends on control dependency: [try], data = [none]
OpenCms.getWorkplaceManager().initialize(A_CmsUI.getCmsObject()); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("Unable to move resource type", e);
} // depends on control dependency: [catch], data = [none]
}
window.close();
A_CmsUI.get().reload();
} } |
public class class_name {
private void fillParams(final Map<String, String[]> params, final String queryString, Charset charset) {
if (StringUtils.hasText(queryString)) {
final StringTokenizer tokenizer = new StringTokenizer(queryString, "&");
while (tokenizer.hasMoreTokens()) {
final String[] nameValuePair = tokenizer.nextToken().split("=");
try {
params.put(URLDecoder.decode(nameValuePair[0], charset.name()),
new String[] { URLDecoder.decode(nameValuePair[1], charset.name()) });
} catch (final UnsupportedEncodingException e) {
throw new CitrusRuntimeException(String.format(
"Failed to decode query param value '%s=%s'",
nameValuePair[0],
nameValuePair[1]), e);
}
}
}
} } | public class class_name {
private void fillParams(final Map<String, String[]> params, final String queryString, Charset charset) {
if (StringUtils.hasText(queryString)) {
final StringTokenizer tokenizer = new StringTokenizer(queryString, "&");
while (tokenizer.hasMoreTokens()) {
final String[] nameValuePair = tokenizer.nextToken().split("=");
try {
params.put(URLDecoder.decode(nameValuePair[0], charset.name()),
new String[] { URLDecoder.decode(nameValuePair[1], charset.name()) }); // depends on control dependency: [try], data = [none]
} catch (final UnsupportedEncodingException e) {
throw new CitrusRuntimeException(String.format(
"Failed to decode query param value '%s=%s'",
nameValuePair[0],
nameValuePair[1]), e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public void marshall(ListVoiceConnectorTerminationCredentialsRequest listVoiceConnectorTerminationCredentialsRequest, ProtocolMarshaller protocolMarshaller) {
if (listVoiceConnectorTerminationCredentialsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listVoiceConnectorTerminationCredentialsRequest.getVoiceConnectorId(), VOICECONNECTORID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListVoiceConnectorTerminationCredentialsRequest listVoiceConnectorTerminationCredentialsRequest, ProtocolMarshaller protocolMarshaller) {
if (listVoiceConnectorTerminationCredentialsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listVoiceConnectorTerminationCredentialsRequest.getVoiceConnectorId(), VOICECONNECTORID_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 synchronized void stop() {
running = false;
pool.shutdown();
try {
if (!pool.awaitTermination(60, TimeUnit.SECONDS))
pool.shutdownNow();
if (!serverSocket.isClosed())
this.serverSocket.close();
} catch (IOException e) {
DBP.printerror("Error closing Socket.");
DBP.printException(e);
} catch (InterruptedException ie) {
DBP.printerror("Error shutting down threadpool.");
DBP.printException(ie);
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
}
} } | public class class_name {
public synchronized void stop() {
running = false;
pool.shutdown();
try {
if (!pool.awaitTermination(60, TimeUnit.SECONDS))
pool.shutdownNow();
if (!serverSocket.isClosed())
this.serverSocket.close();
} catch (IOException e) {
DBP.printerror("Error closing Socket.");
DBP.printException(e);
} catch (InterruptedException ie) { // depends on control dependency: [catch], data = [none]
DBP.printerror("Error shutting down threadpool.");
DBP.printException(ie);
// (Re-)Cancel if current thread also interrupted
pool.shutdownNow();
// Preserve interrupt status
Thread.currentThread().interrupt();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void iterate(int dimension, int n, int[] size, int[] res, int dimension2, int n2, int[] size2,
int[] res2, CoordinateFunction func) {
if (dimension >= n || dimension2 >= n2) {
// stop clause
func.process(ArrayUtil.toLongArray(res), ArrayUtil.toLongArray(res2));
return;
}
if (size2.length != size.length) {
if (dimension >= size.length)
return;
for (int i = 0; i < size[dimension]; i++) {
if (dimension2 >= size2.length)
break;
for (int j = 0; j < size2[dimension2]; j++) {
res[dimension] = i;
res2[dimension2] = j;
iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func);
}
}
} else {
if (dimension >= size.length)
return;
for (int i = 0; i < size[dimension]; i++) {
for (int j = 0; j < size2[dimension2]; j++) {
if (dimension2 >= size2.length)
break;
res[dimension] = i;
res2[dimension2] = j;
iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func);
}
}
}
} } | public class class_name {
public static void iterate(int dimension, int n, int[] size, int[] res, int dimension2, int n2, int[] size2,
int[] res2, CoordinateFunction func) {
if (dimension >= n || dimension2 >= n2) {
// stop clause
func.process(ArrayUtil.toLongArray(res), ArrayUtil.toLongArray(res2)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (size2.length != size.length) {
if (dimension >= size.length)
return;
for (int i = 0; i < size[dimension]; i++) {
if (dimension2 >= size2.length)
break;
for (int j = 0; j < size2[dimension2]; j++) {
res[dimension] = i; // depends on control dependency: [for], data = [none]
res2[dimension2] = j; // depends on control dependency: [for], data = [j]
iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func); // depends on control dependency: [for], data = [none]
}
}
} else {
if (dimension >= size.length)
return;
for (int i = 0; i < size[dimension]; i++) {
for (int j = 0; j < size2[dimension2]; j++) {
if (dimension2 >= size2.length)
break;
res[dimension] = i; // depends on control dependency: [for], data = [none]
res2[dimension2] = j; // depends on control dependency: [for], data = [j]
iterate(dimension + 1, n, size, res, dimension2 + 1, n2, size2, res2, func); // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
public int computeCrossings(
int crossings,
int x0, int y0,
int x1, int y1) {
int numCrosses =
Segment2ai.calculatesCrossingsRectangleShadowSegment(crossings,
this.boundingMinX,
this.boundingMinY,
this.boundingMaxX,
this.boundingMaxY,
x0, y0,
x1, y1);
if (numCrosses == GeomConstants.SHAPE_INTERSECTS) {
// The segment is intersecting the bounds of the shadow path.
// We must consider the shape of shadow path now.
this.crossings = 0;
this.hasX4ymin = false;
this.hasX4ymax = false;
this.x4ymin = this.boundingMinX;
this.x4ymax = this.boundingMinX;
final PathIterator2ai<?> iterator;
if (this.started) {
iterator = this.pathIterator.restartIterations();
} else {
this.started = true;
iterator = this.pathIterator;
}
discretizePathIterator(
iterator,
x0, y0, x1, y1);
// Test if the shape is intesecting the shadow shape.
final int mask = iterator.getWindingRule() == PathWindingRule.NON_ZERO ? -1 : 2;
if (this.crossings == GeomConstants.SHAPE_INTERSECTS
|| (this.crossings & mask) != 0) {
// The given line is intersecting the path shape
return GeomConstants.SHAPE_INTERSECTS;
}
// There is no intersection with the shadow path's shape.
int inc = 0;
if (this.hasX4ymin) {
++inc;
}
if (this.hasX4ymax) {
++inc;
}
if (y0 < y1) {
numCrosses = inc;
} else {
numCrosses = -inc;
}
// Apply the previously computed crossings
numCrosses += crossings;
}
return numCrosses;
} } | public class class_name {
public int computeCrossings(
int crossings,
int x0, int y0,
int x1, int y1) {
int numCrosses =
Segment2ai.calculatesCrossingsRectangleShadowSegment(crossings,
this.boundingMinX,
this.boundingMinY,
this.boundingMaxX,
this.boundingMaxY,
x0, y0,
x1, y1);
if (numCrosses == GeomConstants.SHAPE_INTERSECTS) {
// The segment is intersecting the bounds of the shadow path.
// We must consider the shape of shadow path now.
this.crossings = 0; // depends on control dependency: [if], data = [none]
this.hasX4ymin = false; // depends on control dependency: [if], data = [none]
this.hasX4ymax = false; // depends on control dependency: [if], data = [none]
this.x4ymin = this.boundingMinX; // depends on control dependency: [if], data = [none]
this.x4ymax = this.boundingMinX; // depends on control dependency: [if], data = [none]
final PathIterator2ai<?> iterator;
if (this.started) {
iterator = this.pathIterator.restartIterations(); // depends on control dependency: [if], data = [none]
} else {
this.started = true; // depends on control dependency: [if], data = [none]
iterator = this.pathIterator; // depends on control dependency: [if], data = [none]
}
discretizePathIterator(
iterator,
x0, y0, x1, y1); // depends on control dependency: [if], data = [none]
// Test if the shape is intesecting the shadow shape.
final int mask = iterator.getWindingRule() == PathWindingRule.NON_ZERO ? -1 : 2;
if (this.crossings == GeomConstants.SHAPE_INTERSECTS
|| (this.crossings & mask) != 0) {
// The given line is intersecting the path shape
return GeomConstants.SHAPE_INTERSECTS; // depends on control dependency: [if], data = [GeomConstants.SHAP]
}
// There is no intersection with the shadow path's shape.
int inc = 0;
if (this.hasX4ymin) {
++inc; // depends on control dependency: [if], data = [none]
}
if (this.hasX4ymax) {
++inc; // depends on control dependency: [if], data = [none]
}
if (y0 < y1) {
numCrosses = inc; // depends on control dependency: [if], data = [none]
} else {
numCrosses = -inc; // depends on control dependency: [if], data = [none]
}
// Apply the previously computed crossings
numCrosses += crossings; // depends on control dependency: [if], data = [none]
}
return numCrosses;
} } |
public class class_name {
public Plugin stopPlugin(final String pluginName) {
synchronized (pluginMap) {
Plugin plugin = (Plugin) pluginMap.get(pluginName);
if (plugin == null) {
return null;
}
// shutdown the plugin
plugin.shutdown();
// remove it from the plugin map
pluginMap.remove(pluginName);
firePluginStopped(plugin);
// return it for future use
return plugin;
}
} } | public class class_name {
public Plugin stopPlugin(final String pluginName) {
synchronized (pluginMap) {
Plugin plugin = (Plugin) pluginMap.get(pluginName);
if (plugin == null) {
return null; // depends on control dependency: [if], data = [none]
}
// shutdown the plugin
plugin.shutdown();
// remove it from the plugin map
pluginMap.remove(pluginName);
firePluginStopped(plugin);
// return it for future use
return plugin;
}
} } |
public class class_name {
public Tags and(@Nullable String... keyValues) {
if (keyValues == null || keyValues.length == 0) {
return this;
}
return and(Tags.of(keyValues));
} } | public class class_name {
public Tags and(@Nullable String... keyValues) {
if (keyValues == null || keyValues.length == 0) {
return this; // depends on control dependency: [if], data = [none]
}
return and(Tags.of(keyValues));
} } |
public class class_name {
public static long calculateExpirationWithDelay(long timeInMillis, long delayMillis, boolean backup) {
checkNotNegative(timeInMillis, "timeInMillis can't be negative");
if (backup) {
long delayedTime = timeInMillis + delayMillis;
// check for a potential long overflow
if (delayedTime < 0) {
return Long.MAX_VALUE;
} else {
return delayedTime;
}
}
return timeInMillis;
} } | public class class_name {
public static long calculateExpirationWithDelay(long timeInMillis, long delayMillis, boolean backup) {
checkNotNegative(timeInMillis, "timeInMillis can't be negative");
if (backup) {
long delayedTime = timeInMillis + delayMillis;
// check for a potential long overflow
if (delayedTime < 0) {
return Long.MAX_VALUE; // depends on control dependency: [if], data = [none]
} else {
return delayedTime; // depends on control dependency: [if], data = [none]
}
}
return timeInMillis;
} } |
public class class_name {
public static synchronized void removeChannel(String channelId) {
try {
if (_removeChannel(channelId)) {
save();
}
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while removing channel " + channelId, ex);
}
} } | public class class_name {
public static synchronized void removeChannel(String channelId) {
try {
if (_removeChannel(channelId)) {
save(); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
Log.e(WonderPush.TAG, "Unexpected error while removing channel " + channelId, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public long getTotalRevenueTimeForTrips (Collection<Trip> trips) {
TIntList times = new TIntArrayList();
for (Trip trip : trips) {
StopTime first;
StopTime last;
Spliterator<StopTime> stopTimes = feed.getOrderedStopTimesForTrip(trip.trip_id).spliterator();;
first = StreamSupport.stream(stopTimes, false)
.findFirst()
.orElse(null);
last = StreamSupport.stream(stopTimes, false)
.reduce((a, b) -> b)
.orElse(null);
if (last != null && first != null) {
// revenue time should not include layovers at termini
int time = last.arrival_time - first.departure_time;
times.add(time);
}
}
return times.sum();
} } | public class class_name {
public long getTotalRevenueTimeForTrips (Collection<Trip> trips) {
TIntList times = new TIntArrayList();
for (Trip trip : trips) {
StopTime first;
StopTime last;
Spliterator<StopTime> stopTimes = feed.getOrderedStopTimesForTrip(trip.trip_id).spliterator();;
first = StreamSupport.stream(stopTimes, false)
.findFirst()
.orElse(null); // depends on control dependency: [for], data = [none]
last = StreamSupport.stream(stopTimes, false)
.reduce((a, b) -> b)
.orElse(null); // depends on control dependency: [for], data = [none]
if (last != null && first != null) {
// revenue time should not include layovers at termini
int time = last.arrival_time - first.departure_time;
times.add(time); // depends on control dependency: [if], data = [none]
}
}
return times.sum();
} } |
public class class_name {
@SuppressWarnings("unchecked")
public final T[] filter(final T[] objects) {
final Collection<T> filtered = filter(Arrays.asList(objects));
try {
return filtered.toArray((T[]) Array.newInstance(objects
.getClass(), filtered.size()));
} catch (ArrayStoreException ase) {
Logger log = LoggerFactory.getLogger(Filter.class);
log.warn("Error converting to array - using default approach", ase);
}
return (T[]) filtered.toArray();
} } | public class class_name {
@SuppressWarnings("unchecked")
public final T[] filter(final T[] objects) {
final Collection<T> filtered = filter(Arrays.asList(objects));
try {
return filtered.toArray((T[]) Array.newInstance(objects
.getClass(), filtered.size())); // depends on control dependency: [try], data = [none]
} catch (ArrayStoreException ase) {
Logger log = LoggerFactory.getLogger(Filter.class);
log.warn("Error converting to array - using default approach", ase);
} // depends on control dependency: [catch], data = [none]
return (T[]) filtered.toArray();
} } |
public class class_name {
private static String convertToStandardName(String internalName) {
if (internalName.equals("SHA")) {
return "SHA-1";
} else if (internalName.equals("SHA224")) {
return "SHA-224";
} else if (internalName.equals("SHA256")) {
return "SHA-256";
} else if (internalName.equals("SHA384")) {
return "SHA-384";
} else if (internalName.equals("SHA512")) {
return "SHA-512";
} else {
return internalName;
}
} } | public class class_name {
private static String convertToStandardName(String internalName) {
if (internalName.equals("SHA")) {
return "SHA-1"; // depends on control dependency: [if], data = [none]
} else if (internalName.equals("SHA224")) {
return "SHA-224"; // depends on control dependency: [if], data = [none]
} else if (internalName.equals("SHA256")) {
return "SHA-256"; // depends on control dependency: [if], data = [none]
} else if (internalName.equals("SHA384")) {
return "SHA-384"; // depends on control dependency: [if], data = [none]
} else if (internalName.equals("SHA512")) {
return "SHA-512"; // depends on control dependency: [if], data = [none]
} else {
return internalName; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void saveProperties(Command afterSaveCommand) {
Map<String, String> properties = new HashMap<String, String>();
for (Widget property : m_propertiesPanel) {
CmsPropertyForm form = ((CmsPropertyForm)property);
if (form.isChanged()) {
properties.put(form.getId(), form.getValue());
}
}
m_handler.saveProperties(properties, afterSaveCommand);
} } | public class class_name {
public void saveProperties(Command afterSaveCommand) {
Map<String, String> properties = new HashMap<String, String>();
for (Widget property : m_propertiesPanel) {
CmsPropertyForm form = ((CmsPropertyForm)property);
if (form.isChanged()) {
properties.put(form.getId(), form.getValue()); // depends on control dependency: [if], data = [none]
}
}
m_handler.saveProperties(properties, afterSaveCommand);
} } |
public class class_name {
public List<String[]> getAllMatches(String string) {
Matcher matcher = pattern.matcher(string);
List<String[]> matched = new ArrayList<String[]>();
while(matcher.find()) {
int count = matcher.groupCount();
String [] strings = new String[count];
for(int i = 0; i < count; ++i) {
strings[i] = matcher.group(i+1);
}
matched.add(strings);
}
return matched;
} } | public class class_name {
public List<String[]> getAllMatches(String string) {
Matcher matcher = pattern.matcher(string);
List<String[]> matched = new ArrayList<String[]>();
while(matcher.find()) {
int count = matcher.groupCount();
String [] strings = new String[count];
for(int i = 0; i < count; ++i) {
strings[i] = matcher.group(i+1); // depends on control dependency: [for], data = [i]
}
matched.add(strings); // depends on control dependency: [while], data = [none]
}
return matched;
} } |
public class class_name {
private StringBuilder queryProcessing(TmdbParameters params) {
StringBuilder urlString = new StringBuilder();
// Append the suffix of the API URL
if (submethod != MethodSub.NONE) {
urlString.append("/").append(submethod.getValue());
}
// Append the key information
urlString.append(DELIMITER_FIRST)
.append(Param.API_KEY.getValue())
.append(apiKey)
.append(DELIMITER_SUBSEQUENT)// Append the search term
.append(Param.QUERY.getValue());
String query = (String) params.get(Param.QUERY);
try {
urlString.append(URLEncoder.encode(query, "UTF-8"));
} catch (UnsupportedEncodingException ex) {
LOG.trace("Unable to encode query: '{}' trying raw.", query, ex);
// If we can't encode it, try it raw
urlString.append(query);
}
return urlString;
} } | public class class_name {
private StringBuilder queryProcessing(TmdbParameters params) {
StringBuilder urlString = new StringBuilder();
// Append the suffix of the API URL
if (submethod != MethodSub.NONE) {
urlString.append("/").append(submethod.getValue()); // depends on control dependency: [if], data = [(submethod]
}
// Append the key information
urlString.append(DELIMITER_FIRST)
.append(Param.API_KEY.getValue())
.append(apiKey)
.append(DELIMITER_SUBSEQUENT)// Append the search term
.append(Param.QUERY.getValue());
String query = (String) params.get(Param.QUERY);
try {
urlString.append(URLEncoder.encode(query, "UTF-8")); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException ex) {
LOG.trace("Unable to encode query: '{}' trying raw.", query, ex);
// If we can't encode it, try it raw
urlString.append(query);
} // depends on control dependency: [catch], data = [none]
return urlString;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public Map<String, String> getPartials() {
final View view = this.getView();
if (view != null && view instanceof MustacheView) {
MustacheView mustacheView = (MustacheView) view;
return mustacheView.getAliases();
} else {
final Object object = getModelMap().get(MustacheSettings.PARTIALS_KEY);
if (object != null && !(object instanceof Map)) {
throw new MustachePartialsMappingException();
}
final Map<String, String> map;
if (object == null) {
map = new HashMap<String, String>();
} else {
map = (Map<String, String>) object;
}
return map;
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public Map<String, String> getPartials() {
final View view = this.getView();
if (view != null && view instanceof MustacheView) {
MustacheView mustacheView = (MustacheView) view;
return mustacheView.getAliases(); // depends on control dependency: [if], data = [none]
} else {
final Object object = getModelMap().get(MustacheSettings.PARTIALS_KEY);
if (object != null && !(object instanceof Map)) {
throw new MustachePartialsMappingException();
}
final Map<String, String> map;
if (object == null) {
map = new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
} else {
map = (Map<String, String>) object; // depends on control dependency: [if], data = [none]
}
return map; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void close() {
if (watchdog != null) {
watchdog.cancel();
watchdog = null;
}
disconnect();
// clear nodes collection and send queue
for (Object listener : this.zwaveEventListeners.toArray()) {
if (!(listener instanceof ZWaveNode))
continue;
this.zwaveEventListeners.remove(listener);
}
this.zwaveNodes.clear();
this.sendQueue.clear();
logger.info("Stopped Z-Wave controller");
} } | public class class_name {
public void close() {
if (watchdog != null) {
watchdog.cancel(); // depends on control dependency: [if], data = [none]
watchdog = null; // depends on control dependency: [if], data = [none]
}
disconnect();
// clear nodes collection and send queue
for (Object listener : this.zwaveEventListeners.toArray()) {
if (!(listener instanceof ZWaveNode))
continue;
this.zwaveEventListeners.remove(listener); // depends on control dependency: [for], data = [listener]
}
this.zwaveNodes.clear();
this.sendQueue.clear();
logger.info("Stopped Z-Wave controller");
} } |
public class class_name {
@Override
protected void afterPaint(final RenderContext renderContext) {
super.afterPaint(renderContext);
if (profileBtn.isPressed()) {
// UIC serialization stats
UicStats stats = new UicStats(UIContextHolder.getCurrent());
WComponent currentComp = this.getCurrentComponent();
if (currentComp != null) {
stats.analyseWC(currentComp);
}
if (renderContext instanceof WebXmlRenderContext) {
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
writer.println("<hr />");
writer.println("<h2>Serialization Profile of UIC</h2>");
UicStatsAsHtml.write(writer, stats);
if (currentComp != null) {
writer.println("<hr />");
writer.println("<h2>ObjectProfiler - " + currentComp + "</h2>");
writer.println("<pre>");
try {
writer.println(ObjectGraphDump.dump(currentComp).toFlatSummary());
} catch (Exception e) {
LOG.error("Failed to dump component", e);
}
writer.println("</pre>");
}
}
}
} } | public class class_name {
@Override
protected void afterPaint(final RenderContext renderContext) {
super.afterPaint(renderContext);
if (profileBtn.isPressed()) {
// UIC serialization stats
UicStats stats = new UicStats(UIContextHolder.getCurrent());
WComponent currentComp = this.getCurrentComponent();
if (currentComp != null) {
stats.analyseWC(currentComp); // depends on control dependency: [if], data = [(currentComp]
}
if (renderContext instanceof WebXmlRenderContext) {
PrintWriter writer = ((WebXmlRenderContext) renderContext).getWriter();
writer.println("<hr />"); // depends on control dependency: [if], data = [none]
writer.println("<h2>Serialization Profile of UIC</h2>"); // depends on control dependency: [if], data = [none]
UicStatsAsHtml.write(writer, stats); // depends on control dependency: [if], data = [none]
if (currentComp != null) {
writer.println("<hr />"); // depends on control dependency: [if], data = [none]
writer.println("<h2>ObjectProfiler - " + currentComp + "</h2>"); // depends on control dependency: [if], data = [none]
writer.println("<pre>"); // depends on control dependency: [if], data = [none]
try {
writer.println(ObjectGraphDump.dump(currentComp).toFlatSummary()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Failed to dump component", e);
} // depends on control dependency: [catch], data = [none]
writer.println("</pre>"); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void marshall(UpdateUserPoolDomainRequest updateUserPoolDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (updateUserPoolDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateUserPoolDomainRequest.getDomain(), DOMAIN_BINDING);
protocolMarshaller.marshall(updateUserPoolDomainRequest.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(updateUserPoolDomainRequest.getCustomDomainConfig(), CUSTOMDOMAINCONFIG_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateUserPoolDomainRequest updateUserPoolDomainRequest, ProtocolMarshaller protocolMarshaller) {
if (updateUserPoolDomainRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateUserPoolDomainRequest.getDomain(), DOMAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserPoolDomainRequest.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateUserPoolDomainRequest.getCustomDomainConfig(), CUSTOMDOMAINCONFIG_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public EClass getIfcProduct() {
if (ifcProductEClass == null) {
ifcProductEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(454);
}
return ifcProductEClass;
} } | public class class_name {
@Override
public EClass getIfcProduct() {
if (ifcProductEClass == null) {
ifcProductEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(454);
// depends on control dependency: [if], data = [none]
}
return ifcProductEClass;
} } |
public class class_name {
public Configuration fromFile(String path) throws ConfigurationLoadException {
PropertiesConfiguration propertiesConfiguration =
setupConfiguration(new PropertiesConfiguration());
propertiesConfiguration.setFileName(path);
try {
propertiesConfiguration.load();
} catch (ConfigurationException e) {
if (Throwables.getRootCause(e) instanceof AccessControlException){
AdsServiceLoggers.ADS_API_LIB_LOG.debug("Properties could not be loaded.", e);
} else {
throw new ConfigurationLoadException(
"Encountered a problem reading the provided configuration file \"" + path + "\"!", e);
}
}
return propertiesConfiguration;
} } | public class class_name {
public Configuration fromFile(String path) throws ConfigurationLoadException {
PropertiesConfiguration propertiesConfiguration =
setupConfiguration(new PropertiesConfiguration());
propertiesConfiguration.setFileName(path);
try {
propertiesConfiguration.load();
} catch (ConfigurationException e) {
if (Throwables.getRootCause(e) instanceof AccessControlException){
AdsServiceLoggers.ADS_API_LIB_LOG.debug("Properties could not be loaded.", e); // depends on control dependency: [if], data = [none]
} else {
throw new ConfigurationLoadException(
"Encountered a problem reading the provided configuration file \"" + path + "\"!", e);
}
}
return propertiesConfiguration;
} } |
public class class_name {
public Expression add(String field, JsonNode value) {
try {
((ObjectNode) node).set(field, value);
return this;
} catch (ClassCastException e) {
throw new RuntimeException("Object node expected while adding " + field);
}
} } | public class class_name {
public Expression add(String field, JsonNode value) {
try {
((ObjectNode) node).set(field, value); // depends on control dependency: [try], data = [none]
return this; // depends on control dependency: [try], data = [none]
} catch (ClassCastException e) {
throw new RuntimeException("Object node expected while adding " + field);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private CmsADESessionCache getSessionCache() {
if (m_sessionCache == null) {
m_sessionCache = CmsADESessionCache.getCache(getRequest(), getCmsObject());
}
return m_sessionCache;
} } | public class class_name {
private CmsADESessionCache getSessionCache() {
if (m_sessionCache == null) {
m_sessionCache = CmsADESessionCache.getCache(getRequest(), getCmsObject()); // depends on control dependency: [if], data = [none]
}
return m_sessionCache;
} } |
public class class_name {
@Override
public LoginCredential getLoginCredential() {
return LaRequestUtil
.getOptionalRequest()
.map(request -> {
final HttpServletResponse response = LaResponseUtil.getResponse();
final SpnegoHttpServletResponse spnegoResponse = new SpnegoHttpServletResponse(response);
// client/caller principal
final SpnegoPrincipal principal;
try {
principal = getAuthenticator().authenticate(request, spnegoResponse);
} catch (final Exception e) {
final String msg = "HTTP Authorization Header=" + request.getHeader(Constants.AUTHZ_HEADER);
if (logger.isDebugEnabled()) {
logger.debug(msg);
}
throw new SsoLoginException(msg, e);
}
// context/auth loop not yet complete
if (spnegoResponse.isStatusSet()) {
return new ActionResponseCredential(() -> {
throw new RequestLoggingFilter.RequestClientErrorException("Your request is not authorized.",
"401 Unauthorized", HttpServletResponse.SC_UNAUTHORIZED);
});
}
// assert
if (null == principal) {
final String msg = "Principal was null.";
if (logger.isDebugEnabled()) {
logger.debug(msg);
}
throw new SsoLoginException(msg);
}
if (logger.isDebugEnabled()) {
logger.debug("principal=" + principal);
}
final String[] username = principal.getName().split("@", 2);
return new SpnegoCredential(username[0]);
}).orElseGet(() -> null);
} } | public class class_name {
@Override
public LoginCredential getLoginCredential() {
return LaRequestUtil
.getOptionalRequest()
.map(request -> {
final HttpServletResponse response = LaResponseUtil.getResponse();
final SpnegoHttpServletResponse spnegoResponse = new SpnegoHttpServletResponse(response);
// client/caller principal
final SpnegoPrincipal principal;
try {
principal = getAuthenticator().authenticate(request, spnegoResponse); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
final String msg = "HTTP Authorization Header=" + request.getHeader(Constants.AUTHZ_HEADER);
if (logger.isDebugEnabled()) {
logger.debug(msg); // depends on control dependency: [if], data = [none]
}
throw new SsoLoginException(msg, e);
} // depends on control dependency: [catch], data = [none]
// context/auth loop not yet complete
if (spnegoResponse.isStatusSet()) {
return new ActionResponseCredential(() -> {
throw new RequestLoggingFilter.RequestClientErrorException("Your request is not authorized.",
"401 Unauthorized", HttpServletResponse.SC_UNAUTHORIZED); // depends on control dependency: [if], data = [none]
});
}
// assert
if (null == principal) {
final String msg = "Principal was null.";
if (logger.isDebugEnabled()) {
logger.debug(msg); // depends on control dependency: [if], data = [none]
}
throw new SsoLoginException(msg);
}
if (logger.isDebugEnabled()) {
logger.debug("principal=" + principal);
}
final String[] username = principal.getName().split("@", 2);
return new SpnegoCredential(username[0]);
}).orElseGet(() -> null);
} } |
public class class_name {
static synchronized Accessor accessorFor(Class<?> type, Method method,
Configuration configuration, String name) {
PropertyInfoKey key = new PropertyInfoKey(type, name, configuration);
Accessor accessor = ACCESSOR_CACHE.get(key);
if (accessor == null) {
accessor = new MethodAccessor(type, method, name);
ACCESSOR_CACHE.put(key, accessor);
}
return accessor;
} } | public class class_name {
static synchronized Accessor accessorFor(Class<?> type, Method method,
Configuration configuration, String name) {
PropertyInfoKey key = new PropertyInfoKey(type, name, configuration);
Accessor accessor = ACCESSOR_CACHE.get(key);
if (accessor == null) {
accessor = new MethodAccessor(type, method, name);
// depends on control dependency: [if], data = [none]
ACCESSOR_CACHE.put(key, accessor);
// depends on control dependency: [if], data = [none]
}
return accessor;
} } |
public class class_name {
public static String serialize(Object[] objs)
{
StringBuffer buff = new StringBuffer();
for(int i = 0; i < objs.length; i++)
{
if(objs[i] != null)
{
buff.append(objs[i].toString());
if(i != objs.length-1)
buff.append(",");
}
}
return buff.toString();
} } | public class class_name {
public static String serialize(Object[] objs)
{
StringBuffer buff = new StringBuffer();
for(int i = 0; i < objs.length; i++)
{
if(objs[i] != null)
{
buff.append(objs[i].toString()); // depends on control dependency: [if], data = [(objs[i]]
if(i != objs.length-1)
buff.append(",");
}
}
return buff.toString();
} } |
public class class_name {
public DBInstance withEnabledCloudwatchLogsExports(String... enabledCloudwatchLogsExports) {
if (this.enabledCloudwatchLogsExports == null) {
setEnabledCloudwatchLogsExports(new java.util.ArrayList<String>(enabledCloudwatchLogsExports.length));
}
for (String ele : enabledCloudwatchLogsExports) {
this.enabledCloudwatchLogsExports.add(ele);
}
return this;
} } | public class class_name {
public DBInstance withEnabledCloudwatchLogsExports(String... enabledCloudwatchLogsExports) {
if (this.enabledCloudwatchLogsExports == null) {
setEnabledCloudwatchLogsExports(new java.util.ArrayList<String>(enabledCloudwatchLogsExports.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : enabledCloudwatchLogsExports) {
this.enabledCloudwatchLogsExports.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void uninstallBundle(final String symbolicName, final String version) {
Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null);
if (bundle != null) {
stateChanged = true;
Logger.info("Uninstalling bundle: " + bundle);
BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class);
if (bundleStartLevel.getStartLevel() < currentFrameworkStartLevelValue) {
setFrameworkStartLevel(bundleStartLevel.getStartLevel());
}
try {
bundle.uninstall();
} catch (BundleException e) {
Logger.error("Error during uninstalling bundle: " + bundle.toString(), e);
}
}
} } | public class class_name {
public void uninstallBundle(final String symbolicName, final String version) {
Bundle bundle = bundleDeployerService.getExistingBundleBySymbolicName(symbolicName, version, null);
if (bundle != null) {
stateChanged = true; // depends on control dependency: [if], data = [none]
Logger.info("Uninstalling bundle: " + bundle); // depends on control dependency: [if], data = [none]
BundleStartLevel bundleStartLevel = bundle.adapt(BundleStartLevel.class);
if (bundleStartLevel.getStartLevel() < currentFrameworkStartLevelValue) {
setFrameworkStartLevel(bundleStartLevel.getStartLevel()); // depends on control dependency: [if], data = [(bundleStartLevel.getStartLevel()]
}
try {
bundle.uninstall(); // depends on control dependency: [try], data = [none]
} catch (BundleException e) {
Logger.error("Error during uninstalling bundle: " + bundle.toString(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setAnimationBackend(@Nullable T animationBackend) {
mAnimationBackend = animationBackend;
if (mAnimationBackend != null) {
applyBackendProperties(mAnimationBackend);
}
} } | public class class_name {
public void setAnimationBackend(@Nullable T animationBackend) {
mAnimationBackend = animationBackend;
if (mAnimationBackend != null) {
applyBackendProperties(mAnimationBackend); // depends on control dependency: [if], data = [(mAnimationBackend]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.