method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5584fec9-b1ee-4a14-81dc-4ad991e69e16
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (label.equalsIgnoreCase("tenki")) { if (sender instanceof Player) { Player player = (Player) sender; if (args.length == 0) { player.sendMes...
6242064f-de71-4d99-8df0-26262f578e4a
1
public double getOut4Organism() { double out = 0.0; for (int i = 0; i < outNodes.size(); i++) { out += outNodes.get(i).getPotential(); } return out; }
d6403a8c-2041-4166-9a08-3169e03ddeaf
8
public static Object newProxyInstance(Class<?> superclass, Class<?>[] interfaces, InvocationHandler h) throws ExportException { HandlerAdapter ha = new HandlerAdapter(h, superclass, interfaces); if (interfaces != null) { Class<?>[] source = interfaces; interfaces = new Class<?>[...
cbb44f5d-6c69-4efc-b25e-ff61056c21df
1
public boolean isOfType(Type type) { return (type.typecode == TC_INTEGER && (((IntegerType) type).possTypes & possTypes) != 0); }
45e0ee85-b9f5-4f76-8cdc-7e4b588e784f
6
@Override public void keyPressed(KeyEvent e) { //Uso del teclado para la traslacion //tecla z y x para la traslacion en 'Z' int keyCode = e.getKeyCode(); switch( keyCode ) { case KeyEvent.VK_UP: transformaciones.Traslacion(0, -15, 0); brea...
e75be24a-ab5a-44f5-9af2-078590a01fc1
0
@Override public T pull() throws InterruptedException { updateLength(-1); return taskSupplier.pull(); }
93f8c678-db40-4c7d-90c6-56969c081031
4
private boolean isMoving(){ if(state == StateActor.UP || state == StateActor.DOWN || state == StateActor.LEFT || state == StateActor.RIGHT){ return true; } else return false; }
943409da-b99d-49f3-b5e5-d4ddd9bdbf0f
6
public String displayGW_ShoreMMSI (List<Integer> mm,int totalDigits) { StringBuilder sb=new StringBuilder(); int a,digitCounter=0; for (a=0;a<6;a++) { // High nibble int hn=(mm.get(a)&240)>>4; // Low nibble int ln=mm.get(a)&15; // The following nibble int followingNibble; // Look at the next...
cf5658ba-dfe7-4b6f-afa0-c7a45a5500e8
0
public String getHost() { return host; }
24d183d1-0a3a-48c8-a89b-c7c1d35f020f
4
public void mousePressed(int button,int x,int y){ if(xpos >= Button.GAME_WIDTH/2-replayWidth/2 && xpos <= Button.GAME_WIDTH/2+replayWidth/2 ){ if(ypos >= Button.GAME_HEIGHT/2+100 && ypos <= Button.GAME_HEIGHT/2+100+replayHeight){ mousePress = true; } } }
743e39f2-5559-4689-8c2c-2df7a17541bd
2
private String removeDuplicateCharacters(String s) { Set characters = new HashSet(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { Character c = new Character(s.charAt(i)); if (characters.add(c)) sb.append(c.charValue()); } return sb.toString(); }
ad475be8-9646-493c-980b-923de2d543d8
3
public void set_field( String section, String field, String data ) throws NullPointerException { Hashtable s; if( section== null || field == null ) throw new NullPointerException(); s = (Hashtable) sections.get(section); if(s==null) { s = new Hashtable(); sections.put(section, s); } s.put(field, data...
11514170-a5d3-4a7d-bcea-a732c8d79861
8
public static int prevenirHostChanged(String id) { // previens une machine que cette machine remplace m pour le paquet d'id // Id SocketChannel clientSocket; Paquet p = Donnees.getHostedPaquet(id); int placeToModify = p.power; LinkedList<String> table = new LinkedList<String>(); for (int i = 0; i < Globa...
f6558e68-752a-472a-860f-c419d99472fd
1
public Builder electricCharge(int receivedElectricCharge) { if (receivedElectricCharge < 0) { this.population = -receivedElectricCharge; return this; } this.electricCharge = receivedElectricCharge; return this; }
001dcffb-c66b-4a77-9628-2ae64dc2734b
1
public void testGetPartialConverterRemovedNull() { try { ConverterManager.getInstance().removePartialConverter(NullConverter.INSTANCE); try { ConverterManager.getInstance().getPartialConverter(null); fail(); } catch (IllegalArgumentException ex...
b67f82d2-aa57-4178-9623-86f889dda52b
1
public void addUnsearchList(String url){ if(url.length() > DB_URL_CHAR_SIZE){ log.warn("URL size is too long: "+url); return; } // List<SqlParameter> sqlParamList = new LinkedList<SqlParameter>(); // sqlParamList.add(new SqlParameter(Types.VARCHAR, url)); // sqlParamList.add(new SqlParameter(Types.VARCHAR,...
53231d73-6bbd-48d4-8a71-bbd0316c0985
1
public void start() { if ( isRunning ) return; run(); }
e1735985-f110-4a54-a8bb-1ee53ca1878d
5
@Override public void validate() { if (platform == null) { addActionError("Please Select Platorm"); } if (location == null) { addActionError("Please Select Location"); } if (iphone.equals("Please select")) { addActionError("Please Sele...
ecc5d585-e150-4596-9469-c2c1f394e17a
0
public EventService(EntityManager manager, EntityTransaction tx){ this.manager = manager; this.tx = tx; }
6d23b178-48a3-4bde-a1a7-4737a31bfd0c
5
public void installAndMakeSelecatable(AID packageAID, AID appletAID, AID instanceAID, byte privileges, byte[] installParams, byte[] installToken) throws GPException, CardException { if (installParams == null) { installParams = new byte[] { (byte) 0xC9, 0x00 }; } if (instanceAID == null) { instanceAID = a...
dd047b88-80bf-40de-a1b9-bb1c74e5dadc
3
static public void testStorage(Storage storage, String fileName) throws IOException { int entryCount, uniqueWordsCount; long start, end; BufferedReader br = new BufferedReader(new FileReader(fileName)); String line = br.readLine(); String[] words; Matcher matcher; ...
7be02123-f041-4f08-a870-0259dbb1e660
7
@Test public void onlyBishopOnFilledBoard() { Map<String, Integer> figureQuantityMap = new HashMap<>(); figureQuantityMap.put(BISHOP.toString(), 2); Chessboard chessboard = Chessboard.newBuilder(figureQuantityMap).withDimension(DIMENSION_6).withBishop().build(); assertThat("all elem...
bdd69e36-55aa-4213-a614-051a74640ba2
5
public static boolean removeContactAcct(String contactID,int index){ boolean status = false; AddressBook addressBook = Helpers.getAddressBook(); if (addressBook == null) { System.out.println("removeContactAcct - addressBook returns null"); return false; } ...
bc5765eb-c709-4a5b-ba16-da14f7db4b0d
1
public void actionPerformed(ActionEvent event) { Date now = new Date(); System.out.println("At the tone, the time is " + now); if (beep) Toolkit.getDefaultToolkit().beep(); }
ecefccfe-d2a4-4dbe-b998-aa3cdd3de0f6
9
public void updateDirection() throws BadMoveException { if(start.row == end.row && start.column == end.column) { throw new Board.BadMoveException("Bad move initialized"); } if(start.column == end.column) { if(start.row > end.row) { direction = Direction.UP; } else { direction = Direction.DOWN;...
920b2cf4-ba0c-4d03-89b5-3b1b0d8ede8b
2
public String getName() { if (isFree) { return ("FREE"); } if (isInvalid) { return ("INVALID-CONSTANT"); } return name; }
d1604cbe-c2b4-4b3a-96b1-5f5c332683db
7
protected void loadReactionlikeEvent2CatalystActivity() { String name = "ReactionlikeEvent_2_catalystActivity"; String fileName = dirName + name + ".txt"; if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'"); int i = 1; for (String line : Gpr.readFile(fileName).split("\n")) { // P...
abb7dda0-e9cd-4262-9d35-b030e8811fc9
8
private String prepareConfigString(String configString) { int lastLine = 0; int headerLine = 0; String[] lines = configString.split("\n"); StringBuilder config = new StringBuilder(""); for(String line : lines) { if(line.startsWith(this.getPluginName() + "_COMMENT")) { String comment = "#" + l...
9b9adfef-d54f-48fb-9075-e4b5ea66e3fd
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); Outliner.documents.addOutlinerDocumentListener(this); Outliner.documents.addDocumentRepositoryListener(this); setEnabled(false); }
ef5eae25-c9ad-41d1-8f31-b7f41558b626
0
public void setTaintWrapper(ITaintPropagationWrapper taintWrapper) { this.taintWrapper = taintWrapper; }
d3c04b2f-7266-439f-94ea-2526c7f43200
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://down...
875fc830-fccb-4491-b61c-716200dda5f3
3
@Test public void canGetProductsByCost() { ProductModel addedProduct = ProductModel.builder("Night Visions", 1) .description("Imagine Dragons").cost(149).rrp(400).build(); List<ProductModel> products = null; boolean isInResult = false; try { addedProduct = new ProductModel(insertProduct(addedProduct), ...
0ec297b2-a729-42ae-b438-9ba450ff6ed8
9
public static final Method getMethod(final Class clazz, final String methodName, Class... parameters) { parameters = parameters == null ? new Class[0] : parameters; Method method = null; try { method = clazz.getMethod(methodName, parameters); } catch (NoSuchMethodException e)...
7a95fe90-4c6a-449a-88bb-98bbe2a813ba
8
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // redraw paint method. so it doesnt draw on // top of each other mainMenuObj.menuMessage(mx, g); if (currentMode.equals(mode1)) { // MainMenu mainMenuObj.paint(g, hoverLeft); } else if ...
ed3f7916-e0ca-4c6e-910f-586bdf03521f
9
@Override public void doAction (String o) { setVisible(false); dispose(); }
85b7f084-2177-4345-83ce-43a4a9ae4a5b
2
public ExtraLife(int courtWidth, int courtHeight, int INIT_X) { super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth, courtHeight); try { if (img == null) { img = ImageIO.read(new File(img_file)); } } catch (IOException e) { System.out.println("Internal Error:" + e.getMessage()); ...
54b5b185-7df1-445a-aca3-0fc7768c9c38
4
public void filter(List<String> guessHistory, List<String> feedbackHistory) { Iterator<String> it = possibleAnswer.iterator(); int i = feedbackHistory.size() - 1; if (i >= guessHistory.size()){ return; } String gs = guessHistory.get(i); String fb = feedbackHistory.get(i); for (int coun...
cd841d5f-d977-42d2-8a38-938b5067037e
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 157 // do, line 159 v_1 = cursor; lab0: do { // call prelude, line 159 if...
5dedb543-ba48-430e-8bc6-29d4aa77be70
5
public ArrayList<Meld> getInitialMeld() throws Exception{ ArrayList<Meld> melds; int score; melds = getGroups(); melds.addAll(getRuns()); melds = findLargestSubset(new ArrayList<Tile>(this.getTiles()), new ArrayList<Tile>(), melds); if(melds == null) return null; score = 0; for(int i=0; ...
868b803d-fa53-4de9-9680-764f6bf06ef8
4
public void updateCraftingResults() { for(int var1 = 0; var1 < this.inventorySlots.size(); ++var1) { ItemStack var2 = ((Slot)this.inventorySlots.get(var1)).getStack(); ItemStack var3 = (ItemStack)this.inventoryItemStacks.get(var1); if(!ItemStack.areItemStacksEqual(var3, var2)) { ...
c2f24557-edf6-4da9-9f18-ec5904ad5a3e
9
public Object[][] updateAccountManagerTableView() { Collection<User> users = instance.getUsers(); //calculate number of rows int rows = 0; for (User user : users) { if (!user.isActiveCustomer()) { rows++; } for (Account acc : user.getAc...
ff63dd39-8ca7-4e5b-be23-3c54c118a6a2
6
public String getFullHouse() { String stt = "0"; //search for a set (three of a kind) and a pair. if found, we probably have a winner :D if (cards[0].getRank() == cards[1].getRank() && cards[1].getRank() == cards[2].getRank()) { if (cards[3].getRank() == cards[4].getRank()) { ...
4c52cde8-fb66-4a48-9693-ee24458c4cbf
1
public static DeckArrayManager getDeckArrayManager() { if (instance == null) { instance = new DeckArrayManager(1); log.debug("[DeckArrayManager] inside getter() method"); } return instance; }
2cdb48a1-8313-471b-b537-15ed1f21862c
0
public Product(Character productCode) { prices = new TreeMap<Integer, BigDecimal>(); this.productCode = productCode; }
80e85c00-70ae-44d7-8283-c7655a10ae93
3
@Test public void testQueueUsage() { Thread testThread = new Thread(pipelinedFDstage); //A thread running through pipelined FDstage. testThread.start(); //Start the thread, which runs until interrupted (execute stage is responsible for terminating int opcodeValue = 0; for (int i = 0; i < 10; i ++) { //There a...
29314ca4-d1e8-49b2-aa03-35c920780ae2
5
public static String longToName(long longName) { try { if (longName <= 0L || longName >= 0x5b5b57f8a98a5dd1L) return "invalid_name"; if (longName % 37L == 0L) return "invalid_name"; int i = 0; char name[] = new char[12]; while (longName != 0L) { long n = longName; longName /= 37L; n...
64d9c9fd-4261-436e-b7dc-c41d730df2af
1
@Override public boolean colides(SchlangenKopf head) { if (!super.colides(head)) { head.die(); return true; } return false; }
dcf31c72-7ced-494e-92a6-c693dfeb3afe
3
@Override public void dispose () { super.dispose(); if (this.conn != null) { try { if (this.conn.isClosed() == false) { this.conn.close(); } } catch (SQLException ex) { LOGGER.warning("Unable to clo...
5c7988b9-4bae-4c87-9f6c-46d8c2a3eff8
8
public static void processAction(Object container,SwingWorkerInterface swingworker){ ActionProcessor processor=new ActionProcessor(); try{ try { if(!swingworker.proceed()){ return; } processor.initCompsAndValidate(container,swingworker); ...
9a60d249-f37a-4090-a088-974d1297ab4e
7
public double teaTypeInfo() { double result = 0.0; double blackTeaSize = 0.0; double blackGood = 0.0; double blackBad = 0.0; double whiteTeaSize = 0.0; double whitekGood = 0.0; double whiteBad = 0.0; double greenTeaSize = 0.0; double greenGood = 0.0; double greenBad = 0.0; for (Tea t : trainingSet...
07356e6e-d669-42c9-83d4-71e6209eaa17
5
public final void setProgress(int var1) { if(!this.minecraft.running) { throw new StopGameException(); } else { long var2; if((var2 = System.currentTimeMillis()) - this.start < 0L || var2 - this.start >= 20L) { this.start = var2; int var4 = this.minecraft.w...
7410ebbb-1947-4a8c-b69b-0f4e9133405f
5
public String longestPalindrome(String s) { // Start typing your Java solution below // DO NOT write main() function if (s == null || "".equals(s.trim())) return s; for (int i = s.length() ; i >= 1 ; i-- ) { for (int j = 0; j < s.length() - i + 1 ; j ++ ) { if (checkPal...
4f230cc1-d67f-47b8-bde6-8f27062aec4c
5
public static void main(String[] args) { int input=1000000; ArrayList<Integer> prime=new ArrayList<Integer>(); prime.add(3); prime.add(5); int primes= 3; //long start=System.currentTimeMillis(); long startTime = new Date().getTime(); boolean temp=false; for(int i=7; i<=input; i+=2){ ...
2937aac8-3ce2-4ce3-9e79-bad36e04a74a
4
public Diff getDifForDirection() { Diff diff = null; switch (this) { case UP: diff = createDiff(0, -1); break; case DOWN: diff = createDiff(0, 1); break; case RIGHT: diff = createDiff(1, 0); break; case LEFT: diff = createDiff(-1, 0); break; } return diff; }
ef01f60d-11d9-494b-91ae-cc3a90a75bf1
2
private BasicComboBoxRenderer dayRenderer() { BasicComboBoxRenderer renderer = new BasicComboBoxRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(...
08f7bc14-5ae8-409a-b04f-d95ff2ac6476
2
@SuppressWarnings({ "rawtypes", "unchecked" }) public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException{ resp.setContentType("text/html"); resp.setCharacterEncoding("utf-8"); Cache cache = null; try { CacheFactory cacheFactory = CacheManager.getInstance() .getCacheFactory(...
afacba47-53b1-4768-b3e4-ab23a36211a1
0
public static List<Appointment> findByDay(long uid, long day) throws SQLException { List<Appointment> aAppt = new ArrayList<Appointment>(); // once aAppt.addAll(Appointment.findOnceByDaySpan(uid, day, day)); // daily aAppt.addAll(Appointment.findDailyByDaySpan(uid, day, day)); // weekly aAppt.addAll...
40ae7453-b2ca-4112-87f3-c08b7f7ccc53
7
public void commit() { // if you haven't committed anything in 10,000 cycles, simulator is probably deadlocked --> kill SimAssert.check(((currCycle - lastCommitCycle) < 10000), "Deadlock! no commits in 10K cycles", currCycle); for (int i = 0; i < machineWidth; i++) { ...
e3ea5e1d-f4a8-4578-987a-4aa349729400
5
public static void main(String[] args){ for(int i= 20*19; i<Integer.MAX_VALUE; i++){ //will go through all integers until it reaches an answer boolean goodnum = true; //if it is the right number for(int j = 20; (goodnum == true) && (j>0); j--){ //goes through from 20 to 1 and tests if it is divisible, if not, i...
d1d806eb-41a9-4af7-83b7-52e19fd529ba
7
public Set<Map.Entry<Byte,V>> entrySet() { return new AbstractSet<Map.Entry<Byte,V>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TByteObjectMapDecorator.this.isEmpty(); } public bool...
86428b7a-eb12-48da-9c82-75bb84bcfd01
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String userId = request.getParameter("userId"); String dateTimeInMillis = request.getParameter("dateTimeInMillis"); dat...
a0c42a6f-28c8-49fc-8b28-10ba71243a34
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
193b76d9-c43e-4ace-8964-489cf16dc137
5
public void dijkstra(int s) { PriorityQueue<Edge> q = new PriorityQueue<Edge>(); q.add(new Edge(s, 0)); dis[s] = 0; while (!q.isEmpty()) { Edge cur = q.poll(); if (vis[cur.id]) continue; vis[s] = true; for (int i = 0; i < adj[cur.id].size(); i++) { Edge neigh = adj[cur.id].get(i); if (!v...
fa7a726f-c692-4e93-8f55-4850b3b7e5da
0
@Override public void init(List<String> argumentList) { lineNumber = Integer.parseInt(argumentList.get(0)); }
65c9d0a0-c706-43cb-adb4-9226b5295c2d
5
private void give(String name, int amount, String playerName, CommandSender sender){ Player player = Bukkit.getPlayer(playerName); if(!player.getName().equals(sender.getName())){ if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.give.others"))){ sender.sendMessage(ChatColor.DARK_RED + "You...
3215b0f1-72e5-4c83-9b73-7ae05c79c45f
6
private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(12, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(13, active0); return 14; } switch(curChar) { case 1...
1a953c2c-1409-47eb-aad7-f7910a2555b9
9
public static int parseString(StringBuilder sb, String[] args, int offset) { // string is empty? return an empty string if (offset >= args.length || args[offset].isEmpty()) { sb.append(""); return 1; } // first char is not a quote char? return the str...
231fa52f-3415-4fe8-a354-bec7017fa978
6
public int getScore(final List<Vraag> vragen) { int vragenGoed = 0; for (Vraag vraag : vragen) { int aantalGoed = 0; int aantalFout = 0; int jokers = vraag.getHoeveelJokersGebruikt(); for (GekozenAntwoord gk : vraag.getGekozenAntwoorden()) if (gk.isGoed()) aantalGoed++; else aantalFout++; ...
4b36fdaa-e910-49ad-9b59-f75e4b86ba44
3
public void perteTerritoire(Territoire t) { int unite = t.getNbUnite(); /* Recherche dans les bonus s'il faut défausser une unité ou non */ //if (unite > 1) { << TODO: Utilité du if ? if( !( this.bonusDefausseUnite() || (hasPower() && pouvoir.bonusDefausseUnite()) ) ){ unite--; this.nbUnite--; ...
4a5987f7-c119-478b-bcdf-4255c7a13551
3
public void mouseReleased(MouseEvent me) { Node mouseNode = getMouseNode(); if(me.getButton() == MouseEvent.BUTTON1) { target = mouseNode; System.out.println("Target pos set to: x= "+mouseNode.getX()+", y= "+mouseNode.getY()); if(start != null) { clearPath(); AStar.findPath(start.getX(), start.getY...
f229af48-1b1c-4157-bd60-b690c974c29b
8
public static void add(short magic, Class clazz) { if(magic < MIN_CUSTOM_MAGIC_NUMBER) throw new IllegalArgumentException("magic ID (" + magic + ") must be >= " + MIN_CUSTOM_MAGIC_NUMBER); if(magicMapUser.containsKey(magic) || classMap.containsKey(clazz)) alreadyInMagicMap(magic,...
9035a279-3f7e-4054-886a-c67f2a51bc5e
8
private int checkChar(char c) { switch (c) { case '{': return 1; case '[': return 2; case '\"': return 3; case '-': return 4; case '}': case ']': return 6; default: { if (Character.isDigit(c)) return 4; ...
0ce83e19-e35b-4fbb-a85f-728fe44aa582
9
public void handleCommand(Message message) { if(!conn.isConnected()) return; String body = message.getBody(); if(body.startsWith(prefix)){ body = body.substring(prefix.length()); }else{ //(message.getBody().startsWith(connection.getNick()){ body = body.substring(conn.getNick().length()); if(body.match...
c9d61a26-eceb-4176-bf16-fe54c82be62f
3
public static List<List<Integer>> subsets(int[] S) { Arrays.sort(S, 0, S.length); List<List<Integer>> res = new ArrayList<List<Integer>>(); List<Integer> n = new ArrayList<Integer>(); res.add(n); for (int i : S) { int len = res.size(); for (int j = 0; j < len; j++)...
ee259d78-2d5f-468f-a191-0cedc16fbd4f
9
private LinkedList generatecontent() { int maxitems=0; LinkedList loot = new LinkedList(); //Maximale Anzahl von Items in einer Kiste int randmax = UtilFunctions.randomizer(1, 100); if (randmax <80) { maxitems=1; } else if (randmax >...
6b0a4c10-6a1f-4508-a428-e5b03f2be343
9
public void checkActive() { if (building.requires.length > 0 && !castle.getBuildings().containsAll(Arrays.asList(building.requires))) { buy.setEnabled(false); String requirestr = "<i>Wymaga: "; Set<core.CastleBuilding> diff = new HashSet<core.CastleBuilding>(Arrays.asList(building.requires)); diff.re...
a4cb9cda-1089-471d-a5ad-beca8c820702
9
protected void createCalendarDoc() { try { /** * Clear the document. Required for date roll overs. */ document.remove(0, document.getLength()); /** * Insert the calendar header of month and year. */ document.insertString(0, MONTHS[displayMonth] + HEADER_TAB_SPACE[displayMonth] + HEADER...
cfe4763a-3599-4517-934d-0b991093ed66
8
public static Cons idlTranslateUnit(TranslationUnit unit) { { Symbol testValue000 = unit.category; if (testValue000 == Stella.SYM_STELLA_GLOBAL_VARIABLE) { return (null); } else if (testValue000 == Stella.SYM_STELLA_TYPE) { return (TranslationUnit.idlTranslateDeftypeUnit(unit)); ...
0baec564-b84d-454f-84ac-e0972769e175
4
public FileParser getParserInstance() { if (system.indexOf(UNIX_IDENTIFICATION) >= 0) { log.debug("Found UNIX identification, try to use UNIX file parser"); return new UnixFileParser(locale); } else if (system.indexOf(WINDOWS_IDENTIFICATION) >= 0) { ...
314d97d0-0cb5-4939-b3de-e62704050155
6
protected Variable getImportedVar(String name) throws UtilEvalError { // Try object imports if (importedObjects != null) for (int i = 0; i < importedObjects.size(); i++) { Object object = importedObjects.get(i); Class clas = object.getClass(); Field field = Reflect.resolveJavaField(clas, name, false/...
3985b7da-1c10-4b17-a884-6c8ba1773e9c
2
public String nextLine() { if(console) advance(); String ret = line; st = new StringTokenizer(""); //force advance to readLine if(!console) advance(); return ret; }
a55170a0-1d72-4aa5-bca1-967cf712f231
4
@Override public void display( GLAutoDrawable glautodrawable ) { long now_time = System.currentTimeMillis(); float dt = (now_time - last_time)*0.001f; last_time = now_time; //System.out.println(dt); // Clear The Screen And The Depth Buffer GL2 gl2 = glautodrawable.getGL().getG...
7aaf8f2e-a170-47ad-a288-e306d77b1fa7
9
private Collection getMimeTypes2(Collection mimeTypes, InputStream in) { try { if (mimeTypes.isEmpty() || mimeTypes.size() > 1) { Collection mimeTypes2 = getMimeTypesInputStream(in = new BufferedInputStream( in)); if (!mimeTypes2.isEmpty()) { if (!mimeTypes.isEmpty()) { // more than one ...
94c11755-8371-42ca-a2df-cdf4777c5edc
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://down...
2f21f05e-278e-4f8a-b06e-ec5acb9af408
5
@Override public void paint(Graphics g) { g.setColor(super.getBackground()); g.fillRect(0, 0, this.getWidth(), this.getHeight()); if(autosize) { if(mouseOver) { if(!selected) { Image tmp = this.icon_hover.getImage().getScaledInstance(this.getWidth(), this.getHeight(), java.awt.Image.SCALE_SM...
7b7ba559-2298-49e5-9ace-79c63683b212
7
public List getBundles() { clearResultMetaInformation(); List bundles = new ArrayList(); StringBuffer result = new StringBuffer(); GetMethod get = new GetMethod(apiEndpoint + DeliciousConstants.BUNDLES_ALL); get.setDoAuthentication(true); try { httpResult = ...
b6cc48e4-1dd8-4dac-931f-8eabc118a2d0
0
@Test public void testBubbleSort(){ sortSelection.load(array,null,null); sortSelection.run(); assertArrayEquals(array, arrayActuals); }
5f64e1f2-63b7-4fcd-8030-024230a4db6a
7
public boolean updateEmptySpace () { int i = 0, j = 0; /* Checks the size */ if (size.equals("9x9")){ /* Uses nested for loops to check if a space is empty */ for (i = 0; i < 9; i++) { for (j = 0; j < 9; j++) { if (entries[i][j].getText().equals("")) { entries[i][j].setText(sol...
8750d8be-024f-463c-9e1f-25c285b3078d
0
public PersonAssignation() { setModal(true); setIconImage(Toolkit.getDefaultToolkit().getImage(PersonAssignation.class.getResource("/InterfazGrafica/Images/Search48.png"))); setTitle("BUSQUEDA"); setBounds(100, 100, 450, 235); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(...
0a60b6bd-f541-4990-a052-f28e0e8a5815
1
public static LoLRTMPSClient returnClient(String region) throws NullClientForRegionException { if(PvPNetClients.get(region) == null) { throw new NullClientForRegionException("No client for region " + region + " available.", region); } int numClients = PvPNetClients.get(region).values().size(); LoLRTMPSCli...
b738f5d9-375a-45c9-bda7-eb75e683c5cc
5
public ListNode deleteDuplicates(ListNode head) { if(head == null){ return null; } ListNode superHead = new ListNode(0); superHead.next = head; ListNode previous = superHead; ListNode check = head; boolean dup = false; while(check.next !=null){...
41bc117d-2376-4d71-83c2-af7f0b39b706
5
private boolean okToCreate() { boolean res = false; boolean beteckningOk = !Validate.tfEmpty(tfBeteckning) && Validate.notOverSize(tfBeteckning); boolean checkDates = Validate.startdateBeforeReleasedate(calStartDate.getDate(), calReleaseDate.getDate()); if (beteckningOk) { i...
83f9f2ea-9467-4d4e-8ea2-483446cecf45
1
public void pass() throws IllegalStateException{ if(passedBefore) throw new IllegalStateException(); board.pass(); this.passedBefore = true; }
9a1c69ac-de1b-4144-bd4d-6db144d77f3d
8
public static double compute(double a, double x) throws ArithmeticException { if (x <= 0 || a <= 0) return 1.0; if (x < 1.0 || x < a) return 1.0 - Igam.compute(a, x); final double MACHEP = 1.11022302462515654042E-16; final double MAXLOG = 7.09782712893383996732E2; double big = 4.503599627370496e15; ...
20b382cf-968c-486b-bc66-3b4220860bc3
7
public MainFrame(boolean silent){ super(AlienFXProperties.ALIEN_FX_APPLICATION_NAME); try{ lockApplication(); }catch(Exception e){ JOptionPane.showMessageDialog(null, AlienFXTexts.ALREADY_RUNNING_ERROR_TEXT, AlienFXTexts.ALIEN_FX_ERROR_TITLE_TEXT, JOptionPane.ERROR_MESSAGE); return; } ProfileMo...
e88c8729-91f6-4b7f-b077-bce5315446e2
3
public static TopQueue search(String target, String dictFile) throws IOException { BufferedReader reader; reader = new BufferedReader(new FileReader(dictFile)); TopQueue topQueue = new TopQueue(); String word; int distance; while((word = reader.readLine()) != null) ...
08b37fe5-67e7-4b5d-9736-9d3db8e6e375
8
public static void main(String[] args) throws Throwable{ int[][] res = new int[101][5]; for(int i = 1; i < res.length; i++){ res[i]=res[i-1].clone(); if(i%10<=3)res[i][0]+=(i%10); else if(i%10==4){res[i][0]++;res[i][1]++;} else if(i%10<=8){res[i][1]++;res[i][0]+=(i%10)-5;} else {res[i][0]++;res[i][2]...
8bb56cba-085e-4ce1-afde-d3dcb96fdb9b
0
public static Point invertDirection(Point direction) { Point newDirection = (Point) direction.clone(); newDirection.x *= -1; newDirection.y *= -1; return newDirection; }
9d563dd2-3542-4817-aea8-6f1a8c5a042f
7
private boolean testHypothesis() { if (hypothesis == Hypothesis.LESS_THAN && testStatistic < criticalRegion) { return true; } else if (hypothesis == Hypothesis.GREATER_THAN && testStatistic > criticalRegion) { return true; } ...
13568208-f87b-4325-88bc-1fa2b3ac9eb2
2
@Override public boolean equals(Object other) { if(other == this) return true; if(!(other instanceof Quantity)) return false; //return value == ((Quantity) other).convert(this.unit).value; //return value - ((Quantity) other).convert(this.unit).value < 0.00001; double otherVal...