text
stringlengths
14
410k
label
int32
0
9
public Node popNode() { if (--sp < mk) { mk = marks.remove(marks.size()-1); } return nodes.remove(nodes.size()-1); }
1
@Test public void testAvoidance() { Random r = new Random(260379); /* First create some data */ ArrayList<Integer> workArr = new ArrayList<Integer>(); TreeMap<Integer, Integer> countToId = new TreeMap<Integer, Integer>(new Comparator<Integer>() { public int compare(Inte...
7
@Override public void onKeyPressed(char key, int keyCode, boolean coded) { // Doesn't react to coded keys if (coded) return; // If backspace was pressed, removes the last character if (key == KeyEvent.VK_BACK_SPACE && this.input.length() >= 1) this.input = this.input.substring(0, this.input.length()-...
8
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } QName other = (QName) obj; if (localName == null) { if (other.localName != null) { retu...
9
private void listLastTransactions(CommandSender sender, int amount) { if (TransactionManager.getInstance().getTransactions().isEmpty()) { sender.sendMessage(EdgeCore.errorColor + "No transactions found!"); return; } for (int i = TransactionManager.getInstance().amountOfTransactions() -1; i < TransactionM...
3
public TripTimeLabelComponent (Trip trip) { super (new FlowLayout (FlowLayout.LEADING)); JPanel labelPanel = new JPanel (new GridLayout (2,1)); River r = trip.getRiver(); String riverName; if (r == null) { riverName = "<?>"; } else { riverName = r.getRiverName(); } addLabelWithBorder (labe...
1
public Production getLambdaProductionForFinalState(Automaton automaton, State state) { /** Check if state is a final state. */ if (!automaton.isFinalState(state)) { System.err.println(state + " IS NOT A FINAL STATE"); return null; } String llhs = (String) MAP.get(state); String lrhs = LAMBDA; Produ...
1
private void instantiate(int size) { try { DBConnection con; for (int i = 0; i < size; i++) { con = new DBConnection(); con.connect(driver, url, db, usr, pw); free.add(con); } } catch (Exception e) { e.print...
2
public void initialiseWithInfected(int numI) { if ((numI < N) && (numI > 0)) { states[0].setStateValue(N-numI); for (int i = 1; i < states.length; i++) { if (states[i].getStateName().equals("I")) { states[i].setStateValue(numI); ...
4
@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.clearRect(0, 0, this.getWidth(), this.getHeight()); g2.scale(scale, scale); g2.translate(translateX, translateY); world.paint(g2); int count = 0; ...
8
private static boolean dragBetween(WidgetChild start, WidgetChild end) { if (start == null || end == null || !start.visible() || !end.visible()) return false; if (!hoverChild(start)) return false; Mouse.drag(end.getNextViewportPoint()); return true; }
5
@Test public void WhenUnionBothHavingLevels_ExpectChange() throws UnknownHostException { int level = localhost_.getHostPath().length(); RoutingTable table = new RoutingTable(); table.setLocalhost(localhost_); Host host = new PGridHost("127.0.0.1", 3333); table.ad...
1
public boolean reserve(long id) { if(enemyID == NO_ENEMY) { enemyID = id; return true; } else { return false; } }
1
@Test public void testIterativeSearch() throws Exception { PersistenceManager pm = new PersistenceManager(driver, database, login, password); // drop all tables pm.dropTable(Object.class); // create 42 simpleobjects final int testCount = 42; for (int x = 0; x < testCount; x++) { SimpleObject so = ne...
6
public static void adjustModuleCMakeLists(File moduleDirName, String fileName, boolean fileWasCreated, IOutput output) { output.writeLine(" Registering file in module specific CMakeLists"); File cmakelistsFile = new File(moduleDirName, Constants.CMAKELISTS_FILENAME); if (!cmakelistsFile.e...
8
public static URL convertToURL(String path) { if(path==null || path.isEmpty()){ return null; } URL url = null; try { url = new URL(path); } catch (MalformedURLException e) { url = Thread.currentThread().getContextClassLoader().getResource( path); if (url == null) { File file = new File(pa...
6
private void upload(File source) throws Exception { if (source.isDirectory()) { String[] list = source.list(); for (int index = 0; index < list.length; index++) { File newSource = new File(source, list[index]); upload(newSource); } if (count.containsKey("Directory")) { count.put("Directory...
9
public static String[] getFileContents(String fileName) { final ArrayList<String> lines = new ArrayList<String>(); String line = ""; try { final BufferedReader reader = Files.newBufferedReader(Paths.get(fileName), Charset.forName("US-ASCII")); while (true) { line = reader.readLine(); if (line...
3
@Override public void execute(Player player, String[] args) { if(args.length == 1) { Player other = player.getServer().getPlayer(args[0]); if(other != null) { player.setPos(other.getX(), other.getY(), other.getZ()); } else { player.sendMessage(args[1] + " is not online."); } } else if(arg...
5
protected Value getSimpleDefaultValue(String t) { if (t.equals("java.lang.String")) return StringConstant.v(""); if (t.equals("char")) return DIntConstant.v(0, CharType.v()); if (t.equals("byte")) return DIntConstant.v(0, ByteType.v()); if (t.equals("short")) return DIntConstant.v(0, ShortType.v());...
9
public static int HSBtoRGB(float hue, float saturation, float brightness) { int r = 0, g = 0, b = 0; if (saturation == 0) { r = g = b = (int) (brightness * 255.0f + 0.5f); } else { float h = (hue - (float)Math.floor(hue)) * 6.0f; float f = h - (float)java.lang...
7
public boolean prob(double x) { if (x >= 1) { return true; } if (x <= 0) { return false; } double eps = 0.000000001; double a = 0, b = 1; do { boolean pb = prob(); double center = (a + b) / 2; if (Math.abs(x - center) < eps) { return pb; } if...
9
protected void appendDescriptor(final int type, final String desc) { if (type == CLASS_SIGNATURE || type == FIELD_SIGNATURE || type == METHOD_SIGNATURE) { if (desc != null) { buf.append("// signature ").append(desc).append('\n'); } } else { buf.append(desc); } }
4
public Collection<LineUp> getLineUps(Groop grp) throws SQLException { Collection<LineUp> lineups = new LinkedList<LineUp>(); // Get a statement and run the query String sql = "SELECT LineUp.LineUpNumber, ArtistNumber FROM LineUp,LineUpDetails WHERE LineUp.GroopNumber = ? AND LineUp.LineUpNumber = ...
5
private String getResponse() { String result; try { result = _in.readLine(); } catch (IOException e) { throw new UIError(); // re-throw UIError } if (result == null) { throw new UIError(); // input closed } return result; }
2
public void doStuff() { if (!hsa.done) { hsa.doAlg(); int step = hsa.step; switch (step) { case 1: l.setText("step 1: divided in intervals"); break; case 2: l.setText("step 2: found interval with odd intersection property"); break; case 3: l.setText("step 3: constructed trapeze")...
9
public Knapsack executeOnce(Knapsack knapsack) { int neighbours = generateRandomNumberOfNeighbours(); Knapsack best = null; for (int i=0; i<neighbours; i++) { Knapsack candidate = generateNeighbour(knapsack); if (best == null) { best = candidate; } else if (candidate.compareWith(best) > 0) {...
5
public void method354(Background background, int i, int j) { j += anInt1442; i += anInt1443; int k = j + i * DrawingArea.width; int l = 0; int i1 = myHeight; int j1 = myWidth; int k1 = DrawingArea.width - j1; int l1 = 0; if(i < DrawingArea.topY) { int i2 = DrawingArea.topY - i; i1 -= i2; i...
6
public static boolean visible(WidgetChild... wc) { if (wc == null || wc.length == 0) return false; for (WidgetChild c : wc) { if (c == null || !c.visible()) return false; } return true; }
5
@Override protected String readLineInternal() throws IOException { if (skippingDone == false) { skippingDone = true; do { final String s = readLine(); if (s == null) { return null; } Matcher m = endifPattern.matcher(s); if (m.find()) { return null; } m = elsePattern.matche...
7
public static List<String> readTextFile(Path file) { if (!FileUtil.control(file)) { IllegalArgumentException iae = new IllegalArgumentException("The filepath is null or points to an invalid location!"); Main.handleUnhandableProblem(iae); } return FileReader.readFile(file...
1
protected void drawMapTiles(final Graphics g, final int zoom, Rectangle viewportBounds) { int size = getTileFactory().getTileSize(zoom); Dimension mapSize = getTileFactory().getMapSize(zoom); // calculate the "visible" viewport area in tiles int numWide = viewportBounds.width / size + 2; int numHigh = viewp...
8
public static void main(String args[]) { //<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://download.oracle.com/javase/tutorial/uiswing/loo...
6
public static boolean zmq_proxy (SocketBase frontend_, SocketBase backend_, SocketBase control_) { if (frontend_ == null || backend_ == null) { ZError.errno (ZError.EFAULT); throw new IllegalArgumentException(); } return Proxy.proxy ( frontend_, ...
2
@Override public int getSlotSpacingX() { return isNotPlayerInventory() ? 32 : 18; }
1
public static void reallyDeleteObject(PaintBox box) { Rectangle redrawBounds = null; if (box instanceof FTLRoom) { FTLRoom r = (FTLRoom) box; Point oldLow = null; Point oldHigh = null; if (Main.ship != null) { oldLow = Main.ship.findLowBounds(); oldHigh = Main.ship.findHighBounds(); oldLow....
9
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 s...
7
public void draw(Graphics g){ Color c = g.getColor(); g.setColor(Color.DARK_GRAY); g.fillRect(x,y,w,h); g.setColor(c); }
0
public int minHeight(int[] height,int sta,int end){ int min =0Xffff; int index =sta; for(int i= sta; i<=end ;i++){ if(min > height[i]){ min = height[i]; index = i; } } return index; }
2
public void init() { int a, b, c, d, e, f, g, h; a = b = c = d = e = f = g = h = 0x9e3779b9; for (int i = 0; i < 4; i++) { a ^= b << 11; d += a; b += c; b ^= c >>> 2; e += b; c += d; c ^= d << 8; f += c; d += e; d ^= e >>> 16; g += d; e += f; e ^= f << 10; h += e; f +=...
3
@Test public void testNull() { StaticIntervalTree<Double, Interval<Double>> tree = new StaticIntervalTree<Double, Interval<Double>>(); try { tree.buildTree(null); Assert.fail(); } catch (NullPointerException e) { } try { tree.fetchContainingIntervals(new ArrayList<Interval<Doubl...
7
public ArrayList<Pair<File,Tag>> load(File file) throws FileNotFoundException,IOException { ArrayList<Pair<File,Tag>> pairs = new ArrayList<Pair<File,Tag>>(); FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String strLine; if (br.readLine().equals("#EXTM3U")) { while...
8
public static void addBoilerFuel(Fluid fluid, int heatValuePerBucket) { ModContainer mod = Loader.instance().activeModContainer(); String modName = mod != null ? mod.getName() : "An Unknown Mod"; if (fluid == null) { FMLLog.log("Railcraft", Level.WARN, String.format("An error occured...
2
@Override public boolean execute(WorldChannels plugin, CommandSender sender, Command command, String label, String[] args) { final Map<Flag, String> info = new EnumMap<Flag, String>(Flag.class); info.put(Flag.TAG, WorldChannels.TAG); if(!(sender instanceof Player)) { ...
7
public int compare(Object arg1, Object arg2) { if (!map.containsKey(arg1) || !map.containsKey(arg2)) { return 0; } Comparable value1 = (Comparable) map.get(arg1); Comparable value2 = (Comparable) map.get(arg2); return -value1.compareTo(value2); // Note: We use a minus because we want decreasing order (high val...
2
public boolean _setHp(int hp) { if(hp > -1) { this.hp = hp; // Set HP to the provided value. return true; // Return true, HP updated. } else { return false; // Couldn't update HP (probably invalid HP value). } }
1
public T set(T newValue, int index) { if(index < 0 || index > size()) throw new ArrayIndexOutOfBoundsException(); T old = item[index]; item[index] = newValue; return old; }
2
private Dockable getDockableInDrag(DropTargetDragEvent dtde) { if (dtde.getDropAction() == DnDConstants.ACTION_MOVE) { try { if (dtde.isDataFlavorSupported(DockableTransferable.DATA_FLAVOR)) { Dockable dockable = (Dockable) dtde.getTransferable().getTransferData(DockableTransferable.DATA_FLAVOR); Doc...
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Funcionario other = (Funcionario) obj; if (this.IdFuncionario != other.IdFuncionario && (this.IdFuncionar...
5
public Iterable<WeightedEdge> edges() { List<WeightedEdge> edges = new LinkedList<WeightedEdge>(); for (int v = 0; v < V(); v++) for (WeightedEdge e : adj[v]) if (e.other(v) > v) edges.add(e); return edges; }
3
public ArrayList<Double> getSeparateLengths() { ArrayList<Double> lengths = new ArrayList<Double>(); for (Edge edge : edges) lengths.add(edge.getLength()); return lengths; }
1
public ScaledResolution(GameSettings var1, int var2, int var3) { this.scaledWidth = var2; this.scaledHeight = var3; this.scaleFactor = 1; int var4 = var1.guiScale; if(var4 == 0) { var4 = 1000; } while(this.scaleFactor < var4 && this.scaledWidth / (this.scaleFactor + 1...
4
public void setLocation_id(String location_id) { this.location_id = location_id; setDirty(); }
0
double playGame(Player black, Player white) { System.out.println(black + " vs " + white); long[] elapsedTime = new long[2]; State board = new State(); while (!board.gameOver()) { int move; long before = System.nanoTime(); if (board.getColorToPlay() == 'X') { move = black.move(board); elapsedTim...
7
public boolean isLargerThan(Domino other, int suit) { // Shortcut edge case if (other == null) { return true; } if (isSuit(suit) && !other.isSuit(suit)) { // The other domino doesn't match the given suit return true; } // Determine which side of the other domino we match if (isSuit(other.little...
9
public void driver() { System.out.println("bmw bus drive"); }
0
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
8
@Override public String getColumnName(int col) { switch (col) { case 0: return Localization.getInstance().get("wordColumnName"); case 1: return Localization.getInstance().get("definitionColumnName"); case 2: return Localization.getInstance().get("categoryColumnName"); case 3: return Localization.getInstance(...
4
public void savePatient(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ log.debug("PatientManager savePatient method called..."); Map<String, String> validationMap=new HashMap<String, String>(); Map<String, String> resultsMap; String action=req.getParameter("action");...
2
public Macro(File macro, RecordModel model) { BufferedReader br = null; this.model = model; try { br = new BufferedReader(new FileReader(macro)); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { ...
5
public final void testBoundaryPlacement() { int gridSize = q8cb.getSize(); // Bottom left hand corner. q8cb.clearTheBoard(); assertTrue(q8cb.placePiece(0, 0)); assertTrue(q8cb.getBoard()[0][0] == PositionStatus.OCCUPIED); for (int j = 1; j < gridSize; j++) { assertTrue(q8cb.getBoard()[0][j] == Positio...
8
@Override public void newAttribute(String key, Object value, boolean isReadOnly, AttributeTableModel model) { model.keys.add(key); model.values.add(value); model.readOnly.add(new Boolean(isReadOnly)); Node node = doc.tree.getEditingNode(); node.setAttribute(key, value, isReadOnly); // undo Comp...
0
public void validateMove(Team movingTeam, int fromX, int fromY, int toX, int toY) throws IllegalMoveException { // Check that inputs make sense at all validateCoordsOnBoard(fromX, fromY); validateDestination(toX, toY); if (Team.NEUTRAL.equals(movingTeam)) { throw new IllegalArgumentException...
7
public AutomatonSizeSlider(AutomatonPane view, AutomatonDrawer drawer) { super(AUTOMATON_SIZE_MIN, AUTOMATON_SIZE_MAX, AUTOMATON_SIZE_INIT); this.view = view; this.drawer = drawer; this.addChangeListener(new SliderListener()); setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(...
0
public String getCode() { return code; }
0
protected Function(Dictionary d) { Vector dom = (Vector) d.getObject("Domain"); domain = new float[dom.size()]; for (int i = 0; i < dom.size(); i++) { domain[i] = ((Number) dom.elementAt(i)).floatValue(); } Vector r = (Vector) d.getObject("Range"); if (r != nu...
3
@Override public int read(char[] cbuf, int off, int len) throws IOException { if (len == 0) { return 0; } int c = read(); if (c == -1) { return -1; } int result = 0; do { cbuf[result + off] = (char) c; result++; c = read(); } while (c != -1 && result < len); return result; }
4
public void printIdentificationNumberStr(String enteredIdentificationNumber, boolean lineSeparator) { if (lineSeparator) { System.out.printf("Identification number: %s\n", enteredIdentificationNumber); } else { System.out.printf("Identification number: %s", enteredIdentificationN...
1
private void process() { if (intervals.size() < 2) { throw new IndexOutOfBoundsException("Processing requires at least two intervals"); } // addressing to the first non-fictitious interval double y_min = intervals.get(1).getY(); MatterInterval inl; for (int i...
4
public Set<T> concat(Set<T> s) { Set<T> res=this; if(s==null) { return res; } else { if(s.next==null) { return res.append(s.a);} else//s.next!=null { return res.append(s.a).concat(s.next);} } }
2
@Override public boolean onCommand(CommandSender commandSender, Command cmd, String lbl, String[] args) { if(commandSender instanceof Player) { Player pl = (Player) commandSender; if(cmd.getName().equalsIgnoreCase("challenge")) { if(args[0].equalsIgnoreCase("ironarmor...
4
private void removeHost(Host host) { HostPanel hp = hostsMap.remove(host.getName()); if (hp != null) { ClientConnectionManager.getInstance().removeClientChangedListener( hp); if ((hostList.size() > 1) && (hostList.indexOf(hp) == (hostList.size() - 1))) { GridBagConstraints newLastConstraints = ...
3
public static double regularisedBetaFunction(double z, double w, double x) { if (x < 0.0D || x > 1.0D) throw new IllegalArgumentException("Argument x, " + x + ", must be lie between 0 and 1 (inclusive)"); double ibeta = 0.0D; if (x == 0.0D) { ibeta = 0.0D; } else { if (x == 1.0D) { ibeta = 1.0D; } ...
5
public void deleteProperty(String section, String var) { if (map.containsKey(section + '.' + var)) map.remove(section + '.' + var); }
1
public String toString() { if (Double.isNaN(im) || Double.isInfinite(im)) { return re + " + " + "i" + im; } if (im == 0) { return re + ""; } if (re == 0) { return im + "i"; } if (im < 0) { return re + " - " + (-im) +...
5
private static void dumpImageToSheet(SegmentedImage image, Workbook wb){ Sheet s = wb.createSheet(); generateHeader(s); for(int rownum = 1; rownum <= image.numCells(); rownum++){ fillData(s, rownum, image.getCell(rownum-1)); } }
1
public boolean hasCycle(ListNode head) { if (head == null || head.next == null) return false; ListNode oneStep = head; ListNode twoStep = head.next; while (twoStep != null) { if (oneStep == twoStep) return true; twoStep = twoStep.next; if (twoStep == null) break; oneStep = oneStep....
5
@Test public void testBasicMethodSmall() { final float[] weights = initWeights(18); ChiVertex<Integer, Float> vert = new ChiVertex<Integer, Float>(0, new VertexDegree(0, weights.length)) { public Float getOutEdgeValue(int i) { return weights[i]; } ...
4
public void handleCollisions(CollisionHandler... handlers) { for (int i = 0; i < size(); i++) { for (int j = 0; j < size(); j++) { if (i != j) { Sprite s1 = get(i); Sprite s2 = get(j); if (s1.intersects(s2)) { Collision c = new Collision(s1, s2); Loader.addEventToAll(n...
5
public void initialize() { if(Configuration.hasParameter("DistributionModel/Line/FromX") && Configuration.hasParameter("DistributionModel/Line/FromY") && Configuration.hasParameter("DistributionModel/Line/ToX") && Configuration.hasParameter("DistributionModel/Line/ToY")) { try { previousPositionX ...
6
public DialogWindowView(String title) { dialog = new JDialog((JFrame) null, title); dialog.setResizable(false); dialog.setSize(200, 100); dialog.setLocation(MainWindowView.WIDTH/2, MainWindowView.HEIGHT/2 - dialog.getHeight()/2); init(); addActionListeners(); }
0
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { BigDecimal percentage = null; List<String> fouten = new ArrayList<>(); try { percentage = new BigDecimal(request.getParameter("percentage")); if (percentage.compareTo(BigDecimal.ZERO) <=...
6
public String catchInfo(String url) { this.url = url; String html = null; try { getMethod = new GetMethod(url); int statusCode = httpclient.executeMethod(getMethod); System.out.println("StatusCode:" + statusCode + ">>>>URL:" + url); if ((statusCode == HttpStatus.SC_MOVED_TEMPORARILY) || (sta...
6
protected List<Actor> actors() { if (!(model instanceof Factional)) { return new ArrayList<Actor>(model.actors); } // If we're interacting with a Factional model, // only neutral actors and actors from the current // team should have a chance to act: List<Actor> ret = new ArrayList<Actor>(); int curren...
4
@Override public Object getPreviousValue() { int n = getNumber().intValue(); if (n == 1) { return n; } return n-1; }
1
public Class<?> getColumnClass(int col) { return getValueAt(0, col).getClass(); }
1
protected GeneralPath renderSimpleGlyph (GlyfSimple g) { // the current contour int curContour = 0; // the render state RenderState rs = new RenderState (); rs.gp = new GeneralPath (); for (int i = 0; i < g.getNumPoints (); i++) { PointRec rec = new PointRec...
5
public void push(IntegerNode newNode) { if (this.top == null){ this.top = newNode; } else { IntegerNode nextInLine = this.top; this.top = newNode; this.top.setNextTop(nextInLine); } count++; }
1
public void paint(Graphics g) { double dx = this.getWidth() / (double) a.getWorld().getWidth(); double dy = this.getHeight() / (double) a.getWorld().getHeight(); dx = Math.min(dx, dy); dy = Math.min(dx, dy); for (int x = 0; x < a.getWorld().getWidth(); x++) { for (int y = 0; y < a.getWorld().getHeight();...
7
private JPanel placeTextFields(){ final int ROWS = 2; final int COLUMNS = 2; GridLayout layout = new GridLayout(ROWS, COLUMNS); layout.setHgap(10); layout.setVgap(10); JPanel panel = new JPanel(layout); oldValue = new JTextField("Old value"); oldValue.setE...
0
@Override public void run() { final GameObject obelisk = ctx.objects.select().id(OBELISK).nearest().poll(); if (obelisk.valid() && IMovement.Euclidean(obelisk, ctx.players.local()) < 5) { renewPoints(); } else { if (!locationAttribute.isInObeliskArea(ctx)) { if (doSmall()) { ctx.sleep(666); } ...
4
public boolean buttonDown(Controller controller, int code) { switch(code){ case XBox360Pad.BUTTON_A: MyInput.setKey(Input.JUMP, true); break; case XBox360Pad.BUTTON_X: if(!menu) MyInput.setKey(Input.INTERACT, true); break; case XBox360Pad.BUTTON_RB: MyInput.setKey(Input.ATTACK, true); break; case ...
9
public void setPreNote(String preNote) { this.preNote = preNote; }
0
public boolean available(int num) { boolean availablity = false; try { if(!seat[num])//= if seat is false, then condition will be true availablity = true; } catch(ArrayIndexOutOfBoundsException ex) { System.out.println("Error:" + ex); availablity = false; } return availablity; }
2
@EventHandler public void GhastJump(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.getZombieConfig().getDouble("Ghast.Jump.DodgeCh...
7
@Override public String process(HttpServletRequest request) throws MissingRequiredParameter { ResultSet resultSet = null; String ciudad = request.getParameter("ciudad"); JSONArray result = new JSONArray(); //String result; try { // Get Connection and Statement connection = dataSource.getConnect...
9
private String readline(InputStream is) { StringBuilder rtn = new StringBuilder(); int temp; do { try { temp = is.read(); } catch (Exception e) { return null; } if (temp == -1) { String str = rtn.toSt...
8
public double getValue() { return value; }
0
public void closeConnection(){ if (stmt!=null) { try { stmt.close(); } catch (Exception ignore) {} } if (conn!=null) { try { conn.close(); } catch (Exception ignore) {} } }
4
@Test public void testSearchAndUpdateCollection() { gcPrintUsed(); int repeats = 1000; // five seconds. HugeArrayBuilder<MutableTypes> mtb = new HugeArrayBuilder<MutableTypes>() { }; HugeArrayList<MutableTypes> mts = mtb.create(); mts.setSize(length); for (MutableTypes mt : mts) { mt...
3