method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2ebbe0ca-50b9-4f4c-b427-06830b832a05
3
public void printStatus() { boolean alleVersenkt = true; for (WarMachine w : warMachine) { if (!w.isVersenkt()) alleVersenkt = false; } if (alleVersenkt) spielerstatus = new StatusVerloren(); ausgabe.printSeparator(); System.out.println("Sie haben " + spielerstatus.getSpielerstatus()); }
a5e6bee6-fbaf-4f14-ab0b-2d431129384b
0
public void setEncryptionScheme(EncryptionMethodType value) { this.encryptionScheme = value; }
35885ee5-b47d-4cf1-8693-818d3e15f892
0
@Override public String getDesc() { return "DarkBreath"; }
700051ee-884a-4a2a-bf23-a87b06430e66
1
public static void validateTourist(Tourist tourist) throws TechnicalException { if (tourist == null) { throw new TechnicalException(MSG_ERR_NULL_ENTITY); } validateFIO(tourist.getFirstName()); validateFIO(tourist.getMiddleName()); validateFIO(tourist.getLastName()); ...
5854257a-e957-4f8c-aeaf-8627e99b770c
1
void setlayers(List<Indir<Resource>> layers) { if(rend == null) rend = new AvaRender(layers); else rend.setlay(layers); }
3d2ca8a0-7525-48ec-8204-11c7ef9dd831
8
public void run() { // 1) asks for task in hard drive memory if ((phase == 0) && (pState.equals("ru"))) { PyOS.askForResource(PyOS.waitingList7, 7); neededResource = 7; phase = 1; } // 2-4) deleting or creating jobGovernor if ((phase == 1) && (pState.equals("ru"))) { if (((TaskInHardDrive) PyOS....
349966b6-99b5-40cd-b2d4-5bd25868aa54
1
public boolean enregistrerRetourVehicule(int numeroLocation, int nombreKm){ System.out.println("ModeleLocations::enregistrerRetourVehicule()") ; Location location = rechercherLocation(numeroLocation) ; if(location != null){ location.setEtat(Location.TERMINEE) ; location.setDateRetour(new GregorianCalendar()...
5f3ba242-cc59-4447-9da5-5b7f3e67e8c6
2
private void method242(Stream buffer) { for (int i = 0; i < 10; i++) { int j = buffer.getUnsignedByte(); if (j != 0) { buffer.offset--; soundtracks[i] = new Soundtrack(); soundtracks[i].method169(buffer); } } anInt330 = buffer.getUnsignedShort(); anInt331 = buffer.getUnsignedShort(); }
65fbfc18-ef05-491f-9b20-e109ccdd8e6c
6
public static void main(String args[]) { DAOOwner daoOwner = new DAOOwner(); DAOVehicle daoVehicle = new DAOVehicle(); DAOModel daoModel = new DAOModel(); Owner owner1 = new Owner("antoine", "lucas", "1 rue de gigant", null); System.out.println("Owner creation test :"); ...
279f52e5-552d-4a0c-8b27-b56e8d306079
2
private void logFilter(String channel, String sender, String message, String type) { PrintWriter out = null; try { out = new PrintWriter(new BufferedWriter(new FileWriter(FILTERLOG, true))); SimpleDateFormat logsdf = new SimpleDateFormat("MM/dd/yy h:mm:ss aa"); ou...
b106fd61-90e2-4344-9589-66d04b927aa4
8
public static void checkGremlins(){ //Check and respond to hitting gremlins long px = Math.round(player.xCoord); long py = Math.round(player.yCoord); int n; for (n=0;n<gremlin.allGremlins.size();n++){ if (gremlin.allGremlins.get(n).world==player.world){ long x = Math.round(gremlin.allGremlins.get(n).xCo...
d95673ed-d873-4896-9593-3f75e6f1d6dc
7
public void execute(CommandSender sender, Command command, String[] args) { if(!args[0].equalsIgnoreCase("top")) return; if(!Permissions.COMMANDS_MONEY_TOP.validate(sender)) { Messenger.noPermissions(sender); return; } int pageAmount = (int) Math.ceil((double)su...
4d340983-412c-4e0b-a93f-cbc8628c706e
5
public JsonElement next() throws JsonParseException { if (!hasNext()) { throw new NoSuchElementException(); } try { return Streams.parse(parser); } catch (StackOverflowError e) { throw new JsonParseException("Failed parsing JSON source to Json", e); } catch (OutOfMemoryError e...
d98806d3-2971-4d5e-905b-b46fb8473e62
7
public int coinChangeIter(int[] coins, int amount) { if (amount < 1) return 0; int[] dp = new int[amount + 1]; int sum = 0; while (++sum <= amount) { int min = -1; for (int coin : coins) { if (sum >= coin && dp[sum - coin] != -1) { int temp = dp[sum - coin] + 1; min = min < 0 ? temp : (te...
d30fcb73-fd61-4439-9331-ef74e8e98df6
9
private void processGridletReturn(Sim_event ev) { if (trace_flag) { System.out.println(super.get_name() + ": received an GRIDLET_RETURN event. Clock: " + GridSim.clock()); } Object obj = (Object) ev.get_data(); Gridlet gl = null; Random ra...
6a8a6452-23f0-43a6-b2ce-b6ae69c2c284
4
private String isRedirect() { String html = null; try { Header header = getMethod.getResponseHeader("location"); html = null; if (header != null) { String newUrl = header.getValue(); if (newUrl == null || newUrl.equals("")) { newUrl = "/"; } CatchPage cp = new CatchPage(); html = c...
83468ec5-39ba-4958-a467-014197043f1a
1
public void undo() { System.out.println(history); if (!history.isEmpty()) { CardMove toUndo = history.pop(); toUndo.undo(this); } }
e922e048-9139-42ce-bb27-64964717a433
9
public void paint(Graphics g) { this.setDoubleBuffered(true); Insets in = getInsets(); g.translate(in.left, in.top); // System.out.println("paint();"); if (isThinking) g.drawChars(thinkingText.toCharArray(), 0, thinkingText.length(), 20, 20); // int[][] gameboard = logic.getGameBoard(); int cols...
280f73cf-300e-4c49-ad35-228112d625f7
2
public int getProvinceCount(String playerName) { int count = 0; String query = "SELECT `id` FROM `Monarchy_Provinces` WHERE `player` = ?"; Connection con = getSQLConnection(); try { PreparedStatement statement = con.prepareStatement(query); statement.setString(1, playerName); ResultSet result = state...
b0d844f0-e5ce-4215-95b7-ba8a1375bf17
4
public static void main(String[] args) { //Load the problem from csv file NormalDistributedStochasticLotsizingProblem problem = new NormalDistributedStochasticLotsizingProblem(new File("examples/example_problem_Tempelmeier2012_p319.csv")); //Create a static uncertainty solver AbstractStochasticLotSizingSolve...
fd2c27b4-ea8d-4907-82dc-022fe21ae303
9
private String _calcKeyString(URI uri, int mode) { String scheme = uri.getScheme(); String host = uri.getHost(); int portInt = uri.getPort(); String port = (portInt < 0) ? null : ("" + portInt); String path = uri.getPath(); if (host != null) { if (host.length() < 1) host = null; } if (...
a0de2572-a42f-43ab-8fdf-5b3330d9fd72
6
private void createHeader() { playerList = new JComboBox<String>(); playerList.setModel(createPlayerNameModel()); playerList.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { ...
f4e23c47-b265-463d-b1fe-62f05c00913b
0
private void main_ok() { main_apply(); hide(); }
ecbe721f-4ea9-4ed9-aa7a-a6444ae64b84
0
@Override public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); }
363ddda1-cada-4432-ab9c-83a2ad064098
2
public void bufferedContent(){ if(this.isBuffered.compareAndSet(false, true)){// 如果已经做的缓存就不做处理了 this.currentByteBuffer = null;// 将当前缓冲区置空 this.currentBufferQueue = new ConcurrentLinkedQueue<ByteBuffer>();// 当前正在处理的缓冲区队列 ByteBuffer headerBuffer = processBuffered(this.header); ByteBuffer bodyBuffe...
ffc69471-eb77-444c-98f0-01beb190999e
5
private List<Gate> getMGates(int startOfE, int startOfA, int startOfB, int m1, int startOfMComputation, int startOfM) { List<Gate> res = new ArrayList<Gate>(); //Construct the AND and XOR gates int priorOutput = 0; int m1Squared = m1 * m1; int[] aConvolutedE = new int[m1]; for (int j = 0; j < m1; j++) {...
60ec302a-69e8-4ab9-9280-94430cce0498
9
@SuppressWarnings("unchecked") //static int k=1; public static void main(String[] args) throws IOException { Connexion Cn= new Connexion(); int k=1; for(int i= 1; i<=18;i++){ org.jsoup.nodes.Document doc1 = lireDocument("http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtm...
b2d06520-7d3f-4612-a009-bc794d4055cf
8
@Override public SufficientStatistics clone() { SufficientStatistics newStats = new SufficientStatistics(); if( !this.isSet()) return newStats; if( this.Mxx == null) { newStats.Px = new double[this.Px.length][this.Px[0].length][this.Px[0][0].length]; newStats.counts = new double[this.counts.length...
8ada74b3-ba21-4618-a2d5-588da9bcde2c
6
public boolean setDefaultPrice(OfflinePlayer player, Chest chest,Integer price){ if(player==null || chest==null || price==null) return false; if(price<=0) return false; if(!isStore(chest)) return false; if(!getStoreOwner(chest).equals(player)) return false; stores.get(chest).setDefault...
92df4f75-e14c-4e9d-aaae-af2268bc9238
3
@PUT() @Path("trade/{playerId}/newteam/{teamId}") @Produces("application/json") @SportService(ServiceType.MLB) public Player tradePlayer(@PathParam("playerId") int iPlayerId, @PathParam("teamId") int iTeamId) { Player p = new Player(); UserTransaction utx ...
ba1b5bde-7155-42cb-a18e-df730b3d215f
1
public boolean register(String userID, String password, String email) { // TODO Auto-generated method stub ClientDB c = new ClientDB(userID, password, email); if(getFact.addUser(c)){ return true; } else return false; }
fe77ed46-9c3f-463f-85fb-406492fee8da
2
public List<OperatoerDTO> getOperatoerList() throws DALException { List<OperatoerDTO> list = new ArrayList<OperatoerDTO>(); ResultSet rs = Connector.doQuery("SELECT * FROM operatoer"); try { while (rs.next()) { list.add(new OperatoerDTO(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getString(4),...
fa8a8488-92d0-4e96-ae6f-6082859f79be
5
public static void drawHorizontalLine(int x, int y, int width, int colour) { if (x < topY || x >= bottomY) return; if (y < topX) { width -= topX - y; y = topX; } if (y + width > bottomX) width = bottomX - y; int pointer = y + x * DrawingArea.width; for (int column = 0; column < width; column++) ...
7f263bf6-cf4d-4982-8f9e-7f4da764eb76
1
public static void rethrowException() throws FileNotFoundException { FileInputStream fileInputStream; try { fileInputStream = new FileInputStream("fileNotFound.txt"); } catch (FileNotFoundException e) { throw e; } }
4d40c127-566e-4685-b41f-c46129ebebd6
5
public static void main(String[] args) { boolean answer = false; int result = 20; int iterations = 0; for (int j = 1; j <= 20; j++) { while (isDividable(result, j)) { answer = true; } } while (!answer) { for (int j = 1; ...
2007e40a-70ea-446b-891e-66f39974b3cc
9
public int compare(Record a, Record b) { if (a == null && b == null) { return 0; } else if ((a == null && b != null) || (a != null && b == null)) { return a == null ? 1 : -1; } else { int recordCompare = 0; if (a.zipcode > b.zipcode...
7496366d-5e4e-42b4-871f-43be6f7627b9
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; OperacionPermitida otra = (OperacionPermitida) obj; if (lex == null) { if (otra.lex != null) return false; } else if (!lex.equals(otr...
e49d9ea4-7784-4528-a0fa-c523de5e89d6
4
@Override protected ArrayList<ColorPatch> doInBackground() throws Exception { ArrayList<ColorPatch> patches = new ArrayList<>(); publish(new Double(0.0)); for (int y=0; y<image.getHeight(); ++y) { for (int x=0; x<image.getWidth(); ++x) { if ( isIncluded(x, y) ) { ColorPatch patch = followPixel(...
b4f42792-eb17-4fb2-8ea9-69f44b783afa
4
@Override public Ptg calculatePtg( Ptg[] form ) { try { // 20090202 KSC: Handle array formulas Object[] o = super.getValuesFromPtgs( form ); if( !o[0].getClass().isArray() ) { //double[] dub = super.getValuesFromPtgs(form); // there should always be only two ptg's in this, error if not. if...
3ba31328-15ff-4051-b6ef-364d600a44db
2
public static String getSessionId(URLConnection con) { StringBuffer s = new StringBuffer(); for (String data : con.getHeaderFields().get("Set-Cookie")) { if (!StringUtil.isBlank(s.toString())) s.append(","); s.append(data); } return s.toString(); ...
8c415380-b280-4583-b3d8-1aaf9031917e
9
Point moveSheep(int sheepId) { Point thisSheep = sheeps[sheepId]; double dspeed = 0; Point closestDog = getClosestDog(sheepId); double dist = distance(thisSheep, closestDog); assert dist > 0; if (dist < RUN_DIST) dspeed = RUN_SPEED; else if (dist < WA...
e54d314c-5d08-4191-b9c1-29e37d792c6e
3
public void setSelectionSurvivalOp(String selectedSelectionSurvivalOp) { try { Class crossoverClass = Class.forName(selectedSelectionSurvivalOp); selectedSurvivalOp = (Selection) crossoverClass.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { ...
f9c248f8-d556-45ce-80cf-73ba4a19eeb3
3
public void update(GameContainer gc, StateBasedGame sbg, int delta) { for(int i = 0; i < worldTiles.size(); i++) { worldTiles.get(i).update(gc, sbg, delta); } for(int i = 0; i < worldEntities.size(); i++) { if(worldEntities.get(i).getHp() < 0) worldEntities.remove(i); worldEntities.get(i).update(gc, ...
6868572f-faee-48bb-b810-434b815fd6b6
1
public static void closeLogger(String logger) { for (Handler h : Logger.getLogger(logger).getHandlers()) { System.out.println("Closing logger"); h.close(); } }
5bc8678b-4d02-472d-922f-5662322d52b8
3
@Override public int hashCode() { int hash = 0; for (Map<?, ?> map : getMaps()) { hash += map.hashCode(); } return hash; }
3ce7ad67-697a-48ba-a95a-0cc10bb87d45
1
public void addChangeListener(ChangeListener l) { if (this.changeListeners.contains(l)) { return; } this.changeListeners.add(l); }
973ea7c6-1afe-4154-a91a-883fb7ed3fd4
6
@SuppressWarnings("unchecked") public void run(){ ObjectInputStream in = null; try{ socket = new Socket(HOST, PORT); System.out.println("Connected to server on " + HOST + ":" + PORT); while(true){ in = new ObjectInputStream(socket.getInputStream(...
64d6d3b1-8e3d-4811-a79c-15689077eca3
2
public void loadCreatureSprites() { Image[][] images = new Image[4][]; // load left-facing images images[0] = new Image[] { loadImage("player1.png"), loadImage("player2.png"), loadImage("player3.png"), loadImage("player4.png"), ...
81971cd8-249b-44d8-b291-40e3832bfb40
8
private synchronized void storeIDs(String tableName, boolean adjustQuantity, Connection connection) throws Exception { BigDecimal nextId = null; BigDecimal quantity = null; // Block on the table. Multiple tables are allowed to ask for // ids simultaneously. // TableMap tMap = dbMap.getTable(tableN...
f31a3a48-91b1-4c7d-a9c3-74d82541037d
4
private static String showDualDialog(JComboBox theSelectBox, JComboBox theReplaceBox, JLabel labelUpper, JLabel labelUpperMid, JLabel labelLowerMid, JLabel labelLower) { cont = true; JFrame theFrame = new JFrame("Instrument Replacer"); theFrame.setDefaultCloseOperation(JF...
a977b33a-1e37-4aec-a6cc-5a63431ced7c
6
private void krakLoadCoastline(String lowDetailedFile, String highDetailedFile) { CoastlineLoader clPinkGreen = new CoastlineLoader(1000000, 2000000) { @Override public void processNode(CoastlineNode nd) { if (nd != null) { try { ...
a88f546e-d894-44a2-8b6a-6f82bca21fec
9
public static String solve(String s, long n) { String result = ""; boolean flag = n > 0 ? true : false; n = n > 0 ? n : -n; for (int i = s.length() - 1; i >= 0; --i) { char ch = s.charAt(i); switch (ch) { case 'p': if (flag) { result += n % 2; n /= 2; break; } else { result ...
472c4635-7de9-4e44-b4ee-2fd2e8f7c1c7
4
public int diff_levenshtein(LinkedList<Diff> diffs) { int levenshtein = 0; int insertions = 0; int deletions = 0; for (Diff aDiff : diffs) { switch (aDiff.operation) { case INSERT: insertions += aDiff.text.length(); break; case DELETE: deletions += aDiff.text.length(); break; case EQ...
e1c2aae9-5018-42ce-b9a9-2e2543167fba
0
public int getDistanceToTarget() { int xDistance = Math.abs(getIntelligentX() - getTargetX()); int yDistance = Math.abs(getIntelligentY() - getTargetY()); return Math.max(xDistance, yDistance); }
1965b0a0-769b-4320-a3c1-197ebdd1f8a2
7
public static void calculer(Vector<Vector<String>> data,String pivot) { int ligne_pivot = Integer.parseInt(pivot.split(",")[0]); int col_pivot = Integer.parseInt(pivot.split(",")[1]); /* ===================== Copie de la matrice ================= */ Vector<Vector<St...
f49e0e2d-1446-4ecb-b6aa-b1ec934b4c59
0
public final AbstractCountingBloomFilter<Short> getCbf() { return cbf; }
d0257981-95c8-40e4-835a-6b2d0379246e
4
public static void extendZoneTest(Map map, int x, int y) { System.out.println("Plains of the map : "); for (int i = 0 ; i < x ; i++) { for (int j = 0 ; j < y ; j++) try { if (map.getZone(i, j).getKindOfZone() == KindOfZone.PLAIN) { PlainZone plain = (PlainZone) map.getZone(i, j); Syst...
680af4f6-4365-425c-b44c-84533fb7725d
9
private void genFunctor(String functorType, String parameterList, String argumentList, String errorClassName, PrintWriter pw) { String definitionClass = "org.eigenbase.resgen.ResourceDefinition"; final String classNameSansPackage = Util.removePackage(className); final String bundleThis = classNa...
53bafb82-62a7-4af3-9aee-d84fc4325926
9
public ExperimentPane() { frame = Frame.getInstance(); setLayout(null); JButton backButton = new MainButton("/images/back.png", "/images/backHover.png"); backButton.setBounds(10, 0, 71, 51); this.add(backButton, 0); backButton.addActionListener(new ActionListener() { @Override public void action...
4e19c4cd-79d9-4c68-9ed7-9d16f7034677
3
public static void freshStatus(String status) { String pathStatus = ""; if (path == null || path.isEmpty()) { pathStatus = "【没有选中的报表文件夹】"; } else { pathStatus = "【当前报表位置:" + path + "】"; } String statNumber = ""; if (StatData.errorNumber > 0) { statNumber = "本次检测发现错误" + StatData.errorNumber + "个";...
fb2f1cdf-ebf2-4563-994c-514b6b3799b1
1
public Class<?> getColumnClass(int col) { return getValueAt(0, col).getClass(); }
a299c011-9147-4c70-b42e-894ab505a316
2
public Session GrabSessionByName(String Name) { for(Session mSession : this.SessionList.values()) { if (mSession.GrabHabbo().Username == Name) { return mSession; } } return null; }
0cd2cfb2-c820-49b5-bf25-26391011d465
8
private static void printReleventFeatures() { String word = null; HashMap<String, LinkedHashMap<String, Double>> newMap = new HashMap<String, LinkedHashMap<String, Double>>(); LinkedHashMap<String, Double> curMap = new LinkedHashMap<String, Double>(); for(Entry<String, LinkedHashMap<Stri...
ad79d539-b657-4724-a1a6-dc9e3610e3d4
3
public void testCharArrayReverse() { String s = "Hello World"; String reverse = "dlroW olleH"; StringBuilder sb = new StringBuilder(); char[] test = s.toCharArray(); test = Main.reverseCharArray(test); for(int i = 0; i< test.length; i++) { sb.append(test[i]); } assertEquals(reverse, sb.toStri...
2e478a91-07b0-4c02-82ac-4bbf084880f1
8
private static boolean isStackAssignement2(Exprent first, Exprent second) { // e.g. 1.4-style class invocation if (first.type == Exprent.EXPRENT_ASSIGNMENT && second.type == Exprent.EXPRENT_ASSIGNMENT) { AssignmentExprent asf = (AssignmentExprent)first; AssignmentExprent ass = (AssignmentExprent)secon...
ee97da47-03fa-4ad9-b661-36045e127f3a
3
public boolean equals(Object o) { if (o == null) { return false; } if (o.getClass() != Position.class) { return false; } Position other = (Position) o; return r==other.r && c==other.c; }
ede7a05d-1b46-4a13-85cc-7be825f0d2fd
0
public void setChefVente(String chefVente) { this.chefVente = chefVente; }
7cf662ee-ccc3-47e6-875e-012c30a6cc68
6
@CanReturnNull public static Command getCommandByID(int commandId) { Command toRet = null; ArrayList<Class<?>> availableCommands = (ArrayList<Class<?>>) ReflectionHelper.getCommandClasses(); for(Class<?> comm:availableCommands) { try { Command currComm = (Command)comm.newInstance(); if(currComm....
d3d2a7d8-69dd-490e-bf55-3a7510c71f4a
9
private void moveRow(Board b, int caller) { int posNr = 0; Position tmp = null; int i, j; int foundPos = -1; i = 1; j = 1; while (j <= b.getHeight()) { i = 1; while (i + 1 <= b.getWidth()) { if (b.isFree(i, j) && b.isFree(i + 1, j)) { b.set(i, j); b.set(i + 1, j); foundPos = pos.s...
cdc92ffa-d7c5-4a65-9d46-e967db8598c9
3
public static int login(String user_email, String user_password) { int user_id = -1; try { SQLiteJDBC db = new SQLiteJDBC(); String sql = String.format("SELECT user_id FROM users WHERE email='%s' AND password='%s'",user_email,user_password); ...
f9298acb-9b74-4dd4-9277-dcf60f3bd43d
1
public void removeItems(List<SoldItem> soldItems) throws IllegalArgumentException { for(SoldItem item : soldItems) { removeItem(item); } }
87736f44-7b91-4b13-8c1b-5a41e3e080d5
8
public Vec3D func_514_g(double par1, double par3, double par5) { int var7 = MathHelper.floor_double(par1); int var8 = MathHelper.floor_double(par3); int var9 = MathHelper.floor_double(par5); if (BlockRail.isRailBlockAt(this.worldObj, var7, var8 - 1, var9)) { --va...
84e3dd92-c936-4da9-8106-dae6dfce5667
3
public static void main(String[] args) throws IOException { StringBuilder out = new StringBuilder(); Scanner in = new Scanner(System.in); while (in.hasNext()) { int size = in.nextInt(); m = new long[size][size]; long max = Long.MIN_VALUE; for (int i = 0; i < m.length; i++) for (int j = 0; j < m.le...
d7315a1c-9418-4cea-b202-10597779fb2b
5
public static void calculateWeights(final String pathToA, final String targetTrajectoryFile, final String weightsFile, final int offset) { try { RealMatrix A = csvToMatrix(pathToA); // cut first n elements A = A.getSubMatrix(offset, A.getRowDimension() - 1, 0, A.getColumnDime...
eb6a49bb-1e7b-41c6-8acc-4f9b9f6798d4
0
public void setContactMovil(String contactMovil) { this.contactMovil = contactMovil; }
b4fda968-0ceb-4e3e-9c88-ca5d7d4a3257
4
public static void transpose(int[][] tab) { int[][] tabcopie = new int[tab.length][tab[0].length]; for(int i = 0; i < tab.length; i++) { for(int j = 0; j < tab.length; j++) { tabcopie[i][j] = tab[i][j]; } } for(int i = 0; i < tab.length; i++) { ...
70bdcf66-15ab-491f-8bf7-87a8c415569d
9
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof CaracteristicasParqueaderosPK)) { return false; } CaracteristicasParqueaderosPK other = (CaracteristicasParqueaderosPK)...
37b64c35-6a53-47e1-a5fb-7069bb114541
4
private void placeAmmo(int count) { Random rand = new Random(); while (count > 0) { int pos = rand.nextInt(WIDTH_FIELDS * HEIGHT_FIELDS); IField field = fieldsMatrix[pos / WIDTH_FIELDS][pos % WIDTH_FIELDS]; if (field.getType().equals("building") && !field.hasLife() && !field.hasAmmo()) { field.s...
a510e530-60f3-4a13-b59d-8b3381b10b88
9
private int read1(char[] cbuf, int off, int len) throws IOException { if (nextChar >= nChars) { /* If the requested length is at least as large as the buffer, and if there is no mark/reset activity, and if line feeds are not being skipped, do not bother to copy the characters into the loca...
bada5145-2fc2-4172-b1fd-10a8bce8f465
2
@Test public void testGetWithoutContention() { LockRef<String> mod = new LockRef<String>("Hi"); System.out.print("Empty method call time: "); for (int i = 0; i < 1000; i++) { watch.start(); emptyMethod(); watch.stop(); } System.out.println(watch.nanos() + "ns"); System.out.print("Module ...
558fbca5-e23b-42c0-8d0e-8a34c3e8dbf3
4
public double weight(int i, int j) { if(i < 0 || i >= m) throw new RuntimeException("given m=" + m + ", illegal value for i: " + i); if(j < 0 || j >= n) throw new RuntimeException("given n=" + n + ", illegal value for j: " + j); return _weights[i][j]; }
8c4964a4-e65b-4caf-8aaa-9e59c31c0e74
8
@Override public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2d = (Graphics2D)g; /* added by Adam * this draws a background image if there is one... */ if(background != null && !isGlass){ g2d.drawI...
a9590d06-a36e-4524-adfd-eb3c846dc6cb
2
@Override public void toggleEditability(int row, AttributeTableModel model) { AttributeContainer node = view.tree; if (node == null) { return; } String key = (String) model.keys.get(row); Object oldAndNewValue = node.getAttribute(key); boolean oldReadOnly = node.isReadOnly(key); boolean readO...
e2632923-33b4-4bb1-a538-1f4bdc2ef63b
8
public void moveInwardsBy(float offset){ int type = this.getType(); if(type == TYPE_SLOPED) throw new RuntimeException("Cannot move a sloped egde inwards: "+this); float xOffset = 0; float yOffset = 0; ShapePoint middle = getMiddle(); GeneralPath path = owner.makeIntoPath(); if(type == TYPE_HORIZ...
ef3f1f74-789d-41d0-a3fb-6215cb26bd77
2
int getMax() { int max = 0; for (int i = 0; i < size; i++) { if (stack[i] > max) max = stack[i]; } return max; }
a3d3f086-e96f-46f3-9d78-07318a74eba2
9
@Override public int hashCode() { int result; long temp; result = (int) (id ^ (id >>> 32)); result = 31 * result + (int) (version ^ (version >>> 32)); result = 31 * result + (int) (problemId ^ (problemId >>> 32)); result = 31 * result + (submission != null ? submissio...
44cb7061-fba9-4082-a088-ec9cb643ab4a
7
public void displayResults(boolean showMismatches,PrintStream out) throws IOException { PrintfFormat fmt = new PrintfFormat("%s %3d %7.2f | %30s | %30s\n"); for (int i=0; i<pairs.length; i++) { if (pairs[i]!=null) { String label = pairs[i].isCorrect() ? "+" : "-"; ...
225567a5-a9bf-40df-8834-3ce4206862e6
6
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Map<String, String[]> requestParameters = req.getParameterMap(); Query query = null; StringBuilder params = new StringBuilder(); for (String name : requestParameters.keySet()) { ...
1987ff7f-2e7c-4193-8e59-7299f5eae902
2
@Override public void run() { Graphics g = getGraphics(); int x1=22, y1=22, dx=44, dy=66; //g.drawLine(x1,y1,x1+dx,y1+dy); for(int i = 0; i<100; i++) { x1=x1+i; y1=y1+i; System.out.println(i); g.drawLine(x1,y1,x1+dx,y1+dy); //g.fillRect(x1, y1, x1+dx,y1+d...
df619007-8dad-45e1-97a1-7980c9aad2c7
8
private void initElements() { // Open the JFrame frmAdjustersList = new JFrame(); frmAdjustersList.setTitle("Adjusters List"); frmAdjustersList.setBounds(0, 0, 600, 558); frmAdjustersList.setLocationRelativeTo(null); frmAdjustersList.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frmAdjustersList.setRe...
b1db926a-86bb-429f-909a-0be9ae7836aa
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); ...
8ee44b34-41bb-4554-a83d-b20f87984196
6
static final boolean method1751(byte byte0, char c) { if (byte0 > -103) { return false; } return c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; }
5dc69f69-7325-4c6b-b09e-560fce8495e2
3
public static void main(String[] ar){ Simulator s=new Simulator(20,40); for (int i=1;i<=50;i++){ Customer c; int mobil= (int)(Math.random()*58); c= new Customer(i+"",i,mobil); s.addEvent(new Event(c,c.getArrivalTime())); } Event e= ...
4559089e-323d-4ea1-b237-b177389853c1
6
public void fullHouse(int [] die, String name) { int [] counter = new int[6]; int answer = 0; int zero = 0; for (int i : die) ++counter[i - 1]; for (int i : counter) { if (i == 3) { ++zero; for (int j : counter) if (j == 2) ++zero; break; } } if (zero == 2) { ans...
fc253741-91a3-4dcb-a7f2-b668e96e1a8a
5
public static void main(String[] args) { Scanner in = new Scanner(System.in); String text = in.nextLine(); System.out.println(text); String[] textSplit = text.split(" "); ArrayList<String> sum = new ArrayList<>(); sum.add(textSplit[0]); if (textSplit.length == 1) { System.out.println(textSplit[0...
4b6ec2b1-9efd-419f-a23d-112349922b86
9
protected static final boolean solve (long[] smp, long[] evA, long[] evB, int mA, int mB, long[] pA, long[] pB) throws Exception { int mbar = smp.length; int delta = mA - mB; int tmA = (mbar + delta) / 2; int tmB = (mbar - delta) / 2; if(tmA < 0 || tmB < 0 || tmA + tmB <= 0) retu...
48026cba-7eb7-4432-8c7b-67a265d3cd8c
8
public Graph runPrime(Graph g) { Graph rt = new Graph(g.count); int []distance = new int[g.count]; int pre[] = new int[g.count]; for(int i=0;i<distance.length;i++) distance[i]= Integer.MAX_VALUE; int cur =0; do{ distance[cur] = 0; int min = Integer.MAX_VALUE; int minI=min; for(int i=0;i<g.coun...
cd2d411d-a786-4fe2-9052-c99313aeb4ac
9
public void removeLayoutComponent(Component comp) { synchronized (comp.getTreeLock()) { if (comp == center) { center = null; } else if (comp == north) { north = null; } else if (comp == south) { south = null; } else ...
7db9cb0b-d050-4ac3-80ae-806f950e71e9
1
private void acao106(Token token) throws SemanticError { try { listaParametros = new ArrayList<>(); idAtual = new IdentificadorMetodo(token.getLexeme(), 0, null); tabela.add(idAtual, nivelAtual); nivelAtual++; pilhaMetodosAtuais.push((IdentificadorMetodo) idAtual); } catch (IdentificadorJaDefinidoExc...
f938ffe3-a1f4-4837-b674-ef4e26d1c2b6
3
private void processCommand() throws IOException { try { //Thread.sleep(5000); String url = this.command; //String url = "http://www.vimalkumarpatel.blogspot.com/"; print("Checking for saved versions of the url:"); URL location ...