text
stringlengths
14
410k
label
int32
0
9
public MusicGroup asSchemaOrg(boolean showAction, boolean showChildren) { MusicGroup musicGroup = new MusicGroupImpl("http://jarekandshawnmusic.com/artist/" + id.getName()); if (getName() != null) { musicGroup.setName(getName()); } try { musicGroup.setUrl(new URI("/artist/" + id.getName())); ...
8
private void mergeBlock(int[] listA, int[] listB, int[] listC, int blockOffset, int blockSize) { int a = blockOffset * blockSize; int b = a; int c = blockOffset / 2 * 2 * blockSize; int nextOffset = (blockOffset + 1) * blockSize; while (a < nextOffset && b < nextOffset && a < listA.length && b < listB...
9
@Override public void fill(Parameter parameter, Type type, Annotation[] annotations) { for (Annotation annotation : annotations) { if (annotation instanceof Desc) { parameter.offer(Properties.DESCRIPTION, ((Desc)annotation).value()); return...
2
public void popEntries(int numberToRemove) { for (int i = 0; i < numberToRemove; i++) { Binder b = symbols.get(top); if (b.getTail() != null) { symbols.put(top, b.getTail()); } else { symbols.remove(top); } top = b.getPr...
2
public Result ValidarCampo(Clientes BEEntidades){ // Nombre, ApellidosPaterno, ApellidoMaterno, Email, NroDocumento, Telefono sb.append(Common.IsNullOrEmpty(BEEntidades.getNombre())? "nombre inválido,": ""); sb.append(Common.IsNullOrEmpty(BEEntidades.getApellidoPaterno())? "nombre inválido,"...
7
public N getEnclosingNetwork(int mask) throws NetworkException { if ((mask < 0) || (mask > 1)) { throw new InvalidAddressException(String.format("'%d' is not a valid netmask.", mask)); } if (mask > longMaskToShort(this.mask)) { throw new InvalidAddressException(String.for...
3
private void addPieces() { for(int x = 0 ; x< 8 ; x++) { Pawn whitePawn = new Pawn(true, new Point(x,1),this); Pawn blackPawn = new Pawn(false, new Point(x,6),this); Piece strongBlack=null; Piece strongWhite = null; if(x==0||x==7) { strongWhite = new Rook(true,new Point(x,0),this); str...
9
public static DBObject toDBObject(String query, Object... parameters) { String finalQuery = generateQuery(query, parameters); try { return (DBObject) JSON.parse(finalQuery); } catch (Exception e) { throw new IllegalMongoShellException("Mongo Query表达式式非法:", e); } }
1
public String CreateDiffFiles(DatabaseAccess JavaDBAccess, String TargetPHPFileSelectedComboBox) { String PHPFileTextArea = null; Connection conn = null; PreparedStatement ps = null; String diffFile = ""; try { if ((conn = JavaDBAccess.setConn()) != null) { ...
7
@Override public boolean moveable(Direction direction) { if (direction == null) return false; if (!direction.getDirectionsExcludeDiagonal().contains(direction)) return false; if (lifetime <= 0) return false; return true; }
3
@Override public Item getSelectedItem() { for( Item item : getItems() ) { if( item.isPrimarySelected() ) { return item; } } return null; }
2
public void setId(int id) { this.id = id; }
0
public static void triangle2(String s) { char c[] = s.toCharArray(); for (int i = 0; i < c.length; i++) { System.out.println(); for (int j = 0; j < (c.length - i); j++) { System.out.print(c[j]); } } }
2
public boolean exist(char[][] board, String word) { Stack<Character> stack = new Stack<Character>(); for(int i=word.length();i<0;i--){ stack.push( word.charAt(i) ); } boolean [][] used = new boolean[board.length][board[0].length]; //char[] wc = word.toCharArray(); //char[] tmpc = new char[wc.length]; ...
8
private float phraseFreq() throws IOException { if (!initPhrasePositions()) { return 0.0f; } float freq = 0.0f; numMatches = 0; PhrasePositions pp = pq.pop(); int matchLength = end - pp.position; int next = pq.top().position; while (advancePP(pp)) { if (hasRpts && !advanceRp...
9
public void setPayments(){ desktopPane.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR)); try { try { tableModelDay.clear(); listPaymentDay.clear(); List<PaymentModel> input = new PaymentDAO().getPaymentDay(ut.dateFormatInsertSq...
9
public static QuantCvTermReference getIsotopeLabellingMethodParam(String accession) { if (ITRAQ_QUANTIFIED.getAccession().equals(accession)) { return ITRAQ_QUANTIFIED; } else if (TMT_QUANTIFIED.getAccession().equals(accession)) { return TMT_QUANTIFIED; } else if (O18_QUA...
7
final boolean method2668(int i) { anInt4208++; if (aBoolean4205) return true; if (aClass144_4201 == null) { try { int i_15_ = (Class8.modeWhere == Class55_Sub1.aClass364_5271 ? 80 : 7000 - -(((ConnectionMode) Class135_Sub2.worldConnectionNode) .portOffset)); aClass144_4201 = ...
9
public float get(int dimension) { switch (dimension) { case 0: return x; case 1: return y; case 2: return z; default: return -1; } }
3
public boolean equalsExpr(final Expr other) { return (other instanceof ZeroCheckExpr) && super.equalsExpr(other); }
1
public String getEmployer(int ID) { try { int employerID = ID; if(employerID > 0) { if(employerID < ReadFromFile.getNumberFromFile("company.txt")) { Company [] checkEmployers = ReadFromFile.findAllCompanyData(); return checkEmployers[employerID-1].getName(); } } } catch(NumberFormatExc...
3
public ComplexMatrix getLocalPropagationMatrix(int index, double energy) { MatterInterval inl = intervals.get(index); MatterInterval next = intervals.get(index + 1); Complex p; // Double.POSITIVE_INFINITY is handled here and it assigns to // real part // of Complex if app...
2
public static void main(String[] args) { if (args.length > 0) { try{ int port = Integer.parseInt(args[0]); if (port > 65535 || port < 1) { System.out.println("Invalid port number... starting as default 2222"); new ServerHandler...
4
@Override public void run() { long lastTime = System.nanoTime(); long timer = System.currentTimeMillis(); final double ns = 1000000000D / 60; double delta = 0; int frames = 0; int updates = 0; requestFocus(); while (running) { long now = System.nanoTime(); delta += (now - lastTime) / ns; last...
3
public static double[] toHSL(int r, int g, int b) { double rp = r; double gp = g; double bp = b; rp /= 255; gp /= 255; bp /= 255; double cmax = Math.max(rp, Math.max(gp, bp)); double cmin = Math.min(rp, Math.min(gp, bp)); double delta = cmax - cmin...
3
public void draw(Graphics g) { //g.setColor(needsHighlight() ? selectColor : lightGrayColor); g.setColor(needsHighlight() ? selectColor : Color.GRAY); setBbox(x, y, x2, y2); if (x < x2 && y < y2) { g.fillRect(x, y, x2 - x, y2 - y); } else if (x > x2 && y < y2) { ...
7
@SuppressWarnings("nls") public static void openURL(String url) { String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class<?> fileMgr = Class.forName("com.apple.eio.FileManager"); Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class ...
8
private void setDictionary(Dictionary dic) { this.dic = dic; dic.addDictionaryListener(new DictionaryListener() { public void recieveEvent(DictionaryEvent event) { changed = true; } }); dic.addDictionaryListener(new DictionaryListener() { public void recieveEvent(DictionaryEvent event) { swi...
4
public void displayAtIndex(int index) { if (index >= 1 && index <= numItems) { String book = bookArray[index -1]; System.out.print(book); } else { System.out.println("The index you specified is out of range"); } }
2
public void CalcNormals() { for(int i = 0; i < m_indices.size(); i += 3) { int i0 = m_indices.get(i); int i1 = m_indices.get(i + 1); int i2 = m_indices.get(i + 2); Vector3f v1 = m_positions.get(i1).Sub(m_positions.get(i0)); Vector3f v2 = m_positions.get(i2).Sub(m_positions.get(i0)); Vector3f no...
2
public void actionPerformed(ActionEvent ae) { double x = 0.0, y = 0.0; Double d; try { d = new Double(eastings.getText()); x = d.doubleValue(); } catch (NumberFormatException nfe) { eastings.setText("0"); x = 0.0; } try { d = new Double(northings.getText()); y = d.doubleValue(); } catc...
4
final public void PowerExpression() throws ParseException { UnaryExpressionNotPlusMinus(); switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case POWER: ASTFunNode jjtn001 = new ASTFunNode(JJTFUNNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); try { jj_consume_token(POWER); UnaryExpre...
7
@BeforeClass public static void setUpBeforeClass() { try { new MySQLConnection(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e...
5
public void selectMarker(int index) { //markerRect.select(index); }
0
private String argDigest() { if (argsSpecified) { if (argNames.isEmpty()) return ""; StringBuilder b = new StringBuilder(); List<String> list = new ArrayList<String>(argNames.keySet()); for (int i = 0; i < list.size(); i++) { String name = list.get(i); b.append(" <").append(name).append('>'); ...
9
public List<Integer> getValues() { List<Integer> valuesArray = new ArrayList<Integer>(); iter = bucket.iterator(); while(iter.hasNext()) { valuesArray.add(iter.next().getValue()); } return valuesArray; }
1
@Override public List<BaseArtifactType> queryFullArtifacts(String query) throws Exception { String path = "/s-ramp?query=" + query; List<BaseArtifactType> artifacts = new ArrayList<BaseArtifactType>(); Feed feed = getFeed(path, 200); for (Entry entry : feed.getEntries()) { ...
3
private Map<String, List<String>> getMessageToPartMap( Element documentElement, WsdlSchema retSchema) { Map<String, List<String>> retMap = new HashMap<String, List<String>>(); List<SchemaElement> messages = getElements(documentElement, "wsdl:message", false, null, retSchema); if (messages != null) { for...
5
public void processLine(String line) { StringTokenizer s = new StringTokenizer(line); while (s.hasMoreTokens()) { String currWord = s.nextToken(); double currScore = getWordScore(currWord.toLowerCase()); if (maxScore < currScore) { maxScore = currScore; maxWord = currWord; maxLineCount = count...
2
public String getToolTip() { return "Building Block Creator"; }
0
public boolean containsID(int id) { return (first_land.getID() == id || second_land.getID() == id); }
1
public boolean processDataOut(APDU apdu) { if (selectingApplet()) return false; //allow other Services to postprocess if needed if (mode == ENCRYPT_NONE) { return false; } if (mode == SYMMETRIC_REQUEST) { mode = ENCRYPT_SYMMETRIC; return false; } if(mode == ASYMMETRIC_REQUEST) { mode = ENCRYP...
8
public static void main(String[] args) { Scanner inFile = null; try { // Create a scanner to read the file, file name is parameter inFile = new Scanner(new File(System.getProperty("user.dir") + "/src/Files/prog464a.dat")); } catch (FileNotFoundException e) { System.out.println("File not found!"); // ...
6
@Ignore @Test public void placeFiguresOnBoard() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(KING.toString(), 2); figureQuantityMap.put(QUEEN.toString(), 3); figureQuantityMap.put(BISHOP.toString(), 4); figureQuantityMap.put(ROOK.toStr...
5
* @param height The height of the grid array * @param d The dimension of the initial drawing area */ protected void initGrid(int width, int height, Dimension d) { if ( (width > MAX_GRID_X) || (height > MAX_GRID_Y) ){ throw new IllegalStateException ( ); // hack bf //return; } int i, j...
9
public long set(long millis, int value) { int[] wwd = iChronology.isoFromMillis(millis); millis = iChronology.getTimeOnlyMillis(millis) + iChronology.millisFromISO(value, wwd[1], wwd[2]); if (wwd[1] == 53) { int[] wwd2 = iChronology.isoFromMillis(millis); if (...
2
public Object whoIsRight(Object a, Object b) { Random r = new Random(); if(r.nextBoolean()) { return a; } return b; }
1
@SuppressWarnings("resource") public ArrayList<String> getAllClasses(String jarFile, String superclassName) throws FileNotFoundException, IOException, ClassNotFoundException { ArrayList<String> list = new ArrayList<>(); JarInputStream jar = new JarInputStream(new FileInputStream(jarFile)); JarEntry entry; ...
8
private void update() { final ThreadMXBean bean = ManagementFactory.getThreadMXBean(); final long[] ids = bean.getAllThreadIds(); for (long id : ids) { if (id == getId()) { continue; } final long cpuTime =...
6
@SuppressWarnings("unchecked") @Test public void testThisWeek() { SimpleValidator simpleValidator = new SimpleValidator(); DateRangeBean bean; Set<?> validations; for (int days = -2007; days <= -7; days += 100) { bean = new DateRangeBean(); bean.setDate8(util.add(new Date(), Calendar.DAY_OF_MONTH, days...
8
public void testPropertyCompareToMilli() { TimeOfDay test1 = new TimeOfDay(TEST_TIME1); TimeOfDay test2 = new TimeOfDay(TEST_TIME2); assertEquals(true, test1.millisOfSecond().compareTo(test2) < 0); assertEquals(true, test2.millisOfSecond().compareTo(test1) > 0); assertEquals(true...
2
public int[][] naiveMultiplication(final int[][] X, final int[][] Y) { try { int[][] result = new int[X.length][Y[0].length]; // for each rwo of X for (int i = 0; i < X.length; ++i) { if (X[i].length == Y.length) { // for each column of Y ...
5
private int findIndex(int key) { int[] keys = this.keys; if (keys != null) { int fraction = key * A; int index = fraction >>> (32 - power); int entry = keys[index]; if (entry == key) { return index; } if (entry != EMPTY) { // Se...
7
private void run() { // repita ate que a lista de algum homem esteja vazia ou todos estejam casados while(!someManListEmpty() && !everyoneEngaged()) { boolean existFreeMan = true; // enquanto existir homem solteiro while(existFreeMan) { Person currentMan = existFreeMan(); if(currentMan != null && c...
9
public static boolean isSafeMaterial(Material mat) { switch (mat) { case AIR: case WEB: case VINE: case SNOW: case LONG_GRASS: case DEAD_BUSH: case SAPLING: return true; default: return false; } }
7
public Diamant(Rectangle masse, IntHolder unit, int points) { super(masse, unit); this.points = points; }
0
private void tryCreateAmbits() throws IOException { if (wordIndex == null) { return; } Map meetings = wordIndex.getMeetings(); if (meetings == null) { return; } for (int file : wordIndex.getMeetings().keySet()) { RendezVous rv = wordInd...
4
private double[] calculateHDDConsumptionW(Component component, HardwareAlternative hardwareAlternative) { double consumption[] = { 0, -1 }; for (HardwareComponent hdd : hardwareAlternative.getHardwareComponents()) { double temp[] = Utils.consumptionHDD((Hdd) hdd, component.getUsageHDD()); if (temp[1] != -1 &&...
4
public int[] recorderOddEven(int[] data){ if(data == null){ throw new IncompatibleClassChangeError("Error input array."); } int odd = 0 , even = data.length - 1; while(odd < even){ while(odd < even && isOdd(data[odd])){ odd++; } while(odd < even && !isOdd(data[even])){ even--; } if(odd...
7
public String cadastrar() { if (!nome.isEmpty() && dataNasc != null) { PacienteDAO paciente = new PacienteDAO(null, nome, dataNasc, logradouro, numero, bairro, cidade, uf); FacesContext contexto = FacesContext.getCurrentInstance(); if (paciente.cadastrar()) { ...
3
private void UpdateTotal() { double taxes, finalTotal; taxes = 0.00; finalTotal = 0.00; pizzaTotal = 0.00; /* * check to see which radio button is checked */ if (rdbtnSmallPizza.isSelected()) { pizzaTotal = 8; } else if (rdbtnMediumPizza.isSelected()) { pizzaTotal = 10; } else if (rdbtnLarge...
6
public void moveBackward() { // as long as I'm on the board and visible... if (onBoard) { // get the direction of the sprite to find what is foreward; int dir = image.getDirection(); // now check to see which way to move switch (dir) { cas...
9
public Point[] generateGhostBlockCoordinates() { Point[] ghostBlockCoordinates = new Point[4]; int verticalDistance = boardSizeY - 1; for (Block b : currentTetromino.getBlocks()) { int y = -1; while ((b.getMapIndexY() + y < boardSizeY - 1) && tetrisMap[b.getMapIndexX()][b.getMapIndexY() + y + 2] != 1)...
5
public static void main(String args[]) { int number_of_duels = 10; String cowboy1 = ""; String cowboy2 = ""; if (args.length < 2) { System.err.println("Gotta choose two cowboys, brother."); } else if (args.length < 3) { if (args[0] instanceof String) { ...
8
public User loadUser(String login, String pwd) throws ProfileExceptions { User loadedUser = null; try { String defaultPath = new File("").getAbsolutePath().toString() + mainStructure; DirectoryStream<Path> stream = Files.newDirectoryStream(FileSystems.getDefault().getP...
6
@Override public List<Joueur> findAll() { List<Joueur> listJ = new ArrayList<Joueur>(); Statement st = null; ResultSet rs = null; try { st = this.connect().createStatement(); rs = st.executeQuery("select * from Joueur"); System.out.println("recherc...
5
public Collection<Artist> getCoreMembers() { Set<Artist> coreMembers = new TreeSet<Artist>(); boolean first = true; for (LineUp lineUp : getLineUps()) if (first) { // Add all the artists coreMembers.addAll(lineUp.getArtists()); first = false; } else { Collection<Artist> toRemove =...
4
public void addUnit(int x, int y, int type, int mov, int team) { if(inMap(x, y) && map.getUnit(x, y) == null) //Make sure adding unit within map grid, and that there is no unit currently there { Unit temp = new Unit(x, y, im, mov, team); map.addUnit(x, y, temp); u...
2
public static void drawCircle(Circle circle, WritableRaster imgRaster) { double perimeter = circle.getPerimeter(); double angleIncrement = Constants.TWO_PI/perimeter; int width = imgRaster.getWidth(); int height = imgRaster.getHeight(); for(double angle = 0.; angle < Constants.TWO_PI; angle += angleIncre...
5
public void criarDep(Departamento DEP) throws SQLException, excecaoDepartamento, excecaoCodDepartamentoInavlido { DepartamentoDAO depDAO = new DepartamentoDAO(); Departamento DepExistente = null; DepExistente = depDAO.selecDepartamento(DEP.getNome(), DEP.getCodigo()); if (DepExistente...
2
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; UserBean other = (UserBean) obj; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other....
9
private static Zombie chooseZombie(Necromancer player, int zombieIndex) { Zombie[] zombies = player.getZombies(); Zombie zombie; if (zombieIndex > -1 && zombieIndex < zombies.length && zombies[zombieIndex] != null) { zombie = zombies[zombieIndex]; } else { zombie = zombies[0]; } return zom...
3
private void readValues(Stream stream) { do { int j = stream.readUnsignedByte(); if(j == 0) return; if(j == 1) { anInt648 = stream.readUnsignedWord(); anInt649 = stream.readUnsignedByte(); anInt650 = stream.readUnsignedByte(); } else if(j == 10) stream.readString(); else ...
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS...
9
@Override public boolean execute(final CommandSender sender, final String[] split) { if (sender instanceof Player) { if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) { if (!MonsterIRC.getHandleManager().getPermissionsHandler() .hasCommand...
4
public void mouseMoved(MouseEvent e) { if (!e.isConsumed() && handles != null) { int index = getIndexAt(e.getX(), e.getY()); if (index >= 0 && isHandleEnabled(index)) { Cursor cursor = getCursor(e, index); if (cursor != null) { graphComponent.getGraphControl().setCursor(cursor); e....
5
direction bNNIEdgeTest( edge e, double[][] A, double[] weight, int wPos ) { edge f; double D_LR, D_LU, D_LD, D_RD, D_RU, D_DU; double w1,w2,w0; if ( e.tail.leaf() || e.head.leaf() ) return direction.NONE; f = e.siblingEdge(); D_LR = A[e.head.leftEdge.head.index][e.head.rightEdge.head.inde...
5
public boolean isIntersecting(Vector3f origin, Vector3f direction) { Vector3f delta = verticies.get(0).coord.minus(origin); // Find the time when they intersect float t = normal.dotProduct(direction); if (t <= 0) // don't divide by zero or intersect with the back of objects ...
4
@Override public int getCharThinSortCode(String codeName, boolean loose) { int x=CMParms.indexOf(CHAR_THIN_SORT_CODES,codeName); if(x<0) x=CMParms.indexOf(CHAR_THIN_SORT_CODES2,codeName); if(!loose) return x; if(x<0) { for(int s=0;s<CHAR_THIN_SORT_CODES.length;s++) { if(CHAR_THIN_SORT_CODES[...
8
public void endElement(String uri, String localName, String qName) throws SAXException { switch (qName) { case "config": { configList.add(getConfig()); break; } case "population": { getConfig().setPopulation(Intege...
4
@Override public String getToolTipText(MouseEvent event) { Column column = mOwner.overColumn(event.getX()); if (column != null) { return column.getHeaderCell().getToolTipText(event, getColumnBounds(column), null, column); } return super.getToolTipText(event); }
1
public int IDgenerator(HttpServletRequest request, HttpServletResponse response,String Type) throws ServletException, java.io.IOException { int UserID=0; String query; String tablename; if(Type.equals("purchase")) { tablename="purchase_record"; } else tablename=Type;...
7
@Override protected void channelReadHttpObject(ChannelHandlerContext ctx, HttpObject msg) { switch (currentState) { case INITIAL: reaInitialResponse((HttpResponse) msg); break; case READING_CONTENT: readNextContent(ctx, msg); ...
3
public void paintComponent(Graphics gfx) { super.paintComponent(gfx); Graphics2D g = (Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setPaint(Color.blue); //Draw all the lines for(int i = 0; i ...
7
public void paintBackground() { // Graphics g = MainPanel.getInstance().getGraphics(); g.clearRect(0,0,MainPanel.getInstance().getWidth(),MainPanel.getInstance().getHeight()); g.setColor(Color.white); int pointX = 0; int pointY = 0; try { InputStream pathToFile...
4
static EnumSet<Content> parse(final String str) { final EnumSet<Content> set = EnumSet.noneOf(Content.class); if (!str.isEmpty()) { for (int i, j = 0; j >= 0;) { i = j; j = str.indexOf(',', i + 1); final String sub = j >= 0 ? str.substring(i, j++) : str.substring(i); set.add(Enum.valueOf(C...
3
public static void basicProcessingFormat(Object[] Fieldsin) { // %^_TRATAR_.” | %^I_TRATAR_INSERT.” //Field(0) = Nombre de instruccion //Field(s%3=0) = VariableComp1 = [X:|S:|C:|E:][N:|H:]NAME_op1 //Field(s%3=1) = operation = ',' ',,' //Field(s%3=2) = VariableComp2 = [X:|S:|C:|E...
3
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int sendID = Integer.parseInt(request.getParameter("senderID")); int receiverID = Integer.parseInt(request.getParameter("receiverID")); String confirm = request.getParameter("confirm_btn"); Str...
4
public Line localOptimize() { for (int i = 0; i < lines.size();) { Line optimizedLine = lines.get(i).localOptimize(); if (optimizedLine == null) { lines.remove(i); continue; } if (optimizedLine != lines.get(i)) lines.set(i, optimizedLine); if (optimizedLine instanceof Block) { ...
9
public double bonusAttaque(Territoire from, Territoire to) { return to.coutAttaque(this) == Double.POSITIVE_INFINITY ? Double.POSITIVE_INFINITY : 0; }
1
private static int countCombinations (long deadcards, int toprank, int botrank) { int topcount = 0; int botcount = 0; for (int s=0; s<4; s++) if ( (deadcards & (0x01L<<(toprank+13*s))) == 0) topcount++; if (botrank == -1) { switch (topcount) { case 2: return 1; ...
8
private void select() { if (currentChoice == 0) { gsm.setCharacter(GameStateManager.HEART); Print.say("Choosing heart"); gsm.setState(GameStateManager.GAME); } if (currentChoice == 1) { gsm.setCharacter(GameStateManager.BRAIN); Print.say("Choosing Brain"); gsm.setState(GameStateManager.GAME); ...
2
public boolean estInscrit(String login, char[] password) { ok = false; String mdp = ""; for (int i = 0; i < password.length; i++) { mdp += password[i]; } BufferedReader lecteurAvecBuffer = null; String ligne; try { lecteurAvecBuffer = new BufferedReader(new FileReader("file.txt")); while ((ligne ...
5
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int n=1,flag=0; Connection conn; //ResultSet rs1; //ResultSet rs2; Statement stmt; //Statement stmt1; PrintWriter out=response.getWriter(); response.setContentType("text/html"); try { ...
3
protected void initialise() { this.memory = new MemSpace((int) Math.pow(2.0D, this.addrBits)); for (int i = 0; i < this.addrBits; i++) { String name = "A" + i; this.pins.add(new InputPin(this.cntlBits + 1 + i, name)); } if (this.dataBits - (this.addrBits + this.cntlBits) == 0) { this.pins.add(new Pow...
7
private boolean dfs(char[][] board, int pos) { int n = board.length; if (pos == n*n) { return true; } int x = pos / n; int y = pos % n; if (board[x][y] == '.') { for (char c='1'; c<='9'; ++c) { board[...
6
public void autonomousPeriodic() { // Runs commands & stuff. Scheduler.getInstance().run(); }
0
private boolean isTwoPair(){ int rID=0; for (int i = 0; i < crds.size()-1; i++) { if(crds.get(i).getRankID()==crds.get(i+1).getRankID()){ System.out.println("matched "+crds.get(i+1).getRankID()); if(rID!=crds.get(i).getRankID()&& i>1){ System.out.println("two pair matched****************************...
4
public String getPath() { return assetPath; }
0
public void start() { ProcessBuilder builder = new ProcessBuilder(this.getExecutableName()); try { builder.redirectErrorStream(true); process = builder.start(); writer = new BufferedWriter(new OutputStreamWriter( process.getOutputStream())); OutputListener listener = new OutputListener(process, sil...
6