<commit_before>/**
 * Copyright 2011-2012 the original author or authors.
 *
 * 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.informantproject.core.trace;

import java.math.BigInteger;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;

import javax.annotation.concurrent.Immutable;

import com.google.common.base.Strings;

/**
 * The unique identifier for a trace. The string representation of the unique identifier is lazily
 * constructed since it is not needed in the majority of the cases (it is only needed for traces
 * which are either persisted and/or viewed in-flight).
 * 
 * @author <NAME>
 * @since 0.5
 */
@Immutable
class TraceUniqueId {

    // used to populate id (below)
    private static final AtomicLong idCounter = new AtomicLong();

    private static final long MAX_ID = (long) Math.pow(16, 6); // at most 6 bytes in hex form

    private final long startTimeMillis;
    private final long id;

    TraceUniqueId(long startTimeMillis) {
        this.startTimeMillis = startTimeMillis;
        id = idCounter.getAndIncrement();
    }

    public String get() {
        return twelveDigitHex(startTimeMillis) + BigInteger.valueOf(id % MAX_ID).toString(16);
    }

    private static String twelveDigitHex(long x) {
        String s = BigInteger.valueOf(x).toString(16);
        if (s.length() > 12) {
            return s.substring(s.length() - 12);
        } else if (s.length() == 12) {
            return s;
        } else if (s.length() == 11) {
            // this is the case for dates between Nov 3, 2004 and Jun 23, 2527 so it seems worth
            // optimizing
            return '0' + s;
        } else {
            return Strings.padStart(s, 12, '0');
        }
    }

    public static void main(String... args) {
        System.out.println(twelveDigitHex(System.currentTimeMillis()));
        System.out.println(new Date((long) Math.pow(16, 10)));
        System.out.println(new Date((long) Math.pow(16, 11)));
    }
}
<commit_msg>Remove unused code<commit_after>/**
 * Copyright 2011-2012 the original author or authors.
 *
 * 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.informantproject.core.trace;

import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicLong;

import javax.annotation.concurrent.Immutable;

import com.google.common.base.Strings;

/**
 * The unique identifier for a trace. The string representation of the unique identifier is lazily
 * constructed since it is not needed in the majority of the cases (it is only needed for traces
 * which are either persisted and/or viewed in-flight).
 * 
 * @author <NAME>
 * @since 0.5
 */
@Immutable
class TraceUniqueId {

    // used to populate id (below)
    private static final AtomicLong idCounter = new AtomicLong();

    private static final long MAX_ID = (long) Math.pow(16, 6); // at most 6 bytes in hex form

    private final long startTimeMillis;
    private final long id;

    TraceUniqueId(long startTimeMillis) {
        this.startTimeMillis = startTimeMillis;
        id = idCounter.getAndIncrement();
    }

    public String get() {
        return twelveDigitHex(startTimeMillis) + BigInteger.valueOf(id % MAX_ID).toString(16);
    }

    private static String twelveDigitHex(long x) {
        String s = BigInteger.valueOf(x).toString(16);
        if (s.length() > 12) {
            return s.substring(s.length() - 12);
        } else if (s.length() == 12) {
            return s;
        } else if (s.length() == 11) {
            // this is the case for dates between Nov 3, 2004 and Jun 23, 2527 so it seems worth
            // optimizing
            return '0' + s;
        } else {
            return Strings.padStart(s, 12, '0');
        }
    }
}

{'fraction_non_alphanumeric': 0.09694415173867228, 'fraction_numerical': 0.02065331928345627, 'mean_word_length': 2.88379705400982, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '3523737', 'n_tokens_mistral': 1397, 'n_tokens_neox': 1302, 'n_words': 502}