<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 org.cojen.tupl;

import java.io.IOException;

/**
 * Implements a few {@link View} methods.
 *
 * @author <NAME>
 */
public abstract class AbstractView implements View {
    /**
     * {@inheritDoc}
     */
    @Override
    public boolean insert(Transaction txn, byte[] key, byte[] value) throws IOException {
        return update(txn, key, null, value);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean delete(Transaction txn, byte[] key) throws IOException {
        return replace(txn, key, null);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean remove(Transaction txn, byte[] key, byte[] value) throws IOException {
        return update(txn, key, value, null);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewGe(byte[] key) {
        return BoundedView.viewGe(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewGt(byte[] key) {
        return BoundedView.viewGt(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewLe(byte[] key) {
        return BoundedView.viewLe(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewLt(byte[] key) {
        return BoundedView.viewLt(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewPrefix(byte[] prefix, int trim) {
        return BoundedView.viewPrefix(this, prefix, trim);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewTransformed(Transformer transformer) {
        return TransformedView.apply(this, transformer);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewReverse() {
        return new ReverseView(this);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewUnmodifiable() {
        return UnmodifiableView.apply(this);
    }
}
<commit_msg>Add default stream method.<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 org.cojen.tupl;

import java.io.IOException;

/**
 * Implements a few {@link View} methods.
 *
 * @author <NAME>
 */
public abstract class AbstractView implements View {
    /**
     * {@inheritDoc}
     */
    @Override
    public boolean insert(Transaction txn, byte[] key, byte[] value) throws IOException {
        return update(txn, key, null, value);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean delete(Transaction txn, byte[] key) throws IOException {
        return replace(txn, key, null);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean remove(Transaction txn, byte[] key, byte[] value) throws IOException {
        return update(txn, key, value, null);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Stream newStream() {
        throw new UnsupportedOperationException();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewGe(byte[] key) {
        return BoundedView.viewGe(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewGt(byte[] key) {
        return BoundedView.viewGt(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewLe(byte[] key) {
        return BoundedView.viewLe(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewLt(byte[] key) {
        return BoundedView.viewLt(this, key);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewPrefix(byte[] prefix, int trim) {
        return BoundedView.viewPrefix(this, prefix, trim);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewTransformed(Transformer transformer) {
        return TransformedView.apply(this, transformer);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewReverse() {
        return new ReverseView(this);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public View viewUnmodifiable() {
        return UnmodifiableView.apply(this);
    }
}

{'fraction_non_alphanumeric': 0.11932901258101411, 'fraction_numerical': 0.0030499428135722455, 'mean_word_length': 2.310410094637224, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7241150', 'n_tokens_mistral': 1570, 'n_tokens_neox': 1526, 'n_words': 451}