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 CommentMacro extends SdfMacro {
009
010    public CommentMacro(String comment) {
011        this.comment = comment;
012    }
013
014    @Override
015    public String name() {
016        return "";
017    }
018
019    String comment;
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    @Override
032    public String toString() {
033        return ";" + comment + '\n';
034    }
035
036    @Override
037    public String oneInstructionString() {
038        return ";" + comment + '\n';
039    }
040
041    @Override
042    public String allInstructionString(String indent) {
043        return indent + oneInstructionString();
044    }
045}