method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ab491c09-60f0-4dfc-836b-b9c8ee772aa5
8
public String waterCheck(MOB mob, Item I, Item container, StringBuffer msg) { if(I==null) return ""; if(I.container()==container) { if(((I instanceof Drink)) &&(((Drink)I).containsDrink()) &&(CMLib.flags().canBeSeenBy(I,mob))) msg.append(L("@x1 contains some sort of liquid.\n\r",I.name())); } ...
2562e7d9-d9fa-43d1-bf0a-45f948519b2a
1
public void onEnable() { File settings = new File(getDataFolder(), "com.albert.Bulka.txt"); if(!settings.exists()) { //TODO write file } bulka = new Bulka(this); }
c6bfdadd-a931-482a-8c7a-d5ffae9faafa
2
public ChatScreen(String ip, int port) { // Set up the socket try { this.socket = new Socket(ip, port); this.out = socket.getOutputStream(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.thread = new ClientListeningThread(this.socket, this); this.thre...
b5d3cbe4-d225-440b-a6bb-09ee8d6e466d
5
private ArrayList<InteractionData> getAllInteractions(String stype, InteractionType type, GameDescription game){ ArrayList<SpriteData> allSprites = game.getAllSpriteData(); ArrayList<InteractionData> data = new ArrayList<InteractionData>(); for (SpriteData sd:allSprites){ if(type == InteractionType.FIRST ||...
db482601-ce2c-4589-8bb2-12d0e08e2f0b
5
private void writeCollection(Map<Class<?>, Integer> clazz2count, Map<Object, String> object2variableName, boolean onlyPropertiesWithMatchingField, Collection<?> collection, String collectionName, int maxRecursions, int currentRecursion) throws IOException { if (maxRecursions == 0 || maxRecursions < curren...
4804550a-8766-4116-9b12-ed634fc2ead5
5
public void transform() { if ((Options.options & Options.OPTION_CONTRAFO) == 0 || cons.length == 0) return; removeDefaultSuper(); removeInitializers(); checkJikesContinuation(); if (outerValues != null) { /* * Now tell all constructors the value of outerValues parameters and * simplify the...
d4ffc760-b5a2-464f-8ce1-1dfbba0e69ca
6
final ObjectDefinition method345() { int j = -1; if (anInt540 == -1) { if (anInt599 != -1) { j = Class21.settings[anInt599]; } } else { j = Class142_Sub27_Sub14.method1892(anInt540); } if (~j > -1 || -1 + childIDs.length <= j ||...
b5d2ec3b-0200-4383-a76f-a96e349fb214
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); if (string...
1e12b573-d574-4030-9de2-3d01d6312743
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Right right = (Right) o; if (idRight != right.idRight) return false; if (description != null ? !description.equals(right.description) : right.d...
26a8031d-7e39-407b-8677-6b3f333105ab
3
private void getInput(){ String text = ""; try { if(input.ready()){ text = input.readLine(); } } catch (IOException e) { e.printStackTrace(); } if(text!=""){ processInput(text); } }
960b5b15-2f97-4101-a7e8-b3c816ddc70d
0
public static void initDisplay() { //makes the frame JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(Display.display.gameWidth, Display.display.gameHeight); frame.setLocationRelativeTo(null); frame.setVisible(true); ...
8b3f2668-fe07-4de6-9659-bd869bf56673
3
public static Biome[][] dataToBiome(int[] data, int sx, int sz) { Biome[][] biomes = new Biome[sx][sz]; for (int x = 0; x < sx; x++) for (int z = 0; z < sz; z++) { int v = data[x + z * sx]; biomes[x][z] = v >= 0 ? Biome.biomeList[v] : Biome.und...
08da7384-95bc-408d-8b75-b3046de645d8
7
public static boolean isInteger(String string) { if (string == null || string.isEmpty()) { return false; } int i = 0; if (string.charAt(0) == '-') { if (string.length() > 1) { i++; } else { return false; } ...
e9072167-c01e-4e33-93cc-b3e9268be216
2
private void initTable() { for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { jTable1.setValueAt(' ', x, y); } } }
9aebc556-8bee-4be8-a76c-c186bc0651ec
4
@Override public Object execute(Object obj, Object[] args) { // 如果没有配置Cache操作,则直接执行数据访问操作 if (!cacheDefinitionCollection.needCacheOperation()) { return dataAccessExecutor.execute(obj, args); } boolean dataAccessed = false; Object retVal = null; try { CacheResult cacheResult = beforeDataAccess(args)...
a5d89ae9-1d91-446a-90ae-e4b8f96554b1
2
private static URI createUriFromName(String name) { if (name == null) { throw new NullPointerException("name"); } try { return new URI(name); } catch (final URISyntaxException e) { throw new IllegalArgumentException("Invalid name: " + name, e); ...
150b42b2-295c-4042-bc44-aef6e9896123
5
@POST @Consumes("application/json") @Path("authenticate") public AuthenticationResult authenticate( AuthenticationRequest request ) { // TODO: This is only a basic mock-like implementation. Will require something more solid for real projects. // Get the record for the given email. User foundUser = null ; ...
6e284d9b-ca67-482e-af28-be901cf84cf7
0
public PRFAlgorithmIdentifierType createPRFAlgorithmIdentifierType() { return new PRFAlgorithmIdentifierType(); }
18ca4351-440e-4df5-9bb8-cc079d651a7f
9
public String replaceAllWord(String[] arr, String content) { char conCharArry[] = content.toCharArray(); // 这里key为每个敏感词的第一个字符,里面放着第一个字符相同的敏感词list集合 Map<Character, List<String>> word = new HashMap<Character, List<String>>(); // 遍历数组生成敏感词map对象 for (String str : arr) { char key = str.charAt(0); List<Strin...
6d66fec0-8edb-4130-a992-55b10129fbbb
6
public Object clone() throws CloneNotSupportedException { Style result = (Style)super.clone(); if(result.iconStyle!=null) { result.iconStyle = (IconStyle)this.iconStyle.clone(); result.iconStyle.setParent(result); } if(result.labelStyle!=null) { result.l...
27a47367-f682-44f1-ad29-6721e64a1389
2
public boolean isBusy() { for(boolean b : this.docStates_IsBusy) if(!b) return false; return true; }
cd05cc39-a69a-4a15-9063-6286af0d0942
2
private boolean nextFile() { reportTotal = currentRegion * 3072; currentRegion++; regionX = regionZ = currentChunk = 0; regionChunks = new ArrayList<CoordXZ>(1024); trimChunks = new ArrayList<CoordXZ>(1024); // have we already handled all region files? if (currentRegion >= worldData.regionFileCount()) { ...
bd058800-6927-44a7-ab62-ffe167c7201e
0
public void registerBeing(Being b){ beings.add(b); Thread t = new Thread(b.getAI()); t.start(); //System.out.println(beings.size()); }
3797bcb6-8625-430e-8ee2-96c95cfc9461
0
protected void setFoodLevel(int foodLevel) { this.foodLevel = foodLevel; }
a8702dbe-caa5-4d41-a2d7-9270c2b044ba
3
public void setId(TId node) { if(this._id_ != null) { this._id_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
e9af5410-3db5-41a0-a81e-57c4cbf9a2b1
2
public PrivateChatTab getPrivateChatByName(String nickname) { nickname = nickname.toLowerCase(); for (PrivateChatTab chat : privateChatTabs) { if ( chat.getTabName().toLowerCase().equals(nickname) ) return chat; } return null; }
40a1d705-6d27-4efd-98fb-f1e338f5cd47
6
public static char zero(int r, int c, int f) { if (s1(r, c, f) || s2(r, c, f) || s4(r, c, f) || s5(r, c, f)) return '|'; else if (s3(r, c, f) || s6(r, c, f)) return '_'; return '.'; }
53c61c3d-224f-41bf-96b3-bce86e172f2f
4
@Override public void onKeyPress(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_W) { paddleLeft.accelUp(); paddleRight.accelDown(); } else if (e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_S) { paddleLeft....
137c9a1c-1b49-4f0f-99d5-f048f8590df0
4
private void displayJvmCostResult(List<MapperEstimatedJvmCost> eMappersMemory, List<ReducerEstimatedJvmCost> eReducersMemory) { System.out.println("-----------------------------Mapper Memory Estimation-------------------------------"); if(eMappersMemory != null) for(MapperEstimatedJvmCost jvmCost : eMappersMemor...
82d74c4f-7225-4c6d-9c44-20dfd7c64dfb
5
public static ArrayList<String> getClasses(String packageName) throws IOException, URISyntaxException{ ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL packageURL; ArrayList<String> names = new ArrayList<>(); logger.log(Level.INFO, "Read classes from: " + pa...
2dba9289-507a-45b2-9516-cc7d87790125
4
private void closeConnection() { logger.finer("Closing connection to server"); synchronized(CONNECTION_LOCK) { if(receivePacketThread != null) receivePacketThread.stopReceiving(); if(timeoutThread != null) timeoutThread.stopTimeout(); if(pingThread != null) pingThread.stopPinging(); if(socke...
10edfe5e-659f-48b4-9d6a-2e367e129f4f
4
private TreeNode rotateRight(TreeNode rotatingNode) { TreeNode rotatedTreeRootNode = rotatingNode.left; rotatedTreeRootNode.parent = rotatingNode.parent; rotatingNode.left = rotatedTreeRootNode.right; if (rotatingNode.left != null) { rotatingNode.left.parent = rotatingNode; } rotatedTreeRootNode.ri...
432b35a1-2a2a-4a30-9fe9-eb065788fdec
8
public String scanQuadrantNext(int v, int h, Direction direction) { String result = null; switch (direction) { case UP: if (v > 0) { result = scanQuadrant(v - 1, h); } break; case DOWN: if (v < 8) { result = scanQuadrant(v + 1, h); } break; case LEFT: if (h > 0) { result = sc...
87d202b2-8b75-4a7a-b2e9-4b74f69a164f
8
public void load(mainWindow window, File archivo) { FileReader fr; BufferedReader br; try { fr = new FileReader (archivo); br = new BufferedReader(fr); // Lectura del fichero String linea; while((linea = br.readLine()) != null){ System.o...
f51944ba-71c7-438c-8a34-741903d9b244
4
public boolean renameFile(File file, String newName) { // check whether the new filename is conflicting with existing ones // or not boolean result = false; if (contains(newName)) { return result; } // replace the file name in the file (physical) list ...
b0993b19-90b7-4a88-b2f4-77a45df66a06
1
private void createTable() { try { dao.checkCount(); } catch (Exception e) { dao.create(); } }
293c3abe-05b3-4bb7-b3b0-8483dc819882
5
private static void startActCalculator(String sampleDir, String sampleName, int sampleCount, int dUpperBound, int betaUpperBound, boolean all, CalculationType type) { getTrainTestSize(sampleName); List<Integer> dValues = getBetaValues(dUpperBound); List<Integer> betaValues = getBetaValues(betaUpperBound); St...
3c425ca2-6162-4af1-b5ba-13c22df65b59
4
public static void main(String[] args) throws Exception { String degreeFile = args[0]; DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(degreeFile))); int j = 0; long totIn = 0; long totOut = 0; try { while(true) { ...
1b6aa344-a0c4-4c1c-ac29-1a0fdace15e9
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
7967e993-c3bd-4b59-b268-d7f5b5a9692c
7
public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_P) { if (!pausa) { pausa = true; avion.pausa(); } else { pausa = false; avion.despausa(); } } else if (e.getKeyCode() ...
98e89b1e-9aab-4c65-95c6-79f6a349e5eb
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Diod diod = (Diod) o; if (backMaxVoltage != diod.backMaxVoltage) return false; if (directMaxCurrent != diod.directMaxCurrent) return false; ...
eada2ff9-ea42-43e0-bb87-64ad20ca0e4c
6
@Override public boolean hit(Ray ray, ShadeRec sr, FloatRef tmin) { if (bounds != null && !bounds.hit(ray)) return false; Vector3 normal = null; Vector3 worldHitPoint = null; Vector3 localHitPoint = null; float tMin = Float.MAX_VALUE; boolean hit = false;...
0502a85a-37c6-4062-b094-beb3c212b68b
6
public static <GItem extends Comparable<? super GItem>> GItem maxItem(final Iterable<? extends GItem> items) { final Iterator<? extends GItem> iterator = Iterators.iterator(items); if (!iterator.hasNext()) return null; GItem result = iterator.next(); while (iterator.hasNext()) { final GItem item = iterator.n...
8aa70843-f129-4875-aa67-dde6630671b3
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IndexedBean2 other = (IndexedBean2) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name...
46d3f286-cdcc-479b-9f52-c31caf58cc0a
9
@Override public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); TreePath currentSelection = DynamicTree.getTree().getSelectionPath(); String[] args = new String[5]; DefaultMutableTreeNode currentNode = null; if (c...
8a145d38-ca80-49e9-a4ad-d46af8407013
9
static void destroyPopupMenu(JPopupMenu pm) { if (pm == null) return; pm.setInvoker(null); Component c; AbstractButton b; for (int i = 0, n = pm.getComponentCount(); i < n; i++) { c = pm.getComponent(i); if (c instanceof AbstractButton) { b = (AbstractButton) c; b.setAction(null); ActionL...
755c7566-015b-4451-87f7-c82b08da57b4
3
@Test public void testDefault() { long begin = System.currentTimeMillis(); try { // specify the broker ip directly MessageSenderPool pool = new MessageSenderPool(Runtime.getRuntime().availableProcessors()*2+1, "test", "10.1.110.21:9092,10.1.110.22:9092,10.1.110.24:9092"); // specify ...
d417b968-5069-4d44-b984-afa3fde63fdc
8
public Pedido insertar(Pedido vo) throws ExcepcionDAO { System.out.println("PedidoDAO: insertar()"); String query = "INSERT INTO pedido (id_usuario,fecha,estado,total) VALUES (?,?,?,?)"; Connection con = null; PreparedStatement stmt = null; ResultSet rs = null; try { con = ConexionDB.obtenerConexion(); ...
e89ce87d-4cc6-4404-9650-b6d3253afd99
2
private BufferedReader fluxEntrant() { if (connecteur != null) try { return new BufferedReader(new InputStreamReader( connecteur.getInputStream())); } catch (IOException e) { System.out.println("Problème de récupérartion du flux entrant sur le serveur"); } return null; }
11b49e84-322e-4733-a005-8e618117e875
2
public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(!in.readLine().equals("")) { String classname = in.readLine(); String name = in.readLine(); String room = in.rea...
2d4d9b73-d827-44e0-abb4-47fe87570263
3
public static void main(String[] args) { for (String str : INPUT) { try { Revex revex = new Revex(str); Pattern pattern = Pattern.compile(str); System.out.println(str); for (int i = 0; i < 10; i++) { String s = revex.generate(); Matcher m = pattern.matcher(s); System.out.pr...
b9f004ec-c0af-468c-80f3-09e4477bd706
1
public boolean isFirstVertex(Point p) { return size() > 0 && vertices.get(0).equals(p); }
fa85ac08-75e7-441d-a977-d80537a13fcc
2
void drawRuler(final int width, final int posX, final int posY) { int x = posX; Color even = new Color(0x333333); Color odd = new Color(0xCCCCCC); for (int i = 0; i <= width; i += 10) { if (i % 20 == 0) { g.setColor(odd); } else { ...
4024fe2a-4af3-4760-be71-84e563845eb0
8
public void play() { state.setup(); Event e = new Event(state, null, null, null); notifyPlayers(e); notifyObservers(e); while (true) { try { advance(); if (aborted) return; if (state.gameOver()) { if (state.isDraw()) { for (Player p: players) p.draw(state); ...
921f950d-11ca-46d4-b3af-29f95a352442
0
@Basic @Column(name = "user_data") public String getUserData() { return userData; }
9dd2bb30-a368-408a-adc0-07ba74637b1d
3
public static void setPath() { //Nastavi spremenljivki v katerih je shranjen ime operacijskega sistema //in uporabniško ime uporabnika String os=System.getProperty("os.name"); String user=System.getProperty("user.name"); //Nastavi pot glede na operacijski sistem if (os.c...
2bcee531-977d-4f8e-9e39-e3ab9daeeb02
6
@EventHandler public void onBlockDamageEvent(BlockDamageEvent event){ // first make sure it is something that makes sense to break if (event.getPlayer() != null && event.getBlock() != null && event.getPlayer().getItemInHand() != null && event.getBlock().getType() != Material.BEDROCK){ // next check if the ...
405c7c25-4d31-4641-b961-f632d5d9cb23
0
private Set<Card> twoSixesTwoFoursAceKicker() { return convertToCardSet("4S,6S,6D,TS,4D,QC,AH"); }
91f126bf-c5a5-4ac3-9d0c-0825f32c95f1
7
* @return buffered image of decoded jbig2 image stream. Null if an error * occured during decode. */ private BufferedImage jbig2Decode(int width, int height, Color fill) { BufferedImage tmpImage = null; try { Class jbig2DecoderClass = Class.forName("org.jpedal.jbig2....
007f3de1-e156-40e6-8c6e-30c4a7145bbe
8
private LegacyInstr decode_3(int word1) throws InvalidInstruction { // get value of bits logical[13:15] int value = (word1) & 0x00007; switch ( value ) { case 0x00002: return decode_BRMI_0(word1); case 0x00004: return decode_BRLT_0(word1); case 0x00006: return...
cba6b7ea-0b10-40c6-b1d0-67e90ec7138b
1
private static Category CategoryObject(ResultSet rs) { Category newCategory = null; try { newCategory = new Category(rs.getInt(rs.getMetaData().getColumnName(1)), rs.getString(rs.getMetaData().getColumnName(2))); } catch (SQLException e) {...
becd2414-4570-48b0-bbad-cdfe77be1b4b
1
protected String getTag() { if (operatorId < 128) return "stmnt:" + (char)operatorId; else return "stmnt:" + operatorId; }
32670791-9866-44a0-9824-895e22134f38
5
public static void main(String[] args) throws ParseException { Session hbSession = SessionManager.openSession(); List<Car> cars; Car newCar; Long newCarId; Car carToUpdate; Car loadedUpdateCar; Car loadedCar; Car carToDelete; List<Car> freeCars; try { SimpleDateFormat sdf ...
58b7503d-174b-4767-a36a-3eec1144141d
7
public final List<T> findPath(int oldX, int oldY, int newX, int newY) { // TODO check input openList = new LinkedList<T>(); closedList = new LinkedList<T>(); openList.add(nodes[oldX][oldY]); // add starting node to open list done = false; T current; while (!done)...
7f7b0954-1249-47ae-b078-63fd59647e1b
9
public static Map<Marker, Marker> redundant(Collection<? extends Marker> markersOri) { Map<Marker, Marker> redundant = new HashMap<Marker, Marker>(); // Find which markers are redundant? ArrayList<Marker> markers = new ArrayList<Marker>(); markers.addAll(markersOri); int size = markers.size(); // Iterate ...
a568de34-7426-4fb2-bf6e-3ef06fad1d39
9
public boolean addEdge(int orig, int dest){ int nodeNumber = (adjacencyList == null) ? 0 : adjacencyList.length; if(orig > nodeNumber || dest > nodeNumber || orig < 1 || dest <1) return false; if(adjacencyList[orig-1] != null) for(int n : adjacencyList[orig-1]) if(n==dest) return false; if(adja...
f6eb187e-bfe3-4d8c-ae1f-2b303ebac1b7
0
public void setTaxable(int taxable) { this.taxable = taxable; }
3060c548-799e-478d-8525-63b2037ab9f2
4
private void checkKeys() { if (keys[0]) { leftPaddle.restrictUp(0); } if (keys[1]) { leftPaddle.restrictDown(WINDOW_DIMENSIONS[1]); } if (keys[2]) { rightPaddle.restrictUp(0); } if (keys[3]) { rightPaddle.restrictDown(WINDOW_DIMENSIONS[1]); } }
3c23dbff-3f08-40fa-854c-0423ac3770e5
2
protected static final void setNumberToTheRight(char[] chars, int number, int start, int length) { int end = start + length; while (number > 0 && length-- > 0) { chars[--end] = (char) ('0' + (number % 10)); number /= 10; } }
c585621c-d78c-470e-aac9-c06ebbebee4c
6
protected void execute() { double speed = 0; if (Robot.climberActuator.getPot() > Robot.climberActuator.getClimbSetpoint()){ speed = Robot.oi.getLeftY(); if(Robot.dumper != null){ if(Robot.dumper.getArm().getPot() > Robot.dumper.ARM_VERTICAL + 10 && !R...
e4a43323-5542-41cb-8452-b78a14f6b167
4
@Override public void mouseClicked(MouseEvent e) { if(e.getSource() == widokGlowny.lb_oGrze) { widokGlowny.widokOpisAplikacji.widokOpisAplikacjiZdarzenia.setOknoMacierzyste("OknoGlowne"); pokazOknoOpisuAplikacji(); } if(e.getSource() == widokGlowny.lb_oTworcach) { widokGlowny.widokOpisTworcow.widokO...
f630de60-be4a-44f6-b83f-ea9664c6bbfb
2
public WczytywanieDanych( String sciezka, Dane dane ) { File plik = new File( sciezka ); try { Scanner scanner = new Scanner(plik); while ( scanner.hasNext() ) { dane.dane.add( scanner.nextLine() ); } } catch ( FileNotFoundException e )...
b8fe147a-422c-4c6b-a0d7-873b03236d49
2
public static ArrayList<Descripcion> sqlSelectTodos(){ ArrayList<Descripcion> desc = new ArrayList(); if(!BD.getInstance().sqlSelect("SELECT * FROM descripcion ORDER BY iddescripcion DESC")){ return desc; } while(BD.getInstance().sqlFetch()){ desc.add(new ...
f5176636-c671-4064-a451-8e37f7909a6c
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...
ca00fbe3-fb04-43ea-89c0-91ab8cefd6d2
9
public void muteToType(LeafType newType) { checkNotGroup(); if (newType == null) { throw new IllegalArgumentException(); } if (leafType != LeafType.ABSTRACT_CLASS && leafType != LeafType.CLASS && leafType != LeafType.ENUM && leafType != LeafType.INTERFACE) { throw new IllegalArgumentException("type=" ...
6f57f5ae-53c3-44de-b021-9f870841d29d
5
public void collideFrame() { for(int i = 0;i < balls.length;i++) { if(balls[i].getX()-balls[i].getRadie() < 0) { balls[i].setSpeed(new Vektor2D(-balls[i].getSpeed().getX(),balls[i].getSpeed().getY())); balls[i].setX(balls[i].getRadie()); ...
28fb700d-704b-4c57-9886-d61a4689a9ec
8
public static double fRan(double d){ int RAN_IA = 16807; int RAN_IM = 2147483647; double RAN_AM = (1.0/RAN_IM); int RAN_IQ = 127773; int RAN_IR = 2836; int RAN_NTAB =32; int RAN_NDIV =(1+(RAN_IM-1)/RAN_NTAB); double RAN_EPS = 1.2e-7; double RAN_RNMX =(1.0-RAN_EPS); long seed = (new Random()).nextLon...
1f441af5-eb77-4d8b-b1d0-59bd571660d0
8
private boolean accept(String text){ text = text.trim(); if (text.length() == 0) return true; String newTxt; if(getText()!=null){ newTxt = (getText()!=null ? getText() : "") +text; // If the new text does not satisfy the color code characters. if (!newTxt.matches("^[#]?[a-fA-F0-9]...
6aa19ac5-3d4a-4672-9a88-07ff75a27f47
3
public int getInnerAccessFlags() { InnerClassesAttribute ica = (InnerClassesAttribute)getAttribute(InnerClassesAttribute.tag); if (ica == null) return -1; String name = getName(); int n = ica.tableLength(); for (int i = 0; i < n; ++i) if (name...
bbcb6cb1-e083-4611-b373-2f07db39e3e4
2
protected void setQueryClassForSubClauses(Class<?>queryClass) { for(Clause clause:subClauses) { clause.setQueryClass(queryClass); } }
7e2a4141-0e95-4b29-a1ea-c9f7b0f489ef
2
public void testPropertySetDayOfMonth() { DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0); DateTime copy = test.dayOfMonth().setCopy(12); assertEquals("2004-06-09T00:00:00.000+01:00", test.toString()); assertEquals("2004-06-12T00:00:00.000+01:00", copy.toString()); ...
49b21486-6cc4-4dcf-80ad-df378a96d885
5
protected Transferable createTransferable(JComponent c) { semFROM = -1; //Set some FROM that are required to find proper transferable data deptPos = DataBase.findDeptPos(DataBase.selected_Department); tableFROM = (JTable)c; rowFROM = tableFROM.getSelectedRow(); c...
e556504d-f956-43ca-b3a8-ef000733a8c9
6
public static void close(ResultSet rs,Statement ps,Connection con){ try { //关闭结果集 if (null != rs) { rs.close(); } } catch (Exception e) { } try { //关闭处理块 if (null != ps) { ps.close(); } } catch (Exception e) { } try { //关闭处理块 if (null != con) { con.close(); } ...
93008ffe-47e7-4e54-b266-d80056b14bb1
0
public void setType(String type) { this.type = type; }
a99840c7-3b31-44ba-8cab-66c5beebe510
5
public int[] randomTileArray(int maxNum) { int rg = 0; // Initialize random generated number String rs = null; //String to hold rg for comparison int rc = 0; // Initialize random count int rm = 2; // Declare and set random count max (1 pair = 2) boolean pass = false; int returnRandom = 0; ...
908a92b1-76c3-450e-8d8d-51289fc3f067
2
private void acao171() throws SemanticError{ int numeroEsperado = idMetodoChamado.getParametros().size(); if(numeroParametrosAtuais != numeroEsperado){ throw new SemanticError("Erro na quantidade de parâmetros"); } else { tipoVariavel = idMetodoChamado.getTipo(); //Gera código para ativação de método }...
6a2978f5-81f9-44c5-b072-f62dc17bd33c
4
final public CycList equivForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycObject sent = null; CycObject sent2 = null; CycList val = new CycList(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case EQUIV_CONSTANT: jj_consume_token(EQUIV_CONSTANT); ...
a1f2b791-0a3b-45ca-ba99-a925e72a7958
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 fe...
731ff47f-be5d-4d35-bfa5-a18e933a088c
4
public ShapeMasa (SimpleFeature f, String tipo) { super(f, tipo); shapeId = "MASA" + super.newShapeId(); // Para agrupar geometrias segun su codigo de masa codigoMasa = ((String) f.getAttribute("MASA")).replaceAll("[^\\p{L}\\p{N}]", "")+"-"; this.poligons = new ArrayList<LineString>(); // Masa.shp ...
a6cdbe22-31b8-44a1-9545-799dc7066406
6
public void createWorld() { generator.generateWorld(); for (int x = 0; x < CHUNK_WIDTH; x++) { for (int y = 0; y < CHUNK_HEIGHT; y++) { for (int z = 0; z < CHUNK_WIDTH; z++) { if (chunk[x][y][z] > 0) { cubes += 1; } if (chunk[x][y][z] == 1) { createMesh(x, y, z, 0.0f, 0.0f, 0.0f...
618dec62-01bc-4561-a114-a2cd9ef62131
8
private void findNbrOfAlbums() { Logger.getLogger(ReportGenerator.class.getName()).entering(ReportGenerator.class.getName(), "findNbrOfAlbums"); File[] series = baseDir.listFiles((File pathname) -> { String name = pathname.getName(); return !pathname.isHidden() && pathname.isDire...
25486bff-0785-4e59-91d4-9207bd4405fd
4
public List<File> filterFiles(String ext) { List<File> f = new ArrayList<File>(); for (String s : l) { File sf = new File(s); File parent = sf.getParentFile(); if (!parent.exists()) { throw new IllegalArgumentException("Not found: " + parent); ...
da8d53d8-8c04-4e53-86e8-eb85dbd67151
0
Xpp3Dom createNotes(final String notesValue) { return createElementWithText("notes", notesValue); }
474fdbeb-4c36-42da-891f-007cd64c5b57
1
private static double randGaussian(double var, Random rng) { double res; double y; do { res = rng.nextDouble() * (2 * 6 * var) - (2 * 3 * var); y = rng.nextDouble(); } while (G(res, var) > y); return res; }
d09a4b90-06fb-4085-b93a-33c9b3f50451
5
@Override public boolean equals(Object obj) { if(obj instanceof Log_record) { Log_record lr_obj = (Log_record)obj; if(this.GetDate().getTime() == lr_obj.GetDate().getTime()) if(this.GetSubSystem() == lr_obj.GetSubSystem()) if(this.GetType(...
2d9b4b4c-a9dc-462a-8447-09a32699e7a5
0
public Date getTimestamp() { return timestamp; }
926af10d-3a3b-4c4c-89bb-6444ca3a8a3a
5
public boolean searchMatrix(int[][] matrix, int target) { int m = matrix.length; if (m == 0){ return false; } int n = matrix[0].length; for (int i=m-1;i>=0;i--){ if(matrix[i][0]<=target){ for (int j=0;j<n;j++){ if(matrix...
2b79e0e5-1fcc-4a7c-b683-bfa20de90b95
9
@Override public void reduce(LongWritable key, Iterable<Text> values, Context context) throws IOException, InterruptedException{ Text finalResult = new Text(); StringBuffer firstlastOrderIdDate=null; StringBuffer order_id=null; StringBuffer order_date=null...
217f918a-b2f4-4778-9f8c-3c6fca4b9663
7
Phrase lemmatise() throws SQLException { Connection l = new Connection(); Statement lanceRequete; lanceRequete = l.conn.createStatement(); ResultSet liste_pneus; ResultSet lexique; Phrase finalp = new Phrase(""); String test; test = ""; for (String...
4a3f2440-2ada-40bd-81fb-a41e211e6464
8
@Override public TLValue evaluate() { TLValue value = rhs.evaluate(); if (value == TLValue.VOID) { throw new RuntimeException("can't assign VOID to " + identifier); } if (indexNodes.isEmpty()) { // a simple assignment scope.assign(identifier, value); } else { // a possible list-...