本文整理汇总了Java中com.fujitsu.vdmj.tc.lex.TCNameList.add方法的典型用法代码示例。如果您正苦于以下问题:Java TCNameList.add方法的具体用法?Java TCNameList.add怎么用?Java TCNameList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fujitsu.vdmj.tc.lex.TCNameList
的用法示例。
在下文中一共展示了TCNameList.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllVariableNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
@Override
public TCNameList getAllVariableNames()
{
TCNameList list = new TCNameList();
list.add(name);
return list;
}
示例2: getVariableNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
@Override
public TCNameList getVariableNames()
{
TCNameList names = new TCNameList();
for (TCField field: fields)
{
names.add(field.tagname);
}
return names;
}
示例3: getVariableNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
@Override
public TCNameList getVariableNames()
{
TCNameList names = new TCNameList();
for (TCNameToken vn: superdef.getVariableNames())
{
names.add(vn.getModifiedName(name.getModule()));
}
return names;
}
示例4: getVariableNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
@Override
public TCNameList getVariableNames()
{
TCNameList both = new TCNameList(name);
both.add(def.name);
return both;
}
示例5: getOverloadNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
public TCNameList getOverloadNames(TCNameToken name)
{
TCNameList list = new TCNameList();
for (Entry<TCNameToken, Value> entry: this.entrySet())
{
if (entry.getKey().matches(name)) // All overloaded names
{
list.add(entry.getKey());
}
}
return list;
}
示例6: getVariableNames
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
@Override
public TCNameList getVariableNames()
{
TCNameList names = new TCNameList();
checkSuperDefinition();
for (TCNameToken vn: superdef.getVariableNames())
{
names.add(vn.getModifiedName(name.getModule()));
}
return names;
}
示例7: checkComposeTypes
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
/**
* Check that the compose types that are referred to in a type have a matching
* definition in the environment. The method returns a list of types that do not
* exist if the newTypes parameter is passed.
*/
public static TCTypeList checkComposeTypes(TCType type, Environment env, boolean newTypes)
{
TCTypeList undefined = new TCTypeList();
for (TCType compose: type.getComposeTypes())
{
TCRecordType composeType = (TCRecordType)compose;
TCDefinition existing = env.findType(composeType.name, null);
if (existing != null)
{
// If the type is already defined, check that it has the same shape and
// does not have an invariant (which cannot match a compose definition).
boolean matches = false;
if (existing instanceof TCTypeDefinition)
{
TCTypeDefinition edef = (TCTypeDefinition)existing;
TCType etype = existing.getType();
if (edef.invExpression == null && etype instanceof TCRecordType)
{
TCRecordType retype = (TCRecordType)etype;
if (retype.fields.equals(composeType.fields))
{
matches = true;
}
}
}
if (!matches)
{
TypeChecker.report(3325, "Mismatched compose definitions for " + composeType.name, composeType.location);
TypeChecker.detail2(composeType.name.getName(), composeType.location, existing.name.getName(), existing.location);
}
}
else
{
if (newTypes)
{
undefined.add(composeType);
}
else
{
TypeChecker.report(3113, "Unknown type name '" + composeType.name + "'", composeType.location);
}
}
}
// Lastly, check that the compose types extracted are compatible
TCNameList done = new TCNameList();
for (TCType c1: undefined)
{
for (TCType c2: undefined)
{
if (c1 != c2)
{
TCRecordType r1 = (TCRecordType)c1;
TCRecordType r2 = (TCRecordType)c2;
if (r1.name.equals(r2.name) && !done.contains(r1.name) && !r1.fields.equals(r2.fields))
{
TypeChecker.report(3325, "Mismatched compose definitions for " + r1.name, r1.location);
TypeChecker.detail2(r1.name.getName(), r1.location, r2.name.getName(), r2.location);
done.add(r1.name);
}
}
}
}
return undefined;
}
示例8: dupHideCheck
import com.fujitsu.vdmj.tc.lex.TCNameList; //导入方法依赖的package包/类
/**
* Check whether the list of definitions passed contains any duplicates,
* or whether any names in the list hide the same name further down the
* environment chain.
*
* @param list The list of definitions to check.
*/
protected void dupHideCheck(TCDefinitionList list, NameScope scope)
{
TCNameList allnames = list.getVariableNames();
for (TCNameToken n1: allnames)
{
TCNameList done = new TCNameList();
for (TCNameToken n2: allnames)
{
if (n1 != n2 && n1.equals(n2) && !done.contains(n1))
{
TypeChecker.warning(5007, "Duplicate definition: " + n1, n1.getLocation());
done.add(n1);
}
}
if (outer != null)
{
// We search for any scoped name (ie. the first), but then check
// the scope matches what we can see. If we pass scope to findName
// it throws errors if the name does not match the scope.
TCDefinition def = outer.findName(n1, NameScope.NAMESANDSTATE);
if (def != null && def.location != n1.getLocation() &&
def.nameScope.matches(scope))
{
// Reduce clutter for names in the same module/class
String message = null;
if (def.location.file.equals(n1.getLocation().file))
{
message = def.name.getName() + " " + def.location.toShortString() +
" hidden by " + n1.toString();
}
else
{
message = def.name.getName() + " " + def.location +
" hidden by " + n1.toString();
}
TypeChecker.warning(5008, message, n1.getLocation());
}
}
}
}