method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5e07ba24-a959-499b-ae94-c36cd9c6d58d
6
@Override public void startElement(String name, Attributes attr) { allTags.add(bodyFlag ?name:null); if (bodyFlag && isPrint(name,attr)) { for (int i=0;i<tagPos;i++){ System.out.print(" "); } System.out.print("<" + name); for (int i = 0...
1dc7f111-b4bc-4da5-a8c5-fdf3ec79f90b
3
public Frameset(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "cols": cols = Cols.parse(this, v); break; case "rows": rows = Rows.parse(this, v); break; ...
4b3212a3-4c55-4dbb-88d3-f9646c46439b
0
private void setInitial(boolean value) { final ReentrantLock l = lock; l.lock(); try { initial = value; } finally { l.unlock(); } }
2dc319fd-646b-4beb-a18e-b3a3be5353de
4
public void onLivingUpdate() { if(this.worldObj.isDaytime()) { float var1 = this.getEntityBrightness(1.0F); if(var1 > 0.5F && this.worldObj.canBlockSeeTheSky(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY), MathHelper.floor_double(this.posZ)) && this.rand.nextFloat() * 30....
c9d6ca47-977d-45d9-a008-e773148801c7
2
public InputStream openClassfile(String classname) { try { URLConnection con = openClassfile0(classname); if (con != null) return con.getInputStream(); } catch (IOException e) {} return null; // not found }
c1a0d1fe-e48f-46b3-8ad0-1467f8365956
2
@Override public Object load(){ Object model=null; PreparedStatement stmt = null; ResultSet rs = null; XStream xStream = new XStream(new DomDriver()); try { //TODO change query String query = "select descriptions from GameDescriptions"; stmt = db.getConnection().prepareStatement(query); rs = stmt...
a0b531ec-3271-45d2-9d17-4f80fa376e27
4
public void setGrid(Grid<?> gr) { currentLocation = new Location(0, 0); JViewport vp = getEnclosingViewport(); // before changing, reset // scroll/pan position if (vp != null) vp.setViewPosition(new Point(0, 0)); grid = gr; originRow = originCol = 0; ...
1e4b7074-a430-483a-8d11-eb7da9c16bec
6
public static void main(String[] args) { //String str = new String("A string"); String s = "A string"; // if (str.equals(s)) { // System.out.println("A"); // } else { // System.out.println("B"); // } // char c = 'r'; // for (int i = 0; i < str.length()-1; i++) { // System.out.println(str.subst...
e027fe8f-2a1f-493b-9307-f985fc43f432
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(lastTogether==0) return true; if((shadowing!=null)&&(invoker!=null)&&(shadowing.location()==invoker.location())) lastTogether=System.currentTimeMillis(); final long secondsago=System.current...
e0997a86-f9a9-4e51-b4f5-b145c8c10426
6
public Boolean saveThisObject() { if(Globals.getInstance().preferences.saveFolder == null) return false; else if(name != null && name.equals("Unnamed")) return false; else if(shortName == null || shortName.equals("")) { if(createShortName(this)) Globals.getInstance().changeFlag = true; else return false; ...
d5b9b88f-e948-49a5-8f63-d9fa859ee8dc
5
public void insertionSort(int[] myList) { for(int i = 1; i < myList.length; i++) { /* check if stopButton has been selected */ if(stopFlag == true) { return; } int k = i; while(k > 0) ...
32ef5f5e-2aa0-4889-8cc4-775bbb4bf2d6
3
private int computeWidth(TPoint[] points) { int maxX = points[0].x; int minX = points[0].x; for (int i = 1; i < points.length; i++) { TPoint currentPoint = points[i]; if (currentPoint.x > maxX) maxX = currentPoint.x; if (currentPoint.x < minX) minX = currentPoint.x; } // + 1 is to account for di...
d06c0be1-d148-46ab-b617-d450cf32bdba
6
public VcfHeader readHeader() { // No more header to read? if ((nextLine != null) && !nextLine.startsWith("#")) return header; try { while (ready()) { line = readLine(); if (line == null) return null; // End of file? if (!line.startsWith("#")) { nextLine = line; return header; // End of ...
2506d686-c1df-4e1c-82b8-0d898feeeb81
8
private void SallesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SallesActionPerformed // TODO add your handling code here: switch(etat){ case Debut: donner1.frame_Salle(); this.donner1.setVisible(true); this.donner1.setEta...
ec78de57-7c79-42a7-9206-5db649f3daf5
0
public PlotModel(final MultivariateFunction function, float xMin, float xMax, float yMin, float yMax) { model = new DefaultSurfaceModel(); model.setXMax(xMax); model.setXMin(xMin); model.setYMax(yMax); model.setYMin(yMin); model.setBoxed(true); ...
ec49d87c-8f1d-4a38-9d0f-b192a1a04293
0
public void paintComponent(Graphics gr) { Graphics2D g = (Graphics2D) gr; super.paintComponent(g); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.white); Dimension d = getSize(); g.fillRect(0, 0, d.width, d.height); g.setColor(Color.black); t...
10e4b21b-3c30-4ee5-bc80-a74e3581fbe8
5
public static EnumMap<Kentta, String> haeLomakkeenTiedot(JPanel lomake) { EnumMap<Kentta, String> lomakkeenSisalto = new EnumMap(Kentta.class); Component[] komponentit = lomake.getComponents(); //näihin tallenetaan kirjalomakkeen comoboxissa valittu kenttä ja comboboxin nimi, jotta //v...
6248848a-16f7-4d87-a2f3-e58a94054213
8
public boolean equals(PixImage image) { int width = getWidth(); int height = getHeight(); if (image == null || width != image.getWidth() || height != image.getHeight()) { return false; } for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (!(getRed(x, y) == image.getRed(x, ...
ae594766-c3d3-492b-8f85-30f0aef5c26f
2
public void changeRepeatDay(Integer day) { if(day == -1) { return; // something went wrong in the callback } if(repeatDays.contains(day)) { repeatDays.remove(day); } else { repeatDays.add(day); } Collections.sort(repeatDays); r...
fbe2f452-b5f5-4084-bbb7-81dcdeec7ecb
2
private void calculateVelocities(){ for(int i = 0; i < position.length; i++){ double[]cognitive = calculateCognitiveVelocity(i); double[]social = calculateSocialVelocity(i); for(int k = 0; k < position[i].length; k++){ velocities[i][k] = velocities[i][k] + cognitive[k] + social[k]; } } }
f71d44ba-8952-45b9-a371-32d376873ca7
1
@Test public void shouldSortProvidedArray() throws Exception { Integer[] array = new Integer[]{81, 94, 11, 96, 12, 35, 17, 95, 28, 58, 41, 75, 15}; sort.sort(array); for (int i : array) { System.out.println(i); } }
c7b997c4-c606-4238-946b-0adfaf30cce0
2
public boolean isLeaf(Object node) { if (node instanceof Page) { Page p = (Page) node; return (p.subPages.size() + p.names.size()) == 0; } else if (node instanceof CollectionAndArtist) { return true; } else { throw new NotImplementedException(); ...
faa1a76f-86bd-4e41-a061-30d7fb9374aa
6
@Override public void deserialize(Buffer buf) { memberId = buf.readInt(); if (memberId < 0) throw new RuntimeException("Forbidden value on memberId = " + memberId + ", it doesn't respect the following condition : memberId < 0"); worldX = buf.readShort(); if (worldX < -255...
691e06b4-52a4-4889-979c-efd99b36aea3
3
@WebMethod(operationName = "ReadInvoiceOutDetail") public ArrayList<InvoiceOutDetail> ReadInvoiceOutDetail(@WebParam(name = "inv_out_det_id") String inv_out_det_id) { InvoiceOutDetail inv_out_det = new InvoiceOutDetail(); ArrayList<InvoiceOutDetail> inv_out_dets = new ArrayList<InvoiceOutDe...
daf80836-32f6-4b82-9f37-2be3d4d14076
0
public void setAlgorythmFile(File file){ algorythmFile = file; }
574e7c76-a81c-4c15-a223-bb5c7cb75a4c
4
public static Arena LoadFromDisk(String name) { File arenaFileLocationPath = Config.getArenaFileLocationPath(); File arenadir = new File(arenaFileLocationPath, "arenas"); if (!arenadir.exists()) { arenadir.mkdir(); } File ArenaFile = new File(arenadir, name); ...
ca38a9da-1e12-4cfe-a50a-2e32829cfbfe
2
public void onEnable() { dataFolder = getDataFolder(); Configuration.pairFileAndClass(loadFile("config.yml"), Properties.class); Configuration.pairFileAndClass(loadFile("local.yml"), Messages.class); if (Properties.SHOW_NOTIFICATION_ON_TRANSACTION) { getServer().getPluginMa...
4cf86dd0-686f-442f-9f96-8ce31d7d8dd7
4
public void displayUsersTasks(){ SetOfTasks usersTasks = new SetOfTasks(); try { Project tempProject = null; ResultSet dbUsersTasks = null; Statement statement; statement = connection.createStatement(); dbUsersTasks = statement.executeQuery( "...
afe1737e-7005-4a26-a6e9-8a14aa73aba6
1
private double exptLessThan(double b) { double sum=0,interval=(b-12)/1000,val=12; for (int i = 0; i <1000; i++) { sum+=phi(val, mu, sigma)*val*interval; val+=interval; } return sum/probLessThan(b); }
174d2f43-0614-41bc-8d95-0ee3a0aba04d
5
@Override public final void keyPressed(KeyEvent event) { int code = event.getKeyCode(); if (code > 0 && code < keys.length) keys[code] = true; /* * This allows developer to quickly check the keycode for any * key to use, simply hold the ALT key and press another */ if (hub.DEBU...
2c41802e-b1b4-43b6-8505-e5ececb60663
2
public String getText() { for (JRadioButton c : lista) { if (c.isSelected()) return c.getText(); } return ""; }
2b5327af-c7b9-44d5-8f18-4cb63eb91492
3
@Override public void connect(Integer p, Integer q) { int pId = numbers[p]; int qId = numbers[q]; if (pId == qId) {//they are already connected return; } for (int i = 0; i < numbers.length; i++) { if (numbers[i] == pId) { numbers[i] =...
71f83b0b-0aee-44f7-a475-c3f7e17d0088
7
private AVLtree teePuustaTaydellinen(AVLtree tree, int korkeus) { int tamanHetkinenKorkeus = korkeus; int solmujenMaara = 1; int korkeudenLaskemisraja = 1; LinkedList list = new LinkedList(tree.getRoot()); Node nykyinen = list.getHeadNode(); while (list.getSize() != 0 && ...
a0a23341-2880-4c63-b9b0-fd7e8b58a872
2
public Binomialnode find_min() { //arvolle annetaan mahdollisimman suurin arvo int value = Integer.MAX_VALUE; Binomialnode helpnode = root; Binomialnode min = null; //käydään läpi keko solmu solmulta, ja pidetään yllä keon pienintä arvoa muuttujan min avulla while (helpno...
cf7ec520-ea50-4acb-9fff-150d3870adeb
3
public void actionPerformed(ActionEvent ev) { try { Pesquisador objt = classeView(); if (obj == null) { long x = new PesquisadorDAO().inserir(objt); objt.setId(x); JOptionPane.showMessageDialog(null, "Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION_MESSAGE); ...
75b054f7-9d37-4282-b499-30fe02c334cc
9
public void gameLoop(){ boolean finish=false; currentPlayer = ListOfPlayer.elementAt(0); while(!finish){ board.PrintBoard(); System.out.println("\nYour turn : "+currentPlayer.getPlayerName()); currentPlayer.printCardsOnHand...
28e7db19-9ce7-4c8d-a97d-3504a7aeeca3
9
public static boolean partition(int[] input){ int totalSum = findSum(input); //if some is odd, there cannot be a partition if(totalSum%2==1) { return false; } int halfSum = totalSum/2; //sum array describes sum[a][b][c] where a - 0...index of item , b - leng...
1ee71c0d-dea6-4944-9ed3-d63c33e684e7
8
@Override protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Database database = new Database(configuration); PlayersRepository p_repository = new PlayersRepository(database); SessionsRepository s_repository = new SessionsRepository(database...
4802a30e-1820-4e15-b6f5-f62436923337
1
public void drawCurves(Graphics g) { for (int i = 0; i < curves.size(); i++) { Drawer.drawBezierCurve(g, curves.get(i)); } }
b8b07c65-f231-48a1-a9e6-f6a80abb89e9
1
private boolean jj_2_14(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_14(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(13, xla); } }
19366833-7939-4fb9-a7d4-7e4c4c9552b1
0
private void initContactCreation() { driver.findElement(By.linkText("add new")).click(); }
e5aa32e6-49cc-4b7e-ac0a-74b8100ebf70
6
@Override public void onDisable() { // Save config config.save(); // Perform a Save NOW! performSave(); // Enable built-in world saving for ASynchronous Mode if (config.varMode == Mode.ASYNCHRONOUS) { for (World world : getServer().getWorlds()) { if(bukkitHasSetAutoSave) { world.setAutoSav...
391897c2-88f4-49c8-9ad2-4444de01abee
1
public void attachClean(Problem instance) { log.debug("attaching clean Problem instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.lock(instance, LockMode.NONE); tr.commit(); session.flush(); session.close(); log.debug("attach successful"); ...
69ccbfc6-01eb-4f69-a656-e57beb453b24
8
@Override public void actionPerformed(ActionEvent ev) { if (ev.getSource() == btnAccept) { int alarmId = parent.getSelectedAlarmId(); int carNr = parent.getselectedCarNr(); ArrayList<Usage> usagesToUpdate = new ArrayList<>(); for(ViewOb...
0b89b283-a3b9-4dc1-9ae2-05c2897a6e71
7
private void field_tasa_ivaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_tasa_ivaFocusLost boolean es_componente=false; //voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos int i=0; Component[] components = panel...
dd56314e-afce-4dab-b715-fbd8d364a3ef
6
Throwable evaluate() { // Create a passthrough wrapper ServletRequestWrapper request = new HttpServletRequestWrapper((HttpServletRequest)pageContext.getRequest()) { // The default behavior of this method is to call getAttribute(String name) on the wrapped request object. @Overrid...
8b3c9e4b-b108-4a47-925b-b4f4b2bb4879
4
public void playBackGround(String fileName) { try { Clip player = getSound(fileName); if(playingBackground != null && playingBackground != player && playingBackground.isRunning()) { playingBackground.stop(); } if (!player....
e35478fe-13e8-4045-bf2f-3f4089b56325
5
Object[] parameterForType(String typeName, String value, Widget widget) { if (value.equals("")) return new Object[] {new TableItem[0]}; // bug in Table? if (typeName.equals("org.eclipse.swt.widgets.TableItem")) { TableItem item = findItem(value, ((Table) widget).getItems()); if (item != null) return new Objec...
788cd71b-d979-4731-a764-a3bb27b40bfd
2
@Override public boolean onKeyDown(int key) { if(super.onKeyDown(key)) { return true; } if(key == Keyboard.KEY_ESCAPE) { Application.get().getEventManager().queueEvent(new GameStateChangeEvent(GameLogic.GameState.PLAYING)); return true; } ...
9441e560-5e48-4016-b5ec-588b9083cd90
1
public LinkedHashMap<Integer, Compra> leerComprasXStream(String rutaFichero) { XStream xstream = new XStream(); rutaFichero = rutaFichero + ".xml"; LinkedHashMap<Integer, Compra> compras = new LinkedHashMap<>(); try { compras = (LinkedHashMap<Integer, Compra>) xstream.fromXML...
d3832a59-e539-4c6f-b75a-96bbbc008339
8
static int[][] toIntMatrix(MatVar mv, boolean transpose) { int[] dims = mv.getDim(); int[][] out = new int[dims[transpose ? 1 : 0]][]; for (int i = 0; i < dims[transpose ? 1 : 0]; i++) { int[] ints = new int[dims[transpose ? 0 : 1]]; for (int j = 0; j < dims[transpose ? 0...
02bd6f17-6077-4c33-8ff1-f9a77068f4b7
1
private static double productoEscalar(Funcion g1, double[] valoresg1, Funcion g2, double[] valoresg2) { double toReturn = 0; for (int i = 0; i < valoresg1.length; i++) { toReturn += g1.f(valoresg1[i]) * g2.f(valoresg2[i]); } return toReturn; }
fcfa8866-9ac8-4f4b-873c-de4b40f696c0
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Transforms") public JAXBElement<TransformsType> createTransforms(TransformsType value) { return new JAXBElement<TransformsType>(_Transforms_QNAME, TransformsType.class, null, value); }
dce8f62f-1870-42ba-a0ba-4fefe2d96053
2
protected int breed() { int births = 0; if(canBreed() && getRandom().nextDouble() <= getBreedingProbability()) { births = getRandom().nextInt(getMaxLitterSize()) + 1; } return births; }
d757d226-169f-4061-9f2c-27859f3fc871
4
private GregorianCalendar readDate(String helptekst) { String datumString = readString(helptekst + "; voer datum in (dd-mm-jjjj)"); String[] datumSplit = datumString.split("-"); int dag = Integer.parseInt(datumSplit[0]); if (dag <= 0 || dag > 32) { System.out.println("ongeld...
b5fdf443-a0f3-44f3-bf40-43046a662a8f
5
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][5]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (5>=0){ r_con.Connection(); String campos = colum_names[0]; ...
fe2f09f3-d2bf-4312-b2d0-5ff601da2272
0
public List<Order> getOrders() { return this.orders; }
7cb16c9f-daca-4d8f-819a-de366705c609
8
public static void clientUpload(final Socket socket,InputStream inputStream, DataInputStream datais,String extension,String basepath,String pathPrefix){ System.out.println("client file stuffix: " + extension); String uuid = UUID.randomUUID().toString().toUpperCase(); // 得到存储路径 String storepath = Folder.getStora...
d4785bcd-f574-412d-b63b-ee02e5bb191a
6
@Override public final void update(Level level, int x, int y, int z, Random rand) { if (id != ROPE.id) { int var6 = level.getTile(x, y - 1, z); if (level.isLit(x, y, z) && (var6 == DIRT.id || var6 == GRASS.id)) { if (rand.nextInt(5) == 0) { level.s...
791ffe70-7f7d-42e5-a8a7-49dd49d0c201
3
@Override public String processCommand(String[] arguments) throws SystemCommandException { String name = arguments[0]; String type = arguments[1]; String guid = facade.getCurrentUserGUID(); if (guid == null) throw new SystemCommandException("No current user set."); String electorateID = arguments[2];...
5b5e48e5-97a1-4106-96c1-c40d80013cf5
9
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; // setlimit, line 174 v_1 = limit - cursor; // tomark, line 174 if (cursor < I_pV) { return false; } cursor = I_pV; v_2 = limit_backward; limit_backward = cursor; cursor = limit - v_1; // (, line 174 // [, line ...
b630e8cd-d2f7-4e76-8db3-655a801ef6e4
2
int reportDistance(Markers closestMarkers, Marker queryMarker) { Marker firstMarker = closestMarkers.getMarkers().get(0); // If there is more than one marker, they are at the same distance, so we just report the distance to the first one if (tss) { Transcript tr = findTranscript(firstMarker); Marker trTss = t...
0a5cc688-f380-4bd8-b401-2bda8ea979cd
6
public void hentSager() { String cpr = cpr_textField.getText(); if (cpr.length() == 10) { if (rEDHandler.checkPersonExists(cpr)) { sager_table.setEnabled(true); ArrayList<Sag> sager = rEDHandler.sogCPR(cpr, false); if (!sager.isEmpty()) { ...
20c3d43d-bea7-49e3-90a6-be0a8b4cdd15
0
public BallRunnable(Ball aBall, Component aComponent) { ball = aBall; component = aComponent; }
67038e5f-1b1e-40a5-8336-d0986758312f
9
public LinkedList<interval> FindOverlaps (Node node, interval interval, LinkedList<interval> list) { //LinkedList<interval> list = new LinkedList<interval>(); if (node.CurrentInterval != null) { Date nodeStart = node.CurrentInterval.Start; Date nodeEnd = node.CurrentI...
e54e159a-7d37-493c-9fc1-88252890971f
3
public boolean equals(Vector4i v) { return x == v.x && y == v.y && z == v.z && w == v.w; }
a0c424ca-4e1c-4a62-965e-53a00f931b00
6
@Override public boolean dispatchKeyEvent(KeyEvent e) { if ( e.getID() == KeyEvent.KEY_RELEASED ) { boolean happenedOnTextField = e.getComponent() instanceof JTextField; boolean happenedOnTextArea = e.getComponent() instanceof JTextArea; if ( e.getKey...
5031e675-360c-44be-8ef4-ef07b740dc8e
2
public void cargarClienteS() { try { String sql = "SELECT * FROM clientes"; Connection conn = Conexion.GetConnection(); PreparedStatement ps = conn.prepareStatement(sql); cli = ps.executeQuery(); while (cli.next()) { String[] row = {c...
f5087a57-e86a-484f-af87-90bbbc076610
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
0d11353b-c1f3-41fb-aede-89f38085282a
1
public DBIngredientRepository() throws ClassNotFoundException { Class.forName("org.sqlite.JDBC"); connectionString = System.getProperty("omnom.db.connectionString"); if(connectionString == null){ connectionString="jdbc:sqlite:omnom.db"; } }
90c0e12c-17ec-45c3-833d-43079e077e74
6
public static void main(String[] args) throws IOException { File file = new File("0050/primes.txt"); List<String> lines = FileUtils.readLines(file); List<Integer> primes = new ArrayList<>(); for (String line : lines) { primes.add(Integer.valueOf(line)); } int maxLength = 0; int maxSum = 0; for (int ...
83a700df-a1d0-46b2-840e-75b9974d3207
7
protected void readImage() { ix = readShort(); // (sub)image position & size iy = readShort(); iw = readShort(); ih = readShort(); int packed = read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - inte...
f23928bb-ebf9-4521-9e56-5cee99c05ac3
6
private void initStreams() throws IOException { if (out == null) { if (maxUpload == FTPConnection.MAX_UPLOAD_BANDWIDTH || isControllConnection()) { out = socket.getOutputStream(); } else { out = new BandwidthControlledOutputStream(socke...
95fa0e2b-a6ab-4d2c-9275-20c44f64280b
7
public void redraw() { char[][] mapp = new Map().getAsciiMap(); // reloads a new ascii map with // '.' to write the mask // upon for (MaskObject o : mapObjects) { if (o.posX > 95) // makes sure that no objects have walked outside // the scope of the array o.posX = 95; if ...
c2bb885c-7e6b-49eb-b2a4-28928547fe9a
0
public final File getSaveFile() { return saveFile; }
761f0c3c-c4b8-4e27-8563-eb26901a5a6d
0
public static void main(String[] args) { Hero h = new Hero(); t(h); // Treat it as a CanFight u(h); // Treat it as a CanSwim v(h); // Treat it as a CanFly w(h); // Treat it as an ActionCharacter }
60a30e9e-bdd7-4225-a6aa-c55e1a18ad1f
3
private void redistributeMoisture(ArrayList<Corner> landCorners) { Collections.sort(landCorners, new Comparator<Corner>() { @Override public int compare(Corner o1, Corner o2) { if (o1.moisture > o2.moisture) { return 1; } else if (o1.mo...
e56d64b8-a394-44f8-bdfe-0ac1a83370dc
7
protected static Ptg calcIPMT( Ptg[] operands ) { if( operands.length < 4 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "calcIPMT" ); double rate = operands[0].getDoubleVal(); double per = operands[1].getDoubleVal(); double nper = operands[2].getDoubleVal(); double pv = ope...
52592865-b477-46b8-a6c3-380578f1769c
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; QuestionImpl question1 = (QuestionImpl) o; if (correctAnswerPoints != question1.correctAnswerPoints) return false; if (correctAnswer != questio...
d3db37e4-2d3b-4b61-9327-07446e241fc5
6
@SuppressWarnings({"unchecked"}) public boolean forEachEntry(TObjectObjectProcedure<? super K, ? super V> procedure) { Object[] keys = _set; V[] values = _values; for (int i = keys.length; i-- > 0;) { if (keys[i] != FREE && keys[i] != REMOVED ...
774bf0de-89d0-4122-bb94-417833012fb6
5
@Test public void findSolution_methodFindsOptimalSequence() { HeuristicInterface h = new ManhattanDistance(); byte[][] tests = {test1, test2, test3, test4}; Puzzle p = new Puzzle(); for (int i = 0; i < tests.length; i++) { p.setPuzzle(tests[i]); Astar idaStar ...
bb4c6921-4423-4bf3-ba6e-687b50e37a4e
6
public Customer createCustomer(String s) { String rawName = s; rawName = rawName.substring(1); String[] names = rawName.split(" "); String firstName = names[0]; firstName = firstName.substring(0, 1).toUpperCase() + firstName.substring(1); String lastName = names[1]; lastName = lastName.substring(0, 1).t...
2ef92871-c7dd-4eaf-9548-8879c5437aee
5
public Brick13(int gameAreaStartX, int gameAreaStartY, int brickSize, int brickIndex, BufferedImage brickImage) { super(brickSize, brickIndex, brickImage); switch(brickIndex) { case 1: this.row = 0; this.column = 8; this.relativeRow ...
c0b23e71-ec61-464d-871d-a6899ae801dc
2
@Override public HandshakeState acceptHandshakeAsServer( ClientHandshake handshakedata ) { if( handshakedata.hasFieldValue( "Origin" ) && basicAccept( handshakedata ) ) { return HandshakeState.MATCHED; } return HandshakeState.NOT_MATCHED; }
97eb0668-4c59-4033-a15f-1df4705555df
1
public void atDoubleConst(DoubleConst d) throws CompileError { arrayDim = 0; if (d.getType() == DoubleConstant) exprType = DOUBLE; else exprType = FLOAT; }
38836f40-56ac-4e0c-9130-aa97c3656980
8
public static boolean checkAssign(Type p1, Type p2) { if (p1 == null || p2 == null) { return false; } return (p1 == Type.Fixed && p2 == Type.Integer || p1 == p2 || p1 == Type.String && p2.group == CUSTOM || p2 == Type.String && p1.group == CUSTOM); }
8e9ac039-74b5-4a42-b830-9c1475b0cddf
1
public boolean isReady() { return isInstant || System.nanoTime() - startTime >= castTime; }
56bccccb-ac14-4f11-8922-149e5e22190e
9
private void input() { if(Keyboard.isKeyDown(Keyboard.KEY_DOWN) && (bat.getY() + bat.getHeight()) <= HEIGHT){ bat.update(0,1); } if(Keyboard.isKeyDown(Keyboard.KEY_UP) && bat.getY() >= 0){ bat.update(0,-1); } if(Keyboard.isKeyDown(Keyboard.KEY_NUMPAD5) && ...
2be8d4f2-5c02-4df0-bf67-77e801860e60
7
@Override public CharClass getCombatDominantClass(MOB killer, MOB killed) { CharClass C=null; if((killer!=null)&&(killer.charStats()!=null)) { C=killer.charStats().getCurrentClass(); MOB M=killer; final HashSet<MOB> checked=new HashSet<MOB>(); checked.add(M); while(M.isMonster() &&(M.amFollow...
56e847b3-b626-4f46-9d3a-f72b1ad98545
3
private void showHelp() { JDialog dialog = new JDialog(this, resources .getString("dialog.help.title")); final JEditorPane helpText = new JEditorPane(); try { URL url = getClass().getResource("GridWorldHelp.html"); helpText.setPage(url); ...
5c68fa15-5045-4eda-b8a7-446787193a4a
8
private void updateHook(ServiceReference<?> ref) { // We maintain the hooks sorted, so if ranking has changed for example, // we need to ensure the order remains correct by resorting the hooks. Object svcObj = ((ServiceRegistrationImpl.ServiceReferenceImpl) ref) .getRegistration(...
a8bc6cf9-0d97-411e-a65c-bc0a2f8871aa
4
private List<Integer> getData(String input) { List<Integer> data = new ArrayList<Integer>(); for (char c : input.toCharArray()) { int value = c - '0'; if (c == '.') { value = 0; } // TODO in practice a limit to the max side here. Could allow A B // C... for hex size. if (value >= 0 && value <=...
465cdb9d-a169-4862-9ab3-0f8b93a540f2
4
private void printAll(LeftistTree tree, LeftistTreeNode parent, Node parentNode, int parentPosition, int i) { Node p; LeftistTreeNode node = tree.root; if (node != null && parent == null) { p = makeNode(node.value + "<br/>npl: " + tree.npl(node, -1), new Point(parentPosition, getRe...
de4ff288-6e9e-498e-ba65-7833fe316e62
7
public NuclearSheep() { this.setTitle("Nuclear Sheep"); List<NetworkInterface> networkInterfaces = ARPSpoofLayer.getPotentialInterfaces(); if(networkInterfaces.size()==0) { JOptionPane.showMessageDialog(this, "Found 0 network interfaces with an IPv4 address to spoof on. Exiting."); System.exit(0); } JO...
2b6f415d-be83-41df-8420-a92324d19918
8
public int getArticleCount() throws Exception{ Connection conn = null; PreparedStatement pstmt = null; ResultSet rs =null; int result = 0; try{ conn = getConnection(); pstmt = conn.prepareStatement("select count(*) from food"); rs = pstmt.executeQuery(); if(rs.next()){ result = rs.getInt(1); ...
9b624240-2228-4bab-9bcf-3bfdd81a3e99
5
public boolean isVariant() { if (alts == null) return false; for (String alt : alts) if (!alt.isEmpty() && !alt.equals(".") && !ref.equals(alt)) return true; // Any change option is different? => true return false; }
30bd43a0-19f8-44f8-845b-8fab4f1eafb9
9
@Override public AbstractTableModel getTableModel() { return new AbstractTableModel() { @Override public String getColumnName(int col) { return columnsNames[col]; } @Override public int getRowCount() { return entre...
4e7edf27-b9ee-4609-8cc3-15cb2703a921
3
public void muestra() { System.out.println(fuente.getName()); System.out.println("Elementos: "+elementos.size()); System.out.println("Nodos: "+nodos.size()+"\n"); Iterator iterator = elementos.entrySet().iterator(); double min=100,max=0; while(iterator.hasNext()) ...
bce3d52e-164a-47f5-8223-a30a499b9e83
4
public final void updateStats() { hunger = 10*hoursSinceMeal(); //hunger is 10 points per hour not eaten. Therefore you can go 10 hours without taking damage. //Motivation modifiers. You become 3 points less motivated per turn if you are fatigued more than 70, and 3 extra if you are more th...
27fa2f2a-33d6-4c6a-a23d-b02e7ed83d91
2
private Expression ifStatement( List<Expression> args, String caller ) { if ( args.size() != 3 ) { System.err.println("if expected 3 arguments and got " + args.size() ); System.exit(1); } // if it's false return the second, any other value gets the first if ( args...