method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
266acef3-aef0-4f01-ab19-cd4510390d88
5
public Vector<Shift> getShiftsBetween(Calendar start, Calendar end) { if(shifts.size() > 0) { Vector<Shift> result = new Vector<Shift>(); int x = 0; //Get to the first date within the specified date while(x < shifts.size() && shifts.get(x).getStartTime().before(start)) x++; //Start adding dates ...
b5895982-e793-46db-912e-899e10dba3ed
9
public static int findMaxSum(int matrix[][]) { int rows = matrix.length; int max = 0; if (rows > 0) { int cols = matrix[0].length; if (cols > 0) { // i, j will determine the size of the submatrix for (int i = rows; i > 0; i--) { for (int j = cols; j > 0; j--) { // x, y will determine ...
686bab48-2b1d-4003-987b-a7cc30f13dd4
1
@Override public void handleResult() throws InvalidRpcDataException { String result = getStringResult(); if (result.equalsIgnoreCase(STATUS_STRING_OK)) { EventBusFactory.getDefault().fire(new RemoteDownloadsChangedEvent()); } else { // TODO: handle ...
03abcd9d-e101-46eb-a2bc-6a53b41552e3
1
private void cancelCheckTask() { if (checkTask != null) checkTask.cancel(); }
3114489d-edae-4446-8526-230ebebf6da6
2
public void readSource(String input) { StringBuilder sb = new StringBuilder(); try { FileInputStream fis = new FileInputStream(input); DataInputStream dis = new DataInputStream(fis); BufferedReader br = new BufferedReader(new InputStreamReader(dis)); String line; while ((lin...
09d709a3-a31b-448a-9617-83c699d9d078
4
public void setPotionEffects(ArrayList<PotionEffect> effects) { if(effects.isEmpty()) { this.compound.remove("ActiveEffects"); if(this.autosave) savePlayerData(); return; } NBTTagList activeEffects = new NBTTagList(); for(PotionEffect pe : effects) { NBTTagCompound eCompound = ne...
d6be8376-54ad-48b8-b829-fc9976fc54b3
5
public static void main(String[] args) { try { BufferedReader in = null; if (args.length > 0) { in = new BufferedReader(new FileReader(args[0])); } else { in = new BufferedReader(new InputStreamReader(System.in)); } // BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); ...
6626d2a1-93eb-43a6-a28d-1c5b7b7172e5
5
public void testInternal(int effort) throws IOException, InterruptedException { File tmpDirectory = TestUtil.directoriesToFile("tmp", "SnzOutputStreamTest"); tmpDirectory.mkdirs(); for(File org : testdataDirectory.listFiles()) { if(org.isFile()) { System.out.println("compressing " + org.getName()); ...
c7b6191c-7603-4c0f-af09-fa174d61b9d7
5
protected void showSelectedCountry(SessionRequestContent request) { String selected = request.getParameter(JSP_SELECT_ID); Country currCountry = null; if (selected != null) { Integer idCountry = Integer.decode(selected); if (idCountry != null) { List<Count...
b7f9f5dd-9f6d-45a3-8419-13ec4e01385d
7
public boolean isBranch() { switch (this) { case BEQ: case BGE: case BGT: case BLE: case BLT: case BNE: case BSR: return true; } return false; }
f7aefc54-b573-42bf-a5f1-7f0bc189df4f
7
public void actionPerformed(ActionEvent e) { String actioncommand = e.getActionCommand(); if (actioncommand.equals("New Class")) { ClassRoom newclassroom = new ClassRoom(); String name = (String) JOptionPane.showInputDialog(main, "Enter the new Classroom's name"); if (name != null) { File file = n...
bfeeeddb-f3a2-4794-81e5-31fed5b996ef
1
public int getMinRange(String minMatch, String maxMatch, int dataContentLength) { if (minMatch != null) { return Integer.parseInt(minMatch); } else { return dataContentLength - (Integer.parseInt(maxMatch)); } }
7604930d-40bf-4eb8-b47b-76d0b5ceb8f8
1
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return Movie.class.isAssignableFrom(type); }
3c104b04-ff75-4b03-b2a2-0408fa21793c
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ChannelTeds that = (ChannelTeds) o; if (!dataConverter.equals(that.dataConverter)) return false; if (!dataStructure.equals(that.dataStructure))...
c2ad3cf6-a132-4f60-8a34-a961ee71c157
7
private RebalanceIndex getRebalanceIndex(Node n) { //Index der angibt wie die Rebalancierung durchzuführen ist RebalanceIndex rebalanceIndex = null; //Balancierungsindex des Root Knotens berechnen int balanceIndex = getBalanceIndex(n); if (balanceIndex >= -1 && balanceIndex <= ...
d119a731-8b72-40c5-9da8-6e42e994943d
6
public static String buildParameterStr(Collection<Parameter> parameters) { StringBuilder sb = new StringBuilder(""); if (parameters != null && parameters.size() > 0) { for (Parameter param : parameters) { sb.append(param.getKey()); sb.append("="); try { sb.append(param.getValue() != null ...
0190c0ed-b80a-4fc0-b1f3-981beccd7150
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (o instanceof UserDTO) { final UserDTO other = (UserDTO) o; return Objects.equal(getId(), other.getId()) && Objects.equ...
211f66b9-267c-472c-aa20-188f71c88722
5
public StreamedContent downloadArquivo() { try { logger.info(pasta+" Inciando o download......"); FacesContext context = FacesContext.getCurrentInstance(); InputStream stream; if (verificaTamanho(arquivo.getTmDownload()) == true) { ...
f9c51a79-6729-4e69-bbe8-96d8edfb941c
1
@EventHandler public void scaleHunger(FoodLevelChangeEvent e) { ScaleHungerEvent event = new ScaleHungerEvent(plugin, (Player) e.getEntity()); plugin.getServer().getPluginManager().callEvent(event); // Cancel hunger if the custom event is cancelled. if (event.isCancelled()) { e.setCancelled(true); ...
b1b55009-1ed4-4961-b1ba-f12787c4934d
7
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPlayerCommand(PlayerCommandPreprocessEvent event) { Player player = event.getPlayer(); if (player.hasPermission("GameAPI.join")) { if (okayNoArgCommands.contains(event.getMessage().toLowerCase())) ...
8d327533-ef31-47bd-8d69-fc81cf979242
8
@Override public String expectedDelivery(String item, String client, String market) { logger.info("Calculating expected time to delivery. " + "item " + item + ", client " + client + ", market " + market); // business rule: delivery date depends of the client first letter char key = client.toUpperCase()...
c43de8e9-f557-4699-978e-4197434c1bfc
3
private LinkMatrix getLinkMatrix() { // erzeuge Matrix int L[][] = new int[pageCount][pageCount]; for (Page j : pages.values()) { L[j.nbr][j.nbr] = 1; for (Page i : j.links) L[i.nbr][j.nbr] = 1; } // stelle Output zusammen LinkMatrix lm = new LinkMatrix(); lm.L = L; lm.urls = new String[pageC...
f1b6049f-4df4-4f06-baff-41814d921a9a
5
@Test public void testGetPublisher() throws Exception { Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/librarysystem?user=admin&password=123456"); Statement st = conn.createStatement(); ResultSet rs = null; try { //Unmatched isbn ArrayList<Publisher> pubs = bh.getPublishers(0L, st...
14b57934-cd7e-4713-8e97-8f0f9b0ecb44
4
public boolean equals(Object otherObject) { if (this == otherObject) return true; if (otherObject == null) return false; if (getClass() != otherObject.getClass()) return false; Item other = (Item) otherObject; return description.equals(other.description) && partNumber == othe...
b6d74b63-4664-4a3d-9ded-c83ba91778ab
2
@SuppressWarnings("unchecked") public final JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
a61022f3-6243-4aed-8edd-4cc67231cae3
7
public String getString() { if (data_ == null) return "void"; else if (data_ instanceof Void) return "void"; else if (getType() == ValueType.COLOR) return Utils.codeColor((Color) data_); else if (getType() == ValueType.ARRAY) { @SuppressWarnings("unchecked") ArrayList<Value> vals = (ArrayList<Val...
f49ab878-05a6-4ef0-93e9-ccb6bc2d666e
4
public MuteableURL(String spec) { String[] parsed_url = parseURL(spec); // Then store the parts if (parsed_url != null) { setProtocol(parsed_url[0]); setAuthority(parsed_url[1]); setUserInfo(parsed_url[2]); setHost(parsed_url[3]); try { String port_string = parsed_url[4]; if (port_string...
3aa9b86f-0d10-4368-b978-664d5bfbb249
1
public MenuSaisie() { initComponents(); for (Entreprise entr : MainProjet.lesEntreprises) { jComboNomE.addItem(entr.getNom()); } }
9a06d586-d686-427a-af59-6f431d50aa8c
2
@Override public boolean isMovingEnabledAt( int x, int y ) { if( moveableIfSelected ){ SelectableCapability selectable = getCapability( CapabilityName.SELECTABLE ); if( selectable != null ){ return selectable.getSelected().isSelected(); } else { return false; } } else { return getBoundaries(...
6680805c-77f8-4cac-878e-3ade8b2cf077
6
public static Boolean UpdateQuestion(Question QuestionToUpdate) { List<String> statements = new ArrayList<String>(); statements.add(String.format("Update Question Set QuestionText = '%s', isValidated = %s, isRejected = %s where QuestionId = %d", QuestionToUpdate.questionText, QuestionToUpdate.isVali...
fa578bfa-a80e-43aa-b843-f1eac1c9bf3b
2
public synchronized void drawImage(AbstractAlgorithm imgGen, double scale) { BufferedImage toDraw = imgGen.generate(); int scaledWidth = (int) (toDraw.getWidth() * scale); int scaledHeight = (int) (toDraw.getHeight() * scale); BufferedImage scaled = new BufferedImage(scaledWidth, scaledHeight, BufferedImage...
3b3d5403-9671-4e31-9700-ce7df7e2dd5b
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { writer.println("continue" + (continueLabel == null ? "" : " " + continueLabel) + ";"); }
9af83bdc-b5a6-41fc-80f6-ff9087e253d8
4
public void close() { closed = true; try { if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } if (socket != null) { socket.close(); } } catch (IOException exception) { System.out.println("Error closing stream"); } isWriter = f...
237ee591-aed3-4893-8704-ac27a6799460
8
public int experienceLevels(MOB caster, int asLevel) { if(caster==null) return 1; int adjLevel=1; final int qualifyingLevel=CMLib.ableMapper().qualifyingLevel(caster,this); final int lowestQualifyingLevel=CMLib.ableMapper().lowestQualifyingLevel(this.ID()); if(qualifyingLevel>=0) { final int qualClas...
bfef7d95-3148-4cca-acfe-fe3b190377b5
1
private void labelWebsiteUriMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelWebsiteUriMouseClicked try { URI website = new URI(this.websiteUri); openUriInBrowser(website); } catch (URISyntaxException ex) { ex.printStackTrace(); } }//GEN...
6370e793-16c9-4814-b08b-a169b616bbaf
0
protected final void resetCurrentFailure() { this.currentFailure.set(NO_FAILURE); }
ef18e6e5-bef6-4b31-b18c-ae59eabe524d
3
public char nextClean() throws JSONException { for (;;) { char c = next(); if (c == 0 || c > ' ') { return c; } } }
8c31a98b-d06f-44ef-8cb8-e8d0aad3f8ed
1
public static void main(String[] argsv) { // Setting op a bank. Bank christmasBank = new Bank(); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100))); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000))); // Print the balanc...
9b73a88e-0811-4154-988f-f7875ae585df
9
private static Member memberForSignature2(String s, boolean isCtor) { int openPar = s.indexOf('('); int closePar = s.indexOf(')'); // Verify only one open/close paren, and close paren is last char. assert openPar == s.lastIndexOf('(') : s; assert closePar == s.lastIndexOf(')') : ...
ab572b28-6781-44ab-800b-86014615862e
4
private String[] ubahStringKeArray(int batas, int maxBagian, String kata){ String[] temp= new String[maxBagian]; int j = kata.length(); int k; int banyakBagian = ((j % batas) == 0 ? (j / batas) :Math.round((j / batas) + 0.5f)); for(int i = banyakBagian - 1; i >=0 ; i--){ ...
16cae805-3811-4d18-a8d3-349344f5bbc3
3
public boolean replace(int index, T newV) { if (index < 0 || index >= size) return false; T oldV = heap.get(index).element(); heap.get(index).setElement(newV); if (comp.compare(oldV, newV) < 0) trickleUp(index); else trickleDown(index); return true; }
535b42c8-21be-4432-89a7-e70187b0bc51
3
public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); StringBuilder out = new StringBuilder(); while (in.hasNext()) { int size = in.nextInt(); if (size == 0) break; blocks = new Point[size]; for (int i = 0; i < size; i++) blocks[i] = new Point(in.next...
7b473479-0848-4ce6-b1aa-4b5c84228a0d
5
private int subscribeRdfFiles(final File folder) { int count = 0; for (final File fileEntry : folder.listFiles()) { if (fileEntry.isDirectory()) { subscribeRdfFiles(fileEntry); } else { String regex = "([^\\s]+(\\.(?i)(ttl|rdf|n3))$)"; if (fileEntry.getName().matches(regex)) { System.out.println...
18ce5368-4ada-4288-b3fd-72e7a041e597
0
public void setA(int a){ acceleration = a; }
e32f4c8a-b158-44be-ac69-362c6a528abf
6
public boolean isAccessible(Site other) { //everything that is accessible, is adjacent if (!isAdjacent(other)){ //log.info("Is not adacent"); return false; //check it is standable at the start } else if (!isWalkable()){ //log.info("Is not walkable")...
505e8f53-5df3-4ff6-b81f-d8340dcf983a
6
protected void placeC4() { if(C4Placed) { int n = listElements.size(); Element e; for(int i = 0; i < n; i++) { e = listElements.get(i); if(e.type == Type.WEAPONS) pushEvent(e, "C4"); } } else if(nbC4 > 0) { if(collisionElementList(((int)(x/32.0))*32+16, ((int)(y/32.0))*32+16, T...
de7a4f95-756c-4e71-b045-4d8c19b27593
5
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
06d23f1b-79da-487d-b65b-b15f928755dc
5
public static StringBuilder Htmlfullticket (Integer integer) { // Display the selected item String [] Array = FullTicket.searchFullTicket(integer); Object [] product = Comp.searchTicketProduct(integer).toArray(); //Set color for ticket status ...
da5aa8cd-8678-4b51-b284-b06a6bd70121
5
public int parse(CharsetDetector det) { int b; boolean ignoreSpace = false; while ((b = nextByte(det)) >= 0) { byte mb = byteMap[b]; // TODO: 0x20 might not be a space in all character sets... if (m...
73d95137-0f46-477d-9baf-f1dd3eebf971
0
public String getDesc() { return desc; }
bf3e63fa-bd7f-4ca5-835b-2681d31e3fcd
6
public boolean isUserAlreadyExists(String userId) { Connection connection = new DbConnection().getConnection(); ResultSet resultSet = null; boolean flag = false; Statement statement = null; try { statement = connection.createStatement(); resultSet = statement.executeQuery(IS_USER_ALREADY_EXISTS + userId...
3a67a753-783d-4752-9750-7b2ed01d244e
4
@Override public void run() { int run = 1; while (run == 1) { String message = ""; // Block and wait for input from the socket try { message = socket.readMessage(); if (message==null) { try { ...
03cc06b7-5ada-4b96-bdd4-0ed58f54fc09
4
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder builder = new StringBuilder(); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (charsToDelete.indexOf(c) == -1)...
0ce06022-dd69-4605-94e6-1b29bbe9f940
1
public void shutdown() { log.log(Level.INFO,"Starting Shutdown"); if(conLis != null) { conLis.end(); } disconnect(ALL()); serverStatus = ServerStatus.SHUTDOWN; log.log(Level.INFO, "Finished Shutdown"); }
5508e3eb-4c9d-4455-83f5-550b53570281
8
@SuppressWarnings("unchecked") @Override public Object run() { List<Map<String, Object>> filtered = new ArrayList<Map<String, Object>>(); if(source().containsKey(occurrenceField)) { List<Map<String, Object>> occurrences = (List<Map<String, Object>>)source().get(occurrenceField); addParsedOccurrenceFields(o...
bd22cf3c-25c0-463a-822a-8bba663a608d
4
void setBytes( String ur, String desc, String tm ) { try { setGrbit(); int pos = 32; // start of description/text input byte[] blankbytes = new byte[2]; // trailing zero word byte[] newbytes = new byte[pos]; System.arraycopy( mybytes, 0, newbytes, 0, pos ); // copy old pre-string data into ne...
e0726190-8bbe-4e60-9da6-cf20f168343e
9
@Override public int hashCode() { final int prime = 31; int result = 1; long temp; temp = Double.doubleToLongBits(apertureValue); result = prime * result + (int) (temp ^ (temp >>> 32)); result = prime * result + ((autoFocus == null) ? 0 : autoFocus.hashCode()); ...
820516a8-e910-43f5-8f9c-1e7d49caae31
3
public static void main(String arg[]) { // int[] sizes = {4}; // int index = 4; // int[] indexes = new int[1]; // // // for (int foo = 0; foo < 4; foo++) { // System.out.print(foo); // MmsParameter.figureOutIndexes(foo, sizes, indexes); // // for (int i = 0...
37bcaaf2-123a-48b2-807d-921f49e3c027
9
public static void main(String[] args) { final CircularBuffer<Integer> cb = new CircularBuffer<>(23); final Random randomizer = new Random(); final int MAX_MARGIN = 120_000; final CountDownLatch latch = new CountDownLatch(1); class Producer extends Thread { private ...
7f9481d4-4f54-41d5-b065-9942708f2a69
6
private List<Network> getNetworkDevices(Component component, SoftwareSystem system) { HardwareSet hardwareSet = null; List<Network> networkDevices = new LinkedList<>(); for (DeployedComponent deployedComponent : system.getDeploymentAlternative().getDeployedComponents()) if (deployedComponent.getComponent().equ...
04c53900-6dd0-417b-ac22-4c31f7b0921d
9
public void paint(Graphics g) { //the objects created above are made clickable with the mouseClicked method super.paint(g); final Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.white); g2d.setFont(new Font("Courier", Font.BOLD, 60)); g2d.drawImage(MenuBG, 0, 0, this...
bf7da58d-adcd-4808-8e77-3387be958f8c
2
public void InitGUI() { cmActionListener listener = new cmActionListener(); Container m_container = getContentPane(); m_container.setLayout(new FlowLayout()); JPanel optionsPanel = new JPanel(new GridLayout(UI_ROW,UI_COL)); m_container.add(optionsPanel); ...
cd2b8f84-4240-4a6a-ac61-799c89d8d193
4
public void createResources() throws GridSimRunTimeException { printRuntimeMessage("Creating resouces"); int currentResourceID = 0; for (GridSimResourceConfig resConfig: _config.getResources()) { MachineList machines = new MachineList(); int currentMachineID = 0;...
fc0a986d-f335-40bc-9a81-911439f31857
2
public Object[] GetColumnData(int columnNo){ if(!(columnNo<m_attributeCount)){ JPanel frame = new JPanel(); JOptionPane.showMessageDialog(frame, "Column Index out of bounds", "File error", JOptionPane.ERROR_MESSAGE); } else { m_c...
b68d619a-1e26-4055-938c-d73016296699
3
private synchronized void insert(Packet np, double time) { if ( timeList.isEmpty() ) { timeList.add( new Double(time) ); pktList.add(np); return; } for (int i = 0; i < timeList.size(); i++) { double next = ( (Double) timeList.g...
44522244-7a0d-49a1-a188-9dfb41e79347
7
public void receive(Object obj) { // TODO Parse all possible messages Event event = (Event)obj; int port; switch(event.type) { case "new game": port = (int)event.data; if (port==-1) throw new RuntimeException("could not create game, go back to main menu"); else { gui.joinGame(port); } ...
76b6a974-a04e-4d2d-a245-6a996621f8b2
5
public static void sendMe(MapleCharacter player, String msg) { MaplePacket packet; switch (player.getGMLevel()) { case 0: packet = MaplePacketCreator.serverNotice(6, "[Rookie ~ " + player.getName() + "] " + msg); break; case 1: pack...
8a3ee232-18fb-4428-8fc3-34f550b93322
7
private int getDimenMasLargo(){ int dim=0; LinkedList<Atributo> la=clase.getListaAtributos(); if ( la!=null ){ for ( int i=0 ; i<la.size() ; i++ ) { Atributo a = la.get(i); if ( a.toStringGrafico().length()>dim ) dim = a.toStringG...
6f07f71b-f903-4944-bdd5-1b8080aa74ef
6
public static <T extends RestObject> T getRestObject(Class<T> restObject, String url) throws RestfulAPIException { InputStream stream = null; try { URLConnection conn = new URL(url).openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X...
2da9fc87-3979-4688-b647-a3ff793f31db
8
final void method346() { if (anInt584 == -1) { anInt584 = 0; if (anIntArray558 != null && (anIntArray574 == null || anIntArray574[0] == 10)) { anInt584 = 1; } for (int i = 0; i < 5; i++) { if (actions[i] == null) { ...
a45979be-9e17-42b5-b901-648a7584156c
5
public Object open(final int coordX, final int coordY) { try { fr = new BufferedReader(new FileReader(new File(pathToDiagramsLogFile))); lines = new ArrayList<String>(); String line; while ((line = fr.readLine()) != null) { lines.add(line.re...
ca38a2c0-209a-4763-8ed6-808b1a1b9c98
1
public void setTarget( ItemKey<? extends Box> target ) { this.target = target; }
72749605-f204-4935-892e-d6cb69edb468
8
private JPanel createProcessorSettingsPanel() { final JPanel jp = new JPanel(); jp.setBorder(default_border); BoxLayout bl = new BoxLayout(jp, BoxLayout.PAGE_AXIS); jp.setLayout(bl); JComponent cp = new JLabel(UIStrings.UI_PROC_NAME_LABEL); setItemAlignment(cp); jp.add(cp);...
7eb279a6-616a-48b1-ab76-18a6d7f62842
6
private boolean fskFreqHalf (CircularDataBuffer circBuf,WaveData waveData,int pos) { boolean out; int sp=(int)samplesPerSymbol/2; // First half double early[]=doRTTYHalfSymbolBinRequest(baudRate,circBuf,pos,lowBin,highBin); // Last half double late[]=doRTTYHalfSymbolBinRequest(baudRate,circBuf,(pos+sp),lowB...
1c8efa65-7dc1-48f3-882f-73c7aa571e41
1
public int getPieceCount() { if (this.pieces == null) { throw new IllegalStateException("Torrent not initialized yet."); } return this.pieces.length; }
0c374b10-a417-4459-8c7f-f027f5f303dd
4
public void keyPressed(KeyEvent ke) { char keyPressed = ke.getKeyChar(); if(!world.inBattle()) { world.movePlayer(keyPressed); world.blockAppear(); if(!world.inBattle()) { if(world.isInStore()) { _controlPanel.switchToMenu(ControlPanel.MenuType.ItemShop); ...
2c22ab50-386b-496a-a53c-71b4bc6ad821
8
private void RdesremActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RdesremActionPerformed vtexto = Ctexto.getText(); DefaultTableModel tr = (DefaultTableModel)tabla.getModel(); try { Statement s = cone.getMiConexion().createStatement(); ...
f4068072-fc12-460b-b70e-1c68defa4ad1
3
public void onEnable() { if((citizensPlugin = (CitizensPlugin)Bukkit.getPluginManager().getPlugin("Citizens")) == null) { this.getLogger().log(Level.SEVERE, "Citizens not found. Disabling OWHQuests."); Bukkit.getPluginManager().disablePlugin(this); } if((worldGuardPlugin = (WorldGuardPlugin)Bukkit.get...
90526bc3-7bd9-4ac4-9579-0c9632835c6b
5
public void cleanNotDamaAvvicinando(){ //Se qualche dama si può avvicinare //Elimino le mosse che spostano dame lontano da pedine o dame nemiche if(haveSomeDamaAvvicinando()){ //Recupero il valore minimo di avvicinamento int min = this.getMossaMinAvvicinando(); for(int i=0;i<desmosse.length;i++) ...
c8544af1-6c57-4a0c-8664-f7f17944c6fb
8
public int numIslands(char[][] grid) { if (grid == null || grid.length == 0) return 0; g=grid; boolean[][] visited = new boolean[grid.length][grid[0].length]; for (int i=0; i<g.length; i++) { for (int j=0; j<g[0].length; j++) { visited[i][j] = fal...
f3adb912-a86b-4477-966c-7aa3e08f488c
7
public int transform(CtClass clazz, int pos, CodeIterator iterator, ConstPool cp) throws CannotCompileException { int index; int c = iterator.byteAt(pos); if (c == NEW) { index = iterator.u16bitAt(pos + 1); if (cp.getClassInfo(index).equals(cl...
8f6df1ce-e126-48b3-bbde-12afd29df53a
0
public void setPrezzo(Float prezzo) { this.prezzo = prezzo; }
c8bffd8a-a367-4f19-8ff8-9ef5febe37ef
2
public void showNotificationsToFile(FileWriter f) throws IOException { for (TimedPosts post : notifications) { long elapsedTimeInSec = (endTime - post.getTime()) / 1000000000; endTime += 1000000000; if (elapsedTimeInSec < 60) { int elapsedTime = (int) elapsed...
56dd30c9-bb48-478e-8d3d-ffb40ac24f40
4
public void setData(int row, int col, String data) { if (row < 0 || col < 0 || row > (getRowsCount() - 1) || col > (getColsCount() - 1)) { throw new IndexOutOfBoundsException(); } Vector theRow = (Vector)m_fileContent.get(row); theRow.setElementAt(data, col); ...
302953fe-6157-4571-aed0-b63f42992e3e
7
static void mainToOutput(String[] args, PrintWriter output) throws Exception { if (!parseArgs(args)) { return; } AdaptiveLogisticModelParameters lmp = AdaptiveLogisticModelParameters .loadFromFile(new File(modelFile)); CsvRecordFactory csv = lmp.getCsvRecordFactory(); csv.setIdName(id...
4083557d-2fd1-49ee-a115-00c8ff782c6f
9
public void addNum(int val) { Node node = new Node(val); if(!treeSet.add(node)) return; Node prev = treeSet.lower(node); Node next = treeSet.higher(node); if (prev != null) { node.prev = prev; prev.next=node; if ...
610b7d94-521f-41d0-bd2a-4a6b94a04e44
6
public byte[] packData() throws IOException { ExtendedByteArrayOutputStream out = new ExtendedByteArrayOutputStream(); out.putShort(this.indexOffset); for (ImageBean i : this.imageBeans) { int[] pixels = i.getPixels(); if (this.packType == 0) { for (int x = 0; x < pixels.length; x++) out.write(find...
f8d2b488-63c8-49eb-9ee0-897d993cda4d
0
public void servere(String message) { log(Level.SEVERE, message); }
41a60d3a-22f1-45d8-840d-5e8ec5d7fc42
7
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; boolean isPressed = getModel().isPressed(); boolean isRollover = getModel().isRollover(); int width = getWidth(); int height = getHeight(); Color[] tc = AbstractLookAndFeel.getThem...
c43601b5-7b61-45f3-86a4-d47117873db9
8
public static void handleEvent(int eventId) { // Changes focus to Main Ship Shop Menu if(eventId == 1) { System.out.println("Exit Ship Shop Weapons menu to Main Ship Shop Menu selected"); Main.ShipShopWeaponsMenu.setVisible(false); Main.ShipShopWeaponsMenu.setEnabled(false); Main.ShipShopWeaponsMenu....
065c6fd0-b3bf-458a-8acf-d4ef4d1b1799
5
private boolean transaccionBancaria(int cc,double m,Transaccion tp) throws IOException{ if( buscar(cc) ){ rCuentas.readInt(); rCuentas.readUTF(); long pos = rCuentas.getFilePointer(); double s = rCuentas.readDouble(); rCuentas.readLong(); ...
a6e747e6-2475-4578-bdf6-a30ae577ac92
6
private static boolean modifyEmployee(Employee bean, PreparedStatement stmt, String field) throws SQLException{ String sql = "UPDATE employees SET "+field+"= ? WHERE username = ?"; stmt = conn.prepareStatement(sql); if(field.toLowerCase().equals("pass")) stmt.setString(1, bean.getPass()); if(field.toLo...
d6d14b9d-3629-4801-ba68-b14a3493adfd
0
protected Element createStateElement(Document document, State state, Automaton container) { // System.out.println("moore create state element called"); Element se = super.createStateElement(document, state, state.getAutomaton()); se.appendChild(createElement(document, STATE_OUTPUT_NAME, null,...
dc3f04ef-eb0d-4817-85b7-b9130d8f4d89
8
public ListNode reverseKGroup(ListNode head, int k) { if (k <= 1 || head == null || head.getNext() == null) { return head; } ListNode prev = new ListNode(0); prev.setNext(head); head = prev; //find current position ListNode cur = prev.getNext(); ...
81a3781f-0314-4880-b7ae-8d87212462d0
5
public static int firstIndexOfSubstring(String s, String p) { int firstIndex = 0; int lastIndex = 0; while(lastIndex < s.length()) { // If there is an initial match, update firstIndex. if(s.charAt(lastIndex) == p.charAt(0)) firstIndex = lastIndex; // If we have searched beyond the length of the p...
51c1f286-b30a-43e0-bd39-c9c91a28a1bd
1
public void pushBack() { if (ttype != TT_NOTHING) /* No-op if nextToken() not called */ pushedBack = true; }
168de6e1-c1c6-4508-ac4b-a2dabbf48f53
1
public static FileConfiguration getChannels() { if (Channels == null) { reloadChannels(); } return Channels; }
2c5c86ca-d596-4375-a4ed-96792ce752da
8
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[4]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 0; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ...
d7ad775e-69af-42ff-acf6-eb2ae4c2e2d5
7
@SuppressWarnings("unchecked") static private void createNextLevel( final RowData rowData, final String path, final Data data, final SelectionManager selectionManager) { if(data.isPlain()) { String value = data.valueToString(); rowData.setValue(value); } else { if( data.isList()) { // kein Array ...
00a6b13e-930b-43a0-b63a-6897ce6acf18
6
public void run() { byte[] buffer = new byte[5000]; DatagramPacket packet; try { //Create a socket MulticastSocket socket = new MulticastSocket(port+1); InetAddress address = InetAddress.getByName("224.0.0.31"); socket.joinGroup(address); while (true) { packet = new DatagramPacket(buffer, buffe...