We could add more functionalities, but in separate classes.
1. We may add a class for the following operations: sorting, querying, and merging.
java 代码
- import java.util.List;
-
- public class DataMatrixRowManipulator
- {
- public DataMatrix query(String queryString, DataMatrix dataMatrix)
- {
- return null;
- }
-
- public DataMatrix sortByColumn(int col)
- {
- return null;
- }
-
- public DataMatrix sortByField(Field field)
- {
- return null;
- }
-
- public List selectRow(DataMatrixRowKey rowKey, DataMatrix dataMatrix)
- {
- return null;
- }
-
- public DataMatrix mergeOnKey(DataMatrixRowKey rowKey, DataMatrix dataMatrix, DataMatrix anotherDataMatrix)
- {
- return null;
- }
- }
Here the class
DataMatrixRowKey is to guaranty the uniqueness of each row for the selection and merge purpose(This is corresponding to the composite keys).
java 代码
- import java.util.Set;
- import java.util.Collection;
- import java.util.HashSet;
- import java.util.Iterator;
-
- public class DataMatrixRowKey
- {
- private Set keyFieldSet;
-
- public DataMatrixRowKey(Collection keyFieldSet)
- {
- this.keyFieldSet = new HashSet(keyFieldSet);
- }
-
- public boolean equals(Object obj)
- {
-
- if (!(obj instanceof DataMatrixRowKey)) return false;
-
- DataMatrixRowKey key = (DataMatrixRowKey)obj;
-
- if (key.keyFieldSet.size() != this.keyFieldSet.size()) return false;
-
- for (Iterator it=keyFieldSet.iterator(); it.hasNext(); )
- {
- if (!key.keyFieldSet.contains(it.next())) return false;
- }
-
- return true;
- }
-
- public int hashCode()
- {
- return keyFieldSet.hashCode();
- }
- }
And again, these operations don't use the specific knowledge of Field. The query operation could be complicated, in order to support a search language similar to SQL, we may use a language parser.
2. We could have a separate converter to convert a data matrix to XML, CSV, etc formats and vice versa.
3. Number crunching, e.g., the sum of all cells in a column, truncate float/double to int/long or to certain digits after period, or even a formula that computes from other columns. The formula parsing could get complicated when the Field class has more data fields, even with the help of ANTLR or JavaCC.
4. The hard problem is the equals() method since it has different meanings in different contexts. One way is that two data matrix are equal only when they match cell by cell, another way is by rows and ignore orders, and so on.
分享到:
相关推荐
DataMatrix 二维码生成 和解码 C#程序,亲测可用。解码是Freytag DataMatrixDecoder A c# implementation to find DataMatrix 'barcodes' in bitmaps and decode them back into a string.
2. **编写代码**:在需要生成DataMatrix的Java或Kotlin类中,创建一个方法来生成点阵二维码: ```java import com.google.zxing.*; import com.google.zxing.common.BitMatrix; import ...
1)x: your data matrix samples in rows and variables in columns. 2)LV: How many variables to use from data, if not specified all variables are used. 3)method: Optional, will be selected automatically. ...
cov_matrix = cov(data); ``` 3. **特征值分解**:协方差矩阵是一个实对称矩阵,因此可以进行特征值分解。这一步骤将帮助我们找出主成分的方向。MATLAB中的`eig`函数可以完成这个任务。 ```matlab [~, ...
Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues...
with simulated and experimental data for a range of denoising and sparse-sampling applications. LORAKS is also compared against state-of-the-art methods like homodyne reconstruction, `1-norm ...
In the conventional GMM-UBM framework the universal background model (UBM) is a Gaussian mixture model (GMM) that is trained on a pool of data (known as the background or development data) from a ...
The **lock-compatibility matrix** plays a key role here, determining whether a transaction can be granted a lock based on the locks already held by other transactions on the same item. Multiple ...
2. The second program prints the elements of a 2D array in a specific order. 3. The third program finds the maximum element in a 2D array and prints its position and value. 4. The fourth program ...
2. **创建扫描界面**:ZXing提供了一个简单的Intent方式来启动扫描。你只需要创建一个按钮或者触发扫描的事件,然后启动扫描Intent: ```java IntentIntegrator integrator = new IntentIntegrator(this); ...
“A Large-Scale Benchmark Data Set for Evaluating Pansharpening Performance Overview and implementation”两篇论文提供了评估高光谱和多光谱图像融合(即 pansharpening)性能的大规模基准数据集,这对于比较...
- **4.5–2 Plotting with a For Loop**: Here, plotting functions are used in conjunction with loops to visualize data dynamically. This technique is particularly useful for engineers who need to ...
the data obtained with the existing data, it is concluded that the opening of the second child has a positive effect on China’s economic development, the alleviation of aging, and the increase in the...
A matlab function libsvmwrite writes Matlab matrix to a file in LIBSVM format: libsvmwrite('data.txt', label_vector, instance_matrix] The instance_matrix must be a sparse matrix. (type must be ...
例如,可以定义一个名为`Matrix`的类,包含私有字段`rows`、`cols`和`data`,分别表示行数、列数和二维数组数据: ```csharp public class Matrix { private int rows; private int cols; private double[,] ...
Populating a DataSet Class with a Data Adapter 722 Populating a DataSet from XML 723 xx Contents Persisting DataSet Changes 723 Updating with Data Adapters 724 Writing XML Output 726 Working with ADO...
- **SOAP (Simple Object Access Protocol)**: A protocol for exchanging structured information in the implementation of web services. - **REST (Representational State Transfer)**: An architectural style...
2. Recovering the Data from the Transformation Matrix 324 Ronald N. Goldman 3. Transformations as Exponentials 332 Ronald N. Goldman 4. More Matrices and Transformations: Shear and Pseudo-Perspective ...