method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8a31ac6a-c9cd-4f0f-850a-785d7c5e0cd0
2
private Document constructXml(Document xml) { Element rootElement = xml.createElement(VCNConstants.ROOT); rootElement.setAttribute(VCNConstants.XML_FORMAT_VERSION_ATTR_NAME, VCNConstants.XML_FORMAT_VERSION); addOption(rootElement, VCNConstants.TREE_FONT_SIZE, VCNTreeItem.getFontSize()); addOption(rootElement, V...
82dc9929-0ecf-4aba-bf9b-524577f0df36
2
@Override public List<Hotel> load(Criteria criteria, GenericLoadQuery loadGeneric, Connection conn) throws DaoQueryException { int pageSize = 50; List paramList = new ArrayList<>(); StringBuilder sb = new StringBuilder(WHERE); String queryStr = new QueryMapper() { @Overr...
5f7a29ba-4203-477e-bff0-3f204e2b4563
1
public void setCompany(String company) { company = company.trim(); if ( company.isEmpty() ) { throw new RuntimeException( "'company' should not be empty" ); } this.company = company; }
3be6ee94-1987-482c-8266-12b7c440f6ed
5
public static String getKeyWithRightLength(final String key, int keyLength) { if (keyLength > 0) { if (key.length() == keyLength) { return key; } else { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-...
5a7f4bf2-593e-40c6-a484-6f965513a724
5
private String summarize(CourseRec course) { StringBuffer buf = new StringBuffer(); buf.append("<b>" + course.getName() + "</b><br/>"); buf.append(course.getId() + " <b>" + course.getStatus() + "</b><br/>"); buf.append(course.getCategories() + "<br/>"); buf.append(course.getUniversities() + "<br/><br/>"); A...
fb6b1c6b-80d9-4c27-9387-322e796d8b19
9
public static void useCrystal(final Player player, int id) { if(!(player.getControlerManager().getControler() instanceof FightKiln) || player.getTemporaryAttributtes().get("FightKilnCrystal") != null) return; player.getInventory().deleteItem(new Item(id, 1)); switch(id) { case 23653: //invulnerability ...
fe0e1443-231e-4926-9110-04d9f03a5d82
5
public static String toString(Object array) { if (array == null || !array.getClass().isArray()) { return String.valueOf(array); } else { int length = Array.getLength(array); if (length == 0) { return "[]"; } else { int capacity = length << 3; if (capacity < 16) { capacity = 16; } ...
90e1eae8-a4b6-437d-b4b9-b97d586a2aa8
0
public double getX() { return x; }
8b1ddb2a-825f-40f6-9633-159dd7b17516
0
@Override public void play(Note note) { System.out.println("DoubleBass.play() " + note); }
c551569e-ab84-42e1-9ee0-03ddee07008a
5
public void readLine(String line) { if (line.length() < 32) { while (line.length() < 32) { line += "0"; } } int begin = 0; int end = 2; for (int row = 0; row < 4; row++) { for (int col = 0; col < 4; col++) { // int val = 0; String hexVal = line.substring(begin, end); hexVal = "0x...
4000eafc-f023-452a-ac52-5286d01ad5cb
2
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((originID == null) ? 0 : originID.hashCode()); result = prime * result + ((targetID == null) ? 0 : targetID.hashCode()); return result; }
2587ff52-c69a-4a21-822b-24adca72458e
5
public void createProjectile(Actor source, String im, int sp, Point start, Point end, boolean f, boolean p, boolean dt, int d) { if (gameController.multiplayerMode != gameController.multiplayerMode.CLIENT) { Projectile projectile = new Projectile(this, registry, source, im, sp, start, end, f, p, dt,...
fdc44271-120c-460b-b7a4-ab3e00eae142
7
public synchronized void startMusicPlayerWithSelectedStream() { //get the selected Stream Stream[] stream = getSelectedStream(); if (stream != null) { //Test if a relay stream is running and connect to them //else will connect to stream address directly if(stream[0].getStatus() && stream[0].connectTo...
588e1b04-c808-4a61-ab8b-f51b5c45ed98
5
private void addBundleInput( DCPackage input) { if(input.getPayload().length != DCPackage.PAYLOAD_SIZE) { throw new InputMismatchException("The provided input has length " + input.getPayload().length + " but should be " + DCPackage.PAYLOAD_SIZE); } else { int round = input.getNumber(); if(round != currentR...
c6b94f4a-a5f6-4c2b-8ff8-19c2b815d709
9
static private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0, 0L); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(6, active0, 0L); return 7; } switch(curChar) { ...
b7d255c1-202b-4298-b598-d3d1e1a1b5b4
0
public void setExpYear(int expYear) { this.expYear = expYear; }
8d5a30dc-85ab-4aa1-a84c-6ccf1121e119
1
public static void hqxInit() { /* Initalize RGB to YUV lookup table */ int r, g, b, y, u, v; for (int c = 0x1000000 - 1; c >= 0; c--) { r = (c & 0xFF0000) >> 16; g = (c & 0x00FF00) >> 8; b = c & 0x0000FF; y = (int) (+0.299d * r + 0.587d * g + 0.114d * b); u = (int) (-0.169d * r - 0.331d * g + 0.500...
dbdf3102-e731-4462-81b1-08c024c275a1
6
private void disconnect() { if(clientStatus == 2) { clientStatus = 3; try { socket.close(); } catch(IOException ioexception) { logMessage("IO exception trying to disconnect."); } ...
93b1b06e-3984-4919-8a6b-4e71d65cb7ed
1
public synchronized void getMessage(int num) throws InterruptedException { notify(); while (num!=0) wait(); //caso FIFO DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); Date date = new Date(); /* NodosListaCola aux = cola.PrimerNodo; while (aux....
47a4b3d8-9401-4e06-880e-4f2ed28391a9
1
Iterators(List<List<T>> lists) { this.lists = lists; for (List<T> list : lists) { currentIndexes.add(-1); } }
71dca96b-6430-4319-bdb1-113aed61f266
5
private Point haveBeenCalc(Point start, Point dest, double dev) { Iterator<Side> it = history.iterator(); while (it.hasNext()) { Side temp = it.next(); if (temp.getStart() == start && temp.getDest() == dest || temp.getStart() == dest && temp.getDest() == start) { it.remove(); return temp.getMi...
d3216c8c-550b-46c1-b1cd-c0be21cb3cc2
1
public void generateWorld(Generator g) { if (blocks == null) blocks = new Block[width*height*depth]; g.generate(this); }
b11fb56a-23d8-42f2-b45b-86917c0b386a
8
boolean canBeDug (boolean isJumping) { if (isJumping==false) { for (int row = 0; row < 9; row ++) { for (int col = 0; col < 9; col ++) { if (hasBeenDug[col][row]==false) { return true; } } } return false; } else { for (int row = 0; row < 9; row++) { int initialCol; if (ro...
cb7e66df-1449-4910-aeb0-75f1ab138734
9
* @return true if the move was successful, false otherwise */ private boolean viPreviousWord(int count) throws IOException { boolean ok = true; if (buf.cursor == 0) { return false; } int pos = buf.cursor - 1; for (int i = 0; pos > 0 && i < count; i++) { ...
e813bedb-0379-431f-9f86-5b960f1fab7b
0
public Integer getId() { return id; }
055faab9-895f-4796-8998-78a2eb5eb712
9
private String getCharBuffer() { StringBuilder lb=new StringBuilder(); int a; // 1 or 1.5 stop bits if (stopBits<2) { for (a=0;a<7;a++) { if (inChar7[a]==true) lb.append("1"); else lb.append("0"); if ((a==0)||(a==5)) lb.append(" "); } } // 2 or more stop bits else { for (a=0;a<8;a++) ...
22db66e1-c921-4ac7-8961-57bdd6c3bf40
7
public JMenuBar createGUI(boolean useFrame) { useFrame = true;//tmp mainMenu = new JPopupMenu(); JMenuBar mb = null; if (useFrame) { mb = new JMenuBar(); } JMenu m = new JMenu("File"); if (useFrame) { mb.add(m); } else { ...
e14fdee5-2609-4d5e-98de-0138670e6bed
2
public boolean equals(Transaction other) { return ( to == other.getTo() && from == other.getFrom() && amt == other.getAmt()); }
cd11077e-7660-47fd-84a6-78aa80fdd279
5
private void updateShots() { for (int i = 0; i < shotList.size(); i++ ) { Shot shot = shotList.get(i); shot.Update(); Rectangle shotRectangle = new Rectangle(shot.x, shot.y, shot.shotWidth, shot.shotHeight); if (tank2.tankArea.intersects(shotRectangle)) { ...
8e14f698-8b8a-43f3-9d29-b23bc1532968
9
public ColorChooserDemo(SwingSet2 swingset) { // Set the title for this demo, and an icon used to represent this // demo inside the SwingSet2 app. super(swingset, "ColorChooserDemo", "toolbar/JColorChooser.gif"); // Create the bezier animation panel to put in the center of the panel. ...
befaa483-6307-47b3-b666-597030d0cb96
3
public static String lrs(String s) { int N = s.length(); String[] suffixes = new String[N]; // form suffixes for(int i = 0; i < N; i++) suffixes[i] = s.substring(i, N); // sort Arrays.sort(suffixes); // find longest repeated substring using lcp String lrs = ""; for (int i = 0; i < N - ...
76ccfc97-a652-42ae-a67c-fe910dd90d5e
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((genre == null) ? 0 : genre.hashCode()); long temp; temp = Double.doubleToLongBits(price); result = prime * result + (int) (temp ^ (temp...
f3ea48c4-ae9e-4cf2-b0ab-f9d208c8367b
8
public WavDecoder(InputStream stream) throws Exception { // checks if the stream is valid if (stream == null) throw new IllegalArgumentException("Input stream must not be null"); inputStream = new EndianDataInputStream(new BufferedInputStream(stream, 1024 * 1024)); if (!inputStream.readStringFrom4Byte...
b9838768-d05b-4a56-b1fa-f70ece166ae0
6
public boolean merge(final Subroutine subroutine) throws AnalyzerException { boolean changes = false; for (int i = 0; i < access.length; ++i) { if (subroutine.access[i] && !access[i]) { access[i] = true; changes = true; } } if (subroutine.start == start) { for (int i = 0; i < subroutine.callers...
59ebd24d-367b-46c9-8549-63b031d485f1
1
@Test public void testIncompleteUAString() { try { Browser browser = Browser.parseUserAgentString("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.21.11 (KHTML, like"); browser.getVersion("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/531.21.11 (KHTML, like"); ...
28b55064-0e02-4b2c-834c-825c75ce78ab
7
public static URL normalizeURL(URL url, String encoding) { if (url == null) { throw new IllegalArgumentException("url cannot be null"); } if (encoding == null || encoding.isEmpty()) { encoding = "UTF-8"; } try { // Removing the default port ...
025c1340-1f71-4542-a91c-56f25afc4e13
0
public void setAlgorithm(String value) { this.algorithm = value; }
8fa4faaf-5be7-4695-8081-a5fa5ce4ae29
9
@Override public boolean isValidMove(Movement move) { int distance = Math.abs(move.getInitialLocation().getIntX() - move.getEndLocation().getIntX()); if(distance == 0) { distance = Math.abs(move.getInitialLocation().getArrayY() - move.getEndLocation().getArrayY()); } return ...
2f43f085-abd2-41a8-bfd2-3462fff2b6b2
0
private PaddingMessage(ByteBuffer buffer) { super(Type.PADDING, buffer); this.length = buffer.getInt(); buffer.get(); // pop the type this.data = buffer.slice(); }
76f65069-a82e-4179-833f-0b85c8414ce0
0
public void setDistance(double distance) { this.distance = distance; }
980bf69e-36b4-40df-8a74-f1435957fa94
5
@Override public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); boolean onUI = false; Set<Rectangle> UISpace = display.getUISpace(); for (Rectangle uiSquare : UISpace) { if (uiSquare.contains(p)) { onUI = true; break; } } if (onUI) { Map<String, Rectangle> toggleMap = display.g...
a469b72d-17ea-49dc-a4fc-656539905a82
2
@Override public void caseALessthanOp(ALessthanOp node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(LessThan"); inALessthanOp(node); if(node.getLessthan() != null) { node.getLessthan().apply(this); } o...
dd0bb54d-01df-460a-86de-1f39dc9dcabe
5
public static void put(String key, Attunement value){ if (!players.containsKey(key)){ players.put(key, new ArrayList<Attunement>()); } if (Config.allowPerWorldAttunement == true){ for (int i=0;i<players.get(key).size();i++){ if (players.get(key).get(i).loc.getWorld() != null && players.get(key).get(i)....
106c64df-3724-44e7-869b-1e1d7056d042
7
@Override public Class<?> getColumnClass(int i) { ArrayList<Class<?>> result = new ArrayList<Class<?>>(); for(Field field : this.model.getClass().getDeclaredFields()){ if (field.isAnnotationPresent(CRRCSimEditorField.class)){ result.add(getClassType(field.getType())); ...
4f8abc13-66b1-4964-8d57-91c9c14a3b4e
4
public String getAssetName() { return (canGoUp() ? "-" : "0") + (canGoDown() ? "-" : "0") + (canGoRight() ? "-" : "0") + (canGoLeft() ? "-" : "0") + ".png"; }
133c28b4-f402-4159-87a8-4dcf2d7bb2df
7
public void writeNext(String[] nextLine) { if (nextLine == null) return; StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE); for (int i = 0; i < nextLine.length; i++) { if (i != 0) { sb.append(separator); } String nextEl...
d6e9823d-ae19-4164-a6b7-bfc7be95864d
3
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...
7b570c84-c6c1-4f1f-9921-281390840b44
9
public void getInput() { switch(status) { case ST_INTRO: break; case ST_INTRO_MENU: if(Keyboard.getEventKeyState()) { setStatus(State.ST_MAIN_MENU); Mouse.setCursorPosition(Display.getWidth()...
dcf82c8a-6c8e-4baf-8be4-6a7b987960be
6
protected void appendHitUpdate2(stream str) { try { HP -= hitDiff; if (HP <= 0) { IsDead = true; } str.writeByteS(hitDiff); // What the perseon got 'hit' for if (hitDiff > 0 && !poisondmg) { str.writeByteC(1); // 0: red hitting - 1: blue hitting } else if (hitDiff > 0 && poisondmg) { s...
5e645381-c61c-4b17-8869-a9f1ce5286fc
8
public static ArrayList<Integer> KMP(int[] cadena, int[] patron) { int[] fallas = new int[patron.length + 1]; ArrayList<Integer> coincidencias = new ArrayList<Integer>(); int pos; Arrays.fill(fallas, -1); // funcion de fallas for (int i = 1; i <= patron.length; i++) { pos = fallas[i - 1]; while (po...
50ec01fe-3276-40f9-9370-d88e86698f13
2
public static void main(String[] args) throws IOException { SysFunc tSys = new SysFunc(); Scanner i = new Scanner(System.in); Path currentRelativePath = Paths.get(""); String s = currentRelativePath.toAbsolutePath().toString(); System.out.println("Running from: " + s); ...
faed1bfa-c759-47d9-a843-822659b972db
8
private void updateDragonEnderCrystal() { if (this.healingEnderCrystal != null) { if (this.healingEnderCrystal.isDead) { if (!this.worldObj.isRemote) { this.attackEntityFromPart(this.dragonPartHead, DamageSource.explosion, 1...
d50062c3-83ff-41ad-a386-b3f83fdfd49f
9
public String simplifyPath(String path) { if (path == null) return path; if ("".equals(path.trim())) return ""; Stack<String> paths = new Stack<String>(); String[] strs = path.split("/"); for (String str : strs) { if (str.equals("..")) { if (paths.size() >0) paths.pop();...
255931c3-8819-40f4-9dcd-f62828139cd8
2
@Override protected void interpretDatagram(DatagramPacket datagram) throws IOException { Object controlDatagram = ObjectUtil.extractFromDatagram(datagram); if(controlDatagram instanceof RRQ) { Logger.log("Incoming read request! Spawning worker..."); workers.submit(new ServerReadWorker((RRQ) controlDatagra...
977a4f82-b046-41f6-8dfe-ae7ff60dbd0a
2
public static ArrayList<String> getQuestionListByXMLElem(XMLElement root) { ArrayList<String> questionList = new ArrayList<String>(); for (int i = 0; i < root.childList.size(); i++) { XMLElement elem = root.childList.get(i); if (!elem.name.equals("query")) System.out.println("Question list unexpected nam...
992831f4-139d-44e6-ae57-6dca84ea6976
3
public static String askHash(String msg) { String res = null; while (res == null || !Draft.isHash(res) ) { res = ask(msg); if ( !Draft.isHash(res) ) System.out.println("\n!!! Not an implemented hash function !!!"); } return res; }
48b33466-d3a2-4598-9364-95ef6519473e
0
public final void setWrapWidth(double wrapWidth) { this.wrapWidth.set(wrapWidth); }
663f0f2e-a238-4e42-99e2-f0957302c3e2
7
public void testPOFAddObjectUsage() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Integer> pool; try { pool = makeEmptyPool(factory); } catch(UnsupportedOperationException uoe) { return; ...
639e7f0a-4088-46e9-bd92-77a14a81ab2f
6
public static String substituteTemplateVariablesInString(String string, KeyValueList variables) { { int index = 0; int length = string.length(); String result = string; int variableend = 0; String variablename = null; StringWrapper variablevalue = null; loop000 : for (;;) { ...
4ef0d0c7-2d3e-46bc-8e8a-83e03b3d150b
6
public boolean performIntercourse(Human target, boolean protection){ Random rand = new Random(System.currentTimeMillis()); boolean willing = rand.nextBoolean(); if (willing){ human.getLife().setIsExcited(rand.nextBoolean()); if (protection){ if (!human.getIsSterile() || !target.getIsSterile()){ // ...
4ac7e886-ade8-4dc2-a4a3-138655f3b2f2
3
public void pause() { if (!loading()) { // Make sure there is a sequencer: if (sequencer == null) return; try { // stop playback. Will resume from this location next play. sequencer.stop(); } catch (Exception e) { errorMessage("Exception in method 'pause'"); printStackTrace(e); So...
4dd752b5-9b1b-4b51-a5f0-bff017a4913f
6
public void encryptThenSend(byte[] plainText, Socket sock, boolean verbose) { if(verbose) { System.out.println(); System.out.println("----------------------------------------------"); System.out.print("Performing AES encryption on plain text: "); System.out.println(new String(plainText)); System.out.pr...
b83d010e-fd95-4498-9296-306a9318cf0c
6
DataNode convertToDataNode(Node node) { if (node != null) { DataNode dataNode = new BasicDataNode(node.getNodeName(), node.getTextContent()); NodeList children = node.getChildNodes(); for (int index = 0; index < children.getLength(); ++index) { Node child = children.item(index); if ...
79d64f9f-e130-495b-8ca6-6b335fb384fd
8
public boolean isValid() { if (id != null && name != null) { if (areas != null) { for (Area child : areas) { if (!child.isValid()) { return false; } } } if (newsPapersCategories != null) { for (NewsPaperCategory category : newsPapersCategories) { if (!category.isValid()) { ...
3ae3f20d-b81e-4ee4-a004-a305964e74a5
5
private void tbListaAssessoriaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tbListaAssessoriaKeyReleased System.out.println("Clicando"); if(evt.getKeyCode() == KeyEvent.VK_SPACE ){ try { concluido = true; this.dispose(); } c...
a3faac2f-b615-4cbc-a85d-7bce72f5b78d
7
public void plotZCoordinates (Graphics2D g2) { g2.setFont(new Font("Arial", 20, 12)); float xpoint = 0; float xpoint1 = 0; float zpoint = 0; g2.setColor(Color.BLACK); g2.drawString("0", 105,330); DecimalFormat f = new DecimalFormat("0.#"); int yInterval=50; float points = maxY / 4; for (int x = yI...
91454b1b-30cb-43fd-8862-2a85e4dd79da
9
@Override public void run() { File currentDir = new File("D:\\path"); while (true) { File[] images = currentDir.listFiles(new FileFilter() { @Override public boolean accept(File file) { if (file.isFile() &&...
1fbf1ff1-78ef-4b8a-8cd7-cd07d998cb36
2
private boolean isSessionValid(xAuthPlayer xp, String ipAddress, Timestamp loginTime) { if (plugin.getConfig().getBoolean("session.verifyip") && !ipAddress.equals(xp.getIPAddress())) return false; Timestamp expireTime = new Timestamp(loginTime.getTime() + (plugin.getConfig().getInt("session.length") * 1000)); ...
fafeec5f-ee3e-4602-a032-6c372dd245e7
2
private void initMaze() { for (int i = 0; i < MicromouseRun.BOARD_MAX; i++) { for (int j = 0; j < MicromouseRun.BOARD_MAX; j++) { mazeMap[i][j] = 0; } } }
108ffc03-75db-4af4-94f7-2124f2dc27ae
5
public CreateScheduleRequest(String name, String description, ScheduleCommand command, Date time) { if (name != null && Util.stringSize(name) > 32) { throw new IllegalArgumentException("Schedule name can be at most 32 characters long"); } if (description != null && Util.stringSize(description) > 64) { th...
8aa10a3a-2a41-4cd4-b2b7-fd3e103f424c
5
public void sql_change_acct_info(int choice) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { Class.forName("com.mysql.jdbc.Driver").newInstance(); Statement s = GUI.con.createStatement(); //CHANGE FUNCTION BASED ON DROPDOWN BOX INPUT if(choice == 1) { s.execut...
23084a89-db84-42cb-a869-136c1b42b863
4
public String beschrijving() { StringBuilder sb = new StringBuilder(); sb.append(standaardgegevens()); if (ouderlijkGezin != null) { sb.append("; 1e ouder: ").append(ouderlijkGezin.getOuder1().getNaam()); if (ouderlijkGezin.getOuder2() != null) { sb.appe...
e6719bb7-0824-465a-bdcc-90c04a7381a8
1
public void setIfAppFree() {if (this.cost <= 0) {this.ifAppFree = true;} else {this.ifAppFree = false;}}
4b8438c4-4a6d-4a24-80b8-771941f2455a
0
private void goToGroupListPage() { driver.findElement(By.linkText("groups")).click(); }
c429df83-d45f-41c8-b704-6a558b47ab3b
7
void launchClass(final Class klass) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { prefs.put("defaultClass", klass.getName()); try { System.out.println(klass); System.err.println(klass); Method[] meths = klass.getMethods(); for (int i=0; ; ++i) { if (i == m...
c9394d2a-a099-4a56-86b2-96fa934d58ab
2
@SuppressWarnings({ "rawtypes" }) public static List<Class> getClasses(String packageName) throws ClassNotFoundException, IOException { ClassLoader classLoader = Thread.currentThread() .getContextClassLoader(); assert classLoader != null; String path = packageName.replace('.', '/'); Enumeration<URL> r...
f03000ed-4477-4ea0-a944-25c08b38d37b
7
public double getNextSpecificStationDistance(int ID, String name){ Block b; if(getLineColor() == 0) b = trackObject.getBlock((int)trainDistRed[ID-1][2]); else b = trackObject.getBlock((int)trainDistGreen[ID-1][2]); B...
7145c0ac-4525-4e44-a556-c98d7bb62c2a
0
public static void main(String[] args) { new LighterDriver(new SwingLighter()).start(); }
a4814063-f86e-45ae-bbe8-8b6d65b43528
8
private int read0() throws IOException { final int retChar = this.currentChar; switch (this.currentState) { case EOF: return -1; case START_BLOCK_STATE: throw new IllegalStateException(); case RAND_PART_A_STATE: throw new IllegalStateExcepti...
dcc2967c-5fe5-484d-9da3-29851a0a9904
5
public static int saturation(int color) { int red = (color & RED_MASK) >> 16; int green = (color & GREEN_MASK) >> 8; int blue = (color & BLUE_MASK); int saturation = 0; if(!( red == green && green == blue)) { int max = red; int min = red; ...
4625513d-7154-4f4b-9e39-f0acf9e049fa
9
@Override public Iterator<int[]> iterator() { return new Iterator<int[]>() { int[] c = null; /** * Returns true if there is a next combination in the set. */ @Override public boolean hasNext() { return k <= n && (c =...
447ccc1f-3a56-4f4d-acf8-04daad9d7e9b
6
@Override public void run() { options.status = "Burthorpe Lodestone"; if (!locationAttribute.isInLargeArea(ctx)) { if (ctx.lodestones.teleport(lodestone)) { timeLastTeleport = System.currentTimeMillis(); } } if (locationAttribute.isInLargeArea(ctx) && !locationAttribute.isInSmallArea(ctx)) { opt...
37ebff06-4d0a-42dc-9204-60f51d176d6a
5
public ArrayList<Card> CardPack() { cardPack =new ArrayList<>(); // initialize card pack //Creating 4 suits with values for (int i = 0; i < 4; i++) { if (i==0) { GenerateSuit("Hearts "); } if (i==1) ...
0727c09b-7557-4a45-8ac0-e3879cbbf67b
2
public void calcNormals() { for(int i = 0; i < indices.size(); i += 3) { int i0 = indices.get(i); int i1 = indices.get(i + 1); int i2 = indices.get(i + 2); Vector3f v1 = positions.get(i1).sub(positions.get(i0)); Vector3f v2 = positions.get...
65347779-05c3-404d-8191-f1400c3527ff
9
public void processContacts(double timeStep) { for (Iterator<CollisionPair> it = collisionBroadphase .getCollisionPairs().iterator(); it.hasNext();) { CollisionPair pair = (CollisionPair) it.next(); if (pair.rigidBody1.getCollisionObject() instanceof SphereObject && pair.rigidBody2.getCollisionObject(...
248996ad-9a56-4293-a4bd-428d287990c6
8
public void turnRight() { assertMe(); if(x == 0 && y == 1) { x = -1; y = 0;} else if(x == 1 && y == 0) { x = 0; y = 1;} else if(x == 0 && y == -1) { x = 1; y = 0;} else if(x == -1 && y == 0) { x = 0; y = -1;} assertMe(); }
060b7d08-4273-4740-9fc4-d66c8d866a3b
7
private void calcField() throws InterruptedException { int processors = Runtime.getRuntime().availableProcessors()*2; FieldCalculatorThread[] threads=new FieldCalculatorThread[processors]; for(int y=0; y < processors; y++) { threads[y] = new FieldCalculatorThread(_field,y, processors,_charges,_scale); th...
06a26f6a-6733-4c92-92e6-b5d480fca7d2
1
private void functionDefinition() { if (accept(NonTerminal.FUNCTION_DEFINITION)) { tryDeclareSymbol(current); expect(Token.Kind.IDENTIFIER); expect(Token.Kind.OPEN_PAREN); enterScope(); parameterList(); expect(Token.Kind.CLOSE_PAREN); expect(Token.Kind.COLON); type(); statementBlock(); ...
6ccbd272-ffe5-4336-b755-dc9474e79b1b
5
public CheckResultMessage checkDayofMonth4() { int r1 = get(20, 2); int c1 = get(21, 2); date(); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); if (!(getValueString(r1 + maxDay, c1 - 1, 4).equals(maxDay + "日"))) { return...
77b45d34-3276-4ba0-bbff-9c8d718bc2ca
9
private static void tryRoom(final MOB mob, final Room R, final List<Item> hisPlants, final Set<Item> alreadyDone) { if(R!=null) { for(int i=0;i<R.numItems();i++) { final Item I=R.getItem(i); if(isMyPlant(I,mob)) { if(!alreadyDone.contains(I)) { alreadyDone.add(I); hisPlants....
23ac70c9-dec5-43aa-8c64-10cff14400df
9
public ArrayOfBet getCurrentBets(BetStatusEnum betStatus, Integer marketId, Integer selectionId) { GetCurrentBetsReq getMatchedBetsReq = new GetCurrentBetsReq(); getMatchedBetsReq.setHeader(exchangeHeader); getMatchedBetsReq.setBetStatus(betStatus); getMatchedBetsReq.setDetailed(true); getMatchedBetsReq.s...
bbcd1792-358b-4b3e-8577-9d98cef094ea
2
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { Type arrType = subExpressions[0].getType().getHint(); if (arrType instanceof ArrayType) { Type elemType = ((ArrayType) arrType).getElementType(); if (!elemType.isOfType(getType())) { /* We need an explicit widening cast *...
48e9166d-4341-4afd-8cc1-1271b9950663
3
public void printPlayerData() throws IOException { File dataFolder = main.getDataFolder(); File file = new File(dataFolder.toString() + "/playerDataPrintOut.txt"); file.delete(); File newFile = new File(dataFolder.toString() + "/playerDataPrintOut.txt"); FileWriter out = new FileWriter(newFile, true); ...
725ff8cb-afb3-440d-806d-865c06855c95
2
public <T extends IComponent> T getComponentAsType(Class<T> clazz, Entity entity, boolean required) { HashMap<Entity, IComponent> entityComponentMap = registeredComponents.get(clazz); // If this component existed, return their registered component if (entityComponentMap != null) { return clazz.cast(entityCompo...
7e2110a4-e830-42c4-9646-bf143458575d
2
public static void main(String[] args){ int max = 0; int maxI = 0; for(int i=2;i<1000;i++){ int n = length(i); System.out.println(i + " has recurring length " + n); if (n>max){ maxI = i; max = n;} } System.out.println(maxI); }
d662e785-47c6-4051-a354-7237b1106b3d
9
@Override public ArrayList<BERoleTime> readRoleTime() throws SQLException { ArrayList<BERoleTime> res = new ArrayList<>(); Statement stm = m_connection.createStatement(); stm.execute("select * from [Role/Time] " + "inner join Incident " + "on [Role/Time].incid...
e7f32e24-6b7a-4b06-99f0-11962d2d61f9
0
public boolean nondeterministic() { return nondeterministic; }
03215528-f19b-4099-9afb-13a6d746851d
2
public int getNumberOfSamples() { if (numberOfSamples < 0) { getSampleNames(); numberOfSamples = (sampleNames != null ? sampleNames.size() : 0); } return numberOfSamples; }
3e56a3db-132a-49b2-8a4c-add4d08348af
2
private void write(BufferedWriter out) { for (String s : _dateList.keySet()) { TemperatureDate td = _dateList.get(s); StringBuffer sb = new StringBuffer(); sb.append("db." + JSONWriter.COLLECTION_NAME + ".insert({"); sb.append("stationId: \"" + _stationId + "\""); sb.append(", ...
e5e0010b-59c8-4db3-8865-d8c378acd523
6
public void addStringToChat(String user, int hour, int minute, int second, String toAdd) { // this method is public because we gonna use this // in main to add chat lines! if (user.equals("System")) { SimpleAttributeSet set = new SimpleAttributeSet(); StyleConstants.setForeground(set, Color.red); S...