本文整理汇总了Java中info.monitorenter.gui.chart.Chart2D.DEBUG_THREADING属性的典型用法代码示例。如果您正苦于以下问题:Java Chart2D.DEBUG_THREADING属性的具体用法?Java Chart2D.DEBUG_THREADING怎么用?Java Chart2D.DEBUG_THREADING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类info.monitorenter.gui.chart.Chart2D
的用法示例。
在下文中一共展示了Chart2D.DEBUG_THREADING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: iterator
/**
* @see info.monitorenter.gui.chart.ITrace2D#iterator()
*/
public Iterator<ITracePoint2D> iterator() {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.iterator, 0 locks");
}
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.iterator, 1 lock");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.iterator, 2 locks");
}
return this.m_buffer.iteratorL2F();
}
}
}
示例2: addErrorBarPolicy
/**
* @see info.monitorenter.gui.chart.ITrace2D#addErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
*/
public final boolean addErrorBarPolicy(final IErrorBarPolicy< ? > errorBarPolicy) {
boolean result = false;
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 0 locks");
}
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 1 lock");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 2 locks");
}
result = this.m_errorBarPolicies.add(errorBarPolicy);
if (result) {
errorBarPolicy.setTrace(this);
errorBarPolicy.addPropertyChangeListener(IErrorBarPolicy.PROPERTY_CONFIGURATION, this);
this.expandErrorBarBounds();
this.firePropertyChange(ITrace2D.PROPERTY_ERRORBARPOLICY, null, errorBarPolicy);
}
}
}
return result;
}
示例3: firePropertyChange
/**
* Fires a property change event to the registered listeners.
* <p>
*
* @param property
* one of the <code>PROPERTY_XXX</code> constants defined in <code>
* {@link ITrace2D}</code>.
* @param oldvalue
* the old value of the property.
* @param newvalue
* the new value of the property.
*/
protected final void firePropertyChange(final String property, final Object oldvalue,
final Object newvalue) {
if (property.equals(ITrace2D.PROPERTY_MAX_X) || property.equals(ITrace2D.PROPERTY_MAX_Y)
|| property.equals(ITrace2D.PROPERTY_MIN_X) || property.equals(ITrace2D.PROPERTY_MIN_Y)
|| property.equals(ITrace2D.PROPERTY_TRACEPOINT)
|| property.equals(ITrace2D.PROPERTY_POINT_CHANGED)) {
if (!Thread.holdsLock(this.m_renderer)) {
throw new RuntimeException("Acquire a lock on the corresponding chart first!");
}
if (!Thread.holdsLock(this)) {
throw new RuntimeException("Acquire a lock on this trace first!");
}
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.firePropertyChange (" + property + "), 2 locks, renderer is: "
+ this.m_renderer);
}
}
this.m_propertyChangeSupport.firePropertyChange(property, oldvalue, newvalue);
}
示例4: maxXSearch
/**
* Internal search for the maximum x value that is only invoked if no cached
* value is at hand or bounds have changed by adding new points.
* <p>
* The result is assigned to the property maxX.
* <p>
*
* @see #getMaxX()
*/
protected void maxXSearch() {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.maxXSearch, 0 locks");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.maxXSearch, 1 locks");
}
double ret = -Double.MAX_VALUE;
ITracePoint2D tmpoint = null;
double tmp;
final Iterator<ITracePoint2D> it = this.iterator();
while (it.hasNext()) {
tmpoint = it.next();
tmp = tmpoint.getX();
if (tmp > ret) {
ret = tmp;
}
}
this.m_maxX = ret;
}
// compute the extra amount in case of error bar painters:
this.expandMaxXErrorBarBounds();
}
示例5: setZIndex
/**
* @see info.monitorenter.gui.chart.ITrace2D#setZIndex(java.lang.Integer)
*/
public final void setZIndex(final Integer zIndex) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.setZIndex, 0 locks");
}
if (!zIndex.equals(this.m_zIndex)) {
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.setZIndex, 1 lock");
}
final Integer oldValue = this.m_zIndex;
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.setZIndex, 2 locks");
}
this.m_zIndex = Integer.valueOf(zIndex.intValue());
this.firePropertyChange(ITrace2D.PROPERTY_ZINDEX, oldValue, this.m_zIndex);
}
}
}
}
示例6: propertyChange
/**
* @see info.monitorenter.gui.chart.axis.AAxis.IPropertyChangeReactor#propertyChange(java.beans.PropertyChangeEvent,
* info.monitorenter.gui.chart.axis.AAxis)
*/
public final void propertyChange(final PropertyChangeEvent changeEvent, final AAxis<?> receiver) {
final Chart2D chart = receiver.getAccessor().getChart();
synchronized (chart) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("AAxis.propertyChange (" + Thread.currentThread().getName()
+ "), 1 lock");
}
final boolean repaint = this.propertyChangeSynced(changeEvent, receiver);
if (repaint) {
chart.setRequestedRepaint(true);
}
}
}
示例7: ensureInitialized
/**
* Ensures that no deadlock due to a missing internal chart reference may
* occur.
*
* @throws IllegalStateException
* if this trace is not assigned to a chart.
*
*/
protected final void ensureInitialized() {
if (this.m_renderer == Boolean.FALSE) {
throw new IllegalStateException("Connect this trace (" + this.getName()
+ ") to a chart first before this operation (undebuggable deadlocks might occur else)");
} else {
if (Chart2D.DEBUG_THREADING) {
System.out.println(this.getClass() + "(" + Thread.currentThread().getName()
+ ") this.m_renderer: " + this.m_renderer);
}
}
}
示例8: getZIndex
/**
* @see info.monitorenter.gui.chart.ITrace2D#getZIndex()
*/
public final Integer getZIndex() {
// More expensive but the contract of the order of values described in the
// interface is inverted to the contract of TreeSetGreedy.
// This is done here instead of get/set ComparableProperty
// as those are invoked several times for each iteration
// (and paint contains several iterations).
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", " + this.getClass().getName()
+ ".getZindex, 0 locks");
}
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", " + this.getClass().getName()
+ ".getZindex, 1 locks");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", " + this.getClass().getName()
+ ".getZindex, 2 locks");
}
}
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", " + this.getClass().getName()
+ ".getZindex, freed 1 lock: 1 lock remaining");
}
}
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", " + this.getClass().getName()
+ ".getZindex, freed 1 lock: 0 locks remaining");
}
return this.m_zIndex;
}
示例9: maxYSearch
/**
* Internal search for the maximum y value that is only invoked if no cached
* value is at hand or bounds have changed by adding new points.
* <p>
* The result is assigned to the property maxY.
* <p>
*
* @see #getMaxY()
*/
protected void maxYSearch() {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.maxYSearch, 0 locks");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.maxYSearch, 1 lock");
}
double ret = -Double.MAX_VALUE;
ITracePoint2D tmpoint = null;
double tmp;
final Iterator<ITracePoint2D> it = this.iterator();
while (it.hasNext()) {
tmpoint = it.next();
tmp = tmpoint.getY();
if (tmp > ret) {
ret = tmp;
}
}
this.m_maxY = ret;
}
// compute the extra amount in case of error bar painters:
this.expandMaxYErrorBarBounds();
}
示例10: minXSearch
/**
* Internal search for the minimum x value that is only invoked if no cached
* value is at hand or bounds have changed by adding new points.
* <p>
* The result is assigned to the property minX.
* <p>
*
* @see #getMinX()
*/
protected void minXSearch() {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.minXSearch, 0 locks");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.minXSearch, 1 locks");
}
double ret = Double.MAX_VALUE;
ITracePoint2D tmpoint = null;
double tmp;
final Iterator<ITracePoint2D> it = this.iterator();
while (it.hasNext()) {
tmpoint = it.next();
tmp = tmpoint.getX();
if (tmp < ret) {
ret = tmp;
}
}
this.m_minX = ret;
}
// compute the extra amount in case of error bar painters:
this.expandMinXErrorBarBounds();
}
示例11: minYSearch
/**
* Internal search for the minimum y value that is only invoked if no cached
* value is at hand or bounds have changed by adding new points.
* <p>
* The result is assigned to the property minY.
* <p>
*
* @see #getMinY()
*/
protected void minYSearch() {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.minYSearch, 0 locks");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("trace.minYSearch, 1 locks");
}
double ret = Double.MAX_VALUE;
ITracePoint2D tmpoint = null;
double tmp;
final Iterator<ITracePoint2D> it = this.iterator();
while (it.hasNext()) {
tmpoint = it.next();
tmp = tmpoint.getY();
if (tmp < ret) {
ret = tmp;
}
}
this.m_minY = ret;
// compute the extra amount in case of error bar painters:
this.expandMinYErrorBarBounds();
}
}
示例12: removeErrorBarPolicy
/**
* @see info.monitorenter.gui.chart.ITrace2D#removeErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
*/
public boolean removeErrorBarPolicy(final IErrorBarPolicy< ? > errorBarPolicy) {
boolean result = false;
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 0 locks");
}
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 1 lock");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("addErrorBarPolicy, 2 locks");
}
result = this.m_errorBarPolicies.remove(errorBarPolicy);
if (result) {
errorBarPolicy.setTrace(null);
errorBarPolicy.removePropertyChangeListener(IErrorBarPolicy.PROPERTY_CONFIGURATION, this);
this.expandErrorBarBounds();
this.firePropertyChange(ITrace2D.PROPERTY_ERRORBARPOLICY, errorBarPolicy, null);
}
}
}
return result;
}
示例13: setErrorBarPolicy
/**
* @see info.monitorenter.gui.chart.ITrace2D#setErrorBarPolicy(info.monitorenter.gui.chart.IErrorBarPolicy)
*/
public final Set<IErrorBarPolicy< ? >> setErrorBarPolicy(final IErrorBarPolicy< ? > errorBarPolicy) {
final Set<IErrorBarPolicy< ? >> result = this.m_errorBarPolicies;
if (Chart2D.DEBUG_THREADING) {
System.out.println("setErrorBarPolicy, 0 locks");
}
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("setErrorBarPolicy, 1 lock");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("setErrorBarPolicy, 2 locks");
}
this.m_errorBarPolicies = new TreeSet<IErrorBarPolicy< ? >>();
final boolean added = this.m_errorBarPolicies.add(errorBarPolicy);
if (added) {
errorBarPolicy.setTrace(this);
this.expandErrorBarBounds();
errorBarPolicy.addPropertyChangeListener(IErrorBarPolicy.PROPERTY_CONFIGURATION, this);
this.firePropertyChange(ITrace2D.PROPERTY_ERRORBARPOLICY, null, errorBarPolicy);
}
// now remove this from the previous instances:
for (final IErrorBarPolicy< ? > oldPolicy : result) {
oldPolicy.setTrace(null);
errorBarPolicy.removePropertyChangeListener(IErrorBarPolicy.PROPERTY_CONFIGURATION, this);
this.firePropertyChange(ITrace2D.PROPERTY_ERRORBARPOLICY, oldPolicy, null);
}
}
}
return result;
}
示例14: addTrace
/**
* @see info.monitorenter.gui.chart.IAxis#addTrace(info.monitorenter.gui.chart.ITrace2D)
*/
public boolean addTrace(final ITrace2D trace) {
boolean result = false;
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + "Aaxis" + this.getDimensionString()
+ ".addTrace(), 0 locks");
}
synchronized (this.getAccessor().getChart()) {
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis" + this.getDimensionString()
+ ".addTrace(), 1 lock");
}
synchronized (trace) {
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis"
+ this.getDimensionString() + ".addTrace(), 2 locks");
}
if (this.m_traces.contains(trace)) {
throw new IllegalArgumentException("Trace " + trace.getName()
+ " is already contaied in this axis " + this.getAxisTitle() + ". Review your code. ");
}
// do it here:
result = this.m_traces.add(trace);
if (result) {
this.listen2Trace(trace);
// for static traces (all points added) we won't get events.
// so update here:
final double max = this.getAccessor().getMaxValue(trace);
if (max > this.m_max) {
this.m_max = max;
}
final double min = this.getAccessor().getMinValue(trace);
if (min < this.m_min) {
this.m_min = min;
}
// special case: first trace added:
if (this.getTraces().size() == 1) {
this.m_min = min;
this.m_max = max;
}
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis"
+ this.getDimensionString() + ".addTrace(), before installing chart to trace "
+ trace.getName());
ExceptionUtil.dumpThreadStack(System.out);
}
trace.setRenderer(this.m_accessor.getChart());
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis"
+ this.getDimensionString() + ".addTrace(), after installing chart to trace "
+ trace.getName());
}
// unconditionally scale the trace as we don't know which
// bounds it was related to before.
this.scaleTrace(trace);
}
}
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis" + this.getDimensionString()
+ ".addTrace(), left 1 lock: 1 remaining");
}
}
if (Chart2D.DEBUG_THREADING) {
System.out.println(Thread.currentThread().getName() + ", AAxis" + this.getDimensionString()
+ ".addTrace(), left 1 lock: 0 remaining");
}
// A deadlock occurs if a listener triggers paint.
// This was the case with ChartPanel.
this.m_propertyChangeSupport.firePropertyChange(IAxis.PROPERTY_ADD_REMOVE_TRACE, null, trace);
return result;
}
示例15: setMaxSize
/**
* Sets the maximum amount of points that may be displayed.
* <p>
*
* Don't use this too often as decreases in size may cause expensive array
* copy operations and new searches on all points for bound changes.
* <p>
*
* TODO: Only search for bounds if size is smaller than before, debug and
* test.
*
* @param amount
* the new maximum amount of points to show.
*/
public final void setMaxSize(final int amount) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.setMaxSize, 0 locks");
}
this.ensureInitialized();
synchronized (this.m_renderer) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.setMaxSize, 1 lock");
}
synchronized (this) {
if (Chart2D.DEBUG_THREADING) {
System.out.println("Trace2DLtd.setMaxSize, 2 locks");
}
this.m_buffer.setBufferSize(amount);
final double xmin = this.m_minX;
this.minXSearch();
if (this.m_minX != xmin) {
this.firePropertyChange(ITrace2D.PROPERTY_MIN_X, new Double(xmin),
new Double(this.m_minX));
}
final double xmax = this.m_maxX;
this.maxXSearch();
if (this.m_maxX != xmax) {
this.firePropertyChange(ITrace2D.PROPERTY_MAX_X, new Double(xmax),
new Double(this.m_maxX));
}
final double ymax = this.m_maxY;
this.maxYSearch();
if (this.m_maxY != ymax) {
this.firePropertyChange(ITrace2D.PROPERTY_MAX_Y, new Double(ymax),
new Double(this.m_maxY));
}
final double ymin = this.m_minY;
this.minYSearch();
if (this.m_minY != ymin) {
this.firePropertyChange(ITrace2D.PROPERTY_MIN_Y, new Double(ymin),
new Double(this.m_minY));
}
}
}
}