method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9c6261c0-4f02-40ad-8637-b61d7a177ca3
4
@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....
9d16f81d-903c-43e4-84c0-17b3cf6ff295
9
@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(); ...
45c8bbd9-7ccd-44c9-add4-4ed30363e64c
4
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
81e57ef0-c874-46fb-8d4a-301d69b8d526
8
@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...
677c086c-ad1c-4fca-9448-26e2a50c8804
0
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...
b58e64e2-6bea-4a78-8f61-532420670753
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...
51f14228-638d-4297-b250-befd15e5d424
6
@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...
2f719372-c26b-4d4e-a2a8-a7b7e8b66b00
9
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 - ...
dee8c735-c9e8-4fd6-9770-9b298d0081bb
4
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...
4fe1696b-784e-4e46-83ad-3692a8841930
7
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...
22a73963-dede-40b5-8f32-35e03b1e1ddd
4
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...
879b32e4-774e-4caa-ba78-ff90f13eab71
9
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...
119b1bbe-0a46-4c00-9b8c-ed8417f59104
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) (...
1db3bef9-8142-458f-afc9-26817657d5ef
4
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(...
d86e8d65-4c83-4092-9294-0c0f75443821
9
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...
7a0e025e-a34b-4ff1-85fb-357e33aa29df
1
@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"...
38c5a6e1-f770-4581-8013-e132e5f389ef
6
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...
d3564fa6-5db3-4c6a-be21-6f681ca6bfd3
8
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...
cb3c8c14-a365-4095-9f8f-556be7e0a24f
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...
1fac622a-0a33-499a-bfa3-42c669ca2d6d
7
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(); ...
316d262a-ce7b-456c-9bb4-10cad09d9364
3
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)); } ...
f58d4ec3-8f59-44c2-8651-4ec680979f65
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; }
6622011d-3aa0-4948-ab4a-f980edf24f67
2
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...
40503484-7494-433f-97d4-8dad596d25b3
4
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 ...
19fbfc7a-f9cf-4ff1-a5fb-d61ff0f2a7b6
7
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...
5721f7e0-a525-415e-b668-9bee166fa7e7
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; ...
86b4ed98-8259-428f-9eb9-9856a497eafa
6
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 (...
30c5ee2e-18c4-414a-9a47-5086c576d1cc
0
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",...
3bc70304-c45b-4697-95c9-ce993a3c94eb
7
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...
06c3ee2c-adcd-4ed9-9d64-d711f50c33c4
5
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_...
aedd1e37-7971-459f-a0cf-1f18c3556d92
9
@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...
8a220979-e373-4f23-8298-4a6cf641f126
5
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 ...
b0c025f6-5fbb-4c06-85d0-ca2b239067ee
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;...
329af103-b297-4756-a083-815a80d4c23f
8
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...
3b81bd1f-247f-4693-98af-392f0e3bd624
2
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(...
a76081dd-cd21-4713-af4b-fd9eb389c699
9
@Override public synchronized void broadcastRecieved(Message message) { if (updateTimeStamps(message)) { System.out.println("Message Recieved: " + message.toString()); try { switch (message.getMessageType()) { case ELECTION: ...
3f0c833a-35b9-4ebd-9abd-a45a0bbd16e7
2
@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...
e73ef294-aa60-4d61-bd16-1e1d38edc460
8
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 (...
def7a506-6c0d-478e-8114-8863ff282bec
3
@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!"); } } }
47773a5b-3dca-4938-b394-4ae5bc74295e
1
public static Bank getInstance() { if(bank == null) { bank = new Bank(); System.out.println("Create one Instance !"); } return bank; }
ed85f5da-90a3-4f89-8228-c7fbc3ca1ad1
2
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(...
c7f91e1b-507f-4b1b-b69d-02b4404d5065
3
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; } }
c62b54d0-9217-4bca-9901-f4212bd7ddea
5
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...
a0f2584f-42c0-411f-a941-6be1d5eebf51
6
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); ...
01c2d19d-a86a-466b-8265-893c14acf8b0
3
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...
61de2cb7-015c-43a9-bb01-4a84b3aab52d
7
@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...
bfa012be-bee0-47fa-9219-5824690b13ad
9
public Message dequeueMessage(int reqClientId, int partSenderId, int queueId, boolean peek) throws MessageDequeueException, MessageDequeueQueueDoesNotExistException, MessageDequeueEmptyQueueException, MessageDequeueNotIntendedReceiverException { if (!(queueId == 0 && partSenderId == 0)) { try { ...
fc064a98-7e5f-4963-a5cd-f6722acea263
1
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); }
aa8affe1-e8b8-4f1c-8123-982bff54b901
6
private void checkAllCollsions() { try { for (Projectile pj : projectiles) { pj.update(); for (Player pl : players) { if (!pl.getName().equalsIgnoreCase(pj.getPlayername())) { if (pl.isAlive()) { ...
36aab7db-cc32-4c4f-9fb7-73f70669659a
8
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) ...
093078d8-7172-457a-b2ed-4a35d326d111
1
@Override public void showMafia(String[] players) { createMafiaList(30, 100); for (String player : players) { defaultPlayersList.addElement(player); } panel.revalidate(); panel.repaint(); }
1af54e22-1f95-402c-917e-9076a17b7c97
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."); }
8ea858b8-029d-4333-a433-0cfe22d87fab
8
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...
d1e402f4-d770-4dae-b909-e324282a4936
2
@Override public int compareTo(AstronomicalObject o) { return (this.mass < o.mass) ? -1 : (this.mass > o.mass) ? 1 : 0; }
e057dbbc-8fa4-4276-be0d-593456ce9a02
1
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(...
e3bc415f-76d7-4cdf-a74f-bc3ae8e4a3c6
2
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 + ", "; } ...
7f582e1e-d194-4ff6-9bee-ccc3f5c1ca40
7
public static Keyword tryRefutationProof(ControlFrame frame) { { ParallelThread parallelthread = ((QueryIterator)(Logic.$QUERYITERATOR$.get())).currentParallelThread; ParallelControlFrame parallelframe = ((ParallelControlFrame)(parallelthread.topControlFrame.up)); if (parallelframe.unboundVariablesP) {...
00d49b4a-de0b-46c0-bea6-7aece81344bd
8
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...
4da68819-4f40-4b33-ac91-c0152b75f7a7
3
public void widgetChanged(JComponent widget){ super.widgetChanged(widget); if (widget == sizeControlGroup){ controller.setSize(sizeControlGroup.getCurrentValue()); } if(widget == xControlGroup){ controller.setXposition(xControlGroup.getCurrentValue()); } ...
bbbb654e-0c0c-4925-bf22-82d3ac8d9edc
5
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()){ ...
1d635f71-3af5-4551-8073-c8da966caa92
2
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)/...
e5b6f79c-351f-411b-a45b-24c6e170c5f9
8
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...
c56376e6-3922-449e-a18a-754a3fcf8be6
3
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...
173ff380-0b95-4578-9a92-f2df9d86d281
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...
caf0bcb4-7cf6-4827-8c2b-7ebec171fa7f
9
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...
74924e8e-b4a7-4536-93bd-e86ac8e0f741
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...
31d34e04-927d-417d-95a0-bd8edd6f1c0c
3
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...
5eb421da-e3b4-4d43-a72f-107ed2bac033
0
public void setParagraph(String paragraph) { this.paragraph=paragraph; }
8d9ea16c-23eb-476f-ac7e-760d860082b8
5
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(), ...
0fed6a82-067b-4640-8523-fc36922bfeb2
0
public void reset() { start(); }
a41972a3-3ea6-4fe7-b85e-a5f1f8245c0b
7
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(); ...
0ff04434-6760-4db7-9d41-52736463d5c9
6
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...
508f1866-510e-4786-96f0-38d68d5bab64
5
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...
0afc604e-b248-4eef-b32d-9958e1c68a66
3
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...
46bb27d1-6ac0-46e9-b5eb-125f50d22df4
9
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...
af0db176-2719-441e-8e02-18a7305f03ae
4
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...
d5717978-3515-418a-a92c-701e2399e02f
5
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...
96ec7b7a-6a8f-4a59-b482-0c3b5a2317eb
2
public void openInBrowser(String url) { try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException e) { } catch (URISyntaxException e) { } }
0efd55ac-4c3e-410e-873b-09373bba9d74
3
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; } } } }
b7da7025-8c34-471e-8d04-db339adbdaa1
4
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...
2038f652-0c5d-454b-9f96-16c5e4e263d8
3
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; } ...
70efaaf2-9bd8-4025-985e-a6826e7794af
0
public void setName(String name) { this.name = name; }
3186d0c8-5804-49cd-a284-c00bb0c01e9b
2
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= ...
e364f475-936b-4954-afe8-77882859c652
4
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); }
ac51428e-9407-4481-88f7-61931a48656b
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...
ffa40106-b28a-4c2e-9fb2-5a4aa4003738
8
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...
d7b1f97e-bcc2-42b2-bdeb-ed7de400cb28
6
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...
34efcfdb-8a08-4afa-b5b1-9deb4100272f
1
public void visitArrayLengthExpr(final ArrayLengthExpr expr) { if (isLeaf(expr.array())) { firstOrder = true; } }
96448271-bc3c-4273-ab28-f58bdac02bce
2
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) { ...
7a75044f-78e2-49fe-aab5-60560afc9ac8
1
@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...
88a91160-6ee8-46a5-b3cf-11ef5cbe0239
6
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); ...
a8e3b9e2-a96e-4876-9e15-c91b11478b69
8
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 +...
22eec063-cbea-4c1c-ae0e-9038e1e1f7c8
2
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...
4336821d-9b5b-4dd6-b938-34d4c06c2997
1
public void updateType() { if (!isVoid()) updateParentType(subExpressions[0].getType()); }
2f3df30f-c0da-490a-950d-44a06d4f1a1e
3
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...
4166fcaa-2335-4fff-8138-a147d4c4c496
1
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); }
8f3b64d2-58f2-4a18-8440-4fe41e2b578b
2
public static boolean isValidCardNum(String cardNum) { if (cardNum == null) return false; return cardNum.matches("\\d{16}") && cardNum.length() <= 16; }
c982e94c-c77e-4c89-95ef-26800488551c
6
public void combine(WindowSettings otherSettings) { windowSize = this.windowSize == null ? otherSettings.windowSize : this.windowSize; windowLocation = this.windowLocation == null ? otherSettings.windowLocation : this.windowLocation; ...
cd8bca8c-f0c3-436b-aed0-3df21dcab82e
1
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...
7121bccf-b961-4205-b702-047d91f3ca08
4
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]&& ...