method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ebebb443-dc67-41b0-957f-d7f556f6e714
7
public synchronized DataInputStream getChunkDataInputStream(int x, int z) { if (outOfBounds(x, z)) { debugln("READ", x, z, "out of bounds"); return null; } try { int offset = getOffset(x, z); if (offset == 0) { // debugln("READ", x...
ba344736-1196-47ca-b712-4373df471b53
2
public static final boolean isPython(String fileName) { for (String file : PYTHON) { if (file.equals(fileName)) { return true; } } return false; }
91ef7ae6-924d-4950-8388-c934b6390913
2
public int[][] convert(Object[][] g) { int[][] gf = new int[g.length][g[0].length]; for (int i = 0; i < g.length; i++) { for (int j = 0; j < g[0].length; j++) { gf[i][j] = Integer.parseInt(g[i][j] + ""); } } return gf; }
54d6eb04-1bab-41c7-a8cc-db09825cc8eb
1
public void setLeft(boolean b) { left = b; if(right) right = !b; // facingRight = !b; }
554058ee-75d6-46ad-8e7c-c5fd6aa0101e
0
public String toString() { return this.getName(); }
5127bcbb-3611-4290-8479-c3f4c9636147
6
public void printEnum(PaperCurrency paperCurrency) { String output = null; // It's possible to do without a switch statement switch(paperCurrency) { case ONE: output = "$1"; break; case FIVE: output = "$5"; break; case TEN: ...
259fd7b0-a74e-4450-b320-66bae29c6ddb
2
public void handlePressedKeys(ArrayList<KeyButtons> keyPressed) { if(keyPressed.contains(KeyButtons.ESCAPE)) { marioWorld.setWhatcha(Doing.PAUSE); } if (!map.isDisableInpute()) { boolean setter = true; handleKeys(keyPressed, setter); ...
185c67bd-e1ed-41b6-bbf4-198e0015004e
5
public void read(AlgReader reader) { for (Setting setting : map.values()) { if (setting instanceof AlgFileSetting) continue; String value = reader.getValue("Settings", setting.getName()); boolean locked = true; if (value.startsWith(AlgReader.undef...
7cd8af3a-acbb-42b2-8f6f-96d185b61e33
8
public void renderPlayer(int xp, int yp, Sprite sprite) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < 32; y++) { int ya = y + yp; for (int x = 0; x < 32; x++) { int xa = x + xp; if (xa < -32 || xa >= width || ya < 0 || ya >= height) break; if (xa < 0) xa = 0; int col = sprite.pixels[x ...
70374208-2439-42d8-b323-05ad2fc1469f
5
public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // RHINO_ID return RHINO_ID; case 2: // TITAN_ID return TITAN_ID; case 3: // PROPERTIES return PROPERTIES; case 4: // OUT_EDGES return OUT_EDGES; case 5: //...
57ba7f45-43b6-4c67-a185-4611caa6566f
5
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof StarSystem)) return false; StarSystem that = (StarSystem) o; if (elements != null ? !elements.equals(that.elements) : that.elements != null) return false; if (!name.equals(that.name))...
308dd16b-6521-4b3c-ba0f-129283f410d3
1
public String save() { String temp = "5;"; for(int x = 0; x<spells.size(); x++) { temp += spells.get(x).getID() + ";"; } return temp; }
b976f465-c061-4921-8ee4-ea0a0ac89454
5
@SuppressWarnings("nls") public static final String reflow(String text) { if (text == null) { return ""; } int count = 0; StringBuilder buffer = new StringBuilder(); StringTokenizer tokenizer = new StringTokenizer(text.replaceAll("[\\x00-\\x08]", "").replaceAll("[\\x0b\\x0c]", "").replaceAll("[\\x0e-\\x1f...
0823b4e7-858a-4f4f-821e-28d6e2532849
4
public void test1() { //create a timeserver to test with TimeServer ts = new TimeServerLinked(); //create a traffic grid builder with 2 rows and 3 columns TrafficGridBuilder tgb = new TrafficGridBuilder(2,3, ts); Assert.assertTrue(tgb.getHorizontalRoads().length == 2); Assert.assertTrue(tgb.getVerticalRoad...
b4a9181e-aa0f-4015-95b2-3ad980476a0f
0
public int getGemCount() { return this.Bag.size(); }
0c714982-9636-4593-ba88-6c3f94e3522e
4
public void moveDirection(List<Hero> heroes, List<Tower> towers){ if(getDirection() != null){ startMove(); if(target instanceof Hero || target instanceof Tower && directionToTargetHasChanged(getDirectionToTarget(target))){ stopMove(); setDirection(getDirectionToTarget(target)); startMove(); } } ...
90c0c752-9fc5-418b-8b1a-efa32f51ec85
2
private void drawVisitedEdge(Graphics g, Edge e) { int x1 = e.getStart().getX(); int y1 = e.getStart().getY(); int x2 = e.getEnd().getX(); int y2 = e.getEnd().getY(); g.setColor(Color.BLACK); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { ...
a1639929-0049-43a2-a48e-3fcd6b7d3973
1
@SuppressWarnings("unchecked") public void addQustionToDB() { String questionStr = (String) question; String answerStr = getConcatedString((ArrayList<String>) answer); // add to database try { String statement = new String("INSERT INTO " + DBTable + " (quizid, position, question, answer, score, url) V...
c8ff5a10-871e-4cff-a08c-6d7663be99dc
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 fe...
fc29d26f-391f-43b1-b63d-8b87cfbe5f68
2
public void ge_all_function(TextArea area,SimpleNode node)throws SemanticErr{ int func_num = node.jjtGetNumChildren(); for(int i = 0;i<func_num;i++) { init(); SimpleNode func_node = (SimpleNode)node.jjtGetChild(i).jjtGetChild(0); if(func_node.toString().equal...
82d959e4-f367-40d5-b21b-5e367d159cb5
3
private char findAlternateSymbol(char character) { // test for known symbol aliases for (int i = 0; i < org.icepdf.core.pobjects.fonts.ofont.Encoding.symbolAlaises.length; i++) { for (int j = 0; j < org.icepdf.core.pobjects.fonts.ofont.Encoding.symbolAlaises[i].length; j++) { ...
cf8727ec-08cb-49c7-b817-f3a91c3c9148
9
public byte[] generateReport(String templatePath, ReportType type, Long from, Long to) throws ServletException, IOException { if (from == null) { throw new IllegalArgumentException("report start date cannot be null"); } if (to == null) { throw new IllegalArgumentExcepti...
69da3b0b-4f51-44fd-bd66-a8c2e817a36a
0
public int getMapHeight() { return this.map.length; }
d296a2b7-d46c-4479-b84b-c977a15974b1
0
public List<Root> getNode() { return null; }
61ae3354-f010-434e-a544-e962cc23c497
9
@Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); switch(cmd) { case CARGAR_APTOS: ctrlContratoNuevo.cargarApartamentos(); break; case ELEGIR_DUENIO: ctrlContratoNuevo.cargarDialogoElegirDuenio(); break; ...
50bb5831-f47b-4f34-ab28-ee39c2bc12cf
0
public CheckResultMessage checkG1(int day) { return checkReport.checkG1(day); }
7d5822b8-d995-4cfd-bd70-63965e8c33dc
0
public short getClassID() { return classID; }
349cce97-1add-4499-8c84-e7e47a2a1459
2
public String createMessage(User user, String title, String content){ //input check needed if (!(title.equals("")) || !(content.equals(""))){ Message m = new Message(user, title, content); this.messages.add(m); save(); return m.getId(); } return null; }
6c0ec815-a033-41b3-91b1-b6a47ce37f19
6
@FXML private void handleTxtBarCodeAction(ActionEvent event) { String itemCode = txtBarCode.getText(); // Subtraction if (itemCode.matches("[0-9]+-$")) { int input = Integer.parseInt(itemCode.replaceAll("-", "")); if (input > 0 && totalAmount > 0 && input - totalAmou...
670fff71-43bc-4675-89ce-03f06974d89a
2
private Map<String, Integer> getMap(String[] arr) { Map<String, Integer> result = new TreeMap<>(); Integer first = 1; Integer index; for (String s : arr) { if (result.containsKey(s)) { index = result.get(s); index++; result.put(s, index); } else { result.put(s, first); } } return result; ...
6998cc81-83da-4b44-a9e0-51f11b726933
5
public final void addObject(Object object) { if (object instanceof Iterable) { // Iterable for (Object o : (Iterable<?>) object) { m_objects.add(o); } } else if (object.getClass().isArray()) { // Array for (Object o : (Object[]) object) { m_objects.add(o); } } e...
6f789f14-3940-482a-90ba-551f5cd4d3bd
9
public ArrayList<Point> quickHullHelper(ArrayList<Point> pointsList, Point a, Point b){ if (a.getX() == b.getX() && a.getY() == b.getY()){ return new ArrayList<Point>(); } if (pointsList.size() == 0){ return new ArrayList<Point>(); } int indexOfFarthestPoint = -1; double distanceOfFarthestPoint = -1;...
1241c017-91bb-4f5d-8d5b-0fcfb1a3eb0a
8
public void clearReferences() { if (!referencesCleared) { if (account != null) account.removeReference(); if (transferAccount != null) transferAccount.removeReference(); if (category != null) category.removeReference(); ...
a562190d-92b2-4525-8a92-0757d8724fd5
8
public static void main(String[] args) { BigInteger sum = BigInteger.ZERO; for (int i = 1; i <= 10000; i++) { int n = i; while (n % 10 == 0) n /= 10; BigInteger N = new BigInteger(""+n); BigInteger current = new BigInteger(""+n); if (n == 9999) current = new BigInteger("111122222222222...
ccb0373b-5679-4f88-a48b-63d1fdd88bc8
7
@Override public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareF...
ddef1666-465d-480e-b070-b207626e4604
9
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { final CachedAsset cachedAsset = loadAsset(req.getRequestURI()); if (cachedAsset == null) { resp.sendError(HttpServletResponse.SC_N...
d9941229-a755-49c0-8c96-98a876253f8e
1
@Override public void print() { for(Integer iObj:list) { System.out.println(iObj); } }
fe9aea2c-a5de-4316-9bbf-768b9fefb634
2
@SuppressWarnings("rawtypes") @Test public void testMapLoad() throws Exception { Map<String, Double> map = new HashMap<String, Double>(); map.put("KEY", 3.0); map.put("ANOTHERKEY", 4.0); PersistenceManager persist = new PersistenceManager(driver, database, login, password); persist.dropTable(Object.class);...
bc99b8cc-f837-4a85-9394-fe7a4eb2db92
9
public void renderMapGL(GameContainer container, Graphics g, int x_start, int y_start, int tileSize, int size) { int x, y; float fr, fg, fb; GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glLoadIdentity(); GL11.glShadeModel(GL11.GL_SMOOTH); if (currentMap != null) { for (y...
d63dac84-200a-417b-a41b-484ddd345533
7
final void O(int i, int i_765_, int i_766_) { if (i != 128 && (mask & 0x1) != 1) throw new IllegalStateException(); if (i_765_ != 128 && (mask & 0x2) != 2) throw new IllegalStateException(); if (i_766_ != 128 && (mask & 0x4) != 4) throw new IllegalStateException(); synchronized (this) { for (int...
4bb812fe-fcbe-4e00-ad71-7e62bb515548
3
public void register (int objectID, Object object) { if (objectID == Integer.MAX_VALUE) throw new IllegalArgumentException("objectID cannot be Integer.MAX_VALUE."); if (object == null) throw new IllegalArgumentException("object cannot be null."); idToObject.put(objectID, object); objectToID.put(object, objectID...
0f814582-07ab-441b-b0a5-0c72898d99a4
8
public void move(Action action) { if (action == Action.DOWN && blankRow != N - 1) { board.set(blankRow * N + blankColumn, board.get((blankRow + 1) * N + blankColumn)); board.set((blankRow + 1) * N + blankColumn, 0); blankRow = blankRow + 1; } if (action == Action.RIGHT && blankColumn != N - 1) { board...
dd0a7d1e-e094-40c8-9894-8309262bb6ff
7
private void jouerUnTour(){ Carte carteJoueur1 = joueur1.tirerUneCarte(quelCarte); Carte carteJoueur2 = joueur2.tirerUneCarte(quelCarte); cartesEnJeu++; nbrDeTour++; System.out.println("Tour N°" + nbrDeTour + " - " + joueur1.getNom() + " tire " + carteJoueur1.getTitre() + " cont...
3ed951f1-07fa-462f-915d-00bd95f97a12
1
private int score(int[] bowl, int bowlId, int round){ int score = 0; for (int i=0 ; i<bowl.length ; i++){ score += preference[i] * bowl[i]; } System.out.println("Score: " + score); return score; }
63196c15-664f-4a1d-8e84-ef391dd4d6c6
1
private void onChangeMapSize(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onChangeMapSize try { toggler.setState(false); game.setMapSize(Integer.parseInt(JOptionPane.showInputDialog(this, "This will clear the map.\nEnter map size:", game.getMapSize()))); game.reset(); ...
b911513a-832f-4bb6-a2f5-8c17fd1fd390
8
public void render(GUIContext container, Graphics g) { if (lastKey != -1) { if (input.isKeyDown(lastKey)) { if (repeatTimer < System.currentTimeMillis()) { repeatTimer = System.currentTimeMillis() + KEY_REPEAT_INTERVAL; keyPressed(lastKey, lastChar); } } else { lastKey = -1; } } Rec...
03ad8393-4614-4c31-aef2-8c456cd33326
6
@EventHandler public void onPlayerChat(AsyncPlayerChatEvent event) { Player player = event.getPlayer(); if(plugin.config.getBoolean("Apply.Enabled")) { String group = plugin.config.getString("Apply.Group"); if(plugin.config.getBoolean("Apply.Mute") && !player.hasP...
32cb4628-502f-4d21-b991-dcb0662a7f60
7
private boolean checkSkill() { return checkCompleteSkillOne[0] && checkCompleteSkillOne[1] && checkCompleteSkillOne[2] && checkCompleteSkillOne[3] && checkCompleteSkillOne[4] && checkCompleteSkillOne[5] && checkCompleteSkillOne[6] && checkCompleteSkillOne[7]; }
5bee3c3a-51c0-48f3-9fe5-b1308a45e424
9
public void loadAndVerifyLibrary(String systemType, boolean linux) { String suffix; if (linux) { suffix = ".so"; } else { suffix = ".dll"; } InputStream inputStream = this.getClass().getResourceAsStream(LoadLibraryUtil.LIBRARY + systemType + suffix); ...
7ccb5957-c8fb-4a52-b478-30f3fed0208a
4
protected boolean isInGrabBar(int mouseX, int mouseY){ mouseY = Standards.W_HEIGHT - mouseY - 1; if ((mouseX > ScreenX) && (mouseX < ScreenX + Width)){ if ((mouseY > ScreenY) && (mouseY < ScreenY + GrabBarHeight)){ return true; } } return false; }
bdca6664-31a0-4f31-bee9-9137f79af2d9
3
public final ModEntry pollFromQueue() { while (this.queue.isEmpty()) { if (this.crawlDone) { return null; } try { wait(); } catch (final InterruptedException e) { return null; } } return this.queue.remove(); }
daaeaaa4-14b2-4e63-88b3-57b66b01ba05
1
public Object opt(String key) { return key == null ? null : this.map.get(key); }
ca94290b-6cbe-47c6-9222-fa32af87c2ab
1
public float GetFloat(String name) { Float result = m_floatHashMap.get(name); if(result != null) return result; return 0; }
64c751fa-0e5c-498d-a179-432671182692
4
public static void showPEInfoBox(JFrame p, String key, String type, BoxClosed2 fn) { commonSettings(); p.setVisible(false); dialog.setTitle("Info"); JTextField jKey = new JTextField(9); jKey.setText(key); TypeComboBox jType = new TypeComboBox(p, (nowSelected) -> { ...
fcc7798d-8e3c-4529-9d46-cfd128230217
3
public static void noSpace(String string) throws JSONException { int i, length = string.length(); if (length == 0) { throw new JSONException("Empty string."); } for (i = 0; i < length; i += 1) { if (Character.isWhitespace(string.charAt(i))) { throw...
23f83618-e305-4ffd-ba2c-def2cb9c6072
8
public boolean activate() { String str = null; try { Object localObject; if (this.which == 0) { str = "Error saving game! Contact bugs@legomindstorm.com for assistance."; localObject = new ByteArrayOutputStream(); ObjectOutputStream localObjec...
663a8c1a-3a85-4b6a-ab15-c24d9346034f
6
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); d: do { line = br.readLine(); if (line == null || line.length() == 0) break d; int times = Integer.parseIn...
c750b664-fc67-4565-ad20-5ff3f5ef866e
8
public static void main(String[] args) throws IOException { Scanner in = new Scanner(new File("beads.in")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("beads.out"))); int N = in.nextInt(); in.nextLine(); String necklace = in.next(); // copy the n...
97938cb7-75e9-4001-b804-e45f543da513
9
@Override public String toString() { StringBuilder sb = new StringBuilder("Span("); boolean first = true; sb.append("trace_id:"); sb.append(this.trace_id); first = false; if (!first) sb.append(", "); sb.append("name:"); if (this.name == null) { sb.append("null"); } else { ...
9ef726bb-3704-4d32-8269-21e92833645f
7
public static void main(String[] args) { Scanner inFile = null; try { // Create a scanner to read the file, file name is parameter inFile = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/prog465a.dat")); } catch (FileNotFoundException e) { System.out.println("File not found!"); ...
37464755-040b-47bb-aa7a-a1820a2a4f1d
5
public JSONObject increment(String key) throws JSONException { Object value = this.opt(key); if (value == null) { this.put(key, 1); } else if (value instanceof Integer) { this.put(key, ((Integer) value).intValue() + 1); } else if (value instanceof Long) { ...
8c1b9116-dda5-4dbf-9351-664aaf113c4d
0
@Basic @Column(name = "PCA_TERMINAL") public String getPcaTerminal() { return pcaTerminal; }
0773afa5-99b6-4830-b33f-1f36eb35eb9a
2
public Customer searchViaPhone(String phone){ for (Customer customer : customers) { if (customer.getPhone().equals(phone)){ return customer; } } return null; }
c47528ef-3322-4bcf-8826-a8e1296d69a6
4
public boolean saveData() { try { writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); try { writer.write(tabletoString(columnnames)); writer.newLine(); } catch (IOException e) { e.printStackTrace(); } for (int i = 0; i < rowdata.length; i++) { writer.write(t...
cb64ff83-8751-4b55-b5d7-0734d81461f3
1
public boolean hasDimensions(int rowSize, int colSize) { return (getRowSize() == rowSize && getColSize() == colSize); }
846d5af0-1c02-4385-a435-0ca4fac198df
4
public static String readFile(String filePath) { String loaded = ""; String NL = System.getProperty("line.separator"); BufferedReader read = null; try { String loading; read = new BufferedReader(new FileReader(filePath)); loaded = read.readLine(); while((loading = read.readLine()) != null) { ...
bcca23ea-a6c3-40c9-af86-a3488e4b4243
7
public void run() { //variable to store selected random number int selectedRandomNumber; //list of resources available String[] OS, S3Storage, DBService; OS = new String[]{"RedHatLinux", "Ubuntu", "SUSELinux", "Windows", "AmazonLinux"}; ...
fcb452fb-e9b6-4852-9c1b-a6349943d7d1
1
protected void incrementAge() { setAge(getAge() + 1); if(getAge() > getMaxAge()) { setDead(); } }
be854f7d-1ef5-4a6a-9437-a8e5ecea8ee0
8
public static final void checkDonation(final Player player) { if (player.isExtremeDonator()) return; if (player.getTemporaryAttributtes().get("CheckingDonation") != null) return; player.getTemporaryAttributtes().put("CheckingDonation", Boolean.TRUE); player.getPackets().sendGameMessage("Checking donation....
a1c77743-2afc-4145-9c67-4751e11527c9
1
public ContactHelper getContactHelper() { if (contactHelper == null){ contactHelper = new ContactHelper(); } return contactHelper; }
4aba8157-ef93-483a-8ae5-0bf334b36ee7
2
@Override public Patient getPatient(int healthRecord) throws Exception { log.debug("getPatient method called..."); PreparedStatement stmt = null; Patient pt=null; Connection conn=JDBCManager.getConnection(); try { String sql = "SELECT * FROM Patient where HealthRecordNumber=?"; stmt = conn.prepareS...
fade1301-c4a3-4d47-a16c-90b05258ef64
2
public PopupUI() { super("Pick an implementation for player"); setPreferredSize(new Dimension(605, 120)); setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10)); setResizable(false); String[] bookTitles = new String[] { "1. Human (interactive) player", "2. RandomPlayer (makes random moves)", "3. EagerPl...
710ec718-e5c2-4b45-9f69-5aebfecc7eea
3
public boolean dfs(int previous, int current) { visited[current] = 1; ArrayList<Integer> neighbors = graph.getAdjacenctVertices(current); for (int next : neighbors) { if (visited[next] == 0) { dfs(current, next); } else if (next != previous){ return false; } } visited[current] = 2; retur...
f5e960a9-49fd-4bfa-97bb-b63ac6a2bf5b
3
public boolean newLine() { for (boolean isBlock : grid[0]) { if (isBlock) return false; //highest line contains block -> game over } //System.arraycopy(grid, 1, grid, 0, height - 1); //move blocks up for (int y = 0; y < height - 1; y++) { System.arraycopy(grid[y +...
41817e57-cfbf-4090-9ffe-fbb6f45001d7
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...
a28755a9-5637-4e54-8e57-e48b463f96c1
3
public void initialize() throws IOException { try { fis = new FileInputStream(filename); in = new ObjectInputStream(fis); model = (Model) in.readObject(); in.close(); updateViews(); } catch (FileNotFoundException ex) { this.populateMovies(); Logger.getLogger(Controller.class.getName...
ccae184c-1ead-40ed-b9ee-34a39722e420
9
private boolean r_mark_suffix_with_optional_y_consonant() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 153 // or, line 155 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 154 // (, line 154 // test, line 154 v_2 = limit - cursor; // lit...
2653c4d7-f1ec-4656-95d7-2b3b1508827b
2
public void visitSCStmt(final SCStmt stmt) { print("aswizzle "); if (stmt.array() != null) { stmt.array().visit(this); } if (stmt.index() != null) { stmt.index().visit(this); } }
f7b3d65e-094a-4eb7-8f64-a7fb060c9394
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof NumberResult)) return false; NumberResult other = (NumberResult) obj; if (number == null) { if (other.number != null) return false; } else if (!number.equals(other...
9415f93f-b667-4f35-90c9-c45c5097742a
6
private void check_solve_array(Method m, boolean solveL, boolean transT, boolean transB) { int offsetL = 2; int offsetB = 3; DenseMatrix64F L = createRandomLowerTriangular(3); if( !solveL ) { CommonOps.transpose(L); } if( ...
7d372ba4-d2b4-4da7-9641-3d249204012b
6
public GridPath getPath(){ GridPath path = null; if(!validLocation(start.getX(), start.getY()) || !validLocation(end.getX(), end.getY())){ return null; } GridLocationAstar startingLocation = new GridLocationAstar(start.getX(), start.getY(), start.isEnd(), 0, -1); sortedLocationList.add(startingLocati...
65069b5c-d068-478a-8eeb-e36ebdbf785a
2
public static void handleGetEventReply(HTSMsg msg, HTSPClient client) { Collection<String> requiredFields = Arrays.asList(new String[]{"eventId","channelId","start","stop"}); if (msg.keySet().containsAll(requiredFields)){ long eventId = client.events.add(msg); client.monitor.addEvent(eventId,client.getClientI...
e86598d1-cfcd-49b2-a82f-56d8ffcea4db
7
public int getTimeIndex(Time time) { int index = -1; if (time.getIdTime() > -1) { index = times.indexOf(time); } else { for (Time t : times) { boolean actId = t.getIdActivity() == time.getIdActivity(); boolean sTime = t.getStartTime().equals(time.getStartTime()); boolean eTime = t.getEndTime(...
d378f741-2550-4e58-8276-0cf9782a1fdb
0
public String getId() { return id; }
e0d14b08-abc3-4ebf-8dd3-b13563f57984
6
@Override public void createMatch(Match match) { validate(match); checkDataSource(); if (match.getId() != null) { throw new IllegalArgumentException("match already exists"); } try (Connection conn = dataSource.getConnection(); PreparedStatement st...
a1c47a5f-840c-4e03-b862-78bf6d39aedc
4
private void btncalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncalcularActionPerformed String registro; costo=0; if(chbxlapto.isSelected()){ costo=costo + lapto; } if(chbxtv.isSelected()){ costo=costo + tv; } if(chbx...
56dd1d48-3e3b-467e-8d83-b4846be28a30
8
public boolean predict(FeatureVector featureVector, SingleDecision decision) throws MaltChainedException { // if (cardinalities == null) { // if (getConfigFileEntry(".car") != null) { // cardinalities = loadCardinalities(getInstanceInputStreamReaderFromConfigFile(".car")); // } else { // cardinalities = getC...
c642b9b2-ff4e-4228-b55c-ecd7d1c8b657
4
public boolean checkShape(Shape shape) { ArrayList<Point> shapePoints = shape.getBlocks(location()); boolean sameShape = false; if (attachedPoints.size() == shapePoints.size()) { Collections.sort(shapePoints, new PointCompare(true)); Collections.sort(attachedPoints, new PointCompare(true)); for (i...
3b3916f1-66b7-49eb-8c60-063dadd636a9
3
@SuppressWarnings("nls") public static boolean extractBoolean(String buffer) { buffer = normalizeNumber(buffer, false); return "true".equalsIgnoreCase(buffer) || "yes".equalsIgnoreCase(buffer) || "on".equalsIgnoreCase(buffer) || "1".equals(buffer); }
0c8c3d64-8b1a-4dea-9105-bdd04bb418ab
2
public List<Road> DisplayAllRoad (){ List<Road> RoadList = new ArrayList<>(); String requete = "select * from road"; try { Statement statement = MyConnection.getInstance().createStatement(); ResultSet resultat = statement.executeQuery(requete); while(result...
ce39b827-d1dc-4187-8432-7d8afbaece86
1
@Override public void drawPreview(Graphics2D g) { if (!canvas.getClear()) { canvas.setGraphicsDetails(g); g.drawLine(startX, startY, endX, endY); } else { canvas.resetClear(); } }
eb0e0003-22a7-4d77-823f-a9f4e6794b73
6
public void run() { ObjectInputStream inStream; try { inStream = new ObjectInputStream( new BufferedInputStream(clientSocket.getInputStream())); } catch (Exception ex) { // Мы не смогли создать входной поток Log.add("Не смогли создать вхожн...
09921a31-c0fd-4a13-bf71-82308891c4de
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Way other = (Way) obj; if (nodes == null) { if (other.nodes != null) return false; } else if (!nodes.equals(other.nodes)) return fals...
b1262657-c866-4ff4-8574-afc7c77e6140
1
public boolean opEquals(Operator o) { return (o instanceof BinaryOperator) && o.operatorIndex == operatorIndex; }
81fd1788-fa66-4974-ab9b-bce8090330c5
1
public final synchronized void reconnect() throws IOException, IrcException, NickAlreadyInUseException{ if (getServer() == null) { throw new IrcException("Cannot reconnect to an IRC server because we were never connected to one previously!"); } connect(getServer(), getPort(), getPass...
bb9eed64-ef73-4e87-80e7-171ab1642456
8
public static void main (String[] args){ // Create me! Person ryan = new Person("Ryan Brushett","6131111111",24,new SavingsAccount(0,1234,0.06)); Account checking = new CheckingAccount(0,4321,55); checking.setOwner(ryan); try{ ryan.getAccountById(1234).deposit(3000); } c...
4aea2c1a-c60a-49a0-b80c-e81e1d94667b
1
public static IntBTNode treeCopy(IntBTNode source) { IntBTNode leftCopy, rightCopy; if (source == null) return null; else { leftCopy = treeCopy(source.left); rightCopy = treeCopy(source.right); return new IntBTNode(source.data, leftCopy, rightCopy); } }
5d3d41b1-ab96-4b3c-86e4-f994598f1c18
2
public static boolean blockMaterialIsTeamMaterial(Block b){ return b.getType() == Team.RED.getBlockType() || b.getType() == Team.BLUE.getBlockType() || b.getType() == Team.NONE.getBlockType(); }
f5ea2e78-c758-46fd-84b4-fa345a6a6673
5
public void updatepround() { if (round == 0) pround = "East " + (dealer + 1); else if (round == 1) pround = "South " + (dealer + 1); else if (round == 2) pround = "West " + (dealer + 1); else if (round == 3) pround = "North " + (dealer + 1); else pround = "???" + (round - 3) + " " + (dealer + ...
736a3d87-76c8-4516-85ec-42426dd41720
4
@Override public void setSubNoteSource(SubNoteSource subNoteSource) { if(transmitter != null) { transmitter.close(); } if(device != null) { device.close(); } if(subNoteSource.getIdentifier() == null) { // No device return; } try { device = (MidiDevice)subNoteSource.getIdentifier(); tr...