#if !defined (BAD_SPLITTING_EDGE)
#   define BAD_SPLITTING_EDGE 1

#   include "bad_common.h"

BEGIN_C_DECLS

/*
 * texinfo: bad_typeof_splitting_edge
 * This data type is a subtype of @code{bad_splitting_edge}.
 * It permits to associate a type to an edge in the splitting tree
 * generated by @code{bad_Rosenfeld_Groebner}.
 */

enum bad_typeof_splitting_edge
{
// not an edge
  bad_none_edge,
// critical pair leading to a non trivial differential polynomial
  bad_critical_pair_edge,
  bad_critical_pair_novar_edge, // result is a base field element
// reduction to zero
  bad_redzero_edge,
// splittings introducing an inequation at each edge
  bad_first_edge,               // processing the initial equations
  bad_factor_edge,              // plain factorization
  bad_initial_edge,             // initial
  bad_separant_edge,            // separant
// splittings not introducing inequations
  bad_regularize_edge,          // complete
  bad_reg_characteristic_edge   // reg_characteristic
};

/*
 * texinfo: bad_splitting_edge
 * This data type is a subtype of @code{bad_splitting_vertex}.
 * It permits to describe an edge of the splitting tree
 * generated by a differential elimination algorithm. 
 *
 * The fields @code{src} and @code{dst} contain the @emph{numbers}
 * of the vertices connected by the edge.
 *
 * For some values of the @code{type} field, the leader of the
 * involved polynomial is stored in the @code{leader} field.
 * Similarly, for some values of the @code{type} field, a
 * multiplicity information is stored in the
 * @code{multiplicity} field.
 */

struct bad_splitting_edge
{
// the type of the edge
  enum bad_typeof_splitting_edge type;
// the number of the source vertex
  ba0_int_p src;
// the number of the target vertex
  ba0_int_p dst;
// the leader of the differential polynomial (bad_separant_edge)
  struct bav_variable *leader;
// the multiplicity of the factor (bad_separant_edge)
  ba0_int_p multiplicity;
};

struct bad_tableof_splitting_edge
{
  ba0_int_p alloc;
  ba0_int_p size;
  struct bad_splitting_edge **tab;
};

extern BAD_DLL void bad_init_splitting_edge (
    struct bad_splitting_edge *);

extern BAD_DLL struct bad_splitting_edge *bad_new_splitting_edge (
    void);

extern BAD_DLL char *bad_typeof_splitting_edge_to_string (
    enum bad_typeof_splitting_edge);

extern BAD_DLL void bad_set_splitting_edge (
    struct bad_splitting_edge *,
    struct bad_splitting_edge *);

extern BAD_DLL bool bad_has_var_typeof_splitting_edge (
    enum bad_typeof_splitting_edge);

extern BAD_DLL bool bad_has_multiplicity_typeof_splitting_edge (
    enum bad_typeof_splitting_edge);

extern BAD_DLL bool bad_inequation_producing_splitting_edge (
    enum bad_typeof_splitting_edge);

extern BAD_DLL struct bav_symbol *bad_leader_symbol_splitting_edge (
    struct bad_splitting_edge *);

extern BAD_DLL void bad_set_tsdvm_splitting_edge (
    struct bad_splitting_edge *,
    enum bad_typeof_splitting_edge,
    ba0_int_p,
    ba0_int_p,
    struct bav_variable *,
    ba0_int_p);

extern BAD_DLL ba0_scanf_function bad_scanf_splitting_edge;

extern BAD_DLL ba0_printf_function bad_printf_splitting_edge;

extern BAD_DLL ba0_garbage1_function bad_garbage1_splitting_edge;

extern BAD_DLL ba0_garbage2_function bad_garbage2_splitting_edge;

extern BAD_DLL ba0_copy_function bad_copy_splitting_edge;

END_C_DECLS
#endif
