method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b1e7e3f7-733e-4628-a0f4-fb2e57833dbb
7
public String valueToString() { final boolean isArray = isArray(); StringBuffer result = new StringBuffer(); result.append(isArray ? "[" : "{"); try { for(Iterator i = iterator(); i.hasNext();) { try { ByteArrayData item = (ByteArrayData)i.next(); result.append(isArray ? item.valueToString() : ...
d75c60f3-fa4f-4f16-b071-411c13a43d6e
5
public void initialise() { prefs = Preferences.userNodeForPackage(this.getClass()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println("Unable to switch to native look and feel."); } try { filePath = new File(prefs.get(PREF_FILE_PAT...
32acaab7-56f8-44e6-afe5-76167e25cb8a
0
public Params getParams() { return params; }
f394f6fc-c888-4b05-8ed5-940c0694a03e
4
public List<String> changeChar(String string, int position, Character ch) { List<String> mismatches = new ArrayList<String>(); StringBuilder stringBuilder = new StringBuilder(string); switch (ch) { case 'T': stringBuilder.setCharAt(position, 'A'); mism...
683ca253-9c79-4b04-b8cd-9cab3ed20f6a
3
public synchronized void setDesonnected(boolean cr) { if(socket!=null && cr==true) { try { socket.close(); } catch (Exception e) { System.err.println("Error closing client : setDesonnected : "+e); } } desonnected=cr; //p...
63a5e849-c457-48f1-97d8-a74aa7c882ec
6
private String CreateAskQuery (StatementPattern triple) { String queryString ="ASK { " ; if (triple.getSubjectVar().hasValue()) { try { URI.create(triple.getSubjectVar().getValue().toString()) ; queryString+=" <"+triple.getSubjectVar().getValue()+">" ; } catch (IllegalArgumentException exp) ...
dba21671-6b5e-4c45-8ced-9a59b5b83333
7
public Object getValueAt(int row, int column) { switch(column) { case 0 : return rowHeadings[row]; case 1 : switch (row) { case 0 : return error.getClass().getSimpleName(); case 1 : return error.getSourceFile().getName(); ...
9bc4c0ac-529f-49fa-a02a-81272a97a293
6
private int getMaxNDEForest(Model mod, Color col){ int ndmax = 0; Posizione temp = null; for(int i=0;i<mod.getDamiera().getDim();i++) for(int j=0;j<mod.getDamiera().getDim();j++){ temp = new Posizione(i,j); if(!mod.getDamiera().isFreePos(temp) && !mod.getDamiera().getPezzo(temp).isNullAM()) if(...
c8f1231e-193c-46df-83c8-9b2c3cb51fa6
5
public Page(){ logger = Logger.getLogger(Page.class); logger.setLevel(Level.INFO); BasicConfigurator.configure(); if(driver==null){ // initialize the properties file CONFIG= new Properties(); OR = new Properties(); try{ // config FileInputStream fs = new FileInputStream(System.getProperty("u...
70c0014d-727c-4387-b871-3f2e93a2bc54
9
public static TreeMap<String, Integer> getShipPilots(ArrayList<Kill> kills, ArrayList<Integer> shipList, String name){ TreeMap<String, Integer> output = new TreeMap<String, Integer>(); // the output String charName; for (Kill k : kills) { charName = k.getVictim().getPilot().getCharacterName(); if(k.g...
56427940-022d-430b-98d6-e0714fb9df80
5
public synchronized static String leaveScoreboard(String ip) { String msg = "LEAVE_SCOREBOARD FAILURE"; boolean flag = false; NodeList nList = doc.getElementsByTagName("player"); for (int i = 0; i < nList.getLength(); i++) { Element myEl = (Element) nList.item(i); if (nList.item(i).getParentNode().getPar...
b237eec8-1ca6-4453-967c-7d795b6d116a
5
public Pallet getNextPalletToProduce() { String sql = "select Pallets.*"+ "from Pallets, Orders "+ "where Pallets.orderId = Orders.id and Pallets.creationDateAndTime is NULL "+ "ORDER BY requestedDeliveryDate ASC "+ "LIMIT 1 "; PreparedStatement ps = null; try { ps = conn.prepareStatement(sql); }...
d1db4343-177d-4d09-a24c-0f16d18c85ba
8
public static boolean canCastleLeft(GameBoard board, int color, int col, int row) { if (col - 3 < 0) // out of bounds return false; if (!allowedCastling(board, color, col, row, false)) return false; if (board.isEmpty(Position.get(col - 1, row)) && board.isEmpty(Position.get(col - 2, row)) && board.is...
8adf9189-6a08-4cf3-be37-3dac709dfcc8
2
private int coordToRegionOffset(int x, int z) { // "%" modulus is used to convert potential world coordinates to // definitely be local region coordinates x = x % 32; z = z % 32; // similarly, for local coordinates, we need to wrap negative values // around if (x < 0) x += 32; if (z < 0) z += 32; ...
694df9d9-a216-453f-956a-e3d92f05256a
1
private JTextField getJTextFieldPossibleLetters() { if (jTextFieldPossibleLetters == null) { jTextFieldPossibleLetters = new JTextField(); jTextFieldPossibleLetters.setText("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); } return jTextFieldPossibleLetters; }
aca49fe9-2670-4232-b4b0-e33d29ca34da
4
private static String convertToHex(byte[] data) { StringBuffer buffer = new StringBuffer(); for (int i = 0; i < data.length; i++) { int bytehalf = (data[i] >>> 4) & 0x0F; int two_halfs = 0; do { if ((0 <= bytehalf) && (bytehalf <= 9)) ...
c354c5cd-c9e7-4aff-811c-1ab727e0ed57
5
private int getNeedCallsForNextDepth(int[][][] newBoards) { int r = 0; for (int[][] board : newBoards) { if (board == null) { continue; } for (int[] row : board) { for (int val : row) { if (val == 0) { ...
a31c1b23-dac4-42b2-a912-89b5743b093b
6
public static String showFunctions(Map<String, List<TrigerState[]>> functions, List<String> ids){ String str = ""; for (Map.Entry<String, List<TrigerState[]>> entry : functions.entrySet()) { String id = entry.getKey(); List signal = entry.getValue(); str += i...
e87d481b-4f1f-462c-8ace-790e966155b9
9
public String translateLocation(int index){ if(index == 0){ return "0,0"; } else if(index == 1){ return "0,1"; } else if(index == 2){ return "0,2"; } else if(index == 3){ return "1,0"; } else if(index == 4){ return "1,1"; } else if(index == 5){ return "1,2"; } else if(index =...
279acbe8-7e52-4084-8b8d-29c55fb12b9c
2
public void removeAllResultsForDocument(Document doc) { for (int i = results.size() - 1; i >= 0; i--) { if (doc == getResult(i).getDocument()) { removeResult(i); } } fireTableDataChanged(); }
9ee3925f-c114-4192-97d6-cbacd8cb16e5
6
private int aphaBetaPruning(S s, int a, int b, int d) { visited++; if (d==0 || this.problem.end(s)) { return this.problem.value(s); } else { List<S> succ = problem.getSuccessors(s); for (S leaf : succ) { if (a > b) break; if (s.isMax()) a = Math.max(a, aphaBetaPruning(leaf, a, b, d-1)); ...
7886d210-fb42-4ba3-a5f5-4a9ff1b87f1c
1
public boolean opEquals(Operator o) { return (o instanceof CompareUnaryOperator) && o.getOperatorIndex() == getOperatorIndex(); }
e6603154-0be9-4834-89fc-b96f91c59bc3
0
public Encoder correspondingEncoder() { return this; }
b6653f29-4604-4a66-93f0-64fab4692fd9
9
private void EnableOther(CommandSender sender, String label, String[] args) { if (args.length < 4) { ShowHelp(sender, label, 1); return; } final PreRegistrationEvent event = new PreRegistrationEvent(args[2]); extraauth.getServer().getPluginManager().callEvent(event); if (event.isCancel...
cc61438d-6d38-47d6-a184-aa973e80cf63
9
@Override public void run() { while (true) { Random rand = new Random(); try { sleep(rand.nextInt(2000) + 1000); } catch (InterruptedException ex) { System.out.println("A error occured when the lemming was waiting before taking the next act...
dcfd7496-dca2-433a-b4d0-ca1261b0bcbf
0
public UserAction getUserAction() { return userAction; }
ddf31d1d-5ffb-489f-9ea0-6481ea099fa2
6
private static void writeRandomAccessFile(Path path){ SeekableByteChannel sbc=null; try { sbc = Files.newByteChannel(path, java.nio.file.StandardOpenOption.CREATE, java.nio.file.StandardOpenOption.WRITE); ByteBuffer byteBuffer =ByteBuffer.allocate(92...
e9249973-0af8-4e48-bcb3-7628ff6e0fd2
4
@Test public void testLoadCards() { int rooms = 0; int players = 0; int weapons = 0; //Make cards for testing Card mustardCard = new Card("Colonel Mustard", Card.cardType.PERSON); Card knifeCard = new Card ("Knife", Card.cardType.WEAPON); Card libraryCard = new Card("Library", Card.cardType.ROOM); for(...
93728c30-88a0-4af3-9d23-f278f9e6bede
8
public void actionPerformed(ActionEvent event) { JButton selection = (JButton) (event.getSource()); if (selection.getText().equals("Deal")) deal(); if (selection.getText().equals("Hit")) hit(); if (selection.getText().equals("Stand")) stand(); if (selection.getText().equals("Discard")) discard(); ...
37a073ce-3c5e-4d86-a3a1-ab8516c2dfe9
0
public void pressKey(int key) { jFenrir.keyPress(key); jFenrir.keyRelease(key); }
bae01e2e-ad9a-4f9a-a13b-54ad1f51e36e
0
public void windowOpened(WindowEvent we) { setVisible(false); dispose(); }
00a5bbe2-aa8f-4eac-a88d-e6741c3ab2d4
4
@Override public void update(Observable arg0, Object roomState) { status = (GameStatus)roomState; game = (Grid) arg0; if(status == GameStatus.SHOTMISSED) game.RevealRooms(); else if(status == GameStatus.SHOTHIT) game.RevealRooms(); else if(status == GameStatus.DIEDWUMPUS) game.RevealRooms(); ...
065b50dd-9e65-4fd5-8146-c6f12f6538fc
5
@Override public synchronized void finalize() { Map<String, RemoteControllerInterface> copy = new HashMap(connectedNotepads); for (Map.Entry<String, RemoteControllerInterface> entry : copy.entrySet()) { disconnectNotepad(entry.getKey(), null, null); try { entr...
8e92aa63-cc37-4242-8647-6a3e9c82a04b
1
private static ConcurrentHashMap<Long, UserNode> readUserMap( String directory) throws IOException, ClassNotFoundException { FileInputStream fin; try { fin = new FileInputStream(directory); } catch (FileNotFoundException e) { writeHashMap(directory, new ConcurrentHashMap<Long, UserNode>()); fin = new ...
76705ab9-a5dd-4063-be73-fb3e08269ec8
9
public TaskEntryPanel() { courseWidgets = new ArrayList<CourseWidget>(); taskWidgets = new ArrayList<TaskWidget>(); subTaskWidgets = new ArrayList<SubTaskWidget>(); // Initialize Components and Containers // Split Panes mainSplitPane = new JSplitPane(); nestedSplitPane = new JSpl...
577e3dfd-28ae-4603-b943-2e90a4d9dc60
2
public static CtClass getSuperclass(CtClass c) throws CompileError { try { CtClass sc = c.getSuperclass(); if (sc != null) return sc; } catch (NotFoundException e) {} throw new CompileError("cannot find the super class of " ...
b508786f-974f-4a93-96c8-4bd32606951e
3
public static void testGoogleSuggest() throws Exception { // The Firefox driver supports javascript WebDriver driver = new FirefoxDriver(); // Go to the Google Suggest home page driver.get("http://www.google.com/webhp?complete=1&hl=en"); // Enter the...
c213275a-6f99-4894-8e9a-c3fe1df96c8d
3
public static Action buildAction(Library library, int type) { // state manager StateManager stateManager = library.getStateManager(); // create a new entries to hold the annotation properties Hashtable<Name, Object> entries = new Hashtable<Name, Obje...
76922311-3bf9-4906-a24d-213f002b1a45
5
public void receive() { ActiveMQConnection connection = null; try { BrokerService broker = BrokerFactory.createBroker( "broker:(" + BROKER_URL + ")?" + BROKER_PROPS); broker.start(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(Receiver.BROKER_URL); ...
1cdd3bb2-77c0-434f-8400-26ee94f3f5f2
7
public void shutdown() { shutdownRequested = true; final long time = System.currentTimeMillis(); while((System.currentTimeMillis()-time<30000) && (!isShutdown)) { CMLib.s_sleep(1000); if(servSelector != null) { try { servSelector.close(); } catch(final Exception e) { } ...
6b89f092-7156-4711-b9b2-6c8f386a6f18
5
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AbstractFlowerPackaging)) { return false; } AbstractFlowerPackaging other = (AbstractFlowerPackaging) o; if (id != other.id) { return f...
f214c1e9-c86f-452d-886e-3b32848e278c
6
public static void select(String table, Date from, Date to, Selection sec) { cache.init(); List<String> partitionList = new ArrayList<>(); boolean firstAdd = true, lastAdded = false; for (int i = 0; i < TABLE_PARTCOUNT.get(table); i++) { TablePart key = new TablePart(table, i); Date lessThan = cache.get(k...
132b0469-35f1-4e50-b954-fce7e0b9363c
2
public void addLast(E element) { LinkedElement<E> elem = new LinkedElement<E>(element); elem.setPrev(last); elem.setNext(null); if (total == 0) { first = elem; } if (total > 0) { last.setNext(elem); } last = elem; total++; }
54abd1f7-e246-49fb-ae90-f72d3313d5b4
5
@Override public Class<?> getColumnClass(int columnIndex) { switch (columnIndex) { case 0: return String.class; case 1: return String.class; case 2: return String.class; case 3: return String.cla...
fba1fa61-62ce-4db8-b25e-b8936678e01a
6
public void method354(IndexedSprite indexedSprite, int y, int x) { x += offsetX; y += offsetY; int destOff = x + y * Graphics2D.width; int srcOff = 0; int height = this.height; int width = this.width; int destStep = Graphics2D.width - width; int srcStep = 0; if (y < Graphics2D.topY) { int topMargin...
cfbeb18e-ae28-4291-819e-9632568ba0c4
2
public void setupTextField(){ textField = new JTextField(20); textField.setPreferredSize(new Dimension(8,30)); textField.setBackground(new Color(31, 30, 27)); textField.setForeground(Color.WHITE); textField.setBorder(null); //textField.setBorder(MetalBorders.getTextFieldBorder()); textField.setBorder(B...
9b75f068-ee57-4422-ab2b-566110ae9258
5
void runProcess(final String flag) { if (console.isInstalling()) { sout.println(INSTALLING); return; } if ((script.getText() == null) || (script.getText().isEmpty())) { return; } save(); new Thread() { @Override ...
7f9d4ae1-33d9-40db-8018-7fb2c5aee975
4
public Combo_Box_View_Specific_Account() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { //MAIN FRAME super("Team J's Scheduler | View Specific Account"); setBounds(50,50,500,300); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLa...
3391321a-0fb6-467d-aa5f-16cf1724b797
0
public Role getRole() { return role; }
2f250975-7d76-46e7-8638-000bbe34ce6c
5
@Test public void fetchesInputs() { settings.fetchSetting("PLR1RIGHT 41"); settings.fetchSetting("PLR1UP 88"); settings.fetchSetting("PAUSE 16"); assertTrue(settings.getControl(41) == Input.PLR1RIGHT && settings.getControl(88) == Input.PLR1UP && se...
617a446a-973c-4742-977f-29ae85670514
5
public int getTypeInt() { short grbit = 0; if( fValue ) { grbit = ByteTools.updateGrBit( grbit, true, 0 ); } if( fPercent ) { grbit = ByteTools.updateGrBit( grbit, true, 1 ); } if( fCatName ) { grbit = ByteTools.updateGrBit( grbit, true, 4 ); } if( fBubSizes ) { grbit = ByteTools.up...
ea5a0c5c-5309-4f70-bdfb-280c2fe49def
3
private void btnEliminarEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarEmpleadoActionPerformed // TODO add your handling code here: /*Obtenemos el empleado seleccionado de la tabla:*/ int idEmpleadoQueSeEliminara = obtenerIdEmpleadoAEliminar(); //c...
7646e906-1a23-4fa4-87ed-83a3360b22f5
2
static Method lookup(String method) { for (Method m : Method.values()) { if (m.toString().equalsIgnoreCase(method)) { return m; } } return null; }
3d6b0b90-45b4-4790-af58-93da3273d79a
9
private void bumpPosition() { // Bump the current X position ++xCur; // If we are at the end of a scan line, set xCur back to the beginning // If we are interlaced, bump the yCur to the appropriate spot, // otherwise, just increment it. if (xCur == imgW) ...
343884dd-7f07-451d-8c4d-a77582f1900c
2
public void exit() { for (SlaveVM vm : vmsInUse) vm.hardExit(); for (SlaveVM vm : vmsAvailable) vm.hardExit(); vmsInUse.clear(); vmsAvailable.clear(); System.out.println(this.allVms.values()); }
f92a6cbb-cbf3-4e56-9578-1aa5847ba07a
8
public void getIMDBData(ExecutorService executor, final Gui gui) { Runnable imdbData = new Runnable() { @Override public void run() { for (int i = 0; i < NUMBER_OF_TRIES; i++) { try { InputStream input = new URL("http://www.omdb...
c0463ca0-abcc-49af-9a88-0c1bf5beaf05
9
public boolean doTakeCard(int k) { // System.out.println("DOING TAKE CARD ..."); Card card = cardRow.get(k); // === preparation for take-card ===拿牌前的準備 //(1)enough point to take card點數要夠 int cardPoint = CARD_POINT[k]; if (get當前玩家內政點數() < cardPoint) { System....
3249ebcf-1c73-479d-a179-68e535320834
4
public void tableDoubleClick (String select) { if ("Customer".equals(select)) { Integer integer = (Integer)_view.table_customer.getValueAt( _view.table_customer.getSelectedRow(), 0); new Thread (new CEController(integer,"Customer")).start(); } else...
c1977f74-8c10-4b05-85c4-9ef68ff759b4
3
public void bench_refreshes() { refreshed.clear(); refreshing_error.clear(); long start = System.currentTimeMillis(); for( KeyPair p : generatedKeys ) { threadPool.submit(new PeerRequest(p)); } while( refreshed.size() < generatedKeys.size() ) { System.out.println("done refreshing: " + refreshed....
40f2a3b8-d4b9-4321-bd89-cb855626d7da
2
private void getPrefs() { refreshDevices_settingsButton.setSelected(settings.refreshDevices()); refreshInterval_settingsTextField.setText(String.valueOf((settings.getDeviceRefreshInterval() / 1000))); checkForUpdates_settingsButton.setSelected(settings.checkForUpdatesOnStartup()); autoUp...
7a767988-4ee7-4006-890e-1b197d8d8f7a
2
public String helper(String str, int n) { StringBuilder strBuilder = new StringBuilder(); if (str == null) { return null; } for (int i = 0; i < n; i++) { strBuilder.append(str); } return strBuilder.toString(); }
0b8bd1b8-3716-4a07-9c72-1c6627714eb5
5
private String introduceUser(String input) { String userInfoText = ""; if(numberOfChats == 0) { myUser.setName(input); userInfoText = "Hello " + myUser.getName() + " what is your age?"; } else if(numberOfChats == 2) { int age = Integer.parseInt(input); myUser.setAge(age); userInfoText = m...
c46067e4-3ba6-43c6-a59f-78624dc2de3d
1
public String getSkin(){ if (prop.getProperty("skin").contains("system")) return UIManager.getSystemLookAndFeelClassName(); else return prop.getProperty("skin"); }
389a641d-14c5-41ce-be63-405fb1578568
8
private void listen() { try { Socket client_socket = m_incoming_conn.accept(); //client_socket.setKeepAlive(true); System.out.println("Received connection request"); ObjectInputStream is = new ObjectInputStream( client_socket.getInputStream()); System.out.println("Rea...
6c78e9a7-f4b4-425d-b824-a8438d1d8a71
5
private boolean hole() { return (((row == 7) && (col == 5)) || ((row == 10) && (col == 4)) || ((row == 10) && (col == 6))); }
b6c630f4-7ff0-42bc-a7c6-1d99fd340b84
2
private void setSelectedProductComboboxItem(String productName) { for (String str : comboBoxItems) { if (str.equals(productName)) productComboBox.setSelectedItem(str); } }
4e839515-8b78-4d70-b10c-6c611a59992d
0
public ImageCellRenderer() { super(); }
7036f5b5-5728-4bef-adbc-214687d353a1
4
private boolean releaseFromMap( HTTPHeaderLine element ) { if( element == null ) return false; Set<HTTPHeaderLine> set = this.map.get( element.getKey() ); if( set == null ) { // Container not found return false; } boolean removed = set.remove( element ); if( !removed ) { // Not found in co...
918778bb-4e7d-4002-993a-87f5a085b1cd
8
private void pickRandomDirection() { int rand = Game.random.nextInt(8); switch(rand) { case 0: d = Direction.NORTH; break; case 1: d = Direction.SOUTH; break; case 2: d = Direction.EAST; break; case 3: d = Direction.WEST; break; case 4: d = Direction.NORTHEAST; break; ca...
246fa1f9-5237-4f88-abb4-1aeff2325e0b
5
public static int silog2Wide(long v) { while (true) { if (v == 0) return 0; if (v > 0) { int l = 0; while (v != 0) { l++; v >>= 1; } return l + 1; } if (v == -1...
7a19a725-d37d-460f-bc9f-e2c9241a751b
0
public BruteParseAction(GrammarEnvironment environment) { super("Brute Force Parse", null); this.environment = environment; this.frame = Universe.frameForEnvironment(environment); }
96ecf1a1-1835-42bf-b5f2-2dc8fea96a6b
8
@EventHandler public void onAttackEvent(EntityDamageByEntityEvent e){ Entity attackerE = e.getDamager(); Entity defenderE= e.getEntity(); if (!(attackerE instanceof Player) || !(defenderE instanceof Player)) return; Player attacker = (Player) attackerE; Player defender = (Player) defenderE; UUID atkID = a...
0357d895-a3e7-46a6-8a0f-d0bdf319de8b
1
public void keyPressed(KeyEvent e) { if(e.getKeyCode() == 10){ displayInfo(); } }
47f85337-15c7-4547-a84d-1ac4e1981706
9
public boolean checkSink() { int i = 0; int j = 0; while (j < vertexCount) { if (getValue(i, j) == 0) { j++; } else if (i == j) { i++; j++; } else { i = j; } } if (i >= vertexCount) { return false; } else { // 所有纵向为1, 除了汇点 for (int k = 0; k < vertexCount && k != i; k++) ...
45295769-a4bc-455c-8d35-b34c2c1cc578
4
private static void testCaddie (HttpSession session, ServletOutputStream out, Connection conn) throws IOException, BDException { if (session.getAttribute("config") == null) { char d = BDRequetes.getTypeCaddie(conn); if (d == 'P'){ BDRequetes.checkCaddieLifetime(conn); session.setAttribute("con...
17c929a0-8a53-46d6-9347-c5581debf1a4
6
private void updateTermination() { if(prot.intersects(goal)) { victorious = true; } if(isVictorious()) { finished = true; } else { for(Ball ball:balls) { if(prot.intersects(ball)) { finished = true; ...
c0a7b7bc-d9f7-4597-aa4c-9b27fc99cc1e
4
private void move() { int x = Mouse.getDX(); int y = Mouse.getDY(); int w = Mouse.getDWheel(); if (Mouse.isButtonDown(0)) { SimpleVector line = new SimpleVector(x, 0, y); Matrix m = line.normalize().getRotationMatrix(); plane.rotateAxis(m.getXAxis(), line.length() / 200f); } if (w != 0) { floa...
d6d4f5af-b39e-46a6-8fe5-5927b86596f2
3
@Override public void render() { double[] pos; float[] color; double size; GL11.glBegin(GL11.GL_QUADS); for(int i = 0; i < MAX_PARTICLES; i++) { color = getCRule(cID_[i]).getColor(r_[i], g_[i], b_[i], a_[i], age_[i], props_[i]); size = getSRule(sID_[i]).getSize(size_[i], age_[i], props_[i]); pos ...
2df0c30c-8d81-4485-99f1-71ef78e543ca
9
public String toString() { String opts = ""; opts += writeable ? "write" : "read-only"; opts += ","; opts += verbose ? "verbose" : "quiet"; String dbg = ""; if (debugFile) dbg += dbg.isEmpty() ? "File" : ",File"; if (debugCommand) dbg += dbg.isEmpty() ? "Command" : ",Command"; if (debugTime) dbg += d...
8d2dc3e0-1f29-47d2-b586-67a2ab3acca6
5
public buildings.Base CreateCity(int owner, int xx, int yy, int type) {//15 = Neutral, 12, 13, 14 are unused. (12 max players) //TODO: Warning: I removed the check to make sure each building is legal. System.out.println("List level owner: " + owner); switch (type) { case 0:return new buildings.Capital(owner, x...
690863df-45ff-4b4a-a786-d6d4b30896cf
8
public void SetAllAdvanced(GameEngine gm, String name, String text, int posX, int posY, String fontName, int fontSize, boolean customFont, int red, int green, int blue, int alpha) { //Setting the game engine game = gm; //Setting the text object variables stringName = name; stringText = text; int...
4953c097-2653-493d-a018-107cef7b0b0f
4
public int maxProfit(int[] prices) { //算法题一定要考虑验证入参 if(prices==null || prices.length<=1){ return 0; } int size=prices.length; //初始化一个辅助数组 aux[i] 代表 f(i) int[] aux=new int[size]; if(prices[size-2]<prices[size-1]){ aux[size-2]=prices[size-1]-...
566c5560-1828-45e6-a2ac-9da254928c24
8
public void verarbeiteEingabe(String benutzerName, String eingabe) { System.err.println(benutzerName + ": " + eingabe); Spieler spieler = _logik.getKontext().getSpielerByName(benutzerName); Befehlszeile befehlszeile = new Befehlszeile(eingabe); if(eingabe.equals(TextVerwalter.BEFEHL_BEENDEN)) { BefehlF...
225dd1e8-3b89-4f41-bcd3-075c290ba917
9
private static void collectUserData(String userPath, String split_Sign) throws IOException { File file = new File(userPath); BufferedReader buffRead = new BufferedReader(new InputStreamReader(new FileInputStream(file))); boolean flag = true; int tmp = 0, count = 0; int[] userIndex = new int[DataInfo....
35eea777-f698-4901-a317-722cf008e3f8
9
public Map<OptionSpec<?>, List<?>> asMap() { Map<OptionSpec<?>, List<?>> map = new HashMap<OptionSpec<?>, List<?>>(); for ( AbstractOptionSpec<?> spec : recognizedSpecs.values() ) if ( !spec.representsNonOptions() ) map.put( spec, valuesOf( spec ) ); return unmodifiab...
0917fdc0-474d-4006-a242-bb728cc0c9e3
6
public int minPathSum(int[][] grid) { int[] row = new int[grid[0].length]; for(int i=0; i<grid.length; i++){ for(int j=0; j<grid[0].length; j++){ if(i==0 && j==0) row[j] = grid[0][0]; else if(j==0) row[j] = row[j] + grid[i][0]; else if(i==0) ro...
9eb1949b-7998-4395-9479-d258d4d5077d
5
public static Collection<X509Certificate> getCAX509Certificates(String directoryPath) throws IllegalArgumentException, CertificateException, IOException{ Collection<X509Certificate> certificates=new LinkedList<X509Certificate>(); File certDirectory = new File(directoryPath); File[] files = ce...
a7f3eee9-85cc-4ea5-8507-3cf49b02f8b1
5
private void exportICalCalendar(ActionEvent e) { JFileChooser saveFileChooser = new JFileChooser(); saveFileChooser.setFileFilter(new FileNameExtensionFilter(m_appSettings.getLocalizedMessage("icalfile"), "ical", "ics", "ifb")); saveFileChooser.setFileHidingEnabled(true); saveFileChooser.setFileSelectionMode(JF...
cb923028-b54e-480b-a954-de62096c64ad
6
public EntityManagerFactory getWithoutConfig() { Map<String, String> map = new HashMap<String, String>(); map.put("openjpa.ConnectionURL", "jdbc:postgresql://java.is.uni-due.de/ws1011"); map.put("openjpa.ConnectionDriverName", "org.postgresql.Driver"); map.put("openjpa.ConnectionUserName", "ws1011"); map....
199fb09b-bd6c-4505-99b2-e112fb1e16fd
4
protected void updateDisplay() { if(code == Constants.JOIN || code == Constants.UPDATE_SHIP); SpaceCraft ship = new SpaceCraft(id,x,y,heading); spaceGameServer.sector.updateOrAddSpaceCraft(id,x,y,heading); ArrayList<SpaceCraft> destroyed = spaceGameServer.sector.collisionCheck(ship); if(destro...
0dd5b248-3810-4afd-a4df-481d62c4d6a9
5
public void savefile(List<CADShape> data, boolean SaveAs) { if ((MainView.Saved == false) || (SaveAs==true)) { JFileChooser SAVE = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter(".cad files", "cad"); SAVE.setFileFilter(filter); SA...
fbd5bf5f-39e5-41c8-a0de-8b5903821d26
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tuple2 tuple2 = (Tuple2) o; if (_0 != null ? !_0.equals(tuple2._0) : tuple2._0 != null) return false; if (_1 != null ? !_1.equals(tuple2._1) : ...
38141a9b-e603-40ae-9116-4b60a78f837f
3
public void skipToGranulePosition(int sid, long granulePosition) throws IOException { OggPacket p = null; while( (p = getNextPacket()) != null ) { if(p.getSid() == sid && p.getGranulePosition() >= granulePosition) { nextPacket = p; break; } ...
a1718eb3-2ec6-4151-8bd4-d45a8c04adb6
4
private boolean isRoyalFlush(){ List<Card> rylSet=new ArrayList<Card>(); if(isFlush()){ System.out.println("come to royal flush check###########"); for (Card card : crds) { if(card.getSuitID()==cmnSID){ rylSet.add(card); if(card.getRankID()==14){ System.out.println("Royal Flush matched****...
45157b35-f59c-41d4-8f16-b485c56d9c47
4
private byte[] readBytes(int bytesToWrite) { int samplesToWrite = bytesToWrite / 2; float[] buffer = new float[NUM_SAMPLES]; byte[] answer = new byte[2 * NUM_SAMPLES]; synchronized(this) { Iterator<SoundPlay> iterator = this.buffers.iterator(); while(iterator.hasNext()) { if(iterator.next().writeSam...
8d4b03a8-3f3d-4b49-95d5-aded22b91260
5
public void update_key() { if(isReadOnly()) return; if(Idx!=null) { PREPARE_KEY_FROM_DATA( Idx ); if(cSKey==null || (!cSKey.equals(Idx.searchKey))) Idx.replace_key(); // this is a hack too much } if(cdx_file) { // TODO: // update all key values for this record for all tags } }
6c61719f-5ce9-484c-9c02-b2a8b54f1b88
3
protected GeneralPath renderCompoundGlyph (GlyfTable glyf, GlyfCompound g) { GeneralPath gp = new GeneralPath (); for (int i = 0; i < g.getNumComponents (); i++) { // find and render the component glyf Glyf gl = glyf.getGlyph (g.getGlyphIndex (i)); GeneralPath path =...
1ba97819-beaf-478f-96d2-06ba98cabc5f
8
final public void ThrowStatement() throws ParseException { /*@bgen(jjtree) ThrowStatement */ BSHThrowStatement jjtn000 = new BSHThrowStatement(JJTTHROWSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtreeOpenNodeScope(jjtn000); try { jj_consume_token(THROW); Expression(); ...
1f1bda82-8948-44aa-84cb-74be994c1297
7
public static boolean interpret(CommandSender sender, Command cmd, String commandLabel, String[] args){ //if no args : /bg team if(args.length < 2){ HelpTeam.sendHelpTeam(sender); return true; } else if(args[1].equalsIgnoreCase(BattlegroundsCommands.Team.List)){ ListTeams.listAllTeams(sender); re...
37006518-7d07-4a42-a921-ca0e12134f92
1
public int getTotalOccurrencesAmount() { int total = 0; for (RendezVous rv : meetings.values()) { total += rv.getPlaces().size(); } return total; }