public static MatrixClasses getMatrixClassesFor(final TMatrix t) { NullCheck.notNull(t, "t"); final TypeScalarType e_type = t.getElementType(); final int e_width = t.getWidth().getValue().intValue(); return e_type.matchTypeScalar(new MatrixClassMatcher(e_width, e_width)); }
meta_field_name, JPRATypeModel.JPRAMatrix.class, t.getWidth().getValue(), t.getHeight().getValue()); this.constructor_builder.endControlFlow();
@Test public final void testTypeExprMatrix_0() throws Exception { final JPRAParserType p = this.newParser(); final GlobalContextType c = GlobalContexts.newContext(new AlwaysEmptyLoader()); final JPRAResolverType r = this.newResolver(c); final JPRACheckerType ch = this.newChecker( c, JPRACheckerStandardCapabilities.newCapabilities()); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(matrix [float 32] 4 4)"))); final TypeExprMatrix<IdentifierType, TType> e = TypeExprMatrix.class.cast(ch.checkTypeExpression(te)); final TMatrix t = TMatrix.class.cast(e.getType()); Assert.assertEquals(BigInteger.valueOf(4L), t.getWidth().getValue()); Assert.assertEquals(BigInteger.valueOf(4L), t.getHeight().getValue()); Assert.assertEquals(TFloat.class, t.getElementType().getClass()); }
@Test public final void testTypeExprMatrix_1() throws Exception { final JPRAParserType p = this.newParser(); final GlobalContextType c = GlobalContexts.newContext(new AlwaysEmptyLoader()); final JPRAResolverType r = this.newResolver(c); final JPRACheckerType ch = this.newChecker( c, new CapsSupportingIntegerMatrices( JPRACheckerStandardCapabilities.newCapabilities())); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(matrix [integer signed 32] 4 4)"))); final TypeExprMatrix<IdentifierType, TType> e = TypeExprMatrix.class.cast(ch.checkTypeExpression(te)); final TMatrix t = TMatrix.class.cast(e.getType()); Assert.assertEquals(BigInteger.valueOf(4L), t.getWidth().getValue()); Assert.assertEquals(BigInteger.valueOf(4L), t.getHeight().getValue()); Assert.assertEquals(TIntegerSigned.class, t.getElementType().getClass()); }