method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8da9b8f2-1fbc-4043-9fb8-fc493d03508a
0
short getNumber() { return number; }
13916ff6-94a1-469b-978d-3d31a228f8da
0
public Land getSecondLand() { return second_land; }
e6c1f2ae-f8e0-4dc0-82c0-9518e1fefc8a
1
Item newInteger(final int value) { key.set(value); Item result = get(key); if (result == null) { pool.putByte(INT).putInt(value); result = new Item(index++, key); put(result); } return result; }
301d85d1-ed86-4802-80af-5d67ed7f4667
0
public Point transformFromAutomatonToView(Point point) { return (Point) transform.transform(point, new Point()); }
499cd7d3-1dfe-4fd4-89f2-93f6ae33f390
0
public static void question7() { /* QUESTION PANEL SETUP */ questionLabel.setText("What is your favourite drink?"); questionNumberLabel.setText("7"); /* ANSWERS PANEL SETUP */ //resetting radioButton1.setSelected(false); radioButton...
efe6b69e-1678-40fb-b0c1-699786b976dc
6
private MazeRoomEnterBehavior getBehavior(RoomType roomType){ MazeRoomEnterBehavior enterBehavior; switch(roomType){ case DOOR: enterBehavior = new DoorRoomEnterBehavior(); break; case EXIT: enterBehavior = new ExitRoomEnterBehavior(); break; case PATH: if(rand.nextDouble() >= .5) enterBeha...
d353ba60-f2a5-4248-a194-fe9ff1f667f8
0
public void setAge(String age) { this.age = age; }
48638cd5-14b4-4ba4-bb72-c8659ac2b785
6
private static BufferedImage[][][] createImagesFiende() { BufferedImage[][][] bilder = null; BufferedImage[] imgs0 = Bilder.naziN; BufferedImage[] imgs1 = Bilder.naziE; BufferedImage[] imgs2 = Bilder.naziS; BufferedImage[] imgs3 = Bilder.naziW; BufferedImage[] imgs4 ...
7430e9b3-4133-4da0-83cd-3d758867109d
3
private static void findPatternInFile( File src, String pattern, Vector<Match> matches, MVD mvd ) throws Exception { short vId = mvd.getVersionByLongName( src.getName() ); if ( vId != -1 ) { int length = (int)src.length(); FileInputStream fis = new FileInputStream( src ); byte[] data = new byte[lengt...
698f0a21-f817-4242-a9d9-f135d25f55a8
1
public static void spawnHellhound (Location loc, int amount) { int i = 0; while (i < amount) { Wolf hound = (Wolf) loc.getWorld().spawnEntity(loc, EntityType.WOLF); hound.getEquipment().setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) - 98789)); hou...
e888859d-dd9c-49ec-aca6-4ab5ad05126e
9
void addRecipe(ItemStack var1, Object ... var2) { String var3 = ""; int var4 = 0; int var5 = 0; int var6 = 0; if(var2[var4] instanceof String[]) { String[] var7 = (String[])((String[])var2[var4++]); for(int var8 = 0; var8 < var7.length; ++var8) { String var9 ...
7121c8fc-5039-4175-bf97-ca6c838a84ab
9
private void destroyBonds() { if (bonds != null && !bonds.isEmpty()) { synchronized (bonds.getSynchronizationLock()) { for (Iterator it = bonds.iterator(); it.hasNext();) { ((RadialBond) it.next()).destroy(); } } } bonds.clear(); if (bends != null && !bends.isEmpty()) { synchronized (bends...
6c3888e8-9845-4d9f-a9d6-30e20a5040c4
6
public void zoneEventOccurred(String eventZone, int eventType){ // If within the bounds of the text, go to the link if(eventType==ZoneEvents.ENTER && eventZone.equals("polygon")){ Gui.changeCursor(Cursor.HAND_CURSOR); } else if (eventType==ZoneEvents.CLICK && eventZone.equals("polygon")){ // Adde...
df8ebe77-ecf2-4d4e-b3c5-82e2580bd759
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; ...
3fc69a7c-e512-4cc8-8bc3-70c0f6858048
3
public static boolean containsFeet(Point f1){ for (int i = 0; i < PlatformManager.floors.size(); i++){ if (PlatformManager.floors.get(i).contains(f1) && PlatformManager.floorLevel.get(i) == GameManager.level){ return true; } } return false; }
a0928cc4-0db8-41d7-81c0-6cbf84aba699
3
private static void eliminarCliente() { boolean salir; Integer idCliente; char caracter; do { try { System.out.print( "Introduce el Id del cliente: "); idCliente = Integer.parseInt( scanner.nextLine()); System.out.print( "Deseas eliminar todas las cuentas en tiendas del cliente ...
45b75100-86af-4406-a8f5-f44417d966ee
6
public static void main(String[] args) { try { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile()); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConf...
60e80820-1dcb-4497-b4b4-068c1345d508
2
private HubNode getBusOf (Device dev) throws IOException { Bus bus = dev.getBus (); for (int i = 0; i < busses.length; i++) { if (bus == busses [i]) return hubs [i]; } System.err.println ("what bus ??"); return null; }
9027adf7-5ff9-4d1a-9ed7-311835b0b626
2
public String getText() { StringBuffer sb = new StringBuffer(); try (BufferedInputStream in = new BufferedInputStream( new FileInputStream(new File(path)))) { int c; while ((c = in.read()) != -1) { sb.append((char) c); ...
8b17c294-b1ee-4a1c-b27f-f7b83ab43f62
9
public void activateEmbeddedMovie(boolean b) { if (b) { if (job != null && !job.contains(movieUpdater)) job.add(movieUpdater); int m = movieUpdater.getInterval(); modelTimeQueue.setInterval(m); kine.setInterval(m); pote.setInterval(m); tote.setInterval(m); int n = movie.getCapacity(); setQ...
88ab5625-1c40-4913-85d5-412bf2cbb63c
9
private int nextChunk() throws IOException { int available = super.available(); // must always try to read 1 byte! // some buggy InputStreams return < 0! if (available <= 0) { available = 1; } if (available > inBuf.length) { ...
96c0137a-4129-4de1-b19a-2eef270b70e7
4
private static void addCollection(Collection<ATask> task){ Session session = HibernateUtil.getSessionFactory().openSession(); try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); for(ATask o : task) session.save(...
a88bb484-9df7-4728-9e92-6a5c409a8e65
9
public void csv(){ Grid g1 = hierarchyGrids.getGrid(1); GridNode[] n = g1.nodes; Map<Integer, Integer> ClustersFine = new HashMap<Integer, Integer>(); System.out.println(); System.out.println("F-POINTS:"); for(GridNode f : n){ if(f.type == NodeType.F){ System.out.print(f.id+1 + " "); } } Sy...
39232c4c-5a3d-4333-94e7-aad0abc45ce6
6
@Override public void save(ObjectOutput out) throws IOException { out.writeShort(ints.length); for(int i:ints){ out.writeInt(i); } out.writeShort(longs.length); for(long l:longs){ out.writeLong(l); } out.writeShort(floats.length); for(float f:floats){ out.writeFloat(f); } out.writeShort(do...
3fafc112-8b2d-47cb-9a5b-85b9fad8d2ae
8
protected Object getParentElement(Object element) { boolean oldBusy = isBusy(); setBusy(true); try { if (contentProviderIsLazy && !contentProviderIsTreeBased && !(element instanceof TreePath)) { ILazyTreeContentProvider lazyTreeContentProvider = (ILazyTreeContentProvider) getContentProvider(); return l...
6c23270d-1258-4b0d-a9ac-0d91e2d2bca9
5
public CachedRowSetImpl executeQuery() throws SQLException { String sql = ""; CachedRowSetImpl crs = new CachedRowSetImpl(); if (isGetAll()) { sql = SELECT + getQueryBuilder().getSelectValue() + FROM + getQueryBuilder().getTableName() + ";"; try { getConnection(false); sqlStatement = getConn().prep...
82b127d2-0851-4e6b-bfee-3966b718f409
1
public String toString() { return this.mode == 'd' ? this.writer.toString() : null; }
9d767be4-a8a1-4fd4-874e-66a1597d327e
0
public ContactEntity getContact() { return contact; }
4bf28e64-0282-45e6-b1fc-75905c2d75c8
0
public javax.swing.JTable getTabla(){ return this.tabla; }
e2498a35-c456-431a-ac9c-f092b3733851
7
public final EsperParser.ifthenelse_return ifthenelse() throws RecognitionException { EsperParser.ifthenelse_return retval = new EsperParser.ifthenelse_return(); retval.start = input.LT(1); Object root_0 = null; Token ENDIF30=null; EsperParser.if__return if_27 =null; ...
f42b8837-19e2-4ba2-8a34-443c9eaed912
3
public void showGroupMembers (String group, CommandSender sender) { ArrayList <String> players = new ArrayList <String> (); Player [] player = Bukkit.getServer().getOnlinePlayers(); for (int i = 0; i < player.length; i++) { if (config.getConfig().getString("Player."+player[i].getName()+".CR").equalsIgnoreCase(...
7514014d-c8b0-4a8d-9dbc-b979101a1e1e
0
public MainController() { }
7383d325-bd4a-4d16-b921-74af82a06a97
9
@Override protected void process(Entity e) { Position pos = rectplayermap.get(e); int height = container.getHeight(); int width = container.getWidth(); Input input = container.getInput(); // AXE VERTICAL { if (input.isKeyDown(Input.KEY_UP)) { if (pos.getY() - VELOCITE >= 0) { pos.setY(pos....
ab9ddbdf-88fe-4990-b2e7-2982db9e95a5
1
public Move getLastMove() { return this.moveList.size() > 0 ? this.moveList.get(this.moveList.size() - 1) : null; }
3c33e1be-e379-4f45-97b0-4ee2b94519f0
4
public static void main(String[] args) { // read class name from command line args or user input String name; if (args.length > 0) name = args[0]; else { Scanner in = new Scanner(System.in); System.out.println("Enter class name (e.g. java.util.Collections): "); ...
7d48f934-b780-4939-8c37-ae5a27d1548d
6
public static boolean checkKing() { if(player=="black") for(int y=0;y<7;y++) if(pieces[0][y]==-1) return true; else if(player=="white") for(int a=0; a<7; a++) if(pieces[7][a]==1) return true; return false; }
25ae2020-687e-4f1d-b0aa-19e20a2d599d
3
public LocalDate getEventLocalDate(int meetingsAway) { LocalDate thisMeeting = (weekOfMonth != LAST) ? now.with(TemporalAdjusters.dayOfWeekInMonth(weekOfMonth,dayOfWeek)) : now.with(TemporalAdjusters.lastInMonth(dayOfWeek)); // Has the meeting already happened this month? if (thisMeeting.isBefore(now)) { ...
c10e57b1-74cf-4de6-85b4-ed700d74a81b
5
public int[] getPos() { if(protons == 1) return new int[] {0, 0}; int thisRow = 0, thisCol = 0; boolean breakOut = false; for(int row = 0; row < periodicTable.length; row++) { for(int col = 0; col < periodicTable[0].length; col++) { if(periodicTable[row][col] == protons) { thisRow = ...
c4a5e6e0-6007-4cfb-98e5-f27f4cf5694f
8
public void mainMenu() { int valg = -1; while(valg < 0 || valg > 5) { System.out.println("=========Logged in as " + user.getName() + "========="); startUpInvitations(); System.out.println("0: Log out"); System.out.println("1: Appointment manager"); System.out.println("2: Group management"); Sys...
099bfc91-bbd9-44df-a4f1-23d386b13a51
8
public OptionsPanel(Frame parent) { super(parent); setModal(true); JPanel panel = new JPanel(new BorderLayout()); JLabel label = new JLabel("Настройки", 0); label.setBorder(new EmptyBorder(0, 0, 16, 0)); label.setFont(new Font("Default", 1, 16)); panel.add(label, "North"); JPanel op...
ce02de68-2b0f-4553-a60b-ebe7ca78ca68
8
private void checkBurntState() { //used to make talking heads burn if (isOnFire() == false && !burned) { return; } if (burnedFeet == true) { burnedDontMove = true; return; } if (isOnFire() == true) { if (!cooked) { cookTimer = cookTimer + 1; //this is all used to trigger the bur...
beff7f93-10ac-4098-86e8-a1364f88e319
2
private static void playerInventory() { System.out.println("Player Inventory"); for (int i = 0; i < playerInventory.length; ++i) { if (playerInventory[i] != null) { System.out.println(i + ":" + playerInventory[i]); } } }
b3b24785-a58a-4238-9097-809513b8e4ce
2
private static void test_strdtoi(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { int exp = (Integer) t.tests[i]; String arg1 = (String) t.tests[i + 1]; i...
d3dfcf9d-ab76-4a64-b43b-971a227c321d
6
private void moveP() { Player player = Main.getGamestate().getPlayer(); if (getY() < player.getY()) { move(0, 1); } else if (getY() > player.getY()) { move(0, -1); } else if (getX() < player.getX()) { move(1, 0); } else if (getX() > player.getX()) { move(-1, 0); } if (getX() == player.getX() &...
2a5bc908-d817-470e-aa7f-0d1247fb4fe8
3
@Override protected void loadNBT(NBTTagCompound data) { super.loadNBT(data); NBTTagList tagList = new NBTTagList(); for (Map.Entry<WorldCoordinate, SignalAspect> entry : aspects.entrySet()) { NBTTagCompound nbt = new NBTTagCompound(); if (entry.getKey() != null && ent...
fafbe5e9-c801-4697-9942-476865c43956
5
private boolean addOwnable(ChunkyObject o) { if (o == null) throw new IllegalArgumentException(); // If owner is a owned by the child, remove owner from tree first. // ex. town.setOwner(Peasant) Peasant is removed from parent (Town). if (this.isOwnedBy(o) && this.owner != n...
f0ed682c-44ba-440c-b35c-81bccdff6b25
4
public Boolean ifExistAuditeur(Auditeur a) { for (int i =0; i<liste.size();i++){ Auditeur ai = liste.get(i); if (ai.getNom().equalsIgnoreCase(a.getNom()) && ai.getPrenom().equalsIgnoreCase(a.getPrenom())&& ai.getDateNaissance().equals(a.getDateNaissance())){ return true; } } ...
2247d7ba-e6e1-4294-a5c1-09eaf61227ae
7
public static void checkRank(Player player) { int kills = player.getKillCount(); for (int i = 0; i < ranks.length; i++) { PkRank rank = ranks[i]; if (rank == null) break; if (rank.username.equalsIgnoreCase(player.getUsername())) { ranks[i] = new PkRank(player); sort(); return; } } fo...
4b0615b9-5c5d-442f-a94a-959b99c25f62
5
private void redraw(Graphics g) { g.translate((int) dx, (int) dy); if (toBeDrawn == null) { if (action != null && action.equals("inventory")) GraphicsRenderer.drawInventory(g, Class_Examples.getChest()); else if (action != null && action.equals("drawRoom")) room.draw(g); } else g.drawImage(toBe...
542fc318-ac3c-42ab-8a6d-bb81160cf113
9
public void flujoEntrada(){ String entra=""; String nickname_input=""; Integer tipo; DES objetoDES = new DES(this.clave); try { while(conectado){ //Leemos el Nickname //entra=(String) entrada.readObject(); //thi...
d8347a3c-202f-4aff-ba08-58651e70feca
6
public FuseArgumentParser(String[] args) { boolean seenOption = false; for (String arg : args) { if (seenOption == true) { remaining.add(arg); seenOption = false; } else if ("-o".equals(arg)) { remaining.add(arg); s...
30017418-bd2f-4b8b-a394-90fac8dd0854
9
*/ public void nextActiveUnit(Tile tile) { if (!requireOurTurn()) return; // Always flush outstanding messages first. nextModelMessage(); //if (canvas.isShowingSubPanel()) { // canvas.getShowingSubPanel().requestFocus(); // return; //} // Flush...
c6623523-9ce3-4dad-b4e6-67ffd0f061e5
9
public UnconditionalFlowInfo unconditionalFieldLessCopy() { // TODO (maxime) may consider leveraging null contribution verification as it is done in copy UnconditionalFlowInfo copy = new UnconditionalFlowInfo(); copy.tagBits = this.tagBits; copy.maxFieldCount = this.maxFieldCount; int limit = this.maxFieldCount; ...
2426dac5-17db-4578-9e74-bbee29d2d78f
0
public void update(int id, TravelTrip travelTrip){ TravelTrip travelTripTemp = findById(id); travelTripTemp.setCountry(travelTrip.getCountry()); travelTripTemp.setCity(travelTrip.getCity()); travelTripTemp.setFromDate(travelTrip.getFromDate()); travelTripTemp.setToDate(trav...
0cd752eb-d62d-427b-bd8a-461a08881cdf
5
private void incrementTurn() { index++; for (int i = index;; i++) { index = i % numPlayers; if (players[index].isLiving()) break; } if (index == firstPlayerIndex) { updateRound(); round++; log("Beginning Round " + round); } playerPnlHash.get(activePlayer).setActive(false); activ...
a15993a2-9825-406e-b317-9b976a2e5d20
4
private static int method516(char ac[], int j) { for (int k = j; k < ac.length && k >= 0; k++) if (ac[k] < '0' || ac[k] > '9') return k; return ac.length; }
182b5bb9-9b8e-452f-aa82-a7d2a0794f7b
0
public void setFunConsumoUltimoMes(Integer funConsumoUltimoMes) { this.funConsumoUltimoMes = funConsumoUltimoMes; }
3b2f5e7a-5ff9-4442-a0bd-e1b1d099b002
9
public void DBUpdateRoomItem(String roomID, Item item) { if((roomID==null)||(!item.isSavable())||(item.amDestroyed())) return; synchronized(roomID.toUpperCase().intern()) { DBDeleteRoomItem(roomID,item); if(Log.debugChannelOn()&&(CMSecurity.isDebugging(CMSecurity.DbgFlag.CMROIT)||CMSecurity.isDebugging(...
b7e81ffb-0617-4fd5-aac0-6aefc6442a76
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; ...
31f6f7f9-4c10-48a4-918f-68125ae5e2b0
9
void run(){ Scanner sc = new Scanner(System.in); for(;;){ h = sc.nextInt(); w = sc.nextInt(); if((h|w)==0)break; m = new int[h][w]; dist = new int[h][w]; dir = new int[100]; for(int i=0;i<h;i++)for(int j=0;j<w;j++){ m[i][j] = sc.nextInt(); if(m[i][j]==0)c++; if(m[i][j]==2){ ai = i...
8c97961d-316b-4b65-a2c1-02fbf153bc67
6
public void Solve() { int[] initialArray = new int[10]; for (int i = 0; i < 10; i++) { initialArray[i] = i; } List<int[]> pandigitalNumbers = Enumerate(initialArray, 0); long sum = 0; int[] divisors = new int[]{2, 3, 5, 7, 11, 13, 17}; for (Iterator<...
0037e31c-e0f1-4a93-a2d6-e697aa45f005
2
public void visitIntInsn(final int opcode, final int operand) { buf.setLength(0); buf.append(tab2) .append(OPCODES[opcode]) .append(' ') .append(opcode == Opcodes.NEWARRAY ? TYPES[operand] : Integer .toString(operand)).append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitIntIn...
ca85c028-3532-450f-81ed-296d7c5af42c
5
@SuppressWarnings({ "rawtypes", "unchecked" }) private <K> BeanEvent<K> updateBeanEvents(Class<?> beanClass, Class<K> listener) { BeanEvent result = null; try { for (EventSetDescriptor ed : Introspector.getBeanInfo(beanClass) .getEventSetDescriptors()) { BeanEvent be = new BeanEvent(ed); event...
2c905a2c-bab3-4ba9-97da-d28b9f86b1c1
2
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: String str2; DefaultListModel md = new DefaultListModel(); str2 = this.jTextField9.getText().toUpperCase(); if(Biblio.containsKey(...
9407348b-a207-445b-ab24-2d267ad6f4c6
9
@Override public boolean liiku(Ruutu kohde) { Ruutu ohestalyotava = null; if (this.ruutu.getSijainti().xMuutos(kohde.getSijainti()) != 0 && kohde.getNappula() == null) { ohestalyotava = lauta.getRuutu(kohde.getSijainti().getX(), this.ruutu.getSijainti().getY()); } int vuo...
622b7808-b76b-492f-bcbb-126d54972ec9
9
@Override protected EncryptionKey send(final String sessionId, final String orderId, final PaymentForm form, final CommodityDetail[] commodityDetail) throws NoSuchAlgorithmException { log.info("POST送信開始"); try { // AIRWEBはクライアント証明書を配布しない HttpsURLConnection.setDefa...
0ba88695-c6b3-4759-b6e4-b3615580d10b
3
private boolean jj_3R_41() { if (jj_scan_token(WHILE)) return true; if (jj_3R_50()) return true; if (jj_scan_token(DO)) return true; return false; }
60b1e3e0-c40e-4f9e-9d0e-c0293be1ccb3
9
public Site getAdjByTag(Site site, SiteTag tag) { int x = site.x; int y = site.y; switch (tag) { case NORTH: y--; break; case EAST: x++; break; case SOUTH: y++; break; case WEST: x--; break; } if (this instanceof TorusSpace) { x = x % width; y = y % height; return getSite(x, y); } else { ...
b9d324c2-3a1b-41b1-9bf1-c99ea11dae9f
4
public boolean checkLoan(Loan l, final Inventory i) { Borrower bwer = l.getBorrower(); Period period = l.getPeriod(); Equipment stuff = i.findAvailableEquipment(l.getModel()); final int LOAN_DURATION_LIMIT; final int LOAN_RESERVATION_LIMIT; // Checks if the loan is valid...
d2eca90b-11bc-46cc-9868-691ea428ac7d
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "RecipientKeyInfo", scope = AgreementMethodType.class) public JAXBElement<KeyInfoType> createAgreementMethodTypeRecipientKeyInfo(KeyInfoType value) { return new JAXBElement<KeyInfoType>(_AgreementMethodTypeRecipientKeyInfo_QNAME, KeyInf...
81d24912-0d7f-4c72-ba9c-f3c41726ba40
8
final void method3643(Canvas canvas, int i, int i_195_) { do { try { anInt7955++; if (canvas == ((NativeToolkit) this).aCanvas7925) throw new RuntimeException(); if (aHashtable8014.containsKey(canvas)) break; if (!canvas.isShowing()) throw new RuntimeException(); try { Class var_...
c8ccb349-fc45-40d0-916e-c08fd4d75928
9
public void registerMany(Kim kim) { int length = kim.length; int limit = this.capacity - this.length; if (limit > JSONzip.substringLimit) { limit = JSONzip.substringLimit; } int until = length - (JSONzip.minSubstringLength - 1); for (int from = 0; from < until...
684c74fd-ffb4-4b8f-942c-f6b45cc231f7
3
public synchronized void gridletPause(int gridletId, int userId, boolean ack) { boolean status = false; // find this Gridlet in the execution list int found = gridletInExecList_.indexOf(gridletId, userId); if (found >= 0) { // update Gridlets in execution list up...
6060bf6f-82ec-4f5b-86b4-ddb6daa4bb31
6
private boolean AvoidGrenade(Info info){ for(int i=0;i<info.getEnemies().size();i++){ double angle = 0; int e_x = info.getX(); int e_y = info.getY(); int my_x = info.getEnemies().get(i).getX(); int my_y = info.getEnemies().get(i).getY(); ...
c5c58eb8-3751-44ab-baee-853011c29d3b
2
@Override public void initialize(String filePath){ patternEncoderUtil = new PatternEncoderUtil(); try { setUtil(patternEncoderUtil); analyzePattern(new FileReader(filePath)); } catch (FileNotFoundException e) { e.printStackTrace(); } try { ...
b3441619-f2fe-4288-a571-f7ba2b5102e8
4
private int sendClearCommand() throws Exception { int c; ArrayList<Integer> answer = new ArrayList(); this.output.flush(); Thread.sleep(this.MAX_INTERVAL * 10); this.output.write((char)Sign.REQUEST); this.output.flush(); Thread.sleep(this.MAX_INTERVAL * 3);...
0900376d-8f6f-4895-9a25-d1428a73e95d
8
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TNode<T> tNode = (TNode<T>) o; if (center != tNode.center) return false; if (character != tNode.character) return false; if (left != tNode.left) return false; if (right != ...
84d32726-7d51-499e-8740-b9083e592e10
9
public static void main(String args[]) throws Exception { try { //int depth=Integer.parseInt(args[2]); int depth=3; FileReader in = new FileReader(args[0]); BufferedReader br = new BufferedReader(in); String test=br.readLine(); FileWriter out = new FileWriter(args[1]); BufferedWriter write = new Bu...
10aed8c1-39c3-42b7-94c2-2ad0909beae5
8
private void verificarSeleccionParametricasTransformador() { if (puntoLuz.getTransformador().getTipoTransformador().getId() == null) { puntoLuz.getTransformador().setTipoTransformador(null); } if (puntoLuz.getTransformador().getFabricante().getId() == 0) { puntoLuz.getTr...
4efb15ee-b372-4576-b0d2-fbe28d5081de
6
@Override public void buildFinished(SRunningBuild build) { super.buildFinished(build); if( !build.isPersonal() && build.getBuildStatus().isSuccessful() && slackConfig.postSuccessful() ) { processSuccessfulBuild(build); } else if ( !build.isPersonal() && build.get...
2acb078e-748c-4b82-bbc1-f3e6331f8d25
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...
04135bbc-7640-4375-a202-4e645bf6ba48
0
public List<List<LngLatAlt>> getInteriorRings() { assertExteriorRing(); return coordinates.subList(1, coordinates.size()); }
3772f3f1-8eb0-47ae-a9ab-f1aa0f797517
7
protected void processClauseGraphFragments(List<GraphFragment> matchPhraseList) throws InformationProblem { int matchPhraseCount = 0; for (GraphFragment matchPhrase : matchPhraseList) { if (matchPhraseCount > 0) { _strBuf.append(", "); } List<List<GraphComponent>> matchPhraseGraphComponentList ...
8adbd8d1-11ba-4a9a-b8a5-71ab9eb745bd
2
byte[] getPngData(Image img) { int imageType = artwork.hasAlpha() ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB; // FIXME: Wouldn't it be better to use a BufferedImage and avoid this anyway? BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), imageType); Graphics bg = bi....
5297c440-50a9-4d7f-bf67-8392a2b9cb97
2
public int getX() { if(this == RIGHT) return 1; if(this == LEFT) return -1; return 0; }
220cd771-5122-4303-ab48-1e9f1998b263
5
public int getCount(int number){ if(number > 3){ for(int i=3 ; i < number ; i++){ for(int j=2 ; j < i ; j++){ count ++; if(i%j == 0){ break; } count--; } } number -= (count+2); System.out.println(number); return n...
5a321e5a-9b33-4fe3-aca6-3783245700e2
4
public boolean chequearQuery(String sql) { boolean resultado = false; int indice = sql.indexOf(' '); String tipo = sql.substring(0, indice).toLowerCase(); if (tipo.equals("select") || tipo.equals("insert") || tipo.equals("update") || tipo.equals("delete")) resultado = true; return resultado; }
ea866943-028b-4380-ab57-a5571511347c
9
private ResolvedGenericType resolveSuper(Type genericSuperType) { if (genericSuperType instanceof Class) { return new ResolvedGenericType((Class<?>)genericSuperType, new Class<?>[0]); } else if (genericSuperType instanceof ParameterizedType) { TypeVariable<?>[] typeParameters = getRawType().getTypeParameters(...
25310d47-7937-41bb-a595-09bf301c5e57
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 Employee)) { return false; } Employee other = (Employee) object; if ((this.id == null && other.id != null) || (...
80f38c90-f018-45c1-ae86-eecd4519af0a
5
@Override public <T extends Event> void event(final T event) { for (Class<? extends Event> cls : core.getClasses()) { if (cls.isInstance(event)) { for (@SuppressWarnings("rawtypes") final ControllerListener listener : core.getListeners(cls)) { Runnable r = new Runnable() { @SuppressWarnings("un...
949b1a61-4d6e-4596-8e9e-9074276ce933
6
@SuppressWarnings("unchecked") void readRegulationTrack(String regTrack) { //--- // Read file //--- if (verbose) Timer.showStdErr("Reading regulation track '" + regTrack + "'"); String regFile = config.getDirDataVersion() + "/regulation_" + regTrack + ".bin"; ArrayList<Regulation> regulation = (ArrayList<R...
46d69d9e-b458-4ecc-a1d5-f46cdc3b6f7b
5
@Test public void testInfixToPostfix2() throws DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, BadNextValueException, UnmatchingParenthesisException { try { infix.addLast("*"); infix.addLast("5"); QueueInterface<String> postFix = calc.infixToPostfix(infix); String...
69f48e03-f295-4d85-99ad-2e6940b56845
8
public Vector<LogicalJoinNode> orderJoins( HashMap<String, TableStats> stats, HashMap<String, Double> filterSelectivities, boolean explain) throws ParsingException { // See the project writeup for some hints as to how this function // should work. // some co...
39a36705-6964-4840-9ee9-ccc2ba41d976
9
@Override public void initializeNorm() { checkingNorms(); for ( Action action : getAllActions().values() ) { if ( action.getNormType() != null ) // Only action linked with deontic concept will goona be setted { if ( action.getNormType() == NormType.OBLIGATION ) { if ( getPlayer().containAct...
2901f66c-a855-4577-b93f-1865b4a69b7f
4
public boolean canAttack(Unit enemy) { return enemy != null && enemy.getHP() > 0 && team != enemy.getTEAM() && inRange(enemy) && attacking; }
992ab92f-eecc-480b-9e9f-796b9049a2f7
4
public static int findSmallestDiff(int[] a) { if (a.length < 2) return -1; int diff = (int)Math.abs(a[0] - a[1]); for (int i = 0; i < a.length; i++) for (int j = i + 1; j < a.length; j++) { int tmp_diff = Math.abs(a[i] - a[j]); if (tmp_diff < diff) diff = tmp_diff; } ...
31ab3b6e-dee5-4734-bb3f-f194b7097569
7
@EventHandler public void SkeletonRegeneration(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.getZombieConfig().getDouble("Skeleto...
b3114865-b054-4017-9630-5a63ea79513b
3
public void update(Game game) { actions.clear(); //passive moment. super.updatePassive(); //Get the closest targets closestTargets(game); Direction act = Types.DNONE; if(targets.size() > 0) { //If there's a target, get the path to it and...
1dc3301f-332f-448d-868b-0421e9e34157
4
@Override protected void mutate(Individual i) { Expression e = (Expression) i; Random r = new Random(); if (e.isLeaf()) { ((Leaf) e).rebuild(); return; }// else int d = r.nextInt(e.depth()); int current = 0; int choosen = 0; Expression[] exps = null; while (current < d && !e.isLeaf()) { exps...
db5751b8-6609-4505-a7ac-b1aadafa73b0
5
private <T extends Fetcher> void doFetcher(Collection<T> fs, Map<String, Integer> ignored, Map<String, Integer> offered) throws InterruptedException { for (Fetcher fetcher : fs) { String fetcherKey = fetcher.getClass().getName(); if (fetcher.isIgnore()) { this.getLogger().debug( "ignore fetch...