final MapnamesInStream) {
final Map<StaticAndField,String>namesInStream) {
    private void updateReferences(final SIRStream str,                       final Map/* <StaticAndField,String> */namesInStream) {        ReplacingVisitor visitor = new SLIRReplacingVisitor() {                // need to change JFieldAccessExpression                public Object visitFieldExpression(JFieldAccessExpression self,                                                   JExpression left, 						   String ident) {                    if (left instanceof JTypeNameExpression) {                        String className = ((JTypeNameExpression) left).			    getClassType().getIdent();                        String newFieldName = (String) namesInStream.get(			     new StaticAndField(className, ident));                        if (newFieldName != null) {                            if (str instanceof SIRPhasedFilter) {                                // In a filter, update to new 				// FieldAccessExpression this.newName  				// there is a redundant name in self.getField,				// but this is unused and not updated.                                return new JFieldAccessExpression(self                                    .getTokenReference(),                                     new JThisExpression(left.getTokenReference()),                                     newFieldName,                                    self.getField());                            } else {                                // In a container, update to a 				// JLocalVariableExpression.  The only messy 				// part is that declaration and all references                                // must use a single JVariableDefinition 				// object.  So keep track of in identToVarDefn.                                return new JLocalVariableExpression(self                                     .getTokenReference(),                                    (JVariableDefinition) identToVarDefn                                      .get(newFieldName));                            }                        } else {                            if (debugPrint) {                                System.err                                    .println("Do not replace class and field "                                             + className + "." + ident);                            }                            return super.visitFieldExpression(self, left, ident);                        }                    } else {                        if (debugPrint) {                            System.err.println("Non-class-name " + left + " ."                                               + ident);                        }                        return super.visitFieldExpression(self, left, ident);                    }                }            };        // send through methods        JMethodDeclaration[] methods = str.getMethods();        for (int i = 0; i < methods.length; i++) {            methods[i].accept(visitor);        }        // send through fields, so that it hits the static array        // dimensions as part of field declarations        JFieldDeclaration[] fields = str.getFields();        for (int i = 0; i < fields.length; i++) {            fields[i].accept(visitor);        }    }