method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4bb15dc3-ce1a-406c-8cca-647fc63b5604
5
private void mutate(final int i) { switch (this.mutation) { case RAND_ONE: this.mutateRandOne(i); break; case BEST_ONE: this.mutateBestOne(i); break; case RAND_TWO: this.mutateRandTwo(i); ...
8ce64fef-56f5-444f-a713-92e50564ed7e
6
private static byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset) { byte[] ALPHABET = _STANDARD_ALPHABET; // 1 2 3 // 01234567890123456789012345678901 Bit position // --------000000001111111122222222 Array position from threeBytes // --------| || || || | Six...
368facee-9257-4cb5-a223-e5c571804893
6
@SuppressWarnings("unchecked") public void updateOption(final ConfigNode node) { final ConfigurationSection config = plugin.getConfig(); switch(node.getVarType()) { case LIST: { List<String> list = config.getStringList(node.getPath()); if(list == null) { list = (List<S...
43528985-9236-4841-81aa-03007b810dc5
8
public State PlanIngredient(Domain domain, State startingState, IngredientRecipe ingredient) { State currentState = new State(startingState); List<IngredientRecipe> contents = ingredient.getContents(); for (IngredientRecipe subIngredient : contents) { if (!subIngredient.isSimple()) { currentState = thi...
0cc7e9e2-6073-4743-994c-55c5b7c2814f
1
@Override public void dragEnter(DropTargetDragEvent dtde) { mDragDockable = getDockableInDrag(dtde); if (mDragDockable != null) { mDragOverNode = null; mDragOverLocation = null; updateForDragOver(dtde.getLocation()); dtde.acceptDrag(DnDConstants.ACTION_MOVE); } else { dtde.rejectDrag(); } }
e25121d9-7eef-480d-8de1-a7e948932391
0
public boolean showModifyDialog(Student student) { this.setTitle("޸"); canceled = false; this.editingNo = student.no; no.setText(student.no); name.setText(student.name); sex.setSelectedItem(student.sex); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(student.birthday.getTime()); int year,...
717efb53-b618-4d98-a59d-ef27a4181e3c
4
public Caster getCorrespondingCaster(Ability ability) { Caster minMagicUnit = null; long minMagic = Integer.MAX_VALUE; for(ClickableObject object : selection) { // TODO: change this, we only want casters here Caster caster = (Caster)object; long casterMagic = caster.getMagicBar().getValue(); if(caster...
30e5d3a0-afad-43cd-8cd9-9510df04c84a
5
private static int[] DiffCodes(String aText, Hashtable<String, Integer> h, boolean trimSpace, boolean ignoreSpace, boolean ignoreCase) { // get all codes of the text String[] Lines; int[] Codes; int lastUsedCode = h.size(); Integer aCode; String s; // strip off all cr, only us...
3e115e47-78a7-4dd8-8d2d-229dffb1d739
8
public void update(Graphics g) { int w = getWidth(); int h = getHeight(); g.setColor(getBackground()); g.fillRect(0, 0, w, h); g.setColor(getForeground()); xend = w - margin * 2; yend = h / 2; g.drawLine(margin, yend - 1, xend, yend - 1); g.drawLine(margin, yend, xend, yend); g.drawLine(margin, ye...
5f6ef54d-d6df-4c49-b6ee-d72e3218ceac
5
public String readData(String pattern) { try { int i=0; char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer sb = new StringBuffer(); boolean found = false; char ch = (char) in.read(); while (true) { System.out.print(ch); sb.append(ch); if (ch == lastChar) { if (sb.toS...
bd59846d-57b8-4d01-b0f2-41255bee6e54
2
public void onSpeak(Line line) { String name = line.getString("name"), text = line.getString("text"); if (text.startsWith("!")) { text = text.substring(1); String[] args = text.split(" "); Line cmd = new Line(args[0]); if (cmd.equals("hello")) { speak(String.format("Hi %s, How are you?", name)); ...
df820ed6-f8b9-4b4b-8bec-1e55db8b3ffe
8
public boolean canSwapTiles() { // find the minimum score and minimum-scored color int minColor = 0; int min = getScore(minColor); for (int color = 0; color < 6; color++) { if (getScore(color) < min) { minColor = color; min = getScore(color); } } // we have the minimum, now. // count how man...
c2b43be5-1e63-4ade-a08c-588d5199b947
8
public void addMud(I3Mud mud) { if(( mud.mud_name == null )||( mud.mud_name.length() == 0 )) { return; } { // temp hack final char c = mud.mud_name.charAt(0); if( !(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && c != '(' ) { return; } } if( list.containsKey(mud.mud_name) ) { m...
9cbcb24a-52e6-4700-b071-c517c789345f
5
public void moveRight() { if(!win && !m.getMap(p.getTileX() + 1, p.getTileY()).matches(pattern) && p.getTileX() != Maze.gridSize-1) { if(xOffset < Maze.gridSize - 20 && p.getTileX() == xOffset + 10) { Board.xOffset++; p.move(1, 0); } else { p.move(1, 0); } } }
4ad0dd7a-66db-45d8-801c-c6f4c7f1d225
7
public void checkDuplicateFuncs(){ int i, j; for(i=0; i<symbolTable.getLast()+1; i++){ for(j=0; j<symbolTable.getLast()+1; j++){ if(i!=j && symbolTable.table.get(i).tokenValue.equals(symbolTable.table.get(j).tokenValue) && symbolTable.table.ge...
41c57505-413d-439c-af39-c1f510eaec8f
6
@Override public void run() { System.out.println("Lanzado proceso"); //recoger el parametro de la configuracion WebResource webResource = this.client.resource(this.webservice); MultivaluedMapImpl values = new MultivaluedMapImpl(); //Pasarle un atributo para hacerlo más ...
595da542-2340-49bc-8662-d4e399ffb9a0
1
public void visit_daload(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 2; }
00f7813d-ff85-4bfa-b11e-5192b8208994
6
@Override public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be nul...
44dba662-8861-40de-83c4-7baa8bf39a5c
6
public static Contact getRow(String id) { Connection conn = null; Contact contactID = null; PreparedStatement prStGetRow = null; String query = "SELECT * FROM `mobilephone` WHERE id=?"; try { conn = DBConnection.getConnection(); conn.setAutoCommit(false); prStGetRow = conn.prepareStatement(query); ...
3c183ede-89e7-4a47-a635-4312c235afcd
9
public String nextToken() throws JSONException { char c; char q; StringBuilder sb = new StringBuilder(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
c1afe61b-a9ac-4525-a051-0e83c9d7c60a
0
public void moveRight() { x += walkSpeed; }
8bb4e8a4-c9ef-477d-93d2-f764da3160eb
0
public String getLineEnding() { return lineEnding; }
2561fd39-fc93-47fb-9fed-c82fd766c2e9
1
private void appendComa(final int i) { if (i != 0) { buf.append(", "); } }
5454c001-d40c-4621-a655-c358ef7662f0
3
public void onOther(Line line) { if (line.contains("users:{ ")) { Line[] lines = line.split(Pattern.compile("[0-9]\\:\\{"), line.substring(line.indexOf("users:{ "))); for (Line l : lines) { if (l.startsWith(" name:")) { Users.addUser(new User(l)); } } } }
8541bd9d-e874-43e4-baa6-557d7b79b1bd
4
private void lbx_users_onlineMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lbx_users_onlineMouseClicked int doubleclickcounter = evt.getClickCount(); //detects double clicks, makes sure that the right click is not catched if (doubleclickcounter == 2 && evt.getButton() != MouseE...
85e226dc-2ae7-4074-abec-f863f88eba68
3
private int validarInscripcion() { if (inscriptos.size() < 10) { return -1; } if (estado.equalsIgnoreCase("A")) { return -1; } if (estado.equalsIgnoreCase("G")) { return -1; } return 0; }
7e552b08-1681-471e-8dea-04e4dcbcf863
9
public static void pan_display() { int pan_changed = 0; /* horizontal panning */ if (input_ui_pressed_repeat(IPT_UI_PAN_LEFT, 1) != 0) { if (skipcolumns < skipcolumnsmax) { skipcolumns++; osd_mark_dirty(0, 0, scrbitmap.width - 1, scrbitmap.height - 1,...
c0d27c6c-2c45-4204-b841-24bbf1aa6405
1
@Test public void testUniqueIdValues() { List<Short> retrievedIdValues = new ArrayList<Short>(); for (Browser browser : Browser.values()) { assertTrue(browser.toString(),!retrievedIdValues.contains(browser.getId())); retrievedIdValues.add(browser.getId()); } }
f5d64486-5994-4e23-9b6f-cfed96e8b585
9
public void loadDB() { FileInputStream fin; String plr; try { fin = new FileInputStream ("FULLDB.txt");; DataInputStream dis = new DataInputStream(fin); String name = dis.readLine(); dis.readLine(); while (!name.equalsIgnoreCase("endClasses")) { Str...
1846f654-1079-4324-af9e-0d54d6d2c4c8
9
public int calcItemControlPoints(Area A) { int itemControlPoints=0; synchronized(clanItems) { for(int i=clanItems.size()-1;i>=0;i--) { final ClanItem I=clanItems.elementAt(i); if((!I.amDestroyed()) &&(I.owner() instanceof MOB) &&(((MOB)I.owner()).isMonster()) &&(CMLib.flags().isInTheGam...
3c69b9db-c4e4-41a1-a0df-66de08f7b220
1
public LineNumberDebugInfo[] lineNumbers() { if (lineNumbers != null) { return lineNumbers.lineNumbers(); } return new LineNumberDebugInfo[0]; }
a45ae321-55c9-40a1-9f1c-5568dc84d0fe
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 fe...
9e4e19d9-28e3-4a69-9044-cf067067bcab
3
public boolean zoom(int zoomFactor) { if (img==null) return false; if (zoomFactor>1) { img=imgUnscaled.getScaledInstance( imgUnscaled.getWidth(null)*zoomFactor, imgUnscaled.getHeight(null)*zoomFactor, 0); MediaTracker tracker = new MediaTracker(this); tracker.add...
efc371af-d2a9-41f0-8712-7d25e6c38b93
0
public void update(long elapsedTime) { x += dx * elapsedTime; y += dy * elapsedTime; anim.update(elapsedTime); }
ff0e0a73-14c1-41ba-8df0-8a3a3b36f78b
7
public ResultSetToJTable(ResultSet resultSet) { try { ResultSetMetaData metaData = resultSet.getMetaData(); int columns = metaData.getColumnCount(); for (int i = 1; i <= columns; i++) { String colHeader = metaData.getColumnName(i).replace("_", " "); colHeader = colHeader.substring(0, 1).toUpperCase(...
649fb4e0-1ed1-4a64-95aa-106c80238f76
1
public static void filewrt() throws FileNotFoundException, UnsupportedEncodingException{ PrintWriter wfile = new PrintWriter(fnames, "UTF-8"); for (int i=0;i<names.size();i++){ wfile.println(names.get(i)); } wfile.close(); }
e2f0f0d1-c062-4f43-b3c4-c1f7457b2de5
3
public void PassengersKickedOff(OutputFile outBusStopActivity,OutputFile screen) { //check if trip was empty if(GetEmpty() == true) { //increment empty trip counter IncrementEmptyTrips(); } //counting of trips trips += 1; //p...
8bf9f6a8-e610-45ad-80b9-924be813742f
0
public void setAmount(String amount) { this.amount = amount; }
ad09c3af-cbc3-4cd9-9bf1-89e85e37fb20
5
public void zufriedenheitAnpassen() { // N(0) double indexAlt = (double) this.bevoelkerungszufriedenheit; // N(t) int indexNeu = 0; // der Rundenzähler als Zeit double t = (double) this.marktplatz.getRundenzaehler() / 10.0d; // p wird durch die fünf Parameter errechnet double p1 = (double) getSoldaten(...
2c66027b-8792-494b-9f01-0d74a8bef74a
6
public static boolean isGrass(int num) { return num == Tile.GRASS.getId() || num == Tile.GRASS2.getId() || num == Tile.GRASS3.getId() || num == Tile.GRASS4.getId() || num == Tile.GRASS5.getId() || num == Tile.GRASS_POPPY.getId() || num == Tile.GRASS_FLOWER.getId(); }
19cd0286-ed23-41f8-9be8-390ed41da523
2
public Statements(Accounting accounting){ setName(STATEMENTS); counterParties = accounting.getBusinessObject(CounterParties.COUNTERPARTIES); try { accounting.addBusinessObject(this); } catch (EmptyNameException e) { e.printStackTrace(); //To change body of catch ...
80caae14-af01-4317-9492-90f402b10eec
6
public String getPropertyStringValueNormalizedE(String propertyName) throws Exception { JProperty p = getProperty(propertyName); if (p == null) return null; if (p.getValue() == null) return null; if (p.getValue() instanceof JValue) { JValue v = (JValue)(p.getValue()); if (v.getValue() == null) return nul...
54e3d9be-bbdf-4c27-9dfa-a4a839a38fa4
1
public String toString(){ String ret=this.position+": "+this.label+" | "+this.timediff; if(this.show){ ret+="\n"+payload; } return ret; }
4fa4fd7b-942b-4566-b32f-d062ba83c8f0
9
public static void init() { boolean process = true; File configFile = new File("config.ini"); if (!configFile.exists()) { log.info("Configation file 'config.ini' not found. Using defaults"); process = false; } if (process && !configFile.canRead()) { log.info("Configation file 'config.ini'...
895f5e8e-5a6c-4840-b2f1-b23130e87ef5
6
public void draw(Graphics2D g) { if (!changed) { //g.drawImage(background.getImage(), 0, 0, canvas.getWidth(), canvas.getHeight(), null); for (int i = 0; i < choices.size(); i++) { if (selection == i) { //g.setColor(new Color(235, 235, 235)); ...
b45b1ba9-5cfd-4c0d-9561-82b0097343f5
6
public HorseRace(int nHorses, final int pause) { barrier = new CyclicBarrier(nHorses, new Runnable() { public void run() { StringBuilder s = new StringBuilder(); for (int i = 0; i < FINISH_LINE; i++) s.append("="); // The fence on the racetrack print(s); for (Horse horse : horses) print(horse....
34239c89-78b9-45a0-aa42-fc64e3c9ec23
9
public void moveItems(int from, int to, int moveWindow) { if (moveWindow == 3724) { int tempI; int tempN; tempI = playerItems[from]; tempN = playerItemsN[from]; playerItems[from] = playerItems[to]; playerItemsN[from] = playerItemsN[to]; playerItems[to] = tempI; playerItemsN[to] = tempN; } ...
9100c3d2-8c70-45cd-a8ab-91e26140a40f
5
public void createPlayersStillGfx(int id, int x, int y, int height, int time) { //synchronized(c) { for(int i = 0; i < Config.MAX_PLAYERS; i++) { Player p = Server.playerHandler.players[i]; if(p != null) { Client person = (Client)p; if(person != null) { if(person.getOutStream() != null) { ...
22ad45e5-d9b7-4d7c-8787-a70bc2e4f218
6
private static Moves getBestAttackPlan(BotState state, Region opponentRegion, int minArmies, int maxArmies) { Moves out = new Moves(); List<Region> sortedOwnedNeighbors = getOrderedListOfRegionsByIdleArmies(state, opponentRegion.getOwnedNeighbors(state)); // Try to fulfill at least the minArmies constraint by...
37dc918c-3cb4-4560-af0a-ababfccffe9c
9
private char nonZeroDigitToken(J_PositionTrackingPushbackReader var1) throws IOException, J_InvalidSyntaxException { char var3 = (char)var1.read(); switch(var3) { case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: r...
2e643d8d-0596-4d66-895f-5447afb694bc
4
public static void buttonRandomClicked() { Random r = new Random(); for (int i = 0; i < 10; i++) { boolean isCons = false; int X = 10 + r.nextInt(jLabel1.getWidth() - 20); int Y = 10 + r.nextInt(jLabel1.getWidth() - 20); for (Shapes.Point point : points) {...
b02bc3ad-a69f-4ea5-a0a6-549866f46e45
2
public void addTestButtonActionListener(ActionListener l) { final ActionListener[] originalActionListeners = testButton.getActionListeners(); for (ActionListener actionListener : originalActionListeners) { testButton.removeActionListener(actionListener); } testButton.addActio...
9c7ac917-bc2e-4b49-b4c5-15c796af5968
5
public void Traitement() throws Exception { try { ServerSocket serveur = new ServerSocket( maConf.getPort() ); // | AfficherPort(); // | Bienvenue du serveur ! while(threadTerminateur.isAlive()) // Tant que le termi...
1ff4309a-298c-4875-b9c4-c66a4f24de52
8
@Override public boolean keyPressed(KeyEvent evt) { switch(evt.getKeyCode()) { case KeyEvent.VK_DOWN: if(canMove(getLocation().getNeighbourLocation(Location.SOUTH))) { setDirection(Location.SOUTH); } break; case KeyE...
b05ce0b8-48d5-49d0-9580-3a209d635119
5
public final void run() { anInt2263++; for (;;) { Class348_Sub26 class348_sub26; synchronized (aClass262_2258) { Node class348; for (class348 = aClass262_2258.removeFirst(8); class348 == null; class348 = aClass262_2258.removeFirst(8)) { try { aClass262_2258.wait(); } catch (Interru...
1f6bc076-a06b-4bee-a3e3-79a2ece2acf7
1
private void setBalance(BigInteger balance) throws IllegalArgumentException { if (! this.canHaveAsBalance(balance)) throw new IllegalArgumentException(); this.balance = balance; }
ceef0898-586d-4187-b7a2-d2b3e015d8a4
1
public String lueTiedostoSanaKerrallaan() { if (lukija.hasNext()){ return lukija.next(); } else { return "TIEDOSTON LOPPU"; } }
2b6171f3-427c-466c-96bb-ddec39660818
7
public synchronized void processReqMsg(ClientSessionMgr clientSessionMgr, Token token, OMMMsg msg) { Map<Token, StreamItem> clientSessionStreams = clientSessionMgr.getClientSessionStreams(); StreamItem streamItem = (StreamItem)clientSessionStreams.get(token); if (streamItem == ...
db20e352-dd7d-416f-aec8-ca4c70578dda
2
public void ConcludeVoting() { votingExists = false; voteCountTimer.stop(); if(lastActionsList.size() == 7) { lastActionsList.remove(6); } lastAction = new int[6]; lastAction[TYPE] = NO_TYPE; // NO CASE. Voting Finished. lastAction[X] = conflictX; lastAction[Y] = conflictY; lastAct...
1fa07986-7508-43aa-92b7-d2bf507c4f41
2
private void checkEnableBtn() { this.btnAjouter.setEnabled(this.tfName.getText().length() > 0 && this.cbType.getSelectedItem() != null && this.position != null); //this.btnPreview.setEnabled(this.tfName.getText().length() > 0 && this.cbType.getSelectedItem() != null && this.position != null); }
afb6299a-b222-4d93-ad03-125d092ff353
4
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld warpto <worldname>"); } else if (!hasWorld(worldName)) { reply("World not found: " + worldName); } else { if (...
e2944f49-712a-4430-9852-63734edeb53c
6
@Override public void actionPerformed(ActionEvent evenement) { System.out.println("----------------------------------------") ; System.out.println("GuiRentaco::actionPerformed()") ; Object sourceEvt = evenement.getSource() ; if(sourceEvt == this.itemQuitter){ this.controleur.quitterApplication() ; } ...
62622011-3801-4d8c-a00f-8d0f6d06a428
8
public static void main(String[] args) throws Exception { String input = Utils.getOption('i', args); String output = Utils.getOption('o', args); boolean print = Utils.getFlag('p', args); // words to process? Vector<String> words = new Vector<String>(); for (int i = 0; i < args.length; i++) { ...
a7223b9f-c1bc-41bb-882f-1f0fd5c9a8c7
6
public void decode(byte data[], OutputStream uncompData) { if(data[0] == (byte)0x00 && data[1] == (byte)0x01) { throw new RuntimeException("LZW flavour not supported"); } initializeStringTable(); this.data = data; this.uncompData = uncompData; // Initializ...
2b6357eb-3d49-4e64-a4b3-0630d0f64af3
6
private Collection filterByCondition(Collection source, int from, int to) throws XPatherException { ArrayList result = new ArrayList(); Iterator iterator = source.iterator(); int index = 0; int size = source.size(); while (iterator.hasNext()) { Object curr = iterator....
dada1a80-d659-46c4-911b-46443b850b72
4
public void updatePosition(Mower mower, Lawn lawn) { final Direction direction = mower.getCurrentPosition().getDirection(); //mower changing direction if (direction == Direction.NORTH) { mower.getCurrentPosition().setDirection(Direction.WEST); } else if (direction == Direction.WEST) { mower.getCurrentP...
cdb6c68c-bd70-4c3b-b166-02ff1f2b16bc
8
public static TreeModel parseTree(String string, Grammar grammar, LRParseTable table) { string = string + "$"; int p = 0; IntStack stack = new IntStack(); stack.push(0); Production[] productions = grammar.getProductions(); int nodeNum = 0; while (true) { int state = stack.peekInt(); String read =...
3fc0506f-4334-48fd-a8eb-d75a014941b8
2
private void drawMouseInput(Graphics2D g,float interpol) { g.setColor(Color.WHITE); g.drawString("Mouse is "+((leftMousePressed)?"pressed":"not pressed"), 0, 80); g.drawString("Mouse wheel is "+((mouseWheelPressed)?"pressed.":"not pressed."),0,100); g.drawString("Mouse Press Position is "+rightPressPosition....
69472601-3aba-489e-be64-9d61e5e9fd17
1
public static void updateLigneCommandeFournisseur(int idlignefournisseur,int idcommandefournisseur, int idarticle, int quantite, Float prixht, Float prixttc, Float remise) throws SQLException { String query = ""; try { query = " UPDATE LIGNE_COMMANDE_FOURNISSEUR SET ID_CMDFOU...
1f4be14e-f9c0-4bc9-87ca-ea7999a7c7eb
5
private void btnOkayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkayActionPerformed checkInput(); if(choose.getSelectedDate().get(Calendar.DAY_OF_YEAR) == alarmStart.get(Calendar.DAY_OF_YEAR) && choose.getSelectedDate().get(Calendar.YEAR) == alarmStart.get(Calen...
88b76954-598a-4af3-b74d-37225dc98d20
6
public ArrayList<ArrayList<Integer>> generate(int numRows) { ArrayList<ArrayList<Integer>> Flist = new ArrayList<ArrayList<Integer>>(); int[][] ints = new int[numRows][numRows]; if (numRows == 0){ return Flist; } if (numRows == 1){ ArrayList<Integer> intL...
5bbe9995-b0ac-4574-86d1-570c9fb0cfca
6
public boolean match (Position p) { try { String s=R.getBracket(P); if (s==null) return false; char a[]=s.toCharArray(); for (int i=0; i<a.length; i++) { if (p.end() || a[i]!=p.get()) return false; p.advance(); } return true; } catch (Exception e) { return false; } }
0d63f2ca-a9c0-49ff-8cd9-7de98e7616ea
4
private static boolean hasCommon(int i, int j){ Set<Character> seen = new HashSet<Character>(); for(char c : Integer.toString(i).toCharArray()){ seen.add(c); } for(char c : Integer.toString(j).toCharArray()){ if(c!='0' && seen.contains(c)) return true; } return false; }
c0350e26-efef-4375-b1cc-e50086e8e889
0
public int getZ() { return z; }
c1929d04-404e-46b7-903b-8faef7c1ee96
3
String uniqueTrId(String id) { if (!transcriptsById.containsKey(id)) return id; for (int i = 2; true; i++) { String trId = id + "." + i; if (!transcriptsById.containsKey(trId)) return trId; } }
ecdfbf6a-f78a-456d-9f92-6cf1c6615012
8
public String borrowBook(int isbn, int customerID, int day, int month, int year) { try{ String result = formattedTitle("Borrow Book"); // begin transaction conn.setAutoCommit(false); stmt = conn.createStatement(); // check the customer exists and lock String sql = String.format("SELECT * FROM Cus...
56a185a7-940d-442a-8f00-62c90b466984
4
public static int getPositionDistanceUnit() throws ClassNotFoundException { int weightUnit = 0; try{ //Class derbyClass = RMIClassLoader.loadClass("lib/", "derby.jar"); Class.forName(driverName); Class.forName(clientDriverName); }catch(java.lang.ClassNotFoundE...
6b703e8f-7d3e-4181-9af4-9f9ba23e4779
4
private void disburse() { if(hasDisbursed) { return; } hasDisbursed = true; // Break this space into two spaces: partition(); // We were enable to break this space into furter partitions, but // that's OK, just halt here. if(isLeaf()) { ...
fc728735-6429-4766-9d65-15a8945f6f03
0
@Override public void focusLost(FocusEvent e) { handleUpdate(); }
0b633b4d-b916-4fed-9f4a-f2a72d8d3098
2
public static int round(double num) { double precision = 0.1; //0 < precision < 0.5 int rounded = 0; if((int)(num + precision) != (int)num) rounded = (int)(num + precision); else if((int)(num - precision) != (int)num) rounded = (int)num; return rounded; }
d9c6007d-501b-4b3a-bc1f-f4cb112882a8
1
public JSONObject optJSONObject(String key) { Object object = this.opt(key); return object instanceof JSONObject ? (JSONObject) object : null; }
5853023b-f06f-4e8e-8aa9-5a1f3d6b4fec
0
public BinaryTimer() { }
e9dded90-273d-4519-b638-cb544fb9e8da
6
@Override public List<Lehrer> findAllLehrerWithUnterricht(Connection con) { final String sql = "select * from lehrer, unterricht where lehrer.id = unterricht.l_id"; Map<Integer, Lehrer> lehrer = new HashMap<Integer, Lehrer>(); try (PreparedStatement ps = con.prepareStatement(sql)) { try (ResultSet rs = p...
4f66c2fa-1dca-4245-be09-3329aa58e3a4
7
public boolean isNormalClass(final Class<?> clazz) { return !clazz.isAnonymousClass() && !clazz.isMemberClass() && !clazz.isAnnotation() && !clazz.isEnum() && !clazz.isInterface() && !isAbstract(clazz) && !clazz.isSynthetic(); }
dc7b9e82-d91a-4abb-bb07-8974ffe7d4b3
3
@Override public ICacheable remove(Object key) { ICacheable c = null; if(null != mMemLruCache){ c = mMemLruCache.remove(key); } if(null != c) return c; if(null != mDiskLruCache){ c = mDiskLruCache.remove(key); } return c; }
ac6c9185-4ed6-479a-9f2d-2cc0a88aad29
3
public static void main(String[] args) { String s = "abcdefghijklmnopqrstuvwxyz"; char[] alphabet = s.toCharArray(); ArrayList<HashMap<Character, Character>> list = new ArrayList<HashMap<Character, Character>>(); char[] keys = "gslmrh".toCharArray(); char[] values = "TAOINS".toCharArray(); function(keys,...
89aedbe7-feb6-45c7-b037-0805d00e7996
6
@SuppressWarnings("unchecked") public void copyAll(Map<? extends Boolean, ? extends V> m) { for (Entry<? extends Boolean, ? extends V> e : m.entrySet()) { if (e.getValue() instanceof Object[]) { Object[] arr = (Object[]) e.getValue(); put(e.getKey(), (V) Arrays.copyOf(arr, arr.length)); } } }
9c72e3b7-2d3b-4711-9a8d-6e633802afb0
3
public static Change setStart(final OffRec offering, final Date start) { Change change = new OffFieldChange<Date>(offering, "Start", start, offering.getStart()) { private String safeString(Object date) { if (date == null) return null; return OffRec.dformat.format(date); } @Override publi...
be1e2fc5-f963-4a51-9c88-d041d0dbc879
7
private boolean isPassKeywordCheck(Task task, String key, int tolerance, boolean isExact) { if (tolerance == 0 && !isExact) { nearMatchString = ""; return task.getValue(Keyword.CONTENT).contains(key); } StringMatching sm = new Strin...
b1478aef-da6f-4a58-8f72-51bb33ea5619
8
static private boolean jj_3R_81() { if (jj_scan_token(K_SELECT)) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_85()) jj_scanpos = xsp; if (jj_3R_86()) return true; if (jj_3R_87()) return true; xsp = jj_scanpos; if (jj_3R_88()) jj_scanpos = xsp; xsp = jj_scanpos; if (jj_3R_8...
f9c91628-aa3c-4d93-8d3b-e7abbf9737bd
5
public boolean deleteSinglePlayerDat(String pName, String wName) { World world = Bukkit.getWorld(wName); if (world == null) { log.l("World " + world + " not found! Deletion canceled!", Level.SEVERE); return false; } File playerDat = new File(Bukkit.getWorldContainer().getPath() + File.separator + wName +...
faf3491e-9a84-47a5-a6c2-b0bb66e4a57f
7
public ArrayList<Point> validMove(Point p){ ArrayList<Point> validMoves = new ArrayList<Point>(); Piece piece = b.get(p); for(int i = 1; i <= 8; i++){ for(int j = 1; j<= 8; j++){ Piece p2 = b.get(new Point(i,j)); if((p2 == null && piece.pieceMovement(p, new Point(i,j)) || (validTake(p, new ...
222e7cc7-7810-4f28-93d8-e5911e256df3
2
private boolean isRelative(String mnemonic) { for (String mnem : relativeMnemonic) { if (mnem.equals(mnemonic)) return true; // If the mnemonic is a relative addressing mnemonic, return true } return false; // Otherwise return false }
81089e3d-45bd-451d-aa74-8cdf3d707477
2
public void addEvent(Event event){ try { tx.begin(); manager.persist(event); } catch (NoResultException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ tx.commit(); } }
fbccab42-1ded-40c0-83bf-8ece6852885c
4
static String getPlatformFont() { if(SWT.getPlatform() == "win32") { return "Arial"; } else if (SWT.getPlatform() == "motif") { return "Helvetica"; } else if (SWT.getPlatform() == "gtk") { return "Baekmuk Batang"; } else if (SWT.getPlatform() == "carbon") { return "Arial"; } else { // photon, etc ... ...
25bc79a9-0a82-40af-b3a6-8839c94c900c
8
public static void main(final String... args) { if (args.length==1 && "--gui".equals(args[0])) { SwingUtilities.invokeLater(new Fenetre()); } else { final Scanner reader = new Scanner(System.in, "UTF-8"); boolean choixInterface = false; String consoleOuGraph = ""; while (!choixInterface) { System...
672ea259-6206-42c5-8329-5b9ff45d751b
4
private void getFavorites(String name, StringTokenizer scriptReader) throws Exception { ManagerSession rental = getNewManagerSession(name); while (scriptReader.hasMoreTokens()) { String pars = scriptReader.nextToken(); String favorite = null; List<String> favorites = Arrays.asList(pars.split("/")); i...
f69928c9-5b10-4952-9ba8-217317de28a5
9
private static String getWholeStatement(final BufferedReader reader) { final StringBuilder sbStatement = new StringBuilder(1024); if (lineBuffer != null) { sbStatement.append(lineBuffer); lineBuffer = null; stripComment(sbStatement); } int pos = sbSt...
91e62cf9-f9b9-45c6-b10c-05988c2f32dc
5
public Object invoke(ELContext context, Object[] params) { if (context == null) { throw new NullPointerException(); } if (isLiteralText()) { return expression; } FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class); ELRes...
59ea9ed6-6e5d-42d5-b739-85c0dedc4ad5
0
@After public void tearDown() throws Exception { System.out.println("End"); getDriver().quit(); }