Skip to content

Commit 5f22f26

Browse files
committed
Refactored inline if (?:) statements to mitigate an uncrustify bug.
1 parent e4212f9 commit 5f22f26

12 files changed

Lines changed: 30 additions & 17 deletions

File tree

examples/AAPLot/Classes/RootViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ - (IBAction)toggleView {
6565

6666
[UIView beginAnimations:nil context:NULL];
6767
[UIView setAnimationDuration:1];
68-
[UIView setAnimationTransition:([mainView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft) forView:self.view cache:YES];
68+
UIViewAnimationTransition transition = ([mainView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft);
69+
[UIView setAnimationTransition:transition forView:self.view cache:YES];
6970

7071
if ([mainView superview] != nil) {
7172
[flipsideViewController viewWillAppear:YES];

examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordInd
389389
}
390390
else {
391391
if ( index % 8 ) {
392-
num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
392+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
393+
num = [[dataForPlot objectAtIndex:index] valueForKey:key];
393394
// Green plot gets shifted above the blue
394395
if ( [(NSString *)plot.identifier isEqualToString:@"Green Plot"] ) {
395396
if ( fieldEnum == CPTScatterPlotFieldY ) {

examples/CPTTestApp-iPhone/Classes/CPTTestAppScatterPlotController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {
161161

162162
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
163163
{
164-
NSNumber *num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
164+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
165+
NSNumber *num = [[dataForPlot objectAtIndex:index] valueForKey:key];
165166
// Green plot gets shifted above the blue
166167
if ([(NSString *)plot.identifier isEqualToString:@"Green Plot"])
167168
{

examples/CPTTestApp/Source/Controller.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordInd
366366
num = [(NSDecimalNumber *)num decimalNumberBySubtracting:[NSDecimalNumber decimalNumberWithString:@"10"]];
367367
}
368368
else {
369-
num = [[self.arrangedObjects objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
369+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
370+
num = [[self.arrangedObjects objectAtIndex:index] valueForKey:key];
370371
if ( fieldEnum == CPTScatterPlotFieldY ) {
371372
num = [NSNumber numberWithDouble:([num doubleValue] + 1.0)];
372373
}

examples/CPTTestApp/Source/SelectionDemoController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordInd
196196
NSNumber *num = nil;
197197

198198
if ( [(NSString *)plot.identifier isEqualToString:MAIN_PLOT] ) {
199-
num = [[self.dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
199+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
200+
num = [[self.dataForPlot objectAtIndex:index] valueForKey:key];
200201
}
201202
else if ( [(NSString *)plot.identifier isEqualToString:SELECTION_PLOT] ) {
202203
CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;

examples/CorePlotGallery/src/plots/CompositePlot.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordInd
443443
}
444444
}
445445
else {
446-
num = [[dataForPlot objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
446+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
447+
num = [[dataForPlot objectAtIndex:index] valueForKey:key];
447448

448449
// Green plot gets shifted above the blue
449450
if ([(NSString *)plot.identifier isEqualToString:@"Green Plot"])

examples/CorePlotGallery/src/plots/GradientScatterPlot.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
173173

174174
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
175175
{
176-
NSNumber* num = [[plotData objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
176+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
177+
NSNumber* num = [[plotData objectAtIndex:index] valueForKey:key];
177178
if (fieldEnum == CPTScatterPlotFieldY) {
178179
num = [NSNumber numberWithDouble:[num doubleValue]];
179180
}

examples/CorePlotGallery/src/plots/RealTimePlot.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ -(void)newData:(NSTimer *)theTimer
152152
}
153153

154154
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace;
155-
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(currentIndex >= kMaxDataPoints ? currentIndex - kMaxDataPoints + 1: 0)
155+
NSUInteger location = (currentIndex >= kMaxDataPoints ? currentIndex - kMaxDataPoints + 1 : 0);
156+
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(location)
156157
length:CPTDecimalFromUnsignedInteger(kMaxDataPoints - 1)];
157158

158159
currentIndex++;

examples/CorePlotGallery/src/plots/SimpleScatterPlot.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
194194

195195
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
196196
{
197-
NSNumber *num = [[plotData objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
197+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
198+
NSNumber *num = [[plotData objectAtIndex:index] valueForKey:key];
198199
if (fieldEnum == CPTScatterPlotFieldY) {
199200
num = [NSNumber numberWithDouble:[num doubleValue]];
200201
}

examples/CorePlotGallery/src/plots/SteppedScatterPlot.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
118118

119119
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index
120120
{
121-
NSNumber* num = [[plotData objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
121+
NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y");
122+
NSNumber* num = [[plotData objectAtIndex:index] valueForKey:key];
122123
if (fieldEnum == CPTScatterPlotFieldY) {
123124
num = [NSNumber numberWithDouble:[num doubleValue]];
124125
}

0 commit comments

Comments
 (0)