1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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 Castle
.Core
.Internal
17 using System
.Collections
;
18 using System
.Collections
.Generic
;
20 internal enum VertexColor
24 /// The node has not been visited yet
28 /// This node is in the process of being visited
32 /// This now was visited
38 /// Represents a collection of objects
39 /// which are guaranted to be unique
40 /// and holds a color for them
42 internal class ColorsSet
44 private IDictionary
<IVertex
, VertexColor
> items
= new Dictionary
<IVertex
, VertexColor
>();
46 public ColorsSet(IVertex
[] items
)
48 foreach(IVertex item
in items
)
50 Set(item
, VertexColor
.White
);
54 public void Set(IVertex item
, VertexColor color
)
59 public VertexColor
ColorOf(IVertex item
)
61 if (!items
.ContainsKey(item
)) return VertexColor
.NotInThisSet
;
62 return (VertexColor
) items
[item
];
67 /// Holds a timestamp (integer)
70 internal class TimestampSet
72 private IDictionary
<IVertex
, int> items
= new Dictionary
<IVertex
, int>();
78 public void Register(IVertex item
, int time
)
83 public int TimeOf(IVertex item
)
85 return (int) items
[item
];