5 #include "ordergraph.h"
7 Order *allocOrder(OrderType type, Set *set) {
8 Order *This = (Order *)ourmalloc(sizeof(Order));
10 initDefVectorBooleanOrder(&This->constraints);
12 initOrderEncoding(&This->order, This);
13 This->orderPairTable = NULL;
14 This->elementTable = NULL;
19 void initializeOrderHashTable(Order *This) {
20 This->orderPairTable = allocHashTableOrderPair(HT_INITIAL_CAPACITY, HT_DEFAULT_FACTOR);
23 void initializeOrderElementsHashTable(Order *This){
24 This->elementTable = allocHashSetOrderElement(HT_INITIAL_CAPACITY, HT_DEFAULT_FACTOR);
27 void addOrderConstraint(Order *This, BooleanOrder *constraint) {
28 pushVectorBooleanOrder( &This->constraints, constraint);
31 void setOrderEncodingType(Order *This, OrderEncodingType type) {
32 This->order.type = type;
35 void deleteOrder(Order *This) {
36 deleteVectorArrayBooleanOrder(&This->constraints);
37 deleteOrderEncoding(&This->order);
38 if (This->orderPairTable != NULL) {
39 resetAndDeleteHashTableOrderPair(This->orderPairTable);
40 deleteHashTableOrderPair(This->orderPairTable);
42 if(This->elementTable != NULL){
43 deleteHashSetOrderElement(This->elementTable);
45 if (This->graph != NULL) {
46 deleteOrderGraph(This->graph);