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


Java ReadableArray.getDouble方法代码示例

本文整理汇总了Java中com.facebook.react.bridge.ReadableArray.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java ReadableArray.getDouble方法的具体用法?Java ReadableArray.getDouble怎么用?Java ReadableArray.getDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.react.bridge.ReadableArray的用法示例。


在下文中一共展示了ReadableArray.getDouble方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: arrayGetByType

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private void arrayGetByType(ReadableArray array, int index, String typeToAskFor) {
  if (typeToAskFor.equals("double")) {
    array.getDouble(index);
  } else if (typeToAskFor.equals("int")) {
    array.getInt(index);
  } else if (typeToAskFor.equals("string")) {
    array.getString(index);
  } else if (typeToAskFor.equals("array")) {
    array.getArray(index);
  } else if (typeToAskFor.equals("map")) {
    array.getMap(index);
  } else if (typeToAskFor.equals("boolean")) {
    array.getBoolean(index);
  } else {
    throw new RuntimeException("Unknown type: " + typeToAskFor);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:CatalystNativeJSToJavaParametersTestCase.java

示例2: toArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static Object[] toArray(ReadableArray readableArray) {
  Object[] array = new Object[readableArray.size()];

  for (int i = 0; i < readableArray.size(); i++) {
    ReadableType type = readableArray.getType(i);

    switch (type) {
      case Null:
        array[i] = null;
        break;
      case Boolean:
        array[i] = readableArray.getBoolean(i);
        break;
      case Number:
        array[i] = readableArray.getDouble(i);
        break;
      case String:
        array[i] = readableArray.getString(i);
        break;
      case Map:
        array[i] = MapUtil.toMap(readableArray.getMap(i));
        break;
      case Array:
        array[i] = ArrayUtil.toArray(readableArray.getArray(i));
        break;
    }
  }

  return array;
}
 
开发者ID:davidstoneham,项目名称:react-native-mssql,代码行数:31,代码来源:ArrayUtil.java

示例3: readableArrayToDoubleArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static double[] readableArrayToDoubleArray(ReadableArray readableArray) {
    double[] arr = new double[readableArray.size()];
    for (int i = 0; i < readableArray.size(); i++) {
        arr[i] = readableArray.getDouble(i);
    }

    return arr;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例4: readableArrayToLongArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static long[] readableArrayToLongArray(ReadableArray readableArray) {
    long[] arr = new long[readableArray.size()];
    for (int i = 0; i < readableArray.size(); i++) {
        arr[i] = (long)readableArray.getDouble(i);
    }

    return arr;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例5: readableArrayToFloatArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static float[] readableArrayToFloatArray(ReadableArray readableArray) {
    float[] arr = new float[readableArray.size()];
    for (int i = 0; i < readableArray.size(); i++) {
        arr[i] = (float)readableArray.getDouble(i);
    }

    return arr;
}
 
开发者ID:reneweb,项目名称:react-native-tensorflow,代码行数:9,代码来源:ArrayConverter.java

示例6: toArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static Object[] toArray(ReadableArray readableArray) {
    Object[] array = new Object[readableArray.size()];

    for (int i = 0; i < readableArray.size(); i++) {
        ReadableType type = readableArray.getType(i);

        switch (type) {
            case Null:
                array[i] = null;
                break;
            case Boolean:
                array[i] = readableArray.getBoolean(i);
                break;
            case Number:
                array[i] = readableArray.getDouble(i);
                break;
            case String:
                array[i] = readableArray.getString(i);
                break;
            case Map:
                array[i] = MapUtil.toMap(readableArray.getMap(i));
                break;
            case Array:
                array[i] = ArrayUtil.toArray(readableArray.getArray(i));
                break;
        }
    }

    return array;
}
 
开发者ID:dangerfarms,项目名称:react-native-batch,代码行数:31,代码来源:ArrayUtil.java

示例7: setLocations

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public void setLocations(ReadableArray locations) {
    float[] _locations = new float[locations.size()];
    for (int i = 0; i < _locations.length; i++) {
        _locations[i] = (float) locations.getDouble(i);
    }
    mLocations = _locations;
}
 
开发者ID:svbutko,项目名称:react-native-text-gradient,代码行数:8,代码来源:TextGradientView.java

示例8: FrameBasedAnimationDriver

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
FrameBasedAnimationDriver(ReadableMap config) {
  ReadableArray frames = config.getArray("frames");
  int numberOfFrames = frames.size();
  mFrames = new double[numberOfFrames];
  for (int i = 0; i < numberOfFrames; i++) {
    mFrames[i] = frames.getDouble(i);
  }
  mToValue = config.getDouble("toValue");
  mIterations = config.hasKey("iterations") ? config.getInt("iterations") : 1;
  mCurrentLoop = 1;
  mHasFinished = mIterations == 0;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:FrameBasedAnimationDriver.java

示例9: fromDoubleArray

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
private static double[] fromDoubleArray(ReadableArray ary) {
  double[] res = new double[ary.size()];
  for (int i = 0; i < res.length; i++) {
    res[i] = ary.getDouble(i);
  }
  return res;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:8,代码来源:InterpolationAnimatedNode.java

示例10: toList

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
 * toList converts a {@link ReadableArray} into an ArrayList.
 *
 * @param readableArray The ReadableArray to be converted.
 * @return An ArrayList containing the data that was in the ReadableArray.
 */
public static List<Object> toList(@Nullable ReadableArray readableArray) {
    if (readableArray == null) {
        return new ArrayList<>(0);
    }

    List<Object> result = new ArrayList<>(readableArray.size());

    for (int index = 0; index < readableArray.size(); index++) {
        ReadableType readableType = readableArray.getType(index);
        switch (readableType) {
            case Null:
                result.add(String.valueOf(index));
                break;
            case Boolean:
                result.add(readableArray.getBoolean(index));
                break;
            case Number:
                // Can be int or double.
                double tmp = readableArray.getDouble(index);
                if (tmp == (int) tmp) {
                    result.add((int) tmp);
                } else {
                    result.add(tmp);
                }
                break;
            case String:
                result.add(readableArray.getString(index));
                break;
            case Map:
                result.add(toMap(readableArray.getMap(index)));
                break;
            case Array:
                result = toList(readableArray.getArray(index));
                break;
            default:
                throw new IllegalArgumentException("Could not convert object with index: " + index + ".");
        }
    }

    return result;
}
 
开发者ID:hudl,项目名称:react-native-android-fragment,代码行数:48,代码来源:ReactUtil.java

示例11: setStartPoint

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public void setStartPoint(ReadableArray startPoint) {
    mStartPoint = new float[]{(float) startPoint.getDouble(0), (float) startPoint.getDouble(1)};
}
 
开发者ID:svbutko,项目名称:react-native-text-gradient,代码行数:4,代码来源:TextGradientView.java

示例12: setEndPoint

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public void setEndPoint(ReadableArray endPoint) {
    mEndPoint = new float[]{(float) endPoint.getDouble(0), (float) endPoint.getDouble(1)};
}
 
开发者ID:svbutko,项目名称:react-native-text-gradient,代码行数:4,代码来源:TextGradientView.java

示例13: processTransform

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
public static void processTransform(ReadableArray transforms, double[] result) {
  double[] helperMatrix = sHelperMatrix.get();
  MatrixMathHelper.resetIdentityMatrix(result);

  for (int transformIdx = 0, size = transforms.size(); transformIdx < size; transformIdx++) {
    ReadableMap transform = transforms.getMap(transformIdx);
    String transformType = transform.keySetIterator().nextKey();

    MatrixMathHelper.resetIdentityMatrix(helperMatrix);
    if ("matrix".equals(transformType)) {
      ReadableArray matrix = transform.getArray(transformType);
      for (int i = 0; i < 16; i++) {
        helperMatrix[i] = matrix.getDouble(i);
      }
    } else if ("perspective".equals(transformType)) {
      MatrixMathHelper.applyPerspective(helperMatrix, transform.getDouble(transformType));
    } else if ("rotateX".equals(transformType)) {
      MatrixMathHelper.applyRotateX(
        helperMatrix,
        convertToRadians(transform, transformType));
    } else if ("rotateY".equals(transformType)) {
      MatrixMathHelper.applyRotateY(
        helperMatrix,
        convertToRadians(transform, transformType));
    } else if ("rotate".equals(transformType) || "rotateZ".equals(transformType)) {
      MatrixMathHelper.applyRotateZ(
        helperMatrix,
        convertToRadians(transform, transformType));
    } else if ("scale".equals(transformType)) {
      double scale = transform.getDouble(transformType);
      MatrixMathHelper.applyScaleX(helperMatrix, scale);
      MatrixMathHelper.applyScaleY(helperMatrix, scale);
    } else if ("scaleX".equals(transformType)) {
      MatrixMathHelper.applyScaleX(helperMatrix, transform.getDouble(transformType));
    } else if ("scaleY".equals(transformType)) {
      MatrixMathHelper.applyScaleY(helperMatrix, transform.getDouble(transformType));
    } else if ("translate".equals(transformType)) {
      ReadableArray value = transform.getArray(transformType);
      double x = value.getDouble(0);
      double y = value.getDouble(1);
      double z = value.size() > 2 ? value.getDouble(2) : 0d;
      MatrixMathHelper.applyTranslate3D(helperMatrix, x, y, z);
    } else if ("translateX".equals(transformType)) {
      MatrixMathHelper.applyTranslate2D(helperMatrix, transform.getDouble(transformType), 0d);
    } else if ("translateY".equals(transformType)) {
      MatrixMathHelper.applyTranslate2D(helperMatrix, 0d, transform.getDouble(transformType));
    } else if ("skewX".equals(transformType)) {
      MatrixMathHelper.applySkewX(
        helperMatrix,
        convertToRadians(transform, transformType));
    } else if ("skewY".equals(transformType)) {
      MatrixMathHelper.applySkewY(
        helperMatrix,
        convertToRadians(transform, transformType));
    } else {
      throw new JSApplicationIllegalArgumentException("Unsupported transform type: "
        + transformType);
    }

    MatrixMathHelper.multiplyInto(result, result, helperMatrix);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:63,代码来源:TransformHelper.java

示例14: for

import com.facebook.react.bridge.ReadableArray; //导入方法依赖的package包/类
/**
 * Converts given {@link ReadableArray} to an array of {@code float}. Writes result to the array
 * passed in {@param into}. This method will write to the output array up to the number of items
 * from the input array. If the input array is longer than output the remaining part of the input
 * will not be converted.
 *
 * @param value input array
 * @param into output array
 * @return number of items copied from input to the output array
 */
/*package*/ static int toFloatArray(ReadableArray value, float[] into) {
  int length = value.size() > into.length ? into.length : value.size();
  for (int i = 0; i < length; i++) {
    into[i] = (float) value.getDouble(i);
  }
  return value.size();
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:18,代码来源:PropHelper.java


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