1 package org.apache.lucene.util.fst;
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements. See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.
7 * The ASF licenses this file to You under the Apache License, Version 2.0
8 * (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 import org.apache.lucene.store.DataInput;
21 import org.apache.lucene.store.DataOutput;
24 * Use this if you just want to build an FSA.
26 * @lucene.experimental
29 public final class NoOutputs extends Outputs<Object> {
31 static final Object NO_OUTPUT = new Object() {
32 // NodeHash calls hashCode for this output; we fix this
33 // so we get deterministic hashing.
35 public int hashCode() {
40 public boolean equals(Object other) {
45 private static final NoOutputs singleton = new NoOutputs();
50 public static NoOutputs getSingleton() {
55 public Object common(Object output1, Object output2) {
56 assert output1 == NO_OUTPUT;
57 assert output2 == NO_OUTPUT;
62 public Object subtract(Object output, Object inc) {
63 assert output == NO_OUTPUT;
64 assert inc == NO_OUTPUT;
69 public Object add(Object prefix, Object output) {
70 assert prefix == NO_OUTPUT: "got " + prefix;
71 assert output == NO_OUTPUT;
76 public void write(Object prefix, DataOutput out) {
81 public Object read(DataInput in) {
88 public Object getNoOutput() {
93 public String outputToString(Object output) {