<commit_before>%  @copyright 2010 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin
%  @end
%
%   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.
%%%-------------------------------------------------------------------
%%% File    nodelist.erl
%%% @author <NAME> <<EMAIL>>
%%% @doc    Provides lists of nodes that are sorted by the nodes' ids.
%%% @end
%%% Created : 17 May 2010 by <NAME> <<EMAIL>>
%%%-------------------------------------------------------------------
%% @version $Id$

-module(nodelist).
-author('<EMAIL>').
-vsn('$Id$').

-export([% constructors:
         new_neighborhood/1, new_neighborhood/2, new_neighborhood/3,
         mk_neighborhood/2, mk_neighborhood/4,
         mk_nodelist/2,
         
         % getters:
         node/1, nodeid/1, pred/1, preds/1, succ/1, succs/1,
         has_real_pred/1, has_real_succ/1,
         
         % modifiers:
         trunc/3, trunc_preds/2, trunc_succs/2,
         remove/2, remove/3, filter/2, filter/3,
         lremove/2, lremove/3,lfilter/2, lfilter/3,
         lfilter_min_length/3, filter_min_length/4,
         merge/4, add_node/4, add_nodes/4,
         
         % converters:
         to_list/1,
         
         % miscellaneous:
         lupdate_ids/2, lremove_outdated/1, lremove_outdated/2]).

-include("scalaris.hrl").

-ifdef(with_export_type_support).
-export_type([neighborhood/0, nodelist/0, non_empty_nodelist/0]).
-endif.

-type(snodelist() :: [node:node_type()]). % (sorted) node list
-type(non_empty_snodelist() :: [node:node_type(),...]). % non-empty (sorted) node list
-opaque(neighborhood() :: {Preds::non_empty_snodelist(), Node::node:node_type(), Succs::non_empty_snodelist()}).

%% @doc Helper function that throws an exception if the given neighbor is newer
%%      than the BaseNode (requires that both are equal!).
-spec throw_if_newer(Neighbor::node:node_type(), BaseNode::node:node_type()) -> ok.
throw_if_newer(Neighbor, BaseNode) ->
    case BaseNode =/= node:newer(Neighbor, BaseNode) of
        true ->
            throw('cannot create a neighborhood() with a neighbor newer than the node itself');<commit_msg>- fixed nodelist type exports<commit_after>%  @copyright 2010 Konrad-Zuse-Zentrum fuer Informationstechnik Berlin
%  @end
%
%   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.
%%%-------------------------------------------------------------------
%%% File    nodelist.erl
%%% @author <NAME> <<EMAIL>>
%%% @doc    Provides lists of nodes that are sorted by the nodes' ids.
%%% @end
%%% Created : 17 May 2010 by <NAME> <<EMAIL>>
%%%-------------------------------------------------------------------
%% @version $Id$

-module(nodelist).
-author('<EMAIL>').
-vsn('$Id$').

-export([% constructors:
         new_neighborhood/1, new_neighborhood/2, new_neighborhood/3,
         mk_neighborhood/2, mk_neighborhood/4,
         mk_nodelist/2,
         
         % getters:
         node/1, nodeid/1, pred/1, preds/1, succ/1, succs/1,
         has_real_pred/1, has_real_succ/1,
         
         % modifiers:
         trunc/3, trunc_preds/2, trunc_succs/2,
         remove/2, remove/3, filter/2, filter/3,
         lremove/2, lremove/3,lfilter/2, lfilter/3,
         lfilter_min_length/3, filter_min_length/4,
         merge/4, add_node/4, add_nodes/4,
         
         % converters:
         to_list/1,
         
         % miscellaneous:
         lupdate_ids/2, lremove_outdated/1, lremove_outdated/2]).

-include("scalaris.hrl").

-ifdef(with_export_type_support).
-export_type([neighborhood/0, snodelist/0, non_empty_snodelist/0]).
-endif.

-type(snodelist() :: [node:node_type()]). % (sorted) node list
-type(non_empty_snodelist() :: [node:node_type(),...]). % non-empty (sorted) node list
-opaque(neighborhood() :: {Preds::non_empty_snodelist(), Node::node:node_type(), Succs::non_empty_snodelist()}).

%% @doc Helper function that throws an exception if the given neighbor is newer
%%      than the BaseNode (requires that both are equal!).
-spec throw_if_newer(Neighbor::node:node_type(), BaseNode::node:node_type()) -> ok.
throw_if_newer(Neighbor, BaseNode) ->
    case BaseNode =/= node:newer(Neighbor, BaseNode) of
        true ->
            throw('cannot create a neighborhood() with a neighbor newer than the node itself');
{'fraction_non_alphanumeric': 0.17496200607902734, 'fraction_numerical': 0.01937689969604863, 'mean_word_length': 2.606164383561644, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 23, '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': '2175767', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1632, 'n_words': 445}