private List getSavedtimes() { StringBuilder depart_class = new StringBuilder(); if (!cno.equals("")) { depart_class.append(cno); } else { depart_class.append("_"); } if (!sno.equals("")) { depart_class.append(sno); } else { depart_class.append("__"); } if (!dno.equals("")) { depart_class.append(dno); } else { depart_class.append("_"); } if (!gno.equals("")) { depart_class.append(gno); } else { depart_class.append("_"); } if (!zno.equals("")) { depart_class.append(zno); } else { depart_class.append("_"); } StringBuilder sql = new StringBuilder( "SELECT e.Oid as emplOid, d.school_year, cdo.name as optName,cl.ClassName, e.cname, c.chi_name, d.Oid, d.credit, d.opt, " + "d.thour, d.stu_select, d.techid, d.school_term, cl.ClassNo FROM CODE_DTIME_OPT cdo," + "((Savedtime d LEFT OUTER JOIN empl e ON d.techid=e.idno) " + "LEFT OUTER JOIN Dtime_class dc ON d.Oid=dc.Dtime_oid), Csno c, Class cl " + "WHERE cdo.id=d.opt AND cl.ClassNo=d.depart_class AND d.cscode=c.cscode AND d.school_term='" + term + "'AND d.school_year='" + year + "'"); if (!depart_class.equals("")) { sql.append("AND d.depart_class LIKE'" + depart_class + "%' "); } // 課程名稱是否模糊搜尋 if (cscode.indexOf(",") < 0) { sql.append("AND c.chi_name LIKE '%" + cscode + "%' "); } else { cscode = cscode.substring(0, cscode.indexOf(",")); sql.append("AND c.cscode = '" + cscode + "' "); } // 教師 if (!techid.equals("")) { sql.append("AND e.cname ='" + techid.substring(0, techid.indexOf(",")) + "' "); } sql.append(" GROUP BY d.Oid ORDER BY cl.ClassNo"); // return sortOut(df.sqlGet(sql.toString())); return sortOut(df.sqlGet(sql.toString()), false); }
private String parseInst(Instruction inst, int offset, Map<Integer, Integer> labels) throws ConstantPoolException { StringBuffer tmp = new StringBuffer(); StringBuilder tmp2 = new StringBuilder(); ParseVisitor parseVisitor = new ParseVisitorM6(labels, tmp2); // System.out.println(inst.toString()); tmp.append("(" + offset + " ("); if (labels.containsKey(inst.getPC())) { String label = "TAG_" + labels.get(inst.getPC()); tagTable.put(label, new Integer(offset)); tmp2.append(";;at " + label); } tmp.append(inst.accept(parseVisitor, null)).append("))"); // round the line length to multiple of 8. if (!tmp2.equals("")) { int pos = 20; while (pos <= tmp.length()) { pos += 20; } int bc = pos - tmp.length(); for (int j = 0; j < bc; j++) { tmp.append(" "); } tmp.append(tmp2); } return tmp.toString().trim(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; StripCapablePath that = (StripCapablePath) o; if (!mySourcePath.equals(that.mySourcePath)) return false; return true; }
private boolean hasCspChanged(@NotNull final StringBuilder cspText) { boolean result = !cspText.equals(lastCsp); // if it has changed remember what it changed to, for next time this method is called. if (result) { lastCsp.setLength(0); lastCsp.append(cspText); } return result; }
private void combine(int start) { for (int i = start; i < inputstring.length(); ++i) { output.append(inputstring.charAt(i)); if (!output.equals("")) { System.out.println(output); } if (i < inputstring.length()) { combine(i + 1); } output.setLength(output.length() - 1); } }
public String secToTime(long time) { final StringBuilder toreturn = new StringBuilder(); int years = 0; int weeks = 0; int days = 0; int hours = 0; int minutes = 0; if (time >= 33868800) { years = (int) (time / 33868800); time -= years * 33868800; toreturn.append(years + "y "); } if (time >= 604800) { weeks = (int) (time / 604800); time -= weeks * 604800; toreturn.append(weeks + "w "); } if (time >= 86400) { days = (int) (time / 86400); time -= days * 86400; toreturn.append(days + "d "); } if (time >= 3600) { hours = (int) (time / 3600); time -= hours * 3600; toreturn.append(hours + "h "); } if (time >= 60) { minutes = (int) (time / 60); time -= minutes * 60; toreturn.append(minutes + "m "); } if (toreturn.equals("") || (time > 0)) { toreturn.append((time) + "s "); } return toreturn.toString().trim(); }