001package jmri.jmrix;
002
003/**
004 * Basic interface for messages to and from the layout hardware.
005 *
006 * @author jake Copyright 2008
007 */
008public interface Message {
009
010    /**
011     * Get a particular element in a Message.
012     * @param n Element Index.
013     * @return single element of message.
014     */
015    int getElement(int n);
016
017    /**
018     * Get the number of data elements in a Message.
019     * @return number elements.
020     */
021    int getNumDataElements();
022
023    /**
024     * Set a single Data Element at a particular index.
025     * @param n index of element.
026     * @param v value of element.
027     */
028    void setElement(int n, int v);
029
030    /**
031     * {@inheritDoc}
032     */
033    @Override
034    String toString();
035
036
037    /**
038     * @return a human-readable representation of the message.
039     */
040    default String toMonitorString() {
041        return toString();
042    }
043
044}