Package lupos.datastructures.items.literal

Examples of lupos.datastructures.items.literal.TypedLiteral


      return ((BigDecimal) a).floatValue();
    if(a instanceof LazyLiteral){
      a = ((LazyLiteral)a).getLiteral();
    }
    if (a instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) a;
      String content = tl.getContent().substring(1,
          tl.getContent().length() - 1);
      while(content.startsWith("+")){
        content = content.substring(1,content.length());
      }       
      if (isInteger(tl.getType()))
        return (new BigInteger(content)).floatValue();
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#float>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#double>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#decimal>") == 0)
        return Float.parseFloat(content);
    }
    throw new TypeErrorException();
  }
View Full Code Here


      return ((BigDecimal) a).doubleValue();
    if(a instanceof LazyLiteral){
      a = ((LazyLiteral)a).getLiteral();
    }
    if (a instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) a;
      String content = tl.getContent().substring(1,
          tl.getContent().length() - 1);
      while(content.startsWith("+")){
        content = content.substring(1,content.length());
      }       
      if (isInteger(tl.getType()))
        return (new BigInteger(content)).doubleValue();
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#float>") == 0)
        return (double) Float.parseFloat(content);
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#double>") == 0
          || tl.getType().compareTo(
              "<http://www.w3.org/2001/XMLSchema#decimal>") == 0)
        return Double.parseDouble(content);
    }
    throw new TypeErrorException();
  }
View Full Code Here

    Object o = Helper.unlazy(this.resultOfChildZero(node, b, d));
    if(o instanceof URILiteral){
      return o;
    }
    if(o instanceof TypedLiteral){
      final TypedLiteral tl = (TypedLiteral) o;
      if(tl.getType().compareTo("<http://www.w3.org/2001/XMLSchema#string>")==0) {
        o = tl.getContent();
      } else {
        throw new TypeErrorException();
      }
    }
    if(o instanceof String || o instanceof StringLiteral || o instanceof CodeMapLiteral){
View Full Code Here

      final CodeMapLiteral lit = (CodeMapLiteral) obj;
      return this.valueEquals(lit);
    } else if (obj instanceof StringLiteral) {
      return super.equals(obj);
    } else if (obj instanceof TypedLiteral) {
      final TypedLiteral tl = (TypedLiteral) obj;
      if (tl.getType().compareTo(
          "<http://www.w3.org/2001/XMLSchema#string>") == 0) {
        return (tl.getContent().compareTo(this.toString()) == 0);
      } else {
        return false;
      }
    } else {
      return false;
View Full Code Here

TOP

Related Classes of lupos.datastructures.items.literal.TypedLiteral

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.