public Label getLabelAtAddress(int address) { for (Label lb : stmtToLabel.values()) { if (lb.isPlaced() && lb.getCodeAddress() == address) { return lb; } } return null; }
@Override public boolean add(@Nonnull Label label) { if (label.isPlaced()) { throw new IllegalArgumentException("Cannot add a label that is already placed. You must remove " + "it from its current location first."); } label.location = MethodLocation.this; getLabels(true).add(label); return true; } };
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }
/** * Adds a new named label at the current location. * * Any previous unplaced references to a label of this name will now refer to this label/location * * @param name The name of the label to add * @return A LabelRef representing the label */ @Nonnull public Label addLabel(@Nonnull String name) { Label label = labels.get(name); if (label != null) { if (label.isPlaced()) { throw new IllegalArgumentException("There is already a label with that name."); } else { currentLocation.getLabels().add(label); } } else { label = currentLocation.addNewLabel(); labels.put(name, label); } return label; }