method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4bfe347d-c286-4785-996f-32ac0ef355b4
0
@Id @Column(name = "item_id") public int getItemId() { return itemId; }
96309347-26d5-4525-833f-6d8e76b9fabc
6
public static void main(String[] args) { int n = 2000000; long start = System.currentTimeMillis(); BitSet b = new BitSet(n + 1); int count = 0; int i; // set all the bits for (i = 2; i <= n; i++) { b.set(i); } i = 2; ...
eccbcd29-3887-465c-a726-60f5adf5664d
6
private void linkMesh() { for (int i = 0; i < (width); i++) { // row for (int j = 0; j < height; j++) { // col if (j != 0) submesh[i][j].addNeighbor(this.submesh[i][j - 1]); // North if (j != height - 1) submesh[i][j].addNeighbor(this.submesh[i][j + 1]); // South ...
dfe37bc1-5424-450c-88a5-32f7ca2994d9
7
public static void collectUnboundGoalVariables(Proposition goal, List unboundvariables) { { Stella_Object arg = null; Vector vector000 = goal.arguments; int index000 = 0; int length000 = vector000.length(); for (;index000 < length000; index000 = index000 + 1) { arg = (vector000.theA...
621276d7-b747-425c-9bf1-f06f22c84c12
6
public void informera(Feedback fb) { for(int i = 0;i < fb.getGropar().length;i++) { if(fb.getGropar()[i] != 0) { if(fb.getGropar()[i] == 1) { System.out.println("Sensorp.:"+fb.getRiktningar()[i].getX()+","+fb.getRiktningar()...
4e0a5c0f-72ed-4d55-a8a9-f80375542f25
5
public void handleAddTapeAlphabetButton() { String alphabet = startView.getTapeAlphabetTextField().getText().trim(); if((alphabet.length() > 0) && (startView.getTapeAlphabetItems().contains(alphabet) == false)){ startView.getTapeAlphabetItems().addElement(alphabet); startView.getTapeAlphabetTextFiel...
833d2cfa-4fde-4943-814c-b3da4046275c
4
public Map<String, String> returnMap() throws Exception { Map<String, String> map = new HashMap<String, String>(); BufferedReader reader = new BufferedReader(new FileReader(this.fileName)); String line; while ((line = reader.readLine()) != null) { if (line.trim().length() ==...
243a6cdf-42a9-45cf-8c00-ac3bf06cf612
9
private void btCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCheckActionPerformed String labelEng = ""; ArrayList<String> answerEngList = new ArrayList(); String[] answerEng = null; for (Word w : dbConn.getAllWords()) { if (tempWordId == w.getHunId...
86db37b3-2234-43ae-ac47-0aa58fb14c49
1
@SuppressWarnings("unchecked") public void update(Observable o, Object arg) { // so wird auf die Position jedes einzelnen Vogels zugegriffen; ArrayList<Bird> birds = (ArrayList<Bird>) arg; BirdShape birdShape; Bird bird; for (Iterator<Bird> iterator = birds.iterator(); iterator.hasNext();) { bird = ...
29e9c523-d84a-4395-b233-d2bb4fe355ee
5
public void run() { edge.addElement(GridCell.getStartCell()); int attempts =0; int state=NOT_FOUND; while(state==NOT_FOUND && attempts<maxSteps) { attempts++;//counts the attempts state = step();//sets state to output of step t...
b0aec2f1-af9f-4f74-9307-0563b2b9d7e1
1
public void initInvaders(){ for(int i = 0; i < pos.length; i++){ invaders.add(new Invaders(pos[i][0], pos[i][1])); } }
b1ad4f21-3594-4fd8-a6fd-5d3213a19b83
5
public IVPNumber subtract(IVPNumber number, Context context, DataFactory factory, HashMap map) { IVPNumber result = factory.createIVPNumber(); map.put(result.getUniqueID(), result); if(getValueType().equals(IVPValue.INTEGER_TYPE) && number.getValueType().equals(IVPValue.INTEGER_TYPE)){ int resultInt = context....
aa97aa59-b328-40c1-82a2-0417a27a7c77
2
public boolean isPresent(String key) { for (int bucketIndex : getHashBuckets(key)) { Bucket bucket = new Bucket(bucketIndex); if (bucket.value == 0) { return false; } } return true; }
b11a5f55-8115-4e75-93a7-6af2fcd1f5f5
0
public void setNews(String news) { this.news = news; }
c25c6b7c-0d4e-497d-ac87-9b0dd9301857
0
public void setTrigger(String trigger) { this.trigger = trigger; }
fb9ad586-1388-43b7-9502-0cc448ae41e0
0
@Override public String toString(){ String str = this.name + "\n"; str += "\tIdentifier: " + this.identifier + "\n"; str += "\tPrice: " + this.price + "\n"; str += "\tInventory: " + this.inventory + "\n"; return str; }
c9fb538c-8ea5-4593-85c1-a8ea61b60120
9
protected boolean initializeManagedObjects(MOB affected) { if(unmanagedYet.size()==0) return false; boolean didAnything=false; final SLinkedList<Object[]> commands = new SLinkedList<Object[]>(); while(unmanagedYet.size()>0) { final Object[] thing=unmanagedYet.removeFirst(); if(thing[0] instanceof Ab...
71e84cce-70ef-441b-acbc-521ec8850c24
9
public void init() { io = Games.getIOManager(); configFile = new File(plugin.getDataFolder(), "config.yml"); config = plugin.getConfig(); if (!configFile.exists()){ io.sendConsole("Creating config.yml...", true); try { configFile.createNewFile(); updateConfig(); io.sendConsole("config.ym...
df277ec5-e46c-4885-9232-c4cc2ea9278f
1
private static synchronized List<TaskDoneListener> initListeners(List<TaskDoneListener> list, TaskParameters taskParameters) { if (list == null) { list = new ArrayList<TaskDoneListener>(); tasks.put(taskParameters, list); } return list; }
6bc52813-c30c-4b86-b6e0-9cc796d04f4b
3
Color getColor(){ if(this.equals(RED)){ return new Color(255, 0, 0); } else if(this.equals(GREEN)){ return new Color(255, 0, 255); } else if(this.equals(YELLOW)){ return new Color(255, 255, 0); } return null; }
9f949994-1863-4198-b47d-14adf7d5a7dc
6
public void handleLMSLC() throws IOException { int[] triple = new int[3]; if (!readTriple(triple)) { return; } // SLC will be initiated by the client // case 1. client requests set // LINEMODE SLC 0 SLC_DEFAULT 0 if ((t...
d9d5c520-1d00-47be-8219-5b67e580f92a
6
public static void STARTUP_SOAP_ENV() { { Object OLD_$MODULE$_000 = Stella.$MODULE$.get(); Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS/SOAP-ENV", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpec...
9a4ac9df-203a-4eb7-9fa8-d728bc0d6451
2
@Override protected void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException { if (req.getParameterMap().containsKey("create")) { create(Double.parseDouble(req.getParameter("value")), res); return; } if (req.getParameterMap().containsKey("id")) ...
72120cc7-c161-4310-99cd-b70e31eea8e7
7
public static BookmarkReader predictSample(String filename, int trainSize, int sampleSize, int d, int beta, boolean userBased, boolean resBased, boolean tagBLL, boolean topicBLL) { filename += "_res"; BookmarkReader reader = new BookmarkReader(trainSize, false); reader.readFile(filename); List<int[]> predict...
d2feb10f-b285-447c-9979-70a55ddc4867
8
public Set<Map.Entry<Integer,Long>> entrySet() { return new AbstractSet<Map.Entry<Integer,Long>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TIntLongMapDecorator.this.isEmpty(); } pu...
6b80d738-ed15-4b2e-9307-b21912a0f0f8
9
public Object get(String atrName) { Object ret = null; if (atrName.equals(LABEL)) { ret = e.getLabel(); } else if (atrName.equals(STROKE)) { ret = e.getStroke(); } else if (atrName.equals(COLOR)) { ret = e.getColor(); } else if (atrName.equals(...
d5bc7581-b717-4d9f-a657-c7cee41cd2ba
2
public void newGame() { scores[0] = RESET_SCORE; scores[1] = RESET_SCORE; availableAmount = NUM_DIGITS; turn = PLAYER_ONE; for (int i=0;i<available.length;i++) { available[i] = true; } //Tell everyone the new information Iterator<ModelListener> iter = modelListeners.iterator(); while ...
2a07322c-6712-494b-b92f-a6f032073fc0
6
public Iterator<BxTreeEntry> find(int from, final int to, boolean includeFrom, final boolean includeTo) { final Iterator<BxTreeEntry> baseIter = root.find(from, includeFrom); // >(or >=) from iterator return new Iterator<BxTreeEntry>() { private BxTreeEntry entry = getNext(); @Override public BxTreeEntr...
739bd2b1-1333-4761-a3d3-feb43c573f73
3
private int boldHandler(char[] chars, int i) { basicText.append("\\b "); String plainWord = ""; while (chars[i] != ' ') i++; i++; while (chars[i] != '}' && i < chars.length) { plainWord = plainWord + chars[i]; i++; } basicText.append(plain...
f72c9550-0164-48e4-85d8-f073ee7b6641
6
private boolean avaliaAtividade(Atividade nova) { for (Atividade ativs : depto.recuperarAtividades()) { if((ativs.recuperaData().equals(nova.recuperaData())) && (ativs.recuperaIntervalo() == nova.recuperaIntervalo())){ for (TipoRecurso tipoRecurso : recuperaTipoRecurso("") ) { for (Recurso recurso2 : tipo...
714b2565-1877-42fb-995e-01a3ca538662
1
private void updateKey(){ StringBuffer sb = new StringBuffer(); for(int i = 0; i < words.length-1; i++){ sb.append(words[i]); sb.append(KEYSEPATOR); } key = sb.toString(); }
179febae-e977-4490-9696-2a977b6286eb
1
public List<String> getValues(String schemaName, String tableName, String columnName) throws SQLException { List<String> result = new ArrayList<String>(); String stmt = String.format(getColumnValueStatement, columnName, schemaName, tableName); ResultSet rs = statement.executeQuery(stmt); ...
024bb8f2-7fdb-4dcc-8d98-41a2f0facd34
4
private static void insertField(Difficulty diff, Point enter, Orientation orientation){ Random random = new Random(); int recAccuracy = GetConfigByDiff.setRecAccuracy(diff); Field newField; float x = 0, y = 0; int length, height; length = 2*recAccuracy + random.nextInt(2*...
84209cfa-32b3-4d1f-8975-7561bd155cd5
2
public static boolean isLeftLinear(Production production) { if (isLeftLinearProductionWithVariable(production) || isLinearProductionWithNoVariable(production)) return true; return false; }
ef3a4ce5-eca4-44bd-a4c2-2dc68f68bbb5
0
public SignaturePropertyType createSignaturePropertyType() { return new SignaturePropertyType(); }
c9149468-1714-480b-bb5a-be3947afeee5
2
private boolean isIntegerCommand(ECommands testing_command, Integer intCommand) { if(intCommand >= cmdTable.getAssemblerCommand().get(testing_command).getFrom()) { if(intCommand <= cmdTable.getAssemblerCommand().get(testing_command).getTo()) { return true; } } return false; }
2a922aad-1a24-483e-a783-728d76ce98f4
1
private AbstractGame createGame(Cell[][] board, ModeEnum mode, BoardTypeEnum boardType) { Integer[] survives = mode.getSurvives(); Integer[] revives = mode.getRevives(); if (boardType == BoardTypeEnum.WALLOFDEATH) { return new WallOfDeathGame(board, survives, revives); } else...
8b630ad9-caa7-4cf3-aa97-f3c8b89cdb1c
9
public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_W: case KeyEvent.VK_UP: up = true; break; case KeyEvent.VK_A: case KeyEvent.VK_LEFT: left = true; break; case KeyEvent.VK_S: case KeyEvent.VK_DOWN: down = true; break; case KeyEvent.VK_D: case KeyEvent.VK...
289a5096-27bf-4f0c-9dc2-dd0eaa63ef14
6
public void render(Graphics2D g) { switch (game.getState()) { case MAIN_SCREEN: Rectangle start = new Rectangle(Game.WIDTH * Game.SCALE / 2 - 400 / 2, 150, 400, 80); Rectangle exit = new Rectangle(Game.WIDTH * Game.SCALE / 2 - 400 / 2, 150 + 80 + 25, 400, 80); ...
8a349699-3406-4af5-8902-bf08d13e9e3d
9
static void compareXmlTwoFiles(Reader rr, Reader rq) throws XmlPullParserException, IOException { XmlPullParserFactory factory = XmlPullParserFactory.newInstance( //System.getProperty(XmlPullParserFactory.PROPERTY_NAME), null); "org.xmlpull.mxp1.MXParserFactory", null); factory.s...
4953893d-3750-4286-bc9f-5d4a4ed7cd89
7
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (cmd.getName().equalsIgnoreCase("rank")) { if (args.length > 0) { if(sender.hasPermission("dwdbridge.others")) { Player[] onlinePlayers = Bukkit.getOnlinePlayers(); ...
a2e65568-9788-459c-85c2-382fab1b76f8
2
private static boolean string2Boolean(String s) throws Exception { if (s.compareTo(Boolean.toString(true)) == 0) return true; else if (s.compareTo(Boolean.toString(false)) == 0) return false; throw new Exception(); }
d671093f-fdac-4e74-b3d6-cde0aa3e31f4
2
public void setLabel(String label) { this.label = label; if (label == null) { labels = new String[0]; } else { StringTokenizer st = new StringTokenizer(label, "\n"); ArrayList lines = new ArrayList(); while (st.hasMoreTokens()) lines.add(st.nextToken()); labels = (String[]) lines.toArray(new St...
c1e3543e-a861-44f7-920a-278602268066
3
public static Scrolling parse(HtmlElement element, String str){ switch(str){ case "yes": return YES; case "no": return NO; default: case "auto": return AUTO; } }
b3d544ad-9ffa-4210-bc3c-dffc79e894a0
0
public FireBodyArmor() { this.name = Constants.FIRE_BODY_ARMOR; this.defenseScore = 10; this.money = 300; }
16f597df-bf8a-4068-b27b-d8932ec0bed1
3
public ArrayList<Piece> getEmptyNeighbors(Board board) { ArrayList<Piece> neighbors = new ArrayList<Piece>(); for(int x = this.getX() - 1, y = this.getY() - 1; y <= this.getY() + 1; x++) { if(board.isPlaceFree(x, y)) { neighbors.add(new Piece(x, y)); } if(x > this.ge...
55eeda79-4aca-4211-bf46-052244cc4d00
7
@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); if (isEnabled()) { g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); if (hover) { if (imageHover != null) { ...
6048db2e-0e7e-44f6-a1c8-8361c7b3a96b
9
private void initBackupServer() { try { connectBackupServer(); if(backupServer != null) { // get information from database HashMap<String, ArrayList<String>> tblMessages; HashMap<String, String> tblUser = db.getUsers(); HashMap<String,HashMap<String,String>> tblFriendships = db.getFriendshi...
04cc09c1-fb50-4934-b019-b10892fb0b3f
8
public void keyPressed(KeyEvent e) { switch(e.getKeyCode()) { case KeyEvent.VK_CONTROL: ctrlPressed = true; break; case KeyEvent.VK_RIGHT: if(ctrlPressed) gameEngine.moveSideways(4); else gameEng...
b0038c4a-3f5c-4580-8f65-28fcc5fb5d44
0
public void setSeatNumber(String value) { this._seatNumber = value; }
42636c8c-d6f3-4a93-a9a4-9c9c665c4c77
8
private void btnSalvarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSalvarMouseClicked String comp = txtNome.getText(); int est = Integer.parseInt(txtEstoque.getText()); double vc = Double.parseDouble(txtValorCompra.getText()); double vv = Double.parseDouble(txtValorV...
df81423d-ee2e-4f9a-9954-46912def8933
2
public void CrearAlumne(String user, String password, String nom, String cognoms, int edat){ AlumneVo a= Factory.factoryMethod(user,password,nom,cognoms,edat); if(this.buscarAlumne(a.getNomUser())==null){ //crear connexio DbConnection conex= new DbConnection(); try { //Preparar connexi...
7dab7e57-b0dc-4fea-b13d-55c16e4d504a
4
private ArrayList<ColorAmount> sortMostDominantColors() { ArrayList<ColorAmount> dominantColours = new ArrayList<ColorAmount>(); Iterator it = map.entrySet().iterator(); while (it.hasNext()) { Map.Entry pairs = (Map.Entry) it.next(); dominantColours.add(new ColorAmount...
11110ea5-c849-478a-aa59-45f64ad1416e
4
@Override public void run() { startTime = System.currentTimeMillis(); List<QueueEntry> batch = new ArrayList<QueueEntry>(); while (true) { batch.clear(); // Try to take as many as possible without blocking queue.drainTo(batch, batchSize); // LOG.info("In batch: " + batch.size() + " size after dra...
3595cc59-de8d-468d-9f79-50dac920b725
7
@Override public void onFrame() { // If we reach this state, we're waiting on a building before we can perform the upgrade if (researchInProgress && currentUpgrade != null && upgradeBuildings.size() > 0) { // The building is complete so finish the upgrade and reset vars performUpgradeRequest(currentUpgrade);...
2305ef7b-2c1e-493f-8e9e-b1d133e2c102
3
public void modificarInventario(int id, int cant){ boolean aux = false; for (int x = 0; x < productosDisponibles.size(); x++) { if (id == productosDisponibles.get(x).getId()) { productosDisponibles.get(x).addCantidadDisponible(cant); aux = true; ...
784a4252-b8ee-4c31-b94e-d86ec32af52d
9
public OutlineNode getOutline() throws IOException { // find the outlines entry in the root object PDFObject oroot = root.getDictRef("Outlines"); OutlineNode work = null; OutlineNode outline = null; if (oroot != null) { // find the first child of the outline root ...
078dc92c-7006-4f9c-936a-10f18db0fdba
4
public boolean checkColumn(int col) { int count = 0; for(int j = 0; j < 10; j++) { count = 0; for(int i = 0; i < 9; i++) { if(j == Integer.parseInt(entries[i][col].getText())) { count++; } if(count >= 2) { System.out.println("checkColumn() returned false at i: " + i + " j: " + col + " wi...
610b9d1f-7c2a-4f67-98ea-9ea27e00c202
4
public void checkLossOfLife(){ if (waveNumber != 0){ int loop; for (loop = 0; loop < spawnedWave.enemyStrength(); loop++){ if (spawnedWave.enemyStrength() == 1){ player.loseALife(spawnedWave.lossOfLife(), true); } else{ player.loseALife(spawnedWave.lossOfLife(), false); } repaint()...
b467d35a-2d9b-4be9-89f7-55bc12a7f925
0
public int getLineNumber() { return lineNumber; }
56b4c76f-a92e-4851-a770-31529f41ce3f
9
private boolean dfs(Map<Character, TrieNode> children, String word, int index) { if (index == word.length()) return children.isEmpty(); char ch = word.charAt(index); if (children.containsKey(ch)) { if (index == word.length() - 1 && children.get(ch).isWord) return true; return dfs(children.get(ch)....
df7165db-deab-4176-9106-4f8059c3bd00
3
public Set<Long> getCharacterIDs() { if (toCharacterIDs == null || toCharacterIDs.length() == 0) return null; HashSet<Long> characterIDs = new HashSet<Long>(); for (String characterID : toCharacterIDs.split(",")) characterIDs.add(Long.parseLong(characterID)); return characterIDs; }
b49e7471-f2ce-4416-ad78-cff6e38bf724
0
public Set<Entry<K, List<V>>> entrySet() { return this.map.entrySet(); }
1f18626f-21c4-4e24-bf72-ebde38a6bc24
7
public void payout( Hand playerHand, Hand bankerHand ) { StringBuilder sb = new StringBuilder(); if( playerHand.getValue() > bankerHand.getValue() ) { sb.append("PLAYER "); // player wins, 1-1 if( baccaratBet == BaccaratBet.PLAYER ) { bankroll = bankroll.add(bet); bankroll = bankroll.add(bet...
8d958578-9a7c-49da-8349-df5a5c2a6149
3
private static ListNode reverseOrder(ListNode head){ if(head == null || head.next ==null) return head; ListNode pre = head; ListNode current = head.next; while(current!=null){ ListNode temp = current.next; current.next = pre; pre = current; current = tem...
7e8463f2-c120-4e36-8ef7-fac51652c482
3
@Override public void setup() { Graphics2D graphics = null; if (imageRef != null) { BufferedImage bi = (BufferedImage) imageRef.get(); if (bi != null) { graphics = bi.createGraphics(); } } else { graphics = g; } ...
95ac5d4e-b306-4cd2-95b6-bd44bda6cf99
4
public void setInterpolationMethod(int methodindex) { switch (methodindex) { case 0: method = new NearestNeighbour(); break; case 1: method = new LinearInterpolation(); break; case 2: method = new NewtonPolynom(); break; case 3: method = new CubicSpline(); break; default: break; ...
efa184bc-c887-4ce5-9e47-c3c07f665a54
9
public void testRemove() { int element_count = 10; TIntList a = new TIntLinkedList(); assertTrue( a.isEmpty() ); for ( int i = 1; i <= element_count; i++ ) { a.add( i ); } assertEquals( 6, a.get( 5 ) ); assertTrue( a.remove( 5 ) ); for ( int...
ba5dfe58-f93e-4bb2-9046-30012ca1b620
9
public static void MP_IDENTIFIER() { char currentChar = file.charAt(index); currentLexeme = ""; String tempLexeme = ""; int state = 0; while(true){ currentChar = file.charAt(index); switch(state){ case 0: if(Character.isAlphabetic(currentChar)) { // to accept state tempLexeme += currentChar;...
1aaa626d-824d-4a54-a274-e7b4f1cf46e0
2
public static Object toHL(Object cyclObject, CycAccess access) throws IOException { if (!DefaultCycObject.isCycLObject(cyclObject)) { throw new RuntimeException(DefaultCycObject.cyclify(cyclObject) + " is not a valid Cyc object."); } if (!(cyclObject instanceof CycObject)) { return cyclObject;...
d92d514f-ba0f-4e8a-8229-f0e3428c46a1
8
@Override public void gc() { for (XObject[] m : memory) { for (XObject o : m) { o.resetVisible(); } } for (XValue baseType : baseTypes) { baseType.setVisible(this); } for (XValue module : modules.values()) { module.setVisible(this); } for (XExec exec : threads) { exec.setVisible(); }...
20c52e2d-1225-4e32-a464-b8e2f0fd58d1
6
public void showRecvMessage(String sender, String msg, boolean whisper_recv){ try { String newText; String[] tokens = msg.split("\002"); if(whisper_recv){ newText = "\n" + "( FROM "+ sender+ " )" + " :";// + msg; } else{ ...
82d5e6ce-a9d7-4490-9b6f-6ffc749d23f2
0
public static String getLogin(){ return login; }
aada9d84-5816-4682-b1a1-0b021d651f68
7
private void checkNewHome(Allocation newHomeBudget) { if(newHomeBudget.building == null){ //we live in a freaking villa. Refund that shiznit. income.insert(newHomeBudget.resources); newHomeBudget.resources.extract(newHomeBudget.resources); return; } double budget = newHomeBudget.resources.getValue(); i...
57154f0a-4b1a-4f15-97a6-6ec61e2f9d96
4
public void startGame() { this.gameStatus = GameStatus.IN_SESSION; for (final Player player : this.players) { if (player.getCards().size() > 0) { for (int i = 0; i < player.getCards().size(); i++) { this.whiteCards.add(player.getCards().get(0)); ...
88c24215-181f-4e30-83f0-6c8c102e5463
9
void _tr_flush_block(int buf, // input block, or NULL if too old int stored_len, // length of input block boolean eof // true if this is the last block for a file ) { int opt_lenb, static_lenb;// opt_len and static_len in bytes int max_blindex = 0; // index of last bit length code of non zero freq // Buil...
18f4b0e9-3271-41c5-9010-8d13413f0d43
4
public Wizard(Army armyAllegiance) { super(armyAllegiance); ++serialNumber; race = "Wizard"; super.addName("-Wizard:" + serialNumber); setStaff((Math.random() < 0.95)? true : false);// class specification.method() less than 95%. if (getStaff() == true) super.addStrength(80); setHorse((Math.random() < 0...
bffd4d32-9e3d-45b2-8009-a2589b60d5f4
0
@Override public void documentRemoved(DocumentRepositoryEvent e) {}
433a9ce4-7229-4aa5-9580-3d30521f7b01
3
public static void main(String[] args) { long startTime = System.currentTimeMillis(); if(args.length == 0){ System.out.println("Please provide the location of the workload file!"); System.exit(1); } try { String fileName = args[0]; ...
4dca3117-7d96-4c7e-8b27-e5e04c201e4b
0
protected OSCPort(DatagramSocket socket, int port) { this.socket = socket; this.port = port; }
ed350a4f-827d-4097-989a-154c04883bcc
7
public boolean equals(ChessPiece p) { if (p.TYPE != TYPE || p.COLOR != COLOR || p.RANGE != RANGE || p.ATTACK_SLOPES.length != ATTACK_SLOPES.length || p.hasMoved != hasMoved) { return false; } for (int i = 0;i < ATTACK_SLOPES.le...
7752868c-4028-47c4-a157-af35d2d56606
2
public String signup() { if (!password.equals(confirmPassword)) { addActionError(getText("error.signup_password")); return ERROR; } User user = DataProvider.createUser(name, username, password); if (user == null){ addActionError(getText("error.signup_exists")); return ERROR; } session.put(USER_O...
c9072e98-3f97-4b4b-8227-89a4424bee34
5
public void paint(Graphics g){ int width = getWidth(), height = getHeight(); if (!renderInit || gameCache == null) { if (loader != null) { loader.paint(g); } } else { if (width != oldW || height != oldH) { _ginit(); oldW = width; oldH = height; } ...
0ded4c95-cb89-4ab7-93d3-13382ce3cc9f
3
@Override protected byte[] doInBackground() { byte[] signature = null; try { // Obtention d'une instance de l'objet calculant la signature Signature signer = Signature.getInstance(super.file.getAlgorithm()); // initialisation de l'objet signant avec la clé priv...
e90a5608-94cf-46e0-91ad-ecdd5dcede15
3
public void leerArchivoOrigen() { try { FileInputStream file=new FileInputStream("kardex.txt"); int c; while((c=file.read())!=-1) { dataInput=dataInput+String.valueOf((char)c); } file.close(); } c...
2ab9a307-0dce-4653-aea1-d14c7e8aa541
3
public static void addConnectedClient(String btName, String btAddress) { boolean wasAdded = false; for(int i = 0;i<=5;i++) { if(wasAdded == false) { if(clientsTable.getModel().getValueAt(i, 0) == null) { clientsTable.getModel().setValueAt(btName, i, 0); clientsTable.getModel().setValue...
4142f6ea-256a-4198-9c55-ffb1e8ddf7b6
5
public boolean isConnected(Node from, Node to) { Position p1 = from.getPosition(); Position p2 = to.getPosition(); double d = p1.squareDistanceTo(p2); if(d <= r_min_squared) { return true; // the two nodes are always connected } if(d > r_max_squared) { return false; // the two nodes are never conn...
21ad34a1-a047-403c-8593-decf44d852f7
8
public static void pickAWimpyFight(MOB observer, boolean mobKiller, boolean misBehave, String attackMsg, String zapStr) { if(!canFreelyBehaveNormal(observer)) return; final Room R=observer.location(); if(R!=null) for(int i=0;i<R.numInhabitants();i++) { final MOB mob=R.fetchInhabitant(i); if((mob!=nu...
3c9ee9af-f59b-4273-a354-52930630a680
4
public void addNeighboor(Array n, Ways w) { switch (w) { case NORTH: north = n; n.south = this; break; case SOUTH: south = n; n.north = this; break; case EAST: east = n; n.west = this; break; case WEST: west = n; n.east = this; break; } neighboorCounter++; }
01d65394-cfd2-4c1b-9e14-94797a84b8b2
7
public static void casei(){ boolean correct_input = false; int course_index = 0; Course current_course = null; while(!correct_input){ try{ String course_name = JOptionPane.showInputDialog(null, "Enter the course name of the waiting that you want to see: ", "Waiting List", JOptionPane.INFORMATION_ME...
fbd9d3e5-28a0-4bd3-a03a-c5389e8e267e
3
@Test public void testAusfuehren() { assertTrue(spieler.getInventar().has(Item.UKuchen) || spieler.getInventar().has(Item.UGiftkuchen)); assertTrue(ablegen.ausfuehren(kontext, spieler, befehlszeile)); assertTrue((raum.getNaechstesItem() == Item.UGiftkuchen) || (raum.getNaechstesItem() == Item.UKuchen));...
cd55d108-0fc9-4bf5-a451-79c93d1174cd
2
public void loadOcean(Ocean ocean, String filename, JComboBox removeBox){ try{ InputStream is = new FileInputStream(filename); ObjectInputStream ois = new ObjectInputStream(is); Ocean temp = (Ocean) ois.readObject(); setOceanObjects(temp.getOceanObjects()); setWidth(temp.getWidth()); setDepth(temp.g...
b0d4f5f2-175c-4a55-8145-64c2fd3da6e4
7
public boolean canMove(MoveDirection direction) { Iterable<Point> iterable = pointIterator(direction); for (Point candidate : iterable) { boolean isRealPoint = !isEmpty(candidate.y, candidate.x); if (!isRealPoint) { continue;// discard 0's } int destY = candidate.y + direction.yAddition; int des...
c075b3f1-945b-4c30-ac56-428a3d71718e
2
public int findEmpty() { for(int i = 0; i < array.length; i++) { if(array[i] == null) { return i; } } return -1; }
108aaf7a-4a6d-48d0-b13a-00eda351be33
8
public void setDirection(Direction direction) { this.direction = direction; float spriteIndex = 0; switch(direction) { case SOUTH: spriteIndex = 0; break; case SOUTHWEST: spriteIndex = 1; break; case WEST: spriteIndex = 2; break; case NORTHWEST: spriteIndex = 3; break; case ...
8e7293ef-18f8-454a-8dcf-828e68ab05e2
5
public void update(GameContainer gc, int delta) { animateBasedOnUserInput(input); if (movementButtonIsPressed(input)) current.update(delta); float speedInTilesPerSecond = 3.0f; float pixelsPerTile = 32.0f; float distance = speedInTilesPerSecond * pixelsPerTile * delta / 1000f; if (input.isKeyDown(Input.KE...
acc351cc-20aa-4150-b435-231b4f4bbaf9
5
@Override public String filter(String str) { StringBuffer result = new StringBuffer(128); //String[] tokens = str.split("<.*>"); boolean ignore = false; for(int i = 0;i < str.length(); i++){ if(str.charAt(i) == '<'){ ignore = true; }else if(str.charAt(i) == '>'){ ignore = false; continue; ...
42b8eb3a-5a02-4186-bba4-6763fd593a17
6
public void decreaseKey(Position<T> pos, T newVal) { if (pos == null) { System.out.println("POS IS NULL"); return; } PairNode<T> p = (PairNode<T>) pos; if (p.element == null || compare(p.element, newVal) < 0) { return; } p.element = ...
63d60462-47fe-40ab-90f9-f9bb5e45cec0
4
static HashMap[] generateTransactions(Class documentClass, int ownerId) throws Exception { int count = ownerId % 4; // make sure the first owner has an account if (ownerId == 0) { count = 3; } if (count == 0) { return null; } HashMap[] tran...
f0466b85-7011-4003-bb58-38c8a76a2897
5
public WlanScanner(){ data = new LinkedBlockingQueue<MacRssiPair[]>(); // Queue between communicator thread and this thread pos = new LinkedBlockingQueue<Position>(); // Queue between this thread and the viewer thread sendPos = new LinkedBlockingQueue<Position>(); // Queue between this thread and the WebSender th...