method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a444a237-ff23-4290-872b-2871e54302fc
6
public static float[][] GeneratePerlinNoise(float[][] baseNoise, int octaveCount) { int width = baseNoise.length; int height = baseNoise[0].length; float[][][] smoothNoise = new float[octaveCount][][]; //an array of 2D arrays containing float persistance = 0.5f; //generate smooth noise ...
d7270e19-2736-4faf-aca7-065d302d1ca1
7
public int selectByMouse(int index, int method) { if (index != -1) { if (mAnchor >= 0 && (method & MOUSE_EXTEND) == MOUSE_EXTEND) { select(mAnchor, index, true); } else if ((method & MOUSE_FLIP) == MOUSE_FLIP) { if (isSelected(index)) { deselect(index); } else { select(index, true); } ...
df3baed0-b796-4d99-af8f-217323017c1a
9
public static void main(String[] args) throws Exception { HashMap<String, BufferedWriter> writerMap = new HashMap<String, BufferedWriter>(); HashMap<String, DeMultiplex> sampleIDs =DeMultiplex.getBarcodeMap(); BufferedReader leftReader = new BufferedReader(new FileReader(new File( ConfigReader.getIanNov...
3841003f-f02f-4f10-b825-5bd4fbbdbe7c
2
protected void openGD(BasicGraphEditor editor, File file, mxGdDocument document) { mxGraph graph = editor.getGraphComponent().getGraph(); // Replaces file extension with .mxe String filename = file.getName(); filename = filename.substring(0, filename.length() - 4) + ".mxe"; if (new File(filename)...
a3c79a0d-7187-4c42-b6e7-91ba01b0f367
2
public MapCreator findCreatorForMode(int difficulty) { if (difficulty == 1) return new SafemapCreator(); else if (difficulty == 2) return new HazardousmapCreator(); else return null; }
a618b23b-2202-41cf-9784-46f0a7bffa68
5
public Object getObject() { if( cxnSp != null ) { return cxnSp; } if( graphicFrame != null ) { return graphicFrame; } if( pic != null ) { return pic; } if( sp != null ) { return sp; } if( grpSp != null ) { return grpSp; } return null; }
e3077ef8-c608-45c2-92e2-a6094e878bb0
8
protected Map.Entry<String, List<String>> parseMapEntry(String entry) { // Trim whitespace and return null if empty entry = entry.trim(); if(entry.isEmpty()) return null; // Check if this is a switch if(entry.startsWith("-")) { // Get the rest of the string ...
79b34aff-3d60-44ba-9bd6-4345b04fd87d
6
public static void update(float dt) { float cameraSpeed=untranslateDistance(Camera.cameraSpeed); if (scale-Point.epsilon>scaleObject) setScale(Math.max(scaleObject, scale-dt*scaleSpeed)); else if (scale+Point.epsilon<scaleObject) setScale(Math.min(scaleObject, scale+dt*scaleSpeed)); e...
9500b45f-480a-45c3-96d5-ff78d39ed1ba
2
private boolean intArrayNotContains(int[] array, int value) { for (int i = 0; i < array.length; i++) { if (array[i] == value) return false; } return true; }
5961c2ed-15a1-4fcf-b9c5-b9c6786f21e9
8
public void handleHandshake(Packet2Handshake par1Packet2Handshake) { boolean var2 = true; String var3 = par1Packet2Handshake.username; if (var3 != null && var3.trim().length() != 0) { if (!var3.equals("-")) { try { ...
e792c1cc-7f33-4e5e-863a-976fdd13e46a
4
public boolean canMerge(Polygon polygon) { for(Edge edge : edges) { for(Edge otherEdge : polygon.edges) { if(edge.contains(otherEdge.start) || edge.contains(otherEdge.end)) { return true; } } } return false; }
a1278631-8006-4009-8572-a4694bf2eef4
2
public static void concurrentTest() { final int BUFFER_SIZE = 10; final int NUM_PRODUCERS = 5; final int NUM_CONSUMERS = 3; Buffer buffer = new ConcurrentRingBuffer(BUFFER_SIZE); for (int i = 0; i < NUM_PRODUCERS; ++i) { new Thread(new Producer(buffer)).start(); ...
7852111b-b11a-43d4-bf15-0824c5ce6ad6
1
private void autoUpdate_settingsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoUpdate_settingsButtonActionPerformed if (debug) logger.log(Level.DEBUG, "Setting preference \"autoUpdate\" from " + settings.autoUpdate() + " to " + autoUpdate_settingsButton.isSelect...
547458ea-db05-4d82-b5ac-6e9d8c4b5cce
7
@EventHandler(priority = EventPriority.LOWEST) public void onChunkUnLoad(ChunkUnloadEvent e) { if (!Settings.amrs) { return; } if (Settings.world || WorldSettings.worlds.contains(e.getWorld().getName())) { // Iterate through the entities in the chunk for (Entity en : e.getChunk().getEntities()) { ...
8091fcfb-4305-4565-b340-6021d072f0f1
5
public Test_OneConfig(List<Case> trainingData,List<Case> testingData, ArrayList<String> config, int testNum){ this.config=config; this.testNum = String.valueOf(testNum); double []Attributesweights; // Set the retrieval k int k = Integer.valueOf(this.config.get(0)); // Set the retrieval distances ...
a04234a9-9d6a-4975-9eec-0e74413a9bb1
6
public Transition addOutgoingTransition(Transition t, boolean consistency) throws Exception{ //check if there is not yet another transition with the same target state Transition existing = getExistingOutgoingTransition(t); if(existing != null) { //merge return mergeOutgo...
40d35af8-e786-46fb-bd6e-396377447ce3
2
public boolean isAnnotated() { return isSource || isSink || isNeitherNor; }
65113270-d286-493d-ab1b-fab23e62485a
2
public boolean Salvar(Endereco obj,int idPessoa){ try{ if(obj.getId() == 0){ PreparedStatement comando = banco.getConexao() .prepareStatement("INSERT INTO enderecos (rua,cep,bairro,numero,id_pessoa,cidade,estado,ativo) " + "VALUES(?,?,?...
cdb3546c-a7ec-4a1b-a8ad-e789ee7fc095
8
private static void mergeFlatStatements(SequenceStatement sequence) { while (true) { Statement next; Statement current = null; boolean found = false; for (int i = sequence.getStats().size() - 1; i >= 0; i--) { next = current; current = sequence.getStats().get(i); ...
e9a04b66-4f5d-49ed-8341-6781bb4ccd61
7
int selectSecurityType() throws Exception { int secType = SecTypeInvalid; // Read the list of secutiry types. int nSecTypes = readU8(); if (nSecTypes == 0) { readConnFailedReason(); return SecTypeInvalid; // should never be executed } byte[] secTypes = new byte[nSecTypes]; readFully(secTypes); /...
566fa516-3026-4ae6-bfc9-efa02a79e022
2
@Override public void completed(Object result, Object attachment) { while (buffer.position() < buffer.capacity()) { socket.write(buffer, null, this); } buffer.clear(); try { socket.close(); } catch (IOException exc) { exc.printStack...
c7351854-9227-4105-859c-ca0ae87e8b71
1
private void initSuperclass(String superclass) { if (superclass != null) { this.superClass = constPool.addClassInfo(superclass); cachedSuperclass = superclass; } else { this.superClass = constPool.addClassInfo("java.lang.Object"); cachedSuperclass ...
90ebc1cf-f227-4d00-a013-41b8ca660954
5
@Override public void update(int mouseX, int mouseY, boolean pressed) { this.s += ds; if(this.s <= 20 || 40 <= this.s) this.ds *= -1; if(Game.instance.random.nextInt(Game.instance.requestedUPS/10) == 0) this.c = Game.instance.random.nextInt(); if(this.btnBack.wasClicked()) { if(this.win) ...
71c9883b-9fb7-49ac-9543-61bd2cdd70f0
4
public void loadMasterTileList(String directory, String fileName) throws IOException{ String[] tileList = new String[1]; String[] temp; FileReader fr = new FileReader(directory+fileName); BufferedReader br = new BufferedReader(fr); //init based on number of tiles in file int numOfTile = Integer.parseInt...
3efd9f7d-c7cf-4896-9bcb-6305b19fe4c9
8
public static PLConceptContainer createConceptContainer(List collectedconcepts, Module module, boolean includechildrenP) { { PLConceptContainer container = PLConceptContainer.new_PLConceptContainer(); List plconcepts = List.newList(); { Description concept = null; Cons iter000 = collectedconcep...
1e427cc1-4fb3-4fc9-8bd6-da36ebefe114
5
private void updateDistribution(int[] plate) { int sum = 0, max = 0; double normalfactor = 1.0 * numfruits * (choice + 1) / length; double normalweight = 0.6 - (1.2 * (choice + 1) / nplayers); choicelist[choice] = plate.clone(); for(int i = 0; i < length; i++) { observedlist[i] = observedlist[i] + plat...
ecf56be3-f782-4c0f-bcba-41858c349c60
1
@Override public void run() { if (this.ID != null) { csearch (this.ID); } this._view.init(); }
10a84490-4786-48ca-b10b-87f6b4db5738
2
public void saveDoc() { try { // if (this.pdfwriter != null) { // pdfwriter.close(); // } if (document != null) { document.close(); } } catch (Exception e) { e.printStackTrace(); } }
01b36e7f-e666-4ace-bbe4-d818d0d12096
3
public static ArrayList<Track> randomTracks(int nArtists) { ArrayList<Track> tracks = new ArrayList<Track>(); final int albumsPerArtist = 3; final int tracksPerAlbum = 8; for (int i = 0; i < nArtists; i++) { String artist = getRandomString(4); for (int j = 0; j < albumsPerArtist; j++) { String albu...
23477d0b-2a26-46fb-ad28-c80ea67dbf42
7
@Override public void mouseClicked(MouseEvent e) { if (game.getPlayer(game.getCurrentPlayerIndex()).getPlaysLeft() > 0) { int x = e.getX(); int y = e.getY(); game.setSelectedTile(null); if ((x >= 30) && (x <= 30 + 2 * BoardComponent.HEX_WIDTH)) { for (int i = 0; i < 6; i++) { if ((y >= (30 + i *...
fa8593f2-1d1e-4f61-a2ef-709b60057cf9
3
@Override public void updatePerson(Person person) throws SQLException { Connection dbConnection = null; java.sql.Statement statement = null; try { dbConnection = PSQL.getConnection(); statement = dbConnection.createStatement(); String positionUpdate = "UPDATE person SET phone_number = "+ person.getP...
0c4838c2-4195-4f16-8c3a-a7f344e68423
1
public void doCSVLarge() { try { final int cols = ConsoleMenu.getInt("Number of cols", 10); final int rows = ConsoleMenu.getInt("Number of rows", 2000000); final String filename = "LargeSampleCSV.csv"; CSVTestFileCreator.createFile(cols, rows, filename); ...
1a6fb5d7-3e3d-49c3-8e6c-83c89bcde2f5
6
public static void main(String[] args) throws Exception { HashMap<String, DeMultiplex> sampleIDs = getBarcodeMap(); System.out.println(sampleIDs.size()); HashSet<Integer> sampleID = new HashSet<Integer>(); for( DeMultiplex d : sampleIDs.values()) { if( sampleID.contains(d.sampleID)) throw new Ex...
9c53e55f-095a-41ac-9488-11cc6f2108fa
0
private void initProgressBar(){ progressBar = new JProgressBar(); progressBar.setSize(frame.getWidth()/2,25); progressBar.setStringPainted(true); progressBar.setMaximum(100); progressBar.setMinimum(0); progressBar.setValue(0); frame.add(progressBar); }
70b5f4da-99da-4d07-9edc-7fb950d24022
0
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { modificar = new javax.swing.JFrame(); descripFt = new javax.swing.JTextField(); refFt = new javax.swing.JTextField(); precioFt...
9d29645b-5fb9-492f-acd8-40dc81723acb
6
private void resize() { size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight(); width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (getSkinnable().isKeepAspect()) { if (aspectRatio * wi...
13189100-9f3c-4ba1-9f0b-759ab3d71f44
1
public void render(Screen screen) { screen.renderSprite(animation.getCurrentSprite(), x - animation.getCurrentSprite().getWidth() / 2, y - animation.getCurrentSprite().getHeight() / 2, direction, true); if (level.game.showHitboxes) screen.drawQuad(0x0000ff, (int) getBounds().getX(), (int) ge...
735dec51-8136-4f93-8e52-2eafc10ac32c
8
public static void round(Image image) { for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { double red = image.getPixel(x, y, RED); double green = image.getPixel(x, y, GREEN); double blue = image.getPixel(x, y, BLUE); if (red > Image.MAX_VAL || red < 0) { ...
c42da2cd-2a37-4c87-ae51-6fa49c13691e
9
public void setupBankTable() throws Exception { Connection conn = getConnection(); PreparedStatement ps = null; ResultSet rs = null; if (Misc.is(Constants.DatabaseType, new String[] { "sqlite", "h2", "h2sql" })) { try { ps = conn.prepareStatement("CREATE TABLE " + Constants.SQLTable...
ff9472f7-34d8-43d9-a549-2526ccf7ff42
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost, msg)) return false; if((msg.source()==affected) &&(msg.target() instanceof Item) &&((msg.targetMinor()==CMMsg.TYP_HOLD)||(msg.targetMinor()==CMMsg.TYP_WIELD)) &&(isWearableItem((Item)msg.target()...
94ad6edc-cdbc-4069-9631-8bbec9788250
8
public void findPatternKMP(String string, String pattern) { if (string == null || pattern == null) { System.out.println("String or pattern null "); return; } int stringlen = string.length(); int patternlen = pattern.length(); for (int i = 0; i <= stringlen - patternlen; i++) { if (string.charAt(i...
3abb78a9-7715-41bf-af30-301e40dcd59d
7
public List<Boolean> getBooleanList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Boolean>(0); } List<Boolean> result = new ArrayList<Boolean>(); for (Object object : list) { if (object instanceof Boolean) { ...
b3089182-4554-41a8-b096-0e4d67cc8376
3
public void lancerManche() { joueurCourrant = designerPremierJoueur(joueurs.size()); boolean mancheFinie = false; do { joueurs.get(joueurCourrant).jouer(); AvancerJoueur(); //remplacer ça par un système de levé d'exception for (Joueur j : joueurs) { if(j.getNbCarte() == 0) mancheFin...
d9e6a087-513c-4d25-a757-b41d5bc191f6
0
public void setPrpMoaTipo(String prpMoaTipo) { this.prpMoaTipo = prpMoaTipo; }
c819cfd8-ae71-4f09-a013-7f495441708f
0
public void setAge(int age) { this.age = age; }
a2d6dfb0-f6da-4ecf-a7ee-121e776ee9f9
6
public void draw(int window_x, int window_y, int window_width, int window_height, Graphics g, Level level) { g.drawImage( level.getBackground().getSubimage(this.x, this.y, this.width, this.height), window_x, window_y, window_width, window_height, null); for (List<Member> l : level.getRenders().va...
da3de684-479d-4644-be15-9a1f04201a82
0
public void persistRoomType() { em.persist(typeEntity); }
efb9de32-5f0d-4c64-aba2-69ff5664dc3d
3
private void checkDeleteTrap(int x, int y){ //delete traps. for(ListIterator<Trap> i = traps.listIterator(); i.hasNext();){ Trap t = i.next(); if(t.getX() == x && t.getY() == y){ i.remove(); continue; } } }
7d88e15e-b146-46cb-9e0b-10278a3eec97
7
public static void STARTUP_MARSHALLER() { { Object OLD_$MODULE$_000 = Stella.$MODULE$.get(); Object OLD_$CONTEXT$_000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/STELLA/XML-OBJECTS", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial(Ste...
b8ccdad9-2814-45a0-91a2-b7d84ca332a7
0
public void go() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { new MoveAction(being, being.getPosition().plus(Random.getRandomIdentityVector2(being.ID()).multiply(3.0))).go(); }
a8618861-8772-44dc-852c-6c0592298ea5
8
public boolean stem() { int v_1; int v_2; int v_3; int v_4; // (, line 157 // do, line 159 v_1 = cursor; lab0: do { // call prelude, line 159 if...
723494ac-1174-4903-949a-bba95bb916ec
9
public boolean startup() throws IOException { String userId = node.getUserId(); RPCMessageFactory messageFactory = node.getMessageFactory(); NodeSecurityAgent securityAgent = node.getSecurityAgent(); StringBuilder buffer = new StringBuilder(); buffer.append("\nStarting initi...
c43608a6-2510-44c1-931f-541c24e51bc6
0
public Point getPoint() { return point; }
6a2c58a6-fe94-460b-8bee-24a637dd702e
4
void refillGoodStart() { System.out.println("good Bag"); pointer = 0; DynamicArray<Type> left = new DynamicArray<>(index); boolean gotOne = false; while (!gotOne) { int i = rand.nextInt(6); if (left.get(i) != Type.S && left.get(i) != Type.Z & left.get(i) != Type.O) { tetrominos[0] = left.remove(i); ...
4f5c8cfc-641f-4aab-9ae4-7afcb851dde4
0
public boolean equals(VertexSet that) { return this.laenderMap.keySet().equals(that.laenderMap.keySet()); }
82022b7d-c128-4db1-8490-321bf25048d3
8
public Coffin(TextGame _game) { super("Closed Coffin", ""); this.game = _game; this.addAction(new ActionInitial("open") { @Override public Result execute(Actor actor) { if (Coffin.this.getData("unlocked") == null) { if (((Player) actor).hasOne("key")) { // transform the coffin into vampire ...
5a555447-06e8-4458-b654-b4b6553edc1a
6
public MathGame() { System.out.println("initing"); thisUser = new User("blank", "pass"); setPreferredSize(new Dimension(appWidth, appHeight)); // setSize(appWidth, appHeight); setLayout(null); // ((JComponent) getContentPane()).setBorder(new // LineBorder(Color.yellow)); // setBorder(new LineBorder(C...
3c417ad0-5b71-4aef-af8c-a4e374835bb9
4
public final String getConfigValue(final String section, final String key, final String defaultValue) { synchronized (this.configOld) { synchronized (this.configNew) { final Map<String, String> map0 = this.configNew.get(section); final Map<String, String> map1 = this.configOld.get(section); if (map0...
e0783fa1-a411-485e-be16-54042838cd70
3
public int getTense ( String posTaggedSentence ) { int count = 0; String[] wordsAndTags = posTaggedSentence.split(" "); int size = wordsAndTags.length; for ( int i = 0 ; i < size ; i++ ) { String temp = wordsAndTags[i].substring(wordsAndTags[i].indexOf('/')+1); if...
b0da843c-8696-4423-8884-f52f5a00a820
5
public void writeRecord(byte[] record) throws IOException { int length = record.length; // // The record length must be a positive value // if (length < 1) throw new IllegalArgumentException("Record length "+length+" is not valid"); // // Flush the o...
c7355335-ac7a-4443-a015-1b6e517a946d
9
@EventHandler(priority = EventPriority.LOWEST) @SuppressWarnings("unused") void onDamage(final EntityDamageEvent event) { Entity target = event.getEntity(); if (event instanceof EntityDamageByEntityEvent) { Entity attacker = ((EntityDamageByEntityEvent) event).getDamager(); ...
699753ac-051c-46c3-a2b3-ebbd9f2356d3
0
public Object put(Object key, Object value) { touch(key); return map.put(key, value); }//put
1574df26-b818-4764-b754-55c5a5705f18
5
private void updateVillainMissiles2() { ArrayList<VillainMissile2> deadVillainMissiles = new ArrayList<VillainMissile2>(); for(int i = 0; i < villainMissiles2.size(); i++) { VillainMissile2 v = villainMissiles2.get(i); v.move(); if(CollisionDetector.isColliding(v, sc)) { if(!sc.isShieldActive()) ...
a0b3fb48-5afa-4764-8c58-b5476b5c36a1
4
@RequestMapping(value = "del", method = RequestMethod.POST) @ResponseBody public Map del(@RequestParam int[] id) { Map<String, Object> map = new HashMap<>(); List<String> l1 = new ArrayList<>(); List<String> l2 = new ArrayList<>(); List<String> l3 = new ArrayList<>(); f...
d36bd4b8-c506-4aec-adba-e7881f202b7e
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...
7f0f21fe-1565-4483-9c91-3e41635d31a0
1
private static String getFileContents(String filename) throws IOException, FileNotFoundException { File file = new File(filename); StringBuilder contents = new StringBuilder(); BufferedReader input = new BufferedReader(new FileReader(file)); try { String line = ...
bd1757ee-4016-4b04-a1de-832b1eee12d5
4
public static Player generatePlayer(String teamName){ String firstName, lastName; Player.POSITION position; double height, weight; int age, salary; String alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Random randomNum = new Random(); //Create first name firstName = ""; for (i...
5ce2966f-d754-49fc-8e1d-773d11f4ff05
1
public void doAlarm() { System.out.println("Beep!"); theDisplay.setAlarmPulse(true); try {Thread.sleep(300);} catch (InterruptedException e) {} theDisplay.setAlarmPulse(false); }
ae3f4446-f290-4371-b8d7-599da2de7a52
2
public BouncyBallSimulation(Planet simulatedPlanet, Ball bouncyBall) { if (simulatedPlanet == null) { throw new IllegalArgumentException("The simulated planet can not be missing!"); } if (bouncyBall == null) { throw new IllegalArgumentException("The bouncy ball can not be missing!"); } bouncyBall.addHit...
54b374c4-3fc5-4166-8565-188299af5630
6
* @return the translation vector */ public static MCVector3 translate(int position) { switch(position) { case MCNeighbour.SOUTH: return new MCVector3(0,0,-2*SIZE); case MCNeighbour.NORTH: return new MCVector3(0,0,2*SIZE); c...
2446df16-3918-42e4-a37e-222ce5d2aeae
9
public final boolean equals(AttributeBaseValue attributeBaseValue) { if(attributeBaseValue == null) { return false; } if(_attribute.getId() != attributeBaseValue.getAttribute().getId()) { return false; } try { DataValue value1 = (DataValue)attributeBaseValue.getValue(); if((_value == null) && (val...
4e362664-ebc6-414a-bf7c-7968bb9c1d5f
5
public int calculateCharge(int startingX, int startingY,int endingX, int endingY, final LinkedList<CellDescription> map) { /*initialize some variables*/ int chargeRequiredForReturnTrip; graphics = false; LinkedList<CellDescription> returnCells = new LinkedList<>(); sX = startin...
c9aaf3d0-5a4b-42c6-96cf-dfd5a388820e
9
public static void main(String[] args) { Scanner scn = new Scanner(System.in); StringTokenizer lineTokenizer = new StringTokenizer(scn.nextLine() .trim()); int n = Integer.parseInt(lineTokenizer.nextToken()); int p = Integer.parseInt(lineTokenizer.nextToken()); ...
2711f969-b77a-486a-9366-74e4b2f2c09f
1
@Override public String getHTTPStatusCode(HTTPStatusCodes httpStatusCodes) { return isCredentialMatch() ? httpStatusCodes.getStatus(200) : httpStatusCodes.getStatus(401); }
45190ae7-fcde-4cc4-a564-b097eeda9eab
2
public BufferedImage paneToBufferedImg() { BufferedImage bi; if (canvas.getWidth() <= 0 || canvas.getHeight() <= 0) { bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_RGB); } else { bi = new BufferedImage(canvas.getWidth(), canvas.getHeight(), BufferedImage.TYPE_INT_...
1741da51-79d9-4ade-a122-90682ff90ab2
1
public void createNtables() throws Exception{ Connection conn = JDBC.createConnection(); String table_name = ""; for (int i=97;i<123;i++) { table_name = "n_gram_"+(char)i; String sql = " create table "+table_name+"(wordGroup varchar(100) primary key, wordAttribute varchar(100), frequence double(10,8), cou...
31b1334d-2f0d-4b75-8294-28e87591e03b
3
private void buildStack(Stack<BTPosition<T>> s, ArrayList<BTPosition<T>> al) { BTPosition<T> c; while (!s.isEmpty()) { c = s.pop(); // let right first if (c.getRight() != null) s.push(c.getRight()); if (c.getLeft() != null) s.push(c.getLeft()); al.add(c); } }
be1ca0d9-59ec-4858-95c9-049f5b24fe18
9
public void testRefcount2() throws Exception { Prot p1=new Prot("P1"), p2=new Prot("P2"); fc1=new ForkChannel(a, "stack", "fc1", p1, p2); fc2=new ForkChannel(a, "stack", "fc2"); // uses p1 and p2 from fc1 fc3=new ForkChannel(a, "stack", "fc3"); // uses p1 and p2 from fc1 assert ...
197c786c-ef79-44d4-b7a3-9bf729dd88db
6
public void loadFile(String filename){ String path = "data/" + filename; try { BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream(path), "Shift_JIS")); String line; while ((line = br.readLine()) != null) { ...
972b011b-2304-46ba-9389-289c0d6d3c16
4
public Event removeTimer(int entity) { int timerIndex = -1; Event timer = null; for (int i = 0; i < data.size(); i++) { if ((((Event)(data.elementAt(i))).getType() == NetworkSimulator.TIMER_INTERRUPT) && ...
04f6a57b-98be-4bd1-8608-e5d5fd08f0da
1
public boolean InsertarPlaga(Plaga p){ if (p!=null) { cx.Insertar(p); return true; }else { return false; } }
1bc4e351-d168-44b7-90ec-8ac22c3cc4ad
7
@Override public List<String> translateSingleWord(String word) { word = word.trim(); /* Die Website des zu uebersetzenden Wortes einlesen */ List<Document> contents = null; try { source = "http://" + sitePrefix(From, To) + website + URLEncoder.encode(word, "UTF-8"); contents = webparser.readUrls(source...
842bf3fb-8802-40c9-854e-e839f81c9f1e
2
public void paintOverlayMouseOut(Graphics g, int cornerRadius) { switch(fPaintMode) { case ALWAYS: case MOUSE_OUT: paintMouseOut(g, cornerRadius); break; default: break; } fDecorator.paintOverlayMouseOut(g, cornerRadius); }
1762c3dd-6b50-4fc2-83f5-c5c477a18526
1
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { writer.print("("); writer.printType(castType); writer.print(") "); writer.breakOp(); /* * There are special cases where a cast isn't allowed. We must cast to * the common super type before. This cases always give a run...
f9c7d5b4-559f-4359-a2fb-1d87c3fdb4cc
2
public static String autodetectProjection(String directorio) { File archivoPrj = buscarArchivoPrj(new File(directorio)); if (archivoPrj != null){ try { return autodetectProjectionFromFile(archivoPrj); } catch (IOException e) { e.printStackTrace(); } } return ""; }
2d5c9b8e-3443-4dea-818f-19e21107cd93
7
@Override public int loop() throws Exception { if(ctx.inventory.isFull()) { if(!ctx.bank.isOpen()) { final NPC banker = ctx.npcs.getNearest("Banker"); if(banker != null) { if(banker.interact("Bank")) { Time.sleep(new Con...
8f8bc141-afdb-4612-b29d-771cd1d2cc0a
5
private void loginBtnMouseClicked(java.awt.event.MouseEvent evt) { Map<String, Object> map = new HashMap<String, Object>(); map.put(Constants.USER_NO, this.userNO.getText()); map.put(Constants.USER_PWD, String.valueOf(this.userPwd.getPassword())); map.put(Constants.USER_STATUS, this.status.getSelectedIndex() + ...
5d32f48c-d265-4cee-8a28-f0e2ad60f4b4
4
public boolean Update() { if (KeyPress.IsPressed(V_KEY) && !PRESSED) { return PRESSED = true; } else if (!KeyPress.IsPressed(V_KEY) && PRESSED) { return PRESSED = false; } return false; }
0a1cf279-70af-4395-842e-0fcedc90f7fe
0
public int getCategoryId() { return categoryId; }
b9cdd1a1-cb2e-4410-bcf5-b60a05f2ac2c
8
public void putAll( Map<? extends Short, ? extends Short> map ) { Iterator<? extends Entry<? extends Short,? extends Short>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Short,? extends Short> e = it.next(); this.put( e.getKey...
c5b40c04-6d89-4c3a-bdfd-6ab44ab81442
8
public void getPeopleYouMightKnow() { ArrayList<String> ppl = new ArrayList<>(); for (User user : followers) { if (user.getFollowers().size() == 0) { ppl.add("You might know " + user.getName() + "'s followees..." + "but they don't follow anybody.:( ");...
99afe959-3f34-48bf-b55d-cb4ed4081fcc
5
public <T> void hear(TypeLiteral<T> typeLiteral, TypeEncounter<T> typeEncounter) { for (Class<?> c = typeLiteral.getRawType(); c != Object.class; c = c.getSuperclass()) { for (Field field : c.getDeclaredFields()) { if (field.getType() == Logger.class && field.isAnnotationPresent(InjectLogger.class)) { typ...
cf849802-0ad0-49cb-b321-1eafc560819c
4
private void loadEndpoints(final String fileName){ try{ BufferedReader input = new BufferedReader(new FileReader(fileName)); String line; String[] array; Endpoint endpoint; /* reads each line of servers.txt and then converts them into Endpoint * objects to be inserted into the endpointManager...
f9d663b5-9609-40dd-a8f0-11d86f2b3b74
7
public void CreateSkinNakedAlternativeTexturesMale() throws Exception { SPProgressBarPlug.setStatus("Create SkinNaked alternative textures for males"); ARMO skinNaked = (ARMO) SkyProcStarter.merger.getArmors().get(new FormID("000D64Skyrim.esm")); for (ARMA sourceAA : SkyProcStarter.patch.getArma...
d6bccd17-e460-4ec4-b4f0-0b8e24fd6da8
6
private Opcode toOpcode( byte opcode ) throws InvalidFrameException { switch ( opcode ) { case 0: return Opcode.CONTINUOUS; case 1: return Opcode.TEXT; case 2: return Opcode.BINARY; // 3-7 are not yet defined case 8: return Opcode.CLOSING; case 9: return Opcode.PING; case 10:...
fd8e1f1a-f564-4570-a64a-ca719e0d0aef
3
public boolean isChomsky(Production production) { String[] tokens = separateString(production.getRHS()); switch (tokens.length) { case 1: return grammar.isTerminal(tokens[0]); case 2: return !(grammar.isTerminal(tokens[0]) || grammar .isTerminal(tokens[1])); default: return false; } }
012fd7eb-5d31-4406-878c-7c6da6304047
1
public String getFileName(){ int last = fileName.lastIndexOf("\\"); if(last == -1) last = fileName.lastIndexOf("/"); return fileName.substring(last+1); }
6a8a7efe-1165-4f85-b1ed-435e4d49f824
7
public void getNewsLink( String url, Config config, String encode ) { Document doc = null; try { doc = getDocument(url, encode); Element sourceEle = doc.select(config.ruleSource.sourceEle).first(); Elements newsEles = sourceEle.select(config.ruleSource.sourceEles); ...
6a986549-c93c-4087-b612-4efadbb6a443
0
private int getEuclideanDistance(Tile start) { int dx = Math.abs(start.getX() - end.getX()); int dy = Math.abs(start.getY() - end.getY()); return (int) Math.sqrt(dx * dx + dy * dy); }
6c7c6c62-7d44-4a0d-8a0f-dde3ab1ac7a3
0
@Override public int getType() { return BuildingType.SIDEWALK.ordinal(); }