edu.isi.karma.rep.Node.getHNodeId()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中edu.isi.karma.rep.Node.getHNodeId()方法的一些代码示例,展示了Node.getHNodeId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getHNodeId()方法的具体详情如下:
包路径:edu.isi.karma.rep.Node
类名称:Node
方法名:getHNodeId

Node.getHNodeId介绍

暂无

代码示例

代码示例来源:origin: usc-isi-i2/Web-Karma

void addNode(Node node) {
  nodes.put(node.getHNodeId(), node);
  // mariam
  node.setBelongsToRow(this);
}

代码示例来源:origin: usc-isi-i2/Web-Karma

HashMap<String, String> vals = new HashMap<>();
for (Node n : r.getNodes()) {
  vals.put(n.getHNodeId(), n.getValue().asString());

代码示例来源:origin: usc-isi-i2/Web-Karma

private static String getHashValueRecurse(Row row, List<String> HNodeIds) {
  List<String> hashString = new ArrayList<>();
  for (String HNodeid : HNodeIds) {
    Node n = row.getNode(HNodeid);
    if (n.hasNestedTable()) {
      Table nestedTable = n.getNestedTable();
      for (Row nestedRow : nestedTable.getRows(0, nestedTable.getNumRows(), SuperSelectionManager.DEFAULT_SELECTION)) {
        List<String> ids = new ArrayList<>();
        for (Node node : nestedRow.getNodes()) {
          ids.add(node.getHNodeId());
        }
        hashString.add(getHashValue(nestedRow, ids));                
      }
    }
    else {
      Map<String, String> tmp = hashTable.get(row.getId());
      
      hashString.add(tmp.get(n.getId()));
    }
  }
  Collections.sort(hashString);
  String hash = "";
  for (String t : hashString) {
    hash += t; 
  }
  return hash;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

private void populatePolygons(List<String> coordinateHNodeIds,
    ArrayList<Row> rows, Map<String, String> columnNameMap) {
  for (Row row : rows) {
    try {
      String posList = row.getNode(coordinateHNodeIds.get(0))
          .getValue().asString();
      WKTReader reader = new WKTReader();
      Polygon JTSPolygon = (Polygon)reader.read(posList);
      if(JTSPolygon == null) continue;
      polygons.add(JTSPolygon);
      FeatureTable featureTable = new FeatureTable();
      Collection<Node> nodes = row.getNodes();
      for (Node node : nodes) {
        if (!(coordinateHNodeIds.contains(node.getHNodeId()))
            && !(node.hasNestedTable())) {
          featureTable.addColumnToDescription(columnNameMap.get(node
              .getHNodeId()), node.getValue().asString());
        }
      }
      polygonTable.add(featureTable);
    } catch (Exception e) {
      logger.error("Error creating line! Skipping it.", e);
      continue;
    }
  }
}
private void populateLines(List<String> coordinateHNodeIds,

代码示例来源:origin: usc-isi-i2/Web-Karma

if (!(coordinateHNodeIds.contains(node.getHNodeId()))
    && !(node.hasNestedTable())) {
  point.addColumnToDescription(columnNameMap.get(node
      .getHNodeId()), node.getValue().asString());

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer doIt(Workspace workspace) throws CommandException {
  Node node = workspace.getFactory().getNode(nodeIdArg);
  SuperSelection sel = getSuperSelection(workspace);
  inputColumns.clear();
  outputColumns.clear();
  inputColumns.add(node.getHNodeId());
  outputColumns.add(node.getHNodeId());
  previousValue = node.getValue();
  previousStatus = node.getStatus();
  if (node.hasNestedTable()) {
    throw new CommandException(this, "Cell " + nodeIdArg
        + " has a nested table. It cannot be edited.");
  }        
  node.setValue(newValueArg, Node.NodeStatus.edited,
      workspace.getFactory());
  WorksheetUpdateFactory.detectSelectionStatusChange(worksheetId, workspace, this);
  UpdateContainer uc = WorksheetUpdateFactory.createWorksheetHierarchicalAndCleaningResultsUpdates(worksheetId, sel, workspace.getContextId());
  uc.add(new NodeChangedUpdate(worksheetId,
      nodeIdArg, newValueArg, Node.NodeStatus.edited));
  return uc;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

Collection<Node> nodes = row.getNodes();
for (Node node : nodes) {
  if (!(coordinateHNodeIds.contains(node.getHNodeId()))
      && !(node.hasNestedTable())) {
    line.addColumnToDescription(columnNameMap.get(node
        .getHNodeId()), node.getValue().asString());

代码示例来源:origin: usc-isi-i2/Web-Karma

private static void computeHashValue(Row row, List<String> HNodeIds) {
  for (String HNodeid : HNodeIds) {
    Node n = row.getNode(HNodeid);
    if (n.hasNestedTable()) {
      Table nestedTable = n.getNestedTable();
      for (Row nestedRow : nestedTable.getRows(0, nestedTable.getNumRows(), SuperSelectionManager.DEFAULT_SELECTION)) {
        List<String> ids = new ArrayList<>();
        for (Node node : nestedRow.getNodes()) {
          ids.add(node.getHNodeId());
        }
        computeHashValue(nestedRow, ids);
      }
    }
    else {
      Map<String, String> tmp = hashTable.get(row.getId());
      if (tmp == null) 
        tmp = new ConcurrentHashMap<>();
      String value = n.getValue().asString();
      value = DigestUtils.shaHex(value);
      tmp.put(n.getId(), value);
      hashTable.put(row.getId(), tmp);
    }
  }
  
}

代码示例来源:origin: usc-isi-i2/Web-Karma

private boolean addValues(Node node, String value, RepFactory factory, Table table) {
  Worksheet worksheet = factory.getWorksheet(worksheetId);
  SuperSelection selection = getSuperSelection(worksheet);
  boolean flag = true;
  if (table != null) {
    for (Row r : table.getRows(0, table.getNumRows(), selection)) {
      Node n = r.getNeighbor(node.getHNodeId());
      if (n.getValue() != null && n.getValue().asString().compareTo(value) == 0) { 
        flag = false;
        break;
      }
    }
  }
  if (flag)
    node.setValue(value, NodeStatus.original, factory);
  return flag;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer undoIt(Workspace workspace) {
  for (Node node : affectedNodes) {
    HNode hNode = workspace.getFactory().getHNode(node.getHNodeId());
    hNode.removeNestedTable();
    node.setNestedTable(null, workspace.getFactory());
    node.clearValue(NodeStatus.original);
  }
  affectedNodes.clear();
  try {
    if(previousPythonTransformationCommand instanceof SubmitPythonTransformationCommand)
    {
      SubmitPythonTransformationCommand prevCommand = (SubmitPythonTransformationCommand)previousPythonTransformationCommand;
      //Previous python command exists, lets reset the values, and then start again
      prevCommand.resetColumnValues(workspace);
    }
    UpdateContainer uc = previousPythonTransformationCommand.doIt(workspace);
    return uc;
  } catch (CommandException e) {
    return new UpdateContainer(new ErrorUpdate("Error occured while  applying previous Python transformation to the column."));
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

public void addNestedTableToDataTable(HNode hNode, Table table,
    RepFactory factory) {
  Node node = getNode(hNode.getId());
  if (node != null) {
    // This table does contain this hNode.
    Table nestedTable = factory.createTable(hNode.getNestedTable()
        .getId(), getWorksheetId());
    node.setNestedTable(nestedTable, factory);
    // If the node has a value, we have to move the value to the
    // nestedTable given that we cannot have both.
    if (!node.getValue().isEmptyValue()) {
      logger.info("While adding nested table, found that column '"
          + factory.getColumnName(hNode.getId())
          + "' has a value: '" + node.getValue().asString()
          + "'.");
      logger.info("Emptying value in node and trying to move it to the nested table.");
      nestedTable.addOrphanValue(node.getValue(), node.getHNodeId(),
          factory);
    }
  } else {
    // The node may be in one of the nested tables. We have to look for
    // it.
    for (Node n : nodes.values()) {
      Table nestedTable = n.getNestedTable();
      if (nestedTable != null) {
        nestedTable.addNestedTableToDataTable(hNode, factory);
      }
    }
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

@Override
public UpdateContainer undoIt(Workspace workspace) {
  for (Node node : affectedNodes) {
    HNode hNode = workspace.getFactory().getHNode(node.getHNodeId());
    hNode.removeNestedTable();
    node.setNestedTable(null, workspace.getFactory());

相关文章