tetengo 1.8.1
A multipurpose library set
|
A constraint. More...
#include <stdbool.h>
#include <stddef.h>
#include <tetengo/lattice/constraintElement.h>
#include <tetengo/lattice/node.h>
Go to the source code of this file.
Functions | |
tetengo_lattice_constraint_t * | tetengo_lattice_constraint_createEmpty () |
Creates an empty constraint. | |
tetengo_lattice_constraint_t * | tetengo_lattice_constraint_create (tetengo_lattice_constraintElement_t *const *pp_pattern, size_t pattern_length) |
Creates a constraint. | |
void | tetengo_lattice_constraint_destroy (const tetengo_lattice_constraint_t *p_constraint) |
Destroys a constraint. | |
bool | tetengo_lattice_constraint_matches (const tetengo_lattice_constraint_t *p_constraint, const tetengo_lattice_node_t *p_reverse_path, size_t path_length) |
Returns true when the path matches the pattern. | |
bool | tetengo_lattice_constraint_matchesTail (const tetengo_lattice_constraint_t *p_constraint, const tetengo_lattice_node_t *p_reverse_tail_path, size_t tail_path_length) |
Returns true when the tail path matches the tail of the pattern. | |
A constraint.
Copyright (C) 2019-2023 kaoru https://www.tetengo.org/
tetengo_lattice_constraint_t * tetengo_lattice_constraint_create | ( | tetengo_lattice_constraintElement_t *const * | pp_pattern, |
size_t | pattern_length | ||
) |
Creates a constraint.
The ownership of the constraint elements pointed by pp_pattern is transferred into the constraint. There is no need to destroy the constraint elements after calling this function. But the array holding the constraint elements must be destroyed outside this function.
pp_pattern | A pointer to an array of pointers to constraint elements. |
pattern_length | A pattern length. |
tetengo_lattice_constraint_t * tetengo_lattice_constraint_createEmpty | ( | ) |
Creates an empty constraint.
It matches any path.
void tetengo_lattice_constraint_destroy | ( | const tetengo_lattice_constraint_t * | p_constraint | ) |
Destroys a constraint.
p_constraint | A pointer to a constraint. |
bool tetengo_lattice_constraint_matches | ( | const tetengo_lattice_constraint_t * | p_constraint, |
const tetengo_lattice_node_t * | p_reverse_path, | ||
size_t | path_length | ||
) |
Returns true when the path matches the pattern.
p_constraint | A pointer to a constraint. |
p_reverse_path | A pointer to a path in reverse order. |
path_length | A path length. |
true | When the path matches the pattern. |
false | Otherwise. |
bool tetengo_lattice_constraint_matchesTail | ( | const tetengo_lattice_constraint_t * | p_constraint, |
const tetengo_lattice_node_t * | p_reverse_tail_path, | ||
size_t | tail_path_length | ||
) |
Returns true when the tail path matches the tail of the pattern.
p_constraint | A pointer to a constraint. |
p_reverse_tail_path | A poiner to a tail path in reverse order. |
tail_path_length | A tail path length. |
true | When the tail path matches the tail of the pattern. |
false | Otherwise. |