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
;
19 internal enum VertexColor
23 /// The node has not been visited yet
27 /// This node is in the process of being visited
31 /// This now was visited
37 /// Represents a collection of objects
38 /// which are guaranted to be unique
39 /// and holds a color for them
41 internal class ColorsSet
43 private Hashtable items
= new Hashtable();
45 public ColorsSet(IVertex
[] items
)
47 foreach(IVertex item
in items
)
49 Set(item
, VertexColor
.White
);
53 public void Set(IVertex item
, VertexColor color
)
58 public VertexColor
ColorOf(IVertex item
)
60 if (!items
.ContainsKey(item
)) return VertexColor
.NotInThisSet
;
61 return (VertexColor
) items
[item
];
66 /// Holds a timestamp (integer)
69 internal class TimestampSet
71 private Hashtable items
= new Hashtable();
77 public void Register(IVertex item
, int time
)
82 public int TimeOf(IVertex item
)
84 return (int) items
[item
];