code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
ModelNode node = context.getModelNode();
boolean hasChildren = node.hasDefined(RESOURCEADAPTER_NAME) && node.get(RESOURCEADAPTER_NAME).asPropertyList().size() > 0;
context.startSubsystemElement(Namespace.CURRENT.getUriString(), !hasChildren);
if (hasChildren) {
writer.writeStartElement(Element.RESOURCE_ADAPTERS.getLocalName());
ModelNode ras = node.get(RESOURCEADAPTER_NAME);
for (String name : ras.keys()) {
final ModelNode ra = ras.get(name);
writeRaElement(writer, ra, name);
}
writer.writeEndElement();
// Close the subsystem element
writer.writeEndElement();
}
} } | public class class_name {
@Override
public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException {
ModelNode node = context.getModelNode();
boolean hasChildren = node.hasDefined(RESOURCEADAPTER_NAME) && node.get(RESOURCEADAPTER_NAME).asPropertyList().size() > 0;
context.startSubsystemElement(Namespace.CURRENT.getUriString(), !hasChildren);
if (hasChildren) {
writer.writeStartElement(Element.RESOURCE_ADAPTERS.getLocalName());
ModelNode ras = node.get(RESOURCEADAPTER_NAME);
for (String name : ras.keys()) {
final ModelNode ra = ras.get(name);
writeRaElement(writer, ra, name); // depends on control dependency: [for], data = [name]
}
writer.writeEndElement();
// Close the subsystem element
writer.writeEndElement();
}
} } |
public class class_name {
public Object createNewInstance(Class[] types, Object[] args)
{
try
{
Object result;
// create an instance of the target class
if (types != null)
{
result = ClassHelper.newInstance(getClassToServe(), types, args, true);
}
else
{
result = ClassHelper.newInstance(getClassToServe(), true);
}
// if defined in OJB.properties all instances are wrapped by an interceptor
result = InterceptorFactory.getInstance().createInterceptorFor(result);
return result;
}
catch (InstantiationException e)
{
getLogger().error("ConfigurableFactory can't instantiate class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (IllegalAccessException e)
{
getLogger().error("ConfigurableFactory can't access constructor for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
catch (Exception e)
{
getLogger().error("ConfigurableFactory instantiation failed for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
} } | public class class_name {
public Object createNewInstance(Class[] types, Object[] args)
{
try
{
Object result;
// create an instance of the target class
if (types != null)
{
result = ClassHelper.newInstance(getClassToServe(), types, args, true);
// depends on control dependency: [if], data = [none]
}
else
{
result = ClassHelper.newInstance(getClassToServe(), true);
// depends on control dependency: [if], data = [none]
}
// if defined in OJB.properties all instances are wrapped by an interceptor
result = InterceptorFactory.getInstance().createInterceptorFor(result);
// depends on control dependency: [try], data = [none]
return result;
// depends on control dependency: [try], data = [none]
}
catch (InstantiationException e)
{
getLogger().error("ConfigurableFactory can't instantiate class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
// depends on control dependency: [catch], data = [none]
catch (IllegalAccessException e)
{
getLogger().error("ConfigurableFactory can't access constructor for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
// depends on control dependency: [catch], data = [none]
catch (Exception e)
{
getLogger().error("ConfigurableFactory instantiation failed for class " +
getClassToServe() + buildArgumentString(types, args), e);
throw new PersistenceBrokerException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected boolean section()
{
// System.out.println("------------- section");
// compute the value at the new sample point
double temp = stp;
stp = interpolate(pLow +t2*(pHi - pLow), pHi -t3*(pHi - pLow));
updated = true;
// save the previous step
if( !Double.isNaN(gp)) {
// needs to keep a step with a derivative
stprev = temp;
fprev = fp;
gprev = gp;
}
// see if there is a significant change in alpha
if( checkSmallStep() ) {
if( verbose != null )
verbose.println("WARNING: Small steps");
return true;
}
function.setInput(stp);
fp = function.computeFunction();
gp = Double.NaN;
// check for convergence
if( fp > valueZero + ftol * stp *derivZero || fp >= fLow) {
pHi = stp;
} else {
gp = function.computeDerivative();
// check for termination
if( Math.abs(gp) <= -gtol *derivZero )
return true;
if( gp *(pHi - pLow) >= 0 )
pHi = pLow;
// check on numerical prevision
if( Math.abs((pLow - stp)* gp) <= tolStep ) {
return true;
}
pLow = stp;
fLow = fp;
}
return false;
} } | public class class_name {
protected boolean section()
{
// System.out.println("------------- section");
// compute the value at the new sample point
double temp = stp;
stp = interpolate(pLow +t2*(pHi - pLow), pHi -t3*(pHi - pLow));
updated = true;
// save the previous step
if( !Double.isNaN(gp)) {
// needs to keep a step with a derivative
stprev = temp; // depends on control dependency: [if], data = [none]
fprev = fp; // depends on control dependency: [if], data = [none]
gprev = gp; // depends on control dependency: [if], data = [none]
}
// see if there is a significant change in alpha
if( checkSmallStep() ) {
if( verbose != null )
verbose.println("WARNING: Small steps");
return true; // depends on control dependency: [if], data = [none]
}
function.setInput(stp);
fp = function.computeFunction();
gp = Double.NaN;
// check for convergence
if( fp > valueZero + ftol * stp *derivZero || fp >= fLow) {
pHi = stp; // depends on control dependency: [if], data = [none]
} else {
gp = function.computeDerivative(); // depends on control dependency: [if], data = [none]
// check for termination
if( Math.abs(gp) <= -gtol *derivZero )
return true;
if( gp *(pHi - pLow) >= 0 )
pHi = pLow;
// check on numerical prevision
if( Math.abs((pLow - stp)* gp) <= tolStep ) {
return true; // depends on control dependency: [if], data = [none]
}
pLow = stp; // depends on control dependency: [if], data = [none]
fLow = fp; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static double Log(double x) {
double p, q, w, z;
double[] A =
{
8.11614167470508450300E-4,
-5.95061904284301438324E-4,
7.93650340457716943945E-4,
-2.77777777730099687205E-3,
8.33333333333331927722E-2
};
double[] B =
{
-1.37825152569120859100E3,
-3.88016315134637840924E4,
-3.31612992738871184744E5,
-1.16237097492762307383E6,
-1.72173700820839662146E6,
-8.53555664245765465627E5
};
double[] C =
{
-3.51815701436523470549E2,
-1.70642106651881159223E4,
-2.20528590553854454839E5,
-1.13933444367982507207E6,
-2.53252307177582951285E6,
-2.01889141433532773231E6
};
if (x < -34.0) {
q = -x;
w = Log(q);
p = Math.floor(q);
if (p == q) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
}
}
z = q - p;
if (z > 0.5) {
p += 1.0;
z = p - q;
}
z = q * Math.sin(Math.PI * z);
if (z == 0.0) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
}
}
z = Constants.LogPI - Math.log(z) - w;
return z;
}
if (x < 13.0) {
z = 1.0;
while (x >= 3.0) {
x -= 1.0;
z *= x;
}
while (x < 2.0) {
if (x == 0.0) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
}
}
z /= x;
x += 1.0;
}
if (z < 0.0) z = -z;
if (x == 2.0) return Math.log(z);
x -= 2.0;
p = x * Special.Polevl(x, B, 5) / Special.P1evl(x, C, 6);
return (Math.log(z) + p);
}
if (x > 2.556348e305) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
}
}
q = (x - 0.5) * Math.log(x) - x + 0.91893853320467274178;
if (x > 1.0e8) return (q);
p = 1.0 / (x * x);
if (x >= 1000.0) {
q += ((7.9365079365079365079365e-4 * p
- 2.7777777777777777777778e-3) * p
+ 0.0833333333333333333333) / x;
} else {
q += Special.Polevl(p, A, 4) / x;
}
return q;
} } | public class class_name {
public static double Log(double x) {
double p, q, w, z;
double[] A =
{
8.11614167470508450300E-4,
-5.95061904284301438324E-4,
7.93650340457716943945E-4,
-2.77777777730099687205E-3,
8.33333333333331927722E-2
};
double[] B =
{
-1.37825152569120859100E3,
-3.88016315134637840924E4,
-3.31612992738871184744E5,
-1.16237097492762307383E6,
-1.72173700820839662146E6,
-8.53555664245765465627E5
};
double[] C =
{
-3.51815701436523470549E2,
-1.70642106651881159223E4,
-2.20528590553854454839E5,
-1.13933444367982507207E6,
-2.53252307177582951285E6,
-2.01889141433532773231E6
};
if (x < -34.0) {
q = -x; // depends on control dependency: [if], data = [none]
w = Log(q); // depends on control dependency: [if], data = [none]
p = Math.floor(q); // depends on control dependency: [if], data = [none]
if (p == q) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
z = q - p; // depends on control dependency: [if], data = [none]
if (z > 0.5) {
p += 1.0; // depends on control dependency: [if], data = [none]
z = p - q; // depends on control dependency: [if], data = [none]
}
z = q * Math.sin(Math.PI * z); // depends on control dependency: [if], data = [none]
if (z == 0.0) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
z = Constants.LogPI - Math.log(z) - w; // depends on control dependency: [if], data = [none]
return z; // depends on control dependency: [if], data = [none]
}
if (x < 13.0) {
z = 1.0; // depends on control dependency: [if], data = [none]
while (x >= 3.0) {
x -= 1.0; // depends on control dependency: [while], data = [none]
z *= x; // depends on control dependency: [while], data = [none]
}
while (x < 2.0) {
if (x == 0.0) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
z /= x; // depends on control dependency: [while], data = [none]
x += 1.0; // depends on control dependency: [while], data = [none]
}
if (z < 0.0) z = -z;
if (x == 2.0) return Math.log(z);
x -= 2.0; // depends on control dependency: [if], data = [none]
p = x * Special.Polevl(x, B, 5) / Special.P1evl(x, C, 6); // depends on control dependency: [if], data = [(x]
return (Math.log(z) + p); // depends on control dependency: [if], data = [none]
}
if (x > 2.556348e305) {
try {
throw new ArithmeticException("Overflow.");
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
q = (x - 0.5) * Math.log(x) - x + 0.91893853320467274178;
if (x > 1.0e8) return (q);
p = 1.0 / (x * x);
if (x >= 1000.0) {
q += ((7.9365079365079365079365e-4 * p
- 2.7777777777777777777778e-3) * p
+ 0.0833333333333333333333) / x; // depends on control dependency: [if], data = [none]
} else {
q += Special.Polevl(p, A, 4) / x; // depends on control dependency: [if], data = [none]
}
return q;
} } |
public class class_name {
private static void moveElements(List<?> input, Collection<Object> output, int maxElements) {
for (int i = 0; i < maxElements; i++) {
output.add(input.remove(0));
}
} } | public class class_name {
private static void moveElements(List<?> input, Collection<Object> output, int maxElements) {
for (int i = 0; i < maxElements; i++) {
output.add(input.remove(0)); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public DescribeEntityAggregatesResult withEntityAggregates(EntityAggregate... entityAggregates) {
if (this.entityAggregates == null) {
setEntityAggregates(new java.util.ArrayList<EntityAggregate>(entityAggregates.length));
}
for (EntityAggregate ele : entityAggregates) {
this.entityAggregates.add(ele);
}
return this;
} } | public class class_name {
public DescribeEntityAggregatesResult withEntityAggregates(EntityAggregate... entityAggregates) {
if (this.entityAggregates == null) {
setEntityAggregates(new java.util.ArrayList<EntityAggregate>(entityAggregates.length)); // depends on control dependency: [if], data = [none]
}
for (EntityAggregate ele : entityAggregates) {
this.entityAggregates.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public java.util.List<VolumeStatusAction> getActions() {
if (actions == null) {
actions = new com.amazonaws.internal.SdkInternalList<VolumeStatusAction>();
}
return actions;
} } | public class class_name {
public java.util.List<VolumeStatusAction> getActions() {
if (actions == null) {
actions = new com.amazonaws.internal.SdkInternalList<VolumeStatusAction>(); // depends on control dependency: [if], data = [none]
}
return actions;
} } |
public class class_name {
@Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfExtension (@Nullable final String sExtension)
{
// Extension may be empty!
if (sExtension == null)
return null;
return m_aRWLock.readLocked ( () -> {
ICommonsList <MimeTypeInfo> ret = m_aMapExt.get (sExtension);
if (ret == null)
{
// Especially on Windows, sometimes file extensions like "JPG" can be
// found. Therefore also test for the lowercase version of the
// extension.
ret = m_aMapExt.get (sExtension.toLowerCase (Locale.US));
}
// Create a copy if present
return ret == null ? null : ret.getClone ();
});
} } | public class class_name {
@Nullable
@ReturnsMutableCopy
public ICommonsList <MimeTypeInfo> getAllInfosOfExtension (@Nullable final String sExtension)
{
// Extension may be empty!
if (sExtension == null)
return null;
return m_aRWLock.readLocked ( () -> {
ICommonsList <MimeTypeInfo> ret = m_aMapExt.get (sExtension);
if (ret == null)
{
// Especially on Windows, sometimes file extensions like "JPG" can be
// found. Therefore also test for the lowercase version of the
// extension.
ret = m_aMapExt.get (sExtension.toLowerCase (Locale.US)); // depends on control dependency: [if], data = [none]
}
// Create a copy if present
return ret == null ? null : ret.getClone ();
});
} } |
public class class_name {
private void removeBlocks(List<BlockInfo> blocks) {
if (blocks == null) {
return;
}
for (BlockInfo b : blocks) {
removeFromExcessReplicateMap(b);
neededReplications.remove(b, -1);
corruptReplicas.removeFromCorruptReplicasMap(b);
if (pendingReplications != null) {
int replicas = pendingReplications.getNumReplicas(b);
for (int i = 0; i < replicas; i++) {
pendingReplications.remove(b);
}
}
addToInvalidates(b, false);
blocksMap.removeBlock(b);
}
} } | public class class_name {
private void removeBlocks(List<BlockInfo> blocks) {
if (blocks == null) {
return; // depends on control dependency: [if], data = [none]
}
for (BlockInfo b : blocks) {
removeFromExcessReplicateMap(b); // depends on control dependency: [for], data = [b]
neededReplications.remove(b, -1); // depends on control dependency: [for], data = [b]
corruptReplicas.removeFromCorruptReplicasMap(b); // depends on control dependency: [for], data = [b]
if (pendingReplications != null) {
int replicas = pendingReplications.getNumReplicas(b);
for (int i = 0; i < replicas; i++) {
pendingReplications.remove(b); // depends on control dependency: [for], data = [none]
}
}
addToInvalidates(b, false); // depends on control dependency: [for], data = [b]
blocksMap.removeBlock(b); // depends on control dependency: [for], data = [b]
}
} } |
public class class_name {
public URI uri() {
String uri = newBuilder().reencodeForUri().toString();
try {
return new URI(uri);
} catch (URISyntaxException e) {
// Unlikely edge case: the URI has a forbidden character in the fragment. Strip it & retry.
try {
String stripped = uri.replaceAll("[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]", "");
return URI.create(stripped);
} catch (Exception e1) {
throw new RuntimeException(e); // Unexpected!
}
}
} } | public class class_name {
public URI uri() {
String uri = newBuilder().reencodeForUri().toString();
try {
return new URI(uri); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
// Unlikely edge case: the URI has a forbidden character in the fragment. Strip it & retry.
try {
String stripped = uri.replaceAll("[\\u0000-\\u001F\\u007F-\\u009F\\p{javaWhitespace}]", "");
return URI.create(stripped); // depends on control dependency: [try], data = [none]
} catch (Exception e1) {
throw new RuntimeException(e); // Unexpected!
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void stop() {
// return if not running
if (!running.compareAndSet(true, false)) {
return;
}
try {
runner.join();
} catch (InterruptedException e) {
throw new WebcamException("Joint interrupted");
}
LOG.debug("Discovery service has been stopped");
runner = null;
} } | public class class_name {
public void stop() {
// return if not running
if (!running.compareAndSet(true, false)) {
return; // depends on control dependency: [if], data = [none]
}
try {
runner.join(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new WebcamException("Joint interrupted");
} // depends on control dependency: [catch], data = [none]
LOG.debug("Discovery service has been stopped");
runner = null;
} } |
public class class_name {
public static Object newHashTable(int numEntries, float loadFactor) {
int hashSize = (int) Math.ceil((float) numEntries / loadFactor);
hashSize = 1 << (32 - Integer.numberOfLeadingZeros(hashSize)); // next
// power
// of 2
if (numEntries < 256) {
byte hashTable[] = new byte[hashSize];
Arrays.fill(hashTable, (byte) -1);
return hashTable;
}
if (numEntries < 65536) {
short hashTable[] = new short[hashSize];
Arrays.fill(hashTable, (short) -1);
return hashTable;
}
int hashTable[] = new int[hashSize];
Arrays.fill(hashTable, -1);
return hashTable;
} } | public class class_name {
public static Object newHashTable(int numEntries, float loadFactor) {
int hashSize = (int) Math.ceil((float) numEntries / loadFactor);
hashSize = 1 << (32 - Integer.numberOfLeadingZeros(hashSize)); // next
// power
// of 2
if (numEntries < 256) {
byte hashTable[] = new byte[hashSize];
Arrays.fill(hashTable, (byte) -1); // depends on control dependency: [if], data = [none]
return hashTable; // depends on control dependency: [if], data = [none]
}
if (numEntries < 65536) {
short hashTable[] = new short[hashSize];
Arrays.fill(hashTable, (short) -1); // depends on control dependency: [if], data = [none]
return hashTable; // depends on control dependency: [if], data = [none]
}
int hashTable[] = new int[hashSize];
Arrays.fill(hashTable, -1);
return hashTable;
} } |
public class class_name {
private void split(Map<Invariant, SortedSet<Integer>> invariants, Partition partition) {
int nonEmptyInvariants = invariants.keySet().size();
if (nonEmptyInvariants > 1) {
List<Invariant> invariantKeys =
new ArrayList<Invariant>(invariants.keySet());
partition.removeCell(currentBlockIndex);
int k = currentBlockIndex;
if (splitOrder == SplitOrder.REVERSE) {
Collections.sort(invariantKeys);
} else {
Collections.sort(invariantKeys, Collections.reverseOrder());
}
for (Invariant h : invariantKeys) {
SortedSet<Integer> setH = invariants.get(h);
partition.insertCell(k, setH);
blocksToRefine.add(setH);
k++;
}
// skip over the newly added blocks
currentBlockIndex += nonEmptyInvariants - 1;
}
} } | public class class_name {
private void split(Map<Invariant, SortedSet<Integer>> invariants, Partition partition) {
int nonEmptyInvariants = invariants.keySet().size();
if (nonEmptyInvariants > 1) {
List<Invariant> invariantKeys =
new ArrayList<Invariant>(invariants.keySet());
partition.removeCell(currentBlockIndex); // depends on control dependency: [if], data = [none]
int k = currentBlockIndex;
if (splitOrder == SplitOrder.REVERSE) {
Collections.sort(invariantKeys); // depends on control dependency: [if], data = [none]
} else {
Collections.sort(invariantKeys, Collections.reverseOrder()); // depends on control dependency: [if], data = [none]
}
for (Invariant h : invariantKeys) {
SortedSet<Integer> setH = invariants.get(h);
partition.insertCell(k, setH); // depends on control dependency: [for], data = [none]
blocksToRefine.add(setH); // depends on control dependency: [for], data = [none]
k++; // depends on control dependency: [for], data = [none]
}
// skip over the newly added blocks
currentBlockIndex += nonEmptyInvariants - 1; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void handleEOD(EncoderContext context, CharSequence buffer) {
try {
int count = buffer.length();
if (count == 0) {
return; //Already finished
}
if (count == 1) {
//Only an unlatch at the end
context.updateSymbolInfo();
int available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
int remaining = context.getRemainingCharacters();
// The following two lines are a hack inspired by the 'fix' from https://sourceforge.net/p/barcode4j/svn/221/
if (remaining > available) {
context.updateSymbolInfo(context.getCodewordCount() + 1);
available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
}
if (remaining <= available && available <= 2) {
return; //No unlatch
}
}
if (count > 4) {
throw new IllegalStateException("Count must not exceed 4");
}
int restChars = count - 1;
String encoded = encodeToCodewords(buffer, 0);
boolean endOfSymbolReached = !context.hasMoreCharacters();
boolean restInAscii = endOfSymbolReached && restChars <= 2;
if (restChars <= 2) {
context.updateSymbolInfo(context.getCodewordCount() + restChars);
int available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
if (available >= 3) {
restInAscii = false;
context.updateSymbolInfo(context.getCodewordCount() + encoded.length());
//available = context.symbolInfo.dataCapacity - context.getCodewordCount();
}
}
if (restInAscii) {
context.resetSymbolInfo();
context.pos -= restChars;
} else {
context.writeCodewords(encoded);
}
} finally {
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
}
} } | public class class_name {
private static void handleEOD(EncoderContext context, CharSequence buffer) {
try {
int count = buffer.length();
if (count == 0) {
return; //Already finished // depends on control dependency: [if], data = [none]
}
if (count == 1) {
//Only an unlatch at the end
context.updateSymbolInfo(); // depends on control dependency: [if], data = [none]
int available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
int remaining = context.getRemainingCharacters();
// The following two lines are a hack inspired by the 'fix' from https://sourceforge.net/p/barcode4j/svn/221/
if (remaining > available) {
context.updateSymbolInfo(context.getCodewordCount() + 1); // depends on control dependency: [if], data = [none]
available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount(); // depends on control dependency: [if], data = [none]
}
if (remaining <= available && available <= 2) {
return; //No unlatch // depends on control dependency: [if], data = [none]
}
}
if (count > 4) {
throw new IllegalStateException("Count must not exceed 4");
}
int restChars = count - 1;
String encoded = encodeToCodewords(buffer, 0);
boolean endOfSymbolReached = !context.hasMoreCharacters();
boolean restInAscii = endOfSymbolReached && restChars <= 2;
if (restChars <= 2) {
context.updateSymbolInfo(context.getCodewordCount() + restChars); // depends on control dependency: [if], data = [none]
int available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
if (available >= 3) {
restInAscii = false; // depends on control dependency: [if], data = [none]
context.updateSymbolInfo(context.getCodewordCount() + encoded.length()); // depends on control dependency: [if], data = [none]
//available = context.symbolInfo.dataCapacity - context.getCodewordCount();
}
}
if (restInAscii) {
context.resetSymbolInfo(); // depends on control dependency: [if], data = [none]
context.pos -= restChars; // depends on control dependency: [if], data = [none]
} else {
context.writeCodewords(encoded); // depends on control dependency: [if], data = [none]
}
} finally {
context.signalEncoderChange(HighLevelEncoder.ASCII_ENCODATION);
}
} } |
public class class_name {
public static long incThreeBytePrimaryByOffset(long basePrimary, boolean isCompressible,
int offset) {
// Extract the third byte, minus the minimum byte value,
// plus the offset, modulo the number of usable byte values, plus the minimum.
offset += ((int)(basePrimary >> 8) & 0xff) - 2;
long primary = ((offset % 254) + 2) << 8;
offset /= 254;
// Same with the second byte,
// but reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary.
if(isCompressible) {
offset += ((int)(basePrimary >> 16) & 0xff) - 4;
primary |= ((offset % 251) + 4) << 16;
offset /= 251;
} else {
offset += ((int)(basePrimary >> 16) & 0xff) - 2;
primary |= ((offset % 254) + 2) << 16;
offset /= 254;
}
// First byte, assume no further overflow.
return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24));
} } | public class class_name {
public static long incThreeBytePrimaryByOffset(long basePrimary, boolean isCompressible,
int offset) {
// Extract the third byte, minus the minimum byte value,
// plus the offset, modulo the number of usable byte values, plus the minimum.
offset += ((int)(basePrimary >> 8) & 0xff) - 2;
long primary = ((offset % 254) + 2) << 8;
offset /= 254;
// Same with the second byte,
// but reserve the PRIMARY_COMPRESSION_LOW_BYTE and high byte if necessary.
if(isCompressible) {
offset += ((int)(basePrimary >> 16) & 0xff) - 4; // depends on control dependency: [if], data = [none]
primary |= ((offset % 251) + 4) << 16; // depends on control dependency: [if], data = [none]
offset /= 251; // depends on control dependency: [if], data = [none]
} else {
offset += ((int)(basePrimary >> 16) & 0xff) - 2; // depends on control dependency: [if], data = [none]
primary |= ((offset % 254) + 2) << 16; // depends on control dependency: [if], data = [none]
offset /= 254; // depends on control dependency: [if], data = [none]
}
// First byte, assume no further overflow.
return primary | ((basePrimary & 0xff000000L) + ((long)offset << 24));
} } |
public class class_name {
public static void elementPower(DMatrixD1 A , double b, DMatrixD1 C ) {
if( A.numRows != C.numRows || A.numCols != C.numCols ) {
throw new MatrixDimensionException("All matrices must be the same shape");
}
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
C.data[i] = Math.pow(A.data[i], b);
}
} } | public class class_name {
public static void elementPower(DMatrixD1 A , double b, DMatrixD1 C ) {
if( A.numRows != C.numRows || A.numCols != C.numCols ) {
throw new MatrixDimensionException("All matrices must be the same shape");
}
int size = A.getNumElements();
for( int i = 0; i < size; i++ ) {
C.data[i] = Math.pow(A.data[i], b); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected static final Tree toTree(Object object) {
if (object == null) {
return new Tree((Tree) null, null, null);
}
if (object instanceof Tree) {
return (Tree) object;
}
if (object instanceof Map) {
return new Tree((Map<String, Object>) object);
}
return new Tree((Tree) null, null, object);
} } | public class class_name {
@SuppressWarnings("unchecked")
protected static final Tree toTree(Object object) {
if (object == null) {
return new Tree((Tree) null, null, null);
// depends on control dependency: [if], data = [null)]
}
if (object instanceof Tree) {
return (Tree) object;
// depends on control dependency: [if], data = [none]
}
if (object instanceof Map) {
return new Tree((Map<String, Object>) object);
// depends on control dependency: [if], data = [none]
}
return new Tree((Tree) null, null, object);
} } |
public class class_name {
public Object [] getChildren(Object parent) {
if (parent == invisibleRoot) {
return ((TreeParent)invisibleRoot).getChildren();
} else if (parent instanceof TreeParent) {
return manager.getChildren(parent);
}
return new Object[0];
} } | public class class_name {
public Object [] getChildren(Object parent) {
if (parent == invisibleRoot) {
return ((TreeParent)invisibleRoot).getChildren(); // depends on control dependency: [if], data = [invisibleRoot)]
} else if (parent instanceof TreeParent) {
return manager.getChildren(parent); // depends on control dependency: [if], data = [none]
}
return new Object[0];
} } |
public class class_name {
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Plugin loading happens only once on Jenkins startup")
protected @Nonnull Set<String> loadPluginsFromWar(@Nonnull String fromPath, @CheckForNull FilenameFilter filter) {
Set<String> names = new HashSet();
ServletContext context = Jenkins.getActiveInstance().servletContext;
Set<String> plugins = Util.fixNull((Set<String>) context.getResourcePaths(fromPath));
Set<URL> copiedPlugins = new HashSet<>();
Set<URL> dependencies = new HashSet<>();
for( String pluginPath : plugins) {
String fileName = pluginPath.substring(pluginPath.lastIndexOf('/')+1);
if(fileName.length()==0) {
// see http://www.nabble.com/404-Not-Found-error-when-clicking-on-help-td24508544.html
// I suspect some containers are returning directory names.
continue;
}
try {
URL url = context.getResource(pluginPath);
if (filter != null && url != null) {
if (!filter.accept(new File(url.getFile()).getParentFile(), fileName)) {
continue;
}
}
names.add(fileName);
copyBundledPlugin(url, fileName);
copiedPlugins.add(url);
try {
addDependencies(url, fromPath, dependencies);
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to resolve dependencies for the bundled plugin " + fileName, e);
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e);
}
}
// Copy dependencies. These are not detached plugins, but are required by them.
for (URL dependency : dependencies) {
if (copiedPlugins.contains(dependency)) {
// Ignore. Already copied.
continue;
}
String fileName = new File(dependency.getFile()).getName();
try {
names.add(fileName);
copyBundledPlugin(dependency, fileName);
copiedPlugins.add(dependency);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled dependency plugin " + fileName, e);
}
}
return names;
} } | public class class_name {
@SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "Plugin loading happens only once on Jenkins startup")
protected @Nonnull Set<String> loadPluginsFromWar(@Nonnull String fromPath, @CheckForNull FilenameFilter filter) {
Set<String> names = new HashSet();
ServletContext context = Jenkins.getActiveInstance().servletContext;
Set<String> plugins = Util.fixNull((Set<String>) context.getResourcePaths(fromPath));
Set<URL> copiedPlugins = new HashSet<>();
Set<URL> dependencies = new HashSet<>();
for( String pluginPath : plugins) {
String fileName = pluginPath.substring(pluginPath.lastIndexOf('/')+1);
if(fileName.length()==0) {
// see http://www.nabble.com/404-Not-Found-error-when-clicking-on-help-td24508544.html
// I suspect some containers are returning directory names.
continue;
}
try {
URL url = context.getResource(pluginPath);
if (filter != null && url != null) {
if (!filter.accept(new File(url.getFile()).getParentFile(), fileName)) {
continue;
}
}
names.add(fileName); // depends on control dependency: [try], data = [none]
copyBundledPlugin(url, fileName); // depends on control dependency: [try], data = [none]
copiedPlugins.add(url); // depends on control dependency: [try], data = [none]
try {
addDependencies(url, fromPath, dependencies); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Failed to resolve dependencies for the bundled plugin " + fileName, e);
} // depends on control dependency: [catch], data = [none]
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e);
} // depends on control dependency: [catch], data = [none]
}
// Copy dependencies. These are not detached plugins, but are required by them.
for (URL dependency : dependencies) {
if (copiedPlugins.contains(dependency)) {
// Ignore. Already copied.
continue;
}
String fileName = new File(dependency.getFile()).getName();
try {
names.add(fileName); // depends on control dependency: [try], data = [none]
copyBundledPlugin(dependency, fileName); // depends on control dependency: [try], data = [none]
copiedPlugins.add(dependency); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled dependency plugin " + fileName, e);
} // depends on control dependency: [catch], data = [none]
}
return names;
} } |
public class class_name {
protected void deleteChildExecutions(ExecutionEntity parentExecution, boolean deleteExecution, CommandContext commandContext) {
// Delete all child executions
ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId());
if (CollectionUtil.isNotEmpty(childExecutions)) {
for (ExecutionEntity childExecution : childExecutions) {
deleteChildExecutions(childExecution, true, commandContext);
}
}
if (deleteExecution) {
executionEntityManager.deleteExecutionAndRelatedData(parentExecution, null, false);
}
} } | public class class_name {
protected void deleteChildExecutions(ExecutionEntity parentExecution, boolean deleteExecution, CommandContext commandContext) {
// Delete all child executions
ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
Collection<ExecutionEntity> childExecutions = executionEntityManager.findChildExecutionsByParentExecutionId(parentExecution.getId());
if (CollectionUtil.isNotEmpty(childExecutions)) {
for (ExecutionEntity childExecution : childExecutions) {
deleteChildExecutions(childExecution, true, commandContext); // depends on control dependency: [for], data = [childExecution]
}
}
if (deleteExecution) {
executionEntityManager.deleteExecutionAndRelatedData(parentExecution, null, false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private List<Locale> initWorkplaceLocales(CmsObject cms) {
Set<Locale> locales = new HashSet<Locale>();
// collect locales from the VFS
if (cms.existsResource(CmsWorkplace.VFS_PATH_LOCALES)) {
List<CmsResource> localeFolders;
try {
localeFolders = cms.getSubFolders(CmsWorkplace.VFS_PATH_LOCALES);
} catch (CmsException e) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_WORKPLACE_INIT_NO_LOCALES_1,
CmsWorkplace.VFS_PATH_LOCALES),
e);
// can not throw exception here since then OpenCms would not even start in shell mode (runlevel 2)
localeFolders = new ArrayList<CmsResource>();
}
Iterator<CmsResource> i = localeFolders.iterator();
while (i.hasNext()) {
CmsFolder folder = (CmsFolder)i.next();
Locale locale = CmsLocaleManager.getLocale(folder.getName());
// add locale
locales.add(locale);
// add less specialized locale
locales.add(new Locale(locale.getLanguage(), locale.getCountry()));
// add even less specialized locale
locales.add(new Locale(locale.getLanguage()));
}
}
// collect locales from JAR manifests
try {
Enumeration<URL> resources = getClass().getClassLoader().getResources(MANIFEST_RESOURCE_NAME);
while (resources.hasMoreElements()) {
URL resUrl = resources.nextElement();
try {
Manifest manifest = new Manifest(resUrl.openStream());
String localeString = manifest.getMainAttributes().getValue(LOCALIZATION_ATTRIBUTE_NAME);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(localeString)) {
Locale locale = CmsLocaleManager.getLocale(localeString);
// add locale
locales.add(locale);
// add less specialized locale
locales.add(new Locale(locale.getLanguage(), locale.getCountry()));
// add even less specialized locale
locales.add(new Locale(locale.getLanguage()));
}
} catch (IOException e) {
LOG.warn(
"Error reading manifest from " + resUrl + " while evaluating available workplace localization.",
e);
}
}
} catch (IOException e) {
LOG.error("Error evaluating available workplace localization from JAR manifests.", e);
}
// sort the result
ArrayList<Locale> result = new ArrayList<Locale>();
result.addAll(locales);
Collections.sort(result, CmsLocaleComparator.getComparator());
return result;
} } | public class class_name {
private List<Locale> initWorkplaceLocales(CmsObject cms) {
Set<Locale> locales = new HashSet<Locale>();
// collect locales from the VFS
if (cms.existsResource(CmsWorkplace.VFS_PATH_LOCALES)) {
List<CmsResource> localeFolders;
try {
localeFolders = cms.getSubFolders(CmsWorkplace.VFS_PATH_LOCALES); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.warn(
Messages.get().getBundle().key(
Messages.LOG_WORKPLACE_INIT_NO_LOCALES_1,
CmsWorkplace.VFS_PATH_LOCALES),
e);
// can not throw exception here since then OpenCms would not even start in shell mode (runlevel 2)
localeFolders = new ArrayList<CmsResource>();
} // depends on control dependency: [catch], data = [none]
Iterator<CmsResource> i = localeFolders.iterator();
while (i.hasNext()) {
CmsFolder folder = (CmsFolder)i.next();
Locale locale = CmsLocaleManager.getLocale(folder.getName());
// add locale
locales.add(locale); // depends on control dependency: [while], data = [none]
// add less specialized locale
locales.add(new Locale(locale.getLanguage(), locale.getCountry())); // depends on control dependency: [while], data = [none]
// add even less specialized locale
locales.add(new Locale(locale.getLanguage())); // depends on control dependency: [while], data = [none]
}
}
// collect locales from JAR manifests
try {
Enumeration<URL> resources = getClass().getClassLoader().getResources(MANIFEST_RESOURCE_NAME);
while (resources.hasMoreElements()) {
URL resUrl = resources.nextElement();
try {
Manifest manifest = new Manifest(resUrl.openStream());
String localeString = manifest.getMainAttributes().getValue(LOCALIZATION_ATTRIBUTE_NAME);
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(localeString)) {
Locale locale = CmsLocaleManager.getLocale(localeString);
// add locale
locales.add(locale); // depends on control dependency: [if], data = [none]
// add less specialized locale
locales.add(new Locale(locale.getLanguage(), locale.getCountry())); // depends on control dependency: [if], data = [none]
// add even less specialized locale
locales.add(new Locale(locale.getLanguage())); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.warn(
"Error reading manifest from " + resUrl + " while evaluating available workplace localization.",
e);
} // depends on control dependency: [catch], data = [none]
}
} catch (IOException e) {
LOG.error("Error evaluating available workplace localization from JAR manifests.", e);
} // depends on control dependency: [catch], data = [none]
// sort the result
ArrayList<Locale> result = new ArrayList<Locale>();
result.addAll(locales);
Collections.sort(result, CmsLocaleComparator.getComparator());
return result;
} } |
public class class_name {
protected void discover(final Mapper mapper) {
for (final Class<? extends Annotation> clazz : INTERESTING) {
addAnnotation(clazz);
}
//type must be discovered before the constructor.
discoverType(mapper);
constructor = discoverConstructor();
discoverMultivalued();
// check the main type
isMongoType = ReflectionUtils.isPropertyType(realType);
// if the main type isn't supported by the Mongo, see if the subtype is.
// works for T[], List<T>, Map<?, T>, where T is Long/String/etc.
if (!isMongoType && subType != null) {
isMongoType = ReflectionUtils.isPropertyType(subType);
}
if (!isMongoType && !isSingleValue && (subType == null || subType == Object.class)) {
if (LOG.isWarnEnabled() && !mapper.getConverters().hasDbObjectConverter(this)) {
LOG.warn(format("The multi-valued field '%s' is a possible heterogeneous collection. It cannot be verified. "
+ "Please declare a valid type to get rid of this warning. %s", getFullName(), subType));
}
isMongoType = true;
}
} } | public class class_name {
protected void discover(final Mapper mapper) {
for (final Class<? extends Annotation> clazz : INTERESTING) {
addAnnotation(clazz); // depends on control dependency: [for], data = [clazz]
}
//type must be discovered before the constructor.
discoverType(mapper);
constructor = discoverConstructor();
discoverMultivalued();
// check the main type
isMongoType = ReflectionUtils.isPropertyType(realType);
// if the main type isn't supported by the Mongo, see if the subtype is.
// works for T[], List<T>, Map<?, T>, where T is Long/String/etc.
if (!isMongoType && subType != null) {
isMongoType = ReflectionUtils.isPropertyType(subType); // depends on control dependency: [if], data = [none]
}
if (!isMongoType && !isSingleValue && (subType == null || subType == Object.class)) {
if (LOG.isWarnEnabled() && !mapper.getConverters().hasDbObjectConverter(this)) {
LOG.warn(format("The multi-valued field '%s' is a possible heterogeneous collection. It cannot be verified. "
+ "Please declare a valid type to get rid of this warning. %s", getFullName(), subType)); // depends on control dependency: [if], data = [none]
}
isMongoType = true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(ListStateMachinesRequest listStateMachinesRequest, ProtocolMarshaller protocolMarshaller) {
if (listStateMachinesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listStateMachinesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listStateMachinesRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListStateMachinesRequest listStateMachinesRequest, ProtocolMarshaller protocolMarshaller) {
if (listStateMachinesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listStateMachinesRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listStateMachinesRequest.getNextToken(), NEXTTOKEN_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 boolean isAllowed(String contextPath, String uri, String method,
Authentication authentication) {
Assert.notNull(uri, "uri parameter is required");
FilterInvocation fi = new FilterInvocation(contextPath, uri, method);
Collection<ConfigAttribute> attrs = securityInterceptor
.obtainSecurityMetadataSource().getAttributes(fi);
if (attrs == null) {
if (securityInterceptor.isRejectPublicInvocations()) {
return false;
}
return true;
}
if (authentication == null) {
return false;
}
try {
securityInterceptor.getAccessDecisionManager().decide(authentication, fi,
attrs);
}
catch (AccessDeniedException unauthorized) {
if (logger.isDebugEnabled()) {
logger.debug(fi.toString() + " denied for " + authentication.toString(),
unauthorized);
}
return false;
}
return true;
} } | public class class_name {
public boolean isAllowed(String contextPath, String uri, String method,
Authentication authentication) {
Assert.notNull(uri, "uri parameter is required");
FilterInvocation fi = new FilterInvocation(contextPath, uri, method);
Collection<ConfigAttribute> attrs = securityInterceptor
.obtainSecurityMetadataSource().getAttributes(fi);
if (attrs == null) {
if (securityInterceptor.isRejectPublicInvocations()) {
return false; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
if (authentication == null) {
return false; // depends on control dependency: [if], data = [none]
}
try {
securityInterceptor.getAccessDecisionManager().decide(authentication, fi,
attrs); // depends on control dependency: [try], data = [none]
}
catch (AccessDeniedException unauthorized) {
if (logger.isDebugEnabled()) {
logger.debug(fi.toString() + " denied for " + authentication.toString(),
unauthorized); // depends on control dependency: [if], data = [none]
}
return false;
} // depends on control dependency: [catch], data = [none]
return true;
} } |
public class class_name {
public void visitPubapi(Element e) {
Name n = ((ClassSymbol)e).fullname;
Name p = ((ClassSymbol)e).packge().fullname;
StringBuffer sb = publicApiPerClass.get(n);
assert(sb == null);
sb = new StringBuffer();
PubapiVisitor v = new PubapiVisitor(sb);
v.visit(e);
if (sb.length()>0) {
publicApiPerClass.put(n, sb);
}
explicitPackages.add(p);
} } | public class class_name {
public void visitPubapi(Element e) {
Name n = ((ClassSymbol)e).fullname;
Name p = ((ClassSymbol)e).packge().fullname;
StringBuffer sb = publicApiPerClass.get(n);
assert(sb == null);
sb = new StringBuffer();
PubapiVisitor v = new PubapiVisitor(sb);
v.visit(e);
if (sb.length()>0) {
publicApiPerClass.put(n, sb); // depends on control dependency: [if], data = [none]
}
explicitPackages.add(p);
} } |
public class class_name {
private Map<String, String> getDependenciesFromJson(JSONObject json, String keyJson) {
Map<String, String> nameVersionMap = new HashMap<>();
if (json.has(keyJson)) {
JSONObject optionals = json.getJSONObject(keyJson);
Iterator<String> keys = optionals.keys();
while (keys.hasNext()) {
String key = keys.next();
nameVersionMap.put(key, optionals.getString(key));
}
}
return nameVersionMap;
} } | public class class_name {
private Map<String, String> getDependenciesFromJson(JSONObject json, String keyJson) {
Map<String, String> nameVersionMap = new HashMap<>();
if (json.has(keyJson)) {
JSONObject optionals = json.getJSONObject(keyJson);
Iterator<String> keys = optionals.keys();
while (keys.hasNext()) {
String key = keys.next();
nameVersionMap.put(key, optionals.getString(key)); // depends on control dependency: [while], data = [none]
}
}
return nameVersionMap;
} } |
public class class_name {
public static void configureProtocolHandler() {
final String pkgs = System.getProperty("java.protocol.handler.pkgs");
String newValue = "org.mapfish.print.url";
if (pkgs != null && !pkgs.contains(newValue)) {
newValue = newValue + "|" + pkgs;
} else if (pkgs != null) {
newValue = pkgs;
}
System.setProperty("java.protocol.handler.pkgs", newValue);
} } | public class class_name {
public static void configureProtocolHandler() {
final String pkgs = System.getProperty("java.protocol.handler.pkgs");
String newValue = "org.mapfish.print.url";
if (pkgs != null && !pkgs.contains(newValue)) {
newValue = newValue + "|" + pkgs; // depends on control dependency: [if], data = [none]
} else if (pkgs != null) {
newValue = pkgs; // depends on control dependency: [if], data = [none]
}
System.setProperty("java.protocol.handler.pkgs", newValue);
} } |
public class class_name {
protected void updatePatternSet(PatternSet value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleLists(innerCount, root, value.getIncludes(), "includes", "include");
findAndReplaceSimpleLists(innerCount, root, value.getExcludes(), "excludes", "exclude");
}
} } | public class class_name {
protected void updatePatternSet(PatternSet value, String xmlTag, Counter counter, Element element)
{
boolean shouldExist = value != null;
Element root = updateElement(counter, element, xmlTag, shouldExist);
if (shouldExist)
{
Counter innerCount = new Counter(counter.getDepth() + 1);
findAndReplaceSimpleLists(innerCount, root, value.getIncludes(), "includes", "include"); // depends on control dependency: [if], data = [none]
findAndReplaceSimpleLists(innerCount, root, value.getExcludes(), "excludes", "exclude"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getSuperClientName()
{
ClassType superType = _clientDecl.getSuperclass();
while ( superType != null )
{
ClassDeclaration superDecl = superType.getDeclaration();
Collection<FieldDeclaration> declaredFields = superDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
{
// Found an @control annotated field, so return this class name
return superDecl.getQualifiedName();
}
}
superType = superType.getSuperclass();
}
return null;
} } | public class class_name {
public String getSuperClientName()
{
ClassType superType = _clientDecl.getSuperclass();
while ( superType != null )
{
ClassDeclaration superDecl = superType.getDeclaration();
Collection<FieldDeclaration> declaredFields = superDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
{
// Found an @control annotated field, so return this class name
return superDecl.getQualifiedName(); // depends on control dependency: [if], data = [none]
}
}
superType = superType.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public static ArrayList<String> toList( String[] array )
{
if( array == null )
{
return new ArrayList<String>( 0 );
}
ArrayList<String> list = new ArrayList<String>( array.length );
for (String s : array)
{
list.add( s );
}
return list;
} } | public class class_name {
public static ArrayList<String> toList( String[] array )
{
if( array == null )
{
return new ArrayList<String>( 0 );
// depends on control dependency: [if], data = [none]
}
ArrayList<String> list = new ArrayList<String>( array.length );
for (String s : array)
{
list.add( s );
// depends on control dependency: [for], data = [s]
}
return list;
} } |
public class class_name {
public DBCluster withDBClusterMembers(DBClusterMember... dBClusterMembers) {
if (this.dBClusterMembers == null) {
setDBClusterMembers(new java.util.ArrayList<DBClusterMember>(dBClusterMembers.length));
}
for (DBClusterMember ele : dBClusterMembers) {
this.dBClusterMembers.add(ele);
}
return this;
} } | public class class_name {
public DBCluster withDBClusterMembers(DBClusterMember... dBClusterMembers) {
if (this.dBClusterMembers == null) {
setDBClusterMembers(new java.util.ArrayList<DBClusterMember>(dBClusterMembers.length)); // depends on control dependency: [if], data = [none]
}
for (DBClusterMember ele : dBClusterMembers) {
this.dBClusterMembers.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static String stripTrailingChar(final String string, final char c) {
if (string.length() > 0) {
if (string.charAt(string.length() - 1) == c) {
return string.substring(0, string.length() - 1);
}
}
return string;
} } | public class class_name {
public static String stripTrailingChar(final String string, final char c) {
if (string.length() > 0) {
if (string.charAt(string.length() - 1) == c) {
return string.substring(0, string.length() - 1); // depends on control dependency: [if], data = [none]
}
}
return string;
} } |
public class class_name {
static ObjectStreamClass lookupStreamClass(Class<?> cl) {
WeakHashMap<Class<?>, ObjectStreamClass> tlc = getCache();
ObjectStreamClass cachedValue = tlc.get(cl);
if (cachedValue == null) {
cachedValue = createClassDesc(cl);
tlc.put(cl, cachedValue);
}
return cachedValue;
} } | public class class_name {
static ObjectStreamClass lookupStreamClass(Class<?> cl) {
WeakHashMap<Class<?>, ObjectStreamClass> tlc = getCache();
ObjectStreamClass cachedValue = tlc.get(cl);
if (cachedValue == null) {
cachedValue = createClassDesc(cl); // depends on control dependency: [if], data = [none]
tlc.put(cl, cachedValue); // depends on control dependency: [if], data = [none]
}
return cachedValue;
} } |
public class class_name {
public static String expand(
String pathUri, Object parameters, boolean addUnusedParamsAsQueryParams) {
Map<String, Object> variableMap = getMap(parameters);
StringBuilder pathBuf = new StringBuilder();
int cur = 0;
int length = pathUri.length();
while (cur < length) {
int next = pathUri.indexOf('{', cur);
if (next == -1) {
if (cur == 0 && !addUnusedParamsAsQueryParams) {
// No expansions exist and we do not need to add any query parameters.
return pathUri;
}
pathBuf.append(pathUri.substring(cur));
break;
}
pathBuf.append(pathUri.substring(cur, next));
int close = pathUri.indexOf('}', next + 2);
cur = close + 1;
String templates = pathUri.substring(next + 1, close);
CompositeOutput compositeOutput = getCompositeOutput(templates);
ListIterator<String> templateIterator =
Splitter.on(',').splitToList(templates).listIterator();
boolean isFirstParameter = true;
while (templateIterator.hasNext()) {
String template = templateIterator.next();
boolean containsExplodeModifier = template.endsWith("*");
int varNameStartIndex =
templateIterator.nextIndex() == 1 ? compositeOutput.getVarNameStartIndex() : 0;
int varNameEndIndex = template.length();
if (containsExplodeModifier) {
// The expression contains an explode modifier '*' at the end, update end index.
varNameEndIndex = varNameEndIndex - 1;
}
// Now get varName devoid of any prefixes and explode modifiers.
String varName = template.substring(varNameStartIndex, varNameEndIndex);
Object value = variableMap.remove(varName);
if (value == null) {
// The value for this variable is undefined. continue with the next template.
continue;
}
if (!isFirstParameter) {
pathBuf.append(compositeOutput.getExplodeJoiner());
} else {
pathBuf.append(compositeOutput.getOutputPrefix());
isFirstParameter = false;
}
if (value instanceof Iterator<?>) {
// Get the list property value.
Iterator<?> iterator = (Iterator<?>) value;
value = getListPropertyValue(varName, iterator, containsExplodeModifier, compositeOutput);
} else if (value instanceof Iterable<?> || value.getClass().isArray()) {
// Get the list property value.
Iterator<?> iterator = Types.iterableOf(value).iterator();
value = getListPropertyValue(varName, iterator, containsExplodeModifier, compositeOutput);
} else if (value.getClass().isEnum()) {
String name = FieldInfo.of((Enum<?>) value).getName();
value = getSimpleValue(varName, name != null ? name : value.toString(), compositeOutput);
} else if (!Data.isValueOfPrimitiveType(value)) {
// Parse the value as a key/value map.
Map<String, Object> map = getMap(value);
value = getMapPropertyValue(varName, map, containsExplodeModifier, compositeOutput);
} else {
// For everything else...
value = getSimpleValue(varName, value.toString(), compositeOutput);
}
pathBuf.append(value);
}
}
if (addUnusedParamsAsQueryParams) {
// Add the parameters remaining in the variableMap as query parameters.
GenericUrl.addQueryParams(variableMap.entrySet(), pathBuf);
}
return pathBuf.toString();
} } | public class class_name {
public static String expand(
String pathUri, Object parameters, boolean addUnusedParamsAsQueryParams) {
Map<String, Object> variableMap = getMap(parameters);
StringBuilder pathBuf = new StringBuilder();
int cur = 0;
int length = pathUri.length();
while (cur < length) {
int next = pathUri.indexOf('{', cur);
if (next == -1) {
if (cur == 0 && !addUnusedParamsAsQueryParams) {
// No expansions exist and we do not need to add any query parameters.
return pathUri; // depends on control dependency: [if], data = [none]
}
pathBuf.append(pathUri.substring(cur)); // depends on control dependency: [if], data = [none]
break;
}
pathBuf.append(pathUri.substring(cur, next)); // depends on control dependency: [while], data = [(cur]
int close = pathUri.indexOf('}', next + 2);
cur = close + 1; // depends on control dependency: [while], data = [none]
String templates = pathUri.substring(next + 1, close);
CompositeOutput compositeOutput = getCompositeOutput(templates);
ListIterator<String> templateIterator =
Splitter.on(',').splitToList(templates).listIterator();
boolean isFirstParameter = true;
while (templateIterator.hasNext()) {
String template = templateIterator.next();
boolean containsExplodeModifier = template.endsWith("*");
int varNameStartIndex =
templateIterator.nextIndex() == 1 ? compositeOutput.getVarNameStartIndex() : 0;
int varNameEndIndex = template.length();
if (containsExplodeModifier) {
// The expression contains an explode modifier '*' at the end, update end index.
varNameEndIndex = varNameEndIndex - 1; // depends on control dependency: [if], data = [none]
}
// Now get varName devoid of any prefixes and explode modifiers.
String varName = template.substring(varNameStartIndex, varNameEndIndex);
Object value = variableMap.remove(varName);
if (value == null) {
// The value for this variable is undefined. continue with the next template.
continue;
}
if (!isFirstParameter) {
pathBuf.append(compositeOutput.getExplodeJoiner()); // depends on control dependency: [if], data = [none]
} else {
pathBuf.append(compositeOutput.getOutputPrefix()); // depends on control dependency: [if], data = [none]
isFirstParameter = false; // depends on control dependency: [if], data = [none]
}
if (value instanceof Iterator<?>) {
// Get the list property value.
Iterator<?> iterator = (Iterator<?>) value;
value = getListPropertyValue(varName, iterator, containsExplodeModifier, compositeOutput); // depends on control dependency: [if], data = [)]
} else if (value instanceof Iterable<?> || value.getClass().isArray()) {
// Get the list property value.
Iterator<?> iterator = Types.iterableOf(value).iterator();
value = getListPropertyValue(varName, iterator, containsExplodeModifier, compositeOutput); // depends on control dependency: [if], data = [none]
} else if (value.getClass().isEnum()) {
String name = FieldInfo.of((Enum<?>) value).getName();
value = getSimpleValue(varName, name != null ? name : value.toString(), compositeOutput); // depends on control dependency: [if], data = [none]
} else if (!Data.isValueOfPrimitiveType(value)) {
// Parse the value as a key/value map.
Map<String, Object> map = getMap(value);
value = getMapPropertyValue(varName, map, containsExplodeModifier, compositeOutput); // depends on control dependency: [if], data = [none]
} else {
// For everything else...
value = getSimpleValue(varName, value.toString(), compositeOutput); // depends on control dependency: [if], data = [none]
}
pathBuf.append(value); // depends on control dependency: [while], data = [none]
}
}
if (addUnusedParamsAsQueryParams) {
// Add the parameters remaining in the variableMap as query parameters.
GenericUrl.addQueryParams(variableMap.entrySet(), pathBuf); // depends on control dependency: [if], data = [none]
}
return pathBuf.toString();
} } |
public class class_name {
public static base_responses disable(nitro_service client, Long clid[]) throws Exception {
base_responses result = null;
if (clid != null && clid.length > 0) {
clusterinstance disableresources[] = new clusterinstance[clid.length];
for (int i=0;i<clid.length;i++){
disableresources[i] = new clusterinstance();
disableresources[i].clid = clid[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } | public class class_name {
public static base_responses disable(nitro_service client, Long clid[]) throws Exception {
base_responses result = null;
if (clid != null && clid.length > 0) {
clusterinstance disableresources[] = new clusterinstance[clid.length];
for (int i=0;i<clid.length;i++){
disableresources[i] = new clusterinstance(); // depends on control dependency: [for], data = [i]
disableresources[i].clid = clid[i]; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} } |
public class class_name {
private KamNode wrapNode(KamNode kamNode) {
if (kamNode == null) {
return null;
}
TermParameter param = ntp.get(kamNode.getId());
if (param != null) {
return new OrthologousNode(kamNode, param);
}
return kamNode;
} } | public class class_name {
private KamNode wrapNode(KamNode kamNode) {
if (kamNode == null) {
return null; // depends on control dependency: [if], data = [none]
}
TermParameter param = ntp.get(kamNode.getId());
if (param != null) {
return new OrthologousNode(kamNode, param); // depends on control dependency: [if], data = [none]
}
return kamNode;
} } |
public class class_name {
public static void addAlgorithm(StructureAlignment alg) {
//ensure uniqueness
try {
getAlgorithm(alg.getAlgorithmName());
// algorithm was found. Do nothing.
} catch(StructureException e) {
// no algorithm found, so it's new
algorithms.add(alg);
}
} } | public class class_name {
public static void addAlgorithm(StructureAlignment alg) {
//ensure uniqueness
try {
getAlgorithm(alg.getAlgorithmName()); // depends on control dependency: [try], data = [none]
// algorithm was found. Do nothing.
} catch(StructureException e) {
// no algorithm found, so it's new
algorithms.add(alg);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setBindingsSLO(Collection<String> bindingsSLO) {
if (bindingsSLO == null) {
this.bindingsSLO = Collections.emptyList();
} else {
this.bindingsSLO = bindingsSLO;
}
} } | public class class_name {
public void setBindingsSLO(Collection<String> bindingsSLO) {
if (bindingsSLO == null) {
this.bindingsSLO = Collections.emptyList(); // depends on control dependency: [if], data = [none]
} else {
this.bindingsSLO = bindingsSLO; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ClientConfig setFlakeIdGeneratorConfigMap(Map<String, ClientFlakeIdGeneratorConfig> map) {
Preconditions.isNotNull(map, "flakeIdGeneratorConfigMap");
flakeIdGeneratorConfigMap.clear();
flakeIdGeneratorConfigMap.putAll(map);
for (Entry<String, ClientFlakeIdGeneratorConfig> entry : map.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} } | public class class_name {
public ClientConfig setFlakeIdGeneratorConfigMap(Map<String, ClientFlakeIdGeneratorConfig> map) {
Preconditions.isNotNull(map, "flakeIdGeneratorConfigMap");
flakeIdGeneratorConfigMap.clear();
flakeIdGeneratorConfigMap.putAll(map);
for (Entry<String, ClientFlakeIdGeneratorConfig> entry : map.entrySet()) {
entry.getValue().setName(entry.getKey()); // depends on control dependency: [for], data = [entry]
}
return this;
} } |
public class class_name {
public void printHtmlClassInfo(PrintWriter out, String strTag, String strParams, String strData)
{
String strClass = ((BasePanel)this.getRecordOwner()).getProperty("name");
if (strClass != null) if (strClass.length() > 0)
if (strData != null) if (strData.length() > 0)
{
this.parseHtmlClassInfo(out, strTag, strParams, strData, strClass);
}
} } | public class class_name {
public void printHtmlClassInfo(PrintWriter out, String strTag, String strParams, String strData)
{
String strClass = ((BasePanel)this.getRecordOwner()).getProperty("name");
if (strClass != null) if (strClass.length() > 0)
if (strData != null) if (strData.length() > 0)
{
this.parseHtmlClassInfo(out, strTag, strParams, strData, strClass); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> TypeInformation<T> convert(String jsonSchema) {
Preconditions.checkNotNull(jsonSchema, "JSON schema");
final ObjectMapper mapper = new ObjectMapper();
mapper.getFactory()
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
final JsonNode node;
try {
node = mapper.readTree(jsonSchema);
} catch (IOException e) {
throw new IllegalArgumentException(
"Invalid JSON schema.", e);
}
return (TypeInformation<T>) convertType("<root>", node, node);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> TypeInformation<T> convert(String jsonSchema) {
Preconditions.checkNotNull(jsonSchema, "JSON schema");
final ObjectMapper mapper = new ObjectMapper();
mapper.getFactory()
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES)
.enable(JsonParser.Feature.ALLOW_SINGLE_QUOTES);
final JsonNode node;
try {
node = mapper.readTree(jsonSchema); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException(
"Invalid JSON schema.", e);
} // depends on control dependency: [catch], data = [none]
return (TypeInformation<T>) convertType("<root>", node, node);
} } |
public class class_name {
public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
this.collector = collector;
if(stateStore == null) {
String zkEndpointAddress = eventHubConfig.getZkConnectionString();
if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
//use storm's zookeeper servers if not specified.
@SuppressWarnings("unchecked")
List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
StringBuilder sb = new StringBuilder();
for (String zk : zkServers) {
if (sb.length() > 0) {
sb.append(',');
}
sb.append(zk+":"+zkPort);
}
zkEndpointAddress = sb.toString();
}
stateStore = new ZookeeperStateStore(zkEndpointAddress,
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
}
stateStore.open();
partitionCoordinator = new StaticPartitionCoordinator(
eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);
for (IPartitionManager partitionManager :
partitionCoordinator.getMyPartitionManagers()) {
partitionManager.open();
}
} } | public class class_name {
public void preparePartitions(Map config, int totalTasks, int taskIndex, SpoutOutputCollector collector) throws Exception {
this.collector = collector;
if(stateStore == null) {
String zkEndpointAddress = eventHubConfig.getZkConnectionString();
if (zkEndpointAddress == null || zkEndpointAddress.length() == 0) {
//use storm's zookeeper servers if not specified.
@SuppressWarnings("unchecked")
List<String> zkServers = (List<String>) config.get(Config.STORM_ZOOKEEPER_SERVERS);
Integer zkPort = ((Number) config.get(Config.STORM_ZOOKEEPER_PORT)).intValue();
StringBuilder sb = new StringBuilder();
for (String zk : zkServers) {
if (sb.length() > 0) {
sb.append(','); // depends on control dependency: [if], data = [none]
}
sb.append(zk+":"+zkPort); // depends on control dependency: [for], data = [zk]
}
zkEndpointAddress = sb.toString();
}
stateStore = new ZookeeperStateStore(zkEndpointAddress,
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
(Integer)config.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL));
}
stateStore.open();
partitionCoordinator = new StaticPartitionCoordinator(
eventHubConfig, taskIndex, totalTasks, stateStore, pmFactory, recvFactory);
for (IPartitionManager partitionManager :
partitionCoordinator.getMyPartitionManagers()) {
partitionManager.open();
}
} } |
public class class_name {
protected void subscribeEvent(
List topicSpaces,
List topics,
String busId,
Transaction transaction) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"subscribeEvent",
new Object[] { topics, topicSpaces, busId, transaction });
try
{
// Get the lock Manager lock
// multiple subscribes can happen at the same time -
// this is allowed.
_lockManager.lock();
if (!_started)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "subscribeEvent", "Returning as stopped");
return;
}
if (!_reconciling)
// Call to subscribe.
remoteSubscribeEvent(topicSpaces,
topics,
busId,
transaction,
true);
}
finally
{
_lockManager.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "subscribeEvent");
} } | public class class_name {
protected void subscribeEvent(
List topicSpaces,
List topics,
String busId,
Transaction transaction) throws SIResourceException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"subscribeEvent",
new Object[] { topics, topicSpaces, busId, transaction });
try
{
// Get the lock Manager lock
// multiple subscribes can happen at the same time -
// this is allowed.
_lockManager.lock(); // depends on control dependency: [try], data = [none]
if (!_started)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "subscribeEvent", "Returning as stopped");
return; // depends on control dependency: [if], data = [none]
}
if (!_reconciling)
// Call to subscribe.
remoteSubscribeEvent(topicSpaces,
topics,
busId,
transaction,
true);
}
finally
{
_lockManager.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "subscribeEvent");
} } |
public class class_name {
public Object newInstance(String clazz) {
try {
return Class.forName(clazz).newInstance();
} catch (Exception e) {
error(e);
return null;
}
} } | public class class_name {
public Object newInstance(String clazz) {
try {
return Class.forName(clazz).newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
error(e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private String formatMessage(VdmDebugLogItem item)
{
String result = item.getMessage();
if (result.startsWith(XML_DECL_BEGIN))
{
int end = result.indexOf(XML_DECL_END);
if (end >= 0)
{
end += XML_DECL_END.length();
while (end < result.length()
&& Character.isWhitespace(result.charAt(end)))
{
++end;
}
result = result.substring(end);
}
}
return result.replaceAll("[\\p{Cntrl}]+", ""); //$NON-NLS-1$ //$NON-NLS-2$
} } | public class class_name {
private String formatMessage(VdmDebugLogItem item)
{
String result = item.getMessage();
if (result.startsWith(XML_DECL_BEGIN))
{
int end = result.indexOf(XML_DECL_END);
if (end >= 0)
{
end += XML_DECL_END.length(); // depends on control dependency: [if], data = [none]
while (end < result.length()
&& Character.isWhitespace(result.charAt(end)))
{
++end; // depends on control dependency: [while], data = [none]
}
result = result.substring(end); // depends on control dependency: [if], data = [(end]
}
}
return result.replaceAll("[\\p{Cntrl}]+", ""); //$NON-NLS-1$ //$NON-NLS-2$
} } |
public class class_name {
public static XNElement parseXMLFragment(XMLStreamReader in)
throws XMLStreamException {
XNElement node = null;
XNElement root = null;
final StringBuilder emptyBuilder = new StringBuilder();
StringBuilder b = null;
Deque<StringBuilder> stack = new LinkedList<>();
while (in.hasNext()) {
int type = in.next();
switch(type) {
case XMLStreamConstants.START_ELEMENT:
if (b != null) {
stack.push(b);
b = null;
} else {
stack.push(emptyBuilder);
}
XNElement n = new XNElement(in.getName().getLocalPart());
n.namespace = in.getNamespaceURI();
n.prefix = in.getPrefix();
n.parent = node;
int attCount = in.getAttributeCount();
if (attCount > 0) {
for (int i = 0; i < attCount; i++) {
n.attributes.put(new XAttributeName(
in.getAttributeLocalName(i),
in.getAttributeNamespace(i),
in.getAttributePrefix(i)
), in.getAttributeValue(i));
}
}
if (node != null) {
node.children.add(n);
}
node = n;
if (root == null) {
root = n;
}
break;
case XMLStreamConstants.CDATA:
case XMLStreamConstants.CHARACTERS:
if (node != null && !in.isWhiteSpace()) {
if (b == null) {
b = new StringBuilder();
}
b.append(in.getText());
}
break;
case XMLStreamConstants.END_ELEMENT:
// if text was found, assign the accumulated text to the node
if (b != null) {
node.content = b.toString();
}
if (node != null) {
node = node.parent;
}
// return to the parent's builder
b = stack.pop();
// if the parent had no text so far
if (b == emptyBuilder) {
b = null;
}
if (stack.isEmpty()) {
return root;
}
break;
default:
// ignore others.
}
}
return root;
} } | public class class_name {
public static XNElement parseXMLFragment(XMLStreamReader in)
throws XMLStreamException {
XNElement node = null;
XNElement root = null;
final StringBuilder emptyBuilder = new StringBuilder();
StringBuilder b = null;
Deque<StringBuilder> stack = new LinkedList<>();
while (in.hasNext()) {
int type = in.next();
switch(type) {
case XMLStreamConstants.START_ELEMENT:
if (b != null) {
stack.push(b); // depends on control dependency: [if], data = [(b]
b = null; // depends on control dependency: [if], data = [none]
} else {
stack.push(emptyBuilder); // depends on control dependency: [if], data = [none]
}
XNElement n = new XNElement(in.getName().getLocalPart());
n.namespace = in.getNamespaceURI();
n.prefix = in.getPrefix();
n.parent = node;
int attCount = in.getAttributeCount();
if (attCount > 0) {
for (int i = 0; i < attCount; i++) {
n.attributes.put(new XAttributeName(
in.getAttributeLocalName(i),
in.getAttributeNamespace(i),
in.getAttributePrefix(i)
), in.getAttributeValue(i)); // depends on control dependency: [for], data = [none]
}
}
if (node != null) {
node.children.add(n); // depends on control dependency: [if], data = [none]
}
node = n;
if (root == null) {
root = n; // depends on control dependency: [if], data = [none]
}
break;
case XMLStreamConstants.CDATA:
case XMLStreamConstants.CHARACTERS:
if (node != null && !in.isWhiteSpace()) {
if (b == null) {
b = new StringBuilder(); // depends on control dependency: [if], data = [none]
}
b.append(in.getText()); // depends on control dependency: [if], data = [none]
}
break;
case XMLStreamConstants.END_ELEMENT:
// if text was found, assign the accumulated text to the node
if (b != null) {
node.content = b.toString(); // depends on control dependency: [if], data = [none]
}
if (node != null) {
node = node.parent; // depends on control dependency: [if], data = [none]
}
// return to the parent's builder
b = stack.pop();
// if the parent had no text so far
if (b == emptyBuilder) {
b = null; // depends on control dependency: [if], data = [none]
}
if (stack.isEmpty()) {
return root; // depends on control dependency: [if], data = [none]
}
break;
default:
// ignore others.
}
}
return root;
} } |
public class class_name {
public void resolvePrefixTables() throws TransformerException
{
super.resolvePrefixTables();
StylesheetRoot stylesheet = getStylesheetRoot();
if ((null != m_namespace) && (m_namespace.length() > 0))
{
NamespaceAlias nsa = stylesheet.getNamespaceAliasComposed(m_namespace);
if (null != nsa)
{
m_namespace = nsa.getResultNamespace();
// String resultPrefix = nsa.getResultPrefix();
String resultPrefix = nsa.getStylesheetPrefix(); // As per xsl WG, Mike Kay
if ((null != resultPrefix) && (resultPrefix.length() > 0))
m_rawName = resultPrefix + ":" + m_localName;
else
m_rawName = m_localName;
}
}
if (null != m_avts)
{
int n = m_avts.size();
for (int i = 0; i < n; i++)
{
AVT avt = (AVT) m_avts.get(i);
// Should this stuff be a method on AVT?
String ns = avt.getURI();
if ((null != ns) && (ns.length() > 0))
{
NamespaceAlias nsa =
stylesheet.getNamespaceAliasComposed(m_namespace); // %REVIEW% ns?
if (null != nsa)
{
String namespace = nsa.getResultNamespace();
// String resultPrefix = nsa.getResultPrefix();
String resultPrefix = nsa.getStylesheetPrefix(); // As per XSL WG
String rawName = avt.getName();
if ((null != resultPrefix) && (resultPrefix.length() > 0))
rawName = resultPrefix + ":" + rawName;
avt.setURI(namespace);
avt.setRawName(rawName);
}
}
}
}
} } | public class class_name {
public void resolvePrefixTables() throws TransformerException
{
super.resolvePrefixTables();
StylesheetRoot stylesheet = getStylesheetRoot();
if ((null != m_namespace) && (m_namespace.length() > 0))
{
NamespaceAlias nsa = stylesheet.getNamespaceAliasComposed(m_namespace);
if (null != nsa)
{
m_namespace = nsa.getResultNamespace(); // depends on control dependency: [if], data = [none]
// String resultPrefix = nsa.getResultPrefix();
String resultPrefix = nsa.getStylesheetPrefix(); // As per xsl WG, Mike Kay
if ((null != resultPrefix) && (resultPrefix.length() > 0))
m_rawName = resultPrefix + ":" + m_localName;
else
m_rawName = m_localName;
}
}
if (null != m_avts)
{
int n = m_avts.size();
for (int i = 0; i < n; i++)
{
AVT avt = (AVT) m_avts.get(i);
// Should this stuff be a method on AVT?
String ns = avt.getURI();
if ((null != ns) && (ns.length() > 0))
{
NamespaceAlias nsa =
stylesheet.getNamespaceAliasComposed(m_namespace); // %REVIEW% ns?
if (null != nsa)
{
String namespace = nsa.getResultNamespace();
// String resultPrefix = nsa.getResultPrefix();
String resultPrefix = nsa.getStylesheetPrefix(); // As per XSL WG
String rawName = avt.getName();
if ((null != resultPrefix) && (resultPrefix.length() > 0))
rawName = resultPrefix + ":" + rawName;
avt.setURI(namespace); // depends on control dependency: [if], data = [none]
avt.setRawName(rawName); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public final boolean appliesTo(final URI property) {
if (this.properties.isEmpty() || this.properties.contains(property)) {
return true;
}
Preconditions.checkNotNull(property);
return false;
} } | public class class_name {
public final boolean appliesTo(final URI property) {
if (this.properties.isEmpty() || this.properties.contains(property)) {
return true; // depends on control dependency: [if], data = [none]
}
Preconditions.checkNotNull(property);
return false;
} } |
public class class_name {
public static String join(String delimiter, Object... values) {
// Since primitive arrays does not pass as a values array, but as it's
// single first element.
if (values.length == 1) {
Class<?> type = values[0].getClass();
if (char[].class.equals(type)) {
return joinP(delimiter, (char[]) values[0]);
} else if (int[].class.equals(type)) {
return joinP(delimiter, (int[]) values[0]);
} else if (long[].class.equals(type)) {
return joinP(delimiter, (long[]) values[0]);
} else if (double[].class.equals(type)) {
return joinP(delimiter, (double[]) values[0]);
} else if (boolean[].class.equals(type)) {
return joinP(delimiter, (boolean[]) values[0]);
}
}
StringBuilder builder = new StringBuilder();
boolean first = true;
for (Object value : values) {
if (first) {
first = false;
} else {
builder.append(delimiter);
}
builder.append(Objects.toString(value));
}
return builder.toString();
} } | public class class_name {
public static String join(String delimiter, Object... values) {
// Since primitive arrays does not pass as a values array, but as it's
// single first element.
if (values.length == 1) {
Class<?> type = values[0].getClass();
if (char[].class.equals(type)) {
return joinP(delimiter, (char[]) values[0]); // depends on control dependency: [if], data = [none]
} else if (int[].class.equals(type)) {
return joinP(delimiter, (int[]) values[0]); // depends on control dependency: [if], data = [none]
} else if (long[].class.equals(type)) {
return joinP(delimiter, (long[]) values[0]); // depends on control dependency: [if], data = [none]
} else if (double[].class.equals(type)) {
return joinP(delimiter, (double[]) values[0]); // depends on control dependency: [if], data = [none]
} else if (boolean[].class.equals(type)) {
return joinP(delimiter, (boolean[]) values[0]); // depends on control dependency: [if], data = [none]
}
}
StringBuilder builder = new StringBuilder();
boolean first = true;
for (Object value : values) {
if (first) {
first = false; // depends on control dependency: [if], data = [none]
} else {
builder.append(delimiter); // depends on control dependency: [if], data = [none]
}
builder.append(Objects.toString(value)); // depends on control dependency: [for], data = [value]
}
return builder.toString();
} } |
public class class_name {
public AnimaQuery<T> order(String order) {
if (this.orderBySQL.length() > 0) {
this.orderBySQL.append(',');
}
this.orderBySQL.append(' ').append(order);
return this;
} } | public class class_name {
public AnimaQuery<T> order(String order) {
if (this.orderBySQL.length() > 0) {
this.orderBySQL.append(','); // depends on control dependency: [if], data = [none]
}
this.orderBySQL.append(' ').append(order);
return this;
} } |
public class class_name {
private static boolean endsWith(final CharSequence str, final CharSequence suffix, final boolean ignoreCase) {
if (str == null || suffix == null) {
return str == null && suffix == null;
}
if (suffix.length() > str.length()) {
return false;
}
final int strOffset = str.length() - suffix.length();
return CharSequenceUtils.regionMatches(str, ignoreCase, strOffset, suffix, 0, suffix.length());
} } | public class class_name {
private static boolean endsWith(final CharSequence str, final CharSequence suffix, final boolean ignoreCase) {
if (str == null || suffix == null) {
return str == null && suffix == null; // depends on control dependency: [if], data = [none]
}
if (suffix.length() > str.length()) {
return false; // depends on control dependency: [if], data = [none]
}
final int strOffset = str.length() - suffix.length();
return CharSequenceUtils.regionMatches(str, ignoreCase, strOffset, suffix, 0, suffix.length());
} } |
public class class_name {
static long getTotalSize(Collection<Allocation> allocations) {
long totalSize = 0;
for (Allocation allocation : allocations) {
totalSize += allocation.size;
}
return totalSize;
} } | public class class_name {
static long getTotalSize(Collection<Allocation> allocations) {
long totalSize = 0;
for (Allocation allocation : allocations) {
totalSize += allocation.size; // depends on control dependency: [for], data = [allocation]
}
return totalSize;
} } |
public class class_name {
public void addViewInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = viewInterceptors.get(method);
if (container == null) {
viewInterceptors.put(method, container = new OrderedItemContainer<InterceptorFactory>());
}
container.add(interceptorFactory, priority);
} } | public class class_name {
public void addViewInterceptor(Method method, InterceptorFactory interceptorFactory, int priority) {
OrderedItemContainer<InterceptorFactory> container = viewInterceptors.get(method);
if (container == null) {
viewInterceptors.put(method, container = new OrderedItemContainer<InterceptorFactory>()); // depends on control dependency: [if], data = [none]
}
container.add(interceptorFactory, priority);
} } |
public class class_name {
public LoadBalancerDescription withSubnets(String... subnets) {
if (this.subnets == null) {
setSubnets(new com.amazonaws.internal.SdkInternalList<String>(subnets.length));
}
for (String ele : subnets) {
this.subnets.add(ele);
}
return this;
} } | public class class_name {
public LoadBalancerDescription withSubnets(String... subnets) {
if (this.subnets == null) {
setSubnets(new com.amazonaws.internal.SdkInternalList<String>(subnets.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : subnets) {
this.subnets.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public T headerFragment(Object model, Marshaller marshaller) {
StringResult result = new StringResult();
try {
marshaller.marshal(model, result);
} catch (XmlMappingException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
}
return header(result.toString());
} } | public class class_name {
public T headerFragment(Object model, Marshaller marshaller) {
StringResult result = new StringResult();
try {
marshaller.marshal(model, result); // depends on control dependency: [try], data = [none]
} catch (XmlMappingException e) {
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new CitrusRuntimeException("Failed to marshal object graph for message header data", e);
} // depends on control dependency: [catch], data = [none]
return header(result.toString());
} } |
public class class_name {
public int getNumberAvailable() {
int result = 0;
for (int i = 0; i < data.size(); i++) {
if (data.get(i) != null) {
result += 1;
}
}
return result;
} } | public class class_name {
public int getNumberAvailable() {
int result = 0;
for (int i = 0; i < data.size(); i++) {
if (data.get(i) != null) {
result += 1;
// depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@GwtIncompatible // com.google.common.math.DoubleUtils
public static boolean isPowerOfTwo(double x) {
if (x > 0.0 && isFinite(x)) {
long significand = getSignificand(x);
return (significand & (significand - 1)) == 0;
}
return false;
} } | public class class_name {
@GwtIncompatible // com.google.common.math.DoubleUtils
public static boolean isPowerOfTwo(double x) {
if (x > 0.0 && isFinite(x)) {
long significand = getSignificand(x);
return (significand & (significand - 1)) == 0; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public boolean handleCommand(String strCommand, ScreenField sourceSField, int iUseSameWindow)
{
boolean bHandled = this.doCommand(strCommand, sourceSField, iUseSameWindow); // Do I handle it?
if (bHandled == false)
{ // Not handled by this screen, try child windows
for (int iFieldSeq = 0; iFieldSeq < this.getSFieldCount(); iFieldSeq++)
{ // See if any of my children want to handle this command
ScreenField sField = this.getSField(iFieldSeq);
if (sField != sourceSField) // Don't call the child that passed this up
{
bHandled = sField.handleCommand(strCommand, this, iUseSameWindow); // Send to children (make sure they don't call me)
if (bHandled)
return bHandled;
}
}
}
if (bHandled == false)
bHandled = super.handleCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent
return bHandled;
} } | public class class_name {
public boolean handleCommand(String strCommand, ScreenField sourceSField, int iUseSameWindow)
{
boolean bHandled = this.doCommand(strCommand, sourceSField, iUseSameWindow); // Do I handle it?
if (bHandled == false)
{ // Not handled by this screen, try child windows
for (int iFieldSeq = 0; iFieldSeq < this.getSFieldCount(); iFieldSeq++)
{ // See if any of my children want to handle this command
ScreenField sField = this.getSField(iFieldSeq);
if (sField != sourceSField) // Don't call the child that passed this up
{
bHandled = sField.handleCommand(strCommand, this, iUseSameWindow); // Send to children (make sure they don't call me) // depends on control dependency: [if], data = [none]
if (bHandled)
return bHandled;
}
}
}
if (bHandled == false)
bHandled = super.handleCommand(strCommand, sourceSField, iUseSameWindow); // This will send the command to my parent
return bHandled;
} } |
public class class_name {
public BufferedImage render(List<ColouredPolygon> entity)
{
// Need to set the background before applying the transform.
graphics.setTransform(IDENTITY_TRANSFORM);
graphics.setColor(Color.GRAY);
graphics.fillRect(0, 0, targetSize.width, targetSize.height);
if (transform != null)
{
graphics.setTransform(transform);
}
for (ColouredPolygon polygon : entity)
{
graphics.setColor(polygon.getColour());
graphics.fillPolygon(polygon.getPolygon());
}
return image;
} } | public class class_name {
public BufferedImage render(List<ColouredPolygon> entity)
{
// Need to set the background before applying the transform.
graphics.setTransform(IDENTITY_TRANSFORM);
graphics.setColor(Color.GRAY);
graphics.fillRect(0, 0, targetSize.width, targetSize.height);
if (transform != null)
{
graphics.setTransform(transform); // depends on control dependency: [if], data = [(transform]
}
for (ColouredPolygon polygon : entity)
{
graphics.setColor(polygon.getColour()); // depends on control dependency: [for], data = [polygon]
graphics.fillPolygon(polygon.getPolygon()); // depends on control dependency: [for], data = [polygon]
}
return image;
} } |
public class class_name {
public StorageKey toKey(Path fromPath, StorageKey storage) {
final List<FieldPartitioner> partitioners =
Accessor.getDefault().getFieldPartitioners(storage.getPartitionStrategy());
//Strip off the root directory to get partition segments
String truncatedPath = fromPath.toString();
if(truncatedPath.startsWith(rootPath.toString())){
truncatedPath = truncatedPath.substring(rootPath.toString().length());
}
List<String> pathParts = new LinkedList<String>();
//Check that there are segments to parse.
if(!truncatedPath.isEmpty()) {
Path currentPath = new Path(truncatedPath);
while (currentPath != null) {
String name = currentPath.getName();
if(!name.isEmpty()) {
pathParts.add(currentPath.getName());
}
currentPath = currentPath.getParent();
}
//list is now last -> first so reverse the list to be first -> last
Collections.reverse(pathParts);
}
final List<Object> values = Lists.newArrayList(
new Object[pathParts.size()]);
//for each segment we have get the value for the key
for(int i = 0; i < pathParts.size(); i++){
values.set(i, valueForDirname(
(FieldPartitioner<?, ?>) partitioners.get(i),
pathParts.get(i)));
}
storage.replaceValues(values);
return storage;
} } | public class class_name {
public StorageKey toKey(Path fromPath, StorageKey storage) {
final List<FieldPartitioner> partitioners =
Accessor.getDefault().getFieldPartitioners(storage.getPartitionStrategy());
//Strip off the root directory to get partition segments
String truncatedPath = fromPath.toString();
if(truncatedPath.startsWith(rootPath.toString())){
truncatedPath = truncatedPath.substring(rootPath.toString().length()); // depends on control dependency: [if], data = [none]
}
List<String> pathParts = new LinkedList<String>();
//Check that there are segments to parse.
if(!truncatedPath.isEmpty()) {
Path currentPath = new Path(truncatedPath);
while (currentPath != null) {
String name = currentPath.getName();
if(!name.isEmpty()) {
pathParts.add(currentPath.getName()); // depends on control dependency: [if], data = [none]
}
currentPath = currentPath.getParent(); // depends on control dependency: [while], data = [none]
}
//list is now last -> first so reverse the list to be first -> last
Collections.reverse(pathParts); // depends on control dependency: [if], data = [none]
}
final List<Object> values = Lists.newArrayList(
new Object[pathParts.size()]);
//for each segment we have get the value for the key
for(int i = 0; i < pathParts.size(); i++){
values.set(i, valueForDirname(
(FieldPartitioner<?, ?>) partitioners.get(i),
pathParts.get(i))); // depends on control dependency: [for], data = [i]
}
storage.replaceValues(values);
return storage;
} } |
public class class_name {
public static InetAddress getInetAddress(Config config, String path) {
try {
return InetAddress.getByName(config.getString(path));
} catch (UnknownHostException e) {
throw badValue(e, config, path);
}
} } | public class class_name {
public static InetAddress getInetAddress(Config config, String path) {
try {
return InetAddress.getByName(config.getString(path)); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
throw badValue(e, config, path);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY);
keyArea.addKeyField(ID, DBConstants.ASCENDING);
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, MESSAGE_PROCESS_INFO_ID_KEY);
keyArea.addKeyField(MESSAGE_PROCESS_INFO_ID, DBConstants.ASCENDING);
keyArea.addKeyField(MESSAGE_TRANSPORT_ID, DBConstants.ASCENDING);
keyArea.addKeyField(MESSAGE_VERSION_ID, DBConstants.ASCENDING);
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } | public class class_name {
public KeyArea setupKey(int iKeyArea)
{
KeyArea keyArea = null;
if (iKeyArea == 0)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (iKeyArea == 1)
{
keyArea = this.makeIndex(DBConstants.UNIQUE, MESSAGE_PROCESS_INFO_ID_KEY); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(MESSAGE_PROCESS_INFO_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(MESSAGE_TRANSPORT_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
keyArea.addKeyField(MESSAGE_VERSION_ID, DBConstants.ASCENDING); // depends on control dependency: [if], data = [none]
}
if (keyArea == null)
keyArea = super.setupKey(iKeyArea);
return keyArea;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
protected List cacheLoadOrStore(List<Object> loadedObjects) {
if (loadedObjects.isEmpty()) {
return loadedObjects;
}
if (!(loadedObjects.get(0) instanceof Entity)) {
return loadedObjects;
}
List<Entity> filteredObjects = new ArrayList<Entity>(loadedObjects.size());
for (Object loadedObject : loadedObjects) {
Entity cachedEntity = cacheLoadOrStore((Entity) loadedObject);
filteredObjects.add(cachedEntity);
}
return filteredObjects;
} } | public class class_name {
@SuppressWarnings("rawtypes")
protected List cacheLoadOrStore(List<Object> loadedObjects) {
if (loadedObjects.isEmpty()) {
return loadedObjects; // depends on control dependency: [if], data = [none]
}
if (!(loadedObjects.get(0) instanceof Entity)) {
return loadedObjects; // depends on control dependency: [if], data = [none]
}
List<Entity> filteredObjects = new ArrayList<Entity>(loadedObjects.size());
for (Object loadedObject : loadedObjects) {
Entity cachedEntity = cacheLoadOrStore((Entity) loadedObject);
filteredObjects.add(cachedEntity); // depends on control dependency: [for], data = [none]
}
return filteredObjects;
} } |
public class class_name {
public static String parseWithMetric(final String metric,
final HashMap<String, String> tags) {
final int curly = metric.indexOf('{');
if (curly < 0) {
return metric;
}
final int len = metric.length();
if (metric.charAt(len - 1) != '}') { // "foo{"
throw new IllegalArgumentException("Missing '}' at the end of: " + metric);
} else if (curly == len - 2) { // "foo{}"
return metric.substring(0, len - 2);
}
// substring the tags out of "foo{a=b,...,x=y}" and parse them.
for (final String tag : splitString(metric.substring(curly + 1, len - 1),
',')) {
try {
parse(tags, tag);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing tag '" + tag
+ "': " + e.getMessage());
}
}
// Return the "foo" part of "foo{a=b,...,x=y}"
return metric.substring(0, curly);
} } | public class class_name {
public static String parseWithMetric(final String metric,
final HashMap<String, String> tags) {
final int curly = metric.indexOf('{');
if (curly < 0) {
return metric; // depends on control dependency: [if], data = [none]
}
final int len = metric.length();
if (metric.charAt(len - 1) != '}') { // "foo{"
throw new IllegalArgumentException("Missing '}' at the end of: " + metric);
} else if (curly == len - 2) { // "foo{}"
return metric.substring(0, len - 2); // depends on control dependency: [if], data = [len - 2)]
}
// substring the tags out of "foo{a=b,...,x=y}" and parse them.
for (final String tag : splitString(metric.substring(curly + 1, len - 1),
',')) {
try {
parse(tags, tag); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("When parsing tag '" + tag
+ "': " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
// Return the "foo" part of "foo{a=b,...,x=y}"
return metric.substring(0, curly);
} } |
public class class_name {
public void destroy(String name, Object instance)
{
if (instance != null && isManagedBean(name))
{
try
{
_lifecycleProvider.destroyInstance(instance);
}
catch (IllegalAccessException e)
{
log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e);
}
catch (InvocationTargetException e)
{
log.log(Level.SEVERE, "An Exception occured while invoking " +
"@PreDestroy method of managed bean " + name, e);
}
}
} } | public class class_name {
public void destroy(String name, Object instance)
{
if (instance != null && isManagedBean(name))
{
try
{
_lifecycleProvider.destroyInstance(instance); // depends on control dependency: [try], data = [none]
}
catch (IllegalAccessException e)
{
log.log(Level.SEVERE, "Could not access @PreDestroy method of managed bean " + name, e);
} // depends on control dependency: [catch], data = [none]
catch (InvocationTargetException e)
{
log.log(Level.SEVERE, "An Exception occured while invoking " +
"@PreDestroy method of managed bean " + name, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Pure
public static Long getAttributeLongWithDefault(Node document, boolean caseSensitive, Long defaultValue, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
final String v = getAttributeValue(document, caseSensitive, 0, path);
if (v != null) {
try {
return Long.parseLong(v);
} catch (NumberFormatException e) {
//
}
}
return defaultValue;
} } | public class class_name {
@Pure
public static Long getAttributeLongWithDefault(Node document, boolean caseSensitive, Long defaultValue, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
final String v = getAttributeValue(document, caseSensitive, 0, path);
if (v != null) {
try {
return Long.parseLong(v); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
//
} // depends on control dependency: [catch], data = [none]
}
return defaultValue;
} } |
public class class_name {
private Instance[] readInstance(String corpus, FeatureMap featureMap)
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
List<Instance> instanceList = new LinkedList<Instance>();
for (String line : lineIterator)
{
String[] cells = line.split(",");
String text = cells[0], label = cells[1];
List<Integer> x = extractFeature(text, featureMap);
int y = featureMap.tagSet.add(label);
if (y == 0)
y = -1; // 感知机标签约定为±1
else if (y > 1)
throw new IllegalArgumentException("类别数大于2,目前只支持二分类。");
instanceList.add(new Instance(x, y));
}
return instanceList.toArray(new Instance[0]);
} } | public class class_name {
private Instance[] readInstance(String corpus, FeatureMap featureMap)
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus);
List<Instance> instanceList = new LinkedList<Instance>();
for (String line : lineIterator)
{
String[] cells = line.split(",");
String text = cells[0], label = cells[1];
List<Integer> x = extractFeature(text, featureMap);
int y = featureMap.tagSet.add(label);
if (y == 0)
y = -1; // 感知机标签约定为±1
else if (y > 1)
throw new IllegalArgumentException("类别数大于2,目前只支持二分类。");
instanceList.add(new Instance(x, y)); // depends on control dependency: [for], data = [none]
}
return instanceList.toArray(new Instance[0]);
} } |
public class class_name {
public User getUSer(String email)
{
try
{
ExampleFunctionService userService = appContext.getBean(ExampleFunctionService.class);
return userService.findUserByEmail(email);
}
finally
{
appContext.close();
}
} } | public class class_name {
public User getUSer(String email)
{
try
{
ExampleFunctionService userService = appContext.getBean(ExampleFunctionService.class);
return userService.findUserByEmail(email); // depends on control dependency: [try], data = [none]
}
finally
{
appContext.close();
}
} } |
public class class_name {
private static StringConcatenationClient toStringConcatenation(final String... javaCodeLines) {
return new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation builder) {
for (final String line : javaCodeLines) {
builder.append(line);
builder.newLineIfNotEmpty();
}
}
};
} } | public class class_name {
private static StringConcatenationClient toStringConcatenation(final String... javaCodeLines) {
return new StringConcatenationClient() {
@Override
protected void appendTo(StringConcatenationClient.TargetStringConcatenation builder) {
for (final String line : javaCodeLines) {
builder.append(line); // depends on control dependency: [for], data = [line]
builder.newLineIfNotEmpty(); // depends on control dependency: [for], data = [none]
}
}
};
} } |
public class class_name {
public void addFunctions(final FunctionSet functions) {
checkNotNull(functions);
log.debug("Adding functions: {}", functions);
Object target = functions.target();
for (String name : functions.names()) {
addCommand(null, target, name);
}
} } | public class class_name {
public void addFunctions(final FunctionSet functions) {
checkNotNull(functions);
log.debug("Adding functions: {}", functions);
Object target = functions.target();
for (String name : functions.names()) {
addCommand(null, target, name); // depends on control dependency: [for], data = [name]
}
} } |
public class class_name {
private void initActionButtonAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton,
defStyleAttr, defStyleRes);
try {
initType(attributes);
initSize(attributes);
initButtonColor(attributes);
initButtonColorPressed(attributes);
initRippleEffectEnabled(attributes);
initButtonColorRipple(attributes);
initShadowRadius(attributes);
initShadowXOffset(attributes);
initShadowYOffset(attributes);
initShadowColor(attributes);
initShadowResponsiveEffectEnabled(attributes);
initStrokeWidth(attributes);
initStrokeColor(attributes);
initImage(attributes);
initImageSize(attributes);
initShowAnimation(attributes);
initHideAnimation(attributes);
} catch (Exception e) {
LOGGER.trace("Failed to read attribute", e);
} finally {
attributes.recycle();
}
LOGGER.trace("Successfully initialized the Action Button attributes");
} } | public class class_name {
private void initActionButtonAttrs(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
TypedArray attributes = context.getTheme().obtainStyledAttributes(attrs, R.styleable.ActionButton,
defStyleAttr, defStyleRes);
try {
initType(attributes); // depends on control dependency: [try], data = [none]
initSize(attributes); // depends on control dependency: [try], data = [none]
initButtonColor(attributes); // depends on control dependency: [try], data = [none]
initButtonColorPressed(attributes); // depends on control dependency: [try], data = [none]
initRippleEffectEnabled(attributes); // depends on control dependency: [try], data = [none]
initButtonColorRipple(attributes); // depends on control dependency: [try], data = [none]
initShadowRadius(attributes); // depends on control dependency: [try], data = [none]
initShadowXOffset(attributes); // depends on control dependency: [try], data = [none]
initShadowYOffset(attributes); // depends on control dependency: [try], data = [none]
initShadowColor(attributes); // depends on control dependency: [try], data = [none]
initShadowResponsiveEffectEnabled(attributes); // depends on control dependency: [try], data = [none]
initStrokeWidth(attributes); // depends on control dependency: [try], data = [none]
initStrokeColor(attributes); // depends on control dependency: [try], data = [none]
initImage(attributes); // depends on control dependency: [try], data = [none]
initImageSize(attributes); // depends on control dependency: [try], data = [none]
initShowAnimation(attributes); // depends on control dependency: [try], data = [none]
initHideAnimation(attributes); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.trace("Failed to read attribute", e);
} finally { // depends on control dependency: [catch], data = [none]
attributes.recycle();
}
LOGGER.trace("Successfully initialized the Action Button attributes");
} } |
public class class_name {
private List getRetainedPagesWithTemplate(List xmlPages) {
// list of resources belongs to the selected template
List resourcesWithTemplate = new ArrayList();
TreeMap templates = null;
try {
templates = CmsNewResourceXmlPage.getTemplates(getCms(), null);
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
// check if the users selected template is valid.
if ((templates != null) && templates.containsValue(getParamTemplate())) {
// iterate the xmlPages list and add all resources with the specified template to the resourcesWithTemplate list
Iterator i = xmlPages.iterator();
while (i.hasNext()) {
CmsResource currentPage = (CmsResource)i.next();
// read the template property
CmsProperty templateProperty;
try {
templateProperty = getCms().readPropertyObject(
getCms().getSitePath(currentPage),
CmsPropertyDefinition.PROPERTY_TEMPLATE,
false);
} catch (CmsException e2) {
if (LOG.isErrorEnabled()) {
LOG.error(e2);
}
continue;
}
// add currentResource if the template property value is the same as the given template
if (getParamTemplate().equals(templateProperty.getValue())) {
resourcesWithTemplate.add(currentPage);
}
}
// retain the list of pages against the list with template
xmlPages.retainAll(resourcesWithTemplate);
}
return xmlPages;
} } | public class class_name {
private List getRetainedPagesWithTemplate(List xmlPages) {
// list of resources belongs to the selected template
List resourcesWithTemplate = new ArrayList();
TreeMap templates = null;
try {
templates = CmsNewResourceXmlPage.getTemplates(getCms(), null); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
// check if the users selected template is valid.
if ((templates != null) && templates.containsValue(getParamTemplate())) {
// iterate the xmlPages list and add all resources with the specified template to the resourcesWithTemplate list
Iterator i = xmlPages.iterator();
while (i.hasNext()) {
CmsResource currentPage = (CmsResource)i.next();
// read the template property
CmsProperty templateProperty;
try {
templateProperty = getCms().readPropertyObject(
getCms().getSitePath(currentPage),
CmsPropertyDefinition.PROPERTY_TEMPLATE,
false); // depends on control dependency: [try], data = [none]
} catch (CmsException e2) {
if (LOG.isErrorEnabled()) {
LOG.error(e2); // depends on control dependency: [if], data = [none]
}
continue;
} // depends on control dependency: [catch], data = [none]
// add currentResource if the template property value is the same as the given template
if (getParamTemplate().equals(templateProperty.getValue())) {
resourcesWithTemplate.add(currentPage); // depends on control dependency: [if], data = [none]
}
}
// retain the list of pages against the list with template
xmlPages.retainAll(resourcesWithTemplate); // depends on control dependency: [if], data = [none]
}
return xmlPages;
} } |
public class class_name {
public void setScriptFile(final String scriptFile) {
this.scriptFile = scriptFile;
this.scriptType = determineScriptType(scriptFile);
if (scriptType != SCRIPT_TYPE.CONTENTS) {
// assume that if adjusting the file, engine name should also be re-calc'd
// if scriptType is CONTENTS then we can't determine engineName anyway
this.engineName = getScriptEngineName(scriptFile);
}
} } | public class class_name {
public void setScriptFile(final String scriptFile) {
this.scriptFile = scriptFile;
this.scriptType = determineScriptType(scriptFile);
if (scriptType != SCRIPT_TYPE.CONTENTS) {
// assume that if adjusting the file, engine name should also be re-calc'd
// if scriptType is CONTENTS then we can't determine engineName anyway
this.engineName = getScriptEngineName(scriptFile); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static PrimitiveIterator.OfLong createDelayStream(Duration delay, Duration jitter) {
if (jitter.isZero()) {
// No jitter, return an infinite stream of the delay duration
long delayNanos = asClampedNanos(delay);
return LongStream.generate(() -> delayNanos).iterator();
} else {
// Using jitter, compute the upper and lower bounds and return a stream of randomly distributed values
long lowerLimitNanos = asClampedNanos(delay.minus(jitter));
long upperLimitNanos = asClampedNanos(delay.plus(jitter));
return ThreadLocalRandom.current().longs(lowerLimitNanos, upperLimitNanos).iterator();
}
} } | public class class_name {
protected static PrimitiveIterator.OfLong createDelayStream(Duration delay, Duration jitter) {
if (jitter.isZero()) {
// No jitter, return an infinite stream of the delay duration
long delayNanos = asClampedNanos(delay);
return LongStream.generate(() -> delayNanos).iterator(); // depends on control dependency: [if], data = [none]
} else {
// Using jitter, compute the upper and lower bounds and return a stream of randomly distributed values
long lowerLimitNanos = asClampedNanos(delay.minus(jitter));
long upperLimitNanos = asClampedNanos(delay.plus(jitter));
return ThreadLocalRandom.current().longs(lowerLimitNanos, upperLimitNanos).iterator(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
// not now: 6.0.0
// digester.setLogger(CmsLog.getLog(digester.getClass()));
// Push an array to capture the parameter values if necessary
if (m_paramCount > 0) {
Object[] parameters = new Object[m_paramCount];
for (int i = 0; i < parameters.length; i++) {
parameters[i] = null;
}
getDigester().pushParams(parameters);
}
} } | public class class_name {
@Override
public void begin(String namespace, String name, Attributes attributes) throws Exception {
// not now: 6.0.0
// digester.setLogger(CmsLog.getLog(digester.getClass()));
// Push an array to capture the parameter values if necessary
if (m_paramCount > 0) {
Object[] parameters = new Object[m_paramCount];
for (int i = 0; i < parameters.length; i++) {
parameters[i] = null; // depends on control dependency: [for], data = [i]
}
getDigester().pushParams(parameters);
}
} } |
public class class_name {
public void setReferencedByResources(java.util.Collection<String> referencedByResources) {
if (referencedByResources == null) {
this.referencedByResources = null;
return;
}
this.referencedByResources = new java.util.ArrayList<String>(referencedByResources);
} } | public class class_name {
public void setReferencedByResources(java.util.Collection<String> referencedByResources) {
if (referencedByResources == null) {
this.referencedByResources = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.referencedByResources = new java.util.ArrayList<String>(referencedByResources);
} } |
public class class_name {
public static Location location(List<Location> subLocations, String type) {
if (subLocations.size() == 1) {
return subLocations.get(0);
}
boolean circular = detectCicular(subLocations);
Strand strand = detectStrand(subLocations);
Point start = detectStart(subLocations);
Point end = detectEnd(subLocations, circular);
Location l;
if ("join".equals(type)) {
l = new SimpleLocation(start, end, strand, circular, subLocations);
}
else if ("order".equals(type)) {
l = new InsdcLocations.OrderLocation(start, end, strand, circular, subLocations);
}
else if ("one-of".equals(type)) {
l = new InsdcLocations.OneOfLocation(subLocations);
}
else if ("group".equals(type)) {
l = new InsdcLocations.GroupLocation(start, end, strand, circular, subLocations);
}
else if ("bond".equals(type)) {
l = new InsdcLocations.BondLocation(subLocations);
}
else {
throw new ParserException("Unknown join type " + type);
}
return l;
} } | public class class_name {
public static Location location(List<Location> subLocations, String type) {
if (subLocations.size() == 1) {
return subLocations.get(0); // depends on control dependency: [if], data = [none]
}
boolean circular = detectCicular(subLocations);
Strand strand = detectStrand(subLocations);
Point start = detectStart(subLocations);
Point end = detectEnd(subLocations, circular);
Location l;
if ("join".equals(type)) {
l = new SimpleLocation(start, end, strand, circular, subLocations); // depends on control dependency: [if], data = [none]
}
else if ("order".equals(type)) {
l = new InsdcLocations.OrderLocation(start, end, strand, circular, subLocations); // depends on control dependency: [if], data = [none]
}
else if ("one-of".equals(type)) {
l = new InsdcLocations.OneOfLocation(subLocations); // depends on control dependency: [if], data = [none]
}
else if ("group".equals(type)) {
l = new InsdcLocations.GroupLocation(start, end, strand, circular, subLocations); // depends on control dependency: [if], data = [none]
}
else if ("bond".equals(type)) {
l = new InsdcLocations.BondLocation(subLocations); // depends on control dependency: [if], data = [none]
}
else {
throw new ParserException("Unknown join type " + type);
}
return l;
} } |
public class class_name {
public DisableEnhancedMonitoringResult withCurrentShardLevelMetrics(String... currentShardLevelMetrics) {
if (this.currentShardLevelMetrics == null) {
setCurrentShardLevelMetrics(new com.amazonaws.internal.SdkInternalList<String>(currentShardLevelMetrics.length));
}
for (String ele : currentShardLevelMetrics) {
this.currentShardLevelMetrics.add(ele);
}
return this;
} } | public class class_name {
public DisableEnhancedMonitoringResult withCurrentShardLevelMetrics(String... currentShardLevelMetrics) {
if (this.currentShardLevelMetrics == null) {
setCurrentShardLevelMetrics(new com.amazonaws.internal.SdkInternalList<String>(currentShardLevelMetrics.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : currentShardLevelMetrics) {
this.currentShardLevelMetrics.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private Node getNextSibling(Node node) {
if (node == null || node == root)
return null;
Node newNode = node.getNextSibling();
if (newNode == null) {
newNode = node.getParentNode();
if (newNode == null || node == root)
return null;
int parentAccept = acceptNode(newNode);
if (parentAccept == NodeFilter.FILTER_SKIP) {
return getNextSibling(newNode);
}
return null;
}
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP) {
Node fChild = getFirstChild(newNode);
if (fChild == null)
return getNextSibling(newNode);
return fChild;
} else
// if (accept == NodeFilter.REJECT_NODE)
return getNextSibling(newNode);
} } | public class class_name {
private Node getNextSibling(Node node) {
if (node == null || node == root)
return null;
Node newNode = node.getNextSibling();
if (newNode == null) {
newNode = node.getParentNode(); // depends on control dependency: [if], data = [none]
if (newNode == null || node == root)
return null;
int parentAccept = acceptNode(newNode);
if (parentAccept == NodeFilter.FILTER_SKIP) {
return getNextSibling(newNode); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP) {
Node fChild = getFirstChild(newNode);
if (fChild == null)
return getNextSibling(newNode);
return fChild; // depends on control dependency: [if], data = [none]
} else
// if (accept == NodeFilter.REJECT_NODE)
return getNextSibling(newNode);
} } |
public class class_name {
private ClassLoader getDefaultClassLoader() {
ClassLoader classLoader;
try {
classLoader = Thread.currentThread().getContextClassLoader();
} catch (Throwable ex) {
classLoader = null;
}
if (classLoader == null) {
classLoader = ClassPathResource.class.getClassLoader();
}
return classLoader;
} } | public class class_name {
private ClassLoader getDefaultClassLoader() {
ClassLoader classLoader;
try {
classLoader = Thread.currentThread().getContextClassLoader(); // depends on control dependency: [try], data = [none]
} catch (Throwable ex) {
classLoader = null;
} // depends on control dependency: [catch], data = [none]
if (classLoader == null) {
classLoader = ClassPathResource.class.getClassLoader(); // depends on control dependency: [if], data = [none]
}
return classLoader;
} } |
public class class_name {
public static Element getChild(Element parent, String name, String[] names, boolean firstToLast) {
Assert.isNotNull(parent);
Assert.isNotNull(name);
Assert.isNotNull(names);
boolean found = false;
for (int i = 0; !found && i < names.length; ++i) {
found = names[i].equals(name);
}
Assert.isTrue(found);
int i;
Node child = null;
if (firstToLast) {
i = 0;
child = parent.getFirstChild();
} else {
i = names.length - 1;
child = parent.getLastChild();
}
while (child != null && !names[i].equals(name)) {
int mark = i;
while (!isDAVElement(child, names[i]) && !names[i].equals(name)) {
if (firstToLast) {
++i;
} else {
--i;
}
}
if (!names[i].equals(name)) {
if (firstToLast) {
child = child.getNextSibling();
} else {
child = child.getPreviousSibling();
}
} else if (!isDAVElement(child, names[i])) {
int pos = i;
found = false;
while (!found && (pos >= 0 && pos < names.length)) {
found = isDAVElement(child, names[pos]);
if (firstToLast) {
++pos;
} else {
--pos;
}
}
if (!found) {
i = mark;
if (firstToLast) {
child = child.getNextSibling();
} else {
child = child.getPreviousSibling();
}
}
}
}
return (Element) child;
} } | public class class_name {
public static Element getChild(Element parent, String name, String[] names, boolean firstToLast) {
Assert.isNotNull(parent);
Assert.isNotNull(name);
Assert.isNotNull(names);
boolean found = false;
for (int i = 0; !found && i < names.length; ++i) {
found = names[i].equals(name); // depends on control dependency: [for], data = [i]
}
Assert.isTrue(found);
int i;
Node child = null;
if (firstToLast) {
i = 0; // depends on control dependency: [if], data = [none]
child = parent.getFirstChild(); // depends on control dependency: [if], data = [none]
} else {
i = names.length - 1; // depends on control dependency: [if], data = [none]
child = parent.getLastChild(); // depends on control dependency: [if], data = [none]
}
while (child != null && !names[i].equals(name)) {
int mark = i;
while (!isDAVElement(child, names[i]) && !names[i].equals(name)) {
if (firstToLast) {
++i; // depends on control dependency: [if], data = [none]
} else {
--i; // depends on control dependency: [if], data = [none]
}
}
if (!names[i].equals(name)) {
if (firstToLast) {
child = child.getNextSibling(); // depends on control dependency: [if], data = [none]
} else {
child = child.getPreviousSibling(); // depends on control dependency: [if], data = [none]
}
} else if (!isDAVElement(child, names[i])) {
int pos = i;
found = false; // depends on control dependency: [if], data = [none]
while (!found && (pos >= 0 && pos < names.length)) {
found = isDAVElement(child, names[pos]); // depends on control dependency: [while], data = [none]
if (firstToLast) {
++pos; // depends on control dependency: [if], data = [none]
} else {
--pos; // depends on control dependency: [if], data = [none]
}
}
if (!found) {
i = mark; // depends on control dependency: [if], data = [none]
if (firstToLast) {
child = child.getNextSibling(); // depends on control dependency: [if], data = [none]
} else {
child = child.getPreviousSibling(); // depends on control dependency: [if], data = [none]
}
}
}
}
return (Element) child;
} } |
public class class_name {
public Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>> listCallbackUrlWithServiceResponseAsync(String resourceGroupName, String workflowName, GetCallbackUrlParameters listCallbackUrl) {
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 (workflowName == null) {
throw new IllegalArgumentException("Parameter workflowName is required and cannot be null.");
}
if (listCallbackUrl == null) {
throw new IllegalArgumentException("Parameter listCallbackUrl is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(listCallbackUrl);
return service.listCallbackUrl(this.client.subscriptionId(), resourceGroupName, workflowName, listCallbackUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>>>() {
@Override
public Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<WorkflowTriggerCallbackUrlInner> clientResponse = listCallbackUrlDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>> listCallbackUrlWithServiceResponseAsync(String resourceGroupName, String workflowName, GetCallbackUrlParameters listCallbackUrl) {
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 (workflowName == null) {
throw new IllegalArgumentException("Parameter workflowName is required and cannot be null.");
}
if (listCallbackUrl == null) {
throw new IllegalArgumentException("Parameter listCallbackUrl is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(listCallbackUrl);
return service.listCallbackUrl(this.client.subscriptionId(), resourceGroupName, workflowName, listCallbackUrl, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>>>() {
@Override
public Observable<ServiceResponse<WorkflowTriggerCallbackUrlInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<WorkflowTriggerCallbackUrlInner> clientResponse = listCallbackUrlDelegate(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 {
@SuppressWarnings("deprecation")
public BUILDER addAccessConstraint(final AccessConstraintDefinition accessConstraint) {
if (accessConstraints == null) {
accessConstraints = new AccessConstraintDefinition[] {accessConstraint};
} else {
accessConstraints = Arrays.copyOf(accessConstraints, accessConstraints.length + 1);
accessConstraints[accessConstraints.length - 1] = accessConstraint;
}
return (BUILDER) this;
} } | public class class_name {
@SuppressWarnings("deprecation")
public BUILDER addAccessConstraint(final AccessConstraintDefinition accessConstraint) {
if (accessConstraints == null) {
accessConstraints = new AccessConstraintDefinition[] {accessConstraint}; // depends on control dependency: [if], data = [none]
} else {
accessConstraints = Arrays.copyOf(accessConstraints, accessConstraints.length + 1); // depends on control dependency: [if], data = [(accessConstraints]
accessConstraints[accessConstraints.length - 1] = accessConstraint; // depends on control dependency: [if], data = [none]
}
return (BUILDER) this;
} } |
public class class_name {
public static void loadDictionary(BufferedReader br, TreeMap<String, CoreDictionary.Attribute> storage, boolean isCSV, Nature defaultNature) throws IOException
{
String splitter = "\\s";
if (isCSV)
{
splitter = ",";
}
String line;
boolean firstLine = true;
while ((line = br.readLine()) != null)
{
if (firstLine)
{
line = IOUtil.removeUTF8BOM(line);
firstLine = false;
}
String param[] = line.split(splitter);
int natureCount = (param.length - 1) / 2;
CoreDictionary.Attribute attribute;
if (natureCount == 0)
{
attribute = new CoreDictionary.Attribute(defaultNature);
}
else
{
attribute = new CoreDictionary.Attribute(natureCount);
for (int i = 0; i < natureCount; ++i)
{
attribute.nature[i] = LexiconUtility.convertStringToNature(param[1 + 2 * i]);
attribute.frequency[i] = Integer.parseInt(param[2 + 2 * i]);
attribute.totalFrequency += attribute.frequency[i];
}
}
storage.put(param[0], attribute);
}
br.close();
} } | public class class_name {
public static void loadDictionary(BufferedReader br, TreeMap<String, CoreDictionary.Attribute> storage, boolean isCSV, Nature defaultNature) throws IOException
{
String splitter = "\\s";
if (isCSV)
{
splitter = ",";
}
String line;
boolean firstLine = true;
while ((line = br.readLine()) != null)
{
if (firstLine)
{
line = IOUtil.removeUTF8BOM(line); // depends on control dependency: [if], data = [none]
firstLine = false; // depends on control dependency: [if], data = [none]
}
String param[] = line.split(splitter);
int natureCount = (param.length - 1) / 2;
CoreDictionary.Attribute attribute;
if (natureCount == 0)
{
attribute = new CoreDictionary.Attribute(defaultNature); // depends on control dependency: [if], data = [none]
}
else
{
attribute = new CoreDictionary.Attribute(natureCount); // depends on control dependency: [if], data = [(natureCount]
for (int i = 0; i < natureCount; ++i)
{
attribute.nature[i] = LexiconUtility.convertStringToNature(param[1 + 2 * i]); // depends on control dependency: [for], data = [i]
attribute.frequency[i] = Integer.parseInt(param[2 + 2 * i]); // depends on control dependency: [for], data = [i]
attribute.totalFrequency += attribute.frequency[i]; // depends on control dependency: [for], data = [i]
}
}
storage.put(param[0], attribute);
}
br.close();
} } |
public class class_name {
public static Level normalize(Level level) {
if (levelMap.containsKey(level.intValue())) {
return levelMap.get(level.intValue());
} else if (level.intValue() >= Level.SEVERE.intValue()) {
return Level.SEVERE;
} else if (level.intValue() >= Level.WARNING.intValue()) {
return Level.WARNING;
} else if (level.intValue() >= Level.INFO.intValue()) {
return Level.INFO;
} else {
return Level.FINE;
}
} } | public class class_name {
public static Level normalize(Level level) {
if (levelMap.containsKey(level.intValue())) {
return levelMap.get(level.intValue()); // depends on control dependency: [if], data = [none]
} else if (level.intValue() >= Level.SEVERE.intValue()) {
return Level.SEVERE; // depends on control dependency: [if], data = [none]
} else if (level.intValue() >= Level.WARNING.intValue()) {
return Level.WARNING; // depends on control dependency: [if], data = [none]
} else if (level.intValue() >= Level.INFO.intValue()) {
return Level.INFO; // depends on control dependency: [if], data = [none]
} else {
return Level.FINE; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) {
notNull(jsonObject, "json can not be null");
notEmpty(key, "key can not be null or empty");
notNull(configuration, "configuration can not be null");
EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true);
for (PathRef updateOperation : evaluationContext.updateOperations()) {
updateOperation.put(key, value, configuration);
}
return resultByConfiguration(jsonObject, configuration, evaluationContext);
} } | public class class_name {
public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) {
notNull(jsonObject, "json can not be null");
notEmpty(key, "key can not be null or empty");
notNull(configuration, "configuration can not be null");
EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true);
for (PathRef updateOperation : evaluationContext.updateOperations()) {
updateOperation.put(key, value, configuration); // depends on control dependency: [for], data = [updateOperation]
}
return resultByConfiguration(jsonObject, configuration, evaluationContext);
} } |
public class class_name {
public void addPackageName(PackageDoc pkg, String parsedPackageName,
Content summariesTree) {
Content pkgNameContent;
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
SectionName.UNNAMED_PACKAGE_ANCHOR));
pkgNameContent = defaultPackageLabel;
} else {
summariesTree.addContent(getMarkerAnchor(
parsedPackageName));
pkgNameContent = getPackageLabel(parsedPackageName);
}
Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
summariesTree.addContent(heading);
} } | public class class_name {
public void addPackageName(PackageDoc pkg, String parsedPackageName,
Content summariesTree) {
Content pkgNameContent;
if (parsedPackageName.length() == 0) {
summariesTree.addContent(getMarkerAnchor(
SectionName.UNNAMED_PACKAGE_ANCHOR)); // depends on control dependency: [if], data = [none]
pkgNameContent = defaultPackageLabel; // depends on control dependency: [if], data = [none]
} else {
summariesTree.addContent(getMarkerAnchor(
parsedPackageName)); // depends on control dependency: [if], data = [none]
pkgNameContent = getPackageLabel(parsedPackageName); // depends on control dependency: [if], data = [none]
}
Content headingContent = new StringContent(".*");
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
pkgNameContent);
heading.addContent(headingContent);
summariesTree.addContent(heading);
} } |
public class class_name {
public boolean initSenSegmenter(String modelDir){
System.out.println("Initilize JVnSenSegmenter ...");
//initialize sentence segmentation
vnSenSegmenter = new JVnSenSegmenter();
if (!vnSenSegmenter.init(modelDir)){
System.out.println("Error while initilizing JVnSenSegmenter");
vnSenSegmenter = null;
return false;
}
return true;
} } | public class class_name {
public boolean initSenSegmenter(String modelDir){
System.out.println("Initilize JVnSenSegmenter ...");
//initialize sentence segmentation
vnSenSegmenter = new JVnSenSegmenter();
if (!vnSenSegmenter.init(modelDir)){
System.out.println("Error while initilizing JVnSenSegmenter");
// depends on control dependency: [if], data = [none]
vnSenSegmenter = null;
// depends on control dependency: [if], data = [none]
return false;
// depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void dropByIndex(int idx) {
SAXRecord entry = realTSindex.get(idx);
if (null != entry) {
realTSindex.remove(idx);
entry.removeIndex(idx);
if (entry.getIndexes().isEmpty()) {
records.remove(String.valueOf(entry.getPayload()));
}
}
} } | public class class_name {
public void dropByIndex(int idx) {
SAXRecord entry = realTSindex.get(idx);
if (null != entry) {
realTSindex.remove(idx); // depends on control dependency: [if], data = [none]
entry.removeIndex(idx); // depends on control dependency: [if], data = [none]
if (entry.getIndexes().isEmpty()) {
records.remove(String.valueOf(entry.getPayload())); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void doListRemove(final Message<JsonObject> message) {
final String name = message.body().getString("name");
if (name == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified."));
return;
}
if (message.body().containsField("index")) {
final int index = message.body().getInteger("index");
context.execute(new Action<Object>() {
@Override
public Object perform() {
return data.getList(formatKey(name)).remove(index);
}
}, new Handler<AsyncResult<Object>>() {
@Override
public void handle(AsyncResult<Object> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else {
message.reply(new JsonObject().putString("status", "ok").putValue("result", result.result()));
}
}
});
} else {
final Object value = message.body().getValue("value");
if (value == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No value specified."));
} else {
context.execute(new Action<Boolean>() {
@Override
public Boolean perform() {
return data.getList(formatKey(name)).remove(value);
}
}, new Handler<AsyncResult<Boolean>>() {
@Override
public void handle(AsyncResult<Boolean> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else {
message.reply(new JsonObject().putString("status", "ok").putBoolean("result", result.result()));
}
}
});
}
}
} } | public class class_name {
private void doListRemove(final Message<JsonObject> message) {
final String name = message.body().getString("name");
if (name == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified.")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (message.body().containsField("index")) {
final int index = message.body().getInteger("index");
context.execute(new Action<Object>() {
@Override
public Object perform() {
return data.getList(formatKey(name)).remove(index);
}
}, new Handler<AsyncResult<Object>>() {
@Override
public void handle(AsyncResult<Object> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none]
} else {
message.reply(new JsonObject().putString("status", "ok").putValue("result", result.result())); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
} else {
final Object value = message.body().getValue("value");
if (value == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "No value specified.")); // depends on control dependency: [if], data = [none]
} else {
context.execute(new Action<Boolean>() {
@Override
public Boolean perform() {
return data.getList(formatKey(name)).remove(value);
}
}, new Handler<AsyncResult<Boolean>>() {
@Override
public void handle(AsyncResult<Boolean> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none]
} else {
message.reply(new JsonObject().putString("status", "ok").putBoolean("result", result.result())); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public int getConnectionRetryTimeout() {
int retval;
if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) {
retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT);
} else {
retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT);
}
Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1");
return retval;
} } | public class class_name {
public int getConnectionRetryTimeout() {
int retval;
if (containsKey(CONNECTION_RETRY_TIMEOUT_MS_PROP)) {
retval = getInt(CONNECTION_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); // depends on control dependency: [if], data = [none]
} else {
retval = getInt(CLIENT_RETRY_TIMEOUT_MS_PROP, CONNECTION_RETRY_TIMEOUT_MS_DEFAULT); // depends on control dependency: [if], data = [none]
}
Preconditions.checkArgument(retval >= -1, CONNECTION_RETRY_TIMEOUT_MS_PROP + " must be >= -1");
return retval;
} } |
public class class_name {
public static ExpectedCondition<Boolean> and(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
for (ExpectedCondition<?> condition : conditions) {
Object result = condition.apply(driver);
if (result instanceof Boolean) {
if (Boolean.FALSE.equals(result)) {
return false;
}
}
if (result == null) {
return false;
}
}
return true;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("all conditions to be valid: ");
Joiner.on(" && ").appendTo(message, conditions);
return message.toString();
}
};
} } | public class class_name {
public static ExpectedCondition<Boolean> and(final ExpectedCondition<?>... conditions) {
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
for (ExpectedCondition<?> condition : conditions) {
Object result = condition.apply(driver);
if (result instanceof Boolean) {
if (Boolean.FALSE.equals(result)) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (result == null) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
}
@Override
public String toString() {
StringBuilder message = new StringBuilder("all conditions to be valid: ");
Joiner.on(" && ").appendTo(message, conditions);
return message.toString();
}
};
} } |
public class class_name {
public static ColumnInformation create(String name, ColumnType type) {
byte[] nameBytes = name.getBytes();
byte[] arr = new byte[23 + 2 * nameBytes.length];
int pos = 0;
//lenenc_str catalog
//lenenc_str schema
//lenenc_str table
//lenenc_str org_table
for (int i = 0; i < 4; i++) {
arr[pos++] = 1;
arr[pos++] = 0;
}
//lenenc_str name
//lenenc_str org_name
for (int i = 0; i < 2; i++) {
arr[pos++] = (byte) name.length();
System.arraycopy(nameBytes, 0, arr, pos, nameBytes.length);
pos += nameBytes.length;
}
//lenenc_int length of fixed-length fields [0c]
arr[pos++] = 0xc;
//2 character set
arr[pos++] = 33; /* charset = UTF8 */
arr[pos++] = 0;
int len;
/* Sensible predefined length - since we're dealing with I_S here, most char fields are 64 char long */
switch (type.getSqlType()) {
case Types.VARCHAR:
case Types.CHAR:
len = 64 * 3; /* 3 bytes per UTF8 char */
break;
case Types.SMALLINT:
len = 5;
break;
case Types.NULL:
len = 0;
break;
default:
len = 1;
break;
}
//
arr[pos] = (byte) len; /* 4 bytes : column length */
pos += 4;
arr[pos++] = (byte) ColumnType.toServer(type.getSqlType()).getType(); /* 1 byte : type */
arr[pos++] = (byte) len; /* 2 bytes : flags */
arr[pos++] = 0;
arr[pos++] = 0; /* decimals */
arr[pos++] = 0; /* 2 bytes filler */
arr[pos] = 0;
return new ColumnInformation(new Buffer(arr));
} } | public class class_name {
public static ColumnInformation create(String name, ColumnType type) {
byte[] nameBytes = name.getBytes();
byte[] arr = new byte[23 + 2 * nameBytes.length];
int pos = 0;
//lenenc_str catalog
//lenenc_str schema
//lenenc_str table
//lenenc_str org_table
for (int i = 0; i < 4; i++) {
arr[pos++] = 1; // depends on control dependency: [for], data = [none]
arr[pos++] = 0; // depends on control dependency: [for], data = [none]
}
//lenenc_str name
//lenenc_str org_name
for (int i = 0; i < 2; i++) {
arr[pos++] = (byte) name.length(); // depends on control dependency: [for], data = [none]
System.arraycopy(nameBytes, 0, arr, pos, nameBytes.length); // depends on control dependency: [for], data = [none]
pos += nameBytes.length; // depends on control dependency: [for], data = [none]
}
//lenenc_int length of fixed-length fields [0c]
arr[pos++] = 0xc;
//2 character set
arr[pos++] = 33; /* charset = UTF8 */
arr[pos++] = 0;
int len;
/* Sensible predefined length - since we're dealing with I_S here, most char fields are 64 char long */
switch (type.getSqlType()) {
case Types.VARCHAR:
case Types.CHAR:
len = 64 * 3; /* 3 bytes per UTF8 char */
break;
case Types.SMALLINT:
len = 5;
break;
case Types.NULL:
len = 0;
break;
default:
len = 1;
break;
}
//
arr[pos] = (byte) len; /* 4 bytes : column length */
pos += 4;
arr[pos++] = (byte) ColumnType.toServer(type.getSqlType()).getType(); /* 1 byte : type */
arr[pos++] = (byte) len; /* 2 bytes : flags */
arr[pos++] = 0;
arr[pos++] = 0; /* decimals */
arr[pos++] = 0; /* 2 bytes filler */
arr[pos] = 0;
return new ColumnInformation(new Buffer(arr));
} } |
public class class_name {
public Object createObjectCache(String reference) {
final String methodName = "createCacheInstance()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + reference);
CacheConfig config = ServerCache.getCacheService().getCacheInstanceConfig(reference);
if (config == null) {
// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not
// configured.
// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be
// initialized. The named instance is not avaliable.
// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource
// named {0}.
Tr.error(tc, "DYNA1004E", new Object[] { reference });
}
/*
* Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same
* time. With this sync one reader has to wait till the other has finished creating the cache instance
*/
DistributedObjectCache dCache = null;
synchronized (config) { // ADDED FOR 378973
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Entered synchronized (config) for " + config.getCacheName());
}
dCache = config.getDistributedObjectCache();
if (dCache == null) {
dCache = createDistributedObjectCache(config);
config.setDistributedObjectCache(dCache);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName in=" + reference + " out=" + reference);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + dCache);
return dCache;
} } | public class class_name {
public Object createObjectCache(String reference) {
final String methodName = "createCacheInstance()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + reference);
CacheConfig config = ServerCache.getCacheService().getCacheInstanceConfig(reference);
if (config == null) {
// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not
// configured.
// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be
// initialized. The named instance is not avaliable.
// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource
// named {0}.
Tr.error(tc, "DYNA1004E", new Object[] { reference }); // depends on control dependency: [if], data = [none]
}
/*
* Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same
* time. With this sync one reader has to wait till the other has finished creating the cache instance
*/
DistributedObjectCache dCache = null;
synchronized (config) { // ADDED FOR 378973
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Entered synchronized (config) for " + config.getCacheName()); // depends on control dependency: [if], data = [none]
}
dCache = config.getDistributedObjectCache();
if (dCache == null) {
dCache = createDistributedObjectCache(config); // depends on control dependency: [if], data = [none]
config.setDistributedObjectCache(dCache); // depends on control dependency: [if], data = [(dCache]
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName in=" + reference + " out=" + reference); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + dCache);
return dCache;
} } |
public class class_name {
@Override
public void inheritHistory(ConnectionWrapper wrapper) {
super.inheritHistory(wrapper);
if (wrapper instanceof HookedConnectionWrapper) {
final HookedConnectionWrapper inherited = (HookedConnectionWrapper) wrapper;
checkingOutRequestPath = inherited.checkingOutRequestPath;
checkingOutEntryExp = inherited.checkingOutEntryExp;
checkingOutUserExp = inherited.checkingOutUserExp;
checkingOutMillis = inherited.checkingOutMillis;
checkingInRequestPath = inherited.checkingInRequestPath;
checkingInEntryExp = inherited.checkingInEntryExp;
checkingInUserExp = inherited.checkingInUserExp;
checkingInMillis = inherited.checkingInMillis;
closingReallyRequestPath = inherited.closingReallyRequestPath;
closingReallyEntryExp = inherited.closingReallyEntryExp;
closingReallyUserExp = inherited.closingReallyUserExp;
closingReallyMillis = inherited.closingReallyMillis;
}
} } | public class class_name {
@Override
public void inheritHistory(ConnectionWrapper wrapper) {
super.inheritHistory(wrapper);
if (wrapper instanceof HookedConnectionWrapper) {
final HookedConnectionWrapper inherited = (HookedConnectionWrapper) wrapper;
checkingOutRequestPath = inherited.checkingOutRequestPath; // depends on control dependency: [if], data = [none]
checkingOutEntryExp = inherited.checkingOutEntryExp; // depends on control dependency: [if], data = [none]
checkingOutUserExp = inherited.checkingOutUserExp; // depends on control dependency: [if], data = [none]
checkingOutMillis = inherited.checkingOutMillis; // depends on control dependency: [if], data = [none]
checkingInRequestPath = inherited.checkingInRequestPath; // depends on control dependency: [if], data = [none]
checkingInEntryExp = inherited.checkingInEntryExp; // depends on control dependency: [if], data = [none]
checkingInUserExp = inherited.checkingInUserExp; // depends on control dependency: [if], data = [none]
checkingInMillis = inherited.checkingInMillis; // depends on control dependency: [if], data = [none]
closingReallyRequestPath = inherited.closingReallyRequestPath; // depends on control dependency: [if], data = [none]
closingReallyEntryExp = inherited.closingReallyEntryExp; // depends on control dependency: [if], data = [none]
closingReallyUserExp = inherited.closingReallyUserExp; // depends on control dependency: [if], data = [none]
closingReallyMillis = inherited.closingReallyMillis; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static final <T extends Appendable> void encodeRun(T buffer, short value, int length) {
try {
char valueChar = (char) value;
if (length < 4) {
for (int j=0; j<length; ++j) {
if (valueChar == ESCAPE) {
buffer.append(ESCAPE);
}
buffer.append(valueChar);
}
}
else {
if (length == ESCAPE) {
if (valueChar == ESCAPE) {
buffer.append(ESCAPE);
}
buffer.append(valueChar);
--length;
}
buffer.append(ESCAPE);
buffer.append((char) length);
buffer.append(valueChar); // Don't need to escape this value
}
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} } | public class class_name {
private static final <T extends Appendable> void encodeRun(T buffer, short value, int length) {
try {
char valueChar = (char) value;
if (length < 4) {
for (int j=0; j<length; ++j) {
if (valueChar == ESCAPE) {
buffer.append(ESCAPE); // depends on control dependency: [if], data = [ESCAPE)]
}
buffer.append(valueChar); // depends on control dependency: [for], data = [none]
}
}
else {
if (length == ESCAPE) {
if (valueChar == ESCAPE) {
buffer.append(ESCAPE); // depends on control dependency: [if], data = [ESCAPE)]
}
buffer.append(valueChar); // depends on control dependency: [if], data = [none]
--length; // depends on control dependency: [if], data = [none]
}
buffer.append(ESCAPE); // depends on control dependency: [if], data = [none]
buffer.append((char) length); // depends on control dependency: [if], data = [none]
buffer.append(valueChar); // Don't need to escape this value // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private HashMap<String, String> parseProgressInfoLine(String line) {
HashMap<String, String> table = null;
Matcher m = PROGRESS_INFO_PATTERN.matcher(line);
while (m.find())
{
if (table == null)
{
table = new HashMap<>();
}
String key = m.group(1);
String value = m.group(2);
table.put(key, value);
}
return table;
} } | public class class_name {
private HashMap<String, String> parseProgressInfoLine(String line) {
HashMap<String, String> table = null;
Matcher m = PROGRESS_INFO_PATTERN.matcher(line);
while (m.find())
{
if (table == null)
{
table = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
String key = m.group(1);
String value = m.group(2);
table.put(key, value); // depends on control dependency: [while], data = [none]
}
return table;
} } |
public class class_name {
public java.lang.String getReportCall() {
java.lang.Object ref = reportCall_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
reportCall_ = s;
}
return s;
}
} } | public class class_name {
public java.lang.String getReportCall() {
java.lang.Object ref = reportCall_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref; // depends on control dependency: [if], data = [none]
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
reportCall_ = s; // depends on control dependency: [if], data = [none]
}
return s; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Class<?> loadClass(
String name,
ClassLoader callerClassLoader) throws ClassNotFoundException
{
Class<?> clazz = null;
try
{
ClassLoader loader = getContextClassLoader();
if (loader != null)
{
clazz = loader.loadClass(name);
}
}
catch (ClassNotFoundException e)
{
// treat as though loader not set
}
if (clazz == null)
{
if (callerClassLoader != null)
{
clazz = callerClassLoader.loadClass(name);
}
else
{
clazz = Class.forName(name);
}
}
return clazz;
} } | public class class_name {
public static Class<?> loadClass(
String name,
ClassLoader callerClassLoader) throws ClassNotFoundException
{
Class<?> clazz = null;
try
{
ClassLoader loader = getContextClassLoader();
if (loader != null)
{
clazz = loader.loadClass(name); // depends on control dependency: [if], data = [none]
}
}
catch (ClassNotFoundException e)
{
// treat as though loader not set
}
if (clazz == null)
{
if (callerClassLoader != null)
{
clazz = callerClassLoader.loadClass(name); // depends on control dependency: [if], data = [none]
}
else
{
clazz = Class.forName(name); // depends on control dependency: [if], data = [none]
}
}
return clazz;
} } |
public class class_name {
@Override
public void reconfigurePropertyImpl(String property, String newVal)
throws ReconfigurationException {
if (property.equals("dfs.data.dir")) {
try {
LOG.info("Reconfigure " + property + " to " + newVal);
this.refreshVolumes(newVal);
} catch (Exception e) {
throw new ReconfigurationException(property,
newVal, getConf().get(property), e);
}
} else {
throw new ReconfigurationException(property, newVal,
getConf().get(property));
}
} } | public class class_name {
@Override
public void reconfigurePropertyImpl(String property, String newVal)
throws ReconfigurationException {
if (property.equals("dfs.data.dir")) {
try {
LOG.info("Reconfigure " + property + " to " + newVal); // depends on control dependency: [try], data = [none]
this.refreshVolumes(newVal); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new ReconfigurationException(property,
newVal, getConf().get(property), e);
} // depends on control dependency: [catch], data = [none]
} else {
throw new ReconfigurationException(property, newVal,
getConf().get(property));
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.