method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a2b3fc31-7891-4a93-a5ba-b25a06dbdcf3
3
public SpringAttachable findAttachableElement(double x) { for (PhysicsElement e: elements) if (e instanceof SpringAttachable) if (e.contains(x,0)) return (SpringAttachable)e; return null; }
31586489-14bc-47cc-bed8-a77e4bb39db6
8
public void animation() { animationt--; if (animationt >= 45) { setImage(swordfish1); } else if (animationt < 45 && animationt >= 30) { setImage(swordfish2); } else if (animationt < 30 && animationt >= 15) { setImage(swordfish1); ...
9de94e97-9da4-4438-84fa-3c237af9f416
0
public static void main(String[] args) { first : { System.out.print("Hello, "); here : System.out.println("World!"); } }
049c0c96-711d-4c03-aa82-92ccb631bdcc
9
public static void main(String[] args) { boolean[] isPrime = EulerMath.getSieve(N); boolean found = false; for(int c = 9; c < isPrime.length; c += 2) if( !isPrime[c] ) { found = false; for(int p = 2; !found && p < c; p++) { if( !isPrime[p] ) continue; for(int s = 1; !found && p+2*s*s <= c;...
9fcf1dec-f020-4af8-9503-f32658625a45
7
static double incompleteBetaFraction1(double a, double b, double x) throws ArithmeticException { double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; double k1, k2, k3, k4, k5, k6, k7, k8; double r, t, ans, thresh; int n; k1 = a; k2 = a + b; k3 = a; k4 = a + 1.0; ...
b569c32c-0846-4363-8d52-4c902303c234
6
public boolean matches(Identifier ident) { String test = ident.getFullName(); if (firstStar == -1) { if (wildcard.equals(test)) { return true; } return false; } if (!test.startsWith(wildcard.substring(0, firstStar))) return false; test = test.substring(firstStar); int lastWild = firstStar; ...
0d4e1071-65c9-43cf-bbdc-d1e717c76e8c
4
public void setGrid(Grid grid) { boolean test = false; if (test || m_test) { System.out.println("GameBoardGraphics :: setGrid() BEGIN"); } m_grid = grid; repaint(); if (test || m_test) { System.out.println("GameBoardGraphics :: setGrid() END"); } }
e18fb606-2ff9-4f10-94f9-10dfc6089cd1
5
private void resetLater(final ExprInfo exprInfo, final Phi phi) { phi.setLater(false); final Iterator blocks = cfg.nodes().iterator(); while (blocks.hasNext()) { final Block block = (Block) blocks.next(); final Phi other = exprInfo.exprPhiAtBlock(block); if (other == null) { continue; } fi...
4d6e3f22-6893-400c-a298-85e992dbab47
3
public boolean mousewheel(Coord c, int amount) { int mod = ui.modflags(); if ((mod & 6) == 6) { // mod = 7; } if (amount < 0) wdgmsg("xfer", -1, mod); if (amount > 0) wdgmsg("xfer", 1, mod); return (true); }
e661453d-ef14-470a-8eb6-9cada1622a24
8
@Override public void onPacketReceived(NetworkPacket pPacket) { switch (pPacket.getHeader()) { case REGISTER_RESULT_REP: if (pPacket.getReqResult() == true) { ScreenManager.getInstance().showLoginLayer(); } else { final Base...
b6c810ba-469b-4942-808b-9789983b9dd3
3
public List<Organism> GAstep_crossover() throws Exception { // TODO /* crossover entre les species !!! */ /* crossover */ List<Organism> childList = new ArrayList<Organism>(); for (int i = 0; i < this.getSpeciesNumber(); i++) { if (species.get(i).getNumberOrganisms()...
90e2e52c-3417-4931-beab-2439c06f831a
3
@PUT() @Path("trade/{playerId}/newteam/{teamId}") @Produces("application/json") @SportService(ServiceType.MLB) public Player tradePlayer(@PathParam("playerId") int iPlayerId, @PathParam("teamId") int iTeamId) { Player p = new Player(); UserTransaction utx ...
80146c58-cc48-4c8a-bdd0-bb3dc480b777
1
@Override public void removeInheritence(String inher) { do { inheritence.remove(inher); } while (inheritence.contains(inher)); }
42c79825-2968-4101-9b5f-9c8521b9dfa3
2
protected void resize( int width, int height ) { if( width==fWidth && height==fHeight ) return; fWidth = width; fHeight= height; MutableAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(HTML.Attribute.WIDTH ,Integer.toString(width)); attr.addAttribute(HTML.Attribute.HEIGHT,Integer.toStrin...
c51c5e3e-fe60-4d7a-8ea1-ccb88559d655
8
private void setStateOfComboBox(JComboBox cb, int index) { Action a = cb.getAction(); ActionListener[] al = cb.getActionListeners(); ItemListener[] il = cb.getItemListeners(); cb.setAction(null); if (al != null) { for (ActionListener i : al) cb.removeActionListener(i); } if (il != null) { for ...
cc009fac-43f9-45da-af62-be9acf3cded6
7
public double findMedianSortedArrays(int A[], int B[]) { // Start typing your Java solution below // DO NOT write main() function int m = A.length; int n = B.length; if (m == 0 && n == 0) { return 0; } int i = 0; int j = 0; int s = (m + n) / 2; System.out.println(s); int m1 = -1; int m2 = -1;...
e86683e4-60fe-4a89-aafc-b0585f6ed36a
5
public static boolean isOrdered(List<Partition> partitions) { List<Long> lengths = new ArrayList<Long>(); for (Partition partition : partitions) { lengths.add(partition.getLength()); } // Ignore trailing 0 length blocks. while (lengths.size() > 0 && lengths.get(lengt...
aaf46d31-9a11-4c33-b225-9f151c95fd40
2
public static int getMinimumLoadableVersionOfTag(Class<?> objClass) { XmlTagMinimumVersion tagVersion = objClass.getAnnotation(XmlTagMinimumVersion.class); return tagVersion != null ? tagVersion.value() : 0; }
f0e45065-cb8b-4d18-a3bf-1d73709913ff
6
public String getDescription() { if(fullDescription == null) { if(description == null || isExtensionListInDescription()) { fullDescription = description==null ? "(" : description + " ("; // build the description from the extension list Enumeration extensions = filters.keys(); if(extensions != null) { ...
da049a00-5bef-4057-8cf4-ed6ef5c4bbcf
8
private static final Object get_impl( final NonBlockingHashMap topmap, final Object[] kvs, final Object key, final int fullhash ) { final int len = len (kvs); // Count of key/value pairs, reads kvs.length final CHM chm = chm (kvs); // The CHM, for a volatile read below; reads slot 0 of kvs final i...
b35c15aa-cef2-4649-8ddf-b22836c8d055
3
public static <E extends Enum<?>> E caseInsensitiveValueOf(E[] enumValues, String constant) { for (E candidate : enumValues) { if (candidate.toString().equalsIgnoreCase(constant)) { return candidate; } } throw new IllegalArgumentException(String.format( "constant [%s] does not exist in enum type ...
ca202a8e-e091-471b-879e-2901d894ed35
7
public void init(SmaliMethod method, int linesCount, boolean doMapParams) { if(isInitialized) return; isInitialized = true; this.linesCount = linesCount; this.sliceLength = method.getRegisters(); this.timeline = new ArrayList<ArrayList<RegisterInfo>>(linesCount); for(int i = 0; i < linesCount...
a06cdefa-ed03-4938-be8d-e75d292e4c2a
3
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { PC = (PistolCaveGame) game; //socket connecting to client Socket s = null; //connect to client if(renderWait != 0 && connections.size() < 2){ try { s = ss....
fa41d6a9-57da-411b-8e5c-df71e2d70e3a
2
public String encodeUrl(String value) throws Exception { try { if (value != null) { return URLEncoder.encode(value.trim(), "UTF-8").replaceAll("\\+", "%20"); } else { return null; } } catch (Exception e) { throw e; } }
c25748e4-6db5-4f45-9fb4-9daa8f2ae098
7
public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the s...
cb93756a-7acf-4022-b2e9-b079cc99159f
7
@SuppressWarnings("unchecked") public void tabulateTest(Test t) throws IOException{ //Takes a Test given by the user and shows all response results for the Test. Test tes = t; ArrayList<ArrayList<Response>> resp = new ArrayList<ArrayList<Response>>(); final File dir = new File("responses"); if (!dir.exists(...
f08a3a84-9b45-4ab4-8985-116b1bb486b1
1
public void visitInsn(final int opcode) { buf.setLength(0); buf.append(tab2).append(OPCODES[opcode]).append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitInsn(opcode); } }
69d40b6b-3678-4bad-8cd9-6d6365a444a4
5
public static void main(String[] args) { Set set = new Set(); Speler[] spelers = new Speler[5]; for(int i = 0; i < spelers.length; i++){ spelers[i] = new Speler(); } for(int i = 0; i <Vars.aantalTests; i++){ set.schud(); Kaart[] opTafel = new Kaart[5]; for(int j = 0; j < opTafel.length; j++...
8b4cb86a-de78-4dbe-a949-9db5cf1a485f
9
public int distSingle(int[] inds, int pos, int ch) { int size = inds.length; int[] inds2; int d = 0, i; if(ch >= 0) { inds2 = rp2c[pos][ch]; for(i = 0; i < size; i++) if(i != pos && (ch=inds[i]) != inds2[i]) d += ch >= 0 ? 2 : 1; } else { for(i = 0; i < size; i++) if(i != pos && (ch=inds...
4d7ba501-e1b8-4510-b443-faee22c922e6
0
public SimpleVector getDirection() { return cam.getDirection(); }
37dab9b6-86ea-45b9-a998-0d38a61731eb
4
public boolean equals(Object other) { if (other == this) return true; if (other == null) return false; if (other.getClass() != this.getClass()) return false; Point2D that = (Point2D) other; return this.x == that.x && this.y == that.y; }
ad210467-9c3d-4d9f-9bdf-d52456b464cf
1
public final void comment(final char[] ch, final int off, final int len) throws SAXException { try { closeElement(); writeIdent(); w.write("<!-- "); w.write(ch, off, len); w.write(" -->\n"); ...
fc94979e-3a73-43fa-9034-eb438eeb373f
2
@Override public T poll() { T result = null; if (firstItem != null) { result = (T) firstItem.value; if (firstItem.getNextItem() != null) { firstItem = firstItem.getNextItem(); } } length--; return result; }
17848f07-c0ff-4613-a7f3-00dd33ca206a
8
public static ScriptableObject initStandardObjects(Context cx, ScriptableObject scope, boolean sealed) { if (scope == null) { scope = new NativeObject(); } scope.associat...
358366c1-4fc0-4372-b1c5-2a1780b57406
7
public boolean kickClient(int cientID, boolean onlyChannelKick, String kickReason) { resetLastError(); if (!isConnected()) { saveLastError("kickClient(): Not connected to TS3 server!"); return false; } HashMap<String, String> hmIn; try { String command = "clientkick clid=" + Integer.toStri...
7a455e61-3a1d-44a3-b278-54f969d15f3f
4
@Override public void actionPerformed(ActionEvent event) { if (event.getSource() == setBPMButton) { try { bpmTextField.commitEdit(); bpmSetEvent(); } catch (ParseException e) { bpmTextField.setText((String) bpmTextField.getValue()); ...
2d11f208-4b4f-463d-944f-da46d202250a
6
public static double asin(double x) { if (x != x) { return Double.NaN; } if (x > 1.0 || x < -1.0) { return Double.NaN; } if (x == 1.0) { return Math.PI/2.0; } if (x == -1.0) { return -Math.PI/2.0; } if (x == 0.0) { // Matc...
d8f4594f-f549-4d22-8795-df86f4bc6f01
4
private static HashMap<String, Integer> getCollectionFrequency(String dirName, Normalizer normalizer) throws IOException { // Création de la table des mots HashMap<String, Integer> hits = new HashMap<String, Integer>(); File dir = new File(dirName); String wordLC; if (dir.isDirectory()) { // Liste des fich...
4eb0aa01-b594-4fcb-9391-565272db42c9
2
public void startConsole() { System.out.println("Welcome aboard! Type 'help' for more information"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { System.out.print("> "); String line = null; try { line...
f8730392-d859-47fd-8bff-252c141af761
0
@Override @RequestMapping(value = "/beers", method = RequestMethod.PUT) @ResponseBody @Transactional public BeerResponse create(@RequestBody BeerRequest beerRequest) { Beer beer = new Beer(); beer = persistenceService.create(beer); return update(beer.getId(), beerRequest); }
3317335b-18b9-466f-afe8-16eca5229899
4
@Test public void testSendStatus() throws Exception{ AccessControlServer server = new AccessControlServer(1926); server.start(); SpotStub security = new SpotStub("Security",1926); security.start(); String ans = ""; int x = 0; while(x == 0){ ...
bb30674a-c8f0-4f6c-a54c-6325503b206c
2
@Override public void run() { while(true) { //random time sleeping int timeToSleep = randInt(3, 10); try { TimeUnit.SECONDS.sleep(timeToSleep); } catch (InterruptedException e) { e.printStackTrace(); } /...
cf9be96f-03d4-4264-ae10-01e6ea2b049a
8
public JMenuBar createMenuBar() { // Create the menu bar final JMenuBar menuBar = new JMenuBar(); // Menu for all beans to demo JMenu componentsMenu = new JMenu("Components"); componentsMenu.setMnemonic('C'); menuBar.add(componentsMenu); for (int i = 0; i < bea...
451fe4e2-62f0-44e8-bcc1-91c77204863a
1
private void reply (String x) { try { Soutput.writeObject (x); Soutput.flush (); } catch (Exception e) { } }
022e824c-cb66-4bb3-95b5-f7fa810abb1a
1
public synchronized Object getNext() { Object obj = null; if (getSize() > 0) { obj = queue.firstElement(); queue.removeElementAt(0); } return obj; }
12866e90-6cec-4ebb-8e3d-2f7b50fb4204
5
@Override public boolean equals(Object obj) { if (!(obj instanceof Block)) return false; Block block = (Block) obj; if ((block.xPos == this.xPos) && (block.yPos == this.yPos) && (block.width == this.width) && (block.height == this.height)) { return true; } return false; }
b523429f-812c-4a40-9f60-6a328548271f
7
public String toString() { StringBuffer result; int i; int n; boolean found; result = new StringBuffer(); // title result.append(this.getClass().getName().replaceAll(".*\\.", "") + "\n"); result.append(this.getClass().getName().replaceAll(".*\\.", "").replaceAll(".", "=") ...
b4248f4a-5f90-4843-9e65-46310d485b89
3
byte[] buildBrush(byte[] brush, CPBrushInfo brushInfo) { int intSize = (int) (brushInfo.curSize + .99f); float center = intSize / 2.f; float sqrRadius = (brushInfo.curSize / 2) * (brushInfo.curSize / 2); float xFactor = 1f + brushInfo.curSqueeze * MAX_SQUEEZE; float cosA = (float) Math.cos(brushInfo.curAngl...
86b99ed0-570f-445a-ae2b-55295a07aceb
3
public void toXML( TreeNode treeRoot, Element node ) { if ( treeRoot.ChildNodes == null ) { return ; } for ( String SituName:treeRoot.ChildNodes.keySet() ) { Element nextNode = node.addElement(treeRoot.AttributeName); TreeNode childNode = treeRoot.ChildNodes.get(SituName); nextNode.addAttribute("v...
9ed3cba4-ea5f-4f47-8bce-f040569b67fa
7
public Dimension resize(final Dimension newSize, final boolean isLoading) { if (ancestor == null) return newSize; float[] objectBounds = getModel().getBoundsOfObjects(); if (objectBounds != null) { float xmin = objectBounds[0]; float ymin = objectBounds[1]; float xmax = objectBounds[2]; float ymax ...
63456365-54f0-4378-878d-edacd0815187
5
@Scheduled(fixedRate = 60000) public void scheduledPoll() { Optional<Status> status = Optional.absent(); if (url != null) { status = statusPoller.poll(url); } if (!status.isPresent()) { System.out.println(String.format("not status found at url %s", url)); ...
56a817e2-298b-42e4-854e-812ba59d7470
6
public static Object setValue(String key,Object obj, Object newValue) { String error = ""; if ( obj instanceof Map ) { ((Map)obj).put(key,newValue); return newValue; } try { BeanInfo binfo = Introspector.getBeanInfo(obj.getClass(), Object.class); ...
28f80f70-42b5-446d-ac53-0fff7c5d816e
8
public static int binarySearchUnknownLength(List<Integer> A, int k) { // Find the possible range where k exists. int p = 0; while (true) { try { int val = A.get((1 << p) - 1); if (val == k) { return (1 << p) - 1; } e...
00153ddf-5499-4922-95af-2b8da69124d3
1
public void refresh() { myCases = myLemma.getDoneDescriptions(); /* * Let the table know that data has changed. */ ((AbstractTableModel)myTable.getModel()).fireTableDataChanged(); if(myCases.size() == 0) { myDone.setEnabled(false); ...
ed7b8601-2e9c-4fb3-9069-8b176ac4c0d9
4
public static int cmpDstMaj(final int[] buffer, final int first, final int second) { // if (buffer[first + IDX_DST] < buffer[second + IDX_DST]) return SMALLER; if (buffer[first + IDX_DST] > buffer[second + IDX_DST]) return BIGGER; if (buffer[first + IDX_SRC] < buffer[second + IDX_SRC]) r...
b168b904-21a9-45c1-9438-dbe0106bb12e
3
@Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); Vertex chosenPoint = chooseVertex(e); if (e.getButton() == MouseEvent.BUTTON1) addPoint(draggedToX, draggedToY); else if (e.getButton() == MouseEvent.BUTTON2) toggleWallMode(chosen...
6208f98f-b502-4718-88f9-09c862fe3aa4
0
public void windowDeiconified(WindowEvent e) { isIdle=false; }
a45cdcea-bd1b-41a2-9fe5-f5a1efb7a603
5
public int getMaxJaar() { int jaar = 0; // Itereer de datasets for (DataSet set: this.datasets) { for (Category cat: set.categories) { for (SubCategory scat: cat.subcategories) { SubCategory subcat = new SubCategory(scat.id, scat.naam, scat.datatype, scat.weight,...
11ff8c9d-2aa8-4b16-b075-b92b5920d39c
0
public void setData(InputStream data) { this.data = data; }
e26ab718-d6a7-4c42-be00-03236d7b70c3
5
@Override public void update(Observable o, Object arg) { Route route = (Route) arg; if (route.to == null) { VoieEnum ve = (VoieEnum) ((VoieExterne)route.from).getEnum(); voituresEnAttentes.get(ve).incrementAndGet(); voituresEntrees.get(ve).incrementAndGet(); } else if (route.from instanceof VoieExtern...
0f724a0d-c570-4412-b983-965b04a356ff
8
private char getChar(int i) { if(i >= 0 && i < 10) { return (char) ('0' + i); } switch (i) { case 10: return 'A'; case 11: return 'B'; case 12: return 'C'; case 13: return 'D'; case 14: return 'E'; case 15: retur...
28eb47f9-998f-4a85-87e9-5037fcadcdc9
5
private ObjectDefinition method457() { int i = -1; if (varbitFileId != -1) { VarBit varBit = VarBit.cache[varbitFileId]; int configId = varBit.configId; int shift = varBit.anInt649; int amountBits = varBit.anInt650; int j1 = Client.anIntArray1232[amountBits - shift]; i = client.configStates[config...
99202cd1-547d-4342-a963-aac9b4d7107b
4
@Override public String buscarDocumentoPorEmpresa(String empresa) { ArrayList<Compra> geResult= new ArrayList<Compra>(); ArrayList<Compra> dbCompras = tablaCompras(); String result=""; try{ for (int i = 0; i < dbCompras.size() ; i++){ if(dbCompras.get(i)....
bc91f1e5-6f3c-4261-a4d1-508c030630e1
5
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); ...
a9363b8b-4fb5-4668-9ec6-0cf0467703c8
2
@Override protected void finalize() { if(m_resource.RemoveReference() && !m_fileName.isEmpty()) { s_loadedShaders.remove(m_fileName); } }
c607fc99-daf2-4be6-9411-1605f5c363c9
3
private void loadData() throws IOException, InvalidConfigurationException { File folder = getDataFolder(); if (!folder.exists()) { folder.mkdir(); } else { // Delete the old config file if it is there File oldConfigFile = new File(folder.getPath() + File.separator + "config.yml"); if (oldConf...
313713a6-0e81-4f14-aded-9cbce89b0ef2
1
public <T> BeansContainer register(Class<? extends T> impl, Class<T> iface) { registry.put(iface, impl); return this; }
e9efc708-ba0f-466d-9343-1d26805f9b89
9
public Element toElement() { cleanTableFrom(); DocumentFactory factory = DocumentFactory.getInstance(); Element root = factory.createElement(DbSchema.DBSELECT_FIELD); root.addAttribute(DbSchema.OFFSET_ATTRIBUTE, Integer.toString(offset)); root.addAttribute(DbSchema.LIMIT_ATTRIBUTE, Integer.toString(limit)); ...
33bd4f47-429c-4179-b360-a418c0583700
5
public final Texture getCoinTexture(final BlockType type) { switch (type) { case BLUE_FACE: return coinBlue; case RED_FACE: return coinRed; case GREEN_FACE: return coinGreen; case GREY_FACE: return coinGrey; case BROWN_FACE_BROKEN: return coinPotion; default: return null; } }
07b5a4e7-6703-4127-be88-905df970b022
4
private void step3Recursiv(String usedEdge, int delta, String target) { if (usedEdge != null && usedEdge.length() > 0 && delta > 0) { int flowAtEdge = this.graph.getValE(usedEdge, this.attrEdgeFlow); //Bin ich Source oder Target String source = this.graph.getSource(usedEdge); if (!source.equals(target...
50946938-b0e6-4ad6-b414-869256cdde45
1
public static synchronized DataAccessLayer getInstance(){ if (null == instance) { instance = new DataAccessLayer(); } return instance; }
f4445f70-0eb0-49b3-b380-f4aafcd4daa9
6
@Override protected void execute() { Map<Integer, Set<String>> m = new TreeMap<Integer, Set<String>>(); seq(new WalkToSegment(19, 17)); seq(Segment.skip(1)); seqMove(new WriteMemory(0xd3b1, 0x00)); // set index to 0 qsave(); for (int map=MIN_MAP;map<=MAX_MAP;map++) { if(excludedMaps.contains(map)) ...
d5b32b6b-4e12-4407-a325-1a8557370a05
3
@Test public void testShowAllTrackedJobs() throws LuaScriptException { String jid = addNewTestJob(); String jid2 = addJob(UUID.randomUUID().toString(), TEST_QUEUE); // Track both jobs performTrackingAction("track", jid); performTrackingAction("track", jid2); // Get tracked status List<String> emptyKeys...
6674a87f-dec2-44ac-848d-5ffc5014ee82
9
public int[] getPitchShifts(String tuningscheme, double bendrange, int rootnote, int tuningnote, double tuningfreq) throws Exception, IndexOutOfBoundsException { Double[] pitchratios = getRatios(tuningscheme); int[] pitchshift = {0,0,0,0,0,0,0,0,0,0,0,0}; // midi specs use a numerical value from (0 to 16383...
6c1d5f72-605b-41c6-b3eb-4afc76df54b1
7
public void shellSort() { int inc, i, j, s, s1, p1, p2, p3; Integer[] seq = new Integer[myArray.length]; p1 = p2 = p3 = 1; s1 = -1; do { if ( (++s1 % 2) != 0 ) { seq[s1] = 8 * p1 - 6 * p2 + 1; } else { seq[s1] = 9 * p1 - 9 *...
371d7fd7-7c6a-4ab6-bed7-5dd05d458a63
2
public TestEmbeddedServer( String host, int port ) { this.host = host; this.port = port; this.community_url = host + ":" + port + "/community"; getKeys(); TrustManager[] osTrustManager = new TrustManager[] { new LiberalTrustManager() }; try { sslcontext = SSLContext.getInstance("SSL"); ...
73edb8a6-1381-4a0e-8a5b-84fb689869f3
9
public void addDocument(File f) throws IOException { String document = ""; BufferedReader io = new BufferedReader(new FileReader(f)); String line; boolean markUpFile = false, captureText = false; while((line = io.readLine()) != null) { if(line.startsWith("...
873d7917-7e77-478e-ba78-1996205e6fd3
0
public final IServiceProvider getSite() { return privateSite; }
ce972501-ec49-4d10-9f51-e6cd8b6c06ea
5
public ArrayList<Pallet> getPalletsWithBlockStatus(boolean status) { ArrayList<Pallet> pallets = new ArrayList<Pallet>(); String sql = "Select * from Pallets where isBLocked = ? "; PreparedStatement ps = null; try { ps = conn.prepareStatement(sql); ps.setBoolean(1, status); } catch (SQLException ...
1f6d760b-533d-4bf3-b7c0-e1d5944ac324
7
* @param colony The <code>Colony</code> to unload to, * or null if unloading in Europe. * @return True if the unload succeeded. */ private boolean unloadGoods(Goods goods, Unit carrier, Colony colony) { if (colony == null && carrier.isInEurope() && carrier.getOwner()...
64cbf0af-0dd4-46ea-8252-f5afa367663a
0
protected void _allocate(int cap) { initialCapacity=cap; buf=new byte[cap]; index=0; }
d49282ef-b98b-4ff1-8baf-6671b45e690e
2
public String toString(){ if(identifer != null)return this.identifer.getNewName(false); else if(literal != null)return this.literal.getValue(); else return expression.toString(); }
c08a4ae6-149d-48d4-b3f9-00016347710d
6
@SuppressWarnings("unchecked") @Override public void refreshView(Map<String, Map<String, Object>> state) { // Extract the maps from the state // Map<String, Object> mapState = state.get("mapState"), dayState = state .get("dayState"); LinkedList<Map<String, Object>> elementList = (LinkedList<Map<String, O...
cf3c8329-f4f6-498e-9992-14b3dd2cce91
7
@Override public void update(Observable o, Object arg1) { if (o == model){ view.displayData(model.getData()); view.displayScore(model.getScore()); view.displayHint(model.getHint()); if(model.isSucceed()){ view.gameOver(true); } if(model.isStuck()){ view.gameOver(false); } } i...
c71ebcf7-c199-48df-a531-50e8d1b089ef
3
public void printSudoku() { for (int i = 1; i <= countRow; i++) { for (int j = 1; j <= countRow; j++) { if (selectCellCoord(i, j).openValues.size() == 1) System.out.print(selectCellCoord(i, j).openValues + " "); else System.out.print("[ ] "); ...
a8502cad-f96f-48e1-80d5-dd1f4bc06a2f
1
@Override public int read() throws IOException { synchronized (this) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } return -1; }
de2f7476-068b-4565-87e4-8ea39dff69db
9
protected void processEntity(IXMLReader reader, IXMLEntityResolver entityResolver) throws Exception { if (! XMLUtil.checkLiteral(reader, "NTITY")) { XMLUtil.skipTag(reader); return; } XMLUtil.skipWhitespace(reader, null); char c...
f45bea91-67f8-41fe-a3b4-0a2a513ae91c
6
public static void analytics() { String uuid=""; try { BufferedReader in=new BufferedReader(new InputStreamReader(new FileInputStream(Main.path+"uuid.txt"), "UTF-8")); String ln; String out=""; while ((ln=in.readLine())!=null) out+=ln; uuid=out; ...
1891fe35-4584-4087-a28a-99d9d769f1bb
8
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(tickID!=Tickable.TICKID_MOB) return false; if((affecting()!=null)&&(affecting() instanceof MOB)) { final MOB M=(MOB)affecting(); final Room room=M.location(); final MOB invoker=(invoke...
c88b2041-9000-4d02-a1a0-3c76130baa01
5
@Override public void run() { byte[] receiveData = new byte[1024]; while(active) { try { DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); serverSocket.receive(receivePacket); String sentence = new String(receivePacket.getData(), 0, receive...
d2e3f27f-ffa5-45c8-9570-8f85f6487ab4
0
public String getName() { return name; }
d9c5ca93-83f3-4148-ba98-79d98e1adcf9
4
private LinkedList<Node> getAllNodes(Node in) { LinkedList<Node> list = new LinkedList<Node>(); list.add(in); int i = 0; while ( i < list.size() ) { for ( Node n : list.get(i).getNeighbors() ) { if ( n != null && !list.contains(n) ) list.addLast(n); } i++; } return list; }
a800d7c6-d82f-4877-b373-86c5eb2406e0
0
@Basic @Column(name = "password") public String getPassword() { return password; }
5264237e-d584-4f5f-ac1c-3b42c25b6cb8
0
public String getPlace() { return place; }
bfc79d07-a159-4a36-ab58-2dfe951ae908
4
public String row(int i) throws Exception { int h = this.contents.height(); // The top and bottom of the box if ((i == 0) || (i == h + 1)) { return "+" + TBUtils.dashes(this.contents.width()) + "+"; } // Stuff within the box else if ((i > 0) && (i <= h)) { ret...
7e2619b1-9ca6-43fa-b128-9223c0e57aef
6
@Override public void render(GameContainer gc, Graphics g) { _animation[facing].draw(position.getX(), position.getY()); if(GameInfo.SHOW_DEBUG_INFO) { if(considered != null && isCurrentlyMoving) { g.setColor(new Color(0, 255, 255, 64)); for(Node node : considered) { Vector2 pos = node.getPosition()...
b6e1d7f7-4731-4fa3-8d22-cd5514a87628
1
public Map<Position, List<ElementInfo>> getElements() { final Map<Position, List<ElementInfo>> elements = new HashMap<Position, List<ElementInfo>>(); for (Entry<Position, List<Element>> entry : getGrid().getElementsOnGridMap().entrySet()) elements.put(entry.getKey(), new ArrayList<ElementInfo>(entry.getValue()))...
f257e34d-bf60-42eb-b77c-50f245c32fcd
1
public double leiaDouble() { double numero = 0 ; String linha ; BufferedReader entra = new BufferedReader(new InputStreamReader(System.in)) ; try { linha = entra.readLine() ; numero = Double.valueOf(linha).doubleValue(); } ...
edc7c81b-0ac1-4275-907c-7e68171a4fd9
5
public void startWorking(BufferedReader in, PrintWriter out) throws IOException { new Thread(() -> { try { String input; while ((input = in.readLine()) != null) { lastInput = input; event.run(); } } c...
7f2c942b-8d0b-4174-9cd1-93fcdc92ee0b
7
@Override public void executeTask() { /* Redundant code here in the event Server and Client start diverting. */ try { /* NULL indicates no node was registered. */ if (node != null) { Node mNode = new Client(); switch(node.NODE) { case CLIENT: mNode = RoutingTable.getInsta...