1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      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: KnuthBox.java 893238 2009-12-22 17:20:51Z vhennebert $ */
19 
20 package org.apache.fop.layoutmgr;
21 
22 /**
23  * An instance of this class represents an unbreakable piece of content with
24  * fixed width: for example an image, a syllable (but only if letter spacing
25  * is constant), ...
26  *
27  * A KnuthBox is never a feasible breaking point.
28  *
29  * The represented piece of content is never suppressed.
30  *
31  * Besides the inherited methods and attributes, this class has some more
32  * attributes to store information about the content height and its vertical
33  * positioning, and the methods used to get them.
34  */
35 public class KnuthBox extends KnuthElement {
36 
37     /**
38      * Creates a new <code>KnuthBox</code>.
39      *
40      * @param width    the width of this box
41      * @param pos  the Position stored in this box
42      * @param auxiliary is this box auxiliary?
43      */
KnuthBox(int width, Position pos, boolean auxiliary)44     public KnuthBox(int width, Position pos, boolean auxiliary) {
45         super(width, pos, auxiliary);
46     }
47 
48     /** {@inheritDoc} */
isBox()49     public boolean isBox() {
50         return true;
51     }
52 
53     /** {@inheritDoc} */
toString()54     public String toString() {
55         StringBuffer buffer = new StringBuffer(64);
56         if (isAuxiliary()) {
57             buffer.append("aux. ");
58         }
59         buffer.append("box");
60         buffer.append(" w=");
61         buffer.append(getWidth());
62         return buffer.toString();
63     }
64 
65 }
66