📄 defaultxydataset.html
字号:
<FONT color="green">282</FONT> int seriesIndex = indexOf(seriesKey);<a name="line.282"></a><FONT color="green">283</FONT> if (seriesIndex >= 0) {<a name="line.283"></a><FONT color="green">284</FONT> this.seriesKeys.remove(seriesIndex);<a name="line.284"></a><FONT color="green">285</FONT> this.seriesList.remove(seriesIndex);<a name="line.285"></a><FONT color="green">286</FONT> notifyListeners(new DatasetChangeEvent(this, this));<a name="line.286"></a><FONT color="green">287</FONT> }<a name="line.287"></a><FONT color="green">288</FONT> }<a name="line.288"></a><FONT color="green">289</FONT> <a name="line.289"></a><FONT color="green">290</FONT> /**<a name="line.290"></a><FONT color="green">291</FONT> * Tests this <code>DefaultXYDataset</code> instance for equality with an<a name="line.291"></a><FONT color="green">292</FONT> * arbitrary object. This method returns <code>true</code> if and only if:<a name="line.292"></a><FONT color="green">293</FONT> * <ul><a name="line.293"></a><FONT color="green">294</FONT> * <li><code>obj</code> is not <code>null</code>;</li><a name="line.294"></a><FONT color="green">295</FONT> * <li><code>obj</code> is an instance of <a name="line.295"></a><FONT color="green">296</FONT> * <code>DefaultXYDataset</code>;</li><a name="line.296"></a><FONT color="green">297</FONT> * <li>both datasets have the same number of series, each containing <a name="line.297"></a><FONT color="green">298</FONT> * exactly the same values.</li><a name="line.298"></a><FONT color="green">299</FONT> * </ul><a name="line.299"></a><FONT color="green">300</FONT> * <a name="line.300"></a><FONT color="green">301</FONT> * @param obj the object (<code>null</code> permitted).<a name="line.301"></a><FONT color="green">302</FONT> * <a name="line.302"></a><FONT color="green">303</FONT> * @return A boolean.<a name="line.303"></a><FONT color="green">304</FONT> */<a name="line.304"></a><FONT color="green">305</FONT> public boolean equals(Object obj) {<a name="line.305"></a><FONT color="green">306</FONT> if (obj == this) {<a name="line.306"></a><FONT color="green">307</FONT> return true;<a name="line.307"></a><FONT color="green">308</FONT> }<a name="line.308"></a><FONT color="green">309</FONT> if (!(obj instanceof DefaultXYDataset)) {<a name="line.309"></a><FONT color="green">310</FONT> return false;<a name="line.310"></a><FONT color="green">311</FONT> }<a name="line.311"></a><FONT color="green">312</FONT> DefaultXYDataset that = (DefaultXYDataset) obj;<a name="line.312"></a><FONT color="green">313</FONT> if (!this.seriesKeys.equals(that.seriesKeys)) {<a name="line.313"></a><FONT color="green">314</FONT> return false;<a name="line.314"></a><FONT color="green">315</FONT> }<a name="line.315"></a><FONT color="green">316</FONT> for (int i = 0; i < this.seriesList.size(); i++) {<a name="line.316"></a><FONT color="green">317</FONT> double[][] d1 = (double[][]) this.seriesList.get(i);<a name="line.317"></a><FONT color="green">318</FONT> double[][] d2 = (double[][]) that.seriesList.get(i);<a name="line.318"></a><FONT color="green">319</FONT> double[] d1x = d1[0];<a name="line.319"></a><FONT color="green">320</FONT> double[] d2x = d2[0];<a name="line.320"></a><FONT color="green">321</FONT> if (!Arrays.equals(d1x, d2x)) {<a name="line.321"></a><FONT color="green">322</FONT> return false;<a name="line.322"></a><FONT color="green">323</FONT> }<a name="line.323"></a><FONT color="green">324</FONT> double[] d1y = d1[1];<a name="line.324"></a><FONT color="green">325</FONT> double[] d2y = d2[1]; <a name="line.325"></a><FONT color="green">326</FONT> if (!Arrays.equals(d1y, d2y)) {<a name="line.326"></a><FONT color="green">327</FONT> return false;<a name="line.327"></a><FONT color="green">328</FONT> }<a name="line.328"></a><FONT color="green">329</FONT> }<a name="line.329"></a><FONT color="green">330</FONT> return true;<a name="line.330"></a><FONT color="green">331</FONT> }<a name="line.331"></a><FONT color="green">332</FONT> <a name="line.332"></a><FONT color="green">333</FONT> /**<a name="line.333"></a><FONT color="green">334</FONT> * Creates an independent copy of this dataset.<a name="line.334"></a><FONT color="green">335</FONT> * <a name="line.335"></a><FONT color="green">336</FONT> * @return The cloned dataset.<a name="line.336"></a><FONT color="green">337</FONT> * <a name="line.337"></a><FONT color="green">338</FONT> * @throws CloneNotSupportedException if there is a problem cloning the<a name="line.338"></a><FONT color="green">339</FONT> * dataset (for instance, if a non-cloneable object is used for a<a name="line.339"></a><FONT color="green">340</FONT> * series key).<a name="line.340"></a><FONT color="green">341</FONT> */<a name="line.341"></a><FONT color="green">342</FONT> public Object clone() throws CloneNotSupportedException {<a name="line.342"></a><FONT color="green">343</FONT> DefaultXYDataset clone = (DefaultXYDataset) super.clone();<a name="line.343"></a><FONT color="green">344</FONT> clone.seriesKeys = new java.util.ArrayList(this.seriesKeys);<a name="line.344"></a><FONT color="green">345</FONT> clone.seriesList = new ArrayList(this.seriesList.size());<a name="line.345"></a><FONT color="green">346</FONT> for (int i = 0; i < this.seriesList.size(); i++) {<a name="line.346"></a><FONT color="green">347</FONT> double[][] data = (double[][]) this.seriesList.get(i);<a name="line.347"></a><FONT color="green">348</FONT> double[] x = data[0];<a name="line.348"></a><FONT color="green">349</FONT> double[] y = data[1];<a name="line.349"></a><FONT color="green">350</FONT> double[] xx = new double[x.length];<a name="line.350"></a><FONT color="green">351</FONT> double[] yy = new double[y.length];<a name="line.351"></a><FONT color="green">352</FONT> System.arraycopy(x, 0, xx, 0, x.length);<a name="line.352"></a><FONT color="green">353</FONT> System.arraycopy(y, 0, yy, 0, y.length);<a name="line.353"></a><FONT color="green">354</FONT> clone.seriesList.add(i, new double[][] {xx, yy});<a name="line.354"></a><FONT color="green">355</FONT> }<a name="line.355"></a><FONT color="green">356</FONT> return clone;<a name="line.356"></a><FONT color="green">357</FONT> }<a name="line.357"></a><FONT color="green">358</FONT> <a name="line.358"></a><FONT color="green">359</FONT> }<a name="line.359"></a></PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -