|
26 | 26 | import org.tweetyproject.arg.eaf.syntax.EpistemicArgumentationFramework; |
27 | 27 |
|
28 | 28 | /** |
29 | | - * @author Sandra Hoffmann |
| 29 | + * Abstract base class for writing EpistemicArgumentationFramework (EAF) instances |
| 30 | + * to different file formats. |
| 31 | + * |
| 32 | + * Subclasses must implement the write method for specific formats. |
| 33 | + * This class also provides a static factory method to retrieve a suitable writer |
| 34 | + * for a given file format. |
| 35 | + * |
| 36 | + * Supported formats include: |
| 37 | + * |
| 38 | + * - TGF - Trivial Graph Format |
| 39 | + * - APX - Argumentation Interchange Format (used by ASPARTIX) |
| 40 | + * - CNF - Conjunctive Normal Form (logic-based encoding) |
| 41 | + * |
| 42 | + * |
| 43 | + * |
| 44 | + * Author: Sandra Hoffmann |
30 | 45 | */ |
31 | 46 | public abstract class AbstractEafWriter { |
32 | | - |
33 | | - /** |
34 | | - * standard constructor |
35 | | - */ |
36 | | - public AbstractEafWriter() { |
37 | | - super(); |
38 | | - } |
39 | | - |
40 | | - |
41 | | - /** |
42 | | - * Retrieves the writer for the given file format. |
43 | | - * @param f some file format |
44 | | - * @return a writer or null if the format is not supported. |
45 | | - */ |
46 | | - public static AbstractEafWriter getWriter(FileFormat f){ |
47 | | - if(f.equals(FileFormat.TGF)) |
48 | | - return new EafTgfWriter(); |
49 | | - if(f.equals(FileFormat.APX)) |
50 | | - return new EafApxWriter(); |
51 | | - if(f.equals(FileFormat.CNF)) |
52 | | - return new EafCnfWriter(); |
53 | | - return null; |
54 | | - } |
55 | | - |
56 | | - /** |
57 | | - * Writes the given eaf into a file |
58 | | - * @param eaf an abstract argumentation framework |
59 | | - * @param f the file that will be overwritten. |
60 | | - * @throws IOException for all errors concerning file reading/writing. |
61 | | - */ |
62 | | - public abstract void write(EpistemicArgumentationFramework eaf, File f) throws IOException; |
63 | 47 |
|
| 48 | + /** |
| 49 | + * Standard constructor. |
| 50 | + */ |
| 51 | + public AbstractEafWriter() { |
| 52 | + super(); |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Returns an AbstractEafWriter instance for the specified file format. |
| 57 | + * |
| 58 | + * @param f the desired file format |
| 59 | + * @return a writer for the format, or null if the format is not supported |
| 60 | + */ |
| 61 | + public static AbstractEafWriter getWriter(FileFormat f) { |
| 62 | + if (f.equals(FileFormat.TGF)) |
| 63 | + return new EafTgfWriter(); |
| 64 | + if (f.equals(FileFormat.APX)) |
| 65 | + return new EafApxWriter(); |
| 66 | + if (f.equals(FileFormat.CNF)) |
| 67 | + return new EafCnfWriter(); |
| 68 | + return null; |
| 69 | + } |
| 70 | + |
| 71 | + /** |
| 72 | + * Writes the given epistemic argumentation framework to the specified file. |
| 73 | + * If the file already exists, it will be overwritten. |
| 74 | + * |
| 75 | + * @param eaf the epistemic argumentation framework to be written |
| 76 | + * @param f the file to write to |
| 77 | + * @throws IOException if an error occurs during file writing |
| 78 | + */ |
| 79 | + public abstract void write(EpistemicArgumentationFramework eaf, File f) throws IOException; |
64 | 80 | } |
| 81 | + |
0 commit comments