method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7fd2c4a1-7a06-4183-9aa8-e91d5a377fe7
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Field field = (Field) o; if (!name.equals(field.name)) return false; return true; }
ffcb73b1-ec8e-4426-84af-b715e0a2d8a8
7
public void onScannedRobot(ScannedRobotEvent e) { // If we have a target, and this isn't it, return immediately // so we can get more ScannedRobotEvents. if (trackName != null && !e.getName().equals(trackName)) { return; } // If we don't have a target, well, now we do! if (trackName == null) { track...
70bec6c1-8553-4961-bcdc-f00a313139b5
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Point other = (Point) obj; if (x != other.x) { return false; } if (y != other.y) { return false; } return true; ...
b8912fd9-3c79-4f7a-9f5a-83218e81caec
6
private void displayPairs(String numberString, int sum) { int numPairs = 0; int[] numArr; int i; int frontPointer, backPointer; int tmpSum; String[] num = numberString.split(","); numArr = new int[num.length]; for (i = 0; i < num.length; i++) { numArr[i] = Integer.parseInt(num[i]); } fro...
09a39960-7eab-4b55-a003-c9eed440f05e
6
@Override public void execute() throws IOException { /* Get a list of all storage entries for content */ List<KademliaStorageEntryMetadata> entries = this.dht.getStorageEntries(); /* If a content was last republished before this time, then we need to republish it */ final long m...
a64c5bb7-6dc6-4fbb-85c0-d2307c19f6c1
4
public static Line parallelLine(Line current, CenterPosition centerPosition, int distanceOfView) { Position a = current.getA(); Position b = current.getB(); int distanceX = distanceOfView; int distanceY = distanceOfView; if (CenterPosition.DOWN.equals(centerPosition)) ...
49b78a17-70ba-415b-b168-a991a28e5152
6
public static boolean isIsotopeLabellingMethodParam(String accession) { return ITRAQ_QUANTIFIED.getAccession().equals(accession) || TMT_QUANTIFIED.getAccession().equals(accession) || O18_QUANTIFIED.getAccession().equals(accession) || AQUA_QUANTIFIED.getAccession()...
de04d441-55a2-45b7-93a9-db46f2338910
3
private PartnerListResponse typedPartnerList( final String hallEventIdStr, final String partnerRoleName ) { Boolean success = true; String errorMessage = null; List<Partner> partnerList = null; Long hallEventId = null; try { hallEventId = controllerUt...
5e133423-ec3f-4638-a025-17fc974f3d36
4
public static List<Pearson> getPearsonsFor(int userId, Map<Integer, Map<Integer, Pearson>> pearsons) { List<Pearson> list = new ArrayList<Pearson>(); for (Entry<Integer, Map<Integer, Pearson>> entry : pearsons.entrySet()) { if (entry.getKey() >= userId) { break; } if (entry.getValue().containsKey(userI...
24fc8834-a500-464c-91be-63375f0ded07
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Integer particulierId; Membre connecte = (Membre)request.getSession(false).getAttribute("connecte"); //on verifie que l'utilisateur est conn...
c2661072-7078-45a6-84f4-254db5e93b2e
8
public void buyer(List<String> itemsToBuy) { int itemsSeparate = 0; List<Integer> itemListSeparate = new LinkedList<>(); boolean items[] = new boolean[mapOfItems.size()]; for (String name : itemsToBuy) { itemsSeparate += mapOfItems.get(name).getValue(); itemListSeparate.add(mapOfItems.get(name).getItemN...
46d1ac2f-0bb5-46fb-99b9-64b7631f4574
3
public boolean findAtSouth(int piece, int x, int y){ if(x==7 || b.get(x+1, y)==EMPTY_PIECE) return false; else if(b.get(x+1, y)==piece) return true; else return findAtSouth(piece,x+1,y); // there is an opponent }
2cd8b845-bf55-4b95-a31c-6cffb429f04c
6
public static boolean wordBreak(String s, Set<String> dict) { boolean[] isWord = new boolean[s.length()+1]; isWord[0] = true; for( int i = 0; i< s.length(); i++) { if(!isWord[i]) { continue; } for(String word : dict) { int e...
d143f194-1d48-4d37-b0e2-e1e5c39c4841
4
public static JPanel setUpBoard () { Color purple = new Color(195,67,238); Color lightBlue = new Color(165,225,232); Color pink = new Color(230,0,176); Color orange = new Color(255,150,31); Color red = new Color (255,31,31); Color yellow = new Color (255,236,31); Color green...
89020cca-c9b6-412a-9a7f-0ed77fb49d96
5
public Option(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "disabled": disabled = Disabled.parse(this, v); break; case "label": label = Label.parse(this, v); ...
8653477e-251a-460c-969d-babbf51881c4
3
private <T> T handleResponseWithAuthentication(int status, InputStream responseStream, Class<T> clz) throws AuthenticationException, ServiceException { try { switch (status) { ...
bad8c0d5-7084-4e99-8647-ca105dc7cda1
9
public byte[][] AAcalculate(byte[][] A, int K, int[] ESIs, int[] d, int[] a, int[] b, int Lp) { int L=A[1].length; //for column size. if we need row size just Aarg.length is enough int N=ESIs.length; byte [][] GLTnew= new byte[N][L]; byte [][] Anew= new byte[(L-K)+N][L]; int tem=0; for (int...
2c4928c4-9bb1-42b1-9c4d-3757f2ddc923
6
public String asString() throws WeiboException{ if(null == responseAsString){ BufferedReader br; try { InputStream stream = asStream(); if (null == stream) { return null; } br = new BufferedReader(new Inp...
4cc9d7e5-5b71-437b-900d-fe74b68f330c
2
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!postfix) writer.print(getOperatorString()); writer.startOp(writer.NO_PAREN, 2); subExpressions[0].dumpExpression(writer); writer.endOp(); if (postfix) writer.print(getOperatorString()); }
7580a1d9-1eef-4ba1-9354-7d2dd765f238
8
public boolean detectCollision(Point p) { if (arrowLinkCurve == null) return false; Rectangle2D rec = getControlPoint(p); // flatten the curve and test for intersection (bug fix, fc, 16.1.2004). FlatteningPathIterator pi = new FlatteningPathIterator( arrowLink...
8fe259b1-e137-456b-b5a0-716ab2f3d11a
2
public ClassNode[] getHierarchy(ClassNode c) { LinkedList<ClassNode> hierarchy = new LinkedList<ClassNode>(); ClassNode c2 = c; while (c2 != null) { hierarchy.addFirst(c2); if (c2.superName == null) { break; } c2 = getClass(c2.superName); } return hierarchy.toArray(new ClassNode[0]); }
bd62f899-a2a5-41df-9408-22d4e62c7091
1
public static MainFrame getInstance(){ if (instance == null){ instance = new MainFrame(); } return instance; }
5e7d8c1b-feb4-4979-bab8-8ba836eaa48a
8
@Override public void run() { try { client = new Socket(configReader.get_string("hostname"), configReader.get_int("sync_port", 1, 65536)); BufferedInputStream inFromServer = new BufferedInputStream(client.getInputStream()); BufferedOutputStream outToServer = new BufferedO...
96a13309-9eb8-48a8-9245-b5eb04f3c63e
5
private static int getTipoInterseccionSegmentColineales(int u1, int v1, int u2, int v2, int x1, int y1, int x2, int y2) { int res; double d1, d2, dism, m1, m2, m3, m4; // res := 1 se intersectan en un punto // res := 2 se intersectan en mas de un punto // res :=...
c5b888f0-d065-4fb8-a844-c5c27c6713cf
2
public void onModuleLoad() { try { presenter = new GamePresenter(this, new PlayAgainstComputerController(new PlayerFactory()) ); } catch (Exception e) { e.printStackTrace(); Window.alert("Initialization error. Sorry you cannot play at this time."); return; } informationPanel.add(myScoreTable); inf...
f01bffd9-ad75-4993-ac76-20fae3912e8c
6
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((donations == null) ? 0 : donations.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((facilities == null) ? 0 : facilities.hashCode()); result = prim...
380733be-58f0-4fb0-b38e-3ea9975deea9
5
private void addIfNotDuplicate(ShareInfo add) { boolean shouldadd = true; for (ShareInfo share : this.shares) { if (share.getX() == add.getX()) { // dupe if (! share.getShare().equals(add.getShare())) ...
64fd29a7-4387-4074-8794-0d2757d926f7
7
private SystemObjectProperties createObjectProperties(final SystemObject systemObject) { if(systemObject instanceof Aspect) { return (createAspectProperties((Aspect)systemObject)); } else if(systemObject instanceof AttributeListDefinition) { // enthält AttributeSet und AttributeType // muss vor dem Attribut...
f73a1b8f-961b-4a3d-8c6e-d634851f0b8f
8
public State bellmanFord(Node f, Node t) { TreeMap<Node, Double> cost = new TreeMap<Node, Double>(); TreeMap<Node, Node> bt = new TreeMap<Node, Node>(); for (Node n: nodes) { cost.put(n, Double.MAX_VALUE); bt.put(n, null); } cost.put(f, 0.0); boolean update = true; while (update) { update = false; for...
636205ac-bc37-49cb-be25-08f54356717d
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTarget(mob,commands,givenTarget); if(target==null) return false; Item myPlant=Druid_MyPlants.myPlant(mob.location(),mob,0); if(myPlant==null) { if(auto) myPlant=ne...
ab9088ae-36c5-46db-b7f6-cea6dd33f5e8
0
public int getReportID() { return _rID; }
bed29136-0555-4efd-9100-6f9ec5bdbd05
5
public void play_song(String filename) { try { Scanner scan = new Scanner(new FileReader(filename)); while(scan.hasNext()) { String s = scan.nextLine(); while (!s.contains("delay")) { int note = Integer.parseInt(s.substring(0, s.indexOf(' '))); int code = Integer.parseInt(s.substring(s.indexOf...
5f41c5c3-1f91-44b8-8c87-57cceb4eb3a7
1
private void callHungerEvent(Player p) { HungerChangeEvent event = new HungerChangeEvent(plugin, p); plugin.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) return; }
146f32e6-90f1-4e4f-a45c-7385df505e46
8
public void mouseMoved(MouseEvent me) { GraphNode n; Dimension d = m_gp.getPreferredSize(); //System.out.println("Preferred Size: "+this.getPreferredSize()+ // " Actual Size: "+this.getSize()); x=y=nx=ny=0; if(d.width < m_gp.getWidth()) nx = (int)((nx...
764d522c-970e-4e53-a718-94d261703513
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((hunterAID == null) ? 0 : hunterAID.hashCode()); return result; }
65e54167-963b-4417-87a2-4531523263c5
4
public void store(int value) { if (value < this.value) { if (left == null) { left = new TreeNode(); left.value = value; } else { left.store(value); } } else if (value > this.value) { if (right == null) { right = new TreeNode(); right.value = value; } else { right.store(value);...
c1601ee4-aae4-4b9a-b8e3-c7855d512f27
0
public Worker () { //initial settings isInputActive = true; this.keyboard = new BufferedReader(new InputStreamReader(System.in)); System.out.println(MSG_WELCOME); //start this.lifeCycle(); }
f97d2978-aef8-45e8-9802-dd9bd1c6971a
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...
8530df99-a3fe-4f4b-9280-c9d2cea8030b
8
public ArrayList<String> getValidationErrors() { ArrayList<String> errors = new ArrayList<String>(); try { Double.parseDouble(price); } catch (NumberFormatException e) { errors.add("Price is not a number"); } if(description == null || description == "") ...
7bb330ed-3b09-4c9b-906d-c145a7faf03e
3
public static String left(String str, int len) { if (str == null) { return null; } if (len < 0) { return EMPTY; } if (str.length() <= len) { return str; } return str.substring(0, len); }
15b0926f-cbd2-48fb-b8bf-a9588d1872e0
5
public static void test_3b(){ try{ System.out.println("\n\nTestCase-3B\n\n"); TestNetwork n=new TestNetwork(4,4,2); Paxos p=new Paxos(n); p.runPaxos(); n.change_DPmode(-1,1); for(int i=0;i<10;i++){ //Block the channel of all processes n.block_channel(i, 1); n.reorder_msg(i,1); ...
59617863-3896-44e5-948c-d48f7bd32c3e
7
public LauncherFrame() { setResizable(false); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Launcher.saveGame((String) gameBox.getSelectedItem()); } }); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFo...
7e83cb4c-fff4-469d-b4e1-fe1bbd7aeeb1
5
private void setUrlYahoo (String path) { //try (final Reader symbolList = new FilterNasdaq (new BufferedReader (new InputStreamReader (new URL (url).openStream())))) try (Reader symbolList = new FilterNasdaq (new BufferedReader (new FileReader (new File (path))))) { String symbolLine = ""; int urlLimit = 0...
aa2f4726-9899-4063-a1ea-c07e6a79cb71
0
@Override public void Volum (double n) { this.volume=4/3*Math.PI*this.rad*this.rad*this.rad*n; this.rad = rad*Math.pow(n, 1/3); this.hight = 2*rad; }
82902f43-c536-490a-99a8-b42a637e9408
0
public BloodMedicine(){ x = points[0][0]; y = points[0][1]; w = h = 15; }
1b9ecdf6-7bc9-4c54-a720-a6382aa0b462
4
private void initJavaSound(int channels, int rate) { try { AudioFormat audioFormat = new AudioFormat(rate, 16, channels, true, // PCM_Signed false // littleEndian ); DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat, AudioSystem.NOT_SPECIFIED); if (!AudioSystem.isLine...
bf4958a2-b0bd-47e1-8956-3a33e8b4f2cd
9
public static void drawTape(ArrayList<Boolean> history, Graphics2D g, int w, int h, int dotLength, boolean showLetters, boolean showMetre, boolean showDotDash) { ArrayList<Symbol> symbols = Analysis.extractSymbols(history, dotLength); ArrayList<Letter> letters = Analysis.extractLetters(...
190e9318-2f59-4c3b-ba11-04de0243cfd3
9
@Override public void handle(Message m, String[] args) { if (args.length == 1) { String nick = m.getNick(); if (pozdravy.containsKey(nick)) { cw.sendMessage(nick + ": " + pozdravy.get(nick)); } } else if (args.length < 3) { if (pozdrav...
b454d082-7651-422d-9643-19d360ab761f
6
public int getCouleur() { Random r = new Random(); int t1 = r.nextInt(6); switch (t1) { case 0: return 0; case 1: return 0; case 2: return 1; case 3: return 1; case 4: ...
dc04e140-6d35-4e3e-9217-a47590ee9e2e
7
static private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i==0) ? true : !cons(i-1); default: return true; } }
3f22e313-d9b4-4496-880c-d150bf32de83
4
private void fillTagLast(Integer userID, List<Integer> tags, Long day) { Map<Integer, Long> tagMap = userTagLastMapping.get(userID); if (tagMap == null){ tagMap = new HashMap<Integer, Long>(); } for (Integer tag : tags) { if( ! tagMap.containsKey(tag) || day > tagMap.get(tag)) { tagMap.put(tag, ...
0ade51d5-7020-4692-a868-0957e4bf1920
0
public void mousePressed(MouseEvent event) { Point2D pontoTela = event.getPoint(); double larg = 100; double alt = 20; double cx = pontoTela.getX() - larg / 2.0; double cy = pontoTela.getY() - alt / 2.0; Retangulo retangulo = new Retangulo(cx, cy, ...
6abe4bdd-8932-4522-8186-bc74fc34b5e6
9
public final void unsubscribeReceiver( ClientReceiverInterface receiver, SystemObject[] objects, DataDescription dataDescription) { if((_highLevelCommunication == null) || (_cacheManager == null)) { throw new InitialisationNotCompleteException( "Die Datenverteiler-Applikationsfunktionen sind noch nicht ini...
5f60dc0d-5851-493a-aef0-7b0ef0262f8a
3
public static void pasteSchamtic(Schematic schematic, Location location) { World world = location.getWorld(); for(int x = 0; x < schematic.getWidth(); x++) { for(int y = 0; y < schematic.getHeight(); y++) { for(int z = 0; z < schematic.getLength(); z++) { ...
1754c995-706b-4216-bb9c-ce6dd855e754
3
public void paint(Graphics g) { super.paint(g); cellSize = (this.getWidth() / 8) - 1; for(int x = 0, row = 0; row <= 8; x += cellSize, row++) { g.drawLine(0, x, cellSize * 8, x); } for(int y = 0, col = 0; col <= 8; y += cellSize, col++) { g.drawLine(y, 0, y, cellSize * 8); ...
99f3c65f-5107-4fdf-99d8-7042f8a45635
5
public void setup() { // set the size of our graphics canvas size(1000, 350); // smooth all graphics smooth(); // create a new instance of our Player class this.thePlayer = new Player(this.width/2, this.height-25, this); // create a new instance of our Missile class // (the player only gets o...
f54b27a1-620a-46c4-aac8-14f2a7384030
3
public void mainLoop() { String input; String[] inputParts; while (true) { input = getInput(); inputParts = input.split(" "); // Try each module in turn for (Module module: modules) { if (module.matches(inputParts)) { module.execute(inputParts); break; } } } }
eb43b921-380d-45a2-84e5-706e613ca991
4
@Override public void advanceMinute() { for (int i = 0; i < tellers; i++) { servingClients.get(i).servedMinute(); } for (int i = 0; i < tellers; i++) { if (servingClients.get(i).getExpectedServiceTime() <= 0) { servingClients.remove(servingClients.get(i)); if (waitingClients.size() < 0) { serv...
27069fb0-c429-44e8-871e-ca553bacfa3c
5
public static void treemenu() { System.out.println("\n"+"press key for desired option: "); System.out.println("1 - find pattern in Tree"); System.out.println("2 - print tree"); System.out.println("3 - read file to tree"); System.out.println("4 - read userinput to tree"); Syste...
2a777066-c708-4a8b-b803-b0a65ad4887f
7
public static void mailto(String addr) { String url = "mailto:" + addr; String osName = System.getProperty("os.name"); try { if (osName.startsWith("Mac OS")) { Class fileMgr = Class.forName("com.apple.eio.FileManager"); Method openURL = fileMgr.getDeclaredMethod("openURL...
cf513a2f-166c-4353-a830-1f0c7f5c62b7
5
public void proc(int i) throws ParseException, SQLException { mock = Mockito.mock(EnterModel.class); if (i == 1) mock.add(); if (i == 2) mock.delete(); if (i == 3) mock.search(); if (i == 4) mock.showall(); if (i == 5) ...
bf51af6b-9d3b-435e-ba43-a349db541dbc
4
public final void startElement(final String ns, final String lName, final String qName, final Attributes list) throws SAXException { // the actual element name is either in lName or qName, depending // on whether the parser is namespace aware String name = lName == null || lName.length() == 0 ? qName : lName; ...
faecad9f-0ed1-4d4f-8be5-51c49f9827ff
4
public final void update(Entity carrier, int delta) { timeSinceAttachment += delta; if (!isPermanent() && timeSinceAttachment >= getTotalDuration() && !hasRequestedRemoval) { carrier.loseBuff(this); hasRequestedRemoval = true; } if (hasAnimation()) { animation.update(delta); } continuousEffect(carr...
308c024b-8fa6-4dc3-9c7d-8df8d392f3c1
5
private void drawClock() { panel.erase(); for(Housemate hm : Housemate.values()) { String text = hm.getName() + " was in " + hm.getLastLoc() + " on " + hm.getDate(); switch(hm) { case AMY: panel.drawText(text, 300, 100); break; case DAN: panel.drawText(text, 300, 200); ...
04df0d13-7627-4ed5-8685-44ab7afe3758
8
private DbIterator buildAggregator(DbIterator child, int afield, int gfield,Op op) { DbIterator aitr = new TupleArrayIterator(new ArrayList<Tuple>()); Type groupType; if (gfield == Aggregator.NO_GROUPING) { groupType = Type.INT_TYPE; } else { groupType = child.getTupl...
b2ef36a1-fe7b-4c22-bcb4-48834056bb98
1
private void addMapToDividendDataForEachTicker() { for(String s: dbSet){ DIVIDEND_HISTORY.put(s, new TreeMap<Float,Float>()); } }
b23a57d3-865c-4218-b33f-b9751b7e5ede
9
@Override public boolean canPlayerOption1(Player target) { player.stopAll(true); if (player.getCurrentFriendChatOwner() == null) { player.getPackets().sendGameMessage( "You need to be in a friend's chat to start a war."); return false; } if (player.getCurrentFriendChat().getRank(player.getUsername()...
e1abb23f-94a1-489d-a58f-cffcb710bb83
0
public BufferedWriter getBufferedWriter() { return _writer; }
3a09b19f-9d80-4eee-bd5a-71f889574cb5
7
public static boolean isHoliday(Calendar calendar) { return (isEaster(calendar) || isChristmasSecond(calendar) || isFifthOfMay(calendar) || isAscensionDay(calendar) || isPentecostFirst(calendar) || isPentecostSecond(calendar) ...
314cb39d-b8bb-4a3b-8e44-140c2fccda85
0
public boolean getFileFilterIncludeIgnoreCase() { return this.fileFilterIncludeIgnoreCase; }
39ce6cbd-8f33-4783-8176-0b54c3fea0b9
2
public static String Date2Str(java.util.Date date, String formatString) { if(formatString!=null && !formatString.equals("")){ format = new SimpleDateFormat(formatString); } return format.format(date); }
1e67eea7-0580-4746-80d0-c879fb0e68af
0
public int storeRunTimeStack(int offset) { return runStack.store(offset); }
9ced20cc-5a66-4aef-b0f4-696c00fabf59
8
public Suit changeSuit() { int suitClubs = 0; int suitDiamonds = 0; int suitHearts = 0; int suitSpade = 0; for (int i = 0; i < hand.cardlistSize(); i++) { if (hand.getList().get(i).getSuit().equals(Suit.CLUBS)) { suitClubs++; } else if (ha...
780fa33c-c959-4755-8519-d998a982fc20
8
public static void readHash3(String type_map, HashMap<String, Integer> hashMap) { ArrayList<String> types = new ArrayList<String>(); ArrayList<String> tokens = new ArrayList<String>(); if (type_map != null) { readLines(type_map, types); for (int i = 0; i < types.size(); i++) { if (!types.get(i).isE...
2bdb7c26-33bb-4a38-889e-49054fb09265
6
public void run() { UUID sessionID = this.handleSession_connectionStart( this.userID ); // Do not use the connectionUserID after this point any more! // It's too strong bound to the socketmanager, to which the HTTP handler should not be bound at all (except as a handler). // Use the session ID instead to k...
e33d88c4-75ca-4034-8441-f80aaae91f81
4
private boolean matchClass(String name, ClassPool pool) { if (classname.equals(name)) return true; try { CtClass clazz = pool.get(name); CtClass declClazz = pool.get(classname); if (clazz.subtypeOf(declClazz)) try { CtM...
65249b3e-d1bf-4cfa-9565-03f7becb5981
0
public long getDownloaded() { return this.downloaded; }
dce58fbd-00e8-487e-b019-5ca6b3b5dbc6
1
private void compute_pcm_samples4(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[4 + ...
2739fd04-77ee-47c4-bfa9-ac6d35f683da
7
public List<Position> getListOfPositions() { List<Position> positions = new ArrayList<Position>(); ResultSet resultSet = null; Statement statement = null; Connection connection = new DbConnection().getConnection(); try { statement = connection.createStatement(); resultSet = statement.executeQuery(SELECT...
41eb2354-4a6d-404c-b0a5-59d52028c986
7
public void decodeAndRender(int id, String message) throws JSONException { switch (id) { case 202: StartableMessage tsm = enc.startebleMessageDecode(message); this.startable = tsm.isStartable; break; case 203: StartedMessage startedGame = enc.startedMessageDecode(message); this.started = sta...
4fb9ab73-3760-491d-bb22-3c05908481c5
3
public static void main(String[] args) { long start = System.nanoTime(); int answer = 1; outerLoop: for(int i = 998; i > 1; i--){ for(int j = 1; j + i < 1000; j++){ int k = 1000 - i - j; if(j*j + k*k == i*i){ answer = i*j*k; break outerLoop; } } } System.out.println(answer); Syst...
5baacf4e-8692-402f-990f-7ccfe1466bfe
8
public boolean canMoveUp(PaletteEntry entry) { PaletteContainer parent = entry.getParent(); int parentPermission = parent.getUserModificationPermission(); if (parentPermission < PaletteEntry.PERMISSION_LIMITED_MODIFICATION) { return false; } if (parent.getChildren().indexOf(entry) != 0) { return true; ...
16f16ad1-30f0-4545-be32-867ff12c70c7
2
public void close() { synchronized (socket) { if (close) { return; } close = true; serv.closeid(cid); try { fromClient.close(); toClient.close(); socket.close(); } catch(IOException e) { System.err.println("ajserver: an error occured while trying to close client " + cid); } ...
b24fea62-e262-485c-8dae-5f6534d7841e
9
public static void main(String[] args) { logln("LIG Client " + version + " Initializing.."); Config main = new Config("main"); logln("Loading configurations.."); try { host = main.getString("host", "localhost"); port = Integer.parseInt(main.getString("port", "2022...
6b182331-4ab9-450d-927b-71b0603ba36e
5
public void lireFichier(boolean ignoreNumLignes) { try { InputStream ips = new FileInputStream(fichier); InputStreamReader ipsr = new InputStreamReader(ips); BufferedReader br = new BufferedReader(ipsr); String ligne; while ((ligne = br.readLine()) != null) { // Parsing de la ligne selon le...
00c45199-0214-471f-98ae-ac14c269ceb2
1
private void enlarge(final int size) { int length1 = 2 * data.length; int length2 = length + size; byte[] newData = new byte[length1 > length2 ? length1 : length2]; System.arraycopy(data, 0, newData, 0, length); data = newData; }
310e6823-c794-4b2d-9c8d-0aa8c0e8142f
3
@Test public void testRemove() { // Test that we can remove an actor while iterating over the set ActorSet as = new ActorSet(); for (int i = 0; i < 100; i ++) as.add(new TestActor(Vector3f.newRandom(100))); int count = 0; for (Actor a: as) { if (count...
b134a1bb-2037-4606-8d1e-d0102ce71940
2
protected static JTabbedPane createTabbedPane(Color bg, String title, JPanel... jPanels) { JTabbedPane tabPane = null; if (jPanels != null) { tabPane = new JTabbedPane(); tabPane.setBackground(bg); tabPane.setPreferredSize(GUIConstants.DEFAULT_TAPPEDPANE_DIM); ...
24b66d0e-e69f-448c-9dbd-e250ab442db0
5
@Override public boolean setChartOption( String op, String val ) { boolean bHandled = false; if( op.equalsIgnoreCase( "Stacked" ) ) { setIsStacked( true ); bHandled = true; } else if( op.equalsIgnoreCase( "PercentageDisplay" ) ) { setIs100Percent( true ); bHandled = true; } else if( op.equ...
4a007918-135f-4480-ab5f-8de225c2c3a6
3
public static void checkFiles(String[] files) throws IOException { for (String file : files) { File f = new File(file); if (!(f.exists() && f.isFile())) f.createNewFile(); } }
7f96105c-1385-4bd6-b361-a2443f4de6a8
1
@Override public void mouseReleased( MouseEvent e ) { for( MouseListener listener : listeners( MouseListener.class )){ listener.mouseReleased( e ); } }
07e106bb-2b88-4e4f-92e1-cb963d9592dc
6
public static void main(String[] s) { int n = 2000000; long start = System.currentTimeMillis(); BitSet b = new BitSet(n + 1); int count = 0; int i; for (i = 2; i <= n; i++) b.set(i); i = 2; while (i * i <= n) { if (b.get(i)) { ...
e03ec3b1-1e7c-463a-82d1-1190187c2b3d
8
*/ public boolean growPolypeptide(int x, int y, double angle, int id) { MolecularModel m = model; int n = m.getNumberOfAtoms(); int k = 0; Object o = m.getProperty("NOA_Translation"); if (o instanceof Integer) k = (Integer) o; if (n <= k) { boolean b = insertAnAtom(x, y, id, true, false); if (b) ...
d7a2871e-8f4a-4d69-a140-d9a76e44b62b
8
public double[] maxmin(String op, double[] max, int[] numberOfValues, NodeVariable x, int xIndex, HashMap<NodeVariable, MessageQ> modifierTable){ double cost; if (op.equals("max")){ cost = Double.NEGATIVE_INFINITY; } else if (op.equals("min")){ cost = Double.POSIT...
77b57877-e6b4-4599-b861-c8ec0834b327
6
public int compareTo(Object o) { HardwareComponent cheapestThis = hardwareComponents.get(0); HardwareComponent cheapestOther = ((HardwareAlternative) o).getHardwareComponents().get(0); for (HardwareComponent hardwareComponent : hardwareComponents) if (hardwareComponent.getConsumptionIndicator() < cheapestThis....
85cc24ba-9072-4a42-8b5e-e97d839751a2
6
public Camino getShortestPath(Nodo origen, Nodo destino) { if(!this.containsNodo(origen) || !this.containsNodo(destino)) throw new IllegalArgumentException("Nodo no contenido en el grafo"); ArrayList<Camino> caminos = new ArrayList<Camino>(); caminos.add(new Camino(origen)); // ...
febb9408-eb1c-4ae4-bb2b-b33a87e37cd1
8
public static void FillJsonFile(Json json, JsonFile jsonFile) throws JsonException{ if(jsonFile.startsWith("{") || jsonFile.startsWith(",")) jsonFile.cut(1); if(jsonFile.startsWith("}")) return; int index = jsonFile.indexOf(":"); if(index < 1) throw new JsonException("Expected key after ," ,jsonFile); ...
b0d630fc-1fba-4e32-9933-e1a87cbe7310
4
public static JSONArray fetchByCustomerGroup(final String token, final String objType, final Long number) throws IOException { String url = ApiProperties.get().getUrl() + objType + "/customergroup/" + number; String obj = fetchData(url).toString(); JSONArray results = new JSONArray(); JSONObject jsonObject ...
b8f8b38e-4466-421d-9531-c6d4f15e38a2
4
private static Hand generateHand(Card[] available, int skip1, int skip2) { assert available.length == 7; Card[] cards = new Card[5]; for (int i = 0; i < 5; i++) { int j = i; if(j >= skip1) j++; if(j >= skip2) j++; if(available[j] == null) return null; cards[i] = available[j]; } return new Hand(...
8a4228b2-a9ca-49dd-94af-f9193aa0b51e
2
private void generateHardwareSystems(int alternatives, int[] possibilities, int[] repetitions) { for (int i = 0; i < alternatives; i++) { HardwareSystem hardwareSystem = new HardwareSystem(); for (int j = 0; j < project.getHardwareSets().size(); j++) { int index = (i / repetitions[j]) % project.getHardwareS...