Input:
		public int compare(Storable o1, Storable o2) {
			if(o1.isNotForStorage()) {
				return o1.equals(o2) ? 0 : 1;
			}
			else if(o2.isNotForStorage()) {
				return o1.equals(o2) ? 0 : -1;
			}
			else {
				return -1 * Longs.compare(o1.getTimestamp(), o2.getTimestamp());
			}
		}

Output:
		public int compare(Storable o1, Storable o2) {
			if(o1.isNotForStorage() && o2.isNotForStorage()) {
				return o1.equals(o2) ? 0 : 0;
			}
			if(o1.isNotForStorage()) {
				return 1;
			}
			else if(o2.isNotForStorage()) {
				return -1;
			}
			else {
				return -1 * Longs.compare(o1.getTimestamp(), o2.getTimestamp());
			}
		}


Input:
    public static String normalize(String pidString)
            throws MalformedPIDException {
        if (pidString == null) {
            throw new MalformedPIDException("PID is null.");
        }
        if (pidString.length() > MAX_LENGTH) {
            throw new MalformedPIDException("PID length exceeds "
                    + MAX_LENGTH + ".");
        }
        StringBuffer out = new StringBuffer();
        boolean inObjectID = false;
        for (int i = 0; i < pidString.length(); i++) {
            char c = pidString.charAt(i);
            if (!inObjectID) {
                if (c == ':') {
                    out.append(':');
                    inObjectID = true;
                } else if (c == '%') {
                    if (pidString.length() >= i + 3) {
                        i++;
                        if (pidString.charAt(i) == '3') {
                            i++;
                            c = pidString.charAt(i);
                            if ( c == 'a' || c == 'A' ) {
                                out.append(":");
                                inObjectID = true;
                            } else {
                                throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '3" + c + "'.");
                            }
                        } else {
                            throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i, i+2) + "'.");
                        }
                    } else {
                        throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i+1) + "'.");
                    }
                } else if (isAlphaNum(c) || c == '-' || c == '.') {
                    out.append(c);
                } else {
                    throw new MalformedPIDException("PID namespace-id cannot contain '" + c + "' character.");
                }
            } else if (isAlphaNum(c) || c == '-' || c == '.' || c == '~' || c == '_' ) {
                out.append(c);
            } else if (c == '%') {
                if (pidString.length() >= i + 3) {
                    char h1 = getNormalizedHexChar(pidString.charAt(++i));
                    char h2 = getNormalizedHexChar(pidString.charAt(++i));
                    out.append("%" + h1 + h2);
                } else {
                    throw new MalformedPIDException("PID object-id ended early: need at least 2 chars after '%'.");
                }
            } else {
                throw new MalformedPIDException("PID object-id cannot contain '" + c + "' character.");
            }
        }
        if (!inObjectID) throw new MalformedPIDException("PID delimiter (:) is missing.");
        String outString = out.toString();
        if (outString.startsWith(":")) throw new MalformedPIDException("PID namespace-id cannot be empty.");
        if (outString.length() < 3) throw new MalformedPIDException("PID object-id cannot be empty.");
        return out.toString();
    }

Output:
    public static String normalize(String pidString)
            throws MalformedPIDException {
        if (pidString == null) {
            throw new MalformedPIDException("PID is null.");
        }
        if (pidString.length() > MAX_LENGTH) {
            throw new MalformedPIDException("PID length exceeds "
                    + MAX_LENGTH + ".");
        }
        StringBuffer out = new StringBuffer();
        boolean inObjectID = false;
        for (int i = 0; i < pidString.length(); i++) {
            char c = pidString.charAt(i);
            if (!inObjectID) {
                if (c == ':') {
                    out.append(':');
                    inObjectID = true;
                } else if (c == '%') {
                    if (pidString.length() >= i + 3) {
                        i++;
                        if (pidString.charAt(i) == '3') {
                            i++;
                            c = pidString.charAt(i);
                            if ( c == 'a' || c == 'A' ) {
                                out.append(":");
                                inObjectID = true;
                            } else {
                                throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '3" + c + "'.");
                            }
                        } else {
                            throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i, i+2) + "'.");
                        }
                    } else {
                        throw new MalformedPIDException("Error in PID after first '%': expected '3a' or '3A', but saw '" + pidString.substring(i+1) + "'.");
                    }
                } else if (isAlphaNum(c) || c == '-' || c == '.') {
                    out.append(c);
                } else {
                    throw new MalformedPIDException("PID namespace-id cannot contain '" + c + "' character.");
                }
            } else if (isAlphaNum(c) || c == '-' || c == '.' || c == '~' || c == '_' ) {
                out.append(c);
            } else if (c == '%') {
                if (pidString.length() >= i + 3) {
                    char h1 = getNormalizedHexChar(pidString.charAt(++i));
                    char h2 = getNormalizedHexChar(pidString.charAt(++i));
                    out.append("%" + h1 + h2);
                } else {
                    throw new MalformedPIDException("PID object-id ended early: need at least 2 chars after '%'.");
                }
            } else {
                throw new MalformedPIDException("PID object-id cannot contain '" + c + "' character.");
            }
        }
        if (!inObjectID) throw new MalformedPIDException("PID delimiter (:) is missing.");
        String outString = out.toString();
        if (outString.startsWith(":")) throw new MalformedPIDException("PID namespace-id cannot be empty.");
        if (outString.length() < 3) throw new MalformedPIDException("PID object-id cannot be empty.");
        return outString;
    }


Input:
    public void process(Event event) throws PluggableTaskException {
        PluggableTaskBL<IExternalCreditCardStorage> ptbl = new PluggableTaskBL<IExternalCreditCardStorage>(getExternalSavingPluginId());
        IExternalCreditCardStorage externalCCStorage = ptbl.instantiateTask();
        if (event instanceof NewCreditCardEvent) {
            LOG.debug("Processing NewCreditCardEvent ...");
            NewCreditCardEvent ev = (NewCreditCardEvent) event;
            if (!ev.getCreditCard().getBaseUsers().isEmpty()) {
                String gateWayKey = externalCCStorage.storeCreditCard(null, ev.getCreditCard(), null);
                updateCreditCard(ev.getCreditCard(), gateWayKey);
            } else {
                LOG.debug("Credit card is not associated with a user (card for payment) - can't save through gateway.");
            }
        } else if (event instanceof NewContactEvent) {
            LOG.debug("Processing NewContactEvent ...");
            NewContactEvent ev = (NewContactEvent) event;
            ContactDTO contact = ev.getContactDto();
            int thisRecordContactType = contact.getContactMap().getContactType().getId();
            LOG.debug("Contact type: " + thisRecordContactType + ", plug-in expects: " + getContactType());
            if (getContactType() == thisRecordContactType) {
                UserBL userBl = new UserBL(contact.getUserId());
                CreditCardDTO creditCard = userBl.getCreditCard();
                if (creditCard != null) {
                    String gateWayKey = externalCCStorage.storeCreditCard(contact, creditCard, null);
                    updateCreditCard(creditCard, gateWayKey);
                } else {
                    LOG.warn("Cannot determine credit card for storage, invoking external store with contact only");
                    String gateWayKey = externalCCStorage.storeCreditCard(contact, null, null);
                    updateCreditCard(creditCard, gateWayKey);
                }
            }
        } else {
            throw new PluggableTaskException("Cant not process event " + event);
        }
    }

Output:
    public void process(Event event) throws PluggableTaskException {
        PluggableTaskBL<IExternalCreditCardStorage> ptbl = new PluggableTaskBL<IExternalCreditCardStorage>(getExternalSavingPluginId());
        IExternalCreditCardStorage externalCCStorage = ptbl.instantiateTask();
        if (event instanceof NewCreditCardEvent) {
            LOG.debug("Processing NewCreditCardEvent ...");
            NewCreditCardEvent ev = (NewCreditCardEvent) event;
            if (!ev.getCreditCard().getBaseUsers().isEmpty()) {
                String gateWayKey = externalCCStorage.storeCreditCard(null, ev.getCreditCard(), null);
                updateCreditCard(ev.getCreditCard(), gateWayKey);
            } else {
                LOG.debug("Credit card is not associated with a user (card for payment) - can't save through gateway.");
            }
        } else if (event instanceof NewContactEvent) {
            LOG.debug("Processing NewContactEvent ...");
            NewContactEvent ev = (NewContactEvent) event;
            ContactDTO contact = ev.getContactDto();
            int thisRecordContactType = contact.getContactMap().getContactType().getId();
            LOG.debug("Contact type: " + thisRecordContactType + ", plug-in expects: " + getContactType());
            if (getContactType() == thisRecordContactType) {
                UserBL userBl = new UserBL(contact.getUserId());
                CreditCardDTO creditCard = userBl.getCreditCard();
                if (creditCard != null) {
                    String gateWayKey = externalCCStorage.storeCreditCard(contact, creditCard, null);
                    updateCreditCard(creditCard, gateWayKey);
                } else {
                    LOG.warn("Cannot determine credit card for storage, invoking external store with contact only");
                }
            }
        } else {
            throw new PluggableTaskException("Cant not process event " + event);
        }
    }


Input:
    public static final ServiceLocator instance()
    {
    	if (context == null)
    	{
    		context = new org.springframework.context.annotation.AnnotationConfigApplicationContext();
    		((org.springframework.context.annotation.AnnotationConfigApplicationContext) context).scan("org.molgenis");
    		((org.springframework.context.annotation.AnnotationConfigApplicationContext) context).refresh();
    	}
        return instance;
    }

Output:
    public static final ServiceLocator instance()
    {
    	if (context == null)
    	{
    		context = new org.springframework.context.support.ClassPathXmlApplicationContext();
    	}
        return instance;
    }


Input:
    public void runPermissionEvent(PermissionEvent event) {
        User user = event.getUser();
        RalexBot.log("Updating perms for " + user.getNick());
        String ver = user.isVerified();
        RalexBot.log("Is verified: " + ver);
        if (ver == null || ver.isEmpty()) {
            return;
        }
        Map<String, Set<Permission>> existing = user.getPermissions();
        for (String key : existing.keySet()) {
            for (Permission perm : existing.get(key)) {
                user.removePermission(key, perm.getName());
            }
        }
        List<String> list = permFile.getStringList(ver);
        for (String line : list) {
            String chan = line.split("\\|")[0];
            String perm = line.split("\\|")[1];
            if (chan.isEmpty()) {
                chan = null;
            }
            user.addPermission(chan, perm);
        }
    }

Output:
    public void runPermissionEvent(PermissionEvent event) {
        User user = event.getUser();
        String ver = user.isVerified();
        if (ver == null || ver.isEmpty()) {
            return;
        }
        Map<String, Set<Permission>> existing = user.getPermissions();
        for (String key : existing.keySet().toArray(new String[0])) {
            for (Permission perm : existing.get(key).toArray(new Permission[0])) {
                user.removePermission(key, perm.getName());
            }
        }
        List<String> list = permFile.getStringList(ver);
        for (String line : list) {
            String chan = line.split("\\|")[0];
            String perm = line.split("\\|")[1];
            if (chan.isEmpty()) {
                chan = null;
            }
            user.addPermission(chan, perm);
        }
    }


Input:
private boolean getInfo(String searchString) {
        try {
            String urlString = _searchUrl + filterTitle(searchString);
            URL url = new URL(urlString);
            URLConnection urlConn = url.openConnection();
            if (!(urlConn.getContent() instanceof InputStream))
                return false;
            String data = "";
            BufferedReader in = null;
            String line;
            try {
				in = new BufferedReader(new InputStreamReader(urlConn
						.getInputStream()));
				while ((line = in.readLine()) != null) {
					data += line + "\n";
				}
			} finally {
				if (in != null) {
					in.close();
				}
			}
            if (data.indexOf("No Matches.") > 0)
                return false;
            if (data.indexOf("<title>IMDb name and title search") >= 0 ||
                    data.indexOf("= 0) {
                int start = data.indexOf("/title/tt");
                if (start > 0) {
                    int end = data.indexOf("/",start + "/title/tt".length());
                    _url = data.substring(start,end);
                    if (_url.indexOf("http://") < 0)
                        _url = _baseUrl + _url;
                }
                if (_url == null)
                    return false;
            } else {
                _url = urlString;
            }
            url = new URL(_url);
            urlConn = url.openConnection();
            if (!(urlConn.getContent() instanceof InputStream))
                return false;
            try {
				in = new BufferedReader(new InputStreamReader(urlConn
						.getInputStream()));
				while ((line = in.readLine()) != null)
					data = data + line + "\n";
			} finally {
				in.close();
			}
           _title = parseData(data, "
", "");
           _genre = parseData(data, "Genre:", "

");
           _genre = _genre.replaceAll("\\(more\\)", "").trim();
           _plot = parseData(data, "Plot Outline:", "<a href=\"");
           _rating = parseData(data, "User Rating:", "");
           _rating = _rating.equals("N/A") || _rating.indexOf("/") < 0 ? "N/A"
                       : _rating.substring(0,_rating.indexOf("/"));
           _votes = parseData(data, "User Rating:", "

");
           _votes = _votes.indexOf("(") < 0 || _votes.indexOf("votes") < 0 ? "N/A"
                       : _votes.substring(_votes.indexOf("(")+1, _votes.indexOf("votes")).trim();
           _year = parseData(data, "<a href=\"/Sections/Years/", "");
           if (_year.length() >= 6)
        	   _year = _year.substring(6);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            return false;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

Output:
    private boolean getInfo(String searchString) {
        try {
            String urlString = _searchUrl + filterTitle(searchString);
            URL url = new URL(urlString);
            URLConnection urlConn = url.openConnection();
            if (!(urlConn.getContent() instanceof InputStream))
                return false;
            String data = "";
            BufferedReader in = null;
            String line;
            try {
				in = new BufferedReader(new InputStreamReader(urlConn
						.getInputStream()));
				while ((line = in.readLine()) != null) {
					data += line + "\n";
				}
			} finally {
				if (in != null) {
					in.close();
				}
			}
            if (data.indexOf("<b>No Matches.</b>") > 0)
                return false;
            if (data.indexOf("<title>IMDb name and title search") >= 0 ||
                    data.indexOf("<a href=\"/title/tt") >= 0) {
                int start = data.indexOf("/title/tt");
                if (start > 0) {
                    int end = data.indexOf("/",start + "/title/tt".length());
                    _url = data.substring(start,end);
                    if (_url.indexOf("http://") < 0)
                        _url = _baseUrl + _url;
                }
                if (_url == null)
                    return false;
            } else {
                _url = urlString;
            }
            url = new URL(_url);
            urlConn = url.openConnection();
            if (!(urlConn.getContent() instanceof InputStream))
                return false;
            try {
				in = new BufferedReader(new InputStreamReader(urlConn
						.getInputStream()));
				while ((line = in.readLine()) != null)
					data = data + line + "\n";
			} finally {
				in.close();
			}
           _title = parseData(data, "<strong class=\"title\">", "<small>");
           _genre = parseData(data, "<b class=\"ch\">Genre:</b>", "<br><br>");
           _genre = _genre.replaceAll("\\(more\\)", "").trim();
           _plot = parseData(data, "<b class=\"ch\">Plot Outline:</b>", "<a href=\"");
           _rating = parseData(data, "<b class=\"ch\">User Rating:</b>", "</b>");
           _rating = _rating.equals("N/A") || _rating.indexOf("/") < 0 ? "N/A"
                       : _rating.substring(0,_rating.indexOf("/"));
           _votes = parseData(data, "<b class=\"ch\">User Rating:</b>", "<br><br>");
           _votes = _votes.indexOf("(") < 0 || _votes.indexOf("votes") < 0 ? "N/A"
                       : _votes.substring(_votes.indexOf("(")+1, _votes.indexOf("votes")).trim();
           _year = parseData(data, "<a href=\"/Sections/Years/", "</a>");
           if (_year.length() >= 6)
        	   _year = _year.substring(6);
        } catch (MalformedURLException e) {
            e.printStackTrace();
            return false;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }


Input:
    private void parseInput(File inputFile) throws IOException {
        CSVReader reader = null;
        Map<String, Set<String>> groupMap = new HashMap<String, Set<String>>();
        Map<String, Set<Publication>> publicationMap = new HashMap<String, Set<Publication>>();
        Map<String, SampleData> stMap = new HashMap<String, SampleData>();
        int linecount;
        String [] nextLine;
        try {
            reader = new CSVReader(new FileReader(inputFile), "\t".charAt(0));
            linecount = 0;
            while ((nextLine = reader.readNext()) != null) {
                linecount += 1;
                if (this.headers == null || linecount == 0){
                    this.headers = new ArrayList<String>();
                    for (String header : nextLine){
                        if (header.startsWith("V_")){
                            header = header.substring(2);
                        }
                        log.info("Found header : "+header);
                        headers.add(header);
                    }
                    this.doiindex = this.headers.indexOf("DOI");
                    if (this.doiindex < 0){
                        throw new IOException("Headers does not contain DOI");
                    }
                    this.pubmedindex = this.headers.indexOf("PUBMED_ID");
                    if (this.pubmedindex < 0){
                        throw new IOException("Headers does not contain PUBMED_ID");
                    }
                    this.projheaderindex = this.headers.indexOf("PROJECT_ACC");
                    this.pubheaderindex = this.headers.indexOf("ENA_PUBID");
                    if (this.pubheaderindex < 0){
                        throw new IOException("Headers does not contain ENA_PUBID");
                    }
                    this.collectedbyindex = this.headers.indexOf("COLLECTED_BY");
                    if (this.collectedbyindex < 0){
                        throw new IOException("Headers does not contain COLLECTED_BY");
                    }
                    this.identifiedbyindex = this.headers.indexOf("IDENTIFIED_BY");
                    if (this.identifiedbyindex < 0){
                        throw new IOException("Headers does not contain IDENTIFIED_BY");
                    }
                    this.taxidindex = this.headers.indexOf("TAX_ID");
                    if (this.taxidindex < 0){
                        throw new IOException("Headers does not contain TAX_ID");
                    }
                } else {
                    if (nextLine.length > headers.size()){
                        log.warn("Line longer than headers "+linecount);
                    }
                    String accession = nextLine[0].trim();
                    log.debug("First processing "+accession);
                    for (String id : getGroupIdentifiers(nextLine)){
                        if(!groupMap.containsKey(id)){
                            groupMap.put(id, new HashSet<String>());
                        }
                        groupMap.get(id).add(accession);
                    }
                    publicationMap.put(accession, getPublications(nextLine));
                    log.info(accession+" "+getPublications(nextLine).size());
                }
            }
            reader.close();
        } finally {
            try {
                if (reader != null){
                    reader.close();
                }
            } catch (IOException e){
            }
        }
        try {
            reader = new CSVReader(new FileReader(inputFile), "\t".charAt(0));
            linecount = 0;
            while ((nextLine = reader.readNext()) != null) {
                linecount += 1;
                if (this.headers == null || linecount == 0){
                } else {
                    if (nextLine.length > this.headers.size()){
                        log.warn("Line longer than headers "+linecount);
                    }
                    String accession = nextLine[0].trim();
                    log.debug("Second processing "+accession);
                    for (String id : getGroupIdentifiers(nextLine)){
                        if (!groupMap.containsKey(id)){
                            continue;
                        }
                        if(!stMap.containsKey(id)){
                            stMap.put(id, new SampleData());
                        }
                        SampleData st = stMap.get(id);
                        SampleNode s = lineToSample(nextLine, st);
                        if (s.getNodeName() == null){
                            log.error("Unable to add node with null name");
                            continue;
                        }
                        try {
                            if (s.getNodeName() == null){
                                log.error("Unable to add node with null name");
                            } else if (st.scd.getNode(s.getNodeName(), SampleNode.class) != null) {
                                log.error("Unable to add duplicate node with name "+s.getNodeName());
                            } else if (s.getAttributes().size() <= 1){
                                log.warn("Refusing to add sample "+s.getNodeName()+" without attributes");
                            } else {
                                st.scd.addNode(s);
                            }
                        } catch (ParseException e) {
                            log.error("Unable to add node "+s.getNodeName(), e);
                        }
                        if (!groupMap.containsKey(id)){
                            log.error("Problem locating publication ID "+id+" in publication maping");
                            continue;
                        }
                        if (!groupMap.get(id).contains(s.getNodeName())){
                            log.error("Problem removing sample "+s.getNodeName()+" from publication maping");
                            continue;
                        }
                        if (publicationMap.containsKey(accession)){
                            st.msi.publications.addAll(publicationMap.get(accession));
                            log.debug(accession+" "+publicationMap.get(accession).size());
                            log.debug(accession+" "+st.msi.publications.size());
                        }
                        groupMap.get(id).remove(s.getNodeName());
                        if (groupMap.get(id).size() == 0){
                            st.msi.submissionIdentifier = prefix+"-"+id;
                            if (wgs){
                                String speciesName = null;
                                for (SampleNode sn : st.scd.getNodes(SampleNode.class)){
                                    for (SCDNodeAttribute a : sn.getAttributes()){
                                        if (OrganismAttribute.class.isInstance(a)){
                                            OrganismAttribute oa = (OrganismAttribute) a;
                                            speciesName = a.getAttributeValue();
                                        }
                                    }
                                }
                                if (speciesName == null){
                                    log.warn("Unable to determine species name");
                                } else {
                                    st.msi.submissionTitle = "Whole Genome Shotgun sequencing of "+speciesName;
                                }
                            } else if (tsa){
                                String speciesName = null;
                                for (SampleNode sn : st.scd.getNodes(SampleNode.class)){
                                    for (SCDNodeAttribute a : sn.getAttributes()){
                                        if (OrganismAttribute.class.isInstance(a)){
                                            OrganismAttribute oa = (OrganismAttribute) a;
                                            speciesName = a.getAttributeValue();
                                        }
                                    }
                                }
                                if (speciesName == null){
                                    log.warn("Unable to determine species name");
                                } else {
                                    st.msi.submissionTitle = "Transcriptome Shotgun sequencing of "+speciesName;
                                }
                            } else if (bar){
                                st.msi.submissionTitle = st.msi.submissionIdentifier;
                            }
                            log.debug("No. of publications = "+st.msi.publications.size());
                            log.debug("Empty? "+st.msi.publications.isEmpty());
                            File outputSubDir = new File(outputFile, st.msi.submissionIdentifier);
                            File sampletabPre = new File(outputSubDir, "sampletab.pre.txt");
                            outputSubDir.mkdirs();
                            log.info("Writing "+sampletabPre);
                            SampleTabWriter sampletabwriter = null;
                            try {
                                sampletabwriter = new SampleTabWriter(new BufferedWriter(new FileWriter(sampletabPre)));
                                sampletabwriter.write(st);
                            } catch (IOException e) {
                                log.error("Unable to write to "+sampletabPre, e);
                            } finally {
                                if (sampletabwriter != null){
                                    try {
                                        sampletabwriter.close();
                                    } catch (IOException e) {
                                    }
                                }
                            }
                            groupMap.remove(id);
                            stMap.remove(id);
                        }
                    }
                }
            }
            reader.close();
        } finally {
            try {
                if (reader != null){
                    reader.close();
                }
            } catch (IOException e){
            }
        }
    }

Output:
    private void parseInput(File inputFile) throws IOException {
        CSVReader reader = null;
        Map<String, Set<String>> groupMap = new HashMap<String, Set<String>>();
        Map<String, Set<Publication>> publicationMap = new HashMap<String, Set<Publication>>();
        Map<String, SampleData> stMap = new HashMap<String, SampleData>();
        int linecount;
        String [] nextLine;
        try {
            reader = new CSVReader(new FileReader(inputFile), "\t".charAt(0));
            linecount = 0;
            while ((nextLine = reader.readNext()) != null) {
                linecount += 1;
                if (this.headers == null || linecount == 0){
                    this.headers = new ArrayList<String>();
                    for (String header : nextLine){
                        if (header.startsWith("V_")){
                            header = header.substring(2);
                        }
                        log.info("Found header : "+header);
                        headers.add(header);
                    }
                    this.doiindex = this.headers.indexOf("DOI");
                    if (this.doiindex < 0){
                        throw new IOException("Headers does not contain DOI");
                    }
                    this.pubmedindex = this.headers.indexOf("PUBMED_ID");
                    if (this.pubmedindex < 0){
                        throw new IOException("Headers does not contain PUBMED_ID");
                    }
                    this.projheaderindex = this.headers.indexOf("PROJECT_ACC");
                    this.pubheaderindex = this.headers.indexOf("ENA_PUBID");
                    if (this.pubheaderindex < 0){
                        throw new IOException("Headers does not contain ENA_PUBID");
                    }
                    this.collectedbyindex = this.headers.indexOf("COLLECTED_BY");
                    if (this.collectedbyindex < 0){
                        throw new IOException("Headers does not contain COLLECTED_BY");
                    }
                    this.identifiedbyindex = this.headers.indexOf("IDENTIFIED_BY");
                    if (this.identifiedbyindex < 0){
                        throw new IOException("Headers does not contain IDENTIFIED_BY");
                    }
                    this.taxidindex = this.headers.indexOf("TAX_ID");
                    if (this.taxidindex < 0){
                        throw new IOException("Headers does not contain TAX_ID");
                    }
                } else {
                    if (nextLine.length > headers.size()){
                        log.warn("Line longer than headers "+linecount);
                    }
                    String accession = nextLine[0].trim();
                    log.debug("First processing "+accession);
                    for (String id : getGroupIdentifiers(nextLine)){
                        if(!groupMap.containsKey(id)){
                            groupMap.put(id, new HashSet<String>());
                        }
                        groupMap.get(id).add(accession);
                    }
                    publicationMap.put(accession, getPublications(nextLine));
                    log.info(accession+" "+getPublications(nextLine).size());
                }
            }
            reader.close();
        } finally {
            try {
                if (reader != null){
                    reader.close();
                }
            } catch (IOException e){
            }
        }
        try {
            reader = new CSVReader(new FileReader(inputFile), "\t".charAt(0));
            linecount = 0;
            while ((nextLine = reader.readNext()) != null) {
                linecount += 1;
                if (this.headers == null || linecount == 0){
                } else {
                    if (nextLine.length > this.headers.size()){
                        log.warn("Line longer than headers "+linecount);
                    }
                    String accession = nextLine[0].trim();
                    log.debug("Second processing "+accession);
                    for (String id : getGroupIdentifiers(nextLine)){
                        if (!groupMap.containsKey(id)){
                            continue;
                        }
                        if(!stMap.containsKey(id)){
                            stMap.put(id, new SampleData());
                        }
                        SampleData st = stMap.get(id);
                        SampleNode s = lineToSample(nextLine, st);
                        if (s.getNodeName() == null){
                            log.error("Unable to add node with null name");
                            continue;
                        }
                        try {
                            if (s.getNodeName() == null){
                                log.error("Unable to add node with null name");
                            } else if (st.scd.getNode(s.getNodeName(), SampleNode.class) != null) {
                                log.error("Unable to add duplicate node with name "+s.getNodeName());
                            } else if (s.getAttributes().size() <= 1){
                                log.warn("Refusing to add sample "+s.getNodeName()+" without attributes");
                            } else {
                                st.scd.addNode(s);
                            }
                        } catch (ParseException e) {
                            log.error("Unable to add node "+s.getNodeName(), e);
                        }
                        if (!groupMap.containsKey(id)){
                            log.error("Problem locating publication ID "+id+" in publication maping");
                            continue;
                        }
                        if (!groupMap.get(id).contains(s.getNodeName())){
                            log.error("Problem removing sample "+s.getNodeName()+" from publication maping");
                            continue;
                        }
                        if (publicationMap.containsKey(accession)){
                            st.msi.publications.addAll(publicationMap.get(accession));
                            log.debug(accession+" "+publicationMap.get(accession).size());
                            log.debug(accession+" "+st.msi.publications.size());
                        }
                        groupMap.get(id).remove(s.getNodeName());
                        if (groupMap.get(id).size() == 0){
                            st.msi.submissionIdentifier = prefix+"-"+id;
                            st.msi.submissionIdentifier = st.msi.submissionIdentifier.replace(" ", "-");
                            st.msi.submissionIdentifier = st.msi.submissionIdentifier.replace("&", "and");
                            if (wgs){
                                String speciesName = null;
                                for (SampleNode sn : st.scd.getNodes(SampleNode.class)){
                                    for (SCDNodeAttribute a : sn.getAttributes()){
                                        if (OrganismAttribute.class.isInstance(a)){
                                            OrganismAttribute oa = (OrganismAttribute) a;
                                            speciesName = a.getAttributeValue();
                                        }
                                    }
                                }
                                if (speciesName == null){
                                    log.warn("Unable to determine species name");
                                } else {
                                    st.msi.submissionTitle = "Whole Genome Shotgun sequencing of "+speciesName;
                                }
                            } else if (tsa){
                                String speciesName = null;
                                for (SampleNode sn : st.scd.getNodes(SampleNode.class)){
                                    for (SCDNodeAttribute a : sn.getAttributes()){
                                        if (OrganismAttribute.class.isInstance(a)){
                                            OrganismAttribute oa = (OrganismAttribute) a;
                                            speciesName = a.getAttributeValue();
                                        }
                                    }
                                }
                                if (speciesName == null){
                                    log.warn("Unable to determine species name");
                                } else {
                                    st.msi.submissionTitle = "Transcriptome Shotgun sequencing of "+speciesName;
                                }
                            } else if (bar){
                                st.msi.submissionTitle = st.msi.submissionIdentifier;
                            }
                            log.debug("No. of publications = "+st.msi.publications.size());
                            log.debug("Empty? "+st.msi.publications.isEmpty());
                            File outputSubDir = new File(outputFile, st.msi.submissionIdentifier);
                            File sampletabPre = new File(outputSubDir, "sampletab.pre.txt");
                            outputSubDir.mkdirs();
                            log.info("Writing "+sampletabPre);
                            SampleTabWriter sampletabwriter = null;
                            try {
                                sampletabwriter = new SampleTabWriter(new BufferedWriter(new FileWriter(sampletabPre)));
                                sampletabwriter.write(st);
                            } catch (IOException e) {
                                log.error("Unable to write to "+sampletabPre, e);
                            } finally {
                                if (sampletabwriter != null){
                                    try {
                                        sampletabwriter.close();
                                    } catch (IOException e) {
                                    }
                                }
                            }
                            groupMap.remove(id);
                            stMap.remove(id);
                        }
                    }
                }
            }
            reader.close();
        } finally {
            try {
                if (reader != null){
                    reader.close();
                }
            } catch (IOException e){
            }
        }
    }


Input:
    public void handleEvent(Event e) {
        Player p;
        if (e.getStringValue().equals(getPlayerName())) {
            p = currentPlayer;
        } else {
            p = players.get(e.getSender());
        }
        if (p != null) {
            System.out.printf("Handling event from %s %n", p.getName());
        }
        switch (e.getType()) {
            case RUN_RIGHT: {
                p.accelerateX(Physics.RUN_SPEED);
            } break;
            case RUN_LEFT: {
                p.accelerateX(-Physics.RUN_SPEED);
            } break;
            case JUMP: {
                if (p.isCanJump()) {
                    p.accelerateY(Physics.JUMP_SPEED);
                    p.setCanJump(false);
                }
            } break;
            case SHOOT: {
                String[] pos = e.getStringValue().split(" ");
                int sx = Integer.parseInt(pos[0]);
                int sy = Integer.parseInt(pos[1]);
                countShoot(currentPlayer.getPosition(), new Point(sx, sy));
                if (hitedPlayer != null) {
                    Event event = new GameEvent(EventType.INCREMENT_HP, e.getSender(),
                            hitedPlayer.getName() + " -" + HIT_DECREMENT_HP_VALUE);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    hitedPlayer = null;
                    handleEvent(event);
                }
            } break;
            case INCREMENT_HP: {
                String[] values = e.getStringValue().split(" ");
                int leftHP = players.get(values[0]).changeHP(Integer.parseInt(values[1]));
                if (leftHP <= 0) {
                    GameEvent event = new GameEvent(EventType.KILLED, e.getSender(), values[0]);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    handleEvent(event);
                }
            } break;
            case KILLED: {
                System.out.printf("%s: %s killed %s%n", playerName, e.getSender(), e.getStringValue());
                rate.incScore(players.get(e.getSender()), 1);
                rate.incScore(players.get(e.getStringValue()), -1);
                GameEvent event = new GameEvent(EventType.REBORN,
                        e.getSender(), e.getStringValue());
                for (EventHandler h : handlers) {
                    h.handleEvent(event);
                }
                handleEvent(event);
            } break;
            case REBORN: {
                spawn(players.get(e.getStringValue()));
            } break;
            case JOIN_NEW_PLAYER: {
                String[] playerInfo = e.getStringValue().split(" ");
                int x = Integer.parseInt(playerInfo[0]);
                int y = Integer.parseInt(playerInfo[1]);
                Player newPlayer = new Player(x, y);
                newPlayer.setName(e.getSender());
                players.put(newPlayer.getName(), newPlayer);
                rate.addPlayer(newPlayer);
            } break;
            case MOVE_PLAYER: {
                if (p != currentPlayer && p != null) {
                    String[] pos = e.getStringValue().split(" ");
                    int x = Integer.parseInt(pos[0]);
                    int y = Integer.parseInt(pos[1]);
                    p.setX(x);
                    p.setY(y);
                }
            } break;
        }
    }

Output:
    public void handleEvent(Event e) {
        Player p;
        if (e.getStringValue().equals(getPlayerName())) {
            p = currentPlayer;
        } else {
            p = players.get(e.getSender());
        }
        if (p != null) {
            System.out.printf("Handling event from %s %n", p.getName());
        }
        switch (e.getType()) {
            case RUN_RIGHT: {
                if (p != null) {
                    p.accelerateX(Physics.RUN_SPEED);
                }
            } break;
            case RUN_LEFT: {
                if (p != null) {
                    p.accelerateX(-Physics.RUN_SPEED);
                }
            } break;
            case JUMP: {
                if (p != null) {
                    if (p.isCanJump()) {
                        p.accelerateY(Physics.JUMP_SPEED);
                        p.setCanJump(false);
                    }
                }
            } break;
            case SHOOT: {
                String[] pos = e.getStringValue().split(" ");
                int sx = Integer.parseInt(pos[0]);
                int sy = Integer.parseInt(pos[1]);
                countShoot(currentPlayer.getPosition(), new Point(sx, sy));
                if (hitedPlayer != null) {
                    Event event = new GameEvent(EventType.INCREMENT_HP, e.getSender(),
                            hitedPlayer.getName() + " -" + HIT_DECREMENT_HP_VALUE);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    hitedPlayer = null;
                    handleEvent(event);
                }
            } break;
            case INCREMENT_HP: {
                String[] values = e.getStringValue().split(" ");
                int leftHP = players.get(values[0]).changeHP(Integer.parseInt(values[1]));
                if (leftHP <= 0) {
                    GameEvent event = new GameEvent(EventType.KILLED, e.getSender(), values[0]);
                    for (EventHandler h : handlers) {
                        h.handleEvent(event);
                    }
                    handleEvent(event);
                }
            } break;
            case KILLED: {
                System.out.printf("%s: %s killed %s%n", playerName, e.getSender(), e.getStringValue());
                rate.incScore(players.get(e.getSender()), 1);
                rate.incScore(players.get(e.getStringValue()), -1);
                GameEvent event = new GameEvent(EventType.REBORN,
                        e.getSender(), e.getStringValue());
                for (EventHandler h : handlers) {
                    h.handleEvent(event);
                }
                handleEvent(event);
            } break;
            case REBORN: {
                spawn(players.get(e.getStringValue()));
            } break;
            case JOIN_NEW_PLAYER: {
                String[] playerInfo = e.getStringValue().split(" ");
                int x = Integer.parseInt(playerInfo[0]);
                int y = Integer.parseInt(playerInfo[1]);
                Player newPlayer = new Player(x, y);
                newPlayer.setName(e.getSender());
                players.put(newPlayer.getName(), newPlayer);
                rate.addPlayer(newPlayer);
            } break;
            case MOVE_PLAYER: {
                if (p != currentPlayer && p != null) {
                    String[] pos = e.getStringValue().split(" ");
                    int x = Integer.parseInt(pos[0]);
                    int y = Integer.parseInt(pos[1]);
                    p.setX(x);
                    p.setY(y);
                }
            } break;
        }
    }


Input:
	public void draw(int x, int y){
		if (covered==true){
			Renderer.Tile_Break.draw(x*size, y*size);
			Renderer.print(x*size, y*size, ""+art, 0.5f);
		} else {
			Renderer.Tile_Empty.draw(x*size, y*size);
			switch(art)
			{
				case 1: Renderer.Tile_Health.draw(x*size, y*size); break;
				case 2: Renderer.Tile_addbomb.draw(x*size, y*size); break;
				case 3: Renderer.Tile_kick.draw(x*size, y*size); break;
				case 4:
				case 5: Renderer.Tile_confuse.draw(x*size, y*size); break;
				case 6: Renderer.Tile_teleport.draw(x*size, y*size); break;
				case 7: Renderer.Tile_speed.draw(x*size, y*size); break;
				case 8: Renderer.Tile_slow.draw(x*size, y*size); break;
				case 9:
				case 10:
				case 11:
				case 12:
				case 13:
			}
		}

Output:
	public void draw(int x, int y){
		if (covered==true){
			Renderer.Tile_Break.draw(x*size, y*size);
			Renderer.print(x*size, y*size, ""+art, 0.5f);
		} else {
			Renderer.Tile_Empty.draw(x*size, y*size);
			switch(art)
			{
				case 1: Renderer.Tile_Health.draw(x*size, y*size); break;
				case 2: Renderer.Tile_addbomb.draw(x*size, y*size); break;
				case 3: Renderer.Tile_kick.draw(x*size, y*size); break;
				case 4: break;
				case 5: Renderer.Tile_slow.draw(x*size, y*size); break;
				case 6: Renderer.Tile_teleport.draw(x*size, y*size); break;
				case 7: Renderer.Tile_speed.draw(x*size, y*size); break;
				case 8: Renderer.Tile_confuse.draw(x*size, y*size); break;
				case 9:
				case 10:
			}
		}


Input:
	public Object adapt(Object o) {
		SearchResult result = new SearchResult();
		if(!(o instanceof String)) {
			throw new IllegalArgumentException("Argument is not a String");
		}
		String line = (String) o;
		String[] tokens = line.split(" ");
		if (tokens.length != 9) {
			return null;
		}
		String url = tokens[0];
		String captureDate = tokens[1];
		String origHost = tokens[2];
		String mimeType = tokens[3];
		String httpResponseCode = tokens[4];
		String md5Fragment = tokens[5];
		String redirectUrl = tokens[6];
		long compressedOffset = Long.parseLong(tokens[7]);
		String arcFileName = tokens[8];
		String origUrl = url;
		try {
			UURI uri = UURIFactory.getInstance(WaybackConstants.HTTP_URL_PREFIX +
					url);
			origUrl = origHost + uri.getEscapedPathQuery();
		} catch (URIException e) {
			e.printStackTrace();
			return null;
		}
		result.put(WaybackConstants.RESULT_URL, origUrl);
		result.put(WaybackConstants.RESULT_URL_KEY, url);
		result.put(WaybackConstants.RESULT_CAPTURE_DATE, captureDate);
		result.put(WaybackConstants.RESULT_ORIG_HOST, origHost);
		result.put(WaybackConstants.RESULT_MIME_TYPE, mimeType);
		result.put(WaybackConstants.RESULT_HTTP_CODE, httpResponseCode);
		result.put(WaybackConstants.RESULT_MD5_DIGEST, md5Fragment);
		result.put(WaybackConstants.RESULT_REDIRECT_URL, redirectUrl);
		result.put(WaybackConstants.RESULT_OFFSET, String.valueOf(compressedOffset));
		result.put(WaybackConstants.RESULT_ARC_FILE, arcFileName);
		return result;
	}

Output:
	public Object adapt(Object o) {
		SearchResult result = new SearchResult();
		if(!(o instanceof String)) {
			throw new IllegalArgumentException("Argument is not a String");
		}
		String line = (String) o;
		String[] tokens = line.split(" ");
		if (tokens.length != 9) {
			return null;
		}
		String url = tokens[0];
		String captureDate = tokens[1];
		String origHost = tokens[2];
		String mimeType = tokens[3];
		String httpResponseCode = tokens[4];
		String md5Fragment = tokens[5];
		String redirectUrl = tokens[6];
		long compressedOffset = Long.parseLong(tokens[7]);
		String arcFileName = tokens[8];
		String origUrl = url;
		if(!url.startsWith(WaybackConstants.DNS_URL_PREFIX)) {
			try {
				UURI uri = UURIFactory.getInstance(
						WaybackConstants.HTTP_URL_PREFIX + url);
				origUrl = origHost + uri.getEscapedPathQuery();
			} catch (URIException e) {
				e.printStackTrace();
				return null;
			}
		}
		result.put(WaybackConstants.RESULT_URL, origUrl);
		result.put(WaybackConstants.RESULT_URL_KEY, url);
		result.put(WaybackConstants.RESULT_CAPTURE_DATE, captureDate);
		result.put(WaybackConstants.RESULT_ORIG_HOST, origHost);
		result.put(WaybackConstants.RESULT_MIME_TYPE, mimeType);
		result.put(WaybackConstants.RESULT_HTTP_CODE, httpResponseCode);
		result.put(WaybackConstants.RESULT_MD5_DIGEST, md5Fragment);
		result.put(WaybackConstants.RESULT_REDIRECT_URL, redirectUrl);
		result.put(WaybackConstants.RESULT_OFFSET, String.valueOf(compressedOffset));
		result.put(WaybackConstants.RESULT_ARC_FILE, arcFileName);
		return result;
	}


Input:
	public void execute(AwRequest awRequest) {
		try {
			getDao().execute(awRequest);
			@SuppressWarnings("unchecked")
			List<MobilityQueryResult> results = (List<MobilityQueryResult>) awRequest.getResultList();
			List<MobilityQueryResult> chunkedResults = new ArrayList<MobilityQueryResult>();
			ChunkedMobilityQueryResult currentChunkedResult = new ChunkedMobilityQueryResult();
			int count = 0, still = 0, walk = 0, run = 0, bike = 0, drive = 0;
			String startTimestamp = null;
			for(int i = 0; i < results.size(); i++) {
				MobilityQueryResult result = results.get(i);
				if(0 == count) {
					startTimestamp = result.getTimestamp();
				}
				count++;
				currentChunkedResult.setLocation(result.getLocation());
				currentChunkedResult.setLocationStatus(result.getLocationStatus());
				currentChunkedResult.setTimestamp(result.getTimestamp());
				currentChunkedResult.setTimezone(result.getTimezone());
				if("still".equals(result.getValue())) {
					still++;
				} else if("walk".equals(result.getValue())) {
					walk++;
				} else if("run".equals(result.getValue())) {
					run++;
				} else if("bike".equals(result.getValue())) {
					bike++;
				} else if("drive".equals(result.getValue())) {
					drive++;
				} else {
					_logger.warn("unknown mobility mode found: " + result.getValue());
				}
				if(10 == count || (i == (results.size() - 1)) ) {
					JSONObject o = new JSONObject();
					try {
						o.put("still", still);
						o.put("walk", walk);
						o.put("run", run);
						o.put("bike", bike);
						o.put("drive", drive);
					} catch (JSONException jsone) {
						_logger.warn(jsone);
					}
					currentChunkedResult.setValue(o);
					currentChunkedResult.setDuration(calcDuration(startTimestamp, currentChunkedResult.getTimestamp()));
					chunkedResults.add(currentChunkedResult);
					count = 0; still = 0; walk = 0; run = 0; bike = 0; drive = 0;
				}
			}
			results.clear();
			awRequest.setResultList(chunkedResults);
		} catch (DataAccessException dae) {
			throw new ServiceException(dae);
		}
	}

Output:
	public void execute(AwRequest awRequest) {
		try {
			getDao().execute(awRequest);
			@SuppressWarnings("unchecked")
			List<MobilityQueryResult> results = (List<MobilityQueryResult>) awRequest.getResultList();
			List<MobilityQueryResult> chunkedResults = new ArrayList<MobilityQueryResult>();
			ChunkedMobilityQueryResult currentChunkedResult = new ChunkedMobilityQueryResult();
			int count = 0, still = 0, walk = 0, run = 0, bike = 0, drive = 0;
			String startTimestamp = null;
			for(int i = 0; i < results.size(); i++) {
				MobilityQueryResult result = results.get(i);
				if(0 == count) {
					startTimestamp = result.getTimestamp();
				}
				count++;
				currentChunkedResult.setLocation(result.getLocation());
				currentChunkedResult.setLocationStatus(result.getLocationStatus());
				currentChunkedResult.setTimestamp(result.getTimestamp());
				currentChunkedResult.setTimezone(result.getTimezone());
				if("still".equals(result.getValue())) {
					still++;
				} else if("walk".equals(result.getValue())) {
					walk++;
				} else if("run".equals(result.getValue())) {
					run++;
				} else if("bike".equals(result.getValue())) {
					bike++;
				} else if("drive".equals(result.getValue())) {
					drive++;
				} else {
					_logger.warn("unknown mobility mode found: " + result.getValue());
				}
				if(10 == count || (i == (results.size() - 1)) ) {
					JSONObject o = new JSONObject();
					try {
						o.put("still", still);
						o.put("walk", walk);
						o.put("run", run);
						o.put("bike", bike);
						o.put("drive", drive);
					} catch (JSONException jsone) {
						_logger.warn(jsone);
					}
					currentChunkedResult.setValue(o);
					currentChunkedResult.setDuration(calcDuration(startTimestamp, currentChunkedResult.getTimestamp()));
					chunkedResults.add(currentChunkedResult);
					count = 0; still = 0; walk = 0; run = 0; bike = 0; drive = 0;
					currentChunkedResult = new ChunkedMobilityQueryResult();
				}
			}
			results.clear();
			awRequest.setResultList(chunkedResults);
		} catch (DataAccessException dae) {
			throw new ServiceException(dae);
		}
	}


Input:
public static void
main(String argv[]) throws IOException {
	String server;
	int arg;
	Message query, response;
	Record rec;
	Record opt = null;
	Resolver res = null;
	boolean printQuery = false;
	if (argv.length < 1) {
		usage();
	}
	try {
		arg = 0;
		if (argv[arg].startsWith("@")) {
			server = argv[arg++].substring(1);
			res = new SimpleResolver(server);
		}
		else
			res = new ExtendedResolver();
		String nameString = argv[arg++];
		if (nameString.equals("-x")) {
			name = new Name(dns.inaddrString(argv[arg++]));
			type = Type.PTR;
			_class = DClass.IN;
		}
		else {
			name = new Name(nameString);
			type = Type.value(argv[arg]);
			if (type < 0)
				type = Type.A;
			else
				arg++;
			_class = DClass.value(argv[arg]);
			if (_class < 0)
				_class = DClass.IN;
			else
				arg++;
		}
		while (argv[arg].startsWith("-") && argv[arg].length() > 1) {
			switch (argv[arg].charAt(1)) {
			    case 'p':
				String portStr;
				int port;
				if (argv[arg].length() > 2)
					portStr = argv[arg].substring(2);
				else
					portStr = argv[++arg];
				port = Integer.parseInt(portStr);
				if (port < 0 || port > 65536) {
					System.out.println("Invalid port");
					return;
				}
				res.setPort(port);
				break;
			    case 'k':
				String key;
				if (argv[arg].length() > 2)
					key = argv[arg].substring(2);
				else
					key = argv[++arg];
				int index = key.indexOf('/');
				if (index < 0)
					res.setTSIGKey(key);
				else
					res.setTSIGKey(key.substring(0, index),
						       key.substring(index+1));
				break;
			    case 't':
				res.setTCP(true);
				break;
			    case 'i':
				res.setIgnoreTruncation(true);
				break;
			    case 'e':
				String ednsStr;
				int edns;
				if (argv[arg].length() > 2)
					ednsStr = argv[arg].substring(2);
				else
					ednsStr = argv[++arg];
				edns = Integer.parseInt(ednsStr);
				if (edns < 0 || edns > 1) {
					System.out.println("Unsupported " +
							   "EDNS level: " +
							   edns);
					return;
				}
				res.setEDNS(edns);
				break;
			    case 'd':
			    	opt = new OPTRecord((short)1280, (byte)0,
						    (byte)0, Flags.DO);
				break;
			    case 'q':
			    	printQuery = true;
				break;
			    default:
				System.out.print("Invalid option");
				System.out.println(argv[arg]);
			}
			arg++;
		}
	}
	catch (ArrayIndexOutOfBoundsException e) {
		if (name == null)
			usage();
	}
	rec = Record.newRecord(name, type, _class);
	query = Message.newQuery(rec);
	if (opt != null)
		query.addRecord(opt, Section.ADDITIONAL);
	if (printQuery)
		System.out.println(query);
	response = res.send(query);
	if (type == Type.AXFR)
		doAXFR(response);
	else
		doQuery(response);
}

Output:
public static void
main(String argv[]) throws IOException {
	String server;
	int arg;
	Message query, response;
	Record rec;
	Record opt = null;
	Resolver res = null;
	boolean printQuery = false;
	if (argv.length < 1) {
		usage();
	}
	try {
		arg = 0;
		if (argv[arg].startsWith("@")) {
			server = argv[arg++].substring(1);
			res = new SimpleResolver(server);
		}
		else
			res = new ExtendedResolver();
		String nameString = argv[arg++];
		if (nameString.equals("-x")) {
			name = new Name(dns.inaddrString(argv[arg++]));
			type = Type.PTR;
			_class = DClass.IN;
		}
		else {
			name = new Name(nameString);
			type = Type.value(argv[arg]);
			if (type < 0)
				type = Type.A;
			else
				arg++;
			_class = DClass.value(argv[arg]);
			if (_class < 0)
				_class = DClass.IN;
			else
				arg++;
		}
		while (argv[arg].startsWith("-") && argv[arg].length() > 1) {
			switch (argv[arg].charAt(1)) {
			    case 'p':
				String portStr;
				int port;
				if (argv[arg].length() > 2)
					portStr = argv[arg].substring(2);
				else
					portStr = argv[++arg];
				port = Integer.parseInt(portStr);
				if (port < 0 || port > 65536) {
					System.out.println("Invalid port");
					return;
				}
				res.setPort(port);
				break;
			    case 'k':
				String key;
				if (argv[arg].length() > 2)
					key = argv[arg].substring(2);
				else
					key = argv[++arg];
				int index = key.indexOf('/');
				if (index < 0)
					res.setTSIGKey(key);
				else
					res.setTSIGKey(key.substring(0, index),
						       key.substring(index+1));
				break;
			    case 't':
				res.setTCP(true);
				break;
			    case 'i':
				res.setIgnoreTruncation(true);
				break;
			    case 'e':
				String ednsStr;
				int edns;
				if (argv[arg].length() > 2)
					ednsStr = argv[arg].substring(2);
				else
					ednsStr = argv[++arg];
				edns = Integer.parseInt(ednsStr);
				if (edns < 0 || edns > 1) {
					System.out.println("Unsupported " +
							   "EDNS level: " +
							   edns);
					return;
				}
				res.setEDNS(edns);
				break;
			    case 'd':
			    	opt = new OPTRecord((short)1280, (byte)0,
						    (byte)0, Flags.DO);
				break;
			    case 'q':
			    	printQuery = true;
				break;
			    default:
				System.out.print("Invalid option: ");
				System.out.println(argv[arg]);
			}
			arg++;
		}
	}
	catch (ArrayIndexOutOfBoundsException e) {
		if (name == null)
			usage();
	}
	rec = Record.newRecord(name, type, _class);
	query = Message.newQuery(rec);
	if (opt != null)
		query.addRecord(opt, Section.ADDITIONAL);
	if (printQuery)
		System.out.println(query);
	response = res.send(query);
	if (type == Type.AXFR)
		doAXFR(response);
	else
		doQuery(response);
}


Input:
    protected void reloadConfigFile() throws NicoLiveAlertException {
        File configFile = new File(getDataFolder(), "config.yml");
        if ( !configFile.exists() ) {
            Utility.copyFileFromJar(getFile(), configFile, "config_ja.yml", false);
        }
        reloadConfig();
        FileConfiguration config = getConfig();
        community = config.getStringList("community");
        if ( community == null ) {
            community = new ArrayList<String>();
        }
        user = config.getStringList("user");
        if ( user == null ) {
            user = new ArrayList<String>();
        }
        Object communityNicknames_temp = config.get("communityNicknames");
        if ( communityNicknames_temp != null ) {
            communityNicknames = (MemorySection)communityNicknames_temp;
        }
        Object userNicknames_temp = config.get("userNicknames");
        if ( userNicknames_temp != null ) {
            userNicknames = (MemorySection)userNicknames_temp;
        }
        messageTemplate = Utility.replaceColorCode(
                config.getString("messageTemplate", "&cニコ生 [$com]で[$title]が開始しました！&r") );
        messageTemplate2 = Utility.replaceColorCode(
                config.getString("messageTemplate2", "") );
        messageTemplate3 = Utility.replaceColorCode(
                config.getString("messageTemplate3", "") );
        messageTemplate4 = Utility.replaceColorCode(
                config.getString("messageTemplate4", "") );
        messageTemplate5 = Utility.replaceColorCode(
                config.getString("messageTemplate5", "") );
        messageTemplateURL = config.getString("messageTemplateURL",
                "{\"text\":\"＞放送ページはこちら！＜\","
                + "\"color\":\"red\",\"underlined\":\"true\",\"clickEvent\":{"
                + "\"action\":\"open_url\",\"value\":\"$url\"}}");
        titleKeywords = config.getStringList("titleKeywords");
        if ( titleKeywords == null ) {
            titleKeywords = new ArrayList<String>();
        }
    }

Output:
    protected void reloadConfigFile() throws NicoLiveAlertException {
        File configFile = new File(getDataFolder(), "config.yml");
        if ( !configFile.exists() ) {
            Utility.copyFileFromJar(getFile(), configFile, "config_ja.yml", false);
        }
        reloadConfig();
        FileConfiguration config = getConfig();
        community = config.getStringList("community");
        if ( community == null ) {
            community = new ArrayList<String>();
        }
        user = config.getStringList("user");
        if ( user == null ) {
            user = new ArrayList<String>();
        }
        Object communityNicknames_temp = config.get("communityNicknames");
        if ( communityNicknames_temp != null ) {
            communityNicknames = (MemorySection)communityNicknames_temp;
        }
        Object userNicknames_temp = config.get("userNicknames");
        if ( userNicknames_temp != null ) {
            userNicknames = (MemorySection)userNicknames_temp;
        }
        messageTemplate = Utility.replaceColorCode(
                config.getString("messageTemplate", "&cニコ生が開始しました！") );
        messageTemplate2 = Utility.replaceColorCode(
                config.getString("messageTemplate2", "&bコミュニティ：$com") );
        messageTemplate3 = Utility.replaceColorCode(
                config.getString("messageTemplate3", "&b放送者：$user") );
        messageTemplate4 = Utility.replaceColorCode(
                config.getString("messageTemplate4", "&b$title") );
        messageTemplate5 = Utility.replaceColorCode(
                config.getString("messageTemplate5", "") );
        messageTemplateURL = config.getString("messageTemplateURL",
                "{\"text\":\"＞放送ページはこちら！＜\","
                + "\"color\":\"red\",\"underlined\":\"true\",\"clickEvent\":{"
                + "\"action\":\"open_url\",\"value\":\"$url\"}}");
        titleKeywords = config.getStringList("titleKeywords");
        if ( titleKeywords == null ) {
            titleKeywords = new ArrayList<String>();
        }
    }


Input:
	public String defaultSInvariantType(SInvariantType node,
			PrettyPrinterEnv question) throws AnalysisException
	{
		ILexNameToken name = null;
		switch(node.kindSInvariantType())
		{
			case ANamedInvariantType.kindSInvariantType:
				name = ((ANamedInvariantType)node).getName();
				break;
			case ARecordInvariantType.kindSInvariantType:
				name = ((ARecordInvariantType)node).getName();
				break;
		}
		if(name !=null)
		{
			if(name.getModule()!=null && !name.getModule().equals(question.getClassName()))
			{
				return name.module+"`"+name.getFullName();
			}
			return name.getFullName();
		}
		return "unresolved";
	}

Output:
	public String defaultSInvariantType(SInvariantType node,
			PrettyPrinterEnv question) throws AnalysisException
	{
		ILexNameToken name = null;
		switch(node.kindSInvariantType())
		{
			case ANamedInvariantType.kindSInvariantType:
				name = ((ANamedInvariantType)node).getName();
				break;
			case ARecordInvariantType.kindSInvariantType:
				name = ((ARecordInvariantType)node).getName();
				break;
		}
		if(name !=null)
		{
			if(name.getModule()!=null && !name.getModule().equals(question.getClassName()))
			{
				return name.getModule()+"`"+name.getFullName();
			}
			return name.getFullName();
		}
		return "unresolved";
	}


Input:
	public void startTickRun(int stage, long delta) throws InterruptedException {
		switch (stage) {
			case 0: {
				if(!spawnQueue.isEmpty()) {
					SpoutEntity e;
					while ((e = (SpoutEntity)spawnQueue.poll()) != null) {
						this.allocate(e);
						EntitySpawnEvent event = new EntitySpawnEvent(e, e.getPoint());
						Spout.getGame().getEventManager().callEvent(event);
						if (event.isCancelled()) {
							this.deallocate((SpoutEntity) e);
						}
					}
				}
				if(!removeQueue.isEmpty()) {
					SpoutEntity e;
					while ((e = (SpoutEntity)removeQueue.poll()) != null) {
						this.deallocate(e);
					}
				}
				float dt = delta / 1000.f;
				for (SpoutEntity ent : entityManager) {
					try {
						ent.onTick(dt);
					} catch (Exception e) {
						Spout.getGame().getLogger().severe("Unhandled exception during tick for " + ent.toString());
						e.printStackTrace();
					}
				}
				World world = getWorld();
				int[] updates;
				synchronized (queuedPhysicsUpdates) {
					updates = queuedPhysicsUpdates.toArray();
					queuedPhysicsUpdates.clear();
				}
				for (int key : updates) {
					int x = TByteTripleHashSet.key1(key);
					int y = TByteTripleHashSet.key2(key);
					int z = TByteTripleHashSet.key3(key);
					Chunk chunk = chunks[x >> Chunk.CHUNK_SIZE_BITS][y >> Chunk.CHUNK_SIZE_BITS][z >> Chunk.CHUNK_SIZE_BITS].get();
					if (chunk != null) {
						BlockMaterial material = chunk.getBlockMaterial(x, y, z);
						if (material.hasPhysics()) {
							material.onUpdate(world, x + (this.x << blockShifts), y + (this.y << blockShifts), z + (this.z << blockShifts));
						}
					}
				}
				for(int i = 0; i < LIGHT_PER_TICK; i++) {
					SpoutChunk toLight = lightingQueue.poll();
					if (toLight == null) break;
					if (toLight.isLoaded()) {
						toLight.processQueuedLighting();
					}
				}
				for(int i = 0; i < POPULATE_PER_TICK; i++) {
					Chunk toPopulate = populationQueue.poll();
					if (toPopulate == null) break;
					if (toPopulate.isLoaded()) {
						toPopulate.populate();
					}
				}
				Chunk toUnload = unloadQueue.poll();
				if (toUnload != null) {
					toUnload.unload(true);
				}
				break;
			}
			case 1: {
				for (SpoutEntity ent : entityManager) {
					try {
						ent.resolve();
					} catch (Exception e) {
						Spout.getGame().getLogger().severe("Unhandled exception during tick resolution for " + ent.toString());
						e.printStackTrace();
					}
				}
				break;
			}
			default: {
				throw new IllegalStateException("Number of states exceeded limit for SpoutRegion");
			}
		}
	}

Output:
	public void startTickRun(int stage, long delta) throws InterruptedException {
		switch (stage) {
			case 0: {
				if(!spawnQueue.isEmpty()) {
					SpoutEntity e;
					while ((e = (SpoutEntity)spawnQueue.poll()) != null) {
						this.allocate(e);
						EntitySpawnEvent event = new EntitySpawnEvent(e, e.getPosition());
						Spout.getGame().getEventManager().callEvent(event);
						if (event.isCancelled()) {
							this.deallocate((SpoutEntity) e);
						}
					}
				}
				if(!removeQueue.isEmpty()) {
					SpoutEntity e;
					while ((e = (SpoutEntity)removeQueue.poll()) != null) {
						this.deallocate(e);
					}
				}
				float dt = delta / 1000.f;
				for (SpoutEntity ent : entityManager) {
					try {
						ent.onTick(dt);
					} catch (Exception e) {
						Spout.getGame().getLogger().severe("Unhandled exception during tick for " + ent.toString());
						e.printStackTrace();
					}
				}
				World world = getWorld();
				int[] updates;
				synchronized (queuedPhysicsUpdates) {
					updates = queuedPhysicsUpdates.toArray();
					queuedPhysicsUpdates.clear();
				}
				for (int key : updates) {
					int x = TByteTripleHashSet.key1(key);
					int y = TByteTripleHashSet.key2(key);
					int z = TByteTripleHashSet.key3(key);
					Chunk chunk = chunks[x >> Chunk.CHUNK_SIZE_BITS][y >> Chunk.CHUNK_SIZE_BITS][z >> Chunk.CHUNK_SIZE_BITS].get();
					if (chunk != null) {
						BlockMaterial material = chunk.getBlockMaterial(x, y, z);
						if (material.hasPhysics()) {
							material.onUpdate(world, x + (this.x << blockShifts), y + (this.y << blockShifts), z + (this.z << blockShifts));
						}
					}
				}
				for(int i = 0; i < LIGHT_PER_TICK; i++) {
					SpoutChunk toLight = lightingQueue.poll();
					if (toLight == null) break;
					if (toLight.isLoaded()) {
						toLight.processQueuedLighting();
					}
				}
				for(int i = 0; i < POPULATE_PER_TICK; i++) {
					Chunk toPopulate = populationQueue.poll();
					if (toPopulate == null) break;
					if (toPopulate.isLoaded()) {
						toPopulate.populate();
					}
				}
				Chunk toUnload = unloadQueue.poll();
				if (toUnload != null) {
					toUnload.unload(true);
				}
				break;
			}
			case 1: {
				for (SpoutEntity ent : entityManager) {
					try {
						ent.resolve();
					} catch (Exception e) {
						Spout.getGame().getLogger().severe("Unhandled exception during tick resolution for " + ent.toString());
						e.printStackTrace();
					}
				}
				break;
			}
			default: {
				throw new IllegalStateException("Number of states exceeded limit for SpoutRegion");
			}
		}
	}


Input:
	public static MessageToMediationService valueOf(String json) {
		try {
			JSONObject o = new JSONObject(json);
			String webapp =o.getString("webappname");
			String entityTesto =o.getString("entityTesto");
			int entityId =o.getInt("entityId");
			MessageToMediationService messageToMediationService = new MessageToMediationService(webapp,entityId,entityTesto);
			messageToMediationService.setMediationApproved(o.getBoolean("mediationApproved"));
			messageToMediationService.setParseApproved(o.getBoolean("parseApproved"));
			messageToMediationService.setTimestamp(o.getLong("timestamp"));
			messageToMediationService.setNote(o.getString("note"));
			return messageToMediationService;
		} catch (JSONException e) {
			return null;
		}
	}

Output:
	public static MessageToMediationService valueOf(String json) {
		try {
			JSONObject o = new JSONObject(json);
			String webapp =o.getString("webappname");
			String entityTesto =o.getString("entityTesto");
			int entityId =o.getInt("entityId");
			MessageToMediationService messageToMediationService = new MessageToMediationService(webapp,entityId,entityTesto);
			messageToMediationService.setMediationApproved(o.getBoolean("mediationApproved"));
			messageToMediationService.setParseApproved(o.getBoolean("parseApproved"));
			messageToMediationService.setTimestamp(o.getLong("timestamp"));
			if(o.has("note"))
			messageToMediationService.setNote(o.getString("note"));
			return messageToMediationService;
		} catch (JSONException e) {
			return null;
		}
	}


Input:
	public static boolean checkImpl(String methodPrefix, Class<?>... parameters) {
		if (parameters[0] == null) {
			System.err.println("Error: CheckImpl() first class parameter was null.");
			return false;
		}
		if (!(Zone.class.isAssignableFrom(parameters[0]))) {
			System.err
					.println("Error: CheckImpl() first class parameter ("
							+ parameters[0]
							+ ") was not Zone or a subclass, please give the current Zone class (using this.getClass()) as the first class parameter.");
			return false;
		}
		Method impl = null;
		try {
			Class<?>[] firstRemoved = new Class<?>[parameters.length - 1];
			System.arraycopy(parameters, 1, firstRemoved, 0, parameters.length - 1);
			if (Zone.class.getDeclaredMethod(methodPrefix + "Impl", firstRemoved) != null) {
				try {
					impl = parameters[0].getDeclaredMethod(methodPrefix + "Impl", firstRemoved);
				}
				catch (Exception e) {}
				if (impl == null) {
					try {
						impl = parameters[0].getDeclaredMethod(methodPrefix + "Impl", parameters);
						if (impl != null) {
							System.err
									.println(methodPrefix
											+ "Impl() in the class "
											+ parameters[0].getName()
											+ " should not have Zone as a parameter, please remove it to override "
											+ methodPrefix + "Impl() correctly.");
							impl = null;
						}
					}
					catch (Exception e) {}
				}
			}
		}
		catch (Exception e) {}
		if (impl == null && parameters[0].getSuperclass() != null
				&& parameters[0].getSuperclass() != Zone.class && parameters[0] != Zone.class) {
			Class<?> superClass = parameters[0].getSuperclass();
			Class<?>[] firstSupered = new Class<?>[parameters.length];
			System.arraycopy(parameters, 0, firstSupered, 0, parameters.length);
			firstSupered[0] = superClass;
			if (checkImpl(methodPrefix, firstSupered)) {
				return true;
			}
		}
		if (impl == null) {
			return false;
		}
		else {
			return true;
		}
	}

Output:
	public static boolean checkImpl(String methodPrefix, Class<?>... parameters) {
		if (parameters[0] == null) {
			System.err.println("Error: CheckImpl() first class parameter was null.");
			return false;
		}
		if (!(Zone.class.isAssignableFrom(parameters[0]))) {
			System.err
					.println("Error: CheckImpl() first class parameter ("
							+ parameters[0]
							+ ") was not Zone or a subclass, please give the current Zone class (using this.getClass()) as the first class parameter.");
			return false;
		}
		Method impl = null;
		try {
			Class<?>[] firstRemoved = new Class<?>[parameters.length - 1];
			System.arraycopy(parameters, 1, firstRemoved, 0, parameters.length - 1);
			if (parameters[0].getSuperclass().getDeclaredMethod(methodPrefix + "Impl", firstRemoved) != null) {
				try {
					impl = parameters[0].getDeclaredMethod(methodPrefix + "Impl", firstRemoved);
				}
				catch (Exception e) {}
				if (impl == null) {
					try {
						impl = parameters[0].getDeclaredMethod(methodPrefix + "Impl", parameters);
						if (impl != null) {
							System.err
									.println(methodPrefix
											+ "Impl() in the class "
											+ parameters[0].getName()
											+ " should not have Zone as a parameter, please remove it to override "
											+ methodPrefix + "Impl() correctly.");
							impl = null;
						}
					}
					catch (Exception e) {}
				}
			}
		}
		catch (Exception e) {}
		if (impl == null && parameters[0].getSuperclass() != null
				&& parameters[0].getSuperclass() != Zone.class && parameters[0] != Zone.class) {
			Class<?> superClass = parameters[0].getSuperclass();
			Class<?>[] firstSupered = new Class<?>[parameters.length];
			System.arraycopy(parameters, 0, firstSupered, 0, parameters.length);
			firstSupered[0] = superClass;
			if (checkImpl(methodPrefix, firstSupered)) {
				return true;
			}
		}
		if (impl == null) {
			return false;
		}
		else {
			return true;
		}
	}