예제 #1
0
bool Material::validate() const {
	bool validMaterial = nature_by_type.size() > 0;
	if (!validMaterial) {
		cerr << *this << " has no nature assigned.";
	}
	/*
	 * if the model is configured to assign materials to cells directly check
	 * that every material is assigned to some cell or cellgroup
	 */
	if (!model->configuration.partitionModel) {
		CellContainer assignment = getAssignment();
		validMaterial &= !assignment.empty();
	}
	return validMaterial;
}
예제 #2
0
bool LogProcessor::checkTaskId(const ServerLogEntry& entry)
{
    if (! entry._entry._taskId)
    {
        invalidEntryMsg(entry) << " task id missing" << std::endl;
        return false;
    }
    const AssignmentStatus* assignment = getAssignment(entry);
    if (! assignment)
    {
        return false;
    }
    if (assignment->_finished)
    {
        invalidEntryMsg(entry) << "employee already finished this task, but processing anyway" << std::endl;
    }
    return true;
}
예제 #3
0
파일: calc.c 프로젝트: rukumar333/cs220
tree * getStatement(token **tokenPtr,char *buffer) {
	assert((*tokenPtr)!=NULL);
	if ((*tokenPtr)->type==LCURLY) {
		(*tokenPtr)=nextToken((*tokenPtr),buffer,false);
		tree * exp = getExpList(tokenPtr,buffer);
		if (((*tokenPtr)==NULL) || (*tokenPtr)->type!=RCURLY) {
			printf("Syntax error... unbalanced curly braces... not enough right\n");
			exit(1);
		}
		(*tokenPtr)=nextToken((*tokenPtr),buffer,false);
		return exp;
	}
	tree * asg=getAssignment(tokenPtr,buffer);
	if (asg!=NULL) return asg;
	asg = getWhile(tokenPtr,buffer);
	if (asg != NULL) return asg;
	tree * exp=getExpression(tokenPtr,buffer);
	if ((*tokenPtr)==NULL) return exp;
	if ((*tokenPtr)->type==EOS) return exp;
	printf("Syntax error... expected assignment or expression... found neither\n");
	exit(1);
}