method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c15ae8f1-d38d-4588-8214-b81db5711c2d
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 fe...
f24e436d-4853-4dd3-a393-e4d4d7430557
7
public static void playAudioStream(AudioInputStream audioInputStream) { // Audio format provides information like sample rate, size, channels. AudioFormat audioFormat = audioInputStream.getFormat(); System.out.println("Play input audio format=" + audioFormat); // Convert compres...
ee5c8dce-a75f-42b7-ae47-5ff894da0c58
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSeq...
f55ed446-749a-455c-9ab0-8d823dff8a48
9
private boolean serializeCompactRDFStructProp(XMPNode node, int indent, boolean hasRDFResourceQual) throws XMPException, IOException { // This must be a struct. boolean hasAttrFields = false; boolean hasElemFields = false; boolean emitEndTag = true; for (Iterator ic = node.iterateChildren(); ic.hasNext...
d1212341-f39f-4c70-a9a7-0a2a4e4f5233
8
public static Object mul(Object o1, Object o2){ if (o1 instanceof List && o2 instanceof Number){ List newList = new ArrayList(); for (int i=0;i<((Number)o2).intValue();i++){ newList.addAll((List)o1); } return newList; } if (o1 instanceof String){ if (o2 instanceof Number){ StringBuild...
fa2d59cf-95dc-49e7-8158-4010020234b2
7
private void doCheckStep(Connection cnn, String realm) { CCLoader loader = new CCLoader(); final int BUFFER_SIZE = 4096; BufferedInputStream bis = null; try { String addr = ConfigManager.getInstance().getProperties().getProperty("nativecheckurl"); URL url...
1abda449-887e-4768-ada5-01460ca67672
9
private double evaluate(Node node) throws Exception { double value = 0.0; if (node == null) { throw new Exception("evaluate: Failed because of null node!"); } switch (node.type) { case Node.GROUP: value = evaluate(node.left); break; case Node.OP: value = evaluateOp(node); break; case Nod...
66be71ab-ed7d-47c9-8689-868b95a6f28c
7
public Window<T> find(LockFreeElement<T> headd, T value) { LockFreeElement<T> pred = null, curr = null, succ = null; boolean[] marked = {false}; boolean snip; retry: while (true) { pred = headd; curr = pred.getNext().getReference(); while (true) { succ = curr.getNext().get(marked); while (marke...
153950d1-ab68-4e66-b153-9a79962c9aa8
4
public boolean isSolidTile(float xa, float ya) { int x0 = (int) (x + xa + 3) / 16; int x1 = (int) (x + xa + 13) / 16; int y0 = (int) (y + ya + 2) / 16; int y1 = (int) (y + ya + 14) / 16; if (level.getSolidTile(x0, y0) != null) return true; if (level.getSolidTile(x1, y0) != null) return true; if (lev...
107ba9fd-ac2d-46d9-8ec4-b13a15238d6d
3
public void sendMessage(MessageDTO messageDTO) throws DataProcessingException { MailBox sender = mailBoxDAO.find(messageDTO.getSender()); if (sender == null) { logger.warn("Mailbox with email " + messageDTO.getSender() + " does not exist"); throw new DataProcessingException(ExceptionType.mailBoxDoesNotExist);...
2f4197ab-9dc8-4b59-aaf2-91edc8120983
1
public static FloatControl getVolumeControl(Line line) { if (!line.isOpen()) throw new RuntimeException("Line is closed: " + toString(line)); return (FloatControl) findControl(FloatControl.Type.VOLUME, line.getControls()); }
641c8637-49f8-4d48-a917-bcb4864fe5d1
2
public int[] sort() { if (numbers == null || numbers.length == 0) { return numbers; } int length = numbers.length; quicksort(0, length - 1); return numbers; }
099fb30d-86ad-402e-ae4d-c792687e2117
3
@Override public void run() { int buffersize=size; double datasize=30*buffersize*1024; byte toSend[] = new byte[buffersize]; byte toReceive[] = new byte[buffersize]; for (int i=0; i<buffersize; i++){ toSend[i] = (byte)2; }// TODO Auto-generated method stub DatagramPacket recivePacket; Da...
cceb42ea-24ea-4043-a2a1-43e6b93e0cf2
9
public void keyPressed(KeyEvent key) { player.keyPressed(key); //movement & upgrades //System.out.println(key.getKeyCode()); //int x = player.getX(); //int y = player.getY(); if (inGame) //create weapon { if (key.isShiftDown()) {...
7681ac9c-0e99-4a9d-b69a-71773dabe749
5
public static int sumNonAbundantSum() { ArrayList<Integer> arr = abundantArr(); boolean barr[] = new boolean[28124]; for (int i = 0; i < arr.size(); i++) { for (int j = 0; j < arr.size(); j++) { int temp = arr.get(i) + arr.get(j); if (temp < 28124) { barr[temp] = true; } } } int sum = 0...
a75641fa-2cae-414c-b2a6-a0f173d078e5
3
private boolean initRMI() { if(proxyRMI != null) return true; try { registry = LocateRegistry.getRegistry(proxyHost,proxyRMIPort); proxyRMI = (IProxyRMI)registry.lookup(bindingName); return true; } catch (RemoteException e) { System.out.println("No proxy available, cannot init RMI now"); } catch (No...
2631fe9c-0b7b-4f6a-a17f-68a423243b19
6
public void setCurrentStage(int token) { if( token == 0){ //next Color temp = this.colorList[0] ; for( int i = 0; i <this.colorList.length - 1 ; i++){ this.colorList[i] = this.colorList[ i + 1]; } this.colorList[this.colorList.length - 1] = temp ; if( this.currentStage < this.stageNum){ ...
0414c3fd-b8d2-4bb6-a5d3-6e2da50033bb
0
@Override public String toString() { final StringBuilder sb = new StringBuilder("POSTerminal { "); sb.append("terminalID='").append(terminalID).append('\''); sb.append(", products=").append(products); sb.append(", order='").append(order).append('\''); sb.append(", orderTotal=").append(orderTotal); sb.appen...
3f6a3e8c-7f1b-4aa9-b225-6a01ddfc3043
0
public void setPhoneNumbers(String phoneNumberText) { this.phoneNumberText.setText(phoneNumberText); }
cd1b669b-7325-4a34-b09c-1d03906ba000
5
public static void main(String[] args, ArrayList<MainMenuHeroSlot> heroies) { int choice = 0; heroSlots = heroies; while(choice != 4) { System.out.println("Please choose what you would like to do.\n" + "1). Enter the inventory.\n" + "2). Enter a room to fight.\n" + "3). Buy an Item from the st...
8e63ec83-f884-4543-802c-2048a22e3b8f
5
private void DYING(Vector3f direction, float distance) { double time = (double)Time.getTime()/(double)(Time.SECOND); if(deathTime == 0) deathTime = time; final float time1 = 0.1f; final float time2 = 0.3f; final float time3 = 0.45f; final float time4 = 0...
93ef0262-0d32-40ca-8e77-6479a3e6dab0
0
@Test public void delMinHeapDoesNotSomehowEraseTheWholeHeapWhenCalled() { h.insert(v); h.insert(v); h.delMin(); assertFalse(h.isEmpty()); }
57612a26-48c7-4e29-8f88-d3f4333fc785
0
public int getHold() { return hold; //added to manipulate hold value for dealer class }
3435162f-261c-493b-ac95-576c14e39c5c
6
public void gatherObectives(UQuest plugin, Player player, Quester quester) { for(Objective objective : this.objectives){ if(objective.getType() == "gather") { int questLevel = 1; if(plugin.isScaleQuestLevels()){ questLevel = plugin.getQuestInteraction().getQuestLevel(player)+1; } int ...
44ba7a7a-1341-45a0-9704-081b09c27290
9
private void schedule_MaxMin(Vector<Task> metaSet, int currentTime){ /*We do not actually delete the task from the meta-set rather mark it as removed*/ boolean[] isRemoved=new boolean[metaSet.size()]; /*Matrix to contain the completion time of each task in the meta-set on each machine.*/ ...
c4e1cb83-30a6-453b-a935-160d9cbc2e86
6
public boolean getBoolean(int index) throws JSONException { Object object = get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Bool...
29716654-2e76-45e4-9442-12fb9b081e26
6
private static void errorMessage(String message, String expecting) { // Report error on input. if (readingStandardInput && writingStandardOutput) { // inform user of error and force user to re-enter. out.println(); out.print(" *** Error in input: " + message + "\n"); out....
57411409-baf1-4fad-b71a-83c1b2bd3d94
4
private ActionListener makeMoveFilesButtonListener() { return new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { JFrame fileMover = new JFrame("Move Files"); fileMover.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); fileMover.setSize(500, 750); fileMover.setVisi...
28ca674e-ae3a-48e4-9289-180c59fba7c1
4
public void DORSIdleExecution(boolean bypass){ if(bypass){ if(DORS.isStarted()) { return; } try { new DORS().start(); return; } catch (TooManyListenersException ex) { Logger.getLogger(IdleShutdownMana...
446dcd07-8a0b-4f63-b607-c7ae52bdc608
6
public void dispose() { if (tabs != null) { for (int i = 0; i < tabs.length; i++) { GraphicsTab tab = tabs[i]; tab.dispose(); } } tabs = null; if (resources != null) { for (int i = 0; i < resources.size(); i++) { if (resources.get(i) instanceof Resource) { ((Resource)resources.get(i)).dispose(); ...
36471cd2-8db4-4be1-a2c4-38ed39244104
6
public static void main(String[] args) { PostgreSQL postgres = new PostgreSQL("localhost", "5432", "postgres", "password", "postgres"); postgres.openConnection(); if (postgres.isOpen()) { System.out.println("Connection open."); } else { System.out.println...
3712062f-a2bd-45ed-b6e0-1ded18930b85
4
@Override public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException { // 根据tpURL获取标识码 final String serviceKey = getServiceKey(invoker.getTpURL()); // 通过标识码在缓存中找相应的Exporter Exporter<T> exporter = (Exporter<T>) exporterMap.get(serviceKey); if (exporter != null) { return exporter; } TpURL tpU...
de596091-8087-4293-a568-83a453378687
8
private void printTable() { // header for (int i = 0; i < 65; i++) { System.out.print("-"); } System.out.println(); System.out.print("| " + padRight("ip", 15) + " "); System.out.print("| " + padRight("mac", 17) + " "); System.out.print("| " + padRight...
e972deb3-44ea-4b1f-8a33-093be427b21b
7
public void transferHeatToParticles(List list, double amount) { if (list == null || list.isEmpty()) return; double k0 = getKinForParticles(list); if (k0 < ZERO) assignTemperature(list, 1); GayBerneParticle p = null; Object o = null; for (Iterator it = list.iterator(); it.hasNext();) { o = it.next()...
fa21e928-35d9-477b-a629-f48628187218
6
public void setBlendMode(int mode) { oldBlendMode = blendMode; blendMode = mode; GL14.glBlendEquation(GL14.GL_FUNC_ADD); if (mode < 100) { g.setDrawMode(mode); return; } try { Reflection.invokePrivateMethod(mPredraw,g); } catch (Exception e) {App.getApp().handle(e);} gl.glEnable(SGL.GL_BL...
329d7196-b90a-47d4-bc09-ee5823416858
9
public static void FeedDump1090Sdr() { Instant start = Instant.now(); String inputFile = "D:\\charlottesville\\sdr.1363727373.txt"; int aircraftAddress = 0xa82d60; Duration limit = Duration.ofMillis(10); Instant previous = Instant.MIN; try { SdrLogFileReade...
42926d7e-6338-430b-a235-3291d6aea888
5
@Override public void mouseReleased(MouseEvent e) { fEndPoint = e.getPoint(); Tile startTile = fMap.getTile(fStartPoint); Tile endTile = fMap.getTile(fEndPoint); if( startTile != null && startTile.equals(endTile)) { mouseClicked(e); }else { Lin...
a1f178eb-929f-4ecd-98ce-3e5dca64e441
9
private void initComponents() { UserTitle = new javax.swing.JLabel(); Exit = new javax.swing.JButton(); UserList = new javax.swing.JList(); Toolbar = new javax.swing.JToolBar(); GUITitle = new javax.swing.JLabel(); DocumentScroll = new javax.swing.JScrollPane(); Document = new javax.swing.JTextPane(); ...
55ca256f-67e8-4cd2-bbeb-5d5b3c3fd340
9
public String toString() { String e; switch (this) { case NONE: e = "No error"; break; case FILELIST_NOT_YET_SET: e = "No file list set"; break; case NOTHING_TO_PASTE: e = "Nothing to paste"; break; case CANNOT_PASTE_DIR_INTO_ITSELF: e = "Cannot paste a direct...
abf39ec8-c5dc-4686-8876-944094093a8e
7
public void insertString(int arg0, String arg1, AttributeSet arg2) throws BadLocationException { switch(this.restriccion){ case NUMERICO: if(arg1.matches("[^0-9]")) return; break; case ALFABETICO: if(arg1.matches("[^a-zA-ZñÑàÀèÈìÌòÒùÙ ]")) return; break; case ALFANUMERICO:i...
f89d6836-383b-483c-a377-a06969374d73
9
public void mouseDragged(MouseEvent e) { if (isResizeInProgress()){ if (resizeDirection == Cursor.SE_RESIZE_CURSOR){ setBounds( this.getBounds().x, this.getBounds().y, e.getX(), e.getY() ); } else if (resizeDirection == Cursor.E_RESIZE_CURSOR){ setBounds( this.getBounds().x, this.getBounds().y, e.ge...
dad9a484-75df-4d88-8b77-a621218f1b5b
0
private String getPlayerStats(Characters player) { String stats = " " + player.getName() + "\n\n"; stats = stats + "Health: " + player.getHP() + "\n"; stats = stats + "Mana: " + player.getMana() + "\n"; stats = stats + "Mana Regen: " + player.getManaRegen() + "\n"; retur...
023ec00e-ad24-4859-8294-b7864bcb5b02
8
private String processXPathValue(Document document, String v, boolean namespaceAware, final List<Variable> contextVariables) { if(v.contains(XPATH_EXPR)) { String xpathExpr = v.substring(v.indexOf(XPATH_EXPR) + XPATH_EXPR.length(), v.lastIndexOf("}")); xpathExpr = VariableHelper.substituteVariables(xpathExpr, c...
51742372-17d3-4433-9e57-25fefeb3821d
8
public void setRGB(int r, int g, int b) { if ((r < 0) || (r > 255)) { throw new IllegalArgumentException("The red value (" + r + ") must be between [0,255]."); } if ((g < 0) || (g > 255)) { throw new IllegalArgumentException("The green value (" + g + ") must be between [0...
e0ac6c72-e611-49f1-8f55-2552e999eac0
5
public void guiActionPerformed(int elementId, int action) { if(elementId == list.getId()) { switch (action) { case 0 : close(); break; case 1: game.getWorld().writeToFile(); break; case 2: close(); game.showGui(new GuiMainMenu(game, Game.WIDTH, Game.HEIGHT)); break; case 3: ...
2bfed4ba-4c44-44bc-a0df-142e1dc27d9d
1
private boolean send(String name, Command com) throws IOException { Network st = clients.get(name); if (st == null) { return false; } st.send(com); // System.out.println("Sent message to " + name); return true; }
618c02f3-2090-462b-9a03-c1ad5b8847b6
1
public void removePush() { if (condStack != null) cond = condStack.mergeIntoExpression(cond); bodyBlock.removePush(); }
f6115a68-58dd-46e5-b0f2-67920c4a572a
0
public Vehicle getVehicle() { return vehicle; }
8345a987-9b63-4c6e-aed2-cab200cc49f2
8
@Override public void actionPerformed(ActionEvent arg0) { // Neuen Artikel hinzufuegen if(arg0.getActionCommand().equals("add")){ Double ek = Double.parseDouble(view.getEK().replace(",", ".")); Double vk = Double.parseDouble(view.getVK().replace(",", ".")); this.av.addArtikel(view.getName(), e...
665ae25a-e0cf-493e-ab6c-e3d765e4f8ee
8
public void updateInput(String str) { Boolean state = (str.startsWith("released") ? false : true); String key = (state ? str : str.substring(9)); input.put(key, state); // If one of the directions was pressed, automatically release the // opposite direction. if (state) { ...
50e34144-500b-4395-bcc2-34cd195f9961
3
private void resolutionSemiAleat(){ Plateau tmp=new Plateau(plat); //tant que le score du plateau n'est pas egal au score maximal while(tmp.getScore()!=tmp.scoreOptimal && !resolu ){ //on melange la liste de polyominos shuffle(); //on creer un plateau temporaire vide tmp=new Plateau(plat); ...
4fbd428e-8ae1-4b25-8bbb-5829be43ed9c
8
public Animation getAnimation(directions direction) { switch (direction) { case LEFT: return walkingLeft; case RIGHT: return walkingRight; case UP: return walkingUp; case DOWN: return walkingDown; case STANDING_LEFT: return standingLeft; case STANDING_RIGHT: return standingRight; cas...
e1adf43b-817e-41b4-aa90-cf75b5ed96d8
5
public LOGIN() { //MAIN FRAME super("Team J's Scheduler | Login Page"); setBounds(50,50,350,350); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(null); setVisible(true); //LOGIN BUTTON Login.setLayout(null); Login.setLocation(2, 285); Login.setSize(170, 2...
faa9b4a9-af0e-44e2-a1aa-32646f05ea9f
2
public void ValueSolve(int[][] matr) { if (checkSolve(matr)) { ArrayList<Integer> Colors = this.Colors; HashSet<Integer> tmp = new HashSet(); for (int i = 0; i < Colors.size(); i++) { tmp.add(Colors.get(i)); } this.Value = tmp.size(); ...
e568906a-123d-4adf-96d5-dd6fd76a4975
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { stack[top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { this...
c2758a12-859c-43ed-a437-669a5beaf94a
2
@Override public int compareTo(Version v) { if(v == null) { return 1; } int i = major - v.major; if(i == 0) { i = minor - v.minor; } return i; }
0f22f54f-053c-4273-ad8c-cc557e116697
9
public XMLExpression parseArray(JSONArray jsonArray) { Iterator<Object> iter = jsonArray.iterator(); XMLArray array = new XMLArray(); Object o = null; while (iter.hasNext()) { o = iter.next(); if (o == null) { array.add(new XMLNull()); } else if (o instanceof JSONArray) { array.add(par...
a0e4a83f-fdc8-408e-a422-03f873a30aba
1
public void execute(){ BukkitScheduler scheduler = Bukkit.getScheduler(); Bukkit.broadcastMessage("[RP] " + ChatColor.RED + player + ChatColor.RESET + " wants to become a(n) " + job.getName() + ". Type /vote '" + player + "' to vote for him!"); scheduler.scheduleSyncDelayedTask(plugin, new Runnable(){ ...
ee1243d1-9181-487f-ad0b-0212315e2010
5
private void chooseImage() { if(isEating) { setImage(Eating); return; } if(canEat() || isAirborn()) { setImage(still); return; } if(stepsTaken/50 > prevStepsTaken/50) { if(currentFoot) ...
42bf701f-94e9-4026-b11f-36836b152c34
6
public static void main(String[] args) { Selector selector = null; ServerSocketChannel serverSocketChannel = null; try { // Selector for incoming time requests selector = Selector.open(); // Create a new server socket and set to non blocking mode ...
36cdf91a-a898-4eb3-a682-71e54f92c09b
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...
11433ef5-44f4-4c9a-b09e-4a94ddae1430
7
public String toString() { StringBuilder sb = new StringBuilder(); for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { switch (gameField[i][j]) { case EMPTY: sb.append("."); break; case WALL: sb.append("x"); break; case TREASURE: sb.append("$"); break; c...
ea80d0b5-7d52-458d-a24a-580e15b43236
9
private void nextTexture() { if (animationType == EnumAnimationType.ONEWAY_RENDERED) { if ((currentTexture + 1) < textures.length) { currentTexture++; } else { currentTexture = 0; } } else if (animationType == EnumAnimationType.TWOWAY_R...
afe0a590-bd12-45e7-8270-61d2039b6d74
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
89f181a7-8575-4aca-9dae-a97ac216681c
6
private int getCommandStyle( String Command ) { if ( Command.startsWith( "@ssh" ) ) { String hostInfoList[] = Command.split( ":" ); if ( hostInfoList.length == 5 ) return SSH_INIT; else return SSH_INIT_ERROR; } if ( Command.startsWith( "@local" ) ) { String commandlst[] = Comm...
ef5655e7-37a9-4aad-8ced-3299d6f02915
1
public void addTile(String tileName, Point2D loc) { if(tiles.containsKey(tileName)) { tiles.get(tileName).add(loc); } else { tiles.put(tileName, new ArrayList<Point2D>(Arrays.asList(loc))); loadTile(tileName); } }
e27aec55-6224-44b5-8621-2cf4056f0cf3
9
@Override public void onPreviewNativeEvent(NativePreviewEvent event) { if (!event.isCanceled()) { if (event.getTypeInt() == Event.ONKEYDOWN) { switch (event.getNativeEvent().getKeyCode()) { case KeyCodes.KEY_UP: moveUp(); ...
c7d5cba3-755e-4435-8df4-18d09706f5b8
4
private void useNonEvolutionaryAlgorith(int type) { Integer[] result = null; switch (type) { case 1: result = NotEvolutionAlgorithms.solveLargestFirst(graph); break; case 2: result = NotEvolutionAlgorithms.solveSmallestFirst(graph...
1417931b-cca7-4fd9-8d58-49f0f4d66548
6
private void processFileAttrRequest(Sim_event ev) { if (ev == null) { return; } int requesterID = -1; int size = 0; FileAttribute attr = null; try { Object[] obj = (Object[]) ev.get_data(); if (obj == null) { ...
1ac00a0b-4a1e-4733-b426-a1edda48bba7
4
@Override public void update(GameObject object) { int dir = new Random().nextInt(4); if(dir == 0) { object.y -= 2; } if(dir == 1) { object.y += 2; } if(dir == 2) { object.x -= 2; } if(dir == 3) { object...
cc8e68c0-b243-44b1-be5f-971e4df9e669
1
@Test public void testSecondDown() { Model model = new Model(); Time realTime, expectedTime; realTime = new Time(1,0,3); expectedTime = new Time(0,59,53); model.setTime(realTime); for (int i=0;i<10;i++) { model.secondDown(); } ...
d9446156-2659-45e9-9f2c-6442ea5ccfd4
7
static void indexDocs(IndexWriter writer, File file) throws IOException { // do not try to index files that cannot be read if (file.canRead()) { if (file.isDirectory()) { String[] files = file.list(); // an IO error could occur if (files != null) { for (int i = 0; i < files.length; i++) { ...
9225bc05-7340-4561-926d-c17d0703879c
5
public void drawRegularly(Graphics2D g2){ //update the currentImage creates animation runner.updateCurrentImage(); //update runner's position and draw the runner runner.updateCurrentPosition(); g2.drawImage(runner.getCurrentImage(), (int)runner.getX(), (int)runner.getY(), null); //update the bulletPosition Array...
68c73327-f1f5-4cfe-873c-84454825d597
2
public void setNumDen(double deltaT){ // set denominator, s super.sDenom = new ComplexPoly(0.0D, 1.0D); super.sPoles[0].reset(0.0D, 0.0D); // set exp(-sT) part of pade numerator super.sNumer = new ComplexPoly(1.0D); super.deadTime = deltaT; super.pade(); ...
dfb67f63-f552-40b3-8966-623e7fec8680
8
@Override public void tileFocusChangedAt(Position position) { Unit unit = game.getUnitAt( position ); unitMoves.setText(""); if (unitShield != null) editor.drawing().remove(unitShield); if (unit != null){ unitShield = new ImageFigure((unit.getOwner() == Player.RED ? GfxCo...
c92f6077-b52c-4138-b1b9-91d1b52e5e28
7
public void insert(TreeNode node) { if (initialized()) { TreeNode parent = this.root; while (true) { if (node.value > parent.value) { // rechts einfügen if (parent.hasRightChild()) { parent = parent.rightChild; } else { if (this.prematureWiring) { node.rightChild = pare...
95365863-5cf0-4d75-8d62-458ab9ffea54
8
public void generateTile(World world, Random rand, int x, int y) { if(x < world.width / 2) return; if(rand.nextDouble() > 0.02) return; for(int r = rand.nextInt(5) + 5; r > 0; r--) { for(int a = 0; a < 360; a++) { double angle = Math.toRadians(a); int nx = (int) (x + r * Math.cos(angle)); ...
c0b86fd4-a26e-47cb-8716-be0c0c620045
7
public ArrayList<OpinionCluster> calculateOpinionClustersByGroup() { ArrayList<OpinionCluster> clusters = new ArrayList<OpinionCluster>(); boolean isNewOpinionCluster; for(Group g: groups) { for(Agent a: g.getAgents()) { isNewOpinionCluster = true; for(OpinionCluster o: clusters) { if(a.getGroup().equ...
fa3e0194-bdec-496c-a400-2e74ad797c3e
5
private Integer s_to_int(String s) { if (s.equals("Integer")) { return 0; } if (s.equals("String")) { return 1; } if (s.equals("Date")) { return 2; } if (s.equals("Boolean")) { ...
7bd22b00-db63-4f11-a734-59d9ff6005bb
7
private PDFEntryHolder findEntryHolder(PDFEntryHolder pdfEntryHolderSearch, PDFPageHolder pdfPageHolder) { boolean bestIsMalformed = false; float bestCoverage = 0f; PDFEntryHolder bestEntryHolder = null; for (PDFEntryHolder pdfEntryHolder : pdfPageHolder.getElements()) { if(pdfEntryHolderSearch.getClas...
e17974d5-eade-4125-a26c-6064ff30b218
2
static public DataType getDataType(String typeNumber) { for (DataType type : DataType.values()) { if (type.getDataTypeValue().equals(typeNumber)) { return type; } } throw new RuntimeException("unknown type"); }
25faed9b-0573-4901-9814-469d05277d9e
1
public String getWwLevel() { if (river == null) return "<?>"; return river.getWwLevel(); }
18cc3f60-200c-476f-9fa5-d91b5a38e028
8
private static void refreshAllAccelerators(Map<String, JMenuItem> itemMap) { // This method is called everytime menu and popup-menu is created. File keyBindConf = Bootstrap.getSystemFile("keybind.conf"); if (!keyBindConf.exists()) { return; } Map<String, KeyStroke> ke...
60d7817e-4fba-4fce-9929-5a774294f190
7
public Node search(Problem problem, State initialState) { //A list to keep the nodes generated during the search process. List<Node> frontier = new ArrayList<Node>(); //List of states generated during the search process. This is used to check for repeated states. List<State> generatedStates = new ArrayList<Stat...
19016f7b-92ce-458b-92cb-128019cb55cd
0
public void setSimilarity(double similarity) { _similarity = similarity; }
7a72dd3f-0900-4b1d-acab-102e2e14ee9b
1
private void updateGraphicalRepresentation() { ArrayList<DrawableParticle> d = new ArrayList<DrawableParticle>(); Color c = Color.ORANGE; for (Particle p : this.p) { d.add(new DrawableParticle((int) p.x, (int) p.y, (int) Math .sqrt(p.mass), c)); } this.pDraw = d;// atomic update }
097cba9f-2e6a-4787-b87b-b29d7044017f
5
private void bAddMetodoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddMetodoActionPerformed // TODO add your handling code here: if( !tNMetodo.getText().equals("") ){ String nombre=tNMetodo.getText(); String retorno=cbRetorno.getSelectedItem().toString(); ...
2d190d31-b38b-47d4-88fa-bb1296590851
3
public static boolean isEnglishLetter(char c) { return (c >= 65 && c <= 90) || (c >= 97 && c <= 122); }
21ad8834-4aed-4121-8db5-0ffccf05214c
8
private void signUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_signUpButtonActionPerformed if (!new String(passwordField.getPassword()).equals("") && !new String(confirmPasswordField.getPassword()).equals("") && new String(passwordField.getPassword()).equals(new Stri...
dd8bdf03-acbf-4cc0-94f5-68431c9f13e4
6
public static void calculate(long[][] graph, long[][] paths) { int size = graph.length; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { paths[i][j] = i; } } for (int k = 0; k < size; k++) { for (int i = 0; i < size; i+...
9d3caf89-3ba1-4d0c-b7af-4697242de21c
0
public MACMethodType createMACMethodType() { return new MACMethodType(); }
d1e6e68b-6dfb-48bd-9f17-f299249c6b3a
4
private void closeFile() { if (status_) { try { if (writer_ != null) { writer_.close(); writer_ = null; } if (reader_ != null) { reader_.close(); reader_ = null; } } catch (IOException e) { JOptionPane.showMessageDialog(this, e.getMessage()); } status_ = false; }...
1ab5a7ae-b631-48e0-9be6-c717a4b78fdf
0
@Override public String getCommand() { return this.command; }
0c9d4dac-8d62-424c-add5-f4a5470804a8
1
public void togglePauseHUD() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); hud.togglePauseHUD(); } checkRestoreCuror(); }
12e482c7-1fe2-46f0-a8c9-243d19f1c699
0
public double getIntelligence() { return intelligence; }
61c16da7-6469-48aa-8621-354ac1e52c05
9
public static void main(String args[]){ System.out.println("spawning threads......"); ArrayList<Thread> threads = new ArrayList<Thread>(); int incrementAmount = stop/threadcount; int starting =1; for (int i=0;i<threadcount;i++){ if ((i+1)!= threadcount){ threads.add(new Thread(new PrimeThread(starti...
f4ae90a0-a4eb-4259-b163-fd96cdf2ad0d
8
public int[] getMax(TreeNode p_root) { if (p_root.getLeft() == null && p_root.getRight() == null) { return new int[] {0, 0}; } else if (p_root.getLeft() != null && p_root.getRight() != null) { int[] l_left = getMax(p_root.getLeft()); int[] l_right = getMax(p_root.get...
e5494247-22fd-4512-9031-ac579caf4d12
1
private static void creaInstancia() { if (INSTANCE == null) { INSTANCE = new ctrlDisco(); } }
9790650e-a462-473d-87cb-b38e5e14c395
1
public Cogbot() { if (Cogbot.instance != null) throw new InstantiationError("Cannot create duplicate instances of Cogbot in one JVM context!"); Cogbot.instance = this; Cogbot.log = Logger.getLogger("cogbot"); rootLogger = new CogLog("root", null); gc = new CogGC(Cogbot.log); connectors = new ArrayList<I...
74553edc-7f91-4883-9ff6-83b40ad1c73c
0
@After public void tearDown() { }