static VectorsClasses getVectorClassesFor( final TVector v) { NullCheck.notNull(v, "v"); final TypeScalarType e_type = v.getElementType(); final int e_count = v.getElementCount().getValue().intValue(); return e_type.matchTypeScalar(new VectorClassMatcher(e_count)); }
new TVector(no_lex, Size.valueOf(2L), t_int)); rb.addField( new FieldName(no_lex, "v3i"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(3L), t_int)); rb.addField( new FieldName(no_lex, "v4i"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(4L), t_int)); new TVector(no_lex, Size.valueOf(2L), t_long)); rb.addField( new FieldName(no_lex, "v3l"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(3L), t_long)); rb.addField( new FieldName(no_lex, "v4l"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(4L), t_long)); new TVector(no_lex, Size.valueOf(2L), t_float)); rb.addField( new FieldName(no_lex, "v3f"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(3L), t_float)); rb.addField( new FieldName(no_lex, "v4f"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(4L), t_float)); new TVector(no_lex, Size.valueOf(2L), t_double)); rb.addField( new FieldName(no_lex, "v3d"), gc.getFreshIdentifier(), new TVector(no_lex, Size.valueOf(3L), t_double)); rb.addField(
final TType type = new TVector(e.getLexicalInformation(), t_size, t_type); return new TypeExprVector<>( type, e.getLexicalInformation(), e_count, e_type);
JPRAClasses.getModelScalarTypeForScalarType(t.getElementType()); final String meta_field_name = JPRAGeneratedNames.getMetaTypeFieldName(f_name); this.constructor_builder.addStatement( "final $T et = $T.of($L)", et, et, t.getElementType().getSizeInBits().getValue()); this.constructor_builder.addStatement( "this.$N = $T.of($L, et)", meta_field_name, JPRATypeModel.JPRAVector.class, t.getElementCount().getValue()); this.constructor_builder.endControlFlow();
final TType type = new TVector(e.getLexicalInformation(), t_size, t_type); return new TypeExprVector<>( type, e.getLexicalInformation(), e_count, e_type);
@Test public final void testTypeExprVector_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("(vector [integer signed 32] 4)"))); final TypeExprVector<IdentifierType, TType> e = TypeExprVector.class.cast(ch.checkTypeExpression(te)); final TVector t = TVector.class.cast(e.getType()); Assert.assertEquals(BigInteger.valueOf(4L), t.getElementCount().getValue()); Assert.assertEquals(TIntegerSigned.class, t.getElementType().getClass()); }
@Test public final void testTypeExprVector_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, JPRACheckerStandardCapabilities.newCapabilities()); final TypeExprType<IdentifierType, Untyped> te = r.resolveTypeExpression( p.parseTypeExpression( this.newStringSExpr("(vector [float 32] 4)"))); final TypeExprVector<IdentifierType, TType> e = TypeExprVector.class.cast(ch.checkTypeExpression(te)); final TVector t = TVector.class.cast(e.getType()); Assert.assertEquals(BigInteger.valueOf(4L), t.getElementCount().getValue()); Assert.assertEquals(TFloat.class, t.getElementType().getClass()); }