本文整理汇总了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;
}
示例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));
}
}
}