method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
beea98f0-19fd-445a-9d9a-e365d4d3fe1e
2
public static <T extends DC> Set<Pair<T,PT<Integer>>> codom(Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().snd(),codom(phiMax.getNext())); } else { return new Set(phiMax.getFst().snd(),null); ...
72446b5f-ad5b-40ed-8dc8-c0b86d93caa9
3
@Override public boolean sureUzat(int siraID, int saat, int dakika) { try { /* HbmIslemler hbm = new HbmIslemler(); Sira siraBilgisi = (Sira) hbm.bilgiGetir(siraID , this.getClass()); * */ Sira siraBilgisi = siraBul(siraID); if(siraBi...
2e776648-4c5e-475e-9219-1bca5f5bfe0c
9
private void parseModuleImport() throws XPathException { QueryModule thisModule = (QueryModule)env; Import mImport = new Import(); String prefix = null; mImport.namespaceURI = null; mImport.locationURIs = new ArrayList(5); nextToken(); if (t.currentToken == Token....
80521a19-103e-46be-a4a3-a969b75ab62f
1
public void dumpInstruction(TabbedPrintWriter writer) throws java.io.IOException { /* * Only print the comment if jump null, since otherwise the block isn't * completely empty ;-) */ if (jump == null) writer.println("/* empty */"); }
1f058e7a-bf5d-4315-ae2b-b1a9f6e2076e
6
public void addCategory(Category c) { Connection conn = null; PreparedStatement ps = null; //Do nothing if category is not properly instantiated if(c == null) return; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); //Insert attributes f...
e14df306-4961-4e8f-a698-765220c4dcb0
1
public void info(String message) { if (this.logLevel >= Logger.INFO) { log(" INFO ", message); } }
e3ec6da2-1fbd-44ee-9df6-5c1ccbcdfa36
5
private void button4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button4MouseClicked if(numberofpins < 4) { if(numberofpins == 0) { Login_form.setString1("0"); } if(numberofpins == 1) { Login_form.setString2("0"); } if(numberofpins == 2) { Login_...
4fcaecce-3ef0-4c4f-8a27-32a7d12a055a
2
public Tiedote validateID() throws ValidointiPoikkeus { // luodaan wrapper virheiden kuljettamista varten ValidointiVirheet virheet = new ValidointiVirheet(); // luodaan validoija Validator validoija = new Validator(); Tiedote tiedote = new Tiedote(); // tiedoteID:n validointi if (validoija.validateInt(...
dd161ad5-1d79-43f1-9507-6c38f9755ddd
0
public void setCbLabo(JComboBox cbLabo) { this.jComboBoxLabo = cbLabo; }
d017fe10-6b73-460c-8339-a4c266c2a966
1
private Item Itemvalidate(Item item){ if(!paidTransaction(Accesscreate(),item) ) return null; return item; }
4792e533-3fd5-4317-8863-82001528890a
4
private void btnConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConnectActionPerformed if((!txtFrnd.getText().equals(""))){ try { String frnIP = database.getFrndIp(txtFrnd.getText()); switch(chat.getFriend(frnIP, txtFrnd.getText())){ ...
91032de6-bd88-4db0-a30e-202641b836c7
7
private void transcribeVerticesAndTriangles(HashMap<Integer, MarchingCubes.Node3f> vertexMap, ArrayList<MarchingCubes.Triangle> triangleList) { int idIter = 0; Iterator<Entry<Integer, MarchingCubes.Node3f>> mapIterator = vertexMap.entrySet().iterator(); Entry<Integer, MarchingCubes.Node3f> ...
25caf6f5-c1b4-44f1-8036-831daf59c2b4
4
private void findPathes() { if(MAZE.getHeight() == 0 || MAZE.getWidth() == 0 || !MAZE.isRoad(0, 0)){ log("No pathes"); return; } List<List<? extends Point>> pathes = findPathesRecursive(); log("Found: " + pathes); log("Count: " + pathes.size()); }
49b55398-b6f9-4efe-b072-319662da1b11
3
private void removeMobs(){ for(ListIterator<Mob> i = mobs.listIterator(); i.hasNext();){ Mob mob = i.next(); if(mob.isDead()){ ((HostileMob)mob).getSpawner().remove(1); i.remove(); for(int j = 0; j < 5; j++) addParticle(new BloodParticle(getParticles().size(), mob.getX(), mob.getY(), 0xff6E2120, 8, ...
da645981-b713-4839-8f37-83c59f06a51d
2
@Override public void run() // read server messages and act on them. { try { DatagramSocket socket = new DatagramSocket(udpPort); serverReceiveThread = new ServerReceiveThread(registry, gameController, socket, udpPort); serverReceiveThread.start(); } catch (IO...
d6f668fd-5544-474c-bb57-0027e6a25f75
2
private boolean ifStatement() { if (accept(NonTerminal.IF_STATEMENT)) { enterScope(); expression0(); statementBlock(); if (accept(Token.Kind.ELSE)) { statementBlock(); } exitScope(); } return false; }
8a58dbdb-510b-4555-bab4-2dcc63d6829c
1
public static synchronized SkiPassSystem getInstance() { if (instance == null) { instance = new SkiPassSystem(); } return instance; }
7210af3e-09c2-46de-9f65-a004319db871
1
@Override public void run() { while(true){ repaint(); } }
29ddffaa-3ae1-4963-85c5-7189b77ff082
7
public int maxSubArray(int[] A) { int max = 0; int NegetiveMax = Integer.MIN_VALUE; int len = A.length; boolean allNegetive = true; for(int i=0;i<len;i++) { if(A[i] > 0) { allNegetive = false; } else { if(A[i] > NegetiveMax) { ...
00d1a50e-4357-40e2-83de-514bfbc9098d
7
private List<Pregunta> corregirExamen(HttpServletRequest request, HttpServletResponse response) { List<Pregunta> questList = new ArrayList<Pregunta>(); String listId = request.getParameter("listId"); String[] ids = listId.split(","); for (int i = 0; i < ids.length; i++) { ...
ae44aeec-a59b-4e97-b775-b67d26135092
9
public String toString() { // Number of items in each list to print int n = 10; String output = "The word list "; output += isPruned ? "has been pruned:" : "has not been pruned:"; if (isPruned) { output += "\n\tPruned word list: (showing first " + n + " items for each word length)"; for (Integer k...
8b921246-f9c0-48cf-b651-0cfa68445362
7
@Override public Feature[] analyze(String hpId, String mpId) { String[] hpSyns = OntologyLoader.getHPSynonyms(hpId); if(hpSyns.length == 0) return null; String[] mpSyns = OntologyLoader.getMPSynonyms(mpId); if(mpSyns.length == 0) return null; int count = 0; for(String hpSyn: hpSyns){ for(String mpSyn:...
9428c5a4-4a49-46d8-b29e-777a62478b4b
8
public static Stella_Object access_PLProposition_Slot_Value(PLProposition self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == GuiServer.SYM_GUI_SERVER_PropositionName) { if (setvalueP) { self.PropositionName = ((StringWrapper)(value)).wrapperValue; } else { ...
cc2bc374-acfe-4de7-a764-61e6a036a330
7
public int maxDepth(treeNode root) { if (root == null) return 0; if (root.leftLeaf == null && root.rightLeaf == null) return 1; if (root.leftLeaf != null && root.rightLeaf != null) { int maxLeft = maxDepth(root.leftLeaf); int maxRight = maxDepth(root.rightLeaf); return maxLeft <= maxRight ? (max...
87e09ba9-7685-4577-bcc7-8e7a4010355d
6
private void enableType(int type) { bitsLbl.setEnabled(false); arrayLbl.setEnabled(false); enumLbl.setEnabled(false); typeType.setEnabled(false); array.setEnabled(false); enumData.setEnabled(false); switch (type) { case TYPE_DISABLE: break; case TYPE_ARRAY: { typeType.setEnabled(true); ...
1fc7d402-6ba7-4aff-b6a4-1ce2826fecb7
4
protected Map<String, Long> writeFileList(String destination, long offset) { Map<String, Long> filePathMap = new HashMap<String, Long>(); String innerPath, rawPath; VDKRandomAccessFile raf = null; try { raf = new VDKRandomAccessFile(destination, "rw"); for(VDKInnerDirectory d : getChildren()...
81c4b012-9bb1-406d-857e-43e8c13df64e
2
public void checkDialogs() { if(dialogQueue.size() > 0) { inputEnabled = false; currentDialogBox = dialogQueue.remove(); } else { inputEnabled = true; currentDialogBox = null; if(dialogCallback != null) { dialogCallback.onClose(); } } }
b403ed92-05e0-4fd9-a36e-d54ac184a74f
1
private static String addHTMLFontColor(final String text, final boolean isExceptional) { return "<html><body><font color=" + (isExceptional ? "red" : "green") + ">" + text + "</font></body></html>"; }
62532eca-d4ff-4771-82c9-199a05d30c19
7
protected static Ptg calcRoundDown( Ptg[] operands ) throws CalculationException { if( operands.length < 1 ) { return PtgCalculator.getNAError(); } double[] dd = PtgCalculator.getDoubleValueArray( operands ); if( dd == null ) { return new PtgErr( PtgErr.ERROR_NA );//20090130 KSC: propagate error } ...
1b7025ad-ffe1-40ea-a856-0471fa4e3962
5
public void dispose() { if (disposed) return; disposed = true; charCache = null; bufferPixels = null; fontMetrics = null; Graphics2D gfx = bufferGraphics; if (gfx != null) { bufferGraphics = null; try { gfx.dispose(); } catch (Exception ex) { } } BufferedImage img = buffer; ...
ecb31cbb-56c2-44b7-8545-c5fc9e96fa87
7
public List<Employee> getTeamMembers(String managerId) { String uniqueUserSql = SELECT_MANAGER_TEAM_DETAIL + managerId + "'"; Connection connection = new DbConnection().getConnection(); List<Employee> teamMembers = new ArrayList<Employee>(); ResultSet resultSet = null; Statement statement = null; try { s...
ef4138ce-ef30-4e37-8961-ae3bc188643a
1
public void visit_iflt(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
efba9bde-73e7-4bd4-9aa1-467c410dff96
8
public void endRound() { int winnersInd = 0; numberOfRounds++; cardsPlayedInRound = 0; ItalianDeckCard winnersCard = currentStack[winnersInd]; int score = 0; for (int i = 0; i < currentStack.length; i++) { int comp = BriscaCardComparator.compare(winnersCard, currentStack[i], this.life.getSuit()); ...
6186c072-2351-457f-a665-c24db70507c2
4
@Test public void testTargetsAlongWalkways() { // Initialize lists of where everything should be. int[] targets4 = new int[] {307, 331, 333, 357, 381, 383, 405, 403, 429, 431, 455, 481, 457, 507, 483, 433, 409, 385, 411}; int[] targets3 = new int[] {190, 216, 242, 268, 196, 220, 170, 144, 118, 192, 168, 194, 218...
0bcfb672-8749-4c99-b7e2-7f0a3f6c5151
8
public void run() { try { // Wrapper for Threaded calling System.out.println(this.clsName+","+this.mtdName); Class<?> cls = Class.forName(this.clsName); System.out.println("Class is "+cls); Method[] mtds = cls.getMethods(); System.out.println("Methods are "+Arrays.deepToString(mtds)); Met...
aef6512b-cb19-41e2-9e91-7468431a369f
7
private boolean isIdentifier(char c) { return (c > 47 && c < 58) // Zahl || (c > 64 && c < 91) // Groß A-Z || (c > 96 && c < 123) // Klein a-z || (c == '_') || (c == '$'); // Sonderzeichen }
03c555b3-1358-44ab-8350-b8881a31c4ff
3
public void setFullNameFromTextField(String fullName) { String[] nameParts = fullName.split(" "); if (nameParts.length > 0) { Name.getInstance().setFirstName(nameParts[0]); if (nameParts.length > 1) { Name.getInstance().setMiddleName(nameParts[1]); for (int index = 2; index < nameParts.length; inde...
45d719a7-f549-4ada-b7a9-0a1342372f70
6
@RequestMapping("/home") public ModelAndView home(HttpServletRequest request) { HttpSession session = request.getSession(); String currRole = session.getAttribute("currRole").toString(); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spring-config.xml"); if(currRole.equals("studen...
972b380b-4fea-49bb-9c9c-3ea1874f7897
5
@Test public void canDetermineTheCellFitnessOfAGrid() { for (int sudokuPower = 1; sudokuPower < 10; sudokuPower++) { // all cells are valid but the first one for (int cellIndexX = 0, size = sudoku.getSudokuSize(); cellIndexX < size; cellIndexX++) { for (int cellIndex...
396481f6-efcf-4743-8589-6f0dcfca050f
0
public void setId(int id) { this.id = id; }
529029ca-8a19-49d1-b29d-74d827afeb33
6
public void update() { checkMove(); if (x == targetX) xa = 0; if (y == targetY) ya = 0; move(xa, ya); if ((x <= targetX + 5 && x >= targetX - 5) && (y <= targetY + 5 && y >= targetY - 5)) { checkHit(); this.removed = true; } }
5a7cf991-89a0-4c04-a923-6c9990255f22
7
public ArrayList<ArrayList<Move>> parseOpenings(){ ArrayList<ArrayList<Move>> allOpeningMoves = new ArrayList<ArrayList<Move>>(); List<PGNGame> games = null; BufferedReader reader = null; String pgn = ""; try { reader = new BufferedReader(new FileReader(db)); int j = 0; StringBuilder sb ...
2f7e8976-454c-49db-bc7a-29af38e155fe
8
public double evaluateSolution(String solutionFileName) { double score = 0.0; BufferedReader br = null; ArrayList<Double> locations = new ArrayList<Double>(); ArrayList<Boolean> validity = new ArrayList<Boolean>(); ArrayList<Boolean> flips = new ArrayList<Boolean>(); try { br = new Bu...
f26116a8-6322-448b-b16d-408e9bccae4f
1
public void setPos5(int val){ if (val == 1){p5 = true;} else { p5 = false; }}
34d18240-d179-4625-b46a-3f9d2cc8f35b
4
public static String formatSceond(long second) { long time = second / 1000; if(time < 86400 && time >= 3600 ) { long h = time / 3600; long m = (time - (h * 3600)) / 60; long s = time - h * 3600 - m * 60; return h + "时" + m + "分" + s + "秒"; } if(time < 3600 && time >= 60) { long m = time / 60; ...
9ee40674-f04d-4bbc-8811-3524b1552ccc
1
private static boolean createUser(){ Prints.printWithColor("YELLOW","Usuario: "); String user = rd.next(); if (searchUser(user) == null){ Prints.printWithColor("YELLOW","Contraseña: "); String pass = rd.next(); Prints.printWithColor("YELLOW...
04e381b3-353d-462a-ba87-28a609929c14
4
private static void rotateBilinear(int dd) { ImageData imageData = original.getImageData(); int[][] matrix = new int[imageData.height][imageData.width]; for (int i = 0; i < imageData.height; i++) { for (int j = 0; j < imageData.width; j++) { matrix[i][j] = imageData.getPixel(j, i); } } int[] pixel...
373dd5fe-ca46-4073-bb1a-92bcba3c27a3
2
private Vehicule rechercherVehicule(String immatriculation){ System.out.println("ModeleLocations::rechercherVehicule()") ; Vehicule vehicule = null ; for(Vehicule unVehicule : this.vehicules){ if(unVehicule.getImmatriculation().equals(immatriculation)){ vehicule = unVehicule ; } } return vehicule ; ...
4b51940c-c944-47d5-8682-488a4f3fd937
0
public DocumentInfo getDocumentInfo() { return this.docInfo; }
0321ab09-4ea6-41de-88db-fbeb884555cf
9
private void printData(Items providers){ for(Item provider : providers.getCloudProviders()){ System.out.println("PROVIDER: "+ provider.getName()); System.out.println(" - Category: "+ provider.getCategory()); System.out.println(" - license: "+ provider.getLicense()); System.out.println(" - monitor...
a72ca6b2-f445-4661-b0a1-40d7889beb10
1
public void merge(List<String> inputFileNames, String fileNameDestination) { try { xmlWriter.write(xmlReader.read(inputFileNames), fileNameDestination); } catch (IOException e) { logger.error("error occurred during merge", e); } }
76e8f535-d305-4145-9379-ac226e52eed8
1
@Override public String toString() { StringBuilder res = new StringBuilder(); for (Map.Entry e : stats.entrySet()){ res.append("<"); res.append(e.getKey()); res.append(" = "); res.append(e.getValue()); res.append(">"); } ret...
13c1c746-197a-41ec-802e-54b7ea45d66d
6
public GUI(){ JPanel panel = new JPanel(); JFrame _frame = new JFrame(); Board _board = new Board(); JTextArea _box = new JTextArea("Player 1 :"+" Score: "+" Player 2: "+" Score: "); JPanel board = new JPanel(); board.setLayout(new GridLayout(20,20)); panel.setLayout(new BorderLayo...
3a7f6963-0f62-4d21-a85f-b1d22fda8f8c
4
public int compareTo(Object other) { Location otherLoc = (Location) other; if (getRow() < otherLoc.getRow()) return -1; if (getRow() > otherLoc.getRow()) return 1; if (getCol() < otherLoc.getCol()) return -1; if (getCol() > otherLoc.getCol(...
ffaea2c1-4c83-4e53-a67e-dff94b940545
9
@Override public Node removeItem(int key) throws EmptyTreeException, KeyNotFoundException, InvalidTreeOperation { if (isEmpty()) throw new EmptyTreeException(); Node item = findItem(key); Node next = nextInorder(item); Node removedNode = null; if (item == null) throw new KeyNotFoundException("Key ...
cbc0183b-b117-4887-addd-60ac5650d0cb
0
public String getSector() { return addressCompany.getSector(); }
aee8c278-6f5a-4742-b5e9-c7e196ed12f9
1
@Override public void paintComponent( Graphics g ) { super.paintComponent( g ); if ( game_completed ) { Font font = new Font( "Cooper black", Font.BOLD, 14 ); g.setFont( font ); g.drawString( "Game completed!", 130, 130 ); } else { level.drawLe...
9cd14979-08b0-41ef-aeda-a7ca6bde0ce5
2
protected synchronized Runnable getTask() throws InterruptedException { while (taskQueue.size() == 0) { if (!isAlive) { return null; } wait(); } return (Runnable)taskQueue.removeFirst(); }
df4b0dbf-2f07-42b4-8efe-7ce90718a388
9
public void marshEffect(Player p){ int n = -1; int lb = 0; int ub = 3; bansheeDamage(); spectralCloakShield(p); String head; String textBlock; ArrayList<String> strList = new ArrayList<String>(); head = "Spectral Marsh"; if((p.inventory.contains(Card.gauntlet) || p.inventory.contains(Card.gauntletii...
26b307d7-3945-450b-b812-d47b09e1ac14
3
public static Account narrow (org.omg.CORBA.Object obj) { if (obj == null) return null; else if (obj instanceof Account) return (Account)obj; else if (!obj._is_a (id ())) throw new org.omg.CORBA.BAD_PARAM (); else { org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA...
47e50d17-fc95-4139-b38e-92c876a7415a
5
public void removeRegionRef(String id) { if (members != null) { GroupMember toRemove = null; for (Iterator<GroupMember> it = members.iterator(); it.hasNext(); ) { GroupMember member = it.next(); if (member instanceof RegionRef) { if (((RegionRef)member).getRegionId().equals(id)) { toRemove = ...
2cad62ef-ad90-436d-812c-7577b1285510
4
public static final int highNeighbour(int[] v, int x) { int min=Integer.MAX_VALUE, n=0; for(int i=0; i<v.length && i<x; i++) { if(v[i]<min && v[i]>v[x]) { min=v[i]; n=i; } } return n; }
f2be4651-8bba-4c5e-941e-4898dee2ea37
5
public boolean insert_Into_Inventory(Item item){ //is the item already in the inventory //is the stack size not full for(Slot slot : slots){ if(slot.getItem() == item && slot.getStack_Count() < item.getMax_Stack_Count()){ slot.setStack_Count(slot.getStack_Count()+1); return true; } } for(Slot sl...
88ca9e92-65d4-4ee1-a320-6a404190e182
8
public static void loadPlugin(File dir) throws SlickException, ClassNotFoundException, FileNotFoundException, IOException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException{ Class<Plugin> plugin = null; Properties properties...
1d23f6c9-a933-4bcb-a59d-97eacf88073f
9
@Override //assumes that there is nothing in the buffer from other stuff //make sure other methods accessing the streams //are also synchronized public void run() { PrintWriter out; InputStreamReader reader; while(true) { //wait until ONE client connects synchronized(monitor) { try { // S...
d5b9df60-4968-48ae-8913-732dc34da6bf
4
@EventHandler public void onCrazyMagicMove(PlayerMoveEvent pME) { Player player = pME.getPlayer(); if(CrazyFeet.CrazyMagic.contains(player)) { Location to = pME.getTo(); Location from = pME.getFrom(); Location loc = player.getLocation(); if(to.getX() != from.getBlockX() || to.getY() != fr...
a738808b-128b-4c81-9781-ddecb159aeb1
1
public static boolean printQuickCount(StringBuilder saveAsText) { String[] sections = saveAsText.toString().replaceAll("@", " ") .split(" "); StringBuilder build = new StringBuilder(); for (String s : sections) { build.append(" " + s.split("_").length); } // System.out.println(build); return build.to...
97a8dd28-8028-405d-8f82-37cb867e93bd
0
public CheckResultMessage checkSum1(int i,int j){ return checkReport1.checkSum1(i,j); }
445619c4-0026-4548-9e45-cfab7ef39a1f
4
@SuppressWarnings("unchecked") private void loadTheme() { try { final Class<? extends Theme> clazz = (Class<? extends Theme>) MCLauncher.class .getClassLoader().loadClass( config.getString("window.theme")); final Constructor...
53a38b5b-794d-42f6-8ca9-3e1cb259890a
9
@Override public boolean process(Player player) { if (ingredients == Ingredients.TORSTOL && otherItem.getId() != VIAL) { if (!player.getInventory().containsOneItem(15309) || !player.getInventory().containsOneItem(15313) || !player.getInventory().containsOneItem(15317) || !player.getInventory().cont...
87af52ea-c056-4917-8703-45869438a871
1
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("OK")) System.exit(0); }
95ed07a8-b88e-47dc-bd30-2d9ff9e8cc07
8
public void updateMouse() { nextMB = Mouse.isButtonDown(0) ; nextMP.x = Mouse.getX() ; nextMP.y = Mouse.getY() ; if (mouseB && (! nextMB)) { mouseState = HOVERED ; } if ((! mouseB) && nextMB) { mouseState = CLICKED ; dragMP.setTo(nextMP) ; } if (mouseB && nextMB &&...
899d7d81-b5ab-4628-a648-cd634b00aa38
5
public void paint(Graphics g) { //screen dimensions 296,45,298,217 g.drawImage(my_gif,0,0,this); if(track==99) { g.setFont(bigFont); g.drawString("Press Play",350,150); } if(track==0) { g.setFont(bigFont); g.drawImage(issues_cover,296,45,298,217,this); g.drawString("King of Amarillo"...
8ed22923-c999-423a-bca4-1dad6daf7a76
7
private void readyForTermination() { addKeyListener( new KeyAdapter() { public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if ((keyCode == KeyEvent.VK_ESCAPE) || (keyCode == KeyEvent.VK_Q) || (keyCode == KeyEvent.VK_END) || ((keyCode == KeyEvent.VK_C) && e...
24366f0d-0ca7-438a-a656-e60e8e88722b
8
static String toUnsignedHex8String(long pValue) { String s = Long.toString(pValue, 16); //force length to be eight characters if (s.length() == 0) {return "00000000" + s;} else if (s.length() == 1) {return "0000000" + s;} else if (s.length() == 2) {return "000000" + s;} else if (s...
5c3868ed-0083-42bc-a09f-a5fc23e6c3b7
8
public void filter(Set<Item> usedItems, boolean filterTransitions) { if (filterTransitions) { Set<Transition> removeTrans = new ShareableHashSet<Transition>(); Set<Transition> usedTrans = new ShareableHashSet<Transition>(); for (Transition t : transitions) { if (t.reverse.size() > 0) { // only derives...
94d77dd7-1c4a-4a24-b209-a6641aa9faee
1
public JScrollPane getGUI(){ JPanel p1=new JPanel(); getExam(); GroupLayout groupLayout=new GroupLayout(p1); groupLayout.setAutoCreateContainerGaps(true); groupLayout.setAutoCreateGaps(true); GroupLayout.ParallelGroup horizontalGroup_P = groupLayout.crea...
f7e6863e-3732-4ca7-af60-a54d52b9acf0
8
private boolean readFeed() { try { // Set header values intial to the empty string String title = ""; String link = ""; // First create a new XMLInputFactory XMLInputFactory inputFactory = XMLInputFactory.newInstance(); // Setup...
dfc052fe-ce75-426c-9c3d-78188d1acb74
0
public double getSpeedRpm() { return _speedSensor.getSpeedRpm(); }
b48cf1c0-fdcb-448a-b046-ff297718e95e
7
public static User getUserByXMLElem(XMLElement root) { String username = new String("Username Not Specified"); String password = new String("Password Not Set"); String url = new String("URL missing"); int permission = IS_NORMAL; if (root.attributeMap.containsKey("permission")) { String permissionStr = r...
ed295c85-6c48-4dec-9dd0-90fb4f0178e9
0
public String getClientId() { return clientId; }
bf69612f-8c74-4f74-b348-009c903baa1a
9
private void button3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button3ActionPerformed if (order1code4tf.getText().equals("1001")) { o1c4destf.setText("Chicken Nugget"); } if (order1code4tf.getText().equals("1002")) { o1c4de...
6ce8891a-dab3-4b02-8235-e2f757e25b01
2
public void cargarVentas() { try { String sql = "SELECT t1.idVentas AS id_venta, t2.nombre AS empleado, t1.precio_total " + "FROM ventas AS t1, empleados AS t2 " + "WHERE t1.empleados_idempleados = t2.idempleados"; Connection conn = Conexion.GetCon...
ccd140c9-7a5a-4667-a361-b1be854c64d6
1
private void writeInteger32ToByteArray(int value) { //byte[] intBytes = new byte[4]; //I allocated the this buffer globally so the GC has less work intBytes[3] = (byte)value; value >>>= 8; intBytes[2] = (byte)value; value >>>= 8; intBytes[1] = (byte)value; value >>>= 8; intBytes[0] = (byte)value; try { ...
30b3479e-b857-4663-af31-f75497bd61ba
9
@Override protected int processRecord (int recordCounter, byte[] recordData, short recordAttributes, int recordUniqueID) { // local vars int processResult = SUCCESS ; int relations = 0 ; String nodeTitle = null; int titleLength = 0 ; String nodeNote = null; int noteLength = 0 ; String nodeM...
a6f815e7-a610-4b56-b2b9-17755e4fffcc
7
private ArrayList<SequencePart> parseDomainParts(List<String> lines, String type) { ArrayList<SequencePart> ret = new ArrayList<SequencePart>(); for (String line : lines) { String fromStr = line.substring(15, 20).trim(); String toStr = line.substring(21, 27).trim(); if (fromStr.contains...
683696a2-f7ec-419c-9765-6db9b59d2751
3
private void gameInit(){ score1 = 0; score2 = 0; level = startingLevel; if (unlimitedLives){ if (isSinglePlayer){ player1 = new Player(screenWidth/2,screenHeight/2, 0,0,0,0,-1,0); player2 = null; }else{ player1 = new Player(screenWidth/4, screenHeight/2, 0,0,0,0,-1,0); player2 = new Player...
6fc65029-3f3c-405a-bde6-df21f1c866c3
2
public Produto Abrir(int id) throws ErroValidacaoException, Exception{ try{ PreparedStatement comando = bd.getConexao() .prepareStatement("SELECT * FROM produtos WHERE id = ? "); comando.setInt(1, id); ResultSet consulta = comando.executeQuery(); ...
fbf384a5-de6d-4a37-94c7-0f4d1fce7e56
8
public static void main(String[] arg) { try { JSch jsch = new JSch(); String host = null; if (arg.length > 0) { host = arg[0]; } else { host = JOptionPane.showInputDialog("Enter username@hostname", System.getProperty("user.name") + "@localhost"); } String user = host.substring(0, host...
59e3c502-0fc8-4353-8f23-b75087597350
0
public Read(){ this.path = Params.testFolder + this.separator; this.graf = new ArrayList<Long>(); }
7974aee0-cb49-4107-a2ae-7e668ea50686
4
@Override public void actionPerformed(ActionEvent e) { try { BmTestManager bmTestManager = BmTestManager.getInstance(); GuiPackage guiPackage = GuiPackage.getInstance(); if (Utils.isTestPlanEmpty()) { JMeterUtils.reportErrorToUser("Test-plan should have at...
353dc8cb-b234-4082-b9b1-f554c5afd366
4
private String lineStyle2Dot(Styles.LineStyle lineStyle) { switch (lineStyle) { case Dashed: return "dashed"; case Dotted: return "dotted"; case Bold: return "bold"; case Solid: default: r...
83745c89-9364-498f-9bb1-9847a656c79f
3
public synchronized void addMessage(String paramString) { if ((this.LastMessage == null) || (paramString.compareTo(this.LastMessage) != 0)) { this.LastMessage = paramString; TextContainer localTextContainer = new TextContainer(); localTextContainer.setPackedHeight(true); localTextCont...
cd4d5f9b-c111-4da2-9d5b-5ccdb4fb139a
3
private void printSequenceRecursive(int k, int n, int position, int[] array){ if(position == array.length){ System.out.println(Arrays.toString(array)); return; } int startingNumber; if(position == 0){ startingNumber = 1; } else{ startingNumber = array[position - 1] +1; } for(int i = st...
aec34cf6-946f-446e-bbe8-37e78f0e7b48
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final IndividualAgent other = (IndividualAgent) obj; if (this.id != other.id) { return false; ...
bc131850-2035-4f59-bcee-dd621182e5cc
5
private static JToolBar buildToolbar(Item[] items) { JToolBar bar = new JToolBar(); for (Item item : items) { if (item == Item.SEPARATOR) bar.add(new JToolBar.Separator()); else if (item.icon != null) { AbstractButton button = null; if (item.setting ...
86418b3b-baa1-488c-bea4-c311be0e4ca1
3
public boolean load() { FileInputStream is = null; File f = null; try { f = new File(FileLocation); is = new FileInputStream(f); } catch (FileNotFoundException e) { logger.info(e.getMessage() + ", creating new persistence file:" + f.getAbsolutePath());...
341ad6fb-1f92-4939-be2a-9945f9c02c35
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ClassMetadata other = (ClassMetadata) obj; if (qualifiedName == null) { if (other.qualifiedName != null) return false; } else if (!quali...
7e24cde9-6165-46b9-a52c-d8340516b769
1
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); Venue[] aVenue = Venue.findAll(); rtn.put("rtnCode", this.getRtnCode(200)); { JSONArray venueJa = new JSONArray(); for(int i=0; i<aVenue.length; i++) { venueJa.put(a...
778efae3-5c63-4fd8-929a-7718798cb444
3
private boolean HLIDRoundTripConversionTest(Object obj) { try { String apiId = null; if (obj instanceof String) { apiId = CompactHLIDConverter.converter().toCompactHLId((String) obj); } else if (obj instanceof Number) { apiId = CompactHLIDConverter.converter().toCompactHLId((Number...