text
stringlengths
14
410k
label
int32
0
9
public void mergeBreakedStack(VariableStack stack) { if (breakedStack != null) breakedStack.merge(stack); else breakedStack = stack; }
1
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { eventName = new javax.swing.JLabel(); eventStreet = new javax.swing.JLabel(); whereLabel = new javax.swing.JLabel(); eventDescriptionScrollPane = new javax.swing.JScrollPane(); eventDescription = new javax.swing.JTextArea(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); setName("Event Description"); // NOI18N setResizable(false); setSize(new java.awt.Dimension(300, 350)); eventName.setFont(new java.awt.Font("Lucida Grande", 0, 24)); // NOI18N eventName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); eventName.setText("Name of the event"); eventName.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); eventStreet.setText("Event street"); whereLabel.setText("Where: "); eventDescriptionScrollPane.setEnabled(false); eventDescription.setEditable(false); eventDescription.setBackground(javax.swing.UIManager.getDefaults().getColor("ColorChooser.background")); eventDescription.setColumns(20); eventDescription.setLineWrap(true); eventDescription.setRows(5); eventDescription.setWrapStyleWord(true); eventDescriptionScrollPane.setViewportView(eventDescription); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(eventName, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(whereLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(eventStreet, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(eventDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(eventName) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(eventDescriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(eventStreet) .addComponent(whereLabel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents
0
public void makePaths() throws IOException { PathLoader loader = new PathLoader(); path = new SVGPath(); path2 = new SVGPath(); path3 = new SVGPath(); path4 = new SVGPath(); path5 = new SVGPath(); path.setContent(loader.getPath(1)); path2.setContent(loader.getPath(2)); path3.setContent(loader.getPath(3)); path4.setContent(loader.getPath(4)); path5.setContent(loader.getPath(5)); path.setStroke(Color.YELLOW); path2.setStroke(Color.RED); path3.setStroke(Color.ORANGE); path4.setStroke(Color.WHEAT); path5.setStroke(Color.AQUA); path.setFill(Color.TRANSPARENT); path2.setFill(Color.TRANSPARENT); path3.setFill(Color.TRANSPARENT); path4.setFill(Color.TRANSPARENT); path5.setFill(Color.TRANSPARENT); path.setEffect(boxBlur); path2.setEffect(boxBlur); path3.setEffect(boxBlur); path4.setEffect(boxBlur); path5.setEffect(boxBlur); }
0
public static void addUnitIntoReferential(Unite unite) { if (unite == null || unite.getGrandeur() == null || unite.getNom() == null || unite.getRatio() == null) { throw new IllegalArgumentException("Problème dans l'unitée passée en paramètre !"); } boolean premiereUnite = false; List<Unite> listeUnites = Utils.getListeUnitesDepuisGrandeur(unite.getGrandeur()); if (listeUnites == null) { listeUnites = new ArrayList<>(); premiereUnite = true; } for (Unite uniteTmp : listeUnites) { if (uniteTmp.getNom() != null && uniteTmp.getNom().equalsIgnoreCase(unite.getNom())) { throw new IllegalArgumentException("L'unité existe déjà !"); } } listeUnites.add(unite); if (premiereUnite) { grandeurs.put(unite.getGrandeur(), listeUnites); } }
9
public String getLieu() { return lieu; }
0
public static boolean saveLocal(File file) { try { PrintStream out = new PrintStream(file); out.println(userName); out.println(coins); out.println(playtime); out.println(new BigInteger(lck_lvl)); out.println(new BigInteger(lck_bg)); out.println(new BigInteger(lck_chr)); out.println(new BigInteger(lck_msc)); out.println(new BigInteger(lck_til)); out.println(new BigInteger(lck_obj)); out.flush(); out.close(); isSaved = true; isDBsynced = false; return true; } catch (FileNotFoundException e) { e.printStackTrace(); } return false; }
1
public Abstraction(Implementor implementor) { this.implementor = implementor; }
0
public void insert(Comparable in){ if(smallest == null || in.compareTo(smallest) < 0) { smallest = in; } // Create new node with in as content RBNode insertedNode = createNode(in); if (root == null) { insertedNode.color = NodeColor.RED; insertedNode.left = null; insertedNode.right = null; insertedNode.parent = null; root = insertedNode; } else { RBNode n = root; while (true) { compResult = insertedNode.compareTo(n); if (compResult == 0) { System.out.println("Duplicate Node error"); System.out.println(n + " and " + insertedNode); return; } else if (compResult < 0) { if (n.left == null) { insertedNode.color = NodeColor.RED; insertedNode.left = null; insertedNode.right = null; insertedNode.parent = null; n.left = insertedNode; break; } else { n = n.left; } } else { assert compResult > 0; if (n.right == null) { insertedNode.color = NodeColor.RED; insertedNode.left = null; insertedNode.right = null; insertedNode.parent = null; n.right = insertedNode; break; } else { n = n.right; } } } insertedNode.parent = n; } insertCase1(insertedNode); size++; }
8
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); case '[': this.back(); return new JSONArray(this); } /* * Handle unquoted text. This could be the values true, false, or * null, or it can be a number. An implementation (such as this one) * is allowed to also accept non-standard forms. * * Accumulate characters until we reach the end of the text or a * formatting character. */ StringBuffer sb = new StringBuffer(); while (c >= ' ' && ",:]}/\\\"[{;=#".indexOf(c) < 0) { sb.append(c); c = this.next(); } this.back(); string = sb.toString().trim(); if ("".equals(string)) { throw this.syntaxError("Missing value"); } return JSONObject.stringToValue(string); }
7
private void setGlobalConnection() { for (int i = 0; i < this.connection.length; i++) { int upI = i + 1; this.scene[i] = this.setCurrentConnection(upI); } }
1
public int readUnsignedInt() { if(inf) { if(sc.hasNextInt()) return sc.nextInt(); else return -1; } else { ExceptionLog.println("Попытка записи в неоткрытый файл"); return -1; } }
2
private void loadUsers(){ User[] alstUsers = dbCon.loadUsers(channel); if(alstUsers != null){ Arrays.sort(alstUsers); jlstUsers.setListData(alstUsers); } }
1
public void load(Sheet sheet) { LinkedList<String> lines = new LinkedList<String>(); try { while (ready()) { lines.add(readLine()); } LinkedList<String> sorted = new LinkedList<String>(); for (String s : lines) { boolean isRef = false; int index = s.indexOf('='); for (int i = index; i < s.length(); i++) { if (Character.isLetter(s.charAt(i))) { isRef = true; } } if (isRef) { sorted.addLast(s); } else { sorted.addFirst(s); } } for (String s : sorted) { int index = s.indexOf('='); sheet.putQuiet(s.substring(0,index),s.substring(index+1)); } } catch (Exception e) { throw new XLException(e.getMessage()); } }
7
public void goSpeed(){ if(hspeed!=0){ if(collideCheck(hspeed,0)!=0){ moveHorizontal(hspeed); } } if(vspeed!=0){ if(collideCheck(0,vspeed)!=0){ moveVertical(vspeed); } } }
4
public char getConsensusBase(int site, boolean useAmbiguities) { double[] freqs = getColumnBaseFreqs(site); char[] bases = {'A', 'C', 'T', 'G'}; for(int i=0; i<freqs.length; i++) { //Sort by frequency, but sort bases at the same time for(int j=i; j<freqs.length; j++) { if (freqs[i]<freqs[j]) { double tmpF = freqs[i]; char tmpC = bases[i]; freqs[i] = freqs[j]; bases[i] = bases[j]; freqs[j] = tmpF; bases[j] = tmpC; } } } if (!useAmbiguities) return bases[0]; //This is the most frequent base else { if (Math.abs(freqs[0]-freqs[1])<1e-6) { if (Math.abs(freqs[1]-freqs[2])<1e-6) { if (Math.abs(freqs[2]-freqs[3])<1e-6) { //They're all the same return 'N'; } else { char c = getAmbiguityCode(bases[0], bases[1], bases[2]); System.out.println("Code for " + bases[0] + ", " + bases[1] + ", " + bases[2] + " is " + c); return c; } } else { char c = getAmbiguityCode(bases[0], bases[1]); System.out.println("Code for " + bases[0] + ", " + bases[1] + " is " + c); return c; } } else return bases[0]; } }
7
private String checkForAbbreviation(String bookToCompare) { System.out.println("CHECKING: " + bookToCompare); if (bookToCompare.contains(" of ")) { if (!bookToCompare.equals("Song of Solomon")) { String[] splitter= bookToCompare.split(" "); bookToCompare = splitter[splitter.length - 1]; } } if (bookToCompare.contains(" , ")) { String[] splitter = bookToCompare.split(" "); bookToCompare = splitter[splitter.length - 1]; } if (bookToCompare.equals("Doc & Cov") || bookToCompare.equals("D & C") || bookToCompare.equals("D&C") || bookToCompare.equals("Doctrine & Covenants")) { return "Doctrine & Covenants"; } for (String book : books) { if (book.contains(bookToCompare)) { return book; } } return "NO_NAME"; }
9
@Override public boolean halt() { if(gBest >= solution - error && gBest <= solution + error){ return true; }else{ return false; } }
2
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { writer.print(getOperatorString()); if ((Options.outputStyle & Options.GNU_SPACING) != 0) writer.print(" "); subExpressions[0].dumpExpression(writer, 700); }
1
public static void test(Robot r) { if (r instanceof Null) System.out.println("[Null Robot]"); System.out.println("Robot name: " + r.name()); System.out.println("Robot model: " + r.model()); for (Operation operation : r.operations()) { System.out.println(operation.description()); operation.command(); } }
2
public void setSignatureValue(SignatureValueType value) { this.signatureValue = value; }
0
@Override public OccurrenceAllocation select(SolverState schedule, Occurrence forOccurrence) { if (schedule.constraintsCost() < smallestConflict) { smallestConflict = schedule.constraintsCost(); } // until we are lowering conflict value, store last iteration to current if (lastConflictCost > smallestConflict && schedule.constraintsCost() == smallestConflict) { lastConflictLoweringIteration = schedule.getItearation(); } lastConflictCost = schedule.constraintsCost(); // if current conflict value is worst than smallest found OR // we are not moving better in last stayMinConflictSelction iterations if (schedule.constraintsCost() > smallestConflict || schedule.getItearation() - lastConflictLoweringIteration < stayMinConflictSelectionAfterToZeroConflict) { // best minimal conflict //System.out.printf("AlocSelection: min conflict, min cost. sc:%s, lzi:%s\n",smallestConflict, lastConflictLoweringIteration); return conflictingSelection.select(schedule, forOccurrence); } else { // if (random.nextDouble() < probBestIgnoringSelWhenNoConflict) { // best conflicting // see constructor for explanation of only this selection //System.out.println("AlocSelection: best ignoring conflict"); return selectBestIgnoringConflict(schedule, forOccurrence); //} else { // roulette selection // System.out.println("AlocSelection: roullette"); // return optimizingSelection.select(schedule, forOccurrence); //} } }
5
public static employeeTypes intToEmployeeType(int type) { for (employeeTypes tmpType : employeeTypes.values()) { if (tmpType.ordinal() == type) { return tmpType; } } return employeeTypes.CLERK; }
2
@Test(expected=IllegalStateException.class) public void testIllegalCallOfThreshold() { CircleAccumulator test = new CircleAccumulator(new boolean[][]{{true}}, 0, 1); test.threshold(1); }
0
public static void move(Point p, int i){ switch (i) { case 0: //up p.y++; break; case 1: //down p.y--; break; case 2: //right p.x++; break; case 3: //left p.x--; break; default: break; } }
4
public int minDepth(TreeNode root) { if (root == null) return 0; Queue<TreeNode> nodeq = new LinkedList<TreeNode>(); Queue<Integer> deepq = new LinkedList<Integer>(); nodeq.add(root); deepq.add(1); while (true) { TreeNode node = nodeq.poll(); int dp = deepq.poll(); if (node.left == null && node.right == null) return dp; if (node.left != null) {nodeq.add(node.left); deepq.add(dp+1);} if (node.right != null) {nodeq.add(node.right);deepq.add(dp+1);} } }
6
public void Color(InterferenceGraph graph) { // Retrieve random node with fewer than NUM_REGISTERS neighbors int x = ig.getVertexWithMaxDegree(NUM_REGISTERS); if (x == -1) { x = ig.getSmallestCost(); } // Remove the vertex and recover its neighbors regSet.add(x); ArrayList<Integer> neighbors = ig.removeVertex(x); // If the graph isn't empty, recursively color if (ig.isEmpty() == false) { Color(ig); } // Add x and its edges back to G ig.addVertex(x, neighbors); // choose a color for x that is different from its neighbors HashSet<Integer> neighborColors = new HashSet<Integer>(); for (Integer n : neighbors) { neighborColors.add(regMap.get(n)); } boolean colored = false; int color = 1; // register 0, for DLX, is always reserved to be a constant zero while (!colored) { if (neighborColors.contains(color) == false) { regMap.put(x, color); colored = true; break; } // Try the next color color++; // We can't use reserved registers... only R1-R26 are general purpose (27 is our return reg) // See DLX spec for R0, R28, R29, R30, R31 roles while (color == 27 || color == 28 || color == 29 || color == 30) { color++; } } System.out.println("REG ASSIGNMENT: " + PLStaticSingleAssignment.getInstruction(x).toString() + " => " + color); regMap.put(x, color); PLStaticSingleAssignment.getInstruction(x).regNum = color; }
9
public void processEvent(Event event) { System.out.println("login client's processEvent"); if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } System.out.println(_className + ".processEvent: Received Login Response... "); if (event.getType() != Event.OMM_ITEM_EVENT) { System.out.println("ERROR: " + _className + " Received an unsupported Event type."); _sFrame.cleanup(-1); return; } OMMItemEvent ie = (OMMItemEvent)event; OMMMsg respMsg = ie.getMsg(); if (respMsg.getMsgModelType() != RDMMsgTypes.LOGIN) { System.out.println("ERROR: " + _className + " Received a non-LOGIN model type."); _sFrame.cleanup(-1); return; } if (respMsg.isFinal()) { System.out.println(_className + ": Login Response message is final."); GenericOMMParserI.parse(respMsg, _sFrame._itemManager); // Send the login result back _sFrame.processLogin(false); return; } if ((respMsg.getMsgType() == OMMMsg.MsgType.STATUS_RESP) && (respMsg.has(OMMMsg.HAS_STATE)) && (respMsg.getState().getStreamState() == OMMState.Stream.OPEN) && (respMsg.getState().getDataState() == OMMState.Data.OK)) { System.out.println(_className + ": Received Login Response - REFRESH_SOLICITED"); GenericOMMParserI.parse(respMsg, _sFrame._itemManager); // Send the login result back _sFrame.processLogin(true); } else { System.out.println(_className + ": Received Login Response - " + OMMMsg.MsgType.toString(respMsg.getMsgType())); GenericOMMParserI.parse(respMsg, _sFrame._itemManager); } }
8
private void incrementHour() { hour += 1; server.onHourIncrement(); if (hour > 23) { hour = 0; incrementDay(); } // TODO deal with redundancy, set time of day sends a regular server messages, but then we send a debug version.. if (this.hour == 0) { setTimeOfDay(TimeOfDay.MIDNIGHT, new Message("It is now midnight.", MessageType.BROADCAST)); server.debug("It is now midnight."); } else if (this.hour == 5) { setTimeOfDay(TimeOfDay.BEFORE_DAWN, new Message("It is now just before dawn.", MessageType.BROADCAST)); server.debug("It is now just before dawn."); } else if (this.hour == 6) { setTimeOfDay(TimeOfDay.DAWN, new Message("It is now dawn.", MessageType.BROADCAST)); server.debug("It is now dawn."); } else if (this.hour == 7) { setTimeOfDay(TimeOfDay.MORNING, new Message("It is now morning.", MessageType.BROADCAST)); server.debug("It is now morning."); } else if (this.hour == 12) { setTimeOfDay(TimeOfDay.MIDDAY, new Message("It is now midday.", MessageType.BROADCAST)); server.debug("It is now midday."); } else if (this.hour == 13) { setTimeOfDay(TimeOfDay.AFTERNOON, new Message("It is now afternoon.", MessageType.BROADCAST)); server.debug("It is now afternoon."); } else if (this.hour == 18) { setTimeOfDay(TimeOfDay.DUSK, new Message("It is now dusk.", MessageType.BROADCAST)); server.debug("It is now dusk."); } else if (this.hour == 19) { setTimeOfDay(TimeOfDay.NIGHT, new Message("It is now night.", MessageType.BROADCAST)); server.debug("It is now night."); } /*if (minute != 0) { return; }*/ }
9
@Override protected void clearDiscardPile(TurnContext state) { super.clearDiscardPile(state); System.out.print("The discard pile has been cleared. "); if (state.selection == null && state.g.canDraw() && state.currentPlayable.isEmpty()) { System.out.println("Since cards can be drawn, you must draw and you cannot put down any more cards."); } else if (state.won) { System.out.println(); } }
4
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to string. If we reach an early end, bail. */ for (i = 0; i < length; i += 1) { c = next(); if (c == 0) { return false; } circle[i] = c; } /* We will loop, possibly for all of the remaining characters. */ for (;;) { j = offset; b = true; /* Compare the circle buffer with the to string. */ for (i = 0; i < length; i += 1) { if (circle[j] != to.charAt(i)) { b = false; break; } j += 1; if (j >= length) { j -= length; } } /* If we exit the loop with b intact, then victory is ours. */ if (b) { return true; } /* Get the next character. If there isn't one, then defeat is ours. */ c = next(); if (c == 0) { return false; } /* * Shove the character in the circle buffer and advance the * circle offset. The offset is mod n. */ circle[offset] = c; offset += 1; if (offset >= length) { offset -= length; } } }
9
private Vector solve(Node node) { Vector solution = new Vector(); solution.addElement(node); while (node.parent != null) { solution.insertElementAt(node.parent, 0); node = node.parent; } return solution; }
1
public void load(String[] filenames) { String line, stroke, english; String[] fields; boolean simple= (filenames.length<=1); TST<String> forwardLookup = new TST<String>(); for (String filename : filenames) { if (validateFilename(filename)) { try { File file = new File(filename); FileReader reader = new FileReader(file); BufferedReader lines = new BufferedReader(reader); while ((line = lines.readLine()) != null) { fields = line.split("\""); if ((fields.length > 3) && (fields[3].length() > 0)) { stroke = fields[1]; english = fields[3]; if (simple) { addToDictionary(stroke, english); } else { forwardLookup.put(stroke, english, false); } } } lines.close(); reader.close(); } catch (IOException e) { System.err.println("com.brentandjody.BriefTrainer.Dictionary File: " + filename + " could not be found"); } } } if (!simple) { // Build reverse lookup for (String s : forwardLookup.keys()) { english = forwardLookup.get(s, false); addToDictionary(s, english); } } }
9
public String toString() { return this.mode == 'd' ? this.writer.toString() : null; }
1
private void addLog(Cell cell, int flag) { DataFormatter formatter = new DataFormatter(); switch (cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: { if (flag == OK_PRINT) { //System.out.print(formatter.formatCellValue(cell) + "\t"); setaLogCampo((cell.getColumnIndex() - 1), formatter.formatCellValue(cell)); } else if (flag == LIXO) { System.out.print("###"); } break; } case Cell.CELL_TYPE_STRING: { if (flag == OK_PRINT) { //System.out.print(cell.getStringCellValue() + "\t"); setaLogCampo((cell.getColumnIndex() - 1), formatter.formatCellValue(cell)); } else if (flag == LIXO) { if (cell.getStringCellValue().equals(CELL_READ_START)) { System.out.print("Imprimindo valores na proxima linha...\n"); this.copyCellContent = true; } System.out.print("###"); } break; } } }
7
private void blockCellThatPlayerWillNotBeWinnerInTheNextStep (Square square, Human human) { Mark mark = new Mark(human.getMark()); for (char i=FIRST_LEFT_COORD; i<FIRST_LEFT_COORD + STRINGS_MATRIX_COUNT; i++) { for (char j=FIRST_TOP_COORD; j<FIRST_TOP_COORD + STRINGS_MATRIX_COUNT; j++) { mark.setLeftCoord(i); mark.setTopCoord(j); if (square.emptyCell(mark.getLeftCoord(), mark.getTopCoord())) { square.putMark(mark); if (square.winner(human)) { square.clearCell(mark.getLeftCoord(), mark.getTopCoord()); if (human.getMark() == MARK_X) { mark.setMark(MARK_O); } else { mark.setMark(MARK_X); } square.putMark(mark); return; } else { square.clearCell(mark.getLeftCoord(), mark.getTopCoord()); } } } } }
5
public void listarDepartamentos() { DepartamentoDAO departamento = new DepartamentoDAO(); try { tblDepartamentos.setModel(DbUtils.resultSetToTableModel(departamento.PreencheTabelaDepartamentos())); } catch (SQLException ex) { } }
1
public static void renderQuad(Texture texture, Colour colour, float x, float y, float width, float height){ glEnable(GL_TEXTURE_2D); if(texture != null) texture.bind(); if(colour != null) colour.bind(); glBegin(GL_TRIANGLES); { glTexCoord2f(0, 0); glVertex2f(x, y); glTexCoord2f(1, 0); glVertex2f(x + width, y); glTexCoord2f(0, 1); glVertex2f(x, y + height); glTexCoord2f(1, 0); glVertex2f(x + width, y); glTexCoord2f(1, 1); glVertex2f(x + width, y + height); glTexCoord2f(0, 1); glVertex2f(x, y + height); } glEnd(); glDisable(GL_TEXTURE_2D); }
2
public void addAccount(){ boolean agregada = false; if(!activo.validateTipo(Usuario.LIMITADO)){ System.out.print("Ingrese el Nombre del Cliente: "); String nombre = scan.next(); int num; do{ do{ System.out.print("Ingrese numero de Cuenta: "); num = scan.nextInt(); if(num>=-1 && num!=0){ break; } else{ System.out.println("Numero de cuenta invalido!"); } }while(true); if(num==-1){ break; } if(!validarCuenta(num)){ String tipo = CuentaBancaria.selectAccountType(); agregada = add(nombre, tipo, num); //intenta agregar la cuenta y devuelve true si fue agregada if(!agregada){ //Si no fue agregar es porque esta lleno el arreglo System.out.println("\033[31mLimite de cuentas Lleno!"); break; } }else{ System.out.println("\033[31mYa existe una cuenta con ese numero!"); } }while(!agregada); }else{ System.out.println("\033[31mNo Tiene Permiso para Agregar cuenta Ingeniero!"); } }
8
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(MostrarCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(MostrarCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(MostrarCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(MostrarCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MostrarCliente().setVisible(true); } }); }
6
boolean tryMethod(Object o,String name,Object [] args) { try { Method met=getMethod(o.getClass(),name,args); if (met==null) return false; met.invoke(o,args); } catch (InvocationTargetException ex) { Throwable ex_t = ex.getTargetException(); if (ex_t instanceof JGameError) { eng.exitEngine(eng.dbgExceptionToString(ex_t)); } else { eng.dbgShowException("MAIN",ex_t); } return false; } catch (IllegalAccessException ex) { System.err.println("Unexpected exception:"); ex.printStackTrace(); return false; } return true; }
4
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); }
2
private void stateAltDraw(int x,int y){ if(!sedna.getSelected() ||sedna.getSelection(x,y)){ if(statefillflag){ switch(sft){ case 0: mainBrain.setCellState(x,y,0);viewer.setAState(x,y,0); break; case 1: mainBrain.getCell(x, y).setOption(toolstring[1], false); break; case 2: mainBrain.getCell(x, y).setParameter(toolstring[1], 0); break; default: mainBrain.setCellState(x,y,0);viewer.setAState(x,y,0); break;} } else{ switch(sdt){ case 0: mainBrain.setCellState(x,y,0);viewer.setAState(x,y,0); break; case 1: mainBrain.getCell(x, y).setOption(toolstring[0], false); break; case 2: mainBrain.getCell(x, y).setParameter(toolstring[0], 0); break; default: mainBrain.setCellState(x,y,0);viewer.setAState(x,y,0); break; } } }}
9
private void processLine(RdpPacket_Localised data, LineOrder line, int present, boolean delta) { if ((present & 0x01) != 0) line.setMixmode(data.getLittleEndian16()); if ((present & 0x02) != 0) line.setStartX(setCoordinate(data, line.getStartX(), delta)); if ((present & 0x04) != 0) line.setStartY(setCoordinate(data, line.getStartY(), delta)); if ((present & 0x08) != 0) line.setEndX(setCoordinate(data, line.getEndX(), delta)); if ((present & 0x10) != 0) line.setEndY(setCoordinate(data, line.getEndY(), delta)); if ((present & 0x20) != 0) line.setBackgroundColor(setColor(data)); if ((present & 0x40) != 0) line.setOpcode(data.get8()); parsePen(data, line.getPen(), present >> 7); // if(//logger.isInfoEnabled()) //logger.info("Line from // ("+line.getStartX()+","+line.getStartY()+") to // ("+line.getEndX()+","+line.getEndY()+")"); if (line.getOpcode() < 0x01 || line.getOpcode() > 0x10) { //logger.warn("bad ROP2 0x" + line.getOpcode()); return; } // now draw the line surface.drawLineOrder(line); }
9
@Override public String toString() { return value; }
0
public List<SingleCounter> extractKeyNouns (Documents docs, int n) { Counter c = new Counter(); for (Document d : docs.documents) { for (Sentence s : d.sentences) { Phrases p = s.phrases; for (int idx = 0; idx < p.size(); idx++) { for (String term : p.getNouns(idx)) { c.add(term); } } } } return c.topN(n); }
4
private void updateStopMarkers() { currentGTFSStopsMarker = new HashSet<Stop>(); currentOSMStopsMarker = new HashSet<Stop>(); if (currentGTFSStops.size() == 0 || currentOSMStops.size() == 0){ return; }else{ for (Stop s:currentGTFSStops) if (currentOSMStops.contains(s) && currentGTFSStops.indexOf(s) >= currentOSMStops.indexOf(s)){ //equals }else{ currentGTFSStopsMarker.add(s); } for (Stop s:currentOSMStops) if (currentGTFSStops.contains(s) && currentGTFSStops.indexOf(s) <= currentOSMStops.indexOf(s)){ //equals }else{ currentOSMStopsMarker.add(s); } } osmStopList.repaint(); gtfsStopList.repaint(); }
8
public final void add( final int key, final T value){ if ( size == 0 ){ if (keys.length >0){ keys[0] = key; values[0] = value; } else{ keys = new int[]{key}; values = new Object[]{value}; } size = 1; return; } // Find index where to put it: final int index = closestIndex(key); int ref = keys[index]; if ( ref == key ){ values[index] = value; // size stays. return; } // TODO: (below) more efficient (contract). else if ( ref > key){ int k = index -1; while (k>=0){ if (keys[k] <key ) break; ref = keys[k]; k--; } // k should be one less than the index to add to addAtIndex( k+1, key, value); } else{ // ref < key int k = index + 1; while (k<size){ if (keys[k] >key ) break; ref = keys[k]; k++; } // k should be one greater than the index to add to addAtIndex( k, key, value); } }
8
public String buscarClientePorTelefono(String telefono){ //##########################CARGA_BASE DE DATOS############# tablaDeClientes(); //##########################INGRESO_VACIO################### if(telefono.equals("")){ telefono = "No busque nada"; return resultBusqueda = "Debe ingresar datos a buscar"; } int longitud = datos.size(); for(int i = 0; i<longitud;i++){ String TelefonoBuscado = datos.get(i).getTelefono(); if (TelefonoBuscado.equals(telefono)){ db_Temp.add(datos.get(i)); resultBusqueda = datos.get(i).getTelefono(); } } if (db_Temp.size()>0){ for (int j=0; j<db_Temp.size();j++){ System.out.println("SU BÚSQUEDA POR TELEFONO MUESTRA LOS SIGUIENTES RESULTADOS\t" + "\n"); mostrar(j); } }else{ resultBusqueda = "No se encontraron registros para los filtros ingresados"; } return resultBusqueda; }
5
private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed try { /* * Validity check */ if (!valid()) { return; } DateFormatter df = new DateFormatter(new SimpleDateFormat("dd/MM/yyyy")); InvoiceModel model = new InvoiceModel(); model.setDate(df.valueToString(datepicker.getDate())); String clientname = (String) clientBox.getSelectedItem(); Contact _client = Database.driver().getClientsAlphabetically().get(clientname.toLowerCase()); model.setClient(_client); model.setNumber(number); model.setItems(data); model.setPriceCode(pricecode); model.setSave(saving); FunctionResult<Invoice> res = model.create(); if (res.getCode() == 0 && res.getObj() != null) { delegate.addInvoice(res.getObj()); disposeLater(); } else { // switch case error code String msg; switch (res.getCode()) { case 1: msg = "Controleer of alle velden uniek zijn. Informatie van de databank:\n" + res.getMessage(); break; case 4: msg = res.getMessage(); break; default: msg = "Het toevoegen van het basisingrediënt is foutgelopen (code " + res.getCode() + "). Contacteer de ontwikkelaars met deze informatie."; } JOptionPane.showMessageDialog(null, msg, "Fout!", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { System.err.println("Error: \n" + e.getMessage()); JOptionPane.showMessageDialog(null, tools.Utilities.incorrectFormMessage, "Fout!", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btnSaveActionPerformed
6
private void addDataS(int nGaussians) { if (atomCoordBohr[atomIndex] == null) { moCoeff++; return; } if (doDebug) dumpInfo(nGaussians, "S "); int moCoeff0 = moCoeff; // all gaussians of a set use the same MO coefficient // so we just reset each time, then move on setMinMax(nGaussians); for (int ig = 0; ig < nGaussians; ig++) { moCoeff = moCoeff0; float alpha = gaussians[gaussianPtr + ig][0]; float c1 = gaussians[gaussianPtr + ig][1]; // (2 alpha^3/pi^3)^0.25 exp(-alpha r^2) float a = c1 * (float) Math.pow(alpha, 0.75) * 0.712705470f; a *= moCoefficients[moCoeff++]; // the coefficients are all included with the X factor here for (int i = xMax; --i >= xMin;) { EX[i] = a * gExp(-X2[i] * alpha); } for (int i = yMax; --i >= yMin;) { EY[i] = gExp(-Y2[i] * alpha); } for (int i = zMax; --i >= zMin;) { EZ[i] = gExp(-Z2[i] * alpha); } for (int ix = xMax; --ix >= xMin;) for (int iy = yMax; --iy >= yMin;) for (int iz = zMax; --iz >= zMin;) voxelData[ix][iy][iz] += EX[ix] * EY[iy] * EZ[iz]; } }
9
public LinkedList<Student> getAllStudent() { LinkedList<Student> ans = new LinkedList<Student>(); String select = "SELECT * FROM STUDENT"; try { ResultSet rs = stat.executeQuery(select); Student t; // ȡǰ Calendar now = Calendar.getInstance(); now.setTime(new java.util.Date()); final int year = now.get(Calendar.YEAR); // birthdaydz,yearȥݵõ Calendar birthday = (Calendar) now.clone(); while (rs.next()) { birthday.setTimeInMillis(rs.getDate("BIRTHDAY").getTime()); t = new Student(rs.getString("NO").trim(), rs.getString("NAME") .trim(), year - birthday.get(Calendar.YEAR), rs .getString("Sex").trim(), rs.getDate("BIRTHDAY"), rs .getString("ADDRESS").trim(), rs.getString("TEL") .trim(), rs.getString("EMAIL").trim()); ans.add(t); } } catch (SQLException e) { e.printStackTrace(); } return ans; }
2
private void logIfEnabled(String content) { if (!isChatLoggingEnabled) return; if (chatLogger == null) chatLogger = new FileLogger( getServerTab().getTabName(), getTabName() ); chatLogger.log(content); }
2
public void setLastArg(int argsToSkip_) { //Set the args to skip = to the args to skip plus previous arguments. int argsToSkip = argsToSkip_; //Form the final argument for (int i = argsToSkip; i < args.length; i++) { if (!args[i].equals("")) { if (i != argsToSkip) finalArgument += " " + args[i]; else finalArgument += args[i]; finalArgumentList.add(args[i]); } } }
3
final public void Class_body() throws ParseException { /*@bgen(jjtree) Class_body */ SimpleNode jjtn000 = new SimpleNode(JJTCLASS_BODY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Class_variable_declarations(); Class_function_declarations(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); jjtn000.jjtSetLastToken(getToken(0)); } } }
8
@Override public List<Integer> getHops(Integer start, Integer target) { NodePair pair = NodePair.get(getNode(start), getNode(target)); if(!distances.containsKey(pair) || distances.get(pair).isNonterminating()) return null; List<Integer> hops = new ArrayList<Integer>(); Integer current = start; while (!current.equals(target)) { hops.add(current); current = rule.getNextValue(current, target); } hops.add(target); return hops; }
3
public void run(){ while(true){ try { sleep(60000); } catch (InterruptedException e) { e.printStackTrace(); } GregorianCalendar fecha = new GregorianCalendar(); fecha.get(Calendar.DAY_OF_WEEK); for (int i = 0; i < rutinas.length; i++) for (int j = 0; j < 7; j++) if (rutinas[i].getDiaAlarma()[j] && rutinas[i].getHoraAlarma()[0] == fecha.get(Calendar.HOUR_OF_DAY) && rutinas[i].getHoraAlarma()[1] == fecha.get(Calendar.MINUTE)) JOptionPane.showMessageDialog(null, "Hora de rutina "+rutinas[i]); } }
7
public void connect1(TreeLinkNode root) { if (root == null) return; Queue<TreeLinkNode> curLev = new LinkedList<TreeLinkNode>(); curLev.add(root); while (!curLev.isEmpty()) { Queue<TreeLinkNode> nextLev = new LinkedList<TreeLinkNode>(); while (!curLev.isEmpty()) { TreeLinkNode cur = curLev.poll(); if (cur.left != null) nextLev.add(cur.left); if (cur.right != null) nextLev.add(cur.right); if (!curLev.isEmpty()) { TreeLinkNode curNext = curLev.peek(); if (curNext.left != null) nextLev.add(cur.left); if (curNext.right != null) nextLev.add(cur.right); cur.next = curNext; } } curLev = nextLev; } }
8
public static Vector2d valueOf(String arg) { Vector2d result = null; boolean goFlag = true; String tmp = ""; String strX = ""; String strY = ""; Scanner s1 = new Scanner(arg); if (goFlag) { tmp = s1.findInLine("\\s*\\(\\s*"); goFlag = (tmp != null); } if (goFlag) { strX = s1.findInLine(MdMath.NUMBER_FORMAT_REGEX); goFlag = (strX != null); } if (goFlag) { tmp = s1.findInLine("\\s*,\\s*"); goFlag = (tmp != null); } if (goFlag) { strY = s1.findInLine(MdMath.NUMBER_FORMAT_REGEX); goFlag = (strY != null); } if (goFlag) { tmp = s1.findInLine("\\s*\\)\\s*"); goFlag = (tmp != null); } if (goFlag) { try { double x = Double.parseDouble(strX); double y = Double.parseDouble(strY); result = new Vector2d(x,y); } catch (NumberFormatException e) { } } if (result == null) { throw new NumberFormatException(arg); } return result; }
8
public int hashCode() { return 13 * description.hashCode() + 17 * partNumber; }
0
public static List<String> keysForBounds(CSProperties csp, int boundCount) { List<String> l = new ArrayList<String>(); for (String key : csp.keySet()) { if (csp.getInfo(key).keySet().contains("bound")) { String bound = csp.getInfo(key).get("bound"); StringTokenizer t = new StringTokenizer(bound, ","); if (t.countTokens() == boundCount) { l.add(key); } } } return l; }
3
private int decodePacket(Packet packet) { // check the endianes of the computer. final boolean bigEndian = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN; if (block.synthesis(packet) == 0) { // test for success! dspState.synthesis_blockin(block); } // **pcm is a multichannel float vector. In stereo, for // example, pcm[0] is left, and pcm[1] is right. samples is // the size of each channel. Convert the float values // (-1.<=range<=1.) to whatever PCM format and write it out int convOff = 0; int samples; while ((samples = dspState.synthesis_pcmout(_pcm, _index)) > 0) { //System.out.println("while() 4"); float[][] pcm = _pcm[0]; int bout = (samples < convsize ? samples : convsize); // convert floats to 16 bit signed ints (host order) and interleave for (int i = 0; i < info.channels; i++) { int ptr = (i << 1) + convOff; int mono = _index[i]; for (int j = 0; j < bout; j++) { int val = (int) (pcm[i][mono + j] * 32767.); // might as well guard against clipping val = Math.max(-32768, Math.min(32767, val)); val |= (val < 0 ? 0x8000 : 0); convbuffer[ptr + 0] = (byte) (bigEndian ? val >>> 8 : val); convbuffer[ptr + 1] = (byte) (bigEndian ? val : val >>> 8); ptr += (info.channels) << 1; } } convOff += 2 * info.channels * bout; // Tell orbis how many samples were consumed dspState.synthesis_read(bout); } return convOff; }
8
@Test public void runTestListAccess1() throws IOException { InfoflowResults res = analyzeAPKFile("ArraysAndLists_ListAccess1.apk"); Assert.assertEquals(0, res.size()); }
0
public void render(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.black); g2.setStroke(new BasicStroke(1F)); int width = 20; for (int i = 0; i < this.board.getWidth(); i++) { // Draw horizontal lines g2.drawLine(0, width * (i + 1), width * this.board.getWidth(), width * (i + 1)); } for (int i = 0; i < this.board.getHeight(); i++) { // Draw vertical lines g2.drawLine(width * (i + 1), 0, width * (i + 1), width * this.board.getWidth()); } for (int row = 0; row < this.board.getHeight(); row++) { for (int col = 0; col < this.board.getWidth(); col++) { // Draw the pieces Player player = this.board.get(row, col); if (player != null) { char signature = player.getSignature(); Image image; if (signature == 'X') { image = imgX; } else { image = imgO; } g2.drawImage(image, width * col, width * row, this); } } } }
6
public int uniquePathsWithObstacles(int[][] obstacleGrid) { int rows = obstacleGrid.length; if (rows == 0) { return 0; } int cols = obstacleGrid[0].length; if (cols == 0) { return 0; } if (obstacleGrid[0][0] == 1) { return 0; } int[] pathsToRow = new int[cols]; int prev = 1; pathsToRow[0] = prev; for (int col = 1; col < cols; ++col) { if (obstacleGrid[0][col] == 1) { prev = 0; } pathsToRow[col] = prev; } for (int row = 1; row < rows; ++row) { if (obstacleGrid[row][0] == 1) { pathsToRow[0] = 0; } prev = pathsToRow[0]; for (int col = 1; col < cols; ++col) { if (obstacleGrid[row][col] == 1) { pathsToRow[col] = 0; } else { pathsToRow[col] += prev; } prev = pathsToRow[col]; } } return prev; }
9
public void run() { while (true) { try { String message = messages.take(); Iterator<Socket> iter = sockets.iterator(); while (iter.hasNext()) { Socket socket = iter.next(); try { OutputStream out = socket.getOutputStream(); PrintWriter writer = new PrintWriter(out); writer.println(message); writer.flush(); } catch (IOException e) { e.printStackTrace(); iter.remove(); } } } catch (InterruptedException e) { e.printStackTrace(); } } }
4
private int miniMax(Board board, char mark, int depth, int color, boolean max, int alpha, int beta) { char oppMark = getOppMark(mark); gameLogic = new BoardLogic(board); if(gameLogic.isOver() || depth == 7) return getGameScore(board, depth, mark) * color; else if(max) { ArrayList<Integer> emptySlots = board.getEmptySlots(); for (Integer emptySlot : emptySlots) { board.setMove(mark, emptySlot); alpha = Math.max(alpha, miniMax(board, oppMark, depth + 1, -color, !max, alpha, beta)); board.undoMove(emptySlot); if (alpha >= beta) break; } return alpha; } else { ArrayList<Integer> emptySlots = board.getEmptySlots(); for (Integer emptySlot : emptySlots) { board.setMove(mark, emptySlot); beta = Math.min(beta, miniMax(board, oppMark, depth + 1, -color, !max, alpha, beta)); board.undoMove(emptySlot); if (alpha >= beta) break; } return beta; } }
7
public String toString() { String theWholeDamnBoard = "";// temporary initialization. Hopefully I // remember to delete that one part of // it. // this is gonna be a reeeally long string. /* * The toString method's going to get called a lot. I'm thinking about a * few ways to create the board. The first is fairly one dimensional, * just printing the board with the squares, and the letters inside * them. * * the next is creating a square class, which stores what's inside of * it. It would hold 3 strings, each 3 characters, along with * coordinates, which would be parsed into one long string for each * side, then rinse and repeat, allowing for MEGAcheckers.\ actually, * since the bottom and top are the same, I can just repeat those. * * also, that means more classes. So I like it. */ // there's a better way to do this. // I changed it. for (int y = 0; y < FILE; y++) { for (int x = 0; x < RANK; x++) { theWholeDamnBoard += "|===|";// top thing. } theWholeDamnBoard += "\n"; for (int x = 0; x < RANK; x++)// and now using lots of string. // THere's a thing we did in class // taht I should have used called // stringbuffer. I'll use that when // I realize this was dumb, but // until then, this sin't cahngeing. { theWholeDamnBoard += theBoard[x][y]; } theWholeDamnBoard += " " + (y + 1); theWholeDamnBoard += "\n"; } for (int y = 0; y < RANK; y++) { theWholeDamnBoard += "|===|"; } theWholeDamnBoard += "\n"; for (int y = 0; y < RANK; y++) { theWholeDamnBoard += String.format("%3d ", (y + 1)); } theWholeDamnBoard += " <--put this number in first.\n"; return theWholeDamnBoard; }
5
@EventHandler public void GhastFireResistance(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("Ghast.FireResistance.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (damager instanceof Fireball) { Fireball a = (Fireball) event.getDamager(); LivingEntity shooter = a.getShooter(); if (plugin.getGhastConfig().getBoolean("Ghast.FireResistance.Enabled", true) && shooter instanceof Ghast && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, plugin.getGhastConfig().getInt("Ghast.FireResistance.Time"), plugin.getGhastConfig().getInt("Ghast.FireResistance.Power"))); } } }
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(VuePays.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(VuePays.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(VuePays.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(VuePays.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* * Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new VuePays().setVisible(true); } }); }
6
@Override public void serverMessageReceived(int code, String message) { if (code > 400 && code < 500) { message = message.split(" ", 2)[1]; appendError(message); final int ERR_NOMOTD = 422; AbstractTab tab = InputHandler.getActiveTab(); if ( code != ERR_NOMOTD && tab.getServerTab().equals(this) && !tab.equals(this) ) tab.appendError(message); } else { appendText( HTML.escapeTags(message) ); } }
5
public void setLocale(Object loc) throws JspTagException { if (loc == null || (loc instanceof String && ((String) loc).length() == 0)) { this.locale = null; } else if (loc instanceof Locale) { this.locale = (Locale) loc; } else { locale = Util.parseLocale((String) loc); } }
4
public QueryResultTable executeQueryForResult() throws DataBaseException { // result object QueryResultTable queryResult = new QueryResultTable(); // 2D arraylist for result table ArrayList<ArrayList<String>> resultTable = new ArrayList<ArrayList<String>>(); // hashmap for header details LinkedHashMap<String, String> headers = new LinkedHashMap<String, String>(); try { ResultSet rs = getPreparedStatement().executeQuery(); int colSize = rs.getMetaData().getColumnCount(); // setting header details. for (int i = 1; i <= colSize; i++) { headers.put(rs.getMetaData().getColumnLabel(i), rs.getMetaData().getColumnTypeName(i)); } if (headers.size() < 1) { log.warn("No columns(ColSize: " + colSize + ") were obtained from query"); } queryResult.setHeaderDetails(headers); ArrayList<String> rowData; while (rs.next()) { rowData = new ArrayList<String>(); for (int i = 1; i <= colSize; i++) { rowData.add(String.valueOf(rs.getObject(i))); } resultTable.add(rowData); } if (resultTable.size() < 1) { log.warn("No results(Result Count: " + resultTable.size() + " were obtained from query"); } } catch (SQLException e) { log.error("SQLException while executing query", e); throw new DataBaseException(e.getMessage(), e); } finally { try { dbConnection.close(); } catch (SQLException e) { log.error("SQLException while closing connection", e); throw new DataBaseException(e.getMessage(), e); } } queryResult.setResultTable(resultTable); return queryResult; }
7
public static void printQ(Queue queue) { while (queue.peek() != null) System.out.print(queue.remove() + " "); System.out.println(); }
1
public static List<Id> getUniqueIds(List<Id> ids) { Id[] idsArray = ids.toArray(new Id[ids.size()]); Arrays.sort(idsArray); List<Id> uniqueList = new ArrayList<Id>(); for (Id id : idsArray) { if (uniqueList.isEmpty() || (!id.equals(uniqueList.get(uniqueList.size() - 1)))) { uniqueList.add(id); } } return uniqueList; }
3
public int getReplicaLocation(String lfn) { if (lfn == null) { return -1; } int resourceID = -1; int eventTag = DataGridTags.CTLG_GET_REPLICA; // set tag name // consult with the RC first int rcID = getReplicaCatalogueID(); if (rcID == -1) { return -1; } // sends a request to this RC sendEvent(eventTag, lfn, rcID); // waiting for a response from the RC Sim_type_p tag = new Sim_type_p(DataGridTags.CTLG_REPLICA_DELIVERY); // only look for this type of ack Sim_event ev = new Sim_event(); super.sim_get_next(tag, ev); try { Object[] data = (Object[]) ev.get_data(); // get the data Integer resID = (Integer) data[1]; // get the resource ID if (resID != null) { resourceID = resID.intValue(); } } catch (Exception e) { resourceID = -1; System.out.println(super.get_name() + ".getReplicaLocation(): Exception"); } return resourceID; }
4
public CatalogHandler() throws SQLException { Pages = new HashMap<Integer, CatalogPage>(); Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_store_pages"); ResultSet CatalogPages = Grizzly.GrabDatabase().GrabTable(); while(CatalogPages.next()) { Pages.put(new Integer(CatalogPages.getInt("id")), new CatalogPage(CatalogPages)); } Items = new HashMap<Integer, CatalogItem>(); Grizzly.GrabDatabase().SetQuery("SELECT * FROM server_store_items"); ResultSet CatalogItems = Grizzly.GrabDatabase().GrabTable(); while(CatalogItems.next()) { Items.put(new Integer(CatalogItems.getInt("id")), new CatalogItem(CatalogItems)); } Grizzly.WriteOut("Loaded " + Items.size() + " catalog items for " + Pages.size() + " catalog pages!"); }
2
public boolean equals(Object object) { if (!(object instanceof NBTBase)) { return false; } else { NBTBase nbtbase = (NBTBase) object; return this.getTypeId() != nbtbase.getTypeId() ? false : ((this.name != null || nbtbase.name == null) && (this.name == null || nbtbase.name != null) ? this.name == null || this.name.equals(nbtbase.name) : false); } }
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RunAutomaton other = (RunAutomaton) obj; if (initial != other.initial) return false; if (maxInterval != other.maxInterval) return false; if (size != other.size) return false; if (!Arrays.equals(points, other.points)) return false; if (!Arrays.equals(accept, other.accept)) return false; if (!Arrays.equals(transitions, other.transitions)) return false; return true; }
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(NEATFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(NEATFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(NEATFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(NEATFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new NEATFrame().setVisible(true); } }); }
6
@Override public Object plugin(Object target) { if (reusePreparedStatements && target instanceof BatchExecutor) { target = replaceBatchExecutor((BatchExecutor) target); } if (reusePreparedStatements && target instanceof CachingExecutor) { try { Object delegate = cachingExecutorDelegate.get(target); if (delegate instanceof BatchExecutor) { cachingExecutorDelegate.set(target, replaceBatchExecutor((BatchExecutor) delegate)); } } catch (IllegalAccessException e) { throw new ExecutorException(MSG_ERROR_ACCESSING_DELEGATE, e); } } return target instanceof Executor ? Plugin.wrap(target, new UpdateSplitterPlugin(splitter, skipEmptyStatements)) : target; }
7
public final void setTotalHrsForYear(double totalHrsForYear) { if(totalHrsForYear < 0 || totalHrsForYear > 5000) { throw new IllegalArgumentException(); } this.totalHrsForYear = totalHrsForYear; }
2
public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) throws Exception { Move m = null; // placeholder for return value // this player selects randomly int direction = rand.nextInt(6); switch (direction) { case 0: m = new Move(STAYPUT); break; case 1: m = new Move(WEST); break; case 2: m = new Move(EAST); break; case 3: m = new Move(NORTH); break; case 4: m = new Move(SOUTH); break; case 5: direction = rand.nextInt(4); // if this organism will reproduce: // the second argument to the constructor is the direction to which the offspring should be born // the third argument is the initial value for that organism's state variable (passed to its register function) if (direction == 0) m = new Move(REPRODUCE, WEST, state); else if (direction == 1) m = new Move(REPRODUCE, EAST, state); else if (direction == 2) m = new Move(REPRODUCE, NORTH, state); else m = new Move(REPRODUCE, SOUTH, state); } return m; }
9
public String getSeatNumber() { return this._seatNumber; }
0
private int getDirectionID(Direction d) { switch(d) { case NORTH: return 0; case SOUTH: return 1; case EAST: return 2; case WEST: return 3; case NORTHEAST: return 4; case NORTHWEST: return 5; case SOUTHEAST: return 6; case SOUTHWEST: return 7; } return 0; }
8
public static InetAddress parseIpAddress(String ip) throws IllegalArgumentException { StringTokenizer tok = new StringTokenizer(ip, "."); if (tok.countTokens() != 4) { throw new IllegalArgumentException("IP address must be in the format 'xxx.xxx.xxx.xxx'"); } byte[] data = new byte[4]; int i = 0; while (tok.hasMoreTokens()) { String strVal = tok.nextToken(); try { int val = Integer.parseInt(tok.nextToken(), 10); if (val < 0 || val > 255) { throw new IllegalArgumentException("Illegal value '" + val + "' at byte " + (i + 1) + " in the IP address."); } data[i++] = (byte) Integer.parseInt(tok.nextToken(), 10); } catch (NumberFormatException e) { throw new IllegalArgumentException("Illegal value '" + strVal + "' at token " + (i + 1) + " in the IP address.", e); } } try { return InetAddress.getByAddress(ip, data); } catch (UnknownHostException e) { // This actually can't happen since the method InetAddress.getByAddress(String, byte[]) // doesn't perform any lookups and we have already guaranteed that the length of data is 4 throw new Error("UnknownHostException somehow thrown when creating an InetAddress", e); } }
6
@Override protected void render() throws Exception { glClearColor(0f, 0f, 0f, 1f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (this.currentScene != null) this.currentScene.render(); }
1
public static void main(String[] args) { Scanner scan = new Scanner(System.in); /* Creating object of AVLTree */ AVLTree avlt = new AVLTree(); System.out.println("AVLTree Tree Test\n"); char ch; /* Perform tree operations */ do { System.out.println("\nAVLTree Operations\n"); System.out.println("1. insert "); System.out.println("2. search"); System.out.println("3. count nodes"); System.out.println("4. check empty"); System.out.println("5. clear tree"); int choice = scan.nextInt(); switch (choice) { case 1 : System.out.println("Enter integer element to insert"); avlt.insert( scan.nextInt() ); break; case 2 : System.out.println("Enter integer element to search"); System.out.println("Search result : "+ avlt.search( scan.nextInt() )); break; case 3 : System.out.println("Nodes = "+ avlt.countNodes()); break; case 4 : System.out.println("Empty status = "+ avlt.isEmpty()); break; case 5 : System.out.println("\nTree Cleared"); avlt.makeEmpty(); break; default : System.out.println("Wrong Entry \n "); break; } /* Display tree */ System.out.print("\nPost order : "); avlt.postorder(); System.out.print("\nPre order : "); avlt.preorder(); System.out.print("\nIn order : "); avlt.inorder(); System.out.println("\nDo you want to continue (Type y or n) \n"); ch = scan.next().charAt(0); } while (ch == 'Y'|| ch == 'y'); }
7
protected void act() { if(state == -1) { doBehavior(new WaitMoveBehavior()); } else if(state == 0) { // On cherche a savoir si on es bien sur une ligne. if(Robot.getInstance().getEyes().onNoise()) { stop("I am not along a line !!"); } else { Robot.getInstance().getMotion().getPilot().arcForward(-radiusCalibration * left); } } else if(state == 1) { Robot.getInstance().getMotion().getPilot().arcForward(-radiusCalibration * left); if(Robot.getInstance().getOdometryPoseProvider().getPose().distanceTo(start.getLocation()) > distance) { Geometry.adjustHeading(); ActionFactory.stopMotion(true); stop("End"); } } else if(state == 2) { Robot.getInstance().getMotion().getPilot().arcForward(radiusCalibration * left); if(Robot.getInstance().getOdometryPoseProvider().getPose().distanceTo(start.getLocation()) > distance) { Geometry.adjustHeading(); ActionFactory.stopMotion(true); stop("End"); } } else if(state == 3) { Geometry.adjustHeading(); Geometry.adjustXBump(); stop("BUMP"); } }
8
public void heapDecKey(Vortex vortex, int dayDistance, double dayTravelDistance) { if (vortex.getDayDistance() < dayDistance) { return; } if (vortex.getDayDistance() == dayDistance && vortex.getDayTravelDistance() < dayTravelDistance) { return; } int i = 1; for (i=1; i<=length; i++) { //right upper limit? if (vortex.equals(heap[i])) { break; } } vortex.setDistance(dayDistance, dayTravelDistance); heapify(i); }
5
public void makeSegmentation(String type) { String request = ""; if(type.equals(SIMPLY_SEGM)) request = "Enter simply segments count"; else if(type.equals(ROUND_N_TIMES)) request = "Enter rounding count"; else if(type.equals(ROUND_TO_N_SEGM)) request = "Enter smart segments count"; Object result = JOptionPane.showInputDialog(this, request); try{ int r = Integer.parseInt((String) result); if (r > 255 || r < 0) return; if(type.equals(SIMPLY_SEGM)) imageProcessor.simplySegmentation(r); else if(type.equals(ROUND_N_TIMES)) imageProcessor.roundNAndSegment(r); else if(type.equals(ROUND_TO_N_SEGM)) imageProcessor.roundTillNSegments(r); } catch (Exception ignored) { } }
9
public FlatternerIterator(final T ancestor, final Selector<T, Iterable<T>> selector) { this._ancestor = ancestor; this._selector = selector; }
0
private int attaque(Soldat soldat){ int maxDegats = 0; /* Combat au CaC */ if (distance(soldat) == 1){ maxDegats = this.puissance; } /* Combat à distance */ else if (distance(soldat) <= portee) maxDegats = this.tir; /* L'ennemi est hors de portée */ else maxDegats = 0; // Jet de dégats sur 1d{maxDegats} int degats = (int) (Math.random() * maxDegats) + 1; return(degats); }
2
public double[] distributionForInstance(BayesNet bayesNet, Instance instance) throws Exception { Instances instances = bayesNet.m_Instances; int nNumClasses = instances.numClasses(); double[] fProbs = new double[nNumClasses]; for (int iClass = 0; iClass < nNumClasses; iClass++) { fProbs[iClass] = 1.0; } for (int iClass = 0; iClass < nNumClasses; iClass++) { double logfP = 0; for (int iAttribute = 0; iAttribute < instances.numAttributes(); iAttribute++) { double iCPT = 0; for (int iParent = 0; iParent < bayesNet.getParentSet(iAttribute).getNrOfParents(); iParent++) { int nParent = bayesNet.getParentSet(iAttribute).getParent(iParent); if (nParent == instances.classIndex()) { iCPT = iCPT * nNumClasses + iClass; } else { iCPT = iCPT * instances.attribute(nParent).numValues() + instance.value(nParent); } } if (iAttribute == instances.classIndex()) { // fP *= // m_Distributions[iAttribute][(int) iCPT].getProbability(iClass); logfP += Math.log(bayesNet.m_Distributions[iAttribute][(int) iCPT].getProbability(iClass)); } else { // fP *= // m_Distributions[iAttribute][(int) iCPT] // .getProbability(instance.value(iAttribute)); logfP += Math.log(bayesNet.m_Distributions[iAttribute][(int) iCPT].getProbability(instance.value(iAttribute))); } } // fProbs[iClass] *= fP; fProbs[iClass] += logfP; } // Find maximum double fMax = fProbs[0]; for (int iClass = 0; iClass < nNumClasses; iClass++) { if (fProbs[iClass] > fMax) { fMax = fProbs[iClass]; } } // transform from log-space to normal-space for (int iClass = 0; iClass < nNumClasses; iClass++) { fProbs[iClass] = Math.exp(fProbs[iClass] - fMax); } // Display probabilities Utils.normalize(fProbs); return fProbs; } // distributionForInstance
9
public static String getConstructorDescriptor(final Constructor c) { Class[] parameters = c.getParameterTypes(); StringBuffer buf = new StringBuffer(); buf.append('('); for (int i = 0; i < parameters.length; ++i) { getDescriptor(buf, parameters[i]); } return buf.append(")V").toString(); }
1
public void loadLevel(){ tileManager.clear(); ws.mechanismList.clear(); ws.circuitList.clear(); switch(ws.level){ case 0: // Load Map tileManager.loadMap(TileMaps.level0, 2, 2, TileMaps.TPlevel1); // Set Players ws.p1 = new Player(16, 16, true); ws.p2 = new Player(48, 48, false); break; case 1: // Load Map tileManager.loadMap(TileMaps.level1, 24, 12, TileMaps.TPlevel1); mechanismManager.loadMap(ws.mechanismList, ObjectMaps.level1, 24, 12); // Set Players ws.p1 = new Player(48, 208, true); ws.p2 = new Player(48, 176, false); // Load Circuits ws.circuitList.add(new ReverseOrDualCircuit(1)); ws.circuitList.add(new ReverseOrDualCircuit(2)); ws.circuitList.add(new ExitCircuit(3)); // Load Music ResourceManager.getMusic(TowerGame.BGM_LVL1).loop(); break; case 2: // Load Map tileManager.loadMap(TileMaps.level2, 26, 20, TileMaps.TPlevel2); mechanismManager.loadMap(ws.mechanismList, ObjectMaps.level2, 26, 20); // Set Players ws.p1 = new Player(48, 336, true); ws.p2 = new Player(48, 304, false); // Load Circuits ws.circuitList.add(new ExitCircuit(1)); ws.circuitList.add(new ExitCircuit(2)); break; case 4: // Load Map tileManager.loadMap(TileMaps.level4, 24, 22, TileMaps.TPlevel1); mechanismManager.loadMap(ws.mechanismList, ObjectMaps.level4, 24, 22); // Set Players ws.p1 = new Player(48, 368, true); ws.p2 = new Player(48, 336, false); // Load Circuits ws.circuitList.add(new ExitCircuit(1)); ws.circuitList.add(new OneTimeOnSingleCircuit(2)); ws.circuitList.add(new OneTimeOnSingleCircuit(3)); ws.circuitList.add(new OnCircuit(4)); ws.circuitList.add(new AndQuadCircuit(5)); ws.circuitList.add(new OneTimeOnSingleCircuit(6)); ws.circuitList.add(new IfPressedCircuit(7)); ws.circuitList.add(new OneTimeOnSingleCircuit(8)); ws.circuitList.add(new ReverseIfPressedCircuit(9)); ws.circuitList.add(new IfPressedCircuit(10)); ws.circuitList.add(new ReverseIfPressedCircuit(11)); ws.circuitList.add(new ReverseIfPressedCircuit(12)); ws.circuitList.add(new OneTimeOnSingleCircuit(13)); ws.circuitList.add(new OneTimeOnSingleCircuit(14)); ws.circuitList.add(new OneTimeOnSingleCircuit(15)); ws.circuitList.add(new ExitCircuit(16)); break; case 3: // Load Map tileManager.loadMap(TileMaps.level3, 23, 17, TileMaps.TPlevel1); mechanismManager.loadMap(ws.mechanismList, ObjectMaps.level3, 23, 17); // Set Players ws.p1 = new Player(48, 336, true); ws.p2 = new Player(48, 304, false); // Load Circuits ws.circuitList.add(new ReverseOrDualCircuit(1)); ws.circuitList.add(new ReverseOrDualCircuit(2)); ws.circuitList.add(new ReverseOrDualCircuit(3)); ws.circuitList.add(new ReverseOrDualCircuit(4)); ws.circuitList.add(new ReverseOrDualCircuit(5)); ws.circuitList.add(new ExitCircuit(6)); ws.circuitList.add(new ReverseOrDualCircuit(7)); // Load Music //ResourceManager.getMusic(TowerGame.BGM_LVL1).loop(); break; } if (TowerGame.player1) { player = ws.p1; otherPlayer = ws.p2; } else { player = ws.p2; otherPlayer = ws.p1; } // Remove blank tiles tileManager.removeExtras(); // Set Camera camera = TileUtil.toIso(player.getPosition()); camera.x = -camera.x + 368; camera.y = -camera.y + 262; initSpecialTiles(); }
6
public static void main(String[] args) { ArrayList <Destination>WorkAddresses = new ArrayList(); ArrayList <Destination>HomeAddresses = new ArrayList(); Destination home = new Destination("80 Balcombe Road Mentone VIC 3194",false,true,false); Destination workHQ = new Destination("35 Koornang Road Scoresby VIC 3179",false,false,true); //HomeAddresses.add(new Destination("Monash University Caulfield Melbournce VIC 3145",false,true,false)); HomeAddresses.add(new Destination("5 Warley Road Malvern East VIC 3145",false,true,false)); WorkAddresses.add(new Destination("800 Stud Road Scoresby VIC 3179",false,false,true)); WorkAddresses.add(new Destination("9 Helen Kob Drive Braeside VIC 3195",false,false,true)); WorkAddresses.add(new Destination("47 Robinson St,Dandenong VIC 3175",true,false,false)); UserInput ui = new UserInput(home,workHQ,WorkAddresses,HomeAddresses,true); RouteRepository repo = ui.DistinctRoutes(50); repo.UpdateRouteDistances(); //repo.print(); System.out.println("Net Distinct Routes : " + repo.GetSize()); repo = ui.ProfileRouteRepository(repo, 3); ArrayList<Double> loadingList = new ArrayList(); loadingList.add(50.00); loadingList.add(80.00); loadingList.add(100.00); repo.SetGroupLoading(loadingList); // // repo.AllocateRandomFrequencies(); // DateTimeFormatter dstrFmt = DateTimeFormat.forPattern("dd-MMM-yyyy"); DateTime startOn = dstrFmt.parseDateTime("1-Aug-2013"); DateTime endOn = dstrFmt.parseDateTime("31-Oct-2013"); // UserLimitations ul = new UserLimitations(false); // LogGenerator lg = new LogGenerator(repo, startOn,endOn,ul,"DIST"); lg.Allocate(); // ExportToExcel exporter = new ExportToExcel("TestExport"); exporter.ExportRoutes("RouteList", repo.GetRouteList()); exporter.ExportLogBook("LogBook", lg.GetRecords(),10000,15000); exporter.CommitWorkBook(); for(Double d : loadingList) { System.out.println(" Item at : " + loadingList.indexOf(d) + " - " + d); } int countIncrement = 0 ; ArrayList<Double> itr = loadingList; boolean upd = false; int setIncr = -10; for(int i=0;i<10;i++) { upd = false; for(Double d : itr) { if(d < 100 && upd == false && d+setIncr > 0) { itr.set(itr.indexOf(d), d + setIncr); upd = true; countIncrement = itr.indexOf(d); } if( d == 0 && upd == false) { setIncr = 10; } } for(Double d : itr) { System.out.println(" Item at : " + loadingList.indexOf(d) + " - " + d); } } }
9
public Dealer(int staylvl) { super(staylvl); shuffledDeck = ShuffleDeck(shuffledDeck); //setHold(17);//This could bypass the inherited constructor from player and just sets the dealer to stay on 17. //Though this can also be ignored/removed if the dealer is always constructed with 17 from calling method. }
0
public void endElement(String uri, String localName, String qName) throws SAXException { if (qName.equals("type")) { tempMove.type = tempStr; } else if (qName.equals("class")) { tempMove.damageClass = tempStr; } else if (qName.equals("power")) { tempMove.power = Integer.parseInt(tempStr); } else if (qName.equals("accuracy")) { tempMove.accuracy = (int) (Double.parseDouble(tempStr) * 100); } else if (qName.equals("pp")) { tempMove.maxPp = tempMove.pp = Integer.parseInt(tempStr); } else if (qName.endsWith("target")) { tempMove.target = tempStr; } else if (qName.equals("move")) { m_moves.add(tempMove); } }
7
public void createPlayer(String player, String connection) throws SQLException { sql.initialise(); if(plugin.globalDefault){ sql.standardQuery("INSERT INTO BungeePlayers (PlayerName, DisplayName, Current, LastOnline, IPAddress) VALUES ('"+player+"','"+player+"','Global', CURDATE(), '"+connection+"')"); }else{ sql.standardQuery("INSERT INTO BungeePlayers (PlayerName, DisplayName, Current, LastOnline, IPAddress) VALUES ('"+player+"','"+player+"',NULL, CURDATE(), '"+connection+"')"); } if(plugin.chatEnabled){ getChatPlayer(player); } sql.closeConnection(); }
2
public final TLParser.addExpr_return addExpr() throws RecognitionException { TLParser.addExpr_return retval = new TLParser.addExpr_return(); retval.start = input.LT(1); Object root_0 = null; Token set121=null; TLParser.mulExpr_return mulExpr120 = null; TLParser.mulExpr_return mulExpr122 = null; Object set121_tree=null; try { // src/grammar/TL.g:159:3: ( mulExpr ( ( '+' | '-' ) mulExpr )* ) // src/grammar/TL.g:159:6: mulExpr ( ( '+' | '-' ) mulExpr )* { root_0 = (Object)adaptor.nil(); pushFollow(FOLLOW_mulExpr_in_addExpr1128); mulExpr120=mulExpr(); state._fsp--; adaptor.addChild(root_0, mulExpr120.getTree()); // src/grammar/TL.g:159:14: ( ( '+' | '-' ) mulExpr )* loop23: do { int alt23=2; int LA23_0 = input.LA(1); if ( ((LA23_0>=Add && LA23_0<=Subtract)) ) { alt23=1; } switch (alt23) { case 1 : // src/grammar/TL.g:159:15: ( '+' | '-' ) mulExpr { set121=(Token)input.LT(1); set121=(Token)input.LT(1); if ( (input.LA(1)>=Add && input.LA(1)<=Subtract) ) { input.consume(); root_0 = (Object)adaptor.becomeRoot((Object)adaptor.create(set121), root_0); state.errorRecovery=false; } else { MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } pushFollow(FOLLOW_mulExpr_in_addExpr1140); mulExpr122=mulExpr(); state._fsp--; adaptor.addChild(root_0, mulExpr122.getTree()); } break; default : break loop23; } } while (true); } retval.stop = input.LT(-1); retval.tree = (Object)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { } return retval; }
7