Input:
    public void visitForExpression(final JFXForExpression tree) {
        result = (new Translator( tree.pos(), toJava ) {
            private final TypeMorphInfo tmiResult = typeMorpher.typeMorphInfo(targetType(tree.type));
            private final Type resultElementType = tmiResult.getElementType();
            private final Type resultSequenceLocationType = typeMorpher.generifyIfNeeded(typeMorpher.locationType(TYPE_KIND_SEQUENCE), tmiResult);
            private final boolean isSimple = false;
            private JCExpression makeResultClass() {
                return makeTypeInfo(diagPos, resultElementType);
            }
            private JCVariableDecl makeParam(Type type, Name name) {
                return make.at(diagPos).VarDef(
                        make.Modifiers(Flags.PARAMETER | Flags.FINAL),
                        name,
                        makeExpression(type),
                        null);
            }
            private JCExpression makeCore() {
                JCExpression body = translate(tree.getBodyExpression());
                if (!types.isSequence(tree.getBodyExpression().type)) {
                    List<JCExpression> args = List.of(makeResultClass(), body);
                    body = runtime(diagPos, cBoundSequences, "singleton", args);
                }
                JCExpression whereTest = null;
                for (JFXForExpressionInClause clause : tree.getForExpressionInClauses()) {
                    JCExpression where = translate(clause.getWhereExpression());
                    if (where != null) {
                        if (whereTest == null) {
                            whereTest = where;
                        } else {
                            whereTest = runtime(diagPos, cBoundOperators, "and_bb", List.of(whereTest, where));
                        }
                    }
                }
                if (whereTest != null) {
                    body = makeBoundConditional(diagPos,
                            tree.type,
                            body,
                            runtime(diagPos, cBoundSequences, "empty", List.of(makeTypeInfo(diagPos, resultElementType))),
                            whereTest);
                }
                return body;
            }
            private JCTree makeComputeElementsMethod(JFXForExpressionInClause clause, JCExpression inner, TypeMorphInfo tmiInduction) {
                Type iVarType;
                Type idxVarType;
                Name computeName;
                if  (isSimple) {
                   iVarType = tmiInduction.getRealFXType();
                   idxVarType = syms.intType;
                   computeName = computeElementsName;
                } else {
                   iVarType = tmiInduction.getLocationType();
                   idxVarType = typeMorpher.locationType(TYPE_KIND_INT);
                   computeName = computeElementsName;
                }
                ListBuffer<JCStatement> stmts = ListBuffer.lb();
                Name ivarName = clause.getVar().name;
                stmts.append(m().Return( inner ));
                List<JCVariableDecl> params = List.of(
                        makeParam(iVarType, ivarName),
                        makeParam(idxVarType, indexVarName(clause) )
                        );
                return m().MethodDef(
                        m().Modifiers(Flags.PROTECTED),
                        computeName,
                        makeExpression( resultSequenceLocationType ),
                        List.<JCTypeParameter>nil(),
                        params,
                        List.<JCExpression>nil(),
                        m().Block(0L, stmts.toList()),
                        null);
            }
            private JCExpression makeBoundComprehension(JFXForExpressionInClause clause, JCExpression inner) {
                JFXExpression seq = clause.getSequenceExpression();
                TypeMorphInfo tmiSeq = typeMorpher.typeMorphInfo(seq.type);
                TypeMorphInfo tmiInduction = typeMorpher.typeMorphInfo(clause.getVar().type);
                Type elementType = tmiSeq.getElementType();
                JCClassDecl classDecl = m().AnonymousClassDef(
                        m().Modifiers(0L),
                        List.<JCTree>of(makeComputeElementsMethod(clause, inner, tmiInduction)));
                List<JCExpression> typeArgs = List.nil();
                boolean useIndex = clause.getIndexUsed();
                JCExpression transSeq = translate( seq );
                if (!tmiSeq.isSequence()) {
                    transSeq = runtime(diagPos, cBoundSequences, "singleton", List.of(makeResultClass(), transSeq));
                }
                List<JCExpression> constructorArgs = List.of(
                        makeResultClass(),
                        transSeq,
                        m().Literal(TypeTags.BOOLEAN, useIndex? 1 : 0) );
                int typeKind = tmiInduction.getTypeKind();
                Type bcType = typeMorpher.boundComprehensionNCT[typeKind].type;
                JCExpression clazz = makeExpression(types.erasure(bcType));
                ListBuffer<JCExpression> typeParams = ListBuffer.lb();
                if (typeKind == TYPE_KIND_OBJECT) {
                    typeParams.append( makeExpression(elementType) );
                }
                typeParams.append( makeExpression(resultElementType) );
                clazz = m().TypeApply(clazz, typeParams.toList());
                return m().NewClass(null,
                        typeArgs,
                        clazz,
                        constructorArgs,
                        classDecl);
            }
            public JCExpression doit() {
                List<JFXForExpressionInClause> clauses = tree.getForExpressionInClauses();
                JCExpression expr = makeCore();
                for (int inx = clauses.size() - 1; inx >= 0; --inx) {
                    JFXForExpressionInClause clause = clauses.get(inx);
                    expr = makeBoundComprehension(clause, expr);
                }
                return expr;
            }
        }).doit();
    }

Output:
    public void visitForExpression(final JFXForExpression tree) {
        result = (new Translator( tree.pos(), toJava ) {
            private final TypeMorphInfo tmiResult = typeMorpher.typeMorphInfo(targetType(tree.type));
            private final Type resultElementType = tmiResult.getElementType();
            private final Type resultSequenceLocationType = typeMorpher.generifyIfNeeded(typeMorpher.locationType(TYPE_KIND_SEQUENCE), tmiResult);
            private final boolean isSimple = false;
            private JCExpression makeResultClass() {
                return makeTypeInfo(diagPos, resultElementType);
            }
            private JCVariableDecl makeParam(Type type, Name name) {
                return make.at(diagPos).VarDef(
                        make.Modifiers(Flags.PARAMETER | Flags.FINAL),
                        name,
                        makeExpression(type),
                        null);
            }
            private JCExpression makeCore() {
                JCExpression body;
                if (types.isSequence(tree.getBodyExpression().type)) {
                    body = translate(tree.getBodyExpression(), tmiTarget);
                } else {
                    JCExpression single = translate(tree.getBodyExpression(), tmiTarget.getElementType());
                    List<JCExpression> args = List.of(makeResultClass(), single);
                    body = runtime(diagPos, cBoundSequences, "singleton", args);
                }
                JCExpression whereTest = null;
                for (JFXForExpressionInClause clause : tree.getForExpressionInClauses()) {
                    JCExpression where = translate(clause.getWhereExpression());
                    if (where != null) {
                        if (whereTest == null) {
                            whereTest = where;
                        } else {
                            whereTest = runtime(diagPos, cBoundOperators, "and_bb", List.of(whereTest, where));
                        }
                    }
                }
                if (whereTest != null) {
                    body = makeBoundConditional(diagPos,
                            tree.type,
                            body,
                            runtime(diagPos, cBoundSequences, "empty", List.of(makeTypeInfo(diagPos, resultElementType))),
                            whereTest);
                }
                return body;
            }
            private JCTree makeComputeElementsMethod(JFXForExpressionInClause clause, JCExpression inner, TypeMorphInfo tmiInduction) {
                Type iVarType;
                Type idxVarType;
                Name computeName;
                if  (isSimple) {
                   iVarType = tmiInduction.getRealFXType();
                   idxVarType = syms.intType;
                   computeName = computeElementsName;
                } else {
                   iVarType = tmiInduction.getLocationType();
                   idxVarType = typeMorpher.locationType(TYPE_KIND_INT);
                   computeName = computeElementsName;
                }
                ListBuffer<JCStatement> stmts = ListBuffer.lb();
                Name ivarName = clause.getVar().name;
                stmts.append(m().Return( inner ));
                List<JCVariableDecl> params = List.of(
                        makeParam(iVarType, ivarName),
                        makeParam(idxVarType, indexVarName(clause) )
                        );
                return m().MethodDef(
                        m().Modifiers(Flags.PROTECTED),
                        computeName,
                        makeExpression( resultSequenceLocationType ),
                        List.<JCTypeParameter>nil(),
                        params,
                        List.<JCExpression>nil(),
                        m().Block(0L, stmts.toList()),
                        null);
            }
            private JCExpression makeBoundComprehension(JFXForExpressionInClause clause, JCExpression inner) {
                JFXExpression seq = clause.getSequenceExpression();
                TypeMorphInfo tmiSeq = typeMorpher.typeMorphInfo(seq.type);
                TypeMorphInfo tmiInduction = typeMorpher.typeMorphInfo(clause.getVar().type);
                Type elementType = tmiSeq.getElementType();
                JCClassDecl classDecl = m().AnonymousClassDef(
                        m().Modifiers(0L),
                        List.<JCTree>of(makeComputeElementsMethod(clause, inner, tmiInduction)));
                List<JCExpression> typeArgs = List.nil();
                boolean useIndex = clause.getIndexUsed();
                JCExpression transSeq = translate( seq );
                if (!tmiSeq.isSequence()) {
                    transSeq = runtime(diagPos, cBoundSequences, "singleton", List.of(makeResultClass(), transSeq));
                }
                List<JCExpression> constructorArgs = List.of(
                        makeResultClass(),
                        transSeq,
                        m().Literal(TypeTags.BOOLEAN, useIndex? 1 : 0) );
                int typeKind = tmiInduction.getTypeKind();
                Type bcType = typeMorpher.boundComprehensionNCT[typeKind].type;
                JCExpression clazz = makeExpression(types.erasure(bcType));
                ListBuffer<JCExpression> typeParams = ListBuffer.lb();
                if (typeKind == TYPE_KIND_OBJECT) {
                    typeParams.append( makeExpression(elementType) );
                }
                typeParams.append( makeExpression(resultElementType) );
                clazz = m().TypeApply(clazz, typeParams.toList());
                return m().NewClass(null,
                        typeArgs,
                        clazz,
                        constructorArgs,
                        classDecl);
            }
            public JCExpression doit() {
                List<JFXForExpressionInClause> clauses = tree.getForExpressionInClauses();
                JCExpression expr = makeCore();
                for (int inx = clauses.size() - 1; inx >= 0; --inx) {
                    JFXForExpressionInClause clause = clauses.get(inx);
                    expr = makeBoundComprehension(clause, expr);
                }
                return expr;
            }
        }).doit();
    }


Input:
    AnnotationDefinitionList(Collection<AnnotationDefinition> definitions, boolean addIdentifierToList) {
        if (definitions == null) {
            throw new IllegalArgumentException("Argument definitions was null.");
        }
        if (addIdentifierToList) {
            names.add(IdentifierCriterionWrapper.IDENTIFIER_FIELD_NAME);
            nameToDefinitionMap.put(IdentifierCriterionWrapper.IDENTIFIER_FIELD_NAME, null);
        }
        for (AnnotationDefinition definition : definitions) {
            if (!AnnotationTypeEnum.DATE.getValue().equalsIgnoreCase(definition.getType())) {
                noDateNames.add(definition.getDisplayName());
            }
            names.add(definition.getDisplayName());
            nameToDefinitionMap.put(definition.getDisplayName(), definition);
            Cai2Util.loadCollection(definition.getPermissibleValueCollection());
        }
        Collections.sort(names);
        Collections.sort(noDateNames);
    }

Output:
    AnnotationDefinitionList(Collection<AnnotationDefinition> definitions, boolean addIdentifierToList) {
        if (definitions == null) {
            throw new IllegalArgumentException("Argument definitions was null.");
        }
        if (addIdentifierToList) {
            names.add(IdentifierCriterionWrapper.IDENTIFIER_FIELD_NAME);
            noDateNames.add(IdentifierCriterionWrapper.IDENTIFIER_FIELD_NAME);
            nameToDefinitionMap.put(IdentifierCriterionWrapper.IDENTIFIER_FIELD_NAME, null);
        }
        for (AnnotationDefinition definition : definitions) {
            if (!AnnotationTypeEnum.DATE.getValue().equalsIgnoreCase(definition.getType())) {
                noDateNames.add(definition.getDisplayName());
            }
            names.add(definition.getDisplayName());
            nameToDefinitionMap.put(definition.getDisplayName(), definition);
            Cai2Util.loadCollection(definition.getPermissibleValueCollection());
        }
        Collections.sort(names);
        Collections.sort(noDateNames);
    }


Input:
    public void startGame() {
        d("Starting game.");
        state = GameState.INGAME;
        updateSigns();
        int item = rand.nextInt(players.size());
        d(item);
        int i = 0;
        for (String name : players.keySet()) {
            if (i == item) {
                it = name;
            }
            i++;
        }
        d("Selected IT: " + it);
        for (Player player : getPlayers()) {
            Manager.saveInventory(player);
            player.setHealth(player.getMaxHealth());
            player.setFoodLevel(20);
            removePotionEffects(player);
            if (player.getName().equalsIgnoreCase(it)) {
                d("Equipping IT: " + player.getName());
                Equip.equipIt(player);
            } else {
                d("Equipping other: " + player.getName());
                Equip.equipOther(player);
            }
            player.setHealth(player.getMaxHealth());
            player.teleport(spawn);
        }
        setupScoreboard();
        if (safeperiod) {
            d("Safe period active");
            safe = true;
            new BukkitRunnable() {
                @Override
                public void run() {
                    d("Safe period no longer active.");
                    safe = false;
                }
            }.runTaskLater(plugin, plugin.getConfig().getLong("safe-period-time", 20L) * 20);
        }
        endRun = new BukkitRunnable() {
            public void run() {
                d("Ending game.");
                reset(false);
            }
        };
        endRun.runTaskLater(plugin, plugin.getConfig().getLong("match-duration", 20L) * 400);
    }

Output:
    public void startGame() {
        d("Starting game.");
        state = GameState.INGAME;
        updateSigns();
        int item = rand.nextInt(players.size());
        d(item);
        int i = 0;
        for (String name : players.keySet()) {
            if (i == item) {
                it = name;
            }
            i++;
        }
        d("Selected IT: " + it);
        for (Player player : getPlayers()) {
            Manager.saveInventory(player);
            player.setHealth(player.getMaxHealth());
            player.setFoodLevel(20);
            removePotionEffects(player);
            if (player.getName().equalsIgnoreCase(it)) {
                d("Equipping IT: " + player.getName());
                Equip.equipIt(player);
            } else {
                d("Equipping other: " + player.getName());
                Equip.equipOther(player);
            }
            player.setHealth(player.getMaxHealth());
            player.teleport(spawn);
        }
        setupScoreboard();
        if (safeperiod) {
            d("Safe period active");
            safe = true;
            new BukkitRunnable() {
                @Override
                public void run() {
                    d("Safe period no longer active.");
                    safe = false;
                }
            }.runTaskLater(plugin, plugin.getConfig().getLong("safe-period-time", 20L) * 20);
        }
        endRun = new BukkitRunnable() {
            public void run() {
                d("Ending game.");
                reset(false);
            }
        };
        endRun.runTaskLater(plugin, plugin.getConfig().getLong("match-duration", 20L) * 20);
    }


Input:
	public void myClickHandler(View view) {
		switch (view.getId()) {
		case R.id.BacksideUpdaterButton:
			try {
				if (ALREADY_CHECKED == 0) {
					ALREADY_CHECKED = 1;
					textView.setText("");
					HttpClient client = new DefaultHttpClient();
					HttpGet request = new HttpGet(updateManifestUrl);
					HttpResponse response = client.execute(request);
					BufferedReader rd = new BufferedReader(new InputStreamReader(
							response.getEntity().getContent()));
					String line = rd.readLine();
					String[] separated = line.split(",");
					theDate = separated[0];
					theUrl = separated[1];
					theChangeLog = separated[2];
					theMD5 = separated[3];
					romName = separated[4];
					localFileName = "/download/"+romName;
					theFileSize = separated[5];
					upToDate = (Integer.parseInt(theDate) <  BUILD_DATE);
					String file = android.os.Environment.getExternalStorageDirectory().getPath() + localFileName;
					File f = new File(file);
					if (!upToDate) {
						if (f.exists()) {
							if (!checkFileSize(romName)){
								showCustomToast("The latest build is already downloaded\n\nClick the button to check the MD5 sum");
								textView.setText("Latest build is already downloaded.\n\nReady to check md5\n\nBe patient after clicking!");
								buttonTextView.setText("Check MD5 Now");
								ALREADY_CHECKED = 2;
							} else {
								showCustomToast("Download not yet complete\n\nCheck the notification dropdown\nfor download status.\n\nOr press back to exit the Updater,\ndelete the partially downloaded file,\nand restart Updater to try again.");
								textView.setText("Download not complete.\n\nCheck the notification dropdown\nand try again.\n\nIf you have an incomplete download,\ndelete the partially downloaded file,\nand try again.");
								buttonTextView.setText("Check Download Status");
								ALREADY_CHECKED = 2;
							}
						} else {
							textView.setText("Change Log "+theDate+"\n\n"+theChangeLog);
							showCustomToast("A new build is available:\n\nBACKside-IHO-VM670-"+theDate);
							buttonTextView.setText("Download Now");
						}
					} else {
						textView.setText("Current: "+BUILD_DATE+"\n\nAvailable: "+theDate+"\n\nCheck again later");
						buttonTextView.setText("Already Up To Date");
					}
				} else {
					if (ALREADY_CHECKED == 1){
						if(upToDate){
							System.exit(0);
						} else {
							ALREADY_CHECKED = 2;
							Intent downloadUpdate = new Intent(Intent.ACTION_VIEW);
							downloadUpdate.setData(Uri.parse(theUrl));
							startActivity(downloadUpdate);
							textView.setText("Wait for download to complete\n\nReboot into recovery\n\nWipe cache & dalvik cache\nThen flash the zip file");
							buttonTextView.setText("Check Download Status");
						}
					} else {
						downloadComplete = checkFileSize(romName);
						if (!(downloadComplete)) {
							if(checkMD5(theMD5, romName)){
								new AlertDialog.Builder(this)
								.setTitle("MD5 Verified!")
								.setIcon(R.drawable.download_complete_icon)
								.setMessage("Reboot into recovery,\nwipe cache & dalvik-cache,\nthen flash the zip file located\nin the download directory")
								.setPositiveButton("Reboot Recovery", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Rebooting into Recovery...");
										RebootCmd("reboot", "recovery");
									}
								})
								.setNegativeButton("Later", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Yummy Gingerbread!");
										System.exit(0);
										}
								}).show();
							} else {
								new AlertDialog.Builder(this)
								.setTitle("Download Error")
								.setIcon(R.drawable.md5_error)
								.setMessage("The downloaded file md5\n"+downloadMD5+"\ndoes not match the build\n"+theMD5+"\nTry downloading again!")
								.setPositiveButton("Download again", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										ALREADY_CHECKED = 2;
										textView.setText("Wait for download to complete\n\nCheck the notification dropdown");
										buttonTextView.setText("Check Again");
										Intent downloadUpdate = new Intent(Intent.ACTION_VIEW);
										downloadUpdate.setData(Uri.parse(theUrl));
										startActivity(downloadUpdate);
										}
								})
								.setNegativeButton("Later", new DialogInterface.OnClickListener() {
										public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Yummy Gingerbread!");
										System.exit(0);
										}
								}).show();
							}
						} else {
							ALREADY_CHECKED = 2;
							String file = android.os.Environment.getExternalStorageDirectory().getPath() + localFileName;
							File f = new File(file);
							if (f.exists()) {
								showCustomToast("Download not yet complete\n\nCheck the notification dropdown\nfor download status.\n\nOr press back to exit the Updater,\ndelete the partially downloaded file,\nand restart Updater to try again.");
							} else {
								ALREADY_CHECKED = 1;
								showCustomToast("Download has not started\n\nClick the button to try again now.");
								buttonTextView.setText("Download Now");
							}
						}
					}
				}
			}
			catch (Exception e) {
				System.out.println("Nay, did not work");
				textView.setText(e.getMessage());
				}
			break;
			}
		}

Output:
	public void myClickHandler(View view) {
		switch (view.getId()) {
		case R.id.BacksideUpdaterButton:
			try {
				if (ALREADY_CHECKED == 0) {
					ALREADY_CHECKED = 1;
					textView.setText("");
					HttpClient client = new DefaultHttpClient();
					HttpGet request = new HttpGet(updateManifestUrl);
					HttpResponse response = client.execute(request);
					BufferedReader rd = new BufferedReader(new InputStreamReader(
							response.getEntity().getContent()));
					String line = rd.readLine();
					String[] separated = line.split(",");
					theDate = separated[0];
					theUrl = separated[1];
					theChangeLog = separated[2];
					theMD5 = separated[3];
					romName = separated[4];
					localFileName = "/download/"+romName;
					theFileSize = separated[5];
					upToDate = (BUILD_DATE >= Integer.parseInt(theDate));
					String file = android.os.Environment.getExternalStorageDirectory().getPath() + localFileName;
					File f = new File(file);
					if (!upToDate) {
						if (f.exists()) {
							if (!checkFileSize(romName)){
								showCustomToast("The latest build is already downloaded\n\nClick the button to check the MD5 sum");
								textView.setText("Latest build is already downloaded.\n\nReady to check md5\n\nBe patient after clicking!");
								buttonTextView.setText("Check MD5 Now");
								ALREADY_CHECKED = 2;
							} else {
								showCustomToast("Download not yet complete\n\nCheck the notification dropdown\nfor download status.\n\nOr press back to exit the Updater,\ndelete the partially downloaded file,\nand restart Updater to try again.");
								textView.setText("Download not complete.\n\nCheck the notification dropdown\nand try again.\n\nIf you have an incomplete download,\ndelete the partially downloaded file,\nand try again.");
								buttonTextView.setText("Check Download Status");
								ALREADY_CHECKED = 2;
							}
						} else {
							textView.setText("Change Log "+theDate+"\n\n"+theChangeLog);
							showCustomToast("A new build is available:\n\nBACKside-IHO-VM670-"+theDate);
							buttonTextView.setText("Download Now");
						}
					} else {
						textView.setText("Current: "+BUILD_DATE+"\n\nAvailable: "+theDate+"\n\nCheck again later");
						buttonTextView.setText("Already Up To Date");
					}
				} else {
					if (ALREADY_CHECKED == 1){
						if(upToDate){
							System.exit(0);
						} else {
							ALREADY_CHECKED = 2;
							Intent downloadUpdate = new Intent(Intent.ACTION_VIEW);
							downloadUpdate.setData(Uri.parse(theUrl));
							startActivity(downloadUpdate);
							textView.setText("Wait for download to complete\n\nReboot into recovery\n\nWipe cache & dalvik cache\nThen flash the zip file");
							buttonTextView.setText("Check Download Status");
						}
					} else {
						downloadComplete = checkFileSize(romName);
						if (!(downloadComplete)) {
							if(checkMD5(theMD5, romName)){
								new AlertDialog.Builder(this)
								.setTitle("MD5 Verified!")
								.setIcon(R.drawable.download_complete_icon)
								.setMessage("Reboot into recovery,\nwipe cache & dalvik-cache,\nthen flash the zip file located\nin the download directory")
								.setPositiveButton("Reboot Recovery", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Rebooting into Recovery...");
										RebootCmd("reboot", "recovery");
									}
								})
								.setNegativeButton("Later", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Yummy Gingerbread!");
										System.exit(0);
										}
								}).show();
							} else {
								new AlertDialog.Builder(this)
								.setTitle("Download Error")
								.setIcon(R.drawable.md5_error)
								.setMessage("The downloaded file md5\n"+downloadMD5+"\ndoes not match the build\n"+theMD5+"\nTry downloading again!")
								.setPositiveButton("Download again", new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog, int whichButton) {
										ALREADY_CHECKED = 2;
										textView.setText("Wait for download to complete\n\nCheck the notification dropdown");
										buttonTextView.setText("Check Again");
										Intent downloadUpdate = new Intent(Intent.ACTION_VIEW);
										downloadUpdate.setData(Uri.parse(theUrl));
										startActivity(downloadUpdate);
										}
								})
								.setNegativeButton("Later", new DialogInterface.OnClickListener() {
										public void onClick(DialogInterface dialog, int whichButton) {
										textView.setText("Yummy Gingerbread!");
										System.exit(0);
										}
								}).show();
							}
						} else {
							ALREADY_CHECKED = 2;
							String file = android.os.Environment.getExternalStorageDirectory().getPath() + localFileName;
							File f = new File(file);
							if (f.exists()) {
								showCustomToast("Download not yet complete\n\nCheck the notification dropdown\nfor download status.\n\nOr press back to exit the Updater,\ndelete the partially downloaded file,\nand restart Updater to try again.");
							} else {
								ALREADY_CHECKED = 1;
								showCustomToast("Download has not started\n\nClick the button to try again now.");
								buttonTextView.setText("Download Now");
							}
						}
					}
				}
			}
			catch (Exception e) {
				System.out.println("Nay, did not work");
				textView.setText(e.getMessage());
				}
			break;
			}
		}


Input:
  private static AbstractValueType mapNumericType(SPSSVariable variable) {
    switch(getSpssNumericDataType(variable)) {
      case COMMA:
      case DOLLAR:
      case DOT:
      case FIXED:
      case SCIENTIFIC:
        return variable.getDecimals() > 0 ? DecimalType.get() : IntegerType.get();
      case DATE:
      case ADATE:
      case EDATE:
      case SDATE:
        return DateType.get();
      case DATETIME:
        return DateTimeType.get();
      case TIME:
      case JDATE:
      case DTIME:
      case WEEK_DAY:
      case MONTH:
      case MONTH_YEAR:
      case QUARTERLY_YEAR:
      case WEEK_YEAR:
      case CUSTOM_CURRENCY_A:
      case CUSTOM_CURRENCY_B:
      case CUSTOM_CURRENCY_C:
      case CUSTOM_CURRENCY_D:
      case CUSTOM_CURRENCY_E:
      default:
        return TextType.get();
    }
  }

Output:
  private static AbstractValueType mapNumericType(SPSSVariable variable) {
    switch(getSpssNumericDataType(variable)) {
      case COMMA:
      case DOLLAR:
      case DOT:
      case FIXED:
      case SCIENTIFIC:
        return variable.getDecimals() > 0 ? DecimalType.get() : IntegerType.get();
      case ADATE:
      case EDATE:
      case SDATE:
        return DateType.get();
      case DATETIME:
        return DateTimeType.get();
      case DATE:
      case TIME:
      case JDATE:
      case DTIME:
      case WEEK_DAY:
      case MONTH:
      case MONTH_YEAR:
      case QUARTERLY_YEAR:
      case WEEK_YEAR:
      case CUSTOM_CURRENCY_A:
      case CUSTOM_CURRENCY_B:
      case CUSTOM_CURRENCY_C:
      case CUSTOM_CURRENCY_D:
      case CUSTOM_CURRENCY_E:
      default:
        return TextType.get();
    }
  }


Input:
		public void run() {
			while (true) {
				output.println("I get to run!!!");
				try {
					Thread.sleep(10);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				Packet p = new Packet(theRF.receive());
				short destAddr = p.getDestAddr();
				if((destAddr&0xffff) == ourMAC || (destAddr&0xffff) == 65535){
					output.println("Packet for us");
					if((destAddr&0xffff) == ourMAC && p.getFrameType() == 0){
						try {
							theLinkLayer.getIn().put(p);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						byte[] fakeCRC = new byte[4];
						fakeCRC[0] = 15;
						fakeCRC[1] = 15;
						fakeCRC[2] = 15;
						fakeCRC[3] = 15;
						Packet ack = new Packet(1, p.getSeqNum(), p.getSrcAddr(), ourMAC, null, fakeCRC);
						try {
							Thread.sleep((long)0.01);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						output.println("RF is free: "+ theRF.inUse());
						theRF.transmit(ack.getFrame());
						output.println("Sent an ACK");
					}
					else if((destAddr&0xffff) == ourMAC && p.getFrameType() == 1){
						output.println("Saw an ACK");
						if(theLinkLayer.recievedACKS.containsKey(p.getSrcAddr())){
							if(theLinkLayer.recievedACKS.get(p.getSrcAddr()).contains(p.getSeqNum())){
								output.println("Already got this ACK");
							}
							else{
								theLinkLayer.recievedACKS.get(p.getSrcAddr()).add(p.getSeqNum());
								output.println("Added an ACK for "+ p.getSeqNum()+ " from "+p.getSrcAddr());
							}
						}
						else{
							ArrayList<Short> newHost = new ArrayList<Short>();
							newHost.add(p.getSeqNum());
							theLinkLayer.recievedACKS.put(p.getSrcAddr(), newHost);
							output.println("Added an ACK for "+ p.getSeqNum()+ " from "+p.getSrcAddr());
						}
					}
					else{
						output.println("Didn't ACK a packet of type: "+ p.getFrameType() + " to address "+ (destAddr&0xffff));
					}
				}
				else{
					output.println("Addr: "+ destAddr);
				}
			}
		}

Output:
		public void run() {
			while (true) {
				output.println("I get to run!!!");
				try {
					Thread.sleep(10);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				Packet p = new Packet(theRF.receive());
				short destAddr = p.getDestAddr();
				if((destAddr&0xffff) == ourMAC || (destAddr&0xffff) == 65535){
					output.println("Packet for us");
					if((destAddr&0xffff) == ourMAC && p.getFrameType() == 0){
						try {
							theLinkLayer.getIn().put(p);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						byte[] fakeCRC = new byte[4];
						fakeCRC[0] = 15;
						fakeCRC[1] = 15;
						fakeCRC[2] = 15;
						fakeCRC[3] = 15;
						Packet ack = new Packet(1, p.getSeqNum(), p.getSrcAddr(), ourMAC, null, fakeCRC);
						try {
							Thread.sleep(RF.aSIFSTime);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						output.println("RF is free: "+ theRF.inUse());
						theRF.transmit(ack.getFrame());
						output.println("Sent an ACK");
					}
					else if((destAddr&0xffff) == ourMAC && p.getFrameType() == 1){
						output.println("Saw an ACK");
						if(theLinkLayer.recievedACKS.containsKey(p.getSrcAddr())){
							if(theLinkLayer.recievedACKS.get(p.getSrcAddr()).contains(p.getSeqNum())){
								output.println("Already got this ACK");
							}
							else{
								theLinkLayer.recievedACKS.get(p.getSrcAddr()).add(p.getSeqNum());
								output.println("Added an ACK for "+ p.getSeqNum()+ " from "+p.getSrcAddr());
							}
						}
						else{
							ArrayList<Short> newHost = new ArrayList<Short>();
							newHost.add(p.getSeqNum());
							theLinkLayer.recievedACKS.put(p.getSrcAddr(), newHost);
							output.println("Added an ACK for "+ p.getSeqNum()+ " from "+p.getSrcAddr());
						}
					}
					else{
						output.println("Didn't ACK a packet of type: "+ p.getFrameType() + " to address "+ (destAddr&0xffff));
					}
				}
				else{
					output.println("Addr: "+ destAddr);
				}
			}
		}


Input:
  protected boolean parseMsg(String body, Data data) {
    if (body.startsWith("KOOTENAI COUNTY SHERIFF ")) {
      body = body.substring(25).trim();
    }
    int pt = body.indexOf("\nSent by CLI");
    if (pt >= 0) body = body.substring(0,pt).trim();
    String[] flds = body.split("\n");
    if (flds.length < 5) return false;
    return parseFields(flds, data);
  }

Output:
  protected boolean parseMsg(String body, Data data) {
    if (body.startsWith("KOOTENAI COUNTY SHERIFF ")) {
      body = body.substring(24).trim();
    }
    int pt = body.indexOf("\nSent by CLI");
    if (pt >= 0) body = body.substring(0,pt).trim();
    String[] flds = body.split("\n");
    if (flds.length < 5) return false;
    return parseFields(flds, data);
  }


Input:
	public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
	{
		ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
		drops.add(new ItemStack(blockID, 1, 0));
		if((metadata & 3) > 0)
		{
			drops.add(new ItemStack(MineFactoryReloadedCore.rawRubberItem, 1 + world.rand.nextInt(fortune)));
		}
		return drops;
	}

Output:
	public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
	{
		ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
		drops.add(new ItemStack(blockID, 1, 0));
		if((metadata & 3) > 0)
		{
			drops.add(new ItemStack(MineFactoryReloadedCore.rawRubberItem, fortune <= 0 ? 1 : 1 + world.rand.nextInt(fortune)));
		}
		return drops;
	}


Input:
    public ImageIcon getIcon(Class<?> loader,String iconName) {
        if(!loadedIcons.containsKey(iconName)) {
            URL url = loader.getResource(iconName+".png");
            if(url!=null) {
                ImageIcon newIcon = new ImageIcon(url);
                loadedIcons.put(iconName, newIcon);
                return newIcon;
            } else {
                LOG.warn(I18N.getString("sif.icons.OrbisGISIcon.icon_not_found")+" : "+iconName);
                loadedIcons.put(iconName, ORBISGIS_MISSING_ICON);
                return ORBISGIS_MISSING_ICON;
            }
        } else {
            return loadedIcons.get(iconName);
        }
    }

Output:
    public ImageIcon getIcon(Class<?> loader,String iconName) {
        if(!loadedIcons.containsKey(iconName)) {
            String resourceName = iconName+".png";
            URL url = loader.getResource(resourceName);
            if(url!=null) {
                ImageIcon newIcon = new ImageIcon(url);
                loadedIcons.put(iconName, newIcon);
                return newIcon;
            } else {
                LOG.warn(I18N.getString("sif.icons.OrbisGISIcon.icon_not_found")+" : "+resourceName);
                loadedIcons.put(iconName, ORBISGIS_MISSING_ICON);
                return ORBISGIS_MISSING_ICON;
            }
        } else {
            return loadedIcons.get(iconName);
        }
    }


Input:
    public void setupTrigger() throws SchedulerException {
        scheduler = new StdSchedulerFactory().getScheduler();
        Set<CronTaskEntity> allCronTasks = cronService.getAllCronTasks();
        for (CronTaskEntity cronTaskEntity : allCronTasks) {
            JobDataMap jobDataMap = new JobDataMap();
            jobDataMap.put("frequency", cronTaskEntity.getFrequency());
            JobDetail job = new JobDetail();
            job.setName(cronTaskEntity.getFrequency().getFrequencyName());
            job.setJobClass(IndicatorValueCalculatorJob.class);
            job.setJobDataMap(jobDataMap);
            Trigger trigger = prepareTrigger(cronTaskEntity);
            scheduler.scheduleJob(job, trigger);
        }
        scheduler.start();
        scheduler.shutdown(true);
    }

Output:
    public void setupTrigger() throws SchedulerException {
        scheduler = new StdSchedulerFactory().getScheduler();
        Set<CronTaskEntity> allCronTasks = cronService.getAllCronTasks();
        for (CronTaskEntity cronTaskEntity : allCronTasks) {
            JobDataMap jobDataMap = new JobDataMap();
            jobDataMap.put("frequency", cronTaskEntity.getFrequency());
            JobDetail job = new JobDetail();
            job.setName(cronTaskEntity.getFrequency().getFrequencyName());
            job.setJobClass(IndicatorValueCalculatorJob.class);
            job.setJobDataMap(jobDataMap);
            Trigger trigger = prepareTrigger(cronTaskEntity);
            scheduler.scheduleJob(job, trigger);
        }
        scheduler.start();
    }


Input:
		public void action() {
			Message msg= (Message)message.getContentObject();
			History hist = msg.getHistory();
			HistEl prevEl = hist.getPreviousElement(0);
			HistEl prevprev_el = hist.getPreviousElement(1);
			agent.setBOTTOM(new BottomEl(prevEl.getLiteral(), hist.pop())) = true;
			boolean all_true = true;
			for(Literal l: prevprev_el.getClause().asLiterals())
				if(agent.getBOTTOM(new BottomEl(l, hist.pop())) == false)
					all_true = false;
			if(all_true) {
				if((hist.pop().pop()).isEmpty()) {
					System.out.println("back");
					System.out.println("final");
				}
				else {
					ACLMessage r1 = new ACLMessage();
					r1.addReceiver(message.getSender());
					r1.setContentObject(new BackMessage(hist.pop(), Clause.trueClause()));
					myAgent.send(r1);
					ACLMessage r2 = new ACLMessage();
					r2.addReceiver(message.getSender());
					r2.setContentObject(new FinalMessage(hist.pop(), Clause.trueClause()));
					myAgent.send(r2);
				}
			}
		}

Output:
		public void action() {
			Message msg= (Message)message.getContentObject();
			History hist = msg.getHistory();
			HistEl prevEl = hist.getPreviousElement(0);
			HistEl prevprev_el = hist.getPreviousElement(1);
			agent.setBOTTOM(new BottomEl(prevEl.getLiteral(), hist.pop()), true);
			boolean all_true = true;
			for(Literal l: prevprev_el.getClause().asLiterals())
				if(agent.getBOTTOM(new BottomEl(l, hist.pop())) == false)
					all_true = false;
			if(all_true) {
				if((hist.pop().pop()).isEmpty()) {
					System.out.println("back");
					System.out.println("final");
				}
				else {
					ACLMessage r1 = new ACLMessage();
					r1.addReceiver(message.getSender());
					r1.setContentObject(new BackMessage(hist.pop(), Clause.trueClause()));
					myAgent.send(r1);
					ACLMessage r2 = new ACLMessage();
					r2.addReceiver(message.getSender());
					r2.setContentObject(new FinalMessage(hist.pop(), Clause.trueClause()));
					myAgent.send(r2);
				}
			}
		}


Input:
	public static Test suite() {
		TestSuite suite = new TestSuite("Test for org.eclipse.mylar.bugzilla.tests");
		suite.addTestSuite(Bugzilla220ParserTest.class);
		suite.addTestSuite(BugzillaRepositoryClientTest.class);
		suite.addTestSuite(EncodingTest.class);
		suite.addTestSuite(NewBugWizardTest.class);
		suite.addTestSuite(RegularExpressionMatchTest.class);
		suite.addTestSuite(BugzillaNewBugParserTestCDT.class);
		suite.addTestSuite(BugzillaNewBugParserTestEquinox.class);
		suite.addTestSuite(BugzillaNewBugParserTestGMT.class);
		suite.addTestSuite(BugzillaNewBugParserTestPlatform.class);
		suite.addTestSuite(BugzillaNewBugParserTestVE.class);
		suite.addTestSuite(BugzillaParserTestNoBug.class);
		suite.addTestSuite(BugzillaProductParserTest.class);
		return suite;
	}

Output:
	public static Test suite() {
		TestSuite suite = new TestSuite("Test for org.eclipse.mylar.bugzilla.tests");
		suite.addTestSuite(Bugzilla220ParserTest.class);
		suite.addTestSuite(BugzillaRepositoryConnectorTest.class);
		suite.addTestSuite(EncodingTest.class);
		suite.addTestSuite(NewBugWizardTest.class);
		suite.addTestSuite(RegularExpressionMatchTest.class);
		suite.addTestSuite(BugzillaNewBugParserTestCDT.class);
		suite.addTestSuite(BugzillaNewBugParserTestEquinox.class);
		suite.addTestSuite(BugzillaNewBugParserTestGMT.class);
		suite.addTestSuite(BugzillaNewBugParserTestPlatform.class);
		suite.addTestSuite(BugzillaNewBugParserTestVE.class);
		suite.addTestSuite(BugzillaParserTestNoBug.class);
		suite.addTestSuite(BugzillaProductParserTest.class);
		return suite;
	}


Input:
    public SimpleObject getVisitDetails(
            @SpringBean("adminService") AdministrationService administrationService,
            @RequestParam("visitId") Visit visit,
            UiUtils uiUtils,
            EmrContext emrContext) throws ParseException {
        SimpleObject simpleObject = SimpleObject.fromObject(visit, uiUtils, "id", "location");
        User authenticatedUser = emrContext.getUserContext().getAuthenticatedUser();
        boolean canDelete = authenticatedUser.hasPrivilege(EmrConstants.PRIVILEGE_DELETE_ENCOUNTER);
        Date startDatetime = visit.getStartDatetime();
        Date stopDatetime = visit.getStopDatetime();
        simpleObject.put("startDatetime", DateFormatUtils.format(startDatetime, "dd MMM yyyy hh:mm a"));
        if (stopDatetime!=null){
            simpleObject.put("stopDatetime", DateFormatUtils.format(stopDatetime, "dd MMM yyyy hh:mm a"));
        } else {
            simpleObject.put("stopDatetime", null);
        }
        List<SimpleObject> encounters = new ArrayList<SimpleObject>();
        simpleObject.put("encounters", encounters);
        String[] datePatterns = { administrationService.getGlobalProperty(UiFrameworkConstants.GP_FORMATTER_DATETIME_FORMAT) };
        for (Encounter e : visit.getEncounters()) {
            if (!e.getVoided()) {
                SimpleObject simpleEncounter = SimpleObject.fromObject(e, uiUtils,  "encounterId", "encounterDatetime", "location", "encounterProviders.provider", "voided", "form");
                Date encounterDatetime = DateUtils.parseDate((String) simpleEncounter.get("encounterDatetime"), datePatterns);
                simpleEncounter.put("encounterDate", DateFormatUtils.format(encounterDatetime, "dd MMM yyyy"));
                simpleEncounter.put("encounterTime", DateFormatUtils.format(encounterDatetime, "hh:mm a"));
                EncounterType encounterType = e.getEncounterType();
                simpleEncounter.put("encounterType", SimpleObject.create("uuid", encounterType.getUuid(), "name", uiUtils.format(encounterType)));
                if(canDelete){
                    simpleEncounter.put("canDelete", true);
                }
                encounters.add(simpleEncounter);
            }
        }
        return simpleObject;
    }

Output:
    public SimpleObject getVisitDetails(
            @SpringBean("adminService") AdministrationService administrationService,
            @RequestParam("visitId") Visit visit,
            UiUtils uiUtils,
            EmrContext emrContext) throws ParseException {
        SimpleObject simpleObject = SimpleObject.fromObject(visit, uiUtils, "id", "location");
        User authenticatedUser = emrContext.getUserContext().getAuthenticatedUser();
        boolean canDelete = authenticatedUser.hasPrivilege(EmrConstants.PRIVILEGE_DELETE_ENCOUNTER);
        Date startDatetime = visit.getStartDatetime();
        Date stopDatetime = visit.getStopDatetime();
        simpleObject.put("startDatetime", DateFormatUtils.format(startDatetime, "dd MMM yyyy hh:mm a", emrContext.getUserContext().getLocale()));
        if (stopDatetime!=null){
            simpleObject.put("stopDatetime", DateFormatUtils.format(stopDatetime, "dd MMM yyyy hh:mm a", emrContext.getUserContext().getLocale()));
        } else {
            simpleObject.put("stopDatetime", null);
        }
        List<SimpleObject> encounters = new ArrayList<SimpleObject>();
        simpleObject.put("encounters", encounters);
        String[] datePatterns = { administrationService.getGlobalProperty(UiFrameworkConstants.GP_FORMATTER_DATETIME_FORMAT) };
        for (Encounter e : visit.getEncounters()) {
            if (!e.getVoided()) {
                SimpleObject simpleEncounter = SimpleObject.fromObject(e, uiUtils,  "encounterId", "location", "encounterProviders.provider", "voided", "form");
                simpleEncounter.put("encounterDate", DateFormatUtils.format(e.getEncounterDatetime(), "dd MMM yyyy", emrContext.getUserContext().getLocale()));
                simpleEncounter.put("encounterTime", DateFormatUtils.format(e.getEncounterDatetime(), "hh:mm a", emrContext.getUserContext().getLocale()));
                EncounterType encounterType = e.getEncounterType();
                simpleEncounter.put("encounterType", SimpleObject.create("uuid", encounterType.getUuid(), "name", uiUtils.format(encounterType)));
                if(canDelete){
                    simpleEncounter.put("canDelete", true);
                }
                encounters.add(simpleEncounter);
            }
        }
        return simpleObject;
    }


Input:
	public void editorOpened(IEditorPart editorPartOpened) {
		IWorkbenchPage page = editorPartOpened.getSite().getPage();
		List<IEditorReference> toClose = new ArrayList<IEditorReference>();
		int totalTaskEditors = 0;
		for (IEditorReference editorReference : page.getEditorReferences()) {
			if (editorReference.getId().equals(TaskEditor.ID_EDITOR)) {
				totalTaskEditors++;
			}
		}
		if (totalTaskEditors > MAX_EDITORS) {
			for (IEditorReference editorReference : page.getEditorReferences()) {
				try {
					if (editorReference.getId().equals(TaskEditor.ID_EDITOR)) {
						TaskEditorInput taskEditorInput = (TaskEditorInput) editorReference.getEditorInput();
						TaskEditor taskEditor = (TaskEditor) editorReference.getEditor(false);
						if (taskEditor == null) {
							toClose.add(editorReference);
						} else if (!taskEditor.equals(editorPartOpened) && !taskEditor.isDirty()
								&& taskEditorInput.getTask() != null
								&& taskEditorInput.getTask().getSynchronizationState().isSynchronized()) {
							toClose.add(editorReference);
						}
					}
					if ((totalTaskEditors - toClose.size()) < MAX_EDITORS) {
						break;
					}
				} catch (PartInitException e) {
				}
			}
		}
		if (toClose.size() > 0) {
			page.closeEditors(toClose.toArray(new IEditorReference[toClose.size()]), true);
		}
	}

Output:
	public void editorOpened(IEditorPart editorPartOpened) {
		IWorkbenchPage page = editorPartOpened.getSite().getPage();
		List<IEditorReference> toClose = new ArrayList<IEditorReference>();
		int totalTaskEditors = 0;
		for (IEditorReference editorReference : page.getEditorReferences()) {
			if (TaskEditor.ID_EDITOR.equals(editorReference.getId())) {
				totalTaskEditors++;
			}
		}
		if (totalTaskEditors > MAX_EDITORS) {
			for (IEditorReference editorReference : page.getEditorReferences()) {
				try {
					if (TaskEditor.ID_EDITOR.equals(editorReference.getId())) {
						TaskEditorInput taskEditorInput = (TaskEditorInput) editorReference.getEditorInput();
						TaskEditor taskEditor = (TaskEditor) editorReference.getEditor(false);
						if (taskEditor == null) {
							toClose.add(editorReference);
						} else if (!taskEditor.equals(editorPartOpened) && !taskEditor.isDirty()
								&& taskEditorInput.getTask() != null
								&& taskEditorInput.getTask().getSynchronizationState().isSynchronized()) {
							toClose.add(editorReference);
						}
					}
					if ((totalTaskEditors - toClose.size()) < MAX_EDITORS) {
						break;
					}
				} catch (PartInitException e) {
				}
			}
		}
		if (toClose.size() > 0) {
			page.closeEditors(toClose.toArray(new IEditorReference[toClose.size()]), true);
		}
	}


Input:
    private void generate(File dir) throws Exception {
        final File readme = new File(dir, "README.md");
        final PrintStream out = new PrintStream(IO.write(readme));
        out.print("Title: ");
        out.println(title(dir));
        out.println();
        out.println("*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/" + dir.getName() + ") or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/" + dir.getName() + "). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*");
        final File main = Files.file(dir, "src", "main");
        final File test = Files.file(dir, "src", "test");
        printJavaFiles(out, collect(main, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(main, Pattern.compile(".*\\.xml")));
        printJavaFiles(out, collect(test, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(test, Pattern.compile(".*\\.xml")));
        printBuildOutput(out, new File("/Users/dblevins/examples/"+dir.getName()+"/build.log"));
        out.close();
    }

Output:
    private void generate(File dir) throws Exception {
        final File readme = new File(dir, "README.md");
        final PrintStream out = new PrintStream(IO.write(readme));
        out.print("Title: ");
        out.println(title(dir));
        out.println();
        String path = dir.getAbsolutePath();
        path = path.substring(0, path.indexOf("examples/") + 10);
        out.println("*Help us document this example! Source available in [svn](http://svn.apache.org/repos/asf/openejb/trunk/openejb/examples/" + path + ") or [git](https://github.com/apache/openejb/tree/trunk/openejb/examples/" + path + "). Open a [JIRA](https://issues.apache.org/jira/browse/TOMEE) with patch or pull request*");
        final File main = Files.file(dir, "src", "main");
        final File test = Files.file(dir, "src", "test");
        printJavaFiles(out, collect(main, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(main, Pattern.compile(".*\\.xml")));
        printJavaFiles(out, collect(test, Pattern.compile(".*\\.java")));
        printXmlFiles(out, collect(test, Pattern.compile(".*\\.xml")));
        printBuildOutput(out, new File("/Users/dblevins/examples/"+dir.getName()+"/build.log"));
        out.close();
    }


Input:
	public Die(int side,int value) throws Exception
	{
		if (DiceTypes.isAllowed(side) == false)
			throw new Exception("Invalid Dice Type");
		else
		{
			i_sides = side;
			if (value >= 1 && value <= side)
				i_value = value;
			else
				throw new Exception("Invalid Value. Must be between 1 and side");
		}
	}

Output:
	public Die(int value,int side) throws Exception
	{
		if (DiceTypes.isAllowed(side) == false)
			throw new Exception("Invalid Dice Type");
		else
		{
			i_sides = side;
			if (value >= 1 && value <= side)
				i_value = value;
			else
				throw new Exception("Invalid Value. Must be between 1 and side");
		}
	}


Input:
  public Object clone() {
    LogicalColumn clone = new LogicalColumn();
    clone.setId(getId());
    clone.logicalTable = logicalTable;
    clone.physicalColumn = physicalColumn;
    for (String key : getChildProperties().keySet()) {
      clone.setProperty(key, getChildProperty(key));
    }
    return clone;
  }

Output:
  public Object clone() {
    LogicalColumn clone = new LogicalColumn();
    clone.setId(getId());
    clone.logicalTable = logicalTable;
    clone.physicalColumn = physicalColumn;
    clone.setParentConcept(getParentConcept());
    for (String key : getChildProperties().keySet()) {
      clone.setProperty(key, getChildProperty(key));
    }
    return clone;
  }


Input:
	public void execute() throws MojoExecutionException {
		try {
			if (ignoreMissingFile && !fileExists(file)) {
				getLog().info("Ignoring missing file");
				return;
			}
			getLog().info("Replacing " + token + " with " + value + " in " + file);
			if (outputFile != null) {
				getLog().info("Outputting to: " + outputFile);
			}
			getTokenReplacer().replaceTokens(token, value, isRegex());
		} catch (IOException e) {
			throw new MojoExecutionException(e.getMessage());
		}
	}

Output:
	public void execute() throws MojoExecutionException {
		try {
			if (ignoreMissingFile && !fileExists(file)) {
				getLog().info("Ignoring missing file");
				return;
			}
      if (value != null) {
          getLog().info("Replacing " + token + " with " + value + " in " + file);
		  } else {
          getLog().info("Removing all instances of" + token + " in " + file);
			}
			if (outputFile != null) {
				getLog().info("Outputting to: " + outputFile);
			}
			getTokenReplacer().replaceTokens(token, value, isRegex());
		} catch (IOException e) {
			throw new MojoExecutionException(e.getMessage());
		}
	}


Input:
	private void addCreateProject() {
		SimplePanel container;
		LayoutContainer horizontalTable = new LayoutContainer();
		horizontalTable.addStyleName("row");
	    container = new SimplePanel(new HTML(SafeHtmlUtils.fromSafeConstant("<h1>" + DisplayConstants.LABEL_PROJECT_NAME + "</h1>")));
	    container.addStyleName("col-md-3");
	    horizontalTable.add(container);
		final TextBox textField = new TextBox();
		textField.setStyleName("form-control input-lg");
		textField.addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(KeyDownEvent event) {
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
					createProject(textField.getValue());
	            }
			}
		});
	    container = new SimplePanel(textField);
	    container.addStyleName("col-md-7");
	    horizontalTable.add(container);
		LayoutContainer searchButtonContainer = new LayoutContainer();
		Button createBtn = DisplayUtils.createButton(DisplayConstants.LABEL_CREATE, ButtonType.DEFAULT);
		createBtn.addStyleName("btn-block btn-lg");
		createBtn.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				createProject(textField.getValue());
			}
		});
	    searchButtonContainer.add(createBtn);
	    container = new SimplePanel(searchButtonContainer);
	    container.addStyleName("col-md-2");
	    horizontalTable.add(container);
	    createProjectPanel.clear();
	    createProjectPanel.add(horizontalTable);
	}

Output:
	private void addCreateProject() {
		SimplePanel container;
		LayoutContainer horizontalTable = new LayoutContainer();
		horizontalTable.addStyleName("row");
	    container = new SimplePanel(new HTML(SafeHtmlUtils.fromSafeConstant("<h1>" + DisplayConstants.LABEL_PROJECT_NAME + "</h1>")));
	    container.addStyleName("col-md-3");
	    horizontalTable.add(container);
		final TextBox textField = new TextBox();
		textField.setStyleName("form-control input-lg");
		textField.addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(KeyDownEvent event) {
				if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
					createProject(textField.getValue());
	            }
			}
		});
	    container = new SimplePanel(textField);
	    container.addStyleName("col-md-7 col-sm-8 col-xs-8");
	    horizontalTable.add(container);
		LayoutContainer searchButtonContainer = new LayoutContainer();
		Button createBtn = DisplayUtils.createButton(DisplayConstants.LABEL_CREATE, ButtonType.DEFAULT);
		createBtn.addStyleName("btn-block btn-lg");
		createBtn.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				createProject(textField.getValue());
			}
		});
	    searchButtonContainer.add(createBtn);
	    container = new SimplePanel(searchButtonContainer);
	    container.addStyleName("col-md-2 col-sm-4 col-xs-4");
	    horizontalTable.add(container);
	    createProjectPanel.clear();
	    createProjectPanel.add(horizontalTable);
	}


Input:
	public static Bitmap fixOrientation(Bitmap bm, int currentOrientation)
	{
		switch (currentOrientation)
		{
			case 2:
			{
				return flip(bm, FLIP_HORIZONTAL);
			}
			case 3:
			{
				return rotate(bm, -180);
			}
			case 4:
			{
				return flip(bm, FLIP_VERTICAL);
			}
			case 5:
			{
				return rotate(flip(bm, FLIP_VERTICAL), 90);
			}
			case 6:
			{
				return rotate(bm, 90);
			}
			case 7:
			{
				return rotate(flip(bm, FLIP_HORIZONTAL), 90);
			}
			case 8:
			{
				return rotate(bm, 90);
			}
		}
		return bm;
	}

Output:
	public static Bitmap fixOrientation(Bitmap bm, int currentOrientation)
	{
		switch (currentOrientation)
		{
			case 2:
			{
				return flip(bm, FLIP_HORIZONTAL);
			}
			case 3:
			{
				return rotate(bm, -180);
			}
			case 4:
			{
				return flip(bm, FLIP_VERTICAL);
			}
			case 5:
			{
				return rotate(flip(bm, FLIP_VERTICAL), 90);
			}
			case 6:
			{
				return rotate(bm, 90);
			}
			case 7:
			{
				return rotate(flip(bm, FLIP_HORIZONTAL), 90);
			}
			case 8:
			{
				return rotate(bm, 90);
			}
		}
		return bm;
	}


Input:
  public static void requestFriends(Long id) {
    User user = user();
    User other = User.findById(id);
    Relationship r1 = Relationship.find("SELECT r FROM Relationship r where r.from = ? AND r.to = ?", user, other).first();
    Relationship r2 = Relationship.find("SELECT r FROM Relationship r where r.to = ? AND r.from = ?", user, other).first();
    if (r1 == null) {
      r1 = new Relationship(user, other, true);
    }
    if (r2 != null) {
      if (r2.requested) {
        r1.requested = false;
        r2.requested = false;
        r1.accepted = true;
        r2.accepted = true;
        r1.save();
        r2.save();
      } else if (r2.accepted){
        news(id);
        return;
      } else {
        r1.requested = true;
      }
    }
    else if (r1 != null) {
      if (r1.requested) {
        news(id);
        return;
      } else {
        r1.requested = true;
        r1.save();
        news(id);
        return;
      }
    }
    r1.save();
    news(id);
  }

Output:
  public static void requestFriends(Long id) {
    User user = user();
    User other = User.findById(id);
    Relationship r1 = Relationship.find("SELECT r FROM Relationship r where r.from = ? AND r.to = ?", user, other).first();
    Relationship r2 = Relationship.find("SELECT r FROM Relationship r where r.to = ? AND r.from = ?", user, other).first();
    if (r1 == null) {
      r1 = new Relationship(user, other, true);
      r1.save();
    }
    if (r2 != null) {
      if (r2.requested) {
        r1.requested = false;
        r2.requested = false;
        r1.accepted = true;
        r2.accepted = true;
        r1.save();
        r2.save();
      } else if (r2.accepted){
        news(id);
        return;
      } else {
        r1.requested = true;
      }
    }
    else if (r1 != null) {
      if (r1.requested) {
        news(id);
        return;
      } else {
        r1.requested = true;
        r1.save();
        news(id);
        return;
      }
    }
    System.out.println(r1.requested);
    r1.save();
    news(id);
  }


Input:
   public void performHttp(HttpServletRewrite event, EvaluationContext context)
   {
      Gson gson = new Gson();
      try {
         String jsonString = event.getRequest().getParameter("payload");
         System.out.println(jsonString);
         Map json = gson.fromJson(jsonString, Map.class);
         StringMap repository = (StringMap) json.get("repository");
         String repo = (String) repository.get("url");
         if (!repo.endsWith(".git"))
            repo = repo + ".git";
         File repoDir = new File(root, safeFileName.transpose(event, context, repo));
         File cacheDir = new File(root, safeFileName.transpose(event, context, repo) + "-cache");
         if (!repoDir.exists())
         {
            repoDir.mkdirs();
            cacheDir.mkdirs();
            Git.cloneRepository().setURI(repo)
                     .setCloneAllBranches(true).setDirectory(repoDir).call();
         }
         else
         {
            try {
               Git git = GitUtils.git(repoDir);
               GitUtils.pull(git, 15);
               deleteRecursively(cacheDir);
               cacheDir.mkdirs();
            }
            catch (GitAPIException e) {
               throw new RewriteException("Could not pull from git repository.", e);
            }
         }
      }
      catch (Exception e) {
         throw new RewriteException("Error parsing update hook", e);
      }
   }

Output:
   public void performHttp(HttpServletRewrite event, EvaluationContext context)
   {
      Gson gson = new Gson();
      try {
         String jsonString = event.getRequest().getParameter("payload");
         System.out.println(jsonString);
         Map json = gson.fromJson(jsonString, Map.class);
         StringMap repository = (StringMap) json.get("repository");
         String repo = (String) repository.get("url");
         if (!repo.endsWith(".git"))
            repo = repo + ".git";
         File repoDir = new File(root, safeFileName.transpose(event, context, repo) + "/repo");
         File cacheDir = new File(root, safeFileName.transpose(event, context, repo) + "/caches");
         if (!repoDir.exists())
         {
            repoDir.mkdirs();
            cacheDir.mkdirs();
            Git.cloneRepository().setURI(repo)
                     .setCloneAllBranches(true).setDirectory(repoDir).call();
         }
         else
         {
            try {
               Git git = GitUtils.git(repoDir);
               GitUtils.pull(git, 15);
               deleteRecursively(cacheDir);
               cacheDir.mkdirs();
            }
            catch (GitAPIException e) {
               throw new RewriteException("Could not pull from git repository.", e);
            }
         }
      }
      catch (Exception e) {
         throw new RewriteException("Error parsing update hook", e);
      }
   }


Input:
    private String calculate() {
    	double money, buy_p, sell_p, ticket, tax;
    	try {
	    	money  = Double.parseDouble(i_money.getText().toString());
	    	buy_p  = Double.parseDouble(i_buy_p.getText().toString());
	    	sell_p = Double.parseDouble(i_sell_p.getText().toString());
	    	if(i_tax.getCheckedRadioButtonId() == i_tax_none.getId()) {
	    		tax = 0;
	    	} else if(i_tax.getCheckedRadioButtonId() == i_tax_cust.getId()) {
	    		tax = Double.parseDouble(i_cust_tax.getText().toString());
	    	} else {
	    		tax = 0;
	    	}
	    	ticket = Double.parseDouble(i_ticket.getText().toString());
    	} catch (NumberFormatException e) {
    		return "Please fill with valid information";
    	}
    	int amount = (int) Math.floor(money / buy_p);
    	double expenditure = amount * buy_p - 2 * ticket;
    	double revenue_taxless = amount * sell_p;
    	double revenue = amount * sell_p * (1 / (1 + tax / 100));
    	double income = revenue - expenditure;
    	return "You get: " 			+ amount 	+ " items\n" +
    		   "They cost (inc. travel): " + expenditure + "\n" +
    		   "They sell for: " 	+ revenue_taxless    + "\n" +
    		   "Profit: " 			+ income;
    }

Output:
    private String calculate() {
    	double money, buy_p, sell_p, ticket, tax;
    	try {
	    	money  = Double.parseDouble(i_money.getText().toString());
	    	buy_p  = Double.parseDouble(i_buy_p.getText().toString());
	    	sell_p = Double.parseDouble(i_sell_p.getText().toString());
	    	if(i_tax.getCheckedRadioButtonId() == i_tax_none.getId()) {
	    		tax = 0;
	    	} else if(i_tax.getCheckedRadioButtonId() == i_tax_cust.getId()) {
	    		tax = Double.parseDouble(i_cust_tax.getText().toString());
	    	} else {
	    		tax = 0;
	    	}
	    	ticket = Double.parseDouble(i_ticket.getText().toString());
    	} catch (NumberFormatException e) {
    		return "Please fill with valid information";
    	}
    	int amount = (int) Math.floor(money / buy_p);
    	double expenditure = amount * buy_p + 2 * ticket;
    	double revenue_taxless = amount * sell_p;
    	double revenue = amount * sell_p * (1 / (1 + tax / 100));
    	double income = revenue - expenditure;
    	return "You get: " 			+ amount 	+ " items\n" +
    		   "They cost (inc. travel): " + expenditure + "\n" +
    		   "They sell for: " 	+ revenue_taxless    + "\n" +
    		   "Profit: " 			+ income;
    }


Input:
	public Control createContents(Composite parent) {
		Composite client = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.numColumns = 3;
		layout.marginWidth = layout.marginHeight = 0;
		client.setLayout(layout);
		client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		Composite leftPanel = new Composite(client, SWT.NULL);
		GridLayout leftLayout = new GridLayout();
		leftLayout.numColumns = 1;
		leftLayout.marginWidth = leftLayout.marginHeight = 0;
		leftPanel.setLayout(leftLayout);
		leftPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
		Label label = new Label(leftPanel, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.jobsLabel"));
		createJobViewer(leftPanel);
		Composite centerPanel = new Composite(client, SWT.NULL);
		GridLayout centerLayout = new GridLayout();
		centerLayout.numColumns = 1;
		centerLayout.marginWidth = centerLayout.marginHeight = 0;
		centerPanel.setLayout(centerLayout);
		centerPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
		label = new Label(centerPanel, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.siteLabel"));
		createSiteViewer(centerPanel);
		Composite rightPanel = new Composite(client, SWT.NULL);
		GridLayout rightLayout = new GridLayout();
		rightLayout.numColumns = 1;
		rightLayout.marginWidth = rightLayout.marginHeight = 0;
		rightPanel.setLayout(rightLayout);
		rightPanel.setLayoutData(new GridData(GridData.FILL_VERTICAL));
		new Label(rightPanel, SWT.NULL);
		Composite buttonContainer = new Composite(rightPanel, SWT.NULL);
		GridLayout blayout = new GridLayout();
		blayout.marginWidth = blayout.marginHeight = 0;
		buttonContainer.setLayout(blayout);
		buttonContainer.setLayoutData(new GridData(GridData.FILL_VERTICAL));
		addButton = new Button(buttonContainer, SWT.PUSH);
		addButton.setText(UpdateUI.getString("InstallWizard.TargetPage.new"));
		addButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				addTargetLocation();
			}
		});
		addButton.setEnabled(false);
		addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
		SWTUtil.setButtonDimensionHint(addButton);
		deleteButton = new Button(buttonContainer, SWT.PUSH);
		deleteButton.setText(UpdateUI.getString("InstallWizard.TargetPage.delete"));
		deleteButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				try {
					removeSelection();
				}
				catch (CoreException ex) {
					UpdateUI.logException(ex);
				}
			}
		});
		deleteButton.setEnabled(false);
		deleteButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
		SWTUtil.setButtonDimensionHint(deleteButton);
		Composite status = new Composite(client, SWT.NULL);
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
		gd.horizontalSpan = 3;
		status.setLayoutData(gd);
		layout = new GridLayout();
		layout.numColumns = 2;
		status.setLayout(layout);
		label = new Label(status, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.requiredSpace"));
		requiredSpaceLabel = new Label(status, SWT.NULL);
		requiredSpaceLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		label = new Label(status, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.availableSpace"));
		availableSpaceLabel = new Label(status, SWT.NULL);
		availableSpaceLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		WorkbenchHelp.setHelp(client, "org.eclipse.update.ui.MultiTargetPage2");
		Dialog.applyDialogFont(parent);
		return client;
	}

Output:
	public Control createContents(Composite parent) {
		Composite client = new Composite(parent, SWT.NULL);
		GridLayout layout = new GridLayout();
		layout.numColumns = 3;
		layout.marginWidth = layout.marginHeight = 0;
		client.setLayout(layout);
		client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		Composite leftPanel = new Composite(client, SWT.NULL);
		GridLayout leftLayout = new GridLayout();
		leftLayout.numColumns = 1;
		leftLayout.marginWidth = leftLayout.marginHeight = 0;
		leftPanel.setLayout(leftLayout);
		leftPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
		Label label = new Label(leftPanel, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.jobsLabel"));
		createJobViewer(leftPanel);
		Composite centerPanel = new Composite(client, SWT.NULL);
		GridLayout centerLayout = new GridLayout();
		centerLayout.numColumns = 1;
		centerLayout.marginWidth = centerLayout.marginHeight = 0;
		centerPanel.setLayout(centerLayout);
		centerPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
		label = new Label(centerPanel, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.siteLabel"));
		createSiteViewer(centerPanel);
		Composite rightPanel = new Composite(client, SWT.NULL);
		GridLayout rightLayout = new GridLayout();
		rightLayout.numColumns = 1;
		rightLayout.marginWidth = rightLayout.marginHeight = 0;
		rightPanel.setLayout(rightLayout);
		rightPanel.setLayoutData(new GridData(GridData.FILL_VERTICAL));
		new Label(rightPanel, SWT.NULL);
		Composite buttonContainer = new Composite(rightPanel, SWT.NULL);
		GridLayout blayout = new GridLayout();
		blayout.marginWidth = blayout.marginHeight = 0;
		buttonContainer.setLayout(blayout);
		buttonContainer.setLayoutData(new GridData(GridData.FILL_VERTICAL));
		addButton = new Button(buttonContainer, SWT.PUSH);
		addButton.setText(UpdateUI.getString("InstallWizard.TargetPage.new"));
		addButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				addTargetLocation();
			}
		});
		addButton.setEnabled(false);
		addButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
		SWTUtil.setButtonDimensionHint(addButton);
		deleteButton = new Button(buttonContainer, SWT.PUSH);
		deleteButton.setText(UpdateUI.getString("InstallWizard.TargetPage.delete"));
		deleteButton.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				try {
					removeSelection();
				}
				catch (CoreException ex) {
					UpdateUI.logException(ex);
				}
			}
		});
		deleteButton.setEnabled(false);
		deleteButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
		SWTUtil.setButtonDimensionHint(deleteButton);
		Composite status = new Composite(client, SWT.NULL);
		GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
		gd.horizontalSpan = 3;
		status.setLayoutData(gd);
		layout = new GridLayout();
		layout.numColumns = 2;
		status.setLayout(layout);
		label = new Label(status, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.requiredSpace"));
		requiredSpaceLabel = new Label(status, SWT.NULL);
		requiredSpaceLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		label = new Label(status, SWT.NULL);
		label.setText(UpdateUI.getString("InstallWizard.TargetPage.availableSpace"));
		availableSpaceLabel = new Label(status, SWT.NULL);
		availableSpaceLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		WorkbenchHelp.setHelp(client, "org.eclipse.update.ui.MultiTargetPage2");
		Dialog.applyDialogFont(parent);
		return client;
	}


Input:
	public Object handleData(JsonElement jsonReq) {
		Gson gson = new Gson();
		JsonReqSendMessageParams jsonReqParams;
		try {
			jsonReqParams = gson.fromJson(jsonReq, JsonReqSendMessageParams.class);
		} catch (Exception e) {
			return new SendMessageResponse(RES_BAD_REQUEST);
		}
		if (jsonReqParams.message == null || jsonReqParams.userID == null) {
			return new SendMessageResponse(RES_BAD_REQUEST +
					": must specify both user ID and message body.");
		}
		Profile profile;
		try {
			UserID uid = userIDFactory.getFromBase64(jsonReqParams.userID);
			profile = socialFS.findProfile(uid);
		} catch (ProfileNotFoundException e) {
			e.printStackTrace();
			return new SendMessageResponse(RES_NOT_FOUND);
		}
		ContentMessage msg = smail.createContentMessage().setMessage(jsonReqParams.message);
		smail.send(msg, profile);
		return new SendMessageResponse();
	}

Output:
	public Object handleData(JsonElement jsonReq) {
		Gson gson = new Gson();
		JsonReqSendMessageParams jsonReqParams;
		try {
			jsonReqParams = gson.fromJson(jsonReq, JsonReqSendMessageParams.class);
		} catch (Exception e) {
			return new SendMessageResponse(RES_BAD_REQUEST);
		}
		if (jsonReqParams.message == null || jsonReqParams.userID == null) {
			return new SendMessageResponse(RES_BAD_REQUEST +
					": must specify both user ID and message body.");
		}
		Profile profile;
		try {
			UserID uid = userIDFactory.getFromBase64(jsonReqParams.userID);
			profile = socialFS.findProfile(uid);
		} catch (ProfileNotFoundException e) {
			e.printStackTrace();
			return new SendMessageResponse(RES_NOT_FOUND);
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
			return new SendMessageResponse(RES_BAD_REQUEST + ": illegal user ID.");
		}
		ContentMessage msg = smail.createContentMessage().setMessage(jsonReqParams.message);
		smail.send(msg, profile);
		return new SendMessageResponse();
	}


Input:
protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        HttpSession session = request.getSession();
        if (session == null) {
        }
        Connection connection;
        try {
			connection = DbAdaptor.connect();
		}
        catch (Exception e1){
        	out.println("db connection failed");
			e1.printStackTrace();
			return;
		}
		List<FileItem> items = null;
    	FileItem files = null;
    	String taskDir = "";
    	int taskID = -1;
		try {
			items = (List<FileItem>) new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
		} catch (FileUploadException e) {
			e.printStackTrace();
			return;
		}
    	for( FileItem item : items ) {
        	if(item.isFormField()) {
        		String field = item.getFieldName();
        		if (field.equals("task")) {
            		String task = item.getString();
        			if (task == null) {
        			} else {
            			taskDir = TASKS_DIRECTORY + task + "/";
        			}
        		}
        		if( field.equals("taskID") ) {
        			taskID = Integer.parseInt(item.getString());
        		}
        	}
        	else {
        		files = item;
        	}
    	}
    	PreparedStatement checkTask;
		try {
			checkTask = connection.prepareStatement("SELECT id FROM tasks WHERE id = ? AND submitter = ?");
			checkTask.setInt(1, taskID);
			int accountID = 1;
			checkTask.setInt(2, accountID);
	    	if (!checkTask.execute()) {
	    		out.println("invalid Task");
	    		response.sendRedirect("/upload.html");
	    	}
		} catch (SQLException e) {
			out.println("SQL problem slecting task from id");
			e.printStackTrace();
			return;
		}
		List<String> filenames = new LinkedList<String>();
		if (files.getName().substring(files.getName().length()-4).toLowerCase().equals(".zip")) {
			ZipInputStream zipIn = new ZipInputStream(files.getInputStream());
			ZipEntry entry = zipIn.getNextEntry();
			while( entry != null ) {
				String filename = entry.getName();
				OutputStream fileOut = new FileOutputStream(taskDir + filename);
				IOUtils.copy(zipIn, fileOut);
				zipIn.closeEntry();
				fileOut.close();
				filenames.add(filename);
				entry = zipIn.getNextEntry();
			}
			zipIn.close();
		} else {
			String filename = files.getName();
			filenames.add(filename);
	        InputStream fileIn = files.getInputStream();
	        OutputStream fileOut = new FileOutputStream(taskDir + filename);
	        IOUtils.copy(fileIn, fileOut);
	        fileIn.close();
	        fileOut.close();
		}
    	for (int i = 0 ; i < filenames.size() ; i++) {
	        String insertQuery = "INSERT INTO subtasks VALUES ?,?,?";
	        String filename = filenames.get(i);
	        PreparedStatement stmt;
	        try {
				stmt = connection.prepareStatement(insertQuery);
				stmt.setInt(1, taskID);
		        stmt.setString(2, filename);
		        stmt.setBoolean(3,  true);
		        stmt.execute();
	        } catch (SQLException e1) {
				System.err.println("some error with task fields: taskID not valid?");
				System.err.println("taskID: " + taskID + ", filename: " + filename);
				return;
			}
    	}
        out.println("");
        out.println("");
        out.println("uploaded to task " + taskDir + "
");
        out.println("click here to return to the homepage");
        out.println("");
        out.println("");
    }
}

Output:
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
		response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        HttpSession session = request.getSession();
        if (session == null) {
        }
        Connection connection;
        try {
			connection = DbAdaptor.connect();
		}
        catch (Exception e1){
        	out.println("db connection failed");
			e1.printStackTrace();
			return;
		}
		List<FileItem> items = null;
    	FileItem files = null;
    	String taskDir = "";
    	int taskID = -1;
		try {
			items = (List<FileItem>) new ServletFileUpload(new DiskFileItemFactory()).parseRequest(request);
		} catch (FileUploadException e) {
			e.printStackTrace();
			return;
		}
    	for( FileItem item : items ) {
        	if(item.isFormField()) {
        		String field = item.getFieldName();
        		if (field.equals("task")) {
            		String task = item.getString();
        			if (task == null) {
        			} else {
            			taskDir = TASKS_DIRECTORY + task + "/";
        			}
        		}
        		if( field.equals("taskID") ) {
        			taskID = Integer.parseInt(item.getString());
        		}
        	}
        	else {
        		files = item;
        	}
    	}
    	PreparedStatement checkTask;
		try {
			checkTask = connection.prepareStatement("SELECT id FROM tasks WHERE id = ? AND submitter = ?");
			checkTask.setInt(1, taskID);
			int accountID = 1;
			checkTask.setInt(2, accountID);
	    	if (!checkTask.execute()) {
	    		out.println("invalid Task");
	    		response.sendRedirect("/upload.html");
	    	}
		} catch (SQLException e) {
			out.println("SQL problem slecting task from id");
			e.printStackTrace();
			return;
		}
		List<String> filenames = new LinkedList<String>();
		if (files.getName().substring(files.getName().length()-4).toLowerCase().equals(".zip")) {
			ZipInputStream zipIn = new ZipInputStream(files.getInputStream());
			ZipEntry entry = zipIn.getNextEntry();
			while( entry != null ) {
				String filename = entry.getName();
				OutputStream fileOut = new FileOutputStream(taskDir + filename);
				IOUtils.copy(zipIn, fileOut);
				zipIn.closeEntry();
				fileOut.close();
				filenames.add(filename);
				entry = zipIn.getNextEntry();
			}
			zipIn.close();
		} else {
			String filename = files.getName();
			filenames.add(filename);
	        InputStream fileIn = files.getInputStream();
	        OutputStream fileOut = new FileOutputStream(taskDir + filename);
	        IOUtils.copy(fileIn, fileOut);
	        fileIn.close();
	        fileOut.close();
		}
    	for (int i = 0 ; i < filenames.size() ; i++) {
	        String insertQuery = "INSERT INTO subtasks VALUES (DEFAULT,?,?,?)";
	        String filename = filenames.get(i);
	        PreparedStatement stmt;
	        try {
				stmt = connection.prepareStatement(insertQuery);
				stmt.setInt(1, taskID);
		        stmt.setString(2, filename);
		        stmt.setBoolean(3,  true);
		        stmt.execute();
	        } catch (SQLException e1) {
				System.err.println("some error with task fields: taskID not valid?");
				System.err.println("taskID: " + taskID + ", filename: " + filename);
				return;
			}
    	}
        out.println("<html>");
        out.println("<body>");
        out.println("uploaded to task " + taskDir + "<br>");
        out.println("click <a href=../index.jsp>here</a> to return to the homepage");
        out.println("</body>");
        out.println("</html>");
    }
}


Input:
  public void testSimpleManifest() throws CompilationException {
    File closureLibraryDirectory = new File("../closure-library/closure/goog/");
    final List<File> dependencies = ImmutableList.of();
    String path = "test/org/plovr/example.js";
    File testFile = new File(path);
    JsSourceFile requiredInput = new JsSourceFile(path, testFile);
    final List<File> externs = ImmutableList.of();
    final boolean customExternsOnly = false;
    Manifest manifest = new Manifest(
        closureLibraryDirectory,
        dependencies,
        ImmutableList.<JsInput>of(requiredInput),
        externs,
        customExternsOnly);
    final ModuleConfig moduleConfig = null;
    Compilation compilerArguments = manifest.getCompilerArguments(moduleConfig);
    List<JSSourceFile> inputs = compilerArguments.getInputs();
    List<String> expectedNames = ImmutableList.copyOf(
        new String[] {
            "base.js",
            "/goog/debug/error.js",
            "/goog/string/string.js",
            "/goog/asserts/asserts.js",
            "/goog/array/array.js",
            "/goog/debug/entrypointregistry.js",
            "/goog/debug/errorhandlerweakdep.js",
            "/goog/useragent/useragent.js",
            "/goog/events/browserfeature.js",
            "/goog/disposable/disposable.js",
            "/goog/events/event.js",
            "/goog/events/eventtype.js",
            "/goog/events/browserevent.js",
            "/goog/events/eventwrapper.js",
            "/goog/events/listener.js",
            "/goog/structs/simplepool.js",
            "/goog/useragent/jscript.js",
            "/goog/events/pools.js",
            "/goog/object/object.js",
            "/goog/events/events.js",
            "test/org/plovr/example.js"
        }
        );
    assertEquals(expectedNames, Lists.transform(inputs, JS_SOURCE_FILE_TO_NAME));
  }

Output:
  public void testSimpleManifest() throws CompilationException {
    File closureLibraryDirectory = new File("../closure-library/closure/goog/");
    final List<File> dependencies = ImmutableList.of();
    String path = "test/org/plovr/example.js";
    File testFile = new File(path);
    JsSourceFile requiredInput = new JsSourceFile(path, testFile);
    final List<File> externs = ImmutableList.of();
    final boolean customExternsOnly = false;
    Manifest manifest = new Manifest(
        closureLibraryDirectory,
        dependencies,
        ImmutableList.<JsInput>of(requiredInput),
        externs,
        customExternsOnly);
    final ModuleConfig moduleConfig = null;
    Compilation compilerArguments = manifest.getCompilerArguments(moduleConfig);
    List<JSSourceFile> inputs = compilerArguments.getInputs();
    List<String> expectedNames = ImmutableList.copyOf(
        new String[] {
            "base.js",
            "/goog/debug/error.js",
            "/goog/string/string.js",
            "/goog/asserts/asserts.js",
            "/goog/array/array.js",
            "/goog/debug/entrypointregistry.js",
            "/goog/debug/errorhandlerweakdep.js",
            "/goog/useragent/useragent.js",
            "/goog/events/browserfeature.js",
            "/goog/disposable/disposable.js",
            "/goog/events/event.js",
            "/goog/events/eventtype.js",
            "/goog/reflect/reflect.js",
            "/goog/events/browserevent.js",
            "/goog/events/eventwrapper.js",
            "/goog/events/listener.js",
            "/goog/structs/simplepool.js",
            "/goog/useragent/jscript.js",
            "/goog/events/pools.js",
            "/goog/object/object.js",
            "/goog/events/events.js",
            "test/org/plovr/example.js"
        }
        );
    assertEquals(expectedNames, Lists.transform(inputs, JS_SOURCE_FILE_TO_NAME));
  }


Input:
    protected void addBeanProps(DeserializationContext ctxt,
            BeanDescription beanDesc, BeanDeserializerBuilder builder)
        throws JsonMappingException
    {
        final SettableBeanProperty[] creatorProps =
                builder.getValueInstantiator().getFromObjectArguments(ctxt.getConfig());
        AnnotationIntrospector intr = ctxt.getAnnotationIntrospector();
        boolean ignoreAny = false;
        {
            Boolean B = intr.findIgnoreUnknownProperties(beanDesc.getClassInfo());
            if (B != null) {
                ignoreAny = B.booleanValue();
                builder.setIgnoreUnknownProperties(ignoreAny);
            }
        }
        Set<String> ignored = ArrayBuilders.arrayToSet(intr.findPropertiesToIgnore(beanDesc.getClassInfo()));
        for (String propName : ignored) {
            builder.addIgnorable(propName);
        }
        AnnotatedMethod anySetter = beanDesc.findAnySetter();
        if (anySetter != null) {
            builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetter));
        }
        if (anySetter == null) {
            Collection<String> ignored2 = beanDesc.getIgnoredPropertyNames();
            if (ignored2 != null) {
                for (String propName : ignored2) {
                    builder.addIgnorable(propName);
                }
            }
        }
        final boolean useGettersAsSetters = (ctxt.isEnabled(MapperFeature.USE_GETTERS_AS_SETTERS)
                && ctxt.isEnabled(MapperFeature.AUTO_DETECT_GETTERS));
        List<BeanPropertyDefinition> propDefs = filterBeanProps(ctxt,
                beanDesc, builder, beanDesc.findProperties(), ignored);
        if (_factoryConfig.hasDeserializerModifiers()) {
            for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
                propDefs = mod.updateProperties(ctxt.getConfig(), beanDesc, propDefs);
            }
        }
        for (BeanPropertyDefinition propDef : propDefs) {
            SettableBeanProperty prop = null;
            if (propDef.hasConstructorParameter()) {
                final String name = propDef.getName();
                for (SettableBeanProperty cp : creatorProps) {
                    if (name.equals(cp.getName())) {
                        prop = cp;
                        break;
                    }
                }
                if (prop == null) {
                    throw ctxt.mappingException("Could not find creator property with name '"+name+"'");
                }
                builder.addCreatorProperty(prop);
                continue;
            }
            if (propDef.hasSetter()) {
                Type propertyType = propDef.getSetter().getGenericParameterType(0);
                prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
            } else if (propDef.hasField()) {
                Type propertyType = propDef.getField().getGenericType();
                prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
            } else if (useGettersAsSetters && propDef.hasGetter()) {
                AnnotatedMethod getter = propDef.getGetter();
                Class<?> rawPropertyType = getter.getRawType();
                if (Collection.class.isAssignableFrom(rawPropertyType)
                        || Map.class.isAssignableFrom(rawPropertyType)) {
                    prop = constructSetterlessProperty(ctxt, beanDesc, propDef);
                }
            }
            if (prop != null) {
                Class<?>[] views = propDef.findViews();
                if (views == null) {
                    if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) {
                        views = NO_VIEWS;
                    }
                }
                prop.setViews(views);
                builder.addProperty(prop);
            }
        }
    }

Output:
    protected void addBeanProps(DeserializationContext ctxt,
            BeanDescription beanDesc, BeanDeserializerBuilder builder)
        throws JsonMappingException
    {
        final SettableBeanProperty[] creatorProps =
                builder.getValueInstantiator().getFromObjectArguments(ctxt.getConfig());
        AnnotationIntrospector intr = ctxt.getAnnotationIntrospector();
        boolean ignoreAny = false;
        {
            Boolean B = intr.findIgnoreUnknownProperties(beanDesc.getClassInfo());
            if (B != null) {
                ignoreAny = B.booleanValue();
                builder.setIgnoreUnknownProperties(ignoreAny);
            }
        }
        Set<String> ignored = ArrayBuilders.arrayToSet(intr.findPropertiesToIgnore(beanDesc.getClassInfo()));
        for (String propName : ignored) {
            builder.addIgnorable(propName);
        }
        AnnotatedMethod anySetter = beanDesc.findAnySetter();
        if (anySetter != null) {
            builder.setAnySetter(constructAnySetter(ctxt, beanDesc, anySetter));
        }
        if (anySetter == null) {
            Collection<String> ignored2 = beanDesc.getIgnoredPropertyNames();
            if (ignored2 != null) {
                for (String propName : ignored2) {
                    builder.addIgnorable(propName);
                }
            }
        }
        final boolean useGettersAsSetters = (ctxt.isEnabled(MapperFeature.USE_GETTERS_AS_SETTERS)
                && ctxt.isEnabled(MapperFeature.AUTO_DETECT_GETTERS));
        List<BeanPropertyDefinition> propDefs = filterBeanProps(ctxt,
                beanDesc, builder, beanDesc.findProperties(), ignored);
        if (_factoryConfig.hasDeserializerModifiers()) {
            for (BeanDeserializerModifier mod : _factoryConfig.deserializerModifiers()) {
                propDefs = mod.updateProperties(ctxt.getConfig(), beanDesc, propDefs);
            }
        }
        for (BeanPropertyDefinition propDef : propDefs) {
            SettableBeanProperty prop = null;
            if (propDef.hasConstructorParameter()) {
                final String name = propDef.getName();
                if (creatorProps != null) {
                    for (SettableBeanProperty cp : creatorProps) {
                        if (name.equals(cp.getName())) {
                            prop = cp;
                            break;
                        }
                    }
                }
                if (prop == null) {
                    throw ctxt.mappingException("Could not find creator property with name '"+name+"'");
                }
                builder.addCreatorProperty(prop);
                continue;
            }
            if (propDef.hasSetter()) {
                Type propertyType = propDef.getSetter().getGenericParameterType(0);
                prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
            } else if (propDef.hasField()) {
                Type propertyType = propDef.getField().getGenericType();
                prop = constructSettableProperty(ctxt, beanDesc, propDef, propertyType);
            } else if (useGettersAsSetters && propDef.hasGetter()) {
                AnnotatedMethod getter = propDef.getGetter();
                Class<?> rawPropertyType = getter.getRawType();
                if (Collection.class.isAssignableFrom(rawPropertyType)
                        || Map.class.isAssignableFrom(rawPropertyType)) {
                    prop = constructSetterlessProperty(ctxt, beanDesc, propDef);
                }
            }
            if (prop != null) {
                Class<?>[] views = propDef.findViews();
                if (views == null) {
                    if (!ctxt.isEnabled(MapperFeature.DEFAULT_VIEW_INCLUSION)) {
                        views = NO_VIEWS;
                    }
                }
                prop.setViews(views);
                builder.addProperty(prop);
            }
        }
    }