method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6d83cfc6-c3a1-45e9-9509-27960fcfa96b
3
public synchronized int joinToLobby(Integer ID, ClientThread ct) { Lobby l = lobbies.get(ID); if(l == null) { return NOT_EXIST_OPT; } if(l.addPlayer(ct)) { try { ct.gameID = ID; ct.sendToClient(Packet.getSucc...
4d062d7f-f014-426b-a8ba-49602734862b
7
public int blockOpponentChecker(Coordinate xy) { boolean test = false; if (test || m_test) System.out.println("ConnectFour::blockOpponentChecker() - BEGIN"); Game.PlayerTurn Player; if (getPlayerTurn() == Game.PlayerTurn.PLAYER1) { Player = Game.PlayerTurn.PLAYER2; } else { Player = Game.PlayerTurn....
91b44024-1560-41c6-aa97-74e2dce3d381
9
private Instances [] prepareData(Instances originalData, boolean firstTime) throws Exception { int numAttributes = originalData.numAttributes(); int classIndex = originalData.classIndex(); // determine attributes that won't be used in the imputation (all missing or all one value or nonnumeric clas...
ca4a222a-e203-408e-9144-3081db5b725f
3
private void dessineNoeudItineraire(NoeudItineraire ni, Graphics g, Color c, HashMap<String, Color[]> adresse_deja_livre) { // Un noeud itineraire est dessine differement selon qu'il est // ->un entrepot (un noeud cercl� avec un plus a l'interieur) // ->une livraison (un noeud cercl�) // ->une livraison hor...
33e24697-3ddc-4cc9-8d64-5600793a297b
8
@Override public void moveShape( int incX, int incY, Rectangle2D.Double poseArea) { // MOVE THE SHAPE geometry.x1 += incX; geometry.y1 += incY; geometry.x2 += incX; geometry.y2 += incY; // AND NOW CLAMP IT SO IT DOESN'T GO O...
73ad86c3-ae38-4d51-9d06-94bba727d89d
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed liceu.Secretar s = new liceu.Secretar(numeClasa.getText()); try { s.addClasa(); } catch (IOException ex) { Logger.getLogger(Administratorapp.class.getName()).lo...
f1f741c2-b114-45f5-b602-73d182fc2b01
2
public synchronized JSONObject read() throws IOException, ProtocolException { String line = connection.readLine(); JSONObject obj = null; if(line == null){ return null; } try { obj = new JSONObject(line); return obj; } catch (JSONException e){ throw new ProtocolException("Invalid packet recei...
e77132be-2a95-4b22-9ca6-d88b7f7d817a
1
* * @throws UnknownHostException if cyc server host not found on the network * @throws IOException if a data communication error occurs * @throws CycApiException if the api request results in a cyc server error */ public synchronized void rename(final CycConstant cycConstant, final String newName) ...
86de1267-1650-414c-9b5e-486982b3a409
6
public void setWheelScale(boolean flag) { wheelScale = flag; if(wheelScale) { if(this.getMouseWheelListeners().length == 0) { this.addMouseWheelListener(new MouseWheelListener() { @Override public...
656e38ce-0f67-4b82-81e9-737a8bd7e8f2
8
public Allotment(IClientContext ctx, AllotmentEnum patch) { super(ctx, patch); switch (patch) { case ARDOUGNE_N: case CATHERBY_N: polygon = POLYGON_ALLOTMENT_RECTANGLE_1; break; case ARDOUGNE_S: case CATHERBY_S: polygon = POLYGON_ALLOTMENT_RECTANGLE_2; break; case FALADOR_N: case ...
89bbac59-2a54-43ca-b714-8ddbd4c0daa9
4
private static Line above(LinkedList<Line> tLines, Line l) { int index = -1; for (Line l0 : tLines) { if (l0 == l) { index = tLines.indexOf(l); break; } } if (index > 0) { return tLines.get(index - 1); } else if ...
1e1dc4b0-6c66-48b6-802a-6878ea3ec6a9
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int test = Integer.parseInt(line.trim()), v[]; int...
7fecbe68-d486-4703-bd07-813f8a7173ec
5
public void CheckRows() { for( int n= ROWS - STAGING_ROWS; n>=0; n-- ) { boolean rowFull = true; for (int c=0; c < COLS; c++) if (!colorGrid[n][c].isSet) rowFull = false; //if we find a column not set //then the row is not full //if the row was full and it isn't already in //rowsToClea...
0b8c7e23-f620-4043-b719-7706cb356b23
5
public void changeTurn() { if (turn == Turn.PLAYER) { if (responding == true) { turn = Turn.OPPONENT; controlButtons(); message = "opponent is thinking..."; updateFrame(); timer.restart(); } else { updateFrame(); nextStep(); if (step != Step.SHOWDOWN) { turn = Turn.OPPONENT; con...
82eb7c8e-411b-4759-9071-1f5586be4f5d
5
public void fire (IEvent event) throws Exception { for (IHandler handler : this) { // skip cancelled events if (event instanceof ICancellableEvent && ((ICancellableEvent) event).isCancelled () && ((ICancellableEvent) event).isCancelled () && !handler.acceptsCancelledEvents ()) continue; // call handler h...
7c675fa7-d434-4a46-a6fe-b53a2d5b01dc
6
public static void insertValueSorted(LinkedListNode head, int value) { LinkedListNode n = new LinkedListNode(value); if (head == null) { head = n; } if (head.getNext() == null) { if ((int)head.getData() < value) { ...
070bb862-9dc1-4590-8263-408b36c062e9
1
public void attachDirty(Member instance) { log.debug("attaching dirty Member instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.saveOrUpdate(instance); tr.commit(); session.flush(); session.close(); log.debug("attach successful"); } catch ...
51d6ced8-dc74-40b9-8416-4c120c78d65e
5
public void updateWindow() { if(change){ if(mode==0) { if(moveStep>0) { upgradeFrame.setLocation(upgradeFrame.getX(), upgradeFrame.getY()+5); upgradeFrame.setSize(upgradeFrame.getWidth()-7, upgradeFrame.getHeight()-10); move...
f9a72f1f-41c7-4c5e-ab53-2a0bebea973f
4
public void calcTMmodeEffectiveRefractiveIndices(){ this.effectiveRefractiveIndicesTM = new double[this.numberOfTMmeasurementsGrating]; this.effectiveErrorsTM = new double[this.numberOfTMmeasurementsGrating]; if(!this.setSuperstrateRI){ this.superstrateRI = RefractiveIndex.air(super...
2bf37cf5-810e-4eac-b6bc-f11d1ecdf61b
8
protected boolean isExecutorInvocable(FunctionExecutorContext<R> executor) { // Lockable try { Method invokeMethod = executor.getExecutor().getClass().getMethod("invoke", FunctionInvocation.class, Object[].class); if (executor.isLocked() || source.isLocked() && invokeMethod.isAn...
2b52c043-c1c0-4a57-8848-b28f576db568
2
@Override public void put(Integer item) { lock.lock(); try { while (isFull()) { notFull.await(); } // put item int pos = (newest + 1) % buffer.length; buffer[pos] = item; newest = pos; System.out.pr...
72ab4ef8-7ff2-4ca4-8ffd-e38d9492c569
5
@SuppressWarnings("static-access") public void input() { if(Input.getMouseDown(0)) { openDoors(player.getCamera().getPos()); } if(Input.getKeyDown(Input.KEY_LSHIFT) || Input.getKeyDown(Input.KEY_RSHIFT)) { player.getCamera().setPos(new Vector3f(player.getCamera(...
d0cb23da-48c2-4f2f-8bf0-52b231592750
7
@Override protected Node<T> removeValue(T value) { // Find node to remove Node<T> nodeToRemoved = this.getNode(value); if (nodeToRemoved != null) { // Find the replacement node Node<T> replacementNode = this.getReplacementNode(nodeToRemoved); // Find the parent of the replacement node to re-factor the ...
77e7b53c-2a48-440b-91a8-316a85f026c6
8
private Method getObjMethod(String name) { if (!("size".equals(name) || name.startsWith("is") || name.startsWith("has"))) { name = String.format("get%c%s", Character.toUpperCase( name.charAt(0) ), name.substring(1) ); } try { return obj.getClass().getMethod(name); } catch (SecurityException e)...
000bfe6d-87ba-4ab1-b8f3-63622642d338
1
private void addBranch(final Label label) { if (branches.containsKey(label)) { return; } branches.put(label, new ArrayList(stackFrame)); }
b172bc80-d3d9-4c0c-9e3a-b435ee563d96
1
@Override public boolean accept(File dir, String name) { try { Integer.parseInt(name); return true; } catch (NumberFormatException E) { return false; } }
c5fed907-ecc7-4729-8812-ab6ccb739ffc
5
public boolean isBetween(int x,int y,int z) { if (x<z) { if (y>x && y<z) { return true; } } else { if (y>z && y<x) { return true; } } return false; }
57bcca52-61c6-452a-9dd4-07fdda39d28f
2
@Override public void Parse(String[] Parameters) { switch(Parameters[0]) { case "add": break; case "clear": break; } }
29080a4e-6714-4e79-927b-49f24a99e7da
1
public void deleteAnnotation() { for (Sentence sentence : sentences) { sentence.deleteAnnotation(); } }
923ec36b-c166-4891-8f58-5887ba91d1b0
5
public static void main(String[] args) { System.out.println("Please enter a number"); Scanner sc = new Scanner(System.in); int userNumber = sc.nextInt(); int i = 2; boolean run = true; boolean one = true; String answer = ""; String append = ""; while (run == true) { while (userNumber%i == 0) { ...
befe61fd-cffe-4461-99b5-b0949c38a619
1
public void sendCommand(String command) { try { getWsOutbound().writeTextMessage( CharBuffer.wrap("<message><command>" + command + "</command></message>")); } catch (IOException e) { e.printStackTrace(); } }
e1d97773-a954-42be-a727-9779a8293aeb
9
private void loadChannels() { channels.clear(); ConfigurationSection section = config .getConfigurationSection("channels"); if(section == null) { return; } for(String channelName : section.getKeys(false)) { final String tag = section.getStr...
8f4b09e7-7257-44ad-b750-f93fc84c7796
4
public void run() { if (!arena.isIngame()) { sender.sendMessage(OITG.prefix + ChatColor.RED + "No round is in progress in that arena."); return; } if (args.length == 1) { arena.setTimer(0); sender.sendMessage(OITG.prefix + ChatColor.GREEN + "Forced...
5f06c2e0-ddcb-4d5d-a2ff-d413b6a420b8
5
public static void menuEventos() { Scanner input = new Scanner(System.in); System.out.println("--------------------------------------------------------------------"); System.out.println("----------------------------- EVENTOS ------------------------------"); System.out.pr...
94e5e5d9-0114-4392-91c0-a160f2e534f1
2
public GoAiGame() { super("Go"); // name of the top of the board groups = new ArrayList<GroupAi>(); board = new ImageIcon("go.png");// puts the board as an image icon whitePass = false; blackPass = false; JPanel panel = new JPanel(); // new jpanel and setting the size and putting it to the jframe panel....
5c846382-ff34-40f5-99f1-0bfd969f7447
6
int greatestProductOfConsecutiveDigits(int[][] mat,int k){ int row=mat.length,col=mat[0].length; int product=0; for(int i=0;i<row;i++){ for(int j=0;j<=col-k;j++){ int temp=1; for(int num=0;num<k;num++){ temp*=mat[i][j+num]; product=Math.max(product,temp); } } } for(int j=0;j<col...
2cd3ad0c-25ce-4b5e-8ea6-fe2a79a67f8c
3
@Override public int compare(TreeRow r1, TreeRow r2) { for (SortData sortData : mSortData) { int result = sortData.mColumn.compare(r1, r2); if (result != 0) { return sortData.mAscending ? result : -result; } } return 0; }
17d1d661-529c-4649-8652-ee6d78e86db0
5
public boolean validateUsername(String username, String mapKey, int userNameMinLength, int userNameMaxLength) { boolean success = true; if(username.isEmpty()) { virheet.addValue(mapKey, "Käyttäjätunnus ei saa olla tyhjä!"); success = false; } else if(username.length() < userNameMinLength) { virheet....
bdca4f02-515c-4b14-9532-3853e135835f
8
private boolean checkFullMatch(State current, char[] targetStr, int cur) { // looking for the next cases for complete match if (current.getCh() == State.ANY || current.getCh() != State.SPLIT) { // if first char is not a split state means, first char matched. // moving ahead if first char matched. current =...
be3ca7e3-d508-41a1-9ded-3efbc6e54b69
4
public void setEstrCaso(List<?> list) { for(PEstrCaso e : this._estrCaso_) { e.parent(null); } this._estrCaso_.clear(); for(Object obj_e : list) { PEstrCaso e = (PEstrCaso) obj_e; if(e.parent() != null) { ...
9697367c-b22e-4d6e-9a16-8e394009074c
3
private int run(){ while(!m.win()){ if(player) removeNext1(m); else removeNext2(m); player = !player; } return player?1:0; }
eb206c10-1222-4585-b18b-85cf8f1b23ff
4
private float max(ArrayList<Float> data) { float max = Float.NEGATIVE_INFINITY; for (float f : data) { if (f != f) continue; if (f > max) max = f; } if (max == Float.NEGATIVE_INFINITY) max = -1e-7f; return max; }
be04bff4-2538-49d0-bb11-6130d03b3637
5
public CheckResultMessage checkJ01(int day) { int r1 = get(17, 2); int c1 = get(18, 2); int r2 = get(20, 2); int c2 = get(21, 2); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r2 ...
e82acd3b-f096-4c75-b8ba-71df6b163d1c
3
public boolean submitChallenge(Challenge c) { boolean flag = false; Element challengeE = (Element) document .selectSingleNode("//challenge[@id='" + c.getId() + "']"); if (challengeE != null) { challengeE.element("dialogState").setText(c.getDialogState()); // Write to xml try { XmlUtils.write2Xml(...
907fe2a7-cdc5-46a1-a72e-65668d1522eb
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Coords other = (Coords) obj; if (this.row != other.row && (this.row == null || !this.row.equals(other.row))) { retu...
36227548-8175-4019-8bc5-b5c966a0e0bf
7
public void gestionConnexionServeur() { // Création du client modeleRejoindrePartieReseau.creerClient(pseudoClient.getText()); // Connexion au serveur du Client try { modeleRejoindrePartieReseau.getClientCree().connexionServeur(nomServeur.getText()); } catch (UnknownHostException e1) { System.err.pr...
8c1f52d5-b4d7-455d-8b8e-aa4c32395722
2
public Rectangle getRowBounds(TreeRow row) { int y = 0; int dividerHeight = getRowDividerHeight(); for (TreeRow one : new TreeRowViewIterator(this, mRoot.getChildren())) { int height = getRowHeight(one) + dividerHeight; if (one == row) { return new Rectangle(0, y, getContentSize().width, height); } ...
d8ee26f2-10f3-4dfa-b61a-26b0163feb19
0
@Override public void setID(String iD) { super.setID(iD); }
0b7a8e0c-c69e-49da-8717-209a861d7647
8
public static void main(String[] args) { // provide a trivial extension. Board b = new Board() { public boolean isLegalMove(Piece p, Location loc) { return true; } }; String input; BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); System.out.println(b); help(); // simp...
183c1535-61e1-4f4a-826a-ea9f6ac7f136
7
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { log.debug("{} public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException:", getClass()); log.debug("params: uri={}, localName={}, qName={}, attrs=...
fbd21a8a-3195-4f8a-9f45-e192160d685c
5
@Override public void keyPressed(int k) { if(k == KeyEvent.VK_ENTER) { select(); } if(k == KeyEvent.VK_UP) { currentChoice--; if(currentChoice == -1) { currentChoice = options.length - 1; } } if(k == KeyEvent.VK_DOWN) { currentChoice++; if(currentChoice == options.length) { currentC...
6cb6216e-4e5f-40b7-99f0-f2170e6ad5ee
4
public Transporte recebeuACKdePSH(Transporte t, InetAddress adress){ Transporte t1=new Transporte(initTransportePSH); this.Recebidos.lock(); ArrayList<DatagramPacket> lista = (ArrayList<DatagramPacket>) this.Recebidos.lista.clone(); this.Recebidos.unlock(); for(Datagra...
3ce632cf-7712-4d2a-86c9-34dc2645d2e5
1
public static void main(String[] args) throws Exception { URL url = new URL("http://www.qq.com"); BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String line = null; while(null != (line = br.readLine())) { System.out.println(line); } }
c3c3f6c8-45ba-41b6-b049-49be6f485ab8
2
@Override public ResponseWrapper call() throws InterruptedException { ResponseWrapper rw = null; if (!this.isIgnore()) { String url = this.getRequestWrapper().getUrl(); getLogger().debug("crawl " + url); Document doc; try { doc = Jsoup.connect(url).get(); rw = new ResponseWrapper(doc, this.re...
cd16454d-9c11-4719-8ae6-f801a514a9de
3
public void newGame(EGameMode mode, int gameSize, int winLength) { if(mode == EGameMode.online) game = new OnlineGame(gameSize, winLength); else if(mode == EGameMode.offline) { if(secondUser.getClass() != AIUser.class) secondUser = new AIUser(); game = new OfflineGame...
92027cac-b7e8-4efa-aae2-c28a82ab4124
0
@Override public Query<TElement> toQuery() { return new Query<TElement>(this); }
3876ba8c-07c9-408f-96ba-7d837b44aa64
8
private boolean r_perfective_gerund() { int among_var; int v_1; // (, line 71 // [, line 72 ket = cursor; // substring, line 72 among_var = find_among_b(a_0, 9); if (among_var ...
104e40d8-2e80-46c0-bab6-c7a52fa28e5e
3
public ByteBuffer getBuffer(){ if(this.currentBufferQueue == null){ this.currentBufferQueue = new ConcurrentLinkedQueue<ByteBuffer>();// 当前正在处理的缓冲区队列 } if(this.currentByteBuffer == null || this.currentByteBuffer.remaining() <= 0){ this.currentByteBuffer = BufferPool.getInstance().getBuffer(); this....
abb0cac3-61e9-49fd-8fe4-267581d116c5
9
public static void main(String[] args) { //0 through 4 are in one tree //5 to 6 are in another, disconnected tree Graph g = new Graph(7); g.addEdge(0, 1, eWeight); g.addEdge(0, 2, eWeight); g.addEdge(1, 0, eWeight); g.addEdge(1, 3, eWeight); g.addEdge(1, 4, eWeight); g.addEdge(3, 2, eWeight...
344af380-7a60-4a53-bdc7-6182985a021e
1
@Override public void componentMoved(ComponentEvent event) { if (isFocusOwner()) { repaint(); } }
97461b9d-a7b1-4dca-83c2-7134f48f3fdf
5
private void stringToTimeFilter(String convert){ switch(convert){ default: this.filtering = null; break; case "ALL": this.filtering = TimeFilter.ALL; break; case "TODAY": this.filtering = TimeFilt...
100af3ee-84d4-497d-9015-37ad0ba615e7
0
public Perfil getPerfilidPerfil() { return perfilidPerfil; }
e1dfb6fc-c812-48b0-9803-c791695c6f8f
5
public void setAnimatedMotion(Entity motionEntity,Location destiny) { if (motionEnt != null) { motionEnt.moveTo(motionDestiny); motionEnt = null; loadMotionImage = null; } String w6 = motionEntity.imgLocation; if (motionEntity.getCurrentOrientation() == GridedEntityTileOrientation.ORIENTATION_TOPTOB...
decf507c-95f4-461a-b521-bf1f5c1eb0a7
0
@Override public String getPostalCode() { return super.getPostalCode(); }
02152bbb-8c53-4c94-a3e8-c0da5668c863
2
public boolean isSetMethodPresentFor(Field field) { FieldStoreItem item = store.get(FieldStoreItem.createKey(field)); if(item != null) { return item.getSetMethod() != null ? true : false; } return false; }
8598e6f4-91b3-46fa-aa98-60fc54e347ae
2
public static void resetGameBoard() { for (SlidingPuzzlePiece puzzleTeil : SlidingPuzzlePiece .getPuzzlePiece()) { if (puzzleTeil.getVisible() == null) { puzzleTeil.setVisible(true); } } }
5ced3062-4d80-4f2b-9dce-0e26f9298446
2
public StockData() { data = new Vector(); //读入数据库中的表格数据,包括股票名称、股票代码及股票价格 sql="select * from stock"; s = LoginListenerClass.statement; try { rs = s.executeQuery(sql); while(rs.next()) { data.add(rs.getString(1)); data.add(rs.getString(2)); data.add(rs.getString(3)); data....
6bab9199-094e-4544-b3ba-d91b3cdb9d7a
9
public void dodgeAsteroid(){ //tries to avoid an asteroid before hitting it for(int b=0;b<objects.size();b++){ if(objects.get(b).kind!=0) continue; if(!objects.get(b).isInMap()) continue; boolean obstacle = collisionCircle((int)(x+vx),...
933929b7-6e4d-471c-95a9-84c268694525
6
public static void main(String[] args) { if (args.length < 1) { System.err.println("Must at least provide filename to load"); return; } File loadFile = new File(args[args.length-1]); AbstractTuringMachine machine = null; try { machine = IOController.loadTuringMachine(loadFile); } catch (ClassNotF...
474852b0-fe38-48ea-afc4-e7eefe4ea114
5
public String encode() { if (encodedValue != null) return encodedValue; // Length is variable StringBuffer buf = new StringBuffer(10); if (negative) buf.append('-'); buf.append('P'); if ((years != 0) || (months == 0)) { buf.append(Lon...
6190f844-067c-40c0-9b38-987be6db8b22
1
public boolean isIntelligenceCellAtTarget() { return (intelligentX == targetX && intelligentY == targetY); }
d1a72913-9192-4560-b17b-b5a5fff57184
0
public int getHeldRsrceType() { return heldRsrceType; }
88706f7f-0bf5-41a2-9934-9636c9610226
2
public String toString () { if (dev != null) { String retval = info.getProduct (0); if (retval == null) retval = info.getDeviceClassName (); return retval; } else return super.toString (); }
be364edb-437e-436e-9192-e052b3c9f25f
3
private void createCommands() { commandMap = new HashMap<>(); commandMap.put("StartGame", new Command() { @Override public void executeCommand() { optionDialog.hidDialog(); imageViewerControl.reset(); runApplication(); }...
6ac27d2b-4522-4541-bc79-a42dbd792632
1
public void visitNegExpr(final NegExpr expr) { if (previous == expr.expr()) { previous = expr; expr.parent.visit(this); } }
baf75b18-461a-4d38-8551-0327c3b025bd
8
private synchronized void toBuffer(int s,Object a){ a1.add(s);a2.add(a); if(s==clear){clearBuffer();} if(s==opaque) theOpaque=(Boolean) a; if(s==setBackground)theBackground=(Color) a; if(inBuffer)return; if(isSetter(s))return; Graphics g=getGraphics(); if(g==null)return; Graphics2D g2= (Graph...
78583660-a6ed-4803-823c-08b90d408121
6
private void verifyDB(){ auctions=auctionDB.topAuction(); if (auctions==null||auctions.size()==0) return; for(int i=0;i<auctions.size();i++){ if(!auctions.get(i).getAuctionTime().after(new Timestamp(System.currentTimeMillis()))){ try{ if(auctions.get(i).getCurrentPrice()>auctions.get(i).getReser...
fb184dc8-deaa-413c-8b1b-a8914dac6748
9
private void move() { xa = 0; ya = 0; int px = (int) level.getPlayerAt(0).getX(); int py = (int) level.getPlayerAt(0).getY(); Vector2i start = new Vector2i((int) getX() >> 4, (int) getY() >> 4); Vector2i destination = new Vector2i(px >> 4, py >> 4); if(time % 5 == 0 ) { path = level.findPath(sta...
acbeff21-4b55-493c-a80c-a877f757238b
0
public static void main(String[] args) { OJ343 oj343=new OJ343(); System.out.println(oj343.reverseVowels("hello")); }
8db7ae0f-b75e-4025-9af2-6ffd3651c1cd
1
@Override public void setMaxBackupCount(int count) { if (count > 0) maxBackupCount = count; }
e9630a3f-28dc-4a6d-83dd-b8bbb8be78d4
2
public boolean removeLinkedPoint( Point pointToDelink ) { for( Point checkPoint: connectedPoints ) { if( checkPoint.comparePoint(pointToDelink) ) { connectedPoints.remove(checkPoint); return true; } } return false; }
723ce80c-feff-46a3-906b-d1f398c3dcff
4
public static int addMarks(int index, String value) { if ((index < 0 && index > 9) || (Float.valueOf(value) < 0 && Float.valueOf(value) > 20)) return 0; marks[index] = value; return 1; }
725ae5cf-f661-439a-b5db-82e5a388f058
5
public ArrayList<Object> map2(final Function2<? super Object,? super Object,? extends Object> fn, final List<? extends Object> bs, final List<? extends Object> cs) { ArrayList<Object> _xblockexpression = null; { final ArrayList<Object> finalResult = CollectionLiterals.<Object>newArrayList(); int _le...
76a5be32-4f25-4f4f-90fb-b270175fcfc8
8
private void createActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createActionPerformed //User pressed the create button if (!isEdited()) { //If nothing was changed then close window this.setVisible(false); dispose(); } else { /...
093a7aea-f8af-4780-a300-cad89f5dba41
8
@Override public void delete(Node s) throws NodeException { if(s == null) { throw new NodeException("cannot delete null node"); } int numNode = s.getNodeNum(); for( int i=0;i<node.size();++i) { if(i == numNode) { continue; }...
42d86e51-a6ec-4bc4-854e-6cde5866ef20
3
@Override public Map<Class<?>, String> getDatatypeMappings() { Map<Class<?>, String> mappings = new HashMap<Class<?>, String>(); mappings.put(String.class, "VARCHAR"); mappings.put(Long.class, "BIGINT"); mappings.put(Integer.class, "INT"); mappings.put(Boolean.class, "TINYINT"); mappings.put(Date.class,...
d079c16a-5853-41c1-98bf-7fa40b8a86ad
3
private final void relocateRemove(Hashtable<K,HashCounter> ht) { for (K key : ht.keySet()) { final HashCounter pre = ht.get(key); final HashCounter post = new HashCounter(key); if (pre.mli!=post.mli) { final Entry<K,V> e = new Entry<K,V>(key); Entry<K,V> reloc; try { final Integer index = on...
95da8396-4a60-4826-a7b4-009d047782a0
5
public static IRCMessage parse(String message){ String[] tokens = message.split("\\s+"); String prefix = new String(); List<String> params = new ArrayList<>(); IRCCommand response = IRCCommand.NONE; int i = 0; if (tokens[0].subSequence(0, 1).equals(":")){ prefix = tokens[0]; i++; } else { pref...
127385dd-5513-4145-8ac6-d3a376d3d802
7
private void runAI(String str, boolean draw) throws IOException { if (5 == Setup.getPositioner().getPositioned()) { switch (str) { case "-r": Setup.getAI().randomVolley(); break; case "-h": Setup.getAI().hunt(); break; ...
d946fcc8-482e-4d31-a424-e8c0d5e9382d
5
@Override public void setGiveResource(ResourceType resource) { giveResource = resource; //Grab resource ratio switch(resource){ case WOOD: currentRatio = woodRatio; break; case BRICK: currentRatio = brickRatio; break; case SHEEP: currentRatio = sheepRatio; break; case WHEAT: current...
fad9de04-957c-4c46-a193-36a2c2912168
5
@Override public boolean equals(Object c) { if (c == null) { return false; } if (c == this) { return true; } if (! getClass().equals(c.getClass())) { return false; } TexasCombination param = (TexasCombination)...
9b2f4ad6-242d-4512-9624-77e67149800e
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...
f51b29fb-db59-417a-9b65-7930e8fde040
5
public void validar(String valor) throws ValorInvalidoException { validador.validar(valor); int cont = 0; char aux = valor.charAt(0); for (char a : valor.toCharArray()) { if (aux == a) { aux = a; cont++; } } if (cont == valor.length()) throw new ValorInvalidoException("Digite numeros dife...
7da3a7e6-8816-4f0a-80a3-36f9d8ce5ee3
9
public Table parseFile() throws IOException, ArrayIndexOutOfBoundsException { // initialize buffered reader for parsing the file BufferedReader br = new BufferedReader(new FileReader(this.file)); // skip lines before parsing for (int i = 0; i < linesToSkip; i++) br.readLine(); // parse first l...
624a8f0a-95be-46a8-953c-a8416d9544de
7
private static <T> void assignArrayField(T instance, Field array, int dimensions, Class<?> elementType, String valueString, IAutoConfigParser<?> parser, IAutoConfigValidator<?> validator) throws Exception { if (dimensions == 1) { if (!PATTERN_ARR_ONE_DIM.matcher(valueString).matches()) { throw new Except...
273eef8c-e004-46f0-a289-af8fff04d339
4
@Override protected Object registeringGUI() { String nome; String cpf; while(true){ nome = guiImpl.requestData("Nome:"); if(ValidationStrategy.isValid(nome, ValidationStrategy.NAME)){ break; }else{ GUIAbsTemplate.operationFa...
4df0cfc0-f9ce-4654-96a8-358ad6309c38
2
@Before public void setUp() { TestHelper.signon(this); MongoHelper.setDB("fote"); MongoHelper.getCollection("users").drop(); for(User user : users) { if(!MongoHelper.save(user, "users")) TestHelper.failed("save user failed"); ...
69383667-3118-4ea8-8c1c-47a2e1c77555
7
public void write(String name) { try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("graphml"); rootElement.setAttribute("xmlns","h...
7215e76c-a34d-45c5-8ff4-ea3f89625b6b
7
void updateHealth(int numUpdates) { // // Define primary attributes- ageMultiple = calcAgeMultiple() ; maxHealth = baseBulk * ageMultiple * (DEFAULT_HEALTH + (actor.traits.traitLevel(VIGOUR) / 3f) + (actor.traits.traitLevel(BRAWN ) / 3f) ) ; if (numUpdates < 0) return ; // /...
e7a755f1-5363-47ad-b5ee-6848c8ab4b61
9
@Override public void contextInitialized(ServletContextEvent arg0) { log.i("Initializing Context"); // Load properties try { // Load the file in the usual path of the file in the project (case of the manager) File serverProperties = new File(PROPERTIES_FILE_PATH); InputStream is = new FileInputStr...