HorizontalAlignment.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 horizontal alignment modes for document elements that can be aligned horizontally.
8
 *
9
 * @author noavarice
10
 * @see WithHorizontalAlignment
11
 * @since 1.2.7
12
 */
13
public enum HorizontalAlignment {
14
15
    UNDEFINED(Element.ALIGN_UNDEFINED),
16
    LEFT(Element.ALIGN_LEFT),
17
    CENTER(Element.ALIGN_CENTER),
18
    RIGHT(Element.ALIGN_RIGHT),
19
    JUSTIFIED(Element.ALIGN_JUSTIFIED),
20
    JUSTIFIED_ALL(Element.ALIGN_JUSTIFIED_ALL),
21
    ;
22
23
    private final int id;
24
25
    HorizontalAlignment(int id) {
26
        this.id = id;
27
    }
28
29
    public int getId() {
30
        return id;
31
    }
32
33
    /**
34
    * Constructs {@link HorizontalAlignment} instance from passed unique alignment {@code id}.
35
    *
36
    * @param id Alignment unique ID
37
    * @see Element#ALIGN_UNDEFINED
38
    * @see Element#ALIGN_LEFT
39
    * @see Element#ALIGN_CENTER
40
    * @see Element#ALIGN_RIGHT
41
    * @see Element#ALIGN_JUSTIFIED
42
    * @see Element#ALIGN_JUSTIFIED_ALL
43
    * @return {@link Optional} containing alignment instance. If {@code id} is not recognized,
44
    * {@link Optional#empty()} will be returned
45
    */
46
    public static Optional<HorizontalAlignment> of(final int id) {
47
        for (final HorizontalAlignment alignment: values()) {
48 1 1. of : negated conditional → NO_COVERAGE
            if (alignment.id == id) {
49 1 1. of : mutated return of Object value for com/lowagie/text/alignment/HorizontalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return Optional.of(alignment);
50
            }
51
        }
52
53 1 1. of : mutated return of Object value for com/lowagie/text/alignment/HorizontalAlignment::of to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return Optional.empty();
54
    }
55
}
56

Mutations

48

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

49

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

53

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

Active mutators

Tests examined


Report generated by PIT 1.4.2