text
stringlengths
14
410k
label
int32
0
9
@Override protected ContentValidator getResponseValidator() { return new ContentValidator() { /** * Validate the document. */ @Override public void validate(Document doc) throws Exception { if(doc != null) { Node payloadNode = Utilities.selectSingleNode(doc, "//dc:Payload/*[1]", XMLLabels....
4
@Override public boolean handleEvent(final Event event) { if (event.id != event.ACTION_EVENT) { return super.handleEvent(event); } else if (event.target == buttons.get("On")) { radioControl.turnOn(); return true; } else if (event.target == buttons.get("Off")) { radioControl.turnOff(); ...
9
private void close() throws Exception { try { if (_resultSet != null) { _resultSet.close(); } if (_statement != null) { _statement.close(); } if (_connect != null) { _connect.close(); } } catch (Exception e) { throw e; } } // End close
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((answer == null) ? 0 : answer.hashCode()); result = prime * result + ((answerInfo == null) ? 0 : answerInfo.hashCode()); result = prime * result + ((choice == null) ? 0 : choice.hashCode()); result = prim...
8
private List<AnswerCombination> generateAnswerCombinationList() { List<AnswerCombination> combinations = new ArrayList<AnswerCombination>(); combinations.add(generateAnswerCombination(0, 5)); combinations.add(generateAnswerCombination(1, 4)); combinations.add(generateAnswerCombination(2, 1)); combin...
0
public VueApplication(String parT, BDApplication bDApplication) { super(parT); this.bDApplication = bDApplication; initComponents(); // Initialisation des composants setSize(LARG_ECRAN, HAUT_ECRAN); setLocationRelativeTo(null);// centrage de la fenetre principale setResizable(false); // Redimensionnement in...
0
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Product product = (Product) o; return id == product.id && number == product.number && !(name != null ? !name.equals(pro...
6
static <T extends Comparable<T>> int comparePossiblyNull(T aThis, T aThat, NullsGo aNullsGo){ int EQUAL = 0; int BEFORE = -1; int AFTER = 1; int result = EQUAL; if(aThis != null && aThat != null){ result = aThis.compareTo(aThat); } else { //at least one reference is null - ...
9
public void execute(){ switch(operator) { case eOperator_Plus: this.setResult(lhs.getValue().add(rhs.getValue())); break; case eOperator_Subtract: this.setResult(lhs.getValue().subtract(rhs.getValue())); break; case eOperator_Divide: this.setResult(lhs.getValue().divide(rhs.getValue())); break; cas...
4
public static Show<CheckResult> summaryEx(final Show<Arg<?>> sa) { return showS(new F<CheckResult, String>() { public String f(final CheckResult r) { final String s = summary(sa).show(r).toString(); if (r.isProven() || r.isPassed() || r.isExhausted()) return s; else if (r.isF...
7
public static void main(String[] args) { // String path = "/Users/macbookpro/Desktop/save.wav"; // Player pl = new Player(path); // pl.play(path); // try { // Thread.sleep(5000); // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } // pl.stopP...
4
protected static void parseWallJson(String jsonResponse, String hashKeys, User user, ArrayList<Message> messagesArray) throws IOException, ParseException { JSONParser parser = new JSONParser(); JSONObject obj = (JSONObject)parser.parse(jsonResponse); JSONArray array = (JSONArray)obj.get("res...
9
private static void processMouseEvents(){ if( Mouse.isButtonDown(0)){ // FX VOLUME if( Mouse.getX() > Game.SCREEN_WIDTH/4 && Mouse.getX() < Game.SCREEN_WIDTH/4*3 && Mouse.getY() > Game.SCREEN_HEIGHT - 166 && Mouse.getY() < Game.SCREEN_HEIGHT - 146){ Options.FXVolume = (float) (...
9
public int inputSelectedAnswer() { int playerGuess = 0; String choiceS = ""; do { try { System.out.print(UserDialog.ANSWER_PROMPT); Scanner sc = new Scanner(System.in); choiceS = sc.nextLine(); checkInterruptionRequired(...
4
public List<Location> adjacentLocations(Location location) { assert location != null : "Null location passed to adjacentLocations"; // The list of locations to be returned. List<Location> locations = new LinkedList<Location>(); if(location != null) { int row = location.ge...
9
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { List<BankDeposit> deposits = ReaderFactory.getInstance() .getSAXReader().readXML(DataPath.XML_FILE); request.setAttribute("type"...
1
private void generate_symbols_list() { symbolnames = new ArrayList<>(); if(log_level >= 4) log.log(4, key, "generate_symbols_list called.", "\n"); for (Map.Entry<String, HashMap<String, Variable>> percontext : context_varname_var.entrySet()) { for (Map.Entry<String, Variable> value : percontext.getValue().e...
6
private boolean parseOptions(String[] args) { CommandLineParser parser = new GnuParser(); try { CommandLine cl = parser.parse(opts, args); // check for -help if (cl.hasOption("help")) { showUsage(); System.exit(0); } // check for -version if (cl.hasOption("version")) { show...
8
public void doMove(Move thisMove) { final Piece piece = getPiece(thisMove.getStartX(), thisMove.getStartY()); /* Supprime l'etat de danger */ // TODO VERIFIER SI CES PIECES PEUVENT ETRE EN DANGER PAR UNE AUTRE DE // MES PIECES // Générer tous les coups possibles pour cette pièce ArrayList<Move> moves = p...
8
public String getWWWAuthenticateHeader(String realm) throws IOException { StringBuilder into = new StringBuilder(); String authScheme = null; if (realm != null) { into.append(" realm=\"").append(OAuth2.percentEncode(realm)).append('"'); } beforeGetParameter(); ...
7
private boolean doesPosNumHaveList(ArrayList<Integer> posNums, ArrayList<ArrayList<ArrayList<Integer>>> posNumsListArray) { boolean dPNHL = false; for(int i=0; i<posNumsListArray.size(); i++) { dPNHL = dPNHL || doesPosNumListMatch(posNums, posNumsListArray.get(i)); } ...
3
public static Collection<BSPlayer> getPlayersIgnorers(String player) { Collection<BSPlayer> players = new ArrayList<BSPlayer>(); for(BSPlayer p: PlayerManager.getPlayers()){ if(p.hasIgnores()){ if(p.isIgnoring(player)){ players.add(p); } } } return players; }
3
private void addAttributesFrom(Map<Object, Object> attributes, String pathBase, String key) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); String path = pathBase + key + "/info.txt"; try { InputStream is = classLoader.getResourceAsStream(path); BufferedReader reader; if(is...
2
private void summariseFertilities() { final int SS = World.SECTOR_SIZE, SR = world.size / World.SECTOR_SIZE ; fertilityLevels = new float[SR][SR] ; for (Coord c : Visit.grid(0, 0, world.size, world.size, 1)) { final Tile t = world.tileAt(c.x, c.y) ; final Habitat h = t.habitat() ; float f ...
4
private int jjMoveStringLiteralDfa6_0(long old1, long active1, long old2, long active2) { if (((active1 &= old1) | (active2 &= old2)) == 0L) return jjStartNfa_0(4, 0L, old1, old2); try { curChar = input_stream.readChar(); } catch (IOException e) { jjStopStringLiteralDfa_0...
7
static public void loadToMemory(VMController vmc, File file){ try { Scanner fileScan = new Scanner(new BufferedReader( new FileReader(file))); fileScan.useDelimiter(System.getProperty("line.separator")); String command; int adress = 0; ...
7
private void cambiaLabel(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cambiaLabel if (jComboBox1.getSelectedIndex() == 0) { parcheCartel = 0; jLabel3.setText("Precio de salida $:"); jSpinner1.setVisible(false); jLabel6.setVisible(false); } if (...
6
public QuizDataObject[] createFilledQuizList(int size) { size=3; QuizDataObject [] qDBArray=new QuizDataObject[size]; qDBArray[0]=new QuizDataObject("dsad0",new String[]{""+(1)},""+2,""+0); qDBArray[1]=new QuizDataObject("dsad1",new String[]{""+(1)},""+2,""+(1)); qDBArray[2]=new QuizDataObject("asfs2",...
0
public static double calcChiasmaDist(double chromLength) { if (chromLength<=0.500) { return Double.NaN; } if (chromLength>5.0) { return 0.5; } double toler = 0.00001; double lastdiff = mdiff(chromLength,0.5); //first find initial m...
7
static final int method600(byte i, int i_1_, int i_2_) { anInt1115++; int i_3_; if (i_2_ <= 20000) { if (i_2_ <= 10000) { if ((i_2_ ^ 0xffffffff) >= -5001) { Class348_Sub40_Sub12.method3076(0, true); i_3_ = 1; } else { i_3_ = 2; ConnectionMode.method1263(true); } } else { i_...
5
@Override protected void drawSlot(int index, int xPosition, int yPosition, int l, Tessellator tessellator) { int width = 70; int height = 20; xPosition -= 20; boolean flag = _mouseX >= xPosition && _mouseY >= yPosition && _mouseX < xPosition + width && _mouseY < yPosition + heigh...
9
private static AncestorListener createAncestorListener( JComponent component, final WindowFocusListener windowListener) { final WeakReference<JComponent> weakReference = new WeakReference<JComponent>( component); return new AncestorListener() { public void ancestorAdded(AncestorEvent event) { // TODO ...
5
@Test public void test_12_displayOwnGrid(){ Grid gr = new Grid(2); boolean ok = true; Ship s = new Ship ( 2, 0,0,'v'); gr.addShip(s); char[][] board = gr.displayOwnGrid(); char[][] array = new char[2][2]; for ( int i = 0 ; i < 2 ; i++){ for ( int j = 0; j < 2;j++){ array[i][j] = Grid.DEFAULT_CHAR;...
5
public void acceptDataSet(DataSetEvent e) { if (m_splitThread == null) { final Instances dataSet = new Instances(e.getDataSet()); m_splitThread = new Thread() { public void run() { try { dataSet.randomize(new Random(m_randomSeed)); int trainSize = (int)Math.round(d...
8
private Collection<String> getCutSet(Collection<String> networkMembers) { synchronized(keychain) { ArrayList<String> cutSet = new ArrayList<String>(); // networkMembers might be bigger than keychain.keySet() // but lookups are faster in HashMaps than in Collections. for(String s: networkMembers) { if(...
2
@Override public synchronized void broadcastRecieved(Message message) { if (updateTimeStamps(message)) { System.out.println("Message Recieved: " + message.toString()); try { switch (message.getMessageType()) { case ELECTION: ...
9
@Override public String processCommand(String[] arguments) throws SystemCommandException { String guid = facade.getCurrentUserGUID(); if (guid == null) throw new SystemCommandException("No current user set."); String result = "EID\n"; Set<Election> nominations = facade.getNominations(); for...
2
public static void selectPlanesByFuelConsumption(Airline airline) { logger.info("Starting planes selection... "); while (true) { logger.info(""); logger.info("Enter Fuel Consumption (press space and enter to exit): "); Scanner scanIn = new Scanner(System.in); String s = scanIn.nextLine(); if (...
8
@EventHandler public void onReloadPlayer(PlayerCommandPreprocessEvent e){ if(e.getMessage().equalsIgnoreCase("/reload") && e.getPlayer().isOp()){ for(Player p : Bukkit.getOnlinePlayers()){ p.kickPlayer("[RP] Plugin is reloading!"); } } }
3
public static Bank getInstance() { if(bank == null) { bank = new Bank(); System.out.println("Create one Instance !"); } return bank; }
1
public void testFactory_Zone_int() { GregorianChronology chrono = GregorianChronology.getInstance(TOKYO, 2); assertEquals(TOKYO, chrono.getZone()); assertEquals(2, chrono.getMinimumDaysInFirstWeek()); try { GregorianChronology.getInstance(TOKYO, 0); fail(...
2
public double function( double i ) { switch( type ) { case 1: return function_hill_valley(i); case 2: return function_downhill(i); case 3: return function_stairs(i); default: return 0; } }
3
private void getColumns(File[] folderList) { try { addHeaders(); } catch (WriteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } for (File valuesVersion : folderList) { System.out.println("Parsing...
5
public final boolean isSyncMark(int headerstring,int syncmode,int word) { if (syncmode == INITIAL_SYNC) { sync = ((headerstring & 0xFFF00000) == 0xFFF00000); } else { sync = ((headerstring & 0xFFF80C00) == word) && (((headerstring & 0x000000C0) == 0x000000C0) == single_ch_mode); ...
6
public static DAOFactory getInstance() throws DAOException { Properties properties = new Properties(); String url; String driver; String user; String password; ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream fileProperties = classLoader.getResourceAsStr...
3
@SuppressWarnings("unchecked") @Test public void testFPL() { SimpleValidator simpleValidator = new SimpleValidator(); DateRangeBean bean; Set<?> validations; for (int minutes = -45; minutes <= (120 * 60); minutes += 5) { bean = new DateRangeBean(); bean.setDate12(util.add(new Date(), Calendar.MINUTE, mi...
7
public Message dequeueMessage(int reqClientId, int partSenderId, int queueId, boolean peek) throws MessageDequeueException, MessageDequeueQueueDoesNotExistException, MessageDequeueEmptyQueueException, MessageDequeueNotIntendedReceiverException { if (!(queueId == 0 && partSenderId == 0)) { try { ...
9
private void init(ByteBuffer buffer) { compression = buffer.get() & 0xff; int compressedSize = buffer.getInt(); if (compression == 0) { size = compressedSize; } else { size = buffer.getInt(); } this.buffer = new byte[compressedSize]; buffer.get(this.buffer); }
1
private void checkAllCollsions() { try { for (Projectile pj : projectiles) { pj.update(); for (Player pl : players) { if (!pl.getName().equalsIgnoreCase(pj.getPlayername())) { if (pl.isAlive()) { ...
6
protected void readAutoAffects(MOB mob, Session S, String name) { if(S!=null) { if(CMSecurity.isAllowed(mob, mob.location(),CMSecurity.SecFlag.CMDMOBS)) { if(name.length()>0) { final Physical P=mob.location().fetchFromMOBRoomFavorsItems(mob,null,name,Wearable.FILTER_ANY); if(P==null) ...
8
@Override public void showMafia(String[] players) { createMafiaList(30, 100); for (String player : players) { defaultPlayersList.addElement(player); } panel.revalidate(); panel.repaint(); }
1
public JSONArray getJSONArray(String key) throws JSONException { Object object = this.get(key); if (object instanceof JSONArray) { return (JSONArray) object; } throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONArray."); }
1
public static void main(String[] args) { FileInputStream fstream; try { fstream = new FileInputStream(new File("oliveOilsTEST.dat")); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; File outfile = new File("oliveOil...
8
@Override public int compareTo(AstronomicalObject o) { return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0; }
2
private String loadKeyOfOrientation(String value) { if (orientationMap == null) { orientationMap = new HashMap<String, String>(); orientationMap.put(propertiesLoader.loadProperty(Orientation.EAST.getKey()), Orientation.EAST.getKey()); orientationMap.put(propertiesLoader.loadProperty(Orientation.NORTH.getKey(...
1
public void printGraph() { for (int i = 0; i < this.vertices.size(); i++) { DirectedNode vertex = this.vertices.get(i); String edges = ""; for (int j = 0; j < vertex.edgeNodes.size(); j++) { edges += vertex.edgeNodes.get(j).data + ", "; } ...
2
public static Keyword tryRefutationProof(ControlFrame frame) { { ParallelThread parallelthread = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentParallelThread; ParallelControlFrame parallelframe = ((ParallelControlFrame)(parallelthread.topControlFrame.up)); if (parallelframe.unboundVariablesP) {...
7
public boolean equalsTo(WikiTalkPage page) { if (!page.getTitle().equals(pageTitle)) { return false; } if (!page.getPageId().equals(pageId)) { return false; } if (!page.getPageText().equals(pageText)) { return false; } if (!page...
8
public void widgetChanged(JComponent widget){ super.widgetChanged(widget); if (widget == sizeControlGroup){ controller.setSize(sizeControlGroup.getCurrentValue()); } if(widget == xControlGroup){ controller.setXposition(xControlGroup.getCurrentValue()); } ...
3
public OMGraphicList createGraphics(OMGraphicList graphics, Map<String, List> routes, String selectedRoute) { graphics.clear(); Stroke stroke = new BasicStroke(2); if(routes != null){ Iterator iterator = routes.keySet().iterator(); while(iterator.hasNext()){ ...
5
public static void main(String[] args) throws FileNotFoundException{ File f = new File("src/Median.txt"); Scanner s = new Scanner(f); while(s.hasNext()){ input.add(s.nextInt()); Collections.sort(input); size = input.size(); if(size%2 == 0){ size = size/2; size--; }else{ size = (size+1)/...
2
public int maximalRectangle(char[][] matrix) { int m = matrix.length; if (m < 1) return 0; int n = matrix[0].length; if (n < 1) return 0; int[] H = new int[n]; int[] L = new int[n]; int[] R = new int[n]; for (int i = 0; i < n; i++) R[i] = n; int res = 0; for (int i = 0; i < m; i++) { in...
8
public void calculateTemp() { if (this.constantTemp) { return; } long result = 0; long tmp = 0; for (int i = 0; i < thermalConstants.length; i++) { for (int j = 0; j < neighbors.size(); j++) { tmp += (neighbors.get(j).getTemp() * (neighbors...
3
@Override public String toString() { if (header.length() <= 0) return ""; // Delete last character, if it's a '\n' or a '\r' for (char c = header.charAt(header.length() - 1); (c == '\n') || (c == '\r'); c = header.charAt(header.length() - 1)) header.deleteCharAt(header.length() - 1); return header.toStrin...
3
private void rightChoice() { // Controlla se i Tile selezionati rappresentano una mossa valida int X0 = humanStep[0].getx(); int Y0 = humanStep[0].gety(); int X1 = humanStep[1].getx(); int Y1 = humanStep[1].gety(); if(expectedCell()){ //se la mossa e' corretta la eseguo Step temp=null; for(S...
9
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; a[0] = 1; a[1] = 2; TreeSet<Integer> occu = new TreeSet<Integer>(); occu.add(3); for (int i = 2; i < n; i++) { fo...
9
private static void readFile() { String readLine = null; try { BufferedReader bufferedReader = new BufferedReader(new FileReader( dataFile)); while ((readLine = bufferedReader.readLine()) != null) { String[] splitContent = readLine.split(" ", 2); if (splitContent.length > 1) events.add(split...
3
public void setParagraph(String paragraph) { this.paragraph=paragraph; }
0
public Author getAuthor(int id) { Author aut = null; Connection con = null; Statement stmt = null; try { DBconnection dbCon = new DBconnection(); Class.forName(dbCon.getJDBC_DRIVER()); con = DriverManager.getConnection(dbCon.getDATABASE_URL(), ...
5
public void reset() { start(); }
0
private boolean isIncluded(Color target, Color pixel) { int rT = target.getRed(); int gT = target.getGreen(); int bT = target.getBlue(); int aT = target.getAlpha(); int rP = pixel.getRed(); int gP = pixel.getGreen(); int bP = pixel.getBlue(); ...
7
public static void main(String args[]) { /* Set the Nimbus look and feel */ // <editor-fold defaultstate="collapsed" // desc=" Look and feel setting code (optional) "> /* * If Nimbus (introduced in Java SE 6) is not available, stay with the * default look and feel. For details see * http://download.ora...
6
public void setSystemConditionToAll(ElementSystem e, Condition l) { if (e == null) throw new NullPointerException("The ElementSystem is null."); if (l == null) throw new NullPointerException("The condition is null."); RETW(defaultEngineLock, () -> { systemCond...
5
private int pickFruit(float[] currentFruits) { // generate a prefix sum float[] prefixsum = new float[NUM_FRUIT_TYPES]; prefixsum[0] = currentFruits[0]; for (int i = 1; i != NUM_FRUIT_TYPES; ++i) { prefixsum[i] = prefixsum[i-1] + currentFruits[i]; } float currentFruitCount = prefixsum[NUM...
3
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); RequestDispatcher erd = request.getRequestDispatcher("WEB-INF/register_error.jsp"); SimpleDateFormat sdf = new SimpleDateFormat("dd-M-yyyy"); Date...
9
public final void startElement( final String ns, final String lName, final String qName, final Attributes list) throws SAXException { // the actual element name is either in lName or qName, depending // on whether the parser is namespace aware String name = lN...
4
private ARObject searchBooking(int resID, int reservID) { ARObject data = null; boolean found = false; try { Iterator it = booking_.iterator(); while ( it.hasNext() ) { data = (ARObject) it.next(); if (data.getReserv...
5
public void openInBrowser(String url) { try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException e) { } catch (URISyntaxException e) { } }
2
public void generateMapOutside() { /** * This method is not finished yet. It creates the outline of the map */ for (int i = 1; i <= averageSideWater; i++) { for (int k = 1; k <= i; k++) { for (int l = i; l >= k; l--) { map[i - k][i - l] = Tile.water; } } } }
3
public void mousePressed(int button,int x,int y){ click.play(); int i; i = Checkhit(); if(i < 3){ score += 1; if(buttons[i].getOvalHeight() >= buttonPress.getHeight() && buttons[i].getOvalHeight() <= buttonPress.getHeight()+5){ score += 4; } buttons[i].resetOval(); } if(hitBonus()){ score...
4
private void func_885_a(int var1, int var2, int var3, int var4) { if(!this.func_886_c(var1, var2, var3, var4)) { for(int var5 = var1; var5 < var3; ++var5) { for(int var6 = var2; var6 < var4; ++var6) { this.imageData[var5 + var6 * this.imageWidth] &= 16777215; } ...
3
public void setName(String name) { this.name = name; }
0
private final void getMP3Tag(File song) throws MP3Exception, UnsupportedAudioException { try { this.audioFile = AudioFileIO.read(song); this.tag= audioFile.getTag(); // all of these values are just stored in the attributes of this class. this.songTitle= this.tag.getFirstTitle(); this.albumName= ...
2
public void setFiglio(Albero<T> a, int pos) { if ((pos >= numMaxFigli) || (pos < 0)) throw new ArrayIndexOutOfBoundsException(); if (a == null) return; if (a.gradoMax() != gradoMax()) throw new AlberiDiversiException(); figli.set(pos, a); a.setPadre(this); a.setPos(pos); }
4
public static String[] read(String filetype) { String strFile = filetype; String[] Blah = null; int filelength=0; try { filelength = count(strFile); } catch (IOException e1) { e1.printStackTrace(); } File file = new File(strFile); if (file.exists() == true) { //Syst...
4
public static void main(String... args) throws IOException{ final int WIDTH=1000,HEIGHT=800,OCTAVES=10; final double PERSISTENCE = 0.6; final float WAVELENGTH = 100f; PerlinImage p = new PerlinImage(3, PERSISTENCE, OCTAVES,WAVELENGTH,WIDTH,HEIGHT,1.2); BufferedImage i = new BufferedImage(WIDTH, HEIGHT, Buf...
8
public synchronized BufferedImage optimized( Getter<BufferedImage> imageSource, int w, int h ) throws ResourceNotFound { //if( image.getWidth() == w && image.getHeight() == h ) return image; synchronized(this) { if( scales == null ) scales = new ArrayList<SoftReference<BufferedImage>>(); } synchronize...
6
public void visitArrayLengthExpr(final ArrayLengthExpr expr) { if (isLeaf(expr.array())) { firstOrder = true; } }
1
public String peek() { try { // System.out.println("Starting peek..."); if(stack.size() == 0) { // System.out.println("Returned empty string..."); return ""; } // System.out.println("Returned something real..."); return stack.get(stack.size() - 1); } catch(ArrayIndexOutOfBoundsException e) { ...
2
@Override public void paint(Graphics g, JComponent c) { int tabPlacement = tabPane.getTabPlacement(); Graphics2D g2d = (Graphics2D)g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING , RenderingHints.VALUE_ANTIALIAS_ON); Insets insets = c.getInsets(); Dimension size = c...
1
private static void test1() { Trace trace1 = new Trace (1, 2, 1); FESVo.putTrace(trace1); Trace trace2 = new Trace (1, 4, 1); FESVo.putTrace(trace2); Feature feature1 = new Feature (1, 2, 2); feature1.addW(10); FESVo.putHorizon(feature1); ...
6
private static void removeThreshold(List<String> otuNames, List<List<Double>> dataPointsUnNormalized, double threshold) { List<Boolean> removeList = new ArrayList<Boolean>(); for (int x = 0; x < otuNames.size(); x++) { int sum = 0; for (int y = 0; y < dataPointsUnNormalized.size(); y++) { sum +...
8
protected TokenState getNextState() { String[] line = getNextLine(); TokenState state = new TokenState(line[1], line[line.length-1].equals("yes")); for (int i = 2; i < line.length-1; i++) if (!line[i].equals("")) state.addDestination(getHeaderEntry(i), Integer.parseInt(line[i])); return st...
2
public void updateType() { if (!isVoid()) updateParentType(subExpressions[0].getType()); }
1
public void SetAveragePersonsWaitTime(Bus currentBus) { /* * Get the bus arrival time, for each person * (Bus 'firstTicks' - passenger 'firstTicks'), sum all difference, * and find the average */ //holds total wait times of persons int totalPassengerWaitT...
3
public void setAbstract(final boolean flag) { int mod = methodInfo.modifiers(); if (flag) { mod |= Modifiers.ABSTRACT; } else { mod &= ~Modifiers.ABSTRACT; } methodInfo.setModifiers(mod); this.setDirty(true); }
1
public static boolean isValidCardNum(String cardNum) { if (cardNum == null) return false; return cardNum.matches("\\d{16}") && cardNum.length() <= 16; }
2
public void combine(WindowSettings otherSettings) { windowSize = this.windowSize == null ? otherSettings.windowSize : this.windowSize; windowLocation = this.windowLocation == null ? otherSettings.windowLocation : this.windowLocation; ...
6
public static boolean verifySign(String certLoc, String signLoc, String file) throws IOException, GeneralSecurityException{ //adapted from http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/security/apisign/examples/VerSig.java @SuppressWarnings("resource...
1
void generarManzana() { boolean valido =true; do{ manzanaX = (int) (Math.random() * ancho); manzanaY = (int) (Math.random() * alto); for(int i = inicioSnake;i< inicioSnake + longSnake;i++){ int pos =i %(ancho*alto); if(manzanaX ==snakeX[i]&& ...
4