method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
43d789a9-47fb-43aa-a0ad-ac073d435460
7
public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); String line; int length; for(int i = 0; i < n; i++){ ...
7eae587f-12b0-4e26-b40a-e4d3b794fa75
1
void recordCflow(String name, String cname, String fname) { if (cflow == null) cflow = new Hashtable(); cflow.put(name, new Object[] { cname, fname }); }
04da477a-8e38-4f14-9ccf-16b88283d9d6
0
@Override public void handlePieceSent(SharingPeer peer, Piece piece) { /* Do nothing */ }
9ea1068c-9ed1-428e-a40d-29b96a677951
9
private SimilarityCoefficient computeSimilarityCoefficient( HashMap<String, DBObject> reviewArray, HashMap<String, DBObject> reviewArray2, String exceptBusinessId) { Set<String> keySet = reviewArray.keySet(); Iterator<String> itr = keySet.iterator(); int count = 0; int totalX = 0; int totalY = 0; Arra...
3c4fdc56-c49f-4354-a5bd-d7813f2353f1
2
static double det(double[][] A){ double det = 0; if(A.length == 1){ det = A[0][0]; }else{ for(int i = 0; i < A.length; i++){ det += Math.pow(-1,i)*det(minor(A,i,0))*A[i][0]; } } return det; }
ef460347-ffe1-4932-b924-7a4b3afa0b57
9
public void joinGame(Packet p) { System.out.println("in join"); String xml = ""; int max = 0; if(!checkPlayerId(p.getPlayerId(), p.getName())) { notifyThis("Chyba: hrac se stejnym poradovim cislem jiz ve hre existuje"); try { this.out.c...
be0a7182-4f49-44fc-b322-323793f0dff3
2
@Override public InputStream getInputStream() throws IOException { switch (failValue) { case 0: return new InputStream() { @Override public int read() throws IOException { return 1; } ...
17b9ab16-924c-491b-88aa-57b89d5505ed
2
@Override public String toString() { StringBuffer predicate = new StringBuffer(getName()).append("("); Iterator args = getArgs().iterator(); while (args.hasNext()) { predicate.append(args.next()); if (args.hasNext()) { predicate.append(", "); ...
3b2b049e-42e4-40a7-a263-3316ec681541
2
public void makeEnemiesAttack(){ for(int i = 0; i<initials.size(); i++){ if( initials.get(i).getOffScreen() == true){ initials.remove(initials.get(i)); initials.add(new TypeOneEnemy(4)); } else{ initials.get...
df21757d-6663-4197-a565-97f799cf3eb9
7
public void updateGameBoard() { copyBoardState(storedBoardState, boardState); if (currentDroppingBlock == null) { return; } int[][] position = currentDroppingBlock.getCurrentRotation(); for (int y = 0; y < position.length; y++) { int[] row = position[y]; ...
05aed80e-747c-418e-845d-5ac89bb69f75
6
private void updateAnstalldaInPanel() { tfAnstalldSearch.setEnabled(false); //lets disable it meanwhile we update PanelHelper.cleanPanel(anstalldHolderPanel); ArrayList<String> matches = fetchMatchingAnstallda(); if (!matches.isEmpty()) { for (String st : matches) { ...
d37540c3-c157-402b-8427-35a1769bb3a0
1
public int getPos(Nodo<E> pNodo){ int resp = 0; for (Nodo<E>i = pNodo; pNodo != null; pNodo=pNodo.getSiguiente()) resp++; return resp; }
87e97d3d-615d-48ee-9eea-5982f102a5f8
6
public Object next() { Instance inst = data.getInstance( src, instanceCursor++ ); if (KEEP_OLD_ITERATION_BUG && instanceCursor>data.numInstances(src)) { sourceCursor++; instanceCursor=0; if (sourceCursor<data.numSources()) src = data.getSource...
08916b31-c62b-4d9e-b7b3-3e9eb1db7523
0
@Override public boolean supportsComments() {return true;}
6fc71776-96c2-4384-8e42-f9cda966f9a7
6
public void generateChildren(SortedList<NoteNode> queue) { if(songIndex+1 < FingerTree.end_index) { if(songIndex+2 < FingerTree.end_index && song.getTone(songIndex+2)<0) { NoteNode temp = new NoteNode(songIndex+1, nextFinger, -1, this, song); temp.generateValue(); if(temp.getCurrentScore()<Finger...
14762c73-f399-4bac-8193-0c1aa53323c7
3
public Menu createMenu(Control parent, ColorListener cl) { Menu menu = new Menu(parent); MenuItemListener menuItemListener = createMenuItemListener(parent); menu.addListener(SWT.Selection, menuItemListener); menu.addListener(SWT.Dispose, menuItemListener); menuItemListener.setColorListener(cl); if (enabl...
254fc86a-e841-4ee7-b0fb-02d69c192435
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Position other = (Position) obj; return this.x == other.x && this.y == other.y; }
852f9995-32f2-4eaf-b09e-076ae2912c95
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...
fe5a8574-4a23-446c-b35a-683f795951fe
4
@Override public void onMouseClick(MouseButton button, int x, int y) { if (currentScreen == null) return; if (currentScreen instanceof IReceiveMouseClickEvent) ((IReceiveMouseClickEvent) currentScreen).onMouseClick(button, x, y); for (IRenderable renderable : currentScreen.getComponents()) if (render...
c0e07cb3-c19a-4d13-8b04-83bf20a1a1b9
6
public void run() { long lastTime = System.nanoTime(); double nsPerTick = 1000000000D / 60D; long lastTimer = System.currentTimeMillis(); delta = 0D; while (running) { long now = System.nanoTime(); delta += (now - lastTime) / nsPerTick; lastTime = now; // If you want to limit frame rate, should...
98393b73-b8ca-4f99-b95e-2d33a57f1575
8
public static boolean emitter(String input) throws UnknownHostException, IOException{ Command com = null; if(input.equals(Protocol.LIST_COMMAND)){ com = new List(_CSName, _CSPort, null); } else if(input.startsWith(Protocol.RETRIEVE_COMMAND + " ")){ if(_SSName != null){ String[] arguments = input.split...
ce954ad8-38b2-4573-82c8-a728c669e264
7
public void calculateStatistics(){ long maxRouteLength = 1; long minRouteLength = AntColony[0].getRouteLength(); float avgRouteLength = 0; float avgTemp = 0; int successfulAnts = 0 ; long max = 0; long min = 0; for(int i = 0; i < AntColony.length; i ++){ ...
a69c52dd-3520-45d5-a4fc-c200f583f65d
2
public static void setupFromCompetedSchedule(Match[] matches, Battery[] batteries) { for (Battery battery : batteries) { Competition.getInstance().addBattery(battery); } for (Match match : matches) { Competition.getInstance().addMatch(match); } }
d8e584d8-0b1b-4886-a580-7acf92e3541b
9
protected void update() { secTimer = System.currentTimeMillis() - slast; minTimer = System.currentTimeMillis() - mlast; hrTimer = System.currentTimeMillis() - hlast; ampmTimer = System.currentTimeMillis() - ampmlast; date = String.format("%tr", new Date()); // This loop is more efficient because it on...
da483db5-f956-4755-a9f2-c3956a73ca7e
4
public static void Updatetrema(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement stmn...
62c19554-a582-41ec-86da-2b49b8abf936
2
private void calcNormals(Vertex[] vertices, int[] indices) { for(int i = 0; i < indices.length; i += 3) { int i0 = indices[i]; int i1 = indices[i + 1]; int i2 = indices[i + 2]; Vector3f v1 = vertices[i1].getPos().sub(vertices[i0].getPos()); Vector3f v2 = vertices[i2].getPos().sub(vertices[i0].ge...
8aa4c3b1-d2ad-4b05-a86c-dadf4863fcf1
0
public void actionPerformed(ActionEvent e) { String[] args = getArgs(e); sayCommand(args[0], args[1], args[2], args[3]); }
55a52495-95ce-49b9-bed4-7c049863b334
1
private static void saveState() { try { RecentFilesMenu.saveToPreferences(); Fonts.saveToPreferences(); Preferences.getInstance().save(); } catch (Exception exception) { // Ignore, since preferences may not have been initialized... } }
44201255-8919-4435-b23e-7d9237866e9e
1
public ClassInfo[] getInterfaces() { if ((status & HIERARCHY) == 0) loadInfo(HIERARCHY); return interfaces; }
b65d6785-d7df-4e84-ae48-534f76c73de0
2
public Boolean getFactMiddleFlag(int id) { boolean result= false; try{ stat.setQueryTimeout(30); ResultSet rs = stat.executeQuery("SELECT * From Fact Where Id ="+id+";"); result = (rs.getInt("AnswerFlag") == -1) ? true : false ; }catch(Exception e){ ...
4cff2f74-8154-48d8-8e6e-67b6dcd1cd89
6
public static void main(String[] args) throws IOException, JSONException, InfluException { ArrayList<DetailedMovie> top250Movies = new ArrayList<>(); String arrayString = FileManager.readFile("refined.json"); JSONArray jsonArray = new JSONArray(arrayString); Calendar startTime = Cal...
37d6416f-08ba-4925-bb8f-f6614432bb21
6
@SuppressWarnings("unchecked") void loadRegulationTrack(String regTrack) { //--- // Read file //--- if (verbose) Timer.showStdErr("Reading regulation track '" + regTrack + "'"); String regFile = config.getDirDataVersion() + "/regulation_" + regTrack + ".bin"; ArrayList<Regulation> regulation = (ArrayList<R...
9a223d58-5caa-4a80-aede-cfcb2c5c3071
7
public static void main(String[] args) throws IOException, ParseException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); do { line = in.readLine(); if (line == null || line.length() == 0 || line.equals("0")) break;...
df92d93b-db9d-4cf4-b559-54e0ee073564
4
public boolean update(){ x += dx; y +=dy; if(x< -r|| x > GamePanel.WIDTH + r || y <-r ||y > GamePanel.HEIGHT+r){ return true; } return false; }
5f06fb28-53fd-4228-b906-c5f7f2990971
3
int getCountCommitted() { int count = 0; for(int i=0;i<sudokuSize;i++) { for(int j=0;j<sudokuSize;j++) { if(cells[i][j].valueState == 6) count++; } } return count; }
632726a3-e304-4a52-8d99-2be240f7cb71
6
@Override public SQLResult executeHqlQuery(String query, boolean deref) { Session session = null; Transaction trx = null; SQLResult result = new SQLResult(); try { session = sessionFactory.openSession(); trx = session.beginTransaction(); Query hqlQuery = session.createQuery(query); /*hqlQuery.se...
915cb132-7ef8-4ceb-8d08-37e5f07a277d
8
public void keyPressed(KeyEvent event) { if(getGame().getTurn().getVal() == getLoyalty().getVal()) { if(event.getKeyCode() == KeyEvent.VK_ENTER) { moveRegistered = true; } if(event.getKeyCode() == KeyEvent.VK_U) { for(Location moveLoc : moveLocs) { getBoard().getNode(moveLoc).setHig...
c398d5fa-4a6a-4746-8259-13a5d67ea8cb
7
protected static String normalizeUrl(String url) throws URISyntaxException { URI uri = new URI(url); String scheme = uri.getScheme().toLowerCase(); String authority = uri.getAuthority().toLowerCase(); boolean dropPort = (scheme.equals("http") && uri.getPort() == 80) ...
1b0109d3-8949-4748-9685-337b9cb4cb71
0
public TypeEntity getType() { return types; }
d64a75d2-15b0-45c1-8680-abc57b78a227
3
public void damage(int amt) { health -= amt; if(health > 100) health = 100; if(health <= 0) { AudioUtil.playAudio(deathNoise, 0); System.out.println("Game Over!"); Game.setIsRunning(false); } else { if(amt > 0) AudioUtil.playAudio(painNoise, 0); System.out.println(health + "/1...
f519ae2b-d2a4-4db3-8cf3-29d2b46b9de0
5
@SuppressWarnings("rawtypes") public static MultiColumnComparator createDoubleComparator(NumberName[] numberNames, boolean ascending, String defaultString) throws Exception { final String type="double"; if (ascending) { if (defaultString.equals("")) { return new MultiColumnComparator...
cbc6f8c6-4cfa-4710-a4c4-7af98e75aee3
5
public void talk() throws IOException { try { PrintWriter pw = getWriter(socket); this.lb = new BufferedReader(new InputStreamReader(System.in)); String msg = null; while(true){ if((msg = this.lb.readLine())!=null){ pw.println(msg); if(msg.equals("bye")){ break; } } }...
e31220f0-4f4a-4fab-b4bb-79f598a5f125
8
public void run() { while (true) { try { char temp = ' '; int len = 0; while ((temp = (char) in.read()) != '\0'){ if (Character.isDigit(temp)) { len = len * 10 + Integer.parseInt(""+temp); } } StringBuilder msg = new StringBuilder(); for (int i = 0; i < len; i++) { char...
42ba9344-598e-4f86-a64c-603f7b154d74
5
private Vector<Object> _obtenerVectorDatos() { Vector<Object> v = new Vector<Object>(); /*v.add("John Lennon"); v.add("Paul McCartney"); v.add("George Harrison"); v.add("Ringo Star"); v.add("Sandro (Roberto Sanchez)"); v.add("Charly Garcia"); v.ad...
2480591a-8bd7-4508-a1ac-b9d2816fb3dc
3
private void rebuildSelector () { Selector newSelector; try { newSelector = Selector.open(); } catch (IOException e) { throw new ZError.IOException(e); } try { selector.close (); } catch (IOException e) { } select...
0809e498-34a2-4ba5-a5ca-42480eaa412a
4
private void validateFieldType( char ftype ) { boolean valid = (("CNFDLMG").indexOf(ftype)>=0); valid = valid || ( (!DOS_FOX) && (("IBTY0").indexOf(ftype)>=0) ); if(!valid) try { throw new IOException ("What a field type is " + ftype + " ?"); } catch (IOException e) { e.printStackTrace(); } }
ab3577eb-feaa-442f-8f38-9589b43f0bfa
5
@Override public Behaviour getDefaultBehaviour(int id) { switch (id){ case 0: Goalkeeper goalkeeper = (Goalkeeper) _behaviours[0]; goalkeeper.setSecondGoalkeeper(false); return goalkeeper; case 1: Defender defU = (Defender) _behaviours[1]; defU.setUpper(true); return defU; case 2: Defende...
2bb0e53e-7b27-4818-8639-3ca865f95e5d
2
public void update() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); if (!strategy.contentsLost()) { strategy.show(); } } // Sync the display on some systems. ...
357dc2ad-d32d-41c9-af49-903b80aec20d
1
public static void handleSqlExceptions(SQLException ex) { while (ex != null) { System.out.println("SQLException: " + ex.getMessage()); System.out.println("SQLState: " + ex.getSQLState()); System.out.println("VendorError: " + ex.getErrorCode()); ex = ex.getNextException(); } }
dc805bbd-3ebf-49ee-8f32-90d601e8da08
3
public void stopRecording(Session userSession, Session watcherSession){ Collection<Record> records = this.get(new InMemoryRecording(userSession, watcherSession)); if(records == null){ return; } Recording recording = new Recording(); entityManager.getTransaction().begin(); entityManager.persist(recording)...
2c6c01cd-0eb1-4a28-8cd8-5ddd6f30df47
1
public void changePassword(boolean enable, char[] nPassword){ if(enable){ salt = SecurityUtil.generateSalt(); password = SecurityUtil.sha256HexString(nPassword, salt); psw_enable = true; System.out.println("PASSWORD Set"); } else { psw_enable = false; System.out.println("PASSWORD Disabled")...
587371b8-10e6-433a-b568-893680e0c935
6
public void paint(Graphics graphics, int x, int y) { Graphics2D g = (Graphics2D) graphics; g.setColor(new Color(0,0,0)); Polygon mask = new Polygon(xHex(x),yHex(y),6); g.setClip(mask); String loc; switch (_type) { case BRICK: loc = imageNames[4]; bre...
320e864c-9e78-42dd-beb3-cf9ca2fdb06b
0
@Id @Column(name = "FES_CEDULA") public long getFesCedula() { return fesCedula; }
6aaa81a8-3fd7-47eb-a38a-d92ece94d967
9
private char nonZeroDigitToken(PositionTrackingPushbackReader par1PositionTrackingPushbackReader) throws IOException, InvalidSyntaxException { char var3 = (char)par1PositionTrackingPushbackReader.read(); switch (var3) { case 49: case 50: case 51: ...
c756bfb2-ee2f-4b5a-8383-62c0902a3d7f
1
public void testWithField_DateTimeFieldType_int_3() { LocalTime test = new LocalTime(10, 20, 30, 40); try { test.withField(DateTimeFieldType.dayOfMonth(), 6); fail(); } catch (IllegalArgumentException ex) {} }
0ce87b84-7fad-4ed2-9820-3be6c1721077
7
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) { int blockIncrement; if (orientation == SwingConstants.VERTICAL) { blockIncrement = visibleRect.height-(int)(10.0*screenAdjustment); if (direction < 0) { if (visibleRect...
c0304b91-9102-4698-a9d0-5d567b923876
1
public int getFuelPercent() { if(fuelCapacity <= 100) { double factor = 100 / fuelCapacity; // System.out.print("Factor = " + factor); double result = ((fuelLevel * factor) / (fuelCapacity * factor)) * 100; // System.out.println(", Result = " + result); return (int) result; } else { double resul...
4dbab3bb-4c94-4d81-901f-c99c6511557f
2
public ResultSet CheckLogin(String username, String password) throws Exception{ cx = connection(); ResultSet rs = null; // get the list of emails that match the email and password entered. Should only be one, or zero if the wrong combo is entered String query = "SELECT id as personid, e...
bb9ea4bc-3e85-4e45-8bb0-3245e711ee19
6
public void run() { if( running ) return; try { output_line.open(); output_line.start(); play_position = 0; running = true; while( running ) { int frames = song_duration - play_position; if( frames > 1024 ) frames = 1024; ibxm.get_audio( output_buffer, frames ); output_li...
e7a7e5f2-bd8f-46a6-89cd-ae2db00d10d4
9
public void receiveMessageFromHost() { String string = null; try { string = input.readLine(); } catch (IOException e) { } if (string.equals(CLEAR_WORKSPACE)) { applicationController.createAndShowClearWorkspacePrompt(); return; } if (string.equals(SUBMIT_ARGUMENT)) { System.out.println("EEE"); ...
53029daa-c158-41b8-b0e2-d8c6e3d5c17a
3
private void createPositionReportLine () { if (receivingPositionReport==false) return; else receivingPositionReport=false; // Check enough position fragments have been received if (positionFragmentCounter<10) { String line="Position fragment count is "+Integer.toString(positionFragmentCounter); theApp.wri...
be06af93-6242-4da4-9c5c-e09f92cc3642
5
private boolean testeSiegInSpalte(Spieler spieler) { for (int spaltennummer = 1; spaltennummer <= Spielfeld.ANZAHL_SPALTEN; spaltennummer++) { int sequenceCounter = 0; for (int reihennummer = 1; reihennummer <= Spielfeld.ANZAHL_REIHEN; reihennummer++) { Stein steinfarbe = spielfeld.getSteinfarbe(spaltennumm...
9e48c26d-4cd6-405f-a819-06669b730c57
6
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String commandName = command.getName().toLowerCase(); boolean commandSuccess = false; // Only Players if (!(sender instanceof Player)) { sender.sendMessage(PREFIX + "/" + commandName + " can only be run...
81a443a0-62f7-4650-88de-8932af861e7c
9
private int[] geraSeleccao(double[] qualidade, double[] segmentos, double[] roleta) { int[] sel = new int[individuos.length]; sel[0] = 0; ArrayList<Integer> resto = new ArrayList<Integer>(qualidade.length); Integer maior = 0; for (int i = 0; i < qualidade.length; i++) { ...
15e4d47a-d558-416c-8c5b-b286de44330b
3
@Override public void onEnable(){ // Register necessary events pdfFile = this.getDescription(); pm = this.getServer().getPluginManager(); pm.registerEvents(new PlayerListener(this), this); // Check if vault is loaded (required for economy) VaultEnabled = setupEconomy(); if (VaultEnabled) { Log("Found...
eefb033f-8e81-46a6-846c-d1049bd5a6c2
5
@SuppressWarnings("unchecked") public E[] getElements(){ if (empty) return (E[]) new Object[0]; Object ret[] = new Object[size()]; int n=0; for(int i=begin;; i++){ if (i==MAX) i=0; if (n!=0 && i==end) break; ret[n++] = VALUES[i]; } return (E[])ret; }
4f366177-76cc-407a-8c90-8f4ae936237f
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Schedule other = (Schedule) obj; if (academicTerm == null) { if (other.academicTerm != null) return false; } else if (!academicTerm.equa...
fe8d2ba8-6555-4c08-8141-366ede0446a1
4
private static HttpUriRequest prepareRequest(String address, Request request) { HttpUriRequest httpRequest; if (request.getType() == Request.RequestType.PUT) { HttpPut hp = new HttpPut(address); ByteArrayEntity bae = new ByteArrayEntity(SerializationStuff.getBytes(request.getData...
d2005d77-b1f8-4b12-8203-26e94e4ec0c2
4
private boolean intersectsOtherLines(LineUsedInEditingScreen line) { for ( LineUsedInEditingScreen otherLine : lines ) { if ( otherLine != line && ( line.intersectsAnotherNode(otherLine) || line.haveTheSameDimensions(otherLine) ) ) { return true; } ...
a0991d60-858d-43f9-b43b-8e9bbbd01c84
7
private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSubmitActionPerformed // I WILL NOT SUBMIT TO YOUR SLAVERY! // Er, submit button if(!checkFields()) return; Vehicle v = new Vehicle(); v.setVin(txtVIN.getText...
dd7fada6-0b8c-496f-a1a1-644326c12818
7
@Override public void setStat(String code, String val) { if(CMLib.coffeeMaker().getGenItemCodeNum(code)>=0) CMLib.coffeeMaker().setGenItemStat(this,code,val); else switch(getCodeNum(code)) { case 0: setPowerCapacity(CMath.s_parseLongExpression(val)); break; case 1: activate(CMath.s_bool(val));...
ccbbbc2d-6b04-4414-8893-2750190aa726
0
@Override public void attach(Observer observer) { observerVector.add(observer); }
c88e7069-6a29-49c3-9bf2-82abc42c3c9b
8
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(in.readLine()); int m = Integer.parseInt(st.nextToken()); int q = Integer.parseInt(st.nextToken(...
857cba10-8cc2-478c-8fe3-e523d33be5e5
0
public void setThreads(int threads) { this.threads = threads; }
cc5d339b-4f32-4ac2-980d-1ff795a30cc2
6
private ArrayList<File> dirDirlist(File f) { ArrayList<File> res = new ArrayList<>(); if (f.exists() && f.isDirectory()) { File[] chld = f.listFiles(); for (File sf : chld) { if (!sf.getName().equals(".") && !sf.getName().equals("..") && sf.isDirectory()) { res.add(sf); } } } return res;...
cf22abc8-8b68-4f3c-b91c-08e5d2b18583
8
private void login_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_login_buttonActionPerformed String nameuser=namet.getText().trim(); String password=pass.getText().trim(); try{ Class.forName("java.sql.DriverManager"); Connection con=(Connection)...
29d3a5ff-830e-4a54-a73a-37e7cbf4f3ff
9
private static void terminal() { System.out.println(); Terminals terminals = Native.get(Terminals.class); boolean stdoutIsTerminal = terminals.isTerminal(Terminals.Output.Stdout); boolean stderrIsTerminal = terminals.isTerminal(Terminals.Output.Stderr); System.out.println("* Stdo...
7e87bded-6762-45b7-a7f0-41361a2eebc8
8
@Override public void afterPropertiesSet() throws Exception { ApplicationContextHelper.setApplicationContext(getApplicationContext()); // 执行初始化 EntityContainer.init(); if (servers != null && servers.size() > 0) { for (String item : servers) { String infos[] = item.split(","); if (infos != null && in...
7f114653-7c02-4760-9836-c5d8a25420f9
0
private HibernateSessionFactory() { }
b217d038-546f-4a00-9147-842db8877cb5
1
public BrandingVO getBranding() { if (this.brd == null) { setBranding(null, null, null); } return this.brd; }
59347902-dc61-424b-80a8-60411f1ee207
5
@Override protected Object getColumnValue(SoldItem item, int columnIndex) { switch (columnIndex) { case 0: return item.getId(); case 1: return item.getName(); case 2: return item.getPrice(); case 3: return item.getQuantity(); case 4: return item.getSum(); } throw new IllegalArgumentExcep...
d4f6f2bf-2100-402a-b533-cb0aecd23046
2
public RaavareDTO getRaavare(int raavareId) throws DALException { ResultSet rs = Connector.doQuery("SELECT * FROM raavare WHERE raavare_id = " + raavareId); try { if (!rs.first()) throw new DALException("Raavaren " + raavareId + " findes ikke"); return new RaavareDTO (rs.getInt(1), rs.getString(2), r...
58fee103-bb91-4f44-a0f3-448b46e12dc0
9
public void widgetChanged(JComponent widget){ super.widgetChanged(widget); if (widget == x1ControlGroup){ controller.setX1(x1ControlGroup.getCurrentValue()); } if (widget == y1ControlGroup){ controller.setY1(y1ControlGroup.getCurrentValue()); } if ...
d37f4d8e-819a-4bdc-89f7-d05157f6a2e9
4
@Override public short[] getData() { if (ptr != 0) { return null; } else { if (isConstant()) { if (length > getMaxSizeOf32bitArray()) return null; short[] out = new short[(int) length]; for (int i = 0; i < length; i++) { ...
5ba3fc58-957e-4555-8d03-064f8b375bbd
2
private boolean checkInclineUpWinn(char cellValue){ for (int i = 0; i < WIN_NUMBER_OF_CELLS ; i++){ if( field[i][fieldSize - i - 1] != cellValue) return false; } return true; }
688fffe7-49fa-48fb-8a07-aa3b0c7c8dd5
1
private double[] calculateSocialVelocity(int particle){ double[] socialVelocity = new double[position[particle].length]; int nBest = neighbourhood.neighbourhoodBest(particle); for(int k = 0; k < socialVelocity.length; k++){ socialVelocity[k] = socialConstant * (personalBest[nBest][k] - position[particle][k...
861ab462-97cd-44af-97b9-49a2b74a94fe
7
public boolean findPath() { // Alle noder som kan naas, men ikke er undersokt Set<Block> openSet = new HashSet<Block>(); // Alle noder man har funnet korteste vei til Set<Block> closedSet = new HashSet<Block>(); // Finnes det en vei gjennom kartet? boolean ok = false; // Nullstill alle blokkene for(int ...
0288ac51-50b4-4bd8-b2d8-60b3dd592f10
9
public void decode_instruction(String raw_instruction, Hashtable<String, Integer> label_map) { StringTokenizer st = new StringTokenizer(raw_instruction, ","); StringTokenizer st1 = new StringTokenizer(st.nextToken()); String ins_type = st1.nextToken().trim(), target = st1.nextToken() .trim(); get_class(ins_...
3f006e77-3628-4f91-93e4-d618ca4c8ac6
1
public static void main(String[] args) { SummonerRequests request = new SummonerRequests(); //example SummonerNameListDto summ = request.getListofSummonerNamesbySummonerID(Region.NA, "INSERTSUMMONERID,INSERTANOTHERSUMMONERID"); for(SummonerNameDto test : summ.getSummoners()) { System.out.println(test.getName(...
62d76e7f-0991-4218-a828-9afe2594ba6f
3
public void setPlus(TPlus node) { if(this._plus_ != null) { this._plus_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
5e12c215-8743-431d-a6e1-ee1c19d6e410
9
public Object clone() { Usersinfo cloned = new Usersinfo(); if (this.identification != null) cloned.setIdentification(new String(this.identification)); if (this.sipuri != null) cloned.setSipuri(new String(this.sipuri)); if (this.state != null) cl...
f6c7a1db-afb7-4f4d-abb0-25a0b0279149
8
@Override public void onEnable() { saveDefaultConfig(); pdfFile = getDescription(); plugin = this; console = getServer().getConsoleSender(); String UpdateChannel = plugin.getConfig().getString("System.UpdateChannel"); if (!UpdateChannel.equalsIgnoreCase("none")) { ...
b368411d-1699-44a1-a3f4-048eef3b7ea9
2
public static ArrayList<QuizTakenRecord> getQuizHistoryByQuizIDUserID(int quizID, int userID) { ArrayList<QuizTakenRecord> records = new ArrayList<QuizTakenRecord>(); String statement = new String("SELECT * FROM " + DBTable + " WHERE qid = ? AND userid = ?"); PreparedStatement stmt; try { stmt = DBConnection...
420d5e77-257e-4d94-9cc3-e27e3f44283c
6
public void setSettings(Settings settings) { if (this.settings != settings) { this.settings = settings; valuesTableModel.setValues(settings.getValues()); jPanel1.removeAll(); if (settings == null) { return; } for (JToggleButton toggleButton : settings.getSettingsButtons()) { jPanel1.add(togg...
4118bcab-5e48-4523-9b8b-37c5fde92f66
4
public Response performRequest(Request request) { if (request.getParams().containsKey("Id")) { if (request.getType() == Request.RequestType.GET) { return getter(request); } else if (request.getType() == Request.RequestType.PUT) { return putter(request); ...
d0391805-6172-47bc-bcc4-196039e6ab75
1
public void startGame() { // set starting positions for all players if (NumOfTeams == 0) { System.out.println("Individual Play"); IndividualPlay(); } else { System.out.println("Team Play"); TeamPlay(); } DisplayWinners(); // for (Player winner : winners) { // System.out.print("Player " + wi...
338599ff-4dcc-4a76-9f35-b556d208b44a
2
@SuppressWarnings("ReuseOfLocalVariable") private void paintInfoForCurrentTower(Graphics2D g2, Tower tower) { int x = TOP_MARGIN_X; int y = MARGIN_Y; g2.setColor(Color.BLACK); g2.drawString("Information about current tower", 0, y); y += SMALL_SPACING; g2.drawString("Type...
6c5249b4-5e1c-464d-99f0-4b9cf9bc9189
2
public boolean checkPassword(String entered_password) { for(int i=1;i<=3;i++) if( this.password== entered_password) { return true; } return false; }
0586297d-dc37-4564-b0d3-b9f0ff5a5569
1
public static long hash(String s) { long h = 7; String letters = "acdegilmnoprstuw"; for(int i = 0; i < s.length(); i++) { h = (h * 37 + letters.indexOf(s.charAt(i))); } return h; }
315160c3-5548-4f91-a8ef-b4258da59928
6
@SuppressWarnings("unchecked") public static Department queryDept(Department dept, boolean isCache) { Session session = null; Criteria criteria = null; List<Department> depts = null; try { session = sessionFactory.openSession(); criteria = session.createCriteria(Department.class); // 设置了则会进行...