method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8dfa5aff-90c7-47c4-96e2-c2ec6365488c
2
private static String key2Word(String key) { for (int i = 0; i < basicWordPairs.length; i++) { if (key.equalsIgnoreCase(basicWordPairs[i].key)) return basicWordPairs[i].word; } return ""; }
7c76391c-9e23-4bef-bebb-b323b557799c
5
private void checkArgs( Object args ) { try { if( args != null && args instanceof Map ) { Map argsMap = ( Map )args; if( argsMap.containsKey( "port" ) ) { port = MStringUtil.parseInt( argsMap.get( "port" ), getDefaultPort() ); debug( "port:" + port ); } if( argsMap.containsKey( "httpHeader" )...
3ac17895-a7ef-4aa6-a180-1479ac508419
5
final void method937(boolean bool, float f, float f_0_, float f_1_, float f_2_, float[] fs) { anInt5765++; float f_3_; float f_4_; float f_5_; if (f > 0.00390625F || f < -0.00390625F) { float f_6_ = -f_2_ / f; f_4_ = (f_6_ * ((Class101_Sub3) this).aFloat5770 + ((Class101_Sub3) this).aFloat5747)...
c13d5760-6782-419e-8320-d53c7fadf8b3
3
private void openAreaTile(int aTile) { final byte openId = mField.getMasks().getOpen().getId(); final int x = Tile.getX(aTile), y = Tile.getY(aTile); mField.setMask(x, y, openId); TileValue tileValue; TileSet border = mField.getBorderOf(x, y); for (int tile : border) { tileValue = mField.getTileValue(...
4636d6d4-2caa-4428-83c8-b33bf97941af
9
private void bumpPosition() { ++xCur; if (xCur == imgW) { xCur = 0; if (!wantInterlaced) ++yCur; else switch (curPass) { case 0: yCur += 8; if (yCur >= imgH) { ++curPass; yCur = 4; } break; case 1: yCur += 8; if (yCur >= imgH) { ++c...
5cf41bc0-05f6-47a2-adde-6d0d409b8f90
8
private void tuPatchSame(final Character[] orig, final Character[] dest) { final TreeMap<Character,Character> origMap = new TreeMap<Character,Character>(); final TreeMap<Character,Character> destMap = new TreeMap<Character,Character>(); for (int i = 0; i < orig.length || i < dest.length; ...
d3b07e1b-31d0-4acb-a005-f74dfe55fd1d
1
@Test public void testAddToEnd() throws Exception { List<String> list = new List<>(); list.addToEnd("test1", 1); list.addToEnd("test2", 3); list.addToEnd("test3", 5); for (String current : list) { assertTrue(list.exist(current)); } }
a2e2e7ee-eb5f-4922-bf80-cf202f593705
3
public static void MaxHeapInsert(List<Integer> array, int element){ array.add(element); int x = array.size(); int pIndex = (int)Math.floor(x/2); while(array.get(x-1) > array.get(pIndex-1) && pIndex>=1){ array.set(x-1, array.get(x-1) + array.get(pIndex-1)); array.set(pIndex-1, array.get(x-1) - array.get...
f16415d5-f1cf-4547-bdd5-4490fa3d2cd3
1
private void initDatabase(Location location) { boolean load_database = DatabaseManager.load_database(location.getPath()); if (!load_database) Prefs.getInstance().clear(); FileWalker.getInstance().removeUnexistingEntries(); FileWalker.getInstance().getFiles(location.getPath()); ListManager.se...
ea04d6a5-1355-4d8a-aa64-38dfde671bde
3
public void paintMessage(Graphics2D g, Message message) { switch (message.getType()) { case ERROR: g.setColor(ERROR_MESSAGE_BACKGROUND_COLOR); break; case INFO: g.setColor(INFO_MESSAGE_BACKGROUND_COLOR); break; default: g.setColor(NORMAL_MESSAGE_BACKGROUND_COLOR); } StringTokenizer tok = new...
7b654c4b-0128-4ea9-8df2-d9f233747ce8
3
@Override public UsuarioBean get(UsuarioBean oUsuarioBean) throws Exception { if (oUsuarioBean.getId() > 0) { try { oMysql.conexion(enumTipoConexion); if (!oMysql.existsOne("usuario", oUsuarioBean.getId())) { oUsuarioBean.setId(0); ...
a4effc4f-9d3e-4aef-ac49-c44d182be2a7
8
public String toString() { if (this.mType == MoveType.MOVE_WW.getInternalValue()) { return "WW"; } // End if if (this.mType == MoveType.MOVE_RW.getInternalValue()) { return "RW"; } // End if if (this.mType == MoveType.MOVE_DRAW.getInternalValue()) { return "DRAW"; } // End if if (this.mType == Mo...
4e05596e-7d2b-4f0b-8c0c-d733634f25cb
0
public Hashtable<K, String> getSymbols() { return symbols; }
8abcd539-6920-4c92-b511-697234bb5aca
7
public Result dfs() { long startTime = System.currentTimeMillis(); Deque<Node> stack = new ArrayDeque<Node>(); Set<Node> set = new HashSet<Node>(); int nodesProcessed = 0; stack.addFirst(initial); while(!stack.isEmpty()) { Node temp = stack.removeFirst(); nodesProcessed++; if(temp.getState...
a7054408-5b42-4cf2-a5a9-1d0e6ab379a1
9
public List getWhatsNew() throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs = null; String sql = ""; List newList =null; DataBean bean = null; int k=0; try{ conn = getConnection(); sql="select ROWNUM, b.* from (select * from (select * from board union all selec...
d13fe34e-21a2-4c95-bfd3-54a98a8056eb
9
public void draw(Graphics2D g) { g.setColor(Color.WHITE); if(SimCityGui.GRADINGVIEW) { g.drawString("C"+mNum,xPos+10,yPos-10); } else { g.drawImage(image,xPos,yPos,null); } switch(state) { case ordering: { g.drawString(food+"?", xPos-2, yPos-5); break; } case eating: { ...
0e9aaa9e-ab06-4e28-80be-3ff92914a722
2
public void readIdentifier() { int start = column - 1; while (column < line.length() && Character.isUnicodeIdentifierPart(line.charAt(column))) column++; value = line.substring(start, column); }
24a9f185-b631-4f45-be56-eb5ed94c3cc7
1
@Override public void processBatch(List<SampleEvent> sampleEvents) throws RemoteException { StringBuilder b = new StringBuilder(); for (SampleEvent se : sampleEvents) { JSONObject sample = Utils.getJSONObject(se); SamplesUploader.addSample(sample); } }
436a6d8e-92fb-48d1-af43-d9b4aa13d6b6
6
public Dimension preferredLayoutSize(Container parent) { //System.err.println("preferredLayoutSize"); synchronized (parent.getTreeLock()) { Insets insets = parent.getInsets(); int ncomponents = parent.getComponentCount(); int nrows = getRows(); int ncols = getColumns(); if (nrows > ...
b17fd60f-759b-4d66-85cf-1ac41864fe97
7
public EvaluationResult evaluate(List inputs, EvaluationCtx context) { // Evaluate the arguments AttributeValue [] argValues = new AttributeValue[inputs.size()]; EvaluationResult evalResult = evalArgs(inputs, context, argValues); if (evalResult != null) return evalResult; ...
f5982bf3-676b-4b02-aef5-422ac3a75cdf
8
public void run () { System.out.println("Keep Alive active!"); while (true) { for (Map.Entry<Socket, ClientHandler> client : activeSockets.entrySet()) { Socket socket = client.getKey(); try { PrintWriter out = new PrintWriter(socket.getOutp...
2dc09011-33e6-4034-bffd-3416fc1469e2
9
private void popup(MouseEvent e) { if (!popupMenuEnabled) return; int x = e.getX(); int y = e.getY(); if (e.isShiftDown()) { GayBerneParticle p = whichParticle(x, y); if (p != null) { if (selectedComponent != null && selectedComponent != p) selectedComponent.setSelected(false); p.setSelect...
11192014-3a5e-47eb-ad15-db9530497163
4
private boolean hitBonus() { if(xpos >= bonusButton.getX() && xpos <= bonusButton.getX()+BonusButton.getWidth()){ if(ypos >= bonusButton.getY() && ypos <= bonusButton.getY()+BonusButton.getHeight()){ return true; } } return false; }
01d192c1-2dd7-412f-92cb-1e11aeb9cf00
0
public CreativeMaterial findCreativeMaterialById(final Long id) { return new CreativeMaterial(); }
697e4581-d95f-4fa7-bd7f-2ad3c1de50a3
0
public Mark(int marker, int state) { this.state = state; this.marker = marker; }
9273a564-905b-48b3-848c-79314e7a90e8
1
public void shutdownServer() { try { shutdown = true; serverS.close(); } catch (IOException e) { e.printStackTrace(); } }
5145ee2c-8baa-4633-8743-3a9a2d0fccb6
0
public void setFunEndeudamiento(Integer funEndeudamiento) { this.funEndeudamiento = funEndeudamiento; }
36fd349b-38ca-46f5-bfea-39421c09911e
4
private void rotateRight(Node<K, V> root) { Node<K, V> pivot = root.left; Node<K, V> right = root.right; Node<K, V> pivotLeft = pivot.left; Node<K, V> pivotRight = pivot.right; // move the pivot's right child to the root's left root.left = pivotRight; if (pivotRight != null) { pivotRi...
8cc59e1d-44c4-4ac7-bbd2-900d8d0b63cd
2
private void readChunkDec(StructureFile structure, Element element) throws SyntaxException { if (DOMHelper.isNodeOfType(element, "Structure", strict)) { readStructureDec(structure, element); } else if (DOMHelper.isNodeOfType(element, "StructurePart", strict)) { readPartDec(structure, element); } else thr...
7a51e0a9-33d2-48b7-90a5-82c9c0a946c3
0
public Director(Builder builder) { this.builder = builder; }
db961100-df03-4d4f-b1bd-6f9ac12c788d
4
public DrawableItem getItemAt(Point p) { DrawableItem item = null; for (DrawableItem i : items) { if (i instanceof Panel) { // int[] ind = {0}; Point anchor = ((Panel) i).getKnobContainingPoint(p); if (dic.contains(i, p) || anchor != null) { ...
dc9ecb5f-acad-4a17-8a68-3e4c0304c663
0
public void mousePressed(MouseEvent event) { adapter.mousePressed(event); }
b395d296-0e7e-4d5b-a8be-4db77c8007d6
2
public boolean equals(Object o) { if (o instanceof Vector) { Vector v = (Vector)o; return v.x == x && v.y == y; } return false; }
d2d0ae06-1e47-4f94-bc1d-96beffb897ac
1
private void addFeature(int count, Feat.Shape shape, Pair points, Pair scale, int value, boolean face){ if(result.size() == count){ countMyFeat++; Feat f = new Feat(shape, points, scale); f.valuesFaces.add(new ValueFace(value, face)); result.add(f); }else { result.get(count).valuesFaces.a...
ec518f23-e50f-404c-b792-5ba012efd77b
0
public void setCursor(Cursor cursor) { comp.setCursor(cursor); }
824aba17-abaa-4a20-a3df-183800053421
8
private void loadNagiosDataLiveStatus_services(String host, int port, String prettyName) throws Exception { Socket socket = connectToSocket(host, port); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(socket.get...
310ccdd1-20e4-4dbf-b9e0-2cef75de81fb
4
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String eventType = request.getParameter("event"); if (eventType != null) { try { ReimburseReward r = new EventDAO().getFullRewards(eventType); if (r != null) { if (!r.isEmpty()) {...
7761a785-671b-40ba-9e68-14a70e3d37bd
2
public void setPoint(String jugador){ set.setPunto(jugador); if(jugador == "player1"){ racquet1.x = 0; racquet1.y = 0; ball.x = racquet1.WIDTH; ball.y = 0; ball.xa = getSpeedx(); ball.ya = getSpeedx(); }else if(jugador == "p...
1cbb44cb-28f1-463d-a8dc-73438aeefee3
5
public Answer giveAnswer(Combination<Colors> attempt) { AnswerCombination answerCombination; boolean additionalAttemptPossible; boolean targetFound; if (this.board.additionalAttemptPossible) { if (!this.targetFound) { //1. Generate the answer combination. answerCombinat...
8c41cf97-9ce0-499c-ad31-b87f8eeb731a
2
public void run() { for (int i = 0; i < 5; i++) { try { System.out.println(queue.take()); } catch (Exception e) { } } }
ffc14365-34ac-42ce-83a9-3c5cc761e010
3
public void mouseDragged(MouseEvent e) { if (documentViewController != null ){ int userToolModeFlag = documentViewController .getDocumentViewModel().getViewToolMode(); if (userToolModeFlag == DocumentViewModel.DISPLAY_TOOL_ZOOM_IN || userT...
67aa3b25-b30d-4750-adfc-52602e6d7407
8
public List<Node> compute(Node start, Node end) { List<Node> openset = new ArrayList<Node>(); openset.add(start); start.g = 0.0; start.h = h(start, end); start.f = start.g + start.h; List<Node> closedset = new ArrayList<Node>(); while (!openset.isEmpty()) { ...
5da65c18-4bdc-4adf-b944-bc554287bc1c
1
protected static String removeNewLine(String text) { do { text = text.replaceAll("\n", ""); } while (text.contains("\n")); return text; }
2f2cef4b-c835-4c0b-a163-cb0e77dbb527
6
public static void main(String[] args) { if (args.length ==0 ){ System.out.println(Installation.softwareName+" version "+version); System.out.println("__________________________________"); System.out.println("Installation instructions:"); System.out.println("1 - Move the file ("+Installation.filenameJar...
67339578-91a9-4a60-a0dc-1f10ac7fc999
0
@After public void tearDown() throws Exception { product = null; }
1a637e04-21a9-48e1-9aa0-d70e6d58f277
9
public void addBooks(Set<StockBook> bookSet) throws BookStoreException { if (bookSet == null) { throw new BookStoreException(BookStoreConstants.NULL_INPUT); } // Check if all are there for (StockBook book : bookSet) { int ISBN = book.getISBN(); String bookTitle = book.getTitle(); String bookAut...
fe9e9d4a-ea47-4cd2-a445-5d43619d8746
9
protected void performMoveCallback(){ //we got our move from the swingworker. //Let's post our move to the UI if (parent == null){ return; } if (!parent.isVisible()){ return; } if (parent.gamestate.gameFinished){ return; //game is over } AIBundle bundle = null; try { bundle = workerT...
fc25dc8e-426a-47de-b00a-c095ac956970
2
@Override public void draw(Graphics2D g){ bg.draw(g); g.setFont(font); g.setColor(color); g.drawString("The Brim of Life", GamePanel.WIDTH/2 - 110, GamePanel.HEIGHT/2 - 50); // Draw menu square Rectangle rect = new Rectangle((GamePanel.WIDTH / 2) - 20, 127 + (currentChoice * 15), 35, 15); g.setColor(cl...
b8d61b38-69ae-43aa-bed8-39c0875b746a
4
private static void doAddVersion() throws MVDToolException { try { File t = new File( textFile ); if ( t.exists() ) { File m = new File( mvdFile ); MVD mvd; if ( mvdFile != null ) { mvd = MVDFile.internalise( m, Utilities.loadDBProperties(dbConn) ); mvd.setDirectAl...
d72054ff-ff21-4596-95ea-d500c5c16621
2
public static void animateMovement(Direction direction) { if (direction == Direction.RIGHT) { //TODO: Display animation for moving right } else if (direction == Direction.LEFT) { //TODO: Display animation for moving left } else ...
d2e3427e-ce12-426b-ba1d-dc5467d9ce7b
6
private static Image getImage(String filename) { // to read from file ImageIcon icon = new ImageIcon(filename); // try to read from URL if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) { try { URL url = new URL(filename); ...
a3ef38b4-eebf-4572-8676-314556ad9cb5
4
public void close(){ write("Shutting down the server"); try { // disconnect every client from the server // close all the sockets of the threads for (int i=0; i<clientList.size();i++){ if (clientList.get(i).isRunning()){ l...
8ee9a6fc-9d72-426e-8ec8-bafcca263128
2
public final synchronized int readint(){ int ch = -1; try{ ch = input.read(); }catch(java.io.IOException e){ System.out.println(e); } if(ch==-1){ System.out.println("FileIn...
78c8f612-489d-466b-8633-7d445d7eaa64
9
private boolean r_mark_suffix_with_optional_s_consonant() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 143 // or, line 145 lab0: do { ...
08f0b954-b134-47c3-958a-18cacc8c05fc
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 Clinic)) { return false; } Clinic other = (Clinic) object; if ((this.clinicId == null && other.clinicId != null...
8a1988c0-2634-4681-9ce3-d5a724e207c0
9
static int process(String line) { int n = 2 * Integer.parseInt(line.trim()); if(n == 0) return 0; int[] x = new int[n]; int[] y = new int[n]; costm = new double[n][n]; for (int i = 0; i < n; i++) { String[] str = readLine().trim().split(" "); x[i] = Integer.parseInt(str[1]); y[i] = Integer...
d323dfb2-58a0-4092-917c-eb53c857f0e1
2
private static void updateTablePane() // pane 3 { Vector labels = new Vector(); labels.add("Table"); labels.add("Name"); Vector lines = new Vector(); for (int k = 0; k < DiningRoom.size(); k++) // for each table { Vector stu = new Vector(((Table) DiningRoom.get(k)).getIDList()); int thisStuIndex =...
06fd542f-fd06-4875-81e5-7052d3d4f963
5
@Override public void run() { for (int i = 1; i <= MAX_TRIES; i++) { if (window.RemotePlayer != null && window.RemotePlayer.startsWith("MASTER")) break; try { // construct quote String dString = Pong.address.toString(); byte[] buf = dS...
1440f8b2-e52a-40e8-a382-89ff658f9a57
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); String line = ""; while ((line = in.readLine()) != null) { int n = Integer.parseInt(line.trim()); if (n == 0) break; int[] p...
c6692edf-9ce5-4601-85f4-dbf88d558148
6
public ListarImagemGUI() { //<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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf....
ee202d45-6a8b-4fd2-8065-c3c7e2817c4a
6
@Override public void run() { threadRun = true; Simulator simulator = MainProgram.getSimulator(); while(threadRun && numSteps > 0 && simulator.getSimulatorView().isViable(simulator.getField())) { MainProgram.getSimulator().simulateOneStep(); numSteps--; while(infinite && numSteps == 0) { n...
47dc7287-4e1c-4166-8587-05c4063fef64
6
@Override public Node<TypeOfState, TypeOfValue> next() { if (!this.hasNext()) throw new NoSuchElementException("No more nodes to iterate."); Node<TypeOfState, TypeOfValue> node; boolean keepGoing = true; while (keepGoing) { node = this._stack.peekLast(...
faf6d931-f8dc-47a7-8b19-5edaad2ad624
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LoadBalancee other = (LoadBalancee) obj; if (permits == null) { if (other.permits != null) return false; } else if (!permits.equals(othe...
d317b095-0b8e-449c-a205-8aa2086240c8
6
private String getSynonymOwner(String synonymName) { PreparedStatement ps = null; ResultSet rs = null; String ret = null; try { ps = getConnection().prepareStatement("select table_owner from sys.all_synonyms where table_name=? and owner=?"); ps.setString(1, synonymName); ps.setString(2, schema); rs ...
d4ab7e92-0bc3-4652-91bf-22cdf301b7b7
3
boolean waitForState(Processor p, int state) { synchronized (waitSync) { try { while (p.getState() < state && stateTransitionOK) waitSync.wait(); } catch (Exception e) {} } return stateTransitionOK; }
6ab92d94-3d7f-4281-97e2-4417efff2090
8
public static IntPair calculateMove(Board b, ArrayList<Tuple> movesToBlock, ArrayList<Tuple> movesToMake) { //first check for winning move for (Tuple item : movesToMake) { if (item.getWeight() == 2) { AIDebuggingOutput.println("I'm smart, so I'm winning at " + item.getLocatio...
8b562e92-5ad4-49d0-9ea5-3995916864b6
0
void addAction(Object obj, final String userid){ btn.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { Map<String, Object> m = new HashMap<String, Object>(); m.put("action", "game-action"); m.put("userfrom",View._model.user_id ); m.put...
1bde8501-2cc7-41bd-8db4-7bd52be0ba34
7
public void renderTile(int xp, int yp, Sprite sprite) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < sprite.SIZE; y++) { int ya = y + yp; // ya = actual y position for (int x = 0; x < sprite.SIZE; x++) { int xa = x + xp; // ya = actual y position if (xa < -sprite.SIZE || xa >= width || ya < 0 |...
16b68636-9902-434d-a3a9-d88aeacc89c3
3
public String[] deletedItemsNames(){ if(!this.dataPreprocessed)this.preprocessData(); if(this.nDeletedItems==0){ System.out.println("Method - deletedItemsIndices: there are no deleted items; null returned"); return null; } else{ String[] nam = new Stri...
de4cddc0-6020-4d5d-b096-ff4c6e79f7fa
6
@EventHandler public void SpiderFireResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSpiderConfig().getDouble("Spider....
421efef4-9779-4685-b154-c96de2aac950
2
public static void jFrame() { JFrame frame = new JFrame("Modules"); JPanel panel = new JPanel(); for (Module m : modules) { JButton button = new JButton(m.getClass().getSimpleName()); hash.put(button, m); panel.add(button); } for (final JButton b : hash.keySet()) b.addActionListener(new ActionList...
505ef8c2-503a-42ca-a6b6-1c2eb28c3c7b
1
private void fazerLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fazerLoginActionPerformed try { out = new PrintWriter(socket.getOutputStream(), true); } catch (IOException ex) { Logger.getLogger(ClienteGraphicLogin.class.getName()).log...
9c1df4bc-f1dc-4922-993d-e2351bd1d206
7
@Override public void caseAWhileStmt(AWhileStmt node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(While"); inAWhileStmt(node); if(node.getWhile() != null) { node.getWhile().apply(this); } if(node...
a2fce4c4-1f6d-4e06-9340-27cac7291929
2
public boolean isPlaceableWithin(Point p, int dist) { boolean ret = false; for (String key : placeables.keySet()) { Placeable placeable = placeables.get(key); if (placeable.getCenterPoint().distance(p) <= dist) { ret = true; } } return ...
d1c04ee9-c5ba-4cbf-adac-e3f8c71bc5e4
8
public void testLoadFloorPlan() throws Exception { String testFile = prepareTestFile(); Document doc = FloorPlanUtility.loadFromString(testFile); FloorPlan floorPlan = FloorPlanUtility.loadFloorPlan(doc); BufferedReader reader = new BufferedReader(new StringReader(testFile)); String line = reader.readLine(...
d4ad9631-256b-4e92-bd59-126e141e732a
3
public void endElement(String uri, String localName, String qName) throws SAXException { if(qName.equalsIgnoreCase("Person")) { //add it to the list myPers.add(tempPers); }else if (qName.equalsIgnoreCase("firstName")) { tempPers.setFirstName(tempVal); }else if (qName.equalsIgnoreCase("lastName")) { ...
b12e0b49-4d2a-4d33-8aa6-6f57e99a54db
3
public Object getStat() throws Exception { final HttpURLConnection conn = (HttpURLConnection)url.openConnection(); Future<Integer> future = executor.submit(new Callable<Integer>() { public Integer call() throws Exception { conn.connect(); return conn.getRespo...
ab3d662a-141d-431d-995f-f181677deb4b
1
public void stateChanged(ChangeEvent e) { JSlider source = (JSlider)e.getSource(); double pass = source.getValue()*1./AUTOMATON_SIZE_INIT; view.setScale(pass); view.requestTransform(); ArrayList<Note> noteslist = drawer.getAuto...
3834eec8-6e47-4910-8ec7-565c65006cbd
9
void quickSort(int a[], int lo0, int hi0, int longDimMask) { // Based on the QuickSort method by James Gosling from Sun's SortDemo applet int lo = lo0; int hi = hi0; int mid, t; if ( hi0 > lo0) { mid = a[ ( lo0 + hi0 ) / 2 ] & longDimMask; while( lo <= hi ) { w...
6d7a6c5a-5403-4567-ba0c-372e62768ddf
0
@Override public int hashCode() { return productCode.hashCode(); }
00b3ba84-bec9-4c1e-b78b-ab04f41d53fb
4
@Override public void run() { try { final byte[] bytes = new byte[this.stream.available()]; if (bytes.length == 0) { return; } int read = this.stream.read(bytes); while (read < bytes.length) { read += this.stream.read(bytes, read, bytes.length - read); } this.result = this.sc.parse(byte...
6fa0e8e3-2543-453e-bc4a-6f6664d97748
2
public static boolean writeString(ByteBuffer buffer, String value) { if (buffer.remaining() < getStoredSpace(value)) { return false; } char[] chars = value.toCharArray(); buffer.putShort((short)chars.length); // Convert from chars to bytes for (int i = 0; i < chars.length; i++) { buffer.put((...
92b62dcb-33b5-4d13-a0a5-87613d61297e
3
public String toString() { StringBuilder b = new StringBuilder(); for(int j = 0 ; j < 8 ;j++) { for(int i = 0 ;i<8;i++) { Piece p =theGrid[i][j]; if(p!=null) { b.append(p.toString()); } else { b.append(" "); } } //b.append("\n"); } return b.toString(); ...
9eff5a20-c08a-44fc-854a-810add906d69
0
public boolean isGesture() { return isGesture; }
37c42d08-eab4-46ee-a1e0-d3d1f9ce3d05
7
public void translate(ArrayList nuc, ArrayList bass, int chordSeq, int noteSeq) { // Initialise appropriate chord sequencer switch (chordSeq) { case 0 : chordSequencer = new RandomChordSequencer(mapping); chords = chordSequencer.run(); bre...
cf5a22c1-d1b3-4363-b33d-c326e6cac2d2
8
public static List<Category> list() throws SQLException{ PreparedStatement s = null; List<Category> cats = new ArrayList<Category>(); // Open a connection to the database using DriverManager try { try {Class.forName("org.postgresql.Driver");} catch (ClassNotFoundException ignore) {} currentCon = D...
f18d91d5-ea9d-4304-a8d9-3befcc375dac
5
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(command.getName().equalsIgnoreCase("smclearx")); { if(args.length == 0) { for(@SuppressWarnings("rawtypes") Iterator iterator1 = Bukkit.getServer().getWorlds().iterator...
a2f0c0ef-7c25-4857-bf49-3e61c9051c14
6
static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextCol...
6b6cbf0a-63d4-481f-9074-ffc57493201f
1
@Test public void testTimeStep_PERIOD2() throws Exception { printDebug("----------------------------"); printDebug("PERIOD2: " + this.toString()); printDebug("----------------------------"); CSTable t = DataIO.table(r, "obs"); Assert.assertNotNull(t); ...
75e16465-be7b-4dde-beea-ee4b01ff0205
8
protected String attributeCaseFix(String columnName){ if (m_checkForUpperCaseNames) { String ucname = columnName.toUpperCase(); if (ucname.equals(EXP_TYPE_COL.toUpperCase())) { return EXP_TYPE_COL; } else if (ucname.equals(EXP_SETUP_COL.toUpperCase())) { return EXP_SETUP_COL; } else if (uc...
21027492-f8c5-46cc-972a-f481fe134455
4
private static final boolean validate(long[] eA, long[] eB, long[] dltaA, long[] dltaB) { long[] tA = new long[redundant]; long[] tB = new long[redundant]; for (int i = 0; i < redundant; i++) { int k = maxdiff + i; tA[i] = eA[k]; tB[i] = eB[k]; ...
1264f75a-8f41-4ff2-9f0a-9f8dc256d8f6
9
public static Color getColor(int num) { Color color = new Color(0); num = num % 9; if (num == 0) { color = Color.black; } else if (num == 1) { color = Color.blue; } else if (num == 2) { color = Color.gray; } else if (num == 3) { color = Color.green; } else if (num == 4) { color = Co...
5427821a-7b0d-4ee4-8515-46d4b3d561e8
9
public List<String> searchByKeywords(String str) throws IOException { Keywords keywords = new Keywords(str); Node root = openRoot().getRootNode(); StringBuilder prefix = new StringBuilder(); for (int i = 0; i < keywords.size();) { Integer num = null; ...
d78af603-d8b2-4165-9a52-de9fc942a690
4
public void check(Orderer orderer) { int[] a = {4,7,1,8,5}, a0 = {1,4,5,7,8}; int[] b = {1,2,3,4}, b0 = {1,2,3,4}; int[] c = {6,6,0,9,1,7}, c0 = {0,1,6,6,7,9}; int[] d = {1}, d0 = {1}; a = orderer.order(a); b = orderer.order(b); c = orderer.order(c); d = ...
1d33ed2c-6237-4163-9109-afdf0006b1fe
3
public String getTipoMovimientoPos(String tipo){ if (tipo.equals("sale")){ return "V"; } else if (tipo.equals("fall")){ return "B"; } else if(tipo.equals("return")){ return "D"; } return ""; }
367f10b4-2d9f-401c-99ee-dac5af16229c
5
public void loadPrices() { try { Scanner input = new Scanner(new File("prices.txt")); while (input.hasNext()) { String temp = input.next().replace('_', ' '); if (itemMap.containsKey(temp)) { itemMap.get(temp).setWorth(input.nextInt()); itemMap.get(temp).setTimeUpdated(input.nex...
223709b0-23b3-4607-9aa5-d3fdf1743b24
1
private void allocMemory () { binArr = new byte[3][]; binArr[0] = new byte[binList.get(0).size()]; if (codeCbCr) { binArr[1] = new byte[binList.get(1).size()]; binArr[2] = new byte[binList.get(2).size()]; } }
f7e0e2b4-c5ee-4c53-abe0-02d11841d06a
1
Integer findRoot(Integer a) { // to find the root of an element we traverse the tree starting from the button while (a != id[a]) { a = id[a]; } return a; // this is another approach using recursion however it is good to avoid recursion. // if (id[a] == a) { ...
7a063437-aece-47fe-bc5c-5721ab749129
8
public void load(Minecraft mc, MinecraftClass mcClass) { minecraft = mc; Class<?> clazz = mcClass.getClazz(); int i = 0; try { if (hasParameters) { for (; i < paramNames.length; i++) { paramClasses[i]...
fc0c0bcf-a214-40ee-a8c8-9cc0dd5bf649
0
public static String getTimeString(int time) { long tmpTime = time % 10L; String timeText = Long.toString(tmpTime); tmpTime = (time % 100L - time % 10L) / 10L; timeText = Long.toString(tmpTime) + timeText; tmpTime = (time % 1000L - time % 100L) / 100L; timeText = ":" ...