method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
234f9e64-30af-4b0f-85c0-ba7ef79dcf3b
2
private boolean checkConfigFileVersion() { boolean configOK = false; if(cHandler.getConfig().isSet("config_version")) { String configVersion = getConfig().getString("config_version"); if(configVersion.equals(usedConfigVersion)) { configOK = true; ...
04b678f0-f0f7-49cc-b0ab-a47ba051b023
8
public RegisterProvidedService() { setTitle("Servi\u00E7os Prestados"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 500, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JScrollPane sc...
0effcac3-a437-458f-98ae-845ba00ca548
5
@Override public void putAll(final Map<? extends GKey, ? extends GValue> map) { for (final Entry<? extends GKey, ? extends GValue> entry: map.entrySet()) { this.put(entry.getKey(), entry.getValue()); } }
ea3c0bf3-d964-4ae8-bd11-9c37c127d843
0
public void setId(Long id) { this.id = id; }
799a1ae1-e0e9-477f-95f1-1270565b882f
7
private void setNext() { initial = true; try { if (next != null) jar.closeEntry(); next = null; do { next = jar.getNextJarEntry(); } while (next != null && (next.isDirectory() || (filter == null || !filter.accepts(next.getName())))); ...
b1e7ec2e-1ac4-480c-8bd5-6c61ec6ac094
8
public static String getStat(Environmental E, String stat) { if((stat!=null)&&(stat.length()>0)) { if((stat.equalsIgnoreCase("REJUV")) &&(E instanceof Physical)) { if(((Physical)E).basePhyStats().rejuv()==PhyStats.NO_REJUV) return "0"; return ""+((Physical)E).basePhyStats().rejuv(); } e...
85cf6ac4-b4c1-4ebb-b4df-255005446e24
7
public Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Transactionnal annotation = method.getAnnotation(Transactionnal.class); // Make sure we're dealing with a @Transaction annotated method. if( annotation == null ) { return invocation.proceed(); } ...
7864bfa6-d3af-41d8-af01-de43d82a7359
7
@Override public void processNPC() { super.processNPC(); if (this.getCombat().underCombat()) { target = this.getCombat().getTarget(); } if (spawnTime + 300000 < Utils.currentTimeMillis() && !this.getCombat().underCombat()) { finish(); } if (target != null) { if (target instanceof Familiar) { ...
5628438f-922e-47fb-959e-2e83d3bda436
3
public static Dog getDog(String criteria) { if ( !criteria.equals("small") ) if ( criteria.equals("big") ) return new Rottweiler(); else if ( criteria.equals("working") ) return new SiberianHusky(); else return new Poodle(); return null; }
0614c051-3a22-4d7c-b4a6-d56151211dc8
0
public double getDistance() { return this.distance; }
fd7ececa-1967-4a1c-a307-45095e09a52a
8
private boolean checkDate(String paramDate) { if (paramDate == null || paramDate.equals("")) { errors.put("date-error", "Date cannot be blank!"); return false; } try { SimpleDateFormat parser = new SimpleDateFormat("dd.MM.yyyy"); date = parser.p...
ce67bef3-0fd7-4b8c-86ae-5b2989cc1521
3
public boolean waitClick() { while (true) { if (((Button)wdg()).isChanged()) return true; if (!JSBot.Sleep(25)) return false; } }
a5d57f6e-a9f2-45ed-9446-b173c0608daf
4
private void setCell(int x, int y, char cellValue){ if(x < fieldSize && y < fieldSize && x >= 0 && y >= 0) { field[x][y] = cellValue; } else { System.out.println("Wrong data in setCell"); } }
e8d0e39d-86e6-45e4-90e4-eb2dd32adc54
9
private void copyDecodedStreamBytesIntoRGB(int[] pixels) { byte[] rgb = new byte[3]; try { InputStream input = getInputStreamForDecodedStreamBytes(); for (int pixelIndex = 0; pixelIndex < pixels.length; pixelIndex++) { int argb = 0xFF000000; if (in...
9696c772-24e2-42a6-98ee-42e1b7fea2ce
0
public int value() { return i; }
7b7b33df-203d-4083-b7d9-891cec50b426
0
@Override public void setException(Exception exception) { this.exception = exception; }
36d31fde-b71c-409a-b4bb-89f75c3b22ce
0
public void setRecordCode(String recordCode) { this.recordCode = recordCode; }
adb7af8f-5f7e-42b4-80c5-c0496a8459c4
7
void calcMarginalProbabilities() { // calculate marginal probabilities int [] values = new int[m_nNodes.length]; int [] order = new int[m_bayesNet.getNrOfNodes()]; m_MarginalP = new double[m_nNodes.length][]; for (int iNode = 0; iNode < m_nNodes.length; iNode++) { order[m_nNodes[iNode]] = iNode; ...
de7de5c4-0df3-4e71-84b7-be8e5bbd43c3
0
public String getPassword() { return this.password; }
df3bff9b-c1f5-4073-aedb-c544d2599862
3
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; teamSelectionPanel = new javax.swing.JPanel(); jScrollPane3 = new javax.swing.JScrollP...
db2e08fd-d659-41c2-93b4-e3d147f89686
3
public Color getColor(Intersection i) throws Exception { if (i == null) { return Color.WHITE; } Color rtn = Color.BLACK; Material material = i.getMaterial(); Roughness roughness = material.getRoughness(); if (roughness != null) { i = roughness.perturb(i); } for (Light l : lights) { rtn = rtn.ad...
e29b4d7c-0156-4892-92f8-f1875a9abf8b
1
public static void addTreeWorker(TreeWorker tree) { if(savedTreeWorker==null)savedTreeWorker=new ArrayList<TreeWorker>(); savedTreeWorker.add(tree); }
ce1031cf-9fba-4ae2-887e-e235452664a2
0
@Override public Set<String> getWorlds() { return getList("worlds"); }
77419fe7-37a9-45ad-ab71-ec4e9636cb5e
3
public boolean setupConfig() { if (!getDataFolder().exists()) getDataFolder().mkdir(); File file = new File(getDataFolder(), "config.yml"); try { if (!file.exists()) { file.createNewFile(); ByteStreams.copy(getResourceAsStream("config.yml"), new FileOu...
b5965c6e-957d-4706-8f26-374855dd535b
4
public void setGestartet(boolean gestartet) { if(!gestartet && _gestartet) { _timer.cancel(); } else if(gestartet && !_gestartet) { _timer = new Timer(); _timer.schedule(_tickTimerTask, SpielKonstanten.ONE_SECOND, SpielKonstanten.ONE_SECOND); } _gestartet = gestartet; }
096b3b96-3068-424a-807e-06cab8465bbd
5
public int transactionAdded(int position, TransactionRecord transaction) { Date date = transaction.getDate(); int lastElem = listData.size()-1; int index, lowIndex, highIndex; // // Insert the new transaction based on the transaction date (position == -1) // or at the sp...
a229dd12-06cb-40ba-8e8f-3c0121cede45
9
private void updatePause(){ if(!paused){ for(int i = 0 ; i < players.length ; ++i){ if(players[i].physics.playerControl.isPaused()){ soundPlayer.sfxPause(); pausePlayer = i; paused = true; world.addDrawable(pauseDisplay, 3); pauseState = 0; b...
27b4d2be-5125-46c7-b541-3c38a012bcda
8
public static Livro getBook(int id) { if(id <= 0) return null; if(conn == null) getConnection(); Livro bookFound = null; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement("Select * from livros WHERE id = ?"); stmt.setInt(1, id);...
56d51380-efb5-4679-8ba6-19b2ba98b7cf
9
public static Test suite() { TestSuite suite = new TestSuite(MorfeuszTagsTest.class.getName()); try { LineNumberReader reader = new LineNumberReader( new InputStreamReader( MorfeuszTagsTest.class.getResourceAsStream( ...
f193db73-3f37-4fcb-bd02-0f5170b05247
0
@Override public String getNationality() { return super.getNationality(); }
ac9891c3-926b-4c14-b907-39a5d4001a4e
0
public boolean isAccept() { return type == ACCEPT; }
f0582fee-6e5a-4ef6-a16a-e0ff8a7e6280
9
public void run() {//int[] numbers, int low, int high) { System.out.println(low + ":" + high); int i = low, j = high; // Get the pivot element from the middle of the list int pivot = numbers[low + (high - low) / 2]; // Divide into two lists while (i <= j) { /...
d9a6054a-1b22-46cf-8879-e8c3a3501e2a
8
private String checkName(String fileName) { String sqlCommand = "SELECT * " + "FROM FileRecord " + "WHERE File_Name = ? " + "AND " + "UserID = ? " + "ORDER BY File_Name DESC"; String[] values = new String[]{fileName + "_*", "2"}; int append = 2; String temp = null; try ...
293fcd42-8dc2-490e-ae3d-e72d4451c9c1
6
private boolean available(int port) { if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { throw new IllegalArgumentException("Invalid start port: " + port); } ServerSocket ss = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ss.setReuseAddress(true); ds = new DatagramSo...
e87f2f46-8c4e-4229-b94c-61bf6c19715f
4
public void nextPermutation(int[] num) { int i = num.length - 2; int j = num.length - 1; while(j >= 1){ if(num[j] > num[i]){ // int tmp = num[i]; // num[i] = num[j]; for(int k = j+1, l = num.length - 1; k < l; ++k, --l){ ...
ecce2506-344f-4073-b688-29cba516e264
2
@Override public final int hashCode() { return (mFirst == null ? 22 : mFirst.hashCode()) ^ (mSecond == null ? 67 : mSecond.hashCode()); }
f46666b2-0808-4c5f-a331-2c63d058b923
4
public static void main(String[] args) { ExecutorService exec = Executors.newCachedThreadPool(); List<Future<String>> result = new ArrayList<Future<String>>(); for(int i = 0; i < 9; i ++) { result.add(exec.submit(new Sum(i, i + 1))); } for(Future<String> fs : result...
a818727c-d444-4390-8b8b-16de292f90c7
5
public synchronized void cancel(int index, int begin, int length) { Collection<Message> messagesToCancel = new LinkedList<Message>(); for (Message elem : messagesToBeSent) { if (elem.getType() == Message.PIECE) { Piece block = (Piece) elem; if (block.getIndex(...
5e74e689-25fb-49d5-980b-6f6da1a02f9e
5
public static Node mergeLists(Node head1, Node head2) { Node newhead = new Node(); Node p1 = head1; Node p2 = head2; Node p = newhead; while (p1!=null && p2!=null) { if(p1.value<p2.value) { p.next = p1; p1 = p1.next; } else { p.next = p2; p2 = p2.next; } p = p.next; } if (p1...
58ccb140-adfa-4974-af2d-fdf1aad24818
8
public boolean mouseUp(float x, float y){ if(getTexture() == down || (sticky && inBounds(x,y))){ if(inBounds(x,y) && active) trigger.fire(); if(active)setTexture((sticky) ? ((getTexture() == down) ? up : down) : up); return true; } return false; }
617414c0-4d7b-4067-90c1-afbdcff4729e
5
protected final JToolBar getFileToolBar() { if (this.tb == null) { ActionToolBar tb = new ActionToolBar(); this.tb = tb; Registry reg = getRegistry(); EditorActionManager eam = getEditorActionManager(); tb.add(false, eam.getNewAction()); tb.add(false, eam.getOpenAction())...
590880ee-8eeb-4cf0-8866-34bafbce7583
5
@Test (expected=NullPointerException.class) public void testValue_Integer_DoubleArrWithNullValue() throws Exception { Integer iteration = 0; try { System.out.println("value(Integer, Double[])"); Double[] sequence = this._series; sequence[2] = null; Ric...
21e459c4-5934-47bf-922a-9e05c43bbe14
2
public static UpdatePriority getPriority(int level) { for (UpdatePriority p : values()) if (p.level == level) return p; return null; }
9ca4b9cf-62e0-47ad-8be9-3138f67bf324
6
public static void recursionElement(Element element) { String elementname = element.getTagName(); System.out.print("<" + elementname); NamedNodeMap nnm = element.getAttributes(); if(null != nnm) { for(int i = 0 ; i < nnm.getLength(); i ++) ...
9a9b87ff-55a8-47b2-8617-c559ad9f20a9
6
public boolean actionPerform(Actor actor, Venue venue) { // // Firstly, calculate the effectiveness of the actor's own performance- float effect = 0 ; for (Skill s : PERFORM_SKILLS[type]) { final int DC = s == PERFORM_SKILLS[type][0] ? MODERATE_DC : ROUTINE_DC ; final boolean success = acto...
66578357-b0b0-40f5-a667-534a5321c66c
4
public void drawTo(PPMEC PPM) { int c = (int) (xRatio * PPM.getWidth()); // get x-coord int r = (int) (yRatio * PPM.getHeight()); // get y-coord int radiusOut = (int) (radiusOutP * PPM.getWidth()); // Radius of R. int radiusIn = (int) (radiusInP * PPM.getWidth()); // Radius of R. for (int i = 0; i < PPM.getHe...
a6531319-5b90-4507-b4dd-e2be22287814
7
private void forwardEventToButton(MouseEvent e) { TableColumnModel columnModel = table.getColumnModel(); int column = columnModel.getColumnIndexAtX(e.getX()); if(column!=4)return; int row = e.getY() / table.getRowHeight(); Object value; JButton button; MouseEvent buttonEvent; if(row >= table.getRowC...
c2978794-bdad-4893-8cc1-6c81e75eb0e9
4
public static void getNames(String path) throws Exception { String file = readFile(path); Document doc = Jsoup.parse(file); Elements eles = doc.select("table > tbody > tr > td > table > tbody > tr > td > span.page > nobr > a > b"); for(Element ele : eles) { String nameText = ele.text(); i...
29713310-409a-46ba-92d8-a1f832915d86
7
public String executeCommands(Object object) { String command = null; Scanner inFile = Connect4.getInputFile(); do { try { this.display(); // display the menu // get input command = inFile.nextLine(); command = command.trim()....
007707c7-b9be-4ec6-a0ed-d312c7e19931
9
public void onTouchMovingBrick(){ Actor actor = null; boolean unused = (actor = getOneObjectAtOffset(-1, 4, MovingBrickLeft.class))!= null || (actor = getOneObjectAtOffset(0, 4, MovingBrickLeft.class))!= null || (actor = getOneObjectAtOffset(1, 4, MovingBrickLeft.class))!= null; ...
06f52929-c2e7-40c4-9b39-e9d9bdff37fa
9
public static void compareMomentumLearningSpeed(String filename, int reps, int epochsPerRep, int printFrequency, ANN ann, double[] mentums, double[] lisps, double[][] inputs, double[][] outputs) throws IOException { int numDataPoints = epochsPerRep/printFrequency; int mloc = reps/2; File file = new File(filena...
bccd8a69-9619-43f6-b99b-1d7688b75055
9
public void setSelectedIndex(JComboBox cb, int iSelected, boolean execute) { if (execute) { cb.setSelectedIndex(iSelected); } else { ActionListener[] al = cb.getActionListeners(); if (al != null) for (ActionListener x : al) cb.removeActionListener(x); ItemListener[] il = cb.getItemListeners()...
2d38b4ce-2a59-4a06-8fb7-9d0415b95418
0
public ServerStopEvent(Object server) { super(server); }
e649df13-d846-4ee7-87a7-616d6a7a7a9c
0
public RandomByteFilter(final ConnectionProcessor proc, final Properties props) { super(proc, props); requireConfigKey(probability_key); probability = Float.parseFloat(props.getProperty(probability_key)); }
14e113f1-1a87-40f4-9fc4-4781c4bccc44
1
public void testConstructor_RP_RI8() throws Throwable { DateTime dt = new DateTime(TEST_TIME_NOW); Period dur = new Period(0, 0, 0, 0, 0, 0, 0, -1); try { new MutableInterval(dur, dt); fail(); } catch (IllegalArgumentException ex) {} }
fd19cfb9-602d-4b39-a5b9-080449cf923e
1
public InnerClassInfo[] getExtraClasses() { if ((status & INNERCLASSES) == 0) loadInfo(INNERCLASSES); return extraClasses; }
d4ecc45b-de92-41d6-86c6-db908f4630e8
2
public boolean getBoolean(String key, boolean def) { if(fconfig.contains(key)) { return fconfig.getBoolean(key); } else { fconfig.set(key, def); try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); } return def; } }
c98761c2-8e21-4ee8-93d0-0a4acdc6c6e8
3
private void outputDialog(JTextPane pane){ Scanner fileScanner; System.out.println("Default Output Rule File Path: " + outputRuleFilePath); //Input File /* try { if(!inputFilePath.contains("src/")){ inputFilePath = "src/" + inputFilePath; } fileScanner = new Scanner(new FileInputStream(inpu...
dcfff814-8d36-49d6-8e93-a151853768ef
5
private int jjMoveStringLiteralDfa31_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjMoveNfa_0(0, 30); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return jjMoveNfa_0(0, 30); } switch(curChar) { case 56: return jjMoveStringLiter...
74fe5272-81cd-415e-bbc7-0961b9759a0d
3
public int checkmods() { try { BufferedReader in = new BufferedReader(new FileReader("./data/moderators.txt")); String data = null; while ((data = in.readLine()) != null) { if (playerName.equalsIgnoreCase(data)) { return 5; } } } catch (IOException e) { System.out.println("...
3ffce39e-5dfb-4f6d-bfda-30281f59a395
5
@Override public void callEvent() { super.callEvent(); if (!queue.isEmpty()) queue.add(null); while (!queue.isEmpty() && recursionDepth > 0) { final String name = queue.poll(); if (name == null) { recursionDepth--; if (!queue.isEmpty()) queue.add(null); } else { final Cra...
eda3cb06-d52a-40b8-b3c5-d03c0f7a016e
0
public void setUrl(URL url) { this.url = url; }
36c3f0b6-2573-4953-90a6-e9c9bab1f0f4
4
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative"); if (semiMinorAxis < 0) throw new IllegalArgumentException("ellipse semiminor axis must be nonnegative"); ...
43879c72-1c00-40dd-a657-f407edef0a60
3
private void jPasswordField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jPasswordField1KeyPressed if (evt.getKeyCode() == 38) { txtMother_Name.grabFocus(); } else if (evt.getKeyCode() == 40) { btnSave.grabFocus(); } else if (evt.getKeyCode() == 37) { jTextField1.grabFo...
b5acb09e-8164-4448-926f-73402c323e83
0
public void setNewMarkPosition(int newMarkPosition) { this.newMarkPosition = newMarkPosition; }
cbd9ef1c-565e-44bd-b02a-c72b4a653404
8
public boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) { return false; } if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2...
ef974d7b-26c3-48ac-9093-bc832740cf03
2
public static BSPlayer getSimilarNickPlayer(String nick) { for ( BSPlayer p : onlinePlayers.values() ) { if ( ChatColor.stripColor(p.getNickname()).toLowerCase().contains( nick.toLowerCase() ) ) { return p; } } return getSimilarPlayer(nick); }
5b644401-9eae-4e0a-97a9-db0e26e3f788
0
public File getAlgorythmFile(){ return algorythmFile; }
40a176c2-a4e7-4464-b325-9c2040daad59
0
public int pin_count() { return(pin_cnt); } // end pin_count()
ba63488d-cacf-49e3-856a-013536dbbc6a
5
public String convertToReference(char character) { if (character < 1000 || (character >= 8000 && character < 10000)) { int index = (character < 1000 ? character : character - 7000); String entityReference = this.characterToEntityReferenceMap[index]; if (entityReference != null) { ...
3b31a4ed-835a-4206-a478-4f34aa605fb6
3
public static int solve(int s) { for (int m = 2; m < Integer.MAX_VALUE; m++) { for (int n = 1; n < m; n++) { int a = m * m - n * n; int b = 2 * m * n; int c = m * m + n * n; if (s % (a + b + c) == 0) { int k = s / (...
9102f0a8-b7ea-4444-ae78-25fece0bef80
3
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
d0135be2-445f-48fa-abef-07a9bb72d5ea
5
public void removeSuccessor(Jump jump) { SuccessorInfo destInfo = (SuccessorInfo) successors .get(jump.destination); Jump prev = null; Jump destJumps = destInfo.jumps; while (destJumps != jump && destJumps != null) { prev = destJumps; destJumps = destJumps.next; } if (destJumps == null) throw n...
13a2dd96-1cc8-4286-b5db-a56ec54a9d6d
6
ArrayList<movePair> possibleMoves(Point[] grid, Pair pr) { ArrayList<movePair> possible = new ArrayList<movePair>(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { Point currentPoint = pointAtGridIndex(grid, i, j); if (currentPoint.value == 0) { continue; } for (Pair d : direction...
af921e12-82fe-4232-b3ed-3b3e03af03a9
6
public String getArgs() { datapattern.setEnabled(true); if (random.isSelected()) datapattern.setArgument("random"); else if (sequenced.isSelected()) datapattern.setArgument("sequenced"); else if (ascii.isSelected() && !word.getText().equals("")) datapattern.setArgument("ascii " + word.getText()); els...
ebfa9a48-0815-4487-bf68-99b71d5bbe7b
5
private void persist() { // File file = new File(NAMOO_CLUB_DAT); File dataFolder = file.getParentFile(); if (dataFolder.exists() == false) { dataFolder.mkdirs(); } FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream(file); oos = new ObjectOutputStre...
d764e462-ab44-41a2-90ae-9a07299a0348
6
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 ...
2843cc1a-fa98-4fb1-9bd6-f4a5e15079e0
4
public void newFocus(){ int x1 = x - 20; int y1 = y - 20; int x2 = x + 20; int y2 = y + 20; if (x1 <= 0) {x1 = 0;}; if (y1 <= 0) {y1 = 0;}; if (x2 >= 1023) {x2 = 1023;}; if (y2 >= 1023) {y2 = 1023;}; Console.log(x1+" "+y1+" "+x2+" "+y2); focuspoint = iRandom.nextPosition(x1,y1,x2,y2); }
b792049f-19d2-4067-8d27-b4c702c95200
5
public void calculate(final int centerX, int centerY, final int distance) { int x_off, y_off; final ShadowList shadows = new ShadowList(); final ShadowList formerShadows = new ShadowList(); for(int octant=0; octant < 8; octant ++) { Matrix tran...
86af186f-a5d9-430c-a0cc-1bfecf9a4df9
8
private Object getValueWithCorrectType(int fdIndex, Object data){ Object valueWithType = data; int type = fdSchema.getTypes().get(fdIndex); switch (type) { case SeColumnDefinition.TYPE_INT16: valueWithType = Short.parseShort((String)data); break; case SeColumnDefinition.TYPE_INT32: valueWithType = In...
adf8e24e-db27-4d8f-bc1d-5d2d08c2082c
6
public static int getColumnNumber(char columnToConvert) { int column = 100; switch (columnToConvert) { case 'a': case 'A': column = 0; break; case 'b': case 'B': column = 1; break; case 'c': case 'C': column = 2; break; default: column = 99; break; } return column; }
f676be26-4d86-4864-8817-a5ebbff64bde
0
public OutlinerDesktop() { super(); //setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); setDesktopManager(new OutlinerDesktopManager()); }
7e5a9cb3-3e94-4cd1-85e5-e3b04e7d80ad
2
public ArrayList<User> getFriendList() { ArrayList<User> friendList = new ArrayList<User>(); try { String statement = new String("SELECT * FROM " + FriendDBTable + " WHERE uid1 = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, userID); ResultSet rs = stmt.execu...
8b077981-b6da-4b13-9aca-a0db842d5abb
4
public static void updateDB(Ecran e){ int reply = JOptionPane.showConfirmDialog(null, "Voulez vous mettre a jour la base de donnee ?"); if (reply == JOptionPane.YES_OPTION){ File file = new File("model"); for (File f : file.listFiles()) { try { GestionBDD.insertModel(f.getPath()); } catch (Exc...
74c8eb9c-33e3-45e9-943d-4ef0dddfb94b
9
private boolean doesIntersectInternal(AbstractLineSegment other) { final double d1 = direction(other.getP1(), other.getP2(), this.getP1()); final double d2 = direction(other.getP1(), other.getP2(), this.getP2()); final double d3 = direction(this.getP1(), this.getP2(), other.getP1()); final double d4 = direction...
ba22e906-f59c-413b-b02e-ddb94e2b91fa
9
private void _setRunType(Document document, String item) { NodeList nlist = document.getElementsByTagName("user"); if (nlist.getLength() > 0) { Element user = (Element)nlist.item(0); NodeList newlist = user.getElementsByTagName(item); if (newlist.getLength() > 0) { Node node = newlist.item(0).getFirstC...
b7c588db-bd7b-4ca7-b590-dd45af5c9979
3
private void loadUsers() { try { File dir = new File(getDataFolder(), "usertmp"); if (!dir.exists()) return; for (File file : dir.listFiles()) { FileReader reader = new FileReader(file); Gson gson = new Gson(); The5zigModUser user = gson.fromJson(reader, The5zigModUser.class); users.add(user)...
afdf221e-5da3-40ad-8d59-b4a9a0401fc7
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...
03d39f18-f747-4631-9c0a-408c1988e724
5
public boolean play( Player gambler ) { boolean retBoo = false; double health = gambler.getHealth(); int count = 0; while (gambler.getHealth() > 0 && count < MAX_ROUNDS) { playTurn( gambler ); System.out.print("Do you wish to play another round? You have a maximum of " + (MAX_...
bb535bce-ea62-471f-95fd-c912b07aa049
3
private Edge edgeWithCenters(Center c1, Center c2) { for (Edge e : c1.borders) { if (e.d0 == c2 || e.d1 == c2) { return e; } } return null; }
2e1f7a53-10f6-4947-beef-e532bb53158d
9
public static boolean isPrimitive(Class<?> type) { return type.isPrimitive() || type == Integer.class || type == Boolean.class || type == Long.class || type == Double.class || type == Character.class || type == Byte.class || type == Float.class || Number.class.isAssignableFrom(type); }
354cfe1d-2ac8-4f96-8b96-035e164b9e96
5
public static void borderize(MapView mv, Gob player, Coord sz, Coord border) { if (Config.noborders) { return; } Coord mc = mv.mc; Coord oc = m2s(mc).inv(); int bt = -((sz.y / 2) - border.y); int...
fce790ef-ee3f-4a6d-b66d-100462519a56
3
@Override public ByteBuffer getMessage() { for (int i = 16; i < 20; i++) { uiMode[i] = (short) 0xffff; } uiSetVoltage[1] = (short) 0x1999; ByteBuffer buffer = ByteBuffer.allocate(86); buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.putShort((short) 0xaaa0); // sig buffer.putShort((short) 86); ...
3654ce3d-05ab-4ca1-936e-c1abd4cec215
0
public void setId(int id) { this.id = id; }
406d79af-41fe-4b6d-8785-9010bd7f23b5
1
public void constrcut(Builder builder) { if (builder != null) { builder.buildPartA(); builder.buildPartB(); } }
68f3045b-89cd-4f28-aa53-8d2664b95b90
4
public static void main(String[] args) throws IOException { Validate.isTrue(args.length == 1, "usage: supply url to fetch"); String url = args[0]; print("Fetching %s...", url); Document doc = Jsoup.connect(url).get(); Elements links = doc.select("a[href]"); Elements medi...
cead52fa-8411-4f81-8cdb-e5c7c473b474
2
public boolean fieldsEmpty() { String met = MetSearch.getText(); String con = ConSearch.getText(); String pop = PopSearch.getText(); return (met.equals("") && con.equals("") && pop.equals("")); }
c2389d49-f12f-48e1-8a43-06a57a0a80f0
5
private static NetworkInteraction sendReceive(NetworkInteraction interaction) throws IOException { TaskTree tree=null; Socket socket=null; ObjectInputStream in = null; ObjectOutputStream out = null; NetworkInteraction readInteraction=null; try { SERVER_ADDRESS...
75414593-9efb-4a31-a7af-5a455104e556
5
public boolean faire() { int res = this.itineraire.calculerTournee(); if(res == 0){ //Solu opti trouv�e // this.controleur.vueAppli.afficherMessageInfo(Constantes.SUCCES_CALCUL); System.out.println(Constantes.SUCCES_CALCUL); return true; } else if(res == 1){ //Solu non optimal trouv�e // this.control...
29635737-5f35-4a14-ad54-070e46666721
9
public void balanElimDer( Retorno retorno ) { switch( balance ) { case BIZQ: balance = BAL; retorno.respuesta = this; break; case BAL: balance = BDER; retorno.diferenciaAltura = false; ...