text
stringlengths
14
410k
label
int32
0
9
public void actionPerformed(ActionEvent arg0) { Component apane = environment.tabbed.getSelectedComponent(); JComponent c=(JComponent)environment.getActive(); SaveGraphUtility.saveGraph(apane, c,"BMP files", "bmp"); }
0
protected void calcDIR_NTRes() { byte[] bTemp = new byte[1]; for (int i = 12;i < 13; i++) { bTemp[i-12] = bytesOfFAT32Element[i]; } DIR_NTRes = byteArrayToInt(bTemp); }
1
public static String toString(byte[] data) { ByteArrayInputStream bais = new ByteArrayInputStream(data); DataInputStream dis = new DataInputStream(bais); try { return dis.readUTF(); } catch (IOException e) { } return null; }
1
public void setActionEnabled(String type, boolean enabled){ if(type.equals("undo")){ toolBarUndo.setEnabled(enabled); editUndo.setEnabled(enabled); } else if(type.equals("redo")){ toolBarRedo.setEnabled(enabled); editRedo.setEnabled(enabled); ...
7
@Override public LoggerAppender[] getAppenders() { return (LoggerAppender[])appenders.toArray(new LoggerAppender[appenders.size()]); }
0
public static double romberg(SingleVarEq f, double a, double b, int steps){ // TODO: Fix this to start at index 0 rather than 1; // It works as is, but allocates one dimension of extra array space than necessary. // since the 0th row and column is never used. double[][] R = new double[3][steps + 1]; double...
5
public void reset() { startTime = System.currentTimeMillis(); }
0
public void loadConfig(String config){ int configlength = config.length(); for (int i = 0; i < 81; i++){ int[] xy = indexToXY(i); int x = xy[0]; int y = xy[1]; String cellValue = ""; if (i < configlength){ char configValue = config.char...
5
public RouterPacket(byte[] buf, int length, InetAddress address, int port, int time, int sequence) { //set the sequence number of the packet this.sequence = sequence; //set the time created timeCreated = time; //create the packet dPacket = new DatagramPacket(buf,lengt...
0
public void render(Graphics graphics){ for(int i=0;i<object.size();i++){ tempObject = object.get(i); tempObject.render(graphics); } }
1
private int getHeaderEndIdx(byte[] buf) { int idx = 0; while (idx + 3 < buf.length) { if (buf[idx] == '\r' && buf[idx + 1] == '\n' && buf[idx + 2] == '\r' && buf[idx + 3] == '\n') { return idx + 4; } idx++; } return 0; }
5
@Override public final void actionPerformed(final ActionEvent evt) { if (ePomodoroTime == pomodoroTime) { ePomodoroTime--; // To ensure progress is not 100% at start if (isLongBreakNow) { taskPanel.setStatus(CurrentTaskPanel.WORKING_THEN_LBRK); } ...
9
protected String toJSONFragment() { StringBuffer json = new StringBuffer(); boolean first = true; if (isSetCreditInstrumentId()) { if (!first) json.append(", "); json.append(quoteJSON("CreditInstrumentId")); json.append(" : "); json.append(quoteJSO...
8
private void updateBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateBtnActionPerformed question = questionField.getText(); instructions = instructionField.getText(); // set the match patter of "[]" Matcher matcher = Pattern.compile("\\[([^\\]]+)").matcher(que...
7
public IntegerNode pop(){ while (isEmpty() != true){ IntegerNode nextInLine = this.top; this.top = this.top.getNextTop(); count--; return nextInLine; } return null; }
1
private void iniReader() throws IOException { FileReader iniFile = new FileReader("D:\\search.ini"); BufferedReader reader = null; try { reader = new BufferedReader(iniFile); String str = ""; if((str = reader.readLine()) != null ) { field.setText(str); } if((str = reader.readLine()) != null ) {...
8
void parseAttlistDecl() throws java.lang.Exception { String elementName; requireWhitespace(); elementName = readNmtoken(true); requireWhitespace(); while (!tryRead('>')) { parseAttDef(elementName); skipWhitespace(); } }
1
private final int toIndex(Object base, Object property) { int index = 0; if (property instanceof Number) { index = ((Number) property).intValue(); } else if (property instanceof String) { try { index = Integer.valueOf((String) property); } catch (NumberFormatException e) { throw new IllegalArgume...
9
final int method854(int i) { anInt10827++; Class259 class259 = method868((byte) -125); int i_32_ = aClass99_10893.anInt1281; boolean bool; if ((class259.anInt3258 ^ 0xffffffff) != -1) { bool = aClass99_10893.method1089(anInt10889, class259.anInt3283, -21712, class259.anInt3258); } else { bool = aClass...
9
public static long parseLongWithTable(String s, int radix){ boolean negative = false; if(radix < 2 || radix > 36){ throw new NumberFormatException(); } char[] chars = s.toUpperCase().toCharArray(); if(chars[0] == 45){ negative = true; chars = removeChar(chars, (char)45); } chars = reverse(chars);...
8
public static void main(String[] args) { long sum = 0; outer: for (int i = 1; i <= 100_000_000; i++) { if (!isPrime(i)) continue; int n = i - 1; int end = (int) Math.ceil(Math.sqrt(n + 1)); for (int j = 2;...
5
boolean placeDomino(int i) { if (i == D.length) { for (int d = 0; d < D.length; d++) { System.out.println(D[d]); } return true; } for (int x = 0; x < w; x++) for (int y = 0; y < h; y++) { if (tryPlace(i, x, y, x - 1, y) || tryPlace(i, x, y, x + 1, y) || tryPlace(i, x, y, x, y + 1) || try...
8
public int checaDia(int diaTemp) { int ultimoDiaMes[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if (diaTemp > 0 && diaTemp <= ultimoDiaMes[mes]) { return diaTemp; } else if ((mes == 2 && diaTemp == 29) && (ano % 400 == 0) || ((ano % 4 == 0) && (ano % 100 != 0))) { ...
7
public Writer(String fileName) throws UnsupportedCharsetException { if (System.getProperty("file.encoding").equalsIgnoreCase("UTF-8") == false) { String explainString // Chack whether the encoding property is correct = "\n\tThe system property: \"file.encoding\" should set to \"U...
4
public CreateDirectories() { try { String binning = "Bins"; boolean success = (new File(binning)).mkdir(); if(success) { System.out.println("Folder 'bins' created"); } for(int ab = 0; ab<4; ++ab) { // alpha/beta designation for(int d=0; d<10; ++d) { // distance for (int delta=0; del...
8
public static <A, B> Equal<Either<A, B>> eitherEqual(final Equal<A> ea, final Equal<B> eb) { return equal(e1 -> e2 -> e1.isLeft() && e2.isLeft() && ea.f.f(e1.left().value()).f(e2.left().value()) || e1.isRight() && e2.isRight() && eb.f.f(e1.right().value()).f(e2.right().value())); }
5
public static <A> Equal<List<A>> listEqual(final Equal<A> ea) { return equal(a1 -> a2 -> { List<A> x1 = a1; List<A> x2 = a2; while (x1.isNotEmpty() && x2.isNotEmpty()) { if (!ea.eq(x1.head(), x2.head())) return false; x1 = x1.tail(); x2 = x2.tail(); } ...
4
private boolean isTrueSNP(VariantCandidate v) { if (v.val("max.qual.minor") > 59.699 && v.val("total.depth") <= 82.149 && v.val("allele.balance") >= 0.067) { return true; } else if(v.val("max.qual.minor") <= 60.101 || v.val("total.depth") > 60.973 || (v.val("allele.balance") > 0.048 && v.val...
7
private static void writeOperator(Writer output, AuOperator.Descriptor desc) throws IOException { if(desc == IntArithmetic.intAdd) { output.write("ia"); }else if(desc == Products.productType) { output.write("prt"); }else if(desc == Products.product) { output.write("prv"); }else if(desc instanceof Li...
7
public void append(double d[], int n) throws Exception { double tmp[]; int ln = n * stride; if (d == null || d.length == 0 || n <= 0) { throw new Exception("DataSet: Error in append data!"); } if (data == null) data = new double[increment]; // Copy the data locally. if (ln + length < data.length...
8
private static boolean isCompatible(Class[] paramTypes, Class<?>[] actualTypes) { if (actualTypes.length != paramTypes.length) return false; boolean found = true; for (int j = 0; j < actualTypes.length; j++) { if (!actualTypes[j].isAssignableFrom(paramTypes[j])) { ...
7
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
1
public static void main(String[] args) { int a = 10, b = 20; if( a > b ) { System.out.println(a + ">" + b); } else if ( a < b ) { System.out.println(a + "<" + b); } else if ( a == b ){ System.out.println(a + "==" + b); } }
3
@Override public void mouseExited(MouseEvent e) { if(e.getSource()==recordBut){ recordBut.setIcon(recordIcon); }else if(e.getSource()==playBut){ playBut.setIcon(playIcon); }else if(e.getSource()==stopBut){ stopBut.setIcon(stopIcon); }else if(e.getSource()==saveBut){ saveBut.setIcon(saveIcon); }el...
6
public void setProperty(String property, String newvalue){ try { r = new BufferedReader(new FileReader(config)); } catch (IOException e1) { } String temp = ""; try { p = new PrintWriter(config); while((temp = r.readLine()) != null){ if(!(temp.startsWith(property))){ p.println(temp); } ...
4
public int getID() { return IDNumber; }
0
protected Element createTransitionElement(Document document, Transition transition) { Element te = super.createTransitionElement(document, transition); MealyTransition t = (MealyTransition) transition; te.appendChild(createElement(document, TRANSITION_READ_NAME, null, t.getLabel())); ...
0
public GuiView() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); setLocationRelativeTo(null); try { GuiView.b...
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int nCases = Integer.parseInt(in.readLine().trim()); for (int nCase = 0; nCase < nCases; nCase++) { String word = in.readLine().trim()...
4
public synchronized BufferedImage getSample(int width, int height) { BufferedImage sample = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); Graphics2D sampleEditor = sample.createGraphics(); sampleEditor.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ...
7
public static Rule_DOT parse(ParserContext context) { context.push("DOT"); boolean parsed = true; int s0 = context.index; ArrayList<Rule> e0 = new ArrayList<Rule>(); Rule rule; parsed = false; if (!parsed) { { ArrayList<Rule> e1 = new ArrayList<Rule>(); int s1 =...
7
private void addInvoice() { Scanner sc = new Scanner(System.in); int orderID; boolean success; int testOrderID; do { success = true; System.out.println("Please enter the order id (enter -1 to exit):"); testOrderID = inputInteger(); ...
6
public void addAtIndex(int data, int position){ if(position == 1){ addAtBegin(data); } int len = size; if (position>len+1 || position <1){ System.out.println("\nINVALID POSITION"); } if(position==len+1){ addAtEnd(data); } if(position<=len && position >1){ Node n = new Node(data); Node cur...
7
private void outputTotalsRow( int groupLevel, ICalculator[] calcForCurrentGroupingLevel){ if(distribOfCalculatorsInDataColsArray.length != dataCols.size()){ //TODO: improve throw new IllegalArgumentException("dataRows and distributionOfCalculators arrays should have the same length"); ...
9
public void setSink(boolean isSink) { this.isSink = isSink; }
0
public void initSoldats() { // Ajout des Héros heros = new Armee(NB_HEROS); for (int i=0; i<=NB_HEROS; i++){ int x, y; do{ x = (int) (Math.random() * (IConfig.LARGEUR_CARTE / 2)); y = (int) (Math.random() * IConfig.HAUTEUR_CARTE); ...
5
public static boolean userName(String username){ if(username.matches("[a-zA-Z](\\w){8,29}")) return true; return false; }
1
private boolean isSocialNetworkAccountAdded(SocialNetworkAccount socialNetworkAccount) { for(int i=0; i<addedSocialNetworkAccountCount; i++) { SocialNetworkAccount addedSocialNetworkAct = socialNetworkAccounts[i]; //If they have the same account type ... if(addedSocialNetworkAct.getSocialNetworkAccoun...
4
public void test_constructor() { BaseDateTimeField field = new MockPreciseDurationDateTimeField(); assertEquals(DateTimeFieldType.secondOfMinute(), field.getType()); try { field = new MockPreciseDurationDateTimeField(null, null); fail(); } catch (IllegalArgumentEx...
3
protected void onSelectionChanged(DiagramFieldPanel field) { if(field.isSelected()) queryBuilderPane.sqlBrowserViewPanel.addSelectList(field.getQueryTokenColumn()); else queryBuilderPane.sqlBrowserViewPanel.removeSelectList(field.getQueryTokenColumn()); packFields(); ...
8
public boolean exists() { return question != null && answer != null; }
1
@Override public boolean supportsComments() {return true;}
0
private void handleExitButton(ExitButton button) { // Check input if (button == null) throw new IllegalArgumentException("ExitButton can't be null"); // Check a tile is currently selected if (selectedTileButton != null) { Point2D from = selectedTileButton.getBoardPosition(); // Ca...
7
private static void caratInputValidator(){ while (!validInput) { try { System.out.print("You selected to search by carat. Please enter a carat: "); caratInput = actionInput.nextDouble(); System.out.println("You entered: " + caratInput); validInput = true; if(data1.is...
3
public static void main(String[] args) { try { File file = new File("C:\\Users\\Collin\\Downloads\\words.txt"); Scanner readFile = new Scanner(file); int maxLines = 0; int answer = 0; String wordList = readFile.nextLine(); String[] words; words = wordList.replace("\"","").split(","); for (int ...
7
@Override protected void updateDefinition(final JeksCell cell, final String cellAddress, final String value) { if (currentTierOneHeader == TIER_ONE_HEADERS.FIELDS) { if (columnHeaderMapping.get(CodecUtils .getColumnFromString(cellAddress)) == TIER_TWO_...
9
public void update(Game game) { super.update(game); if(age == 2) { for(Vector2d u : Types.BASEDIRS) { if(game.getRandomGenerator().nextDouble() < spreadprob) { int newType = (itype == -1) ? this.getType() : itype; ...
4
private void drawTableGrid() { Object[][] cellData = new Object[0][headers.length]; tableGridModel = new DefaultTableModel(cellData, headers) { private static final long serialVersionUID = 880033063879582590L; public boolean isCellEditable(int row, int column) { ...
9
@Override public void emettre() throws InformationNonConforme { Float[] tabFloat = new Float[informationRecue.nbElements() * nbEch]; for (int i = 0; i < informationRecue.nbElements(); i++) { if (informationRecue.iemeElement(i)) { for (int j = i * nbEch; j < (i + 1) * nbEch; j++) tabFloat[j] = ampMax; ...
6
public static void matchListings(List<Listing> listings, final Map<String, Product> productMap, final ManufacturerLookup manufacturerLookup) { System.out.println("Matching listings..."); // // single threaded implementation // for(Listing listing : listings) { // // // match product name // String prod...
8
public void set(String key, Object value) { datas.put(key, value); }
0
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
6
private void checkSymbols(char[] symbols) { if (symbols.length != this.numTapes) { throw new InvalidTransitionException("Specified " + symbols.length + " symbols for " + this.numTapes + " tapes."); } //Check that the symbol is valid for (char symbol : symbols) { boolean isContained = false; for (char ...
5
public static void main(String[] args) throws IOException, TechnicalException { MPSConnector mps = new MPSConnector(9302); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Write to test, f.e. \"0\". \"q\" to quit."); String s =in.readLine(); ...
3
private MethodST method() throws UnexpectedTokenException { StringBuilder signature = new StringBuilder(); this.expect(PLUS, MINUS, TILDE); signature.append(this.getToken().data); this.nextToken(); this.expect(IDENT); String type = this.type(); signature.append(type); this.expect(LPAREN, IDENT); if(t...
8
public javax.sound.midi.Sequence createMidiSequence() { javax.sound.midi.Sequence s = null; try { s = new javax.sound.midi.Sequence(javax.sound.midi.Sequence.PPQ, 16); int channelNum = 0; for (Track t : tracks) { int tickCount = 0; javax.sound.midi.Track javaTrack = s.createTrack(); javaTrack.a...
7
public void setSeatType(long value) { this._seatType = value; }
0
@Override public void actionPerformed(ActionEvent e) { String s = promptUserForDirectory(); if (s == null) { return; //if user pressed cancel or close do nothing. } try { //todo tidify? //das magic registryHandler.setPathEnvironmentVari...
3
protected void notifyObservers() { if(observers != null) for(PositionChangedObserver o : observers) { o.update(this); } }
2
public static void main(String[] args) throws Exception { processConfigFile(args[1]); try { maxFiles = Integer.parseInt(args[2]); } catch (Exception e) { maxFiles = Integer.MAX_VALUE; } try { SpotSigs.minIdf = Double.parseDouble(args[3]); System.out.println("minIdf=" + SpotSi...
9
public void run() { int seconds = 0; while(connected) { try { Thread.sleep(1000); } catch(InterruptedException e) { // nah } seconds = (seconds + 1) % idleTimeout; if(seconds == 0) { if(idle) { try { disconnect(); } catch(IOException e) { connected = false; ...
5
private static boolean isValid(int m, int d, int y) { if (m < 1 || m > 12) return false; if (d < 1 || d > DAYS[m]) return false; if (m == 2 && d == 29 && !isLeapYear(y)) return false; return true; }
7
@Override public boolean apply(Course course) { final int startTime = (startHours.getSelectedIndex() % 12) * 60 + startMinutes.getSelectedIndex() * 10 + startAmPm.getSelectedIndex() * 12 * 60; final int endTime = (endHours.getSelectedIndex() % 12) * 60 + endtMinutes.getSelectedIndex() * 10 + endAmPm.getSelectedInd...
8
private static Trajectory secondOrderFilter( int f1_length, int f2_length, double dt, double start_vel, double max_vel, double total_impulse, int length, IntegrationMethod integration) { if (length <= 0) { return null; } T...
8
public int numberSelected() { return selected.size(); }
0
public void remove(Integer start, Integer end){ Interval toRemove = new Interval(start,end); List<Interval> affected = new LinkedList<Interval>(); for (Interval currInterval : sched){ if (!currInterval.isDisjoint(toRemove)) affected.add(currInterval); if (currInterval.start > toRemove.end) break;...
6
public Graph randCreator(){ int p = 0,q = 0; g = new Graph(true); g.addColumn("id", int.class); g.addColumn("value", String.class); g.addColumn("source", String.class); g.addColumn("Edgetype", String.class); //This loop is used to create the nodes of the random graph. //We ensure same ...
6
private static int diff_commonOverlap(String text1, String text2) { // Cache the text lengths to prevent multiple calls. final int text1_length = text1.length(); final int text2_length = text2.length(); // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { return 0; } // Truncate...
9
@Override public String getColumnName(int column) { switch(column) { case 0 : return "Nota"; case 1 : return "Nama"; case 2 : return "Pewangi"; case 3 : return "Berat"; case 4 : return "Masuk"; case 5 : return "Ambil"; case 6 ...
8
public void resume_egress() { ++resume_egress_count; }
0
void addMapChanges(PropertyMapImpl propertyMap, ConstMap mapChanges) { HashMap map = (HashMap) changes.get(propertyMap); if (map == null) { map = new HashMap(); changes.put(propertyMap, map); } for (ConstMapIterator iterator = mapChanges.constIterator(); iterator.atEntry(); iterator.next()...
7
public static void main(String[] args) throws JFAuthenticationException, JFVersionException, Exception { final ITesterClient client = TesterFactory.getDefaultInstance(); client.setSystemListener(new ISystemListener() { @Override public void onStart(long processId) { LOGGER.info("onStart"); } @Ove...
2
private void externalReflection(Atom a) { double x0 = getX(); double x1 = getX() + getWidth(); double y0 = getY(); double y1 = getY() + getHeight(); double radius = a.sigma * 0.5; if (a.rx - radius < x1 && a.rx + radius > x0 && a.ry - radius < y1 && a.ry + radius > y0) { switch (RectangularObstacle.borde...
8
public void setInstalledDirectory(File targetDirectory) { if (installedDirectory != null && installedDirectory.exists()) { try { FileUtils.copyDirectory(installedDirectory, targetDirectory); FileUtils.cleanDirectory(installedDirectory); } catch (IOExceptio...
7
public boolean isComplete() { int size = board.length; for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) { if (x == size - 1 && y == size - 1 && board[x][y] == -1) return true; if (board[x][y] != y * size + x + 1) return false; // Bail early } } return fals...
6
public void Render() { for(int x = 0 ; x < this.mapImageWidth ; x++ ) { for(int y = 0 ; y < this.mapImageHeight ; y++) { this.tileMap[x + y * this.mapImageWidth].render((x << this.shiftCount) + xOffset , (y << this.shiftCount) + yOffset); } } }
2
private boolean checkFieldLineWinn(int lineNumber, char cellValue){ boolean checkLine = true; for (int i = 0; i <= fieldSize - WIN_NUMBER_OF_CELLS ; i++){ checkLine = true; for(int j = i; j < i + WIN_NUMBER_OF_CELLS; j++){ if( field[j][lineNumber] != cellValue) ...
4
public static void combineMonomeConfigurations() { Configuration configuration = Main.main.configuration; if (configuration.getMonomeConfigurations() == null) { return; } @SuppressWarnings("unchecked") HashMap<Integer, MonomeConfiguration> tmpMonomeConfigurations = (HashMap<Integer, MonomeConfigurati...
7
public boolean setParallelJobProbabilities( double uLow, double uMed, double uHi, double uProb) { if (uLow > uHi) { return false; } else if (uMed > uHi-1.5 || uMed < uHi-3.5) { return false; } else if(uProb < 0.7 || uProb > 0.95) { return false; } this.uLow = uLow; ...
5
private static void createFoldSVM(String[] args) throws FileNotFoundException, IOException { String orgDataFile = args[1]; int noFolds = Integer.parseInt(args[2]); BufferedReader br1 = new BufferedReader(new FileReader(orgDataFile)); ArrayList<String> posData = new ArrayList<String>(); ...
9
@SuppressWarnings("rawtypes") public List<Claim> getClaims(String actionType, String team) { List<Claim> claimList = new ArrayList<Claim>(); Element claimE; Claim claim; if (actionType.equals(CLAIMSUBCLAIM)) { List<Claim> claimList1 = getClaims("claim", team); List<Claim> subclaimList = getClaims("subcla...
9
int multiply(int a, int b) { boolean negative = false; // Sign if (a < 0) { negative = !negative; a = sub(0, a); } if (b < 0) { negative = !negative; b = sub(0, b); } int res = 0; while (b != 0) { if ((b & 1) == 1) { res = add(res, a); } a <<= 1; b >>= 1; // 算术移位 } return n...
5
void send(String data) { if (socket == null) { println("Cannot operate with a null socket"); return; } PrintStream output; try { output = new PrintStream(socket.getOutputStream()); output.println(data); } catch (IOException e) { println("An exception has occured while sending to the socket"); ...
2
public ChannelEvent nextEvent() throws ChannelError, InterruptedException { ChannelEvent event; ChannelError error; if ((error = resetError()) != null) { throw error; } if ((event = resetEndEvent()) != null) { return event; } eve...
3
public Bitstream(InputStream in) { if (in==null) throw new NullPointerException("in"); in = new BufferedInputStream(in); loadID3v2(in); firstframe = true; //source = new PushbackInputStream(in, 1024); source = new PushbackInputStream(in, BUFFER_INT_SIZE*4); closeFrame(); //current_frame_number = -...
1
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this); if ((clipboardContent != null) && (clipboardContent.isDataFlavorSupported(DataFlavo...
3
public static boolean writeWikiSample(BookmarkReader reader, List<UserData> userSample, String filename, List<int[]> catPredictions) { try { FileWriter writer = new FileWriter(new File("./data/csv/" + filename + ".txt")); BufferedWriter bw = new BufferedWriter(writer); int userCount = 0; // TODO: check en...
9
private static <T> List<T> filterToList( Iterable<T> source, Filter<T>... filters ) { List<T> dest = new ArrayList<T>(); for ( T each : source ) { filter_loop: for ( Filter<T> filter : filters ) { if ( filter.accept( each ) ) { dest.add( ea...
3
public static int getIndexSelectedValue(String name){ switch(name){ case "USD": System.out.println("USD"); return 2; case "CLP": System.out.println("CLP"); return 1; } return 0; }
2
public Node getEntrance(Node head){ if(head == null || head.next == null) return null; Node slow = head.next; Node fast = head.next.next; while(slow !=null && fast.next != null && fast != slow){ slow = slow.next; fast = fast.next.next; } if(slow == null || fast.next == null) return null; ...
8