method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
04f8bc6d-e07b-4f3c-b41d-cade2eb9e33d
5
public String toString() { String ret = new String(""); for(int y=tabuleiro[0].length-1; y>=0; y--) { if( y == tabuleiro[0].length-1 ) { for(int x=0; x<tabuleiro.length; x++) ret += " "+x; ret += Util.EOL; } for(int x=0; x<tabuleiro.length; x++) ret += "|"+tabuleiro[x][y]; ret ...
47e492e4-07de-47c0-9d09-624b37b5e327
8
@Override public String toString() { String txt = ""; if (label != null && !label.equals("")) { txt += label + ": \n"; } if (vertices != null && vertices.size() > 0) { txt = txt + "V: {"; for (Vertex v : vertices) { txt = txt + v.ge...
a32be0a5-e329-4329-81fc-63d9de32edba
2
@Override public boolean equals(Object obj) { if (!(obj instanceof TargetTransition)) return false; TargetTransition tt = (TargetTransition) obj; return this.action.equals(tt.action) && this.invoke.equals(tt.invoke); }
37327d50-5d7d-4023-85b8-db3fbfd62466
3
public static void linejnyj(int[] a, int key) { double time = -System.currentTimeMillis(); boolean flag = false; for (int i = 0; i < a.length; i++) { if (a[i] == key) { System.out.println("pozicija " + (i + 1)); flag = true; } ...
d672cae2-0a0e-416d-ba79-8c59106b85f7
5
public ArrayList<Term> getOverlappingTerms(String query, ArrayList<Integer> selectedChapters){ if(index.hasTerm(query)){ if(selectedChapters.size() == 0){ return index.getOverlappingTerms(query, 0, 0); } else { ArrayList<Term> overlappingTerms = new ArrayList<>(); for(int i = 0;i < selectedChapte...
133873a6-ea16-465a-9e49-611a393fce48
4
@Override public List<Position> getAll() throws SQLException { List<Position> results = new ArrayList<Position>(); Connection dbConnection = null; java.sql.Statement statement = null; String selectCourses = "SELECT id_position, name, sallary FROM position"; try { dbConnection = PSQL.getConnection(); st...
48e2b62e-b283-42a9-99ac-595dba732470
8
public static void main(String[] args) { long pathCount = 0; long[][] grid = new long[xDim][yDim]; for(int i = 0; i < yDim; i++) { for(int j = 0; j < xDim; j++) { if(j == 0 && i == 0) grid[j][i] = 1 + 1; else if(j == 0) grid[j][i] =...
9591671d-8da3-4faf-a0b7-ab1e035aa083
0
public String toString() { return String.format("%2d : %s", getSuppliercode(), getName()); }
3e90e262-4bec-44fb-8902-55d547fdaa7c
9
@Override public void execute(MapleClient c, MessageCallback mc, String[] splitted) throws Exception { String cmd = splitted[0]; MapleCharacter pl = c.getPlayer(); if (cmd.equalsIgnoreCase("donated")) { if (splitted.length != 4) { pl.dropMessage("syntax : !donated...
2764d10e-b70d-44fa-ac79-5424fa14b220
3
public void setChar(TChar node) { if(this._char_ != null) { this._char_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); }...
ea751b83-c664-4422-b7c8-be5d5d4cfaf7
1
public Editor(final Skin skin) { if (skin == null) { throw new IllegalArgumentException(); } this.skin = skin; setUpStringArrays(); EventQueue.invokeLater(new Runnable() { @Override public void run() { Editor.this.setTitle(GUI...
7e2a1cf6-a225-4343-b415-1e770e664184
8
private ItemStack createStack(Objective o, QuestProgress qd) { Material m = Material.getMaterial(o.getItemIconId()); if(m == null || m == Material.AIR)m = Material.getMaterial(o.getType().getItemIcon()); if(m == null || m == Material.AIR)m = Material.WRITTEN_BOOK; ItemStack ostack = new ItemStack(m); ItemMet...
f8f4118e-ca65-4f89-a751-8d81c20153c9
6
public String getXML() throws KettleException { StringBuilder retval = new StringBuilder(); if (inputField != null) { retval.append(" ").append(XMLHandler.addTagValue("INPUT_FIELD", inputField)); } if (classpath != null) { retval.append(" ").append(XMLHandler.openTag("CLASSPATH")).append(Const.CR);...
8276e61f-31d5-4211-b597-b60a7ac1ccc1
1
public String scriptCreation(String appKey, String userKey, String testName) { try { appKey = URLEncoder.encode(appKey, "UTF-8"); userKey = URLEncoder.encode(userKey, "UTF-8"); testName = URLEncoder.encode(testName, "UTF-8"); } catch (UnsupportedEncodingException e) {...
36e8bf84-f5a2-42b4-b843-071b2d8b3773
2
private boolean includes(HashMap<String, String> row, HashMap<String, String> list) { for (String key : list.keySet()) { String correct = list.get(key); String rowData = row.get(key); if (!correct.equals(rowData)) return false; } return true; }
d4875255-2614-4b7f-bb68-c9681c76fc79
5
public void wakeUp(final Guard guard){ Thread clockTick = new Thread(){ private Bandit prey = null; @Override public void run(){ for(GameMatter itm: area.getItems()){ if(itm instanceof Bandit){ prey = (Bandit) itm; } } try { this.sleep(2500); } catch (InterruptedExcepti...
19dbe6f1-3888-49f2-ac69-5088e01b25e3
1
public Object getObject(String name) { try { return lookupObject(name); } catch (ObjectNotFoundException e) { return null; } }
a750bfae-ccd8-4be2-85a3-4c2b6df75779
3
public final synchronized void waitForInit() { if (--this.wait <= 0) { return; } while (this.wait != 0) { try { wait(); } catch (final InterruptedException e) { this.master.interrupt(); } } }
37dd0b38-5be3-499e-b3ca-c9d50c151774
6
@EventHandler public void WitchNightVision(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.getWitchConfig().getDouble("Witch.NightV...
dd104dd4-f321-424f-a3dd-23cf4be293c4
0
public void showPhoneNumberPopup() { phoneNumber.show(); }
1847437d-06d4-4c48-a366-d31c3a65ccee
5
public void addLink(int s, int d){ Node S = null; Node P = null; for(Node N : network) { if(N.id == s) { S = N; } if(N.id == d) { P = N; } } if(S != null && P != null)...
227bd8c0-ae6c-497b-9451-8d2c5d8e7822
1
public final void forward(String target, String... patterns) { for (String path : patterns) { pages.forward(target, path); } }
c07dc1d5-14ba-4062-a887-06da3c7fcfed
1
public boolean equals(Object o) { MethodType mt; return (o instanceof MethodType && signature .equals((mt = (MethodType) o).signature)); }
c4f6d633-0d5a-43f6-a0de-dd96eb63a1f1
2
@Override public void run(ListIterator<Instruction> iter) throws Exception { Instruction i = iter.next(); for(Value v : i.getArguments()) { if(v instanceof DefaultValue) { i.replaceArgument(v, new Immediate(0)); } } }
d4986303-56d2-47e6-bae6-19c0ec627044
2
public NumberValidator(String str) { String[] parts = str.split(","); if (parts.length > 0) min = Long.parseLong(parts[0]); if (parts.length > 1) max = Long.parseLong(parts[1]); }
833dbee6-465c-4f38-85b1-0b49f2dd81a4
1
public BigDecimal getValue(int row, int clums, int sheetat) { BigDecimal value = new BigDecimal(0); String s = null; try { hSheet = hWorkbook.getSheetAt(sheetat); hRow = hSheet.getRow(row - 1); hCell = hRow.getCell(clums - 1); hCell.setCellType(Cell.CELL_TYPE_STRING); s = hCell.getStringCellValue()...
a39d3140-d0c8-41ad-826a-94aa7e768cce
4
public void click(int x, int y) { if(x<9*drawSize && y<9*drawSize) { Cell clickedCell = grid[y/drawSize][x/drawSize]; if(clickedCell==selectedCell) { selectedCell.deselect(); selectedCell = null; } else ...
b78ab37f-867b-4d71-8e81-c0394311d9d1
7
public static void addComponentsToPane(Container pane) { if (!(pane.getLayout() instanceof BorderLayout)) { pane.add(new JLabel("Container doesn't use BorderLayout!")); return; } JPanel p = new JPanel(); caption = new JLabel(""); caption.setFont(caption....
582b502c-d89f-408e-bd65-dfde3971b74c
1
private void firePieceCompleted(Piece piece) { for (PeerActivityListener listener : this.listeners) { listener.handlePieceCompleted(this, piece); } }
afe0c7c9-c9f7-4365-bfb8-b32c715623a5
8
@Override public void actionPerformed(ActionEvent arg0) { Object event = arg0.getSource(); int row = 0; int col = 0; int bombP = 0; if(event == confirm){ try{ row = Integer.parseInt(textRow.getText()); }catch(NumberFormatException e){ JOptionPane.showMessageDialog(this, "All Fields need t...
6a3a9a87-d39f-47bb-a137-874028bb5db5
8
public boolean remove(K k) { Node<K> parent = head; Node<K> n = head.getRight(); /* * Sucht Knoten mit zu löschendem Schlüssel. * Schleife erfasst auch Elternknoten des Knotens. */ while (n != nullNode) { int compare = k.compareTo(n.getKey()); ...
1abf886c-2af5-4a13-b976-6fde43ca9bf3
5
private void applyInvisibleLinkType(Annotation annotation) { // clear border thickness if (linkType == Annotation.INVISIBLE_RECTANGLE) { Object border = annotation.getObject(Annotation.BORDER_KEY); if (border != null && border instanceof Vector) { Vector borderPro...
af132235-c159-495b-b794-121f5e3f9b4c
8
public static void main( String[] args ) { try{ (new Core(args)).run(); } catch(FileNotFoundException e) { System.out.println(Message.getSSLError("FileNotFound")); System.out.println("[CRITICAL]: Closing server."); } catch(java.net.ConnectException e) { ...
410c43b7-3d4e-40cf-aa16-e43112fdf144
4
public void run() { long currentTime = System.currentTimeMillis(); long lastTime; long deltaMs; options.save(); fpsCounter = 0; elapsed = 0; //resManager.getAudioManager().play(); while(!quitting && !Display.isCloseRequested()) { ...
f1751b2a-e459-416e-9b49-a532e6519f16
4
public RollupTaskXmlDriver(String xmlStr) throws DocumentException, XmlTypeErrorException { super(); if (!isRollupTaskXml(xmlStr)) { throw new XmlTypeErrorException("not a valid rollupTask Xml"); } document = DocumentHelper.parseText(xmlStr); timestamp = d...
973a0497-fffa-4159-bda4-993a5a4f9cfb
5
public MainViewPanel() { super(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBackground(Color.WHITE); for (int i = 0; i < paintings.length; i++) paintings[i] = new Painting(); for(int i = 0; i< graphics.length; i++) graphics[i] = paintings[i].createGraphics(); for (int i = 0; i < sli...
88354283-bafa-4463-b5f8-8b14a1b82f77
2
@Override public void put( ByteBuffer out, Class<?> v ) { if ( v == null ) { out.put( Compress.NULL ); } else { String name = v.getCanonicalName(); Compress.putIntUnsignedNullable( out, name.length() ); out.put( name.getByte...
be26c9ff-832f-4a5c-b839-379940136e94
1
public GenericDAO<Employee> getEmployeesDAO() { if (_employeesDAO == null) { _employeesDAO = new GenericDAO(Employee.class); } return _employeesDAO; }
8a43403e-4220-4c6e-8b7b-d90ace1bd45b
6
public void paintObjects() { removeAll(); Button btop = new Button("top"); objectsName = new Label[objects.size()]; objectsSize = new Label[objects.size()]; objectsSelect = new Button[objects.size()]; lobjs.setFont(new Font(Font.SERIF, Font.PLAIN, 25)); add(lobjs); add(btop); lobjs.setBounds(20,4...
677fb98f-ab3a-4875-add8-212aceb0a5ae
8
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String act = request.getParameter("act"); String message = null; if (act == null) { act = ""; } else { act = act.trim(); } TimeLogger tl = new TimeLogger(); try { if...
51f476bd-6926-44f8-be39-3cd7896b6882
9
public Board chooseMove() throws Exception{ int ties = 1; double bestValue = Double.NEGATIVE_INFINITY, currentValue; Board bestMove = null, currentMove; double[] results = new double[TaTeTi.MAX_CELLS*TaTeTi.MAX_CELLS]; LinkedList<Board> availableMoves = eg.getAvailableMovesForPla...
10c8ee31-b8de-43c0-97e6-924b6081c41f
8
private static void setSpawnLocation() { int rand = random.nextInt(8); switch (rand) { case 0: spawnLocation.setVector(110, 425); break; case 1: spawnLocation.setVector(345, 185); break; case 2: spawnLocation.setVector(755, 85); break; case 3: spawnLocation.setVector(1150, 140); brea...
1c8d80fa-68db-4651-99cf-7b68af24559c
8
private ArrayList<Operation> getAllOperation(String Declaration) { ArrayList<Operation> ArrayOperation = new ArrayList(); Declaration = Declaration.trim(); if(Declaration.equals("")){ return ArrayOperation; } else { boolean nextop = true; int i = 0; while(nextop){ String id =""; while(Declar...
b3ee17d3-886f-46d9-8372-317332a195fd
8
void reprodukcja() { // tworzę tablicę skumulowanych wartości przystosowania: double fittness_skum[] = new double[liczba_rozw]; fittness_skum[0] = fittness[0]; for (int i=1;i<liczba_rozw;i++) fittness_skum[i] = fittness_skum[i-1] + fittness[i]; Rozw nowa_popul_rozw[] = new Roz...
e5b62fa3-e1dc-42f2-ad7f-7ac6494c0db8
7
private int YUV_to_BGR(int Y, int u, int v) { if (Y < 0) { Y = 0; } int tempB, tempG, tempR; tempB = Y + ((116130 * u) >> 16); if (tempB < 0) { tempB = 0; } else if (tempB > 255) { tempB = 255; } tempG = Y - ((22554 * u...
93086b83-b232-43e6-bb74-dd66d1de1992
1
public void reachableClass(String clazzName) { ClassIdentifier ident = getClassIdentifier(clazzName); if (ident != null) ident.setReachable(); }
3f0c9700-54eb-4ce1-8f1e-d5c1d920fd37
9
public static void main(String args[]){ String objectListPath = "/u/ml/mindseye/nlg_lm/LM/lesk_syns_purdue.txt"; int no_objects = readObjectList(objectListPath); String outputMatrixPath = "/u/ml/mindseye/nlg_lm/LM/object_count.txt"; int[] object_counts = new int[no_objects]; String ldcCorpusPath = "/scratc...
794b4eb1-28e0-460f-b32e-d3f01c7a08c8
9
public static Vector<PhyloTreeEdge> getCommonEdges(PhyloTree t1, PhyloTree t2) { Vector<PhyloTreeEdge> commonEdges = new Vector<PhyloTreeEdge>(); // if the two trees do not have the same leaf2NumMap if (!(t1.getLeaf2NumMap().equals(t2.getLeaf2NumMap()))) { System.out.println("Error:...
b36f24a9-fa77-4cfa-988b-397aa1646ce2
9
public static boolean create(String[] args, CommandSender s){ // Various checks to prevent the guild creation from going through if it shouldn't happen if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from i...
dc82b935-d437-4f9e-97a6-295857f07c59
0
public long getNumericalAddress() { return _address; }
103853d2-1477-48b5-b340-fb99e892ec4f
5
public boolean compositeRank() { if(throwback) { for(Song song: library) { double score= (dateAddedWeight*song.getDARank()) + (playCountWeight*song.getPCRank())+ (timeLengthWeight*song.getTLRank()); song.setCompositeScore(score); } Collections.sort(library, ScoreComparator.getScorer()); ...
6ca5a1c6-3238-4111-aa29-36d27300f63f
0
public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("sd"); }
232cb4ed-db4c-41db-9f58-20f0e1e68c78
3
public void bidSearch( ) { FacesContext fc = FacesContext.getCurrentInstance(); try { Bid_DTO bid = bidService.getBid( idBid ); setIdItem( bid.getIdItem()); setIdUser( bid.getIdUser()); setImporte( bid.getBidPrice() ); } catch (ClassCastException e) { e.printStackTrace(); } cat...
f36f5196-d633-4a25-aa65-7da6592bea88
5
public void przerysujPlansze() { liczbaPrzerysowaniaPlanszy++; for(int k=0;k<10;k++) for(int l=0;l<10;l++) { if(liczbaPrzerysowaniaPlanszy > 1) { if(widokRozmiesc.uzytkownik.plansza.l_polaPlanszy_GRACZ[l][k].getRodzajPola().equals("1")) { //lb_polaGry[l][k].setBackground(Color...
8c7ff065-557e-4d93-8713-f60fc3b45f46
1
private Header readNextFrame() throws BitstreamException { if (framesize == -1) { nextFrame(); } return header; }
63a1636c-b931-4e18-92e2-235d88f00d93
7
@Override public SyrianEdge getMove(SyrianGraph graph) throws AgentHasNoMoveException, AgentIsDoneException { if (this.getLocation() == this.getTarget() && graph.getVerticesWithChemicals().size() == 0){ throw new AgentIsDoneException(this); } AbstractList<SimpleHeuristicNode> path = this .getPathToT...
73e58a42-1e52-4f35-9bf4-e0c39701914d
4
public int getRowInsertionIndex(int y) { List<Row> rows = mModel.getRows(); int pos = getInsets().top; int last = getLastRowToDisplay(); for (int i = getFirstRowToDisplay(); i <= last; i++) { Row row = rows.get(i); if (!mModel.isRowFiltered(row)) { int height = row.getHeight(); int tmp = pos + hei...
b8126a47-18e2-49e6-8c3e-70312b4a3585
0
private static Color getColor(int counter) { return colors[counter % colors.length]; }
e8833c40-a230-4624-8b75-9fbfb87f2fbf
2
public void removeEdge(final GraphNode v, final GraphNode w) { Assert.isTrue(nodes.containsValue(v), "Graph does not contain " + v); Assert.isTrue(nodes.containsValue(w), "Graph does not contain " + w); Assert.isTrue(v.succs().contains(w)); if (removingEdge == 0) { succs(v).remove(w); } else if (removingE...
e781461b-63b1-4730-9c0f-0470c5982fcd
4
private void createResolutionCombo(PrintRequestAttributeSet set) { PrinterResolution[] resolutions = (PrinterResolution[]) mService.getSupportedAttributeValues(PrinterResolution.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); if (resolutions != null && resolutions.length > 0) { PrinterResolution current = P...
96087220-9bed-47d8-a0e6-cc5400837876
5
public Label nextBlock(final Label label) { boolean seen = false; final Iterator iter = code.iterator(); while (iter.hasNext()) { final Object obj = iter.next(); if (obj instanceof Label) { if (seen) { final Label l = (Label) obj; if (l.startsBlock()) { return l; } } else if ...
20093270-40e4-4398-a176-c02f09d40569
5
public static double[] baseProportions(String s) { int aCount = 0; int tCount = 0; int gCount = 0; int cCount = 0; int count = 0; for (int i = 0; i < s.length(); i++) { switch (s.charAt(i)) { case 'A': aCount++; count++; break; case 'T': ...
808c2486-6132-462a-a51d-a2229295d3be
3
public MainFrame() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setSize(800, 600); setLocationRelativeTo(null); contentPane = new JPanel(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS)); JPanel listPanel = new JPanel(); textField = new JTextField(); textFi...
8f7a04c4-8ae7-4d99-a4da-25f2cdbd0225
8
public void BuildMobs() { for (int i = 0; i < MOBS.length; i++) { if (Engine.mfo.pfh.ReadPlayerType == 1) { MOBS[i] = new Sleeper(Engine.mfo.pfh.ReadPlayerX, Engine.mfo.pfh.ReadPlayerY, Engine.mfo.pfh.ReadPlayerName, Engine.mfo.pfh.ReadPlayerLayer); } else if (Engine.mfo.pfh.ReadPlayerType...
d2d1ab73-dd5c-41f9-b0e6-2c03a3cbc28e
4
public void run(String[] params) { int codeLine = 0; for(String string : codeLines) { codeLine++; try { try { // System.out.println(string); String[] spl = string.split("\\<"); // System.out.println(spl[1]...
29eb9946-a36c-47a5-b084-5687226c06b5
4
public Loader() throws MessageStackException { copyFile("map.txt"); copyFile("community.txt"); copyFile("events.txt"); if(isSerialized()) { try { //reads serialized data from monopoly.ser to get every map data and player data ObjectInputStream serializedFile = new ObjectInputStream(new FileInputStrea...
28e69fd1-d645-4801-a3fe-3971dd55c167
6
private static final boolean isFinisher(final int skillid) { switch (skillid) { case 1111003: case 1111004: case 1111005: case 1111006: case 11111002: case 11111003: return true; } return false; }
4f186ec2-c555-4344-b76b-b45a4028d7ec
6
private boolean isDead(Node node){ if(node.getX() < 0 || node.getX() > Map.WIDTH){ this.isDead = true; return true; } if(node.getY() < 0 || node.getY() > Map.HEIGHT){ this.isDead = true; return true; } for(Node _node : body){ if(node.isEquals(_node)){ this.isDead = true; return true; ...
dec593bd-e1d8-47aa-a18d-18bf96d6e0f4
4
public List<Claim> getPublicClaimList(String parentClaimId, String claimType) { List<Claim> counterclaimList = new ArrayList<Claim>(); Element claimE; Claim claim; for (Iterator i = root.elementIterator(claimType); i.hasNext();) { claimE = (Element)i.next(); if (claimE.element("isDelete").getText().equals...
ecdf5af2-fc54-4823-9c58-576dd66a3f36
7
@Override public int compareTo(Team t) { if(this.points > t.points) { return HIGHER; } if(this.points == t.points) { if(this.goalDifference > t.goalDifference) { return HIGHER; } if(this.goalDifference == t.goalDifference) { if(this.goalsFor > t.goalsFor) { return HIGHER; } if...
5840fdad-f820-45ff-bf96-d64ad7f442cf
0
public void setSecondCorner(Rectangle secondCorner) { this.secondCorner = secondCorner; }
511746b9-ea2b-491f-bf29-4abe0c97e9e0
9
public void train() { training = true; BHypothesis.training = true; BHypothesis.MARGIN_RATE = 48D; for(int i = 0; i < maxRound; i++) { for(int j = 0; j < sample.size(); j++) { System.err.println((new StringBuilder()).append("Sentence ")...
287f7e20-61eb-476b-b4f3-c590539c00aa
4
@SuppressWarnings("InfiniteLoopStatement") private void calculateVerticalScale() { int scale = 1; for (Map.Entry<String, Integer> entry : dataToDraw.entrySet()) { if (entry.getValue() > highestValue) highestValue = entry.getValue(); } while (true) { if (high...
8675f6d3-059e-41ea-84b6-9d03b3663136
2
public static pgrid.service.corba.exchange.ExchangeHandle unchecked_narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof pgrid.service.corba.exchange.ExchangeHandle) return (pgrid.service.corba.exchange.ExchangeHandle)obj; else { org.omg.CORBA.por...
b45454b1-893f-47c4-b3e4-948d3fd6094e
8
@Override protected void draw() { super.draw(); StringRenderer.drawCenteredString("Select your icon:", this.xSize / 2, 42, 26, true, Color.WHITE); int xStart = (xSize / 2) - (34 * 4); boolean hasSelectedSomething = false; for(int i = 0; i < 8; i++) { Monopoly.getInstance().getEngine().bindTexture("...
451553bd-618e-4859-947f-7ab857d4f562
0
public AndroidSourceSinkManager getSourceSinkManager() { return sourceSinkManager; }
c81ee067-7675-406d-b4c3-a9c6afcca861
8
int getPitchOffsetInterval(KeyEvent e) { int interval = 0; switch (e.getKeyCode()) { case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: interval = Pitch.INTERVALS_PER_OCTAVE; break; case KeyEvent.VK_DOWN: case KeyEvent.VK_KP_DOWN: interval = -Pitch.INTERVALS_PER_OCTAVE; break; case KeyEvent.VK_LEFT:...
51054408-266e-4c39-9351-544f2c011043
1
public void start() { if (hiding) { // Control software already running, activate GUI updates: hiding = false; } else { control.start(); } }
572d67a7-70e1-4368-9f11-f974a78e04e7
0
public static float byte2Float(byte[] b) { int l = b[0]; l &= 0xff; l |= (long) b[1] << 8; l &= 0xffff; l |= (long) b[2] << 16; l &= 0xffffff; l |= (long) b[3] << 24; return Float.intBitsToFloat(l); }
3bdf4f90-953b-4f67-872b-3db2b5b406a4
7
private void createPatternsImpl(final AngleUnitFlapPattern seed, final LineType typeToBeAdded, final int indexToAdd, final int additionCount, final int aimedAdditionCount) { recursionCount++; if (acceptablePatternCondition.holds(seed)) { patterns.add(seed.cloneInstance()); } if (additionCount == aim...
8e6c9e7e-4858-4ade-955b-22fc352f88c1
0
public static void main(String[] args) throws Exception { new World().live(); }
c7d34e33-5f8e-4505-bd36-456206cedd32
8
static final void handleMessage(String string, String string_37_, int i_38_, String string_39_, String string_40_, int type, int i_42_, String string_43_) { try { anInt10382++; Message message = Class318_Sub2.messages[99]; for (int i_44_ = 99; (i_44_ ^ 0xffffffff) < -1; i_44_--) Class31...
7bd5d037-901d-422c-bed1-e17ade30c21b
4
public static ArrayList<Utilisateur> getAllUtilisateur() { Statement stat; ArrayList<Utilisateur> utilisateurs = new ArrayList<>(); try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("use nemovelo"); ResultSet res = stat.executeQue...
06c7105b-49ed-467a-9908-ae2d3353b41d
5
@Override public Ptg getPtgVal() { Object value = getValue(); if( value instanceof Ptg ) { return (Ptg) value; } if( value instanceof Boolean ) { return new PtgBool( (Boolean) value ); } if( value instanceof Integer ) { return new PtgInt( (Integer) value ); } if( value instanceof Number...
f5ca120c-6370-48ab-adc5-94c02fb5c0cd
7
@Override public void executeMsg(Environmental host, CMMsg msg) { if((affected instanceof Armor)&&(msg.source()==((Armor)affected).owner())) { if((msg.targetMinor()==CMMsg.TYP_REMOVE) ||(msg.sourceMinor()==CMMsg.TYP_WEAR) ||(msg.sourceMinor()==CMMsg.TYP_WIELD) ||(msg.sourceMinor()==CMMsg.TYP_HOLD) ...
a1d1c14b-f749-4135-a4b8-27da664c574d
7
@SuppressWarnings("unchecked") protected void UnZip() throws PrivilegedActionException { String szZipFilePath; String szExtractPath; String path = (String) AccessController .doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { return Util.getWorkingDirector...
dd8b26b7-0ecc-48dd-b8c4-9410b226d47c
5
protected void updateText( final BaseUI UI, Text headerText, Text detailText ) { if (selected == null) return ; headerText.setText(selected.fullName()) ; headerText.append("\n") ; final String cats[] = selected.infoCategories() ; if (cats != null) { for (int i = 0 ; i < cats.length ...
41e5344b-c145-4ea5-b7d3-42e45bec8b2e
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Corner other = (Corner) obj; if (e1 == null) { if (other.e1 != null) return false; } else if (!e1.equals(other.e1)) return false; i...
ea137ee1-cffa-4436-9103-fa23a32d3ac9
9
private List getPositionsStop(Traject traject) throws FileNotFoundException, UnsupportedEncodingException, IOException { FileInputStream stream = new FileInputStream("json/stops.csv"); CSVReader reader = new CSVReader(new InputStreamReader(stream, "UTF-8")); String[] nextLine; List stop...
0291fd97-0f0f-4509-9fd4-2cae0e9b2655
6
@Override public void keyReleased(KeyEvent e) { boolean unique=true; if (view.getNameTextField().getText().equals("")){ model.setWarning("Attribute name is empty"); view.getOkButton().setEnabled(false); } else { for (int i=0; i<view.getModel().getObjectUmlAtIndex(view.getIndex()).attributListSize(); i++...
a4a3f8dd-fd4d-4957-bb00-e5797974f2d7
2
static void input(double[][] matrix){ for(int i = 0; i < matrix.length; i++){ for(int j = 0; j < matrix[i].length; j++){ matrix[i][j] = scan.nextDouble(); } } }
ebb7ad80-fb28-43ea-b342-41278c797391
5
public String multiply(String a, String b) { // Start typing your Java solution below // DO NOT write main() function if ("0".equals(b) || "0".equals(a)) // 先排除,不然后面排除更麻烦 return "0"; int m = a.length(); int n = b.length(); if (m < n) { String c = a; int p = m; a = b; b = c; m = n; n = p...
ff76c74f-e2a1-4a1b-a49d-33b72d14586e
2
public static JsonElement fetchJson(String username, String password, String urlEndpoint) throws IOException { URL url = new URL(urlEndpoint); URLConnection urlConnection = url.openConnection(); if (username != null && password != null) { String authString = username + ":" + passwor...
acb20792-c642-4ab0-88d8-9b348025a78a
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...
db45556a-61f7-4d8d-801c-5be3313f146e
7
private boolean checkQuantity(Item item, Order cOrder, int quantity, boolean checkCart) throws Exception { ItemStack is = cOrder.getItem(item.getId()); int checkQt = quantity; if (is != null && checkCart) { checkQt += is.quantity; // we have to check quantity summing items already in...
d1744b4a-ee33-4d1d-9a96-9468ef097b7f
1
public boolean opEquals(Operator o) { return (o instanceof BinaryOperator) && o.operatorIndex == operatorIndex; }
b79cf304-8e5e-4f2a-8a26-121e02dcf24b
2
@Override public void setSourceItem( DefaultBox<?> sourceItem ) { if( sourceItem != null ) { comment = (DefaultCommentBox) sourceItem; comment.setConnection( this ); } else { comment = null; } super.setSourceItem( sourceItem ); }
fa27b951-d2e3-497f-80c2-63ee82abfd39
7
private double shade() { Vector poi = i.poi; Ray ray; LinkedBody lb; Body b; int numLights = lights.length; double distance = -1.0, brightness = 0.0, lambertian = 0.0, brightnessPerLight = 1.0 / numLights; boolean hitSomething; for (Vector L : lights) { lambertian = L.dot(i.nor...
fb587c2d-6ce6-4dc8-b4c4-84b75dfe2f1c
6
private String map(int year, int month, int day) throws NodeMeaningKeyErrorException { System.err.println(year + "/" + month + "/" + day); year -= baseYear; if (year < minYear || year > maxYear) { throw new NodeMeaningKeyErrorException(); } if (month < min...
b1d319bc-7e75-461a-a231-a9cab64a60e9
8
public boolean isItemConnected(int xx, int yy) { try { if(enabledGrid[xx-1][yy]) return true; } catch (Exception e) {} try { if(enabledGrid[xx+1][yy]) return true; } catch (Exception e) {} try { if(enabledGrid[xx][yy+1]) return true; } catch (Exception e) {} try { if(enabledGrid[xx][yy-1]) return true; } catch ...