method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3ba38269-8ff5-4f36-91a0-c3e04ce20b89
2
public AtlasFrame() { int pace = 2000; pendingN = ""; pendingT = null; initComponents(); permitVoteTaxes(false); permitElection(false); permitGoverning(false); permitCoup(false); permitNationName(false); permitPropose(false); per...
6d79527c-5a6d-479f-89a4-03533d1c7da3
2
public ArrayList<Location> getLocationsInDirections(int[] directions) { ArrayList<Location> locs = new ArrayList<Location>(); Grid gr = getGrid(); Location loc = getLocation(); for (int d : directions) { Location neighborLoc = loc.getAdjacentLocation(getDirec...
60e69446-b49f-4e53-819f-6f309982e9e2
7
public void comeNewCustomer( Customer newCustomer) { // ここでは異なる種類の自販機を選択肢としておきたいため、ワイルドカード指定 ImmutableList<? extends VendingMachine<?>> machineList = ImmutableList.of( // new DrinkVendingMachine( newCustomer.getIOManager()), // ReturnTicketVendingMachine.INSTANCE // )...
78fad1ca-6f01-49ef-bb0d-e8d1282e3433
3
private static void organize(Petal[] opts) { int l = 1, p = 0, i = 0; int lr = -1; for (i = 0; i < opts.length; i++) { if (lr == -1) { // lr = (int)(ph / (1 - Math.cos((2 * PI) / (ppl * l)))); lr = 75 + (50 * (l - 1)); } opts[i].ta = (PI / 2) - (p * (2 * PI / (l * ppl))); opts[i].tr = lr; i...
a64f2a06-ec72-419b-9bce-77e93fd61d26
0
public String getEmail() { return email; }
1821fe13-7d08-46fe-bebc-6f6d95db4498
7
public void animateMining(World world, Point2 targetLocation) { int currentFrame = sprite.currentFrame; switch (entity.orientation) { case NORTH: sprite.animate(36, 4, Constants.DWARF_ANIMATION_SPEED / 2); break; default: sprite.ani...
f30722d9-ed77-4f59-9953-0f5de26b6ea7
7
private void searchUser(ActionEvent e) { String userName = this.userName.getText(); String userNo = this.userNO.getText(); if(userName == null || Constants.STR_NULL.equals(userName.trim())){ userName = Constants.STR_NULL; } if(userNo == null || Constants.STR_NULL.equals(userNo.trim())){ userNo = Constan...
7dc13819-e541-4087-a1a9-71442ccdda11
8
public Tile getTile(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile; if (tiles[x + y * width] == 0xFF00FF00) return Tile.grass; if (tiles[x + y * width] == 0xFFFFFF00) return Tile.flower; if (tiles[x + y * width] == 0xFF7F7F00) return Tile.rock; if (tiles[x + y * width] =...
2871bb8e-c559-4dad-b183-6fc897f4c92e
2
private XmlParser getConfigParser() { XmlParser configParser = new XmlParser(); try { if (isValidUrl(testNgResultFileWithPath)) { configParser.loadString(getXmlStringFromUrl(testNgResultFileWithPath)); } else { configParser.loadFile(testNgResultFi...
df10c645-5841-44fc-a2b9-68b6294ad5cc
8
private void setPreviousEntryText() { String text = ""; if (currentPreviousEntry < previousEntries.size() && currentPreviousEntry >= 0) text = previousEntries.get(currentPreviousEntry); if (useInlineInput) { if (inputControl.isReceivingInput() && inputCon...
88b4da6f-5ae5-484c-9b0c-8e0cbca9973e
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TransactionType that = (TransactionType) o; if (amount != that.amount) return false; if (date != null ? !date.equals(that.date) : that.date != ...
715c2ac1-a744-4f2c-a64b-6d363b0f9fd8
7
@Override public void run() { while (!shell.isDisposed() && Uiswt.getInstance().isBusiness) { try { Thread.sleep(1000); Random random = new Random(); int t1 = Math.abs(random.nextInt() % 20); if (t1 < 5 && t1 > 0) { if (Menu.getInstance().getAvailableDishs().size() > 0) { Customer cust...
9153f1bf-b65d-43d0-87f9-e9d73dab9cdf
2
public void stringTokenizerMethod() { StringTokenizer st = new StringTokenizer(orgStr, ";"); System.out.println("-----------------StringTokenizer--------------"); long startDate = System.currentTimeMillis(); for (int i = 0; i < 10000; i++) { while (st.hasMoreTokens()) { st.nextToken(); } st = new S...
635bc37e-6844-43c5-ac25-f24638638693
6
public ThreeD negate() { switch (this) { case Zpos: return Zneg; case Zneg: return Zpos; case Ypos: return Yneg; case Yneg: return Ypos; case Xpos: return Xneg; ...
10af8ca8-461e-4a48-a10b-b75dd2a205ea
2
private void titleTextFieldCaretUpdate(javax.swing.event.CaretEvent evt)//GEN-FIRST:event_titleTextFieldCaretUpdate {//GEN-HEADEREND:event_titleTextFieldCaretUpdate if (button.getText().equals(titleTextField.getText()) && customSearchTextField.getText().isEmpty()) return; customSearchTextField.setText(t...
e5949706-dd64-4462-a750-47b68d34ee1b
8
public void render(Gui gui, int x, int y, int color) { for (Option o : options) { if ((o.id >= scrol) && (o.id < scrol + ENTRIES_DISPLAYED)) { if (o.isAvailable) { FontRenderer.drawString(o.text, gui, x + 5, y + o.id * 8 - scrol * 8, color, 1); if (o.id == selectedEntry) { FontRenderer.d...
a5386b41-e873-4941-9973-b36a16656cbb
2
@Override public void update(Observable o, Object arg) { if(this.model.getCurrentPlayer() == this.player && this.model.getGameState() == GameState.DURING) { ArrayList<Piece> validMoves = this.model.getBoard() .getValidMoves(this.player.getColor()); Random r = new Random(); int ...
89a31156-e62c-4c5c-bdea-83ee95e06043
4
@Override public IEmailKontakt previous(IEmailKontakt emailKontakt) throws NoPreviousEmailKontaktFoundException { System.out.println("Display previous contact..."); Connection con = null; try { con = initDBConnection(); } catch (SQLException e) { e.printStackTrace(); } ResultSet rs = null; Prepa...
4ca86d63-ba27-4ee3-bd92-706612bb79bd
2
private static int badExample2() { int result = 2; try { npe(); return result; } catch (MyException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { //do smth return 3; } }
aedfbd0e-7af3-4ccd-8fd8-296417410c87
1
public int minY() { int m = coords[0][1]; for (int i = 0; i < 4; i++) { m = Math.min(m, coords[i][1]); } return m; }
771c63de-e8d7-4839-8fd6-4b80a3975593
9
protected String[] parseRow( ) throws SQLException { String[] newRow = new String[ COLUMN_NAMES.length ]; String nextLine = null; String oldLine = ""; while( true ) { boolean isContinuationLine = ( oldLine.length() != 0 ); ...
bc04bb6f-a51c-4a87-8e66-75372ca7b968
4
public static void transitionEffect(final JPanel from, JPanel to, final JFrame parent, boolean rightTransition) { final Animate toPanel = new Animate(to, to.getBounds(), from.getBounds(), 350); Animate fromPanel; if(rightTransition) { fromPanel = new Animate(from, from.getBounds(), new Rectangle(fro...
fd3dee48-3d74-4b64-bcfd-f9abe39d1edf
0
public AlgorithmParametersType.ResponseFormat createAlgorithmParametersTypeResponseFormat() { return new AlgorithmParametersType.ResponseFormat(); }
87ebb904-ea03-4a05-9ffd-8db0cd2969f9
1
public void debug(Object... objs) { if (LoggingLevel.DEBUG.value >= currentGlobalLoggingLevel.value) { logger.debug(Helpers.concat(objs)); } }
19878b08-1a58-49b4-9b80-c1c0e6990893
1
public void testIsEqual_MD() { MonthDay test1 = new MonthDay(6, 6); MonthDay test1a = new MonthDay(6, 6); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.isEqual(test...
57414128-ef7e-482f-a5d6-412db050d0e1
1
public void testWithFieldAdded_nullField_zero() { YearMonth test = new YearMonth(2004, 6); try { test.withFieldAdded(null, 0); fail(); } catch (IllegalArgumentException ex) {} }
2923fb23-ae22-461c-a64c-8575b9336391
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...
4ebeb25a-a8f8-479f-887c-0bbf9b8db26e
5
public void main(String playerName, String dirName) { File dir = new File(plugin.minecraft_folder); File srcFolder = new File(dir + dirName); File destFolder = new File(dir + dirName + playerName); //make sure source exists and destination not exists if (!destFolder.exists()){ if(!srcFo...
3dd1798c-6a84-4d53-87ba-891e3ee1b846
0
public void setNotes(String notes) { this.note = notes; setDirty(); }
c9e78b6d-9702-4ff4-8db9-8acb67156fd6
5
public static Map<String, String> getProjectInfos(String file) { File f = new File(file); if (f.exists()) { Map<String, String> prjMap = new HashMap<String, String>(); try { BufferedReader reader = new BufferedReader(new FileReader(f)); String line...
d82564f2-eef4-43e6-847f-e6f057fb045c
9
public void endElement(String uri, String name, String qName) { /* * if ("".equals(uri)) System.out.println("End element: " + qName); else * System.out.println("End element: {" + uri + "}" + name); */ if ("Placemark".equals(name)) { //System.out.p...
09a5ef62-4459-41a3-8df5-878f1da828b3
5
@SuppressWarnings("unchecked") public void delete(T node, Database db, ConsistentHashTest cht){ Long presentServer; for(int i = 0; i < noOfVirtualNodes; ++i){ presentServer = hashFunction.getHash(node.toString()+i); Long previousLink = ((TreeMap<Long, T>) circle).lowerKey(presentServer); Long nextL...
35425aee-42b1-4a06-acda-70b6bc11beb9
1
protected void mockFindGap(Hours... args) { Stubber stubber = doReturn(args[0].getValue()); for (int i = 1; i < args.length; i++) { stubber = stubber.doReturn(args[i].getValue()); } stubber.when(intervals).findGap(any(Interval.class), any(Duration.class)); }
d7f9e1e2-87ba-4ca7-af86-8e845e64d99c
1
public List<HttpMessageConverter<?>> getMessageConverters() { return messageConverters; }
fde409a0-cc8e-4817-90f6-7bbcdc28bd48
1
@Override public void startDocument () { this.currentParent = tree.getRootNode(); // Clear out any existing children. while (currentParent.numOfChildren() > 0) { currentParent.removeChild(currentParent.getLastChild()); } }
41c275ee-fa20-4752-b871-95de59c30bd5
9
public PannelloGestioneGruppi_old(final PannelloConfigurazione pc) throws IOException{ this.pc = pc; Point point = pc.getLocation(); setLocation(point.x+pc.getSize().width, point.y); setTitle("Gestione Gruppi"); setSize(300, 300); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLayout(new GridLayout(...
598b2e42-556d-4ba6-82dc-d1cef3a72549
3
private void parseLookupData(String key, String value) { LookupData lookupData = tgm.getLookupData(); switch(key) { case "Version": lookupData.version = value; break; case "Checksum": lookupData.checksum = Integer.valueOf(value); break; case "Bin": lookupData.bins.add(value); } }
12208cc2-347c-45f2-9b7e-e37a1fc8923e
0
public AssignCoordinatesTest() { }
2e962b63-fb4d-4c9d-bad0-730df1070d53
1
public UsernameSelector(UsernameSelectorReceiver _callback) { setDefaultCloseOperation(EXIT_ON_CLOSE); callback = _callback; setLayout(new GridLayout(2,1)); JPanel topPanel = new JPanel(); topPanel.setLayout(new GridLayout(1,2)); topPanel.add(new JLabel("Username:")); topPanel.add(username); ...
1361baad-c083-4538-ae82-91be80779206
4
public static String removeDuplicates(String string) { if (string == null) { return null; } /* empty string */ if (string.length() == 0) { return ""; } if (string.length() == 1) { return string; } if (string.charAt(0) == string.charAt(1)) { return removeDuplicates(string.substring(1)); } ...
cf43e332-4506-4f68-a4f3-8c0f5b4658d2
9
public void run() { try { int t = 0; while (true) { os.write(1); List<String> lst = (List<String>) ois.readObject(); for (int i = 0; i < lst.size(); i++) { a[i] = Integer.valueOf(lst.get(i)); } // log.info("Server connected"); gui.setCb(a, "Сервер подключен"); t++; TimeUni...
21160917-dcdd-4c67-8fa0-4315c60afaad
9
void compress(int init_bits, OutputStream outs) throws IOException { int fcode; int i /* = 0 */; int c; int ent; int disp; int hsize_reg; int hshift; // Set up the globals: g_init_bits - initial number of bits g_init_bits = init_bits; // Set up the necessary values clear_flg = false; n_bits =...
88c8e58c-818f-4774-b5a9-c100efd963ef
9
public boolean containsExcludeResultPrefix(String prefix, String uri) { if (uri == null || (null == m_excludeResultPrefixes && null == m_ExtensionElementURIs) ) return super.containsExcludeResultPrefix(prefix, uri); if (prefix.length() == 0) prefix...
028f1922-4c2e-40e1-94a5-f5e97c0033fc
3
@Override public final boolean execute(CommandInvocation invocation) { try { this.checkInvocation(invocation); if (!invocation.isConsumed()) { CommandBase command = this.getCommand(invocation.currentToken()); if (command != null...
e4a260d4-ca3d-409b-a98c-8b6486b68710
2
@Override public synchronized String getResult() { while(!isRead){ try{ wait(); }catch(InterruptedException e){ e.printStackTrace(); } } return realdata.result; }
1432d177-6a6a-4643-b7be-22c2349426e2
9
@Override public void updateLot(List<String> optPlayerList) { if(affected instanceof Room) { lastItemNums=updateLotWithThisData((Room)affected,this,false,scheduleReset,optPlayerList,lastItemNums); if((lastDayDone!=((Room)affected).getArea().getTimeObj().getDayOfMonth()) &&(CMProps.getBoolVar(CMProps.Bool...
bcae0446-6fcf-436e-9eb4-b18ea8470f1f
6
static final void method3177(int i, boolean bool) { if (!bool || Class75.aClass348_Sub42_Sub14_1243 == null) Class239_Sub13.anInt5976 = -1; else Class239_Sub13.anInt5976 = (((Class348_Sub42_Sub14) Class75.aClass348_Sub42_Sub14_1243) .anInt9628); anInt9500++; Class75.aClass348_Sub42_Sub14_1243 = nul...
e7c44f38-d996-47d5-b05e-bd69916add08
1
public static void LogResult(String Step, String TestName, String Status, String StartTime, String EndTime) { FileWriter fstream =null; BufferedWriter out =null; try { fstream = new FileWriter(filename, true); out = new BufferedWriter(fstream); out.write("<table border=1 cellspacing=1 cellpa...
2665bce2-dfcf-4646-82e2-979c1d5a472d
2
public static Header findHeader(String value) { // The list is short for now, so don't need anything fancy at this point. for (Header header : Header.values()) { if (header.getHeader().equalsIgnoreCase(value)) { return header; } } ...
6c37857f-6650-48e7-98fa-ad60902329c7
5
private int handleString(LexicalAnalyser analyser, int beginIndex) throws AnalyseException { String content = analyser.getSentence(); for (int index = beginIndex + 1; index < content.length(); index++) { char c = content.charAt(index); if (c == '\'') { int endIndex = index; if (index != content.len...
eed30224-e5d3-4c02-81fc-83942dfca193
8
private static int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset, int options) { // Lots of error checking and exception throwing if (source == null) { throw new NullPointerException("Source array was null."); } if (destination == null) { throw new NullPointerException("Desti...
1dc6e2cd-9807-45f2-941d-c32c53e41624
1
public void setLoadingStatusFontsize(int fontsize) { if (fontsize <= 0) { this.loadingFontSize = UIFontInits.LOADINGSTATUS.getSize(); } else { this.loadingFontSize = fontsize; } somethingChanged(); }
0e0c0212-5560-4ed3-8745-ce598d56e154
2
public boolean isAdjacentToAnyPiece(PieceCoordinate coordinate) { Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator(); PieceCoordinate next; while(pieces.hasNext()) { Entry<PieceCoordinate, HantoPiece> entry = pieces.next(); next = entry.getKey(); if (next.isAdjacentTo(co...
96457063-a983-4a0d-866d-706b12909dd5
7
public ArrayList<Employee> searchEmployee(String firstname, String familyname) { String newFirstname = firstname.toLowerCase(); String newFamilyname = familyname.toLowerCase(); ArrayList<Employee> result = new ArrayList<Employee>(); for (Employee tmpEmployee : employees.values()) { ...
242fdd1f-7c8a-445f-babc-b49b1392d2a9
0
@Override public void setName(String name) { super.setName(name); }
6b98c256-119b-4961-a0de-81ba94f71aed
2
public static void seen(int index) { try { if(seen[index] == false) { seen[index] = true; totalSeen++; } } catch(Exception e){e.printStackTrace();} }
133de473-d254-4d95-a80e-44ae8bf9144d
6
public void visitStackManipStmt(final StackManipStmt stmt) { print("("); final StackExpr[] target = stmt.target(); if (target != null) { for (int i = 0; i < target.length; i++) { target[i].visit(this); if (i != target.length - 1) { print(", "); } } } final String[] str = new String[]...
10386998-3369-4cd7-8916-edf46a0ff1a9
8
static void trianguloPascal( ){ pascal = new BigInteger[101][102]; for (int i = 0; i < pascal.length; i++) Arrays.fill(pascal[i], BigInteger.valueOf(-1)); for (int i = 0; i < pascal.length; i++) { boolean termine = false; for (int j = 0; j < pascal[0].length && !termine; j++) { if(j==0) pascal...
df77bb76-065d-4ce9-a0ae-f5eff7aa497d
3
public void draw(Graphics2D g) { bg.draw(g); tileMap.draw(g); player.draw(g); for (int i = 0; i < enemys.size(); i++) ((Enemy) enemys.get(i)).draw(g); teleport.draw(g); for (int i = 0; i < explosions.size(); i++) { ((Explosion) explosions.get(i)).setMapPosition((int) tileMap.getx(), (int) tileMap.gety...
584abfae-772f-423e-90dd-2ee1617c44a6
6
private void redistributeElevations(ArrayList<Corner> landCorners) { Collections.sort(landCorners, new Comparator<Corner>() { @Override public int compare(Corner o1, Corner o2) { if (o1.elevation > o2.elevation) { return 1; } else if (o...
708947b1-68e0-4186-9b9e-dd775d67291d
5
* @Post: No changes * @Return: Whether or not all attackingEnemies can be killed next turn */ private boolean canKillAllAttackingEnemies(ArrayList<Piece> piecesAttackingKing) { if(piecesAttackingKing.size()>1) { return false;//can't kill two different pieces in one turn } ArrayList<Piece> myPieces=myBo...
342f8889-d7c4-4a1c-a738-fa33108ccb2f
8
public static void main(String args[]){ try{ BufferedReader br=new BufferedReader(new FileReader("OutputRt.txt")); String ln=null; Writer wt0=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File("Rt0Data")))); Writer wt1=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new...
175d538e-088f-4afa-be16-76ca6527a0ab
7
@Override public void setObject(Object obj) { if(obj != null && obj instanceof BancaExaminadora){ this.banca = (BancaExaminadora)obj; this.lblTituloValor.setText( (banca.getDissertacao() != null ? banca.getDissertacao().getTitulo() : "")); ...
f72be570-1022-4e0e-b782-5b67dd5281af
1
public static void main(String args[]){ SLinkedList s=new SLinkedList(); Node n=new Node("first"); Node n2=new Node("second"); s.add(n); s.add(n2); for(int c=0;c<s.getSize();c++){ System.out.println(s.next); } }
6dc548db-82e6-4f89-a74f-0458f8097752
1
public boolean isPressed() { if(isDisabled()) return false; return pressed; }
1f5fef8b-d942-4241-8b92-1411a312f428
2
public void setNome(String nome) throws Exception { if((nome.length()>3) && (nome.length()<250 )) { this.nome = nome; } else { throw new Exception("Não podem haver nomes com menos de 3 letras e mais do que 250 letras"); } }
ade73d42-55d2-4d64-bf2f-7ac47e3ebd88
5
private void radixSort0(int[] a, int i, int low, int high) { if (i < 0) return; Queue[] registers = new Queue[RADIX]; for (int n = 0; n < registers.length; n++) { registers[n] = new LinkedList<Integer>(); } for (int j = low; j < high; j+...
cc909fd3-486c-40eb-8ad4-c22f20610bb9
6
public static int getIndentationLevel(String wikiString) { int characterPosition = wikiString.indexOf('*'); //if (characterPosition < 3) return 0; for (int i=0; i<validPositions.length; i++) { if (characterPosition==validPositions[i]) { if (noCharactersPrecedeItemCharacter(wikiStri...
bd2a449e-d994-45b1-bcea-7415cc0572f4
9
private Map<List<String>, Set<Integer>> BuildWordMatches(String[] hyp, String[] ref) { Set<String> hwhash = new HashSet<String>(); for (int i = 0; i < hyp.length; i++) { hwhash.add(hyp[i]); } boolean[] cor = new boolean[ref.length]; for (int i = 0; i < ref.length; i++) ...
e7063e1c-e7ba-48d1-a891-4b59ceb582a4
1
private InferenceParameterDescriptions getDefaultInferenceParameterDescriptions() { if (defaultInferenceParameterDescriptions == null) { initializeDefaultInferenceParameterDescriptions(); } return defaultInferenceParameterDescriptions; }
bb07330e-e41a-426e-8b3c-454c49a9409c
9
public static BufferedImage getImage(String url,String refer,EventCallback callback){ BufferedImage image = null; HttpURLConnection conn = null; InputStream is = null; try { URL serverUrl = new URL(url); conn = (HttpURLConnection) serverUrl.openConnection(); ...
67957faa-81c0-4705-bfe2-ff9de9122b0a
6
public static void main (String argv []) { Bus busses [] = null; Host host; try { // FIXME: option flag for rmi (iiop?) host:port spec. host = HostFactory.getHost (); if (host == null) { System.err.println ("USB is unavailable, can't run."); return; } System.out.println ("<!--...
ea379d26-c4b3-4d9e-aa28-c4030a5f6a5c
8
public int regArmy(String name, List<UnitAndPlace> units) throws WarAlreadyFinishedException, WarAlreadyStartedException, InvalidUnitNameException, PlaceNotFreeToPlaceUnitException, UnitCoordinatesOutsideMatrixException { if (status == Status.FIGHTING) throw new WarAlreadyStartedException(warID); if (status == Stat...
90f7e0f0-520f-4e59-a9f4-7e7bea6b9aa5
1
public void poistaTuote(int id) throws DAOPoikkeus, SQLException { // avataan yhteys Connection yhteys = avaaYhteys(); // alustetaan kyselyt String poistaPizza ="DELETE FROM Tuote WHERE tuoteID=?"; String poistaTayte ="DELETE FROM TuotteenTayte WHERE tuoteID=?"; PreparedStatement lause; ResultSet po...
52c10f8d-9121-40be-ad22-5d5da2f247fe
2
public static void main(String[] args) throws IOException { int n = in.nextInt(); HeapList<Integer> heap = new HeapList<>(n); for (int i = 0 ; i < n; i++){ String cmd = in.next(); if ("Insert".equals(cmd)){ heap.insert(in.nextInt()); } else { ...
a29a7ca8-0f91-4205-84e6-7f67649f8e9c
6
public int getMin(int start, int end){ if(this.start == start && this.end== end) return minVal; int mid = (this.start+this.end)/2; if(mid>=start && mid>=end) return left.getMin(start, end); if(mid<start && mid<end) return right.getMin(start, end); return Math.min(left.getMin(start, mid), right.getMin(mid...
493b451e-3fd3-40d7-ac38-6a0f3163e1ab
3
@Override public void render(Graphics g) { g.setColor(new Color(0, 0, 0, 128)); g.fillRect(0, 0, this.width, this.height); g.setColor(new Color(198, 23, 35)); g.setFont(new Font("SansSerif", Font.BOLD, 50)); RenderingHelper.drawCenteredString(g, this.width/2, this.height/2 - 100, "Present Delivery"); g....
fe750099-f067-400d-ba82-2dabb8a4cf1b
8
public int getGridY(int x, int y) { Insets myInsets = getInsets(); int x1 = myInsets.left; int y1 = myInsets.top; x = x - x1 - GRID_X; y = y - y1 - GRID_Y; if (x < 0) { //To the left of the grid return -1; } else if (y < 0) { //Above the grid return -1; } else if ((x % (INNER_CELL_...
d78d6ba7-7c5b-4ced-8331-169c5605b2c6
1
private static Color a2col(String[] args) { int r = Integer.parseInt(args[0]); int g = Integer.parseInt(args[1]); int b = Integer.parseInt(args[2]); int a = 255; if(args.length > 3) a = Integer.parseInt(args[3]); return(new Color(r, g, b, a)); }
ff3a02d8-1c62-4b86-9fe3-9107f842da9b
3
public BossLvlReader(String str){ Properties prop= new Properties(); String str2 = "/res/"+str; try{ InputStream in = getClass().getResourceAsStream(str2); prop.load(in); Level.maxCoffee =Integer.parseInt(prop.getProperty("maxCoffee")); String stri[] = prop.getProperty("wall").replaceAll("\\s+"...
ba90aaaa-fadc-4be5-88f5-feed15691e7b
5
protected LIElement createTagLIElement(final EventListener listener, int eventBits) { // create list item final LIElement listItem = Document.get().createLIElement(); listItem.setClassName("input-tag-list-item"); listItem.setTabIndex(0); // Set event listeners DOM.setEven...
f480a79d-a828-4a0d-9973-f4bb971eb905
2
@Override public void execute() { switch (Settings.location.getLocation()) { case 1: Constants.VARROCK_WEST_WALK_BEAR_FUR_SELLER.traverse(); break; case 2: Constants.VARROCK_EAST_WALK_BEAR_FUR_SELLER.traverse(); break; default: System.out.println("Something's wrong."); break; } }
523685e4-c075-43fd-bd0b-730ea87f4809
1
public void update(GameContainer c, StateBasedGame s, int d) throws SlickException { GameScreen.time += d; Damagochi.damaThink(c, s, d); // add event stack? i guess? if (Damagochi.festival_time < GameScreen.time) { // heuhuehueu } // TODO if damagochi is dead, go to gameover and calc the score. // TO...
e65461b9-98a8-46c8-a066-8707a8134dfe
9
public boolean isLocalExempt(MOB target) { if(target==null) return false; final Room R=target.location(); if((!canBeUninvoked()) &&(!isABomb()) &&(R!=null)) { if((CMLib.law().getLandTitle(R)!=null) &&(CMLib.law().doesHavePriviledgesHere(target,R))) return true; if((target.isMonster()) &...
36538579-e59c-4867-8614-e17490a31028
1
public ClientCliImpl(Config config, Shell shell) { //System.out.println("Starting client"); this.config = config; this.shell = shell; readConfig(); readMCConfig(); this.shell.register(this); shellThread = new Thread(this.shell); shellThread.start(); try { UnicastRemoteObject.exportObject(this, 0); ...
50a0d283-7368-40ec-b778-a1e4c711e9ac
7
private void startSimulation() { // Once both simulator and presenter start, control flow depends on the // Initiative setting, which both classes have, so they must each be implemented // consistently with that. When the presenter or simulator are not launched in a // separate thread, i...
ecf52973-cf86-4424-89ae-521d1d475cb5
0
public void construct(){ builder = new ConcreteBuilder(); builder.buildPart1(); builder.buildPart2(); builder.retrieveResult(); }
32e69c09-e82a-488e-b733-cc2ecd4637df
4
public static int getGreatesProdUpRightDiagonal(int[][] arr, int maxDigits, int columns, int rows) { int prod = 0; for(int i = (maxDigits - 1); i < (rows); i++) { int tmp = 0; for(int j = 0; j < (columns-(maxDigits-1)); j++) { int tmpprod = 1; for(int k = 0; k < maxDigits; k++) { tmpprod = tmppro...
22a0977b-3066-420e-a443-01d63693a46c
7
public void read() throws IOException, FileTooShortException { try { for (int m = 0; m < 9; m++) { // reads in a line line = reader.readLine(); for (int j = 0; j < 9; j++) { // if the reading in is equal to space then set it to 0 if (line.length() != 9) { throw new FileTooShortExcepti...
3bc13be9-e92d-4026-9624-d5f6a22706fc
1
public void editQuiz (Quiz quiz) { if (quiz.creator.userID == userID) quiz.updateCurrentQuiz(); }
856898cf-7cb7-4531-aeb5-e8250ead1b49
5
public void read(Json json, JsonValue val) { super.read(json, val); float rx = val.getFloat("respawnPointX"); float ry = val.getFloat("respawnPointY"); this.respawnPoint = new Vector2(rx, ry); this.iFF = IFFTag.valueOf(val.getString("iff")); this.nickName = val.getString("nickName"); this.name = val.g...
d2cd3050-7df5-40e8-b3df-29944ca8566b
8
public String patch_addPadding(LinkedList<Patch> patches) { short paddingLength = this.Patch_Margin; String nullPadding = ""; for (short x = 1; x <= paddingLength; x++) { nullPadding += String.valueOf((char) x); } // Bump all the patches forward. for (Patch aPatch : patches) { aPatc...
0cd5e843-ca9c-4a24-9c13-674b3f999e58
0
public void setPersistenceType(String type) { this.type = type; }
d3abc099-a016-4039-a83c-b1896c7bb3a4
3
@Override public void cleanup() { if (state != null && state.textFormat != null) { state.textFormat.flush(); } if (cmds != null) { cmds.finish(); } stack = null; parserStates = null; state = null; path = null; cmds = nu...
91977af0-560e-4b3c-9fed-16715a9f65d0
0
private Choice(boolean check, boolean download) { this.check = check; this.download = download; }
fb7d330b-f268-46d0-b257-4243150e81f9
8
public static ItemStack[] getRecipe(int i){ ItemStack[] is = new ItemStack[10]; switch(i){ case Sticks: is[0] = new ItemStack(Items.log, 1); break; case CraftTable: is[0] = new ItemStack(Items.stick, 12); is[1] = new ItemStack(Items.log, 4); break; case Pickaxe: is[0] = new ItemStack(Items....
2173979d-4215-4671-bf0b-251186d0ceef
5
private void portamento_up() { if( ( portamento_param & 0xF0 ) == 0xE0 ) { /* Extra-fine porta.*/ if( effect_tick == 0 ) { set_period( period - ( portamento_param & 0x0F ) ); } } else if( ( portamento_param & 0xF0 ) == 0xF0 ) { /* Fine porta.*/ if( effect_tick == 0 ) { set_period( period - (...
a2634943-211b-4ab6-a739-23348c7469d5
2
public static PackedImage sobelGradient(PackedImage img) { PackedImage gxImg = new PackedImage(img.rows(), img.cols()); PackedImage gyImg = new PackedImage(img.rows(), img.cols()); PackedImage outImg = new PackedImage(img.rows(), img.cols()); Kernel gx = new Kernel("sobelGradientGx"); Kernel gy = new Kernel("...
bb3fb650-4703-4d86-8e05-dca21f5cca79
7
public String ending(){ String ending = "dummy value"; if (verb.length() >= 3){ ending = verb.substring(verb.length() - 3, verb.length()); } if (!ending.equals("tsu")){ ending = verb.substring(verb.length() - 2, verb.length()); } if (ending.equals("au") || ending.equals("iu") || ending.equals("ou") ||...
7b50824a-64f0-4c4f-9904-3b76f32cce86
2
public static void main(String[] args) { String sourceFilename = args[0]; Scanner s = null; try { s = new Scanner(new FileReader(sourceFilename)); } catch (IOException e) { e.printStackTrace(); System.err.println("Error accessing the sourc...