method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
34e6fa29-3291-4dd6-9fa8-82b55cb90f38
7
public boolean checkField() { Customer customer = this.customers.get(0); //Check obligatory fields if (customer.getName().isEmpty() || customer.getPublicId().isEmpty() || customer.getStreet().isEmpty() || customer.getCity().isEmpty() || customer.getPostalCode().isEmpty() || customer.getCountry() == 0 ...
fea4a760-2366-4b07-a8ea-377bb2ab3987
0
@Override public ArrayList<Excel> getColoredExes() { return coloredEx; }
6ac085e6-4327-42b2-94ca-02cc4312c308
9
public static Node getFirstCommonNode(Node head1, Node head2) { if (head1 == null || head2 == null) { return null; } int len1 = 1; Node tail1 = head1; while (tail1.next != null) { tail1 = tail1.next; len1++; } int len2 = 1; ...
71a02e87-c79d-42eb-84da-68eb70b7f4e5
5
public String getClientPrefix() { String prefix = this.properties.getProperty("clientprefix"); // Get OS name String osName = System.getProperty("os.name").toLowerCase(); // Probe for keywords in OS name boolean isLinux = osName.contains("ux") || osName.contains("nix") ...
75a97b7d-be34-402a-b340-b0b56b9d8505
8
public Map<String, Map<String, Boolean>> getPermissions(String world) { Map<String, Map<String, Boolean>> result = new HashMap<String, Map<String, Boolean>>(); Map<String, Boolean> groupperms = new LinkedHashMap<String, Boolean>(); //add group permissions groupperms.put("droxperms.meta.group." + group, true); ...
caf0f942-79e4-400d-90de-ec8b233de4ca
4
protected void createBuffers( SSLSession session ) { int appBufferMax = session.getApplicationBufferSize(); int netBufferMax = session.getPacketBufferSize(); if( inData == null ) { inData = ByteBuffer.allocate( appBufferMax ); outCrypt = ByteBuffer.allocate( netBufferMax ); inCrypt = ByteBuffer.allocate...
09770719-57bc-4e3d-92da-6f1f3aeab3d4
7
public static StopForumSpamResponse parseJson(InputStream src) { StopForumSpamResponse response = new StopForumSpamResponse(); JsonFactory factory = new JsonFactory(); try { JsonParser parser = factory.createJsonParser(src); while(parser.nextToken() != JsonToken.END_OBJEC...
0af3a6cf-e303-4317-ae8e-d629f6888aea
7
public static boolean test(Object o1, Object o2) { do { if (o1 == null) { if (o2 != null) { break; } }else if (o1 instanceof Object[] && o2 instanceof Object[]){ if (!Arrays.deepEquals((Object[])o1, (Object[])o2)) { break; ...
b3d92c72-4305-400f-9735-393df1b1f6ec
7
public static void undefineExternalSlots(Symbol name) { { Cons slots = Stella.NIL; { Module module = null; Iterator iter000 = Stella.allModules(); while (iter000.nextP()) { module = ((Module)(iter000.value)); { Slot slot = null; Iterator iter001 = Module.allSl...
75d0b0f9-00a0-42b8-a7f3-55e040ce3f20
4
public CMD_Public (CommandSender sender, String name) { if (sender.hasPermission(new Permissions().publicprivate)) { if (!name.equalsIgnoreCase("Console")) { if (config.getConfig().getString("Player."+name+".CR").equalsIgnoreCase("Default")) sender.sendMessage(ChatColor.GRAY+"The default chat room is alre...
9dae3bf0-1d94-49d5-bbb6-04672e7e5fd3
8
private TimeClock getMysteryTimeNowFromState() { TimeClock NOW=null; if(questState.mysteryData==null) return (TimeClock)CMLib.time().globalClock().copyOf(); if((questState.mysteryData.whereAt!=null)&&(questState.mysteryData.whereAt.getArea()!=null)) NOW=(TimeClock)questState.mysteryData.whereAt.getArea().g...
4dca5d98-49e2-4696-b4c1-caf42bb49040
7
public List<ElementInstance> getFirstIndexes() { List<ElementInstance> competitors = new ArrayList<>(); for (ResourceInstance currentRI : this.resources){ ElementInstance first = currentRI.getKeys().get(0); ElementInstance last = currentRI.getKeys().get(currentRI.getKeys().size()...
2af32fa5-1b10-4459-b6b4-fb0af5067dd6
7
@Override public final void logToFile(BufferedWriter out) { if( !LOG_FILE || out == null) return; try { out.write( dataAsString() ); } catch (IOException e) { e.printStackTrace(); } for(int i = 0; i < S32_NUM_SHADERS; i++) shaders[i].logToFile(out); for(int i = 0; i < S32_NU...
6cf9fc95-14b2-4a6d-a259-bf0ed6997bd6
1
public List<Integer> count(List<Integer> list) { int len = list.size(); if (len < 2) return list; List<Integer> left = count(list.subList(0, len / 2)); List<Integer> right = count(list.subList(len / 2, len)); return merge(left, right); }
9a87d784-6a72-4eac-9e0a-8433d66c6b88
8
private void addThisFkTab() { tbtmThisFinalkey = new TabItem(tabFolder, SWT.NONE,1); tbtmThisFinalkey.setText(Messages.MainWin_tbtmThisFinalkey_text); composite = new Composite(tabFolder, SWT.NONE); tbtmThisFinalkey.setControl(composite); composite.setLayout(new FormLayout()); Group group = new Group(com...
bfbf9463-66c4-4c73-a3f0-9b0f32b958b7
0
public void addInputNeuron(Neuron i) { inputNeurons.add(i); }
e8b85ac0-0a15-4aaf-835d-c1f9a1b7d1a2
6
public ModifierMatcher forceAccess(int accessModif, boolean andAbove) { if (andAbove) { if (accessModif == Modifier.PRIVATE) return this; if (accessModif == 0) return this.and(Modifier.PRIVATE, 0); ModifierMatcher result = this.and(Modifier.PUBLIC, PUBLIC); if (accessModif == Modifier.PROTECTED) ...
369d6fe5-47af-4134-b5e8-c847bac7184a
5
public static Colour fromHexString(String s) { if (s.length() == 7) // in format of #ff00ff { char buf[] = new char[2]; Colour ret = new Colour(1f, 1f, 1f, 1f); for (int i = 0; i < 3; i++) { buf[0] = s.charAt(1 + i * 2); ...
d1804e4b-59fc-491b-82d6-2f5e0b2e3f65
3
public static void startNotepad(String name) { Process asd; Runtime r = Runtime.getRuntime(); try { asd = r.exec("notepad " + name); asd.waitFor(10, TimeUnit.SECONDS); System.out.println(asd.isAlive()); if (asd.isAlive()) { asd.dest...
9bf0b5f8-aced-4953-a923-3dcb19094b9a
9
public View render(View convertView, Context context, FeedView webFeedView) { final ViewHolder holder; if (convertView == null) { convertView = getInflater(context).inflate(layout, null); holder = new ViewHolder(); holder.wrapper = (FrameLayout) convertView.findView...
08c92c37-bcd8-4d05-bd6f-731a9186f602
6
public void clickedRightMouse(Point p) { int x = (int) (p.getX() / tileSize); int y = (int) (p.getY() / tileSize); int locX = (int) ((p.getX() - (x * tileSize)) / (tileSize / 3)); int locY = (int) ((p.getY() - (y * tileSize)) / (tileSize / 3)); switch(currentState) { case OBJECT_ERASER: case OBJECT_P...
0a8102c4-5993-42f7-9d9c-db824fa1fdcd
8
public Value newOperation(final AbstractInsnNode insn) { int size; switch (insn.getOpcode()) { case LCONST_0: case LCONST_1: case DCONST_0: case DCONST_1: size = 2; break; case LDC: Object cst = ((LdcInsnNode) insn).cst; size = cst instanceof Long || cst instanceof Double ? 2 : 1; break; ...
6c006e67-312a-4cf9-af5d-5e9585c0ec2a
0
public PrimitiveUndoableInsert(Node parent, Node node, int index) { this.parent = parent; this.node = node; this.index = index; }
8bcce637-bbf6-45dd-a908-6474c42bcb95
1
public void removePush() { if (stack != null) instr = stack.mergeIntoExpression(instr); }
c4942e7b-daae-41c0-9364-871c086ebbb2
8
public Map<String, ArrayList<String>> getStructuredPhrasebyTF(int n){ if(phraseMap.getSortedMap().size() == 0) loadphraseMap(); Map<String, ArrayList<String>> phrases = new HashMap<String, ArrayList<String>>(); phrases.put("food", new ArrayList<String>()); phrases.put("decor", new ArrayList<String>()); phr...
d38d6d29-8308-485f-8d5f-824cc67cca45
6
public ScoreConfigFactory<P, F> withScoreConfig(ScoreConfig<P, F> config) { ScoreConfigFactory<P, F> result = this; for (PreScorer<P> pre : config.getPreScorers()) { if (!preScorers.contains(pre)) result = withPreScorer(pre); } for (PostScorer<P, F> post : config.getPostScorers()) { if (!postSco...
09a73b83-cb4e-49b6-a876-e7df467f2111
2
public double getWidth() { if (intervals == null || intervals.size() == 0) { return 0.0; } return getSubStackWidth(1, intervals.size() - 1); }
cb6f2f41-5473-4387-9e90-23575ab625a7
2
public double standardizedStandardDeviationCorrelationCoefficients(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.covariancesCalculated)this.covariancesAndCorrelationCoefficients(); return this.standardizedStandardDeviationRhoWithoutTotals; }
55a0c855-de2f-439b-ba51-48ff9448c836
7
public void combatAction(Robot source, Robot target, Ability ability) { int power = ability.getBasePower(); boolean crit = RNG.proc(ability.getCritChance()); boolean hit = RNG.proc(ability.getHitChance()); System.out.println(source.getName() + " used " + ability.getName() + ""); ...
909b3a45-1cd8-4fe7-a6cf-4cfe46de5310
3
@Test public void formatAverage() { // As a next step the code needs PrecisionLab to use it for data rounding. // The PrecisionLab instance can be created using various factory methods in abstract factory or from the // concrete factory implementation. final Map<SampleRoundingContext, Integer> dps = new HashMa...
92e7adba-ab19-4d38-bded-4c00da093814
8
private void addDataPanel() { int cid = MyFactory.getOwnerService().getIdByName4Query(jtfOwner.getText()); Date f = null; String from = showDateFrom.getText(); if (!from.equals("开始日期") && !"".equals(from)) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); ...
0f564a99-9677-4fc5-a2a6-ba9c8d062f1f
0
@Test public void twoChancesAndedShouldBeMultiplied() { // 0.5 * 0.5 = 0.25 Chance coinToss = new Chance(0.5); Chance coinToss2 = new Chance(0.5); assertEquals(coinToss.and(coinToss2), new Chance(0.25)); // 0.2 * 0.5 = 0.1 assertEquals(new Chance(0.2).and(new Chance(...
01081579-52f7-492e-8fba-58696604404d
3
public static String getTableName(Class<?> mainObjectclass) { if (Entity.class.equals(mainObjectclass)) { throw new DBException("no tablemapping for '" + mainObjectclass + "'"); } if (mainObjectclass.isAnnotationPresent(Table.class)) { return getTableNameInClass(mainObj...
15691564-f49f-4b14-baf0-739661cd65cd
7
public static void main(String args[]) { try { MqlParser p = null; if(args.length < 1) { System.out.println("Reading SQL from stdin (quit; or exit; to quit)"); p = new MqlParser(System.in); } else { p = new MqlParser(new DataInputStream(new FileInputStream(args[0]))); ...
4ce7886c-8f61-4102-8ae0-5215a48566d1
9
@Override protected boolean isSubTypeOf(final BasicValue value, final BasicValue expected) { Type expectedType = expected.getType(); Type type = value.getType(); switch (expectedType.getSort()) { case Type.INT: case Type.FLOAT: case Type.LONG: case...
a4b997df-5f64-4724-82ac-b000e9d3d7ac
2
public void clear() { stuff.clear(); for (int i = 0; i < 4; i++) { if (nodes.get(i) != null) { nodes.get(i).clear(); nodes.set(i,null); } } }
a2ddf28b-149f-4ba9-8619-13982b1eabc5
4
public static Date getDate(final String title, final Date defaultValue) { final SimpleDateFormat fmt = new SimpleDateFormat("dd-MM-yy"); final String date = ConsoleMenu.getString(title + "(dd-MM-yy" + (defaultValue != null ? ", default:" + fmt.format(defaultValue) : "") + ")", null); ...
84f84a39-94c3-48af-990f-fae6c9ebaffa
0
public Animal(Field field, Location location) { alive = true; this.field = field; setLocation(location); }
4108b3c7-beb5-43a4-b02d-6620735c7d28
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); String sueldo = request.getParameter("sueldo"); String select = request.getParameter("select"); ...
d486fff7-f379-4a5b-a913-c8b366a2cf98
1
public ShaderResource() { this.m_program = glCreateProgram(); this.m_refCount = 1; if(m_program == 0) { System.err.println("Shader creation failed: Could not find valid memory location in constructor"); System.exit(1); } m_uniforms = new HashMap<String, Integer>(); m_uniformNames = new ArrayList<...
4116dcd8-f69b-4ed1-94a8-0092c55e3e54
0
public Problem getProblem() { return problem; }
c1d01c0d-e986-4c48-8db1-719ef516024b
7
private void writeNumber( int db, int ln, long numb ) { long r = numb; RandomAccessFile f = ( db==0 ? fdbf : db==1 ? ffpt : fcdx ); byte[] g = new byte[ln]; for(int i=0, l=ln;l>0;l--) { if(db>0) r=(l==1? numb : numb>>((l-1)<<3) ); int b = (int)(r & 0xff); g[i++]=(byte)b; if(db==0) r>>=8; } ...
6ded5000-1c4a-4a6f-928d-ce1cb31b5774
0
public Connection getConnexion() { return connexion; }
c763a6ec-a320-4735-be2a-1e4cc196b639
9
private HttpResponse getFirstResponse(Collection<HttpRequest> requests) throws SuchgenieException { Collection<Future<HttpResponse>> futureHttpResponses = new LinkedList<>(); for (HttpRequest request : requests) { futureHttpResponses.add(request.executeAsync(EXECUTOR)); } while (!futureHttpResponses.isEm...
304bbc6c-b1a4-46ea-b24b-631bc9a2ee8b
1
private static String arrayToString_4(int[] a) { String ret; if (a == null) { ret = ""; } else { ret = a[0] + SkinConstants.SPLIT2 + a[1] + SkinConstants.SPLIT2 + a[2] + SkinConstants.SPLIT2 + a[3] + SkinConstants.SPLIT2; } return ret; }
37d687e7-9151-4b7a-a18b-6d67a0310242
0
public Pattern getWordDelimeterPattern() { return _wordDelimeterPattern; }
5f657070-344a-49a9-8fe7-e2acffc9ae6a
6
public void updateWithNewValuesFromScrollBar(JScrollBar jScrollBar) { if(ignoreScrollBarUpdates) return; ScrollBarCalculator sbc = new ScrollBarCalculator(this); if( checkForExtremes(sbc, jScrollBar)) return; float totalNumberOfIncrements = jScrollBar.getMaximum() - jScrollBar.getVisibleAmount()...
f312d7ab-4f3f-4fde-a3eb-76cf71c944ac
4
protected Instruction copyInstruction(Instruction paramInstruction, InstructionList paramInstructionList) { if (paramInstruction == null) { return null; } Instruction localInstruction = (Instruction)paramInstruction.copy(); if ((paramInstructionList instanceof Instruction)) localInst...
7c475e54-1a82-487f-af59-0909b86c851e
1
public void visitLineNumber(final int line, final Label start) { buf.setLength(0); buf.append(tab2).append("LINENUMBER ").append(line).append(' '); appendLabel(start); buf.append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitLineNumber(line, start); } }
6af0a0a8-3edc-489d-895c-59d98759acc8
2
public boolean isMember(String forumId, User user) { for (int i = 0; i < forums.size(); i++) { if (forums.get(i).getId().equals(forumId)) return forums.get(i).isMember(user); } return false; }
32307c3f-e4d9-4390-8f25-c127455620c2
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...
926d42bf-fde7-4fa3-ab92-d6508ef919ae
3
private void printAlgorithmInfo(String name) { Algorithm[] alg = model.getAlgorithms(); for (int i = 0; i < alg.length; i++) { if (alg[i].getName().equalsIgnoreCase(name)) { sysOut.println(bundle.getString("algorithm") + ": " + alg[i].getName()); int pwLen = a...
f655401c-ff40-4dc2-99d2-56c71e961dbc
4
private void actualizarVistas() { obtenerDatosPreguntas(); respuestasActuales(); if (_posicion == 0 || _posicion == 2) { asignarEtiquetasEImagenes(); _columnasImage.setVisible(true); _columnas.setVisible(false); } if (_posicion == 1 || _posici...
d12881fd-5d24-4d66-98ad-819a1ca555bd
1
public static void deleteInvProduct(Integer TID) { try { Database db = dbconnect(); String query = "DELETE FROM products_involved " + "WHERE ticket_TID = ?"; db.prepare(query); db.bind_param(1, TID.toString()); d...
cc392d75-b546-483f-821b-9d4d252e6935
2
public static void main(String[] args) throws ParseException { if (args.length != 3) { System.err.println("3 arguments needed: username, password, baseApiUrl"); return; } String username = args[0]; String password = args[1]; String baseApiUrl = args[2]; ...
84661a2b-c1c4-4e04-bd63-aa9119520730
5
public static String htmlq(String html) { if (html == null) return ("(null)"); StringBuilder buf = new StringBuilder(); for (int i = 0; i < html.length(); i++) { char c = html.charAt(i); if (c == '&') buf.append("&amp;"); else if (c...
f3428120-7a45-4544-a402-5770ec9101f8
2
public int getInt(String key) { Object value = get(key); try { return value instanceof Number ? ((Number) value).intValue() : Integer.parseInt((String) value); } catch (Exception exception) { return 0; } }
71e275e3-7832-4389-8513-cbadb3fb1360
6
@Override public void report(Diagnostic<? extends String> diagnostic) { String message; Kind kind; switch(diagnostic.getKind()){ case ERROR: kind = Kind.ERROR; break; case MANDATORY_WARNING: case WARNING: kind = Kind.WARNING; break; case NOTE: case OTHER: default: kind = Kind.NOTICE; ...
233fe447-c177-4cd9-b62c-429ad500f89f
0
public static void main(String[] args) { DotNew dn = new DotNew(); Inner dni = dn.new Inner(); // Not dn.new DotNew.Inner() }
57a409bf-153f-461d-91d0-1421727e585d
8
private List<String> marchingCompare(List<String> listA, List<String> listB) { List<String> result = new ArrayList<String>(); int b = 0; int c = 0; String sb; int size = listB.size(); for (String s : listA) { sb = listB.get(b); c = s.compareTo(sb...
830f6d73-d8c4-493d-ac26-7d7183489080
0
private void removeVariable(String variable) { myVariables.remove(variable); }
0e3dc4e1-76e2-4567-a852-10b4238958a9
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String author = request.getParameter("author"); String title = request.getParameter("title"); String numberPage = request.getParameter("numberPage"); String imprintDate = request.getParamet...
1ce5e5c8-3031-48fc-8bc4-b4b14000cae4
0
public MergeCell(List<ProcessedCell> src, ProcessedCell dst){ this.src = src; this.dst = dst; }
cd9fd6f8-4110-4573-b49f-2c64b47faaca
2
protected Object getEntity(Class clazz, Object id) { Session session = null; Object o = null; try { session = getSession(); o = session.get(clazz, (Serializable) id); } catch (RuntimeException e) { logger.error("Error returning class"+clazz+" with id"+ id); e.printStackTrace(); } finally { if ...
45379267-6294-4e40-be48-ff9d80ea1d96
4
TreeNode next() { TreeNode head = queue.poll(); if (head == null) { if (!queue.isEmpty()) queue.offer(null); return null; } if (head.left != null) queue.offer(head.left); if (head.right != nu...
9c94c8ca-4361-43fb-9ab5-6068313b4dbb
4
void readClientRedirect(int x, int y, int w, int h) { int port = is.readU16(); String host = is.readString(); String x509subject = is.readString(); if (x != 0 || y != 0 || w != 0 || h != 0) { vlog.error("Ignoring ClientRedirect rect with non-zero position/size"); } else { handler.client...
dcc70cb8-6f60-4970-b209-87481d8dfa23
9
private void validate_preferences() { // verify that X-Plane directory exists if (new File(this.preferences.getProperty(PREF_APTNAV_DIR)).exists() == false) { logger.warning("AptNav Resources directory not found. Will not read navigation data!"); XHSIStatus.nav_db_status = XHSISt...
67b402c8-113c-4788-a650-d4a718fc77e6
2
public List<UsuarioSistema> listarTodos() throws ErroValidacaoException, Exception{ try{ PreparedStatement comando = banco.getConexao() .prepareStatement("select p.id as idpessoa,nome,cpf,rg," + "data_nascimento,u.id as idusuario, usuario from pessoas " ...
36b31530-0b96-44b0-9626-d22bd49295eb
1
public static void main(String[] args) throws Exception { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { config.setServerURL(new URL("http://127.0.0.1:6666/xmlrpc")); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } XmlRpcClient clie...
37ce62a9-ba7a-424f-ae90-066f32d99e90
8
private static MarkupSelectorItem.AttributeCondition.Operator parseAttributeOperator(final String operatorStr) { if (operatorStr == null) { return null; } if ("=".equals(operatorStr)) { return MarkupSelectorItem.AttributeCondition.Operator.EQUALS; } if ("!...
451fa785-8325-4cdc-b276-554e9a8dda42
4
private void addEdgeChunks() { int chunkX = 0, chunkZ; for (chunkZ = 1; chunkZ < 31; chunkZ++) { regionChunks.add(new CoordXZ(CoordXZ.regionToChunk(regionX) + chunkX, CoordXZ.regionToChunk(regionZ) + chunkZ)); } chunkX = 31; for (chunkZ = 1; chunkZ < 31; chunkZ++) { regionChunks.add(new CoordXZ(Co...
fbef4ad1-8d21-4b4f-92d5-29c935d42ccf
8
public void keyPressed(KeyEvent e) { int p = 0; //Current player. int keyCode = e.getKeyCode(); switch (keyCode) { case KeyEvent.VK_UP: if (arrow[p].getValue() != Direction.DOWN) //If you are going down you can't turn up, or you will die. arrow[p]...
9374ab11-93e8-41a9-a122-bdbeaa57953f
1
public int sqrt(int x) { double y=0,z=1.0; while((int)y - (int)z != 0){ y = z; z = (double)x/2/y+y/2; } return (int)y; }
1761ec73-d853-4f2d-b1a3-870935053cc3
7
@Override public void createFromXML(NodeList attributes) { for(int i = 0; i < attributes.getLength(); i++) { Node node = attributes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { if(node.getNodeName().equalsIgnoreCase("EnemyBasic")) { ai = ...
43e6cdae-4e69-45b8-9a61-b8b0dfc1b3ff
2
synchronized public String giveBack(Long i) { if (i.longValue() == latest) { shrinkLatest(); } freeSequences.add(i); String s = currentSequences.get(i); currentSequences.remove(i); if (currentSequences.size() == 0) { latest = 0; } return s; }
8ce133c0-5019-404d-a227-17869c43aafb
5
@Override public String readLine() throws IOException { StringBuilder sb = null; while (true) { if (last <= next) { // Read buffer next = 0; last = raf.read(buffer); // End of file? if (last < 0) return removeNewLine(sb); } // Find end of line int nl = findNl(next, last); if (...
823bc53f-b255-40b6-b44a-54bf19eddc38
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
95f63edb-b771-423c-9bdc-35aa3d108d81
2
private void fillGroup() { this.group.setName(txtName.getText()); this.group.setCapacity(Integer.parseInt(txtCapacity.getText())); //this.group.setTeacher((Teacher)cbTeacher.getSelectedItem()); this.group.setTeacher(lblDispTeacher.getText()); this.group.setLevel((Level)cbLevel.getSelectedItem()); List<G...
20473da7-4911-414b-85c7-fb18d6da452c
3
private int indexToRenderFrom(List<Card> cards, boolean dragonsTail) { double maxSize = dragonsTail ? DECK_Y : getHeight(); //Required as when game is started, maxSize = 0..otherwise doesn't render..odd? maxSize = maxSize > 10 ? maxSize - 10 : 10; double cardsYSize = Y_BOARD_OFFSET + (ca...
b7638869-f24b-422f-be9d-562eae03e771
2
public int getPageLastItem() { int i = getPageFirstItem() + pageSize - 1; int count = getItemsCount() - 1; if (i > count) { i = count; } if (i < 0) { i = 0; } return i; }
efcaeb7d-00ca-4d68-bd90-d462f8c92a50
8
protected void executeSetMethod(String fieldName, Object value, T newInstanceo, Class<?> setClass) throws FactoryFillingException { // Obtain the method name String setterName = this.getSetterGetterMethodName(fieldName, SETTER_PREFIX); // execute the actual setter method try { logger.debug("method to ...
43e1aaf3-ceed-4a5c-ac16-350e708eef93
7
public boolean hasCommonAncestor(FamilyTreeNode node1, FamilyTreeNode node2) { Set<FamilyTreeNode> S = new HashSet<>(); Queue<FamilyTreeNode> Q = new LinkedList<>(); Q.offer(node1); while (!Q.isEmpty()) { FamilyTreeNode node = Q.poll(); if (S.contains(node)) continue; S.add(node); for (FamilyTre...
088234d2-4e3f-4e80-bbd6-bcabb9dd354d
1
@Override public void fire() { if(timeSinceLastShot >= timeBetweenShots) { GameActor a = Application.get().getLogic().getActor(actor); //WeaponsComponent wc1 = (WeaponsComponent)a.getComponent("WeaponsComponent"); PhysicsComponent pc1 = (PhysicsComponent)a.getComponent("P...
5b35aaaf-d43b-44cf-bcfe-328c180dfc7e
4
public void setPlayerType(){ String p1Type = Game.getPlayer(0).getPlayerType(); String p2Type = Game.getPlayer(1).getPlayerType(); Element playerOneType = m_doc.createElement("type"); Element playerTwoType = m_doc.createElement("type"); if(p1Type.equals("ComputerEasy")){ playerOneType.appendChild(m_d...
15cd50a9-868d-407a-8eb7-7a7bc5db5e15
9
public static boolean canOccupy(Game game, Item item, Point2D location) { Vector<Point2D> points = new Vector<Point2D>(); int point_count = (int)(item.getSize() * 8); double da = 2 * Math.PI / point_count; for (int n = 0; n != point_count; ++n) { double theta = da * n; double x = item.getSize...
24ed41a6-2f0b-4442-b620-2f95841fece9
2
@Override public String toString() { String output = ""; for (int x = 0; x < xLength; x++) { for (int y = 0; y < yLength; y++) { output += getItemType(new Position(x, y)); } output += "\n"; } return output; }
ea56b269-04d4-45be-a795-3856031395e9
6
public static void plguiHtmlPprintObject(Stella_Object self, OutputStream stream) { { Object old$LogicDialect$000 = Logic.$LOGIC_DIALECT$.get(); Object old$PprintAtomicObjectRenderer$000 = edu.isi.ontosaurus.OntosaurusUtil.$PPRINT_ATOMIC_OBJECT_RENDERER$.get(); try { Native.setSpecial(Logic.$LO...
db0c7caa-7465-4982-bd18-8bc4eb46441b
6
public String[] getFormattedUrbanDef(boolean hasColors, int limit) { /* * TODO Add try/catch to handle * TODO The exception that no JSON is received * TODO Look at PirateBay.java as an example */ gson = new GsonBuilder().setPrettyPrinting().create(); UrbanJson uj = gson.fromJson(thi...
c5048943-8453-4739-bf00-57d4694eb650
8
JDialog getEditor(Component parent) { final JTextArea titleArea = new PastableTextArea(title); final JTextArea subtitleArea = new PastableTextArea(subtitle); String s = JmolContainer.getInternationalText("AnimationTitle"); final JDialog d = new JDialog(JOptionPane.getFrameForComponent(parent), s != null ? s :...
fae7362d-002c-4d0e-9b14-f4ed17ea61dd
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...
c9e85cf3-22f7-48c4-82fc-2ae4a940c57c
1
public BasketViewHelper getBasketViewHelper(HttpServletRequest req) { BasketViewHelper basketViewHelper = new BasketViewHelper(); basketViewHelper.setBasket( (Basket)req.getSession().getAttribute("basket")); String id; if ((id = req.getParameter("id")) != null) { basketViewHelper.setId(Integer.p...
7056ee33-5128-4878-a08a-2c625a7a9254
1
@Test @SuppressWarnings("unused") public void testSimilarities() throws Exception { // keeping a neighborhood with the top 300 users // how does the similarity influence the performance (root mean square error) of the recommender? for (int i = 0; i < 8; i++) { final int n = i; // make random behave alw...
7a369845-4b60-411d-965e-9f1dbafad3fa
8
public static String calculateJavaType(Column column) { String answer; String javaType = typeMap.get(column.getJdbcType()); if (javaType == null) { switch (column.getJdbcType()) { case Types.DECIMAL: case Types.NUMERIC: if (column....
ad8428f5-77d5-4bc0-8ba5-a59311fe3a46
5
public boolean accept(File dir, String name) { try { File f = new File(dir.getPath() + "/" + name); if(f.isDirectory()) return false; // System.out.println(name); Reader reader = new FileReader(f); BufferedReader buffReader = new BufferedReader(reader); String s ; while((s =...
011ff418-03d0-4470-953c-e468735e76eb
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof OrganisationAccessRequest)) { return false; } OrganisationAccessRequest other = (OrganisationAccessRequest) object; ...
2b2ddd12-87e1-4f6a-9b65-9a8e0bfa8e70
2
public void selectMarker(int x,int y) { for(int i=0;i<markers;i++) { marker[i].selectMarker(x, y); if(marker[i].isSelected()) { //MainView.setSelectedListItem(i); } } }
1ae29b6d-c9c1-4ea4-a181-4d9bc0e8f21a
9
public static double create(double[] y1, Angle angle){ double angleToPlot = 0; switch (angle) { case PSI: { double alpha1 = y1[0]*y1[0] + y1[1]*y1[1] - y1[2]*y1[2] - y1[3]*y1[3]; double beta1 = 2*(y1[1]*y1[2] + y1[0]*y1[3]); ...
2d900820-c89b-490e-9d8e-a47a11cf3b58
8
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException { mouseX = Mouse.getX(); mouseY = Mouse.getY(); Rectangle start = new Rectangle(100,150,600,100); Rectangle exit = new Rectangle(100,350,600,100); if(start.contains(800 - mouseX, 600 - mouseY)){ if(!starthover)startho...
da411597-d1f0-4250-9c18-2e825e1fd5de
4
private synchronized static void completedCheck(Thread t, Status status) { if (debugMode) System.out.println( String.format( "Finished check [%s] @ %-6s [%s]", new SimpleDateFormat("HH:mm:ss").format(status.getTimeChecked())...
47cffd55-08ff-4ef9-832f-bbfd285b921a
5
@Override public List<UserVo> list(int pageNo, int pageSize) throws Throwable { Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; try { con = dataSource.getConnection(); stmt = con.prepareStatement( "select UNO, EMAIL, NAME from SE_USERS" + " order by UNO desc" ...