001package jmri.jmrix.loconet.sdf;
002
003/**
004 * An SdfMacro for carrying a comment
005 *
006 * @author Bob Jacobsen Copyright (C) 2007
007 */
008public class LabelMacro extends SdfMacro {
009
010    public LabelMacro(String label) {
011        this.label = label;
012    }
013
014    @Override
015    public String name() {
016        return "";
017    }
018
019    String label;
020
021    @Override
022    public int length() {
023        return 0;
024    }
025
026    static public SdfMacro match(SdfBuffer buff) {
027        // never match, because this doesn't occur in byte stream
028        return null;
029    }
030
031    /**
032     * Store into a buffer.
033     */
034    @Override
035    public void loadByteArray(SdfBuffer buffer) {
036        // store children
037        super.loadByteArray(buffer);
038    }
039
040    @Override
041    public String toString() {
042        return label + '\n';
043    }
044
045    @Override
046    public String oneInstructionString() {
047        return label + '\n';
048    }
049
050    @Override
051    public String allInstructionString(String indent) {
052        // not indented
053        return oneInstructionString();
054    }
055}