-
Notifications
You must be signed in to change notification settings - Fork 0
/
MPWConstraintFormula.m
74 lines (58 loc) · 1.24 KB
/
MPWConstraintFormula.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// MPWConstraintFormula.m
// DeltaBlue
//
// Created by Marcel Weiher on 06/06/2005.
// Copyright 2005 __MyCompanyName__. All rights reserved.
//
#import "MPWConstraintFormula.h"
#import <ObjectiveSmalltalk/MPWExpression.h>
#import <MPWFoundation/AccessorMacros.h>
@implementation MPWConstraintFormula
idAccessor( source, setSource )
idAccessor( compiled, setCompiled )
//boolAccessor( evaluated, setEvaluated )
-initWithSource:aFormula compiled:aCompiledScript
{
self = [super init];
[self setSource:aFormula];
[self setCompiled:aCompiledScript];
return self;
}
+formulaWithSource:aFormula compiled:aCompiledScript
{
return [[[self alloc] initWithSource:aFormula compiled:aCompiledScript] autorelease];
}
-evaluateIn:anEvaluator
{
id value = [compiled evaluateIn:anEvaluator];
// [anEvaluator markChanged:[compiled variablesWritten]];
return value;
}
-variablesWritten
{
return [compiled variablesWritten];
}
-sourceVariables
{
return [compiled variablesRead];
}
-compileIn:compiler
{
return self;
}
-(void)dealloc
{
[compiled release];
[source release];
[super dealloc];
}
-copyWithZone:aZone
{
return self;
}
-(int)isInterestedInVariables:(NSSet*)variables
{
return [[self sourceVariables] intersectsSet:variables];
}
@end