text
stringlengths
14
410k
label
int32
0
9
protected final short get_action(int state, int sym) { short tag; int first, last, probe; short[] row = action_tab[state]; /* linear search if we are < 10 entries */ if (row.length < 20) for (probe = 0; probe < row.length; probe++) { /* is this entry labeled with our S...
7
@Override public void onDraw(Graphics G, int viewX, int viewY) { if (X>viewX-houseW&&X<viewX+houseW+300&&Y>viewY-(houseH)&&Y<viewY+houseH+300) { if (chimney) { G.setColor(Color.black); G.fillRect((int)(houseX+(houseW/1.5))-viewX, (int)(houseY-(...
5
private void triFusion(int debut, int fin) { // tableau o� va aller la fusion int[] tFusion = new int[fin - debut + 1]; int milieu = (debut + fin) / 2; // Indices des �l�ments � comparer int i1 = debut, i2 = milieu + 1; // indice de la prochaine case du tableau tFusion � remplir int...
7
public Model getInventoryModel(int amount) { if (stackableIds != null && amount > 1) { int stackableId = -1; for (int i = 0; i < 10; i++) if (amount >= stackableAmounts[i] && stackableAmounts[i] != 0) stackableId = stackableIds[i]; if (stackableId != -1) return getDefinition(stackableId).getInv...
9
@Override public void run() { while (!stop) { try { selector.select(1000); Set<SelectionKey> selectionKeys = selector.selectedKeys(); Iterator<SelectionKey> it = selectionKeys.iterator(); SelectionKey key; while (it.hasNext()) { key = it.next(); it.remove(); try { handleIn...
8
public static void main(String[] args) { // vytvorit vlakno serveru a klienta String name = args[0]; int port = Integer.parseInt(args[1]); String file = (args.length > 2) ? args[2] : null; try { Thread serverTh; InetAddress localhost = InetAddress.getLoc...
4
public frmVenda() throws ErroValidacaoException, ParseException { initComponents(); dao = new VendaDao(); pgdao = new PagamentoDao(); pdao = new ProdutoDao(); cdao = new ClienteDao(); fdao = new FuncionarioDao(); //============ List<Pagamento> pag...
4
public Object get(int index) { if (index < 0 || index >= instructionCount) throw new IllegalArgumentException(); return get0(index); }
2
protected void move(final int x, final int y, final Piece piece) throws InvalidMoveException{ if (0 <= x && x <= Board.DIM && 0 <= y && y <= Board.DIM && canMove(x, y, piece)) { cells[x][y].addPiece(piece); } else { throw new InvalidCellException(); } }
5
private void ajout_dispoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ajout_dispoActionPerformed // TODO add your handling code here: int n; switch(etat){ case Intervenant: this.intervenant = new Intervenant(this.nom.getText(),this.prenom.getText(...
6
private void addFileAppender(String appenderName, String level) throws IOException { if ((config.getLoggerName() == null) || (config.getLoggerName().equals("log4j"))) { RollingFileAppender fileAppndr = (RollingFileAppender)Logger.getRootLogger().getAppender(appenderName); if (fileAppndr != null) { ...
3
@Override public boolean extensionExists(String ext) { Iterator it = getExtensions(); while (it.hasNext()) { String key = (String) it.next(); if (ext.equals(key)) { return true; } } return false; }
2
public void notifyObservers() { for (Observer observer : mObservers) { observer.update(); } }
1
private LinkedList<String> parseInfix(LinkedList<String> input){ LinkedList<String> stack= new LinkedList<>(); LinkedList<String> outputQueue= new LinkedList<>(); input.stream().forEach( token ->{ if(token.equals("(")){ stack.push(token); }else if(...
8
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
@Override public void drawPanel(Graphics g) { g.drawRect(position.width-width/2, position.height-height/2, width, height); Font font = g.getFont(); int posX = position.width - font.getSize()*operator.toString().length()/4; int posY = position.height + font.getSize()...
3
protected static Font setFont(Font font, boolean bold, boolean italic) { if (font == null) { return null; } if ((font.getStyle() & Font.BOLD) != 0) { if (!bold) { return font.deriveFont(font.getStyle() ^ Font.BOLD); } } else { if (bold) { return font.deriveFont(f...
7
public String goToAdminProductDetails() { this.product = this.userFacade.getProductById(this.id); return "adminProductDetails"; }
0
private void recTree(int[][] processingField_prievious, int depth, int depth_current, Node currentNode, int player) { int[][] processingField_current; // End-Kondition für Rekursion. Dann wird aktuelle Node mit ihrem Tiefenwert und Score bestückt if (depth == depth_current) { proce...
7
public void setProfession(Profession newProf) { resetExp(); switch (newProf) { case Warrior: getEquipment().сhangeWeapon(Equipment.StandartEquipment.Weapons.Sword); getEquipment().сhangeArmor(Equipment.StandartEquipment.Armors.MediumArmor); ...
5
public Player(boolean isWhite) { this.isWhite = isWhite; }
0
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof Names) { Names other = (Names) obj; return this.firstName.equals(other.firstName) && this.lastName.equals(oth...
6
private void loadFile(String fileName) throws CWRCException { childrenFound = false; file = new File(fileName); if (file.exists()) { } else { try { FileOutputStream fileOut = new FileOutputStream(file); XMLStreamWriter out = XMLOutputFactory.n...
8
@SuppressWarnings("unchecked") @Override public Boolean compareAnswer(Object input) { HashMap<Integer, Integer> inputMap; try{ inputMap = (HashMap<Integer, Integer>) input; }catch(ClassCastException e){ return false; } for (Integer key: inputMap.keySet()){ if (!inputMap.get(key).equals(answer.get(k...
3
public static String applyRelativePath(String path, String relativePath) { int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR); if (separatorIndex != -1) { String newPath = path.substring(0, separatorIndex); if (!relativePath.startsWith(FOLDER_SEPARATOR)) { newPath += FOLDE...
2
@RequestMapping(value = "/createEntity", method = RequestMethod.GET) public ModelAndView welcome() { ModelAndView mav = new ModelAndView("create-entity"); EntityForm entityForm = new EntityForm(); mav.addObject(entityForm); return mav; }
0
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean(); lef.setDataSource(dataSource); lef.setJpaVendorAdapter(...
0
public static int parseSize(String value) throws ParseException{ Pattern p = Pattern.compile("\\s*(((?<mb>[1-9][0-9]*)\\s*(M[Bb])?)|((?<gb>[1-9][0-9]*)\\s*G[Bb]))\\s*"); Matcher m = p.matcher(value); if (m.matches()){ String mb = m.group("mb"); String gb = m.group("gb"); if (null != mb){ retur...
2
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
private ArrayList<DayEvents> readStats(String eventStatsFile, String ijStatsFile) { ArrayList<DayEvents> dayEventsList = new ArrayList<DayEvents>(); ArrayList<double[]> eventRateStatsList = new ArrayList<double[]>(); ArrayList<double[]> ijStatsList = new ArrayList<double[]>(); int ijDyadsWithNoEdges = 0; ...
8
private boolean isTwoByteVal(int valCode) { switch (valCode) { case ValCodes.LITERAL: return true; case ValCodes.POINTER: return true; case ValCodes.atA_plusLiteral: return true; case ValCodes.atB_plusLiteral: return true; case ValCodes.atC_plusLiteral: return true; case ValC...
8
public float ms_per_frame() // E.B { if (h_vbr == true) { double tpf = h_vbr_time_per_frame[layer()] / frequency(); if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2; return ((float) (tpf * 1000)); } else { float ms_per_frame_array[][] = {{8.707483f, 8.0f, 12.0f}, ...
3
public void startLoops(){ timer = new Timer(); new Timer().schedule(new TimerTask() { public void run() { gameLoop(); if(!running){cancel();} } }, 0, (long) (1000*period)); }
1
public boolean containsValue(Object value) { for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) { Object key = iter.next(); Object val = map.get(key); if (val.equals(value)) { touch(key); return true; }//if }//for iter return false; }//containsValue
2
public static ArrayList<DyeParent> getDyeParents() throws SQLException { ArrayList<DyeParent> dyeParents = new ArrayList<DyeParent>(); Statement stm = conn.createStatement(); ResultSet rs = stm.executeQuery("select d.name_dyeparent, d.price_dyeparent, dt.name_dyetype from DyeParent d " + ...
5
public Position getMovePosition() { if (this.getWorld() == null) return null; double bestAngle = this.getAngle(); double bestDistance = 0; Position bestPos = this.getPosition(); for (double currentAngle = this.getAngle() - 0.7875; currentAngle <= this.getAngle() + 0.7875; currentAngle += 0.0175) { doubl...
9
public int add(sols.Model.SubSection subSection){ int generated_Subsec_ID=-1; StringBuffer sql=new StringBuffer(); sql.append("INSERT INTO SubSection"); sql.append("(`SubSection_ID`,"); sql.append("`Section_ID`,"); sql.append("`SubSection_Name`)"); sql.ap...
2
public char skipTo(char to) throws JSONException { char c; try { long startIndex = this.index; long startCharacter = this.character; long startLine = this.line; this.reader.mark(1000000); do { c = this.next(); if...
3
public boolean isAlive() { return alive; }
0
private static void reboot() { String jarLocation = System.getProperty("java.class.path"); if (IS_MAC) { jarLocation = ModelerUtilities.validateJarLocationOnMacOSX(jarLocation); } else if (System.getProperty("os.name").startsWith("Windows")) { jarLocation = "\"" + jarLocation + "\""; } String maxHeap ...
7
@Override public void actionPerformed(ActionEvent event) { PrintProxy proxy = getTarget(PrintProxy.class); if (proxy != null) { print(proxy); } }
1
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("ANNOTATION= {"); java.util.Enumeration keys = entries.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = entries.get(key); sb.append(key...
7
protected void execute() {}
0
public String[] dequeStringArray() { Deque<String> dequelist = new ArrayDeque(); dequelist.add("equity"); dequelist.addFirst("Derivative"); dequelist.addLast("commondities"); Iterator<String> iter = dequelist.iterator(); String[] tmp = new String[dequelist.size()]; ...
1
private Object parseArray() throws StreamCorruptedException { int arrayLen = readLength(); indexPlus(1); Map<String, Object> result = new LinkedHashMap<String, Object>(); Object resultObj; for (int i = 0; i < arrayLen; i++) { Object tmp = parse(); String key = ""; try { key = tmp.toString(); ...
6
public Game(GameMaster master, Board board) { this.master = master; this.board = board; attemptsCount = 0; targetFound = false; gameid = UUID.randomUUID(); }
0
public void draw(Object obj, Component comp, Graphics2D g2, Rectangle rect) { Color color = (Color) AbstractDisplay.getProperty(obj, "color"); if (color == null && obj instanceof Color) color = (Color) obj; Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor"); ...
9
public void drawObjectsWithID(BufferedImage canvas, boolean fill) { BufferedImage image = new BufferedImage(_width, _height, BufferedImage.TYPE_INT_RGB); Graphics2D g = image.createGraphics(); g.drawImage(VisionUtils.convert2grey(canvas), 0, 0, null); g.setFont(new Fo...
6
@EventHandler public void onBlockPlace(BlockPlaceEvent event) { System.out.println(tracks); Block b = event.getBlock(); Player p = event.getPlayer(); if (builderList.containsKey(p.getName())) { Track t = getTrack(builderList.get(p.getName())); if (b.getType() == Material.WOOL) { Wool wool = new Wool(...
5
private Component getHeader() { JButton jbSaveOutput = new JButton("<html>Save<br>output</html>"); jbSaveOutput.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { String outputText = getParsedText("\n"); if (outputText.lengt...
5
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { long newTimestamp = Long.parseLong(params.get("timestamp")); TimeMachine.setNow(newTimestamp); JSONObject rtn = new JSONObject(); rtn.put("rtnCode", this.getRtnCode(200)); return rtn; }
0
@Override public boolean bajaDepartamento(int id) { EntityManager em = null; boolean correcto = false; try { EntityManagerFactory ef = Persistence.createEntityManagerFactory("MerkaSoftPU"); em = ef.createEntityManager(); em.getTransaction().begin(); ...
4
public boolean isMatched(TreeNode T1, TreeNode T2) { if (T2 == null && T1 == null) return true; else if (T2 == null && T1 != null) return false; else if (T1 == null && T2 != null) return false; else if (T1.value != T2.value) return false; else return isMatched(T1.leftChild, T2.leftChild) && isM...
8
public Object transform(String input) { String[] split = StringUtils.split(input, " "); // Single provided argument (cannot be split) which is the word 'status' // - return status of all lines if (split.length == 1 && input.equals("status")) { log.info("Request [" + input + "] resulted in a status reques...
6
public void mouseWheelMoved(MouseWheelEvent e) { if(Global.isRunning) { return; } // block mouse input while simulating int clicks = e.getWheelRotation(); if(clicks < 0) { gui.zoom(1.08); // zoom In } else { gui.zoom(1.0 / 1.08); // zoom out } }
2
public boolean onoff(Model2D model) { float power = powerSource.getPower(); if (power == 0) return false; boolean refresh = false; float t = 0; if (thermometer != null) { t = thermometer.getCurrentData(); } else { Rectangle2D bounds = powerSource.getShape().getBounds2D(); t = model.getTemperatur...
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; PSkill pSkill = (PSkill) o; return skill == pSkill.skill && ...
7
public void checkProduction(Production production) { if (production.getLHS().length() == 0) { throw new IllegalArgumentException( "The left hand side cannot be empty."); } }
1
private int evalState(State s) { if (me.equals("red")) return s.getnRed() - s.getnBlue(); return s.getnBlue() - s.getnRed(); }
1
static void preprocess(char[] p) { int i = 0, j = -1, m = p.length; b = new int[p.length + 1]; b[0] = -1; while (i < m) { while (j >= 0 && p[i] != p[j]) j = b[j]; i++; j++; b[i] = j; } }
3
private void button10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button10MouseClicked if(numberofpins < 4) { if(numberofpins == 0) { Login_form.setString1("1"); } if(numberofpins == 1) { Login_form.setString2("1"); } if(numberofpins == 2) { Logi...
5
private void resolveLine(Node parentNode) { validateTagsOnlyOnce(parentNode, new String[]{"datasource", "color", "legend", "width"}); String datasource = null, legend = null; Paint color = null; float width = 1.0F; Node[] childNodes = getChildNodes(parentNode); for (Node ...
7
public boolean isSameTree(TreeNode p, TreeNode q) { if(p == null && q == null) return true; if(p == null && q != null) return false; if(p != null && q == null) return false; if(p.val == q.val) { return isSameTree(p.left, q.left) && isSameTree(p.right, q.right); } else { return false; ...
8
private HashSet<String> loadFile(String name) { HashSet<String> words = new HashSet<String>(); FileReader reader = null; BufferedReader br = null; File file = new File(this.getDataFolder(), name); if(!file.exists()) { try { file.createNewFile(); } catch (IOException e) { logger.severe("...
8
public void onMessage(Message inMessage) { TextMessage msg = null; try { if (inMessage instanceof TextMessage) { System.out.println("onMessage received in SHSMessageBean.java"); msg = (TextMessage) inMessage; Thread.sleep(100); ...
2
public EncryptedCommunityCards requestDecryptComCards( EncryptedCommunityCards encComCards, final User usr) throws InvalidSubscriptionException, IOException, InterruptedException { final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '" + DECRYPT_COM_CARDS_REPLY + "' && " + GAME_ID + " == '" ...
2
private long toHours() { switch (type) { case SECONDS: return value / 3600; case MINUTES: return value / 60; case HOURS: return value; case DAYS: return value * 24; case MILLISECONDS: ...
5
static void input(double[][] matrix){ for(int i = 0; i < matrix.length; i++){ for(int j = 0; j < matrix[i].length; j++){ matrix[i][j] = scan.nextDouble(); } } }
2
public String getUrl() { if ( this.url == null ) return ""; return url; }
1
GF256Poly(GF256 field, int[] coefficients) { if (coefficients == null || coefficients.length == 0) { throw new IllegalArgumentException(); } this.field = field; int coefficientsLength = coefficients.length; if (coefficientsLength > 1 && coefficients[0] == 0) { // Leading term must be non...
7
public List<ProductManagerDto> getProductManagerDtos(){ List<ProductManagerDto> productManagerDtos=null; PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn .prepareStatement("select mgrName,phoneNumber from ProductManager"); rs = stmt.executeQuery(); String mgrName = ""; ...
4
@Override public int compareTo(Arbre otherArbre) { return (this.poids < otherArbre.getPoids()) ? -1: (this.poids > otherArbre.getPoids()) ? 1:0; }
2
public String select(String whereClause, String... columns) { String format = null; if (null == whereClause || whereClause.isEmpty()) { format = String.format("SELECT %s FROM `%s`.`%s`", wrap(columns), schema, table); } else { format = String.format("SELECT %s FROM `%s`.`%s` WHERE %s", wrap(columns), schema...
2
private void completeFinalBuffer(ByteBuffer buffer) { if(finalBuffer.position() == 0) return; while(buffer.remaining() > 0 && finalBuffer.remaining() > 0) { finalBuffer.put(buffer.get()); } if(finalBuffer.remaining() == 0) { transform(finalBuffer.array(),0); finalBuffer.rewind(); } }
4
public void setCityName(String cityName) { this.cityName = cityName; }
0
private static void begin() { Scanner sc = new Scanner(System.in); int noTestCases = Integer.parseInt(sc.nextLine()); for (int t = 0; t < noTestCases; t++) { Map<Integer, String> table = new HashMap<Integer, String>(); int noTurtles = Integer.parseInt(sc.nextLine()); ...
8
private DoubleDoors getDoor(int id, int x, int y, int z) { for (DoubleDoors d : doors) { if (d.doorId == id) { if (d.x == x && d.y == y && d.z == z) { return d; } } } return null; }
5
public Grammar parseGrammarFromFile(String filePath) throws IOException { //Create new Grammar and set up file to be read parsedGrammar = new Grammar(); BufferedReader reader = (BufferedReader) GrammarReader.readFromFile(filePath); //Create boolean flag to indicate if the file is currently in the first few l...
8
private void button14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button14ActionPerformed if (order2code3tf.getText().equals("1001")) { o2c3destf.setText("Chicken Nugget"); } if (order2code3tf.getText().equals("1002")) { o2c3...
9
public static String preprocessWikiText(String text) { if (text==null) return ""; text=text.trim(); int length=text.length(); char[] chars=new char[length]; text.getChars(0, length, chars, 0); StringBuilder sb=new StringBuilder(); boolean blankLine=true; StringBuilder spaces=new StringBu...
8
public void visitMultiANewArrayInsn(final String desc, final int dims) { mv.visitMultiANewArrayInsn(desc, dims); if (constructor) { for (int i = 0; i < dims; i++) { popValue(); } pushValue(OTHER); } }
2
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
8
private void acao143() throws SemanticError{ numeroParametrosAtuais++; if(contextoExpressao == ContextoExpressao.PARAMETROS_ATUAIS) verificarParametro(); else if(contextoExpressao == ContextoExpressao.IMPRESSAO) if(tipoExpressao == Tipo.BOOLEANO) throw new SemanticError("Tipo inválido para impressão"...
3
public List<Message> fetchUserFriendMessages(User user) { initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; List<Message> messageList = null; try { /* Union query produces a list of email addresses - the logged-in user for plus all people he'...
3
private void doFirePropertyChange(PropertyChangeEvent event) throws PropertyVetoException { String propName = event.getPropertyName(); Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); if (newValue != null && oldValue != null && newValue.equals(ol...
9
public void printNodesStack() { for (int i = 0; i < topOfStack; i++) { System.out.print((nodesStack[i] + 1) + " "); if (i % 100 == 0) System.out.println(); } }
2
@SuppressWarnings ("unchecked") protected final void update(final BaseItem item) throws NullPointerException, IllegalStateException, IllegalArgumentException { switch (item.state()) { case Item.REMOVE_STATE: case Item.CREATE_STATE: if (!this.equals(item.pool())) throw new IllegalArgumentException(); th...
5
public JPanel getUsertileImageMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.usermenuImageMenu; }
1
public void enol(int... overlays) { for (int ol : overlays) visol[ol]++; }
1
public List<IrcUser> getUsers(){ return Users; }
0
private boolean jj_3_2() { if (jj_3R_20()) return true; return false; }
1
public String getOutputKeyword() { Dialog currentDialog = DialogManager.giveDialogManager().getCurrentDialog(); switch((KitchenAssistance)getCurrentState()) { case KA_ENTRY: setQuestion(true); return "<" + currentDialog.getCurrentSession().getCurrentUser().getUserData().getUserName() + ">"; case KA_EXIT: ...
8
@Test public void testConstructor() throws SQLException, IOException, ClassNotFoundException { // Make new clean database new File("testConstructor.db").delete(); Timeflecks.getSharedApplication().setDBConnector( new SQLiteConnector(new File("testConstructor.db"), true)); ArrayList<File> files = new A...
4
public int totalNQueens2(int n){ List<Integer> perm = new ArrayList<Integer>(n); for (int i = 0; i < n; ++i) perm.add(i); totalNQueens2Rec(0, perm); return res; }
1
private double functionVal(MinimaxNode node) { Player[] players = node.getGame().getPlayers(); double functionVal = 0; boolean hasWon = true; for(Player enemy : players) { if(enemy.getLoyalty() != player.getLoyalty()) { if(!enemy.isDefeated()) { hasWon = false; } } } if...
8
public boolean doTransformations() { if (instr == null) return false; /* * Do on the fly access$ transformation, since some further operations * need this. */ if (instr instanceof InvokeOperator) { Expression expr = ((InvokeOperator) instr).simplifyAccess(); if (expr != null) instr = expr; ...
9
public void draw(Graphics2D g, TreeNode node) { g.fill(NODE_SHAPE); Color c = g.getColor(); g.setColor(Color.black); g.draw(NODE_SHAPE); MinimizeTreeNode m = (MinimizeTreeNode) node; g.setColor(c); drawBox(g, getStateString(m), new Point2D.Float(0.0f, 0.0f)); g.setColor(c); drawBox(g, m.getTerminal()...
1
public void radixSort(int[] data){ int max = data[0] , radix = 1;; for (int i = 0; i < data.length; i++) { if(max < data[i]){ max = data[i]; } } Node[] bucket = new Node[10]; for (int i = 0; i < bucket.length; i++) { bucket[i] = new Node(); } while( max/radix > 0 ){ for (int i = 0; i < ...
7
protected synchronized void parserNode(Node node, WebPage wp) throws Exception { if (node instanceof TextNode) {// 判斷是否是文本結點 // srb.addText(((TextNode) node).getText()); } else if (node instanceof Tag) {// 判斷是否是標籤庫結點 Tag atag = (Tag) node; if(wp.getCharSet().equalsIgnoreCase("ISO-8859-1")){ //抓此連結的 ...
6
public static Carte getCarte (Label label, Couleur couleur) { Carte carte; switch (label) { case JOKER: carte = new Joker(); break; case PLUS2: carte = new Plus2(couleur); break; case PLUS4: carte = new Plus4(); break; case SINT: carte = new SensInterdit(couleur); break; case CH...
5