import { SourceBasedExpression } from '../Expression' ; import { OclExecutionContext } from '../../OclExecutionContext' ; oclExpression oclExample export class SumExpression extends SourceBasedExpression { evaluate ( visitor , localVariables ? ) { const source = this . getSource ( ) . evaluate ( visitor , localVariables ) ; if ( source instanceof Array && source instanceof Array ) { return source . reduce ( ( prev , cur ) => prev + cur , 0 ) ; } return 0 ; } }