text
stringlengths
14
410k
label
int32
0
9
protected int partition(double[] array, int[] index, int l, int r, final int indexStart) { double pivot = array[(l + r) / 2]; int help; while (l < r) { while ((array[l] < pivot) && (l < r)) { l++; } while ((array[r] > pivot) && (l < r)) { r--;...
8
public String getGeraGMP() throws SQLException, ClassNotFoundException { String sts = new String(); Connection conPol = conMgr.getConnection("PD"); if (conPol == null) { throw new SQLException("Numero Maximo de Conexoes Atingida!"); } try { Statement stmt ...
3
public ArrayList<String> getRoomId() { return this.roomId; }
0
public synchronized static void newBorn(List<Ant> ants, Ant father, Ant mather) { int randomNumX = rand.nextInt(terrainWidth); int randomNumY = rand.nextInt(terrainHeight); if (father.getInteligence() && mather.getInteligence()) { Inteligence ant = new Inteligence(getMaxId(ants) + 1, father.getId(), ma...
5
public void gen_opt_sim_negate(SemanticRec opSign, SemanticRec term) { if (opSign != null && term != null) { Type termType = getTypeFromSR(term); String op = opSign.getDatum(0); switch (termType) { case INTEGER: switch (op)...
8
private void addLinks(ObjectStack oStack, Node rep, Node linker) { if(!rep.equals(linker)) { addLinkStatement(rep.getRepresentation(), linker.getRepresentation()); } List<Node> supers = oStack.getSupers(rep); for (Node sup : supers) { // recurse addLinks(oStack, sup,linker); } }
2
@EventHandler public void onPlayerQuit(PlayerQuitEvent event) { KaramPlayer player = m_plugin.playerManager.addOrGetPlayer(event.getPlayer()); if (player != null) { if (!player.isAllowedToLeave()) { m_plugin.log(Level.INFO, "All hope is lost for %...
3
@Override public void deserialize(Buffer buf) { barType = buf.readByte(); if (barType < 0) throw new RuntimeException("Forbidden value on barType = " + barType + ", it doesn't respect the following condition : barType < 0"); slot = buf.readInt(); if (slot < 0 || slot > 99...
3
public void render(Graphics2D g) { g.translate(c.getXOffset(), c.getYOffset()); w.render(g); for (int i = 0; i < particles.size(); i++) { if (new Rectangle(particles.get(i).x, particles.get(i).y, 5, 5).intersects(new Rectangle((int) (-c.getXOffset() - 64), (int) (-c.getYOffset() - 64), 448 * 2 + 128, 360 * 2 +...
6
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
static boolean esPosible(int inicio[],int cantInicio,long jugado,int cantJug) { boolean[][] tab=new boolean[100][100]; int x=50,y=50; tab[x][y]=true; for(int i=0;i<cantInicio;i++) { int p=inicio[i]; x+=jug[p][0]; y+=jug[p][1]; tab[x][y]=true; } for(int i=0;i<cantJug;i++) { int p=abs((int)(jug...
9
@Override public void prepareInternal(int skips, boolean assumeOnSkip) { if(moves.length == 0) return; if(!assumeOnSkip) { for(int i=0;i<moves.length-1;i++) if(!moves[i].execute()) throw new RuntimeException("execution of move "+i+" failed"); } moves[moves.length-1].prepareInternal(skips, assume...
4
public String reverse(String s) { String reversed = ""; String[] parsed = s.split(" "); if(parsed.length == 0) { return ""; } for(int i = parsed.length-1 ; i> -1; i--) { if(parsed[i].compareTo("") != 0) //if not null { reversed = reversed.concat(parsed[i]); if(i!= 0) ...
7
private void openMenuItem_actionPerformed(ActionEvent event) { JFileChooser fileChooser = createFileChooser(); fileChooser.showOpenDialog(this); File file = fileChooser.getSelectedFile(); if (file.exists()) { defaultDirectory = fileChooser.getCurrentDirectory(); t...
3
public String qualifier() { Assert.isTrue(desc.charAt(0) == Type.CLASS_CHAR, "No qualifier for " + desc); final int index = desc.lastIndexOf('/'); if (index >= 0) { return desc.substring(1, index); } return desc.substring(1, desc.lastIndexOf(';')); }
1
@Override public String getDesc() { return "ThrowVenomKnife"; }
0
void addPage(int pageIndex) { int size = pages.size(); if(size == 0) { pages.add(new Integer(pageIndex)); } // Even, so last entry is end of range else if((size % 2) == 0) { Integer end = (Integer) pages.get(size-1); // Continuing the existing ...
6
public static void main(String[] args) { final Cv cvUtilisateur = objectFactory.createCv(); final IdentiteType identiteTypeUtilisateur = objectFactory.createIdentiteType(); final AdresseType adresseTypeUtilisateur = objectFactory.createAdresseType(); final FonctionType fonctionTypeUtilis...
3
private void parseTimeControls(String key, int value) { // Java seriously needs to support Strings in switch statements (Java 1.7!) if (key.equals("movetime")) { timeControls |= TC_MOVETIME; moveTime = value; } else if (key.equals("depth")) { timeControls...
9
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In Save Game handler."); String responseMessage = ""; if(exchange.getRequestMethod().toLowerCase().equals("post")) { exchange.getResponseHeaders().set("Content-Type", "appliction/json"); BufferedReader in...
5
public float[] computeOutput(float[] input) { // проверки if (input == null || input.length != size) throw new IllegalArgumentException(); // найдем победителя int winner = 0; for (int i = 1; i < size; i++) if (input[i] > input[winner]) winner = i; // готови...
9
void addGuiComponent(String fieldname) { String fieldguiname = (String)fieldguinames.get(fieldname)+" "; String fieldtype = (String)fieldtypes.get(fieldname); Object fieldval = fieldvalues.get(fieldname); JPanel subpanel = new JPanel(new GridLayout(1,2)); subpanel.setBackground(bgcolor); mainpanel.add(subp...
6
public static List<ShoppingCartInfo> getEventOrders(int eventId) throws HibernateException { List<ShoppingCartInfo> shoppingCartInfoList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); Calendar calendar = new Gre...
4
public void increment(int by) { // if given value is negative, we have to decrement if (by < 0) { decrement(Math.abs(by)); return; } // cut off full overflows by %= (range + 1); // check if we would still overflow int space_up = max - value; if (by > space_up) { // we check how big overflow i...
2
public String matt2browser(){ /*[["Vasya"],["Mon","Tue","Wen","Thu"],["20.09","21.09","22.09","23.09"] ,["10:00","10:30","11:00","11:30","12:00"] ,[[0,1,0,0],[1,0,0,1],[0,0,1,1],[0,0,0,1] ,[1,1,0,1]]]*/ //getting this view for browser. StringBuffer daysStr=null; String name=data.getName(); Date startDate=data...
9
public int solution(int X, int Y, int K, int A[], int B[]) { n = A.length+1; a = new Integer[n]; b = new Integer[n]; for(int i=0; i<n; i++){ a[i] = i<n-1 ? A[i] : X; a[i] -= i>0 ? A[i-1] : 0; b[i] = i<n-1 ? B[i] : Y; b[i] -= i>0 ? B[i-1] : ...
7
@Override public boolean deleteChild(Expression<?> n) { if (!(n instanceof BinaryArithmeticOperator)) { return false; } if (children.get(0).equals(n))//left { children.set(0, ((Expression<?>) (n.randomChild()))); } else if (children.get(1).equals(n))//...
6
private static boolean getMouseUp(int mouseButton) { return !getMouse(mouseButton) && lastMouse[mouseButton]; }
1
private void initPanelGameLayout() { GroupLayout PGL = new GroupLayout(zPanelGame); zPanelGame.setLayout(PGL); int PrefSize = GroupLayout.PREFERRED_SIZE, DefaSize = -1; ComponentPlacement RelaComp = LayoutStyle.ComponentPlacement.RELATED; SequentialGroup [] PGLHQ = new Sequential...
8
public void statusUpdate(int updateMessageType, String extraInfo) { String message = "Parsing status update: "; switch (updateMessageType) { case ParserStatusMessage.PARSING_STARTED: message += "Parsing has started. Parsing library file \"" + extraInfo + "\"."; break; case ParserStatusMessage.PARSI...
7
@Test public void branchInstrInvalidOpcodeTest() { //To test instruction is not created with illegal opcode for format try { instr = new BranchInstr(Opcode.ADD, 0); } catch (IllegalStateException e) { System.out.println(e.getMessage()); } assertNull(instr); //instr should still be null if creation has...
1
private static void newTopscore() throws FileNotFoundException { String initials = ""; while(initials.equals("")) // Re-show the window until the user types something initials = dialogInput(); int rank = 0; for (int i=0; i<topscore_length;i++) { if (topScores[i] > moves) { rank = i; break; } ...
5
@Override public void mouseDragged(MouseEvent me) { this.drag = true; hp.mx = me.getX(); hp.my = me.getY(); int x = me.getX() / scale; int y = me.getY() / scale; hp.setDrag(new Vector3f(x, y, 0)); Color c = null; if(SwingUtilities.isRightMouseButton(me)) { c = bg; } else if(SwingUtilit...
7
public static void UpperType(){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement stmnt ...
4
public int findNearestABondIndex(int x, int y) { ABonds abonds = ((ExtendedFrameRenderer) repaintManager.frameRenderer).abonds; if (abonds == null) return -1; int n = 0; synchronized (abonds.getLock()) { n = abonds.count(); } if (n <= 0) return -1; initHighlightTriangle(); Triangles triangles =...
7
public void calcSequences(BigLong2ShortHashMap hm, String fastaFP) throws FileNotFoundException { int freqThreshold = supergraphFreq.get(); int lenThreshold = sequenceLen.get(); int kValue = k.get(); banKmers(hm, freqThreshold, kValue); int sequenceId = 0; ArrayList<In...
7
public void addOreSpawn(Block block, World world, Random random, int blockXPos, int blockZPos, int maxX, int maxZ, int maxVeinSize, int chancesToSpawn, int minY, int maxY) { // int maxPossY = minY + (maxY - 1); assert maxY > minY : "The maximum Y must be greater than the Minimum Y"; assert maxX > 0 ...
4
public static void main(String[] args) throws IOException { int portNo = 9090; try { if (args.length == 1) { portNo = Integer.parseInt(args[0]); } } catch (Exception e) { System.err.println("Invalid port number!"); System.exit(1); ...
3
public UserVO getStudent(UserVO userVO) throws LibraryManagementException { ConnectionFactory connectionFactory = new ConnectionFactory(); Connection connection; try { connection = connectionFactory.getConnection(); } catch (LibraryManagementException e) { throw e; } ResultSet resultSet = null; P...
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
6
public static synchronized ValidatedHandshakeResponse validate(HandshakeRequestEvent handshakeRequestEvent, Channel c) { ValidatedHandshakeResponse vhr = null; short errCode = matchVersionAndKey(handshakeRequestEvent.getVersion(), handshakeRequestEvent.getAccessKey()); if(errCode != ValidatedHa...
3
public void actionPerformed(ActionEvent ae) { if(ae.getSource() == loginPanel.getLoginButton()) { String szUsername = loginPanel.getUsernameField(); String szPasscode = loginPanel.getPasscodeField(); if(!(szUsername.isEmpty() || szPasscode.isEmpty())) { try ...
7
private static List<Exprent> extractParameters(List<PooledConstant> bootstrapArguments, InvocationExprent expr) { List<Exprent> parameters = expr.getLstParameters(); if (bootstrapArguments != null) { PooledConstant constant = bootstrapArguments.get(0); if (constant.type == CodeConstants.CONSTANT_Str...
9
private void reactOnNextButton() { _nextButtonWasClicked++; // nextButton will be enabled after something was dropped, so this will // be called after something was dropped if (_nextButtonWasClicked == 1) { setCoverArtDropMode(); } else if (_nextButtonWasClicked >= 2) { // now finally we have gotten the...
8
@Override public ArrayList<Position> getPossibleMoves() { possibleMoves = new ArrayList<Position>(); for (Move move : moves) { int newX = getPosition().getX() + move.getX(); int newY = getPosition().getY() + move.getY(); newX = newX + move.getX(); if (newX < 0 || 7 < newX) continue; i...
9
static protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = ...
6
@Override public void saveTrace(String filename) { try { BufferedWriter writer = new BufferedWriter(new FileWriter(filename)); for (AgentState s : state){ if (s instanceof DirtBasedAgentState){ DirtBasedAgentState b = (DirtBasedAgentState)s; int dist [] = b.getDistances(); int type[] = b.ge...
4
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "EncryptionProperty") public JAXBElement<EncryptionPropertyType> createEncryptionProperty(EncryptionPropertyType value) { return new JAXBElement<EncryptionPropertyType>(_EncryptionProperty_QNAME, EncryptionPropertyType.class, null, valu...
0
final void delete(int index) { if (!isNominal() && !isString() && !isRelationValued()) throw new IllegalArgumentException("Can only remove value of " + "nominal, string or relation-" + " valued attribute!"); else { ...
7
public boolean delete(Word t){ Node temp; Node ptr = findNode(t); if(ptr == null) return false; if(ptr.left() == null){ ptr.setData(ptr.right().data()); ptr.setRight(ptr.right().right()); ptr.setLeft(ptr.right().left()); return true; } else if(ptr.right() == null){ ptr.setData(ptr.left().d...
4
protected void processPath() { while (activeNode.getxCoord() != endX || activeNode.getyCoord() != endY && !openNodes.isEmpty()) { checkOpenNodes(); activeNode.mapPiece.togglePath(); pathNodes.add(activeNode); if (activeNode.getxCoord() == endX && activeNode.getyCoord() == endY) { } else { ...
8
public static void createDelFile(String genomeName, String outFile, double prob) throws IOException { Config config = new Config(genomeName, Gpr.HOME + "/snpEff/" + Config.DEFAULT_CONFIG_FILE); config.loadSnpEffectPredictor(); Random rand = new Random(20140129); StringBuilder out = new StringBuilder(); int ...
7
public static void modify(ConcordiaMembers concordiaMember){ boolean correctInput = false; Scanner myKey = new Scanner(System.in); do{ System.out.println("Press 1 to modify Name\nPress 2 to modify Concordia ID\nPress 3 to modify Status and other Attributes"); int option = myKey.nextInt(); switch(option){ c...
7
private int[] getColumnStartingPositions(String line) { int[] columns = new int[34]; boolean skipBlanks = true; int j = 0; for (int i = 0; i < line.length(); i++) { char ch = line.charAt(i); if (ch == ' ') { if (!skipBlanks) { ...
3
public void init(int mode, byte[] key, byte[] iv) throws Exception{ byte[] tmp; if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(key, 0, tmp, 0, tmp.length); key=tmp; } try{ cipher=javax.crypto.Cipher.getInstance("RC4"); SecretKeySpec _key = new SecretKeySpec(key...
4
@Override public void paint(Graphics g) { String romText = "Rom: Punkte: "; String karText = "Karthago: Punkte: "; lblNewLabel.setText("Aktueller Spieler: " + spiel.getAktuellerSpieler().toString()); brett.repaint(); super.paint(g); /*rom.setText(romText + brett.getGraph().getScore(Owne...
0
@SuppressWarnings("static-access") @Override public String execute(String[] arg)throws ClassNotFoundException, IOException{ long pid = System.currentTimeMillis() % 100000; if(runList != null){ process = new Process(arg, process.IDLE, pid); runList.enQueue(process); }else return "ERROR: Batch not create...
1
private void handleGetConstants(TACMessage msg) { // The status code will be NOT_SUPPORTED and the message will contain // no other fields if the server did not support this command // => does not need to check it while (msg.nextTag()) { if (msg.isTag("gameLength")) { int len = msg.getValueAsInt(...
4
public String getWorkPosition() { return WorkPosition; }
0
public static final FileWatcherService getInstance(List<String> watchedFiles, EventBus eventBus) { if(INSTANCE==null) { INSTANCE = new FileWatcherService(watchedFiles,eventBus); } return INSTANCE; }
1
public void generateGameGraph(Game g){ if (isGameOver(g)){ return; } for (Node n : g.getNodes()){ for (Node m : g.getNodes()){ List<Face> common = getCommonFaces(n, m, g); if (!(common.isEmpty())){ for (Face f : common){ for (List<Boundary> b : getBoundaryPowerSet(f.getBoundaries())){ ...
9
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
@Override protected void controlUpdate(float tpf) { if(((Node)spatial).getChild("Ninja") != null){ CharAnimationControl cac = ((Node)spatial).getChild("Ninja").getControl(CharAnimationControl.class); MeleeControl mc = spatial.getControl(MeleeControl.class); i...
7
public Member(String display, boolean isMethod, boolean manageModifier) { this.hasUrl = new UrlBuilder(null, ModeUrl.ANYWHERE).getUrl(display) != null; final Pattern pstart = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")([^\\[\\]]+)$"); final Matcher mstart = pstart.matcher(display); if (mstart.matches()...
9
public static BaseImage biCubicSmooth(BaseImage img, int width, int height) { if(width > img.getWidth() || height > img.getHeight()) { throw new IllegalStateException("Both width and height must be less then the current image!!"); } int scaleFactor = 7; BaseImage nimg = img; BaseImage resized...
9
public void cambiarPosicionJugado2(){ for(int x=0;x<8;x++){ for(int y=0;y<8;y++){ if(pd.mapa_jugador2[x][y].equals(codigo)) pd.mapa_jugador2[x][y]=""; } } int x=rd.nextInt(0)+7; int y=rd.nextInt(0)+7; cam...
3
private static void logHierarchy(String prefix, ClassLoader classLoader) { if (!isDiagnosticsEnabled()) { return; } ClassLoader systemClassLoader; if (classLoader != null) { final String classLoaderString = classLoader.toString(); logDiagnostic(prefix ...
8
@Override public boolean isWebDriverType(String type) { return StringUtils.equalsIgnoreCase("firefox", type); }
0
public int handvalue(int hou, int han) { if (han == -2) { return 16000; } else if (han >= 15 || han == -1) { return 8000; } else if (han >= 13) { return 6000; } else if (han >= 10) { return 4000; } else if (han >= 8) { return 3000; } else if (han >= 7) return 2000; e...
9
@Override public Node streetQuery(String streetNameA, String streetNameB) throws IOException { // System.out.println("Calling streetQuery."); Node node = null; String input = null; try { StringBuilder sb = new StringBuilder("streetQuery\n"); sb.append(ProtocolParser.encodeString(streetNameA)); sb.a...
6
final int addVertex(int x, int y, int z) { for (int i1 = 0; i1 < vertexCount; i1++) { if (verticesX[i1] == x && y == verticesY[i1] && verticesZ[i1] == z) { return i1; } } verticesX[vertexCount] = x; verticesY[vertexCount] = y; verticesZ[vertexCount] = z; maxVertex = 1 + vertexCount; return vert...
4
private void processAddMasterFile(Sim_event ev) { if (ev == null) { return; } Object[] pack = (Object[]) ev.get_data(); if (pack == null) { return; } File file = (File) pack[0]; // get the file file.setMasterCopy(true); // set the file in...
3
@Override public void processChangeRoom() { System.out.println("Current Room:" + getCurrentRoom().getName()); int iNumMonsters = getCurrentRoom().getNumLivingBeings()-1; System.out.println("Number of monsters in current website: "+iNumMonsters+"."); if (iNumMonsters > 0) System.out.println("Monsters:"); ...
4
public static <T1, T2> List<TestCase<?, ?>> createByParams(String format, T1 expected, T2[] params) { List<TestCase<?, ?>> cases = new ArrayList<TestCase<?, ?>>(); for(T2 param : params) cases.add(new TestCase<T1, T2>(format, expected, param)); return cases; }
7
@EventHandler public void WitherWither(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.Wither.D...
7
@Override public void set(Object target, Object value) { if (staticBase != null) target = staticBase; if (type == int.class) unsafe.putInt(target, offset, (Integer) value); else if (type == short.class) unsafe.putShort(target, offset, (Short) value); else if (type == long.class) unsafe.putLong(tar...
9
@EventHandler public void EnderDragonFireResistance(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.getEnderDragonConfig().getDoubl...
6
public static boolean deletePerson(String userid) { ResultSet rs = null; Connection con = null; PreparedStatement ps = null; boolean result = true; try { String sql = "DELETE FROM PERSON WHERE userid=(?)"; con = ConnectionPool.getConnectionFromPool(); ps = con.prepareStatement(sql); ps.setString...
7
@Override public boolean isSearched(String url) { return false; }
0
public String version() throws BITalinoException { try { socket.write(7); ByteBuffer buffer = ByteBuffer.allocate(30); // read until '\n' arrives byte b = 0; while ((char) (b = (byte) socket.getInputStream().read()) != '\n') buffer.put(...
2
public void sincronizaArticulos(){ // TRAIGO EL ID POS PhpposAppConfigEntity appConfig = getAppConfig("id_pos"); // PREGUNTAR SI EL ID POS ESTA CONFIGURADO if (appConfig != null){ int idPos = Integer.parseInt(appConfig.getValue()); logger.info("****>>> idPos = " + idPos); // TRAIGO...
7
public static void visitFilesRecursively(FileVisitor visitor, File directory, String filePattern, String directoryPattern, boolean recursively) { if (!directory.isDirectory()) directory = directory.getParentFile(); if (!directory.getName().matches(directoryPattern)) return; visitor.visitDirectory(directory); fi...
8
private void saveBookingButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBookingButtonActionPerformed boolean commitSuccess; if (!newBookingModel.isEmpty()) { int reply = jOptionPane.showConfirmDialog(this, "Are you sure you want to save?", "Save?", jOptionPane.YE...
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (active(request)) //if there is an active user { if (request.getRequestURI().equals(request.getContextPath() + "/blabs")) //if there is no string after blabs/ { //current user b...
7
boolean putPiece(int p, int row, int col) { // пробуем вставить паззл на доску, возвращает True если подходит if (board.getColor(row,col) != null) return false; for (int i = 1; i < 8; i += 2) { if (row+pieces[p][i] < 0 || row+pieces[p][i] >= rows || col+pieces[p][i+1] < 0 || c...
8
public void setPrice(String price) { this.price = price; }
0
private TypeHolder _eraseTypeVariables(Map<String, TypeHolder> variable2Holder, Set<String> visitedVariables, TypeHolder typeHolder) { if (typeHolder.getRawClass() == null) { if (variable2Holder.containsKey(typeHolder.getName())) { TypeHolder th = variable2Holder.get(typeHolder.getName()); WildcardBound...
9
public void run() { rsSet=getResultSet(cur, limit); String insert="insert into idf(term,docnum,idf)values(?,?,?)"; int no=0; try { PreparedStatement statement=sqLconnection.conn.prepareStatement(insert); while(rsSet.next()) { String term=rsSet.getString("term"); int count=gettermCount(term); ...
3
private void finaliseRelations() { if (tempRelations == null) return; PageLayout layout = page.getLayout(); Relations relations = layout.getRelations(); if (relations == null) return; for (int i=0; i<tempRelations.size(); i++) { List<String> rel = tempRelations.get(i); if (rel != null && rel...
8
public String convert(String s, int nRows) { if (s == null || "".equals(s) || nRows == 1) return s; StringBuffer sb = new StringBuffer(); for (int i = 0; i < nRows; i++) { int j = i; boolean odd = false; while (j < s.length()) { sb.append(s.charAt(j)); if (i == 0 || i == nRows - 1) { j +...
8
public final void modifyHealth(int toInflict) { health= health + toInflict; if(health > 100) { health = 100; } else if(health < 0) { health = 0; //uh oh } }
2
public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: java " + SSLJioClient.class.getName() + " URL [n] [delay]"); System.err.println("\tURL: The url of the service to test."); System.err.println("\tn: The number of clien...
8
public int zmq_sendiov (SocketBase s_, byte[][] a_, int count_, int flags_) { if (s_ == null || !s_.check_tag ()) { throw new IllegalStateException(); } int rc = 0; Msg msg; for (int i = 0; i < count_; ++i) { msg = new Msg(a_[i]); i...
5
public BeerResponse(BeerReadOnly delegate) { this.delegate = delegate; }
0
@Override public ResultSet query(String query) { //Connection connection = null; Statement statement = null; ResultSet result = null/*new JdbcRowSetImpl()*/; try { //connection = open(); //if (checkConnection()) statement = this.connection.createStatement(); result = statement.executeQuery("S...
2
public void setShortMessageFontcolor(int[] fontcolor) { if ((fontcolor == null) || (fontcolor.length != 4)) { this.shortMessageFontColor = UIFontInits.SHORTMESSAGE.getColor(); } else { this.shortMessageFontColor = fontcolor; } somethingChanged(); }
2
private void waitForConnections() { while (true) { try { acceptConnection(); } catch (SocketTimeoutException e) { if (stopWaiting) { try { serverSocket.close(); } catch (IOException e1) { ...
5
public static boolean updateEventStatus(int eventId, int userId, int statusCode) throws HibernateException { boolean isUpdateEventStatusSuccessful = false; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); // update event ...
4
public void stopall() { synchronized(clients) { for(TestClient c : clients) c.stop(); } }
1
public String toString() { return description(); }
0