method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
93d2f850-2e4e-4f4e-96dc-a1701d47710d
9
public static PdfPTable DetailedDistribution(String str) throws DocumentException, IOException { //创建表格 PdfPTable table = new PdfPTable(10); table.setWidthPercentage(100); PdfPCell cell; //设置中文 BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED...
bc9f100c-74f1-431b-9253-e76f98f8c3d8
5
public void refresh(){ Graphics g = getGraphics(); for(int x = 0; x < 500; x += 50){ for(int y = 0; y < 500; y += 50){ if(player.xPos == x/50 && player.yPos == y/50){ g.setColor(Color.GRAY); g.fillRect(x + 10, y + 10, 30, 30); g.setColor(Color.BLACK); g.drawRect(x + 10, y + 10, 30, 30); ...
e0063191-a769-4989-bb08-64aa2f5ad293
1
private void isEveryOneVoted() { if (play.nightPollStatus()) removePlayer(); }
5f465210-25b8-4739-9714-e370b8795bfb
7
public static void main(String[] args) throws Throwable { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); HashMap<String, Integer> letras = new HashMap<String, Integer>(); int lineas = Integer.parseInt(bf.readLine()); for (int i = 0; i < lineas; i++) { String in = bf.readLine(); ...
53809e73-e0cc-44be-a5fb-a17a9fd5d02b
1
@Override public boolean canBomb() { return bombs > 0 && tile.passable(); }
5cc1a17c-a652-4756-93ad-30a865ef8eaa
8
@EventHandler public void click(InventoryClickEvent event) { Player p = (Player) event.getWhoClicked(); Inventory inv = event.getInventory(); String name = inv.getTitle(); if(name.equals(title) && event.getRawSlot()!= -999) { event.setCancelled(true); ItemStack item = event.getCurrentItem()!= null ? even...
8e2b7f52-4d67-418b-8716-559c067cfcde
8
@Override public void actionPerformed(ActionEvent e){ JButton button = (JButton) e.getSource(); Point rv = new Point(); Piece selection = game.gameBoard.boardArray[button.getLocation(rv).x/100][button.getLocation(rv).y/100]; if(selection == null || (selectedPiece...
048592b9-34e6-4962-9c88-d4214bd03a3c
1
@Override public void setTitle(String charname) { String str = TITLE; if (charname != null) { str = charname + " - " + str; } super.setTitle(str); }
14601c6d-b303-4c54-98bb-88ec380ae16d
3
private void initPopupMenu(){ popupMenu = new JPopupMenu(); ImageIcon itemDeleteIcon = new ImageIcon(Main.ICO_PATH + "table_row_delete.png"); JMenuItem itemDelete = new JMenuItem(" Delete ", itemDeleteIcon); itemDelete.addMouseListener(new MouseAdapter() { @Override ...
bf6a70de-2250-4556-a523-bd94718480f6
2
private void processLines(FileData coverageData, StringBuilder lcov) { for (int lineNumber = 0; lineNumber < coverageData.getLines().size(); lineNumber++) { Integer count = coverageData.getLines().get(lineNumber); if (count != null) { lcov.append(format(lineData, lineNumb...
b2c81354-3f7f-4f07-9bf2-7ed3ef189031
8
@Override public boolean replaceChild(Construct replaceMe, Construct newCon) { if(mState != null && mState.mPlaceholders != null) { int indexOfOldConstruct = this.children.indexOf(replaceMe); Placeholder descriptor = null; // If the index of the old construct is bigger than our placeholders // size...
a15c4a23-11ff-46b0-ac77-e3553bd0f1ad
0
public String getIp() { return ip; }
f9418316-3002-449a-ad57-e0641434d423
5
public static Map<Integer, Set<Class<?>>> simpleParameterClasses(final Class<?>... classes) { final Map<Integer, Set<Class<?>>> res = new HashMap<>(classes.length); for (int i = 0; i < classes.length; i++) { final Set<Class<?>> set = new HashSet<>(1); set.add(classes[i]); res.put(i, set); } return r...
4d92d31e-1776-497d-af60-8907368463bd
2
public void testGetFieldType_int() { LocalTime test = new LocalTime(10, 20, 30, 40); assertSame(DateTimeFieldType.hourOfDay(), test.getFieldType(0)); assertSame(DateTimeFieldType.minuteOfHour(), test.getFieldType(1)); assertSame(DateTimeFieldType.secondOfMinute(), test.getFieldType(2)); ...
d01d83c8-7327-4ff7-9f44-78301c24a2d9
3
public void testVerifyValueBounds() { try { FieldUtils.verifyValueBounds(ISOChronology.getInstance().monthOfYear(), -5, 1, 31); fail(); } catch (IllegalFieldValueException e) { assertEquals(DateTimeFieldType.monthOfYear(), e.getDateTimeFieldType()); assert...
8eda5feb-fe03-473f-9732-29809ba95e89
6
public void onUpdate() { this.field_22062_y = 0.0F; super.onUpdate(); this.field_705_Q = this.field_704_R; double var1 = this.posX - this.prevPosX; double var3 = this.posZ - this.prevPosZ; float var5 = MathHelper.sqrt_double(var1 * var1 + var3 * var3) * 4.0F; ...
883d836d-7ed7-4fd5-a3ed-e831ee656e7d
4
public Pizza createPizza(String type) { Pizza pizza = null; if (type.equals("cheese")) { pizza = new CheesePizza(); } else if (type.equals("pepperoni")) { pizza = new PepperoniPizza(); } else if (type.equals("clam")) { pizza = new ClamPizza(); } else if (type.equals("veggie")) { pizza = new Veggi...
eaeb1c88-3d1b-4f40-8abe-faf7a75c3945
2
public void resetPlayerPanel(Player p) { this.removeAll(); this.hand = this.player.getHand(); this.books = this.player.getBooks(); this.add(this.playerName); BookStack bs; for (int i = 0; i < this.books.size(); i++) { bs = new BookStack(this.books.get(i).getBookNum()); this.add(bs); } ArrayList<Ca...
8eea1e87-2a66-4757-bc87-1aa3cba7681b
6
public void processOtherEvent(Sim_event ev){ switch(ev.get_tag()){ // receives the application and submits each one of its // gridlets (jobs) to the broker. case GridSimTags.EXPERIMENT: // Requesting the GridInformationService // to send a list of resources ...
ebf7af1f-bb86-4f51-b1ed-245c463485ab
3
protected void routerURL(String path , HttpServletRequest request , HttpServletResponse response) throws IOException{ //First Page if(path.equals("/") || path.equals("/*")){ return ; } //Router PluginImpl plugin = PluginTree.getInstance().getPluginByPath(path) ; if(plugin != null){ plugin.getRes...
b011ee17-b62e-45c9-a81c-3a526a28b945
4
public static void main(String[] args){ File entrada = null; Scanner sc = null; FileWriter salida = null; PrintWriter pw = null; ArrayList<Carta> cartas = new ArrayList<Carta>(); Mano m = null; try{ ...
14568f97-81f5-49f9-834f-b384c9dabc6a
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
d5968b99-c3d0-4305-b079-b7e0b38e3d0b
7
private boolean doKeyword(Segment line, int i, char c) { int i1 = i+1; boolean klassname = false; int len = i - lastKeyword; byte id = keywords.lookup(line,lastKeyword,len); if ( id == Token.NULL ) { klassname = true; for ( int at = lastKeyword; at < lastKeyword + len; at++ ) { char ch = line...
fd61e92a-8416-4b49-888e-e258d8a0331a
4
public static Browsers parseUserAgent(String userAgent) { if(userAgent.contains("Firefox")) return Browsers.FIREFOX; if(userAgent.contains("Trident")) return Browsers.INTERNET_EXPLORER; if(userAgent.contains("Chrome")) return Browsers.CHROME; if(userAgent.contains("Safari")) return Browsers.SAFARI; ...
b2dc633a-0bef-4631-81d0-0704205c3317
6
public Complex weightedMean_as_Complex() { if (!weightsSupplied) { System.out.println("weightedMean_as_Complex: no weights supplied - unweighted mean returned"); return this.mean_as_Complex(); } else { boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weightingOptionI) { Stat.wei...
38ade66f-f9bc-4f13-9d49-28320b4e127b
3
public static Connection GetConnection() { Connection conexion=null; try { Class.forName("com.mysql.jdbc.Driver"); String servidor = "jdbc:mysql://localhost/gamecrush"; String usuarioDB="gamecrush"; String passwordDB="1234"; ...
f02b1a61-ca5b-49f8-83bc-fa06626a3b79
7
@Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(jbRanquear)) { String strMsg = validaFormulario(); if (!strMsg.equals("")) { JOptionPane.showMessageDialog(rootPane, strMsg); } else { if (jrbAdaptativa.isSelec...
feb3d1b5-681c-4c12-b3b9-6d3a9c2d55d4
6
private LCoord getBestLtr(double [][] w, boolean[][] used, char l){ LCoord lBest = null; double wBest = 0; char[][] board = super.currentGameState.getboard(); for (int r = 0; r < 5; r++){ for (int c = 0; c < 5; c++){ if (board[r][c] == l && used[r][c]==false){ if (w[r][c] > wBest){ //Letter...
deda6a1c-f61b-430c-a585-73f3cc9a8917
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Val other = (Val) obj; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) ...
1f2181e4-e93c-4253-bb79-e0e0e2bb7e3c
1
public SwingGraphics(Graphics graphics){ if (graphics == null){ throw new NullPointerException("Graphics object can not be null."); } this.graphics = graphics; }
ee2503e1-0e45-4d3b-846e-bd812b007d9e
3
public void perdu() { aPerdu = true; for(Propriete p : listePropriete) p.setProprietaire(null); for(Gare g : listeGares) g.setProprietaire(null); for(ServicePublic s : listeService) s.setProprietaire(null); caseActuelle = null; }
7844681e-51ec-43d2-8e7b-f1f43079a1f7
3
boolean isTopScore(String geneId) { double val = geneSets.getValue(geneId); return (!orderDescending && (val <= scoreCutOff)) // || (orderDescending && (scoreCutOff <= val)); }
ff06a356-1d47-41c6-86cc-84ee417ac6cc
8
protected void printTopWord(int k, String topWordFile) { System.out.println("TopWord FilePath:" + topWordFile); Arrays.fill(m_sstat, 0); for (_Doc d : m_trainSet) { for (int i = 0; i < number_of_topics; i++) m_sstat[i] += m_logSpace ? Math.exp(d.m_topics[i]) : d.m_topics[i]; } Utils.L1Normalizat...
6f05515b-7a72-44b7-9d5b-b3c72afc7719
5
public void removeBan(String pname) { try { String[] banList = plugin.getBans(); ArrayList<String> arraylist = new ArrayList<String>(); for (String p : banList) { if (p != pname) { arraylist.add(p); } } new File(plugin.getDataFolder() + File.separator + "bans.txt") .createNewFile(); ...
21c4e3b3-4f98-4efd-b4fe-02fee2568cfd
5
public boolean isBaseColor() { switch(this) { case Red: case Black: case Blue: case Green: case White: return true; default: return false; } }
76faf111-766f-45f4-b6bd-cb5e75eb711f
4
public static <L> Fst<L> determinize(Fst<L> nondet) { Fst<L> det = new Fst<L>(); ArrayDeque<Collection<State>> stack = new ArrayDeque<>(); Map<Collection<State>, State> chart = new HashMap<>(); stack.push(nondet.initialStates); Multimap<L, State> transFunction = HashMultimap.create(); while (!stack.isEm...
2843bd79-aad0-4b0c-acce-d3b81d60c0e9
1
public boolean passed() { return compilationErrors.isEmpty() && missingCompilationUnits.isEmpty(); }
4990d4cb-a8a5-40eb-b883-6531c15496a5
3
public synchronized static String id(String trackingCode, Context context) { if (sID == null) { System.out.println("file creating"); File installation = new File(context.getFilesDir(), INSTALLATION + "-" + trackingCode); try { if (!installation.exists()) ...
dcb69785-95f1-450e-bf31-61e3b43a0602
2
@Override public List Listar() { Session session = null; List<Ejecutivo> ejecutivo = null; try { session = NewHibernateUtil.getSessionFactory().openSession(); Query query = session.createQuery("from Ejecutivo"); ejecutivo = (List<Ejecutivo>) query.list()...
9613f148-c5f4-43c0-85ca-830689e42573
3
@Override public boolean update(DataRow parameters, DataRow row) { Boolean flaga = false; try { con = DriverManager.getConnection(url, login, password); String stm; String tabelName = row.getTableName(); List<DataCell> cell...
aa70c800-951a-44e8-b0bb-39ac56f0ef52
7
public static Point[][] getPlayersPositions(final int playerCount){ switch(playerCount){ case 128: return get128PlayersPositions(); case 64: return get64PlayersPositions(); case 32: return get32PlayersPositions(); case 16: return get16PlayersPositions(); case 8: return get8PlayersPo...
de580338-5120-4fd3-ae39-22b90414aea3
4
public void updateOptionPanel() { year = Database.getInstance().getYear() + "年"; scenarioName = Database.getInstance().getScenarioName(); playerName = Player.getInstance().getPlayerName(); yearLabel.setText(year); scenarioLabel.setText(scenarioName); playerForceL...
f02e5c41-a73d-4034-aacd-e82c16520a9c
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...
f9c380fd-67b2-4992-98a2-6b5b4e9d417f
4
public Image getTile(int x, int y) { if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) { return null; } else { return tiles[x][y]; } }
ea74be64-5568-4ed4-aa17-997ab99fbbd4
4
public void completedRow(int rangee){ for(int x=0; x<emplacement.getNombreColonne() ; x++) emplacement.setCoordonee(x, rangee, false); for(int y=rangee; y>0 ; y--) for(int x=0; x<emplacement.getNombreColonne() ; x++) if(!emplacement.IsEmpty(x, y)){ ...
50abc1bf-dcba-40a7-8f55-4b34ead19cb2
4
public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { renderButton.setForeground(table.getSelectionForeground()); renderButton.setBackground(table.getSelectionBackground()); } else { renderButton....
ae72a369-d84a-4615-ae4a-ca5c21e994dc
8
private void writeBuffer(long timeout, long startTime, ByteBuffer queryBuffer) throws IOException { SelectionKey writeKey = socketChannel.register(selector, SelectionKey.OP_WRITE); boolean firstTime = true; while (queryBuffer.hasRemaining() && currentTime() - startTime < timeout) { ...
87a9f16d-01bb-49e3-b3db-742a24631a08
1
public void testCoolGenerationOfTokens() { TargetGenerator generator = new TargetGenerator(); Combination<Colors> combi = generator.generate(); Set<Colors> combiDifferentColors = new HashSet<Colors>(); for (int i = 0; i < 5; i++){ combiDifferentColors.add(combi.get(i).getColor()); } ...
6f870b95-0880-4f08-9ffc-1af15353a19b
1
private void botonBorrarCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarCompraActionPerformed //la quitamos de la lista y del modelo int fila = jTableCompras.getSelectedRow(); if (fila != -1) { DefaultTableModel modeloCompra = ((DefaultTabl...
cfbe83d7-59b8-4eeb-9230-3fde0b2af3da
4
public void setDialogueScript(String ID){ if(ID==null)return; if(ID.equals("none") || ID.equals("null") || ID.equals("empty")){ script = null; isInteractable = false; } else { script = new Script(ID, ScriptType.DIALOGUE, main, this); isInteractable = true; } }
880cd67d-e7d8-4a77-a251-041372659f04
3
@SuppressWarnings("unchecked") public static ArrayList<LearningPlugin> loadPlugin(String filePath) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException{ ArrayList<LearningPlugin> plugins = new ArrayList<LearningPlugin>(); URLClassLoader loader = new UR...
ef975a51-d9ef-4eec-9b93-c020996f9e54
2
public static void unpackConfig(Archive container) { ItemDefinition.dataBuffer = new Stream(container.get("obj.dat")); Stream indexBuffer = new Stream(container.get("obj.idx")); ItemDefinition.itemCount = indexBuffer.getUnsignedShort(); ItemDefinition.itemIndices = new int[ItemDefinition.itemCount + 10000]; i...
576759d4-78a4-4b9f-bdd8-bdb078a458d8
9
public boolean inicializarDatos(String nombres, String distancias) { ce = new CjtElementos(); if(nombres == null) return false; String delims = "[ ]+"; String[] tokens = nombres.split(delims); //Comprovem que entrin correctament elements ...
0d98f951-dd5a-45d6-976b-4bd313484f95
7
protected void readChildren(XMLStreamReader in) throws XMLStreamException { Game game = getGame(); while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { if (in.getLocalName().equals(UNITS_TAG_NAME)) { // @compat 0.10.5 while (in.nextTag() != XMLStreamConsta...
31833b76-e9fc-4e65-a7fe-b7af04b17cc1
3
private synchronized void updateGridletProcessing() { // Identify MI share for the duration (from last event time) double time = GridSim.clock(); double timeSpan = time - lastUpdateTime_; // if current time is the same or less than the last update time, // then ignore ...
8c8a90da-30d7-46be-9b94-48343e3eb057
3
public int typeToInt(String type) { if(type.equals("MCQ")) { return 1; } if(type.equals("FIB")) { return 2; } if(type.equals("Essay")) { return 3; } return 0; }
11f96594-fe49-423e-9d1d-72a8a3a69952
3
public String toString(){ String ret = name + ": "; for(int i = 0; i < paare.length; i++){ if(paare[i] == null || positionen[i] == null) continue; ret += "Paar: " + paare[i].paarnummer + ":(" + positionen[i].x + "," + positionen[i].y + "), "; } return ret; }
a36570cb-8cda-4b76-9027-c1a26c386b7d
6
@Override public String nextName() throws IOException { expect(JsonToken.NAME); Iterator<?> i = (Iterator<?>) peekStack(); Map.Entry<?, ?> entry = (Map.Entry<?, ?>) i.next(); stack.add(entry.getValue()); return (String) entry.getKey(); }
6855a331-e82c-42e4-bb44-11b3bc1f854b
7
public float[] computeBackwardError(float[] input,float[] error) { // проверки if (input == null || input.length != inputSize || error == null || error.length != matrix.length) throw new IllegalArgumentException(); // вычислим входящую ошибку float[] output = computeOutp...
6388e920-6682-4660-8ea8-3d448b17f80d
5
private String byteArrayToID(byte[] data) { StringBuilder ret = new StringBuilder(); for (int i = 0; i < data.length; i++) { if (i == 4 || i == 6 || i == 8 || i == 10) ret.append('-'); ret.append(String.format("%02x", data[i])); } return ret.toString(); }
6cfd7824-813f-4f90-a067-221ff5815e48
9
public void confirmEvent() { confirm.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String phonePattern = "[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}"; String pwd1 = new String(pwd1Field.getPassword()); String pwd2 = new String(pwd2Field.getPassword()); String id = bID...
b172143b-dd47-4ed2-9d8a-c80c514f564f
2
public void render(GameContainer gc, Graphics g, GameState state, float x, float y) throws SlickException { GL11.glDisable(GL11.GL_BLEND); level.render(g); GL11.glEnable(GL11.GL_BLEND); player.Render(gc, g, level.getCurrentLights(player.getPos())); // ennemy.Render(gc, g, level.getCurrentLights(ennemy.getPos...
c5d6dff9-0884-40a7-b1ac-d85de34bbd32
1
public void parse(Lexico scanner, Semantico semanticAnalyser) throws LexicalError, SyntaticError, SemanticError { this.scanner = scanner; this.semanticAnalyser = semanticAnalyser; stack.clear(); stack.push(new Integer(DOLLAR)); stack.push(new Integer(START_SYMBOL)); ...
8bd34918-dfc3-4db4-bd8e-ce1742401976
8
public void updateDishes(Set<Dish> modelDishes, int type) { //add all the dishes to the tabpanels from the model if (type == 1) { starter.scrollPanel.removeAll(); } else if (type == 2) { main.scrollPanel.removeAll(); } else if (type == 3) { desert.scrollPanel.removeAll(); } for (Dish dish : model...
427a74eb-05e3-48bf-9645-c077ee3fe580
5
public BufferedImage getTileImage(int x, int y) { if ((x < 0 || x >= map.length) || (y < 0 || y >= map[0].length) || map[x][y] == EMPTY_TILE) { return null; } return tiles.get(map[x][y]); }
dc6dbb9e-13aa-4ae1-8a55-9700f1cac5a0
6
@Override public void disconnect(IIOHandler a) { log.fine("Disconnect:"+a); if(side == Side.CLIENT) { if(SERVER != null) { sendPackage(new DisconnectPacket(), SERVER()); SERVER.stop(); SERVER = null; } try { if(socket != null) { socket.close(); } } catch(IOException e) { ...
4e41b652-4af9-48ed-a529-2111f41d2466
6
public boolean checkSql() { try { if (handler.sqlCon() != null) { if (handler.checkTables()) { if (!handler.customField.isEmpty()) { if (handler.checkCustomField()) { logInfo("Database connected. Custom Field OK."); return true; } logInfo("Cannot find custom field. Make su...
a68a0eaa-4b09-41c6-98eb-d5137ba1de58
4
public void hit(Card c) { hand.addCard(c); System.out.println(">Dealt: " + c.toString()); if (hand.getHandValue() > 21 && (hand.getHValues().contains(11))) { hand.getHand().get(hand.getHandRanks().indexOf("Ace")).setAce(); hand.setAceValue(); hand.setAceValue(); System.out.println(this.toString()); ...
5dba5ca5-2c4b-4c3c-88c0-95bdb2b49b99
3
public void init(){ MaxObject.post("Initializing Switchbox / Podium !!!"+"\n"); MaxObject.post("\n"); // outlet(0, "reset"); for(int i=0; i < pwmPorts.length; i++){ outlet(0, "pinMode" + " " + pwmPorts[i] + " " + 3); // PWM outlet(0, "analogWrite" + " " + pwmPorts[i] + " " + 0.0); }; for(int ...
8e80524a-7966-4083-8343-a44ebfd6a7a7
5
public boolean setPlayer1(Player player) { boolean test = false; if (test || m_test) { System.out.println("Game :: setPlayer1() BEGIN"); } if (player == null) { throw new IllegalArgumentException( "Game::SetPlayer1 - Invalid player type(null) for player1"); } m_pl...
0aae6e2b-c5ae-4044-b0a5-fa9bcd6d24d3
6
public void escreve(String nome){ String content = ""; String content2 =""; for(int i = 0 ; i < lChegada.size() ; i++){ if( i%10==0 && i != 0){ content = content.concat("\n"); content2= content2.concat("\n"); } content = content...
3a6de516-efd3-40ff-949f-aad338c0504f
4
public static void changeClosed(int rentTransID, int closed, String dateReturned) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ co...
bf94773c-a3bd-4aa4-9f69-a2756223500f
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Pruefung)) { return false; } Pruefung other = (Pruefung) object; if ((this.id == null && other.id != null) || (...
d9485736-c32e-4723-b148-ee95e54d079a
5
public String monthL(String field) { String newField = ""; for(int i = 1; i <= field.length(); i++) { if(isNumber(field.substring(i - 1, i))) { newField = newField + field.substring(i - 1, i); } ...
59992792-e27c-4de3-9cfc-81e2384e299d
0
public String getInputFormat() { return this.inputFormat; }
a5654290-d673-4526-abc4-df50ad63c09b
3
public static void generatePermutations(int[] p, int depth) { int n = p.length; if (depth == n) { System.out.println(Arrays.toString(p)); return; } for (int i = 0; i < n; i++) { if (p[i] == 0) { p[i] = depth; generatePer...
7ea33354-a216-485d-8120-15f67a921e3e
3
public void gameLoop() { long lastTime = System.nanoTime(); long cycleTime; final double amountOfTicks = 60.0; double ns = 1000000000 / amountOfTicks; // number of nanoseconds per ticks double delta = 0; int updates = 0; int frames = 0; long timer = Syste...
b243a839-df91-4558-be22-ce9d90a4463c
2
@Override public int getRow(Account o) { int row = 0; ArrayList<Account> accountList = accounts.getAccounts(accountTypes.getBusinessObjects()); for(Account account : accountList){ if(account != o){ row++; } else return row; } return 0; }
5dfdaaf2-cb92-4dfc-a246-16bd122a3874
2
public void changeIntel() { if(!dead) { if(mortal) { intel = smart; mortal = false; ghostPicIcon = Toolkit.getDefaultToolkit().getImage(IMAGE_SOURCE + ghostGraphic); } else { i...
d768024d-f867-4a70-b226-7b1b6ed685c3
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 ht...
5da7e7bd-c91d-4215-a4da-eb20b74a70f9
0
public void setShopPhone(String shopPhone) { this.shopPhone = shopPhone; }
c3616bfb-671f-4d9b-a93e-b7b6889e9dca
0
public void setPartA(PartA partA) { this.partA = partA; }
a7d60bd5-36b8-4377-900a-a47b8b57e6ec
1
private void goPrev(int list) { if (getIndex(list) >= 0) { currentIndexes.set(list, getIndex(list) - 1); } }
51a6811f-29db-4a46-9805-47f63016ddec
9
private void writeMessage() throws Exception { if (!this.writeQueue.isEmpty()) { CoreMessage message = writeQueue.poll(); this.writeBuffer.clear(); this.messageCodecHandler.encodeMessage(this.writeBuffer, message); if (message.getType() == CoreMessageType.KEEP_ALIVE_MESSAGE) { this.lastKeepAliveTime =...
98202a05-60ae-4e4b-a999-66788ebadbd6
4
public <T extends HexComponent> List<T> getAllComponentsOnObject(UUID object) { synchronized (componentStores) { LinkedList<T> components = new LinkedList<T>(); for (HashMap<UUID, ? extends HexComponent> store : componentStores .values()) { if (store == null) continue; T co...
10fd8847-5259-44c7-a60d-b5a4845d3e00
1
public boolean inScene() { boolean scene = true; if(getX() > 600) scene = false; return scene; }
462d409d-1606-4b51-ac53-9c8bf78b9a21
8
protected double[][] calculateAssociationMatrix() { if( this.associationMatrixSet) return this.getAssociationMatrix(); // Table initialization double[][] newMatrix = new double[2][2]; for(int i = 0; i < newMatrix.length; ++i) for(int j = 0; j < newMatrix[0].length; ++j) newMatrix[i][j] = 0; /...
221f9ffb-e189-46c7-83f3-437f45b2e702
2
public final void addHighMoney(Opponent opponent) { // is already inside? for (Opponent a : highMoney) { if (a.equals(opponent)) { return; } } highMoney.add(opponent); }
a5bccd99-bc04-4be4-b986-d901288707e1
1
public void testDefault() { assertNotNull(DateTimeZone.getDefault()); DateTimeZone.setDefault(PARIS); assertSame(PARIS, DateTimeZone.getDefault()); try { DateTimeZone.setDefault(null); fail(); } catch (IllegalArgumentException ex) {} ...
74629d3f-4bce-4c33-a06c-b1e3e2937772
2
public float[] getX(float[] result, float y) { double delta = b * b - 4 * a * c; if (delta < 0) { return null; } else { float x1 = (-b + (float) Math.sqrt(delta)) * 0.5f / a; float x2 = (-b - (float) Math.sqrt(delta)) * 0.5f / a; if (result == null) { result = new float[2]; } result[0] = x1;...
713d4c1a-af85-40ba-a1e1-7fdb55ddce48
4
public Path getImgPath_PWField(Imagetype type) { Path ret = null; switch (type) { case DEFAULT: ret = this.imgPWField_Def; break; case DISABLED: ret = this.imgPWField_Dis; break; case KEYFOCUS: ...
4f2bcef1-6e92-48ed-aa31-53d7c7b4d135
2
public void fixSubtree (String footpath, String subtreePrefix, pgrid.service.corba.repair.RepairIssue[] issues) { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("fixSubtree", true); $out.write_string (fo...
1be9f937-bf73-4c27-929b-d36ebe4135cd
8
private void updateGate() throws InvalidPinException { if (this.isHigh("CLR")) { for (int i = 0; i < this.width; i++) { String output = "Q" + i; this.setPin(output, Pin.PinState.LOW); } } else if (this.isRisingEdge("CLK") && this.isHigh("EN")) { boolean zero = true; for (int i = 0; i < this.wi...
576d792e-cf59-4df6-ba3b-fe7e4b6f7bcd
0
private void initComponents() { getStyleClass().add("footer"); this.setMinHeight(AppSettings.getIntegerValue("footer.min.height")); }
99a65bfa-f31f-49d3-80f6-6440e413e27e
7
protected Byte coerceToByte(Object value) { if (value == null || "".equals(value)) { return Byte.valueOf((byte)0); } if (value instanceof Byte) { return (Byte)value; } if (value instanceof Number) { return Byte.valueOf(((Number)value).byteValue()); } if (value instanceof String) { try { re...
49b70e7a-a417-4632-9adb-9a71d15a28b7
3
public void draw(Graphics g){ for(int y = 0; y < getSize().getY(); y++){ for(int x = 0; x < getSize().getX(); x++){ BufferedImage img = images[x][y]; if(img != null){ g.drawImage(img, x * 16, y * 16, null); } } } }
655ea58e-cb04-4059-a754-ee9d7dca05ab
1
public List<Courier> getCouriers() throws AftershipAPIException,IOException,ParseException,JSONException{ JSONObject response = this.request("GET","/couriers",null); JSONArray couriersJSON = response.getJSONObject("data").getJSONArray("couriers"); List<Courier> couriers = new ArrayList<Courie...
c90ba42a-7e17-4fdf-8cd8-eb95084ef4ab
7
private static SSLSocketFactory createJava14SSLSocketFactory(SSLTrustManager[] tm) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { /* * The code below does the following: * TrustManagerJava14Wrapper[] tmWrappers ...
596106f0-fa4c-4bc9-a8a9-18447dbcf207
0
public GraphViz() { }
6426732c-62d9-4fcf-a499-80f0b21d5b39
1
public void traceOnDetailed() { if (cycConnection != null) { cycConnection.traceOnDetailed(); } trace = CycConnection.API_TRACE_DETAILED; }