method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
65a34564-d1c7-41a6-9c69-bcc42d31ef8e
0
public void setExpiryDate(XMLGregorianCalendar value) { this.expiryDate = value; }
08d78a63-e59c-46b4-aad1-146aef3f3de6
6
public void applyCareer(Human actor) { subject = actor ; applyBackgrounds(actor) ; // // We top up basic attributes to match. actor.traits.initDNA(0) ; actor.health.setupHealth( Visit.clamp(Rand.avgNums(2), 0.26f, 0.94f), 1, 0 ) ; // // For now, we apply gender at rando...
7a8651fc-2e53-4966-8a27-f403b300301f
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; BasicResourceDefinition other = (BasicResourceDefinition) obj; if (id == null) { if (other.id != null) return false; } else if (!...
b5c79f0b-e0bf-4a81-8d50-766d8264cd80
6
@Override public void actionPerformed(ActionEvent src) { Object source = src.getSource(); if (source == btnReset) { resetAllTrain(); } else if (source == btnAddLocomotive) { getLocomotiveInfo(); } else if (source == btnAddPassengerCar) { getPassengerCarInfo(); } else if (source == btnAddFreightC...
24f1ca98-ef84-422d-8a13-c865b491b976
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 Email)) { return false; } Email other = (Email) object; if ((this.idEmail == null && other.idEmail != null) || ...
5ffb4452-71c6-48ce-a250-fd306ff6460a
1
private void gameUpdate(long delta) { hero.tick(delta); myControle.tick(delta); for(int i = 0; i < bullets.size(); i++) { bullets.get(i).tick(delta); } }
df9e9dd5-00b1-4f3a-af2d-0337d9379d77
3
public GetUserInfoResult genLoad() { EntityUser user = EntityUser.load(userId); EntityUser delegate = null; List<EntityUser> userVotes = null; if (showVotes) { userVotes = getVotes(user); HashoutUserToDelegate hashoutUserToDelegate = new HashoutUserToDelegate(); List<EntityUserAndVote...
a7ea3078-8b10-49c4-a902-09e89c3c01dd
1
public void printList() { for (int i=0; i<size(); i++) { System.out.println(this.get(i).getX() + " " + this.get(i).getY()); } }
64f8946c-ff18-4648-be95-1a68ded7c13d
9
public static void main(String[] args) { Scanner entrada = new Scanner(System.in); int aleatorio, intentos; int numero, continua; boolean continuar=true; while(continuar){ intentos = 0; aleatorio = (int)(Math.random()*1000 + 1); do{ System.out.println("Adivine un numero entre 1 y 1000: "); ...
8d9c348e-fbf3-4177-87d9-a64f528a9324
5
private void placePitsAndSlime(){ Random rand = new Random(); int pitCount = rand.nextInt(3) + 3; int x, y; //Assign Pits for(int i = 0; i < pitCount; i++){ x = rand.nextInt(10); y = rand.nextInt(10); if(grid[x][y] != RoomState.EMPTY) i--; else grid[x][y] = RoomState.PIT; } ...
7e869d27-b262-46a7-997c-442c24d5b697
9
public Skill getEnum() { switch (skill) { case 0: return Skill.ATTACK; case 1: return Skill.DEFENCE; case 2: return Skill.STRENGTH; case 3: return Skill.CONSTITUTION; case 4: return Skill.RANGED; // guess case 5: return Skill.PRAYER; case 6: return Skill.MAGIC; case...
13dd4136-71ec-414f-8e45-1edc25c10301
3
public int addFuelToCar(int litresAdded) { if(isCarRented() == false || getFuelInCar() == getFuelCapacity()){ return 0; } else { int fuelTotal = fuelInCar + litresAdded; int fuel = Math.min(fuelTotal, fuelCapacity); fuelInCar = fuel; if (litresAdded >= (fuelCapacity - fuelInCar)){ ...
54d295d0-e896-46d6-ae62-af50af39d8b1
0
@Override public void destroy() { node = null; }
85ff6916-7a2f-4798-b689-fcfe90a453d0
9
public ArrayList<Position> possibleMoves(){ ArrayList<Position> d = new ArrayList<Position>(); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { Position position = new Position(super.position().x() + i, super.position().y() + j); if (position().x...
185f0d93-3635-471c-976d-dbeda5c109f3
6
private int findWordLimit(int index, BreakIterator words, boolean direction, String s) { // Fix for 4256660 and 4256661. // Words iterator is different from character and // sentence iterators // in that end of one word is not necessarily start of // another word. // Please see java.text.Brea...
b4f74b78-5a4d-4e63-9779-86ac4a3d57ef
8
private int getAngleNearEnemy(){ int vzdalenost = 2000; int angle, min_x = 0,min_y = 0; /** * Zjištění nejližšího nepřítele */ for (int i=0;i<enemies.size();i++) { // Výpočet vzdalenost X,Y souradnice int pomx = Math.abs(x - enemies....
48b778fb-4335-4acd-b1ff-935710c78731
9
@Override public void componentActivated(AbstractComponent source) { //Handles the Mouse Interactions //TODO: Add logic to check for overlays if(gameTypeBox.isActivated()){ if(source == gameTypeBox.pvaiButton){ Globals.playerTwoAI = true; Globals.GAME.enterState(Globals.GAME.GAMESCREENSTATE, new Fa...
df5bc541-04cb-4a74-8ccd-69775a347fbc
0
public void setIntelligentY(int intelligentY) { this.intelligentY = intelligentY; }
bc4e3612-ffd6-4be8-a4bc-821b90ac71f3
5
private String IaddResourceNode(String resource_id) { String node_id = null; OrientGraph graph = null; try { node_id = getResourceNodeId(resource_id); if(node_id != null) { //System.out.println("Node already Exist: region=" + regio...
5ce76a4f-c698-4d75-99be-d7bc4d337c57
4
@Override public void keyPressed(KeyEvent keyEvent) { if(keyEvent.getKeyCode() == KeyEvent.VK_LEFT) { iDireccion = 1; } if(keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) { iDireccion = 2; } if (iDireccionProyectil == 0 && keyEvent.getKeyCode(...
18d084b0-de3a-44e3-8595-3415f12e10af
0
public void setAddress1(String address1) { this.address1 = address1; }
f2812a77-20a3-420c-85d5-833bf55c56db
1
static public String[] findCoauthor(HashMap<String, String[]> coauthorResult, String personName){ String coauthorArray[] = coauthorResult.get(personName); String temp[] = null; String tempString = null; String ResultArray[] = new String[coauthorArray.length]; ResultArray[0] = coauthorArray[0]; for(int i = 1...
1591b5d3-c6d3-4cae-8b2b-fedecc7498ec
7
private static float maximum(float a, float b, float c, float d) { if (a > b) { if (a > c) { return a > d ? a : d; } else { return c > d ? c : d; } } else if (b > c) { return b > d ? b : d; } else { return c > d ? c : d; } }
35f22b03-1c94-4bf8-9d11-ce16cbd86b28
4
@GET @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public List<SocialCommunity<?>> getCommunities( @QueryParam("query") String query, @QueryParam("communitiesTypes") CommunityType[] communitiesTypes, @QueryParam("page") Integer page) { EnumSet<CommunityType> communitiesTypesSet = EnumSet .n...
790fef37-8e7b-4861-b028-86164252b448
1
public static final void exampleSynchronousQueries() { System.out.println("Starting Cyc synchronous query examples."); try { ELMt inferencePSC = access.makeELMt("InferencePSC"); CycFormulaSentence query = CycLParserUtil.parseCycLSentence("(isa ?X Dog)", true, access); InferenceWorkerSynch work...
a0b2eced-6a69-41f5-a972-088d2af38067
4
private void updateShop(final ShopCharacter shop, final PlayerCharacter player){ for(final Item item : shop.getInventory()){ // create item panel JPanel shopItem = new JPanel(); shopItem.setPreferredSize(new Dimension(250, 70)); shopItem.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); shopItem.se...
b3757769-8ff3-4c90-a68d-1f5fe7dc43c8
8
public void installListeners() { keyListener = new KeyAdapter() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { JediWindowModel model = window.model; if (e.getKeyCode() ==...
22c05a96-482e-40bf-8850-3e0654a7e9fe
7
private JPanel createSavedSettingsPanel() { JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createTitledBorder("Gespeicherte Einstellungen")); panel.setLayout(new BorderLayout()); _savedSettingsTable.setRowSelectionAllowed(true); _savedSettingsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INT...
97158a30-d53a-41a7-9acb-cb32818ad250
2
public void addUso(String cod, double area) { if (usos == null) usos = new HashMap<String, Double>(); if (usos.get(cod) == null) usos.put(cod, area); else { double a = usos.get(cod); a += area; usos.put(cod, a); } }
ddb11723-cacc-45f1-b654-c41471f82bd4
1
public AnnotationVisitor visitAnnotationDefault() { AnnotationVisitor av = mv.visitAnnotationDefault(); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
b5bb5ea9-bd69-4433-a33d-8b5059ac598a
0
public TurnHandler(boolean clockwise) { this.clockwise = clockwise; }
e843b08d-230e-4920-9807-651b9371c541
4
public static void moviesToFile(String infilename, String outfilename) { File file = new File(outfilename); List<UserMovie> list = readData(infilename); Collections.sort(list); FileWriter fw = null; try { fw = new FileWriter(file); for(int i=0; i<list.size(); i++){ fw.append(list.get(i)+"\n"); } ...
4fb8a883-67f7-4f9f-aa39-c3a07675038a
4
public Strat getrand(int r) { if (r == 0) { return tStrats.get((int) new Random().nextInt(tStrats.size())); } else if (r == 1) { return zStrats.get((int) new Random().nextInt(zStrats.size())); } else if (r == 2) { return pStrats.get((int) new Random().nextInt(pStrats.size())); } else if (r == 3) { r...
5b165978-b3cf-4d66-8c84-a343e34db278
2
private Collection<Object[]> getParameterArrays() throws Exception { Method testClassMethod = getDeclaredMethod(this.getClass(), "getTestClass"); Class<?> returnType = testClassMethod.getReturnType(); if (returnType == Class.class) { return getParameterArrays4_3(); ...
31793d23-0e4d-43fc-a863-5ab8b2b0ada1
8
@Override public void run() { if (players[0].getPlayerType() == Const.LAN) { try { String name = in.readUTF(); this.setPlayer1Name(name); out.writeUTF(players[1].getName()); } catch (Exception ex) { System.out.pri...
3486015e-cee3-4d34-9a1f-f5f490ba49da
3
public void showTip(String tipText, Point pt) { if (getRootPane() == null) return; // draw in glass pane to appear on top of other components if (glassPane == null) { getRootPane().setGlassPane(glassPane = new JPanel()); glassPane.setOpaque(false);...
390b3221-45bc-40e1-9a00-8f794b3c9267
9
@SuppressWarnings({ "rawtypes", "unchecked" }) public void lock(TransactionId tid, Permissions permission) throws TransactionAbortedException { if (permission == Permissions.READ_ONLY) { if (lock.getReadHoldCount() == 0) { try { while(!lock.readLock().tryLock()) { wait(); } ...
854effa9-a76e-49b0-b6ac-ee987ea1581d
8
public static void export(String filename) throws Exception { try { BufferedWriter writer = new BufferedWriter(new FileWriter(new File( filename))); manager = new MovieManager("imdblist", "movies"); set = manager.getCompleteResultSet(); writer.write("<html><body><table width=80%>\n"); while (set...
8a01ee82-e828-4cd7-82b2-91842c2848f5
0
public static void clearList(){ listAllWords.clearList(); }
eba872a9-b32b-46e0-8608-661617372499
3
@Override public boolean isCellEditable(int row, int col) { switch (col) { case 0: case 2: case 3: return true; } return false; }
662e8022-1951-4847-acc3-dfddca0bb1ed
6
private int[] getSurroundings(int xCoord, int yCoord) { int[] surroundings = new int[3]; //System.out.println("origin = " + xCoord + ", " + yCoord); for(int y = yCoord - 1; y <= yCoord + 1; y++) { for(int x = xCoord - 1; x <= xCoord + 1; x++) { if(!((validateX(x) == xCoord) && (validateY...
c1d5bcd8-cffa-4fce-a801-a0820007bd5f
9
public Result recognizeFromResult(Result r) { //get phonemes ArrayList<PhonemeContainer> phonemesSpeech = pc.getPhonemes(r); //get best result String[] phonemes = phonemesSpeech.get(0).getPhonemes(); //ad to phone frontend pfe.addPhonemes(phonemes); //start postprocessing r = null; e...
29956c50-3c39-401d-ba6c-76411bc13f72
1
public static void closeSession() throws HibernateException { Session session = (Session) threadLocal.get(); threadLocal.set(null); if (session != null) { session.close(); } }
382bc213-b6d9-41d9-a4b2-19de2afb6101
0
public void updatePlayer(PlayerUpdate newdata){ x = newdata.x; y = newdata.y; }
7b1f633b-acaa-476d-8971-6a12d07b6de4
3
@Override public boolean colides(SchlangenKopf head) { if (super.colides(head) ? true : (nextGlied == null ? false : nextGlied.colides(head))) { head.die(); return true; } return false; }
f7eed7ca-1571-4fd9-bf23-d9ae403d15d2
3
public void buttonClick(int position){ if(turn <10){ btnEmptyClicked = true; if(isMyTurn) { btnEmpty[position].setText("X"); btnEmpty[position].setFont(new Font("sansserif",Font.BOLD,32)); isMyTurn = false; } else { btnEmpty[position].setFont(new Font("sansserif",Font.BOLD,32)); btnEmpty...
4a1d513d-902f-4037-a1c7-5f6ddfd51c69
5
private boolean isAttackPlaceLeftNotHarming(int position, char[] boardElements, int dimension) { if (isPossibleToPlaceLeft(position, dimension)) { if (isPossibleToPlaceOnNextLine(boardElements, position + dimension) && isBoardElementAnotherFigure(boardElements[positionLeftBelow(p...
225b3c3b-e837-4e02-9f36-680e02818306
7
public boolean PointInLineRect(Vector2 point) { return (((point.X >= mPoint1.X && point.X <= mPoint2.X) || (point.X <= mPoint1.X && point.X >= mPoint2.X)) && ((point.Y >= mPoint1.Y && point.Y <= mPoint2.Y) || (point.Y <= mPoint1.Y && point.Y >= mPoint2.Y))); }
ea8e436e-7d58-44ae-8ce7-53912c8ac696
0
@Basic @Column(name = "employee_id") public int getEmployeeId() { return employeeId; }
7c7b092a-7d8f-42d2-bd21-acff3046c2f9
1
public static void main(String[] args) { try { new CounterSwipeServer().startServer(); } catch (Exception e) { System.out.println("I/O failure: " + e.getMessage()); e.printStackTrace(); } }
a6056ecf-9a0b-47da-bd06-e617471049ba
9
public boolean removeWord(String word) { if(word.length() == 0) return true; char the_char = word.charAt(0); int childPos = getChildPos(the_char); if(this.children[childPos] == null) return false; if(word.length() == 1 ){ if(this.children[childPos].is_word){ if(this.children[childPos].is_leaf){ ...
33dabed4-825e-4556-b715-d69f13bc7a45
1
private static void tr(final String s) { if (BloatBenchmark.TRACE) { System.out.println(s); } }
bbc1322c-e4ca-4996-82db-7e0d877400a7
5
public double sin(int a){ //normalizing if(a>360){ a %= 360; }else if(a<0){ a %= 360; a += 360; } //return if(a <= 90){ return sin[a]; }else if(a <= 180){ return sin[180 - a]; }else if(a <= 270){ return -sin[a - 180]; }else{ return -sin[360 - a]; } }
33e8a337-b22a-44cb-98a5-d71b51166d1b
9
public HacklabSignDriver(String serialPortName) { this.portName = serialPortName; if(numBoards < 1 || numBoards > 12) { throw new IllegalArgumentException("numBoards is out of range: " + numBoards); } // open the serial port CommPortIdentifier portIdentifier; try { portIdentifier = CommPortI...
47397e7d-a7f8-4efc-95aa-0634393b8ebf
2
public ClassInfo getClassInfo() { if (clazz != null) return clazz; else if (ifaces.length > 0) return ifaces[0]; else return ClassInfo.javaLangObject; }
037f9135-8f7e-423d-b86a-4a020f6f816c
1
private void killAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_killAllButtonActionPerformed try { logger.log(Level.INFO, "Killing all processes on device: " + deviceManager.getSelectedAndroidDevice().toString()); logger.log(Level.INFO, "ADB Output: " + adbCo...
2b0d9c86-86ff-4334-a228-4b90163b3e76
7
public static <E> Map<E,int[]> intArrayMapCopy(Map<E,int[]> map) { Map<E,int[]> copy = null; if (map instanceof HashMap<?,?>) { copy = new HashMap<E,int[]>(); } else if (map instanceof TreeMap<?,?>) { copy = new TreeMap<E,int[]>(); } for (E e : map.keySet(...
34498c65-bde3-4661-a505-5889e5252827
3
public boolean parseField(String name, String value) { if (name != null && value != null) { DeviceField filed = EnumUtils.lookup(DeviceField.class, name); if (filed != null){ return filed.handle(getDevice(), value); } else{ return false; } } return false; }
e325fb8b-83d4-4655-bbdf-9a2678d2b041
4
@Override public void moveCursor(int x, int y) { if(x < 0) x = 0; if(x >= size().getColumns()) x = size().getColumns() - 1; if(y < 0) y = 0; if(y >= size().getRows()) y = size().getRows() - 1; textPosition.setColumn(x); ...
4d64cab5-1b30-4ad6-9576-fd174cfcbe7c
2
public BinSmotif(Smotifs binMe) { try { String bin = binMe.getBin(); String path = bin.substring(0,1) + "/" + bin.substring(1,2) + "/" + bin.substring(2,3) + "/" + bin.substring(3,4) + "/" + bin.substring(4,5); String totalPath = "C:/emacs/Bioinformatics-Project/Bins" + path + "/" + bin + "output....
fc64006e-06cc-4a87-8474-365f375821a3
0
@Test public void resolve() { int sqrt = ((int) Math.sqrt(N)) + 1; Primes.isPrime(sqrt); print(largest(N)); }
066dbc0c-fee7-4df2-a8e0-40b76973de68
9
public String mkString(Class clazz) throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException { List<String> list = new ArrayList<String>(); String result = clazz.getSimpleName() + " "; if (!Modifier.isAbstract(clazz.getModifiers())){ o...
8686a6e4-397f-488c-926f-792d58122923
1
private String read() throws IOException { String line = br.readLine(); if(line == null) return ""; return line; }
20324748-ea0e-4886-bdd5-f4338ea3aa68
2
public synchronized void moveDown(boolean pressed) { downPressed = pressed; if (pressed) { if (timeToNextDownMove <= 0) { tetromino.tryMove(this, Direction.DOWN); timeToNextDownMove = AUTO_REPEAT_TICKS; } else timeToNextDownMove--; ...
3ab9169e-0802-4d07-bd7a-23544683de28
6
private void render() { // System.out.println("rendering..."); if (first) { c = new Chat(); first = false; } BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(3); return; } Graphics ...
990ff824-b2f7-47b4-8994-7c9492af7824
6
public final double grad(int var1, double var2, double var4, double var6) { int var8 = var1 & 15; double var9 = var8 < 8?var2:var4; double var11 = var8 < 4?var4:(var8 != 12 && var8 != 14?var6:var2); return ((var8 & 1) == 0?var9:-var9) + ((var8 & 2) == 0?var11:-var11); }
56627787-d803-4204-b671-fbadce674e63
4
private void fixBounds() { if (x < xmin) x = xmin; if (y < ymin) y = ymin; if (x > xmax) x = xmax; if (y > ymax) y = ymax; }
3936365c-f0a6-4d8c-b05b-6afbaad11726
9
private static void splitRange( final Object builder, final int valSize, final int precisionStep, long minBound, long maxBound ) { if (precisionStep < 1) throw new IllegalArgumentException("precisionStep must be >=1"); if (minBound > maxBound) return; for (int shift=0; ; shift += precisionSt...
3bf2c559-067e-407a-8a4f-797391778f18
8
public PrintWriter getWriter() throws java.io.IOException { if (_outputState==DISABLED) return __nullServletWriter; if (_outputState!=NO_OUT && _outputState!=WRITER_OUT) throw new IllegalStateException(); // If we are swit...
ced9a153-d696-4d37-b307-919f5ad0f485
9
public void act() { //Initial. Stores the locations which can be reached in the first location. //Push it into the stack if(init==0) { last=this.getLocation(); next = last; crossLocation.push(getValid(last)); init=1; } if (isEnd == true) { //to show step count when reach the goal ...
ee2c04c2-01fc-4e14-a4a1-a2142039c5e5
0
private void menu_closeConnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menu_closeConnActionPerformed Globals.global_connection.close_connection(); this.setTitle("Kurs project,3105,Ratnikov,Chuglov. Connection state = " + Globals.global_connection.get_connection_state()); ...
97f868f7-b449-4f83-b0c3-fbbec214adde
4
@Override public void run() { initialize(); newGeneration = new Chromosome[popsize]; for (int k = 0; k < nGenerations; k++) { evaluate(population); Arrays.sort(population); System.out.println( "Iter: " + k + " Dur: " + population[0].getActualDuration() ); // Elitism for (int...
23579438-ebd8-48b9-b53e-e229300eb275
2
public static void main(String[] args) { int numOfGuesses = 0; GameHelper helper = new GameHelper(); SimpleDotCom theDotCom = new SimpleDotCom(); int randomNum = (int) (Math.random() * 5); int[] locations = {randomNum, randomNum+1, randomNum+2}; theD...
b3abe931-64da-413f-a9fe-edbd38100cf9
6
public static void sendData(String message, String IP, int PORT){ String multicast = IP; int port = PORT; Logger logger = LoggerFactory.getLogger(DaemonStorageProcess.class); InetAddress group = null; try { group = InetAddress.getByName(multicast); } catch (...
c3f0e1df-1c9f-444c-99dc-41dd11b8e71b
2
public List<ReceptDTO> getReceptList() throws DALException { List<ReceptDTO> list = new ArrayList<ReceptDTO>(); ResultSet rs = Connector.doQuery("SELECT * FROM recept"); try { while (rs.next()) { list.add(new ReceptDTO(rs.getInt(1), rs.getString(2))); } } catch (SQLException e) { throw new DAL...
cdf74595-d706-4a9a-9c6b-048e4a8925ef
0
@Before(value = "") public void before() throws Throwable { log.info("Beginning method: "); }
5066b8e2-d00d-455f-a7c3-70f9eca55217
4
public Logging() { String time = getFilenameDateTime(); logfilename = "log/log" + time + ".xml"; msgfilename = "log/.msg" + time; start = "\t<start date=\"" + getLogDate() + "\" time=\"" + getLogTime() + "\" />\n"; try { File file = new File("log/"); if (!file.exists()) file.mkdir(); else i...
a4186214-492f-44cd-88d7-7bfc900a52c8
1
public Row getByKey(String tableName, String key) throws DBUnavailabilityException, DataBaseRequestException, DataBaseTableException { if (key == null) { throw new DataBaseRequestException("key shouldn't be null"); } String firstCharAtName = key.substring(0, 1); ...
0bb27578-609a-4eb7-a81e-65234cf53c8e
5
public static Dir getDir(int id) {//Great for iterating over all Dirs in a for loop // ex: for(int d=0;d<4;d++) // square.transform(Dir.getDir(d)); switch (id) { case 0: return Dir.North; case 1: return Dir.East;...
ab4e1689-dbff-48cc-9fdb-b99d6fb11945
4
public void busRemoved (Bus bus) throws IOException { if (model == null) return; synchronized (busses) { Bus newBusses [] = new Bus [busses.length - 1]; HubNode newHubs [] = new HubNode [newBusses.length]; int index, nodeIndex = -1; HubNode node = null; // which one went? for (int i = in...
19ec9dc8-c6e1-44dc-8bfc-6082b84cf11b
3
@Override void write(DataOutput dataoutput) { try { if (!this.list.isEmpty()) { this.type = ((NBTBase) this.list.get(0)).getTypeId(); } else { this.type = 0; } dataoutput.writeByte(this.type); dataoutput.writeInt(th...
11e1fa09-eb24-40f1-9e94-009c6932480a
0
public void setDescription(String description) { this.description = description; }
148276bc-0fda-45e8-8c82-12423eb64cdc
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
581bef7e-90b5-48e7-b970-67b3ef4899b0
5
@SuppressWarnings({ "unchecked", "rawtypes" }) public void run() { //References the instance of the plugin and config for easier accessing ms = MojangStatus.getInstance(); config = ms.getConfig(); try { //Retrieve status info URL url = new URL("http://status.mojang.com/check"); Scanner s = new ...
0eef2742-1d0a-4816-9619-f811a888464b
6
public void generate_cffile(int operations_count, int file_minindex, int file_maxindex) { System.out.println("inside generating config file"); int remaining_ops = operations_count; int line_index = 1; int read_ops = (int) Math.floor(0.7 * operations_count); int write_ops = (int) Math.ceil(0.3* operations_c...
79c81796-dcc2-4635-93ad-26f0e9aac1f4
8
public void nextModel(LineageState state) { state.setCurrentTime(getNextEventTime()); double time = getNextEventTime(); if (time == Long.MAX_VALUE) { // assert false:state.getLinagesActive(); throw new RuntimeException("Model does not permit full coalescent of linages.\n Check for zero migration rates...
c8574b13-4696-478d-b450-0be6b45ed424
8
public static final ISkill getSkill(final int id) { if (skills.size() != 0) { return skills.get(Integer.valueOf(id)); } System.out.println("Loading SkillFactory :::"); final MapleDataProvider datasource = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("net.sf.odinms.wzpath") + "/Skill.wz"...
efa73aad-755d-43d7-8f3e-18fb2e1d7f89
2
public void settingsKey(int k, Character c) { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (hud.getName().equals("ScreenKeys")) { hud.settingsKey(k, c); } } }
0675b592-a10a-4dc3-a5a3-6d14950b3601
4
public static void main(String[] args) { GameData g = new GameData(6); String[] tribes = new String[] { "banana", "apple" }; g.setTribeNames(tribes[0], tribes[1]); Contestant c1 = null, c2 = null; try { c1 = new Contestant("a2", "Al", "Sd", tribes[1]); c2 = new Contestant("as", "John", "Silver", trib...
95fdba32-e5c6-421a-9be5-d8f7a8bad8ed
5
*/ public void deselectAll () { checkWidget (); CTableItem[] oldSelection = selectedItems; selectedItems = new CTableItem [0]; if (isFocusControl () || (getStyle () & SWT.HIDE_SELECTION) == 0) { for (int i = 0; i < oldSelection.length; i++) { redrawItem (oldSelection [i].index, true); } } for (int i = 0; i...
0b24375e-a7e4-410c-b79e-b1e3ea7946c3
6
public void showEndScreen() { main.textFont(font, 130); main.text("Game Over!", 30, 150); main.textFont(font, 30); main.text("[R]etry", 680, 480); if (main.rightBar.score == 10 && main.opponent != null) { main.textFont(font, 50); main.text("Get some practice an come back.", 30, 350); return; } ma...
6656c511-f056-4d0e-8851-5dc071064bda
8
public void move(int xa, int ya) { if(xa != 0 && ya != 0){ if(diagonal<4){ move(xa, 0); move(0, ya); diagonal++; }else{ diagonal = 0; } return; } if (xa > 0) dir = 1; if (xa < 0) dir = 3; if (ya > 0) dir = 2; if (ya < 0) dir = 0; if (!collision(xa, ya)) { x ...
58710cff-b370-4ffd-ac29-037ff6f89340
7
public void saveOrder() throws Exception{ orderSQL="INSERT INTO ORDERS(USERNAME,"; orderSQL += " SHIPPING_ADDRESS, SHIPPING_ZIPCODE, SHIPPING_CITY)"; orderSQL += " VALUES(?,?,?,?)"; try{ // load the driver and get a connection Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnectio...
6ddd8cbd-bf55-40af-baf6-f2ffd0700915
1
public void start() { Timer time = new Timer(); TimerTask task = new TimerTask() { /** * Actions to do */ @Override public void run() { localNet.progress(); localNet.showNet(); if (!localNet.ha...
1e761303-3e49-4407-9bac-ff7293915ce6
4
public void forward_packet(Node sender, Packet packet) { try { //latência do canal de transferência sleep((long) this.latency); } catch (InterruptedException e) { e.printStackTrace(); } //identifica qual das extremidades está enviando Node receiver = null; if (sender.equals(this.point_A...
d38a3fb0-7af9-4395-acb5-8b5a7ccebbaf
1
@Override public AbstractActionPanel getAction() { if ( owner.getSelected() ) { return new ActionPanelBlank(); } else { return new ActionPanelBlank(); } }
66800bc9-be43-47d1-8a66-a7cf8dbf78c4
6
public void run() { long beforeTime, afterTime, timeDiff, sleepTime; long overSleepTime = 0L; int noDelays = 0; long excess = 0L; gameStartTime = System.nanoTime(); prevStatsTime = gameStartTime; beforeTime = gameStartTime; running = true; while(running) { theModel.update();...
0e694f21-b614-4fa5-bb05-a973a3f71cfd
3
@Override public Class<?> getColumnClass(int columnIndex) { if (columnIndex == 2) return Boolean.class; else if(columnIndex == 3) return Boolean.class; return super.getColumnClass(columnIndex); }
383473a6-5d8a-4581-bd9e-b17a7bf83aa2
3
public void pedirPath(File[] dir) { ArrayList<String> ficheros = new ArrayList(); if(getPath().equals("")){ Interfaz.dirAct.setText(("Carpeta: \"\\\"")); }else{ Interfaz.dirAct.setText("Carpeta: \"" + getPath() + "\""); } int i=0; ...
42ac4400-2645-4e59-8a5b-c0c3aaf2bb52
1
private static void printHeroList() { for(HeroSlot heroslot : heroSlots){ System.out.println(heroslot.toString()); } }