9 #include "fei_Pattern.hpp"
18 recordCollections_(numIDs, recordCollection)
20 int i, len = numIDs_*4;
25 for(i=0; i<numIDs_; ++i) {
26 data_[offset++] = idType;
30 for(i=0; i<numIDs_; ++i) {
35 for(i=0; i<numIDs_; ++i) {
40 for(i=0; i<numIDs_; ++i) {
44 idTypes_ = &(data_[0]);
45 numFieldsPerID_ = idTypes_+numIDs_;
46 numIndicesPerID_= idTypes_+2*numIDs_;
47 fieldIDs_ = idTypes_+3*numIDs_;
52 int fieldID,
int fieldSize)
55 totalNumFields_(numIDs),
58 recordCollections_(numIDs, recordCollection)
60 int i, len = numIDs_*4;
65 for(i=0; i<numIDs_; ++i) {
66 data_[offset++] = idType;
70 for(i=0; i<numIDs_; ++i) {
75 for(i=0; i<numIDs_; ++i) {
76 data_[offset++] = fieldSize;
80 for(i=0; i<numIDs_; ++i) {
81 data_[offset++] = fieldID;
84 numIndices_ = numIDs_*fieldSize;
86 idTypes_ = &(data_[0]);
87 numFieldsPerID_ = idTypes_+numIDs_;
88 numIndicesPerID_= idTypes_+2*numIDs_;
89 fieldIDs_ = idTypes_+3*numIDs_;
94 const int* numFieldsPerID,
96 const int* fieldSizes)
97 : type_(
Pattern::SINGLE_IDTYPE),
102 recordCollections_(numIDs, recordCollection)
104 int i, len = numIDs_*3;
105 int maxNumFieldsPerID = 0;
106 bool oneDistinctFieldID =
true;
108 for(i=0; i<numIDs; ++i) len += numFieldsPerID[i];
113 for(i=0; i<numIDs_; ++i) {
114 data_[offset++] = idType;
118 for(i=0; i<numIDs; ++i) {
119 data_[offset++] = numFieldsPerID[i];
120 if (numFieldsPerID[i] > maxNumFieldsPerID) {
121 maxNumFieldsPerID = numFieldsPerID[i];
126 int firstFieldID = 0;
127 if (numIDs > 0) firstFieldID = fieldIDs[0];
129 int fieldIDOffset = offset + numIDs;
130 for(i=0; i<numIDs; ++i) {
131 int thisNumIndices = 0;
132 for(
int j=0; j<numFieldsPerID[i]; ++j) {
133 int fieldSize = fieldSizes[totalNumFields_];
134 int fieldID = fieldIDs[totalNumFields_++];
135 if (fieldID != firstFieldID) oneDistinctFieldID =
false;
136 data_[fieldIDOffset++] = fieldID;
137 numIndices_ += fieldSize;
138 thisNumIndices += fieldSize;
140 data_[offset+i] = thisNumIndices;
143 if (oneDistinctFieldID ==
true && maxNumFieldsPerID < 2) {
144 type_ = Pattern::SIMPLE;
147 idTypes_ = &(data_[0]);
148 numFieldsPerID_ = idTypes_+numIDs_;
149 numIndicesPerID_= idTypes_+2*numIDs_;
150 fieldIDs_ = idTypes_+3*numIDs_;
155 const int* numFieldsPerID,
157 const int* fieldSizes)
163 recordCollections_(recordCollections, recordCollections+numIDs)
165 int i, len = numIDs*3;
166 int maxNumFieldsPerID = 0;
167 bool oneDistinctFieldID =
true;
168 bool oneDistinctIDType =
true;
170 for(i=0; i<numIDs; ++i) len += numFieldsPerID[i];
174 if (numIDs > 0) firstIDType = idTypes[0];
178 for(i=0; i<numIDs; ++i) {
179 data_[offset++] = idTypes[i];
180 if (idTypes[i] != firstIDType) oneDistinctIDType =
false;
184 for(i=0; i<numIDs; ++i) {
185 data_[offset++] = numFieldsPerID[i];
186 if (numFieldsPerID[i] > maxNumFieldsPerID) {
187 maxNumFieldsPerID = numFieldsPerID[i];
192 int firstFieldID = 0;
193 if (numIDs > 0) firstFieldID = fieldIDs[0];
195 int fieldIDOffset = offset + numIDs;
196 for(i=0; i<numIDs; ++i) {
197 int thisNumIndices = 0;
198 for(
int j=0; j<numFieldsPerID[i]; ++j) {
199 int fieldSize = fieldSizes[totalNumFields_];
200 int fieldID = fieldIDs[totalNumFields_++];
201 if (fieldID != firstFieldID) oneDistinctFieldID =
false;
202 data_[fieldIDOffset++] = fieldID;
203 numIndices_ += fieldSize;
204 thisNumIndices += fieldSize;
206 data_[offset+i] = thisNumIndices;
209 if (oneDistinctFieldID ==
true && maxNumFieldsPerID < 2 &&
210 oneDistinctIDType ==
true) {
211 type_ = Pattern::SIMPLE;
213 else if (oneDistinctIDType ==
true) {
214 type_ = Pattern::SINGLE_IDTYPE;
217 idTypes_ = &(data_[0]);
218 numFieldsPerID_ = idTypes_+numIDs_;
219 numIndicesPerID_= idTypes_+2*numIDs_;
220 fieldIDs_ = idTypes_+3*numIDs_;
224 fei::Pattern::~Pattern()
231 return type_ == rhs.type_ &&
232 numIDs_ == rhs.numIDs_ &&
233 totalNumFields_ == rhs.totalNumFields_ &&
234 numIndices_ == rhs.numIndices_ &&
241 return !(*
this == rhs);
bool operator==(const Pattern &rhs) const
Pattern(int numIDs, int idType, snl_fei::RecordCollection *records)
bool operator!=(const Pattern &rhs) const