<commit_before>//
//  TPBaseFactory.h
//  TPFactory
//
//  Created by <NAME> on 14/04/14.
//  Copyright (c) 2014 Typo.nu. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^TPFactoryClassBlock)(__unsafe_unretained Class cls);

typedef NS_OPTIONS(NSInteger, TPFactoryOptions) {
    TPFactoryPrioritySortDesc                                       = 1 << 0,
    TPFactoryPrioritySortAsc                                        = 1 << 1,
    TPFactoryDebugValidatePriority                                  = 1 << 2, // This should only be used in debug mode since it will slow down your load time.
    TPProtocolFactoryIncludeSystemFrameworks                        = 1 << 3,
#ifdef DEBUG
    TPProtocolFactoryDefaultOptions                                 = TPProtocolFactoryIncludeSystemFrameworks|
                                                                        TPFactoryPrioritySortDesc|
                                                                        TPFactoryDebugValidatePriority,
#else
    TPProtocolFactoryDefaultOptions                                 = TPProtocolFactoryIncludeSystemFrameworks|TPFactoryPrioritySortDesc,
#endif
    
    TPSubclassFactoryDefaultOptions                                 = TPFactoryPrioritySortDesc
};

@protocol TPBaseFactoryProtocol <NSObject>
/*
 @return a integer for sorting of the diffrent types, higher is better
 */
+ (NSInteger) priority;
/*
 @parameter id This is used to determain if your viewcontroller can handle that type of object
 @return BOOL if you can handle object provided.
 */
+ (BOOL) canHandleObject: (id<NSObject>) object;
@end


@interface TPBaseFactory : NSObject
/**
 *  Designated initilizer for all factories
 *
 *  @param options that should be applied to this factory instance
 *
 *  @return self<commit_msg>Better documentation of protocol<commit_after>//
//  TPBaseFactory.h
//  TPFactory
//
//  Created by <NAME> on 14/04/14.
//  Copyright (c) 2014 Typo.nu. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void(^TPFactoryClassBlock)(__unsafe_unretained Class cls);

typedef NS_OPTIONS(NSInteger, TPFactoryOptions) {
    TPFactoryPrioritySortDesc                                       = 1 << 0,
    TPFactoryPrioritySortAsc                                        = 1 << 1,
    TPFactoryDebugValidatePriority                                  = 1 << 2, // This should only be used in debug mode since it will slow down your load time.
    TPProtocolFactoryIncludeSystemFrameworks                        = 1 << 3,
#ifdef DEBUG
    TPProtocolFactoryDefaultOptions                                 = TPProtocolFactoryIncludeSystemFrameworks|
                                                                        TPFactoryPrioritySortDesc|
                                                                        TPFactoryDebugValidatePriority,
#else
    TPProtocolFactoryDefaultOptions                                 = TPProtocolFactoryIncludeSystemFrameworks|TPFactoryPrioritySortDesc,
#endif
    
    TPSubclassFactoryDefaultOptions                                 = TPFactoryPrioritySortDesc
};

@protocol TPBaseFactoryProtocol <NSObject>
/**
 *  Method that will provide the factories with the priority for this class.
 *
 *  @return class priority in relationship to the factory.
 */
+ (NSInteger) priority;

/**
 *  Method that is used to determain if we can handle the provided object
 *
 *  @param object can be of any type depending on what you send in so always assume the worst
 *
 *  @return YES or NO depending if you can handle the object or not
 */
+ (BOOL) canHandleObject: (id<NSObject>) object;
@end


@interface TPBaseFactory : NSObject
/**
 *  Designated initilizer for all factories
 *
 *  @param options that should be applied to this factory instance
 *
 *  @return self
{'fraction_non_alphanumeric': 0.06390780513357779, 'fraction_numerical': 0.009429020429544265, 'mean_word_length': 1.9422187981510015, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4527035', 'n_tokens_mistral': 954, 'n_tokens_neox': 868, 'n_words': 290}