method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
78e70008-6530-4701-9549-ab14e46e96b9
8
public static boolean isConnected(mxAnalysisGraph aGraph) { Object[] vertices = aGraph.getChildVertices(aGraph.getGraph().getDefaultParent()); int vertexNum = vertices.length; if (vertexNum == 0) { throw new IllegalArgumentException(); } //data preparation int connectedVertices = 1; int[] visited ...
4f850cf8-e4f2-4802-9958-d1643c899aa8
9
private void generateLookupTable() { for (int i = 0; i < 512; i++) { boolean[] bits = toBinaryArray(i, 9); int liveNeighbors = 0; for (int j = 0; j < 9; j++) { if (bits[j] && j != 4) { liveNeighbors++; } } boolean isLiving = bits[4]; if (!isLiving && liveNeighbors == 3) { lookupTabl...
5159d28d-49d1-4504-9859-9e365db743e8
9
public static void binaryInsertionSort(Comparable[] a, int lo, int hi) { for (int i = lo + 1; i <= (hi < lo + 7 ? hi : lo + 7); i++) { for (int j = i; j > lo && less(a[j], a[j-1]); j--) exch(a, j, j-1); } for (int i = lo + 8; i <= hi; i++) { // ...
b945398a-9c0c-4a34-aa70-f0b497295615
0
@Basic @Column(name = "CTR_POS_ID") public int getCtrPosId() { return ctrPosId; }
d9a83f05-4155-4a01-a6d4-1a3bd93101ee
9
public void transformMove() { System.out.println("Coin.transformMove()" + this); lastMovedCoin = this; LudoRegion region = null; path = new Path(); // if region 4 than Cordenate from = new Cordenate(this.getBlockNo().getX(), this .getBlockNo().getY()); MoveTo to = new MoveTo(this.getCenterX(), this.ge...
93fb3df6-5b85-488b-bb17-a7906bcc7aff
3
@Override public void sendAllNow() throws IOException { if (isNotReady()) { return; } while (!outbound.isEmpty()) { send(); } while (!bufferOut.isEmpty()) { write(); } }
2f12f1f3-b7ad-45de-81c7-b2e881d3a103
1
public KeyNoncePair(byte[] key) { byte[] nonce = new byte[NONCE_SIZE]; for(int i = 0; i < NONCE_SIZE; i++) { nonce[i] = key[i]; } this.key = key; this.nonce = nonce; }
816fcd45-46ae-4155-be31-14526b9039f6
1
private void quicksort(final int p, final int r) { if (p < r) { final int q = partition(p, r); quicksort(p, q); quicksort(q + 1, r); } }
d80f5bee-7755-4d2d-a9a0-4c97b34ed59b
3
public void end (String name) { if (warmup) return; long e = System.nanoTime(); long time = e - s; Long oldTime = testTimes.get(name); if (oldTime == null || time < oldTime) testTimes.put(name, time); System.out.println(name + ": " + time / 1000000f + " ms"); }
68099eb2-7efa-46bf-ab57-c6af712b4a07
8
public double historicalEventExecute( double historicalEventTime){ historicalEvent tempEvent; double gen = historicalEventTime; if(currentEvent == null){ System.out.println("Sorry no historical event to execute"); return 0; } else{ dem.dgLog(10 , currentEvent.getGen(), currentEvent.getLabel()); sw...
f19dd241-99f9-493e-a90d-100682faa620
5
public String getIdName(){ if(id < 10){ return "000" + id; } else if(id >= 10 && id < 100){ return "00" + id; } else if(id >= 100 && id < 1000){ return "0" + id; } else{ return "" + id; } }
b591d797-7eff-4a26-b7af-8d35d033b8e7
5
public URI crawl(URI currentLocation, final String needle) throws URISyntaxException, MalformedURLException, InterruptedException, ExecutionException { String urlContents = downloadContents(currentLocation); visitedUrls.add(currentLocation); if (urlContents.contains(needle)) { return currentLocation; } e...
e7a76812-bfef-4bc3-972c-e6176dcb0c78
1
public Map<String, Object> getConfiguration() { @SuppressWarnings("unchecked") Map<String, Object> config = (HashMap<String, Object>) servletContext.getAttribute(Constants.CONFIG); // so unit tests don't puke when nothing's been set if (config == null) { return new HashMap<String,...
4f6ecef7-b70c-47d8-bb91-9c0d31982a4c
8
public int Run(RenderWindow App){ boolean Running = true; Text scenario = new Text(); Font Font = new Font(); try { Font.loadFromFile(Paths.get("rsc/font/mrsmonsterrotal.ttf")); } catch (IOException e) { e.printStackTrace(); return (-1); ...
72b74b7a-d264-4ba4-ae26-399883071eb5
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if((msg.amITarget(affected)) &&(mobs.contains(msg.source()))) { if((msg.targetMinor()==CMMsg.TYP_BUY) ||(msg.targetMinor()==CMMsg.TYP_BID) ||(msg.targetMinor()==CMMsg.TYP_SELL) ||(msg.targetMinor()==CMMsg.T...
15745ec3-56ef-4b1f-9a03-a852ea6d73cb
1
public void run(String[] args) throws FileNotFoundException, IOException { Card card = PCSCManager.getCard(); if (card != null) { String atr = Hex.printBytesHexa(card.getATR() .getBytes()); Logger.log(card.toString() + "\n"); Logger.log(PCSCManager.getCardName(atr) + "\n"); Logger.log("ATR: " + a...
ee0cf549-6c00-4c2e-9bb9-13efddaabfe0
0
public formHelp() { initComponents(); }
93837e1b-9fcd-415a-876c-d86437097a7a
0
public void start(String msgIn) { MSG = msgIn; reset(); }
02416eb2-408a-4b18-9b38-a1b7b43ef4df
2
public void clear() { do { CacheableNode cacheableNode = recent.popFront(); if (cacheableNode != null) { cacheableNode.unlink(); cacheableNode.unlinkSub(); } else { capacity = srcCapacity; return; } } while (true); }
0d920aad-7765-4444-a4c7-899f4abd2da0
6
public static <E extends Comparable<E>> void sortWithStack(Stack<E> stack) { if(stack.isEmpty()) { return; } Stack<E> auxStack = new Stack<E>(); while(!stack.isEmpty()) { E item = stack.pop(); while(!auxStack.isEmpty() && auxStack.peek().compareTo(item)>0) { E tmpItem = auxStack.pop(); s...
6df6ac50-8ade-471c-88ae-d4038f824795
4
public void addNodeSorted(treeNode newNode, treeNode curRoot) { if (newNode.value < curRoot.value) {// add to left child tree if (curRoot.leftLeaf != null) { addNodeSorted(newNode, curRoot.leftLeaf); } else { curRoot.leftLeaf = newNode; newNode.parent = curRoot; } } if (newNode.value > curRo...
512130ae-9e48-4605-8f56-3449207dddff
4
public CycObject readNart() throws IOException { CycNart cycNart = null; int cfaslOpcode = read(); if (cfaslOpcode == CFASL_NIL) { cycNart = CycObjectFactory.INVALID_NART; isInvalidObject = true; } else if (cfaslOpcode != CFASL_LIST) { if (cfaslOpcode == CFASL_SYMBOL) { ...
5c9bf790-2f53-43c5-b812-770c0e15a0b3
5
public static int upperBound(int key) { int lower = 0, upper = dig.length - 1, ans = -1; while (lower <= upper) { int mid = (lower + upper) / 2; if (key < dig[mid].s) upper = mid - 1; else { lower = mid + 1; ans = mid; }...
9064702f-678e-4035-82e6-29e2bcd23d02
8
private void qsort(Object[] items, Comparator comparator, int l, int r) { final int M = 4; int i; int j; Object v; if((r - l) > M) { i = (r + l) / 2; if(comparator.compare(items[l], items[i]) > 0) { swap(items, l, i); } if(comparator.compare(items[l], ite...
9ce64c24-797e-4a11-8db0-2fd50b4327ef
0
private void setupMaps(InputMap input_map, ActionMap action_map) { input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0, false), "left"); input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.SHIFT_MASK, false), "left"); input_map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, Event.CTRL_MASK, false), "l...
37253f16-d0bb-4cdb-a11c-2261a2d7f7bd
4
protected HsqlDaoBase(HsqlUnitOfWork uow) { super(uow); try { Connection connection = uow.getConnection(); ResultSet rs = connection.getMetaData().getTables(null, null, null, null); boolean exist = false; stmt =connection.createStatement(); while(rs.next()) { if(rs.getString("TABLE...
f6047091-1c83-4e93-bd54-888cdb3a13a9
5
public int getLanguageID( TLanguageFile checkFile ) { int back = UNDEFINED_LANG ; if ( checkFile != null ) { if (checkFile.hasLanguageExtension() ) { boolean found = false ; int t = 0 ; int len = langVersions.size() ; while ( ( !found ) && ( t < len ) ) ...
ed70cfa2-c2c7-4b96-b065-76bd38c0e210
4
@Test public void adenAskEmployeePriceTest(){ LocalDate date = LocalDate.now(); int dayOfWeek = date.getDayOfWeek(); boolean weekend = false; Canteen c2 = new Canteen(new CanteenData(CanteenNames.ADENAUERRING, 0)); int dayShift = (dayOfWeek + 2) % 7; if(dayOfWeek == 0 || (dayOfWeek == 6)) { // weekends ...
b8e2edfa-f6b5-40a7-81e2-4460672e483f
7
public Object readParamInXmlFile(String paramName){ ArrayList<String> params = new ArrayList<String>(); try{ File fXmlFile = new File(fileName); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder; dBuilder = dbFactory.newDocumentBuilder(); Document do...
bb3247a2-4c1e-4efc-9fbb-32a5265d67b6
7
public void foward(float delta, Level level, int currentRoom) { Float x,y,z,minX,maxX,minY,maxY; minY = level.getRoomList().get(currentRoom).getPos().getY(); maxY = level.getRoomList().get(currentRoom).getPos().getY() + level.getRoomList().get(currentRoom).getDy(); minX = level.getRoomList().get(currentRoom)...
57e9a382-9e3a-4f66-863d-2152ba7f48b6
6
public void initialize() { //finding out number of possible tiles File tilelist; try { tilelist = new File(getClass().getResource("resources/tiles.txt").toURI()); } catch(URISyntaxException e) { tilelist = new File(getClass().getResource("resources/tiles.txt").get...
58455515-d239-43f5-8e49-ab8acaf757e0
9
public static boolean start(RootDoc root) { // Get some options String title = "My Ant Tasks"; String[] templates = null; String templatesDir = "."; String[] outputdirs = new String[] { "."}; String[][] options = root.options(); for (int opt = 0; opt < options.l...
7267bf7e-d7b0-4b96-b22f-26c66cc59534
8
public static List<Query> loadQueriesFromFile(String filePath) { List<Query> queries = new ArrayList<Query>(); InputStream fis = null; BufferedReader reader = null; try { // fis = ClassLoader.getSystemResourceAsStream(filePath); fis = new FileInputStream(filePath); reader = new BufferedReader(new Inpu...
0cbe6518-dbcd-434c-9893-07c19274a968
2
public boolean estaEnExtremos(){ boolean resp= false; if (siguiente==null || previo == null) resp = true; return resp; }
88cf500f-f075-4c99-be15-77a3480aec54
2
public void applySortConfig(String config) { int result = applySortConfigInternal(config); if (result == 0) { notifyOfSortCleared(); } else if (result == 1) { sort(); } }
4376fa8e-4582-431f-8a0b-b8d4aa303d98
3
@SuppressWarnings("unchecked") @Override public double getScore(Object userAnswer) { if (userAnswer == null) return 0; String ans = (String) userAnswer; ArrayList<String> trueAns = (ArrayList<String>) answer; for (int i = 0; i < trueAns.size(); i++) { if (trueAns.get(i).equals(ans)) return score; ...
57d1ce6f-cb71-42e3-9ccb-dfecc28dfb81
2
private String[] letterPairs(String word) { String[] result = new String[0]; int numPairs = word.length() - 1; if (numPairs > 0) { result = new String[numPairs]; for (int letterCounter = 0; letterCounter < numPairs; letterCounter++) { result[letterCounter] = word.substring(letterCounter, letterCou...
f8eb12fd-fb99-44dd-b4e4-11265f9a0593
1
public int deleteUser(String userID) { try { // Erforderlicher SQL-Befehl String sqlStatement = "DELETE FROM bookworm_database.users WHERE id = " + userID + ";"; // SQL-Befehl wird ausgeführt successful = mySQLDatabase.executeSQLUpdate(sqlStatement); return successful; } catch (Exception e) ...
a793ec8e-051d-426d-85ae-2458d0076939
4
public int compareTo(Instruction instr) { if (addr != instr.addr) return addr - instr.addr; if (this == instr) return 0; do { instr = instr.nextByAddr; if (instr.addr > addr) return -1; } while (instr != this); return 1; }
73c41b13-b843-4d08-8846-07251e5ef131
8
@Override public String toString() { String s = getSignature(); for (String perm : permissions) s += " " + perm; if (this.isSource || this.isSink || this.isNeitherNor) s += " ->"; if (this.isSource) s += " _SOURCE_"; if (this.isSink) s += " _SINK_ "; if (this.isNeitherNor) s += " _NONE_";...
9bb3d6eb-7e4e-4a69-a822-9bc2f4f680ac
3
@Override public void postInfo() { //before the beginning of the game get all players to rotate and 'find' all of the //in game components if(playMode == PlayMode.BEFORE_KICK_OFF){ canSeeNothingAction(); }else if(playMode == PlayMode.CORNER_KICK_OWN || playMode == PlayMod...
46267ba6-4ea0-488d-9515-debe0bb78c4a
5
public void merge(int A[], int m, int B[], int n) { int j = m-1; int k = n-1; for (int i =m + n -1 ;i>=0;i--) { if (j >=0 && k >=0) { if (A[j] >= B[k]) A[i] = A[j--]; else A[i] = B[k--]; } else if (j >=0) A[i] = A[j--]; else A[i] = B[k--]; } ...
bdd6b8af-08ff-49a1-bc15-1138dda3df13
0
public void animate() { Timeline mainAnimation = new Timeline(); mainAnimation.getKeyFrames().addAll( new KeyFrame(Duration.millis(0), new KeyValue( glow.radiusProperty(), 1d)), new KeyFrame(Duration.millis(5000), new KeyValue(glow .radiusProperty(), 13d)), new KeyFrame(Duration.millis(1000...
76814562-fb32-4070-913f-d87bb3743ce5
7
private void initMap() { int[] moves = { 0,-1, 1,0, 0,1, -1,0 }; for( int i = 0; i < 11; i++ ) { for( int j = 0; j < 11; j++ ) { Point currentPos = new Point( i, j ); ArrayList<Point> nextPoss = new ArrayList<Point>(5); nextPoss.add( currentPos ); for( int p = 0; p < 8; p = p + 2 ) { Point n...
bdb1a335-4ba4-4e3f-92c8-1e55b60a4737
4
@Override public boolean equals(Object obj) { if (this == obj) return true; else if (obj == null || obj.getClass() != this.getClass()) return false; CoordXZ test = (CoordXZ)obj; return test.x == this.x && test.z == this.z; }
22cf5a54-0e73-4e53-b18c-ae5e5303d3cc
7
public void tick() { super.tick(); if(lifetime > 0) { lifetime--; } else { remove = true; } for(Entity e : level.entities) { if(this != e) { ...
cef61a05-9364-49fe-af73-cf183970ddf7
8
public void init() { if (el.winwidth==0) { // get width/height from applet dimensions el.winwidth=getWidth(); el.winheight=getHeight(); } initCanvas(); if (!el.view_initialised) { exitEngine("Canvas settings not initialised, use setCanvasSettings()."); } if (!i_am_applet) { jre.createWindow(t...
e8c38d7b-a166-4017-af81-f6190c57b2ec
8
protected boolean meetsCriteria(Entity e) { boolean works = true; if(requiredComponents != null) for(Class<? extends Component> comp : requiredComponents) { if(!e.has(comp)) works = false; } if(bannedComponents != null) for(Class<? extends Component> comp : bannedComponents) { if(e.has(comp...
0b71ecd6-d74a-47d4-a9f2-7fa6ba35ade5
9
@Override public boolean equals(Object o) { if (! (o instanceof PoliLine)) { return false; } Iterator<Point> other = ((PoliLine) o).iterator(); boolean started = false; Iterator<Point> me = this.iterator(); if (! me.hasNext()) { return (! other.hasNext()); } Point otherFirst = other.next...
0471d22e-fc0c-4ed7-8bfc-d326a779a3a1
3
public void addRoute(String path, Callback callback) { URI uri; try { uri = new URI(path); } catch (URISyntaxException e) { throw new IllegalArgumentException("invalid URI format of parameter `path`"); } if (!TextUtils.isEmpty(uri.getScheme())) { ...
2fc4a2fa-f8e3-49ca-aa3e-97b53aa071ad
8
final void method3983(int i, int i_63_, int i_64_, boolean[][] bools, boolean bool, int i_65_) { anInt5151 = -1; int i_66_ = 0; float[] fs = new float[aClass262_5149.getSize(0)]; for (Class348_Sub1 class348_sub1 = (Class348_Sub1) aClass262_5149.getFirst(4); class348_sub1 != null; class348_sub1 ...
f9df3afe-adca-4b81-a659-74eeeb7c0613
1
public String getDbProperty(String key) { Properties properties = new Properties(); try { FileInputStream fileInputStream = new FileInputStream( getClass().getClassLoader().getResource(".").getPath() + File.separator + "resources" + File.separator + DB_CONFIGURATION_FILE); properties.load(...
12945ad8-2232-4567-bdb7-17ee51667c6c
1
public static void deleteCustomer(Integer ID) { Database db = dbconnect(); try { String query = "UPDATE customer SET bDeleted = 1 " + "WHERE CID = ?"; db.prepare(query); db.bind_param(1, ID.toString()); db.executeUpdate(); db.close(); } catch(S...
350c39d9-49ce-434c-971d-0cc2600c85d2
2
public Matrix4f mul(Matrix4f r){ Matrix4f res = new Matrix4f(); for (int i = 0; i < 4; i++){ for (int j = 0; j < 4; j++){ res.set(i,j,m[i][0] * r.get(0,j) + m[i][1] * r.get(1,j) + m[i][2] * r.get(2,j) + ...
553578b1-1dee-4425-8f1d-26b18df6e22d
9
public static void main(String[] args) { Scanner Terminal = new Scanner(System.in); Scanner Terminal2 = new Scanner(System.in); int choice1; int choice2; int pin = 0; int pinCheck; double balance = 0; double deposit; double withdrawal; String firstName = null; String lastName = null; System.o...
6fa45866-f456-4a65-af89-36f278ba1786
3
public final EsperParser.vartype_return vartype() throws RecognitionException { EsperParser.vartype_return retval = new EsperParser.vartype_return(); retval.start = input.LT(1); Object root_0 = null; Token set44=null; Object set44_tree=null; try { // C:\\...
10a79435-ac0c-412e-98a3-1a83126ddd34
4
static String getPlatformFont() { if(SWT.getPlatform() == "win32") { return "Arial"; } else if (SWT.getPlatform() == "motif") { return "Helvetica"; } else if (SWT.getPlatform() == "gtk") { return "Baekmuk Batang"; } else if (SWT.getPlatform() == "carbon") { return "Arial"; } else { // photon, etc ... ...
a2754649-4b50-4017-8c6e-ff46541d0bd2
6
public final Token readToken() { while (this.position < this.expression.length()) { if (Character.isWhitespace(this.expression.charAt(this.position))) ++this.position; else break; } if (this.position == this.expression.length()) ...
ec5e7324-caa6-4c96-a76e-b500a32e336e
0
public int[] getAlpha() { return alpha; }
6169cb11-93dc-46a7-a60e-69324d5f0d8c
4
public void test_02() { String args[] = { "-v"// , "-noStats" // , "-i", "vcf", "-o", "vcf" // , "-classic" // , "-onlyTr", "tests/filterTranscripts_02.txt"// , "testHg3765Chr22" // , "tests/test_filter_transcripts_001.vcf" // }; SnpEff cmd = new SnpEff(args); SnpEffCmdEff cmdEff = (Sn...
1d0d2395-7f19-4575-a5aa-57b59313c9a7
7
private void selectNextItem() { int i = 0; boolean selectNext = true; while(i<elements.size() && (! elements.get(i).isSelected()) ) { i++; } if (i<elements.size()) { if (elements.get(i) instanceof AxesElement && ((AxesElement)elements.get(i)).isXSelected()) { ((AxesElement)elements.get(i)).setSelec...
185a9373-ec0a-483c-9b1e-8aaaf110dfbc
8
public void processMsg(ServerMsg m) throws IOException{ String tag = m.getTag(); tag = tag.trim(); threadMessage("Processing Msg " + m.srcID + " " + m.destID + " " + m.tag + " " + m.getMessage()); //Messages received as worker if(tag.equals("job_init")){ //set server worker ob...
3a2a75ac-057a-4d1a-8fea-2e8f3afcbbd6
0
public playerDataSave(CreeperWarningMain plugin) { this.plugin = plugin; this.dir = new File(plugin.getDataFolder() + File.separator + "Players"); this.type = new File(plugin.getDataFolder() + File.separator + "Players" + File.separator + path + ".data"); }
d0cf2765-b7aa-4e8e-afa1-88a554dd5235
0
public void run(){ sort(); }
4dbdb144-a150-4583-9d68-0d52dba52bba
8
private void method362(int i, int ai[], byte abyte0[], int j, int k, int l, int i1, int ai1[], int j1) { int k1 = -(l >> 2); l = -(l & 3); for(int l1 = -i; l1 < 0; l1++) { for(int i2 = k1; i2 < 0; i2++) { byte byte1 = abyte0[i1++]; if(byte1 != 0) ai[k++] = ai1[byte1 & 0xff]; els...
ffa7a0ae-902c-4da7-baab-6dabed75b87a
5
public JMenu getFileMenu(){ JMenu file = new JMenu("File"); file.setMnemonic('F'); JMenuItem open = new JMenuItem("Open project"); open.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser fileChooser = new JFileC...
5fb4cfc4-2123-4520-8a60-ed6141023327
0
public void setIdPerfil(Integer idPerfil) { this.idPerfil = idPerfil; }
5129d430-8ae5-4f34-8355-6177fa424833
1
private static boolean insertEmployee(Employee bean, PreparedStatement stmt) throws SQLException{ stmt.setString(1, bean.getName()); stmt.setString(2, bean.getUsername()); stmt.setString(3, bean.getPass()); stmt.setDate(4, bean.getDob()); stmt.setString(5, bean.getPhone()); stmt.setString(6, bean.getAddr...
faf025a8-480e-4614-9233-4f07136a9042
9
public int compare(boolean[] class_list, int datapoint) throws BoostingAlgorithmException{ int c; int class_index = -1; int classification = -1; //determine what class in the classlist the datapoint has for (c = 0; c < classes; c++) { if (data.classes[datapoint].equals(data.classlist[c])) { class_index...
6b3c2fae-10b1-4f0f-988c-7ff9677e308d
1
@Override public Class<?> getDataType() { return superType.getDataType(); }
6d86643a-166b-4026-bfeb-f058162ce8f5
4
public void run() { while (this.running) { this.tickCount += 1L; if (this.tickCount % 500L == 0L) { System.gc(); Debug.println("gc() called, freeMemory(): " + Runtime.getRuntime().freeMemory()); } this.timestamp = System.currentTimeMillis(); tick(); l...
96489fac-c2f3-4703-8b3c-e5960dd840e4
0
public int getLength(){ return dataBaseFiles.size(); }
8b119d37-82f0-4849-af62-c5f641fd7076
3
public void paint(Graphics g) { if (first != null && current != null) { ((Graphics2D) g).setStroke(new BasicStroke(lineWidth)); g.setColor(lineColor); Rectangle rect = current.getRectangle(); if (rounded) { g.drawRoundRect(rect.x, rect.y, rect.width, rect.height, 8, 8); } else { g....
3806a3b3-a970-4f75-88cf-4a9e16e7c2fe
0
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { in.defaultReadObject(); // Reset those transient listener guys. listeners = new HashSet(); }
b590b68e-63b5-4ba5-9790-eab659380e74
8
public void create(Workstation workstation) throws PreexistingEntityException, RollbackFailureException, Exception { if (workstation.getComputadoraCollection() == null) { workstation.setComputadoraCollection(new ArrayList<Computadora>()); } EntityManager em = null; try { ...
3b953b51-1655-4dc9-b720-88c4317136b0
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Fraction other = (Fraction) obj; if (denominator == null || other.denominator == null) return false; if (numerator == null || other.numerator == null)...
6297eec8-e220-4d96-b73a-b4883ad4063d
5
public static void main(String args[]){ String frase1 ; String frase2 ; int tamano1,tamano2; frase1 =JOptionPane.showInputDialog(null,"Ingrese una frase","Frase 1",JOptionPane.QUESTION_MESSAGE); frase2= JOptionPane.showInputDialog(null,"Ingrese otra frase","Frase 2",JOptionPane...
21a7e516-4f1b-4616-962d-f05c8248e50e
3
private void moveOutgoingArcs( Node from, Node to ) throws MVDException { while ( !from.isOutgoingEmpty() ) { Arc a = from.removeOutgoing( 0 ); to.addOutgoing( a ); } // check if node is now isolated if ( from.indegree()==0&&from.outdegree()==0 ) from.moveMatches( to ); }
7209f0ca-9b0e-4558-a407-9ea75b89b400
6
protected String addParameters(String path, Map<String, String> parameters) { if (path == null) { path = ""; } StringBuffer sb = new StringBuffer(path); if (parameters != null && parameters.size() > 0) { try { boolean hasParameters = path.indexOf("...
99f78391-af05-4cdc-8fdc-2dbf0dcdbbdf
5
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Object convert(Object oldObject, String property) { Object result = oldObject; Class<?> type = propertyTypes.get(property); if (type.isEnum()) { result = Enum.valueOf((Class<Enum>) type, (String) oldObject); } if (type.equals(BigInteger.class)) { ...
1d6dca35-232f-4172-931f-c14e56753f09
9
@Override public boolean validate(String str) { try { String[] data = str.split(","); if (data.length < 3 || data.length > 3) return false; if (!data[0].equals("oo") || !data[0].equals("-oo")) Double.parseDouble(data[0]); if (!data[1].equals("oo") || !data[1].equals("-oo")) Double.parseDouble...
96b9975f-d9c3-465c-9e89-8d40fa3384f9
1
@Override public void startOutline () { // initialize the current node to the root node of the outline this.currentNode = tree.getRootNode(); // clear out any existing children. while (currentNode.numOfChildren() > 0) { currentNode.removeChild(currentNode.getLastChild()); } // end while // set the...
85d415d2-98bf-49a1-bcd0-3067d3385880
1
public void removeState(State state) { if (this.states.contains(state)) { this.states.remove(state); state.setTray(null); } }
9383ffb6-d389-456f-924d-d76717d4662f
2
void setDomParent(final Block block) { // If this Block already had a dominator specified, remove // it from its dominator's children. if (domParent != null) { domParent.domChildren.remove(this); } domParent = block; // Add this Block to its new dominator's children. if (domParent != null) { domPa...
4f53b4ae-1be9-4da9-98de-f287db36b36b
1
public ResultSet getList(String whereString) { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Question_ID,QType_ID"); sql.append(" FROM `Question`"); if (whereString.trim() != "") { sql.append(" where " + whereString); } SQLHelper sQLHelper = new...
5eeeafce-e581-47fb-ba08-efa4c15123d3
4
public void run() { String buffer; while (this.isActive()) { try { while ((buffer = in.readLine()) != null) { handleReceivedData(buffer); if (dataQueue.length() > 0) { out.write(dataQueue); ...
ce5271c2-1821-46c1-b3bf-a77da068a2c3
9
public void run() { PokerState currentState = new PokerState(); while( scan.hasNextLine() ) { String line = scan.nextLine().trim(); if( line.length() == 0 ) { continue; } String[] parts = line.split("\\s+"); if( parts.length == 2 && parts[0].equals("go") ) { // we need to move PokerMove move = b...
01af00b4-22a5-40f3-bd00-6eb095dc4184
5
private void fillZipEntries(int nr) { Enumeration zipEnum = zips[nr].entries(); zipEntries[nr] = new Hashtable(); while (zipEnum.hasMoreElements()) { ZipEntry ze = (ZipEntry) zipEnum.nextElement(); String name = ze.getName(); // if (name.charAt(0) == '/') // name = name.substring(1); if (zipDirs[nr...
5ff63d91-bdb3-40aa-aeca-f3977854e800
1
public void draw() { for(int x = 0; x<mapTiles.size(); x++) { mapTiles.get(x).draw(); } }
c2e53c05-7ec2-4091-843c-874e1e6ac1b3
3
@Override public boolean update(DataRow parameters, DataRow row) { Boolean flaga = false; String stm; String tabelName = row.getTableName(); List<DataCell> cells = row.row; List<DataCell> toUpdate = parameters.row; ...
f9ea914c-ae98-4500-9d5d-830828d31623
3
T select(T a[], int r, int i, int j) { int n = a.length; int pIndex = findPivot(a, i, j); int k = new QuickSorter<T>().partition(a, i, j, pIndex); int rPivot = n - k + 1; if (r == rPivot) return a[r]; else if (r < rPivot) return select(a, r, k + 1, j); else if (r > rPivot) return select(a, r - ...
60d07a42-faed-47e5-a751-5dd15f6f2260
9
private void backTrackingAfter3() { FeatureGenerator fg=new FeatureGenerator(); double result=0.0; String antFeature=featureModelBruteForce; double difference=0.0; //ADD FEATURES TO THE POOL. //If we have 3... // {f1,f2,f3} => { {f1},{f2},{f3},{f1,f2},{f1,f3},{f2,f3},{f1,f2,f3} } // ArrayList<S...
c391fa5c-ea15-4d66-a2a4-a423de9aaa44
9
public static boolean validate(Stack<Character> p, char k) { Iterator<Character> it = p.iterator(); ArrayList<Character> list = new ArrayList<Character>(); ; while (it.hasNext()) { list.add(it.next()); } int index = -1; for (int i = 0; i < list.size(); i++) { if (list.get(i) == index) { index = ...
9f72f502-0459-48bf-ba70-f4bf18a2e0fd
9
public void doPaletteStuff() { int palette; //byte[] pal; int cnt; int bzc; cnt = plyr.damagecount; if (plyr.powers[pw_strength] != 0) { // slowly fade the berzerk out bzc = 12 - (plyr.powers[pw_strength] >> 6); if (bzc > cnt) ...
86ee2cdf-0a51-489a-b938-5fd69b632bb0
1
protected void addGlied() { if (nextGlied == null) { //create/add new glied Rectangle newMasse = (Rectangle) getBounds().clone(); newMasse.x -= getDirection().x * width; newMasse.y -= getDirection().y * height; SchlangenGlied newGlied = new SchlangenGlied(newMasse, unit, Zufallsgenerator.zufallsFar...
0d5ba632-3b16-43a8-9065-ea4598ddb4ed
8
public String [] getOptions() { // Currently no way to set custompropertyiterators from the command line m_UsePropertyIterator = false; m_PropertyPath = null; m_PropertyArray = null; String [] rpOptions = new String [0]; if ((m_ResultProducer != null) && (m_ResultProducer instanceof Opt...
d795399f-01f7-4ee7-9a07-20db921c8f3b
9
private void parseInstruction(Program program) { // Parse mnemonic (easy) String mnemonic = tokenizer.next().text; // Parse operands (hard) List<Operand> operands = new ArrayList<Operand>(); boolean expectcomma = false; while (!tokenizer.check(TokenType.NEWLINE)) { if (!expectcomma) { if (tokenize...
4ffcad40-7d72-4d6f-b345-b6ee94c8eaf3
7
public boolean setStance(Player player, Stance newStance) { if (player == null) { throw new IllegalArgumentException("Player must not be 'null'."); } if (player == this) { throw new IllegalArgumentException("Cannot set the stance towards ourselves."); } if...
4a168ca4-139f-493d-9541-09055e0aedca
7
private double minDist(Freckle[] freckles) { double minDistance = 0; boolean[] inTree = new boolean[freckles.length]; double[] minDists = new double[freckles.length]; for (int i = 0; i < freckles.length; i++) { minDists[i] = Double.MAX_VALUE; } int newNode = ...
d8dafc0c-ca91-44a4-a19f-50548a43dee9
5
protected void rmBus (Object busname) { USB bus = (USB) busses.get (busname); if (bus != null) { if (trace) System.err.println ("rmBus " + bus); for (int i = 0; i < listeners.size (); i++) { USBListener listener; ...