當前位置: 首頁>>代碼示例>>Java>>正文


Java Environment.isFunctional方法代碼示例

本文整理匯總了Java中com.fujitsu.vdmj.typechecker.Environment.isFunctional方法的典型用法代碼示例。如果您正苦於以下問題:Java Environment.isFunctional方法的具體用法?Java Environment.isFunctional怎麽用?Java Environment.isFunctional使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.fujitsu.vdmj.typechecker.Environment的用法示例。


在下文中一共展示了Environment.isFunctional方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
private void typeCheck(Environment base)
{
	// Check whether the field access is permitted from here.
	TCClassType cls = type.getClassType(base);

	for (TCNamePatternPair npp: fieldlist)
	{
		TCDefinition fdef = cls.findName(npp.name, NameScope.STATE);

		if (fdef == null)
		{
			npp.name.report(3091, "Unknown member " + npp.name + " of class " + cls.name.getName());
		}
		else if (!TCClassDefinition.isAccessible(base, fdef, false))
		{
			npp.name.report(3092, "Inaccessible member " + npp.name + " of class " + cls.name.getName());
		}
	}

	if (base.isFunctional())
	{
		report(3332, "Object pattern cannot be used from a function");
	}
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:25,代碼來源:TCObjectPattern.java

示例2: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
	TCDefinition encl = env.getEnclosingDefinition();
	
	if (encl != null && encl.isPure())
	{
		report(3346, "Cannot use 'time' in pure operations");
	}
	
	if (Settings.release == Release.VDM_10 && env.isFunctional())
	{
		report(3348, "Cannot use 'time' in a functional context");
	}

	return checkConstraint(constraint, new TCNaturalType(location));
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:18,代碼來源:TCTimeExpression.java

示例3: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
	TCDefinition encl = env.getEnclosingDefinition();
	
	if (encl != null && encl.isPure())
	{
		report(3346, "Cannot use 'threadid' in pure operations");
	}

	if (Settings.release == Release.VDM_10 && env.isFunctional())
	{
		report(3348, "Cannot use 'threadid' in a functional context");
	}

	return checkConstraint(constraint, new TCNaturalType(location));
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:18,代碼來源:TCThreadIdExpression.java

示例4: typeCheck

import com.fujitsu.vdmj.typechecker.Environment; //導入方法依賴的package包/類
@Override
public TCType typeCheck(Environment env, TCTypeList qualifiers, NameScope scope, TCType constraint)
{
	TCDefinition cdef = env.findType(classname.getClassName(), null);

	if (cdef == null || !(cdef instanceof TCClassDefinition))
	{
		report(3133, "Class name " + classname + " not in scope");
		return new TCUnknownType(location);
	}
	
	if (Settings.release == Release.VDM_10 && env.isFunctional())
	{
		report(3348, "Cannot use 'new' in a functional context");
	}

	classdef = (TCClassDefinition)cdef;

	if (classdef instanceof TCSystemDefinition)
	{
		report(3279, "Cannot instantiate system class " + classdef.name);
	}
	
	if (classdef.isAbstract)
	{
		report(3330, "Cannot instantiate abstract class " + classdef.name);
		
		for (TCDefinition d: classdef.getLocalDefinitions())
		{
			if (d.isSubclassResponsibility())
			{
				detail("Unimplemented", d.name.getName() + d.getType());
			}
		}
	}

	TCTypeList argtypes = new TCTypeList();

	for (TCExpression a: args)
	{
		argtypes.add(a.typeCheck(env, null, scope, null));
	}

	TCDefinition opdef = classdef.findConstructor(argtypes);

	if (opdef == null)
	{
		if (!args.isEmpty())	// Not having a default ctor is OK
   		{
   			report(3134, "Class has no constructor with these parameter types");
   			detail("Called", classdef.getCtorName(argtypes));
   		}
		else if (classdef instanceof TCCPUClassDefinition ||
				 classdef instanceof TCBUSClassDefinition)
		{
			report(3297, "Cannot use default constructor for this class");
		}
	}
	else
	{
		if (!opdef.isCallableOperation())
   		{
   			report(3135, "Class has no constructor with these parameter types");
   			detail("Called", classdef.getCtorName(argtypes));
   		}
		else if (!TCClassDefinition.isAccessible(env, opdef, false))
		{
   			report(3292, "Constructor is not accessible");
   			detail("Called", classdef.getCtorName(argtypes));
		}
		else
		{
			ctordef = opdef;
		}
	}

	return checkConstraint(constraint, classdef.getType());
}
 
開發者ID:nickbattle,項目名稱:FJ-VDMJ,代碼行數:79,代碼來源:TCNewExpression.java


注:本文中的com.fujitsu.vdmj.typechecker.Environment.isFunctional方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。