code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
@Override
public void parallel(ConcurrentParallelCall runnerLambda, ConcurrentParallelOpCall opLambda) {
final ConcurrentParallelOption option = createConcurrentParallelOption(opLambda);
try {
readyGo(runnerLambda, option);
} catch (LaCountdownRaceExecutionException e) {
throwConcurrentParallelRunnerException(option, e);
}
} } | public class class_name {
@Override
public void parallel(ConcurrentParallelCall runnerLambda, ConcurrentParallelOpCall opLambda) {
final ConcurrentParallelOption option = createConcurrentParallelOption(opLambda);
try {
readyGo(runnerLambda, option); // depends on control dependency: [try], data = [none]
} catch (LaCountdownRaceExecutionException e) {
throwConcurrentParallelRunnerException(option, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Complex cdiv(double xr, double xi, double yr, double yi) {
double cdivr, cdivi;
double r, d;
if (Math.abs(yr) > Math.abs(yi)) {
r = yi / yr;
d = yr + r * yi;
cdivr = (xr + r * xi) / d;
cdivi = (xi - r * xr) / d;
} else {
r = yr / yi;
d = yi + r * yr;
cdivr = (r * xr + xi) / d;
cdivi = (r * xi - xr) / d;
}
return new Complex(cdivr, cdivi);
} } | public class class_name {
private static Complex cdiv(double xr, double xi, double yr, double yi) {
double cdivr, cdivi;
double r, d;
if (Math.abs(yr) > Math.abs(yi)) {
r = yi / yr; // depends on control dependency: [if], data = [none]
d = yr + r * yi; // depends on control dependency: [if], data = [none]
cdivr = (xr + r * xi) / d; // depends on control dependency: [if], data = [none]
cdivi = (xi - r * xr) / d; // depends on control dependency: [if], data = [none]
} else {
r = yr / yi; // depends on control dependency: [if], data = [none]
d = yi + r * yr; // depends on control dependency: [if], data = [none]
cdivr = (r * xr + xi) / d; // depends on control dependency: [if], data = [none]
cdivi = (r * xi - xr) / d; // depends on control dependency: [if], data = [none]
}
return new Complex(cdivr, cdivi);
} } |
public class class_name {
public void marshall(ListFileSharesRequest listFileSharesRequest, ProtocolMarshaller protocolMarshaller) {
if (listFileSharesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFileSharesRequest.getGatewayARN(), GATEWAYARN_BINDING);
protocolMarshaller.marshall(listFileSharesRequest.getLimit(), LIMIT_BINDING);
protocolMarshaller.marshall(listFileSharesRequest.getMarker(), MARKER_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListFileSharesRequest listFileSharesRequest, ProtocolMarshaller protocolMarshaller) {
if (listFileSharesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listFileSharesRequest.getGatewayARN(), GATEWAYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listFileSharesRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listFileSharesRequest.getMarker(), MARKER_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 {
void releaseSavepoint(final String savepointName) {
Savepoint savepoint = savepointMap.get(savepointName);
int pos = savepointNames.lastIndexOf(savepointName);
if (pos > -1) {
List<String> subList = savepointNames.subList(pos, savepointNames.size());
for (String name : subList) {
savepointMap.remove(name);
}
subList.clear();
}
if (savepoint != null && connection != null) {
try {
connection.releaseSavepoint(savepoint);
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
}
}
} } | public class class_name {
void releaseSavepoint(final String savepointName) {
Savepoint savepoint = savepointMap.get(savepointName);
int pos = savepointNames.lastIndexOf(savepointName);
if (pos > -1) {
List<String> subList = savepointNames.subList(pos, savepointNames.size());
for (String name : subList) {
savepointMap.remove(name); // depends on control dependency: [for], data = [name]
}
subList.clear(); // depends on control dependency: [if], data = [none]
}
if (savepoint != null && connection != null) {
try {
connection.releaseSavepoint(savepoint); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "checkstyle:illegaltype" })
Collection<V> copyValues(Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return Lists.newArrayList(values);
}
if (backEnd instanceof TreeSet<?>) {
TreeSet<V> c = (TreeSet<V>) backEnd;
c = Sets.newTreeSet(c.comparator());
c.addAll(values);
return c;
}
if (backEnd instanceof LinkedHashSet<?>) {
return Sets.newLinkedHashSet(values);
}
if (backEnd instanceof Set<?>) {
return Sets.newHashSet(values);
}
throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$
} } | public class class_name {
@SuppressWarnings({ "unchecked", "checkstyle:illegaltype" })
Collection<V> copyValues(Collection<V> values) {
final Object backEnd = DataViewDelegate.undelegate(values);
if (backEnd instanceof List<?>) {
return Lists.newArrayList(values); // depends on control dependency: [if], data = [)]
}
if (backEnd instanceof TreeSet<?>) {
TreeSet<V> c = (TreeSet<V>) backEnd;
c = Sets.newTreeSet(c.comparator()); // depends on control dependency: [if], data = [)]
c.addAll(values); // depends on control dependency: [if], data = [)]
return c; // depends on control dependency: [if], data = [none]
}
if (backEnd instanceof LinkedHashSet<?>) {
return Sets.newLinkedHashSet(values); // depends on control dependency: [if], data = [)]
}
if (backEnd instanceof Set<?>) {
return Sets.newHashSet(values); // depends on control dependency: [if], data = [)]
}
throw new IllegalStateException("Unsupported type of the backend multimap: " + values.getClass()); //$NON-NLS-1$
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void insertPair(ReflectedHandle<K, V> handle1, ReflectedHandle<K, V> handle2) {
int c;
if (comparator == null) {
c = ((Comparable<? super K>) handle1.key).compareTo(handle2.key);
} else {
c = comparator.compare(handle1.key, handle2.key);
}
AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle1;
AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle2;
if (c <= 0) {
innerHandle1 = minHeap.insert(handle1.key);
handle1.minNotMax = true;
innerHandle2 = maxHeap.insert(handle2.key);
handle2.minNotMax = false;
} else {
innerHandle1 = maxHeap.insert(handle1.key);
handle1.minNotMax = false;
innerHandle2 = minHeap.insert(handle2.key);
handle2.minNotMax = true;
}
handle1.inner = innerHandle1;
handle2.inner = innerHandle2;
innerHandle1.setValue(new HandleMap<K, V>(handle1, innerHandle2));
innerHandle2.setValue(new HandleMap<K, V>(handle2, innerHandle1));
} } | public class class_name {
@SuppressWarnings("unchecked")
private void insertPair(ReflectedHandle<K, V> handle1, ReflectedHandle<K, V> handle2) {
int c;
if (comparator == null) {
c = ((Comparable<? super K>) handle1.key).compareTo(handle2.key); // depends on control dependency: [if], data = [none]
} else {
c = comparator.compare(handle1.key, handle2.key); // depends on control dependency: [if], data = [none]
}
AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle1;
AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle2;
if (c <= 0) {
innerHandle1 = minHeap.insert(handle1.key); // depends on control dependency: [if], data = [none]
handle1.minNotMax = true; // depends on control dependency: [if], data = [none]
innerHandle2 = maxHeap.insert(handle2.key); // depends on control dependency: [if], data = [none]
handle2.minNotMax = false; // depends on control dependency: [if], data = [none]
} else {
innerHandle1 = maxHeap.insert(handle1.key); // depends on control dependency: [if], data = [none]
handle1.minNotMax = false; // depends on control dependency: [if], data = [none]
innerHandle2 = minHeap.insert(handle2.key); // depends on control dependency: [if], data = [none]
handle2.minNotMax = true; // depends on control dependency: [if], data = [none]
}
handle1.inner = innerHandle1;
handle2.inner = innerHandle2;
innerHandle1.setValue(new HandleMap<K, V>(handle1, innerHandle2));
innerHandle2.setValue(new HandleMap<K, V>(handle2, innerHandle1));
} } |
public class class_name {
public static <T extends ImageGray<T>>
Planar<T> median(Planar<T> input, @Nullable Planar<T> output, int radius ,
@Nullable WorkArrays work) {
if( output == null )
output = input.createNew(input.width,input.height);
for( int band = 0; band < input.getNumBands(); band++ ) {
GBlurImageOps.median(input.getBand(band),output.getBand(band),radius,work);
}
return output;
} } | public class class_name {
public static <T extends ImageGray<T>>
Planar<T> median(Planar<T> input, @Nullable Planar<T> output, int radius ,
@Nullable WorkArrays work) {
if( output == null )
output = input.createNew(input.width,input.height);
for( int band = 0; band < input.getNumBands(); band++ ) {
GBlurImageOps.median(input.getBand(band),output.getBand(band),radius,work); // depends on control dependency: [for], data = [band]
}
return output;
} } |
public class class_name {
public static nd6ravariables[] get(nitro_service service, Long vlan[]) throws Exception{
if (vlan !=null && vlan.length>0) {
nd6ravariables response[] = new nd6ravariables[vlan.length];
nd6ravariables obj[] = new nd6ravariables[vlan.length];
for (int i=0;i<vlan.length;i++) {
obj[i] = new nd6ravariables();
obj[i].set_vlan(vlan[i]);
response[i] = (nd6ravariables) obj[i].get_resource(service);
}
return response;
}
return null;
} } | public class class_name {
public static nd6ravariables[] get(nitro_service service, Long vlan[]) throws Exception{
if (vlan !=null && vlan.length>0) {
nd6ravariables response[] = new nd6ravariables[vlan.length];
nd6ravariables obj[] = new nd6ravariables[vlan.length];
for (int i=0;i<vlan.length;i++) {
obj[i] = new nd6ravariables(); // depends on control dependency: [for], data = [i]
obj[i].set_vlan(vlan[i]); // depends on control dependency: [for], data = [i]
response[i] = (nd6ravariables) obj[i].get_resource(service); // depends on control dependency: [for], data = [i]
}
return response;
}
return null;
} } |
public class class_name {
public static InitialContext findOrCreate(Hashtable<?,?> environment) throws NamingException{
if (found){
return findDefault(environment);
}
InitialContext ctx = null;
NamingException lastE = null;
synchronized (InitialContextFinder.class){
// get and test if the initial context is usable
try {
ctx = findDefault(environment);
} catch (NamingException e) {
lastE = e;
}
if (ctx != null){
try {
@SuppressWarnings("unused")
Object o = ctx.lookup(InitialContextFinder.class.getName());
} catch (NoInitialContextException e) {
ctx = null;
} catch (NamingException e) {
lastE = e;
}
}
// create one if needed
if (ctx == null){
try {
ctx = createFSContext();
} catch (NamingException e) {
lastE = e;
}
}
if (ctx != null){
found = true;
return ctx;
}else{
if (lastE != null){
throw lastE;
}else{
throw new NamingException("Can't find InitialContext.");
}
}
}
} } | public class class_name {
public static InitialContext findOrCreate(Hashtable<?,?> environment) throws NamingException{
if (found){
return findDefault(environment);
}
InitialContext ctx = null;
NamingException lastE = null;
synchronized (InitialContextFinder.class){
// get and test if the initial context is usable
try {
ctx = findDefault(environment);
// depends on control dependency: [try], data = [none]
} catch (NamingException e) {
lastE = e;
}
// depends on control dependency: [catch], data = [none]
if (ctx != null){
try {
@SuppressWarnings("unused")
Object o = ctx.lookup(InitialContextFinder.class.getName());
} catch (NoInitialContextException e) {
ctx = null;
} catch (NamingException e) {
// depends on control dependency: [catch], data = [none]
lastE = e;
}
// depends on control dependency: [catch], data = [none]
}
// create one if needed
if (ctx == null){
try {
ctx = createFSContext();
// depends on control dependency: [try], data = [none]
} catch (NamingException e) {
lastE = e;
}
// depends on control dependency: [catch], data = [none]
}
if (ctx != null){
found = true;
// depends on control dependency: [if], data = [none]
return ctx;
// depends on control dependency: [if], data = [none]
}else{
if (lastE != null){
throw lastE;
}else{
throw new NamingException("Can't find InitialContext.");
}
}
}
} } |
public class class_name {
public void close()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "close",this);
if (_controlLock != null)
{
try
{
_controlLock.releaseSharedLock(LOCK_REQUEST_ID_LCI);
}
catch (NoSharedLockException exc)
{
// This should not happen as we get a shared lock in the constructor and this is the
// only place we release it. Ignore this exception.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogCursorImpl.close", "401", this);
}
}
_iterator1 = null;
_iterator2 = null;
_removeIterator = null;
_controlLock = null;
_singleObject = null;
_empty = true;
if (tc.isEntryEnabled()) Tr.exit(tc, "close");
} } | public class class_name {
public void close()
{
if (tc.isEntryEnabled()) Tr.entry(tc, "close",this);
if (_controlLock != null)
{
try
{
_controlLock.releaseSharedLock(LOCK_REQUEST_ID_LCI); // depends on control dependency: [try], data = [none]
}
catch (NoSharedLockException exc)
{
// This should not happen as we get a shared lock in the constructor and this is the
// only place we release it. Ignore this exception.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.LogCursorImpl.close", "401", this);
} // depends on control dependency: [catch], data = [none]
}
_iterator1 = null;
_iterator2 = null;
_removeIterator = null;
_controlLock = null;
_singleObject = null;
_empty = true;
if (tc.isEntryEnabled()) Tr.exit(tc, "close");
} } |
public class class_name {
public String readResource(URI endpoint, CredentialsEndpointRetryPolicy retryPolicy, Map<String, String> headers) throws IOException {
int retriesAttempted = 0;
InputStream inputStream = null;
headers = addDefaultHeaders(headers);
while (true) {
try {
HttpURLConnection connection = connectionUtils.connectToEndpoint(endpoint, headers);
int statusCode = connection.getResponseCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream();
return IOUtils.toString(inputStream);
} else if (statusCode == HttpURLConnection.HTTP_NOT_FOUND) {
// This is to preserve existing behavior of EC2 Instance metadata service.
throw new SdkClientException("The requested metadata is not found at " + connection.getURL());
} else {
if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withStatusCode(statusCode).build())) {
inputStream = connection.getErrorStream();
handleErrorResponse(inputStream, statusCode, connection.getResponseMessage());
}
}
} catch (IOException ioException) {
if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withException(ioException).build())) {
throw ioException;
}
LOG.debug("An IOException occured when connecting to service endpoint: " + endpoint + "\n Retrying to connect again.");
} finally {
IOUtils.closeQuietly(inputStream, LOG);
}
}
} } | public class class_name {
public String readResource(URI endpoint, CredentialsEndpointRetryPolicy retryPolicy, Map<String, String> headers) throws IOException {
int retriesAttempted = 0;
InputStream inputStream = null;
headers = addDefaultHeaders(headers);
while (true) {
try {
HttpURLConnection connection = connectionUtils.connectToEndpoint(endpoint, headers);
int statusCode = connection.getResponseCode();
if (statusCode == HttpURLConnection.HTTP_OK) {
inputStream = connection.getInputStream(); // depends on control dependency: [if], data = [none]
return IOUtils.toString(inputStream); // depends on control dependency: [if], data = [none]
} else if (statusCode == HttpURLConnection.HTTP_NOT_FOUND) {
// This is to preserve existing behavior of EC2 Instance metadata service.
throw new SdkClientException("The requested metadata is not found at " + connection.getURL());
} else {
if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withStatusCode(statusCode).build())) {
inputStream = connection.getErrorStream(); // depends on control dependency: [if], data = [none]
handleErrorResponse(inputStream, statusCode, connection.getResponseMessage()); // depends on control dependency: [if], data = [none]
}
}
} catch (IOException ioException) {
if (!retryPolicy.shouldRetry(retriesAttempted++, CredentialsEndpointRetryParameters.builder().withException(ioException).build())) {
throw ioException;
}
LOG.debug("An IOException occured when connecting to service endpoint: " + endpoint + "\n Retrying to connect again.");
} finally { // depends on control dependency: [catch], data = [none]
IOUtils.closeQuietly(inputStream, LOG);
}
}
} } |
public class class_name {
public static boolean isEmpty(Iterable<?> iterable) {
if (iterable instanceof Collection) {
return ((Collection<?>) iterable).isEmpty();
}
return !iterable.iterator().hasNext();
} } | public class class_name {
public static boolean isEmpty(Iterable<?> iterable) {
if (iterable instanceof Collection) {
return ((Collection<?>) iterable).isEmpty(); // depends on control dependency: [if], data = [none]
}
return !iterable.iterator().hasNext();
} } |
public class class_name {
public void reinitializeButtons() {
if (isGroupcontainerEditing()) {
m_groupEditor.reinitializeButtons();
} else {
List<CmsContainerPageElementPanel> elemWidgets = getAllContainerPageElements(true);
for (CmsContainerPageElementPanel elemWidget : elemWidgets) {
if (requiresOptionBar(elemWidget, elemWidget.getParentTarget())) {
getContainerpageUtil().addOptionBar(elemWidget);
} else {
// otherwise remove any present option bar
elemWidget.setElementOptionBar(null);
}
elemWidget.showEditableListButtons();
}
}
} } | public class class_name {
public void reinitializeButtons() {
if (isGroupcontainerEditing()) {
m_groupEditor.reinitializeButtons(); // depends on control dependency: [if], data = [none]
} else {
List<CmsContainerPageElementPanel> elemWidgets = getAllContainerPageElements(true);
for (CmsContainerPageElementPanel elemWidget : elemWidgets) {
if (requiresOptionBar(elemWidget, elemWidget.getParentTarget())) {
getContainerpageUtil().addOptionBar(elemWidget); // depends on control dependency: [if], data = [none]
} else {
// otherwise remove any present option bar
elemWidget.setElementOptionBar(null); // depends on control dependency: [if], data = [none]
}
elemWidget.showEditableListButtons(); // depends on control dependency: [for], data = [elemWidget]
}
}
} } |
public class class_name {
private JobVertex createSingleInputVertex(SingleInputPlanNode node) throws CompilerException {
final String taskName = node.getNodeName();
final DriverStrategy ds = node.getDriverStrategy();
// check, whether chaining is possible
boolean chaining;
{
Channel inConn = node.getInput();
PlanNode pred = inConn.getSource();
chaining = ds.getPushChainDriverClass() != null &&
!(pred instanceof NAryUnionPlanNode) && // first op after union is stand-alone, because union is merged
!(pred instanceof BulkPartialSolutionPlanNode) && // partial solution merges anyways
!(pred instanceof WorksetPlanNode) && // workset merges anyways
!(pred instanceof IterationPlanNode) && // cannot chain with iteration heads currently
inConn.getShipStrategy() == ShipStrategyType.FORWARD &&
inConn.getLocalStrategy() == LocalStrategy.NONE &&
pred.getOutgoingChannels().size() == 1 &&
node.getParallelism() == pred.getParallelism() &&
node.getBroadcastInputs().isEmpty();
// cannot chain the nodes that produce the next workset or the next solution set, if they are not the
// in a tail
if (this.currentIteration instanceof WorksetIterationPlanNode && node.getOutgoingChannels().size() > 0)
{
WorksetIterationPlanNode wspn = (WorksetIterationPlanNode) this.currentIteration;
if (wspn.getSolutionSetDeltaPlanNode() == pred || wspn.getNextWorkSetPlanNode() == pred) {
chaining = false;
}
}
// cannot chain the nodes that produce the next workset in a bulk iteration if a termination criterion follows
if (this.currentIteration instanceof BulkIterationPlanNode)
{
BulkIterationPlanNode wspn = (BulkIterationPlanNode) this.currentIteration;
if (node == wspn.getRootOfTerminationCriterion() && wspn.getRootOfStepFunction() == pred){
chaining = false;
}else if(node.getOutgoingChannels().size() > 0 &&(wspn.getRootOfStepFunction() == pred ||
wspn.getRootOfTerminationCriterion() == pred)) {
chaining = false;
}
}
}
final JobVertex vertex;
final TaskConfig config;
if (chaining) {
vertex = null;
config = new TaskConfig(new Configuration());
this.chainedTasks.put(node, new TaskInChain(node, ds.getPushChainDriverClass(), config, taskName));
} else {
// create task vertex
vertex = new JobVertex(taskName);
vertex.setResources(node.getMinResources(), node.getPreferredResources());
vertex.setInvokableClass((this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediateTask.class : BatchTask.class);
config = new TaskConfig(vertex.getConfiguration());
config.setDriver(ds.getDriverClass());
}
// set user code
config.setStubWrapper(node.getProgramOperator().getUserCodeWrapper());
config.setStubParameters(node.getProgramOperator().getParameters());
// set the driver strategy
config.setDriverStrategy(ds);
for (int i = 0; i < ds.getNumRequiredComparators(); i++) {
config.setDriverComparator(node.getComparator(i), i);
}
// assign memory, file-handles, etc.
assignDriverResources(node, config);
return vertex;
} } | public class class_name {
private JobVertex createSingleInputVertex(SingleInputPlanNode node) throws CompilerException {
final String taskName = node.getNodeName();
final DriverStrategy ds = node.getDriverStrategy();
// check, whether chaining is possible
boolean chaining;
{
Channel inConn = node.getInput();
PlanNode pred = inConn.getSource();
chaining = ds.getPushChainDriverClass() != null &&
!(pred instanceof NAryUnionPlanNode) && // first op after union is stand-alone, because union is merged
!(pred instanceof BulkPartialSolutionPlanNode) && // partial solution merges anyways
!(pred instanceof WorksetPlanNode) && // workset merges anyways
!(pred instanceof IterationPlanNode) && // cannot chain with iteration heads currently
inConn.getShipStrategy() == ShipStrategyType.FORWARD &&
inConn.getLocalStrategy() == LocalStrategy.NONE &&
pred.getOutgoingChannels().size() == 1 &&
node.getParallelism() == pred.getParallelism() &&
node.getBroadcastInputs().isEmpty();
// cannot chain the nodes that produce the next workset or the next solution set, if they are not the
// in a tail
if (this.currentIteration instanceof WorksetIterationPlanNode && node.getOutgoingChannels().size() > 0)
{
WorksetIterationPlanNode wspn = (WorksetIterationPlanNode) this.currentIteration;
if (wspn.getSolutionSetDeltaPlanNode() == pred || wspn.getNextWorkSetPlanNode() == pred) {
chaining = false; // depends on control dependency: [if], data = [none]
}
}
// cannot chain the nodes that produce the next workset in a bulk iteration if a termination criterion follows
if (this.currentIteration instanceof BulkIterationPlanNode)
{
BulkIterationPlanNode wspn = (BulkIterationPlanNode) this.currentIteration;
if (node == wspn.getRootOfTerminationCriterion() && wspn.getRootOfStepFunction() == pred){
chaining = false; // depends on control dependency: [if], data = [none]
}else if(node.getOutgoingChannels().size() > 0 &&(wspn.getRootOfStepFunction() == pred ||
wspn.getRootOfTerminationCriterion() == pred)) {
chaining = false; // depends on control dependency: [if], data = [none]
}
}
}
final JobVertex vertex;
final TaskConfig config;
if (chaining) {
vertex = null;
config = new TaskConfig(new Configuration());
this.chainedTasks.put(node, new TaskInChain(node, ds.getPushChainDriverClass(), config, taskName));
} else {
// create task vertex
vertex = new JobVertex(taskName);
vertex.setResources(node.getMinResources(), node.getPreferredResources());
vertex.setInvokableClass((this.currentIteration != null && node.isOnDynamicPath()) ? IterationIntermediateTask.class : BatchTask.class);
config = new TaskConfig(vertex.getConfiguration());
config.setDriver(ds.getDriverClass());
}
// set user code
config.setStubWrapper(node.getProgramOperator().getUserCodeWrapper());
config.setStubParameters(node.getProgramOperator().getParameters());
// set the driver strategy
config.setDriverStrategy(ds);
for (int i = 0; i < ds.getNumRequiredComparators(); i++) {
config.setDriverComparator(node.getComparator(i), i);
}
// assign memory, file-handles, etc.
assignDriverResources(node, config);
return vertex;
} } |
public class class_name {
public void updateField(Field field) {
this.name = field.getName();
this.obj = TypeCheckUtil.isObjClass(field);
this.list = TypeCheckUtil.isListClass(field);
this.number = TypeCheckUtil.isNumberClass(field);
this.enumType = field.getType().isEnum();
this.typeClass = field.getType();
this.type = field.getType().getSimpleName();
if (this.list) {
this.innerClass = ValidationObjUtil.getListInnerClassFromGenericType(field.getGenericType());
this.type += "<" + this.innerClass.getSimpleName() + ">";
}
} } | public class class_name {
public void updateField(Field field) {
this.name = field.getName();
this.obj = TypeCheckUtil.isObjClass(field);
this.list = TypeCheckUtil.isListClass(field);
this.number = TypeCheckUtil.isNumberClass(field);
this.enumType = field.getType().isEnum();
this.typeClass = field.getType();
this.type = field.getType().getSimpleName();
if (this.list) {
this.innerClass = ValidationObjUtil.getListInnerClassFromGenericType(field.getGenericType()); // depends on control dependency: [if], data = [none]
this.type += "<" + this.innerClass.getSimpleName() + ">"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public T tag(final String tag) {
if (this.tags == null) {
this.tags = new HashSet<>();
}
this.tags.add(tag);
return (T) this;
} } | public class class_name {
@SuppressWarnings("unchecked")
public T tag(final String tag) {
if (this.tags == null) {
this.tags = new HashSet<>(); // depends on control dependency: [if], data = [none]
}
this.tags.add(tag);
return (T) this;
} } |
public class class_name {
public UserManagedCacheBuilder<K, V, T> using(Service service) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
if (service instanceof SizeOfEngineProvider) {
removeAnySizeOfEngine(otherBuilder);
}
otherBuilder.services.add(service);
return otherBuilder;
} } | public class class_name {
public UserManagedCacheBuilder<K, V, T> using(Service service) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
if (service instanceof SizeOfEngineProvider) {
removeAnySizeOfEngine(otherBuilder); // depends on control dependency: [if], data = [none]
}
otherBuilder.services.add(service);
return otherBuilder;
} } |
public class class_name {
public final boolean hasAppropriateHandler(Throwable throwable) {
if (exceptionPurger != null && purgeOnAppropriateCheck) {
throwable = exceptionPurger.purge(throwable);
}
return hasAppropriateHandlerPurged(throwable);
} } | public class class_name {
public final boolean hasAppropriateHandler(Throwable throwable) {
if (exceptionPurger != null && purgeOnAppropriateCheck) {
throwable = exceptionPurger.purge(throwable); // depends on control dependency: [if], data = [none]
}
return hasAppropriateHandlerPurged(throwable);
} } |
public class class_name {
@Override
public void registerIrObs(IREventObserver obs)
{
if (obs != null && irObserver == null)
{
irObserver = obs;
}
} } | public class class_name {
@Override
public void registerIrObs(IREventObserver obs)
{
if (obs != null && irObserver == null)
{
irObserver = obs; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <P extends ParaObject> List<P> findTerms(String type, Map<String, ?> terms, boolean matchAll,
Pager... pager) {
if (terms == null) {
return Collections.emptyList();
}
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("matchall", Boolean.toString(matchAll));
LinkedList<String> list = new LinkedList<>();
for (Map.Entry<String, ? extends Object> term : terms.entrySet()) {
String key = term.getKey();
Object value = term.getValue();
if (value != null) {
list.add(key.concat(Config.SEPARATOR).concat(value.toString()));
}
}
if (!terms.isEmpty()) {
params.put("terms", list);
}
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("terms", params), pager);
} } | public class class_name {
public <P extends ParaObject> List<P> findTerms(String type, Map<String, ?> terms, boolean matchAll,
Pager... pager) {
if (terms == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.putSingle("matchall", Boolean.toString(matchAll));
LinkedList<String> list = new LinkedList<>();
for (Map.Entry<String, ? extends Object> term : terms.entrySet()) {
String key = term.getKey();
Object value = term.getValue();
if (value != null) {
list.add(key.concat(Config.SEPARATOR).concat(value.toString())); // depends on control dependency: [if], data = [(value]
}
}
if (!terms.isEmpty()) {
params.put("terms", list); // depends on control dependency: [if], data = [none]
}
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("terms", params), pager);
} } |
public class class_name {
public void setErrorMessage(Throwable exception) {
if (exception != null) {
String message = exception.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = exception.getMessage();
}
if (Strings.isNullOrEmpty(message)) {
message = MessageFormat.format(Messages.SREsPreferencePage_9, exception.getClass().getName());
}
setErrorMessage(message);
}
} } | public class class_name {
public void setErrorMessage(Throwable exception) {
if (exception != null) {
String message = exception.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = exception.getMessage(); // depends on control dependency: [if], data = [none]
}
if (Strings.isNullOrEmpty(message)) {
message = MessageFormat.format(Messages.SREsPreferencePage_9, exception.getClass().getName()); // depends on control dependency: [if], data = [none]
}
setErrorMessage(message); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static RunIf findRunIfAnnotation(Class<?> klass) {
while (klass != null && klass != Object.class) {
RunIf annotation = klass.getAnnotation(RunIf.class);
if (annotation != null) {
return annotation;
}
klass = klass.getSuperclass();
}
return null;
} } | public class class_name {
private static RunIf findRunIfAnnotation(Class<?> klass) {
while (klass != null && klass != Object.class) {
RunIf annotation = klass.getAnnotation(RunIf.class);
if (annotation != null) {
return annotation; // depends on control dependency: [if], data = [none]
}
klass = klass.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
static Atom toBeamAtom(final IAtom a, final int flavour) {
final boolean aromatic = SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && a.getFlag(CDKConstants.ISAROMATIC);
final Integer charge = a.getFormalCharge();
final String symbol = checkNotNull(a.getSymbol(), "An atom had an undefined symbol");
Element element = Element.ofSymbol(symbol);
if (element == null) element = Element.Unknown;
AtomBuilder ab = aromatic ? AtomBuilder.aromatic(element) : AtomBuilder.aliphatic(element);
// CDK leaves nulls on pseudo atoms - we need to check this special case
Integer hCount = a.getImplicitHydrogenCount();
if (element == Element.Unknown) {
ab.hydrogens(hCount != null ? hCount : 0);
} else {
ab.hydrogens(checkNotNull(hCount, "One or more atoms had an undefined number of implicit hydrogens"));
}
if (charge != null) ab.charge(charge);
// use the mass number to specify isotope?
if (SmiFlavor.isSet(flavour, SmiFlavor.AtomicMass | SmiFlavor.AtomicMassStrict)) {
Integer massNumber = a.getMassNumber();
if (massNumber != null) {
ab.isotope(massNumber);
}
}
Integer atomClass = a.getProperty(ATOM_ATOM_MAPPING);
if (SmiFlavor.isSet(flavour, SmiFlavor.AtomAtomMap) && atomClass != null) {
ab.atomClass(atomClass);
}
return ab.build();
} } | public class class_name {
static Atom toBeamAtom(final IAtom a, final int flavour) {
final boolean aromatic = SmiFlavor.isSet(flavour, SmiFlavor.UseAromaticSymbols) && a.getFlag(CDKConstants.ISAROMATIC);
final Integer charge = a.getFormalCharge();
final String symbol = checkNotNull(a.getSymbol(), "An atom had an undefined symbol");
Element element = Element.ofSymbol(symbol);
if (element == null) element = Element.Unknown;
AtomBuilder ab = aromatic ? AtomBuilder.aromatic(element) : AtomBuilder.aliphatic(element);
// CDK leaves nulls on pseudo atoms - we need to check this special case
Integer hCount = a.getImplicitHydrogenCount();
if (element == Element.Unknown) {
ab.hydrogens(hCount != null ? hCount : 0); // depends on control dependency: [if], data = [none]
} else {
ab.hydrogens(checkNotNull(hCount, "One or more atoms had an undefined number of implicit hydrogens")); // depends on control dependency: [if], data = [none]
}
if (charge != null) ab.charge(charge);
// use the mass number to specify isotope?
if (SmiFlavor.isSet(flavour, SmiFlavor.AtomicMass | SmiFlavor.AtomicMassStrict)) {
Integer massNumber = a.getMassNumber();
if (massNumber != null) {
ab.isotope(massNumber); // depends on control dependency: [if], data = [(massNumber]
}
}
Integer atomClass = a.getProperty(ATOM_ATOM_MAPPING);
if (SmiFlavor.isSet(flavour, SmiFlavor.AtomAtomMap) && atomClass != null) {
ab.atomClass(atomClass); // depends on control dependency: [if], data = [none]
}
return ab.build();
} } |
public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public List<Wohnung> getWohnung() {
if (wohnung == null) {
wohnung = new ArrayList<Wohnung>();
}
return this.wohnung;
} } | public class class_name {
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-10-12T02:54:50+02:00", comments = "JAXB RI v2.2.11")
public List<Wohnung> getWohnung() {
if (wohnung == null) {
wohnung = new ArrayList<Wohnung>(); // depends on control dependency: [if], data = [none]
}
return this.wohnung;
} } |
public class class_name {
private String getCerticateSubject(AtomicServiceReference<Object> serviceRef, Properties sslProperties) {
String certificateDN = null;
try {
certificateDN = sslHelper.getClientKeyCertSubject(serviceRef, sslProperties);
} catch (KeyStoreException ke) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke));
} catch (CertificateException ce) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce));
}
// handle null .... cannot find the client key
if (certificateDN == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id));
}
return certificateDN;
} } | public class class_name {
private String getCerticateSubject(AtomicServiceReference<Object> serviceRef, Properties sslProperties) {
String certificateDN = null;
try {
certificateDN = sslHelper.getClientKeyCertSubject(serviceRef, sslProperties); // depends on control dependency: [try], data = [none]
} catch (KeyStoreException ke) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke); // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke));
} catch (CertificateException ce) { // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce); // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce));
} // depends on control dependency: [catch], data = [none]
// handle null .... cannot find the client key
if (certificateDN == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id); // depends on control dependency: [if], data = [none]
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id));
}
return certificateDN;
} } |
public class class_name {
protected static Set<String> generateUpdateTargets(LofPoint addedPoint, LofDataSet dataSet,
String deleteId)
{
Set<String> updateTargets = new HashSet<>();
// 以下の条件のいずれかを満たす対象点と追加された対象点に対してK距離、K距離近傍、局所到達可能密度の更新を行う必要がある。
// 但し、今回追加された対象点は常時対象となるため、判定は行わず、中間データ更新が必要として扱う。
// 1.削除されたデータをK距離近傍に含む
// 2.追加された対象点との距離がK距離より小さい。
updateTargets.add(addedPoint.getDataId());
Collection<LofPoint> pointList = dataSet.getDataMap().values();
for (LofPoint targetPoint : pointList)
{
boolean isDeteted = false;
boolean kDistUpdate = false;
// 今回追加された対象点は判定をスキップ
if (StringUtils.equals(addedPoint.getDataId(), targetPoint.getDataId()) == true)
{
continue;
}
// 「1.削除されたデータをK距離近傍に含む」判定
// K値は高々20~30の値になるのが一般的なため、Listへのcontainsメソッド実行は性能負荷にはならないと判断する。
if (deleteId != null && targetPoint.getkDistanceNeighbor().contains(deleteId) == true)
{
isDeteted = true;
}
// 「2.追加された対象点との距離がK距離より小さい。」判定
if (MathUtils.distance(addedPoint.getDataPoint(), targetPoint.getDataPoint()) < targetPoint.getkDistance())
{
kDistUpdate = true;
}
if (isDeteted || kDistUpdate)
{
updateTargets.add(targetPoint.getDataId());
}
}
return updateTargets;
} } | public class class_name {
protected static Set<String> generateUpdateTargets(LofPoint addedPoint, LofDataSet dataSet,
String deleteId)
{
Set<String> updateTargets = new HashSet<>();
// 以下の条件のいずれかを満たす対象点と追加された対象点に対してK距離、K距離近傍、局所到達可能密度の更新を行う必要がある。
// 但し、今回追加された対象点は常時対象となるため、判定は行わず、中間データ更新が必要として扱う。
// 1.削除されたデータをK距離近傍に含む
// 2.追加された対象点との距離がK距離より小さい。
updateTargets.add(addedPoint.getDataId());
Collection<LofPoint> pointList = dataSet.getDataMap().values();
for (LofPoint targetPoint : pointList)
{
boolean isDeteted = false;
boolean kDistUpdate = false;
// 今回追加された対象点は判定をスキップ
if (StringUtils.equals(addedPoint.getDataId(), targetPoint.getDataId()) == true)
{
continue;
}
// 「1.削除されたデータをK距離近傍に含む」判定
// K値は高々20~30の値になるのが一般的なため、Listへのcontainsメソッド実行は性能負荷にはならないと判断する。
if (deleteId != null && targetPoint.getkDistanceNeighbor().contains(deleteId) == true)
{
isDeteted = true; // depends on control dependency: [if], data = [none]
}
// 「2.追加された対象点との距離がK距離より小さい。」判定
if (MathUtils.distance(addedPoint.getDataPoint(), targetPoint.getDataPoint()) < targetPoint.getkDistance())
{
kDistUpdate = true; // depends on control dependency: [if], data = [none]
}
if (isDeteted || kDistUpdate)
{
updateTargets.add(targetPoint.getDataId()); // depends on control dependency: [if], data = [none]
}
}
return updateTargets;
} } |
public class class_name {
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> listRemoteLoginInformationNextWithServiceResponseAsync(final String nextPageLink) {
return listRemoteLoginInformationNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<RemoteLoginInformationInner>>, Observable<ServiceResponse<Page<RemoteLoginInformationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> call(ServiceResponse<Page<RemoteLoginInformationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listRemoteLoginInformationNextWithServiceResponseAsync(nextPageLink));
}
});
} } | public class class_name {
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> listRemoteLoginInformationNextWithServiceResponseAsync(final String nextPageLink) {
return listRemoteLoginInformationNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<RemoteLoginInformationInner>>, Observable<ServiceResponse<Page<RemoteLoginInformationInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RemoteLoginInformationInner>>> call(ServiceResponse<Page<RemoteLoginInformationInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listRemoteLoginInformationNextWithServiceResponseAsync(nextPageLink));
}
});
} } |
public class class_name {
public static void gcInfo(final Map<String, Object> infos) {
List<GarbageCollectorMXBean> mxBeans = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean mxBean : mxBeans) {
infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionCount", mxBean.getCollectionCount());
infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionTime", mxBean.getCollectionTime());
}
} } | public class class_name {
public static void gcInfo(final Map<String, Object> infos) {
List<GarbageCollectorMXBean> mxBeans = ManagementFactory.getGarbageCollectorMXBeans();
for (GarbageCollectorMXBean mxBean : mxBeans) {
infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionCount", mxBean.getCollectionCount()); // depends on control dependency: [for], data = [mxBean]
infos.put("gc." + mxBean.getName().toLowerCase() + ".collectionTime", mxBean.getCollectionTime()); // depends on control dependency: [for], data = [mxBean]
}
} } |
public class class_name {
public void marshall(DetachThingPrincipalRequest detachThingPrincipalRequest, ProtocolMarshaller protocolMarshaller) {
if (detachThingPrincipalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachThingPrincipalRequest.getThingName(), THINGNAME_BINDING);
protocolMarshaller.marshall(detachThingPrincipalRequest.getPrincipal(), PRINCIPAL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DetachThingPrincipalRequest detachThingPrincipalRequest, ProtocolMarshaller protocolMarshaller) {
if (detachThingPrincipalRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachThingPrincipalRequest.getThingName(), THINGNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detachThingPrincipalRequest.getPrincipal(), PRINCIPAL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setEventSubscriptionsList(java.util.Collection<EventSubscription> eventSubscriptionsList) {
if (eventSubscriptionsList == null) {
this.eventSubscriptionsList = null;
return;
}
this.eventSubscriptionsList = new com.amazonaws.internal.SdkInternalList<EventSubscription>(eventSubscriptionsList);
} } | public class class_name {
public void setEventSubscriptionsList(java.util.Collection<EventSubscription> eventSubscriptionsList) {
if (eventSubscriptionsList == null) {
this.eventSubscriptionsList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.eventSubscriptionsList = new com.amazonaws.internal.SdkInternalList<EventSubscription>(eventSubscriptionsList);
} } |
public class class_name {
public ExpressionBuilder or() {
GroupExpression lastGroupExpression = stack.isEmpty() ? null : stack.peek();
if (lhsExpression == null) {
throw new SyntaxException("Syntax exception: OR missing LHS operand");
} else if (lastGroupExpression == null) {
GroupExpression or = new GroupExpression(GroupExpression.Type.OR);
or.add(lhsExpression);
stack.push(or);
expression.setExpression(or);
lhsExpression = null;
} else if (lastGroupExpression.getType().equals(GroupExpression.Type.OR)) {
// Keep using the existing OR
lhsExpression = null;
return this;
} else if (lastGroupExpression.getType().equals(GroupExpression.Type.AND)) {
// AND takes precedence over OR, so we wrap the AND
// by removing it from any parent expressions and inserting the OR in its place
GroupExpression and = stack.pop();
GroupExpression or = new GroupExpression(GroupExpression.Type.OR);
if (stack.isEmpty()) {
expression.setExpression(or);
or.add(and);
} else {
// need to get at the parent
GroupExpression parent = stack.pop();
parent.remove(and);
parent.add(or);
or.add(and);
}
stack.push(and);
stack.push(or);
lhsExpression = null;
}
return this;
} } | public class class_name {
public ExpressionBuilder or() {
GroupExpression lastGroupExpression = stack.isEmpty() ? null : stack.peek();
if (lhsExpression == null) {
throw new SyntaxException("Syntax exception: OR missing LHS operand");
} else if (lastGroupExpression == null) {
GroupExpression or = new GroupExpression(GroupExpression.Type.OR);
or.add(lhsExpression); // depends on control dependency: [if], data = [none]
stack.push(or); // depends on control dependency: [if], data = [none]
expression.setExpression(or); // depends on control dependency: [if], data = [none]
lhsExpression = null; // depends on control dependency: [if], data = [none]
} else if (lastGroupExpression.getType().equals(GroupExpression.Type.OR)) {
// Keep using the existing OR
lhsExpression = null; // depends on control dependency: [if], data = [none]
return this; // depends on control dependency: [if], data = [none]
} else if (lastGroupExpression.getType().equals(GroupExpression.Type.AND)) {
// AND takes precedence over OR, so we wrap the AND
// by removing it from any parent expressions and inserting the OR in its place
GroupExpression and = stack.pop();
GroupExpression or = new GroupExpression(GroupExpression.Type.OR);
if (stack.isEmpty()) {
expression.setExpression(or); // depends on control dependency: [if], data = [none]
or.add(and); // depends on control dependency: [if], data = [none]
} else {
// need to get at the parent
GroupExpression parent = stack.pop();
parent.remove(and); // depends on control dependency: [if], data = [none]
parent.add(or); // depends on control dependency: [if], data = [none]
or.add(and); // depends on control dependency: [if], data = [none]
}
stack.push(and); // depends on control dependency: [if], data = [none]
stack.push(or); // depends on control dependency: [if], data = [none]
lhsExpression = null; // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs);
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs);
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options));
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options));
}
} } | public class class_name {
@Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs); // depends on control dependency: [if], data = [none]
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs); // depends on control dependency: [if], data = [none]
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options)); // depends on control dependency: [if], data = [none]
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("UnusedReturnValue")
private boolean initialize() {
// For API level 18 and above, get a reference to BluetoothAdapter through
// BluetoothManager.
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
if (bluetoothManager == null) {
loge("Unable to initialize BluetoothManager.");
return false;
}
mBluetoothAdapter = bluetoothManager.getAdapter();
if (mBluetoothAdapter == null) {
loge("Unable to obtain a BluetoothAdapter.");
return false;
}
return true;
} } | public class class_name {
@SuppressWarnings("UnusedReturnValue")
private boolean initialize() {
// For API level 18 and above, get a reference to BluetoothAdapter through
// BluetoothManager.
final BluetoothManager bluetoothManager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
if (bluetoothManager == null) {
loge("Unable to initialize BluetoothManager."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
mBluetoothAdapter = bluetoothManager.getAdapter();
if (mBluetoothAdapter == null) {
loge("Unable to obtain a BluetoothAdapter."); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
@Override
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
if (this.schemeInformation != null) {
children.add(this.schemeInformation);
}
children.addAll(this.metadataLists);
if (this.distributionPoints != null) {
children.add(this.distributionPoints);
}
if (this.getSignature() != null) {
children.add(this.getSignature());
}
return Collections.unmodifiableList(children);
} } | public class class_name {
@Override
public List<XMLObject> getOrderedChildren() {
ArrayList<XMLObject> children = new ArrayList<XMLObject>();
if (this.schemeInformation != null) {
children.add(this.schemeInformation); // depends on control dependency: [if], data = [(this.schemeInformation]
}
children.addAll(this.metadataLists);
if (this.distributionPoints != null) {
children.add(this.distributionPoints); // depends on control dependency: [if], data = [(this.distributionPoints]
}
if (this.getSignature() != null) {
children.add(this.getSignature()); // depends on control dependency: [if], data = [(this.getSignature()]
}
return Collections.unmodifiableList(children);
} } |
public class class_name {
public static <T> Response call(String resource, S3RestUtils.RestCallable<T> callable) {
try {
// TODO(cc): reconsider how to enable authentication
if (SecurityUtils.isSecurityEnabled(ServerConfiguration.global())
&& AuthenticatedClientUser.get(ServerConfiguration.global()) == null) {
AuthenticatedClientUser.set(LoginUser.get(ServerConfiguration.global()).getName());
}
} catch (IOException e) {
LOG.warn("Failed to set AuthenticatedClientUser in REST service handler: {}", e.getMessage());
return createErrorResponse(new S3Exception(e, resource, S3ErrorCode.INTERNAL_ERROR));
}
try {
return createResponse(callable.call());
} catch (S3Exception e) {
LOG.warn("Unexpected error invoking REST endpoint: {}", e.getErrorCode().getDescription());
return createErrorResponse(e);
}
} } | public class class_name {
public static <T> Response call(String resource, S3RestUtils.RestCallable<T> callable) {
try {
// TODO(cc): reconsider how to enable authentication
if (SecurityUtils.isSecurityEnabled(ServerConfiguration.global())
&& AuthenticatedClientUser.get(ServerConfiguration.global()) == null) {
AuthenticatedClientUser.set(LoginUser.get(ServerConfiguration.global()).getName()); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.warn("Failed to set AuthenticatedClientUser in REST service handler: {}", e.getMessage());
return createErrorResponse(new S3Exception(e, resource, S3ErrorCode.INTERNAL_ERROR));
} // depends on control dependency: [catch], data = [none]
try {
return createResponse(callable.call()); // depends on control dependency: [try], data = [none]
} catch (S3Exception e) {
LOG.warn("Unexpected error invoking REST endpoint: {}", e.getErrorCode().getDescription());
return createErrorResponse(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static byte[] encrypt(byte[] keyData, byte[] iv, byte[] data,
String cipherTransformation)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
Cipher cipher = createCipher(Cipher.ENCRYPT_MODE, keyData, iv, cipherTransformation);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
byte[] temp = cipher.update(data);
if (temp != null && temp.length > 0) {
baos.write(temp);
}
if (cipherTransformation.endsWith("/ECB/NoPadding")
|| cipherTransformation.endsWith("/CBC/NoPadding")
|| cipherTransformation.endsWith("/PCBC/NoPadding")) {
temp = cipher.doFinal(PADDING[16 - data.length % 16]);
} else {
temp = cipher.doFinal();
}
if (temp != null && temp.length > 0) {
baos.write(temp);
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return baos.toByteArray();
} } | public class class_name {
public static byte[] encrypt(byte[] keyData, byte[] iv, byte[] data,
String cipherTransformation)
throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException,
IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException {
Cipher cipher = createCipher(Cipher.ENCRYPT_MODE, keyData, iv, cipherTransformation);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
byte[] temp = cipher.update(data);
if (temp != null && temp.length > 0) {
baos.write(temp); // depends on control dependency: [if], data = [(temp]
}
if (cipherTransformation.endsWith("/ECB/NoPadding")
|| cipherTransformation.endsWith("/CBC/NoPadding")
|| cipherTransformation.endsWith("/PCBC/NoPadding")) {
temp = cipher.doFinal(PADDING[16 - data.length % 16]); // depends on control dependency: [if], data = [none]
} else {
temp = cipher.doFinal(); // depends on control dependency: [if], data = [none]
}
if (temp != null && temp.length > 0) {
baos.write(temp); // depends on control dependency: [if], data = [(temp]
}
} catch (IOException e) {
throw new RuntimeException(e);
}
return baos.toByteArray();
} } |
public class class_name {
public List<Integer> getPageRange() {
List<Integer> r = new ArrayList<Integer>();
for (int i = 1; i <= getPages(); i++) {
r.add(i);
}
return r;
} } | public class class_name {
public List<Integer> getPageRange() {
List<Integer> r = new ArrayList<Integer>();
for (int i = 1; i <= getPages(); i++) {
r.add(i);
// depends on control dependency: [for], data = [i]
}
return r;
} } |
public class class_name {
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth();
String condition = null;
Map<String, String> descriptiveTexts = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
if (name.equals("text")) {
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
}
else {
assert (condition == null);
condition = parser.getName();
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new SASLFailure(condition, descriptiveTexts);
} } | public class class_name {
public static SASLFailure parseSASLFailure(XmlPullParser parser) throws XmlPullParserException, IOException {
final int initialDepth = parser.getDepth();
String condition = null;
Map<String, String> descriptiveTexts = null;
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
if (name.equals("text")) {
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); // depends on control dependency: [if], data = [none]
}
else {
assert (condition == null); // depends on control dependency: [if], data = [none]
condition = parser.getName(); // depends on control dependency: [if], data = [none]
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new SASLFailure(condition, descriptiveTexts);
} } |
public class class_name {
private SignatureFieldExtension initExtension() {
SignatureFieldExtension ext = new SignatureFieldExtension(this);
ext.addSignatureChangeListener(new SignatureFieldExtension.SignatureChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void signatureChange(SignatureFieldExtension.SignatureChangeEvent event) {
changingVariables = true;
try {
setValue(event.getSignature(), true);
} finally {
changingVariables = false;
}
}
});
return ext;
} } | public class class_name {
private SignatureFieldExtension initExtension() {
SignatureFieldExtension ext = new SignatureFieldExtension(this);
ext.addSignatureChangeListener(new SignatureFieldExtension.SignatureChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void signatureChange(SignatureFieldExtension.SignatureChangeEvent event) {
changingVariables = true;
try {
setValue(event.getSignature(), true); // depends on control dependency: [try], data = [none]
} finally {
changingVariables = false;
}
}
});
return ext;
} } |
public class class_name {
private void scanAnnotations() {
// set remote type and request URI path from @Remote, @Controller or @Service
boolean remoteType = false;
Controller controllerAnnotation = getAnnotation(implementationClass, Controller.class);
if (controllerAnnotation != null) {
remoteType = true;
requestPath = controllerAnnotation.value();
}
Service serviceAnnotation = getAnnotation(implementationClass, Service.class);
if (serviceAnnotation != null) {
remoteType = true;
requestPath = serviceAnnotation.value();
}
Remote remoteAnnotation = getAnnotation(implementationClass, Remote.class);
if (remoteAnnotation != null) {
remoteType = true;
}
RequestPath requestPathAnnotation = getAnnotation(implementationClass, RequestPath.class);
if (requestPathAnnotation != null) {
requestPath = requestPathAnnotation.value();
}
if (requestPath != null && requestPath.isEmpty()) {
requestPath = null;
}
if (remoteType) {
remotelyAccessible = true;
}
// set transactional and immutable type
boolean transactionalType = hasAnnotation(implementationClass, Transactional.class);
boolean immutableType = hasAnnotation(implementationClass, Immutable.class);
if (!transactionalType && immutableType) {
throw new BugError("@Immutable annotation without @Transactional on class |%s|.", implementationClass.getName());
}
if (transactionalType && !instanceType.isPROXY()) {
throw new BugError("@Transactional requires |%s| type but found |%s| on |%s|.", InstanceType.PROXY, instanceType, implementationClass);
}
Class<? extends Interceptor> classInterceptor = getInterceptorClass(implementationClass);
boolean publicType = hasAnnotation(implementationClass, Public.class);
// managed classes does not support public inheritance
for (Method method : implementationClass.getDeclaredMethods()) {
final int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
// scans only public and non-static methods
continue;
}
Method interfaceMethod = getInterfaceMethod(method);
ManagedMethod managedMethod = null;
boolean remoteMethod = hasAnnotation(method, Remote.class);
if (!remoteMethod) {
remoteMethod = remoteType;
}
if (hasAnnotation(method, Local.class)) {
if (!remoteMethod) {
throw new BugError("@Local annotation on not remote method |%s|.", method);
}
remoteMethod = false;
}
if (remoteMethod) {
// if at least one owned managed method is remote this managed class become remote too
remotelyAccessible = true;
}
// load method interceptor annotation and if missing uses class annotation; is legal for both to be null
Class<? extends Interceptor> methodInterceptor = getInterceptorClass(method);
if (methodInterceptor == null) {
methodInterceptor = classInterceptor;
}
// if method is intercepted, either by method or class annotation, create intercepted managed method
if (methodInterceptor != null) {
if (!instanceType.isPROXY() && !remotelyAccessible) {
throw new BugError("@Intercepted method |%s| supported only on PROXY type or remote accessible classes.", method);
}
managedMethod = new ManagedMethod(this, methodInterceptor, interfaceMethod);
}
// handle remote accessible methods
boolean publicMethod = hasAnnotation(method, Public.class);
if (publicMethod && !remotelyAccessible) {
throw new BugError("@Public annotation on not remote method |%s|.", method);
}
if (!publicMethod) {
publicMethod = publicType;
}
if (hasAnnotation(method, Private.class)) {
if (!remotelyAccessible) {
throw new BugError("@Private annotation on not remote method |%s|.", method);
}
publicMethod = false;
}
RequestPath methodPath = getAnnotation(method, RequestPath.class);
if (!remotelyAccessible && methodPath != null) {
throw new BugError("@MethodPath annotation on not remote method |%s|.", method);
}
if (remoteMethod) {
if (managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
}
managedMethod.setRequestPath(methodPath != null ? methodPath.value() : null);
managedMethod.setRemotelyAccessible(remoteMethod);
managedMethod.setAccess(publicMethod ? Access.PUBLIC : Access.PRIVATE);
}
// handle declarative transaction
// 1. allow transactional only on PROXY
// 2. do not allow immutable on method if not transactional
// 3. do not allow mutable on method if not transactional
// 4. if PROXY create managed method if not already created from above remote method logic
if (!transactionalType) {
transactionalType = hasAnnotation(method, Transactional.class);
}
if (transactionalType) {
transactional = true;
if (!instanceType.isPROXY()) {
throw new BugError("@Transactional requires |%s| type but found |%s|.", InstanceType.PROXY, instanceType);
}
}
boolean immutable = hasAnnotation(method, Immutable.class);
if (immutable && !transactional) {
log.debug("@Immutable annotation without @Transactional on method |%s|.", method);
}
if (!immutable) {
immutable = immutableType;
}
if (hasAnnotation(method, Mutable.class)) {
if (!transactional) {
log.debug("@Mutable annotation without @Transactional on method |%s|.", method);
}
immutable = false;
}
if (instanceType.isPROXY() && managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
}
if (transactional) {
managedMethod.setTransactional(true);
managedMethod.setImmutable(immutable);
}
// handle asynchronous mode
// 1. instance type should be PROXY or managed class should be flagged for remote access
// 2. transactional method cannot be executed asynchronously
// 3. asynchronous method should be void
boolean asynchronousMethod = hasAnnotation(method, Asynchronous.class);
if (asynchronousMethod) {
if (!instanceType.isPROXY() && !remotelyAccessible) {
throw new BugError("Not supported instance type |%s| for asynchronous method |%s|.", instanceType, method);
}
if (transactional) {
throw new BugError("Transactional method |%s| cannot be executed asynchronous.", method);
}
if (!Types.isVoid(method.getReturnType())) {
throw new BugError("Asynchronous method |%s| must be void.", method);
}
// at this point either instance type is PROXY or remote flag is true; checked by above bug error
// both conditions has been already processed with managed method creation
// so managed method must be already created
managedMethod.setAsynchronous(asynchronousMethod);
}
Cron cronMethod = getAnnotation(method, Cron.class);
if (cronMethod != null) {
// if (!instanceType.isPROXY()) {
// throw new BugError("Not supported instance type |%s| for cron method |%s|.", instanceType, method);
// }
if (remotelyAccessible) {
throw new BugError("Remote accessible method |%s| cannot be executed by cron.", method);
}
if (transactional) {
throw new BugError("Transactional method |%s| cannot be executed by cron.", method);
}
if (!Types.isVoid(method.getReturnType())) {
throw new BugError("Cron method |%s| must be void.", method);
}
if (managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
}
managedMethod.setCronExpression(cronMethod.value());
cronMethodsPool.add(managedMethod);
autoInstanceCreation = true;
}
// store managed method, if created, to managed methods pool
if (managedMethod != null) {
methodsPool.put(interfaceMethod, managedMethod);
if (managedMethod.isRemotelyAccessible() && netMethodsPool.put(method.getName(), managedMethod) != null) {
throw new BugError("Overloading is not supported for net method |%s|.", managedMethod);
}
}
}
for (Field field : implementationClass.getDeclaredFields()) {
ContextParam contextParam = field.getAnnotation(ContextParam.class);
if (contextParam != null) {
field.setAccessible(true);
contextParamFields.put(contextParam.value(), field);
}
}
} } | public class class_name {
private void scanAnnotations() {
// set remote type and request URI path from @Remote, @Controller or @Service
boolean remoteType = false;
Controller controllerAnnotation = getAnnotation(implementationClass, Controller.class);
if (controllerAnnotation != null) {
remoteType = true;
// depends on control dependency: [if], data = [none]
requestPath = controllerAnnotation.value();
// depends on control dependency: [if], data = [none]
}
Service serviceAnnotation = getAnnotation(implementationClass, Service.class);
if (serviceAnnotation != null) {
remoteType = true;
// depends on control dependency: [if], data = [none]
requestPath = serviceAnnotation.value();
// depends on control dependency: [if], data = [none]
}
Remote remoteAnnotation = getAnnotation(implementationClass, Remote.class);
if (remoteAnnotation != null) {
remoteType = true;
// depends on control dependency: [if], data = [none]
}
RequestPath requestPathAnnotation = getAnnotation(implementationClass, RequestPath.class);
if (requestPathAnnotation != null) {
requestPath = requestPathAnnotation.value();
// depends on control dependency: [if], data = [none]
}
if (requestPath != null && requestPath.isEmpty()) {
requestPath = null;
// depends on control dependency: [if], data = [none]
}
if (remoteType) {
remotelyAccessible = true;
// depends on control dependency: [if], data = [none]
}
// set transactional and immutable type
boolean transactionalType = hasAnnotation(implementationClass, Transactional.class);
boolean immutableType = hasAnnotation(implementationClass, Immutable.class);
if (!transactionalType && immutableType) {
throw new BugError("@Immutable annotation without @Transactional on class |%s|.", implementationClass.getName());
}
if (transactionalType && !instanceType.isPROXY()) {
throw new BugError("@Transactional requires |%s| type but found |%s| on |%s|.", InstanceType.PROXY, instanceType, implementationClass);
}
Class<? extends Interceptor> classInterceptor = getInterceptorClass(implementationClass);
boolean publicType = hasAnnotation(implementationClass, Public.class);
// managed classes does not support public inheritance
for (Method method : implementationClass.getDeclaredMethods()) {
final int modifiers = method.getModifiers();
if (Modifier.isStatic(modifiers) || !Modifier.isPublic(modifiers)) {
// scans only public and non-static methods
continue;
}
Method interfaceMethod = getInterfaceMethod(method);
ManagedMethod managedMethod = null;
boolean remoteMethod = hasAnnotation(method, Remote.class);
if (!remoteMethod) {
remoteMethod = remoteType;
// depends on control dependency: [if], data = [none]
}
if (hasAnnotation(method, Local.class)) {
if (!remoteMethod) {
throw new BugError("@Local annotation on not remote method |%s|.", method);
}
remoteMethod = false;
// depends on control dependency: [if], data = [none]
}
if (remoteMethod) {
// if at least one owned managed method is remote this managed class become remote too
remotelyAccessible = true;
// depends on control dependency: [if], data = [none]
}
// load method interceptor annotation and if missing uses class annotation; is legal for both to be null
Class<? extends Interceptor> methodInterceptor = getInterceptorClass(method);
if (methodInterceptor == null) {
methodInterceptor = classInterceptor;
// depends on control dependency: [if], data = [none]
}
// if method is intercepted, either by method or class annotation, create intercepted managed method
if (methodInterceptor != null) {
if (!instanceType.isPROXY() && !remotelyAccessible) {
throw new BugError("@Intercepted method |%s| supported only on PROXY type or remote accessible classes.", method);
}
managedMethod = new ManagedMethod(this, methodInterceptor, interfaceMethod);
// depends on control dependency: [if], data = [none]
}
// handle remote accessible methods
boolean publicMethod = hasAnnotation(method, Public.class);
if (publicMethod && !remotelyAccessible) {
throw new BugError("@Public annotation on not remote method |%s|.", method);
}
if (!publicMethod) {
publicMethod = publicType;
// depends on control dependency: [if], data = [none]
}
if (hasAnnotation(method, Private.class)) {
if (!remotelyAccessible) {
throw new BugError("@Private annotation on not remote method |%s|.", method);
}
publicMethod = false;
// depends on control dependency: [if], data = [none]
}
RequestPath methodPath = getAnnotation(method, RequestPath.class);
if (!remotelyAccessible && methodPath != null) {
throw new BugError("@MethodPath annotation on not remote method |%s|.", method);
}
if (remoteMethod) {
if (managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
// depends on control dependency: [if], data = [none]
}
managedMethod.setRequestPath(methodPath != null ? methodPath.value() : null);
// depends on control dependency: [if], data = [none]
managedMethod.setRemotelyAccessible(remoteMethod);
// depends on control dependency: [if], data = [(remoteMethod)]
managedMethod.setAccess(publicMethod ? Access.PUBLIC : Access.PRIVATE);
// depends on control dependency: [if], data = [none]
}
// handle declarative transaction
// 1. allow transactional only on PROXY
// 2. do not allow immutable on method if not transactional
// 3. do not allow mutable on method if not transactional
// 4. if PROXY create managed method if not already created from above remote method logic
if (!transactionalType) {
transactionalType = hasAnnotation(method, Transactional.class);
// depends on control dependency: [if], data = [none]
}
if (transactionalType) {
transactional = true;
// depends on control dependency: [if], data = [none]
if (!instanceType.isPROXY()) {
throw new BugError("@Transactional requires |%s| type but found |%s|.", InstanceType.PROXY, instanceType);
}
}
boolean immutable = hasAnnotation(method, Immutable.class);
if (immutable && !transactional) {
log.debug("@Immutable annotation without @Transactional on method |%s|.", method);
}
if (!immutable) {
immutable = immutableType;
// depends on control dependency: [if], data = [none]
}
if (hasAnnotation(method, Mutable.class)) {
if (!transactional) {
log.debug("@Mutable annotation without @Transactional on method |%s|.", method);
}
immutable = false;
// depends on control dependency: [if], data = [none]
}
if (instanceType.isPROXY() && managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
// depends on control dependency: [if], data = [none]
}
if (transactional) {
managedMethod.setTransactional(true);
// depends on control dependency: [if], data = [none]
managedMethod.setImmutable(immutable);
// depends on control dependency: [if], data = [none]
}
// handle asynchronous mode
// 1. instance type should be PROXY or managed class should be flagged for remote access
// 2. transactional method cannot be executed asynchronously
// 3. asynchronous method should be void
boolean asynchronousMethod = hasAnnotation(method, Asynchronous.class);
if (asynchronousMethod) {
if (!instanceType.isPROXY() && !remotelyAccessible) {
throw new BugError("Not supported instance type |%s| for asynchronous method |%s|.", instanceType, method);
}
if (transactional) {
throw new BugError("Transactional method |%s| cannot be executed asynchronous.", method);
}
if (!Types.isVoid(method.getReturnType())) {
throw new BugError("Asynchronous method |%s| must be void.", method);
}
// at this point either instance type is PROXY or remote flag is true; checked by above bug error
// both conditions has been already processed with managed method creation
// so managed method must be already created
managedMethod.setAsynchronous(asynchronousMethod);
// depends on control dependency: [if], data = [(asynchronousMethod)]
}
Cron cronMethod = getAnnotation(method, Cron.class);
if (cronMethod != null) {
// if (!instanceType.isPROXY()) {
// throw new BugError("Not supported instance type |%s| for cron method |%s|.", instanceType, method);
// }
if (remotelyAccessible) {
throw new BugError("Remote accessible method |%s| cannot be executed by cron.", method);
}
if (transactional) {
throw new BugError("Transactional method |%s| cannot be executed by cron.", method);
}
if (!Types.isVoid(method.getReturnType())) {
throw new BugError("Cron method |%s| must be void.", method);
}
if (managedMethod == null) {
managedMethod = new ManagedMethod(this, interfaceMethod);
// depends on control dependency: [if], data = [none]
}
managedMethod.setCronExpression(cronMethod.value());
// depends on control dependency: [if], data = [(cronMethod]
cronMethodsPool.add(managedMethod);
// depends on control dependency: [if], data = [none]
autoInstanceCreation = true;
// depends on control dependency: [if], data = [none]
}
// store managed method, if created, to managed methods pool
if (managedMethod != null) {
methodsPool.put(interfaceMethod, managedMethod);
// depends on control dependency: [if], data = [none]
if (managedMethod.isRemotelyAccessible() && netMethodsPool.put(method.getName(), managedMethod) != null) {
throw new BugError("Overloading is not supported for net method |%s|.", managedMethod);
}
}
}
for (Field field : implementationClass.getDeclaredFields()) {
ContextParam contextParam = field.getAnnotation(ContextParam.class);
if (contextParam != null) {
field.setAccessible(true);
// depends on control dependency: [if], data = [none]
contextParamFields.put(contextParam.value(), field);
// depends on control dependency: [if], data = [(contextParam]
}
}
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public CustomMake init(){
List<String> plug = (List<String>) ((Map)NutConf.get("EL")).get("custom");
String [] t = plug.toArray(new String[0]);
PluginManager<RunMethod> rm = new SimplePluginManager<RunMethod>(t);
for(RunMethod r : rm.gets()){
me().runms.put(r.fetchSelf(), r);
}
return this;
} } | public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
public CustomMake init(){
List<String> plug = (List<String>) ((Map)NutConf.get("EL")).get("custom");
String [] t = plug.toArray(new String[0]);
PluginManager<RunMethod> rm = new SimplePluginManager<RunMethod>(t);
for(RunMethod r : rm.gets()){
me().runms.put(r.fetchSelf(), r); // depends on control dependency: [for], data = [r]
}
return this;
} } |
public class class_name {
void open() {
initParams();
int state = properties.getDBModified();
switch (state) {
case HsqlDatabaseProperties.FILES_MODIFIED :
deleteNewAndOldFiles();
restoreBackup();
processScript();
processDataFile();
processLog();
close(false);
if (cache != null) {
cache.open(filesReadOnly);
}
reopenAllTextCaches();
break;
case HsqlDatabaseProperties.FILES_NEW :
try {
deleteBackup();
backupData();
renameNewBackup();
renameNewScript();
deleteLog();
properties.setDBModified(
HsqlDatabaseProperties.FILES_NOT_MODIFIED);
} catch (IOException e) {
database.logger.appLog.logContext(e, null);
}
// continue as non-modified files
// $FALL-THROUGH$
case HsqlDatabaseProperties.FILES_NOT_MODIFIED :
/**
* if startup is after a SHUTDOWN SCRIPT and there are CACHED
* or TEXT tables, perform a checkpoint so that the .script
* file no longer contains CACHED or TEXT table rows.
*/
processScript();
if (isAnyCacheModified()) {
properties.setDBModified(
HsqlDatabaseProperties.FILES_MODIFIED);
close(false);
if (cache != null) {
cache.open(filesReadOnly);
}
reopenAllTextCaches();
}
break;
}
openLog();
if (!filesReadOnly) {
properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED);
}
} } | public class class_name {
void open() {
initParams();
int state = properties.getDBModified();
switch (state) {
case HsqlDatabaseProperties.FILES_MODIFIED :
deleteNewAndOldFiles();
restoreBackup();
processScript();
processDataFile();
processLog();
close(false);
if (cache != null) {
cache.open(filesReadOnly); // depends on control dependency: [if], data = [none]
}
reopenAllTextCaches();
break;
case HsqlDatabaseProperties.FILES_NEW :
try {
deleteBackup(); // depends on control dependency: [try], data = [none]
backupData(); // depends on control dependency: [try], data = [none]
renameNewBackup(); // depends on control dependency: [try], data = [none]
renameNewScript(); // depends on control dependency: [try], data = [none]
deleteLog(); // depends on control dependency: [try], data = [none]
properties.setDBModified(
HsqlDatabaseProperties.FILES_NOT_MODIFIED); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
database.logger.appLog.logContext(e, null);
} // depends on control dependency: [catch], data = [none]
// continue as non-modified files
// $FALL-THROUGH$
case HsqlDatabaseProperties.FILES_NOT_MODIFIED :
/**
* if startup is after a SHUTDOWN SCRIPT and there are CACHED
* or TEXT tables, perform a checkpoint so that the .script
* file no longer contains CACHED or TEXT table rows.
*/
processScript();
if (isAnyCacheModified()) {
properties.setDBModified(
HsqlDatabaseProperties.FILES_MODIFIED); // depends on control dependency: [if], data = [none]
close(false); // depends on control dependency: [if], data = [none]
if (cache != null) {
cache.open(filesReadOnly); // depends on control dependency: [if], data = [none]
}
reopenAllTextCaches(); // depends on control dependency: [if], data = [none]
}
break;
}
openLog();
if (!filesReadOnly) {
properties.setDBModified(HsqlDatabaseProperties.FILES_MODIFIED); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
for (int i = 0; i < Constants.DTDS_TLD.length; i++) {
if (publicId.equals(Constants.DTDS_TLD[i])) {
return new InputSource(getClass().getResourceAsStream(LUCEE_DTD_1_0));
}
}
if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_1));
}
else if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_2));
}
return null;
} } | public class class_name {
@Override
public InputSource resolveEntity(String publicId, String systemId) {
for (int i = 0; i < Constants.DTDS_TLD.length; i++) {
if (publicId.equals(Constants.DTDS_TLD[i])) {
return new InputSource(getClass().getResourceAsStream(LUCEE_DTD_1_0)); // depends on control dependency: [if], data = [none]
}
}
if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_1));
}
else if (publicId.equals("-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN")) {
return new InputSource(getClass().getResourceAsStream(SUN_DTD_1_2));
}
return null;
} } |
public class class_name {
public boolean isSubCategory(HierarchyAttribute comp)
{
// Check that the comparator is of the same type class as this one.
if (!comp.attributeClass.attributeClassName.equals(attributeClass.attributeClassName))
{
return false;
}
// Extract the path labels from this and the comparator.
List<String> otherPath = comp.getPathValue();
List<String> path = getPathValue();
// Check that the path length of the comparator is the same as this plus one or longer.
if (otherPath.size() <= path.size())
{
return false;
}
// Start by assuming that the paths prefixes are the same, then walk down both paths checking they are
// the same.
boolean subcat = true;
for (int i = 0; i < path.size(); i++)
{
// Check that the labels really are equal.
if (!otherPath.get(i).equals(path.get(i)))
{
subcat = false;
break;
}
}
return subcat;
} } | public class class_name {
public boolean isSubCategory(HierarchyAttribute comp)
{
// Check that the comparator is of the same type class as this one.
if (!comp.attributeClass.attributeClassName.equals(attributeClass.attributeClassName))
{
return false; // depends on control dependency: [if], data = [none]
}
// Extract the path labels from this and the comparator.
List<String> otherPath = comp.getPathValue();
List<String> path = getPathValue();
// Check that the path length of the comparator is the same as this plus one or longer.
if (otherPath.size() <= path.size())
{
return false; // depends on control dependency: [if], data = [none]
}
// Start by assuming that the paths prefixes are the same, then walk down both paths checking they are
// the same.
boolean subcat = true;
for (int i = 0; i < path.size(); i++)
{
// Check that the labels really are equal.
if (!otherPath.get(i).equals(path.get(i)))
{
subcat = false; // depends on control dependency: [if], data = [none]
break;
}
}
return subcat;
} } |
public class class_name {
public static double elementMinAbs( ZMatrixRMaj a ) {
final int size = a.getDataLength();
double min = Double.MAX_VALUE;
for( int i = 0; i < size; i += 2 ) {
double real = a.data[i];
double imag = a.data[i+1];
double val = real*real + imag*imag;
if( val < min ) {
min = val;
}
}
return Math.sqrt(min);
} } | public class class_name {
public static double elementMinAbs( ZMatrixRMaj a ) {
final int size = a.getDataLength();
double min = Double.MAX_VALUE;
for( int i = 0; i < size; i += 2 ) {
double real = a.data[i];
double imag = a.data[i+1];
double val = real*real + imag*imag;
if( val < min ) {
min = val; // depends on control dependency: [if], data = [none]
}
}
return Math.sqrt(min);
} } |
public class class_name {
public String createImportDeclaration(String lineDelimiter) {
StringBuilder result = new StringBuilder();
for (TypeName importName : getImports()) {
result.append(lineDelimiter + "import " + importName + ";");
}
return result.toString();
} } | public class class_name {
public String createImportDeclaration(String lineDelimiter) {
StringBuilder result = new StringBuilder();
for (TypeName importName : getImports()) {
result.append(lineDelimiter + "import " + importName + ";"); // depends on control dependency: [for], data = [importName]
}
return result.toString();
} } |
public class class_name {
private static ClassLoader getBootstrapClassLoader() {
if (BOOTSTRAP_CLASSLOADER == null) {
synchronized(ClassLoaderUtil.class) {
if (BOOTSTRAP_CLASSLOADER == null) {
ClassLoader cl = null;
if (System.getSecurityManager() != null) {
cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public BootstrapClassLoader run() {
return new BootstrapClassLoader();
}
});
} else {
cl = new BootstrapClassLoader();
}
BOOTSTRAP_CLASSLOADER = cl;
}
}
}
return BOOTSTRAP_CLASSLOADER;
} } | public class class_name {
private static ClassLoader getBootstrapClassLoader() {
if (BOOTSTRAP_CLASSLOADER == null) {
synchronized(ClassLoaderUtil.class) { // depends on control dependency: [if], data = [none]
if (BOOTSTRAP_CLASSLOADER == null) {
ClassLoader cl = null;
if (System.getSecurityManager() != null) {
cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
@Override
public BootstrapClassLoader run() {
return new BootstrapClassLoader();
}
}); // depends on control dependency: [if], data = [none]
} else {
cl = new BootstrapClassLoader(); // depends on control dependency: [if], data = [none]
}
BOOTSTRAP_CLASSLOADER = cl; // depends on control dependency: [if], data = [none]
}
}
}
return BOOTSTRAP_CLASSLOADER;
} } |
public class class_name {
public String getToolTipText(IAtom atom) {
if (toolTipTextMap.get(atom) != null) {
return toolTipTextMap.get(atom);
} else {
return null;
}
} } | public class class_name {
public String getToolTipText(IAtom atom) {
if (toolTipTextMap.get(atom) != null) {
return toolTipTextMap.get(atom); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Term getArgument(int index)
{
if ((arguments == null) || (index > (arguments.length - 1)))
{
return null;
}
else
{
return arguments[index];
}
} } | public class class_name {
public Term getArgument(int index)
{
if ((arguments == null) || (index > (arguments.length - 1)))
{
return null; // depends on control dependency: [if], data = [none]
}
else
{
return arguments[index]; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static String normalize(String dateStr) {
if (StrUtil.isBlank(dateStr)) {
return dateStr;
}
// 日期时间分开处理
final List<String> dateAndTime = StrUtil.splitTrim(dateStr, ' ');
final int size = dateAndTime.size();
if (size < 1 || size > 2) {
// 非可被标准处理的格式
return dateStr;
}
final StringBuilder builder = StrUtil.builder();
// 日期部分("\"、"/"、"."、"年"、"月"都替换为"-")
String datePart = dateAndTime.get(0).replaceAll("[\\/.年月]", "-");
datePart = StrUtil.removeSuffix(datePart, "日");
builder.append(datePart);
// 时间部分
if (size == 2) {
builder.append(' ');
String timePart = dateAndTime.get(1).replaceAll("[时分秒]", ":");
timePart = StrUtil.removeSuffix(timePart, ":");
builder.append(timePart);
}
return builder.toString();
} } | public class class_name {
private static String normalize(String dateStr) {
if (StrUtil.isBlank(dateStr)) {
return dateStr;
// depends on control dependency: [if], data = [none]
}
// 日期时间分开处理
final List<String> dateAndTime = StrUtil.splitTrim(dateStr, ' ');
final int size = dateAndTime.size();
if (size < 1 || size > 2) {
// 非可被标准处理的格式
return dateStr;
// depends on control dependency: [if], data = [none]
}
final StringBuilder builder = StrUtil.builder();
// 日期部分("\"、"/"、"."、"年"、"月"都替换为"-")
String datePart = dateAndTime.get(0).replaceAll("[\\/.年月]", "-");
datePart = StrUtil.removeSuffix(datePart, "日");
builder.append(datePart);
// 时间部分
if (size == 2) {
builder.append(' ');
// depends on control dependency: [if], data = [none]
String timePart = dateAndTime.get(1).replaceAll("[时分秒]", ":");
timePart = StrUtil.removeSuffix(timePart, ":");
// depends on control dependency: [if], data = [none]
builder.append(timePart);
// depends on control dependency: [if], data = [none]
}
return builder.toString();
} } |
public class class_name {
@Override
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
if (emptyMessage(message)) {
return message;
}
MessageHeaderAccessor headers = mutableHeaderAccessor(message);
TraceContextOrSamplingFlags extracted = this.extractor.extract(headers);
Span span = this.threadLocalSpan.next(extracted);
MessageHeaderPropagation.removeAnyTraceHeaders(headers,
this.tracing.propagation().keys());
this.injector.inject(span.context(), headers);
if (!span.isNoop()) {
span.kind(Span.Kind.CONSUMER).name("receive").start();
span.remoteServiceName(REMOTE_SERVICE_NAME);
addTags(message, span, channel);
}
if (log.isDebugEnabled()) {
log.debug("Created a new span in post receive " + span);
}
headers.setImmutable();
if (message instanceof ErrorMessage) {
ErrorMessage errorMessage = (ErrorMessage) message;
return new ErrorMessage(errorMessage.getPayload(),
headers.getMessageHeaders(), errorMessage.getOriginalMessage());
}
return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders());
} } | public class class_name {
@Override
public Message<?> postReceive(Message<?> message, MessageChannel channel) {
if (emptyMessage(message)) {
return message; // depends on control dependency: [if], data = [none]
}
MessageHeaderAccessor headers = mutableHeaderAccessor(message);
TraceContextOrSamplingFlags extracted = this.extractor.extract(headers);
Span span = this.threadLocalSpan.next(extracted);
MessageHeaderPropagation.removeAnyTraceHeaders(headers,
this.tracing.propagation().keys());
this.injector.inject(span.context(), headers);
if (!span.isNoop()) {
span.kind(Span.Kind.CONSUMER).name("receive").start(); // depends on control dependency: [if], data = [none]
span.remoteServiceName(REMOTE_SERVICE_NAME); // depends on control dependency: [if], data = [none]
addTags(message, span, channel); // depends on control dependency: [if], data = [none]
}
if (log.isDebugEnabled()) {
log.debug("Created a new span in post receive " + span); // depends on control dependency: [if], data = [none]
}
headers.setImmutable();
if (message instanceof ErrorMessage) {
ErrorMessage errorMessage = (ErrorMessage) message;
return new ErrorMessage(errorMessage.getPayload(),
headers.getMessageHeaders(), errorMessage.getOriginalMessage()); // depends on control dependency: [if], data = [none]
}
return new GenericMessage<>(message.getPayload(), headers.getMessageHeaders());
} } |
public class class_name {
private String extractOriginOrReferer(HttpExchange pExchange) {
Headers headers = pExchange.getRequestHeaders();
String origin = headers.getFirst("Origin");
if (origin == null) {
origin = headers.getFirst("Referer");
}
return origin != null ? origin.replaceAll("[\\n\\r]*","") : null;
} } | public class class_name {
private String extractOriginOrReferer(HttpExchange pExchange) {
Headers headers = pExchange.getRequestHeaders();
String origin = headers.getFirst("Origin");
if (origin == null) {
origin = headers.getFirst("Referer"); // depends on control dependency: [if], data = [none]
}
return origin != null ? origin.replaceAll("[\\n\\r]*","") : null;
} } |
public class class_name {
public void setManeuverTypeAndModifier(@NonNull String maneuverType, @Nullable String maneuverModifier) {
if (isNewTypeOrModifier(maneuverType, maneuverModifier)) {
this.maneuverType = maneuverType;
this.maneuverModifier = maneuverModifier;
if (checkManeuverTypeWithNullModifier(maneuverType)) {
return;
}
maneuverType = checkManeuverModifier(maneuverType, maneuverModifier);
maneuverTypeAndModifier = new Pair<>(maneuverType, maneuverModifier);
invalidate();
}
} } | public class class_name {
public void setManeuverTypeAndModifier(@NonNull String maneuverType, @Nullable String maneuverModifier) {
if (isNewTypeOrModifier(maneuverType, maneuverModifier)) {
this.maneuverType = maneuverType; // depends on control dependency: [if], data = [none]
this.maneuverModifier = maneuverModifier; // depends on control dependency: [if], data = [none]
if (checkManeuverTypeWithNullModifier(maneuverType)) {
return; // depends on control dependency: [if], data = [none]
}
maneuverType = checkManeuverModifier(maneuverType, maneuverModifier); // depends on control dependency: [if], data = [none]
maneuverTypeAndModifier = new Pair<>(maneuverType, maneuverModifier); // depends on control dependency: [if], data = [none]
invalidate(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(UpdateOrganizationalUnitRequest updateOrganizationalUnitRequest, ProtocolMarshaller protocolMarshaller) {
if (updateOrganizationalUnitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateOrganizationalUnitRequest.getOrganizationalUnitId(), ORGANIZATIONALUNITID_BINDING);
protocolMarshaller.marshall(updateOrganizationalUnitRequest.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateOrganizationalUnitRequest updateOrganizationalUnitRequest, ProtocolMarshaller protocolMarshaller) {
if (updateOrganizationalUnitRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateOrganizationalUnitRequest.getOrganizationalUnitId(), ORGANIZATIONALUNITID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateOrganizationalUnitRequest.getName(), NAME_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 ServletResponse createWrapper(final ServletResponseWrapper pImplementation) {
// TODO: Get all interfaces from implementation
if (pImplementation.getResponse() instanceof HttpServletResponse) {
return (HttpServletResponse) Proxy.newProxyInstance(pImplementation.getClass().getClassLoader(),
new Class[]{HttpServletResponse.class, ServletResponse.class},
new HttpServletResponseHandler(pImplementation));
}
return pImplementation;
} } | public class class_name {
public static ServletResponse createWrapper(final ServletResponseWrapper pImplementation) {
// TODO: Get all interfaces from implementation
if (pImplementation.getResponse() instanceof HttpServletResponse) {
return (HttpServletResponse) Proxy.newProxyInstance(pImplementation.getClass().getClassLoader(),
new Class[]{HttpServletResponse.class, ServletResponse.class},
new HttpServletResponseHandler(pImplementation));
// depends on control dependency: [if], data = [none]
}
return pImplementation;
} } |
public class class_name {
@UsedByGeneratedCode
public static boolean ivicheck(int ids, String nameAndDescriptor) {
// Check 1: FAST: Has anything at all been reloaded?
if (nothingReloaded) {
return false;
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.entering("TypeRegistry", "ivicheck", new Object[] { ids, nameAndDescriptor });
// }
// TODO [perf] global check (anything been reloaded?)
// TODO [perf] local check (type or anything in its hierarchy reloaded)
int registryId = ids >>> 16;
int typeId = ids & 0xffff;
TypeRegistry typeRegistry = registryInstances[registryId].get();
ReloadableType reloadableType = typeRegistry.getReloadableType(typeId);
// Ok, think about what null means here. It means this registry has not loaded this type as a reloadable type. That doesn't
// mean it isn't reloadable as a parent loaded may have found it. We have 3 options:
// 1. assume names are unique - we can look up this type and find the registry in question
// 2. assume delegating classloaders and search the parent registry for it
// 3. pass something in at the call site (the class obejct), this would give us the classloader and thus the registry
// 3 is ideal, but slower. 2 is nice but not always safe. 1 will work in a lot of situations.
// let's try with a (2) strategy, fallback on a (1) - when we revisit this we can end up doing (3) maybe...
// TODO [grails] We need a sentinel to indicate that we've had a look, so that we dont go off searching every time, but for now, lets
// just do the search:
if (reloadableType == null) {
reloadableType = searchForReloadableType(typeId, typeRegistry);
}
// Check 2: Info computed earlier
if (reloadableType != null && !reloadableType.isAffectedByReload()) {
return false;
}
if (reloadableType != null && reloadableType.hasBeenReloaded()) {
MethodMember method = reloadableType.getLiveVersion().incrementalTypeDescriptor.getFromLatestByDescriptor(
nameAndDescriptor);
boolean dispatchThroughDescriptor = false;
if (method == null) {
if (!reloadableType.getTypeDescriptor().isFinalInHierarchy(nameAndDescriptor)) {
// Reloading has occurred and method does not exist in new version, throw NSME
throw new NoSuchMethodError(reloadableType.getBaseName() + "." + nameAndDescriptor);
}
}
else if (IncrementalTypeDescriptor.isBrandNewMethod(method)) {
// Reloading has occurred and method has been added (it wasn't in the original) definetly need to use the dispatcher
dispatchThroughDescriptor = true;
}
else if (IncrementalTypeDescriptor.hasChanged(method)) {
// Reloading has occurred and the method has changed in some way
// Method has been deleted - let the catcher/new generated dispatcher deal with it
if (!IncrementalTypeDescriptor.isCatcher(method)) {
if (!IncrementalTypeDescriptor.wasDeleted(method)) {
// Don't want to call the one that was there!
dispatchThroughDescriptor = true;
}
// } else if (IncrementalTypeDescriptor.wasDeleted(method)) {
// // The method is a catcher because it used to be there, it no longer is
// dispatchThroughDescriptor = true;
}
}
if (dispatchThroughDescriptor) {
if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
log.info("versionstamp " + reloadableType.getLiveVersion().versionstamp);
log.exiting("TypeRegistry", "ivicheck", true);
}
return true;
}
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.exiting("TypeRegistry", "ivicheck", true);
// }
return false;
} } | public class class_name {
@UsedByGeneratedCode
public static boolean ivicheck(int ids, String nameAndDescriptor) {
// Check 1: FAST: Has anything at all been reloaded?
if (nothingReloaded) {
return false; // depends on control dependency: [if], data = [none]
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.entering("TypeRegistry", "ivicheck", new Object[] { ids, nameAndDescriptor });
// }
// TODO [perf] global check (anything been reloaded?)
// TODO [perf] local check (type or anything in its hierarchy reloaded)
int registryId = ids >>> 16;
int typeId = ids & 0xffff;
TypeRegistry typeRegistry = registryInstances[registryId].get();
ReloadableType reloadableType = typeRegistry.getReloadableType(typeId);
// Ok, think about what null means here. It means this registry has not loaded this type as a reloadable type. That doesn't
// mean it isn't reloadable as a parent loaded may have found it. We have 3 options:
// 1. assume names are unique - we can look up this type and find the registry in question
// 2. assume delegating classloaders and search the parent registry for it
// 3. pass something in at the call site (the class obejct), this would give us the classloader and thus the registry
// 3 is ideal, but slower. 2 is nice but not always safe. 1 will work in a lot of situations.
// let's try with a (2) strategy, fallback on a (1) - when we revisit this we can end up doing (3) maybe...
// TODO [grails] We need a sentinel to indicate that we've had a look, so that we dont go off searching every time, but for now, lets
// just do the search:
if (reloadableType == null) {
reloadableType = searchForReloadableType(typeId, typeRegistry); // depends on control dependency: [if], data = [none]
}
// Check 2: Info computed earlier
if (reloadableType != null && !reloadableType.isAffectedByReload()) {
return false; // depends on control dependency: [if], data = [none]
}
if (reloadableType != null && reloadableType.hasBeenReloaded()) {
MethodMember method = reloadableType.getLiveVersion().incrementalTypeDescriptor.getFromLatestByDescriptor(
nameAndDescriptor);
boolean dispatchThroughDescriptor = false;
if (method == null) {
if (!reloadableType.getTypeDescriptor().isFinalInHierarchy(nameAndDescriptor)) {
// Reloading has occurred and method does not exist in new version, throw NSME
throw new NoSuchMethodError(reloadableType.getBaseName() + "." + nameAndDescriptor);
}
}
else if (IncrementalTypeDescriptor.isBrandNewMethod(method)) {
// Reloading has occurred and method has been added (it wasn't in the original) definetly need to use the dispatcher
dispatchThroughDescriptor = true; // depends on control dependency: [if], data = [none]
}
else if (IncrementalTypeDescriptor.hasChanged(method)) {
// Reloading has occurred and the method has changed in some way
// Method has been deleted - let the catcher/new generated dispatcher deal with it
if (!IncrementalTypeDescriptor.isCatcher(method)) {
if (!IncrementalTypeDescriptor.wasDeleted(method)) {
// Don't want to call the one that was there!
dispatchThroughDescriptor = true; // depends on control dependency: [if], data = [none]
}
// } else if (IncrementalTypeDescriptor.wasDeleted(method)) {
// // The method is a catcher because it used to be there, it no longer is
// dispatchThroughDescriptor = true;
}
}
if (dispatchThroughDescriptor) {
if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
log.info("versionstamp " + reloadableType.getLiveVersion().versionstamp); // depends on control dependency: [if], data = [none]
log.exiting("TypeRegistry", "ivicheck", true); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
}
// if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINER)) {
// log.exiting("TypeRegistry", "ivicheck", true);
// }
return false;
} } |
public class class_name {
public Map<String, Integer> countByStatusAndMainComponentUuids(DbSession dbSession, CeQueueDto.Status status, Set<String> projectUuids) {
if (projectUuids.isEmpty()) {
return emptyMap();
}
ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
executeLargeUpdates(
projectUuids,
partitionOfProjectUuids -> {
List<QueueCount> i = mapper(dbSession).countByStatusAndMainComponentUuids(status, partitionOfProjectUuids);
i.forEach(o -> builder.put(o.getMainComponentUuid(), o.getTotal()));
});
return builder.build();
} } | public class class_name {
public Map<String, Integer> countByStatusAndMainComponentUuids(DbSession dbSession, CeQueueDto.Status status, Set<String> projectUuids) {
if (projectUuids.isEmpty()) {
return emptyMap(); // depends on control dependency: [if], data = [none]
}
ImmutableMap.Builder<String, Integer> builder = ImmutableMap.builder();
executeLargeUpdates(
projectUuids,
partitionOfProjectUuids -> {
List<QueueCount> i = mapper(dbSession).countByStatusAndMainComponentUuids(status, partitionOfProjectUuids);
i.forEach(o -> builder.put(o.getMainComponentUuid(), o.getTotal()));
});
return builder.build();
} } |
public class class_name {
public static MarkdownNotebookOutput get(Object source) {
try {
StackTraceElement callingFrame = Thread.currentThread().getStackTrace()[2];
String className = null == source ? callingFrame.getClassName() : source.getClass().getCanonicalName();
String methodName = callingFrame.getMethodName();
String fileName = methodName + ".md";
File path = new File(Util.mkString(File.separator, "reports", className.replaceAll("\\.", "/").replaceAll("\\$", "/"), fileName));
path.getParentFile().mkdirs();
return new MarkdownNotebookOutput(path, methodName);
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static MarkdownNotebookOutput get(Object source) {
try {
StackTraceElement callingFrame = Thread.currentThread().getStackTrace()[2];
String className = null == source ? callingFrame.getClassName() : source.getClass().getCanonicalName();
String methodName = callingFrame.getMethodName();
String fileName = methodName + ".md";
File path = new File(Util.mkString(File.separator, "reports", className.replaceAll("\\.", "/").replaceAll("\\$", "/"), fileName));
path.getParentFile().mkdirs(); // depends on control dependency: [try], data = [none]
return new MarkdownNotebookOutput(path, methodName); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void configPlugin(Plugins me) {
String[] dses = this.getDataSource();
for (String ds : dses) {
if (!this.getDbActiveState(ds)) {
continue;
}
DruidPlugin drp = this.getDruidPlugin(ds);
me.add(drp);
ActiveRecordPlugin arp = this.getActiveRecordPlugin(ds, drp);
me.add(arp);
}
// config ModelRedisPlugin
String[] caches = this.getRedisCaches();
for (String cache : caches) {
if (!this.getRedisActiveState(cache)) {
continue;
}
// conf redis plguin
RedisPlugin rp = null;
String redisPassword = this.getRedisPassword(cache);
if (StrKit.isBlank(redisPassword)) {
rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache));
} else {
rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache), this.getRedisPassword(cache));
}
me.add(rp);
// conf redis model plugin
ModelRedisPlugin mrp = new ModelRedisPlugin(cache, this.getRedisCacheTables(cache));
me.add(mrp);
}
// config others
configMorePlugins(me);
} } | public class class_name {
public void configPlugin(Plugins me) {
String[] dses = this.getDataSource();
for (String ds : dses) {
if (!this.getDbActiveState(ds)) {
continue;
}
DruidPlugin drp = this.getDruidPlugin(ds);
me.add(drp); // depends on control dependency: [for], data = [none]
ActiveRecordPlugin arp = this.getActiveRecordPlugin(ds, drp);
me.add(arp); // depends on control dependency: [for], data = [none]
}
// config ModelRedisPlugin
String[] caches = this.getRedisCaches();
for (String cache : caches) {
if (!this.getRedisActiveState(cache)) {
continue;
}
// conf redis plguin
RedisPlugin rp = null;
String redisPassword = this.getRedisPassword(cache);
if (StrKit.isBlank(redisPassword)) {
rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache)); // depends on control dependency: [if], data = [none]
} else {
rp = new RedisPlugin(cache, this.getRedisHost(cache), this.getRedisPort(cache), this.getRedisPassword(cache)); // depends on control dependency: [if], data = [none]
}
me.add(rp); // depends on control dependency: [for], data = [none]
// conf redis model plugin
ModelRedisPlugin mrp = new ModelRedisPlugin(cache, this.getRedisCacheTables(cache));
me.add(mrp); // depends on control dependency: [for], data = [none]
}
// config others
configMorePlugins(me);
} } |
public class class_name {
private JdbcConnectionDescriptor deepCopyOfFirstFound(String jcdAlias)
{
Iterator it = jcdMap.values().iterator();
JdbcConnectionDescriptor jcd;
while (it.hasNext())
{
jcd = (JdbcConnectionDescriptor) it.next();
if (jcdAlias.equals(jcd.getJcdAlias()))
{
return (JdbcConnectionDescriptor) SerializationUtils.clone(jcd);
}
}
return null;
} } | public class class_name {
private JdbcConnectionDescriptor deepCopyOfFirstFound(String jcdAlias)
{
Iterator it = jcdMap.values().iterator();
JdbcConnectionDescriptor jcd;
while (it.hasNext())
{
jcd = (JdbcConnectionDescriptor) it.next();
// depends on control dependency: [while], data = [none]
if (jcdAlias.equals(jcd.getJcdAlias()))
{
return (JdbcConnectionDescriptor) SerializationUtils.clone(jcd);
// depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public Result append(Append append) throws IOException {
LOG.trace("append(Append)");
Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
com.google.cloud.bigtable.data.v2.models.Row response =
clientWrapper.readModifyWriteRow(hbaseAdapter.adapt(append));
// The bigtable API will always return the mutated results. In order to maintain
// compatibility, simply return null when results were not requested.
if (append.isReturnResults()) {
return Adapters.ROW_ADAPTER.adaptResponse(response);
} else {
return null;
}
} catch (Throwable t) {
span.setStatus(Status.UNKNOWN);
throw logAndCreateIOException("append", append.getRow(), t);
} finally {
span.end();
}
} } | public class class_name {
@Override
public Result append(Append append) throws IOException {
LOG.trace("append(Append)");
Span span = TRACER.spanBuilder("BigtableTable.append").startSpan();
try (Scope scope = TRACER.withSpan(span)) {
com.google.cloud.bigtable.data.v2.models.Row response =
clientWrapper.readModifyWriteRow(hbaseAdapter.adapt(append));
// The bigtable API will always return the mutated results. In order to maintain
// compatibility, simply return null when results were not requested.
if (append.isReturnResults()) {
return Adapters.ROW_ADAPTER.adaptResponse(response); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
span.setStatus(Status.UNKNOWN);
throw logAndCreateIOException("append", append.getRow(), t);
} finally {
span.end();
}
} } |
public class class_name {
public static String open(Tag tag, AttributeValue... attrs) {
StringBuffer sb = new StringBuffer();
sb.append("<").append(tag.name());
for (AttributeValue attr : attrs) {
sb.append(" ").append(attr.toString());
}
sb.append(">");
return sb.toString();
} } | public class class_name {
public static String open(Tag tag, AttributeValue... attrs) {
StringBuffer sb = new StringBuffer();
sb.append("<").append(tag.name());
for (AttributeValue attr : attrs) {
sb.append(" ").append(attr.toString()); // depends on control dependency: [for], data = [attr]
}
sb.append(">");
return sb.toString();
} } |
public class class_name {
public void marshall(OutputArtifact outputArtifact, ProtocolMarshaller protocolMarshaller) {
if (outputArtifact == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputArtifact.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(OutputArtifact outputArtifact, ProtocolMarshaller protocolMarshaller) {
if (outputArtifact == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(outputArtifact.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final boolean start() {
if (running || booting || stopping || terminated) {
// do nothing if this instance is not stopped
return false;
} else {
// mark this instance started
booting = true;
running = true;
onStarted();
return true;
}
} } | public class class_name {
public final boolean start() {
if (running || booting || stopping || terminated) {
// do nothing if this instance is not stopped
return false; // depends on control dependency: [if], data = [none]
} else {
// mark this instance started
booting = true; // depends on control dependency: [if], data = [none]
running = true; // depends on control dependency: [if], data = [none]
onStarted(); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void fixIntegerPrecisions(ItemIdValue itemIdValue,
String propertyId) {
String qid = itemIdValue.getId();
try {
// Fetch the online version of the item to make sure we edit the
// current version:
ItemDocument currentItemDocument = (ItemDocument) dataFetcher
.getEntityDocument(qid);
if (currentItemDocument == null) {
System.out.println("*** " + qid
+ " could not be fetched. Maybe it has been deleted.");
return;
}
// Get the current statements for the property we want to fix:
StatementGroup editPropertyStatements = currentItemDocument
.findStatementGroup(propertyId);
if (editPropertyStatements == null) {
System.out.println("*** " + qid
+ " no longer has any statements for " + propertyId);
return;
}
PropertyIdValue property = Datamodel
.makeWikidataPropertyIdValue(propertyId);
List<Statement> updateStatements = new ArrayList<>();
for (Statement s : editPropertyStatements) {
QuantityValue qv = (QuantityValue) s.getValue();
if (qv != null && isPlusMinusOneValue(qv)) {
QuantityValue exactValue = Datamodel.makeQuantityValue(
qv.getNumericValue(), qv.getNumericValue(),
qv.getNumericValue());
Statement exactStatement = StatementBuilder
.forSubjectAndProperty(itemIdValue, property)
.withValue(exactValue).withId(s.getStatementId())
.withQualifiers(s.getQualifiers())
.withReferences(s.getReferences())
.withRank(s.getRank()).build();
updateStatements.add(exactStatement);
}
}
if (updateStatements.size() == 0) {
System.out.println("*** " + qid + " quantity values for "
+ propertyId + " already fixed");
return;
}
logEntityModification(currentItemDocument.getEntityId(),
updateStatements, propertyId);
dataEditor.updateStatements(currentItemDocument, updateStatements,
Collections.<Statement> emptyList(),
"Set exact values for [[Property:" + propertyId + "|"
+ propertyId + "]] integer quantities (Task MB2)");
} catch (MediaWikiApiErrorException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} } | public class class_name {
protected void fixIntegerPrecisions(ItemIdValue itemIdValue,
String propertyId) {
String qid = itemIdValue.getId();
try {
// Fetch the online version of the item to make sure we edit the
// current version:
ItemDocument currentItemDocument = (ItemDocument) dataFetcher
.getEntityDocument(qid);
if (currentItemDocument == null) {
System.out.println("*** " + qid
+ " could not be fetched. Maybe it has been deleted."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// Get the current statements for the property we want to fix:
StatementGroup editPropertyStatements = currentItemDocument
.findStatementGroup(propertyId);
if (editPropertyStatements == null) {
System.out.println("*** " + qid
+ " no longer has any statements for " + propertyId); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
PropertyIdValue property = Datamodel
.makeWikidataPropertyIdValue(propertyId);
List<Statement> updateStatements = new ArrayList<>();
for (Statement s : editPropertyStatements) {
QuantityValue qv = (QuantityValue) s.getValue();
if (qv != null && isPlusMinusOneValue(qv)) {
QuantityValue exactValue = Datamodel.makeQuantityValue(
qv.getNumericValue(), qv.getNumericValue(),
qv.getNumericValue());
Statement exactStatement = StatementBuilder
.forSubjectAndProperty(itemIdValue, property)
.withValue(exactValue).withId(s.getStatementId())
.withQualifiers(s.getQualifiers())
.withReferences(s.getReferences())
.withRank(s.getRank()).build();
updateStatements.add(exactStatement); // depends on control dependency: [if], data = [none]
}
}
if (updateStatements.size() == 0) {
System.out.println("*** " + qid + " quantity values for "
+ propertyId + " already fixed"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
logEntityModification(currentItemDocument.getEntityId(),
updateStatements, propertyId);
dataEditor.updateStatements(currentItemDocument, updateStatements,
Collections.<Statement> emptyList(),
"Set exact values for [[Property:" + propertyId + "|"
+ propertyId + "]] integer quantities (Task MB2)");
} catch (MediaWikiApiErrorException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} } |
public class class_name {
@TimerJ
public TableMetadataBuilder withPartitionKey(String... fields) {
for (String field : fields) {
partitionKey.add(new ColumnName(tableName, field));
}
return this;
} } | public class class_name {
@TimerJ
public TableMetadataBuilder withPartitionKey(String... fields) {
for (String field : fields) {
partitionKey.add(new ColumnName(tableName, field)); // depends on control dependency: [for], data = [field]
}
return this;
} } |
public class class_name {
public synchronized static void enableLogging() {
if (SplitlogLoggerFactory.state == SplitlogLoggingState.ON) {
return;
}
SplitlogLoggerFactory.messageCounter.set(0);
SplitlogLoggerFactory.state = SplitlogLoggingState.ON;
/*
* intentionally using the original logger so that this message can not
* be silenced
*/
LoggerFactory.getLogger(SplitlogLoggerFactory.class).info("Forcibly enabled Splitlog's internal logging.");
} } | public class class_name {
public synchronized static void enableLogging() {
if (SplitlogLoggerFactory.state == SplitlogLoggingState.ON) {
return; // depends on control dependency: [if], data = [none]
}
SplitlogLoggerFactory.messageCounter.set(0);
SplitlogLoggerFactory.state = SplitlogLoggingState.ON;
/*
* intentionally using the original logger so that this message can not
* be silenced
*/
LoggerFactory.getLogger(SplitlogLoggerFactory.class).info("Forcibly enabled Splitlog's internal logging.");
} } |
public class class_name {
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/revoke_oauth_access/{appName}")
@Description("Revokes Oauth access of app from argus for a particular user")
public Response removeAccess(@Context HttpServletRequest req,@PathParam("appName") String appName) {
String userName=findUserByToken(req);
if(appName.equalsIgnoreCase(applicationName))
{
authService.deleteByUserId(userName);
return Response.status(Status.OK).build();
}
else
{
throw new OAuthException(ResponseCodes.ERR_DELETING_APP, HttpResponseStatus.BAD_REQUEST);
}
} } | public class class_name {
@DELETE
@Produces(MediaType.APPLICATION_JSON)
@Path("/revoke_oauth_access/{appName}")
@Description("Revokes Oauth access of app from argus for a particular user")
public Response removeAccess(@Context HttpServletRequest req,@PathParam("appName") String appName) {
String userName=findUserByToken(req);
if(appName.equalsIgnoreCase(applicationName))
{
authService.deleteByUserId(userName); // depends on control dependency: [if], data = [none]
return Response.status(Status.OK).build(); // depends on control dependency: [if], data = [none]
}
else
{
throw new OAuthException(ResponseCodes.ERR_DELETING_APP, HttpResponseStatus.BAD_REQUEST);
}
} } |
public class class_name {
public void setLiveWebPrefix(String liveWebPrefix) {
if (liveWebPrefix == null || liveWebPrefix.isEmpty()) {
this.liveWebRedirector = null;
}
this.liveWebRedirector = new DefaultLiveWebRedirector(liveWebPrefix);
} } | public class class_name {
public void setLiveWebPrefix(String liveWebPrefix) {
if (liveWebPrefix == null || liveWebPrefix.isEmpty()) {
this.liveWebRedirector = null; // depends on control dependency: [if], data = [none]
}
this.liveWebRedirector = new DefaultLiveWebRedirector(liveWebPrefix);
} } |
public class class_name {
public static String getElementAsString(Element element) {
StringBuilder sb = new StringBuilder();
if (element.isNegated() != null && element.isNegated().booleanValue()) {
sb.append("~");
}
int masks = element.getMask().size();
if (masks > 1) {
sb.append("(");
}
int maskCounter = 0;
for (Mask mask : element.getMask()) {
// Encloses lexemes between quotes.
if (mask.getLexemeMask() != null) {
sb.append("\"").append(mask.getLexemeMask()).append("\"");
} else if (mask.getPrimitiveMask() != null) {
// Primitives are enclosed between curly brackets.
sb.append("{").append(mask.getPrimitiveMask()).append("}");
} else if (mask.getTagMask() != null) {
sb.append(getTagMaskAsString(mask.getTagMask()));
} else if (mask.getTagReference() != null) {
sb.append(getTagReferenceAsString(mask.getTagReference()));
}
if (maskCounter < masks - 1) {
sb.append("|");
}
maskCounter++;
}
if (masks > 1) {
sb.append(")");
}
return sb.toString();
} } | public class class_name {
public static String getElementAsString(Element element) {
StringBuilder sb = new StringBuilder();
if (element.isNegated() != null && element.isNegated().booleanValue()) {
sb.append("~"); // depends on control dependency: [if], data = [none]
}
int masks = element.getMask().size();
if (masks > 1) {
sb.append("("); // depends on control dependency: [if], data = [none]
}
int maskCounter = 0;
for (Mask mask : element.getMask()) {
// Encloses lexemes between quotes.
if (mask.getLexemeMask() != null) {
sb.append("\"").append(mask.getLexemeMask()).append("\""); // depends on control dependency: [if], data = [(mask.getLexemeMask()]
} else if (mask.getPrimitiveMask() != null) {
// Primitives are enclosed between curly brackets.
sb.append("{").append(mask.getPrimitiveMask()).append("}"); // depends on control dependency: [if], data = [(mask.getPrimitiveMask()]
} else if (mask.getTagMask() != null) {
sb.append(getTagMaskAsString(mask.getTagMask())); // depends on control dependency: [if], data = [(mask.getTagMask()]
} else if (mask.getTagReference() != null) {
sb.append(getTagReferenceAsString(mask.getTagReference())); // depends on control dependency: [if], data = [(mask.getTagReference()]
}
if (maskCounter < masks - 1) {
sb.append("|"); // depends on control dependency: [if], data = [none]
}
maskCounter++; // depends on control dependency: [for], data = [mask]
}
if (masks > 1) {
sb.append(")"); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} } |
public class class_name {
@Override
public void cacheResult(List<CommerceTaxMethod> commerceTaxMethods) {
for (CommerceTaxMethod commerceTaxMethod : commerceTaxMethods) {
if (entityCache.getResult(
CommerceTaxMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceTaxMethodImpl.class,
commerceTaxMethod.getPrimaryKey()) == null) {
cacheResult(commerceTaxMethod);
}
else {
commerceTaxMethod.resetOriginalValues();
}
}
} } | public class class_name {
@Override
public void cacheResult(List<CommerceTaxMethod> commerceTaxMethods) {
for (CommerceTaxMethod commerceTaxMethod : commerceTaxMethods) {
if (entityCache.getResult(
CommerceTaxMethodModelImpl.ENTITY_CACHE_ENABLED,
CommerceTaxMethodImpl.class,
commerceTaxMethod.getPrimaryKey()) == null) {
cacheResult(commerceTaxMethod); // depends on control dependency: [if], data = [none]
}
else {
commerceTaxMethod.resetOriginalValues(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private static String getSignature(MethodLiteral<?, ?> method, String[] paramNames,
String overrideName, int overrideModifiers) throws NoSourceNameException {
if (paramNames.length != method.getParameterTypes().size()) {
throw new IllegalArgumentException(
String.format("Wrong number of parameters provided for method signature, "
+ "expected %d but got %d.", method.getParameterTypes().size(), paramNames.length));
}
StringBuilder sb = new StringBuilder();
if (overrideModifiers != 0) {
sb.append(Modifier.toString(overrideModifiers)).append(" ");
}
if (method.getTypeParameters().length > 0) {
List<String> typeParameters = new ArrayList<String>();
for (TypeVariable<?> typeVariable : method.getTypeParameters()) {
typeParameters.add(getTypeVariableDefinition(typeVariable));
}
sb.append("<").append(join(", ", typeParameters)).append("> ");
}
if (!method.isConstructor()) {
sb.append(getSourceName(method.getReturnType())).append(" ");
if (overrideName != null) {
sb.append(overrideName);
} else {
sb.append(method.getName());
}
} else {
sb.append(getSourceName(method.getRawDeclaringType()));
}
sb.append("(");
// TODO(schmitt): We are not respecting varargs here.
List<String> parameters = new ArrayList<String>();
int i = 0;
for (TypeLiteral<?> parameterType : method.getParameterTypes()) {
parameters.add(
String.format("%s %s", getSourceName(parameterType), paramNames[i]));
i++;
}
sb.append(join(", ", parameters)).append(")");
if (method.getExceptionTypes().size() > 0) {
List<String> exceptions = new ArrayList<String>();
for (TypeLiteral<?> exceptionType : method.getExceptionTypes()) {
exceptions.add(getSourceName(exceptionType));
}
sb.append(" throws ").append(join(", ", exceptions));
}
return sb.toString();
} } | public class class_name {
private static String getSignature(MethodLiteral<?, ?> method, String[] paramNames,
String overrideName, int overrideModifiers) throws NoSourceNameException {
if (paramNames.length != method.getParameterTypes().size()) {
throw new IllegalArgumentException(
String.format("Wrong number of parameters provided for method signature, "
+ "expected %d but got %d.", method.getParameterTypes().size(), paramNames.length));
}
StringBuilder sb = new StringBuilder();
if (overrideModifiers != 0) {
sb.append(Modifier.toString(overrideModifiers)).append(" ");
}
if (method.getTypeParameters().length > 0) {
List<String> typeParameters = new ArrayList<String>();
for (TypeVariable<?> typeVariable : method.getTypeParameters()) {
typeParameters.add(getTypeVariableDefinition(typeVariable)); // depends on control dependency: [for], data = [typeVariable]
}
sb.append("<").append(join(", ", typeParameters)).append("> ");
}
if (!method.isConstructor()) {
sb.append(getSourceName(method.getReturnType())).append(" ");
if (overrideName != null) {
sb.append(overrideName);
} else {
sb.append(method.getName());
}
} else {
sb.append(getSourceName(method.getRawDeclaringType()));
}
sb.append("(");
// TODO(schmitt): We are not respecting varargs here.
List<String> parameters = new ArrayList<String>();
int i = 0;
for (TypeLiteral<?> parameterType : method.getParameterTypes()) {
parameters.add(
String.format("%s %s", getSourceName(parameterType), paramNames[i]));
i++;
}
sb.append(join(", ", parameters)).append(")");
if (method.getExceptionTypes().size() > 0) {
List<String> exceptions = new ArrayList<String>();
for (TypeLiteral<?> exceptionType : method.getExceptionTypes()) {
exceptions.add(getSourceName(exceptionType));
}
sb.append(" throws ").append(join(", ", exceptions));
}
return sb.toString();
} } |
public class class_name {
public T addTableColumn(final Connection _con,
final String _tableName,
final String _columnName,
final ColumnType _columnType,
final String _defaultValue,
final int _length,
final int _scale)
throws SQLException
{
// CHECKSTYLE:ON
final StringBuilder cmd = new StringBuilder();
cmd.append("alter table ").append(getTableQuote()).append(_tableName).append(getTableQuote()).append(' ')
.append("add ").append(getColumnQuote()).append(_columnName).append(getColumnQuote())
.append(' ')
.append(getWriteSQLTypeName(_columnType));
if (_length > 0) {
cmd.append("(").append(_length);
if (_scale > 0) {
cmd.append(",").append(_scale);
}
cmd.append(")");
}
if (_defaultValue != null) {
cmd.append(" default ").append(_defaultValue);
}
AbstractDatabase.LOG.debug(" ..SQL> " + cmd.toString());
final Statement stmt = _con.createStatement();
try {
stmt.execute(cmd.toString());
} finally {
stmt.close();
}
@SuppressWarnings("unchecked")
final T ret = (T) this;
return ret;
} } | public class class_name {
public T addTableColumn(final Connection _con,
final String _tableName,
final String _columnName,
final ColumnType _columnType,
final String _defaultValue,
final int _length,
final int _scale)
throws SQLException
{
// CHECKSTYLE:ON
final StringBuilder cmd = new StringBuilder();
cmd.append("alter table ").append(getTableQuote()).append(_tableName).append(getTableQuote()).append(' ')
.append("add ").append(getColumnQuote()).append(_columnName).append(getColumnQuote())
.append(' ')
.append(getWriteSQLTypeName(_columnType));
if (_length > 0) {
cmd.append("(").append(_length);
if (_scale > 0) {
cmd.append(",").append(_scale); // depends on control dependency: [if], data = [(_scale]
}
cmd.append(")");
}
if (_defaultValue != null) {
cmd.append(" default ").append(_defaultValue);
}
AbstractDatabase.LOG.debug(" ..SQL> " + cmd.toString());
final Statement stmt = _con.createStatement();
try {
stmt.execute(cmd.toString());
} finally {
stmt.close();
}
@SuppressWarnings("unchecked")
final T ret = (T) this;
return ret;
} } |
public class class_name {
public static List<CommercePriceList> toModels(
CommercePriceListSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<CommercePriceList> models = new ArrayList<CommercePriceList>(soapModels.length);
for (CommercePriceListSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
} } | public class class_name {
public static List<CommercePriceList> toModels(
CommercePriceListSoap[] soapModels) {
if (soapModels == null) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommercePriceList> models = new ArrayList<CommercePriceList>(soapModels.length);
for (CommercePriceListSoap soapModel : soapModels) {
models.add(toModel(soapModel)); // depends on control dependency: [for], data = [soapModel]
}
return models;
} } |
public class class_name {
public V remove(final int key)
{
@DoNotSub final int mask = values.length - 1;
@DoNotSub int index = Hashing.hash(key, mask);
Object value;
while (null != (value = values[index]))
{
if (key == keys[index])
{
values[index] = null;
--size;
compactChain(index);
break;
}
index = ++index & mask;
}
return unmapNullValue(value);
} } | public class class_name {
public V remove(final int key)
{
@DoNotSub final int mask = values.length - 1;
@DoNotSub int index = Hashing.hash(key, mask);
Object value;
while (null != (value = values[index]))
{
if (key == keys[index])
{
values[index] = null; // depends on control dependency: [if], data = [none]
--size; // depends on control dependency: [if], data = [none]
compactChain(index); // depends on control dependency: [if], data = [none]
break;
}
index = ++index & mask; // depends on control dependency: [while], data = [none]
}
return unmapNullValue(value);
} } |
public class class_name {
public static double distanceSq( LineSegment2D_F64 line, Point2D_F64 p ) {
double a = line.b.x - line.a.x;
double b = line.b.y - line.a.y;
double t = a * ( p.x - line.a.x ) + b * ( p.y - line.a.y );
t /= ( a * a + b * b );
// if the point of intersection is past the end points return the distance
// from the closest end point
if( t < 0 ) {
return UtilPoint2D_F64.distanceSq(line.a.x, line.a.y, p.x, p.y);
} else if( t > 1.0 )
return UtilPoint2D_F64.distanceSq(line.b.x, line.b.y, p.x, p.y);
// return the distance of the closest point on the line
return UtilPoint2D_F64.distanceSq(line.a.x + t * a, line.a.y + t * b, p.x, p.y);
} } | public class class_name {
public static double distanceSq( LineSegment2D_F64 line, Point2D_F64 p ) {
double a = line.b.x - line.a.x;
double b = line.b.y - line.a.y;
double t = a * ( p.x - line.a.x ) + b * ( p.y - line.a.y );
t /= ( a * a + b * b );
// if the point of intersection is past the end points return the distance
// from the closest end point
if( t < 0 ) {
return UtilPoint2D_F64.distanceSq(line.a.x, line.a.y, p.x, p.y); // depends on control dependency: [if], data = [none]
} else if( t > 1.0 )
return UtilPoint2D_F64.distanceSq(line.b.x, line.b.y, p.x, p.y);
// return the distance of the closest point on the line
return UtilPoint2D_F64.distanceSq(line.a.x + t * a, line.a.y + t * b, p.x, p.y);
} } |
public class class_name {
public Condition asCondition() {
Condition condition = new Condition().withComparisonOperator(operator.getComparisonOperator());
int argumentCount = operator.getArgumentCount();
if (argumentCount == 1) {
condition.withAttributeValueList(ConversionUtil.toAttributeValue(values[0]));
} else if (argumentCount == 2) {
condition.withAttributeValueList(ConversionUtil.toAttributeValue(values[0]), ConversionUtil.toAttributeValue(values[1]));
} else if (argumentCount != 0) { // N arguments
condition.setAttributeValueList(ConversionUtil.toAttributeValueList(values[0]));
}
return condition;
} } | public class class_name {
public Condition asCondition() {
Condition condition = new Condition().withComparisonOperator(operator.getComparisonOperator());
int argumentCount = operator.getArgumentCount();
if (argumentCount == 1) {
condition.withAttributeValueList(ConversionUtil.toAttributeValue(values[0])); // depends on control dependency: [if], data = [none]
} else if (argumentCount == 2) {
condition.withAttributeValueList(ConversionUtil.toAttributeValue(values[0]), ConversionUtil.toAttributeValue(values[1])); // depends on control dependency: [if], data = [none]
} else if (argumentCount != 0) { // N arguments
condition.setAttributeValueList(ConversionUtil.toAttributeValueList(values[0])); // depends on control dependency: [if], data = [none]
}
return condition;
} } |
public class class_name {
protected void mergeVariables(TaskQueryImpl extendedQuery, TaskQueryImpl extendingQuery) {
List<TaskQueryVariableValue> extendingVariables = extendingQuery.getVariables();
Set<TaskQueryVariableValueComparable> extendingVariablesComparable = new HashSet<TaskQueryVariableValueComparable>();
// set extending variables and save names for comparison of original variables
for (TaskQueryVariableValue extendingVariable : extendingVariables) {
extendedQuery.addVariable(extendingVariable);
extendingVariablesComparable.add(new TaskQueryVariableValueComparable(extendingVariable));
}
for (TaskQueryVariableValue originalVariable : this.getVariables()) {
if (!extendingVariablesComparable.contains(new TaskQueryVariableValueComparable(originalVariable))) {
extendedQuery.addVariable(originalVariable);
}
}
} } | public class class_name {
protected void mergeVariables(TaskQueryImpl extendedQuery, TaskQueryImpl extendingQuery) {
List<TaskQueryVariableValue> extendingVariables = extendingQuery.getVariables();
Set<TaskQueryVariableValueComparable> extendingVariablesComparable = new HashSet<TaskQueryVariableValueComparable>();
// set extending variables and save names for comparison of original variables
for (TaskQueryVariableValue extendingVariable : extendingVariables) {
extendedQuery.addVariable(extendingVariable); // depends on control dependency: [for], data = [extendingVariable]
extendingVariablesComparable.add(new TaskQueryVariableValueComparable(extendingVariable)); // depends on control dependency: [for], data = [extendingVariable]
}
for (TaskQueryVariableValue originalVariable : this.getVariables()) {
if (!extendingVariablesComparable.contains(new TaskQueryVariableValueComparable(originalVariable))) {
extendedQuery.addVariable(originalVariable); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public Collection<Accountable> getChildResources() {
List<Accountable> resources = new ArrayList<>();
if (delegateFieldsProducer != null) {
resources.add(
Accountables.namedAccountable("delegate", delegateFieldsProducer));
}
return Collections.unmodifiableList(resources);
} } | public class class_name {
@Override
public Collection<Accountable> getChildResources() {
List<Accountable> resources = new ArrayList<>();
if (delegateFieldsProducer != null) {
resources.add(
Accountables.namedAccountable("delegate", delegateFieldsProducer)); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableList(resources);
} } |
public class class_name {
public void writeValue (String name, Object value) {
try {
writer.name(name);
} catch (IOException ex) {
throw new JsonException(ex);
}
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} } | public class class_name {
public void writeValue (String name, Object value) {
try {
writer.name(name);
// depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new JsonException(ex);
}
// depends on control dependency: [catch], data = [none]
if (value == null)
writeValue(value, null, null);
else
writeValue(value, value.getClass(), null);
} } |
public class class_name {
@Override
public String toImplementationClassName(final String className) {
final String implementationClassName = interfaceToImplementationMap.get(className);
if (implementationClassName != null) {
return implementationClassName;
}
final int index = className.lastIndexOf('.');
if (index < 0) {
return getImplementationPackageName() + "." + className + implementationSuffix;
}
return className.substring(0, index) + "." + getImplementationPackageName() + "." + className.substring(index + 1)
+ implementationSuffix;
} } | public class class_name {
@Override
public String toImplementationClassName(final String className) {
final String implementationClassName = interfaceToImplementationMap.get(className);
if (implementationClassName != null) {
return implementationClassName; // depends on control dependency: [if], data = [none]
}
final int index = className.lastIndexOf('.');
if (index < 0) {
return getImplementationPackageName() + "." + className + implementationSuffix; // depends on control dependency: [if], data = [none]
}
return className.substring(0, index) + "." + getImplementationPackageName() + "." + className.substring(index + 1)
+ implementationSuffix;
} } |
public class class_name {
public String format(MonetaryAmount amount){
StringBuilder b = new StringBuilder();
try{
print(b, amount);
}
catch(IOException e){
throw new IllegalStateException("Formatting error.", e);
}
return b.toString();
} } | public class class_name {
public String format(MonetaryAmount amount){
StringBuilder b = new StringBuilder();
try{
print(b, amount); // depends on control dependency: [try], data = [none]
}
catch(IOException e){
throw new IllegalStateException("Formatting error.", e);
} // depends on control dependency: [catch], data = [none]
return b.toString();
} } |
public class class_name {
public EClass getIfcRampFlightType() {
if (ifcRampFlightTypeEClass == null) {
ifcRampFlightTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(424);
}
return ifcRampFlightTypeEClass;
} } | public class class_name {
public EClass getIfcRampFlightType() {
if (ifcRampFlightTypeEClass == null) {
ifcRampFlightTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(424);
// depends on control dependency: [if], data = [none]
}
return ifcRampFlightTypeEClass;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void init(SolrQueryRequest req) throws IOException {
if (config == null) {
// initialise
config = new MtasUpdateRequestProcessorConfig();
// required info
Map<String, FieldType> fieldTypes = req.getSchema().getFieldTypes();
Map<String, SchemaField> fields = req.getSchema().getFields();
SolrResourceLoader resourceLoader = req.getCore().getSolrConfig()
.getResourceLoader();
// check fieldTypes
// for (String name : fieldTypes.keySet()) {
for (Entry<String, FieldType> entry : fieldTypes.entrySet()) {
// only for MtasPreAnalyzedField
if (entry.getValue() instanceof MtasPreAnalyzedField) {
MtasPreAnalyzedField mpaf = (MtasPreAnalyzedField) entry.getValue();
config.fieldTypeDefaultConfiguration.put(entry.getKey(),
mpaf.defaultConfiguration);
config.fieldTypeConfigurationFromField.put(entry.getKey(),
mpaf.configurationFromField);
config.fieldTypeNumberOfTokensField.put(entry.getKey(),
mpaf.setNumberOfTokens);
config.fieldTypeNumberOfPositionsField.put(entry.getKey(),
mpaf.setNumberOfPositions);
config.fieldTypeSizeField.put(entry.getKey(), mpaf.setSize);
config.fieldTypeErrorField.put(entry.getKey(), mpaf.setError);
config.fieldTypePrefixField.put(entry.getKey(), mpaf.setPrefix);
config.fieldTypePrefixNumbersFieldPrefix.put(entry.getKey(), mpaf.setPrefixNumbers);
if (mpaf.followIndexAnalyzer == null
|| !fieldTypes.containsKey(mpaf.followIndexAnalyzer)) {
throw new IOException(
entry.getKey() + " can't follow " + mpaf.followIndexAnalyzer);
} else {
FieldType fieldType = fieldTypes.get(mpaf.followIndexAnalyzer);
SimpleOrderedMap<?> analyzer = null;
Object tmpObj1 = fieldType.getNamedPropertyValues(false)
.get(FieldType.INDEX_ANALYZER);
if (tmpObj1 != null && tmpObj1 instanceof SimpleOrderedMap) {
analyzer = (SimpleOrderedMap<?>) tmpObj1;
}
if (analyzer == null) {
Object tmpObj2 = fieldType.getNamedPropertyValues(false)
.get(FieldType.ANALYZER);
if (tmpObj2 != null && tmpObj2 instanceof SimpleOrderedMap) {
analyzer = (SimpleOrderedMap<?>) tmpObj2;
}
}
if (analyzer == null) {
throw new IOException("no analyzer");
} else {
// charfilters
ArrayList<SimpleOrderedMap<Object>> listCharFilters = null;
SimpleOrderedMap<Object> configTokenizer = null;
try {
listCharFilters = (ArrayList<SimpleOrderedMap<Object>>) analyzer
.findRecursive(FieldType.CHAR_FILTERS);
;
configTokenizer = (SimpleOrderedMap<Object>) analyzer
.findRecursive(FieldType.TOKENIZER);
} catch (ClassCastException e) {
throw new IOException(
"could not cast charFilters and/or tokenizer from analyzer",
e);
}
if (listCharFilters != null && !listCharFilters.isEmpty()) {
CharFilterFactory[] charFilterFactories = new CharFilterFactory[listCharFilters
.size()];
int number = 0;
for (SimpleOrderedMap<Object> configCharFilter : listCharFilters) {
String className = null;
Map<String, String> args = new HashMap<>();
Iterator<Map.Entry<String, Object>> it = configCharFilter
.iterator();
// get className and args
while (it.hasNext()) {
Map.Entry<String, Object> obj = it.next();
if (obj.getValue() instanceof String) {
if (obj.getKey().equals(FieldType.CLASS_NAME)) {
className = (String) obj.getValue();
} else {
args.put(obj.getKey(), (String) obj.getValue());
}
}
}
if (className != null) {
try {
Class<?> cls = Class.forName((String) className);
if (cls.isAssignableFrom(MtasCharFilterFactory.class)) {
Class<?>[] types = { Map.class, ResourceLoader.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args, resourceLoader);
if (cff instanceof MtasCharFilterFactory) {
charFilterFactories[number] = (MtasCharFilterFactory) cff;
number++;
} else {
throw new IOException(
className + " is no MtasCharFilterFactory");
}
} else {
Class<?>[] types = { Map.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args);
if (cff instanceof CharFilterFactory) {
charFilterFactories[number] = (CharFilterFactory) cff;
number++;
} else {
throw new IOException(
className + " is no CharFilterFactory");
}
}
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException e) {
throw new IOException(e);
}
} else {
throw new IOException("no className");
}
}
config.fieldTypeCharFilterFactories.put(entry.getKey(),
charFilterFactories);
} else {
config.fieldTypeCharFilterFactories.put(entry.getKey(), null);
}
if (configTokenizer != null) {
String className = null;
Map<String, String> args = new HashMap<>();
Iterator<Map.Entry<String, Object>> it = configTokenizer
.iterator();
// get className and args
while (it.hasNext()) {
Map.Entry<String, Object> obj = it.next();
if (obj.getValue() instanceof String) {
if (obj.getKey().equals(FieldType.CLASS_NAME)) {
className = (String) obj.getValue();
} else {
args.put(obj.getKey(), (String) obj.getValue());
}
}
}
if (className != null) {
try {
Class<?> cls = Class.forName((String) className);
Class<?>[] types = { Map.class, ResourceLoader.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args, resourceLoader);
if (cff instanceof MtasTokenizerFactory) {
config.fieldTypeTokenizerFactory.put(entry.getKey(),
(MtasTokenizerFactory) cff);
} else {
throw new IOException(
className + " is no MtasTokenizerFactory");
}
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException e) {
throw new IOException(e);
}
} else {
throw new IOException("no className");
}
}
}
}
}
}
for (Entry<String, SchemaField> entry : fields.entrySet()) {
if (entry.getValue().getType() != null
&& config.fieldTypeTokenizerFactory
.containsKey(entry.getValue().getType().getTypeName())) {
config.fieldMapping.put(entry.getKey(),
entry.getValue().getType().getTypeName());
}
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void init(SolrQueryRequest req) throws IOException {
if (config == null) {
// initialise
config = new MtasUpdateRequestProcessorConfig();
// required info
Map<String, FieldType> fieldTypes = req.getSchema().getFieldTypes();
Map<String, SchemaField> fields = req.getSchema().getFields();
SolrResourceLoader resourceLoader = req.getCore().getSolrConfig()
.getResourceLoader();
// check fieldTypes
// for (String name : fieldTypes.keySet()) {
for (Entry<String, FieldType> entry : fieldTypes.entrySet()) {
// only for MtasPreAnalyzedField
if (entry.getValue() instanceof MtasPreAnalyzedField) {
MtasPreAnalyzedField mpaf = (MtasPreAnalyzedField) entry.getValue();
config.fieldTypeDefaultConfiguration.put(entry.getKey(),
mpaf.defaultConfiguration);
config.fieldTypeConfigurationFromField.put(entry.getKey(),
mpaf.configurationFromField);
config.fieldTypeNumberOfTokensField.put(entry.getKey(),
mpaf.setNumberOfTokens);
config.fieldTypeNumberOfPositionsField.put(entry.getKey(),
mpaf.setNumberOfPositions);
config.fieldTypeSizeField.put(entry.getKey(), mpaf.setSize);
config.fieldTypeErrorField.put(entry.getKey(), mpaf.setError);
config.fieldTypePrefixField.put(entry.getKey(), mpaf.setPrefix);
config.fieldTypePrefixNumbersFieldPrefix.put(entry.getKey(), mpaf.setPrefixNumbers);
if (mpaf.followIndexAnalyzer == null
|| !fieldTypes.containsKey(mpaf.followIndexAnalyzer)) {
throw new IOException(
entry.getKey() + " can't follow " + mpaf.followIndexAnalyzer);
} else {
FieldType fieldType = fieldTypes.get(mpaf.followIndexAnalyzer);
SimpleOrderedMap<?> analyzer = null;
Object tmpObj1 = fieldType.getNamedPropertyValues(false)
.get(FieldType.INDEX_ANALYZER);
if (tmpObj1 != null && tmpObj1 instanceof SimpleOrderedMap) {
analyzer = (SimpleOrderedMap<?>) tmpObj1; // depends on control dependency: [if], data = [none]
}
if (analyzer == null) {
Object tmpObj2 = fieldType.getNamedPropertyValues(false)
.get(FieldType.ANALYZER);
if (tmpObj2 != null && tmpObj2 instanceof SimpleOrderedMap) {
analyzer = (SimpleOrderedMap<?>) tmpObj2; // depends on control dependency: [if], data = [none]
}
}
if (analyzer == null) {
throw new IOException("no analyzer");
} else {
// charfilters
ArrayList<SimpleOrderedMap<Object>> listCharFilters = null;
SimpleOrderedMap<Object> configTokenizer = null;
try {
listCharFilters = (ArrayList<SimpleOrderedMap<Object>>) analyzer
.findRecursive(FieldType.CHAR_FILTERS); // depends on control dependency: [try], data = [none]
;
configTokenizer = (SimpleOrderedMap<Object>) analyzer
.findRecursive(FieldType.TOKENIZER); // depends on control dependency: [try], data = [none]
} catch (ClassCastException e) {
throw new IOException(
"could not cast charFilters and/or tokenizer from analyzer",
e);
} // depends on control dependency: [catch], data = [none]
if (listCharFilters != null && !listCharFilters.isEmpty()) {
CharFilterFactory[] charFilterFactories = new CharFilterFactory[listCharFilters
.size()];
int number = 0;
for (SimpleOrderedMap<Object> configCharFilter : listCharFilters) {
String className = null;
Map<String, String> args = new HashMap<>();
Iterator<Map.Entry<String, Object>> it = configCharFilter
.iterator();
// get className and args
while (it.hasNext()) {
Map.Entry<String, Object> obj = it.next();
if (obj.getValue() instanceof String) {
if (obj.getKey().equals(FieldType.CLASS_NAME)) {
className = (String) obj.getValue(); // depends on control dependency: [if], data = [none]
} else {
args.put(obj.getKey(), (String) obj.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
if (className != null) {
try {
Class<?> cls = Class.forName((String) className);
if (cls.isAssignableFrom(MtasCharFilterFactory.class)) {
Class<?>[] types = { Map.class, ResourceLoader.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args, resourceLoader);
if (cff instanceof MtasCharFilterFactory) {
charFilterFactories[number] = (MtasCharFilterFactory) cff;
number++;
} else {
throw new IOException(
className + " is no MtasCharFilterFactory");
}
} else { // depends on control dependency: [if], data = [none]
Class<?>[] types = { Map.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args);
if (cff instanceof CharFilterFactory) {
charFilterFactories[number] = (CharFilterFactory) cff; // depends on control dependency: [if], data = [none]
number++; // depends on control dependency: [if], data = [none]
} else {
throw new IOException(
className + " is no CharFilterFactory");
}
}
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException e) {
throw new IOException(e);
}
} else {
throw new IOException("no className");
}
}
config.fieldTypeCharFilterFactories.put(entry.getKey(),
charFilterFactories); // depends on control dependency: [if], data = [none]
} else {
config.fieldTypeCharFilterFactories.put(entry.getKey(), null); // depends on control dependency: [if], data = [none]
}
if (configTokenizer != null) {
String className = null;
Map<String, String> args = new HashMap<>();
Iterator<Map.Entry<String, Object>> it = configTokenizer
.iterator();
// get className and args
while (it.hasNext()) {
Map.Entry<String, Object> obj = it.next();
if (obj.getValue() instanceof String) {
if (obj.getKey().equals(FieldType.CLASS_NAME)) {
className = (String) obj.getValue(); // depends on control dependency: [if], data = [none]
} else {
args.put(obj.getKey(), (String) obj.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
if (className != null) {
try {
Class<?> cls = Class.forName((String) className);
Class<?>[] types = { Map.class, ResourceLoader.class };
Constructor<?> cnstr = cls.getConstructor(types);
Object cff = cnstr.newInstance(args, resourceLoader);
if (cff instanceof MtasTokenizerFactory) {
config.fieldTypeTokenizerFactory.put(entry.getKey(),
(MtasTokenizerFactory) cff);
} else {
throw new IOException(
className + " is no MtasTokenizerFactory");
}
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException e) {
throw new IOException(e);
}
} else {
throw new IOException("no className");
}
}
}
}
}
}
for (Entry<String, SchemaField> entry : fields.entrySet()) {
if (entry.getValue().getType() != null
&& config.fieldTypeTokenizerFactory
.containsKey(entry.getValue().getType().getTypeName())) {
config.fieldMapping.put(entry.getKey(),
entry.getValue().getType().getTypeName()); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static boolean isIndex(Nanopub np) {
for (Statement st : np.getPubinfo()) {
if (!st.getSubject().equals(np.getUri())) continue;
if (!st.getPredicate().equals(RDF.TYPE)) continue;
if (!st.getObject().equals(NanopubIndex.NANOPUB_INDEX_URI)) continue;
return true;
}
return false;
} } | public class class_name {
public static boolean isIndex(Nanopub np) {
for (Statement st : np.getPubinfo()) {
if (!st.getSubject().equals(np.getUri())) continue;
if (!st.getPredicate().equals(RDF.TYPE)) continue;
if (!st.getObject().equals(NanopubIndex.NANOPUB_INDEX_URI)) continue;
return true; // depends on control dependency: [for], data = [none]
}
return false;
} } |
public class class_name {
public JSONArray getKeywordsJsonArray() {
JSONArray keywordArray = new JSONArray();
for (String keyword : keywords_) {
keywordArray.put(keyword);
}
return keywordArray;
} } | public class class_name {
public JSONArray getKeywordsJsonArray() {
JSONArray keywordArray = new JSONArray();
for (String keyword : keywords_) {
keywordArray.put(keyword); // depends on control dependency: [for], data = [keyword]
}
return keywordArray;
} } |
public class class_name {
public final EObject entryRuleXtendEnumLiteral() throws RecognitionException {
EObject current = null;
EObject iv_ruleXtendEnumLiteral = null;
try {
// InternalSARL.g:7404:57: (iv_ruleXtendEnumLiteral= ruleXtendEnumLiteral EOF )
// InternalSARL.g:7405:2: iv_ruleXtendEnumLiteral= ruleXtendEnumLiteral EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXtendEnumLiteralRule());
}
pushFollow(FOLLOW_1);
iv_ruleXtendEnumLiteral=ruleXtendEnumLiteral();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleXtendEnumLiteral;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject entryRuleXtendEnumLiteral() throws RecognitionException {
EObject current = null;
EObject iv_ruleXtendEnumLiteral = null;
try {
// InternalSARL.g:7404:57: (iv_ruleXtendEnumLiteral= ruleXtendEnumLiteral EOF )
// InternalSARL.g:7405:2: iv_ruleXtendEnumLiteral= ruleXtendEnumLiteral EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXtendEnumLiteralRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleXtendEnumLiteral=ruleXtendEnumLiteral();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleXtendEnumLiteral; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
protected final String escapeSlow(String s, int index) {
int end = s.length();
// Get a destination buffer and setup some loop variables.
char[] dest = DEST_TL.get();
int destIndex = 0;
int unescapedChunkStart = 0;
while (index < end) {
int cp = codePointAt(s, index, end);
if (cp < 0) {
throw new IllegalArgumentException(
"Trailing high surrogate at end of input");
}
char[] escaped = escape(cp);
if (escaped != null) {
int charsSkipped = index - unescapedChunkStart;
// This is the size needed to add the replacement, not the full
// size needed by the string. We only regrow when we absolutely must.
int sizeNeeded = destIndex + charsSkipped + escaped.length;
if (dest.length < sizeNeeded) {
int destLength = sizeNeeded + (end - index) + DEST_PAD;
dest = growBuffer(dest, destIndex, destLength);
}
// If we have skipped any characters, we need to copy them now.
if (charsSkipped > 0) {
s.getChars(unescapedChunkStart, index, dest, destIndex);
destIndex += charsSkipped;
}
if (escaped.length > 0) {
System.arraycopy(escaped, 0, dest, destIndex, escaped.length);
destIndex += escaped.length;
}
}
unescapedChunkStart
= index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1);
index = nextEscapeIndex(s, unescapedChunkStart, end);
}
// Process trailing unescaped characters - no need to account for escaped
// length or padding the allocation.
int charsSkipped = end - unescapedChunkStart;
if (charsSkipped > 0) {
int endIndex = destIndex + charsSkipped;
if (dest.length < endIndex) {
dest = growBuffer(dest, destIndex, endIndex);
}
s.getChars(unescapedChunkStart, end, dest, destIndex);
destIndex = endIndex;
}
return new String(dest, 0, destIndex);
} } | public class class_name {
protected final String escapeSlow(String s, int index) {
int end = s.length();
// Get a destination buffer and setup some loop variables.
char[] dest = DEST_TL.get();
int destIndex = 0;
int unescapedChunkStart = 0;
while (index < end) {
int cp = codePointAt(s, index, end);
if (cp < 0) {
throw new IllegalArgumentException(
"Trailing high surrogate at end of input");
}
char[] escaped = escape(cp);
if (escaped != null) {
int charsSkipped = index - unescapedChunkStart;
// This is the size needed to add the replacement, not the full
// size needed by the string. We only regrow when we absolutely must.
int sizeNeeded = destIndex + charsSkipped + escaped.length;
if (dest.length < sizeNeeded) {
int destLength = sizeNeeded + (end - index) + DEST_PAD;
dest = growBuffer(dest, destIndex, destLength); // depends on control dependency: [if], data = [none]
}
// If we have skipped any characters, we need to copy them now.
if (charsSkipped > 0) {
s.getChars(unescapedChunkStart, index, dest, destIndex); // depends on control dependency: [if], data = [none]
destIndex += charsSkipped; // depends on control dependency: [if], data = [none]
}
if (escaped.length > 0) {
System.arraycopy(escaped, 0, dest, destIndex, escaped.length); // depends on control dependency: [if], data = [none]
destIndex += escaped.length; // depends on control dependency: [if], data = [none]
}
}
unescapedChunkStart
= index + (Character.isSupplementaryCodePoint(cp) ? 2 : 1); // depends on control dependency: [while], data = [none]
index = nextEscapeIndex(s, unescapedChunkStart, end); // depends on control dependency: [while], data = [end)]
}
// Process trailing unescaped characters - no need to account for escaped
// length or padding the allocation.
int charsSkipped = end - unescapedChunkStart;
if (charsSkipped > 0) {
int endIndex = destIndex + charsSkipped;
if (dest.length < endIndex) {
dest = growBuffer(dest, destIndex, endIndex); // depends on control dependency: [if], data = [endIndex)]
}
s.getChars(unescapedChunkStart, end, dest, destIndex); // depends on control dependency: [if], data = [none]
destIndex = endIndex; // depends on control dependency: [if], data = [none]
}
return new String(dest, 0, destIndex);
} } |
public class class_name {
public boolean findCoordElementNoForce(double wantLat, double wantLon, int[] rectIndex) {
findBounds();
if (wantLat < latMinMax.min) return false;
if (wantLat > latMinMax.max) return false;
if (wantLon < lonMinMax.min) return false;
if (wantLon > lonMinMax.max) return false;
double gradientLat = (latMinMax.max - latMinMax.min) / nrows;
double gradientLon = (lonMinMax.max - lonMinMax.min) / ncols;
double diffLat = wantLat - latMinMax.min;
double diffLon = wantLon - lonMinMax.min;
// initial guess
rectIndex[0] = (int) Math.round(diffLat / gradientLat); // row
rectIndex[1] =(int) Math.round(diffLon / gradientLon); // col
int count = 0;
while (true) {
count++;
if (debug) System.out.printf("%nIteration %d %n", count);
if (contains(wantLat, wantLon, rectIndex))
return true;
if (!jump2(wantLat, wantLon, rectIndex)) return false;
// bouncing around
if (count > 10) {
// last ditch attempt
return incr(wantLat, wantLon, rectIndex);
//if (!ok)
// log.error("findCoordElement didnt converge lat,lon = "+wantLat+" "+ wantLon);
//return ok;
}
}
} } | public class class_name {
public boolean findCoordElementNoForce(double wantLat, double wantLon, int[] rectIndex) {
findBounds();
if (wantLat < latMinMax.min) return false;
if (wantLat > latMinMax.max) return false;
if (wantLon < lonMinMax.min) return false;
if (wantLon > lonMinMax.max) return false;
double gradientLat = (latMinMax.max - latMinMax.min) / nrows;
double gradientLon = (lonMinMax.max - lonMinMax.min) / ncols;
double diffLat = wantLat - latMinMax.min;
double diffLon = wantLon - lonMinMax.min;
// initial guess
rectIndex[0] = (int) Math.round(diffLat / gradientLat); // row
rectIndex[1] =(int) Math.round(diffLon / gradientLon); // col
int count = 0;
while (true) {
count++;
// depends on control dependency: [while], data = [none]
if (debug) System.out.printf("%nIteration %d %n", count);
if (contains(wantLat, wantLon, rectIndex))
return true;
if (!jump2(wantLat, wantLon, rectIndex)) return false;
// bouncing around
if (count > 10) {
// last ditch attempt
return incr(wantLat, wantLon, rectIndex);
// depends on control dependency: [if], data = [none]
//if (!ok)
// log.error("findCoordElement didnt converge lat,lon = "+wantLat+" "+ wantLon);
//return ok;
}
}
} } |
public class class_name {
public static void merge(List<PathDetail> pathDetails, List<PathDetail> otherDetails) {
// Make sure that the PathDetail list is merged correctly at via points
if (!pathDetails.isEmpty() && !otherDetails.isEmpty()) {
PathDetail lastDetail = pathDetails.get(pathDetails.size() - 1);
if (lastDetail.getValue().equals(otherDetails.get(0).getValue())) {
lastDetail.setLast(otherDetails.get(0).getLast());
otherDetails.remove(0);
}
}
pathDetails.addAll(otherDetails);
} } | public class class_name {
public static void merge(List<PathDetail> pathDetails, List<PathDetail> otherDetails) {
// Make sure that the PathDetail list is merged correctly at via points
if (!pathDetails.isEmpty() && !otherDetails.isEmpty()) {
PathDetail lastDetail = pathDetails.get(pathDetails.size() - 1);
if (lastDetail.getValue().equals(otherDetails.get(0).getValue())) {
lastDetail.setLast(otherDetails.get(0).getLast()); // depends on control dependency: [if], data = [none]
otherDetails.remove(0); // depends on control dependency: [if], data = [none]
}
}
pathDetails.addAll(otherDetails);
} } |
public class class_name {
public void setHeader (File header)
{
try {
_header = StreamUtil.toString(new FileReader(header));
} catch (IOException ioe) {
System.err.println("Unabled to load header '" + header + ": " +
ioe.getMessage());
}
} } | public class class_name {
public void setHeader (File header)
{
try {
_header = StreamUtil.toString(new FileReader(header)); // depends on control dependency: [try], data = [none]
} catch (IOException ioe) {
System.err.println("Unabled to load header '" + header + ": " +
ioe.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private HashMap<String, List<Validator>> getParamConverters(
final CompositeIndex index, final ClassLoader classLoader,
Set<String> knownProviderClasses, boolean isFromUnitTest) {
HashMap<String, List<Validator>> paramConverterMap = new HashMap<>();
List<Validator> converterProviderList = new ArrayList<>();
paramConverterMap.put(Object.class.getName(), converterProviderList);
Set<ClassInfo> paramConverterSet = new HashSet<ClassInfo>();
if(isFromUnitTest) {
Indexer indexer = new Indexer();
for (String className : knownProviderClasses) {
try {
String pathName = className.replace(".", File.separator);
InputStream stream = classLoader.getResourceAsStream(
pathName + ".class");
indexer.index(stream);
stream.close();
} catch (IOException e) {
JAXRS_LOGGER.classIntrospectionFailure(e.getClass().getName(),
e.getMessage());
}
}
List<ClassInfo> paramConverterList =
indexer.complete().getKnownDirectImplementors(PARAM_CONVERTER_DOTNAME);
List<ClassInfo> paramConverterProviderList =
indexer.complete().getKnownDirectImplementors(PARAM_CONVERTER_PROVIDER_DOTNAME);
paramConverterSet.addAll(paramConverterList);
paramConverterSet.addAll(paramConverterProviderList);
} else {
for (String clazzName : knownProviderClasses) {
ClassInfo classInfo = index.getClassByName(DotName.createSimple(clazzName));
if (classInfo != null) {
List<DotName> intfNamesList = classInfo.interfaceNames();
for (DotName dotName : intfNamesList) {
if (dotName.compareTo(PARAM_CONVERTER_DOTNAME) == 0
|| dotName.compareTo(PARAM_CONVERTER_PROVIDER_DOTNAME) == 0) {
paramConverterSet.add(classInfo);
break;
}
}
}
}
}
for (ClassInfo classInfo : paramConverterSet) {
Class<?> clazz = null;
Method method = null;
try {
String clazzName = classInfo.name().toString();
if (clazzName.endsWith("$1")) {
clazzName = clazzName.substring(0, clazzName.length()-2);
}
clazz = classLoader.loadClass(clazzName);
Constructor<?> ctor = clazz.getConstructor();
Object object = ctor.newInstance();
List<AnnotationInstance> lazyLoadAnnotations =classInfo
.annotations().get(PARAM_CONVERTER_LAZY_DOTNAME);
if (object instanceof ParamConverterProvider) {
ParamConverterProvider pcpObj = (ParamConverterProvider) object;
method = pcpObj.getClass().getMethod(
"getConverter",
Class.class,
Type.class,
Annotation[].class);
converterProviderList.add(new ConverterProvider(pcpObj, method, lazyLoadAnnotations));
}
if (object instanceof ParamConverter) {
ParamConverter pc = (ParamConverter) object;
method = getFromStringMethod(pc.getClass());
Class<?> returnClazz = method.getReturnType();
List<Validator> verifiers = paramConverterMap.get(returnClazz.getName());
PConverter pConverter = new PConverter(pc, method, lazyLoadAnnotations);
if (verifiers == null){
List<Validator> vList = new ArrayList<>();
vList.add(pConverter);
paramConverterMap.put(returnClazz.getName(), vList);
} else {
verifiers.add(pConverter);
}
}
} catch(NoSuchMethodException nsne) {
JAXRS_LOGGER.classIntrospectionFailure(nsne.getClass().getName(),
nsne.getMessage());
} catch (Exception e) {
JAXRS_LOGGER.classIntrospectionFailure(e.getClass().getName(),
e.getMessage());
}
}
return paramConverterMap;
} } | public class class_name {
private HashMap<String, List<Validator>> getParamConverters(
final CompositeIndex index, final ClassLoader classLoader,
Set<String> knownProviderClasses, boolean isFromUnitTest) {
HashMap<String, List<Validator>> paramConverterMap = new HashMap<>();
List<Validator> converterProviderList = new ArrayList<>();
paramConverterMap.put(Object.class.getName(), converterProviderList);
Set<ClassInfo> paramConverterSet = new HashSet<ClassInfo>();
if(isFromUnitTest) {
Indexer indexer = new Indexer();
for (String className : knownProviderClasses) {
try {
String pathName = className.replace(".", File.separator);
InputStream stream = classLoader.getResourceAsStream(
pathName + ".class");
indexer.index(stream); // depends on control dependency: [try], data = [none]
stream.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
JAXRS_LOGGER.classIntrospectionFailure(e.getClass().getName(),
e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
List<ClassInfo> paramConverterList =
indexer.complete().getKnownDirectImplementors(PARAM_CONVERTER_DOTNAME);
List<ClassInfo> paramConverterProviderList =
indexer.complete().getKnownDirectImplementors(PARAM_CONVERTER_PROVIDER_DOTNAME);
paramConverterSet.addAll(paramConverterList); // depends on control dependency: [if], data = [none]
paramConverterSet.addAll(paramConverterProviderList); // depends on control dependency: [if], data = [none]
} else {
for (String clazzName : knownProviderClasses) {
ClassInfo classInfo = index.getClassByName(DotName.createSimple(clazzName));
if (classInfo != null) {
List<DotName> intfNamesList = classInfo.interfaceNames();
for (DotName dotName : intfNamesList) {
if (dotName.compareTo(PARAM_CONVERTER_DOTNAME) == 0
|| dotName.compareTo(PARAM_CONVERTER_PROVIDER_DOTNAME) == 0) {
paramConverterSet.add(classInfo); // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
for (ClassInfo classInfo : paramConverterSet) {
Class<?> clazz = null; // depends on control dependency: [for], data = [none]
Method method = null;
try {
String clazzName = classInfo.name().toString();
if (clazzName.endsWith("$1")) {
clazzName = clazzName.substring(0, clazzName.length()-2); // depends on control dependency: [if], data = [none]
}
clazz = classLoader.loadClass(clazzName); // depends on control dependency: [try], data = [none]
Constructor<?> ctor = clazz.getConstructor();
Object object = ctor.newInstance();
List<AnnotationInstance> lazyLoadAnnotations =classInfo
.annotations().get(PARAM_CONVERTER_LAZY_DOTNAME);
if (object instanceof ParamConverterProvider) {
ParamConverterProvider pcpObj = (ParamConverterProvider) object;
method = pcpObj.getClass().getMethod(
"getConverter",
Class.class,
Type.class,
Annotation[].class); // depends on control dependency: [if], data = [none]
converterProviderList.add(new ConverterProvider(pcpObj, method, lazyLoadAnnotations)); // depends on control dependency: [if], data = [none]
}
if (object instanceof ParamConverter) {
ParamConverter pc = (ParamConverter) object;
method = getFromStringMethod(pc.getClass()); // depends on control dependency: [if], data = [none]
Class<?> returnClazz = method.getReturnType();
List<Validator> verifiers = paramConverterMap.get(returnClazz.getName());
PConverter pConverter = new PConverter(pc, method, lazyLoadAnnotations);
if (verifiers == null){
List<Validator> vList = new ArrayList<>();
vList.add(pConverter);
paramConverterMap.put(returnClazz.getName(), vList);
} else { // depends on control dependency: [if], data = [none]
verifiers.add(pConverter);
}
}
} catch(NoSuchMethodException nsne) {
JAXRS_LOGGER.classIntrospectionFailure(nsne.getClass().getName(),
nsne.getMessage());
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
JAXRS_LOGGER.classIntrospectionFailure(e.getClass().getName(),
e.getMessage());
} // depends on control dependency: [catch], data = [none]
}
return paramConverterMap;
} } |
public class class_name {
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
final MethodDeclaration method)
{
SqlFragment[] fragments = statement.getChildren();
for (SqlFragment fragment : fragments) {
// if the fragment is a container check all of its children.
if (fragment instanceof SqlFragmentContainer) {
doCheck((SqlFragmentContainer) fragment, paramMap, method);
// reflection fragment - make sure it can be mapped using the method's param values.
} else if (fragment instanceof ReflectionFragment) {
checkReflectionFragment((ReflectionFragment) fragment, paramMap, method);
}
}
} } | public class class_name {
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
final MethodDeclaration method)
{
SqlFragment[] fragments = statement.getChildren();
for (SqlFragment fragment : fragments) {
// if the fragment is a container check all of its children.
if (fragment instanceof SqlFragmentContainer) {
doCheck((SqlFragmentContainer) fragment, paramMap, method); // depends on control dependency: [if], data = [none]
// reflection fragment - make sure it can be mapped using the method's param values.
} else if (fragment instanceof ReflectionFragment) {
checkReflectionFragment((ReflectionFragment) fragment, paramMap, method); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void resize() {
double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (size > 0) {
pane.setMaxSize(size, size);
pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));
chartCanvas.setWidth(size);
chartCanvas.setHeight(size);
overlayCanvas.setWidth(size);
overlayCanvas.setHeight(size);
redraw();
}
} } | public class class_name {
private void resize() {
double width = getWidth() - getInsets().getLeft() - getInsets().getRight();
double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
if (size > 0) {
pane.setMaxSize(size, size); // depends on control dependency: [if], data = [(size]
pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5); // depends on control dependency: [if], data = [none]
pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY))); // depends on control dependency: [if], data = [none]
chartCanvas.setWidth(size); // depends on control dependency: [if], data = [(size]
chartCanvas.setHeight(size); // depends on control dependency: [if], data = [(size]
overlayCanvas.setWidth(size); // depends on control dependency: [if], data = [(size]
overlayCanvas.setHeight(size); // depends on control dependency: [if], data = [(size]
redraw(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAdditionalStagingLabelsToDownload(java.util.Collection<String> additionalStagingLabelsToDownload) {
if (additionalStagingLabelsToDownload == null) {
this.additionalStagingLabelsToDownload = null;
return;
}
this.additionalStagingLabelsToDownload = new java.util.ArrayList<String>(additionalStagingLabelsToDownload);
} } | public class class_name {
public void setAdditionalStagingLabelsToDownload(java.util.Collection<String> additionalStagingLabelsToDownload) {
if (additionalStagingLabelsToDownload == null) {
this.additionalStagingLabelsToDownload = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.additionalStagingLabelsToDownload = new java.util.ArrayList<String>(additionalStagingLabelsToDownload);
} } |
public class class_name {
public DBEngineVersion withSupportedTimezones(Timezone... supportedTimezones) {
if (this.supportedTimezones == null) {
setSupportedTimezones(new java.util.ArrayList<Timezone>(supportedTimezones.length));
}
for (Timezone ele : supportedTimezones) {
this.supportedTimezones.add(ele);
}
return this;
} } | public class class_name {
public DBEngineVersion withSupportedTimezones(Timezone... supportedTimezones) {
if (this.supportedTimezones == null) {
setSupportedTimezones(new java.util.ArrayList<Timezone>(supportedTimezones.length)); // depends on control dependency: [if], data = [none]
}
for (Timezone ele : supportedTimezones) {
this.supportedTimezones.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private void broadcast(ImmutableMember update) {
for (SwimMember member : members.values()) {
if (!localMember.id().equals(member.id())) {
unicast(member, update);
}
}
} } | public class class_name {
private void broadcast(ImmutableMember update) {
for (SwimMember member : members.values()) {
if (!localMember.id().equals(member.id())) {
unicast(member, update); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void merge(RunResults runResults) {
for (RootMethodRunResult srcResult : runResults.rootMethodRunResults) {
if (getRunResultByRootMethodKey(srcResult.getRootMethodKey()) != null) {
throw new RuntimeException(String.format(
"not supported: root method %s is called multi times", srcResult.getRootMethodKey()));
}
addRootMethodRunResults(srcResult);
}
} } | public class class_name {
public void merge(RunResults runResults) {
for (RootMethodRunResult srcResult : runResults.rootMethodRunResults) {
if (getRunResultByRootMethodKey(srcResult.getRootMethodKey()) != null) {
throw new RuntimeException(String.format(
"not supported: root method %s is called multi times", srcResult.getRootMethodKey()));
}
addRootMethodRunResults(srcResult); // depends on control dependency: [for], data = [srcResult]
}
} } |
public class class_name {
public Map<String, CellStyle> getCellStylePool() {
if (null == this.cellStylePool) {
this.cellStylePool = new HashMap<String, CellStyle>(16);
}
return this.cellStylePool;
} } | public class class_name {
public Map<String, CellStyle> getCellStylePool() {
if (null == this.cellStylePool) {
this.cellStylePool = new HashMap<String, CellStyle>(16); // depends on control dependency: [if], data = [none]
}
return this.cellStylePool;
} } |
public class class_name {
public void setProfileProxy(int profile, @Nullable BluetoothProfile proxy) {
isOverridingProxyBehavior = true;
if (proxy != null) {
profileProxies.put(profile, proxy);
}
} } | public class class_name {
public void setProfileProxy(int profile, @Nullable BluetoothProfile proxy) {
isOverridingProxyBehavior = true;
if (proxy != null) {
profileProxies.put(profile, proxy); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.