method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
e2845a01-d4a5-4948-b230-dd8605bf0158
5
private static byte method513(char arg0) { if (arg0 >= 'a' && arg0 <= 'z') { return (byte) (arg0 - 97 + 1); } if (arg0 == '\'') { return 28; } if (arg0 >= '0' && arg0 <= '9') { return (byte) (arg0 - 48 + 29); } else { return 27; } }
9580cc60-a6f8-409b-97d2-f4bf5ab67ece
6
public double Dtf2d(int ihour, int imin, double sec) throws palError { /* Preset status */ Status = 0; TRACE("Dtf2d"); /* Validate sec, min, hour */ ENDTRACE("Dtf2d"); if ((sec < 0.0) || (sec >= 60.0)) { Status = 1; throw new palError(1, "Dtf2d: s...
fc229b84-1213-4423-996e-98d7898f45cb
3
public static int getIndexOfFac(String lName, boolean gender) { Teacher thisTeach = new Teacher(); for(int i = 0; i < Faculty.size(); i++) { thisTeach = (Teacher)Faculty.get(i); if(thisTeach.getName().equals(lName) && thisTeach.getGender() == gender){ System.out.println("index of faculty :" + i); re...
bb54a840-3991-4c55-b661-a033620286fc
3
public static String getObjectType(Object o) { if (o instanceof Cow) { return "Корова"; } else if (o instanceof Dog) { return "Собака"; } else if (o instanceof Whale) { return "Кит"; } return "Неизвестное животное"; }
0f77b85b-5bad-4112-a4b8-3b1a05df1a6a
0
public void setControleur(CtrlAbstrait controleur) { this.controleur = controleur; }
4c34cc46-9b9a-4012-b34f-5b6b66d6bc4c
9
public static boolean validOptions(String options[][], DocErrorReporter reporter) { boolean foundDestDirOption = false; boolean foundApiHostOption = false; boolean foundTitleOption = false; boolean foundDescriptionOption = false; for (int ...
c2995865-9a51-474f-a2ac-e35b85a041e1
7
static final int method2279(boolean bool, int i, int i_14_, int i_15_, int i_16_) { anInt3828++; int i_17_ = i & 0xf; if (bool != true) aClass351_3825 = null; int i_18_ = (i_17_ ^ 0xffffffff) > -9 ? i_16_ : i_15_; int i_19_ = ((i_17_ ^ 0xffffffff) > -5 ? i_15_ : i_17_ == 12 || (i_17_ ^ 0xffff...
a27aa521-6414-44f0-961a-ae166f11fd80
8
public void click(int x, int y, boolean leftMouse) { int xGridPos = (int)Math.floor(x / Plot.SIZE); int yGridPos = (int)Math.floor(y / Plot.SIZE); if (metaRound <= 2) { if (validClick(x, y)) { buyProperty(xGridPos, yGridPos, 0); // ...
461fa086-e088-4d47-afc2-17149c964e89
6
public String getParameterString(){ String retString = ""; try{ if(url!=null) retString+="&url="+URLEncoder.encode(url,"UTF-8"); if(html!=null) retString+="&html="+URLEncoder.encode(html,"UTF-8"); if(text!=null) retString+="&text="+URLEncoder.encode(text,"UTF-8"); if(customParameters!=null) retString+=c...
92e56eef-550f-4ea8-8193-b6453840a6d5
7
public static void checkRank(Player player, int mode, String boss) { long dominionFactor = player.getDominionTower().getTotalScore(); for (int i = 0; i < ranks.length; i++) { DTRank rank = ranks[i]; if (rank == null) break; if (rank.username.equalsIgnoreCase(player.getUsername())) { ranks[i] = new ...
cff5724b-279d-4ecb-bc83-d080a73282f6
8
private void rescanDatabase() { // get all songs from DB Vector<Song> databaseList = new Vector<Song>(); databaseList = myDatabase.getSongs(""); // get all songs from HD final String mp3Dir=Settings.get("mp3Dir"); File mp3dir = new File(mp3Dir); Vector<File> mp3Files = new Vector<File>(); mp3Files = ...
01e7412d-5cd3-4f99-93f3-2e286215c43f
7
@Override public boolean equals(Object o) { if (!(o instanceof Tuple_comparable)) return false; Tuple_comparable oo = (Tuple_comparable)o; if( oo.arg1_type.length() != this.arg1_type.length() ) return false; if( oo.relation.length() != this.relation.length() ) ...
be64f0e0-7760-4f0e-ae3d-ef3396ce86d1
0
public final void setWrapWidth(double wrapWidth) { this.wrapWidth.set(wrapWidth); }
9a2dab4a-7de6-48fe-a061-7a14a5720678
3
public double function( double[] x){ // Box-Cox transform if(x[0]==0){ for(int i=0; i<nData; i++)yTransform[i] = Math.log(shiftedData[i]); } else{ for(int i=0; i<nData; i++)yTransform[i] = (Math.pow(shiftedData[i], x[0]) - 1.0)/x[0]; } // Sort tr...
15096467-3e75-4a91-8509-b52a2544dce3
7
private JSONArray readArray(boolean stringy) throws JSONException { JSONArray jsonarray = new JSONArray(); jsonarray.put(stringy ? readString() : readValue()); while (true) { if (probe) { log("\n"); } if (!bit()) { if (!bit()) {...
2cdc183e-2be5-4194-90ff-dab163b4af8c
2
public synchronized String call(Integer i) { input = i; notify(); while ( result == null ) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } String local = result; result = null; return local; }
e09c8250-8db1-43ef-a18d-81b935908b80
5
private void systemLogin() { try { if(txtUserName.getText().trim().length() != 0) { if(pfdUserPassword.getPassword().length != 0) { String userName = txtUserName.getText(); String userPassword = ""; for(char c : pfdUserPassword.getPassword()) ...
f8707e9b-0613-4434-bdf5-42a7fc4b77df
6
@Override public void update(double dt) { super.update(dt); box.x = (int) e.getX() - (int) (box.width/2); box.y = (int) e.getY() - box.height; if( !validBox) currentText = (int) ((time / TIME_BEFORE_NEXT_STR) % texts.length); else if(input.validate.released || input.leftButton.released) currentT...
7b33354f-3e59-45aa-8b2d-65446016b9d5
0
@Override public String toString() { return "Third State"; }
47a9f987-618f-4978-845c-24477fe14ded
4
public void processData(byte[] data) { Object obj = Utils.deserialize(data); if (obj instanceof Protocol) { String command = ((Protocol) obj).getCommandName(); Console.log("[TCP] command " + command + " accepted."); switch (command) { case INSTANTIATE_...
88e2f3a5-665f-4b53-8f30-90498f981650
5
private static int decode0(char[] ibuf, byte[] obuf, int wp) { int outlen = 3; if (ibuf[3] == '=') { outlen = 2; } if (ibuf[2] == '=') { outlen = 1; } int b0 = STANDARD_DECODE_TABLE[ibuf[0]]; int b1 = STANDARD_DECODE_TABLE[ibuf[1]]; ...
2b4acb47-9b0d-4a02-b89a-d502c60a617c
7
public void update() { if(opening) { double time = (double)Time.getTime()/(double)Time.SECOND; if(time < openTime) { double lerpFactor = (time - startTime)/(openTime - startTime); transform.setPosition(openPos.lerp(closedPos, (float)lerpFactor)); } else if(time > openTime && time < ...
3194f933-7b8a-44ed-bdab-641b3475d6c2
6
public void DEMITIUsuario(int CODUSUARIO) throws SQLException, excecaoDeletarElemento { Connection conexao = null; PreparedStatement comando = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement(SQL_DEMITI_UM_FUNCIONARIO); ...
8145a967-e04f-4661-b76b-e6a7b7a071cb
7
private void readAttributesAll(ScanfReader scanReader, IndividualAttributeMaps iam, HashMap colorList,String fname) throws IOException { String name = null; while (!(name = scanReader.scanString()).equals("end")) { double hr=1.0; double hrNotUsing; if (name.equals("at...
bf939b43-1c0f-4cd0-86fd-a5ea72d241eb
4
public boolean reset() { if (P2character.equals("White")) { return whiteKnight.ifDead(); } else if (P2character.equals("Bond")) { return jamesBond.ifDead(); } else if (P2character.equals("Ninja")) { return redNinja.i...
ab8e2c1f-c293-4302-9d70-9d9281b1a853
6
private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(8, active0); return 9; } switch(curChar) { case 100: ...
17b0a39b-72d5-49b5-82b1-06b9be1e81b5
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...
b8c24088-3663-42f8-9b9d-7072b50ddb6f
5
public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } if (property == null) { throw new PropertyNotFoundException("No property specified"); } FacesContext fcontext = (FacesContext) context.getContext...
437322ea-9356-4ef0-bf87-a67959a8da46
4
public void drawEnemies(Graphics g, Enemy enemy){ if( enemy.getDirection() == Tank.direction_up){ g.drawImage(enemy1Up, enemy.getLocation_x(), enemy.getLocation_y(), enemy.getWidth(), enemy.getHeight(), this); }else if(enemy.getDirection() == Tank.direction_down){ g.drawImage(enemy1Down, enemy.getLocation_x()...
7757daff-379c-4a70-8854-4200c563c3e7
5
public Point getTileCollision(Secundarios s, double newX, double newY) { double fromX = Math.min(s.getPosX(), newX); double fromY = Math.min(s.getPosY(), newY); double toX = Math.max(s.getPosX(), newX); double toY = Math.max(s.getPosY(), newY); // get the tile locati...
2a4cd97a-9134-4aac-8167-415632d8fa43
6
@Override public Point2D move() { Point2D nextStep = null; Point2D mumperPos = getPosition(); Point2D destPoint = mumperHouse; if (isLookingForBottle) { if (tmpDest != null && tmpDest.equals(mumperPos)) { tmpDest = null; } if (tmpDe...
080b92cb-b12c-49f3-af6f-cceb7f93e472
8
public void init() { grbit = getRecord()[1]; /* john, the following syntax was not reliable, switched with syntax below.... bitAttrIf = ((grbit & 0x2) >> 4); */ // 20060501 KSC: Changed bitAttrVolatile operation + some names // if ((grbit & 0x1)== 0x1){bitAttrSemi = 1;...
fd8083c9-6a0e-4e2f-bbcd-881f7952d01c
2
public ArrayList<Score> getScores() { ArrayList<Score> scoreList = new ArrayList<Score>(); xmlParser.setPath(new Strings().FILE_TO_XML_HIGHSCORE); xmlParser.build(); NodeList nodeList = xmlParser.getAllValue("player"); for (int temp = 0; temp < nodeList.getLength(); temp++) { Node nNode = nodeList.it...
6cfdf5ac-865b-477a-8537-5a0a03a87021
2
public void Add() throws Exception { String name = ""; BufferedReader reader; reader = new BufferedReader(new InputStreamReader(System.in)); while (n.isNameExists(name) || name.equals("")) { System.out.print("What is your name? "); name = reader.readLine(); ...
06959f88-8de8-41d9-ac57-5093642716cb
5
public static ArrayList<MediaCopy> searchMediaByGenre(String genre){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ArrayList<MediaCopy> medi...
19999616-36e8-4b79-b2bb-e2aee14fe202
5
private static String format(String message, Object... params) { message = String.valueOf(message); StringBuilder builder = new StringBuilder(message.length() + (16 * params.length)); int messageStart = 0; int index = 0; if (params.length == 0) { return builder.app...
19bcb5e9-35fb-4337-b1de-bc4c59783135
2
public void actionPerformed(ActionEvent e) { Component[] components = getComponents(); for (Component c : components) { if (c != e.getSource()) { ((CPIconButton) c).setSelected(false); } } ((CPIconButton) e.getSource()).setSelected(true); }
efacf5e7-0c5b-46dd-a6cb-59b4d1c53760
0
@Override public void remove() { }
f89543e8-100b-47bb-8a48-43ce7fd04133
6
@Override protected Menu<?> getMenu(int i, Factory factory) { Menu<?> menu; switch (i) { case 1: menu = factory.newMenuChooseFromList(ChooseFromListMenuName.CHOOSE_ORDER_TO_EXECUTE, executableOrders, player); break; case 2: if (choices.getOrderChosen().getType() == OrderType.RESEARCH && choice...
bbac90b6-94ba-433f-afe0-9ab41dfb1dc8
9
private void viewScreen(int teamNumber, int leagueNumber, String action, HttpSession session, Connection database, HttpServletRequest request, HttpServletResp...
f8ac8174-27bf-49c5-a6fc-9665f8df2abb
0
public JButton getjButtonPrec() { return jButtonPrec; }
40faaf3d-2085-40b5-9804-2660c0aa8d33
8
public void loadSettings() { try { BufferedReader br = new BufferedReader(new FileReader(settings)); String input; while((input = br.readLine()) != null) { if(input.startsWith("isDisabled:")) { setDisabled(input.split(":").equals("true")); } else if(input.startsWith("disabledCommand:")) { ...
f939f801-e093-4241-80e7-f0b19757e7dc
6
public static boolean isReady(int slot) { if (getSlotType(slot) == ActionSlotType.NOTHING) return false; WidgetChild rchild = getReloadChild(slot), ichild = getItemChild(slot); return rchild != null && rchild.validate() && !rchild.visible() && ichild != null && ichild.validate() && ichild.getTextColor() ==...
037484f2-c046-415e-88f1-042613f013e5
7
public void update(){ player.update(); player.checkAttack(enemies); player.checkCoins(coins); finish.update(); finish.checkGrab(player); bg.setPosition(tileMap.getx(), 0); tileMap.setPosition( GamePanel.WIDTH / 2 - player.getx(), GamePanel.HEIGHT / 2 - player.gety()); if(player.i...
54c91cc3-8056-4329-82b4-fe894671321f
6
static Move getRandomMoveOfFirstMovableTile(Board board, Team team) { // Check inputs if (board == null) { throw new IllegalArgumentException("BoardImpl can't be null"); } if (Team.NEUTRAL.equals(team)) { throw new IllegalArgumentException("Invalid team: " + team); } // Find the fir...
4e2afc0c-d021-4345-b0e5-2daa90cd52c1
4
private int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(10, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(11, active0); return 12; } switch(curChar) { case 1...
5076b0f1-b8b4-46f8-8b5b-bb9fcdceb6a5
0
protected void setCanvas() { stages[5].setVisible(true); myCanvas.reset(); myCanvas.addText("w ="); myCanvas.addText(((RegularPumpingLemma)myLemma).getX(), "x"); myCanvas.addText(((RegularPumpingLemma)myLemma).getY(), "y"); myCanvas.addText(((RegularPumpingLemma)myLemma)...
cb9908d8-674a-4d09-a391-60c1e7a617f1
5
public void addPCData(Reader reader, String systemID, int lineNr) { int bufSize = 2048; int sizeRead = 0; StringBuffer str = new StringBuffer(bufSize); char[] buf = new char[bufSize]; for (;;) { if (sizeRead >= bufSize) { ...
24d814d7-423a-45d5-80e3-258a4782351c
2
public static void main(String[] args) { try { List<String> list = MySQLConnect.getAllTables("show tables", "shoop"); String packeName = "com.web.core"; Iterator<String> it = list.iterator(); List<ModelClassDesc> mcds = new ArrayList<ModelClassDesc>(); while (it.hasNext()) { String tableName...
bb365074-127a-42c1-aefe-2882432a600e
4
public String openRECEIVE(DatagramPacket syn) throws IOException{ Transporte t = new Transporte(initTransporteACKeSYN); Transporte t1 = new Transporte(initTransporteACKeSYN); seq = 100; //desencapsula SYN e reconhece o endereco/porta do outro terminal t1 =...
aec4cf89-9191-42d3-bf77-07f04462dc6b
5
public static String putInvertedPieceInCross(Cube cube, TileColor c) { int count = 0; String movements = ""; while (cube.getColor(Cube.getOthers(getPos(cube, c)).get(0)).getInt() != getPos(cube, c)[0]) { cube.turn(Turn.U); count++; } if (count == 1) { movements += ",U"; } else if (count == 2) { ...
ac40046a-bb8e-4a66-af09-a8b7b5fdae63
5
@Override public void execute(Game game, HashMap<String, String> strings, Entity target) throws ScriptException { if (args[0].toLowerCase().equals("p")) { game.getPlayer().face(getDir(game, args[1])); } else if (args[0].toLowerCase().equals("t")) { try { ((Walkable) target).face(getDir(game, args[1])); ...
3b6078c2-6ead-4205-bad3-5391c5e3b433
1
@Override public boolean isEmpty() { int size = ah.size(); return size == 0 ? true : false; }
f4c784cc-f19e-49f3-b24c-4795928d39ca
2
public Event(EventType eventType, Object originator) { if (originator == null || eventType == null) throw new IllegalArgumentException("The given originator is invalid!"); this.eventType = eventType; this.originator = originator; }
8dac39d7-f0a5-47d1-882c-d34046ea3609
2
public int getLightGrenadeCoverage() { int nrSquaresLg = 0; for(Element e : elements){ if(e instanceof LightGrenade){ nrSquaresLg++; } } return (nrSquaresLg*100/gridSize()); }
1aa378f9-ca49-4659-9cc0-ff287b123c4e
7
public boolean isMatch2(String s, String p) { if(p.isEmpty()) return s.isEmpty(); if(s.length() >= 1 && (s.charAt(0) == p.charAt(0) || p.charAt(0) == '?')){ if(p.startsWith(p.charAt(0) + "*")){ return isMatch(s.substring(1), p) || isMatch(s, p.substring(2)); }els...
750d2ded-d606-474a-9657-2a58041892be
2
public synchronized void setStartButtonEnabled(boolean b){ if(b){ abort.setBorderPainted(false); } else{ start.setBorderPainted(false); } abort.setEnabled(!b); start.setEnabled(b); roundsToPerform.setEnabled(b); refreshRate.setEnabled(b); for(JButton button : disabledButtonList) { butt...
454258e3-ba1a-438d-bf41-4956fbd6db77
1
public OnlineStatusKeepingHandler(Socket jsocket, String userName, GUIMain main) { // TODO Auto-generated constructor stub socket = jsocket; countDown = 15; myUserName = userName; mainForm = main; try { out = new DataOutputStream(socket.getOutputStream()); in = new DataInputStream(socket.getInput...
fcd72079-442e-4f95-85bc-166b6332cd08
3
public void refresh() { listModel = new DefaultListModel<>(); for(BusinessObject mortgage :mortgages.getBusinessObjects()) { if (!listModel.contains(mortgage)) { listModel.addElement(mortgage); } } mortgagesList.setModel(listModel); mortgag...
c3c2d7c7-e53a-4c22-8342-34eb4a084ef5
8
private void createDatabaseIfNeeded() { try { Connection connection = getConnection(); connection.setAutoCommit(true); sqlStatement = connection.createStatement(); boolean clientExists = false, itemExists = false; int tableNameColumn = 3; ...
823d991c-7869-43b7-a6bf-cdd1105af6f2
1
public AuthorBuilder nameAsInstitution(String nameAsInstitution) { this.nameAsInstitution = nameAsInstitution; if (!nameAsInstitution.isEmpty()) { this.name = "null"; this.middleName = "null"; this.surname = "null"; this.secondSurna...
4db288f1-8cec-462c-ac97-708a6517f082
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace...
78801fe7-8932-4284-9be5-20c80e3f1bcf
9
private void ensureArrays(int level) { if (level > _handLength) throw new IllegalStateException("Illegal to request card " + level + " arrays from an " + _handLength + " FST"); try { if (!haveArrays()) readArrays(); } catch (FileNotFoundException e) { System.out.println("FST ...
d773ab26-5ac1-4816-b872-440ddf022ba3
5
public boolean displayPlayerTurn(Game.PlayerTurn player) { boolean test = false; if (test || m_test) { System.out.println("GameWindow :: displayPlayerTurn() BEGIN"); } if(player == Game.PlayerTurn.PLAYER1){ getDrawing().setPlayerTurn(player, !(m_gameControl.getPlayer1() instanceof Huma...
cb968f35-dcc6-4493-924f-414535d94c53
0
public boolean isSelected(TreeNode node) { return selectedNodes.containsKey(node); }
6d7650a1-33e2-4604-97ba-58db8eb80b8a
5
public boolean wins(Hand hand1, Hand hand2) { if (hand1 == null || hand2 == null) { return false; } int value1 = getHandValue(hand1); int value2 = getHandValue(hand2); if (value1 > value2 && value1 <= TWENTY_ONE) { return true; } else { ...
8baadd04-0068-44fc-afe8-9a2231f8f521
1
public String GetResName() { if (res.get() != null) return res.get().name; else return ""; }
6f89107d-f944-4775-8b0d-8c592d3d8497
7
private ObjectMap<String, FieldMetadata> cacheFields (Class type) { ArrayList<Field> allFields = new ArrayList(); Class nextClass = type; while (nextClass != Object.class) { Collections.addAll(allFields, nextClass.getDeclaredFields()); nextClass = nextClass.getSuperclass(); } ObjectMap<String, FieldMet...
d893f1b2-2c59-4cd7-925c-cfd5a91b2496
2
public void mouseReleased(MouseEvent e) { if (!onClickDown && mouseOver) { callActionListeners(); } mousePressed = false; repaint(); }
374a25e3-557c-4f65-81f8-b27a318d92da
5
private InputStream getInputStreamForMap(String fileName) { FileInputStream f = null; try { if (fileName == null) throw new FileNotFoundException(); f = new FileInputStream(new File(fileName)); } catch (FileNotFoundException e) { if (fileName != null) Debug.printWarning("Map " + fileName + " ...
778bd922-5dd8-4b62-858a-d96fe30f2299
2
public static boolean isEmpty( Iterable<?> iterable ) { if ( iterable == null ) { return true; } return iterable.iterator().hasNext(); }
e0f68134-50c5-45eb-8e06-be4f4b4847f7
1
private final Short c(int k) { k &= 0xffff; return k >= 256 ? new Short((short) k) : j[k]; }
4b242e71-fbad-4350-8a15-2267c62e7e5c
3
public String decrypt(String inputFileName, String key) throws Exception { if (!getExtension(inputFileName).equalsIgnoreCase("cheng")) { // the input file must have extension .cheng return "Your File has wrong extension."; } SecretKeySpec tempKey = null; // if user has put in the key, generate a key by th...
1cded117-28b8-4194-b29f-5e0ec448f5a0
6
public void checkCollisionObject(Direction direction) { final Direction opposite = direction.getOpposite(); final MiddleLayer middleLayer = middleLayers.get(player.getCoords()); if (middleLayer != null && !middleLayer.passable()) { movePlayer(opposite); } final LowerLayer lowerLayer =...
84301525-8d7d-4bd6-89f2-dccd589b020d
4
public ItemCollection parse() { int cap = -1; ArrayList<Item> items = new ArrayList<Item>(); try { BufferedReader br = new BufferedReader(new FileReader(file)); String line; boolean first = true; while ((line = br.readLine()) != null) { ...
34f3ff9b-6629-47a1-8be9-95190352a184
2
private void updateObstacles(String obs){ LinkedList<Obstacle> obstacles = new LinkedList<Obstacle>(); String[] tokens = obs.split(" "); for(String token : tokens){ String[] data = token.split(";"); if(data.length == 4){ obstacles.add(new Obstacle( new Position(data[0], data[1]), Float.parse...
4dbe3200-bfba-4b7f-943a-947d3decaafd
2
public PokeDB(FileHandle folder) { FileHandle[] pf = folder.list(".poke"); pokemonList = new HashMap<Integer, String>(); nPokemon = 0; for (int i = 0; i < pf.length; i++) { Pokemon p = Pokemon.getPokemon(pf[i].nameWithoutExtension()); pokemonList.put(p.number, pf[i].nameWithoutExtension()); if (nPok...
52982dcd-f23a-4128-8680-7dbb1bf8efd9
0
public RegisterLocalWebDriversService() { localWebDrivers = Arrays.asList( new LocalFirefoxWebDriver(), new LocalChromeWebDriver(), new LocalIEWebDriver(), new LocalSafariWebDriver(), new ...
68e52673-2fa4-443c-9342-b51520b0807c
1
@Override public Object clone() { StringList newList = new StringList(); for (int i = 0; i < this.size(); i++) { newList.add(this.get(i)); } return newList; }
ccb24d75-52ad-4cfc-a662-ac0838b47da1
1
public String toString() { DecimalFormat h = new DecimalFormat("##"); DecimalFormat m = new DecimalFormat("#0"); DecimalFormat s = new DecimalFormat("00"); if(hours > 0) return h.format(hours) + ":" + m.format(minutes) + ":" + s.format(seconds); return m.format(minutes) + ":" + s.format(sec...
8a6cbf45-8615-4a10-93d7-fd32c95e5604
7
public void handleBed(Packet70Bed par1Packet70Bed) { EntityPlayerSP var2 = this.mc.thePlayer; int var3 = par1Packet70Bed.bedState; if (var3 >= 0 && var3 < Packet70Bed.bedChat.length && Packet70Bed.bedChat[var3] != null) { var2.addChatMessage(Packet70Bed.bedChat[var3]); ...
ed00d6d1-93a8-4efb-8414-69d194fd21d7
9
public void defInteraction(BombDeflagration bombDef) { for(Direction dir : Direction.values()) { for(int[] newpos : bombDef.getListe(dir)) { for(Link l : link) if(doesTouch(newpos, bombDef, l)) l.getDamage(1); if(bombDef.getPlayer() != null) for(Monster m : monster) if(doesTouc...
82d1c712-5387-4831-b0ca-6041d2cbeec2
3
public List<Frame> getFramesForTargetHeadIDref(String targetIDref){ List<Frame> result = new ArrayList<Frame>(); for(Frame frame: frames){ if(frame.getTargetLemmaIDref().equals(targetIDref)) result.add(frame); } return (result.size()>0?result:null); }
1b828fe5-9d10-4659-bef3-563e7fc0f425
0
public list() { this.info = "list all venues"; }
4a91c8c0-8fa8-400e-94a7-42bdec178415
6
public boolean loadViewImage(String imageSrc) { boolean rval = false; System.out.println("loadViewImage " + imageSrc); if (imageSrc.length() < 2) return rval; if (imageSrc.startsWith("http://")) { try { URL url = new URL(imageSrc); System.out .println("ImageIO.read(new URL('" + imageSrc + "'...
173f0bf3-0a31-4dea-b6ec-dff051a47c94
0
public FractalPanel() { super(); addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent e) { needsRepaint = true; repaint(); // ...
7f8da646-1df8-458d-b5f0-f1f14098e323
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final NativePointerObject other = (NativePointerObject) obj; if (buffer == null) ...
7c5b33a3-39dd-4536-a40d-a0db81735ce2
7
private void method91(Stream stream, int i) { while(stream.bitPosition + 10 < i * 8) { int j = stream.readBits(11); if(j == 2047) break; if(playerArray[j] == null) { playerArray[j] = new Player(); if(aStreamArray895s[j] != null) playerArray[j].updatePlayer(aStreamArray895s[j]); } ...
5e03b82c-fc2e-4461-b076-55b4d0080be6
6
public int compareDateTo(DateTime date) { if (this._year == date.getYear()) { if (this._month == date.getMonth()) { if (this._day == date.getDay()) { return 0; // equal } else if (this._day > date.getDay()) { ret...
42502085-203b-4d0e-8b70-546bbc17d917
9
public static Cons loomRelatesToKif(Cons tree, Cons implicitvariables) { if (tree.value == Logic.SYM_LOGIC_RELATES) { tree = tree.rest; } { Cons clauses = Stella.NIL; Cons existsvariables = Stella.NIL; Cons arguments = Stella.NIL; Cons skolemvariables = Stella.NIL; { Symbol v ...
ac1e7556-ef24-4568-8114-2aabca4479a5
9
@Override public boolean keepCombating(Entity victim) { boolean isRanging = PlayerCombat.isRanging(player) != 0; if (!war.isCanCommence()) { player.getPackets().sendGameMessage("The war hasn't started yet.", true); return false; } else if (player.getCurrentFriendChat().getPlayers().contains(victim)) { p...
433ea5c5-092e-4031-916a-63c3e3c26968
7
private Boolean writeData(String data){ try { URL url = new URL(this.curlURL); String auth = this.authType.name().toLowerCase(); char[] stringArray = auth.trim().toCharArray(); stringArray[0] = Character.toUpperCase(stringArray[0]); auth = new String(stringArray); HttpUriRequest req = null;...
51a85b2b-bbe3-4aa3-bae6-6aac6cac041b
1
private String display() { String marDisplay = ""; if (registerContents == -1) { marDisplay += ""; } else { marDisplay += this.registerContents; } return marDisplay; }
6d1286ba-e360-446f-9153-e933ea5048ac
7
public void SortPlayerAssists() { Collections.sort(playerVector, (Player p1, Player p2) -> { if (p1.getPosition().getPosID() == Position.PosID.GOALIE) { if (p2.getPosition().getPosID() == Position.PosID.GOALIE) { int shots = p1.getAssists() + p1.getGoals(); float perc1 = (shots == 0 ? 0 : (100 - ...
34b538db-8d60-4261-8358-fd17c30e75c8
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...
90a4f57d-834f-4f96-bfcf-a1624b29c7ff
1
public void unchoke() { if (this.choking) { logger.trace("Unchoking " + this); this.send(Message.UnchokeMessage.craft()); this.choking = false; } }
31829396-46c9-4eb3-a44e-25a11091ba9e
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...
d0081141-2e0e-4b30-8341-3c17c9637753
4
public Month(DayNames start, int numDays, int curYear, String aName) { totalNumDays = numDays; this.name = aName; year = curYear; days = new Day[7][6]; int st = start.getVal(); startDay = start.getVal(); int dayCounter = 1; for (int j = 0; j < 6; j++) { for (int i = st; i < 7; i++) { Date temp ...
f0d638f3-0a1d-41f6-a6ee-dadcbf9c4907
9
public String addBinaryStrings(String a, String b) { char aChars[]=a.toCharArray(); char bChars[]=b.toCharArray(); StringBuilder sb = new StringBuilder(); int i=aChars.length-1; int j=bChars.length-1; int carry = 0; while(i>=0 || j>=0 || carry==1){ ...
0b2d1b4b-52b7-4ce7-8a45-80b4b98b0aca
2
public static void handleSubscribeReply(HTSMsg msg, HTSPClient client) { Collection<String> requiredFields = Arrays.asList(new String[]{}); if (msg.keySet().containsAll(requiredFields)){ //TODO } else if (msg.get("error") != null){ //TODO } else{ System.out.println("Faulty reply"); } }