method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
31fa9b8c-a752-407d-a6c0-95c6b297c02c
3
@Override public AuthorModel addAuthor(AuthorModel author) throws WebshopAppException { int generatedId = AuthorModel.DEFAULT_ID; if (isValidAuthor(author, "ADD_AUTHOR")) { try (Connection conn = getConnection()) { String sql = "INSERT INTO author (firstname, lastname, dob, country)" + "VALUES (?, ?,...
6dc1551c-357a-4351-a506-3365c4ac635a
8
@SuppressWarnings("rawtypes") public String getUsoDestinoMasArea() { // Si hay destinos cogemos el de mayor area if (destinos != null && !destinos.isEmpty()) { String destino = ""; double area = 0; Iterator<Entry<String, Double>> it = destinos.entrySet().iterator(); // Comparamos las areas de los de...
3f903e2a-4666-4b21-8594-522549db14cd
2
public boolean estaEmS(String transacao) { boolean res = false; for (String s : lockS) { if (s.equals(transacao)) { res = true; } } return res; }
76c140c9-e938-4baa-bf5d-ca98773e6dbf
1
public static void createTrees(ResearchScreen rs) { Collection<ResearchItem> items = Application.get().getLogic().getGame().getResearch().getRoots(); int indx = 0; for(ResearchItem ri : items) { createTree(rs, ri, 100+indx*180, 100); indx++; } }
51cf0848-4d63-4bc6-9b9d-a0fc32b4ba95
7
public static void commandMute(CommandSender sender, String player, String duration){ if (player == null || duration == null) { sender.sendMessage(Msg.$("mute-usage")); return; } int mute; try { mute = Integer.parseInt(dura...
2ce4579e-8083-4530-9a53-1602a4c809bf
7
private Boolean isPresent(String FileOrDirectoryName, Boolean includeProxy) { for(DistributedFile f: files) if(f.getFileName().equals(FileOrDirectoryName) ) return true; for(Directory d: childDirectories) if(d.getName().equals(FileOrDirectoryName)) return true; if(includeProxy) for(String s:...
6fc2297e-90cc-403e-a4e5-a8bfff2cf576
2
@Override public void add(CreditProgram element) { //Добавляем запись в список getList().add(element); Statement statement = null; ResultSet result = null; try { //Создаем изменяемую выборку statement = getConnection().createStatement(ResultSet.TYPE_S...
65918841-8600-4e98-b79a-c7bda17f20c0
4
public static boolean dragDraggable(final Draggable d, final int slot) { return d != null && (SlotData.getDraggableId(slot) == d.getId() || d.show() && dragChild(d.getChild(), slot) && new TimedCondition(700) { @Override public boolean isDone() { return d.getId() == SlotData.getDragga...
396511a7-7da5-482a-8c6a-6c450c03b94a
5
private final void method735(AbstractToolkit var_ha, Class72 class72_19_) { method738(var_ha); method732(var_ha); var_ha.getDimensions(anIntArray1226); var_ha.setDimensions(0, 0, anInt1220, anInt1220); var_ha.ya(); var_ha.drawQuad(0, 0, anInt1220, anInt1220, ~0xffffff | anInt1222, 0); int i = 0; int i_20_ = 0; ...
4f6ba1e0-874d-4845-a095-864fd859fd35
9
public boolean validarContato(Contato contato){ List<Contato> listaContatos = fachada.FachadaSistema.getInstance().listarContatos(); for (Contato contatoBusca : listaContatos) { if(contatoBusca.getNome().equals(contato.getNome())){ JOptionPane.showMessageDialog(null, "...
9cf64987-5dbe-4fd8-94cb-40704cdb29bc
1
public SampleBuffer(int sample_frequency, int number_of_channels) { buffer = new short[OBUFFERSIZE]; bufferp = new int[MAXCHANNELS]; channels = number_of_channels; frequency = sample_frequency; for (int i = 0; i < number_of_channels; ++i) bufferp[i] = (short)i; }
90c677e5-b725-4947-ab9e-e41a0ebea067
8
public Msg read() { if (!in_active || (state != State.active && state != State.pending)) return null; Msg msg_ = inpipe.read (); if (msg_ == null) { in_active = false; return null; } // If delimiter was read, start termination process o...
e284f509-035f-41b9-b31b-e053206d3b38
8
public String readCStr() throws IOException { boolean isAscii = true; // short circuit 1 byte strings _random[0] = read(); if (_random[0] == 0) { return ""; } _random[1] = read(); if (_random[1] == 0) { ...
f95944f4-0174-48dd-bf2f-57212ad9a478
6
public static void main(String[] args) { Scanner cal = new Scanner(System.in); System.out.println("Enter number of units for calculating the bill : \n"); double Bill = cal.nextDouble(); double B = 1; if (Bill < 100) { System.out.println("Calculated Bill is : $ " + B); } else if (Bill > 100 || B...
8f3abd30-bc7a-49e6-baa5-8f4b156230c8
8
public static <Z> Aggregator<Z> createAggregator(Class<?> returnType) throws AggregationException { if (returnType.equals(Integer.TYPE) || returnType.equals(Integer.class)) { return (Sum<Z>) new IntegerSum(); } else if (returnType.equals(Double.TYPE) || returnType.equals(Double.class)) { ...
c0fa4bfd-f7e7-43c8-8866-e7156a2ead28
5
public void setGridletStatus(int newStatus) throws Exception { // if the new status is same as current one, then ignore the rest if (status_ == newStatus) { return; } // throws an exception if the new status is outside the range if (newStatus < Gridlet.CREATED ||...
663573af-c41d-4aa4-9e80-c72e603395b1
7
@Override public void initialize(JSONObject dataMixinValue) throws JSONException, DataFormatException { JSONArray dataMixinArray = dataMixinValue.getJSONArray("mixins"); this.regularTileMixins = new RegularTileMixin[dataMixinArray.length()]; this.firstEventMixins = new FirstEventMixin[dataMixinArray.length()]...
51f37380-8707-440a-af27-4d1e9e98c285
6
private MemoryNode encontrarHojaDondeEstaQ(MemoryNode node, double[] q) throws IOException { comparaciones++; node.setVisitado(1); if (node.getLeft() == null || node.getRight() == null) { double distNueva = Math .sqrt((Math.pow((q[0] - node.getX()), 2) + Math.pow( (q[1] - node.getY()), 2))); dis...
55764680-ec50-45b2-9a02-93697311b75b
4
public double getStrength(ArrayList<Card> holeCards) throws Exception { if (holeCards.size() != 2) { throw new Exception("Not correct amount of hole cards"); } if (holeCards.get(0).sign == holeCards.get(1).sign) { // suited // in cause of a triangular matrix you have to look on the right sight if (holeCa...
f328a241-e3d3-493d-90f8-0929ddc40f18
3
public static void main(String[] args) { BLPSystem sys = new BLPSystem(); SecurityLevel low = SecurityLevel.low; SecurityLevel high = SecurityLevel.high; // We add two subjects, one high and one low. sys.createSubject("Lyle", low); sys.createSubject("Hal", high); ...
88a35849-6be0-4611-bfcc-b88a9de179c8
8
private static String initialise(Token currentToken, int[][] expectedTokenSequences, String[] tokenImage) { String eol = System.getProperty("line.separator", "\n"); StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expe...
26648957-bb4a-4e8f-aab0-f37781aa183b
7
private String useElementVariables(String s) { if (!(model instanceof AtomicModel)) return s; int lb = s.indexOf("%element["); int rb = s.indexOf("].", lb); int lb0 = -1; String v; int i; while (lb != -1 && rb != -1) { v = s.substring(lb + 9, rb); double x = parseMathExpression(v); if (Double....
e0fbf911-d763-42e0-8953-306e3e5d7948
7
Point3i adjustedTemporaryScreenPoint() { float z = (point3fScreenTemp.z - perspectiveOffset.z); if (z < cameraDistance) { if (Float.isNaN(point3fScreenTemp.z)) { // removed for extending pmesh to points and lines BH 2/25/06 if (!haveNotifiedNaN) Logger.debug("NaN seen in TransformPoint"); haveNo...
763cde11-322b-4ac3-bd8d-33890b379a9e
6
static public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextCol...
b321e1b9-76b4-4108-b997-6956e5a789b9
0
public static void addSuccessMessage(String msg) { FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg); }
9325ec48-99d9-4580-a9bd-11372c5e6412
2
public String login(String vCloudUrl, String username, String orgName, String password) throws Exception { String loginString = Utils.CLOUD_URL_PREFIX + vCloudUrl + Utils.CLOUD_URL_SUFFIX; String creds; if(username.contains("@")) { creds = username +":" + password; } else { creds = username + "@" + orgN...
4e5a77bf-2cd2-4578-8d60-b03edfdf0acd
3
public static void renderBlank(Graphics2D g, boolean blue) { try { SVGDiagram diagram = universe.getDiagram(ImageManager.class.getResource(urlBase + (blue ? "blue.svg" : "red.svg")).toURI()); diagram.setIgnoringClipHeuristic(true); diagram.render(g); } catch (URISynt...
eb4c537b-1798-4aa7-9c0a-34515a384088
3
public static void main(String[] args) { String path = System.getProperty("user.dir") + FILE_PATH; Dictionary dictionary = new Dictionary(path); System.out.println("initializing dictionary..."); dictionary.preprocess(); Scanner userInputScanner = new Scanner(System.in); S...
33e206ad-313c-4000-aa47-1780c8721752
0
public Piirtaja(Pelaaja pelaaja, Kamera kamera) { this.pelaaja = pelaaja; this.kamera = kamera; }
910b25b7-3fc0-42cc-bb4f-036ba31e0021
3
public VariableStack mapStackToLocal(VariableStack stack) { StructuredBlock[] subBlocks = getSubBlocks(); VariableStack after; if (subBlocks.length == 0) after = stack; else { after = null; for (int i = 0; i < subBlocks.length; i++) { after = VariableStack.merge(after, subBlocks[i].mapStackTo...
0806a589-0531-4182-8d4b-710cf359c54c
8
public static Book parseBook(String data) throws IOException { Book book = new Book(); try { String tokens[] = data.split("[=]|[\\{]|[\\}]|[,]"); if(data.indexOf("Book") != -1 || tokens.length > 0) { for( int i = 0; i < tokens.length ; i++) { ...
f461057d-8957-4017-b38f-eb6009903720
2
public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { MethodVisitor mv; if ("<clinit>".equals(name)) { int a = Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC; String n = prefix + counter++; mv = cv.visitMethod(a, n, desc, ...
f51f5368-f474-4887-a4ba-9cee1a718b7c
8
public void buildClassifier(Instances data) throws Exception{ //heuristic to avoid cross-validating the number of LogitBoost iterations //at every node: build standalone logistic model and take its optimum number //of iteration everywhere in the tree. if (m_fastRegression && (m_fixedNumIterations < 0)) m_fixedNum...
aaf737e4-47f4-4492-8419-104f09dae859
6
private static boolean addToZip(String absolutePath, String relativePath, String fileName, ZipOutputStream out) { File file = new File(absolutePath + File.separator + fileName); DebugUtils.info("Adding \"" + absolutePath + File.separator + fileName + "\" file"); if (file.isHidden()) return true; if...
bf70087b-ba98-4651-a2f9-0b1ae27bcd07
5
public static List<List<ICard>> getPrese(ICard card, List<ICard> tableCards){ List<List<ICard>> retPrese = new ArrayList<List<ICard>>(); //singola presa for(ICard c : tableCards) if(card.getNumber() == c.getNumber()) { ArrayList<ICard> spresa = new ArrayList<ICard>(); spresa.add(c); spresa.ad...
2f67913f-fe7e-417b-8cc6-d821a342833f
4
public static void main(String [] args) throws SocketException, NoSuchAlgorithmException { if(args.length < 2) { System.out.println("Invalid number of arguments to start server. Needs <port> <shared secret>"); return; } try { UDPServer server = new UDPServer(I...
3323f54e-14bc-49bb-873d-35b4e4a63d66
7
protected void saveBest() { try { if (runBestIndividual == null) throw new IOException("No run best individual"); List<Individual> bestIndividuals = new ArrayList<Individual>(); File inputFolder = new File("results/input"); File outputFolder = new File("results/output"); if (!input...
d8f11f89-064d-4aef-9a1e-9e9a1d87b044
3
public void actionPerformed(ActionEvent e) { if (e.getSource() == kilobutton) { kilotext.setEnabled(true); kbytes.enable(); } else { kilotext.setEnabled(false); kbytes.disable(); } if (e.getSource() == megabutton) { megatext.setEnabled(true); mbytes.enable(); } else { megatext.setE...
f4d02a88-db35-4885-8e27-6c4fe1d43441
2
public static JPanel makePanel(int orientation) { JPanel p = new JPanel(); switch (orientation) { case HORIZONTAL: p.setLayout(new GridLayout(1, 0)); break; case VERTICAL: p.setLayout(new GridLayout(0, 1)); break; default: break; } return p; }
93c1f24e-14d7-43ef-8dc9-b7ee9cee7c52
9
private static int method503(char ac[], char ac1[], int j) { if(j == 0) return 2; for(int k = j - 1; k >= 0; k--) { if(!method517(ac[k])) break; if(ac[k] == '@') return 3; } int l = 0; for(int i1 = j - 1; i1 >= 0; i1--) { if(!method517(ac1[i1])) break; if(ac1[i1] == '*') l...
448be902-e4c6-49f9-97f5-59d73fc0ceb9
6
public boolean getBoolean(int index) throws JSONException { Object object = get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean.TRUE)...
c5a8b4ef-9ef2-46be-a099-2be5484601e0
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Category other = (Category) obj; if (this.id != other.id && (this.id == null || !this.id.equals(other.id)...
b62e7c83-3643-4191-b89c-301211b09e62
6
private void loadCoffers(){ File cofferFile = new File(getDataFolder(),cofferFileName); if(!cofferFile.exists()){ logMessage("Coffer file does not exist"); return; } FileConfiguration config = YamlConfiguration.loadConfiguration(cofferFile); Iterator<String> citr = config.getConfigurationSection("c...
0468a499-df07-4441-8075-e6d1cf6290f4
6
private void logOutput() throws VehicleException, SimulationException, IOException { // reset text area logText.setText(""); Log log = new Log(); // update log if(valid()){ log.initialEntry(cp, s); for (int time=0; time<=Constants.CLOSING_TIME; time++) { //queue elements exceed max waiti...
1031ce93-bef1-46cc-8d6f-a03930089597
2
public ArrayList<String> readTestData() throws IOException{ ArrayList<String> candAttr = new ArrayList<String>(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); String str = ""; while (!(str = reader.readLine()).equals("")) { StringTokenizer tok...
220ef6e9-cc2f-4004-add4-4d43efe26d13
3
private long consumeCurrentToken() throws IOException { if( this.currentToken == null ) return -1L; byte[] buff = new byte[256]; int len; long totalLength = 0; if( !this.currentToken.isClosed() ) { while( (len = this.currentToken.read(buff)) > 0 ) totalLength += len; } this.currentToken.clos...
fda5892d-f24c-4057-9c47-93f3f6efb15e
6
private static void filterMapper(String realJvmCostDir, String mapperJvmCost, String filteredMapper) { File input = new File(realJvmCostDir + mapperJvmCost); File output = new File(realJvmCostDir + filteredMapper); if(!output.exists()) output.getParentFile().mkdirs(); try { BufferedReader reader ...
66960203-e6fe-40c9-aa11-d2fcd757a609
0
public Validator<T> getValidatorRHS() { return validatorRHS; }
407118c1-881b-40f0-b3d2-e027a073d863
8
public boolean setParallelJobProbabilities(int jobType, double uLow, double uMed, double uHi, double uProb) { if(jobType > BATCH_JOBS || jobType < INTERACTIVE_JOBS) { return false; } else if (uLow > uHi) { return false; } else if (uMed > uHi-1.5 || uMed < uHi-3.5) { return false;...
84b9f7d8-d3bf-40cf-9bf3-b8e2d6aa86cb
2
private StructureFile readRoot(Node root) throws SyntaxException { StructureFile structure = new StructureFile(); NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Element) readChunkDec(structure, (Element) chil...
0be32a17-f047-492d-bc4c-dad06de88173
0
void vouting(Object obj, final String userid) { vote.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { Map<String, Object> m = new HashMap<String, Object>(); m.put("action", "vote"); m.put("userfrom",View._model.user_id ); m.put("userto", userid )...
bb7b043d-6e52-41d5-af76-ba72cc5377bc
3
public Habitat getHabitatByTenant(String tenant) { for (Habitat h : getHabitats().values()) { if (h != null) if (h.getTenant().equalsIgnoreCase(tenant)) return h; } return null; }
4a787d41-6156-40a7-8dd9-bf71880400fc
9
public long uniquePathsWithObstacles(int[][] obstacleGrid) { int m = obstacleGrid.length; int n = obstacleGrid[0].length; if(m<1||n<1) return 0; if(m==1 && n==1) return obstacleGrid[0][0]^1; long count[][] = new long[m+1][n+1]; for(int i=0;i<=m;i++) count[i][0] = 0; for(int i=0;i<=n;i++) count[0][i] = 0; ...
f8516c5c-5a4a-473e-8993-81661a064c68
6
public boolean twoOpt555(){ int pathLength=tour.length(); boolean better=false; for(int currentVerticeIndex=0; currentVerticeIndex<pathLength;currentVerticeIndex++){ int nextVerticeIndex=(currentVerticeIndex+1)%pathLength; //skip the current and the nextVerticeIndex int toVerticeIndex=(currentVerticeI...
fad2756e-96ad-4863-a44f-cdba0fc567f8
4
public void removeWalls(int wallsToRemove){ ArrayList<MazeNode> walls = new ArrayList<MazeNode>(); for(int row = 1; row < this.rows - 1; row++){ for(int column = 1; column < this.columns - 1; column++){ if(getNode(column, row).isWall()){ walls.add(getNode(column, row)); } } } Collections.shuf...
22f2a2a3-d1ad-466b-abdf-cddcc6bafd21
8
private static List<SubFileParser> getCompletedWorkers( File rdpFile, int numCPUs) throws Exception { BlockingQueue<String> blockingQueue = new LinkedBlockingQueue<String>(); List<SubFileParser> subList = new ArrayList<SubFileParser>(); int numAdded = 0; List<Thread> startedThreads = new ArrayList<Thread>();...
adec0da9-3339-453e-bc70-a30d7effdcab
0
public void setPassword(String password) { this.password = password; }
4a96c1ab-5a54-4a01-b1a8-5f107a858c87
2
private void renewASL(){ ASL_model.removeAllElements(); for (int i = 0; i<logAc.getDoctorSize(); i++){ ASL_model.add(i, logAc.getDoctor(i).getName()); } ASL_adminmodel.removeAllElements(); for (int i = 0; i<logAc.getAdminSize(); i++){ ASL_adminmodel.add(i, logAc.getAdmin(i).getName()); } ASR_doctor....
7dffa6b6-70b1-493b-833f-eeb4ea639cb6
5
void loadTile(String[] split) { setExplored(Boolean.valueOf(split[1])); setTilehealth(Integer.valueOf(split[2])); if(!split[3].equals("null")) setDesignate(TaskEnum.valueOf(split[3])); setActualTask(Integer.valueOf(split[4])); /* * TODO: split[5] creat...
ee9c6267-b995-4e97-9b70-76930489c86a
7
public Map<String, List<Map<String, String>>> readLocators(List<String> locAppIDs){ Map<String, List<Map<String, String>>> locatorSets= new LinkedHashMap<String, List<Map<String, String>>>(); if(locAppIDs.size()>0){ EnvironmentVariables ev = EnvironmentVariables.getInstance(); for (String appID : locAppIDs) {...
34dacc55-4ecb-4a7d-b139-f9e6ce779415
3
public void actionPerformed(ActionEvent e) { Grammar g = environment.getGrammar(UnrestrictedGrammar.class); myGrammar=g; if (g == null) return; if (g.getTerminals().length==0) { JOptionPane.showMessageDialog(environment, "Error : This grammar does not accept any Strings. ", "Cannot Proceed wit...
376d4651-c522-4858-9072-2cd3beddfc09
8
public void analyzeShots(RoomAnalysis ra) { double closest_shot_distance2 = Double.MAX_VALUE; for (Shot shot : current_room.getShots()) { double shot_distance2 = MapUtils.distance2(bound_object, shot); if (shot.getType().equals(ObjectType.MegaMissile) && MapUtils.distance2(bound_object...
8df5f42a-01d8-450c-914a-2c612239097e
3
@Override public boolean remove(int codigo) { boolean status = false; Connection con = null; PreparedStatement pstm = null; try{ con = ConnectionFactory.getConnection(); pstm = con.prepareStatement(REMOVE); pstm.setInt(1, codigo); pstm....
56d0e076-858e-4a83-94e2-965c6e979d3e
8
private void graphToPS(File psOutputFile, Rectangle boundingBox, PositionTransformation pt){ EPSOutputPrintStream pw = null; try { pw = new EPSOutputPrintStream(psOutputFile); } catch (FileNotFoundException e) { Main.minorError("Could not open the file to write the ps to."); } pw.setBoundingBox((i...
a0d1cd1a-9e4e-4790-8ca5-dcbcc3030d70
9
public static void main(String[] args) { //首先获取一个path Path path = FileSystems.getDefault().getPath("D:/a.txt"); final ByteBuffer byteBuffer = ByteBuffer.allocate(1024); //打开一个通道 try(AsynchronousFileChannel fileChannel = AsynchronousFileChannel.open(path, StandardOpenOption.READ, ...
1140ed34-78f1-419c-9b3c-10d45e2a4869
4
public Card getNextUntappedPerm(String permName, Player controller) { for (Card perm : this.permanents) { if (perm.getName().equals(permName) && perm.getController().equals(controller) && !perm.isTapped()) { return perm; } } return null; }
1f7df96a-0e17-4354-823b-ca32e61988ad
9
private void populateFilters() { //Populate gym filter getGyms().clear(); //get all gyms Iterable<Entry> gymResultSet = MongoHelper.query("{id:{$gte:0}}", Gym.class, "gyms"); if (gymResultSet != null) { //Iterate through gyms matching query for (Entry en...
3ffcd849-6e82-4363-af4d-ca41b7efdb81
3
public void drawStateLabel(Graphics g, State state, Point point, Color color) { String[] labels = state.getLabels(); if (labels.length == 0) return; int ascent = g.getFontMetrics().getAscent(); int heights = 0; int textWidth = 0; for (int i = 0; i < labels.length; i++) { Rectangle2D bounds = g.getFo...
3347fa4e-6ffd-461d-9d0d-20feab6c2674
1
public String getOptions(Request request) { try { return String.join(",", getRoutesMap(request).get(request.getURI()).keySet()); } catch (NullPointerException e) { return "GET"; } }
9ae2ca84-91c5-49dd-9027-1feb7a11c88f
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if(getValueAt(0, column)==null) return String.class; returnValue = getValueAt(0, column).getClass(); ...
b13688f8-9905-4233-b0a3-b27fdf5712a5
5
public void menuTextSym() { int choice; do { System.out.println("\n"); System.out.println("Text Cryption Menu"); System.out.println("Select Symmetric Cryption Methode"); System.out.println("---------------------------------\n"); System.out.pri...
5ad08120-cf27-4133-829c-8bb0a1954f0e
9
protected void spawnLettersNEW_OLD(int amount) { char[] randomCharacters = new char[amount]; char temp; int generatedVowels; int bonusVowels; final int MINIMUM_VOWELS = 6; // (6 for 40%) bonusVowels = rand.nextInt(((2 - 0) + 1) + 0); bonusVowels--; // TODO: this is lame, just fix it by fixin...
d41ed5fe-6bb8-4b74-a5f7-a4ba2fe56698
7
@SuppressWarnings("unchecked") private T createEntity(T entity) { try { return (T) entity.getClass() .getConstructor(new Class<?>[] { entity.getClass() }) .newInstance(entity); } catch (IllegalArgumentException e) { e.printStackTrace()...
cd1507bc-f5f7-4e7a-be58-9e82a1bdfef9
1
Object value() { return (idx == null) ? val : Util.accessArray(name, val, idx); }
eca116d5-fdc0-4527-8f37-6fe038292ebd
0
public void setFirst(T newValue) { first = newValue; }
45d6bb2a-65d0-40d8-9a55-9a5e6527e30b
6
public void setImgPath_SliderArrowUp(Path img, Imagetype type) { switch (type) { case DEFAULT: this.imgSliderArrowUp_Def = handleImage(img, UIResNumbers.SLIDER_UP_DEF.getNum()); if (this.imgSliderArrowUp_Def == null) { this.imgSliderArrowUp_Def = U...
e9fdf30e-7f0a-4e7a-990c-d0c3ccb48a14
8
private void updateRankCap(String Rank, String RankCap, JComboBox rankcapComboBox) { oldRankCap = RankCap; rankcapComboBox.setActionCommand("other"); rankcapComboBox.removeItem("12"); rankcapComboBox.removeItem("11"); rankcapComboBox.removeItem("10"); rankcapComboBox.removeItem("9"); rankcapComboBox.re...
271e3bf5-3bd4-4ec4-a83c-2ee8a79cef78
7
public void visitFrame( final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLoca...
5376c961-7be2-4fa6-b306-1c2b012e7d3a
7
public void transferHeadFiles(BufferedReader consoleInput) throws IOException { directory.setWorkingDir(ProjectDirectory); if (HEAD != null) { for(int i=0; i<HEAD.files.size(); i++) { String headpath = HeadFilesDirectory + File.separator + HEAD.files.get(i); String projectpath = ProjectDirectory + File.s...
174dda15-82b8-4924-9141-a9b079c58c8b
9
public String getEnding(Number aNumber, Case aCase) { //Exception for Dat/Abl/Loc pl for filia/dea if ( (getStem().equalsIgnoreCase("fili") || getStem().equalsIgnoreCase("de") || getStem().equalsIgnoreCase("lup") || getStem().equalsIgnoreCase("equ") || getStem().equalsIgnoreCase("simi")) && (aCase == No...
51b8f47f-4992-4e6d-a3c2-cf19b3ebd8bb
1
public void upkeep(){ for(Creature c : p1.getCritters()) c.setSumSick(false); }
918f4e71-9d11-41eb-9055-451235770558
5
private void check_connection(){ Statement stmt; ResultSet mysql_result; try{ //Execute Query stmt = mysql_connection.createStatement(); mysql_result = stmt.executeQuery("SELECT 1 from DUAL WHERE 1=0"); mysql_result.close(); } cat...
4c88af9d-0221-4cb9-9317-ea4a1cd53c90
8
void output( int code, OutputStream outs ) throws IOException { cur_accum &= masks[cur_bits]; if ( cur_bits > 0 ) cur_accum |= ( code << cur_bits ); else cur_accum = code; cur_bits += n_bits; while ( cur_bits >= 8 ) ...
82cb15d9-514e-40eb-96b5-edc2aefc9d6f
3
private void btnFinalizarPagaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarPagaActionPerformed if(JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0){ try{ Pagamento paga = new Pagamento(); //Setando os...
e4aeca63-3f86-4496-8d14-2167bd9f3a00
3
public T getRandomObject(Random rand) { if(!list.isEmpty()) { int r = rand.nextInt(totalWeight); Iterator<WeightEntry> i = list.iterator(); while(i.hasNext()) { WeightEntry e = i.next(); if(e.inRange(r)) { return e.getObject(); } } } return null; }
23d49524-d68d-41cd-93fd-2494d6bfbffd
2
public static void decodeToFile(String dataToDecode, String filename) throws java.io.IOException { Base64.OutputStream bos = null; try { bos = new Base64.OutputStream( new java.io.FileOutputStream(filename), Base64.DECODE); bos.write(dataToDecode.getBytes(PREFERRED_ENCODING)); } catch (java.io.IOEx...
61fd4987-da78-4ef4-abcd-76894ab8e422
0
public String toCSV() { return super.toCSV(); }
3663e8f6-7c51-4475-bd0d-e4911e927120
3
@Override public void run() { //timer long lastTime; lastTime = System.nanoTime(); long timer; timer = System.currentTimeMillis(); final double ns; ns = 1000000000.0 / 60.0; double delta; delta = 0; //ups & fps counter int ...
631f7bcf-5d8b-4e1c-8efc-0dde6d84038a
1
public static void main(String args[]) { /* System.out.println(newLine + "Queue in Java" + newLine); System.out.println("-----------------------" + newLine); System.out.println("Adding items to the Queue" + newLine); //Creating queue would require you to create instannce of LinkedList...
b490a424-199b-4e28-a443-159f9b999086
9
public static void performTests(PrintWriter reporter) { StudentMaster sm = new StudentMaster("Doug"); Student s = new Student("Doug"); for (int i = 0; i < 101; i++) { s.addExamGrade(79.9); sm.addExamGrade(79.9); } reporter.print(sm.equals(s)); sm = new StudentMaster("Doug"); s = new Student("Doug...
3412a3f4-33b8-4190-a302-31c1f1adf655
2
public boolean hasWhitelistBypassPermission() { return this.whitelistByPassPermission != null && !this.whitelistByPassPermission.equals("*") && !this.whitelistByPassPermission.equals(""); }
50270189-6f38-46ea-a0e0-67a53e5a2978
8
public boolean isSymmetric(TreeNode root) { if (root == null) return true; if (root.left == null && root.right == null) return true; if (root.left == null || root.right == null) return false; if (root.left.val != root.right.val) return false; TreeNode node = new TreeNode(0); node.left = root....
bfde7637-3172-4613-b4be-7ab811d3a3d7
0
void show(){ }
9f2e2883-1df3-4ec8-ba47-178fc7e849b2
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...
2296fa70-2ee7-44d9-8a5f-a815f386da88
8
protected LinkedHashMap<Pattern, String> load(File propertyFile) { LinkedHashMap<Pattern, String> result = new LinkedHashMap<Pattern, String>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader( new FileInputStream(propertyFile...
9a9a1ca8-21ca-4184-9558-da79e3c9f2f2
9
public void tfidfFromFile(String queryPath) throws FileNotFoundException{ Scanner sc = new Scanner(new BufferedReader(new FileReader(queryPath))); String line = sc.nextLine(); // Get Name and Text of document contents = line.toString().split("\\s+",2); words = contents[1].split("\\s+"); // Process f...
92ccfc1a-85d6-4a70-9e70-307b0c95baa0
2
@Override public Properties getOutputProperties(){ Properties properties = new Properties(); properties.put(NAME,getName()); properties.put(DATE,Utils.toString(date)); properties.put(AMOUNT, amount.toString()); properties.put(COMMUNICATION, communication); if(counterP...
49d46458-5cb6-4ecc-971e-40ed0650c339
8
public static /*@pure@*/ int[] stableSort(double[] array){ int[] index = new int[array.length]; int[] newIndex = new int[array.length]; int[] helpIndex; int numEqual; array = (double[])array.clone(); for (int i = 0; i < index.length; i++) { index[i] = i; if (Double.isNaN(array[...
deba5bc1-5884-44e4-bf9c-7dd397a7e42e
9
@Override public Integer value(final Matrix<TypeOfValue> matrix) { int column = this._column; int lowRow = this._lowerRowBound; int highRow = this._upperRowBound; Operator<TypeOfValue, TypeOfValue, Boolean> comparer = this._comparer; if (highRow < lowRow) throw ne...
d7af586f-66da-49ac-b5f8-8c8f839c22ae
2
@Override public boolean isNotebookCorrect(Notebook memory) { boolean isCorrect = true; int numTestsSoFar = 0; while (isCorrect && numTestsSoFar < numTests) { final NotebookTester notebookTester = notebookTesterFactory.produceNotebookTester(); isCorrect &= notebookTes...