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


Java Group.getLogicRelation方法代码示例

本文整理汇总了Java中gov.nih.nci.cagrid.cqlquery.Group.getLogicRelation方法的典型用法代码示例。如果您正苦于以下问题:Java Group.getLogicRelation方法的具体用法?Java Group.getLogicRelation怎么用?Java Group.getLogicRelation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nih.nci.cagrid.cqlquery.Group的用法示例。


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

示例1: convertGroup

import gov.nih.nci.cagrid.cqlquery.Group; //导入方法依赖的package包/类
private CQLGroup convertGroup(String parentClassName, Group cqlGroup) throws QueryConversionException {
    CQLGroup group = new CQLGroup();
    if (cqlGroup.getAssociation() != null) {
        CQLAssociatedObject[] associations = new CQLAssociatedObject[cqlGroup.getAssociation().length];
        for (int i = 0; i < cqlGroup.getAssociation().length; i++) {
            associations[i] = convertAssociation(parentClassName, cqlGroup.getAssociation(i));
        }
        group.setCQLAssociatedObject(associations);
    }
    if (cqlGroup.getAttribute() != null) {
        List<CQLAttribute> convertedAttributes = new LinkedList<CQLAttribute>();
        for (Attribute attrib : cqlGroup.getAttribute()) {
            CQLAttribute conversion = null;
            if (unaryPredicateConversion.containsKey(attrib.getPredicate())) {
                conversion = convertUnaryAttribute(attrib);
            } else {
                conversion = convertBinaryAttribute(parentClassName, attrib);
            }
            convertedAttributes.add(conversion);
        }
        if (convertedAttributes.size() != 0) {
            CQLAttribute[] conversions = new CQLAttribute[convertedAttributes.size()];
            convertedAttributes.toArray(conversions);
            group.setCQLAttribute(conversions);
        }
    }
    if (cqlGroup.getGroup() != null) {
        CQLGroup[] groups = new CQLGroup[cqlGroup.getGroup().length];
        for (int i = 0; i < cqlGroup.getGroup().length; i++) {
            groups[i] = convertGroup(parentClassName, cqlGroup.getGroup(i));
        }
        group.setCQLGroup(groups);
    }
    GroupLogicalOperator logic = 
        cqlGroup.getLogicRelation() == LogicalOperator.AND 
            ? GroupLogicalOperator.AND : GroupLogicalOperator.OR;
    group.setLogicalOperation(logic);
    return group;
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:40,代码来源:CQL1toCQL2Converter.java

示例2: validateGroupStructure

import gov.nih.nci.cagrid.cqlquery.Group; //导入方法依赖的package包/类
private void validateGroupStructure(Group group) throws MalformedStructureException {
	// check the logical operator
	if (group.getLogicRelation() == null) {
		throw new MalformedStructureException("Groups must have a logical operator!");
	}
	String logic = group.getLogicRelation().getValue();
	if (!logic.equals(LogicalOperator._AND) && !logic.equals(LogicalOperator._OR)) {
		throw new MalformedStructureException("Logical operator " + logic + " is not valid");
	}
	
	// ensure two or more group members
	int groupMembers = 0;
	if (group.getAssociation() != null) {
		groupMembers += group.getAssociation().length;
	}
	if (group.getAttribute() != null) {
		groupMembers += group.getAttribute().length;
	}
	if (group.getGroup() != null) {
		groupMembers += group.getGroup().length;
	}
	
	if (groupMembers < 2) {
		throw new MalformedStructureException("Groups must have two or more members");
	}
	
	// validate the members of the group
	if (group.getAttribute() != null) {
		for (int i = 0; i < group.getAttribute().length; i++) {
			validateAttributeStructure(group.getAttribute(i));
		}
	}
	
	if (group.getAssociation() != null) {
		for (int i = 0; i < group.getAssociation().length; i++) {
			validateObjectStructure(group.getAssociation(i));
		}
	}
	
	if (group.getGroup() != null) {
		for (int i = 0; i < group.getGroup().length; i++) {
			validateGroupStructure(group.getGroup(i));
		}
	}
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:46,代码来源:ObjectWalkingCQLValidator.java


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