18 recordCollections_(numIDs, recordCollection)
26 data_[offset++] = idType;
52 int fieldID,
int fieldSize)
55 totalNumFields_(numIDs),
58 recordCollections_(numIDs, recordCollection)
66 data_[offset++] = idType;
76 data_[offset++] = fieldSize;
81 data_[offset++] = fieldID;
94 const int* numFieldsPerID,
96 const int* fieldSizes)
97 : type_(
Pattern::SINGLE_IDTYPE),
102 recordCollections_(numIDs, recordCollection)
105 int maxNumFieldsPerID = 0;
106 bool oneDistinctFieldID =
true;
108 for(i=0; i<numIDs; ++i) len += numFieldsPerID[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) {
135 if (fieldID != firstFieldID) oneDistinctFieldID =
false;
136 data_[fieldIDOffset++] = fieldID;
138 thisNumIndices += fieldSize;
140 data_[offset+i] = thisNumIndices;
143 if (oneDistinctFieldID ==
true && maxNumFieldsPerID < 2) {
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) {
201 if (fieldID != firstFieldID) oneDistinctFieldID =
false;
202 data_[fieldIDOffset++] = fieldID;
204 thisNumIndices += fieldSize;
206 data_[offset+i] = thisNumIndices;
209 if (oneDistinctFieldID ==
true && maxNumFieldsPerID < 2 &&
210 oneDistinctIDType ==
true) {
213 else if (oneDistinctIDType ==
true) {
231 return type_ == rhs.
type_ &&
241 return !(*
this == rhs);
bool operator==(const Pattern &rhs) const
const int * numFieldsPerID_
const int * numIndicesPerID_
Pattern(int numIDs, int idType, snl_fei::RecordCollection *records)
bool operator!=(const Pattern &rhs) const