gpt4 book ai didi

com.bigdata.rdf.internal.impl.literal.XSDNumericIV类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 20:20:40 27 4
gpt4 key购买 nike

本文整理了Java中com.bigdata.rdf.internal.impl.literal.XSDNumericIV类的一些代码示例,展示了XSDNumericIV类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSDNumericIV类的具体详情如下:
包路径:com.bigdata.rdf.internal.impl.literal.XSDNumericIV
类名称:XSDNumericIV

XSDNumericIV介绍

[英]Implementation for inline xsd:byte, xsd:short, xsd:int, xsd:long, xsd:float, xsd:decimal.
[中]内联xsd:bytexsd:shortxsd:intxsd:longxsd:floatxsd:decimal的实现。

代码示例

代码示例来源:origin: blazegraph/database

@Override
@SuppressWarnings("rawtypes")
public IV<?,?> serializeTime(final BigdataValueFactory vf, final Object time) {
  return new XSDNumericIV((Long)time);
}

代码示例来源:origin: blazegraph/database

public IV<V, Number> clone(final boolean clearCache) {
  final XSDNumericIV<V> tmp = new XSDNumericIV<V>(number, getDTE());
  if (!clearCache) {
    tmp.setValue(getValueCache());
    
  }
  
  return tmp;
}

代码示例来源:origin: blazegraph/database

public int hashCode() {
  
  switch (getDTE()) {
    case XSDByte:
      return (int) byteValue();
    case XSDShort:
      return (int) shortValue();
    case XSDInt:
      return intValue();
    case XSDLong:
      return (int) (longValue() ^ (longValue() >>> 32));
    case XSDFloat:
      return Float.floatToIntBits(floatValue());
    case XSDDouble:
      final long l = Double.doubleToLongBits(doubleValue());
      return (int) (l ^ (l >>> 32));
    default:
      throw new RuntimeException("unknown DTE");
  }
  
}

代码示例来源:origin: blazegraph/database

@Override
public boolean booleanValue() {
  
  switch (getDTE()) {
    case XSDByte:
      return byteValue() != 0;
    case XSDShort:
      return shortValue() != 0;
    case XSDInt:
      return intValue() != 0;
    case XSDLong:
      return longValue() != 0;
    default:
      return super.booleanValue();
  }
  
}

代码示例来源:origin: blazegraph/database

final IVariable y = Var.var("y");
final XSDNumericIV<BigdataLiteral> one = new XSDNumericIV<BigdataLiteral>(
    1);
one.setValue(f.createLiteral(1));
final XSDNumericIV<BigdataLiteral> two = new XSDNumericIV<BigdataLiteral>(
    2);
two.setValue(f.createLiteral(2));
final XSDNumericIV<BigdataLiteral> three = new XSDNumericIV<BigdataLiteral>(
    3);
three.setValue(f.createLiteral(3));
final XSDNumericIV<BigdataLiteral> four = new XSDNumericIV<BigdataLiteral>(
    4);
four.setValue(f.createLiteral(4));

代码示例来源:origin: blazegraph/database

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test    
public void testSuffixedIntegerURIHandler() {

  final String nameSpace = "http://blazegraph.com/";
  final String localName = "1234DB";
  final String fixture = "DB";
  final int intValue = 1234;
  
  InlineSuffixedIntegerURIHandler handler = new InlineSuffixedIntegerURIHandler(nameSpace, fixture);
  
  XSDNumericIV iv = (XSDNumericIV) handler.createInlineIV(localName);
  
  if(log.isDebugEnabled()) {
    log.debug(iv.getDTE().name());
  }
  
  assertTrue (intValue == iv.getInlineValue().intValue());
  
  assertTrue (localName.equals(handler.getLocalNameFromDelegate(iv)));
  
}

代码示例来源:origin: blazegraph/database

@SuppressWarnings("unchecked")
public V asValue(final LexiconRelation lex) {
  V v = getValueCache();
    switch(getDTE()) {
      case XSDByte:
        v = (V) lex.getValueFactory().createLiteral(byteValue());
        break;
      case XSDShort:
        v = (V) lex.getValueFactory().createLiteral(shortValue());
        break;
      case XSDInt:
        v = (V) lex.getValueFactory().createLiteral(intValue());
        break;
      case XSDLong:
        v = (V) lex.getValueFactory().createLiteral(longValue());
        break;
      case XSDFloat:
        v = (V) lex.getValueFactory().createLiteral(floatValue());
        break;
      case XSDDouble:
        v = (V) lex.getValueFactory().createLiteral(doubleValue());
        break;
      default:
    setValue(v);

代码示例来源:origin: blazegraph/database

@Override
public BigDecimal decimalValue() {
  
  switch (getDTE()) {
    case XSDByte:
    case XSDShort:
    case XSDInt:
    case XSDLong:
      return BigDecimal.valueOf(longValue());
    case XSDFloat:
    case XSDDouble:
      return BigDecimal.valueOf(doubleValue());
    default:
      throw new RuntimeException("unknown DTE");
  }
  
}

代码示例来源:origin: blazegraph/database

@Override
public boolean equals(final Object o) {
  
  if (o == this) 
    return true;
  
  if(o instanceof XSDNumericIV<?>) {
    
    final XSDNumericIV<?> n = (XSDNumericIV<?>) o;
    
    return this.getDTE() == n.getDTE() && this.number.equals(n.number);
    
  }
  
  return false;
  
}

代码示例来源:origin: com.blazegraph/bigdata-rdf-test

final IVariable y = Var.var("y");
final XSDNumericIV<BigdataLiteral> one = new XSDNumericIV<BigdataLiteral>(
    1);
one.setValue(f.createLiteral(1));
final XSDNumericIV<BigdataLiteral> two = new XSDNumericIV<BigdataLiteral>(
    2);
two.setValue(f.createLiteral(2));
final XSDNumericIV<BigdataLiteral> three = new XSDNumericIV<BigdataLiteral>(
    3);
three.setValue(f.createLiteral(3));
final XSDNumericIV<BigdataLiteral> four = new XSDNumericIV<BigdataLiteral>(
    4);
four.setValue(f.createLiteral(4));

代码示例来源:origin: blazegraph/database

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test    
public void testFixedWidthIntegerURIHandler() {

  final String nameSpace = "http://blazegraph.com/";
  final String localName = "001234";
  final int intValue = 1234;
  final int width = 6;
  
  InlineFixedWidthIntegerURIHandler handler = new InlineFixedWidthIntegerURIHandler(nameSpace, width);
  
  XSDNumericIV iv = (XSDNumericIV) handler.createInlineIV(localName);
  
  if(log.isDebugEnabled()) {
    log.debug(iv.getDTE().name());
  }
  
  assertTrue (intValue == iv.getInlineValue().intValue());
  
  assertTrue (localName.equals(handler.getLocalNameFromDelegate(iv)));
  
}

代码示例来源:origin: com.blazegraph/bigdata-core

@SuppressWarnings("unchecked")
public V asValue(final LexiconRelation lex) {
  V v = getValueCache();
    switch(getDTE()) {
      case XSDByte:
        v = (V) lex.getValueFactory().createLiteral(byteValue());
        break;
      case XSDShort:
        v = (V) lex.getValueFactory().createLiteral(shortValue());
        break;
      case XSDInt:
        v = (V) lex.getValueFactory().createLiteral(intValue());
        break;
      case XSDLong:
        v = (V) lex.getValueFactory().createLiteral(longValue());
        break;
      case XSDFloat:
        v = (V) lex.getValueFactory().createLiteral(floatValue());
        break;
      case XSDDouble:
        v = (V) lex.getValueFactory().createLiteral(doubleValue());
        break;
      default:
    setValue(v);

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public boolean booleanValue() {
  
  switch (getDTE()) {
    case XSDByte:
      return byteValue() != 0;
    case XSDShort:
      return shortValue() != 0;
    case XSDInt:
      return intValue() != 0;
    case XSDLong:
      return longValue() != 0;
    default:
      return super.booleanValue();
  }
  
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public BigDecimal decimalValue() {
  
  switch (getDTE()) {
    case XSDByte:
    case XSDShort:
    case XSDInt:
    case XSDLong:
      return BigDecimal.valueOf(longValue());
    case XSDFloat:
    case XSDDouble:
      return BigDecimal.valueOf(doubleValue());
    default:
      throw new RuntimeException("unknown DTE");
  }
  
}

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
public boolean equals(final Object o) {
  
  if (o == this) 
    return true;
  
  if(o instanceof XSDNumericIV<?>) {
    
    final XSDNumericIV<?> n = (XSDNumericIV<?>) o;
    
    return this.getDTE() == n.getDTE() && this.number.equals(n.number);
    
  }
  
  return false;
  
}

代码示例来源:origin: blazegraph/database

final IVariable z = Var.var("z");
final XSDNumericIV<BigdataLiteral> one = new XSDNumericIV<BigdataLiteral>(
    1);
one.setValue(f.createLiteral(1));
final XSDNumericIV<BigdataLiteral> two = new XSDNumericIV<BigdataLiteral>(
    2);
two.setValue(f.createLiteral(2));
final XSDNumericIV<BigdataLiteral> three = new XSDNumericIV<BigdataLiteral>(
    3);
three.setValue(f.createLiteral(3));
final XSDNumericIV<BigdataLiteral> four = new XSDNumericIV<BigdataLiteral>(
    4);
four.setValue(f.createLiteral(4));
final XSDNumericIV<BigdataLiteral> five = new XSDNumericIV<BigdataLiteral>(
    5);
five.setValue(f.createLiteral(5));

代码示例来源:origin: com.blazegraph/bigdata-core

@Override
@SuppressWarnings("rawtypes")
public IV<?,?> serializeTime(final BigdataValueFactory vf, final Object time) {
  return new XSDNumericIV((Long)time);
}

代码示例来源:origin: blazegraph/database

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test    
public void testPrefixedIntegerURIHandler() {

  final String nameSpace = "http://blazegraph.com/";
  final String localName = "DB1234";
  final String fixture = "DB";
  final int intValue = 1234;
  
  InlinePrefixedIntegerURIHandler handler = new InlinePrefixedIntegerURIHandler(nameSpace, fixture);
  
  XSDNumericIV iv = (XSDNumericIV) handler.createInlineIV(localName);
  
  if(log.isDebugEnabled()) {
    log.debug(iv.getDTE().name());
  }
  
  assertTrue (intValue == iv.getInlineValue().intValue());
  
  assertTrue (localName.equals(handler.getLocalNameFromDelegate(iv)));
  
}

代码示例来源:origin: com.blazegraph/bigdata-core

public IV<V, Number> clone(final boolean clearCache) {
  final XSDNumericIV<V> tmp = new XSDNumericIV<V>(number, getDTE());
  if (!clearCache) {
    tmp.setValue(getValueCache());
    
  }
  
  return tmp;
}

代码示例来源:origin: com.blazegraph/bigdata-core

public int hashCode() {
  
  switch (getDTE()) {
    case XSDByte:
      return (int) byteValue();
    case XSDShort:
      return (int) shortValue();
    case XSDInt:
      return intValue();
    case XSDLong:
      return (int) (longValue() ^ (longValue() >>> 32));
    case XSDFloat:
      return Float.floatToIntBits(floatValue());
    case XSDDouble:
      final long l = Double.doubleToLongBits(doubleValue());
      return (int) (l ^ (l >>> 32));
    default:
      throw new RuntimeException("unknown DTE");
  }
  
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com