001/** 002 * Copyright (C) 2014 Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/ 003 * 004 * This file is part of Dicoogle/dicoogle-sdk. 005 * 006 * Dicoogle/dicoogle-sdk is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * Dicoogle/dicoogle-sdk 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 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with Dicoogle. If not, see <http://www.gnu.org/licenses/>. 018 */ 019package pt.ua.dicoogle.sdk.datastructs; 020 021public class IndexReport2 extends IndexReport { 022 023 private int nIndexedFiles; 024 private int nErrors; 025 private long elapsedTime; 026 027 public IndexReport2(int nIndexedFiles, int nErrors, long elapsedTime) { 028 super(); 029 this.nIndexedFiles = nIndexedFiles; 030 this.nErrors = nErrors; 031 this.elapsedTime = elapsedTime; 032 } 033 034 public IndexReport2(int nIndexedFiles, int nErrors) { 035 this(nIndexedFiles, nErrors, 0); 036 } 037 038 public IndexReport2(int nIndexedFiles) { 039 this(nIndexedFiles, 0, 0); 040 } 041 042 public IndexReport2() { 043 this(0,0,0); 044 } 045 046 public long getElapsedTime() { 047 return elapsedTime; 048 } 049 050 @Override 051 public String toString() { 052 return "IndexReport [nIndexedFiles=" + nIndexedFiles + ", nErrors=" 053 + nErrors + ", elapsedTime=" + elapsedTime + "]"; 054 } 055 056 public void setnIndexedFiles(int nIndexedFiles) { 057 this.nIndexedFiles = nIndexedFiles; 058 } 059 060 public void setnErrors(int nErrors) { 061 this.nErrors = nErrors; 062 } 063 064 public void setElapsedTime(long elapsedTime) { 065 this.elapsedTime = elapsedTime; 066 } 067 068 public void addIndexFile(){ 069 this.nIndexedFiles++; 070 } 071 072 public void addError(){ 073 this.nErrors++; 074 } 075 076 public void started(){ 077 this.elapsedTime = System.currentTimeMillis(); 078 } 079 080 public void finished(){ 081 this.elapsedTime = System.currentTimeMillis() - elapsedTime; 082 } 083 084 @Override 085 public int getNErrors() { 086 return nErrors; 087 } 088 089 @Override 090 public int getNIndexed() { 091 return nIndexedFiles; 092 } 093 094 095}