-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTask.cpp
26 lines (22 loc) · 821 Bytes
/
Task.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "Domain.h"
void Task::SHOPPrint( std::ostream & s, unsigned indent, const TokenStruct< std::string > & ts, Domain & d ) {
tabindent( s, indent );
s << "( " << name << " ";
for ( unsigned i = 0; i < params.size(); ++i ) {
if ( ts.size() && params[i] >= 0 && (unsigned)params[i] < ts.size() ) s <<" " << ts[params[i]];
else if (params[i] >= 0 && (unsigned)params[i] >= ts.size()) s << " ?" << params[i];
}
s << " )";
}
void Task::SHOPparse( Filereader & f, TokenStruct< std::string > & ts, Domain & d ) {
TokenStruct< std::string > lstruct = f.parseTypedList( false );
params = d.convertTypes( lstruct.types );
for ( unsigned i = 0; i < lstruct.size(); ++i ) {
std::string s = lstruct[i];
int k = ts.index( s );
if ( k >= 0 ) params[i] = k;
else {
params[i] = ts.insert(s);
}
}
}