method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
75709c9d-9eaf-4439-b688-43300614e59b
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...
29432b4a-77aa-4528-bf71-a34d432ce5ee
1
public String cyclify() { if (isMetaVariable) { return META_VARIABLE_PREFIX + name; } else { return NORMAL_VARIABLE_PREFIX + name; } }
532b5814-e92c-4911-a14a-bc3ab8df0431
3
@Override public void keyReleased(KeyEvent e) { if(e.getComponent() != null) if(e.getComponent().getName().equals("codeBoxEdit")) if(isLiveDecode()) parent.executeCiphers(); }
bfa33862-f5d4-40d0-b74d-740210c948e4
0
public void visiteur() { this.getCtrlPrincipal().action(EnumAction.MENU_VISITEUR); }
82f7dc61-cafa-4443-ab60-371fdf329e4b
4
public void movePointer(Utility.Direction dir){ pointerY += dir.getDeltaY(); pointerX += dir.getDeltaX(); pointerY = pointerY < 0 ? 0 : pointerY > (items.size()-1)/columns ? (items.size()-1)/columns : pointerY; pointerX = pointerX < 0 ? 0 : pointerX > columns-1 ? columns-1 : pointerX; ...
85d2560a-1620-4b3d-bb6f-deb334a18651
3
public static void main(String[] args) { Scanner input = new Scanner(System.in); char[] str = input.nextLine().toCharArray(); for (int i = 0; i < str.length;i++) { for (int j = 0; j < str.length; j++) { for (int j2 = 0; j2 < str.length; j2++) { System.out.println(""+str[i]+str[j]+str[j2]); }...
10ec0c49-7d1a-4fc8-9912-7dca5dfcb087
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
e7ed6566-827a-4d2d-abbf-362dfd80cf7a
7
public int work(float[] buffer) throws AOException { returned = this.previous[0].nextWork(buffer); if (this.inputs == 2) { if (tmp == null || tmp.length != buffer.length) { tmp = new float[buffer.length]; } else for (index = 0; index < tmp.length; index++) { ...
1169259a-fd04-4b21-b41a-947a5765dac0
9
public static IFuzzyCommand parse(String line) throws FuzzyParserException { if(line == null) { throw new FuzzyParserException("The command string must not be null!"); } IFuzzyCommand command = null; line = line.replaceAll(",\\s+", ","); line = line.replaceAll("write", "w write"); line = line.repla...
5e3f02f2-84b1-48c5-a3ae-1a4d445b4cc9
5
public boolean match(Sim_event ev) { if (ev == null) { return false; } boolean result = false; try { // find an event with a matching tag first if ( tag_ == ev.get_tag() ) { Object obj = ev.get_data(); ...
edf4f57d-f79c-4a38-8425-f45496dd7814
0
public String getChefVente() { return chefVente; }
e69ff7d3-8a88-4c54-a3c0-49473d7ca369
4
public static void entryMode(int a) { // assign cursor moving direction and enable the shift of entire display if (a == 1) { io.iowrite(6,(short)0x6); //cursor moves to right and DDRAM address is increased by 1 } if (a == 2) { io.iowrite(6,(short)0x4); //cursor moves to left and DDRAM address is decreased ...
a0bce9f8-b0cd-41ae-8ebe-5f13488f30de
9
public static char stringToCharacter(String name) { { char renamed_Char = name.charAt(0); if (name.length() > 1) { if (Stella.stringEqlP(name, "SPACE")) { renamed_Char = ' '; } else if (Stella.stringEqlP(name, "LINEFEED")) { renamed_Char = '\n'; } e...
ec4d28ce-26e8-4a54-901a-3b4199b29bd5
4
public static boolean equals(Object obj1, Object obj2) { if ((obj1 == null) && (obj2 == null)) { return true; } else if ((obj1 == null) || (obj2 == null)) { return false; } else { return obj1.equals(obj2); } }
90596458-8d47-4cb1-bc78-af6d9d471395
2
public void tick() { if (input.attack.clicked || input.menu.clicked) { game.setMenu(parent); } }
0524069f-dcf6-426d-ac53-21a255fe281c
9
@Override public void run() { ObjectInputStream in = null; ObjectOutputStream out = null; try { in = new ObjectInputStream(this.socket.getInputStream()); out = new ObjectOutputStream(this.socket.getOutputStream()); } catch (IOException e) { e.print...
53cb42b4-688a-41e3-a5f5-3c0a79e168ce
1
private void botonBorrarPersonaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonBorrarPersonaActionPerformed borrando = true; DefaultTableModel modelo = ((DefaultTableModel) jTable.getModel()); int fila = jTable.getSelectedRow(); //Eliminamos esa persona de la list...
c1f77928-837c-4ecc-8f01-ca863fdbf619
6
private static byte[] getSubBusAndCheck(HDLTokenizer input, String pinName, int busWidth) throws HDLException { byte[] result = null; try { result = getSubBus(pinName); } catch (Exception e) { input.HDLError(pinName + " has an invalid sub bus specification"); ...
4fb09231-3bdd-4e05-bdf1-2ed42381bcef
8
@Override public boolean equals(Object obj) { if( !(obj instanceof Client.UIState) ) return false; Client.UIState o = (Client.UIState)obj; return (scene == o.scene || (scene != null && scene.equals(o.scene))) && (stats == o.stats || (stats != null && stats.equals(o.stats))) && textMessages.equa...
113cce57-6fac-4352-9d55-4f5d33227b5c
3
public void preencherTabela() throws Exception { ArrayList<String> colunas = new ArrayList<String>(); colunas.add("id"); colunas.add("nome"); Object linhas[][] = new Object[list.size()][]; int i = 0; for (AreaFormacao areaformacao : list) { linhas[i] = formatoTabela(areaformacao); i++; } view.g...
6fee63e2-8844-4502-85c4-bd77dce7a832
3
public static void toggleEditableInheritance(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleEdi...
44c8874c-e33e-4f2e-b78e-20374f20967e
1
protected void playerInitialize() { try { audioDevice = FactoryRegistry.systemRegistry().createAudioDevice(); InputStream stream = getClass().getResourceAsStream(filePath); player = new AdvancedPlayer(stream, audioDevice); player.setPlayBackListener(this); ...
be409941-9eda-4127-8373-3f9f9d7d0a1f
4
public static void main(String[] args) { IntSet set = new IntSet(); for (int i = 2; i < 10; i += 2) { set.add(i); } for (int i = 1; i < 9; i++) { System.out.print(i + "-" + set.isMember(i) + " "); } // 3. Clients ask the collection object to creat...
88090528-14a9-4069-b80c-24c28cee9aaa
2
public boolean checkUser(Client c){ for(Client tempc: usershere){ if(tempc.equals(c)){ return true; } } return false; }
0b2009bb-4855-4306-a0ed-63f4e43bb234
9
public static HelperConfig loadConfig(String configPath, String appName) { Document doc = XmlTools.initDocument(configPath); if (doc==null //TODO Use a better validate path // || !XmlTools.validateXml("./HelperConfiguration.xsd", configPath) ) return null; Element rootElement = doc.getDocumentElement(...
95b3089e-8eca-4922-90c6-526d7d8ca709
1
public boolean hitLeft() { if(nextX() <= xMin) return true; return false; }
bd1d71e7-45c4-42c2-b27d-52ac2ae859e2
2
private void display() { blitNumber((int) totalFps, 5, 2); blitNumber((int) lastPps, 5, 12); if (!openGL) { if (!fullscreen) { buffer.display(gFrame, leftBorderWidth, titleBarHeight); } else { Graphics g=bufferStrategy.getDrawGraphics(); g.drawIma...
a6200a68-a347-41cb-89be-7182198579dc
1
public boolean add(String tableName, List<String> args) throws DataBaseTableException { Table table = tableHashMap.get(tableName); if (table == null) { throw new DataBaseTableException("no such table"); } return table.add(args); }
037612a0-7cb4-400d-b812-e85793e71407
3
public void gameStateChangeListener(GameLogic.GameState state) { switch(state) { case PLAYING: //audioPlayer.stop(currentMusic); clearScreens(); addScreen(GameplayScreenFactory.create()); audioPlayer.playMusic("gameplay", true); ...
81b8dc51-fe4b-49d1-8705-edfcb242cf5f
5
public final void clearOldNodes(int i) { if (Class142_Sub8_Sub31.softReferenceFactory != null) { for (ReferenceHolder referenceHolder = (ReferenceHolder) list.getTail(); referenceHolder != null; referenceHolder = (ReferenceHolder) list.getPrev()) { if (referenceHolder.isSoft()) { ...
1d6ea6fb-7661-4d26-a589-86fec1cff08f
7
@Override protected void generateTheory(InputStream ins) throws ParserException { try { if (null == theoryUnmarshaller) theoryUnmarshaller = XjcUtilities.getTheoryUnmarshaller(); Theory cTheory = (Theory) theoryUnmarshaller.unmarshal(ins); theory = new spindle.core.dom.Theory(); ruleCounter = 0; th...
c686bcee-4b11-496a-b22c-f0a528041ce4
1
public static void main(String[] args) { Random r = new Random(); DelayQueue<Student> students = new DelayQueue<Student>(); ExecutorService exec = Executors.newCachedThreadPool(); for(int i = 0; i < STUDENT_SIZE; i++){ students.put(new Student("学生" + ( i + 1), 3000 + r.nextIn...
83e1078f-88c8-4397-9add-d6cd65e4a1e8
7
@Override public void run() { if (logger.isLoggable(Level.FINEST)) { logger.finest("Starting row diff change processor"); } while (true) { try { IRow r = queue.take(); if (r instanceof PoisonRow) { ...
17d5ac80-62de-41eb-b9d6-d57c94553626
2
public SpriteSheet(String path) { BufferedImage image = null; try { image = ImageIO.read(SpriteSheet.class.getResource(path)); } catch (IOException e) { e.printStackTrace(); } if (image == null) { return; } this.path = path; this.width = image.getWidth(); this.height = image.getHeight()...
4fe0ee62-f90b-4c76-9c63-18a91682fe03
7
public int reductionLigne() { int sommeRegret = 0; int min; for(int i = 0; i < this.getTaille(); i++) { min = this.getValue(i, 0); if(i == 0) { min = this.getValue(i, 1); } for(int j = 0; j < this.getTaille(); j++) { if(this.getValue(i, j) != -1) { min = (this.getValue(i, j) < min)?...
e4026e54-e892-4006-8693-ff9a00df5955
1
@Override public Object clone() { DefaultInferenceParameters copy = new DefaultInferenceParameters(cycAccess); Iterator<CycSymbol> iterator = this.keySet().iterator(); while (iterator.hasNext()) { CycSymbol key = iterator.next(); Object value = this.get(key); // note: this might should be clon...
1e8aaf92-ee5f-4443-85ac-e4c4f6cdae04
7
private ArrayList<Integer> primes(int pos){ if(pos>31) throw new RuntimeException("primes not defined to go that large\nset to less than 32"); if(pos<1) throw new RuntimeException("No valid moves specified in primes\nset to more than 0"); ArrayList<Integer> out = new ArrayList<Integer>(); if(bitTest(pos...
35b8fae0-f8b9-4217-b6eb-a2ec682c4dae
5
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String action = request.getParameter("act"); if(action != null) { try { RequestContext context = new RequestContext(request); if(context.isLogged(...
10de2023-276e-461a-bedc-c48ab8937ee3
3
@EventHandler public void onConnectionEvent(ConnectionEvent event){ try{ if(!IPMap.put(event.getSocketChannel().getLocalAddress())){ try{ event.getSocketChannel().socket().getOutputStream().write(new String("We Are Full!").getBytes()); event.getSocketChannel().socket().getOutputStream().flush(); ...
115534ea-6eae-45cc-b06c-494382e93eaa
1
@Override public void paintComponent(Graphics g) { super.paintComponent(g); square = new Rectangle2D.Double(0, 0, this.getWidth() - 1, this.getHeight() - 1); squareInside = new Rectangle2D.Double(1, 1, this.getWidth() - 3, this.getHeight() - 3); g2d = (Graphics2D) g; g2d.setPaint(StockState.getColor...
5c27e151-467d-4357-8a4c-5ddfb6f9c06b
7
@Override public boolean equals(R2DType type) { if(type == null) return false; if(!type.name.equals(name) || !(type instanceof R2DTypeVec2D)) return false; Vector2 otherData = ((R2DTypeVec2D)type).data; if((data == null && otherData != null) || (otherData == null && data != null)) return false; re...
dff6f1e2-26b8-4934-8b5f-3cda02505313
6
public void strikeByObject(int ap, int weight, int vecX, int vecY) { if (dead) { return; } // 迥カ諷九↓繧医k繝�Γ繝シ繧ク螟牙喧 if(wet) { ap *= 1.5; } if(isHasPants()) { ap *= 0.8; } // 蜷ケ縺」鬟帙�險ュ螳� // 菴馴㍾蟾ョ int kick = (weight - getWeight()) / 100; if(kick < 1) kick = 1; //System.out.println(vecX+","+v...
f7f64541-1a54-4843-9393-7e07139ccb3b
7
private FileDescriptor(final FileDescriptorProto proto, final FileDescriptor[] dependencies, final DescriptorPool pool) throws DescriptorValidationException { this.pool = pool; this.proto = proto; this.dependencies = dependencie...
ff9521e7-8c3c-4c27-b780-bab5d8c1e36d
1
private boolean jj_3_46() { if (jj_3R_58()) return true; return false; }
0e5c266f-fd65-49db-b9e1-6ba35691c06c
3
public void setNumInt(TNumInt node) { if(this._numInt_ != null) { this._numInt_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
46efca88-2a30-4794-8db0-7cdce8338735
5
protected void onRender(GraphicsHelper gh) { Rectangle r = new Rectangle(xOnView(pos.x),yOnView(pos.y),s,s); gh.drawRectangleGradient(r,cBgTop.multiply(color),cBgTop.multiply(color),cBgBottom.multiply(color),cBgBottom.multiply(color)); gh.g().setColor(cBorder.multiply(color)); gh.g().draw(r); float mult...
ecc3be63-f856-420b-845a-d5ea8d5f324e
3
public int dit(Model model){ int res = 0; for(Generalization g : model.getGeneralization()){ for(String str : g.getArrayIdent()){ if(str.equals(this.identifier)){ res = cheminPlusLongVersRacine(model, g); } } } //System.out.println(res); return res; }
43a575e5-83ba-45a9-8495-8824b2918f47
8
public boolean isAdjacent(Position position, double radius) { if(this.isImpassable(position, radius)) return false; double step = 0.1 * radius; double checkingWidth = 1.1*radius; double startRow = (position.getY() - checkingWidth); double startColumn = (position.getX() - checkingWidth); double endRow ...
e1a7ba81-382a-4d66-b55d-f3cdac030764
1
private static int updateStarts(int base, int[] values, int[] starts) { int start = base; for (int i = 0; i < values.length; i++) { starts[i] = start; start += values[i]; } return start - base; }
a241c63a-013e-4961-b4bd-61f60c1a5da1
6
@Override public void actionPerformed(final ActionEvent e) { if (e.getSource() instanceof Button) { this.handleButtton(e); } else if (e.getSource() instanceof Menu) { this.handleMenu(e); } else if (e.getSource() instanceof MenuItem) { this.handleMenuItem(e); } else if (e.getSource() instanceof T...
2586e1dd-b671-4715-9d2b-f23121b67936
3
public boolean freqDecision (int freq,int centreFreq,boolean inv) { if (inv==false) { if (freq>centreFreq) return true; else return false; } else { if (freq>centreFreq) return false; else return true; } }
6957d023-d356-47af-aba7-2b4e630e7b18
0
public final Color getColor() { return color; }
ea06aeca-eb94-4c70-99c4-4a2a68ccc60b
3
@Override protected boolean doInsertAfter(IProcessComponent<?> component, IProcessComponent<?> predecessor) { int index = components.indexOf(predecessor); if (index == -1) { return false; } add(index + 1, component); return true; }
8d8d4200-1de5-4998-a1e3-4c95f3d1d0ed
1
public void letClientsThink(){ try { Thread.sleep(roundTimeMilliseconds); // 1000 } catch (InterruptedException e){ Debug.warn("INTERRUPTED!"); } }
e401724b-131d-4761-aead-56cace481586
4
public void init() { String colorstr = getParameter("pagecolor"); if (colorstr == null) colorstr = "ffffff"; this.pageColor = new Color(Integer.parseInt(colorstr, 16)); colorstr = getParameter("bgcolor"); if (colorstr != null) setBackground(new Color(Integer.parseInt(colorstr, 16))); String cp = getPa...
79624592-b5e5-4d26-9d45-3d3c3f2a3ecf
3
public String dump() { String dump = ""; for (int i = 0; i < grid.length; i++) { for (int j = 0; j < grid[0].length; j++) { dump += grid[i][j] ? 'O' : '.'; } dump += "\n"; } return dump; }
c70ebd30-8bb5-4af2-b3ed-16984e6d39f1
4
private ArrayList<String>[] partArrays(ArrayList<String> tmp) { int count = 0; // Nombre de noeuds disponibles for (boolean bool : nodeDispo) { if (bool) count++; } System.out.println("count = "+count); // On redivise le travail non fait @SuppressWarnings("unchecked") ArrayList<String> res[] = new ...
4f4faf6b-a3bf-4a4f-943e-0510fd503dc9
0
public void insert(Persist persist) { String sql = "insert into SaleItems (SaleId, ItemCode, Name, Price, Quantity, SupplierCode, BumonCode) " + "values (?, ?, ?, ?, ?, ?, ?)"; persist.executeUpdate(sql, getSaleid(), getItemcode(), getName(), getPrice(), getQuantity(), ge...
3e3661b0-b523-43a9-948f-f583865b7ebe
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
505a3ca8-60d8-4d62-ac5c-cbee077f353a
7
public void login_function() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { //READ HIERARCHY FROM DATABASE AND DECIDE ON FUNCTION--|| Class.forName("com.mysql.jdbc.Driver").newInstance(); Statement s = GUI.con.createStatement(); s.executeQuery ("SELECT Hierarchy, ...
b230343a-820d-4f09-b21d-08f191c72307
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 AriadnaMember)) { return false; } AriadnaMember other = (AriadnaMember) object; if ((this.memberId == null && o...
27149e49-cb76-480e-93cc-ac8e0b1e9d82
3
private Rectangle deserializeWindowPosition(final Locatable window) { final String positionString = appProperties.getProperty(window.getName()); // Exit if (positionString == null) { log.debug("The position of the window {} is not saved in the properties file.", window.getName()); return null; } ...
7524922a-a889-4029-a883-0048bcd67a36
9
@Override public void setPosition(Integer startNode, Integer finalNode, AggregatePositioner source) { if (startNode != null) getStartNodeValueLabel().setText(startNode.toString()); else getStartNodeValueLabel().setText("Not set"); if (finalNode != null) getFinalNodeValueLabel().setTex...
eb0b73b5-c9c2-4172-959d-a54424dfa6e6
6
private void checkValidContent(Iterator<Cell> cellIterator, Row row, int flag) { if (flag == OK_PRINT) { while (cellIterator.hasNext() && this.copyCellContent) { Cell cell = cellIterator.next(); // Condição parada de leitura do arquivo. if (row.getC...
737727bb-8d19-4000-ad4d-907c662cc742
5
public ListNode deleteDuplicates(ListNode head) { ListNode temp = head; if (head == null){ return head; } while(temp.next!=null){ if (temp.val == temp.next.val){ if( temp.next.next!=null){ temp.next = temp.next.next; ...
3fa49807-b79a-4bfb-9dbe-2cc7fc1b6966
2
public static int skipType(String methodTypeSig, int position) { char c = methodTypeSig.charAt(position++); while (c == '[') c = methodTypeSig.charAt(position++); if (c == 'L') return methodTypeSig.indexOf(';', position) + 1; return position; }
345713d6-2593-4333-a25d-f8722efd0d66
2
public void alimentaTabelaVeiculo(String SQL){ ArrayList dados = new ArrayList(); String [] Colunas = new String[]{"Placa","Marca","Modelo","Ano","AnoModelo","Cor","Chassis","Decric.","Status","Valor/Dia"}; connVeiculo.executaSQL(SQL); try { ...
974e8832-21e0-4e1e-9fea-1034f937e934
8
protected double[] svmlightToArray(String row) throws Exception { double[] result; StringTokenizer tok; int index; int max; String col; double value; // actual data try { // determine max index max = 0; tok = new StringTokenizer(row, " \t"); tok.nextToken(...
c79c1775-dfdc-4b5e-a3b8-4902c43b56d6
9
public String getAttackSpot(double defendersDefSkill,String aim) { setRealSkills(); double proficency=0; if(attackStyle.equals("handToHand")){proficency=getHandToHand();} double diff= ((getAttSkill()-defendersDefSkill)/2.0)+((3*proficency)/20.0); double legs;double arms; double torso;doub...
bf410c4c-8c47-4dd0-b2a6-39e46aea8794
1
public static void CreateWindow(int width, int height, String title) { try { Display.setTitle(title); Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); Keyboard.create(); Mouse.create(); } catch (LWJGLException e) { e.printStackTrace(); } }
8966b6cc-ee6a-48b6-b376-4fd58e9f1fdb
2
private static void printFileWriters(String prefix, Map<String, FileWritingMessageHandler> fileWriters) { Assert.notNull(fileWriters, "Mandatory argument missing."); for (String key : fileWriters.keySet()) { FileWritingMessageHandler writeTarget = fileWriters.get(key); File out...
338e39ae-f417-4b0f-b4d1-5e7150f74ee6
1
public static void main(String[] args) { try { Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread t, Throwable e) { handleException(e); } })...
2e276ac0-4488-49b2-8d7d-ad29cbf1372c
4
public double slopeTo(Point that) { double x0 = this.x; double y0 = this.y; double x1 = that.x; double y1 = that.y; if (x0 == x1 && y0 == y1) { return -1.0/0.0; } else if (y0 == y1) { return 0; } else if (x0 == x1) { return 1.0/0.0; } else { return (y1-y0)/(x1-x0); } /*...
d7c93e11-60cc-44fd-b5b7-60283d39122a
4
public WebDriver getDriver(String browser, String url) { if(browser.equalsIgnoreCase("chrome")){ System.setProperty("webdriver.chrome.driver", "C:/Users/Gufran/Desktop/Documents/PeoplenTech Documents/Class Notes(03-29-14) on Selenium-JAVA/chromedriver.exe"); wd = new ChromeDriver(); ...
36dee734-3034-4c8a-8be8-c57e37747070
5
private void button2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button2MouseClicked if(numberofpins < 4) { if(numberofpins == 0) { Login_form.setString1("9"); } if(numberofpins == 1) { Login_form.setString2("9"); } if(numberofpins == 2) { Login_...
1c8bf0a6-3efd-42de-b03c-eadfc7f2f5dc
8
private void acceptButtonUpdateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonUpdateActionPerformed boolean error = false; String errorString = ""; Object[] what = new Object[7]; what[0] = enabledConectionUpdate.isSelected(); if (!userUpdateData.ge...
9ba504e6-cdb2-408e-ac74-3818ad6c7351
2
public Edge getEdge( int toID ){ for( Edge edge : edges ){ if( edge.to == toID){ return edge; } } return null; }
33a5e7f8-7572-47b5-bb1c-7c534b521294
7
public void karteAuslesen(){ for(int x = 0;x<karte.getWidth();x++){ for(int y = 0;y<karte.getHeight();y++){ Color c = new Color(karte.getRGB(x,y)); if(c == grass){ tileIDs[x][y]=0; }else if(c == sand){ tileIDs[x][y]=1; }else if(c == busch){ tileIDs[x][y]=2; }else if(c == stein){ ...
d846b48c-5495-4e4b-b52f-dfaf98659cf4
0
public String getGearbox() { return gearbox; }
b61b74f7-3e8d-4cd6-9a4c-6d9d4e66b0ac
1
public void restoreScreen() { Window window = device.getFullScreenWindow(); if (window != null) { window.dispose(); } device.setFullScreenWindow(null); }
d8808278-e2d8-4f64-9165-6d5a18f6f572
3
private Point ySearchFirstPoint(Point startPoint) { Point currPoint = new Point(startPoint.x, startPoint.y); while (startPoint.dF * currPoint.dF > 0) { if (currPoint.y <= yNull) { currPoint.setY(currPoint.y + 1); } else { break; } ...
95e7e8ef-112a-4eeb-9bc5-6f2a6c7ddde1
3
public static String updateUser(String userString) { userString = userString.substring(6); int id = Integer.parseInt(userString.split("\\\\")[0]); String username = userString.split("\\\\")[1]; if(username.charAt(0) == '"') username = username.substring(1, username.length()-1); String outputStr = ""; ...
7c16f7f7-4aca-408a-993d-ffc91d5a69f0
1
public void setConstants(final Constant[] constants) { this.constants = new ArrayList(constants.length); for (int i = 0; i < constants.length; i++) { this.constants.add(i, constants[i]); } }
33af29f7-c9f2-4b14-9afe-d1ac61f671d0
1
private void jEnableBtnActionPerformed(java.awt.event.ActionEvent evt) { if (!enabled) { robotInstance.getPacketTransmitter().setEnabled(); jEnableBtn.setText("Disable"); jRoboStatus.setText("Broadcasting (Enabled)"); enabled = true; } else { robotInstance.getPacketTransmitter().setDisabled(); ...
81039082-69da-4874-9ae8-2b8df4df8b50
3
public Expense findLowestPriority() { Expense lowest; if(m_expenses.size() > 0) { lowest = m_expenses.get(0); for(int i = 0; i < m_expenses.size(); ++i) { Expense compare = m_expenses.get(i); if(compare.getPriority() < lowest.getPriority()) { lowest = compare; } } } else l...
fd1a34eb-8abd-4220-bb79-18f6afc1616d
3
public static JFileChooser konfiguriereFileChooser(final boolean save) { final JFileChooser fileChooser = new JFileChooser("./level/"); fileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Zuul-Level"; } @Override public boolean accept(File arg0)...
ce26b4b3-1fcb-4545-87e0-9cd9b0d952a6
7
private static Type decodeType(int dataType) throws IOException { Type result; switch (dataType) { case 0: result = Type.U8; break; case 1: result = Type.STRING; break; case 2: result = Type.U16; break; case 3: result = Type.U32; break; case 4: result = Type.X8; ...
a69ee511-0941-40bf-abc0-acd6d2a3d274
2
public Playfield(int nagents, double dt, int ddt) { DT = dt; DDT = ddt; agents = new Agent[nagents]; for (int i = 0; i < nagents; i++) do agents[i] = new Bug(this, "Bug " + i); while(collision(agents[i], false)); }
71840da0-71bf-42c7-99a7-68c8cf1192ce
9
public Facility(EnumFacilityType type, Corporation owner, Planet location){ this.type = type; this.owner = owner; this.location = location; name = location.getName()+type.toString(); switch(type){ case ELECTRONICSPLANT: inputs.add(EnumResource.CIRCUITRY); output=EnumResource.ELECTRONICS; productionTime=...
babe9ec2-c106-4686-84ae-cd80687b23a2
3
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((version == null) ? 0 : version.hashCode()); return result; }
7021e287-1b94-4e55-abd9-88e8f70139d5
4
public HangmanState(Set<String> knownWords) { /* initialize answer */ int index = (int) (Math.random() * knownWords.size()); Iterator<String> itr = knownWords.iterator(); for (int i = -1; i < index - 1; i++) { itr.next(); } this.theAnswer = itr.next(); this.lettersGuessed = new HashSet<String>(); S...
fef49561-605f-4af3-ae0c-3eaf61f50b9a
8
public static void setArgParam(String key, String value) { if(key.equals("traffic_pattern")) { setParam(key, TrafficType.valueOf(value.toUpperCase())); } else if(key.equals("routing")) { setParam(key, RoutingType.valueOf(value.toUpperCase())); } else if(key.equals("faults")) { setParam(key, ...
dcbf46b4-422c-43eb-b47a-1a1cf1a58071
7
Space[][] getOpenSets(Space sp) { Space[][] sets = new Space[getNumOpenSets(sp)][3]; int index = 0; if (getNumOpenSets(sp) != 0) { if (isOpenForPiece(board[sp.getX()], sp.getPiece())) { sets[index] = board[sp.getX()]; index++; } if (isOpenForPiece(getColumn(sp.getY()), sp.getPiece())) { sets[...
a4de83c4-8aac-41d4-945f-8d7bf7fc6d87
8
public void extractExample(String zipFilePath, String saveFileDir) { File file = new File(zipFilePath); if (file.exists()) { InputStream is = null; ZipArchiveInputStream zais = null; try { is = new FileInputStream(file); zais = new ZipArchiveInputStream(is); ArchiveEntry archiveEntry = null; ...
81efb5d5-870f-4604-b824-93d2584521b1
8
private static boolean dayView(Calendar cal, DateTime d) { Event[] events = cal.getDay(d); if (events == null) { return false; } //30 spaces across String title = "Events for " + d.getMonth() + "-" + d.getDay(); String spacer = "---------------------------------------------"; int x = 45 - title.lengt...
7c7513a2-8034-46d8-a1d9-d9885032c526
3
@Override public void storeTrays(List<Tray> trays, Stock destination) { Iterator<StorageUnit> i = destination.getStorageUnitsIterator(); while (i.hasNext()) { StorageUnit unit = i.next(); for (int taken = unit.getTrays().size(); taken < destination .getMaxTraysPerStorageUnit(); taken++) { Tray tray ...
1bc37be6-bfee-4fec-be3f-e3a655242854
3
public void colocarObjetos(Snake s,Presa pre) { tab=new int[filas][columnas]; Punto p=pre.ub; tab[p.y][p.x]=PRESA; // p=s.vibora.get(0); for(int i=0;i<s.vibora.size();i++) { p=s.vibora.get(i); if(i==0) { //Colocar la Cabeza tab[p.y][p.x]=CABEZA; }else if(i==s.vibora.size()-1) { ...
ca6dc59c-baa8-4282-977c-8d76e310f4f8
1
public void request() { this.preReques(); //在真实角色操作之前所附加的操作 if(null == realsubject) { realsubject = new RealSubject(); } realsubject.request(); //真是角色所完成的事情 this.postRequest(); //在真实角色操作之后附加的操作 }
39ee2c40-4f86-4ac3-959e-f3b383cd992d
3
protected final synchronized String readLineL(){ String line=""; try{ line = input.readLine(); }catch(java.io.IOException e){ System.out.println(e); } if(line==null){ if(!th...
20149e5e-bd1d-4595-b8bc-7d94eeed608f
7
public void updatePosition() { if (position.mX < destination.mX) position.mX++; else if (position.mX > destination.mX) position.mX--; if (position.mY < destination.mY) position.mY++; else if (position.mY > destination.mY) position.mY--; if (position.mX == destination.mX && po...