   2010 - 2011 Zuse Institute Berlin

    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
%
%       -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.

  @author   <  >
%% @doc Service functions for handling quorums.
-module(quorum).
-author('').
-vsn('$Id: quorum.erl 1445 2011-02-23 11:34:29Z  $').

-export([majority_for_accept/1, majority_for_deny/1]).

%% @doc Gives the majority required for a quorum to accept.
-spec majority_for_accept(integer()) -> integer().
majority_for_accept(SetSize) -> SetSize div 2 + 1.

%% @doc Gives the majority required for a quorum to deny.
-spec majority_for_deny(integer()) -> integer().
majority_for_deny(SetSize) -> SetSize div 2 + SetSize rem 2.

   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       -2.0

   Unless required by applicable law or agreed to in writing, software
   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.
 @doc Service functions for handling quorums.
 @doc Gives the majority required for a quorum to accept.
 @doc Gives the majority required for a quorum to deny.
   2010 - 2011 Zuse Institute Berlin

    Licensed under the Apache License , Version 2.0 ( the " License " ) ;
    distributed under the License is distributed on an " AS IS " BASIS ,

  @author   <  >
-module(quorum).
-author('').
-vsn('$Id: quorum.erl 1445 2011-02-23 11:34:29Z  $').

-export([majority_for_accept/1, majority_for_deny/1]).

-spec majority_for_accept(integer()) -> integer().
majority_for_accept(SetSize) -> SetSize div 2 + 1.

-spec majority_for_deny(integer()) -> integer().
majority_for_deny(SetSize) -> SetSize div 2 + SetSize rem 2.
