method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9f12c145-d9b0-4fff-bd59-c6429c0e587d
6
public boolean equals(Object o) { if (!(o instanceof Quaternion) ) { return false; } if (this == o) { return true; } Quaternion comp = (Quaternion) o; if (Float.compare(x,comp.x) != 0) return false; if (Float.compare(y,comp.y) != 0) retur...
de0b355c-3937-444b-a13f-d30311d11b1b
3
@Override public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { try { String url = event.getDescription(); if (url != null) { client.openInBrowser(url); } } catch(Exception e) { e.p...
7da37c1e-6585-478f-aa37-c0a7d54ebb33
7
public static void main(String[] args) throws FileNotFoundException, IOException{ Set<String> sw = StopWord.getStopWords(); List<String> dataFiles = new ArrayList<String>(); File[] files = new File("lyricsdata").listFiles(); // Detect what files to clean. for (File file : files) { if (file.isFile()) ...
9e2278bc-0bf4-4032-8688-7c7f4f9b0688
0
public void setNumberOfTransactions(BigInteger value) { this.numberOfTransactions = value; }
212ab62f-5a44-4df2-a919-03d9862f2dcc
4
public void setSelectedColor(int button, Color c) { switch (button) { case MouseEvent.BUTTON1: setLeft(c); return; case MouseEvent.BUTTON3: setRight(c); return; default: if ((button & (MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON1_DOWN_MASK)) != 0) setLeft(c); if ((button & (Mouse...
58924fd3-5d9b-413b-ad98-830b7c180642
3
public static void botMove(Field field){ boolean setRandomCell = false; while (!setRandomCell) { int randomXCoordinate = (int)(Math.random()*field.getFieldSize()); int randomYCoordinate = (int)(Math.random()*field.getFieldSize()); if(randomXCoordinate < field.getFiel...
c4cc5985-9fd9-4f74-b311-6e655a10dd33
8
public void reorderList(ListNode head) { //find mid if (head == null || head.next == null) { return; } ListNode p1 = head; ListNode p2 = head; ListNode midPre = head; while (p1.next != null && (p2.next != null && p2.next.next != null)) { p1...
4dab1fcc-507a-4591-b9f3-cc79ca81f73e
9
public void updateNPC(Player plr, stream str) { updateBlock.currentOffset = 0; str.createFrameVarSizeWord(65); str.initBitAccess(); str.writeBits(8, plr.npcListSize); int size = plr.npcListSize; plr.npcListSize = 0; for(int i = 0; i < size; i++) { if(plr.RebuildNPCList == false && plr.withinDista...
f5d0d131-2e0b-4555-b920-a10976b22e6c
3
void setItemFont () { if (!instance.startup) { tabFolder1.getItem (0).setFont (itemFont); setExampleWidgetSize(); } /* Set the font item's image to match the font of the item. */ Font ft = itemFont; if (ft == null) ft = tabFolder1.getItem (0).getFont (); TableItem item = colorAndFontTable.getItem(ITEM...
b532ea8c-5f64-4906-949b-47309ad7d145
5
* @return Returns true if the cell is a swimlane. */ public boolean isSwimlane(Object cell) { if (cell != null) { if (model.getParent(cell) != model.getRoot()) { mxCellState state = view.getState(cell); Map<String, Object> style = (state != null) ? state.getStyle() : getCellStyle(cell); ...
e56eafd4-12ce-4361-8276-2af8cbbafb45
9
public static void main(String[] args) throws SQLException{ int choice = -1; DBtask db = new DBtask();//create new database access object db.getConnection();//establish a connection BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); //while(choice < 0){ System.out.print("Please enter...
702b6b19-3f28-4673-8eea-129eec53fdca
0
public boolean marked(int v) { return marked[v]; }
53b3d773-6818-4c81-99b2-0f14353825a5
5
point call(side s, int dir, edge base, point o) throws Coordinator.KilledException { // o is at far end of base if (s.a == bottom) { // region is a singleton return null; } point c = s.a.points[1-s.ai]; if (externAngle(o, s.p, c, dir)) { // no more candi...
e12dadf3-f1d7-43bb-bfca-6584903e7ff8
3
public static Double getDouble(final Context context, final int position) { if (position < 0 || context.arguments.size() <= position) return null; if (!Parser.isDouble(context.arguments.get(position))) return null; return Double.parseDouble(context.arguments.get(position)); }
f39d3d48-14b5-4cfa-89ef-1cd0bb5eb675
8
protected static Ptg calcOct2Hex( Ptg[] operands ) { if( operands.length < 1 ) { return new PtgErr( PtgErr.ERROR_NULL ); } debugOperands( operands, "OCT2HEX" ); long l = (long) operands[0].getDoubleVal(); // avoid sci notation String oString = String.valueOf( l ).trim(); // 10 digits at most (=30 bits...
2660c632-e20e-4f66-ae2b-be68d1b6d701
8
private void calculateGridOffset(Grid grid, GridPoint centerOn) { int gridWidthPx = grid.width * this.tileSize; int gridHeightPx = grid.height * this.tileSize; if (gridWidthPx <= this.gridSpace.width && gridHeightPx <= this.gridSpace.height) { // The grid fits in the space we have with room to spare. The //...
723d4a1d-5ff7-4f34-af07-04ebe29cfa63
4
private int GetBlockLenth(String BlockText) { int nBlockLineCount = 0; try { if(("" == BlockText)||(null == BlockText)){ return 0; } BufferedReader br = new BufferedReader(new StringReader(BlockText)); while( br.readLine() != null) { nBlockLineCount++; } return nBlockLin...
768cbe65-ab6f-4933-9480-7425406f8dc2
0
public FileProtocol getProtocol() { return this.protocol; }
103aeb97-1f98-4d5b-8abb-36c816509c53
3
@Test public void test_solvable_matrix_size_3_solve() throws ImpossibleSolutionException,UnsquaredMatrixException, ElementOutOfRangeException{ int height=3; int width=3; float[] result; try{ test_matrix = new Determinant(height,w...
6be1be4b-236b-49bf-8a55-e77045fa8e22
7
static private final boolean cvc(int i) { if (i < 2 || !cons(i) || cons(i-1) || !cons(i-2)) return false; { int ch = b[i]; if (ch == 'w' || ch == 'x' || ch == 'y') return false; } return true; }
7925d6d7-eb5c-4f6e-beb8-8f03f3599735
2
public void testProperty() { DateMidnight test = new DateMidnight(); assertEquals(test.year(), test.property(DateTimeFieldType.year())); assertEquals(test.dayOfWeek(), test.property(DateTimeFieldType.dayOfWeek())); assertEquals(test.weekOfWeekyear(), test.property(DateTimeFieldType.weekO...
ac857a84-9839-4db3-bb9a-bcd943206afe
6
static int count(String s) { int t=0; for(int i=0;i<s.length();i++) { switch(s.charAt(i)) { case 'a': case 'e': case 'i': case 'o': case 'u': break; default: t++; ...
c4bbb421-7361-44e0-8a9b-badf5a36e79c
9
public CropDialog(final Panel panel) { setBounds(1, 1, 270, 190); Toolkit toolkit = getToolkit(); Dimension size = toolkit.getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan1 = new JPanel(); pan1.se...
a147e2af-537b-4408-80c3-f649f1e82a4c
7
public static boolean isInteger(String str) { if (str == null) { return false; } int length = str.length(); if (length == 0) { return false; } int i = 0; if (str.charAt(0) == '-') { if (length == 1) { return fals...
2cf69169-0e9e-4cf7-a7b3-79f417d7659f
6
public ResultSet pesquisa(String NomeProjeto, String Departamento) throws SQLException { Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; Projeto projet = null; try { conexao = BancoDadosUtil.getConnection(); com...
cf3f5427-69b3-42fb-9520-59497b2721a8
7
private void install() throws ExInstaller { //Establish a SYS connection DatabaseConnection lDatabaseConnection; try { if(!mCommandLineWrapper.hasOption(CommandLineOption.PROMOTE_USER)){ mCommandLineWrapper.overrideOption(CommandLineOption.PROMOTE_USER, "SYS"); } lDatabaseConnec...
c8c8a96a-c663-42e1-b7a8-f7197938487e
3
@Override public void doAction(String value) { switch (value) { case "DAS": this.displayAverageScore(); break; case "DAA": this.displayAverageScore(); break; case "DLL": this.displayAverageScore(); break; ...
d3e47e25-2a8b-48af-8e84-a7f0608d338e
9
public static Cons generateDescriptionsAsRule(Description head, Description tail, Proposition rule, boolean reversepolarityP) { { boolean forwardarrowP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(rule.dynamicSlots, Logic.SYM_LOGIC_FORWARD_ONLYp, Stella.FALSE_WRAPPER))).wrapperValue && (!reversepolar...
3374a134-6858-4830-b433-8d1f00ce8ace
5
static ArrayList<NoSchemaDocument> generateCustomers(int count, ArrayList<NoSchemaDocument> accounts) { ArrayList<NoSchemaDocument> customers = new ArrayList<NoSchemaDocument>(); ArrayList<NoSchemaDocument> addressesData = generateAddresses(count); for (int i=0;i<count;i++) { NoSchem...
01c952f5-218b-4a3b-a5b3-9dc035d95bff
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; ...
620c9253-4685-4fd3-93d9-b0cf6e52f7b5
0
@Before public void setUp() { l = new DoublyLinkedList(); }
582f376a-8cf1-4e31-b144-01df7277b411
3
public void loadScheme() { final String discreteModelFilePath = dlgDiscreteModel.open(); if (discreteModelFilePath != null) { Yaml yaml = new Yaml(); InputStream stream = null; try { stream = new FileInputStream(discreteModelFilePath); } ca...
41a9440c-59d7-46ee-9c3b-6518ca0dd8c0
0
public Sequence(int size) { items = new Object[size]; }
155055c2-4cdb-4008-8306-f00c0ca88688
3
protected static List<Field> getDBFields(Class<?> cls) { ArrayList<Field> r = new ArrayList<Field>(); for (Field f : cls.getFields()) { if (f.isAnnotationPresent(Column.class)) r.add(f); } return r; }
f63a7a0e-d3f7-45e2-a8b7-0995f2b9633b
7
static final void method1367(int i, int i_0_, float f, int i_1_, float[] fs, int i_2_, int i_3_, int i_4_, int i_5_, int i_6_, float[] fs_7_) { try { i_2_ -= i; anInt2409++; i_1_ -= i_3_; i_4_ -= i_5_; float f_8_ = (float) i_2_ * fs_7_[2] + (fs_7_[1] * (float) i_4_ + fs_7_[...
a4bc721e-4d18-4d41-9476-071755d01a38
6
public Header readFrame() throws BitstreamException { Header result = null; try { result = readNextFrame(); // E.B, Parse VBR (if any) first frame. if (firstframe == true) { result.parseVBR(frame_bytes); firstframe = false; } } catch (BitstreamException ex) { if ((ex.getErrorCo...
ca27fc40-61f0-41fe-be56-3432ce107a65
6
@Override public void createPlayer(Player player) { checkDataSource(); validate(player); if (player.getId() != null) { throw new IllegalArgumentException("Player already exists " + player); } try (Connection conn = dataSource.getConnection(); Prep...
bf58b4c5-4d3a-4a5a-899f-87a2f6048074
8
private Map<Integer, Double> getNeighbors(int userID, int resID) { Map<Integer, Double> neighbors = new LinkedHashMap<Integer, Double>(); //List<Map<Integer, Integer>> neighborMaps = new ArrayList<Map<Integer, Integer>>(); // get all users that have tagged the resource for (UserData data : this.trainList) { ...
ead8f431-7099-4348-adcd-a0114ac7b03d
8
public static void main(String[] args){ if (args.length != 2){ throw new RuntimeException("invalid number of arguments. Must receive two argument specifying working directory and server hostname!!!"); } workingDir = args[0].replace("\\", "/"); if (workingDir.charAt(workingDir.length() - 1) != '/') working...
5816dc17-6e3e-4114-b7ea-0ef1d6ea67bb
0
public CryptoModuleInfoType createCryptoModuleInfoType() { return new CryptoModuleInfoType(); }
0ef5bf7e-314a-4112-b8ca-9833f37d51b5
5
public static String SPARQLQuery(Model model, String queryType) { // get get all statements for a certain element if (queryType.equalsIgnoreCase("pathway")) { query = "CONSTRUCT { ?s ?p ?o } " + "WHERE { ?s a <http://vocabularies.wikipathways.org/wp#Pathway> . " + "?s ?p ?o }"; } else if (query...
b68a1118-7eb7-4de5-8f23-bfefbe7c6b00
7
String extract(String line, String key) { // System.err.println("line in extract |" + line + "|"); line = line.replace('\'', '\"'); // some sites use ' instead of " // System.err.println("line in extract after replace |" + line + "|"); try { key = key.toLowerCase(); String lower_case = line.toLowerCase(...
11589d2c-c018-46ef-aefe-f849fb174439
4
public boolean testDeplacement(Point p) { boolean estDeplacable = true; if (Math.abs(this.point.x - p.x) == 1) { if (Math.abs(this.point.y - p.y) != 2) { estDeplacable = false; } } else if (Math.abs(this.point.x - p.x) == 2) { if (Math.abs(th...
d82254e1-214a-4de2-bdde-c578e1bea82e
3
@SuppressWarnings("resource") public PatientInformation(DataSource ds) { while (true) { // Ask for health care number from user. System.out.println("Patient Information Update"); System.out.println("Enter 0 to go back."); System.out.println("Please enter the patient's Health Care No.:"); Scanner i...
4a4d9f2d-debc-4b3e-92b1-122b795a6c20
5
protected static Ptg calcTBillYield( Ptg[] operands ) { if( operands.length < 3 ) { PtgErr perr = new PtgErr( PtgErr.ERROR_NULL ); return perr; } debugOperands( operands, "calcTBILLYIELD" ); try { GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getVa...
2a5f9f47-54e2-45bc-9407-c4cc6e3ecb01
7
public static void printMonsters(ArrayList<Monster> monsters){ ArrayList<String[]> monsterNames = new ArrayList<String[]>(); for (int i = 0; i < monsters.size(); i++){ monsterNames.add(new String[]{monsters.get(i).toString(), monsters.get(i).toPluralString()}); } ArrayList<String[]> names = new Ar...
0cbd2309-4355-4f17-ae55-5248ed323387
9
public void direction() { if (untouchable > 0) { Dolphin dolphin = (Dolphin) getWorld().getObjects(Dolphin.class).get(0); if (dolphin.direction == 0) { setRotation(0); } else if (dolphin.direction == 1) { setRotation(-45); ...
dae63fb9-96f6-4af4-9750-babc84d6e81f
2
@Override public void salvar(Categoria categoria) throws LojaDLOException { if (categoria.getId() != null){ Categoria categoriaFinal = dao.obter(categoria.getId()); categoriaFinal.setNome(categoria.getNome()); categoriaFinal.setDescricao(categoria.getDescricao()); ...
58e61591-e798-476c-a857-a4d7d7f7ccb9
9
private void transfer() { String amountStr = JOptionPane.showInputDialog(this, "Input an amount to transfer:", "Transfer", JOptionPane.QUESTION_MESSAGE); if (amountStr == null) { return; } try { BigDecimal amount = FORMATTER.stringToValue(amountStr); S...
9894f031-eb8d-4d7f-909b-c4a213f05179
9
public static void updateBoundingBox(final WorldAxisAlignedBoundingBox theWorldAxisAlignedBoundingBox, final Vector3f[] myVectors) { if (myVectors == null || myVectors.length == 0) { return; } /* get minimum and maximum */ _myTempMin...
ad2fd8a1-5714-48f3-aeb0-aae952eb3a8b
2
private String getExtension(String f) { // get extension of a file String ext = ""; int i = f.lastIndexOf('.'); if (i > 0 && i < f.length() - 1) { ext = f.substring(i + 1); } return ext; }
11329f9f-5804-4cfb-82c5-20a32a77355d
8
private void reallyPlotPixel(int x, int y, boolean isBG, boolean isSpr) { int val = 0; // background color if (isBG) { val = getBGPixelIndex(x, y); } else { // When BG rendering is off, we display color index 0 // unless the PPU is currently pointing at ...
969c190f-949e-4e34-b31f-c9923e2f8798
2
public void write_activated (Pipe pipe_) { // Skip activating if we're detaching this pipe if (pipe != pipe_) { assert (terminating_pipes.contains (pipe_)); return; } if (engine != null) engine.activate_in (); }
4197a805-db6c-4413-ae1c-d58701f67d02
3
public static void main(String[] args) { if (args.length == 0) { error("Not enough arguments: 0"); } Set<String> commandList = new HashSet<>(); commandList.add("shutdown"); if (commandList.contains(args[0])) { if (send(args[0])) { System.out.println("SUCCESS!"); } else { System.out.println(...
20f636b0-e4fd-48ea-890f-2ee2e355c912
4
final public void run() { // call the hook method to notify that the server is starting serverStarted(); try { // Repeatedly waits for a new client connection, accepts it, and // starts a new thread to handle data exchange. while(!readyToStop) { try { ...
58ecaa4b-3a9a-434b-8079-4f3cec30b36c
4
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { try { UIManager .setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace();...
de75e9d3-db7c-4c28-8124-95a349466c77
5
private Object[] grabExternalVoxelData( int x, int y, int z ) { Object[] data = new Object[ 5 ]; if ( region == null ) { data[ 0 ] = null; data[ 1 ] = Math.abs( x ) % LENGTH; data[ 2 ] = Math.abs( y ) % LENGTH; data[ 3 ] = Math.abs( z ) % LENGT...
a2be1158-ae1f-4f19-8d2d-f5ec9a8aa8e6
8
public List<Movie> meetCriteria(List<RelatedVote> relatedVotes, List<Integer> voted, List<Integer> notVoted){ RelatedVote rv1 = new RelatedVote(); RelatedVote rv2 = new RelatedVote(); List<Movie> l = new ArrayList<Movie>(); if(voted.size() < 2){ //se votou apenas em um pega os dois que tiveram mais votos q...
9cdd20a6-9b23-4af4-9c3f-45c4e57d642b
5
private void createTetrominos(char name) { switch(name){ case 'A': nbVariante=2; polyominos=new int[4][1]; polyominos[0][0]=1; polyominos[1][0]=1; polyominos[2][0]=1; polyominos[3][0]=1; couleur="-8355712"; break; case 'B': nbVariante=1; polyominos=new int[2][2]; polyominos[0][0]...
06d423d9-2864-452a-80c6-8b701e12e792
2
private void calcGNI() { double GNI = 0; for (int i = 0; i < _econ.size(); i++) { GNI += _econ.get(i).get_GNI(); } for (int i = 0; i < _cities.size(); i++) { GNI += _cities.get(i).get_econ().get_GNI(); } _GNI = GNI; }
1c4fd1a3-a8e5-4902-8db5-e609a941cc98
0
private List<String> getInitUrls() { String[] s = { "http://shop67109681.taobao.com", "http://shop36505973.taobao.com", "http://shop33082137.taobao.com", "http://shop71710235.taobao.com" }; return Arrays.asList(s); }
ccf831c9-c696-4c09-afaf-201ae290bee9
8
public static int LevenshteinDistance(String s, String t) { // degenerate cases if (s == t) return 0; if (s.length() == 0) return t.length(); if (t.length() == 0) return s.length(); // create two work vectors of integer distances int[] v0 = new int[t.length() + 1]; int[] v1 = new int[t.length()...
970ef870-771a-4b52-8101-eec8ca41cadf
5
@Override public void validate() { if (platform == null) { addActionError("Please Select Platorm"); } if (location == null) { addActionError("Please Select Location"); } if (android.equals("Please select")) { addActionError("Please Sel...
f3af1982-875a-4f7f-bb74-8a5d17a63f9b
8
public static void main(String[] args) throws FileNotFoundException, IOException, Exception { Conectar("preguntas_v2.db4o"); Preguntas.BorrarTodo(bd); Preguntas.IntroducirDatos(bd); System.out.println("*********************************************************"); System.out.printl...
164fd118-db62-4da3-89b5-cbb133569b8b
9
protected void sendMessages() throws Exception { Message[] msgs=generateMessages(num_msgs); CountDownLatch latch=new CountDownLatch(1); AtomicInteger index=new AtomicInteger(0); Sender[] senders=new Sender[num_senders]; for(int i=0; i < senders.length; i++) { senders[...
d98a196d-93bf-44fd-91d8-b4af2ad3629d
1
private void updateDisplay() { int recursionDepth = spinnerModel.getNumber().intValue(); final List expansion = expander.expansionForLevel(recursionDepth); progressBar.setMaximum(expansion.size() * 2); imageDisplay.setImage(null); Image renderImage = null; final javax.swing.Timer t = new javax.swing.Timer(...
aea7ab7f-17b7-4398-bd41-4ec04afe10a1
0
public String getUsername() { return username; }
af8a1b45-c085-48df-b5dd-07f615191728
9
public RreclassificationParametre(){ this.setNomBase(ConnexionBaseDonnees.getNomBase()); this.setPort(ConnexionBaseDonnees.getPort()); this.setNomUtilisateur(ConnexionBaseDonnees.getUser()); this.setMotDePasse(ConnexionBaseDonnees.getPswd()); this.setHote(ConnexionBaseDonnees.getHote()); tableaux.clear()...
46c81ec2-4755-4dea-8feb-5e4fc6cf7ea5
0
@Test public void printWelcomeTest() throws Exception { mockMvc.perform(get("/")) .andExpect(status().isOk()) .andExpect(view().name("index")); }
7b3d1067-f699-4cb8-923e-2b3e58b466a9
5
void dfs(int v, int[] was1, int[] was2) { ++counter$0; long counterBefore = tempCounter1; if (true) { if (was2[v] == 2 || was1[v] == 1) { memCounter$1 = Math.max(tempCounter1, counterBefore); { tempCounter1 = counterBefore; return; } } was1[v] = 1; tempCounter1 = tempCounter1 + 4...
083cd446-d6d9-4836-bae4-98a57e10f7b8
3
public SubjectType getSubjectType() { if(subjectIndex==1) return FOREIGN_LANG; if(subjectIndex<9) return STANDARD; if(wahlfachType<3) { return FOREIGN_LANG; } else { return NATURAL_SCIENCE; } }
dafa9183-a78b-44d1-9e54-daf32c69f5d9
1
public void onStatStateChanged(Stat stat) { if (stat.isNormalState()) logger.info(stat.getName() + " now is in normal state: " + stat.getStoredValueAsString()); else logger.error(stat.getName() + ": " + stat.getStateDescription() + ": " + stat.getStoredValueAsString()); }
bbd3be8e-88d2-4903-92e5-292b222b0761
7
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int t = Integer.parseInt(in.readLine().trim()); for (int tt = 0; tt < t; tt++) { int n = Integer.parseInt(in.readLine().trim()); if...
fa0eb8e2-2444-4b64-8bc2-9975798213b7
6
public int getMultipleState (String name) { int k; for (k = 0; k < Left.size(); k++) { IconBarElement i = (IconBarElement)Left.elementAt(k); if (i.getName().equals(name) && i instanceof MultipleIcon) { return ((MultipleIcon)i) .getSelected(); } } for (k = 0; k < Right.size(); k++) { IconBarEle...
3963c5c9-38f2-487e-b5f0-debf0e1a2fd5
5
public static void LoadPluginAtBase(){ File base=new File("."); File[] files=base.listFiles(); String[] regex={".+\\.yml",".+\\.smp"}; for(File f:files){ for(String regexs:regex){ if(f.getName().matches(regexs)){ try { List<String>...
35170d07-6e62-4f46-a254-3cb4aee30da9
4
@Override public void init() { control = LcdBuilder.create() .prefWidth(1280) .prefHeight(400) //.styleClass(Lcd.STYLE_CLASS_GREEN_DARKGREEN) .foregroundShadowVisible(true) ...
abf71221-9480-4bec-a844-d3fcd94492a2
3
public Guid readGuid() throws IOException { final byte[] data = new byte[16]; // @todo resource this for (int i = 0; i < 16; i++) { final int currByte = read(); if (currByte == -1) { throw new RuntimeException("Illegal end of stream"); } data[i] = (byte) currByte; }...
1e15aeab-aa47-4b42-8d4c-54c698fe273a
4
public void activateEntry(String text, int pos) { int current = 0; for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof TextEntry) { current++; if (current == pos) { TextEntry te = (TextEntry) i; if (text.equals("")) te.activate(te.text); else te.activate(text...
6c8df5bb-0f6a-45c1-8828-d3b99817dcc8
7
void saveAll() { YamlConfiguration dc = new YamlConfiguration(); File sv = new File(getDataFolder(), "dragons.sav"); if (!sv.exists()) { getDataFolder().mkdirs(); try { sv.createNewFile(); } catch (IOException e) { e.printStackT...
f84b79bd-72d6-4a00-8ab5-926c2f9f6c73
4
@Override public void run() { for (Planet p : currentPlanets) { if (p.getTag().equals("[=H=]")) { restored.add(p); } } for (Planet p : oldPlanets) { if (p.getTag().equals("[=H=]")) { restored.remove(p); } ...
beee275d-5252-4db6-b0dd-27dd025a2ab9
0
public long getCompanyId() { return companyId; }
53ea6c3f-1ebf-49d9-bf93-83504fc41694
4
public boolean savePhpbbUser(String user) throws SQLException, ClassNotFoundException { sqlClass(); sqlCon(); if (!customField.isEmpty()) { query = "SELECT user_id FROM " + tablePref + "profile_fields_data WHERE pf_" + customField + "='" + user + "'"; ResultSet rs = SELECT(query); if (rs.nex...
43c9cdb6-ccb2-4211-aa99-8f0c9d0ef7b1
4
@Override public void deserialize(Buffer buf) { super.deserialize(buf); position = buf.readUByte(); if (position < 63 || position > 255) throw new RuntimeException("Forbidden value on position = " + position + ", it doesn't respect the following condition : position < 63 || posit...
90d49eec-2ec4-4b90-a71b-7bd0b2616a6a
4
@Test public void testServerClientConnectWithMessageQueue() { LOGGER.log(Level.INFO, "----- STARTING TEST testServerClientConnectWithMessageQueue -----"); String server_hash = ""; String client_hash = ""; try { server1.setUseMessageQueues(true); } catch (TimeoutEx...
3b26f2ce-736d-4968-bd91-8ffe8e3bebba
0
public float getY(float x) { return a * x * x + b * x + c; }
26c07f37-65f2-4f31-8f0c-05a5108415be
4
public void rotate() { switch(getDirection()) { case "up": setDirection("right"); break; case "right": setDirection("down"); break; case "down": setDirection("left"); break; case "left": setDirection("up"); break; default: System.out.println("rotate() is bugged");...
e7599f7f-e8ef-466f-9c52-5bba8a86f361
2
public boolean equalsExpr(final Expr other) { return (other != null) && (other instanceof ArrayLengthExpr) && ((ArrayLengthExpr) other).array.equalsExpr(array); }
049e9770-7480-403f-8074-a272740b0d9b
2
public static BufferedImage getImage(final String name, final String URL, final String format) { final File file = new File(Environment.getStorageDirectory(), name); try { if (!file.exists()) { final BufferedImage image = ImageIO.read(new java.net.URL(URL)); I...
16bc9f1c-733e-489d-ba56-dea8fa7c1f9b
8
public static double[] lsolve(double[][] A, double[] b) { int N = b.length; for (int p = 0; p < N; p++) { // find pivot row and swap int max = p; for (int i = p + 1; i < N; i++) { if (Math.abs(A[i][p]) > Math.abs(A[max][p])) { ma...
64423ef9-f662-4754-a15b-8db4400da43a
3
private boolean isUrl(String url) { String regex = "((([A-Za-z]{3,9}:(?://)?)(?:[\\-;:&=\\+\\$,\\w]+@)?[A-Za-z0-9\\.\\-]+|(?:www\\.|[\\-;:&=\\+\\$,\\w]+@)[A-Za-z0-9\\.\\-]+)((?:/[\\+~%/\\.\\w\\-_]*)?\\??(?:[\\-\\+=&;%@\\.\\w_]*)#?(?:[\\.\\!/\\\\\\w]*))?)"; if (Pattern.compile(regex).matcher(url).find()) return t...
509a4dfb-750a-46b4-b221-44b29fed86bc
9
public static void taytaLomakkeenTiedot(JPanel lomake, EnumMap<Kentta, String> kentat) { EnumMap<Kentta, String> lomakkeenSisalto = new EnumMap(Kentta.class); Component[] komponentit = lomake.getComponents(); //näihin tallenetaan kirjalomakkeen comoboxissa valittu kenttä ja comboboxin nimi, jo...
608cd266-3104-4b51-93b0-071ee78cf2a8
5
@Override public void run() { while(true){ synchronized(thread){ try { JixelGame.setPaused(false); thread.wait(); } catch (InterruptedException e) { printErr("Console thread interrupted", e); } } while (isRunning) { JixelGame.setPaused(true); if (!JixelGame.getKeyInput().i...
6715356d-f5a9-49e0-b1e7-c5d7ae854640
2
private void update(){ if(isFullScreen != SettingsModel.getFullscreen()) { if (SettingsModel.getFullscreen()){ this.fullScreen(); } else { this.windowed(); } this.setLocationRelativeTo(null); this.setVisible(true); this.isFullScreen = SettingsModel.getFullscreen(); } }
e1286634-b5aa-48bc-820f-7e5195e528be
6
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("rowset")) { if (currentAsset != null) { stack.add(currentAsset); currentAsset = null; } } if (qName.equals("row")) { currentAsset = new EveAsset<EveAsset<?>>()...
7af42c06-0b51-4c29-bf18-6c1fc208bcc2
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...
3f4007f0-f61d-45ac-84d4-a4aa8729d29b
1
public SchlangenGlied getFirstGlied() { if (previousGlied != null) { return previousGlied.getFirstGlied(); } else { return this; } }
6916b91f-371f-462e-804d-2d60baea4365
5
public void execute(){ Command commande = commandeCourante.commande; commande.execute(); //Actualisation du modèle puis de la vue. if(commande instanceof LirePlanCommand ){ zone = ((LirePlanCommand)commande).getZone(); Fenetre.getInstance().actualiserPlan...
662376f4-bf08-4eaf-b6f1-57407d8039e3
8
public static void main(String [] args) { // Skapar ett TrafficSystem // Utfor stegningen, anropar utskriftsmetoder Random randomized = new Random(); Scanner sc = new Scanner(System.in); System.out.println("The length of the car lanes will be randomized, but the user will set the range."); ...
3a8523a3-3ffa-4b4c-9345-27a5639234a2
9
public static void trimBranch(Branch branch) { // This does not normalize whitespace! // The document tree is modified in place, but no nodes are removed. if (trimmed.get(branch) != null) return; trimmed.put(branch, branch); List content = branch.content(); // trim leading whitespace // NB: ...
f18e924a-f90b-4d33-a4c5-f82da944b431
1
public String toString(){ String str = "if(" + condition.toString() + "){" + truePart.toString() + "}"; if(falsePart != null) str+="else{" + falsePart.toString() + "}"; return str; }