Input:
	private void ingestSurveyInstance(SurveyInstance instance) {
		SurveyedLocale locale = null;
		if (instance != null) {
			List<QuestionAnswerStore> answers = surveyInstanceDao
					.listQuestionAnswerStore(instance.getKey().getId(), null);
			QuestionAnswerStore geoQ = null;
			SurveyDAO surveyDao = new SurveyDAO();
			Survey survey = surveyDao.getByKey(instance.getSurveyId());
			String pointType = null;
			if (survey != null) {
				pointType = survey.getPointType();
			}
			if (answers != null) {
				for (QuestionAnswerStore q : answers) {
					if (QuestionType.GEO.toString().equals(q.getType())) {
						geoQ = q;
						break;
					}
				}
			}
			if (instance.getSurveyedLocaleId() != null) {
				locale = surveyedLocaleDao.getByKey(instance
						.getSurveyedLocaleId());
			}
			GeoPlace geoPlace = null;
			if (geoQ != null && geoQ.getValue() != null) {
				double lat = UNSET_VAL;
				double lon = UNSET_VAL;
				boolean ambiguousFlag = false;
				String code = null;
				String[] tokens = geoQ.getValue().split("\\|");
				if (tokens.length >= 2) {
					lat = Double.parseDouble(tokens[0]);
					lon = Double.parseDouble(tokens[1]);
					if (tokens.length >= 4) {
						code = tokens[tokens.length - 1];
					}
				}
				if (code == null) {
					Long codeNum = Long
							.parseLong((int) ((Math.abs(lat) * 10000d)) + ""
									+ (int) ((Math.abs(lon) * 10000d)));
					code = Long.toString(codeNum, 36);
				}
				if (lat == UNSET_VAL || lon == UNSET_VAL) {
					throw new RuntimeException(
							"Could not parse lat/lon from Geo Question "
									+ geoQ.getQuestionID());
				} else if (mergeNearby && locale == null) {
					List<SurveyedLocale> candidates = surveyedLocaleDao
							.listLocalesByCoordinates(pointType, lat, lon,
									TOLERANCE);
					if (candidates != null && candidates.size() == 1) {
						locale = candidates.get(0);
					} else if (candidates != null && candidates.size() > 1) {
						log.log(Level.WARNING,
								"Geo based lookup of surveyed locale returned more than one candidate so we are creating a new one");
						ambiguousFlag = true;
					}
				}
				geoPlace = getGeoPlace(lat, lon);
				if (locale == null) {
					locale = new SurveyedLocale();
					locale.setAmbiguous(ambiguousFlag);
					locale.setLatitude(lat);
					locale.setLongitude(lon);
					setGeoData(geoPlace, locale);
					if (survey != null) {
						locale.setLocaleType(survey.getPointType());
					}
					locale.setIdentifier(code);
					if (locale.getOrganization() == null) {
						locale.setOrganization(PropertyUtil
								.getProperty(DEFAULT_ORG_PROP));
					}
					locale = surveyedLocaleDao.save(locale);
				} else {
					if (survey.getPointType() != null
							&& !survey.getPointType().equals(
									locale.getLocaleType())) {
						locale.setLocaleType(survey.getPointType());
					}
				}
			}
			if (instance != null && geoPlace != null) {
				instance.setCountryCode(geoPlace.getCountryCode());
				instance.setSublevel1(geoPlace.getSub1());
				instance.setSublevel2(geoPlace.getSub2());
				instance.setSublevel3(geoPlace.getSub3());
				instance.setSublevel4(geoPlace.getSub4());
				instance.setSublevel5(geoPlace.getSub5());
				instance.setSublevel6(geoPlace.getSub6());
				if (answers != null) {
					List<Metric> metrics = metricDao.listMetrics(
							COMMUNITY_METRIC_NAME, null, null, null, null);
					if (metrics != null) {
						List<SurveyMetricMapping> mappings = new ArrayList<SurveyMetricMapping>();
						for (Metric m : metrics) {
							List<SurveyMetricMapping> temp = metricMappingDao
									.listMetricsBySurveyAndMetric(m.getKey()
											.getId(), instance.getSurveyId());
							if (temp != null) {
								mappings.addAll(temp);
							}
						}
						for (SurveyMetricMapping mapping : mappings) {
							for (QuestionAnswerStore ans : answers) {
								if (ans.getQuestionID().equals(
										mapping.getSurveyQuestionId().toString())) {
									instance.setCommunity(ans.getValue());
									break;
								}
							}
						}
					}
				}
			}
			if (locale != null && locale.getKey() != null && answers != null) {
				locale.setLastSurveyedDate(instance.getCollectionDate());
				locale.setLastSurveyalInstanceId(instance.getKey().getId());
				instance.setSurveyedLocaleId(locale.getKey().getId());
				List<SurveyalValue> values = constructValues(locale, answers);
				if (values != null) {
					surveyedLocaleDao.save(values);
					if (!useConfigStatusScore) {
						boolean found = false;
						for (SurveyalValue val : values) {
							if (isStatus(val.getMetricName())
									&& val.getStringValue() != null) {
								found = true;
								locale.setCurrentStatus(val.getStringValue());
								break;
							}
						}
						if (!found) {
							for (SurveyalValue val : values) {
								if (isStatus(val.getQuestionText())
										&& val.getStringValue() != null) {
									found = true;
									locale.setCurrentStatus(val
											.getStringValue());
									break;
								}
							}
						}
					} else if (useDynamicScoring) {
					} else {
						for (SurveyalValue val : values) {
							if (val.getQuestionText() != null
									&& val.getQuestionText().toLowerCase()
											.contains(statusFragment)) {
								String scoredField = scoredVals.get(val
										.getStringValue());
								if (scoredField == null) {
									scoredField = scoredVals.get(DEFAULT);
								}
								locale.setCurrentStatus(scoredField);
							}
						}
					}
				}
			}
		}
	}

Output:
	private void ingestSurveyInstance(SurveyInstance instance) {
		SurveyedLocale locale = null;
		if (instance != null) {
			List<QuestionAnswerStore> answers = surveyInstanceDao
					.listQuestionAnswerStore(instance.getKey().getId(), null);
			QuestionAnswerStore geoQ = null;
			SurveyDAO surveyDao = new SurveyDAO();
			Survey survey = surveyDao.getByKey(instance.getSurveyId());
			String pointType = null;
			if (survey != null) {
				pointType = survey.getPointType();
			}
			if (answers != null) {
				for (QuestionAnswerStore q : answers) {
					if (QuestionType.GEO.toString().equals(q.getType())) {
						geoQ = q;
						break;
					}
				}
			}
			if (instance.getSurveyedLocaleId() != null) {
				locale = surveyedLocaleDao.getByKey(instance
						.getSurveyedLocaleId());
			}
			GeoPlace geoPlace = null;
			if (geoQ != null && geoQ.getValue() != null && geoQ.getValue().length() > 0) {
				double lat = UNSET_VAL;
				double lon = UNSET_VAL;
				boolean ambiguousFlag = false;
				String code = null;
				String[] tokens = geoQ.getValue().split("\\|");
				if (tokens.length >= 2) {
					lat = Double.parseDouble(tokens[0]);
					lon = Double.parseDouble(tokens[1]);
					if (tokens.length >= 4) {
						code = tokens[tokens.length - 1];
					}
				}
				if (code == null) {
					Long codeNum = Long
							.parseLong((int) ((Math.abs(lat) * 10000d)) + ""
									+ (int) ((Math.abs(lon) * 10000d)));
					code = Long.toString(codeNum, 36);
				}
				if (lat == UNSET_VAL || lon == UNSET_VAL) {
					throw new RuntimeException(
							"Could not parse lat/lon from Geo Question "
									+ geoQ.getQuestionID());
				} else if (mergeNearby && locale == null) {
					List<SurveyedLocale> candidates = surveyedLocaleDao
							.listLocalesByCoordinates(pointType, lat, lon,
									TOLERANCE);
					if (candidates != null && candidates.size() == 1) {
						locale = candidates.get(0);
					} else if (candidates != null && candidates.size() > 1) {
						log.log(Level.WARNING,
								"Geo based lookup of surveyed locale returned more than one candidate so we are creating a new one");
						ambiguousFlag = true;
					}
				}
				geoPlace = getGeoPlace(lat, lon);
				if (locale == null) {
					locale = new SurveyedLocale();
					locale.setAmbiguous(ambiguousFlag);
					locale.setLatitude(lat);
					locale.setLongitude(lon);
					setGeoData(geoPlace, locale);
					if (survey != null) {
						locale.setLocaleType(survey.getPointType());
					}
					locale.setIdentifier(code);
					if (locale.getOrganization() == null) {
						locale.setOrganization(PropertyUtil
								.getProperty(DEFAULT_ORG_PROP));
					}
					locale = surveyedLocaleDao.save(locale);
				} else {
					if (survey.getPointType() != null
							&& !survey.getPointType().equals(
									locale.getLocaleType())) {
						locale.setLocaleType(survey.getPointType());
					}
				}
			}
			if (instance != null && geoPlace != null) {
				instance.setCountryCode(geoPlace.getCountryCode());
				instance.setSublevel1(geoPlace.getSub1());
				instance.setSublevel2(geoPlace.getSub2());
				instance.setSublevel3(geoPlace.getSub3());
				instance.setSublevel4(geoPlace.getSub4());
				instance.setSublevel5(geoPlace.getSub5());
				instance.setSublevel6(geoPlace.getSub6());
				if (answers != null) {
					List<Metric> metrics = metricDao.listMetrics(
							COMMUNITY_METRIC_NAME, null, null, null, null);
					if (metrics != null) {
						List<SurveyMetricMapping> mappings = new ArrayList<SurveyMetricMapping>();
						for (Metric m : metrics) {
							List<SurveyMetricMapping> temp = metricMappingDao
									.listMetricsBySurveyAndMetric(m.getKey()
											.getId(), instance.getSurveyId());
							if (temp != null) {
								mappings.addAll(temp);
							}
						}
						for (SurveyMetricMapping mapping : mappings) {
							for (QuestionAnswerStore ans : answers) {
								if (ans.getQuestionID().equals(
										mapping.getSurveyQuestionId().toString())) {
									instance.setCommunity(ans.getValue());
									break;
								}
							}
						}
					}
				}
			}
			if (locale != null && locale.getKey() != null && answers != null) {
				locale.setLastSurveyedDate(instance.getCollectionDate());
				locale.setLastSurveyalInstanceId(instance.getKey().getId());
				instance.setSurveyedLocaleId(locale.getKey().getId());
				List<SurveyalValue> values = constructValues(locale, answers);
				if (values != null) {
					surveyedLocaleDao.save(values);
					if (!useConfigStatusScore) {
						boolean found = false;
						for (SurveyalValue val : values) {
							if (isStatus(val.getMetricName())
									&& val.getStringValue() != null) {
								found = true;
								locale.setCurrentStatus(val.getStringValue());
								break;
							}
						}
						if (!found) {
							for (SurveyalValue val : values) {
								if (isStatus(val.getQuestionText())
										&& val.getStringValue() != null) {
									found = true;
									locale.setCurrentStatus(val
											.getStringValue());
									break;
								}
							}
						}
					} else if (useDynamicScoring) {
					} else {
						for (SurveyalValue val : values) {
							if (val.getQuestionText() != null
									&& val.getQuestionText().toLowerCase()
											.contains(statusFragment)) {
								String scoredField = scoredVals.get(val
										.getStringValue());
								if (scoredField == null) {
									scoredField = scoredVals.get(DEFAULT);
								}
								locale.setCurrentStatus(scoredField);
							}
						}
					}
				}
			}
		}
	}


Input:
	private static boolean test2(CommandSender sender, final String[] args)
	{
		Player player = (Player) sender;
		try
		{
			player.sendMessage("  ");
			URL doge = new URL(args[0]);
			BufferedImage veryImage = ImageIO.read(doge);
			veryImage = Images.getScaledImage(veryImage, 128, 128);
			if(player.isOp()) Images.convertImageToSchematic(veryImage).generate(player.getLocation());
			player.sendMessage("  ");
		}
		catch(Throwable suchError)
		{
			player.sendMessage(ChatColor.RED + "many problems. " + suchError.getMessage());
		}
		return true;
	}

Output:
	private static boolean test2(CommandSender sender, final String[] args)
	{
		Player player = (Player) sender;
		try
		{
			player.sendMessage("  ");
			URL doge = new URL(args[0]);
			BufferedImage veryImage = ImageIO.read(doge);
			veryImage = Images.getScaledImage(veryImage, 128, 128);
			if(player.isOp()) Images.convertImageToSchematic(veryImage).generate(player.getLocation());
			player.sendMessage("  ");
		}
		catch(Throwable suchError)
		{
			player.sendMessage(ChatColor.RED + "many problems. " + suchError.getMessage());
			suchError.printStackTrace();
		}
		return true;
	}


Input:
	public static DisplayMode setDisplayMode(DisplayMode[] dm, final String[] param) throws Exception {
		class Sorter implements Comparator {
			final Field[] field;
			final int[] order;
			final boolean[] usePreferred;
			final int[] preferred;
			Sorter() throws NoSuchFieldException {
				field = new Field[param.length];
				order = new int[param.length];
				preferred = new int[param.length];
				usePreferred = new boolean[param.length];
				for (int i = 0; i < field.length; i ++) {
					int idx = param[i].indexOf('=');
					if (idx > 0) {
						preferred[i] = Integer.parseInt(param[i].substring(idx + 1, param[i].length()));
						usePreferred[i] = true;
						param[i] = param[i].substring(0, idx);
						field[i] = DisplayMode.class.getDeclaredField(param[i]);
					} else if (param[i].charAt(0) == '-') {
						field[i] = DisplayMode.class.getDeclaredField(param[i].substring(1));
						order[i] = -1;
					} else {
						field[i] = DisplayMode.class.getDeclaredField(param[i]);
						order[i] = 1;
					}
				}
			}
			public int compare(Object o1, Object o2) {
				DisplayMode dm1 = (DisplayMode) o1;
				DisplayMode dm2 = (DisplayMode) o2;
				for (int i = 0; i < field.length; i ++) {
					try {
						int f1 = field[i].getInt(dm1);
						int f2 = field[i].getInt(dm2);
						if (usePreferred[i] && f1 != f2) {
							if (f1 == preferred[i])
								return -1;
							else if (f2 == preferred[i])
								return 1;
							else {
								int absf1 = Math.abs(f1 - preferred[i]);
								int absf2 = Math.abs(f2 - preferred[i]);
								if (absf1 < absf2)
									return -1;
								else if (absf1 > absf2)
									return 1;
								else
									continue;
							}
						} else if (f1 < f2)
							return order[i];
						else if (f1 == f2)
							continue;
						else
							return -order[i];
					} catch (Exception e) {
						assert false : e.getMessage();
					}
				}
				return 0;
			}
		}
		Arrays.sort(dm, new Sorter());
		if (Sys.DEBUG || DEBUG) {
			System.out.println("Sorted display modes:");
			for (int i = 0; i < dm.length; i ++) {
				System.out.println(dm[i]);
			}
		}
		for (int i = 0; i < dm.length; i ++) {
			try {
				if (Sys.DEBUG || DEBUG)
					System.out.println("Attempting to set displaymode: "+dm[i]);
				org.lwjgl.opengl.Display.setDisplayMode(dm[i]);
				return dm[i];
			} catch (Exception e) {
				if (Sys.DEBUG || DEBUG) {
					System.out.println("Failed to set display mode to "+dm[i]);
					e.printStackTrace();
				}
			}
		}
		throw new Exception("Failed to set display mode.");
	}

Output:
	public static DisplayMode setDisplayMode(DisplayMode[] dm, final String[] param) throws Exception {
		class Sorter implements Comparator {
			final Field[] field;
			final int[] order;
			final boolean[] usePreferred;
			final int[] preferred;
			Sorter() throws NoSuchFieldException {
				field = new Field[param.length];
				order = new int[param.length];
				preferred = new int[param.length];
				usePreferred = new boolean[param.length];
				for (int i = 0; i < field.length; i ++) {
					int idx = param[i].indexOf('=');
					if (idx > 0) {
						preferred[i] = Integer.parseInt(param[i].substring(idx + 1, param[i].length()));
						usePreferred[i] = true;
						param[i] = param[i].substring(0, idx);
						field[i] = DisplayMode.class.getDeclaredField(param[i]);
					} else if (param[i].charAt(0) == '-') {
						field[i] = DisplayMode.class.getDeclaredField(param[i].substring(1));
						order[i] = -1;
					} else {
						field[i] = DisplayMode.class.getDeclaredField(param[i]);
						order[i] = 1;
					}
					field[i].setAccessible(true);
				}
			}
			public int compare(Object o1, Object o2) {
				DisplayMode dm1 = (DisplayMode) o1;
				DisplayMode dm2 = (DisplayMode) o2;
				for (int i = 0; i < field.length; i ++) {
					try {
						int f1 = field[i].getInt(dm1);
						int f2 = field[i].getInt(dm2);
						if (usePreferred[i] && f1 != f2) {
							if (f1 == preferred[i])
								return -1;
							else if (f2 == preferred[i])
								return 1;
							else {
								int absf1 = Math.abs(f1 - preferred[i]);
								int absf2 = Math.abs(f2 - preferred[i]);
								if (absf1 < absf2)
									return -1;
								else if (absf1 > absf2)
									return 1;
								else
									continue;
							}
						} else if (f1 < f2)
							return order[i];
						else if (f1 == f2)
							continue;
						else
							return -order[i];
					} catch (Exception e) {
						assert false : e.getMessage();
					}
				}
				return 0;
			}
		}
		Arrays.sort(dm, new Sorter());
		if (Sys.DEBUG || DEBUG) {
			System.out.println("Sorted display modes:");
			for (int i = 0; i < dm.length; i ++) {
				System.out.println(dm[i]);
			}
		}
		for (int i = 0; i < dm.length; i ++) {
			try {
				if (Sys.DEBUG || DEBUG)
					System.out.println("Attempting to set displaymode: "+dm[i]);
				org.lwjgl.opengl.Display.setDisplayMode(dm[i]);
				return dm[i];
			} catch (Exception e) {
				if (Sys.DEBUG || DEBUG) {
					System.out.println("Failed to set display mode to "+dm[i]);
					e.printStackTrace();
				}
			}
		}
		throw new Exception("Failed to set display mode.");
	}


Input:
	public void init() {
		super.init();
		setSize(580,660);
		setLayout(new BorderLayout());
		experements.put("Baseline", "baseline 2008.xml");
		experements.put("Boom and Bust", "boom and bust 3.xml");
		experements.put("Exponential Growth", "Exponential Growth Experiment.xml");
		experements.put("Central Place", "central place 1.xml");
		experements.put("Cheaters vs Cooperators", "cheaters vs cooperators.xml");
		currentexp = "Baseline";
		controls = new JPanel();
		JLabel selectorlabel = new JLabel("Experiment:");
		controls.add(selectorlabel);
		expselector = new ExperementSelector(experements);
		controls.add(expselector);
		JButton resetbutton = new JButton("Reset");
		controls.add(resetbutton);
		resetbutton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				loadSimulation(currentexp);
			}
		});
		statsLabel = new JLabel("Statistics:");
		controls.add(statsLabel);
		JButton statsButton = new JButton("Graph");
		statsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				statsUpdater.toggleGraphVisible();
			}
		});
		controls.add(statsButton);
		add(controls, BorderLayout.NORTH);
		expselector.setVisible(true);
		expselector.addActionListener(new ExpSelectorListener());
		loadSimulation(currentexp);
	}

Output:
	public void init() {
		super.init();
		setSize(580,660);
		setLayout(new BorderLayout());
		experements.put("Baseline 2009", "baseline 2009.xml");
		experements.put("Boom and Bust", "boom and bust 2 applet.xml");
		experements.put("Exponential Growth", "Exponential Growth Experiment.xml");
		experements.put("Central Place", "central place applet.xml");
		experements.put("Cheaters vs Cooperators", "cheaters vs cooperators.xml");
		currentexp = "Baseline 2009";
		controls = new JPanel();
		JLabel selectorlabel = new JLabel("Experiment:");
		controls.add(selectorlabel);
		expselector = new ExperementSelector(experements);
		controls.add(expselector);
		JButton resetbutton = new JButton("Reset");
		controls.add(resetbutton);
		resetbutton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				loadSimulation(currentexp);
			}
		});
		statsLabel = new JLabel("Statistics:");
		controls.add(statsLabel);
		JButton statsButton = new JButton("Graph");
		statsButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				statsUpdater.toggleGraphVisible();
			}
		});
		controls.add(statsButton);
		add(controls, BorderLayout.NORTH);
		expselector.setVisible(true);
		expselector.addActionListener(new ExpSelectorListener());
		loadSimulation(currentexp);
	}


Input:
	public static void main(String[] args)
	{
		if (args.length < 4)
		{
			System.out.println("Usage: java EmployeeUpdater <EmployeeObjectName> <Forename> <HourlyRate> <HoursPerWeek>");
			return;
		}
		double hourlyRate = 0.0;
		int hoursPerWeek = 0;
		try {
			hourlyRate = Double.parseDouble(args[2]);
		} catch (NumberFormatException ex) {
			System.out.println("'" + args[2] + "' is not a valid decimal number");
			return;
		}
		try {
			hoursPerWeek = Integer.parseInt(args[3]);
		} catch (NumberFormatException ex) {
			System.out.println("'" + args[3] + "' is not a valid integer");
			return;
		}
		try {
			Registry registry = LocateRegistry.getRegistry();
			Employee employee = (Employee)registry.lookup(args[0]);
			employee.setForename(args[1]);
			employee.setHourlyRate(hourlyRate);
			employee.setNumberHours(hoursPerWeek);
		} catch (RemoteException ex) {
		} catch (NotBoundException ex) {
		}
	}

Output:
	public static void main(String[] args)
	{
		if (args.length < 4)
		{
			System.out.println("Usage: java EmployeeUpdater <EmployeeObjectName> <Forename> <HourlyRate> <HoursPerWeek>");
			return;
		}
		double hourlyRate = 0.0;
		int hoursPerWeek = 0;
		try {
			hourlyRate = Double.parseDouble(args[2]);
		} catch (NumberFormatException ex) {
			System.out.println("'" + args[2] + "' is not a valid decimal number");
			return;
		}
		try {
			hoursPerWeek = Integer.parseInt(args[3]);
		} catch (NumberFormatException ex) {
			System.out.println("'" + args[3] + "' is not a valid integer");
			return;
		}
		try {
			Registry registry = LocateRegistry.getRegistry();
			Employee employee = (Employee)registry.lookup(args[0]);
			employee.setForename(args[1]);
			employee.setHourlyRate(hourlyRate);
			employee.setNumberHours(hoursPerWeek);
		} catch (RemoteException ex) {
			System.out.println("Could not update employee with object name '" + args[0] + "'");
		} catch (NotBoundException ex) {
			System.out.println("Could not update employee with object name '" + args[0] + "'");
		}
	}


Input:
  public static void main(String[] args) throws IllegalStateException, PoolExhaustedException,
      Exception {
    CassandraClientPool pool = CassandraClientPoolFactory.INSTANCE.get();
    CassandraClient client = pool.borrowClient("tush", 9160);
    try {
      Keyspace keyspace = client.getKeyspace("Keyspace1");
      ColumnPath columnPath = new ColumnPath("Standard1");
      columnPath.setColumn(bytes("column-name"));
      keyspace.insert("key", columnPath, bytes("value"));
      Column col = keyspace.getColumn("key", columnPath);
      System.out.println("Read from cassandra: " + string(col.getValue()));
    } finally {
      pool.releaseClient(client);
    }
  }

Output:
  public static void main(String[] args) throws IllegalStateException, PoolExhaustedException,
      Exception {
    CassandraClientPool pool = CassandraClientPoolFactory.INSTANCE.get();
    CassandraClient client = pool.borrowClient("tush", 9160);
    try {
      Keyspace keyspace = client.getKeyspace("Keyspace1");
      ColumnPath columnPath = new ColumnPath("Standard1");
      columnPath.setColumn(bytes("column-name"));
      keyspace.insert("key", columnPath, bytes("value"));
      Column col = keyspace.getColumn("key", columnPath);
      System.out.println("Read from cassandra: " + string(col.getValue()));
      client = keyspace.getClient();
    } finally {
      pool.releaseClient(client);
    }
  }


Input:
        TemplateModel _getAsTemplateModel(Environment env)
                throws TemplateException
        {
            TemplateModel model = target.getAsTemplateModel(env);
            if (model instanceof TemplateDateModel) {
                Date date = EvaluationRules.getDate((TemplateDateModel) model, target, env);
                return new SimpleNumber(date.getTime());
            } else {
                Number num = EvaluationRules.getNumber(model, target, env);
                if (num instanceof Long) {
                    return model;
                }
                return new SimpleNumber(num.longValue());
            }
        }

Output:
        TemplateModel _getAsTemplateModel(Environment env)
                throws TemplateException
        {
            TemplateModel model = target.getAsTemplateModel(env);
            if (!(model instanceof TemplateNumberModel)
                    && model instanceof TemplateDateModel) {
                Date date = EvaluationRules.getDate((TemplateDateModel) model, target, env);
                return new SimpleNumber(date.getTime());
            } else {
                Number num = EvaluationRules.getNumber(model, target, env);
                if (num instanceof Long) {
                    return model;
                }
                return new SimpleNumber(num.longValue());
            }
        }


Input:
	public synchronized ArrayList<Image> getLast(int numberOfRows) {
		if(numberOfRows < 0) {
			throw new IllegalArgumentException();
		}
		ArrayList<Image> images = new ArrayList<Image>();
		try {
			PreparedStatement statement = conn.prepareStatement(
				"SELECT id, url, external_id, description, created_time "+
				"WHERE blocked='0'"+
				" FROM images ORDER BY id DESC LIMIT ?;");
			statement.setInt(1, numberOfRows);
			ResultSet result = statement.executeQuery();
			while (result.next()) {
				Image img = new Image(
						result.getString("url"),
						result.getLong("external_id"),
						result.getString("description"),
						result.getDate("created_time")
				);
				img.setInternalId(result.getInt("id"));
				images.add(img);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return images;
	}

Output:
	public synchronized ArrayList<Image> getLast(int numberOfRows) {
		if(numberOfRows < 0) {
			throw new IllegalArgumentException();
		}
		ArrayList<Image> images = new ArrayList<Image>();
		try {
			PreparedStatement statement = conn.prepareStatement(
				"SELECT id, url, external_id, description, created_time" +
				" FROM images WHERE blocked='0'"+
				" ORDER BY id DESC LIMIT ?;");
			statement.setInt(1, numberOfRows);
			ResultSet result = statement.executeQuery();
			while (result.next()) {
				Image img = new Image(
						result.getString("url"),
						result.getLong("external_id"),
						result.getString("description"),
						result.getDate("created_time")
				);
				img.setInternalId(result.getInt("id"));
				images.add(img);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return images;
	}


Input:
    private ChatColor[] setupSocketColors(FileConfiguration fc)
    {
        List<String> colorStringList = fc.getStringList("SocketItem.Colors");
        if (colorStringList == null)
            colorStringList = Arrays.asList(new String[] { "GREEN", "BLUE",
                    "RED" });
        ChatColor[] colorList = new ChatColor[colorStringList.size()];
        for (int i = 0; i < colorStringList.size(); i++)
        {
            String string = colorStringList.get(i);
            ChatColor cc = null;
            try
            {
                cc = ChatColor.valueOf(string.toUpperCase());
            }
            catch (Exception e)
            {
                continue;
            }
            if (cc != null)
                colorList[i] = cc;
        }
        System.out.println(colorList.toString());
        return colorList;
    }

Output:
    private ChatColor[] setupSocketColors(FileConfiguration fc)
    {
        List<String> colorStringList = fc.getStringList("SocketItem.Colors");
        if (colorStringList == null)
            colorStringList = Arrays.asList(new String[] { "GREEN", "BLUE",
                    "RED" });
        ChatColor[] colorList = new ChatColor[colorStringList.size()];
        for (int i = 0; i < colorStringList.size(); i++)
        {
            String string = colorStringList.get(i);
            ChatColor cc = null;
            try
            {
                cc = ChatColor.valueOf(string.toUpperCase());
            }
            catch (Exception e)
            {
                continue;
            }
            if (cc != null)
                colorList[i] = cc;
        }
        return colorList;
    }


Input:
	private void buildTypeClassMap() throws IOException{
		Reflections reflections = new Reflections("/graphs/\\w+\\.class");
		for ( Class<?> klass : Reflections.getSubClasses(Trace.class, reflections.listClasses("ditl.graphs"))){
			try {
				Field f = klass.getField("type");
				String type = (String)f.get(null);
				type_class_map.put(type, klass);
			} catch (Exception e) {
				System.err.println(klass+": "+e);
			}
		}
	}

Output:
	private void buildTypeClassMap() throws IOException{
		Reflections reflections = new Reflections("/\\w+\\.class");
		for ( Class<?> klass : Reflections.getSubClasses(Trace.class, reflections.listClasses("ditl.graphs"))){
			try {
				Field f = klass.getField("type");
				String type = (String)f.get(null);
				type_class_map.put(type, klass);
			} catch (Exception e) {
				System.err.println(klass+": "+e);
			}
		}
	}


Input:
    public StackWindow(ImagePlus imp, ImageCanvas ic) {
		super(imp, ic);
		ImageStack s = imp.getStack();
		int stackSize = s.getSize();
		nSlices = stackSize;
		hyperStack = imp.getOpenAsHyperStack();
		imp.setOpenAsHyperStack(false);
		int[] dim = imp.getDimensions();
		int nDimensions = 2+(dim[2]>1?1:0)+(dim[3]>1?1:0)+(dim[4]>1?1:0);
		if (nDimensions<=3 && dim[2]!=nSlices) hyperStack = false;
		if (hyperStack) {
			nChannels = dim[2];
			nSlices = dim[3];
			nFrames = dim[4];
		}
		if (nSlices==stackSize) hyperStack = false;
		if (nChannels*nSlices*nFrames!=stackSize) hyperStack = false;
		addMouseWheelListener(this);
		ImageJ ij = IJ.getInstance();
		if (nChannels>1) {
			cSelector = new ScrollbarWithLabel(this, 1, 1, 1, nChannels+1, 'c');
			add(cSelector);
			if (ij!=null) cSelector.addKeyListener(ij);
			cSelector.addAdjustmentListener(this);
			cSelector.setFocusable(false);
			cSelector.setUnitIncrement(1);
			cSelector.setBlockIncrement(1);
		}
		if (nSlices>1) {
			char label = nChannels>1||nFrames>1?'z':'t';
			if (nSlices==dim[2]) label = 'c';
			zSelector = new ScrollbarWithLabel(this, 1, 1, 1, nSlices+1, label);
			if (label=='t') animationSelector = zSelector;
			add(zSelector);
			if (ij!=null) zSelector.addKeyListener(ij);
			zSelector.addAdjustmentListener(this);
			zSelector.setFocusable(false);
			int blockIncrement = nSlices/10;
			if (blockIncrement<1) blockIncrement = 1;
			zSelector.setUnitIncrement(1);
			zSelector.setBlockIncrement(blockIncrement);
			sliceSelector = zSelector.bar;
		}
		if (nFrames>1) {
			animationSelector = tSelector = new ScrollbarWithLabel(this, 1, 1, 1, nFrames+1, 't');
			add(tSelector);
			if (ij!=null) tSelector.addKeyListener(ij);
			tSelector.addAdjustmentListener(this);
			tSelector.setFocusable(false);
			int blockIncrement = nFrames/10;
			if (blockIncrement<1) blockIncrement = 1;
			tSelector.setUnitIncrement(1);
			tSelector.setBlockIncrement(blockIncrement);
		}
		if (sliceSelector==null && this.getClass().getName().indexOf("Image5D")!=-1)
			sliceSelector = new Scrollbar();
		pack();
		ic = imp.getCanvas();
		if (ic!=null) ic.setMaxBounds();
		show();
		int previousSlice = imp.getCurrentSlice();
		if (previousSlice>1 && previousSlice<=stackSize)
			imp.setSlice(previousSlice);
		else
			imp.setSlice(1);
		thread = new Thread(this, "zSelector");
		thread.start();
	}

Output:
    public StackWindow(ImagePlus imp, ImageCanvas ic) {
		super(imp, ic);
		ImageStack s = imp.getStack();
		int stackSize = s.getSize();
		nSlices = stackSize;
		hyperStack = imp.getOpenAsHyperStack();
		imp.setOpenAsHyperStack(false);
		int[] dim = imp.getDimensions();
		int nDimensions = 2+(dim[2]>1?1:0)+(dim[3]>1?1:0)+(dim[4]>1?1:0);
		if (nDimensions<=3 && dim[2]!=nSlices) hyperStack = false;
		if (hyperStack) {
			nChannels = dim[2];
			nSlices = dim[3];
			nFrames = dim[4];
		}
		if (nSlices==stackSize) hyperStack = false;
		if (nChannels*nSlices*nFrames!=stackSize) hyperStack = false;
		addMouseWheelListener(this);
		ImageJ ij = IJ.getInstance();
		if (nChannels>1) {
			cSelector = new ScrollbarWithLabel(this, 1, 1, 1, nChannels+1, 'c');
			add(cSelector);
			if (ij!=null) cSelector.addKeyListener(ij);
			cSelector.addAdjustmentListener(this);
			cSelector.setFocusable(false);
			cSelector.setUnitIncrement(1);
			cSelector.setBlockIncrement(1);
		}
		if (nSlices>1) {
			zSelector = new ScrollbarWithLabel(this, 1, 1, 1, nSlices+1, 'z');
			add(zSelector);
			if (ij!=null) zSelector.addKeyListener(ij);
			zSelector.addAdjustmentListener(this);
			zSelector.setFocusable(false);
			int blockIncrement = nSlices/10;
			if (blockIncrement<1) blockIncrement = 1;
			zSelector.setUnitIncrement(1);
			zSelector.setBlockIncrement(blockIncrement);
			sliceSelector = zSelector.bar;
		}
		if (nFrames>1) {
			animationSelector = tSelector = new ScrollbarWithLabel(this, 1, 1, 1, nFrames+1, 't');
			add(tSelector);
			if (ij!=null) tSelector.addKeyListener(ij);
			tSelector.addAdjustmentListener(this);
			tSelector.setFocusable(false);
			int blockIncrement = nFrames/10;
			if (blockIncrement<1) blockIncrement = 1;
			tSelector.setUnitIncrement(1);
			tSelector.setBlockIncrement(blockIncrement);
		}
		if (sliceSelector==null && this.getClass().getName().indexOf("Image5D")!=-1)
			sliceSelector = new Scrollbar();
		pack();
		ic = imp.getCanvas();
		if (ic!=null) ic.setMaxBounds();
		show();
		int previousSlice = imp.getCurrentSlice();
		if (previousSlice>1 && previousSlice<=stackSize)
			imp.setSlice(previousSlice);
		else
			imp.setSlice(1);
		thread = new Thread(this, "zSelector");
		thread.start();
	}


Input:
    public void update() {
        String table_name = getStringPrompt("Which table?");
        List<String> set = getStringPrompt("Which set instruktion?").split(" *, *");
	String condition = getStringPrompt("Which condition?");
	List<String> columns = new ArrayList();
	List<String> valuess = new ArrayList();
	for (String x:set){
	    List<String> tuple=x.split(" *= *");
	    if (tuple.size()!=2){
		System.out.println("Invalid syntax!");
		return;
	    }
	    columns.add(tuple.get(0));
	    values.add(tuple.get(1));
	}
        try {
            db.insert(table_name,columns,values,condition);
        } catch (Exception e) {
            System.out.println("Invalid syntax!");
            System.out.println(e);
        }
    }

Output:
    public void update() {
        String table_name = getStringPrompt("Which table?");
        List<String> set = getStringPrompt("Which set instruction?").split(" *, *");
	String condition = getStringPrompt("Which condition?");
	List<String> columns = new ArrayList();
	List<String> valuess = new ArrayList();
	for (String x:set){
	    List<String> tuple=x.split(" *= *");
	    if (tuple.size()!=2){
		System.out.println("Invalid syntax!");
		return;
	    }
	    columns.add(tuple.get(0));
	    values.add(tuple.get(1));
	}
        try {
            db.insert(table_name,columns,values,condition);
        } catch (Exception e) {
            System.out.println("Invalid syntax!");
            System.out.println(e);
        }
    }


Input:
	protected <T, V extends T> void applyVisualProperty(final VisualProperty<? extends T> vpOriginal, V value) {
		VisualProperty<?> vp = vpOriginal;
		if (value == null)
			value = (V) vp.getDefault();
		if (vp == DVisualLexicon.NODE_SHAPE) {
			setShape(((NodeShape) value));
		} else if (vp == DVisualLexicon.NODE_SELECTED_PAINT) {
			setSelectedPaint((Paint) value);
		} else if (vp == BasicVisualLexicon.NODE_SELECTED) {
			setSelected((Boolean) value);
		} else if (vp == BasicVisualLexicon.NODE_VISIBLE) {
			if (((Boolean) value).booleanValue())
				graphView.showGraphObject(this);
			else
				graphView.hideGraphObject(this);
		} else if (vp == BasicVisualLexicon.NODE_FILL_COLOR) {
			setUnselectedPaint((Paint) value);
		} else if (vp == DVisualLexicon.NODE_BORDER_PAINT) {
			setBorderPaint((Color)value);
		} else if (vp == DVisualLexicon.NODE_BORDER_TRANSPARENCY) {
			final Integer opacity = ((Number) value).intValue();
			setBorderTransparency(opacity);
		} else if (vp == DVisualLexicon.NODE_BORDER_WIDTH) {
			setBorderWidth(((Number) value).floatValue());
		} else if (vp == DVisualLexicon.NODE_BORDER_LINE_TYPE) {
			final DLineType dLineType = DLineType.getDLineType((LineType) value);
			final float currentBorderWidth = graphView.m_nodeDetails.getBorderWidth(model);
			setBorder(dLineType.getStroke(currentBorderWidth));
		} else if (vp == DVisualLexicon.NODE_TRANSPARENCY) {
			setTransparency(((Number) value).intValue());
		} else if (vp == BasicVisualLexicon.NODE_WIDTH) {
			setWidth(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_HEIGHT) {
			setHeight(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_LABEL) {
			setText(value.toString());
		}  else if (vp == BasicVisualLexicon.NODE_LABEL_WIDTH) {
			setLabelWidth(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_X_LOCATION) {
			setXPosition(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_Y_LOCATION) {
			setYPosition(((Number) value).doubleValue());
		} else if (vp == DVisualLexicon.NODE_TOOLTIP) {
			setToolTip(value.toString());
		} else if (vp == BasicVisualLexicon.NODE_LABEL_COLOR) {
			setTextPaint((Color)value);
		} else if (vp == BasicVisualLexicon.NODE_LABEL_TRANSPARENCY) {
			final int currentOpacity = graphView.m_nodeDetails.getLabelTransparency(model);
			final int opacity = ((Number) value).intValue();
			if(currentOpacity != opacity) {
				setTextTransparency(opacity);
			}
		} else if (vp == DVisualLexicon.NODE_LABEL_FONT_FACE) {
			final float currentFontSize = graphView.m_nodeDetails.getLabelFont(model, 0).getSize();
			final Font newFont = ((Font) value).deriveFont(currentFontSize);
			setFont(newFont);
		} else if (vp == DVisualLexicon.NODE_LABEL_FONT_SIZE) {
			final float newSize = ((Number) value).floatValue();
			final Font newFont = graphView.m_nodeDetails.getLabelFont(model, 0).deriveFont(newSize);
			setFont(newFont);
		} else if (vp == DVisualLexicon.NODE_LABEL_POSITION) {
			this.setLabelPosition((ObjectPosition) value);
		} else if (vp instanceof CustomGraphicsVisualProperty) {
			applyCustomGraphics(vp, (CyCustomGraphics<CustomGraphicLayer>) value);
		} else if (vp instanceof ObjectPositionVisualProperty) {
			applyCustomGraphicsPosition(vp, (ObjectPosition) value);
		}
	}

Output:
	protected <T, V extends T> void applyVisualProperty(final VisualProperty<? extends T> vpOriginal, V value) {
		VisualProperty<?> vp = vpOriginal;
		if (value == null)
			value = (V) vp.getDefault();
		if (vp == DVisualLexicon.NODE_SHAPE) {
			setShape(((NodeShape) value));
		} else if (vp == DVisualLexicon.NODE_SELECTED_PAINT) {
			setSelectedPaint((Paint) value);
		} else if (vp == BasicVisualLexicon.NODE_SELECTED) {
			setSelected((Boolean) value);
		} else if (vp == BasicVisualLexicon.NODE_VISIBLE) {
			if (((Boolean) value).booleanValue())
				graphView.showGraphObject(this);
			else
				graphView.hideGraphObject(this);
		} else if (vp == BasicVisualLexicon.NODE_FILL_COLOR) {
			setUnselectedPaint((Paint) value);
		} else if (vp == DVisualLexicon.NODE_BORDER_PAINT) {
			setBorderPaint((Color)value);
		} else if (vp == DVisualLexicon.NODE_BORDER_TRANSPARENCY) {
			final Integer opacity = ((Number) value).intValue();
			setBorderTransparency(opacity);
		} else if (vp == DVisualLexicon.NODE_BORDER_WIDTH) {
			setBorderWidth(((Number) value).floatValue());
		} else if (vp == DVisualLexicon.NODE_BORDER_LINE_TYPE) {
			final DLineType dLineType = DLineType.getDLineType((LineType) value);
			final float currentBorderWidth = graphView.m_nodeDetails.getBorderWidth(model);
			setBorder(dLineType.getStroke(currentBorderWidth));
		} else if (vp == DVisualLexicon.NODE_TRANSPARENCY) {
			setTransparency(((Number) value).intValue());
		} else if (vp == BasicVisualLexicon.NODE_WIDTH) {
			setWidth(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_HEIGHT) {
			setHeight(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_LABEL) {
			setText(value.toString());
		}  else if (vp == BasicVisualLexicon.NODE_LABEL_WIDTH) {
			setLabelWidth(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_X_LOCATION) {
			setXPosition(((Number) value).doubleValue());
		} else if (vp == BasicVisualLexicon.NODE_Y_LOCATION) {
			setYPosition(((Number) value).doubleValue());
		} else if (vp == DVisualLexicon.NODE_TOOLTIP) {
			setToolTip(value.toString());
		} else if (vp == BasicVisualLexicon.NODE_LABEL_COLOR) {
			setTextPaint((Color)value);
		} else if (vp == BasicVisualLexicon.NODE_LABEL_TRANSPARENCY) {
			final int opacity = ((Number) value).intValue();
			setTextTransparency(opacity);
		} else if (vp == DVisualLexicon.NODE_LABEL_FONT_FACE) {
			final float currentFontSize = graphView.m_nodeDetails.getLabelFont(model, 0).getSize();
			final Font newFont = ((Font) value).deriveFont(currentFontSize);
			setFont(newFont);
		} else if (vp == DVisualLexicon.NODE_LABEL_FONT_SIZE) {
			final float newSize = ((Number) value).floatValue();
			final Font newFont = graphView.m_nodeDetails.getLabelFont(model, 0).deriveFont(newSize);
			setFont(newFont);
		} else if (vp == DVisualLexicon.NODE_LABEL_POSITION) {
			this.setLabelPosition((ObjectPosition) value);
		} else if (vp instanceof CustomGraphicsVisualProperty) {
			applyCustomGraphics(vp, (CyCustomGraphics<CustomGraphicLayer>) value);
		} else if (vp instanceof ObjectPositionVisualProperty) {
			applyCustomGraphicsPosition(vp, (ObjectPosition) value);
		}
	}


Input:
    public boolean isForMe(ProjectViewNode node) {
        if (node instanceof PsiDirectoryNode) {
            PsiDirectoryNode dirNode = (PsiDirectoryNode) node;
            final Project project = dirNode.getProject();
            final PsiDirectory psiDirectory = dirNode.getValue();
            final VirtualFile directoryFile = psiDirectory.getVirtualFile();
            return (ProjectRootsUtil.isModuleContentRoot(directoryFile, project)
                    || ProjectRootsUtil.isInSource(directoryFile, project));
        }
        return false;
    }

Output:
    public boolean isForMe(ProjectViewNode node) {
        if (node instanceof PsiDirectoryNode) {
            PsiDirectoryNode dirNode = (PsiDirectoryNode) node;
            final Project project = dirNode.getProject();
            final PsiDirectory psiDirectory = dirNode.getValue();
            if (psiDirectory != null) {
                final VirtualFile directoryFile = psiDirectory.getVirtualFile();
                return (ProjectRootsUtil.isModuleContentRoot(directoryFile, project)
                        || ProjectRootsUtil.isInSource(directoryFile, project));
            }
        }
        return false;
    }


Input:
    public void should_insert_single_invoice_record_from_finance_and_admin_with_same_invoice_number() throws IOException {
        String[] adminTestData = {
          "1234",
           "2000",
           "goods"
        };
        String[] financeTestData = {
          "1234",
           "23",
           "CHENNAI",
           "2345"
        };
        String[] adminHeaders = {
          "invoiceNumber",
           "bondNumber",
            "descriptionOfGoods"
        };
        String[] financeHeaders={
            "invoiceNumber",
             "quantity",
              "location",
               "april-10"
        };
        List<String[]> adminListOfTestData = new ArrayList<String[]>();
        List<String[]> financeListOfTestData = new ArrayList<String[]>();
        adminListOfTestData.add(adminTestData);
        financeListOfTestData.add(financeTestData);
        List<Map<String, String>> adminMappedEntries = null;
        List<Map<String, String>> financeMappedEntries = null;
        try {
            adminMappedEntries = new ColumnMapper(adminHeaders, adminListOfTestData).mappedList();
            financeMappedEntries = new ColumnMapper(financeHeaders, financeListOfTestData).mappedList();
        } catch (Exception e) {
            e.printStackTrace();
        }
        List<Map<String, String>>combinedEntries = new InvoiceCreator(adminMappedEntries, financeMappedEntries).createJoinEntry();
        List<String> insertStatements =  new SQLGenerator(combinedEntries).createInsertStatements();
        sessionFactory.getCurrentSession().createSQLQuery("delete from asset; delete from invoice");
        for(String insertStatement: insertStatements){
            sessionFactory.getCurrentSession().createSQLQuery(insertStatement).executeUpdate();
        }
       Invoice invoice = invoiceRepository.get(0);
        String[] expectedValue = {
          "1234", "2000", "goods", "23", "CHENNAI"
        };
        String[] actualData = {
          invoice.getInvoiceNumber(),
          invoice.getBondNumber(),
          invoice.getDescriptionOfGoods(),
          invoice.getQuantity().toString(),
          invoice.getLocation().toString()
        };
        assertThat(actualData, equalTo(expectedValue));
    }

Output:
    public void should_insert_single_invoice_record_from_finance_and_admin_with_same_invoice_number() throws IOException {
        String[] adminTestData = {
          "1234",
           "2000",
           "goods"
        };
        String[] financeTestData = {
          "1234",
           "23",
           "CHENNAI",
           "2345"
        };
        String[] adminHeaders = {
          "invoiceNumber",
           "bondNumber",
            "descriptionOfGoods"
        };
        String[] financeHeaders={
            "invoiceNumber",
             "quantity",
              "location",
               "april-10"
        };
        List<String[]> adminListOfTestData = new ArrayList<String[]>();
        List<String[]> financeListOfTestData = new ArrayList<String[]>();
        adminListOfTestData.add(adminTestData);
        financeListOfTestData.add(financeTestData);
        List<Map<String, String>> adminMappedEntries = null;
        List<Map<String, String>> financeMappedEntries = null;
        try {
            adminMappedEntries = new ColumnMapper(adminHeaders, adminListOfTestData).mappedList();
            financeMappedEntries = new ColumnMapper(financeHeaders, financeListOfTestData).mappedList();
        } catch (Exception e) {
            e.printStackTrace();
        }
        List<Map<String, String>>combinedEntries = new InvoiceCreator(adminMappedEntries, financeMappedEntries).createJoinEntry();
        List<String> insertStatements =  new SQLGenerator(combinedEntries).createInsertStatements();
        sessionFactory.getCurrentSession().createSQLQuery("delete from asset; delete from invoice;").executeUpdate();
        for(String insertStatement: insertStatements){
            sessionFactory.getCurrentSession().createSQLQuery(insertStatement).executeUpdate();
        }
       Invoice invoice = invoiceRepository.get(0);
        String[] expectedValue = {
          "1234", "2000", "goods", "23", "CHENNAI"
        };
        String[] actualData = {
          invoice.getInvoiceNumber(),
          invoice.getBondNumber(),
          invoice.getDescriptionOfGoods(),
          invoice.getQuantity().toString(),
          invoice.getLocation().toString()
        };
        assertThat(actualData, equalTo(expectedValue));
    }


Input:
public void displayNewThreadFormFor(final Category category) {
        layout.removeAllComponents();
        final HeadingLabel heading = new HeadingLabel("Start a New Thread",
                HeadingLevel.H2);
        layout.addComponent(heading);
        getRoot().scrollIntoView(heading);
        final HorizontalLayout topicLayout = new HorizontalLayout();
        topicLayout.setSpacing(true);
        topicLayout.setMargin(true, false, true, false);
        topicLayout.setWidth("50em");
        topicLayout.setStyleName("newthread");
        layout.addComponent(topicLayout);
        final HeadingLabel topicLabel = new HeadingLabel("Topic",
                HeadingLevel.H3);
        topicLabel.addStyleName("topiclabel");
        topicLabel.setWidth("153px");
        topicLayout.addComponent(topicLabel);
        final TextField topicField = new TextField();
        topicField.setStyleName("topicfield");
        topicField.setWidth("100%");
        topicLayout.addComponent(topicField);
        topicLayout.setExpandRatio(topicField, 1.0f);
        topicField.focus();
        newThreadComponent = new NewThreadComponent(new NewThreadListener() {
            @Override
            public void submit(final String rawBody) {
                String errorMessages = "";
                final String topic = topicField.getValue();
                if (topic.isEmpty()) {
                    errorMessages += "You need a topic
";
                }
                if (rawBody.isEmpty()) {
                    errorMessages += "You need a thread body
";
                }
                if (errorMessages.isEmpty()) {
                    try {
                        final DiscussionThread createdThread = getPresenter()
                                .createNewThread(category, topic, rawBody);
                        getNavigator().navigateTo(
                                ToriNavigator.ApplicationView.THREADS.getUrl()
                                        + "/" + createdThread.getId());
                    } catch (final DataSourceException e) {
                        getRoot()
                                .showNotification(
                                        DataSourceException.BORING_GENERIC_ERROR_MESSAGE);
                    }
                } else {
                    getRoot().showNotification(errorMessages,
                            Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }
            @Override
            public void addAttachment(final String attachmentFileName,
                    final byte[] data) {
                getPresenter().addAttachment(attachmentFileName, data);
            }
            @Override
            public void resetInput() {
                getPresenter().resetInput();
            }
            @Override
            public void removeAttachment(final String fileName) {
                getPresenter().removeAttachment(fileName);
            }
        }, ToriApplication.getCurrent().getPostFormatter()
                .getFormattingSyntaxXhtml());
        newThreadComponent.setUserMayAddFiles(getPresenter().userMayAddFiles());
        newThreadComponent.setMaxFileSize(getPresenter().getMaxFileSize());
        layout.addComponent(newThreadComponent);
    }

Output:
public void displayNewThreadFormFor(final Category category) {
        layout.removeAllComponents();
        final HeadingLabel heading = new HeadingLabel("Start a New Thread",
                HeadingLevel.H2);
        layout.addComponent(heading);
        getRoot().scrollIntoView(heading);
        final HorizontalLayout topicLayout = new HorizontalLayout();
        topicLayout.setSpacing(true);
        topicLayout.setMargin(true, false, false, false);
        topicLayout.setWidth("50em");
        topicLayout.setStyleName("newthread");
        layout.addComponent(topicLayout);
        final HeadingLabel topicLabel = new HeadingLabel("Topic",
                HeadingLevel.H3);
        topicLabel.addStyleName("topiclabel");
        topicLabel.setWidth("153px");
        topicLayout.addComponent(topicLabel);
        final TextField topicField = new TextField();
        topicField.setStyleName("topicfield");
        topicField.setWidth("100%");
        topicLayout.addComponent(topicField);
        topicLayout.setExpandRatio(topicField, 1.0f);
        topicField.focus();
        newThreadComponent = new NewThreadComponent(new NewThreadListener() {
            @Override
            public void submit(final String rawBody) {
                String errorMessages = "";
                final String topic = topicField.getValue();
                if (topic.isEmpty()) {
                    errorMessages += "You need a topic
";
                }
                if (rawBody.isEmpty()) {
                    errorMessages += "You need a thread body
";
                }
                if (errorMessages.isEmpty()) {
                    try {
                        final DiscussionThread createdThread = getPresenter()
                                .createNewThread(category, topic, rawBody);
                        getNavigator().navigateTo(
                                ToriNavigator.ApplicationView.THREADS.getUrl()
                                        + "/" + createdThread.getId());
                    } catch (final DataSourceException e) {
                        getRoot()
                                .showNotification(
                                        DataSourceException.BORING_GENERIC_ERROR_MESSAGE);
                    }
                } else {
                    getRoot().showNotification(errorMessages,
                            Notification.TYPE_HUMANIZED_MESSAGE);
                }
            }
            @Override
            public void addAttachment(final String attachmentFileName,
                    final byte[] data) {
                getPresenter().addAttachment(attachmentFileName, data);
            }
            @Override
            public void resetInput() {
                getPresenter().resetInput();
            }
            @Override
            public void removeAttachment(final String fileName) {
                getPresenter().removeAttachment(fileName);
            }
        }, ToriApplication.getCurrent().getPostFormatter()
                .getFormattingSyntaxXhtml());
        newThreadComponent.setUserMayAddFiles(getPresenter().userMayAddFiles());
        newThreadComponent.setMaxFileSize(getPresenter().getMaxFileSize());
        layout.addComponent(newThreadComponent);
    }


Input:
	public static String createDisplayName(RElementName a, final int options) {
		StringBuilder sb = null;
		if ((options & DISPLAY_NS_PREFIX) != 0) {
			final RElementName namespace = a.getNamespace();
			if (namespace != null) {
				sb = new StringBuilder(32);
				if (!appendEnvAccess(namespace, sb, options)
						|| a.getType() != MAIN_DEFAULT) {
					return null;
				}
			}
			else if (a.getType() == MAIN_SEARCH_ENV
					|| a.getType() == MAIN_PACKAGE
					|| a.getType() == MAIN_SYSFRAME) {
				sb = new StringBuilder(32);
				if (!appendEnvAccess(a, sb, options)
						|| (a = a.getNextSegment()) != null && a.getType() != MAIN_DEFAULT) {
					return null;
				}
			}
			if (sb != null && a != null) {
				sb.append('$');
				final String name = a.getSegmentName();
				if (name != null) {
					appendSymbol(sb, name);
				}
				a = a.getNextSegment();
			}
		}
		if (sb == null) {
			String firstName;
			final int type = a.getType();
			switch (type) {
			case MAIN_DEFAULT:
			case MAIN_CLASS:
			case SUB_NAMEDPART:
			case SUB_NAMEDSLOT:
				firstName = a.getSegmentName();
				if (firstName != null) {
					sb = appendSymbol(sb, firstName);
				}
				else {
					firstName = "";
				}
				a = a.getNextSegment();
				if (a == null) {
					return (sb != null) ? sb.toString() : firstName;
				}
				if (sb == null) {
					sb = new StringBuilder(firstName);
				}
				break;
			case MAIN_SEARCH_ENV:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return firstName;
				}
				return null;
			case MAIN_SYSFRAME:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "frame:"+firstName;
				}
				return null;
			case MAIN_PACKAGE:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "package:"+firstName;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					return "package:<unknown>";
				}
				else {
					return null;
				}
			case MAIN_PROJECT:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "project:"+firstName;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					return "project:<unknown>";
				}
				else {
					return null;
				}
			case SUB_INDEXED_D:
				if (a instanceof DefaultImpl) {
					sb = new StringBuilder("[[");
					sb.append(a.getSegmentName());
					sb.append("]]");
					a = a.getNextSegment();
					break;
				}
				return null;
			case RESOURCE:
			case MAIN_OTHER:
				return a.getSegmentName();
			case ANONYMOUS:
				if ((options & DISPLAY_EXACT) == 0) {
					return "<anonymous>";
				}
				return null;
			default:
				return null;
			}
		}
		APPEND_SUB : while (a != null) {
			String name;
			switch (a.getType()) {
			case MAIN_DEFAULT:
			case MAIN_CLASS:
			case SUB_NAMEDPART:
				if (((options & DISPLAY_EXACT) != 0) && a instanceof IndexElementName) {
					sb.append("[[");
					sb.append(((IndexElementName) a).getIndex());
					sb.append("L]]");
				}
				else {
					sb.append('$');
					name = a.getSegmentName();
					if (name != null) {
						appendSymbol(sb, name);
					}
				}
				a = a.getNextSegment();
				continue APPEND_SUB;
			case SUB_NAMEDSLOT:
				sb.append('@');
				name = a.getSegmentName();
				if (name != null) {
					appendSymbol(sb, name);
				}
				a = a.getNextSegment();
				continue APPEND_SUB;
			case SUB_INDEXED_S:
				if (((options & DISPLAY_EXACT) != 0)) {
					return null;
				}
				sb.append("[…]");
				break APPEND_SUB;
			case SUB_INDEXED_D:
				if (a instanceof DefaultImpl) {
					sb.append("[[");
					sb.append(a.getSegmentName());
					sb.append("]]");
					a = a.getNextSegment();
					continue APPEND_SUB;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					sb.append("[[…]]");
					continue APPEND_SUB;
				}
				else {
					return null;
				}
			default:
				if (((options & DISPLAY_EXACT) == 0)) {
					sb.append(" …");
					break APPEND_SUB;
				}
				return null;
			}
		}
		return sb.toString();
	}

Output:
	public static String createDisplayName(RElementName a, final int options) {
		StringBuilder sb = null;
		if ((options & DISPLAY_NS_PREFIX) != 0) {
			final RElementName namespace = a.getNamespace();
			if (namespace != null) {
				sb = new StringBuilder(32);
				if (!appendEnvAccess(namespace, sb, options)
						|| a.getType() != MAIN_DEFAULT) {
					return null;
				}
			}
			else if (a.getType() == MAIN_SEARCH_ENV
					|| a.getType() == MAIN_PACKAGE
					|| a.getType() == MAIN_SYSFRAME) {
				sb = new StringBuilder(32);
				if (!appendEnvAccess(a, sb, options)
						|| (a = a.getNextSegment()) != null && a.getType() != MAIN_DEFAULT) {
					return null;
				}
			}
			if (sb != null && a != null) {
				sb.append('$');
				final String name = a.getSegmentName();
				if (name != null) {
					appendSymbol(sb, name);
				}
				a = a.getNextSegment();
			}
		}
		if (sb == null) {
			String firstName;
			final int type = a.getType();
			switch (type) {
			case MAIN_DEFAULT:
			case MAIN_CLASS:
			case SUB_NAMEDPART:
			case SUB_NAMEDSLOT:
				firstName = a.getSegmentName();
				if (firstName != null) {
					sb = appendSymbol(sb, firstName);
				}
				else {
					firstName = "";
				}
				a = a.getNextSegment();
				if (a == null) {
					return (sb != null) ? sb.toString() : firstName;
				}
				if (sb == null) {
					sb = new StringBuilder(firstName);
				}
				break;
			case MAIN_SEARCH_ENV:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return firstName;
				}
				return null;
			case MAIN_SYSFRAME:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "frame:"+firstName;
				}
				return null;
			case MAIN_PACKAGE:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "package:"+firstName;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					return "package:<unknown>";
				}
				else {
					return null;
				}
			case MAIN_PROJECT:
				firstName = a.getSegmentName();
				if (firstName != null) {
					return "project:"+firstName;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					return "project:<unknown>";
				}
				else {
					return null;
				}
			case SUB_INDEXED_D:
				if (a instanceof DefaultImpl) {
					sb = new StringBuilder("[[");
					sb.append(a.getSegmentName());
					sb.append("]]");
					a = a.getNextSegment();
					break;
				}
				return null;
			case RESOURCE:
			case MAIN_OTHER:
				return a.getSegmentName();
			case ANONYMOUS:
				if ((options & DISPLAY_EXACT) == 0) {
					return "<anonymous>";
				}
				return null;
			default:
				return null;
			}
		}
		APPEND_SUB : while (a != null) {
			String name;
			switch (a.getType()) {
			case MAIN_DEFAULT:
			case MAIN_CLASS:
			case SUB_NAMEDPART:
				if (((options & DISPLAY_EXACT) != 0) && a instanceof IndexElementName) {
					sb.append("[[");
					sb.append(((IndexElementName) a).getIndex());
					sb.append("L]]");
				}
				else {
					sb.append('$');
					name = a.getSegmentName();
					if (name != null) {
						appendSymbol(sb, name);
					}
				}
				a = a.getNextSegment();
				continue APPEND_SUB;
			case SUB_NAMEDSLOT:
				sb.append('@');
				name = a.getSegmentName();
				if (name != null) {
					appendSymbol(sb, name);
				}
				a = a.getNextSegment();
				continue APPEND_SUB;
			case SUB_INDEXED_S:
				if (((options & DISPLAY_EXACT) != 0)) {
					return null;
				}
				sb.append("[…]");
				break APPEND_SUB;
			case SUB_INDEXED_D:
				if (a instanceof DefaultImpl) {
					sb.append("[[");
					sb.append(a.getSegmentName());
					sb.append("]]");
					a = a.getNextSegment();
					continue APPEND_SUB;
				}
				else if ((options & DISPLAY_EXACT) == 0) {
					sb.append("[[…]]");
					a = a.getNextSegment();
					continue APPEND_SUB;
				}
				else {
					return null;
				}
			default:
				if (((options & DISPLAY_EXACT) == 0)) {
					sb.append(" …");
					break APPEND_SUB;
				}
				return null;
			}
		}
		return sb.toString();
	}


Input:
	public GLMultiFormWindow(String title, GLSubGraph view, MultiFormInfo info, boolean isScrollable) {
		super(title, view);
		this.info = info;
		GLElementAdapter container = isScrollable ? new ScrollableGLElementAdapter(view, info.multiFormRenderer)
				: new GLElementAdapter(view, info.multiFormRenderer, true);
		info.container = container;
		setContent(container);
		viewSwitchingBar = new GLElementViewSwitchingBar(info.multiFormRenderer);
		titleBar.add(titleBar.size() - 1, viewSwitchingBar);
		viewSwitchingBar.setVisibility(EVisibility.NONE);
		for (Entry<EEmbeddingID, List<Integer>> entry : info.embeddingIDToRendererIDs.entrySet()) {
			for (Integer rendererID : entry.getValue()) {
				String toolTip = null;
				switch (entry.getKey()) {
				case PATHWAY_LEVEL1:
					toolTip = "Pathway";
					break;
				case PATHWAY_LEVEL2:
					toolTip = "Pathway Thumbnail with Context Paths";
					break;
				case PATHWAY_LEVEL3:
					toolTip = "Pathway Thumbnail";
					break;
				case PATHWAY_LEVEL4:
					toolTip = "Minimize";
					break;
				case PATH_LEVEL1:
					toolTip = "Selected Path with Detailed Experimental Data";
					break;
				case PATH_LEVEL2:
					toolTip = "Selected Path";
					break;
				default:
					break;
				}
				if (toolTip != null) {
					viewSwitchingBar.setButtonToolTip(toolTip, rendererID);
				}
			}
		}
	}

Output:
	public GLMultiFormWindow(String title, GLSubGraph view, MultiFormInfo info, boolean isScrollable) {
		super(title, view);
		this.info = info;
		GLElementAdapter container = isScrollable ? new ScrollableGLElementAdapter(view, info.multiFormRenderer)
				: new GLElementAdapter(view, info.multiFormRenderer, true);
		info.container = container;
		setContent(container);
		viewSwitchingBar = new GLElementViewSwitchingBar(info.multiFormRenderer);
		titleBar.add(titleBar.size() - 1, viewSwitchingBar);
		viewSwitchingBar.setVisibility(EVisibility.NONE);
		for (Entry<EEmbeddingID, List<Integer>> entry : info.embeddingIDToRendererIDs.entrySet()) {
			for (Integer rendererID : entry.getValue()) {
				String toolTip = null;
				switch (entry.getKey()) {
				case PATHWAY_LEVEL1:
					toolTip = "Pathway";
					break;
				case PATHWAY_LEVEL2:
					toolTip = "Context Paths with Pathway Thumbnail";
					break;
				case PATHWAY_LEVEL3:
					toolTip = "ContextPaths";
					break;
				case PATHWAY_LEVEL4:
					toolTip = "Minimize";
					break;
				case PATH_LEVEL1:
					toolTip = "Selected Path with Detailed Experimental Data";
					break;
				case PATH_LEVEL2:
					toolTip = "Selected Path";
					break;
				default:
					break;
				}
				if (toolTip != null) {
					viewSwitchingBar.setButtonToolTip(toolTip, rendererID);
				}
			}
		}
	}