DataSet - PendulumProject2020/PendulumProject GitHub Wiki

Version: 0.1.9+

public class DataSet

This class belongs to the main package. This class belongs to the Methodological layer.

The DataSet class improves the clarity of the object transfer process. It has a field encapsulating an object and another field specifying the class of the said object. Another field is a Map which can be used to find data-subsets by name. Storing data-subsets as a field is intended to reduce the difficulty of unpacking a complex collection of objects.

Field Summary

private Map<String, DataSet> dataSubsets The data-subsets that this DataSet encapsulates, alongside their names.

private Class<?> entryType The class that the entry field belongs to.

private Object entry The data that this DataSet encapsulates.

Constructor Summary

public DataSet() Creates an empty DataSet without setting any field values.

public DataSet(Class<?> entryType, Object entry) Creates a DataSet encapsulating entry of the class entryType.

Method Summary

public ArrayList<?> presentAsArrayList() Casts the entry into an ArrayList and returns it.

public boolean equals(DataSet dataSet) Checks whether every field of dataSet is equal to the corresponding field of this object.

public void addDataSubset(String dataSubsetName, DataSet dataSubset) Creates an entry in the dataSubsets field with dataSubsetName as the key and dataSubset as the value.

public DataSet findDataSubset(String dataSubsetName) Returns the value of the key dataSubsetName in the dataSubsets field.

public DataSet findDataSubsetByPath(ArrayList<String> path) Returns the DataSet as specified by path in the data-subset tree of this object.

public Object findEntry(String dataSubsetName) Returns the entry of the DataSet corresponding to the key dataSubsetName in the dataSubsets field.

public Object findEntryByPath(ArrayList<String> path) Returns the entry of the DataSet as specified by path in the data-subset tree of this object.

Getters and Setters

public Map<String, DataSet> getDataSubsets

public void setDataSubsets(Map<String, DataSet> dataSubsets)

public Object getEntry()

public void setEntry(Object entry)

public Class<?> getEntryType()

public void setEntryType(Class<?> entryType)

⚠️ **GitHub.com Fallback** ⚠️