00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 @import <Foundation/CPObject.j>
00024 @import <Foundation/CPKeyValueCoding.j>
00025
00026
00027 var _CPCibConnectorSourceKey = @"_CPCibConnectorSourceKey",
00028 _CPCibConnectorDestinationKey = @"_CPCibConnectorDestinationKey",
00029 _CPCibConnectorLabelKey = @"_CPCibConnectorLabelKey";
00030
00031 @implementation CPCibConnector : CPObject
00032 {
00033 id _source @accessors(property=source);
00034 id _destination @accessors(property=destination);
00035 CPString _label @accessors(property=label);
00036 }
00037
00038 - (void)replaceObject:(id)anObject withObject:(id)anotherObject
00039 {
00040 if (_source === anObject)
00041 _source = anotherObject;
00042
00043 if (_destination === anObject)
00044 _destination = anotherObject;
00045 }
00046
00047 - (void)replaceObjects:(Object)replacementObjects
00048 {
00049 var replacement = replacementObjects[[_source UID]];
00050
00051 if (replacement !== undefined)
00052 _source = replacement;
00053
00054 replacement = replacementObjects[[_destination UID]];
00055
00056 if (replacement !== undefined)
00057 _destination = replacement;
00058 }
00059
00060 @end
00061
00062 @implementation CPCibConnector (CPCoding)
00063
00064 - (id)initWithCoder:(CPCoder)aCoder
00065 {
00066 self = [super init];
00067
00068 if (self)
00069 {
00070 _source = [aCoder decodeObjectForKey:_CPCibConnectorSourceKey];
00071 _destination = [aCoder decodeObjectForKey:_CPCibConnectorDestinationKey];
00072 _label = [aCoder decodeObjectForKey:_CPCibConnectorLabelKey];
00073 }
00074
00075 return self;
00076 }
00077
00078 - (void)encodeWithCoder:(CPCoder)aCoder
00079 {
00080 [aCoder encodeObject:_source forKey:_CPCibConnectorSourceKey];
00081 [aCoder encodeObject:_destination forKey:_CPCibConnectorDestinationKey];
00082 [aCoder encodeObject:_label forKey:_CPCibConnectorLabelKey];
00083 }
00084
00085 @end
00086
00087
00088 @implementation _CPCibConnector : CPCibConnector { } @end