method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ec3c60f6-7e17-4a53-8553-7f82e1229265
4
static void dabBench(int type, boolean useAA, int iterations, int sMin, int sDiff, boolean useTexture) { CPBrushManager manager = new CPBrushManager(); CPBrushInfo brush = new CPBrushInfo(); brush.type = type; brush.isAA = useAA; if (useTexture) { brush.texture = 1; int textureSize = 8; CPGreyBmp ...
a1958a00-146e-44ef-bf34-7a4bc62bc447
7
public static org.jdom2.Document demanderProduits(String nom) throws ClassNotFoundException, UnknownHostException, IOException { org.jdom2.Document res = null; try { gbu = (IGestionBoutiques) Naming.lookup("rmi://localhost/GestionBoutiques"); } catch (NotBoundException ex) { ...
21a61c42-3246-41d1-9c1a-3a958f25c6a6
2
private void writeIndent() throws IOException { if (bIndent) { for (int i = 0; i < openElements.size(); i++) { w.write(indentString); } } }
0e6fea63-c50f-4acc-96b1-30949fa9af08
4
public boolean logOutActions() { boolean canLogout = true; if (user.username == null) return true; if (user.getUserType().equals(UserTypes.seller)) { canLogout = user.canSellerLogout(); } else { doBuyerLogoutActions(); } if (canLogout) { if (user.getUserType().equals(UserTypes.seller)) ...
3c833479-f94f-4a7a-94bb-ed9975507233
9
void readPattern(Scanner s) { List entry=null, level=entrytab[(int)s.pattern[Character.isDigit(s.pattern[0])?1:0]%256]; int[] nodevalues=new int[s.patlen+1]; int ich=0, inv=0; java.util.Enumeration eentry=level.elements(); PATTERN: for(;;) { if(Character.isDigit(s.pattern[ich])) { nodevalues[inv+...
6612ed40-6db8-45d6-a1f7-25d1a7d88682
5
int[] readSimFile() { int[] inputVars = new int[6]; try { BufferedReader input = new BufferedReader(new InputStreamReader(new FileInputStream(filePath))); try { String[] sAry = input.readLine().split(","); for (int i = 0; i < sAry.length; i++) { ...
8954d1ff-cb2a-4767-bcb9-ba287834e446
9
public static Poly2Transform corrPointsToPoly2Transform( double[] fromPoints, int fromPointsOff, double[] toPoints, int toPointsOff, ...
b4bd6350-d92d-41a9-bc3b-fafd89303780
0
public void setDataTypeLineIndex(int dataTypeLineIndex) { this.dataTypeLineIndex = dataTypeLineIndex; }
23078fcf-55a0-42c4-b69b-bbb7cdb46428
7
public static void Update() { new Thread() { @Override public void run() { try { //BuildGui.tabbedPane.remove(1); UpdPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); OutText.setText("<span style=\"...
6a1ec07c-f83e-49fb-a83a-2a53220edffa
1
public FileParser(String filePathString) throws GOLException { if (!(filePathString == null)) { this.filePath = Paths.get(filePathString); } else { throw new GOLException("Bitte Datei auswählen."); } }
d6cb452a-8a29-4646-98d6-bff4f74343b2
3
@Override public void deserialize(Buffer buf) { spellId = buf.readShort(); if (spellId < 0) throw new RuntimeException("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0"); spellLevel = buf.readByte(); if (spellLevel < ...
ac4dd5a9-735f-4253-8e4d-cbea0b80a9f1
4
private void updateBoard() { clearBoard(); //draw the GBlock board[gBlock.location().y][gBlock.location().x] = BlockType.GBLOCK; //draw ghost for (Point p: shape.getBlocks(gBlock.location())) board[p.y][p.x] = BlockType.SBLOCK; //draw all MBlocks for (MBlock b : mBlocks) board[b.location().y][b.loca...
65c98441-32ee-40c3-87b3-c1e4994acf68
4
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ScyBDItemPK other = (ScyBDItemPK) obj; if (!Objects.equals(this.noDokumen, other.noDokumen)) { ...
e091298e-ef7c-4a3a-96f0-cf765688b6e4
1
public String getName() { if(animated) return name + animFrame; else return name; }
49c5fec9-2633-482d-907f-081d25c87525
3
public LaterThanFilter createPercTimeFilter(double perc, HackFilter... fis) { ArrayList<Long> timeStamps = new ArrayList<Long>(); outerloop: for(HackResult res : allHacks) { for(HackFilter fi : fis) { if ( !fi.accept(res) ) continue outerloop; } timeStamps.add(...
04250996-f43d-4474-8b18-ce498e19570f
2
public static void main(String[] args) { Document doc; try { doc = Jsoup.connect("http://en.wikipedia.org/wiki/Main_Page").get();//gets the page source Elements newsHeadlines = doc.select("#mp-itn li");//# indicates the id and li indicates the tag, gets the elements between the two tags //Element firstchil...
7314fa7b-14b8-4abc-99e1-2eb16f37777e
3
private void getFileName() { String fileName = ""; System.out.println("Enter file names (one on a line): "); BufferedReader reader = new BufferedReader(new InputStreamReader( System.in)); while (true) { try { fileName = reader.readLine(); } catch (IOException e) { System.out.println("Error rea...
952df92e-28df-4a5f-b38e-9c7aef30e605
1
private void shuffleDataSet(Object[] array){ int n = array.length; Random random = new Random(); random.nextInt(); for (int i = 0; i < n; i++) { int change = i + random.nextInt(n - i); swap(array, i, change); } }
28ffff66-da01-4d66-b37f-9032520822d6
0
public Rectangle getRect(){ return new Rectangle(x,y,w,h); }
5d5095ba-58e4-4a75-89e5-a70c94f2f193
9
private List<String> getValidMove(List<String> results, int i, int j) { List<Field> fields = chessman.getValidMoves(i, j, new CheckIsValidCommand()); int smallestFieldNearby = Field.NOT_VISITED; Field smallestField = null; boolean notReached = true; for (Field field : fields) { field.reachedInStepNumber = ...
23a8362b-6207-42c9-9fd1-a910d98faba1
8
public void Ordenar_QuickSort(int V[], int izq, int der) { int i, j; int x, aux; i = izq; j = der; x = V[(izq + der) / 2]; do { while ((V[i] > x) && (j <= der)) i++; while ((x > V[j]) && (j > izq)) j--; if (i <= j) { aux = V[i]; V[i] = V[j]; V[j] = aux; i++; j--; } ...
51348e3d-a19e-47e2-8f22-6855ad7fab1e
2
private void giveBirth(List<Actor> newGrass) { // New grass are born into adjacent locations. // Get a list of adjacent free locations. Field field = getField(); List<Location> free = field.getFreeAdjacentLocations(getLocation()); int births = breed(); for(int b = 0; ...
6f58b1d7-8a41-453c-a55f-5c4181522f02
5
public static VolatileClass getMinecraftClass(String name) throws ClassNotFoundException, FunctionUnavailableException { if(_mcClassFinder == null) { throw new FunctionUnavailableException("The Minecraft package could not be found or assumed."); } String className = _mcCl...
2544db32-fb14-4cc4-81ea-6e06c99fcabb
0
public Set<Plotter> getPlotters() { return Collections.unmodifiableSet(plotters); }
cc0614ee-aba4-4cf7-9790-7db01389bbe7
8
@Override public String toString () { StringBuffer result = new StringBuffer (500); int i, j; String cols = " A B C D E\n"; String space= " +---+---+---+---+---+\n"; result.append(cols); for (i=1; i<=5; i++) { result.append(space); result.append(" "+i+" "); for ...
a5989605-bf1e-4064-a01d-96d6610e037c
3
@Override public List<Livro> ListByNome(String nome) { Connection conn = null; PreparedStatement pstm = null; ResultSet rs = null; List<Livro> livros = new ArrayList<>(); try{ conn = ConnectionFactory.getConnection(); pstm = conn.prepareStatement(LISTB...
52b64358-5a86-4892-86c0-6d02e8a1ca91
7
protected static Object evalClass(Class<?> clazz, ScriptContext ctx) throws ScriptException { // JSR-223 requirement ctx.setAttribute("context", ctx, 100); if (clazz == null) { return null; } try { boolean isPublicClazz = Modifier.isPublic(clazz.getModifiers()); // find the setScriptContext ...
caacf595-aabe-49f9-9ede-3cc38d7f0a4b
3
public static void main (String [] args) { Socket s = null; InputStreamReader input; BufferedReader b; PrintWriter p; String result = null; InputStreamReader stdin; BufferedReader console; String line = null; try { s = new Socket(Utils.REGISTRAR_ADDR, Utils.FAULTMNGR_PORT); s.setKeepAlive...
5579ba99-a2c5-42a5-a5e9-2c404db4c49b
1
public void normalize(int count) { for (int i = 0; i < result.length; i++) { result[i] /= count; } calculateStatistic(); }
8bfef173-f249-4486-925f-01944f2451ff
7
public void readFromXML(XMLStreamReader in) throws XMLStreamException { String senderString = in.getAttributeValue(null, "sender"); sender = game.getFreeColGameObject(senderString, Player.class); String recipientString = in.getAttributeValue(null, "recipient"); recipient = game....
5573ba52-d7d6-49d2-90fd-cc1a583b1210
7
public T successor(T data) { if (this.isEmpty()) return null; if (this.getData().compareTo(data) < 0) { if (this.getRight() == null) return null; return this.getRight().successor(data); } if (this.getData().compareTo(data) > 0) { if (this.getLeft() == null) return...
d02913c7-dc7a-49d5-8c5a-d0754a3e4a63
1
public void toggleDisclosure() { List<TreeContainerRow> rows = mRoot.getRecursiveChildContainers(null); if (!rows.isEmpty()) { setOpen(!isOpen(rows.get(0)), rows); } }
8a65997a-55c2-4b78-a61b-ed6670db4321
6
private Result _evaluate(EvaluationCtx context) { // If the Target is null then it's supposed to inherit from the // parent policy, so we skip the matching step assuming we wouldn't // be here unless the parent matched if (target != null) { MatchResult match = target.match(co...
5c979354-97da-4668-bb3a-2629166e5c52
1
public VanhojenKoordinaattienMuistaja(Pelihahmo hahmo1, Pelihahmo hahmo2){ hahmo1nRaajat = new Raaja[4]; hahmo2nRaajat = new Raaja[4]; for (int i=0; i<4; i++){ hahmo1nRaajat[i] = (Raaja) hahmo1.getOsat().get(i); hahmo2nRaajat[i] = (Raaja) hahmo2.getOsat...
ac5edfe8-1820-4f7b-9d64-e8c4c42649d4
5
public boolean intersects(Line other) { double r_x = x2 - x1; double r_y = y2 - y1; double p_x = x1; double p_y = y1; double s_x = other.x2 - other.x1; double s_y = other.y2 - other.y1; double q_x = other.x1; double q_y = other.y1; double rCrossS ...
d56e5a4a-3d76-4358-8ee4-c90811970eb2
6
public GUI() { super(Game.name+" v"+Game.version); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 641, 360); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); // Command-entering text field ...
20533527-f9eb-4c06-b884-b7bd174e9d2d
9
public void actionPerformed(ActionEvent e) { if (e.getSource() == downloadBt ) { downloadBt.setEnabled(false); String inputURL = url.getText(); //Check a url was inserted if (inputURL.length() == 0) { JOptionPane.showMessageDialog(null, "Please enter a url to download from"); downloadBt.setEnab...
31aa1dea-ec05-41e0-af19-148362416050
5
private int chooseDefaultLanguage () { if (languages.length == 1) return languages [0]; Locale dflt = Locale.getDefault (); int retval = languages [0]; for (int i = 0; i < languages.length; i++) { Locale current = LangCode.getLocale (languages [i]); ...
e798dfbd-c210-4ba3-bd2e-9fcdd39e9ba4
4
public ArrayList<Prestamos> getAllByUser(Usuarios u){ PreparedStatement ps; ArrayList<Prestamos> rows = new ArrayList<>(); try { ps = mycon.prepareStatement( "SELECT DISTINCT " + "Prestamos.*, Libros.nombre as lnombre, Usuarios.nombre a...
e8617fa1-2b60-4058-be13-7a50e55c41ad
3
public AbstractInsnNode get(final int index) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(); } if (cache == null) { cache = toArray(); } return cache[index]; }
1a920b7d-a366-4fce-bdee-f09552df4a35
3
String change(String sequence, int numChanges, Random rand) { HashSet<Integer> changedPos = new HashSet<Integer>(); char chars[] = sequence.toCharArray(); for( int i = 0; i < numChanges; ) { int pos = rand.nextInt(chars.length); if( !changedPos.contains(pos) ) { // Already changed? char newBase = rand...
8aed2798-477f-4ce8-9249-3b96e402d74b
8
private byte[] getChannelData(int channelId) { if (uncompressedChannels == null) { for (Channel c : channels) { if (channelId == c.getId() && c.getCompressedData() != null) { ChannelUncompressor uncompressor = new ChannelUncompressor(); byte[] ...
9f7e13fa-e1e2-4b92-9e39-71bd958593d3
6
private final void method3109(byte i) { anInt9289++; Random random = new Random((long) anInt9301); anInt9298 = anInt9294 / 2; anInt9291 = 4096 / anInt9299; anInt9300 = 4096 / anInt9301; int i_0_ = anInt9291 / 2; anIntArray9297 = new int[anInt9301 + 1]; int i_1_ = anInt9300 / 2; anIntArrayArray9287 = new int[an...
e95d2128-3fed-4042-913f-3ab88d9debf8
4
protected void waitForFinish() { logger.info("Waiting for processing to finish"); while (pendingQueue.size() > 0) { logger.info("..."); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } ...
b879719f-a16b-4a6f-99c2-f74b40261615
5
private int[] merge(int[] left, int[] right) { int leftLen = left.length, rightLen = right.length; int leftPos = 0, rightPos = 0; int[] result = new int[leftLen + rightLen]; int resultPos = 0; while(leftPos < leftLen && rightPos < rightLen) { if(left[leftPos] < right[...
5a6dd64a-408d-461a-912a-dd53b48f87ee
1
public PlayerStartPosition(Grid grid, Player player) { super(grid); if (player == null) throw new IllegalArgumentException("The given Player is invalid!"); this.player = player; }
d78db548-eb9f-4bda-8ffd-0d0af2a1f3a4
5
public void actionPerformed(ActionEvent e) { if (this.mIsRunning) { firePropertyChange("tick", 0, 1); this.mAngle += 3; if (this.mAngle >= 360) { this.mAngle = 0; } if (this.mIsFadingOut) { if (--this.mFadeCount == 0) { this.mIsRunning = false; this.mTimer.stop(); } } else i...
5f63c5c6-4e5c-4318-bd8d-f862f1e25796
2
public Object getRawValue(final Field field, final Object object) { final Object result; try { boolean accessible = field.isAccessible(); field.setAccessible(true); result = field.get(object); field.setAccessible(accessible); } catch (IllegalArgumentException e) { throw new RuntimeException(e); }...
62f873ac-1c74-43d6-b6bd-7d03a65038f3
0
@Override public void mouseExited(MouseEvent e) {}
ec58dc6c-65a1-4874-b4ba-7377488320c7
1
public void populateSchema(String schema) throws SQLException { List<String> populatedTables = new ArrayList<>(); List<ForeignKey> foreignKeys = metaDataDao.foreignKeys(); List<String> tables = metaDataDao.tableNames(schema); while (populatedTables.size() < tables.size()) { S...
16ac7235-8d44-4f94-8c7a-5fdaa8b505c4
2
public int get(int at) throws JSONException { if (at < 0 || at > this.length) { throw new JSONException("Bad character at " + at); } return ((int) this.bytes[at]) & 0xFF; }
f2326e4c-3925-453a-95f1-d264b01d94f3
4
private void checkEmployerID() { if(evaluationResults[1].getText().length() > 0) { try { int employerID = Integer.parseInt(evaluationResults[1].getText()); if(employerID > 0) { if(employerID < ReadFromFile.getNumberFromFile("company.txt")) { Company [] checkCompany = ReadFromFile.findAllCompanyD...
8e5915e4-16fb-4299-9569-7015fd6dc9b8
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS...
b9b957bc-de3b-4cc8-b20e-858a85f63788
0
public void enable() { disabled = false; }
4463c077-35e8-4c15-b8f7-4e0da1650db7
1
public void CreateRedirectPhone(){ //создание поле для ввода номера RedirectField = new JTextField(); RedirectField.setPreferredSize(new Dimension(500,100)); RedirectField.setMaximumSize(new Dimension(500,100)); RedirectField.setEditable(false); RedirectField.setHorizontalAlignment(SwingConstants.CENTER)...
39c0300c-7c25-45cb-aed6-b8d6830add71
1
protected void sleepFor ( final int ms ) throws IOException { try { Thread.sleep(ms); } catch ( InterruptedException e ) { throw (IOException) new IOException(e.getMessage()).initCause(e); } }
ac401402-8295-4274-807b-082902efa8df
0
public void setQuestType(QuestType type) { this.type = type; }
a420626f-ca37-4349-9aef-a5def99a0e60
8
*/ protected void getClaimDetail(String title) { if (title != null) { for (int i = 0; i < claimResultList.size(); i++) { if (claimResultList.get(i).getTitle().equals(title)) { if (!(claimResultList.get(i).getDescription() == null || claimResultList.get(i).getDescription().equals("null"))) { ...
8f29ff47-cf21-45a3-876d-68a9b33159d7
8
public int getSymbolStringToCode(String symbol) throws MaltChainedException { if (symbol != null) { if (nullValues == null || !nullValues.isNullValue(symbol)) { if (trie == null) { throw new SymbolException("The symbol table is corrupt. "); } if (this.symbolTableMode == TrieSymbolTableHandler.ADD...
9df6addf-3e05-4d8c-8735-4bf0405e596a
4
public void insertarDespuesDeX(T dato, T x){ Nodo<T> q = this.p; Nodo<T> t = new Nodo<T>(); boolean bandera = true; while(q.getValor() != x && bandera){ if(q.getLiga() != null){ q = q.getLiga(); }else{ bandera = false; } } if(bandera){ t.setValor(dato); t.setLiga(q.getLiga()); ...
cce1fc2a-006b-4f3f-a82e-4a9e85ed6984
5
public void readServerInit(boolean benchmark) { int width = is.readU16(); int height = is.readU16(); handler.setDesktopSize(width, height); PixelFormat pf = new PixelFormat(); pf.read(is); handler.setPixelFormat(pf); String name = is.readString(); handler.setName(name); if (!benchmar...
650a4d32-5724-41e4-ba7d-c5fd289c957d
0
public void setNomeUser(String nomeUser) { this.nomeUser = nomeUser; }
fa0607aa-9059-458a-87b3-8d16fcedc4f9
5
protected Boolean tryCheckHLine3(boolean remove) { for (int i = 0; i < 6; i++) { for (int j = 0; j < 6; j++) { int count = (gemArray[i][j]); if (i + 1 <= 5) { if (count == gemArray[i + 1][j]) { if (remove) { ...
34559dac-c2aa-4eca-acfb-e8329ed9cc24
7
@Override synchronized public void paint (Graphics g) // repaint the board (generate images at first call) { Dimension d = getSize(); // test if ActiveImage is valid. if (Dim.width != d.width || Dim.height != d.height) { Dim = d; makeimages(); repaint(); return; } else { if (ActiveImage ...
2b557c19-68a3-4651-bcad-cd2d2e1916d4
7
@Override public void draw() { int[][] tiles; //Filled with whatever set of tiles the chunk is currently represented by - A or B if (tileState){ tiles = tilesA; } else { tiles = tilesB; } if (properties.containsKey("floorTex")){ stoneSprite = new TextureSprite(0, 0, WALLDIMENSION, WALLDIMENSION, ...
7b23f37a-bc6f-43ea-a3f5-2a0741e64875
7
private PersistenceSettings readPersistenceSettings() { if (persistenceSettings == null) persistenceSettings = new PersistenceSettings(); try { Document doc = DocumentBuilderFactory.newInstance() .newDocumentBuilder() .parse(new FileInputStream(xmlFilePath)); doc.getDocumentElement().normalize();...
c15df980-762b-4662-a4c6-8d5f21ecf347
3
@Override public Type parseType() throws IOException { Type t = new Type(); switch (curToken.type) { case INT: curToken = lexer.getToken(); t.setType(Type.PossibleType.INT); break; case DOUBLE: curToken = lexer....
1209af7b-af43-4e79-bc8e-cfc29d89279e
7
public String getValueText(byte[] bytes, int offset) { try { long value= unscaledLongValue(bytes, offset); IntegerAttributeType type=(IntegerAttributeType)getAttributeType(); IntegerValueState state= getState(value); if(state!=null) return state.getName(); IntegerValueRange range= type.getRange(); i...
0d64b193-5bda-4d5f-8135-ac993b230805
6
private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed // TODO add your handling code here: String NIM = jTextField1.getText(); String Nama = jTextField2.getText(); String Jurusan = jTextField3.getText(); String Alamat = jT...
a4404268-55be-4b80-a5a3-0bdfd8596c39
4
@Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub /*Go back to the mainFrame*/ if(e.getSource() == cancel){ if(!saveChange){ int decide = JOptionPane.showConfirmDialog(this, "Do you want to save your Answer?", "Confirm Dialog", JOptionPane.YES_NO_CANCEL_OPTION); if...
1a8cf770-d6f9-44fd-8d37-0ae138b869f4
1
public Report(String jsonText, String template, String output) throws GeneratorException { this.output=output; this.template = new File(template); if (!this.template.isFile()) throw new GeneratorException(GeneratorError.PARAMETER_ERROR, "Template file does not exists."); buildFromJson(jsonText); }
f232c7fd-89b5-4981-bdc6-095e4eac095d
6
public Flags(String flags){ showAbsence = flags == null || flags.toUpperCase().contains("A") ? true : false; showDifference = flags == null || flags.toUpperCase().contains("D") ? true : false; showUnknown = flags == null || flags.toUpperCase().contains("U") ? true : false; }
66328f4f-1e9e-40f5-93dc-1869341d74ef
0
public int getWidth() { return width; }
720ce076-209c-4fd5-9857-866fe5eb6ac9
9
@Override public boolean tick(Tickable ticking, int tickID) { super.tick(ticking,tickID); if(tickID!=Tickable.TICKID_MOB) return true; final MOB mob=(MOB)ticking; if((wakeForTicks<=0)&&(sleepForTicks<=0)) { if((CMLib.dice().rollPercentage()>50)||(mob.isInCombat())) { CMLib.commands().postStand...
4c3d2588-c49d-4695-841f-4b1f77f9557f
1
public void untimed() { boolean captured = lock.tryLock(); try { System.out.println("tryLock(): " + captured); } finally { if(captured) lock.unlock(); } }
bc1fec6c-504c-4ae8-b874-c7323e988445
8
public void renderGame(Graphics g) { // -- Render Game if(state.state == 100) g.drawImage(pic_story0,0, 0,this); else if(state.state == 101) g.drawImage(pic_story1,0, 0,this); else if(state.state == 102) g.drawImage(pic_story2,0, 0,this); else if(state.state == 103) g.drawImage(pic_story3,0, 0...
fe136b4c-b08e-48a3-9793-be7538ef6376
5
@Override public boolean equals(Object obj) { if (obj instanceof Vec4) { Vec4 vec = (Vec4) obj; if (x == vec.x && y == vec.y && z == vec.z && w == vec.w) return true; } return false; }
7d263198-23e4-4ebe-9c21-39ddafaeb279
4
private void turn(double amount) { // Remembers the last rotation //double lastrotation = getRotation(); double lastrotation = getMoment(this.axelposition); // Adds the turn //addRotation(amount); addMoment(this.axelposition, amount); double maxturn = Math.abs(this.maxturning * getMovement().getSpeed...
ec3fc1c3-8567-4569-8473-39e59531c11c
3
private boolean jj_3R_30() { Token xsp; while (true) { xsp = jj_scanpos; if (jj_3R_33()) { jj_scanpos = xsp; break; } } if (jj_3R_34()) return true; return false; }
7d152dfe-a355-4421-b7d5-3287cc88f47d
3
private List<CoordinatePosition> retrieveCoordinateDataFromNasa(String satelliteId) throws Exception { System.setProperty("http.agent","WsExample (" + System.getProperty("os.name") + " "+ System.getProperty("os.arch") + ")"); SatelliteSituationCenterService service = new SatelliteSituationCenterService(); Satel...
62bb0735-707a-4b32-a747-4dd1e129736c
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 - interlace flag // 3 - sort flag // 4-5 - reserved lctS...
4711ae75-839c-46bf-89c4-1c407cd9bd8f
0
@Override public void run() { System.out.println(SingleTon.getInstance()); }
11837b59-6121-49d0-a1a0-0dfa8f894f3e
5
final Object method1340(int i, Interface14 interface14) { anInt2313++; long l = interface14.method52((byte) 64); for (Class348_Sub42_Sub9 class348_sub42_sub9 = (Class348_Sub42_Sub9) aClass356_2312.get(l); class348_sub42_sub9 != null; class348_sub42_sub9 = (Class348_Sub42_Sub9) aClass356_2312.method...
926f4b9d-1a6b-4d83-8339-27f531a9f02f
9
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); switch (key) { case KeyEvent.VK_W: if(direction != Direction.Sued){ direction = Direction.Nord; } break; case KeyEvent.VK_D: if(direction != Direction.West){ direction = Direction.Ost; } break; case KeyEvent.VK_S: ...
3eb3c686-dcec-402a-988c-c607e172c6ee
0
@Column(name = "PRP_ID_ELEMENTO") @Id public int getPrpIdElemento() { return prpIdElemento; }
9eddfff8-7ee5-4fbc-ab2c-64f6ead00ca5
8
private IQ parseBrief(XmlPullParser parser) throws Exception { BriefStatistics stat = new BriefStatistics(); boolean done = false; while (!done) { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { if (parser.getName().equals("from")) { stat.setFromBalance(Float.parseFloa...
fb8d601b-4172-4069-8aa5-2ff4e624658b
2
public static void main(String[] args) throws InterruptedException { final Processor processor = new Processor(); Thread t1 = new Thread(new Runnable() { @Override public void run() { try { processor.produce(); } catch (Interrup...
6792652a-03cc-403f-ae1a-ebbace520084
6
@EventHandler public void SnowmanWaterBreathing(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getsnowgolemConfig().getDouble("Sno...
7b9b3865-6a60-410b-a025-511e08135ccd
5
private void go(){ Scanner in = new Scanner(System.in); int n=in.nextInt(); int ppl = in.nextInt(); ArrayList<City> l = new ArrayList<City>(); for(int i=0;i<n;i++){ l.add(new City(in.nextInt(), in.nextInt(), in.nextInt())); } Collections.sort(l); double r = 0; for(int i=0;i<l.size();i++){ // Syst...
3b9a033a-100c-451c-94e5-ddd4a540f089
6
public void update(long tick) { moveTimer++; if (moveTimer % 13 == 0) { int i; Random random = new Random(); i = random.nextInt(4); if (i == 0) { move(-1, 0); } else if (i == 1) { move(0, -1); } else if (i == 2) { move(1, 0); } else if (i == 3) { move(1, 1); } } else { ...
ca304ad8-cee6-4d5e-b3e1-a97f30bf9fd4
3
@Override public boolean isCommonSubexpression(Instruction i) { if(i instanceof Load) { Load l = (Load)i; // checks after the first are probably redundant, but are // a requirement for correctness. return this.getArg().equals(l.getArg()) && thi...
80c9d7c7-0440-4fdf-bb14-3f329aa607c0
8
public boolean isPerceived(Feeder fr) { // if food has been eaten, the feeder can't eat it again if (!active) return false; // if the food is already in the feeder's observed list, it has already // responded to it. if (fr.getObservedFood().contains(this)) return false; d...
608c9754-1e36-43ff-8617-48a5f8fbb918
0
public void setEncryptedValue(EncryptedDataType value) { this.encryptedValue = value; }
99f9c3f1-9a86-4089-ac05-23cb3f99d227
2
@SuppressWarnings("resource") private void initCacheIndices(int count) { try { RandomAccessFile dataFile = new RandomAccessFile("./data/cache/main_file_cache.dat2", "rw"); RandomAccessFile referenceFile = new RandomAccessFile("./data/cache/main_file_cache.idx255", "rw"); reference = new FileStore(255, dataF...
e02e2e56-7676-49e7-8ce1-980e8208ef57
1
public void truncate(String fileName){ try { BufferedWriter writer = new BufferedWriter(new FileWriter(fileName)); writer.write(""); writer.close(); }catch (java.io.IOException e) { this.plugin.logMessage("Unable to truncate "+fileName+": "+e.getMessage()); } }
73c238f8-dc4d-4431-8c24-8b4442842826
2
public void insert(int value) { Fibonaccinode x = new Fibonaccinode(value); x.degree = 0; x.parent = null; x.child = null; x.left = x; x.right = x; if (min != null) { //solmut linkitetään toisiinsa x.left = min; ...
3daf8dd8-28db-407b-a121-c64a0de2de7d
3
private boolean solveTile(int aTile) { final int nothings = getNothings(aTile), flags = getFlags(aTile), number = mField.getTileValue(aTile).getId(); if (nothings == 0) return false; if (number - flags == nothings) { markBorders(aTile); return true; } else if (number - flags == 0) { o...
e9439ad3-0225-46a7-9a03-11fa03c24709
9
private Response sinaGet(String url, PostParameter[] params, Paging paging, boolean authenticate) throws WeiboException { if (null != paging) { List<PostParameter> pagingParams = new ArrayList<PostParameter>( 4); if (-1 != paging.getMaxId()) { pagingParams.add(new PostParameter("max_id", Strin...
3338dc7a-cdf0-4a70-b2de-2c68702d960f
4
private int parseFacingChar(char facingChar) { int facingInt; switch (facingChar) { case 'N': facingInt = NORTH; break; case 'E': facingInt = EAST; break; case 'S': facingInt = SOUTH; ...
b8b1d67d-22ab-40dd-8764-f93d6c4211b8
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...