method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3a03f20a-cb91-4384-a2f7-14e473170349
6
private void handleCores() { for (ICore c: cores){ if (c.isCreated()){ //If its created, update it. c.tick(); if (c.isDead()){ entities.removeAll(c.getParts()); } } else { // Create the core if its not created while(!c.isCreated()){ // Let the core decide if it can step to next positi...
ad978a52-c917-455c-a286-8fa50064ebce
3
public RetCode call(Core taCore, Object[] inArs, int startIndex, int endIndex, Object[] outArs, MInteger outBegIdx, MInteger outNbElement, Object ... options) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException{ Object[] parameters = new Object[inArs.length+outArs.length+options.len...
8535ee2c-fb82-4aa0-a62d-64122cd545b7
4
public String[] getTableColumns(String name) { Enumeration enumeration = allTables.elements(); while(enumeration.hasMoreElements()) { ObjectNode on = (ObjectNode)enumeration.nextElement(); if(on.getName().equals(name)) { ObjectNode[] oa= on.children(); ...
c231eda5-6803-4084-95c8-1f30ced90d77
2
public Client get(int id) { Client client = new Client(); try { PreparedStatement statement = getConnection().prepareStatement(idQuery); statement.setInt(1, id); ResultSet result = statement.executeQuery(); if (result.next()) { fillObject(c...
160bd61c-5630-41ac-a597-bd57fe3dca60
6
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String input = scanner.nextLine(); String patternString = "([\\d*]+[\\.?+\\d*?]{0,1}+\\s*)([\\*\\+\\-\\/\\:]+\\s*)([\\d*]+[\\.?+\\d*?]{0,1}+\\s*)"; Pattern pattern = Pattern.compile(patternString); ...
574842ac-3470-411b-8b35-92d39438abf5
8
public void localRun(HashSet<Long> completedUsers, TreeMap<Long, Long> parent, TreeMap<Long, Integer> local, TreeMap<Long, Integer> total) throws InterruptedException { TreeSet<Long> done = new TreeSet<Long>(); for (int i = lines.size() - 1; i >= 0; i--) { long child = lines.get(i); if(done.contai...
f30cdcd7-c099-478a-9d9f-d132bcd22018
5
@Override public void loop() { switch (step) { case 0: if(Motors.movement.isMoving()){ if(Motors.tsf.isPressed()){ Motors.movement.backward(); reset(); step++; break; } } else{ Motors.movement.forward(); } break; case 1: if(delta()>500){ Motors.movement.stop()...
62ab24da-80ff-4611-af39-da860534c13a
1
public void setEvaluative(Definition evaluative) { if (evaluative.type != ConstrainType.EXPRESSIVE) { throw new IllegalArgumentException("Evaluative must be expressive"); } this.evaluative = evaluative; }
aedc544f-3017-4daa-ba02-a05790592c46
8
public String getClassString(ClassInfo clazz, int scopeType) { String name = clazz.getName(); if (name.indexOf('$') >= 0) { if ((Options.options & Options.OPTION_INNER) != 0) { String innerClassName = getInnerClassString(clazz, scopeType); if (innerClassName != null) return innerClassName; } i...
e8c89732-a0ab-40fa-b1dd-0d82fb33bce3
5
public Student GetWithId(int StudentNum){ Collections.sort(listofsets, Student.Comparators.STUDENT_NUMBER); int front = 0; int end = listofsets.size()-1; while(true){ int middle = (end-front)/2; middle += front; ...
f5367737-9121-4ff2-9f2e-21bcc612c2f1
1
public boolean init() { try { conn = DriverManager.getConnection( "jdbc:sqlserver://localhost:1433;databaseName=STU", "lqy", ""); stat = conn.createStatement(); return true; } catch (SQLException e) { } return false; }
b7799ac9-e514-463f-9fe3-5995273e80df
2
public InvokerAction(String name,String icon,String clickedIcon, Object target, String method){ putValue(Action.NAME, name); if (icon != null){ putValue(Action.LARGE_ICON_KEY, new ImageIcon(getClass().getResource(icon))); } if (clickedIcon != null){ putValue(CLICKED_ICON,new ImageIcon(getClass().get...
b0d7471b-7011-4f5d-8a11-b6e3ba0d78c5
7
private void paintGraph(Graphics g) { if (!java.beans.Beans.isDesignTime()) { if (buffer != null) { g.drawImage(buffer, 0, 0, buffer.getWidth(), buffer.getHeight(), null); } buffer = new BufferedImage(this.getWidth(), this.getHeight(), Bu...
5df87f9e-83a2-4c6b-be53-63137c354a02
8
@Override public void mouseMoved(MouseEvent e) { Point actualMousePos = d.calculateNewPointWithZoom(new Point(e.getX() + d.viewPort.x - 320, e.getY() + d.viewPort.y - 240)); Point snappedMousePos = null; for (int i = 0; i < d.updateList.size(); i ++) { if (d.updateList.get(i) instanceof Wall) { W...
a21c776f-c125-43b7-ad26-dcd9cb8fbeed
3
@Override public String toString() { StringBuilder sb=new StringBuilder(); for(int i=0;i<filas;i++) { sb.append("{"); for(int j=0;j<columnas;j++) { if(tab[i][j]!=0) { sb.append("["); sb.append(tab[i][j]); sb.append("]"); } else sb.append(" "); } sb.append("}\n");...
4b81a35c-4f23-49ae-af74-55976549630d
5
public Placeable getClosest(Point p) { Placeable placeable = null; Placeable closestPlaceable = null; double closestDistance = 0; try { for (String key : placeables.keySet()) { placeable = (Placeable) placeables.get(key); if (!placeable.getIt...
5e752f18-c96e-4fe5-8da3-de76378738c2
4
public void setHeigth(int height) { if(rotation == 0 || rotation == 180){ if(zoom == 1){ this.height = (int) (height/zoom); }else{ this.height = (int) (height/zoom)+1; } }else{ if(zoom == 1){ this.width = (int) (height/zoom); }else{ this.width = (int) (height/zoom)+1; } } }
e0d2260b-2a07-47a8-883e-07fb420ecc69
9
protected void handleUndefinedJavaKeysymsConvert2x11(int keycode) { switch (keycode) { case KeyEvent.VK_BACK_SPACE: _keysym = X11_BACK_SPACE; break; case KeyEvent.VK_TAB: _keysym = X11_TAB; break; case KeyEvent.VK_ENTER: _keysym = X11_ENTER; break; case KeyEvent.VK_ESCAPE: _keysym = X11_E...
b3b6c237-2d2a-43c9-b86f-5dddec1f9bcb
6
public static String[] splitAndMaskWordsAroundNot(String text) { String[] words = text.split("\\s+"); //ignore words around "not" (next to, or one word away) - //G.H. (this can be much more efficient with a regex) for (int i=0; i<words.length; i++) { words[i] = stripEndingPunct...
0d4bd15a-9854-4541-ae3c-0ae97db789e3
2
RoomOutput[][] printScheme(int i, int j, Schedule s){ RoomOutput[][] r = new RoomOutput[s.schedule[0][0].rooms.length][s.schedule[0][0].rooms[0].length]; for(int k=0; k<r.length; k++){ for(int m=0; m<r[0].length; m++){ r[k][m] = new RoomOutput(s.schedule[i][j].rooms[...
83ec7fda-af9e-4c4b-a271-a189fef3a588
2
public void sendToAll(Map<String,Object> response) { for(ConnectionHandler ch : connectionHandlerThreadMap.keySet()) { Socket socket = ch.getSocket(); int i = 8; try { send(socket, response); } catch (IOException e) { ch.kill(); ...
b0d8f998-9517-4047-ae00-bf8f1f810761
0
public Multiply(Expression left, Expression right) { this.left = left; this.right = right; }
7f5d059b-1db1-4917-9dbd-a355d2827239
7
private static String stringForJSON(String input) { if (input == null || input.isEmpty()) return ""; final int len = input.length(); final StringBuilder result = new StringBuilder(len + len / 4); final StringCharacterIterator iterator = new StringCharacterIterator(input); char c...
f5268976-26b3-47df-9698-686fc52f7f38
7
@Override public boolean mutate(Mutation.Type type) { switch (type) { case REMOVE: // parent needs replacement Expression, but NumberLiteral has no // children to replace it case SWAP: case REPLICATE: return false; case COPY_TREE: return Mutation.copyExprTree(this); case COPY: // does not us...
a8dbb535-8fc1-40b4-8ff5-cf5639bb3419
4
private boolean read() { try { final URLConnection conn = this.url.openConnection(); conn.setConnectTimeout(5000); if (this.apiKey != null) { conn.addRequestProperty("X-API-Key", this.apiKey); } conn.addRequestProperty("User-Agent", Up...
75f7854b-05b6-4b05-85ec-0dba49ad7114
5
private static int[] getFirstK(double[] sum, int k) { Map<Integer, Double> m = new TreeMap<Integer, Double>(); for (int i = 0; i < sum.length; i++) { m.put(i, sum[i]); } List<Map.Entry<Integer, Double>> mappingList = null; mappingList = new ArrayList<Map.Entry<Integer...
9f9005af-c67c-43bf-8bb1-66d895806237
8
public boolean setEntriesSet(int column, boolean withBlocks) { entriesSet++; if (entriesSet == maxEntries) { setGone(true); return true; } ArrayList<Integer> indeces = new ArrayList<Integer>(); if (withBlocks && blocks != null && blocks.size() > 0) { for (Block b...
b1c6bf0f-4b68-47bb-82af-9c0fed94dbca
3
public void write2DB(Paper paper) { PreparedStatement stmt = null; //dblp-basic String query="insert into dblpbase(IndexID,Title,year,publicationVenue,Abstract) values(?,?,?,?,?)"; try { stmt=sql.conn.prepareStatement(query); stmt.setLong(1, paper.getIndex()); stmt.setString(2, paper.getTitle()); ...
9734038a-fb83-451d-90db-85ca6477d630
9
@Override public void analyseCommands(Controller controller) { controller.setState(this); cl = controller.getCommandLine(); consoleView = controller.getConsoleView(); usrHelper = controller.getUsrHelper(); if (cl.hasOption("help")) { controller.formatter.printHelp...
e639f05f-9ae9-404c-a0d9-b578a4453dee
3
public MessageAdaptor sendAndWait(MessageAdaptor request) { String id = String.valueOf(counter()); request.setId(id); messageSource.add(request); synchronized (publisher) { // logger.debug("State: " + publisher.getState()); if (publisher.getState() == State.WAITING) { logger.info(String.format("Notify...
10a8afc2-0565-4712-a840-e78561042fd4
8
public static void main(String[] args) { System.out.println("To become a Jedi, one must build a lightsaber. Let's test to see if you have constructed yours properly"); System.out.println("Testing constructors"); String color = "green"; boolean isOn = false; double bladeLength = 145; Lightsaber aSaber =...
f0a81c96-f177-4ba8-bab2-e81eeca9c544
6
private void sendMTFValues() throws IOException { final byte[][] len = this.data.sendMTFValues_len; final int alphaSize = this.nInUse + 2; for (int t = N_GROUPS; --t >= 0;) { byte[] len_t = len[t]; for (int v = alphaSize; --v >= 0;) { len_t[v] = GREATER_I...
669dab71-77cb-4da3-a8e4-4f651bc31ce5
2
public void setCalibrationFlag(boolean[] calibrate) { this.calibrationFlag = calibrate; for (int i = 0; i < this.calibrationFlag.length; i++) { if (calibrate[i]) { calibrationDataSize++; } } }
5b34c7fe-c4e2-4a82-8523-3c2109c1f86e
8
public boolean readBuffersFromNextSoundInSequence() { if (!toStream) { errorMessage("Method 'readBuffersFromNextSoundInSequence' may " + "only be used for streaming sources."); return false; } synchronized (soundSequenceLock) { if (soundSequenceQueue != null && soundSequenceQueue.size() > 0) { ...
446575c6-a75d-4c5d-b902-87a2811d3e67
0
public boolean operate(Boolean boolean1, Boolean boolean2) { boolean b1 = (java.lang.Boolean) boolean1; return !b1; }
a9be4b7b-dca9-4d9a-b080-9727c964a4e7
8
public void keyPressed(KeyEvent e) { // gestion du son d'accueil, des touches F1, ESC, F3 et F4 // gere par DevintFrameListener super.keyPressed(e); // enter = selectionner l'option if (e.getKeyCode() == KeyEvent.VK_ENTER) { // methode e rendre concrete par heritage ...
e86c0d6c-6896-4444-bbbc-caa6df5a1900
6
public static void dataStreamTest(String str){ try (DataOutputStream outputStream = new DataOutputStream(new FileOutputStream(str))){ for (int i=0;i<10;i++){ outputStream.writeByte(i); outputStream.writeShort(i); outputStream.writeInt(i); ...
b44b95a4-be21-416f-9dad-e42a0bb9e552
6
private int[] getStepping(String content, int gramAmount) { if (content.length() <= order) return new int[0]; if (gramAmount < 0) return getSequencial(content); int gramIndexLimit = content.length() - order + 1; // if gram count value is larger than the limit valu...
2106d0e5-7df2-45ee-9206-c39b2ce41523
5
public VariableDefinition getDefinition(String variableId) { VariableState state = (VariableState)(idMap.get(variableId)); // make sure this is an identifier we handle if (state == null) throw new ProcessingException("variable is unsupported: " + ...
bc0e3f6a-6fbc-458b-ab98-1b8fa97ff2a8
8
private int height(Node<T> currentNode) { if (currentNode == null) { return 0; } int maxWidth = 1; int width = 1; Node<T> tNode = currentNode; Set<T> observedNodes = new HashSet<T>(); while (tNode != currentNode.getParent()) { observedNodes...
c8cf2fe0-4906-4384-a810-edbae0c543dd
0
@Override @Transactional public Employee getById(Integer id) { Employee employee = (Employee) sessionFactory.getCurrentSession().createQuery("from Employee e where e.id=:id"). setInteger("id", id).uniqueResult(); return employee; }
18f554f0-2e36-436c-9539-7c3fa5f8ab08
8
public static String trimMultiByteCharacter(String aTarget) { char[] tTargetValue = aTarget.toCharArray(); int tLength = tTargetValue.length; int tStart = 0; int tEnd = tLength; while ((tStart < tEnd) && ((tTargetValue[tStart] <= ' ') || (tTargetValue[tStart] == ' '))) { tStart++; } while ((tStart < tE...
526effdd-58da-43e0-b2ac-e5b7b3379eeb
0
public String getRumblerName(int index) { return rumblers[index].getAxisName(); }
37eb6c02-6e74-40be-b5cf-a83346f23f0b
1
private void compute_pcm_samples9(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[9 + ...
4e8406f3-c7ab-48d4-85b3-bcf7797fbd3e
4
public void meta(MetaMessage event) { if (event.getType() == END_OF_TRACK_MESSAGE) { if (sequencer != null && sequencer.isOpen() && loop) { sequencer.start(); } } }
a80c5aa4-04ce-42e2-99d0-7e35bd4715aa
8
public final void connect(String hostname, int port) throws Exception { String buffer; _port = port; if (this.isConnected()) { throw new IOException("Already connected"); } // connect to server socket = new Socket(hostname, port); input = socket.getInputStream(); output = socket.getOutputStream();...
be543786-cf99-4a0a-8f9d-9017d1c03aea
6
public static void testCut(){ TiliaCollection collection = new TiliaCollection(200,42); HashMap<Integer, HashMap<Tilia,Integer>> correct = correctCut(collection); int count = 0; boolean isCorrectSolution = true; for (int j = 100 ; j <= 200; j+=10){ for (int i = 10 ;...
b48565e8-070f-4d12-ae8e-19193d82c1c2
3
public void playSound(int key, boolean fromUser) { // for building a new loop if (fromUser && recording) { //For fuck preload (FIX THIS SHIT) ********************************************* currentLoop.passInput(noPreload.get((Integer)key), key, currentTime); } // attempt to load audio resource ...
41049609-9c2d-4478-a4f5-bb25e03d47a8
1
public String fetchJRadioButtonValue(String componentName) { String result = null; Component comp = fetchComponent(null, componentName); if (comp instanceof JRadioButton) { result = ((JRadioButton) comp).isSelected() + ""; } return result; }
c5dc7a46-45cf-46da-90e2-2040cd91ed4a
5
void resetButtonsToPanelRules() { // Reset the buttons to support the original panel rules, // including whether the next or back buttons are enabled or // disabled, or if the panel is finishable. WizardModel model = wizard.getModel(); WizardPanelDescriptor descriptor = mod...
24a4b00c-0db5-4041-afad-00eeb92c5a5b
3
public static void main (String [] args) { Socket s = null; InputStreamReader input; BufferedReader b; PrintWriter p; String result = null; InputStreamReader stdin; BufferedReader console; String line = null; try { s = new Socket(Utils.REGISTRAR_ADDR, Utils.FAULTMNGR_PORT); s.setKeep...
7b54d433-9d5e-4a89-8f28-80ab69bcfb98
2
public static synchronized void syncUsers(UserSyncEvent sync) { usersOnline.clear(); for(NetworkSharedUser userSync : sync.getOnlineUsers()) { usersOnline.add(userSync); } if(updateListener != null) { updateListener.userSyncUpdate(usersOnline); } }
a39ee395-919a-4a6c-ad62-fbbddfe9bdf6
2
@Override public void setVY(int new_vy) { if(onPlatform || hasPower(PowerUp.FLY)) { super.setVY(new_vy * JUMP_VEL); }//You can't jump if you're not on a platform. updateStateBasedOnVelocity(); }
437d7c4f-21dc-4c2a-a20c-527d37dfb608
6
public void getTime(String playerName, DB_Timers timer, boolean allTimes) { if (allTimes) { for (Integer timerID : this.plugin.rankList.keySet()) { DB_Timers timerData = this.plugin.timers.getTimerbyID(timerID); HashMap<String, String> timerRanks = this.plugin.rankList.get(timerID); String timername = ...
0667292a-7c5a-457e-9354-39ac56083058
9
public static void read() { new Thread(new Runnable() { @Override public void run() { try { // 省份链接 String privicenUrl = Config.PROVINCE_URL; ArrayList<PersonModel> listCache = new ArrayList<PersonModel>(); int time = 0; // 循环34个省 for (int i = 1; i < 35; i++) { // 间隔1...
af75ae35-7ba8-43f7-8ffd-82874f75d51e
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); Dijkstra G = new Dijkstra(20000); int nTest = Integer.parseInt(in.readLine().trim()); for (int tt = 0; tt < nTest; tt++) { int[] v =...
f849397f-742e-48f8-8b33-5544e42132e0
5
static final Class174 method1943(boolean bool, int i) { anInt3294++; Class174 class174 = ((Class174) Class318_Sub1_Sub2.aClass60_8732.method583((long) i, -78)); if (class174 != null) return class174; byte[] is = Class59_Sub2_Sub1.aClass45_8670.getChildArchive(1, i); class174 = new Class174(); if...
2a154330-c75c-417c-a326-cf1c4f4db27d
2
public static boolean readBoolean() { if (isEmpty()) throw new RuntimeException("Reading from empty input stream"); N--; boolean bit = ((buffer >> N) & 1) == 1; if (N == 0) fillBuffer(); return bit; }
33065d5e-373a-41bd-b0d0-0ef2061fbfaf
8
public void connect(TreeLinkNode root) { if(root==null) return; TreeLinkNode cur = root; TreeLinkNode prev = null; TreeLinkNode leftMost = null; while(cur!=null) { if(cur.left!=null) { if(prev != null)prev.next = cur.left; prev = cur.left; if(leftMost =...
f994b615-1bb7-4c6c-8803-5a01ffe41b10
7
public final static int convertFromRoman(final String s) { int x=0; while(s.startsWith("Y")) x+=1000; for(int i=ROMAN_HUNDREDS.length-1;i>=0;i--) if(s.startsWith(ROMAN_HUNDREDS[i])) { x+=(100*(i+1)); break; } for(int i=ROMAN_TENS.length-1;i>=0;i--) if(s.startsWith(ROMAN_TENS[i])) { ...
b541f3ed-8f39-4154-a4df-47783ed737e3
0
@Override @Transactional public <T extends PersistentObject> T create(T entity) { return em.merge(entity); }
71693e6a-2f74-44fc-81a5-7b9be6f6ed68
0
private void initKeyMapping() { keyMapping.put(KeyEvent.VK_UP, SchlangenKopf.DIRECTION_UP); keyMapping.put(KeyEvent.VK_DOWN, SchlangenKopf.DIRECTION_DOWN); keyMapping.put(KeyEvent.VK_RIGHT, SchlangenKopf.DIRECTION_RIGHT); keyMapping.put(KeyEvent.VK_LEFT, SchlangenKopf.DIRECTION_LEFT); }
0ebd2d64-c740-481f-9bbe-3a7c8b8fcb88
2
private void mapGameAction(int code, boolean isMouseMap) { if (inputManager.getMaps(action).size() >= 3) { inputManager.clearMap(action); } if (isMouseMap) { inputManager.mapToMouse(action, code); } else { inputManager.mapToKey(action, ...
f5095f4a-ff58-4521-89e1-edd04706eade
0
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { throw new RuntimeException(); }
d9c40fcf-3539-444b-bda7-b0925d505ec1
4
public String getUUIDString(String playerName) { if (dataConfig.getConfigurationSection(accountHolder) == null) { return null; } for (String uuid: dataConfig.getConfigurationSection(accountHolder).getKeys(false)) { String oldPlayerName = getPlayerName(uuid); if (uuid != null && oldPlayerName.equal...
1db0a59c-c722-44ce-8cb5-c7dcc43a6952
1
public char readSymbol() throws IOException { int i = this.fileReader.read(); if (i == -1) { end = true; } return (char) i; }
263c116d-848a-4e1d-85eb-4da91ea15c8e
2
public void save() { try { sql.Query.save(this); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }
26e96f2d-d960-4ee5-bdcb-37291817c035
2
public String preparedString(Key k){ if(k instanceof PrivateKey){ return "PrivateKey"; }else if(k instanceof PublicKey){ return "PublicKey"; }else{ return "AESKey"; } }
f6f43ba8-0e59-4468-8453-c718ca786f7d
7
public static String parseString(byte[] data, int offset, int length) { if(data.length < offset + length) throw new IllegalArgumentException("Not enough bytes for Reading an String of length " + length + " at " + offset); StringBuilder b = new StringBuilder(""); boolean endReached...
6d5a0f66-af9d-47b6-844a-fa04a166f64a
6
private void jump2() { int tiempo_salto = 1; while (true) { int y = Juego.jFlappy.getLocation().y; int x = Juego.jFlappy.getLocation().x; try { Thread.sleep(getVelocidad()); if (!isDetenerSalto2()) { tiempo_salto = t...
a67070e2-6109-4e37-9538-807ab1e4fb7e
3
private static void writeInt(BitOutputStream out, int numBits, int value) throws IOException { if (numBits < 0 || numBits > 32) throw new IllegalArgumentException(); for (int i = 0; i < numBits; i++) out.write((byte)(value >>> i & 1)); // Little endian }
8c6fd30f-a03c-411b-baee-5ff192a1dd35
6
public LogGildedAltarGUI(LogGildedAltar script) { this.script = script; options = this.script.options; initComponents(); setTitle(script.getName() + " v" + script.version()); setMinimumSize(new Dimension(480, 550)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); for (Path p : Path.values()) { if (...
827ac89d-2eba-4318-8eea-c48fd4a97e61
4
public static void main(String[] args) { int max = 0; for (int i = 100; i < 1000; i++) { for (int j = 100; j < 1000; j++) { if (isPalindrome(i * j) && i * j > max) { max = i * j; } } } System.out.println(max); }
371a6afd-db88-402d-894b-00c7446f870a
8
public static void main(String args[]) { String ret = "\n"; String testcase = "" + "{ SAMPLE : OK }" + ret + "program coverage(output);" + ret + "var Sum, V: integer;" + ret + "" + ret + "procedure printData;" + ret + " begin" + ret; if(args.length > 0) { try{ File file = n...
d135b372-717a-40aa-ba9a-27f1e9e32d6c
0
public List<AIAsset> getAssetsList() { return assetsList; }
70e8cb7b-3694-41ee-bafb-540f2c23316e
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
9b10a1d0-7cd4-47d5-9d41-a75902706f6b
1
public ArrayList<Integer> Shuffle(ArrayList<Integer> x){ Random rng = new Random(); for (int i=numOfCards-1;i>0;i--) { //Fisher-Yates Shuffle implementation int index = rng.nextInt(i+1);//picks random number from 0 to i+1 (or i since last num isn't included) int temp = x.get(index); // stores the item at th...
0c232aaa-4995-450f-b2d5-0fe1b2901adf
7
public MasTaskEnvironment(InputStream input) throws IOException { try (Scanner scan = new Scanner(input)) { // read first line Scanner currLineScanner = new Scanner(scan.nextLine()); numberOfAgents = currLineScanner.nextInt(); numberOfCycles = currLineScanner.nextInt(); LeftoverPenalty = currLineScan...
e777e656-93b4-4dee-9e2b-a6987c17da49
5
public void dfs(String s, String tmp, ArrayList<String> res, int count) { //have 4 parts. if count is 3, means have 3 parts valid already. check the rest, if valid, return. //if not, do nothing and back track if (count == 3 && isValid(s)) { res.add(tmp + s); return; ...
d8a9e1e3-403e-4dfa-b97d-f1060d5ba340
2
@Override public int hashCode() { int hash = 3; hash = 71 * hash + (this.quantity != null ? this.quantity.hashCode() : 0); hash = 71 * hash + (this.currency != null ? this.currency.hashCode() : 0); return hash; }
c2c08f36-937d-49e5-8716-e94a17114fd1
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...
9c0b750d-c7a2-45b8-b313-0f52a68c6d52
1
private static void reading() throws JAXBException, FileNotFoundException { JAXBContext ctx = JAXBContext.newInstance(Rss.class); Unmarshaller unmarshaller = ctx.createUnmarshaller(); Marshaller marshaller = ctx.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); Rss rss = (Rs...
adbf2434-7e53-4819-9dfd-e358f41cfdf9
6
private void sendReport(Player player, String[] args) { if (!player.hasPermission("buildingplanner.send")) { player.sendMessage("You do not have permission to use plan areas"); return; } if (args.length < 2) { player.sendMessage("You need to specify a player to send this report to"); return; }...
b5bdce23-0d3b-4d06-8a78-dcdad1091b67
1
protected String[] getFontStyleNames() { if (fontStyleNames == null) { int i = 0; fontStyleNames = new String[4]; fontStyleNames[i++] = ("Plain"); fontStyleNames[i++] = ("Bold"); fontStyleNames[i++] = ("Italic"); fontStyleNames[...
014e7694-33b3-459f-8d56-e81059af0fba
6
public void setOptionFloatValue(EnumOptions enumoptions, float f) { if (enumoptions == EnumOptions.MUSIC) { this.musicVolume = f; this.mc.sndManager.onSoundOptionsChanged(); } if (enumoptions == EnumOptions.SOUND) { this.soundVolume = f; this.mc.s...
afa82c4f-135b-413f-b8fe-5792f9bfa6d3
2
public void cancel(int id) { // Remove from pending invokes (only affects join()) pendingInvokes.remove(id); // Check if we've already received the result if (peekResult(id) != null) return; // Signify a cancelled invoke by giving it a null callback else { callbacks.put(id, null); // Check for...
86a804d2-a0fb-48b5-96a1-332f055f2946
8
public String toStringAllDetails() { String info = (this.type + "-section named '" + this.name + "', id (" + this.reference + ") on level: " + level + "; full path: " + this.getPath() + "\n\t- "); info += ("definition: \t" + this.definition + "\n"); info += ("\n\t- repository: ...
bf11bdc8-385a-437e-881d-936f0f7e0d54
1
public int getNumberOfChildren() { if (children == null) { return 0; } return children.size(); }
6668cae6-e5c5-47e2-985c-2c7cbcb438bd
0
public String getDescription() { return description; }
795bfa1a-28c2-48bf-9829-f51fd9306845
8
protected void updateCapabilitiesFilter(Capabilities filter) { Instances tempInst; Capabilities filterClass; if (filter == null) { m_FilterEditor.setCapabilitiesFilter(new Capabilities(null)); return; } if (!ExplorerDefaults.getInitGenericObjectEditorFilter()) tempInst = n...
915b26f8-5897-47ac-bea6-cd7fdb94dfa4
0
public Tile getNeighbor(Tile t, Direction d) { return getTile(t.y + d.getY(), t.x + d.getX()); }
a1efebed-874f-4341-977d-caf68a662952
7
private static void printCurrentContext() { if(loop.size() == 0) { System.out.println(NO_MESSAGES); return; } int count = 0; //stop condition is either 3 or the loop size if loop has < 3 elements int stop = (loop.size() < 3) ?...
adec8d00-450e-41ab-a9b4-a9632e5ce4a8
8
public Instance cleanse(Instance before) throws Exception{ Instances insts = before.relationalValue(1).stringFreeStructure(); Instance after = new Instance (before.numAttributes()); after.setDataset(m_Attributes); for(int g=0; g < before.relationalValue(1).numInstances(); g++){ Instance datum = ...
af4a5af5-a59d-4e6d-a529-bac1c66b80fd
2
public InputImage(String path) throws FileNotFoundException{ origImg = new ImagePlus(path); if(origImg.getProcessor() == null){ throw new FileNotFoundException(); } //adjImg = new ImagePlus(path); //rescale the intensity of the image so that min is 5.1 and max is 249.9 //Bounds are chosen so that w...
1c2fffad-8acf-4882-b539-748ecb1521cd
4
void floyd() { int rows = d.length; for (int k = 0; k < rows; k++) for (int i = 0; i < rows; i++) for (int j = 0; j < rows; j++) if (d[i][j] > d[i][k] + d[k][j]) { d[i][j] = d[i][k] + d[k][j]; } }
3b3642f3-e318-4f87-8692-c14ebb18f0c2
8
public static double activacion(byte funcion, double potencial){ double activacion=0.0; if(funcion == 1){ /** Funcion de activacion(lineal): Identidad */ activacion = potencial; } else if(funcion == 2){ /** Funcion de activacion(sigmoidea): Logaritmo Sigmoidal */ activacion = 1.0 / (1.0 + (Math.pow(Math....
78d2a3bb-506d-4461-896e-89b3feadd171
3
private int readID3v2Header(InputStream in) throws IOException { byte[] id3header = new byte[4]; int size = -10; in.read(id3header,0,3); // Look for ID3v2 if ( (id3header[0]=='I') && (id3header[1]=='D') && (id3header[2]=='3')) { in.read(id3header,0,3); int majorVersion = id3header[0]; int revisi...
1b02c176-9f9c-4779-a348-a2c65cf54728
2
public void draw(Graphics2D g2) { player.draw(g2, xOffset, yOffset); for (int w = 0; w < walls.size(); w++) { Wall wall = (Wall) walls.get(w); wall.draw(g2, xOffset,yOffset); } for (int wz = 0; wz < entities.size(); wz++) { Updateable en= (Updateable)entities.get(wz); en.draw(g2, xOffset, y...
74cbda03-5189-45b7-b095-34f7b7a9e5f2
1
public static String privateChat(String channel, String nickname) { PacketBuilder buffer = new PacketBuilder(SendOpcode.MODULE.getValue()); buffer.writeByte(0x00); buffer.writeByte(0x00); buffer.writeByte(0xAE); buffer.writeString(channel, true, false); for (int i = 0; i < 2; i++) { buffer.writeString(...
0182dfc4-b01b-42cc-ac9c-b2e7ec1d68f3
1
public boolean isSet(int index) { /* * Similar to before where the mask is zeroes except where the testing is, only this time we and * if we don't get zero it is turned on. */ if(index >= 32){ return false; } int mask = 0x1; mask = mask << index; return ((mask & bits) != 0x0); }