1 /*
2 * Copyright (C) 2008, Florian Köberle <florianskarten@web.de> and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 package org.eclipse.jgit.fnmatch;
12
13 final class RestrictedWildCardHead extends AbstractHead {
14 private final char excludedCharacter;
15
16 RestrictedWildCardHead(char excludedCharacter, boolean star) {
17 super(star);
18 this.excludedCharacter = excludedCharacter;
19 }
20
21 /** {@inheritDoc} */
22 @Override
23 protected final boolean matches(char c) {
24 return c != excludedCharacter;
25 }
26
27 /** {@inheritDoc} */
28 @Override
29 public String toString() {
30 return isStar() ? "*" : "?"; //$NON-NLS-1$ //$NON-NLS-2$
31 }
32 }