method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8e38465d-c68c-478c-a203-eb062879e26f
6
public ArrayList<GameObject> createGame() { BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader(path)); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); if(sCurrentLine.indexOf("<GO>") != -1) parseG...
b2712fea-aaf5-435b-9c78-271dc280166e
5
private void newGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newGameActionPerformed long pop = Long.valueOf(population.getValue().toString()); Economy e = new Economy(pop * Long.valueOf(gdpPerCapita.getValue().toString()), Double.valueOf(governmentDebt.getValue().toString())); ...
af582054-bc62-4866-b42e-a7d06bf5d076
2
public void updateUI(SimulateurUI ui) { addObserver(ui); for (VoieInterne voie : voiesInternes) { ui.ajouterVoie(voie); ui.ajouterAccidentListener(voie); } for (VoieExterne voie : voiesExternes) { ui.ajouterVoie(voie); ui.ajouterAccidentListener(voie); } }
a9fc5245-ad2c-485a-aeea-716e3bc98547
9
private void addButtonListener(JButton b) { b.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { if (ev.getActionCommand().equals("Choose Source Folder")) { srcF = fileChooser(); if (srcF == null) { src.setText("no Source Folder selected"); ...
70dde999-c90c-4500-830a-cfee79717c8e
8
public boolean ColliderWithPodiumUp(){ if((x>=0 && x<=Podium.WIDTH-25) && (y<=GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp - HEIGHT/1.2 && y>= GameMain.GAME_HEIGHT_ASSUM - GameMain.DistanceBottomAndPodiumUp - HEIGHT)){ return true; } if((x>=GameMain.GAME_WIDTH+25 - Podium.WIDTH - Charac...
d19c6d4e-616b-4708-8d93-269d62d89313
1
public Graphics2D getGraphics() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); return (Graphics2D)strategy.getDrawGraphics(); } else { return null; } }
111f85aa-a7be-47ea-9e5d-c107e3a3df92
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vector2D vector2D = (Vector2D) o; if (Double.compare(vector2D.x, x) != 0) return false; if (Double.compare(vector2D.y, y) != 0) return false; ...
c30e8533-942b-4396-9c74-5b33ece2b6e2
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String serverID = null; if (jComboBox1.getSelectedIndex() > -1) { serverID = ((String[]) serverMap.get((Integer) jComboBox1.getSelectedIndex()))[1]; } System.out.pr...
50a9ffd8-4f4a-4516-a7f8-7e53c789867f
8
protected mxCellState[] getPreviewStates() { mxGraph graph = graphComponent.getGraph(); Collection<mxCellState> result = new LinkedList<mxCellState>(); for (Object cell : movingCells) { mxCellState cellState = graph.getView().getState(cell); if (cellState != null) { result.add(cellState); /...
17f6563d-ca5e-49c7-97a8-34bd79c5cd0e
3
public void startConnection() { try { if ((con == null) || (con.isClosed())) { con = DriverManager.getConnection( "jdbc:postgresql://java.is.uni-due.de/ws1011", "ws1011", "ftpw10"); System.out.println("Datenbankverbindung hergestellt"); } } catch (SQLException e) { e.printStackTrace(); ...
d77c59e4-7286-47a2-a3e3-3af84c5ca3fd
8
protected int setArmorModel(EntityPlayer par1EntityPlayer, int par2, float par3) { ItemStack itemstack = par1EntityPlayer.inventory.armorItemInSlot(3 - par2); if (itemstack != null) { Item item = itemstack.getItem(); if (item instanceof ItemArmor) { ...
feb06a51-ca28-46fc-b0a3-bc7addd61536
4
public HantoBasePiece(HantoPlayerColor playerColor, HantoPieceType type, HantoMove moveType, int moveDistance){ color = playerColor; this.type = type; switch(type) { case BUTTERFLY: this.moveType = moveType; this.moveDistance = moveDistance; break; case CRAB: this.moveType = moveType; this.mo...
ae40aaae-234e-4a9d-8733-14b9b82d71b0
9
public int GetCLStrength(int ItemID) { if (ItemID == 10707) { return 100; } if (ItemID == 6528) { return 60; } if (ItemID == 10707) { return 100; } if (ItemID == 10709) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("G...
8c238888-c0fb-45fc-a6aa-f8cbb72f6202
7
static int getNumber(char l) { l = Character.toUpperCase(l); if(l<='C') return 2; else if(l<='F') return 3; else if(l<='I') return 4; else if(l<='L') return 5; else if(l<='O') return 6; else if(l<='S') return 7; else if(l<='V') return 8; return 9; }
a784a1a7-3220-4ab3-a8fd-dcb10b041740
3
public void trim(int newSize) { if (newSize > size || newSize < 0) { throw new IndexOutOfBoundsException("Index: " + newSize + ", Size: " + size); } while (size > newSize) { attributeLists[--size] = null; } }
1023de5f-3fef-4ca3-af90-16fc34884022
0
public int getLeftScore() { return leftScore; }
5194564a-0267-4e6d-a0af-a0b3ed3df98f
0
@Override public String toString(){ return super.toString()+ " in category : Axes" + " with attack " + this.attackScore; }
183e6960-7cfb-4854-a68f-f48917dcc431
4
public String toString() { StringBuffer s = new StringBuffer(); if (this.vorzeichen) s.append('-'); for (int i = this.mantisse.getSize() - 1; i >= 0; i--) { if (i == this.mantisse.getSize() - 2) s.append(','); if (this.mantisse.bits[i]) s.append('1'); else s.append('0'); } s.append(" *...
a9ccaf3c-7a1c-42de-bad5-67b2a4026cdc
7
private void initLoadingstatusFontMenu(Color bg) { this.loadingstatusPanel = new JPanel(); this.loadingstatusPanel.setBackground(bg); this.loadingstatusPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); String initFontTmp = this.skin.getLoadingStatusFont(); int initFon...
24039293-b313-4888-9ed1-0749805bc2a8
5
private void computeClusterCentroids() { HashMap<Integer, ArrayList<Double>> sumClusterCentroids = new HashMap<Integer, ArrayList<Double>>(); HashMap<Integer, Integer> memberCount = new HashMap<Integer, Integer>(); for (Map.Entry<ArrayList<Integer>, Integer> entry : gridLabel.entrySet()) { // get the grid ...
f3b105ff-0566-4aec-bec1-4a33c9f89b16
8
public DistributedQuery(Statement s, ArrayList dbList) { this.tempDB = s; this.dbList = dbList; String os = System.getProperty("os.name").toLowerCase(); if (!ServicesParser.isInitialized()) { String servicesFile; if (os.indexOf("windows"...
8d8b41f0-304f-494f-af4b-a1352a90720c
9
@Override public void genOperationComment(StringBuffer buff, Map<String, String> simpleToPrimitiveTypeMap, Operation o) { genBeginSeperator(buff); buff.append(String.format("#' @title %s\n", o.name)); String description = o.description.replaceAll("[\\t\\n]", " "); descrip...
825e7941-0817-4ada-8a16-28ac2506ee90
3
private static Move ForwardRightForWhite(int r, int c, Board board){ Move forwardRight = null; if(r<Board.rows-1 && c<Board.cols-1 && board.cell[r+1][c+1] == CellEntry.empty ) { forwardRight = new Move(r,c, r+1, c+1); } return forwardRight; ...
114144a7-a0e9-4375-8288-0cb7ebea5e4d
9
public void close() { try { if (rs != null && !rs.isClosed()) { rs.close(); } } catch (SQLException e) { e.printStackTrace(); } try { if (pstmt != null && !pstmt.isClosed()) { pstmt.close(); } ...
b1783962-4256-488f-bd77-e6bdd3371049
1
public boolean isItemSent() { if (itemSentInt == "1") { return true; } else { return false; } }
f14ee575-ade6-4641-8c6a-67ff7fe93f96
5
@Override public void handleIt(Object... args) { Scanner inputReader = new Scanner(System.in); System.out.print("Are you sure you want to quit? (y/n): "); String userInput = inputReader.next(); if (userInput.equals("y") || userInput.equals("Y")) { Socket sock = (Socket) args[0]; try { sock.close(...
2f169f81-0b57-44b1-b2a9-8a5af080b5be
0
@Override public String getTitle() { Document doc = this.viewer.getDocument(); return (String) doc.getProperty(Document.TitleProperty); }
78aebd00-d21a-4537-9556-80a881ba725b
1
public static String getln() { StringBuffer s = new StringBuffer(100); char ch = readChar(); while (ch != '\n') { s.append(ch); ch = readChar(); } return s.toString(); }
acefd15d-d4f6-4819-a1f0-2a2bdb424d79
4
@Override public StringBuffer getOOXML( String catAxisId, String valAxisId, String serAxisId ) { StringBuffer cooxml = new StringBuffer(); // chart type: contains chart options and series data cooxml.append( "<c:line3DChart>" ); cooxml.append( "\r\n" ); cooxml.append( "<c:grouping val=\"" ); if( is100Pe...
55cd69a6-40e1-4856-bdf1-3e6d5d535d98
2
private String getFechaSQL(String fecha){//01/02/2013 if (fecha!=null) { if (fecha.length() > 8) { return fecha.replace("/", "-"); } } return "1900-01-01"; }
087d0259-b3ff-444a-9a3a-450bc810676e
2
private ChatConnection getDestinationUserConnection(String destinationUser) { for (ChatConnection connection : connections.values()) { if (destinationUser.equals(connection.getUserName())) { return connection; } } return null; ...
474d6feb-924e-4bf5-9d69-0ea0dfb8b7fc
4
public static boolean[] string2BooleanArray(@NotNull String convertable) throws IkszorConvertException { boolean[] result = new boolean[convertable.length() * 8]; try { int real = 0; for(byte b : convertable.getBytes()) { int val = b; for(int i = 0; i < 8; i++) { result[real+i] = (val &...
85c1a8b4-7fee-4da2-9fad-b24fd0d22de1
2
public void explicitFitness() { for (int i = 0; i < getSpecies().size(); i++) { for (int j = 0; j < getSpecies().get(i).getNumberOrganisms(); j++) { double newFitness = getSpecies().get(i).getOrganism(j).getFitness() / (double) sumSharingFunc(getSpecies().get(...
d497ea89-05ca-4ee7-a0cc-0bb2a477e0a0
9
*/ private void recListPopup(MouseEvent e) { JTable tbl = null; JScrollPane pane = null; try { tbl = (JTable)e.getSource(); } catch (ClassCastException cce) { pane = (JScrollPane)e.getSource(); if (pane.equals(queryDbPane)) { tbl = queryDbTable; } else if (pane.equals(resultPane)) { tb...
eb31fe93-5d87-4edc-be0f-3c3c369e475d
7
public static void main(String[] args) throws IOException { File inputFile = new File("entrada"); if (inputFile.exists()) System.setIn(new FileInputStream(inputFile)); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line; HashMap<C...
05ce2e4d-29c3-4dea-8a83-2580fb7b0000
7
public static void makeSimple() { removeList.clear(); for (RoadGraph i : JMaps.getRoadGraphList()) { if (!i.isImportant() && !i.isSocket()) { int curve1, curve2; curve1 = i.getList().get(0); curve2 = i.getList().get(1); for (Ro...
43799ce4-e2f7-403d-9ebc-f1a35e211a69
4
private void setHealth(int newHealth, boolean notifyListeners) { int previousHealth = health; health = newHealth; if(notifyListeners){ for (EntityHealthListener listener : healthListeners) { listener.healthChanged(this, previousHealth, newHealth); } } if (health <= 0 && alive) { die(true); ...
57e950fe-762d-4bb2-ab7b-4686443b3807
3
@Override public boolean onMouseDown(int mX, int mY, int button) { if(super.onMouseDown(mX, mY, button)) { return true; } for(WeaponLocationDisplay wld : weaponLocDisplays) { if(wld.onMouseDown(mX, mY, button)) { return true; } ...
636d1dcf-e29f-4bb1-8dc7-2d51478c226b
5
public void FollowPlayerCB(int NPCID, int playerID) { int playerX = server.playerHandler.players[playerID].absX; int playerY = server.playerHandler.players[playerID].absY; npcs[NPCID].RandomWalk = false; if(server.playerHandler.players[playerID] != null) { if(playerY < npcs[NPCID].absY) { ...
9e3a1866-4523-4f7c-9e26-9c4b0dd7aa0c
3
protected boolean isElementoEnHechosPreguntados(String elemento) { if (null != hechosPreguntados) { for (String s : hechosPreguntados) { if (elemento.equals(s)) { return true; } } } return false; }
cb46919d-36da-430f-92a8-bb29a8e4fdfe
5
public void start() { ImageLoader.init(); Game.init(); game = Game.getInstance(); final int DELTA_TARGET_NANOS = DELTA_TARGET * 1000 * 1000; while (true) { long timeStart = System.nanoTime(); BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); continue; }...
7f11dc77-1400-4c98-aa6a-69d572c876dd
3
private void indexFromRequests(List<Order> orders, Map<String, Product> productMap, OrderHistory history) { for (Order order : orders) { Indexed<Product> x = search.get(order.getSku()); if (x == null) { Product product = productMap.get(order.getSku()); if ...
c544473d-02db-462f-b389-210a78def678
1
private String[] getIDsToArrays(final String stringView) { StringTokenizer st = new StringTokenizer(stringView,","); int number = st.countTokens(); int i = 0; String[] strings = new String[number]; while (st.hasMoreTokens()) { strings[i] = st.nextToken(); i++; } return strings; }
fe831891-2e96-4783-b3fc-b20608e09df9
8
@Override public void analyzeLine(String line, int lineNumber, RequireJsModule module) { String varName = null; String dependencyId = null; Matcher match = NAMED_REQUIRE_REGEX.matcher(line); if(match.find()) { varName = match.group(1); String tentativeDependency = match.group(2); if(!tentativeDepen...
a49b4d76-bc8a-4ea7-9966-76e00953f298
0
public void setjTextFieldNum(JTextField jTextFieldNum) { this.jTextFieldNum = jTextFieldNum; }
64420a4e-e62a-477f-a252-77e5eac4bb73
6
@Override protected Integer doInBackground() { Logger.getLogger(ReportGenerator.class.getName()).entering(ReportGenerator.class.getName(), "doInBackground"); try { nbrOfAlbums = 0; nbrOfProcessedAlbums = 0; findNbrOfAlbums(); try { page...
2c6bb6ac-d322-408f-95e9-fb88309c5c13
5
public Elevator callUp(Rider r){ int startFloor = r.getFrom(); while(true) { for(Elevator e : elevators) { synchronized(e){ if(e.isGoingUp() && e.getFloor()<startFloor) { e.addRequest(r); return e; } else if(!e.isInTransit()) { e.addRequest(r); return e; } } ...
f571b55b-af94-44fd-bc89-a196f7057d0a
4
private void updateLights() { switch (_state) { case GreenNS_RedEW: _ewLight.setColor(LightColor.Green); _nsLight.setColor(LightColor.Red); break; case YellowNS_RedEW: _ewLight.setColor(LightColor.Yellow); _nsLight.setColor(LightColor.Red); break; case RedNS_GreenEW: _ewLight.setColor(Li...
263761a4-b97d-416d-8f55-b6b792cc9362
5
private void Show() { Game.gui.removeAll(); Point size = MenuHandler.PrepMenu(260,140); Prev.setBounds(size.x+190, size.y+100, 60, 24); Next.setBounds(size.x+10, size.y+100, 60, 24); Return.setBounds(size.x+80, size.y+100, 100, 24); if (Game.edit.owner > 0) { for (int i = 0; i < Game.displayU.size(); ...
632cf380-879c-48b2-b329-96dca9011def
3
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
2ba0b999-aae4-4310-9d86-a05787d676ba
1
public void visitMethodInsn( final int opcode, final String owner, final String name, final String desc) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append(' '); appendDescriptor(INTERNAL_NAME, owner); buf.append('.').append(name).appe...
f8ec9172-d10e-491a-991f-3f26662c889e
5
private static void solve_c_svc(svm_problem prob, svm_parameter param, double[] alpha, Solver.SolutionInfo si, double Cp, double Cn) { int l = prob.l; double[] minus_ones = new double[l]; byte[] y = new byte[l]; int i; for(i=0;i<l;i++) { alpha[i] = 0; minus_ones[i] = -1; if(prob.y[i] >...
abc39ca5-19ac-4fa5-a45a-54a1ac0f2943
2
public void RemoveFront() { if (getHead() == null) { return; } if (size == 1) { setHead(tail = null); size = 0; return; } --size; setHead(getHead().next); }
f991ff08-6474-44bc-ac38-2246eec6c614
5
public CheckResultMessage check19(int day) { int r1 = get(33, 5); int c1 = get(34, 5); int r2 = get(39, 5); int c2 = get(40, 5); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r1 +...
d1ae9690-2dcd-44ab-bd15-c6906601a65d
7
public static final BigInteger LCD(BigInteger... ints) { BigInteger lcd = BigInteger.ONE; for (BigInteger n : ints) { if (lcd.mod(n).equals(BigInteger.ZERO)) continue; for (BigInteger i = BigInteger.valueOf(2); i.compareTo(n) <= 0; i = i.add(BigInteger.ONE)) { ...
0331850d-da3a-4503-a450-40acd6759855
8
public void setOptions(String[] options) throws Exception { String tmpStr; String[] spec; String classname; tmpStr = Utils.getOption('W', options); if (tmpStr.length() > 0) { spec = Utils.splitOptions(tmpStr); if (spec.length == 0) throw new IllegalArgumentException...
d654553f-3ea4-46cd-bf4b-bf15dccb17b9
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...
2d4bfe65-2d20-4202-b801-48ae0738892e
9
private String convert(String[] words, int start, int end, int L) { StringBuilder sb = new StringBuilder(); // if this line only contains one word if (start == end) { sb.append(words[start]); for (int i = 0; i < L - words[start].length(); i++) { sb.append(" "); } return sb.toString(); } // if...
b4b95fcb-502b-4015-b88a-39ae0b0996c0
3
public static boolean writeFile(String[] values, String archivo) { FileWriter fichero = null; PrintWriter pw = null; try { boolean isDeleted = deleteFile(archivo); if (isDeleted) { fichero = new FileWriter(archivo, false); ...
b350a47c-ec0c-4998-bbfd-a162bd474172
0
public int getSize() { return nodes.size(); }
26202ccb-f956-4791-a8d4-02a53d7e3378
3
protected void setColorScheme(String colorScheme) { switch (colorScheme) { case "Standard": //set Standard ColorScheme this.activeColorScheme = new ColorScheme("Standard", Color.white, Color.black, new Color(100, 100, 100), Color.orange, new Color(230, 140, 0), Color.gray, new Color(90, 90, 90), Color.g...
e1a07a5e-7e1e-4de7-8a14-0994e279d3e1
6
@GET @Path("{food}") @Produces(MediaType.APPLICATION_JSON ) public PhotoBean getFoodPictureFromTag(@PathParam("food") String food) { Flickr f = FlickrDao.instance.getFlickr(); PhotosInterface photosInterface = f.getPhotosInterface(); Photo photo = null; Boolean visited[] = n...
f1a6653a-74b8-46e0-816c-10d1ae3b22d8
7
private GroupNode<K, V> getGroupNodeInstance( G group ) { GroupNode<K, V>[] buckets = mGroupBuckets; final int hash = (group == null ? 0 : rehash( group.hashCode() )); final int idx = hash & (buckets.length - 1); GroupNode<K, V> g = buckets[idx]; while( g ...
af15841c-5dea-4dd0-812b-a43e77643d49
2
public boolean tagAudioFile(boolean force) throws IOException { AudioFile theFile = fixTag(force); if (null != theFile) { try { theFile.commit(); } catch (CannotWriteException e) { throw new IOException(e); } return true; } return false; }
aa9d4e7f-8f49-4fac-8d50-98e6e1219f32
4
@Override public boolean equals(Object obj) { User other = (User) obj; if (getClass() == obj.getClass() && userId.equals(other.getUserId()) && firstName.equals(other.getFirstName()) && lastName.equals(other.getLastname())) return true; else return false; }
a252271f-c007-4775-9ce6-dcc78a7a822a
1
public void testConstructor_ObjectStringEx7() throws Throwable { try { new LocalDate("10:20:30.040+14:00"); fail(); } catch (IllegalArgumentException ex) {} }
98ea3655-dbda-4cbe-9aad-f05f60827499
3
public RegistrantList getRegistrantViewBy(String asViewById, String asLastModified, int aiMaxSize) { String lsParam = ""; if (aiMaxSize > 0) { lsParam += "&max_size=" + Integer.toString(aiMaxSize); } if (UtilityMethods.isValidStri...
3c15baab-6a0e-4f08-a896-669b9d560c99
9
public static void merge(File f, TreeMap<String, ArrayList<String>> map) { BufferedReader br = null; try { br = new BufferedReader(new FileReader(f)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { File outfile = new File(fileoutname); Buffe...
e3e8540c-da21-4bc1-8f1d-ac27c254ae69
3
@Override public Class<?> getColumnClass(int columnIndex) { // Returns the class of each column if (columnIndex == columnNames.indexOf("Name")) { return String.class; } else if (columnIndex == columnNames.indexOf("Description")) { return String.class; } else {...
8809f3ba-b54e-4afc-843a-55dad8e613e5
4
public static ArrayList<ArrayList<String>> gettopiclist() throws SQLException { String sql="select TopicName,Path from Topics"; ArrayList<ArrayList<String>> feedback = new ArrayList<ArrayList<String>>(); ArrayList<String> feed = null; try { ResultSet rs = st.executeQuery(sql); ResultSetMetaData rsm = r...
31f76da3-f978-49e8-8945-284537beb3cb
3
public void defuse() { if (bombActive && user.equals(bombHolder)) { if (wire(cmdArgs) == true) { connection.msgChannel(config.getChannel(), MircColors.WHITE + "Bomb defused."); bombActive = false; } else { connection.msgChannel(config.getChannel(), MircColors.BROWN + " ,...
61273ce3-2830-4b94-bd21-163f47286c1a
3
public static byte[] loadFile(final String path) { Preconditions.checkNotNull(path); InputStream fis = null; try { System.out.println(path); fis = new FileInputStream(path); BufferedInputStream bis = new BufferedInputStream(fis); byte[] byteArra...
7ffad1e3-00a4-4200-bf0a-d018bcbd25e8
6
public int evalRPN(String[] tokens) { //assume the length is greater than 3 final int len = tokens.length; Integer result = new Integer(0); Stack stack = new Stack(); for(int i = 0; i < len; i++){ if(!isOperator(tokens[i])) stack.push(Integer.valueOf(tokens[i])); else{ Integer operand2 = stack.p...
f48458ca-1362-4ff3-a92e-61a829099c5e
5
private void openSerialPort() { Boolean foundPort = false; //Ist schon ein Port geoeffnet wird nichts gemacht if (serialPortOpen != false) { System.out.println("Serialport already opened"); return; } String selectedPort = (String) comPortComboBox.getSelectedItem(); if(!selectedPort.conte...
725ec4f4-5050-4c6c-81cf-b5473d7f524b
9
private static String GonCalculate(int[] nodes) { int gonCount = nodes.length / 2; int[] result = new int[gonCount * gonCount]; ArrayList<Integer> nodeList = new ArrayList<Integer>(); for (int i = 0; i < nodes.length; i++) { nodeList.add(nodes[i]); } for (int...
0b15561f-5019-4edb-883b-898a38ccac3b
9
public void addKeyDefinition(KeyDefinition keyDef) throws XPathException { if (keyDefinitions.isEmpty()) { collationName = keyDef.getCollationName(); } else { if ((collationName == null && keyDef.getCollationName() != null) || (collationName != null && !collat...
1af1e288-974f-4443-94d9-6c7a26806d18
1
public void dispose(){ for(Texture texture : name2texture.values()){ texture.dispose(); } this.spriteBatch.dispose(); }
9fa7c72d-c56a-4fcd-a789-b11ecc6458b0
2
public static LinkedListNode partition ( LinkedListNode head, int x ) { int listSize = getListSize(head); LinkedListNode nd = head; LinkedListNode pre = new LinkedListNode(-1); pre.next = head; LinkedListNode dum = pre; for ( int i=0; i != listSize; ++i ) { LinkedListNode cur = nd; if (...
9b3729a9-55fc-447d-9b17-86481112e2e7
8
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYDifferenceRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYDifferenceRenderer that = (XYDifferenceRend...
0790a736-4ab2-413e-b599-f5a551c1e50a
4
private void constructTree(TreeElement<TreeValue> place, TreeValue value, int id) throws AlreadyExistException{ // choose right or left way if (place.getId() > id) { // add if empty if (place.hasLeftSon()) { constructTree(place.getLeftSon(), value, id); ...
28b04337-46aa-4778-8894-89cf3093dd4d
4
public void addOffset(int bhw,int p,int val,int[] encoding) { p=p-1; String o=Integer.toBinaryString(val); if(val>(Math.pow(2, p)*bhw-1) || val<-(Math.pow(2, p)*bhw)) { System.out.println("!---------- ERROR: Offset out of range ----------!"); System.exit(0); ...
ecd7881e-59d8-42aa-8bb1-93ab25b9f297
7
@Override public void actionPerformed(ActionEvent actionEvent) { Object src = actionEvent.getSource(); for (JButton bt : colorButtons) { if (src == bt) { currentColorButton.setText(bt.getText()); currentColorButton.setForeground(bt.getForeground()); ...
383aa5d4-cfff-4574-b5f9-a05e36da6536
4
@Override public StateBuffer execute(StateBuffer in) { StateBuffer curBuffer = new StateBuffer(); for(State s : in.getStates()) skipToStart(curBuffer, s); StateBuffer goalBuffer = new StateBuffer(); // boolean first = true; TreeMap<Integer, StateBuffer> next = new TreeMap<Integer, StateBuffer>(); if (...
e1b26c14-1987-4f05-9872-6f5e448d7fde
7
private void loadAllSuitesAndCases() throws InstantiationException, IllegalAccessException { Set<Class<? extends TestCase>> caseClases = getAllTestCaseClasses(); for (Class<? extends TestCase> caseClass : caseClases) { if (isIgnore(caseClass)) { continue; } String packageName = caseClass.getPack...
68487842-df52-416e-9b6a-a477fcd15047
4
* @return The row, or <code>null</code> if none is found. */ public Row overRow(int y) { List<Row> rows = mModel.getRows(); int pos = getInsets().top; int last = getLastRowToDisplay(); for (int i = getFirstRowToDisplay(); i <= last; i++) { Row row = rows.get(i); if (!mModel.isRowFiltered(row)) { po...
d378ee2d-7e78-43f0-a3a5-b8cb6d5c9ffd
8
public void setCutOffMatrix(float cutoff) { if (cutoff <= 0) throw new IllegalArgumentException("cutoff<=0"); rCutOff = cutoff; double[] sig = new double[Element.NMAX]; sig[ID_NT] = nt.getSigma(); sig[ID_PL] = pl.getSigma(); sig[ID_WS] = ws.getSigma(); sig[ID_CK] = ck.getSigma(); sig[ID_MO] = mo.getS...
0529692c-b65f-49d9-a66b-8953bf71fe4f
3
public static int dajTrenutniBrojGostiju() { Session session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery("from " + Boravak.class.getName()); List<Boravak> sviBoravci = (List<Boravak>)q.list(); session.close(); Date today = new Date(); int trBroj = 0; for(Borav...
ef91d085-7a82-429e-afc4-dddc0c167143
2
@Override public void act() { robot.setAhead(1000); if ((new Random().nextInt(3) + 1) == 1) { robot.turnRight((new Random().nextInt(3) + 1) * 30); } if ((new Random().nextInt(5) + 1) == 1) { randomColor(); } }
bfde9e59-7050-4005-9e3b-a5ac7e45968a
1
private static boolean insertDrug(Drug bean, PreparedStatement stmt) throws SQLException{ stmt.setString(1, bean.getDrugName()); stmt.setString(2, bean.getDescription()); stmt.setInt(3, bean.getQuantity()); stmt.setBoolean(4, bean.isControlFlag()); stmt.setString(5, bean.getSideEffect()); int affected =...
b2eb0236-27d0-432a-9775-555aa10e3e94
1
private DefaultTableModel makeModel() { DefaultTableModel model = new DefaultTableModel(null ,columnNames){ private static final long serialVersionUID = 1L; public boolean isCellEditable(int row, int col) { if (col!=6) return false; return true; } }; return model; }
4e603670-8947-443c-b618-999f7e58ed83
3
@FXML private void handleMenuReportItems(ActionEvent event) { File file = new File("商品情報一覧.txt"); try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { bw.write(String.format("%s\t%s\t%s\t%s\t%s\r\n", "バーコード", "商品名", "単価", "仕入先", "部門")); tr...
2f803c38-cdbb-4a91-a05d-afcfb6656d40
5
public boolean isBalancedNoStorage(treeNode root) { if (root == null) return true; if (!isBalancedNoStorage(root.leftLeaf)) return false; if (!isBalancedNoStorage(root.rightLeaf)) return false; int depthLeft = depthOfNodeNoStorage(root.leftLeaf); int depthRight = depthOfNodeNoStorage(root.rightLea...
66b73f70-4f7f-45ff-b590-1633a2517c1b
9
private void equipCommand(String input, Player hero) { boolean pass = false; Equipment original = null; //The original equipment that was on the player Equipment temp = null; //The equipment found in the players inventory for (Item i : hero.getInventory()) { for (String s : ...
25da3fbc-22ac-4bfc-ac7e-ee5cfab6569f
7
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the // container // has not yet been calculated so lets ask for the maximum. ...
868f9c34-2a28-46e3-ade5-d007b37e286e
2
@Override public void propertyChange(PropertyChangeEvent evt) { if(evt.getPropertyName().equals(GameModel.EVENT_ADDED_SCORE)) { if((Integer)evt.getNewValue() > 1) { addedScore = (Integer)evt.getNewValue(); timerOn = true; timerStart = Calendar.getInstance().getTimeInMillis(); } } }
1b3ef637-2423-4a51-a28a-96a890d9f540
4
private int opPrecedence(Operator opr, int sid) { if (opr==null) { return Integer.MIN_VALUE; } // not an operator else if(opr.unary==NO_SIDE || opr.unary!=sid) { return (sid==LEFT_SIDE ? opr.precedenceL : opr.precedenceR); } // operator is binary...
efb6f3c0-9ceb-49b3-8135-6729dcdf0b4f
8
private DensityMap createDensityMap(int numRateBoxes, int numTimeBoxes) { double maxTreeHeight = 0; double minRate = 1; double maxRate = 1; for (RootedTree tree : treeList) { double thisHeight = tree.getHeight(tree.getRootNode()); if (thisHeight > maxTreeHeight) maxTreeHeight = thisHeight; Set<Node...
aa3cbe45-5e56-4cbe-b34c-092a61537cb5
2
private void timeStep(){ for (int i = 0; i < beings.size(); i++) { fight(i); } for (int i = 0; i < beings.size(); i++){ move(i); } }
5b2da7cd-94d5-4efe-9c88-03a4ba769a9c
2
private void dealTag(Tag tag, WebPage srb) throws Exception { NodeList list = tag.getChildren(); if (list != null) { NodeIterator it = list.elements(); while (it.hasMoreNodes()) { parserNode(it.nextNode(), srb); } it = null; } list = null; }
d5fe7875-a906-451f-8574-ec56ec9f8715
1
public void render(GameContainer gc, Graphics g) throws SlickException { for (Ray r : rays) { r.render(gc, g); } }