PageRenderTime 21ms CodeModel.GetById 2ms app.highlight 16ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Analytics/GDataAnalyticsMetric.m

http://macfuse.googlecode.com/
Objective C | 91 lines | 52 code | 21 blank | 18 comment | 1 complexity | 1041c4f77efa89b3d15cc7c489616e54 MD5 | raw file
 1/* Copyright (c) 2009 Google Inc.
 2 *
 3 * Licensed under the Apache License, Version 2.0 (the "License");
 4 * you may not use this file except in compliance with the License.
 5 * You may obtain a copy of the License at
 6 *
 7 *     http://www.apache.org/licenses/LICENSE-2.0
 8 *
 9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16//
17//  GDataAnalyticsMetric.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE
21
22#import "GDataAnalyticsMetric.h"
23#import "GDataAnalyticsConstants.h"
24
25static NSString *const kConfidenceIntervalAttr = @"confidenceInterval";
26static NSString *const kNameAttr = @"name";
27static NSString *const kTypeAttr = @"type";
28static NSString *const kValueAttr = @"value";
29
30@implementation GDataAnalyticsMetric
31
32+ (NSString *)extensionElementURI       { return kGDataNamespaceAnalyticsDXP; }
33+ (NSString *)extensionElementPrefix    { return kGDataNamespaceAnalyticsDXPPrefix; }
34+ (NSString *)extensionElementLocalName { return @"metric"; }
35
36- (void)addParseDeclarations {
37
38  NSArray *attrs = [NSArray arrayWithObjects:
39                    kNameAttr, kTypeAttr, kValueAttr,
40                    kConfidenceIntervalAttr, nil];
41
42  [self addLocalAttributeDeclarations:attrs];
43}
44
45#pragma mark -
46
47- (NSNumber *)confidenceInterval {
48  NSNumber *num = [self doubleNumberForAttribute:kConfidenceIntervalAttr];
49  return num;
50}
51
52- (void)setConfidenceInterval:(NSNumber *)num {
53  [self setStringValue:[num stringValue] forAttribute:kConfidenceIntervalAttr];
54}
55
56- (NSString *)name {
57  NSString *str = [self stringValueForAttribute:kNameAttr];
58  return str;
59}
60
61- (void)setName:(NSString *)str {
62  [self setStringValue:str forAttribute:kNameAttr];
63}
64
65- (NSString *)type {
66  NSString *str = [self stringValueForAttribute:kTypeAttr];
67  return str;
68}
69
70- (void)setType:(NSString *)str {
71  [self setStringValue:str forAttribute:kTypeAttr];
72}
73
74- (NSString *)stringValue {
75  NSString *str = [self stringValueForAttribute:kValueAttr];
76  return str;
77}
78
79- (void)setStringValue:(NSString *)str {
80  [self setStringValue:str forAttribute:kValueAttr];
81}
82
83// convenience accessors
84- (NSNumber *)doubleValue {
85  NSNumber *num = [self doubleNumberForAttribute:kValueAttr];
86  return num;
87}
88
89@end
90
91#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ANALYTICS_SERVICE