01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id$ */
19:
20: package org.apache.xmlgraphics.ps.dsc.events;
21:
22: import java.io.IOException;
23:
24: import org.apache.xmlgraphics.ps.DSCConstants;
25: import org.apache.xmlgraphics.ps.PSGenerator;
26: import org.apache.xmlgraphics.ps.dsc.DSCCommentFactory;
27:
28: /**
29: * This class represents a DSC comment with an "(ATEND)" value.
30: */
31: public class DSCAtend extends AbstractDSCComment {
32:
33: private String name;
34:
35: /**
36: * Creates a new instance
37: * @param name the name of the DSC comment (without the "%%" prefix)
38: */
39: public DSCAtend(String name) {
40: this .name = name;
41: }
42:
43: /**
44: * @see org.apache.xmlgraphics.ps.dsc.events.DSCComment#getName()
45: */
46: public String getName() {
47: return this .name;
48: }
49:
50: /**
51: * @see org.apache.xmlgraphics.ps.dsc.events.DSCComment#hasValues()
52: */
53: public boolean hasValues() {
54: return false;
55: }
56:
57: /**
58: * @see org.apache.xmlgraphics.ps.dsc.events.AbstractDSCComment#isAtend()
59: */
60: public boolean isAtend() {
61: return true;
62: }
63:
64: /**
65: * @see org.apache.xmlgraphics.ps.dsc.events.DSCComment#parseValue(java.lang.String)
66: */
67: public void parseValue(String value) {
68: //nop
69: }
70:
71: /**
72: * @see org.apache.xmlgraphics.ps.dsc.events.DSCEvent#generate(
73: * org.apache.xmlgraphics.ps.PSGenerator)
74: */
75: public void generate(PSGenerator gen) throws IOException {
76: gen.writeDSCComment(getName(), DSCConstants.ATEND);
77: }
78:
79: /**
80: * Creates a new instance of a DSC comment with the same name as this instance but does not
81: * have an "Atend" value.
82: * @return the new DSC comment
83: */
84: public DSCComment createDSCCommentFromAtend() {
85: return DSCCommentFactory.createDSCCommentFor(getName());
86: }
87:
88: }
|