Skip to content

Commit

Permalink
methods get_block_item, get_block, get_node return const reference to…
Browse files Browse the repository at this point in the history
… the desired element by now
  • Loading branch information
kocotom committed Mar 28, 2024
1 parent ca925ac commit 4a9d255
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/mata/utils/partition-relation-pair.hh
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ class Partition {
std::vector<State> states_in_same_block(State state) const;

// accessing blockItems, blocks, nodes through indices
BlockItem get_block_item(size_t block_item_idx) const;
Block get_block(size_t block_idx) const;
Node get_node(size_t node_idx) const;
const BlockItem& get_block_item(size_t block_item_idx) const;
const Block& get_block(size_t block_idx) const;
const Node& get_node(size_t node_idx) const;

// refering between blockItems, blocks, nodes using indices
size_t get_block_idx_from_state(State state) const;
Expand Down Expand Up @@ -387,7 +387,7 @@ Partition::Partition(const Partition& other) {
* @param block_item_idx index of the BlockItem
* @return corresponding BlockItem
*/
BlockItem Partition::get_block_item(size_t block_item_idx) const {
const BlockItem& Partition::get_block_item(size_t block_item_idx) const {
assert(block_item_idx < num_of_block_items() &&
"Nonexisting block item index used.");
return block_items_[block_item_idx];
Expand All @@ -398,7 +398,7 @@ BlockItem Partition::get_block_item(size_t block_item_idx) const {
* @param block_idx index of the block
* @return corresponding block
*/
Block Partition::get_block(size_t block_idx) const {
const Block& Partition::get_block(size_t block_idx) const {
assert(block_idx < num_of_blocks() && "Nonexisting block index used.");
return blocks_[block_idx];
}
Expand All @@ -408,7 +408,7 @@ Block Partition::get_block(size_t block_idx) const {
* @param node_idx index of the node
* @return corresponding node
*/
Node Partition::get_node(size_t node_idx) const {
const Node& Partition::get_node(size_t node_idx) const {
assert(node_idx < num_of_nodes() && "Nonexisting node index used.");
return nodes_[node_idx];
}
Expand Down

0 comments on commit 4a9d255

Please sign in to comment.