method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
61ff5431-f074-453e-9dba-30b29d6eaf97
0
public void render() { level.render(this, xScroll, yScroll); }
ef3a425a-e19a-4594-b708-1a3eda3b41e7
3
public void moveToContainer(Container c) { if(getContainer() != null) {getContainer().remove(this);} if(getGrid() != null){removeSelfFromGrid();} if(c != null) {c.add(this);} setContainer(c); }
b789ab3d-7b99-400d-b017-30a08b66ccb7
4
@Override public void sail(){ while(true){ // STEP 1: // Get sensors reading from Python controller try{ readSensors(); }catch(IOException ex){ ex.printStackTrace(); } // STEP 2: // Check if waypoint is reached. If so, go to next one. // Reading distance to waypoint and sending...
826fa1ad-36e5-48ec-8868-1758c34c325d
4
public String getAnswer(){ for(int i = 2; i < PRIMESBELOW; i++) if(NUMS[i] == false) sieve(i); long answer = 0; for(int i = 2; i < PRIMESBELOW; i++) if(NUMS[i] == false){ answer += (long)i; } System.out.println(answer); return String.valueOf(answer); }
ac980edd-b446-4567-9e47-0e5593a60c5d
8
private void updatePersonne(int id, String adresse, String mail, String situation, String login, String oldMdp, String newMdp) { try { String info = "La modification des données a été prise en compte"; DriverManager.registerDriver(new oracle.jdbc.driver.Oracl...
2938edf9-74fa-40b2-80a0-b72d94ab37f9
7
public static void main (String[] args) { int n = 8; int size = 500; String t = "cs671.UtilClockTimer";//Clock.DEFAULT_TIMER_CLASS; String p = null; try { if (args.length > 0) n = Integer.parseInt(p = args[0]); if (args.length > 1) size = Integer.parseInt(p = args[1]); if (args.len...
0b64ccb3-9b7f-431e-b053-054bc2cb0f26
3
public CookieHandler(Map<String, String> httpHeaders) { String raw = httpHeaders.get("cookie"); if (raw != null) { String[] tokens = raw.split(";"); for (String token : tokens) { String[] data = token.trim().split("="); if (...
f7407f0d-d5a9-4ec4-9c02-c269657ff5b5
7
private boolean validaDados() { boolean retorno = true; if (this.usuarioBean.getCodigo() == null || this.usuarioBean.getCodigo() == 0) { FacesUtil.exibirMensagemErro("ERRO: Codigo não pode ser 0 ou nulo."); retorno = false; } if (!this.usuarioBean.getSenha().equal...
53c696f1-99af-45d8-8a9d-4b6b7c83cb7f
4
public ResultSet retryResult(String query) { boolean passed = false; Connection connection = open(); Statement statement = null; ResultSet result = null; while (!passed) { try { statement = connection.createStatement(); result = statement.executeQuery(query); passed = true; return result...
0abc878d-d06e-4006-abc9-1e8bde227a42
8
public String getStyle() { String returnedString = style; /* Style string returned */ if (style == null) { if (this.isRoot()) { returnedString = getFrame().getProperty( FreeMind.RESOURCES_ROOT_NODE_STYLE); } else { String st...
564acdd2-6aa4-480b-9fa8-10c22a7ad9a3
6
public static String GetItemName(int ItemID) { String ItemName = ""; for(int i=0; i<Items.listItemsID.length; i++) { if(Items.listItemsID[i] == ItemID) { ItemName = Items.listItems[i]; } } if(ItemID >= 300 && ItemID < 400) { ItemName = "Book: "+Books.getName(ItemID); } if(ItemID >= 400...
51902c88-3057-422a-946e-dfd5256a9caa
5
private void loadRights() { try { String right = ""; HashMap<String, Integer> subHM = new HashMap<String, Integer>(); ResultSet erg = this.plugin.db.Query("SELECT * FROM `tncc_gebiete_rights`" + " WHERE `gebiet_id` = '"...
336d3cd4-2a89-4a6f-af4b-24ec51458a03
1
public boolean canHaveAsCreditLimit(BigInteger creditLimit) { return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0); }
d02ccf93-15a0-445e-b569-5e661439d99e
5
private void delete(int row) { if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.PAID_W)) { return; } PaidDetail selectedRow = result == null ? null : result.get(row); if (selectedRow != null) { if (JOptionPane.showConfirmDialog(nul...
4184b001-7a24-466c-b0c5-10c269e15f16
9
@Override public String toImplementationSyntax(TableModel model, String definition) { String newDefinition = definition; StringTokenizer tokens = new StringTokenizer(newDefinition, getSyntax().getDelimiters()); String token; String cellID = null; ...
c47bf179-0ab5-4e72-aee8-45c7418aa570
6
public void analyzeSuperClasses(ClassInfo superclass) { while (superclass != null) { ClassIdentifier superident = Main.getClassBundle() .getClassIdentifier(superclass.getName()); if (superident != null) { superident.addSubClass(this); } else { // all virtual methods in superclass are reachable ...
5ef790f8-86b5-4e9f-88b9-32f724a119a2
0
public static World getLoadedWorld() { return loadedWorld; }
bbbe8643-5a15-4b17-a28e-a315bb731158
0
public void setDocument(OutlinerDocument doc) { this.file = null; this.doc = doc; }
a7802d00-f673-41a5-b290-7dbbb4e4b2e2
4
@Override public List<AssemblyLine> generate(Context context) { final List<AssemblyLine> lines = Lists.newLinkedList(); lines.add(new Label( String.format(FUNCTION_MANGLE, returnType.getName()))); Context funcContext = generateContext(context); ...
af3e5a29-093f-46b3-b13e-e714d8f42c65
7
private void createActions() { // open action opener = new StructureReader(); opener.setMolecularViewer(this); jmol.getInputMap().put((KeyStroke) opener.getValue(Action.ACCELERATOR_KEY), "open"); jmol.getActionMap().put("open", opener); // reset action Action a = new AbstractAction() { public void ac...
dd2614cf-ff11-476c-bfc1-ca5160cc00ab
5
public void removeOutside(){ if(outsideTimesCounter < xGen / grid / 2){ for(int i = 0; i < yGen / grid; i++){ if(rects[outsideCounter].type != INDESTRUCTUBLOCK)rects[outsideCounter].type = 0; outsideCounter += xGen / grid; } for(int i = 0; i < yGen / grid; i++){ if(rects[rightOutsideCounter].type...
c05b096a-da60-43f7-b0b7-f39c2ee87727
1
protected void btnAdicionarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarActionPerformed Telefone temp = new Telefone(); try{ temp.setDdd(Integer.parseInt(txtDdd.getText())); temp.setNumero(Integer.parseInt(txtNumero.getText())); ...
0d20494c-200a-4b6a-8f7c-0a4a1ef968f0
4
@Test public void testGetMessageNoUnexpectedMessages() { try { int noOfMessages = 2; final String message = "TestMessage-testGetMessage_OneSubscriber"; final CountDownLatch gate = new CountDownLatch(1); final AtomicInteger msgCount = new AtomicInteger(0); final Message expected = new MockMessage(messa...
9d45124f-ccc2-4da1-8441-31edb21f7fff
3
public boolean hasMoreElements() { if(index < 0 || index > streamList.length-1){ return false; } if(streamList[index] != null){ return true; }else{ return false; } }
224c1ba2-8a61-437a-8044-987d29f44bf2
4
Query(byte[] chars){ List<Literal> tempLiterals = new ArrayList<>(); int start = 0; Literal possibleLiteral; for (int i = 0; i < chars.length; i++) { if(chars[i]==')'){ possibleLiteral = new Literal(chars, start, i); if(head==null) { ...
8e51166a-b00c-40db-b198-b3188ffe4193
6
public Collection<? extends Object> listAll(String cmd, Connection conn) {//TODO: permitir transaction Collection<? extends Object> matriculasAlunoTurma = super.listAll(cmd, conn); AlunoDAO alunoDAO = new AlunoDAO(dataController); String selectAlunoCmd = createSelectAlunoCmd(alunoDAO.createSelec...
a0035285-135a-474a-81c5-6a5f2f5110ee
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
ba5fca2f-d1d5-41b9-8e9a-9471370bf922
8
public static void main(String[] args) { boolean validar=true; int opcion; char continuar; double monto; account oaccount=new account(); Scanner teclado=new Scanner(System.in); while(validar) { System.out.pri...
a3072db3-cf50-4550-b8be-a7985aa145bc
0
private static void openJournal() throws Exception { // 应该是只增打开 FileOutputStream fos = new FileOutputStream("eventbus.journal"); _journal = new ObjectOutputStream(fos); }
5f09a7e8-566c-44f9-9611-ad1f2b48044e
6
public static void recv(Socket socket) { try { PrintWriter server = new PrintWriter(socket.getOutputStream()); int numFiles = Integer.parseInt(readLine(socket)); System.out.println("Receiving " + numFiles + " files..."); for( int i = 0; i < numFiles; i++){ ...
3717f98d-10b0-472f-aaef-2c9de7f4cb3f
7
public Operator greedyChoose(){ double r; synchronized (rng){ r = rng.nextDouble(); } if (r < EPS){ synchronized (rng){ choosen = rng.nextInt(operators.size()); } return operators.get(choosen); } double qMax=...
1e90bed0-16c4-4aca-b984-dbf63610ae9d
4
public List<Person> getById(UUID personId) throws SQLException { //todo stored procedures are outside scope of demo List<Person> people = new ArrayList<Person>(); String GET_ALL_PERSON_INFO = "SELECT a.idPerson, a.firstName, a.lastName, pos.positionname, f.factoidTopic, f.factoidDesc " + ...
911e4eb0-6c65-440e-bb95-0e8b0c2c8fad
3
private void fillInElementsOnProjectList(int projectID){ listOfElements.clear(); if (projectID >=1){ try{ ResultSet elementsOnProjectListResultSet = null; Statement statement; statement = connection.createStatement(); elementsOn...
ddad7751-c831-4c82-8541-a74c211db481
1
@Override public void updateMovement(){ if (seenButtonTime<defsize/2){ randomPosition(); seenButtonTime=30; } }
593475ff-5c91-40ec-a517-a58cd5b95ca1
1
@Override public int getHeight() { int height = 0; if (this.fontmetrics != null) { height = this.fontmetrics.getHeight(); } return height; }
41c10f0f-41ac-44fd-804a-9b4795f13118
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MapCoordinates other = (MapCoordinates) obj; if (x != other.x) return false; if (y != other.y) return false; if (z != other.z) retur...
cd8fcb3e-caad-4a41-94f9-67869856ba14
3
@SuppressWarnings("unchecked") public ItemPDU<V> fromBuffer(ByteBuffer buf) throws Exception { SyncPeer from; SyncPeer to; byte[] setID; long tag; int i = buf.getInt(); byte[] magic = new byte[i]; buf.get(magic, 0, i); ...
07eec588-c6e6-4f3b-aede-9043e2d9f842
4
public static ImageIcon loadIcon(String src) { String name = src.replaceAll("http://west-it.webs.com/spells/",""); if (imageTable.containsKey(src)) { return new ImageIcon(imageTable.get(src)); } BufferedImage toReturn; while (true) ...
50c08aa6-f368-4df8-bed6-286d7a280f85
0
public ArrayList<String> getCertTitles() { return CertTitles; }
7b82a7e8-5290-475a-bf9d-efe3adaf4022
3
public Location nextLocation() { try { List<String> els = inFile.readLine(); if (els.size() >= 3) { String name = els.get(0); double x = Double.parseDouble(els.get(1)); double y = Double.parseDouble(els.get(2)); ...
3026b3de-1341-4f0f-b6dc-c6fb9dbd1b5a
7
public String minWindow(String S, String T) { winDeque = new LinkedList<Character>(); tMap = new HashMap<Character, Integer>(); cMap = new HashMap<Character, Integer>(); minWindow = null; fill = false; for (int i = 0; i < T.length(); i++) { Character current...
6e9991e5-0c39-494c-835c-98dfebbda19e
6
private void processItemEvent(Event event) { NormalizedEvent nevent = _appContext.getNormalizedEvent(event); int msgType = nevent.getMsgType(); if (msgType == NormalizedEvent.REFRESH) { _pendingCount--; addRefs(nevent); if (_pendingCount == 0 && _c...
5fc45ccd-5f48-44b1-98e3-3d507495373f
2
public void doAutoAction(){ String[] oldBizList = GasDecisionProcess.getShopListCopy(); GasDecisionProcess.resetShopList(); //Set the BizList to null ************************* Should change name DPHreader dphReader = DPHreader.getInstance(); userChoice = Integer.parseInt(dphReader.readAnsw...
e6896c42-397a-4a98-ac44-136786d78fc5
9
public int minDistance(String word1, String word2) { int length1 = word1.length(); int length2 = word2.length(); if (length1 == 0) { return length2; } if (length2 == 0) { return length1; } // dp[i][j] is the edit distance between two strings with length i and // length j int[][] dp = new in...
9a59d428-a4d2-45d1-853c-56a23428c8ff
8
public @Override void execute() throws CommandException { final Module module = getModule(); final Namespace<? extends Symbol> symbolNamespace = module.getSymbolNamespace(); assert (symbolNamespace != null): "Module provided null namespace"; final TokenFeed feed = getFeed(); final DataFactory dataFactory = Da...
1bdcffd7-8387-41b1-9f05-150c2e54380c
4
public void performAction() { if (isConnected()) { boolean first = getOutput()[0].getStatus(); if (this.isTurnedOn()) { getOutput()[0].setStatus(true); } else { getOutput()[0].setStatus(false); } boolean second = getOutput()[0].getStatus(...
f670e0e3-bc85-4845-a4e0-dbc03f70101b
7
public int[] topologicalSort(ArrayList<ArrayList<Integer>> adjList) { int[] result = new int[adjList.size()]; int[] indegrees = new int[adjList.size()]; // queue of all node that has an in-degree of 0 Queue<Integer> zeroInNode = new LinkedList<Integer>(); // init O(|E|) for (ArrayList<Integer> list: adjList...
992b7a23-bfa8-41b3-82ce-5cbd4b6fe21c
0
private void initStatusBar(){ statusBar = new JToolBar(); statusBar.setSize(this.getWidth(), STATUS_BAR_HEIGHT); statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED)); statusLabel = new JLabel("Status"); statusBar.add(statusLabel); add(statusBar, BorderLayout.SOUTH)...
40d4743d-321c-49e7-b262-132cab0a4e6c
0
public byte[] getDigestValue() { return digestValue; }
d11c4357-818c-43ad-91ec-cb515dcb08c2
5
public String deleteProfiles(String inJson) { String retval = new String(); boolean retbool; int retcode; try { JSONObject jo = new JSONObject(inJson); JSONArray keys = jo.getJSONArray("key"); Connection conn = dbConn.getConnection(); PreparedStatement pstmt = conn.prepareStatement( "de...
c45a20da-809a-44a0-93ca-3b19c197ad8b
0
private void btnModificar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificar1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnModificar1ActionPerformed
1a13b583-8acc-4400-a0db-fd17d8d2d10e
4
private void hasGameEnded(){ if ((pelletsLeft <= 0 && !myPinko.thereArePelletsLeft() )|| (loveliesLeft <= 0 && thereAreNoLoveliesLeft())){ gameHasEnded = true; t.stop(); repaint(); } }
cef39543-9358-4701-8a61-4e07c4e32acf
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
4c54c68a-ffaf-4a73-ad0e-962ec32ef199
9
public static void main(String[] args) { Scanner teclado=new Scanner(System.in); int n1,n2,n3; System.out.print("Ingrese el primer numero:"); n1=teclado.nextInt(); System.out.print("Ingrese el segundo numero:"); n2=teclado.nextInt(); System.out.print("Ingrese el t...
a0ca94ce-d3bd-4af1-af55-731b0a26be72
6
private boolean isPlaceable(final int col, final int row) { Boolean placeable; if (row < 0 || row >= size) { throw new IllegalArgumentException( "isPlaceable : row " + row + "parameter out of bounds, must be between 0 and " + size); } if (col < 0 || col >= size) { throw new IllegalArgum...
a5ed8323-8b9b-40d1-966c-a92601d7efa7
8
final public void Function_variable_declaration() throws ParseException { /*@bgen(jjtree) Function_variable_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_VARIABLE_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(...
6247ccba-05dd-4dc2-9139-4166aecbdcd5
3
public String makeUniqueName(String prefix) { HashMap table = new HashMap(); makeMemberList(table); Set keys = table.keySet(); String[] methods = new String[keys.size()]; keys.toArray(methods); if (notFindInArray(prefix, methods)) return prefix; int ...
796c750b-1fba-447e-a245-e6ba13f5658b
3
public void declaration() { if(have(NonTerminal.VARIABLE_DECLARATION)){ //expect(NonTerminal.VARIABLE_DECLARATION); variableDeclaration(); } else if(have(NonTerminal.ARRAY_DECLARATION)){ //expect(NonTerminal.ARRAY_DECLARATION); arrayDeclaration(); } else if(have(NonTerminal.FUNCTION_DEFINITION)...
1e470fb1-d0db-4931-85a6-e3b41d00e62e
9
public void setValueAt(Object aValue, int rowIndex, int columnIndex) { System.out.println("CHANGE "+columnIndex+":"+rowIndex+" VAL: "+ aValue); IECTCItem item = ieclist.get(rowIndex); switch (columnIndex) { case 0 : { item.setType(IECMap.getType((String) aValue)); break; } case 1 : { item.Name= ...
25559ba1-e8c3-40d0-850b-b85ae1d9c898
9
private static String signIn() { System.out.println(); System.out.println(); System.out.println(); System.out.println(); System.out.println(" ____ ____ ____ ____ ____ ____ "); System.out.println(" ||S |||i |||g |||n || ||I |||n || "); System.out.println(" ||__|||__|||__|||__|| ||__|||__|| ...
64fa6300-f39d-4e11-a808-83e55cd9b093
6
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out) { int b,c; int[] table; int remaining = in.remaining(); while (remaining-- > 0) { if (out.remaining() < 2) return CoderResult.OVERFLOW; c = in.get(); ...
0854fe43-a7d4-4305-877d-84a68477cbdc
8
FetchData fetchData(FetchRequest request) throws IOException, RrdException { long arcStep = getArcStep(); long fetchStart = Util.normalize(request.getFetchStart(), arcStep); long fetchEnd = Util.normalize(request.getFetchEnd(), arcStep); if(fetchEnd < request.getFetchEnd()) { fetchEnd += arcStep; } long ...
5b1cbcab-3be8-43d1-9760-32a68c4ff3e0
0
public static JoeNodeList newNodeList(int initialCapacity) { // JoeNodeList currently implemented by NodeList return new NodeList(initialCapacity); }
a57f3610-d27e-4bef-9ba9-f9516a2dc224
7
public static Map countOccurrences(Map imagesTags) { if (PRINT == 1) System.out.println("Creating tagpool and counting occurrences...\n"); Map tagpool = new HashMap(); /* Iterate through the map */ Iterator itMap = imagesTags.entrySet().iterator(); while (itMap.ha...
08fb947c-d57d-48de-ba40-4dd80f10fdf2
1
public void testCreateParserWithMalformedMappingFile() throws Exception { try { final InputStream mapping = this.getClass().getClassLoader().getResourceAsStream("BrokenMapping.pzmap.xml"); final InputStreamReader mappingReader = new InputStreamReader(mapping); new FixedWriter...
b64190ea-9700-4941-92d6-5b6ea05d8e04
6
public int getPrecipitationHeight(int par1, int par2) { int var3 = par1 | par2 << 4; int var4 = this.precipitationHeightMap[var3]; if (var4 == -999) { int var5 = this.getTopFilledSegment() + 15; var4 = -1; while (var5 > 0 && var4 == -1) ...
a915fd41-f1d5-4d47-85e9-bad442855cf4
0
public static int getMaxSimultaneousSounds( AudioFormat playbackFormat) { DataLine.Info lineInfo = new DataLine.Info( SourceDataLine.class, playbackFormat); Mixer mixer = AudioSystem.getMixer(null); return mixer.getMaxLines(lineInfo); }
44998120-0cff-41df-a7b4-7c0544a2598e
7
@Override protected ArrayList<int[]> allPossibleMoves(int currentX, int currentY, Board board) { ArrayList<int[]> moves = new ArrayList<int[]>(); int x,y; for (x = -1; x <= 1; x++) { for (y = -1; y <= 1; y++) { // cannot move to self if (!(x == 0 && y == 0)) { // if on...
dff1ed0c-8c1a-4f17-ac84-ed88b918851c
7
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onDragMenu(InventoryDragEvent event) { if (event.getWhoClicked() instanceof Player) { Player player = (Player) event.getWhoClicked(); Inventory top = event.getView().getTopInventory(); int nu...
be8239f9-9244-4472-bbc3-eee7af21b27a
1
public Value merge(final Value v, final Value w) { if (!v.equals(w)) { return BasicValue.UNINITIALIZED_VALUE; } return v; }
c7304f72-fb41-4b15-98ce-45e92b4e627a
1
@Override public void renderMoneyOver(double priceInEuros) { if(priceInEuros > totalAmountInEuros) throw new IllegalArgumentException("ERR000569852b"); double moneyToRender = totalAmountInEuros - priceInEuros; totalAmountInEuros = 0; Out.infoLn("A coin of %1$.2f€ is bein...
fc3c0f0c-04a3-4768-9064-159214f0b6eb
6
private void doUnequip(ItemStack item) { ItemMeta meta = item.getItemMeta(); if (meta == null) return; if (!meta.hasLore()) return; for (String lore : meta.getLore()) { String name = ENameParser.parseName(lore); int level = ENameParser.parseLevel(lore); ...
c974e6f7-12f7-42b8-a110-8e8a606d633b
9
public void handleTileClick(Tile tile) { panel.getMatchInfoPanel().setSurrenderPending(false); //Any tile click cancels surrendering. if (selectedTile != null) { if (range != null && selectedTile.hasUnit()) { //Actions can only happen if a unit is selected and a range is shown. if (range.getAbility() != null...
9a1b1cb6-ffa6-40b8-9540-e48065b9772a
0
public void setWatchKey(WatchKey watchKey) { this.watchKey = watchKey; }
2000d3b5-8ab3-4800-b1ca-b18e86ef7366
3
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if(qName.equals("hits")) { inHits = true; } if(qName.equals("score")) { inScore = true; } if(qName.equals("color")) { inColor = true; } }
18ae122c-ffb7-411c-8d13-e1c0aceffbc4
3
@Override public boolean shouldReact(Message message) { String msg = message.text; return (msg.length() > 8 && msg.indexOf("to") == 3 && msg.indexOf(' ') == 2 && msg.indexOf(' ', 3) == 5); }
0175d382-5b03-4952-9971-f236435af01d
3
public byte[] read(int index) throws IOException { if (index<0 || index>= size) throw new IndexOutOfBoundsException(); file.seek(index*blockSize); byte[] block = new byte[blockSize]; int retVal = file.read(block); if (retVal != blockSize) throw new InvalidBlockFileException(index); return block; }
d74ce4de-38fa-47dc-a66f-e034d79d1259
0
@Override public String getCalle() { return super.getCalle(); }
4a5baeb9-9ef1-4212-a0d2-0d4148bcf535
5
public void update() { Animal animal; for (int x = 0; x < xSize; x++) { for (int y = 0; y < ySize; y++) { animal = controller.getGrid().getAnimal(x, y); if (animal != null) { if (animal instanceof Fox){ labels[x][y].setBackground(Color.RED); } else if (animal instanceof Rabbit){ labe...
27c743ee-ffb0-4aaa-9d62-5638fddf69e2
3
@Override public Object getContext(CommandInvocation invocation, Class<?> clazz) { if (clazz.isAssignableFrom(invocation.getCommandSource().getClass())) { return invocation.getCommandSource(); } throw new RestrictedSourceException(null, (Class<?>)clazz); }
eb616c11-b1ef-49e0-a63c-a0bbfac89fee
5
@POST @Timed @Path("getServiceDetails") @Consumes("application/x-www-form-urlencoded") @Produces({"application/json"}) public Response verifyServiceToken(@HeaderParam("serviceId") @NotNull String serviceToken, @HeaderParam("callingServiceId") @NotNull String serviceTokenToVerify) { String er...
2a6b76c9-f363-4e4d-a045-f602831be2fe
2
public static byte[] compress(byte[] data, int compressBufSize) { Deflater compressor = new Deflater(); compressor.setLevel(Deflater.DEFAULT_COMPRESSION); // Give the compressor the data to compress compressor.setInput(data); compressor.finish(); // Create an expandable...
3d898525-bf3d-4892-aefb-2c2ab11cbfdc
0
protected CtrlAbstrait(CtrlPrincipal ctrlPrincipal) { this.ctrlPrincipal = ctrlPrincipal; }
9fdbc54b-090b-4288-b9d2-8975fef8a95b
3
@Override @Execute public void idleRender(IChassis chassis) { if(chassis.getSoundSystem() instanceof IListenerLocation) { ((IListenerLocation)(chassis.getSoundSystem())).setListenerPosition(this.camera.getPosition()); } Iterator<GUIElement> it = this.guiElements.values().iterator(); while(it.hasNext()) { ...
676fa065-8d15-44c9-82dd-4ed4fd0c9fbb
1
public static void main (String args[]){ int rand =0; int i=0; Random r = new Random(10) ; for( i=0;i<10;i++){ rand = r.nextInt(10); System.out.println(rand); } }
77369eeb-8c79-445e-9f4d-c9208b328bce
7
public void testTree3() { TreeNode root = new TreeNode("root", 2); TreeNode subtree1 = new TreeNode("subtree1", 1); TreeNode subtree2 = new TreeNode("subtree2", 1); TreeNode leaf = new TreeNode("leaf"); root.branch = new TreeNode[]{ subtree1, subtree2 }; subtree1.branch[0...
549305e5-cba7-4ba8-8de6-8bdcec35a8d6
4
public Recuit(int taille,Gestion g){ //lancement du compteur start=System.currentTimeMillis(); plat=new Plateau(taille); this.taille=taille; this.g=g; listePolyo=new ArrayList<Polyominos>(); //ajout des polyo suivant la taille du plateau passé en parametre switch(taille){ case 3: list...
a63f8c01-8589-4ec2-9b55-b6d1736b85cb
3
public Region[] obtenirRegion(int taille) { assert (taille > 0) && (taille <= nbRegionsRestantes); Region[] aRenvoyer = new Region[taille]; SecureRandom rand = new SecureRandom(); for (int i = 0; i < taille; i++) { int indiceRegion = rand.nextInt(nbRegionsRestantes); aRenvoyer[i] = this.regions[indic...
583ef4f6-8456-4819-a692-ec2f368269c1
1
private Connection openConnection() throws DaoException { try { return dataSource.getConnection(); } catch (SQLException e) { throw new DaoException(e.getMessage()); } }
6d21e2e7-8ece-4b47-996e-4641a6e91b94
3
public void dessineTousTroncon(Graphics g) { // Si l'itin�raire n'est pas calcule, alors // on sait qu'il ne peut pas y avoir de troncon if (!calculated) return;// ...donc on quitte /* * Map qui contient pour chaque troncon dessine, Le nombre de fois ou il * faut encore le dessiner. (Un troncon ayant d...
74e4c920-a863-4ca8-95e8-bd61075215e7
1
public static boolean writeFile(String dir, String filename, byte[] bFile) { FileOutputStream fileOuputStream = null; try { fileOuputStream = new FileOutputStream(dir+"/"+filename); fileOuputStream.write(bFile); fileOuputStream.close(); return true; }catch...
ba92ec85-8ee8-4010-83bc-73d107a80917
2
public Set<BankAccount> getAccountsSatisfying(Predicate<BankAccount> predicate) { Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) if (predicate.test(account)) result.add(account); return result; }
510f25b2-286e-4257-90ea-fd0703c528f0
0
public String getIdent() { return Ident; }
98b8cb9c-53ce-47c2-83c1-f0dc1812e826
3
private void btnAlterarPagamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarPagamentoActionPerformed try { if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) { carregaObjeto(); if (dao.Salvar(pagament...
7da08971-1b35-4772-bcb2-99f4c7304fb8
3
@Override public void onPlayerUnownedBuild(ChunkyPlayerBuildEvent event) { try { if (!Permissions.PLAYER_BUILD_ANYWHERE.hasPerm(event.getChunkyPlayer().getPlayer())) return; } catch (ChunkyPlayerOfflineException e) { return; } if (event.getAccessLevel().equals...
35595cb5-3c93-4863-81a7-b60d9213d4d8
0
private final void doOperate3(){ // do something }
e6c76102-6115-4634-87e2-ca5c45b80a1a
4
public boolean isPartiallySelected(TreePath path) { if (isPathSelected(path, true)) { return false; } TreePath[] selectionPaths = getSelectionPaths(); if (selectionPaths == null) { return false; } for (int j = 0; j < selectionPaths.length; j++) { if (isDescendant(selectionPaths[j], path)) { ret...
58e95318-0467-4aa2-bbc4-b1bdfe6ff6a2
3
@Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) return; StringBuilder sb = new StringBuilder(); if (((getLength() + str.length()) <= limit)) { if (test(str)){ super.insertString(offs, str, a); ...
aa5a046e-0eb1-40de-8175-47981ef20b0a
3
public void createStandardChannels() throws SQLException{ sql.initialise(); boolean check = sql.existenceQuery("SELECT ChannelName FROM BungeeChannels WHERE ChannelName = 'Global';"); sql.closeConnection(); if(!check){ sql.initialise(); sql.standardQuery("INSERT INTO BungeeChannels(ChannelName, ChannelFor...
2877b53d-6ad3-4c04-9ec4-1adaaa24966f
9
public static boolean verifyVolumeHeader(final VolumeSpecification specification, final long systemTimestamp) throws CorruptVolumeException, InvalidVolumeSpecificationException, PersistitIOException { try { final File file = new File(specification.getPath()); if (file.exists(...