method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4c29700e-a3eb-46a6-9b0e-1322a6114708
1
public void testWithFieldAdded3() { YearMonthDay test = new YearMonthDay(2004, 6, 9); try { test.withFieldAdded(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
5382ec29-38b9-4ec7-bec9-32e7641098e3
5
public void fileSave(SimpleFrame frame) { File tempFile = new File(frame.tempFileName); if(tempFile.exists()) tempFile.delete(); if(!frame.getIsFileNameSetted()) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new File(".")); int result = chooser.showSaveDialog(null);...
65805c3d-ef48-48b2-be4b-308bb0ef9efe
2
public void draw(Graphics2D g2) { // Sets the Font to selected Font g2.setFont(new Font ("Eras Demi ITC",Font.BOLD, 24)); g2.setColor(Color.WHITE); //Draws the Text on the screen in the upper left corner g2.drawString("Score: " + currentScore.getScore(), 20,20); g2.dr...
e3f2b485-6a7e-47ac-b036-96f6fcbf6889
5
public String readFile(File name) { BufferedReader inRead = null; StringBuilder outLine = new StringBuilder(); try { inRead = new BufferedReader(new FileReader(name), 4096); final char mBufffer[] = new char[1024]; int mLength; while ((mLength = inRead.read(mBufffer)) > 0) { outLine.append(...
29bd53ba-9f7c-4c31-a2ea-b9cfeac064e5
6
public synchronized void load(String filename) { System.out.println("load"); try { clear(); this.workspace = HeadlessWorkspace.newInstance(); this.workspace.open(filename); BufferedReader in = new BufferedReader(new FileReader(filename)); String line; while ((line = in.readLine()) != null) { ...
2a33b087-04af-496a-9799-0c23a2170532
5
private void createDefaultSettings (File configFile) { BufferedReader bReader = null; BufferedWriter bWriter = null; try { // open a stream to the config.ini in the jar, because we can only accecs // over the class loader bReader = new BufferedReader(new Input...
709b219d-7dc1-462c-bdc0-ac5685724563
6
@EventHandler public void IronGolemStrength(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.getIronGolemConfig().getDouble("IronGol...
c8b2c0ae-d257-4635-9bda-e7bd15b51309
5
public void paint(Graphics g) { int xstart = (int) prot.getCenterX() - SCREEN_WIDTH/2; int ystart = (int) prot.getCenterY() - SCREEN_HEIGHT/2; bg.paint(g, xstart, ystart); prot.paint(g); blocks.paint(g, xstart, prot.getCenterpoint()); for(Ball ball:balls) { ball....
3768d5d5-9dc7-4e51-be7f-eb8675e232e4
4
public void run() { for (int i = 0; i < 4096; i ++) { Actor a = new TestActor(Vector3f.newRandom(100)); a.id = new ActorId(id); actorSetRef.add(a); for (Actor it: actorSetRef) if (it.id.getPlayerId() != id && (i & 15) == 12)...
ea059c10-513b-434d-aa1c-b2df42dc551a
5
public static void randomVector() { BufferedWriter output = null; try { File f = new File("file/randomVector.txt"); output = new BufferedWriter(new OutputStreamWriter( new FileOutputStream(f, false), "UTF-8")); Random random = new Random(); boolean[][] randomVector = new boolean[RANDOM_VECTORS][D...
cac2f092-3efa-49f8-b957-a3f96a9572ca
3
public int getAvgBlocksPlaced(String playerName) { float avgBlocksPlaced = 0; try { ResultSet rs = _sqLite.query("SELECT avg(blocks_placed) " + "AS avg_blocks_placed " + "FROM player, login " + "WHERE player.playername = '" + playerName + "' " + "AND player.id = lo...
d04e9c0f-7edb-4679-84c3-3ff0807cee3a
0
@Test public void testSave() throws Exception { User user = new User(); user.setLoginno("12345"); user.setLoginpwd("45678"); user = repository.save(user); repository.delete(user.getId()); }
2e4d1921-17b5-496a-b254-62eb0eb1c962
2
@Override public boolean onMouseDown(int mX, int mY, int button) { if(button == 0) { Application.get().getLogic().getGame().addPlayerWeapon(actor.getID()); //PhysicsComponent pc = (PhysicsComponent)actor.getComponent("PhysicsComponent"); //pc.setLocation(mX, mY); ...
04269fee-9691-440d-b6e9-55f7b6b304a0
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ResourceType other = (ResourceType) obj; if (enumerationNumber != other.enumerationNumber) return false; if (name == null) { if (other.na...
00013f5e-63c0-49e0-a265-48c53a9c3f91
0
public void setStepToPredator(Scanner scanner) { this.stepToPredator = Input.getPositiveNumber(scanner, "Enter step of Predator"); }
d9a0942a-af18-4c91-87ff-a745c8aca7d2
0
@Override public int getHeight() { return height; }
8239d50a-3b57-40c0-8334-c2a1a679beb3
4
public boolean equals(SinglyLinkedList otherList) { /* if two sizes are different, return false */ if (otherList.size() != numElements) { return false; } SingleNode cursor1 = this.head; SingleNode cursor2 = otherList.head; /* Traverse two lists */ while (cursor1 != null && cursor2 != null) { if (!...
c361bfa7-f3e1-48e7-a891-847aa50ccd94
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:/...
e29ceaf3-4156-4191-9799-5a33ffc3bb21
5
public int charat(int x) { int l = 0, r = text.length() + 1; while(true) { int p = (l + r) / 2; int a = advance(p); if((a < x) && (l < p)) { l = p; } else if((a > x) && (r > p)) { r = p; } else { return(p); } } }
9f4ba740-1ea6-422a-bc76-4a07fa547edf
8
public static void paste(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; // Abort if node is not editable if (!tree.getOldestInSelection().isEditable()) { return; } // Get the text from the clipboard and turn it into a tree boolean is...
323e71ca-beba-4290-8bd1-2e3ebe2ba215
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...
553d27e8-2f41-4738-b95d-d511e5b6ec4e
3
@Override public boolean removeAll(Collection<?> arg0) { boolean changed = false; for(Object o : arg0) { if(remove(o)) { changed = true; } } return changed; }
f5d81984-e718-4890-b698-2ecd7bcef8f4
6
public void reset() { for (int x = 0; x < baseX; x++) { for (int y = 0; y < baseY; y++) { if (x == 0 || y == 0 || x == baseX - 1 || y == baseY - 1) { collisionFlags[x][y] = 0xffffff; } else { collisionFlags[x][y] = 0x1000000; } } } }
42dc6ec0-25fd-4bef-befc-2bb82034ada4
1
private CanvasKeyboard() { currentKeys = new boolean[KEY_COUNT]; keys = new KeyState[KEY_COUNT]; for (int i = 0; i < KEY_COUNT; ++i) { keys[i] = KeyState.RELEASED; } }
48eaed6b-f314-413c-8c65-9e9f03abb349
6
Class<?> createProxyClass(Class<?> clazz) { Class<?> cached = cache.get(clazz); if (cached != null) { return cached; } ProxyFactory f = new ProxyFactory(); if (clazz.isInterface()) { f.setInterfaces(new Class[] {clazz}); } else { f.setSuperclass(clazz); } f.setFilter(new MethodFilte...
e0913af9-ff20-4f6c-b2d4-562a9859899e
5
@Override public final void run() { boolean failure = true; if (this.initiate()) { failure = false; this.running = true; try { this.firstUpdate(); } catch (Throwable e) { this.handleException(e); } while (this.isRunning() && this.canRun()) { try...
468374b3-519c-4d24-aa43-4c1d13ab2486
7
public void disbandActiveUnit() { if (!requireOurTurn()) return; Unit unit = gui.getActiveUnit(); if (unit == null) return; if (unit.getColony() != null && !gui.tryLeaveColony(unit)) return; Tile tile = (gui.isShowingSubPanel()) ? null : unit.getTile(); if (...
40e1e279-748b-428f-845c-9b6c5da739a3
6
public void mergeSuperiorNullFields(DecodedDateTime renamed_Default) { { DecodedDateTime self = this; if (self.dateTimeMillis != Stella.NULL_FLOAT) { self.helpMergeNullFields(renamed_Default, 6); } else if (self.dateTimeSecond != Stella.NULL_INTEGER) { self.helpMergeNullFields(ren...
a4516cfd-bb1c-44be-8e78-283bb9643e6e
8
public static List<Order> list (int uid) throws SQLException { PreparedStatement s = null; List<Order> cart = new ArrayList<Order>(); try { try {Class.forName("org.postgresql.Driver");} catch (ClassNotFoundException ignore) {} currentCon = DriverManager.getConnection(dbName); String query = "select produ...
58717511-e650-4efe-a37f-de4a66d7dc16
3
private void updateTeam() { clear(); System.out.println("Update team information:"); System.out.println(); try { ArrayList<Team> teams = teammgr.listAll(); printShowHeader(); for (Team t : teams) { System.out.p...
828622ee-d92a-4d7c-bc10-5e840f18ba71
6
public static String unescape(String s) { int len = s.length(); StringBuffer b = new StringBuffer(); for (int i = 0; i < len; ++i) { char c = s.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < len) { int d = JS...
3a48c220-3e15-4811-8bcd-666514c2b71a
0
public void startListening(){ reciever.startListening(); }
beda39c6-df1f-4ffa-82d7-ebcb518ff964
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; IndexEntry that = (IndexEntry) o; if (edgePointer != that.edgePointer) return false; if (fileOffset != that.fileOffset)...
23e53573-c8a5-4206-b1ae-72cc8f956bb2
0
public Welcome(String title) { }
192bcc23-c87e-460f-b987-06489a913f66
2
public void close() { if(TCPServerManager != null) { TCPServerManager.close(); } if(tcpClient != null) { tcpClient.close(); } }
88deda0e-12c8-49f2-a7aa-e4d305310f5c
5
public int write2datafile() { int return_val = 0; int paid_count = Paid_MaSP.size(); String file_date = sDate_time; String[] time_info = file_date.split(" "); String[] file_info = time_info[0].split("/"); String file_dir = file_info[2] +"\\" + file_info[1...
24bda35b-cfe4-452a-9e85-7963090dd813
8
public void update( int[][] c ){ Vector v = new Vector(); int high = 0; for( int i=0; i<DIGITS; i++ ){ for( int j=0; j<DIGITS; j++ ){ if( c[i][j] > high ){ high = c[i][j]; v.clear(); v.add( new int[]{i,j} ); ...
2533bf02-8a96-410e-86fe-23daf1761c7a
0
public Day getDay() { return day; }
74907740-697b-4412-ba26-8fae87b6cb6b
7
void batcherSort( int ulArrSize, int ulStart, int ulSkip, boolean fHalves) { int cnt, ulUpper, ulTemp; /* Utility variables */ if (ulArrSize < 2) /* No sorting needed if <2 items in the set */ return; if (ulArrSize == 2) { /* Do simple compare/swap if there are 2 elements */ if (work.greater(ulS...
6c4bbbf7-5bd8-414e-a2c5-5bc6571f8569
6
private void handleMode(String hostmask, String line) { String[] parse = line.split(" "); String message = line.substring(line.indexOf(":", 1) + 1); String nickname = hostmask.substring(0, hostmask.indexOf("!")); String realname = hostmask.substring(hostmask.indexOf("!") + 1, hostmask.in...
ceabeed7-5b89-4c4a-ac56-0a6f15db406f
7
private final XMLNodeType peekType() { switch (mPeek0) { case -1: return XMLNodeType.END_DOCUMENT; case '&': return XMLNodeType.ENTITY_REF; case '<': switch (mPeek1) { case '/': return XMLNodeType.END_TAG; case '[': return XMLNodeType.DATA; case '?': case '!': ...
bcb00eb2-2713-466b-8ebc-dfa5115db2a6
4
public void update() { double cx = maxwidth / 2, cy = maxheight / 2; double dist = Math.sqrt(((cx - rect.x) * (cx - rect.x)) + ((cy - rect.y) * (cy - rect.y))); rect.x += xvel; rect.y += yvel; xvel = (rect.x - cx) / 50; yvel = (rect.y - cy...
9220e697-afc8-4183-ab93-5af99b4412ee
9
public static boolean containsNone(CharSequence cs, char... searchChars) { if (cs == null || searchChars == null) { return true; } int csLen = cs.length(); int csLast = csLen - 1; int searchLen = searchChars.length; int searchLast = searchLen - 1; for (int i = 0; i < csLen; i++) { char ch = cs.charA...
3eae2685-7cf7-4b9c-af52-5c29c0ea205d
9
public char getRandomDirection(){ Random rand=new Random(); int random= rand.nextInt(); for(int l=0; l < 1500 ; l++ ){ random = rand.nextInt(99); } if (random >= 0 && random <= 25) { direction='r'; return directi...
2b4ec5d0-c4a9-41e1-b662-270091319ec4
3
private boolean blackCanEnPassantLeft( int position ) { return ( this.previousMove != null && pieceTypeAt( position + 1 ) == PAWN && this.previousMove.from() == ( position - 31 ) && this.previousMove.to() == ( position + 1 ) ); }
d009c772-ae16-4d39-a844-bfd11b9f0b75
7
public Instances getDataSet() throws IOException { Instances result; Vector<Double> row; double[] data; int i; int n; if (m_sourceReader == null) throw new IOException("No source has been specified"); if (getRetrieval() == INCREMENTAL) throw new IOException("Cannot m...
898b484b-6ced-4ce3-b0ad-e8b186a7ca5d
3
@Override public void render (float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); countdown.update(delta); if(countdown.isDone() && gameover){ Objects.playScreen = new PlayScreen(); ld.setScreen(new MainMenu(ld)); } else if (countdown.isDone()){ Objects.playScreen.failed((int) chunk.x, (int) ch...
89add8cc-bcd5-413a-82f1-5ca440f61cc8
5
@Override public void load(){ try { BufferedReader reader=new BufferedReader(new FileReader(new File(filename))); while(true){ String currency = reader.readLine(); if(currency==null)break; if(!currency.contains(","))continue; ...
65d2e5e8-1ccb-48d8-8276-6f6ad3c23294
7
@Override public boolean perform(final Context context) { // Example: /<command>[ get][ <Player>] int position = 1; if (context.arguments.size() >= 1 && !context.arguments.get(0).equalsIgnoreCase(this.name)) position = 0; OfflinePlayer target = Parser.parsePlayer(context, position); ...
95036bb9-fc17-4d17-8167-09b98b1b24fa
8
private boolean r_shortv() { int v_1; // (, line 49 // or, line 51 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 50 if (!(out_grouping_...
1ed4d2e0-42eb-4aea-bd7c-9a881609f0f8
0
public void setAssetManager(AssetManager assetManager){ this.assetManager = assetManager; }
0afbc85d-b3e0-498a-9433-c0594ce57f83
6
@EventHandler public void SpiderWither(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.Wither.D...
42539e59-8bf0-42a6-b254-b974429d64d8
5
public BPlusTreeNode getChildNodeForValue(long value) throws MiniDB_Exception{ int slotID = 0; int numValuesOnBlock = getCurrNumRecordsOnBlock(); BPlusTreeNode childNode = null; int childBlockID = -1; while( slotID < numValuesOnBlock && childBlockID == -1 ){ if( getValue(slotID) > value ){ c...
28522977-7ced-42f5-a7f3-d9cdd09652ad
1
protected void btnAdicionarEnderecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAdicionarEnderecoActionPerformed Endereco tmp = new Endereco(); try{ tmp.setNumero(Integer.parseInt(txtNumeroEndereco.getText())); tmp.setBairro(txtBairro.getText());...
b4235485-c197-4673-8dcb-078be906a9ab
6
public static void deleteRow(Sheet sheet, Row rowToDelete) { // if the row contains merged regions, delete them List<Integer> mergedRegionsToDelete = new ArrayList<>(); int numberMergedRegions = sheet.getNumMergedRegions(); for (int i = 0; i < numberMergedRegions; i++) { Cel...
e253d4bd-1683-48f6-9322-d59f72025099
4
public InputStream getEncryptionInputStream( Reference objectReference, byte[] encryptionKey, Hashtable decodeParams, InputStream input) { // find the name of the crypt filter used in the CF dictionary CryptFilterEntry cryptFilter = null; if (deco...
9cb2c395-7074-44cc-906a-8dbe19c8fb54
6
@Override public boolean devolucionProducto(TCompraArticulo articulo, int idVenta) { boolean correcto=false; TransactionManager.obtenerInstanacia().nuevaTransaccion(); try { //Iniciamos la transsacion y bloqueamos la tabla a modificar TransactionManager.o...
311eeb5e-5b24-44e3-98a6-b222e9b58e67
3
public static void main(String[] args) { double c1,c2,c3,x; int exp; double a,b,ia,ib,m,fa,fb,fm,error,eact; double eaux=0; Scanner lector = new Scanner(System.in); System.out.println("Dame el coeficiente del termino cuadratico"); c1=lector.nextDouble(); System.out.println("Dame el exponente del t...
9a8fe7ca-f5ea-4bd6-96dd-b9e022672e0d
6
public static String escape(String string) { StringBuffer sb = new StringBuffer(); for (int i = 0, length = string.length(); i < length; i++) { char c = string.charAt(i); switch (c) { case '&': sb.append("&amp;"); break; cas...
473e5474-27cd-4f3e-9157-f26e6dc2a259
9
@Override public void affectCharStats(MOB affected, CharStats affectableStats) { if((whom!=null)&&(song!=null)) { final Hashtable<Integer,Integer> H=getSongBenefits(song); for(final Enumeration<Integer> e=H.keys();e.hasMoreElements();) { final Integer I=e.nextElement(); final String[] chk=stuff[I...
32ef2ea4-0f56-4163-b969-a6db2c3ff271
3
@Override public void sell(Command cmd) { cmd.execute(); if(Storage.getInstance().getRevenue() < 10000.0) { restaurant.setState(restaurant.getBadstate()); }else if(Storage.getInstance().getRevenue() >= 10000.0 && Storage.getInstance().getRevenue() < 20000.0) { restaurant.setState(restaurant.getNormal...
7906f8b8-3628-491d-9396-4d8c29fc8091
6
protected boolean isNumericalLiteralModifier(char c) { switch(c) { case 'l': case 'L': case 'f': case 'F': case 'd': case 'D': return true; default: return false; } }
83718955-1c9f-4ced-aa05-607b36f6adb1
5
* @param encoding The encoding to use. */ public static String format( final List<? extends NameValuePair> parameters, final String encoding) { final StringBuilder result = new StringBuilder(); for (final NameValuePair parameter : parameters) { final String e...
e8f037ba-5b50-49b1-8587-e96e19dc2792
9
public void create(UnidadeMedida unidadeMedida) { if (unidadeMedida.getQualificadorAplicacaoCollection() == null) { unidadeMedida.setQualificadorAplicacaoCollection(new ArrayList<QualificadorAplicacao>()); } if (unidadeMedida.getQualificadorProdutoCollection() == null) { ...
79029219-2c2c-480c-b709-23af9aaff52a
8
protected String attributeCaseFix(String columnName){ if (m_checkForUpperCaseNames) { String ucname = columnName.toUpperCase(); if (ucname.equals(EXP_TYPE_COL.toUpperCase())) { return EXP_TYPE_COL; } else if (ucname.equals(EXP_SETUP_COL.toUpperCase())) { return EXP_SETUP_COL; } else if (uc...
79f46aef-6648-468d-984a-3f0fee95b7f3
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Type)) { return false; } Type other = (Type) object; if ((this.name == null && other.name != null) || (this.nam...
a0cf4aa9-af01-40e6-bd0b-75a965bb32d1
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (this.getClass() != obj.getClass()) return false; final Concatenate other = (Concatenate) obj; if (this.filter1 == null) { if (other.filter1 != null) return false; } else if ...
9dea308c-fae8-41db-8478-9fab085d3c77
6
private void readInitialRequest(HttpRequest req) { req = copyRequest(req); String hostAndPort = ProxyUtils.getHostAndPort(req); if (hostAndPort == null || hostAndPort.isEmpty()) { writeBadRequestResponse("Missing hostAndPort in request to: " + req.getUri()); setCurrentSt...
33e77714-beea-4abd-af8f-0de9563d7a58
3
public void addCd(String artist, String title) { // Freien Datensatz suchen und CD-Daten einfügen for (String[] cd: this.cds) { if (cd[0] == null && cd[1] == null) { cd[0] = artist; cd[1] = title; break; } } return; }
99fff25b-1e32-471d-917d-669457004106
2
public void focus() { Configuration[] configs = configurations.getSelected(); if (configs.length == 0) { JOptionPane.showMessageDialog(configurations, NO_CONFIGURATION_ERROR, NO_CONFIGURATION_ERROR_TITLE, JOptionPane.ERROR_MESSAGE); return; } else if (configs.length > 1) { JOptionPane.showMessa...
9da5fc71-f174-4130-b137-49df05c03e9a
8
public static HashMap<String, String> requestTokenToAccessToken(String oauthToken, String oauthVerifier) throws TwitterException { String _numberUsedOnce = generateNumberUsedOnce(); String _timeStamp= currentTimeInSeconds(); String oauthSignature = null; // signature parameters HashMap<String, String> sign...
5c6053d0-c4a4-4490-a6c3-778ae8771070
8
@Override public Administrador Login(Administrador admin) { String consulta = "select a from Administrador a where a.ativo = 1"; String filtro = ""; HashMap<String, Object> param = new HashMap<String, Object>(); if (admin != null) { if ((admin.getLogin() != null && ad...
2de0b9ef-e157-4c15-b55c-8365eada31b8
9
@Override public List<LayoutNode> generate(int num, int dir) { final Vector<LayoutNode> set = new Vector<LayoutNode>(); final int diameter = (num / 3 / 2) + 1; final LayoutSet lSet = new LayoutSet(set,num); LayoutNode n = new DefaultLayoutNode(new long[]{0,0}); LayoutNode firstNode = n; for(int x=0;x<diam...
9219e7fe-eb0b-4885-a1d0-4fc862dab742
1
public static Map<String, Object> getMapObject(String jsonString) { JSONValue jsonVal = JSONParser.parseStrict(jsonString); JSONObject jsonObj = jsonVal.isObject(); if (jsonObj == null) { throw new IllegalStateException("JSONObject expected"); } return getMapFromJsonObject(jsonObj)...
a965cd41-0f20-44f7-a3e1-81c5457bcbbc
1
public static boolean unzipFileFromZip(Path zip, String filename, Path destDirectory) throws IOException { if (!control(zip)) { return false; } return DirectoryZip.unpackFileFromZip(zip, filename, destDirectory); }
5346ab7e-3cee-4ecf-9edf-41c1bde1839a
8
public void unHighlightPanel(PanelName panelName) { Color defaultColor = this.getBackground(); switch (panelName) { case PANEL_NORTH: northPanel.setBackground(defaultColor); break; case PANEL_SOUTH: southPanel.setBackgro...
216e14f3-5c1c-40a4-85d3-b84f06b40c0d
9
private static final BlockType getType(final int value) { switch (value) { case 1: return BlockType.RED; case 2: return BlockType.PURPLE; case 3: return BlockType.ORANGE; case 4: return BlockType.GREY_FACE; case 5: return BlockType.GREEN_FACE; case 6: return BlockType.BLUE_FACE; case 7...
bde64b24-9b79-4952-8085-4ddbdf118707
3
public static void main(String[] args) throws Exception { // all of the useful sample code is in ExampleClientThatLocks.java // FakeLimitedResource simulates some external resource that can only be access by one process at a time final FakeLimitedResource resource = new FakeLimitedResource(); ...
c7a13093-6f69-4123-9dd9-c58e668d735a
9
@Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } MethodAttributes that = (MethodAttributes) o; if(controllerClass != null ? !controllerClass.equals(that.c...
e4b6408c-942d-447a-a676-816e9c195785
7
public SyncJob prepare(final SyncSet syncSet) { log.info("Checking directories"); if (!Files.isDirectory(syncSet.getSourcePath())) { throw new IllegalStateException("Source directory does not exist: " + syncSet.getSourceDir()); } if (!Files.isDirectory(syncSet.getTargetPath())) { throw new IllegalStateEx...
69b60de3-a5ea-41db-a038-cb040fe5b53d
5
public static Element find(Element tree, String path){ if (tree == null || path == null) { return null; } if (path.charAt(0) == '/') { path = path.substring(path.indexOf('/', 1)+1); } String[] paths = path.split("/"); for (int i = 0; i < paths.length; i++) { tree = tree.getChild(paths[i]); if(tr...
63a014ea-8b20-4c3c-a5a7-9e0a6b4e55c1
9
public boolean input(Instance instance) { if (getInputFormat() == null) { throw new IllegalStateException("No input instance format defined"); } if (m_NewBatch) { resetQueue(); m_NewBatch = false; } Instances outputFormat = outputFormatPeek(); double[] vals = new double[outpu...
77b0736d-6295-4771-9f33-72217ce31368
1
public void downloadRequiredFiles(DownloadInfo info){ if(info.newDir){ File newDir = new File(info.DirectoryName); newDir.mkdir(); info.FileName = info.DirectoryName + info.FileName; System.err.println(""); } new URLFileFetcher(info.URL, info.FileName); }
05c74a17-05ba-4c8d-86fe-3f372ab0a7c9
0
public String getApodo() { return apodo; }
ca58d5a4-5964-4c89-a905-89f176905cb4
4
private boolean read () { String reply = null; if (socket != null) { try { /* Await reply */ reply = b.readLine(); } catch (IOException ignored) {} } if (reply == null) return false; return ((reply.equals("OK")) ? true : false); }
16bebf9e-354f-484a-931a-48dda42e9e85
0
public int GetNextSelectedBusStop() { //set a random bus stop to Start at SetSelectedBusStop(rndStart.nextInt(busStop.length)); //System.out.println("Start: "+(GetSelectedBusStop()+1)); //return the stop chosen return GetSelectedBusStop(); }
a328df67-0109-4741-b015-45af98ac3d85
6
public static void main(String[] args) { //Initialize variables int[] stats = new int[3]; stats = genStats(); Scanner Input = new Scanner(System.in); int in =0; debug = false; //defaults try { if(args[0].equals("--debug"))//enter debugmode debug=true; System.out.println("Running game in debugg...
d85dd8cc-8e9c-4aa8-bbe5-90614abbad42
3
public void download() { URL url = null; URLConnection con = null; int i; try { url = new URL("https://localhost:8080/AppName/FileName.txt"); con = url.openConnection(); File file = new File("/home/user/test.txt"); //this can use the compre...
b8dd416f-598c-4f2e-b318-590d004badaa
1
public EnhancedPath2D( Path2D path ) { if( path == null ) { throw new IllegalArgumentException( "path must not be null" ); } this.path = path; buildSegments(); buildSegmentLengths(); }
6ccc62d6-cbc1-424f-be14-7f039a689695
5
public static String arrayToCommaList(Object[] array) { StringBuffer sb = new StringBuffer(); for (int i=0; i<array.length; i++) { if (i > 0 && i < array.length - 1) { sb.append(','); } if (i > 0) { sb.append(' '); } if (i==(array.length-1)) { sb.append("and "); } sb.append(array[i]...
027e1e66-9c58-4979-86ff-d63f61ac279d
4
@Override public void run(Player activator, List<Player> allPlayers) { // TODO Auto-generated method stub int [][] strengthMap = activator.getBoard().getStrengthMap(); int [][] visualMap = activator.getBoard().getVisualMap(); for (int i = 0; i<strengthMap.length; i++){ for (int j = strengthMap[0].len...
ab96cc29-126d-46f1-920d-b1ea465696f6
7
public static List<TestSetInfo> getTestSetsFromTestSetTree(HierarchicalConfiguration testsetTreeData) { List<TestSetInfo> testsetInfos = new ArrayList<TestSetInfo>(); if (testsetTreeData != null) { List<HierarchicalConfiguration> testsets = testsetTreeData.configurationsAt(TESTSET1_TAG); ...
738f7eec-28e6-46a3-9154-9504dfc17df3
7
@Override public LawnEntity loadData(LawnInformationVO information) { if (information instanceof TextFileLawnInformationVO) { TextFileLawnInformationVO textFileInformation = (TextFileLawnInformationVO) information; // Reading from file Path fileToRead = Paths.get(textFileInformation.getFilePath()); if (...
4e8c5db5-5ddb-49c5-8e6c-7db3238b7b09
7
Space[][] getOpenSets(Space sp) { Space[][] sets = new Space[getNumOpenSets(sp)][3]; int index = 0; if (getNumOpenSets(sp) != 0) { if (isOpenForPiece(board[sp.pos[0]], sp.piece)) { sets[index] = board[sp.pos[0]]; index++; } if (isOpenForPiece(getColumn(sp.pos[1]), sp.piece)) { sets[index] = g...
a6525a84-90b1-4fc6-95c4-53f671dbc534
6
public void doCommand(int command,ASObject value) { switch(command) { case CommandConst.TEST: System.out.println(value); break; case CommandConst.technicalGrowthRate: System.out.println("technicalGrowthRate"); IndicatorParam param = new IndicatorParam(); param.indicatorType = ((Int...
2f8ad736-bb9d-4eb4-81d1-c3244e9213c5
6
public void starting() throws ServerException { if (log.isDebugEnabled()) log.debug("Method call"); ServerSocket s = null; try { s = new ServerSocket(readProp()); while (true) { Socket socket = s.accept(); try { ...
329b8e6b-287a-4f11-a45f-dc312aeb7912
1
public int setCellEmpty(int row, int column) { int value = -1; Cell cell = map[row][column]; if (!cell.isWall()) { value = cell.cleanCell(); } return value; }
00e081f5-622f-4049-b99d-606a51e0d4f7
8
public void updatePhysician(Object o, int empID, int column) { try { Connection connect = connection.getConnectionFromPool(); switch (column) { case 0: Statement fn = connect.createStatement(); ...
85b90a36-cfea-4a43-831f-e5fe7214abf3
3
public usb.core.Device getDevice (String portId) throws IOException { // hack to work with hotplugging and $DEVICE // /proc/bus/usb/BBB/DDD names are unstable, evil !! if (portId.startsWith (devfsPath)) { String temp; int busNum, devAddr; temp = portId.substring (devfsPath.length () + 1); ...
213d84d2-6870-4271-9fde-39702a4f1662
7
public String getLink() { String link = null; // Have a shape with an embed? OOXMLElement oe = getObject( SP ); if( oe != null ) { link = ((Sp) oe).getLink(); } // how's about a picture? if( link == null ) { oe = getObject( PIC ); } if( (oe != null) && (link == null) ) { link = ((Pic) ...