method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
590a2a7c-d8f1-4861-a7ca-439fc4e8ab00
7
public List<Item> getItems() { List<Item> list = new ArrayList<Item>( 1 ); for ( @SuppressWarnings( "rawtypes" ) Enumeration e = ( (DefaultMutableTreeNode) treeModel.getRoot() ).depthFirstEnumeration(); e .hasMoreElements(); ) { DefaultMutableTreeNode curNode = (Defau...
1dc86ba3-9a65-452e-8133-c1f5608f95d2
4
public static boolean verifyResourcesOnDisk() { File file = new File(MainFrame.getSettingsDirectory()+"/artists.db"); if(!file.exists()) { return false; } else { if(file.length() < 100) return false; } file = new File(MainFrame.getSettingsDirectory()+"/artistcorrect.db"); if(!file.exists(...
e3a95f95-910d-448d-a862-71f3d6687e84
6
@EventHandler(priority = EventPriority.HIGH) public void onPlayerRespawn(PlayerRespawnEvent event) { if (GraveyardUtils.useBed(event.getPlayer()) && event.isBedSpawn()) { return; } if (event.getPlayer().hasPermission("graveyard.closest")) { if (SpawnPoint.getAllowedL...
f637cfa0-81cf-42f8-a262-8b69a31d5972
1
public static byte[] pieceBuilder(int index, int offset, byte[] data) { ByteBuffer msg = ByteBuffer.allocate(13 + data.length); msg.putInt(13); msg.put((byte) 7); msg.putInt(index); msg.putInt(offset); for(byte b : data) msg.put(b); return msg.array(); }
8d449b6f-2fe0-44fd-95c3-a80ab4239dfa
9
@SuppressWarnings("unchecked") /** * Returns the results of calling the specified method from the specified * class using the specified parameters. * @param c Class to call the method on. * @param method Name of the method. * @param paramTypes Data types of the parameters being passed to the method. * @param par...
20705daf-cff9-4c6e-81d8-baf63087a0b7
3
@Override public void delete(Membre obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("DELETE FROM Membre where id=?;"); pst.setInt(1, obj.getIdMembre()); pst.executeUpdate(); System.out.println("sup...
fdf4daba-2ae0-4ef7-9954-4f70fc9f6b19
7
public void addNum(int numb){ Integer left = maxLH.peek(); Integer right = minRH.peek(); if(left==null) maxLH.offer(numb); else{ Integer num = numb; int ls = maxLH.size(); int rs = minRH.size(); int ln = maxLH.peek(); ...
b2966a78-3758-457c-a951-aa705f5941b9
3
private void fireGun(int x, int y){ //Check timer to see if previous bullet was fired recently for machine-guns Item ammo = inv.returnItem(currentWeapon + "Ammo"); if (ammo != null && ammo.returnValue() > 0){ if (checkTimer(currentWeapon)){ fireType(currentWeapon); } } els...
997c49db-fcd8-4de4-883c-225d3c236c8b
5
public String longestCommonPrefix(String[] strs) { //if the length is 0, return "". means nothing inside. if (strs.length == 0) { return ""; } //int count = 0; //for loop the first string int the list, check if the rest string match the char in the same position ...
7dee5ad9-655f-4f0f-833e-9165f99cc496
5
private void btnDeleteItemActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnDeleteItemActionPerformed {//GEN-HEADEREND:event_btnDeleteItemActionPerformed if (JOptionPane.showConfirmDialog(this, "Really delete this item?", "WiiExplorer", JOptionPane.YES_NO_OPTION) != JOption...
a61e7894-563f-403b-941e-89a3c0030f52
5
public static void main(String[] args){ Scanner reader = new Scanner(System.in); char loop = 'y'; while (loop == 'y'){//While loop allows program to be re-used Scanner scan = new Scanner(System.in); Random rand = new Random(); int size = 0; boolean bError = true; System.out.println("------------RAD...
7a3c9dbc-cded-4fc0-ac0e-53e04c59fd4a
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...
bfbe95cd-4eaf-40f3-bbaa-c382c2a9d9da
2
public static String getLongestCommonPrefix(String a, String b) { int i; for (i = 0; i < Math.min(a.length(), b.length()); i++) { if (a.charAt(i) != b.charAt(i)) break; } return a.substring(0, i); }
bb91bbe1-9e99-492b-a45f-b48e7f7388e8
4
public final void handleEvent(final Event event) { switch (event) { case CLEAR_INT: this.interrupted = false; break; case INT: this.interrupted = true; break; case LOCK_INT: this.locked = false; break; case UNLOCK_INT: this.locked = true; break; default: break; } }
b1f55709-9aeb-404f-9e37-67f140793482
0
public String getShopPhone() { return shopPhone; }
3782a2ad-db5e-4998-a23b-dd1975430135
8
private boolean checkwalls(Location loc) { Location north = loc.add(0, -1); Location east = loc.add(1, 0); Location south = loc.add(0, 1); Location west = loc.add(-1, 0); int yes = 0; if (north.getY() >= 0 && map[north.getX()][north.getY()] == nonWall) yes++; if (east.getX() < xSize && map[east.getX(...
a3d4a7c0-9574-4d5e-85c8-29c0de65c78a
5
public void writeImage() { ID3v2 tag = f.getId3v2Tag(); if (hasImage == 1) { String tempName = path + "_temp_backup_ImgToID3"; try { //System.out.println("saving to " + path); tag.setAlbumImage(img.getImageData(), img.getMimetype()); //save new file f.save(path + "_tagged_ImgToID3"); ...
f6bd8805-6efd-4664-8de5-d2253e829429
7
private void jButton1MouseClicked(MouseEvent evt) { Actions action = null; switch(getSelectedButtonText(this.buttonGroup1)){ case "Question 1: Comparaison des fonctions de hachage ": action = Actions.HASHFUNCTIONS; break; case "Question 2: Estimation de la taille du fichier p...
991bd2da-2587-4ed7-807e-dcc18d5a9319
5
public void validate() { // // Make sure the account name is correct // if (nameLabel != null) nameLabel.setText("<HTML><h1>"+account.getName()+"</h1></HTML>"); // // Make sure the transaction table is correct // if (table != null) { ...
f0f0772b-f7b4-44e2-86b4-5a40e0f24e7a
9
public void update() { EntityManager manager = getEntityManager(); /** < cria uma lista de eventos de movimentos feitos */ List<Event> actionEvents = getEntityManager().getEvents( MovementCommandEvent.class); /** < variavel que recebera as novas coordenadas a serem manipuladas */ CellPlacement Coord; ...
fa69b807-0b73-4b6f-8648-8ffe77151d61
4
private void delIgnore(long encodedName) { try { if (encodedName == 0L) { return; } for (int id = 0; id < ignoreCount; id++) { if (ignoreListAsLongs[id] == encodedName) { ignoreCount--; needDrawTabArea = ...
a5a8d77e-c1ac-44ac-9e1c-7f4774b1e858
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Group group = (Group) o; return Double.compare(group.mass, mass) == 0 && !(elements != null ? !elements.equals(group.elements) : group.elements != null...
1b09f172-c7b0-4d7e-a3af-42ead50c5fb8
7
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((bonding!=null)&&(!aborted)) { MOB animal=bonding; if((messedUp)||(animal==null)) commonTell(mob,L("You've failed to bond with @x1!",bonding.name())); else...
ab94b364-005e-4faf-9ace-6befc03973ae
2
public static Object introspect(Object obj,HashMap<String,Object> values) throws NoClassFoundException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ParseException{ Class theClass = getClass(obj); HashMap<String,Method> fieldToMethod=initializeMethodToValue(theClass.getDeclaredFields...
3edb3d41-24b7-4870-9170-5736db42c9a6
2
@Override public boolean hasNext() { if (position >= buttonLinkCommands.size() || buttonLinkCommands == null) { return false; } else { return true; } }
759fd5e4-6ffa-4a1b-afa7-48adcb9057f5
5
@Override public boolean containsValue( Object value ) { Iterable<T> values = new ValueIterator( root ); for (T v : values) { if (v == value || (v != null && value != null && v.equals( values ))) { return true; } } return false; }
4dba6f97-85ea-475e-91c7-346f3dc7a0f9
8
public void update() throws MaltChainedException { // Retrieve the address value final AddressValue arg1 = addressFunction1.getAddressValue(); final AddressValue arg2 = addressFunction2.getAddressValue(); // featureValue.setKnown(true); // if arg1 or arg2 is null, then set a NO_NODE null value as feature valu...
df0e178f-c644-4928-ba08-1cb605750310
4
public List<supplier> retrieveSupplierData() throws SQLException{ try{ databaseConnector=myConnector.getConnection(); stmnt=(Statement) databaseConnector.createStatement(); SQLQuery="SELECT * FROM familydoctor.supplier"; dataSet=stmnt.execute...
3ff13574-bf05-4cf0-bfa1-90ecce9ddd4b
2
public JComponent asJComponent() { this.initialize(); JPanel elementPanel = new JPanel(new GridBagLayout()); elementPanel.setBackground(Color.WHITE); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(PADDING, PADDING, PADDING, PADDING); c.anchor = GridBagConstraints.WEST; ...
34973790-e159-4d8b-a4be-e4bc493d37e3
9
@Override public String healthText(MOB viewer, MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is squealing in bloody pain!^N",mob.name(viewer)); else if(pct<.20) return L("^r@x1^r is covered in blood.^N",mob.name(viewe...
a97b88dd-ef82-4b09-924d-9191e79023e8
2
public static String strToBase36(String str) { String returnStr = ""; if (StringUtil.isNullOrEmpty(str)) { return returnStr; } for (int i = 0; i < str.length(); i++) { int n = str.codePointAt(i); returnStr = returnStr + pad(intToBase36(n), 3, "0"); ...
82cce7b6-60b5-43ec-aa1b-01877db4c0a4
5
private boolean readExpected( char expected, StringBuffer b ) throws IOException { if( !readChar() ) return false; boolean matches = ( this.currentChar == expected || ( !this.caseSensitive && Character.toLowerCase(this.currentChar) == Character.toLowerCase(expected) ) ); ...
d822e506-9199-49f8-b830-b2e4df52a35c
5
public CheckResultMessage check12(int day) { int r = get(30, 5); int c = get(31, 5); BigDecimal b = new BigDecimal(0); if (checkVersion(file).equals("2003")) { try { in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); b = getValue(r + 3 + day, c, 7).add( getValue(r + 3 + day, ...
ac63d433-f571-4946-abee-454062dd560a
6
@Override protected boolean configureQuery() { _twitterQuery = new Query(); _twitterQuery.setLang("en"); if (_configuration.exists(SNConnectorKeys.CONF_QUERY_KEY.getId()) > 0) { _search = _configuration.getValue(SNConnectorKeys.CONF_QUERY_KEY.getId(), ""); _twitterQuery.setQuery(_search); } el...
983fbdfc-b19b-4690-99ce-1c923493ddec
4
public static void exportarTablas (List <JTable>tab, List<String> nombres) throws Exception{ //chequea que esten bien pasados los parametros (misma cantidad de tablas que de nombres) if(nombres.size()!=tab.size()){ //si esta mal lanza una excepcion throw new Exception("Error en los parametros al exportar a ex...
15190dd7-09f9-41ad-8e3d-f04c4f86c1b6
1
public static int applyHue(int color, double hue, double saturation) { double l = getLightness(color); double s = saturation; double v2; if ( l < 0.5 ) v2 = l * (1+s); else v2 = ( l + s ) - ( s * l ); double v1 = 2.0 * l - v2; //System.out.println("l: " + l + "s: " + s); int r = (int)(255 ...
fda2363f-16cf-43dd-9ea4-12468e20b431
2
public Unit(float x,float y, float width, float height, boolean visible, float dx, float dy, unitType uT) { super(x, y, width, height, uT.locationMid, visible, dx, dy); try { texture = TextureLoader.getTexture("PNG", new FileInputStream(new File(uT.locationMid))); } catch (FileNotFoundException e) { // TODO...
6edbef78-fcde-4000-8bce-f0cc72b85439
8
void buildMapping(Set<Class<?>> classes) throws ClassValidationException { long timer = System.currentTimeMillis(); mappingEngine.clearMapping(); patternMapping.clear(); if (classes == null || classes.size() == 0) { if (!configuration.getUseClassAutoDescovery()) { ...
0eecb607-83f4-493f-b8bc-150a7c3eae43
0
public String getId() { return id; }
1e842345-0d8b-425e-9b5e-532c6834ab77
9
public Game(Board board, Set<Pawn> pawns) { if (board == null || pawns == null) throw new NullPointerException(); this.board = board; // Filter dead pawns Set<Pawn> pbuf = new HashSet<Pawn>(); for (Pawn p : pawns) if (p.isAlive()) pbuf.add(...
ad25ca39-dc58-46e8-b7fd-89e384c05882
4
@Override public Expression parseExpression() throws IOException { Expression expression = new Expression(); expression.getTermList().add(parseTerm()); while (curToken.type == PLUS || curToken.type == MINUS) { switch (curToken.type) { case PLUS: ...
33fd38cb-b633-4b66-ab45-d672951317d9
0
public PropertyFilterChainImpl() { super(); removeAllFilters(); }
ed513f49-f54d-4702-96cf-01c5d73f3672
8
public ShopItem[] getItemsByName(String... names) { Set<ShopItem> cache = new HashSet<>(); if (names != null && names.length > 0) for (ShopItem nextItem : items) { String name = nextItem.getName(); if (!isStringValid(name)) continue; else for (String nextName : names) if (isStringVali...
593310c9-35b8-46ea-82be-6c1abc4ccffc
3
@Override public void enter(GameContainer container, StateBasedGame game) throws SlickException{ if(map != null){ tm = new TowerManager(); im = new InvaderManager(); if(mapID == null){ map = new Map(mapID, true); tileset = map....
8b4ea669-2994-4f46-ab37-986bd3ed6dea
0
public static void changeIt(String s) { s = "Value 2"; }
ea0882b4-0fd7-4383-95a1-3d3d8bcca297
3
@Override public ByteBuffer encodeMessage(final Message msg) { if (msg instanceof BinaryMessage) { ByteBuffer buf = ((BinaryMessage) msg).codeMessage(); byte[] name = null; try { name = msg.getClass().getCanonicalName().getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { // never call...
5240f92a-f4ad-470d-bfff-888f999830c4
2
public static Welcome getInstanceWelcome(){ if (welcome==null){ try { welcome = new Welcome(); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return welcome;}
56117287-5f0d-48c4-8ffb-0316527e63f9
0
public void setFunId(Integer funId) { this.funId = funId; }
8e9c409b-52e6-4c85-8108-9034708739d0
4
public static String getInputDir(WebSite webSite) { switch (webSite) { case CSDN: return "/Users/king/Documents/WhatIHaveDone/KaiJiangLou/csdn/data"; case BaiduSalon: return "/Users/king/Documents/WhatIHaveDone/KaiJiangLou/baidu_salon/data"; case DaHuoDong: return "/Users/king/Documents/WhatIHaveDone/K...
d5178cbd-b557-40ff-89c4-5261c1d02a1b
9
public void getDiskIOInfoByCmd() { double ioTs = 0; // MEDIUMINT double readSpeed = 0; // MEDIUMINT double readKB = 0; // MEDIUMINT double writeSpeed = 0; // MEDIUMINT double writeKB = 0; // MEDIUMINT List<String> diskNameList = getDiskNameByFile(); String commond = "iostat -d -k"; BufferedInputStream b...
f1f0c573-c860-4446-8193-e488d5226f70
9
private void btnAddUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddUserActionPerformed String userId,username,pass1="",pass2="",role; char[] pwd1,pwd2; userId=this.txtUserID.getText(); username=this.txtUsername.getText(); pwd1=this.txtPassword.getPass...
9555521f-e708-43e6-8844-60eb3d4c0671
9
public MyGraph(Collection<Vertex> v, Collection<Edge> e) { checkNull(v, "vertices"); checkNull(e, "edges"); graph = new HashMap<Vertex, Set<Edge>>(); for (Vertex vertex : v) graph.put(vertex, new HashSet<Edge>()); for (Edge edge : e) { if (!graph.containsKey(edge.getSource()) || !graph.containsKey(edge....
f2f730f9-8485-49bd-ba51-a49019e04079
6
private static void writeALevel(String level) throws Exception { List<Double> caseVals =new ArrayList<Double>(); List<Double> controlVals = new ArrayList<Double>(); File inFile = new File( ConfigReader.getMetabolitesCaseControl() + File.separator + "topeFeb2014_raw_" + level + ".txt"); if( leve...
6570f27d-7ac9-47c6-8269-7c25286fef20
7
protected void readImage() { ix = readShort(); // (sub)image position & size iy = readShort(); iw = readShort(); ih = readShort(); int packed = read(); lctFlag = (packed & 0x80) != 0; // 1 - local color table flag interlace = (packed & 0x40) != 0; // 2 - inte...
953b8f0f-f73d-4189-9d9f-0a4c9a79e4df
0
public void setAlpha (double alpha) { this.alpha = alpha; }
05a357cb-dab7-468b-8b61-447f319f614b
8
private static void fargeleggOgSjekkNaboer(char[][] tegn, int i, int j) { tegn[i][j] = farge; antallAvHver[farge - '0']++; if(i > 0 && tegn[i-1][j] == 'S') { //sjekk over fargeleggOgSjekkNaboer(tegn, i-1, j); } if(j > 0 && tegn[i][j-1] == 'S') { //sjekk venstre fargeleggOgSjekkNaboer(tegn, i, j-1); ...
228d23db-9ddc-4d9f-bbbf-86b1d75300f4
6
public static void main(String args[]) { boolean debug = false; String programFile = null; if (args[0].charAt(0) == '-') { if (args[0].equals("-trace")) { debug = true; } programFile = args[1]; } else { programFile = args[0]; } FileInputStream in = null; t...
7f5db8fe-62a9-439a-afbb-3bd3d2e239a6
7
public void renderTile(float xp, float yp, float xOffset, float yOffset, Sprite sprite) { xOffset = 0; yOffset = 0; for (int y = (int) 0; y < 32; y++) { float ya = yp + y; for (int x = (int) 0; x < 32; x++) { float xa = x + xp; if ((xa + xOffset) < 0 || (xa + xOffset) >= width || (ya + yOffset...
028fdec5-2318-49de-8f4f-aad5676d1fb8
8
@Override public boolean loadMap(Object source) { BufferedReader br = null; String line = ""; String csvSplitBy = ","; File file = new File((String) source); if (!file.exists()) { throw new IllegalArgumentException("file doesn't exist"); } try {...
ce956dad-cb12-4d44-b107-29f44a4be4d8
4
public static void main(String[] args) { EntityManagerFactory factory = Persistence.createEntityManagerFactory("elo"); entityManager = factory.createEntityManager(); entityManager.getTransaction().begin(); EloPersistence ep = new EloPersistence(); ep.setEntityManager(entityManager); if(ep.findAll(Spiele...
ec2878b5-c08c-4c35-9e5e-44994a84a6ca
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; final Ability A=getInebriation(); if((A==null)||(!A.okMessage(myHost, msg))) return false; if(msg.source()!=affected) return true; if(msg.source().location()==null) ...
c8740806-5036-4a09-8e4c-d4d180cc9a24
7
public void redirect() { String roleName = db.getRole(); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); try { if (roleName != null) { if (roleName.equals("customer")) { externalContext.redirect(externalCon...
85a0e3e0-c857-4aae-aa93-890f014e235e
0
public Client(InetAddress address, int port, String name) { this.address = address; this.port = port; this.name = name; }
35f8f068-8621-4c13-a44e-3ee09e23b2f2
5
public boolean isInArea(Area checkArea, boolean isAllWithinArea) { return ((isAllWithinArea && pos1.isInArea(checkArea) && pos2.isInArea(checkArea)) || (!isAllWithinArea && (pos1.isInArea(checkArea) || pos2.isInArea(checkArea)))); }
dbc1dfee-d4e7-4ebc-8d41-da03d9d6a57b
3
public static void end(int track) { switch (track) { case 0: splash.stop(); splash.setLooping(false); break; case 1: game.stop(); game.setLooping(false); break; case 2: kill.stop(); kill.setLooping(false); break; } }
da06d673-1993-4d00-9b4e-97d2eb3b2a88
3
private void addSpeed(Effect e, boolean positive) { int x = positive ? 1 : -1; if (e.getStat().equals("speed")) { // TODO remove magic PlayerPhysics physics = ((PlayerPhysics) components .get(ComponentType.PHYSICS)); physics.setSpeed(physics.getSpeed() + e.getBoost() * x); } else if (e.getStat().equals...
20cbefe2-0a36-4fdc-9ccc-4299619fc2c6
4
public Polylinje kortastGulSamling(Polylinje[] polylinjer){ Polylinje valdPolylinje = null; int j = 0; double kortast = 0; for(int i = 0; i < polylinjer.length; i++) { if(polylinjer[i].getFarg().equals("gul")) { if(j == 0) { kortast = polylinjer[i].langd(); valdPolylinje = polylinjer[i...
2e3693ef-dc35-403f-98e5-e0b87dd17c0c
4
private boolean isTriggeredByMouse() { StackTraceElement[] elements = new Throwable().getStackTrace(); for (Class<?> mouseClass : MouseLoader.getDetectedMouseClasses()) { for (StackTraceElement element : elements) { if (element.getClassName().equals(mouseClass.getCanonicalName())) { return tru...
3af14249-a360-4815-8699-4932b2191f1e
0
public void initGL() { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); ...
8e11da43-a535-416b-ba06-13bd2bdecc32
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 fe...
580177a6-124c-44dc-b76c-54f7c8a9309d
5
private Queue<State> search(State initial, State goal) { Queue<State> frontier = new LinkedList<State>(); frontier.add(initial); Map<State, State> tracks = new HashMap<State, State>(); tracks.put(initial, null); while(!frontier.isEmpty()) { State current = frontier.remove(); if(current.equals(goal)) ...
8f5bd586-a9ac-4361-b566-c2a24827119c
8
private static int cardinalYaw (float yaw){ int cardinalYaw = -1; yaw = (yaw % 360 + 360) % 360; if (yaw >= 315 || yaw <= 45){ cardinalYaw = 0; } else if (yaw > 45 && yaw < 135){ cardinalYaw = 90; } else if (yaw >= 135 && yaw <= 225){ cardinalYaw = 180; } else if (yaw > 225 && yaw < 315){ ...
14ecda93-4808-4a71-903d-3289aaf16a9d
4
private void write_back_stage() throws Exception { int format = current_instruction.get_format(); switch (format) { case 0: write_back_value = alu_result; write_register(); break; case 1: write_back_value = memory_result; write_register(); break; case 4: if (current_instruction.get_type(...
379d1026-7aca-4902-a3c3-8acfd61d689e
3
@Override public void drop(DropTargetDropEvent dtde) { try { Transferable transferable = dtde.getTransferable(); // we check if the type of the dropped element is appropriate if (transferable .isDataFlavorSupported(LevelEditorTransferable.FIELD_STATE_DATA_FLAVOR)) { // accept and process the ...
3c433087-f257-4944-b6b6-873a7edac595
8
private String readLine(InputStream in) { // reads a line of text from an InputStream StringBuffer data = new StringBuffer(""); int c; try { // if we have nothing to read, just return null in.mark(1); if (in.read() == -1) { return null...
7f81e5fb-a228-42e8-8d01-982d91f53094
2
public boolean replaceSubBlock(StructuredBlock oldBlock, StructuredBlock newBlock) { for (int i = 0; i < 2; i++) { if (subBlocks[i] == oldBlock) { subBlocks[i] = newBlock; return true; } } return false; }
60d338e0-8d86-44b9-8045-fd8869fe1bbe
8
private double[] adjustHighLatTimes(double[] times) { double nightTime = timeDiff(times[4], times[1]); // sunset to sunrise // Adjust Fajr double FajrDiff = nightPortion(methodParams.get(this.getCalcMethod().getId())[0]) * nightTime; if (Double.isNaN(times[0]) || timeDiff(times[0], tim...
ca7c4b5a-0110-4a4a-a9e1-e0201e32db69
2
public boolean Salvar(Venda obj){ boolean ok = false; try{ if(obj.getId() == 0){ PreparedStatement comando = conexao .getConexao().prepareStatement("INSERT INTO vendas (horario,id_usuario," + "id_cliente,id_tipo_pagamento,ativo,valo...
12d57279-83a3-423a-96c9-6f8decab37ed
2
public void draw(Graphics g, Location origin, double scale, Color color, int xdiff, int ydiff) { for (Intersection i : intersections) { i.draw(g, origin, scale, color, xdiff, ydiff); } for (Segment s : segments) { s.draw(g, origin, scale, color, xdiff, ydiff); } }
abee30e1-bf28-4163-8d95-e34a708a68ff
1
@Override public boolean accept(File file) { String name = file.getName(); if (FilenameUtils.wildcardMatch(name, wildcards, caseSensitivity)) { return true; } return false; }
0d8d95c2-deb3-4599-ac86-871113da4f7b
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...
92268ea6-17a7-45b5-addf-7ee0b11d3eea
2
static void compress(InputStream in, BitOutputStream out) throws IOException { FrequencyTable freq = new SimpleFrequencyTable(new FlatFrequencyTable(257)); // Initialize with all symbol frequencies at 1 ArithmeticEncoder enc = new ArithmeticEncoder(out); while (true) { int b = in.read(); if (b == -1) b...
98edeb6f-03d7-47b0-87d4-7f7c0cffb4b6
5
public BigDecimal effectiveSampleNumber_as_BigDecimal() { boolean holdW = Stat.weightingOptionS; if (weightingReset) { if (weightingOptionI) { Stat.weightingOptionS = true; } else { Stat.weightingOptionS = false; } } BigDecimal nEff = BigDecimal.ZERO; switch (type) { case 1: case 12: B...
ed5dd4cf-1302-4d6c-8f38-fe50f48cf5a0
2
public void printNodeLinks(GraphNode node){//prints all links from a node ignoring if the a node doesnt have links and its list is null. for(int i=0;i<node.getLinks().getLength();i++) { if (node.getLinks().get(i) == null) {//if the node does not have links. continue; } ...
d69de858-8e99-49ba-944f-f7924a5f35e9
8
@Override public String healthText(MOB viewer, MOB mob) { final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints())); if(pct<.10) return L("^r@x1^r is raging in bloody pain!^N",mob.name(viewer)); else if(pct<.20) return L("^r@x1^r is covered in blood.^N",mob.name(viewer))...
85896a45-b7a8-42c5-a79e-224a482927cb
2
public double getDouble(String key, double def) { if(fconfig.contains(key)) { return fconfig.getDouble(key); } else { fconfig.set(key, def); try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); } return def; } }
c5016d2b-3e5e-40bb-b2f2-287b2fa3f03e
7
public Graphics2D drawLineToObjects(Graphics2D g) { if (Level.hunt[level.levelNumber][0] != null && Level.hunt != null && Level.hunt[level.levelNumber] != null) { if (level.playerNearPickup(player)) { for (HuntObject hObj : Level.hunt[level.levelNumber]) { if (hOb...
d1337997-6794-4f92-9bd8-30df11db7842
0
public double getLongitude() { return longitude; }
29d6e563-5f33-458d-9952-422a940f970d
4
public void put(Key key, Value val) { if (val == null) { delete(key); return; } // double table size if 50% full if (N >= M/2) resize(2*M); int i; for (i = hash(key); keys[i] != null; i = (i + 1) % M) { if (keys[i].equals(key)) { vals...
514adba4-4146-41cf-8c39-cebdea9e920d
6
public int removeAll(T data) { int removed = 0; Link<T> temp = head; while (temp != null) { if (temp.getData().equals(data)) { removed++; if (head == tail) { head = null; tail = null; } else { ...
90b6b2da-454b-4f0a-a6f6-6f4a7f872695
8
public void convertToSQL() { sqlString = new ArrayList<String>(); sqlString.add("START TRANSACTION;"); for (Workplace w : workplaces){ String workplace = "INSERT INTO workplace (workplaceid, workplace_name)" + "VALUES (" + w.getWorkplaceid() + ", " + "\"" + w.getWorkplaceNa...
ce37a520-6460-403f-8338-52f7a8ce7214
6
Function_3(Dictionary d) { super(d); // Convert bounds dictionary values. Vector boundTemp = (Vector) d.getObject("Bounds"); if (boundTemp != null) { bounds = new float[boundTemp.size()]; for (int i = 0; i < boundTemp.size(); i++) { bounds[i] = ((...
d36c6788-0ac6-4b7a-a59c-15a5eee5b12c
3
public String[] split(String text) { if (text == null) { text = ""; } int last_match = 0; LinkedList<String> splitted = new LinkedList<String>(); Matcher m = this.pattern.matcher(text); // Iterate trough each match while (m.find()) { // ...
f9fbd1a2-57f6-4000-982d-e46d35496bbd
8
private void logInButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInButtonActionPerformed //hash the password //MessageDigest handles hashing in various forms MessageDigest md; //declare the password hashed string String hashedPassword=""; try ...
83fab04d-b269-4c75-95f5-ef18746dce93
3
public boolean startTransaction() throws DatabaseManagerException { if( !inTransaction ) { if( conn == null ) { throw new IllegalStateException("Connection closed!"); } try { originalCommit = conn.getAutoCommit(); conn.setAutoCommit(false); inTransaction = true; } catch(SQLException e) { ...
7c733c2c-357f-44bb-bd99-3737e542f13c
1
public Class<?> getColumnClass(int col) { return getValueAt(0, col).getClass(); }
ff78b07b-b2af-412e-b202-1fc5f1b9f5c8
0
private TestTicketPool createTicketPool() throws Exception { IRailwayRepository repo = ServiceManager.getServices() .getRequiredService(IRailwayRepository.class); TrainNumber tn = Queries.query(repo.getTrainNumbers()).first( new Predicate<TrainNumber>() { @Override public boolean evaluate...
9d2f0718-ada5-4a11-92ea-883dc616b177
9
public static void main(String[] args) { // TODO Auto-generated method stub int sum = 0; for (int a = 0;a <= 9; a++) for (int b = 0;b <= 9;b++) for (int c = 0;c <= 9; c++) for (int d = 0;d <= 9; d++) for (int e = 0;e <= 9; e++) for (int g = 0;g <= 9; g++) { String str1 = "" +...
1c0669d1-8c78-4019-840b-68af5aae8c93
5
public static void downloadResource(String filename, String urlString) throws FileNotFoundException, IOException { BufferedInputStream in = null; FileOutputStream fout = null; try { File f = new File(filename); f.getParen...
08e5ff81-75ad-4ab1-a9af-14cc9e4074a7
3
private void restoreLineStyle(Annotation annotation) { Object border = annotation.getObject(Annotation.BORDER_KEY); BorderStyle borderStyle = annotation.getBorderStyle(); borderStyle.setBorderStyle(lineStyle); // remove the dashed border dashed entry if any as we will use // bo...