method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5c90bfb5-93a2-42ec-b32e-2a85e24eedc7
7
public boolean equals(Object o) { if (o instanceof Customer) { Customer that = (Customer) o; if (getCustomerID().equals(that.getCustomerID()) && getAddress().equals(that.getAddress()) && getCity().equals(that.getCity()) && getLastName().equ...
7485b0b1-5b8b-47c7-ba67-41702c0ec7ee
9
private void writeValue(Object value) throws JSONException { if (value instanceof Number) { String string = JSONObject.numberToString((Number) value); int integer = this.valuekeep.find(string); if (integer != none) { write(2, 2); write(integer,...
dba82e51-aceb-424e-93d3-0c50d277722e
7
public String toString(){ String out = name + " " + hours + ":" + minutes +" "+ AmPm + " "; if(ma) out += "mo,"; if(di) out += "tu,"; if(wo) out += "we,"; if(don) out += "th,"; if(vr) out += "fr,"; if(za) out += "sa,"; if(zo) out += "su,"; return out; }
962a0501-0138-40ef-a381-c41b71adb0f6
1
@Override public void run() { System.out.println( "Reception du message : " + message + " (du socket " + socket + " )"); boolean success = interpreteurRequete.ParseCommandPari(message, socket, serveur); if(success) serveur.EnvoyeAClient(socket, "SetBet|Succes du pari"); else serveur.EnvoyeAClient(socket,...
bd6a37cf-7adc-43ba-9653-6c67f500cf35
4
public void addTicket(Ticket ticket) { if (ticket == null) { throw new NullObjectInsertionException("null ticket shouldn't be added"); } if (ticket.getSeance() != null && !ticket.getSeance().equals(this)) { throw new ReassignObjectException("Ticket already assigned to seance. Ticket could not b...
dd39e343-9b24-4d67-b398-c8ae39180823
4
public AddEditRunwayFrame(Runway editRunway, boolean isEditEntry) { objectSet = CurrentDataObjectSet.getCurrentDataObjectSet(); //setupUnits(); if (!isEditEntry || editRunway == null){ editRunway = new Runway("", 0, "", 0, ""); } this.isEditEntry = isEditEntry; ...
c499a810-ce13-41ff-81a9-032ed09a30ec
5
public static int antallUlikeUsortert(int[] a){ int uniketall = a.length; if(a.length==0){ return 0; } else{ boolean like; for(int i=0;i<a.length;i++){ like=false; for(int j=i+1;j<a.length;j++){ if(a[...
8281cd74-d2e5-4857-a855-05ab6fa77b19
0
@Override public Object clone() { PropertyFilterChainImpl cloned = new PropertyFilterChainImpl(); cloned.filters = (ArrayList) this.filters.clone(); return cloned; }
25887e53-ba27-413f-b882-2f9c7c54b874
9
private void BtPesquisaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtPesquisaActionPerformed int[] parametro = new int[4]; parametro[0] = 70; parametro[1] = 300; parametro[2] = 200; parametro[3] = 70; preenche.FormataJtable(TbPesquisa, parametro); ...
551235d0-d1f2-418c-8756-176f1c1b6e1b
8
protected PlayerLibrary.ThinPlayer parseThinUser(ResultSet R) { try { final String name=DBConnections.getRes(R,"CMUSERID"); String cclass=DBConnections.getRes(R,"CMCLAS"); final int x=cclass.lastIndexOf(';'); CharClass C=null; if((x>0)&&(x<cclass.length()-2)) { C=CMClass.getCharClass(cclass.s...
6559b28c-a37b-4c08-addb-af2c54cd134f
5
public Client connect(String hostName, int port) throws UnknownHostException, IOException { final Client client = new Client(hostName, port); client.connect(); new Thread("Check device state") { //$NON-NLS-1$ @Override public void run() { while (!client.isConnected() && (client.getStatus() == S...
2c1b0f1e-50e7-4455-ba4f-17939fda8008
9
private void quicksort(int low, int high) { incrementRekursionDepth(); // if the given part of the array is already sorted, we're done here if (!isSorted(array, low, high)) { int i = low, j = high; // comparision element x int x = array[countStep((low + high) / 2)]; // splitting while (i <= j...
4fc848af-dd54-409e-835f-c8c31d777af7
9
private int insertKeyRehash(T key, int index, int hash, Object cur) { final Object[] set = _set; final int length = set.length; // already FULL or REMOVED, must probe // compute the double hash final int probe = 1 + (hash % (length - 2)); final int loopIndex = index; ...
7a867132-d7f7-4d9c-adb5-36a549aa90e5
6
boolean isInCycle(int theX, int theY, Cycle c){ int count = 0; int detVirt; int j; Integer[] l = new Integer[c.vxList.size()]; c.vxList.toArray(l); for(int i=1; i<l.length; i++){ j = (i==l.length-1 ? 0: i); detVirt = det(vertices[l[i]].x, vertices[l[i-1]].y, vertices[l[i]].x, ...
1d9fd6fc-4543-4902-9017-210ce6e5c57e
7
public void sucheDateiMitRegEx(String regEx, File directory, FoundListener fnd) { if(directory.exists()) { File[] files = directory.listFiles(); for(int i=0; i< files.length; i++) { if(files[i] != null && files[i].exists()) { if(files[i].getName().matches(regEx)) { findings.add(...
445d40d9-29ae-43f1-89de-fcbfaf26d96e
5
private boolean verifChampObligatoire(HttpServletRequest request) { if (request.getParameter("id").contentEquals("") || request.getParameter("pwd").contentEquals("") || request.getParameter("pwdC").contentEquals("") || request.getParameter("ndf").contentEquals("") || request.getParameter("prenom").con...
013a9fc1-2f78-4564-8103-5ef3187b78cb
0
public void setProtocol(FileProtocol protocol) { this.protocol = protocol; setText(protocol.getName()); }
a640dbf8-776b-4bf3-94c6-635554fae8ef
6
public final double getRange() { if (null == maxValue && null != minValue) { return _maxValue - minValue.get(); } else if (null != maxValue && null == minValue) { return maxValue.get() - _minValue; } else if (null == maxValue && null == minValue) { return _max...
40131262-f2d6-4d8f-920c-e61daec1e17b
4
private void setDisplayItems() { ArrayList<ToDoItem> temp = new ArrayList(); ArrayList<ToDoItem> allItems = this.database.getAllItems(); ToDoItem item; if (this.selectedCategory == null || this.selectedCategory.equals("All")) { this.displayList.setList(allItems); } e...
e9a7717a-f557-41ec-bdc2-dcede00ada48
4
private void draw(Graphics2D g, Position positionStart, String text) { text = wrap(deAccent(text).trim(), 85); int currentIndexX = positionStart.x; for (char letter : text.toCharArray()) { if (letter == ' ') { currentIndexX += wordSpacing; continue; ...
50017423-e872-4c38-8182-33ed759bbf4d
7
public final void silence_header() throws RecognitionException { try { // SayScript.g:515:16: ( ( WHITE )? LBRACK HDR_SILENCE RBRACK ( WHITE )? ( NEWLINE | COMMENT ) ) // SayScript.g:515:18: ( WHITE )? LBRACK HDR_SILENCE RBRACK ( WHITE )? ( NEWLINE | COMMENT ) { // SayScript.g:515:18: ( WHITE )? int al...
44a2e574-445e-45f9-b146-fe1b580ed3eb
5
protected double checkWhetherDichotomous(double[] array){ int n = array.length; double[] responseMatching = new double[n]; boolean[] matchingCheck = new boolean[n]; for(int i=0; i<n; i++){ responseMatching[i] = 0.0; matchingCheck[i] = false; } f...
aff53af0-8a92-49e2-8bc1-6c429020ac5f
4
public int[][] dct(int f[][]) { double tempX[][] = new double[N][N]; double tempY[][] = new double[N][N]; int F[][] = new int[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { tempX[i][j] = (double)f[i][j]; } } dc...
40a480ee-935e-4ba0-b350-8b08349bc95c
1
public boolean isValidWorld(Player p) { String world = p.getWorld().getName(); List<String> worldList = plugin.getConfig().getStringList("worlds"); if (!worldList.contains(world)) return false; return true; }
edcd1e7c-c9bb-416b-9a46-b882efe0b4e3
7
public static Rules parseRules(String fileName) throws ParserConfigurationException, SAXException, IOException, ParseRule.ParseException { File fileXML = new File(fileName); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilde...
fb8cb14e-8a64-4deb-be70-e4dc368a199b
1
public static void main(String[] args) { Scanner in = new Scanner(System.in); int testCases = in.nextInt(); while (testCases > 0) { System.out.println(cyclesHeight(in.nextInt())); testCases--; } }
c966d270-bff6-4f28-ae58-60233260fd17
2
private T lowestFInOpen() { // TODO currently, this is done by going through the whole openList! T cheapest = openList.get(0); for (int i = 0; i < openList.size(); i++) { if (openList.get(i).getfCosts() < cheapest.getfCosts()) { cheapest = openList.get(i); ...
a562fd18-fbbb-43bd-96a4-5a09080cd182
9
@SuppressWarnings("deprecation") private void build( Applet applet, String[] args, int width, int height ) { ++instances; this.applet = applet; this.args = args; applet.setStub( this ); name = applet.getClass().getName(); setTitle( name ); // Set up properties. Properties props = System.getProperties(); pr...
be03cf72-84e9-418d-9d23-14c4938f23e7
6
public void allIntronTxPos() { String txPosStringSt = intronFormat(seqChange.getStart()); String txPosStringEnd = intronFormat(seqChange.getEnd()); if (seqChange.isDel()) { if (seqChange.size() == 1) { txPos = txPosStringSt; } else { if (t...
27692e4d-a9a8-45e0-b41f-34c1ba5babce
4
public static void run() { Event event1 = new Event(); Event event2 = new Event(); event1.setPlace("Evénements sur Redon"); event1.setDate("Jeudi 16/10/14 10h"); event2.setPlace("Evénement sur Rennes"); event2.setDate("Mardi 21/10/12 16h30"); eventService.addEvent(event1); eventService.addEv...
7908ede0-3c6a-4a06-8184-16bc5390b986
3
public void setRelativeMouseMode(boolean mode) { if (mode == isRelativeMouseMode()) { return; } if (mode) { try { robot = new Robot(); recenterMouse(); } catch (AWTException ex) { // couldn't create ...
921cb8e6-248a-4fea-b10e-5ac4f4aa3e2d
5
NetUser(String name, int totalGridlet, double baud_rate, double delay, int MTU, Broker broker) throws Exception { super( name, new SimpleLink(name+"_link",baud_rate,delay, MTU) ); this.receiveJobs = new GridletList(); this.jobs = new GridletList(); this.broker = broker; this...
78cda97b-c740-4e1b-a368-e84a00dc9c53
0
public final AuthFrame getFrame() { return frame; }
f9905f24-3656-4f9c-a3df-7571f1eacbcd
3
public char nextClean() throws JSONException { for (;;) { char c = this.next(); if (c == 0 || c > ' ') { return c; } } }
9c0c7cd1-7876-4135-8870-8d9e00778c55
6
public String getKeyString() { String s = new String(); int state = 1; char ch; while ( true ) { try { ch = (char)this.fr.read(); } catch (IOException e) { e.printStackTrace(); return null; } if ( ch == ' ') { state = 0; } else if ( ch == '<' ) { state = 1; s = new Stri...
20a21731-067e-40b7-be60-dbbd8ec1ac31
3
public char skipTo(char to) throws JSONException { char c; try { long startIndex = this.index; long startCharacter = this.character; long startLine = this.line; this.reader.mark(1000000); do { c = this.next(); if...
438ade29-f06b-4811-bb19-b73a50124126
6
@Override public ArrayList<UserScore> getScoreList() { PreparedStatement selectStmt = null; ArrayList<UserScore> list = new ArrayList<>(); ResultSet rs = null; try { selectStmt = sqliteDB.getConnection().prepareStatement("select " + "count(s.score) ...
1863f383-fea4-45cf-90d5-e947bbdfa6da
0
public void paintComponent(Graphics graphics) { Graphics2D graphics2D = (Graphics2D) graphics; graphics2D.setPaint(new GradientPaint(0, 0, Color.white, 0, getHeight(), new Color(212, 212, 212))); graphics2D.fillRect(5, 5, getWidth() - 10, getHeight() - 10);//todo remove this hardcode ...
a349b3af-9907-45f4-bfa7-2fa51e23d831
0
public static void main(String[] args) { Shape shape = new Square(5); System.out.println(shape); shape.draw(); }
7f015be1-984e-44d8-b1ea-c77a99266bcd
6
@Override public void onExpire() { switch (type) { case 1: if (AsteroidsGame.doubleDamage) { AsteroidsGame.doubleDamage = false; break; } case 2: if (AsteroidsGame.doubleSpeed) { AsteroidsGame.doubleSpeed = false; AsteroidsGame.player.setSpeed(AsteroidsGame.player.getSpeed() / 2)...
42bebad3-69b9-44dc-803f-89620ecd5b40
0
public void setxCoordinate(double xCoordinate) { this.xCoordinate = xCoordinate; }
dd1446dd-230b-47ac-af6e-1a1688125f6a
1
@Override public String getAsString(FacesContext fc, UIComponent uic, Object object) { if(object != null) { return ((Funcao)object).getId().toString(); } else { return null; } }
eea49794-c78a-484a-b6ad-2936c51f1c1f
0
public static void setEventName(String eventName){ EventDescriptionWindow.eventName.setText(eventName); }
bf594f29-e35c-4c2c-8642-aabdcb26edee
5
@Override public void update() { //Get current time double currentTime = System.currentTimeMillis(); double movement = ((currentTime - previousTime) * movementSpeed) / 1000.0; //Create a translation vector Vector translation = new Vector(2); boolean moving = false; //Determine which keys are pres...
c12a021f-a7ff-43d1-b8de-bc52bbb5404a
9
static public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[8]; for (int i = 0; i < 8; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 2; i++) ...
37c6aae0-dad0-472d-bc4e-64287f9bbe9e
8
public void init(String ruleSpec) throws MaltChainedException { String spec = ruleSpec.trim(); String[] items = spec.split("\t"); if (items.length != 3) { throw new HeadRuleException("The specification of the head rule is not correct '"+ruleSpec+"'. "); } int index = items[0].indexOf(':'); if (index !...
d308246c-5886-495c-859e-670d40f959b5
8
private boolean isValid(Move move, TKind kind) { // check increasing x if (Check(move, 1, 0, kind, false) != 0) { return true; } // check decreasing x if (Check(move, -1, 0, kind, false) != 0) { return true; } // check increasing y ...
76ada493-cfa4-4f6c-903c-b4947770ce1b
4
public UserModel addUser() { String email = null; String password = null; String firstname = null; String lastname = null; String dob = null; String telephone = null; String address1 = null; String address2 = null; String town = null; String postcode = null; boolean correctDate = false; UserMode...
c2aeb96e-1a91-40b6-b509-9553263c7d1f
5
public double getPointToPointEnergyCoefficient(Coordinates coordinate1, Coordinates coordinate2) throws LandSensorDefaillance, InaccessibleCoordinate { if (carte.get(coordinate1) == null) try { carte.put(coordinate1, Land.getLandByOrdinal(random.nextInt(Land.CountLand()))); ...
b8ac5b49-cb46-460e-8ad0-07a7b47f2151
9
private Method getNonPrivateAccessorMethodForField(String accessorPrefix, Field field) { assert accessorPrefix != null; assert field != null; final String methodName = buildMethodName(accessorPrefix, field.getName()); assert methodName != null; final Class<?>[] params = accessorPrefix.equals("set") ? new Clas...
1dec22f8-5d82-410d-ac30-da2e65dccdfe
1
private void drawBat(Graphics g) { g.setColor(Color.black); for(int i = 1 ; i<=4 ; i++) { Point2D batPos = ClientApp.getClientApp().getPlayerXPosition(i); Point2D batLength = ClientApp.getClientApp().getPlayerXBatLength(i); g.fillRect( (int)(batPos.getX()-batLength.getX()/2), (int)(batPos.getY...
befeb7b4-8b8f-43a2-b9ee-0db5e1004b36
3
public String toString(){ String str = null; if(statement.toString()!=null) str = statement.toString(); if(statements.toString()!=null){ if(statement.toString()!=null) str += ";"; str += statements.toString(); } return str; }
b18ae8b8-15d1-4789-95a2-ae0cd6f2c3c0
5
private static void getLiveData(CloseableHttpClient httpclient) throws FileNotFoundException, IllegalStateException, ParseException { HttpGet get = new HttpGet(LIVEDATA_JSON); CloseableHttpResponse response; try { response = httpclient.execute(get); HttpEntity entity = response.getEntity(); SuPoxyDataO...
4fa41af1-4971-4d1c-b296-3b41dad0fe34
7
public ArrayList<String> compressTokens(HashSet<String> allPaths, String seedName){ ArrayList<String> compress = new ArrayList<String>(); HashMap<String, String> allPatients = new HashMap<String, String>(); for (String network : allPaths){ String patients = allGeneSamplesMap.get(seedName); String[...
c963347e-a46b-43d4-886b-2c2d56ab720b
6
@Override public boolean execute(String input) { String a, date, charge, chargeCategory; a = input.substring(input.indexOf(" "),input.length()); date = a.substring(a.indexOf(" ") + 1, a.indexOf(";")); charge = a.substring(a.indexOf(";")+1,a.indexOf(":")); chargeCategory = a....
969d52d6-36c1-4133-9a28-109892a75d21
3
@Test public void testIOFastaQualityFactory() { String input1 = name + ".fasta"; String input2 = name + ".qual"; FileSequenceIOFactory fact = null; File res1 = testFile(input1); File res2 = testFile(input2); try { fact = FileSequenceIOFactory.getFactory(new FileInputStream(res1), new FileInputStr...
3662a39b-b6dc-4750-ab5d-f38f88eb8075
8
protected static void podarPrivate(Nodo raiz, int dato) { if(raiz.getOpt1() != null) { if(raiz.getOpt1().getDato() == dato) raiz.setOpt1(null); } else if(raiz.getOpt2() != null) { if(raiz.getOpt2().getDato() == dato) raiz.se...
8afcd7c4-4263-4ea1-b71a-7832f6553a90
2
@Provides public DBOpenHelper provideDbOpenHelper() { if (dbOpenHelper != null) { return dbOpenHelper; } ApplicationInfo ai; String dbname; int version; try { ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); dbname = ai.metaData.getStrin...
7b9cbdd1-f19b-4cd8-9dbd-3722f1f5283c
6
@Override public void run() { // Create the regex pattern Pattern pattern = Pattern.compile("Demand: (.*?)MW<BR />(.*?) GMT<BR />Frequency: (.*?)Hz<BR/>(.*?) GMT</p><h3>System Transfers</h3><p class='small'>N.Ireland to Great Britain: (.*?)MW<BR />France to Great Britain: (.*?)MW<BR />Netherlands to GB: (.*?)MW...
6ee851e8-8334-4bda-bdd8-5d2aad8d6ccf
8
@SuppressWarnings("rawtypes") protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String[] splitString = request.getPathInfo().split("/"); String actionString = (splitString == null) ? null : splitString[1]; if (actionString == null) ...
12713161-95a2-4ce2-ae23-dc17382aaeb2
5
public void saveJSONData(File reportDir, String data, List<ScriptCoverageCount> unloadJSData, UriFileTranslator uriFileTranslator) { try { lockOnReportDir(reportDir); reportDir.mkdirs(); File jsonFile = new File(reportDir, "jscoverage.json"); SortedMap<String, Fil...
000813d4-2531-44bc-a606-b2a464478381
8
static double grad(int hash, double x, double y, double z) { int h = hash & 15; // CONVERT LO 4 BITS OF HASH CODE double u = h<8||h==12||h==13 ? x : y, // INTO 12 GRADIENT DIRECTIONS. v = h<4||h==12||h==13 ? y : z; return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v...
b469c6f5-48f3-4c65-a4a2-27ac105a25d8
1
private void handleScrolling(){ this.controller.onMenuItemPressed(new MenuPressedEventArgs(this.scrollMenuItem)); if (this.scrollMenuItem.getText() == Constants.ScrollOffText){ this.scrollMenuItem.setText(Constants.ScrollOnText); } else{ this.scrollMenuItem.setText(Constants.ScrollOffText); } th...
a0458495-caad-4014-a518-fd5612885e90
9
@Override public void placer(Session session, ReservationDTO reservationDTO) throws InvalidHibernateSessionException, InvalidDTOException, InvalidCriterionException, InvalidCriterionValueException, InvalidSortByPropertyException, ServiceException { if(session ...
20597ac9-4dc1-4876-ab6f-121dd9390d6f
4
@Override public Double getValue() { if (value != null) return value; if (getName().equals("rand")) return Math.random(); if (getName().equals("pi")) return Math.PI; if (getName().equals("e")) return Math.E; return null; }
8cfe5e5d-08ec-4d90-9d9f-b6647fd29173
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MakeModel makeModel = (MakeModel) o; if (idMake != makeModel.idMake) return false; if (make != null ? !make.equals(makeModel.make) : makeModel....
d912fcde-a018-4f4b-aadb-1712790e7c2e
9
protected static void createDescriptor() { try { InputStream descriptorStream = TypedLambdaParseControllerGenerated.class.getResourceAsStream(DESCRIPTOR); InputStream table = TypedLambdaParseControllerGenerated.class.getResourceAsStream(TABLE); boolean filesystem = false; if(descript...
0a776f3f-f56c-44aa-ad52-e8395e0b48db
9
@Override public void doTask() { if (this.control) { if (Keyboard.getInstance().isKeyPressed(Keys.W) && !collisions.contains(Direction.TOP)) { y -= speed; } if (Keyboard.getInstance().isKeyPressed(Keys.S) && !collisions.contains(Direction.BOTTOM)) { y += speed; } if (Keyboard....
1ad1d35c-d590-4ede-a10d-3e551c6cb5ac
5
public void PlayerAttack(Fighter attacker, Fighter defender){ int damage; if(!attacker.inAir()){ //calculating whether or not damage is done. if((attacker.getX()+attacker.getAttack(0).getRange() >= defender.getX()-defender.getWidth()) &&(attacker.getY()<defender.getY()+defender.getHeight())) damage=att...
17334f48-7298-4a87-8d37-8e50b4d8ca78
2
private void reset() { for (ClientUI client : m_clients) { client.buttonAttack.setText(""); client.buttonConnection.setText("Connect"); for (int i = 0; i < client.buttonsMap.size(); ++i) { client.buttonsMap.get(i).setText(""); } client.labelAttacked.setText("-"); client.labelAttacker.setText("-"...
4375ac4b-b375-46bd-99ba-31b342315a82
9
static ISeq createFromObject(Object array){ if(array == null || Array.getLength(array) == 0) return null; Class aclass = array.getClass(); if(aclass == int[].class) return new ArraySeq_int(null, (int[]) array, 0); if(aclass == float[].class) return new ArraySeq_float(null, (float[]) array, 0); if(aclass == d...
c6e3cdea-5a96-4d30-8011-15517009039b
1
public static List<Point> generateBezierPoints(Curve curve) { a = curve.calculateA(); b = curve.calculateB(); c = curve.calculateC(); d = curve.calculateD(); initializeStart(); List<Point> points = new ArrayList<Point>(); points.add(actualPoint); for (int i = 0; i < n; i++) { actualPoint = generateNe...
5c9919d8-9716-41dd-b73e-c521c07c4416
3
protected void fillPanelFields(boolean sourceField) { String selectedDir = openDirDialog(); if (selectedDir != null) { if (sourceField) { setSourceDir(selectedDir); } else if (!projectPanel.getSourceDir().equals(selectedDir)) { setDestinationDir(selectedDir); } else { MessageDialog.displayMessa...
55d5bd82-bb0c-46fb-809f-916079c7f95a
6
public void keyPressed(KeyEvent e){ key++; if(e.getKeyCode()==87){ //W-Up gp.moveDir('u'); } else if(e.getKeyCode()==83){ //S-Down gp.moveDir('d'); } else if(e.getKeyCode()==68){ //D-Right gp.moveDir('r'); } else if(e.getKeyCode()==65){ //A-Left gp.moveDir('l'); }else if (e.getKeyCode() == Key...
819387e6-f10c-40ba-93ea-10f88431c1c0
7
public boolean parsePrivateMessage(List<Client> targets, String message, Client client) { if (status > 2 && !client.isModerator()) { client.sendButlerMessage(channel.getName(), "Diese Funktion steht dir hier nicht zur Verfügung."); return false; } if (targets.contains(Server.get().getButler())) { ...
f3774886-de1b-4ae7-86cd-906d9a4cde6d
0
@Override public int hashCode() { long longBits = Double.doubleToLongBits(probability); return (int)(longBits ^ longBits >>>32); }
fb632b0e-eab2-4165-8f50-1e88a814dfc8
0
public void mouseClicked(MouseEvent e) { }
8cafad65-fc20-4543-a3e0-26bd5ebe4d93
8
public void keyReleased(KeyEvent evt) { if ((evt.getKeyCode() == keys[UP]) && (direction == DIR_UP)) { direction = 0; } if ((evt.getKeyCode() == keys[DOWN]) && (direction == DIR_DOWN)) { direction = 0; } if ((evt.getKeyCode() == keys[LEFT]) && (direction =...
359b27c8-561e-47ce-8713-0fe62768ec25
4
public ListNode deleteDuplicates(ListNode head) { if( head == null || head.next == null ) return head; Set<Integer> set = new HashSet<Integer>(); set.add( head.val ); ListNode p = head.next; ListNode prev = head; while( p != null ) { if( set.contains( p.val )...
93200a2c-37e5-4101-8511-1a41f0a0e444
5
public void generateLevel() { // Tile generator int x = 0, y = 0; for (int i = 0; i < game.worldWidth * game.worldHeight; i++) { switch (new Random().nextInt(3)) { // Random int from 0 - 2, use as tileID case 0: tiles[i] = new DirtTile(x * 32, y * 32, game); // Place dirt break; case 1: til...
4ef2e35b-853c-4361-9a36-2d61f1408700
8
public List<Interval> insert(List<Interval> intervals, Interval newInterval) { List <Interval> mergedList = new ArrayList<Interval>(); if (newInterval == null) return intervals; if ((intervals == null) || (intervals.isEmpty())) { mergedList.add(newInterval); return mergedLis...
ada977b4-5fdf-423f-b734-4b1efeb0d46c
6
public void run() { ObjectOutputStream oos = null; ObjectInputStream ois = null; Request request = null; Response response = null; try { ois = new ObjectInputStream(new BufferedInputStream(socket.getInputStream())); request = (Request) ois.readObject(); ...
1ebcc985-db1c-43ff-8b25-1b9c556b6a03
2
public String toString() { StringBuilder buf = new StringBuilder(); for(int i = 0; i < prt.length; i++) { if(i > 0) buf.append(", "); buf.append(nm[i] + ": " + prt[i]); } buf.append(", total: " + total); return(buf.toString()); }
229bdb14-0057-400f-a523-5c73cea6bd70
2
public void add( double addVal ) { //Add value as last node, to maintain balance, completeness of tree _heap.add( addVal ); _size++; int addValPos = _heap.size() - 1; int parentPos; while( addValPos > 0 ) { //potentially swap until reach root //pinpoint parent parentPos = (addValPos-1) / 2; i...
b8133d11-e0bc-41ee-8230-34f0667ef43a
7
@Override public boolean nextKeyValue() throws IOException, InterruptedException { if (key == null) { key = new LongWritable(); } key.set(pos); if (value == null) { value = new Text(); } value.clear(); final Text endline = new Text("\n"...
a84bbd5c-3d51-48b1-bdf9-722475ca29c1
7
private void createRoadsRelations() { // Cas des villes voisines pour les routes. for (Town t: towns) { // Pour chaque ville. if (t != towns[54]) { for (Road r: t.getRoadNeighbours()) { // Pour chaque route voisine de la ville. r.addTownNeighbour(t); // Ajouter la ville en tant que ville voisine de la r...
23194ca4-3de9-4471-a640-dbf285d569a6
4
public void act(){ if (!restart){ //if its not restarting checkInput (stage); map.s.playMenu(); }else{ if (Greenfoot.isKeyDown ("r")){ restart = false; gameStart = false; if (win){ ...
c363ec88-a7ee-457b-8485-2e1eb771c7a2
3
public static AccessDelegate getDelegate(Block block) { MaterialData data = block.getState().getData(); if (data instanceof Door) { return new DoorAccessDelegate(block, (Door) data); } else if (data instanceof Bed) { return new BedAccessDelegate(block, (Bed) data); ...
10addcd3-b7a2-4fd3-ac7a-d9e8768708d9
6
protected BshMethod getImportedMethod(String name, Class[] sig) throws UtilEvalError { // Try object imports if (importedObjects != null) for (int i = 0; i < importedObjects.size(); i++) { Object object = importedObjects.get(i); Class clas = object.getClass(); Method method = Reflect.resolveJavaMetho...
4a726150-d360-4e00-82ef-576c0ccc1b20
3
@Override public void caseAIntArrType(AIntArrType node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(IntegerArrayType"); inAIntArrType(node); if(node.getIntArr() != null) { node.getIntArr().apply(this); }...
bf9a48e0-49cd-4d54-9e6e-988f0e2e1f99
1
public void setNumber(int number) { if (number <= 0) { throw new IllegalArgumentException("Number should be bigger than zero."); } this.number = number; }
58c96edf-90ec-4fa1-9578-1197a26a3b0b
3
private void smudgePasteBuffer(CPRect srcRect, CPRect dstRect, int[] buffer, byte[] brush, int w, int alpha) { int[] undoData = undoBuffer.data; int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dstRect.left + j * wi...
65fe6c47-260c-4c61-9eff-cdda58ac44a7
7
public void renderPreview(ShapeRenderer var1) { var1.begin(); for(int var2 = 0; var2 < 6; ++var2) { if(var2 == 0) { var1.normal(0.0F, 1.0F, 0.0F); } if(var2 == 1) { var1.normal(0.0F, -1.0F, 0.0F); } if(var2 == 2) { var1.normal(0.0F, 0.0F, 1.0F); } if(var2 == 3) { var1.normal...
4982ed5d-a7dd-4dff-a1c5-795652519750
9
private void jbIniciarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbIniciarActionPerformed this.usuario = jtfUsuario.getText(); this.pass = new String(jtfPass.getPassword()); noError(); // Si el usuario o la contraseña están vacias if (usuario.equals("") ...
0142747f-2774-4527-a9fe-1215a16e9078
2
public Currency execute() throws IOException{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); while (true){ System.out.println("Introduzca el código de una divisa"); currency = CurrencySet.getInstance().get(reader.readLine()); if (currenc...
85d36f76-586a-41ce-afbc-1ba4010607a6
7
@Override public void run() { final StringBuilder sb = new StringBuilder(); for (final Player player : this.cah.players) { if (!player.hasPlayedCards() && !player.isCzar() && !player.isWaiting()) { player.addWarning(); if (player.getWarnings() == 3) { ...
a0483bd6-eab6-4a3d-8ddd-9c49518d15d8
9
protected synchronized final void addTComponent(TComponent component) { if (component != null && !getTComponents().contains(component)) { /* * Only initiates the TComponent if it has not been * initiated already and this class has had it's own * parent set. */ if (com...
61a4fe16-b294-48d5-bfc5-939e6eb06118
9
public String getId(){ int pos=getPane().getCaretPosition(); String s; try { s = getText(0, getLength()); } catch (BadLocationException e) { return ""; } int l=s.length(); int act; String rigth=""; for(act=pos; act<l;act++ ){ char c=s.charAt(act); if(isIdentifierChar(c)) rigth+=c; else ...
ab13719a-3ba4-4e10-b1b8-08ebe6675ea1
3
@Override public boolean addAll(Collection<? extends Actor> list) { boolean changed = false; for (Actor a: list) if (add(a)) changed = true; return changed; }
c03324fe-09af-4081-a248-3043968dafe3
9
private static void outputActualSPACLCircuit(List<List<Gate>> gates, String circuitName, int[] circuitInfo) { int sizeOfKey = circuitInfo[0]; int sizeOfPlaintext = circuitInfo[1]; int sizeOfCiphertext = circuitInfo[2]; int heapSize = circuitInfo[3]; int maxXOR = circuitInfo[4]; int maxINV = circuitInfo[...