method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
83c238d8-fc41-4643-a854-2a8ace3e19f8
3
private void ensureXrefEntriesCapacity(int size) { if (xrefEntries == null || xrefEntries.length < size) { final PDFXrefEntry[] newXrefEntries = new PDFXrefEntry[size]; if (xrefEntries != null) { System.arraycopy(xrefEntries, 0, newXrefEntries, 0, xrefEntries.length); ...
6e18fd9d-d358-4fa5-9442-f9548952ec32
8
public static BigInteger combination(BigInteger poolI, BigInteger chooseI) { if(poolI.compareTo(BigInteger.ZERO)<0||chooseI.compareTo(BigInteger.ZERO)<0){ throw new ArithmeticException("Cannot take combinations of negative numbers"); } if(poolI.compareTo(chooseI)<0){ return BigInteger.ZERO; } if(cho...
2875e329-1bdd-403d-8086-515a89f21c55
2
public void share (CompNumb p); // Деление
10e8f9a5-72c6-44cd-8f3c-0a02da4ec3ce
1
public Transition(String transition, State next, int pointer){ String params[] = transition.split("->"); this.right = params[1].split(" "); this.next = null; if(this.right.length > pointer){ this.next = next; this.reduction = -1; } else{ this.reduction = getReductionId(); } }
9a81060e-427c-4149-b728-7154778026b4
8
@Override protected void readAll(List<Address> members, String clustername, Responses responses) { try { List<String> objects = swiftClient.listObjects(container); for(String object: objects) { List<PingData> list=null; byte[] bytes = swiftClient.readO...
afbb3274-f952-4bbd-9793-5ba6aecc9892
5
public int getResult(){ int returnValue = 7, c = this._qtdConsumo; int aux =0; if(c>11){ aux = (c<30)?c:30; returnValue += ((aux-11)+1)*1; }//END IF if(c>31){ aux = (c<100)?c:100; returnValue += ((aux-31)+1)*2; }//END IF if(c>101){ returnValue += ((c-101)+1)*5; }//END IF return returnVa...
de839a54-4192-4787-b7de-f78cf0d827aa
0
public ComboBoxListener(JComboBox box, Preference pref) { setComboBox(box); setPreference(pref); }
941014b2-aa7b-4828-9f75-20d35f53dccc
8
private String sqlTypeToJavaType(int columnType) { if (columnType == java.sql.Types.INTEGER) { return "int"; } else if (columnType == java.sql.Types.VARCHAR || columnType == java.sql.Types.CHAR) { return "String"; } else if (columnType == java.sql.Types.TIMESTAMP) { ...
2f721cb4-6712-4125-8155-fcbf7fc39734
9
public static void retofinv_draw_foreground(osd_bitmap bitmap) { int x, y, offs; int sx, sy, tile, palette, flipx, flipy; for (x = 0; x < 32; x++) { for (y = 30; y <= 31; y++) { offs = y * 32 + x; sx = ((62 - y) + 3) << 3; sy = (31 - ...
5aafb317-5dd9-47ae-90bc-ed4588936033
2
public int generateX(int i, int j) { double mu = 0.0; mu += _parameters.visibleBias(j); for (int jj = 0; jj < _parameters.numHiddenNodes(); jj++) { mu += _parameters.weight(j, jj) * generatedHiddens[i][jj]; } mu = MathUtilities.sigmoid(mu); if (random.nextDouble() >= 1 - mu) { return 1; } else { ...
dc8aeac7-9cd6-4f26-a702-c7fcea33dc08
7
public static void paint(Ocean sea) { if (sea != null) { int width = sea.width(); int height = sea.height(); /* Draw the ocean. */ for (int x = 0; x < width + 2; x++) { System.out.print("-"); } System.out.println(); for (int y = 0; y < height; y++) { System...
c4619f21-7386-4316-acdb-b39be633cbc5
6
private String getTabReplacement(int x) { int align = 0; switch(this) { case CONVERT_TO_ONE_SPACE: return " "; case CONVERT_TO_FOUR_SPACES: return " "; case CONVERT_TO_EIGHT_SPACES: return " "; case...
1953e62c-81aa-4f18-90f4-83bdea5a9275
6
public void run(){ while(true){ synchronized(this.doc){ //For each game under the games_available node, check to see if all the player ready states are true. //If they are all true, move the game to the games_active node. if(((Element)this.doc.getElementsByTagName("games_available").item(0)).getChildNo...
e41af00b-6eed-4bcd-9e39-15c30b4f070b
8
public void update() { speed = potentialSpeed; setWanDirCommand(commandLeft, commandRight, commandUp, commandDown); if(commandC4) placeC4(); if(cacheraufond) canard.play(); //if(cacheraufond) bouftou.play(3, 1); if(commandTrap) placeTrap(); if(commandBomb) placeBomb(); if(!unde...
a57b9232-3158-4dbd-9ed6-9f5c584ab4e9
6
protected String getClasspath() throws MojoExecutionException { try { final List classpath = new ArrayList(); // Loading self dependencies final List scopesToUse = new ArrayList(); scopesToUse.add(Artifact.SCOPE_COMPILE); scopesToUse.add(Ar...
66b86a19-46b9-4a28-9b75-d52cffa6e0f9
2
protected boolean readBool(InputStream in) throws IOException { int i = readInt(in); if( !(i==1 || i==0) ) throw new RuntimeException("Not a bool: " + i); return i == 1; }
4e0b1f8c-c4a5-4b21-a19c-33788acc3cd5
2
public static final void helloWorldExample() { try { CycConstant planetInSolarSystem = (CycConstant) DefaultCycObject.fromCompactExternalId("Mx4rWIie-jN6EduAAADggVbxzQ", access); CycList planets = access.getAllInstances(planetInSolarSystem); for (Object planet : planets) { System.out.print...
a23bc05d-2624-413f-8f4d-ec45d30cab40
2
private String readUrl(final String url) { try { String inputLine, output = ""; BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(url).openStream())); while ((inputLine = reader.readLine()) != null) { output += inputLine; } reader.close(); return output; } catch (I...
791e20e4-a1aa-441e-bd1d-e87944615614
5
private int neighborHasBomb(int neighbor_x, int neighbor_y) { // checks a neighboring square for a bomb. If it doesn't have a bomb or // doesn't exist // it returns 0. Otherwise it returns 1 if (neighbor_x < 0 || neighbor_x > 9 || neighbor_y < 0 || neighbor_y > 9) return 0; if (field[neighbor_x][neighb...
a7ce852b-87ec-4387-813c-f40e18fcde17
9
public void MenuRun() throws Address_Table.TableException, Orders_Table.TableException, Items_Table.TableException { data_load = new DataLoad(); data_load.load_data(); repeat_choice = false; while(repeat_choice == false) { print_menu(); try { BufferedReader brin = new B...
07696bf4-340e-4cae-aa88-4528d0850344
0
private String changeCharacterAtPosition(int pos, String str, String rep) { String alteredString = str.substring(0, pos) + rep + str.substring(pos + 1, str.length()); return alteredString; }
0efd4985-3af2-4508-bc29-4a7645bf43b3
6
private static void printUsage(Command command) { if (command == Command.UNKNOWN) { StringBuilder sb = new StringBuilder(); sb.append("Usage: StaffUtill <command> <arguments> ") .append("\n") .append("command: arguments :") .appen...
651261fb-356e-4b53-b448-f36cddc4b085
2
private void generateCharDimensions() { Graphics2D g2 = (new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB)).createGraphics(); g2.setFont(font); for (int i = 0; i < characterDimensions.length; i++) { characterDimensions[i] = font.layoutGlyphVector(g2.getFontRenderContext(), S...
b2c2542b-e130-421d-b731-6342dab4d3f9
0
@RequestMapping(value="/{tripID}/deleteTravelTrip", method=RequestMethod.GET) public String deleteTravelTrip(@PathVariable("tripID") String tripID, Model model){ travelTripService.delete(Integer.parseInt(tripID)); model.addAttribute("travelTripList", travelTripService.findAll()); ...
b2842b88-9dc8-47ad-8b24-bffbce5055ae
2
public static void setPlayersNickname( String p, String nick ) throws SQLException { if ( isPlayerOnline( p ) ) { getPlayer( p ).setNickname( nick ); getPlayer( p ).updateDisplayName(); getPlayer( p ).updatePlayer(); } if ( nick == null ) { SQLMana...
4d98b041-2b24-4cb9-8930-a2a34ecd1122
8
public Tile getTileByIntExp(int t_i) { if (t_i < 0) return null; else if (t_i < 4) return _t.get(new BoardCoordinate(3 + t_i, t_i, -3)); else if (t_i < 9) return _t.get(new BoardCoordinate(t_i - 2, t_i - 4, -2)); else if (t_i < 15) return _t.get(new BoardCoordinate(t_i - 8, t_i - 9, -1)); else if (t_i < 22) r...
2acb045f-639a-427e-a274-f74b86f2b986
0
protected void execute() {}
79078d03-cfbf-4f66-ac8f-b299597ee9a3
9
@Override public List<Car> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String,String> filters) { List<Car> data = new ArrayList<Car>(); //filter for(Car car : datasource) { boolean match = true; for(Iterator<String> it = ...
aaa1bd57-4705-43a8-bc59-de69df489fb2
6
public static void main( String[] args ) { // Create game window... JFrame app = new JFrame(); app.setIgnoreRepaint( true ); app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); // Create canvas for painting... Canvas canvas = new Canvas(); canvas.setIgnoreRepa...
739f8564-5d5e-44b3-a24b-f1779e27274a
7
public boolean wordContainsLettersInOrder(final LetterGen letGen, final String word) { final char[] a = word.toCharArray(); final char[] test = new char[a.length]; for(int i=0; i < a.length; i++){ test[i] = Character.toLowerCase(a[i]); } int i = 0; char temp = Character.toLowerCase(letGen.getLetter1()); w...
0b44c3ef-c8a6-4322-abb5-13a6d040d121
5
private void resize() { width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (width > 0 && height > 0) { if (aspectRatio * width > height) { width = 1 / (aspectRatio / height); } else if (1 / (aspectRatio / height) > width) { ...
24eeb0e7-1e25-4b25-8446-ff78109b15ca
7
@Override public void draw(Graphics g, Display d, int bottomPixelX, int bottomPixelY, boolean drawHealth){ double percentMoved = count * 0.25; // Tile coordinates of The Dude (x,y) double x, y; if(attacking == null) { x = this.oldX + (this.x - this.oldX) * percentMoved; y = this.oldY + (this.y - thi...
43eaaf0a-7579-4d33-b9aa-fc6b46551eb4
8
private static String ConvierteTodo(String s, Tipo t) { StringBuilder resultado = new StringBuilder(); int cuenta = s.length(); int cuentamillones = 0; while (cuenta > 0) { int inicio = (cuenta - 6 >= 0) ? (cuenta - 6) : 0; int longitud = (6 > cuenta) ? cuenta : 6...
ecd6d7a0-5756-4c37-86be-6873d3a25be6
1
@Override public int commit() { int allNew = 0; writeLock.lock(); try { for (int i = 0; i < 256; ++i) { allNew += files[i].getNewKeys(); files[i].commit(); } } finally { writeLock.unlock(); } return ...
6cf397af-5541-41c2-8d51-3660e5c4e59c
1
public final boolean wasStarted() { return myServerSocket != null && myThread != null; }
2865095c-786b-4b14-973f-e031e29eb11d
2
private static <T> T getSingleDefault(T[] params, T default_value) { //assert params.length == 1; T value = default_value; if (params != null && params.length > 0) value = params[0]; return value; }
4d39dff4-9ed6-4adf-93fd-2c173adfe8a7
8
public void Asearch(Point startPoint, Point goalPoint){ String start = startPoint.x + " " + startPoint.y + " " + "0"; String goal = goalPoint.x + " " + goalPoint.y; target = goal; openset.add...
b38fde69-a5eb-44a0-bf18-30a60abff051
3
public Link(long from_id, long to_id, int length, int lsiclass, int maxspeed) { this.from_id = from_id; this.to_id = to_id; this.length = length; int lsiSpeed = 0; try { lsiSpeed = LSISpeed.getSpeedById(lsiclass); } catch (Exception e) { System.out...
5663d070-026e-41a0-a2d5-fa4d56b57711
5
protected static Ptg calcTrend( Ptg[] operands ) throws CalculationException { if( operands.length < 1 ) { return new PtgErr( PtgErr.ERROR_VALUE ); } // KSC: THIS FUNCTION DOES NOT WORK AS EXPECTED: TODO: FIX! if( true ) { return new PtgErr( PtgErr.ERROR_VALUE ); } // Ptg[] forecast = new Ptg[3]; ...
4e3c19c5-ffbd-43bc-ae92-ca18c985f666
9
public void update() { renders.clear(); stringRenders.clear(); String playerId = session.getCurrentPlayerId(); if (startTimer > 0) { startTimer--; if (startTimer > 60) { StringRender string = new StringRen...
bafb59b4-faf8-4489-935f-8bbb85a76d1c
9
public ListNode detectCycle(ListNode head){ ListNode fast = head; ListNode slow = head; if(head == null || (head != null && head.next == null)){ return null; } while(fast != null && fast.next != null){ fast = fast.next.next; slow = slow.next; if(fast == slow){ break; } } if(fa...
7e6da542-bca5-4729-8b78-0d13cae58b78
0
@Override public void awardPoints(int amount) { points += amount; }
345416c1-539f-4836-b424-e0bb9f5db5be
8
public void deleteRoad(Point p1,Point p2){ Circle tmp1 = new Circle(p1); Circle tmp2 = new Circle(p2); int r1=-2,r2=-2; for (int i=0;i<pnts.length;i++) if (tmp1.equals(pnts[i])) r1 = i; for (int i=0;i<pnts.length;i++) if (tmp2.equals(pnts[i...
0bb732da-5083-4552-8830-aeb3b1e1c1ef
8
public void moveVolatile() { int count = volatileFlowGrid.getCount(); double waterDensityFloor = waterDensityGrid.getWaterDensityFloor(); double carbondioxideDensityFloor = carbondioxideDensityGrid.getCarbondioxideDensityFloor(); double sodiumDensityFloor = sodiumDensityGrid.getSodiu...
1850d593-16ff-4133-ab40-207ef44292ea
6
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if (l1 == null) { return l2; } else if (l2 == null) { return l1; } ListNode root = new ListNode(0); ListNode cur = root; while (l1 != null && l2 != null) { if (l1.val > l2.val)...
8d606f33-fbc0-42ce-92e8-f46d4b9d4601
7
public static List<Pair<Task,Recurrence>> getAllTasksForUser(int userId,int categoryId, CompletionType completionType,long startDateMilliseconds) { String queryString = "SELECT * from public.\"Task\" INNER JOIN public.\"Recurrence\" ON public.\"Task\".\"ID\" = public.\"Recurrence\".\"TaskID\" WHERE \"UserID\" =...
1bd57716-e3ed-4b0a-bc02-2a7f2ec238fa
3
public static String join(String separator, List<String> strings) { StringBuilder appendable = new StringBuilder(); if (strings != null && strings.size() > 0) { appendable.append(strings.get(0)); for (int i = 1; i < strings.size(); i++) { appendable.append(separator).append(strings.get(i)); } } ret...
9cd5e116-515b-4880-84b3-3315993b6aaf
6
private String filter(String str) { StringBuffer sb = new StringBuffer(); int i=0; while (str.charAt(i) == ' ') i++; if (isTag(str.charAt(i))){ sb.append(str.charAt(i)); i++; } else sb.append('+'); boolean zero = true; while (i < str.length()) { if (isDegit(str.charAt(i))) { if (!zero ...
190521bc-bf49-42c0-82a3-63482eb8b603
0
@Override public void windowIconified(WindowEvent arg0) { }
1061bc98-d35f-4958-b3ba-2797eb27b427
9
public void reparseChunkPrimitives(RandomAccessFile raff) throws IOException { if ((this.primitives == null) || (this.primitives.size() == 0)) { //nothing to do! return; } Primitive p = primitives.get(0).getPrimitive(); long oldsize = this.getDataEndPosition() - this.getDataStartPosition(); long pos =...
0cb4c577-f1fe-4463-926d-5e0563e59b7c
4
public static String selectOne(final String title, final String[] optionNames, final String[] optionValues, final int defaultOption) { if (optionNames.length != optionValues.length) { throw new IllegalArgumentException("option names and values must have same length"); } ConsoleMenu....
ceecb792-330d-4e73-84fe-a7cf51ce0591
4
@Override public void execute(VGDLSprite sprite1, VGDLSprite sprite2, Game game) { ArrayList<Integer> subtypes = game.getSubTypes(itype); for (Integer i: subtypes) { Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(i); if (spriteIt != null) while (spriteIt.hasNext()) {...
f14ed76b-d531-437c-bb81-246bd3c07aa6
4
public static int getJstatItem(List<JstatItem> jstatItemList, long timeStampMS) { if (jstatItemList == null) return -1; int beforeIndex = 0; int afterIndex = jstatItemList.size() - 1; for (int i = 0; i < jstatItemList.size(); i++) { JstatItem item = jstatItemList.get(i); if (item.getTimeStampMS() == ...
911677df-5fe5-4974-857e-87293f2990e9
4
public HashMap<String, Boolean> convertStringToHash2(String args) { HashMap<String, Boolean> pl = new HashMap<String, Boolean>(); if (args.equals(null) || args.length() < 1) return pl; String[] sp = args.split(","); try { for (int i = 0; i < sp.length; i++) { String a = String.valueOf(sp[i].split(":")[0]...
a1ebc633-769a-44f3-a7ea-1178bb5fa24c
8
public int getTwoDegrees(String performer1, String performer2) throws SQLException { LinkedList<String> select = new LinkedList<String>(); select.add("Performers"); LinkedList<String> from = new LinkedList<String>(); from.add("Videos"); LinkedList<Pair<String, String>> whereClaus...
7e85766a-3815-44c4-ae0d-ee7772b01434
8
private Gridspot findAdj(Gridspot a, Gridspot from) { if ( getG(a.getXIndex()-1,a.getYIndex()).getColor() == a.getColor() && getG(a.getXIndex()-1,a.getYIndex()) != from ) { return getG(a.getXIndex()-1,a.getYIndex()); } else if ( getG(a.getXIndex()+1,a.getYIndex()).getColor() == a.getColor() && getG(a.getXIn...
3659f936-4451-4252-a16e-2e9ba232278e
9
public void run() { try { boolean running = true; while (running) { try { String line = null; while ((line = _breader.readLine()) != null) { try { _bot.handleLine(line); ...
fd98876c-ee27-424f-a58c-c9248210ac04
2
private static void traverseDOT(Node n, BufferedWriter out) throws IOException { if (n.parent != null) { out.write(Integer.toString(n.nodeNum)); out.write(" -> "); out.write(Integer.toString(n.parent.nodeNum) + ";"); } for (Node child : n.children) { traverseDOT(child, out); } }
ea58db0e-2f07-4325-bdf5-ca2b138a730e
1
public ScoreDialog() { this.setTitle("Score - Jeu du Taquin"); this.setSize(500,350); this.setLocationRelativeTo(null); this.setResizable(false); this.setAlwaysOnTop(true); this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setIconImage(new ImageIcon("essources/Icons/icon.png").getImage()); ...
0173c0c3-3c93-4560-9a27-d7b70fd17075
2
public void testToStandardSeconds_months() { Period test = Period.months(1); try { test.toStandardSeconds(); fail(); } catch (UnsupportedOperationException ex) {} test = Period.months(-1); try { test.toStandardSeconds(); fa...
cd0e21c9-c808-4e3c-b936-a640f54a13c7
6
private void parseRangeNodes(Collection<ParameterNode> nodes) throws Exception { param_ranges = new HashMap<>(); for (ParameterNode p : nodes) { if (!p.isGroup()) { continue; } ParameterGroup g = (ParameterGroup) p; String value_name = g.getChild("valuename").getValueAsString(); float ...
7ec1bc2f-820d-4a7c-acfa-746a8af52755
0
public ResourceManager(GraphicsConfiguration gc) { this.gc = gc; loadTileImages(); loadCreatureSprites(); loadPowerUpSprites(); }
6f29a07e-64ce-4174-81b6-9059330763e2
3
public Messenger connect(String host, int port) { if (mMessenger == null) { Socket socket = new Socket(); try { socket.bind(null); socket.connect(new InetSocketAddress(host, port)); mMessenger = new Messenger(socket, mNotifyDisconnection); mMessenger.start(); } catch (IOException e) { try...
fb3a0988-4859-4bfb-b890-1801f1268e42
1
public char readChar() throws IOException { mark(DEFAULT_READ_LIMIT); int cfaslOpcode = read(); if (cfaslOpcode == CFASL_CHARACTER) { return (char) read(); } reset(); throw new RuntimeException("Expected a char but received opCode=" + cfaslOpcode); }
fcfc79d7-7c83-4907-8473-6073a1dff300
0
@Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { e.getCause().printStackTrace(); e.getChannel().close(); }
39d48863-4ce4-4290-905e-25f5ca698bac
3
private void btnSaveKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_btnSaveKeyPressed if (evt.getKeyCode() == 39) { btnClear.grabFocus(); } else if (evt.getKeyCode() == 38) { jPasswordField1.grabFocus(); } if (evt.getKeyChar() == evt.VK_ENTER) { btnSave.doClick(); ...
e7963110-bf89-460c-9f94-8cf4281a4f29
3
public void grabVideos(Collection<Integer, String> currentCollection) { videos.clear(); playingVideoKeys.clear(); //Iterator through the HashMap Iterator it = currentCollection.getMedia().entrySet().iterator(); while (it.hasNext()) { //Contains the key and the filePath to the video Map...
a3094eb4-a1d1-4728-b548-9c539e6b8d0b
5
public void TouchedByItem(Item item) { Item newItem = null; if (item.editable) { if (item.getClass().toString().endsWith("Sensor")) { Item newTarget = (Item) target.clone(); if (item.getClass().toString().endsWith("ContactSensor")) { newIte...
9eeb1ddb-765e-44b5-a423-d0690800c164
8
public static LinkedList<BasicBlock> enumerateLeafFirst(Function F){ Hashtable<BasicBlock, HashSet<BasicBlock>> targets = enumerateTargets(F); Hashtable<BasicBlock, HashSet<BasicBlock>> sources = enumerateSources(F); LinkedList<BasicBlock> ordering = new LinkedList<BasicBlock>(); LinkedList<BasicBlock> queue = ...
121db5a3-2987-4ba0-ac73-88ab9c483b03
8
static public void main(String[] args) { if(args.length == 0) { showHelp(); return; } boolean result = false; try { if(args[0].compareToIgnoreCase("-version") == 0) result = showVersion(); else if(args.length == 2 && args[...
3b23117f-4c74-40b1-8c3f-599e055e6093
8
public DIR turn(int d){ switch (this){ case N: if(d==0)return DIR.O; else return DIR.L; case S: if(d==0)return DIR.L; else return DIR.O; case L: if(d==0)return DIR.N; else retu...
c0e2b185-3b5f-4fc4-94e8-656a0ded5c5c
2
public synchronized void run(){ try { InputStream inputStream = cashSocket.getInputStream(); ObjectInputStream objectInputStream = new ObjectInputStream( inputStream); OutputStream outputStream = cashSocket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream( outpu...
29a5e398-bd2a-4528-a00f-51a161dfd9cd
5
public void decryptFile(File read, File write) { InputStream filein = null; InputStream in = null; OutputStream fileOut = null; try { cipher.init(Cipher.DECRYPT_MODE, getSecretKeySpec(encryptKey)); filein = new FileInputStream(read); fileOut = new File...
213dc66b-48c1-4d06-999b-8b198438d389
0
@Override public void setEmail(String email) { super.setEmail(email); }
d7bdc32e-5624-46ce-9c79-dc51d4ff8db1
2
public void setMinute(int m){ //checks to see if the integer we passed through //for minute is greater than or equal to zero but less //than 60 and if the requirements are met the value stays the same //but if they aren't, the value is set to zero. minute = ((m >= 0 && m<60) ? m : 0); }
1c3df7a9-7ee1-468f-ba9d-f6da4a324eae
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final PresentationItem other = (PresentationItem) obj; if (this.position != other.position) { retur...
cc532c04-435d-426f-ad46-3289a26c6dca
3
private void insertionSort(double[] input, int lo, int hi) { // Insertion sort for (int i = lo + 1; i < hi; i++) { for (int j = i; j > lo && Helper.less(input, j, j-1); j--) { Helper.exch(input, j, j-1); } } }
f9cacde7-05bd-4e3f-812a-9076abc27c47
2
public boolean verifyInventory(int productId, int inventoryChange) { try { Connection conn = openConnection(); Statement stat = conn.createStatement(); ResultSet rs = stat.executeQuery("select inventory from " + DB_PRODUCT_TABLE + " where rowid = " + productId + ";"); inventoryChange += rs.getInt("i...
1663480a-916c-4a4d-99f8-9112b9d87e90
0
private void setTextQuest(TextQuest quest, ArrayList answerList) { quest.setQuestAnswer(answerList); }
27afc6a4-95b9-49ce-a042-33351047d09d
3
public static void Gaussian(DMatrix points , Matrix mu, Matrix sig, Matrix max){ Matrix temp; temp = new Matrix(points.dimension(), 1); for(int i = 0; i < points.samplenum(); i++){ boolean checker = true; while(checker){ for(int j = 0; j < points.dimension();j++){ temp.set(j, 0, Math.random()); ...
6252b913-eab8-452f-b0f1-2162f3d09593
0
public Year getYearStored() { return yearStored; }
0e3e5f9a-215e-4b98-b68e-fb10959491a3
0
protected TableModel createModel(Transition transition) { final FSATransition t = (FSATransition) transition; return new AbstractTableModel() { public Object getValueAt(int row, int column) { return s; } public void setValueAt(Object o, int r, int c) { s = (String) o; } public boolean isCel...
6b3da3f5-e11d-4132-8ec9-51935cb54138
8
public void Analyze( double[] data ) { int length = data.length; n_max = 0; double[] cumSum = getCumulative_Sum(data); //Seems OK // for( int i = 0; i < cumSum.length; i++ ) // { // System.out.println( cumSum[i]); // } //System.out.println("ind = " + ind + "\n"); x_density[0] = 0; delta...
55cf9481-86de-460a-af20-6353324f0802
3
@Override public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark { //Find the row. int boardPositionRow = boardPosition / columns; //Find the column. int boardPositionColumn = boardPosition % columns; //Posit...
0af854f0-a86c-4cc7-963b-8aafcd4f88ae
0
public double[][] getMatrix() { return matrix; }
d07e92fd-7546-46df-9978-52b89e1897c5
7
public void mutate(){ nets=SpeciationNeuralNetwork.sort(nets); while(nets.size()<maxAllowed) // add individuals if there are too few nets.add(nets.get(0).copyAndMutate()); while(nets.size()>maxAllowed&&nets.size()>0) // remove individuals if there are too many nets.remove...
2cf5561a-f650-4460-8756-7d099e0c65e8
7
@Override public void pause() throws Exception { try { endpoint.pause(); } catch (Exception ex) { log.error(sm.getString("http11protocol.endpoint.pauseerror"), ex); throw ex; } canDestroy = false; // Wait for a while until all the processors are idle RequestInfo[] states = cHandler.global.getReque...
99e6e26a-5599-4031-94cd-a96ae897c87c
3
* The statement before which to add stmt. */ public void addStmtBefore(final Stmt stmt, final Stmt before) { if (Tree.DEBUG) { System.out.println("insert: " + stmt + " before " + before); } final ListIterator iter = stmts.listIterator(); while (iter.hasNext()) { final Stmt s = (Stmt) iter....
861a8d87-6ece-472e-981d-3ea51d1480ee
5
public void run() { try { this.ds = createDatagramSocket(); this.shutdown = false; } catch (final SocketException se) { return; } catch (final UnknownHostException uhe) { return; } final byte[] receiveData = new byte[SyslogConstants.SYSLOG_BUFFER_SIZE]; while(!this.shutdown) { try { fin...
1391ea31-51ee-469b-8b41-987a44985086
2
public static String nullToString(Object inString) { return (inString == null || "null".equalsIgnoreCase(inString.toString().trim())) ? "" : inString.toString(); }
378a1452-8c1e-4d66-9a61-d9888cb4b280
9
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } ValueObject other = (ValueObject) obj; if (firstName == null) { if (...
7182d053-724b-4be7-ad66-079674bc74dc
0
public void setPizzaBuilder(PizzaBuilder pb) { pizzaBuilder = pb; }
8242d81a-a7e2-4d34-af22-a6aa537c0ad4
2
public Matrix transpose() { Matrix mat = new Matrix(getHeight(), getWidth()); for (int x = 0; x < getWidth(); x++) { for (int y = 0; y < getHeight(); y++) { mat.data[y][x] = data[x][y]; } } return mat; }
ee27bb47-dc4d-4284-92e0-423dbb08edc3
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...
fbabb494-7b1e-4fed-86f5-4596d94b3e69
3
public Key delMax() { if (N == 0) throw new RuntimeException("Priority Queue Underflow"); Key max = pq[1]; // exch(pq, 1, N); pq[1] = pq[N]; // half exchange pq[N--] = null; sink(1); // resize if (N == pq.length / 4) pq = resize(pq, pq.length / 2); // keep track of min if (N == 0) minIn...
11ef6480-9ad1-487e-892d-4842a960408d
7
public static boolean visibleArgumentP(Stella_Object self) { if (self == null) { return (true); } if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PROPOSITION)) { { Proposition self000 = ((Proposition)(self)); if ((self000.kind == Logic.KWD_ISA) && ...
b7ea5b05-3627-40bc-a5e4-5967aa023472
1
public void paint(Graphics g){ g.drawImage(this.upgrade.getIcon(), 0, 0, null); if(upgrade.isUsed()){ g.setColor(Color.red); }else{ g.setColor(Color.black); } g.drawString(this.upgrade.getName(), 8, 18); }
2c7c6a01-0942-4601-8c4f-129e0904d59d
0
public String getBallColor() { return this.ballColor; }
e2a448bd-6e56-4370-9bcf-abcc4a24bc59
1
private Object getLastElement(final Collection c) { final Iterator itr = c.iterator(); Object lastElement = itr.next(); while (itr.hasNext()) { lastElement = itr.next(); } return lastElement; }
09ded98e-57cf-4171-8d8f-100709152e44
8
public void setTabu(S source, T target, int expireAfter) { /* Pre-checks */ if (expireAfter < 0) { return; } if (expireAfter > maxExpTime) { throw new IllegalArgumentException("expiration time not in [0.." + maxExpTime + "]"); } if ( source == nu...