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


Java JSONArray.getJSONArray方法代码示例

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


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

示例1: selectCells

import org.json.JSONArray; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") public void selectCells(TableView<?> tableView, String value) {
    @SuppressWarnings("rawtypes")
    TableViewSelectionModel selectionModel = tableView.getSelectionModel();
    selectionModel.clearSelection();
    JSONObject cells = new JSONObject(value);
    JSONArray object = (JSONArray) cells.get("cells");
    for (int i = 0; i < object.length(); i++) {
        JSONArray jsonArray = object.getJSONArray(i);
        int rowIndex = Integer.parseInt(jsonArray.getString(0));
        int columnIndex = getColumnIndex(jsonArray.getString(1));
        @SuppressWarnings("rawtypes")
        TableColumn column = tableView.getColumns().get(columnIndex);
        if (getVisibleCellAt(tableView, rowIndex, columnIndex) == null) {
            tableView.scrollTo(rowIndex);
            tableView.scrollToColumn(column);
        }
        selectionModel.select(rowIndex, column);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:JavaFXElementPropertyAccessor.java

示例2: readPolygon

import org.json.JSONArray; //导入方法依赖的package包/类
private Polygon readPolygon(JSONArray value)
{
    int n = value.length();

    LinearRing shell = null;
    LinearRing[] holes = new LinearRing[n-1];

    for (int i = 0; i < n; i++)
    {
        JSONArray arrLineString = value.getJSONArray(i);
        if (i == 0)
            shell = factory.createLinearRing(readCoordinates(arrLineString));
        else
            holes[i-1] = factory.createLinearRing(readCoordinates(arrLineString));
    }

    if (holes == null || holes.length == 0)
        return factory.createPolygon(shell);
    else
        return factory.createPolygon(shell, holes);
}
 
开发者ID:GIScience,项目名称:openrouteservice-tools,代码行数:22,代码来源:BorderPolygonTask.java

示例3: readPolygon

import org.json.JSONArray; //导入方法依赖的package包/类
private static Polygon readPolygon(JSONArray value)
{
	int n = value.length();
	
	LinearRing shell = null;
	LinearRing[] holes = new LinearRing[n-1];

	for (int i = 0; i < n; i++)
	{
		JSONArray arrLineString = value.getJSONArray(i);
		if (i == 0)
			shell = factory.createLinearRing(readCoordinates(arrLineString));
		else
			holes[i-1] = factory.createLinearRing(readCoordinates(arrLineString));
	}

	if (holes == null || holes.length == 0)
		return factory.createPolygon(shell);
	else
		return factory.createPolygon(shell, holes);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:22,代码来源:GeometryJSON.java

示例4: setTagsWithAlias

import org.json.JSONArray; //导入方法依赖的package包/类
public static void setTagsWithAlias(JSONArray data, CallbackContext callbackContext) {
  HashSet<String> tags = new HashSet<String>();
  String alias;
  try {
    alias = data.getString(0);
    JSONArray tagsArray = data.getJSONArray(1);
    for (int i = 0; i < tagsArray.length(); i++) {
      tags.add(tagsArray.getString(i));
    }
    JPushInterface.setAliasAndTags(cordovaCxt,
      alias, tags, mTagWithAliasCallback);

  } catch (JSONException e) {
    e.printStackTrace();
    callbackContext.error("Error reading tagAlias JSON");
  }
}
 
开发者ID:pengkobe,项目名称:nxtpush-cordova-plugin,代码行数:18,代码来源:JPushUtil.java

示例5: constructReportList

import org.json.JSONArray; //导入方法依赖的package包/类
protected List<Report> constructReportList(String data)
    throws NoSuchFieldException, IllegalAccessException {
  if(Constants.NULL.equals(data)) {
    return null;
  }
  JSONObject jsonObject = new JSONObject(data);
  if (jsonObject.has(ROWS)) {
    List<Report> reports = new ArrayList<>();
    JSONArray headings = jsonObject.getJSONArray(HEADINGS);
    List<Field> fields = new ArrayList<>(headings.length());
    for (int j = 0; j < headings.length(); j++) {
      fields.add(Report.class.getDeclaredField(headings.getString(j)));
    }
    JSONArray results = jsonObject.getJSONArray(ROWS);
    for (int i = 0; i < results.length(); i++) {
      JSONArray row = results.getJSONArray(i);
      reports.add(constructReport(fields, row));
    }
    return reports;
  }
  return null;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:23,代码来源:ReportServiceUtil.java

示例6: readMultiLineString

import org.json.JSONArray; //导入方法依赖的package包/类
private MultiLineString readMultiLineString(JSONArray value)
{
    int n = value.length();
    LineString[] lineStrings = new LineString[n];

    for (int i = 0; i < n; i++)
    {
        JSONArray arrLineString = value.getJSONArray(i);
        lineStrings[i] = readLineString(arrLineString);
    }

    return factory.createMultiLineString(lineStrings);
}
 
开发者ID:GIScience,项目名称:openrouteservice-tools,代码行数:14,代码来源:BorderTask.java

示例7: getPlayerWords

import org.json.JSONArray; //导入方法依赖的package包/类
@SuppressWarnings("SameParameterValue")
private static String[] getPlayerWords(String data, String name) {
    String[] words = new String[2];
    if (data != null) {
        try {
            JSONObject jsonObject = new JSONObject(data);
            JSONArray jsonArray = jsonObject.getJSONArray(name);
            if (jsonArray != null) {
                int index;
                if (jsonArray.length() > 1) {
                    index = getRandomNum(jsonArray.length() - 1);
                } else if (jsonArray.length() == 1) {
                    index = 0;
                } else {
                    return null;
                }
                int id = getRandomNum(1);
                JSONArray jsonArray_words = jsonArray.getJSONArray(index);
                words[Config.PLAYER_WORD_SPY] = jsonArray_words.getString(id);
                if (id == 0) {
                    id = 1;
                } else {
                    id = 0;
                }
                words[Config.PLAYER_WORD_NORMAL] = jsonArray_words.getString(id);
                return words;
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    return null;
}
 
开发者ID:XFY9326,项目名称:CatchSpy,代码行数:34,代码来源:WordMethod.java

示例8: ripVideos

import org.json.JSONArray; //导入方法依赖的package包/类
private void ripVideos() throws IOException {
    String oid = getGID(this.url).replace("videos", "");
    String u = "http://vk.com/al_video.php";
    Map<String,String> postData = new HashMap<>();
    postData.put("al", "1");
    postData.put("act", "load_videos_silent");
    postData.put("offset", "0");
    postData.put("oid", oid);
    Document doc = Http.url(u)
                       .referrer(this.url)
                       .ignoreContentType()
                       .data(postData)
                       .post();
    String[] jsonStrings = doc.toString().split("<!>");
    JSONObject json = new JSONObject(jsonStrings[jsonStrings.length - 1]);
    JSONArray videos = json.getJSONArray("all");
    logger.info("Found " + videos.length() + " videos");
    for (int i = 0; i < videos.length(); i++) {
        JSONArray jsonVideo = videos.getJSONArray(i);
        int vidid = jsonVideo.getInt(1);
        String videoURL = com.rarchives.ripme.ripper.rippers.video.VkRipper.getVideoURLAtPage(
                "http://vk.com/video" + oid + "_" + vidid);
        String prefix = "";
        if (Utils.getConfigBoolean("download.save_order", true)) {
            prefix = String.format("%03d_", i + 1);
        }
        addURLToDownload(new URL(videoURL), prefix);
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            logger.error("Interrupted while waiting to fetch next video URL", e);
            break;
        }
    }
    waitForThreads();
}
 
开发者ID:RipMeApp,项目名称:ripme,代码行数:37,代码来源:VkRipper.java

示例9: readMultiPolygon

import org.json.JSONArray; //导入方法依赖的package包/类
private static MultiPolygon readMultiPolygon(JSONArray value)
{	
	int n = value.length();
	Polygon[] polys = new Polygon[n];

	for (int i = 0; i < n; i++)
	{
		JSONArray arrPoly = value.getJSONArray(i);
		polys[i] = readPolygon(arrPoly);
	}

	return factory.createMultiPolygon(polys);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:14,代码来源:GeometryJSON.java

示例10: parseSwitchFaceJson

import org.json.JSONArray; //导入方法依赖的package包/类
public static SwitchFaceInfo parseSwitchFaceJson(String paramString)
        throws JSONException {
    SwitchFaceInfo localSwitchFaceInfo = new SwitchFaceInfo();
    JSONObject localJSONObject = new JSONObject(paramString);

    localSwitchFaceInfo.bP = localJSONObject.getString("tips");
    localSwitchFaceInfo.bQ = localJSONObject.optInt("soundPlayMode");
    localSwitchFaceInfo.bS = localJSONObject.optString("audio");
    localSwitchFaceInfo.cw = localJSONObject.getInt("count");
    localSwitchFaceInfo.cv = new ArrayList();

    JSONArray localJSONArray1 = localJSONObject.getJSONArray("reslist");
    localSwitchFaceInfo.bR = new String[localJSONArray1.length()];
    for (int i = 0; i < localJSONArray1.length(); i++) {
        localSwitchFaceInfo.bR[i] = localJSONArray1.getString(i);
    }
    JSONArray localJSONArray2 = localJSONObject.getJSONArray("pointIndexArray");
    for (int j = 0; j < localJSONArray2.length(); j++) {
        if (j < localSwitchFaceInfo.cw) {
            JSONArray localJSONArray3 = localJSONArray2.getJSONArray(j);
            for (int k = 0; k < localJSONArray3.length(); k++) {
                SwitchFaceInfo.a locala = new SwitchFaceInfo.a();
                locala.cx = j;
                locala.cy = localJSONArray3.getInt(k);
                localSwitchFaceInfo.cv.add(locala);
            }
        }
    }
    return localSwitchFaceInfo;
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:31,代码来源:FilterFactory.java

示例11: a

import org.json.JSONArray; //导入方法依赖的package包/类
static GroupData a(String paramString, JSONObject paramJSONObject)
        throws JSONException, IOException {
    GroupData locala = new GroupData();
    locala.name = paramJSONObject.getString("foldername");
    locala.cN = paramJSONObject.getInt("maxcount");
    locala.ee = paramJSONObject.getInt("resloadtype");
    locala.bS = paramJSONObject.getString("audio");
    locala.bQ = paramJSONObject.getInt("soundPlayMode");
    locala.di = paramJSONObject.getInt("triggerType");

    locala.cv = new ArrayList();
    JSONArray localJSONArray1 = paramJSONObject.getJSONArray("pointindexarray");
    for (int i = 0; i < localJSONArray1.length(); i++) {
        JSONArray localJSONArray3 = localJSONArray1.getJSONArray(i);
        for (int k = 0; k < localJSONArray3.length(); k++) {
            GroupData.b locala1 = new GroupData.b();
            locala1.cx = i;
            locala1.cy = localJSONArray3.getInt(k);
            locala.cv.add(locala1);
        }
    }
    locala.bO = new float[8];
    JSONArray localJSONArray2 = paramJSONObject.getJSONArray("timeparam");
    for (int j = 0; j < 8; j++) {
        locala.bO[j] = ((float) localJSONArray2.getDouble(j));
    }
    JSONArray localJSONArray4 = paramJSONObject.getJSONArray("reslist");
    locala.ed = new ArrayList();
    for (int k = 0; k < localJSONArray4.length(); k++) {
        locala.ed.add(localJSONArray4.getString(k));
    }
    File localFile = new File(paramString + "/" + locala.name, "glsl");
    locala.bN = IOUtils.convertStreamToString(new FileInputStream(localFile));
    return locala;
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:36,代码来源:FilterFactory.java

示例12: readMultiPolygon

import org.json.JSONArray; //导入方法依赖的package包/类
private MultiPolygon readMultiPolygon(JSONArray value)
{
    int n = value.length();
    Polygon[] polys = new Polygon[n];

    for (int i = 0; i < n; i++)
    {
        JSONArray arrPoly = value.getJSONArray(i);
        polys[i] = readPolygon(arrPoly);
    }

    return factory.createMultiPolygon(polys);
}
 
开发者ID:GIScience,项目名称:openrouteservice-tools,代码行数:14,代码来源:BorderPolygonTask.java

示例13: execute

import org.json.JSONArray; //导入方法依赖的package包/类
/**
 * Executes the request and returns PluginResult.
 *
 * @param action            The action to execute.
 * @param args              JSONArray of arguments for the plugin.
 * @param callbackContext   The callback context used when calling back into JavaScript.
 * @return                  True when the action was valid, false otherwise.
 */
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
    if (action.equals("vibrate")) {
        this.vibrate(args.getLong(0));
    }
    else if (action.equals("vibrateWithPattern")) {
        JSONArray pattern = args.getJSONArray(0);
        int repeat = args.getInt(1);
        //add a 0 at the beginning of pattern to align with w3c
        long[] patternArray = new long[pattern.length()+1];
        patternArray[0] = 0;
        for (int i = 0; i < pattern.length(); i++) {
            patternArray[i+1] = pattern.getLong(i);
        }
        this.vibrateWithPattern(patternArray, repeat);
    }
    else if (action.equals("cancelVibration")) {
        this.cancelVibration();
    }
    else {
        return false;
    }

    // Only alert and confirm are async.
    callbackContext.success();

    return true;
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:36,代码来源:Vibration.java

示例14: readCoordinates

import org.json.JSONArray; //导入方法依赖的package包/类
private static Coordinate[] readCoordinates(JSONArray value)
{
	int n = value.length();

	Coordinate[] coords = new Coordinate[n];

	for (int i = 0; i < n; i++)
	{
		JSONArray arrCoord = value.getJSONArray(i);
		coords[i] = new Coordinate(arrCoord.getDouble(0), arrCoord.getDouble(1));
	}

	return coords;
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:15,代码来源:GeometryJSON.java

示例15: search

import org.json.JSONArray; //导入方法依赖的package包/类
private void search(JSONArray args) throws JSONException
{
    final JSONArray filter = args.getJSONArray(0);
    final JSONObject options = args.get(1) == null ? null : args.getJSONObject(1);
    this.cordova.getThreadPool().execute(new Runnable() {
        public void run() {
            JSONArray res = contactAccessor.search(filter, options);
            callbackContext.success(res);
        }
    });
}
 
开发者ID:rodrigonsh,项目名称:alerta-fraude,代码行数:12,代码来源:ContactManager.java


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