method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
78966d37-91ae-4e0e-92a8-d75e803c103a
7
public static void renderAllTiles(int z, int x, int y, int z_start, int z_stop) throws IOException { // find the projected bounds of this tile in osm projection double[] tile = TileToMercBounds.tileToMercBounds(z, x, y); // convert the bounds to a jts geometry Envelope envolope = new Envelope(tile[0], tile[2...
c5f0d699-35de-4345-a49e-4b38eb504a37
0
public void setFecha(GregorianCalendar fecha) { this.fecha = fecha; }
6b08ed38-1f0a-49f7-8e20-37e5418c8521
6
public static int dehexchar(char c) { if (c >= '0' && c <= '9') { return c - '0'; } if (c >= 'A' && c <= 'F') { return c - ('A' - 10); } if (c >= 'a' && c <= 'f') { return c - ('a' - 10); } return -1; }
893b830e-4af0-42e7-aa96-1db6676a49e5
4
@Override public void keyPressed(KeyEvent e) { switch(e.getKeyCode()){ case(KeyEvent.VK_W) : rocket.player.buttom[0] = true; break; case(KeyEvent.VK_A) : rocket.player.buttom[1] = true; break; case(KeyEvent.VK_S) : rocket.player.buttom[2] = true; break; case(KeyEvent.VK_D) : rocket.player.buttom[3] = true; b...
1d73001a-de52-44dd-9843-45e074ac969a
8
public void calculateExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime = 0; ...
a3d179cc-3d37-49ad-bc15-62d9db68c030
4
private void checkAvailabilityButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkAvailabilityButtonActionPerformed Date checkInDate = checkIn.getDate(); Date checkOutDate = checkOut.getDate(); if (checkInDate != null && checkOutDate != null && !checkInDate.equals(check...
4485aa58-6f4d-49cb-b1e1-d0ae0b306d26
2
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened try { List<Pays> pp1 = RequetesPays.selectPays(); for (Pays pays : pp1) { jComboBoxPays.addItem(pays); } } catch (SQLException ex) { ...
601e954c-12d3-4022-96d6-7f19646b1cc2
5
public Bullet handleInput(Camera camera) { Bullet bullet = null; if (Gdx.input.isKeyPressed(scheme.Left)) { player.moveLeft(); } else if (Gdx.input.isKeyPressed(scheme.Right)) { player.moveRight(); } else { player.stopMoving(); } if (Gdx.input.isKeyPressed(scheme.Jump)) { player.jump(); } ...
10e0dafe-bfa1-4d9a-82ea-c85a8d99ea04
1
private void checkForUpdates_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkForUpdates_settingsButtonActionPerformed if (debug) logger.log(Level.DEBUG, "Setting preference \"checkForUpdates\" from " + settings.checkForUpdatesOnStartup() + " to " + check...
333ff17f-6bee-4b39-8019-bb014f4408de
5
@SuppressWarnings("deprecation") void listen(Function<String> listener) { if (socket == null) { println("Cannot operate with a null socket"); return; } else if (listener == null) { println("The listener needs to be set"); return; } DataInputStream input; String tmp; try { input = new DataIn...
1bb86b98-f314-45d8-82f6-08e980b2c634
2
@Test public void insertAndDeleteTest(){ long start = System.currentTimeMillis(); for (int i = 0; i < 1000000; i++){ heap.insert(i); } for (int i = 0; i < 1000000; i++){ assertEquals(heap.extract_min().value, i); } long end = System.currentTime...
10912b67-9a2a-46c4-ab3f-fca3219aed25
0
public Collection<BookingEntity> getBooking() { return booking; }
5eee64b4-3654-4456-aacf-bb196c637b23
7
public static boolean isPutChessmen(final ChessBoardEntity b, final ChessmenEntity c, final PositionEntity p) { boolean result = false; do { if (null == c || null == p) { break; } if (!c.isPlayer()) { // ̋łȂłB break; } if (c.isBoard()) { // Տ̋łB break; } if (isChessmen(b, p...
72958e04-30e8-4946-821c-1c0036380944
7
public static void memberOfEvaluator(Proposition self) { { Stella_Object member = Logic.valueOf((self.arguments.theArray)[0]); Stella_Object collection = Logic.valueOf((self.arguments.theArray)[1]); if (Proposition.trueP(self)) { if (Stella_Object.isaP(collection, Logic.SGT_LOGIC_DESCRIPTION) &...
ae616e58-6b26-4dfd-aca8-dc9c7577dc70
3
@Test public void resolve() { int days = daysOfYear(1900); int count = 0; for (int year = 1901; year <= 2000; year++) { for (int mon = 1; mon <= 12; mon++) { if (days % 7 == 0) { count++; } days += getDaysOfMonth(year, mon); } } print(count); }
077e08f3-b5c6-4845-b54d-c285250e465f
4
@SuppressWarnings("static-access") public void read(Buffer buf) throws IOException { // Check if we've finished all the frames. if (nextImage >= images.size()) { // We are done. Set EndOfMedia. System.err.println("Done reading all images."); buf.setEOM(true); buf.set...
f10af4e1-a259-4529-a26d-031287563206
0
public static void main(String[] args) { SpaceShipDelegation protector = new SpaceShipDelegation("NSEA Protector"); protector.forward(100); }
3868b661-5f50-4c4f-b399-839a53d9de22
8
public String toString() { StringBuilder sb = new StringBuilder(); long ms = this.millis; int ns = this.nanos; if (ms < 0 || (ms == 0 && ns < 0)) { sb.append("-"); ms *= -1; ns *= -1; } if (ms > Duration.DAY) { ms = extract(...
b0195af0-821c-4514-a0ac-09d95fc070a7
4
public void recruitHero() { if (castle.getHero() != null && castle.getHero().isInCastle(castle)) { QMessageBox.warning(this, "Nie można wynająć bohatera", "W tym zamku znajduje się już inny bohater"); } else if (player.getResource(core.ResourceType.GOLD) < 2500) { QMessageBox.warning(this, "Nie można wynająć...
dc4ead83-be26-42b7-9f45-3f00dd41782a
0
public Forme getForme() { return forme; }
33565c77-e124-48b4-a57c-8c763b9f04cc
7
final int[] method3042(int i, int i_13_) { anInt9457++; int[] is = ((Class348_Sub40) this).aClass191_7032.method1433(0, i); if (i_13_ != 255) method3148(true); if (((Class191) ((Class348_Sub40) this).aClass191_7032).aBoolean2570) { int i_14_ = 1 + (anInt9463 + anInt9463); int i_15_ = 65536 / i_14_; ...
8a8fd034-c3e5-4cfa-88b5-3a1a378d5509
4
public void rotate(boolean clockwise) { int turns; if (clockwise) turns = 1; else turns = 3; for (int k = 1; k <= turns; k++) { boolean sec[][] = new boolean[getHeight()][getWidth()]; for (int i = 0; i < getHeight(); i++) { for (int j = getWidth() - 1; j >= 0; j--) { sec[i][getWidth() - 1 ...
0e085490-d318-41c0-a741-05adeb3f3713
6
private void reduceUnits(){ newTimeSecond = totalSeconds; if ((newTimeSecond <= 60) || (newTimeSecond >= 60)){ newTimeMinute = newTimeSecond / 60; newTimeSecond = newTimeSecond % 60; } if ((newTimeMinute <= 60) || (newTimeMinute >= 60)){ newTimeHour = newTimeMinute / 60; newTimeMinute = newTimeMi...
bf97e8a7-a104-4eb6-9118-9fe0704b7332
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } User other = (User) obj; if (groups == null) { ...
f57ddf42-2b3c-4a0c-bc43-7173ccc3f3f5
4
protected static void mult_INT_PACK_Data(WritableRaster wr) { // System.out.println("Multiply Int: " + wr); SinglePixelPackedSampleModel sppsm; sppsm = (SinglePixelPackedSampleModel) wr.getSampleModel(); final int width = wr.getWidth(); final int scanStride = sppsm.getScanline...
b436de13-14c2-47f1-9231-8769d7ab6db6
3
void test() throws InterruptedException, ExecutionException{ ExecutorService exec = Executors.newCachedThreadPool(); ArrayList<Future<String>> results = new ArrayList<Future<String>>(); //Future 相当于是用来存放Executor执行的结果的一种容器 for (int i = 0; i < 10; i++) { results.add(exe...
7f6e9f25-1a99-45cc-b0b6-30dc92ecb97f
7
public void annuler() throws InvalidArgumentException { if (prixReserveAtteint() && etatEnchere == EtatEnchere.PUBLIEE) throw new InvalidArgumentException( "Prix de réserve atteint. Annulation impossible."); else if (etatEnchere == EtatEnchere.TERMINEE) throw new InvalidArgumentException( "Enchère ...
078a30ab-7b60-4c0b-b5f9-96484cb779a8
2
public void run() { try { File f = new File ( filename ); MediaLocator locator = new MediaLocator ( f.toURI().toURL()); player = Manager.createPlayer ( locator ); pla...
729b9139-9616-40bc-87f9-6d13f4a32ff6
0
public T getFirst() { return first; }
12b69f10-4a24-4338-99b2-0dcda1659144
0
public void enterEnvironmentRecord(String identifier, int offset) { environmentStack.peek().putSymbolTable(identifier, offset); }
7484c375-a523-4aab-ae87-898a4a0e8b0a
3
private boolean isControlWord(String line) { return line != null && (line.length() >= 2 && (line.charAt(0) == '#' && line.charAt(1) != ' ')); }
610c7c49-1726-4bfe-9c44-936b474d59f1
1
public static void main(String[] args) throws FileNotFoundException { File videoOut = new File("data/video1_out.mp4"); File videoIn = new File("data/video1.mp4"); // Vytvorim si testovacie video // List<VideoSection> louderSections = new ArrayList<>(); // louderSections.add(new VideoSection(45L, 120L, TimeUn...
1e1cfcb7-444e-4509-ba98-44ee9f319bdb
3
public void printCombs(ArrayList<ArrayList<Integer>> comb) { System.out.println("["); for (int i = 0; i < comb.size(); i++) { ArrayList<Integer> curComb = comb.get(i); System.out.print("["); for (int j = 0; j < curComb.size(); j++) { if (j == curComb.size() - 1) System.out.print(curComb.get(j)); ...
b2d057be-427d-44fc-9fc5-f422f5849d47
5
public int addEntry(Score newScore) { lastIndex++; //update the index of the last entry in the list //System.out.println("lastIndex: "+lastIndex); // check if list's size needs to be increase if (isFull()) doubleArraySize(); boolean isHighest = false; boolean done = false; int currentIndex = lastInd...
858255e3-f403-4dc6-b8e7-15a12b6f1f8f
7
public AbstractMainframe(Controlador controlador) { super(controlador); panel.setLayout(new FlowLayout(FlowLayout.LEADING)); desconectar.setEnabled(false); frame.setResizable(false); /* False para iconified, True para o resto */ frame.addWindowStateListener(e -> frame.setVisible(e.getNewState() != JFrame...
a598a375-5ccb-4fc5-a9f8-27a159129654
1
public void fillDeclarables(Collection used) { for (int i = 0; i < subExpressions.length; i++) subExpressions[i].fillDeclarables(used); }
da4f51cf-06a2-4cc9-b9a0-1ad17454868c
7
public boolean setNext(Unit unit) { if (predicate.obtains(unit)) { // Of course, it has to be valid... Unit first = (units.isEmpty()) ? null : units.get(0); while (!units.isEmpty()) { if (units.get(0) == unit) return true; units.remove(...
6f782743-0b94-459d-a3fa-7e6225d49bfe
9
private void addDiagonalCell (java.util.List<Point> adjoiningCells, Point adjoiningCell, Point parentCell) { if (isCellOutOfField(adjoiningCell) || isCellWall(adjoiningCell) || isCellClosed(adjoiningCell) || isCellOpened(adjoiningCell)) { return; } java.util.List<Point> checkCells =...
9caec7b6-e046-496a-b82c-a88dab740b20
8
private static Object processFunctionResults(final Object binaryOperatorKey, final Object functionResult) { if (binaryOperatorKey.equals(Syntax.OPERATOR_GREATER)) { return ((Number) functionResult).intValue() == 1 ? Boolean.TRUE ...
b2b887d9-8144-4cfd-8cfc-d3f08f126d66
6
public boolean canEquip(int slotId, int itemId) { if (slotId == Equipment.SLOT_CAPE || slotId == Equipment.SLOT_HAT) { player.getPackets().sendGameMessage( "You can't remove your team's colours."); return false; } if (slotId == Equipment.SLOT_WEAPON || slotId == Equipment.SLOT_SHIELD) { int weaponId...
6e73ec31-f352-4da3-8a9a-e9dbf264d66c
7
public boolean concatenateAligned(BitOutputStream src) { int bitsToAdd = src.totalBits - src.totalConsumedBits; if (bitsToAdd == 0) return true; if (outBits != src.consumedBits) return false; if (!ensureSize(bitsToAdd)) return false; if (outBits == 0) { System.arrayco...
83322c73-5223-46b1-b340-5e04fe81ccc4
8
private void processCommand(String unprocessedCommand) { unprocessedCommand = unprocessedCommand.replaceAll("\\s+", " "); //take out all extra spaces. ("Hello world!" -> "Hello world") if(unprocessedCommand.length() == 0 || (unprocessedCommand.charAt(0) == ' ' && unprocessedCommand.length() == 1)) //avoi...
f8c14642-371d-4e08-b046-7d004ac247aa
4
public synchronized void gridletSubmit(Gridlet gridlet, boolean ack) { int reqPE = gridlet.getNumPE(); try { // reject the Gridlet if it requires more PEs than the maximum if(reqPE > super.totalPE_) { String userName = GridSim.getEntityName( gridlet.getUserID() ); logger.warnin...
c872ca43-1252-4539-86bb-fc6e31e711b3
7
public void actionPerformed(ActionEvent e) { if(e.getSource() == buttonStop){ serial.write(125); MainWindow mainWindow = new MainWindow(serial, laser1, laser2); dispose(); timer.stop(); } if(e.getSource() == buttonIncreaseL1){ serial.write(108); } if(e.getSource() == buttonReduceL1){ ...
d9d94881-d8a2-4cbe-904a-0902412fb5f8
3
private void createMenuBar() { menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("Menu"); JMenuItem scoresMenuItem = new JMenuItem("Najlepsze wyniki"); JMenuItem loginMenuItem = new JMenuItem("Zaloguj"); JMenuItem registerMenuItem = new JMenuItem("Rejestruj"); JMenu...
8aedded9-5165-4984-9ce9-1b159ec41649
0
public void setName(String name) { this.name = name; }
031dff08-35f8-415e-a4a2-abfdcfc34c2f
0
public String getVersion() { return version; }
44df2dfc-3986-44c1-9060-c27ccbebd6d9
6
public static void main(String[] args){ //made a linked list of integers LinkedList<Integer> myList = new LinkedList(); myList.add(2); myList.add(3); for(int i = 5; i<Integer.MAX_VALUE; i=i+2){ int ALSize = myList.size(); boolean isPrime = true; //while the number is not proved to not be a pri...
d2ed5bd2-c78e-4408-a78e-4bd68e967911
5
final int method2426(int i) { anInt10504++; if (i != 200) return 115; if ((((NpcDefinition) ((Npc) this).definition) .anIntArray1377) != null) { NpcDefinition class79 = ((Npc) this).definition .method794(Mob.varbitHandler, -1); if (class79 != null && ((NpcDefinition) class79).anIn...
9f784bb9-de44-423d-b4a8-e00c350f5409
0
private String aboutText() { return "Small World Agents [1.0] has been produced by the\nMulti Agents " + "Systems and Simulation (MASS) Group at the University of Leeds, UK. \n\n" + "It is a working framework for Agent based systems " + "in which Agents can ...
e2eb0fac-f35c-4e32-b172-9f697f71352c
7
private void setSettingsPanel() { if (square) { playersNumber = new JComboBox<String>(new String[]{"1 Player", "2 Players", "3 Players", "4 Players"}); } else { playersNumber = new JComboBox<String>(new String[]{"1 Player", "2 Players", "3 Players", "4 Players", "5 Players", "6 Players"}); } playersNumber...
6d0ccd11-b726-40ed-b433-491e38bf31cd
9
public void buildDB(){ Console.line("Building Database\n**********************\n"); for (CorpusSource source : sources){ if (!source.wasRead()){ Console.text("."); if (source.open()){ while (source.hasNext()){ String sentence = source.readSentence(); //sentence = sentence.replaceAll("[\\...
62a3eeb0-4965-42cb-980c-826981b54aa8
9
public Move move(boolean[] foodpresent, int[] neighbors, int foodleft, int energyleft) { MoveInfo moveData = new MoveInfo(foodpresent, neighbors, foodleft, energyleft, lastMove); preMoveTrack(moveData); Move move; // placeholder for return value move = reproduce(moveData); if (move == null) { move ...
c25fd2f4-261f-47c9-92ec-31a8f4e32d96
3
public boolean locationCheck(Locale newLocale) { if (newLocale == null) { return false; } else { currentLocale = newLocale; try { myStack.push(currentLocale); } catch (Exception ex) { System.out.println("Stack is full"); } try { myQueue.enqueue(currentLocale); } catch (Exception ...
dfb20243-7ef9-483e-bb21-00bc777c3a23
8
private double desiredDirection() { if (directions.contains(Direction.UP)) { if (directions.contains(Direction.RIGHT)) { return 45; } if (directions.contains(Direction.LEFT)) { return 315; } return 0; } if (directions.contains(Direction.DOWN)) { if (directions.contains(Direction.RIGHT)) ...
dc548eec-efc9-48e9-a738-aef93d9f74c9
9
public boolean fGuiCheckObjectNonExistence(String strDesc){ //Delimiters String[] delimiters = new String[] {":="}; String[] arrFindByValues = strDesc.split(delimiters[0]); //Get Findby and Value String FindBy = arrFindByValues[0]; String val = arrFindByValues[1]; ...
ec59b315-d2e7-4ed5-a875-2b8eb22eeb7f
5
private int countMapFiles() { int counter = 0; CodeSource src = this.getClass().getProtectionDomain().getCodeSource(); if( src != null ) { URL jar = src.getLocation(); ZipInputStream zip; try { zip = new ZipInputStream( jar.openStream()); ZipEntry ze = null; while((ze = zip.getNextE...
f123a972-8658-46a4-9817-60550f69d788
8
private void notifyListeners(ProcessState event) { for (IProcessComponentListener listener : this.listeners) { switch (event) { case EXECUTING: listener.onExecuting(new ProcessEventArgs(this)); break; case ROLLBACKING: listener.onRollbacking(new ProcessEventArgs(this)); break; case ...
a4cfc75b-7369-4420-b254-323c9c4549f9
0
public PeanutButterSandwich() { this.setName("PeanutButterSandwich"); this.setPrice(new BigDecimal(30)); }
9ad29e5a-036d-455d-b5e4-da7bc8d4ccf9
0
public TransformType createTransformType() { return new TransformType(); }
3e1c35dd-4bbb-4d11-80d2-6c72a7dfb238
3
public static boolean equals( double[] vec1, double[] vec2 ) { if ( vec1.length != vec2.length ) return(false); for ( int i = 0; i < vec1.length; ++i ) if ( vec1[i] != vec2[i] ) return(false); return(true); }
4dec91d5-6433-4eb5-9672-6e691c56007b
8
public static String[] substringsBetween(String str, String open, String close) { if (str == null || isEmpty(open) || isEmpty(close)) { return null; } int strLen = str.length(); if (strLen == 0) { return new String[0]; } int closeLen = close.length(); int openLen = open.length(); List<...
e0fe3f30-f61c-470d-bd96-995ee8422898
9
public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(), k = in.nextInt(); if (k == 0) { out.println(n == 1 ? 1 : -1); } else if (n < 2 || n...
288d7c5d-8d3b-4e37-a443-3fc24e16ee90
7
private void init() { // default values props.put(REPRODUCIBLE_PRNG, new Boolean(reproducible).toString()); props.put(CHECK_WEAK_KEYS, new Boolean(checkForWeakKeys).toString()); props.put(DO_RSA_BLINDING, new Boolean(doRSABlinding).toString()); // 1. allow site-wide override by readin...
79ea18a9-8760-4938-a5d9-0aba61b2f3ed
6
@Override public void render(Screen screen) { switch (dir) { case NONE: sprite = Sprite.player; break; case UP: sprite = Sprite.playerUp; break; case RIGHT: sprite = Sprite.playerRight; ...
b4b1e5eb-ddb5-4e40-a692-74afd5041b70
2
public GraphPoint[] getSelectedPoints() { ArrayList<GraphPoint> buffer = new ArrayList(); Iterator<Map.Entry<Integer, GraphPoint>> it = points.entrySet().iterator(); GraphPoint bgp; while (it.hasNext()) { bgp = it.next().getValue(); if (bgp.getComponent().getSele...
09c7bc5f-ba48-4c25-a467-7850c844e3de
3
public HashSet<ymlReward> getymlRewardsFromHashMap(int questNumber, HashMap<String,Object> map){ //Since there can be different types of the same reward as well as an undefined amount of them... iterate HashSet<ymlReward> returnMe = new HashSet<ymlReward>(); for (Map.Entry<String, Object> entry : map.entrySe...
15e2c2eb-89a0-4471-9d2f-ac62c06c58c8
2
private void goToTest(GenericLittleMan<?> littleMan) { final boolean isComplete = littleMan.goToComputerLocation(littleManTest.getComputerLocation()); if (isComplete) { incrementConditionalActionStep(); } }
cb467662-04af-402a-b109-ec57bdc145a8
0
public void setApplicationName(String name) { this.applicationName = name; }
db94c4b2-702f-40a0-bbd3-2d25890cfc71
3
public void visit_iinc(final Instruction inst) { final IncOperand operand = (IncOperand) inst.operand(); final int index = operand.var().index(); if (index + 1 > maxLocals) { maxLocals = index + 1; } final int incr = operand.incr(); if ((index < 256) && ((byte) incr == incr)) { addOpcode(Opcode.op...
6820b676-e021-4be5-abf9-d9d6453a5345
9
protected void execute() { processPendingRequests(); Loadable task = null; try { // it probably won't hurt much not to synchronize this iterator for (Iterator it = taskPool.iterator(); it.hasNext();) { if (off || isStopped()) return; task = (AbstractLoadable) it.next(); if (task == null || !ta...
03ec15df-9c7a-4fb3-9831-094f581ebb2f
3
public void addDownServices() { LinkedList<Integer> list = new LinkedList<Integer>(); //conn.query("select service_id from esri.services si where si.service_id not in " + // "(select service_id from esri.service_date_uptime where date_trunc('day', localtimestamp) = time);"); conn.query("select service_id fr...
908360a8-0d19-4f28-8d45-96c08a09dfe2
2
public void FecharConexao(){ try{ if (!conbco.isClosed() ) { conbco.close(); } } catch(Exception ex){ } }
e207e942-3505-4410-b618-4061371022c1
7
@Override public void train(final Matrix matrix) { List<List<Double>> data = matrix.getData(); for (int colIndex = 0; colIndex < data.get(0).size(); colIndex++){ if (matrix.getColumnAttributes(colIndex).getColumnType()== ColumnAttributes.ColumnType.CATEGORICAL){ Counter<D...
9d98b7ab-4dea-42f5-a6af-7fd6bbbd20d4
9
private static final String clean(final String desc) { final StringBuilder result = new StringBuilder(); int pos = 0; for (int i = 0; i < desc.length(); i++) { final char c = desc.charAt(i); if (c == '\\') { result.append(desc.substring(pos, i)); pos = i += 2; } else if (c == '"') { result.ap...
3352637a-85d7-4150-a145-78a372c89d19
2
public void savePatient(Patient patient,String action)throws Exception{ log.debug("savePatient Service method called..."); PatientDAO patientDao=new PatientDAOJDBCImpl(); if(action.equals("Save")){ patientDao.addPatient(patient); }else if(action.equals("Update")){ patientDao.updatePatient(patient); ...
6f71be80-4375-49ea-ba07-2058c4aceab1
7
private CompilerToken makeToken(final String token, final String state) throws LexicalException { if (state.equalsIgnoreCase("identifier")) { return processIdentifier(token); } else if (state.equalsIgnoreCase("integer")) { return processInteger(token); ...
4ca03e89-5e5d-4238-8c94-895275aac178
9
@Override public double[] calculateFractal3DWithoutPeriodicity(Complex pixel) { iterations = 0; Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel))); Complex tempz2 = new Complex(init_val2.getPixel(pixel)); Complex[] complex = new Complex[3]; complex[...
a80af227-1eca-4ebc-8f81-de4d6a59bd86
2
public int testGetState(){ if(bomb) return Spot.BOMB; if(flag) return Spot.FLAG; return getBombCount(); }
23c0fdc0-f8de-4f13-acfc-4c49a70fc1a4
4
private void loadShapes(String[] files, final HashMap<Integer, GMTShape> shapes) { GMTParser gmtpBuildings = new GMTParser() { @Override public void processShape(GMTShape shape) { shapes.put(shape.getID(), shape); } }; try { for (S...
80ed5f05-787d-47bd-b5b5-3b1d399f9317
0
public Worker () { //initial settings this.iFrom=IFROM; this.iTo=ITO; System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
2dd487dc-e43a-45a0-a727-684130e93c80
0
@Test public void getConnectedComponentsTestZero() { City_Graph city_graph2 = new City_Graph(); city_graph2.loadMap("res/singleCity.mp"); City testCity = city_graph2.getCity(0); VertexSet emptySet = new VertexSet(); assertTrue(city_graph2.getNeighbourhood(testCity).equals(emptySet)); }
16ce789c-932f-4cdd-af1f-d28d02262d95
8
public double f_to_minimize(double x[]) { double f,sq1,sq2,sq3,f1,f2,f3,f4,fac,c1,c2,s1,s2; double theta,x1,x2,x3,x4; if (id_f_to_min == 0) { f = x[1]*x[1]; } else if (id_f_to_min == 1) { sq1 = (x[1] - c)*(x[1] - c); sq2 = (x[2] - d)*(x[2] - d); f = sq1 ...
4088c531-7ab0-4015-92cb-8a4401aa7420
0
public MealyLambdaTransitionChecker() { super(); }
c09b4ec3-df78-4e57-ae7e-48e3c56c7d5d
5
public RrdDef getRrdDef() throws RrdException { if (!root.getTagName().equals("rrd_def")) { throw new RrdException("XML definition must start with <rrd_def>"); } validateTagsOnlyOnce(root, new String[] { "path", "start", "step", "datasource*", "archive*" }); // PATH must be supplied or exception is thro...
d7998c0e-7ed7-45ce-8f3e-42db7ea79ea0
7
public static Color getColor ( byte multiplier, byte type ) { switch ( type ) { case 0: switch ( multiplier ) { case 1: return new Color ( 170, 100, 0 ) ; case 2: return Color.CYAN ; case 3: return Color.BLUE ; default: ...
10deb57d-bf38-4550-b5e7-b17a9cf4c766
0
public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; }
74f2eb7f-4955-4a9d-9577-bd653ad146b8
3
@Override public int hashCode() { int result = parentCategoryId; result = 31 * result + accountId; result = 31 * result + id; result = 31 * result + (headLine != null ? headLine.hashCode() : 0); result = 31 * result + (text != null ? text.hashCode() : 0); result = 31 ...
f9e05e34-0fbb-4948-9bda-b167535249e9
8
public void setFreeColGameObject(String id, FreeColGameObject fcgo) { if (aiObjects.containsKey(id)) return; if (!id.equals(fcgo.getId())) { throw new IllegalArgumentException("!id.equals(fcgo.getId())"); } if (fcgo instanceof Colony) { new AIColony(this, (Colony)...
3007b65b-5af8-4d1f-8f4b-4e79644a9fd1
6
@SuppressWarnings("unchecked") public static Class<?> getClass(Type type) { if (type instanceof Class) { return (Class) type; } else if (type instanceof ParameterizedType) { return getClass(((ParameterizedType) type).getRawType()); } else if (type instanceof GenericArrayType) { Type componentType = ((Ge...
3680b337-2ed1-4675-8e13-a9032d63616a
6
@Override public double distribute(TVC newCon) { int id1 = newCon.getFirewallId1(); int id2 = newCon.getFirewallId2(); List<TVC> conns = new LinkedList<>(); for (TVC c : environment.getConnectionsSortedDown()) { if ( c.mightBeManagedBy(id1) && c.mightBeManagedBy(id2)) { conns.add(c)...
606f5906-a0f1-4d0a-afe4-3300e2460313
9
public static StringBuffer expertiseList(MOB E, HTTPRequest httpReq, java.util.Map<String,String> parms) { final StringBuffer str=new StringBuffer(""); if(parms.containsKey("EXPERTISELIST")) { final ArrayList<String> theclasses=new ArrayList<String>(); if(httpReq.isUrlParameter("EXPER1")) { int num=...
ba6a505a-987f-4e59-bfb5-2ebf198744c1
4
public void testLongLargeArrayArraycopy() { long[] data = new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int startPos = 2; int length = 8; LargeArray.setMaxSizeOf32bitArray(1073741824); LongLargeArray a = new LongLargeArray(data); LongLargeArray b = new LongLargeArray(2 *...
df502110-b0e3-42f8-a02c-43250357875b
2
private void initBoutons() { // Création des boutons for (int i = 0; i < this.animaux.size(); i++) { this.boutons.add(i, new JButton() ); this.boutons.get(i).setBackground(java.awt.Color.white); this.boutons.get(i).setText(this.animaux.get(i).getNom()); th...
dcf3c7bf-129d-4107-93a8-2b31dbf39e09
2
public void draw(Graphics2D g) { int offsetX = 0; for (int i = 0; i < playerLives; i++){ g.drawImage(playerHeadImage, playerLivesX + offsetX, playerLivesY, null); offsetX += 15; } g.drawImage(healthBarImage,healthBarX,healthBarY,null ); offsetX = 0; for (int i = 0; i < playerHealth; i++){ g.drawIma...
c1190647-b303-4423-b2d1-bee511c43044
1
public static void compareAndChangeId(int comparedId) { if(id<comparedId) id=comparedId+1; }
3f6326f7-bdf7-40f5-8b6b-305d42015b69
0
public static synchronized HashMap<String, Integer> getUserStock(String uid) { UserStorageAccess xmlAccessor = new UserStorageAccess(); stocks = xmlAccessor.getUserStocks(uid); //System.out.println("size of Hashmap : " + stocks.size()); //System.out.println(stocks.containsKey("CCR")); return...
e14f4d4a-c9e2-4ec9-ae0e-cd8e4e5df297
7
private TreeNode SimpleExpresion() { TreeNode tmp = AdditiveExpression(); switch (t.id) { case Constants.EQ: case Constants.LEQ: case Constants.LS: case Constants.GEQ: case Constants.GT: case Constants.NEQ: TreeNode tmp2 = Relop(); tmp2.C1 = tmp; tmp = tmp2; tmp.C2 = AdditiveExpression(); ...
76b3e334-e390-429b-9919-ebd432c0cc74
9
static byte HopperFix(byte data, String kierunek) { if (kierunek.equals("right")) { if (data == 2) { return 5; } if (data == 4) { return 2; } if (data == 5) { return 3; } if (data == 3) { return 4; } } else ...
5baabfe3-3d7b-4f1c-9b10-1518fe6be908
1
private static Key toKey(byte[] key, String algorithm) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException { DESKeySpec spec = new DESKeySpec(key); SecretKey secretKey = new SecretKeySpec(key, algorithm); if (algorithm.equals(DES)) { SecretKeyFactory factory = SecretKeyFactory....