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


Java XppReader.getNodeName方法代码示例

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


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

示例1: parseCallSignature

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
public static PySignature parseCallSignature(String payload) throws PyDebuggerException {
  final XppReader reader = openReader(payload, true);
  reader.moveDown();
  if (!"call_signature".equals(reader.getNodeName())) {
    throw new PyDebuggerException("Expected <call_signature>, found " + reader.getNodeName());
  }
  final String file = readString(reader, "file", "");
  final String name = readString(reader, "name", "");
  PySignature signature = new PySignature(file, name);

  while (reader.hasMoreChildren()) {
    reader.moveDown();
    if (!"arg".equals(reader.getNodeName())) {
      throw new PyDebuggerException("Expected <arg>, found " + reader.getNodeName());
    }
    signature.addArgument(readString(reader, "name", ""), readString(reader, "type", ""));
    reader.moveUp();
  }

  return signature;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProtocolParser.java

示例2: parseThread

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
@NotNull
public static PyThreadInfo parseThread(final String text, final PyPositionConverter positionConverter) throws PyDebuggerException {
  final XppReader reader = openReader(text, true);
  reader.moveDown();
  if (!"thread".equals(reader.getNodeName())) {
    throw new PyDebuggerException("Expected <thread>, found " + reader.getNodeName());
  }

  final String id = readString(reader, "id", null);
  final String name = readString(reader, "name", "");
  final int stopReason = readInt(reader, "stop_reason", 0);
  String message = readString(reader, "message", "None");
  if ("None".equals(message)) {
    message = null;
  }

  final List<PyStackFrameInfo> frames = new LinkedList<PyStackFrameInfo>();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    frames.add(parseFrame(reader, id, positionConverter));
    reader.moveUp();
  }

  return new PyThreadInfo(id, name, frames, stopReason, message);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ProtocolParser.java

示例3: parseReferrers

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
@NotNull
public static List<PyDebugValue> parseReferrers(final String text, final PyFrameAccessor frameAccessor) throws PyDebuggerException {
  final List<PyDebugValue> values = new LinkedList<PyDebugValue>();

  final XppReader reader = openReader(text, false);

  while (reader.hasMoreChildren()) {
    reader.moveDown();
    if (reader.getNodeName().equals("var")) {
      PyDebugValue value = parseValue(reader, frameAccessor);
      value.setId(readString(reader, "id", null));
      values.add(value);
    }
    else if (reader.getNodeName().equals("for")) {
      //TODO
    }
    else {
      throw new PyDebuggerException("Expected <var> or <for>, found " + reader.getNodeName());
    }
    reader.moveUp();
  }

  return values;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProtocolParser.java

示例4: parseValue

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
private static PyDebugValue parseValue(final XppReader reader, PyFrameAccessor frameAccessor) throws PyDebuggerException {
  if (!"var".equals(reader.getNodeName())) {
    throw new PyDebuggerException("Expected <var>, found " + reader.getNodeName());
  }

  final String name = readString(reader, "name", null);
  final String type = readString(reader, "type", null);
  String value = readString(reader, "value", null);
  final String isContainer = readString(reader, "isContainer", "");
  final String isErrorOnEval = readString(reader, "isErrorOnEval", "");

  if (value.startsWith(type + ": ")) {  // drop unneeded prefix
    value = value.substring(type.length() + 2);
  }

  return new PyDebugValue(name, type, value, "True".equals(isContainer), "True".equals(isErrorOnEval), frameAccessor);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ProtocolParser.java

示例5: parseArrayValues

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
public static ArrayChunk parseArrayValues(final String text, final PyFrameAccessor frameAccessor) throws PyDebuggerException {
  final XppReader reader = openReader(text, false);
  ArrayChunk result = null;
  if (reader.hasMoreChildren()) {
    reader.moveDown();
    if (!"array".equals(reader.getNodeName())) {
      throw new PyDebuggerException("Expected <array> at first node, found " + reader.getNodeName());
    }
    String slice = readString(reader, "slice", null);
    int rows = readInt(reader, "rows", null);
    int cols = readInt(reader, "cols", null);
    String format = "%" + readString(reader, "format", null);
    String type = readString(reader, "type", null);
    String max = readString(reader, "max", null);
    String min = readString(reader, "min", null);
    result =
      new ArrayChunk(new PyDebugValue(slice, null, null, false, false, frameAccessor), slice, rows, cols, max, min, format, type, null);
    reader.moveUp();
  }

  Object[][] data = parseArrayValues(reader, frameAccessor);
  return new ArrayChunk(result.getValue(), result.getSlicePresentation(), result.getRows(), result.getColumns(), result.getMax(),
                        result.getMin(), result.getFormat(), result.getType(), data);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ProtocolParser.java

示例6: parseIo

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
public static PyIo parseIo(final String text) throws PyDebuggerException {
  final XppReader reader = openReader(text, true);
  reader.moveDown();
  if (!"io".equals(reader.getNodeName())) {
    throw new PyDebuggerException("Expected <io>, found " + reader.getNodeName());
  }
  final String s = readString(reader, "s", "");
  final int ctx = readInt(reader, "ctx", 1);
  return new PyIo(s, ctx);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ProtocolParser.java

示例7: parseFrame

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
private static PyStackFrameInfo parseFrame(final XppReader reader, final String threadId, final PyPositionConverter positionConverter)
  throws PyDebuggerException {
  if (!"frame".equals(reader.getNodeName())) {
    throw new PyDebuggerException("Expected <frame>, found " + reader.getNodeName());
  }

  final String id = readString(reader, "id", null);
  final String name = readString(reader, "name", null);
  final String file = readString(reader, "file", null);
  final int line = readInt(reader, "line", 0);

  return new PyStackFrameInfo(threadId, id, name, positionConverter.create(file, line));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ProtocolParser.java

示例8: parseConcurrencyEvent

import com.thoughtworks.xstream.io.xml.XppReader; //导入方法依赖的package包/类
public static PyConcurrencyEvent parseConcurrencyEvent(String payload,
                                                       final PyPositionConverter positionConverter) throws PyDebuggerException {
  final XppReader reader = openReader(payload, true);
  reader.moveDown();
  String eventName = reader.getNodeName();
  boolean isAsyncio;
  if (eventName.equals("threading_event")) {
    isAsyncio = false;
  } else if (eventName.equals("asyncio_event")) {
    isAsyncio = true;
  } else {
    throw new PyDebuggerException("Expected <threading_event> or <asyncio_event>, found " + reader.getNodeName());
  }

  final Long time = Long.parseLong(readString(reader, "time", ""));
  final String name = readString(reader, "name", "");
  final String thread_id = readString(reader, "thread_id", "");
  final String type = readString(reader, "type", "");
  PyConcurrencyEvent threadingEvent;
  if (type.equals("lock")) {
    String lock_id = readString(reader, "lock_id", "0");
    threadingEvent = new PyLockEvent(time, thread_id, name, lock_id, isAsyncio);
  }
  else if (type.equals("thread")) {
    String parentThread = readString(reader, "parent", "");
    if (!parentThread.isEmpty()) {
      threadingEvent = new PyThreadEvent(time, thread_id, name, parentThread, isAsyncio);
    } else {
      threadingEvent = new PyThreadEvent(time, thread_id, name, isAsyncio);
    }
  }
  else {
    throw new PyDebuggerException("Unknown type " + type);
  }

  final String eventType = readString(reader, "event", "");
  if (eventType.equals("__init__")) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.CREATE);
  }
  else if (eventType.equals("start")) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.START);
  }
  else if (eventType.equals("join")) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.JOIN);
  }
  else if (eventType.equals("stop")) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.STOP);
  }
  else if (eventType.equals("acquire_begin") || eventType.equals("__enter___begin")
           || (eventType.equals("get_begin")) || (eventType.equals("put_begin"))) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.ACQUIRE_BEGIN);
  }
  else if (eventType.equals("acquire_end") || eventType.equals("__enter___end")
           || (eventType.equals("get_end")) || (eventType.equals("put_end"))) {
    threadingEvent.setType(PyConcurrencyEvent.EventType.ACQUIRE_END);
  }
  else if (eventType.startsWith("release") || eventType.startsWith("__exit__")) {
    // we record release begin and end on the Python side, but it is not important info
    // for user. Maybe use it later
    threadingEvent.setType(PyConcurrencyEvent.EventType.RELEASE);
  }
  else {
    throw new PyDebuggerException("Unknown event " + eventType);
  }

  threadingEvent.setFileName(readString(reader, "file", ""));
  threadingEvent.setLine(Integer.parseInt(readString(reader, "line", "")) - 1);
  reader.moveUp();

  final List<PyStackFrameInfo> frames = new LinkedList<PyStackFrameInfo>();
  while (reader.hasMoreChildren()) {
    reader.moveDown();
    frames.add(parseFrame(reader, thread_id, positionConverter));
    reader.moveUp();
  }
  threadingEvent.setFrames(frames);
  return threadingEvent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:79,代码来源:ProtocolParser.java


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