method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
49908d0b-abed-4b2e-8c51-8084c988189c
6
public void run() { int p1Win = 0; int p2Win = 0; for (int i = 0; i < turn; i++) { Game game = null; if (i % 2 == 0) game = new Game(player1, player2, visualizeFlg); else game = new Game(player2, player1, visualizeFlg); game.clearBoard(); int result = game.play(); if (result ...
acedebc7-7868-4e8e-829c-b8875866ae09
0
public void setStatus(Status status) { this.status = status; }
972e63da-b6e8-4adb-978f-88c16cf4875b
9
public MsgPk insert(Msg dto) throws MsgDaoException { long t1 = System.currentTimeMillis(); // declare variables final boolean isConnSupplied = (userConn != null); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { // get the user-specified connection or get a connection from...
ce964062-7111-450b-81f9-568c6f7b48a0
0
public void setSendWelcome(boolean sendWelcome) { this.sendWelcome = sendWelcome; }
4a9cc6a3-43d8-4ca2-916e-c4fad8ecac2b
0
public State[] getStates() { return (State[]) getUserObject(); }
6b45926a-7b5c-4191-b0ff-8057c889d895
1
public int compareTo(Contact other) { return this.element.equals(other.element) ? this.cnumber.compareTo(other.cnumber) : this.element.compareTo(other.element); }
91398af2-38a6-4d61-ba08-7506368479cb
8
@SuppressWarnings("unused") private static void HiLoGuessNumber(){ Scanner keyboard = new Scanner(System.in); Random r = new Random(); int randomNumber = 1 + r.nextInt(100); int tries = 0; System.out.println("Type 0 to exit the game."); System.out.println("I'm thinking of a number between 1-100. You have ...
b6dc51e6-955e-4b01-a62e-e867bd5033e6
0
public void freshMessage(String newMessage) { System.out.println(newMessage); gameMessage.setText(newMessage); }
9b8b5027-8e7b-4ce4-98ab-feb05a5dc0c0
2
private boolean playingCommandsPreconditions(int playerIndex) { return (playerIndex == serverModel.getTurnTracker().getCurrentTurn() && serverModel.getTurnTracker().getStatus().equals("Playing")) ? true : false; }
8080b17e-7031-4c6d-abdc-d75a33c67345
1
public List<Area> ObtenerArea(String consulta){ List<Area> lista=new ArrayList<Area>(); if (!consulta.equals("")) { lista=cx.getObjects(consulta); }else { lista=null; } return lista; }
c7a1fc55-6b25-4bf6-80a5-807a515c5252
0
public static int toBase(final double x, final double b) { return (int)Math.pow(b,(int)log(x,b)); }
eb26f10e-7f15-407b-9158-d42b7533a116
3
public void redo(){ if(getCell(0, 0).getredoListSize() < 0){ for(int i = 0; i < model.getWidth(); i++){ for(int j = 0; j < model.getHeight(); j++){ getCell(i, j).redo(); } } } else{ System.out.println("Não há...
ca340372-09f8-4770-9f74-130ea3bb2ead
4
public void visitExprStmt(final ExprStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } stmt.visitChildren(this); genPostponed(stmt); if (!(stmt.expr() instanceof StoreExpr)) { if (!stmt.expr().type().isVoid()) { if (stmt.expr().type().isWide()) { method.addInst...
c002a795-f5dc-4123-86b0-8f0624a3b1bd
5
public int getBgPaletteValue(int address, TimeStamp time) { if (address >= 0 && address < 0x40) { if (bgPalette[address] == null) return (address & 0x1) == 0 ? 0xff : 0x7f; return bgPalette[address].getValueAt(time, (address & 0x1) == 0 ? 0xff : 0x7f); } else throw new RuntimeException...
ec5ce091-bfdd-4c30-afa2-9fcfa95d9ec1
4
private Object handleText(Object tos) { if (tos instanceof SourceCitation) { setDataTagContents(tos, false); // standard says you should just have 1 TEXT tag, but geni uses multiple text tags in place of CONT tags here String text = ((SourceCitation)tos).getText(); if (text != ...
106e3231-3a26-4d48-9f13-850c76f81f96
6
public void merge(int[] arr, int p, int q, int r){ int length=arr.length; int[] tempArray =new int[length]; for (int i=0;i<length; i++) { tempArray[i]=arr[i]; } int temp=p; int i=p,j=q+1; for(; i<=q && j<=r ; ){ if(tempArray[i] < tempArray[j]){ arr[temp++]=tempArray[i]; i++; }else{...
87973351-621b-4f40-91e8-1db464e6dc0f
4
public void resetSpeed(){ isModified = false; switch(type){ case GO_LEFT: speedX = DEFAULT_SPEED_LEFT; speedY = 0; break; case GO_RIGHT: speedX = DEFAULT_SPEED_RIGHT; speedY = 0; break; case GO_UP: speedX = 0; speedY = DEFAULT_SPEED_UP; break; case GO_DOWN: speedX = 0; speed...
dd6edcc0-f3b8-4b25-ab75-a598596e7e1c
3
private void loadImages() { final File imagesDirectory = new File(System.getProperty("user.dir") + "/res/images"); List<ImageIcon> icons = new ArrayList<ImageIcon>(); for (final File file : imagesDirectory.listFiles()) { try { icons.add(new Ima...
fc9db65c-39f6-401c-96ed-69e721ca01c4
2
private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed // Creacion de un archivo nuevo if (principal == null) { String p = JOptionPane.showInputDialog("Introduce el año"); try { anio = Integer.parseInt(p); ...
8c501294-8efd-434d-a7ee-32cff8300157
5
public boolean placable (Boat boat) { boolean placable = true; int t = 0; while (t < boat.getLength() && placable) { if (((boat.getXStart() + t * boat.getXDir()) < size) && ((boat.getYStart() + t * boat.getYDir()) < size)) { if ((board[boat.getXStart() + t * boat.getXDir()][boat.getYStart() + t * boat.getY...
bff30ed6-1398-4ce2-9b26-7aaae9070899
1
public ArrayList<String> listFilesFromTargetsNotInSource() throws IOException{ ArrayList<String> strings = new ArrayList<String>(); for(int i=0;i<targetDirs.size();i++){ strings.add(listFilesFromTargetNotInSource(i)); } return strings; }
c881bdf4-580a-4bb1-afa6-4596a7406063
7
@Override public Explanation explain(IndexReader reader, int doc) throws IOException { Explanation result = new Explanation(); result.setDescription("weight("+getQuery()+" in "+doc+"), product of:"); StringBuilder docFreqs = new StringBuilder(); StringBuilder query = new StringBuilde...
dc81e299-8b87-4da7-bb6d-1dcd56a6d680
1
public Graphics2D getGraphics() { Window window = device.getFullScreenWindow(); if (window != null) { BufferStrategy strategy = window.getBufferStrategy(); return (Graphics2D)strategy.getDrawGraphics(); } else { return null; } }
742ac6ee-68ba-47fc-95ae-29187b6b1e75
5
public int get_THEN(int INDEX, String code) { log.log(4, log_key, "call get_THEN, INDEX = ", new Integer(INDEX).toString(), "\n"); for(;;INDEX++) { if ( (code.charAt(INDEX) == 'T') && (code.charAt(INDEX + 1) == 'H') && (code.charAt(INDEX + 2) == 'E...
c2bb457a-6c9e-4a34-beff-72085d8e3754
8
private void loadCollisionLists(){ try { final String PREFIX = "bin\\"; final String SUFFIX = ".class"; String pkgName = getClass().getPackage().getName(); ArrayList<File> classFiles = FileFinder.getFiles(PREFIX + pkgName, SUFFIX); for (File file : classFiles){ try { String packageLocation = f...
488a1cfa-fd2c-4b00-9f60-34c6ef4d0137
9
@Override public Object execute(TransitionSystem ts, Unifier un, Term[] terms) throws Exception { WorldModel model = ((MartianArch) ts.getUserAgArch()).getModel(); Graph graph = model.getGraph(); Vertex myPosition = model.getMyVertex(); List<Vertex> notProbedNeighbors = graph.returnNotProbedNeighbors(myPosit...
a6cd634f-d5c1-4907-859a-51321b9e2fa8
9
private static void begin() throws Exception { bzrc.updateAll(); String id = "8"; String id2 = "7"; Calendar nextMove = GregorianCalendar.getInstance(); Calendar nextShot = GregorianCalendar.getInstance(); boolean isMoving = false; Calendar nextMove2 = GregorianCalendar.getInstance(); Calendar ...
15f3fde4-32dd-47fc-bf3c-bf8053cbb091
0
public boolean addData(DataStructures obj){ return arraysBase.add(obj); }
ae858ac8-0689-4ed1-a098-2f1990fdfbed
7
public void StaticSemanticsSelf(BlooPInterpreter interpreter, java.util.Stack context) throws SemanticException { this.scope = (ProcedureDefinition)(context.elementAt(0)); if(this.cellNum != null) { this.cellNum.StaticSemantics(interpreter, context); } this.value.StaticSemantics(interpreter, context)...
c18dda24-46f6-446d-afae-b92306eff76f
2
private void exportFiledept() { JFileChooser fileChooser = new JFileChooser("."); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setDialogTitle("打开文件夹"); int ret = fileChooser.showOpenDialog(null); if (ret == JFileChooser.APPROVE_OPTION) { final String filePath = fileChooser.g...
623e884c-e946-4dcc-acb6-6492f652fe2c
3
String browseMethod(String thisClass) { String s = pool.browseDescriptor(descriptorIndex); String returnType = s.substring(0, s.indexOf('(')); String functionParams = s.substring(s.indexOf('(')); String functionName = pool.browseString(nameIndex); String retVal = attributes.browseDeprecat...
81ed4f2e-1972-4b67-8d0f-4a7dcc92e0ad
7
@Override public List<File> exportDiagrams(File suggestedFile, FileFormatOption fileFormat) throws IOException, InterruptedException { if (suggestedFile.exists() && suggestedFile.isDirectory()) { throw new IllegalArgumentException("File is a directory " + suggestedFile); } if (fileFormat.getFileFormat() =...
6fd97322-a56a-4eda-b202-cfd0ceba0ad2
8
public void moveChild(Constituent newChild, int index) { System.out.println(newChild.parent == null); int oldIndex = children.indexOf(newChild); System.out.println("Old index = " + oldIndex); System.out.println("New index = " + index); if (oldIndex != -1 ...
5b4fa201-7e35-44ba-97c9-7521b9a07f44
3
private void createActionListeners() { // action listeners for the "Start" button on the start screen startGame.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ...
42c4dab4-a899-4cb5-81f3-c199259d4b52
8
public void setEditValue(int n, EditInfo ei) { if (ei.value > 0 && n == 0) onresistance = ei.value; if (ei.value > 0 && n == 1) offresistance = ei.value; if (ei.value > 0 && n == 2) breakdown = ei.value; if (ei.value > 0 && n == 3) holdcurrent = ei.value; }
4f316326-e0d8-4ba4-87e3-fe5147d29b94
2
public void closeStream() throws IOException { if (this.audioInputStream != null) { this.audioInputStream.close(); } if (this.mpegInputStream != null) { this.mpegInputStream.close(); } this.open = false; }
7e224dd2-9890-4746-b6f7-9757564695a8
3
private void cancelConnecting(){ if( connection != null ){ site.removeItem( connection ); if( sourceArray != null ){ sourceArray.remove( connection.getSourceEndPoint() ); } if( targetArray != null ){ targetArray.remove( connection.getTargetEndPoint() ); } connection = null; } sour...
7eced3ab-511f-465f-8007-4054b4f664d0
7
public static void login(LoginWindowInterface window) { Employee employee = null; String userID; int accessLevel; char[] password, password1 = null; userID = window.getUserTxtFld().getText(); password = window.getPswrdField().getPassword(); try { empl...
6728571b-844b-4d4c-b372-97d3730a36bd
8
private void jGemBegivenhedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jGemBegivenhedActionPerformed if (jBegivenhedRediger.getSelectedItem() == "Mål") { if (jBegivenhedHoldRediger.getSelectedItem() == "Hjemmehold") { jMålHjemmeSe.addItem(jBegivenhedSpillerRedi...
29071549-26f2-4d7b-b53d-e3e3c8ed2069
6
void keyPress(char k) { switch(k) { case(KeyEvent.VK_BACK_SPACE) : case(KeyEvent.VK_DELETE) : if (allEntries.size() > 0) { allEntries.removeLast() ; //delete last letter. needsFormat = true ; } break ; case(KeyEvent.VK_ESCAPE) : case(KeyEvent....
aa7bb064-b646-4b1c-a1a4-48c0a735b749
4
private static byte encodeConnectionId(int connectionId) throws ConnectionIdOutOfRangeException { if(connectionId != Packet.ANONYMOUS_CONNECTION_ID && (connectionId < Packet.MINIMUM_CONNECTION_ID || connectionId > Packet.MAXIMUM_CONNECTION_ID)) throw new ConnectionIdOutOfRangeException(connectionId); return (byt...
1d33ce61-da0f-497a-b6a1-5872365a8183
8
public boolean tickUpdates(boolean par1) { int var2 = this.scheduledTickTreeSet.size(); if (var2 != this.scheduledTickSet.size()) { throw new IllegalStateException("TickNextTick list out of synch"); } else { if (var2 > 1000) { ...
eb09b03e-3092-4884-ac2c-320e5ff44aa5
3
public Entry search(String myid) { // for scoping, search list backwards. // check for identifer in this block first, outward to global block. ListIterator<ArrayList<Entry>> blocks = st.listIterator(st.size()); // now can go backwards. while( blocks.hasPrevious() ) { ArrayList<Entry> b...
68581f69-b821-49e2-a5fe-52bb00a89e58
9
@SuppressWarnings("unchecked") @Override public AcknowledgementService handle(LocalDevice localDevice, Address from, OctetString linkService) throws BACnetException { BACnetObject obj = localDevice.getObject(objectIdentifier); if (obj == null) throw createException(ErrorC...
047bb036-276e-4ded-beb7-7c52e8b10b45
1
public JTable createUserTable() { // Datenbankverbindung UserDB myUserDB = new UserDB(); // Bei der erstmaligen Initialisierung des Fensters gibt es noch keine // Darstellungsprobleme mit der Tabelle. Es werden alle Datensätze // angezeigt if (getSearchText().getText().matches("Bitte Suchbegriff eingeben"...
92630cf9-889b-4eb2-b45b-1aa5da606de2
4
private void sink(double[] pq, int k, int N) { while (2*k <= N) { int j = 2*k; if (j < N && Helper.less(pq, j-1, j)) j++; if (!Helper.less(pq, k-1, j-1)) break; Helper.exch(pq, k-1, j-1); k = j; } }
dee4509e-1012-454d-9420-bf623d71825b
0
public static void main(String[] args) { // Teste }
2fc160fe-30aa-439d-8072-b817d02011b3
7
public boolean overlapsWith(Session session) { if (this.equals(session)) return false; // If they're on the same day in the same room if (day.equals(session.getDay()) && room.equals(session.getRoom())) { // Check if they overlap if (time <= session.getTime() && time + length > session.getTime(...
bbae5e9d-00bc-4541-a074-a9843f66e529
3
@SuppressWarnings("deprecation") public Share[] startRateUpdate(String[] sharenames) throws IOException{ String namebuffer = ""; Share[] returnshare = new Share[sharenames.length]; int counter = 0; for (int i = 0; i < sharenames.length; i++) { namebuffer += sharenames[i]+","; } namebuffer = URLEncoder.e...
056c5a85-d97b-42f0-b861-9140c0bfec54
2
public static double orbitalWallDistance(final Vector sourceLocation, final Vector targetLocation, final double bulletPower, final int direction, final Rectangle2D.Double battlefield) { final double absBearing = sourceLocation.angleTo(targetLocation); final double distance = sourceLocation.distance(targetLocatio...
3bec9a81-2f57-48c8-a9b2-64543aa9ff78
5
public boolean evaluateLightCheck(Chessboard board) { //Create copies of the board at its current state so that I'm not modifying the game Chessboard chessboardCopy = new Chessboard(board); Tile[][] tileBoardCopy = chessboardCopy.getBoard(); //Get king and king location Piece lightKing = getLightKing(tile...
3730dfd3-efb1-49bb-b8e3-df1f1609b413
6
public void animationCombo_actionPerformed(ActionEvent e) { int selectedIndex = animationCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.DISPLAY_CHANGES: if (!partAnimMenuItem.isSelected()) partAnimMenuItem.setSelected(true); ...
dc5e89ea-2530-4c46-b2a6-1a74a204d170
9
private Token parseSlashCombination() { char c = current; consume(); if (isSpecialCharacter(c)) { return new Token(Type.CHARACTER, String.valueOf(c)); } else { switch (c) { case 'd': return new Token(Type.CLASS_DIGIT, "d"); case 'D'...
b009efbb-8f9e-4889-9781-c5edf07f6f60
5
public void multiTargetGfx(int id, int targetY, int targetX) { for (Player p : server.playerHandler.players) { if(p != null) { client person = (client)p; if((person.playerName != null || person.playerName != "null")) { if(person.distanceToPoint(targetX, targetY) <= 60) { person.stillgfx2(id, ...
a61fd52e-8618-440e-be88-ed042c0eac37
9
private void buyMenu() { if(hotelOwned != true && victim.account.getBalance() >= this.housePrice) // If you dont'have a hotel, you can buy some houses. { if(cout.buyHouse(this.housePrice) == true) { houseAmount = Integer.parseInt(cout.buyHouseAmount(this.totalHouseAmount)); // it now parses it. if(vic...
ec832958-920f-4a3e-b122-9ea385c0229b
0
public float getR() { return r; }
3441dae1-3a2a-4a33-aba3-1c1306931ddc
4
public FindResults findPrevious(String[] findme, int lineFrom, int posFrom) { /* * FIXME: I'm not sure what to do with this, yet. This method only works right * for one instance per line, and regexps can't be traversed backward. */ for (int y = lineFrom; y >= 0; y--) { if (findme.length ==...
082f9b32-7aff-458a-9285-3b2ac3c95800
8
private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchButtonActionPerformed switch (this.search_option) { case "camera_brand": if (!this.cameraBrandTextField.getText().equals("")) { this.rdn = q.cameraBrand(this.cameraB...
8c664e5f-580c-4d17-9d09-0ef4172e8be5
9
public void draw(Graphics2D g) { bg.draw(g); g.drawImage(title, 105, 25, null); g.drawImage(left, 290, 188, null); g.drawImage(right, 310, 188, null); g.drawImage(enter, 80, 188, null); g.drawImage(greendrag, 75, 130, null); g.drawImage(kat, 154, 133, null); g.drawImage(bluedrag, 230, 130, null); g.dr...
8fc4395d-98a8-401e-aa48-236989d79d45
6
@Override public boolean equals(Object obj) { if(obj instanceof List) { List that=(List)obj; if(this.next==null && that.next==null) { return this.a.equals(that.a);} else if(this.next!=null && that.next!=null) { return this.a.equals(that.a)&&this.next.equals(that.next);} else ...
21bfb4ea-11b9-4c89-b52e-ea7221791ff4
1
public static void handleWhois(String nick) { if ( nick.isEmpty() ) { appendError("Nesprávná syntaxe příkazu: /whois uživatel"); } else { getCurrentServerTab().getConnection().whois(nick); clearInput(); } }
9093283f-a259-4e2d-b40a-c404be0d205d
1
public void restart() { try { Thread.sleep(3000); } catch (InterruptedException e) { System.err.println("Failed sleep"); e.printStackTrace(); } pressKey(82); System.err.println("Restarting: largest was " + Calculate.scenarios[0].largest); }
1e7a7f1a-db82-4716-ab31-ec28054b5313
6
public String minPenalty(int[] stations,int maxPerday){ int length=stations.length; int penalties[]=new int[length]; //Penalty if stop in ai int[] result=new int[length]; penalties[0]=0; for(int i=1;i<length;i++){ penalties[i]=Integer.MAX_VALUE; } for(int i=0;i<length-1;i++){ //Update possible place...
9335f9dd-0bd5-47a3-a107-1f178e019679
0
public void setLoginDelegate(LoginDelegate loginDelegate) { this.loginDelegate = loginDelegate; }
be376132-0f9e-4c23-ba94-f7f708623e7a
0
@Override protected void onQuit(){}
db7554d7-bea7-45c5-bd90-01c4d26ec9b3
4
@Override public void raumwahlUpdate(boolean neuerRaum) { _ui.getFrame().remove(_ui.getRaumhinzu()); RaumBearbeitenPanel bearbeitenPanel = _ui.getBearbeitenPanel(); if(bearbeitenPanel != null) _ui.getFrame().remove(bearbeitenPanel); _ui.getFrame().remove(_ui.getFueller()); _ui.getFrame().setVisible(true...
799fff4d-4ea1-4d50-865c-5d734fa5dd60
5
public void faltaEnvido(boolean envido, boolean envidoEnvido, boolean realEnvido, Maquina jugadorM, Contador contador, boolean mentir){ System.out.println("\n"+this.getNombre()+": Falta Envido"); //condicion que verifica si la maquina quiere o no if(jugadorM.cantoFaltaEnvido(envido, envidoEnvido, realEnvido, ment...
3414ff2c-d64f-4684-9211-930d0bcd3eb9
1
public Matrix(int length) { column = new Stack[length]; for (int i = 0; i < length; i++) { column[i] = new Stack(); } }
13d5b540-524a-43cc-b124-3c8c2e4535de
0
public void setBackground(Image background) { this.background = background; }
ff859edd-2c5a-4dce-b94e-b902111dd6af
0
public Iterator<E> iterator() { return new QueueIterator(); }
f97a3e9a-c162-4a24-a69b-c84da6923bdf
2
private void setBackgroundImage() { switch (lvl) { case 1: img = ImageLoader.lvl_1; break; case 2: img = ImageLoader.grass_1; break; default: break; } }
0094978a-3bd1-4ab4-9dc8-31ede3f1472f
0
public BearAction(Being b) { being = b; }
8b20c071-a130-45eb-9854-6a8d21bfd913
6
public V get(K key) { if (root == null) return null; Node node = root; while (true) { if (key.compareTo(node.mKey) < 0) { if (node.left == null) return null; else node = node.left; } else if (key.compareTo(node.mKey) > 0) { if (node.right == null) return null; else ...
d4cc86b8-bebf-476f-b8ba-c5ec2fb74a91
2
public int getProjectileDamage(Shape shape) { int damage = 0; for (Projectile projectile : projectiles) { if (projectile.collidesWith(shape)) { damage += projectile.getPower(); projectile.expire(); } } return damage; }
0ee84556-b5a2-46f7-af72-42cedb6193c3
0
private ScoreManager() { }
f7b44f93-055c-4607-8142-62e1cf6e6345
4
public void restoreBackGround() { for (int i = 0; i < 64; i++) { JPanel panel = (JPanel) chessBoard.getComponent(i); int row = (i / 8) % 2; if (row == 0) { panel.setBackground(i % 2 == 0 ? Color.black : Color.white); } else { panel...
9d237739-ea38-4ef5-b0de-6129ed910b8c
0
protected static final Logger getLogger() { return LoggerFactory.getLogger(IautosResource.class); }
f84299e8-7602-4300-a00e-16a364643b11
7
@Override public void actionPerformed(ActionEvent e) { String name = e.getActionCommand(); if(name=="Sort") { //title if(r1_sort.isSelected()) { customer.sortBookByTitle(); GUIInterface.aText_p4.setText(Main.TITLE+Main.array.toString()); } //authorName else if(r2_sort.isSelected()) ...
f2c8a2ca-febe-40ac-be3b-ca9b1acce50b
6
public static void main(String[] args){ deck.shuffleDeck(); distributeDeck(); // GAME LOOP do{ System.out.println(hand1.element() + " vs " + hand2.element()); System.out.println("Hand_1:"+hand1.size()+" Hand_2:"+hand2.size()+"\n");//Show Current Stats if( hand1.element().compareTo(hand2.element()) =...
5966d206-a103-4125-9ded-5dbee7ce2429
3
public void generateParams(int size) throws Exception { SecureRandom rnd = new SecureRandom(); //generate params do { g = new BigInteger(size, rnd); p = BigInteger.probablePrime(size, rnd); } while (g.modPow(p.subtract(BigInteger.ONE), p).compareTo(BigInteger.ONE)...
d6491916-dd57-4755-9893-316feb368261
6
public void WGGiveWord(String sender, Command command) { if((command.arguments.length == 3) || (command.arguments.length == 4)) { Game game = getGame(command.arguments[1]); if(game != null) { User user = getUserByNick(game, command.arguments[2]); ...
16447d80-4429-4d81-87ee-cb56dfa0f5fe
0
public EventBranchObjectResponse( final Boolean success, final String errorMessage, final EventBranch eventBranch ) { super(success, errorMessage); this.eventBranch = eventBranch; }
cf0c310f-6cb8-4cf8-8de4-3c703f361eb9
1
private boolean jj_3_32() { if (jj_3R_49()) return true; return false; }
de575303-9408-4c09-a631-ff0dbd17336c
2
public void merge() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { matrix[i][j] = x.nextInt(6) + 1; } } }
ab95e950-b56e-406e-8fcb-6c89761d50fe
5
public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) { if ( i > __field_names.length ) return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 ); Churn v = (Churn)o; switch (i) { case 0: v.peerID = in.getInt(); break; case 3: in.readB...
a37f742a-470c-4528-92c4-daaa359c3c5e
3
public static double randomDiagonalDirection() { double randomNumber = Math.random(); if (randomNumber < 0.25) return Const.rightdown; if (randomNumber < 0.5) return Const.leftdown; if (randomNumber < 0.75) return Const.leftup; return Const.rightup; }
b3b5816a-16c7-44a1-8c24-361ffb8640b7
0
public boolean has(String key) { return datas.containsKey(key); }
4dbd108f-b5f4-4025-b3d8-077d9126080a
4
public void draw(boolean isStick) { gl.glPushMatrix(); gl.glTranslatef(origin[X], origin[Y], origin[Z]); gl.glRotated(hipRot * (this.isLeft ? 1 : -1), hipRotVec.x(), hipRotVec.y(), hipRotVec.z()); gl.glTranslatef(0, 0, -this.uDimensions[Z]); gl.glScalef(this.uDimensions[X], t...
fabccc14-e183-436d-a865-fefd0d320ebe
7
final void initValue(int id, String name, Object value, int attributes) { if (!(1 <= id && id <= maxId)) throw new IllegalArgumentException(); if (name == null) throw new IllegalArgumentException(); if (value == NOT_FOUND) throw...
c27d67b1-caba-4507-8016-b2209d4d398f
0
public void setTempFileManagerFactory(TempFileManagerFactory tempFileManagerFactory) { this.tempFileManagerFactory = tempFileManagerFactory; }
10f5f4ba-4cfd-42b0-9080-ec86a0d77b9f
2
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { String msg = ""; if(args.length>0){ for(String data: args){ msg+=data+" "; } } BansManager.kickAll(sender.getName(),msg); return true; }
fa4b9e44-5326-40e9-bc48-c85eb4c61969
8
public boolean accept(File dir, String name) { int i = name.lastIndexOf('.'); if (i != -1) { String extension = name.substring(1+i); if (extensions.contains(extension)) { return true; } else if (extension.startsWith("f") && extension.matches("f\\d+")) { return ...
af5f98bc-cd74-4cfd-98ca-bb8237962548
2
public void loop(){ if(muted)return; try{ new Thread(){ public void run(){ clip.loop(); stopped = false; } }.start(); }catch(Throwable e){ e.printStackTrace(); } }
78578674-f00d-4156-88f6-eadeceb14935
9
@Override public boolean swap(int srcSlot, NStorage dstStorage, int dstSlot) throws IllegalArgumentException { if(dstStorage == null){ throw new IllegalArgumentException("dstStorage must not be null"); } if(dstStorage == this){ if(!canSwap(srcSlot, dstSlot)){ ...
bc219198-d8b6-4c21-b33e-cb1ae51c6a63
0
public static Visiteur selectOneByLogin(EntityManager em, String login) throws PersistenceException { Visiteur visiteur = null; Query query = em.createQuery("select v from Visiteur v where v.nom = :login"); query.setParameter("login", login); visiteur = (Visiteur) query.getSingleResult()...
edc6e633-ec13-4b0d-96a0-6bf122655ec0
3
@Test public void onDeathStopMoving() { rat.moveTo(Const.down); for (int i = 0; i < 100; i++) rat.update(); rat.die(); for (int i = 0; i < 100; i++) rat.update(); assertTrue(rat.X() == Math.round(Const.width / 2) && rat.Y() == 0); }
12b2fa88-94e0-4ee7-a66d-db265763df9c
6
public static String getWorkingDirectoryFromJar( String resource ) { String s; // if jarloc property is set, use it to find working directory if( System.getProperty( "org.openxls.extenxls.jarloc" ) != null ) { s = System.getProperty( "org.openxls.extenxls.jarloc" ) + "!"; } else { URL u = ResourceL...
4dd302bc-9c0e-45e5-b10e-a68b864f7beb
8
public boolean checkDo(Item newTarget, Item originaltarget, Environmental owner) { if((newTarget!=null) &&(newTarget instanceof Food) &&(!(newTarget instanceof Pill)) &&(isBerry(newTarget)) &&(newTarget.container()==originaltarget.container()) &&(newTarget.name().equals(originaltarget.name()))) { fina...
35a3b872-2b8b-4e4c-aba6-63c75b218eaf
4
private void addFieldType(String fieldName, Class<?> fieldType) { final Class<?> existingType = fieldTypes.get(fieldName); if (existingType != null) { if (existingType != fieldType) { throw new IllegalStateException("Invalid component definition, field " + fie...
740e1ac3-94ef-4c79-8dba-8c10b8f08a31
1
public List<Integer> getScores() { List<Integer> scores = new ArrayList<Integer>(); for (Integer i = 0; i < 10; i++) { scores.add(userPrefs.getInt(i.toString() + " score", 0)); } return scores; }