当前位置: 首页>>代码示例>>C++>>正文


C++ SymbolSet::IsElement方法代码示例

本文整理汇总了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;
}
开发者ID:greenscar,项目名称:scripts,代码行数:21,代码来源:set.cpp

示例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;
}
开发者ID:greenscar,项目名称:scripts,代码行数:27,代码来源:set.cpp

示例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);
    }
}
开发者ID:prog012,项目名称:jikes,代码行数:66,代码来源:incrmnt.cpp


注:本文中的SymbolSet::IsElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。