Package parser

Class DataSetFormatter

java.lang.Object
parser.DataSetFormatter

public class DataSetFormatter extends Object
Objects of this class take a data-set and simplify/reduce its complexity so that class MathExpression can easily work with it. The ultimate goal is to convert every data in the data-set into a number or a simple variable.
Since:
Sunday August 07 2011
  • Field Details

    • dataset

      private List<String> dataset
    • COMMA_MASK

      public static final String COMMA_MASK
      used to mask the commas after they have been processed.
      See Also:
    • OPEN_BRACKET_MASK

      public static final String OPEN_BRACKET_MASK
      used to mask the commas after they have been processed.
      See Also:
    • CLOSE_BRACKET_MASK

      public static final String CLOSE_BRACKET_MASK
      used to mask the commas after they have been processed.
      See Also:
  • Constructor Details

    • DataSetFormatter

      public DataSetFormatter(String datastring)
      Takes a comma separated string of data values and scans them into its dataset attribute.
      Parameters:
      datastring - A comma separated data set. e.g 2,3,......or sort(2,3,1,5,...) or mode(1,8,...)
  • Method Details

    • setDataset

      public void setDataset(ArrayList<String> dataset)
    • getDataset

      public List<String> getDataset()
    • getFormattedDataSet

      public String getFormattedDataSet()
      Returns:
      a formatted data-set.
    • processCommasInSingleBracketPair

      private void processCommasInSingleBracketPair(List<String> sbpList)
      Parameters:
      sbpList - A list containing the contents of a single bracket pair. The starting and ending brackets are not included.// 2,3,sin(x),cos,(,x1,),8
    • scanCommaSeparatedData

      public final void scanCommaSeparatedData(String myStr)
      root(@(x)sin(x)-x,2,3)
      Parameters:
      myStr - A String containing a data that uses commas to separate values. It attacks the commas and encloses the values and other data between commas with brackets. e.g sort(2,sin(3),4,log,(,3*a+12,sum,(,2,3,),),log,(,3,10,)....) becomes sort( (2),(sin(3)),(4)....)
    • main

      public static void main(String[] args)