return center_case20; default: throw new SAXException("Invalid alphabet size.");
return distance_case20; default: throw new SAXException("Invalid alphabet size.");
return case20; default: throw new SAXException("Invalid alphabet size.");
return distance_case20; default: throw new SAXException("Invalid alphabet size.");
return case20; default: throw new SAXException("Invalid alphabet size.");
return center_case20; default: throw new SAXException("Invalid alphabet size.");
/** * Compute the distance between the two strings, this function use the numbers associated with * ASCII codes, i.e. distance between a and b would be 1. * * @param a The first string. * @param b The second string. * @return The pairwise distance. * @throws SAXException if length are differ. */ public int strDistance(char[] a, char[] b) throws SAXException { if (a.length == b.length) { int distance = 0; for (int i = 0; i < a.length; i++) { int tDist = Math.abs(Character.getNumericValue(a[i]) - Character.getNumericValue(b[i])); distance += tDist; } return distance; } else { throw new SAXException("Unable to compute SAX distance, string lengths are not equal"); } }
/** * Compute the distance between the two strings, this function use the numbers associated with * ASCII codes, i.e. distance between a and b would be 1. * * @param a The first string. * @param b The second string. * @return The pairwise distance. * @throws SAXException if length are differ. */ public int strDistance(char[] a, char[] b) throws SAXException { if (a.length == b.length) { int distance = 0; for (int i = 0; i < a.length; i++) { int tDist = Math.abs(Character.getNumericValue(a[i]) - Character.getNumericValue(b[i])); distance += tDist; } return distance; } else { throw new SAXException("Unable to compute SAX distance, string lengths are not equal"); } }
int maxIdx = distanceMatrix[0].length; if (numA > (maxIdx - 1) || numA < 0 || numB > (maxIdx - 1) || numB < 0) { throw new SAXException( "The character index greater than " + maxIdx + " or less than 0!"); throw new SAXException("Non-literal character found!"); throw new SAXException("Data arrays lengths are not equal!");
/** * Read at least N elements from the one-column file. * * @param dataFileName the file name. * @param loadLimit the load limit. * @return the read data or empty array if nothing to load. * @throws SAXException if error occurs. * @throws IOException if error occurs. */ public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
/** * Read at least N elements from the one-column file. * * @param dataFileName the file name. * @param loadLimit the load limit. * @return the read data or empty array if nothing to load. * @throws SAXException if error occurs. * @throws IOException if error occurs. */ public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
int maxIdx = distanceMatrix[0].length; if (numA > (maxIdx - 1) || numA < 0 || numB > (maxIdx - 1) || numB < 0) { throw new SAXException( "The character index greater than " + maxIdx + " or less than 0!"); throw new SAXException("Non-literal character found!"); throw new SAXException("Data arrays lengths are not equal!");
/** * Reads timeseries from a file. Assumes that file has a single double value on every line. * Assigned timestamps are the line numbers. * * @param filename The file to read from. * @param columnIdx The column index. * @param sizeLimit The number of lines to read, 0 == all. * @return data. * @throws IOException if error occurs. * @throws SAXException if error occurs. */ public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
/** * Reads timeseries from a file. Assumes that file has a single double value on every line. * Assigned timestamps are the line numbers. * * @param filename The file to read from. * @param columnIdx The column index. * @param sizeLimit The number of lines to read, 0 == all. * @return data. * @throws IOException if error occurs. * @throws SAXException if error occurs. */ public static double[] readFileColumn(String filename, int columnIdx, int sizeLimit) throws IOException, SAXException { // make sure the path exists Path path = Paths.get(filename); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(filename), "UTF-8")); return readTS(br, columnIdx, sizeLimit); }
String message = "Unable to read data from column " + columnIdx; br.close(); throw new SAXException(message);
throw new SAXException("PAA size can't be greater than the timeseries size.");
String message = "Unable to read data from column " + columnIdx; br.close(); throw new SAXException(message);
throw new SAXException("PAA size can't be greater than the timeseries size.");
throw new SAXException( "Unable to saxify via window, window size is greater than the timeseries length...");
throw new SAXException( "Unable to saxify via window, window size is greater than the timeseries length...");