private void addPosition(final Element parentElement, final Position position, final String elementName) { final Element element = parentElement.getOwnerDocument().createElement(elementName); element.setAttribute("x", String.valueOf(position.getX())); element.setAttribute("y", String.valueOf(position.getY())); parentElement.appendChild(element); }
/** * Creates a PositionDTO from the specified position * * @param position position * @return dto */ public PositionDTO createPositionDto(final Position position) { return new PositionDTO(position.getX(), position.getY()); }
private static Position scalePosition(Position position, double factorX, double factorY) { return new Position(position.getX() * factorX, position.getY() * factorY); }
public Position mapPosition(final org.apache.nifi.connectable.Position pos) { final Position position = new Position(); position.setX(pos.getX()); position.setY(pos.getY()); return position; }
Position p = rm.getMap().get(ID); this.table1.setValueAt(result_short, p.getX(), p.getY());
/** * A board represents all of the locations in the matrix. It provides a simple interface to getting * the value in a position, and tracking the height and width of the matrix. */ public class Board { final int [][] board; public Board(int[][] board) { this.board = board; } final int positionValue(Position position) { return this.board[position.getY()][position.getX()]; } final int getWidth() { return board[0].length; } final int getHeight() { return board.length; } }
return new Position(start.getX() + this.incrementX, start.getY() + this.incrementY);
public PathTile[] getAdjacent(Position p) { PathTile[] nodes = new PathTile[8]; int x = p.getX(); int y = p.getY(); PathTile old = null; if (holdingList.size() > 0) old = holdingList.get(holdingList.size() - 1); for(Direction d: Direction.values()){ newNode = new Position(x+ d.x, y + d.y, p.getZ()); //top centre if (!open.contains(newNode)) open.add(newNode); h = OctileValue(newNode); g = d.cost; nodes[d.ordinal()] = new PathTile(newNode, g, h, old); } return nodes; }