text
stringlengths
14
410k
label
int32
0
9
private void undoHelper(boolean fromNetwork) { //get the top of the action stack, handle it, and push it to the future actions stack for redo if(pastActions.empty()) { System.out.println("no actions to undo!"); return; } if(!fromNetwork) networking.sendAction(new BoardEltExchange(null, BoardActionType...
9
private synchronized void updatePathImage_Old() { if (gPanel.getWidth() == 0 || gPanel.getHeight() == 0) { return; } mPathImage = new BufferedImage(gPanel.getWidth(), gPanel.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = mPathImage.createGraphics(); g2d.setColor(Color.black); g2d.fillR...
7
public void UpdateProbabilities(){ // Compute probabilities of each player being each role. // Do this by calling AllPlayers method from GameState // Compile a tally of each player being each thing against total states int[][] RoleCount = new int[NumPlayers][4 + (2 * NumWolves)]; // First index is the play...
9
public static void main(String args[]) { OggPlayer ogg = new OggPlayer(); try { if (args.length < 1) { args = new String[1]; args[0] = "/audio/Madrugada - Ice.ogg"; } InputStream input = ogg.getClass().getResourceAsStream(args[0]); ogg.open(new OggInputStream(input)); ogg.play(); while (ogg...
3
static final void method2028(int i, ObjectDefinition class51, int i_0_, AbstractToolkit var_ha, int i_1_, int i_2_) { try { anInt3395++; Class218 class218 = Class2.aClass141_117 .method1173((byte) 31, ((ObjectDefinition) class51).anInt875); if ((((Class218) class218).anInt2853 ^ 0xfffffff...
9
@Test public void testEncryptBlock2() { byte[] key = ByteHelper.convertBinaryStringToByteArray("1010011010111000011110011110100111011001100111111001100101110010".replace(" ", "")); byte[][][] subKeys = new byte[][][] { KeyCalculator.generateSubKeys(key) }; byte[] block = ByteHelper.convert...
1
private Command getCommand(String alias) { if(commands.getAllValidAliases().contains(alias)) { return commands.get(alias); } else if(ungroupedCommands.getAllValidAliases().contains(alias)) { return ungroupedCommands.get(alias); } else { return getInheritedCommand(alias); } }
2
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyValue") public JAXBElement<KeyValueType> createKeyValue(KeyValueType value) { return new JAXBElement<KeyValueType>(_KeyValue_QNAME, KeyValueType.class, null, value); }
0
private boolean handleGetMessageBody() { final int expectedBytes; final int bytesRead; try { expectedBytes = buffer.remaining(); bytesRead = channel.read(buffer); if (bytesRead == -1) { // EOF currentState = RxThread...
5
private static boolean isBigger(Context cx, Scriptable scope, Object x, Object y, Object cmp, Object[] cmpBuf) { if (cmp == null) { if (cmpBuf != null) Kit.codeBug(); } else { if (cmpBuf == null || cmpBuf...
9
@Override public Object findById(Integer theId) throws Exception { try { session = HibernateUtil.getSessionFactory().openSession(); //Query q = session.getNamedQuery("id.igual"); Query q = session.getNamedQuery(getNamedQueryToFindById()); q.setString("id", the...
1
public static boolean isConsistent(int[] result, int N) { for (int i=0; i<N; i++) { if(result[N] == result[i]) return false; if(result[N] - result[i] == N - i) return false; if(result[N] - result[i] == i - N) return false; } return true; }
4
public MultiImportDialog(Frame parent, final File file) { super(parent, true); setTitle("导入多张表格"); setBounds(100, 100, 450, 442); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, Borde...
9
Power(String name, int properties, String imgFile, String helpInfo) { this.name = name ; this.helpInfo = helpInfo ; this.buttonTex = Texture.loadTexture(IMG_DIR+imgFile) ; this.properties = properties ; }
4
public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if (action.equals(Constantes.OK)) { ok(); } else if (action.equals(Constantes.CANCEL)) { close(); } }
2
public String getLabel() { if (label == null) label = "switch_" + (serialno++) + "_"; return label; }
1
public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { instructions.add(new FrameNode(type, nLocal, local == null ? null : getLabelNodes(local), nStack, stack == null ? null : getLabelNodes(stack))); }
2
public String crypt(String str) { if (str == null || str.length() == 0) { throw new IllegalArgumentException("Error"); } String stringKey = str + HASHKEY; digester.update(stringKey.getBytes()); byte[] hash = digester.digest(); StringBuffer hexString = new StringBuffer(); for (int i = 0; i < hash.lengt...
4
public Osoba getOsoba() { return new Osoba(nazwiskoTextField.getText(), imieTextField.getText(), kodPocztowyTextField.getText(), miastoTextField.getText(), ulicaTextField.getText(), telefonTextField.getText(), telefonTextField.getText()); }
0
private Integer[] getVersionInts(String versionString) { String bits; if (versionString.split("\\-v").length == 2) { bits = versionString.split("\\-v")[1]; } else if (versionString.split(" v").length == 2) { bits = versionString.split(" v")[1]; } else if (versionS...
5
public static PlayableSound parse(String string) throws IllegalArgumentException, NumberFormatException { Matcher matcher = pattern.matcher(string); if (!matcher.matches()) { return null; } if (matcher.group(3) != null) { return new PlayableSound(Sound...
3
public static void main (String [] args) throws IOException { in = new BufferedReader (new FileReader (new File ("find_the_mintxt.txt"))); out = new PrintWriter (new FileWriter ("findthemin.out")); int T = Integer.parseInt (in.readLine()); int t = 0; StringTokenizer st; w...
9
private JButton createButton(String buttonCaption) { final JButton button = new JButton(buttonCaption); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setSelectedFile(file); int selection; switch ...
3
private Gob gobatpos(Coord c) { for (Sprite.Part d : obscured) { Gob gob = (Gob) d.owner; if (gob == null) continue; if (d.checkhit(c.add(gob.sc.inv()))) return (gob); } for (Sprite.Part d : clickable) { Gob gob = (G...
6
public boolean equivalentWasStartedBys (WasStartedBy description1, WasStartedBy description2) { return bothNull (description1, description2) || (neitherNull (description1, description2) && equivalentIdentifiers (description1, description2) && equivalentAttrib...
7
public void setSelectedFontSize(int size) { String sizeString = String.valueOf(size); for (int i = 0; i < this.fontSizeStrings.length; i++) { if (this.fontSizeStrings[i].equals(sizeString)) { getFontSizeList().setSelectedIndex(i); break...
2
public static void ALS_branch(String num, String filepath, String downloadpath, String []paras, Scanner scanner){ String line="", result = ""; int item=0; System.out.println("Please choose the light status you want to test: 1=dark, 2=bright, 0=return:"); System.out.println("If you choose to test the dark status...
7
private void muoviNera(boolean turn){ // cerca possibili mosse bianche (movimenti e mangiate) // try catch usati per evitare i controlli sulle celle (superamento estremi damiera) boolean occupata = false; // cella vicina è occupata da una pedina try{ if(damiera.getCella...
5
@Test @Ignore public void test_SurveyCompletionGet() { SurveyCompletionList laSurveyCompletions = laClient.getSurveyCompletions("20160226060916990275000000", "00456799"); System.out.println(laSurveyCompletions.getSurveyCompletionList().size()); if (laSurveyCompletions.getSurveyCompletionList().size() > 0) { ...
2
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Node other = (Node) obj; if (fullPath == null) { if (other.fullPath != null) return false; } else if (!fullPath.equals(other.fullPath)) ...
9
public int maximumGap_notMine(int[] num) { // not my solution if (num == null || num.length < 2) return 0; // get the max and min value of the array int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for (int i:num) { min = Math.min(min, i); ...
9
private String guessMimeType(String path) { int lastDot = path.lastIndexOf('.'); if (lastDot == -1) { return null; } String extension = path.substring(lastDot + 1).toLowerCase(); String mimeType = mimeTypes.get(extension); if (mimeT...
4
private String decodeDrink(String command) { StringBuilder b = new StringBuilder(); Pattern p = Pattern.compile("(.*):(.*):(.*)"); Matcher matcher = p.matcher(command); if(!matcher.matches()) throw new IllegalArgumentException("Invalid command"); String drinkType = ...
9
private void redirect(String recordType) throws IOException { if (recordType.equals("user")) { if (request.getParameter("type").equals("doctor")) response.sendRedirect("register_doctor.jsp"); else if (request.getParameter("type").equals("patient")) response.sendRedirect("register_patient...
3
public String toString() { if (nome != null) return nome.toString(); return id + ""; }
1
void runSimulation() { CyclicBarrier cb = new CyclicBarrier(4, new ClientSynchronizer()); ClientThread[] clients = new ClientThread[dimensionRatio]; for (int i=0; i<dimensionRatio; i++) { clients[i] = new ClientThread(i,cb); } for (int i=0; i<dimensionRatio; ...
2
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Attributes)) return false; Attributes that = (Attributes) o; if (attributes != null ? !attributes.equals(that.attributes) : that.attributes != null) return false; ...
4
public static boolean vote(Proposal proposal, int optionId) { Vote vote = new Vote(FOTE.getUser().getId(), optionId, proposal.getId()); VoteModel voteModel = new VoteModel(); // Try to find a vote already made by this user for this proposal Iterable<Entry> voteQuery = voteModel.query("{...
7
private void setImage(ImageIcon image, boolean inputDescription) { annotater.setImage(image); if (!gallery.hasNoProperty()) { Object o = gallery.getProperty("grid:" + image.getDescription()); if (o instanceof GridSetting) { annotater.setShowGrid(true); annotater.setGridCellSize(((GridSetting) o).getCe...
7
@EventHandler public void SilverfishStrength(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.getSilverfishConfig().getDouble("Silve...
6
public int CreationIndex() { for (int i = 0; i < CreateButtonSize; ++i) { if (CreateButtons[i].IsClicked()) return i; } return -1; }
2
public boolean containSameStates(State[] states1, State[] states2) { int len1 = states1.length; int len2 = states2.length; if (len1 != len2) return false; Arrays.sort(states1, new Comparator<State>(){ public int compare(State s, State t){ return s.hashCode() - t.hashCode(); ...
3
public void update(float deltaT) { boolean tempButton = false; boolean tempSelected = true; if (owner instanceof SelectableUnit) { tempSelected = ((SelectableUnit) owner).isSelected(); } if (abilityButton != null) { tempButton = abilityButton.isPressed(); ...
9
private void prepare() { if (executor == null) { executor = new AsyncExecutor(); } }
1
protected File getFile(JPackage pkg, String fileName ) throws IOException { File dir; if(pkg.isUnnamed()) dir = target; else dir = new File(target, toDirName(pkg)); if(!dir.exists()) dir.mkdirs(); File fn = new File(dir,fileName); ...
5
public Set pseudoAlreadyUse(int nbjoueur){ Set<Joueur> hjoueur = new HashSet<Joueur>(); Scanner sc = new Scanner(System.in); boolean isAlreadyUsed = false; String pseudo = new String(); for(int i=1; i<nbjoueur+1; i++){ // On demande le pseudo du joueur i jusq...
4
private static void loadMenus() throws IOException { JsonArray json = (JsonArray) GameFiles.readJson("StructureMenu.json"); for (JsonValue item : json) { JsonObject menu = (JsonObject) item; String title; switch (menu.getString("title", "")) { case "bmCat_houses": title = "Housing"; break; case "bmCa...
8
public void addDestino(String cod, double area) { if (destinos == null) destinos = new HashMap<String, Double>(); if (destinos.get(cod) == null) destinos.put(cod, area); else { double a = destinos.get(cod); a += area; destinos.put(cod, a); } }
2
private static byte[] scanPublicKey(CryptobyConsole console) { byte[] retKey = null; do { scanner = new Scanner(System.in); String keyText = ""; // Input Key for decryption System.out.println("\nEnter the public Key (Type '" + quit + "' to Escape):"); ...
7
public static String getFileNameByUrl(String url) { if (isNull(url)) { return null; } // 移除http:// if (url.startsWith("http://")) { url = url.substring(7); } // 移除https:// else if (url.startsWith("https://")) ...
3
public String extractString() { if (offset_pointer <= 0) throw new NetworkBufferException("Buffer is empty, cannot extract a string."); StringBuilder sb = new StringBuilder(max_capacity); // Just to be safe in case the string is the length of our array Byte b = null; for (int i = 0; i < offset_pointer; i++) ...
6
public static void main(String[] args) { String className = "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"; try { UIManager.setLookAndFeel(className); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } E...
1
public void movePlayerWeapons(){ /* blaster shots */ ArrayList blasterShots = player.getBlasterShots(); /* if the blaster is visible - move */ for (int i = 0; i < blasterShots.size(); ++i){ Blaster temp = (Blaster)blasterShots.get(i); if (temp.isVisible() == true)...
8
public void Solve() { ArrayList<HashMap<String, List<String>>> polygonals = new ArrayList<HashMap<String, List<String>>>(); for (int i = 0; i < 6; i++) { polygonals.add(new HashMap<String, List<String>>()); } int n = 1; int minValue = 0; while (minValue < _ma...
7
public long add(long millis, long value) { int weekyear = get(millis); int newWeekyear = weekyear + FieldUtils.safeToInt(value); if (weekyear < 0) { if (newWeekyear >= 0) { newWeekyear++; } } else { if (newWeekyear <= 0) { ...
3
public static String getAlias(Class<? extends ConfigurationSerializable> clazz) { DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class); if (delegate != null) { if ((delegate.value() == null) || (delegate.value() == clazz)) { delegate = null; ...
7
public synchronized static boolean setInventory(String identifier, int newInventory) { StockStorage store = StockStorage.getInstance(); return store.setInventory(identifier, newInventory); }
0
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.size() < 2) throw new Exception("DESAPILA_IND: faltan operandos"); Valor v = st.pop(); Valor d = st.pop(); if (d instanceof Entero) { if(v==null){ v=new Entero(0); } md.put((int) d.getValo...
3
@Override public GameState use(Game game) { List <Npc> npcs; npcs = game.getCurrentRoom().getNpcs(); Killable killablenpc = null; for(Npc creature : npcs){ if(creature instanceof Killable){ killablenpc = (Killable) creature; ...
9
private int getPixelVal(int x, int y) { int i = x + y * width; int bpp = getBpp(); if (bpp == 8) return data[i]; if (bpp == 16) return data[i * 2] | data[i * 2 + 1] << 8; if (bpp == 4) { int res = data[i / 2]; res = res ...
4
public static int oppgave1() { int antallFeil = 0; Liste<Integer> liste = new DobbeltLenketListe<>(); if (liste.antall() != 0) { antallFeil++; System.out.println("Oppgave 1a: Feil i metoden antall()!"); } if (liste.tom() != true) { antallFeil++; System.out.println...
7
public static void getLLcontactGraphStats(){ int maxNumOutEdges = 0; int maxNumInEdges = 0; try { Connection con = dbConnect(); PreparedStatement getNumOutboundEdges = con.prepareStatement( "SELECT COUNT(*) FROM "+llTbl+" WHERE location1ID = ?"); PreparedStatement getNumInboundEdges = con.prepareSt...
7
public Vector<Account> loadDB() throws SQLException, IOException { Vector<Account> result = new Vector<Account>(); PreparedStatement statement; statement = bd.prepareStatement("SELECT * FROM accounts;"); statement.execute(); rs = statement.getResultSet(); while (rs.next()) { Account curAccount = new A...
7
public String toString(int itemsPerLine) { StringBuilder handString = new StringBuilder(); int itemsPrinted = 1; for (Card c : playerHand) { handString.append(c.toString()); if ((playerHand.indexOf(c) < playerHand.size() - 1)) { handString.append(", "); ...
3
public void remove( int offs, int len ) throws BadLocationException { boolean proceed = true; if ( dontCheck == false ) { try { String tmp = super.getText(0, offs) + (super.getLength()>(offs+len) ? super.getText(offs+len, super.getLength()-(offs+len)) : ""); Matcher m = p.matcher(tmp); proceed = m.m...
4
public String largestNumber(int[] nums) { if (nums == null) { return null; } Comparator<String> comparator = (s1, s2) -> { if (s1.equals(s2)) return 0; String option1 = s1+s2; String option2 = s2+s1; char chars1[] = option1.toCharA...
9
@Override public void mouseClicked(MouseEvent e) { if (!pelota.getMov() && pelota.contiene(e.getX(), e.getY())) { pelota.lanzar(); } }
2
public void undo() { revising = true; if (!TEXT_HISTORY.isEmpty()) { String lastText = TEXT_HISTORY.pop(); TEXT_FUTURE.push(lastText); textLower.setText(lastText); // gui.TEXT_HISTORY.tailMap(fromKey) } }
1
@Override public void serialEvent(SerialPortEvent ev) { if (ev.getEventType() == SerialPortEvent.DATA_AVAILABLE) { try { int available = inputStream.available(); byte[] receiveBuffer = new byte[available]; inputStream.read(r...
5
public static void checkSubstitute(int index) { System.out.println("Substitute detected"); if(Mechanics.hasSubstitute[index]) { if(Mechanics.substituteHealth[index]<=0) { Mechanics.substituteHealth[index]=0; Mechanics.hasSubstitute[index]=false; if(index==0) b1.addText("Your substitute b...
3
@Override public boolean getDados() { preenchido = true; String msg = bundle.getString("Os Campos: "); nome = txtNome.getText(); localizacao = txtLocalizacao.getText(); desc = txtaDesc.getText(); preco = (double) spPreco.getValue(); descIng = txtaDescIng.get...
7
public double laskeRivihinta(Juoma j, String koko, int maara) { double rivihinta = 0; // lasketaan tilausrivin hinta sen perusteella kuinka suuri juoma // ja kuinka monta kappaletta niitä halutaan lisätä ostoskoriin if (koko.equals("pieni")) { rivihinta = j.getPieniHinta() * maara; } else if (koko.e...
3
public Vector<String> getAllAdmin() { Vector<String> ans = new Vector<String>(); String select = "SELECT * FROM ADMIN"; try { ResultSet rs = stat.executeQuery(select); while (rs.next()) ans.add(rs.getString("NAME").trim()); } catch (SQLException e) { e.printStackTrace(); } return ans; }
2
public static boolean containsInstance(Collection<?> collection, Object element) { if (collection != null) { for (Object candidate : collection) { if (candidate == element) { return true; } } } return false; }
4
public static void createBoat(String type){ switch(type){ case RACE_MODE: instance = new RaceBoat(); break; case STATION_KEEPING_MODE: instance = new StationKeepingBoat(); break; default: System.out.println("Cannot set boat mode : unknown mode " + type); if(instance == null){ System.out...
3
public static void asm_decf(Integer akt_Befehl, Prozessor cpu) { Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6); Integer result = cpu.getSpeicherzellenWert(f) - 1; // Speicherort abfragen if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) { // in f Register speichern cpu.setSpeicherzellenWert(f, result, tr...
1
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((collator == null) ? 0 : collator.hashCode()); result = prime * result + ((field == null) ? 0 : field.hashCode()); result = prime * result + (includeLower ? 1231 : 1237); result = ...
6
public synchronized String cds() { if (cds != null) return cds; // Concatenate all exons List<Exon> exons = sortedStrand(); StringBuilder sequence = new StringBuilder(); int utr5len = 0, utr3len = 0; // 5 prime UTR length for (Utr utr : get5primeUtrs()) utr5len += utr.size(); // Append all exon se...
6
public MyTableModel(Collection<SupplierProduct> initialData) { ArrayList<SupplierProduct> sortedData = new ArrayList<SupplierProduct>(initialData); Collections.sort(sortedData, new Comparator<SupplierProduct>() { @Override public int compare(SupplierProduct o1, SupplierProduct o2) { return o1.supplier...
2
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton9ActionPerformed {//GEN-HEADEREND:event_jButton9ActionPerformed if (!gameover) { if (rule.turn()) { if (rule.check(2, 2)) { rule.pressed(2, 2); if ...
5
public boolean establishConnection() { try { client.connectToServer(); } catch (HttpClientException e) { return false; } return true; }
1
public Snowball makeSnowball(Location l, Direction d, SnowballType s) { if (s == SnowballType.SUPER) { return new Snowball(l, d, 50, 2, s); } else if (s == SnowballType.FAST) { return new Snowball(l, d, 35, 1, s); } else if (s == SnowballType.ONE_HIT) { return new Snowball(l, d, 100, 2, s); } else if (...
4
public List<Strategy> getSecondaryStrategies () { List<Strategy> rv = new ArrayList<Strategy>(); Strategy primaryStrategy = getPrimaryStrategy(); for (Strategy s : Strategy.values()) if (s != primaryStrategy && getScoreForStrategy (s) > 5) rv.add (s); return rv; }
3
public void reopenFiles() { ArrayList<File> filesToDisplay = new ArrayList<File>(); for(int i=0; i<50; i++) { String key = "display." + Integer.valueOf(i).toString(); if (props.containsKey(key)) { String filepath = props.getProperty(key); File file = new File(filepath); if (fi...
7
public void setIsInSources(boolean isInSources) { _isInSources = isInSources; }
0
final boolean method3905(int i) { anInt4183++; if (aBoolean4177) { return true; } if (aClass241_4178 == null) { try { int i_1_ = Class240.aClass329_2943 != Node_Sub38_Sub1.aClass329_10086 ? Class320_Sub24.aClass197_8443.id + 7000 : 80; aClass241_4178 = Class240.aSignLink2946.method3642((byte) -80,...
9
@EventHandler public void onNameTag(PlayerReceiveNameTagEvent e) { Player player = e.getNamedPlayer(); if (plugin.onDuty.contains(player.getName())) { if (player.getName().length() <15) { e.setTag(ChatColor.RED + player.getName()); } } }
2
@Override public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } FieldData fieldData = (FieldData) o; if(fieldNumber != fieldData.fieldNumber) { return false; } if(!name.equals(fieldData.name)) { return false; } r...
5
private static ExceptionData findMatchingException(Stacktrace currentStacktrace) { ExceptionData matchedException = null; for (ExceptionData exceptionData : exceptions) { boolean match = false; Stacktrace stacktrace = exceptionData.getStacktrace(); int lineDiff = Math.abs(currentStacktrace.getLines().size...
6
private void editorChangeValue(Font font) { for (int i = 0; i < fonts.length; i++) { if (fonts[i].equals(font.getName())) { familyNameCombo.setSelectedIndex(i); break; } } for (int i = 0; i < pointSizes.length; i++) { if (font.getSize() <= pointSizes[i]...
7
public synchronized String[] validatePlayer(QuizServer quizAccess){ int playerId=0; String playerName=""; String[] playerData={"",""}; List<Player> playerList=null; Iterator<Player> playerIterator=null; List<Integer> playerIdList =null; try{ BufferedReader bufferedReader= new BufferedReader(new Inpu...
5
public void addRows(List<Project> array) { ProjectTableModel tableModel = new ProjectTableModel(array, manager); int row = array.size(); int col = 0; for (Project data : array) { setValueAt(data, row - 1, col++); } }
1
public Tile getTileAt(Position p) { if ( p.getRow() == 0 && p.getColumn() == 0 ) { return new StubTile(GameConstants.FOREST, 0, 0); } if ( p.getRow() == 1 && p.getColumn() == 0 ) { return new StubTile(GameConstants.HILLS, 1, 0); } return new StubTile(GameConstants.PLAINS, 0, 1); }
4
public void layoutContainer(Container parent) { synchronized (parent.getTreeLock()) { Insets insets = parent.getInsets(); int totalWidth = maxWidth - insets.left - insets.right; int height = 0; int width = 0; int maxHeightOfThisLine = 0; int componentCount = parent.getComponentCount(); for(...
4
@Override public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException { List paramList1 = new ArrayList<>(); List paramList2 = new ArrayList<>(); StringBuilder sb = new StringBuilder(UPDATE_QUERY); String ...
1
public void populatePeers(ArrayList<Peer> trackerPeers){ System.out.println("PeerList returned from tracker: (new valid peers accentuated with **)"); //Iterate through the list of peers, and add them to new list if they match the specified requirements. for (int currPeerIndex = 0; currPeerIndex < trackerPeers.siz...
5
public static SortedMap<Double, List<Double>> classify(double[] breakPoints, double[] data) { SortedMap<Double, List<Double>> sortedMap = new TreeMap<Double, List<Double>>(); double nextbreakPoint = Double.MAX_VALUE; DecimalFormat twoDForm = new DecimalFormat("#.##"); //format to two decimal pla...
9
@Override public void writeAll(Collection<Element> elements) throws CacheException { // TODO Auto-generated method stub for (Element e : elements) { write(e); } }
1
public State path(Node f, Node t, Queue<State> q, int len) { HashSet<Node> v = new HashSet<Node>(); q.offer(new State(f)); while (!q.isEmpty()) { State cur = q.poll(); if (!v.contains(cur.node)) { v.add(cur.node); if (cur.node.compareTo(t) == 0) return cur; for (Node n: edges.get(cur.node).keySe...
7