method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
7b494ab8-b3ca-49a6-be9e-4093a1c054d1
1
public Value pop() throws IndexOutOfBoundsException { if (top == 0) { throw new IndexOutOfBoundsException("Cannot pop operand off an empty stack."); } return values[--top + locals]; }
1bbb67ec-cb47-48f8-8330-b954a7106925
7
public String execute() { Map<String, Object> session = ActionContext.getContext().getSession(); User user = (User) session.get("USER"); setList(null); String actionResult = ""; reportBusinesService = new ReportBusinesService(); setList(reportBusinesService.createHist...
3a899f70-8725-4b6c-892d-ffcb3bd5cdc4
4
private void addListeners(Component c) { // c.addMouseListener(this); if (c instanceof JTextField) { JTextField tf = (JTextField) c; tf.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent ke) { return; } @Override public void keyReleased(KeyEvent ke) { ...
fa75ae78-422c-4242-b507-a84b85b69238
4
private void loadID3v2(InputStream in) { int size = -1; try { // Read ID3v2 header (10 bytes). in.mark(10); size = readID3v2Header(in); header_pos = size; } catch (IOException e) {} finally { try { // Unread ID3v2 header (10 bytes). in.reset(); } catch (IOExcepti...
ad5434d1-f74b-4feb-a7af-a848c8e12a59
5
static public void codeAllFilesInDirectoryExceptSound(String src) { File folder = new File(src); File[] listOfFiles = folder.listFiles(); for (File file : listOfFiles) { if (file.isFile()) if(!file.getName().substring(file.getName().length()-3, file.getName().length()).toLowerCase().equals("m...
6207aac2-5750-4203-aeeb-309743243785
4
private int reagir(int reducao){ int valor; int gerador; Random gera = new Random(); gerador = gera.nextInt(100); if (gerador > 75 && gerador < 100){ valor = reducao * 1; } else if (gerador > 50 && gerador < 74){ valor = (int) (r...
9b4a57e0-f816-4593-bbb2-678318ca85d5
4
public void ereignisTrigger() { int zufallEreignis = (int) ( Math.random() * 4 ); switch ( zufallEreignis ) { case 0: // kein Ereignis this.spieler .setEreignis( "Es war ein durchschnittliches Jahr, ohne besondere Vorkommnisse!" ); break; case 1: maeuseplage(); this.spieler ...
d756f128-888c-4f4f-ba4a-c0c182d8494c
5
@EventHandler public void rainChange(WeatherChangeEvent event) { if (!event.isCancelled()) if (event.getWorld().getName().equals(this.world.getName())) if (event.toWeatherState()) { //starting to rain if (state == 1) { //it's already been waiting. Now we just actually make it rain. state = 2; ...
1ade5b98-2b50-42ac-90ba-53e434e89b9c
2
public AnnotationVisitor visitArray(String name) { AnnotationVisitor v = av.visitArray(name); return v == null ? null : (v == av ? this : new RemappingAnnotationAdapter(v, renamer)); }
4e181792-ca90-4c80-8ecf-13a06052bf0f
9
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((msg.targetMinor()==CMMsg.TYP_DAMAGE) &&((msg.value())>0) &&(msg.tool()==this) &&(msg.target() instanceof MOB) &&(!((MOB)msg.target()).amDead()) &&(msg.source()==owner())) { final Room r...
e36e8230-9dfe-46b9-bc78-75caf0c32e4d
2
private boolean containsNativeMethods(ClassNode c) { for (Object mo : c.methods) { MethodNode m = (MethodNode) mo; if ((m.access & ACC_NATIVE) != 0) { return true; } } return false; }
fa219783-421b-4b38-a4bd-aabed261c0ec
2
@SuppressWarnings("unchecked") private static <E> Class<E>[] getClasses(String packageName) throws ClassNotFoundException, IOException, URISyntaxException { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); assert classLoader != null; String path = packageName.repla...
e58b073c-3490-4438-9b47-c7b64aca38de
3
public void endDocument() { if (t.findCriteria == C_FIND_TOTAL){ t.totalEntity = t.entityIndex; }else if (t.findCriteria == C_FIND_SORTED){ t.sortShopListValues();//execute the sorting method } String selectedShopList_length = "0"; if(t.selectedShopList != null){ selectedShopList_l...
d16fa889-ed85-45cb-ac46-7e6c8cea1cac
8
public static void main(String[] args) { Group g1 = new Group(); g1.addStudent("Jacob"); g1.addStudent("Whitney"); g1.addStudent("Jennie"); //Test 1 String expected = "Jacob\nWhitney\nJennie\n"; String actual = g1.getStudentsForOut(); if(actual.equals(expected)){ printPass(1); } else{ print...
736a1a49-093b-4d95-8aee-f9c987857cac
5
@Override public void renderAfter(boolean editor, float interpolation) { if(state == PlayerState.LAND && System.currentTimeMillis()-lastLand >= timerLength && timerLength != -1) { state = PlayerState.IDLE; timerLength = -1; } Animation anim = getAnim(); if(anim != null) { Vector2 posVec = ne...
85da1afd-b080-4007-9a3b-e53def35488c
3
public void paint(Graphics arg0) { Graphics2D g2d = (Graphics2D) arg0; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); if (show) { g2d.setColor(Constants.BLACK_TRANS); g2d.fill(Constants.CHATBOX_AREA); g2d.setColor(Color.PINK...
4c36e830-5cab-469f-8e43-a0440ec57002
2
public AbstractComponent newComponent(EComponentType type) throws ComponentException { AbstractComponent component = null; if (type == null) { throw new ComponentException("Component type is null"); } else if (type == EComponentType.CHARACTER) { component = new CharacterComponent(); component.setType(...
ade2b80f-63e6-4b93-a6b9-d110b8a53965
8
public void testConstructor_int_int_int_int() throws Throwable { LocalTime test = new LocalTime(10, 20, 30, 40); assertEquals(ISO_UTC, test.getChronology()); assertEquals(10, test.getHourOfDay()); assertEquals(20, test.getMinuteOfHour()); assertEquals(30, test.getSecondOfMinute()...
33b066e5-8d76-4685-9c02-602cc91b2dd8
2
public boolean kakkoset(){ for(int i=0; i<5; i++){ if(nopat[i].getValue()==2){ return true; } } return false; }
04fd5218-272e-43aa-880e-c733f4ca4b5c
3
public void sort(int[] array) { for (int j = 1; j < array.length; j++) { int key = array[j]; int i = j - 1; while (i >= 0 && array[i] > key) { array[i + 1] = array[i]; i = i - 1; } array[i + 1] = key; } }
aa7aade6-0d88-49a1-b9f8-05f33cdc08d5
9
public void actionPerformed( ActionEvent e ) { if( e.getSource() == btnBack ) { mainFrame.setVisible( false ); TerpInfo.instance.getMainFrame().setVisible( true ); TerpInfo.instance.getMainFrame().requestFocus(); } else if( e.getSource() == btnNextFloor ) { curFloor++; if( curFloor > 1 ) btnPre...
a986af08-b761-4863-addf-b458d6460de4
4
public final void findAlgorithm() { // try to find the function name of the signature generator String functionName = StringUtils.substringBetween(jsEntity, "signature=", "("); // try to find the algorithm String sigAlg = functionName.concat("(a){") .concat(StringUtils.su...
d82c5458-2df1-4227-a1a7-201d1734c54b
6
private void calculateDimensionsGlobal( int cWidth, int cHeight ) { imgWidth = cWidth; imgHeight = cHeight; if ( cWidth > 0 ) numPoints = cWidth; // Padding depends on grid visibility chart_lpadding = ( graphDef.showMajorGridY() ? graphDef.getChartLeftPadding() : CHART_LPADDING_NM ); chart_bpadding...
f8b907c9-5224-41ca-8807-27cf7b472923
0
public void setType(long value) { this._type = value; }
4d42ac74-fbd4-4152-a4d9-a66b51852d30
6
public ResultSet PesquisaNaTabelaDepartamentos(String NomeDepartamento) throws SQLException { Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; Departamento DEP = null; try { conexao = BancoDadosUtil.getConnection(); ...
212f6795-53a9-4799-b6d5-41918fba9bbe
5
public static boolean isMixture(String s, char[] c){ int cIndex = 0; char currentChar = ' '; for (int i=0; i<s.length(); i++) { if (currentChar != s.charAt(i)) { while (cIndex < c.length && s.charAt(i) != c[cIndex]) cIndex++; if (cIndex == c.length) return true; ...
2237cef7-1ec8-4b55-b60e-e382ace86ef6
1
private GUIController() { frameChooser = new FrameChooser(); try {UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { //Handle exception } }
6370ab6b-11af-4b61-839b-1e83ed080acf
1
public void updateSimpleDateFormat(String format) { this.dateFormat = new SimpleDateFormat(format); if (!Preferences.getPreferenceString(Preferences.TIME_ZONE_FOR_SAVING_DATES).cur.equals("")) { this.dateFormat.setTimeZone(TimeZone.getTimeZone(Preferences.getPreferenceString(Preferences.TIME_ZONE_FOR_SAVING_DATE...
af70edcd-b964-427a-a047-4acd12ec2518
7
public static void pprintNamedDescriptionsAsRule(NamedDescription head, NamedDescription tail, String operatorprefix, org.powerloom.PrintableStringWriter stream) { { int operatorindent = operatorprefix.length() + 2; Cons variables = Stella.NIL; { Symbol v = null; Cons iter000 = Logic.SYSTEM_DEF...
b09476f7-3048-4365-b252-ce5fd07366f5
1
@Override public Cab getResource() { return ready ? cab : null; }
4f314c7c-c330-4b89-9d1d-d15723cbb807
7
private void saveToFileMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveToFileMenuItemActionPerformed int button = this.saveToFileFileChooser.showSaveDialog(this); try { if (button == JFileChooser.APPROVE_OPTION) { File f = this.saveToFileFileCho...
f5161f5f-35bf-4402-81ea-9a425a6dc854
9
public void outputGraph(String fileNameLocalIndexes, String fileNameTrueIndexes) throws Exception{ //get nodes with edges HashSet<Integer> nodesWithEdges = new HashSet<Integer>(); for(int i=0; i<this.totalNodes; i++){ for(int j : this.graph.get(i).keySet()){ nodesWithEdges.add(i); ...
7bcfe8d2-da45-4fd0-aad7-963aa70085d6
5
@Override public boolean equals(Object o) { if (!(o instanceof Category)) { return false; } Category c = (Category) o; if (this.getId() != c.getId()) { return false; } if (!this.getHeadLine().equals(c.getHeadLine())) { return fa...
057e2073-fc97-4c84-9d9d-aac0be64b1eb
5
public ArrayList<SalsaVertex> topAuthorities(int K, HashSet<Integer> removeList) { // TODO: faster top-K implementation ArrayList<SalsaVertex> all = new ArrayList<SalsaVertex>(authorities.size()); all.addAll(authorities.values()); Collections.sort(all, new Comparator<SalsaVertex>() { ...
fd50bdcf-fced-4750-bdb3-b3dccd42ccfb
2
@Override public void mousePressed(MouseEvent arg0) { clicked = true; location = new Point(arg0.getPoint()); mouseBtn = arg0.getButton() == MouseEvent.BUTTON1 ? LEFT : arg0.getButton() == MouseEvent.BUTTON2 ? RIGHT : -1; }
b8ee0418-ddfe-498c-b9af-c42732f64df9
8
public Frame5() { try{ Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER, PASS); statement = conn.createStatement(); }catch(SQLException se){ se.printStackTrace(); }catch(Exception e){ e.printStackTrace(); } setTitle("KutaRaya, 53 - 72"); setDefaultCloseOperation(...
eb301ea0-2476-41d3-b2e6-ca1901dfd6df
2
public Long getLong() { Object gotValue=getValue(); if (gotValue != null) { if (!Long.class.isAssignableFrom(gotValue.getClass())) { throw new ClassCastException("don't know how to convert " +gotValue.getClass().getName()+" to Long"); ...
bcf22f62-eed2-4869-a7ae-b82b4975dfdf
4
protected byte[] allocateByteArray(int size, boolean returnNullIfNoMemory) { boolean canAlloc = true; if (memoryManager != null && size >= 512 * 1024) canAlloc = memoryManager.checkMemory(size); if (returnNullIfNoMemory && !canAlloc) return null; return new byte[s...
baa0d6c3-eb30-4edf-8a9c-3521a8f91654
2
private static int reflectFindMethodByName(Class c, String methodName) { Method[] methods = c.getMethods(); for (int i = 0; i < methods.length; i++) { if (methods[i].getName().equalsIgnoreCase(methodName)) { return i; } } return -1; }
70041c8c-a40b-4b6d-8413-13267fa8730c
6
@Override public String getOOXML() { StringBuffer ooxml = new StringBuffer(); ooxml.append( "<" + ns + ":spPr" ); if( bwMode != null ) { ooxml.append( " bwMode=\"" + bwMode + "\">" ); } else { ooxml.append( ">" ); } if( x != null ) { ooxml.append( x.getOOXML() ); // must pass namespace...
db8f89db-bf26-4d07-b875-c3d8b3ab2431
9
private static void readTile(DataBuffer buffer, int x, int y, int plane, int shapeOffset) { GameTile tile = tile(new Position(x, y, plane)); GameTile under = null; if (plane > 0) { under = tile(new Position(x, y, plane - 1)); } tile.clip().set(Collision.OPEN); while (buffer.hasRemaining()) ...
adc55e80-3422-436d-9375-9910995c8640
7
public void actionPerformed(ActionEvent ae) { for (int y = 0; y < 8; y++) { for (int x = 0; x < 8; x++) { if (buttons[y][x] == ae.getSource()) { if (!firstChoice) { if (chessBoard.get(x, y) == null || !chess.getUserColor...
561c6c03-da3e-44b5-82ca-096d77fbd913
7
@Override public void trainOnInstanceImpl(Instance inst) { if (this.treeRoot == null) { this.treeRoot = new ActiveLearningNode(new double[0]); this.activeLeafNodeCount = 1; } FoundNode foundNode = this.treeRoot .filterInstanceToLeaf(inst, null, -1); ...
c844d409-fba7-451e-b6e3-d41f4731f6c9
9
@Override public BigDecimal convertControlValueToControlComparable(Object aValue) { BigDecimal tempBigDecimal = null; if ( aValue instanceof BigDecimal ) { // 2/12/2010 return (BigDecimal) aValue; tempBigDecimal = (BigDecimal) aValue; } else if ( aValue instanceof String ) { String str = (Str...
ef1b459a-4485-417d-8fb2-b7d699da53c9
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Monster other = (Monster) obj; if (this.monsterID != other.monsterID) { return false; ...
041788ce-df10-4de7-ae6b-2f94b7684f4c
3
public MeetingAdmin getMeetingAdminByUsernameAndMeetingID(int meetingID, String username){ for(MeetingAdmin meetingAdmin : meetingAdmins){ if(meetingID == meetingAdmin.getMeetingID() && username.equals(meetingAdmin.getUsername())) return meetingAdmin; } return null; }
884c0e0e-b273-45b4-b453-c448155bc857
5
@Override protected void rebalanceDelete(Position<Entry<K,V>> p) { if (isRed(p)) // deleted parent was black makeBlack(p); // so this restores black depth else if (!isRoot(p)) { Position<Entry<K,V>> sib = sibling(p); if (isInternal(sib) && (isBlack...
487eb32a-9d2c-452c-b223-760180af86fa
2
public Exon findExon(int pos) { // Is it in UTR instead of CDS? for (Exon exon : this) if (exon.intersects(pos)) return exon; return null; }
a12e953d-89cd-4fd9-b771-df3bcd8d83f8
0
public ArithmeticQuantity add(Quantity other) { double otherValue = other.convertTo(this.unit); return new ArithmeticQuantity(this.value + otherValue, this.unit); }
4ca51b56-febd-41b1-afae-931024c90d5b
5
@Override public void actionPerformed(ActionEvent evt) { try { boolean b; Regex r = new Regex(txtRegex.getText()); if(evt.getSource() == btnDemo){ //random generation setTextareaRandomly(lstrExamples); b = true; } ...
7780e030-0f34-4721-91f7-88591b3f9c12
2
private void getRemainingDates() { for ( int i = 1; i < 14; i++ ) { calendar.add( Calendar.DAY_OF_WEEK, 1 ); while ( !isUnitOpen() ) calendar.add( Calendar.DAY_OF_WEEK, 1 ); availables[ i ] = DATE_OUTPUT.format( calendar.getTime() ); } }
ca4576ea-b47f-48d3-bd96-1c34fa546c12
7
@Override public Object get(String name, Scriptable start) { // When used as a constructor, ScriptRuntime.newObject() asks // for our prototype to create an object of the correct type. // We don't really care what the object is, since we're returning // one constructed out of whole c...
a515117e-bbe4-4f8a-a059-3c2b7c974d8c
9
public ArrayList<Integer> run(ArrayList<Chord> chords, ArrayList<AminoAcid> bassIn) { bass = bassIn; int randomAA; int bar = 0; int noteInChord = 1; Chord tempChord; notes.add(60); while (bar < chords.size()) { /...
ceec62f3-dffd-420e-b3ec-c734a4c806bb
4
public boolean compare(Element other) { if(other == null) { return true; } // if(this.iD == -1 && other.iD != -1) // { // return false; // } // if(this.iD != -1 && other.iD == -1) // { // return true; // } // if(this.iD == -1 && other.iD == -1) // { // double i = Math.random(); // if(i < 0.5) ...
50f106dc-2998-4542-a0c0-215bd699cb04
4
public boolean verifyPath(C leaf, C root, List<Pair<C,C>> path) { // Verify that the each pair contains a commitment // to the previous pair and that the first pair // in the path contains the leaf C lasthash = leaf; for (Pair<C,C> pair : path) { if (!GenericsUtils.deepEquals(pair.a, lasthash) && !Generic...
3d77cc22-38ae-4498-9e9f-6789dd3b894d
7
public static JSONObject addFriend(String key, String addFriend){ try { int friend = Integer.parseInt(addFriend); int user = UserTools.keyValid(key); if(friend == user) return ErrorMsg.otherError("You are already friend with yourself, aren't you ?"); FriendTools.addFriend(user,friend); ...
d6684161-14de-468c-8f27-b3c86fda4485
6
public static void drawTiledImage(String resource, Graphics g, JComponent c, Insets insets) { int width = c.getWidth(); int height = c.getHeight(); Image image = ResourceManager.getImage(resource); int dx, dy, xmin, ymin; if (insets == null)...
12cf09c5-ab99-4767-9d3a-7af727ef35f1
7
public static TruthValue unaryDescriptionSpecializesDescriptionP(Description sub, Description renamed_Super) { if (((Boolean)(Logic.$REVERSEPOLARITYp$.get())).booleanValue()) { return (Logic.UNKNOWN_TRUTH_VALUE); } if (LogicObject.collectionImpliesCollectionP(sub, renamed_Super)) { return (Logic...
538b5ec4-2b65-4238-afbd-61fdceec4bd0
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { LinkedList<Billet> panier=new LinkedList<>(); if(request.getSession().getAttribute("Panier")!=null && ((LinkedList<Integer>)request.getSession().getAttribute("Panier")).size()>0){ String sql="se...
1a998187-af28-410f-a870-b6cdc5c87c9b
0
public void setSuppliercode(int suppliercode) { this.suppliercode = suppliercode; }
8f1d1398-824c-4ca3-843c-728c2780e67d
5
public byte actionToByte(Action a) { byte b = 0; switch (a) { case DO_NOTHING: b = 0; break; case OUTPUT_MAX_HEIGHT: b = 1; break; case OUTPUT_MAX_LAUNCH_HEIGHT: b = 2; break; case OUTPUT_LAUNCH_WINDOW_END_HEIGHT: b = 3; break; case OUTPUT_BATTERY_VOLTAGE: b = 4; break; } ...
853e623b-b384-4265-bff0-6bdcd795984e
8
private String compute(String[] input) { if (input.length != 3) return "Error: Invalid input!"; if (input[2].contains("/ 0")) return "Division by zero not supported!"; String[] termParts = input[2].split(" "); if ((termParts.length / 2) * 50 > userMap.get(input[1]).getCredits()) return "Error: Not e...
a5c400ad-93b4-4569-9ecd-4c67a2dafc30
0
public CheckResultMessage checkTF07(int day) { return checkReport.checkTF07(day); }
cc4e6be6-bb14-4b27-a6b2-a1717f183008
1
public void addLinhaVenda(LinhaVenda lv) throws ExceptionGerenteVendas{ if(linhas.contains(lv)){ throw new ExceptionGerenteVendas("Linha de Venda j� foi inserida nesta venda"); }else{ linhas.add(lv); lv.setVenda(this); total+= lv.getTotaldaLinha(); desconto+=lv.get...
1034fa12-13e0-4f5f-a3b9-0619e36412a8
0
@Override public void viewPropertyChange(PropertyChangeEvent pce) { dataModel.stop(); }
76ddf218-d489-4808-bd10-8573797ea428
0
public void SetY(int y) { this.y = y; }
586863c0-41c0-45d9-9cf0-234cbcf911d2
3
private static void replace() { if (GameConfig.PREVENT_MOUSE_IO) { if (_out == null) { _out = System.out; System.setOut(new PrintStream(new OutputStream() { public void close() {} public void flush() {} public void write(byte[] b) {} ...
0a9c3f36-e861-4785-b5ea-149c34d22be3
1
@After public void tearDown(){ cm.flush(); try { Files.delete(Paths.get("contacts.txt")); } catch (IOException e) { e.printStackTrace(); } }
cd0a76ea-2793-4ac3-b9d9-d63107cc8189
4
public LedBargraph() { getStyleClass().add("bargraph"); ledColors = new SimpleListProperty(this, "ledColors", FXCollections.<Color>observableArrayList()); value = new SimpleDoubleProperty(this, "value", 0); for (int i = 0 ; i < getNoOfLeds() ; i++) { if (i < 11) { ...
c44bda20-9e59-4b98-ab48-282bbaaf7f8d
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
b02bfdde-bd3c-453c-a727-4348cfded9ca
8
public final String parseToString() { String str = "Ganze Zahl Attribute: \n"; str += super.parseToString(); if(_dataValueType == DataValue.BYTE_TYPE) { str += "Typ : Byte\n"; } else if(_dataValueType == DataValue.SHORT_TYPE) { str += "Typ: Short\n"; } else if(_dataValueType == DataValue.INTEGER_TY...
bbc76138-701b-4d06-b942-bddd45ce587a
3
private Element findFirstElementByTagName(String tag, Node node) { if (node.nodeName().equals(tag)) return (Element) node; else { for (Node child: node.childNodes) { Element found = findFirstElementByTagName(tag, child); if (found != null) ...
a83bf886-1655-4bf6-97d4-047fbb4e506a
1
static private float[][] splitArray(final float[] array, final int blockSize) { int size = array.length / blockSize; float[][] split = new float[size][]; for (int i=0; i<size; i++) { split[i] = subArray(array, i*blockSize, blockSize); } return split; }
fa837432-fb5d-4d54-a0f6-c80326199ab1
5
private static void compressStream(Map<Byte, byte[]> dictionary, OutputStream outs) throws IOException { int current_pos = 0; byte[] byteStream = new byte[dictionary.size()*2]; boolean patternExistTwice = false; for (Byte key : dictionary.keySet()) ...
fb471227-2718-4c97-bc52-dde7cefec71c
7
void initResources() { final Class<? extends BrowserExample> clazz = this.getClass(); if (resourceBundle != null) { try { if (images == null) { images = new Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { InputStream sourceStream = clazz.getResourceAsStream(ima...
e5e3d7fe-dbe6-4134-ac4d-2ea2e2e01de9
8
private Feature totalNumericValues(FeatureCollection fc, Feature feature) { FeatureSchema schema = fc.getFeatureSchema(); for (Iterator it = fc.iterator() ; it.hasNext() ; ) { Feature f = (Feature)it.next(); for (int i = 0, max = schema.getAttributeCount() ; i < max ; i++) { ...
84b7fa0d-78bb-41f6-8bf3-9c37f45f85b9
2
@Override public void takeDamage(int damage) { if (Math.random() > getAvoidPercent()) { if (damage > defense) { this.curHP -= damage - defense; System.out.println("the player takes: " + (damage - defense) + " dammage"); } else { this.cu...
19c89a94-8b37-47ca-8a81-e521cd11b975
9
public Updater(Plugin plugin, int id, File file, UpdateType type, boolean announce) { this.plugin = plugin; this.type = type; this.announce = announce; this.file = file; this.id = id; this.updateFolder = plugin.getServer().getUpdateFolder(); final File pluginFile...
cc4bb3aa-7f54-42f9-a796-6c15f3c7306b
6
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if (columnIndex < 0 || columnIndex >= COL_NAMES.length || rowIndex < 0 || rowIndex >= propNames.length) { return; } if (columnIndex == 0) { return; } if (columnIndex == 1) { props.put(propNames[rowIndex], aValue);...
06208f9b-97fd-45e6-a650-0c7527ba5ed2
9
protected void updateGraph() { if( CommonState.getTime() != GraphObserver.time || (CDState.isCD() && (CDState.getCycleT() != GraphObserver.ctime)) || CommonState.getPhase() != GraphObserver.phase || pid != GraphObserver.lastpid ) { // we need to update the graphs GraphObserver.lastpid = pid; ...
d6e35b8d-1350-4477-95ea-838f2f7cd082
3
* @throws UnsupportedEncodingException */ int dataSize() throws UnsupportedEncodingException { headerSize = groupTableSize = versionTableSize = pairsTableSize = dataTableSize = 0; // header headerSize = MVDFile.MVD_MAGIC.length; // magic headerSize += 5 * 4; // table offsets etc /*try { MVDError....
0e9ef522-5215-4d41-a57d-bb14c7c04d84
0
@Override public void mouseReleased(MouseEvent e) { }
d7a80e45-7696-417c-aece-c06693f41710
8
private Widget creerListeUserPanel() { setWidth("100%"); setHeight("100%"); listUserPan.isVisible(); listUserPan.setTitle("Liste des utilisateurs"); final CellTable<User> table = new CellTable<User>(); AdminService.Util.getInstance().getAllUsers(new AsyncCallback<ArrayList<User>>(){ @Override public...
1599e953-9649-410f-8796-6036ad63b898
8
private void fixate(Object[] nodes, int start, int end, Rectangle bounds, boolean left, boolean top, int border) { if (start > end) { return; } boolean vertical = bounds.height > bounds.width; int offset = 0; double delta = 0; double size = size(nodes, start, end); for (int i = start; i < end; i++) {...
c14f4a48-ecda-44bf-8a94-a8a03a21109d
7
public String getRawResultOutput() { StringBuffer result = new StringBuffer(); if (m_Classifier == null) { return "<null> classifier"; } result.append(toString()); result.append("Classifier model: \n"+m_Classifier.toString()+'\n'); // append the performance statistics if (m_result !=...
f6ee684a-54f9-42f7-b384-478e6a83f272
3
private void instanceDialogModpackComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instanceDialogModpackComboBoxActionPerformed try { instanceDialogVersionComboBox.removeAllItems(); instanceDialogVersionComboBox.addItem("Recommended"); try { ...
e61be767-612c-4d5e-bf3d-eea7e8935309
5
public void paint1(Graphics g) { g.setColor(Color.white); //Verifica que los objetos existan if (barril != null && banana != null ) { if (info) { g.drawImage(infoImagen, 0, 0, getWidth(), getHeight(), this); } else { ...
4dd3f5a9-3c76-4435-b822-3da0a83e0928
6
protected boolean runAllTests() { boolean _passAll = OK; //The following code checks whether appropriate erros have been logged, //which, if implemented, should be done for each test case. //minibase_errors.clear_errors(); //int result = test(); //if ( !result || minibase_errors.error() ) {...
f96ce255-95a3-44f3-b1f5-27165c46ab01
5
public void setLocation(LocationGPSObject lo ,Picture picture){ if(picture != null){ if(!(lo.getLocation().equals("")) || lo.getLocation() != null){ String place = ""; try{ place = lo.getLocation().toLowerCase(); String s = lo.getLocation().charAt(0) + ""; place = s.toUpperCase() + place.sub...
e91a6eeb-2c48-48fd-a51d-1ab45b1edb81
3
private Designator designator() throws Exception { Identifier id = ident(); // if variable if(scan.sym != Token.opensquare) { return new Designator(id); } ArrayList<Value> index = new ArrayList<Value>(); while(scan.sym == Token.opensquare) { sc...
640fa12e-9de6-4ff8-bd85-bc6781ceddd0
6
public static void Play() { boolean done = false; String [][] words = { {"Penguin", "Bird"}, {"Pizza", "Food"}, {"LawL", "Troll"} }; String [] scramble = new String [SIZE]; for(int i=0; i < words.length; i++) { scramble[i] = words[i][0]; scramble[i] = scramble(scramble[i]); ...
1af3b674-4a81-4419-acda-fd0cf5a8718b
4
private static boolean startsWithVowel(String string) { char[] stringChars = string.toCharArray(); vowelLoop: for (char c : VOWELS) { for (char c2 : stringChars) { if (Character.isLetter(c2)) { if (c2 == c) { return true; } else { continue vowelLoop; } } } } return false...
f8e53ddc-2c66-48fa-90da-cd2ef9792248
2
public int hashCode() { int hash = clazz == null ? 0 : clazz.hashCode(); for (int i = 0; i < ifaces.length; i++) { hash ^= ifaces[i].hashCode(); } return hash; }
ed92c0ac-ac69-40ce-9641-eb0d7a1fc6e7
1
public static String imageUrlFromThumbUrl(String thumbUrl, char thumbChar) { int char_pos = thumbUrl.lastIndexOf("."); if (thumbUrl.charAt(char_pos - 1) == thumbChar) { return thumbUrl.substring(0, char_pos - 1) + thumbUrl.substring(char_pos, thumbUrl.length()); } return thum...
fbb79b65-4532-4b29-ac70-dd1a0f75b86a
5
private boolean parse(String command) { StringTokenizer tokens = new StringTokenizer(command, Utils.SEPARATOR); if (tokens.countTokens() != 2) return false; String process = tokens.nextToken(); if (! r.contains(process)) return false; String action = tokens.nextToken(); if (! (action.equals("ON") || act...
eb7ba109-7cd6-4f05-b067-f4ce99a89e19
5
public static void load(String load){ String[] split = load.split(":"); Setting loadFor = null; for(Setting s: Setting.values()){ if(s.name.equalsIgnoreCase(split[0])){ loadFor = s; break; } } if(loadFor == null) return; try{ if(split[1].toLowerCase().startsWith("f")){ lo...
ea4c1688-f6eb-495a-843d-05317605d946
1
public static JPanel generatePanel(JComponent... comps) { JPanel shell = JComponentFactory .makePanel(JComponentFactory.HORIZONTAL); // if (!Cuker.programSettings.useSystemLookAndFeel) shell.setBorder(BLACKBORDER); for (JComponent a : comps) shell.add(a); return shell; }
17592358-8cd8-4296-b9d4-67336a00c8d2
4
private synchronized Class<?> loadClassFromLocalCache(String name) throws ClassNotFoundException { Class<?> result = localCache.get(name); if (result == null) result = localCache.get(PACKAGE_NAME + "." + name); if (result == null) result = super.findSystemClass(name); ...
b494c169-ae52-4d9d-9e4e-2522d8f6d96b
0
@Column(name = "PCA_ID_ELEMENTO") @Id public int getPcaIdElemento() { return pcaIdElemento; }
db0844aa-01e0-47d0-8351-d6c96b9be0b9
2
public boolean matchesExpression(String text) { int expressionCount = getExpressionCount(); for(int i = 0;i<expressionCount;i++) { String currentExpression = getExpression(i); boolean isMatchingExpression = text.equals(currentExpression); if (isMatchingExpression) { return true; } } return f...