method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
8bcca3b1-333c-411f-a09a-fb0423631ff8
6
private void makeChoice() { choice = ""; //Now, this will handle actual string 'rock' 'paper' 'scissors' //Make it as robust as it needs to be. For now... //Exit while loop by making it a 0 1 or 2 while (choice.equals("")) { System.out.println("Choose Rock, Paper, Scissors, Help, or Show Score (R,...
e04ee4f8-2985-4783-838b-8c2dbf801fae
8
public HmmModel train(Corpus trainset, String observationFeatureLabel, String stateFeatureLabel, String defaultStateLabel) throws DatasetException, HmmException { this.observationFeature = trainset .getFeatureIndex(observationFeatureLabel); if (observationFeature < 0) throw new DatasetException("Obser...
7fc34170-ab38-4ff7-a2d2-f445a4ecc050
1
@Test public void enrollementStudentInActivityTest() { Student s = null; Activity a = null; try { s = familyService.findStudent(1); a = activityService.find(1); } catch (InstanceNotFoundException e) { fail("Activity not exists"); } activityService.enrollmentStudentInActivity(s, a); assertTrue("S...
25b86bfa-43e7-413c-8acc-78d67489aacb
8
protected void performMeltdown() { final int safety = 1 + structure.upgradeLevel(FUSION_CONFINEMENT) ; // // Pollute the surroundings but cut back the meltdown somewhat- float radiationVal = (125 / safety) - 25 ; radiationVal *= meltdown * Rand.avgNums(3) * 2 ; // // TODO: You need some m...
41aba541-8289-461e-b6c1-3632f99fb686
0
public CheckResultMessage check3(int day) { return checkReport.check3(day); }
bb125f8e-2358-4138-94b2-37a3e7520671
8
@SuppressWarnings("unchecked") private void removeBlankWires(List<Gate> gates){ // false means blank boolean[] blankWires = circuitParser.getBlankWires(); int numberOfWires = circuitParser.getNumberOfWires(); // Runs from top to bottom, decrementing the appropriate wires // Is a bit funky since we cannot g...
8d456645-750a-478c-8818-915988c24282
6
public static String fastBlobEncrypt(String msg, SecretKey secretKey) { if (cipherer == null) { try { cipherer = Cipher.getInstance("DESede"); } catch (Throwable t) { t.printStackTrace(); } } String clearText = msg; byte[] clearTextBytes = null; try { clearTextBytes = clearText.getBytes("U...
0351eaa5-6903-4d21-b6c7-f0fa37bab6b2
6
public String readAndVerifyMessage() { byte[] message = null; byte[] signature = null; byte[] pubKeyEnc = null; try { // die Datei wird geoeffnet und die Daten gelesen DataInputStream is = new DataInputStream(new FileInputStream( fileName)); ...
4ca6433b-648f-4829-a6eb-166a047783ed
7
@Override public void run() { DatagramSocket socket = null; try { Logger.getInstance().log("ADV-REC","start scanning"); long endTime = new Date().getTime() + time; try { socket = new DatagramSocket(new InetSocketAddress("255.255.255.255", port)); ...
80059775-13d9-4e3b-b171-623105f61f4a
5
private int addPepperSaltNoise(int pixel, Random random) { int v = pixel; double sp = this.getSaltProbability() * 100; double pp = this.getPepperProbability() * 100; if (100 * Math.random() < sp + pp) {// Only 20% of opportunities. boolean inRange = false; double spp = 100 * sp / (sp + pp);// actual perce...
0899da59-c144-4bc4-8129-527b241a7199
2
public static ConnectionDirectionEnumeration fromValue(String v) { for (ConnectionDirectionEnumeration c: ConnectionDirectionEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
3d14267a-38e5-465c-85ce-d21e8f1e8622
9
@Test public void testCreateMass() { for (int i = -50; i < 50; i++) { double min = (i < 0 ? 4 : 2) * i; double max = (i < 0 ? 2 : 4) * i; grammar.getMassCreations().put("A", new Range(min, max)); developer.currentPoint = shoulder; Mass created = de...
b91e22ad-15bb-41f6-8cb0-bbd242a53639
0
public static void main(String[] args) { // Error - static method //this; Leaf x = new Leaf(); x.increment().increment().increment().print(); }
cba45c17-be55-492b-ba7b-520d8f106131
0
@Override public void requestFocus() {}
6873ef69-4725-4840-a7df-90163d98aee1
1
public void render(Graphics2D graphics) { graphics.setColor(Color.BLACK); graphics.drawRect(screenX, screenY, 13, 13); graphics.setColor(alive ? Color.GRAY : Color.LIGHT_GRAY); graphics.fillRect(screenX + 1, screenY + 1, 12, 12); }
13ec8b18-1d81-4009-b88b-ee0493f01a79
1
private void loop() throws Exception { buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL); Canvas canvas=buffer.enableGLCanvasRenderer(); buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE); frame.add(canvas); while (frame.isShowing()) { box.rotateY(0.01f); buffer.clear(java.awt.Color....
f380fbcc-45b6-41fb-b0a1-79bc8251b93e
7
public String gravarProduto (int id, String nome, String marca,String tipo,String armazenamento, double quantidade, Date validade){ String reposta = ""; System.out.println ("Iniciando a inserção de produtos"); if (!nome.equals(null) || !marca.equals(null)|| !tipo.equals(null) || !armazenamento.eq...
dab0ccde-04d3-416c-99ea-a2a733d08122
5
private boolean r_i_verb_suffix() { int among_var; int v_1; int v_2; // setlimit, line 163 v_1 = limit - cursor; // tomark, line 163 if (cursor < I_pV) { return false; } cursor = I_pV;...
be8be820-95c3-471e-818e-aa349c6e7f58
5
final int[][] method3047(int i, int i_0_) { anInt9407++; if (i_0_ != -1564599039) return null; int[][] is = ((Class348_Sub40) this).aClass322_7033.method2557(-111, i); if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) { int i_1_ = Class348_Sub40_Sub6.anInt9139 / anInt9405; in...
5d189599-a875-464f-8d55-43c791fcdbfa
0
protected static String getDate() { return DATE_FORMATTER.format(new Date(System.currentTimeMillis())); }
3202dfda-8a50-4a0a-ade4-25006762803d
3
public String getExportFileFormatNameForExtension(String extension) { String lowerCaseExtension = extension.toLowerCase(); for (int i = 0, limit = exporters.size(); i < limit; i++) { SaveFileFormat format = (SaveFileFormat) exporters.get(i); if (format.extensionExists(lowerCaseExtension)) { return (String...
f9b2c2bd-8d6e-4bd9-96d9-d02b9fc2fd58
3
public int read(InputStream in) throws IOException { /* RIFF header */ readId( in, "RIFF" ); @SuppressWarnings("unused") int numBytes = readInt( in ) - 36; readId( in, "WAVE" ); /* fmt chunk */ readId( in, "fmt " ); if ( 16 != readInt( in ) ) { throw new IOException( "fmt chunk length not 16" ...
dd7e8bf9-2336-4ae3-a77c-f65f6bb0a5af
0
public int getDepartmentId() { return departmentId; }
068d5f37-79bd-41fa-8861-55605f6661cb
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...
faa2bae6-dc4a-4499-8404-418235e746b0
3
private String getNodeName(JsonNode n){ if(null == n) return "null"; if(!n.isContainerNode() || n.isArray()) return "Not a container"; Iterator<String> it = n.fieldNames(); return it.next(); }
3d1d6e0d-6110-4305-a352-94efe69afb99
1
public treeNode getLeftMostNode(treeNode curRoot) { if (curRoot.leftLeaf == null) return curRoot; return this.getLeftMostNode(curRoot.leftLeaf); }
556a4e21-adb7-4202-9d4b-4a6a75f3e82c
6
@Override public void keyTyped(KeyEvent e) { switch (e.getKeyChar()) { case 's': case 'S': getScreen().shoot(propulsion); break; case 'w': case 'W': getScreen().selectNextWeapon(); break; case '+': propulsion = Math.min(MAX_PROPULSION, propulsion + PROPULSION_STEP); break; case '-': ...
b139e245-3122-4e2f-aeef-edc278ef3d59
3
public void update() { Vector3f directionToCamera = Transform.getCamera().getPos().sub(transform.getTranslation()); float angleToFaceTheCamera = (float)Math.toDegrees(Math.atan(directionToCamera.getZ() / directionToCamera.getX())); if(directionToCamera.getX() < 0) angleToFaceTh...
e053bae6-cd5d-4f92-8a03-a5718b97293f
1
public void run() { Matrix m; try { m = new Matrix(3,4); } catch(Matrix.MatrixError e) { System.out.println("Matrix dimensions set badly."); return; } m.setElement(2,3,-10); m.setRow(1, "66666,777777,8888888"); m.setColumn(0, "2...
97b8d8a9-cfe6-4ab5-98f7-0d38d1b089a8
4
public static final void exampleNartManipulations() { System.out.println("Starting Cyc NART examples."); try { CycConstant cycAdministrator = access.getKnownConstantByName("CycAdministrator"); CycConstant generalCycKE = access.getKnownConstantByName("GeneralCycKE"); access.setCyclist(cycAdmini...
97dee993-b286-4b4d-aaa5-41821a4113e3
7
public void setCreatorApplication(Document doc) { NodeList tempL = doc.getElementsByTagName("Header"); Node header = tempL.item(0); if (header.getNodeType() == Node.ELEMENT_NODE) { NodeList appL = ((Element)header).getElementsByTagName("Application"); if (appL.getLength() > 0) { Node app...
1025c3e7-766e-4eee-8047-86aed08b9b44
0
public String getContactMovil() { return contactMovil; }
19b1a2ee-9a1c-45fa-9a32-04dd51800285
1
public void execute(MinersSon son){ son.increaseFun(); System.out.println(son.getName() + " Playin' outside!"); if (son.fun()) { son.getFSM().changeState(DoChores.getSingleton()); } }
606ad2d4-96d0-474f-bbb7-60be3365d1f1
0
public void setConsumerKey(String consumerKey) { this.consumerKey = consumerKey; }
11866c02-42b1-462e-a266-1407da5b2579
1
public void clear() { for (int i = 0; i < size; i++) { attributeLists[i] = null; } size = 0; }
c55d8b68-e908-4096-9cd6-fa4ef6e3fe98
7
private void save() throws UnknownHostException { if (!info.isEmpty()) { DB db = Mongo.connect(new DBAddress(conf.getDisHost(), conf.getDisMongoDBName())); DBCollection coll = db.getCollection(conf.getDisMongoCollectionName()); DBObject obj = new BasicDBObject("uid", id); ...
d7cacbb1-85dd-461f-953b-9081b77cf886
4
private boolean hasEveryTeleporterPositionOnlyOneTeleporter(Grid grid) { List<Teleporter> teleporters = getTeleportersOfGrid(grid); for (Teleporter teleport : teleporters) { final Position tpPos = grid.getElementPosition(teleport); for (Element e : grid.getElementsOnPosition(tpPos)) if (e instanceo...
99acddfd-8928-4356-afe2-5271ddb76501
7
public static Set<String> decode(String prefix, String code) { Set<String> set = new HashSet<String>(); if (code.length() == 0) { set.add(prefix); return set; } if (code.charAt(0) == '0') return set; set.addAll(decode(prefix + (char) (code.charAt(0) - '1' + 'a'), code.substring(1))); if (code...
1589db88-3eed-4d5b-82e6-f59ceddfe239
3
public static ArrayList<String> readDiscsForUser(String username) { LOGGER.log(Level.INFO, "Loading discs for user '" + username + "'"); ArrayList<String> discNames = new ArrayList<String>(); try { BufferedReader reader = new BufferedReader(new FileReader("bags/" + username + "/bag.txt")); while(reader.read...
90edd2e8-0e57-4f8d-82e4-68ffd00907cd
6
public static int findLIS(int[] input) { int[] lis = new int[input.length]; int maxLength = Integer.MIN_VALUE; for( int i = 0; i< input.length; i++) { lis[i] = 1; } for( int i = 0; i< input.length; i++) { //compare with all elements on left of it, pick the eleme...
3a4416f8-2a11-4caa-8a95-5b1d5a295554
2
@Override protected final AbstractContentHandler getContentHandler() { try { return handlerClazz.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return null; }
ae41ba32-8d72-4ebb-b95a-5c30c3c17863
4
public static void main(String[] argv) throws IOException { File folder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/entraining/"); File femalefolder = new File("/home/dharmesh/aditya/author_profiling/pan_author_profiling_training_data/enseparate/enfemale/"); F...
e293a86c-1a8e-48e4-be03-d3c1b7b16a36
4
@Override public void visitInvokeDynamicInsn(final String name, final String desc, final Handle bsm, final Object... bsmArgs) { Item i = cw.newInvokeDynamicItem(name, desc, bsm, bsmArgs); int argSize = i.intVal; // Label currentBlock = this.currentBlock; if (currentBlock ...
98a3a8a6-d1a2-41e5-ae33-2b1926d190a7
5
public static String web(String url) throws IOException { BufferedReader bis = null; InputStream is = null; try { URLConnection connection = new URL(url).openConnection(); connection.setRequestProperty("Cookie", cookie); Random random = new Random(); connection.setRequestProperty("x-forwarded-for", ...
f68726d3-6500-4a02-bd31-d26c69716b14
5
private boolean versionCheck() { final String title = this.versionName; if (this.type != UpdateType.NO_VERSION_CHECK) { final String localVersion = this.plugin.getDescription().getVersion(); if (title.split(DELIMETER).length == 2) { // Get the newest file's versio...
c702abb9-0253-40c3-890a-1748b2855189
1
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { computeSVUID = (access & Opcodes.ACC_INTERFACE) == 0; if (computeSVUID) { this.name = name; this.access = access; this.interfaces = interfaces; } ...
e7977837-01eb-4a86-8191-15a45d53ccca
4
public static double binaryShannonEntropy(double p) { if (p > 1.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be less than or equal to 1"); if (p < 0.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be greater than or equal to 0"); double entropy = 0.0D; if (p > ...
6646a20c-186d-4620-8820-92801998eab4
9
public static void newGame(){ String decodedPath = ""; try { decodedPath = URLDecoder.decode(path, "UTF-8"); decodedPath = decodedPath.substring(0, decodedPath.lastIndexOf("/") + 1); } catch (UnsupportedEncodingException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } System.out....
96535d0a-9aa0-4f92-9aac-81beb55dc12b
8
public int maximalRectangle(char[][] matrix) { if (matrix == null || matrix.length == 0) return 0; int[][] A = new int[matrix.length][matrix[0].length]; for (int i = 0; i < matrix[0].length; i++) A[0][i] = matrix[0][i] == '1' ? 1 : 0; for (int i = 1; i < matrix.le...
f9c81eef-6400-466d-b3bd-05ae9a5ff868
0
public BigDecimal a() { return a; }
6529af31-25d4-4e78-8d8c-60fc735e1594
4
public boolean isItemAFruit(ItemStack is) { boolean flag = false; if(is != null) { if(is.getType().isEdible()) { if(is.getItemMeta().getLore() != null) { if(is.getItemMeta().getLore().get(0).contains("Fruit")); { flag = true; } } } } return flag; }
3578a5ba-47c6-4f56-b943-53ba51f628d4
8
public void putAll( Map<? extends Float, ? extends V> map ) { Iterator<? extends Entry<? extends Float,? extends V>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Float,? extends V> e = it.next(); this.put( e.getKey(), e.getValue() ); ...
b1de6893-8563-464b-84e3-a1a1e66ac912
5
public void mouseReleased(MouseEvent e) { mouseReleasedFps = papplet.frameCount; if (this.getClickedShapeFlag() == 1) { mouseReleasedX = e.getX(); mouseReleasedY = e.getY(); mouseDistance = PApplet.dist(mousePressedX, mousePressedY, mouseReleasedX, mouseReleasedY); mouseAngle = PApplet.degrees(PApple...
93f57d3b-27ca-4b3c-a319-c0c50c9ec455
4
private boolean load(String name) { InputStream stream = Map.class.getClass().getResourceAsStream(name); if(stream == null) return false; try (BufferedReader in = new BufferedReader(new InputStreamReader(stream));) { String line; while((line = in.readLine()) != null){ grid.add(new ArrayList<GridTy...
7aa56f50-9715-4a43-aade-e73c4c9eb030
0
public String getField() { return field; }
01589642-7097-4263-9543-37951c26dfa3
0
public SimpleStringProperty suffixProperty() { return suffix; }
08797220-830b-4859-8b9e-ce47c89e8469
4
public static void main( String[] argv ) throws InstantiationException, IllegalAccessException { Class<?> c = null; try { c = Class.forName("il.faut.mettre.un.packag.Mademoiselle"); } catch (ClassNotFoundException e) { e.printStackTrace(); } Class<?> cAlt = null; try { cAlt = Class.forName("il....
ad324eb7-922a-4907-bc73-0316379f9e65
3
public ToolBar(SystemForAreaPlanning sfap, String[] res, String[] descr) { super("Tool Bar"); this.sfap = sfap; this.res = res; this.descr = descr; this.selected = false; this.tbc = new ToolBarComponent[res.length]; this.addMouseMotionListener(new MouseMotionHandler(sfap)); this.setLayout(new BoxLay...
5df4cc5c-55cf-4d2b-a0cc-3b2e2f31262a
4
public String ReturnColor(Card.cardColor color) { String colorVal = null; switch(color) { case RED: colorVal = REDCOLOR; break; case BLUE: colorVal = BLUECOLOR; break; case GREEN: colorVal = GREENCOL...
00c7a68e-7d0d-4bbc-8950-a81c2eb05edd
8
private void loadingStages() { if (lowMemory && loadingStage == 2 && Region.plane != plane) { gameScreenImageProducer.initDrawingArea(); fontPlain.drawCentredText("Loading - please wait.", 257, 151, 0); fontPlain.drawCentredText("Loading - please wait.", 256, 150, 0xffffff); gameScreenImageProducer.d...
b84fd751-1578-450a-b660-3697626e4ec1
8
protected String parseHeader(String input) { String[] lines = input.split("\r?\n", -1); StringBuilder result = new StringBuilder(); boolean readingHeader = true; boolean foundHeader = false; for (int i = 0; (i < lines.length) && (readingHeader); i++) { String line = ...
d5dcfe7c-60cd-4956-83fb-6ad2636847e4
6
public Void visitUnit(UnitTree tree) { String name = options.getOutputName(); source = tree.getSource(); if (name == null) { name = source; int dot = name.lastIndexOf('.'); if (dot > 0) name = name.substring(0, dot); } File file = new File(options.getOutputDir(), name+".c"); try { output = new P...
ead2efe0-57ad-42cd-ad61-1853221c394c
3
public void addURL(URL url) { // Verify were not adding a duplicate of the current url if (this.history_location >= 0) { URL current_url = ((MyListItemWrapper) history.getElementAt(this.history_location)).url; if (url.equals(current_url)) { return; } } trimHistory(); if (history.getSize() >= 0...
c9e1514f-439a-4bb1-a19c-97d0aca27481
1
@Override public int getFirstSlotLocationY() { return isNotPlayerInventory() ? centerY - 6: centerY + 34; }
30962a60-835f-40b3-85bc-396102869379
2
public void moveCamera() { if(player.getX() > GraphicsMain.WIDTH - GraphicsMain.WIDTH/4) { GraphicsMain.right(); } if(player.getX() < GraphicsMain.WIDTH/4) { GraphicsMain.left(); } }
11cb1863-968f-441a-8d42-cac46a651588
2
public void draw(GOut g) { Coord c = new Coord(); Coord sz = invSqSizeSubOne; for (c.y = 0; c.y < isz.y; c.y++) { for (c.x = 0; c.x < isz.x; c.x++) { g.image(invsq, c.mul(sz)); } } super.draw(g); }
a50c3dcc-edf4-467a-a0da-919552baa557
3
private boolean hasPlayerPlacedButterfly(HantoPlayerColor player) { boolean hasPlacedButterfly = true; if (player == HantoPlayerColor.BLUE) { if (bluePiecesLeft.get(HantoPieceType.BUTTERFLY) > 0) hasPlacedButterfly = false; } else { if (redPiecesLeft.get(HantoPieceType.BUTTERFLY) > 0) hasPlacedButterfl...
98bb5acb-2a27-4d51-af16-77549da9c75a
4
@Override public void update() { //For every game object in gameObjects for(GameObject obj : objects) { obj.update(); } //Get copyList (Avoid concurrent modification exceptions) ArrayList<GameObject>copyList = new ArrayList<GameObject>(toRemove); //remove every game object in toRemove for(GameObje...
e77fbbcb-a793-4a0d-8cc1-62e2a7165037
3
private void mapColumnsToInstance (ResultSet resultSet, ClassInspect parentInspector , Object instance) throws ResultMapException { List<Field> annotatedFields = parentInspector.findAllAnnotatedFields(Column.class); for(Field field : annotatedFields) { String columnName = field.getAnnotation(Column.class).name()...
de78ea92-c8ec-4c48-ba59-787a19765a50
9
protected boolean tryMatch() { if (pattern == null) { return false; } logTextArea.setText(""); setMatches(false); setHighlightFromMatcher(null); matcher.reset(stringTF.getText()); if (match.isSelected() && matcher.matches()) { setMatches(true); setHighlightFromMatcher(matcher); logTextArea.s...
385dfa31-78be-4a7f-8736-f4af770c1adb
7
public Relation<Pair<Production, Integer>, Production> getItemDerives() { // includes only reachable productions, ignores rejected productions Relation<Pair<Production, Integer>, Production> der = new Relation<Pair<Production, Integer>, Production>(); for (Production p : productions) { if (p.reachable) { ...
fd8da057-f55d-4487-a8fa-4feef6fd48d5
4
public String formatPizzaPrice (int pizzaSize){ if (pizzaSize == 0){ pizzaPriceFloat = EIGHT_INCH_PRICE * numberOfPizzas; pizzaDisplayedPrice = MyUtils.moneyFormatting(pizzaPriceFloat); } else if (pizzaSize == 1){ pizzaPriceFloat = TWELVE_INCH_PRICE * numberOfPizza...
1b28ef85-9edd-4917-bb7d-858c06c411fd
0
@Before public void setup() { uf = new QuickFind(10); }
7085c130-e973-4d76-8381-759964c6f16c
9
@SuppressWarnings("unchecked") void run(){ Scanner sc = new Scanner(System.in); for(;;){ n = sc.nextInt(); if(n==0)break; sun = new boolean[n][16]; for(int i=0;i<n;i++)for(int j=0;j<16;j++)sun[i][j] = sc.nextInt()==1; set = new HashSet[n][9]; for(int i=0;i<n;i++)for(int j=0;j<9;j++)set[i][j] = ne...
52af0af8-428c-4145-9a8c-c146aa3d176a
5
public ListNode detectCycle(ListNode head) { ListNode fast = head; ListNode slow = head; do { if (fast == null || slow == null) { return null; } slow = slow.getNext(); fast = fast.getNext(); if (fast != null) { ...
c958c03a-04b8-4435-a351-dc232cfa0c2e
0
public UniformDistribution(double mean,double standardDeviation, long SEED) { //super(mean, standardDeviation,inputbuffersize); super(mean, standardDeviation, SEED); //initialize the queue for output q=new LinkedList(); this.SEED = SEED; //super.mean = mean; ...
25cae797-a1d1-4e53-aa41-c1d3078acc23
6
public void loadPluginFile(final File jar) { try { final JarFile jarFile = new JarFile(jar); final JarEntry jarEntry = jarFile.getJarEntry("plugin.prop"); final InputStream is = jarFile.getInputStream(jarEntry); final Properties prop = new Properties(); final URL urls = jar.toURI(...
5ee85444-f68a-4cbf-8efc-ac9388d651fd
0
public void setName(String firstName) { this.name = firstName; }
14c8cbd4-6935-4280-b40a-528802b2106c
4
public static GameDate[] readDates(String path) throws IOException { ArrayList<GameDate> output = new ArrayList<GameDate>(0); try { // Reads file from specified path BufferedReader reader = new BufferedReader(new FileReader(path)); String input = reader.readLine(); /...
1c993533-ccfe-4a4c-873a-188f2a7c1747
3
private void createDragWidget(Composite parent) { parent.setLayout(new FormLayout()); Combo combo = new Combo(parent, SWT.READ_ONLY); combo.setItems(new String[] {"Toggle Button", "Radio Button", "Checkbox", "Canvas", "Label", "List", "Table", "Tree", "Text", "StyledText", "Combo"}); combo.select(LABEL); dragContr...
ac805344-bafc-47f3-bb0e-a35afad6a87c
2
public static double acovers(double a){ if(a<0.0D && a>2.0D) throw new IllegalArgumentException("acovers argument (" + a + ") must be <= 2 and >= 0"); return Math.asin(1.0D - a); }
88c3555f-c6c1-4abd-835b-7df3f4cea3d0
4
public synchronized byte[] macEncry(String str){ byte[] raw=str.getBytes(); byte[] result=new byte[8]; byte[] eightgroup=this.fillEightByte(raw); byte[] temp=new byte[8]; int amount=eightgroup.length/8; //the first des for(int j=0;j<8;j++){ temp[j]=eightgroup[j]; } result=this.getEncCode(temp); ...
450b71d8-5b89-4324-8e4f-4d501df57e4b
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...
1e9d78d6-49a9-4f30-b318-34ba92877cc5
8
public boolean isOverLap(Schedule sc) { boolean retval = false; if(startDay==sc.startDay || startDay==sc.endDay){ retval = true; }else if(endDay==sc.startDay || endDay==sc.endDay){ retval = true; }else if (startDay >= sc.startDay && startDay <= sc.endDay) { retval = true; } else if (endDay>=sc.sta...
64fa773f-91bd-437d-b612-db48198b3b4d
9
public double getMeasure(String measureName) { if (measureName.equals("measureExtraArcs")) { return measureExtraArcs(); } if (measureName.equals("measureMissingArcs")) { return measureMissingArcs(); } if (measureName.equals("measureReversedArcs")) { return measureReversedArcs(); ...
fc959894-05e9-4083-9755-c4fc508218ee
1
public void removeConnection(ConnectionHandler ch) { accessSemaphore.acquireUninterruptibly(); connections--; chl.remove(ch); if(ch.isActive) { // Communicate this to the server NetStatPackage nsp = new NetStatPackage.Leaving(ch.alias); netStatBuffer.add(nsp); statusAvailable.release(); } ...
e608279e-812b-4045-a0a8-fa0948a2648e
9
final public CommandControl isValid(List<String> lines) { if (isCommandForbidden()) { return CommandControl.NOT_OK; } final Matcher m1 = starting.matcher(lines.get(0).trim()); if (m1.matches() == false) { return CommandControl.NOT_OK; } if (lines.size() == 1) { return CommandControl.OK_PARTIAL; }...
2f256f32-c3ae-494f-a504-e69fac14a462
4
public void updateTick(World var1, int var2, int var3, int var4, Random var5) { if(var1.isAirBlock(var2, var3 + 1, var4)) { int var6; for(var6 = 1; var1.getBlockId(var2, var3 - var6, var4) == this.blockID; ++var6) { ; } if(var6 < 3) { int var7 = var1.ge...
0c4feaaf-9f7e-4992-9b4f-1b3e2190df2b
1
@Test public void in_a_car_when_first_park_is_full() { for(int i = 0; i <= 5; i ++) { parkBoy.in(new Car(String.valueOf(i))); } Assert.assertEquals(parkBoy.getParkSize(1), this.SECOND_PARK_SIZE-1 ); }
1a7fa7e9-d5f5-42b1-8888-efb6672764b1
0
public AbstractPreferencesPanel() { c.insets = INSETS; setLayout(gridbag); }
f6b38e3b-7a56-41e2-b25d-75a9d832adfd
4
public static boolean checkStadiumName(Stadium stadium, boolean isNew) { boolean res = false; try { PreparedStatement pr = connection.prepareStatement("" + "SELECT stadium_id FROM stadium\n" + "WHERE UPPER(stadium_name) = UPPER(?)"); pr.set...
fbcafbe3-e691-47b1-8735-3186b18813fa
6
@EventHandler public void SlimeInvisibility(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.getSlimeConfig().getDouble("Slime.Invis...
f2d4ffbc-a323-49a3-bcc5-e25b3b07fdc0
7
@Override public int scoreLigne(int[] l, int c) { int i; int res = 0; //Vérifie s'il y a bien une pièce sur toutes les cases de la ligne, //renvoie 0 sinon for(i = 0; i < l.length; i++) if((pl.getPiece(l[i]) == null)) return 0; //Vérifie que toutes les cases sont de la même couleur, //renvoie 0 s...
53ab208d-9abe-4b0f-895c-fe81c289535d
8
public ChannelBuffer encode() throws TooLongFrameException { int b0 = 0; if (fin) { b0 |= (1 << 7); } b0 |= (rsv % 8) << 4; b0 |= opcode % 128; int b1 = maskingKey != null ? 0x80 : 0x00; int headerLength = maskingKey != null ? 6 : 2; Channel...
c1ed5371-d1fd-4b63-9341-f51834bec59a
9
private void setPesoLlaveEntera(int capa, int neurona, int llave, double valor){ switch (llave) { case 0: this.setPeso(capa, neurona, THRESHOLD, valor); break; case 1: this.setPeso(capa, neurona, EMBARAZOS, valor); break; case 2: this.setPeso(capa, neurona, CONCENTRACION_GLUCOSA, valor...
48109a44-e530-4fbc-8e95-e57502ec3f0d
8
@Override public void eat() { double amountLeft = 0.0; if(animalType == AnimalType.Carnivore){ amountLeft = position.eatMeat(10.0); if (amountLeft < 10.0) System.out.println(animalName + " is eating meat."); } if(animalType == AnimalType.Herbivore){ ...
cbcbcea6-17e4-4128-b970-21a721fbbd03
1
public static Object deserializeFromBytes(byte data[]) throws IOException, ClassNotFoundException { ByteArrayInputStream stream = new ByteArrayInputStream(data); try { ObjectInputStream in = new ObjectInputStream(stream); try { Object object = in.readObject(); return object; } ...
33bb3735-d486-4a6a-ba52-5da0db17519d
4
public static int jauJdcalf(int ndp, double dj1, double dj2, int iymdf[]) { int j; double denom, d1, d2, f1, f2, f; /* Denominator of fraction (e.g. 100 for 2 decimal places). */ if ((ndp >= 0) && (ndp <= 9)) { j = 0; denom = pow(10.0, ndp); } else { j...
2de22b1d-4f70-4aac-8d9b-7cd0c5087bf6
7
public short isFullHouse() { short firstNum = handOfCards[0].cardNumber, lastNum = handOfCards[cards - 1].cardNumber; short firstNumCount = 0, lastNumCount = 0; for (int i = 0; i < cards; i++) { if (handOfCards[i].cardNumber == firstNum) { ...
139c20d1-5084-4172-85fe-d5b84838cffb
2
public Integer getAvailabilityCount(int availabilityCode) { Integer i = 0; for (RosterAvailability r: rosterAvailability) { if (r.getAvailabilityCode().equals(availabilityCode)) i = i +1; } return i; }