1 package com.jogamp.gluegen.cgram; 2 3 import antlr.ASTFactory; 4 import antlr.collections.AST; 5 6 /** This class extends ASTFactory to build instances 7 of class TNode */ 8 public class TNodeFactory extends ASTFactory { 9 10 /** Create a new ampty AST node */ 11 @Override create()12 public AST create() { 13 return new TNode(); 14 } 15 16 /** Create a new AST node from type and text */ 17 @Override create(final int ttype, final String text)18 public AST create(final int ttype, final String text) { 19 final AST ast = new TNode(); 20 ast.setType(ttype); 21 ast.setText(text); 22 return ast; 23 } 24 25 /** Create a new AST node from an existing AST node */ 26 @Override create(final AST ast)27 public AST create(final AST ast) { 28 final AST newast = new TNode(); 29 newast.setType(ast.getType()); 30 newast.setText(ast.getText()); 31 return newast; 32 } 33 34 35 } 36