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


Java IntegerType类代码示例

本文整理汇总了Java中org.hl7.fhir.instance.model.IntegerType的典型用法代码示例。如果您正苦于以下问题:Java IntegerType类的具体用法?Java IntegerType怎么用?Java IntegerType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: processConstant

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private Base processConstant(ExecutionContext context, String constant) throws PathEngineException {
	if (constant.equals("true")) {
		return new BooleanType(true);
	} else if (constant.equals("false")) {
		return new BooleanType(false);
   } else if (constant.equals("{}")) {
     return null;
	} else if (Utilities.isInteger(constant)) {
		return new IntegerType(constant);
   } else if (Utilities.isDecimal(constant)) {
		return new DecimalType(constant);
   } else if (constant.startsWith("\'")) {
		return new StringType(processConstantString(constant));
   } else if (constant.startsWith("%")) {
     return resolveConstant(context, constant);
   } else if (constant.startsWith("@")) {
     return processDateConstant(context.appInfo, constant.substring(1));
	} else {
		return new StringType(constant);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:22,代码来源:FHIRPathEngine.java

示例2: opTimes

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> opTimes(List<Base> left, List<Base> right) throws PathEngineException {
  if (left.size() == 0)
    throw new PathEngineException("Error performing *: left operand has no value");
  if (left.size() > 1)
    throw new PathEngineException("Error performing *: left operand has more than one value");
  if (!left.get(0).isPrimitive())
    throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
  if (right.size() == 0)
    throw new PathEngineException("Error performing *: right operand has no value");
  if (right.size() > 1)
    throw new PathEngineException("Error performing *: right operand has more than one value");
  if (!right.get(0).isPrimitive())
    throw new PathEngineException(String.format("Error performing *: right operand has the wrong type (%s)", right.get(0).fhirType()));

List<Base> result = new ArrayList<Base>();
	Base l = left.get(0);
	Base r = right.get(0);

  if (l.hasType("integer") && r.hasType("integer")) 
    result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) * Integer.parseInt(r.primitiveValue())));
  else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
    result.add(new DecimalType(new BigDecimal(l.primitiveValue()).multiply(new BigDecimal(r.primitiveValue()))));
  else
    throw new PathEngineException(String.format("Error performing *: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
  return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:FHIRPathEngine.java

示例3: opMinus

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> opMinus(List<Base> left, List<Base> right) throws PathEngineException {
  if (left.size() == 0)
    throw new PathEngineException("Error performing -: left operand has no value");
  if (left.size() > 1)
    throw new PathEngineException("Error performing -: left operand has more than one value");
  if (!left.get(0).isPrimitive())
    throw new PathEngineException(String.format("Error performing -: left operand has the wrong type (%s)", left.get(0).fhirType()));
  if (right.size() == 0)
    throw new PathEngineException("Error performing -: right operand has no value");
  if (right.size() > 1)
    throw new PathEngineException("Error performing -: right operand has more than one value");
  if (!right.get(0).isPrimitive())
    throw new PathEngineException(String.format("Error performing -: right operand has the wrong type (%s)", right.get(0).fhirType()));

  List<Base> result = new ArrayList<Base>();
  Base l = left.get(0);
  Base r = right.get(0);

  if (l.hasType("integer") && r.hasType("integer")) 
    result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) - Integer.parseInt(r.primitiveValue())));
  else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
    result.add(new DecimalType(new BigDecimal(l.primitiveValue()).subtract(new BigDecimal(r.primitiveValue()))));
  else
    throw new PathEngineException(String.format("Error performing -: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
  return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:FHIRPathEngine.java

示例4: addIntegerExtension

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
public static void addIntegerExtension(DomainResource dr, String url, int value) {
  Extension ex = getExtension(dr, url);
  if (ex != null)
    ex.setValue(new IntegerType(value));
  else
    dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true));   
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:ToolingExtensions.java

示例5: describeCardinality

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private String describeCardinality(ElementDefinition definition, ElementDefinition fallback, UnusedTracker tracker) {
  IntegerType min = definition.hasMinElement() ? definition.getMinElement() : new IntegerType();
  StringType max = definition.hasMaxElement() ? definition.getMaxElement() : new StringType();
  if (min.isEmpty() && fallback != null)
    min = fallback.getMinElement();
  if (max.isEmpty() && fallback != null)
    max = fallback.getMaxElement();

  tracker.used = !max.isEmpty() && !max.getValue().equals("0");

  if (min.isEmpty() && max.isEmpty())
    return null;
  else
    return (!min.hasValue() ? "" : Integer.toString(min.getValue())) + ".." + (!max.hasValue() ? "" : max.getValue());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:16,代码来源:ProfileUtilities.java

示例6: opPlus

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> opPlus(List<Base> left, List<Base> right) throws PathEngineException {
   if (left.size() == 0)
     throw new PathEngineException("Error performing +: left operand has no value");
   if (left.size() > 1)
     throw new PathEngineException("Error performing +: left operand has more than one value");
   if (!left.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing +: left operand has the wrong type (%s)", left.get(0).fhirType()));
   if (right.size() == 0)
     throw new PathEngineException("Error performing +: right operand has no value");
   if (right.size() > 1)
     throw new PathEngineException("Error performing +: right operand has more than one value");
   if (!right.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing +: right operand has the wrong type (%s)", right.get(0).fhirType()));

   List<Base> result = new ArrayList<Base>();
		Base l = left.get(0);
		Base r = right.get(0);
		if (l.hasType("string", "id", "code", "uri") && r.hasType("string", "id", "code", "uri")) 
			result.add(new StringType(l.primitiveValue() + r.primitiveValue()));
   else if (l.hasType("integer") && r.hasType("integer")) 
				result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) + Integer.parseInt(r.primitiveValue())));
   else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) 
     result.add(new DecimalType(new BigDecimal(l.primitiveValue()).add(new BigDecimal(r.primitiveValue()))));
			else
     throw new PathEngineException(String.format("Error performing +: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
	return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:28,代码来源:FHIRPathEngine.java

示例7: opDiv

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> opDiv(List<Base> left, List<Base> right) throws PathEngineException {
   if (left.size() == 0)
     throw new PathEngineException("Error performing div: left operand has no value");
   if (left.size() > 1)
     throw new PathEngineException("Error performing div: left operand has more than one value");
   if (!left.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing div: left operand has the wrong type (%s)", left.get(0).fhirType()));
   if (right.size() == 0)
     throw new PathEngineException("Error performing div: right operand has no value");
   if (right.size() > 1)
     throw new PathEngineException("Error performing div: right operand has more than one value");
   if (!right.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing div: right operand has the wrong type (%s)", right.get(0).fhirType()));

   List<Base> result = new ArrayList<Base>();
   Base l = left.get(0);
   Base r = right.get(0);

   if (l.hasType("integer") && r.hasType("integer")) 
     result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) / Integer.parseInt(r.primitiveValue())));
   else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) { 
     Decimal d1;
     try {
       d1 = new Decimal(l.primitiveValue());
       Decimal d2 = new Decimal(r.primitiveValue());
       result.add(new IntegerType(d1.divInt(d2).asDecimal()));
     } catch (UcumException e) {
       throw new PathEngineException(e);
     }
}
   else
     throw new PathEngineException(String.format("Error performing div: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
   return result;
 }
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:35,代码来源:FHIRPathEngine.java

示例8: opMod

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> opMod(List<Base> left, List<Base> right) throws PathEngineException {
   if (left.size() == 0)
     throw new PathEngineException("Error performing mod: left operand has no value");
   if (left.size() > 1)
     throw new PathEngineException("Error performing mod: left operand has more than one value");
   if (!left.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing mod: left operand has the wrong type (%s)", left.get(0).fhirType()));
   if (right.size() == 0)
     throw new PathEngineException("Error performing mod: right operand has no value");
   if (right.size() > 1)
     throw new PathEngineException("Error performing mod: right operand has more than one value");
   if (!right.get(0).isPrimitive())
     throw new PathEngineException(String.format("Error performing mod: right operand has the wrong type (%s)", right.get(0).fhirType()));

   List<Base> result = new ArrayList<Base>();
   Base l = left.get(0);
   Base r = right.get(0);

   if (l.hasType("integer") && r.hasType("integer")) 
     result.add(new IntegerType(Integer.parseInt(l.primitiveValue()) % Integer.parseInt(r.primitiveValue())));
   else if (l.hasType("decimal", "integer") && r.hasType("decimal", "integer")) {
     Decimal d1;
     try {
       d1 = new Decimal(l.primitiveValue());
       Decimal d2 = new Decimal(r.primitiveValue());
       result.add(new DecimalType(d1.modulo(d2).asDecimal()));
     } catch (UcumException e) {
       throw new PathEngineException(e);
     }
   }
   else
     throw new PathEngineException(String.format("Error performing mod: left and right operand have incompatible or illegal types (%s, %s)", left.get(0).fhirType(), right.get(0).fhirType()));
   return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:35,代码来源:FHIRPathEngine.java

示例9: funcLength

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> funcLength(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
   List<Base> result = new ArrayList<Base>();
   if (focus.size() == 1) {
     String s = convertToString(focus.get(0));
     result.add(new IntegerType(s.length()));
	}
	return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:9,代码来源:FHIRPathEngine.java

示例10: funcToInteger

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private List<Base> funcToInteger(ExecutionContext context, List<Base> focus, ExpressionNode exp) {
	String s = convertToString(focus);
	List<Base> result = new ArrayList<Base>();
	if (Utilities.isInteger(s))
		result.add(new IntegerType(s));
	return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:8,代码来源:FHIRPathEngine.java

示例11: composeIntegerCore

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private void composeIntegerCore(String name, IntegerType value, boolean inArray) throws Exception {
  if (value != null) {
      prop(name, java.lang.Integer.valueOf(value.getValue()));
  }    
  else if (inArray) 
    writeNull(name); 
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:8,代码来源:JsonComposer.java

示例12: composeIntegerExtras

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws Exception {
  if (value != null && (!Utilities.noString(value.getXmlId()) || value.hasExtensions())) {
    open(inArray ? null : "_"+name);
    composeElement(value);
    close();
  }
  else if (inArray) 
    writeNull(name); 
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:10,代码来源:JsonComposer.java

示例13: composeInteger

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private void composeInteger(String name, IntegerType value) throws Exception {
  if (value != null) {
    composeElementAttributes(value);
      xml.attribute("value", toString(value.getValue()));
      
    xml.open(FHIR_NS, name);
    composeElementElements(value);
    xml.close(FHIR_NS, name);
  }    
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:11,代码来源:XmlComposer.java

示例14: parseInteger

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
private IntegerType parseInteger(XmlPullParser xpp) throws Exception {
  IntegerType res = new IntegerType();
  parseElementAttributes(xpp, res);
  res.setValue(parseIntegerPrimitive(xpp.getAttributeValue(null, "value")));
  next(xpp);
  int eventType = nextNoWhitespace(xpp);
  while (eventType != XmlPullParser.END_TAG) {
    if (!parseElementContent(eventType, xpp, res))
      unknownContent(xpp);
    eventType = nextNoWhitespace(xpp);
  }
  next(xpp);
  return res;
}
 
开发者ID:cqframework,项目名称:ProfileGenerator,代码行数:15,代码来源:XmlParser.java

示例15: testIntegerType

import org.hl7.fhir.instance.model.IntegerType; //导入依赖的package包/类
@Test
public void testIntegerType() {
    assertTrue(IBaseIntegerDatatype.class.isAssignableFrom(IntegerType.class));
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:5,代码来源:ModelInheritanceTest.java


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