code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
protected WireFeed parseChannel(final Element rssRoot, final Locale locale) {
final Channel channel = new Channel(getType());
channel.setStyleSheet(getStyleSheet(rssRoot.getDocument()));
final Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
final Element title = eChannel.getChild("title", getRSSNamespace());
if (title != null) {
channel.setTitle(title.getText());
}
final Element link = eChannel.getChild("link", getRSSNamespace());
if (link != null) {
channel.setLink(link.getText());
}
final Element description = eChannel.getChild("description", getRSSNamespace());
if (description != null) {
channel.setDescription(description.getText());
}
channel.setImage(parseImage(rssRoot));
channel.setTextInput(parseTextInput(rssRoot));
// Unfortunately Microsoft's SSE extension has a special case of effectively putting the
// sharing channel module inside the RSS tag and not inside the channel itself. So we also
// need to look for channel modules from the root RSS element.
final List<Module> allFeedModules = new ArrayList<Module>();
final List<Module> rootModules = parseFeedModules(rssRoot, locale);
final List<Module> channelModules = parseFeedModules(eChannel, locale);
if (rootModules != null) {
allFeedModules.addAll(rootModules);
}
if (channelModules != null) {
allFeedModules.addAll(channelModules);
}
channel.setModules(allFeedModules);
channel.setItems(parseItems(rssRoot, locale));
final List<Element> foreignMarkup = extractForeignMarkup(eChannel, channel, getRSSNamespace());
if (!foreignMarkup.isEmpty()) {
channel.setForeignMarkup(foreignMarkup);
}
return channel;
} } | public class class_name {
protected WireFeed parseChannel(final Element rssRoot, final Locale locale) {
final Channel channel = new Channel(getType());
channel.setStyleSheet(getStyleSheet(rssRoot.getDocument()));
final Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
final Element title = eChannel.getChild("title", getRSSNamespace());
if (title != null) {
channel.setTitle(title.getText()); // depends on control dependency: [if], data = [(title]
}
final Element link = eChannel.getChild("link", getRSSNamespace());
if (link != null) {
channel.setLink(link.getText()); // depends on control dependency: [if], data = [(link]
}
final Element description = eChannel.getChild("description", getRSSNamespace());
if (description != null) {
channel.setDescription(description.getText()); // depends on control dependency: [if], data = [(description]
}
channel.setImage(parseImage(rssRoot));
channel.setTextInput(parseTextInput(rssRoot));
// Unfortunately Microsoft's SSE extension has a special case of effectively putting the
// sharing channel module inside the RSS tag and not inside the channel itself. So we also
// need to look for channel modules from the root RSS element.
final List<Module> allFeedModules = new ArrayList<Module>();
final List<Module> rootModules = parseFeedModules(rssRoot, locale);
final List<Module> channelModules = parseFeedModules(eChannel, locale);
if (rootModules != null) {
allFeedModules.addAll(rootModules); // depends on control dependency: [if], data = [(rootModules]
}
if (channelModules != null) {
allFeedModules.addAll(channelModules); // depends on control dependency: [if], data = [(channelModules]
}
channel.setModules(allFeedModules);
channel.setItems(parseItems(rssRoot, locale));
final List<Element> foreignMarkup = extractForeignMarkup(eChannel, channel, getRSSNamespace());
if (!foreignMarkup.isEmpty()) {
channel.setForeignMarkup(foreignMarkup); // depends on control dependency: [if], data = [none]
}
return channel;
} } |
public class class_name {
public boolean monitorAndPrintJob(JobConf conf,
RunningJob job
) throws IOException, InterruptedException {
String lastReport = null;
TaskStatusFilter filter;
filter = getTaskOutputFilter(conf);
JobID jobId = job.getID();
LOG.info("Running job: " + jobId);
int eventCounter = 0;
boolean profiling = conf.getProfileEnabled();
Configuration.IntegerRanges mapRanges = conf.getProfileTaskRange(true);
Configuration.IntegerRanges reduceRanges = conf.getProfileTaskRange(false);
while (!job.isComplete()) {
Thread.sleep(MAX_JOBPROFILE_AGE);
String report =
(" map " + StringUtils.formatPercent(job.mapProgress(), 0)+
" reduce " +
StringUtils.formatPercent(job.reduceProgress(), 0));
if (!report.equals(lastReport)) {
LOG.info(report);
lastReport = report;
}
TaskCompletionEvent[] events =
job.getTaskCompletionEvents(eventCounter);
eventCounter += events.length;
for(TaskCompletionEvent event : events){
TaskCompletionEvent.Status status = event.getTaskStatus();
if (profiling &&
(status == TaskCompletionEvent.Status.SUCCEEDED ||
status == TaskCompletionEvent.Status.FAILED) &&
(event.isMap ? mapRanges : reduceRanges).
isIncluded(event.idWithinJob())) {
downloadProfile(event);
}
switch(filter){
case NONE:
break;
case SUCCEEDED:
if (event.getTaskStatus() ==
TaskCompletionEvent.Status.SUCCEEDED){
LOG.info(event.toString());
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp());
}
break;
case FAILED:
if (event.getTaskStatus() ==
TaskCompletionEvent.Status.FAILED){
LOG.info(event.toString());
// Displaying the task diagnostic information
TaskAttemptID taskId = event.getTaskAttemptId();
String[] taskDiagnostics =
jobSubmitClient.getTaskDiagnostics(taskId);
if (taskDiagnostics != null) {
for(String diagnostics : taskDiagnostics){
System.err.println(diagnostics);
}
}
// Displaying the task logs
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp());
}
break;
case KILLED:
if (event.getTaskStatus() == TaskCompletionEvent.Status.KILLED){
LOG.info(event.toString());
}
break;
case ALL:
LOG.info(event.toString());
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp());
break;
}
}
}
LOG.info("Job complete: " + jobId);
Counters counters = job.getCounters();
if (counters != null) {
counters.log(LOG);
}
return job.isSuccessful();
} } | public class class_name {
public boolean monitorAndPrintJob(JobConf conf,
RunningJob job
) throws IOException, InterruptedException {
String lastReport = null;
TaskStatusFilter filter;
filter = getTaskOutputFilter(conf);
JobID jobId = job.getID();
LOG.info("Running job: " + jobId);
int eventCounter = 0;
boolean profiling = conf.getProfileEnabled();
Configuration.IntegerRanges mapRanges = conf.getProfileTaskRange(true);
Configuration.IntegerRanges reduceRanges = conf.getProfileTaskRange(false);
while (!job.isComplete()) {
Thread.sleep(MAX_JOBPROFILE_AGE);
String report =
(" map " + StringUtils.formatPercent(job.mapProgress(), 0)+
" reduce " +
StringUtils.formatPercent(job.reduceProgress(), 0));
if (!report.equals(lastReport)) {
LOG.info(report);
lastReport = report;
}
TaskCompletionEvent[] events =
job.getTaskCompletionEvents(eventCounter);
eventCounter += events.length;
for(TaskCompletionEvent event : events){
TaskCompletionEvent.Status status = event.getTaskStatus();
if (profiling &&
(status == TaskCompletionEvent.Status.SUCCEEDED ||
status == TaskCompletionEvent.Status.FAILED) &&
(event.isMap ? mapRanges : reduceRanges).
isIncluded(event.idWithinJob())) {
downloadProfile(event); // depends on control dependency: [if], data = [none]
}
switch(filter){
case NONE:
break;
case SUCCEEDED:
if (event.getTaskStatus() ==
TaskCompletionEvent.Status.SUCCEEDED){
LOG.info(event.toString()); // depends on control dependency: [if], data = [none]
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp()); // depends on control dependency: [if], data = [none]
}
break;
case FAILED:
if (event.getTaskStatus() ==
TaskCompletionEvent.Status.FAILED){
LOG.info(event.toString()); // depends on control dependency: [if], data = [none]
// Displaying the task diagnostic information
TaskAttemptID taskId = event.getTaskAttemptId();
String[] taskDiagnostics =
jobSubmitClient.getTaskDiagnostics(taskId);
if (taskDiagnostics != null) {
for(String diagnostics : taskDiagnostics){
System.err.println(diagnostics); // depends on control dependency: [for], data = [diagnostics]
}
}
// Displaying the task logs
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp()); // depends on control dependency: [if], data = [none]
}
break;
case KILLED:
if (event.getTaskStatus() == TaskCompletionEvent.Status.KILLED){
LOG.info(event.toString()); // depends on control dependency: [if], data = [none]
}
break;
case ALL:
LOG.info(event.toString());
displayTaskLogs(event.getTaskAttemptId(), event.getTaskTrackerHttp());
break;
}
}
}
LOG.info("Job complete: " + jobId);
Counters counters = job.getCounters();
if (counters != null) {
counters.log(LOG);
}
return job.isSuccessful();
} } |
public class class_name {
@Override
public void clear() {
if (bean == null) {
return;
}
try {
bean = beanClass.newInstance();
} catch (Exception e) {
throw new UnsupportedOperationException("Could not create new instance of class: " + beanClass);
}
} } | public class class_name {
@Override
public void clear() {
if (bean == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
bean = beanClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new UnsupportedOperationException("Could not create new instance of class: " + beanClass);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void deliver() {
try {
deliverUnsafe();
} catch (Throwable t) {
// This should never happen. If does, it means we are in an inconsistent state and should
// close the stream and further processing should be prevented. This is accomplished by
// purposefully leaving the lock non-zero and notifying the outerResponseObserver of the
// error. Care must be taken to avoid calling close twice in case the first invocation threw
// an error.
innerController.cancel();
if (!finished) {
outerResponseObserver.onError(t);
}
}
} } | public class class_name {
private void deliver() {
try {
deliverUnsafe(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
// This should never happen. If does, it means we are in an inconsistent state and should
// close the stream and further processing should be prevented. This is accomplished by
// purposefully leaving the lock non-zero and notifying the outerResponseObserver of the
// error. Care must be taken to avoid calling close twice in case the first invocation threw
// an error.
innerController.cancel();
if (!finished) {
outerResponseObserver.onError(t); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void cleanup() {
ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
for (ProducerReference p : producerReferences) {
try {
if (p.get() != null)
unregisterProducer(p.get());
} catch (Exception e) {
LOGGER.warn("can't unregister producer " + p, e);
}
}
} } | public class class_name {
public void cleanup() {
ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
for (ProducerReference p : producerReferences) {
try {
if (p.get() != null)
unregisterProducer(p.get());
} catch (Exception e) {
LOGGER.warn("can't unregister producer " + p, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static <A extends Annotation> List<Annotation> getIndirectlyPresentAnnotations(
final A maybeContainerAnnotation) {
try {
final Method method = maybeContainerAnnotation.annotationType().getMethod("value");
final Object o = method.invoke(maybeContainerAnnotation);
if (Annotation[].class.isAssignableFrom(o.getClass())) {
final Annotation[] indirectAnnotations = (Annotation[]) o;
if (indirectAnnotations.length > 0
&& indirectAnnotations[0].annotationType().isAnnotationPresent(Repeatable.class)) {
return Arrays.asList(indirectAnnotations);
}
}
} catch (final NoSuchMethodException e) {
// That's ok, this just wasn't a container annotation -> continue
} catch (final SecurityException
| IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
throw new IllegalStateException(e);
}
return Collections.emptyList();
} } | public class class_name {
public static <A extends Annotation> List<Annotation> getIndirectlyPresentAnnotations(
final A maybeContainerAnnotation) {
try {
final Method method = maybeContainerAnnotation.annotationType().getMethod("value");
final Object o = method.invoke(maybeContainerAnnotation);
if (Annotation[].class.isAssignableFrom(o.getClass())) {
final Annotation[] indirectAnnotations = (Annotation[]) o;
if (indirectAnnotations.length > 0
&& indirectAnnotations[0].annotationType().isAnnotationPresent(Repeatable.class)) {
return Arrays.asList(indirectAnnotations); // depends on control dependency: [if], data = [none]
}
}
} catch (final NoSuchMethodException e) {
// That's ok, this just wasn't a container annotation -> continue
} catch (final SecurityException // depends on control dependency: [catch], data = [none]
| IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e) {
throw new IllegalStateException(e);
} // depends on control dependency: [catch], data = [none]
return Collections.emptyList();
} } |
public class class_name {
public static <T, C extends Collection<T>> Supplier<? extends C> reuse(final Supplier<? extends C> supplier) {
return new Supplier<C>() {
private C c;
@Override
public C get() {
if (c == null) {
c = supplier.get();
} else if (c.size() > 0) {
c.clear();
}
return c;
}
};
} } | public class class_name {
public static <T, C extends Collection<T>> Supplier<? extends C> reuse(final Supplier<? extends C> supplier) {
return new Supplier<C>() {
private C c;
@Override
public C get() {
if (c == null) {
c = supplier.get();
// depends on control dependency: [if], data = [none]
} else if (c.size() > 0) {
c.clear();
// depends on control dependency: [if], data = [none]
}
return c;
}
};
} } |
public class class_name {
private static double calculateHBondEnergy(SecStrucGroup one,
SecStrucGroup two) {
Atom N = one.getN();
Atom H = one.getH();
Atom O = two.getO();
Atom C = two.getC();
double dno = Calc.getDistance(O,N);
double dhc = Calc.getDistance(C,H);
double dho = Calc.getDistance(O,H);
double dnc = Calc.getDistance(C,N);
logger.debug(" cccc: {} {} {} {} O ({})..N ({}):{} | ho:{} - hc:{} + nc:{} - no:{}",
one.getResidueNumber(),one.getPDBName(),two.getResidueNumber(),two.getPDBName(),
O.getPDBserial(),N.getPDBserial(),dno,dho,dhc,dnc,dno);
//there seems to be a contact!
if ( (dno < MINDIST) || (dhc < MINDIST) ||
(dnc < MINDIST) || (dno < MINDIST)) {
return HBONDLOWENERGY;
}
double e1 = Q / dho - Q / dhc;
double e2 = Q / dnc - Q / dno;
double energy = e1 + e2;
logger.debug(" N ({}) O({}): {} : {} ",N.getPDBserial(),O.getPDBserial(),(float) dno,energy);
//Avoid too strong energy
if (energy > HBONDLOWENERGY) return energy;
return HBONDLOWENERGY ;
} } | public class class_name {
private static double calculateHBondEnergy(SecStrucGroup one,
SecStrucGroup two) {
Atom N = one.getN();
Atom H = one.getH();
Atom O = two.getO();
Atom C = two.getC();
double dno = Calc.getDistance(O,N);
double dhc = Calc.getDistance(C,H);
double dho = Calc.getDistance(O,H);
double dnc = Calc.getDistance(C,N);
logger.debug(" cccc: {} {} {} {} O ({})..N ({}):{} | ho:{} - hc:{} + nc:{} - no:{}",
one.getResidueNumber(),one.getPDBName(),two.getResidueNumber(),two.getPDBName(),
O.getPDBserial(),N.getPDBserial(),dno,dho,dhc,dnc,dno);
//there seems to be a contact!
if ( (dno < MINDIST) || (dhc < MINDIST) ||
(dnc < MINDIST) || (dno < MINDIST)) {
return HBONDLOWENERGY; // depends on control dependency: [if], data = [none]
}
double e1 = Q / dho - Q / dhc;
double e2 = Q / dnc - Q / dno;
double energy = e1 + e2;
logger.debug(" N ({}) O({}): {} : {} ",N.getPDBserial(),O.getPDBserial(),(float) dno,energy);
//Avoid too strong energy
if (energy > HBONDLOWENERGY) return energy;
return HBONDLOWENERGY ;
} } |
public class class_name {
@Requires({
"elements != null",
"!elements.contains(null)",
"clazz != null",
"kinds != null"
})
@SuppressWarnings("unchecked")
public static <T extends ElementModel> List<? extends T> filter(
List<? extends ElementModel> elements, Class<T> clazz,
ElementKind... kinds) {
ArrayList<T> result = new ArrayList<T>();
List<ElementKind> list = Arrays.asList(kinds);
for (ElementModel element : elements) {
if (list.contains(element.getKind())
&& clazz.isAssignableFrom(element.getClass())) {
result.add((T) element);
}
}
return Collections.unmodifiableList(result);
} } | public class class_name {
@Requires({
"elements != null",
"!elements.contains(null)",
"clazz != null",
"kinds != null"
})
@SuppressWarnings("unchecked")
public static <T extends ElementModel> List<? extends T> filter(
List<? extends ElementModel> elements, Class<T> clazz,
ElementKind... kinds) {
ArrayList<T> result = new ArrayList<T>();
List<ElementKind> list = Arrays.asList(kinds);
for (ElementModel element : elements) {
if (list.contains(element.getKind())
&& clazz.isAssignableFrom(element.getClass())) {
result.add((T) element); // depends on control dependency: [if], data = [none]
}
}
return Collections.unmodifiableList(result);
} } |
public class class_name {
public boolean containAll(String... containWith) {
for (String contain : containWith) {
if (!contain(contain)) {
return false;
}
}
return true;
} } | public class class_name {
public boolean containAll(String... containWith) {
for (String contain : containWith) {
if (!contain(contain)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public static synchronized POSIX jnr() {
if (posix == null) {
posix = POSIXFactory.getPOSIX(new DefaultPOSIXHandler() {
@Override public void error(Errno error, String extraData) {
throw new PosixException("native error " + error.description() + " " + extraData, convert(error));
}
@Override public void error(Errno error, String methodName, String extraData) {
throw new PosixException("native error calling " + methodName + ": " + error.description() + " " + extraData, convert(error));
}
private org.jruby.ext.posix.POSIX.ERRORS convert(Errno error) {
try {
return org.jruby.ext.posix.POSIX.ERRORS.valueOf(error.name());
} catch (IllegalArgumentException x) {
return org.jruby.ext.posix.POSIX.ERRORS.EIO; // PosixException.message has real error anyway
}
}
}, true);
}
return posix;
} } | public class class_name {
public static synchronized POSIX jnr() {
if (posix == null) {
posix = POSIXFactory.getPOSIX(new DefaultPOSIXHandler() {
@Override public void error(Errno error, String extraData) {
throw new PosixException("native error " + error.description() + " " + extraData, convert(error));
}
@Override public void error(Errno error, String methodName, String extraData) {
throw new PosixException("native error calling " + methodName + ": " + error.description() + " " + extraData, convert(error));
}
private org.jruby.ext.posix.POSIX.ERRORS convert(Errno error) {
try {
return org.jruby.ext.posix.POSIX.ERRORS.valueOf(error.name()); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException x) {
return org.jruby.ext.posix.POSIX.ERRORS.EIO; // PosixException.message has real error anyway
} // depends on control dependency: [catch], data = [none]
}
}, true); // depends on control dependency: [if], data = [none]
}
return posix;
} } |
public class class_name {
public static String getAttributeValue(final Element element, final String name) {
final Node node = element.getAttributes().getNamedItem(name);
if (node != null) {
return node.getNodeValue();
}
return null;
} } | public class class_name {
public static String getAttributeValue(final Element element, final String name) {
final Node node = element.getAttributes().getNamedItem(name);
if (node != null) {
return node.getNodeValue(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private Plan selectPlanAtRandom() {
Plan plan = null;
Set<Belief> vars = null;
int index = rand.nextInt(size());
int idx = 0;
boolean bindingsExist = false;
for (Plan p : bindings.keySet()) {
vars = bindings.get(p);
bindingsExist = (vars != null && !vars.isEmpty());
idx += bindingsExist ? vars.size() : 1;
if (idx > index) {
plan = p;
if (bindingsExist) {
index = index - (idx - vars.size());
setPlanVariables(plan.getAgent(), plan, vars, index);
}
break;
}
}
return plan;
} } | public class class_name {
private Plan selectPlanAtRandom() {
Plan plan = null;
Set<Belief> vars = null;
int index = rand.nextInt(size());
int idx = 0;
boolean bindingsExist = false;
for (Plan p : bindings.keySet()) {
vars = bindings.get(p); // depends on control dependency: [for], data = [p]
bindingsExist = (vars != null && !vars.isEmpty()); // depends on control dependency: [for], data = [p]
idx += bindingsExist ? vars.size() : 1; // depends on control dependency: [for], data = [none]
if (idx > index) {
plan = p; // depends on control dependency: [if], data = [none]
if (bindingsExist) {
index = index - (idx - vars.size()); // depends on control dependency: [if], data = [none]
setPlanVariables(plan.getAgent(), plan, vars, index); // depends on control dependency: [if], data = [none]
}
break;
}
}
return plan;
} } |
public class class_name {
protected List<CmsRelation> findRelationsFromTargetToSource() throws CmsException {
List<CmsRelation> relations = m_cms.readRelations(
CmsRelationFilter.SOURCES.filterPath(m_targetPath).filterIncludeChildren());
List<CmsRelation> result = new ArrayList<CmsRelation>();
for (CmsRelation rel : relations) {
if (isInTargets(rel.getSourcePath()) && isInSources(rel.getTargetPath())) {
result.add(rel);
}
}
return result;
} } | public class class_name {
protected List<CmsRelation> findRelationsFromTargetToSource() throws CmsException {
List<CmsRelation> relations = m_cms.readRelations(
CmsRelationFilter.SOURCES.filterPath(m_targetPath).filterIncludeChildren());
List<CmsRelation> result = new ArrayList<CmsRelation>();
for (CmsRelation rel : relations) {
if (isInTargets(rel.getSourcePath()) && isInSources(rel.getTargetPath())) {
result.add(rel); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public void close() {
Iterator<Map.Entry<Path, OpenCryptoFile>> iter = openCryptoFiles.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Path, OpenCryptoFile> entry = iter.next();
iter.remove(); // remove before invoking close() to avoid concurrent modification of this iterator by #close(OpenCryptoFile)
entry.getValue().close();
}
} } | public class class_name {
@Override
public void close() {
Iterator<Map.Entry<Path, OpenCryptoFile>> iter = openCryptoFiles.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<Path, OpenCryptoFile> entry = iter.next();
iter.remove(); // remove before invoking close() to avoid concurrent modification of this iterator by #close(OpenCryptoFile)
// depends on control dependency: [while], data = [none]
entry.getValue().close();
// depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
private int isCentered(Area area, boolean askBefore, boolean askAfter)
{
Area parent = area.getParent();
if (parent != null)
{
int left = area.getX1() - parent.getX1();
int right = parent.getX2() - area.getX2();
int limit = (int) (((left + right) / 2.0) * CENTERING_THRESHOLD);
if (limit == 0) limit = 1; //we always allow +-1px
//System.out.println(this + " left=" + left + " right=" + right + " limit=" + limit);
boolean middle = Math.abs(left - right) <= limit; //first guess - check if it is placed in the middle
boolean fullwidth = left == 0 && right == 0; //centered because of full width
if (!middle && !fullwidth) //not full width and certainly not in the middle
{
return 0;
}
else //may be centered - check the alignment
{
//compare the alignent with the previous and/or the next child
Area prev = null;
Area next = null;
int pc = 2; //previous centered?
int nc = 2; //next cenrered?
if (askBefore || askAfter)
{
if (askBefore)
{
prev = area.getPreviousSibling();
while (prev != null && (pc = isCentered(prev, true, false)) == 2)
prev = prev.getPreviousSibling();
}
if (askAfter)
{
next = area.getNextSibling();
while (next != null && (nc = isCentered(next, false, true)) == 2)
next = next.getNextSibling();
}
}
if (pc != 2 || nc != 2) //we have something for comparison
{
if (fullwidth) //cannot guess, compare with others
{
if (pc != 0 && nc != 0) //something around is centered - probably centered
return 1;
else
return 0;
}
else //probably centered, if it is not left- or right-aligned with something around
{
if (prev != null && lrAligned(area, prev) == 1 ||
next != null && lrAligned(area, next) == 1)
return 0; //aligned, not centered
else
return 1; //probably centered
}
}
else //nothing to compare, just guess
{
if (fullwidth)
return 2; //cannot guess from anything
else
return (middle ? 1 : 0); //nothing to compare with - guess from the position
}
}
}
else
return 2; //no parent - we don't know
} } | public class class_name {
private int isCentered(Area area, boolean askBefore, boolean askAfter)
{
Area parent = area.getParent();
if (parent != null)
{
int left = area.getX1() - parent.getX1();
int right = parent.getX2() - area.getX2();
int limit = (int) (((left + right) / 2.0) * CENTERING_THRESHOLD);
if (limit == 0) limit = 1; //we always allow +-1px
//System.out.println(this + " left=" + left + " right=" + right + " limit=" + limit);
boolean middle = Math.abs(left - right) <= limit; //first guess - check if it is placed in the middle
boolean fullwidth = left == 0 && right == 0; //centered because of full width
if (!middle && !fullwidth) //not full width and certainly not in the middle
{
return 0; // depends on control dependency: [if], data = [none]
}
else //may be centered - check the alignment
{
//compare the alignent with the previous and/or the next child
Area prev = null;
Area next = null;
int pc = 2; //previous centered?
int nc = 2; //next cenrered?
if (askBefore || askAfter)
{
if (askBefore)
{
prev = area.getPreviousSibling(); // depends on control dependency: [if], data = [none]
while (prev != null && (pc = isCentered(prev, true, false)) == 2)
prev = prev.getPreviousSibling();
}
if (askAfter)
{
next = area.getNextSibling(); // depends on control dependency: [if], data = [none]
while (next != null && (nc = isCentered(next, false, true)) == 2)
next = next.getNextSibling();
}
}
if (pc != 2 || nc != 2) //we have something for comparison
{
if (fullwidth) //cannot guess, compare with others
{
if (pc != 0 && nc != 0) //something around is centered - probably centered
return 1;
else
return 0;
}
else //probably centered, if it is not left- or right-aligned with something around
{
if (prev != null && lrAligned(area, prev) == 1 ||
next != null && lrAligned(area, next) == 1)
return 0; //aligned, not centered
else
return 1; //probably centered
}
}
else //nothing to compare, just guess
{
if (fullwidth)
return 2; //cannot guess from anything
else
return (middle ? 1 : 0); //nothing to compare with - guess from the position
}
}
}
else
return 2; //no parent - we don't know
} } |
public class class_name {
void installAdditional(final File installedFile, final String fileExt, final String payload, final boolean chop)
throws MojoExecutionException {
File additionalFile = null;
if (chop) {
String path = installedFile.getAbsolutePath();
additionalFile = new File(path.substring(0, path.lastIndexOf('.')) + fileExt);
} else {
if (fileExt.indexOf('.') > 0) {
additionalFile = new File(installedFile.getParentFile(), fileExt);
} else {
additionalFile = new File(installedFile.getAbsolutePath() + fileExt);
}
}
getLog().debug("Installing additional file to " + additionalFile);
try {
additionalFile.getParentFile().mkdirs();
FileUtils.fileWrite(additionalFile.getAbsolutePath(), "UTF-8", payload);
} catch (IOException e) {
throw new MojoExecutionException("Failed to install additional file to " + additionalFile, e);
}
} } | public class class_name {
void installAdditional(final File installedFile, final String fileExt, final String payload, final boolean chop)
throws MojoExecutionException {
File additionalFile = null;
if (chop) {
String path = installedFile.getAbsolutePath();
additionalFile = new File(path.substring(0, path.lastIndexOf('.')) + fileExt);
} else {
if (fileExt.indexOf('.') > 0) {
additionalFile = new File(installedFile.getParentFile(), fileExt);
// depends on control dependency: [if], data = [none]
} else {
additionalFile = new File(installedFile.getAbsolutePath() + fileExt);
// depends on control dependency: [if], data = [none]
}
}
getLog().debug("Installing additional file to " + additionalFile);
try {
additionalFile.getParentFile().mkdirs();
FileUtils.fileWrite(additionalFile.getAbsolutePath(), "UTF-8", payload);
} catch (IOException e) {
throw new MojoExecutionException("Failed to install additional file to " + additionalFile, e);
}
} } |
public class class_name {
@Pure
public static String formatHex(int amount, int digits) {
final StringBuffer hex = new StringBuffer(Integer.toHexString(amount));
while (hex.length() < digits) {
hex.insert(0, "0"); //$NON-NLS-1$
}
return hex.toString();
} } | public class class_name {
@Pure
public static String formatHex(int amount, int digits) {
final StringBuffer hex = new StringBuffer(Integer.toHexString(amount));
while (hex.length() < digits) {
hex.insert(0, "0"); //$NON-NLS-1$ // depends on control dependency: [while], data = [none]
}
return hex.toString();
} } |
public class class_name {
public void record(String metric, double value) {
mTimeSeries.compute(metric, (metricName, timeSeries) -> {
if (timeSeries == null) {
timeSeries = new TimeSeries(metricName);
}
timeSeries.record(value);
return timeSeries;
});
} } | public class class_name {
public void record(String metric, double value) {
mTimeSeries.compute(metric, (metricName, timeSeries) -> {
if (timeSeries == null) {
timeSeries = new TimeSeries(metricName); // depends on control dependency: [if], data = [none]
}
timeSeries.record(value);
return timeSeries;
});
} } |
public class class_name {
protected static KDistanceResult calculateKDistance(int kn, List<DistanceResult> distances)
{
// 算出した距離を用いてK距離とK距離近傍データのIDを算出
int countedDataNum = 0;
List<String> idList = new ArrayList<>();
double nowDistance = 0.0d;
// K値の値までIDのカウントを行い、距離を設定する。
for (DistanceResult distanceResult : distances)
{
nowDistance = distanceResult.getDistance();
idList.add(distanceResult.getDataId());
countedDataNum++;
if (kn <= countedDataNum)
{
break;
}
}
KDistanceResult kResult = new KDistanceResult();
kResult.setkDistance(nowDistance);
kResult.setkDistanceNeighbor(idList);
return kResult;
} } | public class class_name {
protected static KDistanceResult calculateKDistance(int kn, List<DistanceResult> distances)
{
// 算出した距離を用いてK距離とK距離近傍データのIDを算出
int countedDataNum = 0;
List<String> idList = new ArrayList<>();
double nowDistance = 0.0d;
// K値の値までIDのカウントを行い、距離を設定する。
for (DistanceResult distanceResult : distances)
{
nowDistance = distanceResult.getDistance(); // depends on control dependency: [for], data = [distanceResult]
idList.add(distanceResult.getDataId()); // depends on control dependency: [for], data = [distanceResult]
countedDataNum++; // depends on control dependency: [for], data = [none]
if (kn <= countedDataNum)
{
break;
}
}
KDistanceResult kResult = new KDistanceResult();
kResult.setkDistance(nowDistance);
kResult.setkDistanceNeighbor(idList);
return kResult;
} } |
public class class_name {
private void updateImage() {
if (!over) {
currentImage = normalImage;
currentColor = normalColor;
state = NORMAL;
mouseUp = false;
} else {
if (mouseDown) {
if ((state != MOUSE_DOWN) && (mouseUp)) {
if (mouseDownSound != null) {
mouseDownSound.play();
}
currentImage = mouseDownImage;
currentColor = mouseDownColor;
state = MOUSE_DOWN;
notifyListeners();
mouseUp = false;
}
return;
} else {
mouseUp = true;
if (state != MOUSE_OVER) {
if (mouseOverSound != null) {
mouseOverSound.play();
}
currentImage = mouseOverImage;
currentColor = mouseOverColor;
state = MOUSE_OVER;
}
}
}
mouseDown = false;
state = NORMAL;
} } | public class class_name {
private void updateImage() {
if (!over) {
currentImage = normalImage;
// depends on control dependency: [if], data = [none]
currentColor = normalColor;
// depends on control dependency: [if], data = [none]
state = NORMAL;
// depends on control dependency: [if], data = [none]
mouseUp = false;
// depends on control dependency: [if], data = [none]
} else {
if (mouseDown) {
if ((state != MOUSE_DOWN) && (mouseUp)) {
if (mouseDownSound != null) {
mouseDownSound.play();
// depends on control dependency: [if], data = [none]
}
currentImage = mouseDownImage;
// depends on control dependency: [if], data = [none]
currentColor = mouseDownColor;
// depends on control dependency: [if], data = [none]
state = MOUSE_DOWN;
// depends on control dependency: [if], data = [none]
notifyListeners();
// depends on control dependency: [if], data = [none]
mouseUp = false;
// depends on control dependency: [if], data = [none]
}
return;
// depends on control dependency: [if], data = [none]
} else {
mouseUp = true;
// depends on control dependency: [if], data = [none]
if (state != MOUSE_OVER) {
if (mouseOverSound != null) {
mouseOverSound.play();
// depends on control dependency: [if], data = [none]
}
currentImage = mouseOverImage;
// depends on control dependency: [if], data = [none]
currentColor = mouseOverColor;
// depends on control dependency: [if], data = [none]
state = MOUSE_OVER;
// depends on control dependency: [if], data = [none]
}
}
}
mouseDown = false;
state = NORMAL;
} } |
public class class_name {
public static boolean tableContainsString(VoltTable t, String s, boolean caseSenstive) {
if (t.getRowCount() == 0) {
return false;
}
if (!caseSenstive) {
s = s.toLowerCase();
}
VoltTableRow row = t.fetchRow(0);
do {
for (int i = 0; i < t.getColumnCount(); i++) {
if (t.getColumnType(i) == VoltType.STRING) {
String value = row.getString(i);
if (value == null) {
continue;
}
if (!caseSenstive) {
value = value.toLowerCase();
}
if (value.contains(s)) {
return true;
}
}
}
} while (row.advanceRow());
return false;
} } | public class class_name {
public static boolean tableContainsString(VoltTable t, String s, boolean caseSenstive) {
if (t.getRowCount() == 0) {
return false; // depends on control dependency: [if], data = [none]
}
if (!caseSenstive) {
s = s.toLowerCase(); // depends on control dependency: [if], data = [none]
}
VoltTableRow row = t.fetchRow(0);
do {
for (int i = 0; i < t.getColumnCount(); i++) {
if (t.getColumnType(i) == VoltType.STRING) {
String value = row.getString(i);
if (value == null) {
continue;
}
if (!caseSenstive) {
value = value.toLowerCase(); // depends on control dependency: [if], data = [none]
}
if (value.contains(s)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
} while (row.advanceRow());
return false;
} } |
public class class_name {
public static String separatorsToSystem(final String path) {
if (path == null) {
return null;
}
if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) {
return separatorsToWindows(path);
} else {
return separatorsToUnix(path);
}
} } | public class class_name {
public static String separatorsToSystem(final String path) {
if (path == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (SYSTEM_SEPARATOR == WINDOWS_SEPARATOR) {
return separatorsToWindows(path); // depends on control dependency: [if], data = [none]
} else {
return separatorsToUnix(path); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setAppendix(final String pAppendix)
{
appendix = pAppendix;
if (pAppendix != null && pAppendix.length() > 0) {
getInputs().property("appendix", pAppendix);
setDescription(
"Create file '" + pluginPomProps.getName() + "' for use in JAR (appendix: " + pAppendix + ")");
}
else {
getInputs().getProperties().remove("appendix");
setDescription("Create file '" + pluginPomProps.getName() + "' for use in JAR (no appendix)");
}
} } | public class class_name {
public void setAppendix(final String pAppendix)
{
appendix = pAppendix;
if (pAppendix != null && pAppendix.length() > 0) {
getInputs().property("appendix", pAppendix); // depends on control dependency: [if], data = [none]
setDescription(
"Create file '" + pluginPomProps.getName() + "' for use in JAR (appendix: " + pAppendix + ")");
}
else {
getInputs().getProperties().remove("appendix");
setDescription("Create file '" + pluginPomProps.getName() + "' for use in JAR (no appendix)"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Invoker getInvoker(Object proxyObject, String proxyType) {
try {
ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class)
.getExtensionClass(proxyType);
if (ext == null) {
throw ExceptionUtils.buildRuntime("consumer.proxy", proxyType,
"Unsupported proxy of client!");
}
Proxy proxy = ext.getExtInstance();
return proxy.getInvoker(proxyObject);
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) {
throw new SofaRpcRuntimeException(e.getMessage(), e);
}
} } | public class class_name {
public static Invoker getInvoker(Object proxyObject, String proxyType) {
try {
ExtensionClass<Proxy> ext = ExtensionLoaderFactory.getExtensionLoader(Proxy.class)
.getExtensionClass(proxyType);
if (ext == null) {
throw ExceptionUtils.buildRuntime("consumer.proxy", proxyType,
"Unsupported proxy of client!");
}
Proxy proxy = ext.getExtInstance();
return proxy.getInvoker(proxyObject); // depends on control dependency: [try], data = [none]
} catch (SofaRpcRuntimeException e) {
throw e;
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
throw new SofaRpcRuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EClass getIfcMaterialDefinitionRepresentation() {
if (ifcMaterialDefinitionRepresentationEClass == null) {
ifcMaterialDefinitionRepresentationEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(308);
}
return ifcMaterialDefinitionRepresentationEClass;
} } | public class class_name {
public EClass getIfcMaterialDefinitionRepresentation() {
if (ifcMaterialDefinitionRepresentationEClass == null) {
ifcMaterialDefinitionRepresentationEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(308);
// depends on control dependency: [if], data = [none]
}
return ifcMaterialDefinitionRepresentationEClass;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected Object messageToTuple(FieldDescriptor fieldDescriptor, Object fieldValue) {
if (fieldValue == null) {
// protobufs unofficially ensures values are not null. just in case:
return null;
}
assert fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE : "messageToTuple called with field of type " + fieldDescriptor.getType();
if (fieldDescriptor.isRepeated()) {
// The protobuf contract is that if the field is repeated, then the object returned is actually a List
// of the underlying datatype, which in this case is a nested message.
List<Message> messageList = (List<Message>) (fieldValue != null ? fieldValue : Lists.newArrayList());
DataBag bag = new NonSpillableDataBag(messageList.size());
for (Message m : messageList) {
bag.add(new ProtobufTuple(m));
}
return bag;
} else {
return new ProtobufTuple((Message)fieldValue);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
protected Object messageToTuple(FieldDescriptor fieldDescriptor, Object fieldValue) {
if (fieldValue == null) {
// protobufs unofficially ensures values are not null. just in case:
return null; // depends on control dependency: [if], data = [none]
}
assert fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE : "messageToTuple called with field of type " + fieldDescriptor.getType();
if (fieldDescriptor.isRepeated()) {
// The protobuf contract is that if the field is repeated, then the object returned is actually a List
// of the underlying datatype, which in this case is a nested message.
List<Message> messageList = (List<Message>) (fieldValue != null ? fieldValue : Lists.newArrayList());
DataBag bag = new NonSpillableDataBag(messageList.size());
for (Message m : messageList) {
bag.add(new ProtobufTuple(m)); // depends on control dependency: [for], data = [m]
}
return bag; // depends on control dependency: [if], data = [none]
} else {
return new ProtobufTuple((Message)fieldValue); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Collection<EndpointInfo> getEndpointInfos() {
ArrayList<EndpointInfo> values = new ArrayList<EndpointInfo>();
Iterator<String> it = getEndpointNames().iterator();
// for each endpoint name, iterate over it's list of endpoints and add to values
while (it.hasNext()) {
List<EndpointInfo> list = endpointInfoMap.get(it.next());
for (int i = 0; i < list.size(); i++) {
values.add(list.get(i));
}
}
return Collections.unmodifiableCollection(values);
//return Collections.unmodifiableCollection(endpointInfoMap.values());
} } | public class class_name {
public Collection<EndpointInfo> getEndpointInfos() {
ArrayList<EndpointInfo> values = new ArrayList<EndpointInfo>();
Iterator<String> it = getEndpointNames().iterator();
// for each endpoint name, iterate over it's list of endpoints and add to values
while (it.hasNext()) {
List<EndpointInfo> list = endpointInfoMap.get(it.next());
for (int i = 0; i < list.size(); i++) {
values.add(list.get(i)); // depends on control dependency: [for], data = [i]
}
}
return Collections.unmodifiableCollection(values);
//return Collections.unmodifiableCollection(endpointInfoMap.values());
} } |
public class class_name {
@Override
public final String getIndexName() {
final Source source = sourceRenderer.getGedObject();
if (!source.isSet()) {
return "";
}
final String nameHtml = sourceRenderer.getTitleString();
return "<a href=\"source?db=" + source.getDbName() + "&id="
+ source.getString() + "\" class=\"name\" id=\"source-"
+ source.getString() + "\">" + nameHtml + " ("
+ source.getString() + ")</a>";
} } | public class class_name {
@Override
public final String getIndexName() {
final Source source = sourceRenderer.getGedObject();
if (!source.isSet()) {
return ""; // depends on control dependency: [if], data = [none]
}
final String nameHtml = sourceRenderer.getTitleString();
return "<a href=\"source?db=" + source.getDbName() + "&id="
+ source.getString() + "\" class=\"name\" id=\"source-"
+ source.getString() + "\">" + nameHtml + " ("
+ source.getString() + ")</a>";
} } |
public class class_name {
public static void returnByteArray(final byte[] b)
{
if (b==null)
return;
byte[][] pool = (byte[][])__pools.get();
for (int i=pool.length;i-->0;)
{
if (pool[i]==null)
{
pool[i]=b;
return;
}
}
// slot.
int s = __slot++;
if (s<0)s=-s;
pool[s%pool.length]=b;
} } | public class class_name {
public static void returnByteArray(final byte[] b)
{
if (b==null)
return;
byte[][] pool = (byte[][])__pools.get();
for (int i=pool.length;i-->0;)
{
if (pool[i]==null)
{
pool[i]=b; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// slot.
int s = __slot++;
if (s<0)s=-s;
pool[s%pool.length]=b;
} } |
public class class_name {
static void rcvCreateBifurcatedSess(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "rcvCreateBifurcatedSess",
new Object[]
{
request,
conversation,
"" + requestNumber,
"" + allocatedFromBufferPool
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
long mpSessionId = request.getLong(); // BIT64 MessageProcessorSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "SICoreConnection Id:", "" + connectionObjectID);
SibTr.debug(tc, "MP Session Id:", "" + mpSessionId);
}
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
try
{
BifurcatedConsumerSession bifConsumerSession =
connection.createBifurcatedConsumerSession(mpSessionId);
CATMainConsumer mainConsumer = new CATMainConsumer(conversation,
(short) 0, // Client sess id
null, // ConsumerSession
false, // Read ahead
false, // No local
null); // Unrecov reliability
short consSessionObjectID = (short) convState.addObject(mainConsumer);
mainConsumer.setConsumerSessionId(consSessionObjectID);
mainConsumer.setBifurcatedSession(bifConsumerSession);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Consumer Session Id:", consSessionObjectID);
StaticCATHelper.sendSessionCreateResponse(JFapChannelConstants.SEG_CREATE_BIFURCATED_SESSION_R,
requestNumber,
conversation,
consSessionObjectID,
bifConsumerSession,
null);
} catch (ConversationStateFullException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateBifurcatedSess",
CommsConstants.STATICCATCONSUMER_CREATEBIF_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATCONSUMER_CREATEBIF_01,
conversation, requestNumber);
} catch (SINotAuthorizedException e)
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
} catch (SIException e)
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!convState.hasMETerminated())
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateBifurcatedSess",
CommsConstants.STATICCATCONSUMER_CREATEBIF_02);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATCONSUMER_CREATEBIF_02,
conversation, requestNumber);
}
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "rcvCreateBifurcatedSess");
} } | public class class_name {
static void rcvCreateBifurcatedSess(CommsByteBuffer request, Conversation conversation,
int requestNumber, boolean allocatedFromBufferPool,
boolean partOfExchange)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "rcvCreateBifurcatedSess",
new Object[]
{
request,
conversation,
"" + requestNumber,
"" + allocatedFromBufferPool
});
ConversationState convState = (ConversationState) conversation.getAttachment();
short connectionObjectID = request.getShort(); // BIT16 ConnectionObjectId
long mpSessionId = request.getLong(); // BIT64 MessageProcessorSessionId
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "SICoreConnection Id:", "" + connectionObjectID); // depends on control dependency: [if], data = [none]
SibTr.debug(tc, "MP Session Id:", "" + mpSessionId); // depends on control dependency: [if], data = [none]
}
SICoreConnection connection =
((CATConnection) convState.getObject(connectionObjectID)).getSICoreConnection();
try
{
BifurcatedConsumerSession bifConsumerSession =
connection.createBifurcatedConsumerSession(mpSessionId);
CATMainConsumer mainConsumer = new CATMainConsumer(conversation,
(short) 0, // Client sess id
null, // ConsumerSession
false, // Read ahead
false, // No local
null); // Unrecov reliability
short consSessionObjectID = (short) convState.addObject(mainConsumer);
mainConsumer.setConsumerSessionId(consSessionObjectID); // depends on control dependency: [try], data = [none]
mainConsumer.setBifurcatedSession(bifConsumerSession); // depends on control dependency: [try], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Consumer Session Id:", consSessionObjectID);
StaticCATHelper.sendSessionCreateResponse(JFapChannelConstants.SEG_CREATE_BIFURCATED_SESSION_R,
requestNumber,
conversation,
consSessionObjectID,
bifConsumerSession,
null); // depends on control dependency: [try], data = [none]
} catch (ConversationStateFullException e)
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateBifurcatedSess",
CommsConstants.STATICCATCONSUMER_CREATEBIF_01);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATCONSUMER_CREATEBIF_01,
conversation, requestNumber);
} catch (SINotAuthorizedException e) // depends on control dependency: [catch], data = [none]
{
// No FFDC Code Needed
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
null,
conversation, requestNumber);
} catch (SIException e) // depends on control dependency: [catch], data = [none]
{
//No FFDC code needed
//Only FFDC if we haven't received a meTerminated event.
if (!convState.hasMETerminated())
{
FFDCFilter.processException(e,
CLASS_NAME + ".rcvCreateBifurcatedSess",
CommsConstants.STATICCATCONSUMER_CREATEBIF_02); // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, e.getMessage(), e);
StaticCATHelper.sendExceptionToClient(e,
CommsConstants.STATICCATCONSUMER_CREATEBIF_02,
conversation, requestNumber);
} // depends on control dependency: [catch], data = [none]
request.release(allocatedFromBufferPool);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "rcvCreateBifurcatedSess");
} } |
public class class_name {
private boolean backrefMatchAtNestedLevel(boolean ignoreCase, int caseFoldFlag,
int nest, int memNum, int memp) {
int pend = -1;
int level = 0;
int k = stk - 1;
while (k >= 0) {
StackEntry e = stack[k];
if (e.type == CALL_FRAME) {
level--;
} else if (e.type == RETURN) {
level++;
} else if (level == nest) {
if (e.type == MEM_START) {
if (memIsInMemp(e.getMemNum(), memNum, memp)) {
int pstart = e.getMemPStr();
if (pend != -1) {
if (pend - pstart > end - s) return false; /* or goto next_mem; */
int p = pstart;
value = s;
if (ignoreCase) {
if (!stringCmpIC(caseFoldFlag, pstart, this, pend - pstart, end)) {
return false; /* or goto next_mem; */
}
} else {
while (p < pend) {
if (bytes[p++] != bytes[value++]) return false; /* or goto next_mem; */
}
}
s = value;
return true;
}
}
} else if (e.type == MEM_END) {
if (memIsInMemp(e.getMemNum(), memNum, memp)) {
pend = e.getMemPStr();
}
}
}
k--;
}
return false;
} } | public class class_name {
private boolean backrefMatchAtNestedLevel(boolean ignoreCase, int caseFoldFlag,
int nest, int memNum, int memp) {
int pend = -1;
int level = 0;
int k = stk - 1;
while (k >= 0) {
StackEntry e = stack[k];
if (e.type == CALL_FRAME) {
level--; // depends on control dependency: [if], data = [none]
} else if (e.type == RETURN) {
level++; // depends on control dependency: [if], data = [none]
} else if (level == nest) {
if (e.type == MEM_START) {
if (memIsInMemp(e.getMemNum(), memNum, memp)) {
int pstart = e.getMemPStr();
if (pend != -1) {
if (pend - pstart > end - s) return false; /* or goto next_mem; */
int p = pstart;
value = s; // depends on control dependency: [if], data = [none]
if (ignoreCase) {
if (!stringCmpIC(caseFoldFlag, pstart, this, pend - pstart, end)) {
return false; /* or goto next_mem; */ // depends on control dependency: [if], data = [none]
}
} else {
while (p < pend) {
if (bytes[p++] != bytes[value++]) return false; /* or goto next_mem; */
}
}
s = value; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
}
} else if (e.type == MEM_END) {
if (memIsInMemp(e.getMemNum(), memNum, memp)) {
pend = e.getMemPStr(); // depends on control dependency: [if], data = [none]
}
}
}
k--; // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public List<Node> parseWrapper(String raw) {
// holds literal text as we parse
StringBuilder buf = new StringBuilder();
// indicates we're inside a quote.
boolean inquote = false;
// indicates we're inside a {x} tag.
boolean intag = false;
// length of input pattern
int length = raw.length();
// current input pattern index
int i = 0;
List<Node> nodes = new ArrayList<>();
while (i < length) {
char ch = raw.charAt(i);
switch (ch) {
case '{':
if (buf.length() > 0) {
nodes.add(new Text(buf.toString()));
buf.setLength(0);
}
intag = true;
break;
case '}':
intag = false;
break;
case '\'':
if (inquote) {
inquote = false;
} else {
inquote = true;
}
break;
default:
if (intag) {
nodes.add(new Field(ch, 0));
} else {
buf.append(ch);
}
}
i++;
}
if (buf.length() > 0) {
nodes.add(new Text(buf.toString()));
}
return nodes;
} } | public class class_name {
public List<Node> parseWrapper(String raw) {
// holds literal text as we parse
StringBuilder buf = new StringBuilder();
// indicates we're inside a quote.
boolean inquote = false;
// indicates we're inside a {x} tag.
boolean intag = false;
// length of input pattern
int length = raw.length();
// current input pattern index
int i = 0;
List<Node> nodes = new ArrayList<>();
while (i < length) {
char ch = raw.charAt(i);
switch (ch) {
case '{':
if (buf.length() > 0) {
nodes.add(new Text(buf.toString())); // depends on control dependency: [if], data = [none]
buf.setLength(0); // depends on control dependency: [if], data = [0)]
}
intag = true;
break;
case '}':
intag = false;
break;
case '\'':
if (inquote) {
inquote = false; // depends on control dependency: [if], data = [none]
} else {
inquote = true; // depends on control dependency: [if], data = [none]
}
break;
default:
if (intag) {
nodes.add(new Field(ch, 0)); // depends on control dependency: [if], data = [none]
} else {
buf.append(ch); // depends on control dependency: [if], data = [none]
}
}
i++; // depends on control dependency: [while], data = [none]
}
if (buf.length() > 0) {
nodes.add(new Text(buf.toString())); // depends on control dependency: [if], data = [none]
}
return nodes;
} } |
public class class_name {
protected boolean internalCanExpire()
{
boolean can = super.internalCanExpire();
if (can && _referenceCount > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "preventing expiry as references remain");
can = false;
}
return can;
} } | public class class_name {
protected boolean internalCanExpire()
{
boolean can = super.internalCanExpire();
if (can && _referenceCount > 0)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "preventing expiry as references remain");
can = false; // depends on control dependency: [if], data = [none]
}
return can;
} } |
public class class_name {
private List<Word> toWords(Node node){
Stack<String> stack = new Stack<>();
while(node != null){
stack.push(node.getText());
node = node.getParent();
}
int len = stack.size();
List<Word> list = new ArrayList<>(len);
for(int i=0; i<len; i++){
list.add(new Word(stack.pop()));
}
return list;
} } | public class class_name {
private List<Word> toWords(Node node){
Stack<String> stack = new Stack<>();
while(node != null){
stack.push(node.getText()); // depends on control dependency: [while], data = [(node]
node = node.getParent(); // depends on control dependency: [while], data = [none]
}
int len = stack.size();
List<Word> list = new ArrayList<>(len);
for(int i=0; i<len; i++){
list.add(new Word(stack.pop())); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public static SequenceSchema inferSequenceMulti(List<List<List<Writable>>> record) {
SequenceSchema.Builder builder = new SequenceSchema.Builder();
int minSequenceLength = record.get(0).size();
int maxSequenceLength = record.get(0).size();
for (int i = 0; i < record.size(); i++) {
if (record.get(i) instanceof DoubleWritable)
builder.addColumnDouble(String.valueOf(i));
else if (record.get(i) instanceof IntWritable)
builder.addColumnInteger(String.valueOf(i));
else if (record.get(i) instanceof LongWritable)
builder.addColumnLong(String.valueOf(i));
else if (record.get(i) instanceof FloatWritable)
builder.addColumnFloat(String.valueOf(i));
else
throw new IllegalStateException("Illegal writable for inferring schema of type "
+ record.get(i).getClass().toString() + " with record " + record.get(0));
builder.minSequenceLength(Math.min(record.get(i).size(), minSequenceLength));
builder.maxSequenceLength(Math.max(record.get(i).size(), maxSequenceLength));
}
return builder.build();
} } | public class class_name {
public static SequenceSchema inferSequenceMulti(List<List<List<Writable>>> record) {
SequenceSchema.Builder builder = new SequenceSchema.Builder();
int minSequenceLength = record.get(0).size();
int maxSequenceLength = record.get(0).size();
for (int i = 0; i < record.size(); i++) {
if (record.get(i) instanceof DoubleWritable)
builder.addColumnDouble(String.valueOf(i));
else if (record.get(i) instanceof IntWritable)
builder.addColumnInteger(String.valueOf(i));
else if (record.get(i) instanceof LongWritable)
builder.addColumnLong(String.valueOf(i));
else if (record.get(i) instanceof FloatWritable)
builder.addColumnFloat(String.valueOf(i));
else
throw new IllegalStateException("Illegal writable for inferring schema of type "
+ record.get(i).getClass().toString() + " with record " + record.get(0));
builder.minSequenceLength(Math.min(record.get(i).size(), minSequenceLength)); // depends on control dependency: [for], data = [i]
builder.maxSequenceLength(Math.max(record.get(i).size(), maxSequenceLength)); // depends on control dependency: [for], data = [i]
}
return builder.build();
} } |
public class class_name {
private void manageBlockEntity( DwgObject entity, double[] bPoint, Point2D insPoint,
double[] scale, double rot, int id, Vector dwgObjectsWithoutBlocks ) {
if (entity instanceof DwgArc) {
// System.out.println("Encuentra un arco dentro de un bloque ...");
DwgArc transformedEntity = new DwgArc();
double[] center = ((DwgArc) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double radius = ((DwgArc) entity).getRadius();
// System.out.println("radius = " + radius);
// System.out.println("scale[0] = " + scale[0]);
// System.out.println("scale[1] = " + scale[1]);
// System.out.println("rot = " + rot);
double transformedRadius = radius * scale[0];
double initAngle = ((DwgArc) entity).getInitAngle();
double endAngle = ((DwgArc) entity).getEndAngle();
// System.out.println("initAngle = " + initAngle);
// System.out.println("endAngle = " + endAngle);
// System.out.println("rot = " + rot);
double transformedInitAngle = initAngle + rot;
if (transformedInitAngle < 0) {
transformedInitAngle = transformedInitAngle + (2 * Math.PI);
} else if (transformedInitAngle > (2 * Math.PI)) {
transformedInitAngle = transformedInitAngle - (2 * Math.PI);
}
double transformedEndAngle = endAngle + rot;
if (transformedEndAngle < 0) {
transformedEndAngle = transformedEndAngle + (2 * Math.PI);
} else if (transformedEndAngle > (2 * Math.PI)) {
transformedEndAngle = transformedEndAngle - (2 * Math.PI);
}
transformedEntity = (DwgArc) ((DwgArc) entity).clone();
transformedEntity.setCenter(transformedCenter);
transformedEntity.setRadius(transformedRadius);
transformedEntity.setInitAngle(transformedInitAngle);
transformedEntity.setEndAngle(transformedEndAngle);
dwgObjectsWithoutBlocks.add(transformedEntity);
} else if (entity instanceof DwgCircle) {
// System.out.println("Encuentra un c�rculo dentro de un bloque ...");
DwgCircle transformedEntity = new DwgCircle();
double[] center = ((DwgCircle) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double radius = ((DwgCircle) entity).getRadius();
double transformedRadius = radius * scale[0];
transformedEntity = (DwgCircle) ((DwgCircle) entity).clone();
transformedEntity.setCenter(transformedCenter);
transformedEntity.setRadius(transformedRadius);
dwgObjectsWithoutBlocks.add(transformedEntity);
} else if (entity instanceof DwgEllipse) {
DwgEllipse transformedEntity = new DwgEllipse();
double[] center = ((DwgEllipse) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double[] majorAxisVector = ((DwgEllipse) entity).getMajorAxisVector();
double[] transformedMajorAxisVector = new double[]{majorAxisVector[0] * scale[0],
majorAxisVector[1] * scale[1], majorAxisVector[2] * scale[2]};
// TODO: Rotar un �ngulo rot el vector majorAxisVector fijado en
// center.
double axisRatio = ((DwgEllipse) entity).getAxisRatio();
double transformedAxisRatio = axisRatio;
double initAngle = ((DwgEllipse) entity).getInitAngle();
double endAngle = ((DwgEllipse) entity).getEndAngle();
double transformedInitAngle = initAngle + rot;
if (transformedInitAngle < 0) {
transformedInitAngle = transformedInitAngle + (2 * Math.PI);
} else if (transformedInitAngle > (2 * Math.PI)) {
transformedInitAngle = transformedInitAngle - (2 * Math.PI);
}
double transformedEndAngle = endAngle + rot;
if (transformedEndAngle < 0) {
transformedEndAngle = transformedEndAngle + (2 * Math.PI);
} else if (transformedEndAngle > (2 * Math.PI)) {
transformedEndAngle = transformedEndAngle - (2 * Math.PI);
}
transformedEntity = (DwgEllipse) ((DwgEllipse) entity).clone();
transformedEntity.setCenter(transformedCenter);
transformedEntity.setMajorAxisVector(transformedMajorAxisVector);
transformedEntity.setAxisRatio(transformedAxisRatio);
transformedEntity.setInitAngle(transformedInitAngle);
transformedEntity.setEndAngle(transformedEndAngle);
dwgObjectsWithoutBlocks.add(transformedEntity);
} else if (entity instanceof DwgLine) {
// System.out.println("Encuentra una l�nea dentro de un bloque ...");
DwgLine transformedEntity = new DwgLine();
double[] p1 = ((DwgLine) entity).getP1();
double[] p2 = ((DwgLine) entity).getP2();
Point2D pointAux = new Point2D.Double(p1[0] - bPoint[0], p1[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP1 = null;
if (((DwgLine) entity).isZflag()) {
double laZ = p1[2] * scale[2];
transformedP1 = new double[]{laX, laY, laZ};
} else {
transformedP1 = new double[]{laX, laY};
}
// double[] transformedP1 = new double[]{laX, laY};
pointAux = new Point2D.Double(p2[0] - bPoint[0], p2[1] - bPoint[1]);
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP2 = null;
if (((DwgLine) entity).isZflag()) {
double laZ = p2[2] * scale[2];
transformedP2 = new double[]{laX, laY, laZ};
} else {
transformedP2 = new double[]{laX, laY};
}
// double[] transformedP2 = new double[]{laX, laY};
transformedEntity = (DwgLine) ((DwgLine) entity).clone();
transformedEntity.setP1(transformedP1);
transformedEntity.setP2(transformedP2);
dwgObjectsWithoutBlocks.add(transformedEntity);
} else if (entity instanceof DwgLwPolyline) {
// System.out.println("Encuentra una DwgLwPolyline dentro de un bloque ...");
DwgLwPolyline transformedEntity = new DwgLwPolyline();
Point2D[] vertices = ((DwgLwPolyline) entity).getVertices();
if (vertices != null) {
Point2D[] transformedVertices = new Point2D[vertices.length];
for( int i = 0; i < vertices.length; i++ ) {
Point2D pointAux = new Point2D.Double(vertices[i].getX() - bPoint[0],
vertices[i].getY() - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
transformedVertices[i] = new Point2D.Double(laX, laY);
}
transformedEntity = (DwgLwPolyline) ((DwgLwPolyline) entity).clone();
transformedEntity.setVertices(transformedVertices);
transformedEntity.setElevation(((DwgLwPolyline) entity).getElevation() * scale[2]);
dwgObjectsWithoutBlocks.add(transformedEntity);
}
} else if (entity instanceof DwgMText) {
} else if (entity instanceof DwgPoint) {
} else if (entity instanceof DwgPolyline2D) {
// System.out.println("Encuentra una polil�nea dentro de un bloque ...");
DwgPolyline2D transformedEntity = new DwgPolyline2D();
Point2D[] vertices = ((DwgPolyline2D) entity).getPts();
if (vertices != null) {
Point2D[] transformedVertices = new Point2D[vertices.length];
for( int i = 0; i < vertices.length; i++ ) {
Point2D pointAux = new Point2D.Double(vertices[i].getX() - bPoint[0],
vertices[i].getY() - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
transformedVertices[i] = new Point2D.Double(laX, laY);
}
transformedEntity = (DwgPolyline2D) ((DwgPolyline2D) entity).clone();
transformedEntity.setPts(transformedVertices);
transformedEntity.setElevation(((DwgPolyline2D) entity).getElevation() * scale[2]);
dwgObjectsWithoutBlocks.add(transformedEntity);
}
} else if (entity instanceof DwgPolyline3D) {
} else if (entity instanceof DwgSolid) {
DwgSolid transformedEntity = new DwgSolid();
double[] corner1 = ((DwgSolid) entity).getCorner1();
double[] corner2 = ((DwgSolid) entity).getCorner2();
double[] corner3 = ((DwgSolid) entity).getCorner3();
double[] corner4 = ((DwgSolid) entity).getCorner4();
Point2D pointAux = new Point2D.Double(corner1[0] - bPoint[0], corner1[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP1 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner2[0] - bPoint[0], corner2[1] - bPoint[1]);
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP2 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner3[0] - bPoint[0], corner3[1] - bPoint[1]);
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP3 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner4[0] - bPoint[0], corner4[1] - bPoint[1]);
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP4 = new double[]{laX, laY};
transformedEntity = (DwgSolid) ((DwgSolid) entity).clone();
transformedEntity.setCorner1(transformedP1);
transformedEntity.setCorner2(transformedP2);
transformedEntity.setCorner3(transformedP3);
transformedEntity.setCorner4(transformedP4);
transformedEntity.setElevation(((DwgSolid) entity).getElevation() * scale[2]);
dwgObjectsWithoutBlocks.add(transformedEntity);
} else if (entity instanceof DwgSpline) {
} else if (entity instanceof DwgText) {
} else if (entity instanceof DwgInsert) {
// System.out.println("Encuentra un insert dentro de un bloque ...");
DwgInsert transformedEntity = new DwgInsert();
double[] p = ((DwgInsert) entity).getInsertionPoint();
Point2D point = new Point2D.Double(p[0], p[1]);
double[] newScale = ((DwgInsert) entity).getScale();
double newRot = ((DwgInsert) entity).getRotation();
int newBlockHandle = ((DwgInsert) entity).getBlockHeaderHandle();
Point2D pointAux = new Point2D.Double(point.getX() - bPoint[0], point.getY()
- bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = p[2] * scale[2];
Point2D newInsPoint = new Point2D.Double(laX, laY);
newScale = new double[]{scale[0] * newScale[0], scale[1] * newScale[1],
scale[2] * newScale[2]};
newRot = newRot + rot;
if (newRot < 0) {
newRot = newRot + (2 * Math.PI);
} else if (newRot > (2 * Math.PI)) {
newRot = newRot - (2 * Math.PI);
}
manageInsert(newInsPoint, newScale, newRot, newBlockHandle, id, dwgObjectsWithoutBlocks);
}
} } | public class class_name {
private void manageBlockEntity( DwgObject entity, double[] bPoint, Point2D insPoint,
double[] scale, double rot, int id, Vector dwgObjectsWithoutBlocks ) {
if (entity instanceof DwgArc) {
// System.out.println("Encuentra un arco dentro de un bloque ...");
DwgArc transformedEntity = new DwgArc();
double[] center = ((DwgArc) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double radius = ((DwgArc) entity).getRadius();
// System.out.println("radius = " + radius);
// System.out.println("scale[0] = " + scale[0]);
// System.out.println("scale[1] = " + scale[1]);
// System.out.println("rot = " + rot);
double transformedRadius = radius * scale[0];
double initAngle = ((DwgArc) entity).getInitAngle();
double endAngle = ((DwgArc) entity).getEndAngle();
// System.out.println("initAngle = " + initAngle);
// System.out.println("endAngle = " + endAngle);
// System.out.println("rot = " + rot);
double transformedInitAngle = initAngle + rot;
if (transformedInitAngle < 0) {
transformedInitAngle = transformedInitAngle + (2 * Math.PI); // depends on control dependency: [if], data = [none]
} else if (transformedInitAngle > (2 * Math.PI)) {
transformedInitAngle = transformedInitAngle - (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
double transformedEndAngle = endAngle + rot;
if (transformedEndAngle < 0) {
transformedEndAngle = transformedEndAngle + (2 * Math.PI); // depends on control dependency: [if], data = [none]
} else if (transformedEndAngle > (2 * Math.PI)) {
transformedEndAngle = transformedEndAngle - (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
transformedEntity = (DwgArc) ((DwgArc) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setCenter(transformedCenter); // depends on control dependency: [if], data = [none]
transformedEntity.setRadius(transformedRadius); // depends on control dependency: [if], data = [none]
transformedEntity.setInitAngle(transformedInitAngle); // depends on control dependency: [if], data = [none]
transformedEntity.setEndAngle(transformedEndAngle); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof DwgCircle) {
// System.out.println("Encuentra un c�rculo dentro de un bloque ...");
DwgCircle transformedEntity = new DwgCircle();
double[] center = ((DwgCircle) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double radius = ((DwgCircle) entity).getRadius();
double transformedRadius = radius * scale[0];
transformedEntity = (DwgCircle) ((DwgCircle) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setCenter(transformedCenter); // depends on control dependency: [if], data = [none]
transformedEntity.setRadius(transformedRadius); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof DwgEllipse) {
DwgEllipse transformedEntity = new DwgEllipse();
double[] center = ((DwgEllipse) entity).getCenter();
Point2D pointAux = new Point2D.Double(center[0] - bPoint[0], center[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = center[2] * scale[2];
double[] transformedCenter = new double[]{laX, laY, laZ};
double[] majorAxisVector = ((DwgEllipse) entity).getMajorAxisVector();
double[] transformedMajorAxisVector = new double[]{majorAxisVector[0] * scale[0],
majorAxisVector[1] * scale[1], majorAxisVector[2] * scale[2]};
// TODO: Rotar un �ngulo rot el vector majorAxisVector fijado en
// center.
double axisRatio = ((DwgEllipse) entity).getAxisRatio();
double transformedAxisRatio = axisRatio;
double initAngle = ((DwgEllipse) entity).getInitAngle();
double endAngle = ((DwgEllipse) entity).getEndAngle();
double transformedInitAngle = initAngle + rot;
if (transformedInitAngle < 0) {
transformedInitAngle = transformedInitAngle + (2 * Math.PI); // depends on control dependency: [if], data = [none]
} else if (transformedInitAngle > (2 * Math.PI)) {
transformedInitAngle = transformedInitAngle - (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
double transformedEndAngle = endAngle + rot;
if (transformedEndAngle < 0) {
transformedEndAngle = transformedEndAngle + (2 * Math.PI); // depends on control dependency: [if], data = [none]
} else if (transformedEndAngle > (2 * Math.PI)) {
transformedEndAngle = transformedEndAngle - (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
transformedEntity = (DwgEllipse) ((DwgEllipse) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setCenter(transformedCenter); // depends on control dependency: [if], data = [none]
transformedEntity.setMajorAxisVector(transformedMajorAxisVector); // depends on control dependency: [if], data = [none]
transformedEntity.setAxisRatio(transformedAxisRatio); // depends on control dependency: [if], data = [none]
transformedEntity.setInitAngle(transformedInitAngle); // depends on control dependency: [if], data = [none]
transformedEntity.setEndAngle(transformedEndAngle); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof DwgLine) {
// System.out.println("Encuentra una l�nea dentro de un bloque ...");
DwgLine transformedEntity = new DwgLine();
double[] p1 = ((DwgLine) entity).getP1();
double[] p2 = ((DwgLine) entity).getP2();
Point2D pointAux = new Point2D.Double(p1[0] - bPoint[0], p1[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP1 = null;
if (((DwgLine) entity).isZflag()) {
double laZ = p1[2] * scale[2];
transformedP1 = new double[]{laX, laY, laZ}; // depends on control dependency: [if], data = [none]
} else {
transformedP1 = new double[]{laX, laY}; // depends on control dependency: [if], data = [none]
}
// double[] transformedP1 = new double[]{laX, laY};
pointAux = new Point2D.Double(p2[0] - bPoint[0], p2[1] - bPoint[1]); // depends on control dependency: [if], data = [none]
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot)); // depends on control dependency: [if], data = [none]
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot)); // depends on control dependency: [if], data = [none]
double[] transformedP2 = null;
if (((DwgLine) entity).isZflag()) {
double laZ = p2[2] * scale[2];
transformedP2 = new double[]{laX, laY, laZ}; // depends on control dependency: [if], data = [none]
} else {
transformedP2 = new double[]{laX, laY}; // depends on control dependency: [if], data = [none]
}
// double[] transformedP2 = new double[]{laX, laY};
transformedEntity = (DwgLine) ((DwgLine) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setP1(transformedP1); // depends on control dependency: [if], data = [none]
transformedEntity.setP2(transformedP2); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof DwgLwPolyline) {
// System.out.println("Encuentra una DwgLwPolyline dentro de un bloque ...");
DwgLwPolyline transformedEntity = new DwgLwPolyline();
Point2D[] vertices = ((DwgLwPolyline) entity).getVertices();
if (vertices != null) {
Point2D[] transformedVertices = new Point2D[vertices.length];
for( int i = 0; i < vertices.length; i++ ) {
Point2D pointAux = new Point2D.Double(vertices[i].getX() - bPoint[0],
vertices[i].getY() - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
transformedVertices[i] = new Point2D.Double(laX, laY); // depends on control dependency: [for], data = [i]
}
transformedEntity = (DwgLwPolyline) ((DwgLwPolyline) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setVertices(transformedVertices); // depends on control dependency: [if], data = [none]
transformedEntity.setElevation(((DwgLwPolyline) entity).getElevation() * scale[2]); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
}
} else if (entity instanceof DwgMText) {
} else if (entity instanceof DwgPoint) {
} else if (entity instanceof DwgPolyline2D) {
// System.out.println("Encuentra una polil�nea dentro de un bloque ...");
DwgPolyline2D transformedEntity = new DwgPolyline2D();
Point2D[] vertices = ((DwgPolyline2D) entity).getPts();
if (vertices != null) {
Point2D[] transformedVertices = new Point2D[vertices.length];
for( int i = 0; i < vertices.length; i++ ) {
Point2D pointAux = new Point2D.Double(vertices[i].getX() - bPoint[0],
vertices[i].getY() - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
transformedVertices[i] = new Point2D.Double(laX, laY); // depends on control dependency: [for], data = [i]
}
transformedEntity = (DwgPolyline2D) ((DwgPolyline2D) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setPts(transformedVertices); // depends on control dependency: [if], data = [none]
transformedEntity.setElevation(((DwgPolyline2D) entity).getElevation() * scale[2]); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
}
} else if (entity instanceof DwgPolyline3D) {
} else if (entity instanceof DwgSolid) {
DwgSolid transformedEntity = new DwgSolid();
double[] corner1 = ((DwgSolid) entity).getCorner1();
double[] corner2 = ((DwgSolid) entity).getCorner2();
double[] corner3 = ((DwgSolid) entity).getCorner3();
double[] corner4 = ((DwgSolid) entity).getCorner4();
Point2D pointAux = new Point2D.Double(corner1[0] - bPoint[0], corner1[1] - bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double[] transformedP1 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner2[0] - bPoint[0], corner2[1] - bPoint[1]); // depends on control dependency: [if], data = [none]
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot)); // depends on control dependency: [if], data = [none]
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot)); // depends on control dependency: [if], data = [none]
double[] transformedP2 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner3[0] - bPoint[0], corner3[1] - bPoint[1]); // depends on control dependency: [if], data = [none]
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot)); // depends on control dependency: [if], data = [none]
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot)); // depends on control dependency: [if], data = [none]
double[] transformedP3 = new double[]{laX, laY};
pointAux = new Point2D.Double(corner4[0] - bPoint[0], corner4[1] - bPoint[1]); // depends on control dependency: [if], data = [none]
laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot)); // depends on control dependency: [if], data = [none]
laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot)); // depends on control dependency: [if], data = [none]
double[] transformedP4 = new double[]{laX, laY};
transformedEntity = (DwgSolid) ((DwgSolid) entity).clone(); // depends on control dependency: [if], data = [none]
transformedEntity.setCorner1(transformedP1); // depends on control dependency: [if], data = [none]
transformedEntity.setCorner2(transformedP2); // depends on control dependency: [if], data = [none]
transformedEntity.setCorner3(transformedP3); // depends on control dependency: [if], data = [none]
transformedEntity.setCorner4(transformedP4); // depends on control dependency: [if], data = [none]
transformedEntity.setElevation(((DwgSolid) entity).getElevation() * scale[2]); // depends on control dependency: [if], data = [none]
dwgObjectsWithoutBlocks.add(transformedEntity); // depends on control dependency: [if], data = [none]
} else if (entity instanceof DwgSpline) {
} else if (entity instanceof DwgText) {
} else if (entity instanceof DwgInsert) {
// System.out.println("Encuentra un insert dentro de un bloque ...");
DwgInsert transformedEntity = new DwgInsert();
double[] p = ((DwgInsert) entity).getInsertionPoint();
Point2D point = new Point2D.Double(p[0], p[1]);
double[] newScale = ((DwgInsert) entity).getScale();
double newRot = ((DwgInsert) entity).getRotation();
int newBlockHandle = ((DwgInsert) entity).getBlockHeaderHandle();
Point2D pointAux = new Point2D.Double(point.getX() - bPoint[0], point.getY()
- bPoint[1]);
double laX = insPoint.getX()
+ ((pointAux.getX() * scale[0]) * Math.cos(rot) + (pointAux.getY() * scale[1])
* (-1) * Math.sin(rot));
double laY = insPoint.getY()
+ ((pointAux.getX() * scale[0]) * Math.sin(rot) + (pointAux.getY() * scale[1])
* Math.cos(rot));
double laZ = p[2] * scale[2];
Point2D newInsPoint = new Point2D.Double(laX, laY);
newScale = new double[]{scale[0] * newScale[0], scale[1] * newScale[1],
scale[2] * newScale[2]}; // depends on control dependency: [if], data = [none]
newRot = newRot + rot; // depends on control dependency: [if], data = [none]
if (newRot < 0) {
newRot = newRot + (2 * Math.PI); // depends on control dependency: [if], data = [none]
} else if (newRot > (2 * Math.PI)) {
newRot = newRot - (2 * Math.PI); // depends on control dependency: [if], data = [none]
}
manageInsert(newInsPoint, newScale, newRot, newBlockHandle, id, dwgObjectsWithoutBlocks); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getParameterByReflection(Object obj, String param)
{
Object value = null;
try {
java.lang.reflect.Method method = obj.getClass().getMethod("getParameter", String.class);
if (method != null)
value = method.invoke(obj, param);
} catch (Exception e) {
e.printStackTrace();
}
if (value == null)
return null;
else
return value.toString();
} } | public class class_name {
public String getParameterByReflection(Object obj, String param)
{
Object value = null;
try {
java.lang.reflect.Method method = obj.getClass().getMethod("getParameter", String.class);
if (method != null)
value = method.invoke(obj, param);
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
if (value == null)
return null;
else
return value.toString();
} } |
public class class_name {
private boolean readAndUpdateVersion(CurrentInProgressMetadataWritable target)
throws IOException {
Stat stat = new Stat();
try {
byte[] data = zooKeeper.getData(fullyQualifiedZNode, false, stat);
expectedZNodeVersion.set(stat.getVersion());
if (data != null) {
WritableUtil.readWritableFromByteArray(data, target);
return true;
}
} catch (KeeperException e) {
keeperException("Unrecoverable ZooKeeper error reading from " +
fullyQualifiedZNode, e);
} catch (InterruptedException e) {
interruptedException("Interrupted reading from " + fullyQualifiedZNode,
e);
}
return false;
} } | public class class_name {
private boolean readAndUpdateVersion(CurrentInProgressMetadataWritable target)
throws IOException {
Stat stat = new Stat();
try {
byte[] data = zooKeeper.getData(fullyQualifiedZNode, false, stat);
expectedZNodeVersion.set(stat.getVersion());
if (data != null) {
WritableUtil.readWritableFromByteArray(data, target); // depends on control dependency: [if], data = [(data]
return true; // depends on control dependency: [if], data = [none]
}
} catch (KeeperException e) {
keeperException("Unrecoverable ZooKeeper error reading from " +
fullyQualifiedZNode, e);
} catch (InterruptedException e) {
interruptedException("Interrupted reading from " + fullyQualifiedZNode,
e);
}
return false;
} } |
public class class_name {
@NotNull
public final List<GeneratorConfig> findGeneratorsForParser(@NotNull final String parserName) {
Contract.requireArgNotNull("parserName", parserName);
final List<GeneratorConfig> list = new ArrayList<>();
final List<GeneratorConfig> gcList = generators.getList();
for (final GeneratorConfig gc : gcList) {
if (gc.getParser().equals(parserName)) {
list.add(gc);
}
}
return list;
} } | public class class_name {
@NotNull
public final List<GeneratorConfig> findGeneratorsForParser(@NotNull final String parserName) {
Contract.requireArgNotNull("parserName", parserName);
final List<GeneratorConfig> list = new ArrayList<>();
final List<GeneratorConfig> gcList = generators.getList();
for (final GeneratorConfig gc : gcList) {
if (gc.getParser().equals(parserName)) {
list.add(gc);
// depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
public void marshall(ConnectionsList connectionsList, ProtocolMarshaller protocolMarshaller) {
if (connectionsList == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(connectionsList.getConnections(), CONNECTIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ConnectionsList connectionsList, ProtocolMarshaller protocolMarshaller) {
if (connectionsList == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(connectionsList.getConnections(), CONNECTIONS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isRangeSet() {
for (int i = 0; i < getDimensions(); i++) {
if( valueMin[i] == 0 && valueMax[i] == 0 ) {
return false;
}
}
return true;
} } | public class class_name {
public boolean isRangeSet() {
for (int i = 0; i < getDimensions(); i++) {
if( valueMin[i] == 0 && valueMax[i] == 0 ) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
LOG.trace("existsAll(Get)");
try (Scope scope = TRACER.spanBuilder("BigtableTable.existsAll").startScopedSpan()) {
addBatchSizeAnnotation(gets);
List<Get> existGets = new ArrayList<>(gets.size());
for(Get get : gets ){
existGets.add(GetAdapter.setCheckExistenceOnly(get));
}
return getBatchExecutor().exists(existGets);
}
} } | public class class_name {
@Override
public boolean[] existsAll(List<Get> gets) throws IOException {
LOG.trace("existsAll(Get)");
try (Scope scope = TRACER.spanBuilder("BigtableTable.existsAll").startScopedSpan()) {
addBatchSizeAnnotation(gets);
List<Get> existGets = new ArrayList<>(gets.size());
for(Get get : gets ){
existGets.add(GetAdapter.setCheckExistenceOnly(get)); // depends on control dependency: [for], data = [get]
}
return getBatchExecutor().exists(existGets);
}
} } |
public class class_name {
public void wrapDescription(StringBuilder out, int indent, int currentLineIndent, String description) {
int max = commander.getColumnSize();
String[] words = description.split(" ");
int current = currentLineIndent;
for (int i = 0; i < words.length; i++) {
String word = words[i];
if (word.length() > max || current + 1 + word.length() <= max) {
out.append(word);
current += word.length();
if (i != words.length - 1) {
out.append(" ");
current++;
}
} else {
out.append("\n").append(s(indent)).append(word).append(" ");
current = indent + word.length() + 1;
}
}
} } | public class class_name {
public void wrapDescription(StringBuilder out, int indent, int currentLineIndent, String description) {
int max = commander.getColumnSize();
String[] words = description.split(" ");
int current = currentLineIndent;
for (int i = 0; i < words.length; i++) {
String word = words[i];
if (word.length() > max || current + 1 + word.length() <= max) {
out.append(word); // depends on control dependency: [if], data = [none]
current += word.length(); // depends on control dependency: [if], data = [none]
if (i != words.length - 1) {
out.append(" "); // depends on control dependency: [if], data = [none]
current++; // depends on control dependency: [if], data = [none]
}
} else {
out.append("\n").append(s(indent)).append(word).append(" "); // depends on control dependency: [if], data = [none]
current = indent + word.length() + 1; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private Class loadTagFile(Compiler compiler,
String tagFilePath, TagInfo tagInfo,
PageInfo parentPageInfo)
throws JasperException {
JspCompilationContext ctxt = compiler.getCompilationContext();
JspRuntimeContext rctxt = ctxt.getRuntimeContext();
synchronized(rctxt) {
JspServletWrapper wrapper =
(JspServletWrapper) rctxt.getWrapper(tagFilePath);
if (wrapper == null) {
wrapper = new JspServletWrapper(ctxt.getServletContext(),
ctxt.getOptions(),
tagFilePath,
tagInfo,
ctxt.getRuntimeContext(),
(URL) ctxt.getTagFileJarUrls().get(tagFilePath));
rctxt.addWrapper(tagFilePath,wrapper);
// Use same classloader and classpath for compiling tag files
wrapper.getJspEngineContext().setClassLoader(
(URLClassLoader) ctxt.getClassLoader());
wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath());
}
else {
// Make sure that JspCompilationContext gets the latest TagInfo
// for the tag file. TagInfo instance was created the last
// time the tag file was scanned for directives, and the tag
// file may have been modified since then.
wrapper.getJspEngineContext().setTagInfo(tagInfo);
}
Class tagClazz;
int tripCount = wrapper.incTripCount();
try {
if (tripCount > 0) {
// When tripCount is greater than zero, a circular
// dependency exists. The circularily dependant tag
// file is compiled in prototype mode, to avoid infinite
// recursion.
JspServletWrapper tempWrapper
= new JspServletWrapper(ctxt.getServletContext(),
ctxt.getOptions(),
tagFilePath,
tagInfo,
ctxt.getRuntimeContext(),
(URL) ctxt.getTagFileJarUrls().get(tagFilePath));
tagClazz = tempWrapper.loadTagFilePrototype();
tempVector.add(
tempWrapper.getJspEngineContext().getCompiler());
} else {
tagClazz = wrapper.loadTagFile();
}
} finally {
wrapper.decTripCount();
}
// Add the dependants for this tag file to its parent's
// dependant list. The only reliable dependency information
// can only be obtained from the tag instance.
try {
Object tagIns = tagClazz.newInstance();
if (tagIns instanceof JspSourceDependent) {
for (String dependant:
((JspSourceDependent)tagIns).getDependants()) {
parentPageInfo.addDependant(dependant);
}
}
} catch (Exception e) {
// ignore errors
}
return tagClazz;
}
} } | public class class_name {
private Class loadTagFile(Compiler compiler,
String tagFilePath, TagInfo tagInfo,
PageInfo parentPageInfo)
throws JasperException {
JspCompilationContext ctxt = compiler.getCompilationContext();
JspRuntimeContext rctxt = ctxt.getRuntimeContext();
synchronized(rctxt) {
JspServletWrapper wrapper =
(JspServletWrapper) rctxt.getWrapper(tagFilePath);
if (wrapper == null) {
wrapper = new JspServletWrapper(ctxt.getServletContext(),
ctxt.getOptions(),
tagFilePath,
tagInfo,
ctxt.getRuntimeContext(),
(URL) ctxt.getTagFileJarUrls().get(tagFilePath)); // depends on control dependency: [if], data = [none]
rctxt.addWrapper(tagFilePath,wrapper); // depends on control dependency: [if], data = [none]
// Use same classloader and classpath for compiling tag files
wrapper.getJspEngineContext().setClassLoader(
(URLClassLoader) ctxt.getClassLoader()); // depends on control dependency: [if], data = [none]
wrapper.getJspEngineContext().setClassPath(ctxt.getClassPath()); // depends on control dependency: [if], data = [none]
}
else {
// Make sure that JspCompilationContext gets the latest TagInfo
// for the tag file. TagInfo instance was created the last
// time the tag file was scanned for directives, and the tag
// file may have been modified since then.
wrapper.getJspEngineContext().setTagInfo(tagInfo); // depends on control dependency: [if], data = [none]
}
Class tagClazz;
int tripCount = wrapper.incTripCount();
try {
if (tripCount > 0) {
// When tripCount is greater than zero, a circular
// dependency exists. The circularily dependant tag
// file is compiled in prototype mode, to avoid infinite
// recursion.
JspServletWrapper tempWrapper
= new JspServletWrapper(ctxt.getServletContext(),
ctxt.getOptions(),
tagFilePath,
tagInfo,
ctxt.getRuntimeContext(),
(URL) ctxt.getTagFileJarUrls().get(tagFilePath));
tagClazz = tempWrapper.loadTagFilePrototype(); // depends on control dependency: [if], data = [none]
tempVector.add(
tempWrapper.getJspEngineContext().getCompiler()); // depends on control dependency: [if], data = [none]
} else {
tagClazz = wrapper.loadTagFile(); // depends on control dependency: [if], data = [none]
}
} finally {
wrapper.decTripCount();
}
// Add the dependants for this tag file to its parent's
// dependant list. The only reliable dependency information
// can only be obtained from the tag instance.
try {
Object tagIns = tagClazz.newInstance();
if (tagIns instanceof JspSourceDependent) {
for (String dependant:
((JspSourceDependent)tagIns).getDependants()) {
parentPageInfo.addDependant(dependant); // depends on control dependency: [for], data = [dependant]
}
}
} catch (Exception e) {
// ignore errors
} // depends on control dependency: [catch], data = [none]
return tagClazz;
}
} } |
public class class_name {
public static void convolve(Kernel2D_F32 kernel,
InterleavedF32 input, InterleavedF32 output , ImageBorder_IL_F32 border ) {
InputSanityCheck.checkSameShapeB(input, output);
boolean processed = BOverrideConvolveImage.invokeNativeConvolve(kernel,input,output,border);
if( !processed ) {
border.setImage(input);
ConvolveImageNoBorder.convolve(kernel,input,output);
ConvolveJustBorder_General_IL.convolve(kernel, border,output);
}
} } | public class class_name {
public static void convolve(Kernel2D_F32 kernel,
InterleavedF32 input, InterleavedF32 output , ImageBorder_IL_F32 border ) {
InputSanityCheck.checkSameShapeB(input, output);
boolean processed = BOverrideConvolveImage.invokeNativeConvolve(kernel,input,output,border);
if( !processed ) {
border.setImage(input); // depends on control dependency: [if], data = [none]
ConvolveImageNoBorder.convolve(kernel,input,output); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_IL.convolve(kernel, border,output); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
JcrPropertyDefinition findPropertyDefinition( JcrSession session,
Name primaryTypeName,
Collection<Name> mixinTypeNames,
Name propertyName,
Value value,
boolean checkMultiValuedDefinitions,
boolean skipProtected,
boolean checkTypeAndConstraints ) {
boolean setToEmpty = value == null;
/*
* We use this flag to indicate that there was a definition encountered with the same name. If
* a named definition (or definitions - for example the same node type could define a LONG and BOOLEAN
* version of the same property) is encountered and no match is found for the name, then processing should not
* proceed. If processing did proceed, a residual definition might be found and matched. This would
* lead to a situation where a node defined a type for a named property, but contained a property with
* the same name and the wrong type.
*/
boolean matchedOnName = false;
// Look for a single-value property definition on the primary type that matches by name and type ...
JcrNodeType primaryType = getNodeType(primaryTypeName);
if (primaryType != null) {
for (JcrPropertyDefinition definition : primaryType.allSingleValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (matchedOnName) {
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allSingleValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
if (checkMultiValuedDefinitions) {
// Look for a multi-value property definition on the primary type that matches by name and type ...
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
return null;
}
}
// Look for a single-value property definition on the mixin types that matches by name and type ...
List<JcrNodeType> mixinTypes = null;
if (mixinTypeNames != null) {
mixinTypes = new LinkedList<JcrNodeType>();
for (Name mixinTypeName : mixinTypeNames) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
mixinTypes.add(mixinType);
for (JcrPropertyDefinition definition : mixinType.allSingleValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (matchedOnName) {
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allSingleValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
if (checkMultiValuedDefinitions) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE
&& definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
return null;
}
}
}
if (checkMultiValuedDefinitions) {
if (primaryType != null) {
// Look for a multi-value property definition on the primary type that matches by name and type ...
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
if (matchedOnName) return null;
if (mixinTypeNames != null) {
mixinTypes = new LinkedList<JcrNodeType>();
for (Name mixinTypeName : mixinTypeNames) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
mixinTypes.add(mixinType);
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true;
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition;
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition;
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
}
if (matchedOnName) return null;
}
// Nothing was found, so look for residual property definitions ...
if (!propertyName.equals(JcrNodeType.RESIDUAL_NAME)) return findPropertyDefinition(session, primaryTypeName,
mixinTypeNames,
JcrNodeType.RESIDUAL_NAME, value,
checkMultiValuedDefinitions,
skipProtected, checkTypeAndConstraints);
return null;
} } | public class class_name {
JcrPropertyDefinition findPropertyDefinition( JcrSession session,
Name primaryTypeName,
Collection<Name> mixinTypeNames,
Name propertyName,
Value value,
boolean checkMultiValuedDefinitions,
boolean skipProtected,
boolean checkTypeAndConstraints ) {
boolean setToEmpty = value == null;
/*
* We use this flag to indicate that there was a definition encountered with the same name. If
* a named definition (or definitions - for example the same node type could define a LONG and BOOLEAN
* version of the same property) is encountered and no match is found for the name, then processing should not
* proceed. If processing did proceed, a residual definition might be found and matched. This would
* lead to a situation where a node defined a type for a named property, but contained a property with
* the same name and the wrong type.
*/
boolean matchedOnName = false;
// Look for a single-value property definition on the primary type that matches by name and type ...
JcrNodeType primaryType = getNodeType(primaryTypeName);
if (primaryType != null) {
for (JcrPropertyDefinition definition : primaryType.allSingleValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (matchedOnName) {
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allSingleValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
if (checkMultiValuedDefinitions) {
// Look for a multi-value property definition on the primary type that matches by name and type ...
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
return null; // depends on control dependency: [if], data = [none]
}
}
// Look for a single-value property definition on the mixin types that matches by name and type ...
List<JcrNodeType> mixinTypes = null;
if (mixinTypeNames != null) {
mixinTypes = new LinkedList<JcrNodeType>(); // depends on control dependency: [if], data = [none]
for (Name mixinTypeName : mixinTypeNames) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
mixinTypes.add(mixinType); // depends on control dependency: [for], data = [none]
for (JcrPropertyDefinition definition : mixinType.allSingleValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (matchedOnName) {
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allSingleValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
if (checkMultiValuedDefinitions) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE
&& definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
return null; // depends on control dependency: [if], data = [none]
}
}
}
if (checkMultiValuedDefinitions) {
if (primaryType != null) {
// Look for a multi-value property definition on the primary type that matches by name and type ...
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : primaryType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
if (matchedOnName) return null;
if (mixinTypeNames != null) {
mixinTypes = new LinkedList<JcrNodeType>(); // depends on control dependency: [if], data = [none]
for (Name mixinTypeName : mixinTypeNames) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
mixinTypes.add(mixinType); // depends on control dependency: [for], data = [none]
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
if (setToEmpty) {
if (!definition.isMandatory()) return definition;
// Otherwise this definition doesn't work, so continue with the next ...
continue;
}
assert value != null;
// We can use the definition if it matches the type and satisfies the constraints ...
int type = definition.getRequiredType();
// Don't check constraints on reference properties
if (type == PropertyType.REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.WEAKREFERENCE && type == value.getType()) return definition;
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && type == value.getType()) return definition;
if (type == PropertyType.UNDEFINED || type == value.getType()) {
if (!checkTypeAndConstraints) return definition;
if (definition.satisfiesConstraints(value, session)) return definition;
}
}
if (value != null) {
for (JcrPropertyDefinition definition : mixinType.allMultiValuePropertyDefinitions(propertyName)) {
matchedOnName = true; // depends on control dependency: [for], data = [none]
// See if the definition allows the value ...
if (skipProtected && definition.isProtected()) return null;
assert definition.getRequiredType() != PropertyType.UNDEFINED;
// Don't check constraints on reference properties
int type = definition.getRequiredType();
if (type == PropertyType.REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == PropertyType.WEAKREFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (type == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE && definition.canCastToType(value)) {
return definition; // depends on control dependency: [if], data = [none]
}
if (!checkTypeAndConstraints) return definition;
if (definition.canCastToTypeAndSatisfyConstraints(value, session)) return definition;
}
}
}
}
if (matchedOnName) return null;
}
// Nothing was found, so look for residual property definitions ...
if (!propertyName.equals(JcrNodeType.RESIDUAL_NAME)) return findPropertyDefinition(session, primaryTypeName,
mixinTypeNames,
JcrNodeType.RESIDUAL_NAME, value,
checkMultiValuedDefinitions,
skipProtected, checkTypeAndConstraints);
return null;
} } |
public class class_name {
private boolean checkUrl(String url) {
try {
URI uri = new URI(url);
return uri.isAbsolute();
} catch (URISyntaxException e) {
return false;
}
} } | public class class_name {
private boolean checkUrl(String url) {
try {
URI uri = new URI(url);
return uri.isAbsolute(); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static <K, V> Collection<Entry<K, V>> constrainedEntries(
Collection<Entry<K, V>> entries, MapConstraint<? super K, ? super V> constraint) {
if (entries instanceof Set) {
return constrainedEntrySet((Set<Entry<K, V>>) entries, constraint);
}
return new ConstrainedEntries<K, V>(entries, constraint);
} } | public class class_name {
private static <K, V> Collection<Entry<K, V>> constrainedEntries(
Collection<Entry<K, V>> entries, MapConstraint<? super K, ? super V> constraint) {
if (entries instanceof Set) {
return constrainedEntrySet((Set<Entry<K, V>>) entries, constraint); // depends on control dependency: [if], data = [none]
}
return new ConstrainedEntries<K, V>(entries, constraint);
} } |
public class class_name {
public void marshall(GetCompatibleElasticsearchVersionsRequest getCompatibleElasticsearchVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (getCompatibleElasticsearchVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCompatibleElasticsearchVersionsRequest.getDomainName(), DOMAINNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetCompatibleElasticsearchVersionsRequest getCompatibleElasticsearchVersionsRequest, ProtocolMarshaller protocolMarshaller) {
if (getCompatibleElasticsearchVersionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCompatibleElasticsearchVersionsRequest.getDomainName(), DOMAINNAME_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 Property<Properties<T>> getOrCreateProperty()
{
List<Node> nodeList = childNode.get("property");
if (nodeList != null && nodeList.size() > 0)
{
return new PropertyImpl<Properties<T>>(this, "property", childNode, nodeList.get(0));
}
return createProperty();
} } | public class class_name {
public Property<Properties<T>> getOrCreateProperty()
{
List<Node> nodeList = childNode.get("property");
if (nodeList != null && nodeList.size() > 0)
{
return new PropertyImpl<Properties<T>>(this, "property", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createProperty();
} } |
public class class_name {
@SuppressWarnings("deprecation")
public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) {
d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds());
if (start == null || end == null) {
return false;
}
if (start.before(end) && (!(d.after(start) && d.before(end)))) {
return false;
}
if (end.before(start) && (!(d.after(end) || d.before(start)))) {
return false;
}
return true;
} } | public class class_name {
@SuppressWarnings("deprecation")
public static boolean isTimeInRange(java.sql.Time start, java.sql.Time end, java.util.Date d) {
d = new java.sql.Time(d.getHours(), d.getMinutes(), d.getSeconds());
if (start == null || end == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (start.before(end) && (!(d.after(start) && d.before(end)))) {
return false; // depends on control dependency: [if], data = [none]
}
if (end.before(start) && (!(d.after(end) || d.before(start)))) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public void marshall(DisablePolicyTypeRequest disablePolicyTypeRequest, ProtocolMarshaller protocolMarshaller) {
if (disablePolicyTypeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disablePolicyTypeRequest.getRootId(), ROOTID_BINDING);
protocolMarshaller.marshall(disablePolicyTypeRequest.getPolicyType(), POLICYTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DisablePolicyTypeRequest disablePolicyTypeRequest, ProtocolMarshaller protocolMarshaller) {
if (disablePolicyTypeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disablePolicyTypeRequest.getRootId(), ROOTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(disablePolicyTypeRequest.getPolicyType(), POLICYTYPE_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 LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
} } | public class class_name {
public static LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public void start () {
if (config.activationKey != null) {
input().keyboardEvents.connect(new Slot<Keyboard.Event>() {
public void onEmit (Keyboard.Event event) {
if (event instanceof Keyboard.KeyEvent) {
Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
if (kevent.key == config.activationKey && kevent.down) {
toggleActivation();
}
}
}
});
}
// make a note of the main thread
synchronized (this) {
mainThread = Thread.currentThread();
}
// run the game loop
loop();
// let the game run any of its exit hooks
dispatchEvent(lifecycle, Lifecycle.EXIT);
// shutdown our thread pool
try {
pool.shutdown();
pool.awaitTermination(1, TimeUnit.SECONDS);
} catch (InterruptedException ie) {
// nothing to do here except go ahead and exit
}
// and finally stick a fork in the JVM
System.exit(0);
} } | public class class_name {
public void start () {
if (config.activationKey != null) {
input().keyboardEvents.connect(new Slot<Keyboard.Event>() {
public void onEmit (Keyboard.Event event) {
if (event instanceof Keyboard.KeyEvent) {
Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
if (kevent.key == config.activationKey && kevent.down) {
toggleActivation(); // depends on control dependency: [if], data = [none]
}
}
}
}); // depends on control dependency: [if], data = [none]
}
// make a note of the main thread
synchronized (this) {
mainThread = Thread.currentThread();
}
// run the game loop
loop();
// let the game run any of its exit hooks
dispatchEvent(lifecycle, Lifecycle.EXIT);
// shutdown our thread pool
try {
pool.shutdown(); // depends on control dependency: [try], data = [none]
pool.awaitTermination(1, TimeUnit.SECONDS); // depends on control dependency: [try], data = [none]
} catch (InterruptedException ie) {
// nothing to do here except go ahead and exit
} // depends on control dependency: [catch], data = [none]
// and finally stick a fork in the JVM
System.exit(0);
} } |
public class class_name {
public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedU8 output ) {
if( output == null ) {
output = new InterleavedU8(width,height,3);
} else {
output.reshape(width, height, 3);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output);
} else {
ImplConvertNV21.nv21ToInterleaved_U8(data, output);
}
return output;
} } | public class class_name {
public static InterleavedU8 nv21ToInterleaved( byte[] data , int width , int height ,
InterleavedU8 output ) {
if( output == null ) {
output = new InterleavedU8(width,height,3); // depends on control dependency: [if], data = [none]
} else {
output.reshape(width, height, 3); // depends on control dependency: [if], data = [none]
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToInterleaved_U8(data, output); // depends on control dependency: [if], data = [none]
} else {
ImplConvertNV21.nv21ToInterleaved_U8(data, output); // depends on control dependency: [if], data = [none]
}
return output;
} } |
public class class_name {
public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData);
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh);
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative());
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
mPostEffects.addPass(rpass);
}
} } | public class class_name {
public void addPostEffect(GVRMaterial postEffectData) {
GVRContext ctx = getGVRContext();
if (mPostEffects == null)
{
mPostEffects = new GVRRenderData(ctx, postEffectData); // depends on control dependency: [if], data = [none]
GVRMesh dummyMesh = new GVRMesh(getGVRContext(),"float3 a_position float2 a_texcoord");
mPostEffects.setMesh(dummyMesh); // depends on control dependency: [if], data = [none]
NativeCamera.setPostEffect(getNative(), mPostEffects.getNative()); // depends on control dependency: [if], data = [none]
mPostEffects.setCullFace(GVRRenderPass.GVRCullFaceEnum.None); // depends on control dependency: [if], data = [none]
}
else
{
GVRRenderPass rpass = new GVRRenderPass(ctx, postEffectData);
rpass.setCullFace(GVRRenderPass.GVRCullFaceEnum.None); // depends on control dependency: [if], data = [none]
mPostEffects.addPass(rpass); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setupMetricBundleAdjustment(List<AssociatedTriple> inliers) {
// Construct bundle adjustment data structure
structure = new SceneStructureMetric(false);
observations = new SceneObservations(3);
structure.initialize(3,3,inliers.size());
for (int i = 0; i < listPinhole.size(); i++) {
CameraPinhole cp = listPinhole.get(i);
BundlePinholeSimplified bp = new BundlePinholeSimplified();
bp.f = cp.fx;
structure.setCamera(i,false,bp);
structure.setView(i,i==0,worldToView.get(i));
structure.connectViewToCamera(i,i);
}
for (int i = 0; i < inliers.size(); i++) {
AssociatedTriple t = inliers.get(i);
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y);
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y);
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y);
structure.connectPointToView(i,0);
structure.connectPointToView(i,1);
structure.connectPointToView(i,2);
}
// Initial estimate for point 3D locations
triangulatePoints(structure,observations);
} } | public class class_name {
private void setupMetricBundleAdjustment(List<AssociatedTriple> inliers) {
// Construct bundle adjustment data structure
structure = new SceneStructureMetric(false);
observations = new SceneObservations(3);
structure.initialize(3,3,inliers.size());
for (int i = 0; i < listPinhole.size(); i++) {
CameraPinhole cp = listPinhole.get(i);
BundlePinholeSimplified bp = new BundlePinholeSimplified();
bp.f = cp.fx; // depends on control dependency: [for], data = [none]
structure.setCamera(i,false,bp); // depends on control dependency: [for], data = [i]
structure.setView(i,i==0,worldToView.get(i)); // depends on control dependency: [for], data = [i]
structure.connectViewToCamera(i,i); // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < inliers.size(); i++) {
AssociatedTriple t = inliers.get(i);
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y); // depends on control dependency: [for], data = [i]
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y); // depends on control dependency: [for], data = [i]
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y); // depends on control dependency: [for], data = [i]
structure.connectPointToView(i,0); // depends on control dependency: [for], data = [i]
structure.connectPointToView(i,1); // depends on control dependency: [for], data = [i]
structure.connectPointToView(i,2); // depends on control dependency: [for], data = [i]
}
// Initial estimate for point 3D locations
triangulatePoints(structure,observations);
} } |
public class class_name {
private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types)
{
Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>();
for (MapRow row : types)
{
List<DateRange> ranges = new ArrayList<DateRange>();
for (MapRow range : row.getRows("TIME_RANGES"))
{
ranges.add(new DateRange(range.getDate("START"), range.getDate("END")));
}
map.put(row.getUUID("UUID"), ranges);
}
return map;
} } | public class class_name {
private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types)
{
Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>();
for (MapRow row : types)
{
List<DateRange> ranges = new ArrayList<DateRange>();
for (MapRow range : row.getRows("TIME_RANGES"))
{
ranges.add(new DateRange(range.getDate("START"), range.getDate("END"))); // depends on control dependency: [for], data = [range]
}
map.put(row.getUUID("UUID"), ranges); // depends on control dependency: [for], data = [row]
}
return map;
} } |
public class class_name {
public static <T> void randomDraw(List<T> dataSet, int numSample,
List<T> initialSample, Random rand) {
initialSample.clear();
for (int i = 0; i < numSample; i++) {
// index of last element that has not been selected
int indexLast = dataSet.size()-i-1;
// randomly select an item from the list which has not been selected
int indexSelected = rand.nextInt(indexLast+1);
T a = dataSet.get(indexSelected);
initialSample.add(a);
// Swap the selected item with the last unselected item in the list. This way the selected
// item can't be selected again and the last item can now be selected
dataSet.set(indexSelected,dataSet.set(indexLast,a));
}
} } | public class class_name {
public static <T> void randomDraw(List<T> dataSet, int numSample,
List<T> initialSample, Random rand) {
initialSample.clear();
for (int i = 0; i < numSample; i++) {
// index of last element that has not been selected
int indexLast = dataSet.size()-i-1;
// randomly select an item from the list which has not been selected
int indexSelected = rand.nextInt(indexLast+1);
T a = dataSet.get(indexSelected);
initialSample.add(a); // depends on control dependency: [for], data = [none]
// Swap the selected item with the last unselected item in the list. This way the selected
// item can't be selected again and the last item can now be selected
dataSet.set(indexSelected,dataSet.set(indexLast,a)); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
protected static ICUResourceBundle getAliasedResource(
ICUResourceBundle base, String[] keys, int depth,
String key, int _resource,
HashMap<String, String> aliasesVisited,
UResourceBundle requested) {
WholeBundle wholeBundle = base.wholeBundle;
ClassLoader loaderToUse = wholeBundle.loader;
String locale;
String keyPath = null;
String bundleName;
String rpath = wholeBundle.reader.getAlias(_resource);
if (aliasesVisited == null) {
aliasesVisited = new HashMap<String, String>();
}
if (aliasesVisited.get(rpath) != null) {
throw new IllegalArgumentException(
"Circular references in the resource bundles");
}
aliasesVisited.put(rpath, "");
if (rpath.indexOf(RES_PATH_SEP_CHAR) == 0) {
int i = rpath.indexOf(RES_PATH_SEP_CHAR, 1);
int j = rpath.indexOf(RES_PATH_SEP_CHAR, i + 1);
bundleName = rpath.substring(1, i);
if (j < 0) {
locale = rpath.substring(i + 1);
} else {
locale = rpath.substring(i + 1, j);
keyPath = rpath.substring(j + 1, rpath.length());
}
//there is a path included
if (bundleName.equals(ICUDATA)) {
bundleName = ICUData.ICU_BASE_NAME;
loaderToUse = ICU_DATA_CLASS_LOADER;
}else if(bundleName.indexOf(ICUDATA)>-1){
int idx = bundleName.indexOf(HYPHEN);
if(idx>-1){
bundleName = ICUData.ICU_BASE_NAME+RES_PATH_SEP_STR+bundleName.substring(idx+1,bundleName.length());
loaderToUse = ICU_DATA_CLASS_LOADER;
}
}
} else {
//no path start with locale
int i = rpath.indexOf(RES_PATH_SEP_CHAR);
if (i != -1) {
locale = rpath.substring(0, i);
keyPath = rpath.substring(i + 1);
} else {
locale = rpath;
}
bundleName = wholeBundle.baseName;
}
ICUResourceBundle bundle = null;
ICUResourceBundle sub = null;
if(bundleName.equals(LOCALE)){
bundleName = wholeBundle.baseName;
keyPath = rpath.substring(LOCALE.length() + 2/* prepending and appending / */, rpath.length());
// Get the top bundle of the requested bundle
bundle = (ICUResourceBundle)requested;
while (bundle.container != null) {
bundle = bundle.container;
}
sub = ICUResourceBundle.findResourceWithFallback(keyPath, bundle, null);
}else{
bundle = getBundleInstance(bundleName, locale, loaderToUse, false);
int numKeys;
if (keyPath != null) {
numKeys = countPathKeys(keyPath);
if (numKeys > 0) {
keys = new String[numKeys];
getResPathKeys(keyPath, numKeys, keys, 0);
}
} else if (keys != null) {
numKeys = depth;
} else {
depth = base.getResDepth();
numKeys = depth + 1;
keys = new String[numKeys];
base.getResPathKeys(keys, depth);
keys[depth] = key;
}
if (numKeys > 0) {
sub = bundle;
for (int i = 0; sub != null && i < numKeys; ++i) {
sub = sub.get(keys[i], aliasesVisited, requested);
}
}
}
if (sub == null) {
throw new MissingResourceException(wholeBundle.localeID, wholeBundle.baseName, key);
}
// TODO: If we know that sub is not cached,
// then we should set its container and key to the alias' location,
// so that it behaves as if its value had been copied into the alias location.
// However, findResourceWithFallback() must reroute its bundle and key path
// to where the alias data comes from.
return sub;
} } | public class class_name {
protected static ICUResourceBundle getAliasedResource(
ICUResourceBundle base, String[] keys, int depth,
String key, int _resource,
HashMap<String, String> aliasesVisited,
UResourceBundle requested) {
WholeBundle wholeBundle = base.wholeBundle;
ClassLoader loaderToUse = wholeBundle.loader;
String locale;
String keyPath = null;
String bundleName;
String rpath = wholeBundle.reader.getAlias(_resource);
if (aliasesVisited == null) {
aliasesVisited = new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
if (aliasesVisited.get(rpath) != null) {
throw new IllegalArgumentException(
"Circular references in the resource bundles");
}
aliasesVisited.put(rpath, "");
if (rpath.indexOf(RES_PATH_SEP_CHAR) == 0) {
int i = rpath.indexOf(RES_PATH_SEP_CHAR, 1);
int j = rpath.indexOf(RES_PATH_SEP_CHAR, i + 1);
bundleName = rpath.substring(1, i); // depends on control dependency: [if], data = [none]
if (j < 0) {
locale = rpath.substring(i + 1); // depends on control dependency: [if], data = [none]
} else {
locale = rpath.substring(i + 1, j); // depends on control dependency: [if], data = [none]
keyPath = rpath.substring(j + 1, rpath.length()); // depends on control dependency: [if], data = [(j]
}
//there is a path included
if (bundleName.equals(ICUDATA)) {
bundleName = ICUData.ICU_BASE_NAME; // depends on control dependency: [if], data = [none]
loaderToUse = ICU_DATA_CLASS_LOADER; // depends on control dependency: [if], data = [none]
}else if(bundleName.indexOf(ICUDATA)>-1){
int idx = bundleName.indexOf(HYPHEN);
if(idx>-1){
bundleName = ICUData.ICU_BASE_NAME+RES_PATH_SEP_STR+bundleName.substring(idx+1,bundleName.length()); // depends on control dependency: [if], data = [(idx]
loaderToUse = ICU_DATA_CLASS_LOADER; // depends on control dependency: [if], data = [none]
}
}
} else {
//no path start with locale
int i = rpath.indexOf(RES_PATH_SEP_CHAR);
if (i != -1) {
locale = rpath.substring(0, i); // depends on control dependency: [if], data = [none]
keyPath = rpath.substring(i + 1); // depends on control dependency: [if], data = [(i]
} else {
locale = rpath; // depends on control dependency: [if], data = [none]
}
bundleName = wholeBundle.baseName; // depends on control dependency: [if], data = [none]
}
ICUResourceBundle bundle = null;
ICUResourceBundle sub = null;
if(bundleName.equals(LOCALE)){
bundleName = wholeBundle.baseName; // depends on control dependency: [if], data = [none]
keyPath = rpath.substring(LOCALE.length() + 2/* prepending and appending / */, rpath.length()); // depends on control dependency: [if], data = [none]
// Get the top bundle of the requested bundle
bundle = (ICUResourceBundle)requested; // depends on control dependency: [if], data = [none]
while (bundle.container != null) {
bundle = bundle.container; // depends on control dependency: [while], data = [none]
}
sub = ICUResourceBundle.findResourceWithFallback(keyPath, bundle, null); // depends on control dependency: [if], data = [none]
}else{
bundle = getBundleInstance(bundleName, locale, loaderToUse, false); // depends on control dependency: [if], data = [none]
int numKeys;
if (keyPath != null) {
numKeys = countPathKeys(keyPath); // depends on control dependency: [if], data = [(keyPath]
if (numKeys > 0) {
keys = new String[numKeys]; // depends on control dependency: [if], data = [none]
getResPathKeys(keyPath, numKeys, keys, 0); // depends on control dependency: [if], data = [0)]
}
} else if (keys != null) {
numKeys = depth; // depends on control dependency: [if], data = [none]
} else {
depth = base.getResDepth(); // depends on control dependency: [if], data = [none]
numKeys = depth + 1; // depends on control dependency: [if], data = [none]
keys = new String[numKeys]; // depends on control dependency: [if], data = [none]
base.getResPathKeys(keys, depth); // depends on control dependency: [if], data = [(keys]
keys[depth] = key; // depends on control dependency: [if], data = [none]
}
if (numKeys > 0) {
sub = bundle; // depends on control dependency: [if], data = [none]
for (int i = 0; sub != null && i < numKeys; ++i) {
sub = sub.get(keys[i], aliasesVisited, requested); // depends on control dependency: [for], data = [i]
}
}
}
if (sub == null) {
throw new MissingResourceException(wholeBundle.localeID, wholeBundle.baseName, key);
}
// TODO: If we know that sub is not cached,
// then we should set its container and key to the alias' location,
// so that it behaves as if its value had been copied into the alias location.
// However, findResourceWithFallback() must reroute its bundle and key path
// to where the alias data comes from.
return sub;
} } |
public class class_name {
public static void printStackTrace(SQLException e, PrintWriter pw) {
SQLException next = e;
while (next != null) {
next.printStackTrace(pw);
next = next.getNextException();
if (next != null) {
pw.println("Next SQLException:");
}
}
} } | public class class_name {
public static void printStackTrace(SQLException e, PrintWriter pw) {
SQLException next = e;
while (next != null) {
next.printStackTrace(pw); // depends on control dependency: [while], data = [none]
next = next.getNextException(); // depends on control dependency: [while], data = [none]
if (next != null) {
pw.println("Next SQLException:"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public final int getIdleCount(IdleStatus status) {
if (getConfig().getIdleTime(status) == 0) {
if (status == IdleStatus.BOTH_IDLE) {
idleCountForBoth.set(0);
}
if (status == IdleStatus.READER_IDLE) {
idleCountForRead.set(0);
}
if (status == IdleStatus.WRITER_IDLE) {
idleCountForWrite.set(0);
}
}
if (status == IdleStatus.BOTH_IDLE) {
return idleCountForBoth.get();
}
if (status == IdleStatus.READER_IDLE) {
return idleCountForRead.get();
}
if (status == IdleStatus.WRITER_IDLE) {
return idleCountForWrite.get();
}
throw new IllegalArgumentException("Unknown idle status: " + status);
} } | public class class_name {
public final int getIdleCount(IdleStatus status) {
if (getConfig().getIdleTime(status) == 0) {
if (status == IdleStatus.BOTH_IDLE) {
idleCountForBoth.set(0); // depends on control dependency: [if], data = [none]
}
if (status == IdleStatus.READER_IDLE) {
idleCountForRead.set(0); // depends on control dependency: [if], data = [none]
}
if (status == IdleStatus.WRITER_IDLE) {
idleCountForWrite.set(0); // depends on control dependency: [if], data = [none]
}
}
if (status == IdleStatus.BOTH_IDLE) {
return idleCountForBoth.get(); // depends on control dependency: [if], data = [none]
}
if (status == IdleStatus.READER_IDLE) {
return idleCountForRead.get(); // depends on control dependency: [if], data = [none]
}
if (status == IdleStatus.WRITER_IDLE) {
return idleCountForWrite.get(); // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException("Unknown idle status: " + status);
} } |
public class class_name {
public int parseIntegerString(String numberString) {
StringReader sr = new StringReader(numberString);
StreamTokenizer st = new StreamTokenizer(sr);
st.parseNumbers();
int tokenType;
int returnValue = 0;
try {
if ((tokenType = st.nextToken()) != StreamTokenizer.TT_EOF) {
if (tokenType == StreamTokenizer.TT_NUMBER) {
returnValue = (int) st.nval;
}
}
}
catch (IOException e) {
Log.e(TAG, "Error: parseIntegerString - " + e);
}
return returnValue;
} } | public class class_name {
public int parseIntegerString(String numberString) {
StringReader sr = new StringReader(numberString);
StreamTokenizer st = new StreamTokenizer(sr);
st.parseNumbers();
int tokenType;
int returnValue = 0;
try {
if ((tokenType = st.nextToken()) != StreamTokenizer.TT_EOF) {
if (tokenType == StreamTokenizer.TT_NUMBER) {
returnValue = (int) st.nval; // depends on control dependency: [if], data = [none]
}
}
}
catch (IOException e) {
Log.e(TAG, "Error: parseIntegerString - " + e);
} // depends on control dependency: [catch], data = [none]
return returnValue;
} } |
public class class_name {
protected String convertDigestEncoding(String value) {
byte[] data = new byte[value.length() / 2];
for (int i = 0; i < data.length; i++) {
data[i] = (byte)(Integer.parseInt(value.substring(i * 2, (i * 2) + 2), 16) - 128);
}
return new String(Base64.encodeBase64(data));
} } | public class class_name {
protected String convertDigestEncoding(String value) {
byte[] data = new byte[value.length() / 2];
for (int i = 0; i < data.length; i++) {
data[i] = (byte)(Integer.parseInt(value.substring(i * 2, (i * 2) + 2), 16) - 128); // depends on control dependency: [for], data = [i]
}
return new String(Base64.encodeBase64(data));
} } |
public class class_name {
public RiakNode setMinConnections(int minConnections)
{
stateCheck(State.CREATED, State.RUNNING, State.HEALTH_CHECKING);
if (minConnections <= getMaxConnections())
{
this.minConnections = minConnections;
}
else
{
throw new IllegalArgumentException("Min connections greater than max connections");
}
// TODO: Start / reap delta?
return this;
} } | public class class_name {
public RiakNode setMinConnections(int minConnections)
{
stateCheck(State.CREATED, State.RUNNING, State.HEALTH_CHECKING);
if (minConnections <= getMaxConnections())
{
this.minConnections = minConnections; // depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalArgumentException("Min connections greater than max connections");
}
// TODO: Start / reap delta?
return this;
} } |
public class class_name {
public static Class<?> getClass(String classname) {
Class<?> clazz = null;
try {
clazz = Class.forName(classname);
} catch (Exception e) {
// Try the second approach
}
if (null == clazz) {
Exception classNotFoundEx = null;
try {
clazz = Class.forName(classname, true, new ClassLoaderResourceUtils().getClass().getClassLoader());
} catch (Exception e) {
// Try the third approach
classNotFoundEx = e;
}
if (null == clazz) {
ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
if (null != threadClassLoader) {
try {
clazz = Class.forName(classname, true, threadClassLoader);
} catch (Exception e) {
throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ e.getClass().getName() + ":" + e.getMessage(), e);
}
} else {
throw new BundlingProcessException(classNotFoundEx.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ classNotFoundEx.getClass().getName() + ":" + classNotFoundEx.getMessage(),
classNotFoundEx);
}
}
}
return clazz;
} } | public class class_name {
public static Class<?> getClass(String classname) {
Class<?> clazz = null;
try {
clazz = Class.forName(classname);
} catch (Exception e) {
// Try the second approach
}
if (null == clazz) {
Exception classNotFoundEx = null;
try {
clazz = Class.forName(classname, true, new ClassLoaderResourceUtils().getClass().getClassLoader()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Try the third approach
classNotFoundEx = e;
} // depends on control dependency: [catch], data = [none]
if (null == clazz) {
ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
if (null != threadClassLoader) {
try {
clazz = Class.forName(classname, true, threadClassLoader); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ e.getClass().getName() + ":" + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} else {
throw new BundlingProcessException(classNotFoundEx.getMessage() + " [The custom class " + classname
+ " could not be instantiated, check wether it is available on the classpath and"
+ " verify that it has a zero-arg constructor].\n" + " The specific error message is: "
+ classNotFoundEx.getClass().getName() + ":" + classNotFoundEx.getMessage(),
classNotFoundEx);
}
}
}
return clazz;
} } |
public class class_name {
public void createControlAdapter()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlAdapter");
DestinationHandler dh = null;
try
{
ItemStream is = getItemStream();
// TODO - This method is using the wrong itemstream
dh = ((AOProtocolItemStream) is).getDestinationHandler();
SIMPMessage msg = (SIMPMessage) is.findById(msgId);
controlAdapter = new QueuedMessage(msg,dh,is);
}
catch(Exception e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.items.AOValue.createControlAdapter",
"1:371:1.28.1.5",
this);
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlAdapter");
} } | public class class_name {
public void createControlAdapter()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createControlAdapter");
DestinationHandler dh = null;
try
{
ItemStream is = getItemStream();
// TODO - This method is using the wrong itemstream
dh = ((AOProtocolItemStream) is).getDestinationHandler(); // depends on control dependency: [try], data = [none]
SIMPMessage msg = (SIMPMessage) is.findById(msgId);
controlAdapter = new QueuedMessage(msg,dh,is); // depends on control dependency: [try], data = [none]
}
catch(Exception e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.store.items.AOValue.createControlAdapter",
"1:371:1.28.1.5",
this);
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createControlAdapter");
} } |
public class class_name {
static IDataModel toDataModel(final Workbook workbook) {
if (workbook == null) { return null; }
//add custom functions information
workbook.addToolPack(getUdfFinder());
Sheet s = workbook.getSheetAt(0); //TODO: only one sheet is supported
if (s == null) { return null; }
IDataModel dm = new DataModel(s.getSheetName());
for (int i = s.getFirstRowNum(); i <= s.getLastRowNum(); i++) {
Row r = s.getRow(i);
if (r == null) { continue; }
DmRow row = new DmRow(i);
dm.setRow(i, row);
for (int j = r.getFirstCellNum(); j < r.getLastCellNum(); j++) {
Cell c = r.getCell(j);
if (c == null) { continue; }
DmCell cell = new DmCell();
row.setCell(j, cell);
cell.setAddress(new CellAddress(dm.getDataModelId(), A1Address.fromRowColumn(i, j)));
cell.setContent(ConverterUtils.resolveCellValue(c));
}
}
EvaluationWorkbook evaluationWbook = ConverterUtils.newEvaluationWorkbook(workbook);
for (int nIdx = 0; nIdx < workbook.getNumberOfNames(); nIdx++) {
Name name = workbook.getNameAt(nIdx);
String reference = name.getRefersToFormula();
if (reference == null) { continue; }
if (A1Address.isAddress(removeSheetFromNameRef(reference))) {
dm.setNamedAddress(name.getNameName(), A1Address.fromA1Address(removeSheetFromNameRef(reference)));
} else if (isFormula(reference, evaluationWbook)) {
dm.setNamedValue(name.getNameName(), new CellValue(FORMULA_PREFIX + reference));
} else {
dm.setNamedValue(name.getNameName(), CellValue.from(reference));
}
}
return dm;
} } | public class class_name {
static IDataModel toDataModel(final Workbook workbook) {
if (workbook == null) { return null; } // depends on control dependency: [if], data = [none]
//add custom functions information
workbook.addToolPack(getUdfFinder());
Sheet s = workbook.getSheetAt(0); //TODO: only one sheet is supported
if (s == null) { return null; } // depends on control dependency: [if], data = [none]
IDataModel dm = new DataModel(s.getSheetName());
for (int i = s.getFirstRowNum(); i <= s.getLastRowNum(); i++) {
Row r = s.getRow(i);
if (r == null) { continue; }
DmRow row = new DmRow(i);
dm.setRow(i, row); // depends on control dependency: [for], data = [i]
for (int j = r.getFirstCellNum(); j < r.getLastCellNum(); j++) {
Cell c = r.getCell(j);
if (c == null) { continue; }
DmCell cell = new DmCell();
row.setCell(j, cell); // depends on control dependency: [for], data = [j]
cell.setAddress(new CellAddress(dm.getDataModelId(), A1Address.fromRowColumn(i, j))); // depends on control dependency: [for], data = [j]
cell.setContent(ConverterUtils.resolveCellValue(c)); // depends on control dependency: [for], data = [none]
}
}
EvaluationWorkbook evaluationWbook = ConverterUtils.newEvaluationWorkbook(workbook);
for (int nIdx = 0; nIdx < workbook.getNumberOfNames(); nIdx++) {
Name name = workbook.getNameAt(nIdx);
String reference = name.getRefersToFormula();
if (reference == null) { continue; }
if (A1Address.isAddress(removeSheetFromNameRef(reference))) {
dm.setNamedAddress(name.getNameName(), A1Address.fromA1Address(removeSheetFromNameRef(reference))); // depends on control dependency: [if], data = [none]
} else if (isFormula(reference, evaluationWbook)) {
dm.setNamedValue(name.getNameName(), new CellValue(FORMULA_PREFIX + reference)); // depends on control dependency: [if], data = [none]
} else {
dm.setNamedValue(name.getNameName(), CellValue.from(reference)); // depends on control dependency: [if], data = [none]
}
}
return dm;
} } |
public class class_name {
@Override
protected <T> T create(Class<T> type, Map<String, String> mapConfig) {
try {
Constructor<T> constructor = type.getConstructor(Vertx.class, VertxEngineConfig.class, Map.class);
return constructor.newInstance(vertx, engineConfig, mapConfig);
} catch (Exception e) {
}
try {
Constructor<T> constructor = type.getConstructor(Map.class);
return constructor.newInstance(mapConfig);
} catch (Exception e) {
}
try {
return type.newInstance();
} catch (Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@Override
protected <T> T create(Class<T> type, Map<String, String> mapConfig) {
try {
Constructor<T> constructor = type.getConstructor(Vertx.class, VertxEngineConfig.class, Map.class);
return constructor.newInstance(vertx, engineConfig, mapConfig); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
try {
Constructor<T> constructor = type.getConstructor(Map.class);
return constructor.newInstance(mapConfig); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
try {
return type.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public byte[] getLevels(int[] linebreaks) {
// Note that since the previous processing has removed all
// P, S, and WS values from resultTypes, the values referred to
// in these rules are the initial types, before any processing
// has been applied (including processing of overrides).
//
// This example implementation has reinserted explicit format codes
// and BN, in order that the levels array correspond to the
// initial text. Their final placement is not normative.
// These codes are treated like WS in this implementation,
// so they don't interrupt sequences of WS.
validateLineBreaks(linebreaks, textLength);
byte[] result = (byte[])resultLevels.clone(); // will be returned to caller
// don't worry about linebreaks since if there is a break within
// a series of WS values preceding S, the linebreak itself
// causes the reset.
for (int i = 0; i < result.length; ++i) {
byte t = initialTypes[i];
if (t == B || t == S) {
// Rule L1, clauses one and two.
result[i] = paragraphEmbeddingLevel;
// Rule L1, clause three.
for (int j = i - 1; j >= 0; --j) {
if (isWhitespace(initialTypes[j])) { // including format codes
result[j] = paragraphEmbeddingLevel;
} else {
break;
}
}
}
}
// Rule L1, clause four.
int start = 0;
for (int i = 0; i < linebreaks.length; ++i) {
int limit = linebreaks[i];
for (int j = limit - 1; j >= start; --j) {
if (isWhitespace(initialTypes[j])) { // including format codes
result[j] = paragraphEmbeddingLevel;
} else {
break;
}
}
start = limit;
}
return result;
} } | public class class_name {
public byte[] getLevels(int[] linebreaks) {
// Note that since the previous processing has removed all
// P, S, and WS values from resultTypes, the values referred to
// in these rules are the initial types, before any processing
// has been applied (including processing of overrides).
//
// This example implementation has reinserted explicit format codes
// and BN, in order that the levels array correspond to the
// initial text. Their final placement is not normative.
// These codes are treated like WS in this implementation,
// so they don't interrupt sequences of WS.
validateLineBreaks(linebreaks, textLength);
byte[] result = (byte[])resultLevels.clone(); // will be returned to caller
// don't worry about linebreaks since if there is a break within
// a series of WS values preceding S, the linebreak itself
// causes the reset.
for (int i = 0; i < result.length; ++i) {
byte t = initialTypes[i];
if (t == B || t == S) {
// Rule L1, clauses one and two.
result[i] = paragraphEmbeddingLevel; // depends on control dependency: [if], data = [none]
// Rule L1, clause three.
for (int j = i - 1; j >= 0; --j) {
if (isWhitespace(initialTypes[j])) { // including format codes
result[j] = paragraphEmbeddingLevel; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
}
}
// Rule L1, clause four.
int start = 0;
for (int i = 0; i < linebreaks.length; ++i) {
int limit = linebreaks[i];
for (int j = limit - 1; j >= start; --j) {
if (isWhitespace(initialTypes[j])) { // including format codes
result[j] = paragraphEmbeddingLevel; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
start = limit; // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
@Override
public void notifyForeignWatch(byte[] key, String serverId)
{
ClusterServiceKraken proxy = _podKraken.getProxy(serverId);
if (proxy != null) {
proxy.notifyLocalWatch(_table.getKey(), key);
}
} } | public class class_name {
@Override
public void notifyForeignWatch(byte[] key, String serverId)
{
ClusterServiceKraken proxy = _podKraken.getProxy(serverId);
if (proxy != null) {
proxy.notifyLocalWatch(_table.getKey(), key); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public long getLength(String path)
{
try {
ZipEntry entry = getZipEntry(path);
long length = entry != null ? entry.getSize() : -1;
return length;
} catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
return -1;
}
} } | public class class_name {
public long getLength(String path)
{
try {
ZipEntry entry = getZipEntry(path);
long length = entry != null ? entry.getSize() : -1;
return length; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.log(Level.FINE, e.toString(), e);
return -1;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String formatCurrency(ITemplate template, Object data, String currencyCode, Locale locale) {
if (null == data) throw new NullPointerException();
Number number;
if (data instanceof Number) {
number = (Number)data;
} else {
number = Double.parseDouble(data.toString());
}
if (null == locale) locale = I18N.locale(template);
if (null == locale.getCountry() || locale.getCountry().length() != 2) {
// try best to guess
String lan = locale.getLanguage();
if (eq(lan, "en")) {
if (null != currencyCode) {
if (eq("AUD", currencyCode)) {
locale = new Locale(lan, "AU");
} else if (eq("USD", currencyCode)) {
locale = Locale.US;
} else if (eq("GBP", currencyCode)) {
locale = Locale.UK;
}
}
} else if (eq(lan, "zh")) {
locale = Locale.SIMPLIFIED_CHINESE;
}
}
NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
Currency currency = null;
if (null == currencyCode) {
String country = locale.getCountry();
if (null != country && country.length() == 2) {
currency = Currency.getInstance(locale);
}
if (null == currency) currencyCode = "$"; // default
}
if (null == currency) {
if (currencyCode.length() != 3) {
// it must be something like '$' or '¥' etc
} else {
currency = Currency.getInstance(currencyCode);
}
}
if (null != currency) {
numberFormat.setCurrency(currency);
numberFormat.setMaximumFractionDigits(currency.getDefaultFractionDigits());
} else {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
dfs.setCurrencySymbol(currencyCode);
((DecimalFormat) numberFormat).setDecimalFormatSymbols(dfs);
}
String s = numberFormat.format(number);
if (null != currency) s = s.replace(currency.getCurrencyCode(), currency.getSymbol(locale));
return s;
} } | public class class_name {
public static String formatCurrency(ITemplate template, Object data, String currencyCode, Locale locale) {
if (null == data) throw new NullPointerException();
Number number;
if (data instanceof Number) {
number = (Number)data; // depends on control dependency: [if], data = [none]
} else {
number = Double.parseDouble(data.toString()); // depends on control dependency: [if], data = [none]
}
if (null == locale) locale = I18N.locale(template);
if (null == locale.getCountry() || locale.getCountry().length() != 2) {
// try best to guess
String lan = locale.getLanguage();
if (eq(lan, "en")) {
if (null != currencyCode) {
if (eq("AUD", currencyCode)) {
locale = new Locale(lan, "AU"); // depends on control dependency: [if], data = [none]
} else if (eq("USD", currencyCode)) {
locale = Locale.US; // depends on control dependency: [if], data = [none]
} else if (eq("GBP", currencyCode)) {
locale = Locale.UK; // depends on control dependency: [if], data = [none]
}
}
} else if (eq(lan, "zh")) {
locale = Locale.SIMPLIFIED_CHINESE; // depends on control dependency: [if], data = [none]
}
}
NumberFormat numberFormat = NumberFormat.getCurrencyInstance(locale);
Currency currency = null;
if (null == currencyCode) {
String country = locale.getCountry();
if (null != country && country.length() == 2) {
currency = Currency.getInstance(locale); // depends on control dependency: [if], data = [none]
}
if (null == currency) currencyCode = "$"; // default
}
if (null == currency) {
if (currencyCode.length() != 3) {
// it must be something like '$' or '¥' etc
} else {
currency = Currency.getInstance(currencyCode); // depends on control dependency: [if], data = [none]
}
}
if (null != currency) {
numberFormat.setCurrency(currency); // depends on control dependency: [if], data = [currency)]
numberFormat.setMaximumFractionDigits(currency.getDefaultFractionDigits()); // depends on control dependency: [if], data = [none]
} else {
DecimalFormatSymbols dfs = new DecimalFormatSymbols();
dfs.setCurrencySymbol(currencyCode); // depends on control dependency: [if], data = [none]
((DecimalFormat) numberFormat).setDecimalFormatSymbols(dfs); // depends on control dependency: [if], data = [none]
}
String s = numberFormat.format(number);
if (null != currency) s = s.replace(currency.getCurrencyCode(), currency.getSymbol(locale));
return s;
} } |
public class class_name {
protected static List<Token> tokenize(String requirement, Semver.SemverType type) {
Map<Character, Token> specialChars = SPECIAL_CHARS.get(type);
// Replace the tokens made of 2 chars
if (type == Semver.SemverType.COCOAPODS) {
requirement = requirement.replace("~>", "~");
} else if (type == Semver.SemverType.NPM) {
requirement = requirement.replace("||", "|");
}
requirement = requirement.replace("<=", "≤").replace(">=", "≥");
LinkedList<Token> tokens = new LinkedList<Token>();
Token previousToken = null;
char[] chars = requirement.toCharArray();
Token token = null;
for (char c : chars) {
if (c == ' ') continue;
if (specialChars.containsKey(c)) {
if (token != null) {
tokens.add(token);
previousToken = token;
token = null;
}
Token current = specialChars.get(c);
if (current.type.isUnary() && previousToken != null && previousToken.type == TokenType.VERSION) {
// Handling the ranges like "≥1.2.3 <4.5.6" by inserting a "AND" binary operator
tokens.add(new Token(TokenType.AND));
}
tokens.add(current);
previousToken = current;
} else {
if (token == null) {
token = new Token(TokenType.VERSION);
}
token.append(c);
}
}
if (token != null) {
tokens.add(token);
}
return tokens;
} } | public class class_name {
protected static List<Token> tokenize(String requirement, Semver.SemverType type) {
Map<Character, Token> specialChars = SPECIAL_CHARS.get(type);
// Replace the tokens made of 2 chars
if (type == Semver.SemverType.COCOAPODS) {
requirement = requirement.replace("~>", "~"); // depends on control dependency: [if], data = [none]
} else if (type == Semver.SemverType.NPM) {
requirement = requirement.replace("||", "|"); // depends on control dependency: [if], data = [none]
}
requirement = requirement.replace("<=", "≤").replace(">=", "≥");
LinkedList<Token> tokens = new LinkedList<Token>();
Token previousToken = null;
char[] chars = requirement.toCharArray();
Token token = null;
for (char c : chars) {
if (c == ' ') continue;
if (specialChars.containsKey(c)) {
if (token != null) {
tokens.add(token); // depends on control dependency: [if], data = [(token]
previousToken = token; // depends on control dependency: [if], data = [none]
token = null; // depends on control dependency: [if], data = [none]
}
Token current = specialChars.get(c);
if (current.type.isUnary() && previousToken != null && previousToken.type == TokenType.VERSION) {
// Handling the ranges like "≥1.2.3 <4.5.6" by inserting a "AND" binary operator
tokens.add(new Token(TokenType.AND)); // depends on control dependency: [if], data = [none]
}
tokens.add(current); // depends on control dependency: [if], data = [none]
previousToken = current; // depends on control dependency: [if], data = [none]
} else {
if (token == null) {
token = new Token(TokenType.VERSION); // depends on control dependency: [if], data = [none]
}
token.append(c); // depends on control dependency: [if], data = [none]
}
}
if (token != null) {
tokens.add(token); // depends on control dependency: [if], data = [(token]
}
return tokens;
} } |
public class class_name {
public java.util.List<AppCookieStickinessPolicy> getAppCookieStickinessPolicies() {
if (appCookieStickinessPolicies == null) {
appCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList<AppCookieStickinessPolicy>();
}
return appCookieStickinessPolicies;
} } | public class class_name {
public java.util.List<AppCookieStickinessPolicy> getAppCookieStickinessPolicies() {
if (appCookieStickinessPolicies == null) {
appCookieStickinessPolicies = new com.amazonaws.internal.SdkInternalList<AppCookieStickinessPolicy>(); // depends on control dependency: [if], data = [none]
}
return appCookieStickinessPolicies;
} } |
public class class_name {
public Record getTargetRecord(Map<String,Object> properties, String strParam)
{
String strRecordName = (String)properties.get(strParam);
Record record = null;
if ((strRecordName != null) && (strRecordName.length() > 0))
{
String strTableName = strRecordName;
if (strTableName.indexOf('.') != -1)
strTableName = strTableName.substring(strTableName.lastIndexOf('.') + 1);
if (this.getRecordOwner() != null) // Always
record = (Record)this.getRecordOwner().getRecord(strTableName);
if (record != null)
return record; // Already open
if (strRecordName.indexOf('.') == -1)
if (properties.get("package") != null)
strRecordName = (String)properties.get("package") + '.' + strRecordName;
if (strRecordName.indexOf('.') == -1)
{
ClassInfo recClassInfo = new ClassInfo(this.getRecordOwner());
try {
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecordName);
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
if (recClassInfo.seek(null))
strRecordName = recClassInfo.getPackageName(null) + '.' + strRecordName;
} catch (DBException ex) {
ex.printStackTrace();
} finally {
recClassInfo.free();
}
}
if (strRecordName.indexOf('.') != -1)
{
record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(strRecordName);
if (record != null)
record.init(this.findRecordOwner());
}
}
return record;
} } | public class class_name {
public Record getTargetRecord(Map<String,Object> properties, String strParam)
{
String strRecordName = (String)properties.get(strParam);
Record record = null;
if ((strRecordName != null) && (strRecordName.length() > 0))
{
String strTableName = strRecordName;
if (strTableName.indexOf('.') != -1)
strTableName = strTableName.substring(strTableName.lastIndexOf('.') + 1);
if (this.getRecordOwner() != null) // Always
record = (Record)this.getRecordOwner().getRecord(strTableName);
if (record != null)
return record; // Already open
if (strRecordName.indexOf('.') == -1)
if (properties.get("package") != null)
strRecordName = (String)properties.get("package") + '.' + strRecordName;
if (strRecordName.indexOf('.') == -1)
{
ClassInfo recClassInfo = new ClassInfo(this.getRecordOwner());
try {
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strRecordName); // depends on control dependency: [try], data = [none]
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY); // depends on control dependency: [try], data = [none]
if (recClassInfo.seek(null))
strRecordName = recClassInfo.getPackageName(null) + '.' + strRecordName;
} catch (DBException ex) {
ex.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
recClassInfo.free();
}
}
if (strRecordName.indexOf('.') != -1)
{
record = (Record)ClassServiceUtility.getClassService().makeObjectFromClassName(strRecordName); // depends on control dependency: [if], data = [none]
if (record != null)
record.init(this.findRecordOwner());
}
}
return record;
} } |
public class class_name {
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) {
TreePath parentPath = tp.getParentPath();
// If it is the root, stop the recursive calls and return
if (parentPath == null) {
return;
}
CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath);
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent();
parentCheckedNode.allChildrenSelected = true;
parentCheckedNode.isSelected = false;
for (int i = 0 ; i < parentNode.getChildCount() ; i++) {
TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i));
CheckedNode childCheckedNode = nodesCheckingState.get(childPath);
// It is enough that even one subtree is not fully selected
// to determine that the parent is not fully selected
if (!allSelected(childCheckedNode)) {
parentCheckedNode.allChildrenSelected = false;
}
// If at least one child is selected, selecting also the parent
if (childCheckedNode.isSelected) {
parentCheckedNode.isSelected = true;
}
}
if (parentCheckedNode.isSelected) {
checkedPaths.add(parentPath);
} else {
checkedPaths.remove(parentPath);
}
// Go to upper predecessor
updatePredecessorsWithCheckMode(parentPath, check);
} } | public class class_name {
protected void updatePredecessorsWithCheckMode(TreePath tp, boolean check) {
TreePath parentPath = tp.getParentPath();
// If it is the root, stop the recursive calls and return
if (parentPath == null) {
return; // depends on control dependency: [if], data = [none]
}
CheckedNode parentCheckedNode = nodesCheckingState.get(parentPath);
DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) parentPath.getLastPathComponent();
parentCheckedNode.allChildrenSelected = true;
parentCheckedNode.isSelected = false;
for (int i = 0 ; i < parentNode.getChildCount() ; i++) {
TreePath childPath = parentPath.pathByAddingChild(parentNode.getChildAt(i));
CheckedNode childCheckedNode = nodesCheckingState.get(childPath);
// It is enough that even one subtree is not fully selected
// to determine that the parent is not fully selected
if (!allSelected(childCheckedNode)) {
parentCheckedNode.allChildrenSelected = false; // depends on control dependency: [if], data = [none]
}
// If at least one child is selected, selecting also the parent
if (childCheckedNode.isSelected) {
parentCheckedNode.isSelected = true; // depends on control dependency: [if], data = [none]
}
}
if (parentCheckedNode.isSelected) {
checkedPaths.add(parentPath); // depends on control dependency: [if], data = [none]
} else {
checkedPaths.remove(parentPath); // depends on control dependency: [if], data = [none]
}
// Go to upper predecessor
updatePredecessorsWithCheckMode(parentPath, check);
} } |
public class class_name {
private <T> Callback createHandler(final Class<T> serviceInterface, final MethodCall call,
final Callback handler) {
final ClassMeta<T> clsMeta = ClassMeta.classMeta(serviceInterface);
final MethodAccess method = clsMeta.method(call.name());
Class<?> returnType = null;
Class<?> compType = null;
if (Promise.class.isAssignableFrom(method.returnType()) ) {
Type t0 = method.method().getGenericReturnType();
if (t0 instanceof ParameterizedType) {
ParameterizedType parameterizedType = ((ParameterizedType) t0);
Type type = ((parameterizedType != null ? parameterizedType.getActualTypeArguments().length : 0) > 0 ? (parameterizedType != null ? parameterizedType.getActualTypeArguments() : new Type[0])[0] : null);
if (type instanceof ParameterizedType) {
returnType = (Class) ((ParameterizedType) type).getRawType();
final Type type1 = ((ParameterizedType) type).getActualTypeArguments()[0];
if (type1 instanceof Class) {
compType = (Class) type1;
}
} else if (type instanceof Class) {
returnType = (Class<?>) type;
}
}
} else {
if (method.parameterTypes().length > 0) {
Type[] genericParameterTypes = method.getGenericParameterTypes();
ParameterizedType parameterizedType = genericParameterTypes.length > 0 ? (ParameterizedType) genericParameterTypes[0] : null;
Type type = ((parameterizedType != null ? parameterizedType.getActualTypeArguments().length : 0) > 0 ? (parameterizedType != null ? parameterizedType.getActualTypeArguments() : new Type[0])[0] : null);
if (type instanceof ParameterizedType) {
returnType = (Class) ((ParameterizedType) type).getRawType();
final Type type1 = ((ParameterizedType) type).getActualTypeArguments()[0];
if (type1 instanceof Class) {
compType = (Class) type1;
}
} else if (type instanceof Class) {
returnType = (Class<?>) type;
}
}
}
final Class<?> actualReturnType = returnType;
final Class<?> componentClass = compType;
/** Create the return handler. */
return new Callback<Object>() {
@Override
public void accept(Object event) {
if (actualReturnType != null) {
if (componentClass != null && actualReturnType == List.class) {
try {
//noinspection unchecked
event = MapObjectConversion.convertListOfMapsToObjects(componentClass, (List) event);
} catch (Exception ex) {
if (event instanceof CharSequence) {
String errorMessage = event.toString();
if (errorMessage.startsWith("java.lang.IllegalState")) {
handler.onError(new IllegalStateException(errorMessage));
return;
} else {
handler.onError(new IllegalStateException("Conversion error"));
return;
}
} else {
handler.onError(new IllegalStateException("Conversion error"));
return;
}
}
} else {
switch (actualReturnType.getName()) {
case "java.lang.Boolean":
if (event instanceof Value) {
event = ((Value) event).booleanValue();
} else {
event = Conversions.coerce(actualReturnType, event);
}
break;
default:
event = Conversions.coerce(actualReturnType, event);
}
}
//noinspection unchecked
handler.accept(event);
}
}
@Override
public void onError(Throwable error) {
handler.onError(error);
}
@Override
public void onTimeout() {
handler.onTimeout();
}
};
} } | public class class_name {
private <T> Callback createHandler(final Class<T> serviceInterface, final MethodCall call,
final Callback handler) {
final ClassMeta<T> clsMeta = ClassMeta.classMeta(serviceInterface);
final MethodAccess method = clsMeta.method(call.name());
Class<?> returnType = null;
Class<?> compType = null;
if (Promise.class.isAssignableFrom(method.returnType()) ) {
Type t0 = method.method().getGenericReturnType();
if (t0 instanceof ParameterizedType) {
ParameterizedType parameterizedType = ((ParameterizedType) t0);
Type type = ((parameterizedType != null ? parameterizedType.getActualTypeArguments().length : 0) > 0 ? (parameterizedType != null ? parameterizedType.getActualTypeArguments() : new Type[0])[0] : null);
if (type instanceof ParameterizedType) {
returnType = (Class) ((ParameterizedType) type).getRawType(); // depends on control dependency: [if], data = [none]
final Type type1 = ((ParameterizedType) type).getActualTypeArguments()[0];
if (type1 instanceof Class) {
compType = (Class) type1; // depends on control dependency: [if], data = [none]
}
} else if (type instanceof Class) {
returnType = (Class<?>) type; // depends on control dependency: [if], data = [none]
}
}
} else {
if (method.parameterTypes().length > 0) {
Type[] genericParameterTypes = method.getGenericParameterTypes();
ParameterizedType parameterizedType = genericParameterTypes.length > 0 ? (ParameterizedType) genericParameterTypes[0] : null;
Type type = ((parameterizedType != null ? parameterizedType.getActualTypeArguments().length : 0) > 0 ? (parameterizedType != null ? parameterizedType.getActualTypeArguments() : new Type[0])[0] : null);
if (type instanceof ParameterizedType) {
returnType = (Class) ((ParameterizedType) type).getRawType(); // depends on control dependency: [if], data = [none]
final Type type1 = ((ParameterizedType) type).getActualTypeArguments()[0];
if (type1 instanceof Class) {
compType = (Class) type1; // depends on control dependency: [if], data = [none]
}
} else if (type instanceof Class) {
returnType = (Class<?>) type; // depends on control dependency: [if], data = [none]
}
}
}
final Class<?> actualReturnType = returnType;
final Class<?> componentClass = compType;
/** Create the return handler. */
return new Callback<Object>() {
@Override
public void accept(Object event) {
if (actualReturnType != null) {
if (componentClass != null && actualReturnType == List.class) {
try {
//noinspection unchecked
event = MapObjectConversion.convertListOfMapsToObjects(componentClass, (List) event); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
if (event instanceof CharSequence) {
String errorMessage = event.toString();
if (errorMessage.startsWith("java.lang.IllegalState")) {
handler.onError(new IllegalStateException(errorMessage));
return; // depends on control dependency: [if], data = [none]
} else {
handler.onError(new IllegalStateException("Conversion error")); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} else { // depends on control dependency: [if], data = [none] // depends on control dependency: [catch], data = [none]
handler.onError(new IllegalStateException("Conversion error"));
return;
}
}
} else {
switch (actualReturnType.getName()) {
case "java.lang.Boolean":
if (event instanceof Value) {
event = ((Value) event).booleanValue(); // depends on control dependency: [if], data = [none]
} else {
event = Conversions.coerce(actualReturnType, event); // depends on control dependency: [if], data = [none]
}
break;
default:
event = Conversions.coerce(actualReturnType, event);
}
}
//noinspection unchecked
handler.accept(event);
}
}
@Override
public void onError(Throwable error) {
handler.onError(error);
}
@Override
public void onTimeout() {
handler.onTimeout();
}
};
} } |
public class class_name {
protected final int initTargetAndStg(){
this.target = this.optionTarget.getValue();
if(this.target==null){
System.err.println(this.getAppName() + ": no target set");
return -1;
}
String fileName = this.optionStgFile.getValue();
try{
this.stg = new STGroupFile(fileName);
}
catch(Exception e){
System.err.println(this.getAppName() + ": cannot load stg file <" + fileName + ">, general exception\n--> " + e);
return -1;
}
String[] availableTargets = null;
try{
availableTargets = StringUtils.split(this.stg.getInstanceOf("supportedTargets").render(), " , ");
}
catch(Exception e){
System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not contain <supportedTargets> function");
return -1;
}
if(availableTargets.length==0){
System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not have a list of targets in <supportedTargets> function");
return -1;
}
if(!ArrayUtils.contains(availableTargets, this.target)){
System.err.println(this.getAppName() + ": target " + this.target + " not supported in stg file <" + fileName + ">");
return -1;
}
System.out.println(this.getAppName() + ": generating scripts for target: " + this.target);
System.out.println();
return 0;
} } | public class class_name {
protected final int initTargetAndStg(){
this.target = this.optionTarget.getValue();
if(this.target==null){
System.err.println(this.getAppName() + ": no target set"); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
String fileName = this.optionStgFile.getValue();
try{
this.stg = new STGroupFile(fileName); // depends on control dependency: [try], data = [none]
}
catch(Exception e){
System.err.println(this.getAppName() + ": cannot load stg file <" + fileName + ">, general exception\n--> " + e);
return -1;
} // depends on control dependency: [catch], data = [none]
String[] availableTargets = null;
try{
availableTargets = StringUtils.split(this.stg.getInstanceOf("supportedTargets").render(), " , "); // depends on control dependency: [try], data = [none]
}
catch(Exception e){
System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not contain <supportedTargets> function");
return -1;
} // depends on control dependency: [catch], data = [none]
if(availableTargets.length==0){
System.err.println(this.getAppName() + ": stg file <" + fileName + "> does not have a list of targets in <supportedTargets> function"); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
if(!ArrayUtils.contains(availableTargets, this.target)){
System.err.println(this.getAppName() + ": target " + this.target + " not supported in stg file <" + fileName + ">"); // depends on control dependency: [if], data = [none]
return -1; // depends on control dependency: [if], data = [none]
}
System.out.println(this.getAppName() + ": generating scripts for target: " + this.target);
System.out.println();
return 0;
} } |
public class class_name {
public GetInvitationConfigurationResult withPrivateSkillIds(String... privateSkillIds) {
if (this.privateSkillIds == null) {
setPrivateSkillIds(new java.util.ArrayList<String>(privateSkillIds.length));
}
for (String ele : privateSkillIds) {
this.privateSkillIds.add(ele);
}
return this;
} } | public class class_name {
public GetInvitationConfigurationResult withPrivateSkillIds(String... privateSkillIds) {
if (this.privateSkillIds == null) {
setPrivateSkillIds(new java.util.ArrayList<String>(privateSkillIds.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : privateSkillIds) {
this.privateSkillIds.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static int lengthOf(WsByteBuffer[] src, int startIndex) {
int length = 0;
if (null != src) {
for (int i = startIndex; i < src.length && null != src[i]; i++) {
length += src[i].remaining();
}
}
return length;
} } | public class class_name {
public static int lengthOf(WsByteBuffer[] src, int startIndex) {
int length = 0;
if (null != src) {
for (int i = startIndex; i < src.length && null != src[i]; i++) {
length += src[i].remaining(); // depends on control dependency: [for], data = [i]
}
}
return length;
} } |
public class class_name {
@Check
public void checkContainerType(SarlBehavior behavior) {
final XtendTypeDeclaration declaringType = behavior.getDeclaringType();
if (declaringType != null) {
final String name = canonicalName(declaringType);
assert name != null;
error(MessageFormat.format(Messages.SARLValidator_29, name),
behavior,
null,
INVALID_NESTED_DEFINITION);
}
} } | public class class_name {
@Check
public void checkContainerType(SarlBehavior behavior) {
final XtendTypeDeclaration declaringType = behavior.getDeclaringType();
if (declaringType != null) {
final String name = canonicalName(declaringType);
assert name != null;
error(MessageFormat.format(Messages.SARLValidator_29, name),
behavior,
null,
INVALID_NESTED_DEFINITION); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public synchronized boolean advanceToLastPostedRunnable() {
long currentMaxTime = currentTime;
for (ScheduledRunnable scheduled : runnables) {
if (currentMaxTime < scheduled.scheduledTime) {
currentMaxTime = scheduled.scheduledTime;
}
}
return advanceTo(currentMaxTime);
} } | public class class_name {
public synchronized boolean advanceToLastPostedRunnable() {
long currentMaxTime = currentTime;
for (ScheduledRunnable scheduled : runnables) {
if (currentMaxTime < scheduled.scheduledTime) {
currentMaxTime = scheduled.scheduledTime; // depends on control dependency: [if], data = [none]
}
}
return advanceTo(currentMaxTime);
} } |
public class class_name {
public static DoubleVector copyOf(DoubleVector source) {
if (source == null)
return null;
DoubleVector result = null;
if (source instanceof SparseDoubleVector) {
result = new CompactSparseVector(source.length());
copyFromSparseVector(result, source);
} else if (source instanceof DenseVector ||
source instanceof ScaledDoubleVector) {
result = new DenseVector(source.length());
for (int i = 0; i < source.length(); ++i)
result.set(i, source.get(i));
} else if (source instanceof AmortizedSparseVector) {
result = new AmortizedSparseVector(source.length());
copyFromSparseVector(result, source);
} else if (source instanceof DoubleVectorView) {
DoubleVectorView view = (DoubleVectorView) source;
return copyOf(view.getOriginalVector());
} else {
// Create a copy of the given class using reflection.
// First check whether we can find a copy contructor that accepts an
// instance of Vector
Class<? extends DoubleVector> sourceClazz = source.getClass();
try {
Constructor<? extends DoubleVector> constructor =
sourceClazz.getConstructor(DoubleVector.class);
result = (DoubleVector) constructor.newInstance(source);
}
// If there wasn't a copy constructor, see if there's one that
// accepts the length and then we'll copy the data over manually
catch (NoSuchMethodException nsme) {
try {
Constructor<? extends DoubleVector> constructor =
sourceClazz.getConstructor(Integer.TYPE);
int length = source.length();
result = (DoubleVector) constructor.newInstance(
Integer.valueOf(length));
// Copy the data over
for (int i = 0; i < length; ++i)
result.set(i, source.get(i));
}
catch (Exception e) {
throw new UnsupportedOperationException(
"Could not find applicalble way to copy a vector " +
"of type " + source.getClass(), e);
}
}
catch (Exception e) {
throw new UnsupportedOperationException(
"Could not find applicalble way to copy a vector " +
"of type " + source.getClass(), e);
}
}
return result;
} } | public class class_name {
public static DoubleVector copyOf(DoubleVector source) {
if (source == null)
return null;
DoubleVector result = null;
if (source instanceof SparseDoubleVector) {
result = new CompactSparseVector(source.length()); // depends on control dependency: [if], data = [none]
copyFromSparseVector(result, source); // depends on control dependency: [if], data = [none]
} else if (source instanceof DenseVector ||
source instanceof ScaledDoubleVector) {
result = new DenseVector(source.length()); // depends on control dependency: [if], data = [none]
for (int i = 0; i < source.length(); ++i)
result.set(i, source.get(i));
} else if (source instanceof AmortizedSparseVector) {
result = new AmortizedSparseVector(source.length()); // depends on control dependency: [if], data = [none]
copyFromSparseVector(result, source); // depends on control dependency: [if], data = [none]
} else if (source instanceof DoubleVectorView) {
DoubleVectorView view = (DoubleVectorView) source;
return copyOf(view.getOriginalVector()); // depends on control dependency: [if], data = [none]
} else {
// Create a copy of the given class using reflection.
// First check whether we can find a copy contructor that accepts an
// instance of Vector
Class<? extends DoubleVector> sourceClazz = source.getClass();
try {
Constructor<? extends DoubleVector> constructor =
sourceClazz.getConstructor(DoubleVector.class);
result = (DoubleVector) constructor.newInstance(source);
}
// If there wasn't a copy constructor, see if there's one that
// accepts the length and then we'll copy the data over manually
catch (NoSuchMethodException nsme) {
try {
Constructor<? extends DoubleVector> constructor =
sourceClazz.getConstructor(Integer.TYPE); // depends on control dependency: [try], data = [none]
int length = source.length();
result = (DoubleVector) constructor.newInstance(
Integer.valueOf(length)); // depends on control dependency: [try], data = [none]
// Copy the data over
for (int i = 0; i < length; ++i)
result.set(i, source.get(i));
}
catch (Exception e) {
throw new UnsupportedOperationException(
"Could not find applicalble way to copy a vector " +
"of type " + source.getClass(), e);
} // depends on control dependency: [catch], data = [none]
}
catch (Exception e) {
throw new UnsupportedOperationException(
"Could not find applicalble way to copy a vector " +
"of type " + source.getClass(), e);
}
}
return result;
} } |
public class class_name {
private String getIdentifier(final int columnIndex) {
final int index = getTable().convertColumnIndexToView(columnIndex);
// selon MTable.addColumn, l'identifier est de type String
final Object identifier = getTable().getColumnModel().getColumn(index).getIdentifier();
if (identifier instanceof String) {
// si l'identifier est de type String, alors on va l'utiliser dans getValueAt, getColumnClass ou getColumnName
return (String) identifier;
}
// mais sinon on ignore l'identifier et ces 3 méthodes auront un comportement par défaut
return null;
} } | public class class_name {
private String getIdentifier(final int columnIndex) {
final int index = getTable().convertColumnIndexToView(columnIndex);
// selon MTable.addColumn, l'identifier est de type String
final Object identifier = getTable().getColumnModel().getColumn(index).getIdentifier();
if (identifier instanceof String) {
// si l'identifier est de type String, alors on va l'utiliser dans getValueAt, getColumnClass ou getColumnName
return (String) identifier;
// depends on control dependency: [if], data = [none]
}
// mais sinon on ignore l'identifier et ces 3 méthodes auront un comportement par défaut
return null;
} } |
public class class_name {
public static MonthDay randomMonthDay(boolean includeLeapDay) {
Month month = randomMonth();
int dayOfMonth = RandomUtils.nextInt(1, month.maxLength() + 1);
MonthDay monthDay = MonthDay.of(month, dayOfMonth);
if (!includeLeapDay && DateUtils.isLeapDay(monthDay)) {
return randomMonthDay(false);
}
return monthDay;
} } | public class class_name {
public static MonthDay randomMonthDay(boolean includeLeapDay) {
Month month = randomMonth();
int dayOfMonth = RandomUtils.nextInt(1, month.maxLength() + 1);
MonthDay monthDay = MonthDay.of(month, dayOfMonth);
if (!includeLeapDay && DateUtils.isLeapDay(monthDay)) {
return randomMonthDay(false); // depends on control dependency: [if], data = [none]
}
return monthDay;
} } |
public class class_name {
public static String localHostName() {
try {
InetAddress localhost = InetAddress.getLocalHost();
return localhost.getHostName();
} catch (Exception e) {
InternalLogFactory.getLog(AwsHostNameUtils.class)
.debug(
"Failed to determine the local hostname; fall back to "
+ "use \"localhost\".", e);
return "localhost";
}
} } | public class class_name {
public static String localHostName() {
try {
InetAddress localhost = InetAddress.getLocalHost();
return localhost.getHostName(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
InternalLogFactory.getLog(AwsHostNameUtils.class)
.debug(
"Failed to determine the local hostname; fall back to "
+ "use \"localhost\".", e);
return "localhost";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String get(final String key, final String def) {
try {
return systemRoot.get(fixKey(key), def);
} catch (final Exception e) {
// just eat the exception to avoid any system crash on system issues
return def;
}
} } | public class class_name {
public static String get(final String key, final String def) {
try {
return systemRoot.get(fixKey(key), def); // depends on control dependency: [try], data = [none]
} catch (final Exception e) {
// just eat the exception to avoid any system crash on system issues
return def;
} // depends on control dependency: [catch], data = [none]
} } |
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<Interessent.Wunsch> getWunsch() {
if (wunsch == null) {
wunsch = new ArrayList<Interessent.Wunsch>();
}
return this.wunsch;
} } | 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<Interessent.Wunsch> getWunsch() {
if (wunsch == null) {
wunsch = new ArrayList<Interessent.Wunsch>(); // depends on control dependency: [if], data = [none]
}
return this.wunsch;
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync() {
return listNodeAgentSkusSinglePageAsync()
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, null));
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> listNodeAgentSkusWithServiceResponseAsync() {
return listNodeAgentSkusSinglePageAsync()
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders>> call(ServiceResponseWithHeaders<Page<NodeAgentSku>, AccountListNodeAgentSkusHeaders> 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(listNodeAgentSkusNextWithServiceResponseAsync(nextPageLink, null));
}
});
} } |
public class class_name {
public void marshall(Grantee grantee, ProtocolMarshaller protocolMarshaller) {
if (grantee == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(grantee.getType(), TYPE_BINDING);
protocolMarshaller.marshall(grantee.getDisplayName(), DISPLAYNAME_BINDING);
protocolMarshaller.marshall(grantee.getURI(), URI_BINDING);
protocolMarshaller.marshall(grantee.getID(), ID_BINDING);
protocolMarshaller.marshall(grantee.getEmailAddress(), EMAILADDRESS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Grantee grantee, ProtocolMarshaller protocolMarshaller) {
if (grantee == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(grantee.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(grantee.getDisplayName(), DISPLAYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(grantee.getURI(), URI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(grantee.getID(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(grantee.getEmailAddress(), EMAILADDRESS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean offer(Task task)
{
try
{
return this.offer(task, 0, TimeUnit.SECONDS);
}
catch (InterruptedException e)
{
return false;
}
} } | public class class_name {
public boolean offer(Task task)
{
try
{
return this.offer(task, 0, TimeUnit.SECONDS);
// depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
return false;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setServices(java.util.Collection<ErrorRootCauseService> services) {
if (services == null) {
this.services = null;
return;
}
this.services = new java.util.ArrayList<ErrorRootCauseService>(services);
} } | public class class_name {
public void setServices(java.util.Collection<ErrorRootCauseService> services) {
if (services == null) {
this.services = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.services = new java.util.ArrayList<ErrorRootCauseService>(services);
} } |
public class class_name {
private MapReduceCommand parseMapReduceCommand(String jsonClause)
{
String collectionName = jsonClause.replaceFirst("(?ms).*?\\.\\s*(.+?)\\s*\\.\\s*mapReduce\\s*\\(.*", "$1");
if (collectionName.contains("getCollection"))
{
collectionName = collectionName
.replaceFirst(".*getCollection\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\).*", "$2");
}
DBCollection collection = mongoDb.getCollection(collectionName);
String body = jsonClause.replaceFirst("^(?ms).*?mapReduce\\s*\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", "$1");
String mapFunction = findCommaSeparatedArgument(body, 0).trim();
String reduceFunction = findCommaSeparatedArgument(body, 1).trim();
String query = findCommaSeparatedArgument(body, 2).trim();
DBObject parameters = (DBObject) JSON.parse(query);
DBObject mongoQuery;
if (parameters.containsField("query"))
{
mongoQuery = (DBObject) parameters.get("query");
}
else
{
mongoQuery = new BasicDBObject();
}
return new MapReduceCommand(collection, mapFunction, reduceFunction, null, MapReduceCommand.OutputType.INLINE,
mongoQuery);
} } | public class class_name {
private MapReduceCommand parseMapReduceCommand(String jsonClause)
{
String collectionName = jsonClause.replaceFirst("(?ms).*?\\.\\s*(.+?)\\s*\\.\\s*mapReduce\\s*\\(.*", "$1");
if (collectionName.contains("getCollection"))
{
collectionName = collectionName
.replaceFirst(".*getCollection\\s*\\(\\s*(['\"])([^'\"]+)\\1\\s*\\).*", "$2"); // depends on control dependency: [if], data = [none]
}
DBCollection collection = mongoDb.getCollection(collectionName);
String body = jsonClause.replaceFirst("^(?ms).*?mapReduce\\s*\\(\\s*(.*)\\s*\\)\\s*;?\\s*$", "$1");
String mapFunction = findCommaSeparatedArgument(body, 0).trim();
String reduceFunction = findCommaSeparatedArgument(body, 1).trim();
String query = findCommaSeparatedArgument(body, 2).trim();
DBObject parameters = (DBObject) JSON.parse(query);
DBObject mongoQuery;
if (parameters.containsField("query"))
{
mongoQuery = (DBObject) parameters.get("query"); // depends on control dependency: [if], data = [none]
}
else
{
mongoQuery = new BasicDBObject(); // depends on control dependency: [if], data = [none]
}
return new MapReduceCommand(collection, mapFunction, reduceFunction, null, MapReduceCommand.OutputType.INLINE,
mongoQuery);
} } |
public class class_name {
private final static void pass2(ShortBuffer data) {
int tmp0, tmp1, tmp2, tmp3;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5;
int d0, d1, d2, d3, d4, d5, d6, d7;
ShortBuffer dataptr = data.duplicate();
/* Pass 2: process columns. */
/* Note that we must descale the results by a factor of 8 == 23, */
/* and also undo the PASS1_BITS scaling. */
for (int rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/*
* Columns of zeroes can be exploited in the same way as we did with
* rows. However, the row calculation has created many nonzero AC
* terms, so the simplification applies less often (typically 5% to
* 10% of the time). On machines with very fast multiplication, it's
* possible that the test takes more time than it's worth. In that
* case this section may be commented out.
*/
d0 = dataptr.get(DCTSIZE_0);
d1 = dataptr.get(DCTSIZE_1);
d2 = dataptr.get(DCTSIZE_2);
d3 = dataptr.get(DCTSIZE_3);
d4 = dataptr.get(DCTSIZE_4);
d5 = dataptr.get(DCTSIZE_5);
d6 = dataptr.get(DCTSIZE_6);
d7 = dataptr.get(DCTSIZE_7);
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)c(-6). */
if (d6 != 0) {
if (d2 != 0) {
/* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX_0_541196100);
tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065);
tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865);
tmp0 = (d0 + d4) << CONST_BITS;
tmp1 = (d0 - d4) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
} else {
/* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
tmp2 = MULTIPLY(-d6, FIX_1_306562965);
tmp3 = MULTIPLY(d6, FIX_0_541196100);
tmp0 = (d0 + d4) << CONST_BITS;
tmp1 = (d0 - d4) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
}
} else {
if (d2 != 0) {
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX_0_541196100);
tmp3 = MULTIPLY(d2, FIX_1_306562965);
tmp0 = (d0 + d4) << CONST_BITS;
tmp1 = (d0 - d4) << CONST_BITS;
tmp10 = tmp0 + tmp3;
tmp13 = tmp0 - tmp3;
tmp11 = tmp1 + tmp2;
tmp12 = tmp1 - tmp2;
} else {
/* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
}
}
/*
* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
if (d7 != 0) {
if (d5 != 0) {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
z1 = d7 + d1;
z2 = d5 + d3;
z3 = d7 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
tmp0 = MULTIPLY(d7, FIX_0_298631336);
tmp1 = MULTIPLY(d5, FIX_2_053119869);
tmp2 = MULTIPLY(d3, FIX_3_072711026);
tmp3 = MULTIPLY(d1, FIX_1_501321110);
z1 = MULTIPLY(-z1, FIX_0_899976223);
z2 = MULTIPLY(-z2, FIX_2_562915447);
z3 = MULTIPLY(-z3, FIX_1_961570560);
z4 = MULTIPLY(-z4, FIX_0_390180644);
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
} else {
/* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
z1 = d7;
z2 = d5 + d3;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d5, FIX_1_175875602);
tmp0 = MULTIPLY(d7, FIX_0_298631336);
tmp1 = MULTIPLY(d5, FIX_2_053119869);
tmp2 = MULTIPLY(d3, FIX_3_072711026);
z1 = MULTIPLY(-d7, FIX_0_899976223);
z2 = MULTIPLY(-z2, FIX_2_562915447);
z3 = MULTIPLY(-z3, FIX_1_961570560);
z4 = MULTIPLY(-d5, FIX_0_390180644);
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 = z1 + z4;
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
z1 = d7 + d1;
z2 = d5;
z3 = d7;
z4 = d5 + d1;
z5 = MULTIPLY(z3 + z4, FIX_1_175875602);
tmp0 = MULTIPLY(d7, FIX_0_298631336);
tmp1 = MULTIPLY(d5, FIX_2_053119869);
tmp3 = MULTIPLY(d1, FIX_1_501321110);
z1 = MULTIPLY(-z1, FIX_0_899976223);
z2 = MULTIPLY(-d5, FIX_2_562915447);
z3 = MULTIPLY(-d7, FIX_1_961570560);
z4 = MULTIPLY(-z4, FIX_0_390180644);
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 += z2 + z4;
tmp2 = z2 + z3;
tmp3 += z1 + z4;
} else {
/* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
tmp0 = MULTIPLY(-d7, FIX_0_601344887);
z1 = MULTIPLY(-d7, FIX_0_899976223);
z3 = MULTIPLY(-d7, FIX_1_961570560);
tmp1 = MULTIPLY(-d5, FIX_0_509795579);
z2 = MULTIPLY(-d5, FIX_2_562915447);
z4 = MULTIPLY(-d5, FIX_0_390180644);
z5 = MULTIPLY(d5 + d7, FIX_1_175875602);
z3 += z5;
z4 += z5;
tmp0 += z3;
tmp1 += z4;
tmp2 = z2 + z3;
tmp3 = z1 + z4;
}
}
} else {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
z1 = d7 + d1;
z3 = d7 + d3;
z5 = MULTIPLY(z3 + d1, FIX_1_175875602);
tmp0 = MULTIPLY(d7, FIX_0_298631336);
tmp2 = MULTIPLY(d3, FIX_3_072711026);
tmp3 = MULTIPLY(d1, FIX_1_501321110);
z1 = MULTIPLY(-z1, FIX_0_899976223);
z2 = MULTIPLY(-d3, FIX_2_562915447);
z3 = MULTIPLY(-z3, FIX_1_961570560);
z4 = MULTIPLY(-d1, FIX_0_390180644);
z3 += z5;
z4 += z5;
tmp0 += z1 + z3;
tmp1 = z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
} else {
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
z3 = d7 + d3;
tmp0 = MULTIPLY(-d7, FIX_0_601344887);
z1 = MULTIPLY(-d7, FIX_0_899976223);
tmp2 = MULTIPLY(d3, FIX_0_509795579);
z2 = MULTIPLY(-d3, FIX_2_562915447);
z5 = MULTIPLY(z3, FIX_1_175875602);
z3 = MULTIPLY(-z3, FIX_0_785694958);
tmp0 += z3;
tmp1 = z2 + z5;
tmp2 += z3;
tmp3 = z1 + z5;
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
z1 = d7 + d1;
z5 = MULTIPLY(z1, FIX_1_175875602);
z1 = MULTIPLY(z1, FIX_0_275899380);
z3 = MULTIPLY(-d7, FIX_1_961570560);
tmp0 = MULTIPLY(-d7, FIX_1_662939225);
z4 = MULTIPLY(-d1, FIX_0_390180644);
tmp3 = MULTIPLY(d1, FIX_1_111140466);
tmp0 += z1;
tmp1 = z4 + z5;
tmp2 = z3 + z5;
tmp3 += z1;
} else {
/* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
tmp0 = MULTIPLY(-d7, FIX_1_387039845);
tmp1 = MULTIPLY(d7, FIX_1_175875602);
tmp2 = MULTIPLY(-d7, FIX_0_785694958);
tmp3 = MULTIPLY(d7, FIX_0_275899380);
}
}
}
} else {
if (d5 != 0) {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
z2 = d5 + d3;
z4 = d5 + d1;
z5 = MULTIPLY(d3 + z4, FIX_1_175875602);
tmp1 = MULTIPLY(d5, FIX_2_053119869);
tmp2 = MULTIPLY(d3, FIX_3_072711026);
tmp3 = MULTIPLY(d1, FIX_1_501321110);
z1 = MULTIPLY(-d1, FIX_0_899976223);
z2 = MULTIPLY(-z2, FIX_2_562915447);
z3 = MULTIPLY(-d3, FIX_1_961570560);
z4 = MULTIPLY(-z4, FIX_0_390180644);
z3 += z5;
z4 += z5;
tmp0 = z1 + z3;
tmp1 += z2 + z4;
tmp2 += z2 + z3;
tmp3 += z1 + z4;
} else {
/* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
z2 = d5 + d3;
z5 = MULTIPLY(z2, FIX_1_175875602);
tmp1 = MULTIPLY(d5, FIX_1_662939225);
z4 = MULTIPLY(-d5, FIX_0_390180644);
z2 = MULTIPLY(-z2, FIX_1_387039845);
tmp2 = MULTIPLY(d3, FIX_1_111140466);
z3 = MULTIPLY(-d3, FIX_1_961570560);
tmp0 = z3 + z5;
tmp1 += z2;
tmp2 += z2;
tmp3 = z4 + z5;
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
z4 = d5 + d1;
z5 = MULTIPLY(z4, FIX_1_175875602);
z1 = MULTIPLY(-d1, FIX_0_899976223);
tmp3 = MULTIPLY(d1, FIX_0_601344887);
tmp1 = MULTIPLY(-d5, FIX_0_509795579);
z2 = MULTIPLY(-d5, FIX_2_562915447);
z4 = MULTIPLY(z4, FIX_0_785694958);
tmp0 = z1 + z5;
tmp1 += z4;
tmp2 = z2 + z5;
tmp3 += z4;
} else {
/* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
tmp0 = MULTIPLY(d5, FIX_1_175875602);
tmp1 = MULTIPLY(d5, FIX_0_275899380);
tmp2 = MULTIPLY(-d5, FIX_1_387039845);
tmp3 = MULTIPLY(d5, FIX_0_785694958);
}
}
} else {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
z5 = d1 + d3;
tmp3 = MULTIPLY(d1, FIX_0_211164243);
tmp2 = MULTIPLY(-d3, FIX_1_451774981);
z1 = MULTIPLY(d1, FIX_1_061594337);
z2 = MULTIPLY(-d3, FIX_2_172734803);
z4 = MULTIPLY(z5, FIX_0_785694958);
z5 = MULTIPLY(z5, FIX_1_175875602);
tmp0 = z1 - z4;
tmp1 = z2 + z4;
tmp2 += z5;
tmp3 += z5;
} else {
/* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
tmp0 = MULTIPLY(-d3, FIX_0_785694958);
tmp1 = MULTIPLY(-d3, FIX_1_387039845);
tmp2 = MULTIPLY(-d3, FIX_0_275899380);
tmp3 = MULTIPLY(d3, FIX_1_175875602);
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
tmp0 = MULTIPLY(d1, FIX_0_275899380);
tmp1 = MULTIPLY(d1, FIX_0_785694958);
tmp2 = MULTIPLY(d1, FIX_1_175875602);
tmp3 = MULTIPLY(d1, FIX_1_387039845);
} else {
/* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
tmp0 = tmp1 = tmp2 = tmp3 = 0;
}
}
}
}
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr.put(DCTSIZE_0, DESCALE18(tmp10 + tmp3));
dataptr.put(DCTSIZE_7, DESCALE18(tmp10 - tmp3));
dataptr.put(DCTSIZE_1, DESCALE18(tmp11 + tmp2));
dataptr.put(DCTSIZE_6, DESCALE18(tmp11 - tmp2));
dataptr.put(DCTSIZE_2, DESCALE18(tmp12 + tmp1));
dataptr.put(DCTSIZE_5, DESCALE18(tmp12 - tmp1));
dataptr.put(DCTSIZE_3, DESCALE18(tmp13 + tmp0));
dataptr.put(DCTSIZE_4, DESCALE18(tmp13 - tmp0));
dataptr = advance(dataptr, 1); /* advance pointer to next column */
}
} } | public class class_name {
private final static void pass2(ShortBuffer data) {
int tmp0, tmp1, tmp2, tmp3;
int tmp10, tmp11, tmp12, tmp13;
int z1, z2, z3, z4, z5;
int d0, d1, d2, d3, d4, d5, d6, d7;
ShortBuffer dataptr = data.duplicate();
/* Pass 2: process columns. */
/* Note that we must descale the results by a factor of 8 == 23, */
/* and also undo the PASS1_BITS scaling. */
for (int rowctr = DCTSIZE - 1; rowctr >= 0; rowctr--) {
/*
* Columns of zeroes can be exploited in the same way as we did with
* rows. However, the row calculation has created many nonzero AC
* terms, so the simplification applies less often (typically 5% to
* 10% of the time). On machines with very fast multiplication, it's
* possible that the test takes more time than it's worth. In that
* case this section may be commented out.
*/
d0 = dataptr.get(DCTSIZE_0); // depends on control dependency: [for], data = [none]
d1 = dataptr.get(DCTSIZE_1); // depends on control dependency: [for], data = [none]
d2 = dataptr.get(DCTSIZE_2); // depends on control dependency: [for], data = [none]
d3 = dataptr.get(DCTSIZE_3); // depends on control dependency: [for], data = [none]
d4 = dataptr.get(DCTSIZE_4); // depends on control dependency: [for], data = [none]
d5 = dataptr.get(DCTSIZE_5); // depends on control dependency: [for], data = [none]
d6 = dataptr.get(DCTSIZE_6); // depends on control dependency: [for], data = [none]
d7 = dataptr.get(DCTSIZE_7); // depends on control dependency: [for], data = [none]
/* Even part: reverse the even part of the forward DCT. */
/* The rotator is sqrt(2)c(-6). */
if (d6 != 0) {
if (d2 != 0) {
/* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
z1 = MULTIPLY(d2 + d6, FIX_0_541196100); // depends on control dependency: [if], data = [(d2]
tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); // depends on control dependency: [if], data = [none]
tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); // depends on control dependency: [if], data = [(d2]
tmp0 = (d0 + d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp1 = (d0 - d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp10 = tmp0 + tmp3; // depends on control dependency: [if], data = [none]
tmp13 = tmp0 - tmp3; // depends on control dependency: [if], data = [none]
tmp11 = tmp1 + tmp2; // depends on control dependency: [if], data = [none]
tmp12 = tmp1 - tmp2; // depends on control dependency: [if], data = [none]
} else {
/* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
tmp2 = MULTIPLY(-d6, FIX_1_306562965); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d6, FIX_0_541196100); // depends on control dependency: [if], data = [0)]
tmp0 = (d0 + d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp1 = (d0 - d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp10 = tmp0 + tmp3; // depends on control dependency: [if], data = [none]
tmp13 = tmp0 - tmp3; // depends on control dependency: [if], data = [none]
tmp11 = tmp1 + tmp2; // depends on control dependency: [if], data = [none]
tmp12 = tmp1 - tmp2; // depends on control dependency: [if], data = [none]
}
} else {
if (d2 != 0) {
/* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
tmp2 = MULTIPLY(d2, FIX_0_541196100); // depends on control dependency: [if], data = [(d2]
tmp3 = MULTIPLY(d2, FIX_1_306562965); // depends on control dependency: [if], data = [(d2]
tmp0 = (d0 + d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp1 = (d0 - d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp10 = tmp0 + tmp3; // depends on control dependency: [if], data = [none]
tmp13 = tmp0 - tmp3; // depends on control dependency: [if], data = [none]
tmp11 = tmp1 + tmp2; // depends on control dependency: [if], data = [none]
tmp12 = tmp1 - tmp2; // depends on control dependency: [if], data = [none]
} else {
/* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
tmp10 = tmp13 = (d0 + d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
tmp11 = tmp12 = (d0 - d4) << CONST_BITS; // depends on control dependency: [if], data = [none]
}
}
/*
* Odd part per figure 8; the matrix is unitary and hence its
* transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively.
*/
if (d7 != 0) {
if (d5 != 0) {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
z1 = d7 + d1; // depends on control dependency: [if], data = [none]
z2 = d5 + d3; // depends on control dependency: [if], data = [none]
z3 = d7 + d3; // depends on control dependency: [if], data = [none]
z4 = d5 + d1; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp0 = MULTIPLY(d7, FIX_0_298631336); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_2_053119869); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_3_072711026); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_1_501321110); // depends on control dependency: [if], data = [(d1]
z1 = MULTIPLY(-z1, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-z2, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-z3, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
z4 = MULTIPLY(-z4, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 += z1 + z3; // depends on control dependency: [if], data = [none]
tmp1 += z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 += z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 += z1 + z4; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
z1 = d7; // depends on control dependency: [if], data = [none]
z2 = d5 + d3; // depends on control dependency: [if], data = [none]
z3 = d7 + d3; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z3 + d5, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp0 = MULTIPLY(d7, FIX_0_298631336); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_2_053119869); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_3_072711026); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(-d7, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-z2, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-z3, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
z4 = MULTIPLY(-d5, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 += z1 + z3; // depends on control dependency: [if], data = [none]
tmp1 += z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 += z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 = z1 + z4; // depends on control dependency: [if], data = [none]
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
z1 = d7 + d1; // depends on control dependency: [if], data = [none]
z2 = d5; // depends on control dependency: [if], data = [none]
z3 = d7; // depends on control dependency: [if], data = [none]
z4 = d5 + d1; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z3 + z4, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp0 = MULTIPLY(d7, FIX_0_298631336); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_2_053119869); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_1_501321110); // depends on control dependency: [if], data = [(d1]
z1 = MULTIPLY(-z1, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-d5, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-d7, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
z4 = MULTIPLY(-z4, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 += z1 + z3; // depends on control dependency: [if], data = [none]
tmp1 += z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 = z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 += z1 + z4; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
tmp0 = MULTIPLY(-d7, FIX_0_601344887); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(-d7, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-d7, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
tmp1 = MULTIPLY(-d5, FIX_0_509795579); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-d5, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z4 = MULTIPLY(-d5, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(d5 + d7, FIX_1_175875602); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 += z3; // depends on control dependency: [if], data = [none]
tmp1 += z4; // depends on control dependency: [if], data = [none]
tmp2 = z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 = z1 + z4; // depends on control dependency: [if], data = [none]
}
}
} else {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
z1 = d7 + d1; // depends on control dependency: [if], data = [none]
z3 = d7 + d3; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z3 + d1, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp0 = MULTIPLY(d7, FIX_0_298631336); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_3_072711026); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_1_501321110); // depends on control dependency: [if], data = [(d1]
z1 = MULTIPLY(-z1, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-d3, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-z3, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
z4 = MULTIPLY(-d1, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 += z1 + z3; // depends on control dependency: [if], data = [none]
tmp1 = z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 += z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 += z1 + z4; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
z3 = d7 + d3; // depends on control dependency: [if], data = [none]
tmp0 = MULTIPLY(-d7, FIX_0_601344887); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(-d7, FIX_0_899976223); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_0_509795579); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-d3, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z3, FIX_1_175875602); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-z3, FIX_0_785694958); // depends on control dependency: [if], data = [none]
tmp0 += z3; // depends on control dependency: [if], data = [none]
tmp1 = z2 + z5; // depends on control dependency: [if], data = [none]
tmp2 += z3; // depends on control dependency: [if], data = [none]
tmp3 = z1 + z5; // depends on control dependency: [if], data = [none]
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
z1 = d7 + d1; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z1, FIX_1_175875602); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(z1, FIX_0_275899380); // depends on control dependency: [if], data = [0)]
z3 = MULTIPLY(-d7, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
tmp0 = MULTIPLY(-d7, FIX_1_662939225); // depends on control dependency: [if], data = [none]
z4 = MULTIPLY(-d1, FIX_0_390180644); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_1_111140466); // depends on control dependency: [if], data = [(d1]
tmp0 += z1; // depends on control dependency: [if], data = [none]
tmp1 = z4 + z5; // depends on control dependency: [if], data = [none]
tmp2 = z3 + z5; // depends on control dependency: [if], data = [none]
tmp3 += z1; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
tmp0 = MULTIPLY(-d7, FIX_1_387039845); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d7, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(-d7, FIX_0_785694958); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d7, FIX_0_275899380); // depends on control dependency: [if], data = [0)]
}
}
}
} else {
if (d5 != 0) {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
z2 = d5 + d3; // depends on control dependency: [if], data = [none]
z4 = d5 + d1; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(d3 + z4, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_2_053119869); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_3_072711026); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_1_501321110); // depends on control dependency: [if], data = [(d1]
z1 = MULTIPLY(-d1, FIX_0_899976223); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-z2, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-d3, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
z4 = MULTIPLY(-z4, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z3 += z5; // depends on control dependency: [if], data = [none]
z4 += z5; // depends on control dependency: [if], data = [none]
tmp0 = z1 + z3; // depends on control dependency: [if], data = [none]
tmp1 += z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 += z2 + z3; // depends on control dependency: [if], data = [none]
tmp3 += z1 + z4; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
z2 = d5 + d3; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z2, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_1_662939225); // depends on control dependency: [if], data = [none]
z4 = MULTIPLY(-d5, FIX_0_390180644); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-z2, FIX_1_387039845); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(d3, FIX_1_111140466); // depends on control dependency: [if], data = [none]
z3 = MULTIPLY(-d3, FIX_1_961570560); // depends on control dependency: [if], data = [0)]
tmp0 = z3 + z5; // depends on control dependency: [if], data = [none]
tmp1 += z2; // depends on control dependency: [if], data = [none]
tmp2 += z2; // depends on control dependency: [if], data = [none]
tmp3 = z4 + z5; // depends on control dependency: [if], data = [none]
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
z4 = d5 + d1; // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z4, FIX_1_175875602); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(-d1, FIX_0_899976223); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_0_601344887); // depends on control dependency: [if], data = [(d1]
tmp1 = MULTIPLY(-d5, FIX_0_509795579); // depends on control dependency: [if], data = [none]
z2 = MULTIPLY(-d5, FIX_2_562915447); // depends on control dependency: [if], data = [none]
z4 = MULTIPLY(z4, FIX_0_785694958); // depends on control dependency: [if], data = [none]
tmp0 = z1 + z5; // depends on control dependency: [if], data = [none]
tmp1 += z4; // depends on control dependency: [if], data = [none]
tmp2 = z2 + z5; // depends on control dependency: [if], data = [none]
tmp3 += z4; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
tmp0 = MULTIPLY(d5, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(d5, FIX_0_275899380); // depends on control dependency: [if], data = [0)]
tmp2 = MULTIPLY(-d5, FIX_1_387039845); // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d5, FIX_0_785694958); // depends on control dependency: [if], data = [none]
}
}
} else {
if (d3 != 0) {
if (d1 != 0) {
/* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
z5 = d1 + d3; // depends on control dependency: [if], data = [none]
tmp3 = MULTIPLY(d1, FIX_0_211164243); // depends on control dependency: [if], data = [(d1]
tmp2 = MULTIPLY(-d3, FIX_1_451774981); // depends on control dependency: [if], data = [none]
z1 = MULTIPLY(d1, FIX_1_061594337); // depends on control dependency: [if], data = [(d1]
z2 = MULTIPLY(-d3, FIX_2_172734803); // depends on control dependency: [if], data = [none]
z4 = MULTIPLY(z5, FIX_0_785694958); // depends on control dependency: [if], data = [none]
z5 = MULTIPLY(z5, FIX_1_175875602); // depends on control dependency: [if], data = [none]
tmp0 = z1 - z4; // depends on control dependency: [if], data = [none]
tmp1 = z2 + z4; // depends on control dependency: [if], data = [none]
tmp2 += z5; // depends on control dependency: [if], data = [none]
tmp3 += z5; // depends on control dependency: [if], data = [none]
} else {
/* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
tmp0 = MULTIPLY(-d3, FIX_0_785694958); // depends on control dependency: [if], data = [none]
tmp1 = MULTIPLY(-d3, FIX_1_387039845); // depends on control dependency: [if], data = [none]
tmp2 = MULTIPLY(-d3, FIX_0_275899380); // depends on control dependency: [if], data = [0)]
tmp3 = MULTIPLY(d3, FIX_1_175875602); // depends on control dependency: [if], data = [none]
}
} else {
if (d1 != 0) {
/* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
tmp0 = MULTIPLY(d1, FIX_0_275899380); // depends on control dependency: [if], data = [(d1]
tmp1 = MULTIPLY(d1, FIX_0_785694958); // depends on control dependency: [if], data = [(d1]
tmp2 = MULTIPLY(d1, FIX_1_175875602); // depends on control dependency: [if], data = [(d1]
tmp3 = MULTIPLY(d1, FIX_1_387039845); // depends on control dependency: [if], data = [(d1]
} else {
/* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
tmp0 = tmp1 = tmp2 = tmp3 = 0; // depends on control dependency: [if], data = [none]
}
}
}
}
/* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
dataptr.put(DCTSIZE_0, DESCALE18(tmp10 + tmp3)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_7, DESCALE18(tmp10 - tmp3)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_1, DESCALE18(tmp11 + tmp2)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_6, DESCALE18(tmp11 - tmp2)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_2, DESCALE18(tmp12 + tmp1)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_5, DESCALE18(tmp12 - tmp1)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_3, DESCALE18(tmp13 + tmp0)); // depends on control dependency: [for], data = [none]
dataptr.put(DCTSIZE_4, DESCALE18(tmp13 - tmp0)); // depends on control dependency: [for], data = [none]
dataptr = advance(dataptr, 1); /* advance pointer to next column */ // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@AfterBatch
public void afterDeliver()
{
SegmentStream nodeStream = _nodeStream;
if (nodeStream != null) {
if (_isBlobDirty) {
_isBlobDirty = false;
// nodeStream.flush(null);
nodeStream.fsync(Result.ignore());
}
else {
nodeStream.flush(Result.ignore());
}
}
/*
if (blobWriter != null) {
try {
blobWriter.flushSegment();
} catch (IOException e) {
e.printStackTrace();
}
}
*/
} } | public class class_name {
@AfterBatch
public void afterDeliver()
{
SegmentStream nodeStream = _nodeStream;
if (nodeStream != null) {
if (_isBlobDirty) {
_isBlobDirty = false; // depends on control dependency: [if], data = [none]
// nodeStream.flush(null);
nodeStream.fsync(Result.ignore()); // depends on control dependency: [if], data = [none]
}
else {
nodeStream.flush(Result.ignore()); // depends on control dependency: [if], data = [none]
}
}
/*
if (blobWriter != null) {
try {
blobWriter.flushSegment();
} catch (IOException e) {
e.printStackTrace();
}
}
*/
} } |
public class class_name {
private void findPockets() {
int[] dim = gridGenerator.getDim();
// logger.debug(" FIND POCKETS>dimx:" + dim[0] + " dimy:" + dim[1]
// + " dimz:" + dim[2] + " linkageRadius>" + linkageRadius
// + " latticeConstant>" + latticeConstant + " pocketSize:"
// + pocketSize + " minPSPocket:" + minPSPocket + " minPSCluster:"
// + minPSCluster);
//int pointsVisited = 0;//Debugging
//int significantPointsVisited = 0;//Debugging
for (int x = 0; x < dim[0]; x++) {
for (int y = 0; y < dim[1]; y++) {
for (int z = 0; z < dim[2]; z++) {
// logger.debug.print(" x:"+x+" y:"+y+" z:"+z);
Point3d start = new Point3d(x, y, z);
//pointsVisited++;
if (this.grid[x][y][z] >= minPSPocket & !visited.containsKey(x + "." + y + "." + z)) {
List<Point3d> subPocket = new ArrayList<Point3d>();
// logger.debug.print("new Point: "+grid[x][y][z]);
//significantPointsVisited++;
// logger.debug("visited:"+pointsVisited);
subPocket = this.clusterPSPPocket(start, subPocket, dim);
if (subPocket != null && subPocket.size() >= pocketSize) {
pockets.add(subPocket);
}
// logger.debug(" Points visited:"+pointsVisited+"
// subPocketSize:"+subPocket.size()+"
// pocketsSize:"+pockets.size()
// +" hashtable:"+visited.size());
}
}
}
}
// try {
// logger.debug(" ->>>> #pockets:" + pockets.size()
// + " significantPointsVisited:" + significantPointsVisited
// + " keys:" + visited.size() + " PointsVisited:"
// + pointsVisited);
// } catch (Exception ex1) {
// logger.debug
// .println("Problem in System.out due to " + ex1.toString());
// }
} } | public class class_name {
private void findPockets() {
int[] dim = gridGenerator.getDim();
// logger.debug(" FIND POCKETS>dimx:" + dim[0] + " dimy:" + dim[1]
// + " dimz:" + dim[2] + " linkageRadius>" + linkageRadius
// + " latticeConstant>" + latticeConstant + " pocketSize:"
// + pocketSize + " minPSPocket:" + minPSPocket + " minPSCluster:"
// + minPSCluster);
//int pointsVisited = 0;//Debugging
//int significantPointsVisited = 0;//Debugging
for (int x = 0; x < dim[0]; x++) {
for (int y = 0; y < dim[1]; y++) {
for (int z = 0; z < dim[2]; z++) {
// logger.debug.print(" x:"+x+" y:"+y+" z:"+z);
Point3d start = new Point3d(x, y, z);
//pointsVisited++;
if (this.grid[x][y][z] >= minPSPocket & !visited.containsKey(x + "." + y + "." + z)) {
List<Point3d> subPocket = new ArrayList<Point3d>();
// logger.debug.print("new Point: "+grid[x][y][z]);
//significantPointsVisited++;
// logger.debug("visited:"+pointsVisited);
subPocket = this.clusterPSPPocket(start, subPocket, dim); // depends on control dependency: [if], data = [none]
if (subPocket != null && subPocket.size() >= pocketSize) {
pockets.add(subPocket); // depends on control dependency: [if], data = [(subPocket]
}
// logger.debug(" Points visited:"+pointsVisited+"
// subPocketSize:"+subPocket.size()+"
// pocketsSize:"+pockets.size()
// +" hashtable:"+visited.size());
}
}
}
}
// try {
// logger.debug(" ->>>> #pockets:" + pockets.size()
// + " significantPointsVisited:" + significantPointsVisited
// + " keys:" + visited.size() + " PointsVisited:"
// + pointsVisited);
// } catch (Exception ex1) {
// logger.debug
// .println("Problem in System.out due to " + ex1.toString());
// }
} } |
public class class_name {
public static String generateTxtJobTable(Collection<JobInProgress> jobs,
JobTracker tracker) throws IOException {
char colSeparator = '\t';
char rowSeparator = '\n';
StringBuffer sb = new StringBuffer();
sb.append("01.JOBID" + colSeparator +
"02.START" + colSeparator +
"03.FINISH" + colSeparator +
"04.USER" + colSeparator +
"05.NAME" + colSeparator +
"06.BLACK_TT" + colSeparator +
"07.PRIORITY" + colSeparator +
"08.MAP_TOTAL" + colSeparator +
"09.MAP_COMPLETE" + colSeparator +
"10.MAP_RUN" + colSeparator +
"11.MAP_SPECU" + colSeparator +
"12.MAP_NONLOC" + colSeparator +
"13.MAP_KILLED" + colSeparator +
"14.MAP_FAILED" + colSeparator +
"15.RED_TOTAL" + colSeparator +
"16.RED_COMPLETE" + colSeparator +
"17.RED_RUN" + colSeparator +
"18.RED_SPECU" + colSeparator +
"19.RED_KILLED" + colSeparator +
"20.RED_FAILED" + colSeparator +
"21.%MEM" + colSeparator +
"22.%MEM_MAX" + colSeparator +
"23.%MEM_PEAK" + colSeparator +
"24.MEM_MS" + colSeparator +
"25.%CPU" + colSeparator +
"26.%CPU_MAX" + colSeparator +
"27.CPU_MS" + rowSeparator);
if (jobs.size() > 0) {
for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext();) {
JobInProgress job = it.next();
JobProfile profile = job.getProfile();
String user = profile.getUser();
String name = profile.getJobName().
replace(' ', '_').replace('\t', '_').replace('\n', '_');
int desiredMaps = job.desiredMaps();
int desiredReduces = job.desiredReduces();
int runningMaps = 0;
int failedMaps = 0;
int killedMaps = 0;
for (TaskInProgress tip: job.getTasks(TaskType.MAP)) {
if (tip.isRunning()) {
runningMaps += tip.getActiveTasks().size();
tip.numKilledTasks();
failedMaps += tip.numTaskFailures();
killedMaps += tip.numKilledTasks();
}
}
int runningReduces = 0;
int failedReduces = 0;
int killedReduces = 0;
for (TaskInProgress tip: job.getTasks(TaskType.REDUCE)) {
if (tip.isRunning()) {
runningReduces += tip.getActiveTasks().size();
failedReduces += tip.numTaskFailures();
killedReduces += tip.numKilledTasks();
}
}
int completedMaps = job.finishedMaps();
int completedReduces = job.finishedReduces();
int nonLocalRunningMaps = job.getNonLocalRunningMaps().size();
long submitTime = job.getStartTime();
long finishTime = job.getFinishTime();
String jobpri = job.getPriority().toString();
JobID jobId = job.getJobID();
double mem = 0, memMax = 0, memMaxPeak = 0, memCost = 0;
double cpu = 0, cpuMax = 0, cpuCost = 0;
ResourceReporter reporter = tracker.getResourceReporter();
if (reporter != null) {
mem = reporter.getJobCpuPercentageOnCluster(jobId);
memMax = reporter.getJobMemMaxPercentageOnBox(jobId);
memMaxPeak = reporter.getJobMemMaxPercentageOnBoxAllTime(jobId);
memCost = reporter.getJobMemCumulatedUsageTime(jobId);
cpu = reporter.getJobCpuPercentageOnCluster(jobId);
cpuMax = reporter.getJobCpuMaxPercentageOnBox(jobId);
cpuCost = reporter.getJobCpuCumulatedUsageTime(jobId);
}
sb.append(jobId.toString() + colSeparator +
submitTime + colSeparator +
finishTime + colSeparator +
user + colSeparator +
name + colSeparator +
job.getNoOfBlackListedTrackers() + colSeparator +
jobpri + colSeparator +
desiredMaps + colSeparator +
completedMaps + colSeparator +
runningMaps + colSeparator +
job.speculativeMapTasks + colSeparator +
nonLocalRunningMaps + colSeparator +
killedMaps + colSeparator +
failedMaps + colSeparator +
desiredReduces + colSeparator +
completedReduces + colSeparator +
runningReduces + colSeparator +
job.speculativeReduceTasks + colSeparator +
killedReduces + colSeparator +
failedReduces + colSeparator +
mem + colSeparator +
memMax + colSeparator +
memMaxPeak + colSeparator +
memCost + colSeparator +
cpu + colSeparator +
cpuMax + colSeparator +
cpuCost + rowSeparator);
}
}
return sb.toString();
} } | public class class_name {
public static String generateTxtJobTable(Collection<JobInProgress> jobs,
JobTracker tracker) throws IOException {
char colSeparator = '\t';
char rowSeparator = '\n';
StringBuffer sb = new StringBuffer();
sb.append("01.JOBID" + colSeparator +
"02.START" + colSeparator +
"03.FINISH" + colSeparator +
"04.USER" + colSeparator +
"05.NAME" + colSeparator +
"06.BLACK_TT" + colSeparator +
"07.PRIORITY" + colSeparator +
"08.MAP_TOTAL" + colSeparator +
"09.MAP_COMPLETE" + colSeparator +
"10.MAP_RUN" + colSeparator +
"11.MAP_SPECU" + colSeparator +
"12.MAP_NONLOC" + colSeparator +
"13.MAP_KILLED" + colSeparator +
"14.MAP_FAILED" + colSeparator +
"15.RED_TOTAL" + colSeparator +
"16.RED_COMPLETE" + colSeparator +
"17.RED_RUN" + colSeparator +
"18.RED_SPECU" + colSeparator +
"19.RED_KILLED" + colSeparator +
"20.RED_FAILED" + colSeparator +
"21.%MEM" + colSeparator +
"22.%MEM_MAX" + colSeparator +
"23.%MEM_PEAK" + colSeparator +
"24.MEM_MS" + colSeparator +
"25.%CPU" + colSeparator +
"26.%CPU_MAX" + colSeparator +
"27.CPU_MS" + rowSeparator);
if (jobs.size() > 0) {
for (Iterator<JobInProgress> it = jobs.iterator(); it.hasNext();) {
JobInProgress job = it.next();
JobProfile profile = job.getProfile();
String user = profile.getUser();
String name = profile.getJobName().
replace(' ', '_').replace('\t', '_').replace('\n', '_');
int desiredMaps = job.desiredMaps();
int desiredReduces = job.desiredReduces();
int runningMaps = 0;
int failedMaps = 0;
int killedMaps = 0;
for (TaskInProgress tip: job.getTasks(TaskType.MAP)) {
if (tip.isRunning()) {
runningMaps += tip.getActiveTasks().size(); // depends on control dependency: [if], data = [none]
tip.numKilledTasks(); // depends on control dependency: [if], data = [none]
failedMaps += tip.numTaskFailures(); // depends on control dependency: [if], data = [none]
killedMaps += tip.numKilledTasks(); // depends on control dependency: [if], data = [none]
}
}
int runningReduces = 0;
int failedReduces = 0;
int killedReduces = 0;
for (TaskInProgress tip: job.getTasks(TaskType.REDUCE)) {
if (tip.isRunning()) {
runningReduces += tip.getActiveTasks().size(); // depends on control dependency: [if], data = [none]
failedReduces += tip.numTaskFailures(); // depends on control dependency: [if], data = [none]
killedReduces += tip.numKilledTasks(); // depends on control dependency: [if], data = [none]
}
}
int completedMaps = job.finishedMaps();
int completedReduces = job.finishedReduces();
int nonLocalRunningMaps = job.getNonLocalRunningMaps().size();
long submitTime = job.getStartTime();
long finishTime = job.getFinishTime();
String jobpri = job.getPriority().toString();
JobID jobId = job.getJobID();
double mem = 0, memMax = 0, memMaxPeak = 0, memCost = 0;
double cpu = 0, cpuMax = 0, cpuCost = 0;
ResourceReporter reporter = tracker.getResourceReporter();
if (reporter != null) {
mem = reporter.getJobCpuPercentageOnCluster(jobId);
memMax = reporter.getJobMemMaxPercentageOnBox(jobId);
memMaxPeak = reporter.getJobMemMaxPercentageOnBoxAllTime(jobId);
memCost = reporter.getJobMemCumulatedUsageTime(jobId);
cpu = reporter.getJobCpuPercentageOnCluster(jobId);
cpuMax = reporter.getJobCpuMaxPercentageOnBox(jobId);
cpuCost = reporter.getJobCpuCumulatedUsageTime(jobId);
}
sb.append(jobId.toString() + colSeparator +
submitTime + colSeparator +
finishTime + colSeparator +
user + colSeparator +
name + colSeparator +
job.getNoOfBlackListedTrackers() + colSeparator +
jobpri + colSeparator +
desiredMaps + colSeparator +
completedMaps + colSeparator +
runningMaps + colSeparator +
job.speculativeMapTasks + colSeparator +
nonLocalRunningMaps + colSeparator +
killedMaps + colSeparator +
failedMaps + colSeparator +
desiredReduces + colSeparator +
completedReduces + colSeparator +
runningReduces + colSeparator +
job.speculativeReduceTasks + colSeparator +
killedReduces + colSeparator +
failedReduces + colSeparator +
mem + colSeparator +
memMax + colSeparator +
memMaxPeak + colSeparator +
memCost + colSeparator +
cpu + colSeparator +
cpuMax + colSeparator +
cpuCost + rowSeparator);
}
}
return sb.toString();
} } |
public class class_name {
public ColorImg scaleChannelToUnitRange(int channel) {
double min=getMinValue(channel), max=getMaxValue(channel);
double range = max-min;
if(range != 0){
double[] channelData = getData()[channel];
for(int i=0; i<channelData.length; i++){
channelData[i] = (channelData[i]-min)/range;
}
} else {
fill(channel, 0);
}
return this;
} } | public class class_name {
public ColorImg scaleChannelToUnitRange(int channel) {
double min=getMinValue(channel), max=getMaxValue(channel);
double range = max-min;
if(range != 0){
double[] channelData = getData()[channel];
for(int i=0; i<channelData.length; i++){
channelData[i] = (channelData[i]-min)/range; // depends on control dependency: [for], data = [i]
}
} else {
fill(channel, 0); // depends on control dependency: [if], data = [0)]
}
return this;
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.