1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html#License
3/*
4**********************************************************************
5* Copyright (c) 2013-2014, International Business Machines
6* Corporation and others.  All Rights Reserved.
7**********************************************************************
8*/
9package com.ibm.icu.impl;
10
11import java.text.FieldPosition;
12
13/**
14 * DontCareFieldPosition is a subclass of FieldPosition that indicates that the
15 * caller is not interested in the start and end position of any field.
16 * <p>
17 * DontCareFieldPosition is a singleton, and its instance is immutable.
18 * <p>
19 * A <code>format</code> method use <code>fpos == DontCareFieldPosition.INSTANCE</code>
20 * to tell whether or not it needs to calculate a field position.
21 *
22 */
23public final class DontCareFieldPosition extends FieldPosition {
24
25    public static final DontCareFieldPosition INSTANCE = new DontCareFieldPosition();
26
27    private DontCareFieldPosition() {
28        // Pick some random number to be sure that we don't accidentally match with
29        // a field.
30        super(-913028704);
31    }
32
33    @Override
34    public void setBeginIndex(int i) {
35        // Do nothing
36    }
37
38    @Override
39    public void setEndIndex(int i) {
40        // Do nothing
41    }
42
43}
44