method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b595575c-09a0-4a11-8c3f-7c0d850e8c59
2
private void fixup(Object bb) throws Exception { ArrayList<Integer> fixupLocations = fixup.get(bb); if(fixupLocations == null) { return; } int address = labels.get(bb); for(Integer i : fixupLocations) { int instruction = code.get(i); // determi...
d7556065-a911-462d-9a8d-949bbb060f3c
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...
e218c369-312e-4c3b-9dd0-a169cc25926e
1
public final static void println(String message) { if (enabled) { System.err.print("[DEBUG] "); System.err.println(message); }; };
0b570c86-935a-4314-81b9-7f28350ebd34
8
private void listagemDisc() { final Main m = new Main(); JLabel NomeDisc = new JLabel("Disciplinas:", JLabel.CENTER); String[] v5 = new String[m.disciplinas.size() + 1]; v5[0] = " "; for (int i = 1; i < m.disciplinas.size() + 1; i++) { v5[i] = m.disciplinas.get(i - 1...
c1b61344-61e4-4b7b-8d9c-c76895a9fb39
0
public boolean isSource() { return isSource; }
70ab7438-5f07-4aea-a5fd-2fad22983e20
5
public ArrayList<Photo> getPhotosByTag(ArrayList<String> tagValues) { ArrayList<Photo> photos = new ArrayList<Photo>(); Collection<Album> albums = GuiView.control.getCurrentUser().getAlbumList().values(); ArrayList<Album> a = new ArrayList<Album>(albums); for (int x = 0; x < a.size(); x++) { Collection<Photo...
5eb895c4-4985-477a-9ef5-8448c262d32d
9
private void getMainlyInfo() throws ParserException { parser.setLexer(new Lexer(htmlContent)); NodeFilter infoFilter = new AndFilter(new TagNameFilter("div"), new HasAttributeFilter("class", "info")); NodeList infoList = (NodeList) parser.parse(infoFilter); BulletList bulletList = (BulletList) infoList.elem...
466760ab-209d-4d1d-969a-05118b9298b6
5
public int laggTillDokument (String isbn, String titel, String upplaga, String forfattare, String forlag, String sidantal, String sprak, String bindningstyp, String nyckelord, String beskrivning, String dokumenttyp, String hylla, String hyllplan) { Calendar c = new GregorianCalendar(); SimpleDateFormat...
a9bf7e17-99b1-4f39-a089-75c21b7a64b1
7
private static Elements getUrlsOnPage(String url, ArrayList<String> keyWordsInURL, int howTimes){ Elements links =null; try { Document doc; doc = Jsoup.connect(url).userAgent("Mozilla").get(); if(doc!=null){ Element elt = doc.body(); if(elt!=null){ links = new Elements(); for(int i=0; i...
5cdbb400-8032-4925-b01e-347d52dbc40c
0
public Histogram() { }
d3a70250-0898-41b0-ad7e-a588b6d3f10e
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final General other = (General) obj; if (!Objects.equals(this.nom, other.nom)) { return false; ...
d2de333d-126c-4b39-b531-9cc517663b77
0
public Paciente getPaciente() { return paciente; }
23221cdf-4b98-4865-a2cb-4cd5c8578e0a
6
public void update() { if (playing == false) { // we weren't updating, now we are; get the time and return playing = true; lastUpdate = System.nanoTime(); return; } // we've already been updating for some time // seconds is time since last valid update double seconds = (System.nanoTime() - last...
9c1ac3e5-0827-4bdb-a6fd-d2323ffb7852
7
protected void heapifyIterative(int i) { int parentIndex = parent(i); boolean swap = true; while(parentIndex >= 0 && swap) { swap = false; if (this.heapType==HeapType.MAX_HEAP && this.array[parentIndex].compareTo(this.array[i]) < 0) ...
c885810b-fca1-4ded-8513-4624a6eb8e90
8
public void delete (int i, int j) // delete the stone and note it { if (P.color(i, j) == 0) return; synchronized (Pos) { Node n = Pos.node(); if (GF.getParameter("puresgf", true) && (n.contains("B") || n.contains("W"))) n = newnode(); String field = Field.string(i, j); if (n.contains("AB", field...
0841dd66-feb1-4ae0-b2dd-76442499722c
7
public void primesToMax() { primes = new HashSet<Integer>(); int[] sieve = new int[MAX]; int ceiling = (int) Math.sqrt(MAX); for (int i = 2; i < MAX; i++) sieve[i] = 1; for (int i = 2; i < ceiling; i++) for (int j = 2; i*j < MAX; j++) if (sieve[i*j] == 1) sieve[i*j] = 0...
6d2bb1ec-3888-4095-bb5a-f65016c11c82
8
public void loadRoomConfig() throws BadConfigFormatException, FileNotFoundException { FileReader reader = new FileReader(layoutFile); Scanner inScan = new Scanner(reader); try { int i = 0; while (inScan.hasNext()) { String s = inScan.nextLine(); String[] queue = s.split(","); if (queue.length !...
2676398e-9d7b-4c94-833a-7817f31ac047
1
public Teacher addToCWWH (Time t) { if (t!= null) this.currentWeekWorkedHours = this.currentWeekWorkedHours.add(t); return this; }
cdaaf86d-d175-4e93-bb95-06acc1bca276
5
public int getDistance(String after) { if (ignoreSize) after = StringSizeConverter.getFullString(after); int[][] cost = new int[before.length() + 1][after.length() + 1]; for (int i = 0; i < cost.length; i++) cost[i][0] = i; for (int i = 0; i < cost[0].length; i++) cost[0][i] = i; int eq; for (int ...
d1be3e8c-fae3-44e1-9d7f-3bca499d0287
6
public static void closeQuietly(Connection conn, Statement ... statements) { for (Statement st : statements) { if (st != null) { try { st.close(); } catch (SQLException ex) { logger.log(Level.SEVERE, "Error when closing statemen...
b8171a9b-f1ba-4497-9c79-03f200c17d32
5
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuffer rs = new StringBuffer(); int c1, c2; if (len <= 0 || len > d.length) throw new IllegalArgumentException ("Invalid len"); while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_co...
eb02d917-a218-4ca1-b8cb-fca9de99081a
4
private void initializeMesh(int width, int height, long[] it, double[] tc) { this.submesh = new Region[width][height]; for(int i=0; i<width; i++) { for(int j=0; j<height; j++) { this.submesh[i][j] = new Region(it[2], tc, i, j, this); } } if(this.se...
3fb52619-a1c6-4713-b26d-4ea53aa38bc3
7
@EventHandler public void GhastPoison(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Poison.Dod...
25a21dcc-182f-41aa-8b56-0faef93f7074
1
public boolean isChanged() { if (changed) { changed = false; return true; } else return false; }
05493a6e-4054-4e9f-951d-3882a3deb2b8
8
public void up() { if (onGround && mState != hardLanding && mState != ducking && mState != beginDuck) { if (jumpReleased) { jumpReleased = false; finishedJump = false; jumpCounter = 0; mState = beginJump; heroySpeed = 9; } } else if (!finishedJump) { heroySpeed -= .4; if (h...
426600e2-3f37-4714-b2de-b2141cc2c460
0
@Override public void windowClosing(WindowEvent e) { super.windowClosing(e); System.exit(0); }
91df5eef-3ef1-438a-9922-7ef29b3bb4b7
3
public void addAuthor(Author author) { if(!authors.contains(author)){ authors.add(author); } if(author.getBooks() != null && !author.getBooks().contains(this)){ author.getBooks().add(this); } }
89c2ce3a-d5d5-4ef6-ba75-7d643b4cab5a
5
public void consolidate(){ // Empty segments ArrayList if openPath ArrayList has been updated if(!segments.isEmpty()){ segments.clear(); this.nBoxes = 0; this.nSeg = 0; this.checkNoMix = true; this.checkPath = false; } // Find ...
75a45286-aaa7-4966-8aaf-ad555dea301e
6
@Override public String toString() { StringBuilder strBldr = new StringBuilder(); if(version != null) { strBldr.append("version : "); strBldr.append(version); strBldr.append("\n\n"); } strBldr.append("structures : \n"); for(GLSLStructure struct : structures.values()) { strBldr.append("\t"); ...
5775790e-3e1b-4b04-a804-6a5760c5c36f
2
public ArrayList<String> getStringListOfNodes() { ArrayList<String> stringList = new ArrayList<String>(); if (edges.isEmpty()) return stringList; stringList.add(edges.get(0).getSource().getName()); for (Edge edge : edges) stringList.add(edge.getDestination().getName()); return stringList; }
7b493ae4-8946-4aa0-a347-e1fe6eb028db
4
public void update() { up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; // for (int i = 0; i < keys.length; i++) { // if (keys[i]) { /...
4cd28961-00eb-4f48-b1b6-e8abe4ed30f7
0
public String getAnthill() { return anthill; }
3ef7cbc0-4eb4-4acd-ba77-592baf6cd6b4
9
public void finalizeCellProcessing() { // Unary Role Traverse. for (String state : parser.grammar.getStates()) { if (!cell.CKYTable.hasState(state, cell.i, cell.j)) continue; // state is the state that current span could be ScoreState previouScoreState = cell.CKYTabl...
d6045909-a20b-410d-a22d-4bcf5b000f82
0
public void addForce(int force){ this.force += force; }
6700f7ce-9d12-48cf-8195-7fddb688cfe6
2
public void render(Graphics g) { if (!active) return; Point p1, p2; // g.setColor(0x999999); for (int i = 0; i < points.size()-1; i++) { p1 = (Point)points.elementAt(i); p2 = (Point)points.elementAt(i+1); g.drawLine((int)p1.X, (int)p1.Y, (int)p2.X, (int)p2.Y); } }
d7fc749b-b969-4755-bb97-1d5a717ff998
3
public boolean searchUserInList(String name, MultipleTalkServer server){ try { for (int i=0; i < server.socket.size()-1; i++){ if(name.equals(server.socket.get(i).getName())){ return true; } } return false; } catch (...
6176f2da-9e33-480f-9a2e-8d40e686ef53
1
@Override public void actionPerformed(ActionEvent action) { System.out.println("GameController --> actionPerformed. Accio: " + action.getActionCommand()); switch (action.getActionCommand()) { case "sweep": repaint(); break; } }
005f505d-c7a0-42c7-a785-731f07db1a80
6
public static void main(String [] args){ int choice = 0; int select = 0; boolean exit = false; Scanner input = new Scanner(System.in); System.out.println("Welcome, Please select your role in the resturant?"); System.out.println("Menu Role"); System.out.pr...
b2fa0128-e7da-494d-8f6f-3c9a11e8f778
1
public int h(int value){ if(value * this.polarity < this.treshold * this.polarity){ return 1; } else { return 0; } }
bf40c8d8-209f-46e9-98d7-d86619786fed
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator iterator =...
5f17c1a4-cfc5-4da8-90bb-51ec41521eb4
4
public void addLien(ZLien lien) { if (lien.getElement(Constantes.MCDENTITE1) != null && lien.getElement(Constantes.MCDENTITE2) != null && lien.getElement(Constantes.MCDENTITE1) != lien.getElement(Constantes.MCDENTITE2) && !zliens.contains(lien)) zliens.add(lie...
6a358d41-b6b2-482f-b68c-0c9daf226195
3
public static void main(String[] args) { try { Toolkit tk = Toolkit.getDefaultToolkit(); OutputStream out = new BufferedOutputStream( new FileOutputStream("gif89out.gif") ); if (args[0].toUpperCase().endsWith(".JPG")) new Gif89Encoder(tk.getImage(args[0])).enco...
feda0ca9-bf27-4eab-b222-8e0be81189e0
4
public void paint(Graphics g) { g.setColor(Color.GRAY); g.fillRect(0, 0, 1000, 1000); g.setColor(new Color(clr)); g.drawImage(texture, 0, 0, 128 * scale, 128 * scale, null); if(curTool == 3) { this.overlay = new BufferedImage(128, 128, BufferedImage.TYPE_INT_ARGB); this.overLayGraphics = this.ove...
097f2f5a-4a32-49da-96f3-9a3310cd86ca
6
@Override public void removeAllVisitors(int error, int type) { for (int i = 1; i <= 3; i++) { MapleCharacter visitor = getVisitor(i); if (visitor != null) { if (type != -1) { visitor.getClient().getSession().write(PlayerShopPacket.shopErrorMessage(error, type)); } visitor.setPlayerShop(null);...
29f7a462-702b-44aa-a108-511e4420547c
2
public int size() { return e1 == null ? 0 : (e2 == null ? 1 : 2); }
cf764aae-8e36-402e-8427-d2b31a788d89
9
public void writeRemoteNode(long id, Tile remote) throws IOException { String line; boolean parse = false; try { FileReader fr = new FileReader(remote.nodesFn); BufferedReader br = new BufferedReader(fr); while ((line = br.readLine()) != null) { if (parse) { if (line.contains(" id=\"")) { ...
555a6256-10f5-44ed-9a6e-aa3922122e21
6
public void codeTrigrers(){ if(codes == null){ Application.mediator.writeInfo("Automaton isn`t coded"); return; } J = new ArrayList<>(); K = new ArrayList<>(); for (int i = 0; i < connections.size(); i++) { int from = connecti...
78a63734-454c-443d-b592-4bd750d71e5e
2
public Rule getRuleByName(String name) { for (Rule r : rulesList) { if (r.getRuleName().equals(name)){ return r; } } return null; }
bcb546ba-e7b2-4b24-81d6-ebe5d03fdf20
9
public Boolean getBlackIs1OrNull(Library library, Hashtable decodeParmsDictionary) { Object blackIs1Obj = library.getObject(decodeParmsDictionary, "BlackIs1"); if (blackIs1Obj != null) { if (blackIs1Obj instanceof Boolean) { return (Boolean) blackIs1Obj; } else if...
e05ee336-9267-4ef7-aefb-d4ae499353a8
8
public static void main(String[] args) { if (args.length != 6) { System.err.println("Parameters error!"); System.exit(0); } String fja = args[0]; int n = Integer.parseInt(args[1]); String vrsta = args[2]; int maxiter = Integer.parseInt(args[3]); double oshare = Double.parseDouble(args[4]); double ...
25e4e3a4-54da-44e9-aa33-b57dcbcced1c
5
@Override public void doCharacterCollision(ArrayList<Collision> collisions, StageObject charachter) { /** * @todo remove tempory fix */ Collision collision = collisions.get(0); if (charachter instanceof StageMario) { switch (collision) {...
450d7d56-1743-46d8-b0a8-799c198c2e4f
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new java...
4aaeadb3-d381-4afe-aee8-b0674d3c3041
2
final public void eof(boolean requireEOF) throws ParseException { if (!requireEOF) {if (true) return;} jj_consume_token(0); }
028820aa-b575-4255-bcf9-efe68b0b4799
0
public int getSize() { return names.size(); }
3581f1b7-1b05-4ac4-b4c4-ac7e733abd20
9
protected Thread findThread(String name,ThreadGroup tGroup, boolean ignoreZeroTickThreads) { final int ac = tGroup.activeCount(); final int agc = tGroup.activeGroupCount(); final Thread tArray[] = new Thread [ac+1]; final ThreadGroup tgArray[] = new ThreadGroup [agc+1]; tGroup.enumerate(tArray,false); tGr...
3373212c-6dc9-4e48-afc4-a91e2bf72e3f
5
@Override public boolean checkMouseHover(Vector2f v) { if (this.contains(v.x,v.y) && !clicked){ state = hover; isHovering = true; if (hasItem && item.hasToolTip()){ return true; } else{ return false; } } else if (!clicked){ state = normal; isHovering = false; } return false; ...
a7f0be11-c2fc-4a3b-bac6-a2a84ce28db6
8
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...
352e4077-9a6b-433c-bfd5-87b4d5d0ba03
4
public static void main(String[] args) { ExecutorService threadPool = Executors.newFixedThreadPool(4, new MyThreadFactory("test-thread-pool-")); for (int i = 1; i < 10; i++) { final int task = i; threadPool.execute(new Runnable() { @Override public void run() { for (int i = 1; i < 10; i++) { ...
b1ee8abb-eedf-49c7-866a-00116d7699ad
3
public static int getNextStop(int busStop, int route) { if (busStop == 0) throw new InvalidQueryException("Nonexistent bus stop"); if (route == 0) throw new InvalidQueryException("Nonexistent route"); database db = database.busDatabase; String source = "path As path1 Inner Join path As pat...
7ccc9c5f-529a-42fd-a42b-39768e4476df
5
@Override public void actionPerformed(ActionEvent timer) { if (vivant == true){ actualiseStatistique(); // Si le tetrominoe ne peut pas descendre if (!canFall()|| tetrominoes.get(tetrominoes.size()-1).getEmplacement().isAllEmpty()){ cleared=0; // Pour le s...
fd4d1947-383b-45fc-b7ef-4f04331c86b9
0
@Override public void rotate(int angle) { base = DimensionalTrasform.rotateX(angle, base); setColoredExes(); base = DimensionalTrasform.rotateY(angle, base); setColoredExes(); base = DimensionalTrasform.rotateZ(angle, base); setColoredExes(); }
80e0bcff-02ea-4150-952c-c369d0d771ed
4
public ArgumentsMap(final ArgumentsIterable it) { for (Argument argument : it) { switch (argument.type) { case LONG: addToMap(longMap, argument.name, argument.value); break; case SHORT: addToMap(shortMap, arg...
3a95f58a-4591-401c-80a9-5c901c721ff4
9
private static List<ImageFileProvider> unrar (final File droppedFile) { final List<ImageFileProvider> providers = new ArrayList<ImageFileProvider> (); Archive archive = null; try { archive = new Archive (droppedFile); final List<FileHeader> headers = archive.getFileHeader...
63ab94d8-8553-425f-9a57-5ae17877ca5d
7
public RandomListNode copyRandomList(RandomListNode head) { if(head == null) return null; RandomListNode curr = head; while(curr!=null) { RandomListNode newnode = new RandomListNode(curr.label); newnode.next = curr.next; newnode.random = curr.random; curr.next = newnode...
65280cb9-b846-422d-a80f-84ab4e64ebfe
3
public int getCurrentLargest() { int currentLargest = 0; for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { if (grid[x][y] > currentLargest) { currentLargest = grid[x][y]; } } } return currentLargest; ...
bfabe9f1-40a6-44bd-a13e-ff1a79c5eecc
8
public void pintarElements(){ Casella[][] botons= Main.t.botons; for(int i=0;i<botons.length;i++){ for(int j=0;j<botons[i].length;j++){ botons[i][j].setIcon(null); Estat e = botons[i][j].getEstatReal(); if(e.getMapaEstat().get(Estat.MONSTRE)){ ...
594cd46f-a6c3-411f-990a-3381370c34e8
9
@Override public void run() { bots[0].printLog("starting socket server on port " + socketPort); // to avoid try-with-resources which isn't supported // before 1.7 ServerSocket serverSocket = null; Socket clientSocket = null; BufferedReader in = null; try { // configure sockets serverSocket = new ...
7e4a6e51-f15a-434c-a19b-396050bba2f3
9
@Override public String getAnEvokeWord(MOB mob, String word) { if(mob==null) return null; Ability A=null; final HashSet<String[]> done=new HashSet<String[]>(); word=word.toUpperCase().trim(); for(final Enumeration<Ability> a=mob.allAbilities();a.hasMoreElements();) { A=a.nextElement(); if((A!=nul...
5a08c173-c814-4e1f-8f7a-65caf8c8d9e8
7
public void carregaInteressesDeProfessoresPorDisciplinasDeArquivo( String nomeArquivo) throws PreferenciaInvalidaException, ProfessorInexistenteException, DisciplinaInexistenteException, IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); Strin...
39b14848-9f84-45f0-85a5-367b312767f9
9
public List<List<Integer>> pathSum(TreeNode root, int sum) { if(root==null) return new ArrayList<List<Integer>>(); if(isLeaf(root) && root.val!=sum)return new ArrayList<List<Integer>>(); List<List<Integer>> rtPathSet =new ArrayList<List<Integer>>(); if(isLeaf(root) && root.val == sum) { List<Integ...
cd17a529-1083-4a93-8a0f-ed1945243490
0
public void setGearbox(String gearbox) { this.gearbox = gearbox; }
43c88a19-fd83-4782-ab94-e2082aadb360
3
public boolean isValid() { if (suit != Suit.INVALID && num >= 1 && num <= 13) return true; return false; }
42288e06-747d-4f49-bb18-6a5d09a4dc2b
9
protected String convertBaseGraphNodeForMatchClause(BaseGraphNode baseGraphNode) throws InformationProblem { String ndStr = "("; // alias String ndAlias = null; if ((baseGraphNode.getLocalAlias() != null) && (baseGraphNode.getLocalAlias().length() > 0)) { ndAlias = "`" + baseGraphNode.getLocalAlias() +...
dbefb675-1b5a-4ea9-970b-de2f6da2937c
5
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null) { return; } int UserId = Room.GetRoomPetById(Main.DecodeInt()); if (UserId != -1) { ...
ee965151-02f5-4da5-ba69-834fd175440b
7
static private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0); return 7; } switch(curChar) { cas...
113dc169-4c63-44ef-b573-213bfa831472
4
final public void onEnable() { //Load INSTANCE for other classes. INSTANCE = this; // Grab the PluginManager final PluginManager pm = getServer().getPluginManager(); //Load Logging class Logging.load(); // Grab the Plugin Description File PluginDescript...
ed3f5d4e-ee57-49b2-a641-4d1a1cc733e7
2
public boolean contains(final AbstractInsnNode insn) { AbstractInsnNode i = first; while (i != null && i != insn) { i = i.next; } return i != null; }
8d90ee40-0e7a-4c8e-933b-37c5d44c4ef4
3
public void clearDisplay() { //TODO: Don't set BLOCKED tiles to NORMAL_TILE colour. Waiting to fix this on a decision on barriers. //That, or make barriers display a graphic rather than a background. for (Tile tile : validTargetPaths.keySet()) { tile.setBackground(PropertiesLoader.getColour("normal_tile")); ...
bf751379-d40f-4d95-af9a-61d154345fe5
9
@Override public String toSql() { if (type == null) return ""; if (type.equals(ClauseType.IN)) { String sql = key + " " + type.getValue() + " ("; for (Object v : (Object[]) value) { if (v != null) { if (v.getClass().equals(String.class) || v.getClass().equals(char.class)) sql += "'" + v + "',";...
8cb400a9-124a-4126-87be-8a27892d200e
5
@Override public final void update() { switch (currentScene.state) { case ENTER: currentScene.onSceneEnter(); currentScene.state = SceneState.RUNNING; break; case RUNNING: currentScene.update(); break; ...
15a8b3b5-e23d-4133-8c6d-bf91994e04eb
7
@Override public void input(float delta) { Vector2f centerPosition = new Vector2f(Window.getWidth()/2, Window.getHeight()/2); if(Input.getKey(unlockMouseKey)) { Input.setCursor(true); mouseLocked = false; } if(Input.getMouseDown(0)) { Input.setMousePosition(centerPosition); Input.setCursor(fa...
edb3a6b7-be4e-43fe-b757-5dcf2024af43
1
public void testParseLocalDate_simple() { assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30Z")); assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30+18:00")); assertEquals(new LocalDate(2004, 6, 9), g.parseLocalDate("2004-06-09T10:20:30-18:00...
530df229-4ab7-46a0-86f6-53a905ecaa31
2
public static Level Convert(String file) throws IOException { String name = new File(file).getName().split("\\.")[0]; DatToGGS newlvl = new DatToGGS(); newlvl.load(file); Level lvl = new Level((short)newlvl.level.width, (short)newlvl.level.height, (short)newlvl.level.height); int[] cords = new int[3]; for (...
1977e0d7-bf3c-4de9-b281-73b2628ee253
7
public static void main(String[] arg){ try{ JSch jsch=new JSch(); String host=null; /*if(arg.length>0){ host=arg[0]; } else{ host=JOptionPane.showInputDialog("Enter username@hostname", System.getProperty("user.name")+ ...
26738a64-0d06-4f23-90e8-f6b4ce60c45b
9
private void makeFrame() { /** Main Frame **/ setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel contentPane = new JPanel(new BorderLayout(10, 10)); contentPane.setBorder(new EmptyBorder(10, 10, 10, 10)); setLocation(new Point(100, 100)); /** Maak menuBar **/ ...
98f2eb08-aa95-4d7d-a6c2-034638916bc3
9
public static ReturnValidate InsereFornecedor(Fornecedor forn){ String retorno = ""; if (forn.getRazao().equals("")){ retorno += "Campo 'Razao Social' não pode ser vazio\n"; } if (!Util.ValidateCnpj(forn.getCnpj())) { retorno += "CNPJ inválido\n"...
c0e1a3ed-35c1-4756-97cc-bd8656d4d4cf
4
private boolean enabled() { boolean blocked = false; final Iterator<Validator> i = validators.iterator(); while (i.hasNext()) { final Validator c = i.next(); if (!c.enabled.get()) { c.pop(); i.remove(); } else if (!blocked && !c.valid()) { blocked = true; } } return !bloc...
b8438cce-f5dc-451e-b15c-9e5f0c978200
9
private static String convertToneNumber2ToneMark(final String pinyinStr) { String lowerCasePinyinStr = pinyinStr.toLowerCase(); if (lowerCasePinyinStr.matches("[a-z]*[1-5]?")) { final char defautlCharValue = '$'; final int defautlIndexValue = -1; char un...
c4346eb8-0cc5-4f01-bd8d-1090c400f92f
8
@Override public void loadFromString(String contents) throws InvalidConfigurationException { Map<?, ?> input; try { input = (Map<?, ?>) yaml.load(contents); } catch (YAMLException e) { throw new InvalidConfigurationException(e); } catch (ClassCastException e)...
2d9165a2-c49d-4955-8e3f-9ce2c5f75e65
8
@Override public void drop(DropTargetDropEvent e) { if (e.isLocalTransfer()) { Transferable tr = e.getTransferable(); DataFlavor[] flavors = tr.getTransferDataFlavors(); try { if (flavors != null && flavors.length > 0 &...
49fe214b-c083-483b-a894-623292a09508
2
public static long copyLarge(Reader input, Writer output) throws RuntimeException { try { char[] buffer = new char[DEFAULT_BUFFER_SIZE]; long count = 0; int n; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); cou...
a0b71819-d20a-4518-bcf5-3f34ec0b0756
9
public boolean canAvoid() { if (!this.busy) { for (Field next : this.getField().getTurnNeighbors()) { if (next != this.nextField && !next.hasNextAnt() && (!next.hasHill() || next.getHill().getOwner() != 0) && !next.hasFood() && !next.isSave() && !next.hasWater()) { return true; } ...
fd8ee6ef-2a7d-481a-9304-4a1b308e8c57
0
@Id @Column(name = "SOL_ID_SOLICITUD") public int getIdSolicitud() { return idSolicitud; }
d71395ab-9fe4-4eb4-8857-59dc8e2c5a50
5
public void changePrice() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String commandArg = null; System.out.println("Please enter the stock number of the item."); try { commandArg = br.readLine(); } catch (IOException ioe) { System.out.println("Error reading command. ...
291f57f2-10ca-43a1-a1ab-a92818611166
8
public void update() { if (dir == LEFT) { dx = -(Catamaran.CHAR_SPEED+1); dy = 0; } else if (dir == RIGHT) { dx = (Catamaran.CHAR_SPEED+1); dy = 0; } else if (dir == UP) { dx = 0; dy = -(Catamaran.CHAR_SPEED+1); } else if (dir == DOWN) { dx = 0; dy = (Catamaran.CHAR_SP...
5b296ea0-0288-4a99-8f3f-4e9ab7e36545
7
protected void firing(long deltaThreshold,long recentThreshold){ if ( ctx.gunHeat > 0.0 ) { return; } double maxPower = 0.0; double aimDistance = Util.fieldFullDistance; MoveType aimType = null; Enemy target = null; for (Map.Entry<String, Enemy> e : ct...
516f2ab0-8f08-4b26-bb7f-b93eb037d8c5
7
@Override public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) switch (state) { case INSPECTED: state = State.SELECTED; gui.viewOverView(); break; case SELECTED: state = State.MOUSEOVER; break; case MOUSEOVER: state = State.SELECTED; break; } ...
cb2d8565-8f32-4fc6-adde-617a9d5583bc
5
public void testFinMotOuJeu(Graphics g){ // Test x mot sur 10 g.setFont(new Font("sansserif", Font.PLAIN, 30)); g.setColor(new Color(0,0,0)); if(finJeu){ g.setFont(new Font("sansserif", Font.ITALIC, 30)); if(!mot.equals(test)){ g.drawString("Temps écoulé ... ", 550, 300); g.drawString("Dommage...
01ee77ec-cbdd-4854-a88f-d330b4dbc152
3
public long update(HTSMsg msg) { HTSMsg chann = tags.get(((Number)msg.get(TAGID)).longValue()); for (String name : msg.keySet()){ if (Arrays.asList(HTSMsgFields).contains(name)){ chann.put(name, msg.get(name)); } else if (name.equals("method")){ //This is normal, do nothing... } else{ ...
a9e7d9f5-1748-4c36-98f2-6300a9cb0fb5
1
public synchronized void stop() { try { thread.join(); System.exit(0); } catch (InterruptedException e) { e.printStackTrace(); } }