Examples of UnderlyingType


Examples of com.foundationdb.server.types.value.UnderlyingType

            if (sourceDepth <= 0|| source.isNull(true)) {
                values.get(i).putNull();
            } else {
                sourceDepth--;
                Value valueTarget = values.get(i);
                UnderlyingType underlyingType = TInstance.underlyingType(valueTarget.getType());
                Class<?> expected = underlyingExpectedClasses.get(underlyingType);
                if (source.decodeType() == expected) {
                    switch (underlyingType) {
                        case BOOL:      valueTarget.putBool(source.decodeBoolean());        break;
                        case INT_8:     valueTarget.putInt8((byte)source.decodeLong());     break;
View Full Code Here

Examples of com.foundationdb.server.types.value.UnderlyingType

            out.putNull();
            return;
        }
       
        byte[] bytes;
        UnderlyingType underlying = ValueSources.underlyingType(in);
        if (underlying == UnderlyingType.BYTES) {
            bytes = in.getBytes();
        }
        else if (underlying == UnderlyingType.STRING) {
            try {
View Full Code Here

Examples of com.foundationdb.server.types.value.UnderlyingType

            ValueTargets.copyFrom(in, out);
            return true;
        }
       
       
        UnderlyingType underlyingType = TInstance.underlyingType(in.getType());
        if (underlyingType == UnderlyingType.STRING || underlyingType == UnderlyingType.BYTES)
            return false;
        final String asString;
        switch (underlyingType) {
        case BOOL:
View Full Code Here

Examples of com.foundationdb.server.types.value.UnderlyingType

            if (key.isNull()) {
                output.putNull();
            }
            else
            {
                UnderlyingType underlyingType = TInstance.underlyingType(getType());
                Class<?> expected = underlyingExpectedClasses.get(underlyingType);
                if (key.decodeType() == expected) {
                    switch (underlyingType) {
                        case BOOL:      output.putBool(key.decodeBoolean());        break;
                        case INT_8:     output.putInt8((byte)key.decodeLong());     break;
View Full Code Here

Examples of com.foundationdb.server.types.value.UnderlyingType

        if (persistitValue.isNull(true)) {
            cacheObject = NULL;
        }
        else {
            Class<?> valueClass = persistitValue.getType();
            UnderlyingType rawUnderlying = classesToUnderlying.get(valueClass);
            if (rawUnderlying == TInstance.underlyingType(expectedTInstance)) {
                value.underlying(expectedTInstance);
                cacheObject = null;
            }
            else
View Full Code Here

Examples of com.opengamma.analytics.financial.pnl.UnderlyingType

      final NthOrderUnderlying nthOrder = (NthOrderUnderlying) underlying;
      final int n = nthOrder.getOrder();
      if (n == 0) {
        return 1;
      }
      final UnderlyingType type = nthOrder.getUnderlying();
      Validate.isTrue(underlyingData.containsKey(type));
      final double value = Math.pow(underlyingData.get(type), n);
      return value * getMultiplier(underlying);
    } else if (underlying instanceof MixedOrderUnderlying) {
      final MixedOrderUnderlying mixedOrder = (MixedOrderUnderlying) underlying;
View Full Code Here

Examples of com.opengamma.analytics.financial.pnl.UnderlyingType

      final NthOrderUnderlying nthOrder = (NthOrderUnderlying) underlying;
      final int n = nthOrder.getOrder();
      if (n == 0) {
        throw new UnsupportedOperationException();
      }
      final UnderlyingType type = nthOrder.getUnderlying();
      Validate.isTrue(underlyingData.containsKey(type));
      DoubleTimeSeries<?> ts = underlyingData.get(type);
      ts = ts.power(n);
      return ts.multiply(getMultiplier(underlying));
    } else if (underlying instanceof MixedOrderUnderlying) {
View Full Code Here

Examples of com.opengamma.analytics.financial.pnl.UnderlyingType

      throw new IllegalArgumentException("Must have at least two underlying types to have mixed order");
    }
    _orders = new ArrayList<>();
    _underlyings = new ArrayList<>();
    int totalOrder = 0;
    UnderlyingType underlying;
    for (final Entry<Integer, UnderlyingType> entry : underlyings.entrySet()) {
      final int key = entry.getKey();
      if (key < 1) {
        throw new IllegalArgumentException("Order must be at least one to have mixed order");
      }
View Full Code Here

Examples of com.opengamma.analytics.financial.pnl.UnderlyingType

  @Test
  public void test() {
    final int order1 = 2;
    final int order2 = 3;
    final UnderlyingType type1 = UnderlyingType.SPOT_PRICE;
    final UnderlyingType type2 = UnderlyingType.SPOT_VOLATILITY;
    final TreeMap<Integer, UnderlyingType> map1 = new TreeMap<>();
    map1.put(order1, type1);
    map1.put(order2, type2);
    final List<NthOrderUnderlying> set = new ArrayList<>();
    set.add(new NthOrderUnderlying(order1, type1));
View Full Code Here

Examples of com.opengamma.analytics.financial.pnl.UnderlyingType

  }

  @Test
  public void test() {
    final int order = 3;
    final UnderlyingType type = UnderlyingType.SPOT_PRICE;
    final Underlying underlying = new NthOrderUnderlying(order, type);
    assertEquals(underlying.getOrder(), order);
    assertEquals(underlying.getUnderlyings(), Arrays.asList(type));
    final Underlying other = new NthOrderUnderlying(order, type);
    assertFalse(other.equals(type));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.