MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / DataAdapter

Class DataAdapter

src/org/opensourcephysics/display/DataAdapter.java:19–136  ·  view source on GitHub ↗

Data adapter class implements the Data interface for double[][] arrays. @author Wolfgang Christian @author Doug Brown

Source from the content-addressed store, hash-verified

17 * @author Doug Brown
18 */
19public class DataAdapter implements Data {
20 protected String[] colNames;
21 protected String name = "Array Data"; //$NON-NLS-1$
22 protected double[][] data;
23 protected int ID = hashCode();
24
25 /**
26 * Constructor DataAdapter
27 * @param array
28 */
29 public DataAdapter(double[][] array) {
30 data = array;
31 }
32
33 /**
34 * Gets column names. Client should assign colors.
35 * Implementation of Data interface.
36 */
37 @Override
38public String[] getColumnNames() {
39 return colNames;
40 }
41
42 /**
43 * Sets the column names.
44 * @param names
45 */
46 public void setColumnNames(String[] names) {
47 if(names==null) return;
48 colNames = names.clone();
49 }
50
51 /**
52 * Gets the name of the Data.
53 */
54 @Override
55public String getName() {
56 return name;
57 }
58
59 /**
60 * Sets the name of the Data.
61 */
62 public void setName(String name) {
63 this.name = name;
64 }
65
66 /**
67 * Gets the double[][] array.
68 * Implementation of Data interface.
69 */
70 @Override
71public double[][] getData2D() {
72 return data;
73 }
74
75 /**
76 * Not used.

Callers

nothing calls this directly

Calls 1

hashCodeMethod · 0.45

Tested by

no test coverage detected