text
stringlengths
14
410k
label
int32
0
9
public static synchronized DAOFactory getInstance() { if (daoFactory == null) daoFactory = new DAOFactory(); return daoFactory; }
1
public void setId(String value) { this.id = value; }
0
public void setRange(int min, int max) { myMax = max; setMin(min); }
0
public boolean scanBoolean() throws StringScanException { StringScanException exception = null; int idxSave = idx; String testStr = "false"; // MUST BE LOWERCASE boolean testval = false; char c; skipWhiteSpace(); if (Character.toLowerCase(buf[idx]) == 't') { testStr = "true"; testval = true; } else { testval = false; } int i = 0; for (i = 0; i < testStr.length(); i++) { if (testStr.charAt(i) != Character.toLowerCase(buf[idx])) { if (idx == len) { exception = new StringScanException(idx, "end of input"); } break; } idx++; } if (exception == null) { if (i < testStr.length() || Character.isLetterOrDigit(c = buf[idx]) || c == '_') { exception = new StringScanException(idx, "illegal boolean"); } } if (exception != null) { idx = idxSave; throw exception; } return testval; }
9
public void rebuildTreeList() { if (tree != null && treePane != null) { tree = null; } treePane.remove(treeScroll); getTreeList(); createTree(); treeScroll = new JScrollPane(tree); treePane.add(treeScroll); try { treePane.setSelected(true); } catch (PropertyVetoException e) { e.printStackTrace(); } treePane.setLocation(treePane.getLocation()); }
3
@Override public void collideWithMovableElement(ElementField element, CollisionMan.TYPE type) { //Спрайт мяча Sprite sp = Buffer.findSprite(this); //Спрайт элемент, с которым произошло столкновение Sprite el = Buffer.findSprite(element); if (type == CollisionMan.TYPE.PAIR) { setSpeed(sp.getHorizontalSpeed() * -1, sp.getVerticalSpeed() * -1); } else { setSpeed(el.getHorizontalSpeed(), el.getVerticalSpeed()); } }
1
public static HighScore read(int n, String file){ HighScore r = null; try{ RandomAccessFile f = new RandomAccessFile(file, "r"); f.seek(n * FILE_SIZE); char[] ch = new char[STRING_SIZE]; for(int i = 0; i<STRING_SIZE; i++){ ch[i] = f.readChar(); } int s = f.readInt(); r = new HighScore(ch, s); f.close(); } catch(Exception e){ System.out.println("Error: " + e.getMessage()); } return r; }
2
@Override public boolean validate(MessageCollector collector, User target) { boolean result = true; if (!isEmpty(target.getLogin())) { if (usersRepository.findByLogin(target.getLogin()) != null) { collector.addMessage(Severity.error, "Такой пользователь уже существует"); result = false; } } else { collector.addMessage(Severity.error, "Поле 'логин' не может быть пустым"); result = false; } if (isEmpty(target.getFirstName())) { collector.addMessage(Severity.error, "Поле 'имя' не может быть пустым"); result = false; } if (isEmpty(target.getLastName())) { collector.addMessage(Severity.error, "Поле 'фамилия' не может быть пустым"); result = false; } if (isEmpty(target.getEmail())) { collector.addMessage(Severity.error, "Поле 'почта' не может быть пустым"); result = false; } if (isEmpty(target.getPassword())) { collector.addMessage(Severity.error, "Поле 'пароль' не может быть пустым"); result = false; } return result; }
6
private static int maxProduct() { int horizontal = -1, vertical = -1, diagonal1 = -1, diagonal2 = -1, max = 0; for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { if (i + 3 < 20) vertical = num(i, j) * num(i + 1, j) * num(i + 2, j) * num(i + 3, j); if (j + 3 < 20) horizontal = num(i, j) * num(i, j + 1) * num(i, j + 2) * num(i, j + 3); if (i + 3 < 20 && j + 3 < 20) diagonal1 = num(i, j) * num(i + 1, j + 1) * num(i + 2, j + 2) * num(i + 3, j + 3); if (i - 3 >= 0 && j + 3 < 20) diagonal2 = num(i, j) * num(i - 1, j + 1) * num(i - 2, j + 2) * num(i - 3, j + 3); max = max5(horizontal, vertical, diagonal1, diagonal2, max); } } return max; }
8
private Filters() { // do nothing }
0
@Override public void removeServerExceptionListener(IExceptionListener listener) { if (serverExceptionListenerList != null) { serverExceptionListenerList.remove(IExceptionListener.class, listener); } }
1
public void execute(Logger logger) { GameSession session = new GameSession(channel); DatabaseConnection con = DatabaseManager.getSingleton().getConnection("player-loader"); DatabaseResult result = null; String hashedPass = "failed"; int rights = 0; try { hashedPass = Misc.getMD5(password); } catch (Exception e1) { e1.printStackTrace(); } int returnCode = LoginConfigs.LOGIN_OK; boolean playerExists = DatabaseUtils.playerExists(username, con); if(playerExists) { try { result = DatabaseUtils.fetchProfile(username, con); if(!result.getPassword().equals(hashedPass)) { returnCode = LoginConfigs.INVALID_PASSWORD; } rights = result.getRights(); } catch (Exception e) { returnCode = LoginConfigs.TRY_AGAIN; e.printStackTrace(); } } Player player = new Player(session, rights); if(playerExists) { SavingService.loadData(player, result); } player.setHashedPassword(hashedPass); player.setUnformattedName(username); player.setFormattedName(Misc.formatName(username)); if(World.getSingleton().checkExistance(username)) { returnCode = LoginConfigs.ALREADY_ONLINE; } if(returnCode == 2) { if(!World.getSingleton().register(player)) { returnCode = LoginConfigs.WORLD_FULL; } } MessageBuilder bldr = new MessageBuilder(); bldr.writeByte(returnCode); bldr.writeByte(rights); bldr.writeByte(0); bldr.writeByte(0); bldr.writeByte(0); bldr.writeByte(1); bldr.writeShort(player.getIndex()); bldr.writeByte(0); if(returnCode != 2) { channel.write(bldr.toMessage()).addListener(ChannelFutureListener.CLOSE); return; } else { channel.write(bldr.toMessage()); } getContext().getPipeline().replace("decoder", "decoder", new DefaultProtocolDecoder(session)); ActionSender.sendLogin(player); synchronized(LogicService.getSingleton()) { player.getUpdateFlags().flag(UpdateFlag.APPERANCE); } //World.getSingleton().getGroundItemManager().loadItemsForPlayer(player, player.getUnformattedName()); logger.info("Registered player ["+username+" @ index "+player.getIndex()+"] successfully!"); }
9
public int[] twoSum2(int[] numbers, int target) { // O(n) solution Map<Integer, Integer> numMap = new HashMap<Integer, Integer>(); int [] res = new int[2]; for(int i = 0; i < numbers.length; ++i){ if(numMap.containsKey(target - numbers[i])){ res[0] = numMap.get(target - numbers[i]) + 1; res[1] = i + 1; return res; }else{ numMap.put(numbers[i], i); } } return res; }
2
private int[] smallestIndices() { int[] smallest = new int[] { Integer.MAX_VALUE, Integer.MAX_VALUE }; for (BufferedImage b : history) { if (b.getWidth() < smallest[0]) smallest[0] = b.getWidth(); if (b.getHeight() < smallest[1]) smallest[1] = b.getHeight(); } return smallest; }
3
public static ArrayList<String> parseDoc( File f ){ importFiles = new ArrayList<String>(); try{ filePath = f.getAbsolutePath(); Scanner scan = new Scanner(f); String readline; boolean commentStart = false; while ( scan.hasNextLine() ){ readline = scan.nextLine(); Pattern startBlock = Pattern.compile("/[\\*].*"); Pattern singleLine = Pattern.compile("//.*"); Pattern endBlock = Pattern.compile(".*[\\*]/"); Matcher m1 = startBlock.matcher( readline ); Matcher m2 = singleLine.matcher( readline ); Matcher m3 = endBlock.matcher( readline ); if( m1.find() ) commentStart = true; if( commentStart || m2.find() ) scanLine( readline ); if( m3.find() ) commentStart = false; //On first line not blank that is not a comment, stop looking //for import statement if(! ( commentStart || m2.find() || ! readline.equals(""))) break; } System.out.println("Finished Scanning"); } catch(Exception e){ e.printStackTrace(); } return importFiles; }
9
public int size() { int s = 0; for (Attribute r : attr.keySet()) if (attr.get(r) != 0) s++; return s; }
2
public void loadFile(){ try { File file = new File(getDataFolder() + "/names.txt"); boolean newFile = file.createNewFile(); if (newFile) { getLogger().info("Created a file called names.txt"); } BufferedReader read = new BufferedReader(new FileReader(file)); String line; while ((line = read.readLine()) != null) { if (!names.contains(line)){ names.add(line); } } } catch (IOException e) { e.printStackTrace(); } }
4
private void constructDissertation(JSONObject object, Connection conn) { PreparedStatement prep = null; JSONArray dissertArr = null; try { dissertArr = object.getJSONArray("Dissertation Info"); } catch(Exception ex) { ex.printStackTrace(); } if(dissertArr != null && dissertArr.length() > 0) { try { for(int i = 0; i < dissertArr.length(); i++) { JSONObject each = dissertArr.getJSONObject(i); String title = each.getString("dissertation"); int author = object.getInt("id"); String university = each.getString("institution"); String year = each.getString("year"); prep = conn.prepareStatement("insert into dissertation (author, title, university, year) values(?,?,?,?) ;", Statement.RETURN_GENERATED_KEYS); prep.setInt(1, author); prep.setString(2, title); prep.setString(3, university); prep.setString(4, year); prep.execute(); prep.close(); int student = 0; ResultSet rs = conn.prepareStatement("SELECT currval('dissertation_did_seq');").executeQuery(); if (rs.next()) { student = rs.getInt(1); } String advisors = each.getString("advisors"); if (!advisors.equals("")) { String[] tmp = advisors.split(","); int len = tmp.length; int advOrder = 1; for(int j = 0; j < len; j++) { int advId = Integer.valueOf(tmp[j]); prep = conn.prepareStatement("insert into advised values(?,?,?);"); prep.setInt(1, student); prep.setInt(2, advOrder); prep.setInt(3, advId); prep.execute(); prep.close(); advOrder += 1; } } } }catch(Exception ex) { ex.printStackTrace(); } } }
8
@Override public Point getToolTipLocation(MouseEvent event) { int x = event.getX(); Column column = overColumn(x); if (column != null) { Row row = overRow(event.getY()); if (row != null) { Rectangle bounds = getCellBounds(row, column); return new Point(x, bounds.y + bounds.height); } } return null; }
2
public static List<Field> parameter(Class<?> comp) { List<Field> f = new ArrayList<Field>(); for (Field field : comp.getFields()) { Role r = field.getAnnotation(Role.class); if (r != null && Annotations.plays(r, Role.PARAMETER)) { f.add(field); } } return f; }
4
public void playSoundLine(int index) { if (!run) return; StaffNoteLine s = theStaff.getSequence().getLine( (int) (currVal.doubleValue() + index)); ArrayList<StaffNote> theNotes = s.getNotes(); tracker.stopNotes(s); for (StaffNote sn : theNotes) { if (sn.muteNoteVal() == 1) stopSound(sn); else if (sn.muteNoteVal() == 2) stopInstrument(sn); } for (StaffNote sn : theNotes) { if (sn.muteNoteVal() == 0) playSound(sn, s); } }
6
protected Transition createTransition(State from, State to, Node node, Map e2t, boolean isBlock) { /* * The boolean isBlock seems to be ignored in FSATransducer.java, so I'm ignoring * it here too. */ String label = (String) e2t.get(TRANSITION_READ_NAME); String output = (String) e2t.get(TRANSITION_OUTPUT_NAME); if(label == null) label = ""; if(output == null) output = ""; return new MooreTransition(from, to, label, output); }
2
@EventHandler public void onPlayerInteractEvent(PlayerInteractEntityEvent e){ Player master = e.getPlayer(); Entity entity = e.getRightClicked(); PlayerLead.server.broadcastMessage("before"); if (plugin.checkLasso(master) && (entity instanceof Player) && !(entity instanceof NPC)){ try { NPC test = (NPC) entity; } catch (Exception e2) { PlayerLead.server.broadcastMessage("master heeft een lasso, en target is een player"); addMaster((Player)entity,master); } } }
4
static Coordinate calcAbsPosition(Subject subject) { double gx, gy; if (subject.meta.type == SubjectType.SHIP) { gx = (subject.parent.size + subject.p.radius) * cos(subject.p.angle); gy = (subject.parent.size + subject.p.radius) * sin(subject.p.angle); } else { gx = subject.p.radius * cos(subject.p.angle); gy = subject.p.radius * sin(subject.p.angle); } return new Coordinate(gx, gy); }
1
public static Locale getLocaleFromString(String localeString) { if (localeString == null) { return null; } localeString = localeString.trim(); if (localeString.toLowerCase().equals("default")) { return Locale.getDefault(); } // Extract language int languageIndex = localeString.indexOf('_'); String language = null; if (languageIndex == -1) { // No further "_" so is "{language}" only return new Locale(localeString, ""); } else { language = localeString.substring(0, languageIndex); } // Extract country int countryIndex = localeString.indexOf('_', languageIndex + 1); String country = null; if (countryIndex == -1) { // No further "_" so is "{language}_{country}" country = localeString.substring(languageIndex + 1); return new Locale(language, country); } else { // Assume all remaining is the variant so is // "{language}_{country}_{variant}" country = localeString.substring(languageIndex + 1, countryIndex); String variant = localeString.substring(countryIndex + 1); return new Locale(language, country, variant); } }
4
public void exibirCepZipCode(String numero){ String res = null; for(int n = 0; n < zipCodes.size(); n++){ if(zipCodes.get(n)== numero){ res = zipCodes.get(n); } } System.out.println(res.substring(0, 5)+"-"+res.substring(5)); }
2
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<String> iterator = set.iterator(); while (iterator.hasNext()) { String name = iterator.next(); Object valueThis = this.get(name); Object valueOther = ((JSONObject)other).get(name); if (valueThis instanceof JSONObject) { if (!((JSONObject)valueThis).similar(valueOther)) { return false; } } else if (valueThis instanceof JSONArray) { if (!((JSONArray)valueThis).similar(valueOther)) { return false; } } else if (!valueThis.equals(valueOther)) { return false; } } return true; } catch (Throwable exception) { return false; } }
9
public static void main(String[] args) throws IOException { GraphIndexer indexer = new GraphIndexer(); indexer.init(); Path start = new Path("/tmp/start"); Path output = new Path(args[1]); FileSystem fs = FileSystem.get(new Configuration()); fs.delete(start, true); System.out.println("!!!!"); fs.mkdirs(output); FileUtil.copy(fs, new Path(args[0]), fs, start, false, new Configuration()); int i = 0; do { BufferedReader reader = new BufferedReader(new InputStreamReader(fs.open(start))); String line = reader.readLine(); HashSet<Integer> neibourSet = new HashSet<Integer>(); OutputStream out = fs.create( new Path(args[1] + Path.SEPARATOR + String.valueOf(i))); while(line != null) { int vertex = Integer.parseInt(line.trim()); indexer.markupAccessed(vertex); int[] neighbours = indexer.queryNeighbours(vertex); for(int neighbour : neighbours) { if(!indexer.isAccessed(neighbour)) neibourSet.add(new Integer(neighbour)); } //System.out.print(line+" "); line = reader.readLine(); out.write(String.format("%d\n", vertex).getBytes()); } //System.out.println(); reader.close(); out.flush(); out.close(); fs.delete(start, true); OutputStream result = fs.create(start); for(Integer vertex : neibourSet) { String neighbour = String.format("%d\n", vertex.intValue()); //System.out.print(" " + neighbour); result.write(neighbour.getBytes()); } result.flush(); result.close(); i++; } while(!indexer.isFinished()); indexer.close(); }
5
protected MediaWiki editPage(final MediaWiki.EditToken editToken, final String section, final Boolean requireExist, final String text, final String editSummary, final boolean bot, final Boolean minor) throws IOException, MediaWiki.MediaWikiException { final Map<String, String> getParams = paramValuesToMap("action", "edit", "format", "xml"); final Map<String, String> postParams = paramValuesToMap("title", editToken.getFullPageName(), "text", text, "token", editToken.getTokenText(), "starttimestamp", iso8601TimestampParser.format(editToken.getStartTime()), "summary", editSummary, "section", section); if (bot) { postParams.put("bot", "true"); } if (minor != null) { postParams.put(minor ? "minor" : "notminor", "true"); } if (requireExist != null) { postParams.put(requireExist ? "nocreate" : "createonly", "true"); } if (editToken.getLastRevisionTime() != null) { postParams.put("basetimestamp", iso8601TimestampParser.format(editToken.getLastRevisionTime())); } final String url = createApiGetUrl(getParams); networkLock.lock(); try { final InputStream in = post(url, postParams); final Document xml = parse(in); checkError(xml); final NodeList editTags = xml.getElementsByTagName("edit"); if (editTags.getLength() > 0) { final Element editTag = (Element) editTags.item(0); if (editTag.hasAttribute("result")) { if (editTag.getAttribute("result").equals("Success")) return this; else throw new MediaWiki.ActionFailureException(editTag.getAttribute("result")); } else throw new MediaWiki.ResponseFormatException("expected <edit result=\"\"> attribute not present"); } else throw new MediaWiki.ResponseFormatException("expected <edit> tag not present"); } finally { networkLock.unlock(); } }
9
final public void Function_head() throws ParseException { /*@bgen(jjtree) Function_head */ SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_HEAD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(FUNCTION); Function_name(); Function_parameter_list(); Function_parameters_type(); if (jj_2_9(3)) { Function_return_declaration(); } else { ; } } 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)); } } }
9
public int read(BitReader bitreader) throws JSONException { try { this.width = 0; Symbol symbol = this.table; while (symbol.integer == none) { this.width += 1; symbol = bitreader.bit() ? symbol.one : symbol.zero; } tick(symbol.integer); if (JSONzip.probe) { JSONzip.logchar(symbol.integer, this.width); } return symbol.integer; } catch (Throwable e) { throw new JSONException(e); } }
4
private void pathFollow() { Vec3D var1 = this.getEntityPosition(); int var2 = this.currentPath.getCurrentPathLength(); for (int var3 = this.currentPath.getCurrentPathIndex(); var3 < this.currentPath.getCurrentPathLength(); ++var3) { if (this.currentPath.getPathPointFromIndex(var3).yCoord != (int)var1.yCoord) { var2 = var3; break; } } float var8 = this.theEntity.width * this.theEntity.width; int var4; for (var4 = this.currentPath.getCurrentPathIndex(); var4 < var2; ++var4) { if (var1.squareDistanceTo(this.currentPath.getVectorFromIndex(this.theEntity, var4)) < (double)var8) { this.currentPath.setCurrentPathIndex(var4 + 1); } } var4 = (int)Math.ceil((double)this.theEntity.width); int var5 = (int)this.theEntity.height + 1; int var6 = var4; for (int var7 = var2 - 1; var7 >= this.currentPath.getCurrentPathIndex(); --var7) { if (this.isDirectPathBetweenPoints(var1, this.currentPath.getVectorFromIndex(this.theEntity, var7), var4, var5, var6)) { this.currentPath.setCurrentPathIndex(var7); break; } } if (this.totalTicks - this.ticksAtLastPos > 100) { if (var1.squareDistanceTo(this.lastPosCheck) < 2.25D) { this.clearPathEntity(); } this.ticksAtLastPos = this.totalTicks; this.lastPosCheck.xCoord = var1.xCoord; this.lastPosCheck.yCoord = var1.yCoord; this.lastPosCheck.zCoord = var1.zCoord; } }
8
@Override public int run(String[] args) throws Exception { Job countJob = new Job(); Job generateJob = new Job(); //Parse Arguments and Setting Job. parseArguementsAndSetCountJob(args, countJob, generateJob); //Run counter job. countJob.waitForCompletion(true); Counters counters = countJob.getCounters(); //Check status of finished value of counter job. //Set index parameter for generate Mapper CounterGroup localCounterGroup = counters.getGroup("LocalCounter".toUpperCase()); CounterGroup globalCounterGroup = counters.getGroup("globalCounter".toUpperCase()); Long globalCountSize = globalCounterGroup.findCounter("counter".toUpperCase()).getValue(); int startIndex = 0; for (Counter each : localCounterGroup) { String mapperID = each.getName(); Long mapperCountSize = each.getValue(); generateJob.getConfiguration().set(mapperID, startIndex + "," + mapperCountSize.toString()); startIndex = startIndex + Integer.parseInt(mapperCountSize.toString()); } // Run a Generate Job return generateJob.waitForCompletion(true) ? 0 : 1; }
2
private Registration parseRegistration(XmlPullParser parser) throws Exception { Registration registration = new Registration(); Map<String, String> fields = null; boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { // Any element that's in the jabber:iq:register namespace, // attempt to parse it if it's in the form <name>value</name>. if (parser.getNamespace().equals("jabber:iq:register")) { String name = parser.getName(); String value = ""; if (fields == null) { fields = new HashMap<String, String>(); } if (parser.next() == XmlPullParser.TEXT) { value = parser.getText(); } // Ignore instructions, but anything else should be added to the map. if (!name.equals("instructions")) { fields.put(name, value); } else { registration.setInstructions(value); } } // Otherwise, it must be a packet extension. else { registration.addExtension( PacketParserUtils.parsePacketExtension( parser.getName(), parser.getNamespace(), parser)); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("query")) { done = true; } } } registration.setAttributes(fields); return registration; }
8
@Override public void run() { this.running = true; while (this.running) { try { Thread.sleep(2); } catch (InterruptedException e) { e.printStackTrace(); } //Thread.yield(); } }
2
public static String getColumnString(int column) { String strColumn = "unknown"; switch (column) { case COLUMN_A: strColumn = "A"; break; case COLUMN_B: strColumn = "B"; break; case COLUMN_C: strColumn = "C"; break; case COLUMN_D: strColumn = "D"; break; case COLUMN_E: strColumn = "E"; break; case COLUMN_F: strColumn = "F"; break; case COLUMN_G: strColumn = "G"; break; case COLUMN_H: strColumn = "H"; break; } return strColumn; }
8
public void start() throws MediaException { //System.out.println("START REQUEST: "+this); if(state == CLOSED) { throw new IllegalStateException(); } if(state == STARTED) return; if(state == UNREALIZED || state == REALIZED){ prefetch(); } try{ startImpl(); ApplicationManager.manager.activePlayers.addElement(this); } catch(MediaException e){ throw e; } catch(Exception e){ e.printStackTrace(); throw new MediaException(e.toString()); } state = STARTED; if(autoNotify){ startListenerNotification(PlayerListener.STARTED, null); } }
7
private void initComponents() { JButton button = null; // Let's hear it for sloth! button = new JButton("Finite Automaton"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new automata.fsa.FiniteStateAutomaton()); } }); getContentPane().add(button); button = new JButton("Mealy Machine"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new MealyMachine()); } }); getContentPane().add(button); button = new JButton("Moore Machine"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new MooreMachine()); } }); getContentPane().add(button); button = new JButton("Pushdown Automaton"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Object[] possibleValues = {"Multiple Character Input", "Single Character Input"}; Object selectedValue = JOptionPane.showInputDialog(null, "Type of PDA Input", "Input", JOptionPane.INFORMATION_MESSAGE, null, possibleValues, possibleValues[0]); if (selectedValue==possibleValues[0]){ createWindow(new automata.pda.PushdownAutomaton()); }else if(selectedValue==possibleValues[1]){ createWindow(new automata.pda.PushdownAutomaton(true)); } } }); getContentPane().add(button); button = new JButton("Turing Machine"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new automata.turing.TuringMachine(1)); } }); getContentPane().add(button); button = new JButton("Multi-Tape Turing Machine"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (INTS == null) { INTS = new Integer[4]; for (int i = 0; i < INTS.length; i++) INTS[i] = new Integer(i + 2); } Number n = (Number) JOptionPane.showInputDialog( NewDialog.this.getContentPane(), "How many tapes?", "Multi-tape Machine", JOptionPane.QUESTION_MESSAGE, null, INTS, INTS[0]); if (n == null) return; createWindow(new automata.turing.TuringMachine(n.intValue())); } private Integer[] INTS = null; }); getContentPane().add(button); button = new JButton("Grammar"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new grammar.cfg.ContextFreeGrammar()); } }); getContentPane().add(button); button = new JButton("L-System"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new grammar.lsystem.LSystem()); } }); getContentPane().add(button); button = new JButton("Regular Expression"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new regular.RegularExpression()); } }); getContentPane().add(button); button = new JButton("Regular Pumping Lemma"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new RegPumpingLemmaChooser()); } }); getContentPane().add(button); button = new JButton("Context-Free Pumping Lemma"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createWindow(new CFPumpingLemmaChooser()); } }); getContentPane().add(button); }
5
@Test @Ignore public void test_PersonalEventsGet() { PersonalEventList laPEList = laClient.getPersonalEvents( "20100729225131564332000000", "2012-01-25-12.36.43.023001"); if (laPEList.getPersonalEventList().size() > 0) { System.out.println(((PersonalEvent) laPEList.getPersonalEventList().get(0)) .getTitle()); } }
1
public void coolOff(boolean buffedUp){ if (!firedUp && turnedOn){ coolant++; if (coolant == (int)firingCoolDown*.75 && buffedUp){ firedUp = true; coolant = 0; shotsReady = maximumShots; } else if (coolant == firingCoolDown){ firedUp = true; coolant = 0; shotsReady = maximumShots; } } }
5
protected static void loadExecutionPlansForStatements(List<DeltaSQLStatementSnapshot> sqlStatements, ProgressListener progressListener) { if (progressListener != null) { progressListener.setStartValue(0); progressListener.setEndValue(sqlStatements.size()); progressListener.setCurrentValue(0); } int progressCounter = 0; List<DeltaSQLStatementSnapshot> missingExecutionPlanSqlStatements = new ArrayList<>(sqlStatements); List<DeltaSQLStatementSnapshot> sqlStatementsToLoad = new ArrayList<>(); int numberStatements; while (missingExecutionPlanSqlStatements.size() > 0) { sqlStatementsToLoad.clear(); numberStatements = 0; Iterator<DeltaSQLStatementSnapshot> iterator = missingExecutionPlanSqlStatements.iterator(); while (iterator.hasNext() && numberStatements <= NUMBER_BIND_VARIABLES_SELECT_EXECUTION_PLAN) { sqlStatementsToLoad.add(iterator.next()); numberStatements++; } // remove those statements from the initial for which the loading is going on for (DeltaSQLStatementSnapshot statement : sqlStatementsToLoad) { missingExecutionPlanSqlStatements.remove(statement); } loadExecutionPlansForSQLStatements(sqlStatementsToLoad); progressCounter += sqlStatementsToLoad.size(); if (progressListener != null) { progressListener.setCurrentValue(progressCounter); } // sleep for 0.1 seconds so all the other tasks can do their // work try { Thread.sleep(100); } catch (InterruptedException e) { // we don't care for being interrupted } } }
7
@Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { ss = value.toString(); String PostTypeId = ""; String Date = ""; String Tags = ""; StringBuilder sb = new StringBuilder(); ByteArrayInputStream bis = new ByteArrayInputStream(ss.getBytes()); try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document d = builder.parse(bis); XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); XPathExpression xpeDate = xpath.compile("//@CreationDate"); XPathExpression xpe = xpath.compile("//@PostTypeId"); XPathExpression xpeTags = xpath.compile("//@Tags"); NodeList nl = (NodeList) xpe.evaluate(d, XPathConstants.NODESET); NodeList nlDate = (NodeList) xpeDate.evaluate(d, XPathConstants.NODESET); NodeList nlTags = (NodeList) xpeTags.evaluate(d, XPathConstants.NODESET); PostTypeId = nl.item(0).getNodeValue(); Date = nlDate.item(0).getNodeValue(); splitDate = Date.substring(0, 10).split("-"); if (PostTypeId.equals("1")) { if (nlTags.getLength() > 0) { Tags = nlTags.item(0).getNodeValue(); String[] tahsArray = Tags.split("<"); String delimiter = ","; for (String sample : tahsArray) { if (top10Tags.contains(sample.split(">")[0])) { if(sample.split(">")[0].equals(".net")){ sb.append("dotnet").append(delimiter); } else if(sample.split(">")[0].equals("asp.net")){ sb.append("aspdotnet").append(delimiter); } else{ sb.append(sample.split(">")[0]).append(delimiter); } // delimiter = ","; } } if (!sb.toString().isEmpty()) { //System.out.println("Date ===>>"+splitDate[0] + // splitDate[1] + // "01"+"---"+"Tags====>>"+sb); context.write(new Text(splitDate[0] + splitDate[1] + "01"), new Text(sb.toString())); } } } } catch (Exception e) { System.out.println("exception " + e); } }
8
public SimpleVector getInitialPosition() { return initialPosition; }
0
@Override /** * creates a Socket if a connection is incoming, then reads the stuff we get * and passes it to the ParserContainer */ public void run() { while (alive) { logger.log(2, logKey, "worker is now running in the while(alive) loop\n"); try ( Socket cSocket = sSocket.accept();) { logger.log(2, logKey, "accepted an incoming connection\n"); if (!alive) { logger.log(1, logKey, "server got the dead signal, shutting down now\n"); break; } try ( PacketReader reader = new PacketReader(cSocket.getInputStream());) { logger.log(4, logKey, "created the inputStream\n"); incomingPacket = reader.readPacket(); infoColl.update_device(new Integer(incomingPacket.getGeraeteId()).toString(), incomingPacket.getValue()); } catch (IOException e) { logger.log(0, logKey, "\n\n", "ERROR: \n", " An Exception occured inside of ASynchronous_IO_Worker\n", " while trying to read a Packet\n", "DETAILED ERROR: \n ", e.getMessage(), "\n\n" ); Main.exit(); } } catch (IOException e) { logger.log(0, logKey, "\n\n", "ERROR: \n", " An Exception occured inside of ASynchronous_IO_Worker\n", " while trying to accept a incoming Connection\n", "DETAILED ERROR: \n ", e.getMessage(), "\n\n" ); Main.exit(); } } try { sSocket.close(); } catch (IOException e) { logger.log(0, logKey, "\n\n", "ERROR: \n", " An Exception occured inside of ASynchronous_IO_Worker\n", " while trying to read a Packet\n", "DETAILED ERROR: \n ", e.getMessage(), "\n\n" ); Main.exit(); } }
5
private void findChanged(List<ClassChangeList> changedList, Node actual, ObjectStack otherStack) { // list all super-classes of actual List<Node> supers = actual.getSupers(); for (Node s : supers) { //check if the two nodes are directly connected if (!otherStack.hasSuper(actual, s)) { ClassChangeList deletedNodes = new ClassChangeList(); deletedNodes.addNode(actual); deletedNodes.addNode(s); recursiveFindChanged(changedList, s, otherStack, deletedNodes); } } }
2
private Stream<String> placePartOfChain(Stream<String> boardsStream) { Set<String> boards = boardsStream.collect(Collectors.toSet()); Integer numberOfFigures = figureQuantityMap.get(getName()); if (Objects.nonNull(numberOfFigures)) { IntStream.range(0, numberOfFigures) .filter(e -> figureQuantityMap.containsKey(getName())) .forEach(e -> { Set<String> boardsToReturn = new HashSet<>(); boardsToReturn.addAll(placementBehavior.placeFiguresOnBoards(boards.stream()).collect(Collectors.toSet())); boards.clear(); boards.addAll(boardsToReturn); boardsToReturn.clear(); }); } return boards.stream(); }
1
public boolean connect() { for(int i = 0; i < 3; i++) { try { _remoteObj = (ServerInterface) Naming.lookup("rmi://127.0.0.1:9090/server1"); _remoteObj.ping(); System.out.println("Connected to Server 1"); return true; } catch(Exception ex) { System.out.println("Server 1 is not responding. \nRetrying to connect ..."); } } for(int i = 0; i < 3; i++) { try { _remoteObj = (ServerInterface) Naming.lookup("rmi://127.0.0.2:9090/server2"); _remoteObj.ping(); System.out.println("Connected to Server 2"); return true; } catch(Exception ex) { System.out.println("Server 2 is not responding. \nRetrying to connect ..."); } } return false; }
4
@Override public void run() { script.familiarFailed.set(false); renew(script); ctx.sleep(1000); if (script.familiarFailed.get()) { script.options.status = "Renewing familiar failed"; final Tile start = ctx.players.local().tile(); final List<Tile> tiles = familarTile(ctx); for (final Tile tile : tiles) { script.familiarFailed.set(false); if (ctx.movement.findPath(tile).traverse()) { if (Condition.wait(new Callable<Boolean>() { @Override public Boolean call() throws Exception { return IMovement.Euclidean(tile, ctx.players.local()) < 2.5; } }, Random.nextInt(400, 650), Random.nextInt(10, 15)) || !start.equals(start)) { renew(script); if (!script.familiarFailed.get()) { break; } ctx.sleep(900); } } } } if (ctx.summoning.summoned() && ctx.summoning.timeLeft() > nextRenew) { reset(); } script.nextSummon.set(System.currentTimeMillis() + Random.nextInt(5000, 15000)); }
8
private void ok() { String key = attributeField.getText(); String value = valueField.getText(); AttributeTableModel model = (AttributeTableModel) panel.getModel(); // Validate Existence if ((key == null) || key.equals("")) { errorLabel.setText(ERROR_EXISTANCE); return; } // Validate alpha-numeric if (!XMLTools.isValidXMLAttributeName(key)) { errorLabel.setText(ERROR_ALPHA_NUMERIC); return; } // Validate Uniqueness for (int i = 0; i < model.keys.size(); i++) { String existingKey = (String) model.keys.get(i); if (key.equals(existingKey)) { errorLabel.setText(ERROR_UNIQUENESS); return; } } // All is good so lets make the change panel.newAttribute(key, value, false, model); panel.update(); // [md] Added so that modification date updates. this.hide(); }
5
@Override public void decode(FacesContext context, UIComponent component) { FileUpload fileUpload = (FileUpload) component; if (!fileUpload.isDisabled()) { ConfigContainer cc = RequestContext.getCurrentInstance().getApplicationContext().getConfig(); String uploader = cc.getUploader(); boolean isAtLeastJSF22 = cc.isAtLeastJSF22(); if (uploader.equals("auto")) { if (isAtLeastJSF22) { if (isMultiPartRequest(context)) { NativeFileUploadDecoder.decode(context, fileUpload); } } else { CommonsFileUploadDecoder.decode(context, fileUpload); } } else if (uploader.equals("native")) { if (!isAtLeastJSF22) { throw new FacesException("native uploader requires at least a JSF 2.2 runtime"); } NativeFileUploadDecoder.decode(context, fileUpload); } else if (uploader.equals("commons")) { CommonsFileUploadDecoder.decode(context, fileUpload); } } }
7
public void setDisabledPlugins(Collection<PluginWrapper> plugins) { if (!plugins.isEmpty()) { StringBuilder sb = new StringBuilder(); Iterator<PluginWrapper> it = plugins.iterator(); if (!it.hasNext()) { return; } while (true) { PluginWrapper p = it.next(); if (!p.isPluginInitialized()) { sb.append(p.getPlugin().getClass().getName()); sb.append(','); } if (!it.hasNext()) { props.setProperty(KEY_DISABLED_PLUGINS, sb.toString()); return; } } } }
5
public boolean hidePlayer(Player player) { if (this.hiders.contains(player)) return false; //Event HidePlayerEvent event = new HidePlayerEvent(player); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) return false; this.hiders.add(player); for (Player p : Bukkit.getOnlinePlayers()) { if (player == p) continue; p.hidePlayer(player); } return true; }
4
public static boolean isCaptureMove(Board b, Move m, int color) { int opponentColor = opponentColor(color); if (color == Board.white) { if (b.board[m.end.rank][m.end.file] < 0) { return true; } } else if (color == Board.black) { if (b.board[m.end.rank][m.end.file] > 0) { return true; } } return false; }
4
public void put(String name, Object value) { if(value == null) { with(name, "NULL"); }else if(value instanceof String) { with(name, (String)value); } else if(value instanceof NVBase) { with(name, (NVBase)value); } else if(value instanceof Integer) { with(name, (Integer)value); } else if(value instanceof Double) { with(name, (Double)value); } else if(value instanceof Long) { with(name, (Long)value); } else if(value instanceof Boolean) { with(name, (Boolean)value); } else { BTLog.debug(this, "put", "no possible conversion for " + (value.getClass() != null ? value.getClass().getName() : "NULL")); } }
8
public Batch <Upgrade> workingUpgrades() { final Batch <Upgrade> working = new Batch <Upgrade> () ; if (upgrades == null) return working ; for (int i = 0 ; i < upgrades.length ; i++) { if (upgrades[i] != null && upgradeStates[i] == STATE_INTACT) { working.add(upgrades[i]) ; } } return working ; }
4
public void print(String prefix) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); if (prefix != null) pw.printf ( "%s", prefix); byte []data = getData(); int size = size(); boolean is_bin = false; int char_nbr; for (char_nbr = 0; char_nbr < size; char_nbr++) if (data [char_nbr] < 9 || data [char_nbr] > 127) is_bin = true; pw.printf ( "[%03d] ", size); int max_size = is_bin? 35: 70; String elipsis = ""; if (size > max_size) { size = max_size; elipsis = "..."; } for (char_nbr = 0; char_nbr < size; char_nbr++) { if (is_bin) pw.printf ("%02X", data [char_nbr]); else pw.printf ("%c", data [char_nbr]); } pw.printf ("%s\n", elipsis); pw.flush(); pw.close(); try { sw.close(); } catch (IOException e) { } System.out.print(sw.toString()); }
9
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
protected void resolveTransitions(Element root, Map<String, Element> stateMap, Map<Element, Element> transMap) { for(Element state: root.getChildren(STATE_TAG)){ boolean hasTimeout = false; for(Element trans: state.getChildren(TIMEOUT_TAG)) { Element target = stateMap.get(trans.getAttributeValue(TRANSITION_TARGET_TAG)); if(hasTimeout) throw new RuntimeException("State '"+target+"' has more than one timeout"); if(target == null) throw new RuntimeException("Timeout target does not exists in '" + root.getAttributeValue(AUTOMATA_NAME_TAG) + "/"+state+"': " + trans.getAttributeValue(TRANSITION_TARGET_TAG)); transMap.put(trans, target); hasTimeout = true; } for(Element trans: state.getChildren(TRANSITION_TAG)) { Element target = stateMap.get(trans.getAttributeValue(TRANSITION_TARGET_TAG)); if(hasTimeout) { String timeoutval = trans.getAttributeValue(TRANSITION_TIMEOUT_TAG); if (timeoutval != null && Integer.parseInt(timeoutval) == TimedAutomata.INFINITY) throw new RuntimeException("Cannot mix timeout and infinite guars in: "+ state); } if(target == null) throw new RuntimeException("Target does not exists in '" + root.getAttributeValue(AUTOMATA_NAME_TAG) + "': " + trans.getAttributeValue(TRANSITION_TARGET_TAG)); transMap.put(trans, target); } } }
9
public static void retractFactsOfInstance(LogicObject self) { if (self == null) { return; } { Proposition p = null; Cons iter000 = Logic.allFactsOfInstance(self, false, true).theConsList; loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { p = ((Proposition)(iter000.value)); if (p.kind == Logic.KWD_FUNCTION) { { Skolem skolem = ((Skolem)(p.arguments.last())); if (skolem == self) { continue loop000; } if ((skolem != null) && (((Stella_Object)(Stella_Object.accessInContext(skolem.variableValue, skolem.homeContext, false))) != null)) { Proposition.unassertProposition(p); } LogicObject.retractFactsOfInstance(skolem); } } else { Proposition.unassertProposition(p); } } } }
6
private void calculateEnabledState(Document doc) { if (doc == null) { setText(TEXT); setEnabled(false); } else { setText(new StringBuffer().append(TEXT).append(" ").append(doc.getUndoQueue().getUndoRangeString()).toString()); if(doc.getUndoQueue().isUndoable()) { setEnabled(true); } else { setEnabled(false); } } }
2
final private void compile() { children = (XML[]) childList.toArray(XML.class) ; attributes = (String[]) attributeList.toArray(String.class) ; values = (String[]) valueList.toArray(String.class) ; if (children == null) children = new XML[0] ; if ((attributes == null) || (values == null)) attributes = values = new String[0] ; if (print) { byte iB[] = new byte[indent] ; for (int n = indent ; n-- > 0 ;) iB[n] = ' ' ; String iS = new String(iB) ; I.say("" + iS + "tag name: " + tag) ; for (int n = 0 ; n < values.length ; n++) I.say("" + iS + "att/val pair: " + attributes[n] + " " + values[n]) ; I.say("" + iS + "tag content: " + content) ; } indent++ ; for (XML child : children) child.compile() ; indent-- ; }
7
@Override public Source putSource(Source s) throws JSONException, BadResponseException { Representation r = new JsonRepresentation(s.toJSON()); r= serv.putResource("intervention/" + interId + "/source", null, r); Source source = null; try { source= new Source(new JsonRepresentation(r).getJsonObject()); } catch (IOException e) { e.printStackTrace(); } catch (InvalidJSONException e) { e.printStackTrace(); } return source; }
2
@Override public int hashCode() { int hash = 0; hash += (depDepartamento != null ? depDepartamento.hashCode() : 0); return hash; }
1
@Override public void meetWith(Host host) { if (host == null) { return; } try { exchange_.execute(host); } catch (CommunicationException e) { logger_.error("{}:{} cannot be reached.", host, host.getPort()); repair_.fixNode(host); } }
2
public void upkeep(){ build_level+=(Empous.Gov.getStat("infrastructure")-7)*build_rate; if (build_level>max_build) build_level=max_build; }
1
public static int search(int[] A, int target) { int index = -1; int left = 0; int right = A.length - 1; while (left <= right) { int mid = left + (right - left) / 2; if(A[mid] == target){ return mid; } if (A[left] <= A[mid]) { if (target >= A[left] && target <= A[mid]) { right = mid - 1; } else { left = mid + 1; } }else if (A[left] > A[mid]) { if (target <= A[right] && target >= A[mid]) { left = mid + 1; } else { right = mid - 1; } } } return index; }
8
public static Player getPlayersOfTeam(Teams team) { switch (team) { case GREEN: return greenMembers; case RED: return redMembers; case ORANGE: return orangeMembers; case BLUE: return blueMembers; default: return null; } }
4
public String[] JSONReadInt( String pNombre, int pCantidad) { JSONParser parser = new JSONParser(); String [] arregloInt = new String [pCantidad]; int cont = 0; try { Object obj = parser.parse(new FileReader("src/" + pNombre +".json")); JSONObject jsonObject = (JSONObject) obj; // // loop array JSONArray tags = (JSONArray) jsonObject.get("Tags"); Iterator<String> iterator = tags.iterator(); while (cont < pCantidad && iterator.hasNext()) { //System.out.println(""+iterator.next()); arregloInt[cont] = iterator.next(); cont++; } } catch (FileNotFoundException e) { //manejo de error } catch (IOException e) { //manejo de error } catch (ParseException e) { //manejo de error } return arregloInt; }
5
@EventHandler public void SpiderHeal(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.getSpiderConfig().getDouble("Spider.Heal.DodgeChance") / 100; final double ChanceOfHappening = random.nextDouble(); if (ChanceOfHappening >= randomChance) { dodged = true; } if (plugin.getSpiderConfig().getBoolean("Spider.Heal.Enabled", true) && damager instanceof Spider && e instanceof Player && plugin.getConfig().getStringList("Worlds").contains(world) && !dodged) { Player player = (Player) e; player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, plugin.getSpiderConfig().getInt("Spider.Heal.Time"), plugin.getSpiderConfig().getInt("Spider.Heal.Power"))); } }
6
private VeldType[][] genSpeelveld(double aandeelLeeg) throws IllegalArgumentException { if(aandeelLeeg < 0 || aandeelLeeg > 1) throw new IllegalArgumentException("De verhouding tussen lege velden en muren moet tussen 0 en 100 liggen"); int max = 2; int min = 1; int range = (max - min) + 1; int type = 0; for (int i = 0; i < speelveld.length; i++) { for (int j = 0; j < speelveld[i].length; j++) { // type = (int) (Math.random() * range) + min; if (Math.random() < aandeelLeeg ) { speelveld[i][j] = VeldType.LEEG; } else { speelveld[i][j] = VeldType.MUUR; } } } return speelveld; }
5
@Override public void close() throws IOException { if(os != null){ try{ os.flush(); os.close(); os = null; } catch (IOException e ){ e.printStackTrace(); } } if(fWriter != null){ try{ fWriter.close(); fWriter = null; } catch (IOException e ){ e.printStackTrace(); } } if(is != null){ try{ is.close(); is = null; } catch (IOException e ){ e.printStackTrace(); } } if(fReader != null){ try{ fReader.close(); fReader = null; } catch (IOException e ){ e.printStackTrace(); } } connectionInStatus = false; connectionOutStatus = false; }
8
public String parse(CodeType codetype, boolean printLineNumbers, boolean genNewName){ Tree.printLineNumber = printLineNumbers; Tree.generateNewNames(genNewName); Tree.initializeIdentifierTable(); Tree tree = programPro(); if(codetype == CodeType.JS_MINIFIED) return tree.toString(); else if(codetype == CodeType.THREE_ADDRESS) return tree.getCode(); else if(codetype == CodeType.THREE_ADDRESS_LABELED) return tree.getLabelCode(); else if(codetype == CodeType.SIMPLE_CODE) return tree.getSimpleCode(); //System.out.println(tree.getCode()); //System.out.println(tree.getLabelCode()); //System.out.println(tree.getSimpleCode()); //System.out.println(ConstantFolding.optimize(tree.getSimpleCode())); return ""; }
4
public static void main(String[] args) { logger.setLevel(Level.SEVERE); ConsoleHandler handler = new ConsoleHandler(); handler.setLevel(Level.SEVERE); logger.addHandler(handler); if (args.length == 0) { logger.warning("Invalid arguments count."); return; } try { System.out.println(Arrays.toString(args)); String skey = args[0]; int key[] = new int[skey.length()]; int pos = 1; for (int k = 0; k < 256; k++) { for (int n = 0; n < skey.length(); n++) { if (skey.charAt(n) == k) { key[n] = pos++; } } } System.out.println(Arrays.toString(key)); String file = args[1]; String dir = args[2]; BufferedReader in = new BufferedReader(new FileReader(file)); while (in.ready()) { if (dir.equals("0")) { String ret = encrypt(key, in.readLine()); System.out.println(ret); } else if (dir.equals("1")){ String ret = decrypt(key, in.readLine()); System.out.println(ret); } else{ String ret = encrypt(key, in.readLine()); System.out.println(ret); ret = decrypt(key, ret); System.out.println(ret); } } } catch (NumberFormatException | FileNotFoundException ex) { logger.log(Level.SEVERE, null, ex); } catch (IOException ex) { logger.log(Level.SEVERE, null, ex); } }
9
private void addCustomer(int customernum) { int index; Customer c = factory.makeCustomer(); c.setCustomernumber(customernum); int smallestnumberofitems; int currentitems; int lanetoaddto = -1; if (this.val.expresslanenum > 0) // there are express lanes { if (c.size() <= this.val.expresslaneitemlimit) { // goes into // express lane lanetoaddto = 0; smallestnumberofitems = laneAry.get(0).getCurrentItems(); for (index = 1; index < this.val.expresslanenum; index++) { currentitems = laneAry.get(index).getCurrentItems(); if (currentitems < smallestnumberofitems) { smallestnumberofitems = currentitems; lanetoaddto = index; } } } else // doesn't go into express lane { smallestnumberofitems = laneAry.get(this.val.expresslanenum) .getCurrentItems(); lanetoaddto = this.val.expresslanenum; for (index = this.val.expresslanenum + 1; index < this.val.lanenum; index++) { currentitems = laneAry.get(index).getCurrentItems(); if (currentitems < smallestnumberofitems) { smallestnumberofitems = currentitems; lanetoaddto = index; } } } } else // no express lanes { lanetoaddto = 0; smallestnumberofitems = laneAry.get(0).getCurrentItems(); for (index = 1; index < this.val.lanenum; index++) { currentitems = laneAry.get(index).getCurrentItems(); if (currentitems < smallestnumberofitems) { smallestnumberofitems = currentitems; lanetoaddto = index; } } } if (lanetoaddto == -1) { System.out.println("error with lane manager add customer logic"); return; } else laneAry.get(lanetoaddto).AddtoLane(c); return; }
9
public void setJList(DefaultListModel<String> uList) { //System.out.println("asdf"); //dListModel = uList; }
0
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); datos = new DefaultTableModel(vcta,colum_names_tabla); tabla.setModel(datos); //ajustamos tamaño de la celda Fecha Alta /*TableColumn columna = tabla.getColumn("Fecha Alta"); columna.setPreferredWidth(100); columna.setMinWidth(100); columna.setMaxWidth(100);*/ if (!field_id_loc.getText().equals("")){ posicionarAyuda(field_id_loc.getText()); } else{ if ((fila_ultimo_registro-1 >= 0)&&(fila_ultimo_registro-1 < tabla.getRowCount())){ tabla.setRowSelectionInterval(fila_ultimo_registro-1,fila_ultimo_registro-1); scrollCellToView(this.tabla,fila_ultimo_registro-1,fila_ultimo_registro-1); cargar_ValoresPorFila(fila_ultimo_registro-1); } else{ if ((fila_ultimo_registro+1 >= 0)&&(fila_ultimo_registro+1 <= tabla.getRowCount())){ tabla.setRowSelectionInterval(fila_ultimo_registro,fila_ultimo_registro); scrollCellToView(this.tabla,fila_ultimo_registro,fila_ultimo_registro); cargar_ValoresPorFila(fila_ultimo_registro); } } } }
5
@Size(min = 2) public String getPin() { return pin; }
0
@Override public void setAddress(Address address) { super.setAddress(address); }
0
static LinkedListNode getKth(LinkedListNode n, int k) { int i = 0; LinkedListNode m = n; while (i<=k && m!=null) { m = m.next; i += 1; } if (i != k+1) return null; while (m != null) { n=n.next; m=m.next; } return n; }
4
private void readData(UUID parameterId) throws IOException { String line = findLine("Obj#", false); if (line == null) { errorsFile.add("Can't find Obj# tag"); } // Get the columns widths from the header int[] columnStartingPositions = getColumnStartingPositions(line); reader.readLine(); reader.readLine(); line = reader.readLine(); int i = 1; while (line != null && line.length() > 100) { String[] columns = getColumns(line, columnStartingPositions); boolean noWCS = noWCS(columns[5], columns[6], columns[7], columns[8], columns[9], columns[10], columns[11], columns[12]); // Are the columns OK List<Integer> integers = columnsOk(noWCS, columns); if (integers.size() == 0) { if (ProduceCSV.filtering) { // Now range check the results integers = rangeCheckColumns(noWCS, columns); } if (integers.size() == 0) { Double ra_rad = null; Double dec_rad = null; if (!noWCS) { ra_rad = Coords.hmsToRadians(columns[5]); dec_rad = Coords.dmsToRadians(columns[6]); } dataWriterCSV.writeDetections(noWCS, parameterId.getMostSignificantBits(), // parameterIdMsb parameterId.getLeastSignificantBits(), // parameterIdLsb columns[2], // X columns[3], // Y columns[4], // Z columns[5], // RA_hms columns[6], // DEC_dms columns[7], // VEL columns[8], // w_RA columns[9], // w_DEC columns[10], // w_50 columns[11], // w_20 columns[12], // w_VEL columns[13], // F_int columns[14], // F_tot columns[15], // F_peak columns[16], // SN_max columns[17], // X1 columns[18], // X2 columns[19], // Y1 columns[20], // Y2 columns[21], // Z1 columns[22], // Z2 columns[23], // Npix columns[24], // Flag columns[25], // X_av columns[26], // Y_av columns[27], // Z_av columns[28], // X_cent columns[29], // Y_cent columns[30], // Z_cent columns[31], // X_peak columns[32], // Y_peak columns[33], // Z_peak ra_rad, // RA_rad dec_rad, // DEC_rad parameterData.parameterNumber, // parameterNumber columns[0].trim()); // obj # parameterData.detectionsAdded++; } else { parameterData.rangeCheckErrorCount++; //LOG.warn("Range check error in line {} {}", i, parameterData.jobName); for (Integer col : integers) { errorsRangeCheck.add(String.format("Range check error in line %1d column %2d", i, col)); } } } else { parameterData.errorCount++; //LOG.error("Error reading line {} {}", i, parameterData.jobName); for (Integer col : integers) { errorsFile.add(String.format("Error reading line %1d column %2d", i, col)); } } line = reader.readLine(); i++; } }
9
private void Heapify(int i) { int left = (2*i + 1); int right = (2*i + 2); Racer leftRacer = null; Racer rightRacer = null; if(left < heapSize-1) { leftRacer = heapArray[left]; } if(right < heapSize-1) { rightRacer = heapArray[right]; } Racer currRacer = heapArray[i]; int smallest = i; if(left < heapSize-1 && leftRacer.getStart() > currRacer.getStart() && leftRacer.getEnd() < currRacer.getEnd()) { int score = currRacer.getScore(); currRacer.setScore(++score); smallest = left; currRacer = heapArray[left]; } // else if(left < heapSize-1 && leftRacer.getStart() < currRacer.getStart() && leftRacer.getId() > currRacer.getId()) // { // int score = currRacer.getScore(); // currRacer.setScore(++score); // smallest = left; // currRacer = heapArray[left]; // } if(right < heapSize-1 && rightRacer.getStart() > currRacer.getStart() && rightRacer.getEnd() < currRacer.getEnd()) { int score = currRacer.getScore(); currRacer.setScore(++score); smallest = right; currRacer = heapArray[right]; } // else if(right < heapSize-1 && rightRacer.getStart() < currRacer.getStart() && rightRacer.getId() > currRacer.getId()) // { // int score = currRacer.getScore(); // currRacer.setScore(++score); // smallest = right; // currRacer = heapArray[right]; // } if(smallest != i) { swap(smallest , i); Heapify(smallest); } }
9
public static String getFileContents(String u) { String contents = ""; BufferedReader br = null; try { URL url = new URL(u); InputStream is = url.openStream(); br = new BufferedReader(new InputStreamReader(is)); } catch (MalformedURLException e) { return ""; } catch (IOException e) { return ""; } try { String s; boolean eof = false; s = br.readLine(); while (!eof) { contents += s; try { s = br.readLine(); if (s == null) { eof = true; br.close(); } } catch (EOFException eo) { eof = true; } catch (IOException e) { return ""; } } } catch (IOException e) { return ""; } return contents.trim(); }
7
public MapModel(String mapFilePath) { initImages(); explosionDeaths = new ArrayList<Integer>(); if (mapFilePath == null) { generateRandomMap(); } else { try { loadMapFromFile(mapFilePath); } catch (Exception ex) { Logger.getLogger(MapModel.class.getName()).log(Level.SEVERE, null, ex); } } startMapView(); }
2
public YamlPermissionEntity(String n, ConfigurationSection config) { super(n, config); }
0
public static boolean stateHasChanged(int objectType, int objectX, int objectY, int objectHeight) { for (StateObject so : stateChanges) { if(so.getHeight() != objectHeight) continue; if(so.getX() == objectX && so.getY() == objectY && so.getType() == objectType) return true; } return false; }
5
private TypeAndValue plus(Vector<TypeAndValue> arguments, String caller) { if ( arguments.size() < 1 ) { System.err.println("Plus expected at least one argument and got zero."); System.exit(-1); } // our return value TypeAndValue ret = new MyVoid(); // what type of arithmetic? boolean canDoInt = true; boolean canDoDouble = true; // check the types, if all ints return an int, if there are any double use doubles, string fail for ( int i = 0; i < arguments.size(); ++i ) { // if any argument is not an integer if ( arguments.get(i).getType().compareTo("Integer") != 0 ) { // we cant do integer arthimetic canDoInt = false; // if it is also not a double if ( arguments.get(i).getType().compareTo("Double") != 0 ) { canDoDouble = false; } } } if ( canDoInt ) { int total = 0; for ( int i = 0; i < arguments.size(); ++i ) { total += ((Integer) arguments.get(i).getValue()).intValue(); } ret = new MyInteger( total ); } else if ( canDoDouble) { double total = 0; for ( int i = 0; i < arguments.size(); ++i ) { // if it's an int if ( arguments.get(i).getType().compareTo("Integer") == 0 ) { total += ((Integer) arguments.get(i).getValue()).doubleValue(); } // it must be a double else { total += ((Double) arguments.get(i).getValue()).doubleValue(); } ret = new MyDouble( total ); } } else { System.err.println("Error in plus()! Can only add types that are Integers or Doubles!"); System.exit(-1); } return ret; }
9
public String getCuentas(){ if(numCuentas<=-1) return null; else{ String temp=""; for(int i=0;i<=numCuentas;i++){ temp+="Cuenta "+(i+1)+":\n"+"Numero de Cuenta:"+cuentas[i].getNumDeCuenta(); if(cuentas[i].getNumDeCuenta().charAt(0)=='C') temp+=" Tipo de Cuenta: Cheques"; else if(cuentas[i].getNumDeCuenta().charAt(0)=='A') temp+=" Tipo de Cuenta: Ahorro"; if(cuentas[i] instanceof CuentaCheques) temp+="\nCuenta de Ahorro asociada:"+((CuentaCheques)cuentas[i]).getCuentaAhorro().getNumDeCuenta(); temp+="\n\n"; } return temp; } }
5
public void clearScorecard() { for (int column = 1; column < 4; column++){ for (int row = 0; row < 18; row++) tblScorecard.setValueAt("", row, column); } }
2
public OptionsPanel(LauncherFrame parent) { super(parent); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent arg0) { OptionsPanel.this.setVisible(false); } }); launcherFrame = parent; setModal(true); setTitle("Launcher options"); final JPanel panel = new JPanel(new BorderLayout()); final JLabel label = new JLabel("Launcher options", 0); label.setBorder(new EmptyBorder(0, 0, 16, 0)); label.setFont(new Font("Default", 1, 16)); panel.add(label, "North"); final JPanel optionsPanel = new JPanel(new BorderLayout()); final JPanel labelPanel = new JPanel(new GridLayout(0, 1)); final JPanel fieldPanel = new JPanel(new GridLayout(0, 1)); optionsPanel.add(labelPanel, "West"); optionsPanel.add(fieldPanel, "Center"); //FORCE UPDATE final JButton forceButton = new JButton( launcherFrame.locale.getString("options.forceUpdate")); if (launcherFrame.getConfig().getString("force-update") != null) { forceButton.setEnabled(false); forceButton.setText(launcherFrame.locale .getString("options.willForce")); } forceButton.addActionListener(new AL(forceButton)); labelPanel.add(new JLabel(launcherFrame.locale .getString("options.forceUpdateLabel") + ": ", 4)); fieldPanel.add(forceButton); //OFFLINE MODE labelPanel.add(new JLabel(launcherFrame.locale.getString("options.offlineMode"))); final JCheckBox offlineModeToggle = new JCheckBox(launcherFrame.locale.getString("options.onlineMode")); final boolean offlineMode = launcherFrame.getConfig().getBoolean("launcher.offlineMode"); if(offlineMode) { offlineModeToggle.setSelected(true); offlineModeToggle.setText(launcherFrame.locale.getString("options.offlineMode")); } offlineModeToggle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(offlineModeToggle.isSelected()) { offlineModeToggle.setText(launcherFrame.locale.getString("options.offlineMode")); launcherFrame.getConfig().set("launcher.offlineMode", true); } else { offlineModeToggle.setText(launcherFrame.locale.getString("options.onlineMode")); launcherFrame.getConfig().set("launcher.offlineMode", false); } } }); fieldPanel.add(offlineModeToggle); //HTTP MODE final boolean httpsMode = launcherFrame.getConfig().getBoolean("launcher.httpsMode"); final JCheckBox httpsModeToggle = new JCheckBox(); if(httpsMode) { labelPanel.add(new JLabel(launcherFrame.locale.getString("options.httpsMode"))); httpsModeToggle.setText(launcherFrame.locale.getString("options.httpsMode")); httpsModeToggle.setSelected(true); } else { labelPanel.add(new JLabel(launcherFrame.locale.getString("options.httpMode"))); httpsModeToggle.setText(launcherFrame.locale.getString("options.httpMode")); } httpsModeToggle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(httpsModeToggle.isSelected()) { httpsModeToggle.setText(launcherFrame.locale.getString("options.httpsMode")); launcherFrame.getConfig().set("launcher.httpsMode", true); } else { httpsModeToggle.setText(launcherFrame.locale.getString("options.httpMode")); launcherFrame.getConfig().set("launcher.httpsMode", false); } } }); fieldPanel.add(httpsModeToggle); //PROFILS labelPanel.add(new JLabel(launcherFrame.locale .getString("options.profiles") + ":")); final JButton profilesButton = new JButton( launcherFrame.locale.getString("options.profiles")); profilesButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new ProfilesPanel(launcherFrame).setVisible(true); } }); fieldPanel.add(profilesButton); //GAME LOCATION labelPanel.add(new JLabel(launcherFrame.locale .getString("options.gameLocationLabel") + ": ")); final TransparentLabel dirLink = new TransparentLabel(Utils .getWorkingDirectory(launcherFrame).toString()) { private static final long serialVersionUID = 0L; @Override public void paint(Graphics g) { super.paint(g); int x = 0; int y = 0; final FontMetrics fm = g.getFontMetrics(); final int width = fm.stringWidth(getText()); final int height = fm.getHeight(); if (getAlignmentX() == 2.0F) { x = 0; } else if (getAlignmentX() == 0.0F) { x = getBounds().width / 2 - width / 2; } else if (getAlignmentX() == 4.0F) { x = getBounds().width - width; } y = getBounds().height / 2 + height / 2 - 1; g.drawLine(x + 2, y, x + width - 2, y); } @Override public void update(Graphics g) { paint(g); } }; dirLink.setCursor(Cursor.getPredefinedCursor(12)); dirLink.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { try { Utils.openLink(new URL("file://" + Utils.getWorkingDirectory(launcherFrame) .getAbsolutePath().replaceAll(" ", "%20")) .toURI()); } catch (final Exception e) { e.printStackTrace(); } } }); dirLink.setForeground(new Color(2105599)); fieldPanel.add(dirLink); panel.add(optionsPanel, "Center"); final JPanel buttonsPanel = new JPanel(new BorderLayout()); buttonsPanel.add(new JPanel(), "Center"); final JButton doneButton = new JButton( launcherFrame.locale.getString("options.done")); doneButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { OptionsPanel.this.setVisible(false); } }); buttonsPanel.add(doneButton, "East"); buttonsPanel.setBorder(new EmptyBorder(16, 0, 0, 0)); panel.add(buttonsPanel, "South"); getContentPane().add(panel); panel.setBorder(new EmptyBorder(16, 24, 24, 24)); pack(); setLocationRelativeTo(parent); }
9
public boolean evaluate_boolean(Object[] dl) throws Throwable { if (Debug.enabled) Debug.println("Wrong evaluateXXXX() method called,"+ " check value of getType()."); return false; };
1
public void setTime(String timeOfDay) { this.timeOfDay = timeOfDay; }
0
public static void main(String[] args) { int x,y,r; double proceso,co=1,co1=1; x=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero X")); y=Integer.parseInt(JOptionPane.showInputDialog("Ingrese el valor del entero Y")); double a=(double)x; if (x<=0 || x>255) { r=-1; JOptionPane.showMessageDialog(null,"Resultado "+r); } else { double[] arreglo=new double[y]; arreglo[0]=a; for (int i = 1;i<arreglo.length; i++) { co=co+1; proceso=x*(1/co); arreglo[i]=proceso; } for (int i = 0; i < arreglo.length; i++) { if(i==(y-1)) { JOptionPane.showMessageDialog(null,"Resultado "+arreglo[i]); } } } }
5
@Override public void startElement(String s, String s1, String elementName, Attributes attributes) throws SAXException { if (elementName.equalsIgnoreCase("bulgarian")) { cyrillic = true; } if (elementName.equalsIgnoreCase("english")) { cyrillic = false; } if (elementName.equalsIgnoreCase("data")) { data = true; } if (elementName.equalsIgnoreCase("alphabet")) { alphabet = true; } if (elementName.equalsIgnoreCase("WordCollection")) { wordCollection = new WordCollection(attributes.getValue("title")); } if (elementName.equalsIgnoreCase("Word")) { word = new Word(); } if (elementName.equalsIgnoreCase("Letter")) { letter = new Letter(); } }
7
@Override public void update() { if (bounded) { int newy = y; newy += down ? 1 : -1; if (Game.getInstance().map.hasCollisionExcept(x, newy, this) || Game.getInstance().map.outOfBounds(x, newy)) { down = !down; } else { y = newy; } } else { y += down ? 1 : -1; level--; if (level == 0) { level = levellim; down = !down; } } }
6
private void createNewMap() { //Criando os tiles: tileMaps = new Tile[MAP_SIZE_H][MAP_SIZE_W]; //Instanciando tudo como grama: for (int y = 0; y < MAP_SIZE_H; y++) { for (int x = 0; x < MAP_SIZE_W; x++) { tileMaps[y][x] = new Tile(Tile.TILE.GRASS, x, y, getTileset()); } } }
2
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // if the element name is valid and in the elementMap if (elementMap.containsKey(qName.toUpperCase())) { Element name = elementMap.get(qName.toUpperCase()); // if the parent of the element is on the stack if (stack.peek() == parentMap.get(name)) // push the element onto the stack stack.push(name); else { throw new SAXException("Element type " + qName + " has incorrect nesting"); } } else { throw new SAXException("Unknown Start Element Type: " + qName + "."); } String fileName; File csvFile; // switch mainly used to process attribute values of elements switch (stack.peek()) { case SIMDOMAIN: numLayer = Integer.parseInt(attributes.getValue("layers")); break; case SIMTIMESTEPS: Director.setTimeStep(Integer.parseInt(attributes .getValue("simsteptime"))); break; case LAYER: if (!gridStart) { grid.setLimits(new Point(numRow, numCol), numLayer); grid.initializeAll(); gridStart = true; } curLayer = Integer.parseInt(attributes.getValue("lay")) - 1; break; case TOP: fileName = attributes.getValue("src"); csvFile = new File(xmlFile.getParentFile().getAbsolutePath(),fileName); grid.importCSV(csvFile, curLayer, Grid.LAYER); break; case OIL: fileName = attributes.getValue("src"); csvFile = new File(xmlFile.getParentFile().getAbsolutePath(),fileName); grid.importCSV(csvFile, curLayer, Grid.OIL); break; case GAS: fileName = attributes.getValue("src"); csvFile = new File(xmlFile.getParentFile().getAbsolutePath(),fileName); grid.importCSV(csvFile, curLayer, Grid.GAS); break; } }
9
public List<String> databaseInfo(String columnName) throws SQLException{ List<String> supplierInfo=new ArrayList(); try{ databaseConnector=myConnector.getConnection(); stmnt=(Statement) databaseConnector.createStatement(); SQLQuery="SELECT * FROM familydoctor.supplier"; dataSet=stmnt.executeQuery(SQLQuery); while(dataSet.next()){ name=dataSet.getString(columnName); supplierInfo.add(name); } } catch(SQLException e){ System.out.println(e.getMessage()); } finally{ if(stmnt!=null) stmnt.close(); if(databaseConnector!=null) databaseConnector.close(); } return supplierInfo; }
4
@Test public void UpdateFilesTest() { this.observable.addObserver(this.mockObserver); assertEquals(this.mockObserver.nbTimesUpdated,0); File dropins = new File("./dropins/plugins/"); int preUpdate=0; if(dropins.listFiles().length!=0){ try { this.observable.updateFiles(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } preUpdate++; } File wrongPlugin = new File(dropins.getAbsolutePath()+"/JUnitTest_wrongPlugin.java"); wrongPlugin.deleteOnExit(); System.out.println(wrongPlugin.getAbsolutePath()); try { wrongPlugin.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { this.observable.updateFiles(); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } assertEquals(this.mockObserver.nbTimesUpdated,0+preUpdate); // nothing found File acceptablePlugin = new File(dropins.getAbsolutePath()+"/JUnitTest_acceptablePlugin.class"); acceptablePlugin.deleteOnExit(); try { acceptablePlugin.createNewFile(); } catch (IOException e) { e.printStackTrace(); } try { this.observable.updateFiles(); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } assertEquals(this.mockObserver.nbTimesUpdated,1+preUpdate); // something found }
9
public Solver(WordSearch wordSearch) { this.solutions = new HashSet<>(); char[][] grid = wordSearch.getGrid(); String[] words = wordSearch.getWords(); next: for (String word : words) { for (int x = 0; x < grid.length; x++) { for (int y = 0; y < grid[x].length; y++) { for (Direction d : Direction.values()) { char[] letters = getLettersFromGrid(d, x, y, word.length(), wordSearch); if (letters == null) continue; if (isEqual(letters, word)) { solutions.add(new Word(word, d, new Point(x, y))); continue next; } } } } } }
6
public static boolean shouldIncludeFunction(Function fn) { if (Directives.has(fn, "keep") || Directives.has(fn, "export") || Directives.has(fn, "main")) { return true; } if (Directives.has(fn, "inline") || Directives.has(fn, "native") || Directives.has(fn, "!keep")) { return false; } if (fn.isCompiled() && !fn.isLibrary()) { if (fn.references!=0) { return true; } } return false; }
9