text
stringlengths
14
410k
label
int32
0
9
public Expression lookup( String name ) { if ( ! environment.containsKey(name) && this.parent == null ) { System.err.println("Error in DeferredSubst.lookup() looking up " + name + " - Unbound identifier!"); System.exit(1); } else if ( ! environment.containsKey(name) ) { ...
3
public void doWork() { Connection conn = null; ResultSet rs = null; try { conn = getConnection(dbUrl,properties); if(conn == null) throw new Exception("Failed to obtain connection!"); conn.setAutoCommit(true); // Setting isolation level to read uncommitted, since this is a sample applica...
8
@Override public void execute(CommandExecutor player, String[] args) { LevelHandler handler = player.getServer().getLevelHandler(); StringBuilder finalStr = new StringBuilder(); for(Level l : handler.getLevelList()) { finalStr.append(l.name); finalStr.append(", "); } player.sendMessage(finalStr.to...
1
public void savePlayerInventoryConfig() { if (playerInventoryConfig == null || playerInventoryConfigFile == null) { return; } try { getPlayerInventoryConfig().save(playerInventoryConfigFile); } catch (IOException ex) { this.getLogger().log(Level.SEVERE, "C...
3
public SensorGnomonEcho(Transform3D transform, double baseWidth, double axisLength, boolean enableLighting) { super() ; int FRONT = 0 ; int BACK = 1 ; int LEFT = 2 ; int RIGHT = 3 ; int TOP = 4 ; int BOTTOM = 5 ; Point3f[] axes = new Point3f[6] ; float length = (float)axisLength ...
9
public void mouseClicked(MouseEvent ev) { //récupération de la position de la souris final Point p = ev.getPoint(); /* Affiche la page d'accueil */ if (m.zoneAccueil.contains(p)) { System.out.println("ActionAccueil"); m.f.page.removeAll(); m.f.clearN...
9
void fill(char[][] board, int x, int y) { if (board[x][y] == 'X') { return; } Queue<int[]> Q = new LinkedList<>(); int[] pair = { x, y }; Q.offer(pair); while (!Q.isEmpty()) { int[] p = Q.poll(); if (board[p[0]][p[1]] == 'O') { board[p[0]][p[1]] = 'D'; if (p[0] - 1 >= 0) { int[] top = ...
7
@Override public void run() { try { while (true) { CalcState state = Main.workQueue.take(); CalcState returnState = work(state); Main.doneQueue.put(returnState); } } catch (InterruptedException ex) { Logger.getLogger...
2
public void showStorage(){ System.out.println("Total Balance : " + access(Accesscreate())); if(itemList.size() != 0){ System.out.println("List item : "); for(Item item : itemList){ System.out.println("item :" + item.toString()); } }else{ System.out.println("There is no item in list"); }...
2
public Dimension preferredLayoutSize(final Container parent) { Component c0, c1, c2, c3, c4, c5; synchronized (parent.getTreeLock()) { final Insets insets = parent.getInsets(); int componentIndex = 0; final int rowCount = this.rowHeights.length; for (int...
9
@Override public void process(Map<String, Object> jsonrpc2Params) throws Exception { if (method.equals(Constants.Method.GET_FORUM_CONTENT)) { getForumContent(jsonrpc2Params); } else if (method.equals(Constants.Method.GET_CATEGORY_CONTENT)) { getCategoryContent(jsonrpc2Params)...
5
public void buildAccount(int fn) throws IOException { FileReader fr = new FileReader(accDir+fn+".txt"); BufferedReader textReader = new BufferedReader(fr); int numberOfLines = 6; String[] textData = new String[numberOfLines]; for (int i = 0; i < numberOfLines; i++) { textDa...
1
protected void makeMove(int type,int stepX,int stepY){ switch(type){ // Swiping on x with going stepY up or down each time we end on a border case 0: if (x+stepX>(width-1)||x+stepX<0) y = (height+y+stepY)%(height); x = (width+x+stepX)%(width); break; case 1: // Swiping on y if (y+stepY>(heigh...
9
protected void paintScrollContentBorder(Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) { Insets bi = new Insets(0, 0, 0, 0); if (tabPane.getBorder() != null) { bi = tabPane.getBorder().getBorderInsets(tabPane); } if (tabPane.getTabPlacement() == ...
5
@Override public Command nextCommand() { if (thereIsAnUnreachedGoal()) { if (cabin.areDoorsOpened()) { return close(); } if (isNextGoalAbove()) { return up(); } else { return down(); } } ...
4
public static void main(String[] args) throws SlotException, NotUniqueException { // TODO get username password from command line? String username = "komodo"; String password = "komodomq51"; String filename = "komodo.dat"; Galaxy galaxy = null; UniverseGenerator ug = n...
8
public void applyTransformation(int frameId) { if (vertexSkin == null) return; if (frameId == -1) return; Animation animationFrame = Animation.forFrameId(frameId); if (animationFrame == null) return; Skins skins = animationFrame.animationSkins; vertexModifierX = 0; vertexModifierY = 0; vertexMo...
4
void installListeners() { styledText.addCaretListener(new CaretListener() { public void caretMoved(CaretEvent event) { updateStatusBar(); updateToolBar(); } }); styledText.addListener(SWT.MouseUp, new Listener() { public void handleEvent(Event event) { handleMouseUp(event); } }); style...
4
public final WTabPanel setOrientation(Orientation orientation) { if (this.orientation != orientation) { this.orientation = orientation; switch (orientation) { case TOP: ((FlowLayout) super.getLayoutManager()).setFlowType(FlowLayout.VERTICAL_FLOW); ...
5
void paintPalette(PaintEvent event) { GC gc = event.gc; gc.fillRectangle(paletteCanvas.getClientArea()); if (imageData.palette.isDirect) { // For a direct palette, display the masks. int y = py + 10; int xTab = 50; gc.drawString("rMsk", 10, y, true); gc.drawString(toHex4ByteString(imageData.palette...
3
public String getName() { if (longname != null && !longname.equals("")) return longname; return shortname; }
2
private void setupUpdater() { Updater updater = new Updater(this, 71125, this.getFile(), Updater.UpdateType.DEFAULT, true); Updater.UpdateResult result = updater.getResult(); switch (result) { case SUCCESS: // Success: The updater found an update, and has readied it to be // loaded the next time the ser...
9
public void setKeyReference(String value) { this.keyReference = value; }
0
@Override public int castingQuality(MOB mob, Physical target) { if((mob!=null)&&(target!=null)) { if(CMLib.flags().isSitting(mob)) return Ability.QUALITY_INDIFFERENT; if(!CMLib.flags().isAliveAwakeMobileUnbound(mob,false)) return Ability.QUALITY_INDIFFERENT; if(mob.isInCombat()&&(mob.rangeToTarge...
8
private InanimateEntity parseEntitiy(String[] values) { String name = values[0]; InanimateEntity item = null; if(name.equals(Entities.KEY.name())){ //Its a Key! parse its description and id item = new Key(parseDescription(2, values), Integer.parseInt(values[1])); }else if(name.equals(Entities.BAG.name())...
9
public String getNick() { return _nick; }
0
public int goodAxe() { for (int j = VALID_AXE.length - 1; j >= 0; j--) { if (c.playerEquipment[c.playerWeapon] == VALID_AXE[j]) { if (c.playerLevel[c.playerWoodcutting] >= AXE_REQS[j]) return VALID_AXE[j]; } } for (int i = 0; i < c.playerItems.length; i++) { for (int j = VALID_AXE.length - 1; ...
7
private boolean probabilityLogic(SudokuGrid grid) { boolean isPossible = true; boolean change = false; int i,j; while(isPossible) { isPossible = false; for(i=0;i<9;i++) { for(j=0;j<9;j++) { if(((boxProbability[i][j].xpectedNum).size()==1)&&(boxProbability[i][j].isFinal ==...
5
public void insertWriteThread() { System.out.println("Inserting write thread"); WritePropertiesThread writeThread = new WritePropertiesThread(); Future<?> future = ProtoThreadQueue.getInstance().addToQueue(writeThread, "write"+THREAD_NAME_COUNT++); try { System.out.println(fu...
3
public void leer_bc(String nombre) throws IOException { long ap_actual, ap_final; RandomAccessFile leer_archi = new RandomAccessFile(nombre, "r"); while ((ap_actual = leer_archi.getFilePointer()) != (ap_final = leer_archi.length())) { char etiqueta[] = new char[15], te...
4
public void tick() { if (!isLive()) { return; } if (weapon != null) { weapon.tick(); } if (dir == Direction.LEFT) { setX(getX() + (-speed)); } else if (dir == Direction.RIGHT) { setX(getX() + speed); } ...
4
@SuppressWarnings("deprecation") public void testConstructor_RP_RP_PeriodType3() throws Throwable { YearMonthDay dt1 = null; YearMonthDay dt2 = new YearMonthDay(2005, 7, 17); try { new Period(dt1, dt2, PeriodType.standard()); fail(); } catch (IllegalArgumentEx...
1
public void visitPhiCatchStmt(final PhiCatchStmt stmt) { if (stmt.target == from) { stmt.target = (LocalExpr) to; ((LocalExpr) to).setParent(stmt); } else { final ListIterator e = stmt.operands.listIterator(); while (e.hasNext()) { final LocalExpr expr = (LocalExpr) e.next(); if (expr == from)...
3
public int getAnimationFrames(int paramInt) { switch (paramInt) { case 0: default: return 1; case 1: return 6; case 2: } return 7; }
3
@Override public Tuple getNext() throws IOException { if (!activeNode) return null; while (!ready) { logger.info("GraphChi-Java running: waiting for graphchi-engine to finish: " + this.getStatusString()); PigStatusReporter.getInstance().setStatus(getStatusString()); ...
3
static Set<IndexHint> validate(Set<IndexHint> indexHints) { boolean hasUse = false; boolean hasForce = false; for (IndexHint indexHint : indexHints) { hasUse = hasUse || indexHint.getType() == IndexHint.Type.USE; hasForce = hasForce || indexHint.getType() == IndexHint.Type.FORCE; } if (h...
5
public Worker () { //initial settings isInputActive = true; isTimeSet1 = false; isTimeSet2 = false; this.keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
0
public PreCombatDialog(FreeColClient freeColClient, GUI gui, FreeColGameObject attacker, FreeColGameObject defender) { super(freeColClient, gui); CombatModel combatModel = attacker.getGame().getCombatModel(); Set<Modifier> offence = sortModi...
8
public boolean isTriangular(int[][] array) { boolean isTriangular = true; for (int i = 1; i < array.length; i++) { for (int j = 0; j < i; j++) { if (array[i][j] != 1) { isTriangular = false; } } } return isTriang...
3
private void copyDir(File src, File dest) throws IOException { if (src.isDirectory()) { if (!dest.exists()) { dest.mkdirs(); } String list[] = src.list(); for (int i = 0; i < list.length; i++) { File dest1 = new File(dest, list[i]); ...
4
public void test_getDifferenceAsLong_long_long() { assertEquals(0L, iField.getDifferenceAsLong(1L, 0L)); assertEquals(567L, iField.getDifferenceAsLong(567000L, 0L)); assertEquals(567L - 1234L, iField.getDifferenceAsLong(567000L, 1234000L)); assertEquals(567L + 1234L, iField.getDifference...
1
public static Node parseNodes(EnumArray[][] ara) { Node curr = new Node(); Node start = curr; Node nextRow = curr; Node nextCol = curr; // RoomFactory factory = RoomFactory.getInstance(); for (int i = 0; i < ara.length; i++) { for (int j = 0; j < ara[i].length; j++) { if (i == 0 && j == 0) ...
7
public boolean canPlayMonument(int playerIndex) { //Checks status, players turn, has player already played dev card, and if the player has a monument card if (generalDevCardPreconditions(playerIndex) && serverModel.getPlayers().get(playerIndex).getOldDevCards().getMonument() > 0) { return true; } else { ...
2
public void loadConsole() throws DataLoadFailedException { dataHolder.loadConsole(); }
0
@Test public void shouldThrowErrorWhenFileCannotBeOpened() throws IOException { //given File tmpFile = folder.newFile(FILENAME); String filePathString = tmpFile.getAbsolutePath(); tmpFile.delete(); //when try { FileParser fileParser = new FileParser(filePa...
1
public static String[] bracketToCapsule(String text, String[] brackets) { ArrayList<String> capsuled = new ArrayList<String>(); for (String bracket : brackets) { String[] bracketSplit = bracket.split(","); if (bracketSplit.length != 3) continue; String startBracket = bracketSplit[0]; String endBrac...
6
public CHRModel() { for(int i=0;i<imagePalette.length;i++){ if(i>0 && (i % 4 != 0)) { imagePalette[i] = (byte)i; } } for(int i=0;i<spritePalette.length;i++){ if(i>0 && (i % 4 != 0)) { spritePalette[i] = (byte)i; } ...
6
public String getExportFileFormat() { return (String) exportFormatComboBox.getSelectedItem(); }
0
final public CycObject predicate(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject t = null; t = representedTerm(false); eof(requireEOF); {if (true) return t;} throw new Error("Missing return statement in function"); }
1
public static int edmons_karp(int source, int finish) { int u; mf = 0; s = source; t = finish; while (true) { f = 0; Queue<Integer> q = new LinkedList<Integer>(); ArrayList<Integer> dist = new ArrayList<Integer>(); dist.addAll(Collections.nCopies(V, INF)); dist.set(s, 0); q.offer(s); p.c...
9
public void breakDNAStrand(){ String temp = null; for(int i = 0; i < arraySize;i++){ //checks to see if it is iterating through the for the first time. //This increase efficiency since we already know the outcome // if(i == 0){ temp = stringCharN(i); maxPercentageDNA = percentageCG; dnaStri...
5
public double kinship(Individual individual) { if(this==individual) return 1; Expression other= (Expression) individual; double k=0; double mF= this.fitness(); double hF= other.fitness(); k=(64-Math.abs(mF-hF))*(mF+hF/2)/64; k= k/Math.abs(depth()-other.depth()); if(this.isLeaf()^other.isLeaf()) k/= 3; ...
5
public boolean VerificaColisao(Point ponto) { for (int i = 0; i < pontos.size(); i++) { if (forma.contains(ponto)) { return true; } } return false; // boolean resposta = false; // int cont1 = 0, cont2 = 0; // int[] dx = new int[3]; // ...
2
public void blinkparticle() { if (untouchable > 0) { if (blink > 15 && blink <= 30) { setImage(invin); } else if (blink >= 0 && blink <= 15) { setImage(empty); } } else if (untouchable == 0) { getWorld()...
6
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { if (e.getDocument() == null) { setEnabled(false); } else { calculateEnabledState(e.getDocument().getTree()); } }
1
public void reMoveElements(PetriNet pn, int x, int y) { for (Place p : pn.getListOfPlaces()) { p.setX(p.getX() + Math.abs(x) + 30); p.setY(y - p.getY() + 30); } for (Transition t : pn.getListOfTransitions()) { t.setX(t.getX() + Math.abs(x) + 30); t...
5
public static void toggleMoveableInheritanceForSingleNode(Node node, CompoundUndoable undoable) { int oldValue = node.getMoveableState(); int newValue = Node.MOVEABLE_INHERITED; boolean isMoveable = node.isMoveable(); if (oldValue == Node.MOVEABLE_INHERITED) { if (isMoveable) { node.setMoveableState(N...
2
public void disconnect(){ //Shut down client try{ System.out.println("Quitting client"); ftp.disconnect(); } catch(Exception e){ } }
1
MAJ_Interface(MonInterface vue1, ArrayList<Message> filemessages, boolean temps_reel) { vue = vue1; this.filemessages = filemessages; dernier_nb_messages = 0; terminer = false; if(temps_reel == true) { go_temps_reel(); } else { go_hors_ligne(); } }
1
@Override public boolean canConvertImplicit(Type v) { if (this == v) return true; if (v instanceof TypeList) { TypeList tl = (TypeList) v; if (types.size() != tl.types.size()) return false; for (int i = 0; i < types.size(); ++i) { if (!types.get(i).canConvertImplicit(tl.types.get(i))) retu...
5
public boolean posNeg(int a, int b, boolean negative){ if((a > 0 && b < 0) && negative == false){ return true; } else if((b > 0 && a < 0 ) && negative == false){ return true; } else if(negative == true){ if(a < 0 && b < 0){ return true; } } return false; }
9
static final int method1082(int i, boolean bool) { anInt1795++; int i_1_ = ByteBuffer.anInt7207; while_44_: do { do { if ((i_1_ ^ 0xffffffff) != -1) { if (i_1_ != 1) { if ((i_1_ ^ 0xffffffff) == -3) break; break while_44_; } } else { if (bool) return 0; return Cla...
6
private void estableceTipo(String tipo) { if (tipo.equals(ManejadorMatrizXML.TRISD)) { tipocod = 1; } else if (tipo.equals(ManejadorMatrizXML.TRISN)) { tipocod = 2; } else if (tipo.equals(ManejadorMatrizXML.TRIID)) { tipocod = 3; } else if (tipo.equals(ManejadorMatrizX...
6
public List<Contato> buscarContatoPorNome(String nomeBusca){ List<Contato> contatosEncontrados = new ArrayList<Contato>(); List<Contato> contatosBusca = contatoDAO.listarContatos(); for (Contato contato : contatosBusca) { if(contato.getNome().toLowerCase().contains(nomeBusca.toLowerC...
2
public static void heapSiftDown(edu.isi.stella.Stella_Object[] heap, int start, int end, Stella_Object value, java.lang.reflect.Method predicate) { { int parent = start; int child = Stella.NULL_INTEGER; Stella_Object leftchild = null; Stella_Object rightchild = null; heap[start] = value; ...
8
private void rmTask(String jid, String tid) { Task[] taskArray = null; synchronized (this.syncTaskList) { taskArray = this.syncTaskList.toArray(new Task[0]); } if (taskArray == null || taskArray.length < 1) { return; } Task objTask = null; for (int i = 0; i < taskArray.length; i++) { ...
7
private void handleTransmission(boolean blnRes) { this.setSysMsg(EzimLang.WaitingForResponse); this.jbtnYes.setVisible(false); this.jbtnNo.setVisible(false); this.jbtnClose.setVisible(true); EzimFrxList.getInstance().put(this.id, this); // let the user choose where to save the incoming file if (blnRes)...
9
public double standardError_of_ComplexModuli() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } double[] re = this.array_as_modulus_of_Complex(); double standardError = Stat.standardError(re);...
2
public void insertaFinal(T dato){ Nodo<T> nodoQ = new Nodo<T>(dato); if(this.inicio == null){ this.inicio = nodoQ; }else{ Nodo<T> nodoT = this.inicio; while(nodoT.getLiga() != null){ nodoT = nodoT.getLiga(); } nodoQ.setLiga(null); nodoT.setLiga(nodoQ); } }
2
private Nodo factor() { Nodo tem = null; if (aux.getTipo()==Nodo.tipoToken.ParentesisIzquierdo){ aux=(Tokens2)tok.next(); tem = this.expresion(); if (aux.getTipo()==Nodo.tipoToken.ParentesisDerecho) { aux=(Tokens2)tok.next(); } else { ...
8
public boolean contains(AASystem other) { if (other.atoms.isEmpty()) { return true; } if (other.arches() > this.arches()) { return false; } if (other.as() > this.as()) { return false; } if (thi...
9
public static int getLargestPeriod(List<Partition> lop) { int ret = 0; for (Partition p : lop) { for (PeriodicTask pt : p.getWorkload()) { if (pt.getPeriod() > ret) ret = pt.getPeriod(); } } return ret; }
3
@Override public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception { if (available <= 0) { data = null; if (log != null) log.append("USINT type, data : - nothing-\n"); return; } ...
3
public static void main(String[] args) { AdditiveNumber additiveNumber=new AdditiveNumber(); System.out.println(additiveNumber.isAdditiveNumber("12012122436")); System.out.println(Integer.MAX_VALUE); }
0
public String toString() { if (nome != null) return nome.toString(); return id + ""; }
1
public int y() { return y; }
0
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String str1; // str1=request.getParameter("option"); System.out.println("option is"+str1); Connection conn; Statement stmt; PrintWriter out=response.getWriter(); response.setContentType("...
2
protected static Target nextMineFace(ExcavationSite site, Tile under[]) { // // Firstly, we set up some initial reference variables, and sample the // tiles and outcrops that can harvest from. final Presences presences = site.world().presences ; final int SS = World.SECTOR_SIZE ; final Batch <...
7
public static void spawnSkeletonWarriorIron (Location loc, int amount) { int i = 0; while (i < amount) { Skeleton SkeletonWarriorIron = (Skeleton) loc.getWorld() .spawnEntity(loc, EntityType.SKELETON); SkeletonWarriorIron.getEquipment().setChestplate( ...
1
@SuppressWarnings("unchecked") private boolean loadKotHMatches(){ //Creates an instance of the file location to save the objects File f = new File(this.getDataFolder()+ File.separator + "Matches.dat"); //If the file does not exist, then we cannont read the file, so return false if (!f.exists())return fal...
8
public void setIdEncargo(int idEncargo) { this.idEncargo = idEncargo; }
0
FileOnDisk(File file, String string, long l) throws IOException { try { if ((l ^ 0xffffffffffffffffL) == 0L) l = 9223372036854775807L; if (l < file.length()) file.delete(); aRandomAccessFile3036 = new RandomAccessFile(file, string); maximumSize = l; aLong3039 = 0L; aFile3046 = file; ...
7
public static void setInstanceSupplier(Function<Class<?>, Object> instanceSupplier) { Injector.instanceSupplier = instanceSupplier; }
1
private void inOrderPositions(Position<Entry<K, V>> p, ArrayList<Entry<K, V>> ps) throws InvalidPositionException, BoundaryViolationException { if (hasLeft(p)) inOrderPositions(left(p), ps); ps.add(p.element()); if (hasRight(p)) inOrderPositions(right(p), ps); }
2
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ConsultantAddress)) { return false; } ConsultantAddress other = (ConsultantAddress) object; if ((this.addId == ...
5
public ArrayList<String> getGradeTitle() { return gradeTitle; }
0
public static void main(final String[] args) { if (args.length != 1) { System.out.println("First argument: GraphJ file"); System.exit(1); } BufferedInputStream fstream = null; try { fstream = new BufferedInputStream(new FileInputStream(args[0])); } catch (final FileNotFoundException e) { ...
6
public void fetchUrl(String container1, String url1, String dest) { String fileData = ""; BufferedWriter bufferWritter = null; try { String container = container1; String url = url1; String destination = dest; Document doc = org.jsoup.Jsoup.connect(url).timeout(10 * 1000) .userAgent("Mozilla/5....
8
public List<Book> getBooksByBookLanguage(int branch_id, int booklangid) { List<Book> list = new ArrayList<>(); Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = Dr...
5
private Object arbitrary(Type paramType, int position, Random random, long size) { Gen<?> generator = genCache.get(Pair.make(paramType, position)); if (generator == null) { generator = generator(paramType, position); genCache.put(Pair.make(paramT...
2
@Test public void findDuplicateTypeHand_whenOnePairExists_returnsOnePairPlusHighestKicker() { Hand hand = findDuplicateTypeHand(twoEightsPlusQueenTenSevenKicker()); assertEquals(HandRank.OnePair, hand.handRank); assertEquals(Rank.Eight, hand.ranks.get(0)); assertEquals(Rank.Queen, hand.ranks.get(1)); assertE...
0
public static void main(String[] args){ // String s1 = "nematode_knowledge"; // String s2 = "empty_bottle"; String s1 = "ABCDEFGH"; String s2 = "ABCGIJKDC"; // method 1 int[][] lcs = lengthLCS(s1, s2); System.out.println(lcs[s1.length()][s2.length()]); String cs = extractLCS(s1, s2, lcs); System.out....
2
private void bonus(Invasor invasor){ //obtenemos el valor de la dificultad int value = juego.getDificultad().VALUE; //1:fácil, 2:medio, 3:difícil //habrá 1/value+1 posibilidades de que se recuperen de 1 a 3 escudos if (random(0, value+1) == 1){ //probamos suerte ...
4
public List getSongsList(){ List<Song> songs = null; try{ org.hibernate.Transaction tx = session.beginTransaction(); songs = session.createCriteria(Song.class).list(); } catch (Exception e){ e.printStackTrace(); } return songs; }
1
public String version_string() { switch (h_version) { case MPEG1: return "MPEG-1"; case MPEG2_LSF: return "MPEG-2 LSF"; case MPEG25_LSF: // SZD return "MPEG-2.5 LSF"; } return(null); }
3
private void clickCell(Board.Move move) { Point TL = getCellLoc(move.X, move.Y); int x = 0, y = 0; switch(move.VAL) { case 1: x = 4; y = 4; break; case 2: x = 15; y = 4; break; case 3: x = 26; y = 4; break; ...
9
private final void retrieveGlobal() { PreparedStatement ps = null; ResultSet rs = null; try { final Connection con = DatabaseConnection.getConnection(); ps = con.prepareStatement("SELECT * FROM drop_data_global WHERE chance > 0"); rs = ps.executeQuery(); while (rs.next()) { globaldrops.add( ...
5
public void parseParameters(String paramstring) throws MaltChainedException { if (paramstring == null) { return; } final String[] argv; try { argv = paramstring.split("[_\\p{Blank}]"); } catch (PatternSyntaxException e) { throw new LibException("Could not split the parameter string '"+paramstring+"'....
9
public boolean isAValidKey(Integer key) throws Exception { for (Integer code : getKeySet()) { if (key.equals(code)) return true; } throw new KeyException("Key is Invalid"); }
2
static String getName(Config.Identifier i, HashSet<String> taken) { String base = ""; for (Config.FontType ft : i.fonts) { String fb = ft.font.replaceAll("[^a-zA-Z]", "").toLowerCase(); if (ft.italic) { fb += "_italic"; } base += fb + "_"; } if (base.isEmpty()) { base = "identifier"; } String all ...
9