⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 samplexysymbolicdataset.java

📁 这是一个segy数据显示程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        return this.xSymbolicValues;    }    /**     * Returns the list of Y symbolic values.     *     * @return array of symbolic value.     */    public String[] getYSymbolicValues() {        return this.ySymbolicValues;    }    /**     * Sets the list of X symbolic values.     *     * @param sValues the new list of symbolic value.     */    public void setXSymbolicValues(final String[] sValues) {        this.xSymbolicValues = sValues;    }    /**     * Sets the list of Y symbolic values.     *     * @param sValues the new list of symbolic value.     */    public void setYSymbolicValues(final String[] sValues) {        this.ySymbolicValues = sValues;    }    /**     * Returns the X symbolic value of the data set specified by     * <CODE>series</CODE> and <CODE>item</CODE> parameters.     *     * @param series value of the serie.     * @param item value of the item.     *     * @return the symbolic value.     */    public String getXSymbolicValue(final int series, final int item) {        final Integer intValue = (Integer) getXValue(series, item);        return getXSymbolicValue(intValue);    }    /**     * Returns the Y symbolic value of the data set specified by     * <CODE>series</CODE> and <CODE>item</CODE> parameters.     *     * @param series value of the serie.     * @param item value of the item.     * @return the symbolic value.     */    public String getYSymbolicValue(final int series, final int item) {        final Integer intValue = (Integer) getYValue(series, item);        return getYSymbolicValue(intValue);    }    /**     * Returns the X symbolic value linked with the specified     * <CODE>Integer</CODE>.     *     * @param val value of the integer linked with the symbolic value.     * @return the symbolic value.     */    public String getXSymbolicValue(final Integer val) {        return this.xSymbolicValues[val.intValue()];    }    /**     * Returns the Y symbolic value linked with the specified     * <CODE>Integer</CODE>.     *     * @param val value of the integer linked with the symbolic value.     * @return the symbolic value.     */    public String getYSymbolicValue(final Integer val) {        return this.ySymbolicValues[val.intValue()];    }    /**     * This function modify <CODE>dataset1</CODE> and <CODE>dataset1</CODE> in     * order that they share the same Y symbolic value list.     * <P>     * The sharing Y symbolic value list is obtained adding the Y symbolic data     * list of the fist data set to the Y symbolic data list of the second data     * set.     * <P>     * This function is use with the <I>combined plot</I> functions of     * JFreeChart.     *     * @param dataset1  the first data set to combine.     * @param dataset2  the second data set to combine.     *     * @return  the shared Y symbolic array.     */    public static String[] combineYSymbolicDataset(final YisSymbolic dataset1,                                                    final YisSymbolic dataset2) {        final SampleXYSymbolicDataset sDataset1 = (SampleXYSymbolicDataset) dataset1;        final SampleXYSymbolicDataset sDataset2 = (SampleXYSymbolicDataset) dataset2;        final String[] sDatasetSymbolicValues1 = sDataset1.getYSymbolicValues();        final String[] sDatasetSymbolicValues2 = sDataset2.getYSymbolicValues();        //Combine the two list of symbolic value of the two data set        final int s1length = sDatasetSymbolicValues1.length;        final int s2length = sDatasetSymbolicValues2.length;        final List ySymbolicValuesCombined = new Vector();        for (int i = 0; i < s1length; i++) {            ySymbolicValuesCombined.add(sDatasetSymbolicValues1[i]);        }        for (int i = 0; i < s2length; i++) {            if (!ySymbolicValuesCombined.contains(sDatasetSymbolicValues2[i])) {                ySymbolicValuesCombined.add(sDatasetSymbolicValues2[i]);            }        }        //Change the Integer reference of the second data set        int newIndex;        for (int i = 0; i < sDataset2.getSeriesCount(); i++) {            for (int j = 0; j < sDataset2.getItemCount(i); j++) {                newIndex = ySymbolicValuesCombined.indexOf(sDataset2.getYSymbolicValue(i, j));                sDataset2.setYValue(i, j, new Integer(newIndex));            }        }        //Set the new list of symbolic value on the two data sets        final String[] ySymbolicValuesCombinedA = new String[ySymbolicValuesCombined.size()];        ySymbolicValuesCombined.toArray(ySymbolicValuesCombinedA);        sDataset1.setYSymbolicValues(ySymbolicValuesCombinedA);        sDataset2.setYSymbolicValues(ySymbolicValuesCombinedA);        return ySymbolicValuesCombinedA;    }    /**     * This function modify <CODE>dataset1</CODE> and <CODE>dataset1</CODE> in     * order that they share the same X symbolic value list.     * <P>     * The sharing X symbolic value list is obtained adding the X symbolic data     * list of the fist data set to the X symbolic data list of the second data     * set.     * <P>     * This function is use with the <I>combined plot</I> functions of     * JFreeChart.     *     * @param dataset1 the first data set to combine.     * @param dataset2 the second data set to combine.     *     * @return  the shared X symbolic array.     */    public static String[] combineXSymbolicDataset(final XisSymbolic dataset1,                                                    final XisSymbolic dataset2) {        final SampleXYSymbolicDataset sDataset1 = (SampleXYSymbolicDataset) dataset1;        final SampleXYSymbolicDataset sDataset2 = (SampleXYSymbolicDataset) dataset2;        final String[] sDatasetSymbolicValues1 = sDataset1.getXSymbolicValues();        final String[] sDatasetSymbolicValues2 = sDataset2.getXSymbolicValues();        //Combine the two list of symbolic value of the two data set        final int s1length = sDatasetSymbolicValues1.length;        final int s2length = sDatasetSymbolicValues2.length;        final List xSymbolicValuesCombined = new Vector();        for (int i = 0; i < s1length; i++) {            xSymbolicValuesCombined.add(sDatasetSymbolicValues1[i]);        }        for (int i = 0; i < s2length; i++) {            if (!xSymbolicValuesCombined.contains(sDatasetSymbolicValues2[i])) {                xSymbolicValuesCombined.add(sDatasetSymbolicValues2[i]);            }        }        //Change the Integer reference of the second data set        int newIndex;        for (int i = 0; i < sDataset2.getSeriesCount(); i++) {            for (int j = 0; j < sDataset2.getItemCount(i); j++) {                newIndex = xSymbolicValuesCombined.indexOf(sDataset2.getXSymbolicValue(i, j));                sDataset2.setXValue(i, j, new Integer(newIndex));            }        }        //Set the new list of symbolic value on the two data sets        final String[] xSymbolicValuesCombinedA = new String[xSymbolicValuesCombined.size()];        xSymbolicValuesCombined.toArray(xSymbolicValuesCombinedA);        sDataset1.setXSymbolicValues(xSymbolicValuesCombinedA);        sDataset2.setXSymbolicValues(xSymbolicValuesCombinedA);        return xSymbolicValuesCombinedA;    }    /**     * Clone the SampleXYSymbolicDataset object     *     * @return the cloned object.     */    public Object clone() {        final String nDatasetName = new String(this.datasetName);        final Integer[][] nXValues = (Integer[][]) cloneArray(this.xValues);        final Integer[][] nYValues = (Integer[][]) cloneArray(this.yValues);        final String[] nXSymbolicValues = (String[]) cloneArray(this.xSymbolicValues);        final String[] nYSymbolicValues = (String[]) cloneArray(this.ySymbolicValues);        final String[] sName = (String[]) cloneArray(this.seriesName);        return new SampleXYSymbolicDataset(            nDatasetName, nXValues, nYValues, nXSymbolicValues, nYSymbolicValues, sName        );    }    /**     * Returns a clone of the array.     *     * @param arr the array.     *     * @return a clone.     */    private static Object cloneArray(final Object arr) {        if (arr == null) {            return arr;        }        final Class cls = arr.getClass();        if (!cls.isArray()) {            return arr;        }        final int length = Array.getLength(arr);        final Object[] newarr = (Object[]) Array.newInstance(cls.getComponentType(), length);        Object obj;        for (int i = 0; i < length; i++) {            obj = Array.get(arr, i);            if (obj.getClass().isArray()) {                newarr[i] = cloneArray(obj);            }            else {                newarr[i] = obj;            }        }        return newarr;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -