method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7449cc56-04e7-4edf-a897-d6ce8e2f73d3
9
@Override public void run() { progressBar.setMaximum(gen.getTotal().intValue()); //length is the number of permutations starting with Albany, which are always at the beginning int length = (gen.getTotal().intValue())/numCities; int progress = 0; double shortestDistance = Double.POSITIVE_INFINITY; ...
b0355822-08a7-4d6e-b795-76439d565b3c
3
private void durchlaufe(int pStartknoten, int[] pBesucht) { if (pBesucht[pStartknoten] != 1) { System.out.println(pStartknoten); } pBesucht[pStartknoten] = 1; int[] lNachbar = this.nachbarKnoten(pStartknoten); for (int i = 0; i < lNachbar.length; i++) { if...
228c6341-c5a6-433d-aa12-181620ed2b08
7
public void render(GameContainer gc, Graphics gr) throws SlickException { for (int i = 0; i < entityList.size(); i++) { if (entityList.get(i) instanceof Skill) { entityList.get(i).renderSkill(gc, null, gr, ((Skill) entityList.get(i)).isOnCooldown()); if (((Skill) entityList.get(i)).isOnCooldown()) { t...
a21da306-ad64-4d7f-80bf-8c7d006c491f
3
@Override public void deserialize(Buffer buf) { elementId = buf.readInt(); if (elementId < 0) throw new RuntimeException("Forbidden value on elementId = " + elementId + ", it doesn't respect the following condition : elementId < 0"); elementTypeId = buf.readInt(); int lim...
a1ab0a83-0c06-4642-81e7-71c4fdb3c332
9
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { s.defaultReadObject(); Vector values = (Vector) s.readObject(); int indexCounter = 0; int maxCounter = values.size(); if (indexCounter < maxCounter && values.elementAt(indexCounter).equals("graphModel")) { grap...
b5f1c169-9291-4c35-8502-b992cdaf070b
3
public static void doubleHashing() { System.out.println("START OF DOUBLE HASHING"); statsDouble = new ArrayList<Stats>(); List<Integer> sieve = MakeList.makeEratosthenesSieve(); // System.out.println(sieve); for (Integer aSieve : sieve) { for (int j = 0; j < 50; j+...
3c7f8819-26f5-4e3a-a10a-c2d954913745
3
public synchronized void respond(IRCCommand cmd){ if (cmd == null || cmd == IRCCommand.NONE){ return; } if(cmd == IRCCommand.PONG){ String pong = "PONG " + "Dinosaur" + Main.version; output.write(pong + "\r\n"); //output.flush(); System.out.println(pong); } }
8cbf3d58-cf35-4148-aadc-d49f406f47b2
4
public void transport(Checker c) { if(this.getY() == 0 && c.team == 2) { c.setLocation(this.getX(), 7); Greenfoot.playSound("tunnel.wav"); } else if(this.getY() == 8 && c.team == 1) { c.setLocation(this.getX(), 1); Greenfoot.playSound("tunnel.wav"); ...
924ff3af-23c6-4e54-ab95-9ee12012000b
3
public Missile getNearestMissile(){ double nearestDistance = 100000; Missile nearestMissile = null; for(Missile missile : missiles){ if(missile != null){ if(settings.screenWidth - missile.posY < nearestDistance){ nearestDistance = settings.screenWidth - missile.posY; nearestM...
f5b87b93-10ea-499a-9730-740f8e6e46e4
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { final String s=CMParms.combine(commands,1).toLowerCase(); try { if(CMath.isInteger(s)) { int h=CMath.s_int(s); if(h==0) h=1; mob.tell(L("..tick..tock..")); mob.location().get...
042cfbba-5e8a-41ae-9987-d5449b526a71
0
public void setMessages(List<String> messages) { this.messages = messages; }
96a0aae6-3e94-47d4-91de-a88696091f15
4
public static void checkFainted() { System.out.print("Checking for fainted Pokemon..."); for(int i=0; i<userNumOfPokemon; i++) if(user[i].health<=0) { user[i].health=0; user[i].status=Pokemon.Status.FNT; } for(int i=0; i<enemyNumOfPokemon; i++) if(enemy[i].health<=0) { enemy[i].healt...
881bd9a5-34e9-4b5f-a946-957f23b08b2b
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(target==mob) { mob.tell(L("Um, you could just enter SCORE.")); return false; } if(!super...
d8f1ff82-ed9a-4b10-aebf-1ef67985f12b
7
protected void handleEvent(final Message<JsonObject> event) { if (event.body().getString("subscribe") != null) { try { String destination = event.body().getString("subscribe"); System.err.println("SUBSCRIBE: " + destination); Session session = this.con...
181bb001-c3be-44be-a15d-1d1693587fb0
0
private IautosStatusCode(int code, String desc) { this.code = code; this.desc = desc; }
e70c99bf-c764-4479-a1ac-caf4e3578f1e
6
public static String selectFileExtension(Keyword type) { { String extension = null; { Cons entry = null; Cons iter000 = Stella.$TYPE_TO_FILE_EXTENSION_TABLE$; for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) { entry = ((Cons)(iter000.value)); if (entry.value == typ...
21c2c6b7-912b-49b7-bd48-9e01147e37e2
0
public Long getId() { return id; }
8b5cb0d6-c2d9-4dbe-b478-5137174542e2
2
@Override public Value get(Key key) { for (Node x = first; x != null; x = x.next) { // cmp++; if (key.equals(x.key)) return x.val; } return null; }
361c9b9a-aad5-43c5-b4a8-723e83c97503
9
public static String[] getPhonemeASR(String refWords, String refPhones, String testWav, String lesson) { String[] line = new String[3]; int timeout = 0; int trial = 0; // if (!Globals.installer){ // testWav = "../../" + testWav.replaceAll("\"", ""); // } String j_phcmd = "janus -f janus/phonemes/getUtt...
7f87c974-a7b8-47d4-93f2-bb57aa2544a9
1
public static void main(String[] args) { Shape[] shapes = new Shape[2]; System.out.println("New SHAPES:"); shapes[0] = new Square(4); shapes[1] = new Triangle(); for (Shape shape : shapes) { System.out.println(shape); shape.draw(); System.out.p...
d8c77afa-3e56-4912-b342-7e5d8a766426
6
public static void initialize() { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); UIM...
5959f3c8-b7e7-4f49-87bc-45c3612b7701
8
public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc; ArrayList<String> list = new ArrayList<String>(); int nbAnag; try{ sc = new Scanner(new File("dictionary.txt")); while(sc.hasNext()) { String str = sc.next(); //System.out.print(str+"\n"); list.add(...
ed19f970-9a88-458e-972a-6457a159e143
5
private void addParticipant() { lblError.setVisible(false); Anstalld selAnst = (Anstalld) cbSpecialist.getSelectedItem(); DefaultListModel<Anstalld> dlm = (DefaultListModel<Anstalld>) listParticipantsHolder.getModel(); boolean exists = false; // check if the participant is already added ...
58d96889-b5b2-4707-aab3-c8ba9a61a120
7
private void initialize() { bank=new Bank("Accounts.txt"); frmBank = new JFrame(); frmBank.setTitle("Bank"); frmBank.setBounds(100, 100, 457, 325); frmBank.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton btnViewAccounts = new JButton("View All Accounts"); btnViewAccounts.setToolTipText("Opens a...
ffb0decd-d741-4798-a852-8ecf69832629
8
public static void main(String[] args) throws Throwable { System.out.println(System.currentTimeMillis()); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(in.readLine()); for (int tc = 0; tc < n; tc++) { int nn = Inte...
8af185bf-2bf8-4462-b9cb-00428ee54355
3
public boolean isExecutable() { return ((status == Watchable.PAUSED || status == Watchable.RUNNING) && (gate == null || !gate.stop())); }
88ec5c64-4cc9-4c54-93bb-dd02ae04d95b
7
protected void checkListeningThreads() { final List<ListeningThread> threadsForRemoval = new ArrayList<ListeningThread>(); for (final ListeningThread listeningThread : this.listeningThreads) { threadsForRemoval.add(listeningThread); } for (final InetSocketAddress inetSocketAddress : this.listeningAddresse...
c8d9d234-0185-41d2-8440-8b1ac1907170
3
public boolean isUsed(Tile t) { for (int y = 0; y < bounds.height; y++) { for (int x = 0; x < bounds.width; x++) { if (map[y][x] == t) { return true; } } } return false; }
f5f1cebb-86c9-49fc-9721-70ee975c1061
9
@SuppressWarnings({ "unchecked", "rawtypes" }) public <T> T deserialze(PBDeserializer parser, Type type, Object fieldName) { Collection array = null; try { if (fieldName != null) { byte tmpIsNull = parser.getTheCodedInputStream().readRawByte(); if (tmpIsNull == 1) { ...
cab1ac1f-8562-4042-8900-4c49cc64e0c2
5
@Override public int getSamples(byte[] buffer) { byte[] pwmBuffer = null; if(pulseWidthCvProvider != null) { pwmBuffer = new byte[buffer.length]; pulseWidthCvProvider.getSamples(pwmBuffer); } int index = 0; for (int i = 0; i < (buffer.length / 2); i+...
c8f157c9-3975-49ea-bdd0-62195ab46db9
9
public void display(BufferedImage bi) { Graphics g = null; try { if (bi != null) { g = bs.getDrawGraphics(); g.drawImage(bi, 0, 0, canvas.getWidth(), canvas.getHeight(), null); long ct = System.currentTimeMillis(); long lt = ct - FR_SAMPLE_HISTORY; long t, dt; long maxdt = 0; long min...
fceee7f8-46d0-4bb4-9f4b-db195225b972
4
public void init( Environment<String,BasicType> additionalSettings, Environment<String,BasicType> optionalReturnValues ) throws InstantiationException { synchronized( this ) { // Since version 0.9.9 it is possible to re-use the handler instance ('sharedHandlerInstance' in // the server config)....
551529e0-146a-49f9-99ad-32b4ba686489
3
public void addObject(int var1, Object var2) { Integer var3 = (Integer)dataTypes.get(var2.getClass()); if(var3 == null) { throw new IllegalArgumentException("Unknown data type: " + var2.getClass()); } else if(var1 > 31) { throw new IllegalArgumentException("Data value id is too big w...
d33116a3-5648-4669-bbed-f4527381a25b
2
public void removePush() { if (stackMap == null) /* already done or mapping didn't succeed */ return; stackMap = null; block.removePush(); Iterator iter = successors.keySet().iterator(); while (iter.hasNext()) { FlowBlock succ = (FlowBlock) iter.next(); succ.removePush(); } }
541fa203-9a00-4272-92ab-c6d90d53cbf6
8
static protected int[] case5(int[][] a) { int[] result = new int[2]; int tmp1, tmp2; if (a[3][1] <= a[1][1]) { tmp1 = a[0][0] + a[2][0]; tmp2 = a[1][0] + a[3][0]; } else if (a[3][1] > a[1][1] && a[1][1] + a[0][1] >= a[3][1]) { tmp1 = a[1][0] + a[3][0]; tmp2 = a[2][0] > a[3][0] ? a[2][0] : a[3][0];...
4cdceb02-ce6e-494d-bcbd-a880a4442eb0
6
private static ArrayList<Integer> getPrimesSieve(int n) { ArrayList<Boolean> integerList = new ArrayList<Boolean>(); ArrayList<Integer> primes = new ArrayList<Integer>(); /* Initialize Arrays: * (1) Mark all other numbers as prime initially * (2) 0, 1 not considered primes */ integerList.add(fal...
3ceb450d-08c3-4608-b390-b6288d6fcce1
3
public static void sendPlayerToHome( BSPlayer player, String home ) { Home h = getSimilarHome( player, home ); if ( h == null ) { player.sendMessage( Messages.HOME_DOES_NOT_EXIST ); return; } Location l = h.loc; ByteArrayOutputStream b = new ByteArrayOutpu...
9953e91c-5ab0-47d9-8cd0-86267babe269
3
public static IPv4Network getByAddress(String address, int mask) throws NetworkException { if ((mask < 0) || (mask > 32)) { throw new InvalidAddressException(String.format("'%d' is not a valid IPv4 mask.", mask)); } try { return new IPv4Network(new BigInteger(Inet4Address...
4505d782-c56a-4c52-93de-5626d19de5ad
6
public static Element getParentElement(Element element) { if (element == null) { return null; } Element parentElement = null; Node parentNode = element.getParentNode(); while (parentNode != null && parentElement == null) { if (parentNode.getNodeType() == Node.ELEMENT_NODE) { parentElement = (Element...
6f7be275-911c-4e41-88be-919556ded96f
9
public static void display(String tableName){ Statement stmt = null; ResultSet rs = null; String sql; try{ stmt= conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); if(tableName.toLowerCase().equals("patients")){ sql = "SELECT * FROM PATIENTS"; rs = stmt.exec...
104c0717-fe2a-40ea-b8f3-04668132ae5d
4
public String httpPost(String url, String queryString) throws Exception { String responseData = null; HttpClient httpClient = new HttpClient(); PostMethod httpPost = new PostMethod(url); httpPost.addParameter("Content-Type", "application/x-www-form-urlencoded"); httpPost.getParams().setParameter("http.soc...
bc9fad38-dca8-47fa-a704-a11befab6682
7
private void process(BruteTreeNode node, int level) { if (this.solutions.size() >= this.getExpectedSolutionCount()) { return; } ValidationResult result = node.validate(); switch(result) { case RESOLVED: this.solutions.add(node); ...
9a68e6d0-951d-47f3-9f2c-7c2dfc037635
3
public List<Message> getUserMessages(String userEmail) { initConnection(); String preparedString = null; PreparedStatement preparedQuery = null; List<Message> messageList = null; try { //Prepare Statement preparedString = "SELECT * FROM messages " + "INNER JOIN users ON users.email...
f7791e89-0072-46e1-8c50-15cfbdbfb8bc
1
public void visit_areturn(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
f5302ce3-e15f-477b-8e16-4730387c14b6
8
private boolean check() { if (N == 0) { if (first != null) return false; } else if (N == 1) { if (first == null) return false; if (first.next != null) return false; } else { if (first.next == null) return false; } ...
4eb024fa-3263-4d42-b020-507afbb85869
5
private boolean isValidSequence(List<Chemin> listeAvalider){ boolean isOk= true; boolean tmpBool= false; List<Chemin> tmpListe = listeAvalider; //QuickSort<Chemin> qSort = new QuickSort<>(tmpListe, 0 , tmpListe.size()); //Collections.sort(tmpListe, new CheminComparator()); for (int i = 0; i < listeAvalide...
a45d7993-0e16-402b-8e8d-d96443e513ff
7
public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof UsuarioId)) return false; UsuarioId castOther = (UsuarioId) other; return (this.getId() == castOther.getId()) && ((this.getUser() == castOther.getUser()) || (this.get...
a661abc8-f473-4a02-aaae-c6b4a3d882cc
5
public String viewMember(String firstName, String lastName, String concordiaID){ String foundMember; DecimalFormat df = new DecimalFormat("#.##"); for(ConcordiaMembers member: concordiaMembers){ if(member!=null){ if(member.getFirstName().equals(firstName) && member.getLastName().equals(lastName) && me...
34ef06af-0e6a-444e-97e7-0a88c3eef182
0
public DocumentRepository() {}
e72dd176-b393-48f5-baad-d5aeac57d308
3
public List<String> getSchedule_indications() { List<String> indications = new LinkedList<String>(); for (Indication schedule_indication : schedule_indications) { if (schedule_indication == null || schedule_indication.getText() == null) continue; indications.add(s...
389177f5-5f03-45dc-8054-f6972ceaebee
7
public static boolean stringRotation(String str1, String str2) { if(str1.length() != str2.length()) return false; String two = str1.substring(0, 2); int j, i = 2; if((j = str2.indexOf(two)) != -1) j += 2; else if(str2.charAt(str2.length() - 1) == two.charAt(0) && str2.charAt(0) == two.charAt(1)) j = ...
a32758b8-53bc-4826-810e-5e69a3edf98c
0
public static void main(String[] args) { String[] rankArray = {"Ace", "Jack"}; String[] SuitArray = {"Spades", "Diamonds", "Fun"}; Integer[] pointArray = {1, 2}; Deck Bicycle = new Deck(rankArray, SuitArray, pointArray); Bicycle.shuffle(); System.out.println(Bicycle.deal()); System.out.println(Bicycle.Dec...
806e5d84-05a3-4d36-84fe-6ca9ff156fa4
2
public int creationpays(int idpays, String nom, String cp) { retour = 0; try { RequetesVille.insertVille(idpays, nom, cp); } catch (SQLException ex) { if (ex.getErrorCode() == 1062) { //error nom de ville deja dans le fichier retour = 106...
22102211-f9f1-42f1-a49d-d4b4e907ee53
8
public static String ticksToTimeString(long var0) { long var2 = var0 / 20L; long var4 = var2 / 60L; long var6 = var4 / 60L; long var8 = var6 / 24L; String var10 = ""; if (var8 > 0L) { var10 = var8 + ":"; } if (var6 > 0L) {...
a68fc0e6-3c58-4278-abe3-6020e172e576
8
public void paint(Graphics g, Shape a) { RSyntaxDocument document = (RSyntaxDocument)getDocument(); Rectangle alloc = a.getBounds(); tabBase = alloc.x; host = (RSyntaxTextArea)getContainer(); Rectangle clip = g.getClipBounds(); // An attempt to speed things up for files with long lines. Note that // ...
742355a4-9366-4368-950e-f05bf0e4b54e
5
public ParamFrame(String title, String textLabel, int _param, int _count, final boolean isSpline){ super(title); content = getContentPane(); JPanel p = new JPanel(); JLabel paramLabel = new JLabel(textLabel); final JTextField paramField = new JTextField(); paramField.setText(_param+""); JLabel count...
6e9fe3b6-718c-4cbf-896a-a8e1a8f226b7
8
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { myPointPanel.togglePointType(); if(myPointPanel.getCurrentType()==PointType.BLUE){ clabel.setText("<html>Color: <font color='blue'>blue</font> - space to change</html>"); } else{ clabel.setText("<html>Color...
18b78af5-7584-4f2f-b9ea-2e86bd669aeb
0
public void mouseEntered(MouseEvent e) {}
92bb7726-59ae-4a6a-a732-a6a91893bc1b
3
public static void blockUntilProcessEnd(Process process, int timeOut) { int maxCount = timeOut * 5; for (int i = 0; i < maxCount && checkProcessEnd(process); i++) { try { Thread.sleep(200); } catch (InterruptedException e) { logger.error(e); ...
1dcd896e-1564-49e0-af2b-fda37db21aa1
5
@Override public void mouseReleased (MouseEvent e) { if (alg.isProcess()) { return; } int i = getRowByMouseX(e.getX()); int j = getColumnByMouseY(e.getY()); draggedCell = null; alg.reset(); if (e.getButton() == MouseEvent.BUTTON1 && alg.getCell(i...
aae70308-452e-4549-bcc8-66a90c1dd126
0
public void updateFile(File file){ this.file = file; }
f8e58c7c-2677-440d-a1fc-a009119e481f
7
* @param unit The missionary <code>Unit</code>. * @param settlement The <code>IndianSettlement</code> to establish at. * @return An <code>Element</code> encapsulating this action. */ public Element establishMission(ServerPlayer serverPlayer, Unit unit, IndianSettle...
ae421201-9f91-4704-86ef-1c34806427a6
0
public boolean getPassedPoint(int i){ return passedPoint[i]; }
0fef88ad-2d46-4240-8957-89ade5d46acc
7
private void parsePacket(byte[] data, InetAddress address, int port) { String message = new String(data).trim(); PacketTypes type = Packet.lookupPacket(message.substring(0, 2)); Packet packet = null; switch (type) { default: case INVALID: break; case LOGIN: packet = new Packet00Login(data); handl...
cbff35ca-bdf2-4d56-839c-367b60ec91c2
7
@SuppressWarnings("unchecked") private static <T extends Object> T getValue(T object, String strFieldName) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { Class<T> d = (Class<T>)object.getClass(); T e = object; String[] fieldnames = strFieldName.split("\\."); for (in...
a3a3ba6c-3d84-46bb-a8d8-91d4162dff76
0
public String getTaxes(String s) { String taxValue = "17"; return taxValue; };
719dce52-76eb-4bd4-8431-b85ae9db6d73
6
public void getTransitionsFromCPN(Document doc, PetriNet pn) { NodeList transList = doc.getElementsByTagName("trans"); for (int i = 0; i < transList.getLength(); i++) { Node nNode = transList.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eEleme...
9583a449-c187-41fb-ae14-54e8d906048c
1
public void addSegment(Segment s){ if(s.getRoadID() == this.roadID){ segments.add(s); } }
d0278d50-8705-4cfc-b8f3-d392bc07a8fa
0
public float getK() { return this.k; }
74b342e4-db92-4b7d-8d55-2c95de9a0461
5
public Elevator callDown(Rider r){ int startFloor = r.getFrom(); while(true) { for(Elevator e : elevators) { synchronized(e){ if(!e.isGoingUp() && e.getFloor()>startFloor) { e.addRequest(r); return e; } else if(!e.isInTransit()) { e.addRequest(r); return e; } }...
3279e250-ebc3-4508-997a-98670e43ba78
3
public static TreeSet<Association> mergeArrays( ArrayList<Association> associations, ArrayList<Association> fClusterAssociations, ArrayList<Association> left) { TreeSet<Association> combine = new TreeSet<Association>(); for (Association a : associations) combine.add(a); for (Association a : fClusterAs...
d3371fe9-dd29-4bb2-8791-6aae3ea705bb
7
public void updatePositions() { playerAlive = new ArrayList<ChessPiece>(); aiAlive = new ArrayList<ChessPiece>(); for (int i = 0; i < gameState.length; i++) { for (int j = 0; j < gameState[0].length; j++) { gameState[i][j].setRow(i); gameState[i][j].setCol(j); if (gameState[i][j].getColor() == play...
1e8491b2-044f-45c0-be75-2248a52b1142
7
@Override protected void repondreExtension(HttpServletRequest requete, HttpServletResponse reponse, String action, Utilisateur utilisateur) throws ServletException, IOException { if (utilisateur != null) { throw new DejaConnecteException(); } String pseudo = requete.getParameter...
e88171f4-43bc-4192-bffb-dd0053329954
2
public void setWindowPadding(int[] padding) { if ((padding != null) && (padding.length != 4)) { IllegalArgumentException iae = new IllegalArgumentException("The padding-array must have four elements!"); Main.handleUnhandableProblem(iae); } this.window_Padding = padding; ...
49f112e1-b152-4280-a7d6-bc812e4f24ee
4
private Particulier createParticulier(HttpServletRequest request) throws Exception{ String email = request.getParameter("email"), motDePasse = request.getParameter("motdepasse"), motDePasse2 = request.getParameter("motdepasse2"), nom = request.getParameter("nom")...
0cde5921-4b27-49b3-a766-695a4b29f877
7
public void run() { //open a socket to the server and send data try { //get the user command (put, get, delete) if(this.commandType.equals("put") || this.commandType.equals("del") || this.commandType.equals("reb")) { //System.out.println("issuing put to server"); getServerResponse(); } el...
6f582f6c-c85e-4ba9-b568-b399d3a1945f
6
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) { if (!par1World.isRemote) { int var6 = par1World.getBlockMetadata(par2, par3, par4); if ((var6 & 8) != 0) { par1World.setBlockMetadataWithNotify(par2, par3, ...
baf68618-59cc-4be5-8e56-c5e5f00a98d8
4
public static int editex(String string1, String string2){ char[] str1 = ("#" + string1).toCharArray(); char[] str2 = ("#" + string2).toCharArray(); int length1, length2; length1 = str1.length; length2 = str2.length; int F[][] = new int[length1][length2]; int dStr...
fc8fd82b-f8e5-4c88-be64-f9d0fade9b47
1
public void setComponent(GuiComponent component) { InputHandler.getInstance().clearAll(); if (activeComponent != null) { activeComponent.deactivate(); } component.activate(); activeComponent = component; }
45966c2e-e6a8-4bc6-91e5-45f63a791a08
0
public void setFesEstado(String fesEstado) { this.fesEstado = fesEstado; }
9c52675d-aa47-4324-a8fa-fb31c5c2dc36
4
private void setOthers(ColorFilter filter, String replacing, String test, int testValue, int otherValue, int testGap, int otherGap, int shift) { boolean set = false; if (shift == LEFT_SHIFT) { filter.setShift("left"); } else if (shift == RIGHT_SHIFT) { filter.setShift("right"); } else { if (replacing....
736d0f88-15c0-43b0-be4c-7fac80794c6c
3
private static byte[][] InvShiftRows(byte[][] state) { byte[] t = new byte[4]; for (int r = 1; r < 4; r++) { for (int c = 0; c < Nb; c++) t[(c + r)%Nb] = state[r][c]; for (int c = 0; c < Nb; c++) state[r][c] = t[c]; } return state; }
c626c730-9707-4dea-8694-841fa7e2052c
4
@Override public String execute() { Polynomial result = new Polynomial(); Multiply mul = new Multiply(); Sum sum = new Sum(); Polynomial minus = new Polynomial(); Polynomial temp; Term c; minus.addTerm(-1,1,0); Term a = divisor.termAt(0); Term ...
b7497c47-3b44-4976-b8d7-85951f9af879
3
public Dimension getSize() { Dimension dim = super.getSize(); if (!layingOut) { if (isAutoPopupWidth) { popupWidth = getOptimumPopupWidth(); } if (popupWidth != 0) { dim.width = popupWidth; } } return dim; ...
cbf0dcff-c04a-422e-ac10-cb888df6e572
1
public boolean opEquals(Operator o) { return (o instanceof ThisOperator && ((ThisOperator) o).classInfo .equals(classInfo)); }
487cbe59-7c8e-4a6c-b7f6-bbcd3bb67576
8
@Override public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); switch (keyCode) { case KeyEvent.VK_UP: U = true; break; case KeyEvent.VK_W: U = true; break; case KeyEvent.VK_DOWN: D = true; break; case KeyEvent.VK_S: D = true; break; case KeyEvent.VK_LEFT: L = tru...
fbe1d6a2-fa42-4756-ac69-fd4a90b39123
8
private void movement() { if (game.getInput().down.down) { if (canDown) game.yOffset += speed; directionFacing = Down; } if (game.getInput().up.down) { if (canUp) game.yOffset -= speed; directionFacing = Up; } if (game.getInput().left.down) { if (canLeft) game.xOffset -= speed; d...
a176eeda-516f-416e-9d0b-a1f60dacd215
3
public ArrayList<Integer> getTransitionStartToGoal( int startID, int goalID ){ ArrayList<Integer> transition = new ArrayList<Integer>(); transition.add( goalID ); while(true){ int to = transition.get(transition.size()-1); int from = getNode(to).getFromID(); if( from < 0){ //どこからもたどり着かなかった break; ...
4c95def5-19c4-4241-8c88-f243f028e333
0
public DriveTrain() { _leftEncoder.start(); _rightEncoder.start(); LiveWindow.addSensor ("Drive Train", "Gyro", _gyro); LiveWindow.addSensor ("Drive Train", "Left Encoder", _leftEncoder); LiveWindow.addSensor ("Drive Train", "Right Encoder", _rightEncoder); }
64b8b9a2-a7dd-40c5-819f-4f469b0d1f51
6
public void drawGeometry(Graphics g) { int radius = (int) ((Math.abs(topLeft.distance(bottomRight)))); if ((topLeft.y > bottomRight.y) && (topLeft.x < bottomRight.x)) { g.drawOval(topLeft.x, bottomRight.y, radius, radius); } else if ((topLeft.y < bottomRight.y) && (topLeft.x >bottomRight.x)) { g.drawOva...
d21275af-64b6-4097-8f4d-a270e571a207
1
@Override public List<Pessoa> Buscar(Pessoa obj) { String consulta = "select l from Pessoa l"; if(obj != null){ consulta = consulta + " where l.nome like '%" + obj.getNome() + "%'"; } Query q = manager.createQuery(consulta); return q.getResultLis...
88c64b13-e725-4a7d-8efc-19795ae0ed38
1
public final void comment(final char[] ch, final int off, final int len) throws SAXException { try { closeElement(); writeIdent(); w.write("<!-- "); w.write(ch, off, len); w.write(" -->\n"); } catch (IOException ex) { throw new SAXException(ex); } }
76de0827-d853-48e8-b84c-715cb7437f68
7
public void addNode(Node node) { if (node instanceof StartEvent) { if (startEvent != null && startEvent != node) { throw new ASFModelException("Multiple StartEvent has been found!"); } this.startEvent = (StartEvent) node; } else if (node instanceof End...
6f4ca593-4a0c-4aeb-a1da-dadc5e5e3861
7
@Override public boolean tick(Tickable ticking, int tickID) { if((tickID==Tickable.TICKID_TRAP_RESET)&&(getReset()>0)) { // recage the motherfather if((tickDown<=1)&&(monsters!=null)) { for(int i=0;i<monsters.size();i++) { final MOB M=monsters.get(i); if(M.amDead()||(!M.isInCombat())) ...
f2383f5e-01a4-4b46-bbfe-e4bb0a4e4e04
7
private String setFPCBindings(String script) { Bindings engineBindings = getContext().getBindings(ScriptContext.ENGINE_SCOPE); Bindings globalBindings = getContext().getBindings(ScriptContext.GLOBAL_SCOPE); StringBuilder varNames = new StringBuilder(); for (String key : engineBindin...
8c3d0a96-94d1-4b30-946f-b38ccb4bd8e5
9
private void printKClosest(int arr[],int x,int k){ //Find the Crossover point to get the left index int left=findCrossOver(arr,0,arr.length-1,x); //Find the right index int right=left+1; //To Keep track of the elements already counted int count=0; //if the element is present in the array...
8bdf0c8e-299c-4b3e-8cc1-dff1855f23a8
4
public void mouseDown(MouseEvent event) { if (event.button != 1) return; getPaintSurface().setStatusMessage(PaintExample.getResourceString( "session.SegmentedInteractivePaint.message.interactiveMode")); previousFigure = currentFigure; if (controlPoints.size() > 0) { final Point lastPoint = (Point) contr...
b0412f49-5ca9-4d43-95d4-4831c0daaa8f
4
@Override protected T readNext() { try { if (reader.ready()) { while ((line = reader.readLine()) != null) { // Read a line (only if needed) if (!line.trim().isEmpty()) { // Non empty line? Create object lineNum++; return createObject(line); } } } } catch (IOException e) { ret...
c472253c-e16a-4648-8890-7fa16ddbc366
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!CMLib.flags().isAliveAwakeMobile(mob,false)) return false; final Ability A=mob.fetchEffect(ID()); if(A!=null) { A.unInvoke(); mob.tell(L("You end your all-out defensive posture."));...
598d8db5-88c6-4c24-ad22-a65e30e5b1bf
6
public double Daf2r(int ideg, int iamin, double asec) throws palError { /* Preset status */ Status = 0; double rad = 0.0; TRACE("Daf2r"); /* Validate arcsec, arcmin, deg */ if ((asec < 0.0) || (asec >= 60.0)) { Status = 3; throw new palError(Statu...