/** * Sets the value for the given keyword. * * @param keyword a keyword. * @param value a value with the correct type. * * @throws UnsupportedOperationException is thrown if the given keyword is * not supported by the NodeSpecification or if the given value has the * wrong type. */ public void setValue(@NonNull final String keyword, final Value value) throws UnsupportedOperationException { if (!sequence.getNodeSpecification().hasKeyword(keyword)) { throw new UnsupportedOperationException("The given keyword is not defined in the sequence!"); } setValue(sequence.getNodeSpecification().getKeywordIndex(keyword), value); }
vector[n - startIdx] = arrays[s][i][n]; node.setValue(k, new VectorialValue(vector));
final Node node = new Node(sequences[s]); for (int k = 0; k < K; k++) { node.setValue(k, new VectorialValue(new double[]{arrays[s][i][k]}));
for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]); node.setValue(0, new VectorialValue(arrays[s][i])); sequences[s].add(node);
/** * Transforms the given arrays to sequences. It is assumed that each * entry arrays[s] is a sequence. * Your sequences are allowed to have different lengths. * * @param arrays an array of double arrays that shall be converted to * sequences. * * @return an array of Sequences. */ public static Sequence[] toSequences(@NonNull double[][] arrays) { final KeywordSpecification[] keywordSpecs = {new VectorialKeywordSpecification(1, STDKEYWORD)}; final NodeSpecification nodeSpec = new NodeSpecification(keywordSpecs); final Sequence[] sequences = new Sequence[arrays.length]; for (int s = 0; s < arrays.length; s++) { sequences[s] = new Sequence(nodeSpec); for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]); node.setValue(0, new VectorialValue(new double[]{arrays[s][i]})); sequences[s].add(node); } } return sequences; }