| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
package dr.app.beauti.generator; |
| 27 |
|
| 28 |
import dr.app.beauti.options.BeautiOptions; |
| 29 |
import dr.app.beauti.util.XMLWriter; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public abstract class BaseComponentGenerator extends Generator implements ComponentGenerator { |
| 38 |
private Generator callingGenerator; |
| 39 |
|
| 40 |
protected BaseComponentGenerator(final BeautiOptions options) { |
| 41 |
super(options, null); |
| 42 |
} |
| 43 |
|
| 44 |
@Override |
| 45 |
public void checkOptions() throws GeneratorException { |
| 46 |
|
| 47 |
} |
| 48 |
|
| 49 |
public void generateAtInsertionPoint(Generator generator, final InsertionPoint point, final Object item, final XMLWriter writer) { |
| 50 |
callingGenerator = generator; |
| 51 |
writer.writeComment("START " + getCommentLabel()); |
| 52 |
generate(point, item, "", writer); |
| 53 |
writer.writeComment("END " + getCommentLabel()); |
| 54 |
writer.writeBlankLine(); |
| 55 |
} |
| 56 |
|
| 57 |
public void generateAtInsertionPoint(Generator generator, final InsertionPoint point, final Object item, final String prefix, final XMLWriter writer) { |
| 58 |
callingGenerator = generator; |
| 59 |
writer.writeComment("START " + getCommentLabel()); |
| 60 |
generate(point, item, prefix, writer); |
| 61 |
writer.writeComment("END " + getCommentLabel()); |
| 62 |
writer.writeBlankLine(); |
| 63 |
} |
| 64 |
|
| 65 |
public Generator getCallingGenerator() { |
| 66 |
return callingGenerator; |
| 67 |
} |
| 68 |
|
| 69 |
protected abstract void generate(final InsertionPoint point, final Object item, final String prefix, final XMLWriter writer); |
| 70 |
|
| 71 |
protected abstract String getCommentLabel(); |
| 72 |
} |