fa07a5b1d4d181f207ce7455b99d7e894c94a730
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / string / tokenizer / Terminator.java
1 /*
2  * Svjatoslav Commons - shared library of common functionality.
3  * Copyright ©2012-2017, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 3 of the GNU Lesser General Public License
7  * or later as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.commons.string.tokenizer;
11
12 public class Terminator {
13
14     public final String startSequence;
15     public final String endSequence;
16     public final TerminationStrategy termination;
17
18     public Terminator(final String startSequence, TerminationStrategy termination) {
19         this.startSequence = startSequence;
20         this.endSequence = null;
21         this.termination = termination;
22     }
23
24     public Terminator(final String startSequence, final String endSequence, TerminationStrategy termination) {
25         this.startSequence = startSequence;
26         this.endSequence = endSequence;
27         this.termination = termination;
28     }
29
30     public enum TerminationStrategy {
31         PRESERVE,
32         DROP
33     }
34
35     @Override
36     public String toString() {
37         return "Terminator{" +
38                 "startSequence='" + startSequence + '\'' +
39                 ", endSequence='" + endSequence + '\'' +
40                 ", termination=" + termination +
41                 '}';
42     }
43 }