method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7a146113-4b6d-4525-8473-2b6006879633
0
public LocalDate getDepartureDate() { return this._departureDate; }
7bc8b75c-95ab-4cd8-8842-9b3dc5b607b8
7
public Protocol getProtocol(String Uri) { BufferedReader in = null; StringBuilder result = new StringBuilder(); String address = ""; System.out.println(Uri); Protocol testProto = null; try { String protocol; if (Uri.indexOf(':') == Uri.length() - ...
82013d7b-2d4c-4335-a800-f6bce75fa284
1
public List<String> getParser() { if (parser == null) { parser = new ArrayList<String>(); } return this.parser; }
dcce10dd-a76b-4819-9533-95e8e04ddd79
1
public static void printBuddies(Pair<? extends Employee> p) { Employee first = p.getFirst(); Employee second = p.getSecond(); System.out.println(first.getName() + " and " + second.getName() + " are buddies."); }
dbbc0145-314b-400f-828c-9bdf6d9fb338
7
public Date decodeTime(boolean implicit) throws Asn1Exception { // // There must be at least 2 bytes available // if (residualLength < 2) throw new Asn1Exception("Attempt to read past end of stream"); // // Validate the tag for an explicit value // ...
53314a9b-61bc-429f-8ae6-e40d99bae553
6
@Override public void actionPerformed(ActionEvent event) { if(event.getSource() == controller.addApplicantView.addButton) { try{ Applicant applicant = new Applicant(AddApplicantPanel.getInstance().dateSourcedCB.getDate(), AddApplicantPanel.getInstance().dateProcessedCB.getDate(), AddApplicantPanel.g...
f0adb851-6175-48c7-8f63-5c8fd8459ac2
3
private void initBrandingMenu(Color bg) { this.brandingMenu = new JPanel(); this.brandingMenu.setBackground(bg); this.brandingMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); // image Path path = this.skin.getBranding().getImage(Brandingsize.SMALL); final Imag...
b0bdafbd-1443-4163-b94e-637f33ec7b79
1
public boolean step() { // controller.step(); boolean worked = false; if (treePanel.next()){ stepAction.setEnabled(false); worked = true; } treePanel.repaint(); return worked; }
3e552e59-70c3-4691-af3f-955be8f18d75
5
protected void preroute(OutboundMessage msg, Collection<AGateway> gateways) { for (AGateway gtw : gateways) if ((gtw.isOutbound()) && (gtw.getStatus() == GatewayStatuses.STARTED)) { if (msg.getGatewayId().equalsIgnoreCase("*")) getCandidates().add(gtw); else if (msg.getGatewayId().equalsIgnoreCase(gtw....
28aa7a52-ad66-458c-86bd-3093edb5df4b
7
public LegendEntry(PlotData2D data, int dataIndex) { javax.swing.ToolTipManager.sharedInstance().setDismissDelay(5000); m_plotData = data; m_dataIndex = dataIndex; // this.setBackground(Color.black); /* this.setPreferredSize(new Dimension(0, 20)); this.setMinimumSize(new D...
e44006f2-deaf-4d1c-a117-b28a48bf57e1
7
public void paintPokeFont(Graphics g , String str, int x, int y, int size) { char[] chars = str.toCharArray(); Image[] letters = new Image[chars.length]; for (int i = 0; i<chars.length; i++) { URL url = Pokemon.class.getResource("Sprites/PokeFont/space.png"); if (Character.isLowerCase(chars[i]) && Char...
6c00c066-bdfc-448c-9977-919b3f8196f9
4
public double distanceSquared(Location o) { if (o == null) { throw new IllegalArgumentException("Cannot measure distance to a null location"); } else if (o.getLevel() == null || getLevel() == null) { throw new IllegalArgumentException("Cannot measure distance to a null level"); ...
2ad37e56-c91e-4833-8254-96479a9a719c
3
public void printTree(ArrayList<Board> parent) { ArrayList<Board> children=new ArrayList<Board>(); for (int i=0;i<parent.size();i++) { Board currParent=parent.get(i); if(currParent.children.size()==0) return; System.out.print("Parent : "); currParent.printGameBoard(); for (int j=0;j<cur...
ea24152c-4313-45ca-aa96-f98f9b331474
0
private static String getMethodName(){ return Thread.currentThread().getStackTrace()[3].getMethodName(); }
8e518a67-d676-4600-8ffd-c416b05ab8e8
0
private void exitScope() { symbolTable = symbolTable.getParent(); }
40769f25-6901-4b9f-bf44-75c319ef85ac
7
public ArrayList<Integer> getFriendsKthLevelRecursive(int userID, int k) { ArrayList<Integer> friends = new ArrayList<Integer>(); if (k == 1) { for (Integer friend : data.getUserFriends().get(userID)) { friends.add(friend); } return friends; } else { // Recursively call method to traverse the...
a60bfe92-eef0-4e6e-bd3d-0b53775f7626
8
@Override void vectorField(double t, double A[], double F[]) throws Exception { int i, j; int comp; double d, d2, d3; double TOL2 = this.paramTOL * this.paramTOL; for (i = 0; i < this.firstSpeedPos; i++) { F[i] = A[this.firstSpeedPos + i]; F[this.firstSpeedPos + i] = 0.; } for (i = 1; i < this.bo...
59fa7f3e-9556-454c-b940-42658c8e330d
4
public void setRoom(Room room) { if (room == null) { throw new IllegalArgumentException(); } if (this.room != null && !this.room.equals(room)) { throw new ReassignObjectException(); } if ( !room.exists(this)) { room.addRow(this); } this.room = room; }
e526e94e-ab64-49b5-a920-d8a1fd857303
1
public static void main(String[] args) { File file=new File("C:"); long totalSpace = file.getTotalSpace(); System.out.println("Total space on " + file + " = " + totalSpace + " bytes"); // Check the free space in C: long freeSpace = file.getFreeSpace(); System.out.println("Free space on " + file + " = " + f...
4e1412d9-028a-4eb4-a329-6791390fb478
6
@Override public void callAction(String args) { String perceptronName; System.out.print("Name of perceptron to dump: "); perceptronName = ui.inputToString(); Perceptron perceptron = ds.getPerceptron(perceptronName); if(perceptron == null) { ui.printToConsole("Error: There is no Perceptron named " + per...
a6d3c4cf-2b82-49bf-85e8-8af43b307418
2
private List<Escudo> selectEscudos(Juego juego){ List<Escudo> listEscudos = new ArrayList<>(); ForeignCollection<Escudo> escudos = juego.getEscudos(); CloseableIterator<Escudo> itEscudos = escudos.closeableIterator(); try { try{ while(itEscudos.h...
723b4806-3fe2-4189-9f47-42feae49d848
0
public static String initMacKey() throws NoSuchAlgorithmException { KeyGenerator keyGenerator = KeyGenerator.getInstance(KEY_MAC); SecretKey secretKey = keyGenerator.generateKey(); return base64Encoder(secretKey.getEncoded()); }
e23977f4-1ac6-4c71-b6c7-7cb75b2895f4
8
public boolean in3050(int a, int b) { if (a>=30 && a<=40 && b>=30 && b<=40) return true; if (a>=40 && a<=50 && b>=40 && b<=50) return true; return false; }
65d5314d-9bc2-492c-944b-ce82379d6836
1
@Override public int hashCode() { return players != null ? Arrays.hashCode(players) : 0; }
4ce2c3fa-106d-456f-aabb-94c69feeb7e2
5
public synchronized String format(LogRecord record) { StringBuilder sb = new StringBuilder(); // Minimize memory allocations here. dat.setTime(record.getMillis()); args[0] = dat; // Date and time StringBuffer text = new StringBuffer(); ...
b0b057d3-dd32-4b80-abd3-71bb88a01f68
3
protected void writeError(String toWrite, boolean severe) { if (toWrite != null && !toWrite.contains("Duplicate")) { if (severe) { this.log.severe(this.PREFIX + this.DATABASE_PREFIX + toWrite); } else { this.log.warning(this.PREFIX + this.DATABASE_PREFIX +...
909dbbff-3cb5-4d75-b82e-2dea42bb7c9c
0
boolean isConnected() { return _isConnected; }
a6956b51-ae4f-4d1f-91d6-8184053cf522
2
public void partUser(Client c){ for(int i = 0; i < usershere.size(); i ++){ if(c.equals(usershere.get(i))){ usershere.remove(usershere.get(i)); } } }
278ee2f7-dcb0-4e9a-9718-7484b0cca587
1
public void addToEnd(String value) throws AlreadyExist { ListElement current = new ListElement(value); if (count == 0) { head = current; } else { tail.connectNext(current); } tail = current; count++; }
420a4e87-9e3b-4cc5-a6b6-169af31199e7
9
public String translate(String source) throws Exception { String sourceContent = this.digContent(source); String[] content = StringUtils.splitByWholeSeparator(sourceContent, this.getLineSpliter()); LinkedHashMap<String, String> sourceHashMap = new LinkedHashMap<>(); for (String line : ...
8c262cf4-1d59-40ad-8c62-d89eb761cdce
0
public String getName(int skill) { return skillNames[skill]; }
1f1d09b8-7dcd-43c3-b64b-af954a93cf55
8
public static void shootArrow(String input) { try{ String direction = input.substring(6); // direction should be input after "shoot " part int dirNum = WumpusMap.directionNumber(direction); if (dirNum == 0) { System.out.println("Huh?"); // bad shoot direct...
75dba708-045e-4bf2-805c-8ece4c30f237
2
private Connection getConnection() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException e) { Utilities.outputError("Could not find sql drivers"); return null; } try { return DriverManager.getConnection( "jdbc:mysql://" + m_options.host + ":" + m_options.port + "/...
eb196bb4-ad36-41e3-b119-c76facc35b4f
9
public RoomSquare(Position position, int num) { this.position = position; this.roomnum = num; switch(roomnum) { case 1 : color = Color.decode("#F0F3EA"); break; case 2 : color = Color.decode("#F3DFF5"); break; case 3 : color = Color.decode("#F7CBCE"); break; case 4 : color = Color.decode("#F2F0C9"); b...
a812a6f6-d7cd-442c-a1fc-febeafa84e38
0
public double getWrapWidth() { return wrapWidth.get(); }
83932b05-e68c-4544-8a6f-eee989b9708b
1
public Form getLoginForm() { Form loginForm = new Form("Welcome to Police Mobile"); userName = new TextField("Police No", "", 30, TextField.ANY); password = new TextField("Password", "", 30, TextField.PASSWORD); login = new PCommand("Login", PCommand.SCREEN, PCommand.LOGIN, 2); ...
ec047c66-f117-48b4-9d57-5df9fe4ecb8b
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
67aa7766-220c-4277-bd88-feaa90787e31
2
public void genericMakeWhiteMove(Move move){ int r1 = move.initialRow; int c1 = move.initialCol; int r2 = move.finalRow; int c2 = move.finalCol; if((Math.abs(r2-r1)==2 && Math.abs(c2-c1)==2)){ CaptureBlackPiece(r1, c1, r2, c2); }else{ ...
1a5f0330-f171-4fc7-bd53-76092835c221
7
double evalCmp(MTuple tuple, Vector operands) throws SQLException { if(operands.size() < 2) { throw new SQLException( "MEval.evalCmp(): Trying to compare less than two values"); } if(operands.size() > 2) { throw new SQLException( "MEval.evalCmp(): Trying to compare more than two...
c6527450-b2df-4349-8687-ffac70507ac3
2
public void render(Graphics g, Coordinate c) { g.setColor(Color.black); double width = WorldPanel.getCurrent().getXBlockLength(); double height = WorldPanel.getCurrent().getYBlockLength(); switch (style) { case Display.VERTICAL: g.fillRect((int)(c.x + width / 2 - (WALL_WIDTH - 1) / 2), (...
969cfeb8-4e0d-4568-a257-819a1de68d0e
4
public int numOpenings(Background b) { final int nO = super.numOpenings(b) ; if (b == Background.VETERAN) { return nO + 2 + structure.upgradeLevel(SECURITY_MEASURES) ; } if (b == Background.TECH_RESERVE) { return nO + 2 + structure.upgradeLevel(LOGISTIC_SUPPORT) ; } if (b == Backgrou...
cd05ac6a-c22e-42d0-87d5-dedf890e2d0a
0
public void sendEmail(Account account, String msg){ account.sendEmail(msg); }
b46f123d-a610-47bd-b613-d9c7aa1e1951
6
protected void liefern(String bestandteilname) { Logger logger=Logger.getLogger("Arbeitsverlauf"); if(bestandteilname.equalsIgnoreCase("Arm")){ Arm bestandteil=new Arm(this.sekretariat.getBauTeilID()); //erstelle einen neuen Arm mit der vom Sektretariat vergebenen ID logger.log(Level.INFO, "Neues Teil an e...
4b493720-ebf0-4f79-9cb9-223e06691ada
3
protected void getFormulario(String ruta, PrintWriter out) { ServletContext context = getServletContext(); InputStream is = context.getResourceAsStream(ruta); if (is != null) { InputStreamReader isr = new InputStreamReader(is); BufferedReader reader = new BufferedReader(i...
d8aad872-b0f8-41fb-a6be-767f9eb78319
6
int unpack_info(Buffer opb){ version=opb.read(32); if(version!=0) return (-1); channels=opb.read(8); rate=opb.read(32); bitrate_upper=opb.read(32); bitrate_nominal=opb.read(32); bitrate_lower=opb.read(32); blocksizes[0]=1<<opb.read(4); blocksizes[1]=1<<opb.read(4); if((...
49818c0e-732b-4902-bfe5-9d3fcf345ca5
8
@Override public void actionPerformed(ActionEvent ae) { if (tree == null) { return; } Directory root = new Directory(tree.getRootFile()); //Validates String delim = validateDelimiter(delimiter.getText()); if (delim == null)...
d8088c32-cbd3-4408-967e-073baf17783a
8
@Override public boolean tick(Tickable ticking, int tickID) { if((affected==null)||(!(affected instanceof MOB))||(target==null)) return false; if(!super.tick(ticking,tickID)) return false; final MOB mob=(MOB)affected; if(mob.location()!=target.location()) unInvoke(); if(mob.getVictim()!=target) ...
76a5e88e-33f8-4a65-a447-f8697a25e46f
7
public void walk(File path){ File[] contents = path.listFiles(); for (File curFile : contents){ if (! Walker.getTerminate()) { try{ if (isValidDirectory(curFile)){ walk(curFile); } else if (isValidFile(curFile)...
12a12ee1-f295-49a8-b04d-70ad4609e5be
5
private void ShowAttackResultsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ShowAttackResultsButtonActionPerformed PreparedStatement ps = null; ResultSet rs = null; Connection conn = null; int i; try { if ((conn = JavaDBAccess.setConn()) != null) { Sys...
277c345f-88f4-4287-bebc-818fd6cf9c10
2
@Test public void getHeight(){ Tile[][] tiles = new Tile[15][10]; for (int x = 0; x < tiles.length; x++){ for(int y = 0; y < tiles[0].length; y++){ tiles[x][y] = new Tile(new Position(x, y), 0); } } World w = new World(tiles); assertTrue(w.getHeight() == 10); }
54596dda-fb11-49c0-8892-26d0c3eaf07f
6
public void run() { if (!parent.getConfig().getBool(Option.DisableEditDupeProtection)) { for (Entry<Player, CBlock> e : map.entrySet()) { Iterator<BlockDesc> i = e.getValue().getBlocks(); while (i.hasNext()) { Block b = Util.getBlockAtLocation(i.next().blockLoc); if (!Util.typeEquals(b.getType(),...
e717889c-7af1-4ef3-a4bf-e61a7d2b7299
8
public void ConnectfromFile ( String DataFolder ) { //Ƀt@C̈ʒu𓊂ƃt@C烉CtTCN𐶐 try { //t@C[_[ File file = new File ( DataFolder ); BufferedReader br = new BufferedReader ( new FileReader ( file ) ); //܂Ńt@C[_[ String str = "0" ; //ǂݎpString֐ kɂƎ~܂iOj int CountLine = 0; //sԍZϐiG[pj //ǂݍ݃...
5b5ee0ad-b2ef-4679-956e-7afe2ce9271b
6
@Override protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uri = request.getRequestURI(); if (uri.endsWith("/compras")) { if (Util.isEmpty(getData(request))) { response.sendRe...
6594ac25-8f40-4652-8ed7-bbbc1c627897
8
public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = Integer.parseInt(in.nextLine().trim()); int lo = -2000000000, hi = 2000000000; boolean pos = true; for (int i...
44a44249-73a5-4b14-b9af-adc336e4e8c2
0
public void setCategoryId(int categoryId) { this.categoryId = categoryId; }
8b55cd13-6849-45e6-83ee-d2f32990ee70
9
public void ping(String title, String[] data){ if(title.equals("key-data")){ this.textName.ping(title, data); this.textEarned.ping(title,data); this.textTotal.ping(title,data); } else if(title.equals("mouse-data")){ int x = (int)Double.parseDouble(data[0]); int y = (int)Double.parseDouble(data[1]);...
33d36196-229e-40b5-986b-e2ae077a7cfa
3
protected String removeHttpsProtocol(String html) { //remove https protocol from tag attributes if(removeHttpsProtocol) { Matcher matcher = httpsProtocolPattern.matcher(html); StringBuffer sb = new StringBuffer(); while(matcher.find()) { //if rel!=external if(!relExternalPattern.matcher(matcher.gro...
2945c9b6-9ff7-4378-bd17-da8b00fabec1
8
public void resize(int sx,int sy){ int ns = sx*sy; if (data==null || ns!=data.length){ if (ns>0) data=new int[ns]; if (ns==0) data=null; if (ns<0) throw new ArrayIndexOutOfBoundsException(ns); width=sx; height=sy; } if (offsets==null || offsets.length!=height) offsets=new int[heigh...
5ca6ce53-e95c-45af-a258-6fb42e45e2f6
7
public void render(Graphics2D g) { if (list.isEmpty()) return; Stroke oldStroke = g.getStroke(); Color oldColor = g.getColor(); Color color = ((MDView) model.getView()).contrastBackground(); int ex = 0, ey = 0, sw, sh, xc, yc; boolean b; String s; g.setFont(FONT12); for (Object o : list) { b = f...
a9f6c912-2e3d-40f7-86e0-30ef97b481cb
3
public void cargarClientes(){ try{ Connection conn = Conexion.GetConnection(); try { st = conn.createStatement(); cli = st.executeQuery("SELECT * FROM Clientes"); } catch (SQLException e) { JOptionPane.showMessageDialog(this,e.g...
344e05a9-d730-44a4-8574-50f3b82a9413
0
public void setjComboBoxSecteur(JComboBox jComboBoxSecteur) { this.jComboBoxSecteur = jComboBoxSecteur; }
91d00829-5a2a-4ef8-a1ed-423769eb6c90
5
static String getPlatformFontFace(int index) { if(SWT.getPlatform() == "win32" || SWT.getPlatform() == "wpf") { return new String [] {"Bookman Old Style", "Century Gothic", "Comic Sans MS", "Impact", "Garamond", "Lucida Console", "Monotype Corsiva"} [index]; } else if (SWT.getPlatform() == "motif") { return new ...
34cfc8c0-baae-496c-9867-1eb31f3414d0
6
public void setLightValue(int x, int y, float v) { if(v<0f || x < 0 || x >= blocks.length || y < 0 || y >= blocks[0].length) return; if(chunkID < 0) x = 15-x; lightValues[x][y] = v; this.lightChanges[x][y] = (int)lvl.ticks; }
588681a9-7b06-4930-a88e-279bafcd55f0
5
public String setHostname(String hostname) { if (hostname.length() == 0 || getHostname().contains(hostname)) return null; InetAddress ip; String hostnameAndIP = ""; boolean valid = false; try { ip = InetAddress.getByName(hostname); hostnameAndIP = hostname + String.format(" (%s)", ip.getHostAddress()...
417f0628-df1d-4b53-a626-0fdd8c7b1d94
3
public Document asDocument() throws WeiboException { if (null == responseAsDocument) { try { // it should be faster to read the inputstream directly. // but makes it difficult to troubleshoot this.responseAsDocument = builders.get().parse(new ByteArray...
8fa9eebb-e9ba-459c-a56a-221f4582e1cd
2
public void setDef(final Expr expr, final Def def) { if (SSAPRE.DEBUG) { System.out.println(" setting def for " + expr + " to " + def); } if (def != null) { defs.put(expr, def); } else { defs.remove(expr); } }
4b75b432-8f63-4ba2-8750-c513da62b7da
0
public void calcLocation(float dT){ calcVelocity(dT); SimpleVector dLocation = new SimpleVector(this.velocity); dLocation.scalarMul(dT); translate(dLocation); }
7aaa3f3f-e3be-4b74-b7c5-c0df69ec5600
1
public Place registerPlace(Place place) { int index = places.indexOf(place); if (index == -1) { addPlace(place); return place; } return places.get(index); }
1de4754c-e69f-4e89-a766-7347a20ac5da
3
public Position<T> SearchNodeRec(Position<T> root, T value) throws InvalidPositionException { if (root == null) return null; BTPosition<T> BTroot = checkPosition(root); T currentV = BTroot.element(); if (currentV == value) return BTroot; if (comp.compare(currentV, value) > 0) return SearchNodeR...
8a45ae7c-3c3d-48b6-9896-7d0bdc83584e
8
private void generate(int[] x, int index) { for (int a = 10; a >= 0; a--) for (int b = 10; b >= 0; b--) for (int c = 10; c >= 0; c--) { if (a + b + c == x[index] && isValid(a, b,c)) { if (getMax(a,b,c) >= P) { if (...
2f3e8b71-40cf-48cf-8ab9-56571c7e0f40
6
private void valid(int year, int month, int day) throws AxisWithoutMeaningErrorException { if (year < minYear || year > maxYear) { throw new AxisWithoutMeaningErrorException(); } if (month < minMonth || month > maxMonth) { throw new AxisWithoutMeaningErrorExce...
910b90ac-5c3b-4a15-af2b-525416f8f90c
3
@Override public double[] get3DData(int px, int py, int pz, int sx, int sy, int sz) { double[] da = a.get3DData(px, py, pz, sx, sy, sz); double[] db; if (a == b) db = da; else db = b.get3DData(px, py, pz, sx, sy, sz); int s = sx*sy*sz; for(int i =...
5f81b626-2e96-47f0-a7f9-af482c6a0984
7
private static void addCustomHandlers(UriHttpRequestHandlerMapper registry) { Reflections reflections = new Reflections(); log.info("Scanning for Custom Handlers"); Set<Class<? extends Object>> subTypes2 = reflections.getTypesAnnotatedWith(CustomHandler.class); for (Class<? extends Object> class1 : subTypes2) {...
10f3e522-36e4-4893-9e85-fab18b1d4cdb
0
public void setCheckEnd(int checkEnd) { _checkEnd = checkEnd; }
794494ed-20e8-427d-a162-79c4f52afd35
8
private void createBottom(Composite self) { self.setLayout(new FillLayout()); CTabFolder folder = new CTabFolder(self, SWT.TOP | SWT.BORDER); folder.setLayout(new FillLayout()); folder.setSimple(false); // Apply tab theme/style folder.setSelectionForeground(titleForeColor); folder.setSelectionBackground(n...
c81e384f-e1f8-4a6a-b816-233545207f7e
0
public void info(final String msg) { }
c390d760-ccaa-4522-96b9-63b0102efe68
1
double VectorNorm(double[] v) { double sum = 0; for (int i = 0; i < v.length; i++) { sum += Math.abs(v[i]);//*v[i]; } return sum;//Math.sqrt(sum); }
222d4bde-7eed-4e97-a7ce-d8fb30634a7c
6
private Object handleVers(Object tos) { if ((tos instanceof Generator && ((Generator)tos).getVersion() == null) || (tos instanceof GedcomVersion && ((GedcomVersion)tos).getVersion() == null) || (tos instanceof CharacterSet && ((CharacterSet)tos).getVersion() == null)) { return new Fie...
97c7ff22-833b-4e14-a3af-790c82c3d9f7
5
private void convertMultipleTextTags(List<GedcomTag> gedcomTags) { Iterator<GedcomTag> iter = gedcomTags.iterator(); GedcomTag prevTag = null; while (iter.hasNext()) { GedcomTag tag = iter.next(); if ("TEXT".equals(tag.getTag())) { if (prevTag != null && "TEXT".equals(pre...
b37f3e43-786c-4748-8226-3d976a2ab8e4
3
public BooleanOperator getBooleanOperator(String string) { char[] chars = string.toCharArray(); for(char c : chars) { if(c == '&') return BooleanOperator.AND; else if(c == '^') return BooleanOperator.OR; } return BooleanOperator.AND; }
230842f5-cca1-456c-91d8-daac5712fe4f
0
public void setStreamStart(Calendar newStreamStart) { streamStart = newStreamStart; }
c27ae0bb-1d51-4c82-a5e9-ab3cd9856670
2
public void dispose() { if(frame != null && frame.isVisible()) { frame.dispose(); } }
d815e3ae-95b5-4ead-9686-0913030f2559
1
public static void main(String[] args) { try { Thread r2 = new Thread (new VentanaProceso("Nproceso")); // r1. start (); r2.start (); } catch (Exception e) { e.printStackTrace(); } }
1bdb2bad-f5d2-4210-aacd-2f0996d13534
4
public Start() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (UnsupportedLookAndFeel...
4fc09154-da17-412b-b00f-7d78fbd52c7b
1
private static Animacion crearAnimacionPelota() { Animacion anim = new Animacion(); for (int i = 0; i <= 20; i++) { anim.sumaCuadro (Toolkit.getDefaultToolkit ().getImage (Pelota.class.getResource ("Images/ball/basketball" + i + ".png")), 60); } return anim; }
5d47fba3-f6e7-47df-bd2e-ecb7c36fd50b
3
public <T> List<T> readValueFromJsonStringToList(String response, Class<T> clazz) { try { return OBJECT_MAPPER.readValue( response, TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, clazz)); } catch (JsonParseException e) { log.error("{}", e); } catch (JsonMappingException e) { ...
3d3e59df-4604-4ba0-a62b-3204889682d6
9
public void convertChannelToHtml(XmlPullParser parser, XmlSerializer writer) throws IOException, XmlPullParserException { // <!ELEMENT channel (title | description | link | language | item+ | rating? | image? | textinput? | copyright? | pubDate? | lastBuildDate? | docs? | managingEditor? | webMaster...
b47d5f05-3f42-4565-b40b-1d59fd158d09
5
public Double columnMax(int col) { if (!isContinuous(col)) { throw new MLException("Cannot calculate the max of a non-continuous column"); } boolean allUnknownValues = true; Double max = Double.MIN_VALUE; for (List<Double> row : data) { double val = row.ge...
252f1cc8-24d7-450c-820a-e09d9a349026
8
@Test public void testAIWhatFinishLineWith2EnemyMarkInNisxodyawDiagonal() { Field field = new Field(); RulesOfGameAndLogic rog = new RulesOfGameAndLogic(field); field.eraseField(); int rand = (int)(Math.random()*2); int randINotSetCell = (int)(Math.random()*2); for (...
bcdd2f74-1273-4e94-a214-03f01616d830
6
public CellHandle[] getCells() { BiffRec[] cells = mysheet.getCells(); CellHandle[] retval = new CellHandle[cells.length]; Mulblank aMul = null; short c = -1; for( int i = 0; i < retval.length; i++ ) { try { if( cells[i].getOpcode() != XLSConstants.MULBLANK ) { retval[i] = getCell( cells...
60a94551-7607-4015-9f89-90109d9409db
3
public int getAliveNum(){ int tankAlive = 0 ; for(Enemy e : this.enemyList){ if( e.getStatus() == Tank.ALIVE || e.getStatus() == Tank.SLEEP) tankAlive ++ ; } this.totleKilledThisStage = this.enemyList.size() - tankAlive ; return tankAlive ; }
b0168276-f4ed-4824-a921-7e81045edb5f
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
89ba7fc6-025a-49d2-b45c-cc9ff47bb834
2
@Override public boolean update(Object item) { conn = new SQLconnect().getConnection(); String sqlcommand = "UPDATE `Timeline_Database`.`Timenodes` SET `time_weight`='%s', `time_description`='%s' WHERE `id`='%s';"; if(item instanceof Timenode) { Timenode newitem = new Timenode(); newitem = (Timenode)item...
ddbe9681-efdf-4eff-91c2-bab3f334d6b7
5
public void checarCEPZipCode(String num){ if(num.length() != 9){ System.out.println("invalido"); return; } if(!(num.contains("-"))){ System.out.println("invalido"); return; } String parte1 = num.substring(0, 5); String digito = num.substring(5, 6); String parte2 = num.substring(6, 9); if((...
39a6a443-16de-4192-a80e-2d492082c457
1
public boolean canHaveAsBalance(BigInteger balance) { return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0); }
63f6ef8c-33f2-49d4-8c9c-c114cf7f91fe
2
public void use(){ if(open){ if(!loot.isEmpty()){ loot(); }else{ open = false; setTexture("res/objects/chest.png"); Game.UI.renderLootDialog = false; } }else{ open = true; setTexture("res/objects/emptyChest.png"); loot(); } }
89b013bf-72c9-4d6b-8429-fb2bd916897a
7
public List<PlayerAccount> DBListAccounts(String mask) { DBConnection D=null; PlayerAccount account = null; final Vector<PlayerAccount> accounts = new Vector<PlayerAccount>(); if(mask!=null) mask=mask.toLowerCase(); try { // why in the hell is this a memory scan? // case insensitivity from databas...
ef6380d2-1240-424e-a62b-6f56f2b5d5ee
4
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { e.printStackTrace(); } ToolTipManager.sharedInstance().setDismissDelay(10000); String settingsFileName = null; for (int i = 0; i < args.length; i++) { if (arg...
79807e40-3183-4157-a916-2dba6f956d8e
6
private void checkCollision() { for (Body b : list) { for (Body b1 : list) { int oldBodies = this.bodies; if (list.indexOf(b) != list.indexOf(b1) && isCollision(b.getCentre(), b.getRadius(), b1.getCentre(), b1.getRadius())) { if (b.getMass() > b1.getMass()) { b.setMass(b.getMass() + b1.getMass()...
bddafd1d-b994-43da-a23e-fea5088f6a59
2
public void inc(int start, int end) { for( int i = start; i <= end; i++ ) if( count[i] < Short.MAX_VALUE ) count[i]++; }