method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cf42b650-385f-4e90-8759-f12847ff60b7
3
private void viscosityForce() { if (myToggles.get(VISC)) { for (HashMap<String, Mass> massList : springies.getMassMaps()) { for (Mass m : massList.values()) { m.xspeed = m.xspeed * myViscosity; m.yspeed = m.yspeed * myViscosity; } } } }
a433f931-2b65-4ac9-ac20-1b00cd2d3714
4
public Boolean containsKey(String key) { if (!enabled) return false; if (mainCache.containsKey(key)) return true; if (useBuffer && mainCache.containsKey(key)) return true; return false; }
d3f076ef-875c-4ce0-b34d-c7addfc18d3e
5
private boolean keysEmpty(ArrayList<Integer> keyIndexes, String[] values) throws MobbedException { boolean empty = true; int keyCount = 0; for (int i = 0; i < keyIndexes.size(); i++) { if (!isEmpty(values[keyIndexes.get(i)])) keyCount++; } if (keyCount > 0 && keyIndexes.size() > keyCount) throw n...
9dd54bb3-fd9f-422b-8f89-74b57a14dffc
3
private void loadLatestVersion() { BufferedReader reader = null; try { URL url = new URL(VERSION_FILE); reader = new BufferedReader(new InputStreamReader(url.openStream())); String str = reader.readLine(); String[] split = str.split("\\|"); latestVer = split[0]; priority = UpdatePriority.getP...
91e921a1-a8eb-4509-bd3c-269ce42e08fe
3
@SuppressWarnings("deprecation") private static Map<String, String> getImplCurlParams(Node db) { try { ConfigParser cp = ConfigParser.getParser(db); HashMap<String, String> ret = new HashMap<String, String>(); try { ret.put("auth-type", cp.getElementAt("auth-type", 0) .getAttribute("type")); } ...
bb174382-16a1-4c2a-8038-ff9ca79ebf26
2
@Override public BencodeList parse(BufferedInputStream inputStream) throws IOException, BencodeParseException { readAndCheckFirstByte(inputStream); List<BencodeType> bencodeTypeList = new ArrayList<BencodeType>(); int currentByte; while ((currentByte = readByteAndMarkPosition(inputS...
cd772ea9-54ca-4db5-a9dd-6a05841a2120
5
public void render(){ initContents(); //4*4 board for(int y = 0; y < IGameState.FIELD_SIZE; ++y){ int r = (COLS*(y+1)) + 1; for(int x = 0; x < IGameState.FIELD_SIZE; ++x){ if(gameState.getTile(x, y) > 0){ contents[x + r] = getTileItems(gameState.getTile(x, y)); }else{ contents[x + r] = emp...
5e90ecbd-747d-47ae-8015-6ac88c9599bf
3
public void printPuzzle() { for(int i=0; i<9; i++) { for(int j=0; j<9; j++) { if(grid[i][j].getValue()==N._0) { System.out.print(" ."); } else { System.out....
c70ecd2c-4c4c-4d54-92a0-355d43f6853f
5
public void workWithStatementStrategy(StatementStrategy stmt) throws SQLException { Connection c = null; PreparedStatement ps = null; try { c = this.dataSource.getConnection(); ps = stmt.makePreparedStatement(c); ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { if (ps != n...
c252e7ab-64f3-46cc-857f-3192ab4b81c7
5
public void run() { HttpClient client = new HttpClient(); client.getHostConfiguration().setHost(endpoint.getHost()); for (int index = 0; index < sparql_queries.size(); index++) { LOGGER.info("Posting " + sparql_queries.get(index).getName()); FileInputStream fis; try { fis = new FileInputStream(s...
bec515fc-a8c2-48b0-9439-363d7ed857e3
4
public void mousePressed(MouseEvent e) { if (state == NO_EMPEZADO) { //empieza a jugar state = VIVO; salta = true; } else if (state == VIVO) { if (bird.getPosY() > 0) { //salta salta = true; } } else if (state == MUERTO) { //se rest...
fc81e547-0b2a-4ac0-a5e9-beff0ff5891a
6
static public String numberToString(Number n) throws JSONException { if (n == null) { throw new JSONException("Null pointer"); } testValidity(n); // Shave off trailing zeros and decimal point, if possible. String s = n.toString(); if (s.indexOf('.') > 0 ...
4a125676-d4e0-4bcb-9650-8cb6b42a4ea8
2
@Override public Boolean typeUser(String strTabla, String strTablaCompare, String strCampo, String idTabla, int idUsuario) throws Exception { int result = 0; Statement oStatement; try { oStatement = (Statement) oConexionMySQL.createStatement(); String strSQL = "SELECT...
1e318900-8a77-4e5b-a0e5-1444dd52418b
1
@Override public Rectangle getVisibleRect() { Rectangle bounds = super.getVisibleRect(); if (mInAutoscroll) { bounds = Geometry.intersection(bounds, new Rectangle(mContentBounds.x + AUTO_SCROLL_MARGIN, mHeaderBounds.y, mContentBounds.width - AUTO_SCROLL_MARGIN * 2, mHeaderBounds.height + mContentBounds.height -...
4c4c60e4-a22e-48aa-988e-59d805bd6216
7
public void run() { try { serverSocket = new ServerSocket(listenPort, backlog); this.done = false; while (!this.done) { if (maxConnections > 0 && arrayListOfObjectatConnection.size() >= maxConnections) { // TODO // Add code to wait for connection to leave } else { connection = serverSo...
873145b8-1849-47dc-a5ea-b4ba3b914d43
9
public static void main(String[] args) { String[] op = {"x","y","z"}; ArrayList<Lx18> arrayList = new ArrayList<Lx18>(); for(int i=0;i<3;i++){ for(int j=0;j<3;j++){ for(int k=0;k<3;k++){ Lx18 a = new Lx18(op[i], op[j], op[k]); if(!a.a.equals(a.b) && !a.b.equals(a.c) && !a.a.equals("x") && ...
b8b1e61e-3d32-45f2-8bbb-b6fadf631769
8
@EventHandler public void onPlayerFirstJoin(PlayerJoinEvent e){ final Player p = e.getPlayer(); final String pname = p.getName(); try { pregicfg.load(pregi); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IOException e1) { // TO...
70d253d1-1fd2-41b9-b129-395252fc3356
4
public List<Position> getPath(int x, int y){ try{ Pattern pattern= Pattern.compile("(\\d+)"); List<Position> posList= new ArrayList<>(); int X,Y = 0; if(posicao(pacmanX(),pacmanY())){ String str=intelFant(x, y, pacmanX(), pacmanY(),"solvente"); ...
a19e4a2d-68c1-412f-89d5-ea85d5cc6dea
3
@Command(command = "hotdog", aliases = {"hd"}, arguments = {"target player[s]"}, description = "hotdogs the target player[s]", permissions = {"hotdog"}, consoleOnly = true) public static boolean hotdogFromConsole(CommandSender sender, String targetPlayer) throws EssentialsCommandException { // make su...
819de74e-4014-4741-af79-dfd45a46927c
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...
72f422eb-c241-41e8-8d59-8ea3d26e8e9e
9
public void testStringIntern() throws InterruptedException { makeStrings(1024*10); // something greater than the capacity of the default cache size // makeStrings(100); // realistic for perf testing int nThreads = 20; // final int iter=100000; final int iter=1000000; final boolean newStrings=t...
74675654-64e8-4547-9dc0-67d5df6869cc
7
private final void reset(final Git gitSession) throws GitAPIException, IOException, InterruptedException { if (this.RESET.getValue()) { // set options to default this.GIT_URL_HTTPS.value(Config.getInstance().getValue( URL_HTTPS_KEY)); this.main.flushConfig(); this.USE_SSH.setValue(false); this....
c378e2e7-4f6e-4cb4-b3e8-5dd213b627bc
7
public void doHandshake() throws Exception { // Begin handshake engine.beginHandshake(); SSLEngineResult.HandshakeStatus hs = engine.getHandshakeStatus(); // Process handshaking message while (hs != SSLEngineResult.HandshakeStatus.FINISHED && hs != SSLEngineResult.HandshakeStatus.NOT_HANDS...
0f689885-d077-4864-8e1e-5925e084f96e
5
public static void voteNo(Player player, String playerName) { if (player == null) { StefsAPI.MessageHandler.buildMessage().addSender("$") .setMessage("error.onlyIngame", AdminEye.messages).build(); return; } if (VoteHandler.type == VoteType.NO_VOTE) { StefsAPI.MessageHandler.buildMessage().addSende...
239853e3-ff89-4113-b5cb-dc588eb7e66c
4
public boolean isNewRegion(Region region) { boolean blnRet = true; Object[] vValues = m_dRegions.values().toArray(); Converter<Region> converter = new Converter<>(); for (int i = 0; i < vValues.length && blnRet; i++) { List<Region> lstPlayerRegions = converter....
5d7014be-a606-4261-9906-f5af1023a49b
2
private void calculateMean() { double sum = 0; Integer count = 0; for(int i=0; i<data.length; i++) { if (calibrationFlag[i]) { sum += data[i]; count++; } } mean = sum / count.doubleValue(); }
fe338bde-b3df-4123-9c94-288353f0a9f8
6
private List<String[]> getCustomOutputNodesValue(final Document doc) { List<String[]> customOutputs = new ArrayList<>(); Node outputsNode = this.getFirstLevelNodeByTag(doc, OUTPUTS_TAG); if (outputsNode == null) { return null; } NodeList customNodes = this.getNodeListByTagInNode(outputsNode, CUSTOM_TAG); ...
b13aa7a4-2868-4d2b-9693-adc0695fb467
9
public void run() { ar.loadLevel(currentLevel); while (true) { GameState state = solve(); if (state == GameState.WON) { try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } int score = -2; while (score != StateUtil.checkCurrentScore(ar.proxy)) { ...
e8e45666-c4c6-4d0e-b758-b94497271968
5
void init(int n){ bitrev=new int[n/4]; trig=new float[n+n/4]; log2n=(int)Math.rint(Math.log(n)/Math.log(2)); this.n=n; int AE=0; int AO=1; int BE=AE+n/2; int BO=BE+1; int CE=BE+n/2; int CO=CE+1; // trig lookups... for(int i=0; i<n/4; i++){ trig[AE+i*2]=(float)Math...
4c73bffa-714c-4a52-a4ec-7b93f1946579
3
public void accessFutureMeeting() { System.out .println("You have selected access future meeting, now please either the ID of the meeting you would like to view, or alternatively enter a contact name or a date(DD/MM/YYYY) to view all associated meetings: "); String str = getInput(); if (Character.isDigit(str...
baf2a7ad-7362-48fb-bec8-c538f8582669
9
private void addLog(Player player) { double xpBoost = 1.00; if (player.getEquipment().getChestId() == 10939) xpBoost += 0.008; if (player.getEquipment().getLegsId() == 10940) xpBoost += 0.006; if (player.getEquipment().getHatId() == 10941) xpBoost += 0.004; if (player.getEquipment().getBootsId() == 1...
8c56b1fd-2b13-4380-be6a-959725acecd2
4
public static Path writeMatrix(double[][] matrix, Path path, HamaConfiguration conf) { SequenceFile.Writer writer = null; try { FileSystem fs = FileSystem.get(conf); writer = new SequenceFile.Writer(fs, conf, path, IntWritable.class, VectorWritable.class); for (int i = 0; i < matrix.length; i++) { ...
514a5014-5754-4aa3-b245-51e481370465
7
protected void resizeDesktop() { int x = 0; int y = 0; JScrollPane scrollPane = getScrollPane(); Insets scrollInsets = getScrollPaneInsets(); if (scrollPane != null) { JInternalFrame allFrames[] = desktop.getAllFrames(); for (int i = 0; i < allFrames.leng...
111ae472-6573-4bd8-8496-a8a318b911af
8
public void kaanny(boolean oikea) { if (this.tiedot.getSuunta() == Suunta.POHJOINEN) { this.tiedot.setSuunta(oikea ? Suunta.ITA : Suunta.LANSI); } else if (this.tiedot.getSuunta() == Suunta.ITA) { this.tiedot.setSuunta(oikea ? Suunta.ETELA : Suunta.POHJOINEN); } else if...
378b8e7b-68c0-4c86-8624-f3b9a62f0b29
2
protected Color getColor (double diff) { if (Vector.fuzzyEquals(diff, 0)) { return Color.BLACK; } else if (diff < 0.0) { return Color.BLUE; } else { return Color.RED; } }
0aac1a79-80a4-4bcb-8be3-a4e672a95bde
2
@Override public void onMessage(Message message) { int messageNumber = messageCounter.incrementAndGet(); if (message instanceof TextMessage) { TextMessage textMessage = (TextMessage) message; try { logger.info("Receive message #" + messageNumber + ": " + textM...
0ea1bbc7-fa42-44a3-89ae-50ceef129e06
1
public static boolean PixelsInTile(Vector2 pixels, Vector2 destTile) { Vector2 translated = GridToPixels(destTile); return (int)pixels.getX() == (int)translated.getX() && (int)pixels.getY() == (int)translated.getY(); }
c42d3de7-79ec-4808-8e8d-af02a9743ad1
5
public void bindTexture(TextureManager var1) { this.textures = var1; if(this.newTexture != null) { BufferedImage var2 = this.newTexture; int[] var3 = new int[512]; var2.getRGB(32, 0, 32, 16, var3, 0, 32); int var5 = 0; boolean var10001; while(true) { ...
9bda1868-48ff-490c-aa75-499f27cf5205
7
private boolean sendFilesAndCloseSocket(List<String> selectedFiles, Socket socket) { boolean isSuccessful = false; int countFiles = selectedFiles.size(); DataOutputStream tempDout = null; // DataOutputStream dataOutput = null; DataInputStream dataInput = null; try (DataOutputStream dataOutput = new Data...
34356acc-e5a4-4b74-9c7b-715178f07c56
9
public static void main(String[] args) throws IOException{ ArgsReader reader = new ArgsReader(); reader.addFlag("-h", ArgsReaderValues.HELP, "Prints argument descriptions"); reader.addFlag("--help", ArgsReaderValues.HELP); reader.addProperty("-i", ArgsReaderValues.INPUT,...
5dc051fa-b622-4520-a62e-97b51771f04a
2
public static boolean deleteType(String name) { if(listTypes.containsKey(name)) { Type type = listTypes.get(name); if(type.getUnits().isEmpty()) { listTypes.remove(name); return true; } } ...
490f227f-14e5-4256-8403-65adca10e78f
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
c308ec8a-385e-4f2d-8788-54f5acd1e33d
4
public void mouseClicked(MouseEvent e) { // clear the selection. // requestFocus(); if (!(documentViewModel.getViewToolMode() == DocumentViewModel.DISPLAY_TOOL_SELECTION || documentViewModel.getViewToolMode() == DocumentViewModel.DISPLAY_TOOL_LINK_...
5b1dddff-3bd7-425a-9b28-5bba6b935995
9
private String[] describeShop(Shop shop) { List<String> shopDetails = new ArrayList<>(); String seperator = new StringBuilder() .append(ChatColor.GREEN).append("=") .append(ChatColor.GOLD).append("=") .append(ChatColor.GREEN).append("=") ...
7e1578c7-6a84-4146-9c9a-7ee32e7772ca
5
public RGB getRGB(){ double H = hue/60; double C = value * saturation; double X = C * (1 - Math.abs(H%2 - 1)); double m = value - C; double r1 = 0, g1 = 0, b1 = 0; if(H < 1){ r1 = C; g1 = X; } else if(H < 2){ r1 = X; g1 = C; } else if(H < 3){ g1 = C; b1 = X; } else if(H < 4){ ...
9b4a3afc-c368-4ac4-8a7a-a5210cddb852
8
public Difficulty changeSettings(Difficulty difficulty) { Difficulty updateDifficulty = difficulty; //Print out menu options System.out.println("Please select a difficulty:"); System.out.println("1. Easy"); System.out.println("2. Normal"); System.out.println("3. Hard"...
eef72cac-0ea7-4c0c-ba9b-8665b96604a0
4
public void randomDisplayTick(World var1, int var2, int var3, int var4, Random var5) { int var6 = var1.getBlockMetadata(var2, var3, var4); double var7 = (double)((float)var2 + 0.5F); double var9 = (double)((float)var3 + 0.7F); double var11 = (double)((float)var4 + 0.5F); double var13 = 0.2...
94fbbf25-64b3-4977-b060-2792b21417e1
6
public static void startupCppTranslateFile() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); ...
b1cc6677-e1de-4f07-b958-f46c2004ff99
7
public MyPanel(int w, int h, int colors) { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice gd = ge.getDefaultScreenDevice(); GraphicsConfiguration gc = gd.getDefaultConfiguration(); BufferCapabilities bufCaps = gc.getBufferCapabilities(); ...
2b54c2b8-50ae-4f2d-ae14-0a3da9ff4d93
6
private static final int method3955(int i, Class229 class229) { if (Class328_Sub3.aClass229_6519 == class229) return 2; if (Class167.aClass229_2207 == class229) return 4; if (OndemandWorker.aClass229_3196 != class229) { if (class229 != Class348_Sub23_Sub2.aClass229_9011) { if (class229 == Class348_Su...
b0f5ca80-31b3-4f9e-bdfa-d6766fd2657d
7
@EventHandler public void onSignBreak(BlockBreakEvent e){ if(e.getBlock().getState() instanceof Sign){ Sign sign = (Sign) e.getBlock().getState(); if(e.getPlayer().hasPermission("oitc.admin")){ if(sign.getLine(0).equalsIgnoreCase(ChatColor.DARK_GRAY + "[" + ChatColor.AQUA.toString() + ChatColor.BOLD.toStri...
5c91780e-a1e4-41d8-87a4-8912a4c521ab
4
void animate() { animate = !animate; if (animate && image != null && imageDataArray.length > 1) { animateThread = new Thread(bundle.getString("Animation")) { public void run() { // Pre-animation widget setup. preAnimation(); // Animate. try { animateLoop(); } catch (final...
7b6e7776-d283-4115-8e59-bb27cf052b1a
2
public void removeSpace(int id) { if (id < 0 || id >= vortexSpaces.length) { return; } //TODO remove also neighbors and paths ArrayList<Integer> paths = vortexSpaces[id].getPaths(); ArrayList<Integer> neighbors = vortexSpaces[id].getNeighbors(); vortexSpaces[id/2] = null; }
0ed640dc-a832-4a33-af88-450750b8f88f
6
private int decodeBlackCodeWord() { int current; int entry; int bits; int isT; int code = -1; int runLength = 0; boolean isWhite = false; while (!isWhite) { current = nextLesserThan8Bits(4); entry = initBlack[current]; // Get the 3 fields from the entry isT = entry & 0x0001; bits = (ent...
4732b308-9d16-4bae-879c-bb2632d3e036
1
public void printRead(ArrayList<String> csvFile) { for (int i=0;i<csvFile.size();++i) { System.out.print(csvFile.get(i)+","); } }
a7b9153e-9aab-43bb-88a1-b0d08fce6062
1
public void removeCity() { if(this.abstractMatterList.has(City.class)) { this.abstractMatterList.get(City.class).owner.cityList.remove(this.abstractMatterList.get(City.class)); this.abstractMatterList.remove(City.class); this.abstractMatterList.sort(); } }
4170dc41-9e18-44d3-8aa0-566c4317a6c3
6
protected void generateLSHtml() { //RootPanel rootDiv =; DockPanel mainDiv = new DockPanel(); this.htmlTable.clear(); this.htmlTable.setWidth("766px"); this.htmlTable.setCellPadding(2); this.htmlTable.setCellSpacing(0); this.htmlTable.setBorderWidth(0); ...
2e1296b7-ea0a-4be3-bfcb-64f04133b4bf
4
public static WikiPage getInheritedPage (String suiteSetupName, WikiPage wikiPage) { if (suiteSetupName.equals(SuiteResponder.SUITE_SETUP_NAME)) { return new WikiPage (SuiteResponder.SUITE_SETUP_NAME); } if (suiteSetupName.equals(SuiteResponder.SUITE_TEARDOWN_NAME)) { return new WikiPage (SuiteResponder.SUI...
af0531c8-ee1b-4192-8b6b-e7fae9aef6ae
0
public void set(float a, float b, float r) { this.a = a; this.b = b; this.r = r; }
cbd1b8bf-f02a-4c74-8c1e-cfc4b86f90fe
4
protected ArrayList<GamePiece> getAllMillCenters(Team team){ ArrayList<GamePiece> millCenters = new ArrayList<GamePiece>(); for(int r = 0; r < 3; r++){ //For every ring... for(int p = 1; p < 8; p+=2){ //System.out.println("Center check: "+r+","+p); //for all odd positions - so add two, only get the ce...
03118ae2-c961-44e2-b352-6fe3beb19931
7
public static DateTimeLogicWrapper timepointOf$Computation(IntegerWrapper yy, IntegerWrapper mm, IntegerWrapper dd, IntegerWrapper hr, IntegerWrapper min, NumberWrapper sec, Stella_Object tz) { { Stella_Object yyValue = Logic.valueOf(yy); Stella_Object mmValue = Logic.valueOf(mm); Stella_Object ddValue ...
d49b83cd-bc6d-4b9c-89b0-1c35ae66465b
5
int getCol(int x, int y){ if(rotated){ tmp=x; x=y; y=d.height-tmp; //System.out.println(x+";"+y); } if(x<d.width && y<d.height && x>=0 && y>=0) return buf.getRGB(x, y); return -1; }
aa7d6c7a-8a6e-4978-91bc-2384338db56a
4
public JPanel getBarPlayer2() { boolean test = false; if (test || m_test) { System.out.println("Drawing :: getBarPlayer2() BEGIN"); } if (test || m_test) System.out.println("Drawing:: getBarPlayer2() - END"); return m_barPlayer2; }
0c3db059-6dc6-4c33-913b-4251fbd4344e
1
public VueCommandes() { this.setLayout(new GridLayout(1, 4)); boutons[0] = new JButton(new ImageIcon("img//plus.png")); boutons[1] = new JButton(new ImageIcon("img//moins.png")); boutons[2] = new JButton("MAJ Donnees"); boutons[3] = new JButton("Affichage externe"); for (int i = 0; i < NBBOUTONS; i++) { ...
944de9e5-f94d-4328-be7e-3951f5573ac7
3
void createTextTransfer(Composite copyParent, Composite pasteParent) { // TextTransfer Label l = new Label(copyParent, SWT.NONE); l.setText("TextTransfer:"); //$NON-NLS-1$ final Text copyText = new Text(copyParent, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); copyText.setText("some\nplain\ntext"); Gri...
b1d3c6f7-5bca-4339-99cf-64a35b0bd19a
7
protected PlayerTurn nextPlayer() { boolean test = false; if (test || m_test) System.out.println("ConnectFour::PlayerTurn() - BEGIN"); if (getPlayerTurn() == Game.PlayerTurn.PLAYER1) { if (test || m_test) System.out.println("ConnectFour::PlayerTurn() - PLAYER1 turn " ...
f25fa6fd-0068-4b04-851a-b227b49b1207
5
@Override public int compareTo(Meld other) { if(this.isRun && !other.isRun) return -1; else if(!this.isRun && other.isRun) return 1; if(isRun) return compareRuns(other); else return compareGroups(other); }
60f5ea58-aa60-4b3e-a108-063d6ed52a20
8
public Result fromJSON(JSONObject json, int version) { try { if(version > Privileges.JSON_VERSION) return IJson.Result.OUTDATED_APP; Result tResult = super.fromJSON(json, version); if(tResult.hasFailed()) return tResult; if(version >= 1) { setDisplayName(json.optString("display_name"))...
7e390256-3242-42da-af49-70ed4e18b7e6
8
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; while ((s = br.readLine()) != null) { StringTokenizer st = new StringTokenizer(s); Integer m = new Integer(st.nextToken()); ...
de1756d6-8bcb-409e-84a2-f27b59f36e83
2
public void restoreFromMemento(MementoBoard memento) { CellState[][] board = new CellState[this.numOfColumns()][this.numOfRows()]; for (int row = 0; row < this.numOfRows(); ++row) { for (int col = 0; col < this.numOfColumns(); ++col) { board[col][row] = memento.nextCell(); ; } } this.board = boar...
adf07e17-4f20-4e76-9cb3-2e40cb3a7532
4
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } Position other = (Position) obj; return this.x == other.x && this.y == other.y; }
9399eaed-1410-4b5c-8d33-dd4473f74101
2
@Override protected boolean requestKeyboardFocus(Widget child) { if (child != null && state != null) { state.keyboardFocusLost(); } return super.requestKeyboardFocus(child); }
9ee80276-ca16-419d-88ee-de7cf665bed5
6
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { // personnage sur le sol? boolean vrai = surLeSol(body); if (!vrai) { tempsEnLair += delta; if (tempsEnLair > 100) { auSol = false; } } else { tempsEnLair = 0; auSol = true; } // si une...
baae6476-e74c-4b17-a226-d5015bb6e48e
9
public static String encode(byte[] input) { if (input.length == 0) { return ""; } input = copyOfRange(input, 0, input.length); // Count leading zeroes. int zeroCount = 0; while (zeroCount < input.length && input[zeroCount] == 0) { ++zeroCount; ...
ae762fdb-60c4-4b86-826c-38d5aa42f43a
3
protected void read(File file) throws IOException { try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); String newline = ignoreComments(line); if (newline != null) read.add(newline); } scanner.close(); } catch (FileNotFoundExcep...
6ec2633a-fd00-4d6b-b78e-ae565d0c2557
4
Object extendArray(Object array, int currentSize, int requiredSize) { if (requiredSize < currentSize) { return array; } else { Object newArray = null; int newSize = currentSize * 2; if (newSize <= requiredSize) { newSize = requiredSize...
5b197425-b520-4927-9a19-e3fa94db04ab
9
public static boolean isValueCode(char ch) { return ch == '@' || ch == ':' || ch == '%' || ch == '+' || ch == '#' || ch == '<' || ch == '>' || ch == '*' || ch == '/' ...
aecb7b6c-0de5-4fca-a01a-53f7abd54fc3
1
public void setOperandAt(final Block block, final Def def) { final int blockIndex = cfg.preOrderIndex(block); operands[blockIndex] = def; if (SSAPRE.DEBUG) { System.out.println(this); } }
bfde1637-e88e-46af-9783-b9f3954ef761
9
public ImportLocalOvfVApp(String ovfLocal,HostSystem host,Folder vmFolder,String newVmName) throws Exception{ ServiceInstance si = GetServiceInstance.getServiceInstance(); String hostip=host.getName(); OvfCreateImportSpecParams importSpecParams = new OvfCreateImportSpecParams(); importSpecParams.setH...
4392e2a4-bc12-4fd8-937b-dcbc9ee15076
6
public List<XmlRaum> getXMLRaumListe() { List<XmlRaum> result = new ArrayList<XmlRaum>(); for(Raum raum : _connected.keySet()) { int nord = 0, ost = 0, sued = 0, west = 0; if(_connected.get(raum)[0] != null) { nord = _connected.get(raum)[0].getId(); } if(_connected.get(raum)[1] != null) { ...
053e8517-be6c-4acf-85fb-faabac021e64
8
protected void func_27260_a(int par1, int par2, Tessellator par3Tessellator) { if (!Mouse.isButtonDown(0)) { this.field_27268_b = -1; } if (this.field_27268_b == 0) { GuiStats.drawSprite(this.field_27269_g, par1 + 115 - 18, par2 + 1, 0, 0); } ...
2e14a7b2-88c0-47be-982e-d9c05f2d4e55
5
public void act() { if (winnerName.equals("White")) { setImage(new GreenfootImage("BattleItem//FuShuWon.png")); } else if (winnerName.equals("Bond")) { setImage(new GreenfootImage("BattleItem//BondWon.png")); } else if (winnerName.equa...
a01b0200-cb9e-4206-bf71-817df428a2ce
7
public void postorderTraversalIterative(ArrayList<Integer> list, TreeNode node){ Stack<TreeNode> stack = new Stack<TreeNode>(); while(true){ if(node != null){ if(node.right != null) stack.push(node.right); stack.push(node); node = node.left; continue; } ...
043dc4bd-9ef0-416e-af91-834bac62a2ea
7
public boolean checkAdjacent(int x, int y) { boolean lost = false; int tempX = -1, tempY = -1, flags = 0; for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { try { if (matrix[x + j][y + i].isFlagged()) flags++; else { if (mines[x + j][y + i] == -1) { lost = true; tem...
eb144f89-226d-4664-be6c-3fcef855a358
7
@Override public void entityRelevancyChanged(String clientId, Iterable<EntityRef> entities) { EntityRef clientEntity = clientEntityMap.get(clientId); Set<Integer> entitiesClientKnows = entitiesClientIsAwareOf.get(clientId); ClientCommunication clientCommunication = connectedClients.get(clien...
7300450e-6359-484f-9dd1-34223b5eb5ec
6
public void DrawScene() { glColor3f(1, 1, 1); mLevel.Draw(); switch (mEditType) { case Polygon: { glColor3f(1, 1, 1); { ListIterator<Polygon> i = mSelectedPolys.listIterator(); while (i.hasNext()) { i.next().DrawEdges(); } } { ListIterator<Polygon> i =...
49a92c95-34d6-42e0-8f13-66d9d62f5935
6
@Override public void run() { try{ ServerSocket serverSocket = new ServerSocket(DefaultNetworkVariables.DEFAULT_FTP_PORT); serverSocket.setSoTimeout(THREAD_HEARTBEAT); while (alive){ try { //System.out.println("DEBUG: Accepting new FTP requests"); final Socket s = serverSocket.accept()...
c840dcfe-8556-4034-a93c-821bdbcf491e
3
public void removeCells(Object[] cells) { if (cells != null) { List<Object> tmp = new ArrayList<Object>(cells.length); for (int i = 0; i < cells.length; i++) { if (isSelected(cells[i])) { tmp.add(cells[i]); } } changeSelection(null, tmp); } }
7aa6707b-5064-4ac0-95a9-c0f316d1c1e9
9
private JPanel getSelectBahanMakananPanel(){ JPanel panel = new JPanel(new BorderLayout()); JPanel panelKategori = new JPanel(new FlowLayout()); panelKategori.add(new JLabel("Pilih Golongan :")); comboBoxKategoriMakanan = new JComboBox<>(makanDikonsumsiController.getListStringGolongan())...
b02eab30-1b84-43da-8cbd-d01929ff8748
2
public static List<Entreprise> selectEntrepriseByName(String name) throws SQLException { String query = null; List<Entreprise> entreprise = new ArrayList<Entreprise>(); ResultSet resultat; try { query = "SELECT * from ENTREPRISE where ENTNOM like ? order b...
94f7a765-6603-4aaf-828f-694fb080fea4
0
public Pizza getPizza() { return pizza; }
7a6d0e93-e1fd-4bc3-8437-9c5143722ac0
3
public void removeListener(Class<? extends PluginListener> key) { Validate.notNull(key, "Key to remove cannot be null!"); if (!listeners.containsKey(key)) return; if (registered) HandlerList.unregisterAll(listeners.get(key)); listeners.remove(key); }
834b75db-e37c-408e-8aae-11dc717f24ad
7
@Override final protected CounterParty addBusinessObject(BusinessObject value, Map<String,String> keyMap) throws EmptyNameException, DuplicateNameException { CounterParty counterParty = (CounterParty)value; if(counterParty.getName()==null || "".equals(counterParty.getName().trim())){ thr...
52df0204-a08e-4a7a-902c-c26b3cb4a064
2
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Address)) { return false; } final Address address1 = (Address) o; return this.hashCode() == address1.hashCode(); }
bd977298-6743-4b76-a10d-3a9fb8435077
9
@Override public List<LogEntry> parseFileContents(InputStream input) throws IOException { if (!(input instanceof BufferedInputStream)) { input = new BufferedInputStream(input); } final List<LogEntry> logEntries = new ArrayList<LogEntry>(); final byte[] data = IOUtils.toB...
e943d27c-9cd9-4e4a-b207-daa9d64bbcab
3
public void testDajZauzeteSobeProvjeraExceptionFalse() { //Test za provjeru bacanja izuzetka metode dajZauzeteSobe, u slucaju kad ne treba da baci izuzetak, da smo sigurni //da ga neće ni baciti java.util.Date datumOD= new java.util.Date(); java.util.Date datumDO= new java.util.Date(); java.text.Simple...
f0dd3052-5c88-4c1c-a870-d21451fca7ea
6
public void setOpacite(double opacite) { // Swap les couleurs Random rnd = new Random(); if (partyMode) { do { r = rnd.nextBoolean() ? 255 : 0; v = rnd.nextBoolean() ? 255 : 0; b = rnd.nextBoolean() ? 255 : 0; } while (r == ...
9bc1237d-120a-4bb1-a23f-8758867ab987
1
public Fraction(int num, int denom) { if (denom == 0) { System.out.println("Invalid fraction with denominator 0"); // this should use exceptions return; } int gcd = myGcd(num, denom); setNumerator(num / gcd); setDenominator(denom / gcd); }
e0cbd7e7-faaf-4ef0-bc1b-e9130706bcd7
0
protected void threadStarted() { // do nothing }
e33cce83-f107-4572-a2cb-ab2948b42fb9
1
public static void awardBonusExternal() { class AwardBonus extends RecursiveAction { public AwardBonus(ArrayList<BankAccount> accounts, int start, int end) { this.accounts = accounts; this.start = start; this.end = end; } priv...