Java Code Examples for edu.cornell.cs.nlp.spf.mr.language.type.Type#isArray()

The following examples show how to use edu.cornell.cs.nlp.spf.mr.language.type.Type#isArray() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IsTypeConsistent.java    From spf with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Verify the argument type against the signature type.
 */
private boolean verifyLiteralArgTyping(LogicalExpression arg,
		Type signatureType) {
	if (arg instanceof Variable) {
		// Case variable: check according to historical type and allow more
		// flexibility.
		return verifyVariableType((Variable) arg, signatureType);
	} else {
		// If the signature expects an array, the argument must be an array.
		// The relation between the signature type and the argument type
		// should be along the inheritance relation, but can be in either
		// direction.
		final boolean literalWellTyped = signatureType.isArray() == arg
				.getType().isArray()
				&& arg.getType().isExtendingOrExtendedBy(signatureType);
		if (!literalWellTyped) {
			message = "Array argument expected, or provided array argument doesn't extend signature array type";
		}
		return literalWellTyped;
	}
}
 
Example 2
Source File: GetAllSimpleLogicalConstants.java    From spf with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void visit(LogicalConstant logicalConstant) {
	final Type type = logicalConstant.getType();
	if (!type.isArray() && !type.isComplex()) {
		constants.add(logicalConstant);
	}
}