method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
92b83cfd-b899-4fbf-845c-1bcc8fe82ae8
0
@Override public void set(String t, Integer... a) { // TODO Auto-generated method stub }
93c53889-e603-4228-b1cb-86b3834a2d6c
0
public IntegrationMethods getIntegrationMethod() { return integrationMethod; }
df6b9e79-a79b-49ca-b046-5dc924f14556
0
public double getSpeedY(){ return speedY; }
4ebd8fe6-f6c1-46ad-9964-66f6ed015252
1
@Override public final void stop() { if (anInt4 >= 0) { anInt4 = 4000 / delayTime; } }
1cd43481-e25c-45f2-9961-07d89ed2cfd1
8
public void nextPermutation(int[] num) { if (num == null || num.length == 0) { return; } int vio = num.length - 1; while (vio > 0) { if (num[vio - 1] < num[vio]) { break; } vio--; } if (vio > 0) { vio--; int rightIndex = num.length - 1; while (rightIndex >= 0 && num[rightIndex] <= ...
19569adf-0573-4076-8c5e-c1219ce884ab
5
public static <TT> TypeAdapterFactory newFactoryForMultipleTypes(final Class<TT> base, final Class<? extends TT> sub, final TypeAdapter<? super TT> typeAdapter) { return new TypeAdapterFactory() { @SuppressWarnings("unchecked") // we use a runtime check to make sure the 'T's equal public <T> TypeA...
d817898b-a90d-488e-8748-ba39c5b02024
1
public String getReturnType() { return returnType == null ? null : returnType.toString(); }
6f46eff0-f568-4be8-a638-014564eb0195
1
public String generaTabla(ArrayList<String[]> cat) { String tabla = ""; tabla += "<table style='width:100%'>"; for (int i = 0; i < cat.size(); i++) { tabla += "<tr id='padre" + cat.get(i)[0] + "'>"; tabla += "<td id='hijo" + cat.get(i)[0] + "' onclick='voyAeditar(" + cat...
5c620cd5-1c25-476f-9c80-dcd56c2500ee
1
public static void mapKeys() { //Update keys for(int i=0;i<keys.length;i++){ keys[i] = Keyboard.isKeyDown(i); } }
7ccf3303-6158-404f-9735-8c869e63c879
8
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been calculated so lets ask for the maximum. int ...
7771ef2c-e335-4491-b54d-dd82bd518dd5
5
private NPC closestAttackableNPC(Filter<NPC> f) { NPC npc = null; for (NPC n : client.getLocalNPCs()) if (n != null) if (((npc == null || distance(n) < distance(npc)) && f .accept(n))) npc = n; return npc; }
0e5f8bee-345a-4ac3-824f-8dc8ae471d70
5
public int getIndexAt(int x, int y) { if (handles != null && isHandlesVisible()) { int tol = graphComponent.getTolerance(); Rectangle rect = new Rectangle(x - tol / 2, y - tol / 2, tol, tol); for (int i = handles.length - 1; i >= 0; i--) { if (isHandleVisible(i) && handles[i].intersects(rect)) ...
6728c6e7-f9bd-414e-9818-319c83397535
6
public String toString() { StringBuffer ss = new StringBuffer(); int order = p.length - 1; for (double t : p) { if (order == p.length - 1) { ss.append(t); if (order > 0) ss.append("s^" + order); } else { if (Math.abs(t) > epsilon) { if (t > 0) ss.append("+"); else ss.a...
4f11c549-ad4d-4815-8413-7595fecb9939
6
private void getStartElement(String name) throws MiniXMLException { MiniXMLToken oMiniXMLToken; boolean bEnd = false; String attrName, attrValue; automaton.startElement(name); MiniXMLStartElement element = new MiniXMLStartElement( automaton.getStateInt(), name); // System.out.print("<" + name); do { ...
061951de-0762-420c-a634-7bf9197a695b
0
protected void initialize() { _timer.start(); }
cd655980-6159-4169-93b4-3c771c719fb3
5
@Override public void retrieveServer(ModpackModel modpack, final String serverId, final IDiscordCallback callback) { final Boolean deadCacheValue = deadCache.getIfPresent(serverId); if (deadCacheValue != null && deadCacheValue) return; Server cacheValue = cache.getIfPresent(ser...
f1a533c9-5cfc-4b63-a045-7819c74a9cc9
8
public static void main(String[] args) { HashMap<Integer, Integer> map = new HashMap<Integer, Integer>(); populateMap(map); int daysPassed = 2; int month = 1; int dayOfMonth = 1; int year = 1901; int startingSundays = 0; while (year < 2001) { if (daysPassed%7 == 0 && dayOfMonth == 1) { star...
18ea2de8-d7c7-426a-bb33-789f6b647de8
4
public void removeQuestionInQueue(String target, int queueNumber) throws Exception { LinkedList<AbstractQuestion> playersActiveQuestions = getQuestions(target.toLowerCase()); if (playersActiveQuestions.size() == 0) { removeAllQuestions(target); throw new Exception("There are no pending questions"); } try ...
314fc238-9177-4747-b2fa-dc267079d45a
3
public void printMultiplicationTable() { // first print the top header row System.out.format(" "); System.out.println("Enter the tablesize"); int tableSize=in.nextInt(); for (int i = 1; i <= tableSize; i++) { System.out.format("%4d", i); } System.out.println(); System.out.println("--------...
7cbd3d8b-0a0f-4d63-9288-4f974b077813
0
public Player getboss() { return boss; }
653cd286-9d77-46e4-ae73-ba8542319fd0
3
private static boolean insertValuesInEdge(int idStartNode, int idEndNode, float etx, float rate, float mtm, float ett) { Node startNode = Tools.getNodeByID(idStartNode); Node endNode = Tools.getNodeByID(idEndNode); if(!startNode.outgoingConnections.contains(startNode, endNode)) return false; Iter...
fd441506-3492-4612-bdfc-217a4b80604b
8
public static Graph tree(int V) { Graph G = new Graph(V); // special case if (V == 1) return G; // Cayley's theorem: there are V^(V-2) labeled trees on V vertices // Prufer sequence: sequence of V-2 values between 0 and V-1 // Prufer's proof of Cayley's theorem: Prufer ...
24e93503-a9e2-451d-978e-e74cde48b48c
6
public void mouseClicked(MouseEvent e) { // Only do this if there is something selected if (view.getLetterSelection() != -1) { // Check the selection and update the word on screen String letterSelection = alpha[view.getLetterSelection()]; // If the selected value has not been picked before ...
bcd6cc73-cf33-403b-8602-aaaa91b3aea3
7
@EventHandler public void GhastFastDigging(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.getZombieConfig().getDouble("Ghast.FastD...
8c739fe0-4846-4944-94d0-3293fcd3a72c
3
public void run() { try { log.info("crawling url: " + urlToCrawl.link()); Page page = downloader.get(urlToCrawl.link()); if (page.getStatusCode() != Status.OK) { visitor.onError(urlToCrawl, page.getStatusCode()); } else { visitor....
9afdb3ba-34ad-4591-8cd5-cb64c9b794a8
9
public void create(AccessPerfiles accessPerfiles) { if (accessPerfiles.getAccessConfigUserList() == null) { accessPerfiles.setAccessConfigUserList(new ArrayList<AccessConfigUser>()); } if (accessPerfiles.getAccessRolesList() == null) { accessPerfiles.setAccessRolesList(ne...
7abf01f0-6d60-415a-8494-976399ea0cf7
0
public Token<T> get(int i) { return tokens.get(i); }
e0cac0d1-0bd4-444e-a293-0ef36ed357fc
5
private boolean checkRas() throws IOException { byte[] a = new byte[14]; if (read(a) != a.length) { return false; } final byte[] RAS_MAGIC = {0x6a, (byte)0x95}; if (!equals(a, 0, RAS_MAGIC, 0, 2)) { return false; } format = FORMAT_RAS; width = getIntBigEndian(a, 2); height = getIntBigEndian(a, 6...
e8d8288a-66a2-4672-addd-373f5b02faf1
3
public static User getUser(String username, String pass) { User user = userManager.getUser(username); if (user != null && pass != null && pass.equals(user.getPassword())) return user; return null; }
5e11fbf0-57ae-438b-b729-15e9a11b1489
0
public String getName() { return name; }
1feb163d-536a-4571-8d77-5f3ce949ec35
2
public boolean setPasswort(String betroffenerBenutzer, String neuesPasswort) { Benutzer benutzer =dbZugriff.getBenutzervonBenutzername(betroffenerBenutzer); if (benutzer != null){ try{ benutzer.setPasswort(neuesPasswort); return true; } catch (SQLException e){ System.out.println(e); } } re...
613dcdb6-5751-4816-8fd9-c8fc1424fcef
8
public void setImage(Bullet b){ switch(b.getDirection()){ case(0): b.image = bulletpics[6]; break; case(1): b.image = bulletpics[3]; break; case(2): b.image = bulletpics[4]; break; case(3): b.image = bulletpics[1]; break; case(4): b.image = bulletpics[5]; break; case(5): b...
a6494634-d142-4fd6-891e-805e6983ffa8
1
public static FancyHouse constructFancyHouse(String[] args) { FancyHouse result; try { result = new FancyHouse(Double.parseDouble(args[0]), Double.parseDouble(args[1]), Integer.parseInt(args[2])); } catch...
a35caf62-2c34-41e7-acf2-e2e9c7407994
1
private String getCreate( String variable ) { StringBuilder sb = new StringBuilder(); sb.append( "\n" + TAB + TAB + variable + " " + toJavaCase( variable ) + " = " + "Test" + variable + "Dao.create" + variable + "();\n" ); if ( !getCreatedCalled ) { sb.append( TAB +...
a30ef87c-88e9-496a-b528-9e5fb67622f8
6
public PirateBay(String command) { String[] splitArray = command.split("\\s+"); String argument=""; if (splitArray.length > 0) { switch (splitArray[0]) { case "-s": argument=splitArray[0]; s_switch = "s"; bre...
2dd970d8-3c11-40d4-9eba-1db5858ea934
0
public GenerateDataKit(int length, Object type, String state, int kitSize, int chars){ this.length = length; this.type = type; this.state = state; this.kitSize = kitSize; this.chars = chars; }
463d00d3-e285-4f7e-b4a9-89bb37b61e19
0
public Image getImageMetadatabyId(String id) { Query query = new Query(); query.fields().include(Image.FIELD_NAME_TIMESTAMP); query.fields().include(Image.FIELD_NAME_COMMENT); query.addCriteria(Criteria.where(Image.FIELD_NAME_ID).is(id)); return mongoImageTemplate.findOne(query, Image.class); }
bb9f98c8-07ef-4838-b44c-09ba41216f18
8
public static ArrayList<Double> PrimeNumbersBelow(double limit) throws MathException{ ArrayList<Double> primes = new ArrayList<Double>(); boolean prime = true; double sqRoot; //Error detected if(limit < 1){ throw new MathException("Invalid input, minamum is 1"); } //Logic exception: For single p...
581bf8d7-0325-4519-9797-30b44e1972d5
2
public String toString() { return "Event[code=" + type + ", type=\"" + getTypeName() + "\"" + ((date == null) ? "" : ", date=" + date) + ((place == null) ? "" : ", place=" + place) + "]"; }
f3848a50-0f17-46b3-ba3a-28c613980987
7
private FieldRule<F> internalRuleFromField(F field, Set<F> knownNonMines) { List<F> ruleParams = new ArrayList<F>(); int foundNeighbors = 0; int fieldValue = getFieldValue(field); for (F neighbor : getNeighbors(field)) { if (isDiscoveredMine(neighbor)) foundNeighbors++; else if (!isClicked(neighbor))...
86e327bc-fbee-48ad-967a-cd11a386ae11
4
public void printPOS(Course[][] courses) { for(int x = 0; x < courses.length; x++) { if (courses[x][0] != null) System.out.println(); for(int y = 0; y < courses[x].length; y++) { if (courses[x][y] != null) System.out.println(courses[x][y]); } } }
d15744dc-cb61-49e7-811b-6d40c9fe9995
2
@Override public BigDecimal calculate(Expression expression) { BigDecimal leftOperand = expression.getLeftValue(); BigDecimal rightOperand = expression.getRightValue(); if(leftOperand == null || rightOperand == null){ return null; } BigDecimal result = leftOperand.multiply(rightOperand); return...
4af920fc-c9c6-4e64-b58b-bade21325da4
0
public Secteur() { }
82b192ab-f599-4fd2-8ef2-a3f428735199
7
public static String getLCSubseq(String str1, String str2) { int substringLength1 = str1.length(); int substringLength2 = str2.length(); int[][] opt = new int[substringLength1+1][substringLength2+1]; for (int i = substringLength1-1; i >= 0; i--) { for (int j = substringLengt...
625301d3-d893-473c-b581-7af3dd2be1cc
4
public void initPlayersState(){ for(Player player : playerList) { if(!player.getState().equals(Player.States.FOLD) && !player.getState().equals(Player.States.ALL_IN) && !player.getState().equals(Player.States.LOSE)){ player.setState(Player.States.WAIT); player.setActionChip(0); } } }
d4d25d2c-6388-4719-bae5-717f76515e00
1
private void addBranches(final Label dflt, final Label[] labels) { addBranch(dflt); for (int i = 0; i < labels.length; i++) { addBranch(labels[i]); } }
09134b04-48d5-443a-bd30-e2953cfa808c
4
public <T extends ActiveRecord> T find(Class<T> clazz, int id) { if (id < 0) { throw new IllegalArgumentException( "The parameter id can not be negative."); } String query = "select * from " + clazz.getSimpleName() + " where id = ?"; PreparedStatement stmt = null; ResultSet rs = null; Connect...
7d5f7126-f436-4a01-8705-dae39797f3c8
1
static final void indent(Writer writer, int indent) throws IOException { for (int i = 0; i < indent; i += 1) { writer.write(' '); } }
0a463aa9-8a4b-4497-825a-f8a28126390a
5
public static void main(String[] args) { Scanner s = new Scanner(System.in); int alcohol = 0; int gasoline = 0; int diesel = 0; for(;;){ int code = s.nextInt(); if(code == 1){ alcohol++; }else if(code == 2){ ...
4e853eaf-5017-4c95-be13-3846defa3e5b
1
@Override protected void setReaction(Message message) { try { String newVideoID = getVideoID(message.text); downloadIfNeeded(newVideoID); LinkInfo li = getCachedInfo(newVideoID); reaction.add("YouTube: " + li.title() ); } catch (Exception e) { ...
751dbce3-0aac-4aa7-a6e7-f859fbfeaef9
5
public Node searchDirectParentWithAttribute(Node n){ if (n!=null) { Attributes attributes =n.attributes(); List <Attribute> list_attributes= attributes.asList(); if (list_attributes.size()>0){ for (int i=0; i<list_attributes.size(); i++){ String attributeHtml =list_attributes.get(i).html(); if(...
37def59e-0a7f-4afe-802e-2202d1dfc8cf
8
public synchronized void resizeTo(int x, int y, int direction) { if (direction == 1) { setBreadth(2.0 * Math.abs(ry - y)); } else if (direction == 0) { setLength(2.0 * Math.abs(rx - x)); } if (breadth < MIN_BREADTH) setBreadth(MIN_BREADTH); else if (breadth > MAX_BREADTH) setBreadth(MAX_BREADTH); ...
f90753c6-6e8d-4368-9f20-ded9c0b32007
4
public static void solveBruteForce() { long startTime = System.nanoTime(); //Parse file Parser p = new Parser(); p.parse(); Graph g = new Graph(); g.cities = p.out; //Populate array for first tour int[] firstPerm = new int[g.cities.size()]; for(int i = 0; i < g.cities.size(); i++){ firstP...
40b3a4b9-c8cd-4f6a-8864-78e41079e40a
5
public static List<mxPoint> parsePoints(String pts) { List<mxPoint> result = new ArrayList<mxPoint>(); if (pts != null) { int len = pts.length(); String tmp = ""; String x = null; for (int i = 0; i < len; i++) { char c = pts.charAt(i); if (c == ',' || c == ' ') { if (x == null)...
51f9087a-b740-4810-a613-0a007a8e9225
0
public static void registerFrame(JFrame jf){ draw = jf; }
9123ac0d-ea1b-480f-a5a4-94bf502339b2
8
@GET @Produces(MediaType.APPLICATION_JSON) public String list(@QueryParam("start") Integer start, @QueryParam("itemsPerPage") Integer itemsPerPage, @QueryParam("user_id") Integer user_id) { // 获取参数 Map<String, Object> params = new LinkedHashMap<String, Object>(); Page page = new Page(); params.put("page"...
14abb32f-6b03-4b5b-b91a-41c449f0f5f0
1
public void cancelarVenda() throws ExceptionGerenteVendas { if(atual == null){ throw new ExceptionGerenteVendas("Venda atual vazia"); } atual = null; }
5a8d8d57-9d02-4f1d-b773-6f282dec85f5
1
public void start() { if (thread == null) { thread = new Thread(this); thread.start(); } }
62ffce6a-3f58-46a8-b6da-1d20c77a27a7
2
@Override public final void destroy() { anInt4 = -1; try { Thread.sleep(5000L); } catch (Exception exception) { } if (anInt4 == -1) { exit(); } }
b43d83d7-ff5f-4a0a-9c08-dff197fef867
1
private void compute_pcm_samples8(Obuffer buffer) { final float[] vp = actual_v; //int inc = v_inc; final float[] tmpOut = _tmpOut; int dvp =0; // fat chance of having this loop unroll for( int i=0; i<32; i++) { final float[] dp = d16[i]; float pcm_sample; pcm_sample = (float)(((vp[8 + ...
fa361205-ee64-4886-8388-f73572d1def8
4
public static void main(String[] args) { DiceGame dice = new DiceGame(); double counter1 = 0; double counter2 = 0; int runs1 = 10000000; int runs2 = 10000000; for (int i = 0; i < runs1; i++) { if (dice.game1()) { counter1+=1; } } for (int i = 0; i < runs2; i++) { if (dice.game2()) ...
c0764aef-65c1-4efc-ae33-2e32ae36e1bf
1
public int getTotalNumberOfPages() { int numProds = products.size(); if (numProds % NUM_PROD_PER_PAGE == 0) { return numProds / NUM_PROD_PER_PAGE; } return (int) Math.floor(numProds / NUM_PROD_PER_PAGE) + 1; }
6d414fc4-c2dc-4c20-908e-8e6ba6a799db
3
void float_operation(float[][] A, float[][] B, float[][] C) { for(int i=0;i<cnt;++i) { for(int j=0;j<cnt;++j) { C[i][j] = 0; for(int k=0;k<cnt;++k) { C[i][j]+=A[i][k]+B[k][j]; } } } }
71434c2d-f641-419f-ac41-e44f749904ea
3
public static boolean canBeCreated() throws Exception { StringBuilder sourceCode = WebPage.downloadSourceCode(Search.URL); if (!(wasLogged(getName(sourceCode))) && parseURL(sourceCode) && !(WebPage.downloadSourceCode(Search._URL + Search.filmography).toString()).equals("-1")) { return true; } return f...
6dd851a4-5657-43ae-9b3a-d78e8b472af0
0
@Override public void saveToDevice() { log.debug("保存至软盘..."); }
90a2a248-7d72-4309-8f1b-c9df013c31d4
6
void setScrollAttribute(CS355SScrollbarAttrConsts scrollBar, CS355SScrollbarAttrConsts attribute, int number) { JScrollBar scrollbarToChange = null; switch (scrollBar) { case H_SCROLL_BAR: scrollbarToChange = jScrollBar2; break; case V...
737e83b3-fdb8-41e5-a93a-e45aa4effba4
6
private List<Color> getDominantClustersInNeighbourhood(Node node) { NodeIterator neighborNodes = this.LPAClusteringEngine.getGraph().getNeighbors(node).iterator(); Map<Color, Double> neighborClusterWeights = new HashMap<Color, Double>(); // Calculating clusters weights in the processed ...
ea514a5e-2e6e-4c4d-ba67-3036956b29ed
3
protected void processKeyEvent(KeyEvent e) { if (e.getID() == e.KEY_PRESSED) { // if backspace is pressed, clear the map if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE && inputManager.getMaps(action).size() > 0) { inputManager.clearMap(acti...
77f3f0b9-f508-4814-97e9-e6a4a6e5372c
6
@Override public void actionPerformed(ActionEvent e) { //Si on clic sur nouveau personnage if(e.getActionCommand().equals("Nouveau personnage")) { System.out.println(e.getActionCommand()); new NouveauPersonnage(); // création du nouveau panel } ...
e6b67162-20c0-4bd4-85f9-64e143548c67
5
public void checkResults() throws IOException, InterruptedException { //check for completed reduces Iterator<Entry<String,ReduceRequest>> it = activeReduces.entrySet().iterator(); while(it.hasNext()) { Entry<String,ReduceRequest> e = it.next(); ReduceRequest rr = e.getValue(); String filename = e.getKey(...
18443a4e-a768-40ec-b76d-0dba233eb796
9
static void generate_hypotheses(final int order, final Hypothesis h, final ArrayList<ME_Model> vme, List<Hypothesis> vh) { int n = h.sentence.size(); int pred_position = -1; double min_ent = 999999; String pred = ""; double pred_prob = 0; for (int j = 0; j < n; j++) { if (!h....
ba5b1ba9-6c08-49d4-b81e-04991ee3ef74
4
public void clearMap(GameAction gameAction) { for (int i=0; i<keyActions.length; i++) { if (keyActions[i] == gameAction) { keyActions[i] = null; } } for (int i=0; i<mouseActions.length; i++) { if (mouseActions[i] == gameAction) { ...
38f5ade3-1439-466a-9f9a-33ad65f3679a
3
public boolean equals(Object o){ if(o==this) return true; if(o.getClass() == Server.class) return false; Server p = (Server) o; if(p.id.equals(this.id)) return true; return false; }
7a2f6aeb-7d5a-4291-90f4-c3e29742ba20
1
public void insertStructuredBlock(StructuredBlock insertBlock) { if (methodHeader != null) { insertBlock.setJump(new Jump(FlowBlock.NEXT_BY_ADDR)); FlowBlock insertFlowBlock = new FlowBlock(this, 0); insertFlowBlock.appendBlock(insertBlock, 0); insertFlowBlock.setNextByAddr(methodHeader); insertFlowBlo...
ca2988b3-0a3f-46e9-93ab-375b99400a45
3
void writePartsToStreams( InputStream streamIn, OutputStreamGetter outputStreamGetter, String boundary) throws IOException { byte[] boundaryBytes = ("\r\n--" + boundary).getBytes("UTF-8"); splitter.init(streamIn); // Discard everything until the f...
245f8838-9a58-43a5-8434-ebfba5d3845e
9
public boolean isIP(String s){ // Make an ArrayList splitting the string up based off of . and : ArrayList<String> alist = new ArrayList<String>(Arrays.asList(s.split("[.:]+"))); if(alist.size() != 5){ // If the string wasn't a long enough IP return false; } ...
21bbd30a-705a-4647-8bf8-c88f06d11e57
7
public void run() { String serverAddress = JOptionPane.showInputDialog("Enter the server address"); try { socket = new Socket(serverAddress, portno); System.out.println("Connection established"); outStream = new PrintWriter( socket.getOutputStream(), true); inputStream = new BufferedReade...
8dfae627-07e1-46bf-b6f0-52f266871a60
7
public static void loadFileToCarsPersons(Connection connection, String filePath) { ReadCVS cvsReader = new ReadCVS(); String[] record; PreparedStatement statement = null; try { cvsReader.readFile(filePath); String insertTableRequest = "INSERT INTO car...
67617ae4-a193-41cc-9e23-74412ae3c694
9
private static void populateRecursively(ArrayList<String> exclusions, ArrayList<String> ignoreList, ArrayList<String> concatenations, Node node, String concatenation) { NodeList childs = node.getChildNodes(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); if (exclusions.cont...
7eaf3574-00d8-45af-a82e-a40187bed312
0
public Object getDelegate() { return delegate; }
5563e9c1-d7a6-4118-b9e6-96bab02aa845
1
public static double angleDiff(double target, double current) { if (Math.abs(target - current) > Math.PI) return 2.0 * Math.PI - (current - target); return target - current; }
a46b3c42-6f62-43fd-9b9d-eeb1a01dc4ff
8
public String TitikHanya2(String strQty){ char [] data = strQty.toCharArray(); String newStrQty = ""; int JmlTitik = 0, PosTitik=0; int Pencacah=0; for (char c : data){ if (c != '.') { newStrQty = newStrQty + String.valueOf(c); } else if (...
3c1b7d47-51f3-4431-8ed3-c820598b28ce
3
public Identifier getIdentifier(String name) { if (loadOnDemand) { Identifier ident = loadClass(name); return ident; } int index = name.indexOf('.'); if (index == -1) return (Identifier) loadedClasses.get(name); else { PackageIdentifier pack = (PackageIdentifier) loadedClasses.get(name .subst...
d425c015-c36b-4594-9e03-b0de39352964
4
public static final List<Block> load(final String file, final float offset) { final List<Block> blocks = new ArrayList<Block>(); try { final Scanner s = new Scanner(new File(file)); for (int y = 0; s.hasNextLine(); y++) { final String line = s.nextLine(); final String[] parts = line.split(" "); f...
423a0875-c342-4531-b3f3-927e6a2b5b25
8
public static int pushAdjacent(Stack<Pair<Integer, Integer>> myStack, int[][] canTravel, Pair<Integer, Integer> curr, Map<String, String> myMap, int[][] pathCost){ int currX = curr.getFirst(); int currY = curr.getSecond(); if(currX+1<canTravel.length && canTravel[currX+1][currY]==0){ Pair<Integer, ...
21801f33-3c94-4edf-9dbb-ce79ac2581d9
7
public TileEntity getChunkBlockTileEntity(int par1, int par2, int par3) { ChunkPosition var4 = new ChunkPosition(par1, par2, par3); TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); if (var5 != null && var5.isInvalid()) { chunkTileEntityMap.remove(...
9c51bd61-c4be-4006-a7da-3928d1d693dd
6
public void onEnable(){ log = this.getLogger(); config = new Config(this); config.load(); //load the config :) bm = new BankMap(); loader = new SlotLoader(this); cmd = new BankCommand(this); PluginManager pm = getServer().getPluginManager(); description = getDescription(); new File(getDataFolder(), ...
72f3e082-1f9b-4556-b359-b15512045b69
5
public void interact(InteractEvent e) { if(!script.isBusyReading() && e.getInteractType() != InteractEvent.Type.INTERRUPT) { script.startReading(e.getInteractor()); } else if(script.isBusyReading() && e.getInteractType() == InteractEvent.Type.INTERRUPT) { script.interrupt(); } else if(script.isBusyReading()...
24ce7711-f3e5-4f13-8bf7-7f5cd8740d4e
9
public void drawTextWithPotentialShadow(String text, int x, int y, int currentColour, boolean shadowed) { strikethrough = false; int originalX = x; if (text == null) return; /* * Draw from the top-left rather than the bottom. */ y -= fontHeight; /* * Iterate through every character in t...
ee2155c9-0974-438a-a919-db2c4f78dfbc
1
public List<Meeting> getMeetings(Contact contact) { List<Meeting> contactMeetings = null; ContactImpl theContact = (ContactImpl) contact; if (theContact.getMeetings() != null) { contactMeetings = theContact.getMeetings(); } else { System.out.println("This contact has no meetings!"); } return con...
25829c45-b2b2-4f2a-b405-4ae4959179c0
1
public String toString(){ StringBuilder builder = new StringBuilder(Integer.toString(userId)); for(int i = 0; i < itemIds.length; i++){ builder.append("(").append(itemIds[i]).append(",").append(ratings[i]).append(")"); } return builder.toString(); }
c73b424d-c2bd-4d2c-a7bd-247ff144e0c8
2
public void printInput() { System.out.println("---input map---"); for (Map.Entry<String, Boolean> entry : input.entrySet()) { String key = entry.getKey(); String value = (entry.getValue() ? "true" : "false"); System.out.println(key + ": " + value); } }
34f918ae-f82b-4cd1-a54e-8aea9e034ff1
5
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String outputJson = ""; PrintWriter out = response.getWriter(); try { String method = request.getParameter("method").toLowerCase( Locale.ENGLISH); ...
5d79bae2-361e-430a-82ed-0b39db6d67cc
8
private boolean epakelvotKoordinaatit(int xa, int xl, int ya, int yl) { if(xa < 0 || xa > 7) return true; if(ya < 0 || ya > 7) return true; if(xl < 0 || xl > 7) return true; if(yl < 0 || yl > 7) return true; return false; }
3567700c-fe64-468f-ac0c-e9ad0ceb2f71
3
@Override public Integer next() { if (!hasNext()) { throw new NoSuchElementException(); } int result = a * b; if (b++ == upperIncusive) { if (a++ == upperIncusive) { done = true; } else { b = a; } ...
8bde9684-8702-45c5-aa46-30af3fc120fb
3
private void updatePositionSlider(Duration currentTime) { if (positionSlider.isValueChanging()) { return; } final MusicPlayer mp = musicPlayer; final Duration total = mp.getTotalDuration(); if (total == null || currentTime == null) { positionSlider.setVal...
a4616336-e321-4e3a-8c87-01b2d9e823b0
7
public boolean isReady(){ if(this.name != null && this.displayName != null && this.active != false && this.startLocation != null && !this.spawnsLocations.isEmpty()){ if(!(this.maxplayers < this.minplayers)){ if(!(this.spawnsLocations.size() < this.minplayers)){ return true; } } } return false; ...
782b800b-e7b3-441d-8ba2-b5090ef863bd
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...
c6f73134-718f-431f-9259-919efead2230
1
private static long getLong(StringTokenizer tokenizer) { try { return Long.parseLong(tokenizer.nextToken().trim()); } catch (Exception exception) { return -1; } }
3ad7de3e-08be-410e-8c59-56cd14ae66f1
9
protected List<Framedata> translateRegularFrame( ByteBuffer buffer ) throws InvalidDataException { while ( buffer.hasRemaining() ) { byte newestByte = buffer.get(); if( newestByte == START_OF_FRAME ) { // Beginning of Frame if( readingState ) throw new InvalidFrameException( "unexpected START_OF_FRAME...