001/*
002 * SonarQube
003 * Copyright (C) 2009-2017 SonarSource SA
004 * mailto:info AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonar.api.batch.fs.internal;
021
022import java.util.Arrays;
023
024import javax.annotation.concurrent.Immutable;
025
026@Immutable
027public class Metadata {
028  private final int lines;
029  private final int nonBlankLines;
030  private final String hash;
031  private final int[] originalLineOffsets;
032  private final int lastValidOffset;
033
034  public Metadata(int lines, int nonBlankLines, String hash, int[] originalLineOffsets, int lastValidOffset) {
035    this.lines = lines;
036    this.nonBlankLines = nonBlankLines;
037    this.hash = hash;
038    this.originalLineOffsets = Arrays.copyOf(originalLineOffsets, originalLineOffsets.length);
039    this.lastValidOffset = lastValidOffset;
040  }
041
042  public int lines() {
043    return lines;
044  }
045
046  public int nonBlankLines() {
047    return nonBlankLines;
048  }
049
050  public String hash() {
051    return hash;
052  }
053
054  public int[] originalLineOffsets() {
055    return originalLineOffsets;
056  }
057
058  public int lastValidOffset() {
059    return lastValidOffset;
060  }
061
062}