VerticalAlignment.java

1
package com.lowagie.text.alignment;
2
3
import com.lowagie.text.Element;
4
import java.util.Optional;
5
6
/**
7
 * Represents a possible vertical alignment modes for document elements that can be aligned vertically.
8
 *
9
 * @author noavarice
10
 * @see WithVerticalAlignment
11
 * @since 1.2.7
12
 */
13
public enum VerticalAlignment {
14
15
    UNDEFINED(Element.ALIGN_UNDEFINED),
16
    TOP(Element.ALIGN_TOP),
17
    CENTER(Element.ALIGN_MIDDLE),
18
    BOTTOM(Element.ALIGN_BOTTOM),
19
    BASELINE(Element.ALIGN_BASELINE),
20
    ;
21
22
    private final int id;
23
24
    VerticalAlignment(int id) {
25
        this.id = id;
26
    }
27
28
    public int getId() {
29
        return id;
30
    }
31
32
    /**
33
    * Constructs {@link VerticalAlignment} instance from passed unique alignment {@code id}.
34
    *
35
    * @param id Alignment unique ID
36
    * @see Element#ALIGN_UNDEFINED
37
    * @see Element#ALIGN_TOP
38
    * @see Element#ALIGN_MIDDLE
39
    * @see Element#ALIGN_BOTTOM
40
    * @see Element#ALIGN_BASELINE
41
    * @return {@link Optional} containing alignment instance. If {@code id} is not recognized,
42
    * {@link Optional#empty()} will be returned
43
    */
44
    public static Optional<VerticalAlignment> of(final int id) {
45
        for (final VerticalAlignment alignment: values()) {
46 1 1. of : negated conditional → NO_COVERAGE
            if (alignment.id == id) {
47 1 1. of : mutated return of Object value for com/lowagie/text/alignment/VerticalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return Optional.of(alignment);
48
            }
49
        }
50
51 1 1. of : mutated return of Object value for com/lowagie/text/alignment/VerticalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return Optional.empty();
52
    }
53
}

Mutations

46

1.1
Location : of
Killed by : none
negated conditional → NO_COVERAGE

47

1.1
Location : of
Killed by : none
mutated return of Object value for com/lowagie/text/alignment/VerticalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

51

1.1
Location : of
Killed by : none
mutated return of Object value for com/lowagie/text/alignment/VerticalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2