text
stringlengths
14
410k
label
int32
0
9
private List<T> calcPath(T start, T goal) { // TODO if invalid nodes are given (eg cannot find from // goal to start, this method will result in an infinite loop!) LinkedList<T> path = new LinkedList<T>(); T curr = goal; boolean done = false; while (!done) { path.a...
2
public void addWorldModelListener(final WorldModelListener listener) { if (listener != null && !listenersWorld.contains(listener)) { this.listenersWorld.add(listener); } }
2
public int evalRPN(String[] tokens) { Stack<Integer> stack = new Stack<Integer>(); for (String str : tokens) { if (str.length() == 1) { switch (str.charAt(0)) { case '+': stack.push(stack.pop() + stack.pop()); break; case '-': { int first = stack.pop(); stack.push(stack.pop() - fi...
6
private Sentence parseSentence(String itemSource) { Sentence sentence = new Sentence(); String[] split = itemSource.split(SENTENCE_PART_MARGIN); for (String itemSource1 : split) { if (itemSource1.equals(String.valueOf(' '))) { Whitespace whitespace = new Whitespace('...
8
private void modifyPanelInit(){ modifyPanel = new JPanel(); generator.createRigidSpace(modifyPanel, 15); //Add a table of all the equipment to the panel final JTable allEquipment = new JTable(allEquipmentModel.getTableModel(5)); allEquipment.removeColumn(allEquipment.getColumn("ID Number")); allEquipm...
7
private static ArrayList<ResidualEdge> minCostFlowWithBellmanFordSub( ArrayList<ResidualEdge>[] edges, int s, int t) { int n = edges.length; ResidualEdge[] prevE = new ResidualEdge[n]; int[] prevV = new int[n]; int[] dist = new int[n]; Arrays.fill(prevV, -1); ...
8
void run() { long countUnknown = 0; long lineNum = 1; Timer.showStdErr("Converting lines from QSEQ to FASTQ (Sanger)"); // Process file try { String linePe1, linePe2, lineIdx; // Open inputs BufferedReader inPe1Buff = new BufferedReader(new InputStreamReader(new FileInputStream(inPe1))); Buffer...
6
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. * F...
6
private void registerCommands() { getCommand("chteam").setExecutor(new CommandExecutor() { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { return getGame(sender).cmdChangeTeam(sender, args); } }); getCommand("teamhome").setExecutor(new Command...
7
private static List<Part> layout(Part fp, int w) { List<Part> ret = new LinkedList<Part>(); List<Part> line = new LinkedList<Part>(); int x = 0, y = 0; int mw = 0, lh = 0; for(Part p = fp; p != null; p = p.next) { boolean lb = p instanceof Newline; int pw, ph; while(true) { p.x = x;...
8
public GenesSearchResult getGenes(List<String> geneNames) { List<GeneInput> loadedGenes = new LinkedList<GeneInput>(); List<String> notFoundGeneNames = new LinkedList<String>(); for (String geneName : geneNames) { GeneInput gene = new GeneInput(geneName); GeneInput select...
9
public void accapt(Visitor visitor) { for (Element element : elements) element.accapt(visitor); }
1
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); f...
3
public static void loadAllXML() { if (isLoaded) { System.out.println("XML already loaded"); return; } isLoaded = true; DBConnection.resetDatabase(); // Load users new XMLReader("./xml/users.xml"); // Load quizzes new XMLReader("./xml/bunny.xml"); new XMLReader("./xml/cities.xml"); new XMLRe...
1
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (this.opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } this.put(key, value); } return this; }
3
public boolean IsAlive(int playerID) { for (Planet p : planets) { if (p.Owner() == playerID) { return true; } } for (Fleet f : fleets) { if (f.Owner() == playerID) { return true; } } return false; }
4
public void pathRecurse(String folderPath, List<String> targetList) { File musicFolder = new File(folderPath); if(!musicFolder.exists()) { musicFolder.mkdirs(); } File[] abstractPaths = musicFolder.listFiles(); for(File path: abstractPaths) { //only add ...
5
public ByteVector putInt(final int i) { int length = this.length; if (length + 4 > data.length) { enlarge(4); } byte[] data = this.data; data[length++] = (byte) (i >>> 24); data[length++] = (byte) (i >>> 16); data[length++] = (byte) (i >>> 8); data[length++] = (byte) i; this.length = length; retu...
1
private static void createGUI() throws MidiUnavailableException, InvalidMidiDataException, IOException { //Set up the GUI. dropdownFont = new Font("Dialog", Font.PLAIN, 12); // the main frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // add icon for OS tray // This icon is also used in var...
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Playlist that = (Playlist) o; if (idPlaylist != that.idPlaylist) return false; if (description != null ? !description.equals(that.description) ...
8
public int[] searchForRange(int[] num, int target){ int[] res = new int[2]; if (num.length == 0){ res[0] = -1; res[1] = -1; return res; } /* search for the start index. */ int start = -1; if (num[0] == target){ start = 0; } else { for (int i = 1; i < num.le...
9
public void suspend() { suspending = true; //prepare the file transferring inFile.setMigrateState(true); outFile.setMigrateState(true); //close the transactional IO try { inFile.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { outFi...
3
public void generate(Entity entity, UUID uuid) { if(PluginVars.hasDeck(uuid)) { return; } else { List<Card> newdeck = new ArrayList<Card>(); List<Integer> newint = new ArrayList<Integer>(); if(entity.getType() == EntityType.ENDERMAN) { if(PluginVars.random.nextBoolean()) { newdeck = new DeckGen...
9
public void SetAPIKey(String apiKey) { _apiKey = apiKey; if (null == _apiKey || _apiKey.length() < 5) throw new IllegalArgumentException("Too short API key."); }
2
public String getNumber() { StringBuilder contactNumber = new StringBuilder(); contactNumber.append(getCountryCode() + " (" + getCityCode() + ") " + getLocalNumber() + " - " + getExtension()); return contactNumber.toString(); }
0
public void exit() { try { UnicastRemoteObject.unexportObject(mInstance, true); logout(); } catch(Exception ex) { if(connect()) { exit(); return; } System.out.println("Error on exit"); System.out.println(ex.getMessage()); } }
2
private void addFire() { squareSelector.reset(); squareSelector.setCriteria(new SquareCriteria() { private final String desc = "Add: Fire"; public String getDescription() { return desc; } public boolean isSquareValid( SquareSelector squareSelector, int roomId, int squareId ) { if ( roomId < 0 || squa...
6
public void move() { if (y + ya > 0 && y + ya < game.getHeight() - HEIGHT) y += ya; if (x+xa > (game.getWidth()/2) && x + xa < game.getWidth() -WIDTH) x -= xa; }
4
public Ability getCombatSpell(boolean malicious) { final List<Ability> spellSet=getCombatSpellSet(); int tries=0; while(((++tries)<1000)) { final Ability A=spellSet.get(CMLib.dice().roll(1,spellSet.size(),-1)); if(((malicious)&&(A.canTarget(Ability.CAN_MOBS))&&(A.enchantQuality()==Ability.QUALITY_MALICIO...
8
public static byte[] encodePapPassword( final MessageDigest md5, final byte[] userPass, final byte[] requestAuthenticator, final String sharedSecret) { // encrypt the password. byte[] userPassBytes = null; //the password must be a multiple of...
8
public Message fetchMessage(int id) { initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; Message message = new Message(); try { //Prepare Statement preparedString = "SELECT * FROM messages " + "INNER JOIN users ON users.email = messages.user " + ...
3
public static void write(String record, BufferedWriter out) { try { out.write("db." + COLLECTION_NAME + ".insert(" + record + ");\n"); } catch (IOException e) { e.printStackTrace(); } }
1
public static void setupres() { if (ResCache.global != null) Resource.addcache(ResCache.global); if (Config.resurl != null) Resource.addurl(Config.resurl); if (ResCache.global != null) { try { Resource.loadlist(ResCache.global.fetch("tmp/alluse...
8
private Stock(){}
0
@Override public boolean shutdown() { //int numTicks=tickGroup.size(); while(allTicks.size()>0) { //Log.sysOut("ServiceEngine","Shutting down all tick "+which+"/"+numTicks+"..."); final TickableGroup tock=allTicks.iterator().next(); if(tock!=null) { CMProps.setUpAllLowVar(CMProps.Str.MUDSTATUS,"...
9
private void processEvent(Event event) { switch (event.getType()) { case NEW_PROCESS: newProcess(); break; case SWITCH_PROCESS: switchProcess(); break; case END_PROCESS: endProcess(); break; case IO_REQUEST: processIoRequest(); break; case END_IO: endIoOperation(); break; } ...
5
public long getLong(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number)object).longValue() : Long.parseLong((String)object); } catch (Exception e) { throw new JSONException("JS...
2
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length==1){ BansManager.unipBanPlayer(sender.getName(),args[0], ""); return true; } if(args.length>1){ String msg = ""; for(String data: args){ if(!data.equals(args[0])){ msg+...
4
public static void main(String[] args) { try { File dirname = new File(args[0]); File writename = new File(args[1]); String reportdate = args[2]; writename.createNewFile(); BufferedWriter out = new BufferedWriter(new FileWriter(writename)); for (File filename : dirname.listFiles()) { if (...
9
public Writer write(Writer writer) throws JSONException { try { boolean b = false; int len = length(); writer.write('['); for (int i = 0; i < len; i += 1) { if (b) { writer.write(','); } Object ...
5
@Override public void processingInstruction(String target, String data) { if (PI_VERBOSE.equalsIgnoreCase(target)) { HashMap map = parseAttributes(data); String enabled = (String) map.get(PI_NAME_ENABLED); setVerbose(TruthTest.getBooleanTruthValue(enabled)); try { String level = (String) map....
2
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
7
public void tick() { for (int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); if (!e.removed) e.tick(); if (e.removed) { blockmap.remove(e); e.onRemoved(); entities.remove(i--); } else { blockmap.update(e); } } for (int i = 0; i < particles.size(); i++) { Particl...
6
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); HashSet<String> dictionary = new HashSet<String>(); ArrayList<String> list = new ArrayList<String>(120000); d: do {...
8
@Basic @Column(name = "FUN_APORTA_FONDO") public String getFunAportaFondo() { return funAportaFondo; }
0
public static String ragoz(Szo szo, FonevRag... ragok) { List<FonevRag> ragokLista = new ArrayList<>(); Collections.addAll(ragokLista, ragok); String ret = szo.getSzo(); if (ragokLista.contains(FonevRag.TOBBES_SZAM)) { ret = addTobbesSzamRag(szo); } else if ( ...
8
int getNorthTweak(int cellId) { int row = getRow(cellId); int positionInRow = getPositionInRow(cellId); if ((row <= 0) || (row >= 5*n)) { return 0; } else if (row == n - 1) { return getSegmentNumber(cellId) / 2; } else if ((row == 2*n - 1) && (n != 1)) { ...
7
@Override public void actionPerformed(ActionEvent ae) { if(this.on==1){ int deltaX = 258-x2; int deltaY = 352-y2; //System.out.println("DeltaX: "+deltaX); //System.out.println("DeltaY: "+deltaY); int originX = x2+deltaX; int originY = y...
7
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
public void useActiveTool(int x, int y, int prevX, int prevY) { imageGfx = image.getGraphics(); if (!isMarking) { return; } if (activeTool == Tool.PENCIL || activeTool == Tool.ERASER) { drawLine(x, y, prevX, prevY); } if (activeTool == Tool.PAINTBUCKET) { fillArea(x, y, color.getRGB()); } ...
4
protected void closeImpl() { if (source != null) { source.close(); } }
1
public static void main(String[] args) { final SieveOfAtkin sieve = new SieveOfAtkin(10000); final int max = 10000; final ArrayList<Integer> list = sieve.run(); final HashMap<Integer, Integer> primes = new HashMap<Integer, Integer>(); for (int prime : list) { primes.p...
7
public static void removeRentTransaction(int rentTransactionId){// deze functie zou ik niet gebruiken try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }...
4
public static double binomialCoefficientLog(final int n, final int k) { ArithmeticUtils.checkBinomial(n, k); if ((n == k) || (k == 0)) { return 0; } if ((k == 1) || (k == n - 1)) { return FastMath.log(n); } /* * For values small enough to do exact integer computation, return the * log of the ex...
9
@Override public boolean showMenu() { // TODO Auto-generated method stub if(rb.getString("validate").equals("1")) return true; else return false; }
1
public void cargarTabla(){ try{ if(jComboBoxTipoCuenta.getSelectedIndex()==0 && jComboBoxTipoCliente.getSelectedIndex()==0){ tipoCuenta=1; tipoCliente=1; tablaCuentaAhorroClienteFisico(); }else{ if(jComboBoxTipoCuenta.getSel...
7
public int compare(bean1 o1, bean1 o2) { if(o1.sal > o2.sal) return -1; else if (o1.sal < o2.sal) return 1; else return 0; }
2
private void listarEmpleados() { ControladorEmpleado unControlador = new ControladorEmpleado(); try { LinkedList listaDeEmpleados = unControlador.buscarTodosLosEmpleadosConVentas(); Object columnasDeDatos[] = new Object[4]; //obtenemos el modelo def...
3
public static boolean testEmptyString(String s) { return s == null || s.equals(""); }
1
private void init(){ allDes = new LinkedList<>(); allDeplacements = new LinkedList<>(); if(tours != null){ for (Tour tour : tours) { int length = tour.getDeSixFaces().size(); List<DeSixFaces> des = tour.getDeSixFaces(); List<Deplacement> deplacements = tour.getListDeplacement(); for( in...
5
public void testPropertyCompareToMinute() { LocalDateTime test1 = new LocalDateTime(TEST_TIME1); LocalDateTime test2 = new LocalDateTime(TEST_TIME2); assertEquals(true, test1.minuteOfHour().compareTo(test2) < 0); assertEquals(true, test2.minuteOfHour().compareTo(test1) > 0); asse...
2
public void setDefaultTime(Date defaultTime) { this.defaultTime = defaultTime; }
0
public static void clear() { Keyboard.destroy(); try { Keyboard.create(); } catch (LWJGLException e1) { e1.printStackTrace(); } for(Keybinds e : Keybinds.values()) { e.key.setPressed(false); } }
2
@Override public void mouseDragged(MouseEvent e) { if (inside) if (draggedComponente != null) { draggedComponente.move(lastPoint, e.getPoint()); lastPoint = e.getPoint(); } else if (draggedNodo != null) { if (startPoint == null) { ...
4
protected final void setName(String name) { _name = name; }
0
@Override public void run() { //try { if(!messages.isEmpty() && connection != null) { try { PreparedStatement messageInsertStatement = connection.prepareStatement( "INSERT INTO BlackBoxMessages(timestamp, mes...
3
@Override public void mouseEntered(MouseEvent e) { if(!czyRozmieszczonoLosowo) { if(widokRozmiesc.cb_RodzajStatku.getItemCount() > 0) for(int i = 0;i < 10; i++) for(int j = 0;j < 10; j++) if(e.getSource() == lb_polaGry[j][i]) { if(widokRozmiesc.uzytkownik.plansza.sprawdzWspolrzedneUs...
6
public static int getYerX(int lvl){ if(lvl == 1) return 210; if(lvl == 2) return 200; if(lvl == 3) return 310; if(lvl == 4) return 290; if(lvl == 5) return 120; if(lvl == 6) return 200; ...
9
private void initSecOptMenu(Color bg) { this.secOptMenu = new JPanel(); this.secOptMenu.setBackground(bg); this.secOptMenu.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); // position Position pos = this.skin.getSecurityMenu_Position(); boolean[] active = { true, t...
4
public void draw(Graphics g, int width, int height) { //TODO optimize - build vector of objs in FOV, need only draw these cameraMan.setMatrix(); obj3dManager.sortObjects(); for (ObjectLayer layer : obj3dManager.layers) { for (Object3d object : layer) { object...
6
private static double getBlackPercent(BufferedImage capture) { int blackcount = 0; for(int i = 0; i < capture.getWidth(); i++){ for(int j = 0; j < capture.getHeight(); j++){ int rgb = capture.getRGB(i, j); float[] hsb = Color.RGBtoHSB((rgb >> 16 & 0xFF), (rgb >> 8 & 0xFF), (rgb & 0xFF), null); if(hs...
3
public final void startIdentServer() { new IdentServer(this, getLogin()); }
0
public static String getSearchRecordsString(String searchKey, Storage storage) { String result = "Name" + "\t" + "PhoneNumber" + "\t" + "Address" + "\n"; List<Contact> searchedContacts = new ArrayList<Contact>(); int recordCount = 0; searchedContacts = getSearchObject(searchKey, storage...
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final AuthenticationInfo other = (AuthenticationInfo) obj; if ((this.login == null) ? (other.login != null) : !this.login.equals(other.login)) { ...
5
public int getKillstreak() { return killstreak; }
0
public static void main(String[] args) { serviceConsumer(new Implementation1Factory()); // Implementations are completely interchangeable: serviceConsumer(new Implementation2Factory()); }
0
public int execute() { // The UNLISTEN listen command is described as follows: // UNLISTEN <socketID> if( this.getParamCount() != 1 ) { this.getFactory().getServer().getLogger().log( Level.SEVERE, "Illegal argument count." ); return 1; // implies error } // OK. Take the last argumen...
3
@Override public void run() { while (running) { for (WorkerThread w : this.getWorker()) { Socket s = w.getSocket(); if (!s.isConnected()) { try { System.out.println("ConnectionInsepctor: " + s.getInetAddress() + " keine ...
4
public Card getCard(String name, String desc, int power, int ActionID){ switch(ActionID){ case 1 : { return new BoostCard(name, desc, power);} case 2 : { return new AttackCard(name, desc, power);} case 3 : { return new StopCard(name, desc, power);} case 4 : { return new TrapSetCard(name, desc);} c...
8
private int insert(Funcionario f) { Connection con = null; PreparedStatement pstm = null; int retorno = -1; try { //con = guarda a conexão aberta no connectionFactory con = ConnectionFactory.getConnection(); //pstm = manda um sql para o banco ...
3
public BufferedImage getSprite(String key) throws NullPointerException { if (VectorWorld.DEBUG_GFX) { System.out.println("Trying to get the sprite with key " + key + "..."); } BufferedImage bi = (BufferedImage) imagesMap.get(key); if (bi == null) { ...
4
public boolean subs(String user, String tag, boolean unsubscribe) { clearResultMetaInformation(); boolean subscribeResult = false; StringBuffer result = new StringBuffer(); GetMethod get; if (!unsubscribe) { get = new GetMethod(apiEndpoint + DeliciousConstants.INBOX_...
7
public static int computerChoice() { int emptyrow= 0; // first check if a move can win for (int i=0; i<COLUMNS; i++) { if (!isColumnFull(board,i)) { emptyrow = firstEmptyRow(board,i); board[emptyrow][i] = XPLAYER; if (winningDisk(board, emptyrow, i)) { board[emptyrow][i] = EMPTY; // reset ...
9
public SubjectID getSubjectID() { SubjectID result = null; try { Node elem = Utilities.selectSingleNode(this.node, "./dc:SubjectID", XMLLabels.STANDARD_NAMESPACES); if(elem != null && elem.getNodeType() == Node.ELEMENT_NODE) { String type = Utilities.getAttributeValue(elem, "type"); result = new Su...
3
@Override public String toJson(int tabs) { StringBuilder b = new StringBuilder(); b.append("["); for (int c = 0; c < this.array.size(); c++) { if (c > 0) { b.append(", "); } Object obj = this.array.get(c); if (obj instanceof IJsonSerializer) { b.append(((IJsonSeria...
3
public String lire(String path) { BufferedReader lect; String tmp = ""; try { lect = new BufferedReader(new FileReader(path)); while (lect.ready() == true) { tmp += lect.readLine() + "\n"; } lect.close(); }//try catch (NullPointerException a) { System.out.println("Erreur : pointeur null"...
3
public static String getRichtung(List<Raum> raums) { if(raums == null || raums.size() < 2) return null; Raum raum1 = raums.get(0); Raum raum2 = raums.get(1); for(String richtung : raum1.getMoeglicheAusgaenge()) { if(raum1.getAusgang(richtung) == raum2) return richtung; } return null; }
4
public synchronized void clearBoard(boolean clearBackup) { if (clearBackup) { backup.clear(); try { // remove unused images Iterator<Integer> i = ImageTable.getInstance().keySet().iterator(); while(i.hasNext()) { Integer id = i.next(); if (backgroundImgID == null || !backgroundImgID.equals...
8
public static void prepareExtensionElement(Document doc, Element command, epp_Extension[] extensions) throws epp_XMLException { if (extensions != null) { Element extension_element = doc.createElement("extension"); for (int count = 0; count < extensions.length; count++) { epp_Extension extension = extensi...
7
public synchronized static String leaveGame(String ip) { String msg = "LEAVE_GAME FAILURE"; boolean flag = false; NodeList nList = doc.getElementsByTagName("player"); for (int i = 0; i < nList.getLength(); i++) { Element myEl = (Element) nList.item(i); if (nList.item(i).getParentNode().getParentNode().to...
6
public HashMap<Integer, ArrayList<Integer>> zigzagLevelHelper(TreeNode root){ HashMap<Integer, ArrayList<Integer>> res = new HashMap<Integer, ArrayList<Integer>>(); if(root == null){ return res; } Queue<TreeNode> q = new LinkedList<TreeNode>(); Queue<Integer>...
6
public final JPoclASTParser.parameters_return parameters() throws RecognitionException { JPoclASTParser.parameters_return retval = new JPoclASTParser.parameters_return(); retval.start = input.LT(1); TypeTree root_0 = null; Token char_literal113=null; JPoclASTParser.bexpr0_retu...
7
public void updateImagePath() { if (team.num == 1) { if (theta == 0) { this.imagePath = IMAGE_TANK_UP_BLUE; } else if (theta == 90) { this.imagePath = IMAGE_TANK_RIGHT_BLUE; } else if (theta == 180) { this.imagePath = IMAGE_TANK_DOWN_BLUE; } else if (theta == 270) { this.imagePath = IMAGE...
9
public boolean Connect() { /* Get all available ports */ Enumeration<?> portIdentifiers = CommPortIdentifier.getPortIdentifiers(); /* Find requested port */ CommPortIdentifier portId = null; while (portIdentifiers.hasMoreElements()) { CommPortIdentifier p = (CommPortIdentifier)portIdentifiers.nextElement(...
8
static void generate_hypotheses(final int order, final Hypothesis h, // final multimap<String, String> tag_dictionary, final ArrayList<ME_Model> vme, List<Hypothesis> vh) { int n = h.sentence.size(); int pred_position = -1; double min_ent = 999999; // String pred = ""; //jenia //...
9
public static void saveProducts() { if (!productsModified) return; SerialFileHandler.writeObject(products, supplier.getName() + ".dat"); productsModified = false; }
1
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
5
private boolean isValidName(String s) { if (!isValidNMTOKEN(s)) return false; int c = s.charAt(0); return ! ((c>=0x30 && c<=0x39) || c=='.' || c=='-' ); }
4
public Object load(String path, Class c) throws SlickException { if(c.equals(Image.class)) { return new Image(path); } else if (c.equals(Sound.class)) { return new Sound(path); } else if (c.equals(Music.class)) { return new Music(path); } else { throw new UnsupportedOperationException("Object to loa...
3
private void writeInstance(Instance inst) throws Exception{ StringBuffer insert = new StringBuffer(); insert.append("INSERT INTO "); insert.append(m_tableName); insert.append(" VALUES ( "); if(m_id){ insert.append(m_count); insert.append(", "); m_count++; }...
8