method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4a0de6e2-1643-4611-9e27-bbfa2c3c8f18
5
@Override public void processKeyPressed(KeyEvent e){ if(e.getKeyCode() == KeyEvent.VK_RIGHT){ mountains.setVector(-1.0, 0); player.setRight(true); } if(e.getKeyCode() == KeyEvent.VK_LEFT){ mountains.setVector(1.0, 0); player.setLeft(true); ...
f1c233a3-bcfc-49bc-925c-2ac573eaef32
3
@Override public void run() { while( true ) { Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch ( IOException e ) { System.err.println("WSSListener.run(): Error accepting connection"); ...
951caded-ff74-4553-a2fb-53e362271a46
9
public static void refreshdisplay() { // Retrieve scene grid size Object[] paramsIntern = { 0 }; String engineData = (String) consumer.consumeService( "getSize", paramsIntern ); String[] sizeArray = engineData.split(":"); displayPanel.setVirtualSize(Integer.parseInt(sizeArray[0]), Integer.parseInt(sizeArray[...
a1ee60b9-5af1-4279-8af1-3b0c5c05832a
7
public final WaiprParser.prog_return prog() throws RecognitionException { WaiprParser.prog_return retval = new WaiprParser.prog_return(); retval.start = input.LT(1); CommonTree root_0 = null; ParserRuleReturnScope machine1 =null; try { dbg.enterRule(getGrammarFileName(), "prog"); if ( getRuleLevel()==0 ...
a512ef13-056d-4a00-b4e7-371737e1b141
9
@Override public boolean tick(Tickable ticking, int tickID) { if(tickID==Tickable.TICKID_MOB) { if((affected!=null) &&(affected instanceof MOB) &&(invoker!=null)) { final MOB mob=(MOB)affected; if(((mob.amFollowing()==null) ||(mob.amDead()) ||(mob.location()!=invoker.location()))) ...
ad57ce14-6098-4938-b268-54b60447a30a
8
private int NearestEnemy(){ int vzdalenost = 3000; int angle, min_x = 0,min_y = 0; /** * Zjištění nejližšího nepřítele */ for (int i=0;i<enemies.size();i++) { // Výpočet vzdalenost X,Y souradnice int pomx = Math.abs(x - enemies.get(i...
8cd0f79b-6480-4c07-ad91-150659560d2e
4
public String saveFormat() { return (day < 10 ? (new StringBuilder().append(0).append(day)) : day) + " " + months[month - 1] + " " + year + " " + (hour < 10 ? (new StringBuilder().append(0).append(hour)) : hour) + ":" + (minute < 10 ? (new StringB...
e7198338-2ff7-4f42-bdd1-096fe8b7e88b
5
@Test public void TestaaTyhjaOikeaAlanurkkaVasenYlanurkka() { rakentaja = new Kartanrakentaja(10, 6); char[][] kartta = rakentaja.getKartta(); Solmu aloitus = new Solmu(kartta.length-1, kartta[0].length-1); Solmu maali = new Solmu(0, 0); Reitinhaku haku = new Reitinhaku(kartt...
6c3b4e11-b0ea-4e32-b83b-db1c2046cceb
8
private void addBundle(String name) { ClassLoader loader = getClass().getClassLoader(); Class bundleClass = null; try { if (loader != null) { bundleClass = loader.loadClass(name); } else { bundleClass = Class.forName(name); } } catch (ClassNotFoundException e) { /...
4ea51606-7e82-4b96-8710-a9148db4b54c
1
private void refreshEditData() { int selRow = rosterTable.getSelectedRow(); if (selRow >= 0) { refreshEditDataFrom (MainWindow.rosterDB.getRosters().get(selRow)); } }
c3b2be61-6ef3-4cf6-90d5-6e1cc9e5d44c
2
private void addPlayerView(Player player) { if(playerViews.size() < 2) { PlayerView view = new PlayerView(player); playerViews.add(view); if(playerViews.size() == 1) { view.setLocation(10, 10); } else { view.setLocation(220, 10); } getContentPane().a...
94d83a7c-5a4d-4979-84b5-5a135769b381
2
private void paintPixelHue(int position, int color, double hue, double saturation) { int trans = ((color >> 24) & 0xff); if (trans == 0); else if (trans == 0xff) { color = Color.applyHue(color, hue, saturation); pixels[position] = color; } else { color = Color.applyHue(color, hue, saturation); pix...
d1d6cbf0-ad03-4ca0-8114-c5ab9ba525e9
3
public void updatePhysics() { if(x+vx >=0 && x+width+vx <= DryIceClimber.SCREEN_WIDTH) { x += vx; int x = 3; } if(y+vy >= 0) { y += vy; } }
72ee41b8-73e0-4642-aa14-20fe8b468b6b
6
public static Member createElement(final int id, final int x, final int y, final ElementData ed) { Member e = null; switch (ed.elementType.toLowerCase()) { case "prop": e = props.get(id).clone(); break; case "decoration": e = decorations.get(id).clone(); break; case "player": final Player t...
ac3465f8-cb9b-4f2c-97a0-5c08539ffd7e
0
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: client.sendMessage("ROOMCHAT@" + roomId + "@" + transfer(jTextPane1.getText()) + "@" + client.frame.getTitle()); pos.removeAllElements(); p...
58b88e79-256a-49d6-b97a-b7739138cc5b
2
public Engine(Ship parent, int engineNum){ this.parent = parent; this.engineNum = engineNum; xorigin = parent.getX(); yorigin = parent.getY(); int totalPoints = parent.speed+(parent.power/4); if(totalPoints <=2){ engineHeight = 2;//(totalPoints - 1) / (1250 - 1) * (24-1) + 1; engineWidth = 1;/...
a865c99a-a2ae-4bf4-a164-be557869f37f
3
private void updateMoveableIndicator() { // [srk] same protection added to updateColors // make sure node is not null if (node == null) { return ; } // end if if (node.getMoveableState() == Node.MOVEABLE_TRUE) { iMoveable.setPropertyInherited(false); iMoveable.setProperty(true); } else if (n...
b1acaac5-6a4a-4816-96c6-e8ade4df0c69
9
protected void update(CheckedFrequencyTable freq, int symbol) throws IOException { // State check if (low >= high || (low & MASK) != low || (high & MASK) != high) throw new AssertionError("Low or high out of range"); long range = high - low + 1; if (range < MIN_RANGE || range > MAX_RANGE) throw new Assert...
886f5a03-b455-4183-a328-8d0101065390
0
public void setMimeType(String value) { this.mimeType = value; }
e780102b-f44a-45b6-a006-06550f574ae1
3
protected Connection setupConnection(String hostname, int port, String database, String user, String password) { try { Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); } catch (ClassNotFoundException e) { LOGGER.severe("Where is your JDBC Driver (nl.cwi.monetdb.jdbc.MonetDriver)...
b643ffa6-e5f3-46fb-a6a5-9107bb5a9cdd
0
public ConfigurationPane(Automaton automaton) { this.automaton = automaton; // this.setLayout(new FlowLayout(FlowLayout.LEFT)); }
0f8ebf35-5f91-4414-98bd-39b28913a0a5
2
public void testCreateAndDeletePerson(){ UUID personId = null; String personJson = " {\n" + " \"factoidDesc\": \"Bob likes to work on his Toyota Supra and race it at Cecil County Dragway\",\n" + " \"title\": \"Newest Employee at HomeAway?\",\n" + ...
77d8edb0-d173-42b4-9084-547eeafc91a6
6
public void setSyncTableRow(int tableRowIndex, String status, int progressValue, int totalProgressValue, File file) { tblSync.getModel().setValueAt(status, tableRowIndex, 1); Component c = (Component) tblSync.getValueAt(tableRowIndex, 2); if (c instanceof JProgressBar) { ((JProgres...
c6d6fa22-c447-403a-90b0-89aed32f760d
6
private void buildWalls() { Random random = new Random(); int procentWalls = random.nextInt(19) + 2; while (getElementCoverage(Wall.class) < procentWalls && (procentWalls - getElementCoverage(Wall.class)) >= 2) { Direction direction = validDirections[random.nextInt(2)]; int randomLength = 1; int random...
4c6e359e-6c30-4645-bcaa-d937f9e7ad90
4
static public void main(String []args) { double [] data = new double[64]; // 64 MB for(int i = 0 ; i < 64 ; i++ ) data[i] = i; double [] cdata = new double[64]; int []vsize = {4,4,4}; int []chunkSteps = {2,2,2}; ChunkTranslater t = new ChunkTranslater(); DataChunk chunk = new DataChunk(vsize,chunkS...
f004ce0e-8c3b-4f3f-b7f4-93b021c4028b
7
public void run() { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true) { String line; try { System.out.print("> "); line = reader.readLine(); } catch (IOException e) { break; ...
ea01cd66-3037-4ba1-bbdc-670896880855
0
public String getPositionId() { return positionId; }
a3877a34-362e-456f-be4e-a4cca21421c9
4
@Override public Tipo validarSemantica() throws Exception { Tipo izq,der; izq=izquierdo.validarSemantica(); der=derecho.validarSemantica(); if (izq instanceof TipoInt || der instanceof TipoFloat){ if (der instanceof TipoInt || der instanceof TipoFloat ){ r...
dd794a9e-d581-443d-8ad5-e8f2536fa93f
9
@EventHandler(priority= EventPriority.LOW) public void onBlockBreak(BlockBreakEvent event) { Block BrokenBlock = event.getBlock(); if (config.enabledWorld.contains(BrokenBlock.getWorld())) { boolean respawnNeeded = false; switch (BrokenBlock.getTypeId()) { cas...
90bcbecf-ad89-4508-a8f6-8e5fb7271761
7
public EventsGUI(MainGUI mainGUIObject) { mainGUI = mainGUIObject; game = mainGUI.getGame(); resources = game.getResources(); message = new MessageGUI(); refreshNumber = 0; possible = true; setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); getContentPane().setLayout(null); getContentPa...
7973bab0-58b1-48eb-b717-ad034885cf4a
3
void drawSImage(int xPosition, int yPosition, String FileName,int theWidth,int theHight) { if (FileName == "X") { this.graphic.drawImage(Picture1, xPosition, yPosition, theWidth, theHight, null); } if (FileName == "O") { this.graphic.drawImage(Picture2, xPosition, yPosition, theWidth, theHight, null); ...
9a7a6e89-8b68-4a72-968d-91e30f947358
0
public String getPwd() { return pwd; }
46687075-82a0-4b56-9796-c7dca63fca89
3
public Baddy enemyMove( ) { if ( lastMove == 0 ) { return new Baddy( new Posn( pin.x, pin.y + 20), "images/downbaddy.png", 0 ); } else if ( lastMove == 1 ) { return new Baddy( new Posn( pin.x + 20, pin.y), "images/rightbaddy.png", 1 ); } else if ( lastMove == 2 ) { return new Baddy( new Posn( pin.x, pin...
7aaf20a5-a99c-481c-a036-8077e0667cef
5
public void moveEntityRight() { for (Entity entity : entitys) { boolean blocked = false; for (Entity platform : platforms) { if (platform.entityType == EntityType.Solid) { if (platform.intersects(new Square(entity.getX() + 6 , entity.getY(), entity.get...
ca6b80f8-c054-479d-8821-81955a45b1fd
1
public void responderUnaPregunta(int numeroDePregunta, String respuesta) { /*Primero me aseguro que este todo en minuscula, y despues meto la primer en mayuscula Probe con esto pero le deja algo al string que hace que falle la comparacion respuesta = respuesta.toLowerCase(); respuesta = Character.toString(re...
0d16f1a9-fadd-425c-a9e5-e830a37c1ada
9
public BLMovie(String filename) throws BMovieException, IOException, FileNotFoundException { this.isGzip = GZIPDetector.isGZIPFile(new File(filename)); if (this.isGzip) { System.out.println("movie appears to be gzip!"); } else { System.out.println("move is not gzip"); } frames = new LinkedList<Frame>...
dcc399d1-501b-4b16-a628-677ee76135d8
4
@Override public void run() { long fpsTimer = System.currentTimeMillis(); int frames = 0; double nsPerTick = 1000000000.0 / _settings.getDouble("FPS", 60.0); long runNs; long lastNs; long nsToSleep = 0; double delta = 0; while (_running) { lastNs = System.nanoTime(); runStep(delta); frames++;...
3d153465-570c-4d66-95e0-89712ffd1f0b
8
public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if ( object == downSample ) downSample_actionPerformed(event); else if ( object == clear ) clear_actionPerformed(event); else if ( object == add ) add_actionPerf...
b62f55ff-e7d1-4f34-8f5c-23f8c10a5b9e
6
final void method3049(ByteBuffer class348_sub49, int i, int i_11_) { anInt9460++; if (i_11_ != 31015) method3147((byte) 32); int i_12_ = i; while_212_: do { do { if ((i_12_ ^ 0xffffffff) != -1) { if ((i_12_ ^ 0xffffffff) != -2) { if ((i_12_ ^ 0xffffffff) == -3) break; break while_...
b4b528b8-72d7-473e-a29a-cc7e36cdb9c6
0
private ImageProcessor findCells(ImageProcessor ip){ ImageProcessor temp = ip.duplicate(); temp.invert(); ImagePlus imp = new ImagePlus("Temp", temp); ResultsTable blobs = new ResultsTable(); Double min_size = 300.0; Double max_size = Double.POSITIVE_INFINITY; ParticleAnalyzer pa = new ParticleAnalyzer(Pa...
ae5e7b00-b9e6-477b-a911-5323dd3bc0f4
3
public static USBConnection getConnection() throws PortInUseException, UnsupportedCommOperationException, IOException { @SuppressWarnings("unchecked") Enumeration<CommPortIdentifier> ports = CommPortIdentifier.getPortIdentifiers(); LOG.debug("Starting to probe ports."); while (ports.hasMoreElements()) { ...
984d3f84-a312-405f-ac4f-f1f3b8f66551
6
private void computeDirectly() { for (int row = startRow; row < endRow; row++) { for (int col = startCol; col < endCol; col++) { int numberOfNeighbors = getNumberOfNeighbors(row, col); if (originalBoard[row][col]) { destinationB...
9bf673a5-9951-4273-8b69-b6373938b70d
7
void emptyPenBox() { assert (home != null && away != null); // empty the penalty box int i = 0; while (i < penBox.homePlayer.GetNofPlayers()) { Player player = penBox.homePlayer.GetPlayer(i); player.decPenSec(); if (player.getPenSec() == 0) { // player goes from penbox onto ice getEvent().bitSe...
840e7db3-d95c-4a0a-8c02-f41999fea7bb
4
public int transform(CtClass tclazz, int pos, CodeIterator iterator, ConstPool cp) throws BadBytecode { int c = iterator.byteAt(pos); if (c == GETFIELD || c == GETSTATIC) { int index = iterator.u16bitAt(pos + 1); String typedesc = isField(tclazz.getCl...
1d0ac26b-eb00-4f52-b917-08a27a4226cc
0
public int getDepartureStart() { return this._departureStart; }
3c7766c9-7e5f-4196-b476-53b7709f5618
5
public void onEnable() { getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(new RedstoneUpdateListener(), this); CONFIG = getConfig(); if (CONFIG.get("threshold") != null) { THRESHOLD = CONFIG.getInt("threshold"); } if (CONFIG.get("refreshTime") !...
a22528eb-f5e2-4444-a45c-fb1efc82f338
5
final int method1859(int i, long l) { if (i != 71) return 127; if ((aLong6158 ^ 0xffffffffffffffffL) > (aLong6154 ^ 0xffffffffffffffffL)) { aLong6155 += aLong6154 - aLong6158; aLong6158 += -aLong6158 + aLong6154; aLong6154 += l; return 1; } int i_0_ = 0; do { i_0_++; aLong61...
d98d6e73-7e90-4b3a-8802-010b13576166
1
public void bakePie() { if (constructed) { pb.bake(); } else { BuilderClient.addOutput("error - your pie is not constructed yet!"); } }
5c508b35-ce25-43ee-b7b8-e75e68916113
9
void TokenLexicalActions(Token matchedToken) { switch(jjmatchedKind) { case 0 : break; case 42 : if (jjmatchedPos == -1) { if (jjbeenHere[0] && jjemptyLineNo[0] == input_stream.getBeginLine() && jjemptyColNo[0] == input_stream.getB...
198a4707-07cd-440b-90f8-c8c3e403a138
9
private void jBDerefActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBDerefActionPerformed try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException ex) { JOptionPane jOErreur = new JOptionPane("Driver non trouvé " + e...
6ce6e6cb-8099-4115-b90e-546b0b5dddf0
8
public void renderProjectile(int xp, int yp, Projectile p) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < p.getSpriteSize(); y++) { int ya = y + yp; for (int x = 0; x < p.getSpriteSize(); x++) { int xa = x + xp; if (xa < -p.getSpriteSize() || xa >= width || ya < 0 || ya >= height) break; if...
6c80b8f8-e645-43c6-88f7-3aeffce1e0f5
8
private static Config getConfig(String[] args) { Config config = new Config(); if(args!=null){ for (int i = 0; i < args.length; i++) { if(args[i].equals("-date")){ i++; Helper.isTrue(args.length>i && Helper.isNotBlank(args[i]), "argument after -date have to be one of "+Arrays.asList(DateSetting....
d904480b-9814-45cd-926b-f4e4c06bcc75
0
public int getPoints() { return points; }
5b3f790e-233c-4178-93a5-fccb25a519e8
5
private void computation() throws IOException, SyntaxFormatException { assertAndMoveNext(TokenType.MAIN); VariableTable globalVarList = varDecl(); for (VariableTable moreVar = varDecl(); moreVar != null; moreVar = varDecl()) { globalVarList.append(moreVar); } if (globalVarList == null) { globalVarList ...
48482ea9-9a49-4960-924d-a688244e70fa
3
public ListeScore(){ listeScores = new ArrayList<>(); String filename = "src\\Scores\\ScoreListe.txt"; File file = new File(filename); try { Scanner scan = new Scanner(file); while(scan.hasNext()){ String joueur = scan.next(); ...
7d43ee45-49f6-4da4-8bd4-d32eba1b107d
7
private boolean doesfit(int width, int height, int size, String[] text) { int currentRow = size; int currentColumn = 0; int i = 0; for (; i < text.length; i++) { if (currentColumn + text[i].length()*size <= width ) { currentColumn += text[i].length()*size; ...
3245d183-8d73-4787-a20d-ea35d3eabd49
4
public String getCountryName(String iso2) { String back = "" ; if (iso2 != null) { boolean found = false ; // normalize to capital letters int hash = iso2.toUpperCase().hashCode() ; ListIterator it = liste.listIterator() ; while ( (it.hasNext()) && (!found)) { ...
ff83ef2b-bfba-43ce-a6a1-d4b68c852437
8
private void clean() { if (mCleanEntries != null) { return; } // Clean out entries that are incomplete or bogus. int size = mEntries.size(); mCleanEntries = new ArrayList<Entry>(size); mRangeCount = 0; outer: for (int i=0; i<size; i++) { ...
4949178b-32d8-4a4e-9e89-515b5fba1703
6
private void behaviour(){ if(playerState == 0){ turnTowardBall(); // the first state is about the player standing in place looking for the ball if(distanceBall <= REACTION_DISTANCE) playerState = 1; // when the ball comes into range, change state } if(playerState == 1){ ...
4158ab86-70c0-48af-8837-2c019560338b
4
public byte getMinimumDifference_as_byte(){ byte diff = (byte)0; if(this.type==10 || this.type==11){ ArrayMaths am = this.sort(); byte[] sorted = am.getArray_as_byte(); diff = (byte)(sorted[1] - sorted[0]); byte minDiff = diff; for(int i=1; i<t...
df69263d-3c5e-4d03-84dc-ee7bfd64a1ce
5
public boolean canPlayRoadBuilding(int playerIndex, EdgeLocation spot1, EdgeLocation spot2) { if (generalDevCardPreconditions(playerIndex) && serverModel.getPlayers().get(playerIndex).getOldDevCards().getRoadBuilding() > 0 && serverModel.getPlayers().get(playerIndex).getRoads() >= 2) { ArrayList<Road> ro...
48ddf21b-68ac-4fbf-9ce3-9c378cba15bf
9
private boolean checkNorthWestEdge(EdgeLocation normEdgeLocation, ArrayList<Road> roads, int playerIndex) { HexLocation thisHexLoc = normEdgeLocation.getHexLoc(); HexLocation NWHexLoc = normEdgeLocation.getHexLoc().getNeighborLoc(EdgeDirection.NorthWest); HexLocation SWHexLoc = normEdgeLocation.getHexLoc().getNei...
5c580b9c-3983-4e4b-8fcf-f84a1231ab77
6
public String getSource() { StringBuilder sb = new StringBuilder(); sb.append(String.format("/*" + "\n * Dynamically created source via interfaces.client.generate.Functions for remote client to server at %s:%s" + "\n * Date: %s" + "\n */\n", host, port, new Date())); sb.append(...
f149cb4b-4bdb-4c7c-940a-641f64718b74
0
public ConsoleConnectionLogger(final String route_name, final Integer connection_id) { this.route_name = route_name; this.connection_id = connection_id; final ConsoleHandler handler = new ConsoleHandler(); handler.setFormatter(new SimpleFormatter()); logger.addHandler(handler); logger.setUseParentHandlers(f...
05d27932-b019-469a-a428-56c3405113b7
5
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); double x1=sc.nextDouble(); double y1=sc.nextDouble(); double x2=sc.nextDouble(); double y2=sc.nextDouble(); //当前位置CLICK if(x1 == x2 && y1==y2) { System.out.println("CLICK"); return; ...
ece28d99-d9e6-41d0-a9c5-b0ecbb6dd7fe
8
private void habilitarMenuPerfil(Vector<Vector<Integer>>moduloTarea){ habilitarMenu(false); for(Component cMenu:jMenuBar1.getComponents()){ for(Vector<Integer>modulo:moduloTarea){ if(cMenu.getName().equals("M"+modulo.get(0))){ ...
356eea8d-5545-405c-a1ac-1b6dbf119495
5
public void connected(final Connection connection){ System.out.println("Recieved Connection " + connection.getID()); if(!client_connected && conID == 0 && !waitingOnPassword){ //client_connected = true; //conID = connection.getID(); if(psw_enable && !password.equals("")){ // store t...
3749ccf6-1cf2-4a0b-96c2-7f38655728e2
9
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed setVisibleAllFalse(); Sumarizacao.setVisible(true); try { float mediaAvVenda = f.mediaAvVenda(); float mediaAvAtendimento = f.mediaAvAtendimento(); float mediaAvOficina = f.mediaAvOficina()...
275597cb-ddfd-4689-9bb4-11b1cddbef07
8
@Test(dataProvider="provider") public void testMessageReceptionUnderHighLoad(Class<? extends Protocol> unicast_class) throws Exception { CountDownLatch latch=new CountDownLatch(1); a=create(unicast_class, "A"); b=create(unicast_class, "B"); MyReceiver r1=new MyReceiver("A"), r2=new M...
98ddbc43-9154-4c9c-9ae9-b2368869dbcf
3
public boolean getPlayerName(String josh) { try { FileInputStream fStream = new FileInputStream("playernames.txt"); DataInputStream in = new DataInputStream(fStream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; while ((line = br.readLine()) != null) { if (line....
a55f2ab3-e5bd-4c9c-8cbb-d8dd03af256c
4
public String getMsg() { InfoMessages im = (InfoMessages) Resources.getInstance().getResource("data/info_messages.xml"); switch (type) { case DB_noConnection: return im.getDbNoConnection(); case Signin_badLoginOrPassword: return im.getBadLoginOrPa...
6300df39-9a38-40a6-8746-ad62c2c76828
1
protected void distributeSelectionEvent() { java.util.Iterator it = selectionListeners.iterator(); while (it.hasNext()) { SelectionListener listener = (SelectionListener) it.next(); listener.selectionChanged(EVENT); } }
24a2f211-d806-4e93-94d7-393b297e26dc
5
public void addAccount(Account account) { if (account == null) return; // nothing to add if (accounts == null) accounts = new ArrayList<Account>(); accounts.add(account); // make sure the account has a resource URI if (account.getResourceURL() == null && this.getResourceURL() != null) { try { // ...
c027e4b8-86a4-4d40-8d43-f9133421b642
9
public static int[] getPos(Cube cube, TileColor other) { for (int f = 0; f < 6; f++) { for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { if ((x == 1 || y == 1) && !(x == 1 && y == 1)) { if (cube.getColor(cube.createArray(f, x, y)).equals(TileColor.white)) { if (other.getInt() == cub...
6919a459-a512-4401-969f-5b5a43769ebb
7
public Status RSVPToSuggestion(long userId, String apiKey, long meetupId, long suggestionId, SuggestionStatus status) throws HoutException { if(userId == 0) { throw new HoutException("userId not specified"); } if(apiKey == null) { throw new HoutException("Api Key not specified"); } if(meet...
5f697e62-237d-4b7c-9552-e057436876b1
5
public void dispatch(Event event){ String eventType = event.getEventType(); List<EventHandler<? super Event>> handles = handleStore.get(eventType); if(CollectionUtils.isEmpty(handles)){ return ; } for(EventHandler<? super Event> handle : handles){ boolean isContinue = handle.handle(event); if(!isC...
1885a6a1-f4e3-48d7-a643-0158a0e7a6a9
1
private String retrieveOperand(String operand) { if (operand.length() == 3) return ""; // No operand, return " " for relative operand return operand.substring(4, operand.length()); // Otherwise return the operand itself }
2c6ad7ed-7194-4043-9c5f-53678a1e6586
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
1504beef-1652-45a4-8dbc-b3076823466a
7
public static void main(String[] args) throws Exception { String input_file=null; XmlConfigurator conf; for(int i=0;i < args.length;i++) { if(args[i].equals("-file")) { input_file=args[++i]; continue; } help(); retu...
b60b3111-c56a-4cc9-b14c-6682a9b49a27
3
public static void DFS(int i, String p) { for (int j = 0; j < h[i].size(); j++) { if (p.length() == 9) { out.append(p).append("\n"); break; } if (!m[i][h[i].get(j)]) { m[i][h[i].get(j)] = m[h[i].get(j)][i] = true; DFS(h[i].get(j), p + (h[i].get(j) + 1)); m[i][h[i].get(j)] = m[h[i].get(j)]...
97c8eb9e-0ba7-481a-81a4-fb4075539395
8
public void stripLocals() { ListIterator iter = bc.getInstructions().listIterator(); for (InstrInfo info = firstInfo; info != null; info = info.nextInfo) { Instruction instr = (Instruction) iter.next(); if (info.local != null && info.local.usingInstrs.size() == 1) { /* * If this is a store, whose val...
cbe7e333-4b83-421c-8fbb-18c6b2a3eccf
0
public static double getDoubleValue(String attr) { return Double.parseDouble(prop.getProperty(attr)); }
0a0a48b5-9249-485d-929e-05cfa4b8c9c5
1
public Id3v2FrameConfig(String frameID, String versionMatch, Class<? extends Id3v2Frame> frameClass, MediaProperty frameProperty, boolean canOccurMultiple) { this.frameID = frameID; this.versionMatch = versionMatch; this.frameClass = frameClass; this.frameProperty = frame...
1f3a9835-0740-420a-a130-129eb12b9a50
5
public void DJP(String startU, LinkedList[] cities/*adjency list*/){ boolean isNewV = false; List<String> V = new ArrayList<>(); //list of added vertices List<Edge> A = new ArrayList<>(); //MST of edges //start at arbitrary v(Grand Forks) and add all edges to Queue (Grand Fork...
610716e2-6861-48b0-8254-248227bd4b4c
2
public List<Strichart> getAlleMoeglichenStricharten() { ResultSet resultSet; List<Strichart> listeStricharten = new ArrayList<Strichart>(); try { resultSet = db .executeQueryStatement("SELECT * FROM Stricharten WHERE Zustand = true"); while (resultSet.next()) { listeStricharten.add(new Strichart(re...
9cdd10b3-dd17-41a1-949a-892b73852dcb
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.size() < 2) throw new Exception("MENOROIGUAL: faltan operandos"); Valor op1 = st.pop(); Valor op2 = st.pop(); if (op1 instanceof Entero && op2 instanceof Entero) { st.push(new Booleano(((int) op2.getVa...
ac786211-ad13-4c47-9d64-2783da2ff1b4
9
private void interpolateObjects(SpriterKeyFrame firstFrame, SpriterKeyFrame secondFrame, float xOffset, float yOffset) { float[] newstuff; for (int i = 0; i < this.currenObjectsToDraw; i++) { SpriterObject obj1 = firstFrame.getObjects()[i]; DrawInstruction dI = this.instructions[i]; if (!obj1.isTransient...
dc8adf92-174b-4869-b673-fc74312ffc0f
6
@Test(expected = java.lang.AssertionError.class) public void twoSymbolTest() { final int ROW1 = 1; final int COLUMN1 = 1; Mark MARK1 = Mark.X; ticTacToeBoard_STUDENT.setMark(ROW1, COLUMN1); final int ROW2 = 1; final int COLUMN2 = 1; Mark MARK2 = Mark.O; ticTacToeBoard_STUDENT.setMark(ROW2, COLUMN2); ...
dddb177f-22cb-4f6a-8a3b-b55e49c026f1
8
@Test public void testGetDescriptionSecondThirdPhone() { Map<String, Object> descriptionSecondPhone = new HashMap<String, Object>(); descriptionSecondPhone.put("name", "Galaxy S4"); descriptionSecondPhone.put("brandName", "Samsung"); descriptionSecondPhone.put("screenSize", 5); descriptionSecondPhone.put("sc...
d7cdd8c4-0cdb-4889-bf51-58ac699ca18c
1
public void loadData(String resource) { File xmlFile = new File(resource); try { Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(xmlFile); Node root = doc.getDocumentElement(); data.put(resource, root.getChildNodes()); ...
0e010351-807f-4e35-8137-047d849d7303
3
private boolean conditionM0(String value, int index) { if (charAt(value, index + 1) == 'M') { return true; } return contains(value, index - 1, 3, "UMB") && ((index + 1) == value.length() - 1 || contains(value, index + 2, 2, "ER")); }
41f027c7-3ede-4363-b9a6-4c6eb5bf7959
4
private Grid getGrid(int x, int y) { for (int i = 0; i < this.walls.size(); i++) { Wall wall = this.walls.get(i); if (wall.isOpened()) { Grid grid = wall.getNextGrid(this); if (grid.getX() == x && grid.getY() == y) { return grid; } } } return null; }
255c17b7-53ec-47a2-86c3-8d56fbfc1ffb
9
private void searchAll(int row, int col, String search, BoggleDictionary dict) { if(row >= height || row < 0 || col >= width || col < 0) { return; } if(marked[row][col]) { return; } search += letters[row][col]; if(dict.hasWord(search)) { set.add(search); } if...
bb6f2619-44e1-4f43-8c98-85f458e6b645
4
public Reservation createReservation(double startTime, int duration, int numPE, int resID) { // check all the values first boolean success = validateValue(startTime, duration, numPE); if (!success) { return null; } Reservation reservation = null;...
22d4372e-a03a-4072-833d-84dcd86f83d1
2
public boolean sendData(Object data) { if(TCPServerManager != null) { return TCPServerManager.sendData(data); } if(tcpClient != null) { return tcpClient.sendData(data); } return false; }
1484766d-1cbe-41ba-985f-d10bd05c1e50
0
private void readaddressActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readaddressActionPerformed // TODO add your handling code here: }//GEN-LAST:event_readaddressActionPerformed
58f4c076-67de-464c-957f-1b686140b7d7
2
private Object getMeta(Metadatable obj, String key) { List<MetadataValue> meta = obj.getMetadata(key); for (MetadataValue item : meta) { if (item.getOwningPlugin() == plugin) { return item.value(); } } return null; }
ea201992-8807-4292-a4db-9170e2e2bd97
1
protected LabelNode getLabelNode(final Label l) { if (!(l.info instanceof LabelNode)) { l.info = new LabelNode(l); } return (LabelNode) l.info; }
61998554-651f-45b5-b88f-ec42b7ab976f
2
public GUI() { if (!checkResources()) { JOptionPane.showMessageDialog(null, "Unable to start GUI. Missing icons.", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } MapReader mr = new MapReader(); maps = mr.readMaps(); if (maps.si...
d5167fcf-a064-4844-8280-ae5e9aa1b258
3
private static int[] mergeSort(int[] list) { if (list.length == 1) { return list; } int len = list.length; int leftLen = len / 2; int middle = len - leftLen; int[] left = new int[leftLen]; int[] right = new int[middle]; for (int i = 0; i < leftLen; i++) { left[i] = list[i]; right[i] = list[i + ...