method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
795b3a68-692a-4666-b4b6-82f1752b0513
9
private String introduceUser(String input) { String userQuestion = ""; if (getChatCount() < 4) { if (getChatCount() == 0) { myUser.setUserName(input); userQuestion = "How many girls have you kissed?"; } else if (getChatCount() == 1) { try { myUser.setGirlsKissed(Integer.parse...
fbff158c-8161-4d92-af07-5e5bea9db14d
6
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed String text = txtBuscar.getText().toString(); LibrosCRUD libro = new LibrosCRUD(MyConnection.getConnection()); ArrayList<Libros> listado = new ArrayList<>(); Libros l = null...
9d25de7d-6b01-4388-88d5-46d3a9bf42a7
3
public SingleTreeNode treePolicy() { SingleTreeNode cur = this; while (!cur.state.isGameOver() && cur.m_depth < ROLLOUT_DEPTH) { if (cur.notFullyExpanded()) { return cur.expand(); } else { SingleTreeNode next = cur.uct(); ...
bd6fc0b1-85dc-45f8-8c13-ee54c41e4811
8
public static void createClusters(final PrintWriter writer, final PgSchema oldSchema, final PgSchema newSchema, final SearchPathHelper searchPathHelper) { for (final PgTable newTable : newSchema.getTables()) { final PgTable oldTable; if (oldSchema == null) { ...
9ff4c602-b1b5-4675-843d-1186c5825430
6
@EventHandler(priority=EventPriority.MONITOR) void onInventoryClick(InventoryClickEvent event) { if (event.getInventory().getTitle().equals(name)) { event.setCancelled(true); int slot = event.getRawSlot(); if (slot >= 0 && slot < size && optionNames[slot] != null) { ...
a2fc5754-7c5a-44f0-b504-956060bd1d0c
5
private void createQuizSlide(Attributes attrs) { quizSlide = new QuizSlide(quizSlideDef); // loop through all attributes, setting appropriate values for (int i = 0; i < attrs.getLength(); i++) { if (attrs.getQName(i).equals("id")) quizSlide.setId(Integer.valueOf(attrs.getValue(i))); else if (attrs.getQN...
69d1e89e-adc9-4b70-b834-b042cadb89c4
8
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 fe...
8d3f27f6-556b-4c5c-803e-83a9d598e4a8
9
public String nextToken() throws JSONException { char c; char q; StringBuilder sb = new StringBuilder(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
82b911b7-2a1a-45f3-ab72-739b7563f4ad
1
public void testStackArray(){ while(!stk.isEmpty()){ System.out.println(stk.pop()); } }
db8da6f0-b9e2-4aa0-a468-e3ae073ded61
9
public void renderLayer(Graphics g, ArrayList<Task> lastLayer, ArrayList<Task> currentLayer, int currentX, int currentY) { // renders layers after the first layer; if (currentLayer.isEmpty()) { // this later is empty, this is the end // close it off for (Task current ...
4518720e-62fe-4d17-b903-d4ab38303293
4
public ShapeConstru(SimpleFeature f, String tipo) { super(f, tipo); shapeId = "CONSTRU" + super.newShapeId(); // Para agrupar geometrias segun su codigo de masa codigoMasa = ((String) f.getAttribute("MASA")).replaceAll("[^\\p{L}\\p{N}]", "")+"-"; this.poligons = new ArrayList<LineString>(); // ...
9fd50bea-13c1-4080-8d7b-efeba36a7957
4
public void serialize(ByteBuffer buffer) { _LOGGER.log(Level.FINE, "Serializing response: " + _status + "/" + _errorCode); buffer.clear(); buffer.putInt(_status); if(_status != STATUS_OK) { buffer.putInt(_errorCode); return; } else if(_message != null) { ...
375c6050-febe-481e-ab1d-88ab0be8b7bd
3
public Praying getPraying(String name) { if(prayings.contains(name)) return null; for(Praying p : prayings) if(p.getName().equalsIgnoreCase(name)) return p; return null; }
7c7f90ef-655a-4562-81f9-d1f72e3c1b94
7
public void arrange(int iterationCounter){ Collections.sort(books); BookNode bi, bj; float vx, vy, vLen; if(books.size()>1){ for(int i=0; i<books.size();i++){ bi=books.get(i); for(int j=i+1;j<books.size();j++){ if(i!=j){ bj = books.get(j); float dx = bj.getX() - bi.getX(); ...
fa48f072-9952-4739-abfb-2df76af9e08f
3
public void startAuction(){ if((super.getOutputPort() == null) || super.getAuctionID() == -1){ System.err.println(this.get_name() + "Error starting the auction. " + "The output port used by the auction is null or" + "the auctioneer's ID was not provided!"); return; } ...
736ade95-5624-44c1-8a84-152d2cc36538
3
private void writeIndexKeys() { String mapperName = table.getDomName() + "Dao"; StringBuilder sb = new StringBuilder(); for ( IndexNode node : table.getIndexList() ) { String methodName = "readByIndex" + toTitleCase( node.getIndexName()); String param = ""; for(...
c58778e1-bdd8-499d-97db-b5292b280d80
2
public FastqBuilder withSequence(final String sequence) { if( sequence == null ) { throw new IllegalArgumentException("sequence must not be null"); } if( this.sequence == null ) { this.sequence = new StringBuilder(sequence.length()); } this.sequence.replace(0, this.sequence.length(), sequence); return this...
6bd328f0-e99c-4495-b8b0-0bdd2fb5086c
8
final Interface18_Impl3 method3855(Class304 class304, int i, int i_54_, float[] fs, boolean bool, int i_55_, int i_56_, int i_57_) { try { anInt9890++; if (i_56_ != 2) ((NativeOpenGlToolkit) this).aMapBuffer9913 = null; if (!aBoolean9926 && (!Class192.method1436(60, i) || !...
e919ef5f-798d-4c14-a129-15445ec5b846
3
public static void main(String[] args){ int max = 0; for(int i=1;i<100;i++){ for(int j=1;j<100;j++){ int dSum = digitSum(power(i, j)); if(dSum>max) max = dSum; } } System.out.println(max); }
6e3056b7-7459-4fb5-a9cb-01c79392bc92
9
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof TarifasParqueaderosPK)) { return false; } TarifasParqueaderosPK other = (TarifasParqueaderosPK) object; if ((th...
bcd10330-cf6f-4e91-b9aa-a0977dd0e33b
5
public static int getInt(byte[] b, int offset) { if (isBlank(b)) { throw new IllegalArgumentException("blank byte array."); } if (offset < 0) { throw new IllegalArgumentException("invalid array offset:" + offset + "."); } int out = b[0] < 0 ? -1 : 0; for (int l = b.length - offset, i = l < INTEGER_BYT...
97eebff9-add5-45a2-b866-e9d6e7f9ca43
9
static protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenB...
10e5092b-1f81-4d30-9827-f2e5fe666ff3
6
@Override public TheaterSeatsReplyMessage seatsRequest(int clientID, int theaterID) throws RemoteException{ TheaterSeats seats = null; TheaterSeatsReplyMessage reply = null; seats = cache.getTheaterSeats(theaterID); if(seats == null){ //Creates a communication channel between this and the DBServer ...
d3b36a56-40c6-4999-a373-8f2814f8da7a
5
public ArrayList<Cell> convert(String s){ //create the cell list to populate ArrayList<Cell> cellList = new ArrayList<Cell>(); //break the string into the words //for now force to lower case s.toLowerCase(); String [] words = s.split(" "); //for the words in for (int i=0 ; i < words.length; i++){...
d0a62894-5f39-48e2-a37c-d33fc0d56ba8
6
void mesajGeldi(String mesaj) throws Exception, Throwable{ System.out.println(mesaj); JSONObject json = new JSONObject(mesaj); String tip = json.get(MESAJ_TIPI).toString(); switch (tip) { case MT_GUC_ACIK: gucAc(json); ...
496cc708-61b9-42e2-a9a9-5c170e0aa15c
4
@Override public void execute() { Logger.getInstance().info("Executing method " + getMethod()); try { rawExecutionResult = Arietta.rpc.callMethod(getMethod(), getParams()); if (rawExecutionResult == null) { Logger.getInstance().error("Got null result for " +...
c209208c-b99b-4601-9d5d-a753fc1bdaa3
0
public void updateP2(String stats) { p2.setText(stats); }
448122ef-6cef-4ef6-9325-b2c2d79421d8
3
public static boolean isNumber(int c) { return isDigit(c) || c == '-' || c == '+' || c == '.'; }
51d60fa2-c55a-45af-ab7f-3e4e8dc529f0
8
String createDotString(String... dotStrings) { final StringBuilder sb = new StringBuilder(); double nodesep = getHorizontalDzeta(); if (nodesep < getMinNodeSep()) { nodesep = getMinNodeSep(); } final String nodesepInches = SvekUtils.pixelToInches(nodesep); // System.err.println("nodesep=" + nodesepInche...
9e02b72b-c656-4ada-af92-b3d65fefd433
7
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { final UEllipse shape = (UEllipse) ushape; g2d.setStroke(new BasicStroke((float) param.getStroke().getThickness())); if (shape.getStart() == 0 && shape.getExtend() == 0) { final Shape ellipse = new Ellipse2D....
b9452c5a-a762-4fbb-aaa5-63be5f377da9
4
@Override public void update(Observable o, Object arg) { if (arg instanceof WorldState) { WorldState worldState = (WorldState) arg; switch (worldState) { // When the timer hit 0 case TIME_OVER: timeOver(); break; // Set when the player has 0 health and 0 shield etc. IE, dead. case PLAY...
3a672aa7-0c0d-49ce-a016-912524856409
6
public void saveStats(BlackjackGui gui) { switch(gui.numPlayers) { case 1: p1wins = players.get(0).getWins(); p1losses = players.get(0).getLosses(); p1won = players.get(0).getMoneyWon(); p1lost = players.get(0).getMoneyLost(); p1money = players.get(0).getMoney(); try { File file1...
0bb89c9e-96c3-4cf2-9738-47ced682d832
5
private void buyCompany(int id, HttpServletResponse response, RequestContext rc) throws IOException, SQLException { int requesterId = rc.getId(); int compNum = UserManager.countCompanies(requesterId); long reregTax = CompanyManager.companyCost(compNum + 1); if(reregTax != -1) { ...
cc885894-30e8-495d-b963-782614b96cbe
8
public void newRandomConnection(Neuron neuron){ try{ for(int i=0;i<neurons.size();i++) neurons.get(i).findDepth(); }catch(StackOverflowError e){ System.out.println("There was a stack overflow because of findDepth :: SpeciationNeuralNetwork"); new CMDTe...
82bbd9fb-ef20-4e07-99db-01a033ab0f43
4
public void Guerra() { General.Reclutar(exerc1, pantalla); General.Reclutar(exerc2, pantalla); Formacio(exerc1); Formacio(exerc2); while (exerc1.size() != 0 && exerc2.size() != 0) { if (General.Acorrer(exerc1, pantalla) == exerc1.size()) { Formacio(exerc1); } if (General.Acorrer(exerc2, panta...
dc821ec4-247c-4fde-9618-2c226a9ed1d5
4
private static void register(Class<? extends Packet> packet) { try { short id = packet.getField("ID").getShort(null); if(id < 0) System.err.println("Packet ID undefined: " + packet.getSimpleName()); else if(packetTypes.containsKey(id)) System.err.println("Duplicate Packet ID: " + packet.getSimpleNa...
01a143c8-d8a7-4f38-8e95-63917dee915a
6
public boolean setINodeParam(String resource_id, String inode_id, String paramKey, String paramValue) { boolean isUpdated = false; int count = 0; try { while((!isUpdated) && (count != retryCount)) { if(count > 0) { ...
5b14abe6-c07f-4db3-8479-bb4f124a92ce
5
public static int insertMstxSort(String sort) { int result = 0; int sid = getMaxNumber("mstx_sort"); updateMaxNumber(8);// 将该字段值加1 Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; try { pstmt = con.prepareStatement("insert into mstx_sort(sid,info_sort) values(" + sid + ", '" + so...
ace9ad0a-ad32-4415-9176-139817f96f7a
6
private void connectTo(AbstractUnit next, int posConn){ if(selected instanceof IMultipuleOutputUnit){ Object result = JOptionPane.showInputDialog( tulip.Tulip.mainFrame, "Which connection?", PropagatorUnit.lastConnectedUnit ); ...
0a6078ff-79ba-4ced-9715-6cd7abb06bab
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if (getValueAt(0, column) == null) { return String.class; } returnValue = getValueAt(0, column).getClass(); } else { ...
e03173ad-0982-4264-8f92-5f99232cd97c
4
@Override public void messageReceived(Message msg) { /** * same as GridScheduler */ if(msg instanceof ControlMessage){ ControlMessage controlMessage = (ControlMessage)msg; // resource manager wants to join this grid scheduler // when a new RM is added, its load is set to Integer.MAX_VALUE to ma...
31b172a3-3f89-4be7-9047-a956e1cdd9f9
1
public void resume_ingress() { for (ConnectionProcessor pipe : pipes) { pipe.resume_ingress(); } }
6cecca34-8959-4a1c-9843-532c3eb0d81d
7
public BrickFireplace(TextGame _game) { super("Brick Fireplace", ""); this.game = _game; this.addAction(new ActionInitial("hit") { @Override public Result execute(Actor actor) { if (((Player) actor).getLocation().hasOne("brick fireplace")) { return new ResultPartial(true, " -- With what? "...
351be5ac-c6b2-4488-8f8c-d971d8eb0877
0
public void setPass(String pass) { this.pass = pass; }
778ad2ca-228d-4bb0-a45b-9a3346a4099b
9
private void newFileInProject() { FileDialog dialog; if (isCurrentItemLocal()) dialog = new FileDialog(shell, FileDialog.Mode.SAVE, getCurrentTreeDir()); else dialog = new FileDialog(shell, FileDialog.Mode.SAVE, getCurrentTreeSym()); ArrayList<SymitarFile> files = dialog.open(); if (files.size() > 0)...
e65fd696-471c-446e-a4f1-fa45945dc433
3
public List<POMInfo> searchMatchingPOMsIgnoreVersion(Dependency dependency) { List<POMInfo> result = new ArrayList<POMInfo>(); POMInfo pom = searchMatchingPOM(dependency); if (pom != null) { result.add(pom); return result; } for (POMInfo testPom : resolve...
9795d0f3-8afc-4c5c-a380-d136cae729cd
7
private void updateEnvironment(Graphics g) { // see if application is paused if (running) { drawFood(g); drawFeeders(g); // loop through all food and feeders for (Food fd : FoodCollection.getFoods()) { // make sure the food is still active ...
44e10a64-4995-4170-9abc-671a350f51ba
5
static Color getReligionColor(String religion) { religion = religion.toLowerCase(); Color ret = relColorCache.get(religion); if (ret == null) { for (GenericObject group : religions.children) { for (GenericObject rel : group.children) { ...
c5bad58f-783a-44b9-a727-81d8be2321dc
9
@Override public void update(int deltaTicks) { int mouseX = Mouse.getX(); int mouseY = Mouse.getY(); if (mouseX > this.position.x - this.size.x / 2 && mouseX < this.position.x + this.size.x / 2 && mouseY > this.position.y - this.size.y / 2 && ...
eb0ca9b1-6a76-49eb-a3c7-ba0e16c38ccd
2
public ByteVector putByteArray(final byte[] b, final int off, final int len) { if (length + len > data.length) { enlarge(len); } if (b != null) { System.arraycopy(b, off, data, length, len); } length += len; return this; }
8c21ad14-ebfa-4992-92ca-1843343c8aee
2
public BoGenerator( Table table ) { super( table ); boName = table.getDomName() + "Bo"; filePath = "src/main/java/" + packageToPath() + "/bo/" + boName + ".java"; for ( Column column : table.getColumns() ) { if ( column.isKey() ) { keyColumns.add(column); ...
8810d064-f58c-4de4-8c3a-40078e7351ad
5
@Override public void run() { int frec = 100; try { keep_going = true; //Creamos los sockets para la transmisión de información. control_sck = new Socket(CONTROL_HOST, CONTROL_PORT); data_sck = new Socket(DATA_HOST, DATA_PORT); //Creamo...
0b829a35-64ce-494f-bdda-ca85869f382a
6
public static boolean compareSubstringBare(String ion, int ii){ boolean test = false; if(IonicRadii.ions1[ii].indexOf(ion)>-1||IonicRadii.ions2[ii].indexOf(ion)>-1||IonicRadii.ions3[ii].indexOf(ion)>-1||IonicRadii.ions4[ii].indexOf(ion)>-1||IonicRadii.ions5[ii].indexOf(ion)>-1||IonicRadii.ions6[ii].inde...
fabd42f5-fa25-42fa-91fd-4a2bdad218f8
8
private boolean check() { if (N == 0) { if (first != null) return false; } else if (N == 1) { if (first == null) return false; if (first.next != null) return false; } else { if (first.next == null) return false; } ...
9194ef90-092f-4f22-baf3-f0943dceb785
3
public void initReferees() { // create file reader and referee program object FileReader refereesFileReader = null; refereeProgram = new RefereeProgram(); try { try { // initialise file reader using RefereesIn.txt refereesFileReader = new FileReader(refereesInFile); // create new Scanner u...
f4d48af1-7b1c-4fd4-a290-0e7b1b47e13d
7
public static void main(String[] args) throws Exception { Options plumeOptions = new Options( TestIsolationDataGenerator.usage_string, TestIsolationDataGenerator.class); plumeOptions.parse_or_usage(args); // Display the help screen. if (showHelp) { ...
c6290003-49d7-4f89-943e-12d62579cc12
3
public Grafic(final String title, JPanel fondo, double plotWindowTime) { super(title); this.plotWindowTime=plotWindowTime; final CombinedDomainXYPlot plot1 = new CombinedDomainXYPlot(new NumberAxis("Time")); final CombinedDomainXYPlot plot2 = new CombinedDomainXYPlot(new NumberAxis(...
b38bd60f-c0c4-4991-92f8-671af44ed153
2
public boolean satisfies(ArrayList<Boolean> b) { for(Clause c: clauses) { //since a formula is a conjuction, if one clause returns //false, the whole formula is false. if(!(c.satisfies(b))) return false; } return true; }
c1f90280-56d0-4dc4-8959-0573482059bc
5
public static void main(String[] args){ try{ ThreadPoolExecutor executor = new ThreadPoolExecutor(30, 30, 1, TimeUnit.SECONDS, new LinkedBlockingQueue()); List<Future<Boolean>> futures = new ArrayList<Future<Boolean>>(9000); // 发送垃圾邮件, 用户名假设为4位数字 for(int i=1000; i<10000; i++){ futures.add(executo...
b1b0d1ae-9708-479f-9c9c-c8ba111a9485
4
public final WaiprParser.inval_return inval() throws RecognitionException { WaiprParser.inval_return retval = new WaiprParser.inval_return(); retval.start = input.LT(1); CommonTree root_0 = null; Token set68=null; CommonTree set68_tree=null; try { // Waipr.g:61:7: ( ( ID | NUMBER | TEXT ) ) // Wai...
0ddc9030-c34e-4448-b696-864d8f996333
3
public static void main(String[] args) throws FileNotFoundException { System.out.println(new File(".").getAbsolutePath()); Scanner inputFile = new Scanner(new File(".\\src\\hashMap\\inputFile.txt")); HashMap2 hashMap = new HashMap2(SIZE); JFrame frame = new JFrame("Hash Map"); JPanel grid = new JPanel(new Gri...
c0e1ee40-55c6-4aac-926d-9a40cf01b206
9
public void addTask(Task task){ StringBuilder update = new StringBuilder("insert into tasks(reporter,assignee,`status`,description,priority,`completion`,start_date,deadline,title) values("); if(task.getReporter()!=null && task.getReporter().getUserName()!=null) update.append("\""+task.getReporter().getUserName(...
0eb4fdd9-9907-4211-8f7c-66a6b98d5855
3
public static MiscellaneousReasonEnumeration fromString(String v) { if (v != null) { for (MiscellaneousReasonEnumeration c : MiscellaneousReasonEnumeration.values()) { if (v.equalsIgnoreCase(c.toString())) { return c; } } } throw new IllegalArgumentException(v); }
ba7421a6-9bd8-4033-a7df-a7e786b2c059
5
void bedIterate() { // Open file BedFileIterator bfi = new BedFileIterator(inFile, config.getGenome()); bfi.setCreateChromos(true); // Any 'new' chromosome in the input file will be created (otherwise an error will be thrown) for (Variant bed : bfi) { try { // Find closest exon Markers closestMarker...
e973353e-dafa-4819-945f-caf76610fd77
2
public void run() { while (!stop) { try { File f = Main.encontrados.take(); System.out.println(f.getCanonicalPath()); } catch (InterruptedException | IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
3f6d179e-9b93-496c-9f03-9f85ce4d11c7
2
@SuppressWarnings("unchecked") public static ListTag fromNBTTag(NBTTagList base) { Type type = Tag.fromNBTTag(base.get(0)).getClass(); List<Tag> list = new ArrayList<>(); for (int i = 0; i < base.size(); i++) { list.add(Tag.fromNBTTag(base.get(i))); } return new ListTag((Class<? extends Tag>) type.g...
aef0611f-67cf-4ff2-9deb-7291f32b881c
9
public void startDocumentInternal() throws org.xml.sax.SAXException { if (m_needToCallStartDocument) { super.startDocumentInternal(); m_needToCallStartDocument = false; if (m_inEntityRef) return; m_needToOutputDocTypeDecl = true; ...
d0f5edbf-f298-475f-b1f4-952d7d2da4c8
0
public void setHistorialClinicoidHistorialClinico(Historialclinico historialClinicoidHistorialClinico) { this.historialClinicoidHistorialClinico = historialClinicoidHistorialClinico; }
41d631d1-3d7a-4366-b432-546af4cc7b27
4
public int loadStripImages(String fnm, int number) /* * Can be called directly, to load a strip file, <fnm>, holding <number> * images. */ { String name = getPrefix(fnm); if (imagesMap.containsKey(name)) { System.out.println("Error: " + name + "already used"); return 0; } // load the images into a...
1140003e-0fe8-484a-9f86-628fc54bfa2e
9
public void testAdd2() { RunArray<Font> runArray = new RunArray<Font>(); int i; // Add 10 fonts for first 100 characters for (i = 0; i < 10; i++) { if (i % 2 == 0) { assertEquals(i, runArray.addRun(i * 10, 10, fontA)); } else { assertEquals(i, runArray.addRun(i * 10, 10, fontB)); } } // Ver...
6fc1cbf5-de51-4297-825c-813cc09d07cf
6
public void showSet(String name, Player controller, double amount, boolean console) { Player online = iConomy.getBukkitServer().getPlayer(name); if (online != null) { name = online.getName(); } Account account = iConomy.getAccount(name); if (account != null) { Holdings ho...
e2e81fae-0507-4ecb-aeff-ac994751b419
0
public CheckResultMessage checkJ04(int day) { return checkReport.checkJ04(day); }
1cfbab7a-edb6-4ac9-bab7-5c072cfd5e89
1
public boolean chargeIt(double price){ if (price + balance > (double)limit) return false; balance +=price; return true; }
1d8d070f-bdb9-4284-93b8-1e16f3553e3e
5
private void KeyboardPanelPressed(final JPanel jPanel) { if (!new ArrayList(Arrays.asList(jPanel.getComponents())).isEmpty()) { return; } for (final Component comp : KeysPanel.getComponents()) { if (comp instanceof JToggleButton) { JToggleButton keyButton ...
935bcda7-5cf9-4f90-abd6-ab4cc85384b3
6
public ChartHandle createChart( String name, WorkSheetHandle wsh ) { if( wsh == null ) { // this is a sheetless chart - TODO: } /* a chart needs a supbook, externsheet, & MSO object in the book stream. * I think this is due to the fact that the referenced series are usually stored * in the fashon 'She...
45f86793-8dd3-4435-b483-ac0bef09a22a
6
private String getPrecedence(String op1, String op2){ String multiplicativeOps = "*/%"; String additiveOps = "+-"; if ((multiplicativeOps.indexOf(op1) != -1) && (additiveOps.indexOf(op2) != -1)) return op1; else if ((multiplicativeOps.indexOf(op2) != -1) && (additiveOps.indexOf(op1) != -1)) return o...
dbc30a8c-b904-4075-a225-c2337fcdfe6c
4
private String getInput(){ @SuppressWarnings("resource") Scanner scanner = new Scanner(System.in); String userInput; do{ System.out.print("Enter your move [WASD?]: "); userInput = scanner.nextLine(); userInput = userInput.trim().substring(0, 1); if(VALID_KEYS.contains(userInput.toUpperCase())){ ...
820b5c35-0e68-4b43-8816-488a4db62230
2
@Override public boolean activate() { return Game.isLoggedIn() && Players.getLocal().isInCombat() || initialized; }
f49b4322-f8fe-4a31-95c5-35ffb639fe20
2
private void home(Value v) throws Exception { if(isSpilled(v)) { // then this value has been spilled, the value is // currently in t1, insert the spill code now // if the color is less than 0, it is 'spilled', but // doesn't need to be put into a home since it is...
d7aa1080-bfca-47b4-9d43-1ec7bc59cf2a
8
@EventHandler public void touchytouchy(PlayerInteractEntityEvent event) { Player player = (Player)event.getPlayer(); Entity rightclick = event.getRightClicked(); if(rightclick instanceof Player) { Player rightclicked = (Player)rightclick; if(plugin.isActivated(player.getName())) { if(player.getI...
019bcdd9-5b7d-4b33-9546-fea7499f4f80
7
public void buy(MapleClient c, int itemId, short quantity) { if (quantity <= 0) { AutobanManager.getInstance().addPoints(c, 1000, 0, "Buying " + quantity + " " + itemId); return; } MapleShopItem item = findById(itemId); if (item != null && item.getPrice() > 0) { if (c.getPlayer().getMeso() >= item.ge...
e06d2838-dc96-4a1f-8adc-978afc571a9c
4
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this.opt(i...
c503b56c-3606-40e8-9a14-99f928a82e34
2
@Override public void run() { while (!Thread.currentThread().isInterrupted()) { try { TrendBar bar = doneBars.take(); trendBarDao.addTrendBar(bar); } catch (InterruptedException e) { executorService.shutdown(); Thread.cu...
8e770022-39b8-415b-bbf2-7cf3c065c874
4
@Override public boolean onPointerMove(int mX, int mY, int mDX, int mDY) { PhysicsComponent pc = (PhysicsComponent)actor.getComponent("PhysicsComponent"); float X = pc.getX(); float Y = pc.getY(); if(mX < placementAreaX) { X = placementAreaX; } el...
7a5bf918-1d2c-45fe-8e1e-ed932677564a
0
public CeremonialAxe() { this.name = Constants.CEREMONIAL_AXE; this.attackScore = 9; this.attackSpeed = 14; this.money = 1500; }
60c75f91-2a85-49fc-b98c-91867cc2bc27
4
@Override public boolean dispatchKeyEvent(KeyEvent e) { switch (e.getKeyCode()) { case 37: GUI.scrollBothPaneH("dec", 30); break; case 39: GUI.scrollBothPaneH("inc", 30); break; case 38: GUI.s...
7f44f524-cf11-483d-b45c-9f663c307a70
6
private void p_bookingPage(){ p_bookingPane = new JPanel(); p_bookingPane.setBackground(SystemColor.activeCaption); p_bookingPane.setLayout(null); if (patient!=null){ db.showBookingPat(PBT_model,patient.getHKID()); } PBL_choose_model.removeAllElements(); PBT_date.setValue(null); JLabel lbl_Bookin...
5fe6efe0-21d4-412d-b431-d439cb2f8d70
8
@Test public void testLoadingCards() { // Test loading cards ArrayList<Card> cards = testBoard.getCards(); // check total number of cards Assert.assertEquals(cards.size(), 21); // check number of types of cards int numberOfWeaponCards = 0; int numberOfRoomCards = 0; int numberOfPersonCards = 0; for...
ceec8c00-02ee-41ed-85a8-f0f6f913a5f7
2
public boolean isNaN(){ boolean test = false; if(this.magnitude!=this.magnitude || this.phaseInDeg!=this.phaseInDeg)test = true; return test; }
ea5295c2-03e8-41ea-b576-7acf08cf6a85
6
public void runScript(String serverUrl, String userId, ScriptName scriptName) { Thread thread = null; switch (scriptName) { case opUsPg: OpenPageScript openPageScript = new OpenPageScript(serverUrl, userId, this); thread = new Thread(openPageScript); break; case addRes: AddResScript addResSc...
e0385f07-b6b3-4ba4-bfba-d719cb9b6891
7
public static void main(String[] args){ try { //prompt for IP address BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter server's IP"); String ip = reader.readLine(); if(!ip.trim().equals("")){ server_ip = ip; } //connect to server Stri...
5b0e4925-8cf5-47ce-bfca-f521eeaffae7
7
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(1280, 768); frame.setTitle("BulletTester"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Random r = new Random(); ArrayList<Bullet> bulletList = new ArrayLis...
19da96f9-b784-474c-8ec6-30a0e9a52e9e
0
public static void main(String[] args) { Demo01 demo = new Demo01(); demo.method_b(b); }
815b239b-9d1c-4b51-8d67-64ce9d0e5de3
1
public Type[] exceptions() { final ConstantPool cp = editor.constants(); final int[] indices = methodInfo.exceptionTypes(); final Type[] types = new Type[indices.length]; for (int i = 0; i < indices.length; i++) { types[i] = (Type) cp.constantAt(indices[i]); } return (types); }
724e7529-3a3d-4f75-aaa0-f9c0d0732cfa
7
public int run (String[] args) throws Exception { for(int i = 0; i < args.length; i++){ System.out.println(i + " : " + args[i]); } if (args.length < 2) { System.err.printf("Usage: %s [generic options] <d> <maxDimensions> <dataSets> <key> <input> <input2?> <output> <prevrun?> \n", getClass().getSimpleN...
c36d52c7-9992-4d6d-811d-e4786d2cb897
1
public Gesture(PersistentCanvas c, Color o, Color f, Point p, Panel l, boolean gesture) { super(c, o, f); panel = l; type = 1; thickness = 2; shape = new GeneralPath(); ((GeneralPath) shape).moveTo(p.x, p.y); firstpoint = p; isGesture = gesture; ...
110e3f8a-6fe0-466b-8071-137915aa3054
8
protected void convertMapsToSections(Map<?, ?> input, ConfigurationSection section) { for (Map.Entry<?, ?> entry : input.entrySet()) { String key = entry.getKey().toString(); Object value = entry.getValue(); if (value instanceof Map) { convertMapsToSections((...
5738505c-2dc7-403c-9687-9d2d69207b9f
5
public boolean remove(String name) { Connection conn = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("DELETE FROM " + Constants.SQLTable + " WHERE username = ? LIMIT 1"); ps.setString(1, name); ps.executeUpdat...
5655f671-fbe8-4c24-ae3a-d899915c4f63
3
public void readFile(String filename) throws FileNotFoundException, IOException, InvalidUserException { Scanner scanner = new Scanner(new File(filename)); fw = new FileWriter(new File(fileWriterName)); while (true) { String s = scanner.nextLine(); if (s.contains("EXIT"))...
4ec7a5c2-4437-4b61-af47-b463579754c2
2
static LinkedList copyAll(LinkedList list, ConstPool cp) { if (list == null) return null; LinkedList newList = new LinkedList(); int n = list.size(); for (int i = 0; i < n; ++i) { AttributeInfo attr = (AttributeInfo)list.get(i); newList.add(attr.copy(...