001 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
002 *
003 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
004 *
005 * "Hilbert II" is free software; you can redistribute
006 * it and/or modify it under the terms of the GNU General Public
007 * License as published by the Free Software Foundation; either
008 * version 2 of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 */
015
016 package org.qedeq.kernel.bo.module;
017
018 import org.qedeq.kernel.se.common.SourceFileExceptionList;
019
020 /**
021 * Holds the results from a plugin execution.
022 *
023 * @author Michael Meyling
024 */
025 public class PluginResults {
026
027 /** Errors that occurred. */
028 private SourceFileExceptionList errors;
029
030 /** Warnings that occurred. */
031 private SourceFileExceptionList warnings;
032
033 /**
034 * Creates a new result container.
035 */
036 public PluginResults() {
037 errors = new SourceFileExceptionList();
038 warnings = new SourceFileExceptionList();
039 }
040
041 /**
042 * Clear all warnings and errors.
043 */
044 public void clear() {
045 errors.clear();
046 warnings.clear();
047 }
048
049 /**
050 * Get list of all errors.
051 *
052 * @return Error list. Is never <code>null</code>.
053 */
054 public SourceFileExceptionList getErrors() {
055 return errors;
056 }
057
058 /**
059 * Add errors.
060 *
061 * @param errors Add these errors.
062 */
063 public void addErrors(final SourceFileExceptionList errors) {
064 this.errors.add(errors);
065 }
066
067 /**
068 * Get list of all warnings.
069 *
070 * @return Warnings list. Is never <code>null</code>.
071 */
072 public SourceFileExceptionList getWarnings() {
073 return warnings;
074 }
075
076 /**
077 * Add warnings.
078 *
079 * @param warnings Add these warnings.
080 */
081 public void addWarnings(final SourceFileExceptionList warnings) {
082 this.warnings.add(warnings);
083 }
084
085 /**
086 * Are there any errors?
087 *
088 * @return Errors exist.
089 */
090 public boolean hasErrors() {
091 return errors.size() > 0;
092 }
093
094 /**
095 * Are there any warnings.
096 *
097 * @return Warnings exist.
098 */
099 public boolean hasWarnings() {
100 return warnings.size() > 0;
101 }
102
103 }
|