text
stringlengths
14
410k
label
int32
0
9
public static void main(String[] args) { PriorityQueue<GregorianCalendar> pq = new PriorityQueue<GregorianCalendar>(); pq.add(new GregorianCalendar(1906, Calendar.DECEMBER, 9)); // G. Hopper pq.add(new GregorianCalendar(1815, Calendar.DECEMBER, 10)); // A. Lovelace pq.add(new GregorianCalenda...
2
public boolean initialize(){ if( is_init ) return true; if( !dao_state.initialize() ){ System.out.println( "LocationHandler : failed to initialize PersonStateDao!" ); return false; } if( !dao_area.initialize() ){ System.out.println( "LocationHandler : failed to initialize LocationAreaDao!" ); dao...
4
protected void prepareAttributes(GrowableConstantPool gcp) { if (unknownAttributes == null) return; Iterator i = unknownAttributes.keySet().iterator(); while (i.hasNext()) gcp.putUTF8((String) i.next()); }
2
private static boolean isIntegral(JsonPrimitive primitive) { if (primitive.value instanceof Number) { Number number = (Number) primitive.value; return number instanceof BigInteger || number instanceof Long || number instanceof Integer || number instanceof Short || number instanceof Byte; }...
5
public void setNewMainObject(Serializable obj){ theMainObject = obj; }
0
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Equipe)) { return false; } Equipe other = (Equipe) object; if ((this.getId() == null && other.getId() != null) ...
5
@EventHandler public void onPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) { String playerName = event.getName(); // check if there is a ban... Ban ban = plugin.getController().getBan(playerName); // player is still banned, but he should already be unbanned if (ban != ...
4
public static JSONObject toJSONObject(java.util.Properties properties) throws JSONException { JSONObject jo = new JSONObject(); if (properties != null && !properties.isEmpty()) { Enumeration enumProperties = properties.propertyNames(); while (enumProperties.hasMoreElements()) { ...
3
@Override public void openSettingsView() { settingsGui.setVisible(true); settingsGui.setLocationRelativeTo(chatGui); }
0
public static void Gauss(double[][] a, double[] b) { for (int i = 0; i < a.length; i++) { int rowMaxElem = rowMaxElem(a, i); if (rowMaxElem == -1) { System.out.println("Error!"); System.exit(1); } if (rowMaxElem != i) ...
6
@Test public void testGetPwEntriesString() throws Exception { if (!isUnix()) return; List<UnixPasswdEntry> pwEntries = UnixPasswdEntry.getPwEntries(); assertNotNull(pwEntries); assertTrue("at least root & current user", pwEntries.size() > 2); String loggedInAs = System.getProperty("user.name"); for (Uni...
3
@Override public Class<?> getColumnClass( int columna ) { switch ( columna ) { case 0: // Nom de l'usuari return String.class; case 1: // Número de partides jugades return Integer.class; case 2: // Percentatge de victóries return String.class; case 3: // Puntuació global return Integer...
5
public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n,k; while ((n=scanner.nextInt())>0){ k=scanner.nextInt(); List<Point> list=new ArrayList<>(n*n); for(int i=0;i<n;++i){ for(int j=0;j<n;++j){ ...
3
@Override public MovingDirection getDirection(AbstractMovingObject movingObject, AbstractGameObject targetObject, GameCollection gameCollection) { MovingDirection direction = null; int characterX = targetObject.getCoordinate().getX(); int characterY = targetObject.getCoordinate().getY(); ...
9
public void extract(File zippedFile, File unzipDirectory) throws IOException { zipLogger.info("Unzipping file " + zippedFile + " to directory " + unzipDirectory); if(unzipDirectory.exists() && !unzipDirectory.isDirectory()) { zipLogger.severe("Unable to unzip! " + unzipDirectory + " exists, and it is not a...
5
@Override public int available() throws IOException { return data.length - ptr; }
0
public void update(GameState pauseState, GameContainer gc, Map m){ Input input = gc.getInput(); int x = input.getMouseX(); int y = input.getMouseY(); Rectangle r = new Rectangle(x,y,2,2); if(r.intersects(resume)){ if(gc.getInput().isMousePressed(Input.MOUSE_LEFT_BUTTON)){ visible = false; } inne...
8
public boolean initDecrypt(String password) { if (password == null || password.length() < 1) { Application.getController().displayError(Application.getResourceBundle().getString("password_not_null_title"), Application.getResourceBundle().getString("password_not_null...
7
public int getPuntos() { if (null != valor) switch (valor) { case "J": case "Q": case "K": return 10; case "A": return 11; default: return Integer.parseInt(valor); } return -100; }
5
public static void main(String args[]) { Die _die1 = new Die(); Die _die2 = new Die(1); Die _die3 = new Die(2); System.out.println(_die1); System.out.println(_die2); System.out.println(_die3); _die1.roll(); _die2.roll(); _die3.roll(); Sy...
5
public Object open() { createContents(); UI.centerShell(getParent(), shell); shell.open(); shell.layout(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return result; }
2
private Point mousePosition() { try { Point mp = this.getMousePosition(); if (mp != null) { return this.getMousePosition(); } else { return new Point(0, 0); } } catch (Exception e) { return new Point(0, 0); ...
2
private void insertEllipse(boolean[][] map, int row, int col, int width, int height) { for (int r = Math.max(0, row - height / 2); r < Math.min(row + height / 2, map.length); r++) { for (int c = Math.max(0, col - width / 2); c < Math.min(col + width / 2, map[r].length); c++) ...
3
public static int getHeight(AbstractInsnNode insn, MethodNode method) { Stack<AbstractInsnNode> branches = new Stack<AbstractInsnNode>(); int height = 0; branches.push(method.instructions.get(0)); outie: while (branches.size() > 0) { AbstractInsnNode current = branches.pop();...
5
@Override public void updateKillStreak(String player_name, int curKillStreak) { PreparedStatement pst = null; int player_id = getPlayerId(player_name); int killstreak = getKillStreak(player_id); if (curKillStreak > killstreak) { try { pst = conn.prepareStatement("UPDATE ffa_leaderboards SET killstreak=?...
4
@Override public String toString() { switch (this) { case LEFT: return "R"; case RIGHT: return "L"; case UP: return "D"; case DOWN: return "U"; default: return ...
4
@Basic @Column(name = "sale_time") public Timestamp getSaleTime() { return saleTime; }
0
private static <V> V findAbbreviatedValue(Map<? extends IKey, V> map, IKey name, boolean caseSensitive) { String string = name.getName(); Map<String, V> results = Maps.newHashMap(); for (IKey c : map.keySet()) { String n = c.getName(); boolean match = (caseSensitive && n.startsWith(string)...
8
public Object parseClass() throws ParseException, IOException { int linenr = scanner.getLineNr(); int token = scanner.getToken(); if (token != IDENTIFIER_TOKEN) throw new ParseException(linenr, "Class name expected"); Object instance; try { Class clazz = Class.forName("jode.obfuscator.modules." + s...
6
public static VulnLocation searchParam(String nameInclude, String s, String method, int sizePath){ BufferedReader buff; String line; int lineNumber; String include = ""; String nameInclude2=""; VulnLocation includeVuln; try{ lineNumber = 0; int index1 = -1, index2 = -1; buff = new BufferedRead...
7
public static String getTipoFunc() { return tipoFunc; }
0
private void cargarSetPrueba(){ DefaultTableModel temp = (DefaultTableModel) this.tablaSetPruebas.getModel(); String csvFile = "dataset/diabetes_prueba.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; try { double maximo0 = normalizacion.obtenerMaximo(0, csvFile); doubl...
9
private Set<Card> twoEightsPlusQueenTenSevenKicker() { return convertToCardSet("2S,7S,TD,8S,QD,8C,5H"); }
0
private long powerOfTen (int power) { if ( power < 1 ) { return 0; } if ( power < powTen.length && powTen[power] != 0 ) { return powTen [power]; } long result = 1; long currentPow = 10; for ( int i = 1; i < power; i++ ) { result = 9 * result + currentPow; currentPow = currentPow * 10; } if ( power...
5
public crearCocheWnd(java.awt.Frame parent, boolean modal, Coche mod) { super(parent, modal); initComponents(); taller = ctrlTaller.getInstance(); modCoche = mod; clientsModel = new DefaultListModel(); if(modCoche != null){ matText.setText(modCoche.ge...
2
private void showHistogram(){ int[] histogram; CreateHistogram.availableChannel histogramColor; switch(this.jComboBoxHistogram.getSelectedItem().toString()){ case "RED": histogram=ObjHistogram.histogramRed(ObjTransformFormats.iconToBufferedImage(this.jLabelImage.g...
5
public void update() { int y = getLoc().getY(); int x = getLoc().getX(); if (upPressed && y > 3) getLoc().setY(y - 5); if (downPressed && y < StartUp.height - 26 - size) getLoc().setY(y + 5); if (leftPressed && x > 3) getLoc().setX(x - 5); if (rightPressed && x < StartUp.width - 7 - size) getLoc...
8
public Double getComision() { if (comision==null) { return 0.00; } return comision; }
1
public Battleground(BattlegroundHandler handler, String name) { this.handler = handler; this.name = name; this.state = BattlegroundState.MAINTENANCE; try { if (getConfigurationSection().contains("spawns")) { for (String key : getConfigurationSection().getConfigur...
7
@Override public ArrayList<BoardPosition> getPossibleDestinations(Board board) { ArrayList<BoardPosition> possibleDestinations = new ArrayList<BoardPosition>(); //is it a valid L move ? int xDiff = Math.abs(startingPosition.getColumn() - targetPosition.getColumn()); int yDiff = Math...
6
private boolean hitAll(String S, int index, HashMap<String, Integer> allWords, int step) { HashMap<String, Integer> left = new HashMap<String, Integer>(allWords); while (left.size() > 0) { if (hitOne(S, index, left, step)) { index += step; } else { ...
2
public int get(Object k){ int hash = hash(k); int mask = cap - 1; int bkt = (hash & mask); int bhash = hopidx[bkt<<2]; if(bhash != 0) { Object bkey = keys[hopidx[(bkt<<2) + 1]]; if(hash == bhash && k.equals(bkey)) return hopidx[(bkt<<2) + 1]; for(;(bhash = hopidx[(bkt<<2) + 2]) != 0; bkt = (bkt + 1) &...
6
@Override public byte unmute(int soundID) { if(this.soundMap.containsKey(soundID)) { if(this.isPlaying(soundID) && this.isMuted(soundID)) { float previousVolume = this.mutedMap.get(soundID); this.setVolumeChecked(soundID, previousVolume); this.mutedMap.remove(soundID); return 1; } else { ...
3
public static Set<Service> getMostUselessServicesMutated(Server server, Map<Server, Set<Application>> connections) { Set<Service> mutatedServices = new LinkedHashSet<>(); List<Service> sortedServices = getServicesOrderedByUsage(server, connections); if (server.getServices() != null) { ...
6
public boolean addUser(ClientDB client) { // TODO Auto-generated method stub if (checkSpace()) { if (checkDuplicate(client.getUserID())) { for (int i = 0; i < clientObj.length; i++) { if(clientObj[i]==null){ clientObj[i]=client; return true; } } } else{ return false; } ...
4
public void writeClassAndObject (Output output, Object object) { if (output == null) throw new IllegalArgumentException("output cannot be null."); beginObject(); try { if (object == null) { writeClass(output, null); return; } Registration registration = writeClass(output, object.getClass()); i...
9
public void setAsignaNumeroDientesPlato(int numerodientes[]) { int i = 0; boolean compruebadientes = true; if (dientesplato.length == numerodientes.length) { i = 1; while (i < dientesplato.length && compruebadientes) { if (numerodientes[i - 1] >= numerodientes[i]) { compruebadientes = false; }...
7
private List<Reducer> estimateReducers(List<Mapper> newMapperList, boolean useRuntimeMaxJvmHeap) { int fReducerNum = finishedConf.getMapred_reduce_tasks(); if(fReducerNum == 0) return null; //if(isMapperConfChanged == false && isSplitSizeChanged == false && isReducerConfChanged == false) // return job.getR...
4
public static String ArrayToString(String[] array, int bottomlimit, int toplimit) { String string = ""; for(int i = bottomlimit; i <= (array.length - (1 + toplimit)); i++) { if (i != bottomlimit) string += " "; string += array[i]; } r...
2
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Parameterized other = (Parameterized) obj; if (m_field == null) { if (other.m_field != null) return false; } else if (!m_field.e...
9
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 static void zip(File directory, File zipfile) { try { final URI base = directory.toURI(); final Deque<File> queue = new LinkedList<File>(); queue.push(directory); final OutputStream out = new FileOutputStream(zipfile); Closeable res = null; final ZipOutputStream zout = new ZipOutputStream(...
5
private void initialiseerVeld2(VeldType[][] eenVeldType2) { for (int i = 0; i < eenVeldType2.length; i++) { for (int j = 0; j < eenVeldType2[i].length; j++) { eenVeldType2[i][j] = VeldType.LEEG; } } eenVeldType2[0][1] = VeldType.MUUR; eenVeldType...
2
public void render(Graphics g) { g.drawImage(sprite, (int)x - 7- View.x, (int)y -14- View.y, null); if(curanim == 1) { g.drawImage(Images.log, (int)x - 7- View.x, (int)y -23- View.y, null); } }
1
public void destroy(Long id) throws NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Periodo periodo; try { periodo = em.getReference(Periodo.class, id); perio...
2
public List<Statement> parse(Map<String, Integer> labels) { List<Statement> statements = new ArrayList<Statement>(); while (true) { // Ignore empty lines. while (match(TokenType.LINE)); if (match(TokenType.LABEL)) { ...
8
private void intercept() { // only one missile will be hit at iron dome synchronized (missile) { // calculate to know if missile will be intercept before he will hit // the ground if (destructAfterLaunch < missile.getFlyTime() + missile.getLaunchTime() && missile.getLaunchTime() <= destructAfterL...
6
public void setNextByAddr(FlowBlock flow) { /* nextByAddr can be set, when reordering block in transform exc */ // if (nextByAddr != null) // throw new IllegalStateException("nextByAddr already set"); if (flow == END_OF_METHOD || flow == NEXT_BY_ADDR) throw new IllegalArgumentException("nextByAddr mustn't be...
5
@SuppressWarnings("deprecation") private void processExternalCommand(final String[] tokens) { // FIXME: searching broken for mixed case-sensitive / insensitive systems if (!Enigma.isFileSystemCaseSensitive(env.getCurrentPath())) tokens[0] = tokens[0].toLowerCase(); File match = null...
9
public String fixColors(String str) { final StringBuffer buf=new StringBuffer(str); int startedAt=-1; for(int i=0;i<buf.length();i++) { if(buf.charAt(i)=='%') { if(startedAt<0) startedAt=i; else if(((i+1)<buf.length())&&(buf.charAt(i+1)=='^')) { String found=null; final Str...
8
public void runScript(String scriptPath) throws FuzzyEngineException { int lineNumber = 0; try(BufferedReader br = new BufferedReader(new InputStreamReader( new BufferedInputStream(new FileInputStream(new File(scriptPath)))))) { while(true) { String line = br.readLine(); lineNumber++; if(...
6
final public static void main( String[] args ) { //determine the cards that the user is required to use in his/her //163 expression ArrayList < Integer > cardsRequiredToBeUsed = new ArrayList < Integer > (); for ( int i = 0 ; i <= 5 ; i ++ ) { cardsRequiredToBeUsed.add( Integer.valueOf( args[ i ] ) ); }...
6
private void updateHitbox() { hitbox.x += xvel; hitbox.y += yvel; if (incHitboxAlpha) { hitboxAlpha += 0.1; if (hitboxAlpha > 1) { hitboxAlpha = 1; incHitboxAlpha = false; } } else { hitboxAlpha -= 0....
3
public void backTrack() { boolean tmpCounter = false, skipCounter = false; for(int i = closedNodes.size()-1; i >= 0; i--) { skipCounter = false; for (Node tmpDead : deadEndList) { if((closedNodes.get(i).compareTo(tmpDead))==1){ skipCounter = true; break; } } if(skipCounter==false) { ...
9
public void setDt(double dt) { for (Component e : subPanel.getElements()) { e.reset(); if (e instanceof DynaSys) ((DynaSys) e).setDt(dt); else if (e instanceof ApproxDif) ((ApproxDif) e).setDt(dt); else if (e instanceof Integration) ((Integration) e).setDt(dt); } }
4
public static String exec(String command){ // Logger logger = org.apache.log4j.Logger.getLogger(CommandSystem.class); String sStandar = ""; String sError = ""; String s; try { //logger.info("command = " + command); // System.out.println("command = ...
5
public Boolean isWallAhead(Position position, int angle){ Boolean _result = true; Position _pos = null; if(angle >= 360){ angle -= 360; } if(angle < 0){ angle += 360; } switch(angle){ case 0: _pos = new Position(position.getX(), position.getY() - 1); _result = !this._nodes.containsKey(_po...
6
@Override public void update(long deltaMs) { sinceLastSpawn += deltaMs; if(sinceLastSpawn >= betweenSpawns && spawned < amount) { GameSector s = Application.get().getLogic().getGame().getSector(sector); if(s.free()) { s.spawnEnemy(resource); si...
3
public boolean checkPass(int numPlayers){ if (numPlayers==3 && moveList.size() < 2){ return false; } else if (numPlayers==2 && moveList.size() < 1){ return false; } else if (numPlayers==2 && moveList.get(moveList.size()-1).Pass()){ return true; } else if (numPlayers==3 && moveList.get(moveList.size()-2...
9
public void dump(PrintStream out) { for (int row = 0; row < SIZE; row++) { for (int col = 0; col < SIZE; col++) { out.print(square[row][col]); if( col == (SIZE-1)) { out.print("\n"); } else { out.print(","); } } out.flush(); } out.print("\n\n"); out.flush(); }
3
@Override public String log(Iterable<LogItem> items) throws Exception { StringBuilder result = new StringBuilder(2048); InputStream in = getClass().getResourceAsStream(PREAMBULE_FILENAME); if (in == null) throw new Exception(PREAMBULE_FILENAME + " was not found."); BufferedReader reader = new BufferedReade...
4
private void RemoverCampoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RemoverCampoActionPerformed try { if (NomeCampo_TextField.getText().equals("")) { JOptionPane.showMessageDialog(null, "Indique qual o nome do campo a remover!", "Alerta!", JOptionPane.WARNING_...
2
public void loadCategories(File dir){ this.dir = dir; categories.clear(); dialogs.clear(); lastUsedCatID = 0; lastUsedDialogID = 0; for(File file : dir.listFiles()){ if(!file.isDirectory()) continue; DialogCategory category = loadCategoryDir(file); Iterator<Entry<Integer, Dialog>> ite = categ...
5
public static void hessianCD(final ObjectiveFunctionFast afunc, final double[] ax, final double afx, double[][] ahess) { int n = afunc.getDim(); double[] h = new double[n]; double xh, oldx, oldy; int i, j; double tol = Math.pow(MachineAccuracy.EPSILON, 0.25);//TODO revise maybe 1...
8
public void setEdgePoints(Object edge, List<mxPoint> points) { mxIGraphModel model = graph.getModel(); mxGeometry geometry = model.getGeometry(edge); if (geometry == null) { geometry = new mxGeometry(); geometry.setRelative(true); } else { geometry = (mxGeometry) geometry.clone(); } if (th...
4
protected void onPing(String sourceNick, String sourceLogin, String sourceHostname, String target, String pingValue) { this.sendRawLine("NOTICE " + sourceNick + " :\u0001PING " + pingValue + "\u0001"); }
0
public PreparedStatementMapper(Class<T> clazz){ // this.clazz = clazz; methods = clazz.getMethods(); //hashmap to store the setters getters = new HashMap<String,Method>(); for( int i=methods.length -1; i>= 0; i--){ Column col = methods[i].getAnnotation(Column.class); Class<?>[] parameters = meth...
4
private ArrayList<Card> createTheFullPack() { ArrayList<Card> theCards = new ArrayList<Card>(TOTAL_NUMBER_OF_CARDS); int suitNum = A1Constants.CLUBS; int cardValue = 0; for (int i = 0; i < TOTAL_NUMBER_OF_CARDS; i++) { theCards.add(new Card(cardValue, suitNum)); if (cardValue >= CARDS_IN_EACH_SUIT - 1) ...
2
private void declaraProced() { Simbolo simboloProced = null; if (comparaLexema(Tag.VOID)) { consomeToken(); if (comparaLexema(Tag.IDENTIFICADOR)) { simboloProced = new Simbolo(escopoAtual + 1, null, listaTokens .get(indiceLista).getNomeDoToken(), null, "PROCEDIMENTO"); consomeToken()...
9
public static void sendFile ( Socket sckIn , String strId , EzimFileOut efoIn ) throws Exception { if (efoIn != null) { efoIn.setSocket(sckIn); EzimDtxSemantics.initByteArrays(); byte[] bTmp = new byte[EzimNetwork.dtxBufLen]; int iTmp = 0; long lCnt = 0; long lCLen = 0; FileInputS...
7
private static Token matchLiteral(String word, int line, int position){ StringBuilder token = new StringBuilder(); int i = 0; for (; i<word.length(); i++){ char current = word.charAt(i); if (!Character.isDigit(current)){ break; } token.append(current); } if (i != 0) return new Token(Token...
3
public boolean next() { if (hasNext()) { tick(); return true; } return false; }
1
public boolean hasparent(Widget w2) { for (Widget w = this; w != null; w = w.parent) { if (w == w2) return (true); } return (false); }
2
private void verifyComponentStart(Stack<LiteralComponent> componentStack, LiteralComponent componentToCheck, String literalName) throws ComponentMismatchException { if (componentStack.size() == 0) { if (componentToCheck.compareTo(LiteralComponent.NAME_START) > 0) throw new ComponentMismatchException( Error...
7
public static void main(String[] args) throws Exception { if(args.length < 1){ System.out.println("Usage : please input htmlFileName"); System.exit(0); } String workDir = System.getProperty("user.dir"); String fileSeparator = System.getProperty("file.separator"); // String urlReg = "href=\"(http://...
6
public void setSolPosId(int solPosId) { this.solPosId = solPosId; }
0
private void downloadPictures(int indexOfPicture) { try { File picturesDir = null; URL aURL = new URL("http://www.cc.kyoto-su.ac.jp/~atsushi/Programs/CSV2HTML/PrimeMinisters/"+url+"0"+indexOfPicture+".jpg"); InputStream inputStream = aURL.openStream(); if(url == "images/") { picturesDir = new ...
9
@Override public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) { iterations = 0; double temp = 0; Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel))); Complex[] complex = new Complex[2]; complex[0] = tempz; complex[1] = new Comp...
9
public static FillInBlankQuestion getQuestionByQuestionID(int questionID) { try { String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, questionID); ResultSet rs = stmt.executeQuery(); r...
1
private void calculateRootNode(CleanTimeValues cleanTimeValues, Set<String> namespacePrefixes) { cleanTimeValues.rootNode = cleanTimeValues.htmlNode; // original behavior -- just take the first html element ignoring all other content, or later html elements. // if (properties.isOmitHtmlEnvelope()) { // ...
9
@Test public void testFailingData() { boolean success = true; try { new Action(new JSONObject("{" + "'execute': 'exec testAction.ex'," + "'keywords': [" + " 'key'," + " 'word'" + "]" + "}")); } catch(JSONException e) { success = false; } if(success)fail("Missing Name doesn...
6
public int getMethod() { if (buttonGroup.getSelection().getActionCommand().equals("A")) return 1;// DESX if (buttonGroup.getSelection().getActionCommand().equals("B")) return 2;// Knapsack else return 3;// AA }
2
public static void main(String[] args) { try { Files.walkFileTree(Paths.get("/home/xander/Downloads"), new PrintFileVisitor()); } catch (IOException e) { e.printStackTrace(); } }
1
public void testIsEqual_YM() { YearMonth test1 = new YearMonth(2005, 6); YearMonth test1a = new YearMonth(2005, 6); assertEquals(true, test1.isEqual(test1a)); assertEquals(true, test1a.isEqual(test1)); assertEquals(true, test1.isEqual(test1)); assertEquals(true, test1a.is...
1
public void sendLine(String line) throws IOException { if (_acceptable) { throw new IOException("You must call the accept() method of the DccChat request before you can use it."); } // No need for synchronization here really... _writer.write(line + "\r\n"); _writer.fl...
1
public boolean start() { address = null; try { address = InetAddress.getByName(ip); } catch (UnknownHostException e) { e.printStackTrace(); } Socket s; try { s = new Socket("google.com", 80); selfIP = (s.getLocalAddress().getHostAddress()); if (selfIP == null) { internetConnected = false;...
5
public void showDwarfData(Dwarf dwarf) throws BadLocationException { doc.remove(0, doc.getLength()); doc.insertString(doc.getLength(), "ID: " + dwarf.getId() + "\n", stylePlain); doc.insertString(doc.getLength(), "Name: ", stylePlain); doc.insertString(doc.getLength(), dwarf.get...
5
public static char toCompatibilityJamo(char jamo) { if (jamo >= 0x1100 && jamo < 0x1100 + CHOSEONG_LIST.length) { return CHOSEONG_LIST[jamo - 0x1100]; } if (jamo >= 0x1161 && jamo <= 0x1175) { return (char)(jamo - 0x1161 + 0x314F); } if (jamo == 0) { return HANGUL_FILLER; } else { if (jamo >= 0x...
7
* @param decode decode vector. * @param bitsPerComponent bits per component . */ private static void alterRasterYCCK2CMYK(WritableRaster wr, Vector<Integer> decode, int bitsPerComponent) { float[] origValues...
6
private static int singleManeuverRoll(Dice d){ Flags rollFlags = new Flags(); rollFlags.ManeuverFlag = true; d.rollDice(); if((d.getCurrentFace() instanceof ManeuverIcon)||(d.getCurrentFace() instanceof IDIcon)) return d.getCurrentFaceValue(); else if(d.getCurrentFace() instanceof SpecialIcons){ Spec...
5