Added container accessor to Castle.Core
[castle.git] / AspectSharp / AspectSharp.Lang / AST / PointCutDefinition.cs
blob9577b7e0aa5234e182777e03158b539ead8a4a31
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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.
15 namespace AspectSharp.Lang.AST
17 using System;
19 [Flags]
20 public enum PointCutFlags
22 Unspecified,
23 Method = 1,
24 Property = 2,
25 PropertyRead = 4,
26 PropertyWrite = 8,
29 /// <summary>
30 /// Summary description for PointCutDefinition.
31 /// </summary>
32 [Serializable]
33 public class PointCutDefinition : NodeBase
35 private MethodSignature _targetMethod = AllMethodSignature.Instance;
36 private InterceptorDefinitionCollection _advices = new InterceptorDefinitionCollection();
37 private PointCutFlags _flags;
39 public PointCutDefinition(LexicalInfo info, PointCutFlags flags) : base(info)
41 _flags = flags;
44 public MethodSignature Method
46 get { return _targetMethod; }
47 set { _targetMethod = value; }
50 public PointCutFlags Flags
52 get { return _flags; }
55 public InterceptorDefinitionCollection Advices
57 get { return _advices; }
60 public override bool Equals(object other)
62 PointCutDefinition otherCut = other as PointCutDefinition;
64 if (otherCut == null)
66 return false;
69 if (otherCut.Flags.Equals( Flags ) &&
70 otherCut.Method.Equals( Method ))
72 return true;
75 return false;
78 public override int GetHashCode()
80 // Doh!!
81 return ((int) _flags) ^ Method.GetHashCode();
84 public override void Accept(IVisitor visitor)
86 visitor.OnPointCutDefinition(this);