text
stringlengths
14
410k
label
int32
0
9
public void saveCustomConfig() { // Return if the configs are null. if (config == null || trueFile == null) { plugin.getLogger().log(Level.SEVERE, "Could not save config to " + trueFile + " due to nulls."); return; } // Attempt to save the files. try { config.save(trueFile); } catch (IOExce...
3
public void move(int enemyx, int enemyy){ if(getxCoord() < enemyx+30){ setxCoord(getxCoord() + speed); } if(getxCoord() > enemyx+30){ setxCoord(getxCoord() - speed); } if(getyCoord() < enemyy+80){ setyCoord(getyCoord() + speed); } ...
4
public static void createItemAll(int itemID, int itemX, int itemY, int itemAmount, int itemController) { for (Player p : server.playerHandler.players){ if(p != null) { client person = (client)p; if((person.playerName != null || person.playerName != "null") && !(person.playerId == itemController)) { ...
6
public int find_split(Context cx, Scriptable scope, String target, String separator, Scriptable reObj, int[] ip, int[] matchlen, boolean[] matched, String[][] parensp) { int i = ip[0]; int length = target.length(); ...
8
public void editMakler() { //Menü zum selektieren des Maklers Menu maklerSelectionMenu = new MaklerSelectionMenu("Makler editieren", service.getAllMakler()); int id = maklerSelectionMenu.show(); //Falls nicht "zurück" gewählt, Makler bearbeiten if(id != MaklerSelectionMenu.BACK) { //Makler laden Makl...
5
@Override public String getColumnName(int column) { return colNames[column]; }
0
@Override public int getAttributeCount() { if (attributes != null) { return attributes.size(); } return 0; }
1
public void setDireccion(String direccion) { this.direccion = direccion; }
0
protected ArrayList<Placement> densityMapping(Field[][] map, int c) { shootDensity.clear(); for (int y = 0; y < map.length; ++y) { for (int x = 0; x < map[y].length - shipValue + 1; ++x) { int tmp = 0; for (int z = 0; z < shipValue; ++z) { ...
9
public static CalendarHMS jauD2dtf(final String scale, int ndp, double d1, double d2 ) throws JSOFAIllegalParameter, JSOFAInternalError { boolean leap; int iy1, im1, id1, iy2, im2, id2, ihmsf1[] = new int[4]; double a1, b1, fd, dat0, dat12, dat24, dleap; /* The two-part JD. */ a1 = d1; b1 = d2; /* Provisional c...
7
public boolean metodoCompare(Pessoa u ){ if (this.end.equals(u.getEnd()) && this.nome.equals(u.getNome()) && this.login.equals(u.getLogin()) && this.senha.equals(u.getSenha()) &&(this.id.equals(getId()))){ return true; } return false; }
5
@Override public void clearSky() { if(!skyedYet) return; final Room skyGridRoom=rawDoors()[Directions.UP]; if(skyGridRoom!=null) { if(((skyGridRoom.roomID()==null)||(skyGridRoom.roomID().length()==0)) &&((skyGridRoom instanceof EndlessSky)||(skyGridRoom instanceof EndlessThinSky))) { ((GridLo...
9
public boolean addClient(String x) { try { LoadBalancer.registerNewClient(x); } catch (IOException e) { System.err.println("Had an error connecting to " + x.split("::")[0] + ": " + e.getMessage()); System.err.println("Will continue to try to connect..."); LolDataServer.log.warning("Had an error connect...
1
@AfterClass public static void tearDownClass() { }
0
static final public void ClassExtendsDeclaration() throws ParseException { jj_consume_token(CLASS); Identifier(); jj_consume_token(EXTENDS); Identifier(); jj_consume_token(LBRACE); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BOOLEAN: case INTEGER: ...
8
protected void guessDeviceType(UserAgentInfo uaInfo) { if (compiledDeviceRegMap == null || deviceMap == null) { return; } String type = uaInfo.getType(); if (type == null || type.isEmpty()) { return; } if (type.equals("Other") || type.equals("Lib...
9
public static boolean isPermutation(String s1, String s2){ /*Firstly, compare their length*/ if(s1.length()!=s2.length()) return false; /*Then use bitmap to do the counting * Assume char has a range of 0 to 255*/ int map[] =new int[256]; int length=s1.length(); for(int i=0;i<lengt...
5
public void twoBodyCollision(Entity e1, Entity e2){ double m1 = e1.mass; double m2 = e2.mass; double v1x = e1.vx; double v1y = e1.vy; double v2x = e2.vx; double v2y = e2.vy; double x1 = e1.x; double y1 = e1.y; double x2 = e2.x; double y2 = e2.y; double size1 = e1.size; double size2 = e2.size; ...
1
@Override public boolean isValid(Location from, Location to) { int fromCount = game.getCount(from); int toCount = game.getCount(to); Color fromColor = game.getColor(from); Color toColor = game.getColor(to); Color playerInTurn = game.getPlayerInTurn(); if(from == to){ return false; } if ( ...
9
public static void renderEntities(Graphics g, Global global){ Verse currentVerse = global.getCurrent().getCurrentVerse(); for (int i=0; i<currentVerse.getVerseEntities().size(); i++){ Entity ent = currentVerse.getVerseEntities().get(i); if (ent!=null){ if (ent.getEntityImg()!=null){ if (ent.getEntity...
8
public Archive findStartMatchArchive( String consolFun, long startTime, long resolution ) throws IOException { long arcStep, diff; int fallBackIndex = 0; int arcIndex = -1; long minDiff = Long.MAX_VALUE; long fallBackDiff = Long.MAX_VALUE; for ( int i = 0; i < archives.length; i++ ) { if ( archive...
7
void createHMlut(int [] kernel, int [] lut){ int i, j, match, toMatch; for(i=0;i<512;i++) lut[i]=1; toMatch=0; for(j=0;j<9;j++){ if (kernel[j]!=2) toMatch++; } //System.out.println("Debug: to match: "+toMatch); //make lut for(i=0;i<512;i++){ match=0; for(j=0;j<9;j++){ if (kernel[j]...
9
public static void main(String[] args) { Reader in = new Reader(); int i,dg[],n; int tc = in.nextInt(); while (0 < tc--) { n = in.nextInt(); in.restStringLine(); ArrayList<Integer> list = new ArrayList<Integer>(); for (int j ...
5
public void updateFiles () { if (FD!=null) return; File dir=new File(DirField.getText()); if (!dir.isDirectory()) return; CurrentDir=DirField.getText(); if (PatternField.getText().equals("")) PatternField.setText("*"); try { Files.clear(); Dirs.clear(); FileList l=new FileList(DirField.getText(), ...
6
public State getMovingDirectionState(Point destination) { Point position = new Point(super.getIntX(), super.getIntY()); if(Point.insideAngle(Point.DOWN_LEFT, Point.DOWN_RIGHT, position, destination)) { // Move up return State.MOVE_UP; } else if(Point.insideAngle(Point.DOWN_RIGHT, Point.UP_RIGHT, position, dest...
3
public DataSource assemble(ServletConfig config) throws ServletException { String dataSourceName = "jdbc/blabber"; DataSource dataSource = null; System.out.println("Data Source Parameter " + dataSourceName); Context envContext = null; try { Context context = new InitialContext(); System.out....
3
@Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (claimNumber != null ? claimNumber.hashCode() : 0); result = 31 * result + (claimantFirstName != null ? claimantFirstName.hashCode() : 0); result = 31 * result + (claimantLastName !=...
9
public String getOrgaEinheitBezeichnung(){ OrgaEinheit orgaEinheit = dbZugriff.getOrgaEinheitZuidOrgaEinheit(this.idOrgaEinheit); if(orgaEinheit!=null)return orgaEinheit.getOrgaEinheitBez(); else return "Keine Organisationseinheit"; }
1
public static Personne authenticate(String username, String password) { try { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "margo", "margo"); if (con == null)...
5
public static ArrayList<String> merge(String[] a, String[] b) { ArrayList<String> sentence = new ArrayList<String>(); for (String s: a) sentence.add(s); for (String s: b) sentence.add(s); return sentence; }
2
public void draw(Graphics graphics) { int y = 1000 / 3; int i = 1; graphics.drawImage(sprite.getImage(image), 0, 0, null); for (String menuItem : menuItems) { if (i == selectedItem) { graphics.setColor(Color.red); graphi...
2
private void updateLists(double x) { if (n == 1) { X[1] = x; } else if (n > 1 && n <= maxlag) { for (int j = 1; j <= n-1; j++) { W[j] = W[j] + ((double)(n - 1) / n) * (x - x_bar) * (X[n-j] - x_bar); } X[n] = x; } el...
5
void compareCdfUp(double p, int k, int n, double result) { double prob = Binomial.get().cdfUp(p, k, n); double abs = Math.abs(prob - result); double diff = abs / Math.min(prob, result); if ((abs > 1E-300) && (diff > 0.00000000001)) throw new RuntimeException("Relative difference:" + diff + "\t\t" + prob + " !=...
2
public MenuItem getLlItemItem() { if (llItem == null) { llItem = new MenuItem("Show Lekkerland Menu"); llItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { new ReceiptListPanel(); } catch (Exception ex) { ex.printStackTrace(); } ...
2
public static int tilesToPixels(int numTiles) { // no real reason to use shifting here. // it's slighty faster, but doesn't add up to much // on modern processors. return numTiles << TILE_SIZE_BITS; // use this if the tile size isn't a power of 2: //return numTiles * TIL...
0
String EncodeCurrentStatus() { String code = ""; for(int i = 0; i < sudokuSize; i++) { for(int k = 0; k < sudokuSize; k++) { if(cells[i][k].valueState != waitingValue) code += i + "," + k + "," + cells[i][k].current + "," + cells[i][k].valueState + "," + instantiator[i][k] + "&"; } } ret...
3
public void persistir() { FileOutputStream fos = null; ObjectOutputStream stream = null; try { fos = new FileOutputStream("arquivo.bin"); stream = new ObjectOutputStream(fos); stream.writeObject(persistencia); } catch (IOException e) { e.printStackTrace(); } finally { if (fos != null) { tr...
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SequenceImpl<?> other = (SequenceImpl<?>)obj; if (size != other.size) ret...
7
public static void ledprocess(String filepath, String result, String sn){ String finalresult = ""; int errorcode=0;// print error code in the final output file; int errornum = 8; File outputfile = new File(filepath); if ((result.equals("P"))||(result.equals("p"))||(result.equals("pass"))||(result.equals("PASS")...
6
private void calculateBestFitLine() { int count = timestamps.length, validCount = 0; double ts = 0.0, vs = 0.0; for(int i = 0; i < count; i++) { if(!Double.isNaN(values[i])) { ts += timestamps[i]; vs += values[i]; validCount++; } } if(validCount <= 1) { // just one not-NaN point b0 = b...
5
public void loadConfig() { configYaml = new YamlConfiguration(); try { configYaml.load(configFile); } catch (Exception e) { e.printStackTrace(); } if (configYaml.getString("config-version") != plugin.getDescription().getVersion()) { if (configYaml.getString("config-version") =...
7
private Object handleSubm(Object tos, String id, String ref) { if (tos instanceof Header && ref != null && ((Header)tos).getSubmitterRef() == null) { ((Header)tos).setSubmitterRef(ref); return new Object(); // placeholder } else if (tos instanceof Header && ref == null && ((Header)to...
9
public void portalEffect(Player p){ int n = -1; int lb = 0; int ub = 3; String head; String textBlock; ArrayList<String> strList = new ArrayList<String>(); head = "Outworld Portal"; strList.add("0: Decline"); if((p.inventory.contains(Card.gauntlet) || p.inventory.contains(Card.gauntletii)) && !spectra...
9
private eIDTokenLoadingWindow(final String providerName, final BiConsumer<PbxUser, CertificateData> consumer) { super("Validating your Citizen Card - Protbox"); this.setIconImage(Constants.getAsset("box.png")); this.setLayout(null); info = new JLabel(); setInfoWithLooking(); ...
8
public void setWeight(String weight) { this.weight = weight; setDirty(); }
0
public static ServerType getServerType(byte t) { switch (t) { case 'D': case 'd': return DEDICATED; case 'L': case 'l': return NON_DEDICATED; case 'P': case 'p': return TELEVISION; default: throw new IllegalArgumentException(); } }
6
public void createAccount(String strAccountName, String strUserName, Boolean autoPassword, int autoPassLen, Boolean autoPassAllSpecials, String autoPassSpecials, String strPassword, Boolean seperatorTab, FkActionEventListener delegate) { StringBuilder sb = new StringBuilder(256); sb.append...
4
public String getIsNull() { return isNull; }
0
public AnalysisData createAnalysisData() { final AnalysisData analysisData = new AnalysisData(); analysisData.name = getName(); analysisData.duration = getDuration(); analysisData.properties = getProperties(); final List<String> callNames = getCallNames(); analysisData.rows = new AnalysisData.Row[callNam...
1
private void setAnchorPointForRectangularShape(byte i, float x, float y, float w, float h) { switch (i) { case RectangleComponent.UPPER_LEFT: anchorPoint.setLocation(x + w, y + h); break; case RectangleComponent.UPPER_RIGHT: anchorPoint.setLocation(x, y + h); break; case RectangleComponent.LOWER_RIG...
8
public void readFile() throws FileNotFoundException { if (fileName != null) { File file = new File(fileName); Scanner scanner; try { scanner = new Scanner(file); String line; if (scanner.hasNextLine()) { scanner.nextLine(); } String currClass = ""; while (scanner.hasNextLine()) {...
6
@Override public String execute() throws Exception { User user = this.service.getCurrentUser(); if (user == null) return SUCCESS; List<Map<String, Object>> notifications = this.service.checkNotification(user.getUid()); if (notifications == null) return SUCCESS; StringBuilder sb = new StringBuilde...
8
public String saveXML(boolean withDialog) { String fileName = ""; FileWriter fstream = null; File tempFile = null; if (withDialog == true) { fileName = getSavedFileName(); if (fileName == null) { return null; } try { fstream = new FileWriter(fileName); } catch (IOException e1) { Er...
6
private boolean move(int nX, int nY) { //Check if valid if (!isValidPosition(nX, nY)) { return false; } pX = nX; pY = nY; setVisited(pX, pY); if(hasWumpus(pX,pY)) { score -= 1000; g...
3
public String try_user_name() throws Exception { System.out.println("userName is " + userName); Connection conn = null; ResultSet rs = null; Statement stmt = null; if (userName.length() > 20) return "overflow"; if (userName.length() < 7) return "usernameShort"; try { Class.forName("com.mysql.jdbc...
5
HashMap<Variant, String> readEnsemblFile(String fileName) { String lines[] = Gpr.readFile(fileName).split("\n"); if (lines.length <= 0) throw new RuntimeException("Cannot open file '" + fileName + "' (or it's empty)."); HashMap<Variant, String> seqChanges = new HashMap<Variant, String>(); for (String line : ...
2
public static Double calculateAndSomething(ArrayList<String> container) { double answer = 0; ArrayList<Double> values = new ArrayList<Double>(); for (int i = 0; i < container.size(); i++) { values.add(Double.valueOf(container.get(i))); } answer = values.get(0); System.out.println(answer); Random ge...
6
public void add( Double addVal ) { //Add value as last node, to maintain balance, completeness of tree _heap.add( addVal ); _size++; int addValPos = _heap.size() - 1; int parentPos; while( addValPos > 0 ) { //potentially swap until reach root //pinpoint parent parentPos = (addValPos-1) / 2; i...
2
public void setIndent(boolean bIndent) { this.bIndent = bIndent; newLine = bIndent ? "\n" : ""; }
1
public static void main(String... args) throws InterruptedException { GWCAConnection gwcaConnection = null; try { LOG.info("Executing \"Java GWCAConstants\" (version {})", Version.getVersion()); //TODO: Fill in the PID here gwcaConnection = new NamedPipeGWCAConnecti...
2
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new FileReader(args[0])); StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { sb.append(line); sb.append('\n'); line = br.readLine()...
1
public AppTest( String testName ) { super( testName ); }
0
@Override protected byte[] generatePayload() throws MQTTException, IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); if (topicFilters.length <= 0 || QoSs.length <= 0) throw new MQTTException( "The SUBSCRIBE message must contain at least one topic...
5
public HookingJar(String folderNameIn, String fileNameIn){ folderName = folderNameIn; fileName = fileNameIn; if (debug) { filePath = ROOT_FOLDER + "\\" + folderName + "\\Testing\\" + fileName + ".jar"; } else { filePath = ROOT_FOLDER + "\\" + folderName + "\\" +...
4
public JButton getDialogButton(String buttonName){ if(buttonName.equals("ok")){ return okButton; } else if(buttonName.equals("cancel")){ return cancelButton; } else if(buttonName.equals("close")){ return closeButton; } return nu...
3
public static boolean isData(String[] ccCode){ String[] tCodes = ccCode; int tblestart = 0; int tbleend = 0; Boolean b=false; Connection con = DBase.dbConnection(); PreparedStatement pst; try{ String query = "Select Count(CountryCode) FROM AED"; ...
7
public Error getError() { if(isOk()) return error; try { JAXBContext context = JAXBContext.newInstance(Error.class); Unmarshaller unmarshaller = context.createUnmarshaller(); StringReader xml = new StringReader(content); if(!content.isEmpty()) error = (Error)unmarshaller.unmarshal(new Stre...
3
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...
6
@Override public boolean ausfuehren(ServerKontext kontext, Spieler spieler, Befehlszeile befehlszeile) { Raum aktuellerRaum = kontext.getAktuellenRaumZu(spieler); Item kuchen = aktuellerRaum.getNaechstesItem(); int energie = spieler.getLebensEnergie(); if(kuchen.isKuchen()) { energie += SpielKonstant...
4
public BooleanOperator getIntegerToBooleanOperator(String string) { char[] chars = string.toCharArray(); for(char c : chars) { if(c == '<') return BooleanOperator.LESS_THAN; else if(c == '>') return BooleanOperator.MORE_THAN; else if(c == '=') return BooleanOperator....
6
public static void main(String[] args) { if (args.length == 0) { usage(); return; } if (args.length > 2) { reportError("too many command-line arguments"); usage(); System.exit(1); } try { Reader input; ...
7
public static String getCookieValue(HttpServletRequest request,String cookieName) { Assert.notNull(request); Assert.hasText(cookieName); Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length >0) { for (Cookie cookie : cookies) { if (cookie.getName().equals(cookieName)) { ret...
4
static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextCol...
6
public void setId(int id) throws ParkingException { if (id < 0) { throw new ParkingException("Parking id is under zero"); } this.id = id; }
1
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
9
private String findSepLineInFile() { String[] lines = new String[0]; try { lines = FileHelper.readFileAsUtf8StringArray( selectedFile ); } catch( final Exception e ) { return DEFAULT_SEPARATOR_LINE; } Arrays.sort( lines ); String candidate = DEFAULT_SEPARATOR_LINE; int candidateCount =...
6
public void actionPerformed(ActionEvent actionEvent) { if (actionEvent.getActionCommand().equals("Cut")) { if (tf != null) { tf.cut(); } else { ta.cut(); } } if (actionEvent.getActionCommand().equals("Copy")) { if (t...
6
@SuppressWarnings({ "rawtypes", "unchecked" }) /* * This creates a request message from the omnilink.jar library. * This function needs to be cleaned up. */ public RequestMessage createRequestMessage(Map o) { Class commandClass = commandMap.get(o.get("command")); try { ...
6
boolean removeIfExists(Key key, T obj) { Object s = index.get(key); if (s instanceof Relation) { Relation rel = (Relation)s; Storage storage = getStorage(); int oid = storage.getOid(obj); int l = 0, n = rel.size(), r = n; while (l < r) { ...
9
public static void main(String[] args) { String a=""; String palabra=JOptionPane.showInputDialog(null,"Ingrese uns frase : "); String []frase=palabra.split(" "); for(int i=frase.length-1;i>=0;i--) { a=a+frase[i]+" "; } JOptionPane.showM...
1
public void actionPerformed(ActionEvent arg0) { Component apane = environment.tabbed.getSelectedComponent(); JComponent c=(JComponent)environment.getActive(); SaveGraphUtility.saveGraph(apane, c,"PNG files", "png"); }
0
public static void DoBullyBotTurn(PlanetWars pw) { Planet source = null; double sourceScore = Double.MIN_VALUE; //Select my strongest planet to send ships from for (Planet myPlanet : pw.MyPlanets()) { if (myPlanet.NumShips() <= 1) continue; double score = (double) myPlanet.NumShips(); if (score > s...
7
public static void main(String... args) { final SimpleFetcher simpleFetcher = new SimpleFetcher(); new Thread(new Runnable() { @Override public void run() { simpleFetcher.fetch(new TestCallBack()); } }).start(); logger.info("do somethin...
1
public void registerEntityType(EntityType type) { log(Level.INFO, "Registering entity type %d", type.id); entityTypes.put(type.id, type); type.init(this); if (type.spawner != null) { registerEntityType(type.spawner); } }
1
public static void kickPlayer(Player player, String playerName, String kickPlayerName, String reason) { ArrayList<Player> kickPlayers = AdminEyeUtils .requestPlayers(kickPlayerName); if (kickPlayers == null && kickPlayerName != null) { StefsAPI.MessageHandler.buildMessage().addSender(playerName) .se...
6
public void drawRange(Graphics g, boolean nearTrack){ if (focused){ //Turret Range g.setColor(new Color(0, 0, 0, 120)); g.fillOval(locX-(range/2), locY-(range/2), range+size, range+size); if (nearTrack){ g.setColor(new Color(6, 65, 105, 120)); } else{ g.setColor(new Color(178, 34, 34, 120));...
2
protected static Point getLowestPoint(Point[] points) { if (points.length < 1) { return null; } Point lowest = points[0]; for (Point temp : points) { if(temp.y < lowest.y || (temp.y == lowest.y && temp.x < lowest.x)) { lowest = temp; } ...
5
protected void readScaleFactorSelection() { for (int i = 0; i < num_subbands; ++i) ((SubbandLayer2)subbands[i]).read_scalefactor_selection(stream, crc); }
1
public Date getCheckinDate() { return checkinDate; }
0
public static void removeFine(int fineId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStateme...
4
public static BufferedImage loadImage(String s){ BufferedImage image = null; try { image = ImageIO.read(Images.class.getClass().getResourceAsStream(s)); } catch (IOException e) { e.printStackTrace(); System.out.println("Failed to load " + s + ". Shutting down system."); System.exit(0); } return ...
1
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { Raster source = sources[0]; Rectangle srcRect = source.getBounds(); int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest); MediaLibAccess...
9
public static void drawBoard(){ String[][] result = new String[8][8]; //make the tiles white or black boolean white = true; for (int i = 0; i < 8; i++){ for (int j = 0; j < 8; j++){ if (white){ result[i][j] = " |"; white = false; }else{ result[i][j] = "##|"; white = true; ...
8
public static String sendGet(String url) { String result = ""; BufferedReader in = null; try { URL realUrl = new URL(url); // 打开和URL之间的连接 URLConnection connection = realUrl.openConnection(); // 设置通用的请求属性 connection.setRequestProperty("a...
4
protected DisplayPiece rotatePiece() { DisplayPiece piece = null; Point[] temp = new Point[body.length]; //switch x,y y,x for (int i = 0; i < body.length; i++) { temp[i] = new Point(); temp[i].x = body[i].y; temp[i].y = body[i].x; ...
2
private boolean endRequest(Request request) { if (!this.requestTransactionLiving(request)) return false; transactionEntity tempT = this.transInfo.get(request.transaction); for (Site site : tempT.visitedSites) { if (!site.isRunning()) continue; ...
3
public boolean collidesEntity(int x, int y) { for (Entity e: entites) { if ((e != (Entity)p) && (e.getPos_x() == x) && (e.getPos_y() == y) && (!e.isPushable())) { p.setHealth(p.getHealth()-e.getAttack()); e.setHealth(e.getHealth()-p.getAttack()); System.out.println("ATK, ENEMY HP " + e.getHealth()); ...
8
public List<String> allUsers() { PreparedStatement stmt = null; Connection conn = null; ResultSet rs = null; List<String> users = new ArrayList<String>(); try { conn = DbConnection.getConnection(); stmt = conn.prepareStatement(ALL_USERS_STMT); rs = stmt.executeQuery(); while (rs.next()) { u...
8
@Override public void remove(Component component) { if (mList != null) { mList.remove(component); } }
1
private static boolean compareBoolean(Node node, Argument left, Argument right) { if (left.isNull()) return right.isNull(); if (left.isBoolean()) { return right.isBoolean() && left.asBoolean() == right.asBoolean(); } if (left.isString() || left.isObject()) { return (right.isString() || right.is...
7