method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
76005239-8881-4063-bf9a-c281caa5433c
1
private void createTouristList(Criteria criteria, Integer idOrder, AbstractDao dao) throws DaoException { List<Tourist> list = (List<Tourist>) criteria.getParam(DAO_ORDER_TOURIST_LIST); for (Tourist t : list) { Criteria crit = new Criteria(); crit.addParam(DAO_ID_ORDER, idOrder);...
88e0fb48-1d5b-4673-a512-a5d851574532
9
public String fwla_to_fsp(String name) { if(name.indexOf('.') == -1) throw new java.lang.Error("The supplied string apears not to have the form <object>.<event>"); String object = name.substring(0, name.indexOf('.')); String event = name.substring(name.indexOf('.') + 1); String _res = ""; if(objec...
c2028e52-e3f5-42ba-87aa-a4dd73661c67
0
public int buscarConta() { System.out.print("entre com o numero da conta: "); return entrada.leiaInt(); }
2d568029-14fd-4516-bde0-6ccea158779b
3
public List<Category> getAll() throws SQLException { Session session = null; List<Category> cats = new ArrayList<Category>(); try { session = HibernateUtil.getSessionFactory().openSession(); Class tmmp = Category.class; cats = session.createCriteria(Category.clas...
39d1d637-2aae-42b5-bfbb-9d096f07a7dc
8
private void readFeed() { try { // Set header values intial to the empty string String title = ""; String link = ""; // First create a new XMLInputFactory XMLInputFactory inputFactory = XMLInputFactory.newInstance(); // Setup a new eventRea...
15525be9-eccd-4002-b8ba-70009969453d
7
public void visitMethodInsn( final int opcode, final String owner, final String name, final String desc){ boolean itf = opcode == Opcodes.INVOKEINTERFACE; Item i = cw.newMethodItem(owner, name, desc, itf); int argSize = i.intVal; // Label currentBlock = this.currentBlock; if(currentBlock != null) { if(...
36ef148d-4a6e-4649-ab0a-504e5f4c662e
5
public static void read_type_def(SimpleNode declarations, Symbol_table symbol_table, Type_table type_table) { try { int component_num = declarations.jjtGetNumChildren(); for (int i = 0; i < component_num; i++) { SimpleNode type_declaration = (SimpleNode) declarations.jjtG...
c392a6bb-dfac-4b88-8bfd-6f6239bbb690
7
static private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
3f12a33f-fa8b-4c25-b46e-2c58c3348a5d
8
private void updateFont() { // [srk] same protection added to updateColors // make sure node is not null if (node == null) { return ; } // end if if (node.isEditable()) { setEditable(true); if (!node.isMoveable() && pApplyFontStyleForMoveability) { setFont(immoveableFont); } else { ...
dc761973-767f-402e-ac23-0eb66a44d437
9
public void rotateImages(float rotationAngle){ //Number of right angle turns int numTurns = (int) Math.round(rotationAngle / (Math.PI*0.5)); //Rounds rotationAngle to nearest integer multiple of pi/2 float testAngle = (float) ((Math.PI*0.5)*numTurns); assert (Math.abs(testAngle-rotationAngle)<0.001): "E...
0840498c-3f56-4f3d-9276-16b43741f1db
1
public static String treeToString(TreeMap<Integer, Integer> tree) { StringBuilder builder = new StringBuilder(); for(Entry<Integer, Integer> i : tree.entrySet()) { builder.append(i.getKey() + " " + i.getValue() + "\n" ); } return builder.toString(); }
2b1fbb3a-76f7-4a7f-80ce-0da478194a02
0
boolean startManually() { return manualStart; }
cc085703-32d0-499c-b065-e6681b9fef2d
1
public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) { ostream.write_long (value.length); for (int _i0 = 0;_i0 < value.length; ++_i0) ostream.write_string (value[_i0]); }
81ab191c-8e39-4599-8b26-1570716fb311
7
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed String name = username.getText(); char [] pw = passwordField.getPassword(); String password = new String(pw); //System.out.println(password); try { ...
5e36ffa7-7e51-4460-b75b-dafda7100a52
5
public static Registry440 getRegistry(String host, int port) throws RemoteException440{ try{ Socket soc = new Socket(host, port); ObjectOutputStream out = new ObjectOutputStream(soc.getOutputStream()); ObjectInputStream in = new ObjectInputStream(soc.getInputStream()); HandshakeMessage handshkMsg = new Ha...
14fe7910-5280-4885-99c2-d78280d41839
1
public final void setY(int y) { if (y < 0) { return; } this.y = y; }
189f2d3a-8e83-45b5-83f7-c16a2437fdfa
8
public int[] searchRange(int[] A, int target) { int[] res = new int[2]; res[0] = -1; res[1] = -1; if (A == null || A.length == 0) { return res; } int start = 0, end = A.length - 1; int mid; // Search left end while (start <= end) { ...
a5b9cdfd-7e34-4f28-bf67-642b0d6fff12
1
public Boolean agregarProducto(String producto){ if(this.stock.containsKey(producto)){ return false; } this.stock.put(producto, 0); return true; }
0f5f944b-b35f-4e0b-9f0f-402c463beae8
5
public static List<String> processComplexValue(String complexValue) throws Exception{ if(!SymbolComplexValueHelper.isComplex(complexValue)) throw new Exception("Symbol: [" + complexValue + "] isn't a complex valid type."); String realValue = cleanComplexValue(complexValue); ...
187a1aec-3d87-4aa0-b619-74c9042cca43
5
@Test public void depthest01opponent3() { for(int i = 0; i < BIG_INT; i++) { int numPlayers = 4; //assume/require > 1, < 7 Player[] playerList = new Player[numPlayers]; ArrayList<Color> factionList = Faction.allFactions(); playerList[0] = new Player(chooseFaction(factionList), new SimpleAI()); ...
f7b00569-9f85-4f79-b612-486706c02a35
3
public static void initializeExecutor(String resDirectory) { PokemonType.initializeTypes(); JSPokemonEngineHandler.initializeTypeHandlers(); System.out.println("Initializing JavaScript..."); //Init scope handlers (THIS, TARGET, etc) pokemonHandlerTHIS = new JSPokemonHandler(); pokemonHandlerTARGET = new ...
bd486cbe-e6c0-4b12-b3a2-c8a5d9efae8e
2
public void openBraceClass() { if (currentLine.length() > 0) { if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) print(" "); else println(); } println("{"); }
1e456094-fb2f-4ed1-af86-ee1e169d82e0
7
public Move bestMove(Board board, Piece piece, Piece nextPiece, int limitHeight){ Rater[] raters = { new HeightRater(FACTORS[0]), new RowsClearedRater(FACTORS[1]), new CohesionRater(FACTORS[2]), new GapFactor(FACTORS[3]) }; EnhancedMove bestMove = null; Piece current = piece; do { ...
ed74bd06-4a67-48c1-bdf6-250a6baefdd7
1
public static void displayHelp(Object object) { String url = getURL(object); if (url == null) url = DEFAULT_HELP; FRAME.gotoURL(url); FRAME.setVisible(true); }
db885332-d20d-4688-a82e-c187b5aaf23d
0
public CFGToPDALRConverter() { }
1aff5e43-6b39-44de-a4e0-f410fbe7ca7a
0
public JTextField getjTextFieldVille() { return jTextFieldVille; }
a027ddde-fe53-4003-b6b4-aa37743d7897
2
public Sprite getSpriteCollision(Sprite sprite) { // run through the list of Sprites Iterator i = map.getSprites(); while (i.hasNext()) { Sprite otherSprite = (Sprite)i.next(); if (isCollision(sprite, otherSprite)) { // collision found, return the Sprite ...
90b8493e-76b5-48ae-9ddc-e6fd540bcef0
9
public Response callAndWait( String recipientId, Map msg, int timeout ) throws SampException { long finish = timeout > 0 ? System.currentTimeMillis() + timeout * 1000 : Long.MAX_VALUE; // 3e8 years HubConnection connection = getConnection(); S...
99f586eb-2cd1-4e5f-9119-ff3dba873921
8
public DnDSimplePluralityResult(DnDElection election) { winners = new ArrayList<Option>(); ArrayList<String> maxGUID = new ArrayList<String>(); Integer maxVotes = 0; Map<String, Integer> votemap = new HashMap<String, Integer>(); for (Vote v : election.getVotes()) { if (!(v instanceof OneOfNVote)) { /...
265677bc-15bc-4317-8305-1676286a9bd1
2
public static String run(String input, int length, int filter) { StringBuilder sb = new StringBuilder(); NaiveSuffixTree myTree = new NaiveSuffixTree(); input += "$"; final BaseCalculator myBaseCalculator = new BaseCalculator(input); Node root = myTree.createTree(input); ArrayList<Entry<Strin...
3f08a249-ce51-4e0d-8188-6057f4efef60
3
@Override public void setTransient(Registry rg) { super.setTransient(rg); try { for (String key : resources.keySet()) { Resource resource = (Resource) resources.get(key); resource.setTransient(rg, this); } } catch (ConcurrentModificati...
15e252ad-f19b-49b8-b3c1-f45f26267fd9
1
private static final boolean hasDecimalSeparator(String buffer, boolean localized) { return buffer.indexOf(localized ? LOCALIZED_DECIMAL_SEPARATOR.charAt(0) : '.') != -1; }
27dfdbef-f265-42c5-8907-b3a68c45d7fe
4
public int largestRectangleArea(int[] height) { int maxArea = 0; int n = height.length; for( int i = 0; i < n; i++ ) { if( i < n - 1 && height[i] <= height[i+1] ) continue; int maxHeight = height[i]; for( int j = i; j >= 0; j-- ) { int l = i - ...
883657d7-6206-424f-87b6-f3ff6e083cae
6
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); PypAdmControlProfesionales pypAdmControlProfesionales; try { py...
4dee0d76-7fbe-49f4-beef-dbd826394b4a
2
public void removeEntity(String name){ for (int i=0;i<eHandler.length-1;i++){ if (eHandler[i].getName().equals(name)){ eHandler[i] = null; } } }
65761647-2ba2-41cc-a8e8-b1ffae0caedd
6
private final void method1802(String s, int i) { int j = 0; boolean flag = false; int k = s.length(); for (int l = 0; l < k; l++) { char c = s.charAt(l); if (c == '<') { flag = true; } else if (c == '>') { flag = false; ...
da844ad6-fa5a-4df8-88e2-7a217a61e83f
2
@Override public void spawnEnemy(String enemyData) { if(!free()) { return; } int r = Application.get().getRNG().nextInt(6); GameActor a = Application.get().getLogic().createActor(enemyData); PhysicsComponent pc = (PhysicsComponent)a.getComponent("PhysicsComponent"...
2b4cb1c4-2eaf-4633-8cae-952f2418cbd8
4
private static String lineStyle2Dot(Styles.LineStyle lineStyle) { switch (lineStyle) { case Dashed: return "dashed"; case Dotted: return "dotted"; case Bold: return "bold"; case Solid: default: ...
ef37e7c8-46b7-4ec1-9af3-2ff8a0e096b0
0
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = new OutlinerDocument(""); Outliner.menuBar.windowMenu.changeToWindow(doc); }
d836210f-da48-443b-85e4-0021b6aeaf6a
3
public void setKey(String key) { byte[] keybyte = key.getBytes(); if (keybyte == null) { throw new RuntimeException("No key"); } else if (keybyte.length < 16) { throw new RuntimeException("Key too short"); } // Change bytes for ints IntBuffer intBuf = ByteBuffer.wrap(keybyte).order(ByteOrder.BIG_END...
3fc0c4e6-9c44-4960-8aa6-3b5236d14949
1
public void makeNonVoid() { if (type != Type.tVoid) throw new jode.AssertError("already non void"); type = subExpressions[0].getType(); }
8c8f03fa-2608-40cc-bf2a-359e4ebd88e5
2
public boolean isInParty() { synchronized (JSBotUtils.glob.party.memb) { for (Party.Member m : JSBotUtils.glob.party.memb.values()) { if (m.gobid == gob_id) return true; } return false; } }
e846d1b1-f863-4cfa-b7f9-e01260c05024
9
public TreatmentRec(Db db,Patient patient,String doctorID){ this.doctorID = doctorID; GregorianCalendar currentTime = new GregorianCalendar(); time = currentTime; //set treatment time //set discuont discount = 1; int ch, cm, nh1, nm1, nh2, nm2; ch = currentTime.get(11); cm = currentTime.get(12); nh1 =...
20bae7aa-c61c-43b0-81be-790d7de7dec8
4
private static void printResult() { Iterator<Entry<String, Integer>> iter = class_number.entrySet().iterator(); while (iter.hasNext()) { Entry<String, Integer> entry = iter.next(); String key = entry.getKey(); int val = entry.getValue(); System.out.println("\t"+key + "\t: " + val); ...
3ba332ed-72da-4e1e-bdb8-28c148b6a767
2
public static <E extends GameObject> List<E> getNearby(Vector2D position, List<E> list){ final int MAX_DISTANCE = 50; List<E> neighbours = new ArrayList<>(); for (E thing : list){ Vector2D other = thing.getPosition(); if (Utilities.distance(position, other) < MAX_DISTANCE){ neighbours.add(thing); } ...
3ad0bf34-f9c3-44dd-9380-dba822e996c2
8
@Override public void run() { int choice; do { System.out.println("\nCryptoby - Crypt your Stuff"); System.out.println("---------------------------\n"); System.out.println("1 - Crypt Files"); System.out.println("2 - Crypt Text"); System.ou...
0397f391-bb27-4767-8d64-1d8103286c07
5
private String apendKeyInString() { StringBuilder field = new StringBuilder(); int i = 0; for (Integer key : cardInFieldGame.keySet()) { if (!listeofcontains.contains(key)) { double fehlt = LEGHTFORSTRING - 1; double me = fehlt / 2; fehlt = fehlt - me; for (int loop = 0; loop < me; loop++) { ...
c62031b6-feaa-48a3-b306-5d63c0ec459b
5
@Override public boolean activate() { return Methods.needToHeal() && (Global.useRejuvenate && ActionBar.getNode(0).canUse() && ActionBar.getAdrenaline() == 1000) || (Global.eatFood && Methods.getHpPercent() <= HEAL_PERCENT - 10); }
29f7d8c8-861b-4070-b627-9575d3815751
3
public void cb(JComboBox cb,String a,String id){ con.ConsultarSQL("SELECT id,"+a+" FROM "+a,true); try { con.rs.first(); cb.addItem("Selecionar...."); int index = 0; do{ index++; cb.addItem(new InseriIdCombobox(con.rs.getString("id...
eb5a023f-5757-4286-bae1-b567eb6241a6
1
public int count() { Set<Integer> components = new HashSet<>(); for (int v = 0; v < id.length; v++) components.add(id[v]); return components.size(); }
c3540b70-dcdc-4253-8925-4ad3cd166aa7
2
public void recalculateTable(int row){ BigDecimal vorigRestCapital; if (row == 0) { vorigRestCapital = getStartCapital(); } else { vorigRestCapital = getBusinessObjects().get(row - 1).getRestCapital(); } for(int i=row; i<getBusinessObjects().size();i++) { ...
0d65e0d7-a11a-40b3-aae7-c4d054bc7164
8
private Widget getHoverText(int seriesIndex, JavaScriptObject object) { if(series!=null && series.size() > seriesIndex) { Series<D> s = series.get(seriesIndex); if(s instanceof LineSeries) { JSONObject lineDataObject = new JSONObject(object); double x = lineDataObject.get("x").isNumber().doubl...
f5174bd2-f264-45eb-a012-58b033262ce5
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
d4484760-132a-4351-817d-c0e607b281a4
8
@Override public void start(final Stage primaryStage) throws Exception { this.primaryStage = primaryStage; this.root = new VBox(); root.setAlignment(Pos.CENTER); root.setSpacing(10); root.setPadding(new Insets(10, 10, 10, 10)); HBox settings = new HBox(); settings.setSpacing(20); settin...
3b3a33fa-b068-4c32-8536-5fd7b89a0b2b
3
public final static void plot(String[] files) throws PlotterException { for(int i= 1; i< files.length; ++i) { try { File file= new File(files[i]); double[] values= LoadRhythmHistogram.getValues(file); HistogramPlotter hp= new HistogramPlotter(values, file.getName()); hp.drawFrame(); } c...
8eaf4cb4-f0db-415f-a2b4-3185cbd58e1e
3
public int [] svmTest(Problem test) { if (test == null) return null; int [] pred = new int[test.l]; for (int i=0; i<test.l; i++) { pred[i] = (svmTestOne(test.x[i])<0?-1:1); } return pred; ...
13600da0-6258-41e7-8b10-f4b692b640fc
2
public boolean isReference() { return type != null && (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY); }
d2d06f46-9e8b-4bf7-b9d5-0cef3a1bbdbd
9
public static com.google.protobuf.BlockingService newReflectiveBlockingService(final BlockingInterface impl) { return new com.google.protobuf.BlockingService() { public final com.google.protobuf.Descriptors.ServiceDescriptor getDescriptorForType() { return getDescriptor(); ...
9b8adc08-6d09-4029-af8b-a7501fb8daac
9
public static int findMax(int[][] matrix) { int[][] ps = buildPartialSumMatrix(matrix); System.out.println("partial sum matrix"); AssortedMethods.printMatrix(ps); int maxSum = Integer.MIN_VALUE; for(int i=0; i<matrix.length; i++){ for(int j=0; j<matrix[i].length; j++){ for (int i2 = i; i2 < matrix.len...
7f9c3cce-f51c-4d55-98a8-bbcc71209848
6
@EventHandler public void EnderDragonWeakness(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.getEnderDragonConfig().getDouble("End...
c6b0c0d8-237b-4d13-8a9f-40e5c065dc59
6
public static void main(String[] args) throws IOException { CFG cfg = new CFG(); ArrayList<CFG_Graph> graphs = cfg.cfgMaker("bin/com/csci599/project/", "Condition"); System.out.println("CFG Size: " + graphs.size()); int i = 1; for (CFG_Graph graph : graphs) { // LocalVariable[] localVariables = graph....
bd31c4a4-cf70-4e0c-829f-613d8b45fc7f
9
public void makeMaze() { Random rand = new Random(); for(int q=0; q<act_rows-1; q++){ //for all rows but the last one if(q != 0){ /* get the current row from the last iteration */ for(int i=0; i<current.length; i++){ current[i] = next[i]; next[i] = UNDETERMINED; } ...
b08101a4-edef-48f0-a50c-e3ab631e286e
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); do { line = in.readLine(); if (line == null || line.length() == 0) break; int times = Integer.parseInt(lin...
6e638536-d369-404f-8e1a-45ba06289521
3
public static ArrayList<QuestionBean> getQuestions(String testid) { // TODO Auto-generated method stub try { ArrayList<String> qidlist=new ArrayList<String>(); ArrayList<QuestionBean> qlist=new ArrayList<QuestionBean>(); con=DBConnection.getConnection(); Statement stmt=con.createStatement(); ResultS...
77df1118-858c-4562-a8c2-c0551c11e18d
3
public void calculateResults() { resetCounts(); for (URL url : urls) { if (url.getURLType() == URLType.Page) { sumPages++; } else if (url.getURLType() == URLType.Document) { sumDocuments++; } else { ...
a9e6b821-b4de-4551-a4ff-8f3e01ba3c0a
8
public static String unescapeHTML4(String str) { if (str == null) return null; int index = 0; Integer cCode; while ((index = str.indexOf('&', index)) != -1) { int index2 = str.indexOf(';', index + 1); if (index2 == -1) return str; if (str.charAt(index + 1) == '#') { int result = 0; ...
3500b132-d684-49d4-9e2a-aa52d6d7127e
2
public List<Node> Colorize() { List<Node> linkedNodes = new ArrayList<Node>(); /*для всех смежных узлов*/ for (Node node : adjacentNodes) { /*если узел не просмотрен*/ if (!node.IsVisited()) { /*покрасить в цвет основного узла*/ node.SetCom...
613e7db2-f803-429f-80f2-f3a8d4e89ed2
3
public void setJoint(boolean isJoint) { if (this.isJoint == isJoint) return; if (isJoint) { this.isJoint = true; } else { try { this.isJoint = false; this.deleteArray("aWaitingId"); this.deleteArray("aAcceptedId"); this.deleteArray("aRejectedId"); } catch (SQLException e) { ...
9c9bb5e1-d3c3-4a05-a8ab-0b55170da7ac
9
@Override public boolean mover(int xIn, int yIn, int xFin, int yFin) { for (int aux = 0; aux < 8; aux++){ if ((xIn+aux == xFin) && (yIn+aux == yFin)) return true; if ((xIn-aux == xFin) && (yIn-aux == yFin)) return true; if ((xIn+aux == xFin) && (yIn-aux == yFin)) return true; if ((xIn-aux == xFin) &&...
0ea52ef3-24a9-4aa1-849c-620dcf14a858
2
public void persistVendor(Vendor vendor) { String sqlStatement; // SQL statement to persist the student // could pass a student object in as parameter to this method dao.connect(); sqlStatement = generateInsertStmt(vendor); if(dao.getErrorLogs().getErrorMsgs().size() == 0){ dao.executeUpdate(sqlStateme...
51de9f1b-097c-412f-96c2-dbc12f1c1e59
2
public Set<BankAccount> getAccountsSatisfying(Checker<BankAccount> checker) { Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) if (checker.check(account)) result.add(account); return result; }
4458b4a2-9151-4113-a9ce-f981e1c3f2a2
7
public void DumpAPILinks( List<ClassDocumentation> docs, String outFile ) { try { FileWriter fw = new FileWriter(outFile); for( ClassDocumentation doc : docs ) { String packName = doc.Klass.ParentPackage.Name; String klassName = doc.Klass.Name; for( ThreadElement thread : doc.getValidatedThre...
ca2c7313-1c13-4a25-a9ef-5a442cc631fb
4
@Override public void deserialize(Buffer buf) { short flag1 = buf.readUByte(); hasRights = BooleanByteWrapper.getFlag(flag1, 0); wasAlreadyConnected = BooleanByteWrapper.getFlag(flag1, 1); login = buf.readString(); nickname = buf.readString(); accountId = buf.readInt(...
a98ed9d3-74fe-43a2-8026-c964a6cb5775
5
@Override public void enable(boolean force) { // Make sure MobManager is enabled if (P.p() == null || !P.p().isEnabled()) { throw new IllegalStateException("MobManager must be enabled to enable Abilities"); } // Check if the Spawner is already enabled if (this.isEnabled()) { throw new IllegalSt...
b450cfee-2029-49ad-9a73-d0ac7ac35a37
0
public String getLastName() { return lastName.get(); }
7616c846-71ab-419f-a744-b878920dc06e
7
protected String instanceToString(Instance inst) { StringBuffer result; Instance outInst; int i; String field; result = new StringBuffer(); if (inst instanceof SparseInstance) { outInst = new DenseInstance(inst.weight(), inst.toDoubleArray()); outInst.setDataset(inst.datas...
4376fa26-3933-4eb8-9dbe-6b1085a79861
7
public int computeNextAge(int currentAge){ if (currentAge < -100){ return currentAge + 100; } else if (currentAge == -100){ return -1; } else if (currentAge == -1){ return 1; } else if (currentAge == 1){ return 50; } else if (currentAge < 1750){ return currentAge + 50; } else if (currentA...
5ddf6a6a-eb50-4ac6-9145-95ab38d7c1b2
7
private int helper(int n, int m, int[][] men, int[][] obstacleGrid) { if (n <= 0 || m <= 0) { return 0; } //the start position, if not obstacle, return 1 if (n == 1 && m == 1 && obstacleGrid[0][0] != 1) { return 1; }//else will be check in the recursive e...
382ba7a8-4645-4aec-922f-0b8587673188
6
public void incrementCountCategories(int type, String word, Term key, Map<String, Integer> map, Integer line_number, Integer word_number) { Logger.getGlobal().fine("," +type + "," + word + "," + key.getCategory() + "," + key.getTerm()); if (map.containsKey(key.getCategory())) { ...
d7024683-2cab-4d5c-a3d4-7181c00eef5e
2
private String traerPrimerObjetivoAComprobar(Regla reglaAPuntoDeComprobarse) { for (String obj : reglaAPuntoDeComprobarse.getCausantes()) { if (!isElementoEnListas(obj)) { return obj; } } return null; }
c6317ad8-4a72-4356-9f34-b89e94b056ae
5
private RegularExpression readRE(File file) { String rstring = ""; // If nothing found, RE is blank. try { BufferedReader reader = new BufferedReader(new FileReader(file)); String line = null; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.startsWith("#")) continue; ...
e255f033-e8ba-45ce-9ae4-ca1d11dc8e74
9
private void BtIncluirProdutoCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtIncluirProdutoCompraActionPerformed boolean inclui = true; limpar.Limpar(TbCompraServ); TfQuantidadeKeyReleased(null); TfValorTotalCompraServ.setValue(BigDecimal.ZERO); if (!Tf...
2283935e-79db-468a-8872-afe33949f795
7
@Override public void update(GameContainer gc, int delta) throws SlickException { for (int i = 0; i < entityList.size(); i++) { entityList.get(i).update(gc, null, delta); } boardSpawn.update(delta); for (int i = 0; i < boardSpawn.getEnemies().size(); i++) { boardSpawn.getEnemies().get(i).update(gc, null...
9f09ad18-5a8d-47c8-8863-6ba64a857b04
1
public void register(long eventType, IGameEventListener listener) { if(!eventListeners.containsKey(eventType)) { eventListeners.put(eventType, new ArrayList<IGameEventListener>()); } eventListeners.get(eventType).add(listener); }
f84d8f05-0bc1-485c-91d4-cd6b9780aecb
5
public int findNthCatalanNumber(int N) { if(N>2) { int C[] = new int[N+1]; C[0] = C[1] = 1; for(int i=2; i<=N; i++) { C[i]=0; for(int j=0; j<i; j++) C[i]+=C[j]*C[i-j]; } return C[N]; } else if(N==1 || N==2) return 1; else return -1; }
eebecb96-e59c-4b3f-810b-4b0fa1ba8eea
8
private boolean r_factive() { int among_var; // (, line 132 // [, line 133 ket = cursor; // substring, line 133 among_var = find_among_b(a_7, 2); if (among_var == 0) { ...
ec593aec-16d8-4b35-ba02-a43ff744788b
6
@EventHandler public void SpiderJump(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.getSpiderConfig().getDouble("Spider.Jump.Dodge...
f84579dc-4ffe-40bf-917c-b9b5d26d8510
6
@Override public boolean equals(Object obj) { // TODO Codeoptimierung if (this == obj) return true; if (obj == null) return false; Card other = new Card((CardType) obj); if (this.treasure != other.getTreasure()) { return false; } for (Integer ID : this.getPin().getPlayerID()) { if (!other.get...
c1e89a3d-759d-4620-b841-d28107d32454
0
public static void main(String[] args) throws UnknownHostException, IOException { Socket s = new Socket("localhost", 2048); OutputStream outputStream = s.getOutputStream(); DataOutputStream dos = new DataOutputStream(outputStream); dos.writeLong(System.currentTimeMillis()); s.close(); }
bffb7419-b615-4f6d-8d43-0978e52877c0
9
public void acquire() { Lib.assertTrue(!isHeldByCurrentThread()); int p; boolean intStatus = Machine.interrupt().disable(); KThread thread = KThread.currentThread(); if(useSPS) temp.printTryLock(thread, this); // check if highest priority can be chang...
47ba17c2-d206-45f8-a13b-ec02349a58e2
9
public void login() { System.out.print("\nAre you a new user? (yes/no) "); String yn = sc.nextLine().toLowerCase(); while (!yn.equals("yes") && !yn.equals("y") && !yn.equals("no") && !yn.equals("n")) { System.out.println(yn + " is incorrect input, try again...."); System.out.print("Are you a new user? (...
58dcfbcd-325e-4fe3-a901-ecc65e4937ad
8
public static void main(String args[]) throws IOException { Loader.Load(); System.out.println("Welcome. Enter number of players: "); Scanner reader = new Scanner(System.in); String input = reader.nextLine(); int amountOfPlayers = Integer.parseInt(input); System.out.println("Welcome. Enter number of round...
f2fc6f3e-8698-470a-a1f8-4d8dc24a9ada
8
private void setLinear() throws Exception { //then set default behaviour for node. //set linear regression combined with attribute filter //find the attributes used for splitting. boolean[] attributeList = new boolean[m_training.numAttributes()]; for (int noa = 0; noa < m_training.n...
dff47b6a-6467-4996-a899-2265d6992561
4
@Override public int partition(int[] array, int pivotIndex, int b, int e) { int pivot = array[ pivotIndex ]; // Using an auxiliary table (easier to understand, but memory impact is // greater) int copyB = 0; int copyE = e - b; int[] copyArray = new int[e - b + 1]; for (int i = b; i <= e; ++i) { if (i...
ac8b501e-6b00-4260-9c90-51273166a2c0
2
@Override public int compare(KeyFrame k1, KeyFrame k2) { if(k1.frameNum > k2.frameNum){ return 1; } else if(k1.frameNum == k2.frameNum){ return 0; } return (-1); //throw new UnsupportedOperationE...
b5ded7c9-27c4-4693-9427-6e780252e48c
0
public static void setBreedingProbability(double newBREEDING_PROBABILITY) { BREEDING_PROBABILITY = newBREEDING_PROBABILITY; }
41e3372a-8f9c-46a9-9e72-4616f2ed9d57
2
private void isLegal() { if ((null == operator) || (null == validator)) { throw new IllegalStateException("Illegal Unary Operator."); } }
47783f72-ac90-4097-9cea-cc91c4187382
5
public static boolean isMyChessmen(final ChessBoardEntity aBoard, final PositionEntity p) { boolean result = false; if (null != p) { List<ChessmenEntity> chessmens = aBoard.getChessmens(); for (ChessmenEntity c : chessmens) { if (c.isPlayer()) { if (p.getX() == c.getPosition().getX() && p.getY() == c...
2e3e0f95-3bba-4be2-9022-a3a300dd970a
5
private static String downloadChecksum(String addr, int numTries) { final int BUFFER_SIZE = 32; BufferedInputStream bis = null; ByteArrayOutputStream baos; try { URL url = new URL(addr); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); ...
6fb17b84-1f00-4fbd-beec-46985ce9b605
6
private boolean versionCheck(String title) { if(type != UpdateType.NO_VERSION_CHECK) { String version = plugin.getDescription().getVersion(); if(title.split(" v").length == 2) { String remoteVersion = title.split(" v")[1].split(" ")[0]; // Get the ...