method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
29590399-8342-407a-9a96-e2705e029299
7
private void jComboBoxOperacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxOperacaoActionPerformed switch (jComboBoxOperacao.getSelectedItem().toString()) { case "GET": jLabelValor.setEnabled(false); jTextFieldValor.setEnabled(false); ...
59a50abc-d34d-4a2f-ac7a-c81e75ae6d07
6
@Override public double getPixel(int x, int y, ChannelType channel) { switch (channel) { case HUE: case RED: return hue.getPixel(x, y); case SATURATION: case GREEN: return saturation.getPixel(x, y); case VALUE: case BLUE: return value.getPixel(x, y); default: throw new IllegalStateException...
01a850a1-93e2-4e5e-8e0f-10468f65b7c6
1
private static void generateUsecaseHtml(List<Object[]> values) throws IOException { File htmlOut = new File(getOutputDir(), "index.html"); OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(htmlOut, false), "utf-8"); writer.write("<html>\n"); writer.write("<head>\n")...
e84ac65f-f186-4c6e-890f-60efb07b72f3
9
private void testDropDowns(String v) { // if both max values and max strings have been initiated if (maxValue.getSelectedItem() != null && maxValue.getSelectedItem().toString() != null) { // if both max values and max strings have been initiated if (minValue.getSelectedItem() != ...
583dc364-b293-4e98-bf15-eec58f4ff35e
3
@Override public void setLocation(int locX, int locY) { int deltaX = locX - getLocationX(); int deltaY = locY - getLocationY(); super.setLocation(locX, locY); if (solidified) { for (GUIComponent component : subComponents) { component.translate(deltaX, de...
7b2e9f7e-1042-43c6-bdaa-cc7d4697fb71
9
public int Get_clr(int x, int y) { if(x<0||x>6||y<0||y>5) return ChessBoard.OUT; short tmp = this.board[y]; int a0 = ((tmp&(1<<2*x))==0)?0:1; int a1 = ((tmp&(1<<(2*x+1)))==0)?0:1; switch (a1*2+a0){ case 0: return ChessBoard.EMPTY; case 1: return ChessBoard.RED; case 2: return ChessBoard.BL...
1c2ead8b-ad2d-44e2-8d0c-c0525cce0eed
9
@Override public String toString() { final StringBuilder sb = new StringBuilder(); if (lowerBounds.length > 0) { final Type lowerBound = lowerBounds[0]; if (lowerBound instanceof Class<?>) { sb.append("? super ").append(((Class<?>) lowerBound).getName()); ...
3fa36913-f586-481f-86ef-d9068d386cfb
7
protected void sendResponses() { if(responses != null) { Object obj; for(int i=0; i < responses.length; i++) { if(delay > 0) Util.sleep(delay); obj=responses[i]; if(obj == null) { ...
4dfd52a0-d1ad-4f96-8115-8131ed84552c
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); targetId = buf.readInt(); destinationCellId = buf.readShort(); if (destinationCellId < -1 || destinationCellId > 559) throw new RuntimeException("Forbidden value on destinationCellId = " + destination...
76e4a693-77ca-4827-9f2f-9ac6bcf86378
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
11915a87-57c4-41da-8f32-1c50855585e3
8
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); String[][] rep; d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; int times...
6ea55ed1-e2b6-4f4c-b0c2-57ee301b8a73
4
private static void dfsGRev(Integer startNode) { // mark node i as explored nodes[startNode.intValue()] = 1; // find edges with start node as tail and another node as head in G-rev List<Integer> heads = reverseEdges.get(startNode); if(heads != null) { Iterator<Integer> headsIterator = heads.iterator(); ...
e42d6ae2-5ecb-4b29-b96a-945ca3f829ca
6
public void visitBaseType(final char descriptor) { if (type != TYPE_SIGNATURE || state != EMPTY) { throw new IllegalStateException(); } if (descriptor == 'V') { if (!canBeVoid) { throw new IllegalArgumentException(); } } else { if ("ZCBSIFJD".indexOf(descriptor) == -1) { throw new IllegalArg...
e3b2f2c6-2260-451b-8b4c-88fa321497f1
8
public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); TreeSet<Integer> primos = new TreeSet<Integer>(); boolean[] arr = new boolean[32769]; int[] arr1 = new int[32769]; for (int i = 2; i < 32768; i++) if(...
ec2ca56a-9d9b-4270-977a-12a6218907f3
4
public void mouseMotion(Point p){ if(headingLbl == null){ return; } if(refreshBtn.getLabel().getBounds().contains(p)){ refreshBtn.changeTextTo(btnFontMotion, btnColorMotion); }else{ refreshBtn.revert(); } if(backBtn.getLabel().getBounds().contains(p)){ backBtn.changeTextTo(btnFontMotion, b...
354805a2-9056-4e4d-b9b4-ed25b3857f43
0
@Override public Address getAddress() { return super.getAddress(); }
01ff7417-91d8-4fbd-8fbe-a65f36cea470
8
private void trim() { char ch='A'; for (int i=0; i<prods.length; i++) { String lhs=prods[i].getLHS(); if (ch=='S' || ch=='T') { ch++; } int aa=lhs.indexOf("V("); while (aa>-1) { // System.out.println("in 1st "+lhs+"===> "); int bb=lhs.indexOf(")"); String var=""; if...
4860aad9-6428-4c3f-b0e3-cae3bd8e0b15
9
public static void superman_update_palette() { char[] palette_map = new char[32]; /* range of color table is 0-31 */ int i; memset(palette_map, 0, sizeof(palette_map)); /* Find colors used in the background tile plane */ for (i = 0; i < 0x400; i += 0x40) { int i2; ...
8e84b715-3148-4126-be0b-6dd1160d7ed8
0
public GiftCard(int amount) { this.acceptability = new AcceptedSelectLocation(); this.balance = amount; }
efe9e478-a1fd-48f5-9b15-c19f325bd58c
2
public IdStatementGenerator(AdapterBase adapter, ObjectStack oStack, Clause[] clauses, boolean addJoins) { this.adapter = adapter; this.addJoins = addJoins; this.asGenerator = new AsStatementGenerator(this.adapter); this.addTablesToJoin(oStack); if (addJoins) { Node linker = oStack.getNode(Object.cla...
0e00447d-d0e7-4acd-8139-cc7397f0c53a
4
private void calculate_distribution() { int[] occurance = new int[max_in_degree+1]; for(int i=0;i<max_in_degree+1;i++) { occurance[i] = 0; //pk[i] = occurance[i]*Math.log(Math.E); } float[] pk = new float[max_in_degree+1]; int edges = 0; int max = 0; for(Node n : graph.getNodes()) { if(max ...
e1478b57-2575-413e-827f-8c676f84ce26
0
private synchronized boolean isStopped() { return this.isStopped; }
5cdd0f74-75a6-44e5-9a40-a1a3df231bc5
7
public static String readLine(Socket s) throws IOException { //Reads data into buffer until newline is found, ignoring special characters and using backspaces properly String buffer = ""; InputStreamReader in = new InputStreamReader(s.getInputStream()); char inChar; while (true) { inChar = (char)in.read...
a3f5cd72-8ee7-4d7b-8e5f-4570cff7ca78
5
@Override public List<SondageReponse> findAll() { List<SondageReponse> listS = new ArrayList<SondageReponse>(); Statement st = null; ResultSet rs = null; try { st = this.connect().createStatement(); rs = st.executeQuery("select * from SondageReponse"); ...
e20549f7-01ad-4f16-aed8-afc00da361ce
5
private void heapifyDown(int index) { int leftChildIndex = index * 2 + 1; int rightChildIndex = index * 2 + 2; int swapIndex = index; // if left child exists and greater than current node if (leftChildIndex < currentIndex) { if (heap.get(leftChildIndex).compareTo(heap.get(swapIndex)) > 0) swapIndex ...
c1f1a5da-eb9e-4a0e-90f0-7d9ed167ffde
8
public void colorierPivot(String pivot) { ligne_pivot = Integer.parseInt(pivot.split(",")[0]); col_pivot = Integer.parseInt(pivot.split(",")[1]); for(int i=0;i<labels.size();i++) { for(int j=0;j<labels.get(i).size();j++) ...
6762915e-304d-4f3a-8ba3-d2bd206c64d4
7
public boolean isInteger(String str) { if (str == null) { return false; } int length = str.length(); if (length == 0) { return false; } int i = 0; if (str.charAt(0) == '-') { if (length == 1) { return false; ...
239aed9f-6c82-4bb9-8be8-fc9d98f9030b
6
@Override public final boolean next() throws IOException { if (position++ >= size - 1) { prevBuffer.set(termBuffer); termBuffer.reset(); return false; } prevBuffer.set(termBuffer); termBuffer.read(input, fieldInfos); termInfo.docFreq = input.readVInt(); // read doc freq t...
b8cb2997-180b-4768-aef1-861f593918bb
9
final public String renameexpr() throws ParseException { /*@bgen(jjtree) RENAME */ SimpleNode jjtn000 = new SimpleNode(JJTRENAME); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; String s; String rename = ""; try { t = jj_consume_token(RENAME); rename += t.image.toString(...
0329ccd6-9666-48e5-8f01-d526a7411539
9
@Override public String getLastWord(StringBuffer buf, int lastSp, int lastSpace) { String lastWord=""; if(lastSp>lastSpace) { lastWord=CMStrings.removeColors(buf.substring(lastSpace,lastSp)).trim().toUpperCase(); while((lastWord.length()>0)&&(!Character.isLetterOrDigit(lastWord.charAt(0)))) lastWord...
274ad5e2-b547-4b8d-88d3-abed4975408a
0
public void setInitialP(Point initialP) { this.initialP = initialP; }
538dd3ca-1b70-4a15-93ac-d7c6b4c582d8
2
private static Method searchInterfaces(Class clazz, String name, String desc) { Method m = null; Class[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { m = findSuperMethod2(interfaces[i], name, desc); if (m != null) retur...
b9a1339c-acd5-4806-b324-b087e17239e8
5
private void updateSuccessors() { bottomOfTableRow.clear(); bottomTable.clear(); for ( String state : topOfTableRow ) { ArrayList<String> successors = getSuccessors(state); for (String successor : successors) { if (!topOfTableRow.contains(successor) && !bottomOfTableRow.contains(succe...
23f14739-ab61-4728-bdb1-a10354d98933
0
public int getStep() { return step; }
863cfd76-2f03-4f75-b9b8-01bfeb0ff4bf
3
public void run() { try { File myFile = new File("WriteTest.txt"); FileReader fileReader = new FileReader(myFile); BufferedReader reader = new BufferedReader(fileReader); String curLine = null; String[] words = null; while ((curLine = reader.readLine()) != null) { words = curLine.split("...
b1e83ab9-7c9d-45c9-938b-f9f36f18a8d1
7
static public void waitOn(Object o) { // System.out.println("About to wait on " + System.identityHashCode(o)); MultithreadedTestCase thisTestCase = currentTestCase.get(); if (thisTestCase != null && thisTestCase.failed) throw new RuntimeException("Test case has failed"); if (skipNextWait.get()) { skipNext...
a4df0325-410b-4078-9e97-3e7bd6af972c
0
@RequestMapping(method = RequestMethod.GET) public String statusView() { return "termsPage"; }
9bcef514-1429-4c54-8f04-a847dd71b2b9
3
private boolean blackCanEnPassantRight( int position ) { return ( this.previousMove != null && pieceTypeAt( position - 1 ) == PAWN && this.previousMove.from() == ( position - 33 ) && this.previousMove.to() == ( position -1 ) ); }
6a034226-3bf3-4293-8915-a30ad7791993
3
private final void changeNumbering(final Set<Path> selection) { final TreeSet<Path> selectionFiles = selectFilesOnly(selection); for (final Path song : selectionFiles) { final SongChangeData data = get(song); final NumberingGUI plugin = new NumberingGUI(data, this.io, "Renumbering"); if (this.master.i...
692f66ba-9802-44f9-bdb5-0408160c626b
2
public void dfs(int vertex) { visited[vertex] = 1; componentIDs[vertex] = id; ArrayList<Integer> neighbors = graph.getAdjacenctVertices(vertex); for (int i : neighbors) { if (visited[i] == 0) { dfs(i); } } visited[vertex] = 2; }
4ac1e41e-ae24-4114-af79-b0ffef45edaf
8
private void processItemResponse(OMMItemEvent event) { OMMMsg responseMessage = event.getMsg(); ItemClosure itemClosure = (ItemClosure)event.getClosure(); int itemIdx = itemClosure._idx; // update; onpass to providerNI only if a refresh had been received // previously ...
d3ab1119-76e3-4bba-b1c0-6bd5c3f38d87
9
public int getIntSurroundedByWhitespace() { int num = 0; boolean makeNegative = false; boolean readNonWhitespace = false; try { while (true) { int curr = reader.read(); if (curr < 0) break; if (Character.isWh...
c7b56b5a-700a-40a6-9914-6371fbcfeae2
7
public boolean cropToFutureOf(LocalDateTime toDate) { int cropToDateNum = new ConverterToInteger().convert(toDate); ArrayList<Occurrence> emptyDomain = new ArrayList<>(); for (Iterator<Occurrence> it = definition.problemOccurrences.iterator(); it.hasNext();) { Occu...
49c51670-09e5-4c0d-888b-5778f76dff5b
2
public static void main(String args[]) { long begin=System.currentTimeMillis(); int total=219521; int limit=20000; ExecutorService executorService = Executors.newFixedThreadPool(total/limit); for(int i=0;i<=total/limit;i++) { String name="T"+i; executorService.execute(new SetIDF(name,i*limit,limit));...
e1e4be22-806c-46e7-a8b3-30edad9a5743
9
private String inserSql(List<Object> params, Object object) throws Exception { StringBuilder sql = new StringBuilder(); sql.append("INSERT INTO "); Class<?> cl = object.getClass(); // Get table name annnotation Table table = cl.getAnnotation(Table.class); if (table == nul...
f02c50a5-f7a5-41a5-9882-bc3609ba4299
4
private void processMigrateCommand(String[] args) { if (args.length <= 2) { System.out.println("usage: mg PROCESS_ID HOSTNAME"); } else { long id = Long.parseLong(args[1]); String hostName = args[2]; MigratableProcess process = getProcess(id); ...
1dc85b6a-3088-49e8-8d19-ed810984e9c7
4
public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Digest digest=new Digest(); JOptionPane prompt=new JOptionPane(); if(e.getSource()==choiceFile){ fileChooser.showOpenDialog(this); fileSource.setText(fileChooser.getSelectedFile().toString());//显示选择的文件名 }else if(e.getSource...
ee8950a1-9427-4cc1-b5ff-4331e1989e04
8
public Result fromJSON(JSONObject json, int version) { try { if(version > Privileges.JSON_VERSION) return IJson.Result.OUTDATED_APP; allowances = new ArrayList<String>(); denials = new ArrayList<String>(); if(version >= 1) { name = json.getString("name"); JSONArray jsonAllow =...
49ed3fae-889e-4fd5-9d12-58f0954538e3
3
private void doEditXinWen(HttpServletRequest request, HttpServletResponse response, boolean isEditUser) throws ServletException, IOException { String xinwenId = StringUtil.toString(request.getParameter("xinwenId")); if(!StringUtil.isEmpty(xinwenId)) { XinWen xinWen = null; ...
12f67efa-5485-4bd2-a849-d89f5e84f403
8
static public CodeAttribute unbox(CodeAttribute ca, String desc) { char type = desc.charAt(0); switch (type) { case 'I': return unboxInt(ca); case 'J': return unboxLong(ca); case 'S': return unboxShort(ca); c...
ca48240e-bc95-47ca-8628-3459e3e243bf
5
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, len = string.length(); i < len; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; case '<':...
15160f05-dc50-451b-aef7-8e9161b2a819
6
@EventHandler public void SlimeRegeneration(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.getSlimeConfig().getDouble("Slime.Regen...
f96d3415-d256-4021-aa64-949b8034745e
0
public static void main(String[] args) { MyDocumentTest t = new MyDocumentTest(); t.document(); }
a3d8f980-28b8-4c37-9fd9-168d40f7c9fa
1
@Test public void testMovePiece() { System.out.println("movePiece"); Board instance = new Board(2, 1); int[][] expResult = new int[][] {{Board.BOUNDARY, Board.BOUNDARY, Board.BOUNDARY, Board.BOUNDARY}, {Board.BOUNDARY, Board.EMPTY, Board.EMPTY, Board...
4066f530-e1f4-4284-88f5-e3a67a233f8c
7
private void Split() { // só acontece em uma folha cheia! No b = new No(folha, tamanho); // irmão int i; if (tamanhoLista() % 2 == 0) // o tamanho é um número duplo, os cortar // ao meio i = tamanhoLista() / 2; else // o tamanho é um número ímpar, a maioria dos registros permanecem // no nó ...
0c51ce54-af8c-412a-aebc-b62cb72c414b
1
public CouldNotSendConnectRequestException(CouldNotSendPacketException e) { super("Could not send connect request" + (e == null ? "." : "--" + e.getMessage())); wrappedException = e; }
6d768fcd-19cb-46a2-83fb-45507f8086b2
9
public static ChatColor toChatColor(Element e) { switch (e) { case AIR: return ChatColor.GRAY; case DARK: return ChatColor.BLACK; case EARTH: return ChatColor.GOLD; case FIRE: return ChatColor.RED; case LIGHT: return ChatColor.AQUA; case NONE: return ChatColor.DARK_GRAY; ...
5aebc782-95a6-4f38-aa0b-968d47dc1fa1
0
public WorkspaceData(ArraysDataBase arraysDataBase, FileDataBase fileDataBase, ListDataOut listDataOut){ this.arraysDataBase = arraysDataBase; this.fileDataBase = fileDataBase; this.listDataOut = listDataOut; }
411c8e17-bded-4825-bac1-33dfdd2f8695
9
public ArrayList<Integer> findSubstring(String S, String[] L) { // Start typing your Java solution below // DO NOT write main() function ArrayList<Integer> res = new ArrayList<Integer>(); if (S.length() == 0 || L.length == 0) return res; int i; HashMap<String, Integer> records = new HashMap<String, Inte...
83e5a02a-01b9-4446-8a1d-60c201daf014
1
public void checkForTimeOut () throws TimeOutException { if (isTimedOut()) { throw new TimeOutException(""); } }
1514d325-6616-49d3-a03a-aa11d90be20c
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Tuple tuple = (Tuple) o; if (item != null ? !item.equals(tuple.item) : tuple.item != null) return false; return true; }
e05fe9bf-700e-4e0b-8b53-ce5e1c482d17
9
static void captureInterpreterStackInfo(RhinoException ex) { Context cx = Context.getCurrentContext(); if (cx == null || cx.lastInterpreterFrame == null) { // No interpreter invocations ex.interpreterStackInfo = null; ex.interpreterLineData = null; ret...
4e72f972-79a0-4243-a883-5f3c8cfa3f76
1
public ItemStack getItemStack() { try { return new ItemStack(getMaterial(), 1, dataId); } catch (NullPointerException exception) { return null; } }
04da7a2e-96f4-4c04-8de7-a1567bfa702a
5
private static Boolean parseBoolean(ListIterator<Character> chars) { String t = "true", f = "fals"; StringBuilder b = new StringBuilder(); while (chars.hasNext() && b.length() < 4) { b.append(Character.toLowerCase(chars.next())); } if (b.toString().equals(t)) return true; else if (b.toString().equals(...
64badaa9-ae3d-4d8c-bd44-ae92ad711257
7
protected void draw_markers(Graphics g, Rectangle w) { int x1, y1; int i; // Calculate the clipping rectangle Rectangle clip = g.getClipBounds(); int xcmin = clip.x; int xcmax = clip.x + clip.width; int ycmin = clip.y; int ycmax = clip.y + clip.height; // Load the marker specified for this data Mar...
cb1d9ac6-0d06-4b82-aac5-ee4f7581c547
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!(sender instanceof Player)) { Bukkit.getLogger() .info("Error: You must be a player to register a spawning location"); } Player player = (Player) sender; if (!player.isOp()) { player.sendMess...
a2e0eb18-cf32-48fa-9eef-e71a248a959c
8
void listIPGroupFromDatabase(ServerInfoDAO serverInfoDAO){ if (serverInfoDAO.queryAll().size() == 0){ HelpPrompt.printNoDataInDataBase(); } else { HelpPrompt.printListServer(); String ask_list_group = getInputContent(); if (! FunctionKit.checkStringLengthI...
342b126f-d8eb-474f-96e8-cb126d6408dd
3
public static void findFormableWords(LinkedList[] lists, Trie[] tries, LinkedList[] formable_words){ Thread[] find_threads = new Thread[26]; for(int i=0; i < 26; ++i){ find_threads[i] = new Thread(new FindWordsThread(lists[i], tries, formable_words[i], i)); find_threads[i].start(); } for(int i=0...
d2ca13a2-da88-4a2d-a288-55c9c72f5005
2
private static void printWords(Map<String, List<GridPosition>> foundWords) { Set<String> words = foundWords.keySet(); for ( String word : words) { List<GridPosition> path = foundWords.get(word); StringBuilder sb = new StringBuilder(); for ( GridPosition position : path){ sb.append(position.toString());...
03eb3fc2-5c77-43ae-bef0-aaa415e36e2e
6
public static void parseCustom(Element current, String path){ List<?> children = current.getChildren(); Iterator<?> iter = children.iterator(); while(iter.hasNext()){ Element child = (Element)iter.next(); for(Object attr : child.getAttributes()) { Attribute a = (Attribute) attr; if(a.getName().t...
18d423e4-9f5d-41b9-96b8-3c83f1ad27ab
4
public static void copyFile(Path file, Path destination, boolean withAttributs) throws IOException { if ((file == null) || !Files.exists(file, LinkOption.NOFOLLOW_LINKS) || (destination == null)) { IllegalArgumentException iae = new IllegalArgumentException("The file is null or points to an invalid ...
f9fbae03-603c-4416-bf91-a3a878c8b562
3
public Vec3D getIntermediateWithZValue(Vec3D var1, double var2) { double var4 = var1.xCoord - this.xCoord; double var6 = var1.yCoord - this.yCoord; double var8 = var1.zCoord - this.zCoord; if(var8 * var8 < 1.0000000116860974E-7D) { return null; } else { double var10 = (va...
a93d32bc-04e5-4838-8755-7523674f2ac4
6
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: direction = Direction.N; break; case KeyEvent.VK_DOWN: direction = Direction.S; break; case KeyEvent.VK_LEFT: ...
c6127197-c163-49c5-ae66-3a34aeaa0121
0
public GoodWorkerRunnable(JComboBox aCombo) { combo = aCombo; generator = new Random(); }
a9f20149-6a40-4aa3-9ba4-048144ea3b1a
1
private BufferedImage getBitmap() { if (image.getBitmap() instanceof SwingBitmap) { return getBufferedImage((SwingBitmap) image.getBitmap()); } return null; }
9d33d1c9-03dd-4de2-983d-ce8049a9af0a
1
public void main_cancel() { // Restore Prefs Preferences.restoreTemporaryToCurrent(); // Restore GUI Preferences prefs = (Preferences) GUITreeLoader.reg.get(GUITreeComponentRegistry.PREFERENCES); Iterator it = prefs.getPreferencesPanelKeys(); while (it.hasNext()) { String key = (String) it.next(); P...
3587b891-5038-4f23-9273-401676114e5f
8
public String addTrain(String trainName, String routeName, int totalSeats, Date departureTime) throws IOException { String message = ""; log.debug("Start method \"addTrain\""); if ("".equals(routeName) || "".equals(trainName) || "".equals(totalSeats) || departureTime == null) { ...
614b1d5e-2a93-4022-9285-f65f80468739
5
public static void main(String[] args) { int width = 800, height = 600; boolean randomizePlane = false, randomStart = false; try { if (args.length > 1) { width = Integer.parseInt(args[0]); height = Integer.parseInt(args[1]); } if (args.len...
1bc4ff0e-9d5a-4057-a676-9ca68d348586
6
public void frame1() { synchronized(c) { for(int i = 0; i < Config.MAX_PLAYERS; i++) { if(Server.playerHandler.players[i] != null) { Client person = (Client)Server.playerHandler.players[i]; if(person != null) { if(person.getOutStream() != null && !person.disconnected) { if(c.distanceToPo...
89e8b7a7-adc1-4caf-a461-a1010ec697c2
7
public void buildClassList() { String classPath = System.getProperty("java.class.path"); String classPathSeparator = File.pathSeparator; // add the current dir to find more plugins classPath = mFrame.getFreemindBaseDir() + classPathSeparator + classPath; logger.in...
c7a3781c-6564-4f25-8ba0-30b09f8ece8a
1
public static void main(String[] args) { try { UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel"); } catch (Exception e) { e.printStackTrace(); } JFrame inicio = new G_Inicio(); inicio.setVisible(true); }
002ae074-49c5-4856-be16-b80506a21a20
8
static double busquedaBinaria(int[] a , double lI, double lS, double totalCajas){ double lM=-1.; double log = Math.log(lS)/epsilon; Arrays.sort(a); TreeSet<Double> s = new TreeSet<Double>(); // for(double j=0;j<log;++j){ while(Math.abs(lI-lS) > epsilon && lI<lS){ lM= (lI+lS)/2.; double ...
b4028fc8-5554-43cd-9d54-fdb88972ece5
1
protected GrammarTable initGrammarTable(Grammar grammar) { grammarTable = new GrammarTable(new GrammarTableModel(grammar) { public boolean isCellEditable(int r, int c) { return false; } }) { public String getToolTipText(java.awt.event.MouseEvent event) { try { int row = rowAtPoint(event.getPoi...
b860f6cc-24b8-419e-b5de-681f6e83de60
0
public String getName() { return name; }
9c78ceb4-540e-4efd-a01d-efce39159de8
8
@Override public byte[] generate(World world, Random random, int chunkX, int chunkY) { byte[] result = new byte[32768]; int worldHeight = world.getMaxHeight(); int halfHeight = (int)(worldHeight / 2); int realX = 0; int realZ = 0; int pos; ...
32bb3f5e-ee38-4543-826b-eefd6046ef7a
7
public KarmaPlayer[] getTopDeaths(int amount){ KarmaPlayer[] top = new KarmaPlayer[amount]; for(KarmaPlayer p : this.karmaPlayers.values()){ for(int i = top.length - 1; i >= -1; i--){ if(i == -1 || (top[i] != null && top[i].getTotalDeaths() > p.getTotalDeaths())){ if(i == top.length - 1){ //Poorer...
74377acd-767a-47b7-b219-aed28361592c
6
private void mapGtfsToFdotSchema(){ mapping = new HashMap<String, Integer>(); List<String> fdotFields = fdSchema.getFields(); if(_entity.contains("stops")){ fdotFields.remove("stop_pos"); fdotFields.add("stop_pos"); } ArrayList<String> gtfsFieldsUnmapped = new ArrayList<String>(); HashMap<S...
13df94f5-6a27-45f4-849d-397fe641708a
5
@Override protected String makeTag() { String szTag = "ROOM_"+getName().toUpperCase(); if (World.getGame().getRoom(szTag) == null || World.getGame().getRoom(szTag).equals(this)) return szTag; String szAugTag; int i = 1; while (true) { szAugTag = szTag+i; if (World.getGame().getRoom(szAugTag) == ...
d8cd8520-37d8-4509-8fb0-17c70fc2ac82
9
public static void main(String[] args) throws Throwable { String directory = "plugins"; if(args.length>0) { directory = args[0]; } /* * Create the pluginManager */ PluginManager pluginManager = new PluginManager(Thread.currentThread().getContextClassLoader()); /* * Register it. */ // P...
dc432862-20d2-4cb0-a7de-379f80af1d29
5
private Component findCorrespondingComponent(Circuit circ, Component givenComp) { for (Component comp : circ.getComponents()) { if ( (comp.getEndPt1().equals(givenComp.getEndPt1()) && comp.getEndPt2().equals(givenComp.getEndPt2())) || (comp.getEndPt1().equals(givenComp.getEndPt2()) && co...
5e8ce987-f51b-450e-8127-374624c45962
8
public String valTypeName() { switch (convertCode) { case 'i': { return ("integer"); } case 'o': { return ("octal integer"); } case 'd': { return ("decimal integer"); } case 'x': { return ("hex integer"); } ...
57f5b153-d2c1-4fdd-a2c7-f8980f127f02
5
public Component getTableCellRendererComponent(JTable pTable, Object pValue, boolean pSelected, boolean pHasFocus, int pRow, int pColumn) { pColumn = pTable.getColumnModel().getColumn(pColumn).getModelIndex(); TableViewAdapter model = (TableViewAdapter) pTable.getModel(); ...
e49f4822-3365-4f53-aacb-aa0e4c23ac2b
8
public String createUser() { // on récupère les données du formulaire String loginForm = user.getUserLogin(); String passwordForm = user.getUserPassword(); String mailForm = user.getUserMail(); if( loginForm == null || loginForm.isEmpty() ) { addActionError("Vous devez saisir un nom d'utilisateur"); ret...
bdd93907-8250-4410-8346-30bf9746ed13
8
public boolean accept(File file, String s) { if(wildIndex.length == 0) return pattern.equals(s); if(!s.startsWith(prefix) || !s.endsWith(suffix)) return false; if(wildIndex.length == 1) return true; int i = s.length() - suffix.length(); int...
3ae9d8ab-874b-4409-bfb6-27587e98008a
6
private boolean marginWaterAndSand(int x, int y, int m) { for (int i = x - m; i < x + m; i++) { for (int k = y - m; k < y + m; k++) { if (i > 0 && k > 0 && map[i][k] != Tile.grass || map[i][k] != Tile.grass2) return true; } } return false; }
8ec86d5b-a00f-4e06-93d6-4d12ab7a7a5e
3
public void repaint() { if (frame == null) return; Dimension dim = component.getPreferredSize(); if (dim.getWidth() > component.getWidth() || dim.getHeight() > component.getHeight()) { frame.pack(); } else { frame.repain...
cb2523f2-64ea-4c27-bce1-5b8c792b42e7
1
public Type peek() { if (top < 1) throw new IndexOutOfBoundsException("Stack is empty"); return stack[top - 1]; }
ffd6b1ac-0f33-4290-a8b8-4271414215a5
3
@Override public String getProperty(String key, String defaultValue) { if (!iSaveDefaults || containsPropery(key)) return super.getProperty(key, defaultValue); if (defaultValue != null) setProperty(key, defaultValue); return defaultValue; }
6a356e2d-1edb-4781-b830-d13c4e222747
7
public static void AdjustBrightness(BufferedWrapper bw, int adjustQuantity) { float[] hsbvals = new float[3]; float brightness; Color newColor; BufferedImage bi2 = new BufferedImage(bw.img.getWidth(), bw.img.getHeight(), bw.img.getType()); for (int x = 0; x < bw.img.getWidth(); x++) { f...
e8f0da73-01e0-437e-95d4-c51bc94a28a4
6
private void bettingtttttttttttttttttttttttttttttttt(Table tbl,Dealer dlr){ while(!allSameBet){ //iterate untill all players in same state or fold blncMnyPlyrs=0; //keep track how many players in balance for (Player plr : players) { if(plr.getBet()==tbl.getHighsBet()||plr.isFold()){ //player ha...