<commit_before>/*
 * Copyright 2018 <NAME> (komamitsu)
 *
 * 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 org.komamitsu.fluency;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.msgpack.jackson.dataformat.MessagePackExtensionType;
import org.msgpack.jackson.dataformat.MessagePackGenerator;

import java.io.IOException;
import java.nio.ByteBuffer;

@JsonSerialize(using = EventTime.Serializer.class)
public class EventTime
{
    private final long seconds;
    private final long nanoseconds;

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochSeconds the epoch seconds. This should be a 32-bit value.
     */
    public static EventTime fromEpoch(long epochSeconds)
    {
        return new EventTime(epochSeconds, 0);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochSeconds the epoch seconds. This should be a 32-bit value.
     * @param nanoSeconds the nanoseconds. This should be a 32-bit value.
     */
    public static EventTime fromEpoch(long epochSeconds, long nanoSeconds)
    {
        return new EventTime(epochSeconds, nanoSeconds);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochMilliSecond the epoch milliseconds.
     *        This should be a 32-bit value.
     */
    public static EventTime fromEpochMilli(long epochMilliSecond)
    {
        return new EventTime(epochMilliSecond/ 1000, (epochMilliSecond % 1000) * 1000000);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param seconds the epoch seconds. This should be a 32-bit value.
     * @param nanoseconds the nanoseconds. This should be a 32-bit value.
     */
    public EventTime(long seconds, long nanoseconds)
    {
        if (seconds >> 32 != 0) {
            throw new IllegalArgumentException("`seconds` should be a 32-bit value");
        }

        if (nanoseconds >> 32 != 0) {
            throw new IllegalArgumentException("`nanoseconds` should be a 32-bit value");
        }<commit_msg>Minor fix<commit_after>/*
 * Copyright 2018 <NAME> (komamitsu)
 *
 * 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 org.komamitsu.fluency;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.msgpack.jackson.dataformat.MessagePackExtensionType;
import org.msgpack.jackson.dataformat.MessagePackGenerator;

import java.io.IOException;
import java.nio.ByteBuffer;

@JsonSerialize(using = EventTime.Serializer.class)
public class EventTime
{
    private final long seconds;
    private final long nanoseconds;

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochSeconds the epoch seconds. This should be a 32-bit value.
     */
    public static EventTime fromEpoch(long epochSeconds)
    {
        return new EventTime(epochSeconds, 0);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochSeconds the epoch seconds. This should be a 32-bit value.
     * @param nanoseconds the nanoseconds. This should be a 32-bit value.
     */
    public static EventTime fromEpoch(long epochSeconds, long nanoseconds)
    {
        return new EventTime(epochSeconds, nanoseconds);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param epochMillisecond the epoch milli seconds.
     *        This should be a 32-bit value.
     */
    public static EventTime fromEpochMilli(long epochMillisecond)
    {
        return new EventTime(epochMillisecond/ 1000, (epochMillisecond % 1000) * 1000000);
    }

    /**
     * Constructs an <code>EventTime</code>.
     *
     * @param seconds the epoch seconds. This should be a 32-bit value.
     * @param nanoseconds the nanoseconds. This should be a 32-bit value.
     */
    public EventTime(long seconds, long nanoseconds)
    {
        if (seconds >> 32 != 0) {
            throw new IllegalArgumentException("`seconds` should be a 32-bit value");
        }

        if (nanoseconds >> 32 != 0) {
            throw new IllegalArgumentException("`nanoseconds` should be a 32-bit value");
        }
{'fraction_non_alphanumeric': 0.09099247844432214, 'fraction_numerical': 0.016877637130801686, 'mean_word_length': 3.0595681310498883, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4663785', 'n_tokens_mistral': 1639, 'n_tokens_neox': 1488, 'n_words': 504}