it.geosolutions.jaiext.range.Range.getDataType()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(98)

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

Range.getDataType介绍

[英]Returns the Range data Type
[中]返回范围数据类型

代码示例

代码示例来源:origin: geosolutions-it/jai-ext

/**
 * This method is responsible for performing a few checks on the provided range in order to make sure we are talking about a valid range for
 * building an {@link IndexColorModel}.
 * 
 * @param numberRange the range to use for mapping values to colors.
 * @return the input {@link NumberRange} if everything goes well.
 * @see IndexColorModel
 */
private static Range checkSampleRange(Range numberRange) {
  if (numberRange == null)
    throw new IllegalArgumentException();
  final Class<?> elementClass = numberRange.getDataType().getClassValue();
  if (!elementClass.equals(Integer.class) && !elementClass.equals(Byte.class)
      && !elementClass.equals(Short.class))
    throw new IllegalArgumentException(
        "The following Range cannot be used for mapping value to colours");
  if (numberRange.getMin().intValue() < 0 || numberRange.getMax().intValue() > 65535)
    throw new IndexOutOfBoundsException(
        "Input Range bounds are outside the available color representation");
  return numberRange;
}

代码示例来源:origin: it.geosolutions.jaiext.classifier/jt-classifier

/**
 * This method is responsible for performing a few checks on the provided range in order to make sure we are talking about a valid range for
 * building an {@link IndexColorModel}.
 * 
 * @param numberRange the range to use for mapping values to colors.
 * @return the input {@link NumberRange} if everything goes well.
 * @see IndexColorModel
 */
private static Range checkSampleRange(Range numberRange) {
  if (numberRange == null)
    throw new IllegalArgumentException();
  final Class<?> elementClass = numberRange.getDataType().getClassValue();
  if (!elementClass.equals(Integer.class) && !elementClass.equals(Byte.class)
      && !elementClass.equals(Short.class))
    throw new IllegalArgumentException(
        "The following Range cannot be used for mapping value to colours");
  if (numberRange.getMin().intValue() < 0 || numberRange.getMax().intValue() > 65535)
    throw new IndexOutOfBoundsException(
        "Input Range bounds are outside the available color representation");
  return numberRange;
}

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public int hashCode() {
  int result = 37;
    result += getDataType().getClass().hashCode();
    result = hash(isMaxIncluded, result);
    result = hash(isMinIncluded, result);
    result = hash(getMax().doubleValue(), result);
    result = hash(getMin().doubleValue(), result);
  return result;
}

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public int hashCode() {
  int result = 37;
    result += getDataType().getClass().hashCode();
    result = hash(isMaxIncluded, result);
    result = hash(isMinIncluded, result);
    result = hash(getMax().doubleValue(), result);
    result = hash(getMin().doubleValue(), result);
  return result;
}

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

/** Method for checking if a Generic value is contained inside the Range */
public <T extends Number> boolean containsN(T value) {
  if (LOGGER.isLoggable(Level.FINE)) {
    LOGGER.log(Level.FINE, "Wrong data type tested: Input: " + value.getClass()
        + ", output: " + this.getDataType().getClassValue());
  }
  int dataType = this.getDataType().getDataType();
  switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    return contains(value.byteValue());
  case DataBuffer.TYPE_USHORT:
  case DataBuffer.TYPE_SHORT:
    return contains(value.shortValue());
  case DataBuffer.TYPE_INT:
    return contains(value.intValue());
  case DataBuffer.TYPE_FLOAT:
    return contains(value.floatValue());
  case DataBuffer.TYPE_DOUBLE:
    return contains(value.doubleValue());
  case DataBuffer.TYPE_DOUBLE + 1:
    return contains(value.longValue());
  default:
    throw new IllegalArgumentException("Wrong data type");
  }
}

代码示例来源:origin: geosolutions-it/jai-ext

/** Method for checking if a Generic value is contained inside the Range */
public <T extends Number> boolean containsN(T value) {
  if (LOGGER.isLoggable(Level.FINE)) {
    LOGGER.log(Level.FINE, "Wrong data type tested: Input: " + value.getClass()
        + ", output: " + this.getDataType().getClassValue());
  }
  int dataType = this.getDataType().getDataType();
  switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    return contains(value.byteValue());
  case DataBuffer.TYPE_USHORT:
  case DataBuffer.TYPE_SHORT:
    return contains(value.shortValue());
  case DataBuffer.TYPE_INT:
    return contains(value.intValue());
  case DataBuffer.TYPE_FLOAT:
    return contains(value.floatValue());
  case DataBuffer.TYPE_DOUBLE:
    return contains(value.doubleValue());
  case DataBuffer.TYPE_DOUBLE + 1:
    return contains(value.longValue());
  default:
    throw new IllegalArgumentException("Wrong data type");
  }
}

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

if (r1.getDataType() != this.getDataType()) {
  return false;

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

public static Range convert(Range input, int dataType) {
  if (input == null) {
    return null;
  }
  // If already double do nothing
  if (input.getDataType().getDataType() == dataType) {
    return input;
  }
  switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    return RangeByte.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_USHORT:
    return RangeUshort.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_SHORT:
    return RangeShort.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_INT:
    return RangeInt.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_FLOAT:
    return RangeFloat.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_DOUBLE:
    return RangeDouble.FULL_RANGE.intersection(input);
  default:
    return null;
  }
}

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: geosolutions-it/jai-ext

public static Range convert(Range input, int dataType) {
  if (input == null) {
    return null;
  }
  // If already double do nothing
  if (input.getDataType().getDataType() == dataType) {
    return input;
  }
  switch (dataType) {
  case DataBuffer.TYPE_BYTE:
    return RangeByte.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_USHORT:
    return RangeUshort.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_SHORT:
    return RangeShort.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_INT:
    return RangeInt.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_FLOAT:
    return RangeFloat.FULL_RANGE.intersection(input);
  case DataBuffer.TYPE_DOUBLE:
    return RangeDouble.FULL_RANGE.intersection(input);
  default:
    return null;
  }
}

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: it.geosolutions.jaiext.utilities/jt-utilities

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: geosolutions-it/jai-ext

private void checkRangeConversion(Range range, int targetType) {
  Range converted = RangeFactory.convert(range, targetType);
  assertEquals(converted.getMin().intValue(), 255);
  assertEquals(converted.getMax().intValue(), 255);
  assertTrue(converted.isMinIncluded);
  assertTrue(converted.isMaxIncluded);
  assertEquals(targetType, converted.getDataType().getDataType());
  if (range.getDataType().getDataType() == targetType) {
    assertSame(range, converted);
  } else {
    assertNotSame(range, converted);
  }
}

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

代码示例来源:origin: geosolutions-it/jai-ext

@Override
public Range intersection(Range other) {
  if (other.getDataType() == getDataType()) {
    if (other.contains(this)) {
      return this;

相关文章