text
stringlengths
14
410k
label
int32
0
9
public static Object[] getSourceVertices(mxAnalysisGraph aGraph) throws StructuralException { if (!mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED)) { throw new StructuralException("The graph is undirected, so it can't have source vertices."); } ArrayList<Object> sou...
4
public String getHindustaniNoteForWesternNote(String w){//B3 int octave = getOctaveOfWesterNote(w); String wNote = getNoteOfWesternNoteWithoutOctave(w); //Determine Hindustani Note int wNoteIdx = getNoteIndex(wNote, wNotes); int hNo...
7
@DELETE() @Path("release/{playerId}") @Produces("application/json") @SportService(ServiceType.MLB) public Player releasePlayer(@PathParam("playerId") int iPlayerId) { Player p = new Player(); UserTransaction utx = null; try { ...
4
public void updateState() { updatePause(); if (!isPaused) { if (level.isFinished()) { if (level.isVictorious()) { if (!lg.hasMoreLevels()) { SwingUtilities.invokeLater(new Runnable() { public void run() { controller.setVictoryScreen(); } }); } else { Sw...
5
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
8
public static void main(String[] args) { Poker[] pokers = new Poker[52]; BufferedReader br; for (int i = 0; i < 4; i++){ for (int j = 0; j < 13; j++){ pokers[i*13+j] = new Poker(nums[j], colors[i]); } } int n = 2; do{ ...
6
public String[] loadArchiveFromBlob(byte[] blob, boolean isSecondary) throws IOException { if (isSecondary && mFileManifest == null) { throw new IOException("Can't load secondary archive because no primary archive is loaded yet!"); } ByteArrayIO io = new ByteArrayIO(); io.se...
8
public void testWithFieldAdded_DurationFieldType_int_3() { LocalDateTime test = new LocalDateTime(2004, 6, 9, 10, 20, 30, 40); try { test.withFieldAdded(null, 6); fail(); } catch (IllegalArgumentException ex) {} }
1
private void checkForUpdates() { if (!getConfig().getBoolean("global-settings.check-for-updates")) { getLogger().log(Level.WARNING, "Why you no like being informed about updates??"); return; } if (getConfig().getBoolean("global-settings.auto-update")) { Updater updater = new Updater(this, 65327, this....
4
public boolean isValid() { Set<Box> boxes = getBoxes(); Set<Integer> seen = new HashSet<>(); boolean isValid = true; for(Box box : boxes) { if(box.getValue() == -1) { isValid = false; } else if(seen.contains(box.getValue())) { isValid = false; } else { seen.add(box.getValue()); } } ...
3
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 String getAccessToken() { return accessToken; }
0
@Override public void setLoggerConfig(ILoggerConfig loggerConfig) { this.loggerConfig = loggerConfig; }
0
@Override public void drawTool(Graphics g, int mouseX, int mouseY) { ((Graphics2D) g).setStroke(new BasicStroke(2)); Canvas c = MainWindow.MAIN_WINDOW.getCanvas(); super.drawTool(g, mouseX, mouseY); if (rect != null){ g.setColor(Color.CYAN); switch (state){ case FIRST: g.drawRect(c.getScaledCoord...
5
public EsteenTyyppi kuuluukoPiste(Piste piste) { if (piste.getX() >= vasenYlakulma.getX() && piste.getX() <= oikeaAlakulma.getX() && piste.getY() >= vasenYlakulma.getY() && piste.getY() <= oikeaAlakulma.getY()) { return tyyppi; } return null; }
4
private static int entrance(List<Point> points){ int size=points.size(),result=0; for(int i=0;i<size-1;++i){ for(int j=i+1;j<size;++j){ Point middle=middle(points.get(i),points.get(j)); result=Math.max(result,inCircleCnt(middle,points)); } ...
2
private Animation GetWalkAnimation(dir d){ Animation fm = null; switch(d){ case down: fm = WalkDown; break; case left: fm=WalkLeft; break; case right: fm=WalkRight; break; case up: fm=WalkUp; break; } return fm; }
4
public void pollInput() { while (Keyboard.next()) { if (Keyboard.getEventKeyState()) { toggle(Keyboard.getEventKey(), true); if (Console.isActive()) { pollTyping(Keyboard.getEventKey()); } } else { toggle(Keyboard.getEventKey(), false); } } }
3
private static Shape getRandomShape(){ Shape randomShape = null; switch (getRandomNumber(1, 4)){ case 1: randomShape = new Square(getRandomColor(), getRandomNumber(1, 100)); break; case 2: randomShape = new Triangle(getRandomColor(...
4
public void run() { final String[] azotArgs = new String[1]; azotArgs[0] = workflowFile; final Properties customProperties = new Properties(); customProperties.setProperty("azot-verbose", String.valueOf(verbose)); customProperties.setProperty("azot-debug", String.valueOf(debug)); customProperti...
5
public String[] checkLogin(String us,String pass){ /* * elegxei an einai swsta ta stoixia tou login kai epistrefei to epipedo tou user px(ipalilos) */ String[] priv= new String[2]; priv[0]="0"; try { pS = conn.prepareStatement("SELECT * FROM users WHERE username=? AND password=?"); pS.setString(1, u...
5
public String getEventName() { return ( name == null || name.equals("")) ? getClass().getSimpleName() : name; }
2
public void VM(Villain v){ //try { // while (!win) { int ranNum = (int)(Math.random() *4) +1; System.out.println(ranNum); if(ranNum == 1){ if(!m.getMap(v.getVillainX(), v.getVillainY() - 1).equals("w") ) v.villainMove(0, -1); } if(ranNum == 2){ if(!m.getMap(v.getVillainX(), ...
8
public static void count(String s) { int UniqueWords = 0; boolean[] b = new boolean[256]; for(int i=0;i<s.length();i++) { if(!b[s.charAt(i)]) { UniqueWords += 1; b[s.charAt(i)] = true; } } System.out.println("Unique words in the String is : " + UniqueWords); }
2
public void close(){ try{ if(in!=null)in.close(); if(out!=null)out.close(); if(socket!=null)socket.close(); } catch(Exception e){ } in=null; out=null; socket=null; }
4
@Override public void actionPerformed(ActionEvent arg0) { String command = arg0.getActionCommand(); String JSONtext = ""; switch (command) { case "startButton": if(startable){ try { JSONtext = enc.encode(new StartedMessage()); sendMessage(JSONtext); } catch (JSONException e1) { e1.pri...
5
public static boolean isCachedObject(int objectX, int objectY, int objectHeight, int objectId) { for (StateObject so : stateChanges) { if(so == null) continue; if(so.getHeight() != objectHeight) continue; if(so.getStatedObject() == objectId && so.getX() == objectX && so.getY() == objectY) retu...
6
public Item zoekItems(int teZoekenNummer) { Item item = null; try (Connection conn = DriverManager.getConnection(JDBC_URL)) { PreparedStatement queryZoekItem = conn.prepareStatement("SELECT FROM ITEM WHERE ITEMID = ?"); queryZoekItem.setInt(1, teZoekenNummer); tr...
3
public int write(byte[] abData, int nOffset, int nLength) { LOG.log(Level.FINE, ">TCircularBuffer.write(): called; nLength: {0}", nLength); dumpInternalState(); synchronized (this) { LOG.log(Level.FINE, "entered synchronized block."); if (!m_bBlockingWrite) { ...
5
public static int[] lis(int[] array) { int[] A = new int[array.length + 1]; int[] lis = new int[array.length]; Arrays.fill(A, Integer.MAX_VALUE); int longest = 0; for (int i = 0; i < array.length; i++) { int low = 0; int high = array.length - 1; while (low < high) { int mid = low + (high - low + ...
5
public Label firstBlock() { final Iterator iter = code.iterator(); while (iter.hasNext()) { final Object obj = iter.next(); if (obj instanceof Label) { final Label l = (Label) obj; if (l.startsBlock()) { return l; } } } return null; }
3
public void act() { setImage(flashScreen); if (style) { if (transparency > 10) { getImage().setTransparency(transparency-=10); } else { getWorld().removeObject(this); } } ...
4
static void kungfum_draw_background(osd_bitmap bitmap) { int offs,i; /* for every character in the Video RAM, check if it has been modified */ /* since last time and update it accordingly. */ for (offs = videoram_size[0]/2 - 1;offs >= 0;offs--) { if (dirtybuffer[offs]!=0 || dirtybuffer[offs+0x800]!=0)...
9
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed path = formatDest(jTextField3.getText().trim()); if(path.length()>1 && item1!=null && item2!=null) { patch = loadFileChooser(new PatchChooseFilter(), true); try { ...
9
Widget computeTabGroup() { ToolItem[] items = _getItems(); if (tabItemList == null) { int i = 0; while (i < items.length && items[i].control == null) i++; if (i == items.length) return super.computeTabGroup(); } int index = 0; while (index < items.length) { if (items[index].hasFocus()) ...
8
public int searchAndReplace( String searchfor, String replacewith ) { CellHandle[] cx = getCells(); int foundcount = 0; for( CellHandle aCx : cx ) { if( !(aCx.getCell() instanceof Formula) ) { // find the string if( !aCx.isNumber() ) { String v = aCx.getStringVal(); if( v.indexOf( s...
4
private Expression renameJikesSuper(Expression expr, MethodAnalyzer methodAna, int firstOuterSlot, int firstParamSlot) { if (expr instanceof LocalLoadOperator) { LocalLoadOperator llop = (LocalLoadOperator) expr; int slot = llop.getLocalInfo().getSlot(); if (slot >= firstOuterSlot && slot < firstParamSlot...
9
public static Attunement get2(String key, World world){ //return players.get(key); if (players.containsKey(key)){ for (int i=0;i<players.get(key).size();i++){ if ((players.get(key).get(i).loc.getWorld() != null && players.get(key).get(i).loc.getWorld().equals(world)) || (Config.fallbackToOtherWorldLifestone ...
6
public static boolean isTypeVoid(Class<?> type) { return (type != null && void.class.equals(type)); }
2
public synchronized void close() { if (m_Dead) { return; } else { try { // connection dead m_Dead = true; // close i/o m_TerminalIO.close(); } catch (Exception ex) { log.error("close()", e...
5
public boolean inBound(int x, int y) { return (x >= position.getX() && x <= position.getX() + width || y >= position.getY() && y <= position.getY() + height); }
3
public HashMap listToMap(MapFilter mf) { HashMap newmap = new HashMap(); Iterator it = iterator(); while(it.hasNext()) { Object o = it.next(); newmap.put(o, mf.map(o)); } return newmap; }
1
public boolean contains (Point2D point) { double x = point.getX(); double y = point.getY(); if (x >= start.getX() && x <= end.getX() && y >= start.getY() && y <= end.getY()) { if (isX) return true; else { // y = ax + b double _y = a * x + b; if (_y == y) return true; } } re...
6
@Override public OccurrenceAllocation select(SolverState schedule, Occurrence forOccurrence) { // Allocations aligned to elementary intervals start and ends AlignedOccurrenceAllocationsIterator allocations = new AlignedOccurrenceAllocationsIterator(forOccurrence, schedule.allocation...
5
private String getStatusMessage(final int status) { switch (status) { case 0x00: return "OK"; case 0x01: return "invalid/unsupported command"; case 0x02: return "no memory on target"; case 0x03: return "malformed data in request"; case 0x64: return "invalid session ID"; ...
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Acao other = (Acao) obj; if (nomefull == nu...
9
final private void init(){ Utils.setDialogIcon( this ); setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE ); Container cont = getContentPane(); cont.setLayout(new GridBagLayout()); Insets insetL = new Insets(8,8,0,8); Insets insetR = new Insets(8,0,0,8); ...
5
private static Node[] splitInHalf(Node h){ Node[] ret = new Node[2]; int l = findLength(h); int cnt = 0; Node ori = h; while(cnt<l/2-1){ cnt++; h=h.next; } ret[1]=h.next; h.next = null; ret[0]=ori; return ret; }
1
private void addBuddyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBuddyButtonActionPerformed int response = server.addBuddy(server.getCurrentUser(), enterBuddyNameField.getText()); if(response == 106){ server.buddies.add(enterBuddyNameField.getText()); ...
4
public boolean setsockopt(int option_, Object optval_) { if (ctx_terminated) { ZError.errno(ZError.ETERM); return false; } // First, check whether specific socket type overloads the option. boolean rc = xsetsockopt (option_, optval_); if (rc || ...
3
private void findApplicableMethods() { Class<?> resourceClass = resource.getClass(); for(Method m: resourceClass.getMethods()) { for(Class<?> clazz: methods) { @SuppressWarnings("unchecked") Class<? extends Annotation> httpMethodClass = (Class<? extends Annotation>) clazz; if(isApplicableMethod(m, ht...
7
public Ship getShip(int x, int y) { for(int i = 0; i < fleet.size(); i++) { Ship ship = fleet.get(i); if(ship.contains(x, y)) return ship; } return new Ship(); }
2
private CanvasMouse(Component component) { // Need the component object to convert screen coordinates this.component = component; // Calculate the component center int w = component.getBounds().width; int h = component.getBounds().height; center = new Point(w / 2, h / 2); try { robot = new Robot(); }...
2
protected PlayerTurn nextPlayer() { boolean test= false; if (test || m_test) { System.out.println("Othello :: isWinner() BEGIN"); } if(getPlayerTurn() == Game.PlayerTurn.PLAYER1) { if (test || m_test) { System.out.println("Othello :: isWinner() END"); } return Game...
7
public static boolean run_tick() { Sim_entity ent; int num_started; boolean queue_empty; num_started = 0; int entities_size = entities.size(); for (int i=0; i < entities_size; i++) { ent = (Sim_entity)entities.get(i); if (ent.get_state() == Sim_entity.RUNNABLE) { ent.restart(); nu...
8
private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; if (++jj_gc > 100) { jj_gc = 0; ...
6
@Override public Long process(int value) { Long freq = frequencies.get(value); if (freq == null) { freq = 0L; } freq++; frequencies.put(value,freq); return freq; }
1
@SuppressWarnings("unchecked") public static ArrayList<Move> findBlackKingMoves(Chessboard board, BlackFinderStrategy strategy) throws ChessboardException { ArrayList<Move> moves = board.getAllLegalBlackKingMoves(); if (moves.size() == 0) { return null; } switch (strategy) { ca...
7
@Override public void addParametersCost(NodeArgument[] params, double cost) { this.costTable.put(NodeArgumentArray.getNodeArgumentArray(params), cost); // set the min and the max if ((cost!= Double.NEGATIVE_INFINITY) && (cost!= Double.POSITIVE_INFINITY) ){ if (this.minCo...
6
private static int treatCommand(String s,long idClient, Aquarium a, boolean server){ String contenu [] = s.split("!"); String commande = contenu[0]; switch (commande){ case "DECONNECT": //message : CMD a.disconnectClient(idClient); break; case "ADDFISH": if(server){ //message : CMD!idClien...
9
public void calculatePointLoss(int group, int index) { switch(group) { case Model.DVRC_ENUM: if(index == dvrcMostPreferred) { points -= ptsDed; sound = false; } else { sound = true...
8
public void run() { InputStream instr = tc.getInputStream(); try { byte[] buff = new byte[1024]; int ret_read = 0; do { ret_read = instr.read(buff); if(ret_read > 0) { System...
4
private Object getObject(EntityUniqueIdentifier belongsTo) { //System.out.println("BelongsTo: " + belongsTo); if (this.maintypes.containsKey(belongsTo)) { return this.maintypes.get(belongsTo); } else { for (Relation key : this.referenceTypes.keySet()) { /...
3
@Override public int numberOfLivingNeighbors(int x, int y) { int numberOfLivingNeighbors = 0; int xPositive = ensurePositiveCoordinate(x, getBoardWidth()); int yPositive = ensurePositiveCoordinate(y, getBoardHeight()); for (int i = -1; i < 2; i++) { for (int j = -1; j < ...
5
@Override public int compare(AbstractCarriage ac1, AbstractCarriage ac2) { if (ac1 instanceof AbstractPassengerCarriage) { if (ac2 instanceof AbstractPassengerCarriage) { return compareType( ((AbstractPassengerCarriage) ac1).getComfortType().getId(), ((AbstractPassengerCarriage) ac2).getComf...
7
private boolean findAndRemove(Object e) { if (e != null) { for (Node pred = null, p = head; p != null; ) { Object item = p.item; if (p.isData) { if (item != null && item != p && e.equals(item) && p.tryMatchData()) { ...
9
private ArrayList createPegList() { ArrayList pegs = new ArrayList(); for (int i = 0; i < N_ACROSS; i++) { pegs.add(new GPoint(i * PEG_SEP, 0)); } for (int i = 0; i < N_DOWN; i++) { pegs.add(new GPoint(N_ACROSS * PEG_SEP, i * PEG_SEP)); } for (int ...
4
public void paintComponent(Graphics g) { int foodCount = 0; for(int x = 0; x < rows; x++) { for(int y = 0; y < cols; y++) { Tile t = map[x][y]; if(t.getType() == Tile.TileType.TILE_WATER) { g.setColor(new Color(25, 25, 185)); } else if (t.getType() == Tile.TileType.TILE_GROUND) { b...
4
@Override public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand().toLowerCase(); if (cmd != null) { if (cmd.equals("save")) { save(); frame.dispose(); } if (cmd.equals("cancel")) { frame.dispose(); } } }
3
@OnOpen public void onOpen(Session userSession) throws IOException { chatroomUsers.add(userSession); Iterator<Session> iterator = chatroomUsers.iterator(); while (iterator.hasNext()) { (iterator.next()).getBasicRemote().sendText(buildJsonUsername()); } }
1
public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception ex) { System.out.println("Look and feel was not found."); } //Schedule a job for the event dispatch thread: ...
3
void read() { char ch = '0'; while(ch != '}'){ try{ ch = (char)System.in.read(); } catch(IOException e){ System.out.println("\nIO Exception!!!\n"); } if(((ch <= '0') || (ch >= '9')) && (ch != '}') && (ch != 10)){ result.append(ch); } } }
6
public Text evaluate(final org.apache.hadoop.io.Text... args) { if (args.length < 1) { return new Text(NOT_ENOUGH_ARGS_ERROR); } Text md5; try { MessageDigest messageDigest = MessageDigest.getInstance(HASH_ALGORITHM); messageDigest.reset(); ...
4
@Override public void updateUser(User user) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.update(user); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ if(ses...
3
public void visitArrayRefExpr(final ArrayRefExpr expr) { if (previous == expr.array()) { // the array reference is like the previous = expr; // left child expr.parent().visit(this); } else if (previous == expr.index()) { check(expr.array()); // right child } }
2
public static void DFS(int index, int step, char end, String path) { if (step < minL) { if(m[index]==end){ //Llegó al final minL = step+1; minPath = path+m[index]; } for (int i = 0; i < ma[index].size(); i++){ //Marcar camino usado e ir a la siguiente ciudad if(!used[index][ma[index].get(i)...
5
public void shiftMode() { finalEdit = true; LRParseTable table = getParseTable(); // Determine which rows and columns have ambiguity. cellEditors = new TableCellEditor[table.getRowCount()][table .getColumnCount()]; for (int r = 0; r < table.getRowCount(); r++) for (int c = 1; c < table.getColumnCount()...
3
private Component getResizableToolbarPanel() { JPanel panel; Box boxButtons = Box.createHorizontalBox(); Box boxButtons2 = Box.createHorizontalBox(); if (frame.getWidth() >= WINDOW_SINGLE_BUTTONS_PANEL_MAX_WIDTH) { boxButtons.setBorder(BorderFactory.createEmptyBorder(1, 8, 1...
1
static final void method268(int i, int i_36_, int i_37_, int i_38_, int i_39_, int i_40_, int i_41_, int i_42_) { anInt259++; int i_43_ = -334 + i_39_; if (i_43_ < 0) i_43_ = 0; else if ((i_43_ ^ 0xffffffff) < -101) i_43_ = 100; int i_44_ = (i_43_ * (-Class348_Sub23_Sub3.aShort9044 + Class320.zoo...
5
final DirTree walkTo(final Path path) { if (path == null) { return null; } DirTree t = this; if (path == this.base) { return t; } final String[] walkingPath = path.relativize(this.base).split("/"); int layer = 0; while (layer < walkingPath.length) { final String base_ = walkingPath[layer++]; ...
5
void makeBMEAveragesTable( double[][] D, double[][] A ) { edge e, f, exclude; node u,v; // first, let's deal with the averages involving the root of T e = root.leftEdge; f = depthFirstTraverse( null ); while ( null != f ) { if ( f.head.leaf() ) A[e.head.index][f.head.index] = A[f.head.index][e....
8
private void resolvesEntityAdditionsAndRemovals(GameContext g) { for (Mob m : g.removals) { if (m instanceof Dot) dots.remove(m); else if (m instanceof Explosion) explosions.remove(m); // else if (m instanceof Line) // lines.remove(m); else if (m instanceof DynamicPolygon) polygons.remove(m)...
8
public Color getSquareColor(SquareColor sColor) { if (sColor == null) { return new Color(20, 20, 20); } switch (sColor) { case CYAN: return new Color(76, 111, 124); case RED: return new Color(124, 82, 83); case BLUE:...
8
@Override boolean transcriptChange() { //this should simply be a negative number representing the distance to the coding start if (utr5prime.intersects(seqChange)) { //distance to cds start //cdsStart>cdsEnd, so cdsStart is really cds start //this is the opposite...
3
private static void insertNewItem(Statement stmt) { System.out.println("Are you sure? y/n"); String input = scan.nextLine(); if (input.equalsIgnoreCase("y")) { String[] newItemValues = new String[7]; int[] statsModified = new int[7];//Fix all of this later ...
5
public ArrayList<Task> getPlausableDependantTasks(Task task) { ArrayList<Task> tasksToReturn = new ArrayList<Task>(); ArrayList<Task> dependantNodes = task.getDependentNodes(); for (Task currentTask : tasks) { if (task.isSibling(currentTask)) { // task is subling ...
4
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof OFPortStatus)) { return false; } OFPortStatus other = (OFPortStatus) obj; ...
7
private String infos(Signature signature) { double meanX = 0; double meanY = 0; double minX = Double.MAX_VALUE; double maxX = Double.MIN_VALUE; double minY = Double.MAX_VALUE; double maxY = Double.MIN_VALUE; for (Point point : signature.getPoints()) { meanX += point.getX(); meanY += point.getY(); ...
5
private String getFile(String link) { String download = null; try { // Open a connection to the page URL url = new URL(link); URLConnection urlConn = url.openConnection(); InputStreamReader inStream = new InputStreamReader( urlConn.getInputStream()); BufferedReader buff = new BufferedReader(inSt...
6
@Override public void mouseDragged(MouseEvent e) { idleTime = 0; mouseX = e.getX(); mouseY = e.getY(); if (e.isControlDown() && !isRightButton(e)) { setType(ClickType.CTRL_DRAG); } else { setType(isRightButton(e) ? ClickType.RIGHT_DRAG : ClickType.LEFT_DRAG); } updateMouse(); }
3
public static void main(String[] args) { final int port = 8003; //create the storage files if they do not exist File userstocks = new File("userstocks.txt"); if(!userstocks.exists()) { try { userstocks.createNewFile(); } catch (IOException e) { System.out.println("Could not create userstoc...
8
@Override public void componentShown(ComponentEvent arg0) { // TODO Auto-generated method stub }
0
public String searchByPhone(final String phone) throws IOException { if (searchingFile(phone,"phone") == null) { return null; } return searchingFile(phone,"phone").name; }
1
public static List<String> readSequence(String option, BufferedReader reader) throws IOException { List<String> list = new ArrayList<String>(); System.out.println(option); String line = reader.readLine(); StringTokenizer tokenizer = new StringTokenizer(line); while (tokenizer.h...
1
public boolean eventGeneratable(String eventName) { if (m_listenee == null) { return false; } if (m_listenee instanceof EventConstraints) { if (eventName.equals("instance")) { if (!((EventConstraints)m_listenee). eventGeneratable("incrementalClassifier")) { return false; } } ...
9
public void endTagEOL(String name, boolean indent) { outdent(); if (indent) { writeIndentation(); } print("</"); //$NON-NLS-1$ print(name); finishTagEOL(); }
1
private BSTNode<T> removeNode(BSTNode<T> tree) { if (tree.getLeft() == null) return tree.getRight(); if (tree.getRight() == null) return tree.getLeft(); T data; data = getPredecessor(tree.getLeft()); tree.setInfo(data); tree.setLeft(recRemove(data, tree.getLeft())); return tree; }
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 fe...
9
public int findPeakElement(int[] num) { if (num.length == 1) { return 0; } if (num.length == 2) { return num[0] < num[1] ? 1 : 0; } for (int i = 1; i < num.length - 1; i++) { if (num[i] > num[i-1] && num[i] > num[i+1]) { return ...
7
public DHCPOption applyOption(DHCPPacket request) { if (request == null) { throw new NullPointerException("request is null"); } if (this.mirror) { DHCPOption res = request.getOption(this.getCode()); return (res != null ? res : this); // return res or this } else { return this; } }
3