method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b20e010a-cb80-4e7c-8a49-f783ca1d4991
4
public boolean prove(int evenNumber) { if(evenNumber<2){ throw new IllegalArgumentException(); } for (int i = 0; i < evenNumber; i++) { int number1 = i; int number2 = evenNumber - i; if (MathUtil.isPrime(number1) && MathUtil.isPrime(number2)) { System.out.println(evenNumber + "=" + number1 + "...
542c515e-bd2d-4e0a-b703-628fc98c512d
9
public static void main(String args[]) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (String ln;(ln=in.readLine())!=null;) { StringTokenizer st=new StringTokenizer(ln); int n=parseInt(st.nextToken()),m=parseInt(st.nex...
973e0464-089f-4975-8b31-551735ae65d4
5
private byte[] HandleRevealSubscriptionCommands(short transId, byte api, byte opcode) { switch(opcode) { case 0x01: break; case 0x02: break; case 0x03: break; case 0x04: return GetSubscribeListVersion(transId,(byte)0xED,api,opcode) ; case 0x05: return SendAck(transId, (byte)0xED, api...
ab5f21ab-7347-41f9-afd1-fbb9f65b292c
6
public void buildMateriiProf() { // materia is the key for (Materie m : materii) { // map is the value HashMap<Clasa, Profesor> map = new HashMap<Clasa, Profesor>(); // seek teachers with corresponding materie for (Profesor p : profesori) { if (p.getMaterie().equals(m)) { // in the classes wher...
62521366-bf66-447a-8a02-960f1ca5eaab
7
private int[][] dijkstras(int source){ //TODO: Stop once we reach the right planet int numVertices = G.numVertices(); int[] dist = new int[numVertices]; int[] prev = new int[numVertices]; HashSet<Integer> Q = new HashSet<Integer>(numVertices); for(int v = 0; v < numVertices; v++){ dist[v] = Integer.MAX_V...
44159b02-5602-4962-9380-5cd066741e46
1
final Object pop() { int size = stack.size(); return size == 0 ? null : stack.remove(size - 1); }
6d046eac-935f-4895-ae9f-94160ae2f3b1
2
public String getTheme() { if (theme == 1) { return "Животные"; } else if (theme == 2) { return "Марки автомобилей"; } else { return "Рок-группы"; } }
fe5a843a-564d-4d81-97be-c1e6c2fb083b
2
private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed int res = JOptionPane.showConfirmDialog( this, "Seguro que deseas eliminar el personal", "Advertencia", JOptionPane.YES_NO_OPTION ); ...
9179c6a8-38af-494f-bbb2-83b4a93708b1
8
public static void main(String[] args) { Scanner sc = new Scanner(System.in); try { DataServer dataServer = (DataServer)Naming.lookup("//localhost:1111/showScore"); System.out.println("create table student"); dataServer.CreateTable(); System.out.println("Create succeed。。"); boolean isrunning = true; ...
d6d637e7-fed0-4809-94b0-89e59a1026e2
5
void changeBackground() { String background = backgroundCombo.getText(); if (background.equals(bundle.getString("White"))) { imageCanvas.setBackground(whiteColor); } else if (background.equals(bundle.getString("Black"))) { imageCanvas.setBackground(blackColor); } else if (background.equals(bundle.getStrin...
f599c996-e8cb-44ca-8dff-7aa281da1ec5
1
public Queue<E> enqueue(E e){ Node current = last; last = new Node(); last.e = e; if(total++ ==0) first = last; else current.next = last; return this; }
032d5428-0f21-46e7-b3ab-a630775a51bb
0
@Test public void testGetAnthillCells() { System.out.println("getAnthillCells"); World instance = new World(); instance.generateRandomContestWorld(); List expResult = new ArrayList<>(); List result = instance.getAnthillCells(); assertEquals(expResult, result); }
8e196819-df8f-4a58-807a-c5fc5d360bc4
2
private String getAvailableShares() { Share[] bufferShare = sharepriceinfo.getAvailableShare(); String s = ""; for (int j = 0; j < bufferShare.length; j++) { if(bufferShare[j].getExchange()!=null){ s += bufferShare[j].name +"<pre>"+ (float)bufferShare[j]....
142449c5-449b-4e15-9715-182149509e89
7
public void mousePressed(MouseEvent e) { if (isRunning) { if (player.canShoot) player.shoot(); player.canShoot = false; } else if (isIntro) { int x = (int) e.getX(); int y = (int) e.getY(); if (x>=172 && x<=438 && y>=400 && y<=464) { isIntro=false; isRunning=true; } } els...
aeda96ab-ef39-42c7-9d43-5c8f27fbe42c
2
public void generateTerrain() { for (int row = 26; row < thisTick.length; row++) { for (int col = 0; col < thisTick[row].length; col++) { //thisTick[row][col] = new Entity(EntityType.ground.id); } } }
fb4e9031-5665-4631-baa0-c14d334af777
3
public static void benchmarkFloatLargeArrayInANewThread() { System.out.println("Benchmarking FloatLargeArray in a new thread."); final long length = (long) Math.pow(2, 32); long start = System.nanoTime(); final FloatLargeArray array = new FloatLargeArray(length); System.out.p...
d2336074-94c1-49ee-87ce-c2f8c2c56250
8
public void startCountdown(PhoneFriendResult phoneFriendResult) { final String[] conversation = getConversation(phoneFriendResult); setVisible(true); if (conversation != null) { friendConversationLabel.setText(setForLabel(conversation[0])); friendConversationLabel.setVis...
87f718d8-e2aa-4c74-a37c-a0a3b4cdd196
7
private void renderSchedule() { try { ArrayList<ScheduleInfo> info = new ArrayList<ScheduleInfo>(); Staff stf = new Staff(); stf.setId(Integer.valueOf(Controller.Instance().getLoggedIn().getId())); for (Flight f : Controller.Instance().getFlights()) { ...
462a1313-63a1-4128-86a9-8eece9c93646
0
private void SetStopBusStop(int stopBusStop) { this.stopBusStop = stopBusStop; }
c6ea1411-0948-41f2-bae2-313de219c0d4
7
static private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(5, active0); return 6; } switch(curChar) { cas...
9223ba30-65a5-4513-bc9c-77732b2d3f60
2
public JSONObject getData() { JSONObject o = new JSONObject(); try { for (Attribute a : Attribute.values()) o.put(a.name(), get(a)); } catch (JSONException e) { e.printStackTrace(); } return o; }
42791b61-78ee-48f1-bc8c-1a61149b89b1
0
public void setPartnerList(final List<Partner> partnerList) { this.partnerList = partnerList; }
eadf0ed1-4d73-48b8-a56a-d31babe001a0
5
private void readDataFromDecoder() { try { while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data != null) { switch (data.getHttpDataType()) { case Attribute: requestBody.at...
51da395f-234b-4ebd-8b9f-1ffb08394489
7
@SuppressWarnings("unchecked") public GridSpace(Settings settings, int width, int height, Class siteClass) { this.settings = settings; if (width < 1) throw new IllegalArgumentException("width must be > 0"); if (height < 1) throw new IllegalArgumentException("height must be > 0"); if (siteClass == null) ...
ecf57588-1ec3-468a-8a7c-f0bec0884cb7
1
public void setCity(String city) { city = city.trim(); if ( city.isEmpty() ) { throw new RuntimeException( "'city' should not be empty" ); } this.city = city; }
ca75277e-a07d-4c9f-b023-79e769853434
5
public static int numTrees(int n) { if (n < 0) return 0; if (0 == n || 1 == n) return 1; int[] result = new int[n + 1]; result[0] = 1; result[1] = 1; for (int i = 2; i < n + 1; i++) { for (int j = 0; j < i; j++) { result[i] = result[i] + result[j] * result[i - j - 1]; ...
d359bf53-6b41-46f6-aac3-b98a7ad656f8
5
private void variableMutation(){ //Check if any max fitness the last few generations has differed greatly. If not increase mutation, if yes then reduce HashMap temp = (HashMap) stats.get(stats.size()-1); double lastFitness = (Double) temp.get("maxFitness"); boolean thresholdBreache...
3c42bfb5-9087-47ea-8e83-1d75350c9602
8
private int priorityTree(int y, int x, int level, boolean turn, Pezzi[][] campo, int direction) { //se la direzione è -1 la pedina non può muoversi, di conseguenza il thread terminerà con 0 // se invece ha un valore diverso compreso tra 0 e 3 il calcolo delle possibilità inizierà if (direction ...
7db1a0da-ab0c-42a9-aaf9-f7c8fc7e847b
7
@Override public void delScript(ScriptingEngine S) { if(scripts!=null) { if(scripts.remove(S)) { if(scripts.isEmpty()) scripts=new SVector(1); if(((behaviors==null)||(behaviors.isEmpty()))&&((scripts==null)||(scripts.isEmpty()))) CMLib.threads().deleteTick(this,Tickable.TICKID_ITEM_BEHAVIO...
3d0091a7-e869-4e72-9b94-ce4de592a185
3
public boolean addAll(Collection<? extends T> c) { // the reason we have to write "? extends E" is because we don't really // care what class is passed in -- just as long as it inherits from type // T at some point. boolean retVal = false; // see official documentation for return value // specs for (T...
4e1335ed-45f9-46fc-b3b1-d7b3b93980e0
9
public static TreeNode buildTree() { TreeBuilder builder = new TreeBuilder("Animations"); for (Building bld : Building.getAll()) { if (!bld.hasAnimation()) continue; String name = bld.getName(); if (name.startsWith("comp_")) builder.add(bld, false, "Buildings", "comp", name); else if (name.startsWit...
f9128652-8586-4fe3-83c8-dbba426244a6
1
public static Class<?> getClass(String fqn) throws ClassNotFoundException { return Class.forName(fqn); }
92ca1a0a-73e7-4292-ae58-d74ab5b9e98c
0
public void continueGame(){ this.running = true; this.lastLoopTime = System.currentTimeMillis(); this.showGame(); }
ee3ce7aa-3868-47d1-9969-68883a997a97
9
public boolean checkContinuous(Player myHand) { boolean continuous = true; int i = 0; while (continuous = true && i <= 3) { int rank1 = myHand.getCard(i).getRank(); int rank2 = myHand.getCard(i + 1).getRank(); if ((rank1++) == rank2) { continuous = true; } else { continuous = false; } //...
1a529d1e-aa7d-47a8-a758-d0abecae2f09
2
@Override public String getSynopsis() { if (synopsis == null || isEmpty(synopsis.getText())) { return ""; } return synopsis.getText(); }
f7cdd5e1-f5e9-4ac4-bc25-859855dbfd4d
8
public void create(Telecommunications telecommunications) throws PreexistingEntityException, RollbackFailureException, Exception { if (telecommunications.getItItemCollection() == null) { telecommunications.setItItemCollection(new ArrayList<ItItem>()); } EntityManager em = null; ...
51570928-b723-4fa3-b335-2f75f5d908ff
9
public static void findPotentials(String data_file) { ChainMRFPotentials p = new ChainMRFPotentials(data_file); SumProduct sp = new SumProduct(p); for(int i=1; i<=p.chainLength(); i++) { double[] marginal = sp.marginalProbability(i); if(marginal.length-1 != p.numXValues()) // take off 1 for 0 index which i...
1e61a358-6484-4595-b67a-3a9471f75b2d
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
4e6b547a-31c5-4be7-9fba-fcff6d400a57
3
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); int LIM = 251; BigInteger[] ans = new BigInteger[LIM]; ans[0] = BigInteger.ONE; ans[1] = BigInteger.ONE; BigInt...
584ad4d3-eeca-4c11-87ab-051aac916dcb
1
public void Answer(final String channel) { new Thread() { public void run() { HangupBridgeCalls(); PrintWriter writer = MainFrame.TelnetWriter(); writer.print("Action: Redirect\r\n"); writer.print("Channel: SIP/" + channel + "\r\n"); writer.print("Exten: " + Phone.MainExtension + "\r\n"...
1a36fc03-0207-4d8c-b4b7-9f9f8b210fc2
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MultipleWritable other = (MultipleWritable) obj; if (intField != other.intField) return false; if (Float.floatToIntBits(floatField) != Float...
87d93947-81ea-4085-8b70-6e7b3f58e70c
4
public void printLongString(int type, int max, String text) throws Exception { HashMap map = new HashMap(); String line = ""; int row_id = 0; String[] words = text.split(" "); for(int i = 0; i < words.length; i++) { line = ""; if (map.conta...
8fde2410-c3c7-46b0-acf5-81257537d800
3
@Override public void run() { while (!interrupted) { long time0 = System.currentTimeMillis(); rotation.mul(deltaRotation); long duration = System.currentTimeMillis() - time0; if (duration < FRAME_DELAY) { try { Thread.sleep(FRAME_DELAY - duration); } catch (InterruptedException e) ...
4aec9ee6-ee53-462f-a63e-fa9b55942bc9
7
public void execute() { boolean skipHash = false; String baseURL = "patch/" + patchName; Map<String, File> patchedFiles = new Hashtable<String, File>(); InstallerPacker.collectFiles(patchedFiles, new File(patchedFolder), false); Set<FileListEntry> patchedEntries = InstallerPacker.generateFileList(patchedFi...
863c6d14-16d5-45c9-bb29-f0a8eed4e929
7
private void logarUsuario(String usuario, String senha) { String senhaAtual,usuarioAtual; String senhaTeste = ""; int pontuacaoUsuario = 0; boolean naoApareceu = true; File dados = new File("data"); try { Scanner reader = new Scanner(dados); while ...
74ed5da4-d4d7-41ce-b619-35fbc1dba874
3
@Override public int doStartTag() throws JspException { User user = (User) pageContext.getSession().getAttribute(JSP_USER); if (user != null) { ClientType type = ClientTypeManager.clientTypeOf(user.getRole().getRoleName()); if (type == ClientType.USER || type == ClientType.AD...
894fa1b4-874b-4d9a-a45b-aae26e64d014
4
public FiniteStateAutomaton convertToDFA(Automaton automaton) { /** check if actually nfa. */ AutomatonChecker ac = new AutomatonChecker(); if (!ac.isNFA(automaton)) { return (FiniteStateAutomaton) automaton.clone(); } /** remove multiple character labels. */ if (FSALabelHandler.hasMultipleCharacterLabel...
b6256f4c-7d66-4ef5-86ae-06bf7111e5a7
7
@Override protected void readChild(XMLStreamReader in) throws XMLStreamException { String childName = in.getLocalName(); if (Limit.getXMLElementTagName().equals(childName)) { if (limits == null) { limits = new ArrayList<Limit>(); } Limit limit = ne...
d24c4749-1f55-44a4-9f49-7ec1f6cdbb44
5
@Test public void getIncome() { Trainer test = null; Trainer test1 = null; try { test = new Trainer("Franz", 3); test1 = new Trainer("Karl", 5); } catch (Exception e) { fail("Unexpected Exception"); } try { Trainer test3 = new Trainer("Sepp", 12); } catch (ValueException e) { // expected ...
20cbc411-88d2-49a5-9e6e-a1aa085b5277
8
public ImagePlus applyWithMask() { final int width = input.getWidth(); final int height = input.getHeight(); final int depth = input.getStackSize(); //final ImagePlus imageOutput = input.duplicate(); //final ImageStack imageStackOutput = imageOutput.getStack(); final ImageStack inputStack = input.getStac...
3e33bfad-c739-4122-aeba-897df5036e73
5
@Override public void say(String toSay) { int fileNum = 0; for (String s : cut(conform(toSay))) { try { download( BASE_URL + "?tl=" + lang + "&q=" + s, TEMP_PATH+"part"+fileNum++ + ".mp3"); } catch (IOException e) { Logger.w("Impossible de télécharger le fichier à lire de " + ...
862be420-4ce3-423e-a809-6eac453a5b10
1
public static void main(String[] args) { double d = 0.05 ; double sum = 0; for (int i = 0; i < 60; i++) { double t = ExponentialRandomNumber(d); sum += t; System.out.println(t); } System.out.println(sum/100); }
22156dd5-2568-4b6b-9e50-5cc44f1da6fc
0
public FilterFactory(Properties[] configs) { this.configs = configs; }
4e90d66e-6fe3-4f37-9d77-51fde2b888a9
4
@Before public void setUp() { TestHelper.signon(this); MongoHelper.setDB("fote"); MongoHelper.getCollection("users").drop(); MongoHelper.getCollection("suggestions").drop(); for (User user : users) { if(!MongoHelper.save(user, "users")) { ...
772cfdff-4fa9-4c5d-844a-b98645f96675
1
public static final int getIndex(String segment) { if (isArraySegment(segment)) { Matcher matcher = ARRAY_SYNTAX_PATTERN.matcher(segment); matcher.find(); return Integer.parseInt(matcher.group(2)); } return -1; }
c0562b15-0d88-471b-ba5c-7492ffb54fae
4
public static void setSelectedY(int y) { if (Main.selectedId != -1 && !Main.getSelected().locked) { RSInterface rsi = Main.getInterface(); if (rsi != null) { if (rsi.children != null) { rsi.childY.set(getSelectedIndex(), y); } } } }
b1618ab0-d21c-4944-905b-6751f0b59df6
9
@Override public Object getValueAt(int arg0, int arg1) { //return percent dl Torrent t = allTorrents.toArray(new Torrent[0])[arg0];//slow switch(arg1){ case 0: return t.name; case 1: String s =null; if(t.totalBytes/1024 <999){ s=""+dg.format(t.totalBytes/1024.0)+" KB"; }else if(t.totalBytes/(...
531e1d0c-99cf-4ff2-a653-298aee227564
3
private static Fontstyle getFontstyle(String s) { Fontstyle ret = null; if ((s != null) && !s.equals("")) { try { ret = Fontstyle.valueOf(s.trim().toUpperCase()); } catch (IllegalArgumentException e) { ret = null; } } ...
c184df55-3ce8-461e-956f-2770838c22da
2
private void calculateEnabledState(JoeTree tree) { if (tree.getComponentFocus() == OutlineLayoutManager.ICON) { setEnabled(true); } else { if (tree.getCursorPosition() == tree.getCursorMarkPosition()) { setEnabled(false); } else { setEnabled(true); } } }
08060135-8d6f-457c-8d60-570626925b0c
3
public boolean removeMovie(String title) { boolean deleted = false; if (aMovieIndex.containsKey(title)) { Item tempMovie = aMovieIndex.remove(title); directorIndex.remove(((Movie)tempMovie).getDirector()); for (String s: ((Movie) tempMovie).getActors()) { ...
9e094900-e79e-4bf8-8cfa-a63825fd8073
6
public static ArrayList<Planet> forShips(PlanetWars pw){ // Tested ArrayList<Planet> asw = new ArrayList<Planet>(2); asw.add(null); asw.add(null); // Find the biggest fleet to attack with and our weakest planet to know what is our goal of fleet to be destroyed in the enemey int maxShips = 0; int minShips ...
590b8344-6ef5-4aa7-812d-33e3ae8454c7
8
public static final boolean isDirect(Buffer buffer) { if (buffer == null) { return true; } if (!(buffer instanceof ByteBuffer)) { if (buffer instanceof FloatBuffer) { return ((FloatBuffer) buffer).isDirect(); } if (buffer i...
83d2ae3f-e2d1-40f1-8b8a-809dc8a9e4ea
1
@Override protected void logBindInfo(Method method) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功"); } }
c2d848cd-c337-4a16-937a-ecc361942a14
6
private Pioche() { for (Couleur c : Couleur.values()) { if(c != Couleur.NOIR){ for (Label l : Label.values()) { Carte carte = new Carte(CarteFactory.getCarte(l, c)); this.add(carte); if(l != Label.ZERO && l != Label.PLUS4 && l != Label.JOKER) { this.add(carte); } } ...
05d5d9fe-9ce8-438f-8730-98d83252d00c
7
private void processDeskSave(RdpPacket_Localised data, DeskSaveOrder desksave, int present, boolean delta) throws RdesktopException { int width = 0, height = 0; if ((present & 0x01) != 0) { desksave.setOffset(data.getLittleEndian32()); } if ((present...
c0411ff9-9e18-4dbe-9f34-c592fd537cbd
6
@Override public void paintComponent(Graphics g) { super.paintComponent(g); this.g = g; width = getWidth(); height = getHeight(); if (drawAxis) { drawVerticals(); } if (click_state == STATE_DROPPED && edit) { drawEdge(x0, y0, x1, y1,...
332cf8d2-33fc-4c1c-8f9c-56279206f229
2
public void renderAll(){ Camera camera = this.raycaster.getCamera(); double x = camera.getX(); double z = camera.getZ(); double width = raycaster.getWidth(); for(int i = 0; i < width; i++){ double grad = ((double)i)/(width/2) - 1; double angle = Math....
b4cdec65-8836-4a62-92ee-0cd03b33e332
7
@SuppressWarnings("rawtypes") public static byte[] generateCanonicalRRsetData(RRset rrset, long ttl, int labels) { DNSOutput image = new DNSOutput(); if (ttl == 0) { ttl = rrset.getTTL(); } Name n = rrset.getName(); if (labels == 0) { la...
4000c0a7-0b01-4894-9c07-bfc656cb107b
1
public boolean hitMe(){ if (getHandCount()<getHold()) hit = true; else hit = false; return hit; }
952ede91-292a-4e28-a773-f682f7cdbab2
4
private void setOrientation(String o) { if ("isometric".equalsIgnoreCase(o)) { map.setOrientation(Map.ORIENTATION_ISOMETRIC); } else if ("orthogonal".equalsIgnoreCase(o)) { map.setOrientation(Map.ORIENTATION_ORTHOGONAL); } else if ("hexagonal".equalsIgnoreCase(o)) { ...
7aa7e4dd-eda0-4775-95ad-562548e8b26e
9
public void takeColor() { Object inputObj = null; Integer outputObj = null; // repeat until a Color is received and confirmation is sent do { // read the Color try { inputObj = in.readObject(); } catch ( Exception e ) { ...
76227602-d73e-4eda-b2c1-f2c17417c3c9
1
public final void registerToNewObservables() { for(PositionChangedObservable o : observables) { o.register(observers); } observables.clear(); }
34ce39a2-9c5b-4cad-b5a2-c2fc9250f746
6
void copyUcs4ReadBuffer(int count, int shift1, int shift2, int shift3, int shift4) throws java.lang.Exception { int j = readBufferPos; int value; if (count > 0 && (count % 4) != 0) { encodingError( "number of bytes in UCS-4 encoding not divisible ...
39c2b21d-6edb-4729-96f9-7ea4a6ffd942
8
@Parameters public static Collection<Object[]> getParameters() throws Exception { List<Object[]> res = new ArrayList<>(); SpdyNameValueBlock blockCorrect = new SpdyNameValueBlock(); SpdyNameValueBlock blockCorrect2 = new SpdyNameValueBlock(); SpdyNameValueBlock blockinCorrect = new S...
5a6e7bfb-4076-4342-a707-42cdfd16275b
8
@Override public HashMap<Long, Float> getScores(HashMap<String, Integer> query) { ArrayList<Long> ids = weighter.getAllIds(); HashMap<Long, Float> docScores = new HashMap<Long, Float>(); HashMap<String, Float> queryWeight = weighter.getWeightsForQuery(query); float norm = 0; ...
9aabfe27-8e17-443a-a526-e59a8ca7267f
0
public static void setSize(int w, int h){ WINDOW_HEIGHT = h; WINDOW_WIDTH = w; init(); }
791b189b-3ac4-4302-b284-b797194e0da9
1
public void init(int nplayers, int[] pref) { this.nplayer=nplayers; this.pref=pref; this.position=this.getIndex();// position start from 0 this.record = new int[2*nplayer]; if(nplayers-position<=9) magic=magic_table[nplayers-position]; else magic=(int) Math.round(0.369...
207baf0a-e48f-4425-95b3-4a479ea29862
6
public void loadUserDict(File userDict) { InputStream is; try { is = new FileInputStream(userDict); } catch (FileNotFoundException e) { System.err.println(String.format("could not find %s", userDict.getAbsolutePath())); return; } try { ...
c75d3d29-ba91-4b99-b503-4adc4d5bcd90
8
@Override public List<AdminCol> getColDsplTblList(String tblNm) { log.debug("get column display table list for table = " + tblNm); Connection conn = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList<AdminCol> list = new ArrayList<AdminCol>(); StringBuilder sql = new StringBuilder(...
6874c287-e705-4981-95f9-4201eea9c143
1
public static int[] fill1(char[] c) { int[] i = new int[c.length]; for (int x = 0; x < c.length; x++) { i[x] = ((int) c[x]) - 65; i[x] = h[i[x]]; } return i; }
5db7b623-0e2c-434c-ad2d-46e14ebe54e5
8
public ArrayList<Action> getPossibleActions() { ArrayList<Action> possibleActions = new ArrayList<Action>(); if (this.movementCounter > 0){ for (Relative_Direction absoluteExitDirection : this.getCurrentRoom().getAbsoluteExits()) { possibleActions.add(new MoveAction(absoluteExitDirection)); } } ...
982cb686-7c1a-4af9-8dff-d089f07c9c2c
9
public K findKey(Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { K[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) { if (keyTable[i] != null && valueTable[i] == null) { return ke...
2cff0b26-7d46-48d3-852f-7ff3060dbf72
9
@Override public int setup(XTreeCompiler compiler, XCodeGen codeGen) { result = scope.get(ident, ident.name, access); switch(result.r){ case DUPLICATED: compiler.addDiagnostic(ident, "duplicated.var", ident.name, result.var.t.position.position.line); break; case FOUND: break; case DECLARED: if(re...
38b8aaa8-8802-42e5-9ff6-6caa1b762b34
1
public int labelIndex(final Label label) { final Integer i = (Integer) labels.get(label); if (i != null) { return i.intValue(); } throw new IllegalArgumentException("Label " + label + " not found"); }
6b593062-85bc-4aa4-a92f-7fa09d4aaf69
5
protected void push(char x, int num) { queueNode trc; //Check if the element is forbidden trc = iHead; while(trc!=null) { if(trc.getData()==x) return; trc = trc.getNext(); } //Check if the element is in the holding queue trc = jHead; while(trc!=null) { if(trc.getKeyNum()==num) { ...
ead3b859-beb6-4a91-b1c5-67d372fb3f68
4
public int NumShips(int playerID) { int numShips = 0; for (Planet p : planets) { if (p.Owner() == playerID) { numShips += p.NumShips(); } } for (Fleet f : fleets) { if (f.Owner() == playerID) { numShips += f.NumShips(); } } return numShips; }
d9656abc-8160-471a-8053-fde48164c979
4
public static void main(String[] args) throws Exception { String hostAddress = args[0]; String namingAddress = args[1]; RemoteDrunkardCompanion companion = (RemoteDrunkardCompanion) Naming.lookup(hostAddress); BufferedReader cmd = new BufferedReader(new InputStreamReader(System.in)); ...
2c08b620-87df-472d-94ac-e467f5ca87da
0
public String getType() { return type; }
1ce5e1d0-8a5c-4962-a6fb-6d4c55b55dfc
6
private static <T> void handleWindows(final String framesetid, final Class<? extends Component> clz, Component comp) { if (comp instanceof Window) { TitleIconImage title = clz.getAnnotation(TitleIconImage.class); if (title != null) { setWindowTitle(comp, title); ...
b9cb3601-5852-4a38-973f-077e594b4b44
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RepeatNode other = (RepeatNode) obj; if (exp1 == null) { if (other.exp1 !...
4f3c63c1-d8e9-4481-9852-5c7a0d18e322
9
static void draw_priority_sprites(osd_bitmap bitmap, int prioritylayer) { int offs; /* sprites must be drawn in this order to get correct priority */ for (offs = 0;offs < spriteram_size[0];offs += 8) { int i,incr,code,col,flipx,flipy,sx,sy; if (prioritylayer==0 || (prioritylayer!=0 && (spriteram.re...
9e57d3e8-4300-437c-80d8-2e74ce8d3f47
1
public void stop() { synchronized (routes) { for (Route route : routes) { route.stop(); } } }
6166d44e-2e38-474c-82ab-88e170e5d983
7
private void applyTransform(BufferedImage sourceImage, BufferedImage destinationImage, PerspectiveTransform transform) { for(int x = 0; x < destinationImage.getWidth(); x++) { for(int y = 0; y < destinationImage.getHeight(); y++) { try { final Point2D sourcePoint ...
d20c34fa-7aa7-424f-a62f-3e1a6446fb36
7
@Override public void onNIOEvent(SelectionKey key) { if( key.isWritable() ) { boolean removeEvent = false; ChannelEvent event = writeQueue.peek(); try { if( removeEvent = (event != null && handleOutgoingEvent(event)) ) event.getFuture().onSuccess(); } catch(Exception e) { remove...
036f4d4a-e330-4929-831e-a991df93253a
6
public static void enqueueEvent( String method, Object target, Object... parameters ) { Event event = new Event(); // create the event try { // determine the classes of our parameters Class< ? >[] paramClasses = new Class< ? >[ parameters.length ]; for ( ...
a1dbfe6d-d3ae-4d63-8f65-444321727976
0
@Override @XmlElement(name="nachname") public String getNachname() { return this.nachname; }
fa0880ac-1346-4c12-a53f-d4f03a97daaf
2
private BeerResponseList(Iterable<Beer> beers) { if (beers != null) { for (Beer beer : beers) { this.beers.add(BeerResponse.createBeerResponse(beer)); } } }
eab11bd6-8048-438a-b68b-1ffe6eb89107
3
void createToolBar(final Composite parent) { final Display display = parent.getDisplay(); toolBar = new ToolBar(parent, SWT.FLAT); ToolItem back = new ToolItem(toolBar, SWT.PUSH); back.setText(getResourceString("Back")); //$NON-NLS-1$ back.setImage(loadImage(display, "back.gif")); //$NON-NLS-1$ back.addLis...
4c5c2542-0a8e-40ed-b112-ca4218ea76ae
9
public Wave06(){ super(); MobBuilder m = super.mobBuilder; for(int i = 0; i < 65; i++){ if(i < 5){ if(i % 2 == 0) add(m.buildMob(MobID.RATTATA)); else add(m.buildMob(MobID.PIDGEY)); } else if (i >= 5 && i < 45){ if(i % 2 == 0) add(m.buildMob(MobID.PIDGEY)); else add(m....
355b819b-d8f3-4a25-a94f-43ec8426ef7b
1
public static void main(final String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { final GUIrscGenerator frame = new GUIrscGenerator(); frame.setVisible(true); } catch (final Exception e) { e.printStackTrace(); } } }); }