text
stringlengths
14
410k
label
int32
0
9
public boolean placeToken(int _column) { if(checkIfValidColumn(_column) == true) { int win; for (int i = 0; i < row; i ++) { if (i == row - 1) { gameGrid[i][_column - 1] = currentPlayer; win = checkForAWinner(); notifyOfGameChange(i, _column); if (win != 0) { ...
8
public static void populateFromMap(Object obj, Map<String, Object> properties, Map<String, Method> setters) throws IllegalAccessException, InvocationTargetException { if (obj == null || setters == null || setters.isEmpty()) { return; } ...
5
@Override public void render() { GameActor a = Application.get().getLogic().getActor(Application.get().getLogic().getGame().getBaseID()); PhysicsComponent pc = null; if(a != null) { pc = (PhysicsComponent)a.getComponent("PhysicsComponent"); } if(pc != nul...
3
protected CycList substituteForBackquote(CycList messageCycList, Timer timeout) throws IOException, CycApiException { if (messageCycList.treeContains(CycObjectFactory.backquote)) { CycList substituteCycList = new CycList(); substituteCycList.add(CycObjectFactory.makeCycSymbol("read-f...
3
public void setjButtonNew(JButton jButtonNew) { this.jButtonNew = jButtonNew; }
0
private QueryPart parseRestrictions(String rql, AtomicInteger pos) { ComplexPart part = new ComplexPart(); rql = rql.trim(); boolean isString = false; //if true, we are dealing with a string boolean isMethodWithParenthesis = false; //if true, it is not a sub expression char ch...
9
public UnitProductionRemover() { }
0
public static String[] parseAka(String data) { Jmdb.log.debug("Parsing movie AKAs"); Matcher matcher = akaPattern.matcher(data); String akas; String[] aka = null; if (matcher.find()) { akas = htmlEntityDecode(matcher.group(1).trim()); ...
2
public int getAttributeSize() { int size = 2; /* attribute count */ if (unknownAttributes != null) { Iterator i = unknownAttributes.values().iterator(); while (i.hasNext()) size += 2 + 4 + ((byte[]) i.next()).length; } return size; }
2
void showErrorMessage(String message) { errorMessage.setVisible(true); errorMessage.setText(message); }
0
@Override public boolean equals(Object obj){ if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PieceLocation other = (PieceLocation)obj; if (this.location == null){ if (other.location != null) return false; } else if (!this.location.equa...
9
public static int countNeighbours(long world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { c += 1; } if (getCell(world, col - 1, row) == true) { ...
8
private boolean isClassBox(String owner) { if (!owner.startsWith("java/lang/")) { return false; } String className = owner.substring("java/lang/".length()); return (className.equals("Integer") || className.equals("Double") || ...
7
public Worker () { //initial settings isInputActive = true; this.keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
0
public static int listCompare(ArrayList<Double> l1, ArrayList<Double> l2){ int size = l1.size(); int i; double[] diff = new double[size]; for(i = 0; i < size; i++){ Double d1 = l1.get(i); Double d2 = l2.get(i); if(d1 - d2 > epsilon){ ...
4
public void drawPath(Graphics g) { Graphics2D g2 = (Graphics2D) g; List<String> path = new ArrayList<>(); if (player.isSelected()) { Field mouseOverField = null; for (int i = 0; i < hexMap.length; i++) { for (int j = 0; j < hexMap[i].length; j++) { if (hexM...
9
public static void deleteElement(ElementField element) { if (element != null) { _elements_sprite.remove(element); } }
1
public ArrayList<Student> students(ResultSet rs) throws Exception { DBConnector db = new DBConnector(); ArrayList<Student> data = new ArrayList<>(); while (rs.next()) { data.add(new Student(db.getPerson(rs.getInt("personid")))); } return data; }
1
public Object getValueAt(int row, int column) { try { Class c = rows.get(row).getClass(); BeanInfo beanInfo = Introspector.getBeanInfo(c, Object.class); PropertyDescriptor pd = beanInfo.getPropertyDescriptors()[column]; Method m = pd.get...
5
@Override public LevelData getData() throws LevelIOException { String leveltxt = ""; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); //odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); b...
5
@Override public T next() { if (!mNextValid) { if (!hasNext()) { throw new NoSuchElementException(); } } mNextValid = false; return mNext; }
2
public void gameLoop() { //Main game Loop of the game boolean pieceFree = true; while (true) { if (!isSpawnFree()) { System.out.println("\n\n\n\n GAME OVER \n\n\n"); this.grid.fireGameOver(); break; } else { ...
7
public void setDialogButton(String[] buttons){ dialogButtonsPanel.removeAll(); dialogButtonsPanel.add(dialogFiller); for(String buttonName : buttons){ if(buttonName.equals("ok")){ dialogButtonsPanel.add(okButton); } else if(buttonName....
4
public User getUserByEmail(String email) { try { String sql = "select * from user where email=" + email; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (rs.next()) { User user = new User(); user.setUserId(Integer.parseInt(rs.getString("user_id"))); user.setE...
2
public boolean has(Player player, String node) { try { if (vaultPerms != null) { return vaultPerms.has(player, node); } else if (nijPerms != null) { return nijPerms.getHandler().has(player, node); } // System.out.println("no perm: checking superperm for " + player.getName() + ": " + node); // Sys...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Customer other = (Customer) obj; if (customerID == null) { if (other.customerID != null) return false; } else if (!customerID.equals(oth...
6
@Override public boolean activate() { return (!Inventory.contains(Constants.BEAR_FUR) && !Bank.isOpen() && !Constants.BURTHOPE_BANK_AREA.contains(Players.getLocal()) && !Constants.BEAR_AREA.contains(Players.getLocal()) && !Constants.ESCAPE_AREA.contains(Players.getLocal())); ...
4
@Override public void removeObserver(IObserver observer) { int index = this.observers.indexOf(observer); if (index >= 0) { this.observers.remove(index); } }
1
@Override public void unsetResource(ResourceType resource) { Player player = presenter.getClientModel().getServerModel().getPlayerByID(presenter.getPlayerInfo().getID()); switch(resource.name().toLowerCase()) { case "brick": this.brickState = 0; this.desiredBrick = 0; this.offeredBrick = 0; this....
5
public Imagen traslacion(Imagen imgFuente, double factX, double factY) { Imagen imgResultado = new Imagen(); imgResultado = imgFuente.clone(); short[][] matrizResultado = new short[imgFuente.getN()][imgFuente.getM()]; short[][] matrizFuente = imgFuente.getMatrizGris(); ...
7
public SlideShow parse(String aPathName) { if (Debug.parser) System.out.println("xmlPath"+aPathName); xmlPath = aPathName; xmlPath = xmlPath.replace('\\', '/'); // get schema and xml files File inputFile = new File(aPathName); if (!inputFile.exists()) { System.out.println("Parser error: passed file d...
5
public final boolean isDefault() { return this.equals(defaultFlags); }
0
private void checkEnoughCapacity(int number) { // if (array.length - currentSize < number) { // expandVectorCapacityBy(number - array.length + currentSize); // } if (array.length - currentSize < number) { changeVectorCapacityBy(array.length); } else if (currentSize < array.length / 4) { changeVectorCapa...
2
public void setDepartmentName(String departmentName) { this.departmentName = departmentName; }
0
private ItemStack getResult(ArrayList<String> holder){ ItemStack fail = new ItemStack(Material.SKULL); ItemStack dish = null; if(!this.recipeSpiceyChicken(holder,fail).isSimilar(fail)){ return this.recipeSpiceyChicken(holder,fail); } if(!this.recipeSeasonedChicken(holder,fail).isSimilar(fail)){ return this.r...
5
public void makeOpAssign(int operatorIndex) { setOperatorIndex(operatorIndex); if (subExpressions[1] instanceof NopOperator) subExpressions[1].type = Type.tUnknown; opAssign = true; }
1
public boolean movable(int x,int y,int xOrig, int yOrig){ if(thePlayer.getHitPoints() <= 0){ return false; } /* not movable, out of boundary*/ if (!inBounds(x, y)) return false; //player isn't movable, start attack for player if(floor[x][y] instanceof Monster){ /*if(floor[xOrig][yOrig...
5
@Override protected void CustomRender(GameContainer gc, Graphics g) throws SlickException { g.drawImage(fond, Ctes.CARACS_X_FOND, Ctes.CARACS_Y_FOND); afficheClasse(perso, g); g.drawString("Niveau " +perso.getNiveau(), Ctes.CARACS_X_NIVEAU, Ctes.CARACS_Y_NIVEAU); if (perso.getNiveau(...
9
protected void cascadingCut(Fibonaccinode y) { Fibonaccinode z = y.parent; if (z != null) { if (!y.mark) { //merkataan solmu y.mark = true; } else { cut(y, z); cascadingCut(z); } } }
2
@Override public void selectCourses(List<Integer> mainCourseList, List<Integer> additionalCourseList, int userId) throws SQLException { Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect =...
6
public boolean equals(Node other) { return other != null && x == other.getX() && y == other.getY(); }
2
private void zoomOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutButtonActionPerformed diagramPanel.getScaleRatio()[0] -= 0.25; diagramPanel.getScaleRatio()[1] -= 0.25; diagramPanel.getScaleRatio()[0] = Math.max(0.3, getDiagramPanel().getScaleRatio()[0]); ...
7
private void getNextPosition() { // movement if (left) { dx -= moveSpeed; if (dx < -maxSpeed) { dx = -maxSpeed; } } else if (right) { dx += moveSpeed; if (dx > maxSpeed) { dx = maxSpeed; } } // falling if (falling) { dy += fallSpeed; } }
5
private static String convertToHex(byte[] data) { StringBuilder buf = new StringBuilder(); for (int i = 0; i < data.length; i++) { int halfbyte = (data[i] >>> 4) & 0x0F; int two_halfs = 0; do { if ((0 <= halfbyte) && (halfbyte <= 9)) { ...
4
public static ArrayList<Kill> compaireEntityLoss(ArrayList<Kill> Kills, String name) { ArrayList<Kill> output = new ArrayList<Kill>(); for (Kill k : Kills) { if (k.getVictim().findAttribute(name)) { output.add(k); } } return output; }
2
void permute(int size) { int M = size; int poped = 0; Stack<Integer> s = new Stack<Integer>(); s.push(0); while (!s.empty()) { int top = s.peek(); int i = 0; for (i = 1; i <= M; ++i) { if (find(top, i)) conti...
6
private void handleLineFragmentInDefaultState(String line) throws IOException { // System.out.println("Handling line fragment: state=" + parsingState // + ", vbLevel=" + verbatimMode // + ", iLevel=" + indentLevel // + ", line=" + line // ...
9
private void btnEditarClienteSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarClienteSalvarActionPerformed try { if (JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0) { carregaObjeto(); if (dao.Salvar(cl...
3
@Override public E get(E e) { if(contains(e)){ setIn = new Node(e); current = root; while(current!=null){ if(setIn.object.compareTo(current.object)<0){ current = current.right; }else if(setIn.object.compareTo(current.object)>0){ current = current.left; }else{ return current.object...
4
public void getAllRecursion() throws MalformedURLException{ List<String> thisList = new ArrayList<>(); for(String l: links){ thisList.add(l); } links.clear(); for(String l: thisList){ URL url = new URL(l); if(finishedLinks.indexOf(l) == -1 && verifyLink(url)){ finishedLinks.add(l); String we...
5
public boolean move(List<Color> source, List<Color> dest) { if (dest.size() == 0 || dest.contains(source.get(0))) { // regular move dest.add(source.remove(source.size() - 1)); return true; } else if (dest.size() == 1 && !dest.contains(source.get(0))) { // blot // move opponent's piece to rail this...
4
public final void addConnection(AbstractSelectableChannelConnection conn, Set<String> allowedEvents) throws ConnectionException { if (conn.isClosed()) { return; } final SelectableChannel channel = conn.getChannel(); try { synchronized (guard) { ...
8
public static <T extends DC> Similarity getPhiSim(Set<Pair<T,T>> done) { if(done!=null) { if(done.next!=null) { return new Similarity(done.a.fst().delta(done.a.snd()).simi().getValue()+(getPhiSim(done.next).getValue())); } else { return new Similarity(done.a.fst().delta(done.a.snd()).simi(...
2
@Override public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) { try { if (e.getMessage() instanceof String) { Channels.write(ctx, e.getFuture(), ChannelBuffers.copiedBuffer( (String) e.getMessage(), Charset.forName("UTF-8"))); } else { EventResponse Message = (EventR...
2
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { processRequest(request, response); } catch (Exception ex) { Logger.getLogger(ControlJsp.class.getName()).log(Level.SEVERE, null, e...
1
public void reportFail(String service) throws RemoteException { //Splits service to get the server ID String tmp[] = service.split("Acesso"); //Parse server ID to int Integer pos = new Integer(Integer.parseInt(tmp[1])); try { System.out.println("Client " + RemoteServer.getClientHost() + " reported dow...
1
@Override public void report(final SortedMap<String, Gauge> gauges, final SortedMap<String, Counter> counters, final SortedMap<String, Histogram> histograms, final SortedMap<String, Meter> meters, final SortedMap<String, Timer> timers) { final long timestampClock = clock.getTime(); final...
5
private void playAudio() { try { // Get everything set up for // playback. // Get the previously-saved data // into a byte array object. byte audioData[] = byteArrayOutputStream.toByteArray(); // Get an input stream on the // byte array containing the data InputStream byteArrayInputStream = ne...
1
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PeriodBrand other = (PeriodBrand) obj; if (manufacture == null) { if (other.manufacture != null) return false; } else if (!manufacture.e...
9
public void startConnection() { String host = plugin.getConfig().getString("hostname", "localhost"); String port = plugin.getConfig().getString("port", "3306"); String username = plugin.getConfig().getString("username", "root"); String password = plugin.getConfig().getString("password", ...
5
@Override @SuppressWarnings("SleepWhileInLoop") public void run() { while (true) { try { Thread.sleep(1000); } catch (InterruptedException ex) { System.out.println("Producer interrupted"); return; } buffer.p...
2
public void run() { init(); //For keeping track of nanoTime long start; long elapsed; long wait; while(running) { //The start time of the function call start = System.nanoTime(); //update variables, create and draw images update(); draw(); drawToScreen(); //set th...
3
public long update(HTSMsg msg) { HTSMsg chann = channels.get(((Number)msg.get(CHANNELID)).longValue()); for (String name : msg.keySet()){ if (Arrays.asList(HTSMsgFields).contains(name)){ chann.put(name, msg.get(name)); } else if (name.equals("method")){ //This is normal, do nothing... } ...
3
public static void main(String[] args) throws Exception { CommandLine cmd = null; String host = ClientApp.DEFAULT_HOST; int port = ClientApp.DEFAULT_PORT; cmd = ClientApp.parseArgs( args ); if( cmd != null ) { if ( cmd.hasOption("host") ) { host = cmd.getOptionValue("host"); } if...
8
private boolean checkOutofBounds(Direction dir, int row, int col) { if(dir == Direction.LEFT){ return col <0; } else if (dir == Direction.RIGHT){ return col> COLS - 1; } else if(dir == Direction.UP){ return row <0; } else if(dir == Direction.DOWN){ return row > ROWS - 1; } return false; ...
4
private void checkfs() { if (fsm != null) { fsm.check(); } }
1
private Face connectHalfEdges ( HalfEdge hedgePrev, HalfEdge hedge) { Face discardedFace = null; if (hedgePrev.oppositeFace() == hedge.oppositeFace()) { // then there is a redundant edge that we can get rid off Face oppFace = hedge.oppositeFace(); HalfEdge hedgeOpp; if (hedgeP...
4
private void processPhil() { ArrayList<String> line = new ArrayList<String>(); int indent = _firstLine ? _indent + _parindent : _indent; for (String word : _wordLine) { if (word == null || word.matches("\\s") || word.matches("\\n")) { continue; ...
8
public void gen_for_controller(SemanticRec controllerRec, SemanticRec forDirection) { boolean increment = false; //determine whether or not to increment or decrement switch (forDirection.getRecType()) { case FOR_DIRECTION: if (forDirection.getDatum(0).equalsIgnoreCase(TokenTy...
6
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if(cmd.getName().equalsIgnoreCase("delowner")){ if(args.length != 2){ sender.sendMessage("/delowner <ChannelN...
9
public static void main(String[] args) { if (System.getSecurityManager() == null) { System.setSecurityManager(new SecurityManager()); } String name = "Compute"; try { Registry registry = LocateRegistry.getRegistry(args[0]); Compute comp = (Compute) re...
2
public String Listen(String valide, String stop, int time){ TextToSpeech tts = new TextToSpeech(); Microphone mic = new Microphone(AudioFileFormat.Type.WAVE); while (true) { try{ Thread.sleep(2000); tts.playSynth("Please, Speak now..."); Thread.sleep(50); mic.open(); mic.captureAudioToFile(f...
4
public Hash get(long hash) throws IOException { processQueue(); Reference<Hash> ref = map.get(hash); Hash h = null; if (ref != null) { h = ref.get(); } if (h != null) { return h; } Hash[] hashes = fileStore.readHash(hash); if (hashes == null) { System.out.println("Readback failed, map contain...
5
@EventHandler public void WitherRegeneration(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("Wither.Re...
7
public static void main(String[] args) { ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); List<Future<Integer>> results = new ArrayList<>(); for (int i = 0; i < 5; i++) { Future<Integer> submit = newCachedThreadPool.submit(new MyCallable(5 + i)); results.add(submit); } for (I...
5
public void sendResult(ParisModel paris) { Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); String htmlBody = "<div style='background-color:#000000; color:#FFFFFF; padding:10px; font-size:16px;'>"; htmlBody += "<h1 style='text-align:center;...
5
@Override public void izvrsiAnalizu() { // konstante u skladu sa formulama int n = stepenMultiprogramiranja; int k = brojKorisnickihDiskova + BROJ_SISTEMSKIH_DISKOVA + 1; // izračunato Gordon-Njuelovom metodom i hardkodovano za ovaj konkretan zadatak double[] x = { 1, 0.36, 0.45, 3.4 / brojKorisnickihDisk...
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final PackageCoverageStatisticsKey other = (PackageCoverageStatisticsKey) obj; if (keyName == null) { if (other.keyName != null) return fa...
7
static final public void FormParList() throws ParseException { Token token; Symbol sy; formPar(); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COLON: case VOID: case INT: case BOOL: case BYREF: ; break; default: jj...
9
public boolean laggTillAnvandareFranSkolDB(String anvandarnamnIn, String losenordIn){ ArrayList<String> dataFranPersondatabas = new ArrayList<String>(); try{ // H�mtar data om personen fr�n persondatabasen. connection2 = getConnection2(); preparedStatement = connection2.prepareStatement("SELECT * FROM pers...
5
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) { if (semiMajorAxis < 0) { throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative"); } if (semiMinorAxis < 0) { throw new IllegalArgumentException("ellipse s...
4
public void paint1(Graphics g) { g.setColor(Color.YELLOW); g.setFont(new Font("default", Font.BOLD, 20)); g.drawImage(principal.getImagenI(), principal.getPosX(), principal.getPosY(),this); g.drawImage(obs1.getImagenI(),obs1.getPosX(), obs1.getPosY(),this); for(int i = ...
2
protected Rectangle getObjectRectangle() { boolean found = false; Rectangle r = new Rectangle(0, 0, 0, 0); for (LevelItem i : objs) { if(!(i instanceof NSMBObject)) continue; NSMBObject o = (NSMBObject) i; if (fou...
3
protected void writeError(String toWrite, boolean severe) { if (toWrite != null) { if (severe) { this.log.severe(this.PREFIX + this.DATABASE_PREFIX + toWrite); } else { this.log.warning(this.PREFIX + this.DATABASE_PREFIX + toWrite); } } }
2
@Override public String getRandomQuestion() { if (size() > 0) { randomWord(); int randomIndex; String randomWordText; int index; String randomWordTextFirst = ""; if (randomWordArray == 0) { randomIndex = random.nextInt(...
5
public void registerAllMasterFiles() { DataGridResource res = (DataGridResource) Sim_system .get_entity(super.resourceID_); AbstractRC rc = null; if (res.hasLocalRC()) { rc = res.getLocalRC(); } else { rc = (AbstractRC) Sim_system.get_entity(super....
4
public static void registerClient(final MapleClient c) { if (c.finishLogin() == 0) { c.getSession().write(LoginPacket.getAuthSuccessRequest(c)); c.setIdleTask(TimerManager.getInstance().schedule(new Runnable() { public void run() { c.getSession().close(); } }, 10 * 60 * 10000)); } else { ...
5
void updatePair( double[][] A, edge nearEdge, edge farEdge, node v, node root, double dcoeff, direction d ) { edge sib; //the various cases refer to where the new vertex has //been inserted, in relation to the edge nearEdge switch( d ) { case UP: //this case is called when v has...
6
public void csNaturalDisasters(Random random, ChangeSet cs, int probability) { if (Utils.randomInt(logger, "check for natural disasters", random, 100) < probability) { int size = getNumberOfSettlements(); if (size < 1) return; // randomly select a colony to start with, then g...
6
public void addElement(AstronomicalObject element) { if (!elements.contains(element)) { elements.add(element); log.info("{} added to {} system", element.getName(), name); } else log.warn("{} not added to {} system. Object with same name already exists", element.getNam...
1
@Override public Match findMatchById(Long id) { checkDataSource(); if (id == null) { throw new IllegalArgumentException("id is null"); } try (Connection conn = dataSource.getConnection(); PreparedStatement st = conn.prepareStatement("SELECT id, hometeamid,...
4
public static Tags fromString(String string) { return TO_ENUM.get(string.toUpperCase()); }
0
@Override public void collideWith(Element e) { if (e instanceof Player) { final Player playerEntered = (Player) e; if (!player.equals(playerEntered)) { player.setPlayerStatus(PlayerStatus.LOST); playerEntered.setPlayerStatus(PlayerStatus.WON); getGrid().getEventManager().sendEvent(new Event(Ev...
2
public int getMossaMinNDMax(){ int ndmin = 12; if(desmosse!=null) //Trovo il minimo tra i vmax for(DescrittoreMossa dm : desmosse) if(dm!=null && dm.getNdmaxEnemyForest()<ndmin) ndmin = dm.getNdmaxEnemyForest(); //Restituisco il vmin se è valido return ndmin!=12?ndmin:-1; }
5
@Override public void render(Art art, Level level) { frame++; frame %= 14; if (invTimer % 10 == 0) { art.drawTile(art.spriteSheet, getX(), getY(), 6 + frame / 2, 8); art.drawTile(art.spriteSheet, getX(), getY() + 8, 6 + frame / 2 + 32, 8); } }
1
public boolean isMatched(String s) { if (s == null) return false; switch (this) { case NONE: return s.isEmpty(); case STR: return !s.isEmpty(); case INT: return s.matches("\\d+"); case PRI: return s.matches(Priorite.REGEX); case DAT: return Date.isMatched(s); case HRE: return...
9
@Override public boolean hasNext() { // TODO Auto-generated method stub boolean currentRowHasTokens = this.rowTokens > 0; boolean hasNext = false; assert(!(currentRow > maxRowNumber)); if(currentRowHasTokens){ hasNext = true; }else{ if(currentRow < maxRowNumber){ int checkedRow = 0; int...
4
@Override public void buttonStateCheck(Input input) { int mX = input.getMouseX(); int mY = input.getMouseY(); int farX = getX() + getStoredImage().getImage().getWidth(); int farY = getY() + getStoredImage().getImage().getHeight(); if (pointContains(getX(), mX, farX) && pointContains(getY(), mY, farY)) { ...
5
@Override public boolean shadow_hit(Ray ray, FloatRef tmin) { if (!bbox.hit(ray)) return false; double x1 = ray.getOrigin().getX(); double y1 = ray.getOrigin().getY(); double z1 = ray.getOrigin().getZ(); double d1 = ray.getDirection().getX(); double d2 =...
6
public static String getCharset(String page) { // page = page.toLowerCase(Locale.getDefault()); int charsetIndex = page.indexOf("charset="); Pattern pattern = Pattern.compile("[a-z0-9/-]{1}"); // 如果不存在charset= if (charsetIndex < 0) { return "utf-8"; } // 截取掉字符集前的所有字符 String indefiniteChar...
4