code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static <T> T getPropertyValue(final Object instance, final String fieldName) {
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
} catch (final Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static <T> T getPropertyValue(final Object instance, final String fieldName) {
try {
return (T) PropertyUtils.getProperty(instance, fieldName);
// depends on control dependency: [try], data = [none]
} catch (final Exception e) {
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public CaseExecutionEntity getCaseExecution() {
if (caseExecutionId != null) {
return Context
.getCommandContext()
.getCaseExecutionManager()
.findCaseExecutionById(caseExecutionId);
}
return null;
} } | public class class_name {
public CaseExecutionEntity getCaseExecution() {
if (caseExecutionId != null) {
return Context
.getCommandContext()
.getCaseExecutionManager()
.findCaseExecutionById(caseExecutionId); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public String getEditorParameter(CmsObject cms, String editor, String param) {
String path = OpenCms.getSystemInfo().getConfigFilePath(cms, "editors/" + editor + ".properties");
CmsVfsMemoryObjectCache cache = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache();
CmsParameterConfiguration config = (CmsParameterConfiguration)cache.getCachedObject(cms, path);
if (config == null) {
try {
CmsFile file = cms.readFile(path);
try (ByteArrayInputStream input = new ByteArrayInputStream(file.getContents())) {
config = new CmsParameterConfiguration(input); // Uses ISO-8859-1, should be OK for config parameters
cache.putCachedObject(cms, path, config);
}
} catch (CmsVfsResourceNotFoundException e) {
return null;
} catch (Exception e) {
LOG.error(e.getLocalizedMessage(), e);
return null;
}
}
return config.getString(param, null);
} } | public class class_name {
public String getEditorParameter(CmsObject cms, String editor, String param) {
String path = OpenCms.getSystemInfo().getConfigFilePath(cms, "editors/" + editor + ".properties");
CmsVfsMemoryObjectCache cache = CmsVfsMemoryObjectCache.getVfsMemoryObjectCache();
CmsParameterConfiguration config = (CmsParameterConfiguration)cache.getCachedObject(cms, path);
if (config == null) {
try {
CmsFile file = cms.readFile(path);
try (ByteArrayInputStream input = new ByteArrayInputStream(file.getContents())) {
config = new CmsParameterConfiguration(input); // Uses ISO-8859-1, should be OK for config parameters
cache.putCachedObject(cms, path, config); // depends on control dependency: [try], data = [none]
}
} catch (CmsVfsResourceNotFoundException e) {
return null;
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
LOG.error(e.getLocalizedMessage(), e);
return null;
} // depends on control dependency: [catch], data = [none]
}
return config.getString(param, null);
} } |
public class class_name {
private void validateExtensions(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException
{
// Get the values of Sec-WebSocket-Extensions.
List<String> values = headers.get("Sec-WebSocket-Extensions");
if (values == null || values.size() == 0)
{
// Nothing to check.
return;
}
List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
for (String value : values)
{
// Split the value into elements each of which represents an extension.
String[] elements = value.split("\\s*,\\s*");
for (String element : elements)
{
// Parse the string whose format is supposed to be "{name}[; {key}[={value}]*".
WebSocketExtension extension = WebSocketExtension.parse(element);
if (extension == null)
{
// The value in 'Sec-WebSocket-Extensions' failed to be parsed.
throw new OpeningHandshakeException(
WebSocketError.EXTENSION_PARSE_ERROR,
"The value in 'Sec-WebSocket-Extensions' failed to be parsed: " + element,
statusLine, headers);
}
// The extension name.
String name = extension.getName();
// If the extension is not contained in the original request from this client.
if (mWebSocket.getHandshakeBuilder().containsExtension(name) == false)
{
// The extension contained in the Sec-WebSocket-Extensions header is not supported.
throw new OpeningHandshakeException(
WebSocketError.UNSUPPORTED_EXTENSION,
"The extension contained in the Sec-WebSocket-Extensions header is not supported: " + name,
statusLine, headers);
}
// Let the extension validate itself.
extension.validate();
// The extension has been agreed.
extensions.add(extension);
}
}
// Check if extensions conflict with each other.
validateExtensionCombination(statusLine, headers, extensions);
// Agreed extensions.
mWebSocket.setAgreedExtensions(extensions);
} } | public class class_name {
private void validateExtensions(StatusLine statusLine, Map<String, List<String>> headers) throws WebSocketException
{
// Get the values of Sec-WebSocket-Extensions.
List<String> values = headers.get("Sec-WebSocket-Extensions");
if (values == null || values.size() == 0)
{
// Nothing to check.
return;
}
List<WebSocketExtension> extensions = new ArrayList<WebSocketExtension>();
for (String value : values)
{
// Split the value into elements each of which represents an extension.
String[] elements = value.split("\\s*,\\s*");
for (String element : elements)
{
// Parse the string whose format is supposed to be "{name}[; {key}[={value}]*".
WebSocketExtension extension = WebSocketExtension.parse(element);
if (extension == null)
{
// The value in 'Sec-WebSocket-Extensions' failed to be parsed.
throw new OpeningHandshakeException(
WebSocketError.EXTENSION_PARSE_ERROR,
"The value in 'Sec-WebSocket-Extensions' failed to be parsed: " + element,
statusLine, headers);
}
// The extension name.
String name = extension.getName();
// If the extension is not contained in the original request from this client.
if (mWebSocket.getHandshakeBuilder().containsExtension(name) == false)
{
// The extension contained in the Sec-WebSocket-Extensions header is not supported.
throw new OpeningHandshakeException(
WebSocketError.UNSUPPORTED_EXTENSION,
"The extension contained in the Sec-WebSocket-Extensions header is not supported: " + name,
statusLine, headers);
}
// Let the extension validate itself.
extension.validate(); // depends on control dependency: [for], data = [none]
// The extension has been agreed.
extensions.add(extension); // depends on control dependency: [for], data = [none]
}
}
// Check if extensions conflict with each other.
validateExtensionCombination(statusLine, headers, extensions);
// Agreed extensions.
mWebSocket.setAgreedExtensions(extensions);
} } |
public class class_name {
public String getValue(CmsUser user) {
String value = null;
if (isAdditionalInfo()) {
value = (String)user.getAdditionalInfo(getAddInfoKey());
} else {
try {
PropertyUtilsBean propUtils = new PropertyUtilsBean();
value = (String)propUtils.getProperty(user, getField().name());
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
LOG.error("Error reading account info field.", e);
}
}
return value;
} } | public class class_name {
public String getValue(CmsUser user) {
String value = null;
if (isAdditionalInfo()) {
value = (String)user.getAdditionalInfo(getAddInfoKey()); // depends on control dependency: [if], data = [none]
} else {
try {
PropertyUtilsBean propUtils = new PropertyUtilsBean();
value = (String)propUtils.getProperty(user, getField().name()); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
LOG.error("Error reading account info field.", e);
} // depends on control dependency: [catch], data = [none]
}
return value;
} } |
public class class_name {
@Override
public INDArray[] exec(CustomOp op) {
Nd4j.getExecutioner().commit();
//
if (op.numOutputArguments() == 0 && !op.isInplaceCall()) {
try {
val list = this.calculateOutputShape(op);
if (list.isEmpty())
throw new ND4JIllegalStateException("Op name " + op.opName() + " failed to execute. You can't execute non-inplace CustomOp without outputs being specified");
for (val shape: list)
op.addOutputArgument(Nd4j.create(shape));
} catch (Exception e) {
throw new ND4JIllegalStateException("Op name " + op.opName() + " failed to execute. You can't execute non-inplace CustomOp without outputs being specified");
}
}
if (op.opName().equalsIgnoreCase("im2col")) {
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
double zeroPad = 0.0;
if(op.tArgs() != null && op.tArgs().length > 0){
zeroPad = op.tArgs()[0];
}
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7], op.iArgs()[8], zeroPad};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, xArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformSame(xShapeHost, 9,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
null, (LongPointer) hzShape, z, (LongPointer) zShape, extraArgs);
//AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr);
Nd4j.getExecutioner().commit();
return op.outputArguments();
} else if (op.opName().equalsIgnoreCase("col2im")) {
val dtype = Nd4j.dataType();
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7]};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, xArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformSame(xShapeHost, 8,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
null, (LongPointer) hzShape, z, (LongPointer) zShape, extraArgs);
//AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr);
//Nd4j.getExecutioner().commit();
return op.outputArguments();
} else if (op.opName().equalsIgnoreCase("pooling2d")) {
val dtype = Nd4j.dataType();
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7], op.iArgs()[8]};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, zArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformFloat(xShapeHost, 23,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
zArr.data().addressPointer(), (LongPointer) hzShape, z, (LongPointer) zShape,
extraArgs);
// AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr);
return op.outputArguments();
}
Nd4j.getExecutioner().commit();
val context = buildContext();
context.markInplace(op.isInplaceCall());
// transferring rng state
context.setRngStates(Nd4j.getRandom().rootState(), Nd4j.getRandom().nodeState());
//transferring input/output arrays
context.setInputArrays(op.inputArguments());
context.setOutputArrays(op.outputArguments());
// transferring static args
context.setBArguments(op.bArgs());
context.setIArguments(op.iArgs());
context.setTArguments(op.tArgs());
val result = exec(op, context);
val states = context.getRngStates();
// pulling states back
Nd4j.getRandom().setStates(states.getFirst(), states.getSecond());
return result;
/*
long st = profilingConfigurableHookIn(op);
CudaContext context =(CudaContext) AtomicAllocator.getInstance().getDeviceContext().getContext();
//AtomicAllocator.getInstance().getFlowController().prepareActionAllWrite(op.outputArguments());
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer extras = extraz.get().put(
new CudaPointer(1),
context.getOldStream(),
context.getBufferScalar(),
context.getBufferReduction());
val outputArgs = op.outputArguments();
val inputArgs = op.inputArguments();
if (outputArgs.length == 0 && !op.isInplaceCall())
throw new ND4JIllegalStateException("You can't execute non-inplace CustomOp without outputs being specified");
val lc = op.opName().toLowerCase();
val hash = op.opHash();
val inputShapes = new PointerPointer<>(inputArgs.length * 2);
val inputBuffers = new PointerPointer<>(inputArgs.length * 2);
int cnt= 0;
for (val in: inputArgs) {
val hp = AtomicAllocator.getInstance().getHostPointer(in.shapeInfoDataBuffer());
inputBuffers.put(cnt, AtomicAllocator.getInstance().getHostPointer(in));
inputShapes.put(cnt, hp);
val dp = AtomicAllocator.getInstance().getPointer(in.shapeInfoDataBuffer(), context);
inputBuffers.put(cnt + inputArgs.length, AtomicAllocator.getInstance().getPointer(in, context));
inputShapes.put(cnt+ inputArgs.length, dp);
if (op.isInplaceCall()) {
val ap = AtomicAllocator.getInstance().getAllocationPoint(in);
if (ap != null)
ap.tickHostWrite();
}
cnt++;
}
val outputShapes = new PointerPointer<>(outputArgs.length * 2);
val outputBuffers = new PointerPointer<>(outputArgs.length * 2);
cnt= 0;
for (val out: outputArgs) {
outputBuffers.put(cnt, AtomicAllocator.getInstance().getHostPointer(out));
outputShapes.put(cnt, AtomicAllocator.getInstance().getHostPointer(out.shapeInfoDataBuffer()));
outputBuffers.put(cnt + outputArgs.length, AtomicAllocator.getInstance().getPointer(out, context));
outputShapes.put(cnt + outputArgs.length, AtomicAllocator.getInstance().getPointer(out.shapeInfoDataBuffer(), context));
val ap = AtomicAllocator.getInstance().getAllocationPoint(out);
if (ap != null)
ap.tickHostWrite();
cnt++;
}
val iArgs = op.iArgs().length > 0 ? new LongPointer(op.iArgs().length) : null;
cnt = 0;
for (val i: op.iArgs())
iArgs.put(cnt++, i);
val tArgs = op.tArgs().length > 0 ? new DoublePointer(op.tArgs().length) : null;
val bArgs = op.bArgs().length > 0 ? new BooleanPointer(op.numBArguments()) : null;
cnt = 0;
for (val t: op.tArgs())
tArgs.put(cnt++, t);
cnt = 0;
for (val b: op.bArgs())
bArgs.put(cnt++, b);
try {
val status = OpStatus.byNumber(nativeOps.execCustomOp(extras, hash, inputBuffers, inputShapes, inputArgs.length, outputBuffers, outputShapes, outputArgs.length, tArgs, op.tArgs().length, iArgs, op.iArgs().length, bArgs, op.numBArguments(), op.isInplaceCall()));
if (status != OpStatus.ND4J_STATUS_OK)
throw new ND4JIllegalStateException("Op execution failed: " + status);
} catch (Exception e) {
throw new RuntimeException("Op [" + op.opName() + "] execution failed");
}
//AtomicAllocator.getInstance().getFlowController().prepareActionAllWrite(op.outputArguments());
profilingConfigurableHookOut(op, st);
return op.outputArguments();
*/
} } | public class class_name {
@Override
public INDArray[] exec(CustomOp op) {
Nd4j.getExecutioner().commit();
//
if (op.numOutputArguments() == 0 && !op.isInplaceCall()) {
try {
val list = this.calculateOutputShape(op);
if (list.isEmpty())
throw new ND4JIllegalStateException("Op name " + op.opName() + " failed to execute. You can't execute non-inplace CustomOp without outputs being specified");
for (val shape: list)
op.addOutputArgument(Nd4j.create(shape));
} catch (Exception e) {
throw new ND4JIllegalStateException("Op name " + op.opName() + " failed to execute. You can't execute non-inplace CustomOp without outputs being specified");
} // depends on control dependency: [catch], data = [none]
}
if (op.opName().equalsIgnoreCase("im2col")) {
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
double zeroPad = 0.0;
if(op.tArgs() != null && op.tArgs().length > 0){
zeroPad = op.tArgs()[0]; // depends on control dependency: [if], data = [none]
}
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7], op.iArgs()[8], zeroPad};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, xArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformSame(xShapeHost, 9,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
null, (LongPointer) hzShape, z, (LongPointer) zShape, extraArgs); // depends on control dependency: [if], data = [none]
//AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr); // depends on control dependency: [if], data = [none]
Nd4j.getExecutioner().commit(); // depends on control dependency: [if], data = [none]
return op.outputArguments(); // depends on control dependency: [if], data = [none]
} else if (op.opName().equalsIgnoreCase("col2im")) {
val dtype = Nd4j.dataType();
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7]};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, xArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformSame(xShapeHost, 8,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
null, (LongPointer) hzShape, z, (LongPointer) zShape, extraArgs); // depends on control dependency: [if], data = [none]
//AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr); // depends on control dependency: [if], data = [none]
//Nd4j.getExecutioner().commit();
return op.outputArguments(); // depends on control dependency: [if], data = [none]
} else if (op.opName().equalsIgnoreCase("pooling2d")) {
val dtype = Nd4j.dataType();
val xArr = op.inputArguments()[0];
val zArr = op.outputArguments()[0];
CudaContext context = AtomicAllocator.getInstance().getFlowController().prepareAction(zArr, xArr);
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer xShapeHost =
extraz.get().put(AddressRetriever.retrieveHostPointer(xArr.shapeInfoDataBuffer()), // 0
context.getOldStream(), // 1
AtomicAllocator.getInstance().getDeviceIdPointer(), // 2
context.getBufferAllocation(), // 3
context.getBufferReduction(), // 4
context.getBufferScalar(), // 5
context.getBufferSpecial(),
null,
AddressRetriever.retrieveHostPointer(zArr.shapeInfoDataBuffer())
);
val x = AtomicAllocator.getInstance().getPointer(xArr, context);
val z = AtomicAllocator.getInstance().getPointer(zArr, context);
val xShape = AtomicAllocator.getInstance().getPointer(xArr.shapeInfoDataBuffer(), context);
val zShape = AtomicAllocator.getInstance().getPointer(zArr.shapeInfoDataBuffer(), context);
val hxShape = AtomicAllocator.getInstance().getHostPointer(xArr.shapeInfoDataBuffer());
val hzShape = AtomicAllocator.getInstance().getHostPointer(zArr.shapeInfoDataBuffer());
val extrass = new double[]{op.iArgs()[0], op.iArgs()[1], op.iArgs()[2], op.iArgs()[3], op.iArgs()[4], op.iArgs()[5], op.iArgs()[6], op.iArgs()[7], op.iArgs()[8]};
val extraArgsBuff = Nd4j.getConstantHandler().getConstantBuffer(extrass, zArr.dataType());
val extraArgs = AtomicAllocator.getInstance().getPointer(extraArgsBuff, context);
nativeOps.execTransformFloat(xShapeHost, 23,
null, (LongPointer) hxShape, x, (LongPointer) xShape,
zArr.data().addressPointer(), (LongPointer) hzShape, z, (LongPointer) zShape,
extraArgs); // depends on control dependency: [if], data = [none]
// AtomicAllocator.getInstance().getAllocationPoint(zArr).tickDeviceWrite();
AtomicAllocator.getInstance().getFlowController().registerAction(context, zArr, xArr); // depends on control dependency: [if], data = [none]
return op.outputArguments(); // depends on control dependency: [if], data = [none]
}
Nd4j.getExecutioner().commit();
val context = buildContext();
context.markInplace(op.isInplaceCall());
// transferring rng state
context.setRngStates(Nd4j.getRandom().rootState(), Nd4j.getRandom().nodeState());
//transferring input/output arrays
context.setInputArrays(op.inputArguments());
context.setOutputArrays(op.outputArguments());
// transferring static args
context.setBArguments(op.bArgs());
context.setIArguments(op.iArgs());
context.setTArguments(op.tArgs());
val result = exec(op, context);
val states = context.getRngStates();
// pulling states back
Nd4j.getRandom().setStates(states.getFirst(), states.getSecond());
return result;
/*
long st = profilingConfigurableHookIn(op);
CudaContext context =(CudaContext) AtomicAllocator.getInstance().getDeviceContext().getContext();
//AtomicAllocator.getInstance().getFlowController().prepareActionAllWrite(op.outputArguments());
if (extraz.get() == null)
extraz.set(new PointerPointer(32));
PointerPointer extras = extraz.get().put(
new CudaPointer(1),
context.getOldStream(),
context.getBufferScalar(),
context.getBufferReduction());
val outputArgs = op.outputArguments();
val inputArgs = op.inputArguments();
if (outputArgs.length == 0 && !op.isInplaceCall())
throw new ND4JIllegalStateException("You can't execute non-inplace CustomOp without outputs being specified");
val lc = op.opName().toLowerCase();
val hash = op.opHash();
val inputShapes = new PointerPointer<>(inputArgs.length * 2);
val inputBuffers = new PointerPointer<>(inputArgs.length * 2);
int cnt= 0;
for (val in: inputArgs) {
val hp = AtomicAllocator.getInstance().getHostPointer(in.shapeInfoDataBuffer());
inputBuffers.put(cnt, AtomicAllocator.getInstance().getHostPointer(in));
inputShapes.put(cnt, hp);
val dp = AtomicAllocator.getInstance().getPointer(in.shapeInfoDataBuffer(), context);
inputBuffers.put(cnt + inputArgs.length, AtomicAllocator.getInstance().getPointer(in, context));
inputShapes.put(cnt+ inputArgs.length, dp);
if (op.isInplaceCall()) {
val ap = AtomicAllocator.getInstance().getAllocationPoint(in);
if (ap != null)
ap.tickHostWrite();
}
cnt++;
}
val outputShapes = new PointerPointer<>(outputArgs.length * 2);
val outputBuffers = new PointerPointer<>(outputArgs.length * 2);
cnt= 0;
for (val out: outputArgs) {
outputBuffers.put(cnt, AtomicAllocator.getInstance().getHostPointer(out));
outputShapes.put(cnt, AtomicAllocator.getInstance().getHostPointer(out.shapeInfoDataBuffer()));
outputBuffers.put(cnt + outputArgs.length, AtomicAllocator.getInstance().getPointer(out, context));
outputShapes.put(cnt + outputArgs.length, AtomicAllocator.getInstance().getPointer(out.shapeInfoDataBuffer(), context));
val ap = AtomicAllocator.getInstance().getAllocationPoint(out);
if (ap != null)
ap.tickHostWrite();
cnt++;
}
val iArgs = op.iArgs().length > 0 ? new LongPointer(op.iArgs().length) : null;
cnt = 0;
for (val i: op.iArgs())
iArgs.put(cnt++, i);
val tArgs = op.tArgs().length > 0 ? new DoublePointer(op.tArgs().length) : null;
val bArgs = op.bArgs().length > 0 ? new BooleanPointer(op.numBArguments()) : null;
cnt = 0;
for (val t: op.tArgs())
tArgs.put(cnt++, t);
cnt = 0;
for (val b: op.bArgs())
bArgs.put(cnt++, b);
try {
val status = OpStatus.byNumber(nativeOps.execCustomOp(extras, hash, inputBuffers, inputShapes, inputArgs.length, outputBuffers, outputShapes, outputArgs.length, tArgs, op.tArgs().length, iArgs, op.iArgs().length, bArgs, op.numBArguments(), op.isInplaceCall()));
if (status != OpStatus.ND4J_STATUS_OK)
throw new ND4JIllegalStateException("Op execution failed: " + status);
} catch (Exception e) {
throw new RuntimeException("Op [" + op.opName() + "] execution failed");
}
//AtomicAllocator.getInstance().getFlowController().prepareActionAllWrite(op.outputArguments());
profilingConfigurableHookOut(op, st);
return op.outputArguments();
*/
} } |
public class class_name {
public InetAddress discoverHost (int udpPort, int timeoutMillis) {
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket();
try {
socket.receive(packet);
} catch (SocketTimeoutException ex) {
if (INFO) info("kryonet", "Host discovery timed out.");
return null;
}
if (INFO) info("kryonet", "Discovered server: " + packet.getAddress());
discoveryHandler.onDiscoveredHost(packet, getKryo());
return packet.getAddress();
} catch (IOException ex) {
if (ERROR) error("kryonet", "Host discovery failed.", ex);
return null;
} finally {
if (socket != null) socket.close();
discoveryHandler.onFinally();
}
} } | public class class_name {
public InetAddress discoverHost (int udpPort, int timeoutMillis) {
DatagramSocket socket = null;
try {
socket = new DatagramSocket(); // depends on control dependency: [try], data = [none]
broadcast(udpPort, socket); // depends on control dependency: [try], data = [none]
socket.setSoTimeout(timeoutMillis); // depends on control dependency: [try], data = [none]
DatagramPacket packet = discoveryHandler.onRequestNewDatagramPacket();
try {
socket.receive(packet); // depends on control dependency: [try], data = [none]
} catch (SocketTimeoutException ex) {
if (INFO) info("kryonet", "Host discovery timed out.");
return null;
} // depends on control dependency: [catch], data = [none]
if (INFO) info("kryonet", "Discovered server: " + packet.getAddress());
discoveryHandler.onDiscoveredHost(packet, getKryo()); // depends on control dependency: [try], data = [none]
return packet.getAddress(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
if (ERROR) error("kryonet", "Host discovery failed.", ex);
return null;
} finally { // depends on control dependency: [catch], data = [none]
if (socket != null) socket.close();
discoveryHandler.onFinally();
}
} } |
public class class_name {
public Canal findCanal(String destination) {
FindCanalEvent event = new FindCanalEvent();
event.setDestination(destination);
try {
Object obj = delegate.callManager(event);
if (obj != null && obj instanceof Canal) {
return (Canal) obj;
} else {
throw new CanalException("No Such Canal by [" + destination + "]");
}
} catch (Exception e) {
throw new CanalException("call_manager_error", e);
}
} } | public class class_name {
public Canal findCanal(String destination) {
FindCanalEvent event = new FindCanalEvent();
event.setDestination(destination);
try {
Object obj = delegate.callManager(event);
if (obj != null && obj instanceof Canal) {
return (Canal) obj; // depends on control dependency: [if], data = [none]
} else {
throw new CanalException("No Such Canal by [" + destination + "]");
}
} catch (Exception e) {
throw new CanalException("call_manager_error", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void resetJavaLibraryPath() {
synchronized (Runtime.getRuntime()) {
try {
Field field = ClassLoader.class.getDeclaredField("usr_paths");
field.setAccessible(true);
field.set(null, null);
field = ClassLoader.class.getDeclaredField("sys_paths");
field.setAccessible(true);
field.set(null, null);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
} } | public class class_name {
private static void resetJavaLibraryPath() {
synchronized (Runtime.getRuntime()) {
try {
Field field = ClassLoader.class.getDeclaredField("usr_paths");
field.setAccessible(true); // depends on control dependency: [try], data = [none]
field.set(null, null); // depends on control dependency: [try], data = [none]
field = ClassLoader.class.getDeclaredField("sys_paths"); // depends on control dependency: [try], data = [none]
field.setAccessible(true); // depends on control dependency: [try], data = [none]
field.set(null, null); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static long parseDateTimeString(String str, int offset) {
int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
boolean isUTC = false;
boolean isValid = false;
do {
if (str == null) {
break;
}
int length = str.length();
if (length != 15 && length != 16) {
// FORM#1 15 characters, such as "20060317T142115"
// FORM#2 16 characters, such as "20060317T142115Z"
break;
}
if (str.charAt(8) != 'T') {
// charcter "T" must be used for separating date and time
break;
}
if (length == 16) {
if (str.charAt(15) != 'Z') {
// invalid format
break;
}
isUTC = true;
}
try {
year = Integer.parseInt(str.substring(0, 4));
month = Integer.parseInt(str.substring(4, 6)) - 1; // 0-based
day = Integer.parseInt(str.substring(6, 8));
hour = Integer.parseInt(str.substring(9, 11));
min = Integer.parseInt(str.substring(11, 13));
sec = Integer.parseInt(str.substring(13, 15));
} catch (NumberFormatException nfe) {
break;
}
// check valid range
int maxDayOfMonth = Grego.monthLength(year, month);
if (year < 0 || month < 0 || month > 11 || day < 1 || day > maxDayOfMonth ||
hour < 0 || hour >= 24 || min < 0 || min >= 60 || sec < 0 || sec >= 60) {
break;
}
isValid = true;
} while(false);
if (!isValid) {
throw new IllegalArgumentException("Invalid date time string format");
}
// Calculate the time
long time = Grego.fieldsToDay(year, month, day) * Grego.MILLIS_PER_DAY;
time += (hour*Grego.MILLIS_PER_HOUR + min*Grego.MILLIS_PER_MINUTE + sec*Grego.MILLIS_PER_SECOND);
if (!isUTC) {
time -= offset;
}
return time;
} } | public class class_name {
private static long parseDateTimeString(String str, int offset) {
int year = 0, month = 0, day = 0, hour = 0, min = 0, sec = 0;
boolean isUTC = false;
boolean isValid = false;
do {
if (str == null) {
break;
}
int length = str.length();
if (length != 15 && length != 16) {
// FORM#1 15 characters, such as "20060317T142115"
// FORM#2 16 characters, such as "20060317T142115Z"
break;
}
if (str.charAt(8) != 'T') {
// charcter "T" must be used for separating date and time
break;
}
if (length == 16) {
if (str.charAt(15) != 'Z') {
// invalid format
break;
}
isUTC = true; // depends on control dependency: [if], data = [none]
}
try {
year = Integer.parseInt(str.substring(0, 4)); // depends on control dependency: [try], data = [none]
month = Integer.parseInt(str.substring(4, 6)) - 1; // 0-based // depends on control dependency: [try], data = [none]
day = Integer.parseInt(str.substring(6, 8)); // depends on control dependency: [try], data = [none]
hour = Integer.parseInt(str.substring(9, 11)); // depends on control dependency: [try], data = [none]
min = Integer.parseInt(str.substring(11, 13)); // depends on control dependency: [try], data = [none]
sec = Integer.parseInt(str.substring(13, 15)); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
break;
} // depends on control dependency: [catch], data = [none]
// check valid range
int maxDayOfMonth = Grego.monthLength(year, month);
if (year < 0 || month < 0 || month > 11 || day < 1 || day > maxDayOfMonth ||
hour < 0 || hour >= 24 || min < 0 || min >= 60 || sec < 0 || sec >= 60) {
break;
}
isValid = true;
} while(false);
if (!isValid) {
throw new IllegalArgumentException("Invalid date time string format");
}
// Calculate the time
long time = Grego.fieldsToDay(year, month, day) * Grego.MILLIS_PER_DAY;
time += (hour*Grego.MILLIS_PER_HOUR + min*Grego.MILLIS_PER_MINUTE + sec*Grego.MILLIS_PER_SECOND);
if (!isUTC) {
time -= offset; // depends on control dependency: [if], data = [none]
}
return time;
} } |
public class class_name {
public boolean checkRead()
{
if (!inActive) {
return false;
}
if (state != State.ACTIVE && state != State.WAITING_FOR_DELIMITER) {
return false;
}
// Check if there's an item in the pipe.
if (!inpipe.checkRead()) {
inActive = false;
return false;
}
// If the next item in the pipe is message delimiter,
// initiate termination process.
if (isDelimiter(inpipe.probe())) {
Msg msg = inpipe.read();
assert (msg != null);
processDelimiter();
return false;
}
return true;
} } | public class class_name {
public boolean checkRead()
{
if (!inActive) {
return false; // depends on control dependency: [if], data = [none]
}
if (state != State.ACTIVE && state != State.WAITING_FOR_DELIMITER) {
return false; // depends on control dependency: [if], data = [none]
}
// Check if there's an item in the pipe.
if (!inpipe.checkRead()) {
inActive = false; // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
// If the next item in the pipe is message delimiter,
// initiate termination process.
if (isDelimiter(inpipe.probe())) {
Msg msg = inpipe.read();
assert (msg != null); // depends on control dependency: [if], data = [none]
processDelimiter(); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public LibrarySet[] getActiveLibrarySets(final LinkerDef[] defaultProviders, final int index) {
if (isReference()) {
return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
.getActiveUserLibrarySets(defaultProviders, index);
}
final Project p = getProject();
final Vector libsets = new Vector();
for (int i = index; i < defaultProviders.length; i++) {
defaultProviders[i].addActiveUserLibrarySets(p, libsets);
}
addActiveUserLibrarySets(p, libsets);
for (int i = index; i < defaultProviders.length; i++) {
defaultProviders[i].addActiveSystemLibrarySets(p, libsets);
}
addActiveSystemLibrarySets(p, libsets);
final LibrarySet[] sets = new LibrarySet[libsets.size()];
libsets.copyInto(sets);
return sets;
} } | public class class_name {
public LibrarySet[] getActiveLibrarySets(final LinkerDef[] defaultProviders, final int index) {
if (isReference()) {
return ((LinkerDef) getCheckedRef(LinkerDef.class, "LinkerDef"))
.getActiveUserLibrarySets(defaultProviders, index); // depends on control dependency: [if], data = [none]
}
final Project p = getProject();
final Vector libsets = new Vector();
for (int i = index; i < defaultProviders.length; i++) {
defaultProviders[i].addActiveUserLibrarySets(p, libsets); // depends on control dependency: [for], data = [i]
}
addActiveUserLibrarySets(p, libsets);
for (int i = index; i < defaultProviders.length; i++) {
defaultProviders[i].addActiveSystemLibrarySets(p, libsets); // depends on control dependency: [for], data = [i]
}
addActiveSystemLibrarySets(p, libsets);
final LibrarySet[] sets = new LibrarySet[libsets.size()];
libsets.copyInto(sets);
return sets;
} } |
public class class_name {
protected void processDigits(List<Span> contextTokens, char compare, HashMap rule, int matchBegin, int currentPosition,
LinkedHashMap<String, ConTextSpan> matches) {
mt = pdigit.matcher(contextTokens.get(currentPosition).text);
if (mt.find()) {
double thisDigit;
// prevent length over limit
if (mt.group(1).length() < 4) {
String a = mt.group(1);
thisDigit = Double.parseDouble(mt.group(1));
} else {
thisDigit = 1000;
}
Set<String> numbers = rule.keySet();
for (String num : numbers) {
double ruleDigit = Double.parseDouble(num);
if ((compare == '>' && thisDigit > ruleDigit) || (compare == '<' && thisDigit < ruleDigit)) {
if (mt.group(2) == null) {
// if this token is a number
processRules(contextTokens, (HashMap) rule.get(num), matchBegin, currentPosition + 1, matches);
} else {
// thisToken is like "30-days"
HashMap ruletmp = (HashMap) rule.get(ruleDigit + "");
String subtoken = mt.group(2).substring(1);
if (ruletmp.containsKey(subtoken)) {
processRules(contextTokens, (HashMap) ruletmp.get(subtoken), matchBegin, currentPosition + 1, matches);
}
}
}
}
}
} } | public class class_name {
protected void processDigits(List<Span> contextTokens, char compare, HashMap rule, int matchBegin, int currentPosition,
LinkedHashMap<String, ConTextSpan> matches) {
mt = pdigit.matcher(contextTokens.get(currentPosition).text);
if (mt.find()) {
double thisDigit;
// prevent length over limit
if (mt.group(1).length() < 4) {
String a = mt.group(1);
thisDigit = Double.parseDouble(mt.group(1)); // depends on control dependency: [if], data = [none]
} else {
thisDigit = 1000; // depends on control dependency: [if], data = [none]
}
Set<String> numbers = rule.keySet();
for (String num : numbers) {
double ruleDigit = Double.parseDouble(num);
if ((compare == '>' && thisDigit > ruleDigit) || (compare == '<' && thisDigit < ruleDigit)) {
if (mt.group(2) == null) {
// if this token is a number
processRules(contextTokens, (HashMap) rule.get(num), matchBegin, currentPosition + 1, matches); // depends on control dependency: [if], data = [none]
} else {
// thisToken is like "30-days"
HashMap ruletmp = (HashMap) rule.get(ruleDigit + "");
String subtoken = mt.group(2).substring(1);
if (ruletmp.containsKey(subtoken)) {
processRules(contextTokens, (HashMap) ruletmp.get(subtoken), matchBegin, currentPosition + 1, matches); // depends on control dependency: [if], data = [none]
}
}
}
}
}
} } |
public class class_name {
@Override
public CPDefinitionOptionRel fetchByC_SC_Last(long CPDefinitionId,
boolean skuContributor,
OrderByComparator<CPDefinitionOptionRel> orderByComparator) {
int count = countByC_SC(CPDefinitionId, skuContributor);
if (count == 0) {
return null;
}
List<CPDefinitionOptionRel> list = findByC_SC(CPDefinitionId,
skuContributor, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CPDefinitionOptionRel fetchByC_SC_Last(long CPDefinitionId,
boolean skuContributor,
OrderByComparator<CPDefinitionOptionRel> orderByComparator) {
int count = countByC_SC(CPDefinitionId, skuContributor);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CPDefinitionOptionRel> list = findByC_SC(CPDefinitionId,
skuContributor, count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public ArgumentOptions withMaxUsageWidth(int maxWidth) {
if (tty.isInteractive()) {
this.usageWidth = Math.min(maxWidth, tty.getTerminalSize().cols);
} else {
this.usageWidth = maxWidth;
}
return this;
} } | public class class_name {
public ArgumentOptions withMaxUsageWidth(int maxWidth) {
if (tty.isInteractive()) {
this.usageWidth = Math.min(maxWidth, tty.getTerminalSize().cols); // depends on control dependency: [if], data = [none]
} else {
this.usageWidth = maxWidth; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public void setSize(float width, float height)
{
if (view != null)
{
view.setSize(width, height);
}
} } | public class class_name {
@Override
public void setSize(float width, float height)
{
if (view != null)
{
view.setSize(width, height); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unused")
public void selectItem(int position, boolean invokeListeners) {
IOperationItem item = mOuterAdapter.getItem(position);
IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition);
int realPosition = mOuterAdapter.normalizePosition(position);
//do nothing if position not changed
if (realPosition == mCurrentItemPosition) {
return;
}
int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition;
item.setVisible(false);
startSelectedViewOutAnimation(position);
mOuterAdapter.notifyRealItemChanged(position);
mRealHidedPosition = realPosition;
oldHidedItem.setVisible(true);
mFlContainerSelected.requestLayout();
mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition);
mCurrentItemPosition = realPosition;
if (invokeListeners) {
notifyItemClickListeners(realPosition);
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "clicked on position =" + position);
}
} } | public class class_name {
@SuppressWarnings("unused")
public void selectItem(int position, boolean invokeListeners) {
IOperationItem item = mOuterAdapter.getItem(position);
IOperationItem oldHidedItem = mOuterAdapter.getItem(mRealHidedPosition);
int realPosition = mOuterAdapter.normalizePosition(position);
//do nothing if position not changed
if (realPosition == mCurrentItemPosition) {
return; // depends on control dependency: [if], data = [none]
}
int itemToShowAdapterPosition = position - realPosition + mRealHidedPosition;
item.setVisible(false);
startSelectedViewOutAnimation(position);
mOuterAdapter.notifyRealItemChanged(position);
mRealHidedPosition = realPosition;
oldHidedItem.setVisible(true);
mFlContainerSelected.requestLayout();
mOuterAdapter.notifyRealItemChanged(itemToShowAdapterPosition);
mCurrentItemPosition = realPosition;
if (invokeListeners) {
notifyItemClickListeners(realPosition); // depends on control dependency: [if], data = [none]
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "clicked on position =" + position); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isLog4jConfigurationAvailable()
{
String log4jConfiguration = System.getProperty(LOG4J_CONFIGURATION);
String resource = log4jConfiguration != null ? log4jConfiguration : LOG4J_PROPERTIES;
URL url = null;
try
{
url = new URL(resource);
loadConfiguration(url);
}
catch (Exception e1)
{
try
{
url = Loader.getResource(resource);
loadConfiguration(url);
}
catch (Exception e2)
{
//ignore
}
}
return url != null;
} } | public class class_name {
public static boolean isLog4jConfigurationAvailable()
{
String log4jConfiguration = System.getProperty(LOG4J_CONFIGURATION);
String resource = log4jConfiguration != null ? log4jConfiguration : LOG4J_PROPERTIES;
URL url = null;
try
{
url = new URL(resource); // depends on control dependency: [try], data = [none]
loadConfiguration(url); // depends on control dependency: [try], data = [none]
}
catch (Exception e1)
{
try
{
url = Loader.getResource(resource); // depends on control dependency: [try], data = [none]
loadConfiguration(url); // depends on control dependency: [try], data = [none]
}
catch (Exception e2)
{
//ignore
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
return url != null;
} } |
public class class_name {
private synchronized void onStateChange(PrimitiveState state) {
if (this.state != state) {
if (state == PrimitiveState.EXPIRED) {
if (connected) {
onStateChange(PrimitiveState.SUSPENDED);
recover();
} else {
log.debug("State changed: {}", state);
this.state = state;
stateChangeListeners.forEach(l -> l.accept(state));
}
} else {
log.debug("State changed: {}", state);
this.state = state;
stateChangeListeners.forEach(l -> l.accept(state));
if (state == PrimitiveState.CLOSED) {
connectFuture = Futures.exceptionalFuture(new PrimitiveException.ClosedSession());
session = null;
}
}
}
} } | public class class_name {
private synchronized void onStateChange(PrimitiveState state) {
if (this.state != state) {
if (state == PrimitiveState.EXPIRED) {
if (connected) {
onStateChange(PrimitiveState.SUSPENDED); // depends on control dependency: [if], data = [none]
recover(); // depends on control dependency: [if], data = [none]
} else {
log.debug("State changed: {}", state); // depends on control dependency: [if], data = [none]
this.state = state; // depends on control dependency: [if], data = [none]
stateChangeListeners.forEach(l -> l.accept(state)); // depends on control dependency: [if], data = [none]
}
} else {
log.debug("State changed: {}", state); // depends on control dependency: [if], data = [none]
this.state = state; // depends on control dependency: [if], data = [none]
stateChangeListeners.forEach(l -> l.accept(state)); // depends on control dependency: [if], data = [(state]
if (state == PrimitiveState.CLOSED) {
connectFuture = Futures.exceptionalFuture(new PrimitiveException.ClosedSession()); // depends on control dependency: [if], data = [none]
session = null; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void visit(Term term)
{
if (isEnteringContext())
{
SymbolKey key = currentSymbolTable.getSymbolKey(currentPosition);
term.setSymbolKey(key);
}
if (delegate != null)
{
delegate.visit(term);
}
} } | public class class_name {
public void visit(Term term)
{
if (isEnteringContext())
{
SymbolKey key = currentSymbolTable.getSymbolKey(currentPosition);
term.setSymbolKey(key); // depends on control dependency: [if], data = [none]
}
if (delegate != null)
{
delegate.visit(term); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean hasInputVariable(String name) {
for (InputVariable inputVariable : this.inputVariables) {
if (inputVariable.getName().equals(name)) {
return true;
}
}
return false;
} } | public class class_name {
public boolean hasInputVariable(String name) {
for (InputVariable inputVariable : this.inputVariables) {
if (inputVariable.getName().equals(name)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void setConstraintDetails(java.util.Collection<ConstraintDetail> constraintDetails) {
if (constraintDetails == null) {
this.constraintDetails = null;
return;
}
this.constraintDetails = new java.util.ArrayList<ConstraintDetail>(constraintDetails);
} } | public class class_name {
public void setConstraintDetails(java.util.Collection<ConstraintDetail> constraintDetails) {
if (constraintDetails == null) {
this.constraintDetails = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.constraintDetails = new java.util.ArrayList<ConstraintDetail>(constraintDetails);
} } |
public class class_name {
public Observable<ServiceResponse<Page<DetectorResponseInner>>> listHostingEnvironmentDetectorResponsesNextWithServiceResponseAsync(final String nextPageLink) {
return listHostingEnvironmentDetectorResponsesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Observable<ServiceResponse<Page<DetectorResponseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DetectorResponseInner>>> call(ServiceResponse<Page<DetectorResponseInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listHostingEnvironmentDetectorResponsesNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<DetectorResponseInner>>> listHostingEnvironmentDetectorResponsesNextWithServiceResponseAsync(final String nextPageLink) {
return listHostingEnvironmentDetectorResponsesNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<DetectorResponseInner>>, Observable<ServiceResponse<Page<DetectorResponseInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DetectorResponseInner>>> call(ServiceResponse<Page<DetectorResponseInner>> 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(listHostingEnvironmentDetectorResponsesNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
private static RgroupStructure buildMoleculefromPeptideOrRNA(final String id, final List<Monomer> validMonomers) throws BuilderMoleculeException, ChemistryException {
try {
String input = null;
AbstractMolecule currentMolecule = null;
input = getInput(validMonomers.get(0));
AbstractMolecule prevMolecule =
Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(validMonomers.get(0).getAttachmentList()));
AbstractMolecule firstMolecule = null;
Monomer prevMonomer = null;
RgroupStructure first = new RgroupStructure();
RgroupStructure current = new RgroupStructure();
int prev = 1;
if (validMonomers.size() == 0 || validMonomers == null) {
LOG.error("Polymer (Peptide/RNA) has no contents");
throw new BuilderMoleculeException("Polymer (Peptide/RNA) has no contents");
}
int i = 0;
/* First catch all IAtomBases */
for (Monomer currentMonomer : validMonomers) {
LOG.debug("Monomer " + currentMonomer.getAlternateId());
i++;
if (prevMonomer != null) {
input = getInput(currentMonomer);
currentMolecule = Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(currentMonomer.getAttachmentList()));
current.setMolecule(currentMolecule);
current.setRgroupMap(generateRgroupMap(id + ":" + String.valueOf(i), currentMolecule));
/* Backbone Connection */
if (currentMonomer.getMonomerType().equals(Monomer.BACKBONE_MOMONER_TYPE)) {
prevMolecule = Chemistry.getInstance().getManipulator().merge(first.getMolecule(), first.getRgroupMap().get(id + ":" + prev
+ ":R2"), current.getMolecule(), current.getRgroupMap().get(id
+ ":" + i
+ ":R1"));
first.getRgroupMap().remove(id + ":" + prev + ":R2");
current.getRgroupMap().remove(id + ":" + i + ":R1");
first.setMolecule(prevMolecule);
Map<String, IAtomBase> map = new HashMap<String, IAtomBase>();
map.putAll(first.getRgroupMap());
map.putAll(current.getRgroupMap());
first.setRgroupMap(map);
prev = i;
} /* Backbone to Branch Connection */ else if (currentMonomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
prevMolecule = Chemistry.getInstance().getManipulator().merge(first.getMolecule(), first.getRgroupMap().get(id + ":" + prev
+ ":R3"), current.getMolecule(), current.getRgroupMap().get(id
+ ":"
+ i + ":R1"));
first.getRgroupMap().remove(id + ":" + prev + ":R3");
current.getRgroupMap().remove(id + ":" + i + ":R1");
first.setMolecule(prevMolecule);
Map<String, IAtomBase> map = new HashMap<String, IAtomBase>();
map.putAll(first.getRgroupMap());
map.putAll(current.getRgroupMap());
first.setRgroupMap(map);
} /* Unknown connection */ else {
LOG.error("Intra connection is unknown");
throw new BuilderMoleculeException("Intra connection is unknown");
}
} /* first Monomer! */ else {
prevMonomer = currentMonomer;
input = getInput(prevMonomer);
prevMolecule =
Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(prevMonomer.getAttachmentList()));
firstMolecule = prevMolecule;
first.setMolecule(firstMolecule);
first.setRgroupMap(generateRgroupMap(id + ":" + String.valueOf(i), firstMolecule));
}
}
LOG.debug(first.getRgroupMap().keySet().toString());
return first;
} catch (IOException | CTKException e) {
LOG.error("Polymer(Peptide/RNA) molecule can't be built " + e.getMessage());
throw new BuilderMoleculeException("Polymer(Peptide/RNA) molecule can't be built " + e.getMessage());
}
} } | public class class_name {
private static RgroupStructure buildMoleculefromPeptideOrRNA(final String id, final List<Monomer> validMonomers) throws BuilderMoleculeException, ChemistryException {
try {
String input = null;
AbstractMolecule currentMolecule = null;
input = getInput(validMonomers.get(0));
AbstractMolecule prevMolecule =
Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(validMonomers.get(0).getAttachmentList()));
AbstractMolecule firstMolecule = null;
Monomer prevMonomer = null;
RgroupStructure first = new RgroupStructure();
RgroupStructure current = new RgroupStructure();
int prev = 1;
if (validMonomers.size() == 0 || validMonomers == null) {
LOG.error("Polymer (Peptide/RNA) has no contents");
throw new BuilderMoleculeException("Polymer (Peptide/RNA) has no contents");
}
int i = 0;
/* First catch all IAtomBases */
for (Monomer currentMonomer : validMonomers) {
LOG.debug("Monomer " + currentMonomer.getAlternateId());
i++;
if (prevMonomer != null) {
input = getInput(currentMonomer);
// depends on control dependency: [if], data = [none]
currentMolecule = Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(currentMonomer.getAttachmentList()));
// depends on control dependency: [if], data = [none]
current.setMolecule(currentMolecule);
// depends on control dependency: [if], data = [none]
current.setRgroupMap(generateRgroupMap(id + ":" + String.valueOf(i), currentMolecule));
// depends on control dependency: [if], data = [none]
/* Backbone Connection */
if (currentMonomer.getMonomerType().equals(Monomer.BACKBONE_MOMONER_TYPE)) {
prevMolecule = Chemistry.getInstance().getManipulator().merge(first.getMolecule(), first.getRgroupMap().get(id + ":" + prev
+ ":R2"), current.getMolecule(), current.getRgroupMap().get(id
+ ":" + i
+ ":R1"));
// depends on control dependency: [if], data = [none]
first.getRgroupMap().remove(id + ":" + prev + ":R2");
// depends on control dependency: [if], data = [none]
current.getRgroupMap().remove(id + ":" + i + ":R1");
// depends on control dependency: [if], data = [none]
first.setMolecule(prevMolecule);
// depends on control dependency: [if], data = [none]
Map<String, IAtomBase> map = new HashMap<String, IAtomBase>();
map.putAll(first.getRgroupMap());
// depends on control dependency: [if], data = [none]
map.putAll(current.getRgroupMap());
// depends on control dependency: [if], data = [none]
first.setRgroupMap(map);
// depends on control dependency: [if], data = [none]
prev = i;
// depends on control dependency: [if], data = [none]
} /* Backbone to Branch Connection */ else if (currentMonomer.getMonomerType().equals(Monomer.BRANCH_MOMONER_TYPE)) {
prevMolecule = Chemistry.getInstance().getManipulator().merge(first.getMolecule(), first.getRgroupMap().get(id + ":" + prev
+ ":R3"), current.getMolecule(), current.getRgroupMap().get(id
+ ":"
+ i + ":R1"));
// depends on control dependency: [if], data = [none]
first.getRgroupMap().remove(id + ":" + prev + ":R3");
// depends on control dependency: [if], data = [none]
current.getRgroupMap().remove(id + ":" + i + ":R1");
// depends on control dependency: [if], data = [none]
first.setMolecule(prevMolecule);
// depends on control dependency: [if], data = [none]
Map<String, IAtomBase> map = new HashMap<String, IAtomBase>();
map.putAll(first.getRgroupMap());
// depends on control dependency: [if], data = [none]
map.putAll(current.getRgroupMap());
// depends on control dependency: [if], data = [none]
first.setRgroupMap(map);
// depends on control dependency: [if], data = [none]
} /* Unknown connection */ else {
LOG.error("Intra connection is unknown");
// depends on control dependency: [if], data = [none]
throw new BuilderMoleculeException("Intra connection is unknown");
}
} /* first Monomer! */ else {
prevMonomer = currentMonomer;
// depends on control dependency: [if], data = [none]
input = getInput(prevMonomer);
// depends on control dependency: [if], data = [(prevMonomer]
prevMolecule =
Chemistry.getInstance().getManipulator().getMolecule(input, generateAttachmentList(prevMonomer.getAttachmentList()));
// depends on control dependency: [if], data = [none]
firstMolecule = prevMolecule;
// depends on control dependency: [if], data = [none]
first.setMolecule(firstMolecule);
// depends on control dependency: [if], data = [none]
first.setRgroupMap(generateRgroupMap(id + ":" + String.valueOf(i), firstMolecule));
// depends on control dependency: [if], data = [none]
}
}
LOG.debug(first.getRgroupMap().keySet().toString());
return first;
} catch (IOException | CTKException e) {
LOG.error("Polymer(Peptide/RNA) molecule can't be built " + e.getMessage());
throw new BuilderMoleculeException("Polymer(Peptide/RNA) molecule can't be built " + e.getMessage());
}
} } |
public class class_name {
private static JavaDumper createInstance() {
try {
// Try to find IBM Java dumper class.
Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
try {
// Try to find the IBM Java 7.1 dump methods.
Class<?>[] paramTypes = new Class<?>[] { String.class };
Method javaDumpToFileMethod = dumpClass.getMethod("javaDumpToFile", paramTypes);
Method heapDumpToFileMethod = dumpClass.getMethod("heapDumpToFile", paramTypes);
Method systemDumpToFileMethod = dumpClass.getMethod("systemDumpToFile", paramTypes);
return new IBMJavaDumperImpl(javaDumpToFileMethod, heapDumpToFileMethod, systemDumpToFileMethod);
} catch (NoSuchMethodException e) {
return new IBMLegacyJavaDumperImpl(dumpClass);
}
} catch (ClassNotFoundException ex) {
// Try to find HotSpot MBeans.
ObjectName diagName;
ObjectName diagCommandName;
try {
diagName = new ObjectName("com.sun.management:type=HotSpotDiagnostic");
diagCommandName = new ObjectName("com.sun.management:type=DiagnosticCommand");
} catch (MalformedObjectNameException ex2) {
throw new IllegalStateException(ex2);
}
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (!mbeanServer.isRegistered(diagName)) {
diagName = null;
}
if (!mbeanServer.isRegistered(diagCommandName)) {
diagCommandName = null;
}
return new HotSpotJavaDumperImpl(mbeanServer, diagName, diagCommandName);
}
} } | public class class_name {
private static JavaDumper createInstance() {
try {
// Try to find IBM Java dumper class.
Class<?> dumpClass = Class.forName("com.ibm.jvm.Dump");
try {
// Try to find the IBM Java 7.1 dump methods.
Class<?>[] paramTypes = new Class<?>[] { String.class };
Method javaDumpToFileMethod = dumpClass.getMethod("javaDumpToFile", paramTypes);
Method heapDumpToFileMethod = dumpClass.getMethod("heapDumpToFile", paramTypes);
Method systemDumpToFileMethod = dumpClass.getMethod("systemDumpToFile", paramTypes);
return new IBMJavaDumperImpl(javaDumpToFileMethod, heapDumpToFileMethod, systemDumpToFileMethod);
} catch (NoSuchMethodException e) { // depends on control dependency: [try], data = [none]
return new IBMLegacyJavaDumperImpl(dumpClass);
}
} catch (ClassNotFoundException ex) {
// Try to find HotSpot MBeans.
ObjectName diagName;
ObjectName diagCommandName;
try {
diagName = new ObjectName("com.sun.management:type=HotSpotDiagnostic"); // depends on control dependency: [try], data = [none]
diagCommandName = new ObjectName("com.sun.management:type=DiagnosticCommand"); // depends on control dependency: [try], data = [none]
} catch (MalformedObjectNameException ex2) {
throw new IllegalStateException(ex2);
} // depends on control dependency: [catch], data = [none]
MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
if (!mbeanServer.isRegistered(diagName)) {
diagName = null; // depends on control dependency: [if], data = [none]
}
if (!mbeanServer.isRegistered(diagCommandName)) {
diagCommandName = null; // depends on control dependency: [if], data = [none]
}
return new HotSpotJavaDumperImpl(mbeanServer, diagName, diagCommandName);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public OrderlessRouter<T> addRoute(String pathPattern, T target) {
PathPattern p = new PathPattern(pathPattern);
if (routes.containsKey(p)) {
return this;
}
routes.put(p, target);
addReverseRoute(target, p);
return this;
} } | public class class_name {
public OrderlessRouter<T> addRoute(String pathPattern, T target) {
PathPattern p = new PathPattern(pathPattern);
if (routes.containsKey(p)) {
return this; // depends on control dependency: [if], data = [none]
}
routes.put(p, target);
addReverseRoute(target, p);
return this;
} } |
public class class_name {
protected void postPublishEvent(Collection<EntryEventData> eventDataIncludingValues,
Collection<EntryEventData> eventDataExcludingValues) {
// publish event data of interest to query caches; since query cache listener registrations
// include values (as these are required to properly filter according to the query cache's predicate),
// we do not take into account eventDataExcludingValues, if any were generated
if (eventDataIncludingValues != null) {
for (EntryEventData entryEventData : eventDataIncludingValues) {
queryCacheEventPublisher.addEventToQueryCache(entryEventData);
}
}
} } | public class class_name {
protected void postPublishEvent(Collection<EntryEventData> eventDataIncludingValues,
Collection<EntryEventData> eventDataExcludingValues) {
// publish event data of interest to query caches; since query cache listener registrations
// include values (as these are required to properly filter according to the query cache's predicate),
// we do not take into account eventDataExcludingValues, if any were generated
if (eventDataIncludingValues != null) {
for (EntryEventData entryEventData : eventDataIncludingValues) {
queryCacheEventPublisher.addEventToQueryCache(entryEventData); // depends on control dependency: [for], data = [entryEventData]
}
}
} } |
public class class_name {
public BoxTransform concatenate(BoxTransform src)
{
if (src.isEmpty())
return this;
else if (this.isEmpty())
return src;
else
{
BoxTransform ret = new BoxTransform(this);
ret.transform = new AffineTransform(transform);
ret.transform.concatenate(src.transform);
return ret;
}
} } | public class class_name {
public BoxTransform concatenate(BoxTransform src)
{
if (src.isEmpty())
return this;
else if (this.isEmpty())
return src;
else
{
BoxTransform ret = new BoxTransform(this);
ret.transform = new AffineTransform(transform); // depends on control dependency: [if], data = [none]
ret.transform.concatenate(src.transform); // depends on control dependency: [if], data = [none]
return ret; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void addServiceManagementBean(ServiceContext serviceContext) {
GatewayManagementBean gatewayManagementBean = getLocalGatewayManagementBean();
ServiceManagementBean serviceManagementBean = serviceManagmentBeanFactory.newServiceManagementBean(
serviceContext.getServiceType(), gatewayManagementBean, serviceContext);
ServiceManagementBean tempBean = serviceManagementBeans.putIfAbsent(serviceContext, serviceManagementBean);
if (tempBean == null) {
// A bean was not already created for this service
for (ManagementServiceHandler handler : managementServiceHandlers) {
handler.addServiceManagementBean(serviceManagementBean);
}
}
} } | public class class_name {
@Override
public void addServiceManagementBean(ServiceContext serviceContext) {
GatewayManagementBean gatewayManagementBean = getLocalGatewayManagementBean();
ServiceManagementBean serviceManagementBean = serviceManagmentBeanFactory.newServiceManagementBean(
serviceContext.getServiceType(), gatewayManagementBean, serviceContext);
ServiceManagementBean tempBean = serviceManagementBeans.putIfAbsent(serviceContext, serviceManagementBean);
if (tempBean == null) {
// A bean was not already created for this service
for (ManagementServiceHandler handler : managementServiceHandlers) {
handler.addServiceManagementBean(serviceManagementBean); // depends on control dependency: [for], data = [handler]
}
}
} } |
public class class_name {
public static List<InetSocketAddress> getJobMasterRpcAddresses(AlluxioConfiguration conf) {
// First check whether job rpc addresses are explicitly configured.
if (conf.isSet(PropertyKey.JOB_MASTER_RPC_ADDRESSES)) {
return parseInetSocketAddresses(
conf.getList(PropertyKey.JOB_MASTER_RPC_ADDRESSES, ","));
}
int jobRpcPort =
NetworkAddressUtils.getPort(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, conf);
// Fall back on explicitly configured regular master rpc addresses.
if (conf.isSet(PropertyKey.MASTER_RPC_ADDRESSES)) {
List<InetSocketAddress> addrs =
parseInetSocketAddresses(conf.getList(PropertyKey.MASTER_RPC_ADDRESSES, ","));
return overridePort(addrs, jobRpcPort);
}
// Fall back on server-side journal configuration.
return overridePort(getEmbeddedJournalAddresses(conf, ServiceType.JOB_MASTER_RAFT), jobRpcPort);
} } | public class class_name {
public static List<InetSocketAddress> getJobMasterRpcAddresses(AlluxioConfiguration conf) {
// First check whether job rpc addresses are explicitly configured.
if (conf.isSet(PropertyKey.JOB_MASTER_RPC_ADDRESSES)) {
return parseInetSocketAddresses(
conf.getList(PropertyKey.JOB_MASTER_RPC_ADDRESSES, ",")); // depends on control dependency: [if], data = [none]
}
int jobRpcPort =
NetworkAddressUtils.getPort(NetworkAddressUtils.ServiceType.JOB_MASTER_RPC, conf);
// Fall back on explicitly configured regular master rpc addresses.
if (conf.isSet(PropertyKey.MASTER_RPC_ADDRESSES)) {
List<InetSocketAddress> addrs =
parseInetSocketAddresses(conf.getList(PropertyKey.MASTER_RPC_ADDRESSES, ","));
return overridePort(addrs, jobRpcPort); // depends on control dependency: [if], data = [none]
}
// Fall back on server-side journal configuration.
return overridePort(getEmbeddedJournalAddresses(conf, ServiceType.JOB_MASTER_RAFT), jobRpcPort);
} } |
public class class_name {
public Pattern getPattern()
{
if(pattern == null) {
pattern = constructPattern();
if (this instanceof SIFMiner && idFetcher != null && idMap != null) {
pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getSourceLabel());
pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getTargetLabel());
}
pattern.optimizeConstraintOrder();
}
return pattern;
} } | public class class_name {
public Pattern getPattern()
{
if(pattern == null) {
pattern = constructPattern(); // depends on control dependency: [if], data = [none]
if (this instanceof SIFMiner && idFetcher != null && idMap != null) {
pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getSourceLabel()); // depends on control dependency: [if], data = [none]
pattern.add(new HasAnID(idFetcher, idMap), ((SIFMiner) this).getTargetLabel()); // depends on control dependency: [if], data = [none]
}
pattern.optimizeConstraintOrder(); // depends on control dependency: [if], data = [none]
}
return pattern;
} } |
public class class_name {
public java.util.List<ECSService> getEcsServices() {
if (ecsServices == null) {
ecsServices = new com.amazonaws.internal.SdkInternalList<ECSService>();
}
return ecsServices;
} } | public class class_name {
public java.util.List<ECSService> getEcsServices() {
if (ecsServices == null) {
ecsServices = new com.amazonaws.internal.SdkInternalList<ECSService>(); // depends on control dependency: [if], data = [none]
}
return ecsServices;
} } |
public class class_name {
public Number optNumber(int index, Number defaultValue) {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue;
}
if (val instanceof Number){
return (Number) val;
}
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val);
} catch (Exception e) {
return defaultValue;
}
}
return defaultValue;
} } | public class class_name {
public Number optNumber(int index, Number defaultValue) {
Object val = this.opt(index);
if (JSONObject.NULL.equals(val)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
if (val instanceof Number){
return (Number) val; // depends on control dependency: [if], data = [none]
}
if (val instanceof String) {
try {
return JSONObject.stringToNumber((String) val); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return defaultValue;
} // depends on control dependency: [catch], data = [none]
}
return defaultValue;
} } |
public class class_name {
private String readNmtoken(boolean isName) throws SAXException, IOException {
char c;
nameBufferPos = 0;
// Read the first character.
while (true) {
c = readCh();
switch (c) {
case '%':
case '<':
case '>':
case '&':
case ',':
case '|':
case '*':
case '+':
case '?':
case ')':
case '=':
case '\'':
case '"':
case '[':
case ' ':
case '\t':
case '\n':
case '\r':
case ';':
case '/':
unread(c);
if (nameBufferPos == 0) {
fatal("name expected");
}
String s = intern(nameBuffer, 0, nameBufferPos);
nameBufferPos = 0;
return s;
default:
if (isName && (nameBufferPos == 0)
&& (!(NCName.isNCNameStart(c)))) {
fatal("Not a name start character, U+"
+ Integer.toHexString(c));
} else if (!(NCName.isNCNameTrail(c) || c == ':')) {
fatal("Not a name character, U+"
+ Integer.toHexString(c));
}
if (nameBufferPos >= nameBuffer.length) {
nameBuffer = (char[]) extendArray(nameBuffer,
nameBuffer.length, nameBufferPos);
}
nameBuffer[nameBufferPos++] = c;
}
}
} } | public class class_name {
private String readNmtoken(boolean isName) throws SAXException, IOException {
char c;
nameBufferPos = 0;
// Read the first character.
while (true) {
c = readCh();
switch (c) {
case '%':
case '<':
case '>':
case '&':
case ',':
case '|':
case '*':
case '+':
case '?':
case ')':
case '=':
case '\'':
case '"':
case '[':
case ' ':
case '\t':
case '\n':
case '\r':
case ';':
case '/':
unread(c);
if (nameBufferPos == 0) {
fatal("name expected"); // depends on control dependency: [if], data = [none]
}
String s = intern(nameBuffer, 0, nameBufferPos);
nameBufferPos = 0;
return s;
default:
if (isName && (nameBufferPos == 0)
&& (!(NCName.isNCNameStart(c)))) {
fatal("Not a name start character, U+"
+ Integer.toHexString(c)); // depends on control dependency: [if], data = [none]
} else if (!(NCName.isNCNameTrail(c) || c == ':')) {
fatal("Not a name character, U+"
+ Integer.toHexString(c)); // depends on control dependency: [if], data = [none]
}
if (nameBufferPos >= nameBuffer.length) {
nameBuffer = (char[]) extendArray(nameBuffer,
nameBuffer.length, nameBufferPos); // depends on control dependency: [if], data = [none]
}
nameBuffer[nameBufferPos++] = c;
}
}
} } |
public class class_name {
protected TemplateEngine getTemplateEngine() {
if (cachedTemplateEngine != null) {
return cachedTemplateEngine;
}
synchronized (this) {
if (cachedTemplateEngine != null) {
return cachedTemplateEngine;
}
cachedTemplateEngine = createTemplateEngine();
}
return cachedTemplateEngine;
} } | public class class_name {
protected TemplateEngine getTemplateEngine() {
if (cachedTemplateEngine != null) {
return cachedTemplateEngine; // depends on control dependency: [if], data = [none]
}
synchronized (this) {
if (cachedTemplateEngine != null) {
return cachedTemplateEngine; // depends on control dependency: [if], data = [none]
}
cachedTemplateEngine = createTemplateEngine();
}
return cachedTemplateEngine;
} } |
public class class_name {
private boolean insert(T element) {
if (!entries.containsKey(element)) {
head = createEntry(element, head);
entries.put(element, head);
return true;
}
return false;
} } | public class class_name {
private boolean insert(T element) {
if (!entries.containsKey(element)) {
head = createEntry(element, head); // depends on control dependency: [if], data = [none]
entries.put(element, head); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static boolean isClazzExists(String name) {
try {
Class.forName(name, false, Decisions.class.getClassLoader());
} catch (ClassNotFoundException e) {
return false;
}
return true;
} } | public class class_name {
public static boolean isClazzExists(String name) {
try {
Class.forName(name, false, Decisions.class.getClassLoader());
} catch (ClassNotFoundException e) {
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
private GeneralizedCounter<K> conditionalizeHelper(K o) {
if (depth > 1) {
GeneralizedCounter<K> next = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o));
if (next == null) // adds a new GeneralizedCounter if needed
{
map.put(o, (next = new GeneralizedCounter<K>(depth - 1)));
}
return next;
} else {
throw new RuntimeException("Error -- can't conditionalize a distribution of depth 1");
}
} } | public class class_name {
private GeneralizedCounter<K> conditionalizeHelper(K o) {
if (depth > 1) {
GeneralizedCounter<K> next = ErasureUtils.<GeneralizedCounter<K>>uncheckedCast(map.get(o));
if (next == null) // adds a new GeneralizedCounter if needed
{
map.put(o, (next = new GeneralizedCounter<K>(depth - 1)));
// depends on control dependency: [if], data = [(next]
}
return next;
// depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Error -- can't conditionalize a distribution of depth 1");
}
} } |
public class class_name {
protected void descriminateType(
EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
if (Byte.class.getName().equals(defaultClassName)
|| Short.class.getName().equals(defaultClassName)
|| Integer.class.getName().equals(defaultClassName)
|| Long.class.getName().equals(defaultClassName)
|| Float.class.getName().equals(defaultClassName)
|| Double.class.getName().equals(defaultClassName)
|| BigInteger.class.getName().equals(defaultClassName)
|| BigDecimal.class.getName().equals(defaultClassName)
|| byte.class.getName().equals(defaultClassName)
|| short.class.getName().equals(defaultClassName)
|| int.class.getName().equals(defaultClassName)
|| long.class.getName().equals(defaultClassName)
|| float.class.getName().equals(defaultClassName)
|| double.class.getName().equals(defaultClassName)) {
propertyDesc.setNumber(true);
} else if (Time.class.getName().equals(defaultClassName)
|| LocalTime.class.getName().equals(defaultClassName)) {
propertyDesc.setTime(true);
} else if (Date.class.getName().equals(defaultClassName)
|| LocalDate.class.getName().equals(defaultClassName)) {
propertyDesc.setDate(true);
} else if (Timestamp.class.getName().equals(defaultClassName)
|| java.util.Date.class.getName().equals(defaultClassName)
|| LocalDateTime.class.getName().equals(defaultClassName)) {
propertyDesc.setTimestamp(true);
}
} } | public class class_name {
protected void descriminateType(
EntityDesc entityDesc, EntityPropertyDesc propertyDesc, ColumnMeta columnMeta) {
String defaultClassName = dialect.getMappedPropertyClassName(columnMeta);
if (Byte.class.getName().equals(defaultClassName)
|| Short.class.getName().equals(defaultClassName)
|| Integer.class.getName().equals(defaultClassName)
|| Long.class.getName().equals(defaultClassName)
|| Float.class.getName().equals(defaultClassName)
|| Double.class.getName().equals(defaultClassName)
|| BigInteger.class.getName().equals(defaultClassName)
|| BigDecimal.class.getName().equals(defaultClassName)
|| byte.class.getName().equals(defaultClassName)
|| short.class.getName().equals(defaultClassName)
|| int.class.getName().equals(defaultClassName)
|| long.class.getName().equals(defaultClassName)
|| float.class.getName().equals(defaultClassName)
|| double.class.getName().equals(defaultClassName)) {
propertyDesc.setNumber(true); // depends on control dependency: [if], data = [none]
} else if (Time.class.getName().equals(defaultClassName)
|| LocalTime.class.getName().equals(defaultClassName)) {
propertyDesc.setTime(true); // depends on control dependency: [if], data = [none]
} else if (Date.class.getName().equals(defaultClassName)
|| LocalDate.class.getName().equals(defaultClassName)) {
propertyDesc.setDate(true); // depends on control dependency: [if], data = [none]
} else if (Timestamp.class.getName().equals(defaultClassName)
|| java.util.Date.class.getName().equals(defaultClassName)
|| LocalDateTime.class.getName().equals(defaultClassName)) {
propertyDesc.setTimestamp(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static boolean isEmpty(@Nonnull final File file, @Nonnull final Charset charset) {
try {
return FileUtil.isEmpty(file, charset);
} catch (final IOException e) {
throw new IllegalStateOfArgumentException("The given file could not be read.", e);
}
} } | public class class_name {
private static boolean isEmpty(@Nonnull final File file, @Nonnull final Charset charset) {
try {
return FileUtil.isEmpty(file, charset); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
throw new IllegalStateOfArgumentException("The given file could not be read.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Routes setBaseViewPath(String baseViewPath) {
if (StrKit.isBlank(baseViewPath)) {
throw new IllegalArgumentException("baseViewPath can not be blank");
}
baseViewPath = baseViewPath.trim();
if (! baseViewPath.startsWith("/")) { // add prefix "/"
baseViewPath = "/" + baseViewPath;
}
if (baseViewPath.endsWith("/")) { // remove "/" in the end of baseViewPath
baseViewPath = baseViewPath.substring(0, baseViewPath.length() - 1);
}
this.baseViewPath = baseViewPath;
return this;
} } | public class class_name {
public Routes setBaseViewPath(String baseViewPath) {
if (StrKit.isBlank(baseViewPath)) {
throw new IllegalArgumentException("baseViewPath can not be blank");
}
baseViewPath = baseViewPath.trim();
if (! baseViewPath.startsWith("/")) { // add prefix "/"
baseViewPath = "/" + baseViewPath;
// depends on control dependency: [if], data = [none]
}
if (baseViewPath.endsWith("/")) { // remove "/" in the end of baseViewPath
baseViewPath = baseViewPath.substring(0, baseViewPath.length() - 1);
// depends on control dependency: [if], data = [none]
}
this.baseViewPath = baseViewPath;
return this;
} } |
public class class_name {
private float[] getData50002(RandomAccessFile raf, Grib2Drs.Type50002 gdrs) throws IOException {
BitReader reader;
reader = new BitReader(raf, startPos + 5);
int[] groupWidth = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
groupWidth[i] = (int) reader.bits2UInt(gdrs.widthOfWidth);
}
reader = new BitReader(raf, raf.getFilePointer());
int[] groupLength = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
groupLength[i] = (int) reader.bits2UInt(gdrs.widthOfLength);
}
reader = new BitReader(raf, raf.getFilePointer());
int[] firstOrderValues = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
firstOrderValues[i] = (int) reader.bits2UInt(gdrs.widthOfFirstOrderValues);
}
int bias = 0;
if (gdrs.orderOfSPD > 0) {
bias = gdrs.spd[gdrs.orderOfSPD];
}
reader = new BitReader(raf, raf.getFilePointer());
int cnt = gdrs.orderOfSPD;
int[] data = new int[totalNPoints];
for (int i = 0; i < gdrs.p1; i++) {
if (groupWidth[i] > 0) {
for (int j = 0; j < groupLength[i]; j++) {
data[cnt] = (int) reader.bits2UInt(groupWidth[i]);
data[cnt] += firstOrderValues[i];
cnt++;
}
} else {
for (int j = 0; j < groupLength[i]; j++) {
data[cnt] = firstOrderValues[i];
cnt++;
}
}
}
if (gdrs.orderOfSPD >= 0) {
System.arraycopy(gdrs.spd, 0, data, 0, gdrs.orderOfSPD);
}
int y, z, w;
switch (gdrs.orderOfSPD) {
case 1:
y = data[0];
for (int i = 1; i < totalNPoints; i++) {
y += data[i] + bias;
data[i] = y;
}
break;
case 2:
y = data[1] - data[0];
z = data[1];
for (int i = 2; i < totalNPoints; i++) {
y += data[i] + bias;
z += y;
data[i] = z;
}
break;
case 3:
y = data[2] - data[1];
z = y - (data[1] - data[0]);
w = data[2];
for (int i = 3; i < totalNPoints; i++) {
z += data[i] + bias;
y += z;
w += y;
data[i] = w;
}
break;
}
int D = gdrs.decimalScaleFactor;
float DD = (float) java.lang.Math.pow((double) 10, (double) D);
float R = gdrs.referenceValue;
int E = gdrs.binaryScaleFactor;
float EE = (float) java.lang.Math.pow(2.0, (double) E);
float[] ret = new float[totalNPoints];
for (int i = 0; i < totalNPoints; i++) {
ret[i] = (((data[i] * EE) + R) * DD);
}
return ret;
} } | public class class_name {
private float[] getData50002(RandomAccessFile raf, Grib2Drs.Type50002 gdrs) throws IOException {
BitReader reader;
reader = new BitReader(raf, startPos + 5);
int[] groupWidth = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
groupWidth[i] = (int) reader.bits2UInt(gdrs.widthOfWidth);
}
reader = new BitReader(raf, raf.getFilePointer());
int[] groupLength = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
groupLength[i] = (int) reader.bits2UInt(gdrs.widthOfLength);
}
reader = new BitReader(raf, raf.getFilePointer());
int[] firstOrderValues = new int[gdrs.p1];
for (int i = 0; i < gdrs.p1; i++) {
firstOrderValues[i] = (int) reader.bits2UInt(gdrs.widthOfFirstOrderValues);
}
int bias = 0;
if (gdrs.orderOfSPD > 0) {
bias = gdrs.spd[gdrs.orderOfSPD];
}
reader = new BitReader(raf, raf.getFilePointer());
int cnt = gdrs.orderOfSPD;
int[] data = new int[totalNPoints];
for (int i = 0; i < gdrs.p1; i++) {
if (groupWidth[i] > 0) {
for (int j = 0; j < groupLength[i]; j++) {
data[cnt] = (int) reader.bits2UInt(groupWidth[i]); // depends on control dependency: [for], data = [none]
data[cnt] += firstOrderValues[i]; // depends on control dependency: [for], data = [none]
cnt++; // depends on control dependency: [for], data = [none]
}
} else {
for (int j = 0; j < groupLength[i]; j++) {
data[cnt] = firstOrderValues[i]; // depends on control dependency: [for], data = [none]
cnt++; // depends on control dependency: [for], data = [none]
}
}
}
if (gdrs.orderOfSPD >= 0) {
System.arraycopy(gdrs.spd, 0, data, 0, gdrs.orderOfSPD);
}
int y, z, w;
switch (gdrs.orderOfSPD) {
case 1:
y = data[0];
for (int i = 1; i < totalNPoints; i++) {
y += data[i] + bias;
data[i] = y;
}
break;
case 2:
y = data[1] - data[0];
z = data[1];
for (int i = 2; i < totalNPoints; i++) {
y += data[i] + bias;
z += y;
data[i] = z;
}
break;
case 3:
y = data[2] - data[1];
z = y - (data[1] - data[0]);
w = data[2];
for (int i = 3; i < totalNPoints; i++) {
z += data[i] + bias;
y += z;
w += y;
data[i] = w;
}
break;
}
int D = gdrs.decimalScaleFactor;
float DD = (float) java.lang.Math.pow((double) 10, (double) D);
float R = gdrs.referenceValue;
int E = gdrs.binaryScaleFactor;
float EE = (float) java.lang.Math.pow(2.0, (double) E);
float[] ret = new float[totalNPoints];
for (int i = 0; i < totalNPoints; i++) {
ret[i] = (((data[i] * EE) + R) * DD);
}
return ret;
} } |
public class class_name {
public VTimeZone loadVTimeZone(String id) throws IOException, ParserException, ParseException {
Validate.notBlank(id, "Invalid TimeZone ID: [%s]", id);
if (!cache.containsId(id)) {
final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics");
if (resource != null) {
try (InputStream in = resource.openStream()) {
final CalendarBuilder builder = new CalendarBuilder();
final Calendar calendar = builder.build(in);
final VTimeZone vTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE);
// load any available updates for the timezone.. can be explicility disabled via configuration
if (!"false".equals(Configurator.getProperty(UPDATE_ENABLED).orElse("true"))) {
return updateDefinition(vTimeZone);
}
if (vTimeZone != null) {
cache.putIfAbsent(id, vTimeZone);
}
}
} else {
return generateTimezoneForId(id);
}
}
return cache.getTimezone(id);
} } | public class class_name {
public VTimeZone loadVTimeZone(String id) throws IOException, ParserException, ParseException {
Validate.notBlank(id, "Invalid TimeZone ID: [%s]", id);
if (!cache.containsId(id)) {
final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics");
if (resource != null) {
try (InputStream in = resource.openStream()) {
final CalendarBuilder builder = new CalendarBuilder();
final Calendar calendar = builder.build(in);
final VTimeZone vTimeZone = (VTimeZone) calendar.getComponent(Component.VTIMEZONE);
// load any available updates for the timezone.. can be explicility disabled via configuration
if (!"false".equals(Configurator.getProperty(UPDATE_ENABLED).orElse("true"))) {
return updateDefinition(vTimeZone); // depends on control dependency: [if], data = [none]
}
if (vTimeZone != null) {
cache.putIfAbsent(id, vTimeZone); // depends on control dependency: [if], data = [none]
}
}
} else {
return generateTimezoneForId(id);
}
}
return cache.getTimezone(id);
} } |
public class class_name {
@CanIgnoreReturnValue
public static boolean removeAll(Iterator<?> removeFrom, Collection<?> elementsToRemove) {
checkNotNull(elementsToRemove);
boolean result = false;
while (removeFrom.hasNext()) {
if (elementsToRemove.contains(removeFrom.next())) {
removeFrom.remove();
result = true;
}
}
return result;
} } | public class class_name {
@CanIgnoreReturnValue
public static boolean removeAll(Iterator<?> removeFrom, Collection<?> elementsToRemove) {
checkNotNull(elementsToRemove);
boolean result = false;
while (removeFrom.hasNext()) {
if (elementsToRemove.contains(removeFrom.next())) {
removeFrom.remove(); // depends on control dependency: [if], data = [none]
result = true; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static boolean templateTagAction(
String element,
String elementlist,
boolean checkall,
boolean checknone,
ServletRequest req) {
if (elementlist != null) {
CmsFlexController controller = CmsFlexController.getController(req);
String filename = controller.getCmsObject().getRequestContext().getUri();
I_CmsXmlDocument content = null;
try {
content = CmsXmlPageFactory.unmarshal(controller.getCmsObject(), filename, req);
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_XML_DOCUMENT_UNMARSHAL_1, filename), e);
}
if (content != null) {
String absolutePath = controller.getCmsObject().getSitePath(content.getFile());
// check the elements in the elementlist, if the check fails don't render the element
String[] elements = CmsStringUtil.splitAsArray(elementlist, ',');
boolean found = false;
for (int i = 0; i < elements.length; i++) {
String el = elements[i].trim();
List<Locale> locales = content.getLocales(el);
Locale locale = null;
if ((locales != null) && (locales.size() != 0)) {
locale = OpenCms.getLocaleManager().getBestMatchingLocale(
controller.getCmsObject().getRequestContext().getLocale(),
OpenCms.getLocaleManager().getDefaultLocales(controller.getCmsObject(), absolutePath),
locales);
}
if ((locale != null) && content.hasValue(el, locale) && content.isEnabled(el, locale)) {
found = true;
if (!checkall) {
// found at least an element that is available
break;
}
} else {
if (checkall) {
// found at least an element that is not available
return false;
}
}
}
if (!found && !checknone) {
// no element found while checking for existing elements
return false;
} else if (found && checknone) {
// element found while checking for nonexisting elements
return false;
}
}
}
// otherwise, check if an element was defined and if its equal to the desired element
String param = req.getParameter(I_CmsResourceLoader.PARAMETER_ELEMENT);
return ((element == null) || (param == null) || (param.equals(element)));
} } | public class class_name {
public static boolean templateTagAction(
String element,
String elementlist,
boolean checkall,
boolean checknone,
ServletRequest req) {
if (elementlist != null) {
CmsFlexController controller = CmsFlexController.getController(req);
String filename = controller.getCmsObject().getRequestContext().getUri();
I_CmsXmlDocument content = null;
try {
content = CmsXmlPageFactory.unmarshal(controller.getCmsObject(), filename, req); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_XML_DOCUMENT_UNMARSHAL_1, filename), e);
} // depends on control dependency: [catch], data = [none]
if (content != null) {
String absolutePath = controller.getCmsObject().getSitePath(content.getFile());
// check the elements in the elementlist, if the check fails don't render the element
String[] elements = CmsStringUtil.splitAsArray(elementlist, ',');
boolean found = false;
for (int i = 0; i < elements.length; i++) {
String el = elements[i].trim();
List<Locale> locales = content.getLocales(el);
Locale locale = null;
if ((locales != null) && (locales.size() != 0)) {
locale = OpenCms.getLocaleManager().getBestMatchingLocale(
controller.getCmsObject().getRequestContext().getLocale(),
OpenCms.getLocaleManager().getDefaultLocales(controller.getCmsObject(), absolutePath),
locales); // depends on control dependency: [if], data = [none]
}
if ((locale != null) && content.hasValue(el, locale) && content.isEnabled(el, locale)) {
found = true; // depends on control dependency: [if], data = [none]
if (!checkall) {
// found at least an element that is available
break;
}
} else {
if (checkall) {
// found at least an element that is not available
return false; // depends on control dependency: [if], data = [none]
}
}
}
if (!found && !checknone) {
// no element found while checking for existing elements
return false; // depends on control dependency: [if], data = [none]
} else if (found && checknone) {
// element found while checking for nonexisting elements
return false; // depends on control dependency: [if], data = [none]
}
}
}
// otherwise, check if an element was defined and if its equal to the desired element
String param = req.getParameter(I_CmsResourceLoader.PARAMETER_ELEMENT);
return ((element == null) || (param == null) || (param.equals(element)));
} } |
public class class_name {
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
final int restore = canvas.save();
final int cx = getMeasuredWidth() / 2;
final int cy = getMeasuredHeight() / 2;
final int radius = getMeasuredWidth() / 2 - strokeWidth / 2;
float drawPercent = percent;
if (drawPercent > 0.97 && drawPercent < 1) {
// 设计师说这样比较好
drawPercent = 0.97f;
}
// 画渐变圆
canvas.save();
canvas.rotate(-90, cx, cy);
int[] colors;
float[] positions;
if (drawPercent < 1 && drawPercent > 0) {
calculatePercentEndColor(drawPercent);
customColors[1] = percentEndColor;
colors = customColors;
customPositions[1] = drawPercent;
customPositions[2] = drawPercent;
positions = customPositions;
} else if (drawPercent == 1) {
percentEndColor = endColor;
colors = fullColors;
positions = extremePositions;
} else {
// <= 0 || > 1?
colors = emptyColors;
positions = extremePositions;
}
final SweepGradient sweepGradient = new SweepGradient(getMeasuredWidth() / 2, getMeasuredHeight() / 2, colors, positions);
paint.setShader(sweepGradient);
canvas.drawCircle(cx, cy, radius, paint);
canvas.restore();
if (drawPercent > 0) {
// 绘制结束的半圆
if (drawPercent < 1 || (isFootOverHead && drawPercent == 1)) {
canvas.save();
endPaint.setColor(percentEndColor);
canvas.rotate((int) Math.floor(360.0f * drawPercent) - 1, cx, cy);
canvas.drawArc(rectF, -90f, 180f, true, endPaint);
canvas.restore();
}
if (!isFootOverHead || drawPercent < 1) {
canvas.save();
// 绘制开始的半圆
canvas.drawArc(rectF, 90f, 180f, true, startPaint);
canvas.restore();
}
}
canvas.restoreToCount(restore);
} } | public class class_name {
@SuppressLint("DrawAllocation")
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
final int restore = canvas.save();
final int cx = getMeasuredWidth() / 2;
final int cy = getMeasuredHeight() / 2;
final int radius = getMeasuredWidth() / 2 - strokeWidth / 2;
float drawPercent = percent;
if (drawPercent > 0.97 && drawPercent < 1) {
// 设计师说这样比较好
drawPercent = 0.97f; // depends on control dependency: [if], data = [none]
}
// 画渐变圆
canvas.save();
canvas.rotate(-90, cx, cy);
int[] colors;
float[] positions;
if (drawPercent < 1 && drawPercent > 0) {
calculatePercentEndColor(drawPercent); // depends on control dependency: [if], data = [none]
customColors[1] = percentEndColor; // depends on control dependency: [if], data = [none]
colors = customColors; // depends on control dependency: [if], data = [none]
customPositions[1] = drawPercent; // depends on control dependency: [if], data = [none]
customPositions[2] = drawPercent; // depends on control dependency: [if], data = [none]
positions = customPositions; // depends on control dependency: [if], data = [none]
} else if (drawPercent == 1) {
percentEndColor = endColor; // depends on control dependency: [if], data = [none]
colors = fullColors; // depends on control dependency: [if], data = [none]
positions = extremePositions; // depends on control dependency: [if], data = [none]
} else {
// <= 0 || > 1?
colors = emptyColors; // depends on control dependency: [if], data = [none]
positions = extremePositions; // depends on control dependency: [if], data = [none]
}
final SweepGradient sweepGradient = new SweepGradient(getMeasuredWidth() / 2, getMeasuredHeight() / 2, colors, positions);
paint.setShader(sweepGradient);
canvas.drawCircle(cx, cy, radius, paint);
canvas.restore();
if (drawPercent > 0) {
// 绘制结束的半圆
if (drawPercent < 1 || (isFootOverHead && drawPercent == 1)) {
canvas.save(); // depends on control dependency: [if], data = [none]
endPaint.setColor(percentEndColor); // depends on control dependency: [if], data = [none]
canvas.rotate((int) Math.floor(360.0f * drawPercent) - 1, cx, cy); // depends on control dependency: [if], data = [none]
canvas.drawArc(rectF, -90f, 180f, true, endPaint); // depends on control dependency: [if], data = [none]
canvas.restore(); // depends on control dependency: [if], data = [none]
}
if (!isFootOverHead || drawPercent < 1) {
canvas.save(); // depends on control dependency: [if], data = [none]
// 绘制开始的半圆
canvas.drawArc(rectF, 90f, 180f, true, startPaint); // depends on control dependency: [if], data = [none]
canvas.restore(); // depends on control dependency: [if], data = [none]
}
}
canvas.restoreToCount(restore);
} } |
public class class_name {
private void processGroups(ConfigurationAdmin configAdmin,
String roleName,
Dictionary<String, Object> roleProps, Set<String> pids) {
String[] groupPids = (String[]) roleProps.get(CFG_KEY_GROUP);
if (groupPids == null || groupPids.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No groups in role " + roleName);
}
} else {
Set<String> badGroups = new HashSet<String>();
Set<String> badAccessIds = new HashSet<String>();
for (int i = 0; i < groupPids.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "group pid " + i + ": " + groupPids[i]);
}
pids.add(groupPids[i]);
Configuration groupConfig = null;
try {
groupConfig = configAdmin.getConfiguration(groupPids[i], bundleLocation);
} catch (IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid group entry " + groupPids[i]);
}
continue;
}
if (groupConfig == null || groupConfig.getProperties() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null group element", groupPids[i]);
}
continue;
}
Dictionary<String, Object> groupProps = groupConfig.getProperties();
final String name = (String) groupProps.get("name");
final String accessId = (String) groupProps.get("access-id");
if (name == null || name.trim().isEmpty()) {
continue;
}
// access id takes precedence
if (accessId != null && AccessIdUtil.isGroupAccessId(accessId)) {
if (badAccessIds.contains(accessId)) {
// This accessId is already flagged as a duplicate
continue;
}
if (!accessIds.add(accessId)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_ACCESSID, accessId);
badAccessIds.add(accessId);
accessIds.remove(accessId);
}
} else {
// TODO: check for bad access id
if (badGroups.contains(name)) {
// This group is already flagged as a duplicate
continue;
}
if (name.trim().isEmpty()) {
// Empty entry, ignoring
continue;
}
if (!groups.add(name)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_GROUP, name);
badGroups.add(name);
groups.remove(name);
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Role " + roleName + " has groups:", groups);
}
}
} } | public class class_name {
private void processGroups(ConfigurationAdmin configAdmin,
String roleName,
Dictionary<String, Object> roleProps, Set<String> pids) {
String[] groupPids = (String[]) roleProps.get(CFG_KEY_GROUP);
if (groupPids == null || groupPids.length == 0) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "No groups in role " + roleName); // depends on control dependency: [if], data = [none]
}
} else {
Set<String> badGroups = new HashSet<String>();
Set<String> badAccessIds = new HashSet<String>();
for (int i = 0; i < groupPids.length; i++) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "group pid " + i + ": " + groupPids[i]); // depends on control dependency: [if], data = [none]
}
pids.add(groupPids[i]); // depends on control dependency: [for], data = [i]
Configuration groupConfig = null;
try {
groupConfig = configAdmin.getConfiguration(groupPids[i], bundleLocation); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Invalid group entry " + groupPids[i]); // depends on control dependency: [if], data = [none]
}
continue;
} // depends on control dependency: [catch], data = [none]
if (groupConfig == null || groupConfig.getProperties() == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Null group element", groupPids[i]); // depends on control dependency: [if], data = [none]
}
continue;
}
Dictionary<String, Object> groupProps = groupConfig.getProperties();
final String name = (String) groupProps.get("name");
final String accessId = (String) groupProps.get("access-id");
if (name == null || name.trim().isEmpty()) {
continue;
}
// access id takes precedence
if (accessId != null && AccessIdUtil.isGroupAccessId(accessId)) {
if (badAccessIds.contains(accessId)) {
// This accessId is already flagged as a duplicate
continue;
}
if (!accessIds.add(accessId)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_ACCESSID, accessId); // depends on control dependency: [if], data = [none]
badAccessIds.add(accessId); // depends on control dependency: [if], data = [none]
accessIds.remove(accessId); // depends on control dependency: [if], data = [none]
}
} else {
// TODO: check for bad access id
if (badGroups.contains(name)) {
// This group is already flagged as a duplicate
continue;
}
if (name.trim().isEmpty()) {
// Empty entry, ignoring
continue;
}
if (!groups.add(name)) {
Tr.error(tc, "AUTHZ_TABLE_DUPLICATE_ROLE_MEMBER", getRoleName(), CFG_KEY_GROUP, name); // depends on control dependency: [if], data = [none]
badGroups.add(name); // depends on control dependency: [if], data = [none]
groups.remove(name); // depends on control dependency: [if], data = [none]
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Role " + roleName + " has groups:", groups); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void directRefreshTree() {
int[] rowCounts;
DefaultMutableTreeNode propertiesNode;
// Added: (weconsultants@users) Moved tableNode here for visibiity nd new DECFM
DefaultMutableTreeNode tableNode;
DecimalFormat DECFMT = new DecimalFormat(" ( ####,###,####,##0 )");
// First clear the existing tree by simply enumerating
// over the root node's children and removing them one by one.
while (treeModel.getChildCount(rootNode) > 0) {
DefaultMutableTreeNode child =
(DefaultMutableTreeNode) treeModel.getChild(rootNode, 0);
treeModel.removeNodeFromParent(child);
child.removeAllChildren();
child.removeFromParent();
}
treeModel.nodeStructureChanged(rootNode);
treeModel.reload();
tScrollPane.repaint();
ResultSet result = null;
// Now rebuild the tree below its root
try {
// Start by naming the root node from its URL:
rootNode.setUserObject(dMeta.getURL());
// get metadata about user tables by building a vector of table names
result = dMeta.getTables(null, null, null, (showSys ? usertables
: nonSystables));
Vector tables = new Vector();
Vector schemas = new Vector();
// sqlbob@users Added remarks.
Vector remarks = new Vector();
String schema;
while (result.next()) {
schema = result.getString(2);
if ((!showSys) && isOracle
&& oracleSysUsers.contains(schema)) {
continue;
}
if (schemaFilter == null || schema.equals(schemaFilter)) {
schemas.addElement(schema);
tables.addElement(result.getString(3));
remarks.addElement(result.getString(5));
continue;
}
}
result.close();
result = null;
// Added: (weconsultants@users)
// Sort not to go into production. Have to sync with 'remarks Vector' for DBMS that has it
// Collections.sort(tables);
// Added: (weconsultants@users) - Add rowCounts if needed.
rowCounts = new int[tables.size()];
try {
rowCounts = getRowCounts(tables, schemas);
} catch (Exception e) {
// Added: (weconsultants@users)
CommonSwing.errorMessage(e);
}
ResultSet col;
// For each table, build a tree node with interesting info
for (int i = 0; i < tables.size(); i++) {
col = null;
String name;
try {
name = (String) tables.elementAt(i);
if (isOracle && name.startsWith("BIN$")) {
continue;
// Oracle Recyle Bin tables.
// Contains metacharacters which screw up metadata
// queries below.
}
schema = (String) schemas.elementAt(i);
String schemaname = "";
if (schema != null && showSchemas) {
schemaname = schema + '.';
}
String rowcount = displayRowCounts
? (" " + DECFMT.format(rowCounts[i]))
: "";
String displayedName = schemaname + name + rowcount;
// [email protected] Add rowCounts if needed.
tableNode = makeNode(displayedName, rootNode);
col = dMeta.getColumns(null, schema, name, null);
if ((schema != null) && !schema.trim().equals("")) {
makeNode(schema, tableNode);
}
// sqlbob@users Added remarks.
String remark = (String) remarks.elementAt(i);
if ((remark != null) && !remark.trim().equals("")) {
makeNode(remark, tableNode);
}
// This block is very slow for some Oracle tables.
// With a child for each column containing pertinent attributes
while (col.next()) {
String c = col.getString(4);
DefaultMutableTreeNode columnNode = makeNode(c,
tableNode);
String type = col.getString(6);
makeNode("Type: " + type, columnNode);
boolean nullable = col.getInt(11)
!= DatabaseMetaData.columnNoNulls;
makeNode("Nullable: " + nullable, columnNode);
}
} finally {
if (col != null) {
try {
col.close();
} catch (SQLException se) {}
}
}
DefaultMutableTreeNode indexesNode = makeNode("Indices",
tableNode);
if (showIndexDetails) {
ResultSet ind = null;
try {
ind = dMeta.getIndexInfo(null, schema, name, false,
false);
String oldiname = null;
DefaultMutableTreeNode indexNode = null;
// A child node to contain each index - and its attributes
while (ind.next()) {
boolean nonunique = ind.getBoolean(4);
String iname = ind.getString(6);
if ((oldiname == null
|| !oldiname.equals(iname))) {
indexNode = makeNode(iname, indexesNode);
makeNode("Unique: " + !nonunique, indexNode);
oldiname = iname;
}
// And the ordered column list for index components
makeNode(ind.getString(9), indexNode);
}
} catch (SQLException se) {
// Workaround for Oracle
if (se.getMessage() == null || ((!se.getMessage()
.startsWith("ORA-25191:")) && (!se.getMessage()
.startsWith("ORA-01702:")) && !se.getMessage()
.startsWith("ORA-01031:"))) {
throw se;
}
} finally {
if (ind != null) {
ind.close();
ind = null;
}
}
}
}
// Finally - a little additional metadata on this connection
propertiesNode = makeNode("Properties", rootNode);
makeNode("User: " + dMeta.getUserName(), propertiesNode);
makeNode("ReadOnly: " + cConn.isReadOnly(), propertiesNode);
makeNode("AutoCommit: " + cConn.getAutoCommit(), propertiesNode);
makeNode("Driver: " + dMeta.getDriverName(), propertiesNode);
makeNode("Product: " + dMeta.getDatabaseProductName(),
propertiesNode);
makeNode("Version: " + dMeta.getDatabaseProductVersion(),
propertiesNode);
} catch (SQLException se) {
propertiesNode = makeNode("Error getting metadata:", rootNode);
makeNode(se.getMessage(), propertiesNode);
makeNode(se.getSQLState(), propertiesNode);
CommonSwing.errorMessage(se);
} finally {
if (result != null) {
try {
result.close();
} catch (SQLException se) {}
}
}
treeModel.nodeStructureChanged(rootNode);
treeModel.reload();
tScrollPane.repaint();
// We want the Schema List to always be in sync with the displayed tree
updateSchemaList();
} } | public class class_name {
protected void directRefreshTree() {
int[] rowCounts;
DefaultMutableTreeNode propertiesNode;
// Added: (weconsultants@users) Moved tableNode here for visibiity nd new DECFM
DefaultMutableTreeNode tableNode;
DecimalFormat DECFMT = new DecimalFormat(" ( ####,###,####,##0 )");
// First clear the existing tree by simply enumerating
// over the root node's children and removing them one by one.
while (treeModel.getChildCount(rootNode) > 0) {
DefaultMutableTreeNode child =
(DefaultMutableTreeNode) treeModel.getChild(rootNode, 0);
treeModel.removeNodeFromParent(child); // depends on control dependency: [while], data = [none]
child.removeAllChildren(); // depends on control dependency: [while], data = [none]
child.removeFromParent(); // depends on control dependency: [while], data = [none]
}
treeModel.nodeStructureChanged(rootNode);
treeModel.reload();
tScrollPane.repaint();
ResultSet result = null;
// Now rebuild the tree below its root
try {
// Start by naming the root node from its URL:
rootNode.setUserObject(dMeta.getURL()); // depends on control dependency: [try], data = [none]
// get metadata about user tables by building a vector of table names
result = dMeta.getTables(null, null, null, (showSys ? usertables
: nonSystables)); // depends on control dependency: [try], data = [none]
Vector tables = new Vector();
Vector schemas = new Vector();
// sqlbob@users Added remarks.
Vector remarks = new Vector();
String schema;
while (result.next()) {
schema = result.getString(2); // depends on control dependency: [while], data = [none]
if ((!showSys) && isOracle
&& oracleSysUsers.contains(schema)) {
continue;
}
if (schemaFilter == null || schema.equals(schemaFilter)) {
schemas.addElement(schema); // depends on control dependency: [if], data = [none]
tables.addElement(result.getString(3)); // depends on control dependency: [if], data = [none]
remarks.addElement(result.getString(5)); // depends on control dependency: [if], data = [none]
continue;
}
}
result.close(); // depends on control dependency: [try], data = [none]
result = null; // depends on control dependency: [try], data = [none]
// Added: (weconsultants@users)
// Sort not to go into production. Have to sync with 'remarks Vector' for DBMS that has it
// Collections.sort(tables);
// Added: (weconsultants@users) - Add rowCounts if needed.
rowCounts = new int[tables.size()]; // depends on control dependency: [try], data = [none]
try {
rowCounts = getRowCounts(tables, schemas); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Added: (weconsultants@users)
CommonSwing.errorMessage(e);
} // depends on control dependency: [catch], data = [none]
ResultSet col;
// For each table, build a tree node with interesting info
for (int i = 0; i < tables.size(); i++) {
col = null; // depends on control dependency: [for], data = [none]
String name;
try {
name = (String) tables.elementAt(i); // depends on control dependency: [try], data = [none]
if (isOracle && name.startsWith("BIN$")) {
continue;
// Oracle Recyle Bin tables.
// Contains metacharacters which screw up metadata
// queries below.
}
schema = (String) schemas.elementAt(i); // depends on control dependency: [try], data = [none]
String schemaname = "";
if (schema != null && showSchemas) {
schemaname = schema + '.'; // depends on control dependency: [if], data = [none]
}
String rowcount = displayRowCounts
? (" " + DECFMT.format(rowCounts[i]))
: "";
String displayedName = schemaname + name + rowcount; // depends on control dependency: [try], data = [none]
// [email protected] Add rowCounts if needed.
tableNode = makeNode(displayedName, rootNode); // depends on control dependency: [try], data = [none]
col = dMeta.getColumns(null, schema, name, null); // depends on control dependency: [try], data = [none]
if ((schema != null) && !schema.trim().equals("")) {
makeNode(schema, tableNode); // depends on control dependency: [if], data = [none]
}
// sqlbob@users Added remarks.
String remark = (String) remarks.elementAt(i);
if ((remark != null) && !remark.trim().equals("")) {
makeNode(remark, tableNode); // depends on control dependency: [if], data = [none]
}
// This block is very slow for some Oracle tables.
// With a child for each column containing pertinent attributes
while (col.next()) {
String c = col.getString(4);
DefaultMutableTreeNode columnNode = makeNode(c,
tableNode);
String type = col.getString(6);
makeNode("Type: " + type, columnNode); // depends on control dependency: [while], data = [none]
boolean nullable = col.getInt(11)
!= DatabaseMetaData.columnNoNulls;
makeNode("Nullable: " + nullable, columnNode); // depends on control dependency: [while], data = [none]
}
} finally {
if (col != null) {
try {
col.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException se) {} // depends on control dependency: [catch], data = [none]
}
}
DefaultMutableTreeNode indexesNode = makeNode("Indices",
tableNode);
if (showIndexDetails) {
ResultSet ind = null;
try {
ind = dMeta.getIndexInfo(null, schema, name, false,
false); // depends on control dependency: [try], data = [none]
String oldiname = null;
DefaultMutableTreeNode indexNode = null;
// A child node to contain each index - and its attributes
while (ind.next()) {
boolean nonunique = ind.getBoolean(4);
String iname = ind.getString(6);
if ((oldiname == null
|| !oldiname.equals(iname))) {
indexNode = makeNode(iname, indexesNode); // depends on control dependency: [if], data = [none]
makeNode("Unique: " + !nonunique, indexNode); // depends on control dependency: [if], data = [none]
oldiname = iname; // depends on control dependency: [if], data = [none]
}
// And the ordered column list for index components
makeNode(ind.getString(9), indexNode); // depends on control dependency: [while], data = [none]
}
} catch (SQLException se) {
// Workaround for Oracle
if (se.getMessage() == null || ((!se.getMessage()
.startsWith("ORA-25191:")) && (!se.getMessage()
.startsWith("ORA-01702:")) && !se.getMessage()
.startsWith("ORA-01031:"))) {
throw se;
}
} finally { // depends on control dependency: [catch], data = [none]
if (ind != null) {
ind.close(); // depends on control dependency: [if], data = [none]
ind = null; // depends on control dependency: [if], data = [none]
}
}
}
}
// Finally - a little additional metadata on this connection
propertiesNode = makeNode("Properties", rootNode); // depends on control dependency: [try], data = [none]
makeNode("User: " + dMeta.getUserName(), propertiesNode); // depends on control dependency: [try], data = [none]
makeNode("ReadOnly: " + cConn.isReadOnly(), propertiesNode); // depends on control dependency: [try], data = [none]
makeNode("AutoCommit: " + cConn.getAutoCommit(), propertiesNode); // depends on control dependency: [try], data = [none]
makeNode("Driver: " + dMeta.getDriverName(), propertiesNode); // depends on control dependency: [try], data = [none]
makeNode("Product: " + dMeta.getDatabaseProductName(),
propertiesNode); // depends on control dependency: [try], data = [none]
makeNode("Version: " + dMeta.getDatabaseProductVersion(),
propertiesNode); // depends on control dependency: [try], data = [none]
} catch (SQLException se) {
propertiesNode = makeNode("Error getting metadata:", rootNode);
makeNode(se.getMessage(), propertiesNode);
makeNode(se.getSQLState(), propertiesNode);
CommonSwing.errorMessage(se);
} finally { // depends on control dependency: [catch], data = [none]
if (result != null) {
try {
result.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException se) {} // depends on control dependency: [catch], data = [none]
}
}
treeModel.nodeStructureChanged(rootNode);
treeModel.reload();
tScrollPane.repaint();
// We want the Schema List to always be in sync with the displayed tree
updateSchemaList();
} } |
public class class_name {
protected boolean isLeftmostNode() {
@SuppressWarnings("unchecked")
K node = (K) this;
while (node != null) {
K parent = node.getParent();
if (parent != null && parent.leftChild != node)
return false;
node = parent;
}
return true;
} } | public class class_name {
protected boolean isLeftmostNode() {
@SuppressWarnings("unchecked")
K node = (K) this;
while (node != null) {
K parent = node.getParent();
if (parent != null && parent.leftChild != node)
return false;
node = parent; // depends on control dependency: [while], data = [none]
}
return true;
} } |
public class class_name {
public void writeEndElement() throws SAXException {
processStartElement();
final QName qName = elementStack.remove(); // pop
transformer.endElement(qName.uri, qName.localName, qName.qName);
for (final NamespaceMapping p: qName.mappings) {
if (p.newMapping) {
transformer.endPrefixMapping(p.prefix);
}
}
} } | public class class_name {
public void writeEndElement() throws SAXException {
processStartElement();
final QName qName = elementStack.remove(); // pop
transformer.endElement(qName.uri, qName.localName, qName.qName);
for (final NamespaceMapping p: qName.mappings) {
if (p.newMapping) {
transformer.endPrefixMapping(p.prefix); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static <T extends Enum<T> & FieldNameProvider> List<Order> parse(final Class<T> enumType,
final String sortString) throws SortParameterSyntaxErrorException {
final List<Order> parsedSortings = new ArrayList<>();
// scan the sort tuples e.g. field:direction
if (sortString != null) {
final StringTokenizer tupleTokenizer = new StringTokenizer(sortString, DELIMITER_SORT_TUPLE);
while (tupleTokenizer.hasMoreTokens()) {
final String sortTuple = tupleTokenizer.nextToken().trim();
final StringTokenizer fieldDirectionTokenizer = new StringTokenizer(sortTuple,
DELIMITER_FIELD_DIRECTION);
if (fieldDirectionTokenizer.countTokens() == 2) {
final String fieldName = fieldDirectionTokenizer.nextToken().trim().toUpperCase();
final String sortDirectionStr = fieldDirectionTokenizer.nextToken().trim();
final T identifier = getAttributeIdentifierByName(enumType, fieldName);
final Direction sortDirection = getDirection(sortDirectionStr);
parsedSortings.add(new Order(sortDirection, identifier.getFieldName()));
} else {
throw new SortParameterSyntaxErrorException();
}
}
}
return parsedSortings;
} } | public class class_name {
public static <T extends Enum<T> & FieldNameProvider> List<Order> parse(final Class<T> enumType,
final String sortString) throws SortParameterSyntaxErrorException {
final List<Order> parsedSortings = new ArrayList<>();
// scan the sort tuples e.g. field:direction
if (sortString != null) {
final StringTokenizer tupleTokenizer = new StringTokenizer(sortString, DELIMITER_SORT_TUPLE);
while (tupleTokenizer.hasMoreTokens()) {
final String sortTuple = tupleTokenizer.nextToken().trim();
final StringTokenizer fieldDirectionTokenizer = new StringTokenizer(sortTuple,
DELIMITER_FIELD_DIRECTION);
if (fieldDirectionTokenizer.countTokens() == 2) {
final String fieldName = fieldDirectionTokenizer.nextToken().trim().toUpperCase();
final String sortDirectionStr = fieldDirectionTokenizer.nextToken().trim();
final T identifier = getAttributeIdentifierByName(enumType, fieldName);
final Direction sortDirection = getDirection(sortDirectionStr);
parsedSortings.add(new Order(sortDirection, identifier.getFieldName())); // depends on control dependency: [if], data = [none]
} else {
throw new SortParameterSyntaxErrorException();
}
}
}
return parsedSortings;
} } |
public class class_name {
protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = null;
try
{
item = findItemByName(parentId, name.getAsString(), name.getIndex());
while (item.next())
{
int columnClass = item.getInt(COLUMN_CLASS);
if (itemType == ItemType.UNKNOWN || columnClass == itemType.ordinal())
{
return itemData(parent.getQPath(), item, columnClass, parent.getACL());
}
}
return null;
}
finally
{
try
{
if (item != null)
{
item.close();
}
}
catch (SQLException e)
{
LOG.error("Can't close the ResultSet: " + e.getMessage());
}
}
}
catch (SQLException e)
{
throw new RepositoryException(e);
}
catch (IOException e)
{
throw new RepositoryException(e);
}
} } | public class class_name {
protected ItemData getItemByName(NodeData parent, String parentId, QPathEntry name, ItemType itemType)
throws RepositoryException, IllegalStateException
{
checkIfOpened();
try
{
ResultSet item = null;
try
{
item = findItemByName(parentId, name.getAsString(), name.getIndex()); // depends on control dependency: [try], data = [none]
while (item.next())
{
int columnClass = item.getInt(COLUMN_CLASS);
if (itemType == ItemType.UNKNOWN || columnClass == itemType.ordinal())
{
return itemData(parent.getQPath(), item, columnClass, parent.getACL()); // depends on control dependency: [if], data = [none]
}
}
return null; // depends on control dependency: [try], data = [none]
}
finally
{
try
{
if (item != null)
{
item.close(); // depends on control dependency: [if], data = [none]
}
}
catch (SQLException e)
{
LOG.error("Can't close the ResultSet: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
}
catch (SQLException e)
{
throw new RepositoryException(e);
}
catch (IOException e)
{
throw new RepositoryException(e);
}
} } |
public class class_name {
public void setAllowedValues(java.util.Collection<String> allowedValues) {
if (allowedValues == null) {
this.allowedValues = null;
return;
}
this.allowedValues = new java.util.ArrayList<String>(allowedValues);
} } | public class class_name {
public void setAllowedValues(java.util.Collection<String> allowedValues) {
if (allowedValues == null) {
this.allowedValues = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.allowedValues = new java.util.ArrayList<String>(allowedValues);
} } |
public class class_name {
public Timer add(long interval, TimerHandler handler, Object... args)
{
if (handler == null) {
return null;
}
return new Timer(timer.add(interval, handler, args));
} } | public class class_name {
public Timer add(long interval, TimerHandler handler, Object... args)
{
if (handler == null) {
return null; // depends on control dependency: [if], data = [none]
}
return new Timer(timer.add(interval, handler, args));
} } |
public class class_name {
public String getOriginalParams() {
if (m_originalParams == null) {
m_originalParams = CmsEncoder.decode(CmsRequestUtil.encodeParams(getJsp().getRequest()));
}
return m_originalParams;
} } | public class class_name {
public String getOriginalParams() {
if (m_originalParams == null) {
m_originalParams = CmsEncoder.decode(CmsRequestUtil.encodeParams(getJsp().getRequest())); // depends on control dependency: [if], data = [none]
}
return m_originalParams;
} } |
public class class_name {
public java.util.List<PolicyAttributeDescription> getPolicyAttributeDescriptions() {
if (policyAttributeDescriptions == null) {
policyAttributeDescriptions = new com.amazonaws.internal.SdkInternalList<PolicyAttributeDescription>();
}
return policyAttributeDescriptions;
} } | public class class_name {
public java.util.List<PolicyAttributeDescription> getPolicyAttributeDescriptions() {
if (policyAttributeDescriptions == null) {
policyAttributeDescriptions = new com.amazonaws.internal.SdkInternalList<PolicyAttributeDescription>(); // depends on control dependency: [if], data = [none]
}
return policyAttributeDescriptions;
} } |
public class class_name {
public void addRecord(Rec record, boolean bMainQuery)
{
if (record == null)
return;
if (this.contains(record))
{ // Don't add this twice.
if (!bMainQuery)
return;
this.removeRecord(record); // Change order
}
if (bMainQuery)
this.insertElementAt(record, 0);
else
this.addElement(record);
} } | public class class_name {
public void addRecord(Rec record, boolean bMainQuery)
{
if (record == null)
return;
if (this.contains(record))
{ // Don't add this twice.
if (!bMainQuery)
return;
this.removeRecord(record); // Change order // depends on control dependency: [if], data = [none]
}
if (bMainQuery)
this.insertElementAt(record, 0);
else
this.addElement(record);
} } |
public class class_name {
public static void dispose() {
if (xml2containerMap != null) {
for (SpringContainer container : xml2containerMap.values()) {
container.dispose();
}
xml2containerMap.clear();
}
} } | public class class_name {
public static void dispose() {
if (xml2containerMap != null) {
for (SpringContainer container : xml2containerMap.values()) {
container.dispose(); // depends on control dependency: [for], data = [container]
}
xml2containerMap.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getCurrentSSpaceFileName() {
// REMINDER: This instruction is expected to be rare, so rather than
// save the name and require a lookup every time the current sspace
// is needed, we use an O(n) call to find the name as necessary
for (Map.Entry<String,SemanticSpace> e : fileNameToSSpace.entrySet()) {
if (e.getValue() == current) {
return e.getKey();
}
}
return null;
} } | public class class_name {
private String getCurrentSSpaceFileName() {
// REMINDER: This instruction is expected to be rare, so rather than
// save the name and require a lookup every time the current sspace
// is needed, we use an O(n) call to find the name as necessary
for (Map.Entry<String,SemanticSpace> e : fileNameToSSpace.entrySet()) {
if (e.getValue() == current) {
return e.getKey(); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers/{triggerId}")
@Description("Returns a trigger by its ID.")
public TriggerDto getTriggerById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId,
@PathParam("triggerId") BigInteger triggerId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
PrincipalUser owner = validateAndGetOwner(req, null);
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
if(!alert.isShared()) {
validateResourceAuthorization(req, alert.getOwner(), owner);
}
for (Trigger trigger : alert.getTriggers()) {
if (trigger.getId().equals(triggerId)) {
return TriggerDto.transformToDto(trigger);
}
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} } | public class class_name {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{alertId}/triggers/{triggerId}")
@Description("Returns a trigger by its ID.")
public TriggerDto getTriggerById(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId,
@PathParam("triggerId") BigInteger triggerId) {
if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (triggerId == null || triggerId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("Trigger Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
PrincipalUser owner = validateAndGetOwner(req, null);
Alert alert = alertService.findAlertByPrimaryKey(alertId);
if (alert != null) {
if(!alert.isShared()) {
validateResourceAuthorization(req, alert.getOwner(), owner); // depends on control dependency: [if], data = [none]
}
for (Trigger trigger : alert.getTriggers()) {
if (trigger.getId().equals(triggerId)) {
return TriggerDto.transformToDto(trigger); // depends on control dependency: [if], data = [none]
}
}
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} } |
public class class_name {
protected void buildConstructorWithFields(ClassVisitor cw,
ClassDefinition classDef,
Collection<FieldDefinition> fieldDefs) {
Type[] params = new Type[fieldDefs.size()];
int index = 0;
for ( FieldDefinition field : fieldDefs ) {
params[index++] = Type.getType( BuildUtils.getTypeDescriptor( field.getTypeName() ) );
}
MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
"<init>",
Type.getMethodDescriptor( Type.VOID_TYPE,
params ),
null,
null );
mv.visitCode();
Label l0 = null;
if ( this.debug ) {
l0 = new Label();
mv.visitLabel( l0 );
}
fieldConstructorStart( mv, classDef, fieldDefs );
mv.visitInsn( Opcodes.RETURN );
Label l1 = null;
if ( this.debug ) {
l1 = new Label();
mv.visitLabel( l1 );
mv.visitLocalVariable( "this",
BuildUtils.getTypeDescriptor( classDef.getClassName() ),
null,
l0,
l1,
0 );
for ( FieldDefinition field : classDef.getFieldsDefinitions() ) {
Label l11 = new Label();
mv.visitLabel( l11 );
mv.visitLocalVariable( field.getName(),
BuildUtils.getTypeDescriptor( field.getTypeName() ),
null,
l0,
l1,
0 );
}
}
mv.visitMaxs( 0,
0 );
mv.visitEnd();
} } | public class class_name {
protected void buildConstructorWithFields(ClassVisitor cw,
ClassDefinition classDef,
Collection<FieldDefinition> fieldDefs) {
Type[] params = new Type[fieldDefs.size()];
int index = 0;
for ( FieldDefinition field : fieldDefs ) {
params[index++] = Type.getType( BuildUtils.getTypeDescriptor( field.getTypeName() ) ); // depends on control dependency: [for], data = [field]
}
MethodVisitor mv = cw.visitMethod( Opcodes.ACC_PUBLIC,
"<init>",
Type.getMethodDescriptor( Type.VOID_TYPE,
params ),
null,
null );
mv.visitCode();
Label l0 = null;
if ( this.debug ) {
l0 = new Label(); // depends on control dependency: [if], data = [none]
mv.visitLabel( l0 ); // depends on control dependency: [if], data = [none]
}
fieldConstructorStart( mv, classDef, fieldDefs );
mv.visitInsn( Opcodes.RETURN );
Label l1 = null;
if ( this.debug ) {
l1 = new Label(); // depends on control dependency: [if], data = [none]
mv.visitLabel( l1 ); // depends on control dependency: [if], data = [none]
mv.visitLocalVariable( "this",
BuildUtils.getTypeDescriptor( classDef.getClassName() ),
null,
l0,
l1,
0 ); // depends on control dependency: [if], data = [none]
for ( FieldDefinition field : classDef.getFieldsDefinitions() ) {
Label l11 = new Label();
mv.visitLabel( l11 ); // depends on control dependency: [for], data = [none]
mv.visitLocalVariable( field.getName(),
BuildUtils.getTypeDescriptor( field.getTypeName() ),
null,
l0,
l1,
0 ); // depends on control dependency: [for], data = [none]
}
}
mv.visitMaxs( 0,
0 );
mv.visitEnd();
} } |
public class class_name {
public void setWidth(String width) {
try {
m_width = Integer.parseInt(width);
} catch (NumberFormatException e) {
m_width = -1;
}
} } | public class class_name {
public void setWidth(String width) {
try {
m_width = Integer.parseInt(width); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
m_width = -1;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void process(Writer writer)
{
try
{
template.process(data, writer);
}
catch (IOException e)
{
throw new RuntimeException("Error writing template to writer", e);
}
catch (TemplateException e)
{
throw new RuntimeException(e.getMessage(), e);
}
} } | public class class_name {
@Override
public void process(Writer writer)
{
try
{
template.process(data, writer); // depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
throw new RuntimeException("Error writing template to writer", e);
} // depends on control dependency: [catch], data = [none]
catch (TemplateException e)
{
throw new RuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private CoreContainer createCoreContainer() {
CoreContainer container = null;
try {
// get the core container
// still no core container: create it
container = CoreContainer.createAndLoad(
Paths.get(m_solrConfig.getHome()),
m_solrConfig.getSolrFile().toPath());
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_CORE_CONTAINER_CREATED_2,
m_solrConfig.getHome(),
m_solrConfig.getSolrFile().getName()));
}
} catch (Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_SOLR_CORE_CONTAINER_NOT_CREATED_1,
m_solrConfig.getSolrFile().getAbsolutePath()),
e);
}
return container;
} } | public class class_name {
private CoreContainer createCoreContainer() {
CoreContainer container = null;
try {
// get the core container
// still no core container: create it
container = CoreContainer.createAndLoad(
Paths.get(m_solrConfig.getHome()),
m_solrConfig.getSolrFile().toPath()); // depends on control dependency: [try], data = [none]
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_SOLR_CORE_CONTAINER_CREATED_2,
m_solrConfig.getHome(),
m_solrConfig.getSolrFile().getName())); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_SOLR_CORE_CONTAINER_NOT_CREATED_1,
m_solrConfig.getSolrFile().getAbsolutePath()),
e);
} // depends on control dependency: [catch], data = [none]
return container;
} } |
public class class_name {
private int quantifiersMemoryInfo(Node node) {
int info = 0;
switch(node.getType()) {
case NodeType.LIST:
case NodeType.ALT:
ListNode can = (ListNode)node;
do {
int v = quantifiersMemoryInfo(can.value);
if (v > info) info = v;
} while ((can = can.tail) != null);
break;
case NodeType.CALL:
if (Config.USE_SUBEXP_CALL) {
CallNode cn = (CallNode)node;
if (cn.isRecursion()) {
return TargetInfo.IS_EMPTY_REC; /* tiny version */
} else {
info = quantifiersMemoryInfo(cn.target);
}
} // USE_SUBEXP_CALL
break;
case NodeType.QTFR:
QuantifierNode qn = (QuantifierNode)node;
if (qn.upper != 0) {
info = quantifiersMemoryInfo(qn.target);
}
break;
case NodeType.ENCLOSE:
EncloseNode en = (EncloseNode)node;
switch (en.type) {
case EncloseType.MEMORY:
return TargetInfo.IS_EMPTY_MEM;
case EncloseType.OPTION:
case EncloseNode.STOP_BACKTRACK:
case EncloseNode.CONDITION:
case EncloseNode.ABSENT:
info = quantifiersMemoryInfo(en.target);
break;
default:
break;
} // inner switch
break;
case NodeType.BREF:
case NodeType.STR:
case NodeType.CTYPE:
case NodeType.CCLASS:
case NodeType.CANY:
case NodeType.ANCHOR:
default:
break;
} // switch
return info;
} } | public class class_name {
private int quantifiersMemoryInfo(Node node) {
int info = 0;
switch(node.getType()) {
case NodeType.LIST:
case NodeType.ALT:
ListNode can = (ListNode)node;
do {
int v = quantifiersMemoryInfo(can.value);
if (v > info) info = v;
} while ((can = can.tail) != null);
break;
case NodeType.CALL:
if (Config.USE_SUBEXP_CALL) {
CallNode cn = (CallNode)node;
if (cn.isRecursion()) {
return TargetInfo.IS_EMPTY_REC; /* tiny version */ // depends on control dependency: [if], data = [none]
} else {
info = quantifiersMemoryInfo(cn.target); // depends on control dependency: [if], data = [none]
}
} // USE_SUBEXP_CALL
break;
case NodeType.QTFR:
QuantifierNode qn = (QuantifierNode)node;
if (qn.upper != 0) {
info = quantifiersMemoryInfo(qn.target); // depends on control dependency: [if], data = [none]
}
break;
case NodeType.ENCLOSE:
EncloseNode en = (EncloseNode)node;
switch (en.type) {
case EncloseType.MEMORY:
return TargetInfo.IS_EMPTY_MEM;
case EncloseType.OPTION:
case EncloseNode.STOP_BACKTRACK:
case EncloseNode.CONDITION:
case EncloseNode.ABSENT:
info = quantifiersMemoryInfo(en.target);
break;
default:
break;
} // inner switch
break;
case NodeType.BREF:
case NodeType.STR:
case NodeType.CTYPE:
case NodeType.CCLASS:
case NodeType.CANY:
case NodeType.ANCHOR:
default:
break;
} // switch
return info;
} } |
public class class_name {
public Datatype.Builder setRebuildableType(Optional<? extends TypeClass> rebuildableType) {
if (rebuildableType.isPresent()) {
return setRebuildableType(rebuildableType.get());
} else {
return clearRebuildableType();
}
} } | public class class_name {
public Datatype.Builder setRebuildableType(Optional<? extends TypeClass> rebuildableType) {
if (rebuildableType.isPresent()) {
return setRebuildableType(rebuildableType.get()); // depends on control dependency: [if], data = [none]
} else {
return clearRebuildableType(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean isSlopDead(Cluster cluster, Set<String> storeNames, Slop slop) {
// destination node , no longer exists
if(!cluster.getNodeIds().contains(slop.getNodeId())) {
return true;
}
// destination store, no longer exists
if(!storeNames.contains(slop.getStoreName())) {
return true;
}
// else. slop is alive
return false;
} } | public class class_name {
protected boolean isSlopDead(Cluster cluster, Set<String> storeNames, Slop slop) {
// destination node , no longer exists
if(!cluster.getNodeIds().contains(slop.getNodeId())) {
return true; // depends on control dependency: [if], data = [none]
}
// destination store, no longer exists
if(!storeNames.contains(slop.getStoreName())) {
return true; // depends on control dependency: [if], data = [none]
}
// else. slop is alive
return false;
} } |
public class class_name {
public void EBEsAssignAxialForces(int hi){
AxialForcei_ = new double[numberOfElements_];
AxialForcej_ = new double[numberOfElements_];
for(int el=0;el<numberOfElements_;el++){
AxialForcei_[el] = Efforti_[aX_][el][hi];
AxialForcej_[el] = Effortj_[aX_][el][hi];
}
} } | public class class_name {
public void EBEsAssignAxialForces(int hi){
AxialForcei_ = new double[numberOfElements_];
AxialForcej_ = new double[numberOfElements_];
for(int el=0;el<numberOfElements_;el++){
AxialForcei_[el] = Efforti_[aX_][el][hi]; // depends on control dependency: [for], data = [el]
AxialForcej_[el] = Effortj_[aX_][el][hi]; // depends on control dependency: [for], data = [el]
}
} } |
public class class_name {
public Object getBean(String name) {
Bean bean = beans.get(name);
if (null == bean) {
return null;
}
return bean.object;
} } | public class class_name {
public Object getBean(String name) {
Bean bean = beans.get(name);
if (null == bean) {
return null; // depends on control dependency: [if], data = [none]
}
return bean.object;
} } |
public class class_name {
public final double toDoubleSafe(String toParseParam) {
if (toParseParam == null || toParseParam.trim().isEmpty()) {
return 0D;
}
try {
return Double.parseDouble(toParseParam);
} catch (NumberFormatException e) {
return 0D;
}
} } | public class class_name {
public final double toDoubleSafe(String toParseParam) {
if (toParseParam == null || toParseParam.trim().isEmpty()) {
return 0D; // depends on control dependency: [if], data = [none]
}
try {
return Double.parseDouble(toParseParam); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
return 0D;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void submit(CmsUser user, CmsObject cms, Runnable afterWrite, boolean force) {
try {
if (isValid() | force) {
if (force) {
removeValidators();
}
m_binder.commit();
PropertyUtilsBean propUtils = new PropertyUtilsBean();
for (CmsAccountInfo info : OpenCms.getWorkplaceManager().getAccountInfos()) {
boolean editable = (m_editLevel == EditLevel.all)
|| ((m_editLevel == EditLevel.configured) && info.isEditable());
if (editable) {
if (info.isAdditionalInfo()) {
user.setAdditionalInfo(info.getAddInfoKey(), m_infos.getItemProperty(info).getValue());
} else {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(
(String)m_infos.getItemProperty(info).getValue())) {
propUtils.setProperty(
user,
info.getField().name(),
m_infos.getItemProperty(info).getValue());
}
}
}
}
cms.writeUser(user);
afterWrite.run();
}
} catch (CmsException | CommitException | IllegalAccessException | InvocationTargetException
| NoSuchMethodException e) {
LOG.error("Unable to commit changes to user..", e);
}
} } | public class class_name {
public void submit(CmsUser user, CmsObject cms, Runnable afterWrite, boolean force) {
try {
if (isValid() | force) {
if (force) {
removeValidators(); // depends on control dependency: [if], data = [none]
}
m_binder.commit(); // depends on control dependency: [if], data = [none]
PropertyUtilsBean propUtils = new PropertyUtilsBean();
for (CmsAccountInfo info : OpenCms.getWorkplaceManager().getAccountInfos()) {
boolean editable = (m_editLevel == EditLevel.all)
|| ((m_editLevel == EditLevel.configured) && info.isEditable());
if (editable) {
if (info.isAdditionalInfo()) {
user.setAdditionalInfo(info.getAddInfoKey(), m_infos.getItemProperty(info).getValue()); // depends on control dependency: [if], data = [none]
} else {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(
(String)m_infos.getItemProperty(info).getValue())) {
propUtils.setProperty(
user,
info.getField().name(),
m_infos.getItemProperty(info).getValue()); // depends on control dependency: [if], data = [none]
}
}
}
}
cms.writeUser(user); // depends on control dependency: [if], data = [none]
afterWrite.run(); // depends on control dependency: [if], data = [none]
}
} catch (CmsException | CommitException | IllegalAccessException | InvocationTargetException
| NoSuchMethodException e) {
LOG.error("Unable to commit changes to user..", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
boolean hasValidTimes() {
if ((getEnd() > 0L) && (getEnd() < System.currentTimeMillis())) {
return false;
}
return ((getEnd() == 0) | (getStart() == 0)) || (getEnd() >= getStart());
} } | public class class_name {
boolean hasValidTimes() {
if ((getEnd() > 0L) && (getEnd() < System.currentTimeMillis())) {
return false; // depends on control dependency: [if], data = [none]
}
return ((getEnd() == 0) | (getStart() == 0)) || (getEnd() >= getStart());
} } |
public class class_name {
private void generateCallToClassHandler(MutableClass mutableClass, MethodNode originalMethod,
String originalMethodName, RobolectricGeneratorAdapter generator) {
decorator.decorateMethodPreClassHandler(mutableClass, originalMethod, originalMethodName, generator);
int planLocalVar = generator.newLocal(PLAN_TYPE);
int exceptionLocalVar = generator.newLocal(THROWABLE_TYPE);
Label directCall = new Label();
Label doReturn = new Label();
// prepare for call to classHandler.methodInvoked(String signature, boolean isStatic)
generator.push(mutableClass.classType.getInternalName() + "/" + originalMethodName + originalMethod.desc);
generator.push(generator.isStatic());
generator.push(mutableClass.classType); // my class
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, METHOD_INVOKED_METHOD);
generator.storeLocal(planLocalVar);
generator.loadLocal(planLocalVar); // plan
generator.ifNull(directCall);
// prepare for call to plan.run(Object instance, Object[] params)
TryCatch tryCatchForHandler = generator.tryStart(THROWABLE_TYPE);
generator.loadLocal(planLocalVar); // plan
generator.loadThisOrNull(); // instance
generator.loadArgArray(); // params
generator.invokeInterface(PLAN_TYPE, PLAN_RUN_METHOD);
Type returnType = generator.getReturnType();
int sort = returnType.getSort();
switch (sort) {
case VOID:
generator.pop();
break;
case OBJECT:
/* falls through */
case ARRAY:
generator.checkCast(returnType);
break;
default:
int unboxLocalVar = generator.newLocal(OBJECT_TYPE);
generator.storeLocal(unboxLocalVar);
generator.loadLocal(unboxLocalVar);
Label notNull = generator.newLabel();
Label afterward = generator.newLabel();
generator.ifNonNull(notNull);
generator.pushDefaultReturnValueToStack(returnType); // return zero, false, whatever
generator.goTo(afterward);
generator.mark(notNull);
generator.loadLocal(unboxLocalVar);
generator.unbox(returnType);
generator.mark(afterward);
break;
}
tryCatchForHandler.end();
generator.goTo(doReturn);
// catch(Throwable)
tryCatchForHandler.handler();
generator.storeLocal(exceptionLocalVar);
generator.loadLocal(exceptionLocalVar);
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD);
generator.throwException();
if (!originalMethod.name.equals("<init>")) {
generator.mark(directCall);
TryCatch tryCatchForDirect = generator.tryStart(THROWABLE_TYPE);
generator.invokeMethod(mutableClass.classType.getInternalName(), originalMethod.name, originalMethod.desc);
tryCatchForDirect.end();
generator.returnValue();
// catch(Throwable)
tryCatchForDirect.handler();
generator.storeLocal(exceptionLocalVar);
generator.loadLocal(exceptionLocalVar);
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD);
generator.throwException();
}
generator.mark(doReturn);
generator.returnValue();
} } | public class class_name {
private void generateCallToClassHandler(MutableClass mutableClass, MethodNode originalMethod,
String originalMethodName, RobolectricGeneratorAdapter generator) {
decorator.decorateMethodPreClassHandler(mutableClass, originalMethod, originalMethodName, generator);
int planLocalVar = generator.newLocal(PLAN_TYPE);
int exceptionLocalVar = generator.newLocal(THROWABLE_TYPE);
Label directCall = new Label();
Label doReturn = new Label();
// prepare for call to classHandler.methodInvoked(String signature, boolean isStatic)
generator.push(mutableClass.classType.getInternalName() + "/" + originalMethodName + originalMethod.desc);
generator.push(generator.isStatic());
generator.push(mutableClass.classType); // my class
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, METHOD_INVOKED_METHOD);
generator.storeLocal(planLocalVar);
generator.loadLocal(planLocalVar); // plan
generator.ifNull(directCall);
// prepare for call to plan.run(Object instance, Object[] params)
TryCatch tryCatchForHandler = generator.tryStart(THROWABLE_TYPE);
generator.loadLocal(planLocalVar); // plan
generator.loadThisOrNull(); // instance
generator.loadArgArray(); // params
generator.invokeInterface(PLAN_TYPE, PLAN_RUN_METHOD);
Type returnType = generator.getReturnType();
int sort = returnType.getSort();
switch (sort) {
case VOID:
generator.pop();
break;
case OBJECT:
/* falls through */
case ARRAY:
generator.checkCast(returnType);
break;
default:
int unboxLocalVar = generator.newLocal(OBJECT_TYPE);
generator.storeLocal(unboxLocalVar);
generator.loadLocal(unboxLocalVar);
Label notNull = generator.newLabel();
Label afterward = generator.newLabel();
generator.ifNonNull(notNull);
generator.pushDefaultReturnValueToStack(returnType); // return zero, false, whatever
generator.goTo(afterward);
generator.mark(notNull);
generator.loadLocal(unboxLocalVar);
generator.unbox(returnType);
generator.mark(afterward);
break;
}
tryCatchForHandler.end();
generator.goTo(doReturn);
// catch(Throwable)
tryCatchForHandler.handler();
generator.storeLocal(exceptionLocalVar);
generator.loadLocal(exceptionLocalVar);
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD);
generator.throwException();
if (!originalMethod.name.equals("<init>")) {
generator.mark(directCall); // depends on control dependency: [if], data = [none]
TryCatch tryCatchForDirect = generator.tryStart(THROWABLE_TYPE);
generator.invokeMethod(mutableClass.classType.getInternalName(), originalMethod.name, originalMethod.desc); // depends on control dependency: [if], data = [none]
tryCatchForDirect.end(); // depends on control dependency: [if], data = [none]
generator.returnValue(); // depends on control dependency: [if], data = [none]
// catch(Throwable)
tryCatchForDirect.handler(); // depends on control dependency: [if], data = [none]
generator.storeLocal(exceptionLocalVar); // depends on control dependency: [if], data = [none]
generator.loadLocal(exceptionLocalVar); // depends on control dependency: [if], data = [none]
generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD); // depends on control dependency: [if], data = [none]
generator.throwException(); // depends on control dependency: [if], data = [none]
}
generator.mark(doReturn);
generator.returnValue();
} } |
public class class_name {
@SafeVarargs
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
if (null == ts) {
return isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
}
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
HashSet<T> set = isSorted ? new LinkedHashSet<T>(initialCapacity) : new HashSet<T>(initialCapacity);
for (T t : ts) {
set.add(t);
}
return set;
} } | public class class_name {
@SafeVarargs
public static <T> HashSet<T> newHashSet(boolean isSorted, T... ts) {
if (null == ts) {
return isSorted ? new LinkedHashSet<T>() : new HashSet<T>();
// depends on control dependency: [if], data = [none]
}
int initialCapacity = Math.max((int) (ts.length / .75f) + 1, 16);
HashSet<T> set = isSorted ? new LinkedHashSet<T>(initialCapacity) : new HashSet<T>(initialCapacity);
for (T t : ts) {
set.add(t);
// depends on control dependency: [for], data = [t]
}
return set;
} } |
public class class_name {
protected void checkFormPropertyConflictingWithRegisteredData(ActionRuntime runtime, WebContext context, String propertyName) {
if (context.getVariableNames().contains(propertyName)) {
throwThymeleafFormPropertyConflictingWithRegisteredDataException(runtime, context, propertyName);
}
} } | public class class_name {
protected void checkFormPropertyConflictingWithRegisteredData(ActionRuntime runtime, WebContext context, String propertyName) {
if (context.getVariableNames().contains(propertyName)) {
throwThymeleafFormPropertyConflictingWithRegisteredDataException(runtime, context, propertyName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void decodeUISelectOne(FacesContext facesContext, UIComponent component)
{
if (!(component instanceof EditableValueHolder))
{
throw new IllegalArgumentException("Component "
+ component.getClientId(facesContext)
+ " is not an EditableValueHolder");
}
if (isDisabledOrReadOnly(component))
{
return;
}
Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(facesContext);
if (paramMap.containsKey(clientId))
{
//request parameter found, set submitted value
((EditableValueHolder) component).setSubmittedValue(paramMap.get(clientId));
}
else
{
//see reason for this action at decodeUISelectMany
((EditableValueHolder) component).setSubmittedValue(STR_EMPTY);
}
} } | public class class_name {
public static void decodeUISelectOne(FacesContext facesContext, UIComponent component)
{
if (!(component instanceof EditableValueHolder))
{
throw new IllegalArgumentException("Component "
+ component.getClientId(facesContext)
+ " is not an EditableValueHolder");
}
if (isDisabledOrReadOnly(component))
{
return; // depends on control dependency: [if], data = [none]
}
Map paramMap = facesContext.getExternalContext().getRequestParameterMap();
String clientId = component.getClientId(facesContext);
if (paramMap.containsKey(clientId))
{
//request parameter found, set submitted value
((EditableValueHolder) component).setSubmittedValue(paramMap.get(clientId)); // depends on control dependency: [if], data = [none]
}
else
{
//see reason for this action at decodeUISelectMany
((EditableValueHolder) component).setSubmittedValue(STR_EMPTY); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected Cassandra.Client getConnection(Object connection)
{
if (connection != null)
{
return ((IPooledConnection) connection).getAPI();
}
throw new KunderaException("Invalid configuration!, no available pooled connection found for:"
+ this.getClass().getSimpleName());
} } | public class class_name {
protected Cassandra.Client getConnection(Object connection)
{
if (connection != null)
{
return ((IPooledConnection) connection).getAPI(); // depends on control dependency: [if], data = [none]
}
throw new KunderaException("Invalid configuration!, no available pooled connection found for:"
+ this.getClass().getSimpleName());
} } |
public class class_name {
private void updateFirstKey(PageModificationContext context) {
BTreePage page = context.getPageWrapper().getPage();
assert page.getConfig().isIndexPage() : "expected index page";
if (page.getCount() > 0) {
page.setFirstKey(generateMinKey());
}
} } | public class class_name {
private void updateFirstKey(PageModificationContext context) {
BTreePage page = context.getPageWrapper().getPage();
assert page.getConfig().isIndexPage() : "expected index page";
if (page.getCount() > 0) {
page.setFirstKey(generateMinKey()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void pushRight( int row ) {
if( isOffZero(row))
return;
// B = createB();
// B.print();
rotatorPushRight(row);
int end = N-2-row;
for( int i = 0; i < end && bulge != 0; i++ ) {
rotatorPushRight2(row,i+2);
}
// }
} } | public class class_name {
private void pushRight( int row ) {
if( isOffZero(row))
return;
// B = createB();
// B.print();
rotatorPushRight(row);
int end = N-2-row;
for( int i = 0; i < end && bulge != 0; i++ ) {
rotatorPushRight2(row,i+2); // depends on control dependency: [for], data = [i]
}
// }
} } |
public class class_name {
public void insert_us(final int[] argIn) {
attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
final short[] values = new short[argIn.length];
for (int i = 0; i < argIn.length; i++) {
values[i] = (short) (argIn[i] & 0xFFFF);
}
attributeValue_5.w_dim.dim_x = argIn.length;
attributeValue_5.w_dim.dim_y = 0;
if (use_union) {
attributeValue_5.value.ushort_att_value(values);
} else {
deviceAttribute_3.insert_us(argIn);
}
} } | public class class_name {
public void insert_us(final int[] argIn) {
attributeValue_5.data_format = AttrDataFormat.FMT_UNKNOWN;
final short[] values = new short[argIn.length];
for (int i = 0; i < argIn.length; i++) {
values[i] = (short) (argIn[i] & 0xFFFF); // depends on control dependency: [for], data = [i]
}
attributeValue_5.w_dim.dim_x = argIn.length;
attributeValue_5.w_dim.dim_y = 0;
if (use_union) {
attributeValue_5.value.ushort_att_value(values); // depends on control dependency: [if], data = [none]
} else {
deviceAttribute_3.insert_us(argIn); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvRqst.getScopes()))
{
tcpSrvRply.perform(socket, srvRqst, SLPError.SCOPE_NOT_SUPPORTED);
return;
}
ServiceType serviceType = srvRqst.getServiceType();
List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter());
tcpSrvRply.perform(socket, srvRqst, matchingServices);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType);
} } | public class class_name {
protected void handleTCPSrvRqst(SrvRqst srvRqst, Socket socket)
{
// Match scopes, RFC 2608, 11.1
if (!scopes.weakMatch(srvRqst.getScopes()))
{
tcpSrvRply.perform(socket, srvRqst, SLPError.SCOPE_NOT_SUPPORTED); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
ServiceType serviceType = srvRqst.getServiceType();
List<ServiceInfo> matchingServices = matchServices(serviceType, srvRqst.getLanguage(), srvRqst.getScopes(), srvRqst.getFilter());
tcpSrvRply.perform(socket, srvRqst, matchingServices);
if (logger.isLoggable(Level.FINE))
logger.fine("DirectoryAgent " + this + " returning " + matchingServices.size() + " services of type " + serviceType);
} } |
public class class_name {
private static MethodHandle findMethod(Class<?> clazz, String methodName, boolean staticMethod,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
MethodHandle methodHandle = null;
try {
Method method = clazz.getMethod(methodName, expectedParameterTypes);
int modifiers = method.getModifiers();
Class<?> returnType = method.getReturnType();
if (Modifier.isStatic(modifiers) != staticMethod) {
throw new NoSuchMethodException();
}
if (expectedReturnType != null && !expectedReturnType.isAssignableFrom(returnType)) {
throw new NoSuchMethodException();
}
methodHandle = MethodHandles.publicLookup().unreflect(method);
} catch (NoSuchMethodException | SecurityException | IllegalAccessException e) {
// Method not found
}
return methodHandle;
} } | public class class_name {
private static MethodHandle findMethod(Class<?> clazz, String methodName, boolean staticMethod,
Class<?> expectedReturnType, Class<?>... expectedParameterTypes) {
MethodHandle methodHandle = null;
try {
Method method = clazz.getMethod(methodName, expectedParameterTypes);
int modifiers = method.getModifiers();
Class<?> returnType = method.getReturnType();
if (Modifier.isStatic(modifiers) != staticMethod) {
throw new NoSuchMethodException();
}
if (expectedReturnType != null && !expectedReturnType.isAssignableFrom(returnType)) {
throw new NoSuchMethodException();
}
methodHandle = MethodHandles.publicLookup().unreflect(method); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException | SecurityException | IllegalAccessException e) {
// Method not found
} // depends on control dependency: [catch], data = [none]
return methodHandle;
} } |
public class class_name {
public Object getValue(float fraction) {
// Special-case optimization for the common case of only two keyframes
if (mNumKeyframes == 2) {
if (mInterpolator != null) {
fraction = mInterpolator.getInterpolation(fraction);
}
return mEvaluator.evaluate(fraction, mFirstKeyframe.getValue(),
mLastKeyframe.getValue());
}
if (fraction <= 0f) {
final Keyframe nextKeyframe = mKeyframes.get(1);
final /*Time*/Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = mFirstKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(),
nextKeyframe.getValue());
} else if (fraction >= 1f) {
final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2);
final /*Time*/Interpolator interpolator = mLastKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(mLastKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
mLastKeyframe.getValue());
}
Keyframe prevKeyframe = mFirstKeyframe;
for (int i = 1; i < mNumKeyframes; ++i) {
Keyframe nextKeyframe = mKeyframes.get(i);
if (fraction < nextKeyframe.getFraction()) {
final /*Time*/Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction);
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
nextKeyframe.getValue());
}
prevKeyframe = nextKeyframe;
}
// shouldn't reach here
return mLastKeyframe.getValue();
} } | public class class_name {
public Object getValue(float fraction) {
// Special-case optimization for the common case of only two keyframes
if (mNumKeyframes == 2) {
if (mInterpolator != null) {
fraction = mInterpolator.getInterpolation(fraction); // depends on control dependency: [if], data = [none]
}
return mEvaluator.evaluate(fraction, mFirstKeyframe.getValue(),
mLastKeyframe.getValue()); // depends on control dependency: [if], data = [none]
}
if (fraction <= 0f) {
final Keyframe nextKeyframe = mKeyframes.get(1);
final /*Time*/Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction); // depends on control dependency: [if], data = [none]
}
final float prevFraction = mFirstKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, mFirstKeyframe.getValue(),
nextKeyframe.getValue()); // depends on control dependency: [if], data = [none]
} else if (fraction >= 1f) {
final Keyframe prevKeyframe = mKeyframes.get(mNumKeyframes - 2);
final /*Time*/Interpolator interpolator = mLastKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction); // depends on control dependency: [if], data = [none]
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(mLastKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
mLastKeyframe.getValue()); // depends on control dependency: [if], data = [none]
}
Keyframe prevKeyframe = mFirstKeyframe;
for (int i = 1; i < mNumKeyframes; ++i) {
Keyframe nextKeyframe = mKeyframes.get(i);
if (fraction < nextKeyframe.getFraction()) {
final /*Time*/Interpolator interpolator = nextKeyframe.getInterpolator();
if (interpolator != null) {
fraction = interpolator.getInterpolation(fraction); // depends on control dependency: [if], data = [none]
}
final float prevFraction = prevKeyframe.getFraction();
float intervalFraction = (fraction - prevFraction) /
(nextKeyframe.getFraction() - prevFraction);
return mEvaluator.evaluate(intervalFraction, prevKeyframe.getValue(),
nextKeyframe.getValue()); // depends on control dependency: [if], data = [none]
}
prevKeyframe = nextKeyframe; // depends on control dependency: [for], data = [none]
}
// shouldn't reach here
return mLastKeyframe.getValue();
} } |
public class class_name {
public boolean hasOverride(String operation) {
boolean result = false;
if (this.overrideOnce.containsKey(operation) == true || this.override.containsKey(operation) == true) {
result = true;
}
return result;
} } | public class class_name {
public boolean hasOverride(String operation) {
boolean result = false;
if (this.overrideOnce.containsKey(operation) == true || this.override.containsKey(operation) == true) {
result = true;
// depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static CompletionException combineErrors( Throwable error1, Throwable error2 )
{
if ( error1 != null && error2 != null )
{
Throwable cause1 = completionExceptionCause( error1 );
Throwable cause2 = completionExceptionCause( error2 );
if ( cause1 != cause2 )
{
cause1.addSuppressed( cause2 );
}
return asCompletionException( cause1 );
}
else if ( error1 != null )
{
return asCompletionException( error1 );
}
else if ( error2 != null )
{
return asCompletionException( error2 );
}
else
{
return null;
}
} } | public class class_name {
public static CompletionException combineErrors( Throwable error1, Throwable error2 )
{
if ( error1 != null && error2 != null )
{
Throwable cause1 = completionExceptionCause( error1 );
Throwable cause2 = completionExceptionCause( error2 );
if ( cause1 != cause2 )
{
cause1.addSuppressed( cause2 ); // depends on control dependency: [if], data = [cause2 )]
}
return asCompletionException( cause1 ); // depends on control dependency: [if], data = [none]
}
else if ( error1 != null )
{
return asCompletionException( error1 ); // depends on control dependency: [if], data = [( error1]
}
else if ( error2 != null )
{
return asCompletionException( error2 ); // depends on control dependency: [if], data = [( error2]
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void profile(String profileApp, String code, String message) {
if (openTrace) {
try {
tracer.profile(profileApp, code, message);
} catch (Exception e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(e.getMessage(), e);
}
}
}
} } | public class class_name {
public static void profile(String profileApp, String code, String message) {
if (openTrace) {
try {
tracer.profile(profileApp, code, message); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (LOGGER.isWarnEnabled()) {
LOGGER.warn(e.getMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static EvaluationResult evaluation(String resultText, String standardText, String perfectResult, String wrongResult) {
long start = System.currentTimeMillis();
int perfectLineCount=0;
int wrongLineCount=0;
int perfectCharCount=0;
int wrongCharCount=0;
try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8"));
BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"));
BufferedWriter perfectResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(perfectResult),"utf-8"));
BufferedWriter wrongResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wrongResult),"utf-8"))){
String result;
while( (result = resultReader.readLine()) != null ){
result = result.trim();
String standard = standardReader.readLine().trim();
if(result.equals("")){
continue;
}
if(result.equals(standard)){
//分词结果和标准一模一样
perfectResultWriter.write(standard+"\n");
perfectLineCount++;
perfectCharCount+=standard.replaceAll("\\s+", "").length();
}else{
//分词结果和标准不一样
wrongResultWriter.write("实际分词结果:"+result+"\n");
wrongResultWriter.write("标准分词结果:"+standard+"\n");
wrongLineCount++;
wrongCharCount+=standard.replaceAll("\\s+", "").length();
}
}
} catch (IOException ex) {
LOGGER.error("分词效果评估失败:", ex);
}
long cost = System.currentTimeMillis() - start;
int totalLineCount = perfectLineCount+wrongLineCount;
int totalCharCount = perfectCharCount+wrongCharCount;
LOGGER.info("评估耗时:"+cost+" 毫秒");
EvaluationResult er = new EvaluationResult();
er.setPerfectCharCount(perfectCharCount);
er.setPerfectLineCount(perfectLineCount);
er.setTotalCharCount(totalCharCount);
er.setTotalLineCount(totalLineCount);
er.setWrongCharCount(wrongCharCount);
er.setWrongLineCount(wrongLineCount);
return er;
} } | public class class_name {
public static EvaluationResult evaluation(String resultText, String standardText, String perfectResult, String wrongResult) {
long start = System.currentTimeMillis();
int perfectLineCount=0;
int wrongLineCount=0;
int perfectCharCount=0;
int wrongCharCount=0;
try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8"));
BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"));
BufferedWriter perfectResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(perfectResult),"utf-8"));
BufferedWriter wrongResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wrongResult),"utf-8"))){
String result;
while( (result = resultReader.readLine()) != null ){
result = result.trim(); // depends on control dependency: [while], data = [none]
String standard = standardReader.readLine().trim();
if(result.equals("")){
continue;
}
if(result.equals(standard)){
//分词结果和标准一模一样
perfectResultWriter.write(standard+"\n"); // depends on control dependency: [if], data = [none]
perfectLineCount++; // depends on control dependency: [if], data = [none]
perfectCharCount+=standard.replaceAll("\\s+", "").length(); // depends on control dependency: [if], data = [none]
}else{
//分词结果和标准不一样
wrongResultWriter.write("实际分词结果:"+result+"\n"); // depends on control dependency: [if], data = [none]
wrongResultWriter.write("标准分词结果:"+standard+"\n"); // depends on control dependency: [if], data = [none]
wrongLineCount++; // depends on control dependency: [if], data = [none]
wrongCharCount+=standard.replaceAll("\\s+", "").length(); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException ex) {
LOGGER.error("分词效果评估失败:", ex);
}
long cost = System.currentTimeMillis() - start;
int totalLineCount = perfectLineCount+wrongLineCount;
int totalCharCount = perfectCharCount+wrongCharCount;
LOGGER.info("评估耗时:"+cost+" 毫秒");
EvaluationResult er = new EvaluationResult();
er.setPerfectCharCount(perfectCharCount);
er.setPerfectLineCount(perfectLineCount);
er.setTotalCharCount(totalCharCount);
er.setTotalLineCount(totalLineCount);
er.setWrongCharCount(wrongCharCount);
er.setWrongLineCount(wrongLineCount);
return er;
} } |
public class class_name {
public synchronized WorkManager createWorkManager(String id, String name)
{
if (id == null || id.trim().equals(""))
throw new IllegalArgumentException("The id of WorkManager is invalid: " + id);
// Check for an active work manager
if (activeWorkmanagers.keySet().contains(id))
{
if (trace)
log.tracef("RefCounting WorkManager: %s", id);
Integer i = refCountWorkmanagers.get(id);
refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1));
WorkManager wm = activeWorkmanagers.get(id);
if (wm instanceof DistributedWorkManager)
{
DistributedWorkManager dwm = (DistributedWorkManager)wm;
if (dwm.getTransport() != null)
dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
}
return wm;
}
try
{
// Create a new instance
WorkManager template = null;
if (name != null)
{
template = workmanagers.get(name);
}
else
{
template = defaultWorkManager;
}
if (template == null)
throw new IllegalArgumentException("The WorkManager wasn't found: " + name);
WorkManager wm = template.clone();
wm.setId(id);
if (wm instanceof DistributedWorkManager)
{
DistributedWorkManager dwm = (DistributedWorkManager)wm;
dwm.initialize();
if (dwm.getTransport() != null)
{
dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
try
{
((DistributedWorkManager) wm).getTransport().startup();
}
catch (Throwable t)
{
throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" +
((DistributedWorkManager) wm).getTransport().getId(), t);
}
}
else
{
throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() +
" doesn't have a transport associated");
}
}
activeWorkmanagers.put(id, wm);
refCountWorkmanagers.put(id, Integer.valueOf(1));
if (trace)
log.tracef("Created WorkManager: %s", wm);
return wm;
}
catch (Throwable t)
{
throw new IllegalStateException("The WorkManager couldn't be created: " + name, t);
}
} } | public class class_name {
public synchronized WorkManager createWorkManager(String id, String name)
{
if (id == null || id.trim().equals(""))
throw new IllegalArgumentException("The id of WorkManager is invalid: " + id);
// Check for an active work manager
if (activeWorkmanagers.keySet().contains(id))
{
if (trace)
log.tracef("RefCounting WorkManager: %s", id);
Integer i = refCountWorkmanagers.get(id);
refCountWorkmanagers.put(id, Integer.valueOf(i.intValue() + 1)); // depends on control dependency: [if], data = [none]
WorkManager wm = activeWorkmanagers.get(id);
if (wm instanceof DistributedWorkManager)
{
DistributedWorkManager dwm = (DistributedWorkManager)wm;
if (dwm.getTransport() != null)
dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId()));
}
return wm; // depends on control dependency: [if], data = [none]
}
try
{
// Create a new instance
WorkManager template = null;
if (name != null)
{
template = workmanagers.get(name); // depends on control dependency: [if], data = [(name]
}
else
{
template = defaultWorkManager; // depends on control dependency: [if], data = [none]
}
if (template == null)
throw new IllegalArgumentException("The WorkManager wasn't found: " + name);
WorkManager wm = template.clone();
wm.setId(id);
if (wm instanceof DistributedWorkManager)
{
DistributedWorkManager dwm = (DistributedWorkManager)wm;
dwm.initialize(); // depends on control dependency: [if], data = [none]
if (dwm.getTransport() != null)
{
dwm.getTransport().register(new Address(wm.getId(), wm.getName(), dwm.getTransport().getId())); // depends on control dependency: [if], data = [none]
try
{
((DistributedWorkManager) wm).getTransport().startup(); // depends on control dependency: [try], data = [none]
}
catch (Throwable t)
{
throw new ApplicationServerInternalException("Unable to start the DWM Transport ID:" +
((DistributedWorkManager) wm).getTransport().getId(), t);
} // depends on control dependency: [catch], data = [none]
}
else
{
throw new ApplicationServerInternalException("DistributedWorkManager " + dwm.getName() +
" doesn't have a transport associated");
}
}
activeWorkmanagers.put(id, wm);
refCountWorkmanagers.put(id, Integer.valueOf(1));
if (trace)
log.tracef("Created WorkManager: %s", wm);
return wm;
}
catch (Throwable t)
{
throw new IllegalStateException("The WorkManager couldn't be created: " + name, t);
}
} } |
public class class_name {
private String createMailToLink(String to, String bcc, String cc,
String subject, String body) {
Validate.notNull(to, "You must define a to-address");
final StringBuilder urlBuilder = new StringBuilder("mailto:");
addEncodedValue(urlBuilder, "to", to);
if (bcc != null || cc != null || subject != null || body != null) {
urlBuilder.append('?');
}
addEncodedValue(urlBuilder, "bcc", bcc);
addEncodedValue(urlBuilder, "cc", cc);
addEncodedValue(urlBuilder, "subject", subject);
if (body != null) {
addEncodedValue(urlBuilder, "body", body.replace("$NL$", "\r\n"));
}
return urlBuilder.toString();
} } | public class class_name {
private String createMailToLink(String to, String bcc, String cc,
String subject, String body) {
Validate.notNull(to, "You must define a to-address");
final StringBuilder urlBuilder = new StringBuilder("mailto:");
addEncodedValue(urlBuilder, "to", to);
if (bcc != null || cc != null || subject != null || body != null) {
urlBuilder.append('?'); // depends on control dependency: [if], data = [none]
}
addEncodedValue(urlBuilder, "bcc", bcc);
addEncodedValue(urlBuilder, "cc", cc);
addEncodedValue(urlBuilder, "subject", subject);
if (body != null) {
addEncodedValue(urlBuilder, "body", body.replace("$NL$", "\r\n")); // depends on control dependency: [if], data = [none]
}
return urlBuilder.toString();
} } |
public class class_name {
public static List<Field> retrievePropertyList(final Class<?> cls) {
final List<Field> propertyList = new ArrayList<>();
for (final Field f : cls.getFields()) {
propertyList.add(f);
}
return propertyList;
} } | public class class_name {
public static List<Field> retrievePropertyList(final Class<?> cls) {
final List<Field> propertyList = new ArrayList<>();
for (final Field f : cls.getFields()) {
propertyList.add(f); // depends on control dependency: [for], data = [f]
}
return propertyList;
} } |
public class class_name {
public static <E> Optional<E> get(final Iterable<E> iterable, final int position) {
checkNotNull(iterable, "Get requires an iterable");
if (position < 0) {
return Optional.empty();
}
int iterablePosition = 0;
for (E anIterable : iterable) {
if (iterablePosition == position) {
return of(anIterable);
}
iterablePosition++;
}
return Optional.empty();
} } | public class class_name {
public static <E> Optional<E> get(final Iterable<E> iterable, final int position) {
checkNotNull(iterable, "Get requires an iterable");
if (position < 0) {
return Optional.empty(); // depends on control dependency: [if], data = [none]
}
int iterablePosition = 0;
for (E anIterable : iterable) {
if (iterablePosition == position) {
return of(anIterable); // depends on control dependency: [if], data = [none]
}
iterablePosition++; // depends on control dependency: [for], data = [none]
}
return Optional.empty();
} } |
public class class_name {
public static String encodePassword(final String password) {
if (password == null) {
return null;
}
return encodePassword(password.toCharArray());
} } | public class class_name {
public static String encodePassword(final String password) {
if (password == null) {
return null; // depends on control dependency: [if], data = [none]
}
return encodePassword(password.toCharArray());
} } |
public class class_name {
public RiakSet getSet(BinaryValue key)
{
if (entries.containsKey(key))
{
for (RiakDatatype dt : entries.get(key))
{
if (dt.isSet())
{
return dt.getAsSet();
}
}
}
return null;
} } | public class class_name {
public RiakSet getSet(BinaryValue key)
{
if (entries.containsKey(key))
{
for (RiakDatatype dt : entries.get(key))
{
if (dt.isSet())
{
return dt.getAsSet(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public static RequestContext handle(final HttpServletRequest request, final HttpServletResponse response) {
try {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sets request context character encoding failed", e);
}
final RequestContext ret = new RequestContext();
ret.setRequest(request);
ret.setResponse(response);
Latkes.REQUEST_CONTEXT.set(ret);
for (final Handler handler : HANDLERS) {
ret.addHandler(handler);
}
ret.handle();
result(ret);
Latkes.REQUEST_CONTEXT.set(null);
return ret;
} } | public class class_name {
public static RequestContext handle(final HttpServletRequest request, final HttpServletResponse response) {
try {
request.setCharacterEncoding("UTF-8"); // depends on control dependency: [try], data = [none]
response.setCharacterEncoding("UTF-8"); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
LOGGER.log(Level.ERROR, "Sets request context character encoding failed", e);
} // depends on control dependency: [catch], data = [none]
final RequestContext ret = new RequestContext();
ret.setRequest(request);
ret.setResponse(response);
Latkes.REQUEST_CONTEXT.set(ret);
for (final Handler handler : HANDLERS) {
ret.addHandler(handler); // depends on control dependency: [for], data = [handler]
}
ret.handle();
result(ret);
Latkes.REQUEST_CONTEXT.set(null);
return ret;
} } |
public class class_name {
public int getMnemonic() {
int mnemonic = KeyEvent.VK_UNDEFINED;
if (!MAC_OS_X) {
int index = getMnemonicIndex();
if ((index >= 0) && ((index + 1) < myAnnotatedString.length())) {
mnemonic = Character.toUpperCase(myAnnotatedString.charAt(index + 1));
}
}
return mnemonic;
} } | public class class_name {
public int getMnemonic() {
int mnemonic = KeyEvent.VK_UNDEFINED;
if (!MAC_OS_X) {
int index = getMnemonicIndex();
if ((index >= 0) && ((index + 1) < myAnnotatedString.length())) {
mnemonic = Character.toUpperCase(myAnnotatedString.charAt(index + 1)); // depends on control dependency: [if], data = [none]
}
}
return mnemonic;
} } |
public class class_name {
public @Nullable Apikey getApikeyOrNull(@Nullable String apikey) {
if (apikey != null) {
try {
return decode(apikey);
} catch (Exception e) { // any exception, also parsing ones
// nothing to do
}
}
return null;
} } | public class class_name {
public @Nullable Apikey getApikeyOrNull(@Nullable String apikey) {
if (apikey != null) {
try {
return decode(apikey); // depends on control dependency: [try], data = [none]
} catch (Exception e) { // any exception, also parsing ones
// nothing to do
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
int guessPayloadLength() {
int length = 0;
// Total guess at average size of stream entry
try {
List<Object> payload = getBodyList();
length = payload.size() * 40;
}
catch (UnsupportedEncodingException e) {
// No FFDC code needed
// hmm... how do we figure out a reasonable length
}
return length;
} } | public class class_name {
int guessPayloadLength() {
int length = 0;
// Total guess at average size of stream entry
try {
List<Object> payload = getBodyList();
length = payload.size() * 40; // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException e) {
// No FFDC code needed
// hmm... how do we figure out a reasonable length
} // depends on control dependency: [catch], data = [none]
return length;
} } |
public class class_name {
private String toPostParameters(String getRequestUri, CmsSearch search) {
StringBuffer result;
String formname = "";
if (!m_formCache.containsKey(getRequestUri)) {
result = new StringBuffer();
int index = getRequestUri.indexOf('?');
String query = "";
String path = "";
if (index > 0) {
query = getRequestUri.substring(index + 1);
path = getRequestUri.substring(0, index);
formname = new StringBuffer("searchform").append(m_formCache.size()).toString();
result.append("\n<form method=\"post\" name=\"").append(formname).append("\" action=\"");
result.append(path).append("\">\n");
// "key=value" pairs as tokens:
StringTokenizer entryTokens = new StringTokenizer(query, "&", false);
while (entryTokens.hasMoreTokens()) {
StringTokenizer keyValueToken = new StringTokenizer(entryTokens.nextToken(), "=", false);
if (keyValueToken.countTokens() != 2) {
continue;
}
// Undo the possible already performed url encoding for the given url
String key = CmsEncoder.decode(keyValueToken.nextToken());
String value = CmsEncoder.decode(keyValueToken.nextToken());
if ("action".equals(key)) {
// cannot use the "search"-action value in combination with CmsWidgetDialog: prepareCommit would be left out!
value = CmsWidgetDialog.DIALOG_SAVE;
}
result.append(" <input type=\"hidden\" name=\"");
result.append(key).append("\" value=\"");
result.append(value).append("\" />\n");
}
// custom search index code for making category widget - compatible
// this is needed for transforming e.g. the CmsSearch-generated
// "&category=a,b,c" to widget fields categories.0..categories.n.
List<String> categories = search.getParameters().getCategories();
Iterator<String> it = categories.iterator();
int count = 0;
while (it.hasNext()) {
result.append(" <input type=\"hidden\" name=\"");
result.append("categories.").append(count).append("\" value=\"");
result.append(it.next()).append("\" />\n");
count++;
}
List<String> roots = search.getParameters().getRoots();
it = roots.iterator();
count = 0;
while (it.hasNext()) {
result.append(" <input type=\"hidden\" name=\"");
result.append("roots.").append(count).append("\" value=\"");
result.append(it.next()).append("\" />\n");
count++;
}
result.append(" <input type=\"hidden\" name=\"");
result.append("fields").append("\" value=\"");
result.append(CmsStringUtil.collectionAsString(search.getParameters().getFields(), ","));
result.append("\" />\n");
result.append(" <input type=\"hidden\" name=\"");
result.append("sortfields.").append(0).append("\" value=\"");
result.append(search.getParameters().getSortName()).append("\" />\n");
result.append("</form>\n");
HTMLForm form = new HTMLForm(formname, result.toString());
m_formCache.put(getRequestUri, form);
return formname;
}
// empty String for no get parameters
return formname;
} else {
HTMLForm form = m_formCache.get(getRequestUri);
return form.m_formName;
}
} } | public class class_name {
private String toPostParameters(String getRequestUri, CmsSearch search) {
StringBuffer result;
String formname = "";
if (!m_formCache.containsKey(getRequestUri)) {
result = new StringBuffer(); // depends on control dependency: [if], data = [none]
int index = getRequestUri.indexOf('?');
String query = "";
String path = "";
if (index > 0) {
query = getRequestUri.substring(index + 1); // depends on control dependency: [if], data = [(index]
path = getRequestUri.substring(0, index); // depends on control dependency: [if], data = [none]
formname = new StringBuffer("searchform").append(m_formCache.size()).toString(); // depends on control dependency: [if], data = [none]
result.append("\n<form method=\"post\" name=\"").append(formname).append("\" action=\""); // depends on control dependency: [if], data = [none]
result.append(path).append("\">\n"); // depends on control dependency: [if], data = [none]
// "key=value" pairs as tokens:
StringTokenizer entryTokens = new StringTokenizer(query, "&", false);
while (entryTokens.hasMoreTokens()) {
StringTokenizer keyValueToken = new StringTokenizer(entryTokens.nextToken(), "=", false);
if (keyValueToken.countTokens() != 2) {
continue;
}
// Undo the possible already performed url encoding for the given url
String key = CmsEncoder.decode(keyValueToken.nextToken());
String value = CmsEncoder.decode(keyValueToken.nextToken());
if ("action".equals(key)) {
// cannot use the "search"-action value in combination with CmsWidgetDialog: prepareCommit would be left out!
value = CmsWidgetDialog.DIALOG_SAVE; // depends on control dependency: [if], data = [none]
}
result.append(" <input type=\"hidden\" name=\""); // depends on control dependency: [while], data = [none]
result.append(key).append("\" value=\""); // depends on control dependency: [while], data = [none]
result.append(value).append("\" />\n"); // depends on control dependency: [while], data = [none]
}
// custom search index code for making category widget - compatible
// this is needed for transforming e.g. the CmsSearch-generated
// "&category=a,b,c" to widget fields categories.0..categories.n.
List<String> categories = search.getParameters().getCategories();
Iterator<String> it = categories.iterator();
int count = 0;
while (it.hasNext()) {
result.append(" <input type=\"hidden\" name=\""); // depends on control dependency: [while], data = [none]
result.append("categories.").append(count).append("\" value=\""); // depends on control dependency: [while], data = [none]
result.append(it.next()).append("\" />\n"); // depends on control dependency: [while], data = [none]
count++; // depends on control dependency: [while], data = [none]
}
List<String> roots = search.getParameters().getRoots();
it = roots.iterator(); // depends on control dependency: [if], data = [none]
count = 0; // depends on control dependency: [if], data = [none]
while (it.hasNext()) {
result.append(" <input type=\"hidden\" name=\""); // depends on control dependency: [while], data = [none]
result.append("roots.").append(count).append("\" value=\""); // depends on control dependency: [while], data = [none]
result.append(it.next()).append("\" />\n"); // depends on control dependency: [while], data = [none]
count++; // depends on control dependency: [while], data = [none]
}
result.append(" <input type=\"hidden\" name=\""); // depends on control dependency: [if], data = [none]
result.append("fields").append("\" value=\""); // depends on control dependency: [if], data = [none]
result.append(CmsStringUtil.collectionAsString(search.getParameters().getFields(), ",")); // depends on control dependency: [if], data = [none]
result.append("\" />\n"); // depends on control dependency: [if], data = [none]
result.append(" <input type=\"hidden\" name=\""); // depends on control dependency: [if], data = [none]
result.append("sortfields.").append(0).append("\" value=\""); // depends on control dependency: [if], data = [0)]
result.append(search.getParameters().getSortName()).append("\" />\n"); // depends on control dependency: [if], data = [none]
result.append("</form>\n"); // depends on control dependency: [if], data = [none]
HTMLForm form = new HTMLForm(formname, result.toString());
m_formCache.put(getRequestUri, form); // depends on control dependency: [if], data = [none]
return formname; // depends on control dependency: [if], data = [none]
}
// empty String for no get parameters
return formname; // depends on control dependency: [if], data = [none]
} else {
HTMLForm form = m_formCache.get(getRequestUri);
return form.m_formName; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void insertEJBRefInEJBJar(Element ejb, EJBInfo ei, String ejbLinkValue, Document ejbDoc) {
List ejbRefArray = DomUtils.getChildElementsByName(ejb, "ejb-ref");
String insertedEjbRefName = ei.getRefName();
Node nextSibling = null;
for (int j = ejbRefArray.size() - 1; j >= 0; j--) {
Element ejbRef = (Element) ejbRefArray.get(j);
String ejbRefName = DomUtils.getChildElementText(ejbRef, "ejb-ref-name");
if (insertedEjbRefName.equals(ejbRefName)) {
nextSibling = ejbRef.getNextSibling();
ejb.removeChild(ejbRef);
break;
}
}
// insert a new <ejb-ref> entry and fill in the values
Element insertedEjbRef = ejbDoc.createElement("ejb-ref");
if (nextSibling != null) {
ejb.insertBefore(insertedEjbRef, nextSibling);
}
else {
ejb.insertBefore(insertedEjbRef, findEjbRefInsertPoint(ejb));
}
Element ejbRefName = ejbDoc.createElement("ejb-ref-name");
ejbRefName.setTextContent(insertedEjbRefName);
insertedEjbRef.appendChild(ejbRefName);
Element ejbRefType = ejbDoc.createElement("ejb-ref-type");
ejbRefType.setTextContent(ei.getBeanType());
insertedEjbRef.appendChild(ejbRefType);
Element homeType = ejbDoc.createElement("home");
homeType.setTextContent(ei.getHomeInterface().getName());
insertedEjbRef.appendChild(homeType);
Element remoteType = ejbDoc.createElement("remote");
remoteType.setTextContent(ei.getBeanInterface().getName());
insertedEjbRef.appendChild(remoteType);
Element ejbLink = ejbDoc.createElement("ejb-link");
ejbLink.setTextContent(ejbLinkValue);
insertedEjbRef.appendChild(ejbLink);
} } | public class class_name {
private void insertEJBRefInEJBJar(Element ejb, EJBInfo ei, String ejbLinkValue, Document ejbDoc) {
List ejbRefArray = DomUtils.getChildElementsByName(ejb, "ejb-ref");
String insertedEjbRefName = ei.getRefName();
Node nextSibling = null;
for (int j = ejbRefArray.size() - 1; j >= 0; j--) {
Element ejbRef = (Element) ejbRefArray.get(j);
String ejbRefName = DomUtils.getChildElementText(ejbRef, "ejb-ref-name");
if (insertedEjbRefName.equals(ejbRefName)) {
nextSibling = ejbRef.getNextSibling(); // depends on control dependency: [if], data = [none]
ejb.removeChild(ejbRef); // depends on control dependency: [if], data = [none]
break;
}
}
// insert a new <ejb-ref> entry and fill in the values
Element insertedEjbRef = ejbDoc.createElement("ejb-ref");
if (nextSibling != null) {
ejb.insertBefore(insertedEjbRef, nextSibling); // depends on control dependency: [if], data = [none]
}
else {
ejb.insertBefore(insertedEjbRef, findEjbRefInsertPoint(ejb)); // depends on control dependency: [if], data = [none]
}
Element ejbRefName = ejbDoc.createElement("ejb-ref-name");
ejbRefName.setTextContent(insertedEjbRefName);
insertedEjbRef.appendChild(ejbRefName);
Element ejbRefType = ejbDoc.createElement("ejb-ref-type");
ejbRefType.setTextContent(ei.getBeanType());
insertedEjbRef.appendChild(ejbRefType);
Element homeType = ejbDoc.createElement("home");
homeType.setTextContent(ei.getHomeInterface().getName());
insertedEjbRef.appendChild(homeType);
Element remoteType = ejbDoc.createElement("remote");
remoteType.setTextContent(ei.getBeanInterface().getName());
insertedEjbRef.appendChild(remoteType);
Element ejbLink = ejbDoc.createElement("ejb-link");
ejbLink.setTextContent(ejbLinkValue);
insertedEjbRef.appendChild(ejbLink);
} } |
public class class_name {
@Override
public void sendInternal(NotificationType type, String... messages) throws NotificationException {
if (producer == null) {
createProducer();
}
sendInternalToProducer(producer, type, messages);
} } | public class class_name {
@Override
public void sendInternal(NotificationType type, String... messages) throws NotificationException {
if (producer == null) {
createProducer(); // depends on control dependency: [if], data = [none]
}
sendInternalToProducer(producer, type, messages);
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.