method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fbb1e6a0-1f50-42d1-ac92-8b9110d75b14
1
public int getMessageId() { if (messageId == -1) { messageId = nextId(); } return messageId; }
83198ed0-3104-4fe2-bf3d-3c149b56c648
9
public static void main(String[]args){ int[] numbers = new int [5]; Scanner scanner = new Scanner(System.in); /*for (int i=0; i<5; i++) { System.out.println("Write numbers[" + i + " ] = "); numbers[i] = scanner.nextInt(); System.out.println(verifyIfNumberIsPrime(numbers[i]))...
af0ec086-a800-4283-98a3-65c821700707
3
public String[] getInterfaces() { if (cachedInterfaces != null) return cachedInterfaces; String[] rtn = null; if (interfaces == null) rtn = new String[0]; else { int n = interfaces.length; String[] list = new String[n]; for (in...
e9ad33f3-768f-4a37-8c79-3028851986bd
8
public static ServiceTime getServiceTime(Address srcAddr, Address dstAddr) { ServiceTime serviceTime = new ServiceTime(); serviceTime.setSrcAddr(srcAddr); serviceTime.setDstAddr(dstAddr); String url = "http://www.sf-express.com/dwr/call/plaincall/ServiceTimeManager.getServiceTime_omp.dwr"; List<NameValuePair>...
883cb9aa-4f85-43ac-a875-9bda5c9c41ff
5
public void changeController(EU2Country country) { String sid = go.getString("id"); boolean b = false; EU2Country prevController = null; for (int i = 0; i < scenario.numCountries() && !b; i++) { GenericList provs = scenario.getCountry(i).go.getList("controlledprovinc...
66812cea-b560-4f79-a278-38259931b18f
2
@SuppressWarnings("unchecked") @Override public E get(int index) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException("Index " + index + "for size " + size + " is out of bounds"); } return (E) data[index]; }
f3209d81-0943-4623-b4ac-12bf50283d31
2
void initKey(Integer[] kcs) { for (int i = 0; i < kcs.length; i++) { try { keyMapping.put(kcs[i], Board.class.getMethod(methodName[i])); } catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); } } }
73738eca-7b15-411b-8b46-5fbca30556f9
4
public void load() { try { // First do checks to create the initial file if(!file.exists()) { if(file.getParentFile()!=null) file.getParentFile().mkdirs(); if(file.createNewFile()) super.save(file); else throw new Exception("Cannot load: File can not be created!"); } // Then do checks to save...
a1768c69-3d60-41e7-9da4-776636033618
2
private void checkTreeMembership(Position<T> pos) { if (!(pos instanceof GeneralTreeNode) || !((GeneralTreeNode<T>) pos).sameTree(this)) { throw new IllegalArgumentException("Invalid position for this " + "tree."); } }
3ae47a40-da01-48e2-91bd-ba742d291b07
7
public void selectNextgenaration() { List<MaxOneChromosome> nextGen = new ArrayList<MaxOneChromosome>(); // Copy over a portion of the population unchanged, based on // the elitism ratio. int idx = Math.round(this.size() * elitism); for (int i = 0; i < idx; i++) { ...
a8a9949d-0974-4109-bddf-cfb8b09c610e
4
public void setStats(boolean forceNewStats, Stats stats) { switch(stats.getMode()) { case 0: setStatsOsuStandard(forceNewStats, stats); return; case 1: setStatsTaiko(forceNewStats, stats); return; case 2: setStatsCTB(forceNewStats, stats); return; case 3: setStatsOsuMania(fo...
05e8bcc7-e0a5-41e4-b25c-b38e85059bba
3
public void run() { byte[] ack_buffer = new byte[ACK_SIZE]; do { try { ack_buffer = new byte[ACK_SIZE]; DatagramPacket receivePacket = new DatagramPacket( ack_buffer, ack_buffer.length); clientSocket.receive(receivePacket); } catch (Exception e) { } int ack_num = Utilities.ge...
e09f50bc-5885-46ec-a764-0b260ce222b0
3
protected synchronized void flushAndClose( int code, String message, boolean remote ) { if ( flushandclosestate ) { return; } closecode = code; closemessage = message; closedremotely = remote; flushandclosestate = true; wsl.onWriteDemand( this ); // ensures that all outgoing frames are flushed...
e1429456-78a1-4935-8fb5-8bdf98b0b4ff
9
public boolean setOption( String op, String val ) { if( op.equals( "crossesAt" ) ) // specifies where axis crosses (double value { catCross = Short.valueOf( val ); } else if( op.equals( "orientation" ) ) { // axis orientation minMax or maxMin -- fReverse fReverse = (val.equals( "maxM...
81f14258-1cce-4662-89df-82e0edb2d272
9
int insertKeyRehash(short val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look ...
697ab478-a7bc-4357-a1e3-61ff99d89629
8
public static boolean almostEquals(double v1, double v2) { if (v1 == v2) { return true; } if (Double.isNaN(v1) || Double.isNaN(v2) || Double.isInfinite(v1) || Double.isInfinite(v2)) { return false; } long bits1 = Double.doubleToLongBits(v...
53883516-bc42-4bc6-8ecc-a413dcee6728
6
public MainView(Piece[][] board){ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setBounds(0, 0, 1150, 870); boardPane = new JLayeredPane(); boardPane.setBounds(100, 100,800,800); getContentPane().add(boardPane); this.addMainMenuBar(); chessBoard = new JPanel(); chessBoard.set...
e6d77b85-03e9-49a0-ae96-287c19a04fbe
1
private JComponent drawDialogPane() { // Create the panel JPanel panel = new JPanel(); panel.setLayout(new GridLayout()); panel.setBorder(BorderFactory.createTitledBorder("Product")); //Getting items from warehouse tab StockItem[] items = new StockItem[model.ge...
4dd3ce91-91ec-478a-a0dd-bc68d039951e
2
private boolean insertBlock(Block gameBlock) { if (!gameBlock.insert(gameGrid)) { --lives; if (lives != 0) { gameGrid.wipe(); return gameBlock.insert(gameGrid); } return false; } return true; }
5f797ff5-be33-4ec5-bb4b-694dc5a67ca5
7
public static void startupClassify() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Mod...
25f623c9-bd2d-49a0-b59f-7163dc6139dc
9
public void createNewarea(int x, int y, String areaName) { int i, j = 0; Room r = null; Vector<Room> newRoomList = new Vector<Room>(); for (i = 0; i < x; i++) { for (j = 0; j < y; j++) { System.out.print("make room" + String.valueOf(i) + '-' + String.valueOf(j)); r = new Room(); r.init();...
33c72166-a847-4ef1-aeea-0cc9a58fb4ba
5
public NoeudItineraire rechercheNoeudLivraisonPrecedent(Livraison livraison){ int idxPremierePlageNonVide = 0; for(int idxPlage=0; idxPlage< this.plagesHoraire.size(); idxPlage++){ List<Livraison> listeLivraison = this.plagesHoraire.get(idxPlage).getAllLivraison(); if(listeLivraison.size() == 0){ idxPremi...
99115d54-618b-431b-8e0e-fe5b60404815
7
private void eltran(double[][] a, double[][] zz, int[] ordr, int n) { int i, j, m; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { zz[i][j] = 0.0; zz[j][i] = 0.0; } zz[i][i] = 1.0; } if (n <= 2) { ...
a98b9268-b46e-42e7-a822-1e4d288870b6
8
@Override public void deserialize(Buffer buf) { rank = buf.readShort(); if (rank < 0 || rank > 2300) throw new RuntimeException("Forbidden value on rank = " + rank + ", it doesn't respect the following condition : rank < 0 || rank > 2300"); bestDailyRank = buf.readShort(); ...
9464e327-5e49-4725-bbeb-26dc5475b3ab
4
public void start() { if (this.cPointer == 0) { throw new ClosedException(); } final int r = ppaml_phase_start(this.cPointer); switch (r) { case 0: break; case 1: throw new ClockAcquisitionException(); case 2: throw ...
696f253b-46f4-429f-92e5-91dc79824f0b
4
@Override public void update(Observable obs, Object obj) { if (obs == robotInstance.getJoystickHandler()) { // We've hit a joystick error - disable everything if (connected) { robotInstance.getPacketTransmitter().terminate(); jEnableBtn.setEnabled(false); jEnableBtn.setText("Enable"); jConnectB...
1695dc55-401a-486a-95a2-8a5357fb8040
4
public GameWindow getGameWindow() { boolean test = false; if (test || m_test) { System.out.println("Controls :: getGameWindow() BEGIN"); } if (test || m_test) { System.out.println("Controls :: getGameWindow() END"); } return m_gameWindow; }
c9cf8924-a872-4df0-8eb3-7a165a77adb2
4
@Override /** * This method will be used by the table component to get * value of a given cell at [row, column] */ public Object getValueAt(int rowIndex, int columnIndex) { Object value = null; Problem problem = problems.get(rowIndex); switch (columnIndex) { case COLUMN_TITLE: value = problem.getPr...
a0da4524-65de-487c-bf72-f5a675ca07d5
5
@Override public int takeStep() { fillVariables(); if (gloBallBehindLine(this.gloBall, -0.3, ourField)) { if (upper) { goToGloDestination(this.gloMyPosition, this.gloUpperDefensePosition, 0.1); System.out.println("UPPER: " + this.gloUpperDefensePosition); } else { ...
769bbffe-296d-4f31-bdc6-95c1aad92402
7
public boolean equals(Object obj) { if(!(obj instanceof Pair)) { return false; } if(obj == this) { return true; } if(obj.equals(null)) { return false; } @SuppressWarnings("unchecked") Pair<T, U> p = (Pair<T, U>)obj; if(p.getFirst() == null || p.getSecond() == null) { System.out.pr...
c3c17d7f-78ae-4dd4-956f-15912efa880a
0
public void addAll(Collection<Feature> features) { this.features.addAll(features); }
41966a78-3ea1-4b35-9014-8b7d653bba56
1
public Integer getInteger(String expression, Object context) throws XPathExpressionException { assert(expression != null); if(context == null) { assert(document != null); context = document; } return ((Double) xpath.evaluate(expression, ...
82c678e6-9ba7-4908-855a-16b207f92370
3
private static int buildRows(OutlineModel model) { model.addRow(new OutlineTestRow("First")); //$NON-NLS-1$ model.addRow(new OutlineTestRow("Second, but with a really long piece of non-pre-wrapped text.")); //$NON-NLS-1$ model.addRow(new OutlineTestRow("Third, but with a\nreally long piece\nof pre-wrapped text.")...
305faf96-0fee-4c0c-8beb-7d740834cec7
8
public static double fTestValueGivenFprob(double fProb, int df1, int df2) { // Create an array F-test value array int fTestsNum = 100; // length of array double[] fTestValues = new double[fTestsNum]; fTestValues[0] = 0.0001D; // lowest array value fTestValues[fTestsNum - 1] = 10000.0D; // highest array value...
c1def063-423b-484d-9929-92bea48b8dd4
8
public boolean equals(Object obj) { if (obj == this) return true; if (obj == null) return false; if (obj.getClass() != this.getClass()) return false; Picture that = (Picture) obj; if (this.width() != that.width()) return false; if (this.height() != that.height()) return...
3d1ffa58-95d4-442a-a06b-40f1855e57e0
1
public void InsertaInicio (int idProceso, String nombreProceso, boolean recibido) { if (VaciaLista()) PrimerNodo = UltimoNodo = new NodosListaProceso(nombreProceso); else PrimerNodo = new NodosListaProceso(nombreProceso,PrimerNodo ); }
e8ef5b5f-6e85-47e6-b426-af4bf4c09e2b
9
private void render() { System.out.println("Render"); GridSquare[][] grid = gl.getGrid(); for(int col = 0; col < grid.length; col++) { for(int row = 0; row < grid[col].length; row++) { if (grid[row][col].player == EPlayer.None) System.out.print("-"); else if (grid[row][col].player == EPl...
8ef6202a-460d-4b79-9dc2-69735cba9d94
6
public void writeDataFile(String contentToWrite, String personName, String topic) { // Checks if personName is null of empty if (personName == null || personName.isEmpty()) { personName = "All Speakers"; } // Checks if topic is null or empty if (topic == null || topi...
bcc96f72-bcc0-4b3e-a543-baf2d8957384
4
@Override public boolean create(Particulier x) { String req = "INSERT INTO particulier ( email, motdepasse, nom, prenom, titre, adresse)\n" +"select \""+x.getEmail()+"\", \""+x.getMotDePasse()+"\", \""+x.getNom()+"\", \""+x.getPrenom()+"\", \""+x.getTitre()+"\", \"...
dd07a0f6-7a51-40d3-9aa6-e49db99da922
2
@Override public void run() { try { InputStream in = socket.getInputStream();// read from the socket BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String html; while (!"".equals((html = reader.readLine()))) { System.out.println(html); } OutputStream out = socket.getOu...
4b96ce1f-7585-4358-b05c-555037e2d227
9
boolean clauseChainSpec(int tok) { if (tok == Token.colon) { tokenNext(); tok = tokPeek(); if (isSpecTerminator(tok)) return generateResidueSpecCode(new Token(Token.spec_chain, '\0', "spec_chain")); } if (tok == Token.asterisk) { tokenNext(); return true; } Token tokenChain; char chain; ...
c581e33f-bcfa-4f0b-a442-2da872d87c14
9
private Node getOpposite(Node n){ int cur = n.getIndex(); int par = n.getParent().getIndex(); try{ if(cur == par + dim && cur / dim < dim - 1) return nodeMap[cur+dim]; if(cur == par - dim && cur / dim > 0) return nodeMap[cur-dim]; if(cur == par + 1 && cur % dim < dim - 1) return nodeMap[cur+1]; if(cur == par...
755dbc3c-3a0d-4935-84b0-2d1fa6b58a46
0
public static long convert32bitsLittleEndianToUnsignedInt(byte[] d) { return ((0xff & d[3])<<24) + ((0xff & d[2])<<16) + ((0xff & d[1])<<8) + (0xff & d[0]); }
82fbe0fa-d979-48a2-9af9-a11fb702bdbb
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AlgebraicParticle other = (AlgebraicParticle) obj; if (exponent != other.exponent) return false; if (sign != other.sign) return false; ...
5a38ccc0-8ce2-46d1-a9e9-65b0307c62ee
2
public static boolean isPrinterAvailable2(String printerName) { DocFlavor myFormat = DocFlavor.SERVICE_FORMATTED.PRINTABLE; PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); PrintService[] printers = PrintServiceLookup.lookupPrintServices(myFormat, aset); for (PrintSe...
04985f82-0ff2-4e87-866b-0fb626f398de
0
@AfterClass public static void tearDownClass() { }
ac3496f9-d766-4456-9e91-699dc55eb861
1
private String getTTenNum(){ if ((this.LinkIDNum++) >= 10000000) this.LinkIDNum=0; String returnnum ="0000000000"+ String.valueOf(this.LinkIDNum); return returnnum.substring(returnnum.length()-10); }
b200e9ee-1da6-4ef7-b37f-539679665164
2
@Override public void update(double deltaTime) { desiredPosition = position.plus(controls.desiredMove()); rechargeTimeRemaining -= deltaTime; if (controls.shouldFire()){ if (rechargeTimeRemaining <= 0){ Vector2f spawnLocation = position.plus(size.x()/2, 0); ...
e9daad02-0212-472b-b72a-ed42016044a7
5
public static int traversal(TreeNode node, int prefix) { if (null != node) { if (null == node.left && null == node.right) { return prefix * 10 + node.val; } else if (null == node.left) { return traversal(node.right, prefix * 10 + node.val); } else if (null == node.right) { return traversal(node.l...
7c2b922d-3288-47f2-882b-38af249720f4
6
private Opcode toOpcode(byte opcode) { switch (opcode) { case 0: return Opcode.CONTINIOUS; case 1: return Opcode.TEXT; case 2: return Opcode.BINARY; // 3-7 are not yet defined case 8: return Opcode.CLOSING; case 9: return Opcode.PING; case 10: return Opcode.PONG; // 11-15 are not y...
7d1b6fc6-cc89-4a43-a540-d516833b9c44
5
public ArrayList<UndoableItem> undoFunction() { ArrayList<UndoableItem> toReturn = new ArrayList<>(); if (undoStack.isEmpty()) { return null; } else { ArrayList<UndoableItem> cur = (ArrayList<UndoableItem>) this.undoStack.pop(); this.redoStack.push(cur); ...
9061ee97-9ec5-4fc0-a70a-61c2c6d86567
0
public ServiceContainer() { }
064f4e45-1928-43da-b6ed-f3e005008baf
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Action other = (Action) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fa...
c3dfbf47-1280-4639-ba34-7a5605ec85c5
4
public int findPeakElement(int[] num){ int fore = -9999999, next=-9999999; for(int i = 0; i < num.length; i++){ if(i+1 == num.length) next = -999999; else next = num[i+1]; if(num[i] >= fore && num[i] >= next) return i; } return 0; }
b2a9f10e-9ec2-483e-86f3-b557fc0b5717
2
@Override public Point2D next() { Point2D ret = new Point2D.Double(x, y); double e2 = 2*error; if (e2 > -dy) { error -= dy; x += sx; } if (e2 < dx) { error += dx; y += sy; } return ret; }
88d634bc-5984-4c40-a759-11683aa57a1e
6
public static void startupHttpClient() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/HTTP", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Stella.$CONTEXT$, ((Mo...
acf66f53-5751-47a8-ad33-bd76af7cdbe1
5
private boolean goalIsOnTheRoad(Goal goal) { Direction cabinDirection = cabinDirection(); if (cabinDirection == Direction.DOWN) { return cabin.getCurrentFloor() >= goal.getFloor() && goal.getFloor() >= nextFloorToReach() && Direction.DOWN == goal.getNextDirection(); } return...
e776efd6-efb0-47e4-83cf-42780acbf789
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if((affected instanceof MOB) &&(((MOB)affected).isInCombat()) &&(!struckDownToday) &&(CMLib.dice().roll(1,1000,0)==1) &&(((MOB)affected).getWorshipCharID().length()>0) &&(!((MOB)affected).getVi...
506f718a-d4b6-473b-8370-e4740c9ae45f
5
@Override public boolean contains(Object o){ if(o instanceof Set<?>){ Set<?> set = (Set<?>) o; if(wrapped.containsAll(set)){ return true; } } return false; }
86f6dc8d-663d-4168-ba33-72c5bcb8b289
1
private void drawDragRowInsertionMarker(Graphics gc, Row parent, int insertAtIndex) { Rectangle bounds = getDragRowInsertionMarkerBounds(parent, insertAtIndex); gc.setColor(Color.red); gc.drawLine(bounds.x, bounds.y + bounds.height / 2, bounds.x + bounds.width, bounds.y + bounds.height / 2); for (int i = 0; i <...
64843f2e-5b44-4ae9-9f29-f10a7bbd512f
6
protected void spots(int i, int j, BufferedImage completePic, int toSpread) { // 10% chance to stop, 90% chance to keep going on each iteration for (double rand = random.nextDouble(); rand < 0.9; rand = random .nextDouble()) { if (rand < 0.225) { i--; } else if (rand < 0.450) { i++; } else if (...
615a4317-b25c-4b8e-b7b0-ee65caaef374
7
public boolean isAABBInMaterial(AxisAlignedBB par1AxisAlignedBB, Material par2Material) { int var3 = MathHelper.floor_double(par1AxisAlignedBB.minX); int var4 = MathHelper.floor_double(par1AxisAlignedBB.maxX + 1.0D); int var5 = MathHelper.floor_double(par1AxisAlignedBB.minY); int var...
9a2e0c7c-febf-44ed-a4f8-ea5442df5282
5
public void keyPressed(int k){ if(k == KeyEvent.VK_RIGHT) player.setRight(true); if(k == KeyEvent.VK_LEFT) player.setLeft(true); if(k == KeyEvent.VK_W) player.setJumping(true); if(k == KeyEvent.VK_R) player.setScratching(); if(k == KeyEvent.VK_F) player.setFiring(); }
dc1154f7-363d-4b53-a82b-7cc39c8303eb
6
public static int stringToInt(String s) throws IllegalArgumentException { /* * (1) Determine if number should be negative (and starting index for * processing the rest of the String. */ boolean isNegative = false; if (s.length() > 1 && s.charAt(0) == '-') { isNegative = true; } /* * (2...
20358907-52e7-47be-86fc-2bd3cc560796
8
@Override public boolean push_msg (Msg msg_) { switch (state) { case bottom: if (msg_.flags () == Msg.more && msg_.size () == 0) { state = State.body; return super.push_msg (msg_); } break; ...
aa2cd906-38aa-4d74-bd85-e3e6094944d8
1
public ClassInfo loadClass(final String name) throws ClassNotFoundException { final String classFileName = name.replace('.', '/') + ".class"; final InputStream is = BloatingClassLoader.this .getResourceAsStream(classFileName); if (is == null) { throw new ClassNotFoundException("Could not find cla...
9d9199f2-e756-4dea-a1b6-2b6b2cb0e196
1
public List findAll() { log.debug("finding all Member instances"); try { String queryString = "from Member"; Query queryObject = getSession().createQuery(queryString); return queryObject.list(); } catch (RuntimeException re) { log.error("find all failed", re); throw re; } }
56fb1abe-958c-4c58-9ea7-e6380bfdadfd
1
public void testFormat_shortBasicParse() { // Tests special two digit parse to make sure it properly switches // between lenient and strict parsing. DateTime dt = new DateTime(2004, 3, 9, 0, 0, 0, 0); DateTimeFormatter f = DateTimeFormat.forPattern("yyMMdd"); assertEquals(dt, f...
bcb1b774-fb60-4c1c-a12a-5937798f580e
7
public static void llenarMemorizacion2() { for (int i = 0; i < matriz.length; i++) { for (int j = 0; j < matriz[0].length; j++) { int cuento = (matriz[i][j]=='.'? 1:0 ); if(i==0 && j==0) memorizacion2[i][j] = cuento; else if(i==0) memorizacion2[i][j] = memorizacion2[i][j-1] + cuento; else...
90d02cca-3fd0-42e7-b307-89ad1cedcc90
0
public int getDepth() { return depth; }
16ac9ca7-d347-4d7a-b4a6-9c63b4c82b80
6
public Meta(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "charset": charset = Charset.parse(this, v); break; case "content": content = Content.parse(this, v); ...
0a1bca05-45a0-4320-bdaf-7ba7837e494f
9
public static int getPalindromeLength(String str) { // 1.构造新的字符串 // 为了避免奇数回文和偶数回文的不同处理问题,在原字符串中插入'#',将所有回文变成奇数回文 StringBuilder newStr = new StringBuilder(); newStr.append('#'); for (int i = 0; i < str.length(); i++) { newStr.append(str.charAt(i)); newStr.a...
e4a9801e-64a6-428c-bc4b-9eb4529ff9e3
3
public static void berakning(int m, int n, int[] NtoY, int[] XtoM, int[][] vagar) { int min = vagar[0][0] + XtoM[0] + NtoY[0]; String Zon = "station 1 och station 1. Vilket är på avståndet: " + min + "."; for(int i = 0; i < m; i++) { for(int i2 = 0; i2 < n; i2++) { int kortvag = vagar[i][i2] + XtoM[i...
db0235ba-c2d7-403b-addd-33b2a977fc51
2
protected void setSourceDragColumn(TreeColumn column) { if (mSourceDragColumn != null) { repaintColumn(mSourceDragColumn); } mSourceDragColumn = column; if (mSourceDragColumn != null) { repaintColumn(mSourceDragColumn); } }
487d5aac-080b-43c4-b5c5-5a22a03dec7d
7
public static void startupTimepointSupport() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/TIMEPOINT-SUPPORT", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Ste...
e1185e66-e110-44e6-9d1e-51d365d8590b
5
public void run() { /*if there is a message store and check it*/ if (bot.hasPrivateMessage()) { message = bot.getPrivateMessage(); } /*This method checks if the user has the proper access*/ if (checkAccess(2, bot.getPrivateSender()) == false) { return; ...
c906ef02-c444-416b-bc2c-32648d2a8f3c
6
@EventHandler public void SpiderWaterBreathing(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSpiderConfig().getDouble("Spider....
d01aab3f-d474-4f3f-a14f-0c7ecd4e237f
7
public static void writeALevel(String level) throws Exception { System.out.println(level); BufferedReader reader = new BufferedReader(new FileReader(new File(ConfigReader.getMicrboesVsMetabolitesDir() + File.separator + "toFodor05182015_PL_shucha_bothLanes_wTaxa.txt"))); List<String> sampleNames = new Ar...
70e79a35-5f82-44b5-b63c-5e892ec3da84
6
public void save (String filepath) throws IOException { new ShrinkTail(tail,begs,lens).shrink(); int nodeSize = chck.size(); // 末尾の未使用部分を取り除く for(; nodeSize > 0 && chck.get(nodeSize-1) == Node.Chck.VACANT_CODE; nodeSize--); nodeSize += Node.Chck.CODE_LIMIT; // 検索時の範囲外アクセスを防ぐために、余白を設ける final int total = 4*3 +...
c3978b28-d043-49f7-81c6-e7c2a8e2307f
0
public static void main(String[] args) throws IOException { input(); output(); }
fc8ddddb-7156-4767-89e2-874baf8ad41c
2
public Airplane() { wSeats=new String[TOTAL_WIN_SEATS]; aSeats=new String[TOTAL_AISLE_SEATS]; for(int i=0;i<wSeats.length;i++) { wSeats[i]=new String("NA"); } for(int i=0;i<wSeats.length;i++) { aSeats[i]=new String("NA"); } }
3746fe7c-eadf-40cb-accd-6563e72c831a
8
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.source()==affected) &&(msg.sourceMinor()== CMMsg.TYP_FACTIONCHANGE) &&(msg.othersMessage()!=null) &&(msg.othersMessage().equalsIgnoreCase(CMLib.factions().AlignID())) &&(msg.value()>0) &&(msg.value()<Integer.MAX_VALUE)...
a3ce6772-cf74-4a7b-bb28-2f438928ea1e
1
public void removeComponent(Class<? extends IComponent> clazz, Entity entity) { registeredComponents.get(clazz).remove(entity); }
d4a750cd-303d-40ca-8cdb-62a2aa9e7e99
3
public boolean load(String audiofile) { try { setFilename(audiofile); sample = AudioSystem.getAudioInputStream(getURL(filename)); clip.open(sample); return true; } catch (IOException e) { return false; } catch (UnsupportedAudioFileException e) { return false; } catch (LineUnavailableException...
0d545c8a-3af3-4e6d-bca1-4ee21b05a394
6
@EventHandler public void ZombieBlindness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Blind...
ac362514-899b-4211-b999-d436dcbd97e0
9
private void enterIdSuccAndCost(ArrayList<PlageHoraire> PlagesHoraires, LinkedList<Livraison> tabLivraison, Tournee ens) throws Exception { PlageHoraire PH1,PH2; // Insert entrepot at the beginning ArrayList<Integer> suivantEntrepot = new ArrayLis...
9bae598c-04b2-426a-8684-10361da6b53a
5
private int countLivingNeighbors(int x, int y) { int livingNeighbors = 0; for (int xx = x - 1; xx < x + 2; xx++) { for (int yy = y - 1; yy < y + 2; yy++) { if (xx == x && yy == y) continue; if (isAlive(xx, yy)) { livingNeighbors++; } } } return ...
7b0047f6-5894-471b-a258-5a0627909de2
7
private static int getJobBy5ByteEncoding(int encoded) { switch (encoded) { case 2: case 3: return 100; case 4: return 200; case 8: return 300; case 16: return 400; case 32: case 63: return 500; default: return 0; } }
40cee8a4-0142-43bd-b922-753e3767f97f
0
@Override protected EntityManager getEntityManager() { return em; }
f84e9846-3f91-40ac-b1d1-658999b98afc
8
public final Function<Random, TestMethod> nextMethod(Class<?> actualType) { AliasedMethodTable<TestMethod> d = cache.get(requireNonNull(actualType)); return d != null ? d : cache.computeIfAbsent(actualType, new Function<Class<?>, AliasedMethodTable<TestMethod>>() { public AliasedMethodTable<...
83227926-acf5-428c-8084-ca5a547671e3
5
private void heap_down() { Binarynode node = root; Binarynode help; int valuehelper; while (true) { if (node.right == null || node.left.value > node.right.value) { help = node.right; } else { help = node.left; } ...
6991e665-f633-43df-b5f6-d8331b504237
2
public void testPropertySetHour() { LocalTime test = new LocalTime(10, 20, 30, 40); LocalTime copy = test.hourOfDay().setCopy(12); check(test, 10, 20, 30, 40); check(copy, 12, 20, 30, 40); try { test.hourOfDay().setCopy(24); fail(); } catc...
638a6ad8-b517-46ae-8af2-a34af94a6bda
9
public static int[] access(int[] a,int[] reg,int rw) { int[] r=new int[ARRAY_ROWS]; int[] b1=new int[WORD_SIZE]; //generate row selects (and-circuit) for(int row=0;row<ARRAY_ROWS;row++) { int mask=4; r[row]=Function.and(Function.C_MEMORY,(row&1)>0?a[0]:Function.not(Function.C_MEMORY,a[0]),(row...
672c97c6-e183-4f17-878e-fe3bd3fb17be
7
private static void optimizeMoves(List<DefinedMove> path) { DefinedMove prevMove = null; int count = 1; for (ListIterator<DefinedMove> it = path.listIterator(); it.hasNext(); ) { DefinedMove move = it.next(); /* * Check if some move is repeated 3 times */ if (move.equals(prevMove)) count+...
a836f8db-e633-49b2-8fd5-4cae0a819885
6
@Override public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { if (args.length == 1) { List<String> matches = new ArrayList<String>(); for (String subcommand : subcommands) { if (StringUtil.startsWithIgnor...
c34c22eb-a8a3-40aa-a7fa-4ee1f6f15c24
5
public void move(int offsetX, int offsetY) { CPRect srcRect; offsetX += movePrevX; offsetY += movePrevY; if (moveInitSelect == null) { srcRect = getSelectionAutoSelect(); if (!getSelection().isEmpty()) { moveInitSelect = getSelection(); } } else { srcRect = (CPRect) moveInitSelect.clone(); ...
df2a2481-b54b-4bfa-acc5-940042554879
5
protected double generateAmplitude(double time, double amplitude){ double amp = amplitude; if(time<adsr.getAttackTime()){ double deltaAmp=this.amplitude/(getSampleRate()*adsr.getAttackTime()); //the rate of growth of amplitude per sample return amplitude+deltaAmp; } else if(ti...
122a9d3e-116a-421c-a28e-6c7af28154e5
9
public void run() { try { oos = new ObjectOutputStream(connection.getOutputStream()); ois = new ObjectInputStream(connection.getInputStream()); } catch (Exception e) { e.printStackTrace(); return; } try { BufferedInputStream bis = new BufferedInputStream(connection.getInputStream()); w...
fe045708-9e90-4dd1-94dd-c36226f03d50
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
dc95d7e8-feea-4ece-9329-e8b9c0f6abc9
2
public static void setSpeed(int s) { if (s > MAX_SPEED || s < 1) { Debug.printWarning("Trying to set speed greater than maximum (" + MAX_SPEED + ")! Setting to max instead..."); speed = MAX_SPEED; return; } speed = s; }