method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d609634c-e06f-494c-a19d-6e27aeffe6ff
2
public static void loadFonts(){ try { resource = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/fonts.png")); } catch (IOException e) { e.printStackTrace(); } try { texture = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/background/sand.png"));...
ef6ef649-1d15-4c89-a215-89e16f269666
1
public void applyPreserveRule(IdentifierMatcher preserveRule) { if (loadOnDemand) loadMatchingClasses(preserveRule); super.applyPreserveRule(preserveRule); }
c63aed86-f621-409a-9ad7-b98a5d55e26f
0
@Override public void componentResized(ComponentEvent e) { // 根据panel自适应大小,调整scrollpane和textArea的位置 scrollPane.setBounds(0, 0, this.getWidth(), this.getHeight()); textArea.setSize(scrollPane.getSize()); // 调整滚动条到随后 textArea.selectAll(); // 去掉全选效果 textArea.setCaretPosition(textArea.getDocument().getLengt...
75ec7a17-72a3-4d4b-944f-030709dea392
0
public LocalDate getEndDate() { return this._endDate; }
14ebf1a1-788c-42da-8927-9c38ed8918fd
0
@OneToMany(mappedBy="car") public List<Participant> getPassengers() { return passengers; }
7248fdf9-ee1b-4852-88ce-0d8505a2ad0e
3
void replaceAllocStmt(Unit u){//Set<Unit> set){ String classname = null; /* Iterator it = u.getDefBoxes().iterator(); while(it.hasNext()){ Value v = ((ValueBox)it.next()).getValue(); if(v instanceof Local){ Local l = (Local)v ; classname = l.getType().toString(); } } */ StringBuilder sb = n...
381c811b-f931-485b-93f1-0d719689093a
0
public void setPcaIdElemento(int pcaIdElemento) { this.pcaIdElemento = pcaIdElemento; }
26805530-e4fd-44c1-86e5-977ac697921e
3
private static boolean doesPatternExist(Map<Byte, byte[]> haystack, byte[] needle) { if (needle == null) return false; for (Byte key : haystack.keySet()) { if (Arrays.equals(haystack.get(key), needle)) { return true; ...
c30c9741-29e9-4504-85af-a90147091096
8
private void loadingStages() { if(lowMem && loadingStage == 2 && ObjectManager.anInt131 != plane) { aRSImageProducer_1165.initDrawingArea(); aTextDrawingArea_1271.drawText(0, "Loading - please wait.", 151, 257); aTextDrawingArea_1271.drawText(0xffffff, "Loading - please wait.", 150, 256); aRSImageProdu...
80a7eb66-aa9d-4f1d-b8d5-06d659bf3ac5
7
@Override public int worldAging(int age) { //between 4000BC and 100BC if(age < -100){ return age + 100; } //Around birth of Christ else if(age == -100){ return age = -1; } else if(age == -1){ return age = 1; } else if(age == 1){ return age = 50; } //between 50 AD and 1750 AD e...
817b4f1c-53db-493b-bfff-751603fadf94
5
private void multiplyTempo() { String txt = tempoField.getText(); if (txt != null) { int num = 1; try { num = Integer.parseInt(txt); } catch (NumberFormatException e) { return; } if (num <= 1) ret...
e6b0dc3d-c1ea-4971-8e62-8ade8bb4a4a9
4
public void verifyType(String inMsg, BufferedReader in) throws Exception{ String welcomeMsg = WELCOME_CONSTANT + "\n"; String[] splitter = inMsg.split(":"); if ((splitter[0] + ":").equals(FROM_CONSTANT )){ if (!splitter[1].isEmpty()){ String ipReceived = splitter[1];...
e9ee21af-6e32-4b38-afbe-d48959cebf6e
0
@Override public void greeting(Context ctx) { System.out.println("Hello !! " + LoggerUtils.getSig()); ctx.setState(new ConcreteState_Night()); }
dd9e4f43-e2cd-4e94-8c59-b5455267088c
4
public boolean deleteFile(String filename, int resID) { // check for errors first if (resID == -1 || filename == null) { return false; } Object[] packet = new Object[2]; packet[0] = filename; packet[1] = myID_; // send the event super.sen...
f67dd151-b3cd-4586-80df-dcb671302f89
4
@SuppressWarnings("unchecked") @Override public String displayQuestionWithAnswer(int position, Object userAnswer) { ArrayList<String> questionList = (ArrayList<String>) question; String questionStr = questionList.get(0) + "_____________" + questionList.get(1); ArrayList<String> answerList = (ArrayList<String>) ...
2bf69ccc-154e-4c85-b8b0-84309a37a3b9
0
public void setSaveEncoding(String saveEncoding) { this.saveEncoding = saveEncoding; }
e457742c-7ad8-49f7-bf9b-19682d91c82e
7
public static List<Flow> getFlows(String dpid) throws IOException, JSONException { List<Flow> flows = new ArrayList<Flow>(); // If JSONObject is not supplied, get it. try { obj = (JSONObject) Deserializer.readJsonObjectFromURL("http://" + IP + ":8080/wm/core/switch/" + dpid + "/flow/json").get(5...
1161c1f5-5505-4df0-8b05-a86b2825950a
5
public static boolean getFileWithHttp(String address, String localFileName) { OutputStream out = null; URLConnection conn = null; InputStream in = null; try { // create local folders new File(localFileName).getParentFile().mkdirs(); // get file URL url = new URL(address); out = new Buffere...
bddf0b67-532e-4339-92c6-203c709a6488
8
@Override public void affectPhyStats(Physical affected, PhyStats affectableStats) { super.affectPhyStats(affected,affectableStats); if(affected instanceof MOB) { affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_SEE_HIDDEN); if(ticksSinceLoss>30) affectableStats.setDisposition(af...
fc2623d6-6e0d-4d3d-b9af-e4cd24098a58
4
static protected void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { ...
fd12150b-2fe1-4429-8582-f2c573251274
3
public static boolean conflitoLinha(int posicaox, int posicaoy, int valorteste, Celula[][] sudoku){ int linhateste = posicaox; for(int i=0;i<=8;i++){ if(i==posicaoy){ continue; } Celula celulatestar = sudoku[linhateste][i]; if(celulatestar....
10d4c19a-232e-4b0b-886d-f0ae5c104111
1
@Test public void shouldThrowErrorWhenFileSizeTooBig() throws IOException { //given File tmpFile = folder.newFile(FILENAME); String filePathString = tmpFile.getAbsolutePath(); Path filePath = Paths.get(filePathString); byte[] bytes = new byte[260000]; Files.write(file...
50c3e627-f17a-4055-b0e8-7bf510cf6c6c
4
public void setWrap(int a){ switch(a){ case 0: mainBrain.setXYwrap(false, false); break; case 1: mainBrain.setXYwrap(true, false); break; case 2: mainBrain.setXYwrap(false, true); break; case 3: mainBrain.setXYwrap(true, true); break; } }
561e7383-e636-4dd0-914e-74dbf726bf5f
7
public void run() { while(true){ if(client.isConnected()){ while(!client.isGameStarted()) { //listens to server for the go signal client.listenToServer(); } // // game components revealed // setButton.setVisible(true); lblNumberOfCards.setVisible(true); numberOfCardsInDeck.setV...
6884a537-8a57-4f27-bb18-083994ddc1a9
2
public static void main(String[] args) { ArrayList arrayList1 = new ArrayList(); arrayList1.add("Hello"); arrayList1.add("world"); arrayList1.add("world"); arrayList1.add("welcome!"); String s1 = (String)arrayList1.get(0); String s2 = (String)arrayList1.get(1); String s3 = (String)...
bd5d74d8-82b6-4b52-94b8-807084006797
8
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map<String, String> fouten = new HashMap<>(); String gebruikersnaam = request.getParameter("gebruikersnaam"); String paswoord = request.getParameter("paswoord"); if (gebruikersnaam == null || g...
d05ce029-0674-4dd4-a23c-5407400b2d0f
7
protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer) throws DecoderException { FrameDecoder decoder = null; // REVIEW: allow channel output selection type // (LEFT, RIGHT, BOTH, DOWNMIX) switch (layer) { case 3: if (l3decoder==null) { l3decoder = new LayerIIIDec...
a0299c52-7d66-4ed0-954f-e04e6e48301f
6
public static void setPixels(BufferedImage img, int x, int y, int w, int h, int[] pixels) { if (pixels == null || w == 0 || h == 0) { return; } else if (pixels.length < w * h) { throw new IllegalArgumentException("pixels array must have a length" ...
84df6835-e216-4de6-9867-9938c4ab584e
0
@Test public void testNextInt() { System.out.println("nextInt"); RandomInt instance = new RandomInt(); int expResult = 0; int result = instance.nextInt(1); assertEquals(expResult, result); expResult = 0; result = instance.nextInt(2); ...
b0ecb4e0-939f-4e45-b81a-f0fd3384ad98
3
public void inicio(Local local) throws Exception { salvar = new JButton("Salvar"); id = new JTextInt(local.getId()); id.setEditable(false); id.setEnabled(false); cidade = new JTextField(local.getCidade() == null ? "" : local.getCidade()); estado = new JTextField(local.getEstado() == null ? "" : loc...
f3478929-78cd-4244-8cf7-b653cd8ba269
1
public static void insertActionCom(String typelibelle) throws SQLException { String query = ""; try { query = "INSERT INTO ACTION_TYPE (TYP_LIB) VALUES (?); "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStatement(query); pStatement.setStr...
4c42330f-8804-457a-91d5-e85abacf5f4c
0
public void setjButtonPrec(JButton jButtonPrec) { this.jButtonPrec = jButtonPrec; }
c1341cc5-3eb5-48d8-ad07-390605df7066
2
private static int trySwapTimes(int[] a, int times){ if(times == 0) return maxSum(a); int max = Integer.MIN_VALUE; for(int i=0;i<allSwaps.size();i++){ Point p = allSwaps.get(i); swap(a, p.x, p.y); allSwaps.remove(i); max = Math.max(max, trySwapTimes(a, times-1)); allSwaps.add(i, p); } return ma...
b7301e65-1eab-43b9-ac59-25c1d4fadbbb
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vector3d vector3d = (Vector3d) o; if (x == vector3d.x && y == vector3d.y && z == vector3d.z) { return true;...
45f95bc4-8fd2-479c-9cd6-8bf797693adb
1
@Override public String getText() { String typed = super.getText(); return typed.equals(hint) ? "" : typed; }
05212c8d-70eb-4690-a540-8f0fd51dd561
0
public void setName(String name) { this.name = name; }
c8c023d7-fafe-4baa-91e5-638ea22a2a27
0
public String getHostname() { return _hostname; }
1c50537b-fab9-4b34-9c2f-d9586f0f41c0
5
public static void parseQueryString(String queryString, Map<String, String> params) { if (queryString == null || params == null) { return; } if (queryString.length() > 0) { String token; int offset; StringTokenizer tokenizer = n...
1d23a336-d686-4e9e-b076-86c2d0be4738
0
public int getFloorDistance() { return floorDistance; }
2d0e8429-81d8-4883-8739-297af2baa21c
8
public static void main(String[] args) { int port = 4444; // default port // Check for and parse command line arguments Queue<String> arguments = new LinkedList<String>(Arrays.asList(args)); try { while ( ! arguments.isEmpty()) { String flag = arguments.remo...
56fdad5a-211d-4e2d-a0a6-abd3676a3b0f
6
private void handleMouseInput() { if (Mouse.getDX() != 0 || Mouse.getDY() != 0) { if (isMouseOnSelection(SELECTION.YES) && !currentSelection.equals(SELECTION.YES)) { Sounds.get().playCursor(); currentSelection = SELECTION.YES; } else if (isMouseOnSelection(SELECTION.NO) && !currentSelection.eq...
e2bfe0cd-f02a-4b53-bf8c-928bcbf96b90
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...
f7136356-115e-432a-9b13-cbe76af16503
4
public Grid getGrid() { boolean test = false; if (test || m_test) { System.out.println("GameBoardGraphics :: getGrid() BEGIN"); } if (test || m_test) { System.out.println("GameBoardGraphics :: getGrid() END"); } return m_grid; }
54c57672-6936-4f65-a7fd-0f243fd6ccd9
3
public int size() { if(empty){ return 0; }else if(begin < end){ return end-begin; }else if(begin > end){ return MAX-begin+end; }else{ return MAX; } }
d563f97b-18ba-4357-9b4c-5b8594c0a2ef
6
private void loadLanguage() { try { BufferedReader reader = new BufferedReader(new FileReader(new File(GameApplication.getGameDir() + File.separator + "resources" + File.separator + "lang" + File.separator + langFileName + ".glf"))); String cur; while ((cur = reader.readLine...
ce405841-c8e0-484a-97b4-4a8a58350d73
8
public static int minCut(String s) { boolean [][] isPal = new boolean[s.length()][s.length()]; int[][] cost = new int[s.length()][s.length()]; // for single letter palindromes for( int i = 0; i< s.length(); i++) { isPal[i][i] = true; cost[i][i] = 0; } ...
ab7e1a27-cbe6-477a-ba90-d81a85d94dfe
4
public static void main(String[] args) { SequentialSearchST<String, Integer> st = new SequentialSearchST<String, Integer>(); for (int i = 0; !StdIn.isEmpty(); i++) { String key = StdIn.readString(); st.put(key, i); } // print keys for (String s : st.keys()) StdOut.println(s + " " + st.get(s)); ...
67035bd2-32b4-4629-8142-4bd81cf52d8a
9
private int validMove(int x, int y) { if ((x >= 0) && (x < 10) && (y >= 0) && (y < 10)) { if (this.playerIntBoard[x][y] > -2) return 1; } else if ((x < 0) || (x >= 10) || (y < 0) || (y >= 10)) { return -5; } return this.playerIntBoard[x][y]; }
9c46c4af-f1dd-4c9b-8af5-1f704ab4a618
3
public Map<String, TableDescription> getTablesInDataBaseDescription() { Map<String, TableDescription> result = new HashMap<String, TableDescription>(); for (DataBase db : databases.values()) { for (TableDescription td : db.getTablesDescriptions()) { String tableName = td.get...
9de6f6fd-6b1f-449c-9d7c-172a418aa2c3
3
public List<QcTestCase> getTestCases(List<Long> testcaseIds) throws Exception { List<QcTestCase> testCases = new ArrayList<QcTestCase>(); for (Long testcaseId : testcaseIds) { QcRequest qcRequest = new QcRequest(QcConstants.QC_ENDPOINT_URL + "/test-case/" + testcaseId); try { ...
9e421a68-42d8-4864-b4f8-8babfe4cf94b
5
@Override public void update() { super.update(); Projectile projectile = null; ArrayList deadProjectiles = new ArrayList(); try { for (String key : projectiles.keySet()) { projectile = (Projectile) projectiles.get(key); projectile.update(...
35b465b7-c22a-4c22-8ed4-e1de4b2c805d
8
@Override public boolean keyUp(int keycode) { switch (keycode) { case Keys.UP: moving.remove(Dir.North); return true; case Keys.DOWN: moving.remove(Dir.South); return true; case Keys.RIGHT: moving.remove(Dir.East); return true; case Keys.LEFT: moving.remove(Dir.West); return true; c...
bb82db59-5326-473b-b063-24fe42be133b
9
void rehash() { int oldCapacity = table.length; Entry oldMap[] = table; int i; for (i = oldCapacity; --i >= 0;) { Entry e, next, prev; for (prev = null, e = oldMap[i]; e != null; e = next) { next = e.next; Object obj = e.ref.get()...
7b1cd388-e228-40f3-8a9a-2c0959f1cf47
0
public static Session fromNanoCookie(NanoHTTPD.CookieHandler cookie) { return fromSessionId(cookie.read(COOKIE_KEY)); }
d8616391-5388-4359-807d-83bde3c17077
9
private void RenderFrame() { int i = 0; glBegin(GL_LINES); glColor3d(1, 1, 1); boolean draw = true; for(i = 0; i < 8; i++){ for (int j = 0; j < 8; j++){ for (int l=0; l<8; l+=2){ if((i == opposites[l] && j == opposites[l+1]) || i == getExcludedVertex() || j == getExcludedVertex()){ draw = f...
491ee47a-642d-4944-8515-80ffec0d7b77
2
public void moveBullets() { for (int i=0; i<MAX_BULLETS; i++) { if (bullets[i].getVisibility()) { bullets[i].moveForward(); } } }
57de9dd6-dd8d-4440-bf64-97e7aa8cec71
4
public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); switch(key) { case KeyEvent.VK_W: p.setMoveUp(true); break; case KeyEvent.VK_S: p.setMoveDown(true); break; case KeyEvent.VK_A: p.setMoveLeft(true); break; case KeyEvent.VK_D: p.setMoveRight(true); b...
067fbe9c-e216-4712-82e7-1ce047579e09
2
public int getBytesDownloaded(){ int total = 0; for(int i : pieces.keySet()){ Piece p = pieces.get(i); if(p==null) continue; total += p.bytesCompleted(); } return total; }
1df5a818-54d7-4aad-a1b3-2c5185fd6c89
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
b65ca8df-9d9b-46fc-a80a-fca6a67ab3ba
8
private static void deleteCompetitor(Scanner scan){ //If there are some competitors in table. while (!ds.getAllCompetitor().isEmpty()) { //Display all competitor for conveniently picking a name. ds.printCompetitors(ds.getAllCompetitor()); System.out.println("please input the name of competitor whom you wan...
cdca374d-b242-4f8a-bdce-fce7ef78e3a2
1
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); final int dID = Integer.parseInt(request.getParameter("dID")); PrintWriter out = response.getWriter(); if (new Control(-1).startParsing(dID)) { out.pr...
527b348c-efb6-4ee0-8404-93dec8bc9de9
0
public Integer getEmailsCount() { return emails.size(); }
67fa6dd7-2f29-41c0-9005-7095a2669ed0
4
public static String[] readMap(int stage){ String[] array = new String[Constant.MAP_Array_SIZE]; File file = new File("source/stages/stage" + stage + ".txt"); BufferedReader bur = null ; try { FileReader fr = new FileReader(file); bur = new BufferedReader(fr); String str = null; int i = 0 ; w...
7e54325e-bfba-49e3-8ae1-9f801444e8f2
1
public void setSelectionPointer(String pointerName) { this.pointer = new SelectionPointer(pointerName); if(selection != -1) { pointer.setPositionAt(get(selection)); } }
36cc92ba-13cc-48b6-bdae-bf44a93cfdd8
3
public void act(){ if (clicked){ if (counter >= 10){ counter = 0; clicked = false; } else{ counter++; this.setImage (bg[2]); } } else if (selected){ selected = false; ...
e06d1f74-fd45-479a-a5ad-748580e92ecb
0
public void restoreTemporaryToCurrent() { lineEnd.restoreTemporaryToCurrent(); saveEncoding.restoreTemporaryToCurrent(); saveFormat.restoreTemporaryToCurrent(); ownerName.restoreTemporaryToCurrent(); ownerEmail.restoreTemporaryToCurrent(); applyFontStyleForComments.restoreTemporaryToCurrent(); applyFontSt...
15ef8730-6dbc-4e3d-83f0-01eb1cb899da
1
void checkEndCode() { if (endCode) { throw new IllegalStateException( "Cannot visit instructions after visitMaxs has been called."); } }
815aec73-d53d-4f1a-b05f-83447572595a
6
public static void main(String[] args) { /* wap to print following pattern * *** ***** ******* ***** *** * */ for(int i=0;i<=3;i++) { for(int j=3;j>=i;j--){ System.out.print(" "); } for(int j=i;j>...
fbe49c15-c3cf-47bd-afbf-72d54a7406f3
3
private static ResourceUserList createGridUser(GridletList list) { ResourceUserList userList = new ResourceUserList(); userList.add(0); // user ID starts from 0 userList.add(1); userList.add(2); int userSize = userList.size(); int gridletSize = list.size(...
7cdc032c-135d-47e2-9871-3db21910eda3
4
@Override public String getUsername() throws RemoteException { { try { String name = JOptionPane.showInputDialog(null, "Please, enter your nickname!"); if (name != null && name.trim().length() > 0) { nickname = name; return ...
0c632824-46df-4247-a2d5-cdf5da00b434
0
public static Hand TwoPair(Rank firstPairRank, Rank secondPairRank, Rank firstKicker) { return new Hand(HandRank.TwoPair, null, firstPairRank, secondPairRank, firstKicker, Rank.Null, Rank.Null); }
af4fd1c9-e01c-43a6-b020-93f258c5c6fe
6
public Behaviour jobFor(Actor actor) { if ((! structure.intact()) || (! personnel.onShift(actor))) return null ; final Choice choice = new Choice(actor) ; final Delivery d = Deliveries.nextDeliveryFor( actor, this, services(), 10, world ) ; if (d != null && personnel.assignedTo(d) < 1) { ...
40e4f297-a392-4b76-b42d-5447a9b01801
8
public CRLGen() { super(); try { crlM=new CRLManager(); //Certificat à révoquer } catch (InvalidKeyException e) { // TODO Bloc catch généré automatiquement e.printStackTrace(); } catch (KeyStoreException e) { // TODO Bloc catch généré automatiquement e.printStackTrace(); } catch ...
f7e9c16a-cf36-4b0b-b2c6-c2156609c630
1
public void update(GameContainer c, StateBasedGame s, int d) throws SlickException { GameScreen.time += d; if (c.getInput().isKeyPressed(Input.KEY_SPACE)){ s.enterState(1); } }
1d499a81-d624-493f-9807-d58fd0ff76e6
9
private static Result toResult(Object xml) throws IOException { if(xml==null) throw new IllegalArgumentException("no XML is given"); if (xml instanceof String) { try { xml=new URI((String)xml); } catch (URISyntaxException e) { xml=new ...
4fa20972-e81a-46b6-8339-66aa01eb055c
6
@Override public PlayerAbilities swapAbilityScores(int strength, int intelligence, int wisdom, int dexterity, int constitution, int charisma) { List<Integer> scores = new ArrayList<Integer>(); scores.add(abilities.getStrength()); scores.add(abilities.getIntellige...
0b1fe7a3-b4f6-4bec-889c-3991c1dc7bd2
3
@Override public Dimension getMinimumSize(JComponent c) { if ((JOptionPane) c == optionPane) { Dimension ourMin = getMinimumOptionPaneSize(); LayoutManager lm = c.getLayout(); if (lm != null) { Dimension lmSize = lm.minimumLayoutSize(c); if (ourMin != null) { return new Dimension(Math.max(lmSiz...
84d769fb-f302-40af-93b3-54371f4d4845
3
@Override public Move findBestMove(int[][] board) { while(true) { String s = in.next(); for (Move move : Move.ALL) { if(move.arrow.equals(s)) { int[][] newBoard = makeMove(board, move); copyBoard(board, newBoard); ...
dd87637a-8d89-405c-b679-39034246f411
2
public static void main(String[] args) throws Exception { final Runner runner = new Runner(); Thread t1 = new Thread(new Runnable() { public void run() { try { runner.firstThread(); } catch (InterruptedException ignored) {} } ...
bf0a8cf4-5397-41ad-be41-64eb1f7308ea
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/entrada/form.jsp"); EntradaBean oEntradaBean; EntradaDao oEntradaDao; oEntrad...
0b42347f-a127-4821-a193-80d5bbb9f45f
8
public String KonversiKwitansi (double doubleAngka){ String [] bil ={"","satu","dua","tiga","empat","lima","enam","tujuh","delapan","sembilan","sepuluh","sebelas"}; String x=" "; int intAngka = (int) doubleAngka; if (doubleAngka<12){ x = bil[intAngka] + " "; } else i...
d12b6efc-122e-4899-b9af-5e75ad5b27e3
5
* @return a bitset with all specified versions set */ public BitSet convertVersions( String spec ) { BitSet set = new BitSet(); if ( spec.toLowerCase().equals("all") ) { for ( int i=1;i<=versions.size();i++ ) set.set(i); } else { ...
c5f5e642-fd3a-466b-9e03-b11c16192c9f
3
public static void main (String args[]) throws Exception{ ConnectionFrames playerWindow = new ConnectionFrames(); playerWindow.run(); Ball ball = new Ball(); while(playerWindow.connectionType == null); System.out.println(playerWindow.connectionType); //ball.run(); ...
85c3e852-a240-4fe8-9b0a-538bb6cad575
4
public void addComment(String value) { if (value != null) // we have something { String trimmed = value.trim() ; if (trimmed.length() > 0) { if (trimmed.charAt(0) == '#' ) // comment sign { comment.add( value ) ; after = 0 ; return ; } ...
a59a02dc-ec76-4a85-abf0-4cc43720bcf3
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...
d3d8fbf3-d7b0-4948-9f87-2c0c77a24271
4
public int getMachineIndexByName(String machineFileName){ ArrayList machines = getEnvironment().myObjects; if(machines == null) return -1; for(int k = 0; k < machines.size(); k++){ Object current = machines.get(k); if(current instanceof Automaton){ ...
3efb6482-ce74-469b-9f0e-dd515f703ea0
8
@Override public Iterable<Token> determineMostLikelyTags(Iterable<Token> sentence) { List<Map<String, Double>> matrix = new ArrayList<>(); Map<String, List<String>> paths = createPath(); Iterator<Token> tokenIter = sentence.iterator(); // initialize base cases (t == 0) String firstToken = tokenIter.next()...
12b98af1-cec1-4cf1-80b3-85ead86510c2
7
private static int parseArgs(String[] args, HamaConfiguration conf, BSPJob bsp) { conf.set(inputMatrixAPathString, args[0]); conf.setInt(inputMatrixARows, Integer.parseInt(args[1])); conf.setInt(inputMatrixACols, Integer.parseInt(args[2])); conf.set(inputMatrixBPathString, args[3]); conf.setInt(inputMatrix...
b8670bfe-5735-47aa-aba3-eb4f4bc7fa8b
5
public static void createColumn(CyTable table, String columnName, Class type, Class elementType) { CyColumn column = table.getColumn(columnName); if (column != null) { if (!column.getType().equals(type)) throw new RuntimeException("Column "+columnName+" already exists, but has a different type"); if (colu...
050ea1dc-fec0-4bf9-82f5-9c7b915ee532
7
@Override public void action() { //System.out.println("Executando comportamento esperarReputacao"); ACLMessage mensagem = this.agenteReputacao.receive(); if(mensagem != null){ System.out.println("Recebi Mensagem"); ACLMessage mensagemDeRetorno = mensagem.createReply(); AID agenteEmissorAid ...
d754dea2-0be1-4e1f-91db-7e43c40288be
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Produk other = (Produk) obj; if (!Objects.equals(this.Pcode, other.Pcode)) { return false; ...
2fed591a-2f16-400c-b109-9779422c4d9d
8
protected void setupMouseControls(){ // right click to set the color addMouseListener(new MouseInputAdapter() { public void mouseClicked(MouseEvent e) { if( e.getButton() == MouseEvent.BUTTON1 || e.getButton() == MouseEvent.BUTTON3){ int xPos = e.getX(); ...
6dccae49-0bce-43c9-8f07-37decb9eef07
6
public void insert(ListNode node, int index) { ListNode currentNode = root; ListNode beforeNode = root; int currentIndex = 0; if (!isEmpty() && index >= 0 && index <= size()) { // iterate to index while (currentNode != null && currentIndex != index) { beforeNode = currentNode; currentNode = curr...
64e3d6dd-fc41-4e8c-88a0-5a14806cbe43
5
private String getCorrection(String word) { String res = corrections.get(word); if (res != null) { return res; } for (String u : getMisspelled(word)) { String s = corrections.get(u); if (s != null && ((word.length() >= DOUBLE_CORRECTION_TRESHOLD) || i...
252d0198-4b8b-4abb-9947-339e862febd4
7
public static void main(String[] args) throws Exception { Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40); analyzer = new WhitespaceAnalyzer(Version.LUCENE_40); String index_path = "D:/code_respo/index"; String data_path = "D:/code_respo/respo"; String query_path = "D:/code_respo/query.py"; Stri...
a4fa0d0b-5986-476e-87a2-e56e68e57fbb
2
@Override public void tick() { if (wait <= 3) { wait++; return; } if (getLevel().getTile(getX(), getY() - 1, getZ()).getVisableBlock() == 0) move(getX(), getY() - 1, getZ()); }
d2923253-1ac9-494a-8732-8eea09d495e7
0
@Override public void deleteEntity(T entity) throws DaoException { waitCompete(); getEntities().remove(entity); }
c9b9fee7-74cf-43d8-af1e-b79d27f00f46
3
public PodcastModel[] getSearchResult1(){ try{ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.parse(_url.openStream()); doc.getDocum...
3a493262-be88-4896-ba13-1cd7f6c30047
0
public byte[] toBytes() { ByteBuffer buffer = ByteBuffer.allocate(BASE_SIZE + 4 + length); buffer.putInt(length) .put(Message.Type.PADDING.getTypeByte()) .put(data); return buffer.array(); }
cd5eb407-da73-4b36-b5e8-758cb3fbdc40
5
public Problem validate(final Object instance, final UpperCase annotation, final Object target, final CharSequence value) { if (value == null || value.length() < 1) { if (annotation.required()) { return new Problem(instance, annotation, target, value); } return null; } fo...