View Javadoc
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 CharacterHead extends AbstractHead {
14  	private final char expectedCharacter;
15  
16  	/**
17  	 * Constructor for CharacterHead
18  	 *
19  	 * @param expectedCharacter
20  	 *            expected {@code char}
21  	 */
22  	CharacterHead(char expectedCharacter) {
23  		super(false);
24  		this.expectedCharacter = expectedCharacter;
25  	}
26  
27  	/** {@inheritDoc} */
28  	@Override
29  	protected final boolean matches(char c) {
30  		return c == expectedCharacter;
31  	}
32  
33  	/** {@inheritDoc} */
34  	@Override
35  	public String toString() {
36  		return String.valueOf(expectedCharacter);
37  	}
38  
39  }