text
stringlengths
14
410k
label
int32
0
9
public static String kuvaFormaatti(String kuvanNimi) { String teksti = kuvanNimi; teksti.toLowerCase(); if (teksti.endsWith(".png")) { return "png"; } if (teksti.endsWith(".gif")) { return "gif"; } if (teksti.endsWith(".jpg")) { ...
3
private void setupListeners() { saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent click) { Game tempGame = baseController.makeGameFromInput(titleField.getText(), rankingField.getText(), rulesArea.getText()); if (tempGame != null) { ...
3
private boolean executaComando(char comando, String parametros) throws MVNException{ switch(comando){ case CMD_INICIALIZA: initialize(); break; case CMD_ASCII: loadTextFiletoMemory(parametros); break; case CMD_EXECUTA: executa(ExtractArguments(parametros)); break; case CMD_DEBUG...
9
public void create() { frame = new JFrame(TITLE); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE)); frame.pack(); frame.setLocationRelativeTo(null); frame.add(this); frame.setVisible(true); }
0
public int[] calculateDragDistance() { int[] distances = new int[2]; int startX = clickX; int startY = clickY; int currentX = mouseX; int currentY = mouseY; if (startX < currentX) { distances[0] = +(currentX - startX); } if (startX > currentX) { distances[0] = -(startX - currentX); } if (start...
4
public boolean pickAndExecuteAnAction() { synchronized(marketbills) { for (MyMarketBill mb : marketbills) { if (mb.state == mbState.unpaid) { payMarketBill(mb); } } } synchronized(uncomputedChecks) { for(Check c: uncomputedChecks) { if(c.state == CheckState.uncomputed) { c.sta...
9
@Override public void run(){ try{ say(s,""); say(s, "Sorry, there are too many users."); say(s, "Server message: too many users"); } catch(Exception e){ e.printStackTrace(); } }
1
private JLabel getLblSongName() { if (lblSongName == null) { lblSongName = new JLabel("Song name :"); lblSongName.setBounds(10, 81, 86, 14); } return lblSongName; }
1
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.T...
6
@Override public void updateCourses(List<Integer> mainCourseList, List<Integer> additionalCourseList, int userId) throws SQLException { Connection connect = null; PreparedStatement statement = null; try { Class.forName(Params.bundle.getString("urlDriver")); connect = ...
6
public void run() { // Set colors setBodyColor(new Color(128, 128, 50)); setGunColor(new Color(50, 50, 20)); setRadarColor(new Color(200, 200, 70)); setScanColor(Color.white); setBulletColor(Color.blue); // Prepare gun trackName = null; // Initialize to not tracking anyone setAdjustGunForRobotTurn(tr...
4
private void generateHardwareSystemAlternativesEP() { int alternatives = 1; int possibilities[] = new int[project.getHardwareSets().size()]; int repetitions[] = new int[project.getHardwareSets().size()]; int i = 0; for (HardwareSet hws : project.getHardwareSets()) { alternatives *= hws.getHardwareSetCheape...
1
@Override public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) { if( failed ) { return HandshakeState.NOT_MATCHED; } try { if( !response.getFieldValue( "Sec-WebSocket-Origin" ).equals( request.getFieldValue( "Origin" ) ) || !basicAccept( response ) ) { ret...
7
public String returnInsertColumnsDefine() { StringBuilder sb = new StringBuilder(); List<String> list = columnMap.get(this.getClass()); int i = 0; for (String column : list) { if (isNull(column)) continue; if (i++ != 0) sb.append(','); sb.append("#{").append(column).append('}'); } return ...
3
private void sendAsChunked(OutputStream outputStream, PrintWriter pw) throws IOException { pw.print("Transfer-Encoding: chunked\r\n"); pw.print("\r\n"); pw.flush(); int BUFFER_SIZE = 16 * 1024; byte[] CRLF = "\r\n".getBytes(); byte[] buff = new byt...
1
@Override public int hashCode() { return isAlive ? 1231 : 1237; }
1
private void loadWorlds() throws DynmapInitException { for (DynmapWorld world : dynmapConfig.getWorlds()) { logger.info("Checking World " + world.getName()); AbstractFile dynmapWorldConfig = null; try { dynmapWorldConfig = getFile("standalone/dynmap_" + world...
6
public void loadAlphabets(String filename) { try { File f = new File(filename); Scanner s = new Scanner(f); String line = null; List<String> dot_mat_alpha = new ArrayList<String>(); if(s.hasNext()) characters = s.nextLine(); int i = 0;...
7
public static void decTrigger() { idTrigger--; }
0
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; int v_4; // (, line 175 // setlimit, line 176 v_1 = limit - cursor; // tomark, line 176 ...
8
public void close(){ try { List<User> f = pod.getFriendList(); //récupère la liste d'ami //on la stocke dans un JSONArray JSONArray t = new JSONArray(); for(int i = 0 ; i < f.size() ; i++) t.put(i, f.get(i).getLocation()); //On récupère les amis qui était dans l'ancien fichier stocker l...
9
public void singlePlayerMove(Object source, int indexPosition) { boolean legalMove = false; legalMove = singlePlayerGame.selectSquare(indexPosition); if (legalMove) { // Draw board moves on board setOpponentsMove(singlePlayerGame.getComputersMostRecentMove()); ...
5
public void test_getValue_long() { assertEquals(0, iField.getValue(0L)); assertEquals(12345, iField.getValue(12345678L)); assertEquals(-1, iField.getValue(-1234L)); assertEquals(INTEGER_MAX, iField.getValue(LONG_INTEGER_MAX * 1000L + 999L)); try { iField.getValue(LONG...
1
@Override public MapObject doNextAction(MapEngine engine, double s_elapsed) { if (is_cloaked && cloak_time_left < 0.0) { is_cloaked = false; is_visible = true; playPublicSound("effects/cloakoff.wav"); } MultipleObject created_objects = new MultipleObject(); if (!death_spin_started) {...
9
public static void load(int track) { // TODO Auto-generated constructor stub switch (track) { case 0: splash = loadMusic("splash.ogg"); break; case 1: game = loadMusic("game.ogg"); break; case 2: kill = loadMusic("kill.ogg"); break; } }
3
public Hole getHole(int holeNumber) { for (Hole hole : holes) { if (hole.getHoleNumber() == holeNumber) { return hole; } } return null; }
2
public void setColorArray(String id, Color[] color) { int count = 0; for(int i=0;i<identity.size();i++) { if(identity.get(i).contains(id)) { attrib_colors = new Color[2]; attrib_colors[0] = color[count]; //Color attrib_colors[1] = colors.get(i)[1]; //Textcolor colors.set(i, attrib_c...
2
@Override public void signalEndOfData() { taskAcceptor.signalEndOfData(); }
0
public void stripFunction(){ //set validness of filename to false as initialization and other general initialization boolean valid=false; //if inputs are valid String inFileName=_curDir; //input filename String outFileName=_saveDir; //output file name int overrideChoice=-1; //for override button choice Stri...
9
public void mutate(int strandIndex, int mutatorKind, int index, Nucleotide nucleotideTo) { Strand strand = getStrand(strandIndex); if (strand == null) return; Mutator mutator = strand.getMutator(mutatorKind); if (mutator == null) return; if ((mutator instanceof SubstitutionMutator) || (mutator instanceo...
7
public void setLives(int a){ lives = a; }
0
public void fusionWithAddFullAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha1 = (c...
3
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { Physical target=mob; if((auto)&&(givenTarget!=null)) target=givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",...
7
public static String getJailer(String playerName){ String banner = "Not Jailed"; if(isJailed(playerName)){ try { SQL_STATEMENT = SQL_CONNECTION.createStatement(); SQL_RESULTSET = SQL_STATEMENT.executeQuery("SELECT * FROM jails WHERE username='" + playerName + "'"); // This loop check...
4
@Override public void updateItem(Boolean item, boolean empty) { super.updateItem(item, empty); if(item!=null){ chkCell.setSelected(item); setGraphic(chkCell); chkCell.setOnKeyPressed( new EventHandler<KeyEvent>() { ...
8
public ModelAppResponse handleRequest(HTTPRequest request, BufferedReader is) { ModelUser user = authenticateUser(request); if (isExcludedSecurity(request)) { user = (user == null) ? ModelUser.annonymous() : user; } if (isLoginRequest(request)) { return routeLogin(request, user); } else if (user == nul...
7
public void cliqueFinRedeploiement() { if( joueurEnCours.getPeuple().getNbUniteEnMain() == 0 ){ if ((etape == 2 || etape == 3)) { if (Game.getInstance().askConf("Confirmer la fin du redéploiement ?")) { if (etape == 2) { if (tempEnDeclin) { joueurEnCours.getPeuple().decliner(); ...
7
@Override public void mouseClicked(MouseEvent e) { }
0
private String getExtension(String f) { // get extension of a file String ext = ""; int i = f.lastIndexOf('.'); if (i > 0 && i < f.length() - 1) { ext = f.substring(i + 1); } return ext; }
2
private boolean isInBounds(int var1, int var2, int var3) { return var1 >= 0 && var2 >= 0 && var3 >= 0 && var1 < this.width && var2 < this.depth && var3 < this.height; }
5
protected void pack(byte[] src, int[] dest, int destOffset) { assert destOffset + (src.length / 4) <= dest.length; int i = 0, shift = 24; int j = destOffset; dest[j] = 0; while (i < src.length) { dest[j] |= ((src[i] & 0xff) << shift); if (shift == 0) { ...
3
public static Cons mostGeneralCollections(Cons descriptions) { if (descriptions.rest == null) { return (descriptions); } { Cons cursor1 = descriptions; Cons cursor2 = null; Stella_Object value1 = null; Stella_Object value2 = null; while (!(cursor1 == Stella.NIL)) { val...
7
private Direction getDirection(){ List<Direction> directionList = new ArrayList<Direction>(); //Determine if //Calculate the distances from all possible directions for(int i = 0; i < Direction.Orientation.values().length; i++){ int[] relativeCoordinate = (Direction.Orientation.values()[i]).directio...
6
public String getOpiskellutAsiat(){ String palautettava = ""; ArrayList<String> opiskellut = ajastimenTiedot.getOpiskellutAiheet(); for (String opiskeltu : opiskellut) { palautettava += opiskeltu + " "; } return palautettava.substring(0, palautettava.length()-1); //po...
1
protected void renderContinuousSegment() { /* A lazy but effective line drawing algorithm */ final int dX = points[1].x - points[0].x; final int dY = points[1].y - points[0].y; int absdX = Math.abs(dX); int absdY = Math.abs(dY); if ((dX == 0) && (dY == 0)) return; if (absdY > absdX) { final int inc...
9
public void print(){ for (String index : cache.keySet()) { for(String tag : cache.get(index).records.keySet()){ for(String offset: cache.get(index).records.get(tag).words.keySet()){ System.out.print(" " + index + " " + tag + " " + offset + " " + cache.get(index).records.get(tag).words.get(offset)); } ...
3
public void createVehicles(int numVehicles){ ArrayList<Vehicle> v= Vehicle.getVehicleArray(); for(int k=0; k<numVehicles; k++){ double number= Math.random()*4; if(number>=0 && number<1) v.add(new Car(this)); if(number>=1 && number<2) v.add(new Ambulance(this)); if(number>=2 && number<3) v.ad...
9
public int getLineIdByNameAndPassword(String name, String password) { try { if(name.equals("D1") && password.equals("dev_password1")) return -11; else if(name.equals("D2") && password.equals("dev_password2")) return -12; Scanner scan = new Scanner(this); int num =...
8
private synchronized void calcSimilarity(ArrayList<CompareResult> compareResults) { for (CompareResult result : compareResults) { if (_similarity < result.getSimilarity()) { _similarity = result.getSimilarity(); } } }
2
public void run() { try { log.debug(this.taskName + " : is started."); Thread.sleep(10000); log.debug(this.taskName + " : is completed."); } catch (InterruptedException e) { log.error(this.taskName + " : is not completed!"); e.printStackTrace(); } }
1
private static boolean isLanguageModelCreated(String grammar, boolean deleteOnExit){ boolean isLanguageModelCreated = false; // Ensure that the files were created successfully File lm = new File(grammar + ".lm"); File dmp = new File(grammar + ".DMP"); // Check if the files exists...
5
public Controller(View _view, ActionDispatch a) { }
0
private PhongShader() { super(); addVertexShaderFromFile("phongVertex.vs"); addFragmentShaderFromFile("phongFragment.fs"); compileShader(); addUniform("transform"); addUniform("transformProjected"); addUniform("baseColor"); addUniform("ambientLight"); addUniform("specularIntensity"); addUn...
2
private void moveShuffled(){ shuffling = new HashMap<String, Multimap<String, Double>>(); HashMap<String, Multimap<String, Double>> lastCore = combinedShuffling.get(combinedShuffling.size()-1); for (String str : lastCore.keySet()){ Multimap<String, Double> mhsd = ArrayListMultimap.create(); for (String hs :...
7
protected void scaleNumericPredictions() { double maxErr; double minErr; double err; int i; Double errd; double temp; maxErr = Double.NEGATIVE_INFINITY; minErr = Double.POSITIVE_INFINITY; // find min/max errors for (i = 0; i < m_PlotSizes.size(); i++) { errd = (...
7
public static void main( String[] args ) { final RobotState rs = new RobotState(); final RayCaster rc = new RayCaster( 32, 32 ); for( int i=0; i<1024; ++i ) rc.walls[i] = true; Random r = new Random(); int tx = 16, ty = 16; for( int i=0; i<1024; ++i ) { rc.putWallAt( tx, ty, false ); //ty += 1; ...
9
public static Parser rulesParserFromReader( BufferedReader src ) { try { StringBuffer result = new StringBuffer(); String line; Map prefixes = new Map(); // List preloadedRules = new ArrayList(); List preloadedRules = new List(); while ((line = src...
8
public void AddInputPacket(RouterPacket dPacket, int bufferNumber) { //put a packet in the chosen buffer inputBuffer[bufferNumber].add(dPacket); System.out.println("Time: "+GetTime()+" --> Delivered packet#: "+dPacket.GetSequenceNumber()+" to InputBuffer: "+bufferNumber+" PacketTIME:...
0
public int getWidth() { return (this.getHeight() < 1) ? 0 : this.pic[0].length(); }
1
@Override public final Configuration get() { try { XmlConfigurationReader xmlConfigReader = new XmlConfigurationReader(componentName); return new MojoConfiguration(authorUrl, publishUrl, dispatcherUrl, xmlConfigReader); } catch (Exception e) { throw new ProvisionE...
1
public static void helpInsertACsValue(KvCons kvcons, Stella_Object newvalue, Context target, boolean overwriteP) { { int contextnumber = target.contextNumber; for (;;) { if ((!Stella.$CONTEXT_BACKTRACKING_MODE$) && (Stella.$UNLINK_DISCARDED_CONTEXTS_ON_WRITEp$ && (((((Context...
9
@Override public void update(int mouseX, int mouseY, boolean pressed) { super.update(mouseX, mouseY, pressed); if(this.btnBack.wasClicked()) Game.instance.setCurrentGui(this.parent); if(this.btnNext.wasClicked() && this.page < 2) this.page++; if(this.btnPrev.wasClicked() && this.page > 0) this.page-...
5
private static Node deleteNode(Node h, int value){ if(h==null) return null; if(h.v==value) return h.next; Node curr = h.next; Node prev = h; while(curr!=null){ if(curr.v == value){ prev.next = curr.next; break; } prev = curr; curr = curr.next; } return h; }
4
public static boolean arrayEqual(char[] a, char[] b, int aStart, int bStart, int length) { for(int i=0;i<length;i++) { if(a[aStart+i] != b[bStart+i]) { return false; } } return true; }
2
int getB(String s1, String s2) { int b = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { // this situation has handled by getA. continue; } if (s1.charAt(i) == s2.charAt(j)) { // if their digit m...
4
public static void processTriple(String subject, String verb, String object, String inputDir, String outDir){ //expansion ArrayList<String> subject_words = expanded_object_list.get(subject); ArrayList<String> verb_words = expanded_verb_list.get(verb); ArrayList<String> obje...
9
public void loadRepositoryFromGraphXML(String graphXML) { try { String result=graphXML.replaceAll("&#x","---"); Document document = builder.parse(new InputSource(new StringReader(result))); // SBModel is sign of SystemBiology XML document, which equals to GraphData of Pat...
8
public File getCsvData() { List<DataLead> leads = selectAll(); if(leads == null) { this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. Can't get data. "); return null; } File tmp = createCsvFile(); if(tmp == null) { this.errorLogFi...
9
public String openMana(Player player) { // Currently only considers basic lands. String mana = ""; for (Card perm : this.permanents) { if (perm.getTypes().contains("Land") && perm.getController().equals(player) && !perm.isTapped()) { String cardName = perm.getName(); switch (cardName) { case "...
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { invoker=mob; final CMMsg msg=CMClass.getMsg(mob...
8
public synchronized void adicionar() { try { new PesquisaView(this); } catch (Exception e) { } }
1
public static String nullSafeClassName(Object obj) { return (obj != null ? obj.getClass().getName() : NULL_STRING); }
1
@Override public Set<String> keySet() { return new Set<String>() { @Override public int size() { return size; } @Override public boolean isEmpty() { return size == 0; ...
9
private static void wordquiz() { for (int i = 0; i < 40; ++i) System.out.println(); int max = database.size() - 1; success = new SList(); failure = new SList(); total = new SList(); String guess; sc = new Scanner(System.in); System.out.println("Random word's deffinition is displayed below. You have to g...
5
public void setjTextFieldPrenom(JTextField jTextFieldPrenom) { this.jTextFieldPrenom = jTextFieldPrenom; }
0
public boolean replace(String key, int ttlSec, Object value, long timeoutMiliSec) throws TimeoutException { try { StringBuilder sb = new StringBuilder(); byte valueBytes[] = null; int flag = -1; if (value instanceof String) { String arg = (String) value; valueBytes = arg.getBytes(charset); ...
5
@Override public void actionPerformed(ActionEvent e) { if(e.getSource()==logOut){ frameRef.setContentPane(new Login(frameRef)); } if(e.getSource()==addBook){ contentPanelLayout.show(panel, "ADD_BOOK"); } if(e.getSource()==addItem){ contentPanelLayout.show(panel, "ADD_ITEM"); } if(e.getSource() =...
9
@XmlElementDecl(namespace = "urn:ietf:params:xml:ns:keyprov:pskc", name = "KeyContainer") public JAXBElement<KeyContainerType> createKeyContainer(KeyContainerType value) { return new JAXBElement<KeyContainerType>(_KeyContainer_QNAME, KeyContainerType.class, null, value); }
0
public void run(){ System.out.println("in run method "); synchronized(this){ try { for(int i = 0; i < 100; i++){ total += i; System.out.println("total: "+total); wait(100); } } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }...
2
public int getIndexFrom(){ int numOfOptions=_map.mygraph.getCurr(); if(numOfOptions==0){ JOptionPane.showMessageDialog(null,"There isn't any location on the map!","Directions",JOptionPane.ERROR_MESSAGE,null); return -1; } String[] options=new String[numOfOptions]; for(int i=0;i<numOfOpt...
4
public String format(Alignment alignment) { char[] sequence1 = alignment.getSequence1(); char[] sequence2 = alignment.getSequence2(); char[] markup = alignment.getMarkupLine(); int length = sequence1.length > sequence2.length ? sequence2.length : sequence1.length; String name1 = adjustName(alignment.get...
8
public ShapeModels(String path) throws BadModelFormatException{ models = new HashSet<ShapeModel>(); Integer length = 0; Integer height = 0; Integer lineNumber = 0; Integer modelScore = 0; Set<Position> model = null; List<String> lines = null; try { lines = Files.readAllLines(Paths.get(path)); } cat...
9
@Override public String[] getClientAliases(String keyType, Principal[] issuers) { if (CacHookingAgent.DEBUG) { System.out.println("getClientAliases: "); } try { KeyStore ks = getKeyStore(); if (ks == null) { return new String[0]; } ArrayList<String> asList = new ArrayList<String>(); Enumera...
4
public ListNode mergeKLists(ListNode[] lists) { if (lists == null || lists.length == 0) { return null; } PriorityQueue<ListNode> priorityQueue = new PriorityQueue<ListNode>(new Comparator<ListNode>() { @Override public int compare(ListNode o1, ListNode o2) { ...
6
@EventHandler public void IronGolemFastDigging(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.getIronGolemConfig().getDouble("Iron...
6
public static void main(String[] args) { int[] tipsArr = new int[] { 1, 10, 1, 5, 5, 10, 10, 5, 10, 5 }; Random random = new Random(); for (int i = 1; i < tipsArr.length; i++) { int j = random.nextInt(i); int temp = tipsArr[i]; tipsArr[i] = tipsArr[j]; tipsArr[j] = temp; } for (int i = 0...
7
boolean checkPassword(String password, String confirmPassword) { if(password.length() < 8 || password.length() > 16) { JOptionPane.showMessageDialog(null, "Password must be between 8 to 16 characters long", "Error", JOptionPane.ERROR_MESSAGE); return false; } if(!password.equals(confirmPassword)) { JOpti...
3
static void printAngle(double theta, PrintStream ps, String posPrefix, String negPrefix) { int pd, pm; double phi = RtoD(Math.abs(theta)); pd = (int) phi; phi = 60.0 * (phi - pd); pm = (int) phi; phi = 60.0 * (phi - pm); if (theta < 0.0) { ps.print((negPrefix == null) ? "-" : negPrefix); } else...
3
public void sendDebugFile(final String errorid) throws IOException { this.plugin.getServer().getScheduler().runTaskAsynchronously(this.plugin, new Runnable() { @SuppressWarnings("resource") @Override public void run() { try { URL url = new URL("http...
6
protected void ushortLoop(RasterAccessor src, RasterAccessor dst, int filterSize) { int dwidth = dst.getWidth(); int dheight = dst.getHeight(); int dnumBands = dst.getNumBands(); short dstDataArrays[][] = dst.getShortDataArr...
9
@Override public void paint(Graphics g) { super.paint(g); map.paint(g, this); for (Tower tower : towerList) { tower.paintBase(g, this); } enemyHandler.paint(g, this); for (Tower tower : towerList) { tower.paintProjectiles(g, this); } ...
4
public void train(String listofFiles,String output) { CountsCollection bag1=new CountsCollection(); HashSet<String> IdsVisible=new HashSet<String>(); loadList(listofFiles,DataHalf.ODD,Visibility.VISIBLE,bag1,IdsVisible); loadList(listofFiles,DataHalf.EVEN,Visibility.BLIND,bag1,IdsVisible); // Do some sort of ...
2
public void run() { long lastTime = System.nanoTime(); long timer = System.currentTimeMillis(); double ns = 1000000000.0 / 60.0; double unprocessed = 0; int ticks = 0; int frames = 0; requestFocus(); while (running) { long now = System.nanoTime(); unprocessed += (now - lastTime) / ns; lastTime...
4
private void pullData() { File tmp = new File(backup); tmp.mkdirs(); tmp.delete(); info("Your device will ask you for permission to backup files. Do NOT enter a password, just accept."); String messages = ""; try { Process p = Runtime.getRuntime().exec(new S...
3
public boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[0-9]|\\."); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } return true; }
1
@Override public void addChoices(Player player, List<Choice> choices) { super.addChoices(player, choices); if (player.isNextTo(ConnectionType.boat)) { if (player.lastChoice() != null && (player.lastChoice().equals(doNothing) || (player.lastChoice().equals(this) && player.getAt().getType().equals(...
7
public void update(float delta, Level level) { move(delta, level, false); if (collision(level)) { level.entities.remove(this); } for (int i = 0; i < level.entities.size(); i++) { if (level.entities.get(i) instanceof Player && collision(level.entities.get(i))) { level.resetLevel(); Sound.DEATH...
9
public void act(XmlAction pAction) { if (pAction instanceof ChangeRootNodeAction) { ChangeRootNodeAction rootNodeAction = (ChangeRootNodeAction) pAction; NodeAdapter focussed = controller.getNodeFromID(rootNodeAction .getNode()); if (fo...
7
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ( "tag".equals(qName) ) { String name = attributes.getValue("name"); String content = attributes.getValue("content"); String ...
9
public String getColor() { return color; }
0