method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7124cec0-9209-41bb-9028-756736c5c155
0
public int getAge() { return age; }
298d979c-673b-46e4-b15b-e6e620ff07e3
0
public int getNumBuffers() { return numBuffers; } // end getNumBuffers()
5729f2e6-fb78-4066-8867-afa2d422d519
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
809fcbfb-6561-4f1e-85f2-6cbda8963238
9
public static int findNumInRotatedArray(int[] array, int num) { int low = 0; int high = array.length - 1; int mid; while (low <= high) { mid = (low + high) / 2; if (array[mid] == num) { return mid; } else if (array[mid] > num) { if ((array[low] > array[mid]) || (array[low] < array[mid]...
d2b073a8-d29a-49f7-b432-bc15f033f649
9
private static int play() { /** * Get a new deck of cards, and store a reference to it * in the variable <code>deck</code> */ Deck deck = new Deck(); /** * @param currentCard the current card, which user sees */ Card currentCard; ...
4e071fe7-ca87-49c5-a09c-356a4cc72795
9
public static boolean wordBreak(String s, Set<String> dict){ if(s==null||s.length() == 0){ return true; } boolean[][] resultHash = new boolean[s.length()][s.length()]; for(int len = 0;len<s.length();len++){ for(int i=0;i<s.length();i++){ if(i+len<s...
72ac6e80-b35a-4440-8b10-55bf723eafa1
9
@Override public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) { variablesWithOffsets = new LinkedHashMap<String, Integer>(); variablesWithNewValues = new HashMap<String, Integer>(); variableValues = new ArrayList<Integer>(); if (argumentList.size() % 2 != 0) {...
f116eb2d-db81-464f-a5cf-93bc0f101309
4
@Test public void testLastVisitedSelection() throws BadConfigFormatException { // 3 possible targets one step from 5,8 ComputerPlayer player = new ComputerPlayer("test","yellow",board.getCellAt(board.calcIndex(5, 8))); player.setLastVisited('m'); // Pick a location with last visited room in target, just three ...
e294e4f4-2ca8-4eb4-a627-486bb0dbc1e0
0
public boolean isEatable() { return true; }
e55cf1f4-675a-45f2-a130-a874626aa6e3
7
public static void main(String[] args) { Locale.setDefault(Locale.US); Scanner s = new Scanner(System.in); String op = s.nextLine(); double sum = 0; for(int i = 0; i <= 5; i++){ for(int j = 0; j < 12-i; j++){ s.nextDouble(); } ...
8cde71a6-80af-4dd4-a22f-e06f64e0fa7a
3
@Override public boolean isValid(LoginCredential loginCredential) { try { CryptedInputStream cryptedInputStream = new CryptedInputStream(new FileReader("crypted_" + loginCredential.getUserName() + ".txt")); int character; String cryptedPassword = ""; while ((character = cryptedInputStream.r...
6abd1cb3-7323-4df1-a125-97f7dbaf8a0b
0
public int getLineCountOffset() {return this.lineCountOffset;}
445fc1c8-c97f-4060-a43a-59b93543bcec
3
public void test_05_fastqReader() { String fastqFileName = "tests/fastq_test.fastq"; String txtFileName = "tests/fastq_test.txt"; // Read fastq file StringBuilder sb = new StringBuilder(); for( Fastq fq : new FastqFileIterator(fastqFileName, FastqVariant.FASTQ_ILLUMINA) ) sb.append(fq.getSequence() + "\t"...
b22e2145-5a6a-400b-99d9-fb4acd9e8da5
5
public static void combinationsCounter(int n, int k, int[] indexes, int d) { int i, iMin; if (d < k) { if (d == 0) { iMin = 1; } else { iMin = indexes[d-1]; } for (i = iMin; i < n; i++) { indexes[d] = i; ...
f32e64e7-02b2-45c8-aa1f-2ffa3539188a
2
public SignatureVisitor visitExceptionType() { if (state != RETURN) { throw new IllegalStateException(); } SignatureVisitor v = sv == null ? null : sv.visitExceptionType(); return new CheckSignatureAdapter(TYPE_SIGNATURE, v); }
59781272-1962-48d0-bed6-78489f25803f
7
public void maskRect(int x, int y, int w, int h, byte[] pix, byte[] mask) { int maskBytesPerRow = (w + 7) / 8; int stride = getStride(); for (int j = 0; j < h; j++) { int cy = y + j; if (cy >= 0 && cy < height_) { for (int i = 0; i < w; i++) { int cx = x + i; if (cx >...
e7a7fb5c-9709-44c4-9437-fab0ecd3eac2
1
public void setToZeroPosition(){ for (int i = 0; i < beings.size(); i++){ beings.get(i).setPosition(zeroBeings.get(i).getX(), zeroBeings.get(i).getY()); } }
57fbeaa9-b7a4-4047-b72a-87b4a032b490
0
@Override public String toString() { return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); }
27ecdc29-5e50-4bdb-a89e-3de07a6f9ed4
1
public ByteVector putByte(final int b) { int length = this.length; if (length + 1 > data.length) { enlarge(1); } data[length++] = (byte) b; this.length = length; return this; }
527bbc00-b9f5-4b5e-a5a6-1d9406f6f5ac
6
public int calculateRangeAttack() { int attackLevel = c.playerLevel[4]; attackLevel *= c.specAccuracy; if (c.fullVoidRange()) attackLevel += c.getLevelForXP(c.playerXP[c.playerRanged]) * 0.1; if (c.prayerActive[3]) attackLevel *= 1.05; else if (c.prayerActive[11]) attackLevel *= 1.10; ...
a745907e-f56a-4de0-8744-9ce48533bfdc
2
public void InsertarAudio(ArrayList datos) { // Cambiamos todos los datos, que se puedan cambiar, a minúsculas for(int i = 0 ; i < datos.size() ; i++) { try{datos.set(i, datos.get(i).toString().toLowerCase());} catch(Exception e){} } biblioteca.inserta...
0fcb5c57-5c0d-46c8-a852-cef43fa6b4fa
3
private void initUI() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); questions[0] = new Question("File name for text file?", false); questions[1] = new Question("File name for tilesheet to use?", false); questions[1].GetTextField().setEditable(false); questions[1].GetTextField().setText(box.getSelectedNa...
1513c7a6-fb5d-4476-92be-4a941adfdb7e
7
public void run() { Long time = System.currentTimeMillis(); Long sleep = System.currentTimeMillis() - (time+broadcastDelay); Long threshold; Set<Byte> keys; Iterator<Byte> i; Byte key; while (true) { // broadcast try { time = System.currentTimeMillis(); // -> networking.Networ...
ef3dd797-9705-4092-9c47-4b6e9556a7a4
2
public void setProducts(ArrayList<Product> products, Basket basket) { if (basket != null) { for (Product product : products) { product.setInBasket(basket.isInBasket(product.getId())); } } this.products = products; removeSoldOutProducts(); }
bccdf364-1ff4-4f67-aa30-fa923aedca7e
7
private boolean loadEntities(String pathName, String productFile, String userFile){ boolean rtn = false; String productPath = confPath + productFileName; String userPath = confPath + userFileName; if(pathName != null && pathName.length() != 0){ if(productFile != null && productFile.length() != 0){ produc...
ad2368f5-77db-4be9-bf19-18da54708b76
9
protected void processKeyPressed(KeyEvent e) { if (!editable) return; if (selectedElement == null) return; int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_UP: selectedElement.translateBy(0, -1); break; case KeyEvent.VK_DOWN: selectedElement.translateBy(0, 1); break; case KeyEve...
bf4521dd-ab31-4d14-a862-9bc370e4f46b
2
private void updateQuadTree() { q.clear(); for (Mob m : dots) { q.insert((Collidable)m); } // for (Mob m : lines) { // q.insert((Collidable)m); // } for (Mob m : polygons) { q.insert((Collidable)m); } }
e21084d1-e0b0-4e8c-b7c0-c2c8551121bb
6
@Override //Este metodo permite la eliminacion de un producto de la BBDD public boolean bajaProducto(int id) { boolean correcto=false; TransactionManager.obtenerInstanacia().nuevaTransaccion(); try { //Iniciamos la transsacion y bloqueamos la tabla a mod...
2284cb04-5dc8-462f-a984-64c8f1e24ab7
0
private static void displayParams(long[] longValues, double[] doubleValues, int[] intValues) { System.out.println("Settings:"); System.out.println(" s: " + longValues[0]); System.out.println(" t: " + longValues[1]); System.out.println(" c1: " + doubleValues[0]); Sy...
0444a456-4a4f-4e79-a76d-9190ddbe1934
8
private BitSet selectImages(String str) { int n = view.getNumberOfInstances(ImageComponent.class); if (n == 0) return null; BitSet bs = new BitSet(n); if ("selected".equalsIgnoreCase(str)) { for (int i = 0; i < n; i++) { if (view.getImage(i).isSelected()) bs.set(i); } return bs; } if (s...
9961dee0-5a30-4be0-b038-b10c8b85c4cf
9
public Tile getTile(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile; if (tiles[x + y * width] == Tile.col_spawn_floor) return Tile.spawn_floor; if (tiles[x + y * width] == Tile.col_spawn_grass) return Tile.spawn_grass; if (tiles[x + y * width] == Tile.col_spawn_hedge) retur...
9da30dac-7275-431f-a697-a2df5bb4225d
7
public byte[] getNextFrame(int length) { byte[] output = new byte[length]; for (int i = 0; i < length; i++) { //convert the phase to an index by rounding int index = Math.round((WaveTable.TABLE_LENGTH - 1) * (phase / TWO_PI)); switch (mode) { case SI...
ce5ac237-b004-451d-9424-dbe60dd4910c
6
private static LinkedList createNetworkFlow(BufferedReader buf) throws Exception { if (buf == null) { return null; } // create the Router objects first LinkedList routerList = createRouter(buf, NetworkReader.FLOW_ROUTER); ...
b6a0b00a-c322-4934-9038-07f876c64c9d
8
public void construct(int[] treeNodes){ BinaryTree<Integer> root = null; if(treeNodes[0] != -1) { root = new BinaryTree<Integer>(treeNodes[0]); } Queue<BinaryTree> queue = new LinkedList<BinaryTree>(); queue.add(root); for(int i = 1; i < treeNodes.length;) { ...
e5be0472-582e-4e00-b1d5-cd34131357ef
0
public void colorBlack() { myColor = BLACK; }
4fd7195b-c5d9-4c46-a17c-a9e5160d9232
4
@EventHandler(priority = EventPriority.NORMAL) public void onEntityDamagedDebug(EntityDamageEvent evt) { if( !(evt.getEntity() instanceof Player) ) { return; } Player jugador = (Player) evt.getEntity(); SpyAroundHere.logInfo("Entity attacked"); ItemMet...
bb286fd9-5753-4f58-8906-8ce7aabd96b5
4
@SuppressWarnings("unchecked") protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // tarkistetaan onko sessioon lisättynä tilausriveja ja haetaan ne ArrayList<Tilausrivi> tilausrivit = null; if (request.getSession().getAttribute("tilausriv...
a1f6e27b-d8a1-4e08-8ee2-55d999c6afba
8
protected void drawHorizontal(Graphics2D g2, Rectangle2D area) { Rectangle2D titleArea = (Rectangle2D) area.clone(); g2.setFont(this.font); g2.setPaint(this.paint); TextBlockAnchor anchor = null; float x = 0.0f; HorizontalAlignment horizontalAlignment = getHorizontalAlign...
a0a296c8-07eb-4c09-aa0b-903bd9049f57
0
public LocalFileSystemFileProtocol() {}
c69f1a56-4986-4895-b502-6e61199b06de
1
protected String getName() { return name == null ? getClass().getSimpleName() : name; }
ab158a66-589b-4858-9252-11e4571e7b01
7
private void checkSettings() { // Check Region Size Integer regionSize = (Integer)regionSizeComboBox.getSelectedItem(); if(regionSize == null || regionSize == 0){ setError("Region Size cannot be null or zero!"); } // Build topology String[] intStrings = topologyField.getText().split("[, ]"); int[] i...
3d12c2a7-2218-41a6-b540-9d22050d883a
9
@Override public void keyPressed(Keys key) { switch (key) { case KEY_LEFT: player.getVelocity().x = -1; break; case KEY_RIGHT: player.getVelocity().x = 1; break; case KEY_UP: player.getVelocity().y = -1; break; case KEY_DOWN: player.getVelocity().y = 1; break; case K...
b4b3fde1-c041-47b7-8228-9a8200cbf4c8
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer) value).intValue() + 1); } else if (value instanceof Long) { ...
70151256-f233-46d8-b0e7-4fc18339ec94
7
private static String removeTenantRoot(String tenantRoot, String path) { if (tenantRoot != null && tenantRoot.length() > 1 && path != null && path.startsWith(tenantRoot) && !path.startsWith(PUBLIC_ROOT)) { path = path.substring(tenantRoot.length()); if (path == null || path.isEmpty()) { path = "/"; } }...
251e8869-47dd-4747-a090-85729a5e3e46
2
public Vector2 calculate() { if(behaviors.size() == 0) return new Vector2(0f, 0f); steeringForce = new Vector2(0f, 0f); for(IBehavior b : behaviors) { steeringForce.add(b.calculate(target)); } steeringForce = steeringForce.divideBy(behaviors.size()); //average return steeringForce; }
3f1ca4b2-b215-4ba3-9972-01f40b7ff2f5
8
public static Image getRightImage(int number) { if (number == 1) { return around; } else if (number == 2) { return unknown; } else if (number == 3) { return free; } else if (number == 4) { return nxt; } else if (number == 5) { return arrow_right; } else if (number == 6) { return arrow_dow...
1886a197-ab14-43de-a2a2-678ff15132e0
6
private void parseInputToMaze(ArrayList<String> temp) { for (int y = 0; y < temp.size(); y++) { String line = temp.get(y); for (int x = 0; x < line.length(); x++) { if (line.substring(x, x + 1).equals("E")) { maze[y][x] = new MazeField(MazeField.FieldType.EMPTY); } else if (line.substring(x, x + 1)...
ff91529d-2a52-4ff0-a8cb-28bfb93d2501
9
public static void main(String[] args) throws IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException { // 日,一,二,三,四,五,六 String[] strCal = new String[42]; String[] destCal = new String[35]; // 只需要保存第一行的Calendar对象就可以了。 Calendar[] calArr = new Calendar[7]; Calendar ca...
97f4a5ed-1a21-4065-8978-cd4f05153052
3
public double[] do200baudFSKHalfSymbolBinRequest (CircularDataBuffer circBuf,int start,int bin0,int bin1) { double vals[]=new double[2]; // Get the data from the circular buffer double samData[]=circBuf.extractDataDouble(start,20); double datar[]=new double[FFT_64_SIZE]; // Run the data through a Blackman win...
969cde7e-73b3-4f18-9a2d-9dc07e925cb0
8
private void tuRevertSame(final Character[] orig, final Character[] dest) { final TreeMap<Character,Character> origMap = new TreeMap<Character,Character>(); final TreeMap<Character,Character> destMap = new TreeMap<Character,Character>(); for (int i = 0; i < orig.length || i < dest.length;...
a1725ac6-b989-42ec-86d9-51bd53654d2a
2
public void showSide(boolean showSideB) { showingSideB = showSideB; colorBar.setBackground(showingSideB ? colorB : colorA); String text = showingSideB ? sideB : sideA; contentLabel.setText(text); contentLabel.setFont(findBestFontSize(FONT, text)); }
803c7c1d-875d-4d9d-803a-3012d87bd8cf
6
static String urlize(String s, int length) { char[] charArray = s.toCharArray(); int start_strip = 0; for (int i = 0; i<s.length(); i++) { if (charArray[i] == ' ') { start_strip += 1; } else { break; } } int spa...
70606c6f-5994-405f-b3a6-96c6261037fc
3
private Group readGroup(Class<? extends Group> type, List<ParsedParameter> params) { try { Group group = type.newInstance(); for (ParsedParameter param : params) { Field field = param.getParameter().getProperty(Properties.FIELD_HOLDER); ...
ec55eb11-c718-4835-b627-11f549b20535
1
void writeClassfile(String classname, OutputStream out) throws NotFoundException, IOException, CannotCompileException { InputStream fin = openClassfile(classname); if (fin == null) throw new NotFoundException(classname); try { copyStream(fin, out); } ...
9649cac6-f880-47e8-8837-daf5d8a9965e
3
private boolean isTargetKeyword(Token cur) { if (!cur.isKeyword()) return false; for (Keyword target: targetKeywords) { if (target.equals(cur.getKeyword())) return true; } return false; }
2dddb070-c161-42c2-8e07-72fb86bd6601
7
@Override public String getTypeDescription(File f) { String extension = Utils.getExtension(f); String type = null; if (extension != null) { if (extension.equals(Utils.jpeg) || extension.equals(Utils.jpg)) { type = "JPEG Image"; } else ...
171905b8-d466-45c4-a30e-9fc0e9d2b230
3
void iniciarJuego() { snake.inicializar(); while (!gameOver) { try { while (pausa) { Thread.sleep(10); } Thread.sleep(150); } catch (InterruptedException ex) { } snake.mover(); ...
dd8d2666-db40-4d7f-8cab-7e6098eab974
9
private Object optimizeFieldMethodProperty(Object ctx, String property, Class<?> cls, Member member) throws IllegalAccessException { Object o = ((Field) member).get(ctx); if (((member.getModifiers() & STATIC) != 0)) { // Check if the static field reference is a constant and a primitive. i...
9c669587-337f-40d2-91fc-e5c182c87daa
2
private void updateRowColumnSizes(FlexGridData data) { if (data.mRowSpan == 1) { updateSizes(data.mRow, data.mSize.height, mRowHeights, data.mMinSize.height, mMinRowHeights, data.mMaxSize.height, mMaxRowHeights); } if (data.mColumnSpan == 1) { updateSizes(data.mColumn, data.mSize.width, mColumnWidths, data....
1037899d-563f-4057-83aa-ea9448e64056
2
private Sentence splitSentenceByWordsAndPunctuation(String sourceString) { ResourceBundle bundle; bundle = ResourceBundle.getBundle(ApplicationValue.BUNDLE_LOCATION); Pattern wordPattern = Pattern.compile(bundle.getString(ApplicationValue.WORD_PUNCUATION)); Matcher wordMatcher = wordPatt...
1764f48b-576f-4a86-b30d-6642f32bbad6
2
private InfoNode SplitLeaf(String key, Integer value, Node node) { node.add(key, value); LeafNode sibling = new LeafNode(); int mid = (node.getSize()+1)/2; int loopTo = node.getSize(); for(int i = mid; i < loopTo;i++){ sibling.add(node.getKey(i), node.getValue(i)); } for(int i = mid; i < loopTo;i++){ ...
2bb577de-7bdd-4b9f-ba6a-74de50788040
7
private void refreshRecursively(Object comp, boolean forceRefresh) { if (comp instanceof YIComponent) { YController controller = YUIToolkit.getController((YIComponent) comp); if (controller != null) { if (forceRefresh || (controller.getRefreshHelper()...
86d38ab6-c237-401f-846b-71f3f68ff796
3
public void draw(Graphics2D g2,int xOffset, int yOffset){ g2.setColor(Color.blue); if(skin==1){ g2.drawImage(Tile.zombie1[dire][timeVar],getX_Point()-xOffset, getY_Point()+yOffset,null); }else if (skin==2){ g2.drawImage(Tile.zombie2[dire][timeVar],getX_Point()-xOffset, getY_Point()+yOffset,null); }else if...
57e4d4c7-f9ae-4176-bf78-74149c683abe
6
public EndDisplay(Game game) { boolean test = false; if (test || m_test) { System.out.println("EndDisplay :: EndDisplay() BEGIN"); } final int YESGRIDX = 0; final int YESGRIDY = 0; final int YESPADY = 0; final double STATP1WEIGHTX = 0.5; ...
761cca1d-c702-4e7a-8465-765a7ce5e734
2
@Override public int compareTo(Product o) { int res = 0; if (o.getProductCode()>this.getProductCode()) { res = 1; } if (o.getProductCode()<this.getProductCode()) { res=-1; } return res; }
6e259271-be5d-4d89-a207-abbb3ff2b96d
1
private void jButtonCommandeClientEntrepriseMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButtonCommandeClientEntrepriseMousePressed if (!(jTextFieldCmdDate.getText().trim().isEmpty()) ) { Entreprise entreprise = (Entreprise) this.jComboBoxCommandeClientEntrepri...
748c3f4a-f193-400d-9529-f2c81c6e622d
8
String anonymizeString(String input,String nameToBeAnonymized) { //extract name terms String nameTerms[] = nameToBeAnonymized.split(" "); String textTerms[] = input.split(" "); String output = null; //go through input, replace name term sequences with substitute boolean lastTermWasName = false; for(int ...
833727b8-3492-4628-94b6-241a62cc77fe
2
public String toString() { String x = ""; if (handlers != null) { for (int i = 0; i < handlers.length; i++) { x += "\n " + handlers[i]; } } /* * for (int i = 0; i < attrs.length; i++) { x += "\n " + attrs[i]; } */ return "(code " + maxStack + " " + maxLocals + " " + code.length + x ...
f458fd63-deb7-4fa9-8058-c8eb011ef5e7
7
public Copyable getVersion(Transaction me, ContentionManager manager) { while (true) { if (me != null && me.getStatus() == Status.ABORTED) { throw new AbortedException(); } switch (writer.getStatus()) { case ACTIVE: if (manager == null) { throw new PanicExcept...
46507559-08c2-4505-8e7a-13585689ae21
4
public void loadFile() { JFileChooser chooser = new JFileChooser(executableDir); FileNameExtensionFilter filter = new FileNameExtensionFilter( "Pippin Executable Files", "pexe"); chooser.setFileFilter(filter); // CODE TO LOAD DESIRED FILE int openOK = chooser.show...
0a9706b6-170a-4d37-8b2b-4c64ffc04c51
5
public boolean getSimplicityofPN() throws BadLocationException { dialog.addMessageToLogger("Checking simplicity of a PN", 1); boolean simplicity = true; for (Arc a : getPn().getListOfArcs()) { if (!(a.getOutElement() instanceof Resource) && !(a.getInElement() instanceof Resource) && ...
1336d261-43ae-4342-9fa4-3b7be5ac5575
5
public void solve() throws SolvingInitialisiationException, WrongOptimisationOrderException{ if (possibleDecisions.isEmpty()) throw new SolvingInitialisiationException("DP decisions have not been initialized in "+this); Iterator<DPLotSizingDecision> it = possibleDecisions.iterator(); //Start of with the fir...
099fb30d-86ad-402e-ae4d-c792687e2117
4
@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...
319cd57d-e0d8-469f-bbf5-6e7bc8f1c3a1
4
public void extractConfig(final String resource, final boolean replace) { final File config = new File(this.getDataFolder(), resource); if (config.exists() && !replace) return; this.getLogger().log(Level.FINE, "Extracting configuration file {1} {0} as {2}", new Object[] { resource, CustomPlugin...
03aab52a-9918-4f05-9eb1-2c53075c5b71
9
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...
6e2e2e81-015b-4d24-a7f5-bdc8da55fd33
3
public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k= in.nextInt(); int q= in.nextInt(); i...
fdb3dcb7-29af-40d0-ad3d-661458ecc637
0
public long getIdConnection() { return idConnection; }
0be84ae8-a6ac-4a13-b656-dcf450002e30
1
public Class<? extends Command> getCls() { return cls; }
4db0221e-9e77-4f01-93f2-bbe8e5a6a399
8
public void testConstructor_int_int_int_int_Chronology() throws Throwable { LocalTime test = new LocalTime(10, 20, 30, 40, JULIAN_LONDON); assertEquals(JULIAN_UTC, test.getChronology()); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals...
68e9a94c-fe8c-4971-b0f6-f68596c61f27
3
public void run() { //Guarda el tiempo actual del sistema tiempoActual = System.currentTimeMillis(); //Ciclo principal del JFrame. Actualiza y despliega en pantalla hasta que se acaben las vidas while (vidas > 0) { //si esta pausado no actualizas ni checas colision ...
db8b39f1-fde3-4c7c-9c76-2bd0152d74c4
4
public int getxattrsize(ByteBuffer path, ByteBuffer name, FuseSizeSetter sizeSetter) { if (xattrSupport == null) { return handleErrno(Errno.ENOTSUPP); } String pathStr = cs.decode(path).toString(); String nameStr = cs.decode(name).toString(); if (log != null && log....
6c2819ee-a030-4b03-a297-d581db43c2c3
1
public void suljeLohko() throws IllegalStateException { this.nykyinenLohko().paataLohko(); if (!this.eiAvoimiaLohkoja()) { lohkot.remove(lohkot.size() - 1); } }
d0c5499d-ea9a-4825-ae67-2b6897ead184
1
public void appendModifier(String type, String value) { for(TextSegment s : segments) { s.modifier.addModifier(type, value); } }
b72c80f5-72c5-42e9-8adf-db1e0dc92ea8
8
public void setComputerBoard() { int boardIter = shipSize; if (shipSize == 1) { boardIter = 3; } // System.out.println("BoardIter:" + boardIter); if (horizontal == false) { int yCoor = ship.getY(); while (boardIter > 0) { computerBoard[ship.getX()][yCoor] = shipSize; boardIter--; yCoor++...
e9544e99-3c06-451b-b63c-861ed2124045
8
private ArrayList<Method> getAnnotatedMethodsRecursively(Class<?> klass) { if (klass == null || klass.equals(Class.class)) { annotatedMethodsByClass.put(klass, null); return null; } if (annotatedMethodsByClass.containsKey(klass)) { return annotatedMethodsByClass.get(klass); } ArrayList<Method> result...
62a3d89f-27ff-42ca-b5ff-7bb2c9b8b44f
0
public Blog getBlogDetail(long pBlogId){ return blogModelBS.getBlogDetail(pBlogId); }
26b9a831-eb9c-4ce2-ac13-e65a28dc37d4
2
public static void main(String[] args) throws IOException, ClassNotFoundException { URLClassLoader urlClassLoader=new URLClassLoader(new URL[]{new URL("file:/tmp/")}); urlClassLoader.loadClass("Bulbs"); File file=new File("/tmp"); file.toURI().toURL(); FileChannel fcin=new Fil...
90d2191c-a515-4966-80e4-e35de4e0a0ab
3
public static <T extends DC> Set<Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>>> despatch(Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>> pair, Set<Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>>> sets) { if(pair==null) ...
35a8f104-7fdc-4b7c-9734-dfcdfcb6c87e
1
public String toString() { StringBuilder s = new StringBuilder(); for (Item item : this) s.append(item + " "); return s.toString(); }
9fa95ffd-28e7-44e2-b644-9dd103c91478
6
public static String firstName(byte fn, byte ln, boolean gender) { int[] N = {Calc.squeezeByte(fn, 0, SYL1.length),Calc.squeezeByte(ln, 0, SYL2.length)}; String p1 = SYL1[N[0]], p2 = SYL2[N[1]].get(gender); String suffix = ""; if (gender == Misc.FEMALE) { switch ((fn * ln) % 3) { case 0: suffix += "a"...
63502cf5-c14b-4983-9f45-1f9b5cec2d43
0
protected void onMessage(String channel, String sender, String login, String hostname, String message) {}
d853e6c3-ba0b-42b2-bd4f-c49780e0eb16
7
@Override public Set<T> next(){ if(!hasNext()){ throw new NoSuchElementException(); } if(current == null){ current = new TreeSet<Integer>(); } else{ if(current.size() == 0){ current.add(1); } else{ part:{{ int iterations = 0; int tempIndex = curr...
f09de4bb-df96-4746-85e7-91d07929a22d
5
public ArrayList<Flight> cancelFlightsCorrectly(String airport) { ArrayList<Flight> temp = deepCopy(flights); for (int i = temp.size() - 1; i >= 0; i--) { if (temp.get(i).getDepartureAirport().equals(airport) || temp.get(i).getArrivalAirport().equals(airport)) { /* find the flight ID which is canceled ...
18d98464-e071-49b5-8834-5588fc22f508
2
private static void expandMoveRecursivelyForBlack(Board board, Vector<Vector<Move>> outerVector, Vector<Move> innerVector, int r, int c){ Vector<Move> forcedMoves = Black.ObtainForcedMovesForBlack(r, c, board); if(forcedMoves.isEmpty()){ Vector<Move> innerCopy = (Vector<Mov...
5fd52bde-2204-4be3-8261-fa193b056f88
3
public boolean setSerialProbability(int jobType, double prob) { if(jobType > BATCH_JOBS || jobType < INTERACTIVE_JOBS) { return false; } if(useJobType_) { serialProb[jobType] = prob; } else { serialProb[INTERACTIVE_JOBS] = serialProb[BATCH_JOBS] = prob; } ret...
e75d75bc-78fe-48de-8a40-0a4f3a064b68
9
public K findKey (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { K[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != null && valueTable[i] == null) return keyTable[i]; } else if (identity) { for (int i = capacity + st...
f9bdc6ec-b6d3-40bf-b64f-73779571a0ac
4
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String codforn, codpedido, data; int qtd; codforn = txt_codforn.getText(); codpedido = txt_codpedido.getText(); da...
bf87ef1b-8817-47cb-aff7-e35c92d9b6b9
6
private void checkIfBuildable(int sizeX, int sizeY) { for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { try { if (map.getTile(mouseTileCoords.x + i, mouseTileCoords.y + j) == null || !map.getTile(mouseTileCoords.x + i,...
212ed8a2-6af5-4e85-be98-2e1863357846
1
protected void btnRemoverEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoverEmailActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja" + " Remover o item ? ","",JOptionPane.OK_CANCEL_OPTION) == 0){ this.listaEmail.remove...
7553c3b4-75bc-4e9c-8a73-9bdca6ad098f
7
private Vector[] buildHeaders(JPanel panel, ColumnSet set, boolean blankOut, Vector[] refLabels) { int numParents = set.getNumParents(); int numChildren = getNumChildren(set); Vector[] headers = new Vector[2]; headers[0] = new Vector(); for (int i=0; i<set.getNu...