method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a28b7a66-9c7e-4da2-8142-0194f16f6704
1
public void visitFieldExpr(final FieldExpr expr) { // a.f, f in class C // [a] <= C // [declared field type] <= [a.f] final MemberRef field = expr.field(); if (!expr.isDef()) { start(expr, field.type()); } }
a76dcae3-6232-44eb-be8e-04f04803ca96
8
private void uniqueinmap() throws FileNotFoundException, IOException { FileInputStream fstream = new FileInputStream("C:\\Users\\ANKI\\Documents\\NetBeansProjects\\keywords\\src\\keywords\\rules1"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new Inp...
358e0632-f3d1-4a84-9589-81a1b4958cae
4
private void decodeNextByte() throws IOException { if (_nextByte == ArithCodeModel.EOF) return; if (_decoder.endOfStream()) { _nextByte = ArithCodeModel.EOF; return; } while (true) { _nextByte = _model.pointToSymbol(_decoder.getCurrentSymbolCount(_model.totalCount())); _model.interval(_nextByte,_interval);...
226e872d-d33c-4c7f-9409-aee644175741
6
@Override protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) { switch (setField) { case SHORT_VALUE: return SHORT_VALUE_FIELD_DESC; case INT_VALUE: return INT_VALUE_FIELD_DESC; case LONG_VALUE: return LONG_VALUE_FIELD_DESC; case DOUBLE_VALUE:...
4560ade1-d7ad-4b79-a33e-c45adfad21d8
3
public static void treeStitch(String pitchTreePath, String rhythmTreePath){ String trees[] = new String[2]; trees[0] = pitchTreePath; trees[1] = rhythmTreePath; File treeStorage = new File("Random Song Trees.txt"); try{ OutputStream out = new FileOutputStream(treeStorage); byte[] buf = new byte[100];...
1f2ab1ee-f417-4578-9bcd-d6345addb65d
7
@Override protected void doStop() { for (Event event : this.events1) { event.release(); } this.events1.clear(); for (Event event : this.events2) { event.release(); } this.events2.clear(); int numListeners = 0; for (Bag<EventListener> listeners : this.listenerMap.values()) { numListeners +=...
e67fa3c3-c75e-4a6c-b318-2a96c43871bb
6
public void setCustomCursor() { if (this.ellipseButton.isSelected()) { this.getDiagramPanel().setCursor(this.ellipseCursor); } else if ((this.resuorceButton.isSelected())) { this.getDiagramPanel().setCursor(this.resCursor); } else if ((this.rectangleButto...
1727f96f-32da-4d5e-a6b0-dd44c741d3a3
5
@Override public void Draw(Graphics2D g2d) { //Draw will be called by the game class, depending on gamestate //draw will draw the necessary items switch (gameState) { case PLAYING: game.Draw(g2d, mousePosition()); break; case GAMEOVER:...
57d1a391-1479-4b31-b48c-a9407c78e8da
4
private int partitionQS(int[] arr, int left, int right) { int pivotEle = arr[(left + right) / 2]; while (left <= right) { while (arr[left] < pivotEle) left++; while (arr[right] > pivotEle) right--; if (left <= right) { swap(arr, left, right); left++; right--; } } return left; ...
a10dac24-daea-4034-8b46-df925d780021
6
private void verifySignature(VerificationResponse response) throws YubicoValidationFailure, YubicoVerificationException { StringBuilder keyValueStr = new StringBuilder(); for (Entry<String, String> entry : response.getKeyValueMap().entrySet()) { if ("h".equals(entry.getKey())) { ...
7217d9a2-c843-479d-9707-ce22ea151190
8
@Override public boolean equals(Object obj) { if(this == obj) return true; if(!(obj instanceof Port)) return false; Port that = (Port) obj; return (this.getSwitch() == null && that.getSwitch() == null || this.getSwitch() ...
760169b7-f971-483b-9b6a-c83d42384636
2
private void patientPage() throws ParseException{ patientPane = new JPanel(); patientPane.setBackground(SystemColor.activeCaption); patientPane.setLayout(null); saveStatus = false; //*****Head Label***** JLabel lbl_patient = new JLabel("Patient"); lbl_patient.setFont(new Font("Arial", Font.BOLD, 30));...
794f6881-b514-418a-9d8a-e890ae35ebcb
5
public GUI(Reader myReader) { //set reader reader = myReader; //create all the GUI objects gui = new JFrame(); gui.setTitle("System Information"); gui.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); gui.setLayout(new BorderLayout()); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //set the progress ...
ab7cb540-120e-4845-aff7-ad2c8262f6f4
1
public void printPath(List<Link<T>> path) { for (int i=0; i<path.size(); i++) { System.out.print(path.get(i).start.label + " "); } System.out.print(path.get(path.size()-1).end.label); }
91552c87-47ba-4f42-9ef7-603623f52c2d
5
@EventHandler public void onDeath(PlayerDeathEvent e) { if (e.getEntityType() == EntityType.PLAYER) { Player player = e.getEntity(); Player killer = player.getKiller(); Arena arena = this.gm.findArenaByPlayer(player); if (arena == null) { return; } if ((arena.findPlayer...
ff17ed22-2305-4fdf-8e6a-9884c6388ea3
1
public void serverBroadcast(String message) { for (Player p : server.players) p.sendMessage(message); }
c94ad65c-a787-419f-be5d-06ce6444e511
2
@Override public void mousePressed(MouseEvent e) { minus.mousePressed(e); plus.mousePressed(e); if (minus.state == 1 || plus.state == 1) timeDown = System.currentTimeMillis(); }
ec6ac393-aa1d-4d22-a512-93ccaffe56bc
4
public static boolean printMessage(Map<String, String[]> map) { boolean force = false; for (Entry<String, String[]> entry2 : map.entrySet()) { for (String string : entry2.getValue()) { if (string.equals("true")) { continue; } if(entry2.getKey().contains("force")) { System.err.println(Messa...
a1ba99c2-cca2-4be2-b1d5-25f22512f0f7
5
public void readPasvAnswer() throws PassivModeException { while (true) { // endless loop try { // if any byte is available (start) int counter; if ((counter = msgSocket.getSocketInput().available()) != 0) { int buffersize = msgSocket.getSocketInput().available(); char buffer[] = ...
cbb2463f-f090-4b4e-a2b2-d3a8a3059f2c
5
public void registerPacket(int id, Class<? extends IPacket> packet){ if (idToPacketMap == null){ idToPacketMap = new HashMap<Integer, Class<? extends IPacket>>(); } if (packetToIDMap == null){ packetToIDMap = new HashMap<Class<? extends IPacket>, Integer>(); } ...
8358075a-aca5-4769-8672-2b0791eaf43b
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...
2527cb17-6846-4074-8f3a-7899aed5c11c
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the server with glorious data task = plugin.getServer().getScheduler().runTaskTimerAsynchronous...
5d56c649-b083-46d3-a487-0a7f0f106057
8
public int convertIndex( int old_i, long fc, final String old_cad, final String new_cad ){ int fc_offset = 0, new_i = 0, step; double multiplier; int[] frames; //figure out the index multiplier, fc_offset, and //get the new frameset based on input cadence if(new_cad.equals...
2d71223a-456e-4c3c-a58e-ad76cd221362
3
private static void tableSort(int array[][]) { int helpElementArr[] = new int[array.length];//массив первой строки матрицы for (int i = 0; i < array.length; i++) { helpElementArr[i] = array[0][i]; } bubbleSort(helpElementArr); System.out.println(); for (int i ...
f7246e52-5cfa-411d-805a-740c72a44ef7
0
@Override public WebDriver getWebDriver() { return new SafariDriver(); }
4d1672e5-4059-4c99-a5f6-85ac60a8fa82
5
protected void checkMoveTo() { if (numSeg == 0) return; switch (types[numSeg - 1]) { case PathIterator.SEG_MOVETO: path.moveTo(values[numVals - 2], values[numVals - 1]); break; case PathIterator.SEG_CLOSE: if (numSeg == 1) return; if (types[numSeg - 2] == PathIterator.SEG_MOVETO)...
37a1efd0-daf9-4e12-a835-3bc05b806800
3
public List<Integer> bubbleSort(List<Integer> array) { int tmp; for (int i = 0; i < array.size() - 1; i++) for (int j = i + 1; j < array.size(); j++) { if (array.get(i) > array.get(j)) { tmp = array.get(i); array.set(i, array.get(j)); ...
f631845c-4681-472b-b3ae-e07937e231c0
1
public void testToStandardSeconds() { Minutes test = Minutes.minutes(3); Seconds expected = Seconds.seconds(3 * 60); assertEquals(expected, test.toStandardSeconds()); try { Minutes.MAX_VALUE.toStandardSeconds(); fail(); } catch (ArithmeticExceptio...
0f2f2c72-a7bb-437d-a2ee-166fa778ca02
3
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); if (textColor != null && textColor.getBgColor1() != null) gc.setForeground(textColor.getBgColor1()); gc.setTextAntialias(aliasValues[aliasCombo.getSelectionIndex()]); // column 1, r...
bf42fe6f-0375-4740-b6e5-2a6fcba67ab4
4
public double getBiScore(String parent, String lchild, String rchild){ double biscore=0; List<BinaryRule> rules = getBinaryRulesByParent(parent); for(int i=0;i<rules.size();i++){ String cc = rules.get(i).getLeftChild(); if (cc.equals(lchild)){ List<BinaryRule> rules1 = getBinaryRulesByLeftChild...
5d13fc48-6649-4d22-aa5d-0474cc01eedc
6
protected void paintComponent(Graphics g) { super.paintComponent(g); cursorPosition += translation; if ((translation == -1 * translationUnit && cursorPosition < cursorGoal) || (translation == translationUnit && cursorPosition > cursorGoal)) cursorPosition = cursorGoal; int rectPosition = 0; for (in...
2d08c540-1574-4fc3-b644-9bf3d003c688
6
public int viewToModel(float fx, float fy, Shape a, Position.Bias[] bias) { bias[0] = Position.Bias.Forward; Rectangle alloc = a.getBounds(); RSyntaxDocument doc = (RSyntaxDocument)getDocument(); int x = (int) fx; int y = (int) fy; // If they're asking about a view position above the area covered by //...
d9b48644-3834-4d52-86b6-1e33d9efb0a2
0
public CheckResultMessage checkTF05(int day) { return checkReport.checkTF05(day); }
97979c63-14e3-4e38-ab3e-0776aa0a4401
7
private void setUpCards(){ // set up card collections List<CharacterCard> characterCards = new ArrayList<CharacterCard>(); List<WeaponCard> weaponCards = new ArrayList<WeaponCard>(); List<RoomCard> roomCards = new ArrayList<RoomCard>(); for (Character character : Character.values()){ characterCards.add(n...
29c3da12-94e2-4d16-b545-b65eed7df827
2
public static boolean isPossessedItem (Entity entity) { if (entity instanceof Skeleton) { Skeleton lich = (Skeleton) entity; if (lich.getEquipment().getChestplate().equals(new ItemStack(Material.GLOWSTONE, 1, (short) - 98789))) { return true; } } ...
fa90ad6f-3f9e-45fd-b06b-3fc3ca25ee88
4
public String readString(String key, String valueName) { try { OpenResult openResult = openKey(key, READ_ACCESS); if (openResult.mSuccess) { if (METHOD_QUERY_VALUE_EX == null) { METHOD_QUERY_VALUE_EX = getMethod(mRoot.getClass(), "WindowsRegQueryValueEx", int.class, byte[].class); } byte[] byte...
bdf9f7f6-929e-49f8-bc3c-60958e524a16
7
private static double incbcf(double a, double b, double x) throws ArithmeticException { double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; double k1, k2, k3, k4, k5, k6, k7, k8; double r, t, ans, thresh; int n; double big = 4.503599627370496e15; double biginv = 2.22044604925031308085e-16; k1 = a; k2 = a + b; ...
fa0e843c-5cc4-4fa0-a353-24e8ea24fd8e
5
private List<Integer> getInformationAboutLinkedDialogs(NodeList lList, boolean isGroup){ List<Integer> listLinkedDialogEntries = new ArrayList<Integer>(); if(debugConsole){ System.out.println(""); System.out.println("----------"); System.out.println("Linked to the Dialogs :"); System.out.println("------...
22d85047-796a-490c-a631-5f87fa71bf5b
9
public static void extractStartupFunctionUnits(List startupunits, Symbol startupfnname) { { int remainingunits = startupunits.length(); int minunitsperfunction = Native.floor((((double)(Stella.$MAX_NUMBER_OF_STARTUP_UNITS$)) / Stella.$STARTUP_TIME_PHASES$.length()) + 1); Cons cursor = startupunits.theCo...
6b15f902-6713-43fd-acec-81d73c8c0672
1
public void addMessage(String message) { if (messages.size() >= 4) messages.remove(3); messages.add(0, message); }
008813e9-0c3d-4940-a705-b0f457c9a82f
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String rid = request.getParameter("rid"); String rname = request.getParameter("rname"); response.setContentType("text/html;charset=UTF-8");...
387f0020-b4e3-4614-8de2-1b6df7ff0bb3
5
public void dir(){ int cf = 0, cd = 0; long cbytes = 0; try{ if( file.isDirectory() ){ File files[] = file.listFiles(); for( File fi : files){ System.out.print( new Date( fi.lastModified() ) ); ...
ebf25c81-579e-42c8-8f70-a2776ae1cc44
2
@Test public void testClientJobTracked() throws LuaScriptException { String jid1 = addJob(); String jid2 = addJob(); popJob(); popJob(); trackJob(jid1); trackJob(jid2); List<BaseJob> jobs = _clientJobs.tracked(); assertTrue(jobs.size() == 2); for (BaseJob job : jobs) { assertTrue(job.getAttrib...
718d5e81-53c0-4e33-acb8-a076d40b57b0
3
private String getEast(char a) { if ('0' == a) return "1, halt"; if ('1' == a) return "0, E"; if ('2' == a) return "3, halt"; return "2, E"; }
b0c83a3a-ce69-40d7-8d34-9da21b58111d
0
public Austin() { super("Austin", 4000, 250, 20, 50, as); as.setSkill(0, "Sleep", 0, 0, "Austin sleeps in class."); as.setSkill(1, "Argue", 30, 100, "Austin argues."); as.setSkill(2, "Confusion", 10, 50, "Austin is really confused about what is happening."); as.setSkill(3, "NoIdea", -50, 0, "Austin has no id...
b7972859-73b9-4097-95ef-3a0ed9d96b48
2
private String parseArgs(String args[]) { String fpath = null; for (String arg : args) { if (arg.startsWith("-")) { // TODO: maybe add something here. } else // expect a filename. { fpath = arg; } } return f...
fdd43af4-625a-44b9-b9e6-808e51ff3198
6
public void endElement(String uri, String localName, String qName) throws SAXException { if(qName.equals("levelWidth")) { gameEngine.setPlayingFieldWidth(level_width); inLevelWidth = false; } if(qName.equals("levelHeight")) { gameEngine.setPlayingFieldHeight(level_height + Breako...
c61f62cf-57c4-498d-bccb-018b68a24b84
6
public void move() { if (Zen.isKeyPressed(me.up) && y >= 65) { y = y -10; } if (Zen.isKeyPressed(me.down) && y <= 435) { y = y +10; } if (Math.abs(x-b.x) <= 7 && Math.abs(y-b.y) <= 50) { b.horizontalBounce(); b.xv = b.xv * 1.1; } }
6c824636-5039-4993-8a8d-36186025ff60
0
public void setWidth(int width) { this.width = width; }
cade8b11-a3b5-4eba-be5b-734048804dad
6
private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed if(nombrelaboratoriosField.getText().trim().isEmpty() || telefonolaboratorios1Field.getText().trim().isEmpty() || sucursalField.getText().trim().isEmpty()) { JOptionP...
63cd90c8-d26f-48db-944c-4763fac95f5f
4
public void move(){ System.err.println("sy " + sy); System.out.println("by " + by); System.err.println("sx " + sx); System.out.println("bx " + bx); if(sy > by){ by+=1; } else if (sy < by){ by-=1; } else if (sx > bx){ ...
2c032ce2-be88-41b0-984a-10694ae2bcfe
1
public static void setPropertyDefaultAsBoolean(PropertyContainer container, String key, boolean default_value) { if (container != null) { container.setPropertyDefault(key, new Boolean(default_value)); } else { throw new IllegalArgumentException("Provided PropertyContainer was null."); } }
e4fb100d-e1cc-4707-87ea-3fa5701c4e4d
8
private void calculateShape() { float t = 360 / sides; float a = angle; a = a > 360 ? a - 360 : a; points = new Point2D[sides]; path = new GeneralPath(); for( int i = 0; i < sides; i++ ) { float ra = (float) Math.toRadians( a ); float x = (float) Math.abs( radius * ...
add05467-e152-4cb9-9409-3f1a67368516
2
public void paintComponent(Graphics g) { if (gradientColor == null) { super.paintComponent(g); } else { Rectangle rect = getVisibleRect(); if (g.getClipBounds() != null) { rect = rect.intersection(g.getClipBounds()); } Graphics2D g2 = (Graphics2D) g; g2.setPaint(new GradientPaint(...
95a995d0-cdd8-481f-b996-c0bcc6a06afb
4
public static boolean list_filter(String url, List<String> list) { if(list.size() > 1000){ for (int i = 0; i< list.size()-1000; i++){ list.remove(i); } } for (String aList : list) { if (url.equals(aList)) { return false; ...
65a79af7-9950-4ac7-97bc-6c85a738253c
6
public static void main(String[] args) { Reader in = new Reader(); int n,m; long ways; int cc; int[] csize,vis; int tc = in.nextInt(); while (0 < tc--) { n = in.nextInt(); m = in.nextInt(); edged = new ArrayList[n+1]; fo...
9aab601c-e1fe-4333-a57f-385178a6951e
0
public String getMethodName() { return methodName; }
538f28ec-58aa-4fa4-8bbc-11f7ef7e2391
5
@Override protected Void doInBackground() throws Exception{ OctTreeNode world = new OctTreeNode(8); //OctTreeNode.fillCube(world, new IntPosition(12,1,1), new IntPosition(14,5,5), new ByteVoxel((byte)0x78)); //OctTreeNode.fillCube(world, new IntPosition(1,12,1), new IntPositi...
92ad4a5d-a768-494c-ac2d-a0ef35127364
9
final public void SimpleExpression() throws ParseException { /*@bgen(jjtree) #SimpleExpression(> 1) */ ASTSimpleExpression jjtn000 = new ASTSimpleExpression(JJTSIMPLEEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getT...
fd104b79-e86f-4883-913b-2ab6b6bdbc5d
0
public static void main(String[] args) { // Upcasting during addition to the array: Instrument[] orchestra = { new Wind(), new Percussion(), new Stringed(), new Brass(), new Woodwind() }; tuneAll(orchestra); }
af9d5722-9b55-4cd5-b317-cdc26bd997b9
2
public void select(String code) { for (T item : getItems()) { if (item.getKey().equals(code)) { setValue(item); break; } } }
6ed26505-594b-4907-9877-ddda70a3d22d
8
public TxtGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 814, 470); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new BorderLayout(0, 0)); JScrollPane scrollPane = new JScrollPane(); conten...
9dca18ad-4e31-4f2b-9e83-e6f2f8293c65
0
@Override public void setModules(Vector modules) { this.modules = modules; }
27fbb147-a927-499c-80db-38f26b8ac076
6
private String convertStarRatings(String str){ if(str == null) return ""; String ret = ""; if(str.contains("100%")){ ret = "5"; }else if(str.contains("80%")){ ret = "4"; }else if(str.contains("60%")){ ret = "3"; }else if(str.contains("40%")){ ret = "2"; }else if(str.contains("20%")){ ret = ...
7e826ddc-5604-4ef4-a4b3-15cd32b6e4cf
4
private float[] readColor(StringTokenizer tokenizer) { float[] components = new float[5]; float[] result; int i = 0; while (tokenizer.hasMoreTokens()) { String token = tokenizer.nextToken(); try { components[i] = Float.parseFloat(token); ...
869c1e4d-36ec-4db7-b504-c3c75d97b372
1
private void compute_pcm_samples7(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[7 + ...
91ad38b6-eb5d-4f8d-ae7e-e27fe72e95f6
7
public static ParameterCreator<?> extract(Annotation[] annotationsOfOneParameter, Map<String, String> properties){ for (Annotation annotation : annotationsOfOneParameter) { if(annotation.annotationType() == ClassInject.class){ return new ClassNameBasedCreator((ClassInject)annotation); }else if(annotation.an...
237d3d7c-c08a-4673-a822-03ab8bc25e5e
3
public boolean removeResource(Resource r, int count) { ResourceItem ri = findResource(r); if (ri == null) return false; if (ri.count < count) return false; ri.count -= count; if (ri.count <= 0) items.remove(ri); return true; }
4632170c-1259-421a-8ded-d9a6fd9ea305
7
public static int cycleSort(int[] array) { int writes = 0; // Loop through the array to find cycles to rotate. for (int cycleStart = 0; cycleStart < array.length; cycleStart++) { int item = array[cycleStart]; int pos = cycleStart; for (int i = cycleStart + 1; i < array.length; i++) { if (array[i]...
46e846c5-d580-46c0-87ae-0ce359ed4e5a
5
public void paint(Graphics paramGraphics) { if (this.GroundBufferTainted) { if (this.GroundTaintArea == null) { this.GroundTaintArea = this.DEFAULT_GROUND_TAINT; } if (this.GroundBlit != null) { Rectangle localRectangle = Renderer.this.GroundBufferGra...
d9cea506-1630-48e3-b180-7400fbc10b72
2
public Boolean getDataTable(JTable table) { dataTable = new Object[table.getRowCount()][table.getColumnCount() - 1]; int g = 0; for (int i = 0; i < table.getRowCount(); i++) { g = 0; for (int j = 1; j < table.getColumnCount(); j++) { dataTable[i][g] = tabl...
b35efe8f-41cb-4d7e-8939-b8dae3c465f9
1
public Combination(List<Token<T>> tokens) { if (tokens.size() != 5) { throw new IllegalArgumentException("No way. You need 5 tokens"); } this.tokens = new ArrayList<Token<T>>(tokens); }
6daf9cfd-0225-49bc-a699-9149a79f3cd6
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
e3a560d9-4ed4-43af-b8e5-b5a78fda7044
9
public void write(String transactionName, String variableName, int value, long timestamp) { Transaction transaction = transactionMap.get(transactionName); if( transaction != null && transaction.getType() == Transaction.Type.READ_WRITE) { Lock lock = lockManager .acquireWrite(tran...
992e79f5-7b75-46fa-a879-ec311fefc734
7
public List<LargeSongElement> generateRandomSongStructure() { List<LargeSongElement> result = new ArrayList<LargeSongElement>(); Random rnd = new Random(); List<SongElementType> overallForm = songSchemes.get(rnd.nextInt(songSchemes.size())); LargeSongElement songVerse = new LargeSongElement(SongElementTyp...
ee689b09-f52a-40a8-9304-aa7eac8764e9
3
public int bulkInsert(DatasetObject obj) throws Exception{ File bulk_load_in_progress_f=new File(indexDirectory+"/bulk_load_in_progress.dat"); if(bulk_load_in_progress_f.exists()){ int id=objDb.insert(obj); TreeMap<Double,Integer> knp; if(isUseIntrinsicDimensionality(...
459a011d-97a0-4e65-8288-97d40a32aced
9
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub PrintWriter out = response.getWriter(); String action = request.getParameter("action"); String zone = request.getParameter("zone"); if(action==null){ out...
18e33615-1a60-4245-ad66-b2f1cae0ae7a
1
void addListener(Listener l) { if (log.isLoggable(Level.CONFIG)) { log.config("Adding Notification Listener " + l); } ll.add(Listener.class, l); shouldFire = true; }
72d133e9-6d6c-42aa-b4f4-02827ffc8f45
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MavenModule other = (MavenModule) obj; if (artifactId == null) { if (other.artifactId != null) return false; } else if (!artifactId.equa...
2be172eb-b63d-43ae-a0f0-25378ea939e6
4
public List<String> getChildTable( String AttributeName, String SituationName ) { List<String> newTextList = new ArrayList<String>(); String Headers[] = this.textList.get(0).split(","); int AttrIndex = 0; for ( int i = 0; i < Headers.length; i ++ ) { if ( AttributeName.equals(Headers[i]) ) { AttrIndex...
f47e7526-63de-4050-93fc-5cf7448044de
7
public static void DFS(WUGraph t, DFSVertex current, DFSVertex prev, int[] maxOnPath, int maxEdge) { Neighbors neigh; int i; current.visited = true; maxOnPath[current.number] = maxEdge; neigh = t.getNeighbors(current); if (neigh != null) { for (i = 0; i < neigh.ne...
84b308ca-d677-4909-b75a-c925d92ff863
2
@Override public void received(final Connection connection, final Object object) { manager.setRegisteredClientId(connection.getID()); if (object instanceof PacketDTO) { PacketDTO dto = (PacketDTO) object; logger.trace("received package #" + dto.getPacketNr()); manager.addReceivedPackageDTO(dto); } else ...
b13d08ac-9d54-47dc-bab8-49aa080bf4ce
8
@Override public Map< String , Map<Place, Float> > scorePlaces(Map<String, List<Place>> placesByMaxRating) { float totalRatingOfCat = 0F; int totalVotesOfCat = 0; float score = 0F; int totalPlaces = 0; float averageRatingOfCategory = 0F; float averageVotesOfCateogory = 0F; Map<Place, Float> placesWi...
d9ea7f1e-a1d1-4a09-b345-040cfd8482eb
5
public Object nextEntity(char a) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { break;...
a777e1c8-1f29-4e5d-b7a5-91d6576bc554
7
public int doCompare(WorldRenderer par1WorldRenderer, WorldRenderer par2WorldRenderer) { if (par1WorldRenderer.isInFrustum && !par2WorldRenderer.isInFrustum) { return 1; } else if (par2WorldRenderer.isInFrustum && !par1WorldRenderer.isInFrustum) { retu...
e4e370c5-df5c-44e6-84e8-845be5a5e570
9
@Override public String getHelp(MOB user, PhysicalAgent target, String rest) { final String word=CMLib.english().getFirstWord(rest==null?"":rest).toUpperCase().trim(); if (word.equals("READ")) return "USAGE: "+getCommandWord()+" READ \"<FILENAME>\": returns contents of the file or directory as a block."; els...
572ab0f2-283d-4c66-8306-972ee06f2060
2
public void dragOver(DropTargetDragEvent e) { if (!((mxGraphTransferHandler) graphContainer.getTransferHandler()) .isLocalDrag() && JTableRenderer.this != dragSource) { Point p = e.getLocation(); int row = rowAtPoint(p); getSelectionModel().setSelectionInterval(row, row); } }
b5751796-728b-4146-ba14-f4eabbf146d5
5
public static void write(Matrix matrix, String path) throws MatrixIndexOutOfBoundsException { int rows = matrix.getRowsCount(); int cols = matrix.getColsCount(); BufferedWriter buffer = null; long startTime = System.currentTimeMillis(); try { buffer = new Buffered...
a7874c0d-3bbd-4c2e-b46a-1be19cf1c543
6
public boolean removePointAt(int x, int y) { if (type!=TYPE_POLY) return false; for (int i=0; i<poly.npoints; i++) { if (x>=poly.xpoints[i]-2 && x<=poly.xpoints[i]+2 && y>=poly.ypoints[i]-2 && y<=poly.ypoints[i]+2) { remove_polypoint(i+1); return true; } } ...
a0aa241b-6020-44b0-b9d9-2cb7da944a09
7
@Override public Vocabulary parse(Expression expression) throws ExpressionParserException { Vocabulary vocabulary = new Vocabulary(); setDefaults(vocabulary); // vocabulary definition should be compound List<Expression> nested = getNested(expression); for (Expression exp : nested) { String identi...
55878135-cad3-447c-bf91-6cc0d362f560
5
private void forecastGridlet() { // if no Gridlets available in exec list, then exit this method if (gridletInExecList_.size() == 0) { return; } // checks whether Gridlets have finished or not. If yes, then remove // them since they will effect the MIShare calcul...
f4884b78-0a28-45e5-96da-510e5089513a
4
@Override public DetectResult doDetect(DetectParameter parameter) { LOG.info("do connect of " + getDetectName() + " start ..."); result = new DHCPDetectResult(); try { start(); // dhcp discover process LOG.info("DHCP discover process..."); d...
71984fa5-f939-4c44-90dc-159bab3bab9a
3
String change(String sequence, int numChanges, Random rand) { HashSet<Integer> changedPos = new HashSet<Integer>(); char chars[] = sequence.toCharArray(); for( int i = 0; i < numChanges; ) { int pos = rand.nextInt(chars.length); if( !changedPos.contains(pos) ) { // Already changed? int newCode = rand....
101e189f-04b2-40ca-8742-030716351a35
5
private void calculateExperimentalImpedances(){ if(this.referenceSet && this.appliedVoltageSet){ for(int i=0; i<this.numberOfFrequencies; i++){ // voltage divider calculation this.impedances[i] = (this.referenceImpedance.times(this.voltages[i])).over(this.appliedVolt...
898ff4fe-3049-4303-9f6c-a69b332a6d10
5
@Override /** * Update images for poke & terror, and else. */ public void update(Observable o, Object arg) { if (arg == GameEvent.POKE) { showPokeTimer.restart(); } else if (arg == GameEvent.TERRIFY) { showTerrifyTimer.restart(); } else if (arg == GameEvent.RESET || a...
be888286-81aa-40c0-bcba-92fb6ca3f1ed
4
public int computation(char operation, int value1, int value2) throws IncorrectSymbol { switch (operation) { case '+' : return value1 + value2; case '-' : return value1 - value2; case '*' : return value1 * value2; case '/' : return value1 / value2; def...
af6cbcce-bcdf-41e5-b8ba-1589073bb795
7
private boolean feasible( Level level, int remain_depth ) throws IOException { if ( remain_depth > 0 ) { for ( int step = 0; step < 5; step++ ) { Level step_level = new Level( level ); if ( step == 4 ) { step_level.swapHunter(); ...
317b4a5a-2f5a-43da-9800-797bdb713e5e
9
public Frame(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "frameborder": frameborder = Frameborder.parse(this, v); break; case "longdesc": longdesc = Longdesc....
c447db15-d933-4f04-8034-3b2ac1e9d273
4
public void actualiza() { if (inicio) { long tiempoTranscurrido = System.currentTimeMillis() - tiempoActual; pelota.avanza(); if (canasta.getMoveLeft()) { canasta.setPosX(canasta.getPosX() - 15); } if (canasta.getMoveRight()) { ...
e8522f9e-e2e9-4511-8515-f21e822822bb
1
public int[] directWavelet(int c[], int h) { int result[] = new int[h * h]; for (int i = 0; i < (h * h) / 2; i++) { result[2 * i] = ((c[2 * i] + c[2 * i + 1])); result[2 * i + 1] = ((c[2 * i] - c[2 * i + 1])); } return result; }