API  0.9.10
CPPredicateEditorRowTemplate.j
Go to the documentation of this file.
1 /*
2  * CPPredicateEditorRowTemplate.j
3  * AppKit
4  *
5  * Created by cacaodev.
6  * Copyright 2011, cacaodev.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 
25 
26 
39 
40 @implementation CPPredicateEditorRowTemplate : CPObject
41 {
42  int _templateType;
43  unsigned _predicateOptions;
44  unsigned _predicateModifier;
45  unsigned _leftAttributeType;
46  unsigned _rightAttributeType;
47  BOOL _leftIsWildcard;
48  BOOL _rightIsWildcard;
49  CPArray _views;
50 
51 }
52 
86 - (id)initWithLeftExpressions:(CPArray)leftExpressions rightExpressions:(CPArray)rightExpressions modifier:(int)modifier operators:(CPArray)operators options:(int)options
87 {
88  self = [super init];
89  if (self != nil)
90  {
91  _templateType = 1;
92  _leftIsWildcard = NO;
93  _rightIsWildcard = NO;
94  _leftAttributeType = 0;
95  _rightAttributeType = 0;
96  _predicateModifier = modifier;
97  _predicateOptions = options;
98 
99  var leftView = [self _viewFromExpressions:leftExpressions],
100  rightView = [self _viewFromExpressions:rightExpressions],
101  middleView = [self _viewFromOperatorTypes:operators];
102 
103  _views = [[CPArray alloc] initWithObjects:leftView, middleView, rightView];
104  }
105 
106  return self;
107 }
108 
118 - (id)initWithLeftExpressions:(CPArray )leftExpressions rightExpressionAttributeType:(CPAttributeType)attributeType modifier:(CPComparisonPredicateModifier)modifier operators:(CPArray )operators options:(int)options
119 {
120  self = [super init];
121  if (self != nil)
122  {
123  var leftView = [self _viewFromExpressions:leftExpressions],
124  middleView = [self _viewFromOperatorTypes:operators],
125  rightView = [self _viewFromAttributeType:attributeType];
126 
127  _templateType = 1;
128  _leftIsWildcard = NO;
129  _rightIsWildcard = YES;
130  _leftAttributeType = 0;
131  _rightAttributeType = attributeType;
132  _predicateModifier = modifier;
133  _predicateOptions = options;
134  _views = [[CPArray alloc] initWithObjects:leftView, middleView, rightView];
135  }
136 
137  return self;
138 }
139 
146 - (id)initWithCompoundTypes:(CPArray )compoundTypes
147 {
148  self = [super init];
149  if (self != nil)
150  {
151  var leftView = [self _viewFromCompoundTypes:compoundTypes],
152  rightView = [[CPPopUpButton alloc] init];
153 
154  [rightView addItemWithTitle:@"of the following are true"];
155 
156  _templateType = 2;
157  _leftIsWildcard = NO;
158  _rightIsWildcard = NO;
159  _rightAttributeType = 0;
160  _views = [[CPArray alloc] initWithObjects:leftView, rightView];
161  }
162  return self;
163 }
164 
175 - (double)matchForPredicate:(CPPredicate)predicate
176 {
177  // How exactly this value (float 0-1) is computed ?
178  if ([self _templateType] == 2 && [predicate isKindOfClass:[CPCompoundPredicate class]])
179  {
180  if ([[self compoundTypes] containsObject:[predicate compoundPredicateType]])
181  return 1;
182  }
183  else if ([self _templateType] == 1 && [predicate isKindOfClass:[CPComparisonPredicate class]])
184  {
185  if (!_leftIsWildcard && ![[self leftExpressions] containsObject:[predicate leftExpression]])
186  return 0;
187 
188  if (![[self operators] containsObject:[predicate predicateOperatorType]])
189  return 0;
190 
191  if (!_rightIsWildcard && ![[self rightExpressions] containsObject:[predicate rightExpression]])
192  return 0;
193 
194  return 1;
195  }
196 
197  return 0;
198 }
199 
205 - (CPArray)templateViews
206 {
207  return _views;
208 }
209 
217 - (void)setPredicate:(CPPredicate)predicate
218 {
219  if (_templateType == 2)
220  [self _setCompoundPredicate:predicate];
221  else
222  [self _setComparisonPredicate:predicate];
223 }
224 
231 - (CPArray)displayableSubpredicatesOfPredicate:(CPPredicate)predicate
232 {
233  if ([predicate isKindOfClass:[CPCompoundPredicate class]])
234  {
235  var subpredicates = [predicate subpredicates];
236  if ([subpredicates count] == 0)
237  return nil;
238 
239  return subpredicates;
240  }
241 
242  return nil;
243 }
244 
253 - (CPPredicate)predicateWithSubpredicates:(CPArray)subpredicates
254 {
255  if (_templateType == 2)
256  {
257  var type = [[_views[0] selectedItem] representedObject];
258  return [[CPCompoundPredicate alloc] initWithType:type subpredicates:subpredicates];
259  }
260 
261  if (_templateType == 1)
262  {
263  var lhs = [self _leftExpression],
264  rhs = [self _rightExpression],
265  operator = [[_views[1] selectedItem] representedObject];
266 
268  rightExpression:rhs
269  modifier:[self modifier]
270  type:operator
271  options:[self options]];
272  }
273 
274  return nil;
275 }
276 
285 - (CPArray)leftExpressions
286 {
287  if (_templateType == 1 && !_leftIsWildcard)
288  {
289  var view = [_views objectAtIndex:0];
290  return [[view itemArray] valueForKey:@"representedObject"];
291  }
292 
293  return nil;
294 }
295 
301 {
302  if (_templateType == 1 && !_rightIsWildcard)
303  {
304  var view = [_views objectAtIndex:2];
305  return [[view itemArray] valueForKey:@"representedObject"];
306  }
307 
308  return nil;
309 }
310 
315 - (CPArray)compoundTypes
316 {
317  if (_templateType == 2)
318  {
319  var view = [_views objectAtIndex:0];
320  return [[view itemArray] valueForKey:@"representedObject"];
321  }
322 
323  return nil;
324 }
325 
330 - (CPComparisonPredicateModifier)modifier
331 {
332  if (_templateType == 1)
333  return _predicateModifier;
334 
335  return nil;
336 }
337 
342 - (CPArray)operators
343 {
344  if (_templateType == 1)
345  {
346  var view = [_views objectAtIndex:1];
347  return [[view itemArray] valueForKey:@"representedObject"];
348  }
349 
350  return nil;
351 }
352 
357 - (int)options
358 {
359  if (_templateType == 1)
360  return _predicateOptions;
361 
362  return nil;
363 }
364 
370 {
371  return _rightAttributeType;
372 }
373 
378 - (CPAttributeType)leftExpressionAttributeType
379 {
380  return _leftAttributeType;
381 }
382 
384 + (id)_bestMatchForPredicate:(CPPredicate)predicate inTemplates:(CPArray)templates quality:(double)quality
385 {
386  var count = [templates count],
387  match_value = 0,
388  templateIndex = CPNotFound,
389  i;
390 
391  for (i = 0; i < count; i++)
392  {
393  var template = [templates objectAtIndex:i],
394  amatch = [template matchForPredicate:predicate];
395 
396  if (amatch > match_value)
397  {
398  templateIndex = i;
399  match_value = amatch;
400  }
401  }
402 
403  if (templateIndex == CPNotFound)
404  {
405  [CPException raise:CPRangeException reason:@"Unable to find template matching predicate: " + [predicate predicateFormat]];
406  return nil;
407  }
408 
409  return [templates objectAtIndex:templateIndex];
410 }
411 
412 - (void)_setCompoundPredicate:(CPCompoundPredicate)predicate
413 {
414  var left = [_views objectAtIndex:0],
415  type = [predicate compoundPredicateType],
416  index = [left indexOfItemWithRepresentedObject:type];
417 
418  [left selectItemAtIndex:index];
419 }
420 
421 - (void)_setComparisonPredicate:(CPComparisonPredicate)predicate
422 {
423  var left = [_views objectAtIndex:0],
424  middle = [_views objectAtIndex:1],
425  right = [_views objectAtIndex:2],
426  leftExpression = [predicate leftExpression],
427  rightExpression = [predicate rightExpression],
428  operator = [predicate predicateOperatorType];
429 
430  if (_leftIsWildcard)
431  [left setObjectValue:[leftExpression constantValue]];
432  else
433  {
434  var index = [left indexOfItemWithRepresentedObject:leftExpression];
435  [left selectItemAtIndex:index];
436  }
437 
438  var op_index = [middle indexOfItemWithRepresentedObject:operator];
439  [middle selectItemAtIndex:op_index];
440 
441  if (_rightIsWildcard)
442  [right setObjectValue:[rightExpression constantValue]];
443  else
444  {
445  var index = [right indexOfItemWithRepresentedObject:rightExpression];
446  [right selectItemAtIndex:index];
447  }
448 }
449 
450 - (CPExpression)_leftExpression
451 {
452  return [self _expressionFromView:_views[0] forAttributeType:_leftAttributeType];
453 }
454 
455 - (CPExpression)_rightExpression
456 {
457  return [self _expressionFromView:_views[2] forAttributeType:_rightAttributeType];
458 }
459 
460 - (CPExpression)_expressionFromView:(CPView)aView forAttributeType:(CPAttributeType)attributeType
461 {
462  if (attributeType == 0)
463  return [[aView selectedItem] representedObject];
464 
465  var value;
466  if (attributeType >= CPInteger16AttributeType && attributeType <= CPFloatAttributeType)
467  value = [aView floatValue];
468  else if (attributeType == CPBooleanAttributeType)
469  value = [aView state];
470  else if (attributeType == CPDateAttributeType)
471  value = [aView dateValue];
472  else
473  value = [aView stringValue];
474 
475  return [CPExpression expressionForConstantValue:value];
476 }
477 
478 - (int)_rowType
479 {
480  return (_templateType - 1);
481 }
482 
483 - (id)copy
484 {
485  var views = [CPArray array],
486  copy = [[[self class] alloc] init];
487 
488  [copy _setTemplateType:_templateType];
489  [copy _setOptions:_predicateOptions];
490  [copy _setModifier:_predicateModifier];
491  [copy _setLeftAttributeType:_leftAttributeType];
492  [copy _setRightAttributeType:_rightAttributeType];
493  [copy setLeftIsWildcard:_leftIsWildcard];
494  [copy setRightIsWildcard:_rightIsWildcard];
495 
496  [_views enumerateObjectsUsingBlock:function(aView, idx, stop)
497  {
498  var vcopy;
499 
500  if ([aView implementsSelector:@selector(copy)])
501  {
502  vcopy = [aView copy];
503  }
504  else
505  {
507  }
508 
509  [views addObject:vcopy];
510  }];
511 
512  [copy setTemplateViews:views];
513 
514  return copy;
515 }
516 
517 + (id)_operatorsForAttributeType:(CPAttributeType)attributeType
518 {
519  var operators_array = [CPMutableArray array];
520 
521  switch (attributeType)
522  {
523  case CPInteger16AttributeType : [operators_array addObjects:4,5,0,2,1,3];
524  break;
525  case CPInteger32AttributeType : [operators_array addObjects:4,5,0,2,1,3];
526  break;
527  case CPInteger64AttributeType : [operators_array addObjects:4,5,0,2,1,3];
528  break;
529  case CPDecimalAttributeType : [operators_array addObjects:4,5,0,2,1,3];
530  break;
531  case CPDoubleAttributeType : [operators_array addObjects:4,5,0,2,1,3];
532  break;
533  case CPFloatAttributeType : [operators_array addObjects:4,5,0,2,1,3];
534  break;
535  case CPStringAttributeType : [operators_array addObjects:99,4,5,8,9];
536  break;
537  case CPBooleanAttributeType : [operators_array addObjects:4,5];
538  break;
539  case CPDateAttributeType : [operators_array addObjects:4,5,0,2,1,3];
540  break;
541  default : CPLogConsole("Cannot create operators for an CPAttributeType " + attributeType);
542  break;
543  }
544 
545  return operators_array;
546 }
547 
548 - (int)_templateType
549 {
550  return _templateType;
551 }
552 
553 - (id)_displayValueForPredicateOperator:(int)operator
554 {
555  var value;
556 
557  switch (operator)
558  {
559  case CPLessThanPredicateOperatorType : value = @"is less than";
560  break;
561  case CPLessThanOrEqualToPredicateOperatorType : value = @"is less than or equal to";
562  break;
563  case CPGreaterThanPredicateOperatorType : value = @"is greater than";
564  break;
565  case CPGreaterThanOrEqualToPredicateOperatorType : value = @"is greater than or equal to";
566  break;
567  case CPEqualToPredicateOperatorType : value = @"is";
568  break;
569  case CPNotEqualToPredicateOperatorType : value = @"is not";
570  break;
571  case CPMatchesPredicateOperatorType : value = @"matches";
572  break;
573  case CPLikePredicateOperatorType : value = @"is like";
574  break;
575  case CPBeginsWithPredicateOperatorType : value = @"begins with";
576  break;
577  case CPEndsWithPredicateOperatorType : value = @"ends with";
578  break;
579  case CPInPredicateOperatorType : value = @"in";
580  break;
581  case CPContainsPredicateOperatorType : value = @"contains";
582  break;
583  case CPBetweenPredicateOperatorType : value = @"between";
584  break;
585  default : CPLogConsole(@"unknown predicate operator %d" + operator);
586  }
587 
588  return value;
589 }
590 
591 - (id)_displayValueForCompoundPredicateType:(unsigned int)predicateType
592 {
593  var value;
594  switch (predicateType)
595  {
596  case CPNotPredicateType: value = @"None";
597  break;
598  case CPAndPredicateType: value = @"All";
599  break;
600  case CPOrPredicateType: value = @"Any";
601  break;
602  default : value = [CPString stringWithFormat:@"unknown compound predicate type %d",predicateType];
603  }
604 
605  return value;
606 }
607 
608 - (id)_displayValueForConstantValue:(id)value
609 {
610  return [value description]; // number, date, string, ... localize
611 }
612 
613 - (id)_displayValueForKeyPath:(CPString)keyPath
614 {
615  return keyPath; // localize
616 }
617 
618 - (CPPopUpButton)_viewFromExpressions:(CPArray)expressions
619 {
620  var popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 100, 18)],
621  count = [expressions count];
622 
623  for (var i = 0; i < count; i++)
624  {
625  var exp = expressions[i],
626  type = [exp expressionType],
627  title;
628 
629  switch (type)
630  {
631  case CPKeyPathExpressionType: title = [self _displayValueForKeyPath:[exp keyPath]];
632  break;
633  case CPConstantValueExpressionType: title = [self _displayValueForConstantValue:[exp constantValue]];
634  break;
635  default: [CPException raise:CPInvalidArgumentException reason:@"Invalid Expression type " + type];
636  break;
637  }
638 
639  var item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
640  [item setRepresentedObject:exp];
641  [popup addItem:item];
642  }
643 
644  [popup sizeToFit];
645 
646  return popup;
647 }
648 
649 - (CPPopUpButton)_viewFromOperatorTypes:(CPArray)operators
650 {
651  var popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 100, 18)],
652  count = [operators count];
653 
654  for (var i = 0; i < count; i++)
655  {
656  var op = operators[i],
657  title = [self _displayValueForPredicateOperator:op],
658  item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
659 
660  [item setRepresentedObject:op];
661  [popup addItem:item];
662  }
663 
664  [popup sizeToFit];
665 
666  return popup;
667 }
668 
669 - (CPView)_viewFromCompoundTypes:(CPArray)compoundTypes
670 {
671  var popup = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0, 0, 100, 18)],
672  count = [compoundTypes count];
673 
674  for (var i = 0; i < count; i++)
675  {
676  var type = compoundTypes[i],
677  title = [self _displayValueForCompoundPredicateType:type],
678  item = [[CPMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""];
679 
680  [item setRepresentedObject:type];
681  [popup addItem:item];
682  }
683 
684  [popup sizeToFit];
685 
686  return popup;
687 }
688 
689 - (CPView)_viewFromAttributeType:(CPAttributeType)attributeType
690 {
691  var view;
692 
693  if (attributeType >= CPInteger16AttributeType && attributeType <= CPFloatAttributeType)
694  {
695  view = [self _textFieldWithFrame:CGRectMake(0, 0, 50, 26)];
696  }
697  else if (attributeType == CPStringAttributeType)
698  {
699  view = [self _textFieldWithFrame:CGRectMake(0, 0, 150, 26)];
700  }
701  else if (attributeType == CPBooleanAttributeType)
702  {
703  view = [[CPCheckBox alloc] initWithFrame:CGRectMake(0, 0, 50, 26)];
704  }
705  else if (attributeType == CPDateAttributeType)
706  {
707  view = [[CPDatePicker alloc] initWithFrame:CGRectMake(0, 0, 180, 26)];
708  [view setDatePickerElements:CPYearMonthDayDatePickerElementFlag];
709  }
710  else
711  return nil;
712 
713  [view setTag:attributeType];
714 
715  return view;
716 }
717 
718 - (CPTextField)_textFieldWithFrame:(CGRect)frame
719 {
720  var textField = [[CPTextField alloc] initWithFrame:frame];
721  [textField setBezeled:YES];
722  [textField setBezelStyle:CPTextFieldSquareBezel];
723  [textField setBordered:YES];
724  [textField setEditable:YES];
725  [textField setFont:[CPFont systemFontOfSize:10]];
726  [textField setSendsActionOnEndEditing:YES];
727 
728  return textField;
729 }
730 
731 - (void)_setOptions:(unsigned)options
732 {
733  _predicateOptions = options;
734 }
735 
736 - (void)_setModifier:(unsigned)modifier
737 {
738  _predicateModifier = modifier;
739 }
740 
742 {
743  if (_templateType == 2)
744  return [CPString stringWithFormat:@"<%@ %p %@>",[self className],self,[[self compoundTypes] componentsJoinedByString:@", "]];
745  else if (_templateType == 1 && _rightIsWildcard)
746  return [CPString stringWithFormat:@"<%@ %p [%@] [%@] %d>",[self className],self,[[self leftExpressions] componentsJoinedByString:@", "],[[self operators] componentsJoinedByString:@", "],[self rightExpressionAttributeType]];
747  else
748  return [CPString stringWithFormat:@"<%@ %p [%@] [%@] [%@]>",[self className],self,[[self leftExpressions] componentsJoinedByString:@", "],[[self operators] componentsJoinedByString:@", "],[[self rightExpressions] componentsJoinedByString:@", "]];
749 }
750 
751 /*
752 - (void)_setLeftExpressionObject:(id)object
753 {
754 }
755 - (void)_setRightExpressionObject:(id)object
756 {
757 }
758 - (BOOL)_predicateIsNoneAreTrue:(id)predicate
759 {
760 }
761 - (id)_viewFromExpressionObject:(id)object
762 {
763 }
764 */
765 @end
766 
767 var CPPredicateTemplateTypeKey = @"CPPredicateTemplateType",
768  CPPredicateTemplateOptionsKey = @"CPPredicateTemplateOptions",
769  CPPredicateTemplateModifierKey = @"CPPredicateTemplateModifier",
770  CPPredicateTemplateLeftAttributeTypeKey = @"CPPredicateTemplateLeftAttributeType",
771  CPPredicateTemplateRightAttributeTypeKey = @"CPPredicateTemplateRightAttributeType",
772  CPPredicateTemplateLeftIsWildcardKey = @"CPPredicateTemplateLeftIsWildcard",
773  CPPredicateTemplateRightIsWildcardKey = @"CPPredicateTemplateRightIsWildcard",
774  CPPredicateTemplateViewsKey = @"CPPredicateTemplateViews";
775 
776 @implementation CPPredicateEditorRowTemplate (CPCoding)
777 
778 - (id)initWithCoder:(CPCoder)coder
779 {
780  self = [super init];
781  if (self != nil)
782  {
783  _templateType = [coder decodeIntForKey:CPPredicateTemplateTypeKey];
784  _predicateOptions = [coder decodeIntForKey:CPPredicateTemplateOptionsKey];
785  _predicateModifier = [coder decodeIntForKey:CPPredicateTemplateModifierKey];
786  _leftAttributeType = [coder decodeIntForKey:CPPredicateTemplateLeftAttributeTypeKey];
787  _rightAttributeType = [coder decodeIntForKey:CPPredicateTemplateRightAttributeTypeKey];
788  _leftIsWildcard = [coder decodeBoolForKey:CPPredicateTemplateLeftIsWildcardKey];
789  _rightIsWildcard = [coder decodeBoolForKey:CPPredicateTemplateRightIsWildcardKey];
790  _views = [coder decodeObjectForKey:CPPredicateTemplateViewsKey];
791 
792  // In Xcode 4, when the menu item title == template's expression keypath, representedObject is empty.
793  // So we need to regenerate expressions from titles.
794  if (_templateType == 1 && _leftIsWildcard == NO)
795  {
796  var itemArray = [_views[0] itemArray],
797  count = [itemArray count];
798 
799  for (var i = 0; i < count; i++)
800  {
801  var item = itemArray[i];
802  if ([item representedObject] == nil)
803  {
804  var exp = [CPExpression expressionForKeyPath:[item title]];
805  [item setRepresentedObject:exp];
806  }
807  }
808  }
809  }
810 
811  return self;
812 }
813 
814 - (void)encodeWithCoder:(CPCoder)coder
815 {
816  [coder encodeInt:_templateType forKey:CPPredicateTemplateTypeKey];
817  [coder encodeInt:_predicateOptions forKey:CPPredicateTemplateOptionsKey];
818  [coder encodeInt:_predicateModifier forKey:CPPredicateTemplateModifierKey];
819  [coder encodeInt:_leftAttributeType forKey:CPPredicateTemplateLeftAttributeTypeKey];
820  [coder encodeInt:_rightAttributeType forKey:CPPredicateTemplateRightAttributeTypeKey];
821  [coder encodeBool:_leftIsWildcard forKey:CPPredicateTemplateLeftIsWildcardKey];
822  [coder encodeBool:_rightIsWildcard forKey:CPPredicateTemplateRightIsWildcardKey];
823  [coder encodeObject:_views forKey:CPPredicateTemplateViewsKey];
824 }
825 
826 @end
827 
828 // Copy support for built-in types
829 @implementation CPDatePicker (CPCopying)
830 
831 - (id)copy
832 {
833  var ret = [[[self class] alloc] initWithFrame:[self frame]];
834 
835  [ret setTextFont:[self textFont]];
836  [ret setMinDate:[self minDate]];
837  [ret setMaxDate:[self maxDate]];
838  [ret setTimeInterval:[self timeInterval]];
839  [ret setDatePickerMode:[self datePickerMode]];
840  [ret setDatePickerElements:[self datePickerElements]];
841  [ret setDatePickerStyle:[self datePickerStyle]];
842  [ret setLocale:[self locale]];
843  [ret setDateValue:[self dateValue]];
844  [ret setBackgroundColor:[self backgroundColor]];
845  [ret setDrawsBackground:[self drawsBackground]];
846  [ret setBordered:[self isBordered]];
847  [ret _init];
848 
849  return ret;
850 }
851 
852 @end
855 @implementation CPPredicateEditorRowTemplate (CPSynthesizedAccessors)
856 
857 
860 - (int)_templateType
861 {
862  return _templateType;
863 }
864 
868 - (void)_setTemplateType:(int)aValue
869 {
870  _templateType = aValue;
871 }
872 
876 - (void)_setOptions:(unsigned)aValue
877 {
878  _predicateOptions = aValue;
879 }
880 
884 - (void)_setModifier:(unsigned)aValue
885 {
886  _predicateModifier = aValue;
887 }
888 
892 - (unsigned)leftAttributeType
893 {
894  return _leftAttributeType;
895 }
896 
900 - (void)_setLeftAttributeType:(unsigned)aValue
901 {
902  _leftAttributeType = aValue;
903 }
904 
908 - (unsigned)rightAttributeType
909 {
910  return _rightAttributeType;
911 }
912 
916 - (void)_setRightAttributeType:(unsigned)aValue
917 {
918  _rightAttributeType = aValue;
919 }
920 
924 - (BOOL)leftIsWildcard
925 {
926  return _leftIsWildcard;
927 }
928 
932 - (void)setLeftIsWildcard:(BOOL)aValue
933 {
934  _leftIsWildcard = aValue;
935 }
936 
940 - (BOOL)rightIsWildcard
941 {
942  return _rightIsWildcard;
943 }
944 
948 - (void)setRightIsWildcard:(BOOL)aValue
949 {
950  _rightIsWildcard = aValue;
951 }
952 
956 - (void)setTemplateViews:(CPArray)aValue
957 {
958  _views = aValue;
959 }
960 
961 @end
Used to implement exception handling (creating & raising).
Definition: CPException.h:2
Definition: CPFont.h:2
A CALayer is similar to a CPView
Definition: CALayer.j:46
CGRect frame
CPFont systemFontOfSize:(CGSize aSize)
Definition: CPFont.j:282
CPString className()
Definition: CPObject.j:527
CPComparisonPredicateModifier modifier()
Returns the comparison predicate modifier for the receiver.
void raise:reason:(CPString aName, [reason] CPString aReason)
Definition: CPException.j:66
CPArray operators()
Returns Returns the array of operators for the receiver.
Unarchives objects created using CPKeyedArchiver.
int options()
Returns the comparison predicate options for the receiver.
CPString description()
Definition: CPObject.j:358
CPCompoundPredicate is a subclass of CPPredicate used to represent logical “gate” operations (AND/O...
Implements keyed archiving of object graphs (e.g. for storing data).
An immutable string (collection of characters).
Definition: CPString.h:2
CPAttributeType rightExpressionAttributeType()
Returns the attribute type of the receiver’s right expression.
CPArray rightExpressions()
Returns the right hand expressions for the receiver.
id copy()
Definition: CPObject.j:154
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
CPNotFound
Definition: CPObjJRuntime.j:62
CPAttributeType leftExpressionAttributeType()
Returns the attribute type of the receiver’s left expression.
CPComparisonPredicate is a subclass of CPPredicate used to compare expressions.
id unarchiveObjectWithData:(CPData aData)
id init()
Definition: CPObject.j:145
CPPredicate predicateWithLeftExpression:rightExpression:modifier:type:options:(CPExpression left, [rightExpression] CPExpression right, [modifier] CPComparisonPredicateModifier modifier, [type] int type, [options] unsigned options)
id initWithTitle:action:keyEquivalent:(CPString aTitle, [action] SEL anAction, [keyEquivalent] CPString aKeyEquivalent)
Definition: CPMenuItem.j:121
CPLessThanOrEqualToPredicateOperatorType
Class class()
Definition: CPObject.j:179
CPGreaterThanOrEqualToPredicateOperatorType
CPArray compoundTypes()
Returns the compound predicate types for the receiver.
CPArray templateViews()
Returns the views for the receiver.
CPArray leftExpressions()
Returns the left hand expressions for the receiver.
id alloc()
Definition: CPObject.j:130
Definition: CPView.j:136
CPData archivedDataWithRootObject:(id anObject)
id stringWithFormat:(CPString format, [,] ...)
Definition: CPString.j:166