method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
17fa9ce2-0309-43a2-ab0d-72edb6d2cdd0
1
public void testFactory_FromDateFields() throws Exception { GregorianCalendar cal = new GregorianCalendar(1970, 1, 3, 4, 5, 6); cal.set(Calendar.MILLISECOND, 7); YearMonthDay expected = new YearMonthDay(1970, 2, 3); assertEquals(expected, YearMonthDay.fromDateFields(cal.getTime())); ...
725cbcbd-5918-4230-a913-7114ecd5c1f8
1
private void actionUpdate(HttpServletRequest request, RequestData rd, Class clazz){ try{ helper.update(clazz, rd.id, request.getParameterMap()); } catch (RuntimeException ex){ request.setAttribute("error", ex.getMessage()); } }
d5c87129-ed83-4041-abc7-4150550120cf
9
@Override public void update() { if (isFailing()) return; if (!isReloading()) { Mob closestMob = super.nextMob(); if (closestMob != null) { if (upg == 3) { double rand = Math.random(); if (rand > .2 && rand < .5) bh.add(new SplashBullet((Point2D.Double)loc.clone(), closestMob.getLoc(),...
48ab1921-6e38-403c-a4c2-b8eb2135e3d3
0
public SaveGraphBMPAction(Environment environment, JMenu menu) { super("Save Graph as BMP", null); this.environment = environment; this.myMenu = menu; }
1e0995cc-c907-4b0a-979d-82bc142c355a
5
@Override public void step(Graphics2D graphics) { if (data == null) { titleOffset = screen.getXOffset(graphics, bigFont, title); getData(graphics); } graphics.setColor(Color.WHITE); for (Star star : stars) { star.update(); star.draw(gr...
0c48d98c-f081-45d9-8116-49c2849a0ba3
7
public Changes updateFrom(Archive archive, IO source) throws IOException { if (!archive.isUpdating()) { throw new IllegalStateException("!archive.isUpdating()"); } Map<String, LinkDigest> otherMap = new HashMap<String, LinkDigest>(source.getFiles()); for (String name : getKe...
5d9cb53f-afbd-4565-a781-97f960915a90
4
@Test public void TestAll() throws IOException, SyntaxFormatException { for (File file : new File("src/test/resources/testprogs/").listFiles()) { if (file.isFile()) { if (file.getPath().indexOf(simpleFuncTest4) >= 0) { continue; } if (!file.getPath().endsWith(".txt")) { continue; } T...
ee2d3725-038a-4b22-bd4f-21699e1ad5b2
6
public static void printAllPossibleWords(String digits, int index, String message) { if(digits == null || digits == ""){ return; } if(index == digits.length()) { System.out.println(message); return; } String[] possibleChars = findPossibleMap...
aef6e6d8-1833-4c74-8a09-41ab9a8463cc
3
@Override public boolean equals(Object obj) { if(obj instanceof Triple) { Triple that=(Triple)obj; /*if(this.r==null||this.s==null||this.t==null||that.r==null||that.s==null||that.t==null) { return false;} else*/ { return this.r.equals(that.r)&&this.s.equals(that.s)&&this.t.equals(that.t)...
2c304615-49b6-42be-8604-487d51a9ec76
9
static int dayOfMonth(int m,int y){ if(m==1||m==3||m==5||m==7||m==8||m==10||m==12) return 31; if(m==2) return (isLeap(y)?29:28); return 30; }
b38cf03b-7ba1-49b7-9dac-677a625bf6e4
1
private boolean jj_2_67(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_67(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(66, xla); } }
e9598c04-8103-4ccd-b69c-6c58fb3e9dc1
1
public static void main(String[] args) { if (args.length != 1) { System.err.println ("usage: Swarm <nbugs>"); System.exit(1); } final int nbugs = Integer.parseInt(args[0]); SwingUtilities.invokeLater(new Runnable() { public void run() { ...
bab06a06-e2ca-4b22-b525-8e45162cc2df
0
public Encargo getEncargo() { return encargo; }
3f268b75-ad1c-4515-a138-4b03b38e3f9d
4
@Override public void move(int x, int y) { try{ if((bitMap.Map[(body.x)][(body.y)+1].Resident==null)&&bitMap.Map[(body.x)+x][(body.y)+y].medium==1) { int colorhold = body.color; body.color=(6340095-body.y); body.Resident= null; body= bitMap.Map[body.x+x][body.y+y]; body.Resident = this; body...
1bdf62d5-12fb-45ba-a604-f2363737ab8c
4
protected void updateColour() { if (colourName.getSelectedIndex() == 1) { inputarea.setBackground(frame.ORANGE_THEME[2]); panelcolour = frame.ORANGE_THEME[0]; UIManager.put("TitledBorder.border", new LineBorder(frame.ORANGE_THEME[1], 3, true)); newColor = frame.ORANGE_THEME; } else if (colourName.getSel...
8e4798ac-79d8-4932-9651-ccc2dd5ee583
4
@Override public final void setUp() { if (tileType.getName().equals("")) { placeZombieAtRoadLink(); } else if (tileType.getName().equals("Helicopter")) { for (int x = 0; x < Tile.WIDTH_FIELDS; x++) { for (int y = 0; y < Tile.WIDTH_FIELDS; y++) { getField(y, x).setZombie(new Zombie()); } } }...
43dad21a-2ba6-4ca4-8f96-5685146189c3
4
ArrayList<String> createCol(int nullBefore, String type) { ArrayList<String> col = new ArrayList<String>(); PosStats posStats = coverageByType.get(type); for (int i = 0; i < nullBefore; i++) col.add(null); if (posStats != null) { if (posStats.size() <= 0) col.add("0"); else { for (int i = 0; i < ...
07d41bf1-387f-4261-ad3b-5632172012ea
0
@Override public void removePool(ITicketPool pool) { throw new UnsupportedOperationException(); }
77135100-04a4-4969-8777-574d7d8fcf41
3
private void collectDeviceInfos() { try { PackageInfo packageInfo = context.getPackageManager() .getPackageInfo(context.getPackageName(), 0); crashInfos.put("versionName", packageInfo.versionName); crashInfos.put("versionCode", packageInfo.versionCode + ""); } catch (NameNotFoundException e) { Log...
9af629cd-6fa6-428e-bcc4-2d6d3fa575fb
2
public static List<String> keysByNotMeta(CSProperties csp, String mkey) { List<String> l = new ArrayList<String>(); for (String key : csp.keySet()) { if (!csp.getInfo(key).keySet().contains(mkey)) { l.add(key); } } return l; }
07fe16b1-1b6d-4c01-a0f0-fc31a91003ef
3
public void body() { // a loop that is looking for internal events only Sim_event ev = new Sim_event(); while (Sim_system.running()) { super.sim_get_next(ev); // if the simulation finishes then exit the loop if (ev.get_tag() == GridSimTags.END_OF_SIMULATION) ...
435b0d84-7ceb-4596-ad0e-a172ccc14b9d
2
private void jLabel6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel6MouseClicked JFrame currentFrame = (JFrame) SwingUtilities.getWindowAncestor(this); try { UserClient.getOnlineUsers(new User(clientUserInMain.getText().trim())); } catch (IOException ex...
1218e42a-6a17-4c5a-859c-b01b2c7f11b2
4
private static Set<TypeAdapter<?>> getRuntimeGeneratedTypeAdapters(Gson gson) { Set<TypeAdapter<?>> adapters = gson.runtimeGeneratedTypeAdapters.get(); if (adapters == null) adapters = new HashSet<TypeAdapter<?>>(); gson.runtimeGeneratedTypeAdapters.set(adapters); return adapters; }
174dce3c-3239-4f5b-a49e-7b400dd4f448
3
private void runGameLoop(BufferedImage image, Graphics2D graphics, int width, int height) { double lastTime = System.nanoTime(); double currentTime = System.nanoTime(); while (true) { currentTime = System.nanoTime(); double dt = (currentTime - lastTime) / 500000000; if (!isPaused) { currentSystem....
cd769ea8-e86f-4652-bb22-d81720a9783c
3
public boolean cancelReservation(int reservationId) { Reservation reservation = getReservation(reservationId); if(reservation == null) { logger.info("Error cancelling reservation, ID is invalid"); return false; } int resourceId = reservation.getResourceID(); try { ...
572fa673-0d7c-4802-bbaa-dfb382181d88
2
public static void main(String[] args) { try { CycAccess access = new CycAccess("localhost", 3600); InferenceWorker worker = new DefaultInferenceWorker("(#$isa ?X #$Dog)", CycAccess.inferencePSC, null, access, 10000); worker.addInferenceListener(new InferenceWorkerListener() { ...
3be09f56-3a9a-4ce9-a9fa-6cb881379c1f
5
private final int method806(int i, int i_0_, int i_1_) { if (i_1_ == 1) { if ((i & 0x7fff) < 16384) return i_0_; return -i_0_; } if (i_1_ == 2) return sinetable[i & 0x7fff] * i_0_ >> 14; if (i_1_ == 3) return ((i & 0x7fff) * i_0_ >> 14) - i_0_; if (i_1_ == 4) return anIntArray1416[i / 26...
2e9cf599-e906-479e-aa3a-185aec66dd3e
6
private boolean removeWumpus() { boolean success = false; if(getWumpusPos().getX() != -1 && getWumpusPos().getY() != -1) { if(removeFromBoard(WUMPUS, getWumpusPos())) { // Remove Smell Position smell = new Position(); for(int i=-1; i<2; i++) { smell.setX(getWumpusPos().getX()); sme...
b400bb8e-a211-4313-b90b-e1263b111c1e
4
private static void getInput() { rods = new ArrayList<Rod>(); int index = 0; try { scanner = new Scanner(System.in); System.out.println("Enter total length capacity [int] : "); totalLength = scanner.nextInt(); System.out.println("Enter number of rods for price list [int] : "); int numberOfRods ...
4d3a0188-8036-4a3f-a917-7e190bf3ab8a
5
public void getObserver() { networkController.SendMessage("getPromotion#" + clientId + "," + clientType + "," + passiveUser + "," + userName); clientType = passiveUser; observer = true; cleanLabels(); if(contributor) getContributor.setVisible(true); if(reporter) getReporter.setVisible(true); ...
d9d79d56-11f2-4173-b662-15c0245386a1
1
public boolean hasPlayerWon() { return isOver && playerWon; }
d2f0712d-3fdd-479a-a931-768247f29f44
3
public static List<AstronomicalObject> findInhabited(StarSystem stm) { List<AstronomicalObject> returnedObjects = new ArrayList<AstronomicalObject>(); List<AstronomicalObject> elements = stm.getElementsAsList(); for (AstronomicalObject element : elements) { if (element instanceof In...
58b38d9e-0a7a-474a-8f02-190d420bb44c
0
public void addEdge(FlowEdge e) { int v = e.from(); int w = e.to(); adj[v].add(e); // add forward edge adj[w].add(e); // add backward edge }
a71b7b49-6195-4f38-b974-582b5fafec2c
4
public static boolean isColliding(Vector2 position, int x, int y, int padding){ if(position.x > (x - padding) && position.y > (y - padding) && position.x < (x + padding) + World.current.tileSize && position.y < (y + padding) + World.current.tileSize) return true; return false; }
826b6f0c-f24a-4a85-8892-95dc212f232b
6
public static LinkedListNode rotateByKNodes(LinkedListNode head, int k) { if (head == null || k == 0) { return head; } LinkedListNode current = head; int count = 1; while (count < k && current != null) { current = curr...
b7842b76-8ec8-4aa1-8e8d-6f7ec01b60b4
6
@Override public void mouseInput(int x, int y, int dX, int dY, boolean lmbDown, boolean rmbDown) { int cPicker; int cRule; int sRule; int pRule; x_ = x - (LAUNCHER_WIDTH / 2); clickedThisTick = lmbDown; if(!clickedLastTick && clickedThisTick) { while(!cPickers[cPicker = r.nextInt(cPickers.length...
0dbd476a-5321-423d-895b-e7c8d1eff646
2
public Class getType(String name){ if (map != null){ return null; } PropInfo propInfo = classInfo.getPropInfo(name); if (propInfo != null){ return propInfo.getType(); }else{ return null; } }
0935b17d-3e46-461a-bf8e-10cae7464ba2
2
public void run() { try { InputStream in = s.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String line; while ((line = reader.readLine()) != null) { // write to all the clients messages.add(line); } } catch (IOException e) { e.printStackTrace(); ...
90f0730b-823d-42d5-94a7-f07784218873
9
protected void addAbbreviationPairs(Map<String, Acronym> predictions) { for (String sf : predictions.keySet()) { String lf = predictions.get(sf)._longForm; Integer sf_id = _strToID.get(sf); Integer lf_id = _strToID.get(lf); if (sf_id == null && lf_id == null){ Integer id = _strToID.size(); _st...
f71b6a63-e544-4c85-bc7e-35458523064e
3
private void imprimirArreglo(){ for (int i = 0; i < tablero.length; i++) { System.out.print(i+" "); for (int j = 0; j < tablero[i].length; j++) { System.out.print(tablero[i][j]); } System.out.println(""); } for (int i = 0; i < table...
d459822e-28ab-4ae9-bbc0-c420add16192
6
public String toString() { String textToReturn = ""; textToReturn += ("\nName: " + this.getName()); textToReturn += ("\nTitle: " + this.getTitle()); textToReturn += "\nTasks To Do:"; int toDoTaskNum = 1;// labels each task sequentially for (Task t : this.getTasks()) { if (!t.isComplete()) { textToRet...
569a716e-7689-4c45-8e46-2d8218ab02f0
2
private void createTask(Plugin plugin) { task = Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() { @Override public void run() { for (OfflinePlayer member : getMembers()) { Player player = member.getPlayer(); if (player !...
6bb98f19-999f-4a1f-a19e-3d6d1c2c089e
7
private String makeSig(String url, String data) { ArrayList<Character> tmp = new ArrayList<Character>(36); for (char c = 'a'; c <= 'z'; c += 1) { tmp.add(c); } for (char c = '0'; c <= '9'; c += 1) { tmp.add(c); } Collections.shuffle(tmp); String nonce = new String(); for (Character c : tmp.subLi...
c28adae3-834d-46cb-8a42-0dbb9f3e00ef
0
public YamlPermissionUser(String n, ConfigurationSection config) { super(n, config); }
53ae1ce7-ec36-4ccb-8651-e54acc43ba50
9
public static void main(String[] args) { HashSet<HashSet<Integer>> primeSets = new HashSet<HashSet<Integer>>(); ArrayList<Integer> nums = new ArrayList<Integer>(); for (int i = 1; i < 10; i++) nums.add(i); ArrayList<ArrayList<Integer>> perms = perms(nums); for (int i = 0; i < perms.size(); i++) { Arr...
d84f48de-61e3-4338-a0d7-45fabddcbca7
5
static void AuxillaryMerge(int[] A, int[]B, int p, int q, int r) { //Data is first copied from A to global auxiliary array B for(int i=p; i<=r; i++){ B[i] = A[i]; } //Merge the data in B back to A int i = p; int j = q+1; for(int k=p; k<=r; k+...
fd1f1bb9-62fc-4991-9368-5430d95b955e
1
@SuppressWarnings("static-access") public static void spawnChargedCreeper (Location loc, int amount) { int i = 0; while (i < amount) { Creeper chargedcreeper = (Creeper) loc.getWorld().spawnEntity(loc, EntityType.CREEPER); chargedcreeper.setPowered(true); i++; ...
0ca31091-3c19-4c25-b14b-9cd8dce0c932
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; final boolean undead=CMLib.flags().isUndead(target); if((!undead)&&(!auto)) { mob.tell(L("Only t...
ef4fd62e-df90-48e3-982e-d1330c92c0eb
6
public static String escape(String string) { char c; String s = string.trim(); StringBuffer sb = new StringBuffer(); int length = s.length(); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c == '+' || c == '%' ...
7723099b-c369-463b-a165-df5fb63a85f1
7
private boolean loadAsNewFunctor(final Functor parameterFunctor) throws DataException { if (!(parameterFunctor.getOriginalName() == null)) // not new return false; if (parameterFunctor.definitionDepth() == 0) { // not a definition // translate kinds final List<? extends Kind> parameterFunctorInputKinds = p...
e7e247d9-eec9-462d-a473-213d44a35339
4
static double[][] minor(double[][] A, int i, int j){ double[][] minor = new double[A.length-1][A.length-1]; int n = 0, m = 0; for(int k = 0; k < A.length; k++){ if(k == i) continue; for(int l = 0; l < A.length; l++){ if(l == j) continue; minor[n][m] = A[k][l]; m++; } n++; m = ...
6d46e85b-fe10-4cc6-b1bc-1c7a394bbd7d
3
private static int[] initNext( char[] pattern ) { int[] next = new int [pattern.length]; int i = 0, j = -1; next[0] = -1; while (i < pattern.length - 1) { while ( j >= 0 && pattern[i] != pattern[j] ) j = next[j]; i++; j++; next[i] = j; } next[0] = 0; return next; }
ff84e762-df9c-4beb-a968-e497bf0b78d8
5
public int[][] buildTestMat(String filename) throws IOException { Scanner fScanner = null; try { fScanner = new Scanner(new File(filename)); } catch (FileNotFoundException e) { System.err.println(filename + " not found."); System.exit(1); } String type = fScanner.nextLine(); if (!type.equals("Weigh...
5e10c4dc-020a-4f77-8f19-90766fdc3bf4
5
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Dice) { Dice od = (Dice) obj; return mCount == od.mCount && mSides == od.mSides && mModifier == od.mModifier && mMultiplier == od.mMultiplier; } return false; }
a01bada2-3517-431d-a0c1-14269c763998
0
@DataProvider(name = "addressBookDataProviderAsIterator") public static Iterator<String[]> addressBookDataProviderAsIterator() { return Data.getDataAsIterator(addressBook); }
1362598e-5040-4c0a-a637-545ebb80881a
6
@Override public void actionPerformed(ActionEvent e) { //System.out.println("CopyAction"); OutlinerCellRendererImpl textArea = null; boolean isIconFocused = true; Component c = (Component) e.getSource(); if (c instanceof OutlineButton) { textArea = ((OutlineButton) c).renderer; } else if (c instance...
980bb8b2-7232-4828-9b66-5998b12cdb9a
6
private void loadNextIterable() { if ((this.currentIterator == null || !this.currentIterator.hasNext()) && this.iterables != null) { while ((this.currentIterator == null || !this.currentIterator.hasNext()) && this.iterables.hasNext()) { this.currentIterator = this.iterables.next().it...
4586467e-d987-4714-b6b1-eebc433c39cb
0
public static void main(String[] args) { new CarTest(args); }
f726dc78-2348-4f8e-a484-4e389fc97978
1
@Override public byte[] save(JoeTree tree, DocumentInfo docInfo) { StringBuffer buf = new StringBuffer(); tree.getRootNode().depthPaddedValue(buf, PlatformCompatibility.platformToLineEnding(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_LINE_ENDING))); try { return buf.toString().getBy...
4ce5df41-5c28-4f23-a2aa-e22044800fd7
5
public void run () { boolean fini = false; try { while ( ! fini ) { String ligne = reader.readLine(); if (ligne != null ) { writer.println( ligne ); if( ligne.trim().equalsIgnoreCa...
a84196a6-173a-4b39-8cfa-4631ed5808e2
5
public void updateAREDParameters() { double max_p = getMaxP(); if ((getAvg() > TARGET_HIGH) && (getMaxP() <= 0.5)) { // increase max_p setMaxP(max_p + ALPHA); } else if ((getAvg() < TARGET_LOW) && (max_p >= 0.01)) { // decrease max_...
abbdc660-a6b7-46aa-bc83-ee286c99a943
2
@Override public ArrayList<Speaker> getSession(String session) { //creat a new list for speakers ArrayList<Speaker> speakers = new ArrayList<>(); //clear out any old speakers searchedSpeakers = new HashMap<>(); //get all the names in the session ArrayList<String> n...
ea5011a5-4e3a-445d-a89a-d60310dd9935
7
public void removeValue(Object valueToRemove) { boolean rehash = false; for (int i = 0, l = valueTable.length; i < l; i++) { Object value = valueTable[i]; if (value != null && value.equals(valueToRemove)) { elementSize--; keyTable[i] = null; valueTable[i] = null; if (!rehash && keyTable[i + 1 == l ? 0...
3435d52f-aa79-4e6d-86ab-6f5820c88e62
3
public ArrayList<Short> getStringAsShortList(String name) { List<String> value_list = strings_map.get(name); ArrayList<Short> result = new ArrayList<Short>(); if(value_list == null) { return result; } for(String val:value_list) { try { result.add(Short.valueO...
ab48ab54-50b3-4dd8-9f42-40d1a48a97b7
8
public static long hash(BufferedImage image) { BufferedImage scaled = new BufferedImage(size, size, BufferedImage.TYPE_BYTE_GRAY); Graphics g = scaled.getGraphics(); g.drawImage(image, 0, 0, size, size, null); g.dispose(); Raster raster = scaled.getRaster(); double[][] pixels = new double[size][size]; for...
61616092-9cda-409f-a8fd-18d438949bc1
0
public byte[] getSignature() { return Arrays.copyOfRange(data.array(), 0, 20); }
28622690-6670-43d0-b0a4-8c9cf3d365f1
5
public static ArrayList<HashSet<Integer>> transiveRule(HashSet<HashSet<Integer>> originSets) { HashSet<HashSet<Integer>> tempSet = deepCopySet(originSets); ArrayList<HashSet<Integer>> clusterList = new ArrayList<>(); for (HashSet<Integer> temp : tempSet) { clusterList.add(temp); ...
2256c9a7-823e-4de7-b41b-b8d3f01325d1
6
public Combo_Box_Add_Group() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { //MAIN FRAME super("Team J's Scheduler | Add Group"); setBounds(50,50,500,300); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(null); setVisible...
9f9ea865-4ad1-4c82-9952-994bd184e0db
2
public String toString() { String clauseSet = ""; for (int i = 0; i < clauses.size() - 1; i++) { clauseSet += "(" + get(i) + ") AND "; } if (clauses.size() > 0) { clauseSet += "(" + get(clauses.size() - 1) +")"; } return clauseSet; }
7825a85d-69db-447b-8811-830e028c9900
5
public void updatePatron(int cardNumber, Patron p) { Connection conn =null; Statement st = null; // If p is null, do nothing if (p == null) return; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); st=conn.createStatement(); /...
a7c11659-0877-4de0-ad6d-efbc28131f4f
4
public void benchmark(int neighboursSize,DistanceMeasure measure){ long startTime = 0; double linearSearchTime = 0; double lshSearchTime = 0; int numbercorrect = 0; int falsePositives = 0; int truePositives = 0; int falseNegatives = 0; //int intersectionSize = 0; for(int i = 0 ; i < dataset.size() ; i...
9d292acc-c1a3-484f-81d9-7f40cd1704d7
3
public static boolean isIPV6(String ip) { Pattern ipv6_hex4 = Pattern.compile(IPV6_HEX4DECCOMPRESSED_REGEX); Pattern ipv6_6hex4 = Pattern.compile(IPV6_6HEX4DEC_REGEX); Pattern ipv6_hexcom = Pattern.compile(IPV6_HEXCOMPRESSED_REGEX); Pattern ipv6 = Pattern.compile(IPV6_REGEX); Matcher matcher_ipv6_hex4 = ipv...
fdac25f2-8dd8-43ba-9a01-09f8767daa14
4
public boolean add(Object element) { if (element == null) throw new NullPointerException(); for (int i = 0; i < count; i++) { if (element.equals(elementObjects[i])) return false; } if (count == elementObjects.length) { Object[] newArray = new Object[(count + 1) * 3 / 2]; System.arraycopy(eleme...
ca683288-04b9-4909-8177-134e7d161395
5
protected void modify() { // ѡеҪ޸ĵ int row = this.table.getSelectedRow(); if (row < 0) return; // Ҫ޸ĵѧϢ final String no = (String) tableModel.getValueAt(row, 0); Student isToModify = null; for (Student e : students) if (e.no.equals(no)) { isToModify = e; break; } if (!dialog.showModif...
e1302de5-c497-4c68-9a72-6d84523dad92
1
public void insertFront(Node node) { if (node.previous != null) { node.unlink(); } node.previous = head; node.next = head.next; node.previous.next = node; node.next.previous = node; }
d9d69e83-c3a3-43d3-9137-6112e1a115bf
4
private static void execute(File f, int i) throws Exception { int column = 0; int row = 0; BufferedReader br = new BufferedReader(new FileReader(f)); String line = null; System.out.println("***********" + f.getName()); while ((line = br.readLine()) != null) { String[] split = line.split(splitmark); ...
76dc189a-9bd3-42f5-8406-bdc51798ee32
3
public BottomPanel(){ erase = new Button("--Erase--"); setLayout(new GridLayout(5,4,1,1)); JSlider Red = new JSlider(JSlider.HORIZONTAL,0,255,0); JSlider Green = new JSlider(JSlider.HORIZONTAL,0,255,0); JSlider Blue = new JSlider(JSlider.HORIZONTAL,0,255,0); final Label r = new Lab...
400a7c8a-6de4-45ea-b645-fdf4996fa7b0
0
protected RegularEnvironment getEnvironment() { return environment; }
1110167c-eccb-441c-a1d3-0b09fae6275e
9
public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("Exit")){ System.exit(0); } for(int i = 0; i < fs.length; i ++){ if(e.getActionCommand().equals(fs[i])) { setFontStyle(fs[i]); } } for(int i = 0; i < FONT_SIZE_LENGTH; i ++){ if(e.getAct...
c8250e2a-08cd-4987-a5d2-85bd38fbcdff
1
public void pushbackToken(int token) { if (pushback != NO_TOKEN) throw new IllegalStateException("Can only handle one pushback"); pushback = token; }
91aaaaa5-31a7-4336-b457-02eaedb452bc
8
@Override public void endElement (String uri, String localName, String qName)throws SAXException { switch (qName) { case "stone": stoneList.add(stone); break; case "name": stone.setName(holder); ...
fce27ff6-e250-4001-a3b9-cb4f7464f7de
5
private String checkUrl(String url){ url = url.trim(); String extensionRegex = "(\\.jpg|\\.jpeg|\\.png|\\.gif|\\.JPG|\\.PNG|\\.JPEG|\\.GIF)"; Pattern pattern = Pattern.compile(extensionRegex,Pattern.MULTILINE); Matcher matcher = pattern.matcher(url); if(matcher.find()) { ...
1e1645c1-bf7f-4c10-9788-4df855eb1405
9
@Override public void paintComponent (Graphics g) { super.paintComponent (g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); for (Line2D.Float l : xAxis) { g2.draw (l); } for (Line2D.Float l : yAxis) { g2.draw (l); } drawS...
877990e7-1e8e-42cc-a8b1-04544d5a989b
8
public boolean isCollision(Sprite s1, Sprite s2) { // if the Sprites are the same, return false if (s1 == s2) { return false; } // if one of the Sprites is a dead Creature, return false if (s1 instanceof Creature && !((Creature)s1).isAlive()) { return fal...
79805ef8-67fa-4998-9cdc-0cd075af98fd
2
public void setShutdownMenuFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.shutdownMenuFontColor = UIFontInits.SHDMENU.getColor(); } else { this.shutdownMenuFontColor = fontcolor; } somethingChanged(); }
39f408a7-0502-4a31-b1fb-62bda84e055a
5
@Override public int lastIndexOf(final Object item) { if (item == null) { for (int index = this.size() - 1; 0 <= index; index--) { if (this.get(index) == null) return index; } } else { for (int index = this.size() - 1; 0 <= index; index--) { if (item.equals(this.get(index))) return index; ...
6657891a-b211-469a-84c7-f2a07d3aa8d0
1
private void bind(){ try { serverSocket = new ServerSocket(PORT); } catch (IOException e) { LOG.fatal("ServerSocket bind error", e); System.exit(-1); } }
fa413899-1caa-42ae-8f66-6b852069d04a
3
public void insertPatientData(Patient myPatient) throws SQLException{ try { databaseConnector = myConnector.getConnection(); SQLQuery = "INSERT INTO familydoctor.patient "+"VALUES(?,?,?,?,?,?,?,?,?,?) "; PreparedStatement preparedStatement =...
ddaadfc9-428e-4c54-9894-bf83dd12f881
2
public void messagesQueue() throws IOException{ try{ if(!sender.messageQueue.isEmpty()){ FileOutputStream f_out = new FileOutputStream("qtemp.ser"); ObjectOutputStream out = new ObjectOutputStream(f_out); out.writeObject(sender.messageQueue); out.close...
f17f9726-0520-4ffc-88a2-aed1eed44b27
2
private void tarkistaPisteet() { /** * t niinku temporaalinen muuttuja */ int x0, x1, y0, y1, t; x0 = vasenYlakulma.getX(); y0 = vasenYlakulma.getY(); x1 = oikeaAlakulma.getX(); y1 = oikeaAlakulma.getY(); if (x1 < x0) { t = x0; ...
0067e7a6-8eab-4df0-b217-454aa181f7e0
9
public static void main(String[] args) throws Throwable{ BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); for (String line; (line = in.readLine()) != null; ) { int n = Integer.parseInt(line); if(n == 0)break; off=new boolean[n]; boolean termine = false; for (int j = 1; !...
157b8e95-204f-4812-a740-87da3f489eb8
6
public Vector Coordinates(String folderPath) { Vector vecData = new Vector(); File gridFile = new File(this.getClass().getResource("/Data/188/2012-03-21/GridCoordinates.tsv").getFile()); try { BufferedReader input = new BufferedReader(new FileReader(gridFile)); try { String line = n...
e7aba914-6d9b-40c0-80f1-1b33d3947060
1
public String toString() { String data = flavorText; for(int x = 0; x<getEffectsTotal(); x++) data += ";" + stats.get(x) + ";" + effects.get(x) + ";" + values.get(x) + ";" + percents.get(x) + ";" + durations.get(x); return data; }
178e90af-3157-4746-ad09-17004932630c
0
public static void setConfigFile(String configFile) { HibernateSessionFactory.configFile = configFile; sessionFactory = null; }
46d917ab-9c85-4586-9ff7-3ca47aa9e84b
6
private void generateUserInputActions () { if (getKey('N')) { clearKey('N'); addNewAssembly(); } if (getKey('C')) { clearKey('C'); clearAssembly(); } if (getKey('V')) { clearKey('V'); EnvironmentVariables.tog...
54f97ad5-3659-4391-b957-a5aa38ffc6cb
6
public int[] getBorderColorInts() { try { int[] clrs = new int[5]; if( borderElements.get( "top" ) != null ) { clrs[0] = borderElements.get( "top" ).getBorderColorInt(); } if( borderElements.get( "left" ) != null ) { clrs[1] = borderElements.get( "left" ).getBorderColorInt(); } if( ...
a43f6d9a-dcc0-459c-8b3e-cada863126d0
6
public boolean isCanDrop(DefaultMutableTreeNode dragTreeNode, DefaultMutableTreeNode dropTreeNode, JTree jtr) { if (dragTreeNode == null) { //拖动源为空则退出 return false; } //设置放置目标为空时不可放置 if (dropTreeNode == null ) { re...
12743cca-4549-4749-839f-451c04649c06
5
public void estadoSICadeia(String palavra, int next) { while (contador < Token.length) { char c = (char) next; palavra = palavra + c; if (contador < (Token.length - 1)) { next = Token[contador + 1]; } if (contador == (Token.length - 1))...
ce0836dd-fd2c-4f24-bc6c-41cc071d4dee
3
public int compareTo( DefaultConnectionUserID userID ) { int cmp = this.serverID.compareTo( userID.serverID ); if( cmp != 0 ) return cmp; cmp = compareAddresses( this.localAddress, userID.localAddress ); if( cmp != 0 ) return cmp; cmp = this.localPort - userID.localPort; if( cmp != 0 ) return 0;...
d53d07a0-0f86-4845-9499-7838ae847a59
4
private synchronized boolean enviarBroadCast() { janelaServidor.adicionarHistorico("Enviando Broadcas...", EstadoSistema.PROCESSANDO); if(!servidor.getGerenteConexaoEscravos().temEscravoConectado()) { janelaServidor.adicionarHistorico("Enviando Broadcas... Falou não há Servidores Escravos co...