code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@SuppressWarnings("deprecation")
private static void copyCellSetStyle(final Sheet destSheet, final Cell sourceCell, final Cell newCell) {
CellStyle newCellStyle = getCellStyleFromSourceCell(destSheet, sourceCell);
newCell.setCellStyle(newCellStyle);
// If there is a cell hyperlink, copy
if (sourceCell.getHyperlink() != null) {
newCell.setHyperlink(sourceCell.getHyperlink());
}
// Set the cell data type
newCell.setCellType(sourceCell.getCellTypeEnum());
} } | public class class_name {
@SuppressWarnings("deprecation")
private static void copyCellSetStyle(final Sheet destSheet, final Cell sourceCell, final Cell newCell) {
CellStyle newCellStyle = getCellStyleFromSourceCell(destSheet, sourceCell);
newCell.setCellStyle(newCellStyle);
// If there is a cell hyperlink, copy
if (sourceCell.getHyperlink() != null) {
newCell.setHyperlink(sourceCell.getHyperlink());
// depends on control dependency: [if], data = [(sourceCell.getHyperlink()]
}
// Set the cell data type
newCell.setCellType(sourceCell.getCellTypeEnum());
} } |
public class class_name {
public static Field getDeclaredField(Class<?> clz, final String fieldName) {
for (Class<?> s = clz; s != Object.class; s = s.getSuperclass()) {
try {
return s.getDeclaredField(fieldName);
} catch (NoSuchFieldException ignored) {
}
}
return null;
} } | public class class_name {
public static Field getDeclaredField(Class<?> clz, final String fieldName) {
for (Class<?> s = clz; s != Object.class; s = s.getSuperclass()) {
try {
return s.getDeclaredField(fieldName); // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException ignored) {
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public DataPointLongBean addDataPoint(Date timestamp, long value, Map<String, String> tags) {
DataPointLongBean point = new DataPointLongBean(timestamp, value);
for (Entry<String, String> entry : tags.entrySet()) {
point.addTag(entry.getKey(), entry.getValue());
}
dataPoints.add(point);
return point;
} } | public class class_name {
public DataPointLongBean addDataPoint(Date timestamp, long value, Map<String, String> tags) {
DataPointLongBean point = new DataPointLongBean(timestamp, value);
for (Entry<String, String> entry : tags.entrySet()) {
point.addTag(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
dataPoints.add(point);
return point;
} } |
public class class_name {
public static void close (OutputStream out)
{
if (out != null) {
try {
out.close();
} catch (IOException ioe) {
log.warning("Error closing output stream", "stream", out, "cause", ioe);
}
}
} } | public class class_name {
public static void close (OutputStream out)
{
if (out != null) {
try {
out.close(); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
log.warning("Error closing output stream", "stream", out, "cause", ioe);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
String message = null;
try {
stack.precomputation(this);
if ((seen == Const.TABLESWITCH) || (seen == Const.LOOKUPSWITCH)) {
int pc = getPC();
for (int offset : getSwitchOffsets()) {
transitionPoints.set(pc + offset);
}
transitionPoints.set(pc + getDefaultSwitchOffset());
} else if (isBranch(seen) && (getBranchOffset() < 0)) {
// throw out try blocks in loops, this could cause false
// negatives
// with two try/catches in one loop, but more unlikely
Iterator<TryBlock> it = blocks.iterator();
int target = getBranchTarget();
while (it.hasNext()) {
TryBlock block = it.next();
if (block.getStartPC() >= target) {
it.remove();
}
}
}
int pc = getPC();
TryBlock block = findBlockWithStart(pc);
if (block != null) {
inBlocks.add(block);
block.setState(TryBlock.State.IN_TRY);
}
if (inBlocks.isEmpty()) {
return;
}
TryBlock innerBlock = inBlocks.get(inBlocks.size() - 1);
int nextPC = getNextPC();
if (innerBlock.atHandlerPC(nextPC)) {
if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) {
innerBlock.setEndHandlerPC(getBranchTarget());
} else {
inBlocks.remove(innerBlock);
blocks.remove(innerBlock);
}
} else if (innerBlock.atHandlerPC(pc)) {
innerBlock.setState(TryBlock.State.IN_CATCH);
} else if (innerBlock.atEndHandlerPC(pc)) {
inBlocks.remove(inBlocks.size() - 1);
innerBlock.setState(TryBlock.State.AFTER);
}
if (transitionPoints.get(nextPC)) {
if (innerBlock.inCatch() && (innerBlock.getEndHandlerPC() > nextPC)) {
innerBlock.setEndHandlerPC(nextPC);
}
}
if (innerBlock.inCatch()) {
if (((seen >= Const.IFEQ) && ((seen <= Const.RET))) || (seen == Const.GOTO_W) || OpcodeUtils.isReturn(seen)) {
blocks.remove(innerBlock);
inBlocks.remove(inBlocks.size() - 1);
} else if (seen == Const.ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XMethod xm = item.getReturnValueOf();
if (xm != null) {
innerBlock.setThrowSignature(xm.getSignature());
}
innerBlock.setExceptionSignature(item.getSignature());
innerBlock.setMessage((String) item.getUserValue());
} else {
inBlocks.remove(inBlocks.size() - 1);
innerBlock.setState(TryBlock.State.AFTER);
}
} else if ((seen == Const.INVOKESPECIAL) && Values.CONSTRUCTOR.equals(getNameConstantOperand())) {
String cls = getClassConstantOperand();
JavaClass exCls = Repository.lookupClass(cls);
if (exCls.instanceOf(THROWABLE_CLASS)) {
String signature = getSigConstantOperand();
List<String> types = SignatureUtils.getParameterSignatures(signature);
if (!types.isEmpty()) {
if (Values.SIG_JAVA_LANG_STRING.equals(types.get(0)) && (stack.getStackDepth() >= types.size())) {
OpcodeStack.Item item = stack.getStackItem(types.size() - 1);
message = (String) item.getConstant();
if (message == null) {
message = "____UNKNOWN____" + System.identityHashCode(item);
}
}
} else {
message = "";
}
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack.sawOpcode(this, seen);
if ((message != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(message);
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
String message = null;
try {
stack.precomputation(this); // depends on control dependency: [try], data = [none]
if ((seen == Const.TABLESWITCH) || (seen == Const.LOOKUPSWITCH)) {
int pc = getPC();
for (int offset : getSwitchOffsets()) {
transitionPoints.set(pc + offset); // depends on control dependency: [for], data = [offset]
}
transitionPoints.set(pc + getDefaultSwitchOffset()); // depends on control dependency: [if], data = [none]
} else if (isBranch(seen) && (getBranchOffset() < 0)) {
// throw out try blocks in loops, this could cause false
// negatives
// with two try/catches in one loop, but more unlikely
Iterator<TryBlock> it = blocks.iterator();
int target = getBranchTarget();
while (it.hasNext()) {
TryBlock block = it.next();
if (block.getStartPC() >= target) {
it.remove(); // depends on control dependency: [if], data = [none]
}
}
}
int pc = getPC();
TryBlock block = findBlockWithStart(pc);
if (block != null) {
inBlocks.add(block); // depends on control dependency: [if], data = [(block]
block.setState(TryBlock.State.IN_TRY); // depends on control dependency: [if], data = [none]
}
if (inBlocks.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
TryBlock innerBlock = inBlocks.get(inBlocks.size() - 1);
int nextPC = getNextPC();
if (innerBlock.atHandlerPC(nextPC)) {
if ((seen == Const.GOTO) || (seen == Const.GOTO_W)) {
innerBlock.setEndHandlerPC(getBranchTarget()); // depends on control dependency: [if], data = [none]
} else {
inBlocks.remove(innerBlock); // depends on control dependency: [if], data = [none]
blocks.remove(innerBlock); // depends on control dependency: [if], data = [none]
}
} else if (innerBlock.atHandlerPC(pc)) {
innerBlock.setState(TryBlock.State.IN_CATCH); // depends on control dependency: [if], data = [none]
} else if (innerBlock.atEndHandlerPC(pc)) {
inBlocks.remove(inBlocks.size() - 1); // depends on control dependency: [if], data = [none]
innerBlock.setState(TryBlock.State.AFTER); // depends on control dependency: [if], data = [none]
}
if (transitionPoints.get(nextPC)) {
if (innerBlock.inCatch() && (innerBlock.getEndHandlerPC() > nextPC)) {
innerBlock.setEndHandlerPC(nextPC); // depends on control dependency: [if], data = [none]
}
}
if (innerBlock.inCatch()) {
if (((seen >= Const.IFEQ) && ((seen <= Const.RET))) || (seen == Const.GOTO_W) || OpcodeUtils.isReturn(seen)) {
blocks.remove(innerBlock); // depends on control dependency: [if], data = [none]
inBlocks.remove(inBlocks.size() - 1); // depends on control dependency: [if], data = [none]
} else if (seen == Const.ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
XMethod xm = item.getReturnValueOf();
if (xm != null) {
innerBlock.setThrowSignature(xm.getSignature()); // depends on control dependency: [if], data = [(xm]
}
innerBlock.setExceptionSignature(item.getSignature()); // depends on control dependency: [if], data = [none]
innerBlock.setMessage((String) item.getUserValue()); // depends on control dependency: [if], data = [none]
} else {
inBlocks.remove(inBlocks.size() - 1); // depends on control dependency: [if], data = [none]
innerBlock.setState(TryBlock.State.AFTER); // depends on control dependency: [if], data = [none]
}
} else if ((seen == Const.INVOKESPECIAL) && Values.CONSTRUCTOR.equals(getNameConstantOperand())) {
String cls = getClassConstantOperand();
JavaClass exCls = Repository.lookupClass(cls);
if (exCls.instanceOf(THROWABLE_CLASS)) {
String signature = getSigConstantOperand();
List<String> types = SignatureUtils.getParameterSignatures(signature);
if (!types.isEmpty()) {
if (Values.SIG_JAVA_LANG_STRING.equals(types.get(0)) && (stack.getStackDepth() >= types.size())) {
OpcodeStack.Item item = stack.getStackItem(types.size() - 1);
message = (String) item.getConstant(); // depends on control dependency: [if], data = [none]
if (message == null) {
message = "____UNKNOWN____" + System.identityHashCode(item); // depends on control dependency: [if], data = [none]
}
}
} else {
message = ""; // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally { // depends on control dependency: [catch], data = [none]
stack.sawOpcode(this, seen);
if ((message != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item item = stack.getStackItem(0);
item.setUserValue(message); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private VarTupleSet getValidTupleSet( RandSeq randSeq, FunctionInputDef inputDef)
{
List<Tuple> validTuples = new ArrayList<Tuple>();
// Get tuple sets required for each specified combiner, ordered for "greedy" processing, i.e. biggest tuples first.
// For this purpose, "all permutations" is considered the maximum tuple size, even though in practice it might not be.
getCombiners()
.stream()
.sorted( byTupleSize_)
.forEach( combiner -> validTuples.addAll( RandSeq.order( randSeq, combiner.getTuples( inputDef))));
// For all input variables that do not belong to a combiner tuple set...
List<VarDef> uncombinedVars =
IteratorUtils.toList(
IteratorUtils.filteredIterator(
new VarDefIterator( inputDef),
this::isUncombined));
if( !uncombinedVars.isEmpty())
{
// ... add the default tuples.
int defaultTupleSize = getDefaultTupleSize();
int varCount = uncombinedVars.size();
validTuples.addAll(
RandSeq.order(
randSeq,
getUncombinedTuples(
uncombinedVars,
Math.min(
varCount,
defaultTupleSize < 1? varCount : defaultTupleSize))));
}
return new VarTupleSet( validTuples);
} } | public class class_name {
private VarTupleSet getValidTupleSet( RandSeq randSeq, FunctionInputDef inputDef)
{
List<Tuple> validTuples = new ArrayList<Tuple>();
// Get tuple sets required for each specified combiner, ordered for "greedy" processing, i.e. biggest tuples first.
// For this purpose, "all permutations" is considered the maximum tuple size, even though in practice it might not be.
getCombiners()
.stream()
.sorted( byTupleSize_)
.forEach( combiner -> validTuples.addAll( RandSeq.order( randSeq, combiner.getTuples( inputDef))));
// For all input variables that do not belong to a combiner tuple set...
List<VarDef> uncombinedVars =
IteratorUtils.toList(
IteratorUtils.filteredIterator(
new VarDefIterator( inputDef),
this::isUncombined));
if( !uncombinedVars.isEmpty())
{
// ... add the default tuples.
int defaultTupleSize = getDefaultTupleSize();
int varCount = uncombinedVars.size();
validTuples.addAll(
RandSeq.order(
randSeq,
getUncombinedTuples(
uncombinedVars,
Math.min(
varCount,
defaultTupleSize < 1? varCount : defaultTupleSize)))); // depends on control dependency: [if], data = [none]
}
return new VarTupleSet( validTuples);
} } |
public class class_name {
protected void setLastUserTaskID(UserTask task) {
String name = task.getName();
if (name != null && name.length() > 0) {
int i = name.indexOf(DEFAULT_USERTASK_NAME_PREFIX);
if (i == 0) {
String numStr = name.substring(5);
try {
int num = Integer.parseInt(numStr);
if (num >= LastUserTaskID) {
LastUserTaskID = num;
}
} catch (NumberFormatException nfe) {
// do nothing
}
}
}
} } | public class class_name {
protected void setLastUserTaskID(UserTask task) {
String name = task.getName();
if (name != null && name.length() > 0) {
int i = name.indexOf(DEFAULT_USERTASK_NAME_PREFIX);
if (i == 0) {
String numStr = name.substring(5);
try {
int num = Integer.parseInt(numStr);
if (num >= LastUserTaskID) {
LastUserTaskID = num; // depends on control dependency: [if], data = [none]
}
} catch (NumberFormatException nfe) {
// do nothing
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public final <T> T decode(Val value) {
if (value == null) {
return null;
}
return decode(value.get());
} } | public class class_name {
public final <T> T decode(Val value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
return decode(value.get());
} } |
public class class_name {
public void marshall(Message message, ProtocolMarshaller protocolMarshaller) {
if (message == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(message.getSubject(), SUBJECT_BINDING);
protocolMarshaller.marshall(message.getBody(), BODY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Message message, ProtocolMarshaller protocolMarshaller) {
if (message == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(message.getSubject(), SUBJECT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(message.getBody(), BODY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Type[] typeLambdaReturnConstructor(Type.Callable[] types) {
Type[] returnTypes = new Type[types.length];
for (int i = 0; i != types.length; ++i) {
// NOTE: this is an implicit assumption that typeLambdaFilter() only ever
// returns
// lambda types with exactly one return type.
returnTypes[i] = types[i].getReturns().get(0);
}
return returnTypes;
} } | public class class_name {
public static Type[] typeLambdaReturnConstructor(Type.Callable[] types) {
Type[] returnTypes = new Type[types.length];
for (int i = 0; i != types.length; ++i) {
// NOTE: this is an implicit assumption that typeLambdaFilter() only ever
// returns
// lambda types with exactly one return type.
returnTypes[i] = types[i].getReturns().get(0); // depends on control dependency: [for], data = [i]
}
return returnTypes;
} } |
public class class_name {
public static InputStream findResourceAsStream(final String resourceName) {
// First try the context class loader
final ClassLoader contextClassLoader = getThreadContextClassLoader();
if (contextClassLoader != null) {
final InputStream inputStream = contextClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream;
}
// Pass-through, there might be other ways of obtaining it
// note anyway that this is not really normal: the context class loader should be
// either able to resolve any of our application's resources, or to delegate to a class
// loader that can do that.
}
// The thread context class loader might have already delegated to both the class
// and system class loaders, in which case it makes little sense to query them too.
if (!isKnownLeafClassLoader(contextClassLoader)) {
// The context class loader didn't help, so... maybe the class one?
if (classClassLoader != null && classClassLoader != contextClassLoader) {
final InputStream inputStream = classClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream;
}
// Pass-through, maybe the system class loader can do it? - though it would be *really* weird...
}
if (!systemClassLoaderAccessibleFromClassClassLoader) {
// The only class loader we can rely on for not being null is the system one
if (systemClassLoader != null && systemClassLoader != contextClassLoader && systemClassLoader != classClassLoader) {
final InputStream inputStream = systemClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream;
}
// Pass-through, anyway we have a return null after this...
}
}
}
return null;
} } | public class class_name {
public static InputStream findResourceAsStream(final String resourceName) {
// First try the context class loader
final ClassLoader contextClassLoader = getThreadContextClassLoader();
if (contextClassLoader != null) {
final InputStream inputStream = contextClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream; // depends on control dependency: [if], data = [none]
}
// Pass-through, there might be other ways of obtaining it
// note anyway that this is not really normal: the context class loader should be
// either able to resolve any of our application's resources, or to delegate to a class
// loader that can do that.
}
// The thread context class loader might have already delegated to both the class
// and system class loaders, in which case it makes little sense to query them too.
if (!isKnownLeafClassLoader(contextClassLoader)) {
// The context class loader didn't help, so... maybe the class one?
if (classClassLoader != null && classClassLoader != contextClassLoader) {
final InputStream inputStream = classClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream; // depends on control dependency: [if], data = [none]
}
// Pass-through, maybe the system class loader can do it? - though it would be *really* weird...
}
if (!systemClassLoaderAccessibleFromClassClassLoader) {
// The only class loader we can rely on for not being null is the system one
if (systemClassLoader != null && systemClassLoader != contextClassLoader && systemClassLoader != classClassLoader) {
final InputStream inputStream = systemClassLoader.getResourceAsStream(resourceName);
if (inputStream != null) {
return inputStream; // depends on control dependency: [if], data = [none]
}
// Pass-through, anyway we have a return null after this...
}
}
}
return null;
} } |
public class class_name {
protected void createA(List<AssociatedPair> points, DMatrixRMaj A ) {
A.reshape(points.size(),9, false);
A.zero();
Point2D_F64 f_norm = new Point2D_F64();
Point2D_F64 s_norm = new Point2D_F64();
final int size = points.size();
for( int i = 0; i < size; i++ ) {
AssociatedPair p = points.get(i);
Point2D_F64 f = p.p1;
Point2D_F64 s = p.p2;
// normalize the points
N1.apply(f, f_norm);
N2.apply(s, s_norm);
// perform the Kronecker product with the two points being in
// homogeneous coordinates (z=1)
A.unsafe_set(i,0,s_norm.x*f_norm.x);
A.unsafe_set(i,1,s_norm.x*f_norm.y);
A.unsafe_set(i,2,s_norm.x);
A.unsafe_set(i,3,s_norm.y*f_norm.x);
A.unsafe_set(i,4,s_norm.y*f_norm.y);
A.unsafe_set(i,5,s_norm.y);
A.unsafe_set(i,6,f_norm.x);
A.unsafe_set(i,7,f_norm.y);
A.unsafe_set(i,8,1);
}
} } | public class class_name {
protected void createA(List<AssociatedPair> points, DMatrixRMaj A ) {
A.reshape(points.size(),9, false);
A.zero();
Point2D_F64 f_norm = new Point2D_F64();
Point2D_F64 s_norm = new Point2D_F64();
final int size = points.size();
for( int i = 0; i < size; i++ ) {
AssociatedPair p = points.get(i);
Point2D_F64 f = p.p1;
Point2D_F64 s = p.p2;
// normalize the points
N1.apply(f, f_norm); // depends on control dependency: [for], data = [none]
N2.apply(s, s_norm); // depends on control dependency: [for], data = [none]
// perform the Kronecker product with the two points being in
// homogeneous coordinates (z=1)
A.unsafe_set(i,0,s_norm.x*f_norm.x); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,1,s_norm.x*f_norm.y); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,2,s_norm.x); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,3,s_norm.y*f_norm.x); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,4,s_norm.y*f_norm.y); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,5,s_norm.y); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,6,f_norm.x); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,7,f_norm.y); // depends on control dependency: [for], data = [i]
A.unsafe_set(i,8,1); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
String hash(TemplateClass tc) {
try {
//Object enhancer = engine.conf().byteCodeEnhancer();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update((engine.version() + tc.getTemplateSource(true)).getBytes("utf-8"));
byte[] digest = messageDigest.digest();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < digest.length; ++i) {
int value = digest[i];
if (value < 0) {
value += 256;
}
builder.append(Integer.toHexString(value));
}
return builder.toString();
} catch (Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
String hash(TemplateClass tc) {
try {
//Object enhancer = engine.conf().byteCodeEnhancer();
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset(); // depends on control dependency: [try], data = [none]
messageDigest.update((engine.version() + tc.getTemplateSource(true)).getBytes("utf-8")); // depends on control dependency: [try], data = [none]
byte[] digest = messageDigest.digest();
StringBuilder builder = new StringBuilder();
for (int i = 0; i < digest.length; ++i) {
int value = digest[i];
if (value < 0) {
value += 256; // depends on control dependency: [if], data = [none]
}
builder.append(Integer.toHexString(value)); // depends on control dependency: [for], data = [none]
}
return builder.toString(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static SanitizedContent create(String content, ContentKind kind) {
checkArgument(
kind != ContentKind.TEXT, "Use UnsanitizedString for SanitizedContent with a kind of TEXT");
if (Flags.stringIsNotSanitizedContent()) {
return new SanitizedContent(content, kind, kind.getDefaultDir());
}
return SanitizedCompatString.create(content, kind, kind.getDefaultDir());
} } | public class class_name {
static SanitizedContent create(String content, ContentKind kind) {
checkArgument(
kind != ContentKind.TEXT, "Use UnsanitizedString for SanitizedContent with a kind of TEXT");
if (Flags.stringIsNotSanitizedContent()) {
return new SanitizedContent(content, kind, kind.getDefaultDir()); // depends on control dependency: [if], data = [none]
}
return SanitizedCompatString.create(content, kind, kind.getDefaultDir());
} } |
public class class_name {
@Override
public void putAll(final Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (size() == 0 && mapSize != 0 && map instanceof SortedMap) {
Comparator<?> c = ((SortedMap<? extends K, ? extends V>) map).comparator();
if (c == comparator || (c != null && c.equals(comparator))) {
++modCount;
try {
buildFromSorted(mapSize, map.entrySet().iterator(), null, null);
} catch (java.io.IOException cannotHappen) {
} catch (ClassNotFoundException cannotHappen) {
}
return;
}
}
super.putAll(map);
} } | public class class_name {
@Override
public void putAll(final Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (size() == 0 && mapSize != 0 && map instanceof SortedMap) {
Comparator<?> c = ((SortedMap<? extends K, ? extends V>) map).comparator();
if (c == comparator || (c != null && c.equals(comparator))) {
++modCount;
// depends on control dependency: [if], data = [none]
try {
buildFromSorted(mapSize, map.entrySet().iterator(), null, null);
// depends on control dependency: [try], data = [none]
} catch (java.io.IOException cannotHappen) {
} catch (ClassNotFoundException cannotHappen) {
// depends on control dependency: [catch], data = [none]
}
// depends on control dependency: [catch], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
}
super.putAll(map);
} } |
public class class_name {
@Override
public ValidationResult validate(PMContext ctx) {
final ValidationResult res = new ValidationResult();
final String fieldvalue = (String) ctx.getFieldValue();
res.setSuccessful(true);
if (!isName(fieldvalue)) {
res.setSuccessful(false);
res.getMessages().add(MessageFactory.error(ctx.getEntity(), ctx.getField(), get("msg", "")));
}
return res;
} } | public class class_name {
@Override
public ValidationResult validate(PMContext ctx) {
final ValidationResult res = new ValidationResult();
final String fieldvalue = (String) ctx.getFieldValue();
res.setSuccessful(true);
if (!isName(fieldvalue)) {
res.setSuccessful(false); // depends on control dependency: [if], data = [none]
res.getMessages().add(MessageFactory.error(ctx.getEntity(), ctx.getField(), get("msg", ""))); // depends on control dependency: [if], data = [none]
}
return res;
} } |
public class class_name {
protected void pushIdScope()
{
if (_idScope != null) {
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
ArrayList/*<String>*/ list = (ArrayList/*<String>*/) RequestUtils.getOuterAttribute(req,SCOPE_ID);
if (list == null) {
list = new ArrayList/*<String>*/();
RequestUtils.setOuterAttribute(req,SCOPE_ID,list);
}
list.add(_idScope);
}
} } | public class class_name {
protected void pushIdScope()
{
if (_idScope != null) {
HttpServletRequest req = (HttpServletRequest) pageContext.getRequest();
ArrayList/*<String>*/ list = (ArrayList/*<String>*/) RequestUtils.getOuterAttribute(req,SCOPE_ID);
if (list == null) {
list = new ArrayList/*<String>*/(); // depends on control dependency: [if], data = [none]
RequestUtils.setOuterAttribute(req,SCOPE_ID,list); // depends on control dependency: [if], data = [none]
}
list.add(_idScope); // depends on control dependency: [if], data = [(_idScope]
}
} } |
public class class_name {
public void addButton(Widget button) {
if (m_isFrame) {
initButtonPanel();
m_buttonPanel.insert(button, 0);
} else {
m_popup.addButton(button);
}
} } | public class class_name {
public void addButton(Widget button) {
if (m_isFrame) {
initButtonPanel();
// depends on control dependency: [if], data = [none]
m_buttonPanel.insert(button, 0);
// depends on control dependency: [if], data = [none]
} else {
m_popup.addButton(button);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public String marshall(Object value) {
if( value == null ) {
return "null";
}
return BuiltInFunctions.getFunction( StringFunction.class ).invoke( value ).cata( justNull(), Function.identity());
} } | public class class_name {
@Override
public String marshall(Object value) {
if( value == null ) {
return "null"; // depends on control dependency: [if], data = [none]
}
return BuiltInFunctions.getFunction( StringFunction.class ).invoke( value ).cata( justNull(), Function.identity());
} } |
public class class_name {
public Map<String, String> getMulti(String columnName, String... keys) {
MultigetSliceQuery<String, String,String> q = createMultigetSliceQuery(keyspace, serializer, serializer, serializer);
q.setColumnFamily(columnFamilyName);
q.setKeys(keys);
q.setColumnNames(columnName);
QueryResult<Rows<String,String,String>> r = q.execute();
Rows<String,String,String> rows = r.get();
Map<String, String> ret = new HashMap<String, String>(keys.length);
for (String k: keys) {
HColumn<String, String> c = rows.getByKey(k).getColumnSlice().getColumnByName(columnName);
if (c != null && c.getValue() != null) {
ret.put(k, c.getValue());
}
}
return ret;
} } | public class class_name {
public Map<String, String> getMulti(String columnName, String... keys) {
MultigetSliceQuery<String, String,String> q = createMultigetSliceQuery(keyspace, serializer, serializer, serializer);
q.setColumnFamily(columnFamilyName);
q.setKeys(keys);
q.setColumnNames(columnName);
QueryResult<Rows<String,String,String>> r = q.execute();
Rows<String,String,String> rows = r.get();
Map<String, String> ret = new HashMap<String, String>(keys.length);
for (String k: keys) {
HColumn<String, String> c = rows.getByKey(k).getColumnSlice().getColumnByName(columnName);
if (c != null && c.getValue() != null) {
ret.put(k, c.getValue()); // depends on control dependency: [if], data = [none]
}
}
return ret;
} } |
public class class_name {
@InterfaceAudience.Public
public void setHeaders(Map<String, Object> requestHeadersParam) {
if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) {
requestHeaders = requestHeadersParam;
}
} } | public class class_name {
@InterfaceAudience.Public
public void setHeaders(Map<String, Object> requestHeadersParam) {
if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) {
requestHeaders = requestHeadersParam; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int[] commonElements(int[] arra, int[] arrb) {
int[] c = null;
int n = countCommonElements(arra, arrb);
if (n > 0) {
c = new int[n];
int k = 0;
for (int i = 0; i < arra.length; i++) {
for (int j = 0; j < arrb.length; j++) {
if (arra[i] == arrb[j]) {
c[k++] = arra[i];
}
}
}
}
return c;
} } | public class class_name {
public static int[] commonElements(int[] arra, int[] arrb) {
int[] c = null;
int n = countCommonElements(arra, arrb);
if (n > 0) {
c = new int[n]; // depends on control dependency: [if], data = [none]
int k = 0;
for (int i = 0; i < arra.length; i++) {
for (int j = 0; j < arrb.length; j++) {
if (arra[i] == arrb[j]) {
c[k++] = arra[i]; // depends on control dependency: [if], data = [none]
}
}
}
}
return c;
} } |
public class class_name {
public static <T extends SerializableObject> T deserialize(File file, Class<T> cls) throws IOException {
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
DataInputStream in = new DataInputStream(stream);
try {
Constructor<T> constructor = cls.getDeclaredConstructor(DataInput.class);
constructor.setAccessible(true);
return constructor.newInstance(in);
} catch (Exception e) {
throw new IOException("Unable to instantiate class: " + cls, e);
}
} finally {
Util.ensureClosed(stream);
}
} } | public class class_name {
public static <T extends SerializableObject> T deserialize(File file, Class<T> cls) throws IOException {
FileInputStream stream = null;
try {
stream = new FileInputStream(file);
DataInputStream in = new DataInputStream(stream);
try {
Constructor<T> constructor = cls.getDeclaredConstructor(DataInput.class);
constructor.setAccessible(true); // depends on control dependency: [try], data = [none]
return constructor.newInstance(in); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new IOException("Unable to instantiate class: " + cls, e);
} // depends on control dependency: [catch], data = [none]
} finally {
Util.ensureClosed(stream);
}
} } |
public class class_name {
private AuthConfig parseOpenShiftConfig() {
Map kubeConfig = DockerFileUtil.readKubeConfig();
if (kubeConfig == null) {
return null;
}
String currentContextName = (String) kubeConfig.get("current-context");
if (currentContextName == null) {
return null;
}
for (Map contextMap : (List<Map>) kubeConfig.get("contexts")) {
if (currentContextName.equals(contextMap.get("name"))) {
return parseContext(kubeConfig, (Map) contextMap.get("context"));
}
}
return null;
} } | public class class_name {
private AuthConfig parseOpenShiftConfig() {
Map kubeConfig = DockerFileUtil.readKubeConfig();
if (kubeConfig == null) {
return null; // depends on control dependency: [if], data = [none]
}
String currentContextName = (String) kubeConfig.get("current-context");
if (currentContextName == null) {
return null; // depends on control dependency: [if], data = [none]
}
for (Map contextMap : (List<Map>) kubeConfig.get("contexts")) {
if (currentContextName.equals(contextMap.get("name"))) {
return parseContext(kubeConfig, (Map) contextMap.get("context")); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public Response doExecute(String name, ExecutionRequest executionRequest, CommandCompletePostProcessor postProcessor, UserDetails userDetails, RestUIContext uiContext) throws Exception {
try (RestUIContext context = uiContext) {
UICommand command = getCommandByName(context, name);
if (command == null) {
return Response.status(Status.NOT_FOUND).build();
}
List<Map<String, Object>> inputList = executionRequest.getInputList();
// lets ensure a valid targetLocation for new projects
if (Objects.equal(PROJECT_NEW_COMMAND, name)) {
if (inputList.size() > 0) {
Map<String, Object> map = inputList.get(0);
map.put(TARGET_LOCATION_PROPERTY, projectFileSystem.getUserProjectFolderLocation(userDetails));
}
}
CommandController controller = createController(context, command);
configureAttributeMaps(userDetails, controller, executionRequest);
ExecutionResult answer = null;
if (controller instanceof WizardCommandController) {
WizardCommandController wizardCommandController = (WizardCommandController) controller;
List<WizardCommandController> controllers = new ArrayList<>();
List<CommandInputDTO> stepPropertiesList = new ArrayList<>();
List<ExecutionResult> stepResultList = new ArrayList<>();
List<ValidationResult> stepValidationList = new ArrayList<>();
controllers.add(wizardCommandController);
WizardCommandController lastController = wizardCommandController;
Result lastResult = null;
int page = executionRequest.wizardStep();
int nextPage = page + 1;
boolean canMoveToNextStep = false;
for (Map<String, Object> inputs : inputList) {
UICommands.populateController(inputs, lastController, getConverterFactory());
List<UIMessage> messages = lastController.validate();
ValidationResult stepValidation = UICommands.createValidationResult(context, lastController, messages);
stepValidationList.add(stepValidation);
if (!stepValidation.isValid()) {
break;
}
canMoveToNextStep = lastController.canMoveToNextStep();
boolean valid = lastController.isValid();
if (!canMoveToNextStep) {
if (lastController.canExecute()) {
// lets assume we can execute now
LOG.info("About to invoked command " + name + " stepValidation: " + stepValidation + " messages: " + messages + " with " + executionRequest);
lastResult = lastController.execute();
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
stepResultList.add(stepResults);
break;
} else {
stepValidation.addValidationError("Forge command failed with an internal error");
LOG.warn("Cannot move to next step as canExecute() returns false but the validation seems to be fine!");
break;
}
} else if (!valid) {
stepValidation.addValidationError("Forge command is not valid but didn't report any validation errors!");
LOG.warn("Cannot move to next step as invalid despite the validation saying otherwise");
break;
}
WizardCommandController nextController = lastController.next();
if (nextController != null) {
if (nextController == lastController) {
LOG.warn("No idea whats going on ;)");
break;
}
lastController = nextController;
lastController.initialize();
controllers.add(lastController);
CommandInputDTO stepDto = UICommands.createCommandInputDTO(context, command, lastController);
stepPropertiesList.add(stepDto);
} else {
int i = 0;
for (WizardCommandController stepController : controllers) {
Map<String, Object> stepControllerInputs = inputList.get(i++);
UICommands.populateController(stepControllerInputs, stepController, getConverterFactory());
lastResult = stepController.execute();
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult);
ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
stepResultList.add(stepResults);
}
break;
}
}
answer = UICommands.createExecutionResult(context, lastResult, canMoveToNextStep);
WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepValidationList, stepResultList);
answer.setWizardResults(wizardResultsDTO);
} else {
Map<String, Object> inputs = inputList.get(0);
UICommands.populateController(inputs, controller, getConverterFactory());
Result result = controller.execute();
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + result);
answer = UICommands.createExecutionResult(context, result, false);
}
if (answer.isCommandCompleted() && postProcessor != null) {
postProcessor.firePostCompleteActions(name, executionRequest, context, controller, answer, request);
}
context.setCommitMessage(ExecutionRequest.createCommitMessage(name, executionRequest));
return Response.ok(answer).build();
}
} } | public class class_name {
public Response doExecute(String name, ExecutionRequest executionRequest, CommandCompletePostProcessor postProcessor, UserDetails userDetails, RestUIContext uiContext) throws Exception {
try (RestUIContext context = uiContext) {
UICommand command = getCommandByName(context, name);
if (command == null) {
return Response.status(Status.NOT_FOUND).build(); // depends on control dependency: [if], data = [none]
}
List<Map<String, Object>> inputList = executionRequest.getInputList();
// lets ensure a valid targetLocation for new projects
if (Objects.equal(PROJECT_NEW_COMMAND, name)) {
if (inputList.size() > 0) {
Map<String, Object> map = inputList.get(0);
map.put(TARGET_LOCATION_PROPERTY, projectFileSystem.getUserProjectFolderLocation(userDetails)); // depends on control dependency: [if], data = [none]
}
}
CommandController controller = createController(context, command);
configureAttributeMaps(userDetails, controller, executionRequest);
ExecutionResult answer = null;
if (controller instanceof WizardCommandController) {
WizardCommandController wizardCommandController = (WizardCommandController) controller;
List<WizardCommandController> controllers = new ArrayList<>();
List<CommandInputDTO> stepPropertiesList = new ArrayList<>();
List<ExecutionResult> stepResultList = new ArrayList<>();
List<ValidationResult> stepValidationList = new ArrayList<>();
controllers.add(wizardCommandController); // depends on control dependency: [if], data = [none]
WizardCommandController lastController = wizardCommandController;
Result lastResult = null;
int page = executionRequest.wizardStep();
int nextPage = page + 1;
boolean canMoveToNextStep = false;
for (Map<String, Object> inputs : inputList) {
UICommands.populateController(inputs, lastController, getConverterFactory()); // depends on control dependency: [for], data = [inputs]
List<UIMessage> messages = lastController.validate();
ValidationResult stepValidation = UICommands.createValidationResult(context, lastController, messages);
stepValidationList.add(stepValidation); // depends on control dependency: [for], data = [none]
if (!stepValidation.isValid()) {
break;
}
canMoveToNextStep = lastController.canMoveToNextStep(); // depends on control dependency: [for], data = [none]
boolean valid = lastController.isValid();
if (!canMoveToNextStep) {
if (lastController.canExecute()) {
// lets assume we can execute now
LOG.info("About to invoked command " + name + " stepValidation: " + stepValidation + " messages: " + messages + " with " + executionRequest); // depends on control dependency: [if], data = [none]
lastResult = lastController.execute(); // depends on control dependency: [if], data = [none]
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult); // depends on control dependency: [if], data = [none]
ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
stepResultList.add(stepResults); // depends on control dependency: [if], data = [none]
break;
} else {
stepValidation.addValidationError("Forge command failed with an internal error"); // depends on control dependency: [if], data = [none]
LOG.warn("Cannot move to next step as canExecute() returns false but the validation seems to be fine!"); // depends on control dependency: [if], data = [none]
break;
}
} else if (!valid) {
stepValidation.addValidationError("Forge command is not valid but didn't report any validation errors!"); // depends on control dependency: [if], data = [none]
LOG.warn("Cannot move to next step as invalid despite the validation saying otherwise"); // depends on control dependency: [if], data = [none]
break;
}
WizardCommandController nextController = lastController.next();
if (nextController != null) {
if (nextController == lastController) {
LOG.warn("No idea whats going on ;)"); // depends on control dependency: [if], data = [none]
break;
}
lastController = nextController; // depends on control dependency: [if], data = [none]
lastController.initialize(); // depends on control dependency: [if], data = [none]
controllers.add(lastController); // depends on control dependency: [if], data = [none]
CommandInputDTO stepDto = UICommands.createCommandInputDTO(context, command, lastController);
stepPropertiesList.add(stepDto); // depends on control dependency: [if], data = [none]
} else {
int i = 0;
for (WizardCommandController stepController : controllers) {
Map<String, Object> stepControllerInputs = inputList.get(i++);
UICommands.populateController(stepControllerInputs, stepController, getConverterFactory()); // depends on control dependency: [for], data = [stepController]
lastResult = stepController.execute(); // depends on control dependency: [for], data = [stepController]
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + lastResult); // depends on control dependency: [for], data = [none]
ExecutionResult stepResults = UICommands.createExecutionResult(context, lastResult, false);
stepResultList.add(stepResults); // depends on control dependency: [for], data = [none]
}
break;
}
}
answer = UICommands.createExecutionResult(context, lastResult, canMoveToNextStep); // depends on control dependency: [if], data = [none]
WizardResultsDTO wizardResultsDTO = new WizardResultsDTO(stepPropertiesList, stepValidationList, stepResultList);
answer.setWizardResults(wizardResultsDTO); // depends on control dependency: [if], data = [none]
} else {
Map<String, Object> inputs = inputList.get(0);
UICommands.populateController(inputs, controller, getConverterFactory()); // depends on control dependency: [if], data = [none]
Result result = controller.execute();
LOG.debug("Invoked command " + name + " with " + executionRequest + " result: " + result); // depends on control dependency: [if], data = [none]
answer = UICommands.createExecutionResult(context, result, false); // depends on control dependency: [if], data = [none]
}
if (answer.isCommandCompleted() && postProcessor != null) {
postProcessor.firePostCompleteActions(name, executionRequest, context, controller, answer, request); // depends on control dependency: [if], data = [none]
}
context.setCommitMessage(ExecutionRequest.createCommitMessage(name, executionRequest));
return Response.ok(answer).build();
}
} } |
public class class_name {
public static Set<SelectorName> getSelectorsReferencedBy( Visitable visitable ) {
final Set<SelectorName> symbols = new HashSet<SelectorName>();
// Walk the entire structure, so only supply a StrategyVisitor (that does no navigation) ...
visitAll(visitable, new AbstractVisitor() {
@Override
public void visit( AllNodes allNodes ) {
if (allNodes.hasAlias()) {
symbols.add(allNodes.alias());
} else {
symbols.add(allNodes.name());
}
}
@Override
public void visit( ChildNode childNode ) {
symbols.add(childNode.selectorName());
}
@Override
public void visit( ChildNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.childSelectorName());
symbols.add(joinCondition.parentSelectorName());
}
@Override
public void visit( Column column ) {
symbols.add(column.selectorName());
}
@Override
public void visit( DescendantNode descendant ) {
symbols.add(descendant.selectorName());
}
@Override
public void visit( DescendantNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.ancestorSelectorName());
symbols.add(joinCondition.descendantSelectorName());
}
@Override
public void visit( EquiJoinCondition joinCondition ) {
symbols.add(joinCondition.selector1Name());
symbols.add(joinCondition.selector2Name());
}
@Override
public void visit( FullTextSearch fullTextSearch ) {
symbols.add(fullTextSearch.selectorName());
}
@Override
public void visit( FullTextSearchScore fullTextSearchScore ) {
symbols.add(fullTextSearchScore.selectorName());
}
@Override
public void visit( Length length ) {
symbols.add(length.selectorName());
}
@Override
public void visit( NodeDepth depth ) {
symbols.add(depth.selectorName());
}
@Override
public void visit( NodePath path ) {
symbols.add(path.selectorName());
}
@Override
public void visit( NodeLocalName node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( NodeName node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( NamedSelector node ) {
if (node.hasAlias()) {
symbols.add(node.alias());
} else {
symbols.add(node.name());
}
}
@Override
public void visit( PropertyExistence prop ) {
symbols.add(prop.selectorName());
}
@Override
public void visit( PropertyValue prop ) {
symbols.add(prop.selectorName());
}
@Override
public void visit( Subquery obj ) {
// do nothing ...
}
@Override
public void visit( ReferenceValue ref ) {
symbols.add(ref.selectorName());
}
@Override
public void visit( SameNode node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( SameNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.selector1Name());
symbols.add(joinCondition.selector2Name());
}
});
return symbols;
} } | public class class_name {
public static Set<SelectorName> getSelectorsReferencedBy( Visitable visitable ) {
final Set<SelectorName> symbols = new HashSet<SelectorName>();
// Walk the entire structure, so only supply a StrategyVisitor (that does no navigation) ...
visitAll(visitable, new AbstractVisitor() {
@Override
public void visit( AllNodes allNodes ) {
if (allNodes.hasAlias()) {
symbols.add(allNodes.alias()); // depends on control dependency: [if], data = [none]
} else {
symbols.add(allNodes.name()); // depends on control dependency: [if], data = [none]
}
}
@Override
public void visit( ChildNode childNode ) {
symbols.add(childNode.selectorName());
}
@Override
public void visit( ChildNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.childSelectorName());
symbols.add(joinCondition.parentSelectorName());
}
@Override
public void visit( Column column ) {
symbols.add(column.selectorName());
}
@Override
public void visit( DescendantNode descendant ) {
symbols.add(descendant.selectorName());
}
@Override
public void visit( DescendantNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.ancestorSelectorName());
symbols.add(joinCondition.descendantSelectorName());
}
@Override
public void visit( EquiJoinCondition joinCondition ) {
symbols.add(joinCondition.selector1Name());
symbols.add(joinCondition.selector2Name());
}
@Override
public void visit( FullTextSearch fullTextSearch ) {
symbols.add(fullTextSearch.selectorName());
}
@Override
public void visit( FullTextSearchScore fullTextSearchScore ) {
symbols.add(fullTextSearchScore.selectorName());
}
@Override
public void visit( Length length ) {
symbols.add(length.selectorName());
}
@Override
public void visit( NodeDepth depth ) {
symbols.add(depth.selectorName());
}
@Override
public void visit( NodePath path ) {
symbols.add(path.selectorName());
}
@Override
public void visit( NodeLocalName node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( NodeName node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( NamedSelector node ) {
if (node.hasAlias()) {
symbols.add(node.alias()); // depends on control dependency: [if], data = [none]
} else {
symbols.add(node.name()); // depends on control dependency: [if], data = [none]
}
}
@Override
public void visit( PropertyExistence prop ) {
symbols.add(prop.selectorName());
}
@Override
public void visit( PropertyValue prop ) {
symbols.add(prop.selectorName());
}
@Override
public void visit( Subquery obj ) {
// do nothing ...
}
@Override
public void visit( ReferenceValue ref ) {
symbols.add(ref.selectorName());
}
@Override
public void visit( SameNode node ) {
symbols.add(node.selectorName());
}
@Override
public void visit( SameNodeJoinCondition joinCondition ) {
symbols.add(joinCondition.selector1Name());
symbols.add(joinCondition.selector2Name());
}
});
return symbols;
} } |
public class class_name {
public static <T> JavaRDD<T>[] balancedRandomSplit(int totalObjectCount, int numObjectsPerSplit, JavaRDD<T> data,
long rngSeed) {
JavaRDD<T>[] splits;
if (totalObjectCount <= numObjectsPerSplit) {
splits = (JavaRDD<T>[]) Array.newInstance(JavaRDD.class, 1);
splits[0] = data;
} else {
int numSplits = totalObjectCount / numObjectsPerSplit; //Intentional round down
splits = (JavaRDD<T>[]) Array.newInstance(JavaRDD.class, numSplits);
for (int i = 0; i < numSplits; i++) {
splits[i] = data.mapPartitionsWithIndex(new SplitPartitionsFunction<T>(i, numSplits, rngSeed), true);
}
}
return splits;
} } | public class class_name {
public static <T> JavaRDD<T>[] balancedRandomSplit(int totalObjectCount, int numObjectsPerSplit, JavaRDD<T> data,
long rngSeed) {
JavaRDD<T>[] splits;
if (totalObjectCount <= numObjectsPerSplit) {
splits = (JavaRDD<T>[]) Array.newInstance(JavaRDD.class, 1); // depends on control dependency: [if], data = [none]
splits[0] = data; // depends on control dependency: [if], data = [none]
} else {
int numSplits = totalObjectCount / numObjectsPerSplit; //Intentional round down
splits = (JavaRDD<T>[]) Array.newInstance(JavaRDD.class, numSplits); // depends on control dependency: [if], data = [none]
for (int i = 0; i < numSplits; i++) {
splits[i] = data.mapPartitionsWithIndex(new SplitPartitionsFunction<T>(i, numSplits, rngSeed), true); // depends on control dependency: [for], data = [i]
}
}
return splits;
} } |
public class class_name {
private void removeUnsharedReference(Object obj, int previousHandle) {
if (previousHandle != -1) {
objectsWritten.put(obj, previousHandle);
} else {
objectsWritten.remove(obj);
}
} } | public class class_name {
private void removeUnsharedReference(Object obj, int previousHandle) {
if (previousHandle != -1) {
objectsWritten.put(obj, previousHandle); // depends on control dependency: [if], data = [none]
} else {
objectsWritten.remove(obj); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void loadFilteredPath(String filter) {
if (filter == null) return;
filter = getSlashyPath(filter);
int starIndex = filter.indexOf(WILDCARD);
if (starIndex == -1) {
addFile(new File(filter));
return;
}
boolean recursive = filter.contains(ALL_WILDCARD);
if (filter.lastIndexOf('/') < starIndex) {
starIndex = filter.lastIndexOf('/') + 1;
}
String startDir = filter.substring(0, starIndex - 1);
File root = new File(startDir);
filter = Pattern.quote(filter);
filter = filter.replaceAll("\\" + WILDCARD + "\\" + WILDCARD, MATCH_ALL);
filter = filter.replaceAll("\\" + WILDCARD, MATCH_FILE_NAME);
Pattern pattern = Pattern.compile(filter);
final File[] files = root.listFiles();
if (files != null) {
findMatchingFiles(files, pattern, recursive);
}
} } | public class class_name {
private void loadFilteredPath(String filter) {
if (filter == null) return;
filter = getSlashyPath(filter);
int starIndex = filter.indexOf(WILDCARD);
if (starIndex == -1) {
addFile(new File(filter)); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
boolean recursive = filter.contains(ALL_WILDCARD);
if (filter.lastIndexOf('/') < starIndex) {
starIndex = filter.lastIndexOf('/') + 1; // depends on control dependency: [if], data = [none]
}
String startDir = filter.substring(0, starIndex - 1);
File root = new File(startDir);
filter = Pattern.quote(filter);
filter = filter.replaceAll("\\" + WILDCARD + "\\" + WILDCARD, MATCH_ALL);
filter = filter.replaceAll("\\" + WILDCARD, MATCH_FILE_NAME);
Pattern pattern = Pattern.compile(filter);
final File[] files = root.listFiles();
if (files != null) {
findMatchingFiles(files, pattern, recursive); // depends on control dependency: [if], data = [(files]
}
} } |
public class class_name {
static byte[] pollAndConvertToByteArray(final int totalCapacity,
final Queue<ByteBuffer> dataArray) {
final byte[] wholeData = new byte[totalCapacity];
int destStartIndex = 0;
ByteBuffer data;
while ((data = dataArray.poll()) != null) {
final byte[] array = data.array();
System.arraycopy(array, 0, wholeData, destStartIndex, array.length);
destStartIndex += array.length;
if (destStartIndex == totalCapacity) {
break;
}
}
return wholeData;
} } | public class class_name {
static byte[] pollAndConvertToByteArray(final int totalCapacity,
final Queue<ByteBuffer> dataArray) {
final byte[] wholeData = new byte[totalCapacity];
int destStartIndex = 0;
ByteBuffer data;
while ((data = dataArray.poll()) != null) {
final byte[] array = data.array();
System.arraycopy(array, 0, wholeData, destStartIndex, array.length); // depends on control dependency: [while], data = [none]
destStartIndex += array.length; // depends on control dependency: [while], data = [none]
if (destStartIndex == totalCapacity) {
break;
}
}
return wholeData;
} } |
public class class_name {
private void parseLocationStep(String selector,
int start,
int stepEnd)
throws InvalidXPathSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(cclass,
"parseLocationStep",
"selector: " + selector + ", start: " + start + ", end: " + stepEnd);
int stepStart = start;
int posOpenBracket = selector.indexOf("[", start);
if(posOpenBracket > stepEnd || posOpenBracket == -1)
{
// Set posOpenBracket to avoid further processing
posOpenBracket = -1;
// No brackets so process whole of the location step
String step = selector.substring(start,stepEnd);
// Set the full name into the identifier. The full name is used in position assignment when
// determining uniqueness of names. Only a full name will do.
String full = selector.substring(0,stepEnd);
// Add an IdentifierImpl for the location step to the array list
selOperands.add(createIdentifierForSubExpression(step, full, true, false));
}
int posCloseBracket = selector.indexOf("]", start);
boolean wrapWholeStep = false;
boolean foundPredicates = false;
ArrayList tempSelOperands = new ArrayList();
while (posOpenBracket >= 0)
{
foundPredicates = true;
if(posCloseBracket < posOpenBracket)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "parseLocationStep", "bracket error");
InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector);
FFDC.processException(cclass,
"com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl",
iex,
"1:372:1.16");
throw iex;
}
else
{
// The full selector path up to this point
String full = selector.substring(0,posOpenBracket);
// Factor out the location step first but be careful we may have a predicate
if(start != posOpenBracket)
{
// Go ahead and deal with the location step
String step = selector.substring(start,posOpenBracket);
// Add an IdentifierImpl for the location step to the array list
tempSelOperands.add(createIdentifierForSubExpression(step, full, true, false));
}
// Now parse the predicate
String predicate = selector.substring(posOpenBracket + 1,posCloseBracket);
Selector parsedPredicate = parsePredicate(predicate, full);
// Check whether we were able to parse
if(parsedPredicate == null)
{
// Unable to parse the expression, so we need to wrap the entire step
// tempSelOperands.add(createIdentifierForSubExpression(predicate, false));
wrapWholeStep = true;
break;
}
else
{
// we were able to parse the expression with the MatchParser
// Check that the predicate has Simple tests only
if(!Matching.isSimple(parsedPredicate))
{
wrapWholeStep = true;
break;
}
parsedPredicate.setExtended();
tempSelOperands.add(parsedPredicate);
}
}
// Move to beyond the close bracket
start = posCloseBracket+1;
//Are there any more brackets?
posOpenBracket = selector.indexOf("[", start);
posCloseBracket = selector.indexOf("]", start);
// Have we found the last bracket in this location step?
if(posOpenBracket > stepEnd || posOpenBracket == -1)
{
// Set posOpenBracket to avoid further processing
posOpenBracket = -1;
}
} // eof while
if(foundPredicates)
{
// If we determined that we cannot parse this location step, then wrap it
if(wrapWholeStep)
wrapLocationStep(selector, stepStart,stepEnd);
else
{
// PostProcessing here
selOperands.addAll(tempSelOperands);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "parseLocationStep");
} } | public class class_name {
private void parseLocationStep(String selector,
int start,
int stepEnd)
throws InvalidXPathSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(cclass,
"parseLocationStep",
"selector: " + selector + ", start: " + start + ", end: " + stepEnd);
int stepStart = start;
int posOpenBracket = selector.indexOf("[", start);
if(posOpenBracket > stepEnd || posOpenBracket == -1)
{
// Set posOpenBracket to avoid further processing
posOpenBracket = -1;
// No brackets so process whole of the location step
String step = selector.substring(start,stepEnd);
// Set the full name into the identifier. The full name is used in position assignment when
// determining uniqueness of names. Only a full name will do.
String full = selector.substring(0,stepEnd);
// Add an IdentifierImpl for the location step to the array list
selOperands.add(createIdentifierForSubExpression(step, full, true, false));
}
int posCloseBracket = selector.indexOf("]", start);
boolean wrapWholeStep = false;
boolean foundPredicates = false;
ArrayList tempSelOperands = new ArrayList();
while (posOpenBracket >= 0)
{
foundPredicates = true;
if(posCloseBracket < posOpenBracket)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "parseLocationStep", "bracket error");
InvalidXPathSyntaxException iex = new InvalidXPathSyntaxException(selector);
FFDC.processException(cclass,
"com.ibm.ws.sib.matchspace.selector.impl.XPath10ParserImpl",
iex,
"1:372:1.16"); // depends on control dependency: [if], data = [none]
throw iex;
}
else
{
// The full selector path up to this point
String full = selector.substring(0,posOpenBracket);
// Factor out the location step first but be careful we may have a predicate
if(start != posOpenBracket)
{
// Go ahead and deal with the location step
String step = selector.substring(start,posOpenBracket);
// Add an IdentifierImpl for the location step to the array list
tempSelOperands.add(createIdentifierForSubExpression(step, full, true, false)); // depends on control dependency: [if], data = [none]
}
// Now parse the predicate
String predicate = selector.substring(posOpenBracket + 1,posCloseBracket);
Selector parsedPredicate = parsePredicate(predicate, full);
// Check whether we were able to parse
if(parsedPredicate == null)
{
// Unable to parse the expression, so we need to wrap the entire step
// tempSelOperands.add(createIdentifierForSubExpression(predicate, false));
wrapWholeStep = true; // depends on control dependency: [if], data = [none]
break;
}
else
{
// we were able to parse the expression with the MatchParser
// Check that the predicate has Simple tests only
if(!Matching.isSimple(parsedPredicate))
{
wrapWholeStep = true; // depends on control dependency: [if], data = [none]
break;
}
parsedPredicate.setExtended(); // depends on control dependency: [if], data = [none]
tempSelOperands.add(parsedPredicate); // depends on control dependency: [if], data = [(parsedPredicate]
}
}
// Move to beyond the close bracket
start = posCloseBracket+1;
//Are there any more brackets?
posOpenBracket = selector.indexOf("[", start);
posCloseBracket = selector.indexOf("]", start);
// Have we found the last bracket in this location step?
if(posOpenBracket > stepEnd || posOpenBracket == -1)
{
// Set posOpenBracket to avoid further processing
posOpenBracket = -1; // depends on control dependency: [if], data = [none]
}
} // eof while
if(foundPredicates)
{
// If we determined that we cannot parse this location step, then wrap it
if(wrapWholeStep)
wrapLocationStep(selector, stepStart,stepEnd);
else
{
// PostProcessing here
selOperands.addAll(tempSelOperands); // depends on control dependency: [if], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "parseLocationStep");
} } |
public class class_name {
public Map<URI, URI> getChangeTable() {
for (final Map.Entry<URI, URI> e : changeTable.entrySet()) {
assert e.getKey().isAbsolute();
assert e.getValue().isAbsolute();
}
return Collections.unmodifiableMap(changeTable);
} } | public class class_name {
public Map<URI, URI> getChangeTable() {
for (final Map.Entry<URI, URI> e : changeTable.entrySet()) {
assert e.getKey().isAbsolute();
assert e.getValue().isAbsolute(); // depends on control dependency: [for], data = [e]
}
return Collections.unmodifiableMap(changeTable);
} } |
public class class_name {
protected void fireRemove(CmsPublishJobFinished publishJob) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_REMOVE_0));
}
for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
I_CmsPublishEventListener listener = it.next();
try {
listener.onRemove(publishJob);
} catch (Throwable t) {
// catch every thing including runtime exceptions
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_PUBLISH_JOB_REMOVE_ERROR_1,
listener.getClass().getName()),
t);
}
if (publishJob.m_publishJob.getPublishReport() != null) {
publishJob.m_publishJob.getPublishReport().println(t);
}
}
}
} } | public class class_name {
protected void fireRemove(CmsPublishJobFinished publishJob) {
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_REMOVE_0)); // depends on control dependency: [if], data = [none]
}
for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
I_CmsPublishEventListener listener = it.next();
try {
listener.onRemove(publishJob); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// catch every thing including runtime exceptions
if (LOG.isErrorEnabled()) {
LOG.error(
Messages.get().getBundle().key(
Messages.ERR_PUBLISH_JOB_REMOVE_ERROR_1,
listener.getClass().getName()),
t); // depends on control dependency: [if], data = [none]
}
if (publishJob.m_publishJob.getPublishReport() != null) {
publishJob.m_publishJob.getPublishReport().println(t); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public List<AttributeBundle> getAttributeBundles() {
if (attributeBundles != null) {
return attributeBundles;
}
Map<String, AttributeBundle> bundlesMap = newHashMap();
for (Attribute attribute : getAttributes().getList()) {
if (attribute.columnNameHasLanguageSuffix()) {
String base = attribute.getColumnNameWithoutLanguage();
AttributeBundle bundle = bundlesMap.get(base);
if (bundle == null) {
bundle = new AttributeBundle(attribute); // add first attribute
bundlesMap.put(base, bundle);
} else {
bundle.addAttribute(attribute);
}
}
}
// keep bundles with more than 1 attribute
attributeBundles = newArrayList();
for (AttributeBundle bundle : bundlesMap.values()) {
if (bundle.getAttributes().size() > 1) {
attributeBundles.add(bundle);
log.info("Found columns satisfying localization pattern: " + bundle.toString());
}
}
return attributeBundles;
} } | public class class_name {
public List<AttributeBundle> getAttributeBundles() {
if (attributeBundles != null) {
return attributeBundles; // depends on control dependency: [if], data = [none]
}
Map<String, AttributeBundle> bundlesMap = newHashMap();
for (Attribute attribute : getAttributes().getList()) {
if (attribute.columnNameHasLanguageSuffix()) {
String base = attribute.getColumnNameWithoutLanguage();
AttributeBundle bundle = bundlesMap.get(base);
if (bundle == null) {
bundle = new AttributeBundle(attribute); // add first attribute // depends on control dependency: [if], data = [none]
bundlesMap.put(base, bundle); // depends on control dependency: [if], data = [none]
} else {
bundle.addAttribute(attribute); // depends on control dependency: [if], data = [none]
}
}
}
// keep bundles with more than 1 attribute
attributeBundles = newArrayList();
for (AttributeBundle bundle : bundlesMap.values()) {
if (bundle.getAttributes().size() > 1) {
attributeBundles.add(bundle); // depends on control dependency: [if], data = [none]
log.info("Found columns satisfying localization pattern: " + bundle.toString()); // depends on control dependency: [if], data = [none]
}
}
return attributeBundles;
} } |
public class class_name {
private boolean isWorkMethodSynchronized(Class<? extends Work> workClass, String methodName)
{
try
{
Method method = SecurityActions.getMethod(workClass, methodName, new Class[0]);
if (Modifier.isSynchronized(method.getModifiers()))
return true;
}
catch (NoSuchMethodException e)
{
//Never happens, Work implementation should have these methods
}
return false;
} } | public class class_name {
private boolean isWorkMethodSynchronized(Class<? extends Work> workClass, String methodName)
{
try
{
Method method = SecurityActions.getMethod(workClass, methodName, new Class[0]);
if (Modifier.isSynchronized(method.getModifiers()))
return true;
}
catch (NoSuchMethodException e)
{
//Never happens, Work implementation should have these methods
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
protected byte[] getData()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getData", this);
byte[] data = _data;
if (data != null)
{
// There is data cached in memory. Simply use this directly.
if (tc.isDebugEnabled()) Tr.debug(tc, "Cached data located");
}
else
{
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
// There is no data cached in memory - it must be retrieved from disk.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located. Attempting data retreival");
// If there is no data cached in memory and we are operating in file
// backed mode then retireve the data from disk.
if (_filePosition != UNWRITTEN)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieving " + _dataSize + " bytes of data @ position " + _filePosition);
_logRecord.position(_filePosition);
data = new byte[_dataSize];
_logRecord.get(data);
}
else
{
// The data should have been stored on disk but the file position was not set. Return null
// to the caller and allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "Unable to retrieve data as file position is not set");
}
}
else
{
// The data should have been cached in memory but was not found Return null to the caller and
// allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located");
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getData", new Object[]{new Integer(data.length),RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES)});
return data;
} } | public class class_name {
protected byte[] getData()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "getData", this);
byte[] data = _data;
if (data != null)
{
// There is data cached in memory. Simply use this directly.
if (tc.isDebugEnabled()) Tr.debug(tc, "Cached data located");
}
else
{
if (_storageMode == MultiScopeRecoveryLog.FILE_BACKED)
{
// There is no data cached in memory - it must be retrieved from disk.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located. Attempting data retreival");
// If there is no data cached in memory and we are operating in file
// backed mode then retireve the data from disk.
if (_filePosition != UNWRITTEN)
{
if (tc.isDebugEnabled()) Tr.debug(tc, "Retrieving " + _dataSize + " bytes of data @ position " + _filePosition);
_logRecord.position(_filePosition); // depends on control dependency: [if], data = [(_filePosition]
data = new byte[_dataSize]; // depends on control dependency: [if], data = [none]
_logRecord.get(data); // depends on control dependency: [if], data = [none]
}
else
{
// The data should have been stored on disk but the file position was not set. Return null
// to the caller and allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "Unable to retrieve data as file position is not set");
}
}
else
{
// The data should have been cached in memory but was not found Return null to the caller and
// allow them to handle this failure.
if (tc.isDebugEnabled()) Tr.debug(tc, "No cached data located");
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "getData", new Object[]{new Integer(data.length),RLSUtils.toHexString(data,RLSUtils.MAX_DISPLAY_BYTES)});
return data;
} } |
public class class_name {
List<String> generateImports(Set<String> importedTypes) {
List<String> importDecls = new ArrayList<>();
for (String it : importedTypes) {
importDecls.add(StubKind.IMPORT.format(it));
}
return importDecls;
} } | public class class_name {
List<String> generateImports(Set<String> importedTypes) {
List<String> importDecls = new ArrayList<>();
for (String it : importedTypes) {
importDecls.add(StubKind.IMPORT.format(it)); // depends on control dependency: [for], data = [it]
}
return importDecls;
} } |
public class class_name {
<T> T getValue( Object object, String name )
{
T result = getPropertyImpl( object, name );
if( result instanceof Property )
{
@SuppressWarnings( "unchecked" )
Property<T> property = ((Property<T>) result);
return property.getValue();
}
return result;
} } | public class class_name {
<T> T getValue( Object object, String name )
{
T result = getPropertyImpl( object, name );
if( result instanceof Property )
{
@SuppressWarnings( "unchecked" )
Property<T> property = ((Property<T>) result);
return property.getValue(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Override
public void start() {
super.start();
if (hasOption(SHORT_OPT_IN_PATH)) {
processInputDirectories();
} else if (hasOption(INFILE_SHORT_OPT)) {
processFiles();
} else {
error(NO_XBEL_INPUT);
failUsage();
}
} } | public class class_name {
@Override
public void start() {
super.start();
if (hasOption(SHORT_OPT_IN_PATH)) {
processInputDirectories(); // depends on control dependency: [if], data = [none]
} else if (hasOption(INFILE_SHORT_OPT)) {
processFiles(); // depends on control dependency: [if], data = [none]
} else {
error(NO_XBEL_INPUT); // depends on control dependency: [if], data = [none]
failUsage(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public EEnum getMDDYmBase() {
if (mddYmBaseEEnum == null) {
mddYmBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(45);
}
return mddYmBaseEEnum;
} } | public class class_name {
public EEnum getMDDYmBase() {
if (mddYmBaseEEnum == null) {
mddYmBaseEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(45); // depends on control dependency: [if], data = [none]
}
return mddYmBaseEEnum;
} } |
public class class_name {
protected V createEntry(final K key, KK cacheKey, Object v) {
FutureTask<V> task;
boolean creator = false;
if (v != null) {
// Another thread is already loading an instance
task = (FutureTask<V>) v;
} else {
task = new FutureTask<V>(new Callable<V>() {
public V call() throws Exception {
return loader.apply(key);
}
});
Object prevTask = map.putIfAbsent(cacheKey, task);
if (prevTask == null) {
// creator does the load
creator = true;
task.run();
} else if (prevTask instanceof FutureTask) {
task = (FutureTask<V>) prevTask;
} else {
return (V) prevTask;
}
}
V result;
try {
result = task.get();
} catch (InterruptedException e) {
throw new IllegalStateException("Interrupted while loading cache item", e);
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw ((RuntimeException) cause);
}
throw new IllegalStateException("Unable to load cache item", cause);
}
if (creator) {
map.put(cacheKey, result);
}
return result;
} } | public class class_name {
protected V createEntry(final K key, KK cacheKey, Object v) {
FutureTask<V> task;
boolean creator = false;
if (v != null) {
// Another thread is already loading an instance
task = (FutureTask<V>) v; // depends on control dependency: [if], data = [none]
} else {
task = new FutureTask<V>(new Callable<V>() {
public V call() throws Exception {
return loader.apply(key);
}
}); // depends on control dependency: [if], data = [none]
Object prevTask = map.putIfAbsent(cacheKey, task);
if (prevTask == null) {
// creator does the load
creator = true; // depends on control dependency: [if], data = [none]
task.run(); // depends on control dependency: [if], data = [none]
} else if (prevTask instanceof FutureTask) {
task = (FutureTask<V>) prevTask; // depends on control dependency: [if], data = [none]
} else {
return (V) prevTask; // depends on control dependency: [if], data = [none]
}
}
V result;
try {
result = task.get(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new IllegalStateException("Interrupted while loading cache item", e);
} catch (ExecutionException e) { // depends on control dependency: [catch], data = [none]
Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw ((RuntimeException) cause);
}
throw new IllegalStateException("Unable to load cache item", cause);
} // depends on control dependency: [catch], data = [none]
if (creator) {
map.put(cacheKey, result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public Observable<ServiceResponse<VpnClientIPsecParametersInner>> beginSetVpnclientIpsecParametersWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkGatewayName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (vpnclientIpsecParams == null) {
throw new IllegalArgumentException("Parameter vpnclientIpsecParams is required and cannot be null.");
}
Validator.validate(vpnclientIpsecParams);
final String apiVersion = "2018-08-01";
return service.beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), vpnclientIpsecParams, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VpnClientIPsecParametersInner>>>() {
@Override
public Observable<ServiceResponse<VpnClientIPsecParametersInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<VpnClientIPsecParametersInner> clientResponse = beginSetVpnclientIpsecParametersDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<VpnClientIPsecParametersInner>> beginSetVpnclientIpsecParametersWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkGatewayName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (vpnclientIpsecParams == null) {
throw new IllegalArgumentException("Parameter vpnclientIpsecParams is required and cannot be null.");
}
Validator.validate(vpnclientIpsecParams);
final String apiVersion = "2018-08-01";
return service.beginSetVpnclientIpsecParameters(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), vpnclientIpsecParams, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VpnClientIPsecParametersInner>>>() {
@Override
public Observable<ServiceResponse<VpnClientIPsecParametersInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<VpnClientIPsecParametersInner> clientResponse = beginSetVpnclientIpsecParametersDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private void initTopicTree(HelpTopicNode htnParent, List<?> children) {
if (children != null) {
for (Object node : children) {
TopicTreeNode ttnChild = (TopicTreeNode) node;
Topic topic = ttnChild.getTopic();
Target target = topic.getTarget();
String source = view.getBook().getBookTitle();
URL url = null;
try {
url = target == null ? null : target.getURL();
} catch (MalformedURLException e) {}
HelpTopic ht = new HelpTopic(url, topic.getLabel(), source);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild);
initTopicTree(htnChild, ttnChild);
}
}
} } | public class class_name {
private void initTopicTree(HelpTopicNode htnParent, List<?> children) {
if (children != null) {
for (Object node : children) {
TopicTreeNode ttnChild = (TopicTreeNode) node;
Topic topic = ttnChild.getTopic();
Target target = topic.getTarget();
String source = view.getBook().getBookTitle();
URL url = null;
try {
url = target == null ? null : target.getURL(); // depends on control dependency: [try], data = [none]
} catch (MalformedURLException e) {} // depends on control dependency: [catch], data = [none]
HelpTopic ht = new HelpTopic(url, topic.getLabel(), source);
HelpTopicNode htnChild = new HelpTopicNode(ht);
htnParent.addChild(htnChild); // depends on control dependency: [for], data = [none]
initTopicTree(htnChild, ttnChild); // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private CFile parseCFile( JSONObject jObj )
{
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) );
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) );
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified );
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
}
}
return cfile;
} } | public class class_name {
private CFile parseCFile( JSONObject jObj )
{
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) ); // depends on control dependency: [if], data = [none]
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) ); // depends on control dependency: [if], data = [none]
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified ); // depends on control dependency: [try], data = [none]
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
} // depends on control dependency: [catch], data = [none]
}
return cfile;
} } |
public class class_name {
public float[] calculate(float pSample[])
{
final int wAps = pSample.length / ss;
int n2 = ss2;
// int nu1 = nu - 1;
int a = 0;
for (int b=0; a<pSample.length; b++)
{
xre[b] = (long)(pSample[a]*FRAC_FAC);
xim[b] = 0;
a += wAps;
}
int x = 0;
for (int l=1; l<=nu; l++)
{
for (int k=0; k<ss; k+=n2)
{
for (int i=1; i<=n2; i++)
{
final long c = fftCos[x];
final long s = fftSin[x];
final int kn2 = k + n2;
final long tr = (xre[kn2]*c + xim[kn2]*s)>>FRAC_BITS;
final long ti = (xim[kn2]*c - xre[kn2]*s)>>FRAC_BITS;
xre[kn2] = xre[k] - tr;
xim[kn2] = xim[k] - ti;
xre[k] += tr;
xim[k] += ti;
k++;
x++;
}
}
// nu1--;
n2 >>= 1;
}
for (int k=0; k<ss; k++)
{
final int r = fftBr[k];
if (r > k)
{
final long tr = xre[k];
final long ti = xim[k];
xre[k] = xre[r];
xim[k] = xim[r];
xre[r] = tr;
xim[r] = ti;
}
}
mag[0] = ((float)((longSqrt(xre[0]*xre[0] + xim[0]*xim[0]))>>FRAC_BITS)) / ((float)ss);
for (int i=1; i<ss2; i++)
mag[i] = ((float)((longSqrt(xre[i]*xre[i] + xim[i]*xim[i])<<1)>>FRAC_BITS)) / ((float)ss);
return mag;
} } | public class class_name {
public float[] calculate(float pSample[])
{
final int wAps = pSample.length / ss;
int n2 = ss2;
// int nu1 = nu - 1;
int a = 0;
for (int b=0; a<pSample.length; b++)
{
xre[b] = (long)(pSample[a]*FRAC_FAC); // depends on control dependency: [for], data = [b]
xim[b] = 0; // depends on control dependency: [for], data = [b]
a += wAps; // depends on control dependency: [for], data = [none]
}
int x = 0;
for (int l=1; l<=nu; l++)
{
for (int k=0; k<ss; k+=n2)
{
for (int i=1; i<=n2; i++)
{
final long c = fftCos[x];
final long s = fftSin[x];
final int kn2 = k + n2;
final long tr = (xre[kn2]*c + xim[kn2]*s)>>FRAC_BITS;
final long ti = (xim[kn2]*c - xre[kn2]*s)>>FRAC_BITS;
xre[kn2] = xre[k] - tr; // depends on control dependency: [for], data = [none]
xim[kn2] = xim[k] - ti; // depends on control dependency: [for], data = [none]
xre[k] += tr; // depends on control dependency: [for], data = [none]
xim[k] += ti; // depends on control dependency: [for], data = [none]
k++; // depends on control dependency: [for], data = [none]
x++; // depends on control dependency: [for], data = [none]
}
}
// nu1--;
n2 >>= 1; // depends on control dependency: [for], data = [none]
}
for (int k=0; k<ss; k++)
{
final int r = fftBr[k];
if (r > k)
{
final long tr = xre[k];
final long ti = xim[k];
xre[k] = xre[r]; // depends on control dependency: [if], data = [none]
xim[k] = xim[r]; // depends on control dependency: [if], data = [none]
xre[r] = tr; // depends on control dependency: [if], data = [none]
xim[r] = ti; // depends on control dependency: [if], data = [none]
}
}
mag[0] = ((float)((longSqrt(xre[0]*xre[0] + xim[0]*xim[0]))>>FRAC_BITS)) / ((float)ss);
for (int i=1; i<ss2; i++)
mag[i] = ((float)((longSqrt(xre[i]*xre[i] + xim[i]*xim[i])<<1)>>FRAC_BITS)) / ((float)ss);
return mag;
} } |
public class class_name {
protected Properties collectProperties(
CmsObject cms,
CmsResource resource,
CmsRelation relation,
Set<String> orgfilter,
ObjectInfoImpl objectInfo) {
CmsCmisTypeManager tm = m_repository.getTypeManager();
if (resource == null) {
throw new IllegalArgumentException("Resource may not be null.");
}
// copy filter
Set<String> filter = (orgfilter == null ? null : new LinkedHashSet<String>(orgfilter));
// find base type
String typeId = "opencms:" + relation.getType().getName();
objectInfo.setBaseType(BaseTypeId.CMIS_RELATIONSHIP);
objectInfo.setTypeId(typeId);
objectInfo.setContentType(null);
objectInfo.setFileName(null);
objectInfo.setHasAcl(false);
objectInfo.setHasContent(false);
objectInfo.setVersionSeriesId(null);
objectInfo.setIsCurrentVersion(true);
objectInfo.setRelationshipSourceIds(null);
objectInfo.setRelationshipTargetIds(null);
objectInfo.setRenditionInfos(null);
objectInfo.setSupportsDescendants(false);
objectInfo.setSupportsFolderTree(false);
objectInfo.setSupportsPolicies(false);
objectInfo.setSupportsRelationships(false);
objectInfo.setWorkingCopyId(null);
objectInfo.setWorkingCopyOriginalId(null);
// let's do it
try {
PropertiesImpl result = new PropertiesImpl();
// id
String id = createKey(relation);
addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_ID, id);
objectInfo.setId(id);
// name
String name = createReadableName(relation);
addPropertyString(tm, result, typeId, filter, PropertyIds.NAME, name);
objectInfo.setName(name);
// created and modified by
CmsUUID creatorId = resource.getUserCreated();
CmsUUID modifierId = resource.getUserLastModified();
String creatorName = creatorId.toString();
String modifierName = modifierId.toString();
try {
CmsUser user = cms.readUser(creatorId);
creatorName = user.getName();
} catch (CmsException e) {
// ignore, use id as name
}
try {
CmsUser user = cms.readUser(modifierId);
modifierName = user.getName();
} catch (CmsException e) {
// ignore, use id as name
}
addPropertyString(tm, result, typeId, filter, PropertyIds.CREATED_BY, creatorName);
addPropertyString(tm, result, typeId, filter, PropertyIds.LAST_MODIFIED_BY, modifierName);
objectInfo.setCreatedBy(creatorName);
addPropertyId(tm, result, typeId, filter, PropertyIds.SOURCE_ID, relation.getSourceId().toString());
addPropertyId(tm, result, typeId, filter, PropertyIds.TARGET_ID, relation.getTargetId().toString());
// creation and modification date
GregorianCalendar lastModified = millisToCalendar(resource.getDateLastModified());
GregorianCalendar created = millisToCalendar(resource.getDateCreated());
addPropertyDateTime(tm, result, typeId, filter, PropertyIds.CREATION_DATE, created);
addPropertyDateTime(tm, result, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified);
objectInfo.setCreationDate(created);
objectInfo.setLastModificationDate(lastModified);
// change token - always null
addPropertyString(tm, result, typeId, filter, PropertyIds.CHANGE_TOKEN, null);
// base type and type name
addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_RELATIONSHIP.value());
addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, typeId);
objectInfo.setHasParent(false);
return result;
} catch (Exception e) {
if (e instanceof CmisBaseException) {
throw (CmisBaseException)e;
}
throw new CmisRuntimeException(e.getMessage(), e);
}
} } | public class class_name {
protected Properties collectProperties(
CmsObject cms,
CmsResource resource,
CmsRelation relation,
Set<String> orgfilter,
ObjectInfoImpl objectInfo) {
CmsCmisTypeManager tm = m_repository.getTypeManager();
if (resource == null) {
throw new IllegalArgumentException("Resource may not be null.");
}
// copy filter
Set<String> filter = (orgfilter == null ? null : new LinkedHashSet<String>(orgfilter));
// find base type
String typeId = "opencms:" + relation.getType().getName();
objectInfo.setBaseType(BaseTypeId.CMIS_RELATIONSHIP);
objectInfo.setTypeId(typeId);
objectInfo.setContentType(null);
objectInfo.setFileName(null);
objectInfo.setHasAcl(false);
objectInfo.setHasContent(false);
objectInfo.setVersionSeriesId(null);
objectInfo.setIsCurrentVersion(true);
objectInfo.setRelationshipSourceIds(null);
objectInfo.setRelationshipTargetIds(null);
objectInfo.setRenditionInfos(null);
objectInfo.setSupportsDescendants(false);
objectInfo.setSupportsFolderTree(false);
objectInfo.setSupportsPolicies(false);
objectInfo.setSupportsRelationships(false);
objectInfo.setWorkingCopyId(null);
objectInfo.setWorkingCopyOriginalId(null);
// let's do it
try {
PropertiesImpl result = new PropertiesImpl();
// id
String id = createKey(relation);
addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_ID, id);
// depends on control dependency: [try], data = [none]
objectInfo.setId(id);
// depends on control dependency: [try], data = [none]
// name
String name = createReadableName(relation);
addPropertyString(tm, result, typeId, filter, PropertyIds.NAME, name);
// depends on control dependency: [try], data = [none]
objectInfo.setName(name);
// depends on control dependency: [try], data = [none]
// created and modified by
CmsUUID creatorId = resource.getUserCreated();
CmsUUID modifierId = resource.getUserLastModified();
String creatorName = creatorId.toString();
String modifierName = modifierId.toString();
try {
CmsUser user = cms.readUser(creatorId);
creatorName = user.getName();
// depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// ignore, use id as name
}
// depends on control dependency: [catch], data = [none]
try {
CmsUser user = cms.readUser(modifierId);
modifierName = user.getName();
// depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// ignore, use id as name
}
// depends on control dependency: [catch], data = [none]
addPropertyString(tm, result, typeId, filter, PropertyIds.CREATED_BY, creatorName);
// depends on control dependency: [try], data = [none]
addPropertyString(tm, result, typeId, filter, PropertyIds.LAST_MODIFIED_BY, modifierName);
// depends on control dependency: [try], data = [none]
objectInfo.setCreatedBy(creatorName);
// depends on control dependency: [try], data = [none]
addPropertyId(tm, result, typeId, filter, PropertyIds.SOURCE_ID, relation.getSourceId().toString());
// depends on control dependency: [try], data = [none]
addPropertyId(tm, result, typeId, filter, PropertyIds.TARGET_ID, relation.getTargetId().toString());
// depends on control dependency: [try], data = [none]
// creation and modification date
GregorianCalendar lastModified = millisToCalendar(resource.getDateLastModified());
GregorianCalendar created = millisToCalendar(resource.getDateCreated());
addPropertyDateTime(tm, result, typeId, filter, PropertyIds.CREATION_DATE, created);
// depends on control dependency: [try], data = [none]
addPropertyDateTime(tm, result, typeId, filter, PropertyIds.LAST_MODIFICATION_DATE, lastModified);
// depends on control dependency: [try], data = [none]
objectInfo.setCreationDate(created);
// depends on control dependency: [try], data = [none]
objectInfo.setLastModificationDate(lastModified);
// depends on control dependency: [try], data = [none]
// change token - always null
addPropertyString(tm, result, typeId, filter, PropertyIds.CHANGE_TOKEN, null);
// depends on control dependency: [try], data = [none]
// base type and type name
addPropertyId(tm, result, typeId, filter, PropertyIds.BASE_TYPE_ID, BaseTypeId.CMIS_RELATIONSHIP.value());
// depends on control dependency: [try], data = [none]
addPropertyId(tm, result, typeId, filter, PropertyIds.OBJECT_TYPE_ID, typeId);
// depends on control dependency: [try], data = [none]
objectInfo.setHasParent(false);
// depends on control dependency: [try], data = [none]
return result;
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (e instanceof CmisBaseException) {
throw (CmisBaseException)e;
}
throw new CmisRuntimeException(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Observable<ServiceResponse<BuildGetLogResultInner>> getLogLinkWithServiceResponseAsync(String resourceGroupName, String registryName, String buildId) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (buildId == null) {
throw new IllegalArgumentException("Parameter buildId is required and cannot be null.");
}
final String apiVersion = "2018-02-01-preview";
return service.getLogLink(this.client.subscriptionId(), resourceGroupName, registryName, buildId, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BuildGetLogResultInner>>>() {
@Override
public Observable<ServiceResponse<BuildGetLogResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<BuildGetLogResultInner> clientResponse = getLogLinkDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<BuildGetLogResultInner>> getLogLinkWithServiceResponseAsync(String resourceGroupName, String registryName, String buildId) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (registryName == null) {
throw new IllegalArgumentException("Parameter registryName is required and cannot be null.");
}
if (buildId == null) {
throw new IllegalArgumentException("Parameter buildId is required and cannot be null.");
}
final String apiVersion = "2018-02-01-preview";
return service.getLogLink(this.client.subscriptionId(), resourceGroupName, registryName, buildId, apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BuildGetLogResultInner>>>() {
@Override
public Observable<ServiceResponse<BuildGetLogResultInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<BuildGetLogResultInner> clientResponse = getLogLinkDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
private static Object getAssociationRows(Association association, AssociationKey key, AssociationContext associationContext) {
boolean organizeByRowKey = DotPatternMapHelpers.organizeAssociationMapByRowKey( association, key, associationContext );
// transform map entries such as ( addressType='home', address_id=123) into the more
// natural ( { 'home'=123 }
if ( organizeByRowKey ) {
String rowKeyColumn = organizeByRowKey ? key.getMetadata().getRowKeyIndexColumnNames()[0] : null;
Document rows = new Document();
for ( RowKey rowKey : association.getKeys() ) {
Document row = (Document) getAssociationRow( association.get( rowKey ), key );
String rowKeyValue = (String) row.remove( rowKeyColumn );
// if there is a single column on the value side left, unwrap it
if ( row.keySet().size() == 1 ) {
rows.put( rowKeyValue, DocumentUtil.toMap( row ).values().iterator().next() );
}
else {
rows.put( rowKeyValue, row );
}
}
return rows;
}
// non-map rows can be taken as is
else {
List<Object> rows = new ArrayList<>();
for ( RowKey rowKey : association.getKeys() ) {
rows.add( getAssociationRow( association.get( rowKey ), key ) );
}
return rows;
}
} } | public class class_name {
private static Object getAssociationRows(Association association, AssociationKey key, AssociationContext associationContext) {
boolean organizeByRowKey = DotPatternMapHelpers.organizeAssociationMapByRowKey( association, key, associationContext );
// transform map entries such as ( addressType='home', address_id=123) into the more
// natural ( { 'home'=123 }
if ( organizeByRowKey ) {
String rowKeyColumn = organizeByRowKey ? key.getMetadata().getRowKeyIndexColumnNames()[0] : null;
Document rows = new Document();
for ( RowKey rowKey : association.getKeys() ) {
Document row = (Document) getAssociationRow( association.get( rowKey ), key );
String rowKeyValue = (String) row.remove( rowKeyColumn );
// if there is a single column on the value side left, unwrap it
if ( row.keySet().size() == 1 ) {
rows.put( rowKeyValue, DocumentUtil.toMap( row ).values().iterator().next() ); // depends on control dependency: [if], data = [none]
}
else {
rows.put( rowKeyValue, row ); // depends on control dependency: [if], data = [none]
}
}
return rows; // depends on control dependency: [if], data = [none]
}
// non-map rows can be taken as is
else {
List<Object> rows = new ArrayList<>();
for ( RowKey rowKey : association.getKeys() ) {
rows.add( getAssociationRow( association.get( rowKey ), key ) ); // depends on control dependency: [for], data = [rowKey]
}
return rows; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void deleteEntryFiles(List<Entry<V>> list) throws IOException {
for(Entry<V> e: list) {
File file = e.getFile();
if(file != null && file.exists()) {
if (file.delete()) {
_log.info(file.getName() + " deleted");
} else {
_log.warn(file.getName() + " not deleted");
}
}
}
} } | public class class_name {
private void deleteEntryFiles(List<Entry<V>> list) throws IOException {
for(Entry<V> e: list) {
File file = e.getFile();
if(file != null && file.exists()) {
if (file.delete()) {
_log.info(file.getName() + " deleted"); // depends on control dependency: [if], data = [none]
} else {
_log.warn(file.getName() + " not deleted"); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public <T> T execute(final Object[] args, final Class<T> clazz, final boolean failOnError) {
if (this.groovyScript != null) {
return ScriptingUtils.executeGroovyScript(this.groovyScript, args, clazz, failOnError);
}
return null;
} } | public class class_name {
public <T> T execute(final Object[] args, final Class<T> clazz, final boolean failOnError) {
if (this.groovyScript != null) {
return ScriptingUtils.executeGroovyScript(this.groovyScript, args, clazz, failOnError); // depends on control dependency: [if], data = [(this.groovyScript]
}
return null;
} } |
public class class_name {
public void setScaleUpModifications(java.util.Collection<String> scaleUpModifications) {
if (scaleUpModifications == null) {
this.scaleUpModifications = null;
return;
}
this.scaleUpModifications = new com.amazonaws.internal.SdkInternalList<String>(scaleUpModifications);
} } | public class class_name {
public void setScaleUpModifications(java.util.Collection<String> scaleUpModifications) {
if (scaleUpModifications == null) {
this.scaleUpModifications = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.scaleUpModifications = new com.amazonaws.internal.SdkInternalList<String>(scaleUpModifications);
} } |
public class class_name {
public static Map<String, Object> findFreeMarkerContextVariables(Variables variables, String... varNames)
{
Map<String, Object> results = new HashMap<>();
for (String varName : varNames)
{
WindupVertexFrame payload = null;
try
{
payload = Iteration.getCurrentPayload(variables, null, varName);
}
catch (IllegalStateException | IllegalArgumentException e)
{
// oh well
}
if (payload != null)
{
results.put(varName, payload);
}
else
{
Iterable<? extends WindupVertexFrame> var = variables.findVariable(varName);
if (var != null)
{
results.put(varName, var);
}
}
}
return results;
} } | public class class_name {
public static Map<String, Object> findFreeMarkerContextVariables(Variables variables, String... varNames)
{
Map<String, Object> results = new HashMap<>();
for (String varName : varNames)
{
WindupVertexFrame payload = null;
try
{
payload = Iteration.getCurrentPayload(variables, null, varName); // depends on control dependency: [try], data = [none]
}
catch (IllegalStateException | IllegalArgumentException e)
{
// oh well
} // depends on control dependency: [catch], data = [none]
if (payload != null)
{
results.put(varName, payload); // depends on control dependency: [if], data = [none]
}
else
{
Iterable<? extends WindupVertexFrame> var = variables.findVariable(varName); // depends on control dependency: [if], data = [none]
if (var != null)
{
results.put(varName, var); // depends on control dependency: [if], data = [(var]
}
}
}
return results;
} } |
public class class_name {
@Nullable
public T selectTemplate(
String delTemplateName, String variant, Predicate<String> activeDelPackageSelector) {
Group<T> group = nameAndVariantToGroup.get(delTemplateName, variant);
if (group != null) {
T selection = group.select(activeDelPackageSelector);
if (selection != null) {
return selection;
}
}
if (!variant.isEmpty()) {
// Retry with an empty variant
group = nameAndVariantToGroup.get(delTemplateName, "");
if (group != null) {
return group.select(activeDelPackageSelector);
}
}
return null;
} } | public class class_name {
@Nullable
public T selectTemplate(
String delTemplateName, String variant, Predicate<String> activeDelPackageSelector) {
Group<T> group = nameAndVariantToGroup.get(delTemplateName, variant);
if (group != null) {
T selection = group.select(activeDelPackageSelector);
if (selection != null) {
return selection; // depends on control dependency: [if], data = [none]
}
}
if (!variant.isEmpty()) {
// Retry with an empty variant
group = nameAndVariantToGroup.get(delTemplateName, ""); // depends on control dependency: [if], data = [none]
if (group != null) {
return group.select(activeDelPackageSelector); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static final String convertPattern(String pattern) {
if (pattern == null) {
return null;
}
else {
String convertedPattern = pattern;
for (PatternConverter converter : PATTERN_CONVERTERS) {
convertedPattern = converter.convert(convertedPattern);
}
return convertedPattern;
}
} } | public class class_name {
public static final String convertPattern(String pattern) {
if (pattern == null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
String convertedPattern = pattern;
for (PatternConverter converter : PATTERN_CONVERTERS) {
convertedPattern = converter.convert(convertedPattern); // depends on control dependency: [for], data = [converter]
}
return convertedPattern; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static float sad(TupleDesc_F32 a, TupleDesc_F32 b) {
float total = 0;
for( int i = 0; i < a.value.length; i++ ) {
total += Math.abs( a.value[i] - b.value[i]);
}
return total;
} } | public class class_name {
public static float sad(TupleDesc_F32 a, TupleDesc_F32 b) {
float total = 0;
for( int i = 0; i < a.value.length; i++ ) {
total += Math.abs( a.value[i] - b.value[i]); // depends on control dependency: [for], data = [i]
}
return total;
} } |
public class class_name {
public Object convert(String rawString, Type type, Class<?> genericSubType) {
Object converted = null;
if (genericSubType == null && type instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) type;
Type[] aTypes = pType.getActualTypeArguments();
Type genericTypeArg = aTypes.length == 1 ? aTypes[0] : null; //initially only support one type arg
if (genericTypeArg instanceof Class) { //for the moment we only support a class ... so no type variables; e.g. List<String> is ok but List<T> is not
Class<?> genericClassArg = (Class<?>) genericTypeArg;
converted = convert(rawString, pType.getRawType(), genericClassArg);
} else {
throw new IllegalArgumentException(Tr.formatMessage(tc, "generic.type.variables.notsupported.CWMCG0018E", type, genericTypeArg));
}
} else {
//first box any primitives
if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>) type;
if (clazz.isPrimitive()) {
type = ClassUtils.primitiveToWrapper(clazz);
}
}
//do a simple lookup in the map of converters
ConversionStatus status = simpleConversion(rawString, type, genericSubType);
if (!status.isConverterFound() && type instanceof Class) {
Class<?> requestedClazz = (Class<?>) type;
//try array conversion
if (requestedClazz.isArray()) {
Class<?> arrayType = requestedClazz.getComponentType();
Class<?> conversionType = arrayType;
//first convert primitives to wrapper types
if (arrayType.isPrimitive()) {
conversionType = ClassUtils.primitiveToWrapper(arrayType);
}
//convert to an array of the wrapper type
Object[] wrappedArray = convertArray(rawString, conversionType);// convertArray will throw ConverterNotFoundException if it can't find a converter
//switch back to the primitive type if required
Object value = wrappedArray;
if (arrayType.isPrimitive()) {
value = toPrimitiveArray(wrappedArray, arrayType);
}
status.setConverted(value);
}
//try implicit converters (e.g. String Constructors)
if (!status.isConverterFound()) {
status = implicitConverters(rawString, requestedClazz);
}
//try to find any compatible converters
if (!status.isConverterFound()) {
status = convertCompatible(rawString, requestedClazz);
}
}
if (!status.isConverterFound()) {
throw new IllegalArgumentException(Tr.formatMessage(tc, "could.not.find.converter.CWMCG0014E", type.getTypeName()));
}
converted = status.getConverted();
}
return converted;
} } | public class class_name {
public Object convert(String rawString, Type type, Class<?> genericSubType) {
Object converted = null;
if (genericSubType == null && type instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType) type;
Type[] aTypes = pType.getActualTypeArguments();
Type genericTypeArg = aTypes.length == 1 ? aTypes[0] : null; //initially only support one type arg
if (genericTypeArg instanceof Class) { //for the moment we only support a class ... so no type variables; e.g. List<String> is ok but List<T> is not
Class<?> genericClassArg = (Class<?>) genericTypeArg;
converted = convert(rawString, pType.getRawType(), genericClassArg);
} else {
throw new IllegalArgumentException(Tr.formatMessage(tc, "generic.type.variables.notsupported.CWMCG0018E", type, genericTypeArg));
}
} else {
//first box any primitives
if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>) type;
if (clazz.isPrimitive()) {
type = ClassUtils.primitiveToWrapper(clazz);
}
}
//do a simple lookup in the map of converters
ConversionStatus status = simpleConversion(rawString, type, genericSubType);
if (!status.isConverterFound() && type instanceof Class) {
Class<?> requestedClazz = (Class<?>) type;
//try array conversion
if (requestedClazz.isArray()) {
Class<?> arrayType = requestedClazz.getComponentType();
Class<?> conversionType = arrayType;
//first convert primitives to wrapper types
if (arrayType.isPrimitive()) {
conversionType = ClassUtils.primitiveToWrapper(arrayType); // depends on control dependency: [if], data = [none]
}
//convert to an array of the wrapper type
Object[] wrappedArray = convertArray(rawString, conversionType);// convertArray will throw ConverterNotFoundException if it can't find a converter
//switch back to the primitive type if required
Object value = wrappedArray;
if (arrayType.isPrimitive()) {
value = toPrimitiveArray(wrappedArray, arrayType); // depends on control dependency: [if], data = [none]
}
status.setConverted(value); // depends on control dependency: [if], data = [none]
}
//try implicit converters (e.g. String Constructors)
if (!status.isConverterFound()) {
status = implicitConverters(rawString, requestedClazz); // depends on control dependency: [if], data = [none]
}
//try to find any compatible converters
if (!status.isConverterFound()) {
status = convertCompatible(rawString, requestedClazz); // depends on control dependency: [if], data = [none]
}
}
if (!status.isConverterFound()) {
throw new IllegalArgumentException(Tr.formatMessage(tc, "could.not.find.converter.CWMCG0014E", type.getTypeName()));
}
converted = status.getConverted(); // depends on control dependency: [if], data = [none]
}
return converted; // depends on control dependency: [if], data = [none]
} } |
public class class_name {
public void release()
{
IPhynixxManagedConnection<C> con= this.connection;
if (connection != null) {
this.connection.removeConnectionListener(this);
}
this.connection = null;
// return con;
} } | public class class_name {
public void release()
{
IPhynixxManagedConnection<C> con= this.connection;
if (connection != null) {
this.connection.removeConnectionListener(this); // depends on control dependency: [if], data = [none]
}
this.connection = null;
// return con;
} } |
public class class_name {
public static void addCookiesToResponse(List<Cookie> cookieList, HttpServletResponse resp) {
Iterator<Cookie> iterator = cookieList.listIterator();
while (iterator.hasNext()) {
Cookie cookie = iterator.next();
if (cookie != null) {
resp.addCookie(cookie);
}
}
} } | public class class_name {
public static void addCookiesToResponse(List<Cookie> cookieList, HttpServletResponse resp) {
Iterator<Cookie> iterator = cookieList.listIterator();
while (iterator.hasNext()) {
Cookie cookie = iterator.next();
if (cookie != null) {
resp.addCookie(cookie); // depends on control dependency: [if], data = [(cookie]
}
}
} } |
public class class_name {
public ListDocumentClassificationJobsResult withDocumentClassificationJobPropertiesList(
DocumentClassificationJobProperties... documentClassificationJobPropertiesList) {
if (this.documentClassificationJobPropertiesList == null) {
setDocumentClassificationJobPropertiesList(new java.util.ArrayList<DocumentClassificationJobProperties>(
documentClassificationJobPropertiesList.length));
}
for (DocumentClassificationJobProperties ele : documentClassificationJobPropertiesList) {
this.documentClassificationJobPropertiesList.add(ele);
}
return this;
} } | public class class_name {
public ListDocumentClassificationJobsResult withDocumentClassificationJobPropertiesList(
DocumentClassificationJobProperties... documentClassificationJobPropertiesList) {
if (this.documentClassificationJobPropertiesList == null) {
setDocumentClassificationJobPropertiesList(new java.util.ArrayList<DocumentClassificationJobProperties>(
documentClassificationJobPropertiesList.length)); // depends on control dependency: [if], data = [none]
}
for (DocumentClassificationJobProperties ele : documentClassificationJobPropertiesList) {
this.documentClassificationJobPropertiesList.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private ServiceContainer currentServiceContainer() {
if(WildFlySecurityManager.isChecking()) {
return AccessController.doPrivileged(CurrentServiceContainer.GET_ACTION);
}
return CurrentServiceContainer.getServiceContainer();
} } | public class class_name {
private ServiceContainer currentServiceContainer() {
if(WildFlySecurityManager.isChecking()) {
return AccessController.doPrivileged(CurrentServiceContainer.GET_ACTION); // depends on control dependency: [if], data = [none]
}
return CurrentServiceContainer.getServiceContainer();
} } |
public class class_name {
public static String getContextStringProperty(SensorContext context, String name, String def) {
String s = context.config().get(name).orElse(null);
if (s == null || s.isEmpty()) {
return def;
}
return s;
} } | public class class_name {
public static String getContextStringProperty(SensorContext context, String name, String def) {
String s = context.config().get(name).orElse(null);
if (s == null || s.isEmpty()) {
return def;
// depends on control dependency: [if], data = [none]
}
return s;
} } |
public class class_name {
public ISimpleChemObjectReader createReader(IChemFormat format) {
if (format != null) {
String readerClassName = format.getReaderClassName();
if (readerClassName != null) {
try {
// make a new instance of this class
return (ISimpleChemObjectReader) this.getClass().getClassLoader().loadClass(readerClassName)
.newInstance();
} catch (ClassNotFoundException exception) {
logger.error("Could not find this ChemObjectReader: ", readerClassName);
logger.debug(exception);
} catch (InstantiationException | IllegalAccessException exception) {
logger.error("Could not create this ChemObjectReader: ", readerClassName);
logger.debug(exception);
}
} else {
logger.warn("ChemFormat is recognized, but no reader is available.");
}
} else {
logger.warn("ChemFormat is not recognized.");
}
return null;
} } | public class class_name {
public ISimpleChemObjectReader createReader(IChemFormat format) {
if (format != null) {
String readerClassName = format.getReaderClassName();
if (readerClassName != null) {
try {
// make a new instance of this class
return (ISimpleChemObjectReader) this.getClass().getClassLoader().loadClass(readerClassName)
.newInstance(); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException exception) {
logger.error("Could not find this ChemObjectReader: ", readerClassName);
logger.debug(exception);
} catch (InstantiationException | IllegalAccessException exception) { // depends on control dependency: [catch], data = [none]
logger.error("Could not create this ChemObjectReader: ", readerClassName);
logger.debug(exception);
} // depends on control dependency: [catch], data = [none]
} else {
logger.warn("ChemFormat is recognized, but no reader is available."); // depends on control dependency: [if], data = [none]
}
} else {
logger.warn("ChemFormat is not recognized."); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public ActionDeclaration withOutputArtifacts(OutputArtifact... outputArtifacts) {
if (this.outputArtifacts == null) {
setOutputArtifacts(new java.util.ArrayList<OutputArtifact>(outputArtifacts.length));
}
for (OutputArtifact ele : outputArtifacts) {
this.outputArtifacts.add(ele);
}
return this;
} } | public class class_name {
public ActionDeclaration withOutputArtifacts(OutputArtifact... outputArtifacts) {
if (this.outputArtifacts == null) {
setOutputArtifacts(new java.util.ArrayList<OutputArtifact>(outputArtifacts.length)); // depends on control dependency: [if], data = [none]
}
for (OutputArtifact ele : outputArtifacts) {
this.outputArtifacts.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public String getEncodedRequestURI()
{
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse();
}
// 321485
String uri = null;
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", "");
}
if (getDispatchContext() == null)
uri = _request.getRequestURI();
else
uri = getDispatchContext().getRequestURI();
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", " uri --> " + uri);
}
return uri;
} } | public class class_name {
public String getEncodedRequestURI()
{
if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
checkRequestObjectInUse(); // depends on control dependency: [if], data = [none]
}
// 321485
String uri = null;
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", ""); // depends on control dependency: [if], data = [none]
}
if (getDispatchContext() == null)
uri = _request.getRequestURI();
else
uri = getDispatchContext().getRequestURI();
if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15
logger.logp(Level.FINE, CLASS_NAME,"getEncodedRequestURI", " uri --> " + uri); // depends on control dependency: [if], data = [none]
}
return uri;
} } |
public class class_name {
@Override
public List<Object> getAttributeValues(final String name) {
final List<Object> values = this.attributes.get(name);
if (values == null) {
return null;
}
return values;
} } | public class class_name {
@Override
public List<Object> getAttributeValues(final String name) {
final List<Object> values = this.attributes.get(name);
if (values == null) {
return null; // depends on control dependency: [if], data = [none]
}
return values;
} } |
public class class_name {
protected Set<String> updateInBuffer(final NodeData node, final QPath prevPath, Set<String> idsToSkip)
{
// I expect that NullNodeData will never update existing NodeData.
CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevPath, ItemType.NODE);
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
cache.remove(prevKey);
}
// update childs paths if index changed
int nodeIndex = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getIndex();
int prevNodeIndex = prevPath.getEntries()[prevPath.getEntries().length - 1].getIndex();
if (nodeIndex != prevNodeIndex)
{
// its a same name reordering
return updateTreePath(prevPath, node.getQPath(), idsToSkip);
}
return null;
} } | public class class_name {
protected Set<String> updateInBuffer(final NodeData node, final QPath prevPath, Set<String> idsToSkip)
{
// I expect that NullNodeData will never update existing NodeData.
CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevPath, ItemType.NODE);
if (node.getIdentifier().equals(cache.getFromBuffer(prevKey)))
{
cache.remove(prevKey);
// depends on control dependency: [if], data = [none]
}
// update childs paths if index changed
int nodeIndex = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getIndex();
int prevNodeIndex = prevPath.getEntries()[prevPath.getEntries().length - 1].getIndex();
if (nodeIndex != prevNodeIndex)
{
// its a same name reordering
return updateTreePath(prevPath, node.getQPath(), idsToSkip);
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static StringBuilder appendProblems(Object object, StringBuilder builder) {
if (object instanceof CompilationProblem[]) {
final CompilationProblem[] problem = (CompilationProblem[]) object;
for (CompilationProblem aProblem : problem) {
builder.append("\t")
.append(aProblem)
.append("\n");
}
} else if (object != null) {
builder.append(object);
}
return builder;
} } | public class class_name {
public static StringBuilder appendProblems(Object object, StringBuilder builder) {
if (object instanceof CompilationProblem[]) {
final CompilationProblem[] problem = (CompilationProblem[]) object;
for (CompilationProblem aProblem : problem) {
builder.append("\t")
.append(aProblem)
.append("\n"); // depends on control dependency: [for], data = [none]
}
} else if (object != null) {
builder.append(object); // depends on control dependency: [if], data = [(object]
}
return builder;
} } |
public class class_name {
private int readCorner3(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(0, numColumns - 3, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(0, numColumns - 2, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(0, numColumns - 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(1, numColumns - 3, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(1, numColumns - 2, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1;
}
return currentByte;
} } | public class class_name {
private int readCorner3(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(numRows - 1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(0, numColumns - 3, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(0, numColumns - 2, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(0, numColumns - 1, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(1, numColumns - 3, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(1, numColumns - 2, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
currentByte <<= 1;
if (readModule(1, numColumns - 1, numRows, numColumns)) {
currentByte |= 1; // depends on control dependency: [if], data = [none]
}
return currentByte;
} } |
public class class_name {
public static URLTemplatesFactory createURLTemplatesFactory( ServletContext servletContext )
{
// get the URLTemplatesFactory from the containerAdapter.
ServletContainerAdapter containerAdapter = AdapterManager.getServletContainerAdapter( servletContext );
URLTemplatesFactory factory = (URLTemplatesFactory) containerAdapter.getFactory( URLTemplatesFactory.class, null, null );
// if there's no URLTemplatesFactory, use our default impl.
if ( factory == null )
{
factory = new DefaultURLTemplatesFactory();
}
return factory;
} } | public class class_name {
public static URLTemplatesFactory createURLTemplatesFactory( ServletContext servletContext )
{
// get the URLTemplatesFactory from the containerAdapter.
ServletContainerAdapter containerAdapter = AdapterManager.getServletContainerAdapter( servletContext );
URLTemplatesFactory factory = (URLTemplatesFactory) containerAdapter.getFactory( URLTemplatesFactory.class, null, null );
// if there's no URLTemplatesFactory, use our default impl.
if ( factory == null )
{
factory = new DefaultURLTemplatesFactory(); // depends on control dependency: [if], data = [none]
}
return factory;
} } |
public class class_name {
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(',');
}
joinedByComma.append(format);
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString());
}
// check requested camera ID
if (cameraId >= 0) {
intentScan.putExtra("SCAN_CAMERA_ID", cameraId);
}
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog();
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(FLAG_NEW_DOC);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
} } | public class class_name {
public final AlertDialog initiateScan(Collection<String> desiredBarcodeFormats, int cameraId) {
Intent intentScan = new Intent(BS_PACKAGE + ".SCAN");
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
// check which types of codes to scan for
if (desiredBarcodeFormats != null) {
// set the desired barcode types
StringBuilder joinedByComma = new StringBuilder();
for (String format : desiredBarcodeFormats) {
if (joinedByComma.length() > 0) {
joinedByComma.append(','); // depends on control dependency: [if], data = [none]
}
joinedByComma.append(format); // depends on control dependency: [for], data = [format]
}
intentScan.putExtra("SCAN_FORMATS", joinedByComma.toString()); // depends on control dependency: [if], data = [none]
}
// check requested camera ID
if (cameraId >= 0) {
intentScan.putExtra("SCAN_CAMERA_ID", cameraId); // depends on control dependency: [if], data = [none]
}
String targetAppPackage = findTargetAppPackage(intentScan);
if (targetAppPackage == null) {
return showDownloadDialog(); // depends on control dependency: [if], data = [none]
}
intentScan.setPackage(targetAppPackage);
intentScan.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intentScan.addFlags(FLAG_NEW_DOC);
attachMoreExtras(intentScan);
startActivityForResult(intentScan, REQUEST_CODE);
return null;
} } |
public class class_name {
public void marshall(CreateInstanceProfileRequest createInstanceProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (createInstanceProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createInstanceProfileRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createInstanceProfileRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createInstanceProfileRequest.getPackageCleanup(), PACKAGECLEANUP_BINDING);
protocolMarshaller.marshall(createInstanceProfileRequest.getExcludeAppPackagesFromCleanup(), EXCLUDEAPPPACKAGESFROMCLEANUP_BINDING);
protocolMarshaller.marshall(createInstanceProfileRequest.getRebootAfterUse(), REBOOTAFTERUSE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateInstanceProfileRequest createInstanceProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (createInstanceProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createInstanceProfileRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceProfileRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceProfileRequest.getPackageCleanup(), PACKAGECLEANUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceProfileRequest.getExcludeAppPackagesFromCleanup(), EXCLUDEAPPPACKAGESFROMCLEANUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceProfileRequest.getRebootAfterUse(), REBOOTAFTERUSE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final String state() {
String thisMethodName = "state";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this);
}
String state = getState();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, state);
}
return state;
} } | public class class_name {
public final String state() {
String thisMethodName = "state";
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.entry(tc, thisMethodName, this); // depends on control dependency: [if], data = [none]
}
String state = getState();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
SibTr.exit(tc, thisMethodName, state); // depends on control dependency: [if], data = [none]
}
return state;
} } |
public class class_name {
public boolean hasStateProperty(String key) {
if (StringUtils.isBlank(key)) {
return false;
}
return getDeviceState().containsKey(key);
} } | public class class_name {
public boolean hasStateProperty(String key) {
if (StringUtils.isBlank(key)) {
return false; // depends on control dependency: [if], data = [none]
}
return getDeviceState().containsKey(key);
} } |
public class class_name {
public Collection<String> listOperationDescriptions() {
List<String> list = new ArrayList<String>();
try {
MBeanOperationInfo[] operations = beanInfo.getOperations();
for (MBeanOperationInfo operation : operations) {
list.add(describeOperation(operation));
}
} catch (Exception e) {
throwException("Could not list operation descriptions. Reason: ", e);
}
return list;
} } | public class class_name {
public Collection<String> listOperationDescriptions() {
List<String> list = new ArrayList<String>();
try {
MBeanOperationInfo[] operations = beanInfo.getOperations();
for (MBeanOperationInfo operation : operations) {
list.add(describeOperation(operation)); // depends on control dependency: [for], data = [operation]
}
} catch (Exception e) {
throwException("Could not list operation descriptions. Reason: ", e);
} // depends on control dependency: [catch], data = [none]
return list;
} } |
public class class_name {
private List<BaseInvoker> getInvokersForPointcut(Pointcut thePointcut) {
List<BaseInvoker> invokers;
synchronized (myRegistryMutex) {
List<BaseInvoker> globalInvokers = myGlobalInvokers.get(thePointcut);
List<BaseInvoker> anonymousInvokers = myAnonymousInvokers.get(thePointcut);
List<BaseInvoker> threadLocalInvokers = null;
if (myThreadlocalInvokersEnabled) {
ListMultimap<Pointcut, BaseInvoker> pointcutToInvokers = myThreadlocalInvokers.get();
if (pointcutToInvokers != null) {
threadLocalInvokers = pointcutToInvokers.get(thePointcut);
}
}
invokers = union(globalInvokers, anonymousInvokers, threadLocalInvokers);
}
return invokers;
} } | public class class_name {
private List<BaseInvoker> getInvokersForPointcut(Pointcut thePointcut) {
List<BaseInvoker> invokers;
synchronized (myRegistryMutex) {
List<BaseInvoker> globalInvokers = myGlobalInvokers.get(thePointcut);
List<BaseInvoker> anonymousInvokers = myAnonymousInvokers.get(thePointcut);
List<BaseInvoker> threadLocalInvokers = null;
if (myThreadlocalInvokersEnabled) {
ListMultimap<Pointcut, BaseInvoker> pointcutToInvokers = myThreadlocalInvokers.get();
if (pointcutToInvokers != null) {
threadLocalInvokers = pointcutToInvokers.get(thePointcut); // depends on control dependency: [if], data = [none]
}
}
invokers = union(globalInvokers, anonymousInvokers, threadLocalInvokers);
}
return invokers;
} } |
public class class_name {
private Jedis getAndSetConnection()
{
Jedis conn = factory.getConnection();
this.connection = conn;
// If resource is not null means a transaction in progress.
if (settings != null)
{
for (String key : settings.keySet())
{
conn.configSet(key, settings.get(key).toString());
}
}
return conn;
} } | public class class_name {
private Jedis getAndSetConnection()
{
Jedis conn = factory.getConnection();
this.connection = conn;
// If resource is not null means a transaction in progress.
if (settings != null)
{
for (String key : settings.keySet())
{
conn.configSet(key, settings.get(key).toString()); // depends on control dependency: [for], data = [key]
}
}
return conn;
} } |
public class class_name {
public boolean isNoneDisplay(final TargetMode _mode)
{
boolean ret = false;
if (this.mode2display.containsKey(_mode)) {
ret = this.mode2display.get(_mode).equals(Field.Display.NONE);
} else if (_mode.equals(TargetMode.CREATE) || _mode.equals(TargetMode.SEARCH)) {
ret = true;
}
return ret;
} } | public class class_name {
public boolean isNoneDisplay(final TargetMode _mode)
{
boolean ret = false;
if (this.mode2display.containsKey(_mode)) {
ret = this.mode2display.get(_mode).equals(Field.Display.NONE); // depends on control dependency: [if], data = [none]
} else if (_mode.equals(TargetMode.CREATE) || _mode.equals(TargetMode.SEARCH)) {
ret = true; // depends on control dependency: [if], data = [none]
}
return ret;
} } |
public class class_name {
public Map<String, String> containerEnv() {
final Map<String, String> env = Maps.newHashMap(envVars);
// Put in variables that tell the container where it's exposed
for (final Entry<String, Integer> entry : ports.entrySet()) {
env.put("HELIOS_PORT_" + entry.getKey(), host + ":" + entry.getValue());
}
// Job environment variables take precedence.
env.putAll(job.getEnv());
return env;
} } | public class class_name {
public Map<String, String> containerEnv() {
final Map<String, String> env = Maps.newHashMap(envVars);
// Put in variables that tell the container where it's exposed
for (final Entry<String, Integer> entry : ports.entrySet()) {
env.put("HELIOS_PORT_" + entry.getKey(), host + ":" + entry.getValue()); // depends on control dependency: [for], data = [entry]
}
// Job environment variables take precedence.
env.putAll(job.getEnv());
return env;
} } |
public class class_name {
public void marshall(CreateConfigurationSetRequest createConfigurationSetRequest, ProtocolMarshaller protocolMarshaller) {
if (createConfigurationSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConfigurationSetRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateConfigurationSetRequest createConfigurationSetRequest, ProtocolMarshaller protocolMarshaller) {
if (createConfigurationSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConfigurationSetRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void repairDataSize()
{
try
{
long dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName);
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize);
quotaPersister.setWorkspaceDataSize(rName, wsName, 0); // workaround
Runnable task = new ApplyPersistedChangesTask(wqm.getContext(), changesItem);
task.run();
}
catch (UnknownDataSizeException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace(e.getMessage(), e);
}
}
} } | public class class_name {
private void repairDataSize()
{
try
{
long dataSize = quotaPersister.getWorkspaceDataSize(rName, wsName);
ChangesItem changesItem = new ChangesItem();
changesItem.updateWorkspaceChangedSize(dataSize); // depends on control dependency: [try], data = [none]
quotaPersister.setWorkspaceDataSize(rName, wsName, 0); // workaround // depends on control dependency: [try], data = [none]
Runnable task = new ApplyPersistedChangesTask(wqm.getContext(), changesItem);
task.run(); // depends on control dependency: [try], data = [none]
}
catch (UnknownDataSizeException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace(e.getMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Set<String> commaDelimitedListToSet(String str) {
Set<String> set = new LinkedHashSet<String>();
String[] tokens = commaDelimitedListToStringArray(str);
for (String token : tokens) {
set.add(token);
}
return set;
} } | public class class_name {
public static Set<String> commaDelimitedListToSet(String str) {
Set<String> set = new LinkedHashSet<String>();
String[] tokens = commaDelimitedListToStringArray(str);
for (String token : tokens) {
set.add(token); // depends on control dependency: [for], data = [token]
}
return set;
} } |
public class class_name {
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) {
BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO);
if (buildInfo == null) {
buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap());
stepVariables.put(BUILD_INFO, buildInfo);
}
buildInfo.setCpsScript(cpsScript);
return buildInfo;
} } | public class class_name {
public static BuildInfo appendBuildInfo(CpsScript cpsScript, Map<String, Object> stepVariables) {
BuildInfo buildInfo = (BuildInfo) stepVariables.get(BUILD_INFO);
if (buildInfo == null) {
buildInfo = (BuildInfo) cpsScript.invokeMethod("newBuildInfo", Maps.newLinkedHashMap()); // depends on control dependency: [if], data = [none]
stepVariables.put(BUILD_INFO, buildInfo); // depends on control dependency: [if], data = [none]
}
buildInfo.setCpsScript(cpsScript);
return buildInfo;
} } |
public class class_name {
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public @ResponseBody
void insert(
@RequestParam(value = "username", required = true) String username,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "surname", required = false) String surname,
@RequestParam(value = "telephoneNumber", required = true) String telephoneNumber,
@RequestParam(value = "verificationText", required = true) String verificationText,
HttpServletRequest request, HttpServletResponse response) {
logger.debug("Received a request to insert an account");
// validate captcha
Boolean isResponseCorrect = false;
String sessionId = request.getSession().getId();
// Call the Service method
try {
isResponseCorrect = captchaService.validateResponseForID(sessionId,
verificationText);
if (isResponseCorrect == false) {
response.sendError(500, "Provided captcha text was wrong.");
return;
}
} catch (Exception e) {
e.printStackTrace();
return;
}
accountService.insert(new Account(username, name, surname,
telephoneNumber));
} } | public class class_name {
@RequestMapping(value = "/insert", method = RequestMethod.POST)
public @ResponseBody
void insert(
@RequestParam(value = "username", required = true) String username,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "surname", required = false) String surname,
@RequestParam(value = "telephoneNumber", required = true) String telephoneNumber,
@RequestParam(value = "verificationText", required = true) String verificationText,
HttpServletRequest request, HttpServletResponse response) {
logger.debug("Received a request to insert an account");
// validate captcha
Boolean isResponseCorrect = false;
String sessionId = request.getSession().getId();
// Call the Service method
try {
isResponseCorrect = captchaService.validateResponseForID(sessionId,
verificationText); // depends on control dependency: [try], data = [none]
if (isResponseCorrect == false) {
response.sendError(500, "Provided captcha text was wrong."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
e.printStackTrace();
return;
} // depends on control dependency: [catch], data = [none]
accountService.insert(new Account(username, name, surname,
telephoneNumber));
} } |
public class class_name {
private void generatePeerLinks(final Metadata m, final Element e) {
for (final PeerLink peerLink : m.getPeerLinks()) {
final Element peerLinkElement = new Element("peerLink", NS);
addNotNullAttribute(peerLinkElement, "type", peerLink.getType());
addNotNullAttribute(peerLinkElement, "href", peerLink.getHref());
if (peerLinkElement.hasAttributes()) {
e.addContent(peerLinkElement);
}
}
} } | public class class_name {
private void generatePeerLinks(final Metadata m, final Element e) {
for (final PeerLink peerLink : m.getPeerLinks()) {
final Element peerLinkElement = new Element("peerLink", NS);
addNotNullAttribute(peerLinkElement, "type", peerLink.getType()); // depends on control dependency: [for], data = [peerLink]
addNotNullAttribute(peerLinkElement, "href", peerLink.getHref()); // depends on control dependency: [for], data = [peerLink]
if (peerLinkElement.hasAttributes()) {
e.addContent(peerLinkElement); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void removeSprites (Predicate<Sprite> pred)
{
int idxoff = 0;
for (int ii = 0, ll = _sprites.size(); ii < ll; ii++) {
Sprite sprite = _sprites.get(ii-idxoff);
if (pred.apply(sprite)) {
_sprites.remove(sprite);
sprite.invalidate();
sprite.shutdown();
// we need to preserve the original "index" relative to the current tick position,
// so we don't decrement ii directly
idxoff++;
if (ii <= _tickpos) {
_tickpos--;
}
}
}
} } | public class class_name {
public void removeSprites (Predicate<Sprite> pred)
{
int idxoff = 0;
for (int ii = 0, ll = _sprites.size(); ii < ll; ii++) {
Sprite sprite = _sprites.get(ii-idxoff);
if (pred.apply(sprite)) {
_sprites.remove(sprite); // depends on control dependency: [if], data = [none]
sprite.invalidate(); // depends on control dependency: [if], data = [none]
sprite.shutdown(); // depends on control dependency: [if], data = [none]
// we need to preserve the original "index" relative to the current tick position,
// so we don't decrement ii directly
idxoff++; // depends on control dependency: [if], data = [none]
if (ii <= _tickpos) {
_tickpos--; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public void setFilters(Map<String, ? extends IoFilter> filters) {
if (filters == null) {
throw new NullPointerException("filters");
}
if (!isOrderedMap(filters)) {
throw new IllegalArgumentException(
"filters is not an ordered map. Please try " +
LinkedHashMap.class.getName() + ".");
}
filters = new LinkedHashMap<String, IoFilter>(filters);
for (Map.Entry<String, ? extends IoFilter> e: filters.entrySet()) {
if (e.getKey() == null) {
throw new NullPointerException("filters contains a null key.");
}
if (e.getValue() == null) {
throw new NullPointerException("filters contains a null value.");
}
}
synchronized (this) {
clear();
for (Map.Entry<String, ? extends IoFilter> e: filters.entrySet()) {
addLast(e.getKey(), e.getValue());
}
}
} } | public class class_name {
public void setFilters(Map<String, ? extends IoFilter> filters) {
if (filters == null) {
throw new NullPointerException("filters");
}
if (!isOrderedMap(filters)) {
throw new IllegalArgumentException(
"filters is not an ordered map. Please try " +
LinkedHashMap.class.getName() + ".");
}
filters = new LinkedHashMap<String, IoFilter>(filters);
for (Map.Entry<String, ? extends IoFilter> e: filters.entrySet()) {
if (e.getKey() == null) {
throw new NullPointerException("filters contains a null key.");
}
if (e.getValue() == null) {
throw new NullPointerException("filters contains a null value.");
}
}
synchronized (this) {
clear();
for (Map.Entry<String, ? extends IoFilter> e: filters.entrySet()) {
addLast(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e]
}
}
} } |
public class class_name {
public static void parseURI(String uriStr, List<String> uriPathList,
StringBuilder uriQuery, StringBuilder uriFragment) {
assert uriStr != null;
assert uriPathList != null;
assert uriQuery != null;
assert uriFragment != null;
// Start with everything empty.
uriPathList.clear();
uriQuery.setLength(0);
uriFragment.setLength(0);
// Find location of query (?) and fragment (#) markers, if any.
int quesInx = uriStr.indexOf('?');
int hashInx = uriStr.indexOf('#');
if (hashInx >= 0 && quesInx >= 0 && hashInx < quesInx) {
// Technically this is an invalid URI since the fragment should always follow
// the query. We'll just pretend we didn't see the hash.
hashInx = -1;
}
// The path starts at index 0. Point to where it ends.
int pathEndInx = quesInx >= 0 ? quesInx :
hashInx >= 0 ? hashInx : uriStr.length();
// Split path into nodes based on "/". Append non-empty nodes to path list.
String[] pathNodes = uriStr.substring(0, pathEndInx).split("/");
for (String pathNode : pathNodes) {
if (pathNode.length() > 0) {
uriPathList.add(pathNode);
}
}
// Extract the query part, if any.
if (quesInx >= pathEndInx) {
int quesEndInx = hashInx > quesInx ? hashInx : uriStr.length();
uriQuery.append(uriStr.substring(quesInx + 1, quesEndInx));
}
// Extract the fragment part, if any.
if (hashInx >= 0) {
uriFragment.append(uriStr.substring(hashInx + 1, uriStr.length()));
}
} } | public class class_name {
public static void parseURI(String uriStr, List<String> uriPathList,
StringBuilder uriQuery, StringBuilder uriFragment) {
assert uriStr != null;
assert uriPathList != null;
assert uriQuery != null;
assert uriFragment != null;
// Start with everything empty.
uriPathList.clear();
uriQuery.setLength(0);
uriFragment.setLength(0);
// Find location of query (?) and fragment (#) markers, if any.
int quesInx = uriStr.indexOf('?');
int hashInx = uriStr.indexOf('#');
if (hashInx >= 0 && quesInx >= 0 && hashInx < quesInx) {
// Technically this is an invalid URI since the fragment should always follow
// the query. We'll just pretend we didn't see the hash.
hashInx = -1;
// depends on control dependency: [if], data = [none]
}
// The path starts at index 0. Point to where it ends.
int pathEndInx = quesInx >= 0 ? quesInx :
hashInx >= 0 ? hashInx : uriStr.length();
// Split path into nodes based on "/". Append non-empty nodes to path list.
String[] pathNodes = uriStr.substring(0, pathEndInx).split("/");
for (String pathNode : pathNodes) {
if (pathNode.length() > 0) {
uriPathList.add(pathNode);
// depends on control dependency: [if], data = [none]
}
}
// Extract the query part, if any.
if (quesInx >= pathEndInx) {
int quesEndInx = hashInx > quesInx ? hashInx : uriStr.length();
uriQuery.append(uriStr.substring(quesInx + 1, quesEndInx));
// depends on control dependency: [if], data = [(quesInx]
}
// Extract the fragment part, if any.
if (hashInx >= 0) {
uriFragment.append(uriStr.substring(hashInx + 1, uriStr.length()));
// depends on control dependency: [if], data = [(hashInx]
}
} } |
public class class_name {
protected static Object getScopeService(IScope scope, String name, Class<?> defaultClass) {
if (scope != null) {
final IContext context = scope.getContext();
ApplicationContext appCtx = context.getApplicationContext();
Object result;
if (!appCtx.containsBean(name)) {
if (defaultClass == null) {
return null;
}
try {
result = defaultClass.newInstance();
} catch (Exception e) {
log.error("{}", e);
return null;
}
} else {
result = appCtx.getBean(name);
}
return result;
}
return null;
} } | public class class_name {
protected static Object getScopeService(IScope scope, String name, Class<?> defaultClass) {
if (scope != null) {
final IContext context = scope.getContext();
ApplicationContext appCtx = context.getApplicationContext();
Object result;
if (!appCtx.containsBean(name)) {
if (defaultClass == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
result = defaultClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("{}", e);
return null;
} // depends on control dependency: [catch], data = [none]
} else {
result = appCtx.getBean(name); // depends on control dependency: [if], data = [none]
}
return result; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void acceptAgreement() {
// store accepted flag in current users settings
getSettings().setUserAgreementAccepted(true);
// check accepted agreement version
if (getAcceptedVersion() < getRequiredVersion()) {
// a new (higher) version was accepted, increase version to store and reset accepted count
setAcceptedVersion(getRequiredVersion());
setAcceptedCount(0);
}
// increase accepted count
setAcceptedCount(getAcceptedCount() + 1);
// create the JSON data structure that is stored in the additional info
JSONObject jsonData = new JSONObject();
try {
jsonData.put(KEY_ACCEPTED_VERSION, getRequiredVersion());
jsonData.put(KEY_ACCEPTED_COUNT, m_acceptedCount);
// store accepted data in users additional information
CmsUser user = getCms().getRequestContext().getCurrentUser();
user.setAdditionalInfo(CmsUserSettings.LOGIN_USERAGREEMENT_ACCEPTED, jsonData.toString());
// write the changed user
getCms().writeUser(user);
} catch (Exception e) {
LOG.error(e);
}
} } | public class class_name {
public void acceptAgreement() {
// store accepted flag in current users settings
getSettings().setUserAgreementAccepted(true);
// check accepted agreement version
if (getAcceptedVersion() < getRequiredVersion()) {
// a new (higher) version was accepted, increase version to store and reset accepted count
setAcceptedVersion(getRequiredVersion()); // depends on control dependency: [if], data = [getRequiredVersion())]
setAcceptedCount(0); // depends on control dependency: [if], data = [none]
}
// increase accepted count
setAcceptedCount(getAcceptedCount() + 1);
// create the JSON data structure that is stored in the additional info
JSONObject jsonData = new JSONObject();
try {
jsonData.put(KEY_ACCEPTED_VERSION, getRequiredVersion()); // depends on control dependency: [try], data = [none]
jsonData.put(KEY_ACCEPTED_COUNT, m_acceptedCount); // depends on control dependency: [try], data = [none]
// store accepted data in users additional information
CmsUser user = getCms().getRequestContext().getCurrentUser();
user.setAdditionalInfo(CmsUserSettings.LOGIN_USERAGREEMENT_ACCEPTED, jsonData.toString()); // depends on control dependency: [try], data = [none]
// write the changed user
getCms().writeUser(user); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void getPersistentData(ObjectOutputStream oos)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPersistentData", oos);
try
{
HashMap<String, Object> hm = new HashMap<String, Object>();
addPersistentDestinationData(hm);
oos.writeObject(hm);
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream.getPersistentData",
"1:396:1.93.1.14",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream",
"1:403:1.93.1.14",
e,
getDestinationHandler().getName()});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData", e);
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream",
"1:415:1.93.1.14",
e,
getDestinationHandler().getName()},
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData");
} } | public class class_name {
public void getPersistentData(ObjectOutputStream oos)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getPersistentData", oos);
try
{
HashMap<String, Object> hm = new HashMap<String, Object>();
addPersistentDestinationData(hm); // depends on control dependency: [try], data = [none]
oos.writeObject(hm); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream.getPersistentData",
"1:396:1.93.1.14",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream",
"1:403:1.93.1.14",
e,
getDestinationHandler().getName()});
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData", e);
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0003",
new Object[] {
"com.ibm.ws.sib.processor.impl.store.itemstreams.PtoPMessageItemStream",
"1:415:1.93.1.14",
e,
getDestinationHandler().getName()},
null),
e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getPersistentData");
} } |
public class class_name {
public void nextBytes(byte[] bytes) {
int i = 0;
final int iEnd = bytes.length - 3;
while (i < iEnd) {
final int random = next(32);
bytes[i] = (byte) (random & 0xff);
bytes[i + 1] = (byte) ((random >> 8) & 0xff);
bytes[i + 2] = (byte) ((random >> 16) & 0xff);
bytes[i + 3] = (byte) ((random >> 24) & 0xff);
i += 4;
}
int random = next(32);
while (i < bytes.length) {
bytes[i++] = (byte) (random & 0xff);
random = random >> 8;
}
} } | public class class_name {
public void nextBytes(byte[] bytes) {
int i = 0;
final int iEnd = bytes.length - 3;
while (i < iEnd) {
final int random = next(32);
bytes[i] = (byte) (random & 0xff); // depends on control dependency: [while], data = [none]
bytes[i + 1] = (byte) ((random >> 8) & 0xff); // depends on control dependency: [while], data = [none]
bytes[i + 2] = (byte) ((random >> 16) & 0xff); // depends on control dependency: [while], data = [none]
bytes[i + 3] = (byte) ((random >> 24) & 0xff); // depends on control dependency: [while], data = [none]
i += 4; // depends on control dependency: [while], data = [none]
}
int random = next(32);
while (i < bytes.length) {
bytes[i++] = (byte) (random & 0xff); // depends on control dependency: [while], data = [none]
random = random >> 8; // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
@Override
public int compareTo(HandlerHolder holderToCompare) {
if (holderToCompare == this || this.serviceId == holderToCompare.serviceId)
return 0;
// service ranking is higher to lower
int compare = holderToCompare.serviceRanking - this.serviceRanking;
if (compare == 0) {
// service id is lower to higher
return holderToCompare.serviceId > this.serviceId ? -1 : 1;
}
// service ranking is higher to lower
// Can't get here with equal ranking, falls into compare block w/
// non-equal service ids.
return holderToCompare.serviceRanking > this.serviceRanking ? 1 : -1;
} } | public class class_name {
@Override
public int compareTo(HandlerHolder holderToCompare) {
if (holderToCompare == this || this.serviceId == holderToCompare.serviceId)
return 0;
// service ranking is higher to lower
int compare = holderToCompare.serviceRanking - this.serviceRanking;
if (compare == 0) {
// service id is lower to higher
return holderToCompare.serviceId > this.serviceId ? -1 : 1; // depends on control dependency: [if], data = [none]
}
// service ranking is higher to lower
// Can't get here with equal ranking, falls into compare block w/
// non-equal service ids.
return holderToCompare.serviceRanking > this.serviceRanking ? 1 : -1;
} } |
public class class_name {
private int ssPivot(int Td, int PA, int first, int last) {
int middle;// SA pointer
int t = last - first;
middle = first + t / 2;
if (t <= 512) {
if (t <= 32) {
return ssMedian3(Td, PA, first, middle, last - 1);
} else {
t >>= 2;
return ssMedian5(Td, PA, first, first + t, middle, last - 1 - t, last - 1);
}
}
t >>= 3;
first = ssMedian3(Td, PA, first, first + t, first + (t << 1));
middle = ssMedian3(Td, PA, middle - t, middle, middle + t);
last = ssMedian3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1);
return ssMedian3(Td, PA, first, middle, last);
} } | public class class_name {
private int ssPivot(int Td, int PA, int first, int last) {
int middle;// SA pointer
int t = last - first;
middle = first + t / 2;
if (t <= 512) {
if (t <= 32) {
return ssMedian3(Td, PA, first, middle, last - 1); // depends on control dependency: [if], data = [none]
} else {
t >>= 2; // depends on control dependency: [if], data = [none]
return ssMedian5(Td, PA, first, first + t, middle, last - 1 - t, last - 1); // depends on control dependency: [if], data = [none]
}
}
t >>= 3;
first = ssMedian3(Td, PA, first, first + t, first + (t << 1));
middle = ssMedian3(Td, PA, middle - t, middle, middle + t);
last = ssMedian3(Td, PA, last - 1 - (t << 1), last - 1 - t, last - 1);
return ssMedian3(Td, PA, first, middle, last);
} } |
public class class_name {
public List<String> getValueList(List<String> defaultValue) {
if (this == CmsProperty.NULL_PROPERTY) {
// return the default value if this property is the null property
return defaultValue;
}
// somebody might have set both values to null manually
// on a property object different from the null property...
return (m_structureValue != null)
? getStructureValueList()
: ((m_resourceValue != null) ? getResourceValueList() : defaultValue);
} } | public class class_name {
public List<String> getValueList(List<String> defaultValue) {
if (this == CmsProperty.NULL_PROPERTY) {
// return the default value if this property is the null property
return defaultValue; // depends on control dependency: [if], data = [none]
}
// somebody might have set both values to null manually
// on a property object different from the null property...
return (m_structureValue != null)
? getStructureValueList()
: ((m_resourceValue != null) ? getResourceValueList() : defaultValue);
} } |
public class class_name {
@Deprecated
public static String splitAndIndent(String str, int indent, int numChars) {
final int inputLength = str.length();
// to prevent resizing, we can predict the size of the indented string
// the formatting addition is the indent spaces plus a newline
// this length is added once for each line
boolean perfectFit = (inputLength % numChars == 0);
int fullLines = (inputLength / numChars);
int formatLength = perfectFit ?
(indent + 1) * fullLines :
(indent + 1) * (fullLines + 1);
int outputLength = inputLength + formatLength;
StringBuilder sb = new StringBuilder(outputLength);
for (int offset = 0; offset < inputLength; offset += numChars) {
SpaceCharacters.indent(indent, sb);
sb.append(str, offset, Math.min(offset + numChars,inputLength));
sb.append('\n');
}
return sb.toString();
} } | public class class_name {
@Deprecated
public static String splitAndIndent(String str, int indent, int numChars) {
final int inputLength = str.length();
// to prevent resizing, we can predict the size of the indented string
// the formatting addition is the indent spaces plus a newline
// this length is added once for each line
boolean perfectFit = (inputLength % numChars == 0);
int fullLines = (inputLength / numChars);
int formatLength = perfectFit ?
(indent + 1) * fullLines :
(indent + 1) * (fullLines + 1);
int outputLength = inputLength + formatLength;
StringBuilder sb = new StringBuilder(outputLength);
for (int offset = 0; offset < inputLength; offset += numChars) {
SpaceCharacters.indent(indent, sb); // depends on control dependency: [for], data = [none]
sb.append(str, offset, Math.min(offset + numChars,inputLength)); // depends on control dependency: [for], data = [offset]
sb.append('\n'); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
private synchronized void enumerate(Hashtable h) {
for (String key : keySet()) {
h.put(key, get(key));
}
} } | public class class_name {
private synchronized void enumerate(Hashtable h) {
for (String key : keySet()) {
h.put(key, get(key)); // depends on control dependency: [for], data = [key]
}
} } |
public class class_name {
private List<MavenDependencyDescriptor> addManagedDependencies(MavenDependentDescriptor pomDescriptor, DependencyManagement dependencyManagement,
ScannerContext scannerContext, Class<? extends AbstractDependencyDescriptor> relationClass) {
if (dependencyManagement == null) {
return Collections.emptyList();
}
List<Dependency> dependencies = dependencyManagement.getDependencies();
return getDependencies(pomDescriptor, dependencies, relationClass, scannerContext);
} } | public class class_name {
private List<MavenDependencyDescriptor> addManagedDependencies(MavenDependentDescriptor pomDescriptor, DependencyManagement dependencyManagement,
ScannerContext scannerContext, Class<? extends AbstractDependencyDescriptor> relationClass) {
if (dependencyManagement == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
List<Dependency> dependencies = dependencyManagement.getDependencies();
return getDependencies(pomDescriptor, dependencies, relationClass, scannerContext);
} } |
public class class_name {
public static byte[] getBytes(final String string) {
try {
return string.getBytes(JoddCore.encoding);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static byte[] getBytes(final String string) {
try {
return string.getBytes(JoddCore.encoding); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private RouteEntry findTargetWithGivenAcceptType(List<RouteEntry> routeMatches, String acceptType) {
if (acceptType != null && routeMatches.size() > 0) {
Map<String, RouteEntry> acceptedMimeTypes = getAcceptedMimeTypes(routeMatches);
String bestMatch = MimeParse.bestMatch(acceptedMimeTypes.keySet(), acceptType);
if (routeWithGivenAcceptType(bestMatch)) {
return acceptedMimeTypes.get(bestMatch);
} else {
return null;
}
} else {
if (routeMatches.size() > 0) {
return routeMatches.get(0);
}
}
return null;
} } | public class class_name {
private RouteEntry findTargetWithGivenAcceptType(List<RouteEntry> routeMatches, String acceptType) {
if (acceptType != null && routeMatches.size() > 0) {
Map<String, RouteEntry> acceptedMimeTypes = getAcceptedMimeTypes(routeMatches);
String bestMatch = MimeParse.bestMatch(acceptedMimeTypes.keySet(), acceptType);
if (routeWithGivenAcceptType(bestMatch)) {
return acceptedMimeTypes.get(bestMatch); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} else {
if (routeMatches.size() > 0) {
return routeMatches.get(0); // depends on control dependency: [if], data = [0)]
}
}
return null;
} } |
public class class_name {
@Override
public Iterator<? extends IPAddress> prefixBlockIterator(int prefLength) {
if(prefLength < 0) {
throw new PrefixLenException(prefLength);
}
IPv6Address lower = getLower();
IPv6Address upper = getUpper();
AddressCreator<IPv6Address, ?, ?, IPv6AddressSegment> creator = getAddressCreator();
return iterator(
lower,
upper,
creator,
IPv6Address::getSegment,
(seg, segIndex) -> seg.iterator(),
(addr1, addr2, index) -> {
Integer segPrefLength = ParsedAddressGrouping.getPrefixedSegmentPrefixLength(IPv6Address.BITS_PER_SEGMENT, prefLength, index);
if(segPrefLength == null) {
return addr1.getSegment(index).getSegmentValue() == addr2.getSegment(index).getSegmentValue();
}
int shift = IPv6Address.BITS_PER_SEGMENT - segPrefLength;
return addr1.getSegment(index).getSegmentValue() >>> shift == addr2.getSegment(index).getSegmentValue() >>> shift;
},
getNetworkSegmentIndex(prefLength, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT),
getHostSegmentIndex(prefLength, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT),
(seg, index) -> {
Integer segPrefLength = ParsedAddressGrouping.getPrefixedSegmentPrefixLength(IPv6Address.BITS_PER_SEGMENT, prefLength, index);
if(segPrefLength == null) {
return seg.iterator();
}
return seg.prefixBlockIterator(segPrefLength);
});
} } | public class class_name {
@Override
public Iterator<? extends IPAddress> prefixBlockIterator(int prefLength) {
if(prefLength < 0) {
throw new PrefixLenException(prefLength);
}
IPv6Address lower = getLower();
IPv6Address upper = getUpper();
AddressCreator<IPv6Address, ?, ?, IPv6AddressSegment> creator = getAddressCreator();
return iterator(
lower,
upper,
creator,
IPv6Address::getSegment,
(seg, segIndex) -> seg.iterator(),
(addr1, addr2, index) -> {
Integer segPrefLength = ParsedAddressGrouping.getPrefixedSegmentPrefixLength(IPv6Address.BITS_PER_SEGMENT, prefLength, index);
if(segPrefLength == null) {
return addr1.getSegment(index).getSegmentValue() == addr2.getSegment(index).getSegmentValue(); // depends on control dependency: [if], data = [none]
}
int shift = IPv6Address.BITS_PER_SEGMENT - segPrefLength;
return addr1.getSegment(index).getSegmentValue() >>> shift == addr2.getSegment(index).getSegmentValue() >>> shift;
},
getNetworkSegmentIndex(prefLength, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT),
getHostSegmentIndex(prefLength, IPv6Address.BYTES_PER_SEGMENT, IPv6Address.BITS_PER_SEGMENT),
(seg, index) -> {
Integer segPrefLength = ParsedAddressGrouping.getPrefixedSegmentPrefixLength(IPv6Address.BITS_PER_SEGMENT, prefLength, index);
if(segPrefLength == null) {
return seg.iterator();
}
return seg.prefixBlockIterator(segPrefLength);
});
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.