LCOV - code coverage report
Current view: top level - Core - OORoleSet.h (source / functions) Hit Total Coverage
Test: coverxygen.info Lines: 0 22 0.0 %
Date: 2025-05-28 07:50:54 Functions: 0 0 -

          Line data    Source code
       1           0 : /*
       2             : 
       3             : OORoleSet.h
       4             : 
       5             : Manage a set of roles for a ship (or ship type), including probabilities.
       6             : 
       7             : A role set is an immutable object. 
       8             : 
       9             : 
      10             : Copyright (C) 2007-2013 Jens Ayton
      11             : 
      12             : Permission is hereby granted, free of charge, to any person obtaining a copy
      13             : of this software and associated documentation files (the "Software"), to deal
      14             : in the Software without restriction, including without limitation the rights
      15             : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      16             : copies of the Software, and to permit persons to whom the Software is
      17             : furnished to do so, subject to the following conditions:
      18             : 
      19             : The above copyright notice and this permission notice shall be included in all
      20             : copies or substantial portions of the Software.
      21             : 
      22             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      23             : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      24             : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      25             : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      26             : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      27             : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      28             : SOFTWARE.
      29             : 
      30             : */
      31             : 
      32             : #import "OOCocoa.h"
      33             : 
      34             : 
      35           0 : @interface OORoleSet: NSObject <NSCopying>
      36             : {
      37             : @private
      38             :         NSString                                        *_roleString;
      39           0 :         NSDictionary                            *_rolesAndProbabilities;
      40           0 :         NSSet                                           *_roles;
      41           0 :         float                                           _totalProb;
      42           0 : }
      43             : 
      44             : + (instancetype) roleSetWithString:(NSString *)roleString;
      45           0 : + (instancetype) roleSetWithRole:(NSString *)role probability:(float)probability;
      46           0 : 
      47             : - (id)initWithRoleString:(NSString *)roleString;
      48           0 : - (id)initWithRole:(NSString *)role probability:(float)probability;
      49           0 : 
      50             : - (NSString *)roleString;
      51           0 : 
      52             : - (BOOL)hasRole:(NSString *)role;
      53           0 : - (float)probabilityForRole:(NSString *)role;
      54           0 : - (BOOL)intersectsSet:(id)set;  // set may be an OORoleSet or an NSSet.
      55           0 : 
      56             : - (NSSet *)roles;
      57           0 : - (NSArray *)sortedRoles;
      58           0 : - (NSDictionary *)rolesAndProbabilities;
      59           0 : 
      60             : // Returns a random role, taking probabilities into account.
      61             : - (NSString *)anyRole;
      62           0 : 
      63             :         // Creating modified copies of role sets:
      64             : - (id)roleSetWithAddedRole:(NSString *)role probability:(float)probability;
      65           0 : - (id)roleSetWithAddedRoleIfNotSet:(NSString *)role probability:(float)probability;     // Unlike the above, does not change probability if role exists.
      66           0 : - (id)roleSetWithRemovedRole:(NSString *)role;
      67           0 : 
      68             : @end
      69             : 
      70             : 
      71             : // Returns a dictionary whose keys are roles and whose values are weights.
      72             : NSDictionary *OOParseRolesFromString(NSString *string);

Generated by: LCOV version 1.14