text
stringlengths
14
410k
label
int32
0
9
static void draw_sprites(osd_bitmap bitmap,int pri_mask) { int offs,fx,fy,x,y,color,sprite; for (offs = 0x1000-8;offs >= 0;offs -= 8) { /* Don't draw empty sprite table entries */ if (buffered_spriteram.read(offs+7)!=0xf) continue; if (buffered_spriteram.read(offs+0)==0xf0f) continue; if ((pri_mask...
8
private void makePath(Rectangle r1, Rectangle r2) { Rectangle rec = new Rectangle(0, 0, 0, 0); int cx1 = r1.x + r1.width / 2; int cx2 = r2.x + r2.width / 2; int cy1 = r1.y + r1.height / 2; int cy2 = r2.y + r2.height / 2; if (cx1 == cx2) { rec.x = cx1; ...
4
public static boolean isHit(int x, int y, int[][] sea) { return (isTile(x, y, sea) && sea[x][y] == Sea.HIT); }
1
public void draw(Graphics2D g){ //g.setColor(color1); //g.fillOval((int)(x - r), (int)(y - r), 2 * r, 2 * r); g.drawImage(this.getImage(), Math.round(this.getX()), Math.round(this.getY()), null); }
0
private boolean checkLeftDiagonalWin(int playerNumber) { int criticalNumber = 0; int i = 0; int j = 0; switch (playerNumber) { case 1: { while (i < gameField.getFieldSize()) { if(gameField.isX(i,j)) { criticalNum...
9
public Chromo<T> getRandomChromoFromPopulation(){ Chromo<T> selected = individuals.get(rand.nextInt(size)); return new Chromo<>(selected.getGenes(), selected.getFitness()); }
0
@Override public synchronized void connect(BluetoothDevice device, boolean secure, long timeout) { if (D) Log.d(TAG, "connect to: " + device); // no connection attempt already made if (!connectionAttempts.containsKey(device)) { // no active connection already set up ...
5
private void applyReplacementHighlighting(JTextComponent comp, Pattern pattern, String repString) { Matcher matcher = pattern.matcher(comp.getText()); int charsRemoved = 0; Highlighter h = comp.getHighlighter(); h.removeAllHighlights(); comp.setText(comp.getText().replaceAll(pattern.patter...
2
private IRemoteCallObject getCallObj(Long key) { return sync.get(key); }
0
public void addEntry(BaseTemplate bt) { ArrayList<String> newEntry = bt.getEntry(); ArrayList<String> authorshipURIList = new ArrayList<>(); ArrayList<String> authorURIList; if(!bt.hasAuthors()) { //Dead Entry return; } ...
7
private boolean matchParams(Class<?>[] parInput, Class<?>[] parDefined) { // make sure both methods have the same number of arguments if (Array.getLength(parInput) != Array.getLength(parDefined)){ return false; } if (Array.getLength(parInput) == 0) // no parameters to match return true; for (int ...
6
private long locateIP(byte[] ip) { long m = 0; int r; // 比较第一个ip项 readIP(ipBegin, b4); r = compareIP(ip, b4); if (r == 0) return ipBegin; else if (r < 0) return -1; // 开始二分搜索 for (long i = ipBegin, j = ipEnd; i < j;) { m = getMiddleOffset(i, j); readIP(m, b4); r = compareIP(ip, b4); ...
7
private void addWall (String id, double magnitude, double exponent) { final double WALL_MARGIN = 10; final double WALL_THICKNESS = 10; final double WALL_WIDTH = DISPLAY_WIDTH - WALL_MARGIN * 2 + WALL_THICKNESS; final double WALL_HEIGHT = DISPLAY_HEIGHT - WALL_MARGIN * 2 + WALL_THICKNESS;...
4
@Test public void testNNMany () { int numRects = 100000; List<Rectangle2D> rects = new ArrayList<Rectangle2D> (numRects); for (int i = 0; i < numRects; i++) rects.add (new Rectangle2D.Double (i * 10, i * 10, 10, 10)); tree.load (rects); DistanceCalculator<Rectangle2D> dc = new RectDistance (); DistanceR...
4
public boolean saveConfig(){ config.delete(); try { if(config.createNewFile()){ FileWriter fstream = new FileWriter(config); BufferedWriter out = new BufferedWriter(fstream); out.write("// Anvil Configuration File\n\n"); out.write("// The number of Quick Launch files to keep track of.\n");...
8
private void makeLayout(DrawerUtil drawerUtil) { this.removeAll(); if (this.mdSettingConstraints != null) { GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 0; gbc.weighty = 0; gbc.gridx=0; g...
7
private void quickSort(int array[], int start, int end) { int i = start; // index of left-to-right scan int k = end; // index of right-to-left scan if (end - start >= 1) // check that there are at least two elements to so...
9
private void createImage(int w, int h) { if (w == 0 || h == 0) return; WritableRaster wr; if (cm instanceof IndexColorModel) wr = ((IndexColorModel)cm).createCompatibleWritableRaster(w, h); else wr = ((DirectColorModel)cm).createCompatibleWritableRaster(w, h); image = new BufferedImage(c...
7
public void move() { if (nextGlied != null) { nextGlied.move(); } this.x += getDirection().getX() * width; this.y += getDirection().getY() * height; }
1
public Main() { // Nimbus Look & Feel try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } ...
6
public Mapa(int i,int j,int k,int civi,int rocas) { //variables this.spawningRocas=rocas; this.i=i; this.j=j; this.k=k; this.civi=civi; this.distribucion=new Cubo[i][j][k]; int concentracion[][][]; //generar matriz de distribucion ...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Proprietario other = (Proprietario) obj; if (codigo == null) { if (other.codigo != null) return false; } else if (!codigo.equals(other.c...
6
void binarySearch(int[] array, int lowerbound, int upperbound, int key) { int position; // To start, find the subscript of the middle position. position = (lowerbound + upperbound) / 2; while ((array[position] != key) && (lowerbound <= upperbound)) { if (array[position] > k...
4
public static Stella_Object access_PLInstance_Slot_Value(PLInstance self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == GuiServer.SYM_GUI_SERVER_InstanceName) { if (setvalueP) { self.InstanceName = ((StringWrapper)(value)).wrapperValue; } else { value =...
6
public boolean membershipQueryOnSortedArr(int[] array, int key) { //sanity check on input arguments if(array == null || array.length == 0){ return false; } //sanity check on the array if (!validateArraySorted(array)) { return false; } ...
7
private Node getNextToExpand() { Integer bestCost = null; Node next = null; for (int i = 0; i < nodes.length; i++) for (int j = 0; j < nodes[i].length; j++) { Node nd = nodes[i][j]; if (nd != null && !nd.isVisited()) { if (nd.getCost() == null) continue; if (bestCost == null || bestCo...
7
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
public void geraSumario(ArrayList<Palavra> listaPalavras) { textoCompleto.append("</div>"); sumario.append("<div>"); char indice = 0; for (Palavra listaPalavra : listaPalavras) { if(!(listaPalavra.getInicial() == indice)) sumario.append("<h2>").ap...
3
void bite() { print("bite"); }
0
public static void visualize(Graphics g) { if (list == null) return; list.reset(); g.setColor(Color.red); while (list.hasNext()) { AngleInterval ai = list.getNext(); if ((int)ai.leftDist == 0 && (int)ai.rightDist == 0) continue; ...
4
@Override public boolean allowedThisManyValues(final int count) { if(count == 0 && !hasValue()) { return true; } else if(count == 1 && hasValue() && !isMultiValued()) { return true; } else if(isMultiValued() && hasExactCount()) { ...
9
@Override public void put(Key key, Value val) { if (val == null) { delete(key); return; } int i = rank(key); // key is already in table. Update if (i < N && key.compareTo(keys[i]) == 0) { vals[i] = val; return; } // insert new key-value pair if (N == keys.length) resize(keys.leng...
5
public boolean containsAnnotation(String annotation) { Annotation[] annotations = methodToCheck.getAnnotations(); for(Annotation ant : annotations) { if(annotationMatches(ant,annotation)) return true; } return false; }
2
public void onKeyReleased(KeyEvent e) { switch (e.getKeyCode()) { case VK_UP: case VK_W: case VK_DOWN: case VK_S: // Arrow up and down keys: move direction = stand still moveDirection = 0; moveAmount = 0; break; case VK_RIGHT: case VK_D: case VK_LEFT: case VK_A: // Arrow right and left...
8
public void resetNivel() { auxLeerNombre = true;// permite leer una vez el nombre del jugador //Antorchas antorcha1.setPosY(getHeight() + antorcha1.getAlto()); antorcha2.setPosY(getHeight() + antorcha2.getAlto()); puerta1.setPosY(getHeight() + puerta1.getAlto()); // in...
4
public static int[] getArrayDiff(int[] source, int[] result) { List<Integer> diff = new ArrayList<Integer>(); if (source.length != result.length) { throw new IllegalArgumentException( "The arrays need to have the same length"); } boolean[] diffs = new boolean[source.length]; Arrays.fill(diffs, false)...
9
public boolean handlePrivateMessage(Info info) { if( !NexusBot.isOwner(info.getSender() ) ) { return false; } String message = info.getMessage(); if( message.startsWith( "!join " ) ) { String login = message.substring( 6 ).trim(); ...
9
protected List<Entity> getEntitiesWithTag(String name) { entitysWithTagNames.clear(); for (Entity taggedEntity : taggedEntityList) { if (name.equals(taggedEntity.getComponent(NameTag.class).name)) { entitysWithTagNames.add(taggedEntity); } } return entitysWithTagNames; }
2
@SuppressWarnings("unchecked") private <T extends Annotation> T[] getParameterAnnotations(Class<T> annotationClass) { Annotation[][] paramAnnotations = method.getMethod().getParameterAnnotations(); T[] annotations = (T[]) Array.newInstance(annotationClass, paramAnnotations.length); ...
3
public void moveUnitsToHero() { if (!hero.isInCastle(this)) return; List<GroupOfUnits> toRemove = new ArrayList<GroupOfUnits>(); for (core.GroupOfUnits ug: garisson.getUnits()) { if (hero.getUnits().size() >= 6) return; boolean found = false; for (core.GroupOfUnits uh: hero.getUnits()) { if (ug.type...
6
private List<Triangle> read(BufferedReader reader) throws IOException { List<Vector3> vertices = new ArrayList<Vector3>(); List<Vector3> normals = new ArrayList<Vector3>(); List<Triangle> result = new ArrayList<Triangle>(); Vector3 triangleVertices[] = new Vector3[3]; ...
6
private void initialiseGrid() { int N = (int)(double)network.params.get("N"); int M = (int)(double)network.params.get("M"); IndividualNetworkAgent[][] vertices = new IndividualNetworkAgent[N][M]; for (int i = 0; i < N; i++) { for (int j = 0; j < M...
6
public void run() { try { while (!interrupted()) { Hash h; while ((h = pending.take()) != null) { handleQueue(h); } } } catch (InterruptedException e) { } finally { Hash h; while ((h = pending.poll()) != null) { handleQueue(h); } if (writeQueue.size() > 0) { ...
5
protected Instances determineOutputFormat(Instances inputFormat) throws Exception { Instances data; Instances result; FastVector atts; FastVector values; HashSet hash; int i; int n; boolean isDate; Instance inst; Vector sorted; m_Cols.setUpper(inputFormat.numAt...
9
public String toString() { return type + " - " + (type == RENAME ? oldName + "," + newName : name); }
1
@EventHandler public void onPlayerJoin(PlayerJoinEvent event) { if (bounties) { int unclaimedHeads = 0; try { unclaimedHeads = dsi.getNumUnclaimedHeads(event.getPlayer().getName()); } catch (DataStorageException e) { getLogger().log(Level.S...
4
public int evaluate(Card[] hand) { long product = 1; for (int i = 0; i < 6; i++) { int prime = FiveCardEvaluator.primes[hand[i].rank.ordinal()]; product *= prime; } //System.out.println(ranks); int rank = ranks.get(product); // Look for flushes for (int i = 0; i < 4; i++) lengths[i] = 0; ...
7
public boolean addProduct(String title, int count, double price) { if (title.isEmpty()) return false; if (count <= 0) return false; if (price <= 0) return false; if (taxes.length > 4) return false; Product product = new Prod...
4
protected static boolean isOpusSpecial(OggPacket packet) { byte[] d = packet.getData(); // Is it an Opus Header or Tags packet? if (d.length < 12) return false; if (IOUtils.byteRangeMatches(MAGIC_HEADER_BYTES, d, 0)) return true; if (IOUtils.byteRangeMatches(MAGIC_TAGS_BYTES, ...
3
@SuppressWarnings("unchecked") public Map<MarketClockField, String> getMarketClockPaths(Document doc) throws UtilityException { Map<MarketClockField, String> toReturn = new HashMap<MarketClockField, String>(); for (MarketClockField f : MarketClockField.values()) { String path = f.getPath(); if (f.equals(M...
6
@Override public void removeClientConnectEventListener(ConnectListener listener) { connectEventListenerList.remove(ConnectListener.class, listener); }
0
private void insertInOpened(List < AState > opened, AState state) { if(!opened.isEmpty()) { for(int i = 0; i < opened.size(); i++) { if(opened.get(i).getF() > state.getF()) { opened.add(i, state); return; } else if (opened.get(i).getF() == state.getF()) { if(state == this.t...
5
@Override public void finalize() throws SQLException { this.statement.close(); this.c.close(); }
0
private ContentObjectRelation getLowLevelTextObject(LowLevelTextContainer parent, LowLevelTextType type, String id) { if (parent == null) return null; //Iterate over all child text objects for (int i=0; i<parent.getTextObjectCount(); i++) { LowLevelTextObject obj = parent.getTextObject(i); //Is the ...
7
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (rotation % 2 == 1) { g.drawRect(50, 85, 100, 30); g.drawLine(0, 100, 50, 100); g.drawLine(150, 100, 200, 100); } if (rotation % 2 == 0) { g.drawRect(85, ...
3
public PersonBean getPersonInfo(String userid){ PersonBean person=null; ResultSet rs = null; Connection con = null; PreparedStatement ps = null; boolean result = true; try { String sql = "SELECT * FROM PERSON WHERE userid=(?)"; con = ConnectionPool.getConnectionFromPool(); ps = con.prepareStatem...
8
private static void insertMappingtables(DBConnection connection, List<ExtendedField> manyToMany, List<String> tables) throws SQLException { for (ExtendedField mapTab : manyToMany) { String mapTabName = mapTab.getMappingTable(); Column columnTabA = buildMappingColumn(DaoUtils...
4
public Course CourseDetail(long idcourse) throws SQLException { String query = ""; String query1 = ""; String query2 = ""; String query3 = ""; Course courseInfo = new Course(); List<Instructor> instructorInfo = new ArrayList<Instructor>(); int index = 0; long[] personid = null; try { query = "s...
8
public static void Gym() throws IOException{ int timeblock = 3; BufferedReader r = new BufferedReader (new InputStreamReader(System.in)); while (timeblock > 0){ System.out.println("Damon is at the Gym. What exercise would Damon like to do?"); { System.out.println("1. Bench"); System.out.printl...
5
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
protected void calcDIR_CrtTimeTenth() { byte[] bTemp = new byte[1]; for (int i = 13;i < 14; i++) { bTemp[i-13] = bytesOfFAT32Element[i]; } DIR_CrtTimeTenth = byteArrayToInt(bTemp); }
1
public static Hand findHighestFlushOrStraight(Set<Card> cardSet) { List<Card> flushCards = getAllFlushCards(cardSet); if (flushCards != null) { Suit suit = flushCards.get(0).suit; // If we find straight with flush cards, we have a straight flush Hand sfHand = findHighestStraight(new HashSet<Card>(flushCard...
2
public boolean exist(char[][] board, String word) { if (board == null || board.length == 0 || word == null) return false; this.board = board; this.word = word; for (int i=0; i<board.length; i++) { for (int j=0; j<board[0].length; j++) { boo...
7
public void onDrop(final PlayerDropItemEvent event, String flag) { final FileConfiguration configFile = pCops.getPlugin().getConfig(); StringBuilder equipmentPath = new StringBuilder("equipment."); equipmentPath.append(flag); equipmentPath.append(".items"); List<String> equipmentItems = configFile.getStri...
6
public Map<String, Integer> getExtensionFrequency(){ Map<String, Integer> map = new HashMap<String, Integer>(); for(Record record : log.getRecords()){ String extension = record.getRequest().getUrl().getExtension().getExtension(); Integer number = map.get(extension); if(number != null){ map.remove(ex...
2
@Override public int compareTo(Color o) { if (r != o.r) return (r < o.r ? -1 : 1); if (g != o.g) return (g < o.g ? -1 : 1); if (b != o.b) return (b < o.b ? -1 : 1); return 0; }
6
private boolean clearLineIfFull(int lineN) { Block[] line = rows[lineN]; if (isLineFull(line)) { for (int i = 0; i < line.length; i++) { line[i] = null; } moveLinesDown(lineN); return true; } return false; }
2
public JPanel getTextInputAndSendPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); inputField = new JTextField(); inputField.setEnabled(false); /* * Key Listener to grab when user Hits Enter: */ inputField.addKeyListener(new KeyListener() { @Override public void key...
3
public static StoryboardAction findStoryboardActionById(ArrayList<StoryboardAction> storyboardactions, int id) { for(StoryboardAction storyboardaction:storyboardactions) { if(storyboardaction.getId()==id) { return storyboardaction; } } return new StoryboardAction(); }
2
public static String wrapToPixelWidth(Font font, String text, int width) { int[] lineWidth = { 0 }; StringBuilder buffer = new StringBuilder(text.length() * 2); StringBuilder lineBuffer = new StringBuilder(text.length()); StringTokenizer tokenizer = new StringTokenizer(text + NEWLINE, " \t/\\\n", true); //$NON-...
7
@Override public void run() { running = true; while (true) { try { switch (functionStep) { case ONE: { long[] values = stepOneQueue.take(); step...
9
public void put(int hash, Object o) { if (size++ > threshold) grow(); modCount++; int slot = Math.abs(hash % buckets.length); // /#ifdef JDK12 Bucket b = new Bucket(o, queue); // /#else // / Bucket b = new Bucket(o); // /#endif b.hash = hash; b.next = buckets[slot]; buckets[slot] = b; }
1
public void visitReturnExprStmt(final ReturnExprStmt stmt) { print("return "); if (stmt.expr() != null) { stmt.expr().visit(this); } println(" caught by " + stmt.catchTargets()); }
1
public int getAmountOf(String type) throws SQLException { ArrayList<String> list = getCoupons(); int item = 0; int econ = 0; int rank = 0; int xp = 0; for (String name : list) { Coupon c = getBasicCoupon(name); if (c instanceof ItemCoupon) item++; if (c instanceof EconomyCoupon) econ++; if (c...
9
@Override public int wordCount() { int count = 1; if(valueA.hasNextWord()) count++; if(opcode.isBasic() && valueB.hasNextWord()) count++; return count; }
3
private void run() { int frames = 0; double unprocessedSeconds = 0; long lastTime = System.nanoTime(); double secondsPerTick = 1 / 60.0; int tickCount = 0; while (true) { if (focused) { long now = System.nanoTime(); long passedTime = now - lastTime; ...
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setAttribute("errors","Ошибка базы данных"); try{ List<Category> cats = Factory.getInstanc...
1
private Type parse(String sig) { this.sig = sig; sigp = 0; List<TypeParamType> typeParamTypes = null; if (sig.charAt(sigp) == '<') typeParamTypes = parseTypeParamTypes(); if (sig.charAt(sigp) == '(') { List<Type> paramTypes = parseTypeSignatures(')'); ...
9
public void update() { // removes used items for (int i = 0; i < items.size(); i++) { if (items.get(i) != null && !inventory.contains(items.get(i))) { items.remove(i); this.remove(i); i--; } } // adds blank items for (int i = items.size(); i < MAX_ITEMS; i++) { items.add(null); this.ad...
8
public static void selectLeftText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; int currentPosition = textArea.getCaretPosition(); if (currentPosition == 0) { return; } // Update Preferred Caret Position int newCaretPosition = cur...
2
protected Error getErrorCode () { if ( error.equals( "Method Not Allowed" ) ) { return Error.METHOD_NOT_ALLOWED; } else if ( error.equals( "Not Found" ) ) { return Error.NOT_FOUND; } else if ( error.equals( "ForbiddenOperationException" ) ) { ...
6
public void setPosition (String name) { if (Global.getParameter(name + ".maximized", false)) { setExtendedState(Frame.MAXIMIZED_BOTH); return; } Point l = getLocation(); Dimension d = getSize(); Dimension dscreen = getToolkit().getScreenSize(); int x = Global.getParameter(name + ".x", l.x); int y...
7
public void calculateFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); ...
7
@Override public int getBookingsCount() throws ConnectException { if (this.dbConnection == null) { connectToDB(this.dbFileName); } if(this.dbConnection != null) { String query = "SELECT COUNT(ID) FROM Bookings"; ResultSet resultSet = executeQuery(query); if(resultSet != null) { try { return ...
6
@Model private void cleanDeadObjects() { for (GameObject obj : this.getGameObjects()) { if (obj instanceof Projectile && obj != this.getLivingProjectile()) { this.gameObjList.remove(obj); } else if (!obj.isAlive() || !this.liesWithinBoundaries(obj)) { this.gameObjList.remove(obj); if(obj == this.ge...
6
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("CLAN"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("CLAN"); return ""; }...
8
public static Class<?>[] evalToTypes(Object... args) { Class<?>[] types = new Class[args.length]; int i = 0; for (Object arg : args) { types[i++] = null == arg ? Object.class : arg.getClass(); } return types; }
4
@Override public void save() throws DataSaveFailedException { super.save(); getSection().set("groups", groups); }
0
public CheckResultMessage check31(int day) { return checkReport.check31(day); }
0
private String printSection(Section section, int lvl) { Line selectedLine = this.getSelectedLine(); StringBuilder printed = new StringBuilder(); for (int i = 0; i < lvl; i++) { printed.append("*"); } if (section.getTitle().getLine().equals(selectedLine)) { printed.append(new StringBuilder(section.getTit...
8
public Point getCentroid(){ return centroid; }
0
private void addBoxes() { while(boxes.size() < nHW) { Box newBox = new HeavyWeight(System.currentTimeMillis()); if( !overlaps(newBox) ) boxes.add(newBox); } while(boxes.size() < nHW+nWH) { Box newBox = new WhiteHole(System.currentTimeMillis()); if( !overlaps(newBox) ) boxes.add(newBox); } ...
6
@Override public void update(String dataBaseName, String tableName, ArrayList<Field> entries, Field entry) { // get the array of col from load XMLParser obj = new XMLParser(); ArrayList<Col>table=obj.load(dataBaseName, tableName); // ArrayList<Col> table = intialize(); if(table==null)return; ...
5
@Override public double membership(double x) { if (Double.isNaN(x)) { return Double.NaN; } if (Op.isEq(start, end)) { return 0.0; } if (Op.isLt(start, end)) { if (Op.isLE(x, start)) { return 0.0; } ...
7
public void addPiece(int[][] piece,Point corner) { score+=6; for (int i=0;i<piece.length;i++) { for (int j=0;j<piece[i].length;j++) { int bx=corner.getX()+i; //row int by=corner.getY()+j; //col boolean xInRange=!(bx >= board.length || bx < 0); boolean yInRange=!(by < 0 || by >= board[0].len...
7
public String getAsString(FacesContext ctx, UIComponent component, Object value) { if (value != null && !"".equals(value)) { BaseEntity entity = (BaseEntity) value; // adiciona item como atributo do componente this.addAttribute(component, en...
3
private boolean unsetPossibleValueForSquare(int possibleValueToRemove, int squareIndex, int rowIndex, int colIndex){ boolean modified = false; for (int i = getSquareTopCoordinate(squareIndex).getRowIndex(); i <= getSquareEndCoordinate(squareIndex).getRowIndex(); i++) { for (int j = getSquareTopCoordinate(squareI...
8
private boolean readZipFile(String flName) throws IOException { boolean success = false; ZipFile zipFile = null; try { BufferedReader reader = null; // ZipFile offers an Enumeration of all the files in the file zipFile = new ZipFile(flName); Enumeration<? extends ZipEntry> ...
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PackageMeta other = (PackageMeta) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return ...
6
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(this) ||((msg.tool()==this)&&(msg.target()==container())&&(container()!=null))) &&((getCageFlagsBitmap()&CagedAnimal.CAGEFLAG_TO_MOB_PROGRAMMATICALLY)==0) &&((msg.targetMinor()==CMMsg.TYP_GET)||(msg.targetMinor(...
9