1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * See LICENSE.txt included in this distribution for the specific 9 * language governing permissions and limitations under the License. 10 * 11 * When distributing Covered Code, include this CDDL HEADER in each 12 * file and include the License file at LICENSE.txt. 13 * If applicable, add the following below this CDDL HEADER, with the 14 * fields enclosed by brackets "[]" replaced with your own identifying 15 * information: Portions Copyright [yyyy] [name of copyright owner] 16 * 17 * CDDL HEADER END 18 */ 19 20 /* 21 * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. 22 * Portions Copyright (c) 2017, 2020, Chris Fraire <cfraire@me.com>. 23 */ 24 package org.opengrok.indexer.search; 25 26 import org.opengrok.indexer.analysis.NullableNumLinesLOC; 27 28 import java.io.File; 29 30 /** 31 * Represents a pairing of {@link File} along with supplemental 32 * {@link NullableNumLinesLOC}. 33 */ 34 public class DirectoryEntry { 35 36 private final File file; 37 private final NullableNumLinesLOC extra; 38 39 /** 40 * Initializes an instance with a specified, required {@link File}. 41 * @param file a defined instance 42 */ DirectoryEntry(File file)43 public DirectoryEntry(File file) { 44 this(file, null); 45 } 46 47 /** 48 * Initializes an instance with a specified, required {@link File} and 49 * a possible {@link NullableNumLinesLOC}. 50 * @param file a defined instance 51 * @param extra an optional instance 52 */ DirectoryEntry(File file, NullableNumLinesLOC extra)53 public DirectoryEntry(File file, NullableNumLinesLOC extra) { 54 if (file == null) { 55 throw new IllegalArgumentException("`file' is null"); 56 } 57 this.file = file; 58 this.extra = extra; 59 } 60 61 /** 62 * @return the file 63 */ getFile()64 public File getFile() { 65 return file; 66 } 67 68 /** 69 * @return the (optional) extra file data 70 */ getExtra()71 public NullableNumLinesLOC getExtra() { 72 return extra; 73 } 74 } 75