method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ad8c4c95-c342-4911-b3bc-713092ff5c11
4
@Override public PartnerRole getTypeByName(final String name) throws WrongTypeNameException { if (name == null) { throw new WrongTypeNameException("Type name is empty"); } switch (name) { case CREATOR_ROLE_NAME: case SPONSOR_ROLE_NAME: case PAR...
eaa3d907-1732-45cc-9423-ef893138f41b
7
protected boolean checkCoverage() { int i; int n; int[] count; Range r; String attrIndex; SubspaceClusterDefinition cl; // check whether all the attributes are covered count = new int[getNumAttributes()]; for (i = 0; i < getNumAttributes(); i++)...
a25e4a79-e713-4e31-beda-f3c5a5b88b8a
3
public void insymbol() { try { nextSymbol = scanner.yylex(); } catch (java.io.FileNotFoundException e) { System.out.println("File not found : \"" + fileName + "\""); } catch (java.io.IOException e) { System.out.println("IO error scanning file \"" + fileName + "\""); System.out.println(e); } catch (E...
543df3fc-80e7-4b84-a84d-af0cc33afb5a
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Atendente)) { return false; } Atendente other = (Atendente) object; if ((this.id == null && other.id != null) |...
e93a2ce2-bfe2-4fab-9788-7ef32b49e085
1
private void checkEnd() { if (end) { throw new IllegalStateException("Cannot call a visit method after visitEnd has been called"); } }
73f6e8c0-156c-4798-8d9e-e88fc054bfbf
3
public World getCmdWorld(CommandSender sender, String args) {if (args==" ") {if (sender instanceof Player) {return Bukkit.getServer().getPlayer(sender.getName()).getLocation().getWorld();} else {sender.sendMessage(ChatColor.RED + "Needs World Argument!");return null;}}World world = Bukkit.getServer().getWorld(args);if ...
6ff640d5-9659-4cdd-ab8b-da1e6609c8b5
0
public AlgorithmParametersType.ResponseFormat getResponseFormat() { return responseFormat; }
1d2e75cf-099c-447d-b936-261caea8a19d
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...
11482232-eb8b-41df-a991-e4940e58124c
0
public void setFriend(FooObject friend) { this.friend = friend; }
471e8fc5-4cdc-4b1e-809d-988e8c01b6f2
0
@AfterClass public static void tearDownClass() { }
b4e8750c-59d2-4da3-930e-38c0a8fb89e9
1
public void discard(DiscardPile pile) { while (hand.size() > 0) { pile.getDeck().add(hand.get(0)); hand.remove(0); } pile.refreshImage(); refreshImage(); }
0a3048b5-290c-47a2-a15d-3dd80bf48d08
3
@Override public GameState doAction(GameState state, Card card, int time) { if(time == Time.DAY) { //Do nothing } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); state = temp.doAction(state, card, time); } else if(time == Time.NIGHT) { state = mutineerNightAction(state,...
c33d4eed-a6d2-4ee1-880e-2f8275dd5cf3
1
public void drawUI() { for(UIElement ui : uiElements) { ui.draw(); } }
7416ed21-92c4-414b-8340-d72ab61399b9
3
public Object getValueAt(int row, int col) { if(row>-1 && col>-1 && data!=null) return data[row][col]; else return null; }
d16f9e36-d507-4b67-83de-1bc140c11512
3
@Override public void incrementPlayCount(String player_name) { PreparedStatement pst = null; int player_id = getPlayerId(player_name); int playcount = getPlayCount(player_id); try { pst = conn.prepareStatement("UPDATE ffa_leaderboards SET times_played=? WHERE player_id=?"); pst.setInt(1, playcount + 1); ...
3f70015f-006a-47ef-bd94-5106262db0ef
6
private Matrix subMatrix(Matrix matrix, int row, int column) { Matrix result = new Matrix(matrix.getRows() - 1, matrix.getColumns() - 1); int rowIndex = 0; int colIndex = 0; for (int x = 0; x < matrix.getRows(); x++) { colIndex = 0; for (int y = 0; y < matrix.g...
7092f29a-c2b0-4c97-8396-7bd2251acf83
1
private void jTextFieldCmdCliQte6FocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_jTextFieldCmdCliQte6FocusLost mondecimal = new DecimalFormat("#######.00"); if (!(jTextFieldCmdCliQte6.getText().equals(""))) { int qte = Integer.parseInt(jTextFieldCmdCliQte6.getText().tri...
675947d2-6ac7-4b41-830f-f1e606281ddd
6
private final int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(1, old0, old1); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, 0L, active1);...
c4f9efa5-5103-4f49-9b40-3d1d9dff85c0
6
@Override public List<Product> getProducts(String namePattern) { Session session = null; Transaction trx = null; List results = null; try { session = sessionFactory.openSession(); trx = session.beginTransaction(); Criteria cr = session.createCriteria(Product.class); cr.add(Restrictions.like("title...
54fc190a-fe7b-4ec3-90f8-51a52a510c9c
4
final public CycList existUBoundForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycVariable var = null; CycObject sent = null; CycList val = new CycList(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case THEREEXISTATMOST_CONSTANT: jj_consume_token(T...
86752cc7-860c-4f46-ad1f-a838569299e0
9
private void setMaxWidthHeight(PetriNet pn) { int maxW = 0; int maxH = 0; for (Resource r : pn.getListOfResources()) { if (r.getWidth() > maxW) { maxW = r.getWidth(); } if (r.getHeight() > maxH) { maxH = r.getHeight(); ...
161d4489-f0e7-4874-b359-8833c64b72db
8
private Color getRandomColor() { Color c = Color.MAGENTA; int i = new Random().nextInt(7) + 1; switch(i) { case 1: c = Color.RED; break; case 2: c = Color.BLUE; break; case 3: c = Color.GREEN; break; case 4: c = Color.CYAN; break; case 5: c = Color.PINK; break; case 6: ...
84886b99-69a8-45e6-9cd3-3bab4ae6d41d
4
private String sendHandler() { int rand = (int) Random.nextDouble(1, 4); switch(rand) { case 1: sendText = setText1; break; ...
406553be-b0e3-49f5-a6fb-18e2f69047f1
4
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (this.seance == null) return false; Ticket otherTicket = (Ticket) other; return this.place.equals(otherTicket.getPlace()) && this.seance.equals(otherTicket.getSeanc...
365dab62-f103-45ca-ac40-4aa95133b76f
4
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{ g.drawImage(singlePlayerButton, 20, 80); g.drawImage(multiplayerButton, 320, 80); g.drawImage(exitButton, 535, 320); if (multiplayer){ g.drawString("Enter the number of players:", 200, 360); // Draws the name te...
dfa1a33e-f898-4de7-a9c7-b1cde269a9fe
9
public boolean writeFileText(File addr, String content, boolean assure_file_existance, enmTextAppendMode appendmode) throws FileNotFoundException, SecurityException, UnsupportedEncodingException { //Default variable for the return value. boolean returnval = false; //Variable for the modified content. String mod...
219519cf-ad16-48fc-9eda-cfd5b10c0d2b
7
public TextPosition getposition (int x, int y) { if (L.first() == null) return null; if (y < 0) return new TextPosition(TopLine, TopLineCount, 0); if (TopLine == null) return null; ListElement e = TopLine; int h = Leading + Height; if (h == 0) return null; h = y / h; int i; for (i = 0; i < h; i++) ...
afea68a9-3f8a-40d3-ab70-bf87f9d51e9e
3
private static String exec(String ...cmd) { try { ProcessBuilder pb = new ProcessBuilder(cmd); Process process = pb.start(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); InputStream stdout = process.getInputStream(); int readByte = std...
f870fe12-3232-4adc-92fa-42555247cd86
6
public Vector<Vector<Object>> getFolderContentsTable() { Vector<Vector<Object>> tableData = new Vector<>(); // Get the contents of the folder List<FileInfo> files = getFolderContents(); logger.debug("Found " + files.size() + " entries for " + path.toString()); // Add folders for(FileInfo file : files) ...
e1eab4c7-71da-46e9-9b79-e5cfe7d67903
1
public static ArrayList<HighScoreAchievement> getAllAchievements() { if (allAchievements.isEmpty()) loadAllAchievements(); return allAchievements; }
82d9d40c-9d55-4cfe-962f-9280144ddd7d
0
private Assets() { }
88284553-6f8b-4260-b12d-554a0a6bc535
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String ud = request.getParameter("u"); try (PrintWriter out = response.getWriter()) { ...
345c0e0f-c9b9-4a30-a8ee-897f6f431941
5
public Edge searchForEdge(String input) { String address = cleanString(input); String tempString = address; int index = 0; while(tempString.length()>0) { index = Collections.binarySearch(edges, new Edge(tempString), nameComparator); if(index >=0) { break; } tempString = tempString.substrin...
74dfc11a-6924-45e5-97f4-1409a5735b74
8
@Override protected void doAction(int option) { switch (option) { case 1: listAllPlaylists(); //lister alle playlister op menu pause(); break; case 2: allSongsInPlaylist(); //viser alle sange på play...
a40fd9e7-f0aa-4638-8dca-3179dcd996e2
9
public boolean validaHoraComUltimoLancamento2(JobProtheus op, String dataInicialLancamentoAtual, String HoraInicialLancamentoAtual, String dataFinalLancamentoAtual, String HoraFinalLancamentoAtual, String recursoAtual, double qtdTransf) { if (temLinhaTempo && !jCheckBoxRetrabalho.isSelected() && qtdTransf > 0)...
12b1d343-eb15-40f2-b700-286fb185ddba
6
@EventHandler public void WolfBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWolfConfig().getDouble("Wolf.Blindness.D...
6065e360-a1de-4eda-987a-5e8c4e6336bf
0
public static void setMainWindow(JFrame mainWindow) { MainWindow.mainWindow = mainWindow; }
80b9d050-c30b-466c-ac2e-804946d15155
1
public boolean EliminarProveedor(Proveedor p){ if (p!=null) { cx.Eliminar(p); return true; }else { return false; } }
44d2f7cd-0b63-4338-a492-6e8be95a3df8
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Student other = (Student) obj; if ((this.studentName == null) ? (other.studentName != null) : !this.stude...
b20eb1d5-76e6-4e82-bcc1-e3a524f802b8
1
private LinkedList<Calificacion> invertirColeccion(PriorityQueue<Calificacion> calificaciones) { LinkedList<Calificacion> copiaCalific = new LinkedList<>();//para no modificar la colecc original LinkedList<Calificacion> calificacionesInvertidas= new LinkedList<>(); copiaCalific.addAll(calificaciones); int i; ...
e01b0b7f-a028-4edb-988a-969885a35c64
0
public int getCompareJumpLength() { _read.lock(); try { return _compareJumpLength; } finally { _read.unlock(); } }
36435c95-eff1-4a33-9d2c-e4f9fdf1279b
6
public static void getRunTimes(Unsigned m, Unsigned n, Unsigned t, File fout, boolean opt) { // random System.currentTimeMillis() //MemoryFarm.initMem(); BigInt.setRandSeed(1231538606138l); int pairs = m.intValue(); long[][] worstCaseRunTimes = new long[t.intValue()][2]; for(int j = 1;...
bd9709b1-ba14-4239-9011-e7cd4eb8ee1d
7
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof CustomPieURLGenerator) { CustomPieURLGenerator generator = (CustomPieURLGenerator) o; if (getListCount() != generator.getListCount()) { return fals...
581472a0-3d02-4e09-afd5-86f2cd8da075
1
public File alustaTyhjaTestitiedosto(){ //asettaa testiluokalle tiedoston ja tyhjentää sen try { tiedosto = new File("JapanimaatinTiedostot/testi.txt"); PrintWriter kirjoitin = new PrintWriter(tiedosto); kirjoitin.print(""); kirjoitin.close(); ...
7a171385-8841-437a-a620-cbc27fdb1775
6
public void act() { if (steps < sideLength && canMove()) { move(); steps++; } else if (turns == 0 && canMove()) { turn(); turn(); turn(); turns++; steps = 0; } else if (turns == 1 && canMove()){ set...
cf267d57-6b89-4cbb-8575-2b326e618d05
1
public void client_info(){ String one="client info: "; String two="port number: "+ this.serverPort; String three="downloaded: " + this.torrentHandler.getBytesDownloaded(); String four="uploaded: " + this.torrentHandler.getBytesUploaded(); String five= "total: "+this.torrentInfo.file_length; //Al...
9abe3429-f22a-47e5-a2b4-1ecb07cc2b3b
2
public void drawScreens(Graphics2D g, float interpol) { // int i = 0; for (GameScreen s : screens) { if (s.state != ScreenState.HIDDEN) { // Profiler.start(); s.drawScreen(g,interpol); // Profiler.lap("Draw Screen "+(i+1)); } // i++; } }
3bd81af2-b03b-4d65-a030-bbb06368d031
1
public static void DisconnectButton() { try { chatClient.Disconnect(); } catch (Exception e) { System.out.println("error in action disconnect in clientgui"); e.printStackTrace(); } }
8ae881ec-040f-4aa0-88c3-5fc48f60f278
8
public void runServer() { System.out.println("Server started"); //TODO Find way to display the server ip here System.out.println("Port: " + socket.getLocalPort()); printHelp(); running = true; showRaw = true; receiver = new MsgReceiver(this, "Server-Receiver"); receiver.start(); Scanner input = new S...
297f5e78-e15a-482f-b619-36467888b63a
7
public static Object[][] getGraphComponents(mxAnalysisGraph aGraph) { Object parent = aGraph.getGraph().getDefaultParent(); Object[] vertices = aGraph.getChildVertices(parent); int vertexCount = vertices.length; if (vertexCount == 0) { return null; } ArrayList<ArrayList<Object>> componentList = new ...
f72e9a76-9d45-42cd-bba7-4a816be1f988
0
public ExportSubMenuItem() { super(); setEnabled(false); Outliner.documents.addDocumentRepositoryListener(this); }
1d23d64d-cdb2-4208-90a3-62edb1742971
3
@Override public void replaceAll( BiFunction<? super K, ? super V, ? extends V> function) { throw new UnsupportedOperationException(); }
b7ee0a31-5097-4d47-a78b-ab4f4adab6c4
8
private int getCriteriumValue(PokerHandName handName, byte[] cards) { switch (handName) { case STRAIGHT_FLUSH: return straightFlashValue(cards); case QUADS: return quadsValue(cards); case FULL_HOUSE: return fullHouseValue(cards); case FLUSH: return flushValue(cards); case STRAIGHT: return str...
9663affc-03eb-4b93-bf1d-9181714d71be
7
public void mousePressed(MouseEvent e) { Node mouseOverN = tgPanel.getMouseOverN(); Node select = tgPanel.getSelect(); if (e.getModifiers() == MouseEvent.BUTTON1_MASK) { if (mouseOverN != null) { if(mouseOverN!=select) ...
85627b0e-45f4-4fdf-bf17-a1ce57ac4623
2
@Override public int getIndexOfChild(Object node, Object child) { File[] children = ((FileWrapper) node).getF().listFiles(); ArrayList<File> dirs = new ArrayList<File>(); for (File f : children) { if (f.isDirectory()) dirs.add(f); } ret...
4aba5c65-97b5-4d6b-864a-2260c000208d
4
public Object getValueAt(int row, int column) { User myUser = (User) userList.get(row); switch (column) { case 0: return myUser.getUserID(); case 1: return myUser.getUserName(); case 2: return myUser.getUserRole(); case 3: return myUser.getUserPassword(); default: return null; } }
a3ef0f6b-512f-4dc3-b7e1-f75c94686db7
7
public static void updateLinksAndTimestamps(Proposition proposition, Keyword updatemode) { if (proposition == null) { return; } Logic.updateNowTimestamp(Logic.KWD_UPDATE_PROPOSITION); if ((updatemode == Logic.KWD_ASSERT_TRUE) || (updatemode == Logic.KWD_PRESUME_TRUE)) { Proposition.r...
e19ce685-79ca-4744-9393-74d2325eefdf
0
public Collection<Car> getCars() { return this._cars; }
f5c9aebb-6ad6-42c1-a653-db8a1f171bc8
0
public void setEncargo(Encargo encargo) { this.encargo = encargo; }
25f1a5d5-5619-40e8-aa26-99edef1be39e
2
public ArrayList<classifiedData> GetDescriptors(){ ArrayList<classifiedData> DataOut = new ArrayList<classifiedData>(); classifiedData tmp = null; //Get all files from sub-directory ArrayList<String> imagePaths = getFilesFromDirectory(); System.out.println("-----Indexing images in " + FileLocation + ...
a35aba39-e402-4dfd-9256-fe47fcdd5c24
8
private String javadocVisibilityArgument(int visibility, int modifiers) { String argument = null; switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) { case ClassFileConstants.AccPublic : argument = CompilerOptions.PUBLIC; break; case ClassFileConstants.AccProtected: if (visibility != ClassFile...
2d14be71-ec7c-4527-9caa-b7d814a7d67e
7
public double DeltaAdd(Instance inst, double r) { //System.out.println("DeltaAdd"); int S_new; int W_new; double profit; double profit_new; double deltaprofit; S_new = 0; W_new = occ.size(); if (inst instanceof SparseInstance) { //System.out.println("DeltaAddSparceInstance"); for (int i = 0; i < inst.nu...
ce42b647-7a82-40a1-bec6-0ed0b5fdb915
4
public static NationType fromId (int id) { if(id == 3) { return ENGLAND; } else if (id == 2) { return NETHERLANDS; } else if (id == 1) { return SPAIN; } else if (id == 0) { return FRANCE; } else { return null; } }
3972cb8c-b17f-4d98-837a-cfd5ec01c9e0
0
public Number get(String parameter) { return (Number) parametersToNumbers.get(parameter); }
601ebc7e-419b-40dd-b834-a096809b14cc
9
public static Location grid(Location loc1) { Location loc = new Location(loc1.getWorld(), loc1.getX(), loc1.getY()-2, loc1.getZ()); if(loc.getBlock().getType().equals(Material.DIAMOND_BLOCK)) { return loc; }else if(loc.getBlock().getType().equals(Material.GOLD_BLOCK)) { //We need to add to Z Location z1...
31d1efe8-c578-4a3d-9c7f-f0a113ff8381
1
public Player(String n, Color c) { setName(n); color = c; for (ResourceType i: ResourceType.values()) { resources.put(i, 0); } }
55c8be1e-7a28-4817-a2e1-3b92f401b51d
5
private void predictionShowResults(int predictionNumber, String[] inputText) { // storing the input text Set<String> input = new LinkedHashSet<String>(Arrays.asList(inputText)); // storing the contexts supplied as part of input that have suggestion // results Set<String> inputHaveResults = new LinkedHashSet<S...
b8de903f-e2bf-46e7-a85b-14937c5eac65
9
public static String makeTesnseEomi(String preword, String endword) { if(preword==null||preword.length()==0) return endword; if(endword==null||endword.length()==0) return preword; if(endword.charAt(0)=='ㅆ') { return preword.substring(0,preword.length()-1)+ makeChar(preword.charAt(preword.l...
f87e4f5d-8f08-43cf-bb04-ad66a4c56dba
9
private String resultAt(int[] a, int i) { int res[] = new int[a.length]; res[0] = i; if(a.length > 1){ res[1] = a[0] - res[0]; } for(int j=2; j < a.length; j++){ res[i] = a[i - 1] - res[i - 1] - res[i - 2]; } if(a.length > 1 && res[a.length - 1] + res[a.length - 2] != a[a.length - 1] ) return...
170facda-50ee-4b55-b239-0b0c87837260
9
public static List parse(String pLine) { final List lSections = new ArrayList(); // True if within word. boolean lInSectionP = false; // Current char char lChar; // Wait for this character before switching back to normal parsing. char lSeparator = ' '; // Part count. int lSectionN...
54c7a3af-8a39-42fc-9096-c6184f182466
6
public static short computeALU(short input0, short input1, boolean zero0, boolean negate0, boolean zero1, boolean negate1, boolean ADDorAND, boolean negateOutput) { short result; if (zero0) input0 = 0; if (zero1) ...
cd78cf6e-86ca-4626-901a-20b8cfa5a625
3
public String[] sortList(String[] names) { String tempName; boolean complete = false; while(complete) { complete = true; // assume that you done for (int i = 0; i < names.length-1; i++) { int compareResult = names[i].compareTo(name...
d3acdb3a-cbe2-4440-8f8e-b648f01f9b24
0
@Override public String getAcademicLevel() { return super.getAcademicLevel(); }
c5f54704-3207-4f36-9f03-cfe11b5c99af
1
public String getValueString(int row, int clums, int sheetat) { String s = null; try { hSheet = hWorkbook.getSheetAt(sheetat - 1); hRow = hSheet.getRow(row - 1); hCell = hRow.getCell(clums - 1); hCell.setCellType(Cell.CELL_TYPE_STRING); s = hCell.getStringCellValue(); } catch (Exception e) { } ...
f1f5f0fe-a00f-43d7-938b-48ddfa0db5fa
2
public boolean isLeaf(Object node) { if (node instanceof Page) { Page p = (Page)node; return (p.children.size() + p.names.size()) == 0; } else if (node instanceof Name) { return true; } else { throw new NotImplementedException(); } }
372db763-ebab-4d2f-951a-11fbc0f5cdea
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; User other = (User) obj; if (userData == null) { if (other.userData != null) return false; } else if (!userData.equals(other.userData)) return fal...
4b9935a9-9243-42c0-a2dd-b12e598a9233
3
private int buildFontCache(RenderingHints hints) { Rectangle2D maxbounds = font.getMaxCharBounds(new FontRenderContext(new AffineTransform(), false, false)); int width = (int) Math.ceil(maxbounds.getWidth() + 2); int height = (int) Math.ceil(maxbounds.getHeight() + 2); BufferedImage texture = new BufferedImage...
9f4b55ba-077f-419c-8329-e66956701006
8
public BufferedImage getImage() { if (toolTipObject != -1 && System.currentTimeMillis() > toolTipLastUpdate + TOOL_TIP_DELAY) { String[] text = mouseObjects.get(toolTipObject).getToolTipText(); if (text != null) { BufferedImage image = new BufferedImage(finalImage.getWidth(), finalImage.getHeight(), Buffere...
fee69dda-166a-4034-bee8-6edcf3c12d60
5
public static void main(String[] args) throws InterruptedException, IOException { log.info("SimplePublishSubscribe"); LocalTurtleEnvironment env = new LocalTurtleEnvironment(); env.open(); ConsoleReporter reporter = ConsoleReporter.forRegistry(env.getMetrics()) .convertR...
8aa9db22-25ec-4e03-9db3-73661ec55071
1
public String getSimpleCode(){ String str= ""; str += this.printLineNumber(true) + "function := " + name.getNewName() + " ("; if(paramlist != null) str += paramlist.getSimpleCode(); str += ")\n" + compoundStatement.getSimpleCode(); str += this.printLineNumber(true) + "return := function "+ name.get...
e7ed212f-9c38-470d-9ba8-9b89bcae8921
7
public void load(File file, AlignmentMedium medium) { this.medium = medium; resultFile = file; if(medium != null) currentSet = medium.get(0); setIndex = 0; rdcIndex = 0; try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; Scanner scanner; while ((line = br.rea...
d4864fe3-24f8-458e-b7f1-f71ea194769f
3
private static int decode4to3( byte[] source, int srcOffset, byte[] destination, int destOffset, int options ) { byte[] DECODABET = getDecodabet( options ); // Example: Dk== if( source[ srcOffset + 2] == EQUALS_SIGN ) { // Two ways to do the same thing. Don't know which way ...
d3ff7f71-0595-4c10-bc00-ec00f62e87db
8
private static int findEndQuote(final String line, final int startPos) { final char quoteChar = line.charAt(startPos); boolean quoted = true; for (int i = startPos + 1; i < line.length(); i++) { final char chr = line.charAt(i); if (chr == quoteChar) { if...
0532daad-baf9-4337-bdca-752b2c991668
1
public void testMyStreamTokenizer() { System.out.println("** testMyStreamTokenizer **"); final String testString1 = "xyz\n;abc\ndef"; final StringReader stringReader = new StringReader(testString1); final MyStreamTokenizer st = new MyStreamTokenizer(stringReader); st.resetSyntax(); st.ordinary...
0a633d8e-05c9-4e2a-83b5-edc4381249a6
4
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Name : " + locusName + "\n"); sb.append("Sequence length : " + sequence.length() + "\n"); // Show references for (StringBuffer refsb : references) { sb.append("Reference :\n"); for (String l : refs...
f494035b-7fa0-4bd8-b241-5874d20efde8
8
public static boolean hasPotentialInfiniteLoop(Node<?> node) { for (;;) { if (node instanceof RepeatNode && ((RepeatNode) node).sibling.isNullable()) return true; if (node instanceof GrammarNode) return false; // Grammars have already been checked ...
085b2fdc-5a1c-474a-b8dd-a936072f5dde
4
private void copyCharactersTillPotentialReference() { if (nextPotentialReferencePosition != currentPosition) { int skipUntilIndex = nextPotentialReferencePosition != -1 ? nextPotentialReferencePosition : originalMessage.length(); if (skipUntilIndex - currentPosition > 3) { ...
034a3535-f42b-4aca-bd73-5ba38af26932
2
public static boolean isDataFilePath(String path) { return (isRosterPath(path) || isCataloguePath(path) || isGameSytstemPath(path)); }
6e78f4b1-9ccf-4b85-9469-552108fcdd89
9
public boolean[] CollisionEventWithShotWithHull(Ship ship, Shot shot, ArrayList<Ship> allShips) { boolean[] removed = {false, false}; // first is ship, second is shot. for (Ship s : allShips) { if (shot.getOwner().equals(s) && !s.equals(ship)) // if s fired the shot and ...
d6618b78-7414-4d42-b075-5147adf5b9ab
7
@SuppressWarnings("unchecked") @Override public boolean importData(TransferSupport support) { try { if (support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { Transferable transferable = support.getTransferable(); List<File> transferData = (List<File>...
c65011bd-12f3-442b-be24-bd80c055760d
8
public void updateOffscreenImage(){ if(offscreenGraphics == null){ return; } offscreenGraphics.setColor(Color.WHITE); offscreenGraphics.fillRect(0,0,oldActualWidth, oldActualHeight); int numWide = modelRef.getAnimationDuration(activeRow); if(numWide <...
0b309d2d-bd52-43bc-9795-5c2bcc618786
3
public void whenMinesAreCreated_thenMinesAreOnField() { Cell[][] cell = game.getCell(); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { if (cell[i][j].getIsAMine() == true) { assert(true); } } } assert(false); }
08f43224-ebba-490b-8f59-95bd0e61959f
6
protected ArrayList<HashMap<String, String>> execute(String sql, ArrayList<String> values, boolean returns) { try{ connect(); PreparedStatement preparedStatement = connection.prepareStatement(sql); if(values != null){ for(int i=0; i<values.size(); i++){ ...
7b8db5e9-2b5d-48b2-95fd-5aff65fc84a7
2
private double variance() { double ave = average(); double var = 0, sum = 0, number = 0; for (Patient p : this.allPatients) { if (!p.isHospitalized()) { sum += Math.pow(ave - p.getTotalTime(), 2.0); number++; } } var = sum / number; return var; }
96305836-626f-4dfa-8c32-ca126a69fe58
5
@Override public void run() { while(game.gameRunning){ for(int x=0;x<game.gameDimensions.x;x++){ for(int y=0;y<game.gameDimensions.y;y++){ if(game.glowColor[x][y]!=null){ graphics.setColor(game.glowColor[x][y]); graphics.drawRect(x,y, 1, 1); } else { graphics.setColor(C...
69b21581-8f21-4db5-9c4c-91b94e1d4ad3
9
public static Hand findHand(Card[] tableCards, Card[] holeCards) { allCards = new Card[7]; System.arraycopy(holeCards, 0, allCards, 0, holeCards.length); System.arraycopy(tableCards, 0, allCards, holeCards.length, tableCards.length); Arrays.sort(allCards); Hand h = isRoyalFlush(...
74b45226-5fed-48b5-ac10-8d3f3ade3e24
4
public static int[][] nDivM(int n) { int[][] intM = new int[n + 1][n + 1]; intM[0][0] = 1; for (int i = 1; i <= n; i++) { intM[i][0] = 0; } for (int i = 0; i < n; i++) { intM[i][i + 1] = 0; } for (int i = 1; i <= n; i++) { for (...
259c5536-2b2b-4a8a-8600-adcdcad17a2b
6
public static void main(String[] args) { String usage = "Usage: tacagent.jar [-options]\n" + "where options include:\n" + " -config <configfile> set the config file to use\n" + " -agentimpl <className> set the agent implementation\n" + " -agent <agentname> set t...
e97c3a5f-8bae-4c6f-8f09-61e96f4f22b7
7
ArchiveFetcher(OndemandWorker ondemandworker, FileIndexWorker indexworker, BigInteger e, BigInteger m) { do { try { fileIndexWorker = indexworker; modulus = m; exponent = e; ondemandWorker = ondemandworker; if (ondemandWorker.isPriorityRequestsFull()) break; parentTableRequest = ondemandWorker.c...
dc3cb6d2-ab4f-462f-9a77-d867a731a866
0
public void setValueMAC(byte[] value) { this.valueMAC = value; }