method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
39666cce-7908-491c-b4de-55e733c78f61
7
public void paivita(Object uusi, int rivi, int sarake) { Elokuva elokuva = elokuvat.get(rivi); if (sarake == 1) elokuva.setNimi((String) uusi); else if (sarake == 2) elokuva.setOhjaaja((String) uusi); else if (sarake == 3) elokuva.setNayttelijat((String) uusi); else if (sarake ==...
ae5f4b27-144c-47ec-be54-30826a941233
4
public Game() { grid = new Tile[GRID_WIDTH][GRID_HEIGHT]; currentPiece = generatePiece(); for (int i = 0; i < 4; i++) currentPiece = new Piece().changeX(currentPiece, 1); nextPiece = generatePiece(); for (int i = 0; i < 4; i++) nextPiece = new Piece().changeX(nextPiece, 1); //insert(nextPiece, 7, ...
a80a7463-1faa-431d-bfd8-2605b445f509
7
public synchronized void startGame(List<String> wordList) { if (wordList.isEmpty()) { // TODO: do something.... end game? } gameEnded = false; currentScore = 100; while (countClients() < GamePlay.NUM_PLAYERS) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } R...
c5ad8e6a-2a30-4c9d-851a-7ec84399bfde
2
@Override public void Parse(Session Session, EventRequest Request) { if (!Session.GrabActor().InRoom()) { return; } Session.GrabResponse().Initialize(ComposerLibrary.LeavingRoom); Session.GrabResponse().AppendBoolean(false); Session.SendResponse(); if (Session.GrabActor().CurrentRoom.GrabParty(...
5a5dab4c-a09f-4507-8e90-625e86da9105
8
final public void VarDecl() throws ParseException { /*@bgen(jjtree) VarDecl */ SimpleNode jjtn000 = new SimpleNode(JJTVARDECL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token value; try { jj_consume_token(VAR_TAG); value = jj_c...
ad73d327-4ff1-4dad-921c-148a3030cffb
9
@Override public void doTask() { if(!dead) { // Log.debug("Moving Man"); this.direction = ai.getNextDirection(); if (direction.equals(Direction.TOP)) { if (!collisions.contains(Direction.TOP)) { super.setRealY(super.getRealY() - super.speed); } } if (direction.equals(Dire...
6f367ac2-18d4-435c-8cb8-42700a719f9a
4
public User getUserById(long userId) throws DataAccessException { Connection connection = getConnection(); try { PreparedStatement ps = connection.prepareStatement( "SELECT * FROM grad_users WHERE user_id=?"); PreparedStatement ps2 = connection.prepareStatemen...
c2b3fdfb-7ff5-4017-b0a6-2b565b59afb0
6
private void viewHistory() { System.out.println("View interpretation history ..."); // get list of grouping effective time: ArrayList<DataTimestamp> timestamps = this.loader.getGroupingEffectiveTimestamps(); // insert a "Baseline" timestamp timestamps.add(ti...
59420490-8137-4872-aed1-386729c90138
9
private void assertReaderClosed(IndexReader reader, boolean checkSubReaders, boolean checkNormsClosed) { assertEquals(0, reader.getRefCount()); if (checkNormsClosed && reader instanceof SegmentReader) { assertTrue(((SegmentReader) reader).normsClosed()); } if (checkSubReaders) { if...
c59da3cb-15b4-4527-b568-f9adcee2cf51
8
public void refreshMonLocs() { // if (this.useDelay) // this.flushNewInf(this.mySim.curTime); if (this.numMonitors == 0 || this.trackLocations.size() == 0) return; else if (this.weightByPop) this.refreshMonLocsWeightByPop(); else if (this.actualInfCount) this.refreshMonLocsActInfCount(); else if (th...
5624bd46-8694-43ad-b161-983d40cb5335
5
private final void printMessageFunc(final String title, final String message, @SuppressWarnings("hiding") final String text) { if (Thread.currentThread() == this.master) { synchronized (Button.class) { this.pressed = Button.ABORT; Button.class.notifyAll(); } } if (title == null) { Debug.print(...
e95d6d45-210f-48c3-9d56-b76b67928f96
9
public static void initializeRuntime() { String bootPath = System.getProperty("sun.boot.class.path"); String pathSeparator = System.getProperty("path.separator"); if ((bootPath == null) || (pathSeparator == null)) { StandardLog .warning("Cannot initialize boot pat...
3643c741-660a-4f5d-90d4-2cf0c6d1a5e1
0
public PrioritizedTaskProducer(Queue<Runnable> q, ExecutorService e) { queue = q; exec = e; }
24084eba-2473-46f7-8b87-3e4595d62d34
1
public HMWord(String word) { this.setWord(word); length = word.length(); setWrongLetters(new ArrayList<Character>()); setPlaceholder(new ArrayList<Character>()); for (int i = 0; i < length; i++) { getPlaceholder().add(UNDERSCORE); } }
b6fe678f-2c92-46a5-898c-f39e86b94f87
5
@Override public boolean match(ValueExpression te, Map<String, ValueExpression> map) { if (!(te instanceof TupleExpression)) { return false; } TupleExpression tuple = (TupleExpression)te; if (!(tuple.getTupleType().equals(getTupleType()))) { return false; } else { if (element...
5f588925-a3b2-4910-8cef-57a582042f92
4
@Override public C next() { if (lastNode!=null && (index < lastNode.keysSize)) { lastValue = lastNode.getKey(index++); return lastValue; } while (toVisit.size()>0) { // Go thru the current nodes ...
4b70b3bf-3382-4484-892e-75ed0fef2886
4
public boolean isInBound ( int x, int y) { if(x<0||x>=boardSize||y<0||y>=boardSize) return false; return true; }
738e8965-8c1e-4d7c-b414-f7693647a03d
5
static void readBTX(File f) throws Throwable { BTXParser v = new BTXParser(f); l: while (true) { switch (v.next()) { case ATTRIBUTE : BTXAttribute at = v.getEventData().getAttribute(); at.getName(); at.asString(); break; case END_OBJECT : break; default : case EOF : ...
ec1a9044-7566-4ab7-aa7d-b737f57e811f
5
private void asetaTKuva() { if (noppa == 2 || noppa == 3){ ImageIcon nyrkki = new ImageIcon(new ImageIcon(getClass().getResource("/nyrkky.jpg")).getImage()); setIcon(nyrkki); } else if (noppa == 4){ ImageIcon jousi = new ImageIcon(new ImageIcon(getClass().getResource(...
6d38a073-d9a0-41bf-a08e-f7d6bb9fcec9
7
public boolean HandleRequest( HTTPRequest request, StringWriter out ) { if ( !request.method.equals( "GET" ) && !request.method.equals( "POST" ) ) return false; String command = ""; if ( request.parameters.containsKey( "command" ) ) { command = request.parame...
a73d326e-31a0-4905-9dcf-6b8109cfdd6a
2
private boolean isLeaf() { if (internal_node) return false; if (objects.size() < max_objects_per_leaf) return true; grow_leaves(); return false; }
69c8186d-84a6-4e94-bda7-8c712569e006
1
public Collection<GroupSettings> getGroups(boolean includeManual) { if(includeManual) return Collections.unmodifiableList(mAllGroups); else return Collections.unmodifiableList(mAutoGroups); }
73a289b7-b2ee-4f9a-bb92-5fde821ecb1a
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Client other = (Client) obj; if (this.idClient != other.idClient) { return false; } ...
26b374d7-1401-4cb9-92e1-e02900742dbe
2
public synchronized static void print(String name) { for (int i = 0; i < 20; i++) { System.out.printf("%s %s\n", name, i); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } }
9d59fec6-9c07-4c9a-901e-f6bb86c6baa3
0
public void mouseClicked(MouseEvent e) { }
56fe6e49-f50f-4b1a-822b-633ae52d30ee
4
private int computeGlobalSize() { int size = (allocator.getRegNumber() + 2) * 4; // useless, just to make // code logic simple int maxReg = 0; for (int reg : regMap.values()) { if (maxReg < reg) { maxReg = reg; } } if (maxReg > allocator.getRegNumber() + 2) { size = maxReg * 4; } for (Varia...
42c947a4-1e9b-4a27-b00e-528c230344f5
8
@Override public void computeFontSize(List<TagCloudElement> elements) { if (elements.size() > 0) { Double minCount = null; Double maxCount = null; for (TagCloudElement tce : elements) { double n = tce.getWeight(); if ((minCount == null) || ...
98c9fe5c-1c0f-4f02-bef3-63dfb8ce8fbe
9
void hitmiss(int xe, int ye, int [][] pixel2, int [][]pixel, int [] lut){ int x, y; // considers the pixels outside image to be 0 (not set) for (x=1; x<xe-1; x++) { for (y=1; y<ye-1; y++) { pixel[x][y]+= lut[( pixel2[x-1][y-1] + pixel2[x ][y-1] * 2 + pixel2[x+1][y-1] * 4 + pixel2[x-1][y ]...
e219f7ee-13fe-44b0-9366-a5b303c0db78
6
private int method42(int i, int j, int k) { int l = k >> 7; int i1 = j >> 7; if(l < 0 || i1 < 0 || l > 103 || i1 > 103) return 0; int j1 = i; if(j1 < 3 && (byteGroundArray[1][l][i1] & 2) == 2) j1++; int k1 = k & 0x7f; int l1 = j & 0x7f; int i2 = intGroundArray[j1][l][i1] * (128 - k1) + intGroundAr...
1e1d8e30-5a63-403a-b73a-109fd1657c90
1
protected void carregaTabelaEnderecos(List<Endereco> lista){ this.modeloTabelaEndereco = new DefaultTableModel(); this.modeloTabelaEndereco.addColumn("Rua"); this.modeloTabelaEndereco.addColumn("Bairro"); this.modeloTabelaEndereco.addColumn("Cep"); this.modeloTabelaEndereco.addCo...
7aa406db-d8da-4cd8-be0e-17dab83fbe32
2
private boolean impliedBy(int and, int xor) { for (int i = 0; i < andMasks.length; i++) { if (implies(and, xor, andMasks[i], xorMasks[i])) return true; } return false; }
88bbab56-a099-4ba7-a4b7-3553587fc6c5
1
public static void load() { File file = new File("./Player.xml"); if(file.exists()){ playerData = JAXB.unmarshal(file, PlayerData.class); } else { playerData = JAXB.unmarshal(PlayerData.class.getResourceAsStream("/data/Player.xml"), PlayerData.class); } }
dd50b733-1cb7-4988-880d-d74fef82769d
1
public static void display(long array[]){ for(long arr : array){ System.out.print(arr+" "); } System.out.println(); }
dd8c59d0-6014-40be-acfe-93127c2a21b1
0
public int getCoordonneeX() { return x; }
5d6f1c59-284b-49b5-b57f-6d58b8511eba
2
private void gererLesEvenementsUtilisateurs() { while (Mouse.next()) { this.camera.onMouseEvent(); } while (Keyboard.next()) { this.sphere.onKeyEvent(); } }
2183284d-668a-4ef8-8320-54813a2b4bb4
4
private void assertTagValue(Document doc, String tagName, String tagValue) throws XPathExpressionException { NodeList list; if (tagName.startsWith("/")) { XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); XPathExpression expr = xpath.compil...
c10cc800-5d79-42bb-94aa-58989d33d923
0
public List<String> getPrefNames() { return prefNameCombo.getItems(); }
fe746ca9-19e1-46a5-aae5-230b7fa2731f
2
private OutputChannels(int channels) { outputChannels = channels; if (channels<0 || channels>3) throw new IllegalArgumentException("channels"); }
393f11d6-0517-450a-bb29-8ff118cdcd17
6
public boolean playerWon(int p){ // If sentinel won if(winner == 1) { // Check whether player was on team sentinel for(int s:sentinel) { if(s == p) return true; } } // If scourge won if(wi...
d0016f4c-820b-4e66-9ccf-2988bfde8a2f
4
public static List<Point2D> ConnectionPoint (ABObject o1, ABObject o2) { List<Point2D> connection_p = new ArrayList<Point2D>(); if (o1.id != o2.id) { List<Point2D> pointsO1 = MathFunctions.getObjectContourPoints(o1); List<Point2D> pointsO2 = MathFunctions.getObjectContourPoints(o2); //System.out.println...
d5e6652d-6b4f-4506-9864-e4b644346b37
7
public void hataHesapla(double ideal[]) { int i, j; final int arakatmanİndeksi = girisSayisi; final int cikisİndeksi = girisSayisi + arakatmanSayisi; for (i = girisSayisi; i < neuronSayisi; i++) { hata[i] = 0; } for (i = cikisİndeksi; i < neuronSayisi; i++) { hata[i] = ideal[i ...
313bffde-3cba-4b54-8450-5b1fd67da33e
3
public void gameLoop() { long startTime = System.currentTimeMillis(); long currTime = startTime; while (isRunning) { long elapsedTime = System.currentTimeMillis() - currTime; currTime += elapsedTime; // update if (startTim...
eda8fe0c-c464-4185-9a82-692c2e8d3b1f
9
public static void display(JPanel p, String font) { // loops for the length of how many non-repeating words there are rect = new ArrayList<Rectangle>(); System.out.println("hi hi hi world!! " + wordsList.size()); p.setOpaque(true); p.setBackground(Color.white); for(int q = 0; q < words...
15eb710d-4555-4c31-a9df-b01cd6758548
9
static public boolean checkInstallation(JavaPlugin plugin, Properties config, Logger log) { boolean ret = true; String pluginName = plugin.getDescription().getName(); byte buffer[] = new byte[512]; Iterator<Entry<Object, Object>> it = config.entrySet().iterator(); while (it.h...
b50c41ab-f0b4-4b2a-b086-d0fa185eaf6c
5
public boolean isFull(Comparable[] flatTree) { boolean answer = true; for (int i = 1; i < flatTree.length; i++) // go through everything in the flattree { Comparable left = getLeftKid(i,flatTree); // get the left child of the current item Comparable right = get...
60334a1f-619e-4266-ae42-0b90800643fd
7
private void flipColors(Node h) { // h must have opposite color of its two children assert (h != null) && (h.left != null) && (h.right != null); assert (!isRed(h) && isRed(h.left) && isRed(h.right)) || (isRed(h) && !isRed(h.left) && !isRed(h.right)); h.color = !h.color; ...
001bb03c-c318-418b-8775-6700471dfc6b
5
public void writeKnownAttributes(GrowableConstantPool gcp, DataOutputStream output) throws IOException { if (bytecode != null) { output.writeShort(gcp.putUTF8("Code")); output.writeInt(bytecode.getSize()); bytecode.write(gcp, output); } if (exceptions != null) { int count = exceptions.length; ou...
5c105290-6049-4b72-bf58-68303a3cdbe3
8
public synchronized void buyBooks(Set<BookCopy> bookCopiesToBuy) throws BookStoreException { if (bookCopiesToBuy == null) { throw new BookStoreException(BookStoreConstants.NULL_INPUT); } // Check that all ISBNs that we buy are there first. int ISBN; BookStoreBook book; Boolean saleMiss = false; for...
7dcee073-88b2-4078-9d29-d78cc7fc0c1d
4
@Override public void stop() { switch( channelType ) { case SoundSystemConfig.TYPE_NORMAL: if( clip != null ) { clip.stop(); clip.setFramePosition(0); } break; case Sou...
d3d46d77-573d-42fc-bed5-3fa91eaf12d1
1
public void copyField( Level level ) { for ( int i = 0; i < level.field.length; i++ ) { System.arraycopy( level.field[i], 0, field[i], 0, level.field[0].length ); } }
054779e8-4773-462f-b89e-6e9bc2daab90
5
public LinkedList<File> getPatches() { LinkedList<File> patches = new LinkedList<File>(); if(carrierString!=null) { if(carrierString.length()>0) { patches.add(findReplace(extractFromJar(CARRIER_PATCH), "/*Edit Here*/", "+\t\t\tthis.carrierText = \"" + ...
cc0dd065-1949-43a9-b7d0-0df939904029
1
private void init() { _view.cmb_status.setModel(new javax.swing.DefaultComboBoxModel(fa.Ticket_ComboBox(4).toArray( new Object[fa.Ticket_ComboBox(4).size()]))); _view.cmb_category.setModel(new javax.swing.DefaultComboBoxModel(fa.Ticket_ComboBox(3).toArray( ...
9c74f63d-4255-45bd-9f39-4e055c48e111
4
private void readGroups( Element groupsElement ) { NodeList nl = groupsElement.getChildNodes(); for ( int i=0;i<nl.getLength();i++ ) { org.w3c.dom.Node node = nl.item( i ); if ( node.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE ) { String nodeName = node.getNodeName(); if ( nodeName != null &...
8553ad48-c1ec-4f6e-9b4e-26b567c64a2b
2
public void filter(byte[] samples, int offset, int length) { for (int i=offset; i<offset+length; i+=2) { // update the sample short oldSample = getSample(samples, i); short newSample = (short)(oldSample + decay * delayBuffer[delayBufferPos]); setS...
7451891c-f55e-4b7b-b678-97ca450bd8d4
8
public static void main(String[] args) { if (args.length < 2) { System.out.println("Please indicate the number of planes and the length of a time unit (in milliseconds) as command line arguments (in that order)."); return; } int num_aircraft; int time_unit; Lock lock; try { num_aircraft = Int...
64400854-7a57-49ce-a277-31e5c5844ae3
1
public static NormalDistributedStochasticLotsizingProblem generate( int quarterPeriodLength, int numberOfQuarterPeriods, double baseLevelMean, double amplitudeMean, double cv, double setupCost, double inventoryHoldingCost, float alpha, AbstractNormalLikeOrdersGenerator orderGenerator){ //calculate sin ste...
b1e860f2-a0ac-4eff-bb4f-fee1fc7198cf
1
public synchronized ClassInfo loadClass(String className) throws ClassNotFoundException { // Lots of interesting stuff to do here. For the moment, just // load the class from the ClassInfoLoader and add it to the // hierarchy. className = className.replace('.', '/').intern(); // Check the cache of ClassInfo...
a6ac5c6c-7f09-42e1-a377-8f450fdd934e
3
public int inserir(Manutencao m){ Connection conn = null; PreparedStatement pstm = null; int retorno = -1; try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(INSERT, Statement.RETURN_GENERATED_KEYS); pstm.setString(1, m.getMoti...
d2e64d8b-9478-43ab-b83a-127912a264ec
5
public void actionPerformed(ActionEvent evt) { String response; try { Object source = evt.getSource(); //finds the source of the objects that triggers the event int indexPosition = (Integer) ((JComponent) evt.getSource()).getClientProperty("index"); //variable that represents the...
fcb755cb-e73a-4283-9e97-dce34d0b8f01
9
private float getValue(char letter) { switch (letter) { case 'I': return I; case 'V': return V; case 'X': return X; case 'L': return L; case 'C': return C; case...
bbe366a2-7ab6-4425-a1d9-05a444b6472a
4
@Test public void testMoveForward() { Random rand = Mockito.mock(Random.class); // On s'assure que le terrain et toujours franchissable. Mockito.when(rand.nextInt(Land.CountLand())).thenReturn(0); Robot r = new Robot(); r.land(new Coordinates(0,0), new LandSensor(rand));...
3213005f-7be9-4603-87b2-d9be54f1de8c
9
public static void main(String[] args) throws IOException { // 1. Reading input by lines: BufferedReader in = new BufferedReader(new FileReader("mao.txt")); String s, s2 = new String(); while ((s = in.readLine()) != null) s2 += s + "\n"; in.close(); // 1b. Reading standard input: BufferedReader stdin =...
d8648e5d-9637-47f8-ba9e-4c788a84b931
6
public void addMessageListener(int type, MessageEventListener messageEventListener) { try { switch(type) { case 0: this.stdmessageEventManager.addEventListener(messageEventListener); break; case 1: this.authmessageEventManager.addEventListener(messageEventListener); break; case 2: this.usermessageEvent...
b822c1af-56fc-4f14-be3f-d3e33ea8e807
1
public void setState1(State state1) throws IllegalArgumentException{ if(state1 != null) this.state1 = state1; else throw new IllegalArgumentException(); }
c6a9f54b-ca05-40f9-af6f-223b1d0619ca
2
@BeforeClass public static void setUpClass() { clock_ = new LamportClock(); timestampList_ = new ArrayList<Long>(); thread1_ = new Thread(new Runnable() { @Override public void run() { for (int i = 1; i <= events1_; i++) { clock_....
4c7e4790-7f84-4a83-8c61-cc5dc1589637
3
public long skip( long n ) throws IOException { if( this.isClosed ) throw new IOException( "This stream was already closed. Cannot skip input." ); if( this.emptyStopMarkSet() ) return this.in.skip( n ); // First call? if( this.currentStreams[0] == null ) initStreamStack(); return this.currentS...
aa49e470-b025-4115-8e30-3693ca0090c6
0
public Taso getTaso() { return taso; }
6d7fcfb8-3a12-4fab-9158-33cc071b7cc1
4
public boolean implementedBy(ClassInfo clazz) { while (clazz != this && clazz != null) { ClassInfo[] ifaces = clazz.getInterfaces(); for (int i = 0; i < ifaces.length; i++) { if (implementedBy(ifaces[i])) return true; } clazz = clazz.getSuperclass(); } return clazz == this; }
42c4a065-1624-46ca-aadc-d9b21fb225fe
5
protected String getList() { StringBuilder fileList = new StringBuilder(); File[] files = new File( configPath ).listFiles(); fileList.append( " " ); for ( int i = 0; i < files.length; i++ ) { if ( files[i].getName().contains( ".txt" ) ) { fileList.append...
bf8c4fa6-2d34-4271-9f0e-3e9ba792be6e
4
public static int ppt2pdf(String srcPath, String destPath) { File file = new File(srcPath); if (file.exists()) { ComThread.InitMTA(); ActiveXComponent ppt = null; try { ppt = new ActiveXComponent("Powerpoint.Application"); ppt.setProperty("Visible", new Variant(true)); Dispatch presentations = ...
ed7b2f70-5444-4f0a-9cc6-40de17050c66
2
public boolean deleteKey(String key) { try { if (METHOD_DELETE_KEY == null) { METHOD_DELETE_KEY = getMethod(mRoot.getClass(), "WindowsRegDeleteKey", int.class, byte[].class); } return ((Integer) METHOD_DELETE_KEY.invoke(mRoot, new Object[] { mRootKey, toCstr(key) })).intValue() == 0; } catch (Exception...
70b0ee01-778f-4280-8fe9-0c73926680ad
8
private boolean verifyValidExport() { for (Link link : story.getAllLinks()) { // Check if there are any links with no media item if (link.getMediaItems().isEmpty()) { JOptionPane.showMessageDialog(null, "There are Links with no Media items. Add so...
5beda620-925c-43b9-93db-3395849a6614
1
protected DatabaseHandler() { try { //contructor method to initiate (combo)DataSource for pooled connections on spawning an object. //initiateDataSource(); initiateDataSource(); } catch (SQLException ex) { throw new RuntimeException("Something went wrong w...
6d918ca8-5893-4747-8983-912259975b01
2
public void testTrackRead() { try { buildEmptyTrackForTest(); Record r = GetRecords.create().getRecords("fake-empty-tracks-testing").get(0); for (int i = 1; i <= r.getNumberOfFormatTracks(); i++) { assert (r.getFormTrackArtist(i).length() > 0); ...
cc4a2816-3cf8-4c23-8407-43b40f0eeb59
8
public static double[][] readMatrix(Path path, HamaConfiguration conf, int rows, int columns, int blockSize) { int finalRows = getBlockMultiple(rows, blockSize); int finalCols = getBlockMultiple(columns, blockSize); double[][] matrix = new double[finalRows][finalCols]; SequenceFile.Reader reader = null; ...
0398f7fa-515d-4015-96e9-8a820fcc3499
1
public final TMState createBlock(Point point) { int i = 0; while (getStateWithID(i) != null) i++; OpenAction read = new OpenAction(); OpenAction.setOpenOrRead(true); JButton button = new JButton(read); button.doClick(); OpenAction.setOpenOrRead(false); return getAutomatonFromFile(i, point); }
bcd39265-0c01-4287-b106-e92b8d2e4bc6
7
public Integer insert(MovimientosBeans movi) throws DAOException { PreparedStatement pst = null; ResultSet generatedKeys = null; try { pst = con.prepareStatement(sql.getString("INSERT_MOVIMIENTOS"), Statement.RETURN_GENERATED_KEYS); //INSERT INTO MOVIMIENTOS (IDTIPO_MOVIMIENTO, IDUSUARIOS, IDUNICO_MOV...
a2f11ce7-cc31-496d-ab39-03f9072977f4
4
public void get(int key) { HashPrinter.tryGet(key); /** Run along the array */ int runner = 0; int hash = (key % TABLE_INITIAL_SIZE); while (table[hash] != null && runner < TABLE_INITIAL_SIZE) { if (table[hash].getKey() == key) { break; } runner++; hash = ((key + runner) % TABLE_INITIAL...
da6a7b72-c8e2-4b41-bf16-03e25b3e5106
1
@Override public boolean canImport(TransferSupport support) { return (support.getComponent() instanceof JList) && support.isDataFlavorSupported(RosterTransferComponent.ROSTER_COMPONENT_DATA_FLAVOR); }
958b9bf8-c2e4-451a-8384-21502fa991b1
9
private static ArrayList<ResidualEdge> minCostFlowWithPrimalDualSub( ArrayList<ResidualEdge>[] edges, int[] lastShortestDists, int s, int t) { int n = edges.length; ResidualEdge[] prevE = new ResidualEdge[n]; int[] prevV = new int[n]; int[] dist = new int[n]; Arrays.f...
c9e6dfb9-15b7-4721-9ef1-b49b50cf96b2
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...
4fd3a3c6-341e-457d-a4db-8b150f048f3e
2
public Bag getDiscsByType(DiscType discType) { LOGGER.log(Level.INFO, "Getting all discs of type " + discType); Bag discBag = new Bag(); for (int i = 0; i < discs.size(); i++) { if (discs.get(i).getDiscType() == discType) { discBag.addDisc(discs.get(i)); } ...
9c3f565b-43c7-4df2-b613-107e4bc5b423
5
private static int procmemsize(long rnum, String path) { System.gc(); long musage = memusagerss(); double stime = Utility.time(); long count = -1; if (path == null) { int bnum = rnum < Integer.MAX_VALUE ? (int)rnum : Integer.MAX_VALUE; Map<String, String> map = new HashMap<String, String...
6b1e0882-4796-4cef-9d0f-eab2093621b0
5
@Override public void update(Observable o, Object arg) { searchNumber.setText(arg+""); if (board.getValidAnswer()){ switch(movePlayer){ case moveByA: pointsPlayerA++; log.finer("Player A was right!"); break; case moveByB: pointsPlayerB++; log.finer("Player B was right!"); break; } ...
669b945e-465d-4508-919b-51753b8ecf39
1
public void rotCW() { if (!pause) { plateau.updatePosition(0, 1); updateObservers(); } }
99518101-fd60-42ff-bd4f-415c71216374
5
public LinkedHashMap<Integer, Persona> cargarPersonaTexto(String nombreFichero) { LinkedHashMap<Integer, Persona> personas = new LinkedHashMap<>(); Persona p; FileInputStream fis = null; ObjectInputStream ois = null; try { fis = new FileInputStream(nombreFichero); ...
5d63a179-a1b5-4c6b-8264-0fff9502b330
9
public static double documentRankIDFWeighted(List<String> document, List<String> query, IDFMatrix iDF) { if(document.isEmpty() && query.isEmpty()) return 1; if(document.isEmpty() && !query.isEmpty()) return 0; if(query.isEmpty() && !document.isEmpty()) return 0; Frequen...
9865203b-5d4c-4f20-9640-f71e3b4ea3d2
3
public static long bstExperiment(BSTInterface<Long> tree) { int choice; Long number; startTime = (new Date()).getTime(); for(int i = 0; i < NUMBER_OF_CHOICES; i++) { choice = choices[i]; number = numbers[choice]; if(!tree.contains(number)) { System.out.println("Not found"); br...
92bf61e1-a6d7-44f7-89c2-84d1fcaa3aa4
0
public final void addDragListeners(final Node n) { n.setOnMousePressed(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent me) { startDragX = me.getSceneX(); startDragY = me.getSceneY(); root.setStyle("-fx-opacity:.7;"); } }); n.setOnMouseReleased(new EventHandler<Mous...
31da6fe1-a9b1-4b00-86c3-ce2ebbe3a307
3
@Override public String compress(String xml) { if(!enabled || xml == null || xml.length() == 0) { return xml; } //preserved block containers List<String> cdataBlocks = new ArrayList<String>(); //preserve blocks xml = preserveBlocks(xml, cdataBlocks); //process pure xml xml = processXml(xml)...
6ad910b8-1fd8-4dad-8f05-d5f505fe7a0c
1
static void printNumbers(int n){ if(n <= 0){ return; } System.out.println(n); printNumbers(n-2); printNumbers(n-3); System.out.println(n); }
3ca9e8c0-86f6-4fb7-883e-28ba487d1872
7
public Map<Vertex, Integer> calculate(WeightedNonDirectedGraphImpl<Integer> graph, Vertex<Integer> start) { processedVertices = new HashSet<Vertex<Integer>>(); unsettledVertices = new HashSet<Vertex<Integer>>(); distances = new HashMap<Vertex, Integer>(graph.numVertices()); for (Vertex...
24143e5e-131c-4bd8-8cf9-6686c7a969e3
7
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); HttpSession session=request.getSession(true); ...
a28765b4-6f62-4c16-a112-cd56d352575e
5
public static void print_help_if_requested(List<String> argv, String doc) { if (argv.isEmpty() || ArrayExtensions.contain(argv, "-h") || ArrayExtensions.contain(argv, "--h") || ArrayExtensions.contain(argv, "-help") || ArrayExtensions.contain(argv, "--help")) { System.err.println(doc); System.e...
14e84396-10a1-41a8-8485-54d1d37af3ad
4
private void scruffPolyline(Element element) { StringBuilder modified = new StringBuilder(); List<Point2D> points = Point2D.parsePoints(element.getAttribute("points")); for(int i=0, n=points.size()-1; i<n; i++) { Point2D pn0Orig = points.get(i); Point2D pn0 = pn0Orig; ...
1894c4cf-3e99-48db-96a1-01f502fc55b3
0
public void setPostalCode(String postalCode) { Address.setPostalCode(postalCode); }
5188783d-04ef-460a-bd5a-e87e2c00956f
1
@Override public final void update(Graphics g) { if (graphics == null) { graphics = g; } shouldClearScreen = true; raiseWelcomeScreen(); }
277281e0-3a19-4c44-9751-2f8c825dca01
5
public int[] getIntsArray() { if (this.getTypeByte() == Encoder.TAG_NULL) return null; Decoder dec; try { dec = this.getContent(); } catch (ASN1DecoderFail e) { e.printStackTrace(); return null; } ArrayList<BigInteger> ints = new ArrayList<BigInteger>(); for(;;){ Decoder val = dec.getFirstObje...
d237b0bd-4ff0-4929-a7fb-3c765fb95bdd
1
public void generateWeapon(int ALG_TYPE, int roundNumber) { Weapon w; cw = CalculateWeapon.makeCalc(ALG_TYPE, roundNumber); w = cw.calculateWeapon(); super.setWeapon(w); if (ALG_TYPE == 1) { setPredictedWeapon(null); } else { setPredictedWeapon(w);...
13c3fba8-abcf-4f8c-8e96-205219657c16
1
public void keyup(KeyEvent ev) { setmods(ev); if (keygrab == null) root.keyup(ev); else keygrab.keyup(ev); }