method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ec491d10-0ba9-4f59-80bc-8561299622a1
8
private TreeModel makeTreeModel(ResultData[] results) { // Pseudo-Wurzel erstellen TreeNodeObject rootNode = new TreeNodeObject("Wurzel", ""); int position = 0; for(Iterator iterator = _treeNodes.iterator(); iterator.hasNext();) { Object object = iterator.next(); TreeNodeObject treeNodeObject = null...
025956df-28d0-49d8-bdf5-df4af9388b42
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ParseResult that = (ParseResult) o; if (value1 != null ? !value1.equals(that.value1) : that.value1 != null) return false; if (value2 != null ? ...
ad60ff65-2209-4f61-82b7-7c886ffa70fa
0
public void setListener(JNotifyListener listener) { this.listener = listener; }
36166618-e909-4ea6-b382-409e91a3f1c1
8
public boolean equals(Object o) { if (o == this) return true; if (o == null || !(o instanceof FastSparseSet)) return false; int[] longdata = ((FastSparseSet)o).getData(); int[] shortdata = data; if (data.length > longdata.length) { shortdata = longdata; longdata = data; ...
e816df65-c6b5-41e9-8d39-066bde34ac54
3
@Override public List<Fornecedor> ListByNome(String nome) { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Fornecedor> fornecedores = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepar...
f25033e0-1787-45f6-816b-2d3c90df5e05
8
private void writeInstance(Instance inst) throws Exception{ StringBuffer insert = new StringBuffer(); insert.append("INSERT INTO "); insert.append(m_tableName); insert.append(" VALUES ( "); if(m_id){ insert.append(m_count); insert.append(", "); m_count++; }...
f0532779-c5b0-4589-adce-19dd78122581
3
protected void rimuoviNodo(AlberoBin<T> a) { AlberoBin<T> figlio = (a.sin() == null ? a.des() : a.sin()); AlberoBin<T> padre = a.padreBin(); int pos = a.pos(); a.pota(); if (figlio != null) figlio.pota(); if (padre != null) padre.setFiglio(figlio, pos); else coll = figlio; }
7440551a-39c3-44a8-aea3-fca7789912bd
8
private static Pair findTextEdge(BufferedImage capture){ int left = 0; int right = 0; int mid = capture.getHeight()/2; for(int i = 0; i < capture.getWidth(); i++){ //from left to right int rgb = capture.getRGB(i, mid); float[] hsb = Color.RGBtoHSB((rgb >> 16 & 0xFF), (rgb >> 8 & 0xFF), (rgb & 0x...
fc98e18f-47c7-4103-b78e-100a845d4196
3
public double getDensity() { double count = 0; for(int x = 0; x < pixels.length; x++) { for(int y = 0; y < pixels[0].length; y++) { if(pixels[x][y]) { ++count; } } } return count / (pixels.length * pixels[0].length); }
4a603a56-76f3-47f2-8a1c-e744314e886a
2
public void cargarPedidos() { String sql = "SELECT t2.idpedidos AS id_pedido , t1.nombres AS clientes, t3.nombre AS empleado, t2.precio_total " + "FROM clientes AS t1, pedidos AS t2, empleados AS t3 " + "WHERE t1.idclientes = t2.clientes_idclientes " + "AND t3.id...
43499b7f-5ff4-4db9-b7d9-379fe4ec95f7
2
public double reducedMass(char direction) { if (direction == 'x' || direction == 'a') { return 1 / (1 / mass_elx + 1 / mass_hhx); } else { return 1 / (1 / mass_elz + 1 / mass_hhz); } }
cc57ca59-5b28-4f08-b817-4099936bda2f
9
public static QR GivensQRDecomposition(Matrix m) throws QRException { int row = m.getRowSize(); int col = m.getColumnSize(); Matrix u = new Matrix(row, col); QR qr = new QR(row, row, col); int size = Math.min(row, col); for (int i = 0; i < size; i++) { qr.q.set(i, i, 1); } for (int i = 0; i < ...
dc28f4f7-3e0d-42c1-8ca4-77ab893a7be4
2
public String submitNotebookSolutionAttempt() { final boolean isCorrect = notebookProblemSet.verifyNotebook(notebook); final StringBuilder resultStringBuilder = new StringBuilder(notebookProblemSet.getMessageFromLastTest()); if (isCorrect) { if (notebookProblemSet.hasNextProblem()) {...
b0cbf52c-3837-4f62-be46-53788500b185
5
private boolean isDaysNegative(DateTime subtractor){ if (this.getYear() > subtractor.getYear()){ return false; } else if (this.getYear() == subtractor.getYear()){ if (this.getMonth() > subtractor.getMonth()){ return false; } else if (this.getMonth() == subtractor.getMonth()){ if (this.getDay()...
6cb24223-4080-49ed-a4ee-69cb304139a8
6
private final Class348_Sub19_Sub1 method307(int i, int[] is, int i_0_, int i_1_) { anInt378++; int i_2_ = i ^ (i_1_ >>> 1578798380 | i_1_ << -1997163324 & 0xfff1); i_2_ |= i_1_ << -1230270352; long l = (long) i_2_; Class348_Sub19_Sub1 class348_sub19_sub1 = (Class348_Sub19_Sub1) aClass356_381.get(l); if...
0be5d8d3-54db-48f9-89b5-fa6685156a8f
9
private static int method503(char ac[], char ac1[], int j) { if(j == 0) return 2; for(int k = j - 1; k >= 0; k--) { if(!method517(ac[k])) break; if(ac[k] == '@') return 3; } int l = 0; for(int i1 = j - 1; i1 >= 0; i1--) { if(!method517(ac1[i1])) break; if(ac1[i1] == '*') l...
5f2a5166-ccd0-4520-a144-1ddef3beaa75
8
private boolean isSingleValueRestrictionType() { return this.restrictionType.equals(RestrictionType.EQUAL) || this.restrictionType.equals(RestrictionType.NOT_EQUAL) || this.restrictionType.equals(RestrictionType.GREATER) || this.restrictionType.equals(RestrictionType.GREATER_EQUAL) || this.res...
bed57495-bdad-4ecb-9bfe-02b4294aef46
5
protected void execute() { boolean fineTune = false; if (Math.abs(Robot.oi.getRightX()) > 0.4){ fineTune = true; } boolean inverted = Robot.oi.getIsInverted(); double acceleration = DriveRobot.checkInverted(DriveRobot.getDeadZone(-Robot.oi.getRightY(), 0.25), inverted...
1246e32b-b54d-4506-815d-bfd65f76c0d9
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); // Get the variable info for browse by the selected codebook if (request.getParameter("codebook") != null) { response.setContentType("text/html"); UR...
73ed5b32-f07b-4898-9f7f-a584e343b652
8
public void setCurrentDirection(Direction desiredDirection) { switch (desiredDirection) { case UPARROW: if (this.currentDirection != DOWNARROW) { this.desiredDirection = UPARROW; } break; case DOWNARROW: ...
66f0078c-ebfa-4e4c-8782-a94d5e38d7cf
1
@Override protected DataSet doParse() { final DataSet ds = new BuffReaderDataSet(getPzMetaData(), this); try { // gather the conversion properties ds.setPZConvertProps(ParserUtils.loadConvertProperties()); br = new BufferedReader(getDataSourceReader()); ...
a71439ac-2578-40ba-b178-451b439e858b
9
private boolean r_mark_suffix_with_optional_y_consonant() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 153 // or, line 155 lab0: do { ...
89c1c8b7-f543-49da-b935-fca3ff802e68
6
private static ClassPath makePathObject(String pathname) throws NotFoundException { String lower = pathname.toLowerCase(); if (lower.endsWith(".jar") || lower.endsWith(".zip")) return new JarClassPath(pathname); int len = pathname.length(); if (len > 2 && pathnam...
49611861-eeff-4aeb-b3ee-26287bbbce41
3
public void cadastraAluno(String nome, String matricula) throws AlunoJaExisteException { boolean teste = false; for (Aluno e : alunos) { if (e.getMatricula().equals(matricula)) { teste = true; break; } } if (teste == false) { Aluno a = new Aluno(nome, matricula); alunos.add(a); } else {...
49762e51-30dd-4b0c-bdd7-1d1595485718
8
public Parser(){ String input = UtilitiesLA.ReadStringFromInput(); List<String> list = Arrays.asList(input.split("\n")); Iterator<String> it = list.iterator(); String line=it.next(); while(line.substring(0,1).equals("{")){ FillRegDef(line); line = it.next(); }; mStateCounter...
9cacc79e-3b18-491b-aa5b-15d01f0f5404
4
public void init(int mode, byte[] key, byte[] iv) throws Exception{ String pad="NoPadding"; byte[] tmp; if(iv.length>ivsize){ tmp=new byte[ivsize]; System.arraycopy(iv, 0, tmp, 0, tmp.length); iv=tmp; } if(key.length>bsize){ tmp=new byte[bsize]; System.arraycopy(k...
4d31aba5-ae50-4e9a-83fb-b20dc44f8e82
4
public Serializable decode(File file, Map parameters) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(file); Transducer transducer = TransducerFactory.getTransducer(doc); return transducer...
98052a6a-0c71-450e-aae0-7c6c3a3ffa4c
0
public Float getGainReference_dB() { return gainReference_dB; }
3c8df1e0-6777-44a4-8e50-dae6aaf3dfdc
4
public void delete() { for (OVLine l : lines_) { l.delete(); } lines_.clear(); for (SlotInterface s : connections_) { if (s instanceof InNode) { if (((InNode) s).getLine(this) != null) { ((InNode) s).getLine(this).delete(); ...
84f93ddf-f03d-4df3-9a6d-6821c5711d9d
2
public static Tank getTank(String tS){ Tank tank = null; String[] d = tS.split(","); tank = new Tank( dI(d[0]), d[1], dI(d[2]), dI(d[3]), decodeDir(d[4]), decodeBoolean(d[5]), dI(d[6]), dI(d[7]), dI(d[8]), dI(d[9]), dI(d[10]), dI(d[11]), decodeBoolean(d[12]), ...
7d5ea888-ec59-4198-b481-cda367607396
3
public Integer getStat() throws Exception { logger.info(commandLinePattern); ExecutionResult result = ProcessCommander.exec(commandLinePattern); if (result.getOut().size() > 1) { try { long pid = Long.parseLong(result.getOut().get(1).trim()); if (pid >...
6183b45c-6382-4356-a9db-5abd810fc8fa
4
@SuppressWarnings("unchecked") public ArrayList<E> toSortedList(Comparator<? super E> cmp) { E[] sorted = (E[]) data.clone(); for(int i = 1; i<size; i++){ E val = sorted[i]; int j; for(j = i-1; j>=0 && cmp.compare(sorted[j], val) > 0; j--) sorted[j+1] = sorted[j]; sorted[j+1] = val; } Arr...
cc28a223-0af8-4620-8a25-452608ddf4c3
3
public TextureAtlas(String path, int cw, int ch) { try { BufferedImage bi = ImageIO.read(new File("src/" + path)); tiles = new Texture[bi.getWidth() / cw][bi.getHeight() / ch]; for (int i = 0; i < bi.getWidth() / cw; i++) { for (int j = 0; j < bi.getHeight() / ch; j++) { Texture t = BufferedImageUti...
c9de93ff-7ca6-44dc-9c3a-4b1a07888233
8
protected static Ptg calcIndirect( Ptg[] operands ) { try { if( operands[0] instanceof PtgStr ) { PtgStr ps = (PtgStr) operands[0]; String locx = ps.toString(); // detect range if( !(FormulaParser.isRef( locx ) || FormulaParser.isRange( locx )) ) { // see if it's a named range Na...
e1b081a4-64fe-48c6-8004-bac4ce448d2c
1
private void xout_participants (Graphics2D g2d, int i, int j, int n) { if (n==13) return; g2d.setColor(MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (i).getPrintColor()); Point a = MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (i).getAnchorPoint(); ...
cc1ec3a9-153d-4608-ae10-4dd4f6dbc4b7
5
@Override public synchronized void writeDebitTransactionToFile(Transaction transaction) { if (debitCounter % BATCH_SIZE == 0 && debitCounter > 0) { String newDebitFileName = this.reportDao .getCurrentFileName(TransactionType.DEBIT.toString(), debitFileName); if (!newDebitFileName.equalsIgnoreCase(debitFi...
c55b6088-6cb8-490d-b0a8-e4e6399538e4
6
public static void main(String[] args) { int WIDTH = 10; int HEIGHT = 7; ConnectFourBoard c4Board1 = new ConnectFourBoard(WIDTH,HEIGHT); ConnectFourPiece[][] c4Pieces1 = new ConnectFourPiece[WIDTH][HEIGHT]; for (int i=0; i<WIDTH; i++) { for (int j=0; j<HEIGHT; j++) { c4Pieces1[i][j] = c4Board1.m_Piece...
8e11c8d5-756a-45ef-9ff9-7c3aed568050
7
public int nullStatus(FlowInfo flowInfo) { if (this.constant != null && this.constant != Constant.NotAConstant) { return FlowInfo.NON_NULL; // constant expression cannot be null } switch (bits & RestrictiveFlagMASK) { case Binding.FIELD : // reading a field return FlowInfo.UNKNOWN; case Binding.LOCAL : // r...
d725e090-a483-4989-b689-65e8b3190321
1
private static ByteBuffer makeRGBABuffer(ArrayBitmap image) { if (image == null) { return null; } final ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4); image.visitAll(new ArrayBitmap.IVisitor() { @Override public void visit(int x, int y, int pixel) { ...
b05a2670-814d-4184-ab4e-043bd4968c65
4
@Override public ArrayList<BalanceLine> getBusinessObjects(){ ArrayList<Account> leftAccounts = getLeftAccounts(); ArrayList<Account> rightAccounts = getRightAccounts(); int nrLeft = leftAccounts.size(); int nrRight = rightAccounts.size(); int min,max; if (nrLeft > n...
fb772d84-16bf-48e2-832f-4462de48cd34
0
public void setFoo(T foo) { this.foo = foo; }
bb596342-af88-46f2-a188-b851aa650d54
9
private ArrayList<String> commentStripper(ArrayList<String> in){ ArrayList<String> out = new ArrayList<String>(); boolean blockquote = false; for(String s : in){ for(int i=0; i<s.length()-1; i++){ String st = s.substring(i, i+2); if(blockquote){ if(st.equals("*/")){ s = s.substring(i+2); ...
37254cfe-5523-4e1a-8935-2584f3ea0d50
1
static private float[][] splitArray(final float[] array, final int blockSize) { int size = array.length / blockSize; float[][] split = new float[size][]; for (int i=0; i<size; i++) { split[i] = subArray(array, i*blockSize, blockSize); } return split; }
6291f4eb-3d2f-4551-97b3-94ad03e2bf3e
4
public void run(){ String msg = ""; // se cambiara para poner la ip de la maquina con lo siguiente InetAddress group = null; try{ msg=InetAddress.getLocalHost().getHostAddress(); group = InetAddress.getByName(MCAST_ADDR); //se trata de resolver dir multicast }catch(UnknownHostException e...
e24f8cbd-881c-4ad0-b899-fa97d1b96953
3
public boolean doTransformations() { return (type == SWAP && removeSwap(flowBlock.lastModified)) || (type == POP && removePop(flowBlock.lastModified)); }
d7d17437-cb68-4e7b-af37-3315667803d4
1
private final void deleteRequiredLayers() { for (GameLayer layer : removeLayers) { gameLayers.remove(layer.getName()); } }
5af8322a-6629-40f7-91b5-b8aed09a8ca4
3
private DetachedCriteria makeCriteria(Map<String, Object> condition) { DetachedCriteria criteria = DetachedCriteria.forClass(Module.class); if (condition == null) { return criteria; } if (condition.containsKey("module_type")) { criteria.add(Restrictions.eq("modu...
28d28697-ca1f-4fd0-b9d7-4cdebefe3edf
7
public static int count_letter(int x) { if(x < 10) { return one_digit[x]; } if(x < 100) { if(x % 10 == 0) { return two_10[x/10]; } if(x < 20) { return teen[x - 10]; ...
4059a20a-2fec-4f2b-8944-1a2732f4e8a6
1
private void shoot(Enemy currentEnemy) { currentEnemy.attacked(attackData.getDmg()); attackData.addEnemiesTowerHasShoot(); if (!currentEnemy.isAlive()) { // enemy died tower.getPlayer().addGold(currentEnemy.getGold()); tower.addKills(1); tower.getLevelOfTower...
2bdb3ab6-dd18-406e-829c-02ce93314196
1
private void exToString(StringBuffer buffer, String msg, CtMember head, CtMember tail) { buffer.append(msg); while (head != tail) { head = head.next(); buffer.append(head); buffer.append(", "); } }
d212f15a-ba32-4f96-b7d7-bc2103c0ed85
5
static void gameMusic() { new Thread(new Runnable(){ public void run() { List<String> results = new ArrayList<String>(); File[] files = new File(dir+"/music").listFiles(); for (File file : files) { if (file.isFile()) { results.add(file.getName()); } } int number = 0;...
0ce54e85-6882-4edb-972b-b7e9fa414d15
2
public boolean isHomeCollision(int x, int y, Wall home) { Gem tempGem; int number; if((home.x == x && home.y == y)) { return true; } return false; }
da889030-c48d-4327-9f98-6c3752c287f7
0
public Base(){ state = 1; level = new Level("Temp", "Testing.txt"); menu = new Menu(new Image("bg.png")); Dimension size = new Dimension(width, height); setPreferredSize(size); addKeyListener(in); addMouseListener(in); addMouseMotionListener(in); u = new TestUnit("TestUnit", 128, 128); rend...
facc890e-fabb-4027-be07-0472846e80c0
2
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel l = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (hasFocus && table.isCellEditable(row, column)) retu...
76e0b767-3f7c-4620-8f28-4457d4330cc0
8
public void start() { int frames = 0; double unprocessedTime = 0.0; double frameCounterTime = 0; long previousTime = System.nanoTime(); String fpsString = "0 ms per frame (0 fps)"; boolean isRunning = true; while (!display.isClosed() && isRunning) { boolean render = false; long currentTime = Syst...
e71533c6-942f-4f26-aa00-629b821d4ec6
2
@Test @Ignore public void test_SessionListGet() { SessionList laSessionList = laClient.getSessions("2012-01-25-12.36.43.023001", 1); System.out.println(laSessionList.getSessionList().size()); if (laSessionList.getSessionList().size() > 0) { for (Session laSession : laSessionList.getSessionList()) { ...
f0edec45-893e-464d-ab81-f7124aef8aff
3
public List<MapPoint> find(FieldObjectType type) { List<MapPoint> ret = new ArrayList<>(); for (int i = 0; i < FIELD_SIZE; i++) { for (int j = 0; j < FIELD_SIZE; j++) { if (type == getObjectTypeAt(i, j)) { ret.add(new MapPoint(i, j)); } } } return ret; }
8f6b873b-8c29-45eb-8c49-8c7cef45a717
1
public String getString(String key) throws JSONException { Object object = this.get(key); if (object instanceof String) { return (String) object; } throw new JSONException("JSONObject[" + quote(key) + "] not a string."); }
fc532688-8972-41b3-bb97-5e2f4957fade
4
private void handleCopiedInput() { while (!receivedInputCopy.isEmpty()) { switch (receivedInputCopy.removeEventType()) { case KEY_EVENT: handleKeyEvent(receivedInputCopy.removeKeyEvent()); break; case MOUSE_EVENT: ...
ddf22d18-42ef-4c81-8f98-656e2bb9dafa
4
private boolean profile(String baseDir, String jobName, String jobDir, String jobId) { File jobFile = new File(baseDir + jobName + File.separator + jobDir + File.separator + jobId + ".out"); try { FileInputStream fis = new FileInputStream(jobFile); ObjectInputStream ois = new ObjectInputStream(fis); job...
33f78367-975c-4855-bcef-88473b79a067
0
public TipoSala getTipo() { return tipo; }
6466b205-182a-4224-a497-eb6e702c38a8
4
int readBlockAndVerify(int pNumberOfBytes, byte pPktID) { int totalNumBytes = pNumberOfBytes + 1; //account for the checksum int bytesRead; try{ bytesRead = byteIn.read(inBuffer, 0, totalNumBytes); } catch(IOException e){ logSevere(e.getMessage() + " - Error: 424"); re...
2d25f638-e482-49b9-b597-7604ddef49e9
4
public Matrix subtractMean(){ Matrix mat = new Matrix(this.numberOfRows, this.numberOfColumns); double mean = 0.0; for(int i=0; i<this.numberOfRows; i++){ for(int j=0; j<this.numberOfColumns; j++){ mean += this.matrix[i][j]; } ...
d19a5471-6446-4671-9a69-f96e13798006
6
public void ajoutSQLImage(File doc) { try { Connection connexion; java.sql.Statement requete; Class.forName("org.sqlite.JDBC"); connexion = DriverManager.getConnection("jdbc:sqlite:dbged"); requete = connexion.createStatement(); ResultSet testAjout = null;// verifie lors de l'ajout que les ...
ce479b14-5a4d-4095-84d9-68b5f72abf20
4
public void update() { if (channel == null) return; try { while (selector.selectNow() != 0){ for (Iterator<SelectionKey> it = selector.selectedKeys().iterator(); it.hasNext(); ) { SelectionKey key = it.next(); handleSelectionKey(key); it.remove(); } } } catch (IOException e) { e.pr...
caeddbb5-c461-4018-8539-55ec48f0647b
0
public void setWidth(double width) { _width = width; }
7cb3c4c5-94d9-4cfc-8a74-95ddd41a83e4
0
@Override public String toString() { return "FALSEBRANCH " + label; }
f46fde08-d483-40e4-b4d3-49b431ea39e8
6
protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); ...
bc2fcabf-f8bd-4a47-80d1-d587b4862793
8
public final float getPixelUnitFactor(boolean isHor) { switch (PlatformDefaults.getLogicalPixelBase()) { case PlatformDefaults.BASE_FONT_SIZE: Font font = c.getFont(); FontMetrics fm = c.getFontMetrics(font != null ? font : SUBST_FONT); Point.Float p = FM_MAP.get(fm); if (p == null) { Rectang...
11e6d765-8155-4800-8715-49f4901727bf
6
@Override public Class<?> getColumnClass(int columnIndex){ Class type = String.class; switch (columnIndex){ case 0: type = Integer.class; break; case 1: type = String.class; break; case 2: type = Integer.class; break; case 3: type = Double.class; break; case 4: ty...
a7f41014-705f-42a7-89e4-fe6ecfa63a7c
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Group other = (Group) obj; if (fakulty == null) { if (other.fakulty != nu...
25135774-cbb5-4adf-af0b-15dfa27fa8cc
1
public final void unregister() { for (PluginListener<T> listener : this.listeners.values()) { listener.unregister(); } registered = false; }
fffc6045-8595-481c-8f8f-bda3fd5dc305
4
private void ConnectJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConnectJButtonActionPerformed String hstName; try { hstName = JOptionPane.showInputDialog(null, "Enter Hostname", "HostName Request", 1); userSocket = new Socket(hstName, 6666); ...
fd77c701-8229-4b26-978a-73cb7355214f
8
public static void main(String[] args) { // A simple list -- one data type, no generics (JDK 1.1 - 1.4) // Object values must be cast when retrieved // Change "ArrayList" to "Vector" to see Liskov Substitution // Any object can be stored, but good to keep them the same List shopp...
081bb389-7453-489f-9491-1a23ffce16a6
8
private void CreationBonbon(Coordonnee pos, int i, int j){ // si ajout nouveau type de bonbon, ajouter le la loggerGrille.trace("Debut de création Bonbon"); BonbonNormal bonbon = new BonbonNormal(Couleur.JAUNE); BonbonRaye bonbonRaye = new BonbonRaye(Couleur.JAUNE,Axe.HORIZONTALE); Bonbon...
f487157c-a9c9-4c28-9841-09a9603c19a5
1
public void setLimbs(Limbs limbs) { if(this.limbs != null){ this.limbs.setUsed(false); } this.limbs = limbs; this.limbs.setUsed(true); }
c0978c1f-ea8f-4fe3-b390-edac91b9c92d
0
private static void foo(Object veryLongVar) { // TODO Auto-generated method stub }
ba107727-343a-4004-84a2-4b627a6d22db
7
private static LinkedList createNetworkRate(BufferedReader buf, int numClass, double[] percentage) throws Exception { if (buf == null) { return null; } // create the Router objects first LinkedList routerList = createRouter(buf, NetworkReader.RATE...
c768fcdb-ee97-4ec6-8c0a-d7af9cd72932
9
private boolean salvarConfigsImpressoraCozinha() { System.out.println("Configurando Impressora da Cozinha:"); usarImpressoraCozinha = checkboxAtivarImpressoraCozinha.isSelected(); System.out.println("Usar impressora da cozinha: " + usarImpressoraCozinha); switch (comboboxModeloCozinha.ge...
16f2cc67-60b2-4f1b-80da-a63c0fb0fdce
3
public Value get(Key key) { Node node = root; while (node != null) { int cmp = key.compareTo(node.key); if (cmp < 0) node = node.left; else if (cmp > 0) node = node.right; else return node.value; } ...
53d3eb0e-b8ad-4ab7-94fa-442079e00534
2
private void afficherPraticiens(){ if (ctrlMenu == null) { VueMenu vueM = new VueMenu(ctrlA); ctrlMenu = new CtrlMenu(vueM, vueA); } if (ctrlPraticiens == null) { VuePraticiens vueP = new VuePraticiens(ctrlA); ctrlPraticiens = new CtrlPraticiens(vu...
0f23a549-6425-441c-b394-dd5f8e20fc5f
3
private void firstFitItems(List<Element> items) { for(int i = 0; i < items.size(); i++){ Element elem = items.get(i); for(int j = 0; j < bins.size(); j++){ if(bins.get(j).addElement(elem)){ return; } } Bin bin = new Bin(); bin.addElement(elem); bins.add(bin); } }
e6a18848-c59e-42e4-a872-3e44e4776dbc
8
public int getDemandByCost(int cost) { int result = 0; int[] demands = getDemands(); int i = 0; while(i < demands.length){ // kijk per demand of de cost groter of gelijk is aan cost if (costByDemandMap.get(demands[i]) == cost){ result = demands[i]; break; } if(demands[i] < 0 && costByDemandM...
814d597b-d45f-471a-811d-39a9ec24e728
0
public Query<T> takeWhile(Predicate<T> predicate) { return new Query<T>(new TakeWhileIterable(this._source, predicate)); }
7c39a070-f768-41ed-869c-4df7a6cdb087
5
String diagPred(Expr expr) { if (expr instanceof Expr.And) { Expr arg = ((Expr.And)expr).expr; if (arg instanceof Expr.Ref) { Expr.Rule rule = ((Expr.Ref)arg).rule; return diagName(rule); } else return arg.asString(); } else if (expr instanceof Ex...
5dbf5085-8284-4799-82d7-109641bcf6e1
6
public boolean baca(String no_beli){ boolean adaKesalahan = false; Connection cn = null; try{ Class.forName(Koneksi.driver); } catch (Exception ex){ adaKesalahan = true; JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+ex,"...
6ad8de15-38b2-42f7-ae75-b0e23fd907d8
3
private JTextPane createTextPane() { TransparentTextPane textPane = new TransparentTextPane(); StyledDocument doc = textPane.getStyledDocument(); addStylesToDocument(doc); Style newStyle = doc.addStyle("newStyle", doc.getStyle("defaultStyle")); for(TextBody text : textObject.getTextBody()) { ne...
2053ec16-6f8d-410c-8a34-ec536129f2bd
9
private void loadConfiguration() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { final FileInputStream fis = new FileInputStream( "data/configuration.cfg"); try { final ConfigurationParser p = new ConfigurationParser(fis); final Map<String, String> mappin...
d68714cd-29d8-4794-b9e6-533916217d6e
0
public void setRsrceQuantity(int rsrceQuantity) { this.rsrceQuantity = rsrceQuantity; }
0646b448-faf7-4762-a16a-ffcf675f4423
8
public void printNonTerminalUsage(IAmbiDexterMonitor monitor) { Map<Symbol, Integer> usage = new ShareableHashMap<Symbol, Integer>(); for (Production p : productions) { if (p.reachable) { for (int i = 0; i < p.getLength(); i++) { Symbol s = p.getSymbolAt(i); if (s instanceof NonTerminal) { In...
0840e56a-2ed7-40c2-93d4-a8149eb862ff
8
public int solution2(int[] A) { // write your code in Java SE 8 if (A == null || A.length == 0) { return -1; } int result = 0; int[] allLength = new int[A.length]; for (int i = 0; i < A.length; i++) { if (A[i] != -1) { int temp = 0; int j = i; while (A[j] != -1 && A[j] != i) { int las...
6d200189-610b-4746-847f-e15a2f59eab1
8
public static byte[] decodeBase64(byte[] base64Data) { // RFC 2045 requires that we discard ALL non-Base64 characters base64Data = discardNonBase64(base64Data); // handle the edge case, so we don't have to worry about it later if (base64Data.length == 0) { return new byte[0]...
fcfcd933-0069-40e1-b252-e5606816b0ff
4
private static int extractValue(StringBuilder buffer) { int value = 0; while (buffer.length() > 0) { char ch = buffer.charAt(0); if (ch >= '0' && ch <= '9') { value *= 10; value += ch - '0'; } else if (ch != ' ') { break; } buffer.deleteCharAt(0); } return value; }
9676b033-f981-4e1b-81d2-ff7b6ef467ac
4
@Override public String execute(SessionRequestContent request) throws ServletLogicException { String page = (String) request.getSessionAttribute(JSP_PAGE); resaveParamsCountrySelected(request); request.setAttribute(JSP_CURR_ID_CITY, "0"); String currCountry = request.getParameter(JS...
bee34a8a-e501-40ad-b467-48b70d59073d
6
public void processEvent(Event event) { if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } if (event.getType() != Event.OMM_ITEM_EVENT) { Syste...
c2cc5ce5-bbc7-47b3-abbb-b57bc36fa0a3
1
public boolean opEquals(Operator o) { return (o instanceof CompareUnaryOperator) && o.getOperatorIndex() == getOperatorIndex(); }
74b6e0b2-1720-4a1d-ada8-fe80eddc4b24
5
public Node getPostContainer(Node n, String date, String message, String author){ List <Node> nodes = n.childNodes(); for (int i=0; i< nodes.size(); i++){ if (nodes.get(i).childNodes().size()>0) { String contentParsed = Jsoup.parse(nodes.get(i).outerHtml()).text(); if( contentParsed.toLowerCase().contain...
34a46306-314c-4fac-8572-3181b58ab8e7
5
public void updateTextArea() { //Update processlists textarea with statistics data this.textArea.setText(""); String nameOfSelectedProcess = this.mainPanel.getProcessList().getSelectedProcess(); Statistics statistics = this.mainPanel.getStatistics(); if(nameOfSelectedProcess != null && statistics != null) ...
31de489f-c6ee-44fb-9700-9bcd7abaa99a
5
public String removeBlocks(String completeCode) { int depth = 0; String blockContents = ""; char[] charList = completeCode.toCharArray(); completeCode = ""; for(char c : charList) { if(c == '{') { depth++; } else if(c == '}') { ...
be8f239b-bf04-46e3-b395-ff50aacd8640
2
private void load() { for (int y = 0; y < SIZE; y++) { for (int x = 0; x < SIZE; x++) { pixels[x + y * SIZE] = sheet.pixels[(x + this.x) + (y + this.y) * sheet.SIZE]; } } }