<commit_before>import { ElementValidatorBase } from '../element-validator-base';
import { Process } from '../../model/Process';
import { Validator } from '../validator-decorator';
import { IContainer } from '../../model/IContainer';
import { ValidationResult } from '../validation-result';
import { Type } from '../../util/type';
import { Config } from '../../config/config';
import { ProcessStep } from '../../model/ProcessStep';
import { ProcessDecision } from '../../model/ProcessDecision';
import { ProcessConnection } from '../../model/ProcessConnection';

@Validator(Process)
export class NodeSingleOutgoingConnectionValidator extends ElementValidatorBase<Process> {
    public validate(element: Process, contents: IContainer[]): ValidationResult {
        const invalidNodes: IContainer[] = contents
            .filter((element: IContainer) => !Type.is(element, ProcessDecision))
            .filter((element: IContainer) =>
                (<any>element).outgoingConnections && (<any>element).outgoingConnections.length !== 1);
        if (invalidNodes.length > 0) {
            return new ValidationResult(Config.ERROR_PROCESS_NODE_MULTIPLE_OUTGOING_CONNECTIONS, false, invalidNodes);
        }
        return ValidationResult.VALID;
    }
}<commit_msg>Adjusting condition to not overlap.<commit_after>import { ElementValidatorBase } from '../element-validator-base';
import { Process } from '../../model/Process';
import { Validator } from '../validator-decorator';
import { IContainer } from '../../model/IContainer';
import { ValidationResult } from '../validation-result';
import { Type } from '../../util/type';
import { Config } from '../../config/config';
import { ProcessStep } from '../../model/ProcessStep';
import { ProcessDecision } from '../../model/ProcessDecision';
import { ProcessConnection } from '../../model/ProcessConnection';

@Validator(Process)
export class NodeSingleOutgoingConnectionValidator extends ElementValidatorBase<Process> {
    public validate(element: Process, contents: IContainer[]): ValidationResult {
        const invalidNodes: IContainer[] = contents
            .filter((element: IContainer) => !Type.is(element, ProcessDecision))
            .filter((element: IContainer) =>
                (<any>element).outgoingConnections && (<any>element).outgoingConnections.length > 1);
        if (invalidNodes.length > 0) {
            return new ValidationResult(Config.ERROR_PROCESS_NODE_MULTIPLE_OUTGOING_CONNECTIONS, false, invalidNodes);
        }
        return ValidationResult.VALID;
    }
}
{'fraction_non_alphanumeric': 0.14728986645718775, 'fraction_numerical': 0.0015710919088766694, 'mean_word_length': 3.6648351648351647, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5565775', 'n_tokens_mistral': 640, 'n_tokens_neox': 636, 'n_words': 154}