method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
38873982-8ed8-4fa1-8122-27818202530c
1
private void showDirOpenDialog(){ JFileChooser fileOpen = new JFileChooser(directoryPath.getText()); fileOpen.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // FileNameExtensionFilter filter = new FileNameExtensionFilter( // "Algorythm workspace files .wks", "wks"); // ...
a734e9ad-9c9b-46bd-a401-339dc3949835
1
public long getElapsedTicks() { long cur=System.currentTimeMillis(); long l=cur-ticks; if (l>=granularity) { ticks=cur-(l%granularity); return l/granularity; } return 0; }
f357e7d6-22db-4d35-a3f5-e6bb7bb60ad4
4
public void run(){ //mientras haya un elemento en el buffer while(mibuffer.getSize()>0){ //Pasar a la lista del consumidor synchronized(mibuffer){ if(mibuffer.isEmpty()) try { mibuffer.wait(); } ...
41379653-5776-42c1-bd18-e98e7669045e
0
public int GetFirstTicks() { //get the tick time the bus got to the first bus stop return firstTicks; }
4f442f8d-7d3d-453f-994e-299db923b7e0
1
public static void main(String[] args) throws Exception { int port; if (args.length > 0) { port = Integer.parseInt(args[0]); } else { port = 8080; } new HttpServer(port).run(); }
9d32037a-04bd-46c8-a0e8-604959f17fa3
1
public static void main(String[] args) throws InterruptedException { new Thread(new Runnable() { @Override public void run() { int i = 0; while (!isDone()){ i++; } System.out.println("done!"); } }).start(); System.out.println("OS: " + System.getPr...
3ab22f97-af4f-4c0d-8d22-62ec8002d86b
2
public static int getColorOfPiece(Board b, Position p) { if (b.board[p.rank][p.file] < 0) { return Board.black; } else if (b.board[p.rank][p.file] > 0) { return Board.white; } return 0; }
2efcc2bb-42ff-4e17-889f-478737056fed
3
public static void main(String[] args){ Scanner in = new Scanner(System.in); double cups = 0; double medals = 0; for(int i=0;i<3;i++){ cups+=in.nextInt(); } for(int i=0;i<3;i++){ medals+=in.nextInt(); } int n = in.nextInt(); System.out.println(((int)Math.ceil(cups/5)) + ((int)M...
d2f7308e-1f36-4b1d-9dff-42b28cd5c8cf
7
@Override public void onMessage(String message, Object o) { System.out.println("Game_Started = " + this.game_started); if (this.game_started) { try { super.onMessage(message); switch (message) { case "pushSessionUpdate": ...
143493ff-742f-4e5b-ba0d-b1ee6053c3ec
9
public static Sequence parse(List<Map<?, ?>> list) { if (list == null || list.isEmpty()) { throw new NullPointerException(); } List<Frame> frameList = new ArrayList<Frame>(); for (Map<?, ?> frame : list) { int time = (Integer) frame.get("time"); ...
c99e5f5d-ad13-45c4-8a80-49b91d9f2893
1
public List<String> getKeys() { List<String> keysList = new ArrayList<String>(); iter = bucket.iterator(); while(iter.hasNext()) { keysList.add(iter.next().getKey()); } return keysList; }
d48d7c72-56f1-4c41-8107-4581ff993aec
2
public void step(double deltaT) { for (Collider collider : colliders) { //TODO: check Vector3d operations and make physics for sphere jump. if (!collider.isStatic()) { Vector3d location = collider.getCenter(); Vector3d velocity = collider.getVelocity(); ...
2a499d8f-14f5-433a-b65a-01a1ed684e02
2
protected static String processTranslation(String text) { StringBuilder output = new StringBuilder(""); String[] arr = text.split("\\|"); if (arr.length == 2) { return ""; } String languageOfTranslation = arr[1]; for (int i = 2; i < arr.length; i++) { ...
0c6cb1cb-22ee-4441-8d1e-f0a2d6735033
1
public void sendMessageRequest(Request message) throws IllegalBlockSizeException, BadPaddingException, IOException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException{ if(message instanceof LoginRequest){ byte[] encode = this.encodeBase64(((LoginRequest) message).getChallenge()); String m = "!l...
1a2e64d3-f3da-4122-93ce-f33c676a7cc7
9
@Override public int[] getLigneDir(int pos, Direction d) { int size = 0; int i; int dir = 0; ArrayList<Integer> ligne = new ArrayList<Integer>(); switch (d) { case V: dir = 0; break; case Hg: dir = 1; break; case Bg: dir = 2; break; } size = c[pos][dir].length; for(i = 0; i <...
ab11ef66-20e7-4c45-9277-9a26d61fd05a
4
private static void playLocallyAgainstAsBlackRandomOpponent() { try{ Random randomGenerator = new Random(); PlayChess blackTeam = new PlayChess(Board.black); while (true) { System.out.println("MOVING FOR WHITE RANDOMLY"); if (blackTeam.board.gameIsOver()) { System.out.println("Game over"); ...
9f9c167f-cf49-4639-9f21-4b70ead519ea
6
static public void commitSlots(Player p, SerializableInventory inv) { try { reconnect(); PreparedStatement delete = con.prepareStatement("DELETE FROM `inv_slots` WHERE `server` = ? AND `player` = ?"); delete.setString(1, SQLWrapper.plugin.getConfig().getString("general.server.name")); delete.setString(2, ...
dc0a220a-43bc-49c3-9f76-fb4588fabe12
3
static public BukkitDatabase findDatabase(String name, String pluginName) { for (BukkitDatabase dbase : DATABASES) { if (name.equalsIgnoreCase(dbase.getName())) { if (pluginName.equalsIgnoreCase(dbase.getOwnerName())) { return dbase; } } } return null; }
123021d0-d457-44d5-90bb-03d825c90e31
2
@Override public Label predict(Instance instance) { int i = 0; double y = 0.0; for (Instance ins : instances) { // System.out.println("i is:" + i); y += dualParam[i] * labels[i] * kernel.value(ins, instance); i++; } if (y > 0) { return new ClassificationLabel(1); } return new ClassificationLab...
0d11ba57-9c5a-41fc-a454-bd74b18f23c2
8
public void keyTyped(KeyEvent event) { char c = event.getKeyChar(); if (c == 'e' || c == 'E') { view.dispose(); System.exit(0); } else if (c == 'p' || c == 'P') { model.setPause(! model.getPause()); } else if (c == 'f' || c == 'F') { view.setFlipVertical(! view.getFlipVertical()); } else if(c =='r...
b5ec27e1-5739-4f04-b286-1c7cc5014d67
9
public String converter( int i ) { if (i == 0) { return "a"; } else if (i == 1) { return "b"; } else if (i == 2) { return "c"; } else if (i == 3) { return "d"; } else if (i == 4) { return "e"; } else if (i == 5) { return "f"; } else if (i == 6) { return "g"; } else if ...
1229c55c-5609-4bb4-b21e-08587774b983
7
private void initGrid() { grid = new Site[xSize][ySize]; for(int x = 0; x < xSize; x++) { for(int y = 0; y < ySize; y++) { double distance = Math.sqrt(Math.pow((center1 - x), 2) + Math.pow((center1 - y), 2)); double distance2 = Math.sqrt(Math.pow((center2 - x), 2) + Math.pow((center2 - y), 2)); doubl...
c906a11a-c9c8-4523-ab7a-3a7f097a239a
3
public Msg pull_msg () { Msg msg_ = null; // First message to send is identity if (!identity_sent) { msg_ = new Msg(options.identity_size); msg_.put(options.identity, 0, options.identity_size); identity_sent = true; incomple...
6281f882-bde2-4507-8637-a6d41d7a0050
7
public static byte[][] createAndValidateTopMap(int w, int h) { int attempt = 0; do { byte[][] result = createTopMap(w, h); int[] count = new int[256]; for (int i = 0; i < w * h; i++) { count[result[0][i] & 0xff]++; } if (count[Tile.rock.id & 0xff] < 100) continue; if (count[Tile.sand.id & 0x...
5cb0cfd3-2d0c-4679-aa96-1111b2f228fa
3
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof AbstractEntity)) return false; AbstractEntity that = (AbstractEntity) o; return !(id != null ? !id.equals(that.id) : that.id != null); }
fa664dd6-b166-45af-b9c1-60921f8a073d
9
@Override protected void execute(Output output, Settings settings, List<String> parameters) throws CommandException { VariableManager variableManager = settings.getVariableManager(); if (parameters.size() == 0) { List<String> keys = variableManager.getVariableNames(); Collections.sort(keys); for (String k...
ecaf2ccd-f843-4e21-b156-03c3b185a55b
7
protected Content getNavDetailLinks() throws Exception { Content li = HtmlTree.LI(detailLabel); li.addContent(getSpace()); Content ulNav = HtmlTree.UL(HtmlStyle.subNavList, li); MemberSummaryBuilder memberSummaryBuilder = (MemberSummaryBuilder) configuration.getBuilderFac...
8159c845-b7b9-46b0-8ab1-3c1d63597f13
3
public boolean addHyperLink(String sheetName,String screenShotColName,String testCaseName,int index,String url,String message){ url=url.replace('\\', '/'); if(!isSheetExist(sheetName)) return false; sheet = workbook.getSheet(sheetName); for(int i=2;i<=getRowCount(sheetName);i++){ ...
f4f62e56-d843-4494-94d8-23f09b54c171
7
@Override public void update(double deltaSec, double scrollDistance) { alpha -= .02; if (alpha <= 0 || !gmass.isAlive()) die(false); this.scrollDistance = scrollDistance; if(player != null) { gmass.setX(Library.worldUnitToScreen(player.getCenterX())); gmass.setY(Library.worldPosYToScreen(play...
71382196-5136-4f1b-b552-f56d8ede9e0f
2
public boolean addPerceptron(String name, Perceptron perceptron) { for (String a : perceptrons.keySet()) { if (name.equalsIgnoreCase(a)) { return false; } } perceptrons.put(name, perceptron); return true; }
7340d854-99c6-4809-ba0a-248cd3f84269
3
public Person getPerson(int personid) throws Exception { // for getting any person out of the database DBConnector db = new DBConnector(); ResultSet rs = db.getPerson(personid); if(rs.next()) { if(rs.getString("persontype").equals("student")) { return new Stud...
40f683ab-34e9-43a5-9dd3-ac7cd5bac8b6
3
public static Board cloneBoard(Board board){ Board retBoard = new Board(); for (int i = 0;i < 8;i++){ for (int u = 0;u < 8;u++){ if (board.get(i, u) != null){ retBoard.set(i, u, board.get(i, u).copy()); } else{ retBoard.set(i, u, null); } } } return retBoard; }
0f1a7bd5-301c-409f-9936-285c63cfd01e
1
public static boolean verifyName(String name, Policy p){ if (p.isLegaelName(name)) return true; return false; }
0b209dfc-8542-4ee3-a774-0661ba2cde61
5
public void takeTurn(Point selectedLocation) throws Connect4Exception, GameException { Player currentPlayer = this.game.getCurrentPlayer(); Player otherPlayer = this.game.getOtherPlayer(); PlayerType playerType = currentPlayer.getPlayerType(); if (this.game.getGameType() == Ga...
a8bcb1c4-1f69-4615-b732-903bdf3727c3
7
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String s = br.readLine(); int up=0, down=0; for(int i=0; i<n; i++){ if(s.charAt(i)=='x') down++...
c13a9549-221e-40cf-b119-357ffbfbf25a
0
public static void main(String[] args) { System.out.println(12); System.out.println(012); System.out.println(0x12); }
303b41eb-6bbd-4f04-9b17-0805a8ad28c8
7
SimPanel(Console con) { this.console = con; initComponents(); setRunningIndicator(false); syslogCombo.addItem(Level.OFF); syslogCombo.addItem(Level.ALL); syslogCombo.addItem(Level.SEVERE); syslogCombo.addItem(Level.WARNING); syslogCombo.addItem(Level.INFO...
8f9e9f45-9e62-4600-9111-0c847ed3fd15
4
@Override public void update(Observable o, Object arg) { if (arg != null && arg instanceof Integer) { Integer timestamp = (Integer) arg; if (leaveMap.containsKey(timestamp)) { for(Car auto : leaveMap.get(timestamp)) cs.addToExitQueue(auto); ...
484ec1a1-aaf8-4e76-b2cf-4f4d0b3a7966
7
public MemoryUsagePanel() { super(); // initializes members m_Memory = new Memory(); m_History = new Vector<Double>(); m_Percentages = new Vector<Double>(); m_Colors = new Hashtable<Double,Color>(); // colors and percentages m_BackgroundColor = parseColor("BackgroundColor...
0d19defb-0b6c-4042-8cdb-02d0a710ada5
4
public void keyTyped(java.awt.event.KeyEvent evt) { if (evt.getSource() == nombrelaboratoriosField) { RegistroLaboratorios.this.nombrelaboratoriosFieldKeyTyped(evt); } else if (evt.getSource() == telefonolaboratorios1Field) { RegistroLaboratorios.this....
de682ec1-cfc5-41c2-97ff-86fac0860718
4
private void preencherTabela() { String[] propriedades = {"Id", "Nome", "Preco"}; ProdutoDAO dao = new ProdutoDAO(); List<Produto> produtos = dao.list(); String[][] matriz = new String[produtos.size()][3]; for (int i = 0; i < produtos.size(); i++) { Produto produto = ...
b2b8d49f-39ac-4207-a773-55d02ea55f8c
3
@SuppressWarnings("rawtypes") public synchronized boolean logClientIn(String clientName, String passcode, ServerProtocol protocol){ User userFound= _users.get(clientName); if ((userFound != null) && (userFound.checkPassword(passcode)) && (!userFound.isLoggedIn())){ _users.get(clientName).setProtocol(protocol); ...
5c5d08c0-9430-4308-9574-a0cada5a3e2b
2
JSONArray packJson() { if(this.isEmpty()) return new JSONArray(); JSONArray rtn = new JSONArray(); for(Notification notification:this.aNotification) { rtn.put(notification.toJson()); } aNotification.clear(); return rtn; }
bdc2a1ea-4bbf-467f-98bb-077eed835091
0
@Override public void actionPerformed(ActionEvent e) { handleUpdate(); }
57cf5635-4691-4af9-8b6c-a335bc5984cf
7
public int getTeamTemplate(String username) { int templateNumber = 0; int studentID = -1; PreparedStatement studentFinder = null; PreparedStatement templateNumberFinder = null; try { // Get student ID studentFinder = connect.prepareStatement( ...
596b01ed-623e-4e48-ad1f-dfab65130ec8
1
List<SuppliersModel> select() { String sql = "SELECT * FROM Suppliers;"; List<Suppliers> list = getPersist().readList(Suppliers.class, sql); List<SuppliersModel> models = new ArrayList<>(); for (Suppliers suppliers : list) { SuppliersModel model = new SuppliersModel(); ...
f969f9c4-850c-4388-8bbf-0df92da381f3
1
private boolean hasEnemyInAreaToMove(int number){ double radius = beings.get(number).isZombie() ? RADIUS_DETECT_HUMAN : RADIUS_DETECT_ZOMBIE; return hasEnemyInArea(number, radius); }
7e5b7bed-a4ad-4b99-b151-098656afd6fa
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhpposPermissionsEntity that = (PhpposPermissionsEntity) o; if (personId != that.personId) return false; if (moduleId != null ? !moduleId.equal...
6c9467ae-11a2-4edf-9d1d-a774501cf615
3
public List<Funcionario> consultarFuncionarios(String nome) throws DaoException{ Connection conn = DbUtil.getConnection(); PreparedStatement statement = null; ResultSet result = null; List<Funcionario> listaFunc = new ArrayList<Funcionario>(); try { if(nome.equals("")){ statement = conn.prepareStatem...
82109354-fb33-41b9-875e-f4919f5b2e1b
9
public static boolean updateDrug(Connection con, JSONObject parameters) { String idS = (String) parameters.get("id"); if (idS == null) return false; int id = Integer.valueOf(idS); String msdcodeS = (String) parameters.get("msdcode"); String category_idS = (String) parameters.get("category_id"); Strin...
dc20ea15-33f2-403c-81f3-ca2ca4a2fcf5
0
public String[] getRight(String lhs) { Set rhses = (Set) lhsToRhs.get(lhs); return (String[]) rhses.toArray(new String[0]); }
4ba8de79-42ac-453a-882b-4a3036d627fa
5
public String formatList(double amount, boolean mat) { StringBuilder builder = new StringBuilder(); boolean close = false; if (econ != null && amount != 0) { builder.append("("); builder.append(amount); close = true; } if (mat) { if (close) builder.append(", + "); else builder.append("("); b...
36eb992f-68b8-4284-8e68-f6f3eb572983
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
b074f860-c48a-4735-b097-f398f570c579
7
private JSONWriter append(String s) throws JSONException { if (s == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write(','); ...
07d04bdb-c2c8-44fc-af2b-15f317f01787
9
@SuppressWarnings("static-access") public void drawHealthBars(Graphics2D g2d) { if (coast1.hp > 0) { float remHPs = ((float) coast1.hp / (float) getMaxHP()) * (float) 300; g2d.setColor(Color.black); g2d.fillRect((int) coast1.loc.x, (int) coast1.loc.y - 35, 300, 5); if (getMaxHP() / coast1.hp < 1.5) ...
dfb5ee4a-051f-4336-a909-20ff92621a46
6
public void drawInverse(int x, int y) { x += offsetX; y += offsetY; int offset = x + y * RSDrawingArea.width; int originalOffset = 0; int height = myHeight; int width = myWidth; int deviation = RSDrawingArea.width - width; int originalDeviation = 0; if (y < RSDrawingArea.startY) { int j2 = RSDrawin...
71735b25-1a20-481a-b28e-b528e3674f8f
4
public static long pop_array(long A[], int wordOffset, int numWords) { /* * Robert Harley and David Seal's bit counting algorithm, as documented * in the revisions of Hacker's Delight * http://www.hackersdelight.org/revisions.pdf * http://www.hackersdelight.org/HDcode/newCode/pop_arrayHS.cc * * This funct...
9ed43bce-2823-464c-8929-873a24ba0d59
7
final public void ArgumentList(int reqArguments, String functionName) throws ParseException { int count = 0; String errorStr = ""; if (jj_2_6(1)) { Expression(); count++; label_7: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case 30: break; default: jj_la1[15] = jj_g...
f9e11c3a-9b2e-4f23-817c-54328d8da620
9
public static String getShooterType(ArrayList<TeamMatch> matches) { boolean curved = false, linear = false; for (TeamMatch t : matches) { if (t.getShooterType() == TeamMatch.ShooterType.Curved) { curved = true; } else if (t.getShooterType() == TeamMatch.ShooterTyp...
e03d7441-a5b3-49ae-b6cf-1bdcae128a17
2
public static IntArrayBag intersection(IntArrayBag b1, IntArrayBag b2) { System.out.println("in the intersection"); IntArrayBag temp = new IntArrayBag(b1.manyItems + b2.manyItems); for(int i = 0; i < b1.manyItems; i++) { System.out.println("in for-loop"); if(b2.countO...
e9e1265c-2c5e-47e4-a38b-0aff1cfac79d
4
private void deboard(Story st,PassengersList allPassengers) { countPermitExit = 0; int currentElevatorContainerSize = elevatorContainer.size(); for(Passenger passenger : elevatorContainer.getContainer()) { passenger.setNotTriedExit(true); } synchronized (Actions.DEBOARDING) { setActi...
94d841dc-fb7f-4c46-bc3a-c1f2cbb0c87b
3
public Set<BankAccount> getAccountsBalanceNotBelow(BigInteger threshold) throws IllegalArgumentException { if (threshold == null) throw new IllegalArgumentException(); Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) if (account.getBalance()....
93ca9d6f-0ca3-4bec-bfd4-d2f90aece11b
2
public static String getFinalArg(String[] args, int start) { StringBuilder bldr = new StringBuilder(); for (int i = start; i < args.length; i++) { if (i != start) { bldr.append(" "); } bldr.append(args[i]); } return bldr.toString(); }
85306acc-957d-4754-82f6-629e6777b42d
1
protected void carregaTabelaTelefones(List<Telefone> lista){ this.modeloTabelaTelefone = new DefaultTableModel(); this.modeloTabelaTelefone.addColumn("DDD"); this.modeloTabelaTelefone.addColumn("Numero"); for(Telefone t : lista){ Vector v = new Vector(); ...
f61b05fa-4ebc-4f82-8e8e-ea75339b9e35
6
public ParseTable(LinkedList<GToken> tokens,LinkedList<GRule> rules,GToken epsilon) { this.tokens=tokens; /* System.out.println("Starting Parse table motherfuckers"); System.out.println(tokens.toString()); System.out.println(rules.toString()); System.out.println(); */ for (GRule r:rules) //for each rul...
b638e31b-5d20-4be6-bc3c-a9aad7c8644e
8
@Override protected void onButtonReleased(GuiButton button) { if (button.id == 0) { Monopoly.getInstance().startGame(this.options); } else if (button.id == 1) { GuiScreen.setGui(new GuiChoseBoard(this, this.options.board)); } else if (button.id == 2) { this.options.playerCount++; if (this...
b72d9200-6a5a-4eb2-a8bb-e5da71c0d729
7
public void newConstraintFromPoint(Point origin, int value) { List<Point> points = new ArrayList<Point>(); knownPoints[origin.x][origin.y] = value; //add every point around the point to the constraint if it is unknown int i, n; for (i = -1; i < 2; i++) { for (n = -1; n < 2; n++) { //if we are at the ...
3c64c8de-f1d6-43f7-a703-83e522eeaa65
0
public void flushPage(PageId pageid) throws HashOperationException, PageUnpinnedException, PagePinnedException, PageNotFoundException, BufMgrException, IOException { // send to private method with the common code for all flush methods privFlushPages(pageid, 0); } // end flu...
c5e80be4-bc5a-434f-a210-f0532aec4395
8
protected double kernel(SequenceInput input1, int token1, SequenceInput input2, int token2) { int idxFtr1 = 0; int idxFtr2 = 0; int numFtrs1 = input1.getNumberOfInputFeatures(token1); int numFtrs2 = input2.getNumberOfInputFeatures(token2); double dotProd = 0d; while (idxFtr1 < numFtrs1 && idxFtr2 < numFt...
f1c3a32b-323a-4564-a9fa-c636a22b8a21
9
private void shiftPaletteForward() { color_cycling_location++; color_cycling_location = color_cycling_location > Integer.MAX_VALUE - 1 ? 0 : color_cycling_location; if(color_choice == palette.length - 1) { temp_color_cycling_location = color_cycling_location; } up...
892a3bed-120d-4651-83d4-ffc46242ff58
1
public boolean trustUser(String trustee, boolean isTrusted) throws SQLException { LinkedList<String> columns = new LinkedList<String>(); LinkedList<String> values = new LinkedList<String>(); columns.add("Truster"); values.add(username); columns.add("Trustee"); values.add(...
dc439637-a03e-4260-beca-7936a1e8a9b1
0
@Id @Column(name = "PRP_POS_ID") public Integer getPrpPosId() { return prpPosId; }
3b92dd9d-dcfd-45b8-94cd-047a3d707426
2
public Bee(String name, Block[] rects, float x, float y) { this.beename = name; this.x = x; this.y = y; map = rects; try { bsprite = new SpriteSheet("src/Assets/beesheet.png", 128, 128); } catch (SlickException e) { e.printStackTrace(); } try { bsprite2 = new SpriteSheet("src/Assets/beeshee...
ebde9337-14ee-47ff-aa34-bb545c5a6f01
3
public static void main(String[] args) throws BookStoreException { MasterCertainBookStore bookStore = new MasterCertainBookStore(); int listen_on_port = 8081; MasterBookStoreHTTPMessageHandler handler = new MasterBookStoreHTTPMessageHandler( bookStore); String server_port_string = System .getProperty(Bo...
5137fa34-44e5-4ec8-9db2-ab7b919734c4
2
public PermWriter(boolean useGUI) { if (useGUI) { this.gui = new GUIManager(this); this.gui.init(); } else { this.gui = null; } final PermWriter proj = this; if (useGUI) { SwingUtilities.invokeLater(new Runnable() ...
646f1768-e834-437b-ad03-573234cbca84
4
public void dispatchMessage(final WebSocketHandler handler, final NettyWebSocketConnection connection, final Executor executor, final Thread.UncaughtExceptionHandler exceptionHandler) throws UTF8Exception { switch (opcode) { case Opcodes.OPCODE_TEXT: { final String messageValue = ut...
14363246-22c4-4805-9a6b-5f09c656b36a
4
public boolean equals(Object other) { if ( (this == other ) ) return true; if ( (other == null ) ) return false; if ( !(other instanceof TicketsId) ) return false; TicketsId castOther = ( TicketsId ) other; return (this.getFestId()==castOther.getFestId()) && (this.getGebrId()==castOther...
682b0511-25c3-42d3-b7c5-63734e8be614
6
@EventHandler public void CaveSpiderFastDigging(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.getCaveSpiderConfig().getDouble("Ca...
ac9a1ba8-b4bd-4b50-bf95-3355c7e5a8fe
1
private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } }
959ea4ed-b2bd-4df7-ade6-063701088fe9
9
public void func_152_a(EntityMinecart par1EntityMinecart, double par2, double par4, double par6, float par8, float par9) { GL11.glPushMatrix(); long var10 = (long)par1EntityMinecart.entityId * 493286711L; var10 = var10 * var10 * 4392167121L + var10 * 98761L; float var12 = (((float)(v...
f76b280f-b7ee-4426-b246-1ac68ac19d34
0
public PyramidShoot() { // Drive back. This used to be an EncoderDrive, but our right encoder // is broken. addSequential(new Command() { { requires(Robot.driveTrain); } protected void initialize() { Robot.vision.setDistance(Vi...
70820ec3-991e-4334-ac1e-3b17358ad0fa
8
public void or(TACCommand c) { if ((c.getP1() instanceof VarLocation) && (c.getP2() instanceof Literal)) { VarLocation loc = (VarLocation) c.getP1(); assembly.add(" movl " + offset(loc) + ", %eax"); assembly.add(" or $" + c.getP2().toString() + ", %eax"); ...
3f64ff50-07ae-446d-b29a-5af189b74c3c
8
private void logNoExecResults() { if(hasCommandLineOption(CommandLineOption.NO_EXEC)){ final String lSequenceHeader = "Sequence"; final String lNameHeader = "Description"; final String lDetailsHeader = "Details"; int lLongestSequence = lSequenceHeader.length(); int lLongestN...
21cab1fa-026f-4e8a-98ed-a2d779801afa
7
private void buildFreqsArray() { thetaWArr = new int[sg.getMaxSeqLength()]; piArr = new double[sg.getMaxSeqLength()]; int numGaps = 0; for(int i=0; i<thetaWArr.length; i++) { if ((!hasGap(i)) && isPolymorphic(i)) thetaWArr[i] = 1; else thetaWArr[i] = 0; } for(int i=0; i<thetaWArr.length; i+...
d67f0adb-5a46-4f6d-ace6-a7c17dbaad66
2
private void initComboBoxCreditPrograms() { //Создаем список названий кредитных программ List<String> listNames = new ArrayList<String>(); //Получаем список всех кредитных программ List<CreditProgram> listPrograms = crProgDAO.listAll(); //Формируем список имен кредитных программ ...
2eb32cf3-c968-4804-84ad-8fdf8be85260
3
private static void printHorizBound(int width, int printWidth, int startX) { if (startX > 0) // Handle an extra column of "..."s at the beginning. System.out.print("----"); for (int x = 0; x < printWidth; x++) System.out.print("-------"); if (printWidth < width) // Handle an extra column...
2f033005-7844-40e5-9a48-fa052f572e04
2
@Override public String decompress(String inFileName) throws Exception { // the input extension must be .gz if (!getExtension(inFileName).equalsIgnoreCase("gz")) { return "Your File has wrong extension."; } System.out.println("Decompressed file: " + inFileName); GZIPInputStream in = null; in = new GZI...
32df8cb4-b480-47a5-abdc-170b85e725b8
1
public double recalculateAndGetManagedIntensity() { managedIntencity = 0; for (TVC con : managedConnections) { managedIntencity += con.getIntencity(); } return managedIntencity; }
e1c920b1-2c67-41e9-90c6-f6dfc277dfbf
2
private ArrayList<Card> returnTwoPairsSetup() { ArrayList<Card> setup = new ArrayList<>(); if (compareCardFigures(0, 1) && compareCardFigures(2, 3)) { @SuppressWarnings("unchecked") ArrayList<Card> handCopy = (ArrayList<Card>) cards.clone(); setup.addAll(...
bde43fd9-dcef-483f-a3fe-877522caede9
3
public static List<String> columnNames(CSTable table, String name) { List<String> l = new ArrayList<String>(); for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).startsWith(name)) { l.add(table.getColumnName(i)); } } if ...
cbd44cb0-3cae-4180-b0bc-4bc52e3b6519
2
public void notifySubLWorkerTerminated(SubLWorkerEvent event) { //// Preconditions assert event != null : "event must not be null"; assert subLWorkerStartTimeDictionary != null : "subLWorkerStartTimeDictionary must not be null"; final SubLWorker subLWorker = event.getWorker(); final SubLWorker...
cb04c700-5480-4c56-a571-363cff310fe3
1
public void visitAttribute(final Attribute attr) { buf.setLength(0); buf.append("// ATTRIBUTE ").append(attr.type).append('\n'); if (attr instanceof ASMifiable) { buf.append("{\n"); ((ASMifiable) attr).asmify(buf, "attr", labelNames); buf.append(name).append(".visitAttribute(attr);\n"); buf.append("}\...
a4663466-abdf-41c5-82ba-ef8a013183af
0
@Test( expectedExceptions = { IllegalArgumentException.class } ) public void noRuntimeRetention() { annotatedWithType( NoRuntimeRetention.class ); }
77c2ff8f-f89a-4197-89ae-b3e3750fa2c2
6
private void readSections(List<SectionMetadata> res, StreamedSource source) { Iterator<Segment> i = source.iterator(); while (i.hasNext()) { Segment segment = i.next(); if (segment instanceof StartTag) { Tag tag = (Tag) segment; if (tag.getName().equals("body")) { while (i.hasNext()) { segm...
35592d3a-f1cb-4340-ac02-c3d3bf608de5
9
public boolean actionDoTreat(Actor actor, Actor patient) { if (! canTreat()) return false ; final Item used = Item.withAmount(accessory, 0.1f) ; final boolean hasUsed = actor.gear.hasItem(used) ; float checkMod = hasUsed ? 0 : +5 ; checkMod -= diagnoseBonus() ; float success = Rand.num...
61e60c4c-3007-45f8-a1f5-82e44cc9580d
9
public ArrayList<String> selectColumn(String table, String column, String where, String args) throws SQLiteException { String query = "SELECT " + column + " FROM " + table; if (where.trim().length() > 0) { query += " WHERE " + where; } SQLiteStatement st = _db.prepare(query); String[] parameters; i...
e7a974b7-c559-408d-b4da-fb6e59081662
7
public static OOXMLElement parseOOXML( XmlPullParser xpp, Stack<String> lastTag ) { HashMap<String, String> attrs = new HashMap<>(); try { int eventType = xpp.getEventType(); while( eventType != XmlPullParser.END_DOCUMENT ) { if( eventType == XmlPullParser.START_TAG ) { String tnm = xpp.get...
a33a552b-e592-43ac-9caa-12c83037bc45
3
public void run() { System.out.println(LoadBalancer.getCurrentTime() + "::" +"Starting Status checker thread"); serverInfo server; String status; while(true) { try { //System.out.println("StatusChecker: Before Acquire"); ConnectionTable.serverListLock.acquire(); //System.out.println("StatusCheck...
9197cccc-3a28-4b23-83a6-52d4c7b1f1e1
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { GUISignup frame = new GUISignup(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
9e220eeb-0c58-4fde-98d5-dfd973700534
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) return false; // Is metrics already running? if (task != null) return true; // Begin hitting the server with glorious data task = plugin.getServer().getScheduler() ...