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


Java CheckType.FAST属性代码示例

本文整理汇总了Java中org.eclipse.xtext.validation.CheckType.FAST属性的典型用法代码示例。如果您正苦于以下问题:Java CheckType.FAST属性的具体用法?Java CheckType.FAST怎么用?Java CheckType.FAST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.xtext.validation.CheckType的用法示例。


在下文中一共展示了CheckType.FAST属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkPinAssignQualifiers

@Check(CheckType.FAST)
public void checkPinAssignQualifiers(PinAssign p) {
	Instance i = (Instance) p.eContainer();
	if (i.getArray().isArray()) {
		if (p.getQualifier() != null) {
			if (p.getQualifier().getIndices().isArray()) {
				if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), p.getQualifier()
						.getIndices().getMsb()))
					invalidMsbError(p.getQualifier().getIndices(), PhdlPackage.Literals.INDICES__MSB);
				if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), p.getQualifier()
						.getIndices().getLsb()))
					invalidLsbError(p.getQualifier().getIndices(), PhdlPackage.Literals.INDICES__LSB);
			} else {
				for (Integer index : p.getQualifier().getIndices().getIndices())
					if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), index))
						invalidIndexError(p.getQualifier().getIndices(), p.getQualifier().getIndices().getIndices()
								.indexOf(index), PhdlPackage.Literals.INDICES__INDICES);
			}
		}
	} else {
		if (p.getQualifier() != null)
			qualifierNotAllowedError(p, PhdlPackage.Literals.PIN_ASSIGN__QUALIFIER);
	}
}
 
开发者ID:timofonic,项目名称:PHDL,代码行数:24,代码来源:PhdlJavaValidator.java

示例2: checkDevicePinDeclarations

@Check(CheckType.FAST)
public void checkDevicePinDeclarations(Device d) {
	for (DeviceElement element : d.getElements()) {
		if (element instanceof Pin) {
			Pin p = (Pin) element;
			int index = d.getElements().indexOf(p);
			int width = (Math.abs(p.getVector().getMsb() - p.getVector().getLsb())) + 1;
			if (width != p.getPinNames().size())
				error("Pin declaration width mismatch.  Left=" + width + ", right=" + p.getPinNames().size() + ".",
						d, PhdlPackage.Literals.DEVICE__ELEMENTS, d.getElements().indexOf(element),
						IssueCodes.INVALID_PIN_DECLARATION, Integer.toString(index),
						Boolean.toString(p.getVector().isVector()), Integer.toString(width),
						Integer.toString(p.getPinNames().size()));
		}
	}
}
 
开发者ID:timofonic,项目名称:PHDL,代码行数:16,代码来源:PhdlJavaValidator.java

示例3: checkUnusedEntry

@Check(CheckType.FAST)
public void checkUnusedEntry(final Entry entry) {
	if (entry.getParentRegion().getComposite() instanceof org.yakindu.sct.model.sgraph.State
			&& entry.getIncomingTransitions().isEmpty()) {
		org.yakindu.sct.model.sgraph.State state = (org.yakindu.sct.model.sgraph.State) entry.getParentRegion()
				.getComposite();
		if (!STextValidationModelUtils.isDefault(entry)) {
			boolean hasIncomingTransition = false;
			Iterator<Transition> transitionIt = state.getIncomingTransitions().iterator();
			while (transitionIt.hasNext() && !hasIncomingTransition) {
				Iterator<ReactionProperty> propertyIt = transitionIt.next().getProperties().iterator();
				while (propertyIt.hasNext() && !hasIncomingTransition) {
					ReactionProperty property = propertyIt.next();
					if (property instanceof EntryPointSpec) {
						hasIncomingTransition = entry.getName().equals(((EntryPointSpec) property).getEntrypoint());
					}
				}
			}
			if (!hasIncomingTransition) {
				warning(ENTRY_UNUSED, entry, null, -1);
			}
		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:24,代码来源:STextJavaValidator.java

示例4: checkDeviceRequiredAttributes

@Check(CheckType.FAST)
public void checkDeviceRequiredAttributes(Device d) {
	for (String reqAttr : reqAttrs) {
		boolean found = false;
		for (DeviceElement element : d.getElements()) {
			if (element instanceof Attr) {
				Attr a = (Attr) element;
				if (a.getName().equalsIgnoreCase(reqAttr)) {
					found = true;
					break;
				}
			}
		}
		if (!found) {
			error("Required attribute '" + reqAttr + "' missing.", d, PhdlPackage.Literals.DEVICE__NAME, -1,
					IssueCodes.REQUIRED_ATTRIBUTE_MISSING, reqAttr);
		}
	}
}
 
开发者ID:timofonic,项目名称:PHDL,代码行数:19,代码来源:PhdlJavaValidator.java

示例5: checkValueOfNoEvent

@Check(CheckType.FAST)
public void checkValueOfNoEvent(EventValueReferenceExpression exp) {

	Expression eventExpr = exp.getValue();

	EObject element = null;
	if (eventExpr instanceof ElementReferenceExpression) {
		element = ((ElementReferenceExpression) eventExpr).getReference();
	} else if (eventExpr instanceof FeatureCall) {
		element = ((FeatureCall) eventExpr).getFeature();
	}

	if (element != null && (!(element instanceof Event))) {
		String elementName = "";
		if (element instanceof NamedElement) {
			elementName = "'" + ((NamedElement) element).getName() + "' ";
		}
		error(elementName + "is no event.", StextPackage.Literals.EVENT_VALUE_REFERENCE_EXPRESSION__VALUE, 0,
				VALUE_OF_REQUIRES_EVENT);
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:21,代码来源:STextJavaValidator.java

示例6: checkAnnotationTarget

@Check(CheckType.FAST)
public void checkAnnotationTarget(final AnnotatableElement element) {
	EList<Annotation> annotations = element.getAnnotations();
	for (Annotation annotation : annotations) {
		EList<EObject> targets = annotation.getType().getTargets();
		if(targets.isEmpty())
			continue;
		boolean found = Iterables.any(targets, new Predicate<EObject>() {
			@Override
			public boolean apply(EObject input) {
				return ((EClass) input).isInstance(element);
			}
		});
		if (!found) {
			error(String.format(ERROR_WRONG_ANNOTATION_TARGET_MSG, annotation.getType().getName(),
					element.eClass()), null,
					element.getAnnotations().indexOf(annotation), ERROR_WRONG_ANNOTATION_TARGET_CODE);
		}
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:20,代码来源:ExpressionsJavaValidator.java

示例7: checkPortAssignQualifiers

@Check(CheckType.FAST)
public void checkPortAssignQualifiers(PortAssign p) {
	Instance i = (Instance) p.eContainer();
	if (i.getArray().isArray()) {
		if (p.getQualifier() != null) {
			if (p.getQualifier().getIndices().isArray()) {
				if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), p.getQualifier()
						.getIndices().getMsb()))
					invalidMsbError(p.getQualifier().getIndices(), PhdlPackage.Literals.INDICES__MSB);
				if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), p.getQualifier()
						.getIndices().getLsb()))
					invalidLsbError(p.getQualifier().getIndices(), PhdlPackage.Literals.INDICES__LSB);
			} else {
				for (Integer index : p.getQualifier().getIndices().getIndices())
					if (!PhdlUtils.isValidIndex(i.getArray().getMsb(), i.getArray().getLsb(), index))
						invalidIndexError(p.getQualifier().getIndices(), p.getQualifier().getIndices().getIndices()
								.indexOf(index), PhdlPackage.Literals.INDICES__INDICES);
			}
		}
	} else {
		if (p.getQualifier() != null)
			qualifierNotAllowedError(p, PhdlPackage.Literals.PORT_ASSIGN__QUALIFIER);
	}
}
 
开发者ID:timofonic,项目名称:PHDL,代码行数:24,代码来源:PhdlJavaValidator.java

示例8: checkDevicePhysicalPinNames

@Check(CheckType.FAST)
public void checkDevicePhysicalPinNames(Device d) {
	Map<String, Pin> pinMap = new HashMap<String, Pin>();
	for (DeviceElement element : d.getElements()) {
		if (element instanceof Pin) {
			Pin p = (Pin) element;
			List<String> pinList = p.getPinNames();
			for (int i = 0; i < (pinList.size()); i++) {
				String pinNum = pinList.get(i);
				if (pinMap.containsKey(pinNum)) {
					EStructuralFeature f = PhdlPackage.Literals.PIN__PIN_NAMES;
					error("Duplicate physical pin name.", p, f, i);
					Pin orig = pinMap.get(pinNum);
					error("Duplicate physical pin name.", orig, f, orig.getPinNames().indexOf(pinNum));
				} else
					pinMap.put(pinNum, p);
			}
		}
	}
}
 
开发者ID:timofonic,项目名称:PHDL,代码行数:20,代码来源:PhdlJavaValidator.java

示例9: checkWhenOccursStatment

@Check(CheckType.FAST)
public void checkWhenOccursStatment(WhenOccursStatment when){
    Expr condition = when.getCondition();
    Expr event = when.getEvent();
    Expr times = when.getTimes();
    
    checkExprIsIdentifier(condition);
    checkExprIsIdentifier(event);
            
    AgreeType type = getAgreeType(condition);
    if(!matches(BOOL, type)){
        error(condition, "The condition of the 'when' statement is of type '" +type +"'"
                + " but must be of type 'bool'");
    }
    type = getAgreeType(event);
    if(!matches(BOOL, type)){
        error(event, "The effect of the 'when' statement is of type '" +type+"'"
                + " but must be of type 'bool'");
    }
    type = getAgreeType(times);
    if(!matches(INT, type)){
        error(event, "The 'times' of the 'when' statement is of type '" +type+"'"
                + " but must be of type 'int'");
    }    
    
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:26,代码来源:AgreeJavaValidator.java

示例10: checkAppDoesNotContainsParentModel

@Check(CheckType.FAST)
public void checkAppDoesNotContainsParentModel(UIApplication app) {
	Model[] models = (Model[]) app.getModels().toArray();
	if (models.length > 1) {
		for (int i = 0; i < models.length - 1; i++) {
			for (int j = i + 1; j < models.length; j++) {
				if (this.containsModel(models[i], models[j])) {
					error("This Model is present in the Model "
							+ models[i].getName(), app,
							MvcPackage.Literals.UI_APPLICATION__MODELS, j);
				} else if (this.containsModel(models[j], models[i])) {
					error("This Model is present in the Model "
							+ models[j].getName(), app,
							MvcPackage.Literals.UI_APPLICATION__MODELS, i);
				}
			}
		}
	}
}
 
开发者ID:nemolovich,项目名称:MDEProject,代码行数:19,代码来源:LanguageJavaValidator.java

示例11: checkUnaryExpr

@Check(CheckType.FAST)
public void checkUnaryExpr(UnaryExpr unaryExpr) {
	AgreeType typeRight = getAgreeType(unaryExpr.getExpr());
	String op = unaryExpr.getOp();

	switch (op) {
	case "-":
		if (!matches(INT, typeRight) && !matches(REAL, typeRight)) {
			error(unaryExpr, "right side of unary expression '" + op + "' is of type '" + typeRight
					+ "' but must be of type 'int' or 'real'");
		}
		break;
	case "not":
		if (!matches(BOOL, typeRight)) {
			error(unaryExpr, "right side of unary expression '" + op + "' is of type '" + typeRight
					+ "' but must be of type 'bool'");
		}
		break;
	default:
		assert (false);
	}
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:22,代码来源:AgreeJavaValidator.java

示例12: checkWheneverHoldsStatement

@Check(CheckType.FAST)
public void checkWheneverHoldsStatement(WheneverHoldsStatement whenever) {
    Expr cause = whenever.getCause();
    Expr effect = whenever.getEffect();
    
    checkExprIsIdentifier(cause);
    checkExprIsIdentifier(effect);

    AgreeType type = getAgreeType(cause);
    if (!matches(BOOL, type)) {
        error(cause, "The cause of the 'whenever' statement is of type '" + type + "' "
                + "but must be of type 'bool'");
    }
    type = getAgreeType(effect);
    if (!matches(BOOL, type)) {
        error(effect, "The effect of the 'whenever' statement is of type '" + type + "' "
                + "but must be of type 'bool'");
    }
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:19,代码来源:AgreeJavaValidator.java

示例13: checkFnCallExpr

@Check(CheckType.FAST)
public void checkFnCallExpr(FnCallExpr fnCall) {
	NamedElement fn = getFinalNestId(fnCall.getFn());
	if (isInLinearizationBody(fnCall)) {
		if (fn instanceof NodeDefExpr) {
			error(fnCall, "Node definitions cannot be applied in a linearization definition");
		}
	} else {
		if (fn instanceof LibraryFnDefExpr) {
			if (fn.getElementRoot().getName().equalsIgnoreCase("dreal")) {
				warning(fnCall, "dReal library functions require the use of the dReal solver");
			}
			else {
				error(fnCall, "Library functions cannot be called from the logic");
			}
		}
	}
	checkInputsVsActuals(fnCall);
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:19,代码来源:AgreeJavaValidator.java

示例14: checkTimeInterval

@Check(CheckType.FAST)
	public void checkTimeInterval(TimeInterval interval){
	    Expr lower = interval.getLow();
	    Expr higher = interval.getHigh();
	    
//	    AgreeType lowerType = getAgreeType(lower);
//	    AgreeType higherType = getAgreeType(higher);
	    
	    if(!(lower instanceof RealLitExpr || isConst(lower))){
	        error(lower, "Lower interval must be a real valued literal");
	    }
	    
	    if(!(higher instanceof RealLitExpr || isConst(higher))){
            error(higher, "higher interval must be a real valued literal");
        }
	            
	}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:17,代码来源:AgreeJavaValidator.java

示例15: checkMNSynchStatement

@Check(CheckType.FAST)
public void checkMNSynchStatement(MNSynchStatement sync) {

	if (sync.getMax().size() != sync.getMin().size() && sync.getMax().size() != sync.getComp1().size()
			&& sync.getMax().size() != sync.getComp2().size()) {
		return; // this should throw a parser error
	}

	for (int i = 0; i < sync.getMax().size(); i++) {
		String maxStr = sync.getMax().get(i);
		String minStr = sync.getMin().get(i);

		int max = Integer.valueOf(maxStr);
		int min = Integer.valueOf(minStr);

		if (max < 1 || min < 1) {
			error(sync, "Quasi-synchronous values must be greater than zero");
		}

		if (min > max) {
			error("Left hand side quasi-synchronous values must be greater than the right hand side");
		}
	}
}
 
开发者ID:smaccm,项目名称:smaccm,代码行数:24,代码来源:AgreeJavaValidator.java


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