<commit_before>package at.innovative_solutions.tlv;

public interface ValueDecoder {
	public String getName(final TLV tlv);
	public String toString(final TLV tlv); // TODO better name
	public byte[] toValue(final String str, final TLV tlv);
	// TODO does this belong here?
	public String getFormat(final TLV tlv);
	public boolean isValueParsable(final TLV tlv);
	public String getSimpleDecoded(final TLV tlv);
	public boolean isValid(final TLV tlv);
}<commit_msg>Provide prelim. documentation for ValueDecoder interface<commit_after>package at.innovative_solutions.tlv;

public interface ValueDecoder {
	/**
	 * get short name for the tag
	 * 
	 * The name should not be dependent on the current value of the TLV.
	 * It should provide a short description (e.g. 1-2 words) of the
	 * passed field.
	 * 
	 * If the field can't be recognized or parsed, null shall be returned
	 *  
	 * @param tlv TLV to decode
	 * @return name or null
	 */
	public String getName(final TLV tlv);
	
	/**
	 * Get value decoded to string
	 * 
	 * Should return a human-readable representation of the data in
	 * the TLV. Representation shall match with {@link #toValue(String, TLV)}.
	 * 
	 * If the field can't be recognized or parsed, null shall be returned
	 * 
	 * @param tlv TLV to decode
	 * @return decoded string or null
	 */
	public String toString(final TLV tlv); // TODO better name
	
	/**
	 * Encode string representation to bytes
	 * 
	 * Should convert the human readable representation to data bytes
	 * for update. Representation shall match with {@link #toString(TLV)}.
	 * 
	 * @param str human readable representation
	 * @param tlv TLV to encode for
	 * @return encoded bytes or null
	 */
	public byte[] toValue(final String str, final TLV tlv);

	// TODO does this belong here?
	/**
	 * Get format information for serializations specifying these
	 * 
	 * Should return a short formatting description if available, like used in EMV.
	 * Think along the lines of e.g. "I5" for a 5 digit integer, or similar.
	 * 
	 * Return null if no such thing is available/known for the given TLV.
	 * 
	 * @param tlv TLV to supply format for
	 * @return format hint or null
	 */
	public String getFormat(final TLV tlv);
	
	/**
	 * Check if TLV data matches expected data
	 * 
	 * @param tlv TLV to check
	 * @return check result
	 */
	public boolean isValueParsable(final TLV tlv);
	
	/**
	 * Decode TLV data and return interpretation
	 * 
	 * Return e.g. parsed and decoded bitfield data.
	 * 
	 * @param tlv TLV to parse data of
	 * @return multi-line string showing data interpretation or null
	 */
	public String getSimpleDecoded(final TLV tlv);
	
	public boolean isValid(final TLV tlv);
}
{'fraction_non_alphanumeric': 0.07729648991784914, 'fraction_numerical': 0.0014936519790888724, 'mean_word_length': 3.4135090609555188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4674197', 'n_tokens_mistral': 830, 'n_tokens_neox': 741, 'n_words': 343}