summaryrefslogtreecommitdiff
path: root/Homework/cs5300/p4-formatter/submit/ast/Factor.java
blob: bda0f53c948601d55c4e8077855a115945b63089 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package submit.ast;

public class Factor implements Node {
    private Immutable immutable;
    private Mutable mutable;

    public Factor(Immutable immutable) {
        this.immutable = immutable;
    }

    public Factor(Mutable mutable) {
        this.mutable = mutable;
    }

    @Override
    public void toCminus(StringBuilder builder, String prefix) {
        builder.append(prefix);
        if (mutable != null)
            mutable.toCminus(builder, "");
        if (immutable != null)
            immutable.toCminus(builder, "");
    }
}