method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fdf7652d-57d4-4e88-8bdc-3125e1b45d0a
5
public boolean isSyncMark(int headerstring, int syncmode, int word) { boolean sync = false; if (syncmode == INITIAL_SYNC) { //sync = ((headerstring & 0xFFF00000) == 0xFFF00000); sync = ((headerstring & 0xFFE00000) == 0xFFE00000); // SZD: MPEG 2.5 } else { sync = ((headerstring & 0xFFF80C00) ==...
0b61dcee-985f-47ed-adba-a51f05390561
9
public RBMParameters(String data_file) { int line_num = 1; try { BufferedReader br = new BufferedReader(new FileReader(data_file)); String line = br.readLine(); String[] ar = line.split("\\s+"); m = Integer.parseInt(ar[0]); n = Integer.parseInt(ar[1]); T = Integer.parseInt(ar[2]); _weights = ne...
4f45b16f-53b9-4477-8ac3-3ec5f6a88ab9
0
public void setLoginno(String loginno) { this.loginno = loginno; }
152fe75c-17ab-4051-883f-9f6878d8082e
3
public void testCompareTo() { YearMonth test1 = new YearMonth(2005, 6); YearMonth test1a = new YearMonth(2005, 6); assertEquals(0, test1.compareTo(test1a)); assertEquals(0, test1a.compareTo(test1)); assertEquals(0, test1.compareTo(test1)); assertEquals(0, test1a.compareTo...
53e987fd-d0a5-4f1b-a4da-faaea4e4518f
2
public boolean noticeChan(String chan, String msg){ boolean success = true; String[] msgSplit = msg.split("\n"); for(int i=0;i<msgSplit.length;i++) { if(!sendln("NOTICE " + chan + " :" + msgSplit[i]) ) { success = false; } } return success; }
fd5e8363-4cea-448d-9432-2d23a9b01ffd
6
private List<PartyResults> internalCalculations(List<Party> list){ int chair = 0; int votes = 0; int counter = 0; if (!(list.size()>0)) return results; // Set to 0 totalVotes, not already calculated totalVotes=0; totalChairs=0; results.clear(); for (Iterator it = list.iterator(); it.hasNext();) {...
ecafabff-c269-4ce1-ab5c-8c85d69e8775
8
private ArrayList<Sprite> makeNewSpriteArray(int sheepNum, int snailNum, int raccoonNum, int pandaNum , int amountToAdd) { ArrayList<Sprite> makeObstacle = new ArrayList<Sprite>(); for(int i = 0; i < sheepNum; i++){ Sprite makeSheep = new Sheep(CountryRunnerTitleScreen.difficulty); makeObstacle.add(...
4fa3b71c-4b92-44aa-a8df-3eadbda094c0
1
public void actionPerformed(ActionEvent ae){ String message = jtxtfldEnterMessage.getText(); if(validateMessage(message)){ ChatMessage chatMessage = new ChatMessage(user.getNick(), user.getID(), channel.getChannelID(), jtxtfldEnterMessage.getText()); writtenMessages.add(chatMessage); jtxtfldEnterMessa...
47e330d8-7989-41f8-8fa2-c210908dc33a
8
public boolean fire(int r, int c) throws IOException { if (1 > r || 1 > c || 10 < r || 10 < c) { invalidShot = true; } else { switch (board[r][c]) { case "x": case "!": return unavailibleShot(); case "-": return missedShot(r, c); ...
520ffa62-4b30-45eb-b984-076a9480d7f3
6
public boolean run() { int i; ok = false; stdout.clear(); stderr.clear(); try { String line; String[] cmd = command.split(" "); ProcessBuilder pb= new ProcessBuilder(cmd); pb.redirectErrorStream(true); ...
9921874c-38c1-45f2-9afb-f5b9ded9f953
2
public List<?> list(Class<?> clazz) { String simpleName = clazz.getSimpleName(); String hql = "from " + clazz.getName() + " " + simpleName; return getSession().createQuery(hql).list(); }
1dc99cd2-e2ed-448c-baea-4d83d9faad99
6
public double ranGamma(double k, double theta) { boolean accept = false; if (k < 1) { // Weibull algorithm double c = (1 / k); double d = ((1 - k) * Math.pow(k, (k / (1 - k)))); double u, v, z, e, x; do { u = rand.nextDouble(...
1b184214-982b-486f-bd71-be042670195d
5
public void setNeighbors( int[] truckdrivin){ for(int g = 0; g <= truckdrivin.length-1; g++){ switch(inmode){ case 0: break; case 1: if(truckdrivin[g] > 0){neighborstate[g] = 1;} else{neighborstate[g] = 0;} break; case 2: neighborstate[g] = truckdrivin[g]; break; default: neighborstate[g] = t...
3c8a163e-47d6-4fa1-a901-8ed5f166d28f
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
ea07b436-cc9c-49d9-a3d6-b0d200ece12e
2
private void processFunctions(FileData coverageData, StringBuilder lcov) { int total = 0; int hit = 0; for (int functionNumber = 0; functionNumber < coverageData.getFunctions().size(); functionNumber++) { total++; Integer functionHits = coverageData.getFunctions().get(fun...
50f93bbc-0c19-4efb-a921-062e7ab07a01
5
private RequestDispatcher goRegistrazione(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("username") == null || request.getParameter("password") == null || request.getParameter("password2") == null) { return getServletContext...
8d9c57bc-49f5-4af3-a45b-8115a88cad04
9
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final EventsType other = (EventsType) obj; if (this.row != other.row) { return false; } ...
b4a7ba0a-070c-466b-a4a3-7ae9cb9e635e
5
public boolean mousedown(Coord c, int button) { for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) { if (!wdg.visible) continue; Coord cc = xlate(wdg.c, true); if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) { if (wdg.mousedown(c.add(cc.inv()), button)) { return (true); } } }...
b56df41c-9a02-44c4-a071-3732232fc3e0
0
public void setLineEndingAtEnd(boolean lineEndingAtEnd) { this.lineEndingAtEnd = lineEndingAtEnd; }
00b097da-509a-4d6f-8851-fde5312638c1
9
public static String escapeIllegalXpathSearchChars(String s) { StringBuilder sb = new StringBuilder(); sb.append(s.substring(0, (s.length() - 1))); char c = s.charAt(s.length() - 1); // NOTE: keep this in sync with _ESCAPED_CHAR below! if (c == '!' || c == '(' || c == ':' || c ==...
7e3ee0a8-33e3-4f5c-a865-aec9ce8997ea
3
String token() { if (idx == null && val.getClass().isArray()) { int len = Array.getLength(val); StringBuilder b = new StringBuilder(); for (int i = 0; i < len - 1; i++) { b.append(token + "[" + i + "],"); } b...
be233d95-939a-476a-846e-ca7418fc85bf
5
static void parcoursArbre(Element e) { String s = ""; if (e.getAttributeValue("type").equals("node")) { //l'élément est un noeud Element question = e.getChild("question"); s += question.getAttributeValue("name") + "<"; s += question.getAttributeValue("patron") + " ?"; System.out.p...
4260fd12-35d4-4e5b-b33e-f1a34b7cda1a
4
private void doFirstStep(Vertex<Text, Text, NullWritable> vertex) { // First superstep is special, because we can simply look at the neighbors // On first step value is not set, so using id Text currentComponent = vertex.getId(); for (Edge<Text, NullWritable> edge : vertex.getEdges()) {...
0eef74e7-598c-46d1-8e1f-509acdbb2c06
9
private static BeanInfo getExplicitBeanInfo(Class<?> beanClass) { String beanInfoClassName = beanClass.getName() + "BeanInfo"; //$NON-NLS-1$ try { return loadBeanInfo(beanInfoClassName, beanClass); } catch (Exception e) { // fall through } int index = bea...
4f1637af-7286-495b-91a8-906792bd18ec
9
@Override public AcknowledgementService handle(LocalDevice localDevice, Address from, OctetString linkService) throws BACnetException { AtomicWriteFileAck response; BACnetObject obj; FileObject file; try { // Find the file. obj = localDevice.getOb...
4c326fab-fafc-4d8f-9fcc-0236ad405851
2
public void increment(int by) { // if given value is negative, we have to decrement if (by < 0) { decrement(Math.abs(by)); return; } // check if we would overflow int space_up = max - value; if (by > space_up) { // we simply use max value = max; } else { // no overflowing, this is easy ...
a7c19efc-57b5-4af2-a437-1bc172fef345
7
@Override public Iterator<T> iterator() { return new Iterator<T>() { boolean hasNext; T next; final Iterator<? extends T> i1 = s1.iterator(); Iterator<? extends T> i2; @Override public boolean hasNext() { if (i1.hasNex...
c9385898-b223-4be2-8d61-fc88bf9d7373
1
public String getQuery() { if (_query == null) throw new java.util.NoSuchElementException(); return _query; }
bbd81e44-af95-45ca-9649-5c9b188a4f69
4
public void setWalkable(int x, int y, boolean bool) { if(x < 0 || x > width || y < 0 || y > height){ throw new IllegalArgumentException("X & Y must be more than 0, but less than w/h"); } nodes[x][y].setWalkable(bool); }
87cddb9c-92d4-4586-a72a-d573954d82ee
0
public static void main(String[] args) { // Nature creates two new animals, gives sparrow the ability to fly. System.out.println("Nature provides birdy the ability to fly."); System.out.println("Nature doesn't give kitty the abilty to fly."); Cat kitty = new Cat("kitty", 6f, new NoFlyingAbilty()); Sparrow bir...
77610760-5b27-4819-abab-6b4097375685
8
protected String toXMLFragment() { StringBuffer xml = new StringBuffer(); if (isSetTokenId()) { xml.append("<TokenId>"); xml.append(escapeXML(getTokenId())); xml.append("</TokenId>"); } if (isSetFriendlyName()) { xml.append("<FriendlyName>"...
18adaa32-2332-4022-a56b-6de344fe0828
0
public String getContent() { return mContent; }
5aa7470a-d2b0-4892-8ce5-f79e53a4ba87
6
public void Email(JTextField a) { a.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (Character.isLetterOrDigit(c) || c == '_' || c == '-' || c == '@' || c == '.' || c == 'ñ') { }else...
7eb2f04c-a111-4bb5-bc33-a4dbbce55fb8
9
public void update(long deltaMs) { ArrayList<BaseProcess> toAttach = new ArrayList<BaseProcess>(); Iterator<BaseProcess> it = processes.iterator(); while(it.hasNext()) { BaseProcess current = it.next(); if(current.getState() == BaseProcess.P...
a47ca7ad-22fb-46ba-96fd-1e6e963b6a69
0
public void mouseDragged(MouseEvent e) { mouseMoved(e); }
dc7c5b7f-968b-4e1f-8fad-f9f10a288f78
4
public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; super.paintComponent(g2); // Draw randomly generated nodes for (Node p : myGraph.getNodes()) drawPoint(g2, p.x, p.y); //Draw selected Nodes g2.setColor(Color.blue); if (fromNode != null) ...
5b532dc5-187e-414e-adb9-e03302388e8d
3
@SuppressWarnings("SleepWhileInLoop") private Repository forkAndWait(GitHubClient gitHubClient, Repository masterRepository) throws IOException { Properties properties = ApplicationProperties.getProperties(); RepositoryService repositoryService = new RepositoryService(gitHubClient); Reposito...
b2babeff-ef53-416e-86ef-7acf25d5c7d7
3
public Class getTypeClass() throws ClassNotFoundException { switch (typecode) { case TC_LONG: return Long.TYPE; case TC_FLOAT: return Float.TYPE; case TC_DOUBLE: return Double.TYPE; default: throw new AssertError("getTypeClass() called on illegal type"); } }
77591b78-9755-41f6-a5e7-fc68ed090ad7
8
@Override public void e(float sideMot, float forMot) { if (this.passenger == null || !(this.passenger instanceof EntityHuman)) { super.e(sideMot, forMot); this.W = 0.5F; // Make sure the entity can walk over half slabs, // instead of jumping return; } EntityHuman human = (EntityHuman) this.passe...
c4b54649-13f6-407e-acb1-e5c9f041d5a8
8
public boolean equals(Object o) { if ( !(o instanceof DTNode) ) return false; if ( o == this ) return true; DTNode n = (DTNode)o; if ( n.left_bit != left_bit ) return false; if ( n.right_bit != right_bit ) return false; if ( !n.label.equals(label) ) return false; ...
3937c7b4-cef8-4b85-8547-718c37a5755c
7
public void checkType(Symtab st) { exp1.setScope(scope); exp1.checkType(st); exp2.setScope(scope); exp2.checkType(st); String exp1Type = exp1.getType(st); String exp2Type = exp2.getType(st); if (!exp1Type.equals(exp2Type)) { if (!(st.lookup(exp1Type) != null && exp2Type.equals("null"))) { if (!exp1...
1ce8c1ea-0f61-4524-ac78-4072996faab8
0
public void setProduct(Product product) { this.product = product; }
fdff13f9-656d-4c6b-bcd3-7ec3ff37a3f7
4
public boolean collision(int index1, int index2) { if (getImage(index1) == null || getImage(index2) == null) { return false; } if (getImage(index1).getBounds().intersects( getImage(index2).getBounds())) { return (getImage(index1).isActive() && getImage(index2).isActive()); } return false; }
03daf4d0-1266-4e39-84b7-24e9349af34c
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
619297fc-d558-44df-b67c-c7e39df19365
7
private String expresion(Nodo chk){ String tem=new String(); Iterator e=chk.getNodo().iterator(); switch(chk.getToken()){ case Suma: tem+=this.expresion(((Nodo)e.next())); tem+=this.expresion(((Nodo)e.next())); tem+="\n...
407f8e2e-8b11-4f4b-865d-43314d4c4fb1
3
@Override public void restart() throws MusicPlayerException { if ( this.mStreamPlayerRunnable == null ) { throw new IllegalStateException( "can't restart. not started yet" ); } if ( this.mStreamPlayerRunnable.isStopped() ) { try { this.mStreamPlayerRunnable.join(); } catch (InterruptedException e...
539d6265-aff1-41e7-a565-844482b1822a
4
private int pickAmount() { Random rand = new Random(); if (itemQuality == quality.poor) { return rand.nextInt(config.getPoorMaxAmount() - config.getPoorMinAmount() + 1) + config.getPoorMinAmount(); } else if (itemQuality == quality.average) { return rand.nextInt(config.ge...
d04d8e67-e30c-4ab4-bbea-ce58d64ebb90
1
public static List<Mixer> getMixers() { Info[] infos = AudioSystem.getMixerInfo(); List<Mixer> mixers = new ArrayList<Mixer>(infos.length); for (Info info : infos) { Mixer mixer = AudioSystem.getMixer(info); mixers.add(mixer); } return mixers; }
9007e278-9e0c-415b-8ede-9fede72f7eb0
3
private void btnAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAceptarActionPerformed if (inicio.principal.datos == null) { try { inicio.d.setAntiguedad(Integer.parseInt(txtAntiguedad.getText())); inicio.d.setHoraArma(Double.parseDouble(t...
d8baa08b-237d-4a2f-9125-c75f24ad16cb
7
public HashMap<String,String> getConfigurationData() { HashMap<String,String> l_tmp_map; Scanner l_reader; Scanner l_line_scanner; String l_tmp_key; String l_tmp_val; if( this.configuration_file == null) return null; l_tmp_map = new HashMap<String,String>(); l_reader =...
f8bf4128-7a01-4435-9038-50896f05a5c0
1
public JSONObject getJSONObject(int index) throws JSONException { Object o = get(index); if (o instanceof JSONObject) { return (JSONObject)o; } throw new JSONException("JSONArray[" + index + "] is not a JSONObject."); }
4713bc11-a452-4bd3-9339-7376ba16629a
0
public State getOldBlock() { return myOldBlock; }
19de1843-df17-41b6-ab6c-8f1692add580
5
public String consumeToIgnoreCase(String seq) { int start = pos; String first = seq.substring(0, 1); boolean canScan = first.toLowerCase().equals(first.toUpperCase()); // if first is not cased, use index of while (!isEmpty()) { if (matches(seq)) break; ...
13a48cc0-9087-4658-899b-e280b26c2567
0
public void setId(String id) { this.id = id; }
92ba4516-d909-402d-91d8-c3400528c0eb
3
public void setBullet(int id, int x, int y){ switch (id) { case 1:{ this.id = 1; this.pointX = x; this.pointY = y; this.bulletSpeed = 2; this.shotSpeed = 4; this.damage = 1...
4f6c1552-26e1-4a96-89c9-c24b1a874977
2
public void setComments(String comments) { if (comments != null && comments.trim().length() > 256) { comments = comments.substring(0, 256); } this.comments = comments; }
459ee551-b827-4fa3-aa2c-5751628401f7
0
public String getPassword() { return this.password; }
9943ff11-06cf-448d-9c93-755e353c94e2
3
public int put(int key, int n) { int pos, t = 1; while (t < m) { pos = toHash(key, t); if (table[pos] == null) { table[pos] = new HashEntry(key, t); // ???????????????????????????????????????????????????????????????????????????????????? // ...
e4066123-2d78-4146-bff4-01f98dcdf170
0
public int getScore() { return score; }
3e804656-4122-49e1-8173-ddf29b4fc6d1
3
public void loppuukoPeli() { if (this.logiikka.tarkistaVoitto(1)) { this.tekstiKentta.setText("Risti on voittaja!"); this.logiikka.setPelinTila(0); } else if (this.logiikka.tarkistaVoitto(2)) { this.tekstiKentta.setText("Nolla on voittaja!"); this.logiikka...
d2697ad5-1f2b-4a0d-be0c-bc25d46bab22
2
private void loadHighScore(){ try{ File f = new File(saveDataPath, fileName); if(!f.isFile()){ createSaveData(); } BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f))); highScore = Integer.parseInt(reader.readLine()); reader.close(); } catch(Exception...
aaf32f16-92f4-46e0-8b38-46d057c84846
3
private synchronized void seek(RandomAccessFile randomaccessfile, int pos) throws IOException { if (pos < 0 || pos > 0x3c00000) { System.out.println("Badseek - pos:" + pos + " len:" + randomaccessfile.length()); pos = 0x3c00000; try { Thread.sleep(1000L); } catch (Exception exception) { } } ran...
3818f4f7-8d3b-401d-8376-cd873396cc8e
9
public void nextPermutation(int[] num) { List<Integer> list = new ArrayList<Integer>(); int length = num.length; if(num == null||length == 0) return ; int big = num[length-1]; int target = num[length-1]; int index = -1; for(int i =num.length-1 ;i>0;i-...
635c4172-1acb-4f1d-9c7f-00b83b940feb
1
public boolean SetAnnounced(String player, Date newdate) { String datestr = ""; if (newdate != null) { datestr = new SimpleDateFormat("yyyy-MM-dd").format(newdate); } String query = "UPDATE birthdaygift SET lastAnnouncedDate=? WHERE player=?"; dbcon.PreparedUpdate(query, new String[]{datestr, player.toLowe...
ae24be2e-389e-410a-ae33-6daf0a76bdb7
5
private boolean testeSiegInReihe(Spieler spieler) { for (int reihennummer = 1; reihennummer <= Spielfeld.ANZAHL_REIHEN; reihennummer++){ int sequenceCounter = 0; for (int spaltennummer = 1; spaltennummer <= Spielfeld.ANZAHL_SPALTEN; spaltennummer++){ Stein steinfarbe = spielfeld.getSteinfarbe(spaltennummer,...
ee35bccd-553e-4e3b-a0a2-d4e1927699ac
2
@Override public boolean accept(File dir, String name) { try{ if (name.substring(name.lastIndexOf(".")).equalsIgnoreCase(".dat")) return true; } catch (Exception e){ } return false; }
e5536748-c4d2-4a62-a921-559c82c4368d
1
public void configureAction(Map<String, Object> config) { if (config == null) { this.task = null; this.gruntFile = null; this.page = null; } else { this.task = (String) config.get(Activator.KEY_TASK); this.gruntFile = (IFile) config.get(Activator.KEY_FILE); this.page = (IWorkbenchPage) config.get(...
b9429068-7061-44f4-99f5-57db6070eb1d
0
public Dysk produkujemyDysk(){ return new DyskDlaLaptopa(); }
fab96ca5-c1a4-4465-b785-761e78a7ee0b
3
public void print(ArrayList<Double> values, String fileName, ArrayList<String> description) { String outString = ""; if(!_titlesPrinted){ outString += "\n"; _titlesPrinted = true; for (int i = 0 ; i < description.size(); i ++){ outString += description.get(i)+","; } outString += "\n"; } for(i...
75f0d2f6-b8f8-4cb8-8dba-2312ee44375f
7
@Override public long getMass() { final long mass=this.mass; if(mass<0) { int newMass=phyStats().weight(); for(final Enumeration<Room> r=getProperMap(); r.hasMoreElements();) { final Room R=r.nextElement(); if(R!=null) { for(int i=0;i<R.numItems();i++) { final Item I=R.getIt...
ef92e365-45b0-4e6b-8369-c7a9b258322a
4
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300) { G.setColor(Color.DARK_GRAY); G.fillArc((int)(X-radius/2)-viewX, (int)(Y-radius/2)-viewY, radius, radius, 0, 360); G.setColor(Color.GRAY)...
49d1b08b-e8a4-4894-bd92-ecd04a235101
2
@Override @SuppressWarnings("unchecked") protected <E> E getApiResponse(AbstractContentHandler contentHandler, InputStream inputStream, Class<E> clazz) throws ApiException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); if (logger.isInfoEnabled()) { inputStream = new InputStreamSplitter(inp...
f52906b3-6590-4ea9-96db-e1e2bfcc73dd
7
protected void householder( int j ) { // find the element with the largest absolute value in the column and make a copy int index = j+j*numCols; double max = 0; for( int i = j; i < numRows; i++ ) { double d = u[i] = dataQR[index]; // absolute value of d ...
1d718ef0-b97e-49c3-8d14-5734b1a5fdf7
2
public void update(String key){ synchronized(this.cache){ U fromCache = cache.get(key); if(!(fromCache == null)){ ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream objOut; try{ objOut = new ObjectOutputStream(baos); objOut.writeObjec...
1b68c360-dd37-4616-bdf3-354729117291
8
@SuppressWarnings("unchecked") private void parseQuery(String query, Map<String, Object> parameters) throws UnsupportedEncodingException { if (query != null) { String pairs[] = query.split("[&]"); for (String pair : pairs) { String param[] = pair.split("[=]"); String key = null; String value = n...
1083e33f-1da4-4582-98c6-f951abdb4ead
8
@Override public void update(Document document) { NodeList node = null; NodeList items = null; Element element = null; node = document.getElementsByTagName("SomaticContext"); element = (Element) node.item(0); items = element.getElementsByTagName("FrameState"); if (!synchronizeMode && !updateFlag) ret...
699c9cb3-89cf-4322-b10c-5e54a7b68034
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PeopleInfo other = (PeopleInfo) obj; if (this.id != other.id && (this.id == null || !this.id.equals(other...
185e2b3a-213b-441e-917c-f6b994aa105d
6
private void readExcelFile(){ ArrayList<String> readTmp = new ArrayList<String>(); //儲存讀Excel用 Train tmp = new Train(); //儲存單筆火車用 try { InputStream excelFile = new FileInputStream("src/data_readme/Input_data_set_1.xls"); //要讀的檔案 jxl.Workbook readWorkBook = Workbook.getWorkbook(excelFile); //將其讀入work...
84e8135d-51b4-4bc0-80e2-e8c4a63f1663
0
@Test public void testFailingAssumptionWithoutTestLinkAnnotation() { assumeNoException(new IllegalStateException("Could not connect to server")); }
d076c228-4ce2-43b5-8c15-211c1dadfb72
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
4f9cfa8f-d35b-4f67-8b01-20652fddbc86
7
private int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(IOException e) { jjStopStringLiteralDfa_0(0, active0); return 1; } switch(curChar) { case 97: return jjMoveStringLiteralDfa2_0(active0, 0x30000L); case 100: ret...
a86760fe-d6e0-45ca-b529-6d02115cf8a8
3
private boolean isValidState(String state){ if(state.equals(WumpusConsts.STATE_ALIVE) || state.equals(WumpusConsts.STATE_DEAD) || state.equals(WumpusConsts.STATE_GOAL)) { return true; } return false; }
261b6631-e159-4862-bd41-9cab4266f86a
9
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(mob.isInCombat()) return Ability.QUALITY_INDIFFERENT; if(CMLib.flags().isSitting(mob)) return Ability.QUALITY_INDIFFERENT; if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false)) return Ability.QUALITY_INDIFFER...
44a40ab5-0c6f-41c0-8a21-2222c81e8ed8
0
public static void main(String[] args) { RendezvousObject robj = new RendezvousObject(); CallerThread cth = new CallerThread(robj); ServiceThread sth = new ServiceThread(robj); new Thread(cth, "Caller").start(); new Thread(sth, "Service").start(); }
693c2d9b-9cce-43f8-bd2e-e32a4f289a1e
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TimeStamp other = (TimeStamp) obj; if (procName == null) { if (other.procName != null) return false; } else if (!procName.equals(other.p...
20d077e5-0451-40bb-8e76-62406ce33375
0
@Override public void applyTemporaryToCurrent() { copyHashMap(tmp,cur); }
aef75cdc-f471-4c3c-8bb6-e12a2636ab3b
2
public static double quantile(double[] vals, double phi) { if (vals.length == 0) { return 0.0; } double[] sortedElements = Arrays.copyOf(vals, vals.length); Arrays.sort(sortedElements); int n = sortedElements.length; double index = phi * (n - 1); int...
a394c9a8-146d-4e52-add6-23995d199e8e
5
protected JTable createTable(final Transition transition) { TableModel model = createModel(transition); final TipLambdaCellRenderer[] renders = new TipLambdaCellRenderer[model .getColumnCount()]; for (int i = 0; i < model.getColumnCount(); i++) renders[i] = new TipLambdaCellRenderer(model.getColumnName(i))...
1a1dec55-18f9-43f3-be09-06fb57ae4f45
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
3e175337-5772-4bdb-8ae6-a30021ea732a
9
public void render(int xMovement, int yMovement) { if(RenderWallSprite) { for (int y = 0; y < height; y++) { int yp = y + yMovement; if (yp < 0 || yp >= height) continue; for (int x = 0; x < width; x++) { int xp = x + xMovement; if (xp < 0 || xp >= width) continue; int PR = wall.SIZE - 1...
353e2c6d-46c1-4a6d-83b2-cb41a17ab1ab
5
@Override public Vector2 mapSample(Vector2 sample) { sample.setX(sample.getX() * 2 - 1); sample.setY(sample.getY() * 2 - 1); double r; double phi; if (sample.getX() > -sample.getY()) if (sample.getX() > sample.getY()) { r = sample.getX(); phi = sample.getY() / sample.getX(); } else { r = sample.getY(); p...
ee2ebb66-d424-4dde-92d5-6191990d2737
9
public boolean makeMove(String move) { Field[][] fields = gameboard.getFields(); int centerX = fields.length/2; int centerY = fields[centerX].length/2; if((move.equals("N") && !gameboard.isMoveable(centerX, centerY-1)) || (move.equals("E") && !gameboard.isMoveable(centerX+1, centerY)) || (move.eq...
6cd11dbc-7c1e-4762-8d3a-d54372c7d0c1
8
private boolean addIfNeededToPruneSet(TagNode tagNode, CleanTimeValues cleanTimeValues) { if ( cleanTimeValues.pruneTagSet != null ) { for(ITagNodeCondition condition: cleanTimeValues.pruneTagSet) { if ( condition.satisfy(tagNode)) { addPruneNode(tagNode, cleanTim...
39d1b30d-7577-416b-be99-f3d42af949b4
1
public void draw(Graphics2D g2) { BufferedImage image = animation.getImage(action); if (lookingRight) { g2.drawImage(image, (int) xPos, (int) yPos, width, height, null); } else { g2.drawImage(image, (int) xPos + width, (int) yPos, -width, height, null); } }
559e19c8-666f-4e18-a9a0-7d58c9069d4b
9
* @throws Exception */ private JMethod generateCommandSignature(JDefinedClass jClusterInterface, ZclCommandDescriptor zclCommandDescriptor, boolean addContext) throws Exception { if (zclCommandDescriptor.isResponse()) return null; // FIXME: the return type depends on the returned response!!!! JType jR...
838ab303-8616-4ade-bc32-096a5e062c09
0
public void set(int index, int datum) { RangeCheck(index); data[index] = datum; }
ee2065c4-f6d2-407c-a55b-6dd9458b7a1d
9
private int[] getStyle(int index) { if (m_styleOffsets==null || m_styles==null || index>=m_styleOffsets.length) { return null; } int offset=m_styleOffsets[index]/4; int style[]; ...
b9e826d4-86c4-4fd9-b77d-eaae3cc420c9
5
public void insert(Pnode node){ count++; if(pq==null){ pq=node; } else if(pq.freq>node.freq){ node.next=pq; pq=node; } else{ Pnode temp = pq; Pnode prev = null; while(temp.next!=null && temp.freq<=nod...
6f0f1d33-f2fe-4957-a281-5c3b5badb71b
6
public void setWindow(LatLng center, double deltaLat, double deltaLng) { if (deltaLat == Double.NaN || deltaLat == Double.POSITIVE_INFINITY || deltaLat == Double.NEGATIVE_INFINITY) throw new IllegalArgumentException("Invalid latitude delta."); if (deltaLng == Double.NaN || deltaLng == Double.POSITIVE_INFINIT...
9505bc30-3789-45f0-9d28-30f1fc20569e
8
public void palyaEpites(Mezo[][] mezok, List<List<Mezo>> utvonalak) { this.utvonalak = utvonalak; createPrototypes(); karakterek = new ArrayList<GyuruSzovetsege>(); ellensegeSzama = 0; for (int x = 0; x < getMezok().length; x++) { for (int y = 0; y < getMezok()[x].length; y++) { getMezok()[x][y].setSzo...