code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static double[][] transposeTimes(final double[] v1, final double[][] m2) {
assert m2.length == v1.length : ERR_MATRIX_INNERDIM;
final int columndimension = m2[0].length;
final double[][] re = new double[1][columndimension];
for(int j = 0; j < columndimension; j++) {
double s = 0;
for(int k = 0; k < v1.length; k++) {
s += v1[k] * m2[k][j];
}
re[0][j] = s;
}
return re;
} } | public class class_name {
public static double[][] transposeTimes(final double[] v1, final double[][] m2) {
assert m2.length == v1.length : ERR_MATRIX_INNERDIM;
final int columndimension = m2[0].length;
final double[][] re = new double[1][columndimension];
for(int j = 0; j < columndimension; j++) {
double s = 0;
for(int k = 0; k < v1.length; k++) {
s += v1[k] * m2[k][j]; // depends on control dependency: [for], data = [k]
}
re[0][j] = s; // depends on control dependency: [for], data = [j]
}
return re;
} } |
public class class_name {
public JsonNode toJson(Object object) throws IOException {
if (object instanceof SBase) {
SBase base = (SBase) object;
ObjectNode jsonObject = OBJECT_MAPPER.createObjectNode();
jsonObject.put("__type", base.getSClass().getSimpleName());
for (SField field : base.getSClass().getAllFields()) {
jsonObject.set(field.getName(), toJson(base.sGet(field)));
}
return jsonObject;
} else if (object instanceof Collection) {
Collection<?> collection = (Collection<?>) object;
ArrayNode jsonArray = OBJECT_MAPPER.createArrayNode();
for (Object value : collection) {
jsonArray.add(toJson(value));
}
return jsonArray;
} else if (object instanceof Date) {
return new LongNode(((Date) object).getTime());
} else if (object instanceof DataHandler) {
DataHandler dataHandler = (DataHandler) object;
InputStream inputStream = dataHandler.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(inputStream, out);
return new TextNode(new String(Base64.encodeBase64(out.toByteArray()), Charsets.UTF_8));
} else if (object instanceof Boolean) {
return BooleanNode.valueOf((Boolean) object);
} else if (object instanceof String) {
return new TextNode((String) object);
} else if (object instanceof Long) {
return new LongNode((Long) object);
} else if (object instanceof Integer) {
return new IntNode((Integer) object);
} else if (object instanceof Double) {
return new DoubleNode((Double) object);
} else if (object instanceof Float) {
return new FloatNode((Float) object);
} else if (object instanceof Enum) {
return new TextNode(object.toString());
} else if (object == null) {
return NullNode.getInstance();
} else if (object instanceof byte[]) {
byte[] data = (byte[]) object;
return new TextNode(new String(Base64.encodeBase64(data), Charsets.UTF_8));
}
throw new UnsupportedOperationException(object.getClass().getName());
} } | public class class_name {
public JsonNode toJson(Object object) throws IOException {
if (object instanceof SBase) {
SBase base = (SBase) object;
ObjectNode jsonObject = OBJECT_MAPPER.createObjectNode();
jsonObject.put("__type", base.getSClass().getSimpleName());
for (SField field : base.getSClass().getAllFields()) {
jsonObject.set(field.getName(), toJson(base.sGet(field))); // depends on control dependency: [for], data = [field]
}
return jsonObject;
} else if (object instanceof Collection) {
Collection<?> collection = (Collection<?>) object;
ArrayNode jsonArray = OBJECT_MAPPER.createArrayNode();
for (Object value : collection) {
jsonArray.add(toJson(value)); // depends on control dependency: [for], data = [value]
}
return jsonArray;
} else if (object instanceof Date) {
return new LongNode(((Date) object).getTime());
} else if (object instanceof DataHandler) {
DataHandler dataHandler = (DataHandler) object;
InputStream inputStream = dataHandler.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(inputStream, out);
return new TextNode(new String(Base64.encodeBase64(out.toByteArray()), Charsets.UTF_8));
} else if (object instanceof Boolean) {
return BooleanNode.valueOf((Boolean) object);
} else if (object instanceof String) {
return new TextNode((String) object);
} else if (object instanceof Long) {
return new LongNode((Long) object);
} else if (object instanceof Integer) {
return new IntNode((Integer) object);
} else if (object instanceof Double) {
return new DoubleNode((Double) object);
} else if (object instanceof Float) {
return new FloatNode((Float) object);
} else if (object instanceof Enum) {
return new TextNode(object.toString());
} else if (object == null) {
return NullNode.getInstance();
} else if (object instanceof byte[]) {
byte[] data = (byte[]) object;
return new TextNode(new String(Base64.encodeBase64(data), Charsets.UTF_8));
}
throw new UnsupportedOperationException(object.getClass().getName());
} } |
public class class_name {
public ActionExecute findActionExecute(String paramPath) { // null allowed when not found
for (ActionExecute execute : executeMap.values()) {
if (execute.determineTargetByPathParameter(paramPath)) {
return execute;
}
}
return null;
} } | public class class_name {
public ActionExecute findActionExecute(String paramPath) { // null allowed when not found
for (ActionExecute execute : executeMap.values()) {
if (execute.determineTargetByPathParameter(paramPath)) {
return execute; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void addChildren( AstNode first,
AstNode second,
AstNode third ) {
if (first != null) {
this.addLastChild(first);
}
if (second != null) {
this.addLastChild(second);
}
if (third != null) {
this.addLastChild(third);
}
} } | public class class_name {
public void addChildren( AstNode first,
AstNode second,
AstNode third ) {
if (first != null) {
this.addLastChild(first); // depends on control dependency: [if], data = [(first]
}
if (second != null) {
this.addLastChild(second); // depends on control dependency: [if], data = [(second]
}
if (third != null) {
this.addLastChild(third); // depends on control dependency: [if], data = [(third]
}
} } |
public class class_name {
public static List<Future> getAllDone(Collection<Future> futures) {
List<Future> doneFutures = new ArrayList<Future>();
for (Future f : futures) {
if (f.isDone()) {
doneFutures.add(f);
}
}
return doneFutures;
} } | public class class_name {
public static List<Future> getAllDone(Collection<Future> futures) {
List<Future> doneFutures = new ArrayList<Future>();
for (Future f : futures) {
if (f.isDone()) {
doneFutures.add(f); // depends on control dependency: [if], data = [none]
}
}
return doneFutures;
} } |
public class class_name {
public static base_responses delete(nitro_service client, String kcdaccount[]) throws Exception {
base_responses result = null;
if (kcdaccount != null && kcdaccount.length > 0) {
aaakcdaccount deleteresources[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++){
deleteresources[i] = new aaakcdaccount();
deleteresources[i].kcdaccount = kcdaccount[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } | public class class_name {
public static base_responses delete(nitro_service client, String kcdaccount[]) throws Exception {
base_responses result = null;
if (kcdaccount != null && kcdaccount.length > 0) {
aaakcdaccount deleteresources[] = new aaakcdaccount[kcdaccount.length];
for (int i=0;i<kcdaccount.length;i++){
deleteresources[i] = new aaakcdaccount(); // depends on control dependency: [for], data = [i]
deleteresources[i].kcdaccount = kcdaccount[i]; // depends on control dependency: [for], data = [i]
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } |
public class class_name {
private static EntityPatcher<BuildConfig> bcPatcher() {
return (KubernetesClient client, String namespace, BuildConfig newObj, BuildConfig oldObj) -> {
if (UserConfigurationCompare.configEqual(newObj, oldObj)) {
return oldObj;
}
OpenShiftClient openShiftClient = OpenshiftHelper.asOpenShiftClient(client);
if (openShiftClient == null) {
throw new IllegalArgumentException("BuildConfig can only be patched when connected to an OpenShift cluster");
}
DoneableBuildConfig entity =
openShiftClient.buildConfigs()
.inNamespace(namespace)
.withName(oldObj.getMetadata().getName())
.edit();
if (!UserConfigurationCompare.configEqual(newObj.getMetadata(), oldObj.getMetadata())) {
entity.withMetadata(newObj.getMetadata());
}
if(!UserConfigurationCompare.configEqual(newObj.getSpec(), oldObj.getSpec())) {
entity.withSpec(newObj.getSpec());
}
return entity.done();
};
} } | public class class_name {
private static EntityPatcher<BuildConfig> bcPatcher() {
return (KubernetesClient client, String namespace, BuildConfig newObj, BuildConfig oldObj) -> {
if (UserConfigurationCompare.configEqual(newObj, oldObj)) {
return oldObj;
}
OpenShiftClient openShiftClient = OpenshiftHelper.asOpenShiftClient(client);
if (openShiftClient == null) {
throw new IllegalArgumentException("BuildConfig can only be patched when connected to an OpenShift cluster");
}
DoneableBuildConfig entity =
openShiftClient.buildConfigs()
.inNamespace(namespace)
.withName(oldObj.getMetadata().getName())
.edit();
if (!UserConfigurationCompare.configEqual(newObj.getMetadata(), oldObj.getMetadata())) {
entity.withMetadata(newObj.getMetadata()); // depends on control dependency: [if], data = [none]
}
if(!UserConfigurationCompare.configEqual(newObj.getSpec(), oldObj.getSpec())) {
entity.withSpec(newObj.getSpec()); // depends on control dependency: [if], data = [none]
}
return entity.done();
};
} } |
public class class_name {
public EList<JvmTypeReference> getParamTypes()
{
if (paramTypes == null)
{
paramTypes = new EObjectContainmentEList<JvmTypeReference>(JvmTypeReference.class, this, XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES);
}
return paramTypes;
} } | public class class_name {
public EList<JvmTypeReference> getParamTypes()
{
if (paramTypes == null)
{
paramTypes = new EObjectContainmentEList<JvmTypeReference>(JvmTypeReference.class, this, XtypePackage.XFUNCTION_TYPE_REF__PARAM_TYPES); // depends on control dependency: [if], data = [none]
}
return paramTypes;
} } |
public class class_name {
public void marshall(BackupPlansListMember backupPlansListMember, ProtocolMarshaller protocolMarshaller) {
if (backupPlansListMember == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanArn(), BACKUPPLANARN_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanId(), BACKUPPLANID_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getDeletionDate(), DELETIONDATE_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getVersionId(), VERSIONID_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanName(), BACKUPPLANNAME_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getCreatorRequestId(), CREATORREQUESTID_BINDING);
protocolMarshaller.marshall(backupPlansListMember.getLastExecutionDate(), LASTEXECUTIONDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(BackupPlansListMember backupPlansListMember, ProtocolMarshaller protocolMarshaller) {
if (backupPlansListMember == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanArn(), BACKUPPLANARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanId(), BACKUPPLANID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getCreationDate(), CREATIONDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getDeletionDate(), DELETIONDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getVersionId(), VERSIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getBackupPlanName(), BACKUPPLANNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getCreatorRequestId(), CREATORREQUESTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(backupPlansListMember.getLastExecutionDate(), LASTEXECUTIONDATE_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 marshall(GetSizeConstraintSetRequest getSizeConstraintSetRequest, ProtocolMarshaller protocolMarshaller) {
if (getSizeConstraintSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSizeConstraintSetRequest.getSizeConstraintSetId(), SIZECONSTRAINTSETID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetSizeConstraintSetRequest getSizeConstraintSetRequest, ProtocolMarshaller protocolMarshaller) {
if (getSizeConstraintSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSizeConstraintSetRequest.getSizeConstraintSetId(), SIZECONSTRAINTSETID_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 gotoFreshPosWritable0(int oldIndex, int newIndex, int xor) { // goto block start pos
//noinspection StatementWithEmptyBody
if (xor < (1 << 5)) { // level = 0
} else if (xor < (1 << 10)) { // level = 1
if (depth == 1) {
display1 = new Object[32];
display1[(oldIndex >> 5) & 31] = display0;
depth += 1;
}
display0 = new Object[32];
} else if (xor < (1 << 15)) { // level = 2
if (depth == 2) {
display2 = new Object[32];
display2[(oldIndex >> 10) & 31] = display1;
depth += 1;
}
display1 = (Object[]) display2[(newIndex >> 10) & 31];
if (display1 == null) display1 = new Object[32];
display0 = new Object[32];
} else if (xor < (1 << 20)) { // level = 3
if (depth == 3) {
display3 = new Object[32];
display3[(oldIndex >> 15) & 31] = display2;
display2 = new Object[32];
display1 = new Object[32];
depth += 1;
}
display2 = (Object[]) display3[(newIndex >> 15) & 31];
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31];
if (display1 == null) display1 = new Object[32];
display0 = new Object[32];
} else if (xor < (1 << 25)) { // level = 4
if (depth == 4) {
display4 = new Object[32];
display4[(oldIndex >> 20) & 31] = display3;
display3 = new Object[32];
display2 = new Object[32];
display1 = new Object[32];
depth += 1;
}
display3 = (Object[]) display4[(newIndex >> 20) & 31];
if (display3 == null) display3 = new Object[32];
display2 = (Object[]) display3[(newIndex >> 15) & 31];
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31];
if (display1 == null) display1 = new Object[32];
display0 = new Object[32];
} else if (xor < (1 << 30)) { // level = 5
if (depth == 5) {
display5 = new Object[32];
display5[(oldIndex >> 25) & 31] = display4;
display4 = new Object[32];
display3 = new Object[32];
display2 = new Object[32];
display1 = new Object[32];
depth += 1;
}
display4 = (Object[]) display5[(newIndex >> 25) & 31];
if (display4 == null) display4 = new Object[32];
display3 = (Object[]) display4[(newIndex >> 20) & 31];
if (display3 == null) display3 = new Object[32];
display2 = (Object[]) display3[(newIndex >> 15) & 31];
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31];
if (display1 == null) display1 = new Object[32];
display0 = new Object[32];
} else { // level = 6
throw new IllegalArgumentException();
}
} } | public class class_name {
public void gotoFreshPosWritable0(int oldIndex, int newIndex, int xor) { // goto block start pos
//noinspection StatementWithEmptyBody
if (xor < (1 << 5)) { // level = 0
} else if (xor < (1 << 10)) { // level = 1
if (depth == 1) {
display1 = new Object[32]; // depends on control dependency: [if], data = [none]
display1[(oldIndex >> 5) & 31] = display0; // depends on control dependency: [if], data = [none]
depth += 1; // depends on control dependency: [if], data = [none]
}
display0 = new Object[32]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 15)) { // level = 2
if (depth == 2) {
display2 = new Object[32]; // depends on control dependency: [if], data = [none]
display2[(oldIndex >> 10) & 31] = display1; // depends on control dependency: [if], data = [none]
depth += 1; // depends on control dependency: [if], data = [none]
}
display1 = (Object[]) display2[(newIndex >> 10) & 31]; // depends on control dependency: [if], data = [none]
if (display1 == null) display1 = new Object[32];
display0 = new Object[32]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 20)) { // level = 3
if (depth == 3) {
display3 = new Object[32]; // depends on control dependency: [if], data = [none]
display3[(oldIndex >> 15) & 31] = display2; // depends on control dependency: [if], data = [none]
display2 = new Object[32]; // depends on control dependency: [if], data = [none]
display1 = new Object[32]; // depends on control dependency: [if], data = [none]
depth += 1; // depends on control dependency: [if], data = [none]
}
display2 = (Object[]) display3[(newIndex >> 15) & 31]; // depends on control dependency: [if], data = [none]
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31]; // depends on control dependency: [if], data = [none]
if (display1 == null) display1 = new Object[32];
display0 = new Object[32]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 25)) { // level = 4
if (depth == 4) {
display4 = new Object[32]; // depends on control dependency: [if], data = [none]
display4[(oldIndex >> 20) & 31] = display3; // depends on control dependency: [if], data = [none]
display3 = new Object[32]; // depends on control dependency: [if], data = [none]
display2 = new Object[32]; // depends on control dependency: [if], data = [none]
display1 = new Object[32]; // depends on control dependency: [if], data = [none]
depth += 1; // depends on control dependency: [if], data = [none]
}
display3 = (Object[]) display4[(newIndex >> 20) & 31]; // depends on control dependency: [if], data = [none]
if (display3 == null) display3 = new Object[32];
display2 = (Object[]) display3[(newIndex >> 15) & 31]; // depends on control dependency: [if], data = [none]
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31]; // depends on control dependency: [if], data = [none]
if (display1 == null) display1 = new Object[32];
display0 = new Object[32]; // depends on control dependency: [if], data = [none]
} else if (xor < (1 << 30)) { // level = 5
if (depth == 5) {
display5 = new Object[32]; // depends on control dependency: [if], data = [none]
display5[(oldIndex >> 25) & 31] = display4; // depends on control dependency: [if], data = [5)]
display4 = new Object[32]; // depends on control dependency: [if], data = [none]
display3 = new Object[32]; // depends on control dependency: [if], data = [none]
display2 = new Object[32]; // depends on control dependency: [if], data = [none]
display1 = new Object[32]; // depends on control dependency: [if], data = [none]
depth += 1; // depends on control dependency: [if], data = [none]
}
display4 = (Object[]) display5[(newIndex >> 25) & 31]; // depends on control dependency: [if], data = [none]
if (display4 == null) display4 = new Object[32];
display3 = (Object[]) display4[(newIndex >> 20) & 31]; // depends on control dependency: [if], data = [none]
if (display3 == null) display3 = new Object[32];
display2 = (Object[]) display3[(newIndex >> 15) & 31]; // depends on control dependency: [if], data = [none]
if (display2 == null) display2 = new Object[32];
display1 = (Object[]) display2[(newIndex >> 10) & 31]; // depends on control dependency: [if], data = [none]
if (display1 == null) display1 = new Object[32];
display0 = new Object[32]; // depends on control dependency: [if], data = [none]
} else { // level = 6
throw new IllegalArgumentException();
}
} } |
public class class_name {
protected void associateBatched(Collection owners, Collection children)
{
CollectionDescriptor cds = getCollectionDescriptor();
PersistentField field = cds.getPersistentField();
PersistenceBroker pb = getBroker();
Class ownerTopLevelClass = pb.getTopLevelClass(getOwnerClassDescriptor().getClassOfObject());
Class collectionClass = cds.getCollectionClass(); // this collection type will be used:
HashMap ownerIdsToLists = new HashMap(owners.size());
IdentityFactory identityFactory = pb.serviceIdentity();
// initialize the owner list map
for (Iterator it = owners.iterator(); it.hasNext();)
{
Object owner = it.next();
ownerIdsToLists.put(identityFactory.buildIdentity(getOwnerClassDescriptor(), owner), new ArrayList());
}
// build the children lists for the owners
for (Iterator it = children.iterator(); it.hasNext();)
{
Object child = it.next();
// BRJ: use cld for real class, relatedObject could be Proxy
ClassDescriptor cld = getDescriptorRepository().getDescriptorFor(ProxyHelper.getRealClass(child));
Object[] fkValues = cds.getForeignKeyValues(child, cld);
Identity ownerId = identityFactory.buildIdentity(null, ownerTopLevelClass, fkValues);
List list = (List) ownerIdsToLists.get(ownerId);
if (list != null)
{
list.add(child);
}
}
// connect children list to owners
for (Iterator it = owners.iterator(); it.hasNext();)
{
Object result;
Object owner = it.next();
Identity ownerId = identityFactory.buildIdentity(owner);
List list = (List) ownerIdsToLists.get(ownerId);
if ((collectionClass == null) && field.getType().isArray())
{
int length = list.size();
Class itemtype = field.getType().getComponentType();
result = Array.newInstance(itemtype, length);
for (int j = 0; j < length; j++)
{
Array.set(result, j, list.get(j));
}
}
else
{
ManageableCollection col = createCollection(cds, collectionClass);
for (Iterator it2 = list.iterator(); it2.hasNext();)
{
col.ojbAdd(it2.next());
}
result = col;
}
Object value = field.get(owner);
if ((value instanceof CollectionProxyDefaultImpl) && (result instanceof Collection))
{
((CollectionProxyDefaultImpl) value).setData((Collection) result);
}
else
{
field.set(owner, result);
}
}
} } | public class class_name {
protected void associateBatched(Collection owners, Collection children)
{
CollectionDescriptor cds = getCollectionDescriptor();
PersistentField field = cds.getPersistentField();
PersistenceBroker pb = getBroker();
Class ownerTopLevelClass = pb.getTopLevelClass(getOwnerClassDescriptor().getClassOfObject());
Class collectionClass = cds.getCollectionClass(); // this collection type will be used:
HashMap ownerIdsToLists = new HashMap(owners.size());
IdentityFactory identityFactory = pb.serviceIdentity();
// initialize the owner list map
for (Iterator it = owners.iterator(); it.hasNext();)
{
Object owner = it.next();
ownerIdsToLists.put(identityFactory.buildIdentity(getOwnerClassDescriptor(), owner), new ArrayList());
// depends on control dependency: [for], data = [none]
}
// build the children lists for the owners
for (Iterator it = children.iterator(); it.hasNext();)
{
Object child = it.next();
// BRJ: use cld for real class, relatedObject could be Proxy
ClassDescriptor cld = getDescriptorRepository().getDescriptorFor(ProxyHelper.getRealClass(child));
Object[] fkValues = cds.getForeignKeyValues(child, cld);
Identity ownerId = identityFactory.buildIdentity(null, ownerTopLevelClass, fkValues);
List list = (List) ownerIdsToLists.get(ownerId);
if (list != null)
{
list.add(child);
// depends on control dependency: [if], data = [none]
}
}
// connect children list to owners
for (Iterator it = owners.iterator(); it.hasNext();)
{
Object result;
Object owner = it.next();
Identity ownerId = identityFactory.buildIdentity(owner);
List list = (List) ownerIdsToLists.get(ownerId);
if ((collectionClass == null) && field.getType().isArray())
{
int length = list.size();
Class itemtype = field.getType().getComponentType();
result = Array.newInstance(itemtype, length);
for (int j = 0; j < length; j++)
{
Array.set(result, j, list.get(j));
// depends on control dependency: [for], data = [j]
}
}
else
{
ManageableCollection col = createCollection(cds, collectionClass);
for (Iterator it2 = list.iterator(); it2.hasNext();)
{
col.ojbAdd(it2.next());
// depends on control dependency: [for], data = [it2]
}
result = col;
// depends on control dependency: [if], data = [none]
}
Object value = field.get(owner);
if ((value instanceof CollectionProxyDefaultImpl) && (result instanceof Collection))
{
((CollectionProxyDefaultImpl) value).setData((Collection) result);
// depends on control dependency: [if], data = [none]
}
else
{
field.set(owner, result);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public void onFailure(Response response, Throwable t, JSONObject extendedInfo) {
if (isAuthorizationRequired(response)) {
processResponseWrapper(response, true);
} else {
listener.onFailure(response, t, extendedInfo);
}
} } | public class class_name {
@Override
public void onFailure(Response response, Throwable t, JSONObject extendedInfo) {
if (isAuthorizationRequired(response)) {
processResponseWrapper(response, true); // depends on control dependency: [if], data = [none]
} else {
listener.onFailure(response, t, extendedInfo); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public IoBuffer fill(byte value, int size) {
autoExpand(size);
int q = size >>> 3;
int r = size & 7;
if (q > 0) {
int intValue = value | value << 8 | value << 16 | value << 24;
long longValue = intValue;
longValue <<= 32;
longValue |= intValue;
for (int i = q; i > 0; i--) {
putLong(longValue);
}
}
q = r >>> 2;
r = r & 3;
if (q > 0) {
int intValue = value | value << 8 | value << 16 | value << 24;
putInt(intValue);
}
q = r >> 1;
r = r & 1;
if (q > 0) {
short shortValue = (short) (value | value << 8);
putShort(shortValue);
}
if (r > 0) {
put(value);
}
return this;
} } | public class class_name {
@Override
public IoBuffer fill(byte value, int size) {
autoExpand(size);
int q = size >>> 3;
int r = size & 7;
if (q > 0) {
int intValue = value | value << 8 | value << 16 | value << 24;
long longValue = intValue;
longValue <<= 32; // depends on control dependency: [if], data = [none]
longValue |= intValue; // depends on control dependency: [if], data = [none]
for (int i = q; i > 0; i--) {
putLong(longValue); // depends on control dependency: [for], data = [none]
}
}
q = r >>> 2;
r = r & 3;
if (q > 0) {
int intValue = value | value << 8 | value << 16 | value << 24;
putInt(intValue); // depends on control dependency: [if], data = [none]
}
q = r >> 1;
r = r & 1;
if (q > 0) {
short shortValue = (short) (value | value << 8);
putShort(shortValue); // depends on control dependency: [if], data = [none]
}
if (r > 0) {
put(value); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
public UpdateUserPoolRequest withAutoVerifiedAttributes(String... autoVerifiedAttributes) {
if (this.autoVerifiedAttributes == null) {
setAutoVerifiedAttributes(new java.util.ArrayList<String>(autoVerifiedAttributes.length));
}
for (String ele : autoVerifiedAttributes) {
this.autoVerifiedAttributes.add(ele);
}
return this;
} } | public class class_name {
public UpdateUserPoolRequest withAutoVerifiedAttributes(String... autoVerifiedAttributes) {
if (this.autoVerifiedAttributes == null) {
setAutoVerifiedAttributes(new java.util.ArrayList<String>(autoVerifiedAttributes.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : autoVerifiedAttributes) {
this.autoVerifiedAttributes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private void initializeModuleScope(Node moduleBody, Module module, TypedScope moduleScope) {
if (module.metadata().isGoogModule()) {
declareExportsInModuleScope(module, moduleBody, moduleScope);
markGoogModuleExportsAsConst(module);
}
} } | public class class_name {
private void initializeModuleScope(Node moduleBody, Module module, TypedScope moduleScope) {
if (module.metadata().isGoogModule()) {
declareExportsInModuleScope(module, moduleBody, moduleScope); // depends on control dependency: [if], data = [none]
markGoogModuleExportsAsConst(module); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (createdBy != null) {
addFieldToSource(sourceMap, "createdBy", createdBy);
}
if (createdTime != null) {
addFieldToSource(sourceMap, "createdTime", createdTime);
}
if (excludedPaths != null) {
addFieldToSource(sourceMap, "excludedPaths", excludedPaths);
}
if (includedPaths != null) {
addFieldToSource(sourceMap, "includedPaths", includedPaths);
}
if (name != null) {
addFieldToSource(sourceMap, "name", name);
}
if (permissions != null) {
addFieldToSource(sourceMap, "permissions", permissions);
}
if (sortOrder != null) {
addFieldToSource(sourceMap, "sortOrder", sortOrder);
}
if (updatedBy != null) {
addFieldToSource(sourceMap, "updatedBy", updatedBy);
}
if (updatedTime != null) {
addFieldToSource(sourceMap, "updatedTime", updatedTime);
}
if (value != null) {
addFieldToSource(sourceMap, "value", value);
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost);
}
return sourceMap;
} } | public class class_name {
@Override
public Map<String, Object> toSource() {
Map<String, Object> sourceMap = new HashMap<>();
if (createdBy != null) {
addFieldToSource(sourceMap, "createdBy", createdBy); // depends on control dependency: [if], data = [none]
}
if (createdTime != null) {
addFieldToSource(sourceMap, "createdTime", createdTime); // depends on control dependency: [if], data = [none]
}
if (excludedPaths != null) {
addFieldToSource(sourceMap, "excludedPaths", excludedPaths); // depends on control dependency: [if], data = [none]
}
if (includedPaths != null) {
addFieldToSource(sourceMap, "includedPaths", includedPaths); // depends on control dependency: [if], data = [none]
}
if (name != null) {
addFieldToSource(sourceMap, "name", name); // depends on control dependency: [if], data = [none]
}
if (permissions != null) {
addFieldToSource(sourceMap, "permissions", permissions); // depends on control dependency: [if], data = [none]
}
if (sortOrder != null) {
addFieldToSource(sourceMap, "sortOrder", sortOrder); // depends on control dependency: [if], data = [none]
}
if (updatedBy != null) {
addFieldToSource(sourceMap, "updatedBy", updatedBy); // depends on control dependency: [if], data = [none]
}
if (updatedTime != null) {
addFieldToSource(sourceMap, "updatedTime", updatedTime); // depends on control dependency: [if], data = [none]
}
if (value != null) {
addFieldToSource(sourceMap, "value", value); // depends on control dependency: [if], data = [none]
}
if (virtualHost != null) {
addFieldToSource(sourceMap, "virtualHost", virtualHost); // depends on control dependency: [if], data = [none]
}
return sourceMap;
} } |
public class class_name {
public static void addGroupsToStructure(Structure s, Collection<Group> groups, int model, boolean clone) {
Chain chainGuess = null;
for(Group g : groups) {
chainGuess = addGroupToStructure(s, g, model, chainGuess, clone);
}
} } | public class class_name {
public static void addGroupsToStructure(Structure s, Collection<Group> groups, int model, boolean clone) {
Chain chainGuess = null;
for(Group g : groups) {
chainGuess = addGroupToStructure(s, g, model, chainGuess, clone); // depends on control dependency: [for], data = [g]
}
} } |
public class class_name {
public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
ConcurrentHashMap<String, BaseMethodBinding<?>> map = getMapForOperation(operationType);
if(map == null || !map.containsKey(bindingKey)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
return map.get(bindingKey);
}
} } | public class class_name {
public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
ConcurrentHashMap<String, BaseMethodBinding<?>> map = getMapForOperation(operationType);
if(map == null || !map.containsKey(bindingKey)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
return map.get(bindingKey); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String getAttributeBodyType(Node n, String name) {
if (n instanceof Node.CustomTag) {
TagInfo tagInfo = ((Node.CustomTag)n).getTagInfo();
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
for (int i=0; i<tldAttrs.length; i++) {
if (name.equals(tldAttrs[i].getName())) {
if (tldAttrs[i].isFragment()) {
return TagInfo.BODY_CONTENT_SCRIPTLESS;
}
if (tldAttrs[i].canBeRequestTime()) {
return TagInfo.BODY_CONTENT_JSP;
}
}
}
if (tagInfo.hasDynamicAttributes()) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.IncludeAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ForwardAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.SetProperty) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.UseBean) {
if ("beanName".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.PlugIn) {
if ("width".equals(name) || "height".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.ParamAction) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP;
}
} else if (n instanceof Node.JspElement) {
return TagInfo.BODY_CONTENT_JSP;
}
return JAVAX_BODY_CONTENT_TEMPLATE_TEXT;
} } | public class class_name {
private String getAttributeBodyType(Node n, String name) {
if (n instanceof Node.CustomTag) {
TagInfo tagInfo = ((Node.CustomTag)n).getTagInfo();
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
for (int i=0; i<tldAttrs.length; i++) {
if (name.equals(tldAttrs[i].getName())) {
if (tldAttrs[i].isFragment()) {
return TagInfo.BODY_CONTENT_SCRIPTLESS; // depends on control dependency: [if], data = [none]
}
if (tldAttrs[i].canBeRequestTime()) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
}
}
if (tagInfo.hasDynamicAttributes()) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.IncludeAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.ForwardAction) {
if ("page".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.SetProperty) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.UseBean) {
if ("beanName".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.PlugIn) {
if ("width".equals(name) || "height".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.ParamAction) {
if ("value".equals(name)) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
} else if (n instanceof Node.JspElement) {
return TagInfo.BODY_CONTENT_JSP; // depends on control dependency: [if], data = [none]
}
return JAVAX_BODY_CONTENT_TEMPLATE_TEXT;
} } |
public class class_name {
private void handleStubDefinition(NodeTraversal t, Node n) {
if (!t.inGlobalHoistScope()) {
return;
}
JSDocInfo info = n.getFirstChild().getJSDocInfo();
boolean hasStubDefinition = info != null && (n.isFromExterns() || info.hasTypedefType());
if (hasStubDefinition) {
if (n.getFirstChild().isQualifiedName()) {
String name = n.getFirstChild().getQualifiedName();
ProvidedName pn = providedNames.get(name);
if (pn != null) {
n.putBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED, true);
pn.addDefinition(n, t.getModule());
} else if (n.getBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED)) {
// We didn't find it in the providedNames, but it was previously marked as provided.
// This implies we're in hotswap pass and the current typedef is a provided namespace.
ProvidedName provided = new ProvidedName(name, n, t.getModule(), true, true);
providedNames.put(name, provided);
provided.addDefinition(n, t.getModule());
}
}
}
} } | public class class_name {
private void handleStubDefinition(NodeTraversal t, Node n) {
if (!t.inGlobalHoistScope()) {
return; // depends on control dependency: [if], data = [none]
}
JSDocInfo info = n.getFirstChild().getJSDocInfo();
boolean hasStubDefinition = info != null && (n.isFromExterns() || info.hasTypedefType());
if (hasStubDefinition) {
if (n.getFirstChild().isQualifiedName()) {
String name = n.getFirstChild().getQualifiedName();
ProvidedName pn = providedNames.get(name);
if (pn != null) {
n.putBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED, true); // depends on control dependency: [if], data = [none]
pn.addDefinition(n, t.getModule()); // depends on control dependency: [if], data = [none]
} else if (n.getBooleanProp(Node.WAS_PREVIOUSLY_PROVIDED)) {
// We didn't find it in the providedNames, but it was previously marked as provided.
// This implies we're in hotswap pass and the current typedef is a provided namespace.
ProvidedName provided = new ProvidedName(name, n, t.getModule(), true, true);
providedNames.put(name, provided); // depends on control dependency: [if], data = [none]
provided.addDefinition(n, t.getModule()); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public CompletableFuture<Void> close() {
for (OperationAttempt attempt : new ArrayList<>(attempts.values())) {
attempt.fail(new ClosedSessionException("session closed"));
}
attempts.clear();
return CompletableFuture.completedFuture(null);
} } | public class class_name {
public CompletableFuture<Void> close() {
for (OperationAttempt attempt : new ArrayList<>(attempts.values())) {
attempt.fail(new ClosedSessionException("session closed")); // depends on control dependency: [for], data = [attempt]
}
attempts.clear();
return CompletableFuture.completedFuture(null);
} } |
public class class_name {
private void bfs(int v, int[] cc, int id) {
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (int i = 0; i < n; i++) {
if (graph[t][i] != 0.0 && cc[i] == -1) {
queue.offer(i);
cc[i] = id;
}
}
}
} } | public class class_name {
private void bfs(int v, int[] cc, int id) {
cc[v] = id;
Queue<Integer> queue = new LinkedList<>();
queue.offer(v);
while (!queue.isEmpty()) {
int t = queue.poll();
for (int i = 0; i < n; i++) {
if (graph[t][i] != 0.0 && cc[i] == -1) {
queue.offer(i); // depends on control dependency: [if], data = [none]
cc[i] = id; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
static void dump(@Nullable String title) {
if (title != null && title.length() > 0) {
System.out.printf("Start TransmittableThreadLocal[%s] Dump...\n", title);
} else {
System.out.println("Start TransmittableThreadLocal Dump...");
}
for (Map.Entry<TransmittableThreadLocal<?>, ?> entry : holder.get().entrySet()) {
final TransmittableThreadLocal<?> key = entry.getKey();
System.out.println(key.get());
}
System.out.println("TransmittableThreadLocal Dump end!");
} } | public class class_name {
static void dump(@Nullable String title) {
if (title != null && title.length() > 0) {
System.out.printf("Start TransmittableThreadLocal[%s] Dump...\n", title); // depends on control dependency: [if], data = [none]
} else {
System.out.println("Start TransmittableThreadLocal Dump..."); // depends on control dependency: [if], data = [none]
}
for (Map.Entry<TransmittableThreadLocal<?>, ?> entry : holder.get().entrySet()) {
final TransmittableThreadLocal<?> key = entry.getKey();
System.out.println(key.get()); // depends on control dependency: [for], data = [none]
}
System.out.println("TransmittableThreadLocal Dump end!");
} } |
public class class_name {
@Override
public <E> E search(final Object searchableAnnotatedObject) {
try {
return search(this.<E>asList(searchableAnnotatedObject, configureMatcher(getSearchableMetaData(
searchableAnnotatedObject))));
}
finally {
MatcherHolder.unset();
}
} } | public class class_name {
@Override
public <E> E search(final Object searchableAnnotatedObject) {
try {
return search(this.<E>asList(searchableAnnotatedObject, configureMatcher(getSearchableMetaData(
searchableAnnotatedObject)))); // depends on control dependency: [try], data = [none]
}
finally {
MatcherHolder.unset();
}
} } |
public class class_name {
protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi,
final int numSteps, final boolean isGlobal)
{
Variable var = new Variable();
var.setQName(uniquePseudoVarName);
var.setIsGlobal(isGlobal);
if(isGlobal)
{ ElemTemplateElement elem = getElemFromExpression(wi);
StylesheetRoot root = elem.getStylesheetRoot();
Vector vars = root.getVariablesAndParamsComposed();
var.setIndex(vars.size()-1);
}
// Walk to the first walker after the one's we are replacing.
AxesWalker walker = wi.getFirstWalker();
for(int i = 0; i < numSteps; i++)
{
assertion(null != walker, "Walker should not be null!");
walker = walker.getNextWalker();
}
if(null != walker)
{
FilterExprWalker few = new FilterExprWalker(wi);
few.setInnerExpression(var);
few.exprSetParent(wi);
few.setNextWalker(walker);
walker.setPrevWalker(few);
wi.setFirstWalker(few);
return wi;
}
else
{
FilterExprIteratorSimple feis = new FilterExprIteratorSimple(var);
feis.exprSetParent(wi.exprGetParent());
return feis;
}
} } | public class class_name {
protected LocPathIterator changePartToRef(final QName uniquePseudoVarName, WalkingIterator wi,
final int numSteps, final boolean isGlobal)
{
Variable var = new Variable();
var.setQName(uniquePseudoVarName);
var.setIsGlobal(isGlobal);
if(isGlobal)
{ ElemTemplateElement elem = getElemFromExpression(wi);
StylesheetRoot root = elem.getStylesheetRoot();
Vector vars = root.getVariablesAndParamsComposed();
var.setIndex(vars.size()-1); // depends on control dependency: [if], data = [none]
}
// Walk to the first walker after the one's we are replacing.
AxesWalker walker = wi.getFirstWalker();
for(int i = 0; i < numSteps; i++)
{
assertion(null != walker, "Walker should not be null!"); // depends on control dependency: [for], data = [none]
walker = walker.getNextWalker(); // depends on control dependency: [for], data = [none]
}
if(null != walker)
{
FilterExprWalker few = new FilterExprWalker(wi);
few.setInnerExpression(var); // depends on control dependency: [if], data = [none]
few.exprSetParent(wi); // depends on control dependency: [if], data = [none]
few.setNextWalker(walker); // depends on control dependency: [if], data = [walker)]
walker.setPrevWalker(few); // depends on control dependency: [if], data = [none]
wi.setFirstWalker(few); // depends on control dependency: [if], data = [none]
return wi; // depends on control dependency: [if], data = [none]
}
else
{
FilterExprIteratorSimple feis = new FilterExprIteratorSimple(var);
feis.exprSetParent(wi.exprGetParent()); // depends on control dependency: [if], data = [none]
return feis; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Set<String> getInlinkAnchors(Page page)
throws WikiTitleParsingException
{
Set<String> inAnchors = new HashSet<String>();
for (Page p : page.getInlinks()) {
ParsedPage pp = parser.parse(p.getText());
if (pp == null) {
return inAnchors;
}
for (Link l : pp.getLinks()) {
String pageTitle = page.getTitle().getPlainTitle();
String anchorText = l.getText();
if (l.getTarget().equals(pageTitle) && !anchorText.equals(pageTitle)) {
inAnchors.add(anchorText);
}
}
}
return inAnchors;
} } | public class class_name {
public Set<String> getInlinkAnchors(Page page)
throws WikiTitleParsingException
{
Set<String> inAnchors = new HashSet<String>();
for (Page p : page.getInlinks()) {
ParsedPage pp = parser.parse(p.getText());
if (pp == null) {
return inAnchors;
}
for (Link l : pp.getLinks()) {
String pageTitle = page.getTitle().getPlainTitle();
String anchorText = l.getText();
if (l.getTarget().equals(pageTitle) && !anchorText.equals(pageTitle)) {
inAnchors.add(anchorText); // depends on control dependency: [if], data = [none]
}
}
}
return inAnchors;
} } |
public class class_name {
public static EpochTransitionRecord computeEpochTransition(EpochRecord currentEpoch, List<Long> segmentsToSeal,
List<Map.Entry<Double, Double>> newRanges, long scaleTimestamp) {
Preconditions.checkState(segmentsToSeal.stream().allMatch(currentEpoch::containsSegment), "Invalid epoch transition request");
int newEpoch = currentEpoch.getEpoch() + 1;
int nextSegmentNumber = currentEpoch.getSegments().stream().mapToInt(StreamSegmentRecord::getSegmentNumber).max().getAsInt() + 1;
ImmutableMap.Builder<Long, Map.Entry<Double, Double>> newSegments = ImmutableMap.builder();
for (int i = 0; i < newRanges.size(); i++) {
newSegments.put(computeSegmentId(nextSegmentNumber + i, newEpoch), newRanges.get(i));
}
return new EpochTransitionRecord(currentEpoch.getEpoch(), scaleTimestamp, ImmutableSet.copyOf(segmentsToSeal),
newSegments.build());
} } | public class class_name {
public static EpochTransitionRecord computeEpochTransition(EpochRecord currentEpoch, List<Long> segmentsToSeal,
List<Map.Entry<Double, Double>> newRanges, long scaleTimestamp) {
Preconditions.checkState(segmentsToSeal.stream().allMatch(currentEpoch::containsSegment), "Invalid epoch transition request");
int newEpoch = currentEpoch.getEpoch() + 1;
int nextSegmentNumber = currentEpoch.getSegments().stream().mapToInt(StreamSegmentRecord::getSegmentNumber).max().getAsInt() + 1;
ImmutableMap.Builder<Long, Map.Entry<Double, Double>> newSegments = ImmutableMap.builder();
for (int i = 0; i < newRanges.size(); i++) {
newSegments.put(computeSegmentId(nextSegmentNumber + i, newEpoch), newRanges.get(i)); // depends on control dependency: [for], data = [i]
}
return new EpochTransitionRecord(currentEpoch.getEpoch(), scaleTimestamp, ImmutableSet.copyOf(segmentsToSeal),
newSegments.build());
} } |
public class class_name {
private static ValueMap toValueMap(Resource resource) {
ValueMap propertyMap = resource.adaptTo(ValueMap.class);
if (propertyMap != null) {
propertyMap = new PrimitiveSupportingValueMap(propertyMap);
}
return propertyMap;
} } | public class class_name {
private static ValueMap toValueMap(Resource resource) {
ValueMap propertyMap = resource.adaptTo(ValueMap.class);
if (propertyMap != null) {
propertyMap = new PrimitiveSupportingValueMap(propertyMap); // depends on control dependency: [if], data = [(propertyMap]
}
return propertyMap;
} } |
public class class_name {
public void cancel(Exception reason) {
// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
// syncing here, so we don't do the channel.cancel if the request is processing
// future.complete() on another thread at the same time. Should just do a quick
// sync, check the future.complete flag, then process only if !complete. That will
// also mean we can remove a bunch of redundant checks for complete, but we need to check all
// the paths carefully.
if (this.channel == null) {
return;
}
synchronized (this.completedSemaphore) {
if (!this.completed) {
try {
// this ends up calling future.completed()
this.channel.cancel(this, reason);
} catch (Exception e) {
// Simply swallow the exception
} // end try
} else {
if (this.channel.readFuture != null) {
this.channel.readFuture.setCancelInProgress(0);
}
if (this.channel.writeFuture != null) {
this.channel.writeFuture.setCancelInProgress(0);
}
}
}
} } | public class class_name {
public void cancel(Exception reason) {
// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
// syncing here, so we don't do the channel.cancel if the request is processing
// future.complete() on another thread at the same time. Should just do a quick
// sync, check the future.complete flag, then process only if !complete. That will
// also mean we can remove a bunch of redundant checks for complete, but we need to check all
// the paths carefully.
if (this.channel == null) {
return; // depends on control dependency: [if], data = [none]
}
synchronized (this.completedSemaphore) {
if (!this.completed) {
try {
// this ends up calling future.completed()
this.channel.cancel(this, reason); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Simply swallow the exception
} // end try // depends on control dependency: [catch], data = [none]
} else {
if (this.channel.readFuture != null) {
this.channel.readFuture.setCancelInProgress(0); // depends on control dependency: [if], data = [none]
}
if (this.channel.writeFuture != null) {
this.channel.writeFuture.setCancelInProgress(0); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public ServiceCall<Void> deleteWord(DeleteWordOptions deleteWordOptions) {
Validator.notNull(deleteWordOptions, "deleteWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { deleteWordOptions.customizationId(), deleteWordOptions.word() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "deleteWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } | public class class_name {
public ServiceCall<Void> deleteWord(DeleteWordOptions deleteWordOptions) {
Validator.notNull(deleteWordOptions, "deleteWordOptions cannot be null");
String[] pathSegments = { "v1/customizations", "words" };
String[] pathParameters = { deleteWordOptions.customizationId(), deleteWordOptions.word() };
RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("text_to_speech", "v1", "deleteWord");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
} } |
public class class_name {
@Override
public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) {
if (!super.supports(context, copy)) {
return false;
}
final Type targetKeyType = getKeyType(copy.getTargetPosition());
final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType);
return getProperties(context, copy.getSourcePosition())
.anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName))));
} } | public class class_name {
@Override
public boolean supports(TherianContext context, Copy<? extends Object, ? extends Map> copy) {
if (!super.supports(context, copy)) {
return false;
// depends on control dependency: [if], data = [none]
}
final Type targetKeyType = getKeyType(copy.getTargetPosition());
final Position.ReadWrite<?> targetKey = Positions.readWrite(targetKeyType);
return getProperties(context, copy.getSourcePosition())
.anyMatch(propertyName -> context.supports(Convert.to(targetKey, Positions.readOnly(propertyName))));
} } |
public class class_name {
private synchronized void addLastTime(File wordsFile) {
if(wordsFile != null) {
wordsLastTime.put(wordsFile, wordsFile.lastModified());
}
} } | public class class_name {
private synchronized void addLastTime(File wordsFile) {
if(wordsFile != null) {
wordsLastTime.put(wordsFile, wordsFile.lastModified());
// depends on control dependency: [if], data = [(wordsFile]
}
} } |
public class class_name {
public static RejectedExecutionHandler backoff(final int retries, long backoffAmount, TimeUnit unit) {
ObjectUtil.checkPositive(retries, "retries");
final long backOffNanos = unit.toNanos(backoffAmount);
return new RejectedExecutionHandler() {
@Override
public void rejected(Runnable task, SingleThreadEventExecutor executor) {
if (!executor.inEventLoop()) {
for (int i = 0; i < retries; i++) {
// Try to wake up the executor so it will empty its task queue.
executor.wakeup(false);
LockSupport.parkNanos(backOffNanos);
if (executor.offerTask(task)) {
return;
}
}
}
// Either we tried to add the task from within the EventLoop or we was not able to add it even with
// backoff.
throw new RejectedExecutionException();
}
};
} } | public class class_name {
public static RejectedExecutionHandler backoff(final int retries, long backoffAmount, TimeUnit unit) {
ObjectUtil.checkPositive(retries, "retries");
final long backOffNanos = unit.toNanos(backoffAmount);
return new RejectedExecutionHandler() {
@Override
public void rejected(Runnable task, SingleThreadEventExecutor executor) {
if (!executor.inEventLoop()) {
for (int i = 0; i < retries; i++) {
// Try to wake up the executor so it will empty its task queue.
executor.wakeup(false); // depends on control dependency: [for], data = [none]
LockSupport.parkNanos(backOffNanos); // depends on control dependency: [for], data = [none]
if (executor.offerTask(task)) {
return; // depends on control dependency: [if], data = [none]
}
}
}
// Either we tried to add the task from within the EventLoop or we was not able to add it even with
// backoff.
throw new RejectedExecutionException();
}
};
} } |
public class class_name {
public EEnum getIfcTextPath() {
if (ifcTextPathEEnum == null) {
ifcTextPathEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(913);
}
return ifcTextPathEEnum;
} } | public class class_name {
public EEnum getIfcTextPath() {
if (ifcTextPathEEnum == null) {
ifcTextPathEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(913);
// depends on control dependency: [if], data = [none]
}
return ifcTextPathEEnum;
} } |
public class class_name {
private static String getConfValue(String defaultValue, String keySuffix,
Configuration conf, String... keys) {
String value = null;
for (String key : keys) {
if (keySuffix != null) {
key += "." + keySuffix;
}
value = conf.get(key);
if (value != null) {
break;
}
}
if (value == null) {
value = defaultValue;
}
return value;
} } | public class class_name {
private static String getConfValue(String defaultValue, String keySuffix,
Configuration conf, String... keys) {
String value = null;
for (String key : keys) {
if (keySuffix != null) {
key += "." + keySuffix; // depends on control dependency: [if], data = [none]
}
value = conf.get(key); // depends on control dependency: [for], data = [key]
if (value != null) {
break;
}
}
if (value == null) {
value = defaultValue; // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
protected IDbgpBreakpoint[] parseBreakpointsResponse(Element response)
{
List<IDbgpBreakpoint> list = new ArrayList<IDbgpBreakpoint>();
NodeList breakpoints = response.getElementsByTagName(BREAKPOINT_TAG);
for (int i = 0; i < breakpoints.getLength(); ++i)
{
list.add(DbgpXmlEntityParser.parseBreakpoint((Element) breakpoints.item(i)));
}
return (IDbgpBreakpoint[]) list.toArray(new IDbgpBreakpoint[list.size()]);
} } | public class class_name {
protected IDbgpBreakpoint[] parseBreakpointsResponse(Element response)
{
List<IDbgpBreakpoint> list = new ArrayList<IDbgpBreakpoint>();
NodeList breakpoints = response.getElementsByTagName(BREAKPOINT_TAG);
for (int i = 0; i < breakpoints.getLength(); ++i)
{
list.add(DbgpXmlEntityParser.parseBreakpoint((Element) breakpoints.item(i))); // depends on control dependency: [for], data = [i]
}
return (IDbgpBreakpoint[]) list.toArray(new IDbgpBreakpoint[list.size()]);
} } |
public class class_name {
public void marshall(CampaignLimits campaignLimits, ProtocolMarshaller protocolMarshaller) {
if (campaignLimits == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(campaignLimits.getDaily(), DAILY_BINDING);
protocolMarshaller.marshall(campaignLimits.getMaximumDuration(), MAXIMUMDURATION_BINDING);
protocolMarshaller.marshall(campaignLimits.getMessagesPerSecond(), MESSAGESPERSECOND_BINDING);
protocolMarshaller.marshall(campaignLimits.getTotal(), TOTAL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CampaignLimits campaignLimits, ProtocolMarshaller protocolMarshaller) {
if (campaignLimits == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(campaignLimits.getDaily(), DAILY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(campaignLimits.getMaximumDuration(), MAXIMUMDURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(campaignLimits.getMessagesPerSecond(), MESSAGESPERSECOND_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(campaignLimits.getTotal(), TOTAL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) {
if (jsonContext.isSupportedType(type.getRawClass())) {
return createSerializer();
}
return null;
} } | public class class_name {
@Override
public JsonSerializer<?> findSerializer(SerializationConfig config, JavaType type, BeanDescription beanDesc) {
if (jsonContext.isSupportedType(type.getRawClass())) {
return createSerializer(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private void addChildElements() {
for (Node node : nodes) {
if(node instanceof NestableNode) {
List<Node> nl = ((NestableNode) node).getChildren();
for (Node n : nl) {
if (!(n instanceof Element)) {
continue;
}
String tag = selector.getTagName();
if (tagEquals(tag, ((Element)n).getNormalizedName()) || tag.equals(Selector.UNIVERSAL_TAG)) {
result.add(n);
}
}
}
}
} } | public class class_name {
private void addChildElements() {
for (Node node : nodes) {
if(node instanceof NestableNode) {
List<Node> nl = ((NestableNode) node).getChildren();
for (Node n : nl) {
if (!(n instanceof Element)) {
continue;
}
String tag = selector.getTagName();
if (tagEquals(tag, ((Element)n).getNormalizedName()) || tag.equals(Selector.UNIVERSAL_TAG)) {
result.add(n); // depends on control dependency: [if], data = [none]
}
}
}
}
} } |
public class class_name {
public void setTitle(CharSequence title){
if(mConstruct != null && !mConstruct.getDesign().isMaterial()){
// Modify the dialog's title element
getDialog().setTitle(title);
}else{
if(mTitle != null){
mTitle.setText(title);
}
}
} } | public class class_name {
public void setTitle(CharSequence title){
if(mConstruct != null && !mConstruct.getDesign().isMaterial()){
// Modify the dialog's title element
getDialog().setTitle(title); // depends on control dependency: [if], data = [none]
}else{
if(mTitle != null){
mTitle.setText(title); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void format(LogData logData, SimpleLogHandler receiver) {
Metadata metadata = logData.getMetadata();
Throwable thrown = metadata.findValue(LogContext.Key.LOG_CAUSE);
// Either no metadata, or exactly one "cause" means we don't need to do additional formatting.
// This is pretty common and will save some work and object allocations.
boolean hasOnlyKnownMetadata = metadata.size() == 0 || (metadata.size() == 1 && thrown != null);
TemplateContext ctx = logData.getTemplateContext();
String message;
if (ctx == null) {
// If a literal message (no arguments) is logged and no metadata exists, just use the string.
// Having no format arguments is fairly common and this avoids allocating StringBuilders and
// formatter instances in a lot of situations.
message = safeToString(logData.getLiteralArgument());
if (!hasOnlyKnownMetadata) {
// If unknown metadata exists we have to append it to the message (this is not that common
// because a Throwable "cause" is already handled separately).
message = appendContext(new StringBuilder(message), metadata);
}
} else {
StringBuilder buffer = formatMessage(logData);
message = hasOnlyKnownMetadata ? buffer.toString() : appendContext(buffer, metadata);
}
receiver.handleFormattedLogMessage(logData.getLevel(), message, thrown);
} } | public class class_name {
public static void format(LogData logData, SimpleLogHandler receiver) {
Metadata metadata = logData.getMetadata();
Throwable thrown = metadata.findValue(LogContext.Key.LOG_CAUSE);
// Either no metadata, or exactly one "cause" means we don't need to do additional formatting.
// This is pretty common and will save some work and object allocations.
boolean hasOnlyKnownMetadata = metadata.size() == 0 || (metadata.size() == 1 && thrown != null);
TemplateContext ctx = logData.getTemplateContext();
String message;
if (ctx == null) {
// If a literal message (no arguments) is logged and no metadata exists, just use the string.
// Having no format arguments is fairly common and this avoids allocating StringBuilders and
// formatter instances in a lot of situations.
message = safeToString(logData.getLiteralArgument()); // depends on control dependency: [if], data = [none]
if (!hasOnlyKnownMetadata) {
// If unknown metadata exists we have to append it to the message (this is not that common
// because a Throwable "cause" is already handled separately).
message = appendContext(new StringBuilder(message), metadata); // depends on control dependency: [if], data = [none]
}
} else {
StringBuilder buffer = formatMessage(logData);
message = hasOnlyKnownMetadata ? buffer.toString() : appendContext(buffer, metadata); // depends on control dependency: [if], data = [none]
}
receiver.handleFormattedLogMessage(logData.getLevel(), message, thrown);
} } |
public class class_name {
public EnvironmentImage withVersions(String... versions) {
if (this.versions == null) {
setVersions(new java.util.ArrayList<String>(versions.length));
}
for (String ele : versions) {
this.versions.add(ele);
}
return this;
} } | public class class_name {
public EnvironmentImage withVersions(String... versions) {
if (this.versions == null) {
setVersions(new java.util.ArrayList<String>(versions.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : versions) {
this.versions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public void marshall(ScheduleKeyDeletionRequest scheduleKeyDeletionRequest, ProtocolMarshaller protocolMarshaller) {
if (scheduleKeyDeletionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scheduleKeyDeletionRequest.getKeyId(), KEYID_BINDING);
protocolMarshaller.marshall(scheduleKeyDeletionRequest.getPendingWindowInDays(), PENDINGWINDOWINDAYS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ScheduleKeyDeletionRequest scheduleKeyDeletionRequest, ProtocolMarshaller protocolMarshaller) {
if (scheduleKeyDeletionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(scheduleKeyDeletionRequest.getKeyId(), KEYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(scheduleKeyDeletionRequest.getPendingWindowInDays(), PENDINGWINDOWINDAYS_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 String factorizeFullness(long bitmapCardinality, long numRows)
{
if (bitmapCardinality == 0) {
return "0";
} else if (bitmapCardinality == numRows) {
return "1";
} else {
double fullness = bitmapCardinality / (double) numRows;
int index = Arrays.binarySearch(BITMAP_FULLNESS_FACTORIZATION_STOPS, fullness);
if (index < 0) {
index = ~index;
}
return FACTORIZED_FULLNESS[index];
}
} } | public class class_name {
private static String factorizeFullness(long bitmapCardinality, long numRows)
{
if (bitmapCardinality == 0) {
return "0"; // depends on control dependency: [if], data = [none]
} else if (bitmapCardinality == numRows) {
return "1"; // depends on control dependency: [if], data = [none]
} else {
double fullness = bitmapCardinality / (double) numRows;
int index = Arrays.binarySearch(BITMAP_FULLNESS_FACTORIZATION_STOPS, fullness);
if (index < 0) {
index = ~index; // depends on control dependency: [if], data = [none]
}
return FACTORIZED_FULLNESS[index]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Set<String> getSupportedUriSchemes() {
Set<String> schemes = new HashSet<>();
for (ConfigFileLoaderPlugin loaderPlugin: this.getLoaderPlugins()) {
schemes.add(loaderPlugin.getUriScheme());
}
return schemes;
} } | public class class_name {
public Set<String> getSupportedUriSchemes() {
Set<String> schemes = new HashSet<>();
for (ConfigFileLoaderPlugin loaderPlugin: this.getLoaderPlugins()) {
schemes.add(loaderPlugin.getUriScheme()); // depends on control dependency: [for], data = [loaderPlugin]
}
return schemes;
} } |
public class class_name {
public void marshall(PipelineMetadata pipelineMetadata, ProtocolMarshaller protocolMarshaller) {
if (pipelineMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pipelineMetadata.getPipelineArn(), PIPELINEARN_BINDING);
protocolMarshaller.marshall(pipelineMetadata.getCreated(), CREATED_BINDING);
protocolMarshaller.marshall(pipelineMetadata.getUpdated(), UPDATED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PipelineMetadata pipelineMetadata, ProtocolMarshaller protocolMarshaller) {
if (pipelineMetadata == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pipelineMetadata.getPipelineArn(), PIPELINEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineMetadata.getCreated(), CREATED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pipelineMetadata.getUpdated(), UPDATED_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 Assignment createAssignment(final LNGBooleanVector vec, final LNGIntVector relevantIndices) {
final Assignment model = new Assignment();
if (relevantIndices == null) {
for (int i = 0; i < vec.size(); i++) {
model.addLiteral(this.f.literal(this.solver.nameForIdx(i), vec.get(i)));
}
} else {
for (int i = 0; i < relevantIndices.size(); i++) {
final int index = relevantIndices.get(i);
if (index != -1) {
model.addLiteral(this.f.literal(this.solver.nameForIdx(index), vec.get(index)));
}
}
}
return model;
} } | public class class_name {
private Assignment createAssignment(final LNGBooleanVector vec, final LNGIntVector relevantIndices) {
final Assignment model = new Assignment();
if (relevantIndices == null) {
for (int i = 0; i < vec.size(); i++) {
model.addLiteral(this.f.literal(this.solver.nameForIdx(i), vec.get(i))); // depends on control dependency: [for], data = [i]
}
} else {
for (int i = 0; i < relevantIndices.size(); i++) {
final int index = relevantIndices.get(i);
if (index != -1) {
model.addLiteral(this.f.literal(this.solver.nameForIdx(index), vec.get(index))); // depends on control dependency: [if], data = [(index]
}
}
}
return model;
} } |
public class class_name {
@Override
public void write(Batch batch) throws StageException {
Iterator<Record> it = batch.getRecords();
if (it.hasNext()) {
while (it.hasNext()) {
Record record = it.next();
try {
write(record);
} catch (OnRecordErrorException ex) {
switch (getContext().getOnErrorRecord()) {
case DISCARD:
break;
case TO_ERROR:
getContext().toError(record, ex);
break;
case STOP_PIPELINE:
throw ex;
default:
throw new IllegalStateException(Utils.format("It should never happen. OnError '{}'",
getContext().getOnErrorRecord(), ex));
}
}
}
} else {
emptyBatch();
}
} } | public class class_name {
@Override
public void write(Batch batch) throws StageException {
Iterator<Record> it = batch.getRecords();
if (it.hasNext()) {
while (it.hasNext()) {
Record record = it.next();
try {
write(record); // depends on control dependency: [try], data = [none]
} catch (OnRecordErrorException ex) {
switch (getContext().getOnErrorRecord()) {
case DISCARD:
break;
case TO_ERROR:
getContext().toError(record, ex);
break;
case STOP_PIPELINE:
throw ex;
default:
throw new IllegalStateException(Utils.format("It should never happen. OnError '{}'",
getContext().getOnErrorRecord(), ex));
}
} // depends on control dependency: [catch], data = [none]
}
} else {
emptyBatch();
}
} } |
public class class_name {
private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) {
List<Consumes> consumes = findAll(method, Consumes.class);
List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class);
if (consumes.isEmpty() && consumeTypes.isEmpty()) {
consumes = findAll(clazz, Consumes.class);
consumeTypes = findAll(clazz, ConsumeType.class);
}
final List<MediaType> types =
Stream.concat(consumes.stream().map(Consumes::value),
consumeTypes.stream().map(ConsumeType::value))
.map(MediaType::parse)
.collect(toImmutableList());
return ensureUniqueTypes(types, Consumes.class);
} } | public class class_name {
private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) {
List<Consumes> consumes = findAll(method, Consumes.class);
List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class);
if (consumes.isEmpty() && consumeTypes.isEmpty()) {
consumes = findAll(clazz, Consumes.class); // depends on control dependency: [if], data = [none]
consumeTypes = findAll(clazz, ConsumeType.class); // depends on control dependency: [if], data = [none]
}
final List<MediaType> types =
Stream.concat(consumes.stream().map(Consumes::value),
consumeTypes.stream().map(ConsumeType::value))
.map(MediaType::parse)
.collect(toImmutableList());
return ensureUniqueTypes(types, Consumes.class);
} } |
public class class_name {
public String escapeXml(final Object target) {
if (target == null) {
return null;
}
return StringUtils.escapeXml(target);
} } | public class class_name {
public String escapeXml(final Object target) {
if (target == null) {
return null; // depends on control dependency: [if], data = [none]
}
return StringUtils.escapeXml(target);
} } |
public class class_name {
private static void markClusterEndPoints_(int geometry,
TopoGraph topoGraph, int clusterIndex) {
int id = topoGraph.getGeometryID(geometry);
for (int cluster = topoGraph.getFirstCluster(); cluster != -1; cluster = topoGraph.getNextCluster(cluster))
{
int cluster_parentage = topoGraph.getClusterParentage(cluster);
if ((cluster_parentage & id) == 0)
continue;
int first_half_edge = topoGraph.getClusterHalfEdge(cluster);
if (first_half_edge == -1)
{
topoGraph.setClusterUserIndex(cluster, clusterIndex, 0);
continue;
}
int next_half_edge = first_half_edge;
int index = 0;
do
{
int half_edge = next_half_edge;
int half_edge_parentage = topoGraph.getHalfEdgeParentage(half_edge);
if ((half_edge_parentage & id) != 0)
index++;
next_half_edge = topoGraph.getHalfEdgeNext(topoGraph.getHalfEdgeTwin(half_edge));
} while (next_half_edge != first_half_edge);
topoGraph.setClusterUserIndex(cluster, clusterIndex, index);
}
return;
} } | public class class_name {
private static void markClusterEndPoints_(int geometry,
TopoGraph topoGraph, int clusterIndex) {
int id = topoGraph.getGeometryID(geometry);
for (int cluster = topoGraph.getFirstCluster(); cluster != -1; cluster = topoGraph.getNextCluster(cluster))
{
int cluster_parentage = topoGraph.getClusterParentage(cluster);
if ((cluster_parentage & id) == 0)
continue;
int first_half_edge = topoGraph.getClusterHalfEdge(cluster);
if (first_half_edge == -1)
{
topoGraph.setClusterUserIndex(cluster, clusterIndex, 0); // depends on control dependency: [if], data = [none]
continue;
}
int next_half_edge = first_half_edge;
int index = 0;
do
{
int half_edge = next_half_edge;
int half_edge_parentage = topoGraph.getHalfEdgeParentage(half_edge);
if ((half_edge_parentage & id) != 0)
index++;
next_half_edge = topoGraph.getHalfEdgeNext(topoGraph.getHalfEdgeTwin(half_edge));
} while (next_half_edge != first_half_edge);
topoGraph.setClusterUserIndex(cluster, clusterIndex, index); // depends on control dependency: [for], data = [cluster]
}
return;
} } |
public class class_name {
protected int getAccessTokenValiditySeconds(OAuth2Request clientAuth) {
if (clientDetailsService != null) {
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
Integer validity = client.getAccessTokenValiditySeconds();
if (validity != null) {
return validity;
}
}
return accessTokenValiditySeconds;
} } | public class class_name {
protected int getAccessTokenValiditySeconds(OAuth2Request clientAuth) {
if (clientDetailsService != null) {
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
Integer validity = client.getAccessTokenValiditySeconds();
if (validity != null) {
return validity; // depends on control dependency: [if], data = [none]
}
}
return accessTokenValiditySeconds;
} } |
public class class_name {
protected String lookupEeApplicationName() {
try {
InitialContext initialContext = new InitialContext();
String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH);
String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH);
// make sure that if an EAR carries multiple PAs, they are correctly
// identified by appName + moduleName
if (moduleName != null && !moduleName.equals(appName)) {
return appName + "/" + moduleName;
} else {
return appName;
}
}
catch (NamingException e) {
throw LOG.ejbPaCannotAutodetectName(e);
}
} } | public class class_name {
protected String lookupEeApplicationName() {
try {
InitialContext initialContext = new InitialContext();
String appName = (String) initialContext.lookup(JAVA_APP_APP_NAME_PATH);
String moduleName = (String) initialContext.lookup(MODULE_NAME_PATH);
// make sure that if an EAR carries multiple PAs, they are correctly
// identified by appName + moduleName
if (moduleName != null && !moduleName.equals(appName)) {
return appName + "/" + moduleName; // depends on control dependency: [if], data = [none]
} else {
return appName; // depends on control dependency: [if], data = [none]
}
}
catch (NamingException e) {
throw LOG.ejbPaCannotAutodetectName(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
public T addTag(String tag) {
if (this.tags_ == null) {
tags_ = new ArrayList<>();
}
this.tags_.add(tag);
return (T) this;
} } | public class class_name {
@SuppressWarnings("unchecked")
public T addTag(String tag) {
if (this.tags_ == null) {
tags_ = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
this.tags_.add(tag);
return (T) this;
} } |
public class class_name {
public static SyncPlan computeSyncPlan(Inode inode, Fingerprint ufsFingerprint,
boolean containsMountPoint) {
Fingerprint inodeFingerprint = Fingerprint.parse(inode.getUfsFingerprint());
boolean isContentSynced = inodeUfsIsContentSynced(inode, inodeFingerprint, ufsFingerprint);
boolean isMetadataSynced = inodeUfsIsMetadataSynced(inode, inodeFingerprint, ufsFingerprint);
boolean ufsExists = ufsFingerprint.isValid();
boolean ufsIsDir = ufsFingerprint != null
&& Fingerprint.Type.DIRECTORY.name().equals(ufsFingerprint.getTag(Fingerprint.Tag.TYPE));
UfsSyncUtils.SyncPlan syncPlan = new UfsSyncUtils.SyncPlan();
if (isContentSynced && isMetadataSynced) {
// Inode is already synced.
if (inode.isDirectory() && inode.isPersisted()) {
// Both Alluxio and UFS are directories, so sync the children of the directory.
syncPlan.setSyncChildren();
}
return syncPlan;
}
// One of the metadata or content is not in sync
if (inode.isDirectory() && (containsMountPoint || ufsIsDir)) {
// Instead of deleting and then loading metadata to update, try to update directly
// - mount points (or paths with mount point descendants) should not be deleted
// - directory permissions can be updated without removing the inode
if (inode.getParentId() != InodeTree.NO_PARENT) {
// Only update the inode if it is not the root directory. The root directory is a special
// case, since it is expected to be owned by the process that starts the master, and not
// the owner on UFS.
syncPlan.setUpdateMetadata();
}
syncPlan.setSyncChildren();
return syncPlan;
}
// One of metadata or content is not in sync and it is a file
// The only way for a directory to reach this point, is that the ufs with the same path is not
// a directory. That requires a deletion and reload as well.
if (!isContentSynced) {
// update inode, by deleting and then optionally loading metadata
syncPlan.setDelete();
if (ufsExists) {
// UFS exists, so load metadata later.
syncPlan.setLoadMetadata();
}
} else {
syncPlan.setUpdateMetadata();
}
return syncPlan;
} } | public class class_name {
public static SyncPlan computeSyncPlan(Inode inode, Fingerprint ufsFingerprint,
boolean containsMountPoint) {
Fingerprint inodeFingerprint = Fingerprint.parse(inode.getUfsFingerprint());
boolean isContentSynced = inodeUfsIsContentSynced(inode, inodeFingerprint, ufsFingerprint);
boolean isMetadataSynced = inodeUfsIsMetadataSynced(inode, inodeFingerprint, ufsFingerprint);
boolean ufsExists = ufsFingerprint.isValid();
boolean ufsIsDir = ufsFingerprint != null
&& Fingerprint.Type.DIRECTORY.name().equals(ufsFingerprint.getTag(Fingerprint.Tag.TYPE));
UfsSyncUtils.SyncPlan syncPlan = new UfsSyncUtils.SyncPlan();
if (isContentSynced && isMetadataSynced) {
// Inode is already synced.
if (inode.isDirectory() && inode.isPersisted()) {
// Both Alluxio and UFS are directories, so sync the children of the directory.
syncPlan.setSyncChildren(); // depends on control dependency: [if], data = [none]
}
return syncPlan; // depends on control dependency: [if], data = [none]
}
// One of the metadata or content is not in sync
if (inode.isDirectory() && (containsMountPoint || ufsIsDir)) {
// Instead of deleting and then loading metadata to update, try to update directly
// - mount points (or paths with mount point descendants) should not be deleted
// - directory permissions can be updated without removing the inode
if (inode.getParentId() != InodeTree.NO_PARENT) {
// Only update the inode if it is not the root directory. The root directory is a special
// case, since it is expected to be owned by the process that starts the master, and not
// the owner on UFS.
syncPlan.setUpdateMetadata(); // depends on control dependency: [if], data = [none]
}
syncPlan.setSyncChildren(); // depends on control dependency: [if], data = [none]
return syncPlan; // depends on control dependency: [if], data = [none]
}
// One of metadata or content is not in sync and it is a file
// The only way for a directory to reach this point, is that the ufs with the same path is not
// a directory. That requires a deletion and reload as well.
if (!isContentSynced) {
// update inode, by deleting and then optionally loading metadata
syncPlan.setDelete(); // depends on control dependency: [if], data = [none]
if (ufsExists) {
// UFS exists, so load metadata later.
syncPlan.setLoadMetadata(); // depends on control dependency: [if], data = [none]
}
} else {
syncPlan.setUpdateMetadata(); // depends on control dependency: [if], data = [none]
}
return syncPlan;
} } |
public class class_name {
public boolean removeDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
list.remove(k);
items.remove(k);
return true;
}
}
return false;
} } | public class class_name {
public boolean removeDivider(String text) {
for (int k = 0; k < list.getWidgetCount(); k++) {
Widget w = list.getWidget(k);
if (isDivider(w) && w.getElement().getInnerText().equals(text)) {
list.remove(k); // depends on control dependency: [if], data = [none]
items.remove(k); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private void calc(int x, int y) {
double d;
int dIndex;
int index;
for (int alpha = 0; alpha < (this.cSteps - 1); alpha++) {
d = y * this.cCosA[alpha] - x * this.cSinA[alpha];
dIndex = (int) (d - this.cDMin);
index = dIndex * this.cSteps + alpha;
try {
this.cHMatrix[index] += 1;
} catch (Exception e) {
logger.warn("", e);
}
}
} } | public class class_name {
private void calc(int x, int y) {
double d;
int dIndex;
int index;
for (int alpha = 0; alpha < (this.cSteps - 1); alpha++) {
d = y * this.cCosA[alpha] - x * this.cSinA[alpha]; // depends on control dependency: [for], data = [alpha]
dIndex = (int) (d - this.cDMin); // depends on control dependency: [for], data = [none]
index = dIndex * this.cSteps + alpha; // depends on control dependency: [for], data = [alpha]
try {
this.cHMatrix[index] += 1; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn("", e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static void setContentLength(HttpRequest req, HttpHeaders headers, int contentLength) {
// https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4
// prohibits to send message body for below cases.
// and in those cases, content should be empty.
if (req.method() == HttpMethod.HEAD || ArmeriaHttpUtil.isContentAlwaysEmpty(headers.status())) {
return;
}
headers.setInt(HttpHeaderNames.CONTENT_LENGTH, contentLength);
} } | public class class_name {
private static void setContentLength(HttpRequest req, HttpHeaders headers, int contentLength) {
// https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.4
// prohibits to send message body for below cases.
// and in those cases, content should be empty.
if (req.method() == HttpMethod.HEAD || ArmeriaHttpUtil.isContentAlwaysEmpty(headers.status())) {
return; // depends on control dependency: [if], data = [none]
}
headers.setInt(HttpHeaderNames.CONTENT_LENGTH, contentLength);
} } |
public class class_name {
public GSection setNotifications(int notifications) {
String textNotification;
textNotification = String.valueOf(notifications);
if(notifications < 1) {
textNotification = "";
}
if(notifications > 99) {
textNotification = "99+";
}
this.notifications.setText(textNotification);
numberNotifications = notifications;
return this;
} } | public class class_name {
public GSection setNotifications(int notifications) {
String textNotification;
textNotification = String.valueOf(notifications);
if(notifications < 1) {
textNotification = ""; // depends on control dependency: [if], data = [none]
}
if(notifications > 99) {
textNotification = "99+"; // depends on control dependency: [if], data = [none]
}
this.notifications.setText(textNotification);
numberNotifications = notifications;
return this;
} } |
public class class_name {
public void marshall(IssueCertificateRequest issueCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (issueCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(issueCertificateRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING);
protocolMarshaller.marshall(issueCertificateRequest.getCsr(), CSR_BINDING);
protocolMarshaller.marshall(issueCertificateRequest.getSigningAlgorithm(), SIGNINGALGORITHM_BINDING);
protocolMarshaller.marshall(issueCertificateRequest.getValidity(), VALIDITY_BINDING);
protocolMarshaller.marshall(issueCertificateRequest.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(IssueCertificateRequest issueCertificateRequest, ProtocolMarshaller protocolMarshaller) {
if (issueCertificateRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(issueCertificateRequest.getCertificateAuthorityArn(), CERTIFICATEAUTHORITYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(issueCertificateRequest.getCsr(), CSR_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(issueCertificateRequest.getSigningAlgorithm(), SIGNINGALGORITHM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(issueCertificateRequest.getValidity(), VALIDITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(issueCertificateRequest.getIdempotencyToken(), IDEMPOTENCYTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void histogram( GrayF32 input , float minValue , int histogram[] ) {
if( BoofConcurrency.USE_CONCURRENT ) {
ImplImageStatistics_MT.histogram(input,minValue,histogram);
} else {
ImplImageStatistics.histogram(input,minValue,histogram);
}
} } | public class class_name {
public static void histogram( GrayF32 input , float minValue , int histogram[] ) {
if( BoofConcurrency.USE_CONCURRENT ) {
ImplImageStatistics_MT.histogram(input,minValue,histogram); // depends on control dependency: [if], data = [none]
} else {
ImplImageStatistics.histogram(input,minValue,histogram); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void go(Reader r) throws IOException {
BufferedReader reader;
if (r instanceof BufferedReader)
reader = (BufferedReader)r;
else
reader = new BufferedReader(r);
doc.startDocument();
while(true) {
// read a new character
if (previousCharacter == -1) {
character = reader.read();
}
// or re-examine the previous character
else {
character = previousCharacter;
previousCharacter = -1;
}
// the end of the file was reached
if (character == -1) {
if (html) {
if (html && state == TEXT)
flush();
doc.endDocument();
} else {
throwException("Missing end tag");
}
return;
}
// dealing with \n and \r
if (character == '\n' && eol) {
eol = false;
continue;
} else if (eol) {
eol = false;
} else if (character == '\n') {
lines++;
columns = 0;
} else if (character == '\r') {
eol = true;
character = '\n';
lines++;
columns = 0;
} else {
columns++;
}
switch(state) {
// we are in an unknown state before there's actual content
case UNKNOWN:
if(character == '<') {
saveState(TEXT);
state = TAG_ENCOUNTERED;
}
break;
// we can encounter any content
case TEXT:
if(character == '<') {
flush();
saveState(state);
state = TAG_ENCOUNTERED;
} else if(character == '&') {
saveState(state);
entity.setLength(0);
state = ENTITY;
nowhite = true;
} else if (Character.isWhitespace((char)character)) {
if (nowhite)
text.append((char)character);
nowhite = false;
} else {
text.append((char)character);
nowhite = true;
}
break;
// we have just seen a < and are wondering what we are looking at
// <foo>, </foo>, <!-- ... --->, etc.
case TAG_ENCOUNTERED:
initTag();
if(character == '/') {
state = IN_CLOSETAG;
} else if (character == '?') {
restoreState();
state = PI;
} else {
text.append((char)character);
state = EXAMIN_TAG;
}
break;
// we are processing something like this <foo ... >.
// It could still be a <!-- ... --> or something.
case EXAMIN_TAG:
if(character == '>') {
doTag();
processTag(true);
initTag();
state = restoreState();
} else if(character == '/') {
state = SINGLE_TAG;
} else if(character == '-' && text.toString().equals("!-")) {
flush();
state = COMMENT;
} else if(character == '[' && text.toString().equals("![CDATA")) {
flush();
state = CDATA;
} else if(character == 'E' && text.toString().equals("!DOCTYP")) {
flush();
state = PI;
} else if(Character.isWhitespace((char)character)) {
doTag();
state = TAG_EXAMINED;
} else {
text.append((char)character);
}
break;
// we know the name of the tag now.
case TAG_EXAMINED:
if(character == '>') {
processTag(true);
initTag();
state = restoreState();
} else if(character == '/') {
state = SINGLE_TAG;
} else if(Character.isWhitespace((char)character)) {
// empty
} else {
text.append((char)character);
state = ATTRIBUTE_KEY;
}
break;
// we are processing a closing tag: e.g. </foo>
case IN_CLOSETAG:
if(character == '>') {
doTag();
processTag(false);
if(!html && nested==0) return;
state = restoreState();
} else {
if (!Character.isWhitespace((char)character))
text.append((char)character);
}
break;
// we have just seen something like this: <foo a="b"/
// and are looking for the final >.
case SINGLE_TAG:
if(character != '>')
throwException("Expected > for tag: <"+tag+"/>");
doTag();
processTag(true);
processTag(false);
initTag();
if(!html && nested==0) {
doc.endDocument();
return;
}
state = restoreState();
break;
// we are processing CDATA
case CDATA:
if(character == '>'
&& text.toString().endsWith("]]")) {
text.setLength(text.length()-2);
flush();
state = restoreState();
} else
text.append((char)character);
break;
// we are processing a comment. We are inside
// the <!-- .... --> looking for the -->.
case COMMENT:
if(character == '>'
&& text.toString().endsWith("--")) {
text.setLength(text.length() - 2);
flush();
state = restoreState();
} else
text.append((char)character);
break;
// We are inside one of these <? ... ?> or one of these <!DOCTYPE ... >
case PI:
if(character == '>') {
state = restoreState();
if(state == TEXT) state = UNKNOWN;
}
break;
// we are processing an entity, e.g. <, », etc.
case ENTITY:
if(character == ';') {
state = restoreState();
String cent = entity.toString();
entity.setLength(0);
char ce = EntitiesToUnicode.decodeEntity(cent);
if (ce == '\0')
text.append('&').append(cent).append(';');
else
text.append(ce);
} else if ((character != '#' && (character < '0' || character > '9') && (character < 'a' || character > 'z')
&& (character < 'A' || character > 'Z')) || entity.length() >= 7) {
state = restoreState();
previousCharacter = character;
text.append('&').append(entity.toString());
entity.setLength(0);
}
else {
entity.append((char)character);
}
break;
// We are processing the quoted right-hand side of an element's attribute.
case QUOTE:
if (html && quoteCharacter == ' ' && character == '>') {
flush();
processTag(true);
initTag();
state = restoreState();
}
else if (html && quoteCharacter == ' ' && Character.isWhitespace((char)character)) {
flush();
state = TAG_EXAMINED;
}
else if (html && quoteCharacter == ' ') {
text.append((char)character);
}
else if(character == quoteCharacter) {
flush();
state = TAG_EXAMINED;
} else if(" \r\n\u0009".indexOf(character)>=0) {
text.append(' ');
} else if(character == '&') {
saveState(state);
state = ENTITY;
entity.setLength(0);
} else {
text.append((char)character);
}
break;
case ATTRIBUTE_KEY:
if(Character.isWhitespace((char)character)) {
flush();
state = ATTRIBUTE_EQUAL;
} else if(character == '=') {
flush();
state = ATTRIBUTE_VALUE;
} else if (html && character == '>') {
text.setLength(0);
processTag(true);
initTag();
state = restoreState();
} else {
text.append((char)character);
}
break;
case ATTRIBUTE_EQUAL:
if(character == '=') {
state = ATTRIBUTE_VALUE;
} else if(Character.isWhitespace((char)character)) {
// empty
} else if (html && character == '>') {
text.setLength(0);
processTag(true);
initTag();
state = restoreState();
} else if (html && character == '/') {
flush();
state = SINGLE_TAG;
} else if (html) {
flush();
text.append((char)character);
state = ATTRIBUTE_KEY;
} else {
throwException("Error in attribute processing.");
}
break;
case ATTRIBUTE_VALUE:
if(character == '"' || character == '\'') {
quoteCharacter = character;
state = QUOTE;
} else if(Character.isWhitespace((char)character)) {
// empty
} else if (html && character == '>') {
flush();
processTag(true);
initTag();
state = restoreState();
} else if (html) {
text.append((char)character);
quoteCharacter = ' ';
state = QUOTE;
} else {
throwException("Error in attribute processing");
}
break;
}
}
} } | public class class_name {
private void go(Reader r) throws IOException {
BufferedReader reader;
if (r instanceof BufferedReader)
reader = (BufferedReader)r;
else
reader = new BufferedReader(r);
doc.startDocument();
while(true) {
// read a new character
if (previousCharacter == -1) {
character = reader.read(); // depends on control dependency: [if], data = [none]
}
// or re-examine the previous character
else {
character = previousCharacter; // depends on control dependency: [if], data = [none]
previousCharacter = -1; // depends on control dependency: [if], data = [none]
}
// the end of the file was reached
if (character == -1) {
if (html) {
if (html && state == TEXT)
flush();
doc.endDocument(); // depends on control dependency: [if], data = [none]
} else {
throwException("Missing end tag"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// dealing with \n and \r
if (character == '\n' && eol) {
eol = false; // depends on control dependency: [if], data = [none]
continue;
} else if (eol) {
eol = false; // depends on control dependency: [if], data = [none]
} else if (character == '\n') {
lines++; // depends on control dependency: [if], data = [none]
columns = 0; // depends on control dependency: [if], data = [none]
} else if (character == '\r') {
eol = true; // depends on control dependency: [if], data = [none]
character = '\n'; // depends on control dependency: [if], data = [none]
lines++; // depends on control dependency: [if], data = [none]
columns = 0; // depends on control dependency: [if], data = [none]
} else {
columns++; // depends on control dependency: [if], data = [none]
}
switch(state) {
// we are in an unknown state before there's actual content
case UNKNOWN:
if(character == '<') {
saveState(TEXT); // depends on control dependency: [if], data = [none]
state = TAG_ENCOUNTERED; // depends on control dependency: [if], data = [none]
}
break;
// we can encounter any content
case TEXT:
if(character == '<') {
flush(); // depends on control dependency: [if], data = [none]
saveState(state); // depends on control dependency: [if], data = [none]
state = TAG_ENCOUNTERED; // depends on control dependency: [if], data = [none]
} else if(character == '&') {
saveState(state); // depends on control dependency: [if], data = [none]
entity.setLength(0); // depends on control dependency: [if], data = [none]
state = ENTITY; // depends on control dependency: [if], data = [none]
nowhite = true; // depends on control dependency: [if], data = [none]
} else if (Character.isWhitespace((char)character)) {
if (nowhite)
text.append((char)character);
nowhite = false; // depends on control dependency: [if], data = [none]
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
nowhite = true; // depends on control dependency: [if], data = [none]
}
break;
// we have just seen a < and are wondering what we are looking at
// <foo>, </foo>, <!-- ... --->, etc.
case TAG_ENCOUNTERED:
initTag();
if(character == '/') {
state = IN_CLOSETAG; // depends on control dependency: [if], data = [none]
} else if (character == '?') {
restoreState(); // depends on control dependency: [if], data = [none]
state = PI; // depends on control dependency: [if], data = [none]
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
state = EXAMIN_TAG; // depends on control dependency: [if], data = [none]
}
break;
// we are processing something like this <foo ... >.
// It could still be a <!-- ... --> or something.
case EXAMIN_TAG:
if(character == '>') {
doTag(); // depends on control dependency: [if], data = [none]
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else if(character == '/') {
state = SINGLE_TAG; // depends on control dependency: [if], data = [none]
} else if(character == '-' && text.toString().equals("!-")) {
flush(); // depends on control dependency: [if], data = [none]
state = COMMENT; // depends on control dependency: [if], data = [none]
} else if(character == '[' && text.toString().equals("![CDATA")) {
flush(); // depends on control dependency: [if], data = [none]
state = CDATA; // depends on control dependency: [if], data = [none]
} else if(character == 'E' && text.toString().equals("!DOCTYP")) {
flush(); // depends on control dependency: [if], data = [none]
state = PI; // depends on control dependency: [if], data = [none]
} else if(Character.isWhitespace((char)character)) {
doTag(); // depends on control dependency: [if], data = [none]
state = TAG_EXAMINED; // depends on control dependency: [if], data = [none]
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
}
break;
// we know the name of the tag now.
case TAG_EXAMINED:
if(character == '>') {
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else if(character == '/') {
state = SINGLE_TAG; // depends on control dependency: [if], data = [none]
} else if(Character.isWhitespace((char)character)) {
// empty
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
state = ATTRIBUTE_KEY; // depends on control dependency: [if], data = [none]
}
break;
// we are processing a closing tag: e.g. </foo>
case IN_CLOSETAG:
if(character == '>') {
doTag(); // depends on control dependency: [if], data = [none]
processTag(false); // depends on control dependency: [if], data = [none]
if(!html && nested==0) return;
state = restoreState(); // depends on control dependency: [if], data = [none]
} else {
if (!Character.isWhitespace((char)character))
text.append((char)character);
}
break;
// we have just seen something like this: <foo a="b"/
// and are looking for the final >.
case SINGLE_TAG:
if(character != '>')
throwException("Expected > for tag: <"+tag+"/>");
doTag();
processTag(true);
processTag(false);
initTag();
if(!html && nested==0) {
doc.endDocument(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
state = restoreState();
break;
// we are processing CDATA
case CDATA:
if(character == '>'
&& text.toString().endsWith("]]")) {
text.setLength(text.length()-2); // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else
text.append((char)character);
break;
// we are processing a comment. We are inside
// the <!-- .... --> looking for the -->.
case COMMENT:
if(character == '>'
&& text.toString().endsWith("--")) {
text.setLength(text.length() - 2); // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else
text.append((char)character);
break;
// We are inside one of these <? ... ?> or one of these <!DOCTYPE ... >
case PI:
if(character == '>') {
state = restoreState(); // depends on control dependency: [if], data = [none]
if(state == TEXT) state = UNKNOWN;
}
break;
// we are processing an entity, e.g. <, », etc.
case ENTITY:
if(character == ';') {
state = restoreState(); // depends on control dependency: [if], data = [none]
String cent = entity.toString();
entity.setLength(0); // depends on control dependency: [if], data = [none]
char ce = EntitiesToUnicode.decodeEntity(cent);
if (ce == '\0')
text.append('&').append(cent).append(';');
else
text.append(ce);
} else if ((character != '#' && (character < '0' || character > '9') && (character < 'a' || character > 'z')
&& (character < 'A' || character > 'Z')) || entity.length() >= 7) {
state = restoreState(); // depends on control dependency: [if], data = [none]
previousCharacter = character; // depends on control dependency: [if], data = [none]
text.append('&').append(entity.toString()); // depends on control dependency: [if], data = [none]
entity.setLength(0); // depends on control dependency: [if], data = [none]
}
else {
entity.append((char)character); // depends on control dependency: [if], data = [none]
}
break;
// We are processing the quoted right-hand side of an element's attribute.
case QUOTE:
if (html && quoteCharacter == ' ' && character == '>') {
flush(); // depends on control dependency: [if], data = [none]
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
}
else if (html && quoteCharacter == ' ' && Character.isWhitespace((char)character)) {
flush(); // depends on control dependency: [if], data = [none]
state = TAG_EXAMINED; // depends on control dependency: [if], data = [none]
}
else if (html && quoteCharacter == ' ') {
text.append((char)character); // depends on control dependency: [if], data = [none]
}
else if(character == quoteCharacter) {
flush(); // depends on control dependency: [if], data = [none]
state = TAG_EXAMINED; // depends on control dependency: [if], data = [none]
} else if(" \r\n\u0009".indexOf(character)>=0) {
text.append(' '); // depends on control dependency: [if], data = [none]
} else if(character == '&') {
saveState(state); // depends on control dependency: [if], data = [none]
state = ENTITY; // depends on control dependency: [if], data = [none]
entity.setLength(0); // depends on control dependency: [if], data = [none]
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
}
break;
case ATTRIBUTE_KEY:
if(Character.isWhitespace((char)character)) {
flush(); // depends on control dependency: [if], data = [none]
state = ATTRIBUTE_EQUAL; // depends on control dependency: [if], data = [none]
} else if(character == '=') {
flush(); // depends on control dependency: [if], data = [none]
state = ATTRIBUTE_VALUE; // depends on control dependency: [if], data = [none]
} else if (html && character == '>') {
text.setLength(0); // depends on control dependency: [if], data = [none]
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else {
text.append((char)character); // depends on control dependency: [if], data = [none]
}
break;
case ATTRIBUTE_EQUAL:
if(character == '=') {
state = ATTRIBUTE_VALUE; // depends on control dependency: [if], data = [none]
} else if(Character.isWhitespace((char)character)) {
// empty
} else if (html && character == '>') {
text.setLength(0); // depends on control dependency: [if], data = [none]
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else if (html && character == '/') {
flush(); // depends on control dependency: [if], data = [none]
state = SINGLE_TAG; // depends on control dependency: [if], data = [none]
} else if (html) {
flush(); // depends on control dependency: [if], data = [none]
text.append((char)character); // depends on control dependency: [if], data = [none]
state = ATTRIBUTE_KEY; // depends on control dependency: [if], data = [none]
} else {
throwException("Error in attribute processing."); // depends on control dependency: [if], data = [none]
}
break;
case ATTRIBUTE_VALUE:
if(character == '"' || character == '\'') {
quoteCharacter = character; // depends on control dependency: [if], data = [none]
state = QUOTE; // depends on control dependency: [if], data = [none]
} else if(Character.isWhitespace((char)character)) {
// empty
} else if (html && character == '>') {
flush(); // depends on control dependency: [if], data = [none]
processTag(true); // depends on control dependency: [if], data = [none]
initTag(); // depends on control dependency: [if], data = [none]
state = restoreState(); // depends on control dependency: [if], data = [none]
} else if (html) {
text.append((char)character); // depends on control dependency: [if], data = [none]
quoteCharacter = ' '; // depends on control dependency: [if], data = [none]
state = QUOTE; // depends on control dependency: [if], data = [none]
} else {
throwException("Error in attribute processing"); // depends on control dependency: [if], data = [none]
}
break;
}
}
} } |
public class class_name {
public static String tryGetCanonicalPathElseGetAbsolutePath(File file) {
try {
return file.getCanonicalPath();
}
catch (IOException ignore) {
return file.getAbsolutePath();
}
} } | public class class_name {
public static String tryGetCanonicalPathElseGetAbsolutePath(File file) {
try {
return file.getCanonicalPath(); // depends on control dependency: [try], data = [none]
}
catch (IOException ignore) {
return file.getAbsolutePath();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected LinkedList<double[]> computeScoreList(Table table, int current)
{
LinkedList<double[]> scoreList = new LinkedList<double[]>();
for (FeatureTemplate featureTemplate : featureTemplateList)
{
char[] o = featureTemplate.generateParameter(table, current);
FeatureFunction featureFunction = featureFunctionTrie.get(o);
if (featureFunction == null) continue;
scoreList.add(featureFunction.w);
}
return scoreList;
} } | public class class_name {
protected LinkedList<double[]> computeScoreList(Table table, int current)
{
LinkedList<double[]> scoreList = new LinkedList<double[]>();
for (FeatureTemplate featureTemplate : featureTemplateList)
{
char[] o = featureTemplate.generateParameter(table, current);
FeatureFunction featureFunction = featureFunctionTrie.get(o);
if (featureFunction == null) continue;
scoreList.add(featureFunction.w); // depends on control dependency: [for], data = [none]
}
return scoreList;
} } |
public class class_name {
private void reload() {
try {
if (!configFile.exists()) {
LOGGER.warn("Config file deleted " + configFile + ", keeping old config.");
return;
}
LOGGER.trace("Config reload triggered for " + configFile);
if (parentSupplier != null) {
set(loadConfig(parentSupplier.get()));
} else {
set(loadConfig(null));
}
} catch (ProvidenceConfigException e) {
LOGGER.error("Exception when reloading " + configFile, e);
}
} } | public class class_name {
private void reload() {
try {
if (!configFile.exists()) {
LOGGER.warn("Config file deleted " + configFile + ", keeping old config."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LOGGER.trace("Config reload triggered for " + configFile); // depends on control dependency: [try], data = [none]
if (parentSupplier != null) {
set(loadConfig(parentSupplier.get())); // depends on control dependency: [if], data = [(parentSupplier]
} else {
set(loadConfig(null)); // depends on control dependency: [if], data = [null)]
}
} catch (ProvidenceConfigException e) {
LOGGER.error("Exception when reloading " + configFile, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String replaceExpression(String pValue) {
if (pValue == null) {
return null;
}
Matcher matcher = EXPRESSION_EXTRACTOR.matcher(pValue);
StringBuffer ret = new StringBuffer();
try {
while (matcher.find()) {
String var = matcher.group(1);
String value;
if (var.equalsIgnoreCase("host")) {
value = getLocalAddress().getHostName();
} else if (var.equalsIgnoreCase("ip")) {
value = getLocalAddress().getHostAddress();
} else {
String key = extractKey(var,"env");
if (key != null) {
value = System.getenv(key);
} else {
key = extractKey(var,"prop");
if (key != null) {
value = System.getProperty(key);
} else {
throw new IllegalArgumentException("Unknown expression " + var + " in " + pValue);
}
}
}
matcher.appendReplacement(ret, value != null ? value.trim() : null);
}
matcher.appendTail(ret);
} catch (IOException e) {
throw new IllegalArgumentException("Cannot lookup host" + e, e);
}
return ret.toString();
} } | public class class_name {
public static String replaceExpression(String pValue) {
if (pValue == null) {
return null; // depends on control dependency: [if], data = [none]
}
Matcher matcher = EXPRESSION_EXTRACTOR.matcher(pValue);
StringBuffer ret = new StringBuffer();
try {
while (matcher.find()) {
String var = matcher.group(1);
String value;
if (var.equalsIgnoreCase("host")) {
value = getLocalAddress().getHostName(); // depends on control dependency: [if], data = [none]
} else if (var.equalsIgnoreCase("ip")) {
value = getLocalAddress().getHostAddress(); // depends on control dependency: [if], data = [none]
} else {
String key = extractKey(var,"env");
if (key != null) {
value = System.getenv(key); // depends on control dependency: [if], data = [(key]
} else {
key = extractKey(var,"prop"); // depends on control dependency: [if], data = [none]
if (key != null) {
value = System.getProperty(key); // depends on control dependency: [if], data = [(key]
} else {
throw new IllegalArgumentException("Unknown expression " + var + " in " + pValue);
}
}
}
matcher.appendReplacement(ret, value != null ? value.trim() : null); // depends on control dependency: [while], data = [none]
}
matcher.appendTail(ret); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new IllegalArgumentException("Cannot lookup host" + e, e);
} // depends on control dependency: [catch], data = [none]
return ret.toString();
} } |
public class class_name {
public final Object evaluateString(Scriptable scope, String source,
String sourceName, int lineno,
Object securityDomain)
{
Script script = compileString(source, sourceName, lineno,
securityDomain);
if (script != null) {
return script.exec(this, scope);
}
return null;
} } | public class class_name {
public final Object evaluateString(Scriptable scope, String source,
String sourceName, int lineno,
Object securityDomain)
{
Script script = compileString(source, sourceName, lineno,
securityDomain);
if (script != null) {
return script.exec(this, scope); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static Result update(Long id) {
Form<Computer> computerForm = form(Computer.class).bindFromRequest();
if(computerForm.hasErrors()) {
return badRequest(editForm.render(id, computerForm));
}
computerForm.get().update(id);
flash("success", "Computer " + computerForm.get().name + " has been updated");
return GO_HOME;
} } | public class class_name {
public static Result update(Long id) {
Form<Computer> computerForm = form(Computer.class).bindFromRequest();
if(computerForm.hasErrors()) {
return badRequest(editForm.render(id, computerForm)); // depends on control dependency: [if], data = [none]
}
computerForm.get().update(id);
flash("success", "Computer " + computerForm.get().name + " has been updated");
return GO_HOME;
} } |
public class class_name {
public void markAsVisited(final Field field) {
if (field.getAnnotation(Requires.class) != null) {
this.dependantsInJson.add(field);
}
final Field dependant = this.requirementToDependantMap.get(field.getName());
if (dependant != null) {
this.dependantToRequirementsMap.remove(dependant, field.getName());
}
} } | public class class_name {
public void markAsVisited(final Field field) {
if (field.getAnnotation(Requires.class) != null) {
this.dependantsInJson.add(field); // depends on control dependency: [if], data = [none]
}
final Field dependant = this.requirementToDependantMap.get(field.getName());
if (dependant != null) {
this.dependantToRequirementsMap.remove(dependant, field.getName()); // depends on control dependency: [if], data = [(dependant]
}
} } |
public class class_name {
protected void convertNeighbors(DBIDRange ids, DBIDRef ix, boolean square, KNNList neighbours, DoubleArray dist, IntegerArray ind) {
for(DoubleDBIDListIter iter = neighbours.iter(); iter.valid(); iter.advance()) {
if(DBIDUtil.equal(iter, ix)) {
continue; // Skip query point
}
double d = iter.doubleValue();
dist.add(square ? (d * d) : d);
ind.add(ids.getOffset(iter));
}
} } | public class class_name {
protected void convertNeighbors(DBIDRange ids, DBIDRef ix, boolean square, KNNList neighbours, DoubleArray dist, IntegerArray ind) {
for(DoubleDBIDListIter iter = neighbours.iter(); iter.valid(); iter.advance()) {
if(DBIDUtil.equal(iter, ix)) {
continue; // Skip query point
}
double d = iter.doubleValue();
dist.add(square ? (d * d) : d); // depends on control dependency: [for], data = [none]
ind.add(ids.getOffset(iter)); // depends on control dependency: [for], data = [iter]
}
} } |
public class class_name {
@Override
public String getTemplateURI(String controllerName, String templateName, boolean includeExtension) {
if (templateName.startsWith(SLASH_STR)) {
return getAbsoluteTemplateURI(templateName, includeExtension);
}
else if(templateName.startsWith(RELATIVE_STRING)) {
return getRelativeTemplateURIInternal(templateName, includeExtension);
}
FastStringWriter buf = new FastStringWriter();
String pathToTemplate = BLANK;
int lastSlash = templateName.lastIndexOf(SLASH);
if (lastSlash > -1) {
pathToTemplate = templateName.substring(0, lastSlash + 1);
templateName = templateName.substring(lastSlash + 1);
}
if(controllerName != null) {
buf.append(SLASH)
.append(controllerName);
}
buf.append(SLASH)
.append(pathToTemplate)
.append(UNDERSCORE)
.append(templateName);
if(includeExtension) {
return buf.append(EXTENSION).toString();
}
else {
return buf.toString();
}
} } | public class class_name {
@Override
public String getTemplateURI(String controllerName, String templateName, boolean includeExtension) {
if (templateName.startsWith(SLASH_STR)) {
return getAbsoluteTemplateURI(templateName, includeExtension); // depends on control dependency: [if], data = [none]
}
else if(templateName.startsWith(RELATIVE_STRING)) {
return getRelativeTemplateURIInternal(templateName, includeExtension); // depends on control dependency: [if], data = [none]
}
FastStringWriter buf = new FastStringWriter();
String pathToTemplate = BLANK;
int lastSlash = templateName.lastIndexOf(SLASH);
if (lastSlash > -1) {
pathToTemplate = templateName.substring(0, lastSlash + 1); // depends on control dependency: [if], data = [none]
templateName = templateName.substring(lastSlash + 1); // depends on control dependency: [if], data = [(lastSlash]
}
if(controllerName != null) {
buf.append(SLASH)
.append(controllerName); // depends on control dependency: [if], data = [none]
}
buf.append(SLASH)
.append(pathToTemplate)
.append(UNDERSCORE)
.append(templateName);
if(includeExtension) {
return buf.append(EXTENSION).toString(); // depends on control dependency: [if], data = [none]
}
else {
return buf.toString(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final boolean mergeLists(List<UnclosedBranchDescriptor> child1open,
List<UnclosedBranchDescriptor> child2open,
List<UnclosedBranchDescriptor> result,
boolean markJoinedBranchesAsPipelineBreaking) {
//remove branches which have already been closed
removeClosedBranches(child1open);
removeClosedBranches(child2open);
result.clear();
// check how many open branches we have. the cases:
// 1) if both are null or empty, the result is null
// 2) if one side is null (or empty), the result is the other side.
// 3) both are set, then we need to merge.
if (child1open == null || child1open.isEmpty()) {
if(child2open != null && !child2open.isEmpty()) {
result.addAll(child2open);
}
return false;
}
if (child2open == null || child2open.isEmpty()) {
result.addAll(child1open);
return false;
}
int index1 = child1open.size() - 1;
int index2 = child2open.size() - 1;
boolean didCloseABranch = false;
// as both lists (child1open and child2open) are sorted in ascending ID order
// we can do a merge-join-like loop which preserved the order in the result list
// and eliminates duplicates
while (index1 >= 0 || index2 >= 0) {
int id1 = -1;
int id2 = index2 >= 0 ? child2open.get(index2).getBranchingNode().getId() : -1;
while (index1 >= 0 && (id1 = child1open.get(index1).getBranchingNode().getId()) > id2) {
result.add(child1open.get(index1));
index1--;
}
while (index2 >= 0 && (id2 = child2open.get(index2).getBranchingNode().getId()) > id1) {
result.add(child2open.get(index2));
index2--;
}
// match: they share a common branching child
if (id1 == id2) {
didCloseABranch = true;
// if this is the latest common child, remember it
OptimizerNode currBanchingNode = child1open.get(index1).getBranchingNode();
long vector1 = child1open.get(index1).getJoinedPathsVector();
long vector2 = child2open.get(index2).getJoinedPathsVector();
// check if this is the same descriptor, (meaning that it contains the same paths)
// if it is the same, add it only once, otherwise process the join of the paths
if (vector1 == vector2) {
result.add(child1open.get(index1));
}
else {
// we merge (re-join) a branch
// mark the branch as a point where we break the pipeline
if (markJoinedBranchesAsPipelineBreaking) {
currBanchingNode.markAllOutgoingConnectionsAsPipelineBreaking();
}
if (this.hereJoinedBranches == null) {
this.hereJoinedBranches = new ArrayList<OptimizerNode>(2);
}
this.hereJoinedBranches.add(currBanchingNode);
// see, if this node closes the branch
long joinedInputs = vector1 | vector2;
// this is 2^size - 1, which is all bits set at positions 0..size-1
long allInputs = (0x1L << currBanchingNode.getOutgoingConnections().size()) - 1;
if (joinedInputs == allInputs) {
// closed - we can remove it from the stack
addClosedBranch(currBanchingNode);
} else {
// not quite closed
result.add(new UnclosedBranchDescriptor(currBanchingNode, joinedInputs));
}
}
index1--;
index2--;
}
}
// merged. now we need to reverse the list, because we added the elements in reverse order
Collections.reverse(result);
return didCloseABranch;
} } | public class class_name {
protected final boolean mergeLists(List<UnclosedBranchDescriptor> child1open,
List<UnclosedBranchDescriptor> child2open,
List<UnclosedBranchDescriptor> result,
boolean markJoinedBranchesAsPipelineBreaking) {
//remove branches which have already been closed
removeClosedBranches(child1open);
removeClosedBranches(child2open);
result.clear();
// check how many open branches we have. the cases:
// 1) if both are null or empty, the result is null
// 2) if one side is null (or empty), the result is the other side.
// 3) both are set, then we need to merge.
if (child1open == null || child1open.isEmpty()) {
if(child2open != null && !child2open.isEmpty()) {
result.addAll(child2open); // depends on control dependency: [if], data = [(child2open]
}
return false; // depends on control dependency: [if], data = [none]
}
if (child2open == null || child2open.isEmpty()) {
result.addAll(child1open); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
int index1 = child1open.size() - 1;
int index2 = child2open.size() - 1;
boolean didCloseABranch = false;
// as both lists (child1open and child2open) are sorted in ascending ID order
// we can do a merge-join-like loop which preserved the order in the result list
// and eliminates duplicates
while (index1 >= 0 || index2 >= 0) {
int id1 = -1;
int id2 = index2 >= 0 ? child2open.get(index2).getBranchingNode().getId() : -1;
while (index1 >= 0 && (id1 = child1open.get(index1).getBranchingNode().getId()) > id2) {
result.add(child1open.get(index1)); // depends on control dependency: [while], data = [(index1]
index1--; // depends on control dependency: [while], data = [none]
}
while (index2 >= 0 && (id2 = child2open.get(index2).getBranchingNode().getId()) > id1) {
result.add(child2open.get(index2)); // depends on control dependency: [while], data = [(index2]
index2--; // depends on control dependency: [while], data = [none]
}
// match: they share a common branching child
if (id1 == id2) {
didCloseABranch = true; // depends on control dependency: [if], data = [none]
// if this is the latest common child, remember it
OptimizerNode currBanchingNode = child1open.get(index1).getBranchingNode();
long vector1 = child1open.get(index1).getJoinedPathsVector();
long vector2 = child2open.get(index2).getJoinedPathsVector();
// check if this is the same descriptor, (meaning that it contains the same paths)
// if it is the same, add it only once, otherwise process the join of the paths
if (vector1 == vector2) {
result.add(child1open.get(index1)); // depends on control dependency: [if], data = [none]
}
else {
// we merge (re-join) a branch
// mark the branch as a point where we break the pipeline
if (markJoinedBranchesAsPipelineBreaking) {
currBanchingNode.markAllOutgoingConnectionsAsPipelineBreaking(); // depends on control dependency: [if], data = [none]
}
if (this.hereJoinedBranches == null) {
this.hereJoinedBranches = new ArrayList<OptimizerNode>(2); // depends on control dependency: [if], data = [none]
}
this.hereJoinedBranches.add(currBanchingNode); // depends on control dependency: [if], data = [none]
// see, if this node closes the branch
long joinedInputs = vector1 | vector2;
// this is 2^size - 1, which is all bits set at positions 0..size-1
long allInputs = (0x1L << currBanchingNode.getOutgoingConnections().size()) - 1;
if (joinedInputs == allInputs) {
// closed - we can remove it from the stack
addClosedBranch(currBanchingNode); // depends on control dependency: [if], data = [none]
} else {
// not quite closed
result.add(new UnclosedBranchDescriptor(currBanchingNode, joinedInputs)); // depends on control dependency: [if], data = [none]
}
}
index1--; // depends on control dependency: [if], data = [none]
index2--; // depends on control dependency: [if], data = [none]
}
}
// merged. now we need to reverse the list, because we added the elements in reverse order
Collections.reverse(result);
return didCloseABranch;
} } |
public class class_name {
public void marshall(GetSdkTypesRequest getSdkTypesRequest, ProtocolMarshaller protocolMarshaller) {
if (getSdkTypesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSdkTypesRequest.getPosition(), POSITION_BINDING);
protocolMarshaller.marshall(getSdkTypesRequest.getLimit(), LIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetSdkTypesRequest getSdkTypesRequest, ProtocolMarshaller protocolMarshaller) {
if (getSdkTypesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getSdkTypesRequest.getPosition(), POSITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getSdkTypesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void updateAutoGeneratedQueriesPanel()
{
// make sure to make a copy since we are adding items to this set
Set<String> corpora = new HashSet<>(ui.getQueryState().getSelectedCorpora().
getValue());
if (corpora.isEmpty())
{
corpora.addAll(ui.getQueryState().getAvailableCorpora().getItemIds());
}
autoGenQueries.setSelectedCorpusInBackground(corpora);
} } | public class class_name {
private void updateAutoGeneratedQueriesPanel()
{
// make sure to make a copy since we are adding items to this set
Set<String> corpora = new HashSet<>(ui.getQueryState().getSelectedCorpora().
getValue());
if (corpora.isEmpty())
{
corpora.addAll(ui.getQueryState().getAvailableCorpora().getItemIds()); // depends on control dependency: [if], data = [none]
}
autoGenQueries.setSelectedCorpusInBackground(corpora);
} } |
public class class_name {
private static int getPowerSet(int[] set, int inputIndex, int[] sofar, int[][] sets, int outputIndex) {
for (int i = inputIndex; i < set.length; i++) {
int n = sofar == null ? 0 : sofar.length;
if (n < set.length-1) {
int[] subset = new int[n + 1];
subset[n] = set[i];
if (sofar != null) {
System.arraycopy(sofar, 0, subset, 0, n);
}
sets[outputIndex] = subset;
outputIndex = getPowerSet(set, i + 1, subset, sets, outputIndex + 1);
}
}
return outputIndex;
} } | public class class_name {
private static int getPowerSet(int[] set, int inputIndex, int[] sofar, int[][] sets, int outputIndex) {
for (int i = inputIndex; i < set.length; i++) {
int n = sofar == null ? 0 : sofar.length;
if (n < set.length-1) {
int[] subset = new int[n + 1];
subset[n] = set[i]; // depends on control dependency: [if], data = [none]
if (sofar != null) {
System.arraycopy(sofar, 0, subset, 0, n); // depends on control dependency: [if], data = [(sofar]
}
sets[outputIndex] = subset; // depends on control dependency: [if], data = [none]
outputIndex = getPowerSet(set, i + 1, subset, sets, outputIndex + 1); // depends on control dependency: [if], data = [none]
}
}
return outputIndex;
} } |
public class class_name {
public Collection<Line> getPoints()
{
final Collection<Line> list = new ArrayList<>(npoints);
for (int i = 0; i < npoints / 2; i++)
{
list.add(new Line(xpoints[i], ypoints[i], xpoints[i + npoints / 2], ypoints[i + npoints / 2]));
}
return list;
} } | public class class_name {
public Collection<Line> getPoints()
{
final Collection<Line> list = new ArrayList<>(npoints);
for (int i = 0; i < npoints / 2; i++)
{
list.add(new Line(xpoints[i], ypoints[i], xpoints[i + npoints / 2], ypoints[i + npoints / 2]));
// depends on control dependency: [for], data = [i]
}
return list;
} } |
public class class_name {
static synchronized void destroy() {
if (debuggable()) {
hasInit = false;
LogisticsCenter.suspend();
logger.info(Consts.TAG, "ARouter destroy success!");
} else {
logger.error(Consts.TAG, "Destroy can be used in debug mode only!");
}
} } | public class class_name {
static synchronized void destroy() {
if (debuggable()) {
hasInit = false; // depends on control dependency: [if], data = [none]
LogisticsCenter.suspend(); // depends on control dependency: [if], data = [none]
logger.info(Consts.TAG, "ARouter destroy success!"); // depends on control dependency: [if], data = [none]
} else {
logger.error(Consts.TAG, "Destroy can be used in debug mode only!"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean add(Object obj) {
if (obj == null) {
obj = NULL;
}
Entry tab[] = mTable;
int hash = hashCode(obj);
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index], prev = null; e != null; e = e.mNext) {
Object iobj = e.get();
if (iobj == null) {
// Clean up after a cleared Reference.
if (prev != null) {
prev.mNext = e.mNext;
}
else {
tab[index] = e.mNext;
}
mCount--;
}
else if (e.mHash == hash &&
obj.getClass() == iobj.getClass() &&
equals(obj, iobj)) {
// Already in set.
return false;
}
else {
prev = e;
}
}
if (mCount >= mThreshold) {
// Cleanup the table if the threshold is exceeded.
cleanup();
}
if (mCount >= mThreshold) {
// Rehash the table if the threshold is still exceeded.
rehash();
tab = mTable;
index = (hash & 0x7FFFFFFF) % tab.length;
}
// Create a new entry.
tab[index] = new Entry((obj == NULL ? new Null() : obj), hash, tab[index]);
mCount++;
return true;
} } | public class class_name {
public boolean add(Object obj) {
if (obj == null) {
obj = NULL; // depends on control dependency: [if], data = [none]
}
Entry tab[] = mTable;
int hash = hashCode(obj);
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index], prev = null; e != null; e = e.mNext) {
Object iobj = e.get();
if (iobj == null) {
// Clean up after a cleared Reference.
if (prev != null) {
prev.mNext = e.mNext; // depends on control dependency: [if], data = [none]
}
else {
tab[index] = e.mNext; // depends on control dependency: [if], data = [none]
}
mCount--; // depends on control dependency: [if], data = [none]
}
else if (e.mHash == hash &&
obj.getClass() == iobj.getClass() &&
equals(obj, iobj)) {
// Already in set.
return false; // depends on control dependency: [if], data = [none]
}
else {
prev = e; // depends on control dependency: [if], data = [none]
}
}
if (mCount >= mThreshold) {
// Cleanup the table if the threshold is exceeded.
cleanup(); // depends on control dependency: [if], data = [none]
}
if (mCount >= mThreshold) {
// Rehash the table if the threshold is still exceeded.
rehash(); // depends on control dependency: [if], data = [none]
tab = mTable; // depends on control dependency: [if], data = [none]
index = (hash & 0x7FFFFFFF) % tab.length; // depends on control dependency: [if], data = [none]
}
// Create a new entry.
tab[index] = new Entry((obj == NULL ? new Null() : obj), hash, tab[index]);
mCount++;
return true;
} } |
public class class_name {
@Override
public JMSProducer createProducer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createProducer");
JMSProducer jmsProducer = null;
try {
// Create messageproducer first, since we reuse most in jmsproducer
// destination is passed as null because during send,destination is passed
// jmssession.createproducer() is not used becuase it stores the list of producers
// which is not required for simplified API's
MessageProducer msgProducer = jmsSession.instantiateProducer(null);
jmsProducer = new JmsJMSProducerImpl(msgProducer);
} catch (JMSException e) {
// should never have got here because we pass destination as null so there is no chance
// that instantiateProducer() will throw any exception
FFDCFilter.processException(e,
JmsJMSContextImpl.class.toString() + ".createProducer",
"598", this);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createProducer");
return jmsProducer;
} } | public class class_name {
@Override
public JMSProducer createProducer() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "createProducer");
JMSProducer jmsProducer = null;
try {
// Create messageproducer first, since we reuse most in jmsproducer
// destination is passed as null because during send,destination is passed
// jmssession.createproducer() is not used becuase it stores the list of producers
// which is not required for simplified API's
MessageProducer msgProducer = jmsSession.instantiateProducer(null);
jmsProducer = new JmsJMSProducerImpl(msgProducer); // depends on control dependency: [try], data = [none]
} catch (JMSException e) {
// should never have got here because we pass destination as null so there is no chance
// that instantiateProducer() will throw any exception
FFDCFilter.processException(e,
JmsJMSContextImpl.class.toString() + ".createProducer",
"598", this);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "createProducer");
return jmsProducer;
} } |
public class class_name {
public void setRegion(int left, int top, int width, int height) {
if (top < 0 || left < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (height < 1 || width < 1) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int right = left + width;
int bottom = top + height;
if (bottom > this.height || right > this.width) {
throw new IllegalArgumentException("The region must fit inside the matrix");
}
for (int y = top; y < bottom; y++) {
int offset = y * rowSize;
for (int x = left; x < right; x++) {
bits[offset + (x / 32)] |= 1 << (x & 0x1f);
}
}
} } | public class class_name {
public void setRegion(int left, int top, int width, int height) {
if (top < 0 || left < 0) {
throw new IllegalArgumentException("Left and top must be nonnegative");
}
if (height < 1 || width < 1) {
throw new IllegalArgumentException("Height and width must be at least 1");
}
int right = left + width;
int bottom = top + height;
if (bottom > this.height || right > this.width) {
throw new IllegalArgumentException("The region must fit inside the matrix");
}
for (int y = top; y < bottom; y++) {
int offset = y * rowSize;
for (int x = left; x < right; x++) {
bits[offset + (x / 32)] |= 1 << (x & 0x1f); // depends on control dependency: [for], data = [x]
}
}
} } |
public class class_name {
public static <T extends ImageGray<T>>
FastCornerDetector<T> fast(int pixelTol, int minCont, Class<T> imageType)
{
FastCornerInterface helper;
if( imageType == GrayF32.class ) {
if (minCont == 9) {
helper = new ImplFastCorner9_F32(pixelTol);
} else if (minCont == 10) {
helper = new ImplFastCorner10_F32(pixelTol);
} else if (minCont == 11) {
helper = new ImplFastCorner11_F32(pixelTol);
} else if (minCont == 12) {
helper = new ImplFastCorner12_F32(pixelTol);
} else {
throw new IllegalArgumentException("Specified minCont is not supported");
}
} else if( imageType == GrayU8.class ){
if (minCont == 9) {
helper = new ImplFastCorner9_U8(pixelTol);
} else if (minCont == 10) {
helper = new ImplFastCorner10_U8(pixelTol);
} else if (minCont == 11) {
helper = new ImplFastCorner11_U8(pixelTol);
} else if (minCont == 12) {
helper = new ImplFastCorner12_U8(pixelTol);
} else {
throw new IllegalArgumentException("Specified minCont is not supported");
}
} else {
throw new IllegalArgumentException("Unknown image type");
}
return new FastCornerDetector(helper);
} } | public class class_name {
public static <T extends ImageGray<T>>
FastCornerDetector<T> fast(int pixelTol, int minCont, Class<T> imageType)
{
FastCornerInterface helper;
if( imageType == GrayF32.class ) {
if (minCont == 9) {
helper = new ImplFastCorner9_F32(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 10) {
helper = new ImplFastCorner10_F32(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 11) {
helper = new ImplFastCorner11_F32(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 12) {
helper = new ImplFastCorner12_F32(pixelTol); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Specified minCont is not supported");
}
} else if( imageType == GrayU8.class ){
if (minCont == 9) {
helper = new ImplFastCorner9_U8(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 10) {
helper = new ImplFastCorner10_U8(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 11) {
helper = new ImplFastCorner11_U8(pixelTol); // depends on control dependency: [if], data = [none]
} else if (minCont == 12) {
helper = new ImplFastCorner12_U8(pixelTol); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Specified minCont is not supported");
}
} else {
throw new IllegalArgumentException("Unknown image type");
}
return new FastCornerDetector(helper);
} } |
public class class_name {
protected String buildQueryString(Request request)
{
MultiMap resolvedParameters = null;
if(parameterFactory != null)
{
resolvedParameters = parameterFactory.getParameters();
}
if(hasEntries(resolvedParameters))
resolvedParameters = resolvedParameters.merge(request.getParameters());
else
resolvedParameters = request.getParameters();
if(authorizationFactory != null)
{
MultiMap authEntries = authorizationFactory.getParameters();
if(hasEntries(authEntries))
resolvedParameters = resolvedParameters.merge(authEntries);
}
int ct = 0;
StringBuilder sb = new StringBuilder(512);
for (Map.Entry<String, List<String>> entry : resolvedParameters.entries())
{
for (String value : entry.getValue())
{
if(ct++ > 0)
sb.append("&");
sb.append(encode(entry.getKey())).append("=").append(encode(value));
}
}
return sb.toString();
} } | public class class_name {
protected String buildQueryString(Request request)
{
MultiMap resolvedParameters = null;
if(parameterFactory != null)
{
resolvedParameters = parameterFactory.getParameters(); // depends on control dependency: [if], data = [none]
}
if(hasEntries(resolvedParameters))
resolvedParameters = resolvedParameters.merge(request.getParameters());
else
resolvedParameters = request.getParameters();
if(authorizationFactory != null)
{
MultiMap authEntries = authorizationFactory.getParameters();
if(hasEntries(authEntries))
resolvedParameters = resolvedParameters.merge(authEntries);
}
int ct = 0;
StringBuilder sb = new StringBuilder(512);
for (Map.Entry<String, List<String>> entry : resolvedParameters.entries())
{
for (String value : entry.getValue())
{
if(ct++ > 0)
sb.append("&");
sb.append(encode(entry.getKey())).append("=").append(encode(value)); // depends on control dependency: [for], data = [value]
}
}
return sb.toString();
} } |
public class class_name {
public boolean isToBeIgnored()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isToBeIgnored");
SibTr.exit(tc, "isToBeIgnored", Boolean.valueOf(_toBeIgnored));
}
return _toBeIgnored;
} } | public class class_name {
public boolean isToBeIgnored()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(tc, "isToBeIgnored"); // depends on control dependency: [if], data = [none]
SibTr.exit(tc, "isToBeIgnored", Boolean.valueOf(_toBeIgnored)); // depends on control dependency: [if], data = [none]
}
return _toBeIgnored;
} } |
public class class_name {
private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
int newScrollDirection;
if (newScrollPosition < oldScrollPosition) {
newScrollDirection = SCROLL_TO_TOP;
} else {
newScrollDirection = SCROLL_TO_BOTTOM;
}
if (directionHasChanged(newScrollDirection)) {
translateYAnimatedView(newScrollDirection);
}
} } | public class class_name {
private void onScrollPositionChanged(int oldScrollPosition, int newScrollPosition) {
int newScrollDirection;
if (newScrollPosition < oldScrollPosition) {
newScrollDirection = SCROLL_TO_TOP; // depends on control dependency: [if], data = [none]
} else {
newScrollDirection = SCROLL_TO_BOTTOM; // depends on control dependency: [if], data = [none]
}
if (directionHasChanged(newScrollDirection)) {
translateYAnimatedView(newScrollDirection); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int create(User registrar) throws IdentityException, InvalidArgumentException {
if (this.deleted) {
throw new IdentityException("Identity has been deleted");
}
if (registrar == null) {
throw new InvalidArgumentException("Registrar should be a valid member");
}
String createURL = "";
try {
createURL = client.getURL(HFCA_IDENTITY);
logger.debug(format("identity url: %s, registrar: %s", createURL, registrar.getName()));
String body = client.toJson(idToJsonObject());
JsonObject result = client.httpPost(createURL, body, registrar);
statusCode = result.getInt("statusCode");
if (statusCode < 400) {
getHFCAIdentity(result);
logger.debug(format("identity url: %s, registrar: %s done.", createURL, registrar));
}
this.deleted = false;
return statusCode;
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while creating user '%s' from url '%s': %s", e.getStatusCode(), getEnrollmentId(), createURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
} catch (Exception e) {
String msg = format("Error while creating user '%s' from url '%s': %s", getEnrollmentId(), createURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
}
} } | public class class_name {
public int create(User registrar) throws IdentityException, InvalidArgumentException {
if (this.deleted) {
throw new IdentityException("Identity has been deleted");
}
if (registrar == null) {
throw new InvalidArgumentException("Registrar should be a valid member");
}
String createURL = "";
try {
createURL = client.getURL(HFCA_IDENTITY);
logger.debug(format("identity url: %s, registrar: %s", createURL, registrar.getName()));
String body = client.toJson(idToJsonObject());
JsonObject result = client.httpPost(createURL, body, registrar);
statusCode = result.getInt("statusCode");
if (statusCode < 400) {
getHFCAIdentity(result); // depends on control dependency: [if], data = [none]
logger.debug(format("identity url: %s, registrar: %s done.", createURL, registrar)); // depends on control dependency: [if], data = [none]
}
this.deleted = false;
return statusCode;
} catch (HTTPException e) {
String msg = format("[Code: %d] - Error while creating user '%s' from url '%s': %s", e.getStatusCode(), getEnrollmentId(), createURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
} catch (Exception e) {
String msg = format("Error while creating user '%s' from url '%s': %s", getEnrollmentId(), createURL, e.getMessage());
IdentityException identityException = new IdentityException(msg, e);
logger.error(msg);
throw identityException;
}
} } |
public class class_name {
public boolean handleBegin(TagContext context)
{
WikiParameters params = context.getParams();
MacroInfo macroInfo = (MacroInfo) context.getTagStack().getStackParameter(MACRO_INFO);
boolean withNonGeneratedContent = false;
if (isMetaDataElement(params)) {
MetaData metaData = createMetaData(params);
if (metaData.contains(MetaData.SYNTAX)) {
String currentSyntax = (String) metaData.getMetaData(MetaData.SYNTAX);
context.getTagStack().pushStackParameter(CURRENT_SYNTAX, currentSyntax);
}
if (metaData.contains(MetaData.NON_GENERATED_CONTENT)) {
String currentSyntaxParameter = this.getSyntax(context);
try {
PrintRenderer renderer = this.componentManager.getInstance(PrintRenderer.class,
currentSyntaxParameter);
DefaultWikiPrinter printer = new DefaultWikiPrinter();
renderer.setPrinter(printer);
Listener listener;
if (context.getTagStack().isInsideBlockElement()) {
listener = new InlineFilterListener();
((InlineFilterListener) listener).setWrappedListener(renderer);
} else {
listener = renderer;
}
XWikiGeneratorListener xWikiGeneratorListener = this.parser.createXWikiGeneratorListener(listener,
null);
context.getTagStack().pushScannerContext(new WikiScannerContext(xWikiGeneratorListener));
context.getTagStack().getScannerContext().beginDocument();
withNonGeneratedContent = true;
if (metaData.contains(MetaData.PARAMETER_NAME)) {
context.getTagStack().pushStackParameter(PARAMETER_CONTENT_NAME,
metaData.getMetaData(MetaData.PARAMETER_NAME));
}
} catch (ComponentLookupException e) {
this.logger.error("Error while getting the appropriate renderer for syntax [{}]",
currentSyntaxParameter, e);
}
}
}
context.getTagStack().pushStackParameter(NON_GENERATED_CONTENT_STACK, withNonGeneratedContent);
return withNonGeneratedContent || macroInfo != null;
} } | public class class_name {
public boolean handleBegin(TagContext context)
{
WikiParameters params = context.getParams();
MacroInfo macroInfo = (MacroInfo) context.getTagStack().getStackParameter(MACRO_INFO);
boolean withNonGeneratedContent = false;
if (isMetaDataElement(params)) {
MetaData metaData = createMetaData(params);
if (metaData.contains(MetaData.SYNTAX)) {
String currentSyntax = (String) metaData.getMetaData(MetaData.SYNTAX);
context.getTagStack().pushStackParameter(CURRENT_SYNTAX, currentSyntax); // depends on control dependency: [if], data = [none]
}
if (metaData.contains(MetaData.NON_GENERATED_CONTENT)) {
String currentSyntaxParameter = this.getSyntax(context);
try {
PrintRenderer renderer = this.componentManager.getInstance(PrintRenderer.class,
currentSyntaxParameter);
DefaultWikiPrinter printer = new DefaultWikiPrinter();
renderer.setPrinter(printer); // depends on control dependency: [try], data = [none]
Listener listener;
if (context.getTagStack().isInsideBlockElement()) {
listener = new InlineFilterListener(); // depends on control dependency: [if], data = [none]
((InlineFilterListener) listener).setWrappedListener(renderer); // depends on control dependency: [if], data = [none]
} else {
listener = renderer; // depends on control dependency: [if], data = [none]
}
XWikiGeneratorListener xWikiGeneratorListener = this.parser.createXWikiGeneratorListener(listener,
null);
context.getTagStack().pushScannerContext(new WikiScannerContext(xWikiGeneratorListener)); // depends on control dependency: [try], data = [none]
context.getTagStack().getScannerContext().beginDocument(); // depends on control dependency: [try], data = [none]
withNonGeneratedContent = true; // depends on control dependency: [try], data = [none]
if (metaData.contains(MetaData.PARAMETER_NAME)) {
context.getTagStack().pushStackParameter(PARAMETER_CONTENT_NAME,
metaData.getMetaData(MetaData.PARAMETER_NAME)); // depends on control dependency: [if], data = [none]
}
} catch (ComponentLookupException e) {
this.logger.error("Error while getting the appropriate renderer for syntax [{}]",
currentSyntaxParameter, e);
} // depends on control dependency: [catch], data = [none]
}
}
context.getTagStack().pushStackParameter(NON_GENERATED_CONTENT_STACK, withNonGeneratedContent);
return withNonGeneratedContent || macroInfo != null;
} } |
public class class_name {
public void set(SortedSet<? extends Number> collection) {
this.values = null;
this.size = 0;
for (final Number number : collection) {
final int e = number.intValue();
if ((this.values != null) && (e == this.values[this.values.length - 1] + 1)) {
// Same group
++this.values[this.values.length - 1];
++this.size;
}
if ((this.values != null) && (e > this.values[this.values.length - 1] + 1)) {
// Create a new group
final int[] newTab = new int[this.values.length + 2];
System.arraycopy(this.values, 0, newTab, 0, this.values.length);
newTab[newTab.length - 2] = e;
newTab[newTab.length - 1] = newTab[newTab.length - 2];
this.values = newTab;
++this.size;
} else if (this.values == null) {
// Add the first group
this.values = new int[] {e, e};
this.size = 1;
}
}
} } | public class class_name {
public void set(SortedSet<? extends Number> collection) {
this.values = null;
this.size = 0;
for (final Number number : collection) {
final int e = number.intValue();
if ((this.values != null) && (e == this.values[this.values.length - 1] + 1)) {
// Same group
++this.values[this.values.length - 1]; // depends on control dependency: [if], data = [none]
++this.size; // depends on control dependency: [if], data = [none]
}
if ((this.values != null) && (e > this.values[this.values.length - 1] + 1)) {
// Create a new group
final int[] newTab = new int[this.values.length + 2];
System.arraycopy(this.values, 0, newTab, 0, this.values.length); // depends on control dependency: [if], data = [none]
newTab[newTab.length - 2] = e; // depends on control dependency: [if], data = [none]
newTab[newTab.length - 1] = newTab[newTab.length - 2]; // depends on control dependency: [if], data = [none]
this.values = newTab; // depends on control dependency: [if], data = [none]
++this.size; // depends on control dependency: [if], data = [none]
} else if (this.values == null) {
// Add the first group
this.values = new int[] {e, e}; // depends on control dependency: [if], data = [none]
this.size = 1; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
final void firePropertyChange(String property, Object oldValue,
Object newValue)
{
Object listeners = propertyListeners;
if (listeners != null) {
firePropertyChangeImpl(listeners, property, oldValue, newValue);
}
} } | public class class_name {
final void firePropertyChange(String property, Object oldValue,
Object newValue)
{
Object listeners = propertyListeners;
if (listeners != null) {
firePropertyChangeImpl(listeners, property, oldValue, newValue); // depends on control dependency: [if], data = [(listeners]
}
} } |
public class class_name {
private static char[] chars(byte[] bytes) {
char[] chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
int pos = bytes[i] & 0xff;
chars[i] = (char) pos;
}
return chars;
} } | public class class_name {
private static char[] chars(byte[] bytes) {
char[] chars = new char[bytes.length];
for (int i = 0; i < bytes.length; i++) {
int pos = bytes[i] & 0xff;
chars[i] = (char) pos; // depends on control dependency: [for], data = [i]
}
return chars;
} } |
public class class_name {
private List<ContextHandler> collectResourceHandlers() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
final List<ContextHandler> resourceHandlers = new LinkedList<>();
final String resourceHandlerList = Settings.ResourceHandlers.getValue();
if (resourceHandlerList != null) {
for (String resourceHandlerName : resourceHandlerList.split("[ \\t]+")) {
if (StringUtils.isNotBlank(resourceHandlerName)) {
final String contextPath = Settings.getOrCreateStringSetting(resourceHandlerName, "contextPath").getValue();
if (contextPath != null) {
final String resourceBase = Settings.getOrCreateStringSetting(resourceHandlerName, "resourceBase").getValue();
if (resourceBase != null) {
final ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setDirectoriesListed(Settings.getBooleanSetting(resourceHandlerName, "directoriesListed").getValue());
final String welcomeFiles = Settings.getOrCreateStringSetting(resourceHandlerName, "welcomeFiles").getValue();
if (welcomeFiles != null) {
resourceHandler.setWelcomeFiles(StringUtils.split(welcomeFiles));
}
resourceHandler.setResourceBase(resourceBase);
resourceHandler.setCacheControl("max-age=0");
//resourceHandler.setEtags(true);
final ContextHandler staticResourceHandler = new ContextHandler();
staticResourceHandler.setContextPath(contextPath);
staticResourceHandler.setHandler(resourceHandler);
resourceHandlers.add(staticResourceHandler);
} else {
logger.warn("Unable to register resource handler {}, missing {}.resourceBase", resourceHandlerName, resourceHandlerName);
}
} else {
logger.warn("Unable to register resource handler {}, missing {}.contextPath", resourceHandlerName, resourceHandlerName);
}
}
}
} else {
logger.warn("No resource handlers configured for HttpService.");
}
return resourceHandlers;
} } | public class class_name {
private List<ContextHandler> collectResourceHandlers() throws ClassNotFoundException, InstantiationException, IllegalAccessException {
final List<ContextHandler> resourceHandlers = new LinkedList<>();
final String resourceHandlerList = Settings.ResourceHandlers.getValue();
if (resourceHandlerList != null) {
for (String resourceHandlerName : resourceHandlerList.split("[ \\t]+")) {
if (StringUtils.isNotBlank(resourceHandlerName)) {
final String contextPath = Settings.getOrCreateStringSetting(resourceHandlerName, "contextPath").getValue();
if (contextPath != null) {
final String resourceBase = Settings.getOrCreateStringSetting(resourceHandlerName, "resourceBase").getValue();
if (resourceBase != null) {
final ResourceHandler resourceHandler = new ResourceHandler();
resourceHandler.setDirectoriesListed(Settings.getBooleanSetting(resourceHandlerName, "directoriesListed").getValue()); // depends on control dependency: [if], data = [none]
final String welcomeFiles = Settings.getOrCreateStringSetting(resourceHandlerName, "welcomeFiles").getValue();
if (welcomeFiles != null) {
resourceHandler.setWelcomeFiles(StringUtils.split(welcomeFiles)); // depends on control dependency: [if], data = [(welcomeFiles]
}
resourceHandler.setResourceBase(resourceBase); // depends on control dependency: [if], data = [(resourceBase]
resourceHandler.setCacheControl("max-age=0"); // depends on control dependency: [if], data = [none]
//resourceHandler.setEtags(true);
final ContextHandler staticResourceHandler = new ContextHandler();
staticResourceHandler.setContextPath(contextPath); // depends on control dependency: [if], data = [none]
staticResourceHandler.setHandler(resourceHandler); // depends on control dependency: [if], data = [none]
resourceHandlers.add(staticResourceHandler); // depends on control dependency: [if], data = [none]
} else {
logger.warn("Unable to register resource handler {}, missing {}.resourceBase", resourceHandlerName, resourceHandlerName); // depends on control dependency: [if], data = [none]
}
} else {
logger.warn("Unable to register resource handler {}, missing {}.contextPath", resourceHandlerName, resourceHandlerName); // depends on control dependency: [if], data = [none]
}
}
}
} else {
logger.warn("No resource handlers configured for HttpService.");
}
return resourceHandlers;
} } |
public class class_name {
public void marshall(JobExecution jobExecution, ProtocolMarshaller protocolMarshaller) {
if (jobExecution == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobExecution.getJobId(), JOBID_BINDING);
protocolMarshaller.marshall(jobExecution.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(jobExecution.getForceCanceled(), FORCECANCELED_BINDING);
protocolMarshaller.marshall(jobExecution.getStatusDetails(), STATUSDETAILS_BINDING);
protocolMarshaller.marshall(jobExecution.getThingArn(), THINGARN_BINDING);
protocolMarshaller.marshall(jobExecution.getQueuedAt(), QUEUEDAT_BINDING);
protocolMarshaller.marshall(jobExecution.getStartedAt(), STARTEDAT_BINDING);
protocolMarshaller.marshall(jobExecution.getLastUpdatedAt(), LASTUPDATEDAT_BINDING);
protocolMarshaller.marshall(jobExecution.getExecutionNumber(), EXECUTIONNUMBER_BINDING);
protocolMarshaller.marshall(jobExecution.getVersionNumber(), VERSIONNUMBER_BINDING);
protocolMarshaller.marshall(jobExecution.getApproximateSecondsBeforeTimedOut(), APPROXIMATESECONDSBEFORETIMEDOUT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(JobExecution jobExecution, ProtocolMarshaller protocolMarshaller) {
if (jobExecution == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(jobExecution.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getForceCanceled(), FORCECANCELED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getStatusDetails(), STATUSDETAILS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getThingArn(), THINGARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getQueuedAt(), QUEUEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getStartedAt(), STARTEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getLastUpdatedAt(), LASTUPDATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getExecutionNumber(), EXECUTIONNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getVersionNumber(), VERSIONNUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(jobExecution.getApproximateSecondsBeforeTimedOut(), APPROXIMATESECONDSBEFORETIMEDOUT_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 marshall(EncryptionConfiguration encryptionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (encryptionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(encryptionConfiguration.getNoEncryptionConfig(), NOENCRYPTIONCONFIG_BINDING);
protocolMarshaller.marshall(encryptionConfiguration.getKMSEncryptionConfig(), KMSENCRYPTIONCONFIG_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(EncryptionConfiguration encryptionConfiguration, ProtocolMarshaller protocolMarshaller) {
if (encryptionConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(encryptionConfiguration.getNoEncryptionConfig(), NOENCRYPTIONCONFIG_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(encryptionConfiguration.getKMSEncryptionConfig(), KMSENCRYPTIONCONFIG_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 updateImpl(List<Metric> metrics) {
Preconditions.checkNotNull(metrics, "metrics");
File file = new File(dir, fileFormat.format(new Date(clock.now())));
Writer out = null;
try {
try {
LOGGER.debug("writing {} metrics to file {}", metrics.size(), file);
OutputStream fileOut = new FileOutputStream(file, true);
if (compress) {
fileOut = new GZIPOutputStream(fileOut);
}
out = new OutputStreamWriter(fileOut, "UTF-8");
for (Metric m : metrics) {
out.append(m.getConfig().getName()).append('\t')
.append(m.getConfig().getTags().toString()).append('\t')
.append(m.getValue().toString()).append('\n');
}
} catch (Throwable t) {
if (out != null) {
out.close();
out = null;
}
throw Throwables.propagate(t);
} finally {
if (out != null) {
out.close();
}
}
} catch (IOException e) {
incrementFailedCount();
LOGGER.error("failed to write update to file " + file, e);
}
} } | public class class_name {
public void updateImpl(List<Metric> metrics) {
Preconditions.checkNotNull(metrics, "metrics");
File file = new File(dir, fileFormat.format(new Date(clock.now())));
Writer out = null;
try {
try {
LOGGER.debug("writing {} metrics to file {}", metrics.size(), file); // depends on control dependency: [try], data = [none]
OutputStream fileOut = new FileOutputStream(file, true);
if (compress) {
fileOut = new GZIPOutputStream(fileOut); // depends on control dependency: [if], data = [none]
}
out = new OutputStreamWriter(fileOut, "UTF-8"); // depends on control dependency: [try], data = [none]
for (Metric m : metrics) {
out.append(m.getConfig().getName()).append('\t')
.append(m.getConfig().getTags().toString()).append('\t')
.append(m.getValue().toString()).append('\n'); // depends on control dependency: [for], data = [m]
}
} catch (Throwable t) {
if (out != null) {
out.close(); // depends on control dependency: [if], data = [none]
out = null; // depends on control dependency: [if], data = [none]
}
throw Throwables.propagate(t);
} finally { // depends on control dependency: [catch], data = [none]
if (out != null) {
out.close(); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException e) {
incrementFailedCount();
LOGGER.error("failed to write update to file " + file, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void processConfigProps(Map<String, Object> props) {
if (props == null || props.isEmpty())
return;
id = (String) props.get(CFG_KEY_ID);
if (id == null) {
Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL");
return;
}
rolePids = (String[]) props.get(CFG_KEY_ROLE);
// if (rolePids == null || rolePids.length < 1)
// return;
processRolePids();
} } | public class class_name {
private void processConfigProps(Map<String, Object> props) {
if (props == null || props.isEmpty())
return;
id = (String) props.get(CFG_KEY_ID);
if (id == null) {
Tr.error(tc, "AUTHZ_ROLE_ID_IS_NULL"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
rolePids = (String[]) props.get(CFG_KEY_ROLE);
// if (rolePids == null || rolePids.length < 1)
// return;
processRolePids();
} } |
public class class_name {
@Override
public void validateAllocator() {
if (topSize < 0) {
return;
}
traverseAndCheck();
for (int i = 0; i < smallBins.length; i++) {
checkSmallBin(i);
}
for (int i = 0; i < treeBins.length; i++) {
checkTreeBin(i);
}
} } | public class class_name {
@Override
public void validateAllocator() {
if (topSize < 0) {
return; // depends on control dependency: [if], data = [none]
}
traverseAndCheck();
for (int i = 0; i < smallBins.length; i++) {
checkSmallBin(i); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < treeBins.length; i++) {
checkTreeBin(i); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private void runPreStepCommand(File bomFile) {
String directory = bomFile.getParent();
String[] gradleCommandParams = gradleCli.getGradleCommandParams(GradleMvnCommand.COPY_DEPENDENCIES);
if (StringUtils.isNotEmpty(directory) && gradleCommandParams.length > 0) {
gradleCli.runGradleCmd(directory, gradleCommandParams, true);
} else {
logger.warn("Could not run gradle command");
}
} } | public class class_name {
private void runPreStepCommand(File bomFile) {
String directory = bomFile.getParent();
String[] gradleCommandParams = gradleCli.getGradleCommandParams(GradleMvnCommand.COPY_DEPENDENCIES);
if (StringUtils.isNotEmpty(directory) && gradleCommandParams.length > 0) {
gradleCli.runGradleCmd(directory, gradleCommandParams, true); // depends on control dependency: [if], data = [none]
} else {
logger.warn("Could not run gradle command"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void setFormValue(Object value) {
if (value instanceof List<?>) {
List<String> keys = (List<String>)value;
Set<String> keySet = new HashSet<String>(keys);
int i = 0;
for (Map.Entry<String, String> entry : m_items.entrySet()) {
String key = entry.getKey();
CmsCheckBox checkbox = m_checkboxes.get(i);
checkbox.setChecked(keySet.contains(key));
i += 1;
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void setFormValue(Object value) {
if (value instanceof List<?>) {
List<String> keys = (List<String>)value;
Set<String> keySet = new HashSet<String>(keys);
int i = 0;
for (Map.Entry<String, String> entry : m_items.entrySet()) {
String key = entry.getKey();
CmsCheckBox checkbox = m_checkboxes.get(i);
checkbox.setChecked(keySet.contains(key)); // depends on control dependency: [for], data = [none]
i += 1; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public void setSupportedOperations(java.util.Collection<SupportedOperation> supportedOperations) {
if (supportedOperations == null) {
this.supportedOperations = null;
return;
}
this.supportedOperations = new com.amazonaws.internal.SdkInternalList<SupportedOperation>(supportedOperations);
} } | public class class_name {
public void setSupportedOperations(java.util.Collection<SupportedOperation> supportedOperations) {
if (supportedOperations == null) {
this.supportedOperations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.supportedOperations = new com.amazonaws.internal.SdkInternalList<SupportedOperation>(supportedOperations);
} } |
public class class_name {
public void addBcc(String bcc) {
if (this.bcc.length() > 0) {
this.bcc.append(",");
}
this.bcc.append(bcc);
} } | public class class_name {
public void addBcc(String bcc) {
if (this.bcc.length() > 0) {
this.bcc.append(","); // depends on control dependency: [if], data = [none]
}
this.bcc.append(bcc);
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.