method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6ae89cc6-aed1-4124-9950-dd94e395eeb9
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...
632dc37d-2315-4ccb-b3ac-deaecc678b66
2
public IntegerAggregate getDistanceBetween(Integer start, Integer finish) { if (start > maxStart || finish > maxTarget) { logger.warning("Invalid request, out of range (from: " + start + " to: " + finish); throw new IndexOutOfBoundsException("Unable to find value for " + start + " -> " + finish); ...
91e4c03f-97ac-4f27-a983-9a053354c8a7
1
public static boolean isAssault(int s) { if(s==53057) return true; return false; }
886492d3-51a1-4dff-9629-7f5414409281
0
public void init() { this.window = new PWWindow(this.project); }
6cf36ff3-e59e-4a16-bf12-183884fb2890
2
@Override public Statement createNewChild(TreeMap<String, String> properties) { Statement statement = new Statement(); statement.setName(properties.get(NAME)); statement.setDate(Utils.toCalendar(properties.get(Statement.DATE))); statement.setAmount(Utils.parseBigDecimal(properties.ge...
52d9f311-1fb1-4d94-96bb-9b6262c4e2c0
2
public PayloadException(Node node) throws XPathExpressionException { String provider = Utilities.selectSingleText(node, "./dc:DataProvider", XMLLabels.STANDARD_NAMESPACES); if(Utilities.isNullOrWhitespace(provider)) { this.provider = Contributor.findContributor(provider); } Node subjectNode = Utilities...
b15d8c0a-f3ad-456c-a0ef-0e635077d739
5
public static void setActive(Block block, boolean state) { if (!isApplicable(block)) return; TileEntityBeacon beacon = (TileEntityBeacon) ((CraftWorld) block .getWorld()).getHandle().getTileEntity(block.getX(), block.getY(), block.getZ()); Field active = null; try { active = TileEntityBeacon.class.ge...
dcfc52fe-ed36-484b-ae4c-1f7e750e3c7a
5
private static boolean removeDirectory(File directory) { String[] list = directory.list(); if (list != null) { for (int i = 0; i < list.length; i++) { File entry = new File(directory, list[i]); if (entry.isDirectory()) { if (!removeDirector...
5268ac46-a233-42d2-bc9b-f97919f651ff
2
public synchronized String convertByteToHexString(byte[] raw){ String hexString=""; for(int i=0;i<raw.length;i++){ String hex=Integer.toHexString(raw[i]); if(hex.length()<2){ hex="0"+hex; } hex=hex.substring(hex.length()-2); hexString=hexString+hex; } return hexString; }
340814e2-4576-4946-a647-98eb81163004
3
void update(Move m) { if (m != null) { int index0 = (m.getCol0() - 1) + 8 * (8 - m.getRow0()); int index1 = (m.getCol1() - 1) + 8 * (8 - m.getRow1()); if (((JPanel) _gameboard.getComponent(index1)).getComponentCount() > 0) { ((JPanel) _gam...
308e2a3d-a2f8-469d-a26c-0ed8b4072b6e
0
public void testWrite() throws Exception { byte[] data = FileUtils.readWithNIO("g:\\test\\t.txt"); FileUtils.write(data, "gbk", "g:\\test\\tgbk.txt"); FileUtils.write("可我忘了中华人民共和国", "utf-8", "g:\\test\\t2utf-8.txt"); FileUtils.write("d中中中中中".getBytes(), "g:\\test\\t2utf-8.txt", true); FileUtils.writeWithNIO("...
acfd2331-8afb-45fa-9942-dc5eec5284b9
7
public static int PretvoriCharUInt(String in){ if (in.length() == 4){ // mora biti jedan od ovih if (in.charAt(2) != 't') return (int)('\t'); if (in.charAt(2) != 'n') return (int)('\n'); if (in.charAt(2) != '0') return (int)('\0'); if (in.charAt(2) != '\'') return (int)('\''); if (in.charAt(2) != '"...
28b9b5a6-64cf-4e10-a1cf-6d67adfe05ff
9
private static double[] calculateErrorSurfaceReAnnealing(){ // Prepare output file FileWriter outFile; try{ outFile = new FileWriter("surf_reanneal.txt"); }catch(Exception e){ System.out.println("ERROR! Couldn't open surf_reanneal.txt"); ...
475b9dab-8900-47ca-a67e-1efb54cfa13e
2
public void update() { if (shouldRender) { HUDArea hudArea = null; for (int i = 0; i < hudAreas.size(); i++) { hudArea = hudAreas.get(i); hudArea.update(); } } }
ab9f8b4e-9ff6-470d-a1c3-d82450c6629c
9
public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { Options opt = new Options(); CmdLineParser cmdParser = new CmdLineParser(opt); cmdParser.setUsageWidth(80); try { cmdParser.parseArgument(args); if (opt.arguments.size() == 0) { System.err.println("w...
924ceef5-00dd-48a1-afd9-ede7f7091328
3
private QcTestStatus toTestStatus(String strStatus) { QcTestStatus status = null; if ("PASS".equals(strStatus)) { status = QcTestStatus.PASSED; } else if ("FAIL".equals(strStatus)) { status = QcTestStatus.FAILED; } else if ("SKIP".equals(strStatus)) { status = QcTes...
a791b15b-3efd-4ce4-84cc-0bd6c4153b54
2
private void jTextFieldCommercialCpKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldCommercialCpKeyReleased try { List<projetrf.model.Ville> vv1 = RequetesVille.rechercheVilleByCp(jTextFieldCommercialCp.getText().trim()); jComboBoxCommercialVille.re...
9a5734b0-578d-4344-b685-acca4d207e2c
3
public static short toShort(Object object) { if (object instanceof Number) { return ((Number) object).shortValue(); } try { return Short.valueOf(object.toString()); } catch (NumberFormatException e) { } catch (NullPointerException e) { } r...
55316880-29e5-4662-858a-27d8f74cf821
2
@Override public void put( ByteBuffer out, T[] v ) { if (v == null) { out.put( Compress.NULL ); } else { Compress.putIntUnsignedNullable( out, v.length ); for (int i = 0; i < v.length; i++) { ref...
d8f89f4f-eecd-410f-a27e-f4ef213b68e6
4
private static void writeByteFile(Path path){ DataOutputStream dataOut=null; try { //apertura del stream. StandardOpenOption.CREATE->si el fichero no existe se crea dataOut = new DataOutputStream(Files.newOutputStream(path, java.nio.file.StandardOpenOption.CREATE)); for ...
064d21bf-555a-463a-8607-09d8397bcf87
3
public int[][] getGrayLevels() { if (image == null) return new int[0][0]; int[][] grayLevels = new int[getHeight()][getWidth()]; for (int i = 0; i < grayLevels.length; i++) for (int j = 0; j < grayLevels[i].length; j++) { int rgb = image.getRGB(...
5354d683-8f0c-4349-a466-9ed84b2085ad
2
public Complex standardError_as_Complex() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } Complex standardError = Complex.zero(); Complex[] cc = this.getArray_as_Complex(); standardError =...
2188d149-9c94-45d6-8f7a-8d5ef8b7347d
6
public static String[] args(String line){ if(line.indexOf("(") == -1 || line.indexOf(")") == -1) return line.split(","); String tmp = line.substring(line.indexOf("(")+1 , line.lastIndexOf(")")); //preserve string arguments Array<String> str= new Array<>(); while(tmp.contains("{") && tmp.contains("}")){ ...
5230bd55-f885-4f24-8b3f-70ddb6ce3d19
2
public static boolean allAlive(QueryThread t[]) { boolean status = true; for (QueryThread th : t) { if (th.isAlive()) { status = false; break; } } return status; }
3bc268da-91ff-46a8-9be6-e92d1d4caad1
5
public synchronized Serializable jvnInvalidateWriter() throws JvnException { System.out.println("invalidate writer with state : "+STATE+" sur l'objet "+joi+" "+System.currentTimeMillis()); if(STATE != STATE_ENUM.RWC && STATE != STATE_ENUM.W){ STATE = STATE_ENUM.NL; } else{ wait_for_write = true; ...
79ac829b-aa29-4a1a-bee7-538f7f0b69a5
8
public static void circleAroundEnemyBaseWith(Unit explorer, MapPoint aroundThisPoint) { // System.out.println("$$$$ " + explorer.toStringShort() + " / " // + enemyBase.toStringLocation()); if (explorer == null || aroundThisPoint == null) { return; } // Define explorer action according to the last action ...
d35923b8-08b3-42e0-84ba-cc10e9145c57
4
public synchronized byte[] getData(){ byte[] data = new byte[length]; for(Integer offset : this.blocks.keySet()){ Block b = this.blocks.get(offset); if(b == null) continue; byte[] bdata = b.getData(); for(int i = 0; i < b.getLength() && offset + i < this.length; i++){ data[offset+i] = bdata[i]; ...
15ce3053-ef09-47d4-8517-a4459ff62ef1
9
public static void pprintStellaCons(Cons self, org.powerloom.PrintableStringWriter stream) { stream.print("("); Native.setIntSpecial(OntosaurusUtil.$PPRINT_INDENT$, ((Integer)(OntosaurusUtil.$PPRINT_INDENT$.get())).intValue() + 1); switch (self.length()) { case 0: break; case 1: On...
a080c918-2514-43d1-b0ea-d7d1a940368f
9
private void placeHold(){ //PlaceHoldRequest(Integer hid, Integer bid, String callNumber, Date issuedDate, Connection con) { //TABLE: HoldRequest(hid, bid, callNumber, issuedDate) boolean quit; String hold; String bid; String searchMethod; //BorrowerModel b = new BorrowerModel(...
cb45f85d-f8c4-4d6d-9776-8c0b3e21e684
2
private void saveDefaults(CommentedYamlConfiguration configuration, ConfigNode[] defaultNodes) throws IOException { for(ConfigNode node : defaultNodes) { configuration.set(node.getNode(), node.getDefaultValue()); List<String> comments = node.getComments(); if(!comments.isEmpty()) configuration.addComment...
2f179918-9bb0-45bc-b5c4-668f9d6b75a4
6
@Override public String toString() { String s=""; Precision p=getPrecision(); if(p.compareTo(Precision.YEAR)<=0) { s+=String.format("%04d", year); } if(p.compareTo(Precision.MONTH)<=0) { s+=String.format("-%02d", month); } if(p.compareTo(Precision.DAY)<=0) { s+=String.format("-%02d", day); } ...
6f01c7d7-7b2a-45ca-9fa3-7ebbcaa585fd
5
public double messageFactor2Node(int factor, int node, int value) { double result = 0; if (factor == node) { return potentials.potential(node, value); } else if (factor == potentials.chainLength() + node -1) { // left factor n' -> f -> n for (int v = 1; v <= potentials.numXValues(); v++) { result +...
5f0360d7-384b-4a71-8297-2cc92af8b2a1
9
public static String soundex(String s) { char[] ca = s.toUpperCase().toCharArray(); StringBuilder res = new StringBuilder(); char c, prev = '?'; // Main loop: find up to 4 chars that map. for (int i = 0; i < ca.length && res.length() < 4 && (c = ca[i]) != ','; i++) { // Check to see...
2cbc481f-07a3-4350-8cac-064a6127056f
4
public BinarySearchTreeNode<T> getPredecessorNode() { /** * Case 1: Node has left child * If a node X has a left child, then node X's predecessor node is the * maximum value of the left child node (i.e., you perform the maximum * operation on that left child). The result of performing the maximu...
8bb9c856-4ae6-40f9-ba3e-c8041a56a788
5
public static void become(Automaton dest, Automaton src){ dest.clear(); // Copy over the states. HashMap map = new HashMap(); // Old states to new states. Iterator it = src.states.iterator(); while (it.hasNext()) { State state = (State) it.next(); State nstate = new State(state.getID(), new Poin...
3a638b84-979b-41da-be76-ff5a35970d59
4
@Override public boolean hasNext() { // if not initialized, initialize it first. if (this.currentElementItr == null) { if (this.currentListItr.hasNext()) { // have lists this.currentElementItr = this.currentListItr.next() .i...
e25ffc81-387f-43c5-a844-bad96ecbe8ed
9
public int think(Board board, int depth) { // Initialization nodesSearched = 0; qsearched = 0; abortSearch = false; timeStarted = System.currentTimeMillis(); useFixedDepth = (depth != 0); if (!useFixedDepth) { timeForThisMove = handler.getTimeForThi...
231966ba-31af-4e0b-b15b-1aae61454773
7
public int trap(int[] A) { if(A.length<3) return 0; int[] maxL = new int[A.length]; int[] maxR = new int[A.length]; int max = A[0]; maxL[0] = 0; for(int i =1;i<A.length-1;i++){ maxL[i] = max; if(max<A[i]) max =A[i]; } max = A[A.length-1]; maxR[A.length-1] = 0; for(int i = A.len...
a55bf3d3-4cf1-4401-bf46-c110d81f9fb4
2
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D gg = (Graphics2D) g; int w = getWidth(); int h = getHeight(); if (bgImg != null) { int imgW = bgImg.getWidth(); int imgH = bgImg.getHeight(); if ((float)w/h < (float)imgW/imgH) { int tw = h * imgW/ imgH...
afb6ffeb-04c7-4564-9697-1ed294dffad5
5
private boolean isTypeFlavor( ConnectionFlavor flavor ) { if( flavor.equals( ExtendsConnection.EXTENDS ) ) { return true; } if( flavor.equals( ImplementsConnection.IMPLEMENTS ) ) { return true; } if( flavor.equals( AssoziationConnection.ASSOZIATION ) ){ return true; } if( flavor.equals( Compositi...
46c4de5e-7e4e-4e25-a527-a0760ce931c3
0
public void mouseReleased(MouseEvent event) { }
fa5f1d5e-a84d-415a-bb6c-0cfdaa162891
5
public static List<Map<Integer, Double>> getUniqueTopicMaps(List<Bookmark> userLines, boolean resource) { List<Map<Integer, Double>> resMaps = new ArrayList<Map<Integer, Double>>(); for (Bookmark data : userLines) { int resID = resource ? data.getWikiID() : data.getUserID(); Map<Integer, Double> rMap = null; ...
607ac048-99cb-46bb-966b-eeadd55b54ca
0
@Override public void setWorkingDay(String workingDay) { super.setWorkingDay(workingDay); }
1501a15f-a0ed-4621-8e2d-60dd789a1e69
6
@Override public void run() { while(this.running) { if(!this.transitionsToPersist.isEmpty()) { try { this.dbConnection.persistTransitionStoreEntry(this.transitionsToPersist.poll()); } catch (ConnectException e) { System.err.println("Cannot persist TransitionStore Entry " + e.getMessage())...
c0f0021f-e49a-48ba-82be-40493f4f8d12
5
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { Player player = (Player) sender; if (cmd.getName().equalsIgnoreCase("update")) { if(player.hasPermission("EasyPvpKits.Admin")){ if(plugin.getConfig().getBoolean("options.auto-update")) { ...
9b0a9c70-520b-4417-9ad4-822ec6edbb9a
1
public Value getLocal(final int i) throws IndexOutOfBoundsException { if (i >= locals) { throw new IndexOutOfBoundsException("Trying to access an inexistant local variable"); } return values[i]; }
5a7826e6-1f7c-45c0-aadd-29e936f2fda8
9
public String simplifyPath(String path) { if (path == null || path.trim().length()==0){ return ""; } Stack<String> stack = new Stack<>(); String[] tokens = path.split("/"); for (String s : tokens){ s = s.trim(); if (s.isEmpty()){ ...
3022f21c-e935-4f2e-82d0-1b7d1e43492e
0
public void setSequence_Id(int sequenceId) { sequence_Id = sequenceId; }
fdf4ca91-d6d7-41d2-9df3-b3fad41761c2
2
public Board generateFromIntArray(char[][] input) { AState[][] map = new AState[input.length][input[0].length]; for(int rowNum = 0; rowNum < input.length; rowNum++) { for(int colNum = 0; colNum < input[rowNum].length; colNum++) { boolean block = input[rowNum][colNum] == 1; boolean start = input[...
7c101212-3838-4b89-80f3-b8194a29cda9
0
public boolean isHidden() { return hidden; }
185db41e-4b9b-4391-ac00-85bacc0b9e72
3
public void printSalesMenu() { System.out.println("Print by what?"); System.out.println("1:sale by product"); System.out.println("2:sale per category"); System.out.println("3:customer most purchase"); int input = scanner.nextInt(); switch (input) { case 1: System.out.println("Input Stock Number");...
da60925b-c96f-4a29-9f89-ecb37f21581a
7
public static PackageDescription fromString(String contents) throws IOException { PackageDescription d = new PackageDescription(); d.properties = ArrayListMultimap.create(); List<String> lines = CharStreams.readLines(new StringReader(contents)); String key = null; StringBuilder value = new StringBuilder(); ...
86a401ad-a809-4bc1-aafe-bcb239bc11d7
6
@Override public void keyPressed(KeyEvent e) { int delta_x = 0; int delta_y = 0; switch (e.getKeyCode()) { case KeyEvent.VK_LEFT: delta_x = -OFFSET; break; case KeyEvent.VK_RIGHT: delta_x = OFFSET; break; case KeyEvent.VK_UP: delta_y = -OFFSET; break; case KeyEvent.VK_DOWN: delta...
750f1496-a09a-482e-bea7-e3b657988ef0
7
private static String unescape(String input) { input = input.substring(1, input.length()-1); StringBuilder buffer = new StringBuilder(); for (int i = 0; i < input.length(); i++) { char c = input.charAt(i); if (c == '\u005c\u005c') { c = input.charAt(++i); ...
c45db104-0f79-44d3-9d7f-67134ce5d3a6
1
public WeightedQuickUnion(List<ConnectedPair> connectedPairs) { init(connectedPairs.size()); sizes= new int[connectedPairs.size()]; setSize(connectedPairs.size()); for (ConnectedPair pair : connectedPairs) { connect(pair.getFirst(), pair.getSecond()); } }
7c409b06-de99-4144-953e-4a5696b69743
4
@Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { int bookId; if (req.getParameter("bookId") ==""){ bookId=0; } else { bookId=Integer.parseInt(req.getParameter("bookId")); } HttpSession session = req.getSession(...
3f653cfa-5443-4581-a4f1-5aef62d35924
4
public String getRoadActionChar(ArrayList<Integer> start, ArrayList<Integer> end) { if (start.equals(end)) { return ""; } for (int i = 0; i < m_Roads.size(); i++) { if (m_Roads.elementAt(i).getStart().equals(start) && m_Roads.elementAt(i).getFinal().equals(end)) { ...
e7e6be56-61a0-48fc-9ff6-96eee439e5e5
4
public static boolean check_type_exist(Type_table type_table, String name) { if (name.equals("integer") || name.equals("boolean")) return true; for (int i = 0; i < type_table.type_name.size(); i++) { if (type_table.type_name.get(i).toString().equals(name)) { retur...
f30383b1-759f-427b-9248-953d83dd1d83
6
public static <T> boolean isConsistent(T[] ... data) { if (data != null) { int m = data.length; if (m > 0x00) { if (data[0x00] != null) { int n = data[0x00].length; for (int i = 0x01; i < m; i++) { ...
652d4eaf-4d2f-4b19-b50e-d1d83eb4a2b3
0
public int getNonMin(int i){ return nonPeakHr[i].get(12); }
c7d43e88-8001-4b33-9b29-c54b075153db
9
private void selectImageSizing() { int oldValue = thumbSize; if (imageSizeX < THUMB_MIN && imageSizeY < THUMB_MIN) { realImgPath = ImageBrowser.projectName + "\\thumbs\\" + image.image_id + "_" + THUMB_MIN + ".jpg"; thumbSize = THUMB_MIN; } else if (imageSizeX < THUMB_SMA && imageSizeY < THUMB_SMA) { ...
be9da255-5d83-4a86-90c8-9c9a2dc53258
9
public ArrayList<Event> getPlayerEvents(String playerName, ArrayList<Event> events) { ArrayList<Event> playerEvents = new ArrayList<Event>(); // Get all events that are performed by, or on a specific player. for (int i = 0; i < events.size(); i++) { Event currentEvent = events.get(i); if (currentEvent.ge...
dbef273e-7678-4858-b653-f76d713eb386
0
private Address(String addressType) { this.addressType = new SimpleStringProperty(addressType); this.streetName = new SimpleStringProperty(""); this.cityName = new SimpleStringProperty(""); this.stateName = new SimpleStringProperty(""); this.zipCode = new SimpleStringProperty(""); this.country = new Simple...
d6b2da65-2064-4c42-8c80-1693ceba4b6b
5
public boolean metodoCompare(Pessoa u ){ { if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome()) && this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha()) &&this.instituicao.equals(getInstituicao())){ return true; } return false; } }
75c2025a-fa8c-434c-9a43-be5864695aa9
1
@Override public BufferedImage draw() { BufferedImage image = new BufferedImage(Chunk.getPixelLength(), Chunk.getPixelLength(), BufferedImage.TYPE_INT_ARGB); Graphics2D gI = image.createGraphics(); drawGround(gI); drawBoundaries(gI); if (village != null) { drawVillage(gI); } return image; ...
d241bdad-6103-427f-ba71-055b1fc3db56
8
public void accept(final Player player) { final Player other = (Player) player.getTemporaryAttributtes().get("clan_request_p"); if (other != null && (Boolean) other.getTemporaryAttributtes().get("accepted_war_terms") == Boolean.TRUE) { CoresManager.slowExecutor.submit(new Runnable() { @Override public vo...
b5077ee3-16c0-4cc0-85a2-cbecd9d329fb
3
public boolean anyEmpty() { if(inA.getText().equals("") || inB.getText().equals("") || inC.getText().equals("")) { return true; } else { return false; } }
8238ae71-e7b3-451d-94e8-10822ebcfb2f
0
public Tetrahedron (double hight, double edge, double area, double summ){ // первый конструктор this.hight = hight; this.setName("Прав.Тетраэдр."); this.edge = edge; this.area_surf = area; this.summ = summ; this.area = 1.732*edge*edge; this.volume = edge*edge*edge...
995a369e-086a-4cf7-a280-2646b08b90f9
8
private static boolean getCodeNonRootedTrees(String consensusType, String OutgroupRoot, int nofOutgroup) { if (consensusType.equalsIgnoreCase("MRe")) { partCodeG = ""; } else if (consensusType.equalsIgnoreCase("Strict")) { partCodeG = "C\n"; } else if ...
b8ce89f6-d368-4aa7-82ee-7c3821f2ac11
0
public void setDesc(String desc) { this.desc = desc; }
4e070cf3-c3ac-478f-aa52-2876bff0614d
9
private void outputFileBtnPress() { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(TrainView.this); if (returnVal == JFileChooser.APPROVE_OPTION) { outputFile = fc.getSelectedFile(); outputLbl.setText(outputFile.getName()); } ...
37f9950c-7b04-4b49-a395-0615dc4f6704
5
public void GenerateIcons() { icons = new ImageIcon[1]; icons[0] = new ImageIcon(new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR)); Graphics g; Graphics2D g2; Color transparent = new Color(0, 0, 0, 0); try { g = icons[0].getImage().getGraphics()...
b1aafdd7-87ed-4032-a4ad-7848168ceaa2
5
public void advance() throws HDLException { if (!hasMoreTokens()) HDLError("Unexpected end of file"); try { switch (parser.ttype) { case StreamTokenizer.TT_NUMBER: tokenType = TYPE_INT_CONST; intValue = (int)parser.nval; ...
04ca193f-f685-4246-abb9-2a491b1e4b5a
8
public void cadastraTarefa(String nome, String descricao, String data, String hora) { try { tarefasEmAberto.add(new Tarefa(nome, descricao, data, hora)); } catch (NomeNullException e) { try { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(e.getMessage(), e.getMessage())); ...
246aa32f-e9ba-4441-bd89-ea749b2d1a56
6
public void addPegs(){ //Initialize the array of 15 Pegs pegArray = new Peg[15]; for (int i = 0; i < pegArray.length; i++){ pegArray[i] = new Peg(); } //Initialize the amount of pegs on the board pegCount = 14; //Set bounds and positioning for the Pegs to be displayed on screen int row...
6946142b-3de5-44a5-b8b6-e68d28af5dba
5
private void handleSelectionKey(SelectionKey key) throws IOException { if ((key.readyOps() & SelectionKey.OP_CONNECT) == SelectionKey.OP_CONNECT) { boolean ok = channel.finishConnect(); System.out.println("[Client] Finished connecting to " + channel.getRemoteAddress() + (ok ? " successfully" : " failure")); ...
ac3c1fd0-fbce-4e1f-a27e-fbcb83446183
4
private void createAddRecipeBatch(Statement stmt, Recipe recipe) throws SQLException, DataStoreException{ List<RecipeSection> sections = recipe.getSections(); List<Ingredient> ingredients = retrieveAllIngredients(); stmt.addBatch("INSERT INTO recipes VALUES ('" + escapeQuotes(recipe.getName()) ...
414611ef-7406-40b3-b43d-bec8155d3a1e
2
private boolean osuukoRaajatMasuun(ArrayList<Raaja> raajat, Vartalo masu){ for (Raaja raaja : raajat){ double px = raaja.getKarjenXkoordinaatti(); double py = raaja.getKarjenYkoordinaatti(); if (osuukoPisteVartaloon(px, py, masu)){ return true; } ...
56594caf-fdcd-4aaa-813a-ed015e8b35e9
1
@Test public void filtersByPublisherWorks() { citations.add(c1); filter.addFieldFilter("publisher", "Otava"); List<Citation> filtered = filter.getFilteredList(); assertTrue(filtered.contains(c1) && filtered.size() == 1); }
d50a4a16-20aa-4beb-9842-1a09096e5215
7
public SolveState(Level l){ long start = System.currentTimeMillis(); gLayers.add(new Layer_Maze()); final ArrayList<Point> exits = new ArrayList<>(); final ArrayList<Teleporter> tels = new ArrayList<>(); l.getEntitys().doForAll(new editAction<Entity>() { @Override public void action(Entity o) { if...
931d6888-a7cd-4285-ad3e-49aba798c8c4
4
public void drawPages() { // loop through pages for (int i = 0; i < pages.size(); i++) { // load the page Page p = pages.get(i); try { g2d.setTransform(identity); } catch (NullPointerException e) { } // check if page is being shown if (p.getVisible()) { ...
3b59b440-03a2-4511-b776-8e5119700397
7
public void getGridGraph(mxAnalysisGraph aGraph, int numColumns, int numRows) { if (numColumns < 0 || numRows < 0) { throw new IllegalArgumentException(); } mxGraph graph = aGraph.getGraph(); Object parent = graph.getDefaultParent(); int numVertices = numColumns * numRows; Object[] vertices = new Obj...
225249aa-ee8f-414d-9014-b0a08fa4955e
8
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset, int options) { // Lots of error checking and exception throwing if (source == null) { throw new NullPointerException("Source array was null."); } // end if if (destination == null) { throw new NullPointerExcep...
6765149a-ffed-4935-ba0a-4b9a4dfa5243
8
private void InsertarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InsertarActionPerformed // TODO add your handling code here: if(!(Producto.getText().equals("")&& Cantidad.getText().equals("") && Precio.getText().equals("") && Marca.getText().equals("") && Descripc...
712d6fbb-0e75-4315-ab16-7e2b2a7a05d0
0
public synchronized void reset() { this.bytes = 0; this.reset = System.currentTimeMillis(); this.last = this.reset; }
7018a799-1c58-4107-905c-63fd2ba1d3c6
8
private void setOpts(cell darwin){ boolean visifier = false; String[] names = new String[]{"Age", "Fade", "Mat", "Born", "Survives", "WolfRule", "Orient", "Mirror", "Any", "All", "Dir","Xfact", "InMode"}; for(int concount = 0; concount< names.length; concount++){ visifier = darwin.getControls(names[concount]); ...
33a6b656-a1d4-407b-b88f-84687f6291c7
4
public void validate(final Object paramValue, final Object value) throws IllegalArgumentException, IllegalStateException { if (paramValue instanceof String) { isEqualToString(paramValue, value); } else if (paramValue instanceof Integer) { isEqualToInteger(paramValue, value); } else if (paramValue instanc...
d2957a66-e8e7-4d49-9ec9-42ee15688d76
4
public String toString() { String str = "["; for (int i = 0; i < matrix.length; i++) { for (int j = 0; j < matrix[i].length; j++) { str += matrix[i][j]; if (j < matrix[i].length - 1) { str += ","; } else if (i < matrix.lengt...
833e3bed-eb1b-4b29-bd45-0759b6214e12
7
public void addToTerritory(Territory t, Square s) { if (s == null || t.squares.contains(s) || s.piece != null) { return; } int row = s.row; int col = s.col; t.squares.add(s); if (col > 0) { addToTerritory(t, squares[row][col - 1]); } if (row > 0) { addToTerritory(t, squares[row - 1][co...
e3d86442-5936-4768-abd1-bb4508f694d6
0
public void setId(long Id) { this.Id = Id; }
7be41073-2562-478e-a56a-7e4e59954912
3
@Override public void run() { initializeLogger(); this.log.info("Message receiver started"); this.currentThread = Thread.currentThread(); this.log.info("Get current thread"); String line = null; while (true) { this.log.info("before readLine from inputMessageReceiver"); line = readLine(); this.log....
0d826156-b116-4dee-b219-db540c733684
1
public int Steps(int val) { if(val == 1) { return 1; } else { return (Steps(val -1) * val); } }
3ff8461b-c705-44d5-91ab-ca9c36035e28
4
private void closeQuery(ResultSet resultSet, PreparedStatement statement) { try { if (resultSet != null) { resultSet.close(); } if (statement != null) { statement.close(); } } catch (SQLRecoverableException e) { conn.resetConnection(e); } catch (SQLException e) ...
b7f1594f-b07e-4800-9934-da2a856b0e6a
2
final int[] initTT(int length) { int[] ttShadow = this.tt; // tt.length should always be >= length, but theoretically // it can happen, if the compressor mixed small and large // blocks. Normally only the last block will be smaller // than others. ...
f2053324-6bb4-46a7-8c0e-38ee8b7e116b
5
public boolean dump(Board board){ byte[] squares = board.getSquares(); PrintWriter out = writerOpen(); if (out == null) return false; for ( int i = 0; i < 128; i++ ){ if ( ( i & 0x88 ) == 0 ){ if ( ( i % 8 == 0 && i != 0) )out.println(); out.print(squares[i]); out.print(" "); } } out.close...
03a984c2-45ec-4874-8709-655c4c147823
7
public ListNode getIntersectionNode(ListNode headA, ListNode headB) { ListNode A = headA; ListNode B = headB; int lenA = 0; int lenB = 0; while(A!=null) { lenA++; A = A.next; } while(B!=null) { lenB++; B = B.next; } A = headA; B = hea...
50377bef-8fab-41fd-8dfc-181d19997953
2
public boolean put(int key, String value) { if(root == null){ LeafNode leaf = new LeafNode(key,value); root = leaf; return true; } else{ InfoNode infoNode = Add(key, value, this.root); if(infoNode != null){ InternalNode node = new InternalNode(); node.size = 1; node.children[0] = root; ...
56080fe8-709e-4bc4-8cae-f35ea24d1f2d
2
public static void deque(String queueName) { try { // Retrieve storage account from connection-string. CloudStorageAccount storageAccount = CloudStorageAccount .parse(storageConnectionString); // Create the queue client. CloudQueueClient queueClient = storageAccount .createCloudQueueClient(); ...
424c4792-4699-4ce1-a3c6-463214ecf173
0
public Color(int red, int green, int blue){ _red = red; _green = green; _blue = blue; }
e2389a1b-41e6-4896-a062-7356ddd71204
4
public List<ModelSubset> orderSubsetsInList(List<GameObject> list) { Comparator<ModelSubset> comp = new Comparator<ModelSubset>() { @Override public int compare(ModelSubset o1, ModelSubset o2) { if (o1.getMaterial().getTextureID()<o2.getMaterial().getTextureID()) return -1; if (o1.getMaterial()...