method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c808f235-9c6e-465f-b47f-7441e3973901
5
@Override public boolean doLarge() { if (!options.useOtherHouse.get() && script.houseTask.getHouseLocation() != HouseTask.HouseLocation.YANILLE) { script.log.info("House not in yanille"); return false; } if (script.houseTask.isInHouse() && !locationAttribute.isInLargeArea(ctx)) { script.houseTask.leave...
38215f9d-2120-4286-9528-37de208b799f
9
public static void main(String... args) throws IOException { MyScanner sc = new MyScanner(); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList<Integer>[] edgs = new ArrayList[n]; ArrayList<Integer>[] redgs = new ArrayList[n]; for (int i = 0; i < n; i++) { ...
498dfd59-8ec5-42a5-8bc9-bd1477772141
9
public static ArrayList<Face> Parse(String dataFilePath, String labelFilePath) { try { BufferedReader lbr = new BufferedReader(new FileReader(labelFilePath)); BufferedReader dbr = new BufferedReader(new FileReader(dataFilePath)); ArrayList<Face> ret = new ArrayList<Face>(); ...
486ce505-f73a-4926-9a8a-aaef189f8039
8
public boolean find(JComponent subject, String text, boolean forward, boolean matchCase, boolean wholeWord, boolean regex) throws PatternSyntaxException { JTextComponent component = (JTextComponent) subject; // Be smart about what position we'r...
3d473025-9cb7-43cc-adff-77d9e65be70f
1
public void escribirPersonaXStream(String rutaFichero, LinkedHashMap<Integer, Persona> personas) { XStream xstream = new XStream(); rutaFichero = rutaFichero + ".xml"; try { xstream.toXML(personas, new FileOutputStream(rutaFichero)); } catch (Exception e) { //e.pr...
d9096e29-680a-4fed-9dab-44a8e9c4491c
2
private void setGroupNames(String username, String[] groups) { Vector<String> v = null; if (groups == null) { v = emptyVector; } else { v = new Vector<String>(groups.length + 1); for (int i = 0; i < groups.length; i++) { v.add(groups[i]); ...
48caa2e5-7455-4b74-a6b9-fbdf41dbbcb9
8
public Coords nextCoords(Coords start, Direction dir) { Coords next = new Coords(start.getCoordsRow(), start.getCoordsCol()); switch(dir) { case NORTH: next = new Coords(start.getCoordsRow() - 1, start.getCoordsCol()); break; case ...
42641b9b-4709-4224-815a-e633978aed07
1
public static String getClassFileName(Class<?> clazz) { Assert.notNull(clazz, "Class must not be null"); String className = clazz.getName(); int lastDotIndex = className.lastIndexOf(PACKAGE_SEPARATOR); return className.substring(lastDotIndex + 1) + CLASS_FILE_SUFFIX; }
aa691ac2-23d1-40fb-825d-a464ed5de505
4
public static Object[] File2intArr(String filepath){ // RandomAccessFile raf = new FileInputStream fis = null; File f=new File(filepath); List<Integer> listint = new LinkedList<>(); try { fis = new FileInputStream(filepath); int n = fis.read(); int i=0; List<Integer> tmp = new LinkedList<>(); ...
a965c56a-8b2f-4df4-998a-8b0da662160d
1
public List<String> getLinks() { Pattern pattern = Pattern.compile("(?i)(?s)<\\s*?frame.*?src=\"(.*?)\".*?>"); Matcher matcher = pattern.matcher(content); List<String> list = new ArrayList<String>(); while (matcher.find()) { list.add(matcher.group(1)); } return list; }
0388e098-f926-4bad-8e7b-dfd88a35e663
7
* @param slotName * @return Slot */ public static Slot lookupSlot(Stella_Class renamed_Class, Symbol slotName) { if (renamed_Class == null) { return (null); } { int offset = slotName.symbolSlotOffset; Slot cachedslot = null; if (offset != Stella.NULL_INTEGER) { cachedslot ...
eee15794-6712-4734-9435-50ebbd4b3fcb
0
public void stopLiveWindowMode() { _table.removeTableListener(_listener); }
396504fa-fd3a-4e29-b63f-a03dcd8ea1e2
9
@Override public int countParameters(String wsdlPath) { int count = 0; try { FileInputStream fstream = new FileInputStream(wsdlPath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); ...
caec3838-7975-481c-85d2-94a8e01c49fc
5
public static MapleStorage loadStorage(int id) { MapleStorage ret = null; int storeId; try { Connection con = DatabaseConnection.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT * FROM storages WHERE accountid = ?"); ps.setInt(1, id); ResultSet rs = ps.executeQuery(); if...
57d08bf0-1381-4420-b99d-b4a661e20b6c
3
private void drawClose(Graphics g, int x, int y) { if(tabbedPane != null && tabbedPane.getTabCount() > 0){ Graphics2D g2 = (Graphics2D)g; drawColored(g2, isUnderMouse(x,y)? Color.RED : Color.WHITE, x, y); } }
c3a28051-a893-4374-b0ab-bb4669f8dbd6
6
public static <K, V> MultiValueMap<K, V> unmodifiableMultiValueMap( MultiValueMap<? extends K, ? extends V> map) { Assert.notNull(map, "'map' must not be null"); Map<K, List<V>> result = new LinkedHashMap<K, List<V>>(map.size()); for (Map.Entry<? extends K, ? extends List<? extends V>> entry : map .entrySe...
bc65aadb-3df0-427d-b746-558adbf4975f
5
private int findBestMove(int turns, int card){ int max_pos = 0, discard; last_score = null; //Test every possible move for (int i=0; i<game.rack_size; i++){ //See if the card is usable in this position if (game.card_count-card < game.rack_size-i-1 || card-1 < i) continue; //Swap card with this posi...
d93edb67-4c86-445d-ba42-5ab11bf84d39
5
@Override public IEmailKontakt previous(IEmailKontakt emailKontakt) throws NoPreviousEmailKontaktFoundException { EmailKontaktList emailContacts = readContacts(); if (emailContacts.getContactList().size() == 0) { throw new NoPreviousEmailKontaktFoundException( "Kein Kontakt gefunden!"); } else { Em...
ee43a22c-f906-4e64-b8d2-6f7d76af80e4
8
public FST<T> finish() throws IOException { final UnCompiledNode<T> root = frontier[0]; // minimize nodes in the last word's suffix freezeTail(0); if (root.inputCount < minSuffixCount1 || root.inputCount < minSuffixCount2 || root.numArcs == 0) { if (fst.emptyOutput == null) { return null...
0670052c-1449-4d38-a75f-be9d130f7d00
8
public void run() { super.run(); running = true; while (running) { beginTime = System.currentTimeMillis(); this.update(timeDiff); do { do { this.draw(); } while (strategy.contentsRestored()); ...
dd96f35f-5042-46f5-90f1-efef19608eab
4
public static Choreo fromString(String path){ try{ InputStream inputStream = new FileInputStream(path); InputStreamReader isr = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(isr); StringBuilder sb = new StringBuilder(); String line; while ((line = bufferedRea...
e76630a5-e606-41ab-b376-fb5c4e140f5f
5
private Object waitForResponse (byte responseID) { if (connection.getEndPoint().getUpdateThread() == Thread.currentThread()) throw new IllegalStateException("Cannot wait for an RMI response on the connection's update thread."); long endTime = System.currentTimeMillis() + timeoutMillis; while (true) { ...
8ca37465-d98e-4b60-91b2-0748a5ebc419
7
private void shutdown() { logger.config("Shutting down.."); // Close the packetworker if(packetWorker.isRunning()){ packetWorker.setRunning(false); } // Close the taskWorker if(!singleThreaded){ if(taskWorker.isRunning()){ taskWorke...
25013714-dc51-4530-ac24-d949ee5eb9fd
6
protected int handleInput(Automaton automaton, AutomatonSimulator simulator, Configuration[] configs, Object initialInput, List associatedConfigurations) { JFrame frame = Universe.frameForEnvironment(getEnvironment()); // How many configurations have we had? int numberGenerated = 0; // When should the nex...
7d2fe794-ddd7-4fbe-a8f3-e25994580e78
4
public static String trim(String str) { String result = str; StringBuffer temp = null; if ((result == null) || (result.trim().length() == 0)) { return result; } temp = new StringBuffer(""); for (int i = 0; i < result.length(); i++) { if (result.charAt(i) != ' ') { tem...
aea7557f-1a67-4940-bde7-67b4bd8266e3
5
public void cmdOffers(CommandSender sender, String[] args) { if( args.length < 2 ) { sender.sendMessage(Conf.colorMain + "Usage:"); sender.sendMessage(Conf.colorAccent + "/ee offers <material name>"); return; } Material material = materials.get(args[1]); if( material == null ) { sender.send...
a81cd231-db04-48de-8dbe-6a5c1a39597b
3
public static ArrayList<bConsulta2> getMediaHoras2(String dt1, String dt2, Integer gmp, String arg_prod) throws SQLException, ClassNotFoundException { ArrayList<bConsulta2> sts = new ArrayList<bConsulta2>(); Connection conPol = conMgr.getConnection("PD"); ResultSet rs; if (conPol == null...
920a6702-a80b-43ad-af70-3a4bdfe7b440
7
public int reverse(int x) { boolean negative = true; int limit = Integer.MIN_VALUE; if(x > 0) { negative = false; x = -x; limit = -Integer.MAX_VALUE; } int ret = 0; while(x != 0 && x%10 == 0) { x/=10; } wh...
908cff82-ba93-4149-b034-eb109bf5d78b
9
public void sendResponseWithStatusAndHeaders( final AbstractBody respBody, final int httpStatus, final Map<String,String> headers) throws IOException { HttpResponseHeader respHead = new HttpResponseHeader(httpStatus); if (headers != null) { for...
ac3dd87a-fefa-4c52-99e5-023aa0cb6f49
9
public static void main(String[] args) { ArrayList<Integer> abundants = new ArrayList<Integer>(); final int n = 28123; final int n2 = n / 2; final int[] d = new int[n + 1]; for (int i = 1; i <= n2; i++) { int j = i; while (j + i <= n) { j +...
7b1572d8-0e2a-4d77-9d1c-7f7574730d8b
7
public void fusionWithBurnFullAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha1 = (...
887c17e1-82b1-45bc-ba1b-7fcffae42f1f
9
public boolean equalsMat(Matrix mat) { if (this == null && mat == null) return true; if (this == null || mat == null) return false; if (this.row != mat.rows() || this.col != mat.cols()) return false; for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { if (!matrix[i][j].equal...
97499170-f82f-48fa-9e1b-51630312f55c
3
public static void main(String[] args) { final boolean DEBUG = false; if (DEBUG) { //Test code FirstClass fc = new FirstClass(5, Column.F); BusinessClass bc = new BusinessClass(3, Column.D); List<TravelClass> pList = new ArrayLi...
1f7792e0-04e8-4df2-9ea9-f7bbb36320d5
6
private void makeVerticalCuts() { Random rand = new Random(); int begining; //the begining of the section (inclusive) int end; //the end of teh section (inclusive) boolean madeVertical; // tracks if a vertical path has been made in the section int i; begining = 0; do{ ...
a875b7f9-411b-42cc-bd7f-a84abcc8aad1
8
* */ public void maximize(Dockable dockable) { if (dockable.getDockKey().getLocation() != DockableState.Location.DOCKED) { // development error (could have been an assertion). throw new IllegalArgumentException( "Dockable isn't currently in the DOCKED state : " + dockable); } DockableState cur...
f1625b66-a4dc-4291-8636-7c867168004c
7
@SuppressWarnings("unchecked") public void update(Observable arg0, Object arg1) { if (arg1 instanceof Calque) { this.addCalque((Calque) arg1); this.revalidate(); } if (arg1 instanceof ArrayList<?>) { ArrayList<Calque> list = (ArrayList<Calque>) arg1; ListIterator<?> it = list.listIterator(); if...
dc2ef9dd-2102-4c6d-8c0a-d3a9b010f128
3
public String getSubject() { Object value = library.getObject(entries, "Subject"); if (value != null && value instanceof StringObject) { StringObject text = (StringObject) value; return cleanString(text.getDecryptedLiteralString(securityManager)); } else if (value...
aeaac183-3ba2-46a6-8c56-8224881399f4
6
public static void beAPeer() throws IOException, ParseException { // variáveis locais Message localMsg = new Message(); String msgIn; String msgOut; CommonMessage4Parameters msg4param = new CommonMessage4Parameters(); CommonMessage4Parameters msg4ParamLocal = new CommonM...
6fd697c0-097e-422c-a2a0-9ee4d2f45479
0
public void enterMessage() { UserInterface.println("Enter h for help.\n"); }
2e4b5afd-ef44-42e1-9049-7a3e4e77ebfa
9
public void ComputeSmallWindowStatisticByToeflDataSet() throws IOException{ int correctAnswers = 0; File testFile = new File(testFileName); BufferedReader testReader = new BufferedReader(new FileReader(testFile)); String rdline; int LineNo = 0; String[] question = new String[6]; while ((rdline =...
e0b49753-ee4e-4afa-9799-ad8858b700e0
4
@Override public byte[] receiveData(NetworkConnection targetConn, int targetDataSize) { byte[] toRet = null; TCPNetworkConnection conn = (TCPNetworkConnection)targetConn; if(conn != null && conn.currentServSocket !=null) { try { toRet = new byte[targetDataSize]; if(conn.currrentConnSocket.getIn...
74997f8f-e9bc-48da-a79d-0ae37a2d474b
1
public void tyhjenna(){ for (int i = 0; i < this.koko; i++){ keko[i] = null; } this.koko = 0; }
6e982286-c5d6-4067-821e-6e5fc5e2c163
4
public RaknaMedStrangarBerakning(String first, String operator, String second) { if("-".equals(operator)) //Kollar om det är subtraktion den skall utföra System.out.println(subraction(first, second)); if("+".equals(operator)) //Kollar om det är addition den skall utföra System.out.println(addition(first, sec...
8e3816c4-ff2f-4e75-98c8-2cd4d04cdd7a
8
@Override public void actionPerformed(ActionEvent e) { int size = 1; boolean flag = false; if(e.getSource() == brush){ canvas.set_selectedOption(DrawType.BRUSH); sizeSlider.setMaximum(30); size = 10; flag = true; ((JButton)e.getSource()).setBackground(Color.BLACK); } if(e.getSource() == pen){ ...
f26c101a-5dbe-4717-9eb7-a861a57f026d
6
private void retrieveSecretKeys(List<String> list) { String line; boolean bNewKey = false; String keyID = null; for (String list1 : list) { line = list1; if (line.startsWith("sec")) { Pattern p = Pattern.compile("^.*/([^\\s]+).*"); ...
b3231762-bbd4-4feb-b884-de0017666650
8
private void createAndConnectSegmentsToInputs() { upperArmSegment = null; if (shoulder != null && elbow != null) { List<Mass> upperArmInputs = getMassesBetweenYRange(shoulder.getY(), elbow.getY()); if (upperArmInputs.size() == 2) { upperArmSegment = new Mass(sho...
2e1d6d5f-bcea-4a74-8681-4e8ce567c8a2
8
public Direction previousClockwise() { String direction = this.toString(); Direction nextDirection; if (direction.equals("n")) { nextDirection = Direction.newDirection("nw"); } else if (direction.equals("nw")) { nextDirection = Direction.newDirection("w"); } else if (direction.equals("w")) { nextDire...
1b920663-add7-4e77-b64c-93855aa22990
3
@Override public void run() { super.run(); this.running = true; try { serverSocket = new ServerSocket(SERVERPORT); System.out.println("Server: Listening..."); while(running){ // Cria um socket novo por cada pedido Socket sock = serverSocket.accept(); System.out.println("New Client Reques...
1041e9e7-e79e-4cca-8bf9-47b7c0971167
7
public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); for(int c = 0; c < dim; c++) { for(int r = 0; r < dim; r++) { if(isBarrier(c,r)){ g.setColor(Color.RED); g.fillRect(xPositions[c]+1, yPositions[r]+1,width,width); g.setColor(Color.BLACK); } else if( ...
41e95d6b-63f7-4ac7-8fbb-2420040f48dc
4
public void submitStrategy(Strategy... strategys) { if (strategys == null) return; for (Strategy strategy : strategys) { if (strategy != null && !strategyList.contains(strategy)) strategyList.add(strategy); } }
fafa9772-db16-4b72-9a04-ae3bcf27953b
9
public static void addDisplay() { boolean isValid = false; while (!isValid) { Scanner sc = new Scanner(System.in); System.out.print("Enter a UPC code: "); String upc = sc.nextLine(); if (upc == null || upc.isEmpty()) { if (lastUpc == null) { System.out.println("Error: No UPC provid...
53b91787-9bfc-4f57-82ff-e32f9d3c2feb
0
public RoomEventListResponse(final Boolean success, final String errorMessage, final List<RoomEvent> roomEventList) { super(success, errorMessage); this.roomEventList = roomEventList; }
d5363579-c732-4772-8bd0-5e67c7894ab0
8
public boolean appliesTo(Item item) { if (itemSpec.getName() != null && !itemSpec.getName().equals(item.getName())) { return false; } if (itemSpec.getCategory() != null && !itemSpec.getCategory().equals(item.getCategory())) { return false; } // applies filter only if the flag (secondHand) is tr...
d8c413ed-ea9d-4fd5-b2ca-1adf5a2c91a2
9
@Override public void processarImagem(ArrayList<int[][]> matrizes) { origem = matrizes.get(0); resultado = new int[origem.length][origem[0].length]; int recorde, coordI, coordJ; for (int i=0; i<resultado.length; i++){ for (int j=0; j<resultado[0].length;...
8ac41c72-08e5-4bac-9359-4900be3159ef
0
public double getEccentricity() { return Math.sqrt(1 + b * b / a * a); }
92c99305-7f08-441d-bf0d-e6ea85708073
7
public void rotateTo(float winkel) { if (winkel > 0) { if (arc + winkel > 360) { winkel = (winkel + arc) - 360; Movement.rotate(Movement.Type.TURN_LEFT);// TURN_RIGHT while (arc > winkel) ; } else {// ok winkel = winkel + arc; Movement.rotate(Movement.Type.TURN_LEFT); } while (a...
a17af1c2-0943-44a3-94d1-7fb4d0784ef5
3
public void testLineUp() { try { // Create a groop Groop g = new Groop("lutgroop", "lutgroop"); // Create some artists Artist a1 = new Artist("artist1"); Artist a2 = new Artist("artist2"); LineUp lineup = new LineUp(g); lineup.addArtist(a1)...
23fb7b81-89e6-4582-b510-bd71c3c58ea3
3
private void setIdentification() { if(trainerIdNumber>99999) trainerIdNumber=45897; else if(trainerIdNumber<10000) trainerIdNumber=45897; idString=""+trainerIdNumber; while(idString.length()<5) { idString="0"+idString; } }
1fb9d6bd-81c8-44ff-a148-ae957b1a77d6
1
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); exceptions = new ArrayList<Throwable>(); int size = stream.readInt(); for (int i = 0; i < size; i++) { exceptions.add((Throwable)stream.readObject()); } }
57959891-d1b1-4a5e-898d-1d16b68353bc
2
private ArrayList getStatesConnectedToState(State state, Automaton automaton) { ArrayList list = new ArrayList(); State[] states = automaton.getStates(); for (int k = 0; k < states.length; k++) { if (areDirectlyConnected(state, states[k], automaton)) { list.add(states[k]); } } return list; }
31ae3032-9320-4f1a-9e9c-3ca4ec2a20d5
2
public boolean peutModifier(Utilisateur utilisateur) { return utilisateur != null && ( getAuteur().equals(utilisateur) || utilisateur.getRole().getValeur() >= Role.Moderateur.getValeur() ); }
d715f7a9-e2e5-4101-89c4-373ccfaf8115
0
public ChatPane() { }
4beb04ac-8811-4e9d-b6cc-55350899557d
9
public void autoAddLoci(double head, double tail, double interval, String prefix) { if (prefix==null || prefix.trim().equals("")) { prefix = ""; } if (head<headPos) head=headPos; if (tail>tailPos) tail=tailPos; int count = (int) (1.0 +0.01*interval+(tail-head)/interva...
12c51c5c-19ea-45ff-aee7-55f03474fc05
1
public static String tanksString(ArrayList<Tank> tanks){ String tanksString = ""; for(Tank t:tanks){ String buf = tankString(t); tanksString = tanksString + buf + ":"; } return tanksString; }
8112501c-3c91-4025-a298-4c8c36515ef7
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace...
5aedb2f7-823d-4e11-b463-a14b6d412e61
3
public static Pathway loadPathway(BufferedReader reader) { String line; try { Pathway path = null; while((line = reader.readLine()) != null && !line.matches("<END>")) { String[] temp = line.split(";"); path = new Pathway(new Rectangle2D.Double(Integer.parseInt(temp[0]), Integer.parseInt(temp[1]), ...
0ee6e1a7-27fa-447b-9218-286dc105cca1
2
public void readIdentifier() { int start = column - 1; while (column < line.length() && Character.isUnicodeIdentifierPart(line.charAt(column))) column++; value = line.substring(start, column); }
c68fa2f6-60f1-4b54-b51d-b071431bdae6
4
public void handleMove(Player player, Packet03Move packet) { player.setxPosition(packet.getX()); player.setyPosition(packet.getY()); player.setWalking(packet.isWalking()); player.setRunning(packet.isRunning()); player.setMovingRight(packet.isMovingRight()); player.setFacingRight(packet.isFacingRight()); i...
0c8176c6-c996-4dc0-a2fa-ba9675e0debc
5
public String generateAllOutputs() throws Exception { // The first lines about the number of states and their names String result = "STATES_NO:" + (int) Math.pow(2, flipflops.size()) + "\n"; result += "STATES: "; for (int i = 0; i < Math.pow(2, flipflops.size()); i++) result += "S" + i + " "; result +...
a1ccf65a-9d41-4b77-b940-19030bec289a
3
@Override public void save() { if(file == null) { // TODO L'utilisateur choisis un chemin // A supprimer ensuite : file = new File("sauvegardeParDefaut"); }else { try { ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file)); oos.writeObject(shapes); oos.close(); } ca...
f3357099-b138-4521-9ee1-579e6b3a193c
8
public GradingToolbar(final DisplayTabsPane displayPanels, InteractTabsPane interactPanels) { this.setFloatable(false); displayPanes = displayPanels; interactTabs = interactPanels; compile = new JButton("Compile"); compile.setEnabled(false); compile.addActionListener(new ActionListener() { @Override ...
0938cd0e-b39a-44ae-9e8f-2797ac8b3741
5
public void setMinor(String singular, String plural) { Connection conn = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("UPDATE " + Constants.SQLTable + "_Banks SET minor = ? WHERE id = ?"); ps.setString(1, singular...
45f05fee-46c6-451c-b6d2-7a3b07bf36b9
5
public String execute() { String ret = ERROR; Connection conn = null; try { String URL = "jdbc:mysql://localhost/bookdatabase3"; String sql1 = new String(); ResultSet rs,rs1=null; Class.forName("com.mysql.jdbc.Driver"); conn = DriverManager.getConnection(URL, "root", "123456789"); String sql ...
28e9ae09-528a-48ad-9244-31239d10d72b
6
public LinearRegression(double[] x, double[] y) { if (x.length != y.length) { throw new IllegalArgumentException("array lengths are not equal"); } N = x.length; // first pass double sumx = 0.0, sumy = 0.0, sumx2 = 0.0; for (int i = 0; i < N; i++) sumx += x[i...
44ebf27d-3e40-4e31-a696-f535e0a2d4e5
1
public int getPosition() { int pos = 0; if (source != null) { pos = (int) (source.getMicrosecondPosition() / 1000); } return pos; }
aab7d4ca-e576-456c-ba06-eee3ca6be650
1
public void push(E e){ if(top == element.length){ increCapa(); } element[++top] = e; }
ff350113-4ea1-4074-854c-97a3780b329a
8
private void drawWinner() { String currentPlayer = ""; int player = 0; if (currentColor == blue) player = 1; if (currentColor == red) player = 2; if (Intro.names[(player - 1)].length() != 0) currentPlayer = Intro.names[(player - 1)]; else currentPlayer = "Player " + player; if (winner != 0) { if (curr...
7b2cbace-790a-414a-90ea-95db54031431
9
public void loadStatusBlocks(){ if (customConfigurationFile == null) { customConfigurationFile = new File(plugin.getDataFolder(), "status.yml"); if (customConfigurationFile.isFile() != true){ plugin.saveDefaultConfig(); } } customConfig = YamlConfiguration.loadConfiguration(customConfigurationFil...
cb6779c9-bdee-4522-9cbf-a4e2580486d4
8
public void send(Message msg) throws Exception { if(msg == null) throw new IllegalArgumentException("message must not be null"); num_threads.incrementAndGet(); int tmp_index=getWriteIndex(); // decrements write_permits // System.out.printf("[%d] tmp_index=%d\n", Thread.curre...
05a546ad-46c6-4314-9fef-4029aae481ce
6
private void prim(EdgeWeightedGraph G, int s) { scan(G, s); while (!pq.isEmpty()) { // better to stop when mst has V-1 edges Edge e = pq.delMin(); // smallest edge on pq int v = e.either(), w = e.other(v); // two endpoints ...
36fcaf77-d5ce-45e5-8902-cb8dfb387b0a
9
protected void placecbtn() { cbtn.c = new Coord(wsz.x - 3 - Utils.imgsz(cbtni[0]).x, 3).sub(mrgn) .sub(wbox.tloff()); if (flipped) { fbtn.c = new Coord(cbtn.c.x, wsz.y - 3 - Utils.imgsz(fbtni[0]).y - mrgn.y - wbox.tloff().y); if (lockbtn != nul...
d397f001-c059-401c-8d79-a8b735b8c9b6
3
public void getTrames() { //On crée une List contenant tous les noeuds "etudiant" de l'Element racine List trames = racine.getChildren("trame"); //On crée un Iterator sur notre liste Iterator i = trames.iterator(); int nbtrames =0; while(i.hasNext()){ i.next(); nbtrames++; } ...
97c69160-b817-4fe8-99b8-008ff0c0af16
1
@Override public void notifyMessage(String sender, String message) throws RemoteException { if(mMessageWindows.get(sender) == null) { MessageWindow window = new MessageWindow(sender, this); window.setVisible(true); window.addMessage(message); mMessageWindows.put(sender, window); } else { mMessageW...
46cef750-5cbb-4fff-bf07-1ea483d89f44
4
StringBuilder display(StringBuilder currentCode, CrossRef table) { currentCode .append(pdfHeader()) .append("/Font <<\n"); /* Get the Fonts */ for (int i = 0; i < linkedObjects.size(); i++) { BodyObject curobj = linkedObjects.get(i); if (curobj.getType() == "Font") { current...
07e64c35-e9e3-4165-9a95-ee697ce23cb3
8
public boolean execute(UnitStats unit, PhysicalGameState pgs) { // obviously, but no harm checking for the umpteenth time if (unit.id == unitID) { boolean result = false; switch (type) { case MOVE: result = pgs.moveUnit(unit, targetX, targetY); break; case ATTACK: result = pgs.attackUni...
579c71d6-091d-42d4-815d-80a109bd65d8
4
public static String getLocationId(Users users, String locationTitle) { JSONArray locations = users.getLocations(); if (locations.length() > 0) { String locationId; try { for (int i = 0; i < locations.length(); ++i) { JSONObject location = loca...
8e4d0432-1f38-4af5-82d2-4001d559ada7
2
public ArrayList createProductionsForTransition(Transition transition, Automaton automaton) { ArrayList list = new ArrayList(); if (isPushLambdaTransition(transition)) { list.addAll(getProductionsForPushLambdaTransition(transition, automaton)); } else if (isPushTwoTransition(transition)) { list.addA...
527c21bb-cc15-45d0-8a20-09b44bbb7719
1
public void NotifyTestInfoChanged() { for (ITestInfoNotification ti : testInfoNotificationListeners) { ti.onTestInfoChanged(testInfo); } }
d696c24f-d8d8-4b36-918e-6c782c2cbd21
3
public void visitContainedObjects(Visitor visitor) { for (EventFact eventFact : getEventsFacts()) { eventFact.accept(visitor); } for (LdsOrdinance ldsOrdinance : getLdsOrdinances()) { ldsOrdinance.accept(visitor); } if (chan != null) { chan.accept(visitor); ...
3318a699-259e-4024-a882-177f2f9dbbea
7
public void init(){ if (simpleDB == null) { // log.info("SimpleDBManager.init() "+this.getClass()); log.info("start"); FileInputStream inputStream; try { // log.info("AWS Credential file : "+this.getClass().getResource("../AwsCredentials.properties") // .getPath()); log.info("SimpleD...
3cdab96b-fe3e-4799-be58-0fbeaf3eac19
4
public void revokeStrategy(Strategy... strategys) { if (strategys == null) return; for (Strategy strategy : strategys) { if (strategy != null && strategyList.contains(strategy)) strategyList.remove(strategy); } }
32bd9dd1-ba90-4d83-9f0b-5207e21d25fc
3
private void saveDomain() { if (domaine == null) { return; } try { ObjectOutputStream output_domain = new ObjectOutputStream(new FileOutputStream(domaine.getNom()+FILE_EXTENSION)); output_domain.writeObject(domaine); output_domain.flush(); output_domain.close(); } catch (FileNotFoundException e) ...
33cb7c3e-5c14-4edf-8962-df1d168f9ae6
3
public static void checkFolders(String[] folders) { for (String folder : folders) { File f = new File(folder); if (!(f.exists() && f.isDirectory())) f.mkdir(); } }
2e7ba232-c5e9-433b-8d64-5def0c776889
5
@Override protected void onChildDeleted(int index, Construct deleted) { super.onChildDeleted(index, deleted); if(getPlaceholders() != null && deleted.getClass().equals(PlaceholderConstruct.class) == false) // Forced, internal deletion { Placeholder descriptor = getPlaceholderForIndex(index); if(!de...
82b3b601-4a0f-4988-a55d-b38b4cc9fb5d
6
public boolean onCommand(CommandSender commandSender, Command command, String label, String[] args) { if(! (commandSender instanceof Player)) { commandSender.sendMessage(ChatColor.DARK_RED + "You need to be a player to use this command!"); return true; } Player senderPlayer = (Player) commandSender; if(! (s...
063dbe58-33c8-4978-afa8-3dcc404c7aa3
0
public boolean isFlying() { return false; }
af6ca75c-306f-4c5b-a766-d2cd3eb87df2
7
public int firstMissingPositive(int[] A) { for (int i = 0; i < A.length; i++) { //since the array start from 0, A[i] will be put in i position while (A[i] != i + 1) { //think about the nagetive & 0 number, out of the length, and duplicate number if (A[i] ...
0fcf81dc-9be1-4439-854a-d65931827f79
2
public static TreeNode[] children(TreeNode node) { TreeNode[] children = new TreeNode[node.getChildCount()]; if (!node.isLeaf()) { int i = 0; Enumeration enumer = node.children(); while (i < children.length) children[i++] = (TreeNode) enumer.nextElement(); } return children; }
d741cf4c-535b-4cd4-8ce2-025cc627f5ed
9
public ListNode deleteDuplicates(ListNode head) { ListNode uniqueTail = null; ListNode uniqueHead = null; ListNode tentativeNode = null; boolean duplicate = false; while (head != null) { if (tentativeNode == null) { tentativeNode = head; ...
b8f598a6-0100-4a54-ab6c-53e79b32cfee
6
public void processOMMDataDictionaryEvent(OMMMsg respMsg) { // *_log<<"Received dictionary Response"<<endl<<endl; // _dataDict.setDictId(respMsg.getAttribInfo().getID()); if (respMsg.getMsgType() == OMMMsg.MsgType.REFRESH_RESP || respMsg.getMsgType() == OMMMsg.MsgType.UPDATE...