aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/zwobble/mammoth/internal/documents/Run.java
blob: 6deca285662163de873ecfe53a1af8375b4f4bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package org.zwobble.mammoth.internal.documents;

import java.util.List;
import java.util.Optional;

public class Run implements DocumentElement, HasChildren {
    private final Optional<String> highlight;
    private final boolean isBold;
    private final boolean isItalic;
    private final boolean isUnderline;
    private final boolean isStrikethrough;
    private final boolean isAllCaps;
    private final boolean isSmallCaps;
    private final VerticalAlignment verticalAlignment;
    private final Optional<Style> style;
    private final List<DocumentElement> children;

    public Run(
        Optional<String> highlight,
        boolean isBold,
        boolean isItalic,
        boolean isUnderline,
        boolean isStrikethrough,
        boolean isAllCaps,
        boolean isSmallCaps,
        VerticalAlignment verticalAlignment,
        Optional<Style> style,
        List<DocumentElement> children
    ) {
        this.highlight = highlight;
        this.isBold = isBold;
        this.isItalic = isItalic;
        this.isUnderline = isUnderline;
        this.isStrikethrough = isStrikethrough;
        this.isAllCaps = isAllCaps;
        this.isSmallCaps = isSmallCaps;
        this.verticalAlignment = verticalAlignment;
        this.style = style;
        this.children = children;
    }

    public Optional<String> getHighlight() {
        return highlight;
    }

    public boolean isBold() {
        return isBold;
    }

    public boolean isItalic() {
        return isItalic;
    }

    public boolean isUnderline() {
        return isUnderline;
    }

    public boolean isStrikethrough() {
        return isStrikethrough;
    }

    public boolean isAllCaps() {
        return isAllCaps;
    }

    public boolean isSmallCaps() {
        return isSmallCaps;
    }

    public VerticalAlignment getVerticalAlignment() {
        return verticalAlignment;
    }

    public Optional<Style> getStyle() {
        return style;
    }

    @Override
    public List<DocumentElement> getChildren() {
        return children;
    }

    @Override
    public DocumentElement replaceChildren(List<DocumentElement> newChildren) {
        return new Run(
            this.highlight,
            this.isBold,
            this.isItalic,
            this.isUnderline,
            this.isStrikethrough,
            this.isAllCaps,
            this.isSmallCaps,
            this.verticalAlignment,
            this.style,
            newChildren
        );
    }

    @Override
    public <T, U> T accept(DocumentElementVisitor<T, U> visitor, U context) {
        return visitor.visit(this, context);
    }
}