當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。