protected static void checkChainMatch ( final ElkSubObjectPropertyExpression fullChain , final int startPos ) { // verifies that start position exists in full chain fullChain . accept ( new ElkSubObjectPropertyExpressionVisitor < Void > ( ) { void fail ( ) { throw new IllegalArgumentException ( fullChain + ", " + startPos ) ; } Void defaultVisit ( ElkObjectPropertyExpression expression ) { if ( startPos != 0 ) { fail ( ) ; } return null ; } @ Override public Void visit ( ElkObjectPropertyChain expression ) { if ( startPos < 0 || startPos >= expression . getObjectPropertyExpressions ( ) . size ( ) ) fail ( ) ; return null ; } @ Override public Void visit ( ElkObjectInverseOf expression ) { return defaultVisit ( expression ) ; } @ Override public Void visit ( ElkObjectProperty expression ) { return defaultVisit ( expression ) ; } } ) ; }
some methods for checking correctness of arguments