method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ab8c33ee-cced-4c67-bbce-fde5bef20b81
7
public void timechk() { for (World w : plugin.gmtWorlds) { if (plugin.getConfig().getBoolean("worlds." + w.getName() + ".keep_night") && plugin.gmtPlayerCount.containsKey(w.getName()) && plugin.gmtHasSwitched.contains(w.getName())) { if (plugin...
6f6568bd-1fbf-453e-b800-5b22e3af2b85
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...
ea12b7ab-0bf5-467e-9ad0-dc4551de6cca
0
public void mouseReleased(MouseEvent e) {}
143b3b83-a718-428c-a472-84c9f67eb777
1
public ImagePreview(String src) { super(); try { image = ImageIO.read(new File(src)); } catch (IOException ex) { } setPreferredSize(new Dimension(image.getWidth(), image.getHeight())); }
3f0d72ef-767b-4e4a-898f-d50e94140a4c
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
1b311b91-8969-4dcc-997a-2f2ad3f84a92
4
public final void grabMouse() { if(!this.hasMouse) { this.hasMouse = true; if(this.levelLoaded) { try { Mouse.setNativeCursor(this.cursor); Mouse.setCursorPosition(this.width / 2, this.height / 2); } catch (LWJGLException var2) { var2.printStackTrace(); } if(this.canvas == null) ...
15366b96-572a-49a1-a036-3ff2ceaccfd3
3
public boolean isViable(Field field) { // How many counts are non-zero. int nonZero = 0; if(!countsValid) { generateCounts(field); } for(Class key : counters.keySet()) { Counter info = counters.get(key); if(info.getCount() > 0) { ...
d9f25996-fa47-454b-871d-b0a0edb4bc2f
9
@Override public void copySources( HashMap<String, Source> srcMap ) { if( srcMap == null ) return; Set<String> keys = srcMap.keySet(); Iterator<String> iter = keys.iterator(); String sourcename; Source source; // Make sure the buffer m...
fed1d520-dee6-4cd2-ae73-00c2e5cf8ee1
3
public boolean add(Pet pet) { for (int i = 0; i < list.length; i++) { if (list[i] == null) { list[i] = pet; return true; } } Pet[] tempList = new Pet[list.length + 1]; for (int j = 0; j < list.length; j...
72bd3a39-51c2-4c13-b4f1-86cb6b3f42c2
3
protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(map, 0, 0, this); if (players != null) { for (Player p: players) { g.setColor(Color.RED); g.fillOval(p.getX(), p.getY(), 10, 10); g.setColor(Color.BLACK); g.drawOval(p.getX(), p.getY(), 10, 10)...
316ab950-e832-4314-8737-0a58b7224ee2
5
public void load() throws IOException, InvalidConfigurationException { if (!file.exists()) { BufferedWriter writer = null; BufferedReader reader = null; try { InputStream in = CommandBoat.getInstance().getResource("commands.yml"); reader = new...
1dbe1026-bd95-40e5-8442-10f123aacec0
4
public static void UpperStreet(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement stmnt...
d332c8ca-2c8a-4a0e-9c32-d9d16fe49126
3
public void actionPerformed(ActionEvent e) { ConfigurationButton button = null; try { button = (ConfigurationButton) e.getSource(); } catch (ClassCastException ex) { return; // Then, we don't care. } Configuration config = button.getConfiguration(); if (!configurationToButtonMap.containsKey(config)) ...
21fc2d98-9a0e-4e60-b51d-c573d7e01ba9
9
public void allMove() { // 물고기들을 이동시키고 충돌확인하고 이벤트를 처리하는 메소드 // 컴퓨터 물고기와 플레이어 물고기를 모두 논리이동시킨다 for (int i = 0; i < curFishNumber; i++) { fishList.elementAt(i).move(); } this.playerFish1.move(); if (this.gameMode == FishEater.GAME_RUN_2P) { this.play...
4746ccbb-51e2-44c4-8270-ace1a856e8d1
3
protected void toString2(StringBuffer sbuf) { sbuf.append("pos=").append(position).append(", len=") .append(length).append(", in=").append(incoming) .append(", exit{"); if (exit != null) { for (int i = 0; i < exit.length; i++) sbuf.append(exit[i].posit...
ebfb1655-3571-4f3f-8c43-843a9ab44f8e
9
protected void submitData(){ if (isComplete()){ String name = nameField.getText(); float magneticHeading = Float.parseFloat(magneticHeadingField.getText()); //float altitude = Float.parseFloat(altitudeField.getText()) / UnitConversionRate.convertDistanceUnitIndexToFactor(runw...
9688fbfe-7111-4d7c-becc-b1f7d6846182
2
public Player(Vector3f position) { if(mesh == null) { Vertex[] vertices = new Vertex[]{new Vertex(new Vector3f(-SIZEX,START,START), new Vector2f(0.1f,0.1f)), new Vertex(new Vector3f(-SIZEX,SIZEY,START), new Vector2f(0.1f,0.1f)), new Vertex(new Vector3...
8df16a1a-a8c8-4d05-abcc-6c77b46d9ce9
0
@Test public void testCreateServices() throws Exception { //Test TestTicketPoolManager can be initialized without throwing any exception. ServiceManager.getServices().initializeServices(new Object[] {new TestRailwayRepository(), new TestTicketPoolManager()}); //IRailwayRepository repo = ServiceManager.getS...
de774258-abef-43f4-9314-5250009ecfaf
0
public ConnectionHandler(Socket sock) throws IOException { this.socket = sock; out = new PrintWriter(socket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); }
067a4042-059d-48e7-9832-aa2a10044c2f
6
public static boolean transform(LoopBlock forBlock, StructuredBlock last) { if (!(last.outer instanceof SequentialBlock)) return false; SequentialBlock sequBlock = (SequentialBlock) last.outer; if (!(sequBlock.subBlocks[0] instanceof InstructionBlock)) return false; InstructionBlock init = (Instructio...
46728f62-b838-41d6-9bd1-5a636003c240
8
@Override public double getFMeasure(String classValue) throws IllegalArgumentException { if( classValue == null) throw new IllegalArgumentException("Error: null class value"); if( this.valueToIndex.get(classValue) == null) throw new IllegalArgumentException("Error: state = " + classValue + " didn't fou...
1478595a-a1d1-46dc-918e-0022a2fc16c5
3
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (!sender.hasPermission("under50.broadcast")) { sender.sendMessage(ChatColor.RED + "No permission"); return true; } if (args.length == 0) { sender.sendMessage("Try /bc...
9de1740f-e21a-4e4c-8b1e-77f9e6ef192e
1
public boolean useTeleport() { if (teleports > 0) { teleports--; return true; } else { return false; } }
a37e3536-ef90-4812-9648-e57656e62ff9
4
private OSCMessage convertMessage() { OSCMessage message = new OSCMessage(); message.setAddress(readString()); char[] types = readTypes(); if (null == types) { // we are done return message; } moveToFourByteBoundry(); for (int i = 0; i < types.length; i++) { if ('[' == types[i]) { // we're lo...
aff6dec0-447f-4178-9374-cd5942049f0e
7
boolean canMoveTo(int inLocX, int inLocY,LivingThing thnStore) { int i; LivingThing thnStore2; DuskObject objStore=null; Script scrStore; boolean blnStore; try { objStore = objEntities[inLocX][inLocY]; }catch(Exception e) {} if (scrCanMoveThroughLivingThing != null) { while (objStore != null)...
9564d077-66f2-4282-a5b2-47a1688732df
2
public boolean kickFromChannel(String chan, String msg) { boolean success = true; msg = addNewLines(msg); String[] msgArr = msg.split("\n"); char ch; for(int j=0;j<msgArr.length;j++) { /* * Meaning if one call to sendln returns false * This entire function will return false ...
b32acd18-b009-4b42-acef-7fa2f172c927
4
private static int idchf(palString string) { int ivec, ictab; char c = ' '; int nptr = string.getPos(); int digit = 0; int l_string = string.length(); /* Character/vector tables */ TRACE("idchf"); final int NCREC = 20; final char kctab[] = ...
d8e7370f-ff83-4909-bed6-36d1424697db
1
public World() { try { map = new TiledMap("res/map/map.tmx"); } catch (SlickException e) { // TODO Auto-generated catch block e.printStackTrace(); } layerMap = new CustomLayerBasedMap(map, map.getLayerIndex("objects"), map.getLayerIndex("npc")); }
d54f251d-5052-43a9-84ef-9634cc3feed8
4
@Override public String execute() { ContactListHandler contactListHandler = new ContactListHandler(); contactListHandler.setContactDao(new ContactDao()); try { contactListHandler.executeSearch(); int currentPage = getCurrentPage(commandParameter.getRequestParameter(COMMAND_PARAM), commandPara...
f8f17717-7343-42e6-86f7-9ef22e9f0790
4
@EventHandler public void onEntityShootBow(EntityShootBowEvent event) { if (event.getEntity() instanceof Player) { ItemStack item = event.getBow(); if (item == null || !Config.isItemEnabled(plugin, item.getTypeId())) { return; } Weapon weapon = new Weapon(plugin, item); int levelState = we...
d8c1db5a-e38e-4fb4-918c-17701ddcd24b
7
private void start(String props, String cluster_name, long rpc_timeout, long caching_time, boolean migrate_data, boolean use_l1_cache, int l1_max_entries, long l1_reaping_interval, int l2_max_entries, long l2_reaping_interval) throws Exception { ...
fce2c9f3-3c2a-4715-8772-7c62c1fa0a23
3
protected CasavaFastqParser(String id) { Matcher m = Pattern.compile(REGEX).matcher(id); // Last guard block if (!m.matches()) return; setAttribute(IdAttributes.FASTQ_TYPE, NAME); for (IdAttributes a : regexAttributeMap.keySet()) { String value = m.group(regexAttributeMap.get(a)); if (value != null) ...
993ab8b1-1623-422c-9e7a-374a07612750
5
@Override public int authorized(String email, String password) { int ret = -1; /* SELECT id, password, group_id FROM b_user AS bu RIGHT JOIN b_user_group AS bug ON bu.id = bug.user_id WHERE login = ? AND group_id = 1 AND active = 'Y' */ String q = "SELECT id, password, group_id\n" + "FROM b_user AS bu\n" ...
3a2cbcd7-304b-4f5d-8e58-742fd05d676f
4
public void test_constructor() { try { new ScaledDurationField(null, DurationFieldType.minutes(), 10); fail(); } catch (IllegalArgumentException ex) {} try { new ScaledDurationField(MillisDurationField.INSTANCE, null, 10); fail(); } catch (...
5ef7af64-b60e-4c00-ba05-a2c50f51756b
4
@Override public String display() { //Displays assembly language program with line numbers String displayString = " <Label>: <Instruction/Operand> <#Comment>\n\n"; if (leadingComments.size() > 0) { //Display leading comments, if there are any for (int i = 0; i < leadingComments.size(); i++) { displ...
9514d750-3130-4b9c-bd33-3dfa15bdb4fd
2
private static BitSet fromByteArray(byte[] bytes) { BitSet bits = new BitSet(); for (int i=0; i<bytes.length*8; i++) { if ((bytes[bytes.length-i/8-1]&(1<<(i%8))) > 0) { bits.set(i); } } return bits; }
ba30529b-18e0-4b22-9fbf-0259ed1df675
0
public AlphaMerger(int[] alpha) { this.alpha = alpha; }
0961612d-a3e8-4f46-a05e-53c562d2e1e6
8
public String setMidiOut(int id) { if(_synthesizer != null) { _synthesizer.close(); _synthesizer = null; _midiDevices.setSynthesizer(_synthesizer); } if(id > _midiDevices.getNumberOfDevices()) { return "<midi-out>" + id + "</mi...
afee891b-89fe-4167-b1e4-6c13c80870b2
9
public int compare(boolean[] class_list, int datapoint) throws BoostingAlgorithmException{ int c; int class_index = -1; int classification = -1; //determine what class in the classlist the datapoint has for (c = 0; c < classes; c++) { if (data.classes[datapoint].equals(data.classlist[c])) { class_index...
3c041f8e-2334-476c-b05b-5ef9194ce36c
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(args.length != 3) { printArgsError(args); printHelp(sender, label); return true; } String target = findTarget(args[1]); int chargeId = -1; try { chargeId = Integer.valueOf(args[2]); } catc...
33e9d150-c47f-4016-95fa-6bfd298cb070
0
@Before public void setUp() { a = new DynamicArray(); }
21988dca-d3c9-4609-a13e-6faa3fb1b640
1
public void addAnnouncementToDB() { try { String statement = new String("INSERT INTO " + DBTable + " (title, content, time)" + " VALUES (?, ?, NOW())"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement, new String[] {"aid"}); stmt.setString(1, title); stmt.setString(2, cont...
3bebfe26-58a7-484f-b84f-93b3a9d2c8ba
7
@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; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=profi...
7803ca14-3329-4266-8e9d-e0784b5eb9ae
2
private void verifyResource(String attributeName, String nameRes, String resType) { if (nameRes == null || !nameRes.startsWith("@"+resType+"/")) throw new InvalidPackConfiguration(mFileName, "Node "+mNodeName+" has an invalid "+attributeName+" "+resType+" resource !"); }
885c2908-09aa-4da7-80f0-011740e878ec
2
public void testFactory_parseWeeks_String() { assertEquals(0, Weeks.parseWeeks((String) null).getWeeks()); assertEquals(0, Weeks.parseWeeks("P0W").getWeeks()); assertEquals(1, Weeks.parseWeeks("P1W").getWeeks()); assertEquals(-3, Weeks.parseWeeks("P-3W").getWeeks()); assertEquals...
b61e621c-0feb-47da-8f84-be41896cc364
5
public static void verify(FastaFile obj1, FastaFile obj2) { boolean equal=true; if(obj1.getDataBase().size()!=obj2.getDataBase().size()) { equal=false; } for(int i=0;i<obj1.getDataBase().size();i++) { for(int j=0;j<obj1.getDataBase().get(i).getFoundPositionList().size();j++) if((obj1.getDataBase()...
71fe6331-76bf-4077-bdf5-988df175a329
0
public Player cPlayer(){ Player player = new Player(); return player; }
84bf8a72-fae4-45b6-9da6-4431244098fa
3
private int adjustedHandStrength(int rawHandStrength) { int ahs = 0; for(int j = 0; j < 15; j++) { if(rawHandStrength < boundaries[j]) { ahs = j; break; } else if(j == 14) { ahs = j; break; } else { rawHandStrength -= boundaries[j]; } } return Math.min(ahs, 15); }
a17f32ff-d13d-4a3c-8bf6-15a761d36fa3
4
private void getResultCategorization(CategoryPOJO spreadCategory) { // verifica a maior tipo de ocorrencia e diz o tipo de categoria correspondente Object[] keyCount = count.keySet().toArray(); for (int j = 0; j < keyCount.length; j++) { // adiciona 1 na linha, pois o DDex comeca com zero e a planilha com 1 ...
637a41d5-e899-4342-b3dc-a935d8a55ccf
0
public void setDecisionAnswer(ArrayList<String> answ, ArrayList<String> numbers) { questAnswer=answ; goToList=numbers; }
db6e2570-889d-41f7-8e2f-e8087ef8bad8
7
@Override /** Questo è il listener per la menuBar */ public void actionPerformed(ActionEvent arg0) { /** Per salvare prende la lista di locazioni e la salva */ if (arg0.getSource().equals(save)) { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.showSaveDial...
43ca87b3-37c5-4140-bf29-a46b78ee403f
4
@Override public boolean move(int row, int col) { if (this.row == row && this.col != col) { this.col = col; return true; } else if (this.row != row && this.col == col) { this.row = row; return true; } return false; }
664f23bd-5767-4193-8408-d05f2d24f127
8
protected boolean validate() { m_file = new File(m_fileCombo.getText()); if (!m_file.exists() || !m_file.isFile()) { m_errorMsg = "File not found:\n" + m_fileCombo.getText(); return false; } if (!m_file.canRead()) { m_errorMsg = "Cannot read file:\n" + m_fileCombo.getText(); return false; } try...
4ed823e0-412e-4fea-a2f7-dac6dc739405
2
public ArrayList<String> getList() { String line; try { while((line=reader.readLine())!=null) { list.add(line); } } catch (IOException e) { e.printStackTrace(); } return list; }
f7ea3b80-1c01-4f86-9ca1-f11261880824
5
public TreeNode<Integer> findNext(TreeNode<Integer> n) { if (n == null) return null; if (n.right != null) { TreeNode<Integer> p = n.right; while (p.left != null) { p = p.left; } return p; } else { TreeNode<Integer> p = n.parent; while (p.parent != null) { if (p == p.parent.left) ...
883bfa69-6fb1-4634-a447-566409746465
7
private String postResult(String URL){ StringBuffer sb= new StringBuffer(); try { String finalUrl=""; String[] parsedUrl=URL.split("\\?"); String params=URLEncoder.encode(parsedUrl[1], "UTF-8").replace("%3D","=").replace("%26","&"); URL url= new...
eb96df40-013f-4f09-b1f9-8004150223ef
3
protected void tallennaActionPerformed() { String kurssinNimi = kurssinNimiField.getText().trim(); if (kurssinNimi.equals("")) { JOptionPane.showMessageDialog(this, "Kurssin nimi ei voi olla tyhjä!", "Virhe! Kurssilta puuttuu nimi.", JOptionPane.ERROR_MESSAGE); return; ...
151048c8-3b4b-4e0f-9b8a-18c03c5b9319
5
public boolean epoch(Player p){ if (noimprove < noimprove_max){ noimprove++; //Update our average EPOCH statistics if (!new_model){ //Update the "noimprove" and DL_max/DL_min variables if (p.MODEL_allmoves-min_allmoves+EPSILON < 0){ min_allmoves = p.MODEL_allmoves; noimprove = 0; } ...
c49d3e15-448d-4064-a280-4bb22b8feaaf
3
public static void main(String[] args){ //create instance of "Class" Class<?> c = null; try{ c=Class.forName("Foo"); }catch(Exception e){ e.printStackTrace(); } //create instance of "Foo" Foo f = null; try { f = (Foo) c.newInstance(); } catch (Exception e) { e.printStackTrace(); } ...
d7f9d52f-f4af-4347-a527-f42b7db81c29
5
public static int[][] openMatrixfile(String filename) throws FileNotFoundException { File inputFile = new File("src" + File.separator + "gol" + File.separator + filename); if(!inputFile.exists()){ return null; } Scanner lengthScanner = new Scanner(inputFile); int arrayLength =1; String linje ...
0b29bc50-ad82-4a07-9ddf-0d81b82d0d88
8
@Override public Map<String, ?> resourceMap( DrawingContext context ) throws MojoExecutionException { for ( String range : StringUtils.split( ranges, ',' ) ) { try { String[] members = StringUtils.split( range, '-' ); if ( ArrayUti...
19f03597-59cb-411b-a1cb-88e1552525c3
5
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora...
f4e6eab9-07f3-4d6b-8a77-0f6bf3cc6104
5
@Override public boolean equals(Object o) { if (o == null) return false; if (o == this) return true; if (o.getClass() != this.getClass()) return false; Vector3D other = (Vector3D)o; return x == other.x && y == other.y &...
b0572a6d-20ce-4932-b073-ab5324d3aa68
5
public int getSelection() { if(selectionOvalY == 94) return 1; else if(selectionOvalY == 114) return 2; else if(selectionOvalY == 134) return 3; else if(selectionOvalY == 154) return 4; else if(selectionOvalY == 174) return 5; return 0; }
08bd0788-7de1-405f-b204-b239748afee9
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; System.arraycopy(iv, 0, tmp, 0, tmp.length); iv=tmp; } if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(k...
8253dd21-4952-458a-8929-e649ad8b3955
4
public final boolean matchesSub(Identifier ident, String name) { if (ident instanceof PackageIdentifier) return true; if (ident instanceof ClassIdentifier) { ClassIdentifier clazz = (ClassIdentifier) ident; return (clazz.isSerializable() && (!onlySUID || clazz.hasSUID())); } return false; }
a5e9c194-ea51-4817-9b6a-83563be59515
7
private void updateChangesFull(DnBData data, Node changes) throws ParseException { // changes = <MON_PROD_RS> for(int i=0;i<changes.getChildNodes().getLength();i++) // this should be length 1, should I check ? { Node changeNode = changes.getChildNodes().item(i); // this is <ArrayOfMON_PROD_RSItem>, if anyone'...
59945ad7-1e29-4e0a-b651-1e8886a2ecc0
2
public boolean deplaceSoldat(Position pos, Soldat soldat){ Position posSoldat = soldat.getPos(); Element depart = getElement(posSoldat.getX(), posSoldat.getY()); Element arrivee = getElement(pos); if (!arrivee.estLibre() || soldat.aJoue()) // Si le t...
bc67b461-c917-4b5c-a84f-3d5b946862cc
3
public void setMarkedAccessible(boolean markedAccessible) { if(this.e.getType() != BackgroundEnum.water || (!this.e.estLibre() && this.e.getSoldat() instanceof Heros)) this.markedAccessible = markedAccessible; }
ee8ead90-2b66-462f-975f-ba07b42c52e8
8
protected void resetQueue() { queueNode trc; queueNode trcPrev = null; //Delete expired nodes trc = jHead; while(trc!=null) { if(trc.getExpired()) { if(trcPrev == null) { jHead = trc.getNext(); if(jHead == null) jTail = null; } else if(trc.getNext()==null) { ...
cad0df94-48be-4180-9bdf-1b6bc79a6639
0
public KeyInfoType getKeyInfo() { return keyInfo; }
e14b070c-534d-4c4d-9cd2-9c4f5d9f403d
6
Space getForkSpace(Piece piece) { Space[] oppSpaceArray = getSpacesWithPiece(piece); Space[][] openSetsLast = getOpenSets(lastSpaceMoved); for (Space oppSpace : oppSpaceArray) { if (oppSpace != lastSpaceMoved) { Space[][] openOppSets = getOpenSets(oppSpace); for (Space[] oppSet : openOppSets) { fo...
f5374fd4-a522-4c86-9901-404193348491
4
@Override public void ParseIn(Connection Main, Server Environment) { int UserId = Main.DecodeInt(); Player Client = Environment.ClientManager.GetClient(UserId); if(Client == null) return; if((Client.Flags & Server.plrOnline) != Server.plrOnline) // Is Online? { ...
1be9a025-ccdb-403b-b135-1362be9aff08
1
@Override protected void done() { try{ out = get(); System.out.println("done!"); }catch(Exception e){ e.printStackTrace(); } }
0b17f95f-701b-4fcd-958f-dbc29cff668d
2
public boolean TryConnect(Configuration Config) { try { Class.forName("com.mysql.jdbc.Driver"); Connection = (new DatabasePool(Config)).GrabConnection(); Statement = Connection.createStatement(); return true; } catch (ClassNotFoundException C...
c37f6585-6a0d-4987-af58-4ceb15effc18
4
private static BigDecimal processCoinEntry(int[] coin_totals, BigDecimal balance, Coin inserted_coin) { // convert value to String String insert_Coin_str = inserted_coin.getValue().toString(); switch (insert_Coin_str) { case "1": addCoinToCategoryTotal(coin_totals, ...
98579e14-9838-4408-8fa0-a4bb64a9e678
4
public static void main(String[] args) throws IOException { // On cherche le datastore enregistré précédemment. String workingDir = System.getProperty("user.dir"); try { BufferedReader br = new BufferedReader(new FileReader(workingDir + "/dataStoreLocation.loc")); String sCurrentLine; while ((sCurr...
ab48ef7b-04b7-473b-8c04-1969a40ca905
6
@EventHandler public void GiantHarm(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.getGiantConfig().getDouble("Giant.Harm.DodgeCha...
90c6a91e-a858-4efd-958c-b385bd672d31
9
private void readToken() { while (true) { prompt(); String token = _input.findWithinHorizon(TOKEN_PATN, 0); if (token == null) { token = "*EOF*"; } else if (token.startsWith("'")) { if (token.length() == 1 || !token.endsWith("'")) {...
12210e4a-59ac-46d3-8828-ae1b31ff809b
6
public static void backTrack(Graph_ST<Vertex_ST, Edge_ST> gST, String esWFF) { if (!gST.edgeSet().isEmpty()) { for (Edge_ST e : gST.edgeSet()) { // build up links between effect scenarios if (gST.getEdgeTarget(e).esWFF.equals(esWFF)) { a.e.println("Given an effect scenario, locate the task and effect...
22a1bc53-e5d3-4a74-ad0f-250f9d9c14eb
1
private void setUpVisibleRowOfCards(Card[][] cards) { /* * Stage 3 (4 Marks) */ for (Card tempCard : cards[2]) { tempCard.setIsFaceUp(true); } }
cb44c252-7da3-4044-b4b0-ac0eaff977a0
2
synchronized void getGuichet(Voyageurs voyageur) { while (nbGuichetDispo == 0) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } nbGuichetDispo--; voyageur.setAUnGuichet(true); }
a1693736-582f-406d-88ed-79f517df5799
5
@Override public void onUpdate(float delta) { percentComplete += 100 * delta / waitTime; if (percentComplete > 100) { percentComplete = 100; Activity.stopCurrentActivity(); try { level.load(null); } catch (IOException e) { e.printStackTrace(); } Material material = new Material(); m...
9c65d495-9b2e-4528-95a0-2e56c5905097
3
int computeColumnIntersect (int x, int startColumn) { CTableColumn[] orderedColumns = getOrderedColumns (); if (orderedColumns.length - 1 < startColumn) return -1; int rightX = orderedColumns [startColumn].getX (); for (int i = startColumn; i < orderedColumns.length; i++) { rightX += orderedColumns [i].width; i...
692b1dfa-9341-45a7-a093-f531c89acd2e
9
private static Class[] getClasses(Object[] parameters){ Class[] classes = new Class[parameters.length]; for(int j = 0; j < parameters.length; j++){ classes[j] = parameters[j].getClass(); if(classes[j]==Integer.class)classes[j] = int.class; else if(classes[j]==Double.class)classes[j] = double.class; else...
39122922-27a2-492e-ba32-172721260b9e
4
@Override public int hashCode() { int result = (int) (orderId ^ (orderId >>> 32)); result = 31 * result + (driverId != null ? driverId.hashCode() : 0); result = 31 * result + (source != null ? source.hashCode() : 0); result = 31 * result + (target != null ? target.hashCode() : 0); ...
5f307b8b-f48a-40e5-8d5d-8438bc8da0ef
8
@Override public boolean ActUpon() { if(getArguments()!= null){ if(getArguments()[0].equalsIgnoreCase("Stop")){ if(hasPermission("cloud.server.stop")){ getPlayer().sendMessage(ChatColor.RED+"Tried Stopping The Service!"); ClientHandler.getCH().Stop(); return true; }else{noPermissions(); re...
c220975c-fab6-4e43-88c0-92a02db783fd
9
public static TimeValue parseTimeValue(String sValue, TimeValue defaultValue) { if (sValue == null) { return defaultValue; } long millis; if (sValue.endsWith("S")) { millis = Long.parseLong(sValue.substring(0, sValue.length() - 1)); } else if (sValue.ends...
acde5fdc-bba9-4adf-9c84-f1dcb9b32a1c
4
public void stopMoving(Direction dir) { boolean foundDir = false; for(int i = 0; i < queuedMoveDirectionPreferences.length - 1; i++) { if(!foundDir && queuedMoveDirectionPreferences[i] == dir) foundDir = true; if(foundDir) queuedMoveDirectionPreferences[i] = queuedMoveDirectionPreferences[i + 1]; } ...
264a012c-491f-496d-8512-495eeda5b89e
7
public void gameSolo() throws IOException{ // Changement du titre this.setTitle("Vous jouez à Tetra Word en Solo"); this.setPreferredSize(new Dimension(1024,768)); // Arrière plan JPanel panel = setBackgroundImage(this, new File("src/f...
faecbfff-6b7a-47b5-b83d-90e85db23dc9
2
@Override public int play(){ //If we've gone so many moves without progress, do a random move //This will hopefully prevent deadlock over a zugzwang situation Model m = (++turns % no_progress) == 0 ? random : learner; boolean fromDiscard = m.decideDraw(turns); int drawn = game.deck.draw(fromDiscard), pos ...
278cc780-0083-4aed-b7cf-73e310094952
7
public EvaluationResult evaluate(List inputs, EvaluationCtx context) { // Evaluate the arguments AttributeValue [] argValues = new AttributeValue[inputs.size()]; EvaluationResult evalResult = evalArgs(inputs, context, argValues); if (evalResult != null) return evalResult; ...
acb25c2c-d4c0-4ab6-8539-653647801e60
8
public List<Cliente> buscar(Cliente filtro) { try { String sql = "select * from pessoa p join cliente c on p.IdPessoa = c.IdPessoa where ativo = 1 "; String where = ""; if (filtro.getNome().length() > 0) { if (where.length() > 0) { where ...
472a6cc9-95ea-42d1-8be4-a84db41e70de
1
public boolean noChildren() { if(propChildren == null) return true; else return false; }
38d36c2f-8c5e-48cb-9e77-3d71322b6c72
9
public static void main(String[] args) throws InterruptedException { Thread.currentThread().sleep(20000l); int row; int col; ArrayList<String> colNameList = new ArrayList(); Object[][] data; String sql; String[] colName; // File f=new File("D:\\sqlite\\logs\\log.out");...
b9116c96-7dda-49b2-9b34-92d6f3e442a2
1
public boolean receptionConfirmation() throws IOException { boolean conf = input.readBoolean(); String msg = input.readUTF(); if (conf) System.out.println("OK : "+msg); else System.err.println("KO : "+msg); return conf; }
f4be6e8e-f378-47eb-97c5-33f6141bdd33
4
private void configureDetails() { if (details != null) { details.setVisible(false); } if (details != null) { details.addEventFilter(EventType.ROOT, new EventHandler<Event>() { @Override public void handle(Event event) { ...
9ce6c289-929e-42be-9945-8f643e11e7a8
5
private static final void method702(int i) { Widget class46 = AbstractFontRasterizer.getWidget(i); if (class46 != null) { int i_3_ = i >>> 16; Widget[] class46s = Class369_Sub2.aClass46ArrayArray8584[i_3_]; if (class46s == null) { Widget[] class46s_4_ = Class348_Sub40_Sub33.aClass46ArrayArray94...
79e98b3d-9f89-4a71-8d73-e6b110465c7b
7
public static void main(String[] args){ Scanner cin = new Scanner(System.in); str = cin.next(); int limit = cin.nextInt(); int steps; for (steps = 0; steps < limit; steps ++){ //check if palindromic,break boolean flag = true; for (int j = 0, k = str.length() - 1; j < k; j ++, k --) if (str.cha...
21c3317d-2d4f-42b5-b8e8-5fb78815a799
1
private void callUserAction() { try { callAction(UserAction.getByActionCode(readUserActionCode())); } catch (UnsupportedOperationException | InputMismatchException e) { String excMsg = "entered an incorrect value!"; view.printExceptionMsg(excMsg); logger.w...