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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package org.apache.lucene.analysis.compound.hyphenation;
20 import java.io.Serializable;
23 * This class represents a hyphen. A 'full' hyphen is made of 3 parts: the
24 * pre-break text, post-break text and no-break. If no line-break is generated
25 * at this position, the no-break text is used, otherwise, pre-break and
26 * post-break are used. Typically, pre-break is equal to the hyphen character
27 * and the others are empty. However, this general scheme allows support for
28 * cases in some languages where words change spelling if they're split across
29 * lines, like german's 'backen' which hyphenates 'bak-ken'. BTW, this comes
32 * This class has been taken from the Apache FOP project (http://xmlgraphics.apache.org/fop/). They have been slightly modified.
35 public class Hyphen implements Serializable {
36 public String preBreak;
38 public String noBreak;
40 public String postBreak;
42 Hyphen(String pre, String no, String post) {
55 public String toString() {
56 if (noBreak == null && postBreak == null && preBreak != null
57 && preBreak.equals("-")) {
60 StringBuilder res = new StringBuilder("{");
63 res.append(postBreak);
67 return res.toString();