text
stringlengths
14
410k
label
int32
0
9
@Override public StatusType getInput(Object object) { StatusType status = StatusType.PLAYING; do { try { this.display(); //displays the display method from this class //get the input command entered by user String input = this.getCommand()...
4
@Override public void render() { if (!enabled && grayOnDisable) Color.gray.bind(); super.render(); glEnable(GL_BLEND); int fac = 8; TextureImpl.bindNone(); color.bind(); RenderAssistant.drawRect(x + fac, y + fac, width - fac * 2, height - fac * 2); glColor4f(1, 1, 1, 0.5f); RenderAssistant.bind...
4
private void moisture(double[][] array, boolean[][] water, int x, int y) { if (water[x][y]) { calc[x][y] = 6.0; for (int k = 1; k < 4; k++) { ArrayList<Object[]> a = getNearbyRegions(array, x, y, k); for (Object[] r : a) if (r != null && !(array[x][y] > 0.5)) { double m = calc[x][y] * (1.0 / ...
6
private void cargarProgramaDesdeFichero(){ // Si estamos en medio de una ejecución paso a paso, finalizarla if (ejecucionSBS) accionParar(true); // Comprobamos los cambios en el fichero actual antes de cargar uno nuevo comprobarCambios("Antes de cargar otro programa...", "¿Desea guardar los cambio...
7
public Clinic(){ session[0] = new GregorianCalendar(); session[1] = new GregorianCalendar(); session[2] = new GregorianCalendar(); session[3] = new GregorianCalendar(); nonPeakHr[0] = new GregorianCalendar(); nonPeakHr[1] = new GregorianCalendar(); nonPeakHr[2] = new GregorianCalendar(); nonPeakHr[3] = ...
0
@Override public User findUserByUserIdAndGroupId(int userId, int groupId) { User user = null; Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatement(QTPL_SELECT_BY...
5
public void create(PypAdmAgend pypAdmAgend) { if (pypAdmAgend.getPypAdmAsistConList() == null) { pypAdmAgend.setPypAdmAsistConList(new ArrayList<PypAdmAsistCon>()); } EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); ...
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage("This command can only be run by a...
9
public boolean hasBlank(Object... values) { int length = ArrayUtil.getLength(values, true); do { if (isBlank(values[--length])) { return true; } } while (length > 0); return false; }
2
public boolean promptPermissionsGood() { if(badMods.getSize() > 0 || unknownMods.getSize() > 0) { StringBuilder bldr = new StringBuilder(); if(badMods.getSize() > 0) { bldr.append(badMods.getSize()); if(badMods.getSize() == 1) { bldr.append(" mod has missing permission\n"); } else { bldr.a...
7
public void delete(String table, int id) throws Throwable { try { if(!table.equals("")) { Statement st = con.createStatement(); String query = "DELETE FROM "+table+" WHERE id='"+id+"'"; // System.out.println(query); st.executeUpdate(query); st.close(); } } ...
2
private static int doRecurringEvents( int firedEvents, long startTime ) { // fire all of the recurring events for ( Event e : recurringEvents ) { if ( TimeHelper.isOver( startTime, MaxTickTime ) ) { return firedEvents; // we've run out of time for thi...
6
public boolean isSuperOrThis() { ClassInfo clazz = getClassInfo(); if (clazz != null) { return clazz.superClassOf(methodAnalyzer.getClazz()); } return false; }
1
public void removeObject(SimObject object) { if (object instanceof Gate) { boolean hasGate = false; for (SimObject obj : this.allObjects) { if (obj instanceof Gate && obj != object) hasGate = true; } this.myComponent.setGateCreated(hasGate); this.myComponent.updateLevelButton(); } else if (obje...
7
private void afficherPageErreur(String erreur) { File fichierErreur; switch (erreur) { case "ERREURREQUETE"://400 fichierErreur = new File("FichierServeur/400_Serveur_web.html"); break; case "INTERDIT"://403 ...
4
public static void main(String[] args) { int pnum, budget, hotels, weeks, pcost = 0; Scanner inputScanner = new Scanner(System.in); while (inputScanner.hasNext()) { pnum = inputScanner.nextInt(); budget = inputScanner.nextInt(); hotels = inputScanner.nextInt(); weeks = inputScanner.nextInt(); int m...
7
public void toArgb(int[] dest, short r, short g, short b, int div) { assert dest.length >= w * h; for (int i = w * h - 1; i >= 0; --i) { short sr = (short) (this.r[i] * r / div); short sg = (short) (this.g[i] * g / div); short sb = (short) (this.b[i] * b / div); if( sr < 0 || sr > 255 ) sr = 255; ...
7
synchronized public void computeNewToDosAndEnd(BlockTuple newBlocks,Block splitted,Block notSplitted){ //Füge zuerst in HashSet ein und vereinige died mit toDoList //sonst iterator überschreiben HashSet<BlockTuple> toAdd = new HashSet<BlockTuple>(); HashSet<BlockTuple> toDel = new HashSet<BlockTuple>(); Bloc...
7
public String nextToken() throws Exception { if( sToken.hasMoreTokens()) return sToken.nextToken().trim(); while(true) { String nextLine = reader.readLine(); //System.out.println(nextLine); while( nextLine != null && nextLine.startsWith("#")) nextLine = reader.readLine(); if( nextLi...
6
public void keyPressed (KeyEvent e) { int keyCode = e.getKeyCode (); if (model.running) { switch (keyCode) { case KeyEvent.VK_UP: model.changeDirection (SnakeModel.UP); break; case KeyEvent.VK_DOWN: ...
9
public static S3Object[] listAllObjects(RestS3Service s3, String bucketName) { S3Object[] s3Re = null; try { s3Re = s3.listObjects(bucketName); } catch (S3ServiceException e) { e.printStackTrace(); } return s3Re; }
1
void readEnclosingMethodAttr(Symbol sym) { // sym is a nested class with an "Enclosing Method" attribute // remove sym from it's current owners scope and place it in // the scope specified by the attribute sym.owner.members().remove(sym); ClassSymbol self = (ClassSymbol)sym; ...
9
public String mapToXml(Map<Object, Object> map, Element element) { for (Map.Entry<Object, Object> entry : map.entrySet()) { System.out.println(entry.getKey()); if (entry.getValue() instanceof Map) { Element e = element.addElement(entry.getKey().toString()); mapToXml((Map<Object, Object>) entry.getValue...
2
@Override public void decode(final ByteBuffer buf, final int available, final StringBuilder log) throws Exception { final int len = buf.get() & 0x7F; if (len > available-1) throw new Exception("String length of " + len + " exceeds remaining data (" + (available-1) + " bytes)"); final byte[] raw = new byte[le...
3
private void manip(final StackExpr[] source, final StackExpr[] target, final int[] s) { for (int i = 0; i < s.length; i++) { prop(target[i], source[s[i]]); } }
1
protected void changeRegistrySettings(boolean ensureCleanSession, boolean avoidProxy) throws IOException { log.info("Modifying registry settings..."); HudsuckrSettings settings; if (oldSettings == null) { backupHudsuckrSettings(); } if (!customPACappropriate) { String proxyServer = ...
8
private void refreshContestantCBs() { GameData g = (GameData) GameData.getCurrentGame(); if (g == null) { return; } List<Contestant> cons = g.getActiveContestants(true); if (g.doesElimExist()) { Contestant t = g.getElimCont(); if (!cons.contains(t)) { cons.add(t); Collections.sort(cons...
5
public void actionPerformed(ActionEvent e) { Grammar g = environment.getGrammar(); if (g == null) return; hypothesizeLambda(environment, g); }
1
public void setNeighbors( int[] truckdrivin){ //System.out.println(truckdrivin.length); //System.out.println(neighborstate.length); for(int g = 0; g <= truckdrivin.length-1; g++){ switch(inmode){ case 0: break; case 1: if(truckdrivin[g] > 0){neighborstate[g] = 1;} else{neighborstate[g] = 0;} brea...
5
public void update() { List<Entity> entities = level.getallEntities(); for (int i = 0; i < entities.size(); i++) { if (entities.get(i) instanceof Zombie) { Zombie current = (Zombie) entities.get(i); //creates 16x16 "hitbox" if (x < current.getX() + 17 && x > current.getX() - 17 && y < current.getY() ...
7
@Override protected void doGet(Request request) throws ServletException, IOException, SQLException, IllegalArgumentException, IllegalAccessException { if (!request.getSession().isLoggedIn()) throw new LoginRequiredException(); request.printHeader(); final PrintWriter writer = request.getWriter(); writer...
8
private void loadfromFile(String problemPath) { try { DataInputStream in = new DataInputStream(new FileInputStream( problemPath)); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; boolean firstLine = true; int i = 0; int j = 0; while ((line = br.readLine()) != ...
8
public void testPropertyCompareToYear() { YearMonthDay test1 = new YearMonthDay(TEST_TIME1); YearMonthDay test2 = new YearMonthDay(TEST_TIME2); assertEquals(true, test1.year().compareTo(test2) < 0); assertEquals(true, test2.year().compareTo(test1) > 0); assertEquals(true, test1.y...
2
public void paintComponent(Graphics g) { super.paintComponent (g); if (acList == null) { return; } left = 0; right = this.getWidth(); delta = (right - left - inset*2) / numIntervals; // Background. Dimension D = this.getSize (); g.setColor (Color.white); g.fillRect ...
7
public boolean checkIfJibberish() { boolean suitCorrect = false; boolean ctCorrect = false; for (String s: SUITS){ if (s.equals(suit)){ suitCorrect = true; break; } } for (char c: CARD_TYPES){ if (c == cardType){ ctCorrect = true; break; } } if (suitCorrect && ctCorrect) { r...
6
public void oneSpanningTree(mxAnalysisGraph aGraph, boolean forceConnected, boolean forceSimple) throws StructuralException { mxGraph graph = aGraph.getGraph(); boolean isSimple = mxGraphStructure.isSimple(aGraph); boolean isConnected = mxGraphStructure.isConnected(aGraph); if (!isSimple) { if (forceSim...
6
public static void main(String[] args) { //////////////////////////////////////////////////// /* GLOBAL VARIABLES */ int n=12; //12 by default int m=4; //4 by default int b=8; //8 by default /* HANDLES CLI ARGUMENTS */ //Usage: java ProcessSimulation.java processes(n) cpu's(m) if(args.length>2){ Sy...
9
public synchronized boolean[][] processImage(BufferedImage image, double threshold) { return threshold(findEdges(graySmooth(image)), threshold); }
0
@Override public void mouseClicked(MouseEvent e) { if (e.getComponent().getName().equals("chatline")) { inputChat.setText(""); } else if (e.getComponent().getName().equals("username")) { userName.setText(""); } else if (e.getComponent().getName().equals("audio-toggle")) { JToggleButton temp; temp = (...
9
boolean matchesIgnoreCase(String seq) { int scanLength = seq.length(); if (scanLength > length - pos) return false; for (int offset = 0; offset < scanLength; offset++) { char upScan = Character.toUpperCase(seq.charAt(offset)); char upTarget = Character.toUppe...
3
public int numTrees(int n) { if (n <= 0) return 0; if (n == 1) return 1; int result = 0; for (int i = 1; i <= n; i++) { if (i == 1 || i == n) result += numTrees(n - 1); else result += numTrees(i - 1) * numTrees(n - i); } return result; }
5
public ListNode detectCycle(ListNode head) { if (head == null) return null; ListNode fast = head, slow = head; while (true) { slow = slow.next; fast = fast.next; if (fast != null) fast = fast.next; if (slow == null || fa...
8
void go() { callbackReference.increment(); }
0
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); fillFactorial(20); l = new int[27]; while ((line = in.readLine()) != null && line.length() != 0) { int size = In...
5
public String[] getStartWords(){ String[] sw = new String[sentences.size()]; Iterator<String[]> it = sentences.iterator(); int index = 0; while(it.hasNext()){//For each sentence String[] sentence = it.next(); if(sentence.length > 0){ sw[index++] = sentence[0]; } } return sw; }
2
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_S: { downPressed=true; } break; case KeyEvent.VK_W: { upPressed=true; } break; case KeyEvent.VK_D: { rightPressed=true; } break; case KeyEvent.VK_A: {...
4
public static boolean isFullHelm(int itemID) { for (int i=0; i<fullHelm.length; i++) if (fullHelm[i] == itemID) return true; return false; }
2
public void removeObject(PhysicalObject paramPhysicalObject) { Vector localVector; int i; if (this.Loopers.contains(paramPhysicalObject)) { localVector = paramPhysicalObject.getLoopList(); for (i = 0; i < localVector.size(); i++) { String str = (String)localVector.elementAt(...
4
private static void testInvalidNode(ListNode p) { System.out.println("p.isValidNode() should be false: " + p.isValidNode()); try { p.item(); System.out.println("p.item() should throw an exception, but didn't."); } catch (InvalidNodeException lbe) { System.out.println("p.item() should throw...
7
public Stats getExamStats() { Stats stats = new Stats(); checkField(baHead, stats, 12); checkField(baChest, stats, 12); checkField(baAbdomen, stats, 12); checkField(baNeck, stats, 12); checkField(baBack, stats, 12); checkField(baGenitaliaGroinButtocks, stats, 12); checkFi...
8
@Test public void testFilterGreyScale() { ImageFactory imageFactory = new ImageFactory(); IImage iim = imageFactory.createImage("/images/megaman.gif"); iim.filterGreyScale(1); try{ PixelGrabber grab1 = new PixelGrabber(iim.getImageObject(), 0, 0, -1, -1, true); grab1.grabPixels(); int[] data = (int[])...
4
private String nameOfType(Java7Parser.LocalVariableDeclarationContext ctx) { // System.out.println(ctx.getText()); if (ctx.getChild(1).getChild(0).getChild(2) == null) return "-1"; // System.out.println(ctx.getChild(1).getChild(0).getChild(2).getChild(0).getChild(0).getText()); String tmp = ctx.getChild(1).g...
4
void putCharacter(int x, int y, ScreenCharacter character) { synchronized(mutex) { if(y < 0 || y >= backbuffer.length || x < 0 || x >= backbuffer[0].length) return; //Only create a new character if the if(!backbuffer[y][x].equals(character)) ...
5
private AssociationList genAssocData(int aiNumOfRecs) { AssociationList laAssocList = new AssociationList(); for (int i = 0; i < aiNumOfRecs; i++) { // Build the Association Association laAssoc = new Association(); laAssoc.setRegistrantNum("tst_" + i); laAssoc.setEpc("epc_" + i); laAssoc.setKill(...
1
@Override public void collectStats(SegmentEventRecoder recorder, StringBuilder builder) { if (AFS) { int[] freq = getFrequencySpectrum(recorder); lastAFS=freq; Util.arrayAdd(gloabalAFS, freq); if (!onlySummary) { builder.append("AFS: "); for (int i = 0; i < freq.length; i++) { builder.append...
8
public void addListeners() { // event listeners added to buttons // ------------------------------------------ // this method sets the description textArea to the generic info of the // bird -----can add anything else we want in this area // ------------------------------------------ descriptionButton.addA...
7
public void printAuctions(){ for( int i = 0; i < this.getAuctionsList().size(); i++){ System.out.println(this.getAuctionsList().get(i).toString() + "\n\n"); } }
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); List<Role> roles = rfl.findAll(); try (PrintWriter out = response.getWriter()) { ...
1
private void askForNewGame() { int hor = 0; int ver = 0; while (hor < 10 || ver < 10) { GridSizeDialog dialog = new GridSizeDialog(); int answer = dialog.show(); if (answer == JOptionPane.CANCEL_OPTION) { System.exit(0); } else if (answer == JOptionPane.OK_OPTION) { try { hor = dialog.get...
5
private Caption parseDialogueForASS(String[] line, String[] dialogueFormat, float timer, TimedTextObject tto) { Caption newCaption = new Caption(); for (int i = 0; i < dialogueFormat.length; i++) { String trimmedDialogueFormat = dialogueFormat[i].trim(); //we go through every format parameter and save t...
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
7
public int getX() { return x; }
0
@GET @Path("/v2.0/subnets/{subnetId}") @Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF}) public Response showSubnet(@PathParam("subnetId") String subnetId, @HeaderParam("Accept") String accept) throws MalformedURLException, IOException{ if (accept.equals(OpenstackNetProxyConstants.TYPE_R...
1
private void verificarSeleccionParametricasMedidor() { if (puntoLuz.getMedidorEnergia().getFabricante().getId() == 0) { puntoLuz.getMedidorEnergia().setFabricante(null); } if (puntoLuz.getMedidorEnergia().getTipoMedidor().getId() == null) { puntoLuz.getMedidorEnergia().s...
9
private void endGame(boolean won) { for(int row = 0; row < rows; row++) { for(int col = 0; col < cols; col++) { JButton button = buttonGrid[row][col]; if(base.getSquare(row, col).getIsAMine()) { button.setText("M"); if(won) { button.setBackground(Color.green); ...
5
private void addDelta(int x, int y, Color newC) { Delta d = new Delta(x, y, colorArr[x][y], newC); if (!d.amUseless()) { dMap.add(d); } }
1
private void prepare() { int counter = 0; for (int u = 0; u < 4; u++) { for (int i = 0; i < 5; i++) { colorCont = Greenfoot.getRandomNumber(2) + 1; sizeCont = Greenfoot.getRandomNumber(2) + 1; colorCont2 = Greenfoot.getRandomNumber(2) + 1; ...
6
private boolean loadItem(Collection<RobotSpecification> battlingRobotsList, RobotSpecification spec, IRobotSpecItem item, int teamNum) { String teamId = String.format("%4d", teamNum); if (item != null) { if (item.isTeam()) { teamId = item.getFullClassNameWithVersion() + "[" + teamId + "]"; final Collect...
8
@Override public void moveInto(GameEntity target) { if (target == GamePanel.get().getPlayer()) { // Only attack the target if it's the GamePanel.get().getPlayer() ((Actor) target).applyDamage(attack((Actor) target), this); } else { // Else, try to move around the ...
8
private List<Object> generateFactOrRule(Map<String, spindle.core.dom.Rule> factsOrRules) { List<Object> factOrRule = new ArrayList<Object>(); Object obj = null; for (spindle.core.dom.Rule rule : factsOrRules.values()) { switch (rule.getRuleType()) { case FACT: spindle.core.dom.Literal headLiteral = rule...
7
static LinkedListNode addReverse(LinkedListNode a, LinkedListNode b) { LinkedListNode resultHead = null; LinkedListNode resultTail = null; boolean hasCarrier = false; int tmp, tmpa, tmpb; while (a != null || b != null) { if (a != null) { tmpa = a.getVa...
8
public void visit_isub(final Instruction inst) { stackHeight -= 2; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
1
public static void main(String[] args) { // Field[] fields = CompanyA.class.getDeclaredFields(); // for (Field f : fields) { // Class t = f.getType(); // System.out.println("field name : " + f.getName() + " , type : " + t); // } // List<String> list = getFieldNameWithListDataType(); for(String data ...
1
public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] mas = new int[n]; in.nextLine(); for (int i = 0; i < n; i++) { mas[i] = in.nextInt(); } Arrays.sort(mas); for (int i : mas) { System.out.println(i); } }
2
public static void main(String[] args) { String filename; Scanner input = new Scanner(System.in); System.out.print("Enter name of file/directory "); System.out.print("or press <Enter> to quit: "); filename = input.nextLine(); while (!filename.equals("")) { File fileDir = new File(filename); if (!fileD...
7
public BufferedImage redRGBFilter() { this.redImage = originalImage; Color actualPixel; int actualRedValue; int actualGreenValue; int actualBlueValue; float numberOfRedPixels = 0f; for (int i = 0; i < originalImage.getWidth(); i++) { for (int j = 0; j < originalImage.getHeight(); j++) { actualPixel...
9
private void saveExperiment() { int returnVal = m_FileChooser.showSaveDialog(this); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } File expFile = m_FileChooser.getSelectedFile(); // add extension if necessary if (m_FileChooser.getFileFilter() == m_ExpFilter) { if (!e...
8
public Reply fetchDataConnectionReply() throws FileNotFoundException, IOException { ReplyWorker worker = new ReplyWorker(getDataSocket(), this); worker.start(); while (worker.getStatus() == ReplyWorker.UNKNOWN) { try { Thread.sleep(20); } catch...
4
private void startFrame(final int offset, final int nLocal, final int nStack) { int n = 3 + nLocal + nStack; if (frame == null || frame.length < n) { frame = new int[n]; } frame[0] = offset; frame[1] = nLocal; frame[2] = nStack; frameIndex = 3; }
2
public void printLocalDictionaryInfo() { if (_localDictionary == null) { System.out.println(_className + ": Local dictionary is not available."); return; } System.out.println(_className + ": Local dictionary from files: "); String value = null; ...
7
private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed if (existeOrdemServicoSelecionada() && super.exclusaoConfirmada()) { try { excluir(); } catch (ValidacaoException ex) { JOptionPane.showMess...
3
public static void main(String[] args) { int x = 1, y = 1; int a = 0, b = 0; x++; ++y; System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y); //a = 0, b = 0, x = 2, y = 2 a = x++; b = ++y; System.out.println("a = " + a + ", b = " + b + ", x = " + x + ", y = " + y); //a = 2, b = 3, x = 3,...
0
public static double [][] getDensityData(String input_file_name) { Workbook wrk1; try { wrk1 = Workbook.getWorkbook(new File(input_file_name)); Sheet sheet1 = wrk1.getSheet(0); int rows=sheet1.getRows(); double [][] data = new double [315][98]; for (int h = 0; h < 315; h++) { for (int w = 0; w...
6
int getNumOpenSets(Space space) { int num = 0; if (isOpenForPiece(board[space.pos[0]], space.piece)) num++; if (isOpenForPiece(getColumn(space.pos[1]), space.piece)) num++; if (space.diagID % 2 == 0 && isOpenForPiece(getTopDownDiag(), space.piece)) num++; if (space.diagID % 3 == 0 && isOpenFo...
6
public void testGetValue_int() { LocalTime test = new LocalTime(10, 20, 30, 40, COPTIC_PARIS); assertEquals(10, test.getValue(0)); assertEquals(20, test.getValue(1)); assertEquals(30, test.getValue(2)); assertEquals(40, test.getValue(3)); try { test.getValue(-...
2
public int produceScore( User u , JobPosting jp ){ int totalScore = 0; if(u.getFullTime() == jp.getFullTime()) totalScore++; if(u.getAreaOfInterest().equals(jp.getJobType())) totalScore++; Set<String> userSet = u.getUserKeywords(); Set<String> jobSet = jp.getKeywords(); for(String use...
5
private void hentSager() { String cpr = cpr_textField.getText(); if (cpr.length() == 10) { if (sLEHandler.checkPersonExists(cpr)) { sager_table.setEnabled(true); ArrayList<Sag> sager = sLEHandler.sogCPR(cpr, false); if (!sager.isEmpty()) { ...
6
private OptionDescriptor findAndRemoveNonOptionsSpec( Collection<? extends OptionDescriptor> options ) { for ( Iterator<? extends OptionDescriptor> it = options.iterator(); it.hasNext(); ) { OptionDescriptor next = it.next(); if ( next.representsNonOptions() ) { it.remove...
4
@Override public void render(Graphics g, Visibility visibility, float x, float y, float scale) { if(visibility == Visibility.VISIBLE) { Animation anim; if(isMoving()) anim = moveAnim[toIndex(getFacing())]; else if(isCancelingMove() || isRecoveringFromCanceledMove()) anim = bumpAnim[toIndex(getFacing...
5
public File getBukkitDataFolder() { return getDataFolder(); }
0
public String buscarClientePorDNI(String DNI){ //##########################CARGA_BASE DE DATOS############# tablaDeClientes(); //##########################INGRESO_VACIO################### if(DNI.equals("")){ DNI = "No busque nada"; return resultBusqueda =...
5
@Override public void run() { boolean interrupted = false; while (!interrupted) { try { JSONObject data = connector.refresh(); users.clear(); JSONArray dataUsers = data.getJSONArray("users"); int i = 0; while (i < dataUsers.length()) { JSONObject dataUser = dataUsers.getJSONO...
4
public ArrayList<ArrayList<Integer>> zigzagLevelOrder(TreeNode root) { ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>(); if (root == null) { return result; } //if left to right order boolean leftToRight = true; //current level ...
9
public void start(BundleContext context) throws Exception { // Query for all service references matching any language. ServiceReference[] refs = context.getServiceReferences( DictionaryService.class.getName(), "(Language=*)"); if (refs != null) { try { System.out.println("Enter a blank line to exit.")...
5
private static String encode_base64(byte d[], int len) throws IllegalArgumentException { int off = 0; StringBuffer rs = new StringBuffer(); int c1, c2; if (len <= 0 || len > d.length) throw new IllegalArgumentException ("Invalid len"); while (off < len) { c1 = d[off++] & 0xff; rs.append(base64_co...
5
public static int longestValidParentheses(String s) { int max = 0; Stack<Integer> stack = new Stack<Integer>(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if ('(' == c) { stack.push(i); } else { if (!stack.isEmpty() && '(' == s.charAt...
6
public static void writeFile(String theFileName) { try { File currentFile = new File("plugins/CraftHUD/Resources/"+theFileName); @SuppressWarnings("static-access") JarFile jar = new JarFile(plugin.crafthud); JarEntry entry = jar.getJarEntry("resources/"+theFileName); ...
3
public void driver() { System.out.println("benz bus drive"); }
0
public static <VertexDataType> void foreach(int numVertices, String baseFilename, BytesToValueConverter<VertexDataType> conv, ForeachCallback<VertexDataType> callback) throws IOException { VertexData<VertexDataType> vertexData = new VertexData<VertexDataType>(nu...
3
public Locomotive(Integer grossWeight, String classification) throws TrainException{ super(grossWeight); String powerClass = classification.substring(0, classification.length()-1); String engineType = classification.substring(classification.length() - 1); try{ this.powerClass = Integer.parseInt(powerClass); ...
6