Input:
	public BubbleCommand(Walker walker, Game game) {
		super(walker, 1.4f, EaseLinear.getInstance());
		this.walker = walker;
		this.game = game;
		switch(walker.rol)
		{
		case JEDI:
			switch((int)Math.random()*10)
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_OLA_K_ASE, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_HOLA_K_ASE, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBLE_SPACEPELOTAS, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_TINTINTIRIRIN, walker.position);
				break;
			default:
				bubble = new Bubble(BubbleType.BUBBLE_NOTE_BLUE, walker.position);
			}
			break;
		case STORM_TROOPER:
			switch((int)Math.random()*10)
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_A_DUCADOS, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_A_EWOK, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBLE_A_NAPALM, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_EWOKS3, walker.position);
				break;
			case 4:
				bubble = new Bubble(BubbleType.BUBBLE_PEINANDO, walker.position);
				break;
			default:
				bubble = new Bubble(BubbleType.BUBBLE_NOTE_WHITE, walker.position);
			}
			break;
		case DARTH_VADER:
			switch((int)Math.random()*4)
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_A_OBI, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_A_OSCURO, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBBE_A_PADRE_2, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_VADER, walker.position);
				break;
			}
			break;
		case CHUWAKA:
			bubble = new Bubble(BubbleType.getRandomBubble(), walker.position);
			break;
		default:
			bubble = new Bubble(BubbleType.getRandomBubble(), walker.position);
		}
		movable = bubble;
		this.game.addEntity(bubble);
	}

Output:
	public BubbleCommand(Walker walker, Game game) {
		super(walker, 1.4f, EaseLinear.getInstance());
		this.walker = walker;
		this.game = game;
		switch(walker.rol)
		{
		case JEDI:
			switch((int)(Math.random()*10))
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_OLA_K_ASE, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_HOLA_K_ASE, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBLE_SPACEPELOTAS, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_TINTINTIRIRIN, walker.position);
				break;
			default:
				bubble = new Bubble(BubbleType.BUBBLE_NOTE_BLUE, walker.position);
			}
			break;
		case STORM_TROOPER:
			switch((int)(Math.random()*10))
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_A_DUCADOS, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_A_EWOK, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBLE_A_NAPALM, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_EWOKS3, walker.position);
				break;
			case 4:
				bubble = new Bubble(BubbleType.BUBBLE_PEINANDO, walker.position);
				break;
			default:
				bubble = new Bubble(BubbleType.BUBBLE_NOTE_WHITE, walker.position);
			}
			break;
		case DARTH_VADER:
			switch((int)(Math.random()*4))
			{
			case 0:
				bubble = new Bubble(BubbleType.BUBBLE_A_OBI, walker.position);
				break;
			case 1:
				bubble = new Bubble(BubbleType.BUBBLE_A_OSCURO, walker.position);
				break;
			case 2:
				bubble = new Bubble(BubbleType.BUBBBE_A_PADRE_2, walker.position);
				break;
			case 3:
				bubble = new Bubble(BubbleType.BUBBLE_VADER, walker.position);
				break;
			}
			break;
		case CHUWAKA:
			bubble = new Bubble(BubbleType.getRandomBubble(), walker.position);
			break;
		default:
			bubble = new Bubble(BubbleType.getRandomBubble(), walker.position);
		}
		movable = bubble;
		this.game.addEntity(bubble);
	}


Input:
	private static void importProject(SVNRepository repo) throws Exception {
		log.info("Import the project...");
		repo.setAuthenticationManager(andyMeneely);
		ISVNEditor editor = repo.getCommitEditor("import project", null , true , null );
		editor.openRoot(-1);
		List<File> files = new RecurseJavaFiles(true).loadRecursive(new File("testsvn/mancala"));
		for (File file : files) {
			String svnpath = "";
			svnpath = "trunk/" + file.getPath().replaceFirst("testsvn\\\\", "").replaceAll("\\\\", "/");
			log.debug("Adding svnpath: " + svnpath);
			if (file.isDirectory()) {
				editor.addDir(svnpath, null, -1);
				editor.closeDir();
			} else {
				editor.addFile(svnpath, null, -1);
				editor.applyTextDelta(svnpath, null);
				Scanner scanner = new Scanner(file);
				StringBuffer sb = new StringBuffer();
				while (scanner.hasNext())
					sb.append(scanner.next());
				scanner.close();
				String checksum = new SVNDeltaGenerator().sendDelta(svnpath, new ByteArrayInputStream(sb.toString().getBytes()), editor, true);
				editor.closeFile(svnpath, checksum);
			}
		}
		SVNCommitInfo commitInfo = editor.closeEdit();
		log.info("Finished commit: " + commitInfo.toString());
	}

Output:
	private static void importProject(SVNRepository repo) throws Exception {
		log.info("Import the project...");
		repo.setAuthenticationManager(andyMeneely);
		ISVNEditor editor = repo.getCommitEditor("import project", null , true , null );
		editor.openRoot(-1);
		List<File> files = new RecurseJavaFiles(true).loadRecursive(new File("testsvn/mancala"));
		for (File file : files) {
			String svnpath = "";
			svnpath = "trunk/" + file.getPath().replaceFirst("testsvn\\\\", "").replaceAll("\\\\", "/");
			log.debug("Adding svnpath: " + svnpath);
			if (file.isDirectory()) {
				editor.addDir(svnpath, null, -1);
				editor.closeDir();
			} else {
				editor.addFile(svnpath, null, -1);
				editor.applyTextDelta(svnpath, null);
				Scanner scanner = new Scanner(file);
				StringBuffer sb = new StringBuffer();
				while (scanner.hasNextLine())
					sb.append(scanner.nextLine() + "\r\n");
				scanner.close();
				String checksum = new SVNDeltaGenerator().sendDelta(svnpath, new ByteArrayInputStream(sb.toString().getBytes()), editor, true);
				editor.closeFile(svnpath, checksum);
			}
		}
		SVNCommitInfo commitInfo = editor.closeEdit();
		log.info("Finished commit: " + commitInfo.toString());
	}


Input:
    public boolean apply(Object deploymentPlanItem, AssemblyTemplateConstructor atc) {
        Object item = lookup(deploymentPlanItem);
        if (item==null) return false;
        log.debug("Item "+deploymentPlanItem+" being instantiated with "+item);
        Object old = atc.getInstantiator();
        if (old!=null && !old.equals(BrooklynAssemblyTemplateInstantiator.class)) {
            log.warn("Can't mix Brooklyn entities with non-Brooklyn entities (at present): "+old);
            return false;
        }
        Builder<? extends PlatformComponentTemplate> builder = PlatformComponentTemplate.builder();
        if (item instanceof CatalogItem) {
            builder.type( "brooklyn:"+((CatalogItem<?>)item).getJavaType() );
        } else if (item instanceof Class) {
            builder.type( "brooklyn:"+((Class<?>) item).getCanonicalName() );
        } else {
            throw new IllegalStateException("Item "+item+" is not recognised here");
        }
        atc.instantiator(BrooklynAssemblyTemplateInstantiator.class);
        String name = ((Service)deploymentPlanItem).getName();
        if (!Strings.isBlank(name)) builder.name(name);
        Map<String, Object> attrs = MutableMap.copyOf( ((Service)deploymentPlanItem).getCustomAttributes() );
        if (attrs.containsKey("id"))
            builder.customAttribute("planId", attrs.remove("id"));
        Object location = attrs.remove("location");
        if (location!=null)
            builder.customAttribute("location", location);
        Object locations = attrs.remove("locations");
        if (locations!=null)
            builder.customAttribute("locations", locations);
        Map<Object, Object> brooklynConfig = MutableMap.of();
        Object origBrooklynConfig = attrs.remove("brooklyn.config");
        if (origBrooklynConfig!=null) {
            if (!(origBrooklynConfig instanceof Map))
                throw new IllegalArgumentException("brooklyn.config must be a map of brooklyn config keys");
            brooklynConfig.putAll((Map<?,?>)origBrooklynConfig);
        }
        if (!brooklynConfig.isEmpty())
            builder.customAttribute("brooklyn.config", brooklynConfig);
        List<Object> brooklynPolicies = Lists.newArrayList();
        Object origBrooklynPolicies = attrs.remove("brooklyn.policies");
        if (origBrooklynPolicies != null) {
            if (!(origBrooklynPolicies instanceof List))
                throw new IllegalArgumentException("brooklyn.policies must be a list of brooklyn policy definitions");
            brooklynPolicies.addAll((List<?>)origBrooklynPolicies);
        }
        if (!brooklynPolicies.isEmpty())
            builder.customAttribute("brooklyn.policies", brooklynPolicies);
        List<Object> brooklynEnrichers = Lists.newArrayList();
        Object origBrooklynEnrichers = attrs.remove("brooklyn.enrichers");
        if (origBrooklynEnrichers != null) {
            if (!(origBrooklynEnrichers instanceof List))
                throw new IllegalArgumentException("brooklyn.enrichers must be a list of brooklyn enricher definitions");
            brooklynEnrichers.addAll((List<?>)origBrooklynEnrichers);
        }
        if (!brooklynEnrichers.isEmpty())
            builder.customAttribute("brooklyn.enrichers", brooklynEnrichers);
        List<Object> brooklynChildren = Lists.newArrayList();
        Object origBrooklynChildren = attrs.remove("brooklyn.children");
        if (origBrooklynChildren != null) {
            if (!(origBrooklynChildren instanceof List))
                throw new IllegalArgumentException("brooklyn.children must be a list of brooklyn entity definitions");
            brooklynChildren.addAll((List<?>)origBrooklynChildren);
        }
        if (!brooklynChildren.isEmpty())
            builder.customAttribute("brooklyn.children",  brooklynChildren);
        if (!attrs.isEmpty()) {
            log.warn("Ignoring PDP attributes on "+deploymentPlanItem+": "+attrs);
        }
        atc.add(builder.build());
        return true;
    }

Output:
    public boolean apply(Object deploymentPlanItem, AssemblyTemplateConstructor atc) {
        Object item = lookup(deploymentPlanItem);
        if (item==null) return false;
        log.debug("Item "+deploymentPlanItem+" being instantiated with "+item);
        Object old = atc.getInstantiator();
        if (old!=null && !old.equals(BrooklynAssemblyTemplateInstantiator.class)) {
            log.warn("Can't mix Brooklyn entities with non-Brooklyn entities (at present): "+old);
            return false;
        }
        Builder<? extends PlatformComponentTemplate> builder = PlatformComponentTemplate.builder();
        if (item instanceof CatalogItem) {
            builder.type( "brooklyn:"+((CatalogItem<?>)item).getJavaType() );
        } else if (item instanceof Class) {
            builder.type( "brooklyn:"+((Class<?>) item).getName() );
        } else {
            throw new IllegalStateException("Item "+item+" is not recognised here");
        }
        atc.instantiator(BrooklynAssemblyTemplateInstantiator.class);
        String name = ((Service)deploymentPlanItem).getName();
        if (!Strings.isBlank(name)) builder.name(name);
        Map<String, Object> attrs = MutableMap.copyOf( ((Service)deploymentPlanItem).getCustomAttributes() );
        if (attrs.containsKey("id"))
            builder.customAttribute("planId", attrs.remove("id"));
        Object location = attrs.remove("location");
        if (location!=null)
            builder.customAttribute("location", location);
        Object locations = attrs.remove("locations");
        if (locations!=null)
            builder.customAttribute("locations", locations);
        Map<Object, Object> brooklynConfig = MutableMap.of();
        Object origBrooklynConfig = attrs.remove("brooklyn.config");
        if (origBrooklynConfig!=null) {
            if (!(origBrooklynConfig instanceof Map))
                throw new IllegalArgumentException("brooklyn.config must be a map of brooklyn config keys");
            brooklynConfig.putAll((Map<?,?>)origBrooklynConfig);
        }
        if (!brooklynConfig.isEmpty())
            builder.customAttribute("brooklyn.config", brooklynConfig);
        List<Object> brooklynPolicies = Lists.newArrayList();
        Object origBrooklynPolicies = attrs.remove("brooklyn.policies");
        if (origBrooklynPolicies != null) {
            if (!(origBrooklynPolicies instanceof List))
                throw new IllegalArgumentException("brooklyn.policies must be a list of brooklyn policy definitions");
            brooklynPolicies.addAll((List<?>)origBrooklynPolicies);
        }
        if (!brooklynPolicies.isEmpty())
            builder.customAttribute("brooklyn.policies", brooklynPolicies);
        List<Object> brooklynEnrichers = Lists.newArrayList();
        Object origBrooklynEnrichers = attrs.remove("brooklyn.enrichers");
        if (origBrooklynEnrichers != null) {
            if (!(origBrooklynEnrichers instanceof List))
                throw new IllegalArgumentException("brooklyn.enrichers must be a list of brooklyn enricher definitions");
            brooklynEnrichers.addAll((List<?>)origBrooklynEnrichers);
        }
        if (!brooklynEnrichers.isEmpty())
            builder.customAttribute("brooklyn.enrichers", brooklynEnrichers);
        List<Object> brooklynChildren = Lists.newArrayList();
        Object origBrooklynChildren = attrs.remove("brooklyn.children");
        if (origBrooklynChildren != null) {
            if (!(origBrooklynChildren instanceof List))
                throw new IllegalArgumentException("brooklyn.children must be a list of brooklyn entity definitions");
            brooklynChildren.addAll((List<?>)origBrooklynChildren);
        }
        if (!brooklynChildren.isEmpty())
            builder.customAttribute("brooklyn.children",  brooklynChildren);
        if (!attrs.isEmpty()) {
            log.warn("Ignoring PDP attributes on "+deploymentPlanItem+": "+attrs);
        }
        atc.add(builder.build());
        return true;
    }


Input:
    private ClipperTrip[] parseTrips (DesfireCard card)
    {
        DesfireFile file = card.getApplication(0x9011f2).getFile(0x0e);
        byte [] data = file.getData();
        int pos = data.length - RECORD_LENGTH;
        List<ClipperTrip> result = new ArrayList<ClipperTrip>();
        while (pos > 0) {
            byte[] slice = Utils.byteArraySlice(data, pos, RECORD_LENGTH);
            final ClipperTrip trip = createTrip(slice);
            if (trip != null) {
                ClipperTrip existingTrip = Utils.findInList(result, new Utils.Matcher<ClipperTrip>() {
                    @Override
                    public boolean matches(ClipperTrip otherTrip) {
                        return trip.getTimestamp() == otherTrip.getTimestamp();
                    }
                });
                if (existingTrip != null) {
                    if (existingTrip.getExitTimestamp() != 0) {
                        continue;
                    } else {
                        result.remove(existingTrip);
                    }
                }
                result.add(trip);
            }
            pos -= RECORD_LENGTH;
        }
        ClipperTrip[] useLog = new ClipperTrip[result.size()];
        result.toArray(useLog);
        Arrays.sort(useLog, new Trip.Comparator());
        return useLog;
    }

Output:
    private ClipperTrip[] parseTrips (DesfireCard card)
    {
        DesfireFile file = card.getApplication(0x9011f2).getFile(0x0e);
        byte [] data = file.getData();
        int pos = data.length - RECORD_LENGTH;
        List<ClipperTrip> result = new ArrayList<ClipperTrip>();
        while (pos > 0) {
            byte[] slice = Utils.byteArraySlice(data, pos, RECORD_LENGTH);
            final ClipperTrip trip = createTrip(slice);
            if (trip != null) {
                ClipperTrip existingTrip = Utils.findInList(result, new Utils.Matcher<ClipperTrip>() {
                    @Override
                    public boolean matches(ClipperTrip otherTrip) {
                        return trip.getTimestamp() == otherTrip.getTimestamp();
                    }
                });
                if (existingTrip != null) {
                    if (existingTrip.getExitTimestamp() != 0) {
                        pos -= RECORD_LENGTH;
                        continue;
                    } else {
                        result.remove(existingTrip);
                    }
                }
                result.add(trip);
            }
            pos -= RECORD_LENGTH;
        }
        ClipperTrip[] useLog = new ClipperTrip[result.size()];
        result.toArray(useLog);
        Arrays.sort(useLog, new Trip.Comparator());
        return useLog;
    }


Input:
	public void testDeg() throws Exception {
		final JsclMathEngine mathEngine = JsclMathEngine.instance;
		Assert.assertEquals("2.0", mathEngine.evaluate("deg(0.03490658503988659)"));
		Assert.assertEquals("-2.0", mathEngine.evaluate("deg(-0.03490658503988659)"));
		Assert.assertEquals("π", mathEngine.evaluate("deg(" + String.valueOf(Math.PI) + ")"));
		for (int i = 0; i < 1000; i++) {
			double value = Math.random() * 100000;
			assertEquals(value, Double.valueOf(mathEngine.evaluate("rad(deg(" + value + "))")));
			assertEquals(value, Double.valueOf(mathEngine.evaluate("deg(rad(" + value + "))")));
		}
	}

Output:
	public void testDeg() throws Exception {
		final JsclMathEngine mathEngine = JsclMathEngine.instance;
		Assert.assertEquals("2.0", mathEngine.evaluate("deg(0.03490658503988659)"));
		Assert.assertEquals("-2.0", mathEngine.evaluate("deg(-0.03490658503988659)"));
		Assert.assertEquals("180.0", mathEngine.evaluate("deg(" + String.valueOf(Math.PI) + ")"));
		for (int i = 0; i < 1000; i++) {
			double value = Math.random() * 100000;
			assertEquals(value, Double.valueOf(mathEngine.evaluate("rad(deg(" + value + "))")));
			assertEquals(value, Double.valueOf(mathEngine.evaluate("deg(rad(" + value + "))")));
		}
	}


Input:
	private JSONObject processElement(CRResolvableBean crBean) {
		JSONObject objElement = new JSONObject();
		objElement.element("contentid", "" + crBean.getContentid());
		objElement.element("obj_id", "" + crBean.getObj_id());
		objElement.element("obj_type", "" + crBean.getObj_type());
		objElement.element("mother_id",
				((crBean.getMother_id() == null) ? "" : ""
						+ crBean.getMother_id()));
		objElement.element("mother_type",
				((crBean.getMother_type() == null) ? "" : ""
						+ crBean.getMother_type()));
		if (crBean.getAttrMap() != null && (!crBean.getAttrMap().isEmpty())) {
			JSONObject attrContainer = new JSONObject();
			Iterator<String> bit = crBean.getAttrMap().keySet().iterator();
			while (bit.hasNext()) {
				String entry = bit.next();
				Object bValue=crBean.getAttrMap().get(entry);
				if(bValue!=null)
				{
					if((!entry.equals("binarycontent")) &&(bValue.getClass().isArray()||bValue.getClass()==ArrayList.class))
					{
						JSONArray value = new JSONArray();
						ArrayList<Object> arr;
						if(bValue.getClass()==ArrayList.class)
							arr=(ArrayList<Object>)bValue;
						else
						{
							arr=new ArrayList<Object>();
							Object[] ob_arr = (Object[])bValue;
							for(int i=0;i<ob_arr.length;i++ )
								arr.add(ob_arr[i]);
						}
						value.addAll(arr);
						attrContainer.element(entry, value);
					}
					else
					{
						String value="";
						if(entry.equals("binarycontent"))
						{
							byte[] bs = (byte[])bValue;
							value=new String(bs);
						}
						else
						{
							if(bValue.getClass()==String.class)
							{
								value=(String)bValue;
							}
							else
							{
								try {
									value = new String(getBytes(bValue));
								} catch (IOException e) {
									e.printStackTrace();
								}
							}
						}
						attrContainer.element(entry, value);
					}
				}
			}
			objElement.element("attributes",attrContainer);
		}
		if(crBean.getChildRepository() != null && crBean.getChildRepository().size()>0)
		{
			JSONArray childContainer = new JSONArray();
			for (Iterator it = crBean.getChildRepository().iterator(); it.hasNext();) {
				CRResolvableBean chBean = (CRResolvableBean) it.next();
				JSONObject chElement = processElement(chBean);
				childContainer.add(chElement);
			}
			objElement.element("children",childContainer);
		}
		return objElement;
	}

Output:
	private JSONObject processElement(CRResolvableBean crBean) {
		JSONObject objElement = new JSONObject();
		objElement.element("contentid", "" + crBean.getContentid());
		objElement.element("obj_id", "" + crBean.getObj_id());
		objElement.element("obj_type", "" + crBean.getObj_type());
		objElement.element("mother_id",
				((crBean.getMother_id() == null) ? "" : ""
						+ crBean.getMother_id()));
		objElement.element("mother_type",
				((crBean.getMother_type() == null) ? "" : ""
						+ crBean.getMother_type()));
		if (crBean.getAttrMap() != null && (!crBean.getAttrMap().isEmpty())) {
			JSONObject attrContainer = new JSONObject();
			Iterator<String> bit = crBean.getAttrMap().keySet().iterator();
			while (bit.hasNext()) {
				String entry = bit.next();
				Object bValue=crBean.getAttrMap().get(entry);
				if(bValue!=null)
				{
					if((!entry.equals("binarycontent")) &&(bValue.getClass().isArray()||bValue.getClass()==ArrayList.class))
					{
						JSONArray value = new JSONArray();
						ArrayList<Object> arr;
						if(bValue.getClass()==ArrayList.class)
							arr=(ArrayList<Object>)bValue;
						else
						{
							arr=new ArrayList<Object>();
							Object[] ob_arr = (Object[])bValue;
							for(int i=0;i<ob_arr.length;i++ )
								arr.add(ob_arr[i]);
						}
						value.addAll(arr);
						attrContainer.element(entry, value);
					}
					else
					{
						String value="";
						if(entry.equals("binarycontent"))
						{
							byte[] bs = (byte[])bValue;
							value=new String(bs);
						}
						else
						{
							if(bValue.getClass()==String.class)
							{
								value=(String)bValue;
							} else if (bValue instanceof Number) {
								value = bValue.toString();
							} else {
								try {
									value = new String(getBytes(bValue));
								} catch (IOException e) {
									e.printStackTrace();
								}
							}
						}
						attrContainer.element(entry, value);
					}
				}
			}
			objElement.element("attributes",attrContainer);
		}
		if(crBean.getChildRepository() != null && crBean.getChildRepository().size()>0)
		{
			JSONArray childContainer = new JSONArray();
			for (Iterator it = crBean.getChildRepository().iterator(); it.hasNext();) {
				CRResolvableBean chBean = (CRResolvableBean) it.next();
				JSONObject chElement = processElement(chBean);
				childContainer.add(chElement);
			}
			objElement.element("children",childContainer);
		}
		return objElement;
	}


Input:
    public void Delete() {
        if (mEngine.id == null) {
            DataProvider.deleteSearchEngine(getActivity(), getData());
            return;
        }
        DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == DialogInterface.BUTTON_POSITIVE) {
                    DataProvider.deleteSearchEngine(getActivity(), getData());
                    if (mDetailController != null) {
                        final DetailController detailController = mDetailController.get();
                        if (detailController != null) {
                            detailController.OnDetailFinish(MODE_DELETE, mEngine);
                        }
                    }
                }
            }
        };
        new AlertDialog.Builder(getActivity())
            .setTitle(R.string.dialog_confirmation)
            .setMessage(R.string.confirmation_delete)
            .setCancelable(true)
            .setNegativeButton(R.string.no, click)
            .setPositiveButton(R.string.yes, click)
            .show();
    }

Output:
    public void Delete() {
        if (mEngine.id == null) {
            if (mDetailController != null) {
                final DetailController detailController = mDetailController.get();
                if (detailController != null) {
                    detailController.OnDetailFinish(MODE_DELETE, mEngine);
                }
            }
            return;
        }
        DialogInterface.OnClickListener click = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                if (i == DialogInterface.BUTTON_POSITIVE) {
                    DataProvider.deleteSearchEngine(getActivity(), getData());
                    if (mDetailController != null) {
                        final DetailController detailController = mDetailController.get();
                        if (detailController != null) {
                            detailController.OnDetailFinish(MODE_DELETE, mEngine);
                        }
                    }
                }
            }
        };
        new AlertDialog.Builder(getActivity())
            .setTitle(R.string.dialog_confirmation)
            .setMessage(R.string.confirmation_delete)
            .setCancelable(true)
            .setNegativeButton(R.string.no, click)
            .setPositiveButton(R.string.yes, click)
            .show();
    }


Input:
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    Configuration conf = context.getConfiguration();
    try {
      ClassLoader ccl = Thread.currentThread().getContextClassLoader();
      DistanceMeasure measure = ccl.loadClass(conf.get(KMeansConfigKeys.DISTANCE_MEASURE_KEY))
          .asSubclass(DistanceMeasure.class).newInstance();
      measure.configure(conf);
      String clusterPath = conf.get(KMeansConfigKeys.CLUSTER_PATH_KEY);
      if ((clusterPath != null) && (clusterPath.length() > 0)) {
        KMeansUtil.configureWithClusterInfo(new Path(clusterPath), clusters);
        if (clusters.isEmpty()) {
          throw new IllegalStateException("Cluster is empty!");
        }
      }
      this.clusterer = new KMeansClusterer(measure);
    } catch (ClassNotFoundException e) {
      throw new IllegalStateException(e);
    } catch (IllegalAccessException e) {
      throw new IllegalStateException(e);
    } catch (InstantiationException e) {
      throw new IllegalStateException(e);
    }
  }

Output:
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    Configuration conf = context.getConfiguration();
    try {
      ClassLoader ccl = Thread.currentThread().getContextClassLoader();
      DistanceMeasure measure = ccl.loadClass(conf.get(KMeansConfigKeys.DISTANCE_MEASURE_KEY))
          .asSubclass(DistanceMeasure.class).newInstance();
      measure.configure(conf);
      String clusterPath = conf.get(KMeansConfigKeys.CLUSTER_PATH_KEY);
      if ((clusterPath != null) && (clusterPath.length() > 0)) {
        KMeansUtil.configureWithClusterInfo(new Path(clusterPath), clusters);
        if (clusters.isEmpty()) {
          throw new IllegalStateException("No clusters found. Check your -c path.");
        }
      }
      this.clusterer = new KMeansClusterer(measure);
    } catch (ClassNotFoundException e) {
      throw new IllegalStateException(e);
    } catch (IllegalAccessException e) {
      throw new IllegalStateException(e);
    } catch (InstantiationException e) {
      throw new IllegalStateException(e);
    }
  }


Input:
    private static NodeList selectNodeList(Element documentElement, String string) {
        NodeList result = null;
        ArrayList<Node> input = new ArrayList<Node>();
        String[] path = string.split("/");
        NodeList childNodes = documentElement.getChildNodes();
        if(path[0].equals("entry") || path[0].equals("node")) {
            for(int i = 0; i < childNodes.getLength(); i++) {
                Object next = childNodes.item(i);
                if(next instanceof Element) {
                    if(((Element) next).getNodeName().equals(path[0])
                            && next instanceof Node) {
                        input.add((Node)next);
                    }
                }
            }
        } else if(path[0].equals("map") && path[1].equals("entry")) {
            for(int i = 0; i < childNodes.getLength(); i++) {
                Object next = childNodes.item(i);
                if(next instanceof Element) {
                    if(((Element) next).getNodeName().equals(path[0])
                            && next instanceof Node) {
                        NodeList nextChildNodes = ((Node)next).getChildNodes();
                        for(int j = 0; j < nextChildNodes.getLength(); j++) {
                            Object subnext = nextChildNodes.item(j);
                            if(subnext instanceof Element) {
                                if(((Element)subnext).getNodeName().equals(path[1])) {
                                    input.add((Node)subnext);
                                }
                            }
                        }
                    }
                }
            }
        }
        result = new NodeSet(input.iterator());
        return result;
    }

Output:
    private static NodeList selectNodeList(Element documentElement, String string) {
        NodeList result = null;
        ArrayList<Node> input = new ArrayList<Node>();
        String[] path = string.split("/");
        NodeList childNodes = documentElement.getChildNodes();
        if(path[0].equals("entry") || path[0].equals("node")) {
            for(int i = 0; i < childNodes.getLength(); i++) {
                Object next = childNodes.item(i);
                if(next instanceof Element) {
                    if(((Element) next).getNodeName().equals(path[0])) {
                        input.add((Node)next);
                    }
                }
            }
        } else if(path[0].equals("map") && path[1].equals("entry")) {
            for(int i = 0; i < childNodes.getLength(); i++) {
                Object next = childNodes.item(i);
                if(next instanceof Element) {
                    if(((Element) next).getNodeName().equals(path[0])
                            && next instanceof Node) {
                        NodeList nextChildNodes = ((Node)next).getChildNodes();
                        for(int j = 0; j < nextChildNodes.getLength(); j++) {
                            Object subnext = nextChildNodes.item(j);
                            if(subnext instanceof Element) {
                                if(((Element)subnext).getNodeName().equals(path[1])) {
                                    input.add((Node)subnext);
                                }
                            }
                        }
                    }
                }
            }
        }
        result = new NodeSet(input.iterator());
        return result;
    }


Input:
		public int compare(Object o1, Object o2)
		{
			int result = -1;
			if (m_criteria.equals(SORTED_BY_DEFAULT))
			{
				int s1 = ((Assignment) o1).getPosition_order();
				int s2 = ((Assignment) o2).getPosition_order();
				if ( s1 == s2 )
				{
					Time t1 = ((Assignment) o1).getDueTime();
					Time t2 = ((Assignment) o2).getDueTime();
					if (t1 == null)
					{
						result = -1;
					}
					else if (t2 == null)
					{
						result = 1;
					}
					else if (t1.before(t2))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
				else if ( s1 == 0 && s2 > 0 )
				{
					result = 1;
				}
				else if ( s2 == 0 && s1 > 0 )
				{
					result = -1;
				}
				else
				{
					result = (s1 < s2) ? -1 : 1;
				}
			}
			if (m_criteria.equals(SORTED_BY_TITLE))
			{
				String s1 = ((Assignment) o1).getTitle();
				String s2 = ((Assignment) o2).getTitle();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_SECTION))
			{
				String s1 = ((Assignment) o1).getSection();
				String s2 = ((Assignment) o2).getSection();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_DUEDATE))
			{
				Time t1 = ((Assignment) o1).getDueTime();
				Time t2 = ((Assignment) o2).getDueTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_OPENDATE))
			{
				Time t1 = ((Assignment) o1).getOpenTime();
				Time t2 = ((Assignment) o2).getOpenTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_ASSIGNMENT_STATUS))
			{
				String s1 = getAssignmentStatus((Assignment) o1);
				String s2 = getAssignmentStatus((Assignment) o2);
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_NUM_SUBMISSIONS))
			{
				int subNum1 = 0;
				int subNum2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted()) subNum1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted()) subNum2++;
				}
				result = (subNum1 > subNum2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_NUM_UNGRADED))
			{
				int ungraded1 = 0;
				int ungraded2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted() && !submission1.getGraded()) ungraded1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted() && !submission2.getGraded()) ungraded2++;
				}
				result = (ungraded1 > ungraded2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_SUBMISSION_STATUS))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String status1 = getSubmissionStatus(submission1, (Assignment) o1);
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String status2 = getSubmissionStatus(submission2, (Assignment) o2);
					result = status1.compareTo(status2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_GRADE))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String grade1 = " ";
					if (submission1 != null && submission1.getGraded() && submission1.getGradeReleased())
					{
						grade1 = submission1.getGrade();
					}
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String grade2 = " ";
					if (submission2 != null && submission2.getGraded() && submission2.getGradeReleased())
					{
						grade2 = submission2.getGrade();
					}
					result = grade1.compareTo(grade2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_MAX_GRADE))
			{
				String maxGrade1 = maxGrade(((Assignment) o1).getContent().getTypeOfGrade(), (Assignment) o1);
				String maxGrade2 = maxGrade(((Assignment) o2).getContent().getTypeOfGrade(), (Assignment) o2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_BY_FOR))
			{
				String factor1 = getAssignmentRange((Assignment) o1);
				String factor2 = getAssignmentRange((Assignment) o2);
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_TITLE))
			{
				String factor1 = ((Group) o1).getTitle();
				String factor2 = ((Group) o2).getTitle();
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_DESCRIPTION))
			{
				String factor1 = ((Group) o1).getDescription();
				String factor2 = ((Group) o2).getDescription();
				if (factor1 == null)
				{
					factor1 = "";
				}
				if (factor2 == null)
				{
					factor2 = "";
				}
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_LASTNAME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null || u1.getUser() == null || u2.getUser() == null )
				{
					result = 1;
				}
				else
				{
					String lName1 = u1.getUser().getLastName();
					String lName2 = u2.getUser().getLastName();
					result = lName1.toLowerCase().compareTo(lName2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_SUBMIT_TIME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null || s1.getTimeSubmitted() == null)
					{
						result = -1;
					}
					else if (s2 == null || s2.getTimeSubmitted() == null)
					{
						result = 1;
					}
					else if (s1.getTimeSubmitted().before(s2.getTimeSubmitted()))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_STATUS))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				String status1 = "";
				String status2 = "";
				if (u1 == null)
				{
					status1 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					if (s1 == null)
					{
						status1 = rb.getString("listsub.nosub");
					}
					else
					{
						status1 = getSubmissionStatus(m_state, (AssignmentSubmission) s1);
					}
				}
				if (u2 == null)
				{
					status2 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s2 = u2.getSubmission();
					if (s2 == null)
					{
						status2 = rb.getString("listsub.nosub");
					}
					else
					{
						status2 = getSubmissionStatus(m_state, (AssignmentSubmission) s2);
					}
				}
				result = status1.toLowerCase().compareTo(status2.toLowerCase());
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_GRADE))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String grade1 = s1.getGrade();
						String grade2 = s2.getGrade();
						if (grade1 == null)
						{
							grade1 = "";
						}
						if (grade2 == null)
						{
							grade2 = "";
						}
						if ((s1.getAssignment().getContent().getTypeOfGrade() == 3)
								&& ((s2.getAssignment().getContent().getTypeOfGrade() == 3)))
						{
							if (grade1.equals(""))
							{
								result = -1;
							}
							else if (grade2.equals(""))
							{
								result = 1;
							}
							else
							{
								result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
							}
						}
						else
						{
							result = grade1.compareTo(grade2);
						}
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_RELEASED))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String released1 = (new Boolean(s1.getGradeReleased())).toString();
						String released2 = (new Boolean(s2.getGradeReleased())).toString();
						result = released1.compareTo(released2);
					}
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME))
			{
				User[] u1 = ((AssignmentSubmission) o1).getSubmitters();
				User[] u2 = ((AssignmentSubmission) o2).getSubmitters();
				if (u1 == null || u2 == null)
				{
					return 1;
				}
				else
				{
					String submitters1 = "";
					String submitters2 = "";
					for (int j = 0; j < u1.length; j++)
					{
						if (u1[j] != null && u1[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters1 = submitters1.concat("; ");
							}
							submitters1 = submitters1.concat("" + u1[j].getLastName());
						}
					}
					for (int j = 0; j < u2.length; j++)
					{
						if (u2[j] != null && u2[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters2 = submitters2.concat("; ");
							}
							submitters2 = submitters2.concat(u2[j].getLastName());
						}
					}
					result = submitters1.toLowerCase().compareTo(submitters2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_SUBMIT_TIME))
			{
				Time t1 = ((AssignmentSubmission) o1).getTimeSubmitted();
				Time t2 = ((AssignmentSubmission) o2).getTimeSubmitted();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_STATUS))
			{
				String status1 = getSubmissionStatus(m_state, (AssignmentSubmission) o1);
				String status2 = getSubmissionStatus(m_state, (AssignmentSubmission) o2);
				result = status1.compareTo(status2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_MAX_GRADE))
			{
				Assignment a1 = ((AssignmentSubmission) o1).getAssignment();
				Assignment a2 = ((AssignmentSubmission) o2).getAssignment();
				String maxGrade1 = maxGrade(a1.getContent().getTypeOfGrade(), a1);
				String maxGrade2 = maxGrade(a2.getContent().getTypeOfGrade(), a2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_RELEASED))
			{
				String released1 = (new Boolean(((AssignmentSubmission) o1).getGradeReleased())).toString();
				String released2 = (new Boolean(((AssignmentSubmission) o2).getGradeReleased())).toString();
				result = released1.compareTo(released2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_ASSIGNMENT))
			{
				String title1 = ((AssignmentSubmission) o1).getAssignment().getContent().getTitle();
				String title2 = ((AssignmentSubmission) o2).getAssignment().getContent().getTitle();
				result = title1.toLowerCase().compareTo(title2.toLowerCase());
			}
			if (m_asc.equals(Boolean.FALSE.toString()))
			{
				result = -result;
			}
			return result;
		}

Output:
		public int compare(Object o1, Object o2)
		{
			int result = -1;
			if (m_criteria.equals(SORTED_BY_DEFAULT))
			{
				int s1 = ((Assignment) o1).getPosition_order();
				int s2 = ((Assignment) o2).getPosition_order();
				if ( s1 == s2 )
				{
					Time t1 = ((Assignment) o1).getDueTime();
					Time t2 = ((Assignment) o2).getDueTime();
					if (t1 == null)
					{
						result = -1;
					}
					else if (t2 == null)
					{
						result = 1;
					}
					else if (t1.before(t2))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
				else if ( s1 == 0 && s2 > 0 )
				{
					result = 1;
				}
				else if ( s2 == 0 && s1 > 0 )
				{
					result = -1;
				}
				else
				{
					result = (s1 < s2) ? -1 : 1;
				}
			}
			if (m_criteria.equals(SORTED_BY_TITLE))
			{
				String s1 = ((Assignment) o1).getTitle();
				String s2 = ((Assignment) o2).getTitle();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_SECTION))
			{
				String s1 = ((Assignment) o1).getSection();
				String s2 = ((Assignment) o2).getSection();
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_DUEDATE))
			{
				Time t1 = ((Assignment) o1).getDueTime();
				Time t2 = ((Assignment) o2).getDueTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_OPENDATE))
			{
				Time t1 = ((Assignment) o1).getOpenTime();
				Time t2 = ((Assignment) o2).getOpenTime();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_ASSIGNMENT_STATUS))
			{
				String s1 = getAssignmentStatus((Assignment) o1);
				String s2 = getAssignmentStatus((Assignment) o2);
				result = s1.compareToIgnoreCase(s2);
			}
			else if (m_criteria.equals(SORTED_BY_NUM_SUBMISSIONS))
			{
				int subNum1 = 0;
				int subNum2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted()) subNum1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted()) subNum2++;
				}
				result = (subNum1 > subNum2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_NUM_UNGRADED))
			{
				int ungraded1 = 0;
				int ungraded2 = 0;
				Iterator submissions1 = AssignmentService.getSubmissions((Assignment) o1);
				while (submissions1.hasNext())
				{
					AssignmentSubmission submission1 = (AssignmentSubmission) submissions1.next();
					if (submission1.getSubmitted() && !submission1.getGraded()) ungraded1++;
				}
				Iterator submissions2 = AssignmentService.getSubmissions((Assignment) o2);
				while (submissions2.hasNext())
				{
					AssignmentSubmission submission2 = (AssignmentSubmission) submissions2.next();
					if (submission2.getSubmitted() && !submission2.getGraded()) ungraded2++;
				}
				result = (ungraded1 > ungraded2) ? 1 : -1;
			}
			else if (m_criteria.equals(SORTED_BY_SUBMISSION_STATUS))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String status1 = getSubmissionStatus(submission1, (Assignment) o1);
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String status2 = getSubmissionStatus(submission2, (Assignment) o2);
					result = status1.compareTo(status2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_GRADE))
			{
				try
				{
					AssignmentSubmission submission1 = AssignmentService.getSubmission(((Assignment) o1).getId(), m_user);
					String grade1 = " ";
					if (submission1 != null && submission1.getGraded() && submission1.getGradeReleased())
					{
						grade1 = submission1.getGrade();
					}
					AssignmentSubmission submission2 = AssignmentService.getSubmission(((Assignment) o2).getId(), m_user);
					String grade2 = " ";
					if (submission2 != null && submission2.getGraded() && submission2.getGradeReleased())
					{
						grade2 = submission2.getGrade();
					}
					result = grade1.compareTo(grade2);
				}
				catch (IdUnusedException e)
				{
					return 1;
				}
				catch (PermissionException e)
				{
					return 1;
				}
			}
			else if (m_criteria.equals(SORTED_BY_MAX_GRADE))
			{
				String maxGrade1 = maxGrade(((Assignment) o1).getContent().getTypeOfGrade(), (Assignment) o1);
				String maxGrade2 = maxGrade(((Assignment) o2).getContent().getTypeOfGrade(), (Assignment) o2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_BY_FOR))
			{
				String factor1 = getAssignmentRange((Assignment) o1);
				String factor2 = getAssignmentRange((Assignment) o2);
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_TITLE))
			{
				String factor1 = ((Group) o1).getTitle();
				String factor2 = ((Group) o2).getTitle();
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_BY_GROUP_DESCRIPTION))
			{
				String factor1 = ((Group) o1).getDescription();
				String factor2 = ((Group) o2).getDescription();
				if (factor1 == null)
				{
					factor1 = "";
				}
				if (factor2 == null)
				{
					factor2 = "";
				}
				result = factor1.compareToIgnoreCase(factor2);
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_LASTNAME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null || u1.getUser() == null || u2.getUser() == null )
				{
					result = 1;
				}
				else
				{
					String lName1 = u1.getUser().getSortName();
					String lName2 = u2.getUser().getSortName();
					result = lName1.toLowerCase().compareTo(lName2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_SUBMIT_TIME))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null || s1.getTimeSubmitted() == null)
					{
						result = -1;
					}
					else if (s2 == null || s2.getTimeSubmitted() == null)
					{
						result = 1;
					}
					else if (s1.getTimeSubmitted().before(s2.getTimeSubmitted()))
					{
						result = -1;
					}
					else
					{
						result = 1;
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_STATUS))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				String status1 = "";
				String status2 = "";
				if (u1 == null)
				{
					status1 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					if (s1 == null)
					{
						status1 = rb.getString("listsub.nosub");
					}
					else
					{
						status1 = getSubmissionStatus(m_state, (AssignmentSubmission) s1);
					}
				}
				if (u2 == null)
				{
					status2 = rb.getString("listsub.nosub");
				}
				else
				{
					AssignmentSubmission s2 = u2.getSubmission();
					if (s2 == null)
					{
						status2 = rb.getString("listsub.nosub");
					}
					else
					{
						status2 = getSubmissionStatus(m_state, (AssignmentSubmission) s2);
					}
				}
				result = status1.toLowerCase().compareTo(status2.toLowerCase());
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_GRADE))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String grade1 = s1.getGrade();
						String grade2 = s2.getGrade();
						if (grade1 == null)
						{
							grade1 = "";
						}
						if (grade2 == null)
						{
							grade2 = "";
						}
						if ((s1.getAssignment().getContent().getTypeOfGrade() == 3)
								&& ((s2.getAssignment().getContent().getTypeOfGrade() == 3)))
						{
							if (grade1.equals(""))
							{
								result = -1;
							}
							else if (grade2.equals(""))
							{
								result = 1;
							}
							else
							{
								result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
							}
						}
						else
						{
							result = grade1.compareTo(grade2);
						}
					}
				}
			}
			else if (m_criteria.equals(SORTED_GRADE_SUBMISSION_BY_RELEASED))
			{
				UserSubmission u1 = (UserSubmission) o1;
				UserSubmission u2 = (UserSubmission) o2;
				if (u1 == null || u2 == null)
				{
					result = -1;
				}
				else
				{
					AssignmentSubmission s1 = u1.getSubmission();
					AssignmentSubmission s2 = u2.getSubmission();
					if (s1 == null)
					{
						result = -1;
					}
					else if (s2 == null)
					{
						result = 1;
					}
					else
					{
						String released1 = (new Boolean(s1.getGradeReleased())).toString();
						String released2 = (new Boolean(s2.getGradeReleased())).toString();
						result = released1.compareTo(released2);
					}
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_LASTNAME))
			{
				User[] u1 = ((AssignmentSubmission) o1).getSubmitters();
				User[] u2 = ((AssignmentSubmission) o2).getSubmitters();
				if (u1 == null || u2 == null)
				{
					return 1;
				}
				else
				{
					String submitters1 = "";
					String submitters2 = "";
					for (int j = 0; j < u1.length; j++)
					{
						if (u1[j] != null && u1[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters1 = submitters1.concat("; ");
							}
							submitters1 = submitters1.concat("" + u1[j].getLastName());
						}
					}
					for (int j = 0; j < u2.length; j++)
					{
						if (u2[j] != null && u2[j].getLastName() != null)
						{
							if (j > 0)
							{
								submitters2 = submitters2.concat("; ");
							}
							submitters2 = submitters2.concat(u2[j].getLastName());
						}
					}
					result = submitters1.toLowerCase().compareTo(submitters2.toLowerCase());
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_SUBMIT_TIME))
			{
				Time t1 = ((AssignmentSubmission) o1).getTimeSubmitted();
				Time t2 = ((AssignmentSubmission) o2).getTimeSubmitted();
				if (t1 == null)
				{
					result = -1;
				}
				else if (t2 == null)
				{
					result = 1;
				}
				else if (t1.before(t2))
				{
					result = -1;
				}
				else
				{
					result = 1;
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_STATUS))
			{
				String status1 = getSubmissionStatus(m_state, (AssignmentSubmission) o1);
				String status2 = getSubmissionStatus(m_state, (AssignmentSubmission) o2);
				result = status1.compareTo(status2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_GRADE))
			{
				String grade1 = ((AssignmentSubmission) o1).getGrade();
				String grade2 = ((AssignmentSubmission) o2).getGrade();
				if (grade1 == null)
				{
					grade1 = "";
				}
				if (grade2 == null)
				{
					grade2 = "";
				}
				if ((((AssignmentSubmission) o1).getAssignment().getContent().getTypeOfGrade() == 3)
						&& ((((AssignmentSubmission) o2).getAssignment().getContent().getTypeOfGrade() == 3)))
				{
					if (grade1.equals(""))
					{
						result = -1;
					}
					else if (grade2.equals(""))
					{
						result = 1;
					}
					else
					{
						result = (new Integer(grade1)).intValue() > (new Integer(grade2)).intValue() ? 1 : -1;
					}
				}
				else
				{
					result = grade1.compareTo(grade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_MAX_GRADE))
			{
				Assignment a1 = ((AssignmentSubmission) o1).getAssignment();
				Assignment a2 = ((AssignmentSubmission) o2).getAssignment();
				String maxGrade1 = maxGrade(a1.getContent().getTypeOfGrade(), a1);
				String maxGrade2 = maxGrade(a2.getContent().getTypeOfGrade(), a2);
				try
				{
					int max1 = Integer.parseInt(maxGrade1);
					int max2 = Integer.parseInt(maxGrade2);
					result = (max1 < max2) ? -1 : 1;
				}
				catch (NumberFormatException e)
				{
					result = maxGrade1.compareTo(maxGrade2);
				}
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_RELEASED))
			{
				String released1 = (new Boolean(((AssignmentSubmission) o1).getGradeReleased())).toString();
				String released2 = (new Boolean(((AssignmentSubmission) o2).getGradeReleased())).toString();
				result = released1.compareTo(released2);
			}
			else if (m_criteria.equals(SORTED_SUBMISSION_BY_ASSIGNMENT))
			{
				String title1 = ((AssignmentSubmission) o1).getAssignment().getContent().getTitle();
				String title2 = ((AssignmentSubmission) o2).getAssignment().getContent().getTitle();
				result = title1.toLowerCase().compareTo(title2.toLowerCase());
			}
			if (m_asc.equals(Boolean.FALSE.toString()))
			{
				result = -result;
			}
			return result;
		}


Input:
	public Set<IMove> getPossibleMovesFrom(int square) {
		int type = PieceHelper.pieceType(getFromBoard(square));
		int opp_color = getOpponentsColor();
		List<Integer> squares;
		Set<IMove> moves = new HashSet<IMove>();
		Move move;
		if (type == PieceHelper.BISHOP || type == PieceHelper.QUEEN
				|| type == PieceHelper.ROOK) {
			for (Direction direction : Direction.values()) {
				if (((direction == Direction.NORTH
						|| direction == Direction.EAST
						|| direction == Direction.SOUTH || direction == Direction.WEST) && type == PieceHelper.BISHOP)
						|| ((direction == Direction.NORTHWEST
								|| direction == Direction.NORTHEAST
								|| direction == Direction.SOUTHEAST || direction == Direction.SOUTHWEST) && type == PieceHelper.ROOK)) {
					continue;
				} else {
					squares = SquareHelper.getAllSquaresInDirection(square,
							direction);
					for (Integer new_square : squares) {
						if (getFromBoard(new_square) == 0
								|| PieceHelper
										.pieceColor(getFromBoard(new_square)) == opp_color) {
							move = new Move(square, new_square);
							moves.add(move);
							if (getFromBoard(new_square) != 0
									&& PieceHelper
											.pieceColor(getFromBoard(new_square)) == opp_color)
								break;
						} else
							break;
					}
				}
			}
		}
		if (type == PieceHelper.PAWN) {
			if ((SquareHelper.getRow(square) == 2 && active_color == PieceHelper.WHITE)
					|| (SquareHelper.getRow(square) == 7 && active_color == PieceHelper.BLACK)) {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset);
					moves.add(move);
					if (getFromBoard(square + 2
							* Direction.pawnDirection(active_color).offset) == 0) {
						move = new Move(square, square + 2
								* Direction.pawnDirection(active_color).offset);
						moves.add(move);
					}
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if (getFromBoard(square + direction.offset) != 0
							&& PieceHelper.pieceColor(getFromBoard(square
									+ direction.offset)) == getOpponentsColor()) {
						move = new Move(square, square + direction.offset);
						moves.add(move);
					}
				}
			}
			else if ((SquareHelper.getRow(square) == 7 && active_color == PieceHelper.WHITE)
					|| (SquareHelper.getRow(square) == 2 && active_color == PieceHelper.BLACK)) {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.QUEEN);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.KNIGHT);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.ROOK);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.BISHOP);
					moves.add(move);
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if (getFromBoard(square + direction.offset) != 0
							&& PieceHelper.pieceColor(getFromBoard(square
									+ direction.offset)) == getOpponentsColor()) {
						move = new Move(square, square + direction.offset,
								PieceHelper.QUEEN);
						moves.add(move);
						move = new Move(square, square + direction.offset,
								PieceHelper.KNIGHT);
						moves.add(move);
					}
				}
			}
			else {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset);
					moves.add(move);
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if ((getFromBoard(square + direction.offset) != 0 && PieceHelper
							.pieceColor(getFromBoard(square + direction.offset)) == getOpponentsColor())
							|| getFromBoard(square + direction.offset) == getEnPassant()) {
						move = new Move(square, square + direction.offset);
						moves.add(move);
					}
				}
			}
		}

Output:
	public Set<IMove> getPossibleMovesFrom(int square) {
		int type = PieceHelper.pieceType(getFromBoard(square));
		int opp_color = getOpponentsColor();
		List<Integer> squares;
		Set<IMove> moves = new HashSet<IMove>();
		Move move;
		if (type == PieceHelper.BISHOP || type == PieceHelper.QUEEN
				|| type == PieceHelper.ROOK) {
			for (Direction direction : Direction.values()) {
				if (((direction == Direction.NORTH
						|| direction == Direction.EAST
						|| direction == Direction.SOUTH || direction == Direction.WEST) && type == PieceHelper.BISHOP)
						|| ((direction == Direction.NORTHWEST
								|| direction == Direction.NORTHEAST
								|| direction == Direction.SOUTHEAST || direction == Direction.SOUTHWEST) && type == PieceHelper.ROOK)) {
					continue;
				} else {
					squares = SquareHelper.getAllSquaresInDirection(square,
							direction);
					for (Integer new_square : squares) {
						if (getFromBoard(new_square) == 0
								|| PieceHelper
										.pieceColor(getFromBoard(new_square)) == opp_color) {
							move = new Move(square, new_square);
							moves.add(move);
							if (getFromBoard(new_square) != 0
									&& PieceHelper
											.pieceColor(getFromBoard(new_square)) == opp_color)
								break;
						} else
							break;
					}
				}
			}
		}
		if (type == PieceHelper.PAWN) {
			if ((SquareHelper.getRow(square) == 2 && active_color == PieceHelper.WHITE)
					|| (SquareHelper.getRow(square) == 7 && active_color == PieceHelper.BLACK)) {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset);
					moves.add(move);
					if (getFromBoard(square + 2
							* Direction.pawnDirection(active_color).offset) == 0) {
						move = new Move(square, square + 2
								* Direction.pawnDirection(active_color).offset);
						moves.add(move);
					}
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if (getFromBoard(square + direction.offset) != 0
							&& PieceHelper.pieceColor(getFromBoard(square
									+ direction.offset)) == getOpponentsColor()) {
						move = new Move(square, square + direction.offset);
						moves.add(move);
					}
				}
			}
			else if ((SquareHelper.getRow(square) == 7 && active_color == PieceHelper.WHITE)
					|| (SquareHelper.getRow(square) == 2 && active_color == PieceHelper.BLACK)) {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.QUEEN);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.KNIGHT);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.ROOK);
					moves.add(move);
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset,
							PieceHelper.BISHOP);
					moves.add(move);
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if (getFromBoard(square + direction.offset) != 0
							&& PieceHelper.pieceColor(getFromBoard(square
									+ direction.offset)) == getOpponentsColor()) {
						move = new Move(square, square + direction.offset,
								PieceHelper.QUEEN);
						moves.add(move);
						move = new Move(square, square + direction.offset,
								PieceHelper.KNIGHT);
						moves.add(move);
					}
				}
			}
			else {
				if (getFromBoard(square
						+ Direction.pawnDirection(active_color).offset) == 0) {
					move = new Move(square, square
							+ Direction.pawnDirection(active_color).offset);
					moves.add(move);
				}
				Set<Direction> pawn_capturing_directions = Direction
						.pawnCapturingDirections(active_color);
				for (Direction direction : pawn_capturing_directions) {
					if ((getFromBoard(square + direction.offset) != 0 && PieceHelper
							.pieceColor(getFromBoard(square + direction.offset)) == getOpponentsColor())
							|| square + direction.offset == getEnPassant()) {
						move = new Move(square, square + direction.offset);
						moves.add(move);
					}
				}
			}
		}


Input:
	public WidgetDataEvents addControls(Composite parent,
			final Listener statusListener) {
		Composite configCom = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout(3, false);
		configCom.setLayout(layout);
		configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
		Label lblCustomPakage = new Label(configCom, SWT.NONE);
		lblCustomPakage
				.setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
		final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
		txtCustomPkgName.setText(model.getCustomPackage());
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.horizontalSpan = 2;
		txtCustomPkgName.setLayoutData(gd);
		txtCustomPkgName.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				if (validatePackage(txtCustomPkgName.getText())) {
					model.setCustomPackage(txtCustomPkgName.getText());
				}
				statusListener.handleEvent(null);
			}
		});
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
		final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
		cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
		cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
		if (JBossWSCreationCoreMessages.Value_Target_0
				.equals(model.getTarget())) {
			cbSpec.select(0);
		} else {
			cbSpec.select(1);
		}
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.horizontalSpan = 2;
		cbSpec.setLayoutData(gd);
		cbSpec.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				model.setTarget(cbSpec.getText());
			}
		});
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_Catalog_File);
		final Text txtCatlog = new Text(configCom, SWT.BORDER);
		txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		Button btnCatlog = new Button(configCom, SWT.NONE);
		btnCatlog
				.setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
		btnCatlog.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String fileLocation = new FileDialog(Display.getCurrent()
						.getActiveShell(), SWT.NONE).open();
				txtCatlog.setText(fileLocation);
				model.setCatalog(fileLocation);
			}
		});
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_Binding_File);
		final List bindingList = new List(configCom, SWT.BORDER
				| SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
		gd.verticalSpan = 3;
		bindingList.setLayoutData(gd);
		loadBindingFiles(bindingList);
		bindingList.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				if (bindingList.getSelectionIndex() >= 0) {
					btnRemove.setEnabled(true);
				} else {
					btnRemove.setEnabled(false);
				}
			}
		});
		Button btnSelect = new Button(configCom, SWT.NONE);
		btnSelect
				.setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
		btnSelect.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String fileLocation = new FileDialog(Display.getCurrent()
						.getActiveShell(), SWT.NONE).open();
				if (fileLocation != null
						&& !model.getBindingFiles().contains(fileLocation)) {
					bindingList.add(fileLocation);
					model.addBindingFile(fileLocation);
				}
			}
		});
		new Label(configCom, SWT.NONE);
		btnRemove = new Button(configCom, SWT.NONE);
		btnRemove.setEnabled(false);
		btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
		btnRemove.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				model.getBindingFiles().remove(bindingList.getSelectionIndex());
				bindingList.remove(bindingList.getSelectionIndex());
				if (bindingList.getSelectionIndex() == -1) {
					btnRemove.setEnabled(false);
				}
			}
		});
		btnExtension = new Button(configCom, SWT.CHECK);
		gd = new GridData();
		gd.horizontalSpan = 3;
		btnExtension.setLayoutData(gd);
		btnExtension
				.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
		btnExtension.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				model.setEnableSOAP12(btnExtension.getSelection());
			}
		});
		if (model.getWsScenario() != WebServiceScenario.CLIENT) {
			btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
			gd = new GridData();
			gd.horizontalSpan = 3;
			btnGenDefaultImpl.setLayoutData(gd);
			btnGenDefaultImpl
					.setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
			btnGenDefaultImpl.setSelection(true);
			btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					model.setGenerateImplementatoin(btnGenDefaultImpl
							.getSelection());
					btnUpdateWebxml
							.setEnabled(btnGenDefaultImpl.getSelection());
					if (!btnGenDefaultImpl.getSelection()) {
						model.setUpdateWebxml(false);
					} else {
						model.setUpdateWebxml(btnUpdateWebxml.getSelection());
					}
				}
			});
			btnUpdateWebxml = new Button(configCom, SWT.CHECK);
			gd = new GridData();
			gd.horizontalSpan = 3;
			btnUpdateWebxml.setLayoutData(gd);
			btnUpdateWebxml
					.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
			btnUpdateWebxml.setSelection(true);
			btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					model.setUpdateWebxml(btnUpdateWebxml.getSelection());
				}
			});
		}
		updateExtensionButtonStatus();
		return this;
	}

Output:
	public WidgetDataEvents addControls(Composite parent,
			final Listener statusListener) {
		Composite configCom = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout(3, false);
		configCom.setLayout(layout);
		configCom.setLayoutData(new GridData(GridData.FILL_BOTH));
		Label lblCustomPakage = new Label(configCom, SWT.NONE);
		lblCustomPakage
				.setText(JBossWSCreationCoreMessages.Label_Custom_Package_Name);
		final Text txtCustomPkgName = new Text(configCom, SWT.BORDER);
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.horizontalSpan = 2;
		txtCustomPkgName.setLayoutData(gd);
		txtCustomPkgName.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				if (validatePackage(txtCustomPkgName.getText())) {
					model.setCustomPackage(txtCustomPkgName.getText());
				}
				statusListener.handleEvent(null);
			}
		});
		txtCustomPkgName.setText(model.getCustomPackage());
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_JaxWS_Target);
		final Combo cbSpec = new Combo(configCom, SWT.BORDER | SWT.READ_ONLY);
		cbSpec.add(JBossWSCreationCoreMessages.Value_Target_0, 0);
		cbSpec.add(JBossWSCreationCoreMessages.Value_Target_1, 1);
		if (JBossWSCreationCoreMessages.Value_Target_0
				.equals(model.getTarget())) {
			cbSpec.select(0);
		} else {
			cbSpec.select(1);
		}
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.horizontalSpan = 2;
		cbSpec.setLayoutData(gd);
		cbSpec.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				model.setTarget(cbSpec.getText());
			}
		});
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_Catalog_File);
		final Text txtCatlog = new Text(configCom, SWT.BORDER);
		txtCatlog.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		Button btnCatlog = new Button(configCom, SWT.NONE);
		btnCatlog
				.setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
		btnCatlog.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String fileLocation = new FileDialog(Display.getCurrent()
						.getActiveShell(), SWT.NONE).open();
				txtCatlog.setText(fileLocation);
				model.setCatalog(fileLocation);
			}
		});
		new Label(configCom, SWT.NONE)
				.setText(JBossWSCreationCoreMessages.Label_Binding_File);
		final List bindingList = new List(configCom, SWT.BORDER
				| SWT.SCROLL_LINE | SWT.V_SCROLL | SWT.H_SCROLL);
		gd = new GridData(GridData.FILL_HORIZONTAL);
		gd.heightHint = Display.getCurrent().getActiveShell().getBounds().height / 4;
		gd.verticalSpan = 3;
		bindingList.setLayoutData(gd);
		loadBindingFiles(bindingList);
		bindingList.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				if (bindingList.getSelectionIndex() >= 0) {
					btnRemove.setEnabled(true);
				} else {
					btnRemove.setEnabled(false);
				}
			}
		});
		Button btnSelect = new Button(configCom, SWT.NONE);
		btnSelect
				.setText(JBossWSCreationCoreMessages.Label_Button_Text_Seletion);
		btnSelect.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				String fileLocation = new FileDialog(Display.getCurrent()
						.getActiveShell(), SWT.NONE).open();
				if (fileLocation != null
						&& !model.getBindingFiles().contains(fileLocation)) {
					bindingList.add(fileLocation);
					model.addBindingFile(fileLocation);
				}
			}
		});
		new Label(configCom, SWT.NONE);
		btnRemove = new Button(configCom, SWT.NONE);
		btnRemove.setEnabled(false);
		btnRemove.setText(JBossWSCreationCoreMessages.Label_Button_Text_Remove);
		btnRemove.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				model.getBindingFiles().remove(bindingList.getSelectionIndex());
				bindingList.remove(bindingList.getSelectionIndex());
				if (bindingList.getSelectionIndex() == -1) {
					btnRemove.setEnabled(false);
				}
			}
		});
		btnExtension = new Button(configCom, SWT.CHECK);
		gd = new GridData();
		gd.horizontalSpan = 3;
		btnExtension.setLayoutData(gd);
		btnExtension
				.setText(JBossWSCreationCoreMessages.Label_EnableSOAP12_Binding_Extension);
		btnExtension.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				model.setEnableSOAP12(btnExtension.getSelection());
			}
		});
		if (model.getWsScenario() != WebServiceScenario.CLIENT) {
			btnGenDefaultImpl = new Button(configCom, SWT.CHECK);
			gd = new GridData();
			gd.horizontalSpan = 3;
			btnGenDefaultImpl.setLayoutData(gd);
			btnGenDefaultImpl
					.setText(JBossWSCreationCoreMessages.Label_Generate_Impelemtation);
			btnGenDefaultImpl.setSelection(true);
			btnGenDefaultImpl.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					model.setGenerateImplementatoin(btnGenDefaultImpl
							.getSelection());
					btnUpdateWebxml
							.setEnabled(btnGenDefaultImpl.getSelection());
					if (!btnGenDefaultImpl.getSelection()) {
						model.setUpdateWebxml(false);
					} else {
						model.setUpdateWebxml(btnUpdateWebxml.getSelection());
					}
				}
			});
			btnUpdateWebxml = new Button(configCom, SWT.CHECK);
			gd = new GridData();
			gd.horizontalSpan = 3;
			btnUpdateWebxml.setLayoutData(gd);
			btnUpdateWebxml
					.setText(JBossWSCreationCoreMessages.Label_Update_Webxml);
			btnUpdateWebxml.setSelection(true);
			btnUpdateWebxml.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent e) {
					model.setUpdateWebxml(btnUpdateWebxml.getSelection());
				}
			});
		}
		updateExtensionButtonStatus();
		return this;
	}


Input:
    protected final void collectOrFireEvents( InputSystem is, EventQueue eventQueue, long nanoTime, boolean acceptEvents ) throws InputSystemException
    {
        final boolean isQueued = ( eventQueue != null );
        if ( !org.lwjgl.opengl.Display.isCreated() )
            throw( new InputSystemException( "Display is not created." ) );
        if ( !org.lwjgl.input.Mouse.isCreated() )
            throw( new InputSystemException( "Mouse is not created." ) );
        try
        {
            LWJGLInputDeviceFactory.processMessages( nanoTime );
            org.lwjgl.input.Mouse.poll();
            while ( org.lwjgl.input.Mouse.next() )
            {
                if ( !acceptEvents )
                    continue;
                final int x = org.lwjgl.input.Mouse.getEventX();
                final int y = getSourceWindow().getHeight() - org.lwjgl.input.Mouse.getEventY();
                final int dx = org.lwjgl.input.Mouse.getEventDX();
                final int dy = -org.lwjgl.input.Mouse.getEventDY();
                final int buttonIdx = org.lwjgl.input.Mouse.getEventButton();
                final boolean buttonState = org.lwjgl.input.Mouse.getEventButtonState();
                final int wheelDelta = org.lwjgl.input.Mouse.getEventDWheel() / 120;
                if ( isAbsolute() )
                    this.storePosition( x, y );
                if ( ( dx != 0 ) || ( dy != 0 ) )
                {
                    final MouseMovedEvent movEv = prepareMouseMovedEvent( getCurrentX(), getCurrentY(), dx, dy, nanoTime );
                    if ( dx != 0 )
                        is.notifyInputStatesManagers( this, getXAxis(), x, dx, nanoTime );
                    if ( dy != 0 )
                        is.notifyInputStatesManagers( this, getYAxis(), y, dy, nanoTime );
                    if ( movEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( movEv );
                    else
                        fireOnMouseMoved( movEv, true );
                }
                if ( buttonIdx != -1 )
                {
                    final MouseButton button = convertButton( buttonIdx );
                    if ( buttonState )
                    {
                        final MouseButtonPressedEvent pressedEv = prepareMouseButtonPressedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 1, +1, nanoTime );
                        if ( pressedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( pressedEv );
                        else
                            fireOnMouseButtonPressed( pressedEv, true );
                    }
                    else
                    {
                        final MouseButtonReleasedEvent releasedEv = prepareMouseButtonReleasedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 0, -1, nanoTime );
                        if ( releasedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( releasedEv );
                        else
                            fireOnMouseButtonReleased( releasedEv, true );
                    }
                }
                if ( wheelDelta != 0 )
                {
                    final MouseWheelEvent wheelEv = prepareMouseWheelMovedEvent( wheelDelta, false, nanoTime );
                    is.notifyInputStatesManagers( this, getWheel(), getWheel().getIntValue(), wheelDelta, nanoTime );
                    if ( wheelEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( wheelEv );
                    else
                        fireOnMouseWheelMoved( wheelEv, true );
                }
            }
        }
        catch ( Throwable t )
        {
            if ( t instanceof InputSystemException )
                throw( (InputSystemException)t );
            if ( t instanceof Error )
                throw( (Error)t );
            if ( t instanceof RuntimeException )
                throw( (RuntimeException)t );
            throw( new InputSystemException( t ) );
        }
    }

Output:
    protected final void collectOrFireEvents( InputSystem is, EventQueue eventQueue, long nanoTime, boolean acceptEvents ) throws InputSystemException
    {
        final boolean isQueued = ( eventQueue != null );
        if ( !org.lwjgl.opengl.Display.isCreated() )
            throw( new InputSystemException( "Display is not created." ) );
        if ( !org.lwjgl.input.Mouse.isCreated() )
            throw( new InputSystemException( "Mouse is not created." ) );
        try
        {
            LWJGLInputDeviceFactory.processMessages( nanoTime );
            org.lwjgl.input.Mouse.poll();
            while ( org.lwjgl.input.Mouse.next() )
            {
                if ( !acceptEvents )
                    continue;
                final int x = org.lwjgl.input.Mouse.getEventX();
                final int y = getSourceWindow().getHeight() - org.lwjgl.input.Mouse.getEventY();
                final int dx = org.lwjgl.input.Mouse.getEventDX();
                final int dy = org.lwjgl.input.Mouse.getEventDY();
                final int buttonIdx = org.lwjgl.input.Mouse.getEventButton();
                final boolean buttonState = org.lwjgl.input.Mouse.getEventButtonState();
                final int wheelDelta = org.lwjgl.input.Mouse.getEventDWheel() / 120;
                if ( isAbsolute() )
                    this.storePosition( x, y );
                if ( ( dx != 0 ) || ( dy != 0 ) )
                {
                    final MouseMovedEvent movEv = prepareMouseMovedEvent( getCurrentX(), getCurrentY(), dx, dy, nanoTime );
                    if ( dx != 0 )
                        is.notifyInputStatesManagers( this, getXAxis(), x, dx, nanoTime );
                    if ( dy != 0 )
                        is.notifyInputStatesManagers( this, getYAxis(), y, dy, nanoTime );
                    if ( movEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( movEv );
                    else
                        fireOnMouseMoved( movEv, true );
                }
                if ( buttonIdx != -1 )
                {
                    final MouseButton button = convertButton( buttonIdx );
                    if ( buttonState )
                    {
                        final MouseButtonPressedEvent pressedEv = prepareMouseButtonPressedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 1, +1, nanoTime );
                        if ( pressedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( pressedEv );
                        else
                            fireOnMouseButtonPressed( pressedEv, true );
                    }
                    else
                    {
                        final MouseButtonReleasedEvent releasedEv = prepareMouseButtonReleasedEvent( button, nanoTime );
                        is.notifyInputStatesManagers( this, button, 0, -1, nanoTime );
                        if ( releasedEv == null )
                            continue;
                        if ( isQueued )
                            eventQueue.enqueue( releasedEv );
                        else
                            fireOnMouseButtonReleased( releasedEv, true );
                    }
                }
                if ( wheelDelta != 0 )
                {
                    final MouseWheelEvent wheelEv = prepareMouseWheelMovedEvent( wheelDelta, false, nanoTime );
                    is.notifyInputStatesManagers( this, getWheel(), getWheel().getIntValue(), wheelDelta, nanoTime );
                    if ( wheelEv == null )
                        continue;
                    if ( isQueued )
                        eventQueue.enqueue( wheelEv );
                    else
                        fireOnMouseWheelMoved( wheelEv, true );
                }
            }
        }
        catch ( Throwable t )
        {
            if ( t instanceof InputSystemException )
                throw( (InputSystemException)t );
            if ( t instanceof Error )
                throw( (Error)t );
            if ( t instanceof RuntimeException )
                throw( (RuntimeException)t );
            throw( new InputSystemException( t ) );
        }
    }


Input:
    private void send() throws IOException {
        final Pooled<ByteBuffer> pooledBuffer = buffer;
        final ByteBuffer buffer = pooledBuffer.getResource();
        this.buffer =  null;
        final boolean eof = this.eof;
        if (buffer != null && buffer.position() > 0) {
            buffer.flip();
            send(pooledBuffer, eof);
        } else if (eof) {
            Pooled<ByteBuffer> pooledBuffer1 = getBuffer();
            final ByteBuffer buffer1 = pooledBuffer1.getResource();
            buffer1.flip();
            send(pooledBuffer1, eof);
        }
    }

Output:
    private void send() throws IOException {
        final Pooled<ByteBuffer> pooledBuffer = buffer;
        final ByteBuffer buffer = pooledBuffer == null ? null : pooledBuffer.getResource();
        this.buffer =  null;
        final boolean eof = this.eof;
        if (buffer != null && buffer.position() > 0) {
            buffer.flip();
            send(pooledBuffer, eof);
        } else if (eof) {
            Pooled<ByteBuffer> pooledBuffer1 = getBuffer();
            final ByteBuffer buffer1 = pooledBuffer1.getResource();
            buffer1.flip();
            send(pooledBuffer1, eof);
        }
    }


Input:
	private static String getFileContents(String fileName)
	{
		FileInputStream fin;
		try {
			fin = new FileInputStream("D:\\Development\\Emulator\\src\\utility\\test\\" +fileName);
			FileChannel fch = fin.getChannel();
			ByteBuffer byteBuff;
			try {
				byteBuff = fch.map(FileChannel.MapMode.READ_ONLY, 0, fch.size());
				CharBuffer chBuff = Charset.forName("UTF-8").decode(byteBuff);
				return chBuff.toString();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		return "";
	}

Output:
	private static String getFileContents(String fileName)
	{
		FileInputStream fin;
		try {
			fin = new FileInputStream(fileName);
			FileChannel fch = fin.getChannel();
			ByteBuffer byteBuff;
			try {
				byteBuff = fch.map(FileChannel.MapMode.READ_ONLY, 0, fch.size());
				CharBuffer chBuff = Charset.forName("UTF-8").decode(byteBuff);
				return chBuff.toString();
			} catch (IOException e) {
				e.printStackTrace();
			}
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		return "";
	}