method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ca167ed9-b845-4278-8f6d-121b8d4b0a3f
2
protected boolean isInterface(final Type t) { if (currentClass != null && t.equals(currentClass)) { return isInterface; } return getClass(t).isInterface(); }
1761f140-794b-41cb-b966-a456fb701b51
0
private void clearBarCode() { initQuantity(); txtBarCode.clear(); txtBarCode.requestFocus(); }
ee4fdff3-bfc7-4e65-b3f5-102134f6594b
5
@SuppressWarnings("unchecked") public static void loadOptions(File f) throws Exception{ if(!f.exists()){ f.createNewFile(); saveDefaultOptions(f); } YAMLFile data = new YAMLFile(true); data.Load(f); for(Option p : options){ if(p.getType().equals("int")) p.value = data.getInt(p.key); if(p....
9e6150ea-598a-4886-b3b9-058050577ff6
9
@Override public void mouseDragged(final MouseEvent e) { if (this.draggedComponent == null) { for (final Element el : getGraphicPanel().getSelectionManager().getSelectedElements()) { if (el.getComponent().getHandlers().isHandlerAt(e.getPoint())) { if (el insta...
794490bd-6c85-48a8-81a7-ac0fd9906f2d
3
private String col(String s, int width) { if(s == null) s = ""; if(s.length() >= width) s = s.substring(0, width - 1); while(s.length() < width) s = s + " "; return s; }
8e34592e-1d7f-482d-bbe4-1a79127c805e
2
private static boolean isNotPrimitiveOrString(Class<?> type) { return !type.isPrimitive() && !type.isAssignableFrom(String.class); }
29df0204-6696-492a-8b90-78fc58e46b2a
4
private void insertUser() { if (Arrays.equals(jPasswordField1.getPassword(), jPasswordField2.getPassword())) { if (newEmployeeName.getText().isEmpty() || newEmployeeUsername.getText().isEmpty()) { JOptionPane.showMessageDialog(this, "Udfyld alle felterne!"); } else { ...
eca7d949-365f-4e74-ae10-a7b1dfed3b3e
0
public RemoteServerCall(String address, int port) { super(address, port); sync = new ConcurrentHashMap<Long, IRemoteCallObject>(); conns = new ConcurrentHashMap<Long, List<Long>>(); }
4f38fb5e-0f10-4f0a-b4f9-33cd452172c5
5
@EventHandler public void onHangingBlockPlace(HangingPlaceEvent event) { Player player = event.getPlayer(); // get player Hanging block = event.getEntity(); // get block placed // check config FileConfiguration config = plugin.getConfig(); String material = block.getType().toString(); // if deactivated, do...
1c4dc217-9f67-4a1f-96ee-1eaac731e57b
3
public void show(String title, String message, ButtonSet buttonSet) { switch (buttonSet) { case OK: buttonOK.setVisible(true); buttonCancel.setVisible(false); break; case CANCEL: buttonOK.setVisible(false); buttonCancel.setVisible(true...
fd990e33-1513-4519-b117-d1895621c238
1
@SuppressWarnings("UseSpecificCatch") public void readXMLfile() { try { File XmlFile = new File("temp_movie.xml"); DocumentBuilderFactory dfb = DocumentBuilderFactory .newInstance(); DocumentBuilder dBuilder = dfb.newDocumentBuilder(); ...
102536ac-7c83-41da-9eba-1ffe6f70181f
3
private void handlePointSelection(Point clickedPoint) { selectedCurve = null; selectedPoint = -1; List<Curve> curves = Main.getCurveManager().getCurves(); int i = curves.size() - 1; boolean found = false; while (i >= 0 && !found) { selectedPoint = curves.get(i).checkMouseCollision(clickedPoint); if (s...
4c7f45a3-5658-4190-8de5-ee37a8e943cc
6
@EventHandler public void SlimeWeakness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getSlimeConfig().getDouble("Slime.Weakness....
2aae5d7e-a27e-40eb-bf95-c0c27f56f1fa
9
public void setTagValue(){ try { File xmlFile = new File("graphs//saveLivingstone-complex.xml"); fstream = new FileWriter("graphs//saveLivingstone-complex.grs"); out = new BufferedWriter(fstream); fileName="saveLivingstone-complex"; // obtain a parser that produces DOM object trees from XML documen...
e7aa7efb-177d-4c4c-8380-fa3617a04981
5
private boolean add( char[] chars, V newValue, int offset, int length ) { if ( offset == length ) { value = newValue; boolean wasAlreadyAKey = key != null; key = new String( chars ); return !wasAlreadyAKey; } char nextChar = chars[ offset ]; ...
e4b9e363-5eea-41a1-a842-e75c5d52700d
1
public static Element e(Document document, String tagName, A...attributes) { Element element = document.createElement(tagName); for(A a : attributes) { element.setAttribute(a.name, a.value); } return element; }
a307813a-c2dc-44b4-93e4-0bc2263eb5a7
2
public User getUser(String username) { Query query = sessionFactory.getCurrentSession().createQuery("from User where username = :username"); query.setParameter("username", username); List<?> list = query.list(); if (list.size() == 0) return null; return (User) list.get(0); }
19c4bee8-5f67-4f7f-914d-2acb8d229b6a
9
private int getStatIndex(String stat) { switch(stat.toLowerCase()) { case "atk": return 0; case "def": return 1; case "satk": case "spa": return 2; case "sdef": case "spd": return 3; case "spe": return 4; case "evasion": return 5; case "accuracy": return 6; } return 0; ...
9a0011f4-827f-439a-bc47-e739d0168811
0
public boolean hasCrashed() { return ex == null; }
0cb78973-05eb-4473-992a-9053fe2dc733
5
public ChatChannel joinChannel(ChatChannel channel, User user, boolean channelExists){ try { Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT); socket.setSoTimeout(TIMEOUT); OutputStream outputStream = socket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStrea...
7f6cb170-b6a3-4b74-8777-c3f5ca1b0275
9
public boolean isComplete() { if (from == null || from.length()==0) { System.err.println("doSend: no FROM"); return false; } if (subject == null || subject.length()==0) { System.err.println("doSend: no SUBJECT"); return false; } if (toList.size()==0) { System.err.println("doSend: no recipien...
f272dff4-88d3-4926-8598-a379542f01c5
4
private void fillTagFirst(Integer userID, List<Integer> tags, Long day) { Map<Integer, Long> tagMap = userTagFirstMapping.get(userID); if (tagMap == null){ tagMap = new HashMap<Integer, Long>(); } for (Integer tag : tags) { if( ! tagMap.containsKey(tag) || day < tagMap.get(tag)) { tagMap.put(tag...
27559bec-a85e-46aa-9c3b-8ce57157b714
1
private String chooseFile() { if (chooser.showDialog(org.analyse.main.Main.analyseFrame, null) == JFileChooser.APPROVE_OPTION) { return chooser.getSelectedFile().getAbsolutePath(); } return null; }
62148d64-3e10-4bdf-b421-c93451bd1a57
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
09c8b3da-9d75-4367-a688-72004d9b8a56
1
public static int listLength(IntNode head) { IntNode cursor; int answer; answer = 0; for (cursor = head; cursor != null; cursor = cursor.link) answer++; return answer; }
bc5d96a3-9ed3-4b9a-bd88-60f61dcb5f9f
5
public void schemeEditorAddElement() { if(ce_element.getText().length() == 0 || ce_type.getSelectionIndex() == -1) return; String elementName = ce_element.getText(); String elementType = ce_type.getText(); scheme.getElements().put(elementName, elementType); Eleme...
2629ccde-5641-4f12-8290-69d6148ac1c2
9
public final void list_for() throws RecognitionException { try { // Python.g:423:10: ( 'for' exprlist 'in' testlist ( list_iter )? ) // Python.g:423:12: 'for' exprlist 'in' testlist ( list_iter )? { match(input,82,FOLLOW_82_in_list_for3775); if (state.failed) return; pushFollow(FOLLOW_exprlist_in_list_...
0de73ba3-0c1f-4468-9a8b-1a44245d3993
3
@Override Color getColor(String colorName) { // Java 8 can use Strings in switch. switch (colorName) { case "RED": return new Red(); case "GREEN": return new Green(); case "BLUE": return new Blue(); default: return null; } }
09637dd0-8e2d-4c8a-ab25-2e349525863c
5
public MavenJarFile getMavenJarFileFromFolderWithArtifactId(File folder, String artifactId) throws IOException { MavenJarFile mainJarFile = null; for (File aFile : folder.listFiles()) { if (aFile.isDirectory()) { mainJarFile = getMavenJarFileFromFolderWithArtifactId(aFile, ar...
1c01068c-d962-459e-a8ed-c39bf74a0576
8
public int[] getInts(int par1, int par2, int par3, int par4) { int var5 = par1 - 1; int var6 = par2 - 1; int var7 = par3 + 2; int var8 = par4 + 2; int[] var9 = this.parent.getInts(var5, var6, var7, var8); int[] var10 = IntCache.getIntCache(par3 * par4); for (...
167d5b22-94da-41e8-ba69-8c6392406d42
9
@SuppressWarnings("deprecation") public void run(){ System.out.println("HEALTHY 2: " + model.character.health); /* * Create a new display, which all of the GL11 commands will be applied to. */ try { Display.create(); } catch (Exception e2) { e2.printStackTrace(); System.exit(0); } G...
5ea193c6-d74a-48a9-a4d0-a64f6dbdbf51
0
public LogFileMessageFormatterImpl() {}
8dd81f18-47cc-444f-9d0d-2e619c0466cd
8
public double round( double num) { if(num > -45 && num < 45){ return 0; } if(num > 45 && num < 135){ return 90; } if(num > 135 && num < 225){ return 180; } if(num > 225 && num < 315){ return 270; } return num; }
9a93db64-8d0f-4ec1-aa10-fcf4d7bc1f06
7
private int mapOp(boolean invert, int op) { switch (op) { case Expression.EQ: return Expression.GE; case Expression.GE: if (!invert) { return Expression.GE; } return Expression.LE; case Expression.LE: if (!invert) { return Expression.LE; } return Expression.GE; case Expression.LT...
642d38f3-829a-4d9f-88c0-37930021f79c
1
public boolean storeMessage(String sender, String receiver, String message){ PreparedStatement st; Integer rs; String query; query="INSERT INTO messages(sender,receiver,message) VALUES('"+sender+"','"+receiver+"','"+message+"')"; try { st = conn.prepareStatement(query); rs = st.executeUpdate(); st.cl...
dbd5a9b4-4fbd-4351-949a-a86d929c7df5
5
@Override public void run() { s = new StartLogo(this); p = new PlayField(input); p.reset(); long lastTick = System.nanoTime(); double nsPerTick = 1000000000D / 40D; long lastFrame = System.nanoTime(); double nsPerFrame = 1000000000D / 60D; int ticksPS = 0; int framesPS = 0; long lastTimer = Sys...
dce08e3d-5bd2-42a5-b4a9-5e6c9c5f8aec
6
@Test public void testIsOpenOutOfRange() { Percolation p = new Percolation(10); try { p.isOpen(10 + 1, 5); fail("Line above should throw exception"); } catch (IndexOutOfBoundsException e) { /* Expected */ } try { p.isOpen(5, 10 + 1); fail("Line above should throw ex...
6a44efe4-1ea8-44c1-be68-b75fab998d04
1
private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 800, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); imagePanel = new JPanel(); imagePanel.setBounds(10, 30, 293, 447); frame.getContentPane().add(imagePanel); imageLabel = n...
19a6f1aa-4788-48f8-a12b-389e32a0965e
2
public void passEigenValues( double[] eigenValues, double[][] eigenVectors ) { if ( size() == 0 ) { this.eigenValues = eigenValues; this.eigenVectors = eigenVectors; } else { get(0).passEigenValues(eigenValues, eigenVectors); for ( int i = 0; i < size() - 1; ++i ) get(i + 1).passEigenValues(get(i).get...
f6923e0d-1a83-4d3f-b518-7f082e4f0d30
8
public double[] distributionForInstance(Instance instance) throws Exception { if (!m_isLeaf) { // value of split attribute is missing if (instance.isMissing(m_Attribute)) { double[] returnedDist = new double[m_ClassProbs.length]; for (int i = 0; i < m_Successors.length; i++) { double[] help = ...
a84ad22e-0a24-4ba1-9766-33b3f745e95b
0
public static void setPoints(Player p, double i){ warnLevel.remove(p); warnLevel.put(p, i); }
811e6882-72ab-4fad-9b68-00e5804042a8
2
@Override public Integer validate(String fieldName, String value) throws ValidationException { if (value == null) { return null; } try { return Integer.parseInt(value); } catch (NumberFormatException e) { throw new ValidationException(fieldName, value, "not a valid int", e); } ...
a4062ae0-f5d4-4c73-81fa-5a918aea7496
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader( new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int caso = 1; for(String line; (line = in.readLine())!=null;){ StringTokenizer st = new StringTokenizer(line.trim()); int n = Integer...
1e2851ca-da41-45a4-862c-b2c38cafff04
4
public GameFrame() { // set the title on the frame super("Boat Game!!!"); // Builds the Frame and adds the Game Panel to it buildFrame(); // infinite animation loop, program halts when window is closed. while (true) { pause(); ...
79cde4cd-6fab-4600-a4a8-f79b0c5317f5
9
protected boolean wantBraces() { StructuredBlock block = subBlock; if (block == null) return false; for (;;) { if (block.declare != null && !block.declare.isEmpty()) { /* A declaration; we need braces. */ return true; } if (!(block instanceof SequentialBlock)) { /* * This was the las...
86ceeeed-fa66-4ae1-9068-aa7e094eee6d
8
public static Perturbation generate(String type, Molecule m,int resList[],BufferedReader br){//Generates a perturbation of the indicated type, affecting units in unitList //(Basically a constructor wrapper) Arrays.sort(resList);//We need the list of affected residues to be in ascending order if...
c005d600-bb4e-4133-9bc6-2f2e68239690
0
@Override public void documentRemoved(DocumentRepositoryEvent e) {}
ab2f50c2-f24a-49bb-b850-ebb71d50ac04
4
protected Element createStateElement(Document document, State state, Automaton container) { // Start the creation of the state tag. Element se = createElement(document, STATE_NAME, null, null); se.setAttribute(STATE_ID_NAME, "" + state.getID()); // Encode position. se.appendChild(createElement(document, ST...
3fd4704e-305f-4ffb-a703-e45e2d82de57
4
private void clearCaches() { if ((priorityCache != null) && !priorityCache.isEmpty()) priorityCache.clear(); if ((structCache != null) && !structCache.isEmpty()) structCache.clear(); }
8c632ac1-3444-4245-aa3c-6b0ee7b16a7f
4
public static double[] bubbleSort(double[] actualArraySort, String order) { double temp=0; for (int i = 0; i < actualArraySort.length; i++) { for (int j = 1; j <(actualArraySort.length-1) ; j++) { if(order.equalsIgnoreCase("asc") ? actualArraySort[i] > actualA...
250e3c53-cf8f-4833-b8ed-5dd5b59a7c37
9
public boolean isAncestor(mxGraphHierarchyNode otherNode) { // Firstly, the hash code of this node needs to be shorter than the // other node if (otherNode != null && hashCode != null && otherNode.hashCode != null && hashCode.length < otherNode.hashCode.length) { if (hashCode == otherNode.hashCode) {...
f8f3e67d-c116-45e9-9c92-229e70abe403
1
public static void print (Object s){ if (setFind) System.out.println(getFileName() +":" +getClassName() +":"+ getMethodName() +":"+ getLineNumber()); System.out.println(s); }
cdd0984a-f167-4e52-ab28-136ce2277861
8
void simulate(ArrayList<Process> l) { int[] waitTime = new int[l.size()-1]; int[] turnAroundTime = new int[l.size()-1]; int timer = l.get(0).arrivalTime; boolean flag = true; for (int i = 0; i < l.size()-1; i++) { Process p = l.get(i); char name ...
ea6d9c6b-9440-45b5-88b3-2f2c40c15f2f
0
public void setPlace(String place) { this.place = place; }
c1b21392-70fd-42dd-9c45-76e740e87d9f
5
void innerMessagesPerform(Request request) { String message = request.getParams().get("Innermessage").get(0); String data = (String) request.getData(); if (data == null) { throw new NullPointerException("data == null"); } if ("added_slave".equals(message)) { ...
16107463-08a5-434d-8152-db66a44a5b7a
5
public void print_statusbar(int x, int n, int r, int w, String message) { if (!silent) { /* Calculuate the ratio of statusbar (will be 0.5 on 50%) */ double ratio = (double)x / (double)n; /* Calculate the percentage of current status */ int pe...
5243db74-92f4-4954-97af-974b4a612870
3
public static void main(String[] args) throws Exception { AbstractVDKFileInfo fileInfo = null; CTFileInfo ctFileInfo; // AbstractVDKFileParser fileParser = AbstractVDKFileParser.getParser("C:\\Users\\Herestt\\Desktop\\OBJECT_CITY.VDK"); // fileInfo = fileParser.start(); // fileInfo.unpack("C:\\Users\...
488e63ba-53c7-4e7b-b473-8847d4db32e1
2
public boolean addPatternObject(String name, Object patternType) { for (String a : genericPatterList.keySet()) { if (name.equalsIgnoreCase(a)) { return false; } } genericPatterList.put(name, patternType); return true; }
d5e3f814-43b3-4305-962e-1c616e641345
2
public void eat(WorldObject woEaten) { try { // Nothing will eat its own type if (woEaten.getWobID() != this.getWobID() ) woEaten.died("Killed"); } catch ( Exception e) { System.out.println("WorldObject.eat(): " + e); } }
ea9a4bc2-b959-484b-8620-200b110a3178
4
@Override public void close() { switch (this.getState()) { case LIFTOPEN: this.setState(LiftState.LIFTCLOSE); break; case LIFTSTOP: case LIFTRUNNING: case LIFTCLOSE: break; } }
c8480ab9-343f-485a-9234-7ace9bab598a
1
public void setSubExpressions(int i, Expression expr) { int diff = expr.getFreeOperandCount() - subExpressions[i].getFreeOperandCount(); subExpressions[i] = expr; expr.parent = this; for (Operator ce = this; ce != null; ce = (Operator) ce.parent) ce.operandcount += diff; updateType(); }
e2cf719e-0778-4628-99c3-657ba80e788f
9
public static void main(String[] args) throws IOException{ ServerSocketChannel channel = ServerSocketChannel.open();//获取ServerSocket通道 channel.socket().bind(new InetSocketAddress(8888)); channel.configureBlocking(false);//设置为非阻塞 Selector selector = Selector.open();//获得通道的多路复用器(通道管理器) ...
01933265-6f2b-446d-be9b-2212348a7dc3
0
public Venue getVenue() { return venue; }
3127a396-d838-4482-a2e2-cc0bb0d14310
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical target, boolean auto, int asLevel) { if(target==null) target=mob; if(!(target instanceof MOB)) return false; if(CMLib.flags().isGolem(target)) return false; if(((MOB)target).phyStats().level()<CMProps.getIntVar(CMProps.Int.INJBL...
fd5abed0-b514-4899-831d-b87d6ec06441
2
public static Quiz getQuiz(int quizId) { try { String query = String.format("SELECT * FROM QUIZ where quizid = %d", quizId); ResultSet rs = getQueryResults(query); Quiz q; if (rs.next()) { q = new Quiz(rs.getString("QUIZTITLE"), rs.getInt("QUIZID")); ...
8937e026-c711-4ed0-bb71-906101305a09
4
public String loadScriptResource(String filename, String charset) { BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader( new FileInputStream(filename), charset )); } catch( IOException | NullPointerException e1 ) { // no file found try to load from jar try ...
34e8a5e8-8617-4b03-99f5-6a385ae1fe49
8
public String shortcutTag(int i, String s, int j, String s1, String s2, int k) { String s3 = ""; if(s.equals("")) return ""; XMLNode xmlnode = new XMLNode(); xmlnode.XMLType = j; xmlnode.XMLData = s; xmlnode.XMLAttr = s1; LinkedList linkedlist = ne...
9059ad76-1527-41e3-8ab1-81bd7a79116a
6
@Test public void testSVD() { SparseMatrix matrix = new SparseMatrix(); for(int i=0; i<5000; i++) { for(int j=0; j<50; j++){ if (j % 2 == 0) { matrix.set(i, j, (float) (Math.sin(i) + RND.nextDouble()*0.01)); } else { ...
7f428a28-432a-4b95-805b-1c8c558a0095
7
public static void find(int[] a,int target){ int m = 0; int n = 0; boolean flag = false; for(int i = 0; i < a.length; i++){ for(int j = i+1; j < a.length; j++){ if(a[i] * 2 > target){ i = a.length; j = a.length; break; } int temp = a[i] + a[j]; if(temp > target){ break; ...
6698b1a0-9dfb-446f-8a4f-d56ef8d06661
6
public static final void execTransform(Body b) { switch(b.getType()) { case Reimu.type: // 縺ァ縺��蛹� synchronized(SimYukkuri.lock) { Terrarium.bodyList.remove(b); Body to = new Deibu(b.getX(), b.getY(), b.getZ(), b.getAgeState(), null, null); YukkuriUtil.changeBody(to, b); Terrarium.bodyL...
02102eda-3109-4350-b1b8-11962b781258
3
public static void copyFromQueueToQueue(RabbitMQRequestParams rabbitMQRequestParams) throws Exception { RabbitMQTopicQueueConsumer consumer = new RabbitMQTopicQueueConsumer( rabbitMQRequestParams.getSourceHost(), rabbitMQRequestParams.getSourcePort() , rabbitMQRequestParams.getSourceUsername(), rabbitMQReques...
aed84998-f750-48ba-8d54-889b3e0931c0
2
public boolean isDescendantOf(Row row) { Row parent = mParent; while (parent != null) { if (parent == row) { return true; } parent = parent.mParent; } return false; }
c44b0ac1-6ded-4ac9-8ac7-1bc3b616418a
2
public static long factorial(int n) { if (n < 2) { return 1; } long ans = 1; for (long i = 1; i <= n; i++) { ans *= i; } return ans; }
8f711560-9f3b-441f-8de9-72ab1be21c99
8
private long cal(){ int length = subLength*2; long[][][] dp = new long[length+1][subLength+1][subLength+1]; dp[0][0][0] = 1; for(int k=1; k<=length; k++){ for(int i=0; i<=subLength; i++){ int j = k-i; if(j<0) break; if(j<=subLe...
e063c5f6-b02d-478f-87e1-6509ea11bf04
8
private void configureLogger() throws Exception { if ((!new File(getDirectory()).exists()) && (!new File(getDirectory()).mkdirs())) throw new Exception("Cann't create log-directory " + getDirectory()); if ((config.getResource() != null) && (!config.getResource().isEmpty()) && (new Fil...
8bf6ee06-c922-4989-b78e-37ca548da1e6
7
public void siirra(int xMuutos){ if (peli.onkoPause()){ return; } if (xMuutos < 0){ int vas = etsiVasenX(); if (vas + xMuutos < 0){ return; } } if (xMuutos > 0){ int oik = etsiOikeaX(); if (oi...
c16ed410-afe4-46a8-967f-a0a83854a9f1
1
@Override public void run() { for(int i = 0 ; i < 100; i ++) { System.out.println("Thread Test !" + i); } }
fbf10cd1-9e72-4b56-9487-368e971a0738
8
@Override public void map(Object key, Text value, Context context) throws IOException, InterruptedException { // 讀取一列轉換為欄位陣列 String[] columnValue = readRow(value, VERTICALBAR); // 建立Key <primaryKey, tableIndex, joinCondition> outputKey = new QuadTextPair(new IntWritable(Integer.parseInt(columnValue[0])), new...
1a04113e-38d0-4df1-b4d2-a87214353443
0
private Message(Type type, ByteBuffer data) { this.type = type; this.data = data; this.data.rewind(); }
bb46ae77-5e5a-4c01-80de-bea46ce23969
0
public List<CreativeMaterial> findAllCreativeMaterialsByRoomEventId(final Long roomEventId) { return new ArrayList<CreativeMaterial>(); }
defb2e73-36d2-42bd-81ef-a626eeb20ff4
6
public int findNumberInString(String in){ int pos = 0; int start = -1; int stop = -1; while(pos < in.length() ) { if(isNumber(in.codePointAt(pos))) { if(start == -1) { start = pos; } ...
04c5e108-09f1-40ef-b339-8e93708920b6
8
@Override public void run() { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char input = 'm'; try { while (!player.canMove) { input = (char) br.read(); } while (player.canMove) { if (input == 'w' || input == 'a' || input == 's' || input == 'd' || input == 'x'...
e77defc7-621a-4b08-aef8-661da1767be6
1
public boolean matches( Class<?> clazz ) { return this.a.matches( clazz ) ^ this.b.matches( clazz ); }
d65d5355-4f14-4721-bc5b-aa8a288acf3b
3
private boolean checkTrapLocation(int x, int y){ for(Trap t : traps) if(t.getX() == x && t.getY() == y) return true; return false; }
3451b120-8760-4c00-9741-c281826e35b4
1
@Override public int hashCode() { return (currencyPair.hashCode() * 17 + tenor.hashCode()) * 17 + (getRole() == null ? 0 : getRole().hashCode()); }
fa0cecee-0c50-4908-bfe8-6ee1db1dfc4b
1
public void accept(final MethodVisitor mv) { mv.visitTryCatchBlock(start.getLabel(), end.getLabel(), handler == null ? null : handler.getLabel(), type); }
c92fa0a8-a056-4d66-b01d-c320a62c79bb
6
protected void printHelp(CommandSender sender, String label) { if(sender.hasPermission("rapsheet.lookup")) { sender.sendMessage(ChatColor.GRAY + "/" + label + " lookup <player>"); sender.sendMessage(ChatColor.GRAY + "/" + label + " lookup <player> <charge#>"); } if(sender.hasPermission("rapsheet.charge")) {...
beb4220e-1107-4e47-aa3a-0de1b275e5ad
8
private void randomWalkAddPossibleCommandsForDirection(dir direction, ArrayList<Command> possibleCommands){ if (neighbourFree(this.atField,direction)) { possibleCommands.add(new Command(direction)); } else if (neighbourIsBoxOfSameColor(direction)) { //Find possible pull commands for (dir d : ...
c6057cd2-facb-48c9-86b8-d750972d1484
1
public void createIntro(ArrayList<String> imageList, ArrayList<String> descriptionList) { Element introElement = doc.createElement("intro"); gameModule.appendChild(introElement); for(int i=0;i<imageList.size();i++) { Path path = Paths.get(imageList.get(i)); Element i...
11c7f09e-e97b-408f-872a-b7c61ea0ac0f
7
public void testPresent2() { try { TreeNode result = contains(new TreeNode("node"), mkChain(new String[]{ "node", "anothernode" })); assertTrue(null, "Failed to ignore the subtrees branches when locating the only node of a leaf!", result != null && result...
98103592-35ad-41f8-9c0c-fae181915681
2
public double getDouble(int index) throws JSONException { Object o = get(index); try { return o instanceof Number ? ((Number)o).doubleValue() : Double.valueOf((String)o).doubleValue(); } catch (Exception e) { throw new JSONException("JSONAr...
d79b6278-5e24-456d-bcd6-2056ce8530e1
3
public double getDiscountedPrice(double originalPrice){ if(originalPrice <= 0) throw new IllegalArgumentException("The starting price cannot be 0 or below."); double newPrice = 0; switch(typeFlag){ case PERCENTAGE: newPrice = originalPrice * (1 - discountValue); break; case ABSOLUTE: newPri...
921609a1-7f63-4f4a-becf-3ed0ed6007c0
1
public String listPlayerNames() { String[][] playerArray = getConnectedPlayers(); String playerNames = ""; int processed = 0; while(processed < playerArray.length) { playerNames = playerNames + "," + playerArray[processed][0]; processed++; } return "PLAYERS " + playerNames; }
696cdaa8-a407-475b-92df-f778b6011f2a
6
public static Stella_Object safeArgumentBoundTo(Stella_Object self) { if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PATTERN_VARIABLE)) { { PatternVariable self000 = ((PatternVariable)(self)); { Stella_Object value = null; if ((((QueryIterator)(Logic.$QUERYIT...
6ce1e43b-41b4-4c68-bc0f-4444d7682ea4
9
public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); int n = Integer.parseInt(st.nextToken()); int m = Integer.parseInt(st.nextToken()); int d = ...
d6cef677-2f5c-4ded-9540-6f225ca13248
3
public final GameTreeNode select(Random random) { GameTreeNode node = root; int me = root.board.currentPlayer; while(node.children.size() > 0) { if(random.nextDouble() < 0.1) break; if(node.board.currentPlayer == me) { // choose the most promising node for me node = node.children.str...
d595ac57-ddb8-4b53-a69a-90bc2c0b031a
2
private static String getEmptyTempFile(String dir) { Random r = new Random(); String name = null; File f = null; do { name = (dir.equals("") ? "" : dir + "/") + "_temp_" + Math.abs(9272334 * r.nextInt()); f = new File(name); } while(f.exists()); return name; }
02e65740-0373-46c5-9676-8a77a90d7d91
0
@Override public int getCounterwidth() { // TODO Auto-generated method stub return 0; }
ce323e7b-ada9-444c-9774-26a29b0eb3f6
9
final public void ExpPRT() throws ParseException { /*@bgen(jjtree) PRT */ SimpleNode jjtn000 = new SimpleNode(JJTPRT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(OPEN_ROUND_BRACKET); Expression(); SimpleNode jjtn001 = new S...
ceac1b7e-b4c6-428a-9551-cd49f2cb1d3a
4
private ArrayList caclPosIni(){ ArrayList<Integer> pos = new ArrayList(); // int canto = 2; int t; int canto = (int) (Math.random()*4); switch (canto){ case 0: t = (int) (Math.random()*Board.getWIDTH()); ...