code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
Object[] mosim(double S[][], double SF[][], int SR[], int n, double minn[], double maxn[]) {
int lenS = S[0].length;
int lenSF = SF[0].length;
// int e = S.length;
int r = lenS + lenSF + 1;
// Define Simplex .. Simplex = [S SF SR];
double Simplex[][] = new double[S.length][lenS + lenSF + 1];
for (int i = 0; i < S.length; i++) {
for (int j = 0; j < lenS; j++) {
Simplex[i][j] = S[i][j];
}
for (int j = 0; j < lenSF; j++) {
Simplex[i][lenS + j] = SF[i][j];
}
Simplex[i][lenS + lenSF] = (double) SR[i];
}
// Sort Simplex
sort(Simplex, r - 1);
//Assing function values for worst point in Simplex
double Fw[] = new double[lenSF];
for (int i = 0; i < lenSF; i++) {
Fw[i] = Simplex[Simplex.length - 1][n + i];
}
// Assing parameter values worst ranked point in Simplex
double Sw[] = new double[n];
for (int i = 0; i < n; i++) {
Sw[i] = Simplex[Simplex.length - 1][i];
}
double Sg[] = new double[n];
// Compute centroid of Simplex after excluding the worst ranked point
for (int i = 0; i < n; i++) {
Sg[i] = 0;
for (int j = 0; j < Simplex.length - 1; j++) {
Sg[i] += Simplex[j][i];
}
Sg[i] /= (double) (Simplex.length - 1);
}
// Compute Reflection step
double Sref[] = new double[n];
for (int i = 0; i < n; i++) {
Sref[i] = 2 * Sg[i] - Sw[i];
}
boolean accept = isSampleValid(Sref);
double Snew[], Fnew[];
if (!accept) {
// Compute contraction step
double Scon[] = new double[n];
for (int i = 0; i < n; i++) {
Scon[i] = 0.5 * Sg[i] + 0.5 * Sw[i];
}
accept = isSampleValid(Scon);
//if it fails again, try a mutation
while (!accept) {
double newpar[][] = lhsu(this.lowBound, this.upBound, 1);
Scon = newpar[0];
accept = isSampleValid(Scon);
}
double Fcon[] = compob(Scon);
Snew = Scon;
Fnew = Fcon;
// Update number of function evaluations
} else {
// Compute corresponding objective function values
double Fref[] = compob(Sref);
double SimplexTmp[][] = new double[Simplex.length][lenSF];
for (int j = 0; j < lenSF; j++) {
for (int i = 0; i < Simplex.length - 1; i++) {
SimplexTmp[i][j] = Simplex[i][n + j];
}
SimplexTmp[Simplex.length - 1][j] = Fref[j];
}
// Test for non dominance
Object ret[] = parrank(SimplexTmp, 2); // 2 ist possible wrong
int Rref[] = (int[]) ret[0];
int Rrefmax = Integer.MIN_VALUE;
for (int i = 0; i < Rref.length - 1; i++) {
if (Rref[i] > Rrefmax) {
Rrefmax = Rref[i];
}
}
if (Rref[Rref.length - 1] <= Rrefmax) {
Snew = Sref;
Fnew = Fref;
} else {
// Compute contraction step
double Scon[] = new double[n];
for (int i = 0; i < n; i++) {
Scon[i] = 0.5 * Sg[i] + 0.5 * Sw[i];
}
accept = isSampleValid(Scon);
//if it fails again, try a mutation
while (!accept) {
double newpar[][] = lhsu(this.lowBound, this.upBound, 1);
Scon = newpar[0];
accept = isSampleValid(Scon);
}
// Compute corresponding objective function values
double Fcon[] = compob(Scon);
Snew = Scon;
Fnew = Fcon;
}
}
for (int i = 0; i < n; i++) {
S[S.length - 1][i] = Snew[i];
}
for (int i = 0; i < SF[0].length; i++) {
SF[SF.length - 1][i] = Fnew[i];
}
return new Object[]{S, SF};
} }
|
public class class_name {
Object[] mosim(double S[][], double SF[][], int SR[], int n, double minn[], double maxn[]) {
int lenS = S[0].length;
int lenSF = SF[0].length;
// int e = S.length;
int r = lenS + lenSF + 1;
// Define Simplex .. Simplex = [S SF SR];
double Simplex[][] = new double[S.length][lenS + lenSF + 1];
for (int i = 0; i < S.length; i++) {
for (int j = 0; j < lenS; j++) {
Simplex[i][j] = S[i][j]; // depends on control dependency: [for], data = [j]
}
for (int j = 0; j < lenSF; j++) {
Simplex[i][lenS + j] = SF[i][j]; // depends on control dependency: [for], data = [j]
}
Simplex[i][lenS + lenSF] = (double) SR[i]; // depends on control dependency: [for], data = [i]
}
// Sort Simplex
sort(Simplex, r - 1);
//Assing function values for worst point in Simplex
double Fw[] = new double[lenSF];
for (int i = 0; i < lenSF; i++) {
Fw[i] = Simplex[Simplex.length - 1][n + i]; // depends on control dependency: [for], data = [i]
}
// Assing parameter values worst ranked point in Simplex
double Sw[] = new double[n];
for (int i = 0; i < n; i++) {
Sw[i] = Simplex[Simplex.length - 1][i]; // depends on control dependency: [for], data = [i]
}
double Sg[] = new double[n];
// Compute centroid of Simplex after excluding the worst ranked point
for (int i = 0; i < n; i++) {
Sg[i] = 0; // depends on control dependency: [for], data = [i]
for (int j = 0; j < Simplex.length - 1; j++) {
Sg[i] += Simplex[j][i]; // depends on control dependency: [for], data = [j]
}
Sg[i] /= (double) (Simplex.length - 1); // depends on control dependency: [for], data = [i]
}
// Compute Reflection step
double Sref[] = new double[n];
for (int i = 0; i < n; i++) {
Sref[i] = 2 * Sg[i] - Sw[i]; // depends on control dependency: [for], data = [i]
}
boolean accept = isSampleValid(Sref);
double Snew[], Fnew[];
if (!accept) {
// Compute contraction step
double Scon[] = new double[n];
for (int i = 0; i < n; i++) {
Scon[i] = 0.5 * Sg[i] + 0.5 * Sw[i]; // depends on control dependency: [for], data = [i]
}
accept = isSampleValid(Scon); // depends on control dependency: [if], data = [none]
//if it fails again, try a mutation
while (!accept) {
double newpar[][] = lhsu(this.lowBound, this.upBound, 1);
Scon = newpar[0]; // depends on control dependency: [while], data = [none]
accept = isSampleValid(Scon); // depends on control dependency: [while], data = [none]
}
double Fcon[] = compob(Scon);
Snew = Scon; // depends on control dependency: [if], data = [none]
Fnew = Fcon; // depends on control dependency: [if], data = [none]
// Update number of function evaluations
} else {
// Compute corresponding objective function values
double Fref[] = compob(Sref);
double SimplexTmp[][] = new double[Simplex.length][lenSF];
for (int j = 0; j < lenSF; j++) {
for (int i = 0; i < Simplex.length - 1; i++) {
SimplexTmp[i][j] = Simplex[i][n + j]; // depends on control dependency: [for], data = [i]
}
SimplexTmp[Simplex.length - 1][j] = Fref[j]; // depends on control dependency: [for], data = [j]
}
// Test for non dominance
Object ret[] = parrank(SimplexTmp, 2); // 2 ist possible wrong
int Rref[] = (int[]) ret[0];
int Rrefmax = Integer.MIN_VALUE;
for (int i = 0; i < Rref.length - 1; i++) {
if (Rref[i] > Rrefmax) {
Rrefmax = Rref[i]; // depends on control dependency: [if], data = [none]
}
}
if (Rref[Rref.length - 1] <= Rrefmax) {
Snew = Sref; // depends on control dependency: [if], data = [none]
Fnew = Fref; // depends on control dependency: [if], data = [none]
} else {
// Compute contraction step
double Scon[] = new double[n];
for (int i = 0; i < n; i++) {
Scon[i] = 0.5 * Sg[i] + 0.5 * Sw[i]; // depends on control dependency: [for], data = [i]
}
accept = isSampleValid(Scon); // depends on control dependency: [if], data = [none]
//if it fails again, try a mutation
while (!accept) {
double newpar[][] = lhsu(this.lowBound, this.upBound, 1);
Scon = newpar[0]; // depends on control dependency: [while], data = [none]
accept = isSampleValid(Scon); // depends on control dependency: [while], data = [none]
}
// Compute corresponding objective function values
double Fcon[] = compob(Scon);
Snew = Scon; // depends on control dependency: [if], data = [none]
Fnew = Fcon; // depends on control dependency: [if], data = [none]
}
}
for (int i = 0; i < n; i++) {
S[S.length - 1][i] = Snew[i]; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < SF[0].length; i++) {
SF[SF.length - 1][i] = Fnew[i]; // depends on control dependency: [for], data = [i]
}
return new Object[]{S, SF};
} }
|
public class class_name {
public void marshall(DeleteIntegrationResponseRequest deleteIntegrationResponseRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIntegrationResponseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getApiId(), APIID_BINDING);
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getIntegrationId(), INTEGRATIONID_BINDING);
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getIntegrationResponseId(), INTEGRATIONRESPONSEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteIntegrationResponseRequest deleteIntegrationResponseRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteIntegrationResponseRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getApiId(), APIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getIntegrationId(), INTEGRATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(deleteIntegrationResponseRequest.getIntegrationResponseId(), INTEGRATIONRESPONSEID_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 String relPlaceHolderFrom(final String rel) {
if (isMatchingCuriedRel(rel)) {
return rel.substring(curiedRelPrefix.length());
}
if (isMatchingExpandedRel(rel)) {
return rel.substring(relPrefix.length(), rel.length() - relSuffix.length());
}
throw new IllegalArgumentException("Rel does not match the CURI template.");
} }
|
public class class_name {
public String relPlaceHolderFrom(final String rel) {
if (isMatchingCuriedRel(rel)) {
return rel.substring(curiedRelPrefix.length()); // depends on control dependency: [if], data = [none]
}
if (isMatchingExpandedRel(rel)) {
return rel.substring(relPrefix.length(), rel.length() - relSuffix.length()); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Rel does not match the CURI template.");
} }
|
public class class_name {
public void clearAndCancelActivationGroup(final String name) {
final InternalActivationGroup activationGroup = this.activationGroups.get( name );
if ( activationGroup != null ) {
clearAndCancelActivationGroup( activationGroup );
}
} }
|
public class class_name {
public void clearAndCancelActivationGroup(final String name) {
final InternalActivationGroup activationGroup = this.activationGroups.get( name );
if ( activationGroup != null ) {
clearAndCancelActivationGroup( activationGroup ); // depends on control dependency: [if], data = [( activationGroup]
}
} }
|
public class class_name {
private void makeSnapshotIfNeeded(long currentTime) {
if (currentTime < 0) {
currentTime = nanoTimer.getNano();
}
if (lastSnapshotTimestamp == -1)
lastSnapshotTimestamp = 0;
if (lastSnapshotTimestamp < 0 || currentTime - lastSnapshotTimestamp >= intervalBetweenSnapshots) {
snapshot = new PerformanceSnapshot(performanceCountersHolder, countersByComponent, writCacheCountersHolder,
storageCountersHolder, walCountersHolder);
lastSnapshotTimestamp = currentTime;
}
if (cleanUpInterval > 0) {
if (currentTime - lastCleanUpTimeStamp >= cleanUpInterval) {
performanceCountersHolder.clean();
for (PerformanceCountersHolder pch : countersByComponent.values()) {
pch.clean();
}
if (writCacheCountersHolder != null)
writCacheCountersHolder.clean();
if (storageCountersHolder != null)
storageCountersHolder.clean();
if (writCacheCountersHolder != null)
walCountersHolder.clean();
lastCleanUpTimeStamp = currentTime;
}
}
} }
|
public class class_name {
private void makeSnapshotIfNeeded(long currentTime) {
if (currentTime < 0) {
currentTime = nanoTimer.getNano(); // depends on control dependency: [if], data = [none]
}
if (lastSnapshotTimestamp == -1)
lastSnapshotTimestamp = 0;
if (lastSnapshotTimestamp < 0 || currentTime - lastSnapshotTimestamp >= intervalBetweenSnapshots) {
snapshot = new PerformanceSnapshot(performanceCountersHolder, countersByComponent, writCacheCountersHolder,
storageCountersHolder, walCountersHolder); // depends on control dependency: [if], data = [none]
lastSnapshotTimestamp = currentTime; // depends on control dependency: [if], data = [none]
}
if (cleanUpInterval > 0) {
if (currentTime - lastCleanUpTimeStamp >= cleanUpInterval) {
performanceCountersHolder.clean(); // depends on control dependency: [if], data = [none]
for (PerformanceCountersHolder pch : countersByComponent.values()) {
pch.clean(); // depends on control dependency: [for], data = [pch]
}
if (writCacheCountersHolder != null)
writCacheCountersHolder.clean();
if (storageCountersHolder != null)
storageCountersHolder.clean();
if (writCacheCountersHolder != null)
walCountersHolder.clean();
lastCleanUpTimeStamp = currentTime; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Map<String, byte[]> getCurrentMembers()
{
ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder();
boolean thisIdAdded = false;
for ( ChildData data : cache.getCurrentData() )
{
String id = idFromPath(data.getPath());
thisIdAdded = thisIdAdded || id.equals(thisId);
builder.put(id, data.getData());
}
if ( !thisIdAdded )
{
builder.put(thisId, pen.getData()); // this instance is always a member
}
return builder.build();
} }
|
public class class_name {
public Map<String, byte[]> getCurrentMembers()
{
ImmutableMap.Builder<String, byte[]> builder = ImmutableMap.builder();
boolean thisIdAdded = false;
for ( ChildData data : cache.getCurrentData() )
{
String id = idFromPath(data.getPath());
thisIdAdded = thisIdAdded || id.equals(thisId); // depends on control dependency: [for], data = [none]
builder.put(id, data.getData()); // depends on control dependency: [for], data = [data]
}
if ( !thisIdAdded )
{
builder.put(thisId, pen.getData()); // this instance is always a member // depends on control dependency: [if], data = [none]
}
return builder.build();
} }
|
public class class_name {
public String[] getAttributeNames() {
String[] result = new String[attributeMap.size()];
int i = 0;
// for (String attributeName : attributeMap.keySet()) {
Iterator it = attributeMap.keySet().iterator();
while (it.hasNext()) {
result[i++] = (String) it.next();
}
return result;
} }
|
public class class_name {
public String[] getAttributeNames() {
String[] result = new String[attributeMap.size()];
int i = 0;
// for (String attributeName : attributeMap.keySet()) {
Iterator it = attributeMap.keySet().iterator();
while (it.hasNext()) {
result[i++] = (String) it.next();
// depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public void addResponse(CheckRequest req, CheckResponse resp) {
if (cache == null) {
return;
}
String signature = sign(req).toString();
long now = ticker.read();
int quotaScale = 0; // WIP
synchronized (cache) {
CachedItem item = cache.getIfPresent(signature);
if (item == null) {
cache.put(signature, new CachedItem(resp, req, kinds, now, quotaScale));
} else {
item.lastCheckTimestamp = now;
item.response = resp;
item.quotaScale = quotaScale;
item.isFlushing = false;
cache.put(signature, item);
}
}
} }
|
public class class_name {
public void addResponse(CheckRequest req, CheckResponse resp) {
if (cache == null) {
return; // depends on control dependency: [if], data = [none]
}
String signature = sign(req).toString();
long now = ticker.read();
int quotaScale = 0; // WIP
synchronized (cache) {
CachedItem item = cache.getIfPresent(signature);
if (item == null) {
cache.put(signature, new CachedItem(resp, req, kinds, now, quotaScale)); // depends on control dependency: [if], data = [none]
} else {
item.lastCheckTimestamp = now; // depends on control dependency: [if], data = [none]
item.response = resp; // depends on control dependency: [if], data = [none]
item.quotaScale = quotaScale; // depends on control dependency: [if], data = [none]
item.isFlushing = false; // depends on control dependency: [if], data = [none]
cache.put(signature, item); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private static String[] fmtObjectToStrArray(Object object) {
if (object == null) {
return null;
}
if (object instanceof String[]) {
return (String[]) object;
}
if (object instanceof Collection) {
Collection c = (Collection) object;
return (String[]) c.toArray(new String[c.size()]);
}
return null;
} }
|
public class class_name {
private static String[] fmtObjectToStrArray(Object object) {
if (object == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (object instanceof String[]) {
return (String[]) object; // depends on control dependency: [if], data = [none]
}
if (object instanceof Collection) {
Collection c = (Collection) object;
return (String[]) c.toArray(new String[c.size()]); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public ListDeviceInstancesResult withDeviceInstances(DeviceInstance... deviceInstances) {
if (this.deviceInstances == null) {
setDeviceInstances(new java.util.ArrayList<DeviceInstance>(deviceInstances.length));
}
for (DeviceInstance ele : deviceInstances) {
this.deviceInstances.add(ele);
}
return this;
} }
|
public class class_name {
public ListDeviceInstancesResult withDeviceInstances(DeviceInstance... deviceInstances) {
if (this.deviceInstances == null) {
setDeviceInstances(new java.util.ArrayList<DeviceInstance>(deviceInstances.length)); // depends on control dependency: [if], data = [none]
}
for (DeviceInstance ele : deviceInstances) {
this.deviceInstances.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
public Object encode(final Mapper mapper, final Object value, final MappedField optionalExtraInfo) {
if (isResolved()) {
return wrapId(mapper, optionalExtraInfo, get());
} else {
return null;
}
} }
|
public class class_name {
@Override
public Object encode(final Mapper mapper, final Object value, final MappedField optionalExtraInfo) {
if (isResolved()) {
return wrapId(mapper, optionalExtraInfo, get()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Set<Integer> getAliveTasks(String topologyId, Set<Integer> taskIds) throws Exception {
Set<Integer> aliveTasks = new HashSet<>();
// taskIds is the list from ZK /ZK-DIR/tasks/topologyId
for (int taskId : taskIds) {
boolean isDead = NimbusUtils.isTaskDead(nimbusData, topologyId, taskId);
if (!isDead) {
aliveTasks.add(taskId);
}
}
return aliveTasks;
} }
|
public class class_name {
public Set<Integer> getAliveTasks(String topologyId, Set<Integer> taskIds) throws Exception {
Set<Integer> aliveTasks = new HashSet<>();
// taskIds is the list from ZK /ZK-DIR/tasks/topologyId
for (int taskId : taskIds) {
boolean isDead = NimbusUtils.isTaskDead(nimbusData, topologyId, taskId);
if (!isDead) {
aliveTasks.add(taskId); // depends on control dependency: [if], data = [none]
}
}
return aliveTasks;
} }
|
public class class_name {
public static ChildRelation getChildRelation(SbbEntity sbbEntity,
String childRelationMethodName) {
if (sbbEntity.getSbbObject().getState() != SbbObjectState.READY)
throw new IllegalStateException(
"Could not invoke getChildRelation Method, Sbb Object is not in the READY state!");
if (logger.isTraceEnabled()) {
logger.trace("ChildRelation Interceptor:"
+ childRelationMethodName);
}
return sbbEntity.getChildRelation(childRelationMethodName);
} }
|
public class class_name {
public static ChildRelation getChildRelation(SbbEntity sbbEntity,
String childRelationMethodName) {
if (sbbEntity.getSbbObject().getState() != SbbObjectState.READY)
throw new IllegalStateException(
"Could not invoke getChildRelation Method, Sbb Object is not in the READY state!");
if (logger.isTraceEnabled()) {
logger.trace("ChildRelation Interceptor:"
+ childRelationMethodName); // depends on control dependency: [if], data = [none]
}
return sbbEntity.getChildRelation(childRelationMethodName);
} }
|
public class class_name {
public static List<Long> getTilesCoverage(final BoundingBox pBB,
final int pZoomMin, final int pZoomMax) {
final List<Long> result = new ArrayList<>();
for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
final Collection<Long> resultForZoom = getTilesCoverage(pBB, zoomLevel);
result.addAll(resultForZoom);
}
return result;
} }
|
public class class_name {
public static List<Long> getTilesCoverage(final BoundingBox pBB,
final int pZoomMin, final int pZoomMax) {
final List<Long> result = new ArrayList<>();
for (int zoomLevel = pZoomMin; zoomLevel <= pZoomMax; zoomLevel++) {
final Collection<Long> resultForZoom = getTilesCoverage(pBB, zoomLevel);
result.addAll(resultForZoom); // depends on control dependency: [for], data = [none]
}
return result;
} }
|
public class class_name {
private static Method getDeclaredMethods(Class<?> clazz, String methodName) {
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
return method;
}
}
throw new IllegalArgumentException("方法" + methodName + "不存在!");
} }
|
public class class_name {
private static Method getDeclaredMethods(Class<?> clazz, String methodName) {
Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
return method; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("方法" + methodName + "不存在!");
} }
|
public class class_name {
private void initIndex() throws Exception {
//0. Add the tasklog template
if (doesResourceNotExist("/_template/tasklog_template")) {
logger.info("Creating the index template 'tasklog_template'");
InputStream stream = ElasticSearchDAOV5.class.getResourceAsStream("/template_tasklog.json");
byte[] templateSource = IOUtils.toByteArray(stream);
HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON);
try {
elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/tasklog_template", Collections.emptyMap(), entity);
} catch (IOException e) {
logger.error("Failed to initialize tasklog_template", e);
}
}
} }
|
public class class_name {
private void initIndex() throws Exception {
//0. Add the tasklog template
if (doesResourceNotExist("/_template/tasklog_template")) {
logger.info("Creating the index template 'tasklog_template'");
InputStream stream = ElasticSearchDAOV5.class.getResourceAsStream("/template_tasklog.json");
byte[] templateSource = IOUtils.toByteArray(stream);
HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON);
try {
elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/tasklog_template", Collections.emptyMap(), entity); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Failed to initialize tasklog_template", e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static final String getHostOrIP(boolean preferHostname, Tree info) {
String hostOrIP = null;
if (preferHostname) {
hostOrIP = getHost(info);
if (hostOrIP == null) {
hostOrIP = getIP(info);
}
} else {
hostOrIP = getIP(info);
if (hostOrIP == null) {
hostOrIP = getHost(info);
}
}
return hostOrIP;
} }
|
public class class_name {
public static final String getHostOrIP(boolean preferHostname, Tree info) {
String hostOrIP = null;
if (preferHostname) {
hostOrIP = getHost(info);
// depends on control dependency: [if], data = [none]
if (hostOrIP == null) {
hostOrIP = getIP(info);
// depends on control dependency: [if], data = [none]
}
} else {
hostOrIP = getIP(info);
// depends on control dependency: [if], data = [none]
if (hostOrIP == null) {
hostOrIP = getHost(info);
// depends on control dependency: [if], data = [none]
}
}
return hostOrIP;
} }
|
public class class_name {
private void processParsedValue(final String parsed_value) {
if (rule.getCompiledRegex() == null &&
(rule.getSeparator() == null || rule.getSeparator().isEmpty())) {
// we don't have a regex and we don't need to separate, so just use the
// name of the timseries
setCurrentName(parsed_value, parsed_value);
} else if (rule.getCompiledRegex() != null) {
// we have a regex rule, so deal with it
processRegexRule(parsed_value);
} else if (rule.getSeparator() != null && !rule.getSeparator().isEmpty()) {
// we have a split rule, so deal with it
processSplit(parsed_value);
} else {
throw new IllegalStateException("Unable to find a processor for rule: " +
rule);
}
} }
|
public class class_name {
private void processParsedValue(final String parsed_value) {
if (rule.getCompiledRegex() == null &&
(rule.getSeparator() == null || rule.getSeparator().isEmpty())) {
// we don't have a regex and we don't need to separate, so just use the
// name of the timseries
setCurrentName(parsed_value, parsed_value); // depends on control dependency: [if], data = [none]
} else if (rule.getCompiledRegex() != null) {
// we have a regex rule, so deal with it
processRegexRule(parsed_value); // depends on control dependency: [if], data = [none]
} else if (rule.getSeparator() != null && !rule.getSeparator().isEmpty()) {
// we have a split rule, so deal with it
processSplit(parsed_value); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalStateException("Unable to find a processor for rule: " +
rule);
}
} }
|
public class class_name {
public static String getNodeTitle(Node node) {
String result = null;
try {
Property title = node.getProperty(JCR_TITLE);
if (title != null) {
result = title.getString();
}
} catch (RepositoryException rex) {
LOG.error(rex.getMessage(), rex);
}
return result;
} }
|
public class class_name {
public static String getNodeTitle(Node node) {
String result = null;
try {
Property title = node.getProperty(JCR_TITLE);
if (title != null) {
result = title.getString(); // depends on control dependency: [if], data = [none]
}
} catch (RepositoryException rex) {
LOG.error(rex.getMessage(), rex);
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
private String getFilterValues(final TableDataModel dataModel, final int rowIndex) {
List<String> filterValues = dataModel.getFilterValues(rowIndex);
if (filterValues == null || filterValues.isEmpty()) {
return null;
}
StringBuffer buf = new StringBuffer(filterValues.get(0));
for (int i = 1; i < filterValues.size(); i++) {
buf.append(", ");
buf.append(filterValues.get(i));
}
return buf.toString();
} }
|
public class class_name {
private String getFilterValues(final TableDataModel dataModel, final int rowIndex) {
List<String> filterValues = dataModel.getFilterValues(rowIndex);
if (filterValues == null || filterValues.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuffer buf = new StringBuffer(filterValues.get(0));
for (int i = 1; i < filterValues.size(); i++) {
buf.append(", "); // depends on control dependency: [for], data = [none]
buf.append(filterValues.get(i)); // depends on control dependency: [for], data = [i]
}
return buf.toString();
} }
|
public class class_name {
public List<FormFieldMapping> getFormFieldMappingForFormDefinition(
Long formDefinitionIdParam
) {
List<FormFieldMapping> returnVal = new ArrayList();
if(formDefinitionIdParam == null || formDefinitionIdParam.longValue() < 1)
{
return returnVal;
}
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try{
//Local Mapping...
//When we have the key by definition, we can just return.
if(this.localDefinitionToFieldsMapping.containsKey(formDefinitionIdParam))
{
return this.localDefinitionToFieldsMapping.get(formDefinitionIdParam);
}
ISyntax syntax = SyntaxFactory.getInstance().getSyntaxFor(
this.getSQLTypeFromConnection(),
ISyntax.ProcedureMapping.Field.GetFormFieldsForFormDefinition);
preparedStatement = this.getConnection().prepareStatement(
syntax.getPreparedStatement());
preparedStatement.setLong(1, formDefinitionIdParam);
resultSet = preparedStatement.executeQuery();
//Iterate each of the form containers...
while (resultSet.next())
{
returnVal.add(this.mapFormFieldMapping(resultSet));
}
this.localDefinitionToFieldsMapping.put(formDefinitionIdParam, returnVal);
return returnVal;
}
//
catch (SQLException sqlError) {
throw new FluidSQLException(sqlError);
}
//
finally {
this.closeStatement(preparedStatement, resultSet);
}
} }
|
public class class_name {
public List<FormFieldMapping> getFormFieldMappingForFormDefinition(
Long formDefinitionIdParam
) {
List<FormFieldMapping> returnVal = new ArrayList();
if(formDefinitionIdParam == null || formDefinitionIdParam.longValue() < 1)
{
return returnVal; // depends on control dependency: [if], data = [none]
}
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try{
//Local Mapping...
//When we have the key by definition, we can just return.
if(this.localDefinitionToFieldsMapping.containsKey(formDefinitionIdParam))
{
return this.localDefinitionToFieldsMapping.get(formDefinitionIdParam); // depends on control dependency: [if], data = [none]
}
ISyntax syntax = SyntaxFactory.getInstance().getSyntaxFor(
this.getSQLTypeFromConnection(),
ISyntax.ProcedureMapping.Field.GetFormFieldsForFormDefinition);
preparedStatement = this.getConnection().prepareStatement(
syntax.getPreparedStatement()); // depends on control dependency: [try], data = [none]
preparedStatement.setLong(1, formDefinitionIdParam); // depends on control dependency: [try], data = [none]
resultSet = preparedStatement.executeQuery(); // depends on control dependency: [try], data = [none]
//Iterate each of the form containers...
while (resultSet.next())
{
returnVal.add(this.mapFormFieldMapping(resultSet)); // depends on control dependency: [while], data = [none]
}
this.localDefinitionToFieldsMapping.put(formDefinitionIdParam, returnVal); // depends on control dependency: [try], data = [none]
return returnVal; // depends on control dependency: [try], data = [none]
}
//
catch (SQLException sqlError) {
throw new FluidSQLException(sqlError);
} // depends on control dependency: [catch], data = [none]
//
finally {
this.closeStatement(preparedStatement, resultSet);
}
} }
|
public class class_name {
private int initStepTransactionTimeout() {
logger.entering(sourceClass, "initStepTransactionTimeout");
Properties p = runtimeStepExecution.getProperties();
int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS; // default as per spec.
if (p != null && !p.isEmpty()) {
String propertyTimeOut = p.getProperty("javax.transaction.global.timeout");
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "javax.transaction.global.timeout = {0}", propertyTimeOut == null ? "<null>" : propertyTimeOut);
}
if (propertyTimeOut != null && !propertyTimeOut.isEmpty()) {
timeout = Integer.parseInt(propertyTimeOut, 10);
}
}
logger.exiting(sourceClass, "initStepTransactionTimeout", timeout);
return timeout;
} }
|
public class class_name {
private int initStepTransactionTimeout() {
logger.entering(sourceClass, "initStepTransactionTimeout");
Properties p = runtimeStepExecution.getProperties();
int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS; // default as per spec.
if (p != null && !p.isEmpty()) {
String propertyTimeOut = p.getProperty("javax.transaction.global.timeout");
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, "javax.transaction.global.timeout = {0}", propertyTimeOut == null ? "<null>" : propertyTimeOut); // depends on control dependency: [if], data = [none]
}
if (propertyTimeOut != null && !propertyTimeOut.isEmpty()) {
timeout = Integer.parseInt(propertyTimeOut, 10); // depends on control dependency: [if], data = [(propertyTimeOut]
}
}
logger.exiting(sourceClass, "initStepTransactionTimeout", timeout);
return timeout;
} }
|
public class class_name {
private void failHeartbeat() {
raft.checkThread();
// Iterate through pending timestamped heartbeat futures and fail futures that have been pending longer
// than an election timeout.
long currentTimestamp = System.currentTimeMillis();
Iterator<TimestampedFuture<Long>> iterator = heartbeatFutures.iterator();
while (iterator.hasNext()) {
TimestampedFuture<Long> future = iterator.next();
if (currentTimestamp - future.timestamp > electionTimeout) {
future.completeExceptionally(new RaftException.ProtocolException("Failed to reach consensus"));
iterator.remove();
}
}
} }
|
public class class_name {
private void failHeartbeat() {
raft.checkThread();
// Iterate through pending timestamped heartbeat futures and fail futures that have been pending longer
// than an election timeout.
long currentTimestamp = System.currentTimeMillis();
Iterator<TimestampedFuture<Long>> iterator = heartbeatFutures.iterator();
while (iterator.hasNext()) {
TimestampedFuture<Long> future = iterator.next();
if (currentTimestamp - future.timestamp > electionTimeout) {
future.completeExceptionally(new RaftException.ProtocolException("Failed to reach consensus")); // depends on control dependency: [if], data = [none]
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public boolean relative(int row) throws PersistenceBrokerException
{
if (row == 0)
{
return true;
}
boolean movedToRelative = false;
boolean retval = false;
setNextIterator();
if (row > 0)
{
// special case checking for the iterator we're currently in
// (since it isn't positioned on the boundary potentially)
if (row > (m_activeIterator.size() - m_currentCursorPosition))
{
// the relative position lies over the border of the
// current iterator.
// starting position counter should be set to whatever we have left in
// active iterator.
int positionCounter = m_activeIterator.size() - m_currentCursorPosition;
for (int i = m_activeIteratorIndex + 1; ((i < m_rsIterators.size()) && !movedToRelative); i++)
{
m_activeIteratorIndex = i;
m_currentCursorPosition = 0;
m_activeIterator = (OJBIterator) m_rsIterators.get(m_activeIteratorIndex);
if (!((row - positionCounter) > m_activeIterator.size()))
{
// the relative position requested is within this iterator.
m_currentCursorPosition = row - positionCounter;
retval = m_activeIterator.relative(m_currentCursorPosition);
movedToRelative = true;
}
}
}
else
{
// the relative position lays within the current iterator.
retval = m_activeIterator.relative(row);
movedToRelative = true;
}
}
return retval;
} }
|
public class class_name {
public boolean relative(int row) throws PersistenceBrokerException
{
if (row == 0)
{
return true;
}
boolean movedToRelative = false;
boolean retval = false;
setNextIterator();
if (row > 0)
{
// special case checking for the iterator we're currently in
// (since it isn't positioned on the boundary potentially)
if (row > (m_activeIterator.size() - m_currentCursorPosition))
{
// the relative position lies over the border of the
// current iterator.
// starting position counter should be set to whatever we have left in
// active iterator.
int positionCounter = m_activeIterator.size() - m_currentCursorPosition;
for (int i = m_activeIteratorIndex + 1; ((i < m_rsIterators.size()) && !movedToRelative); i++)
{
m_activeIteratorIndex = i;
// depends on control dependency: [for], data = [i]
m_currentCursorPosition = 0;
// depends on control dependency: [for], data = [none]
m_activeIterator = (OJBIterator) m_rsIterators.get(m_activeIteratorIndex);
// depends on control dependency: [for], data = [none]
if (!((row - positionCounter) > m_activeIterator.size()))
{
// the relative position requested is within this iterator.
m_currentCursorPosition = row - positionCounter;
// depends on control dependency: [if], data = [none]
retval = m_activeIterator.relative(m_currentCursorPosition);
// depends on control dependency: [if], data = [none]
movedToRelative = true;
// depends on control dependency: [if], data = [none]
}
}
}
else
{
// the relative position lays within the current iterator.
retval = m_activeIterator.relative(row);
// depends on control dependency: [if], data = [(row]
movedToRelative = true;
// depends on control dependency: [if], data = [none]
}
}
return retval;
} }
|
public class class_name {
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)
{
Object listeners[];
synchronized (bcsListeners)
{
listeners = bcsListeners.toArray();
}
for (int i = 0; i < listeners.length; i++)
{
BeanContextServicesListener l = (BeanContextServicesListener) listeners[i];
l.serviceRevoked(event);
}
} }
|
public class class_name {
protected final void fireServiceRevoked(BeanContextServiceRevokedEvent event)
{
Object listeners[];
synchronized (bcsListeners)
{
listeners = bcsListeners.toArray();
}
for (int i = 0; i < listeners.length; i++)
{
BeanContextServicesListener l = (BeanContextServicesListener) listeners[i];
l.serviceRevoked(event); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public MethodParamsType<T> methodParam(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("method-param").text(name);
}
}
return this;
} }
|
public class class_name {
public MethodParamsType<T> methodParam(String ... values)
{
if (values != null)
{
for(String name: values)
{
childNode.createChild("method-param").text(name); // depends on control dependency: [for], data = [name]
}
}
return this;
} }
|
public class class_name {
public static String getUrl(Object o) {
if ( o instanceof VerifierRule ) {
VerifierRule rule = (VerifierRule) o;
return getRuleUrl( UrlFactory.RULE_FOLDER,
rule.getPath(),
rule.getName() );
}
return o.toString();
} }
|
public class class_name {
public static String getUrl(Object o) {
if ( o instanceof VerifierRule ) {
VerifierRule rule = (VerifierRule) o;
return getRuleUrl( UrlFactory.RULE_FOLDER,
rule.getPath(),
rule.getName() ); // depends on control dependency: [if], data = [none]
}
return o.toString();
} }
|
public class class_name {
public String getString(final int index) {
try {
return statement.getString(index);
} catch (SQLException sex) {
throw newGetParamError(index, sex);
}
} }
|
public class class_name {
public String getString(final int index) {
try {
return statement.getString(index); // depends on control dependency: [try], data = [none]
} catch (SQLException sex) {
throw newGetParamError(index, sex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private int resize(int newSize)
{
int[] base2 = new int[newSize];
int[] check2 = new int[newSize];
if (allocSize > 0)
{
System.arraycopy(base, 0, base2, 0, allocSize);
System.arraycopy(check, 0, check2, 0, allocSize);
}
base = base2;
check = check2;
return allocSize = newSize;
} }
|
public class class_name {
private int resize(int newSize)
{
int[] base2 = new int[newSize];
int[] check2 = new int[newSize];
if (allocSize > 0)
{
System.arraycopy(base, 0, base2, 0, allocSize); // depends on control dependency: [if], data = [none]
System.arraycopy(check, 0, check2, 0, allocSize); // depends on control dependency: [if], data = [none]
}
base = base2;
check = check2;
return allocSize = newSize;
} }
|
public class class_name {
public void setSubstitution(Term term)
{
Term termToBindTo = term;
// When binding against a variable, always bind to its storage cell and not the variable itself.
if (termToBindTo instanceof Variable)
{
Variable variableToBindTo = (Variable) term;
termToBindTo = variableToBindTo.getStorageCell(variableToBindTo);
}
substitution = termToBindTo;
} }
|
public class class_name {
public void setSubstitution(Term term)
{
Term termToBindTo = term;
// When binding against a variable, always bind to its storage cell and not the variable itself.
if (termToBindTo instanceof Variable)
{
Variable variableToBindTo = (Variable) term;
termToBindTo = variableToBindTo.getStorageCell(variableToBindTo); // depends on control dependency: [if], data = [none]
}
substitution = termToBindTo;
} }
|
public class class_name {
private IfStatement parseIfStatement(Token token) throws IOException {
SourceInfo info = token.getSourceInfo();
Expression condition = parseExpression();
if (!(condition instanceof ParenExpression)) {
error("if.condition", condition.getSourceInfo());
}
Block thenPart = parseBlock();
Block elsePart = null;
token = peek();
if (token.getID() != Token.ELSE) {
info = info.setEndPosition(thenPart.getSourceInfo());
}
else {
read(); // read the else keyword
token = peek();
if (token.getID() == Token.IF) {
elsePart = new Block(parseIfStatement(read()));
}
else {
elsePart = parseBlock();
}
info = info.setEndPosition(elsePart.getSourceInfo());
}
return new IfStatement(info, condition, thenPart, elsePart);
} }
|
public class class_name {
private IfStatement parseIfStatement(Token token) throws IOException {
SourceInfo info = token.getSourceInfo();
Expression condition = parseExpression();
if (!(condition instanceof ParenExpression)) {
error("if.condition", condition.getSourceInfo());
}
Block thenPart = parseBlock();
Block elsePart = null;
token = peek();
if (token.getID() != Token.ELSE) {
info = info.setEndPosition(thenPart.getSourceInfo());
}
else {
read(); // read the else keyword
token = peek();
if (token.getID() == Token.IF) {
elsePart = new Block(parseIfStatement(read())); // depends on control dependency: [if], data = [none]
}
else {
elsePart = parseBlock(); // depends on control dependency: [if], data = [none]
}
info = info.setEndPosition(elsePart.getSourceInfo());
}
return new IfStatement(info, condition, thenPart, elsePart);
} }
|
public class class_name {
public static /*@pure@*/ double variance(double[] vector) {
double sum = 0, sumSquared = 0;
if (vector.length <= 1) {
return 0;
}
for (int i = 0; i < vector.length; i++) {
sum += vector[i];
sumSquared += (vector[i] * vector[i]);
}
double result = (sumSquared - (sum * sum / (double) vector.length)) /
(double) (vector.length - 1);
// We don't like negative variance
if (result < 0) {
return 0;
} else {
return result;
}
} }
|
public class class_name {
public static /*@pure@*/ double variance(double[] vector) {
double sum = 0, sumSquared = 0;
if (vector.length <= 1) {
return 0; // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < vector.length; i++) {
sum += vector[i]; // depends on control dependency: [for], data = [i]
sumSquared += (vector[i] * vector[i]); // depends on control dependency: [for], data = [i]
}
double result = (sumSquared - (sum * sum / (double) vector.length)) /
(double) (vector.length - 1);
// We don't like negative variance
if (result < 0) {
return 0; // depends on control dependency: [if], data = [none]
} else {
return result; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(CreateDataSourceFromRDSRequest createDataSourceFromRDSRequest, ProtocolMarshaller protocolMarshaller) {
if (createDataSourceFromRDSRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getDataSourceId(), DATASOURCEID_BINDING);
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getDataSourceName(), DATASOURCENAME_BINDING);
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getRDSData(), RDSDATA_BINDING);
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getRoleARN(), ROLEARN_BINDING);
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getComputeStatistics(), COMPUTESTATISTICS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateDataSourceFromRDSRequest createDataSourceFromRDSRequest, ProtocolMarshaller protocolMarshaller) {
if (createDataSourceFromRDSRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getDataSourceId(), DATASOURCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getDataSourceName(), DATASOURCENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getRDSData(), RDSDATA_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getRoleARN(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDataSourceFromRDSRequest.getComputeStatistics(), COMPUTESTATISTICS_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 String asDirPath(String path) {
String dirPath = path;
if (!path.equals(JawrConstant.URL_SEPARATOR)) {
dirPath = JawrConstant.URL_SEPARATOR + normalizePath(path) + JawrConstant.URL_SEPARATOR;
}
return dirPath;
} }
|
public class class_name {
public static String asDirPath(String path) {
String dirPath = path;
if (!path.equals(JawrConstant.URL_SEPARATOR)) {
dirPath = JawrConstant.URL_SEPARATOR + normalizePath(path) + JawrConstant.URL_SEPARATOR; // depends on control dependency: [if], data = [none]
}
return dirPath;
} }
|
public class class_name {
protected List<String> getTableNames(String sql) {
Pattern[] patterns = {SELECT_TABLE_NAMES, NON_SELECT_TABLE_NAME};
List<String> result = new ArrayList<String>();
for (Pattern pattern : patterns) {
Matcher matcher = pattern.matcher(sql);
while (matcher.find()) {
for (int i=1; i <= MAX_NUM_TABLE_NAMES; i++) {
String group = null;
try {
group = matcher.group("table"+i);
} catch (IllegalArgumentException e) {
// The two patterns have different numbers of groups
// (table1, table2, etc.), so this may well happen
break;
}
if (group != null) {
result.add(group);
}
}
}
}
return result;
} }
|
public class class_name {
protected List<String> getTableNames(String sql) {
Pattern[] patterns = {SELECT_TABLE_NAMES, NON_SELECT_TABLE_NAME};
List<String> result = new ArrayList<String>();
for (Pattern pattern : patterns) {
Matcher matcher = pattern.matcher(sql);
while (matcher.find()) {
for (int i=1; i <= MAX_NUM_TABLE_NAMES; i++) {
String group = null;
try {
group = matcher.group("table"+i); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
// The two patterns have different numbers of groups
// (table1, table2, etc.), so this may well happen
break;
} // depends on control dependency: [catch], data = [none]
if (group != null) {
result.add(group); // depends on control dependency: [if], data = [(group]
}
}
}
}
return result;
} }
|
public class class_name {
public final EObject ruleComparison() throws RecognitionException {
EObject current = null;
Token lv_operator_2_1=null;
Token lv_operator_2_2=null;
Token lv_operator_2_3=null;
EObject this_PrefixExpression_0 = null;
EObject lv_right_3_0 = null;
enterRule();
try {
// InternalSimpleExpressions.g:265:28: ( (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? ) )
// InternalSimpleExpressions.g:266:1: (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? )
{
// InternalSimpleExpressions.g:266:1: (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? )
// InternalSimpleExpressions.g:267:5: this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )?
{
newCompositeNode(grammarAccess.getComparisonAccess().getPrefixExpressionParserRuleCall_0());
pushFollow(FOLLOW_10);
this_PrefixExpression_0=rulePrefixExpression();
state._fsp--;
current = this_PrefixExpression_0;
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:275:1: ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( ((LA5_0>=18 && LA5_0<=20)) ) {
alt5=1;
}
switch (alt5) {
case 1 :
// InternalSimpleExpressions.g:275:2: () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) )
{
// InternalSimpleExpressions.g:275:2: ()
// InternalSimpleExpressions.g:276:5:
{
current = forceCreateModelElementAndSet(
grammarAccess.getComparisonAccess().getComparisonLeftAction_1_0(),
current);
}
// InternalSimpleExpressions.g:281:2: ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) )
// InternalSimpleExpressions.g:282:1: ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) )
{
// InternalSimpleExpressions.g:282:1: ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) )
// InternalSimpleExpressions.g:283:1: (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' )
{
// InternalSimpleExpressions.g:283:1: (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' )
int alt4=3;
switch ( input.LA(1) ) {
case 18:
{
alt4=1;
}
break;
case 19:
{
alt4=2;
}
break;
case 20:
{
alt4=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// InternalSimpleExpressions.g:284:3: lv_operator_2_1= '=='
{
lv_operator_2_1=(Token)match(input,18,FOLLOW_5);
newLeafNode(lv_operator_2_1, grammarAccess.getComparisonAccess().getOperatorEqualsSignEqualsSignKeyword_1_1_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule());
}
setWithLastConsumed(current, "operator", lv_operator_2_1, null);
}
break;
case 2 :
// InternalSimpleExpressions.g:296:8: lv_operator_2_2= '<='
{
lv_operator_2_2=(Token)match(input,19,FOLLOW_5);
newLeafNode(lv_operator_2_2, grammarAccess.getComparisonAccess().getOperatorLessThanSignEqualsSignKeyword_1_1_0_1());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule());
}
setWithLastConsumed(current, "operator", lv_operator_2_2, null);
}
break;
case 3 :
// InternalSimpleExpressions.g:308:8: lv_operator_2_3= '>='
{
lv_operator_2_3=(Token)match(input,20,FOLLOW_5);
newLeafNode(lv_operator_2_3, grammarAccess.getComparisonAccess().getOperatorGreaterThanSignEqualsSignKeyword_1_1_0_2());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule());
}
setWithLastConsumed(current, "operator", lv_operator_2_3, null);
}
break;
}
}
}
// InternalSimpleExpressions.g:323:2: ( (lv_right_3_0= rulePrefixExpression ) )
// InternalSimpleExpressions.g:324:1: (lv_right_3_0= rulePrefixExpression )
{
// InternalSimpleExpressions.g:324:1: (lv_right_3_0= rulePrefixExpression )
// InternalSimpleExpressions.g:325:3: lv_right_3_0= rulePrefixExpression
{
newCompositeNode(grammarAccess.getComparisonAccess().getRightPrefixExpressionParserRuleCall_1_2_0());
pushFollow(FOLLOW_2);
lv_right_3_0=rulePrefixExpression();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getComparisonRule());
}
set(
current,
"right",
lv_right_3_0,
"org.eclipse.xtext.xtext.generator.parser.antlr.splitting.SimpleExpressions.PrefixExpression");
afterParserOrEnumRuleCall();
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject ruleComparison() throws RecognitionException {
EObject current = null;
Token lv_operator_2_1=null;
Token lv_operator_2_2=null;
Token lv_operator_2_3=null;
EObject this_PrefixExpression_0 = null;
EObject lv_right_3_0 = null;
enterRule();
try {
// InternalSimpleExpressions.g:265:28: ( (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? ) )
// InternalSimpleExpressions.g:266:1: (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? )
{
// InternalSimpleExpressions.g:266:1: (this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )? )
// InternalSimpleExpressions.g:267:5: this_PrefixExpression_0= rulePrefixExpression ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )?
{
newCompositeNode(grammarAccess.getComparisonAccess().getPrefixExpressionParserRuleCall_0());
pushFollow(FOLLOW_10);
this_PrefixExpression_0=rulePrefixExpression();
state._fsp--;
current = this_PrefixExpression_0;
afterParserOrEnumRuleCall();
// InternalSimpleExpressions.g:275:1: ( () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) ) )?
int alt5=2;
int LA5_0 = input.LA(1);
if ( ((LA5_0>=18 && LA5_0<=20)) ) {
alt5=1; // depends on control dependency: [if], data = [none]
}
switch (alt5) {
case 1 :
// InternalSimpleExpressions.g:275:2: () ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) ) ( (lv_right_3_0= rulePrefixExpression ) )
{
// InternalSimpleExpressions.g:275:2: ()
// InternalSimpleExpressions.g:276:5:
{
current = forceCreateModelElementAndSet(
grammarAccess.getComparisonAccess().getComparisonLeftAction_1_0(),
current);
}
// InternalSimpleExpressions.g:281:2: ( ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) ) )
// InternalSimpleExpressions.g:282:1: ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) )
{
// InternalSimpleExpressions.g:282:1: ( (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' ) )
// InternalSimpleExpressions.g:283:1: (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' )
{
// InternalSimpleExpressions.g:283:1: (lv_operator_2_1= '==' | lv_operator_2_2= '<=' | lv_operator_2_3= '>=' )
int alt4=3;
switch ( input.LA(1) ) {
case 18:
{
alt4=1;
}
break;
case 19:
{
alt4=2;
}
break;
case 20:
{
alt4=3;
}
break;
default:
NoViableAltException nvae =
new NoViableAltException("", 4, 0, input);
throw nvae;
}
switch (alt4) {
case 1 :
// InternalSimpleExpressions.g:284:3: lv_operator_2_1= '=='
{
lv_operator_2_1=(Token)match(input,18,FOLLOW_5);
newLeafNode(lv_operator_2_1, grammarAccess.getComparisonAccess().getOperatorEqualsSignEqualsSignKeyword_1_1_0_0());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_2_1, null);
}
break;
case 2 :
// InternalSimpleExpressions.g:296:8: lv_operator_2_2= '<='
{
lv_operator_2_2=(Token)match(input,19,FOLLOW_5);
newLeafNode(lv_operator_2_2, grammarAccess.getComparisonAccess().getOperatorLessThanSignEqualsSignKeyword_1_1_0_1());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_2_2, null);
}
break;
case 3 :
// InternalSimpleExpressions.g:308:8: lv_operator_2_3= '>='
{
lv_operator_2_3=(Token)match(input,20,FOLLOW_5);
newLeafNode(lv_operator_2_3, grammarAccess.getComparisonAccess().getOperatorGreaterThanSignEqualsSignKeyword_1_1_0_2());
if (current==null) {
current = createModelElement(grammarAccess.getComparisonRule()); // depends on control dependency: [if], data = [none]
}
setWithLastConsumed(current, "operator", lv_operator_2_3, null);
}
break;
}
}
}
// InternalSimpleExpressions.g:323:2: ( (lv_right_3_0= rulePrefixExpression ) )
// InternalSimpleExpressions.g:324:1: (lv_right_3_0= rulePrefixExpression )
{
// InternalSimpleExpressions.g:324:1: (lv_right_3_0= rulePrefixExpression )
// InternalSimpleExpressions.g:325:3: lv_right_3_0= rulePrefixExpression
{
newCompositeNode(grammarAccess.getComparisonAccess().getRightPrefixExpressionParserRuleCall_1_2_0());
pushFollow(FOLLOW_2);
lv_right_3_0=rulePrefixExpression();
state._fsp--;
if (current==null) {
current = createModelElementForParent(grammarAccess.getComparisonRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"right",
lv_right_3_0,
"org.eclipse.xtext.xtext.generator.parser.antlr.splitting.SimpleExpressions.PrefixExpression");
afterParserOrEnumRuleCall();
}
}
}
break;
}
}
}
leaveRule();
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public static String readLine(ByteBuffer buffer, Charset charset) {
final int startPosition = buffer.position();
final int endPosition = lineEnd(buffer);
if (endPosition > startPosition) {
byte[] bs = readBytes(buffer, startPosition, endPosition);
return StrUtil.str(bs, charset);
} else if (endPosition == startPosition) {
return StrUtil.EMPTY;
}
return null;
} }
|
public class class_name {
public static String readLine(ByteBuffer buffer, Charset charset) {
final int startPosition = buffer.position();
final int endPosition = lineEnd(buffer);
if (endPosition > startPosition) {
byte[] bs = readBytes(buffer, startPosition, endPosition);
return StrUtil.str(bs, charset);
// depends on control dependency: [if], data = [none]
} else if (endPosition == startPosition) {
return StrUtil.EMPTY;
// depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public void handleConnection(Socket socket) throws IOException
{
// Check acceptable remote servers
if (_remoteServers!=null&&_remoteServers.length>0)
{
boolean match=false;
InetAddress inetAddress=socket.getInetAddress();
String hostAddr=inetAddress.getHostAddress();
String hostName=inetAddress.getHostName();
for (int i=0; i<_remoteServers.length; i++)
{
if (hostName.equals(_remoteServers[i])||hostAddr.equals(_remoteServers[i]))
{
match=true;
break;
}
}
if (!match)
{
log.warn("AJP13 Connection from un-approved host: "+inetAddress);
return;
}
}
// Handle the connection
socket.setTcpNoDelay(true);
socket.setSoTimeout(getMaxIdleTimeMs());
AJP13Connection connection=createConnection(socket);
try
{
connection.handle();
}
finally
{
connection.destroy();
}
} }
|
public class class_name {
public void handleConnection(Socket socket) throws IOException
{
// Check acceptable remote servers
if (_remoteServers!=null&&_remoteServers.length>0)
{
boolean match=false;
InetAddress inetAddress=socket.getInetAddress();
String hostAddr=inetAddress.getHostAddress();
String hostName=inetAddress.getHostName();
for (int i=0; i<_remoteServers.length; i++)
{
if (hostName.equals(_remoteServers[i])||hostAddr.equals(_remoteServers[i]))
{
match=true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!match)
{
log.warn("AJP13 Connection from un-approved host: "+inetAddress); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// Handle the connection
socket.setTcpNoDelay(true);
socket.setSoTimeout(getMaxIdleTimeMs());
AJP13Connection connection=createConnection(socket);
try
{
connection.handle();
}
finally
{
connection.destroy();
}
} }
|
public class class_name {
private void addRolesToSubject(Subject subject, Set<String> userRoles) {
if (userRoles == null) {
userRoles = Collections.emptySet();
}
Map<String, Set<String>> attributes =
SubjectUtils.getAttributes(subject);
Set<String> roles = attributes.get(ROLE_KEY);
if (roles == null) {
roles = new HashSet<String>(userRoles);
attributes.put(ROLE_KEY, roles);
} else {
roles.addAll(userRoles);
}
if (logger.isDebugEnabled()) {
for (String role : userRoles) {
logger.debug("added role: {}", role);
}
}
} }
|
public class class_name {
private void addRolesToSubject(Subject subject, Set<String> userRoles) {
if (userRoles == null) {
userRoles = Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
Map<String, Set<String>> attributes =
SubjectUtils.getAttributes(subject);
Set<String> roles = attributes.get(ROLE_KEY);
if (roles == null) {
roles = new HashSet<String>(userRoles); // depends on control dependency: [if], data = [none]
attributes.put(ROLE_KEY, roles); // depends on control dependency: [if], data = [none]
} else {
roles.addAll(userRoles); // depends on control dependency: [if], data = [none]
}
if (logger.isDebugEnabled()) {
for (String role : userRoles) {
logger.debug("added role: {}", role); // depends on control dependency: [for], data = [role]
}
}
} }
|
public class class_name {
private static TensorBuilder getTensorFromVariables(VariableNumMap variables) {
// Get the dimensions and dimension sizes for the tensor.
int[] dimensions = variables.getVariableNumsArray();
int[] sizes = new int[dimensions.length];
List<DiscreteVariable> varTypes = variables.getDiscreteVariables();
for (int i = 0; i < varTypes.size(); i++) {
sizes[i] = varTypes.get(i).numValues();
}
return new SparseTensorBuilder(dimensions, sizes);
} }
|
public class class_name {
private static TensorBuilder getTensorFromVariables(VariableNumMap variables) {
// Get the dimensions and dimension sizes for the tensor.
int[] dimensions = variables.getVariableNumsArray();
int[] sizes = new int[dimensions.length];
List<DiscreteVariable> varTypes = variables.getDiscreteVariables();
for (int i = 0; i < varTypes.size(); i++) {
sizes[i] = varTypes.get(i).numValues(); // depends on control dependency: [for], data = [i]
}
return new SparseTensorBuilder(dimensions, sizes);
} }
|
public class class_name {
@Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
String propertyName = ruleFactory.getNameHelper().getPropertyName(nodeName, node);
JType propertyType = ruleFactory.getSchemaRule().apply(nodeName, node, parent, jclass, schema);
boolean isIncludeGetters = ruleFactory.getGenerationConfig().isIncludeGetters();
boolean isIncludeSetters = ruleFactory.getGenerationConfig().isIncludeSetters();
node = resolveRefs(node, schema);
int accessModifier = isIncludeGetters || isIncludeSetters ? JMod.PRIVATE : JMod.PUBLIC;
JFieldVar field = jclass.field(accessModifier, propertyType, propertyName);
propertyAnnotations(nodeName, node, schema, field);
formatAnnotation(field, jclass, node);
ruleFactory.getAnnotator().propertyField(field, jclass, nodeName, node);
if (isIncludeGetters) {
JMethod getter = addGetter(jclass, field, nodeName, node, isRequired(nodeName, node, schema), useOptional(nodeName, node, schema));
ruleFactory.getAnnotator().propertyGetter(getter, jclass, nodeName);
propertyAnnotations(nodeName, node, schema, getter);
}
if (isIncludeSetters) {
JMethod setter = addSetter(jclass, field, nodeName, node);
ruleFactory.getAnnotator().propertySetter(setter, jclass, nodeName);
propertyAnnotations(nodeName, node, schema, setter);
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders()) {
addBuilderMethod(jclass, field, nodeName, node);
}
if (node.has("pattern")) {
ruleFactory.getPatternRule().apply(nodeName, node.get("pattern"), node, field, schema);
}
ruleFactory.getDefaultRule().apply(nodeName, node.get("default"), node, field, schema);
ruleFactory.getMinimumMaximumRule().apply(nodeName, node, parent, field, schema);
ruleFactory.getMinItemsMaxItemsRule().apply(nodeName, node, parent, field, schema);
ruleFactory.getMinLengthMaxLengthRule().apply(nodeName, node, parent, field, schema);
if (isObject(node) || isArray(node)) {
ruleFactory.getValidRule().apply(nodeName, node, parent, field, schema);
}
return jclass;
} }
|
public class class_name {
@Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
String propertyName = ruleFactory.getNameHelper().getPropertyName(nodeName, node);
JType propertyType = ruleFactory.getSchemaRule().apply(nodeName, node, parent, jclass, schema);
boolean isIncludeGetters = ruleFactory.getGenerationConfig().isIncludeGetters();
boolean isIncludeSetters = ruleFactory.getGenerationConfig().isIncludeSetters();
node = resolveRefs(node, schema);
int accessModifier = isIncludeGetters || isIncludeSetters ? JMod.PRIVATE : JMod.PUBLIC;
JFieldVar field = jclass.field(accessModifier, propertyType, propertyName);
propertyAnnotations(nodeName, node, schema, field);
formatAnnotation(field, jclass, node);
ruleFactory.getAnnotator().propertyField(field, jclass, nodeName, node);
if (isIncludeGetters) {
JMethod getter = addGetter(jclass, field, nodeName, node, isRequired(nodeName, node, schema), useOptional(nodeName, node, schema));
ruleFactory.getAnnotator().propertyGetter(getter, jclass, nodeName); // depends on control dependency: [if], data = [none]
propertyAnnotations(nodeName, node, schema, getter); // depends on control dependency: [if], data = [none]
}
if (isIncludeSetters) {
JMethod setter = addSetter(jclass, field, nodeName, node);
ruleFactory.getAnnotator().propertySetter(setter, jclass, nodeName); // depends on control dependency: [if], data = [none]
propertyAnnotations(nodeName, node, schema, setter); // depends on control dependency: [if], data = [none]
}
if (ruleFactory.getGenerationConfig().isGenerateBuilders()) {
addBuilderMethod(jclass, field, nodeName, node); // depends on control dependency: [if], data = [none]
}
if (node.has("pattern")) {
ruleFactory.getPatternRule().apply(nodeName, node.get("pattern"), node, field, schema); // depends on control dependency: [if], data = [none]
}
ruleFactory.getDefaultRule().apply(nodeName, node.get("default"), node, field, schema);
ruleFactory.getMinimumMaximumRule().apply(nodeName, node, parent, field, schema);
ruleFactory.getMinItemsMaxItemsRule().apply(nodeName, node, parent, field, schema);
ruleFactory.getMinLengthMaxLengthRule().apply(nodeName, node, parent, field, schema);
if (isObject(node) || isArray(node)) {
ruleFactory.getValidRule().apply(nodeName, node, parent, field, schema); // depends on control dependency: [if], data = [none]
}
return jclass;
} }
|
public class class_name {
public void shutdown() {
for (Channel c : channels) {
ChannelPipeline pipeline = c.getPipeline();
RedisAsyncConnection<?, ?> connection = pipeline.get(RedisAsyncConnection.class);
connection.close();
}
ChannelGroupFuture future = channels.close();
future.awaitUninterruptibly();
bootstrap.releaseExternalResources();
} }
|
public class class_name {
public void shutdown() {
for (Channel c : channels) {
ChannelPipeline pipeline = c.getPipeline();
RedisAsyncConnection<?, ?> connection = pipeline.get(RedisAsyncConnection.class); // depends on control dependency: [for], data = [c]
connection.close(); // depends on control dependency: [for], data = [c]
}
ChannelGroupFuture future = channels.close();
future.awaitUninterruptibly();
bootstrap.releaseExternalResources();
} }
|
public class class_name {
public List<Long> getAllTableIconIds(String featureTable) {
List<Long> iconIds = null;
StyleMappingDao mappingDao = getTableIconMappingDao(featureTable);
if (mappingDao != null) {
iconIds = mappingDao.uniqueRelatedIds();
}
return iconIds;
} }
|
public class class_name {
public List<Long> getAllTableIconIds(String featureTable) {
List<Long> iconIds = null;
StyleMappingDao mappingDao = getTableIconMappingDao(featureTable);
if (mappingDao != null) {
iconIds = mappingDao.uniqueRelatedIds(); // depends on control dependency: [if], data = [none]
}
return iconIds;
} }
|
public class class_name {
@Override
public Iterable<? extends GeoDocument> findAllDocuments() {
final SortedSet<String> names = new TreeSet<>();
names.addAll(map.keySet());
final List<GeoDocument> list = new ArrayList<>();
for (final String name : names) {
list.add(getDocument(name));
}
return list;
} }
|
public class class_name {
@Override
public Iterable<? extends GeoDocument> findAllDocuments() {
final SortedSet<String> names = new TreeSet<>();
names.addAll(map.keySet());
final List<GeoDocument> list = new ArrayList<>();
for (final String name : names) {
list.add(getDocument(name)); // depends on control dependency: [for], data = [name]
}
return list;
} }
|
public class class_name {
public void marshall(OperatingSystemConfigurationManager operatingSystemConfigurationManager, ProtocolMarshaller protocolMarshaller) {
if (operatingSystemConfigurationManager == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(operatingSystemConfigurationManager.getName(), NAME_BINDING);
protocolMarshaller.marshall(operatingSystemConfigurationManager.getVersion(), VERSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(OperatingSystemConfigurationManager operatingSystemConfigurationManager, ProtocolMarshaller protocolMarshaller) {
if (operatingSystemConfigurationManager == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(operatingSystemConfigurationManager.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(operatingSystemConfigurationManager.getVersion(), VERSION_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 {
protected boolean _setProperty(String name, Object value) throws SAXNotSupportedException{
if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){
if(value==null || value instanceof LexicalHandler){
handler.setLexicalHandler((LexicalHandler)value);
return true;
}else
throw new SAXNotSupportedException("value must implement "+LexicalHandler.class);
}else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){
if(value==null || value instanceof DeclHandler){
handler.setDeclHandler((DeclHandler)value);
return true;
}else
throw new SAXNotSupportedException("value must implement "+DeclHandler.class);
}else
return false;
} }
|
public class class_name {
protected boolean _setProperty(String name, Object value) throws SAXNotSupportedException{
if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){
if(value==null || value instanceof LexicalHandler){
handler.setLexicalHandler((LexicalHandler)value); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}else
throw new SAXNotSupportedException("value must implement "+LexicalHandler.class);
}else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){
if(value==null || value instanceof DeclHandler){
handler.setDeclHandler((DeclHandler)value); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}else
throw new SAXNotSupportedException("value must implement "+DeclHandler.class);
}else
return false;
} }
|
public class class_name {
public Object fieldValue( ) {
if (!path) {
FieldAccess field1 = this.field();
return field1.getValue(objectUnderTest);
} else {
return BeanUtils.atIndex(objectUnderTest, name.toString());
}
} }
|
public class class_name {
public Object fieldValue( ) {
if (!path) {
FieldAccess field1 = this.field();
return field1.getValue(objectUnderTest); // depends on control dependency: [if], data = [none]
} else {
return BeanUtils.atIndex(objectUnderTest, name.toString()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(Classifier classifier, ProtocolMarshaller protocolMarshaller) {
if (classifier == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(classifier.getGrokClassifier(), GROKCLASSIFIER_BINDING);
protocolMarshaller.marshall(classifier.getXMLClassifier(), XMLCLASSIFIER_BINDING);
protocolMarshaller.marshall(classifier.getJsonClassifier(), JSONCLASSIFIER_BINDING);
protocolMarshaller.marshall(classifier.getCsvClassifier(), CSVCLASSIFIER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Classifier classifier, ProtocolMarshaller protocolMarshaller) {
if (classifier == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(classifier.getGrokClassifier(), GROKCLASSIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(classifier.getXMLClassifier(), XMLCLASSIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(classifier.getJsonClassifier(), JSONCLASSIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(classifier.getCsvClassifier(), CSVCLASSIFIER_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 {
@Pure
public static URL generateShapeFileIndexFromShapeFile(File shapeFile) throws IOException {
final File shxFile = FileSystem.replaceExtension(shapeFile, "." + ShapeFileIndexFilter.EXTENSION_SHX); //$NON-NLS-1$
try (ShapeFileReader<Object> shpReader = new ShapeFileReader<>(shapeFile, new NullFactory())) {
try (ShapeFileIndexWriter shxWriter = new ShapeFileIndexWriter(
shxFile,
shpReader.getShapeElementType(),
shpReader.getBoundsFromHeader())) {
int offset = shpReader.getFileReadingPosition();
int newOffset;
int shpLength;
while (shpReader.read() != null) {
newOffset = shpReader.getFileReadingPosition();
// byte length - file header length - record header length
shpLength = newOffset - offset;
shxWriter.write(shpLength);
offset = newOffset;
}
}
}
return shxFile.toURI().toURL();
} }
|
public class class_name {
@Pure
public static URL generateShapeFileIndexFromShapeFile(File shapeFile) throws IOException {
final File shxFile = FileSystem.replaceExtension(shapeFile, "." + ShapeFileIndexFilter.EXTENSION_SHX); //$NON-NLS-1$
try (ShapeFileReader<Object> shpReader = new ShapeFileReader<>(shapeFile, new NullFactory())) {
try (ShapeFileIndexWriter shxWriter = new ShapeFileIndexWriter(
shxFile,
shpReader.getShapeElementType(),
shpReader.getBoundsFromHeader())) {
int offset = shpReader.getFileReadingPosition();
int newOffset;
int shpLength;
while (shpReader.read() != null) {
newOffset = shpReader.getFileReadingPosition(); // depends on control dependency: [while], data = [none]
// byte length - file header length - record header length
shpLength = newOffset - offset; // depends on control dependency: [while], data = [none]
shxWriter.write(shpLength); // depends on control dependency: [while], data = [none]
offset = newOffset; // depends on control dependency: [while], data = [none]
}
}
}
return shxFile.toURI().toURL();
} }
|
public class class_name {
public static boolean hasModifier(Class<?> clazz, ModifierType... modifierTypes) {
if (null == clazz || ArrayUtil.isEmpty(modifierTypes)) {
return false;
}
return 0 != (clazz.getModifiers() & modifiersToInt(modifierTypes));
} }
|
public class class_name {
public static boolean hasModifier(Class<?> clazz, ModifierType... modifierTypes) {
if (null == clazz || ArrayUtil.isEmpty(modifierTypes)) {
return false;
// depends on control dependency: [if], data = [none]
}
return 0 != (clazz.getModifiers() & modifiersToInt(modifierTypes));
} }
|
public class class_name {
public static <T> T getFieldValue(Object target, String fieldName) {
try {
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
@SuppressWarnings("unchecked")
T returnValue = (T) field.get(target);
return returnValue;
} catch (NoSuchFieldException e) {
throw handleException(fieldName, e);
} catch (IllegalAccessException e) {
throw handleException(fieldName, e);
}
} }
|
public class class_name {
public static <T> T getFieldValue(Object target, String fieldName) {
try {
Field field = target.getClass().getDeclaredField(fieldName);
field.setAccessible(true); // depends on control dependency: [try], data = [none]
@SuppressWarnings("unchecked")
T returnValue = (T) field.get(target);
return returnValue; // depends on control dependency: [try], data = [none]
} catch (NoSuchFieldException e) {
throw handleException(fieldName, e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
throw handleException(fieldName, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void runMain(String[] args) {
server = StatusServer.startServer(new InMemoryStatusStorage(), statusPort);
if (mediaDriver == null)
mediaDriver = MediaDriver.launchEmbedded();
log.info("Started media driver with aeron directory " + mediaDriver.aeronDirectoryName());
//cache a reference to the first listener.
//The reason we do this is to share an updater and listener across *all* subscribers
//This will create a shared pool of subscribers all updating the same "server".
//This will simulate a shared pool but allow an accumulative effect of anything
//like averaging we try.
NDArrayCallback parameterServerListener = null;
ParameterServerListener cast = null;
for (int i = 0; i < numWorkers; i++) {
subscriber[i] = new ParameterServerSubscriber(mediaDriver);
//ensure reuse of aeron wherever possible
if (aeron == null)
aeron = Aeron.connect(getContext(mediaDriver));
subscriber[i].setAeron(aeron);
List<String> multiArgs = new ArrayList<>(Arrays.asList(args));
if (multiArgs.contains("-id")) {
int streamIdIdx = multiArgs.indexOf("-id") + 1;
int streamId = Integer.parseInt(multiArgs.get(streamIdIdx)) + i;
multiArgs.set(streamIdIdx, String.valueOf(streamId));
} else if (multiArgs.contains("--streamId")) {
int streamIdIdx = multiArgs.indexOf("--streamId") + 1;
int streamId = Integer.parseInt(multiArgs.get(streamIdIdx)) + i;
multiArgs.set(streamIdIdx, String.valueOf(streamId));
}
if (i == 0) {
subscriber[i].run(multiArgs.toArray(new String[args.length]));
parameterServerListener = subscriber[i].getCallback();
cast = subscriber[i].getParameterServerListener();
} else {
//note that we set both the callback AND the listener here
subscriber[i].setCallback(parameterServerListener);
subscriber[i].setParameterServerListener(cast);
//now run the callback initialized with this callback instead
//in the run method it will use this reference instead of creating it
//itself
subscriber[i].run(multiArgs.toArray(new String[args.length]));
}
}
} }
|
public class class_name {
public void runMain(String[] args) {
server = StatusServer.startServer(new InMemoryStatusStorage(), statusPort);
if (mediaDriver == null)
mediaDriver = MediaDriver.launchEmbedded();
log.info("Started media driver with aeron directory " + mediaDriver.aeronDirectoryName());
//cache a reference to the first listener.
//The reason we do this is to share an updater and listener across *all* subscribers
//This will create a shared pool of subscribers all updating the same "server".
//This will simulate a shared pool but allow an accumulative effect of anything
//like averaging we try.
NDArrayCallback parameterServerListener = null;
ParameterServerListener cast = null;
for (int i = 0; i < numWorkers; i++) {
subscriber[i] = new ParameterServerSubscriber(mediaDriver); // depends on control dependency: [for], data = [i]
//ensure reuse of aeron wherever possible
if (aeron == null)
aeron = Aeron.connect(getContext(mediaDriver));
subscriber[i].setAeron(aeron); // depends on control dependency: [for], data = [i]
List<String> multiArgs = new ArrayList<>(Arrays.asList(args));
if (multiArgs.contains("-id")) {
int streamIdIdx = multiArgs.indexOf("-id") + 1;
int streamId = Integer.parseInt(multiArgs.get(streamIdIdx)) + i;
multiArgs.set(streamIdIdx, String.valueOf(streamId)); // depends on control dependency: [if], data = [none]
} else if (multiArgs.contains("--streamId")) {
int streamIdIdx = multiArgs.indexOf("--streamId") + 1;
int streamId = Integer.parseInt(multiArgs.get(streamIdIdx)) + i;
multiArgs.set(streamIdIdx, String.valueOf(streamId)); // depends on control dependency: [if], data = [none]
}
if (i == 0) {
subscriber[i].run(multiArgs.toArray(new String[args.length])); // depends on control dependency: [if], data = [none]
parameterServerListener = subscriber[i].getCallback(); // depends on control dependency: [if], data = [none]
cast = subscriber[i].getParameterServerListener(); // depends on control dependency: [if], data = [none]
} else {
//note that we set both the callback AND the listener here
subscriber[i].setCallback(parameterServerListener); // depends on control dependency: [if], data = [none]
subscriber[i].setParameterServerListener(cast); // depends on control dependency: [if], data = [none]
//now run the callback initialized with this callback instead
//in the run method it will use this reference instead of creating it
//itself
subscriber[i].run(multiArgs.toArray(new String[args.length])); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public CtorDescriptor getCtorDescriptor(final Class[] args, final boolean declared) {
CtorDescriptor ctorDescriptor = getCtors().getCtorDescriptor(args);
if ((ctorDescriptor != null) && ctorDescriptor.matchDeclared(declared)) {
return ctorDescriptor;
}
return null;
} }
|
public class class_name {
public CtorDescriptor getCtorDescriptor(final Class[] args, final boolean declared) {
CtorDescriptor ctorDescriptor = getCtors().getCtorDescriptor(args);
if ((ctorDescriptor != null) && ctorDescriptor.matchDeclared(declared)) {
return ctorDescriptor; // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public boolean setKeepAliveTimeout(String ipAddress, int port, long timeout) throws Exception {
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> queryNames = mbeanServer.queryNames(new ObjectName("*:type=Service,*"), null);
boolean changed = false;
for(ObjectName objectName : queryNames) {
changed = (Boolean) mbeanServer.invoke(objectName, "setKeepAliveTimeout", new Object[]{this, ipAddress, port, timeout}, new String[] {SipConnector.class.getName() , String.class.getName(), "int" , "long"});
if(changed) {
return changed;
}
}
return false;
} }
|
public class class_name {
public boolean setKeepAliveTimeout(String ipAddress, int port, long timeout) throws Exception {
MBeanServer mbeanServer = getMBeanServer();
Set<ObjectName> queryNames = mbeanServer.queryNames(new ObjectName("*:type=Service,*"), null);
boolean changed = false;
for(ObjectName objectName : queryNames) {
changed = (Boolean) mbeanServer.invoke(objectName, "setKeepAliveTimeout", new Object[]{this, ipAddress, port, timeout}, new String[] {SipConnector.class.getName() , String.class.getName(), "int" , "long"});
if(changed) {
return changed; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public String awaitImageId(long timeout, TimeUnit timeUnit) {
try {
awaitCompletion(timeout, timeUnit);
} catch (InterruptedException e) {
throw new DockerClientException("Awaiting image id interrupted: ", e);
}
return getImageId();
} }
|
public class class_name {
public String awaitImageId(long timeout, TimeUnit timeUnit) {
try {
awaitCompletion(timeout, timeUnit); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
throw new DockerClientException("Awaiting image id interrupted: ", e);
} // depends on control dependency: [catch], data = [none]
return getImageId();
} }
|
public class class_name {
static NameConstraintsExtension mergeNameConstraints(
X509Certificate currCert, NameConstraintsExtension prevNC)
throws CertPathValidatorException
{
X509CertImpl currCertImpl;
try {
currCertImpl = X509CertImpl.toImpl(currCert);
} catch (CertificateException ce) {
throw new CertPathValidatorException(ce);
}
NameConstraintsExtension newConstraints =
currCertImpl.getNameConstraintsExtension();
if (debug != null) {
debug.println("prevNC = " + prevNC +
", newNC = " + String.valueOf(newConstraints));
}
// if there are no previous name constraints, we just return the
// new name constraints.
if (prevNC == null) {
if (debug != null) {
debug.println("mergedNC = " + String.valueOf(newConstraints));
}
if (newConstraints == null) {
return newConstraints;
} else {
// Make sure we do a clone here, because we're probably
// going to modify this object later and we don't want to
// be sharing it with a Certificate object!
return (NameConstraintsExtension)newConstraints.clone();
}
} else {
try {
// after merge, prevNC should contain the merged constraints
prevNC.merge(newConstraints);
} catch (IOException ioe) {
throw new CertPathValidatorException(ioe);
}
if (debug != null) {
debug.println("mergedNC = " + prevNC);
}
return prevNC;
}
} }
|
public class class_name {
static NameConstraintsExtension mergeNameConstraints(
X509Certificate currCert, NameConstraintsExtension prevNC)
throws CertPathValidatorException
{
X509CertImpl currCertImpl;
try {
currCertImpl = X509CertImpl.toImpl(currCert);
} catch (CertificateException ce) {
throw new CertPathValidatorException(ce);
}
NameConstraintsExtension newConstraints =
currCertImpl.getNameConstraintsExtension();
if (debug != null) {
debug.println("prevNC = " + prevNC +
", newNC = " + String.valueOf(newConstraints));
}
// if there are no previous name constraints, we just return the
// new name constraints.
if (prevNC == null) {
if (debug != null) {
debug.println("mergedNC = " + String.valueOf(newConstraints)); // depends on control dependency: [if], data = [none]
}
if (newConstraints == null) {
return newConstraints; // depends on control dependency: [if], data = [none]
} else {
// Make sure we do a clone here, because we're probably
// going to modify this object later and we don't want to
// be sharing it with a Certificate object!
return (NameConstraintsExtension)newConstraints.clone(); // depends on control dependency: [if], data = [none]
}
} else {
try {
// after merge, prevNC should contain the merged constraints
prevNC.merge(newConstraints); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
throw new CertPathValidatorException(ioe);
} // depends on control dependency: [catch], data = [none]
if (debug != null) {
debug.println("mergedNC = " + prevNC); // depends on control dependency: [if], data = [none]
}
return prevNC;
}
} }
|
public class class_name {
public void reacquireLock (NodeObject.Lock lock)
{
// make sure we're releasing it
LockHandler handler = _locks.get(lock);
if (handler == null || !Objects.equal(handler.getNodeName(), _nodeName) ||
handler.isAcquiring()) {
log.warning("Tried to reacquire lock not being released", "lock", lock,
"handler", handler);
return;
}
// perform an update to let other nodes know that we're reacquiring
_nodeobj.updateLocks(lock);
// cancel the handler and report to any listeners
_locks.remove(lock);
handler.cancel();
handler.listeners.requestCompleted(_nodeName);
} }
|
public class class_name {
public void reacquireLock (NodeObject.Lock lock)
{
// make sure we're releasing it
LockHandler handler = _locks.get(lock);
if (handler == null || !Objects.equal(handler.getNodeName(), _nodeName) ||
handler.isAcquiring()) {
log.warning("Tried to reacquire lock not being released", "lock", lock,
"handler", handler); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// perform an update to let other nodes know that we're reacquiring
_nodeobj.updateLocks(lock);
// cancel the handler and report to any listeners
_locks.remove(lock);
handler.cancel();
handler.listeners.requestCompleted(_nodeName);
} }
|
public class class_name {
public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType);
setMethodsCache.set(object.getClass(), argumentType, fieldName, method);
}
return method;
} }
|
public class class_name {
public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType); // depends on control dependency: [if], data = [none]
setMethodsCache.set(object.getClass(), argumentType, fieldName, method); // depends on control dependency: [if], data = [none]
}
return method;
} }
|
public class class_name {
public String getMethodSig() {
if (!visitingMethod) {
throw new IllegalStateException("getMethodSig called while not visiting method");
}
if (methodSig == null) {
methodSig = getStringFromIndex(method.getSignatureIndex());
}
return methodSig;
} }
|
public class class_name {
public String getMethodSig() {
if (!visitingMethod) {
throw new IllegalStateException("getMethodSig called while not visiting method");
}
if (methodSig == null) {
methodSig = getStringFromIndex(method.getSignatureIndex()); // depends on control dependency: [if], data = [none]
}
return methodSig;
} }
|
public class class_name {
private static Element getFirstNamedElement(Element element, String name) {
NodeList list = element.getElementsByTagName(name);
if (list.getLength() == 0) {
return null;
}
return (Element) list.item(0);
} }
|
public class class_name {
private static Element getFirstNamedElement(Element element, String name) {
NodeList list = element.getElementsByTagName(name);
if (list.getLength() == 0) {
return null;
// depends on control dependency: [if], data = [none]
}
return (Element) list.item(0);
} }
|
public class class_name {
private void putFrame() {
final int numLocal = currentFrame[1];
final int numStack = currentFrame[2];
if (symbolTable.getMajorVersion() < Opcodes.V1_6) {
// Generate a StackMap attribute entry, which are always uncompressed.
stackMapTableEntries.putShort(currentFrame[0]).putShort(numLocal);
putAbstractTypes(3, 3 + numLocal);
stackMapTableEntries.putShort(numStack);
putAbstractTypes(3 + numLocal, 3 + numLocal + numStack);
return;
}
final int offsetDelta =
stackMapTableNumberOfEntries == 0
? currentFrame[0]
: currentFrame[0] - previousFrame[0] - 1;
final int previousNumlocal = previousFrame[1];
final int numLocalDelta = numLocal - previousNumlocal;
int type = Frame.FULL_FRAME;
if (numStack == 0) {
switch (numLocalDelta) {
case -3:
case -2:
case -1:
type = Frame.CHOP_FRAME;
break;
case 0:
type = offsetDelta < 64 ? Frame.SAME_FRAME : Frame.SAME_FRAME_EXTENDED;
break;
case 1:
case 2:
case 3:
type = Frame.APPEND_FRAME;
break;
default:
// Keep the FULL_FRAME type.
break;
}
} else if (numLocalDelta == 0 && numStack == 1) {
type =
offsetDelta < 63
? Frame.SAME_LOCALS_1_STACK_ITEM_FRAME
: Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED;
}
if (type != Frame.FULL_FRAME) {
// Verify if locals are the same as in the previous frame.
int frameIndex = 3;
for (int i = 0; i < previousNumlocal && i < numLocal; i++) {
if (currentFrame[frameIndex] != previousFrame[frameIndex]) {
type = Frame.FULL_FRAME;
break;
}
frameIndex++;
}
}
switch (type) {
case Frame.SAME_FRAME:
stackMapTableEntries.putByte(offsetDelta);
break;
case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME:
stackMapTableEntries.putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME + offsetDelta);
putAbstractTypes(3 + numLocal, 4 + numLocal);
break;
case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED:
stackMapTableEntries
.putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED)
.putShort(offsetDelta);
putAbstractTypes(3 + numLocal, 4 + numLocal);
break;
case Frame.SAME_FRAME_EXTENDED:
stackMapTableEntries.putByte(Frame.SAME_FRAME_EXTENDED).putShort(offsetDelta);
break;
case Frame.CHOP_FRAME:
stackMapTableEntries
.putByte(Frame.SAME_FRAME_EXTENDED + numLocalDelta)
.putShort(offsetDelta);
break;
case Frame.APPEND_FRAME:
stackMapTableEntries
.putByte(Frame.SAME_FRAME_EXTENDED + numLocalDelta)
.putShort(offsetDelta);
putAbstractTypes(3 + previousNumlocal, 3 + numLocal);
break;
case Frame.FULL_FRAME:
default:
stackMapTableEntries.putByte(Frame.FULL_FRAME).putShort(offsetDelta).putShort(numLocal);
putAbstractTypes(3, 3 + numLocal);
stackMapTableEntries.putShort(numStack);
putAbstractTypes(3 + numLocal, 3 + numLocal + numStack);
break;
}
} }
|
public class class_name {
private void putFrame() {
final int numLocal = currentFrame[1];
final int numStack = currentFrame[2];
if (symbolTable.getMajorVersion() < Opcodes.V1_6) {
// Generate a StackMap attribute entry, which are always uncompressed.
stackMapTableEntries.putShort(currentFrame[0]).putShort(numLocal); // depends on control dependency: [if], data = [none]
putAbstractTypes(3, 3 + numLocal); // depends on control dependency: [if], data = [none]
stackMapTableEntries.putShort(numStack); // depends on control dependency: [if], data = [none]
putAbstractTypes(3 + numLocal, 3 + numLocal + numStack); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
final int offsetDelta =
stackMapTableNumberOfEntries == 0
? currentFrame[0]
: currentFrame[0] - previousFrame[0] - 1;
final int previousNumlocal = previousFrame[1];
final int numLocalDelta = numLocal - previousNumlocal;
int type = Frame.FULL_FRAME;
if (numStack == 0) {
switch (numLocalDelta) {
case -3:
case -2:
case -1:
type = Frame.CHOP_FRAME;
break;
case 0:
type = offsetDelta < 64 ? Frame.SAME_FRAME : Frame.SAME_FRAME_EXTENDED;
break;
case 1:
case 2:
case 3:
type = Frame.APPEND_FRAME;
break;
default:
// Keep the FULL_FRAME type.
break;
}
} else if (numLocalDelta == 0 && numStack == 1) {
type =
offsetDelta < 63
? Frame.SAME_LOCALS_1_STACK_ITEM_FRAME
: Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED; // depends on control dependency: [if], data = [none]
}
if (type != Frame.FULL_FRAME) {
// Verify if locals are the same as in the previous frame.
int frameIndex = 3;
for (int i = 0; i < previousNumlocal && i < numLocal; i++) {
if (currentFrame[frameIndex] != previousFrame[frameIndex]) {
type = Frame.FULL_FRAME; // depends on control dependency: [if], data = [none]
break;
}
frameIndex++; // depends on control dependency: [for], data = [none]
}
}
switch (type) {
case Frame.SAME_FRAME:
stackMapTableEntries.putByte(offsetDelta);
break;
case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME:
stackMapTableEntries.putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME + offsetDelta);
putAbstractTypes(3 + numLocal, 4 + numLocal);
break;
case Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED:
stackMapTableEntries
.putByte(Frame.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED)
.putShort(offsetDelta);
putAbstractTypes(3 + numLocal, 4 + numLocal);
break;
case Frame.SAME_FRAME_EXTENDED:
stackMapTableEntries.putByte(Frame.SAME_FRAME_EXTENDED).putShort(offsetDelta);
break;
case Frame.CHOP_FRAME:
stackMapTableEntries
.putByte(Frame.SAME_FRAME_EXTENDED + numLocalDelta)
.putShort(offsetDelta);
break;
case Frame.APPEND_FRAME:
stackMapTableEntries
.putByte(Frame.SAME_FRAME_EXTENDED + numLocalDelta)
.putShort(offsetDelta);
putAbstractTypes(3 + previousNumlocal, 3 + numLocal);
break;
case Frame.FULL_FRAME:
default:
stackMapTableEntries.putByte(Frame.FULL_FRAME).putShort(offsetDelta).putShort(numLocal);
putAbstractTypes(3, 3 + numLocal);
stackMapTableEntries.putShort(numStack);
putAbstractTypes(3 + numLocal, 3 + numLocal + numStack);
break;
}
} }
|
public class class_name {
public Map<String, String> toMap() {
Element root = doc.getDocumentElement();
Map<String, String> params = new HashMap<String, String>();
// 将节点封装成map形式
NodeList list = root.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
params.put(node.getNodeName(), node.getTextContent());
}
// 含有空白符会生成一个#text参数
params.remove("#text");
return params;
} }
|
public class class_name {
public Map<String, String> toMap() {
Element root = doc.getDocumentElement();
Map<String, String> params = new HashMap<String, String>();
// 将节点封装成map形式
NodeList list = root.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node node = list.item(i);
params.put(node.getNodeName(), node.getTextContent()); // depends on control dependency: [for], data = [none]
}
// 含有空白符会生成一个#text参数
params.remove("#text");
return params;
} }
|
public class class_name {
public FutureData<ManagedSource> addAuth(String id, boolean validate, String... resources) {
if (id == null || resources == null || resources.length == 0) {
throw new IllegalArgumentException("ID and a resource is required");
}
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(ADD_AUTH));
try {
List<BaseSource.ResourceParams> list = new ArrayList<>();
for (String val : resources) {
BaseSource.ResourceParams params = new ManagedSource.ResourceParams();
params.set("value", val);
list.add(params);
}
POST request = config.http().POST(uri, new PageReader(newRequestCallback(future,
new ManagedSource(), config)))
.form("id", id)
.form("auth", DataSiftClient.MAPPER.writeValueAsString(list))
.form("validate", DataSiftClient.MAPPER.writeValueAsString(Arrays.asList(validate)));
performRequest(future, request);
} catch (JsonProcessingException jpe) {
future.interuptCause(jpe);
future.doNotify();
}
return future;
} }
|
public class class_name {
public FutureData<ManagedSource> addAuth(String id, boolean validate, String... resources) {
if (id == null || resources == null || resources.length == 0) {
throw new IllegalArgumentException("ID and a resource is required");
}
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(ADD_AUTH));
try {
List<BaseSource.ResourceParams> list = new ArrayList<>();
for (String val : resources) {
BaseSource.ResourceParams params = new ManagedSource.ResourceParams();
params.set("value", val); // depends on control dependency: [for], data = [val]
list.add(params); // depends on control dependency: [for], data = [none]
}
POST request = config.http().POST(uri, new PageReader(newRequestCallback(future,
new ManagedSource(), config)))
.form("id", id)
.form("auth", DataSiftClient.MAPPER.writeValueAsString(list))
.form("validate", DataSiftClient.MAPPER.writeValueAsString(Arrays.asList(validate)));
performRequest(future, request); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException jpe) {
future.interuptCause(jpe);
future.doNotify();
} // depends on control dependency: [catch], data = [none]
return future;
} }
|
public class class_name {
public static UIComponentTag getParentUIComponentTag(PageContext context) {
UIComponentClassicTagBase result =
getParentUIComponentClassicTagBase(context);
if (!(result instanceof UIComponentTag)) {
return new UIComponentTagAdapter(result);
}
return ((UIComponentTag) result);
} }
|
public class class_name {
public static UIComponentTag getParentUIComponentTag(PageContext context) {
UIComponentClassicTagBase result =
getParentUIComponentClassicTagBase(context);
if (!(result instanceof UIComponentTag)) {
return new UIComponentTagAdapter(result); // depends on control dependency: [if], data = [none]
}
return ((UIComponentTag) result);
} }
|
public class class_name {
public static Environment of(@NonNull URL url) {
try {
return of(url.openStream());
} catch (UnsupportedEncodingException e) {
} catch (IOException e) {
throw new IllegalStateException(e);
}
return null;
} }
|
public class class_name {
public static Environment of(@NonNull URL url) {
try {
return of(url.openStream()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public List<String> listInstanceIDs(final Set<String> instanceIDs) {
Set<String> allInstanceIDs = allMockEc2Instances.keySet();
if (null == instanceIDs || instanceIDs.size() == 0) {
return new ArrayList<String>(allInstanceIDs);
} else {
List<String> filteredInstanceIDs = new ArrayList<String>();
for (String id : allInstanceIDs) {
if (null != id && instanceIDs.contains(id)) {
filteredInstanceIDs.add(id);
}
}
return filteredInstanceIDs;
}
} }
|
public class class_name {
public List<String> listInstanceIDs(final Set<String> instanceIDs) {
Set<String> allInstanceIDs = allMockEc2Instances.keySet();
if (null == instanceIDs || instanceIDs.size() == 0) {
return new ArrayList<String>(allInstanceIDs); // depends on control dependency: [if], data = [none]
} else {
List<String> filteredInstanceIDs = new ArrayList<String>();
for (String id : allInstanceIDs) {
if (null != id && instanceIDs.contains(id)) {
filteredInstanceIDs.add(id); // depends on control dependency: [if], data = [none]
}
}
return filteredInstanceIDs; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void joinAndStoreBundle(JoinableResourceBundle bundle) {
BundleProcessingStatus status = new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle,
resourceHandler, config);
JoinableResourceBundleContent store = null;
// Process the bundle for searching variant
if (needToSearchForVariantInPostProcess || hasVariantPostProcessor(bundle)) {
status.setSearchingPostProcessorVariants(true);
joinAndPostProcessBundle(bundle, status);
// Process the bundles
status.setSearchingPostProcessorVariants(false);
Map<String, VariantSet> postProcessVariants = status.getPostProcessVariants();
if (!postProcessVariants.isEmpty()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Post process variants found for bundle " + bundle.getId() + ":" + postProcessVariants);
}
Map<String, VariantSet> newVariants = VariantUtils.concatVariants(bundle.getVariants(),
postProcessVariants);
bundle.setVariants(newVariants);
joinAndPostProcessBundle(bundle, status);
}
} else {
status.setSearchingPostProcessorVariants(false);
joinAndPostProcessBundle(bundle, status);
}
// Store the collected resources as a single file, both in text and
// gzip formats.
store = joinAndPostprocessBundle(bundle, null, status);
storeBundle(bundle.getId(), store);
// Set the data hascode in the bundle, in case the prefix needs to
// be generated
initBundleDataHashcode(bundle, store, null);
} }
|
public class class_name {
private void joinAndStoreBundle(JoinableResourceBundle bundle) {
BundleProcessingStatus status = new BundleProcessingStatus(BundleProcessingStatus.FILE_PROCESSING_TYPE, bundle,
resourceHandler, config);
JoinableResourceBundleContent store = null;
// Process the bundle for searching variant
if (needToSearchForVariantInPostProcess || hasVariantPostProcessor(bundle)) {
status.setSearchingPostProcessorVariants(true); // depends on control dependency: [if], data = [none]
joinAndPostProcessBundle(bundle, status); // depends on control dependency: [if], data = [none]
// Process the bundles
status.setSearchingPostProcessorVariants(false); // depends on control dependency: [if], data = [none]
Map<String, VariantSet> postProcessVariants = status.getPostProcessVariants();
if (!postProcessVariants.isEmpty()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Post process variants found for bundle " + bundle.getId() + ":" + postProcessVariants); // depends on control dependency: [if], data = [none]
}
Map<String, VariantSet> newVariants = VariantUtils.concatVariants(bundle.getVariants(),
postProcessVariants);
bundle.setVariants(newVariants); // depends on control dependency: [if], data = [none]
joinAndPostProcessBundle(bundle, status); // depends on control dependency: [if], data = [none]
}
} else {
status.setSearchingPostProcessorVariants(false); // depends on control dependency: [if], data = [none]
joinAndPostProcessBundle(bundle, status); // depends on control dependency: [if], data = [none]
}
// Store the collected resources as a single file, both in text and
// gzip formats.
store = joinAndPostprocessBundle(bundle, null, status);
storeBundle(bundle.getId(), store);
// Set the data hascode in the bundle, in case the prefix needs to
// be generated
initBundleDataHashcode(bundle, store, null);
} }
|
public class class_name {
public boolean set(final int index, final ByteBuffer buf) {
if (!validState) {
throw new InvalidStateException();
}
if (log.isDebugEnabled()) {
log.debug("set(" + index + "," + buf + ")");
}
try {
if (buf.limit() > blockSize) {
log.error("ERROR: buffer.capacity=" + buf.limit() + " > blocksize=" + blockSize);
}
if (useMmap) {
final MappedByteBuffer mbb = getMmapForIndex(index);
if (mbb != null) {
mbb.put(buf);
return true;
}
// Fallback to RAF
}
fileChannel.position(index * blockSize).write(buf);
return true;
} catch (Exception e) {
log.error("Exception in set(" + index + ")", e);
}
return false;
} }
|
public class class_name {
public boolean set(final int index, final ByteBuffer buf) {
if (!validState) {
throw new InvalidStateException();
}
if (log.isDebugEnabled()) {
log.debug("set(" + index + "," + buf + ")"); // depends on control dependency: [if], data = [none]
}
try {
if (buf.limit() > blockSize) {
log.error("ERROR: buffer.capacity=" + buf.limit() + " > blocksize=" + blockSize); // depends on control dependency: [if], data = [blockSize)]
}
if (useMmap) {
final MappedByteBuffer mbb = getMmapForIndex(index);
if (mbb != null) {
mbb.put(buf); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
// Fallback to RAF
}
fileChannel.position(index * blockSize).write(buf); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error("Exception in set(" + index + ")", e);
} // depends on control dependency: [catch], data = [none]
return false;
} }
|
public class class_name {
public ListJobsResult withJobSummaries(JobSummary... jobSummaries) {
if (this.jobSummaries == null) {
setJobSummaries(new java.util.ArrayList<JobSummary>(jobSummaries.length));
}
for (JobSummary ele : jobSummaries) {
this.jobSummaries.add(ele);
}
return this;
} }
|
public class class_name {
public ListJobsResult withJobSummaries(JobSummary... jobSummaries) {
if (this.jobSummaries == null) {
setJobSummaries(new java.util.ArrayList<JobSummary>(jobSummaries.length)); // depends on control dependency: [if], data = [none]
}
for (JobSummary ele : jobSummaries) {
this.jobSummaries.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private void tryToEraseSimulator() {
int numTries = 0;
boolean successfulReset = false;
while ((!successfulReset) && (numTries < NUMBER_TRIES_RESET_DEVICE)) {
log.info("Wait " + SLEEP_TIME_BETWEEN_RESET_TRIES + " milliseconds before reattempt.");
try {
Thread.sleep(SLEEP_TIME_BETWEEN_RESET_TRIES);
} catch (InterruptedException e) {
// ignored
}
successfulReset = eraseSimulator();
numTries += 1;
}
if (!successfulReset) {
int totalWaitTime = SLEEP_TIME_BETWEEN_RESET_TRIES * NUMBER_TRIES_RESET_DEVICE;
String message = "Erase contents and settings still failed. Total waiting time: "
+ totalWaitTime
+ ". Now try to shutdown device: " + deviceUUID;
log.warning(message);
Boolean successfulShutdown = shutdownDevice();
if (successfulShutdown) {
successfulReset = eraseSimulator();
}
if (!successfulReset) {
message = "Unable to erase contents and settings of this device: " + deviceUUID;
log.warning(message);
// add more information to exception message
message += ". Tried " + NUMBER_TRIES_RESET_DEVICE + " times with with a waiting period of " + SLEEP_TIME_BETWEEN_RESET_TRIES
+ " millisecond between each attempt. ";
if (!successfulShutdown) {
message += "Also unable to shut down the device.";
}
throw new WebDriverException(message);
}
}
} }
|
public class class_name {
private void tryToEraseSimulator() {
int numTries = 0;
boolean successfulReset = false;
while ((!successfulReset) && (numTries < NUMBER_TRIES_RESET_DEVICE)) {
log.info("Wait " + SLEEP_TIME_BETWEEN_RESET_TRIES + " milliseconds before reattempt."); // depends on control dependency: [while], data = [none]
try {
Thread.sleep(SLEEP_TIME_BETWEEN_RESET_TRIES); // depends on control dependency: [try], data = [none]
} catch (InterruptedException e) {
// ignored
} // depends on control dependency: [catch], data = [none]
successfulReset = eraseSimulator(); // depends on control dependency: [while], data = [none]
numTries += 1; // depends on control dependency: [while], data = [none]
}
if (!successfulReset) {
int totalWaitTime = SLEEP_TIME_BETWEEN_RESET_TRIES * NUMBER_TRIES_RESET_DEVICE;
String message = "Erase contents and settings still failed. Total waiting time: "
+ totalWaitTime
+ ". Now try to shutdown device: " + deviceUUID;
log.warning(message); // depends on control dependency: [if], data = [none]
Boolean successfulShutdown = shutdownDevice();
if (successfulShutdown) {
successfulReset = eraseSimulator(); // depends on control dependency: [if], data = [none]
}
if (!successfulReset) {
message = "Unable to erase contents and settings of this device: " + deviceUUID; // depends on control dependency: [if], data = [none]
log.warning(message); // depends on control dependency: [if], data = [none]
// add more information to exception message
message += ". Tried " + NUMBER_TRIES_RESET_DEVICE + " times with with a waiting period of " + SLEEP_TIME_BETWEEN_RESET_TRIES
+ " millisecond between each attempt. "; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
if (!successfulShutdown) {
message += "Also unable to shut down the device."; // depends on control dependency: [if], data = [none]
}
throw new WebDriverException(message);
}
}
} }
|
public class class_name {
public static base_responses update(nitro_service client, dnszone resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnszone updateresources[] = new dnszone[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnszone();
updateresources[i].zonename = resources[i].zonename;
updateresources[i].proxymode = resources[i].proxymode;
updateresources[i].dnssecoffload = resources[i].dnssecoffload;
updateresources[i].nsec = resources[i].nsec;
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
public static base_responses update(nitro_service client, dnszone resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnszone updateresources[] = new dnszone[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnszone(); // depends on control dependency: [for], data = [i]
updateresources[i].zonename = resources[i].zonename; // depends on control dependency: [for], data = [i]
updateresources[i].proxymode = resources[i].proxymode; // depends on control dependency: [for], data = [i]
updateresources[i].dnssecoffload = resources[i].dnssecoffload; // depends on control dependency: [for], data = [i]
updateresources[i].nsec = resources[i].nsec; // depends on control dependency: [for], data = [i]
}
result = update_bulk_request(client, updateresources);
}
return result;
} }
|
public class class_name {
private String getOuFromItem(Object itemId, I_CmsOuTreeType type) {
if (type.equals(CmsOuTreeType.OU)) {
return ((CmsOrganizationalUnit)itemId).getName();
}
Object o = m_treeContainer.getParent(itemId);
while (!(o instanceof CmsOrganizationalUnit)) {
o = m_treeContainer.getParent(o);
}
return ((CmsOrganizationalUnit)o).getName();
} }
|
public class class_name {
private String getOuFromItem(Object itemId, I_CmsOuTreeType type) {
if (type.equals(CmsOuTreeType.OU)) {
return ((CmsOrganizationalUnit)itemId).getName(); // depends on control dependency: [if], data = [none]
}
Object o = m_treeContainer.getParent(itemId);
while (!(o instanceof CmsOrganizationalUnit)) {
o = m_treeContainer.getParent(o); // depends on control dependency: [while], data = [none]
}
return ((CmsOrganizationalUnit)o).getName();
} }
|
public class class_name {
static protected int getPadBits(
int bitString)
{
int val;
if (bitString == 0)
{
return 7;
}
if (bitString > 255)
{
val = ((bitString >> 8) & 0xFF);
}
else
{
val = (bitString & 0xFF);
}
int bits = 1;
while (((val <<= 1) & 0xFF) != 0)
{
bits++;
}
return 8 - bits;
} }
|
public class class_name {
static protected int getPadBits(
int bitString)
{
int val;
if (bitString == 0)
{
return 7;
// depends on control dependency: [if], data = [none]
}
if (bitString > 255)
{
val = ((bitString >> 8) & 0xFF);
// depends on control dependency: [if], data = [(bitString]
}
else
{
val = (bitString & 0xFF);
// depends on control dependency: [if], data = [(bitString]
}
int bits = 1;
while (((val <<= 1) & 0xFF) != 0)
{
bits++;
// depends on control dependency: [while], data = [none]
}
return 8 - bits;
} }
|
public class class_name {
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitText(TextTree tree, Void ignore) {
if (hasNonWhitespace(tree)) {
checkAllowsText(tree);
markEnclosingTag(Flag.HAS_TEXT);
}
return null;
} }
|
public class class_name {
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitText(TextTree tree, Void ignore) {
if (hasNonWhitespace(tree)) {
checkAllowsText(tree); // depends on control dependency: [if], data = [none]
markEnclosingTag(Flag.HAS_TEXT); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public ProjectionRect latLonToProjBB(LatLonRect latlonRect) {
if (isLatLon) {
LatLonProjection llp = (LatLonProjection) this;
llp.setCenterLon(latlonRect.getCenterLon()); // LOOK side effect BAD !!
}
ProjectionPointImpl w1 = new ProjectionPointImpl();
ProjectionPointImpl w2 = new ProjectionPointImpl();
LatLonPoint ll = latlonRect.getLowerLeftPoint();
LatLonPoint ur = latlonRect.getUpperRightPoint();
latLonToProj(ll, w1);
latLonToProj(ur, w2);
//if (!isLatLon && crossSeam(w1, w2)) {
// log.warn("CROSS SEAM failure=" + w1 + " " + w2+" for "+this, new Throwable());
//}
// make bounding box out of those two corners
ProjectionRect world = new ProjectionRect(w1.getX(), w1.getY(), w2.getX(), w2.getY());
LatLonPointImpl la = new LatLonPointImpl();
LatLonPointImpl lb = new LatLonPointImpl();
// now extend if needed to the other two corners
la.setLatitude(ur.getLatitude());
la.setLongitude(ll.getLongitude());
latLonToProj(la, w1);
world.add(w1);
lb.setLatitude(ll.getLatitude());
lb.setLongitude(ur.getLongitude());
latLonToProj(lb, w2);
world.add(w2);
return world;
} }
|
public class class_name {
public ProjectionRect latLonToProjBB(LatLonRect latlonRect) {
if (isLatLon) {
LatLonProjection llp = (LatLonProjection) this;
llp.setCenterLon(latlonRect.getCenterLon()); // LOOK side effect BAD !!
// depends on control dependency: [if], data = [none]
}
ProjectionPointImpl w1 = new ProjectionPointImpl();
ProjectionPointImpl w2 = new ProjectionPointImpl();
LatLonPoint ll = latlonRect.getLowerLeftPoint();
LatLonPoint ur = latlonRect.getUpperRightPoint();
latLonToProj(ll, w1);
latLonToProj(ur, w2);
//if (!isLatLon && crossSeam(w1, w2)) {
// log.warn("CROSS SEAM failure=" + w1 + " " + w2+" for "+this, new Throwable());
//}
// make bounding box out of those two corners
ProjectionRect world = new ProjectionRect(w1.getX(), w1.getY(), w2.getX(), w2.getY());
LatLonPointImpl la = new LatLonPointImpl();
LatLonPointImpl lb = new LatLonPointImpl();
// now extend if needed to the other two corners
la.setLatitude(ur.getLatitude());
la.setLongitude(ll.getLongitude());
latLonToProj(la, w1);
world.add(w1);
lb.setLatitude(ll.getLatitude());
lb.setLongitude(ur.getLongitude());
latLonToProj(lb, w2);
world.add(w2);
return world;
} }
|
public class class_name {
private void add(int startHour, int limitHour, DayPeriod period) {
for (int i = startHour; i != limitHour; ++i) {
if (i == 24) { i = 0; }
dayPeriodForHour[i] = period;
}
} }
|
public class class_name {
private void add(int startHour, int limitHour, DayPeriod period) {
for (int i = startHour; i != limitHour; ++i) {
if (i == 24) { i = 0; } // depends on control dependency: [if], data = [none]
dayPeriodForHour[i] = period; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public void initialize(final int appId, ICallStatsTokenGenerator tokenGenerator,
final String bridgeId, final ServerInfo serverInfo,
final CallStatsInitListener callStatsInitListener) {
if (appId <= 0 || StringUtils.isBlank(bridgeId) || serverInfo == null
|| callStatsInitListener == null) {
logger.error("intialize: Arguments cannot be null ");
throw new IllegalArgumentException("intialize: Arguments cannot be null");
}
this.appId = appId;
this.tokenGenerator = tokenGenerator;
this.bridgeId = bridgeId;
this.listener = callStatsInitListener;
this.serverInfo = serverInfo;
CallStatsConfigProvider.init();
httpClient = new CallStatsHttp2Client(CallStatsConfigProvider.connectionTimeOut);
authHttpClient = new CallStatsHttp2Client(CallStatsConfigProvider.connectionTimeOut);
authenticator = new CallStatsAuthenticator(appId, this.tokenGenerator, bridgeId, authHttpClient,
new CallStatsInitListener() {
public void onInitialized(String msg) {
setInitialized(true);
logger.info("SDK Initialized " + msg);
startKeepAliveThread();
listener.onInitialized(msg);
}
public void onError(CallStatsErrors error, String errMsg) {
logger.info("SDK Initialization Failed " + errMsg);
listener.onError(error, errMsg);;
}
});
authenticator.doAuthentication();
} }
|
public class class_name {
public void initialize(final int appId, ICallStatsTokenGenerator tokenGenerator,
final String bridgeId, final ServerInfo serverInfo,
final CallStatsInitListener callStatsInitListener) {
if (appId <= 0 || StringUtils.isBlank(bridgeId) || serverInfo == null
|| callStatsInitListener == null) {
logger.error("intialize: Arguments cannot be null "); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException("intialize: Arguments cannot be null");
}
this.appId = appId;
this.tokenGenerator = tokenGenerator;
this.bridgeId = bridgeId;
this.listener = callStatsInitListener;
this.serverInfo = serverInfo;
CallStatsConfigProvider.init();
httpClient = new CallStatsHttp2Client(CallStatsConfigProvider.connectionTimeOut);
authHttpClient = new CallStatsHttp2Client(CallStatsConfigProvider.connectionTimeOut);
authenticator = new CallStatsAuthenticator(appId, this.tokenGenerator, bridgeId, authHttpClient,
new CallStatsInitListener() {
public void onInitialized(String msg) {
setInitialized(true);
logger.info("SDK Initialized " + msg);
startKeepAliveThread();
listener.onInitialized(msg);
}
public void onError(CallStatsErrors error, String errMsg) {
logger.info("SDK Initialization Failed " + errMsg);
listener.onError(error, errMsg);;
}
});
authenticator.doAuthentication();
} }
|
public class class_name {
public SplitDataProperties<T> splitsPartitionedBy(String partitionMethodId, String partitionFields) {
if (partitionFields == null) {
throw new InvalidProgramException("PartitionFields may not be null.");
}
String[] partitionKeysA = partitionFields.split(";");
if (partitionKeysA.length == 0) {
throw new InvalidProgramException("PartitionFields may not be empty.");
}
this.splitPartitionKeys = getAllFlatKeys(partitionKeysA);
if (partitionMethodId != null) {
this.splitPartitioner = new SourcePartitionerMarker<>(partitionMethodId);
}
else {
this.splitPartitioner = null;
}
return this;
} }
|
public class class_name {
public SplitDataProperties<T> splitsPartitionedBy(String partitionMethodId, String partitionFields) {
if (partitionFields == null) {
throw new InvalidProgramException("PartitionFields may not be null.");
}
String[] partitionKeysA = partitionFields.split(";");
if (partitionKeysA.length == 0) {
throw new InvalidProgramException("PartitionFields may not be empty.");
}
this.splitPartitionKeys = getAllFlatKeys(partitionKeysA);
if (partitionMethodId != null) {
this.splitPartitioner = new SourcePartitionerMarker<>(partitionMethodId); // depends on control dependency: [if], data = [(partitionMethodId]
}
else {
this.splitPartitioner = null; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public void stop(MissionDiagnostics diags)
{
if( !this.isRunning )
{
return;
}
if (this.videoProducer != null)
this.videoProducer.cleanup();
// stop sending video frames
try
{
MinecraftForge.EVENT_BUS.unregister(this);
}
catch(Exception e)
{
System.out.println("Failed to unregister video hook: " + e);
}
// Close our TCP socket:
this.connection.close();
this.isRunning = false;
// allow the user to resize the window again
Display.setResizable(true);
// And fill in some diagnostic data:
if (diags != null)
{
VideoData vd = new VideoData();
vd.setFrameType(this.videoProducer.getVideoType().toString());
vd.setFramesSent((int) this.framesSent);
if (this.timeOfLastFrame == this.timeOfFirstFrame)
vd.setAverageFpsSent(new BigDecimal(0));
else
vd.setAverageFpsSent(new BigDecimal(1000.0 * this.framesSent / (this.timeOfLastFrame - this.timeOfFirstFrame)));
diags.getVideoData().add(vd);
}
} }
|
public class class_name {
public void stop(MissionDiagnostics diags)
{
if( !this.isRunning )
{
return; // depends on control dependency: [if], data = [none]
}
if (this.videoProducer != null)
this.videoProducer.cleanup();
// stop sending video frames
try
{
MinecraftForge.EVENT_BUS.unregister(this); // depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
System.out.println("Failed to unregister video hook: " + e);
} // depends on control dependency: [catch], data = [none]
// Close our TCP socket:
this.connection.close();
this.isRunning = false;
// allow the user to resize the window again
Display.setResizable(true);
// And fill in some diagnostic data:
if (diags != null)
{
VideoData vd = new VideoData();
vd.setFrameType(this.videoProducer.getVideoType().toString()); // depends on control dependency: [if], data = [none]
vd.setFramesSent((int) this.framesSent); // depends on control dependency: [if], data = [none]
if (this.timeOfLastFrame == this.timeOfFirstFrame)
vd.setAverageFpsSent(new BigDecimal(0));
else
vd.setAverageFpsSent(new BigDecimal(1000.0 * this.framesSent / (this.timeOfLastFrame - this.timeOfFirstFrame)));
diags.getVideoData().add(vd); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
@FFDCIgnore({JspCoreException.class})
public List<String> getInjectionClasses(Container moduleContainer) {
List<String> result = new ArrayList<String>();
//WebAppConfig webAppConfig = null;
WebAppConfiguration webAppConfiguration = null;
JspXmlExtConfig jspConfig = null;
try {
webAppConfiguration = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class);
jspConfig = moduleContainer.adapt(JspXmlExtConfig.class);
} catch (UnableToAdaptException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){
logger.logp(Level.FINE, CLASS_NAME, "getInjectionClasses", "exception getting injection classes for jsp", e);
}
}
//if (webAppConfig!=null) {
if (jspConfig!=null) {
//List tagLibs = webAppConfig.getTagLibs();
Map tagLibs = jspConfig.getTagLibMap();
JspOptions options = jspConfig.getJspOptions();
if (tagLibs!=null) {
try {
GlobalTagLibraryCache globalCache = JSPExtensionFactory.getGlobalTagLibraryCache();
Map globalTagLibMap = globalCache.getGlobalTagLibMapForWebApp(moduleContainer, jspConfig);
TagLibraryCache tagLibCacheList = new TagLibraryCache(moduleContainer, tagLibs, options, null, globalTagLibMap, globalCache.getImplicitTagLibPrefixMap(),
globalCache.getOptimizedTagConfigMap(), webAppConfiguration);
List<String> jspListeners = (List<String>)tagLibCacheList.getEventListenerList(); //List<String>
result.addAll(jspListeners);
List<String> tags = tagLibCacheList.getTagsList();
result.addAll(tags);
return result;
} catch (JspCoreException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){
logger.logp(Level.FINE, CLASS_NAME, "getInjectionClasses", "exception getting injection classes for jsp", e);
}
}
}
}
return result;
} }
|
public class class_name {
@Override
@FFDCIgnore({JspCoreException.class})
public List<String> getInjectionClasses(Container moduleContainer) {
List<String> result = new ArrayList<String>();
//WebAppConfig webAppConfig = null;
WebAppConfiguration webAppConfiguration = null;
JspXmlExtConfig jspConfig = null;
try {
webAppConfiguration = (WebAppConfiguration) moduleContainer.adapt(WebAppConfig.class); // depends on control dependency: [try], data = [none]
jspConfig = moduleContainer.adapt(JspXmlExtConfig.class); // depends on control dependency: [try], data = [none]
} catch (UnableToAdaptException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){
logger.logp(Level.FINE, CLASS_NAME, "getInjectionClasses", "exception getting injection classes for jsp", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
//if (webAppConfig!=null) {
if (jspConfig!=null) {
//List tagLibs = webAppConfig.getTagLibs();
Map tagLibs = jspConfig.getTagLibMap();
JspOptions options = jspConfig.getJspOptions();
if (tagLibs!=null) {
try {
GlobalTagLibraryCache globalCache = JSPExtensionFactory.getGlobalTagLibraryCache();
Map globalTagLibMap = globalCache.getGlobalTagLibMapForWebApp(moduleContainer, jspConfig);
TagLibraryCache tagLibCacheList = new TagLibraryCache(moduleContainer, tagLibs, options, null, globalTagLibMap, globalCache.getImplicitTagLibPrefixMap(),
globalCache.getOptimizedTagConfigMap(), webAppConfiguration);
List<String> jspListeners = (List<String>)tagLibCacheList.getEventListenerList(); //List<String>
result.addAll(jspListeners); // depends on control dependency: [try], data = [none]
List<String> tags = tagLibCacheList.getTagsList();
result.addAll(tags); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} catch (JspCoreException e) {
if(com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)){
logger.logp(Level.FINE, CLASS_NAME, "getInjectionClasses", "exception getting injection classes for jsp", e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} }
|
public class class_name {
public boolean setNonnull(HttpResponse response) {
Preconditions.checkNotNull(response);
if (set(response)) {
callback.completed(response);
return true;
} else {
return false;
}
} }
|
public class class_name {
public boolean setNonnull(HttpResponse response) {
Preconditions.checkNotNull(response);
if (set(response)) {
callback.completed(response); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean containsTagHandler(String ns, String localName)
{
if (containsNamespace(ns))
{
Map<String, TagHandlerFactory> map = _factories.get(ns);
if (map == null)
{
return false;
}
return map.containsKey(localName);
}
else
{
return false;
}
} }
|
public class class_name {
public boolean containsTagHandler(String ns, String localName)
{
if (containsNamespace(ns))
{
Map<String, TagHandlerFactory> map = _factories.get(ns);
if (map == null)
{
return false; // depends on control dependency: [if], data = [none]
}
return map.containsKey(localName); // depends on control dependency: [if], data = [none]
}
else
{
return false; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void generateWriteProperty(Builder methodBuilder, String editorName, TypeName beanClass, String beanName,
PrefsProperty property) {
Converter<String, String> formatter = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);
String tempPre = "";
String tempPost = "";
if (property.hasTypeAdapter()) {
// this comment is needed to include $T for PrefsTypeAdapterUtils
methodBuilder.addComment("Use $T to convert objects", PrefsTypeAdapterUtils.class);
tempPre = String.format("%s.getAdapter(%s.class).toData(", PrefsTypeAdapterUtils.class.getSimpleName(),
TypeUtility.className(property.typeAdapter.adapterClazz).simpleName());
tempPost = ")";
}
boolean isStringSet = isStringSet(property);
if (!isStringSet) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
methodBuilder.addStatement("String temp=serialize$L($L)", formatter.convert(property.getName()),
getter(beanName, beanClass, property));
methodBuilder.addStatement("$L.putString($S,temp)", editorName, property.getPreferenceKey());
methodBuilder.nextControlFlow(" else ");
methodBuilder.addStatement("$L.remove($S)", editorName, property.getPreferenceKey());
methodBuilder.endControlFlow();
} else {
methodBuilder.addStatement("$L.putStringSet($S," + tempPre + "$L" + tempPost + ")", editorName,
property.getPreferenceKey(), getter(beanName, beanClass, property));
}
} }
|
public class class_name {
@Override
public void generateWriteProperty(Builder methodBuilder, String editorName, TypeName beanClass, String beanName,
PrefsProperty property) {
Converter<String, String> formatter = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_CAMEL);
String tempPre = "";
String tempPost = "";
if (property.hasTypeAdapter()) {
// this comment is needed to include $T for PrefsTypeAdapterUtils
methodBuilder.addComment("Use $T to convert objects", PrefsTypeAdapterUtils.class); // depends on control dependency: [if], data = [none]
tempPre = String.format("%s.getAdapter(%s.class).toData(", PrefsTypeAdapterUtils.class.getSimpleName(),
TypeUtility.className(property.typeAdapter.adapterClazz).simpleName()); // depends on control dependency: [if], data = [none]
tempPost = ")"; // depends on control dependency: [if], data = [none]
}
boolean isStringSet = isStringSet(property);
if (!isStringSet) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property)); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("String temp=serialize$L($L)", formatter.convert(property.getName()),
getter(beanName, beanClass, property)); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("$L.putString($S,temp)", editorName, property.getPreferenceKey()); // depends on control dependency: [if], data = [none]
methodBuilder.nextControlFlow(" else "); // depends on control dependency: [if], data = [none]
methodBuilder.addStatement("$L.remove($S)", editorName, property.getPreferenceKey()); // depends on control dependency: [if], data = [none]
methodBuilder.endControlFlow(); // depends on control dependency: [if], data = [none]
} else {
methodBuilder.addStatement("$L.putStringSet($S," + tempPre + "$L" + tempPost + ")", editorName,
property.getPreferenceKey(), getter(beanName, beanClass, property)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static StringBuilder concat(final String... message) {
final StringBuilder builder = new StringBuilder();
for (final String mess : message) {
builder.append(mess);
builder.append(" ");
}
return builder;
} }
|
public class class_name {
public static StringBuilder concat(final String... message) {
final StringBuilder builder = new StringBuilder();
for (final String mess : message) {
builder.append(mess); // depends on control dependency: [for], data = [mess]
builder.append(" "); // depends on control dependency: [for], data = [none]
}
return builder;
} }
|
public class class_name {
private void initializeLandscapeListListener() {
instructionLayoutText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View instructionLayoutText) {
boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE;
if (!instructionsVisible) {
showInstructionList();
} else {
hideInstructionList();
}
}
});
} }
|
public class class_name {
private void initializeLandscapeListListener() {
instructionLayoutText.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View instructionLayoutText) {
boolean instructionsVisible = instructionListLayout.getVisibility() == VISIBLE;
if (!instructionsVisible) {
showInstructionList(); // depends on control dependency: [if], data = [none]
} else {
hideInstructionList(); // depends on control dependency: [if], data = [none]
}
}
});
} }
|
public class class_name {
private Expression transformInlineConstants(Expression exp) {
if (exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof ClassExpression) {
ClassExpression ce = (ClassExpression) pe.getObjectExpression();
ClassNode type = ce.getType();
if (type.isEnum())
return exp;
FieldNode fn = type.getField(pe.getPropertyAsString());
if (fn != null && !fn.isEnum() && fn.isStatic() && fn.isFinal()) {
if (fn.getInitialValueExpression() instanceof ConstantExpression) {
return fn.getInitialValueExpression();
}
}
}
} else if (exp instanceof ListExpression) {
ListExpression le = (ListExpression) exp;
ListExpression result = new ListExpression();
for (Expression e : le.getExpressions()) {
result.addExpression(transformInlineConstants(e));
}
return result;
} else if (exp instanceof AnnotationConstantExpression) {
ConstantExpression ce = (ConstantExpression) exp;
if (ce.getValue() instanceof AnnotationNode) {
// replicate a little bit of AnnotationVisitor here
// because we can't wait until later to do this
AnnotationNode an = (AnnotationNode) ce.getValue();
for (Map.Entry<String, Expression> member : an.getMembers().entrySet()) {
member.setValue(transformInlineConstants(member.getValue()));
}
}
}
return exp;
} }
|
public class class_name {
private Expression transformInlineConstants(Expression exp) {
if (exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof ClassExpression) {
ClassExpression ce = (ClassExpression) pe.getObjectExpression();
ClassNode type = ce.getType();
if (type.isEnum())
return exp;
FieldNode fn = type.getField(pe.getPropertyAsString());
if (fn != null && !fn.isEnum() && fn.isStatic() && fn.isFinal()) {
if (fn.getInitialValueExpression() instanceof ConstantExpression) {
return fn.getInitialValueExpression(); // depends on control dependency: [if], data = [none]
}
}
}
} else if (exp instanceof ListExpression) {
ListExpression le = (ListExpression) exp;
ListExpression result = new ListExpression();
for (Expression e : le.getExpressions()) {
result.addExpression(transformInlineConstants(e)); // depends on control dependency: [for], data = [e]
}
return result; // depends on control dependency: [if], data = [none]
} else if (exp instanceof AnnotationConstantExpression) {
ConstantExpression ce = (ConstantExpression) exp;
if (ce.getValue() instanceof AnnotationNode) {
// replicate a little bit of AnnotationVisitor here
// because we can't wait until later to do this
AnnotationNode an = (AnnotationNode) ce.getValue();
for (Map.Entry<String, Expression> member : an.getMembers().entrySet()) {
member.setValue(transformInlineConstants(member.getValue())); // depends on control dependency: [for], data = [member]
}
}
}
return exp;
} }
|
public class class_name {
private void continueAttemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
AttributeSplitSuggestion bestSuggestion = activeLearningNode.getDistributedBestSuggestion();
AttributeSplitSuggestion secondBestSuggestion = activeLearningNode.getDistributedSecondBestSuggestion();
//compare with null split
double[] preSplitDist = activeLearningNode.getObservedClassDistribution();
AttributeSplitSuggestion nullSplit = new AttributeSplitSuggestion(null,
new double[0][], this.splitCriterion.getMeritOfSplit(
preSplitDist,
new double[][]{preSplitDist}));
if((bestSuggestion == null) || (nullSplit.compareTo(bestSuggestion) > 0)){
secondBestSuggestion = bestSuggestion;
bestSuggestion = nullSplit;
}else{
if((secondBestSuggestion == null) || (nullSplit.compareTo(secondBestSuggestion) > 0)){
secondBestSuggestion = nullSplit;
}
}
boolean shouldSplit = false;
if(secondBestSuggestion == null){
shouldSplit = (bestSuggestion != null);
}else{
double hoeffdingBound = computeHoeffdingBound(
this.splitCriterion.getRangeOfMerit(activeLearningNode.getObservedClassDistribution()),
this.splitConfidence,
activeLearningNode.getWeightSeen());
if((bestSuggestion.merit - secondBestSuggestion.merit > hoeffdingBound)
|| (hoeffdingBound < tieThreshold)) {
shouldSplit = true;
}
//TODO: add poor attributes removal
}
SplitNode parent = foundNode.getParent();
int parentBranch = foundNode.getParentBranch();
//split if the Hoeffding bound condition is satisfied
if(shouldSplit){
if (bestSuggestion.splitTest != null) {
SplitNode newSplit = new SplitNode(bestSuggestion.splitTest, activeLearningNode.getObservedClassDistribution());
for(int i = 0; i < bestSuggestion.numSplits(); i++){
Node newChild = newLearningNode(bestSuggestion.resultingClassDistributionFromSplit(i), this.parallelismHint);
newSplit.setChild(i, newChild);
}
this.activeLeafNodeCount--;
this.decisionNodeCount++;
this.activeLeafNodeCount += bestSuggestion.numSplits();
if(parent == null){
this.treeRoot = newSplit;
}else{
parent.setChild(parentBranch, newSplit);
}
}
//TODO: add check on the model's memory size
}
//housekeeping
activeLearningNode.endSplitting();
activeLearningNode.setWeightSeenAtLastSplitEvaluation(activeLearningNode.getWeightSeen());
} }
|
public class class_name {
private void continueAttemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
AttributeSplitSuggestion bestSuggestion = activeLearningNode.getDistributedBestSuggestion();
AttributeSplitSuggestion secondBestSuggestion = activeLearningNode.getDistributedSecondBestSuggestion();
//compare with null split
double[] preSplitDist = activeLearningNode.getObservedClassDistribution();
AttributeSplitSuggestion nullSplit = new AttributeSplitSuggestion(null,
new double[0][], this.splitCriterion.getMeritOfSplit(
preSplitDist,
new double[][]{preSplitDist}));
if((bestSuggestion == null) || (nullSplit.compareTo(bestSuggestion) > 0)){
secondBestSuggestion = bestSuggestion; // depends on control dependency: [if], data = [none]
bestSuggestion = nullSplit; // depends on control dependency: [if], data = [none]
}else{
if((secondBestSuggestion == null) || (nullSplit.compareTo(secondBestSuggestion) > 0)){
secondBestSuggestion = nullSplit; // depends on control dependency: [if], data = [none]
}
}
boolean shouldSplit = false;
if(secondBestSuggestion == null){
shouldSplit = (bestSuggestion != null); // depends on control dependency: [if], data = [null)]
}else{
double hoeffdingBound = computeHoeffdingBound(
this.splitCriterion.getRangeOfMerit(activeLearningNode.getObservedClassDistribution()),
this.splitConfidence,
activeLearningNode.getWeightSeen());
if((bestSuggestion.merit - secondBestSuggestion.merit > hoeffdingBound)
|| (hoeffdingBound < tieThreshold)) {
shouldSplit = true; // depends on control dependency: [if], data = [none]
}
//TODO: add poor attributes removal
}
SplitNode parent = foundNode.getParent();
int parentBranch = foundNode.getParentBranch();
//split if the Hoeffding bound condition is satisfied
if(shouldSplit){
if (bestSuggestion.splitTest != null) {
SplitNode newSplit = new SplitNode(bestSuggestion.splitTest, activeLearningNode.getObservedClassDistribution());
for(int i = 0; i < bestSuggestion.numSplits(); i++){
Node newChild = newLearningNode(bestSuggestion.resultingClassDistributionFromSplit(i), this.parallelismHint);
newSplit.setChild(i, newChild); // depends on control dependency: [for], data = [i]
}
this.activeLeafNodeCount--; // depends on control dependency: [if], data = [none]
this.decisionNodeCount++; // depends on control dependency: [if], data = [none]
this.activeLeafNodeCount += bestSuggestion.numSplits(); // depends on control dependency: [if], data = [none]
if(parent == null){
this.treeRoot = newSplit; // depends on control dependency: [if], data = [none]
}else{
parent.setChild(parentBranch, newSplit); // depends on control dependency: [if], data = [(parent]
}
}
//TODO: add check on the model's memory size
}
//housekeeping
activeLearningNode.endSplitting();
activeLearningNode.setWeightSeenAtLastSplitEvaluation(activeLearningNode.getWeightSeen());
} }
|
public class class_name {
static String normalizeDefaultHostname(String defaultHostname) {
requireNonNull(defaultHostname, "defaultHostname");
if (needsNormalization(defaultHostname)) {
defaultHostname = IDN.toASCII(defaultHostname, IDN.ALLOW_UNASSIGNED);
}
if (!HOSTNAME_PATTERN.matcher(defaultHostname).matches()) {
throw new IllegalArgumentException("defaultHostname: " + defaultHostname);
}
return Ascii.toLowerCase(defaultHostname);
} }
|
public class class_name {
static String normalizeDefaultHostname(String defaultHostname) {
requireNonNull(defaultHostname, "defaultHostname");
if (needsNormalization(defaultHostname)) {
defaultHostname = IDN.toASCII(defaultHostname, IDN.ALLOW_UNASSIGNED); // depends on control dependency: [if], data = [none]
}
if (!HOSTNAME_PATTERN.matcher(defaultHostname).matches()) {
throw new IllegalArgumentException("defaultHostname: " + defaultHostname);
}
return Ascii.toLowerCase(defaultHostname);
} }
|
public class class_name {
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) {
A annotation = method.getAnnotation(annotationClass);
if (annotation == null) {
for (Annotation metaAnnotation : method.getAnnotations()) {
annotation = metaAnnotation.annotationType().getAnnotation(annotationClass);
if (annotation != null) {
return annotation;
}
}
Method superclassMethod = getOverriddenMethod(method);
if (superclassMethod != null) {
annotation = getAnnotation(superclassMethod, annotationClass);
}
}
return annotation;
} }
|
public class class_name {
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) {
A annotation = method.getAnnotation(annotationClass);
if (annotation == null) {
for (Annotation metaAnnotation : method.getAnnotations()) {
annotation = metaAnnotation.annotationType().getAnnotation(annotationClass); // depends on control dependency: [for], data = [metaAnnotation]
if (annotation != null) {
return annotation; // depends on control dependency: [if], data = [none]
}
}
Method superclassMethod = getOverriddenMethod(method);
if (superclassMethod != null) {
annotation = getAnnotation(superclassMethod, annotationClass); // depends on control dependency: [if], data = [(superclassMethod]
}
}
return annotation;
} }
|
public class class_name {
@Override
protected void visitSoyFileSetNode(SoyFileSetNode node) {
// Figure out the generated class name for each Soy file, including adding number suffixes
// to resolve collisions, and then adding the common suffix "SoyInfo".
Multimap<String, SoyFileNode> baseGeneratedClassNameToSoyFilesMap = HashMultimap.create();
for (SoyFileNode soyFile : node.getChildren()) {
baseGeneratedClassNameToSoyFilesMap.put(
javaClassNameSource.generateBaseClassName(soyFile), soyFile);
}
soyFileToJavaClassNameMap = Maps.newHashMap();
for (String baseClassName : baseGeneratedClassNameToSoyFilesMap.keySet()) {
Collection<SoyFileNode> soyFiles = baseGeneratedClassNameToSoyFilesMap.get(baseClassName);
if (soyFiles.size() == 1) {
for (SoyFileNode soyFile : soyFiles) {
soyFileToJavaClassNameMap.put(soyFile, baseClassName + "SoyInfo");
}
} else {
int numberSuffix = 1;
for (SoyFileNode soyFile : soyFiles) {
soyFileToJavaClassNameMap.put(soyFile, baseClassName + numberSuffix + "SoyInfo");
numberSuffix++;
}
}
}
// Run the pass.
for (SoyFileNode soyFile : node.getChildren()) {
visit(soyFile);
}
} }
|
public class class_name {
@Override
protected void visitSoyFileSetNode(SoyFileSetNode node) {
// Figure out the generated class name for each Soy file, including adding number suffixes
// to resolve collisions, and then adding the common suffix "SoyInfo".
Multimap<String, SoyFileNode> baseGeneratedClassNameToSoyFilesMap = HashMultimap.create();
for (SoyFileNode soyFile : node.getChildren()) {
baseGeneratedClassNameToSoyFilesMap.put(
javaClassNameSource.generateBaseClassName(soyFile), soyFile); // depends on control dependency: [for], data = [none]
}
soyFileToJavaClassNameMap = Maps.newHashMap();
for (String baseClassName : baseGeneratedClassNameToSoyFilesMap.keySet()) {
Collection<SoyFileNode> soyFiles = baseGeneratedClassNameToSoyFilesMap.get(baseClassName);
if (soyFiles.size() == 1) {
for (SoyFileNode soyFile : soyFiles) {
soyFileToJavaClassNameMap.put(soyFile, baseClassName + "SoyInfo"); // depends on control dependency: [for], data = [soyFile]
}
} else {
int numberSuffix = 1;
for (SoyFileNode soyFile : soyFiles) {
soyFileToJavaClassNameMap.put(soyFile, baseClassName + numberSuffix + "SoyInfo"); // depends on control dependency: [for], data = [soyFile]
numberSuffix++; // depends on control dependency: [for], data = [none]
}
}
}
// Run the pass.
for (SoyFileNode soyFile : node.getChildren()) {
visit(soyFile); // depends on control dependency: [for], data = [soyFile]
}
} }
|
public class class_name {
public void addReading(AnalyzedToken token) {
List<AnalyzedToken> l = new ArrayList<>(Arrays.asList(anTokReadings).subList(0, anTokReadings.length - 1));
if (anTokReadings[anTokReadings.length - 1].getPOSTag() != null) {
l.add(anTokReadings[anTokReadings.length - 1]);
}
token.setWhitespaceBefore(isWhitespaceBefore);
l.add(token);
anTokReadings = l.toArray(new AnalyzedToken[0]);
if (token.getToken().length() > this.token.length()) { //in case a longer token is added
this.token = token.getToken();
}
anTokReadings[anTokReadings.length - 1].setWhitespaceBefore(isWhitespaceBefore);
isParaEnd = hasPosTag(PARAGRAPH_END_TAGNAME);
isSentEnd = hasPosTag(SENTENCE_END_TAGNAME);
setNoRealPOStag();
hasSameLemmas = areLemmasSame();
} }
|
public class class_name {
public void addReading(AnalyzedToken token) {
List<AnalyzedToken> l = new ArrayList<>(Arrays.asList(anTokReadings).subList(0, anTokReadings.length - 1));
if (anTokReadings[anTokReadings.length - 1].getPOSTag() != null) {
l.add(anTokReadings[anTokReadings.length - 1]); // depends on control dependency: [if], data = [none]
}
token.setWhitespaceBefore(isWhitespaceBefore);
l.add(token);
anTokReadings = l.toArray(new AnalyzedToken[0]);
if (token.getToken().length() > this.token.length()) { //in case a longer token is added
this.token = token.getToken(); // depends on control dependency: [if], data = [none]
}
anTokReadings[anTokReadings.length - 1].setWhitespaceBefore(isWhitespaceBefore);
isParaEnd = hasPosTag(PARAGRAPH_END_TAGNAME);
isSentEnd = hasPosTag(SENTENCE_END_TAGNAME);
setNoRealPOStag();
hasSameLemmas = areLemmasSame();
} }
|
public class class_name {
public void activateOptions() {
for (Filter f = headFilter; f != null; f = f.next) {
f.activateOptions();
}
} }
|
public class class_name {
public void activateOptions() {
for (Filter f = headFilter; f != null; f = f.next) {
f.activateOptions(); // depends on control dependency: [for], data = [f]
}
} }
|
public class class_name {
public void marshall(CreateDeviceDefinitionRequest createDeviceDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (createDeviceDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDeviceDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING);
protocolMarshaller.marshall(createDeviceDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING);
protocolMarshaller.marshall(createDeviceDefinitionRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(createDeviceDefinitionRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateDeviceDefinitionRequest createDeviceDefinitionRequest, ProtocolMarshaller protocolMarshaller) {
if (createDeviceDefinitionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createDeviceDefinitionRequest.getAmznClientToken(), AMZNCLIENTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeviceDefinitionRequest.getInitialVersion(), INITIALVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeviceDefinitionRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createDeviceDefinitionRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Iterator<T> getServices() {
final List<T> empty = Collections.emptyList();
if (contextRef.get() == null) {
return empty.iterator();
}
return new ServiceIterator(elements());
} }
|
public class class_name {
public Iterator<T> getServices() {
final List<T> empty = Collections.emptyList();
if (contextRef.get() == null) {
return empty.iterator(); // depends on control dependency: [if], data = [none]
}
return new ServiceIterator(elements());
} }
|
public class class_name {
void onSliderChange(double min, double max) {
if (selectedMin != min || selectedMax != max) {
selectedMin = min;
selectedMax = max;
DataSetFilter filter = new DataSetFilter();
CoreFunctionFilter columnFilter = new CoreFunctionFilter();
columnFilter.setColumnId(dataColumnMin.getId());
columnFilter.setType(CoreFunctionType.BETWEEN);
filter.addFilterColumn(columnFilter);
if (ColumnType.DATE.equals(dataColumnMin.getColumnType())) {
Date dateFrom = new Date((long) min);
Date dateTo = new Date((long) max);
columnFilter.setParameters(dateFrom, dateTo);
minDateEditor.setValue(dateFrom);
maxDateEditor.setValue(dateTo);
super.filterUpdate(filter);
}
else if (ColumnType.NUMBER.equals(dataColumnMin.getColumnType())) {
columnFilter.setParameters(min, max);
minNumberEditor.setValue(min);
maxNumberEditor.setValue(max);
super.filterUpdate(filter);
}
}
} }
|
public class class_name {
void onSliderChange(double min, double max) {
if (selectedMin != min || selectedMax != max) {
selectedMin = min; // depends on control dependency: [if], data = [none]
selectedMax = max; // depends on control dependency: [if], data = [none]
DataSetFilter filter = new DataSetFilter();
CoreFunctionFilter columnFilter = new CoreFunctionFilter();
columnFilter.setColumnId(dataColumnMin.getId()); // depends on control dependency: [if], data = [none]
columnFilter.setType(CoreFunctionType.BETWEEN); // depends on control dependency: [if], data = [none]
filter.addFilterColumn(columnFilter); // depends on control dependency: [if], data = [none]
if (ColumnType.DATE.equals(dataColumnMin.getColumnType())) {
Date dateFrom = new Date((long) min);
Date dateTo = new Date((long) max);
columnFilter.setParameters(dateFrom, dateTo); // depends on control dependency: [if], data = [none]
minDateEditor.setValue(dateFrom); // depends on control dependency: [if], data = [none]
maxDateEditor.setValue(dateTo); // depends on control dependency: [if], data = [none]
super.filterUpdate(filter); // depends on control dependency: [if], data = [none]
}
else if (ColumnType.NUMBER.equals(dataColumnMin.getColumnType())) {
columnFilter.setParameters(min, max); // depends on control dependency: [if], data = [none]
minNumberEditor.setValue(min); // depends on control dependency: [if], data = [none]
maxNumberEditor.setValue(max); // depends on control dependency: [if], data = [none]
super.filterUpdate(filter); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected static String removeQuotes(String quotedString, boolean quotesRequired) {
// support both quoted and non-quoted
if (quotedString.length() > 0 && quotedString.charAt(0) != '"' && !quotesRequired) {
return quotedString;
} else if (quotedString.length() > 2) {
return quotedString.substring(1, quotedString.length() - 1);
} else {
return "";
}
} }
|
public class class_name {
protected static String removeQuotes(String quotedString, boolean quotesRequired) {
// support both quoted and non-quoted
if (quotedString.length() > 0 && quotedString.charAt(0) != '"' && !quotesRequired) {
return quotedString; // depends on control dependency: [if], data = [none]
} else if (quotedString.length() > 2) {
return quotedString.substring(1, quotedString.length() - 1); // depends on control dependency: [if], data = [none]
} else {
return ""; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Table<URI, URI, MatchResult> match(Set<URI> origins, Set<URI> destinations) {
StringBuffer queryBuffer = new StringBuffer()
.append(generateQueryHeader());
List<String> whereClauses = new ArrayList<String>();
for (URI origin : origins) {
for (URI destination : destinations) {
whereClauses.add(generateMatchWhereClause(origin, destination, true));
}
}
String queryStr = queryBuffer.append(Util.generateUnionStatement(whereClauses))
.append(generateQueryFooter())
.toString();
log.debug("SPARQL Query generated: \n {}", queryStr);
// This only returns positive matches. Fill up the rest with Fails
Table<URI, URI, MatchResult> positiveMatches = queryForMatchResults(queryStr);
ImmutableTable.Builder<URI, URI, MatchResult> results = ImmutableTable.builder();
results.putAll(positiveMatches);
// Fill up those not present with Fails
for (URI origin : origins) {
for (URI destination : destinations) {
if (!positiveMatches.contains(origin, destination)) {
results.put(origin, destination, new AtomicMatchResult(origin, destination, LogicConceptMatchType.Fail, this));
}
}
}
return results.build();
} }
|
public class class_name {
@Override
public Table<URI, URI, MatchResult> match(Set<URI> origins, Set<URI> destinations) {
StringBuffer queryBuffer = new StringBuffer()
.append(generateQueryHeader());
List<String> whereClauses = new ArrayList<String>();
for (URI origin : origins) {
for (URI destination : destinations) {
whereClauses.add(generateMatchWhereClause(origin, destination, true)); // depends on control dependency: [for], data = [destination]
}
}
String queryStr = queryBuffer.append(Util.generateUnionStatement(whereClauses))
.append(generateQueryFooter())
.toString();
log.debug("SPARQL Query generated: \n {}", queryStr);
// This only returns positive matches. Fill up the rest with Fails
Table<URI, URI, MatchResult> positiveMatches = queryForMatchResults(queryStr);
ImmutableTable.Builder<URI, URI, MatchResult> results = ImmutableTable.builder();
results.putAll(positiveMatches);
// Fill up those not present with Fails
for (URI origin : origins) {
for (URI destination : destinations) {
if (!positiveMatches.contains(origin, destination)) {
results.put(origin, destination, new AtomicMatchResult(origin, destination, LogicConceptMatchType.Fail, this)); // depends on control dependency: [if], data = [none]
}
}
}
return results.build();
} }
|
public class class_name {
private static void calculateHierarchy(final Map<String, SchemaNode> schemaNodes) {
try (final Tx tx = StructrApp.getInstance().tx()) {
final Set<String> alreadyCalculated = new HashSet<>();
// calc hierarchy
for (final SchemaNode schemaNode : schemaNodes.values()) {
final int relCount = Iterables.count(schemaNode.getProperty(SchemaNode.relatedFrom)) + Iterables.count(schemaNode.getProperty(SchemaNode.relatedTo));
final int level = recursiveGetHierarchyLevel(schemaNodes, alreadyCalculated, schemaNode, 0);
schemaNode.setProperty(SchemaNode.hierarchyLevel, level);
schemaNode.setProperty(SchemaNode.relCount, relCount);
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
} }
|
public class class_name {
private static void calculateHierarchy(final Map<String, SchemaNode> schemaNodes) {
try (final Tx tx = StructrApp.getInstance().tx()) {
final Set<String> alreadyCalculated = new HashSet<>();
// calc hierarchy
for (final SchemaNode schemaNode : schemaNodes.values()) {
final int relCount = Iterables.count(schemaNode.getProperty(SchemaNode.relatedFrom)) + Iterables.count(schemaNode.getProperty(SchemaNode.relatedTo));
final int level = recursiveGetHierarchyLevel(schemaNodes, alreadyCalculated, schemaNode, 0);
schemaNode.setProperty(SchemaNode.hierarchyLevel, level); // depends on control dependency: [for], data = [schemaNode]
schemaNode.setProperty(SchemaNode.relCount, relCount); // depends on control dependency: [for], data = [schemaNode]
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("", fex);
}
} }
|
public class class_name {
public void printHtmlOptional(PrintWriter out, String strTag, String strParams, String strData)
{
String strField = ((BasePanel)this.getRecordOwner()).getProperty("field");
if ((strField != null) && (strField.length() > 0) && (m_recDetail.getField(strField) != null))
{
String string = m_recDetail.getField(strField).toString();
if (strField.equalsIgnoreCase("TechnicalInfo"))
{
string = this.getRecordOwner().getProperty("tech"); // Special case - For Technical Info, Only output if &tech is found
if (string != null)
string = "yes";
}
if ((string != null) && (string.length() > 0))
this.parseHtmlData(out, strData); // If the data is not blank, then process the HTML
// Otherwise, don't output the HTML
}
} }
|
public class class_name {
public void printHtmlOptional(PrintWriter out, String strTag, String strParams, String strData)
{
String strField = ((BasePanel)this.getRecordOwner()).getProperty("field");
if ((strField != null) && (strField.length() > 0) && (m_recDetail.getField(strField) != null))
{
String string = m_recDetail.getField(strField).toString();
if (strField.equalsIgnoreCase("TechnicalInfo"))
{
string = this.getRecordOwner().getProperty("tech"); // Special case - For Technical Info, Only output if &tech is found // depends on control dependency: [if], data = [none]
if (string != null)
string = "yes";
}
if ((string != null) && (string.length() > 0))
this.parseHtmlData(out, strData); // If the data is not blank, then process the HTML
// Otherwise, don't output the HTML
}
} }
|
public class class_name {
@Override
public void setValue(final Object value) {
if (value == null) {
this.setText(null);
} else {
if (value instanceof Integer) {
this.setText(getNumberFormat().format(value));
} else if (value instanceof Number) {
// Number inclue Integer, Long, BigInteger, Double, Float ...
this.setText(getNumberFormat().format(((Number) value).longValue()));
} else {
this.setText("??");
}
}
} }
|
public class class_name {
@Override
public void setValue(final Object value) {
if (value == null) {
this.setText(null);
// depends on control dependency: [if], data = [null)]
} else {
if (value instanceof Integer) {
this.setText(getNumberFormat().format(value));
// depends on control dependency: [if], data = [none]
} else if (value instanceof Number) {
// Number inclue Integer, Long, BigInteger, Double, Float ...
this.setText(getNumberFormat().format(((Number) value).longValue()));
// depends on control dependency: [if], data = [none]
} else {
this.setText("??");
// depends on control dependency: [if], data = [none]
}
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.