method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6ea58b6c-73c5-4601-ab1e-2257306a4d62
3
public void initiallizeWithHtmlTemplate(){ if (isFileEmprtyAtStart) { String htmlTemplatePath = "C:\\GitRepos\\JavaToSVG\\Templates\\html_template.html"; String line; Path templatePath = Paths.get(htmlTemplatePath); try(BufferedReader reader ...
78e9a48f-6c6b-4501-bd38-1d0d073e1f2d
1
public PropertyTree(Property property,PropertyTree parent) { this.property=property; this.parent=parent; this.children=null; if(parent!=null) parent.addChild(this); }
483e404c-4eb9-4220-a146-fbd028f194b7
3
public static void main(String[] args) { System.out.println("hello".substring(0,3)); int val = 268435456; String inter = Integer.toBinaryString(val); while(inter.length()<32) { inter = 0+inter; } String highest4bits = inter.substring(0, 4); Str...
c80c1afd-efbd-415b-90a0-59b09f03d41d
7
static final void method3146(int i, int i_0_, byte i_1_, int i_2_, int i_3_, int i_4_, byte[] is, byte[] is_5_, int i_6_) { try { anInt9464++; int i_7_ = -(i_0_ >> -394325566); i_0_ = -(i_0_ & 0x3); if (i_1_ >= -12) method3148(true); for (int i_8_ = -i_3_; i_8_ < 0; i_8_++) { for...
b8abb134-d251-4ded-93bd-b8587bf10105
6
public ArrayList<ArrayList<String>> splitClauses(Sentence input) { tokenizedSentence = input.getSentence(); charIdentifier = input.getPosTags(); int previousIndex = 0; for (int index = 0; index < tokenizedSentence.size(); index++) { if ((tokenizedSentence.get(index).matches...
de684972-69c8-4e71-99fe-0251d03cfcf9
7
@Override public void performInteraction(GameModel g, Unit myUnit) { if (!myUnit.hasAttribute("Attack")) return; AttributeAttack att = (AttributeAttack) myUnit.getAttribute("Attack"); ArrayList<Tile> tileList = g.getMap().getTilesList(); for (Tile t : tileList) { ...
09ba01da-9fd7-4d70-8943-5aabc5b41ab4
3
public void AddTlv(int tag, String value) { if (tag == TlvId.LinkID) { this.LinkID = value; } else if (tag == TlvId.Mserviceid) { this.ProductID = value; } else { if (this.OtherTlvArray == null) { Tlv[] tmp = new Tlv[1]; tmp[0] = new Tlv(tag, value); this.OtherTlvArray = tmp; } else { ...
4c1669f5-d428-4457-98f6-98ebf77b063b
0
public add() { this.info = "add a new venue"; this.addParamConstraint("name"); this.addParamConstraint("capacity", ParamCons.INTEGER); this.addRtnCode(201, "already exists"); }
ed707eb8-fb7c-41c3-b384-d002628f19a9
0
@Override public String getName() { return NAME; }
4f309e95-482d-4ab7-8386-85243ea7eae1
6
public void setGameType(String game) { GameType = game; if (game.equals("matchcard")) { if (matchestowin == 6) { for (int i = 0; i < 6; i++) { list4x3.add(i); list4x3.add(i); } } else if (matchestowin == 10) ...
efd9a686-d15e-4354-b7f4-e7fcb1ebf46b
1
private String getFloatValue(final Field field, final Object object) { Object result = getRawValue(field, object); if (result == null) { result = ""; } return result.toString(); }
0345a7d3-fb84-4e5b-a839-49fe52fc310d
2
private static String getValue(String value) { return (value == null || value.trim().length() == 0) ? null : value.trim(); }
fe58e1f0-db45-43fb-b659-0c2788b6d1a1
7
* @return Kodierung des Konfigurationsverantwortlichen */ private short getAuthorityCoding(final ConfigurationConfigurationObject configurationObjectProperties) { final ConfigurationObjectElements[] datasetAndObjectSet = configurationObjectProperties.getDatasetAndObjectSet(); for(ConfigurationObjectElements elem...
fb082e0a-0a13-4f11-a2d6-895a26591cac
2
public void setUp() throws Exception { try { d = new Database("dbauth.txt"); /*d = new Database("localhost", "postgres", "", "myapp_test"); //For travis-ci*/ try { d.initTables(); } catch(Exception e) { d.cleanTables(); ...
4c8cafb6-bd7d-464e-bf35-4b293008d89d
0
@AnnotationTestTool public void method2() { System.out.println("method1"); }
eb6a0d7f-d9bc-4480-a40e-064b24ec9eb8
7
public void steprun2() throws IOException { // FrontEnd.exceptionraised = 0; // handlers.clean_branchtable(); // handlers.clean_memtable(); FrontEnd.activepane.getHighlighter().removeAllHighlights(); //FrontEnd.activepane.setSelectionColor(new Color(1.0f, 1.0f, 1.0f, 0.0f)); ...
b1c5a2f5-0314-4457-ab97-bf05ce039a83
7
public void setValuesWithMappingNameMap(final Map<String, Object> map, final ValueVisitor defaultVisitor) { Class<?> clazz = getClass(); final FieldDefinitionImpl thiz = this; try { SpringReflectionUtils.doWithFields(clazz, new SpringReflectionUtils.FieldCallback() { public void doWith(Field fie...
d254f896-fd29-4c46-b0fd-35921fbf9e97
3
public void onReceiveBid(MessageBid bid){ if (bid.getRound() == super.currentRound()) { if (bestBid == null) { bestBid = bid; synchronized (syncIncr) { shouldDecrease = true; } } else { if (bestBid.getRound() < bid.getRound()) { bestBid = bid; synchronized (syncIncr) { shoul...
f951bf61-9979-42e0-950d-02d6ae2230f7
5
public ListNode deleteDuplicates(ListNode head) { if(null == head || head.next == null) return head; ListNode current = new ListNode(0); current.next = head; ListNode result = current; ListNode normal = current.next; ListNode compared = normal.next; ...
eb33144c-ae2d-4d89-8c32-721631e20bd6
9
private void initActions() { for (int i = 0; i < tools.length; ++i) { final Tool tool = tools[i]; String group = tool.group; if (group.equals("tool")) { tool.action = new Runnable() { public void run() { setPaintTool(tool.id); } }; } else if (group.equals("fill")) { tool.action...
6423fa6f-a964-4eb8-9498-ce90a5bca4c3
6
public void warp(){ if(warped) return; random = false; destroyBodies(); scene = nextScene; scene.create(); if(warp!=null){ Vector2 w = warp.getLink().getWarpLoc(); createPlayer(w); if(warp.getLink().warpID==1 && !character.isFacingLeft()) character.setDirection(true); if(warp.getLink().warpI...
218b1e5d-f6ef-4472-b5e4-fa6f3a395ba4
2
private boolean message_ready() { // Message is completely read. Push it further and start reading // new message. (in_progress is a 0-byte message after this point.) if (msg_sink == null) return false; boolean rc = msg_sink.push_msg (in_progress); ...
07d6a31a-c342-4dd2-94ae-5a8181e1fac9
4
private void rotateUp(Node child) { assert child != null && child.parent() != null && child.parent().parent() != null; Node parent = child.parent(); Node grandparent = parent.parent(); if (grandparent.left() == parent) { grandparent.setLeft(child); } else { g...
2af75992-fa03-4f17-bce2-ee1917fc1149
1
public static void writeComment( StringBuffer buf, int depth, String line_ending, String comment ) { indent(buf, depth); buf.append("<!--"); buf.append(escapeXMLComment(comment)); buf.append("-->"); if (line_ending != null) { buf.append(line_ending); } }
43846b2c-54d9-41a8-932f-55c99e672f2f
7
private void doPaintBucketReg(int x, int y, Color newCol, Color currentCol) { // make sure it's on the image if (x > -1 && y > -1 && x < this.getDrawingWidth() && y < this.getDrawingHeight() && this.getPointColor(x, y).equals(currentCol)) { this.drawPoint(...
a90438fb-ec1e-484a-8165-e7fdc48acf8e
7
public MainView(Shell shell) { this.shell = shell; addFileDropTarget(shell); createMenubar(shell); SashForm sash = new SashForm(shell, SWT.NONE); this.fileList = new FileList(sash); Composite right = new Composite(sash, SWT.NONE); this.tabs = new CTabFolder(right, SWT.NONE); GridLayout grid...
c0885810-8338-4d84-8ef0-b5310bf0fb35
0
TestState(final String description, final char state) { this.description = description; this.state = state; }
a1ed76d3-7b19-4e83-a352-7552aa692a0c
1
List<Score> matchCouple(List<Person> ps, List<Person> left){ left.clear(); System.out.println("matching"); Map<Person, List<Score>> table = calculateAffinity(ps); // List<Score> result = matchCoupleRound(table); ps.stream() .filter(p -> result.stream().noneMatch...
3e1345e8-4567-49a6-a787-8e9e1caa6ebe
2
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (isSelected && (-1 < index)) { list.setToolTipText(((File) list.getModel().getElementAt(index)).getPath()); } ...
aa18f15b-14bc-4ed0-bad1-3cf6b43ff461
0
private void nowaPaczka() { this.campaign.clearCampaign(); this.campaign.setGameDate(projectTabPane.getGameDate()); projectTabPane.initiateGameFields(); projectTabPane.updateGraph(); repaint(); }
9ab520bf-b693-4846-9cd7-e607a8e01c8b
5
public int clearLines() { int numClearedLines = 0; for (int curOldLine = board.length-1 ; curOldLine >= 0; curOldLine--) { if (curOldLine >= 2 && board[curOldLine] == 0x3ff) numClearedLines++; else board[curOldLine + numClearedLines] = board[curOldLine]; } for (int i = numCle...
e5683a2f-e531-48b6-8cc6-fd98f9500e08
1
public boolean setUserlistImageWidth(int width) { boolean ret = true; if (width <= 0) { this.userlistImg_Width = UISizeInits.USERLIST_IMAGE.getWidth(); ret = false; } else { this.userlistImg_Width = width; } somethingChanged(); retur...
57e12f7a-68a6-4385-bc95-ccc235ea9888
0
@Test public void getIndexOutOfBoundsReturnsNull() { a.insert(v); assertEquals(null, a.get(Integer.MAX_VALUE)); assertEquals(null, a.get(-1)); }
dffb82a9-98a9-49f4-8c15-09a08b897232
5
public static void main(String[] args) { try { String f1 = "/home/mayank/DistributedSystems/test1.txt"; File file1 = new File(f1); FilePartition fp1 = new FilePartition(f1, 13, file1.length()); TextRecordReader reader = new TextRecordReader(fp1, null); Record<String, String> record; while( (r...
1138c75a-3854-4090-8f2e-cec1220db053
4
public static synchronized User addUser(String username, ArrayList<User> users) { users = DataReader.getUsers(); // check if the user exists for (User u : users) { if (u.getUsername().equalsIgnoreCase(username)) { System.out.println("User already exists"); return u; } } // add the user to th...
ac1d2a79-c229-4718-a72e-be3836a2becb
4
@EventHandler public void onPlayerMove(PlayerMoveEvent e) { Zone zone = plugin.canPlayerWalkTo(e.getPlayer(), e.getTo()); if (zone != null) { if (!e.getPlayer().isDead()) e.getPlayer().sendMessage(zone.getOnEnter()); if (zone.isKillZone()) { if (!e.getPlayer().isDead()) e.getPlayer().setHe...
4c0ed45e-9a02-4385-a9d6-d544e25955c3
3
@Override public String format(LogRecord record) { String throwable = ""; if (record.getThrown() != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println(); record.getThrown().printStackTrace(pw); pw...
1f408636-2f88-4c07-a90b-33f1e5ba1d53
6
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout) parent.getLayout(); } catch (ClassCastException exc) { ...
c913cd02-f76e-4a90-bc84-d246df45238e
2
public void clean(double time) { if (time <= 0 || jumpheight == 3) { return; } this.setDirtiness(this.getDirtiness() - time/length); }
c23df00a-56e4-4dcb-b557-32624c17baf3
9
@Override public boolean onCommand(CommandSender sender, Command cmd, String arg2, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length < 1) { player.sendMessage(ChatColor.YELLOW + "Deafened players:"); String plrs = ""; for (String p...
b079cec1-8e35-48c4-84fd-d64f4d52a958
0
public String [] toArray() { return new String [] {String.valueOf(id), String.valueOf(defaultPoints), defaultTime.toString(), name}; }
9f60777a-5212-4fb6-88f8-be8cb93c041f
9
public static Move parseMove(String input) { Move rez = new Move(); int index = 0; while (index < input.length()) { char type = input.charAt(index++); switch (type) { case 'a': rez.addAttack(getArea(input, index++)); break; case 'b': rez.addBlock(getArea(input, index++)); break; case '.': ...
69d61f31-b8de-4055-832b-c7b94acc8c86
9
public double getWinningProbility(int c1,int c2){ if(!reduced){ if(!indexUpdated)updatePositionIndex(); return 1-position[c1*52+c2]; }else{ if(!rankUpdated)updateRank(); if(!positionUpdated)updatePosition(); int queryrank = 0; if(common == 3){ queryrank = FiveEval.getBestRankOf(c1, c2, ...
91c16e03-59e0-40bb-a3d3-878e46766fb7
3
private byte[] CreateData() { //create byte buffer for data byte[] buf = new byte[packetSize]; //holds the character bytes generated StringBuilder s = new StringBuilder(); char c; //generate data for the packet for(int x=0; x< (packe...
77086794-8ae0-41b1-9214-84471f9f68c9
6
public String DELETE_Request(String url, String url_params) { StringBuffer response; String json_data = ""; HttpsURLConnection con = null; try { // url = "https://selfsolve.apple.com/wcResults.do"; // url_params = "sn=C02G8416DRJM&cn=&locale=&caller=&num=12345"; // URL obj = new URL(url); // con = ...
fbf867dd-26ca-44c7-90eb-a8f4ba45254e
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SPKIData") public JAXBElement<SPKIDataType> createSPKIData(SPKIDataType value) { return new JAXBElement<SPKIDataType>(_SPKIData_QNAME, SPKIDataType.class, null, value); }
3af93a67-1fa1-4a9f-afc6-9bdcd3516fbe
6
public CriterionGroup buildCriterionGroup() throws HqlBuildException { if(this.form == null || this.ruleScheme == null){ return new CriterionGroup(); } /** * 1. 生成CriterionResult */ CriterionGroup group = new CriterionGroup(); /** * 遍历Form对象所有属性 * 顺序是映射文件里面从上到下 */ Iterator<String>...
903cab13-0b9c-4232-b4a6-36f24b114891
0
@Override public void toggleEditability(int row, AttributeTableModel model) { Node node = doc.tree.getEditingNode(); String key = (String) model.keys.get(row); Object oldAndNewValue = node.getAttribute(key); boolean oldReadOnly = node.isReadOnly(key); boolean readOnly = !oldReadOnly; node.setReadO...
c22c0df6-4f8d-4b86-a5f8-a0f0084aa4ed
2
public static FileType getType(InputStream is) { String fileHead = getFileHeader(is); FileType[] fileTypes = FileType.values(); for (FileType fileType : fileTypes) { if (fileHead.startsWith(fileType.getValue())) { return fileType; } } return FileType.NOTSUPPORTED; }
d4d423e6-c7be-449e-abfe-2dc7993890a3
4
@Override public void deserialize(Buffer buf) { super.deserialize(buf); targetId = buf.readInt(); startCellId = buf.readShort(); if (startCellId < -1 || startCellId > 559) throw new RuntimeException("Forbidden value on startCellId = " + startCellId + ", it doesn't respect...
e64d4325-772f-4e93-a6b9-14f0faeaf3b1
5
private void drawLabels(double current_time) { // Draw take off button int opacity = (airport.is_active || airport.aircraft_hangar.size() == 0) ? 128 : 256; // Grey out if not clickable graphics.setColour(0, 128, 0, opacity); double y = y_position +height -division_height; if (!airport.is_active) { graphic...
d50df3f6-a967-478a-ad8a-80a7ba57c883
8
private void TfCodProdutoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TfCodProdutoKeyReleased if (!TfCodProduto.getText().equals("")) { prodcompravenda.getForneproduto().getProduto().setCodigo(Integer.parseInt(TfCodProduto.getText())); if (prodcompravenda.getForneproduto()...
53b27c0b-5511-4c3b-a422-e21a96d5394e
4
@Test public void testTop() { Random r = new Random(260379); ArrayList<Integer> workArr = new ArrayList<Integer>(); TreeMap<Integer, Integer> countToId = new TreeMap<Integer, Integer>(new Comparator<Integer>() { public int compare(Integer integer, Integer integer1) { ...
ecf90bf3-1046-4e15-8f51-79fccc84738c
9
private boolean r_postlude() { int among_var; int v_1; // repeat, line 75 replab0: while (true) { v_1 = cursor; lab1: do { // (, line 75 // [, line 77 bra = cursor; // substring, line 77 among_var = find_among(a_1, 4); if (among_var == 0) { break lab1; } // ], line 77 ...
3aef8e0c-9a46-4aa4-8172-2a71ecd2d002
9
protected void configureCurrentConverter(int dialogType) { String filename; File currFile; if ( (getSelectedFile() == null) || (getSelectedFile().isDirectory()) ) return; filename = getSelectedFile().getAbsolutePath(); if (m_CurrentConverter == null) { if (dialogType == LO...
902fa8bf-22b9-4879-a457-c76b1d52c87c
6
@Override public String toString() { StringBuilder sb = new StringBuilder("User("); boolean first = true; sb.append("firstName:"); if (this.firstName == null) { sb.append("null"); } else { sb.append(this.firstName); } first = false; if (!first) sb.append(", "); sb.appe...
180352b4-558d-4215-b700-042401e93bc2
9
public BreakPoint commitMinPenalty(int space, int lastSpace, int minPenalty) { if (startPos == -1 || lastSpace > endPos - startPos || minPenalty == 10 * (endPos - startPos - lastSpace)) { /* We don't have to break anything */ startPos = -1; childBPs = null; return this; } int size = c...
ab05b9ad-029a-48f6-913e-2c0fd2be8da1
1
public static void write (org.omg.CORBA.portable.OutputStream ostream, pgrid.service.corba.repair.RepairIssue[] value) { ostream.write_long (value.length); for (int _i0 = 0;_i0 < value.length; ++_i0) pgrid.service.corba.repair.RepairIssueHelper.write (ostream, value[_i0]); }
eef5c226-9329-4d85-b05b-d03576220f6e
2
public String getContenido(File file) throws IOException { String contenido = ""; if (file.exists()) { try { contenido = new Scanner(file).useDelimiter("\\Z").next(); } catch (FileNotFoundException ex) { } } return contenido; }
4001bfb8-c6ff-42e9-ace4-21326b04bf0f
9
public int ladderLength(String start, String end, Set<String> dict) { if (dict.size() == 0) return 0; int curLevel = 1; int nextLevel = 0; int steps = 1; boolean isEndReached = false; Queue<String> bfsQueue = new LinkedList<String>(); Set<String> visited = new HashSet<String>(); bfsQueue.add(start); ...
72b68ab5-2973-4272-b350-71efa55ae130
7
public void update(double diff) { if (shootTimer <= diff) { shoot(); shootTimer = 500; } else shootTimer -= diff; if (path.isEmpty()) { int directionDiff = 300; if (Game.bounds.contains(left ? me.getX() - directionDiff : me.getX() + directionDiff...
815766d2-d51a-4225-ac9e-df50e5acb15e
1
public int getInt(String key) throws JSONException { Object o = get(key); return o instanceof Number ? ((Number)o).intValue() : (int)getDouble(key); }
c5610f2c-1ea4-4535-94aa-0e73eb7f1f94
3
public int getNodeID(int x, int y) { for(int i = 0; i < nodes.size(); i++) { if(x == nodes.get(i).getX() && y == nodes.get(i).getY()) return i; } return -1; }
c0b44b7a-a3f4-4d53-9773-d13f5106959b
5
public void propertyChange(PropertyChangeEvent e) { if(e.getPropertyName().equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File newFile =(File)e.getNewValue(); if (newFile != null){ if ((newFile.isFile()) && (FileDialogs.isImage(newFile))) { Str...
29f7055f-b52c-4498-9f26-461d44dc6dec
7
public static ItemStack setCustomBlockAmount(ItemStack item, int amount) { if ((amount <= 0) || (item == null) || (!item.hasItemMeta())) return null; ItemMeta meta = item.getItemMeta(); if ((meta == null) || (!meta.hasDisplayName())) return item; String title = meta.getDisplayName(); if ((title == null...
81c26819-d76d-4ba1-b189-053ed36bdf13
9
public static void main( String[] args) { if(args == null || args.length == 0) { System.err.println( "usage: java MappedPlaceholderResource <resourcefile basename> [[key] [value]] ..."); System.exit(1); } try { MappedPlaceholderResource mpr = new MappedPlaceholderResource(args[0]); ...
ad43e7d0-3d10-49a8-a4e6-652c5f2cf522
0
@Test public void itShouldSerializeMultiPoint() throws Exception { MultiPoint lineString = new LineString(new LngLatAlt(100, 0), new LngLatAlt(101, 1)); Assert.assertEquals("{\"coordinates\":[[100.0,0.0],[101.0,1.0]],\"type\":\"LineString\"}", mapper.toJson(lineString)); }
378031cd-839b-461e-b1a9-aff7bb6c9058
7
private static void rsaEncrypterFile(CryptobyConsole console) { // Input Path to File for encryption scanner = new Scanner(System.in); scanner.useDelimiter("\n"); System.out.println("Enter Path to File for Encryption (Type '" + quit + "' to Escape):"); if (scanner.hasNext(quit))...
d9c0082c-5ff5-4c76-8b3e-e9aa21b9c175
7
public List findRecords(String sqlString, boolean closeConnection) throws SQLException, Exception { Statement stmt = null; ResultSet rs = null; ResultSetMetaData metaData = null; final List list=new ArrayList(); Map record = null; // do this in an excpetion handler so that we can depend on the // fina...
d15b04ff-6c50-46e1-b413-4c0deeb60d51
2
public static void main(String args[]) { //MagicPower.setMP(999); GraphicDisplay gd = new GraphicDisplay(); Game game = new Game(gd); game.init(); gd.setGame(game); gd.menu(); //gd.setup(); // game.getMap().addTower(2, 2); // game.getMap().addTower(6, 1); // game.getMap().addTower(8, 1); // ...
9ddec840-98e8-430d-b3e5-512d9ad51fe5
6
public void startTeleport2(int x, int y, int height) { if(c.duelStatus == 5) { c.sendMessage("You can't teleport during a duel!"); return; } if(c.duelStatus >= 1 && c.duelStatus <= 4) { Client o = (Client) Server.playerHandler.players[c.duelingWith]; c.duelStatus = 0; o.duelStatus = 0...
16e6d170-b2ab-4f2d-8dbc-e2378cfe1753
3
public static Sha1Hash forValue (Value<?> value) { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA1"); } catch (NoSuchAlgorithmException e) { // If the SHA1 algorithm doesn't exist, returns null return null; } BencodeOutputS...
2d62593e-32f7-497b-8340-6765a8b6c3c7
8
public Car issueCar(DrivingLicense drivingLicense, String typeOfCar){ Date now = new Date(); Car c = AbstractCar.getInstance(typeOfCar, RegistrationNumber.getInstance(extracted(registrationNumber).getLetterIdentifier(), extracted(registrationNumber).getNumberIdentifier()), fuelCapacity, fuelInCar, carRented); lo...
44db59c5-7160-48c3-ad0f-028d05ad0097
9
private void readNormalPatchContent(SinglePatch patch) throws IOException, PatchException { List<Hunk> hunks = new ArrayList<Hunk>(); Hunk hunk = null; Matcher m; for (;;) { String line = readPatchLine(); if (line == null || line.startsWith("Index:")) { ...
406cf21c-c1f4-48e8-9d71-34974ef05f04
3
@Override public Attributes clone() { if (attributes == null) return new Attributes(); Attributes clone; try { clone = (Attributes) super.clone(); } catch (CloneNotSupportedException e) { throw new RuntimeException(e); } clone.attr...
2db470b9-aff9-4bcb-8ae0-47af715072ef
0
public static void main(String[] args) { Flower x = new Flower(); x.printPetalCount(); }
ba90c929-de6b-482e-8973-e22f40137ca0
8
public boolean readBuffersFromNextSoundInSequence() { if( !toStream ) { errorMessage( "Method 'readBuffersFromNextSoundInSequence' may " + "only be used for streaming sources." ); return false; } synchronized( soundSequenceLock ) ...
bb27a3ea-e726-4487-95b3-bea74ef09370
5
public boolean checkDraw() { if (drawCounter == 42 && !(checkVertical() && checkMainDiagonal() && checkAntiDiagonal() && checkHorizontal())) { game.setGameIsOver(true); return true; } ...
9f9e7da2-ecaa-46f4-a26f-88dd186f9ad8
5
public Vector getAcceleration(){ Vector accel = new Vector(0,-12); if( isOnGround ){ accel.x = controller.getX()*3; } else if ( controller.getButtonJump() && jetpackFuel > 0 ){ accel.x = controller.getX()*12; } else { accel.x = controller.getX()*1; } if( controller.getButtonJump() && jetpackFuel...
1f0476d1-f221-4ac4-9f67-f279549e8cb6
0
public int getStudentCategoryId() { return studentCategoryId; }
e7b68ced-348e-46d7-95a8-d3d8dd24c5ef
0
public String getDerivation() { return derivation; }
e9740869-9e7f-4c0a-ab2b-c183ccf8a98e
6
void setElement(String name, int contentType, String contentModel, Hashtable attributes) throws java.lang.Exception { Object element[]; // Try looking up the element element = (Object[]) elementInfo.get(name); // Make a new one if necessary. if (element == null)...
1817ef02-32bd-41a0-97a8-782968e347df
1
private void moveCamera(MouseEvent e) { //System.out.println("============= Move camera ============"); try { dragEndScreen = e.getPoint(); Point2D.Float dragStart = transformPoint(dragStartScreen); Point2D.Float dragEnd = transformPoint(dragEndScreen); do...
e17fdfbd-7aec-4777-a0a2-a6a483824347
4
public void run() { Socket sckOut = null; InetSocketAddress isaTmp = null; try { sckOut = new Socket(); sckOut.bind ( new InetSocketAddress ( EzimNetwork.localAddress , 0 ) ); isaTmp = new InetSocketAddress ( this.addr , this.port ); sckOut.connect(isaTmp,...
fd42574a-ff6f-4bac-90f8-b278683e5b94
8
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); HttpSession session=request.getSession(true); Con...
668c57ff-1b4e-4c6f-9fa0-2e8620e13e11
7
public EventInfo(String name, String loc, String id, String note) { final JFrame eventInfo = new JFrame(); eventInfo.setVisible(true); eventInfo.setTitle("Event Info"); eventInfo.setLocationRelativeTo(CalendarPanel.bullseye); eventInfo.setSize(400, 300); JPanel infoPanel = new JPanel(); eventInfo.getCon...
9b992ffc-779c-43ff-bb45-9f5815ac4f50
4
private void maxHeapify(int pos){ if(!isLeaf(pos)){ if(myHeap[pos].compare(myHeap[this.leftChild(pos)]) == -1 || myHeap[pos].compare( myHeap[this.rightChild(pos)]) == -1){ if(myHeap[this.leftChild(pos)].compare(myHeap[this.rightChild(pos)]) == 1){ swap(pos, this.leftChild(pos)); maxHeapify(this.leftC...
b366c429-02e6-49c3-8a01-b418785ae112
9
public void keyPressed(KeyEvent e) { if(count>=3 && count<5) picnum=6; if(count>4) picnum=7; if(count<3) picnum=5; int key = e.getKeyCode(); if(key == 37) direction = LEFT; else if(key == 38) direction = UP; else if(key == 39) direction = RIGHT; else if (key == 40) directio...
f8559214-88ef-42d0-a755-8a91af59cc92
8
private static List<String> tokenise(String string, Map<Character, Match> matches, char escapeChar, boolean includeSplitCharAsToken) { List<String> tokenised = new LinkedList<>(); StringBuffer sb = new StringBuffer(); boolean escape = false; for (char c : string.toCharArray()) { if (!escape && matches.conta...
a139e603-ef93-4e33-b491-b38533cb401b
5
@Override public void caseAParaPassoComando(AParaPassoComando node) { inAParaPassoComando(node); if(node.getVar() != null) { node.getVar().apply(this); } if(node.getADe() != null) { node.getADe().apply(this); } if(node.getAP...
c45a9cb7-59ea-4840-9ccf-7dd669c914be
7
@SuppressWarnings("unchecked") @Override public <T extends Serializable> DiagnosisChannel<T> channel(Class<? extends DiagnosisChannelID<T>> channel, ChannelOption... options) { // In case we are disabled, return a dummy if (this.isD...
c52f632d-f260-4abb-901e-7f3ee16891da
7
private boolean isBlocked(float x, float y) { boolean blocked = false; float tweakedX = x + 4; float tweakedY = y + 8 + mapY; int rowCount = genX / blockSize; int startY = (Math.round(mapY / blockSize))* rowCount + 1; int endY = (Math.round((mapY + screenHei...
d33e01b1-70cb-4133-aa3c-a828b94fb023
5
public void run() { while (true) { try { String msg = (String) sInput.readObject(); // if console mode print the message and add back the prompt if (cg == null) { System.out.println(msg); System.out.print("> "); } else { cg.append(msg); } } catch (IOException e) { ...
d30866b1-2e25-4d6c-89ca-31db784e42bd
4
public void updateForecast() { Date date = new Date(); long maxTimeNoUpdate = Long.parseLong(config.getWeather_expiration_time()); long timeNow = date.getTime()/1000L; long timeLastForecast = 0; try { crs = qb.selectFrom("forecast").all().executeQuery(); if(crs.next()){ timeLastForecast = crs.getD...
099ae000-00ab-4b08-800d-aca4daa2a509
9
public HGSearchResult<T> execute() { switch (scanType) { case keys: return ((HGIndex<T, ?>)index).scanKeys(); case values: ((HGIndex<?, T>)index).scanValues(); default: switch (operator) { case EQ: return ((HGIndex<Object, T>)index).find(key.get()); ...
bcb1baa5-150c-4d8a-8ab5-7bda2f89ce6a
1
public void NextQuestion() { if(i == QuestionCount -1 ) { i = 0; } else { // Current Question Id incremented by 1 i++; } // Display question in form this.SetUp(); }
91525471-e08d-44ca-941d-35a0edf58dab
4
private void trickleDown(int index) { int largerChild; BTPosition<T> top = heap.get(index); while (index < size / 2) { int leftChild = 2 * index + 1; int rightChild = leftChild + 1; if (rightChild < size && comp.compare(heap.get(leftChild).element(), heap.get(rightChild).element()) < 0) ...
7b3fafd4-720f-407d-baf0-d8c0d23a9243
8
@Override public String getOutputStatement(String toDisplay) { int l = toDisplay.length(); int dl = l * 2 + 11; if (dl < 0) dl = l; StringBuilder sb = new StringBuilder(dl); sb.append("println(\""); for (int i = 0; i < l; i++) { char c = toDisplay.charAt(i); switch (c) { case '\\': sb.appen...
e9aaf5e1-46d3-4a13-8b36-4b878fdf2388
9
public int minCut(String s) { int min=0; if(s==null||s.length()==0){ return min; } int len=s.length(); int[] cuts=new int[len+1]; boolean[][] matrix=new boolean[len][len]; //initiate the cuts to the worst condition for(int i=0;i<len;i++){ cuts[i]=len-i; ...
9ae75bcf-f2a9-47dc-8cd0-2f93abbe379f
7
private static void loadOptions() { File inputFile = new File("haven.conf"); if (!inputFile.exists()) { return; } try { options.load(new FileInputStream("haven.conf")); } catch (IOException e) { System.out.println(e); } String hideObjects = options.getProperty("hideObjects", ""); String hideHig...