FileWriter fw = new FileWriter("sw" + Layout.getTile(node.contents) + ".s"); SIRFilter filter = (SIRFilter)node.contents; int peek, pop, push, receive;  boolean first = true;  peek = filter.getPeekInt(); pop = filter.getPopInt(); push = filter.getPushInt();  fw.write("#  Switch code for a filter with pushes and pops\n"); fw.write(getHeader());  SwitchScheduleNode currentReceive, firstReceive; currentReceive = firstReceive = (SwitchScheduleNode)switchReceiveCode.get(node); SwitchScheduleNode currentSend, firstSend; currentSend = firstSend = (SwitchScheduleNode)switchSendCode.get(node);    while (currentReceive != null && currentSend != null) {    if (first) { first  = false; receive = peek; } else receive = pop; for (int i = 0; i < receive; i++) { if (currentReceive == null) currentReceive = firstReceive; fw.write(currentReceive.toAssembly(node, false)); currentReceive = currentReceive.next; }  for (int i = 0; i < push; i++) { if (currentSend == null) currentSend = firstSend; fw.write(currentReceive.toAssembly(node, true)); currentSend = currentSend.next; } }  fw.write("sw_loop:\n");    while (currentReceive != null && currentSend != null) { for (int i = 0; i < pop; i++) { if (currentReceive == null) currentReceive = firstReceive; fw.write(currentReceive.toAssembly(node, false)); currentReceive = currentReceive.next; }  for (int i = 0; i < push; i++) { if (currentSend == null) currentSend = firstSend; fw.write(currentReceive.toAssembly(node, true)); currentSend = currentSend.next; } }  fw.write("\tj\tsw_loop\n\n"); fw.write(getTrailer()); fw.close();
    private static void generalSchedule(FlatNode node) throws Exception    {    }