本文整理汇总了C++中SymbolSet::IsElement方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolSet::IsElement方法的具体用法?C++ SymbolSet::IsElement怎么用?C++ SymbolSet::IsElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolSet
的用法示例。
在下文中一共展示了SymbolSet::IsElement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool SymbolSet::operator==(SymbolSet& rhs)
{
if (this != &rhs)
{
if (symbol_pool.Length() != rhs.symbol_pool.Length())
return false;
for (int i = 0; i < symbol_pool.Length(); i++)
{
ShadowSymbol *shadow = symbol_pool[i];
Symbol *symbol = shadow -> symbol;
for (int k = 0; symbol; symbol = (Symbol *) (k < shadow -> NumConflicts() ? shadow -> Conflict(k++) : NULL))
{
if (! rhs.IsElement(symbol))
return false;
}
}
}
return true;
}
示例2: Intersection
//
// Intersect the set in question with the set passed as argument: "set"
//
void SymbolSet::Intersection(SymbolSet &set)
{
if (this != &set)
{
Tuple<Symbol *> old_symbol_pool(this -> symbol_pool.Length());
for (int i = 0; i < this -> symbol_pool.Length(); i++)
{
ShadowSymbol *shadow = this -> symbol_pool[i];
Symbol *symbol = shadow -> symbol;
for (int k = 0; symbol; symbol = (Symbol *) (k < shadow -> NumConflicts() ? shadow -> Conflict(k++) : NULL))
old_symbol_pool.Next() = symbol;
}
this -> SetEmpty();
for (int j = 0; j < old_symbol_pool.Length(); j++)
{
if (set.IsElement(old_symbol_pool[j]))
AddElement(old_symbol_pool[j]);
}
}
return;
}
示例3: RemoveTrashedTypes
void Control::RemoveTrashedTypes(SymbolSet& type_trash_set)
{
TypeSymbol* type;
//
// For each type T that is going to be trashed, and for each parent P of T
// that is not itself being trashed, remove T from the set of dependents of
// P. If T is a subtype of P it is also removed from the subtypes set.
//
for (type = (TypeSymbol*) type_trash_set.FirstElement();
type; type = (TypeSymbol*) type_trash_set.NextElement())
{
TypeSymbol* parent;
for (parent = (TypeSymbol*) type -> static_parents -> FirstElement();
parent;
parent = (TypeSymbol*) type -> static_parents -> NextElement())
{
if (! type_trash_set.IsElement(parent))
{
parent -> dependents -> RemoveElement(type);
parent -> subtypes -> RemoveElement(type);
}
}
for (parent = (TypeSymbol*) type -> parents -> FirstElement();
parent;
parent = (TypeSymbol*) type -> parents -> NextElement())
{
if (! type_trash_set.IsElement(parent))
{
parent -> dependents -> RemoveElement(type);
parent -> subtypes -> RemoveElement(type);
}
}
}
//
// We can now safely delete the type.
//
for (type = (TypeSymbol*) type_trash_set.FirstElement();
type; type = (TypeSymbol*) type_trash_set.NextElement())
{
PackageSymbol* package = type -> ContainingPackage();
//
// If a type that is about to be trashed was read in via a class file,
// remove the class file. Note that invoking RemoveElement for a file
// that it does not contain has no ill effect.
//
FileSymbol* file_symbol = type -> file_symbol;
if (file_symbol && type -> Identity() == file_symbol -> Identity())
input_class_file_set.RemoveElement(file_symbol);
//
// If a type that is about to be trashed was contained in the
// unnamed_package, remove it from the set "unnamed_package_types"
//
if (package == unnamed_package)
unnamed_package_types.RemoveElement(type);
//
// Remove the type from its containing package.
//
package -> DeleteTypeSymbol(type);
}
}