<commit_before>/*   Copyright 2013 APPNEXUS INC
 
 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.
 */

/***
 * This protocol defines all the things that are common between *all* types of
 * ads, whether they be direct descendants of UIView as in ANBannerAdView, or
 * modal view controller types like ANInterstitalAd.
 ***/

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class ANAdFetcher;
@class ANLocation;
@protocol ANAdDelegate;

typedef enum _ANGender
{
    UNKNOWN,
    MALE,
    FEMALE
} ANGender;

@protocol ANAdProtocol <NSObject>

@required
@property (nonatomic, readwrite, strong) NSString *placementId;
@property (nonatomic, readwrite, assign) CGSize adSize;
@property (nonatomic, readwrite, assign) BOOL clickShouldOpenInBrowser;
@property (nonatomic, readwrite, strong) ANAdFetcher *adFetcher;
@property (nonatomic, readwrite, assign) BOOL shouldServePublicServiceAnnouncements;
@property (nonatomic, readwrite, strong) ANLocation *location;
@property (nonatomic, readwrite, assign) CGFloat reserve;
@property (nonatomic, readwrite, strong) NSString *age;
@property (nonatomic, readwrite, assign) ANGender gender;
@property (nonatomic, readwrite, strong) NSMutableDictionary *customKeywords;

- (NSString *)adType;
- (void)setLocationWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude
                      timestamp:(NSDate *)timestamp horizontalAccuracy:(CGFloat)horizontalAccuracy;
- (void)addCustomKeywordWithKey:(NSString *)key value:(NSString *)value;
- (void)removeCustomKeywordWithKey:(NSString *)key;

@end

@protocol ANAdDelegate <NSObject>

@optional
- (void)adDidReceiveAd:(id<ANAdProtocol>)ad;
- (void)ad:(id<ANAdProtocol>)ad requestFailedWithError:(NSError *)error;
- (void)adWasClicked:(id<ANAdProtocol>)ad;
- (void)adWillClose:(id<ANAdProtocol>)ad;
- (void)adDidClose:(id<ANAdProtocol>)ad;
- (void)adWillPresent:(id<ANAdProtocol>)ad;
- (void)adDidPresent:(id<ANAdProtocol>)ad;
- (void)adWillLeaveApplication:(id<ANAdProtocol>)ad;

@end
<commit_msg>Add docs to ANAdProtocol.<commit_after>/*   Copyright 2013 APPNEXUS INC
 
 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.
 */

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@class ANAdFetcher;
@class ANLocation;
@protocol ANAdDelegate;

typedef enum _ANGender
{
    UNKNOWN,
    MALE,
    FEMALE
} ANGender;

// `ANAdProtocol' defines the properties and methods that are common
// to *all* ad types, whether direct descendants of `UIView' (like
// `ANBannerAdView') or modal view controller types (like
// `ANInterstitialAdView').

// This protocol can be understood as a toolkit for implementing ad
// types (It's used in the implementation of both banners and
// interstitials by the SDK).  If you wanted to, you could implement
// your own ad type using this protocol.
@protocol ANAdProtocol <NSObject>

@required
@property (nonatomic, readwrite, strong) NSString *placementId;
@property (nonatomic, readwrite, assign) CGSize adSize;
@property (nonatomic, readwrite, assign) BOOL clickShouldOpenInBrowser;
@property (nonatomic, readwrite, strong) ANAdFetcher *adFetcher;
@property (nonatomic, readwrite, assign) BOOL shouldServePublicServiceAnnouncements;
@property (nonatomic, readwrite, strong) ANLocation *location;
@property (nonatomic, readwrite, assign) CGFloat reserve;
@property (nonatomic, readwrite, strong) NSString *age;
@property (nonatomic, readwrite, assign) ANGender gender;
@property (nonatomic, readwrite, strong) NSMutableDictionary *customKeywords;

- (NSString *)adType;
- (void)setLocationWithLatitude:(CGFloat)latitude longitude:(CGFloat)longitude
                      timestamp:(NSDate *)timestamp horizontalAccuracy:(CGFloat)horizontalAccuracy;
- (void)addCustomKeywordWithKey:(NSString *)key value:(NSString *)value;
- (void)removeCustomKeywordWithKey:(NSString *)key;

@end

// The definition of the `ANAdDelegate' protocol includes methods
// which can be implemented by either type of ad.  Though these
// methods are listed here as optional, specific ad types may require
// them.  For example, interstitial ads require that `adDidReceiveAd'
// be implemented.
@protocol ANAdDelegate <NSObject>

@optional
- (void)adDidReceiveAd:(id<ANAdProtocol>)ad;
- (void)ad:(id<ANAdProtocol>)ad requestFailedWithError:(NSError *)error;
- (void)adWasClicked:(id<ANAdProtocol>)ad;
- (void)adWillClose:(id<ANAdProtocol>)ad;
- (void)adDidClose:(id<ANAdProtocol>)ad;
- (void)adWillPresent:(id<ANAdProtocol>)ad;
- (void)adDidPresent:(id<ANAdProtocol>)ad;
- (void)adWillLeaveApplication:(id<ANAdProtocol>)ad;

@end

{'fraction_non_alphanumeric': 0.10235934664246824, 'fraction_numerical': 0.0029038112522686023, 'mean_word_length': 5.854477611940299, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '6393424', 'n_tokens_mistral': 1683, 'n_tokens_neox': 1579, 'n_words': 526}