method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4f8637bb-cb00-45b6-a458-358526818745
8
private void processArguments(final String[] args) throws CommandException { log.debug("processing arguments: " + Strings.join(args, ",")); if (args.length == 0) { throw new CommandException("Command requires arguments"); } String sopts = "-:dcl"; LongOpt[] ...
f4b21650-eec7-4055-bc80-a2337f2cc17b
1
public void testGuid() { System.out.println("\n*** testGuid ***"); CycObjectFactory.resetGuidCache(); assertEquals(0, CycObjectFactory.getGuidCacheSize()); String guidString = "bd58c19d-9c29-11b1-9dad-c379636f7270"; Guid guid = CycObjectFactory.makeGuid(guidString); assertEquals(1, CycObjectFact...
15777916-e2b7-4bf8-b67d-595cbe84b796
2
private void getAuthTokenTest(String url, String usr, String pwd) { try { IAquariusPublishService client = AqWsFactory.newAqPubClient(url); Assert.assertTrue(client!=null); String token = client.getAuthToken(TestContext.User, TestContext.Pwd); Assert.assertTrue(token!=null && token.length()>0); ...
59b0c415-8fe2-4f58-810f-bbee48491dfd
8
public void paint(Graphics2D g2, Node item, Justification justification, Rectangle2D bounds) { final Font oldFont = g2.getFont(); if (background != null) { g2.setPaint(background); g2.fill(bounds); } if (borderPaint != null && borderStroke != null) { ...
51c4cc70-3085-4b1c-830c-7d5469fe1c9c
6
private void setSchedule(int userID) { String[] startTimes = new String[7]; String[] endTimes = new String[7]; String startDate = ""; String endDate = ""; int k = 0; DatabaseConnection db = new DatabaseConnection(); Connection conn = db.connectToDB();...
a2c39e7e-accf-4d5b-aa4c-ae83713a8468
4
@Test public void getTopicsRatios() throws Exception { this.portfolio.openCorpus("MISS"); this.portfolio.openViewpoint("446d798e240d4dee5a552b902ae56c8d"); for (Portfolio.Viewpoint.Topic t : this.portfolio.getTopics()) { assertTrue(t.getRatio(0)<1); assertTrue(t.getRatio(1)==0); } this.portfolio.toggleTopic( ...
f770a92f-9f36-4872-a1e2-55922b052830
6
private void applyGravity() { for (int i = 0; i < planets.size(); i++) { for (int j = i + 1; j < planets.size(); j++) { planets.get(i).applyGravitationalAttraction(planets.get(j)); } planets.get(i).applyGravitationalAttraction(ship); for (int a =...
ee8a57ad-3a25-4d43-bdc5-f25c8d9a5cf1
4
public void actualizarSeccion(String seccion, int index){ switch(index){ case 1: _LblGrupo1.setText(seccion); break; case 2: _LblGrupo2.setText(seccion); break; case 3: _LblGrupo3.setText(seccion)...
4b560e1e-ca83-4175-a0e3-3bb8b1ab365b
6
private static boolean isNativeMethod(String line) { line = line.trim(); // what if 'native' appears in a comment return !(line.startsWith("//") || line.startsWith("*")) && // comments? line.contains(" native ") && // native qualifier line.contains(";") && line.contains("(") && line.contains(")") && // ...
72529f82-a14d-41e5-8a34-a642e0f4eab2
4
public static void LoadSpawn() { localFile = new File("spawn.dat"); String line; BufferedReader br; try { br = new BufferedReader(new FileReader(localFile)); try { // Read in spawn coordinates, only 3 numbers separated by spaces line = br.readLine(); ...
6f470512-6508-4eed-b8d9-e32ebf616bb7
0
public int getNumberOfPoints(){ return numberOfPoints; }
3877a715-96ed-4c1a-8f57-41022607136e
1
public OSCPacket convert(byte[] byteArray, int bytesLength) { this.bytes = byteArray; this.bytesLength = bytesLength; this.streamPosition = 0; if (isBundle()) { return convertBundle(); } else { return convertMessage(); } }
52305245-bfcd-438e-bb21-5b275999a1a1
0
public Integer getNumeroColegiado() { return numeroColegiado; }
69ea8298-3f8d-4b08-a712-92cbda6b9369
5
public static void main(final String[] args) throws IOException, ServiceException, InterruptedException { if (args.length != 3) { System.err.println("arguments: picasaUser albumName freemapAuthKey"); System.exit(1); } final PicasawebService myService = new PicasawebService("freemapPhotoImporter"); final ...
5751834f-1af5-42a7-96c3-0efd44ebec63
1
private void processMoveToKingPile(MouseEvent e) { int index = (int) (e.getY() / (CARD_Y_GAP + CARD_HEIGHT)); if (index < 4) { activeMove.cardReleased(index, CardMoveImpl.MOVE_TYPE_TO.TO_KING_PILES); String result = activeMove.makeMove(game, this); processMoveResult(r...
68d1d905-659c-4a1d-822f-9bad8ca3b9f5
2
public int getY() { if(this == DOWN) return 1; if(this == UP) return -1; return 0; }
3936534b-a92e-4578-ad14-b27adde9060c
6
@Override /** * Fügt dem Baum einen Wert hinzu * */ public void addValue(Integer value) throws BinarySearchTreeException { if (root == null) { //Wenn es noch keinen root Knoten gibt, erzeuge diesen mit dem hinzuzufügenen Wert root = new Node(value); //...
a9a346bf-88e0-4c0c-abad-8d698c7ae0d6
2
public static void loadFromFile() throws Exception{ String filename = "Girl.bin"; File file = new File(filename); FileInputStream fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis); try{ Object temp = ois.readObject(); if(temp.getClass().getName().equals("Girl")){ he...
cf862f8c-d716-4d3c-bf63-1ea1d01dacf5
0
@Override public void redo() { // Insert the Node parent.insertChild(node, index); node.getTree().insertNode(node); node.getTree().addNodeToSelection(node); }
e3674367-fb31-401f-916f-353e251a9de0
9
@Override public FTPResult handleResponse(FTPInterface inter, FTPResponse response) { if (response.getCode() == 211) { String[] features = response.getContent().split("\n"); if (features.length > 2) { int length = features.length - 1; for (int i = 1; i < length; i++) { String feature = features[i]...
e66b2be8-b778-47d0-aa6f-c40a570fbd2c
0
public void setCost(double value) { this.cost = value; }
c785a4c3-116c-4195-b722-9fb977a5bed2
8
public int similarity(String s1, String s2) { int[][] d = new int[s1.length()][s2.length()]; for(int i=0;i<s1.length();i++) { d[i] = new int[s2.length()]; d[i][0] = i; for(int j=0;j<s2.length();j++) { try { d[0][j] = j; } catch ( Exception ae){} } } for(int j=0;j<s2.lengt...
3e48c725-e2df-469a-b59c-99c3090e127a
5
public static void main(String[] args) { Scanner input = new Scanner(System.in); int start = input.nextInt(); int end = input.nextInt(); for (int i = start; i <= end; i++) { if (i < 10) { System.out.print(i + " "); } else if (i < 100) { if ((i / 10) == (i % 10)){ System.out.p...
9e691df9-9a92-40d9-9dff-10ac07603452
5
public static Map<String, List<String>> prepareArgs(String[] args) { Map<String, List<String>> preparedArgs = new HashMap<String, List<String>>(); List<String> values = null; String key = null; for (String arg : args) { if (arg.startsWith("--")) { key = arg.su...
32ca3010-75f5-45e3-920e-5bfa882f2042
9
@Override public void run(CommandSender sender, String maincmd, String[] args) { if (sender instanceof Player && !sender.hasPermission("mobmanager.butcher")) { sender.sendMessage(ChatColor.DARK_RED + "You do not have permission to use /mm butcher"); return; } if (!MMComponent.getLimiter().isEnabled()...
09036149-dded-4985-a867-3350f9259670
0
public TruncateHelper setWordDelimeterPattern(Pattern wordDelimeterPattern) { Assert.notNull(wordDelimeterPattern); this._wordDelimeterPattern = wordDelimeterPattern; return this; }
bc14e7e7-905b-45f4-b4ee-204863477ee3
8
@Override public ExpertiseDefinition findDefinition(String ID, boolean exactOnly) { ExpertiseDefinition D=getDefinition(ID); if(D!=null) return D; for(final Enumeration<ExpertiseDefinition> e=definitions();e.hasMoreElements();) { D=e.nextElement(); if(D.name().equalsIgnoreCase(ID)) return D; } ...
45d81079-566d-415a-b372-7c890210a5c9
9
public void checkForLoginRequests(List<ServerWorker> w) throws IOException { ServerWorker wLogin = null; if (!pendingConnections.isEmpty()) { Iterator<Entry<NetworkStream, Long>> entrySetIterator = pendingConnections.entrySet().iterator(); while (entrySetIterator.hasNext()) { Entry<NetworkStream, Long> e...
4d0789ab-9730-4525-bf5f-af417b22745f
2
public static Short stoShort(String str){ Short i=0; if(str!=null){ try{ i = Short.parseShort(str.trim()); }catch(Exception e){ i = null; } }else{ i = null; } return i; }
2cf49587-aefc-45f3-822e-22db5308107f
6
public static Cons yieldRelationParametersTree(NamedDescription self, boolean dropfunctionparameterP, boolean typedP) { { Cons parameterlist = Stella.NIL; Stella_Object parameter = null; { Symbol pname = null; Cons iter000 = self.ioVariableNames.theConsList; Surrogate ptype = null; ...
7f96d71c-2f91-45ad-9777-f135e900c280
7
public int[] compile(String[] commandsArray) throws Exception { int commandNr = 0; int commandsIntArray[] = new int[MAX_CS_SIZE]; for (int i = 0; i < commandsArray.length; i++) { if (commandsArray[i].trim().equals("")) { continue; } else { CmdWithVar cmd = recognizeStringCommand(commandsArray[i], i)...
3592d7f1-8256-4fdf-9897-72a8458cb54b
0
public int getTEAM() { return team; }
a72aaf59-f549-4e44-83e7-d52cb8f2ca5b
7
private String get(String id) { if (id.equals(UserColumn.ACCOUNT_ID)) { return account_id; } else if (id.equals(UserColumn.ROLE)) { return role; } else if (id.equals(UserColumn.LOGIN_ID)) { return login_id; } else if (id.equals(...
d42a54c7-a484-4614-a1e9-85455ae1ca1b
7
private void calcTime(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { // Stores the current time. int secondsPlayedOld = secondsPlayed; // Increments the time based on delta. time += delta; secondsPlayed = time/1000; // If it's been one second. if (secondsPlayed - secondsPlay...
9510bfdf-50a2-4283-92f8-86a756b0ffa6
1
public ClassInfo getClassInfo() { if (classType instanceof ClassInterfacesType) return ((ClassInterfacesType) classType).getClassInfo(); return null; }
3e9688ed-784c-4826-ac3e-ec6d5a1a73d3
1
public List<ForeignKey> foreignKeys() throws SQLException { List<ForeignKey> result = new ArrayList<ForeignKey>(); ResultSet rs = statement.executeQuery(getFKStatement); while (rs.next()) { ForeignKey foreignKey = new ForeignKey( rs.getString(1), ...
6d547599-234c-45a8-b0d8-cd27451e0140
2
public String GetPlayedWeek(String profileId) throws Exception { String gamesString = loadGames(profileId, "games?tab=recent"); List<String> games = parseGamesData(gamesString, "hours"); float total = 0; for (String str : games) { try { total += Float.parseFlo...
1d038a16-3562-4a71-830a-4701c873c7e1
1
private Date getDOB() { Date DOB; int dayOfBirth = getDayOfBirth(); int monthOfBirth = getMonthOfBirth(); int yearOfBirth = getYearOfBirth(); String dateToValidate = String.format("%d.%d.%d", dayOfBirth, monthOfBirth, yearOfBirth); List<ValidateException> validateExcepti...
bd9d3de1-02fc-4927-8efa-8ad23bd5137d
7
public Expr Add_Expr() throws ParseException { Expr e, et; Token tok; e = Mul_Expr(); label_24: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case ADD: case SUB: break; default: ...
cfebb306-8560-48c8-81bd-a2fb21427012
2
public void send(Object oo){ try { if(this.running){ out.writeObject(oo); out.flush(); } } catch (IOException e) { e.printStackTrace(); } }
7e02e91a-7e64-4a3c-89d8-b2128ec35410
7
public void randomGrid() { Random rand = new Random(); /* resetGrid(); int b = rand.nextInt(dim*dim); barrierPositions = new boolean[dim*dim]; for(int i = 0; i < b; i++) { barrierPositions[rand.nextInt(barrierPositions.length)] = rand.nextBoolean(); } repaint(); */ resetGrid(); nodeMap = new Node[dim*dim];...
04ee7492-92e5-4d82-bafa-fb144c2253ef
0
@Override public String notation() { return this.from.toString() + "x" + this.to.toString() + " e.p."; }
1190dc19-3a4b-41e4-89a0-b8cc052ff4d0
0
@Override public void setReceiveQuery(IReceiveQuery receiveQuery) { this.receiveQuery = receiveQuery; }
3d9e0f46-ad14-48af-80d2-9e3809d22b54
0
private void initView() { setGridColor(Color.lightGray); TableColumn column = getColumnModel().getColumn(0); // column.setCellRenderer(column.getHeaderRenderer()); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setBackground(new Color(200, 200, 200)); column.setCellRenderer(ren...
1073d9e8-26ad-4a96-99c2-b604663363d3
8
public SSLConnection(CM_Stream chanmon) { cm = chanmon; com.grey.naf.SSLConfig sslcfg = cm.getSSLConfig(); int peerport = (cm.iochan instanceof java.nio.channels.SocketChannel ? ((java.nio.channels.SocketChannel)cm.iochan).socket().getPort() : 0); engine = sslcfg.isClient ? sslcfg.ctx.createSSLEng...
c73843ea-d724-499c-a1e4-fe5ff7073e82
4
private void movePieceCheck(Piece piece, int x1, int y1, int x2, int y2, Position start, Position end, String command, String startSpot, String endSpot) { String currentTurnColor = whitePlayerTurn() ? white : black; if(board.getChessBoardSquare(x2, y2).getPiece().getPieceColor() != (piece.getPieceColor())) {...
c0e21394-8013-4ad6-9ed9-c71df07475ee
7
public static void refreshMarketOfferList(String serverID, String nymID) { Map marketList = null; Map offerList = null; try { // DEBUGGING: this is where the next step happens marketList = Market.loadMarketList(serverID, nymID); offerList = Market.getNymOfferL...
6eeccdcc-df52-4c04-9f9c-a80fe07ac704
8
@Override public void run(ImageProcessor ip) { ImageStack stack = imp.getStack(); float[][] slicePixels; int dimension = ip.getWidth() * ip.getHeight(); int sx = ip.getWidth(); int sy = ip.getHeight(); int sc = imp.getNChannels(); int sz = stack.getSize()/sc; ...
3b2b98e3-809b-4c65-93a2-5104560e7022
7
private String calculateStringToSignV2(Map<String, String> parameters, String httpMethod, String hostHeader, String requestURI) throws SignatureException { StringBuffer stringToSign = new StringBuffer(""); if (httpMethod == null) throw new SignatureException("HttpMethod cannot be null"); stringToSign.ap...
27b710cb-aa72-4ea4-8fa5-6dce7b51c2bd
0
public IrcException(String e) { super(e); }
bf805ad3-a603-4440-ba00-caff99f33d5d
4
private void defineStartSaveHistory() { saveHistory = new Thread(new Runnable() { @Override public void run() { while (true) { while (revising) { sleep(10); } String text = textLower.getText(); if (!TEXT_HISTORY.contains(text)) { TEXT_HISTORY.push(textLower.getText()); ...
1b6ee5f9-cb82-4f13-bdae-259414d23bae
4
public void die(){ if (actors != null) actors.remove(this); if(ParticleSystem.isEnabled()) for(ParticleGenerator<? extends Particle> particleGenerator : particleGenerators) ParticleSystem.removeGenerator(particleGenerator); }
d7dbeecf-24a3-4f89-a26f-2921874a40f3
9
@Override public GistUser deserializeUserFromJson(String json) { JSONObject userJO = null; try { userJO = (JSONObject) parser.parse(json); } catch (ParseException e) { return null; } GistUser user = new GistUser(); Object temp = null; ...
a15180ac-25c8-486b-a66c-3512574f7852
1
public void visitInsn(final int opcode) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitInsn(opcode); } }
dd7b29c4-c268-4011-99af-66633d4058b8
2
@Override public Command receive() { System.out.println("Receive ..."); final byte[] buffer = new byte[K.SIZE]; DatagramPacket data = new DatagramPacket(buffer, buffer.length); Object o = null; try { m_multicastSocket.receive(data); o = Utils.toObject(data.getData()); } catch (ClassNotFoundException ...
ea337e26-87d6-4628-addb-9e33c9db29a6
6
@Override public void execute() throws ParseException { DBManager mng = DBManager.getDBManager(); Schema removeSchema = mng.getSchema(this.tableName); Table removeTable = mng.getTable(this.tableName); if (removeSchema == null || removeTable == null) { throw new ParseException("No table called "+this.table...
b7389b01-71b3-47ee-a618-58612ddf2b8a
6
public Graph(String[] s, int[][] m){ int n = s.length; if(m.length != n || m[0].length != n){ System.out.println("Dimension does not match, exit!"); System.exit(0); } for(int i=0;i<s.length;i++){ vertexList.add(new Vertex(s[i])); } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(m[i][j...
4f029d8a-c101-438f-bd29-f7d45c5bb0e3
4
public void viewExampleOProperties(String filename) { Document doc = (Document) session.getObjectByPath("/" + filename); List<Property<?>> properties = doc.getProperties(); for (Property<?> p : properties) { if (p.getFirstValue() == null) { Syste...
1bb9950f-2af9-4316-89fe-0320288cf6f3
5
public String buscarClientePorApellidoPaterno(String surname1){ //##########################CARGA_BASE DE DATOS############# tablaDeClientes(); //##########################INGRESO_VACIO################### if(surname1.equals("")){ surname1 = "No busque nada";...
b375535d-a32f-44da-bf49-bf9020043a17
6
private void addQualifierSchemaNodes(Set<Class<? extends Enum<?>>> qualifiers, ObjectNode props) { for (Class<? extends Enum<?>> qualifier : qualifiers) { ObjectNode inner = JsonNodeFactory.instance.objectNode(); // inner.put("type", "string"); props.put(factory.getAttributeNa...
9c9762a5-2328-4f9e-bfc0-f5e18580765e
9
protected short[] union(short[] itemSet1, short[] itemSet2) { // check for null sets if (itemSet1 == null) { if (itemSet2 == null) return(null); else return(itemSet2); } if (itemSet2 == null) return(itemSet1); // determine size of union and dimension ...
b42b2f19-cdf1-4111-853f-1329110fd82d
2
public void setLocaleButtonPosition(Position position) { if (position == null) { this.localeBtn_Position = UIPositionInits.LOCALE_BTN.getPosition(); } else { if (position.equals(Position.NONE)) { IllegalArgumentException iae = new IllegalArgumentException("Positi...
28255dc1-4627-4ec0-ac38-c0ead5178a9f
1
public void setValueOfOutPut(int pData){ if (_logicaCompuerta == "IN") _ValorOutPut = pData; else System.out.println("Por seguridad solo es permitido cambiar el resultado de logica a las compuertas de InPut"); }
ed777a86-e643-4e13-8f1a-c12fcf06d9ae
5
public static void dispose() { Iterator<String> it = resources.keySet().iterator(); while (it.hasNext()) { Object resource = resources.get(it.next()); if (resource instanceof Font) ((Font) resource).dispose(); else if (resource instanceof Color) ((Color) resource).dispose(); else if (resource ...
419825ab-0c4c-4614-883f-5ffc52d03ada
6
public static final int encryptMessage(int streamOffset, int messageDataLength, byte[] streamBuffer, int messageDataOffset, byte[] messageData) { int i = 0; messageDataLength += messageDataOffset; int i_19_ = streamOffset << 309760323; for (/**/; messageDataOffset < messageDataLength; messageDataOffset++)...
81065f57-de21-42a0-af7e-64425bba8ab8
1
Parser(Converter converter) { if (converter == null) { throw new RuntimeException("cannot convert."); } this.converter = converter; }
2fa26a84-96fa-40e7-bc40-6a13f67407b6
4
private int findMinBinarySearch(int[] num, int start, int end) { if (start == end) return num[start]; if (end - start == 1) { return Math.min(num[start], num[end]); } else { // end - start > 1 int mid = (start + end) / 2; if (num[mid] < num[start]) { ...
d25b1457-505d-4cbd-9ea5-b9913d29834f
4
public MazeMaker() { try { newMap = JOptionPane.showConfirmDialog(null, "Do you want to create a new map?", "New Map", JOptionPane.YES_NO_OPTION); } catch(Exception e) { System.exit(0); } if(newMap == JOptionPane.YES_OPTION) { try { borderedMap = JOptionPane.showConfirmDialog(null, "Do you want ...
a935530c-d664-41d5-af97-e510c1a5b04f
5
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed String userName = txtFieldUserName.getText(); char[] pw = txtFieldPassword.getPassword(); String password = new String(pw); userName.trim(); password.trim(); if...
e9099735-92e7-4a5e-a35b-c7810bf67010
3
public void open( boolean readOnly ) throws ReadOnlyException, IOException { // Resource cann be double-opened! if( this.isOpen() ) throw new IOException( "Processable resources cannot be double opened." ); if( !readOnly ) throw new ReadOnlyException( "This BufferedResource implementation only ...
c983ea44-0a58-4fd7-a0e9-4d4ff1a2ef9a
7
public static String newValue() { JOptionPane jp = new JOptionPane("Input"); String value = jp.showInputDialog(null, "Enter value (Type #D (Decimal), #B (Binary), #O (Octal), followed by a value.\n\tDefault base is Hex."); // If the user does not enter anything, returns "ERROR". if...
8b7d287d-d33e-482e-a481-619db4a4cb1e
8
static public void awaitOn(Condition c) { MultithreadedTestCase thisTestCase = currentTestCase.get(); if (thisTestCase != null && thisTestCase.failed) throw new RuntimeException("Test case has failed"); if (skipNextWait.get()) { skipNextWait.set(false); return; } try { c.await(3, TimeUnit.SECONDS...
d7d138ab-4229-40f0-a5cd-5fa9d0b8df17
3
public Color lastStanding() { int size, i; Color last = null; for (size=0, i=0; i<playersNo; ++i) { if (players[i].isFinished() == false) { ++size; last = players[i].getColor(); } } if (size == 1) return last; return null; }
e0a0d800-0fd6-4f4b-801d-62f3c7e31351
7
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { String elementName = localName; if ("".equals(elementName)) { elementName = qName; } System.out.println("element: " + elementName); if (elementName.equals("booklist")) { if (bookList ==...
d75ecf31-3a52-45b0-8a16-618abad4da7e
8
public Infix2Postfix(String exp){ String str = ""; infixExp = exp; stack = new Stack<String>(); for (int i=0;i<infixExp.length();i++){ /* * If the character is a letter or a digit we append it to the postfix * expression directly. */ str = infixExp.substring(i,i+1); if(str.matches(...
c72b95a8-b9a8-4062-ac0c-88836cda7fa2
3
public void visitSelector(Selector node, String args){ for (int i =0; i< node.getChain().size(); i++){ if(node.getChain().get(i).getClass().getName().compareTo("ast.IdentSelector")==0){ pp("."); ((IdentSelector) node.getChain().get(i)).getIdent().accept(this, args); } else if(node.getChain().get(i).g...
11680765-9406-4579-abfa-1e676b2f1b3c
4
protected void moveRight() { if (this.posX < (BattleBotsGUI.instance.xDim-1) && !(this.posY == this.enemyPosY && (this.posX+1) == this.enemyPosX) && !(BattleBotsGUI.instance.obstacles[this.posX+1][this.posY])) { this.posX++; } }
00f186bb-6244-4558-a27b-fc7432743a81
7
public void setOptions(String[] options) throws Exception { String tmpStr; tmpStr = Utils.getOption('T', options); if (tmpStr.length() != 0) setAttributeType(new SelectedTag(tmpStr, TAGS_TYPE)); else setAttributeType(new SelectedTag(Attribute.NUMERIC, TAGS_TYPE)); tmpStr = Utils.ge...
f59ac618-929d-4387-a23f-b238f02f8ec5
3
public void matchSubscriptions(Message message) { try { List<Subscription> subscriptions = this.parent.getSubscriptionByTopic(message.getTopic()); for (Subscription subscription : subscriptions) { try { System.out.println("Enviando mensaje a: " + subs...
396b37e6-c2ea-40c9-996d-c4f9ef615edd
2
public List<Organism> GAstep_mutation() throws Exception { /* mutation */ List<Organism> mutatedOrganisms = new ArrayList<Organism>(); for (int i = 0; i < this.getSpeciesNumber(); i++) { mutatedOrganisms.addAll(species.get(i).mutation(getGenerationNumber())); } /** ...
37dc5ba1-0e6a-4841-b823-d595c2594dcb
5
private boolean checaTipoVariavelGlobal(String tipoDoRetorno) { if(!listaVariveisGlobais.isEmpty()){ for(int i = 0; i< listaVariveisGlobais.size();i++){ String tipoVariavel; String nomeVariavel; if(listaVariveisGlobais.get(i).split(":")[1].equals("vetor")){ ...
7aa3f73d-6d38-474b-b8ca-7f8a399a6469
7
private int resolveDayUnit( String unit ) { if ( unit.equalsIgnoreCase("monday") ) { return TimeAxisUnit.MONDAY; } else if ( unit.equalsIgnoreCase("tuesday") ) { return TimeAxisUnit.TUESDAY; } else if ( unit.equalsIgnoreCase("wednesday") ) { return TimeAxisUnit.WEDNESDAY; } else if ( unit.equalsI...
95d0e9ec-6870-43fa-ba1b-6addac06d2b7
4
public boolean isFullFilled() { boolean isFilled = true; boolean aId = idActivity >= 0; boolean sTime = startTime != null; boolean eTime = endTime != null; boolean dur = duration >= 0; if (!aId) isFilled = false; if (!sTime) isFilled = false; if (!eTime) isFilled = false; if (!dur) isFilled = fa...
3124854b-af15-4b45-855d-45c2cc746977
8
public boolean equals( Object other ) { if ( ! ( other instanceof TObjectIntMap ) ) { return false; } TObjectIntMap that = ( TObjectIntMap ) other; if ( that.size() != this.size() ) { return false; } try { TObjectIntIterator iter = this...
4b1638a8-788e-45bb-a1ee-4853ca22026e
6
static void combine_sort(int l,int m,int h,int num[]) { int i,j=m+1,k;int temp[]=new int[10]; for(i=l;i<=h;i++) { temp[i]=num[i]; } i=l;k=l; while(i<=m && j<=h) { if(temp[i]<=temp[j]) { num[k++]=temp[i++]; } else { num[k++]=temp[j++]; } } while(i<=m) { num[k++]=tem...
622c0c56-d84e-455c-b294-b6caa8bae496
7
public static void updateSelectedRow(JTable table, Container controlsContainer) throws Exception { int selRow = table.getSelectedRow(); DefaultTableModel tableModel = ((DefaultTableModel)table.getModel()); if (selRow > -1) { int compCount = controlsContainer.getComponentCount(); ...
4c0892ab-49d9-4951-82a2-a76652071f8c
2
protected void onSaveKey() { File[] fileNames; FileDialog dlgSave = new FileDialog( this, "Save keystore...", FileDialog.SAVE ); dlgSave.setFile( "*.ks" ); try { this.readDataToKeyInfo(); this.lblStatus.setText( "Choose file name..." ); dl...
2b90ec21-6bfb-4604-b6b0-9b3ddee89914
0
@Test public void testUnion() { assertThat(uf.connected(0, 1), is(not(true))); uf.union(0, 1); uf.union(0, 2); assertThat(uf.connected(0, 1), is(true)); assertThat(uf.connected(1, 2), is(true)); }
9fe72d42-5214-4fb6-bed8-a9a19507b2a2
4
@Override public boolean activate() { return (!Inventory.isFull() && Settings.root.getRoot() == 3 && !Inventory.contains(Constants.INVENTORY_BURNED_ROOT_ID) && !validate(Constants.WAITFOR_WIDGET) && !validate(Constants.FLETCH_WIDGET) ); }
f97e7188-cdcd-45cc-bd35-ad8b68326a0e
4
public void setPaused(boolean paused) { if (this.paused != paused && sequencer != null && sequencer.isOpen()) { this.paused = paused; if (paused) { sequencer.stop(); } else { sequencer.start(); } } }
60207e31-1f99-4160-95b3-f9d8652d975e
5
@Override public boolean onMouseDown(int mX, int mY, int button) { if(button == 0 && mX > x && mX < x + width && mY > y && mY < y + height) { Application.get().getHumanView().addScreen(ShopScreenFactory.create()); return true; } return false; }
dd23ab48-6b41-488c-a90f-507d2b486da4
9
public boolean remove(int value) { // Knuth, v. 3, 527, Algorithm R. int i = indexOf(value); if (_values[i] == ndv) { return false; } --_size; for (; ;) { _values[i] = ndv; int j = i; int r; do { ...
7447ecb4-0680-49df-ad01-6e8ae87f91aa
2
private void form_keyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_form_keyPressed if (evt.getKeyCode() == KeyEvent.VK_F5) try { reload(); } catch (IOException ex) { logger.log(level.ERROR, "Error while loading devices! Stack trace will be printe...
b2455cb6-be03-4648-b198-615b37ab9fd2
6
private static void estEntourerDeMurs(Labyrinthe l) throws LabyMalEntoureException { for (int i = 0; i < l.Xsize(); i++) { if (l.getContenuCase(i, 0) != ContenuCase.MUR) throw new LabyMalEntoureException(new Point(i, 0)); if (l.getContenuCase(i, l.Ysize() - 1) != ContenuCase.MUR) throw new LabyMalEnt...
ee9fd518-3d40-48fc-a4b9-b455f0c02a9e
5
public void update(GameContainer gc, StateBasedGame sbg, GameplayState gs, int delta) throws SlickException { for (Entry<Long, Tower> entry : this.towers.entrySet()) { entry.getValue().update(gc, sbg, gs, delta); } for (Entry<Long, Bullet> bullet : this.bullets.entrySet()) { bullet.getValue().update(gc, ...
b382598f-9730-4171-b3de-7f864d42b5c1
8
private int partition() { int center = (start + end) / 2; if (array[center] < array[start]) { swap(center, start); } if (array[end] < array[start]) { swap(start, end); } if (array[end] < array[center]) { swap(center, end); } ...
1e89addd-bac2-4cd2-9e84-a6b0f5fe6a46
1
@Override public ArrayList<Short> get(Integer... a) { ArrayList<Short> r = new ArrayList<Short>(); for (Integer i : a) { Object[] plain = huff.decode(filter[i/rate]); int index = i-(i/rate)*rate; r.add((Short)plain[index]); } return r; }
62651259-334b-4cf5-b668-c5549caca514
1
public int length() { int len = 1; Node n = this; while(n.next != null) { len++; n = n.next; } return len; }
027212b0-7c44-4256-aa29-9f8caaec9181
1
private void addPoint() throws NumberFormatException, IOException { double[] coordList = new double[dimensionList.length]; for (int count = 0; count < dimensionList.length; count++) { System.out.println("Enter " + dimensionList[count].toString() + "-coord:"); coordList[count] = Double.parseDouble(Wrapper.get...
654e9e2b-95e4-4c7a-a3f0-b99b9a971031
7
@Override public void renameProductContainer(ProductContainerData renamedContainer, String newName, int newIndex) { boolean disabledEvents = disableEvents(); try { ProductContainerTreeNode renamedNode = _productContainers.get(renamedContainer); assert renamedNode != null; if (renamedNode...