<commit_before>/*
 * Copyright 2015 <NAME>
 *
 * 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 io.trivium.extension._f70b024ca63f4b6b80427238bfff101f;

import io.trivium.dep.com.google.common.primitives.Bytes;
import io.trivium.NVList;
import io.trivium.NVPair;
import io.trivium.Registry;
import io.trivium.anystore.ObjectRef;
import io.trivium.extension.type.Type;
import io.trivium.glue.om.Element;
import io.trivium.glue.om.Json;
import io.trivium.glue.om.Trivium;
import io.trivium.dep.org.iq80.snappy.Snappy;

import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;

public class TriviumObject implements Type {
    /**
     * typeByte
     * 0 uncompressed json
     * 1 snappy compressed json
     */
    public static byte typeByte = 1;
    Logger log = Logger.getLogger(getClass().getName());
    ObjectRef id;
    ObjectRef typeId;
    NVList metadata;
    byte[] b_metadata;
    Element data;
    byte[] b_data;

    public TriviumObject(){
        id = ObjectRef.getInstance();
        typeId = ObjectRef.INVALID;
        metadata = new NVList();
        replaceMeta("id", id.toString());
        data = Element.EMPTY;
    }

    public TriviumObject(ObjectRef id){
        this.id = id;
        typeId = ObjectRef.INVALID;
        metadata = new NVList();
        replaceMeta("id",id.toString());
        data = Element.EMPTY;
    }

    public ObjectRef getId(){
        return id;
    }

    public void setId(ObjectRef id){
        this.id=id;
        replaceMeta("id",id.toString());
    }

    @Override
    public ObjectRef getTypeId(){
        return typeId;
    }

    public void setTypeId(ObjectRef newType){
        typeId = newType;
        metadata.replace(new NVPair("typeId",newType.toString()));
    }

    public NVList getMetadata(){
        return metadata;
    }

    public void addMetadata(String name,String value){<commit_msg>create object with default meta data<commit_after>/*
 * Copyright 2015 <NAME>
 *
 * 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 io.trivium.extension._f70b024ca63f4b6b80427238bfff101f;

import io.trivium.dep.com.google.common.primitives.Bytes;
import io.trivium.NVList;
import io.trivium.NVPair;
import io.trivium.Registry;
import io.trivium.anystore.ObjectRef;
import io.trivium.extension.type.Type;
import io.trivium.glue.om.Element;
import io.trivium.glue.om.Json;
import io.trivium.glue.om.Trivium;
import io.trivium.dep.org.iq80.snappy.Snappy;

import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;

public class TriviumObject implements Type {
    /**
     * typeByte
     * 0 uncompressed json
     * 1 snappy compressed json
     */
    public static byte typeByte = 1;
    Logger log = Logger.getLogger(getClass().getName());
    ObjectRef id;
    ObjectRef typeId;
    NVList metadata;
    byte[] b_metadata;
    Element data;
    byte[] b_data;

    public TriviumObject(){
        id = ObjectRef.getInstance();
        typeId = ObjectRef.INVALID;
        metadata = new NVList();
        replaceMeta("id", id.toString());
        data = Element.EMPTY;
        checkMetadata();
    }

    public TriviumObject(ObjectRef id){
        this.id = id;
        typeId = ObjectRef.INVALID;
        metadata = new NVList();
        replaceMeta("id",id.toString());
        data = Element.EMPTY;
        checkMetadata();
    }

    public ObjectRef getId(){
        return id;
    }

    public void setId(ObjectRef id){
        this.id=id;
        replaceMeta("id",id.toString());
    }

    @Override
    public ObjectRef getTypeId(){
        return typeId;
    }

    public void setTypeId(ObjectRef newType){
        typeId = newType;
        metadata.replace(new NVPair("typeId",newType.toString()));
    }

    public NVList getMetadata(){
        return metadata;
    }

    public void addMetadata(String name,String value){
{'fraction_non_alphanumeric': 0.10227493680731091, 'fraction_numerical': 0.01283297686175384, 'mean_word_length': 3.056782334384858, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3959383', 'n_tokens_mistral': 1588, 'n_tokens_neox': 1535, 'n_words': 430}