code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static void sortByQualityValue(List<MediaType> mediaTypes) {
checkNotNull(mediaTypes, "'mediaTypes' must not be null");
if (mediaTypes.size() > 1) {
Collections.sort(mediaTypes, QUALITY_VALUE_COMPARATOR);
}
} }
|
public class class_name {
public static void sortByQualityValue(List<MediaType> mediaTypes) {
checkNotNull(mediaTypes, "'mediaTypes' must not be null");
if (mediaTypes.size() > 1) {
Collections.sort(mediaTypes, QUALITY_VALUE_COMPARATOR); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public FacesConfigFlowDefinitionFacesMethodCallType<FacesConfigFlowDefinitionType<T>> getOrCreateMethodCall()
{
List<Node> nodeList = childNode.get("method-call");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionFacesMethodCallTypeImpl<FacesConfigFlowDefinitionType<T>>(this, "method-call", childNode, nodeList.get(0));
}
return createMethodCall();
} }
|
public class class_name {
public FacesConfigFlowDefinitionFacesMethodCallType<FacesConfigFlowDefinitionType<T>> getOrCreateMethodCall()
{
List<Node> nodeList = childNode.get("method-call");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigFlowDefinitionFacesMethodCallTypeImpl<FacesConfigFlowDefinitionType<T>>(this, "method-call", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createMethodCall();
} }
|
public class class_name {
private static List<HostAddress> sortSRVRecords(List<SRVRecord> records) {
// RFC 2782, Usage rules: "If there is precisely one SRV RR, and its Target is "."
// (the root domain), abort."
if (records.size() == 1 && records.get(0).getFQDN().isRootLabel())
return Collections.emptyList();
// sorting the records improves the performance of the bisection later
Collections.sort(records);
// create the priority buckets
SortedMap<Integer, List<SRVRecord>> buckets = new TreeMap<Integer, List<SRVRecord>>();
for (SRVRecord r : records) {
Integer priority = r.getPriority();
List<SRVRecord> bucket = buckets.get(priority);
// create the list of SRVRecords if it doesn't exist
if (bucket == null) {
bucket = new LinkedList<SRVRecord>();
buckets.put(priority, bucket);
}
bucket.add(r);
}
List<HostAddress> res = new ArrayList<HostAddress>(records.size());
for (Integer priority : buckets.keySet()) {
List<SRVRecord> bucket = buckets.get(priority);
int bucketSize;
while ((bucketSize = bucket.size()) > 0) {
int[] totals = new int[bucketSize];
int running_total = 0;
int count = 0;
int zeroWeight = 1;
for (SRVRecord r : bucket) {
if (r.getWeight() > 0) {
zeroWeight = 0;
break;
}
}
for (SRVRecord r : bucket) {
running_total += (r.getWeight() + zeroWeight);
totals[count] = running_total;
count++;
}
int selectedPos;
if (running_total == 0) {
// If running total is 0, then all weights in this priority
// group are 0. So we simply select one of the weights randomly
// as the other 'normal' algorithm is unable to handle this case
selectedPos = (int) (Math.random() * bucketSize);
} else {
double rnd = Math.random() * running_total;
selectedPos = bisect(totals, rnd);
}
// add the SRVRecord that was randomly chosen on it's weight
// to the start of the result list
SRVRecord chosenSRVRecord = bucket.remove(selectedPos);
res.add(chosenSRVRecord);
}
}
return res;
} }
|
public class class_name {
private static List<HostAddress> sortSRVRecords(List<SRVRecord> records) {
// RFC 2782, Usage rules: "If there is precisely one SRV RR, and its Target is "."
// (the root domain), abort."
if (records.size() == 1 && records.get(0).getFQDN().isRootLabel())
return Collections.emptyList();
// sorting the records improves the performance of the bisection later
Collections.sort(records);
// create the priority buckets
SortedMap<Integer, List<SRVRecord>> buckets = new TreeMap<Integer, List<SRVRecord>>();
for (SRVRecord r : records) {
Integer priority = r.getPriority();
List<SRVRecord> bucket = buckets.get(priority);
// create the list of SRVRecords if it doesn't exist
if (bucket == null) {
bucket = new LinkedList<SRVRecord>(); // depends on control dependency: [if], data = [none]
buckets.put(priority, bucket); // depends on control dependency: [if], data = [none]
}
bucket.add(r); // depends on control dependency: [for], data = [r]
}
List<HostAddress> res = new ArrayList<HostAddress>(records.size());
for (Integer priority : buckets.keySet()) {
List<SRVRecord> bucket = buckets.get(priority);
int bucketSize;
while ((bucketSize = bucket.size()) > 0) {
int[] totals = new int[bucketSize];
int running_total = 0;
int count = 0;
int zeroWeight = 1;
for (SRVRecord r : bucket) {
if (r.getWeight() > 0) {
zeroWeight = 0; // depends on control dependency: [if], data = [none]
break;
}
}
for (SRVRecord r : bucket) {
running_total += (r.getWeight() + zeroWeight); // depends on control dependency: [for], data = [r]
totals[count] = running_total; // depends on control dependency: [for], data = [r]
count++; // depends on control dependency: [for], data = [none]
}
int selectedPos;
if (running_total == 0) {
// If running total is 0, then all weights in this priority
// group are 0. So we simply select one of the weights randomly
// as the other 'normal' algorithm is unable to handle this case
selectedPos = (int) (Math.random() * bucketSize); // depends on control dependency: [if], data = [none]
} else {
double rnd = Math.random() * running_total;
selectedPos = bisect(totals, rnd); // depends on control dependency: [if], data = [none]
}
// add the SRVRecord that was randomly chosen on it's weight
// to the start of the result list
SRVRecord chosenSRVRecord = bucket.remove(selectedPos);
res.add(chosenSRVRecord); // depends on control dependency: [while], data = [none]
}
}
return res;
} }
|
public class class_name {
@Override
public void onPositiveButtonClicked(int requestCode) {
if (requestCode == REQUEST_SIMPLE_DIALOG) {
Toast.makeText(c, "Positive button clicked", Toast.LENGTH_SHORT).show();
}
} }
|
public class class_name {
@Override
public void onPositiveButtonClicked(int requestCode) {
if (requestCode == REQUEST_SIMPLE_DIALOG) {
Toast.makeText(c, "Positive button clicked", Toast.LENGTH_SHORT).show(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static void pushOp(String operation, Stack<MetricExpression> expressions, Stack<String> operations) {
if (operation.equals("(")) {
operations.push(operation);
return;
}
if (operation.equals(")")) {
while (!operations.isEmpty()) {
String op = operations.pop();
if (op.equals("("))
return;
doOperation(op, expressions, operations);
}
}
if (operation.equals("*") || operation.equals("/")) {
if (operations.isEmpty())
operations.push(operation);
else {
String op1 = operations.peek();
if (!op1.equals("(")) {
if (op1.equals("+") || op1.equals("-")) {
operations.push(operation);
} else {
doOperation(operations.pop(), expressions, operations);
operations.push(operation);
}
} else {
operations.push(operation);
}
}
}
if (operation.equals("+") || operation.equals("-")) {
if (operations.isEmpty())
operations.push(operation);
else {
String op1 = operations.peek();
if (!op1.equals("(")) {
doOperation(operations.pop(), expressions, operations);
}
operations.push(operation);
}
}
} }
|
public class class_name {
private static void pushOp(String operation, Stack<MetricExpression> expressions, Stack<String> operations) {
if (operation.equals("(")) {
operations.push(operation);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
if (operation.equals(")")) {
while (!operations.isEmpty()) {
String op = operations.pop();
if (op.equals("("))
return;
doOperation(op, expressions, operations);
// depends on control dependency: [while], data = [none]
}
}
if (operation.equals("*") || operation.equals("/")) {
if (operations.isEmpty())
operations.push(operation);
else {
String op1 = operations.peek();
if (!op1.equals("(")) {
if (op1.equals("+") || op1.equals("-")) {
operations.push(operation);
// depends on control dependency: [if], data = [none]
} else {
doOperation(operations.pop(), expressions, operations);
// depends on control dependency: [if], data = [none]
operations.push(operation);
// depends on control dependency: [if], data = [none]
}
} else {
operations.push(operation);
// depends on control dependency: [if], data = [none]
}
}
}
if (operation.equals("+") || operation.equals("-")) {
if (operations.isEmpty())
operations.push(operation);
else {
String op1 = operations.peek();
if (!op1.equals("(")) {
doOperation(operations.pop(), expressions, operations);
// depends on control dependency: [if], data = [none]
}
operations.push(operation);
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public DescribeOptionGroupOptionsResult withOptionGroupOptions(OptionGroupOption... optionGroupOptions) {
if (this.optionGroupOptions == null) {
setOptionGroupOptions(new com.amazonaws.internal.SdkInternalList<OptionGroupOption>(optionGroupOptions.length));
}
for (OptionGroupOption ele : optionGroupOptions) {
this.optionGroupOptions.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeOptionGroupOptionsResult withOptionGroupOptions(OptionGroupOption... optionGroupOptions) {
if (this.optionGroupOptions == null) {
setOptionGroupOptions(new com.amazonaws.internal.SdkInternalList<OptionGroupOption>(optionGroupOptions.length)); // depends on control dependency: [if], data = [none]
}
for (OptionGroupOption ele : optionGroupOptions) {
this.optionGroupOptions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
protected static void dumpInstance (
PrintStream out, Object object, boolean includeToString, String indent)
{
// summarize the current object
summarizeObject(out, object, includeToString, indent);
// increment the indentation level
indent += " ";
// summarize the object's fields
Field[] fields = object.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
try {
Object field = fields[i].get(object);
dumpInstance(out, field, includeToString, indent);
} catch (Exception e) {
out.println(indent + "*** unable to fetch field " +
"[field=" + fields[i] + ", error=" + e + "]");
}
}
} }
|
public class class_name {
protected static void dumpInstance (
PrintStream out, Object object, boolean includeToString, String indent)
{
// summarize the current object
summarizeObject(out, object, includeToString, indent);
// increment the indentation level
indent += " ";
// summarize the object's fields
Field[] fields = object.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
try {
Object field = fields[i].get(object);
dumpInstance(out, field, includeToString, indent); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
out.println(indent + "*** unable to fetch field " +
"[field=" + fields[i] + ", error=" + e + "]");
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
protected void invoke (Connection connection, Object target, InvokeMethod invokeMethod) {
if (DEBUG) {
String argString = "";
if (invokeMethod.args != null) {
argString = Arrays.deepToString(invokeMethod.args);
argString = argString.substring(1, argString.length() - 1);
}
debug("kryonet", connection + " received: " + target.getClass().getSimpleName() + "#"
+ invokeMethod.cachedMethod.method.getName() + "(" + argString + ")");
}
byte responseData = invokeMethod.responseData;
boolean transmitReturnValue = (responseData & returnValueMask) == returnValueMask;
boolean transmitExceptions = (responseData & returnExceptionMask) == returnExceptionMask;
int responseID = responseData & responseIdMask;
CachedMethod cachedMethod = invokeMethod.cachedMethod;
Object result = null;
try {
result = cachedMethod.invoke(target, invokeMethod.args);
} catch (InvocationTargetException ex) {
if (transmitExceptions)
result = ex.getCause();
else
throw new KryoNetException("Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "."
+ cachedMethod.method.getName(), ex);
} catch (Exception ex) {
throw new KryoNetException(
"Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "." + cachedMethod.method.getName(),
ex);
}
if (responseID == 0) return;
InvokeMethodResult invokeMethodResult = new InvokeMethodResult();
invokeMethodResult.objectID = invokeMethod.objectID;
invokeMethodResult.responseID = (byte)responseID;
// Do not return non-primitives if transmitReturnValue is false.
if (!transmitReturnValue && !invokeMethod.cachedMethod.method.getReturnType().isPrimitive()) {
invokeMethodResult.result = null;
} else {
invokeMethodResult.result = result;
}
int length = connection.sendTCP(invokeMethodResult);
if (DEBUG) debug("kryonet", connection + " sent TCP: " + result + " (" + length + ")");
} }
|
public class class_name {
protected void invoke (Connection connection, Object target, InvokeMethod invokeMethod) {
if (DEBUG) {
String argString = "";
if (invokeMethod.args != null) {
argString = Arrays.deepToString(invokeMethod.args); // depends on control dependency: [if], data = [(invokeMethod.args]
argString = argString.substring(1, argString.length() - 1); // depends on control dependency: [if], data = [none]
}
debug("kryonet", connection + " received: " + target.getClass().getSimpleName() + "#"
+ invokeMethod.cachedMethod.method.getName() + "(" + argString + ")");
}
byte responseData = invokeMethod.responseData;
boolean transmitReturnValue = (responseData & returnValueMask) == returnValueMask;
boolean transmitExceptions = (responseData & returnExceptionMask) == returnExceptionMask;
int responseID = responseData & responseIdMask;
CachedMethod cachedMethod = invokeMethod.cachedMethod;
Object result = null;
try {
result = cachedMethod.invoke(target, invokeMethod.args); // depends on control dependency: [try], data = [none]
} catch (InvocationTargetException ex) {
if (transmitExceptions)
result = ex.getCause();
else
throw new KryoNetException("Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "."
+ cachedMethod.method.getName(), ex);
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
throw new KryoNetException(
"Error invoking method: " + cachedMethod.method.getDeclaringClass().getName() + "." + cachedMethod.method.getName(),
ex);
} // depends on control dependency: [catch], data = [none]
if (responseID == 0) return;
InvokeMethodResult invokeMethodResult = new InvokeMethodResult();
invokeMethodResult.objectID = invokeMethod.objectID; // depends on control dependency: [if], data = [none]
invokeMethodResult.responseID = (byte)responseID; // depends on control dependency: [if], data = [none]
// Do not return non-primitives if transmitReturnValue is false.
if (!transmitReturnValue && !invokeMethod.cachedMethod.method.getReturnType().isPrimitive()) {
invokeMethodResult.result = null; // depends on control dependency: [if], data = [none]
} else {
invokeMethodResult.result = result; // depends on control dependency: [if], data = [none]
}
int length = connection.sendTCP(invokeMethodResult);
if (DEBUG) debug("kryonet", connection + " sent TCP: " + result + " (" + length + ")");
} }
|
public class class_name {
String eglErrorToString(int errorCode) {
if (errorCode >= 0x3000 && errorCode < 0x3020) {
for (Field field : EGL.class.getFields()) {
try {
if (field.getName().startsWith("EGL_")
&& field.getType() == Integer.TYPE
&& field.getInt(null) == errorCode) {
return field.getName();
}
} catch (IllegalAccessException e) {
}
}
}
return new Formatter()
.format("0x%04x", errorCode & 0xffff)
.out()
.toString();
} }
|
public class class_name {
String eglErrorToString(int errorCode) {
if (errorCode >= 0x3000 && errorCode < 0x3020) {
for (Field field : EGL.class.getFields()) {
try {
if (field.getName().startsWith("EGL_")
&& field.getType() == Integer.TYPE
&& field.getInt(null) == errorCode) {
return field.getName(); // depends on control dependency: [if], data = [none]
}
} catch (IllegalAccessException e) {
} // depends on control dependency: [catch], data = [none]
}
}
return new Formatter()
.format("0x%04x", errorCode & 0xffff)
.out()
.toString();
} }
|
public class class_name {
public byte[] getEncodedPKCS7(byte secondDigest[], Calendar signingTime, TSAClient tsaClient, byte[] ocsp) {
try {
if (externalDigest != null) {
digest = externalDigest;
if (RSAdata != null)
RSAdata = externalRSAdata;
}
else if (externalRSAdata != null && RSAdata != null) {
RSAdata = externalRSAdata;
sig.update(RSAdata);
digest = sig.sign();
}
else {
if (RSAdata != null) {
RSAdata = messageDigest.digest();
sig.update(RSAdata);
}
digest = sig.sign();
}
// Create the set of Hash algorithms
ASN1EncodableVector digestAlgorithms = new ASN1EncodableVector();
for(Iterator it = digestalgos.iterator(); it.hasNext();) {
ASN1EncodableVector algos = new ASN1EncodableVector();
algos.add(new ASN1ObjectIdentifier((String)it.next()));
algos.add(DERNull.INSTANCE);
digestAlgorithms.add(new DERSequence(algos));
}
// Create the contentInfo.
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new ASN1ObjectIdentifier(ID_PKCS7_DATA));
if (RSAdata != null)
v.add(new DERTaggedObject(0, new DEROctetString(RSAdata)));
DERSequence contentinfo = new DERSequence(v);
// Get all the certificates
//
v = new ASN1EncodableVector();
for (Iterator i = certs.iterator(); i.hasNext();) {
ASN1InputStream tempstream = new ASN1InputStream(new ByteArrayInputStream(((X509Certificate)i.next()).getEncoded()));
v.add(tempstream.readObject());
}
DERSet dercertificates = new DERSet(v);
// Create signerinfo structure.
//
ASN1EncodableVector signerinfo = new ASN1EncodableVector();
// Add the signerInfo version
//
signerinfo.add(new ASN1Integer(signerversion));
v = new ASN1EncodableVector();
v.add(getIssuer(signCert.getTBSCertificate()));
v.add(new ASN1Integer(signCert.getSerialNumber()));
signerinfo.add(new DERSequence(v));
// Add the digestAlgorithm
v = new ASN1EncodableVector();
v.add(new ASN1ObjectIdentifier(digestAlgorithm));
v.add(DERNull.INSTANCE);
signerinfo.add(new DERSequence(v));
// add the authenticated attribute if present
if (secondDigest != null && signingTime != null) {
signerinfo.add(new DERTaggedObject(false, 0, getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp)));
}
// Add the digestEncryptionAlgorithm
v = new ASN1EncodableVector();
v.add(new ASN1ObjectIdentifier(digestEncryptionAlgorithm));
v.add(DERNull.INSTANCE);
signerinfo.add(new DERSequence(v));
// Add the digest
signerinfo.add(new DEROctetString(digest));
// When requested, go get and add the timestamp. May throw an exception.
// Added by Martin Brunecky, 07/12/2007 folowing Aiken Sam, 2006-11-15
// Sam found Adobe expects time-stamped SHA1-1 of the encrypted digest
if (tsaClient != null) {
byte[] tsImprint = MessageDigest.getInstance("SHA-1").digest(digest);
byte[] tsToken = tsaClient.getTimeStampToken(this, tsImprint);
if (tsToken != null) {
ASN1EncodableVector unauthAttributes = buildUnauthenticatedAttributes(tsToken);
if (unauthAttributes != null) {
signerinfo.add(new DERTaggedObject(false, 1, new DERSet(unauthAttributes)));
}
}
}
// Finally build the body out of all the components above
ASN1EncodableVector body = new ASN1EncodableVector();
body.add(new ASN1Integer(version));
body.add(new DERSet(digestAlgorithms));
body.add(contentinfo);
body.add(new DERTaggedObject(false, 0, dercertificates));
if (!crls.isEmpty()) {
v = new ASN1EncodableVector();
for (Iterator i = crls.iterator();i.hasNext();) {
ASN1InputStream t = new ASN1InputStream(new ByteArrayInputStream(((X509CRL)i.next()).getEncoded()));
v.add(t.readObject());
}
DERSet dercrls = new DERSet(v);
body.add(new DERTaggedObject(false, 1, dercrls));
}
// Only allow one signerInfo
body.add(new DERSet(new DERSequence(signerinfo)));
// Now we have the body, wrap it in it's PKCS7Signed shell
// and return it
//
ASN1EncodableVector whole = new ASN1EncodableVector();
whole.add(new ASN1ObjectIdentifier(ID_PKCS7_SIGNED_DATA));
whole.add(new DERTaggedObject(0, new DERSequence(body)));
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream dout = new ASN1OutputStream(bOut);
dout.writeObject(new DERSequence(whole));
dout.close();
return bOut.toByteArray();
}
catch (Exception e) {
throw new ExceptionConverter(e);
}
} }
|
public class class_name {
public byte[] getEncodedPKCS7(byte secondDigest[], Calendar signingTime, TSAClient tsaClient, byte[] ocsp) {
try {
if (externalDigest != null) {
digest = externalDigest; // depends on control dependency: [if], data = [none]
if (RSAdata != null)
RSAdata = externalRSAdata;
}
else if (externalRSAdata != null && RSAdata != null) {
RSAdata = externalRSAdata; // depends on control dependency: [if], data = [none]
sig.update(RSAdata); // depends on control dependency: [if], data = [none]
digest = sig.sign(); // depends on control dependency: [if], data = [none]
}
else {
if (RSAdata != null) {
RSAdata = messageDigest.digest(); // depends on control dependency: [if], data = [none]
sig.update(RSAdata); // depends on control dependency: [if], data = [(RSAdata]
}
digest = sig.sign(); // depends on control dependency: [if], data = [none]
}
// Create the set of Hash algorithms
ASN1EncodableVector digestAlgorithms = new ASN1EncodableVector();
for(Iterator it = digestalgos.iterator(); it.hasNext();) {
ASN1EncodableVector algos = new ASN1EncodableVector();
algos.add(new ASN1ObjectIdentifier((String)it.next())); // depends on control dependency: [for], data = [it]
algos.add(DERNull.INSTANCE); // depends on control dependency: [for], data = [none]
digestAlgorithms.add(new DERSequence(algos)); // depends on control dependency: [for], data = [none]
}
// Create the contentInfo.
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new ASN1ObjectIdentifier(ID_PKCS7_DATA)); // depends on control dependency: [try], data = [none]
if (RSAdata != null)
v.add(new DERTaggedObject(0, new DEROctetString(RSAdata)));
DERSequence contentinfo = new DERSequence(v);
// Get all the certificates
//
v = new ASN1EncodableVector(); // depends on control dependency: [try], data = [none]
for (Iterator i = certs.iterator(); i.hasNext();) {
ASN1InputStream tempstream = new ASN1InputStream(new ByteArrayInputStream(((X509Certificate)i.next()).getEncoded()));
v.add(tempstream.readObject()); // depends on control dependency: [for], data = [none]
}
DERSet dercertificates = new DERSet(v);
// Create signerinfo structure.
//
ASN1EncodableVector signerinfo = new ASN1EncodableVector();
// Add the signerInfo version
//
signerinfo.add(new ASN1Integer(signerversion)); // depends on control dependency: [try], data = [none]
v = new ASN1EncodableVector(); // depends on control dependency: [try], data = [none]
v.add(getIssuer(signCert.getTBSCertificate())); // depends on control dependency: [try], data = [none]
v.add(new ASN1Integer(signCert.getSerialNumber())); // depends on control dependency: [try], data = [none]
signerinfo.add(new DERSequence(v)); // depends on control dependency: [try], data = [none]
// Add the digestAlgorithm
v = new ASN1EncodableVector(); // depends on control dependency: [try], data = [none]
v.add(new ASN1ObjectIdentifier(digestAlgorithm)); // depends on control dependency: [try], data = [none]
v.add(DERNull.INSTANCE); // depends on control dependency: [try], data = [none]
signerinfo.add(new DERSequence(v)); // depends on control dependency: [try], data = [none]
// add the authenticated attribute if present
if (secondDigest != null && signingTime != null) {
signerinfo.add(new DERTaggedObject(false, 0, getAuthenticatedAttributeSet(secondDigest, signingTime, ocsp))); // depends on control dependency: [if], data = [(secondDigest]
}
// Add the digestEncryptionAlgorithm
v = new ASN1EncodableVector(); // depends on control dependency: [try], data = [none]
v.add(new ASN1ObjectIdentifier(digestEncryptionAlgorithm)); // depends on control dependency: [try], data = [none]
v.add(DERNull.INSTANCE); // depends on control dependency: [try], data = [none]
signerinfo.add(new DERSequence(v)); // depends on control dependency: [try], data = [none]
// Add the digest
signerinfo.add(new DEROctetString(digest)); // depends on control dependency: [try], data = [none]
// When requested, go get and add the timestamp. May throw an exception.
// Added by Martin Brunecky, 07/12/2007 folowing Aiken Sam, 2006-11-15
// Sam found Adobe expects time-stamped SHA1-1 of the encrypted digest
if (tsaClient != null) {
byte[] tsImprint = MessageDigest.getInstance("SHA-1").digest(digest);
byte[] tsToken = tsaClient.getTimeStampToken(this, tsImprint);
if (tsToken != null) {
ASN1EncodableVector unauthAttributes = buildUnauthenticatedAttributes(tsToken);
if (unauthAttributes != null) {
signerinfo.add(new DERTaggedObject(false, 1, new DERSet(unauthAttributes))); // depends on control dependency: [if], data = [(unauthAttributes]
}
}
}
// Finally build the body out of all the components above
ASN1EncodableVector body = new ASN1EncodableVector();
body.add(new ASN1Integer(version)); // depends on control dependency: [try], data = [none]
body.add(new DERSet(digestAlgorithms)); // depends on control dependency: [try], data = [none]
body.add(contentinfo); // depends on control dependency: [try], data = [none]
body.add(new DERTaggedObject(false, 0, dercertificates)); // depends on control dependency: [try], data = [none]
if (!crls.isEmpty()) {
v = new ASN1EncodableVector(); // depends on control dependency: [if], data = [none]
for (Iterator i = crls.iterator();i.hasNext();) {
ASN1InputStream t = new ASN1InputStream(new ByteArrayInputStream(((X509CRL)i.next()).getEncoded()));
v.add(t.readObject()); // depends on control dependency: [for], data = [none]
}
DERSet dercrls = new DERSet(v);
body.add(new DERTaggedObject(false, 1, dercrls)); // depends on control dependency: [if], data = [none]
}
// Only allow one signerInfo
body.add(new DERSet(new DERSequence(signerinfo))); // depends on control dependency: [try], data = [none]
// Now we have the body, wrap it in it's PKCS7Signed shell
// and return it
//
ASN1EncodableVector whole = new ASN1EncodableVector();
whole.add(new ASN1ObjectIdentifier(ID_PKCS7_SIGNED_DATA)); // depends on control dependency: [try], data = [none]
whole.add(new DERTaggedObject(0, new DERSequence(body))); // depends on control dependency: [try], data = [none]
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
ASN1OutputStream dout = new ASN1OutputStream(bOut);
dout.writeObject(new DERSequence(whole)); // depends on control dependency: [try], data = [none]
dout.close(); // depends on control dependency: [try], data = [none]
return bOut.toByteArray(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new ExceptionConverter(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected void onMessage(final ODistributedRequest iRequest) {
String senderNodeName = null;
for (int retry = 0; retry < 10; retry++) {
senderNodeName = manager.getNodeNameById(iRequest.getId().getNodeId());
if (senderNodeName != null)
break;
try {
Thread.sleep(200);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw OException.wrapException(new ODistributedException("Execution has been interrupted"), e);
}
}
if (senderNodeName == null) {
ODistributedServerLog.warn(this, localNodeName, senderNodeName, DIRECTION.IN,
"Sender server id %d is not registered in the cluster configuration, discard the request: (%s) (worker=%d)",
iRequest.getId().getNodeId(), iRequest, id);
sendResponseBack(iRequest, new ODistributedException("Sender server id " + iRequest.getId().getNodeId()
+ " is not registered in the cluster configuration, discard the request"));
return;
}
final ORemoteTask task = iRequest.getTask();
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, senderNodeName, DIRECTION.IN, "Received request: (%s) (worker=%d)", iRequest, id);
// EXECUTE IT LOCALLY
Object responsePayload = null;
OSecurityUser origin = null;
try {
waitNodeIsOnline();
distributed.waitIsReady(task);
// EXECUTE THE TASK
for (int retry = 1; running; ++retry) {
if (task.isUsingDatabase()) {
initDatabaseInstance();
if (database == null)
throw new ODistributedOperationException(
"Error on executing remote request because the database '" + databaseName + "' is not available");
// keep original user in database, check the username passed in request and set new user in DB, after document saved,
// reset to original user
if (database != null) {
database.activateOnCurrentThread();
origin = database.getUser();
try {
if (iRequest.getUserRID() != null && iRequest.getUserRID().isValid() && (lastUser == null || !(lastUser.getIdentity())
.equals(iRequest.getUserRID()))) {
lastUser = database.getMetadata().getSecurity().getUser(iRequest.getUserRID());
database.setUser(lastUser);// set to new user
} else
origin = null;
} catch (Exception ex) {
OLogManager.instance().error(this, "Failed on user switching database. ", ex);
}
}
}
responsePayload = manager.executeOnLocalNode(iRequest.getId(), iRequest.getTask(), database);
if (responsePayload instanceof OModificationOperationProhibitedException) {
// RETRY
try {
ODistributedServerLog.info(this, localNodeName, senderNodeName, DIRECTION.IN,
"Database is frozen, waiting and retrying. Request %s (retry=%d, worker=%d)", iRequest, retry, id);
Thread.sleep(1000);
} catch (InterruptedException e) {
}
} else {
// OPERATION EXECUTED (OK OR ERROR), NO RETRY NEEDED
if (retry > 1)
ODistributedServerLog
.info(this, localNodeName, senderNodeName, DIRECTION.IN, "Request %s succeed after retry=%d", iRequest, retry);
break;
}
}
} catch (RuntimeException e) {
if (task.hasResponse())
sendResponseBack(iRequest, e);
throw e;
} finally {
if (database != null && !database.isClosed()) {
database.activateOnCurrentThread();
if (!database.isClosed()) {
database.rollback();
database.getLocalCache().clear();
if (origin != null)
database.setUser(origin);
}
}
}
if (task.hasResponse()) {
if (!sendResponseBack(iRequest, responsePayload)) {
handleError(iRequest, responsePayload);
}
}
} }
|
public class class_name {
protected void onMessage(final ODistributedRequest iRequest) {
String senderNodeName = null;
for (int retry = 0; retry < 10; retry++) {
senderNodeName = manager.getNodeNameById(iRequest.getId().getNodeId()); // depends on control dependency: [for], data = [none]
if (senderNodeName != null)
break;
try {
Thread.sleep(200); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw OException.wrapException(new ODistributedException("Execution has been interrupted"), e);
} // depends on control dependency: [catch], data = [none]
}
if (senderNodeName == null) {
ODistributedServerLog.warn(this, localNodeName, senderNodeName, DIRECTION.IN,
"Sender server id %d is not registered in the cluster configuration, discard the request: (%s) (worker=%d)", // depends on control dependency: [if], data = [none]
iRequest.getId().getNodeId(), iRequest, id); // depends on control dependency: [if], data = [none]
sendResponseBack(iRequest, new ODistributedException("Sender server id " + iRequest.getId().getNodeId()
+ " is not registered in the cluster configuration, discard the request")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final ORemoteTask task = iRequest.getTask();
if (ODistributedServerLog.isDebugEnabled())
ODistributedServerLog
.debug(this, localNodeName, senderNodeName, DIRECTION.IN, "Received request: (%s) (worker=%d)", iRequest, id);
// EXECUTE IT LOCALLY
Object responsePayload = null;
OSecurityUser origin = null;
try {
waitNodeIsOnline(); // depends on control dependency: [try], data = [none]
distributed.waitIsReady(task); // depends on control dependency: [try], data = [none]
// EXECUTE THE TASK
for (int retry = 1; running; ++retry) {
if (task.isUsingDatabase()) {
initDatabaseInstance(); // depends on control dependency: [if], data = [none]
if (database == null)
throw new ODistributedOperationException(
"Error on executing remote request because the database '" + databaseName + "' is not available");
// keep original user in database, check the username passed in request and set new user in DB, after document saved,
// reset to original user
if (database != null) {
database.activateOnCurrentThread(); // depends on control dependency: [if], data = [none]
origin = database.getUser(); // depends on control dependency: [if], data = [none]
try {
if (iRequest.getUserRID() != null && iRequest.getUserRID().isValid() && (lastUser == null || !(lastUser.getIdentity())
.equals(iRequest.getUserRID()))) {
lastUser = database.getMetadata().getSecurity().getUser(iRequest.getUserRID()); // depends on control dependency: [if], data = [(iRequest.getUserRID()]
database.setUser(lastUser);// set to new user // depends on control dependency: [if], data = [none]
} else
origin = null;
} catch (Exception ex) {
OLogManager.instance().error(this, "Failed on user switching database. ", ex);
} // depends on control dependency: [catch], data = [none]
}
}
responsePayload = manager.executeOnLocalNode(iRequest.getId(), iRequest.getTask(), database); // depends on control dependency: [for], data = [none]
if (responsePayload instanceof OModificationOperationProhibitedException) {
// RETRY
try {
ODistributedServerLog.info(this, localNodeName, senderNodeName, DIRECTION.IN,
"Database is frozen, waiting and retrying. Request %s (retry=%d, worker=%d)", iRequest, retry, id); // depends on control dependency: [try], data = [none]
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
} // depends on control dependency: [catch], data = [none]
} else {
// OPERATION EXECUTED (OK OR ERROR), NO RETRY NEEDED
if (retry > 1)
ODistributedServerLog
.info(this, localNodeName, senderNodeName, DIRECTION.IN, "Request %s succeed after retry=%d", iRequest, retry);
break;
}
}
} catch (RuntimeException e) {
if (task.hasResponse())
sendResponseBack(iRequest, e);
throw e;
} finally { // depends on control dependency: [catch], data = [none]
if (database != null && !database.isClosed()) {
database.activateOnCurrentThread(); // depends on control dependency: [if], data = [none]
if (!database.isClosed()) {
database.rollback(); // depends on control dependency: [if], data = [none]
database.getLocalCache().clear(); // depends on control dependency: [if], data = [none]
if (origin != null)
database.setUser(origin);
}
}
}
if (task.hasResponse()) {
if (!sendResponseBack(iRequest, responsePayload)) {
handleError(iRequest, responsePayload); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
void removeInternal(Node<K, V> node, boolean unlink) {
if (unlink) {
node.prev.next = node.next;
node.next.prev = node.prev;
}
Node<K, V> left = node.left;
Node<K, V> right = node.right;
Node<K, V> originalParent = node.parent;
if (left != null && right != null) {
/*
* To remove a node with both left and right subtrees, move an
* adjacent node from one of those subtrees into this node's place.
*
* Removing the adjacent node may change this node's subtrees. This
* node may no longer have two subtrees once the adjacent node is
* gone!
*/
Node<K, V> adjacent = (left.height > right.height) ? left.last() : right.first();
removeInternal(adjacent, false); // takes care of rebalance and size--
int leftHeight = 0;
left = node.left;
if (left != null) {
leftHeight = left.height;
adjacent.left = left;
left.parent = adjacent;
node.left = null;
}
int rightHeight = 0;
right = node.right;
if (right != null) {
rightHeight = right.height;
adjacent.right = right;
right.parent = adjacent;
node.right = null;
}
adjacent.height = Math.max(leftHeight, rightHeight) + 1;
replaceInParent(node, adjacent);
return;
} else if (left != null) {
replaceInParent(node, left);
node.left = null;
} else if (right != null) {
replaceInParent(node, right);
node.right = null;
} else {
replaceInParent(node, null);
}
rebalance(originalParent, false);
size--;
modCount++;
} }
|
public class class_name {
void removeInternal(Node<K, V> node, boolean unlink) {
if (unlink) {
node.prev.next = node.next; // depends on control dependency: [if], data = [none]
node.next.prev = node.prev; // depends on control dependency: [if], data = [none]
}
Node<K, V> left = node.left;
Node<K, V> right = node.right;
Node<K, V> originalParent = node.parent;
if (left != null && right != null) {
/*
* To remove a node with both left and right subtrees, move an
* adjacent node from one of those subtrees into this node's place.
*
* Removing the adjacent node may change this node's subtrees. This
* node may no longer have two subtrees once the adjacent node is
* gone!
*/
Node<K, V> adjacent = (left.height > right.height) ? left.last() : right.first();
removeInternal(adjacent, false); // takes care of rebalance and size-- // depends on control dependency: [if], data = [none]
int leftHeight = 0;
left = node.left; // depends on control dependency: [if], data = [none]
if (left != null) {
leftHeight = left.height; // depends on control dependency: [if], data = [none]
adjacent.left = left; // depends on control dependency: [if], data = [none]
left.parent = adjacent; // depends on control dependency: [if], data = [none]
node.left = null; // depends on control dependency: [if], data = [none]
}
int rightHeight = 0;
right = node.right; // depends on control dependency: [if], data = [none]
if (right != null) {
rightHeight = right.height; // depends on control dependency: [if], data = [none]
adjacent.right = right; // depends on control dependency: [if], data = [none]
right.parent = adjacent; // depends on control dependency: [if], data = [none]
node.right = null; // depends on control dependency: [if], data = [none]
}
adjacent.height = Math.max(leftHeight, rightHeight) + 1; // depends on control dependency: [if], data = [(left]
replaceInParent(node, adjacent); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (left != null) {
replaceInParent(node, left); // depends on control dependency: [if], data = [none]
node.left = null; // depends on control dependency: [if], data = [none]
} else if (right != null) {
replaceInParent(node, right); // depends on control dependency: [if], data = [none]
node.right = null; // depends on control dependency: [if], data = [none]
} else {
replaceInParent(node, null); // depends on control dependency: [if], data = [null)]
}
rebalance(originalParent, false);
size--;
modCount++;
} }
|
public class class_name {
@Override
public CommerceShipment fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey);
if (serializable == nullModel) {
return null;
}
CommerceShipment commerceShipment = (CommerceShipment)serializable;
if (commerceShipment == null) {
Session session = null;
try {
session = openSession();
commerceShipment = (CommerceShipment)session.get(CommerceShipmentImpl.class,
primaryKey);
if (commerceShipment != null) {
cacheResult(commerceShipment);
}
else {
entityCache.putResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey, nullModel);
}
}
catch (Exception e) {
entityCache.removeResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey);
throw processException(e);
}
finally {
closeSession(session);
}
}
return commerceShipment;
} }
|
public class class_name {
@Override
public CommerceShipment fetchByPrimaryKey(Serializable primaryKey) {
Serializable serializable = entityCache.getResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey);
if (serializable == nullModel) {
return null; // depends on control dependency: [if], data = [none]
}
CommerceShipment commerceShipment = (CommerceShipment)serializable;
if (commerceShipment == null) {
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
commerceShipment = (CommerceShipment)session.get(CommerceShipmentImpl.class,
primaryKey); // depends on control dependency: [try], data = [none]
if (commerceShipment != null) {
cacheResult(commerceShipment); // depends on control dependency: [if], data = [(commerceShipment]
}
else {
entityCache.putResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey, nullModel); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e) {
entityCache.removeResult(CommerceShipmentModelImpl.ENTITY_CACHE_ENABLED,
CommerceShipmentImpl.class, primaryKey);
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
}
return commerceShipment;
} }
|
public class class_name {
private FieldDoc[] fields(boolean filter, boolean enumConstants) {
List<FieldDocImpl> fields = List.nil();
for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
if (sym != null && sym.kind == VAR) {
VarSymbol s = (VarSymbol)sym;
boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
!env.legacyDoclet;
if (isEnum == enumConstants &&
(!filter || env.shouldDocument(s))) {
fields = fields.prepend(env.getFieldDoc(s));
}
}
}
return fields.toArray(new FieldDocImpl[fields.length()]);
} }
|
public class class_name {
private FieldDoc[] fields(boolean filter, boolean enumConstants) {
List<FieldDocImpl> fields = List.nil();
for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
if (sym != null && sym.kind == VAR) {
VarSymbol s = (VarSymbol)sym;
boolean isEnum = ((s.flags() & Flags.ENUM) != 0) &&
!env.legacyDoclet;
if (isEnum == enumConstants &&
(!filter || env.shouldDocument(s))) {
fields = fields.prepend(env.getFieldDoc(s)); // depends on control dependency: [if], data = [none]
}
}
}
return fields.toArray(new FieldDocImpl[fields.length()]);
} }
|
public class class_name {
private String generateAbbreviatedExceptionMessage(final Throwable throwable) {
final StringBuilder builder = new StringBuilder();
builder.append(": ");
builder.append(throwable.getClass().getCanonicalName());
builder.append(": ");
builder.append(throwable.getMessage());
Throwable cause = throwable.getCause();
while (cause != null) {
builder.append('\n');
builder.append("Caused by: ");
builder.append(cause.getClass().getCanonicalName());
builder.append(": ");
builder.append(cause.getMessage());
// make sure the exception cause is not itself to prevent infinite
// looping
assert (cause != cause.getCause());
cause = (cause == cause.getCause() ? null : cause.getCause());
}
return builder.toString();
} }
|
public class class_name {
private String generateAbbreviatedExceptionMessage(final Throwable throwable) {
final StringBuilder builder = new StringBuilder();
builder.append(": ");
builder.append(throwable.getClass().getCanonicalName());
builder.append(": ");
builder.append(throwable.getMessage());
Throwable cause = throwable.getCause();
while (cause != null) {
builder.append('\n'); // depends on control dependency: [while], data = [none]
builder.append("Caused by: "); // depends on control dependency: [while], data = [none]
builder.append(cause.getClass().getCanonicalName()); // depends on control dependency: [while], data = [(cause]
builder.append(": "); // depends on control dependency: [while], data = [none]
builder.append(cause.getMessage()); // depends on control dependency: [while], data = [(cause]
// make sure the exception cause is not itself to prevent infinite
// looping
assert (cause != cause.getCause()); // depends on control dependency: [while], data = [(cause]
cause = (cause == cause.getCause() ? null : cause.getCause()); // depends on control dependency: [while], data = [(cause]
}
return builder.toString();
} }
|
public class class_name {
@SuppressWarnings("unused")
public boolean isInRestoreState(View view) {
//noinspection SimplifiableIfStatement
if (mViewState != null) {
return mViewState.isInRestoreState(view);
}
return false;
} }
|
public class class_name {
@SuppressWarnings("unused")
public boolean isInRestoreState(View view) {
//noinspection SimplifiableIfStatement
if (mViewState != null) {
return mViewState.isInRestoreState(view); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
protected final Vertex addIntent(final E proposed, Vertex generator) {
generator = supremum(proposed, generator);
if (filter(generator, proposed) && filter(proposed, generator)) {
return generator;
}
List parents = new ArrayList<>();
for (Edge edge : generator.getEdges(Direction.BOTH)) {
Vertex target = edge.getVertex(Direction.OUT);
if (filter(target, generator)) {
continue;
}
Vertex candidate = target;
if (!filter(target, proposed) && !filter(proposed, target)) {
E targetElement = target.getProperty(LABEL);
E intersect = (E) targetElement.intersect(proposed);
candidate = addIntent(intersect, candidate);
}
boolean add = true;
List doomed = new ArrayList<>();
for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
Vertex parent = (Vertex) it.next();
if (filter(parent, candidate)) {
add = false;
break;
}
else if (filter(candidate, parent)) {
doomed.add(parent);
}
}
for (java.util.Iterator it = doomed.iterator(); it.hasNext();) {
Vertex vertex = (Vertex) it.next();
parents.remove(vertex);
}
if (add) {
parents.add(candidate);
}
}
E generatorLabel = generator.getProperty(LABEL);
Vertex child = insert((E) proposed.union(generatorLabel));
addUndirectedEdge(generator, child, "");
bottom = filter(bottom, proposed) ? child : bottom;
for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
Vertex parent = (Vertex) it.next();
if (!parent.equals(generator)) {
removeUndirectedEdge(parent, generator);
addUndirectedEdge(parent, child, "");
}
}
return child;
} }
|
public class class_name {
protected final Vertex addIntent(final E proposed, Vertex generator) {
generator = supremum(proposed, generator);
if (filter(generator, proposed) && filter(proposed, generator)) {
return generator; // depends on control dependency: [if], data = [none]
}
List parents = new ArrayList<>();
for (Edge edge : generator.getEdges(Direction.BOTH)) {
Vertex target = edge.getVertex(Direction.OUT);
if (filter(target, generator)) {
continue;
}
Vertex candidate = target;
if (!filter(target, proposed) && !filter(proposed, target)) {
E targetElement = target.getProperty(LABEL);
E intersect = (E) targetElement.intersect(proposed);
candidate = addIntent(intersect, candidate); // depends on control dependency: [if], data = [none]
}
boolean add = true;
List doomed = new ArrayList<>();
for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
Vertex parent = (Vertex) it.next();
if (filter(parent, candidate)) {
add = false; // depends on control dependency: [if], data = [none]
break;
}
else if (filter(candidate, parent)) {
doomed.add(parent); // depends on control dependency: [if], data = [none]
}
}
for (java.util.Iterator it = doomed.iterator(); it.hasNext();) {
Vertex vertex = (Vertex) it.next();
parents.remove(vertex); // depends on control dependency: [for], data = [none]
}
if (add) {
parents.add(candidate); // depends on control dependency: [if], data = [none]
}
}
E generatorLabel = generator.getProperty(LABEL);
Vertex child = insert((E) proposed.union(generatorLabel));
addUndirectedEdge(generator, child, "");
bottom = filter(bottom, proposed) ? child : bottom;
for (java.util.Iterator it = parents.iterator(); it.hasNext();) {
Vertex parent = (Vertex) it.next();
if (!parent.equals(generator)) {
removeUndirectedEdge(parent, generator); // depends on control dependency: [if], data = [none]
addUndirectedEdge(parent, child, ""); // depends on control dependency: [if], data = [none]
}
}
return child;
} }
|
public class class_name {
static final int match(String text, int pos, String str) {
for (int i = 0; i < str.length() && pos >= 0;) {
int ch = UTF16.charAt(str, i);
i += UTF16.getCharCount(ch);
if (isBidiMark(ch)) {
continue;
}
pos = match(text, pos, ch);
if (PatternProps.isWhiteSpace(ch)) {
i = skipPatternWhiteSpace(str, i);
}
}
return pos;
} }
|
public class class_name {
static final int match(String text, int pos, String str) {
for (int i = 0; i < str.length() && pos >= 0;) {
int ch = UTF16.charAt(str, i);
i += UTF16.getCharCount(ch); // depends on control dependency: [for], data = [i]
if (isBidiMark(ch)) {
continue;
}
pos = match(text, pos, ch); // depends on control dependency: [for], data = [none]
if (PatternProps.isWhiteSpace(ch)) {
i = skipPatternWhiteSpace(str, i); // depends on control dependency: [if], data = [none]
}
}
return pos;
} }
|
public class class_name {
private ManagementVertex getCandidateVertex(final TraversalEntry te, final boolean forward) {
if (forward) {
while (true) {
if (this.confinedToStage && te.getCurrentChannel() == 0) {
while (currentGateLeadsToOtherStage(te, this.forward)) {
te.increaseCurrentGate();
}
}
// No more outgoing edges to consider
if (te.getCurrentGate() >= te.getManagementVertex().getNumberOfOutputGates()) {
break;
}
if (te.getCurrentChannel() >= te.getManagementVertex().getOutputGate(te.getCurrentGate())
.getNumberOfForwardEdges()) {
te.increaseCurrentGate();
te.resetCurrentChannel();
} else {
final ManagementEdge forwardEdge = te.getManagementVertex().getOutputGate(te.getCurrentGate())
.getForwardEdge(te.getCurrentChannel());
final ManagementVertex target = forwardEdge.getTarget().getVertex();
te.increaseCurrentChannel();
if (!alreadyVisited.contains(target)) {
return target;
}
}
}
} else {
while (true) {
if (this.confinedToStage && te.getCurrentChannel() == 0) {
while (currentGateLeadsToOtherStage(te, this.forward)) {
te.increaseCurrentGate();
}
}
// No more incoming edges to consider
if (te.getCurrentGate() >= te.getManagementVertex().getNumberOfInputGates()) {
break;
}
if (te.getCurrentChannel() >= te.getManagementVertex().getInputGate(te.getCurrentGate())
.getNumberOfBackwardEdges()) {
te.increaseCurrentGate();
te.resetCurrentChannel();
} else {
final ManagementEdge backwardEdge = te.getManagementVertex().getInputGate(te.getCurrentGate())
.getBackwardEdge(te.getCurrentChannel());
final ManagementVertex source = backwardEdge.getSource().getVertex();
if (source == null) {
LOG.error("Inconsistency in vertex map found (backward)!");
}
te.increaseCurrentChannel();
if (!this.alreadyVisited.contains(source)) {
return source;
}
}
}
}
return null;
} }
|
public class class_name {
private ManagementVertex getCandidateVertex(final TraversalEntry te, final boolean forward) {
if (forward) {
while (true) {
if (this.confinedToStage && te.getCurrentChannel() == 0) {
while (currentGateLeadsToOtherStage(te, this.forward)) {
te.increaseCurrentGate(); // depends on control dependency: [while], data = [none]
}
}
// No more outgoing edges to consider
if (te.getCurrentGate() >= te.getManagementVertex().getNumberOfOutputGates()) {
break;
}
if (te.getCurrentChannel() >= te.getManagementVertex().getOutputGate(te.getCurrentGate())
.getNumberOfForwardEdges()) {
te.increaseCurrentGate(); // depends on control dependency: [if], data = [none]
te.resetCurrentChannel(); // depends on control dependency: [if], data = [none]
} else {
final ManagementEdge forwardEdge = te.getManagementVertex().getOutputGate(te.getCurrentGate())
.getForwardEdge(te.getCurrentChannel());
final ManagementVertex target = forwardEdge.getTarget().getVertex();
te.increaseCurrentChannel(); // depends on control dependency: [if], data = [none]
if (!alreadyVisited.contains(target)) {
return target; // depends on control dependency: [if], data = [none]
}
}
}
} else {
while (true) {
if (this.confinedToStage && te.getCurrentChannel() == 0) {
while (currentGateLeadsToOtherStage(te, this.forward)) {
te.increaseCurrentGate(); // depends on control dependency: [while], data = [none]
}
}
// No more incoming edges to consider
if (te.getCurrentGate() >= te.getManagementVertex().getNumberOfInputGates()) {
break;
}
if (te.getCurrentChannel() >= te.getManagementVertex().getInputGate(te.getCurrentGate())
.getNumberOfBackwardEdges()) {
te.increaseCurrentGate(); // depends on control dependency: [if], data = [none]
te.resetCurrentChannel(); // depends on control dependency: [if], data = [none]
} else {
final ManagementEdge backwardEdge = te.getManagementVertex().getInputGate(te.getCurrentGate())
.getBackwardEdge(te.getCurrentChannel());
final ManagementVertex source = backwardEdge.getSource().getVertex();
if (source == null) {
LOG.error("Inconsistency in vertex map found (backward)!"); // depends on control dependency: [if], data = [none]
}
te.increaseCurrentChannel(); // depends on control dependency: [if], data = [none]
if (!this.alreadyVisited.contains(source)) {
return source; // depends on control dependency: [if], data = [none]
}
}
}
}
return null;
} }
|
public class class_name {
private boolean isSSLRequired(HttpConstraintElement httpConstraint) {
boolean sslRequired = false;
TransportGuarantee transportGuarantee = httpConstraint.getTransportGuarantee();
if (transportGuarantee != TransportGuarantee.NONE) {
sslRequired = true;
}
return sslRequired;
} }
|
public class class_name {
private boolean isSSLRequired(HttpConstraintElement httpConstraint) {
boolean sslRequired = false;
TransportGuarantee transportGuarantee = httpConstraint.getTransportGuarantee();
if (transportGuarantee != TransportGuarantee.NONE) {
sslRequired = true; // depends on control dependency: [if], data = [none]
}
return sslRequired;
} }
|
public class class_name {
public void marshall(MessageConfiguration messageConfiguration, ProtocolMarshaller protocolMarshaller) {
if (messageConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(messageConfiguration.getADMMessage(), ADMMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getAPNSMessage(), APNSMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getBaiduMessage(), BAIDUMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getDefaultMessage(), DEFAULTMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getEmailMessage(), EMAILMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getGCMMessage(), GCMMESSAGE_BINDING);
protocolMarshaller.marshall(messageConfiguration.getSMSMessage(), SMSMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(MessageConfiguration messageConfiguration, ProtocolMarshaller protocolMarshaller) {
if (messageConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(messageConfiguration.getADMMessage(), ADMMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getAPNSMessage(), APNSMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getBaiduMessage(), BAIDUMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getDefaultMessage(), DEFAULTMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getEmailMessage(), EMAILMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getGCMMessage(), GCMMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(messageConfiguration.getSMSMessage(), SMSMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private int scale(SynthContext context, int size) {
if (context == null || context.getComponent() == null) {
return size;
}
// The key "JComponent.sizeVariant" is used to match Apple's LAF
String scaleKey = SeaGlassStyle.getSizeVariant(context.getComponent());
if (scaleKey != null) {
if (SeaGlassStyle.LARGE_KEY.equals(scaleKey)) {
size *= SeaGlassStyle.LARGE_SCALE;
} else if (SeaGlassStyle.SMALL_KEY.equals(scaleKey)) {
size *= SeaGlassStyle.SMALL_SCALE;
} else if (SeaGlassStyle.MINI_KEY.equals(scaleKey)) {
// mini is not quite as small for icons as full mini is
// just too tiny
size *= SeaGlassStyle.MINI_SCALE + 0.07;
}
}
return size;
} }
|
public class class_name {
private int scale(SynthContext context, int size) {
if (context == null || context.getComponent() == null) {
return size; // depends on control dependency: [if], data = [none]
}
// The key "JComponent.sizeVariant" is used to match Apple's LAF
String scaleKey = SeaGlassStyle.getSizeVariant(context.getComponent());
if (scaleKey != null) {
if (SeaGlassStyle.LARGE_KEY.equals(scaleKey)) {
size *= SeaGlassStyle.LARGE_SCALE; // depends on control dependency: [if], data = [none]
} else if (SeaGlassStyle.SMALL_KEY.equals(scaleKey)) {
size *= SeaGlassStyle.SMALL_SCALE; // depends on control dependency: [if], data = [none]
} else if (SeaGlassStyle.MINI_KEY.equals(scaleKey)) {
// mini is not quite as small for icons as full mini is
// just too tiny
size *= SeaGlassStyle.MINI_SCALE + 0.07; // depends on control dependency: [if], data = [none]
}
}
return size;
} }
|
public class class_name {
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the OrderService.
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select all orders.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get orders by statement.
OrderPage page = orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++, order.getId(), order.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} }
|
public class class_name {
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the OrderService.
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select all orders.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get orders by statement.
OrderPage page = orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize(); // depends on control dependency: [if], data = [none]
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++, order.getId(), order.getName()); // depends on control dependency: [for], data = [none]
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} }
|
public class class_name {
@Override
public File call() throws Exception {
try {
latch.await();
if (isTimeoutEnabled()) {
timedExecutor.schedule(new Runnable() {
public void run() {
try {
if (abortableDownload.getState() != Transfer.TransferState.Completed) {
abortableDownload.abort();
}
} catch (Exception e) {
throw new SdkClientException(
"Unable to abort download after timeout", e);
}
}
}, timeout, TimeUnit.MILLISECONDS);
}
setState(Transfer.TransferState.InProgress);
createParentDirectoryIfNecessary(dstfile);
if (isDownloadParallel) {
downloadInParallel();
} else {
downloadAsSingleObject();
}
return dstfile;
} catch (Throwable t) {
cleanupAfterException();
if (t instanceof Exception) {
throw (Exception) t;
} else {
throw (Error) t;
}
}
} }
|
public class class_name {
@Override
public File call() throws Exception {
try {
latch.await();
if (isTimeoutEnabled()) {
timedExecutor.schedule(new Runnable() {
public void run() {
try {
if (abortableDownload.getState() != Transfer.TransferState.Completed) {
abortableDownload.abort(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw new SdkClientException(
"Unable to abort download after timeout", e);
} // depends on control dependency: [catch], data = [none]
}
}, timeout, TimeUnit.MILLISECONDS);
}
setState(Transfer.TransferState.InProgress);
createParentDirectoryIfNecessary(dstfile);
if (isDownloadParallel) {
downloadInParallel();
} else {
downloadAsSingleObject();
}
return dstfile;
} catch (Throwable t) {
cleanupAfterException();
if (t instanceof Exception) {
throw (Exception) t;
} else {
throw (Error) t;
}
}
} }
|
public class class_name {
int binarySearch(int fromIndex, int toIndex, long key, long value) {
if (ind.isUnique()) {
return binarySearchUnique(fromIndex, toIndex, key);
}
return binarySearchNonUnique(fromIndex, toIndex, key, value);
} }
|
public class class_name {
int binarySearch(int fromIndex, int toIndex, long key, long value) {
if (ind.isUnique()) {
return binarySearchUnique(fromIndex, toIndex, key); // depends on control dependency: [if], data = [none]
}
return binarySearchNonUnique(fromIndex, toIndex, key, value);
} }
|
public class class_name {
public LoginConfigType<WebAppDescriptor> getOrCreateLoginConfig()
{
List<Node> nodeList = model.get("login-config");
if (nodeList != null && nodeList.size() > 0)
{
return new LoginConfigTypeImpl<WebAppDescriptor>(this, "login-config", model, nodeList.get(0));
}
return createLoginConfig();
} }
|
public class class_name {
public LoginConfigType<WebAppDescriptor> getOrCreateLoginConfig()
{
List<Node> nodeList = model.get("login-config");
if (nodeList != null && nodeList.size() > 0)
{
return new LoginConfigTypeImpl<WebAppDescriptor>(this, "login-config", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createLoginConfig();
} }
|
public class class_name {
@Override
public void sawOpcode(int seen) {
try {
stack.precomputation(this);
if (OpcodeUtils.isStandardInvoke(seen)) {
String clsName = getClassConstantOperand();
if (!safeClasses.contains(clsName)) {
try {
JavaClass cls = Repository.lookupClass(clsName);
Method[] methods = cls.getMethods();
String methodName = getNameConstantOperand();
String signature = getSigConstantOperand();
boolean found = false;
for (Method m : methods) {
if (m.getName().equals(methodName) && m.getSignature().equals(signature)) {
if (isAnonymousInnerCtor(m, cls)) {
// The java compiler doesn't properly attached an Exception Table to anonymous
// constructors, so just clear if so
break;
}
ExceptionTable et = m.getExceptionTable();
if (et != null) {
String[] thrownExceptions = et.getExceptionNames();
for (String thrownException : thrownExceptions) {
removeThrownExceptionHierarchy(thrownException);
}
}
found = true;
break;
}
}
if (!found) {
clearExceptions();
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
clearExceptions();
}
} else if ("wait".equals(getNameConstantOperand())) {
removeException("java.lang.InterruptedException");
}
} else if (seen == Const.ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
String exSig = item.getSignature();
String thrownException = SignatureUtils.stripSignature(exSig);
removeThrownExceptionHierarchy(thrownException);
} else {
clearExceptions();
}
}
} finally {
stack.sawOpcode(this, seen);
}
} }
|
public class class_name {
@Override
public void sawOpcode(int seen) {
try {
stack.precomputation(this); // depends on control dependency: [try], data = [none]
if (OpcodeUtils.isStandardInvoke(seen)) {
String clsName = getClassConstantOperand();
if (!safeClasses.contains(clsName)) {
try {
JavaClass cls = Repository.lookupClass(clsName);
Method[] methods = cls.getMethods();
String methodName = getNameConstantOperand();
String signature = getSigConstantOperand();
boolean found = false;
for (Method m : methods) {
if (m.getName().equals(methodName) && m.getSignature().equals(signature)) {
if (isAnonymousInnerCtor(m, cls)) {
// The java compiler doesn't properly attached an Exception Table to anonymous
// constructors, so just clear if so
break;
}
ExceptionTable et = m.getExceptionTable();
if (et != null) {
String[] thrownExceptions = et.getExceptionNames();
for (String thrownException : thrownExceptions) {
removeThrownExceptionHierarchy(thrownException); // depends on control dependency: [for], data = [thrownException]
}
}
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
clearExceptions(); // depends on control dependency: [if], data = [none]
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
clearExceptions();
} // depends on control dependency: [catch], data = [none]
} else if ("wait".equals(getNameConstantOperand())) {
removeException("java.lang.InterruptedException"); // depends on control dependency: [if], data = [none]
}
} else if (seen == Const.ATHROW) {
if (stack.getStackDepth() > 0) {
OpcodeStack.Item item = stack.getStackItem(0);
String exSig = item.getSignature();
String thrownException = SignatureUtils.stripSignature(exSig);
removeThrownExceptionHierarchy(thrownException); // depends on control dependency: [if], data = [none]
} else {
clearExceptions(); // depends on control dependency: [if], data = [none]
}
}
} finally {
stack.sawOpcode(this, seen);
}
} }
|
public class class_name {
public double cur(Element elem, String prop, boolean force) {
if (JsUtils.isWindow(elem)) {
if ("width".equals(prop)) {
return getContentDocument(elem).getClientWidth();
}
if ("height".equals(prop)) {
return getContentDocument(elem).getClientHeight();
}
elem = GQuery.body;
}
if (force && sizeRegex.test(prop)) {
// make curCSS below resolve width and height (issue #145) when force is true
} else if (elem.getPropertyString(prop) != null
&& (elem.getStyle() == null || elem.getStyle().getProperty(prop) == null)) {
// cases where elem.prop exists instead of elem.style.prop
return elem.getPropertyDouble(prop);
}
String val = curCSS(elem, prop, force);
if ("thick".equalsIgnoreCase(val)) {
return 5;
} else if ("medium".equalsIgnoreCase(val)) {
return 3;
} else if ("thin".equalsIgnoreCase(val)) {
return 1;
}
if (!val.matches("^[\\d\\.]+.*$")) {
val = curCSS(elem, prop, false);
}
val = val.trim().replaceAll("[^\\d\\.\\-]+.*$", "");
return val.isEmpty() ? 0 : Double.parseDouble(val);
} }
|
public class class_name {
public double cur(Element elem, String prop, boolean force) {
if (JsUtils.isWindow(elem)) {
if ("width".equals(prop)) {
return getContentDocument(elem).getClientWidth(); // depends on control dependency: [if], data = [none]
}
if ("height".equals(prop)) {
return getContentDocument(elem).getClientHeight(); // depends on control dependency: [if], data = [none]
}
elem = GQuery.body; // depends on control dependency: [if], data = [none]
}
if (force && sizeRegex.test(prop)) {
// make curCSS below resolve width and height (issue #145) when force is true
} else if (elem.getPropertyString(prop) != null
&& (elem.getStyle() == null || elem.getStyle().getProperty(prop) == null)) {
// cases where elem.prop exists instead of elem.style.prop
return elem.getPropertyDouble(prop); // depends on control dependency: [if], data = [none]
}
String val = curCSS(elem, prop, force);
if ("thick".equalsIgnoreCase(val)) {
return 5; // depends on control dependency: [if], data = [none]
} else if ("medium".equalsIgnoreCase(val)) {
return 3; // depends on control dependency: [if], data = [none]
} else if ("thin".equalsIgnoreCase(val)) {
return 1; // depends on control dependency: [if], data = [none]
}
if (!val.matches("^[\\d\\.]+.*$")) {
val = curCSS(elem, prop, false); // depends on control dependency: [if], data = [none]
}
val = val.trim().replaceAll("[^\\d\\.\\-]+.*$", "");
return val.isEmpty() ? 0 : Double.parseDouble(val);
} }
|
public class class_name {
public Association getAssociation() {
if ( association == null ) {
AssociationKey key = getAssociationKey();
if ( hostingEntity != null ) {
OgmEntityEntryState entryState = OgmEntityEntryState.getStateFor( session, hostingEntity );
if ( entryState.hasAssociation( associationKeyMetadata.getCollectionRole() ) ) {
association = entryState.getAssociation( associationKeyMetadata.getCollectionRole() );
}
else {
association = gridDialect.getAssociation( key, getAssociationContext() );
OgmEntityEntryState.getStateFor( session, hostingEntity )
.setAssociation( associationKeyMetadata.getCollectionRole(), association );
}
}
else {
association = gridDialect.getAssociation( key, getAssociationContext() );
}
if ( association == null ) {
association = gridDialect.createAssociation( key, getAssociationContext() );
if ( hostingEntity != null ) {
OgmEntityEntryState.getStateFor( session, hostingEntity )
.setAssociation( associationKeyMetadata.getCollectionRole(), association );
}
}
}
return association;
} }
|
public class class_name {
public Association getAssociation() {
if ( association == null ) {
AssociationKey key = getAssociationKey();
if ( hostingEntity != null ) {
OgmEntityEntryState entryState = OgmEntityEntryState.getStateFor( session, hostingEntity );
if ( entryState.hasAssociation( associationKeyMetadata.getCollectionRole() ) ) {
association = entryState.getAssociation( associationKeyMetadata.getCollectionRole() ); // depends on control dependency: [if], data = [none]
}
else {
association = gridDialect.getAssociation( key, getAssociationContext() ); // depends on control dependency: [if], data = [none]
OgmEntityEntryState.getStateFor( session, hostingEntity )
.setAssociation( associationKeyMetadata.getCollectionRole(), association ); // depends on control dependency: [if], data = [none]
}
}
else {
association = gridDialect.getAssociation( key, getAssociationContext() ); // depends on control dependency: [if], data = [none]
}
if ( association == null ) {
association = gridDialect.createAssociation( key, getAssociationContext() ); // depends on control dependency: [if], data = [none]
if ( hostingEntity != null ) {
OgmEntityEntryState.getStateFor( session, hostingEntity )
.setAssociation( associationKeyMetadata.getCollectionRole(), association ); // depends on control dependency: [if], data = [none]
}
}
}
return association;
} }
|
public class class_name {
public void marshall(CompliantSummary compliantSummary, ProtocolMarshaller protocolMarshaller) {
if (compliantSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(compliantSummary.getCompliantCount(), COMPLIANTCOUNT_BINDING);
protocolMarshaller.marshall(compliantSummary.getSeveritySummary(), SEVERITYSUMMARY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CompliantSummary compliantSummary, ProtocolMarshaller protocolMarshaller) {
if (compliantSummary == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(compliantSummary.getCompliantCount(), COMPLIANTCOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(compliantSummary.getSeveritySummary(), SEVERITYSUMMARY_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Logger getLogger( String name )
{
PaxLogger paxLogger;
if( m_paxLogging == null )
{
paxLogger = FallbackLogFactory.createFallbackLog( null, name );
}
else
{
paxLogger = m_paxLogging.getLogger( name, LOG4J_FQCN );
}
Logger logger = new Logger( paxLogger );
m_loggers.put( name, logger );
return logger;
} }
|
public class class_name {
public static Logger getLogger( String name )
{
PaxLogger paxLogger;
if( m_paxLogging == null )
{
paxLogger = FallbackLogFactory.createFallbackLog( null, name ); // depends on control dependency: [if], data = [none]
}
else
{
paxLogger = m_paxLogging.getLogger( name, LOG4J_FQCN ); // depends on control dependency: [if], data = [none]
}
Logger logger = new Logger( paxLogger );
m_loggers.put( name, logger );
return logger;
} }
|
public class class_name {
public static Object getProperty(Object bean, List<String> propertyPath) {
Object current = bean;
for (String propertyName : propertyPath) {
if (current == null) {
return null;
}
if (current instanceof Iterable) {
// follow multi-valued property
List<Object> result = new ArrayList<>();
Iterable<?> iterable = (Iterable<?>) current;
for (Object currentElem : iterable) {
result.add(getProperty(currentElem, propertyName));
}
current = result;
} else {
// follow single-valued property
current = getProperty(current, propertyName);
}
}
return current;
} }
|
public class class_name {
public static Object getProperty(Object bean, List<String> propertyPath) {
Object current = bean;
for (String propertyName : propertyPath) {
if (current == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (current instanceof Iterable) {
// follow multi-valued property
List<Object> result = new ArrayList<>();
Iterable<?> iterable = (Iterable<?>) current;
for (Object currentElem : iterable) {
result.add(getProperty(currentElem, propertyName)); // depends on control dependency: [for], data = [currentElem]
}
current = result; // depends on control dependency: [if], data = [none]
} else {
// follow single-valued property
current = getProperty(current, propertyName); // depends on control dependency: [if], data = [none]
}
}
return current;
} }
|
public class class_name {
private ThriftRow constructIndexTableThriftRow(String columnFamily, String embeddedFieldName, Object obj,
Attribute column, byte[] rowKey, String ecValue)
{
// Column Name
Field columnField = (Field) column.getJavaMember();
byte[] indexColumnName = PropertyAccessorHelper.get(obj, columnField);
ThriftRow tr = null;
if (indexColumnName != null && indexColumnName.length != 0 && rowKey != null)
{
// Construct Index Table Thrift Row
tr = new ThriftRow();
tr.setColumnFamilyName(columnFamily); // Index column-family name
tr.setId(embeddedFieldName + Constants.INDEX_TABLE_ROW_KEY_DELIMITER + column.getName()); // Id
SuperColumn thriftSuperColumn = new SuperColumn();
thriftSuperColumn.setName(indexColumnName);
Column thriftColumn = new Column();
thriftColumn.setName(rowKey);
thriftColumn.setValue(ecValue.getBytes());
thriftColumn.setTimestamp(generator.getTimestamp());
thriftSuperColumn.addToColumns(thriftColumn);
tr.addSuperColumn(thriftSuperColumn);
}
return tr;
} }
|
public class class_name {
private ThriftRow constructIndexTableThriftRow(String columnFamily, String embeddedFieldName, Object obj,
Attribute column, byte[] rowKey, String ecValue)
{
// Column Name
Field columnField = (Field) column.getJavaMember();
byte[] indexColumnName = PropertyAccessorHelper.get(obj, columnField);
ThriftRow tr = null;
if (indexColumnName != null && indexColumnName.length != 0 && rowKey != null)
{
// Construct Index Table Thrift Row
tr = new ThriftRow(); // depends on control dependency: [if], data = [none]
tr.setColumnFamilyName(columnFamily); // Index column-family name // depends on control dependency: [if], data = [none]
tr.setId(embeddedFieldName + Constants.INDEX_TABLE_ROW_KEY_DELIMITER + column.getName()); // Id // depends on control dependency: [if], data = [none]
SuperColumn thriftSuperColumn = new SuperColumn();
thriftSuperColumn.setName(indexColumnName); // depends on control dependency: [if], data = [(indexColumnName]
Column thriftColumn = new Column();
thriftColumn.setName(rowKey); // depends on control dependency: [if], data = [none]
thriftColumn.setValue(ecValue.getBytes()); // depends on control dependency: [if], data = [none]
thriftColumn.setTimestamp(generator.getTimestamp()); // depends on control dependency: [if], data = [none]
thriftSuperColumn.addToColumns(thriftColumn); // depends on control dependency: [if], data = [none]
tr.addSuperColumn(thriftSuperColumn); // depends on control dependency: [if], data = [none]
}
return tr;
} }
|
public class class_name {
public void add(Container container, boolean addRelationships) {
if (container != null && !container.equals(getContainer())) {
addElement(container, addRelationships);
}
} }
|
public class class_name {
public void add(Container container, boolean addRelationships) {
if (container != null && !container.equals(getContainer())) {
addElement(container, addRelationships); // depends on control dependency: [if], data = [(container]
}
} }
|
public class class_name {
private Mode lookupCreateMode(String name) {
if (name == null)
return null;
name = name.trim();
Mode mode = (Mode)modeMap.get(name);
if (mode == null) {
mode = new Mode(name, defaultBaseMode);
modeMap.put(name, mode);
}
return mode;
} }
|
public class class_name {
private Mode lookupCreateMode(String name) {
if (name == null)
return null;
name = name.trim();
Mode mode = (Mode)modeMap.get(name);
if (mode == null) {
mode = new Mode(name, defaultBaseMode); // depends on control dependency: [if], data = [none]
modeMap.put(name, mode); // depends on control dependency: [if], data = [none]
}
return mode;
} }
|
public class class_name {
private static void tred(DenseMatrix V, double[] d, double[] e) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
d[i] = V.get(n - 1, i);
}
// Householder reduction to tridiagonal form.
for (int i = n - 1; i > 0; i--) {
// Scale to avoid under/overflow.
double scale = 0.0;
double h = 0.0;
for (int k = 0; k < i; k++) {
scale = scale + Math.abs(d[k]);
}
if (scale == 0.0) {
e[i] = d[i - 1];
for (int j = 0; j < i; j++) {
d[j] = V.get(i - 1, j);
V.set(i, j, 0.0);
V.set(j, i, 0.0);
}
} else {
// Generate Householder vector.
for (int k = 0; k < i; k++) {
d[k] /= scale;
h += d[k] * d[k];
}
double f = d[i - 1];
double g = Math.sqrt(h);
if (f > 0) {
g = -g;
}
e[i] = scale * g;
h = h - f * g;
d[i - 1] = f - g;
for (int j = 0; j < i; j++) {
e[j] = 0.0;
}
// Apply similarity transformation to remaining columns.
for (int j = 0; j < i; j++) {
f = d[j];
V.set(j, i, f);
g = e[j] + V.get(j, j) * f;
for (int k = j + 1; k <= i - 1; k++) {
g += V.get(k, j) * d[k];
e[k] += V.get(k, j) * f;
}
e[j] = g;
}
f = 0.0;
for (int j = 0; j < i; j++) {
e[j] /= h;
f += e[j] * d[j];
}
double hh = f / (h + h);
for (int j = 0; j < i; j++) {
e[j] -= hh * d[j];
}
for (int j = 0; j < i; j++) {
f = d[j];
g = e[j];
for (int k = j; k <= i - 1; k++) {
V.sub(k, j, (f * e[k] + g * d[k]));
}
d[j] = V.get(i - 1, j);
V.set(i, j, 0.0);
}
}
d[i] = h;
}
for (int j = 0; j < n; j++) {
d[j] = V.get(j, j);
}
e[0] = 0.0;
} }
|
public class class_name {
private static void tred(DenseMatrix V, double[] d, double[] e) {
int n = V.nrows();
for (int i = 0; i < n; i++) {
d[i] = V.get(n - 1, i); // depends on control dependency: [for], data = [i]
}
// Householder reduction to tridiagonal form.
for (int i = n - 1; i > 0; i--) {
// Scale to avoid under/overflow.
double scale = 0.0;
double h = 0.0;
for (int k = 0; k < i; k++) {
scale = scale + Math.abs(d[k]); // depends on control dependency: [for], data = [k]
}
if (scale == 0.0) {
e[i] = d[i - 1]; // depends on control dependency: [if], data = [none]
for (int j = 0; j < i; j++) {
d[j] = V.get(i - 1, j); // depends on control dependency: [for], data = [j]
V.set(i, j, 0.0); // depends on control dependency: [for], data = [j]
V.set(j, i, 0.0); // depends on control dependency: [for], data = [j]
}
} else {
// Generate Householder vector.
for (int k = 0; k < i; k++) {
d[k] /= scale; // depends on control dependency: [for], data = [k]
h += d[k] * d[k]; // depends on control dependency: [for], data = [k]
}
double f = d[i - 1];
double g = Math.sqrt(h);
if (f > 0) {
g = -g; // depends on control dependency: [if], data = [none]
}
e[i] = scale * g; // depends on control dependency: [if], data = [none]
h = h - f * g; // depends on control dependency: [if], data = [none]
d[i - 1] = f - g; // depends on control dependency: [if], data = [none]
for (int j = 0; j < i; j++) {
e[j] = 0.0; // depends on control dependency: [for], data = [j]
}
// Apply similarity transformation to remaining columns.
for (int j = 0; j < i; j++) {
f = d[j]; // depends on control dependency: [for], data = [j]
V.set(j, i, f); // depends on control dependency: [for], data = [j]
g = e[j] + V.get(j, j) * f; // depends on control dependency: [for], data = [j]
for (int k = j + 1; k <= i - 1; k++) {
g += V.get(k, j) * d[k]; // depends on control dependency: [for], data = [k]
e[k] += V.get(k, j) * f; // depends on control dependency: [for], data = [k]
}
e[j] = g; // depends on control dependency: [for], data = [j]
}
f = 0.0; // depends on control dependency: [if], data = [none]
for (int j = 0; j < i; j++) {
e[j] /= h; // depends on control dependency: [for], data = [j]
f += e[j] * d[j]; // depends on control dependency: [for], data = [j]
}
double hh = f / (h + h);
for (int j = 0; j < i; j++) {
e[j] -= hh * d[j]; // depends on control dependency: [for], data = [j]
}
for (int j = 0; j < i; j++) {
f = d[j]; // depends on control dependency: [for], data = [j]
g = e[j]; // depends on control dependency: [for], data = [j]
for (int k = j; k <= i - 1; k++) {
V.sub(k, j, (f * e[k] + g * d[k])); // depends on control dependency: [for], data = [k]
}
d[j] = V.get(i - 1, j); // depends on control dependency: [for], data = [j]
V.set(i, j, 0.0); // depends on control dependency: [for], data = [j]
}
}
d[i] = h; // depends on control dependency: [for], data = [i]
}
for (int j = 0; j < n; j++) {
d[j] = V.get(j, j); // depends on control dependency: [for], data = [j]
}
e[0] = 0.0;
} }
|
public class class_name {
public void run(){
while(true){
String cmd = null;
try {
cmd = commandQueue.take();
} catch (InterruptedException e) {
continue;
}
if ("exit".equals(cmd)){
log.info("CamelContextController for '" + context.getName() + "' received '" + cmd + "' command.");
break;
}
log.info("CamelContext '" + context.getName() + "' received '" + cmd + "' command.");
try {
context.getClass().getMethod(cmd).invoke(context);
log.info("CamelContext '" + context.getName() + "' successfully proccessed '" + cmd + "' command.");
}catch(Exception e){
log.error("CamelContext '" + context.getName() + "' failed processing '" + cmd + "' command.", e);
}
}
try {
myContext.stop();
log.info("CamelContextController for '" + context.getName() + "' will exit.");
} catch (Exception e) {
log.error("Error stopping CamelContextController's own CamelContext '" + myContext.getName() + "'.", e);
}
} }
|
public class class_name {
public void run(){
while(true){
String cmd = null;
try {
cmd = commandQueue.take();
// depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
continue;
}
// depends on control dependency: [catch], data = [none]
if ("exit".equals(cmd)){
log.info("CamelContextController for '" + context.getName() + "' received '" + cmd + "' command.");
// depends on control dependency: [if], data = [none]
break;
}
log.info("CamelContext '" + context.getName() + "' received '" + cmd + "' command.");
// depends on control dependency: [while], data = [none]
try {
context.getClass().getMethod(cmd).invoke(context);
// depends on control dependency: [try], data = [none]
log.info("CamelContext '" + context.getName() + "' successfully proccessed '" + cmd + "' command.");
// depends on control dependency: [try], data = [none]
}catch(Exception e){
log.error("CamelContext '" + context.getName() + "' failed processing '" + cmd + "' command.", e);
}
// depends on control dependency: [catch], data = [none]
}
try {
myContext.stop();
// depends on control dependency: [try], data = [none]
log.info("CamelContextController for '" + context.getName() + "' will exit.");
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Error stopping CamelContextController's own CamelContext '" + myContext.getName() + "'.", e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public Map<String, Object> getPropertiesForUpdate() {
if (!readOnly && membersModified) {
modifiedMap.put(MEMBERS_FIELD, StringUtils.join(members, ';'));
}
Map<String, Object> propertiesForUpdate = super.getPropertiesForUpdate();
return propertiesForUpdate;
} }
|
public class class_name {
@Override
public Map<String, Object> getPropertiesForUpdate() {
if (!readOnly && membersModified) {
modifiedMap.put(MEMBERS_FIELD, StringUtils.join(members, ';')); // depends on control dependency: [if], data = [none]
}
Map<String, Object> propertiesForUpdate = super.getPropertiesForUpdate();
return propertiesForUpdate;
} }
|
public class class_name {
@Override
public EEnum getIfcValveTypeEnum() {
if (ifcValveTypeEnumEEnum == null) {
ifcValveTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1097);
}
return ifcValveTypeEnumEEnum;
} }
|
public class class_name {
@Override
public EEnum getIfcValveTypeEnum() {
if (ifcValveTypeEnumEEnum == null) {
ifcValveTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1097);
// depends on control dependency: [if], data = [none]
}
return ifcValveTypeEnumEEnum;
} }
|
public class class_name {
public List<TaxonomyTerm> selectPostTerms(final long postId, final String taxonomy) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
List<Long> termIds = Lists.newArrayListWithExpectedSize(8);
Timer.Context ctx = metrics.postTermsSelectTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(selectPostTermsSQL);
stmt.setLong(1, postId);
rs = stmt.executeQuery();
while(rs.next()) {
termIds.add(rs.getLong(1));
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
if(termIds.size() == 0) {
return ImmutableList.of();
}
List<TaxonomyTerm> terms = Lists.newArrayListWithExpectedSize(termIds.size());
for(long termId : termIds) {
TaxonomyTerm term = resolveTaxonomyTerm(termId);
if(term != null && (taxonomy == null || term.taxonomy.equals(taxonomy))) {
terms.add(term);
}
}
return terms;
} }
|
public class class_name {
public List<TaxonomyTerm> selectPostTerms(final long postId, final String taxonomy) throws SQLException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet rs = null;
List<Long> termIds = Lists.newArrayListWithExpectedSize(8);
Timer.Context ctx = metrics.postTermsSelectTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(selectPostTermsSQL);
stmt.setLong(1, postId);
rs = stmt.executeQuery();
while(rs.next()) {
termIds.add(rs.getLong(1)); // depends on control dependency: [while], data = [none]
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt, rs);
}
if(termIds.size() == 0) {
return ImmutableList.of();
}
List<TaxonomyTerm> terms = Lists.newArrayListWithExpectedSize(termIds.size());
for(long termId : termIds) {
TaxonomyTerm term = resolveTaxonomyTerm(termId);
if(term != null && (taxonomy == null || term.taxonomy.equals(taxonomy))) {
terms.add(term); // depends on control dependency: [if], data = [none]
}
}
return terms;
} }
|
public class class_name {
private Segment currentSegment() {
Segment segment = segments.currentSegment();
if (segment.isFull()) {
segments.currentSegment().flush();
segment = segments.nextSegment();
}
return segment;
} }
|
public class class_name {
private Segment currentSegment() {
Segment segment = segments.currentSegment();
if (segment.isFull()) {
segments.currentSegment().flush(); // depends on control dependency: [if], data = [none]
segment = segments.nextSegment(); // depends on control dependency: [if], data = [none]
}
return segment;
} }
|
public class class_name {
final void put(final ByteVector out) {
final int FACTOR = ClassWriter.TO_ACC_SYNTHETIC;
int mask = ACC_CONSTRUCTOR | Opcodes.ACC_DEPRECATED
| ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
| ((access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) / FACTOR);
out.putShort(access & ~mask).putShort(name).putShort(desc);
if (classReaderOffset != 0) {
out.putByteArray(cw.cr.b, classReaderOffset, classReaderLength);
return;
}
int attributeCount = 0;
if (code.length > 0) {
++attributeCount;
}
if (exceptionCount > 0) {
++attributeCount;
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
++attributeCount;
}
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount;
}
if (ClassReader.SIGNATURES && signature != null) {
++attributeCount;
}
if (methodParameters != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && annd != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && anns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && ianns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && tanns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && itanns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && panns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && ipanns != null) {
++attributeCount;
}
if (attrs != null) {
attributeCount += attrs.getCount();
}
out.putShort(attributeCount);
if (code.length > 0) {
int size = 12 + code.length + 8 * handlerCount;
if (localVar != null) {
size += 8 + localVar.length;
}
if (localVarType != null) {
size += 8 + localVarType.length;
}
if (lineNumber != null) {
size += 8 + lineNumber.length;
}
if (stackMap != null) {
size += 8 + stackMap.length;
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
size += 8 + ctanns.getSize();
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
size += 8 + ictanns.getSize();
}
if (cattrs != null) {
size += cattrs.getSize(cw, code.data, code.length, maxStack,
maxLocals);
}
out.putShort(cw.newUTF8("Code")).putInt(size);
out.putShort(maxStack).putShort(maxLocals);
out.putInt(code.length).putByteArray(code.data, 0, code.length);
out.putShort(handlerCount);
if (handlerCount > 0) {
Handler h = firstHandler;
while (h != null) {
out.putShort(h.start.position).putShort(h.end.position)
.putShort(h.handler.position).putShort(h.type);
h = h.next;
}
}
attributeCount = 0;
if (localVar != null) {
++attributeCount;
}
if (localVarType != null) {
++attributeCount;
}
if (lineNumber != null) {
++attributeCount;
}
if (stackMap != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
++attributeCount;
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
++attributeCount;
}
if (cattrs != null) {
attributeCount += cattrs.getCount();
}
out.putShort(attributeCount);
if (localVar != null) {
out.putShort(cw.newUTF8("LocalVariableTable"));
out.putInt(localVar.length + 2).putShort(localVarCount);
out.putByteArray(localVar.data, 0, localVar.length);
}
if (localVarType != null) {
out.putShort(cw.newUTF8("LocalVariableTypeTable"));
out.putInt(localVarType.length + 2).putShort(localVarTypeCount);
out.putByteArray(localVarType.data, 0, localVarType.length);
}
if (lineNumber != null) {
out.putShort(cw.newUTF8("LineNumberTable"));
out.putInt(lineNumber.length + 2).putShort(lineNumberCount);
out.putByteArray(lineNumber.data, 0, lineNumber.length);
}
if (stackMap != null) {
boolean zip = (cw.version & 0xFFFF) >= Opcodes.V1_6;
out.putShort(cw.newUTF8(zip ? "StackMapTable" : "StackMap"));
out.putInt(stackMap.length + 2).putShort(frameCount);
out.putByteArray(stackMap.data, 0, stackMap.length);
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleTypeAnnotations"));
ctanns.put(out);
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleTypeAnnotations"));
ictanns.put(out);
}
if (cattrs != null) {
cattrs.put(cw, code.data, code.length, maxLocals, maxStack, out);
}
}
if (exceptionCount > 0) {
out.putShort(cw.newUTF8("Exceptions")).putInt(
2 * exceptionCount + 2);
out.putShort(exceptionCount);
for (int i = 0; i < exceptionCount; ++i) {
out.putShort(exceptions[i]);
}
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
out.putShort(cw.newUTF8("Synthetic")).putInt(0);
}
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
out.putShort(cw.newUTF8("Deprecated")).putInt(0);
}
if (ClassReader.SIGNATURES && signature != null) {
out.putShort(cw.newUTF8("Signature")).putInt(2)
.putShort(cw.newUTF8(signature));
}
if (methodParameters != null) {
out.putShort(cw.newUTF8("MethodParameters"));
out.putInt(methodParameters.length + 1).putByte(
methodParametersCount);
out.putByteArray(methodParameters.data, 0, methodParameters.length);
}
if (ClassReader.ANNOTATIONS && annd != null) {
out.putShort(cw.newUTF8("AnnotationDefault"));
out.putInt(annd.length);
out.putByteArray(annd.data, 0, annd.length);
}
if (ClassReader.ANNOTATIONS && anns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleAnnotations"));
anns.put(out);
}
if (ClassReader.ANNOTATIONS && ianns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleAnnotations"));
ianns.put(out);
}
if (ClassReader.ANNOTATIONS && tanns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleTypeAnnotations"));
tanns.put(out);
}
if (ClassReader.ANNOTATIONS && itanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleTypeAnnotations"));
itanns.put(out);
}
if (ClassReader.ANNOTATIONS && panns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleParameterAnnotations"));
AnnotationWriter.put(panns, synthetics, out);
}
if (ClassReader.ANNOTATIONS && ipanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleParameterAnnotations"));
AnnotationWriter.put(ipanns, synthetics, out);
}
if (attrs != null) {
attrs.put(cw, null, 0, -1, -1, out);
}
} }
|
public class class_name {
final void put(final ByteVector out) {
final int FACTOR = ClassWriter.TO_ACC_SYNTHETIC;
int mask = ACC_CONSTRUCTOR | Opcodes.ACC_DEPRECATED
| ClassWriter.ACC_SYNTHETIC_ATTRIBUTE
| ((access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) / FACTOR);
out.putShort(access & ~mask).putShort(name).putShort(desc);
if (classReaderOffset != 0) {
out.putByteArray(cw.cr.b, classReaderOffset, classReaderLength); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int attributeCount = 0;
if (code.length > 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (exceptionCount > 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.SIGNATURES && signature != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (methodParameters != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && annd != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && anns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ianns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && tanns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && itanns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && panns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ipanns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (attrs != null) {
attributeCount += attrs.getCount(); // depends on control dependency: [if], data = [none]
}
out.putShort(attributeCount);
if (code.length > 0) {
int size = 12 + code.length + 8 * handlerCount;
if (localVar != null) {
size += 8 + localVar.length; // depends on control dependency: [if], data = [none]
}
if (localVarType != null) {
size += 8 + localVarType.length; // depends on control dependency: [if], data = [none]
}
if (lineNumber != null) {
size += 8 + lineNumber.length; // depends on control dependency: [if], data = [none]
}
if (stackMap != null) {
size += 8 + stackMap.length; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
size += 8 + ctanns.getSize(); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
size += 8 + ictanns.getSize(); // depends on control dependency: [if], data = [none]
}
if (cattrs != null) {
size += cattrs.getSize(cw, code.data, code.length, maxStack,
maxLocals); // depends on control dependency: [if], data = [none]
}
out.putShort(cw.newUTF8("Code")).putInt(size); // depends on control dependency: [if], data = [none]
out.putShort(maxStack).putShort(maxLocals); // depends on control dependency: [if], data = [none]
out.putInt(code.length).putByteArray(code.data, 0, code.length); // depends on control dependency: [if], data = [(code.length]
out.putShort(handlerCount); // depends on control dependency: [if], data = [none]
if (handlerCount > 0) {
Handler h = firstHandler;
while (h != null) {
out.putShort(h.start.position).putShort(h.end.position)
.putShort(h.handler.position).putShort(h.type); // depends on control dependency: [while], data = [(h]
h = h.next; // depends on control dependency: [while], data = [none]
}
}
attributeCount = 0; // depends on control dependency: [if], data = [none]
if (localVar != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (localVarType != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (lineNumber != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (stackMap != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
++attributeCount; // depends on control dependency: [if], data = [none]
}
if (cattrs != null) {
attributeCount += cattrs.getCount(); // depends on control dependency: [if], data = [none]
}
out.putShort(attributeCount); // depends on control dependency: [if], data = [none]
if (localVar != null) {
out.putShort(cw.newUTF8("LocalVariableTable")); // depends on control dependency: [if], data = [none]
out.putInt(localVar.length + 2).putShort(localVarCount); // depends on control dependency: [if], data = [(localVar]
out.putByteArray(localVar.data, 0, localVar.length); // depends on control dependency: [if], data = [(localVar]
}
if (localVarType != null) {
out.putShort(cw.newUTF8("LocalVariableTypeTable")); // depends on control dependency: [if], data = [none]
out.putInt(localVarType.length + 2).putShort(localVarTypeCount); // depends on control dependency: [if], data = [(localVarType]
out.putByteArray(localVarType.data, 0, localVarType.length); // depends on control dependency: [if], data = [(localVarType]
}
if (lineNumber != null) {
out.putShort(cw.newUTF8("LineNumberTable")); // depends on control dependency: [if], data = [none]
out.putInt(lineNumber.length + 2).putShort(lineNumberCount); // depends on control dependency: [if], data = [(lineNumber]
out.putByteArray(lineNumber.data, 0, lineNumber.length); // depends on control dependency: [if], data = [(lineNumber]
}
if (stackMap != null) {
boolean zip = (cw.version & 0xFFFF) >= Opcodes.V1_6;
out.putShort(cw.newUTF8(zip ? "StackMapTable" : "StackMap")); // depends on control dependency: [if], data = [none]
out.putInt(stackMap.length + 2).putShort(frameCount); // depends on control dependency: [if], data = [(stackMap]
out.putByteArray(stackMap.data, 0, stackMap.length); // depends on control dependency: [if], data = [(stackMap]
}
if (ClassReader.ANNOTATIONS && ctanns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleTypeAnnotations")); // depends on control dependency: [if], data = [none]
ctanns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ictanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleTypeAnnotations")); // depends on control dependency: [if], data = [none]
ictanns.put(out); // depends on control dependency: [if], data = [none]
}
if (cattrs != null) {
cattrs.put(cw, code.data, code.length, maxLocals, maxStack, out); // depends on control dependency: [if], data = [none]
}
}
if (exceptionCount > 0) {
out.putShort(cw.newUTF8("Exceptions")).putInt(
2 * exceptionCount + 2); // depends on control dependency: [if], data = [none]
out.putShort(exceptionCount); // depends on control dependency: [if], data = [(exceptionCount]
for (int i = 0; i < exceptionCount; ++i) {
out.putShort(exceptions[i]); // depends on control dependency: [for], data = [i]
}
}
if ((access & Opcodes.ACC_SYNTHETIC) != 0) {
if ((cw.version & 0xFFFF) < Opcodes.V1_5
|| (access & ClassWriter.ACC_SYNTHETIC_ATTRIBUTE) != 0) {
out.putShort(cw.newUTF8("Synthetic")).putInt(0); // depends on control dependency: [if], data = [none]
}
}
if ((access & Opcodes.ACC_DEPRECATED) != 0) {
out.putShort(cw.newUTF8("Deprecated")).putInt(0); // depends on control dependency: [if], data = [0)]
}
if (ClassReader.SIGNATURES && signature != null) {
out.putShort(cw.newUTF8("Signature")).putInt(2)
.putShort(cw.newUTF8(signature)); // depends on control dependency: [if], data = [none]
}
if (methodParameters != null) {
out.putShort(cw.newUTF8("MethodParameters")); // depends on control dependency: [if], data = [none]
out.putInt(methodParameters.length + 1).putByte(
methodParametersCount); // depends on control dependency: [if], data = [(methodParameters]
out.putByteArray(methodParameters.data, 0, methodParameters.length); // depends on control dependency: [if], data = [(methodParameters]
}
if (ClassReader.ANNOTATIONS && annd != null) {
out.putShort(cw.newUTF8("AnnotationDefault")); // depends on control dependency: [if], data = [none]
out.putInt(annd.length); // depends on control dependency: [if], data = [none]
out.putByteArray(annd.data, 0, annd.length); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && anns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleAnnotations")); // depends on control dependency: [if], data = [none]
anns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ianns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleAnnotations")); // depends on control dependency: [if], data = [none]
ianns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && tanns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleTypeAnnotations")); // depends on control dependency: [if], data = [none]
tanns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && itanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleTypeAnnotations")); // depends on control dependency: [if], data = [none]
itanns.put(out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && panns != null) {
out.putShort(cw.newUTF8("RuntimeVisibleParameterAnnotations")); // depends on control dependency: [if], data = [none]
AnnotationWriter.put(panns, synthetics, out); // depends on control dependency: [if], data = [none]
}
if (ClassReader.ANNOTATIONS && ipanns != null) {
out.putShort(cw.newUTF8("RuntimeInvisibleParameterAnnotations")); // depends on control dependency: [if], data = [none]
AnnotationWriter.put(ipanns, synthetics, out); // depends on control dependency: [if], data = [none]
}
if (attrs != null) {
attrs.put(cw, null, 0, -1, -1, out); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Deprecated
public static int indexOf(CharSequence s, int codePoint) {
int cp;
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = Character.codePointAt(s, i);
if (cp == codePoint) {
return i;
}
}
return -1;
} }
|
public class class_name {
@Deprecated
public static int indexOf(CharSequence s, int codePoint) {
int cp;
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = Character.codePointAt(s, i); // depends on control dependency: [for], data = [i]
if (cp == codePoint) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
public void putAll(Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (mapSize == 0) {
return;
}
int newSize = (int) ((size + mapSize) / loadFactor + 1);
ensureCapacity(calculateNewCapacity(newSize));
// Have to cast here because of compiler inference problems.
for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
Map.Entry<? extends K, ? extends V> entry = (Map.Entry<? extends K, ? extends V>) it
.next();
put(entry.getKey(), entry.getValue());
}
} }
|
public class class_name {
public void putAll(Map<? extends K, ? extends V> map) {
int mapSize = map.size();
if (mapSize == 0) {
return; // depends on control dependency: [if], data = [none]
}
int newSize = (int) ((size + mapSize) / loadFactor + 1);
ensureCapacity(calculateNewCapacity(newSize));
// Have to cast here because of compiler inference problems.
for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
Map.Entry<? extends K, ? extends V> entry = (Map.Entry<? extends K, ? extends V>) it
.next();
put(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private List<Entry> removeValues( Collection<?> values,
boolean ifMatch ) {
LinkedList<Entry> results = null;
// Record the list of entries that are removed, but start at the end of the values (so the indexes are correct)
ListIterator<?> iter = this.values.listIterator(size());
while (iter.hasPrevious()) {
int index = iter.previousIndex();
Object value = iter.previous();
if (ifMatch == values.contains(value)) {
iter.remove();
if (results == null) {
results = new LinkedList<>();
}
results.addFirst(new BasicEntry(index, value));
}
}
return results != null ? results : Collections.<Entry>emptyList();
} }
|
public class class_name {
private List<Entry> removeValues( Collection<?> values,
boolean ifMatch ) {
LinkedList<Entry> results = null;
// Record the list of entries that are removed, but start at the end of the values (so the indexes are correct)
ListIterator<?> iter = this.values.listIterator(size());
while (iter.hasPrevious()) {
int index = iter.previousIndex();
Object value = iter.previous();
if (ifMatch == values.contains(value)) {
iter.remove(); // depends on control dependency: [if], data = [none]
if (results == null) {
results = new LinkedList<>(); // depends on control dependency: [if], data = [none]
}
results.addFirst(new BasicEntry(index, value)); // depends on control dependency: [if], data = [none]
}
}
return results != null ? results : Collections.<Entry>emptyList();
} }
|
public class class_name {
public void put(ElementType x) {
if (full()) {
getIdx = (getIdx + 1) % elements.length;
} else {
size++;
}
elements[putIdx] = x;
putIdx = (putIdx + 1) % elements.length;
} }
|
public class class_name {
public void put(ElementType x) {
if (full()) {
getIdx = (getIdx + 1) % elements.length; // depends on control dependency: [if], data = [none]
} else {
size++; // depends on control dependency: [if], data = [none]
}
elements[putIdx] = x;
putIdx = (putIdx + 1) % elements.length;
} }
|
public class class_name {
public String createToken(Map<String, Object> data, TokenOptions options) {
if ((data == null || data.size() == 0) && (options == null || (!options.isAdmin() && !options.isDebug()))) {
throw new IllegalArgumentException("TokenGenerator.createToken: data is empty and no options are set. This token will have no effect on Firebase.");
}
JSONObject claims = new JSONObject();
try {
claims.put("v", TOKEN_VERSION);
claims.put("iat", new Date().getTime() / 1000);
boolean isAdminToken = (options != null && options.isAdmin());
validateToken("TokenGenerator.createToken", data, isAdminToken);
if (data != null && data.size() > 0) {
claims.put("d", new JSONObject(data));
}
// Handle options
if (options != null) {
if (options.getExpires() != null) {
claims.put("exp", options.getExpires().getTime() / 1000);
}
if (options.getNotBefore() != null) {
claims.put("nbf", options.getNotBefore().getTime() / 1000);
}
// Only add these claims if they're true to avoid sending them over the wire when false.
if (options.isAdmin()) {
claims.put("admin", options.isAdmin());
}
if (options.isDebug()) {
claims.put("debug", options.isDebug());
}
}
} catch (JSONException e) {
throw new RuntimeException(e);
}
String token = computeToken(claims);
if (token.length() > 1024) {
throw new IllegalArgumentException("TokenGenerator.createToken: Generated token is too long. The token cannot be longer than 1024 bytes.");
}
return token;
} }
|
public class class_name {
public String createToken(Map<String, Object> data, TokenOptions options) {
if ((data == null || data.size() == 0) && (options == null || (!options.isAdmin() && !options.isDebug()))) {
throw new IllegalArgumentException("TokenGenerator.createToken: data is empty and no options are set. This token will have no effect on Firebase.");
}
JSONObject claims = new JSONObject();
try {
claims.put("v", TOKEN_VERSION); // depends on control dependency: [try], data = [none]
claims.put("iat", new Date().getTime() / 1000); // depends on control dependency: [try], data = [none]
boolean isAdminToken = (options != null && options.isAdmin());
validateToken("TokenGenerator.createToken", data, isAdminToken); // depends on control dependency: [try], data = [none]
if (data != null && data.size() > 0) {
claims.put("d", new JSONObject(data)); // depends on control dependency: [if], data = [(data]
}
// Handle options
if (options != null) {
if (options.getExpires() != null) {
claims.put("exp", options.getExpires().getTime() / 1000); // depends on control dependency: [if], data = [none]
}
if (options.getNotBefore() != null) {
claims.put("nbf", options.getNotBefore().getTime() / 1000); // depends on control dependency: [if], data = [none]
}
// Only add these claims if they're true to avoid sending them over the wire when false.
if (options.isAdmin()) {
claims.put("admin", options.isAdmin()); // depends on control dependency: [if], data = [none]
}
if (options.isDebug()) {
claims.put("debug", options.isDebug()); // depends on control dependency: [if], data = [none]
}
}
} catch (JSONException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
String token = computeToken(claims);
if (token.length() > 1024) {
throw new IllegalArgumentException("TokenGenerator.createToken: Generated token is too long. The token cannot be longer than 1024 bytes.");
}
return token;
} }
|
public class class_name {
private synchronized void checkTimeout(final long timeoutMs) {
final Entry<Integer, SendWork> oldest = m_outstandingWork.firstEntry();
if (oldest != null) {
final long now = System.currentTimeMillis();
SendWork work = oldest.getValue();
if ((now - work.m_ts) > timeoutMs) {
StreamSnapshotTimeoutException exception =
new StreamSnapshotTimeoutException(String.format(
"A snapshot write task failed after a timeout (currently %d seconds outstanding). " +
"Node rejoin may need to be retried",
(now - work.m_ts) / 1000));
rejoinLog.error(exception.getMessage());
m_writeFailed.compareAndSet(null, exception);
}
}
} }
|
public class class_name {
private synchronized void checkTimeout(final long timeoutMs) {
final Entry<Integer, SendWork> oldest = m_outstandingWork.firstEntry();
if (oldest != null) {
final long now = System.currentTimeMillis();
SendWork work = oldest.getValue();
if ((now - work.m_ts) > timeoutMs) {
StreamSnapshotTimeoutException exception =
new StreamSnapshotTimeoutException(String.format(
"A snapshot write task failed after a timeout (currently %d seconds outstanding). " +
"Node rejoin may need to be retried",
(now - work.m_ts) / 1000));
rejoinLog.error(exception.getMessage()); // depends on control dependency: [if], data = [none]
m_writeFailed.compareAndSet(null, exception); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void generateCommunity(final Metadata m, final Element e) {
if (m.getCommunity() == null) {
return;
}
final Element communityElement = new Element("community", NS);
if (m.getCommunity().getStarRating() != null) {
final Element starRatingElement = new Element("starRating", NS);
addNotNullAttribute(starRatingElement, "average", m.getCommunity().getStarRating().getAverage());
addNotNullAttribute(starRatingElement, "count", m.getCommunity().getStarRating().getCount());
addNotNullAttribute(starRatingElement, "min", m.getCommunity().getStarRating().getMin());
addNotNullAttribute(starRatingElement, "max", m.getCommunity().getStarRating().getMax());
if (starRatingElement.hasAttributes()) {
communityElement.addContent(starRatingElement);
}
}
if (m.getCommunity().getStatistics() != null) {
final Element statisticsElement = new Element("statistics", NS);
addNotNullAttribute(statisticsElement, "views", m.getCommunity().getStatistics().getViews());
addNotNullAttribute(statisticsElement, "favorites", m.getCommunity().getStatistics().getFavorites());
if (statisticsElement.hasAttributes()) {
communityElement.addContent(statisticsElement);
}
}
if (m.getCommunity().getTags() != null && !m.getCommunity().getTags().isEmpty()) {
final Element tagsElement = new Element("tags", NS);
for (final Tag tag : m.getCommunity().getTags()) {
if (!tagsElement.getTextTrim().isEmpty()) {
tagsElement.addContent(", ");
}
if (tag.getWeight() == null) {
tagsElement.addContent(tag.getName());
} else {
tagsElement.addContent(tag.getName());
tagsElement.addContent(":");
tagsElement.addContent(String.valueOf(tag.getWeight()));
}
}
if (!tagsElement.getTextTrim().isEmpty()) {
communityElement.addContent(tagsElement);
}
}
if (!communityElement.getChildren().isEmpty()) {
e.addContent(communityElement);
}
} }
|
public class class_name {
private void generateCommunity(final Metadata m, final Element e) {
if (m.getCommunity() == null) {
return; // depends on control dependency: [if], data = [none]
}
final Element communityElement = new Element("community", NS);
if (m.getCommunity().getStarRating() != null) {
final Element starRatingElement = new Element("starRating", NS);
addNotNullAttribute(starRatingElement, "average", m.getCommunity().getStarRating().getAverage()); // depends on control dependency: [if], data = [none]
addNotNullAttribute(starRatingElement, "count", m.getCommunity().getStarRating().getCount()); // depends on control dependency: [if], data = [none]
addNotNullAttribute(starRatingElement, "min", m.getCommunity().getStarRating().getMin()); // depends on control dependency: [if], data = [none]
addNotNullAttribute(starRatingElement, "max", m.getCommunity().getStarRating().getMax()); // depends on control dependency: [if], data = [none]
if (starRatingElement.hasAttributes()) {
communityElement.addContent(starRatingElement); // depends on control dependency: [if], data = [none]
}
}
if (m.getCommunity().getStatistics() != null) {
final Element statisticsElement = new Element("statistics", NS);
addNotNullAttribute(statisticsElement, "views", m.getCommunity().getStatistics().getViews()); // depends on control dependency: [if], data = [none]
addNotNullAttribute(statisticsElement, "favorites", m.getCommunity().getStatistics().getFavorites()); // depends on control dependency: [if], data = [none]
if (statisticsElement.hasAttributes()) {
communityElement.addContent(statisticsElement); // depends on control dependency: [if], data = [none]
}
}
if (m.getCommunity().getTags() != null && !m.getCommunity().getTags().isEmpty()) {
final Element tagsElement = new Element("tags", NS);
for (final Tag tag : m.getCommunity().getTags()) {
if (!tagsElement.getTextTrim().isEmpty()) {
tagsElement.addContent(", "); // depends on control dependency: [if], data = [none]
}
if (tag.getWeight() == null) {
tagsElement.addContent(tag.getName()); // depends on control dependency: [if], data = [none]
} else {
tagsElement.addContent(tag.getName()); // depends on control dependency: [if], data = [none]
tagsElement.addContent(":"); // depends on control dependency: [if], data = [none]
tagsElement.addContent(String.valueOf(tag.getWeight())); // depends on control dependency: [if], data = [(tag.getWeight()]
}
}
if (!tagsElement.getTextTrim().isEmpty()) {
communityElement.addContent(tagsElement); // depends on control dependency: [if], data = [none]
}
}
if (!communityElement.getChildren().isEmpty()) {
e.addContent(communityElement); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Stream<List<T>> combinations() {
if (this instanceof ArrayStream) {
@SuppressWarnings("resource")
final ArrayStream<T> s = ((ArrayStream<T>) this);
final int count = s.toIndex - s.fromIndex;
return newStream(IntStream.rangeClosed(0, count).flatMapToObj(new IntFunction<Stream<List<T>>>() {
@Override
public Stream<List<T>> apply(int value) {
return combinations(value);
}
}).iterator(), false, null);
} else {
return newStream((T[]) toArray(), false, null).combinations();
}
} }
|
public class class_name {
@Override
public Stream<List<T>> combinations() {
if (this instanceof ArrayStream) {
@SuppressWarnings("resource")
final ArrayStream<T> s = ((ArrayStream<T>) this);
final int count = s.toIndex - s.fromIndex;
return newStream(IntStream.rangeClosed(0, count).flatMapToObj(new IntFunction<Stream<List<T>>>() {
@Override
public Stream<List<T>> apply(int value) {
return combinations(value);
}
}).iterator(), false, null);
// depends on control dependency: [if], data = [none]
} else {
return newStream((T[]) toArray(), false, null).combinations();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private XmlElement generateSelectiveElement(IntrospectedTable introspectedTable) {
XmlElement chooseEle = new XmlElement("choose");
XmlElement whenEle = new XmlElement("when");
whenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
chooseEle.addElement(whenEle);
// 生成返回字段节点
XmlElement keysEle = new XmlElement("foreach");
whenEle.addElement(keysEle);
keysEle.addAttribute(new Attribute("collection", "selective"));
keysEle.addAttribute(new Attribute("item", "column"));
keysEle.addAttribute(new Attribute("separator", ","));
keysEle.addElement(new TextElement("${column.aliasedEscapedColumnName}"));
XmlElement otherwiseEle = new XmlElement("otherwise");
chooseEle.addElement(otherwiseEle);
// 存在关键词column或者table定义了alias属性,这里直接使用对应的ColumnListElement
if (introspectedTable.getRules().generateSelectByExampleWithBLOBs()) {
otherwiseEle.addElement(XmlElementGeneratorTools.getBaseColumnListElement(introspectedTable));
otherwiseEle.addElement(new TextElement(","));
otherwiseEle.addElement(XmlElementGeneratorTools.getBlobColumnListElement(introspectedTable));
} else {
otherwiseEle.addElement(XmlElementGeneratorTools.getBaseColumnListElement(introspectedTable));
}
return chooseEle;
} }
|
public class class_name {
private XmlElement generateSelectiveElement(IntrospectedTable introspectedTable) {
XmlElement chooseEle = new XmlElement("choose");
XmlElement whenEle = new XmlElement("when");
whenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
chooseEle.addElement(whenEle);
// 生成返回字段节点
XmlElement keysEle = new XmlElement("foreach");
whenEle.addElement(keysEle);
keysEle.addAttribute(new Attribute("collection", "selective"));
keysEle.addAttribute(new Attribute("item", "column"));
keysEle.addAttribute(new Attribute("separator", ","));
keysEle.addElement(new TextElement("${column.aliasedEscapedColumnName}"));
XmlElement otherwiseEle = new XmlElement("otherwise");
chooseEle.addElement(otherwiseEle);
// 存在关键词column或者table定义了alias属性,这里直接使用对应的ColumnListElement
if (introspectedTable.getRules().generateSelectByExampleWithBLOBs()) {
otherwiseEle.addElement(XmlElementGeneratorTools.getBaseColumnListElement(introspectedTable)); // depends on control dependency: [if], data = [none]
otherwiseEle.addElement(new TextElement(",")); // depends on control dependency: [if], data = [none]
otherwiseEle.addElement(XmlElementGeneratorTools.getBlobColumnListElement(introspectedTable)); // depends on control dependency: [if], data = [none]
} else {
otherwiseEle.addElement(XmlElementGeneratorTools.getBaseColumnListElement(introspectedTable)); // depends on control dependency: [if], data = [none]
}
return chooseEle;
} }
|
public class class_name {
public void validate(Context context, Date asOfDateTime, DOReader currentObjectReader,
Validation validation) throws ServerException {
OWLOntologyManager owlManager = OWLManager.createOWLOntologyManager();
List<String> contentmodels = currentObjectReader.getContentModels();
for (String contentmodel : contentmodels) {
contentmodel = contentmodel.substring("info:fedora/".length());
DOReader contentmodelReader;
try {
contentmodelReader = doMgr.getReader(false, context, contentmodel);
} catch (LowlevelStorageException e) {//content model could not be found
continue;
}
if (asOfDateTime != null) { //disregard content models created after the asOfDateTime
if (!contentmodelReader.getCreateDate().before(asOfDateTime)) {
continue;
}
}
Datastream ontologyDS = contentmodelReader.GetDatastream("ONTOLOGY", asOfDateTime);
if (ontologyDS == null) {//No ontology in the content model, continue
continue;
}
InputStream ontologyStream = ontologyDS.getContentStream();
try {
owlManager.loadOntologyFromOntologyDocument(ontologyStream);
} catch (OWLOntologyCreationException e) {
logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
}
}
OWLOntologyMerger merger = new OWLOntologyMerger(owlManager);
IRI mergedOntologyIRI = IRI.create("http://www.semanticweb.com/mymergedont");
OWLOntology mergedOntology = null;
try {
mergedOntology = merger.createMergedOntology(owlManager, mergedOntologyIRI);
} catch (OWLOntologyCreationException e) {
logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
}
//Make a new restrition visitor.
RestrictionVisitor restrictionVisitor =
new RestrictionVisitor(Collections.singleton(mergedOntology));
Set<RelationshipTuple> relations = currentObjectReader.getRelationships();
for (String contentmodel : contentmodels) {
List<String> datastreamNames = getDatastreamNames(context, contentmodel, asOfDateTime);
for (String datastreamName : datastreamNames) {
IRI datastreamDeclaration = toIRI(contentmodel, datastreamName);
OWLClass datastreamClass = owlManager.getOWLDataFactory().getOWLClass(datastreamDeclaration);
for (OWLSubClassOfAxiom ax : mergedOntology.getSubClassAxiomsForSubClass(datastreamClass)) {
OWLClassExpression superCls = ax.getSuperClass();
// Ask our superclass to accept a visit from the RestrictionVisitor - if it is an
// existential restiction then our restriction visitor will answer it - if not our
// visitor will ignore it
superCls.accept(restrictionVisitor);
}
String datastream = "info:fedora/" + currentObjectReader.GetObjectPID() + "/" + datastreamName;
/*
NodeList relationsNodes = xpathselector
.selectNodeList(relsint, "/rdf:RDF/rdf:Description[@rdf:about='" + datastream + "']*/
/*");
*/
Set<RelationshipTuple> relationsAbout = getRelationsSubjectTo(relations, datastream);
checkMinCardinality(datastream, relationsAbout, restrictionVisitor, validation);
checkMaxCardinality(datastream, relationsAbout, restrictionVisitor, validation);
checkExactCardinality(datastream, relationsAbout, restrictionVisitor, validation);
checkSomeValuesFrom(datastream, relationsAbout, restrictionVisitor, validation, context);
checkAllValuesFrom(datastream, relationsAbout, restrictionVisitor, validation, context);
restrictionVisitor.reset();
}
}
for (String contentmodel : contentmodels) {
IRI objectDeclaration = toIRI(contentmodel, null);
OWLClass objectClass = owlManager.getOWLDataFactory().getOWLClass(objectDeclaration);
for (OWLSubClassOfAxiom ax : mergedOntology.getSubClassAxiomsForSubClass(objectClass)) {
OWLClassExpression superCls = ax.getSuperClass();
// Ask our superclass to accept a visit from the RestrictionVisitor - if it is an
// existential restiction then our restriction visitor will answer it - if not our
// visitor will ignore it
superCls.accept(restrictionVisitor);
}
String pid = "info:fedora/" + currentObjectReader.GetObjectPID();
Set<RelationshipTuple> relationsAbout = getRelationsSubjectTo(relations, pid);
checkMinCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkMaxCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkExactCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkSomeValuesFrom(pid, relationsAbout, restrictionVisitor, validation, context);
checkAllValuesFrom(pid, relationsAbout, restrictionVisitor, validation, context);
restrictionVisitor.reset();
}
} }
|
public class class_name {
public void validate(Context context, Date asOfDateTime, DOReader currentObjectReader,
Validation validation) throws ServerException {
OWLOntologyManager owlManager = OWLManager.createOWLOntologyManager();
List<String> contentmodels = currentObjectReader.getContentModels();
for (String contentmodel : contentmodels) {
contentmodel = contentmodel.substring("info:fedora/".length());
DOReader contentmodelReader;
try {
contentmodelReader = doMgr.getReader(false, context, contentmodel); // depends on control dependency: [try], data = [none]
} catch (LowlevelStorageException e) {//content model could not be found
continue;
} // depends on control dependency: [catch], data = [none]
if (asOfDateTime != null) { //disregard content models created after the asOfDateTime
if (!contentmodelReader.getCreateDate().before(asOfDateTime)) {
continue;
}
}
Datastream ontologyDS = contentmodelReader.GetDatastream("ONTOLOGY", asOfDateTime);
if (ontologyDS == null) {//No ontology in the content model, continue
continue;
}
InputStream ontologyStream = ontologyDS.getContentStream();
try {
owlManager.loadOntologyFromOntologyDocument(ontologyStream); // depends on control dependency: [try], data = [none]
} catch (OWLOntologyCreationException e) {
logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
} // depends on control dependency: [catch], data = [none]
}
OWLOntologyMerger merger = new OWLOntologyMerger(owlManager);
IRI mergedOntologyIRI = IRI.create("http://www.semanticweb.com/mymergedont");
OWLOntology mergedOntology = null;
try {
mergedOntology = merger.createMergedOntology(owlManager, mergedOntologyIRI);
} catch (OWLOntologyCreationException e) {
logger.debug("Failed to load ontology for object " + currentObjectReader.GetObjectPID(), e);
}
//Make a new restrition visitor.
RestrictionVisitor restrictionVisitor =
new RestrictionVisitor(Collections.singleton(mergedOntology));
Set<RelationshipTuple> relations = currentObjectReader.getRelationships();
for (String contentmodel : contentmodels) {
List<String> datastreamNames = getDatastreamNames(context, contentmodel, asOfDateTime);
for (String datastreamName : datastreamNames) {
IRI datastreamDeclaration = toIRI(contentmodel, datastreamName);
OWLClass datastreamClass = owlManager.getOWLDataFactory().getOWLClass(datastreamDeclaration);
for (OWLSubClassOfAxiom ax : mergedOntology.getSubClassAxiomsForSubClass(datastreamClass)) {
OWLClassExpression superCls = ax.getSuperClass();
// Ask our superclass to accept a visit from the RestrictionVisitor - if it is an
// existential restiction then our restriction visitor will answer it - if not our
// visitor will ignore it
superCls.accept(restrictionVisitor); // depends on control dependency: [for], data = [none]
}
String datastream = "info:fedora/" + currentObjectReader.GetObjectPID() + "/" + datastreamName;
/*
NodeList relationsNodes = xpathselector
.selectNodeList(relsint, "/rdf:RDF/rdf:Description[@rdf:about='" + datastream + "']*/
/*");
*/
Set<RelationshipTuple> relationsAbout = getRelationsSubjectTo(relations, datastream);
checkMinCardinality(datastream, relationsAbout, restrictionVisitor, validation); // depends on control dependency: [for], data = [none]
checkMaxCardinality(datastream, relationsAbout, restrictionVisitor, validation); // depends on control dependency: [for], data = [none]
checkExactCardinality(datastream, relationsAbout, restrictionVisitor, validation); // depends on control dependency: [for], data = [none]
checkSomeValuesFrom(datastream, relationsAbout, restrictionVisitor, validation, context); // depends on control dependency: [for], data = [none]
checkAllValuesFrom(datastream, relationsAbout, restrictionVisitor, validation, context); // depends on control dependency: [for], data = [none]
restrictionVisitor.reset(); // depends on control dependency: [for], data = [none]
}
}
for (String contentmodel : contentmodels) {
IRI objectDeclaration = toIRI(contentmodel, null);
OWLClass objectClass = owlManager.getOWLDataFactory().getOWLClass(objectDeclaration);
for (OWLSubClassOfAxiom ax : mergedOntology.getSubClassAxiomsForSubClass(objectClass)) {
OWLClassExpression superCls = ax.getSuperClass();
// Ask our superclass to accept a visit from the RestrictionVisitor - if it is an
// existential restiction then our restriction visitor will answer it - if not our
// visitor will ignore it
superCls.accept(restrictionVisitor); // depends on control dependency: [for], data = [none]
}
String pid = "info:fedora/" + currentObjectReader.GetObjectPID();
Set<RelationshipTuple> relationsAbout = getRelationsSubjectTo(relations, pid);
checkMinCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkMaxCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkExactCardinality(pid, relationsAbout, restrictionVisitor, validation);
checkSomeValuesFrom(pid, relationsAbout, restrictionVisitor, validation, context);
checkAllValuesFrom(pid, relationsAbout, restrictionVisitor, validation, context);
restrictionVisitor.reset();
}
} }
|
public class class_name {
private static int arrayMemberHash(final Class<?> componentType, final Object o) {
if (componentType.equals(Byte.TYPE)) {
return Arrays.hashCode((byte[]) o);
}
if (componentType.equals(Short.TYPE)) {
return Arrays.hashCode((short[]) o);
}
if (componentType.equals(Integer.TYPE)) {
return Arrays.hashCode((int[]) o);
}
if (componentType.equals(Character.TYPE)) {
return Arrays.hashCode((char[]) o);
}
if (componentType.equals(Long.TYPE)) {
return Arrays.hashCode((long[]) o);
}
if (componentType.equals(Float.TYPE)) {
return Arrays.hashCode((float[]) o);
}
if (componentType.equals(Double.TYPE)) {
return Arrays.hashCode((double[]) o);
}
if (componentType.equals(Boolean.TYPE)) {
return Arrays.hashCode((boolean[]) o);
}
return Arrays.hashCode((Object[]) o);
} }
|
public class class_name {
private static int arrayMemberHash(final Class<?> componentType, final Object o) {
if (componentType.equals(Byte.TYPE)) {
return Arrays.hashCode((byte[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Short.TYPE)) {
return Arrays.hashCode((short[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Integer.TYPE)) {
return Arrays.hashCode((int[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Character.TYPE)) {
return Arrays.hashCode((char[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Long.TYPE)) {
return Arrays.hashCode((long[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Float.TYPE)) {
return Arrays.hashCode((float[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Double.TYPE)) {
return Arrays.hashCode((double[]) o); // depends on control dependency: [if], data = [none]
}
if (componentType.equals(Boolean.TYPE)) {
return Arrays.hashCode((boolean[]) o); // depends on control dependency: [if], data = [none]
}
return Arrays.hashCode((Object[]) o);
} }
|
public class class_name {
public String getXML()
{
if (m_message != null)
{
BaseMessage message = m_message.getMessage();
return message.getXML(false);
}
return super.getXML(); // Null
} }
|
public class class_name {
public String getXML()
{
if (m_message != null)
{
BaseMessage message = m_message.getMessage();
return message.getXML(false); // depends on control dependency: [if], data = [none]
}
return super.getXML(); // Null
} }
|
public class class_name {
public void marshall(CreateCrawlerRequest createCrawlerRequest, ProtocolMarshaller protocolMarshaller) {
if (createCrawlerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createCrawlerRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getRole(), ROLE_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getDatabaseName(), DATABASENAME_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getTargets(), TARGETS_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getSchedule(), SCHEDULE_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getClassifiers(), CLASSIFIERS_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getTablePrefix(), TABLEPREFIX_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getSchemaChangePolicy(), SCHEMACHANGEPOLICY_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getConfiguration(), CONFIGURATION_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getCrawlerSecurityConfiguration(), CRAWLERSECURITYCONFIGURATION_BINDING);
protocolMarshaller.marshall(createCrawlerRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateCrawlerRequest createCrawlerRequest, ProtocolMarshaller protocolMarshaller) {
if (createCrawlerRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createCrawlerRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getRole(), ROLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getDatabaseName(), DATABASENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getTargets(), TARGETS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getSchedule(), SCHEDULE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getClassifiers(), CLASSIFIERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getTablePrefix(), TABLEPREFIX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getSchemaChangePolicy(), SCHEMACHANGEPOLICY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getConfiguration(), CONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getCrawlerSecurityConfiguration(), CRAWLERSECURITYCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createCrawlerRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static List<File> findFilesInDirectory(File directory,
Pattern pattern, boolean scanRecursive) {
List<File> files = new ArrayList<File>();
String[] filesInDirectory = directory.list();
if (filesInDirectory == null) {
return files;
}
for (String fileToCheck : filesInDirectory) {
File file = new File(directory, fileToCheck);
if (file.isFile()) {
if (pattern.matcher(fileToCheck).matches()) {
files.add(file);
}
} else if (file.isDirectory()) {
if (scanRecursive) {
files.addAll(findFilesInDirectory(file, pattern,
scanRecursive));
}
}
}
return files;
} }
|
public class class_name {
private static List<File> findFilesInDirectory(File directory,
Pattern pattern, boolean scanRecursive) {
List<File> files = new ArrayList<File>();
String[] filesInDirectory = directory.list();
if (filesInDirectory == null) {
return files; // depends on control dependency: [if], data = [none]
}
for (String fileToCheck : filesInDirectory) {
File file = new File(directory, fileToCheck);
if (file.isFile()) {
if (pattern.matcher(fileToCheck).matches()) {
files.add(file); // depends on control dependency: [if], data = [none]
}
} else if (file.isDirectory()) {
if (scanRecursive) {
files.addAll(findFilesInDirectory(file, pattern,
scanRecursive)); // depends on control dependency: [if], data = [none]
}
}
}
return files;
} }
|
public class class_name {
public synchronized void removeContextAttribute(String name)
{
Object old= super.getContextAttribute(name);
super.removeContextAttribute(name);
if (old != null && _contextAttributeListeners != null)
{
ServletContextAttributeEvent event= new ServletContextAttributeEvent(getServletContext(), name, old);
for (int i= 0; i < LazyList.size(_contextAttributeListeners); i++)
{
ServletContextAttributeListener l=
(ServletContextAttributeListener)LazyList.get(_contextAttributeListeners, i);
l.attributeRemoved(event);
}
}
} }
|
public class class_name {
public synchronized void removeContextAttribute(String name)
{
Object old= super.getContextAttribute(name);
super.removeContextAttribute(name);
if (old != null && _contextAttributeListeners != null)
{
ServletContextAttributeEvent event= new ServletContextAttributeEvent(getServletContext(), name, old);
for (int i= 0; i < LazyList.size(_contextAttributeListeners); i++)
{
ServletContextAttributeListener l=
(ServletContextAttributeListener)LazyList.get(_contextAttributeListeners, i);
l.attributeRemoved(event); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public void marshall(InviteMembersRequest inviteMembersRequest, ProtocolMarshaller protocolMarshaller) {
if (inviteMembersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inviteMembersRequest.getAccountIds(), ACCOUNTIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InviteMembersRequest inviteMembersRequest, ProtocolMarshaller protocolMarshaller) {
if (inviteMembersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inviteMembersRequest.getAccountIds(), ACCOUNTIDS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static SelectionSpec[] buildFullTraversal() {
List<TraversalSpec> tSpecs = buildFullTraversalV2NoFolder();
// Recurse through the folders
TraversalSpec visitFolders = createTraversalSpec("visitFolders",
"Folder", "childEntity",
new String[]{"visitFolders", "dcToHf", "dcToVmf", "crToH", "crToRp", "HToVm", "rpToVm"});
SelectionSpec[] sSpecs = new SelectionSpec[tSpecs.size() + 1];
sSpecs[0] = visitFolders;
for (int i = 1; i < sSpecs.length; i++) {
sSpecs[i] = tSpecs.get(i - 1);
}
return sSpecs;
} }
|
public class class_name {
public static SelectionSpec[] buildFullTraversal() {
List<TraversalSpec> tSpecs = buildFullTraversalV2NoFolder();
// Recurse through the folders
TraversalSpec visitFolders = createTraversalSpec("visitFolders",
"Folder", "childEntity",
new String[]{"visitFolders", "dcToHf", "dcToVmf", "crToH", "crToRp", "HToVm", "rpToVm"});
SelectionSpec[] sSpecs = new SelectionSpec[tSpecs.size() + 1];
sSpecs[0] = visitFolders;
for (int i = 1; i < sSpecs.length; i++) {
sSpecs[i] = tSpecs.get(i - 1);
// depends on control dependency: [for], data = [i]
}
return sSpecs;
} }
|
public class class_name {
public void replaceOrAdd(String name, String value) {
boolean found = false;
for (Param param : params) {
if (param.getKey().equals(name)) {
param.setValue(value);
found = true;
break;
}
}
if (!found) {
addParam(name, value);
}
} }
|
public class class_name {
public void replaceOrAdd(String name, String value) {
boolean found = false;
for (Param param : params) {
if (param.getKey().equals(name)) {
param.setValue(value); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
addParam(name, value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String Replace(String aSrcStr, String aSearchStr, String aReplaceStr) {
if (aSrcStr == null || aSearchStr == null || aReplaceStr == null)
return aSrcStr;
if (aSearchStr.length() == 0
|| aSrcStr.length() == 0
|| aSrcStr.indexOf(aSearchStr) == -1) {
return aSrcStr;
}
StringBuffer mBuff = new StringBuffer();
int mSrcStrLen, mSearchStrLen;
mSrcStrLen = aSrcStr.length();
mSearchStrLen = aSearchStr.length();
for (int i = 0, j = 0; i < mSrcStrLen; i = j + mSearchStrLen) {
j = aSrcStr.indexOf(aSearchStr, i);
if (j == -1) {
mBuff.append(aSrcStr.substring(i));
break;
}
mBuff.append(aSrcStr.substring(i, j));
mBuff.append(aReplaceStr);
}
return mBuff.toString();
} }
|
public class class_name {
public static String Replace(String aSrcStr, String aSearchStr, String aReplaceStr) {
if (aSrcStr == null || aSearchStr == null || aReplaceStr == null)
return aSrcStr;
if (aSearchStr.length() == 0
|| aSrcStr.length() == 0
|| aSrcStr.indexOf(aSearchStr) == -1) {
return aSrcStr; // depends on control dependency: [if], data = [none]
}
StringBuffer mBuff = new StringBuffer();
int mSrcStrLen, mSearchStrLen;
mSrcStrLen = aSrcStr.length();
mSearchStrLen = aSearchStr.length();
for (int i = 0, j = 0; i < mSrcStrLen; i = j + mSearchStrLen) {
j = aSrcStr.indexOf(aSearchStr, i); // depends on control dependency: [for], data = [i]
if (j == -1) {
mBuff.append(aSrcStr.substring(i)); // depends on control dependency: [if], data = [none]
break;
}
mBuff.append(aSrcStr.substring(i, j)); // depends on control dependency: [for], data = [i]
mBuff.append(aReplaceStr); // depends on control dependency: [for], data = [none]
}
return mBuff.toString();
} }
|
public class class_name {
public synchronized EventBus once(Class<? extends EventObject> eventType, OnceEventListenerBase listener) {
if (null != onceBus) {
onceBus.bind(eventType, listener);
} else {
bind(eventType, listener);
}
return this;
} }
|
public class class_name {
public synchronized EventBus once(Class<? extends EventObject> eventType, OnceEventListenerBase listener) {
if (null != onceBus) {
onceBus.bind(eventType, listener); // depends on control dependency: [if], data = [none]
} else {
bind(eventType, listener); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
static WebAppClassLoader createWebAppClassLoader(final ClassLoader cl, final WebAppContext wac)
{
return AccessController.doPrivileged(new PrivilegedAction<WebAppClassLoader>()
{
public WebAppClassLoader run()
{
try
{
return new WebAppClassLoader(cl, wac);
}
catch (IOException ioe)
{
return null;
}
}
});
} }
|
public class class_name {
static WebAppClassLoader createWebAppClassLoader(final ClassLoader cl, final WebAppContext wac)
{
return AccessController.doPrivileged(new PrivilegedAction<WebAppClassLoader>()
{
public WebAppClassLoader run()
{
try
{
return new WebAppClassLoader(cl, wac); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe)
{
return null;
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public void marshall(ExtendedKeyUsage extendedKeyUsage, ProtocolMarshaller protocolMarshaller) {
if (extendedKeyUsage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(extendedKeyUsage.getName(), NAME_BINDING);
protocolMarshaller.marshall(extendedKeyUsage.getOID(), OID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ExtendedKeyUsage extendedKeyUsage, ProtocolMarshaller protocolMarshaller) {
if (extendedKeyUsage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(extendedKeyUsage.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(extendedKeyUsage.getOID(), OID_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 {
double getBetheFreeEnergy() {
//
// G_{Bethe} = \sum_a \sum_{x_a} - b(x_a) ln \chi(x_a)
// + \sum_a \sum_{x_a} b(x_a) ln b(x_a)
// + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
// = \sum_a \sum_{x_a} b(x_a) ln (b(x_a) / \chi(x_a))
// + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
//
// where n_i is the number of neighbors of the variable x_i,
// b(x_a) and b(x_i) are normalized distributions and x_a is
// the set of variables participating in factor a.
//
double bethe = 0.0;
for (int a=0; a<fg.getFactors().size(); a++) {
Factor f = fg.getFactors().get(a);
if (!(f instanceof GlobalFactor)) {
int numConfigs = f.getVars().calcNumConfigs();
VarTensor beliefs = getFactorBeliefs(a);
for (int c=0; c<numConfigs; c++) {
// Since we want multiplication by 0 to always give 0 (not the case for Double.POSITIVE_INFINITY or Double.NaN.
double b_c = beliefs.getValue(c);
if (b_c != s.zero()) {
double r_b_c = s.toReal(b_c);
double log_b_c = s.toLogProb(b_c);
double log_chi_c = f.getLogUnormalizedScore(c);
bethe += r_b_c * (log_b_c - log_chi_c);
}
}
} else {
VarTensor[] inMsgs = getMsgs(f.getId(), msgs, IN_MSG);
bethe += ((GlobalFactor) f).getExpectedLogBelief(inMsgs);
}
}
for (int v=0; v<fg.getVars().size(); v++) {
Var var = fg.getVars().get(v);
int numNeighbors = bg.numNbsT1(v);
VarTensor beliefs = getVarBeliefs(v);
double sum = 0.0;
for (int c=0; c<var.getNumStates(); c++) {
double b_c = beliefs.getValue(c);
if (b_c != s.zero()) {
double r_b_c = s.toReal(b_c);
double log_b_c = s.toLogProb(b_c);
sum += r_b_c * log_b_c;
}
}
bethe -= (numNeighbors - 1) * sum;
}
assert !Double.isNaN(bethe);
return bethe;
} }
|
public class class_name {
double getBetheFreeEnergy() {
//
// G_{Bethe} = \sum_a \sum_{x_a} - b(x_a) ln \chi(x_a)
// + \sum_a \sum_{x_a} b(x_a) ln b(x_a)
// + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
// = \sum_a \sum_{x_a} b(x_a) ln (b(x_a) / \chi(x_a))
// + \sum_i (n_i - 1) \sum_{x_i} b(x_i) ln b(x_i)
//
// where n_i is the number of neighbors of the variable x_i,
// b(x_a) and b(x_i) are normalized distributions and x_a is
// the set of variables participating in factor a.
//
double bethe = 0.0;
for (int a=0; a<fg.getFactors().size(); a++) {
Factor f = fg.getFactors().get(a);
if (!(f instanceof GlobalFactor)) {
int numConfigs = f.getVars().calcNumConfigs();
VarTensor beliefs = getFactorBeliefs(a);
for (int c=0; c<numConfigs; c++) {
// Since we want multiplication by 0 to always give 0 (not the case for Double.POSITIVE_INFINITY or Double.NaN.
double b_c = beliefs.getValue(c);
if (b_c != s.zero()) {
double r_b_c = s.toReal(b_c);
double log_b_c = s.toLogProb(b_c);
double log_chi_c = f.getLogUnormalizedScore(c);
bethe += r_b_c * (log_b_c - log_chi_c); // depends on control dependency: [if], data = [none]
}
}
} else {
VarTensor[] inMsgs = getMsgs(f.getId(), msgs, IN_MSG);
bethe += ((GlobalFactor) f).getExpectedLogBelief(inMsgs); // depends on control dependency: [if], data = [none]
}
}
for (int v=0; v<fg.getVars().size(); v++) {
Var var = fg.getVars().get(v);
int numNeighbors = bg.numNbsT1(v);
VarTensor beliefs = getVarBeliefs(v);
double sum = 0.0;
for (int c=0; c<var.getNumStates(); c++) {
double b_c = beliefs.getValue(c);
if (b_c != s.zero()) {
double r_b_c = s.toReal(b_c);
double log_b_c = s.toLogProb(b_c);
sum += r_b_c * log_b_c; // depends on control dependency: [if], data = [none]
}
}
bethe -= (numNeighbors - 1) * sum; // depends on control dependency: [for], data = [none]
}
assert !Double.isNaN(bethe);
return bethe;
} }
|
public class class_name {
@Override public synchronized Long append(final String key, final String value) throws WrongTypeException {
checkType(key, "string");
if (!exists(key)) {
try {
set(key, value);
}
catch (Exception e) {
}
}
else {
stringCache.set(key, stringCache.get(key) + value);
}
return strlen(key);
} }
|
public class class_name {
@Override public synchronized Long append(final String key, final String value) throws WrongTypeException {
checkType(key, "string");
if (!exists(key)) {
try {
set(key, value); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
else {
stringCache.set(key, stringCache.get(key) + value);
}
return strlen(key);
} }
|
public class class_name {
public void marshall(ListHapgsRequest listHapgsRequest, ProtocolMarshaller protocolMarshaller) {
if (listHapgsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listHapgsRequest.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(ListHapgsRequest listHapgsRequest, ProtocolMarshaller protocolMarshaller) {
if (listHapgsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listHapgsRequest.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 void addComponentListeners() {
// avoid duplicate registration
removeListeners();
for (final AbstractField<?> field : allComponents) {
if (field instanceof TextChangeNotifier) {
((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
}
if (field instanceof Table) {
((Table) field).addItemSetChangeListener(new ChangeListener(field));
}
field.addValueChangeListener(new ChangeListener(field));
}
} }
|
public class class_name {
public void addComponentListeners() {
// avoid duplicate registration
removeListeners();
for (final AbstractField<?> field : allComponents) {
if (field instanceof TextChangeNotifier) {
((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field)); // depends on control dependency: [if], data = [none]
}
if (field instanceof Table) {
((Table) field).addItemSetChangeListener(new ChangeListener(field)); // depends on control dependency: [if], data = [none]
}
field.addValueChangeListener(new ChangeListener(field)); // depends on control dependency: [for], data = [field]
}
} }
|
public class class_name {
protected void injectValueIntoObject(final Object target, final PropertyDescriptor pd, final Object value) {
Object convertedValue = value;
if (value != null) {
Class targetClass = pd.getType();
convertedValue = convertType(value, targetClass);
}
try {
Setter setter = pd.getSetter(true);
if (setter != null) {
setter.invokeSetter(target, convertedValue);
}
} catch (Exception ex) {
throw new JsonException(ex);
}
} }
|
public class class_name {
protected void injectValueIntoObject(final Object target, final PropertyDescriptor pd, final Object value) {
Object convertedValue = value;
if (value != null) {
Class targetClass = pd.getType();
convertedValue = convertType(value, targetClass); // depends on control dependency: [if], data = [(value]
}
try {
Setter setter = pd.getSetter(true);
if (setter != null) {
setter.invokeSetter(target, convertedValue); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
throw new JsonException(ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Recipient[] toRecipient(PhoneNumber[] to) {
Recipient[] addresses = new Recipient[to.length];
int i = 0;
for (PhoneNumber t : to) {
addresses[i++] = new Recipient(t);
}
return addresses;
} }
|
public class class_name {
public static Recipient[] toRecipient(PhoneNumber[] to) {
Recipient[] addresses = new Recipient[to.length];
int i = 0;
for (PhoneNumber t : to) {
addresses[i++] = new Recipient(t); // depends on control dependency: [for], data = [t]
}
return addresses;
} }
|
public class class_name {
private Priority determinePriority(final Matcher matcher) {
if (isOfType(matcher, "note") || isOfType(matcher, "info")) {
return Priority.LOW;
}
else if (isOfType(matcher, "warning")) {
return Priority.NORMAL;
}
return Priority.HIGH;
} }
|
public class class_name {
private Priority determinePriority(final Matcher matcher) {
if (isOfType(matcher, "note") || isOfType(matcher, "info")) {
return Priority.LOW; // depends on control dependency: [if], data = [none]
}
else if (isOfType(matcher, "warning")) {
return Priority.NORMAL; // depends on control dependency: [if], data = [none]
}
return Priority.HIGH;
} }
|
public class class_name {
public static Anchor getAnchor(Properties attributes) {
Anchor anchor = new Anchor(getPhrase(attributes));
String value;
value = attributes.getProperty(ElementTags.NAME);
if (value != null) {
anchor.setName(value);
}
value = (String) attributes.remove(ElementTags.REFERENCE);
if (value != null) {
anchor.setReference(value);
}
return anchor;
} }
|
public class class_name {
public static Anchor getAnchor(Properties attributes) {
Anchor anchor = new Anchor(getPhrase(attributes));
String value;
value = attributes.getProperty(ElementTags.NAME);
if (value != null) {
anchor.setName(value); // depends on control dependency: [if], data = [(value]
}
value = (String) attributes.remove(ElementTags.REFERENCE);
if (value != null) {
anchor.setReference(value); // depends on control dependency: [if], data = [(value]
}
return anchor;
} }
|
public class class_name {
public static <T> T[] map(Class<T> c, Function<Long, T> f) {
@SuppressWarnings("unchecked")
T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length);
for (int i = 0; i < BUCKET_VALUES.length; ++i) {
values[i] = f.apply(BUCKET_VALUES[i]);
}
return values;
} }
|
public class class_name {
public static <T> T[] map(Class<T> c, Function<Long, T> f) {
@SuppressWarnings("unchecked")
T[] values = (T[]) Array.newInstance(c, BUCKET_VALUES.length);
for (int i = 0; i < BUCKET_VALUES.length; ++i) {
values[i] = f.apply(BUCKET_VALUES[i]); // depends on control dependency: [for], data = [i]
}
return values;
} }
|
public class class_name {
private void unpackRules(byte[] rules)
{
startDay = rules[0];
startDayOfWeek = rules[1];
endDay = rules[2];
endDayOfWeek = rules[3];
// As of serial version 2, include time modes
if (rules.length >= 6) {
startTimeMode = rules[4];
endTimeMode = rules[5];
}
} }
|
public class class_name {
private void unpackRules(byte[] rules)
{
startDay = rules[0];
startDayOfWeek = rules[1];
endDay = rules[2];
endDayOfWeek = rules[3];
// As of serial version 2, include time modes
if (rules.length >= 6) {
startTimeMode = rules[4]; // depends on control dependency: [if], data = [none]
endTimeMode = rules[5]; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setVersions(java.util.Collection<String> versions) {
if (versions == null) {
this.versions = null;
return;
}
this.versions = new com.amazonaws.internal.SdkInternalList<String>(versions);
} }
|
public class class_name {
public void setVersions(java.util.Collection<String> versions) {
if (versions == null) {
this.versions = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.versions = new com.amazonaws.internal.SdkInternalList<String>(versions);
} }
|
public class class_name {
@Override
public void add(int value) {
int key = toIntUnsigned(highbits(value));
if (key != currentKey) {
if (key < currentKey) {
underlying.add(value);
return;
} else {
appendToUnderlying();
currentKey = key;
}
}
int low = toIntUnsigned(lowbits(value));
bitmap[(low >>> 6)] |= (1L << low);
dirty = true;
} }
|
public class class_name {
@Override
public void add(int value) {
int key = toIntUnsigned(highbits(value));
if (key != currentKey) {
if (key < currentKey) {
underlying.add(value); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else {
appendToUnderlying(); // depends on control dependency: [if], data = [none]
currentKey = key; // depends on control dependency: [if], data = [none]
}
}
int low = toIntUnsigned(lowbits(value));
bitmap[(low >>> 6)] |= (1L << low);
dirty = true;
} }
|
public class class_name {
public void updateByteMetrics() {
try {
for (Optional<Fork> fork : this.forks.keySet()) {
if (fork.isPresent()) {
fork.get().updateByteMetrics();
}
}
} catch (IOException ioe) {
LOG.error("Failed to update byte-level metrics for task " + this.taskId, ioe);
}
} }
|
public class class_name {
public void updateByteMetrics() {
try {
for (Optional<Fork> fork : this.forks.keySet()) {
if (fork.isPresent()) {
fork.get().updateByteMetrics(); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException ioe) {
LOG.error("Failed to update byte-level metrics for task " + this.taskId, ioe);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void putRecursive(Class<?> type, E element, Class<?> elementType) {
Class<?> clazz = type;
while (clazz != null) {
if (isAccepted(clazz)) {
E existing = this.classMap.get(clazz);
boolean add = (existing == null);
if (existing != null) {
if (existing == element) {
return;
}
add = isPreferable(element, elementType, existing, clazz);
}
if (add) {
this.classMap.put(clazz, element);
}
}
for (Class<?> interfaceClass : clazz.getInterfaces()) {
if (isAccepted(interfaceClass)) {
putRecursive(interfaceClass, element, elementType);
}
}
clazz = clazz.getSuperclass();
}
} }
|
public class class_name {
private void putRecursive(Class<?> type, E element, Class<?> elementType) {
Class<?> clazz = type;
while (clazz != null) {
if (isAccepted(clazz)) {
E existing = this.classMap.get(clazz);
boolean add = (existing == null);
if (existing != null) {
if (existing == element) {
return; // depends on control dependency: [if], data = [none]
}
add = isPreferable(element, elementType, existing, clazz); // depends on control dependency: [if], data = [none]
}
if (add) {
this.classMap.put(clazz, element); // depends on control dependency: [if], data = [none]
}
}
for (Class<?> interfaceClass : clazz.getInterfaces()) {
if (isAccepted(interfaceClass)) {
putRecursive(interfaceClass, element, elementType); // depends on control dependency: [if], data = [none]
}
}
clazz = clazz.getSuperclass(); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public void marshall(DeleteInstanceRequest deleteInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteInstanceRequest.getInstanceName(), INSTANCENAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteInstanceRequest deleteInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteInstanceRequest.getInstanceName(), INSTANCENAME_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 Rectangle getBarcodeSize() {
float fontX = 0;
float fontY = 0;
String fCode = code;
if (extended)
fCode = getCode39Ex(code);
if (font != null) {
if (baseline > 0)
fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
else
fontY = -baseline + size;
String fullCode = code;
if (generateChecksum && checksumText)
fullCode += getChecksum(fCode);
if (startStopText)
fullCode = "*" + fullCode + "*";
fontX = font.getWidthPoint(altText != null ? altText : fullCode, size);
}
int len = fCode.length() + 2;
if (generateChecksum)
++len;
float fullWidth = len * (6 * x + 3 * x * n) + (len - 1) * x;
fullWidth = Math.max(fullWidth, fontX);
float fullHeight = barHeight + fontY;
return new Rectangle(fullWidth, fullHeight);
} }
|
public class class_name {
public Rectangle getBarcodeSize() {
float fontX = 0;
float fontY = 0;
String fCode = code;
if (extended)
fCode = getCode39Ex(code);
if (font != null) {
if (baseline > 0)
fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
else
fontY = -baseline + size;
String fullCode = code;
if (generateChecksum && checksumText)
fullCode += getChecksum(fCode);
if (startStopText)
fullCode = "*" + fullCode + "*";
fontX = font.getWidthPoint(altText != null ? altText : fullCode, size); // depends on control dependency: [if], data = [none]
}
int len = fCode.length() + 2;
if (generateChecksum)
++len;
float fullWidth = len * (6 * x + 3 * x * n) + (len - 1) * x;
fullWidth = Math.max(fullWidth, fontX);
float fullHeight = barHeight + fontY;
return new Rectangle(fullWidth, fullHeight);
} }
|
public class class_name {
public synchronized void clear(boolean redraw) {
for (Layer layer : this.layersList) {
layer.unassign();
}
this.layersList.clear();
if (redraw) {
this.redrawer.redrawLayers();
}
} }
|
public class class_name {
public synchronized void clear(boolean redraw) {
for (Layer layer : this.layersList) {
layer.unassign(); // depends on control dependency: [for], data = [layer]
}
this.layersList.clear();
if (redraw) {
this.redrawer.redrawLayers(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void buildBeginTimeIfNeeds(StringBuilder sb) {
final Object beginTime = findBeginTime();
if (beginTime != null) {
sb.append(LF).append(" beginTime: ");
final String beginExp;
if (beginTime instanceof LocalDateTime) { // basically here
beginExp = beginTimeFormatter.format((LocalDateTime) beginTime);
} else { // no way, just in case
beginExp = beginTime.toString();
}
sb.append(beginExp);
}
} }
|
public class class_name {
protected void buildBeginTimeIfNeeds(StringBuilder sb) {
final Object beginTime = findBeginTime();
if (beginTime != null) {
sb.append(LF).append(" beginTime: "); // depends on control dependency: [if], data = [none]
final String beginExp;
if (beginTime instanceof LocalDateTime) { // basically here
beginExp = beginTimeFormatter.format((LocalDateTime) beginTime); // depends on control dependency: [if], data = [none]
} else { // no way, just in case
beginExp = beginTime.toString(); // depends on control dependency: [if], data = [none]
}
sb.append(beginExp); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private List<Integer> getBondNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet) {
List<Integer> btc = new ArrayList<Integer>();
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
if (btc.size() > 0) {
if (!btc.contains(molecule.indexOf(bond))) {
btc.add(molecule.indexOf(bond));
}
} else {
btc.add(molecule.indexOf(bond));
}
}
}
return btc;
} }
|
public class class_name {
private List<Integer> getBondNosForRingGroup(IAtomContainer molecule, List<Integer> ringGroup, IRingSet ringSet) {
List<Integer> btc = new ArrayList<Integer>();
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
if (btc.size() > 0) {
if (!btc.contains(molecule.indexOf(bond))) {
btc.add(molecule.indexOf(bond)); // depends on control dependency: [if], data = [none]
}
} else {
btc.add(molecule.indexOf(bond)); // depends on control dependency: [if], data = [none]
}
}
}
return btc;
} }
|
public class class_name {
public static boolean isFloat(final byte[] qualifier, final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
} else {
return (qualifier[offset + 1] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT;
}
} }
|
public class class_name {
public static boolean isFloat(final byte[] qualifier, final int offset) {
validateQualifier(qualifier, offset);
if ((qualifier[offset] & Const.MS_BYTE_FLAG) == Const.MS_BYTE_FLAG) {
return (qualifier[offset + 3] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT; // depends on control dependency: [if], data = [none]
} else {
return (qualifier[offset + 1] & Const.FLAG_FLOAT) == Const.FLAG_FLOAT; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public <T> HttpAuthServiceBuilder addTokenAuthorizer(
Function<HttpHeaders, T> tokenExtractor, Authorizer<? super T> authorizer) {
requireNonNull(tokenExtractor, "tokenExtractor");
requireNonNull(authorizer, "authorizer");
final Authorizer<HttpRequest> requestAuthorizer = (ctx, req) -> {
final T token = tokenExtractor.apply(req.headers());
if (token == null) {
return CompletableFuture.completedFuture(false);
}
return authorizer.authorize(ctx, token);
};
add(requestAuthorizer);
return this;
} }
|
public class class_name {
public <T> HttpAuthServiceBuilder addTokenAuthorizer(
Function<HttpHeaders, T> tokenExtractor, Authorizer<? super T> authorizer) {
requireNonNull(tokenExtractor, "tokenExtractor");
requireNonNull(authorizer, "authorizer");
final Authorizer<HttpRequest> requestAuthorizer = (ctx, req) -> {
final T token = tokenExtractor.apply(req.headers());
if (token == null) {
return CompletableFuture.completedFuture(false); // depends on control dependency: [if], data = [none]
}
return authorizer.authorize(ctx, token);
};
add(requestAuthorizer);
return this;
} }
|
public class class_name {
static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue;
} else {
T result = record.get(field);
return result != null ? result : defaultValue;
}
} }
|
public class class_name {
static <T> T maybeGet(Record record, TableField<Record, T> field, T defaultValue) {
if (record.fieldsRow().indexOf(field) < 0) {
return defaultValue; // depends on control dependency: [if], data = [none]
} else {
T result = record.get(field);
return result != null ? result : defaultValue; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public JsonEntityBean getRootEntity(String groupType) {
EntityEnum type = EntityEnum.getEntityEnum(groupType);
String rootKey;
if (EntityEnum.GROUP.equals(type)) {
rootKey = "local.0";
} else if (EntityEnum.CATEGORY.equals(type)) {
IEntityGroup categoryGroup =
GroupService.getDistinguishedGroup(IPortletDefinition.DISTINGUISHED_GROUP);
return new JsonEntityBean(categoryGroup, EntityEnum.CATEGORY);
} else {
throw new IllegalArgumentException(
"Unable to determine a root entity for group type '" + groupType + "'");
}
JsonEntityBean bean = getEntity(groupType, rootKey, false);
return bean;
} }
|
public class class_name {
@Override
public JsonEntityBean getRootEntity(String groupType) {
EntityEnum type = EntityEnum.getEntityEnum(groupType);
String rootKey;
if (EntityEnum.GROUP.equals(type)) {
rootKey = "local.0"; // depends on control dependency: [if], data = [none]
} else if (EntityEnum.CATEGORY.equals(type)) {
IEntityGroup categoryGroup =
GroupService.getDistinguishedGroup(IPortletDefinition.DISTINGUISHED_GROUP);
return new JsonEntityBean(categoryGroup, EntityEnum.CATEGORY); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException(
"Unable to determine a root entity for group type '" + groupType + "'");
}
JsonEntityBean bean = getEntity(groupType, rootKey, false);
return bean;
} }
|
public class class_name {
public OutlierResult run(Relation<V> relation) {
final DBIDs ids = relation.getDBIDs();
ArrayList<ArrayDBIDs> subspaceIndex = buildOneDimIndexes(relation);
Set<HiCSSubspace> subspaces = calculateSubspaces(relation, subspaceIndex, rnd.getSingleThreadedRandom());
if(LOG.isVerbose()) {
LOG.verbose("Number of high-contrast subspaces: " + subspaces.size());
}
List<DoubleRelation> results = new ArrayList<>();
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Calculating Outlier scores for high Contrast subspaces", subspaces.size(), LOG) : null;
// run outlier detection and collect the result
// TODO extend so that any outlierAlgorithm can be used (use materialized
// relation instead of SubspaceEuclideanDistanceFunction?)
for(HiCSSubspace dimset : subspaces) {
if(LOG.isVerbose()) {
LOG.verbose("Performing outlier detection in subspace " + dimset);
}
ProxyDatabase pdb = new ProxyDatabase(ids);
pdb.addRelation(new ProjectedView<>(relation, new NumericalFeatureSelection<V>(dimset)));
// run LOF and collect the result
OutlierResult result = outlierAlgorithm.run(pdb);
results.add(result.getScores());
LOG.incrementProcessed(prog);
}
LOG.ensureCompleted(prog);
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
DoubleMinMax minmax = new DoubleMinMax();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
double sum = 0.0;
for(DoubleRelation r : results) {
final double s = r.doubleValue(iditer);
if(!Double.isNaN(s)) {
sum += s;
}
}
scores.putDouble(iditer, sum);
minmax.put(sum);
}
OutlierScoreMeta meta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax());
DoubleRelation scoreres = new MaterializedDoubleRelation("HiCS", "HiCS-outlier", scores, relation.getDBIDs());
return new OutlierResult(meta, scoreres);
} }
|
public class class_name {
public OutlierResult run(Relation<V> relation) {
final DBIDs ids = relation.getDBIDs();
ArrayList<ArrayDBIDs> subspaceIndex = buildOneDimIndexes(relation);
Set<HiCSSubspace> subspaces = calculateSubspaces(relation, subspaceIndex, rnd.getSingleThreadedRandom());
if(LOG.isVerbose()) {
LOG.verbose("Number of high-contrast subspaces: " + subspaces.size()); // depends on control dependency: [if], data = [none]
}
List<DoubleRelation> results = new ArrayList<>();
FiniteProgress prog = LOG.isVerbose() ? new FiniteProgress("Calculating Outlier scores for high Contrast subspaces", subspaces.size(), LOG) : null;
// run outlier detection and collect the result
// TODO extend so that any outlierAlgorithm can be used (use materialized
// relation instead of SubspaceEuclideanDistanceFunction?)
for(HiCSSubspace dimset : subspaces) {
if(LOG.isVerbose()) {
LOG.verbose("Performing outlier detection in subspace " + dimset); // depends on control dependency: [if], data = [none]
}
ProxyDatabase pdb = new ProxyDatabase(ids);
pdb.addRelation(new ProjectedView<>(relation, new NumericalFeatureSelection<V>(dimset))); // depends on control dependency: [for], data = [dimset]
// run LOF and collect the result
OutlierResult result = outlierAlgorithm.run(pdb);
results.add(result.getScores()); // depends on control dependency: [for], data = [none]
LOG.incrementProcessed(prog); // depends on control dependency: [for], data = [none]
}
LOG.ensureCompleted(prog);
WritableDoubleDataStore scores = DataStoreUtil.makeDoubleStorage(relation.getDBIDs(), DataStoreFactory.HINT_STATIC);
DoubleMinMax minmax = new DoubleMinMax();
for(DBIDIter iditer = relation.iterDBIDs(); iditer.valid(); iditer.advance()) {
double sum = 0.0;
for(DoubleRelation r : results) {
final double s = r.doubleValue(iditer);
if(!Double.isNaN(s)) {
sum += s; // depends on control dependency: [if], data = [none]
}
}
scores.putDouble(iditer, sum); // depends on control dependency: [for], data = [iditer]
minmax.put(sum); // depends on control dependency: [for], data = [none]
}
OutlierScoreMeta meta = new BasicOutlierScoreMeta(minmax.getMin(), minmax.getMax());
DoubleRelation scoreres = new MaterializedDoubleRelation("HiCS", "HiCS-outlier", scores, relation.getDBIDs());
return new OutlierResult(meta, scoreres);
} }
|
public class class_name {
@Nonnull
public static <ELEMENTTYPE> String getImplodedMappedNonEmpty (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (sSep, "Separator");
if (aElements != null)
ValueEnforcer.isArrayOfsLen (aElements, nOfs, nLen);
ValueEnforcer.notNull (aMapper, "Mapper");
final StringBuilder aSB = new StringBuilder ();
if (aElements != null)
{
int nElementsAdded = 0;
for (int i = nOfs; i < nOfs + nLen; ++i)
{
final String sElement = aMapper.apply (aElements[i]);
if (hasText (sElement))
{
if (nElementsAdded > 0)
aSB.append (sSep);
nElementsAdded++;
aSB.append (sElement);
}
}
}
return aSB.toString ();
} }
|
public class class_name {
@Nonnull
public static <ELEMENTTYPE> String getImplodedMappedNonEmpty (@Nonnull final String sSep,
@Nullable final ELEMENTTYPE [] aElements,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
@Nonnull final Function <? super ELEMENTTYPE, String> aMapper)
{
ValueEnforcer.notNull (sSep, "Separator");
if (aElements != null)
ValueEnforcer.isArrayOfsLen (aElements, nOfs, nLen);
ValueEnforcer.notNull (aMapper, "Mapper");
final StringBuilder aSB = new StringBuilder ();
if (aElements != null)
{
int nElementsAdded = 0;
for (int i = nOfs; i < nOfs + nLen; ++i)
{
final String sElement = aMapper.apply (aElements[i]);
if (hasText (sElement))
{
if (nElementsAdded > 0)
aSB.append (sSep);
nElementsAdded++; // depends on control dependency: [if], data = [none]
aSB.append (sElement); // depends on control dependency: [if], data = [none]
}
}
}
return aSB.toString ();
} }
|
public class class_name {
protected MClassRef<NType, NClass> getTypeInfo(CClassRef info) {
MClassRef<NType, NClass> classInfo = classRefs.get(info);
if (classInfo == null) {
classInfo = createClassRef(info);
classRefs.put(info, classInfo);
}
return classInfo;
} }
|
public class class_name {
protected MClassRef<NType, NClass> getTypeInfo(CClassRef info) {
MClassRef<NType, NClass> classInfo = classRefs.get(info);
if (classInfo == null) {
classInfo = createClassRef(info); // depends on control dependency: [if], data = [none]
classRefs.put(info, classInfo); // depends on control dependency: [if], data = [none]
}
return classInfo;
} }
|
public class class_name {
public void marshall(BatchGetDeploymentTargetsRequest batchGetDeploymentTargetsRequest, ProtocolMarshaller protocolMarshaller) {
if (batchGetDeploymentTargetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchGetDeploymentTargetsRequest.getDeploymentId(), DEPLOYMENTID_BINDING);
protocolMarshaller.marshall(batchGetDeploymentTargetsRequest.getTargetIds(), TARGETIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(BatchGetDeploymentTargetsRequest batchGetDeploymentTargetsRequest, ProtocolMarshaller protocolMarshaller) {
if (batchGetDeploymentTargetsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(batchGetDeploymentTargetsRequest.getDeploymentId(), DEPLOYMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(batchGetDeploymentTargetsRequest.getTargetIds(), TARGETIDS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@SuppressWarnings("Duplicates")
protected void upgradeEnergiepassElements(Document doc) throws JaxenException {
Map<String, String> fields = new HashMap<>();
fields.put("hwbwert", "user_defined_simplefield[@feldname='epass_hwbwert']");
fields.put("hwbklasse", "user_defined_simplefield[@feldname='epass_hwbklasse']");
fields.put("fgeewert", "user_defined_simplefield[@feldname='epass_fgeewert']");
fields.put("fgeeklasse", "user_defined_simplefield[@feldname='epass_fgeeklasse']");
List nodes = XmlUtils.newXPath(
"/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben",
doc).selectNodes(doc);
for (Object item : nodes) {
Element node = (Element) item;
Element energiepassNode = (Element) XmlUtils.newXPath(
"io:energiepass", doc).selectSingleNode(node);
if (energiepassNode == null) {
energiepassNode = doc.createElementNS(StringUtils.EMPTY, "energiepass");
}
for (Map.Entry<String, String> entry : fields.entrySet()) {
boolean fieldProcessed = false;
List childNodes = XmlUtils.newXPath(entry.getValue(), doc)
.selectNodes(node);
for (Object childItem : childNodes) {
Node childNode = (Node) childItem;
if (!fieldProcessed) {
String value = StringUtils.trimToNull(childNode.getTextContent());
if (value != null) {
Element newElement = doc.createElementNS(StringUtils.EMPTY, entry.getKey());
newElement.setTextContent(value);
energiepassNode.appendChild(newElement);
fieldProcessed = true;
}
}
node.removeChild(childNode);
}
}
if (energiepassNode.getParentNode() == null && energiepassNode.hasChildNodes()) {
node.appendChild(energiepassNode);
}
}
} }
|
public class class_name {
@SuppressWarnings("Duplicates")
protected void upgradeEnergiepassElements(Document doc) throws JaxenException {
Map<String, String> fields = new HashMap<>();
fields.put("hwbwert", "user_defined_simplefield[@feldname='epass_hwbwert']");
fields.put("hwbklasse", "user_defined_simplefield[@feldname='epass_hwbklasse']");
fields.put("fgeewert", "user_defined_simplefield[@feldname='epass_fgeewert']");
fields.put("fgeeklasse", "user_defined_simplefield[@feldname='epass_fgeeklasse']");
List nodes = XmlUtils.newXPath(
"/io:openimmo/io:anbieter/io:immobilie/io:zustand_angaben",
doc).selectNodes(doc);
for (Object item : nodes) {
Element node = (Element) item;
Element energiepassNode = (Element) XmlUtils.newXPath(
"io:energiepass", doc).selectSingleNode(node);
if (energiepassNode == null) {
energiepassNode = doc.createElementNS(StringUtils.EMPTY, "energiepass"); // depends on control dependency: [if], data = [none]
}
for (Map.Entry<String, String> entry : fields.entrySet()) {
boolean fieldProcessed = false;
List childNodes = XmlUtils.newXPath(entry.getValue(), doc)
.selectNodes(node);
for (Object childItem : childNodes) {
Node childNode = (Node) childItem;
if (!fieldProcessed) {
String value = StringUtils.trimToNull(childNode.getTextContent());
if (value != null) {
Element newElement = doc.createElementNS(StringUtils.EMPTY, entry.getKey());
newElement.setTextContent(value); // depends on control dependency: [if], data = [(value]
energiepassNode.appendChild(newElement); // depends on control dependency: [if], data = [none]
fieldProcessed = true; // depends on control dependency: [if], data = [none]
}
}
node.removeChild(childNode); // depends on control dependency: [for], data = [none]
}
}
if (energiepassNode.getParentNode() == null && energiepassNode.hasChildNodes()) {
node.appendChild(energiepassNode); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void setSendDataPoints(java.util.Collection<SendDataPoint> sendDataPoints) {
if (sendDataPoints == null) {
this.sendDataPoints = null;
return;
}
this.sendDataPoints = new com.amazonaws.internal.SdkInternalList<SendDataPoint>(sendDataPoints);
} }
|
public class class_name {
public void setSendDataPoints(java.util.Collection<SendDataPoint> sendDataPoints) {
if (sendDataPoints == null) {
this.sendDataPoints = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.sendDataPoints = new com.amazonaws.internal.SdkInternalList<SendDataPoint>(sendDataPoints);
} }
|
public class class_name {
public static MutableRoaringBitmap priorityqueue_or(
@SuppressWarnings("rawtypes") Iterator bitmaps) {
if (!bitmaps.hasNext()) {
return new MutableRoaringBitmap();
}
// we buffer the call to getLongSizeInBytes(), hence the code complexity
ArrayList<ImmutableRoaringBitmap> buffer = new ArrayList<>();
while (bitmaps.hasNext()) {
buffer.add((ImmutableRoaringBitmap) bitmaps.next());
}
final long[] sizes = new long[buffer.size()];
final boolean[] istmp = new boolean[buffer.size()];
for (int k = 0; k < sizes.length; ++k) {
sizes[k] = buffer.get(k).getLongSizeInBytes();
}
PriorityQueue<Integer> pq = new PriorityQueue<>(128, new Comparator<Integer>() {
@Override
public int compare(Integer a, Integer b) {
return (int)(sizes[a] - sizes[b]);
}
});
for (int k = 0; k < sizes.length; ++k) {
pq.add(k);
}
if (pq.size() == 1) {
return buffer.get(pq.poll()).toMutableRoaringBitmap();
}
while (pq.size() > 1) {
Integer x1 = pq.poll();
Integer x2 = pq.poll();
if (istmp[x1] && istmp[x2]) {
buffer.set(x1, MutableRoaringBitmap.lazyorfromlazyinputs(
(MutableRoaringBitmap) buffer.get(x1), (MutableRoaringBitmap) buffer.get(x2)));
sizes[x1] = buffer.get(x1).getLongSizeInBytes();
pq.add(x1);
} else if (istmp[x2]) {
((MutableRoaringBitmap) buffer.get(x2)).lazyor(buffer.get(x1));
sizes[x2] = buffer.get(x2).getLongSizeInBytes();
pq.add(x2);
} else if (istmp[x1]) {
((MutableRoaringBitmap) buffer.get(x1)).lazyor(buffer.get(x2));
sizes[x1] = buffer.get(x1).getLongSizeInBytes();
pq.add(x1);
} else {
buffer.set(x1, ImmutableRoaringBitmap.lazyor(buffer.get(x1), buffer.get(x2)));
sizes[x1] = buffer.get(x1).getLongSizeInBytes();
istmp[x1] = true;
pq.add(x1);
}
}
MutableRoaringBitmap answer = (MutableRoaringBitmap) buffer.get(pq.poll());
answer.repairAfterLazy();
return answer;
} }
|
public class class_name {
public static MutableRoaringBitmap priorityqueue_or(
@SuppressWarnings("rawtypes") Iterator bitmaps) {
if (!bitmaps.hasNext()) {
return new MutableRoaringBitmap(); // depends on control dependency: [if], data = [none]
}
// we buffer the call to getLongSizeInBytes(), hence the code complexity
ArrayList<ImmutableRoaringBitmap> buffer = new ArrayList<>();
while (bitmaps.hasNext()) {
buffer.add((ImmutableRoaringBitmap) bitmaps.next()); // depends on control dependency: [while], data = [none]
}
final long[] sizes = new long[buffer.size()];
final boolean[] istmp = new boolean[buffer.size()];
for (int k = 0; k < sizes.length; ++k) {
sizes[k] = buffer.get(k).getLongSizeInBytes(); // depends on control dependency: [for], data = [k]
}
PriorityQueue<Integer> pq = new PriorityQueue<>(128, new Comparator<Integer>() {
@Override
public int compare(Integer a, Integer b) {
return (int)(sizes[a] - sizes[b]);
}
});
for (int k = 0; k < sizes.length; ++k) {
pq.add(k); // depends on control dependency: [for], data = [k]
}
if (pq.size() == 1) {
return buffer.get(pq.poll()).toMutableRoaringBitmap(); // depends on control dependency: [if], data = [none]
}
while (pq.size() > 1) {
Integer x1 = pq.poll();
Integer x2 = pq.poll();
if (istmp[x1] && istmp[x2]) {
buffer.set(x1, MutableRoaringBitmap.lazyorfromlazyinputs(
(MutableRoaringBitmap) buffer.get(x1), (MutableRoaringBitmap) buffer.get(x2))); // depends on control dependency: [if], data = [none]
sizes[x1] = buffer.get(x1).getLongSizeInBytes(); // depends on control dependency: [if], data = [none]
pq.add(x1); // depends on control dependency: [if], data = [none]
} else if (istmp[x2]) {
((MutableRoaringBitmap) buffer.get(x2)).lazyor(buffer.get(x1)); // depends on control dependency: [if], data = [none]
sizes[x2] = buffer.get(x2).getLongSizeInBytes(); // depends on control dependency: [if], data = [none]
pq.add(x2); // depends on control dependency: [if], data = [none]
} else if (istmp[x1]) {
((MutableRoaringBitmap) buffer.get(x1)).lazyor(buffer.get(x2)); // depends on control dependency: [if], data = [none]
sizes[x1] = buffer.get(x1).getLongSizeInBytes(); // depends on control dependency: [if], data = [none]
pq.add(x1); // depends on control dependency: [if], data = [none]
} else {
buffer.set(x1, ImmutableRoaringBitmap.lazyor(buffer.get(x1), buffer.get(x2))); // depends on control dependency: [if], data = [none]
sizes[x1] = buffer.get(x1).getLongSizeInBytes(); // depends on control dependency: [if], data = [none]
istmp[x1] = true; // depends on control dependency: [if], data = [none]
pq.add(x1); // depends on control dependency: [if], data = [none]
}
}
MutableRoaringBitmap answer = (MutableRoaringBitmap) buffer.get(pq.poll());
answer.repairAfterLazy();
return answer;
} }
|
public class class_name {
public void setModelMatrix(float[] mat) {
if (mat.length != 16) {
throw new IllegalArgumentException("Size not equal to 16.");
}
getTransform().setModelMatrix(mat);
if (mTransformCache.setModelMatrix(mat)) {
onTransformChanged();
}
} }
|
public class class_name {
public void setModelMatrix(float[] mat) {
if (mat.length != 16) {
throw new IllegalArgumentException("Size not equal to 16.");
}
getTransform().setModelMatrix(mat);
if (mTransformCache.setModelMatrix(mat)) {
onTransformChanged(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void perform(Rewrite event, EvaluationContext context)
{
/*
* Highly optimized loop - for performance reasons. Think before you change this!
*/
List<Rule> rules = config.getRules();
Rule rule = null;
final EvaluationContextImpl subContext = new EvaluationContextImpl();
for (int i = 0; i < rules.size(); i++)
{
rule = rules.get(i);
event.getEvaluatedRules().add(rule);
subContext.clear();
subContext.put(ParameterStore.class, context.get(ParameterStore.class));
ParameterValueStore values = (ParameterValueStore) context.get(ParameterValueStore.class);
subContext.put(ParameterValueStore.class, values);
subContext.setState(RewriteState.EVALUATING);
if (rule.evaluate(event, subContext))
{
if (handleBindings(event, subContext, values))
{
subContext.setState(RewriteState.PERFORMING);
if (log.isDebugEnabled())
log.debug("Rule [" + rule + "] matched and will be performed.");
List<Operation> preOperations = subContext.getPreOperations();
for (int k = 0; k < preOperations.size(); k++) {
preOperations.get(k).perform(event, subContext);
}
if (event.getFlow().isHandled())
{
break;
}
rule.perform(event, subContext);
if (event.getFlow().isHandled())
{
break;
}
List<Operation> postOperations = subContext.getPostOperations();
for (int k = 0; k < postOperations.size(); k++) {
postOperations.get(k).perform(event, subContext);
}
if (event.getFlow().isHandled())
{
break;
}
}
}
else
{
event.getEvaluatedRules().remove(rule);
}
}
} }
|
public class class_name {
@Override
public void perform(Rewrite event, EvaluationContext context)
{
/*
* Highly optimized loop - for performance reasons. Think before you change this!
*/
List<Rule> rules = config.getRules();
Rule rule = null;
final EvaluationContextImpl subContext = new EvaluationContextImpl();
for (int i = 0; i < rules.size(); i++)
{
rule = rules.get(i); // depends on control dependency: [for], data = [i]
event.getEvaluatedRules().add(rule); // depends on control dependency: [for], data = [none]
subContext.clear(); // depends on control dependency: [for], data = [none]
subContext.put(ParameterStore.class, context.get(ParameterStore.class)); // depends on control dependency: [for], data = [none]
ParameterValueStore values = (ParameterValueStore) context.get(ParameterValueStore.class);
subContext.put(ParameterValueStore.class, values); // depends on control dependency: [for], data = [none]
subContext.setState(RewriteState.EVALUATING); // depends on control dependency: [for], data = [none]
if (rule.evaluate(event, subContext))
{
if (handleBindings(event, subContext, values))
{
subContext.setState(RewriteState.PERFORMING); // depends on control dependency: [if], data = [none]
if (log.isDebugEnabled())
log.debug("Rule [" + rule + "] matched and will be performed.");
List<Operation> preOperations = subContext.getPreOperations();
for (int k = 0; k < preOperations.size(); k++) {
preOperations.get(k).perform(event, subContext); // depends on control dependency: [for], data = [k]
}
if (event.getFlow().isHandled())
{
break;
}
rule.perform(event, subContext); // depends on control dependency: [if], data = [none]
if (event.getFlow().isHandled())
{
break;
}
List<Operation> postOperations = subContext.getPostOperations();
for (int k = 0; k < postOperations.size(); k++) {
postOperations.get(k).perform(event, subContext); // depends on control dependency: [for], data = [k]
}
if (event.getFlow().isHandled())
{
break;
}
}
}
else
{
event.getEvaluatedRules().remove(rule); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public long alloc(int chunks, long prevPos, int prevChunks) {
long ret = s.allocReturnCode(chunks);
if (prevPos >= 0)
s.free(prevPos, prevChunks);
if (ret >= 0)
return ret;
while (true) {
s.nextTier();
ret = s.allocReturnCode(chunks);
if (ret >= 0)
return ret;
}
} }
|
public class class_name {
@Override
public long alloc(int chunks, long prevPos, int prevChunks) {
long ret = s.allocReturnCode(chunks);
if (prevPos >= 0)
s.free(prevPos, prevChunks);
if (ret >= 0)
return ret;
while (true) {
s.nextTier(); // depends on control dependency: [while], data = [none]
ret = s.allocReturnCode(chunks); // depends on control dependency: [while], data = [none]
if (ret >= 0)
return ret;
}
} }
|
public class class_name {
@Override
public int rename(String oldPath, String newPath) {
final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath);
final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath);
LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri);
try {
mFileSystem.rename(oldUri, newUri);
synchronized (mOpenFiles) {
if (mOpenFiles.contains(PATH_INDEX, oldPath)) {
OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath);
oe.setPath(newPath);
}
}
} catch (FileDoesNotExistException e) {
LOG.debug("Failed to rename {} to {}, file {} does not exist", oldPath, newPath, oldPath);
return -ErrorCodes.ENOENT();
} catch (FileAlreadyExistsException e) {
LOG.debug("Failed to rename {} to {}, file {} already exists", oldPath, newPath, newPath);
return -ErrorCodes.EEXIST();
} catch (Throwable t) {
LOG.error("Failed to rename {} to {}", oldPath, newPath, t);
return AlluxioFuseUtils.getErrorCode(t);
}
return 0;
} }
|
public class class_name {
@Override
public int rename(String oldPath, String newPath) {
final AlluxioURI oldUri = mPathResolverCache.getUnchecked(oldPath);
final AlluxioURI newUri = mPathResolverCache.getUnchecked(newPath);
LOG.trace("rename({}, {}) [Alluxio: {}, {}]", oldPath, newPath, oldUri, newUri);
try {
mFileSystem.rename(oldUri, newUri); // depends on control dependency: [try], data = [none]
synchronized (mOpenFiles) { // depends on control dependency: [try], data = [none]
if (mOpenFiles.contains(PATH_INDEX, oldPath)) {
OpenFileEntry oe = mOpenFiles.getFirstByField(PATH_INDEX, oldPath);
oe.setPath(newPath); // depends on control dependency: [if], data = [none]
}
}
} catch (FileDoesNotExistException e) {
LOG.debug("Failed to rename {} to {}, file {} does not exist", oldPath, newPath, oldPath);
return -ErrorCodes.ENOENT();
} catch (FileAlreadyExistsException e) { // depends on control dependency: [catch], data = [none]
LOG.debug("Failed to rename {} to {}, file {} already exists", oldPath, newPath, newPath);
return -ErrorCodes.EEXIST();
} catch (Throwable t) { // depends on control dependency: [catch], data = [none]
LOG.error("Failed to rename {} to {}", oldPath, newPath, t);
return AlluxioFuseUtils.getErrorCode(t);
} // depends on control dependency: [catch], data = [none]
return 0;
} }
|
public class class_name {
private void addPropsForPublisher(QueryBasedHiveConversionEntity hiveConversionEntity) {
if (!hiveConversionEntity.getPartition().isPresent()) {
return;
}
ConvertibleHiveDataset convertibleHiveDataset = hiveConversionEntity.getConvertibleHiveDataset();
for (String format : convertibleHiveDataset.getDestFormats()) {
Optional<ConvertibleHiveDataset.ConversionConfig> conversionConfigForFormat =
convertibleHiveDataset.getConversionConfigForFormat(format);
if (!conversionConfigForFormat.isPresent()) {
continue;
}
SchemaAwareHivePartition sourcePartition = hiveConversionEntity.getHivePartition().get();
// Get complete source partition name dbName@tableName@partitionName
String completeSourcePartitionName = StringUtils.join(Arrays
.asList(sourcePartition.getTable().getDbName(), sourcePartition.getTable().getTableName(),
sourcePartition.getName()), AT_CHAR);
ConvertibleHiveDataset.ConversionConfig config = conversionConfigForFormat.get();
// Get complete destination partition name dbName@tableName@partitionName
String completeDestPartitionName = StringUtils.join(
Arrays.asList(config.getDestinationDbName(), config.getDestinationTableName(), sourcePartition.getName()),
AT_CHAR);
workUnit.setProp(HiveConvertPublisher.COMPLETE_SOURCE_PARTITION_NAME, completeSourcePartitionName);
workUnit.setProp(HiveConvertPublisher.COMPLETE_DEST_PARTITION_NAME, completeDestPartitionName);
}
} }
|
public class class_name {
private void addPropsForPublisher(QueryBasedHiveConversionEntity hiveConversionEntity) {
if (!hiveConversionEntity.getPartition().isPresent()) {
return; // depends on control dependency: [if], data = [none]
}
ConvertibleHiveDataset convertibleHiveDataset = hiveConversionEntity.getConvertibleHiveDataset();
for (String format : convertibleHiveDataset.getDestFormats()) {
Optional<ConvertibleHiveDataset.ConversionConfig> conversionConfigForFormat =
convertibleHiveDataset.getConversionConfigForFormat(format);
if (!conversionConfigForFormat.isPresent()) {
continue;
}
SchemaAwareHivePartition sourcePartition = hiveConversionEntity.getHivePartition().get();
// Get complete source partition name dbName@tableName@partitionName
String completeSourcePartitionName = StringUtils.join(Arrays
.asList(sourcePartition.getTable().getDbName(), sourcePartition.getTable().getTableName(),
sourcePartition.getName()), AT_CHAR);
ConvertibleHiveDataset.ConversionConfig config = conversionConfigForFormat.get();
// Get complete destination partition name dbName@tableName@partitionName
String completeDestPartitionName = StringUtils.join(
Arrays.asList(config.getDestinationDbName(), config.getDestinationTableName(), sourcePartition.getName()),
AT_CHAR);
workUnit.setProp(HiveConvertPublisher.COMPLETE_SOURCE_PARTITION_NAME, completeSourcePartitionName); // depends on control dependency: [for], data = [none]
workUnit.setProp(HiveConvertPublisher.COMPLETE_DEST_PARTITION_NAME, completeDestPartitionName); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private long put(K key, long value, boolean ifNew)
{
if (key == null) {
long old = _nullValue;
_nullValue = value;
return old;
}
int hash = key.hashCode() & _mask;
while (true) {
K testKey = _keys[hash];
if (testKey == null || (_flags[hash] & DELETED) != 0) {
_keys[hash] = key;
_values[hash] = value;
_flags[hash] = 0;
_size++;
if (_keys.length <= 2 * _size)
resize(2 * _keys.length);
return NULL;
}
else if (key != testKey && ! testKey.equals(key)) {
hash = (hash + 1) & _mask;
continue;
}
else if (ifNew) {
return _values[hash];
}
else {
long old = _values[hash];
_values[hash] = value;
return old;
}
}
} }
|
public class class_name {
private long put(K key, long value, boolean ifNew)
{
if (key == null) {
long old = _nullValue;
_nullValue = value; // depends on control dependency: [if], data = [none]
return old; // depends on control dependency: [if], data = [none]
}
int hash = key.hashCode() & _mask;
while (true) {
K testKey = _keys[hash];
if (testKey == null || (_flags[hash] & DELETED) != 0) {
_keys[hash] = key; // depends on control dependency: [if], data = [none]
_values[hash] = value; // depends on control dependency: [if], data = [none]
_flags[hash] = 0; // depends on control dependency: [if], data = [none]
_size++; // depends on control dependency: [if], data = [none]
if (_keys.length <= 2 * _size)
resize(2 * _keys.length);
return NULL; // depends on control dependency: [if], data = [none]
}
else if (key != testKey && ! testKey.equals(key)) {
hash = (hash + 1) & _mask; // depends on control dependency: [if], data = [none]
continue;
}
else if (ifNew) {
return _values[hash]; // depends on control dependency: [if], data = [none]
}
else {
long old = _values[hash];
_values[hash] = value; // depends on control dependency: [if], data = [none]
return old; // depends on control dependency: [if], data = [none]
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.