/** * This applies the KeywordSpecification validation and additionally checks * whether the given value has the correct length. * * {@inheritDoc } */ @Override public boolean validate(Value value) { return value == null || (super.validate(value) && ((VectorialValue) value).getVector().length == length); }
/** * This applies the KeywordSpecification validation and additionally checks * whether the given value is part of the Alphabet. * * {@inheritDoc } */ @Override public boolean validate(Value value) { return value == null || (super.validate(value) && ((SymbolicValue) value).getAlphabet().equals(alphabet)); }
/** * Sets the value for the given keyword. * * @param index a keyword index. * @param value a value with the correct type. * * @throws UnsupportedOperationException is thrown if the given value has * the wrong type. * @throws ArrayIndexOutOfBoundsException is thrown if the given index is * too large or too small. */ public void setValue(final int index, final Value value) throws UnsupportedOperationException, ArrayIndexOutOfBoundsException { if (!sequence.getNodeSpecification().getKeywordSpecification(index).validate(value)) { throw new UnsupportedOperationException("The given value " + value + " does not meet the given specification for the keyword!"); } valueMap[index] = value; }