org.apache.lucene.misc.util.fst.UpToTwoPositiveIntOutputs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lucene-misc Show documentation
Show all versions of lucene-misc Show documentation
Miscellaneous Lucene extensions
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.misc.util.fst;
import java.io.IOException;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.DataOutput;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.fst.FSTCompiler;
import org.apache.lucene.util.fst.Outputs;
/**
* An FST {@link Outputs} implementation where each output is one or two non-negative long values.
* If it's a single output, Long is returned; else, TwoLongs. Order is preserved in the TwoLongs
* case, ie .first is the first input/output added to Builder, and .second is the second. You cannot
* store 0 output with this (that's reserved to mean "no output")!
*
* NOTE: the only way to create a TwoLongs output is to add the same input to the FST twice in a
* row. This is how the FST maps a single input to two outputs (e.g. you cannot pass a TwoLongs to
* {@link FSTCompiler#add}. If you need more than two then use {@link ListOfOutputs}, but if you
* only have at most 2 then this implementation will require fewer bytes as it steals one bit from
* each long value.
*
*
NOTE: the resulting FST is not guaranteed to be minimal! See {@link FSTCompiler}.
*
* @lucene.experimental
*/
public final class UpToTwoPositiveIntOutputs extends Outputs
© 2015 - 2025 Weber Informatics LLC | Privacy Policy