All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.basistech.rosette.apimodel.MentionOffsets Maven / Gradle / Ivy

The newest version!
// Generated by delombok at Fri Nov 15 11:56:46 CST 2024
/*
* Copyright 2017 Basis Technology Corp.
*
* Licensed 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 com.basistech.rosette.apimodel;

import com.basistech.rosette.annotations.JacksonMixin;
import jakarta.validation.constraints.Min;

/**
 * The start and end offset/index for a given mention in a string of text
 */
@JacksonMixin
public final class MentionOffsets {
    /**
     */
    @Min(0)
    private final Integer startOffset;
    /**
     */
    @Min(0)
    private final Integer endOffset;

    @SuppressWarnings("all")
    MentionOffsets(final Integer startOffset, final Integer endOffset) {
        this.startOffset = startOffset;
        this.endOffset = endOffset;
    }


    @SuppressWarnings("all")
    public static class MentionOffsetsBuilder {
        @SuppressWarnings("all")
        private Integer startOffset;
        @SuppressWarnings("all")
        private Integer endOffset;

        @SuppressWarnings("all")
        MentionOffsetsBuilder() {
        }

        /**
         * @return {@code this}.
         */
        @SuppressWarnings("all")
        public MentionOffsets.MentionOffsetsBuilder startOffset(final Integer startOffset) {
            this.startOffset = startOffset;
            return this;
        }

        /**
         * @return {@code this}.
         */
        @SuppressWarnings("all")
        public MentionOffsets.MentionOffsetsBuilder endOffset(final Integer endOffset) {
            this.endOffset = endOffset;
            return this;
        }

        @SuppressWarnings("all")
        public MentionOffsets build() {
            return new MentionOffsets(this.startOffset, this.endOffset);
        }

        @Override
        @SuppressWarnings("all")
        public String toString() {
            return "MentionOffsets.MentionOffsetsBuilder(startOffset=" + this.startOffset + ", endOffset=" + this.endOffset + ")";
        }
    }

    @SuppressWarnings("all")
    public static MentionOffsets.MentionOffsetsBuilder builder() {
        return new MentionOffsets.MentionOffsetsBuilder();
    }

    /**
     * @return the offset for the first character of a mention, based on UTF-16 code page
     */
    @SuppressWarnings("all")
    public Integer getStartOffset() {
        return this.startOffset;
    }

    /**
     * @return the offset for the last character of a mention, based on UTF-16 code page
     */
    @SuppressWarnings("all")
    public Integer getEndOffset() {
        return this.endOffset;
    }

    @Override
    @SuppressWarnings("all")
    public boolean equals(final Object o) {
        if (o == this) return true;
        if (!(o instanceof MentionOffsets)) return false;
        final MentionOffsets other = (MentionOffsets) o;
        final Object this$startOffset = this.getStartOffset();
        final Object other$startOffset = other.getStartOffset();
        if (this$startOffset == null ? other$startOffset != null : !this$startOffset.equals(other$startOffset)) return false;
        final Object this$endOffset = this.getEndOffset();
        final Object other$endOffset = other.getEndOffset();
        if (this$endOffset == null ? other$endOffset != null : !this$endOffset.equals(other$endOffset)) return false;
        return true;
    }

    @Override
    @SuppressWarnings("all")
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        final Object $startOffset = this.getStartOffset();
        result = result * PRIME + ($startOffset == null ? 43 : $startOffset.hashCode());
        final Object $endOffset = this.getEndOffset();
        result = result * PRIME + ($endOffset == null ? 43 : $endOffset.hashCode());
        return result;
    }

    @Override
    @SuppressWarnings("all")
    public String toString() {
        return "MentionOffsets(startOffset=" + this.getStartOffset() + ", endOffset=" + this.getEndOffset() + ")";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy