method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2675b36e-26ce-43f2-9ba6-f9851111a050
3
public String toString() { if (resolved != null) return resolved.toString(); StringBuffer buffer = new StringBuffer("{"); Iterator iter = interfaces.keySet().iterator(); while (iter.hasNext()) { buffer.append(iter.next()); buffer.append(", "); ...
a05cfd17-bcda-414d-b075-54408adf6a9e
6
protected void writeMailbox(int which, int what, int answer) throws Exception { if (which < 0 || which > 9) { return; } writeStream(String.valueOf(which)); writeStream(String.valueOf(what + 1)); if (debug) { System.out.println(name + "(d): send " + what + " on " + which); } if (!readStream().equa...
f32f31f1-da3d-49c1-9d3b-e73782d7d4bf
4
private void setNewPiece() { currentPiece=getRandomPiece(); int row=0; int col=2; int[][] pieceArray=currentPiece.getPiece(); //sets corner so piece at the top boolean breakk=false; for (int i=0;i<pieceArray.length;i++) { for (int j=0;j<pieceArray[i].length;j++) { if (pieceArray[i][j]==...
12d29533-20d9-4fb2-9e3c-f5b92f894dc6
5
public static Entity loadEntity(Level level, Tag tag) { String classname = (String) tag.findTagByName("CLASSNAME").getValue(); Entity ent = null; try { ent = (Entity) Class.forName(classname) .getConstructor(Level.class, Tag.class).newInstance(level, tag); } catch (InstantiationException | IllegalAccess...
c11198b3-595f-4a8e-b3e3-2b2e08bea3bc
0
public Build getLastCompletedBuild() { return lastCompletedBuild; }
8b9789e9-f62b-428e-b2a6-6dfec3e6ca98
6
public static final SyslogServerIF createInstance(final String protocol, final SyslogServerConfigIF config) throws SyslogRuntimeException { if (protocol == null || "".equals(protocol.trim())) { throw new SyslogRuntimeException("Instance protocol cannot be null or empty"); } if (config == null) { throw new ...
c1ea9366-8d4b-4c37-824a-99d0caaf28f9
1
public void start() { activePlayer = players[0]; if (players[0].startTurn(day)) { startTurn.emit(day, players[0]); } }
8226b401-3138-4b03-87d4-48bcacb92373
9
private void jj_add_error_token(int kind, int pos) { if (pos >= 100) return; if (pos == jj_endpos + 1) { jj_lasttokens[jj_endpos++] = kind; } else if (jj_endpos != 0) { jj_expentry = new int[jj_endpos]; for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; ...
8f85246d-0c8b-4fec-bb76-c4a36e5e814d
6
public static <E extends Comparable<E>> E kthLargest(E[] array, int k) { if (array == null || k >= array.length || k < 0) return null; MinHeap<E> minheap = new MinHeap<E>(); for (E e : array) { if (minheap.size() < k + 1) minheap.add(e); else if (e.compareTo(minheap.findMin()) > 0) { minhea...
5ba9f327-c087-49f0-aab9-f2ef50ebaef5
8
private Date GetDateAfterTimeSpan(Date date, FinanceTimeSpans timeSpan) { Calendar cal = Calendar.getInstance(); cal.setTime(date); if(timeSpan == FinanceTimeSpans.ONEDAY) cal.add(Calendar.DATE, 1); else if(timeSpan == FinanceTimeSpans.ONEMONTH) cal.add(Calendar.MONTH, 1); else if(timeS...
3980024e-e091-48de-b482-fd14c7f75d5b
1
@Override protected void logBindInfo(Method method) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功"); } }
adbd46bd-d585-42b4-b80f-9695fd792d4b
8
public ArrayList<Integer> top_features_community_percentage(ca_table t1,ca_table t2) { ArrayList<Integer> f_list_t1=new ArrayList<Integer>(); ArrayList<Integer> f_list_t2=new ArrayList<Integer>(); for(int i=0;i<t1.rows();i++) { int tmp_row_total=t1.row_total(i); for(int j=0;j<t1.columns();j++) { ...
85ecf496-fb6c-4b23-860d-4266e9d5564b
1
public String toComplexString() { if(this.b>=0) return String.format("%.3f +%.3fi", this.a, this.b); else return String.format("%.3f %.3fi", this.a, this.b); }
24d7ecfb-f1c4-4f61-83e8-af566cb572c3
8
public List<Long> getLongList(String path) { List<?> list = getList(path); if (list == null) { return new ArrayList<Long>(0); } List<Long> result = new ArrayList<Long>(); for (Object object : list) { if (object instanceof Long) { result....
b21475d9-8142-4b84-b88b-54254c998e66
8
String jvxlGetDefinitionLine(Mesh mesh) { String definitionLine = mesh.cutoff + " "; // cutoff param1 param2 param3 // | | | // when | | > 0 ==> jvxlDataIsColorMapped // when | | == -1 ==> not color mapped // when | | < -1 ==> jvxlDataIsPrecisionColor // when == -1 && == -1 ==> noncontoured plane // wh...
dbc0941b-a2d7-4fad-a804-d16df84f4521
8
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) { if(activity==CraftingActivity.LEARNING) commonEmote(mob,L("<S-NAME> fail(s) to learn how to make @x1.",bu...
78ea7ccc-3151-47c8-9754-1de9aef17a67
1
public MLibros(Libros l) { setModal(true); initComponents(); if(!(l == null)){ edtCodigo.setEnabled(false); edtCodigo.setText(l.getCodigolibro()); edtNombre.setText(l.getNombrelibro()); edtTitulo.setText(l.getTitulolibro()); edtAutor.se...
5775d040-8449-46cf-8026-3c360e96f68a
3
public void clearSocket(Object index){ Client client = this.localClients.remove(index);// 从本地连接中清除 if(client != null){ return; } client = this.clustersClients.remove(index);// 从集群连接中清除 if(client != null){ return; } client = this.clients.remove(index);// 从客户端连接中清除 if(client != null){ ret...
1b6d9b0c-d24c-4192-b18f-cd51218c932e
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...
1f8ef6d2-6a1c-44c7-987b-ac054ae3c162
5
public ListNode mergeTwoLists(ListNode l1, ListNode l2) { ListNode dummy = new ListNode(0); ListNode p = dummy; while(l1 != null && l2 != null){ if(l1.val < l2.val){ p.next = l1; l1 = l1.next; }else{ p.next = l2; ...
39889ed0-00f0-47b7-854d-c7cad5206fa6
1
@Test public void testObstacles(){ System.out.println("testObstacles: start"); Obstacles obst = new Obstacles(5, 4, 5, 4, true, 10,200); for (int i = 0; i < 200; i++) { obst.update(200, 200, 0); System.out.println(obst.centers.size()); } System.out.println("testObstacles: stop"); }
6d3315d5-1d94-4f92-b16a-b638d02914ce
0
public String getWRholder() { return WRholder; }
7ffa7e77-8eea-42b4-b2d0-1f16a3234224
4
public boolean stageOne() { this.closedNodes.add(new Node(this.currentNode.getX(), this.currentNode.getY())); // Create new Node to prevent pointing to currentNode's address this.expandCounter++; this.view.printCounter(this.expandCounter); if(this.checkerObject.getUp()==1) { // Able to move to up this....
7a73de4a-e3e2-4d5b-a251-2f89024a27a1
2
public boolean iAmSecond(){ String answer; while(true){ answer = getString(); if(answer.equals(I_AM_SECOND)) return true; } }
11272e3f-c3ad-4f3f-8cd9-3bb317ca1110
2
@Override public int addFutureMeeting(Set<Contact> contacts, Calendar date) { if(date.before(timeNow()) || !contactsExist(contacts)) { throw new IllegalArgumentException(); } else { int id = generateMeetingId(); allMeetings.add(new FutureMeetingImpl(id, date, cont...
81235948-5002-4bf4-874e-904faa85b99b
0
public static void main(String[] args) { Chess x = new Chess(); }
8dc1ddb2-6bc3-4a98-a4bc-d31c0121a121
0
private static String getHelloMsg(Neighbor from) { StringBuilder result = new StringBuilder(); result.append("From:"); result.append(Setup.ROUTER_NAME); result.append("\n"); result.append("Type:HELLO\n"); return result.toString(); }
8e4711f6-fb72-46d5-93bf-8351ec42c993
8
public static void main(String[] args) throws InterruptedException{ if(args.length > 0){ ArgCheck acheck = new ArgCheck(); acheck.Constants = mainConst; acheck.check(args); } monitor = new ThreadDelegate(mainConst); System.out.println(Constants._trials + " " + Constants._numnodes); if(!Constants.f...
d46d9038-0bef-46ef-a71e-0a13632e5c65
7
private boolean isStarterArgumentList(int kind) { return isStarterReference(kind) || kind == Token.NOT // unop || kind == Token.MINUS // maybe should add Token NEGATIVE || kind == Token.LPAREN || kind == Token.INTLITERAL |...
12b867d9-2b1c-4a8a-86d9-3ba8e3d8bd64
9
public boolean subSequenceEquals(CharSequence cs1, int offset1, CharSequence cs2, int offset2, int length) { if (offset1 + length > cs1.length() || offset2 + length > cs2.length()) { return false; } if (isCaseSensitive()) { for (int i = 0; i < length; i++) { char ch1 = cs1.charAt(offset...
1248d9a2-ac79-4f4b-a41d-b28fb1273543
3
public Type checkType(TypeMap tm) { Type t = new Type(); t.typeid = Type.TypeEnum.t_error; Type tmp = e.checkType(tm); if(tmp.OK()) { if(tmp.typeid == Type.TypeEnum.t_list) { t = tmp; } else { if(Type.isDebug) { System.out.println("TypeError! tail: "+tmp.typeid); System.o...
1e7df1cf-9d01-4794-8b1f-9422c048fe65
7
@Override public void applyTransaction(long txID) throws UnfulfillableTransactionException, InvalidTransactionStateException { Transaction tx = null; synchronized(transactions) { if (transactions.containsKey(txID)) { throw new InvalidTransactionStateException(txID); } tx = transactions.get(txID); } ...
5d8ae0f2-cb7a-43d5-9c7e-ff6e7e4012f1
4
private NetStatPackage parseSnapshot(byte header, InputStream is) throws InputMismatchException, IOException{ int length = 0; int shifts = 0; boolean cont; do { int count = (header & 0x3F) << (6*shifts++); length |= count; if(shifts > 4) { throw new InputMismatchException("A network of this size mi...
5c33d293-8567-4513-8a1c-5994ef8843c2
3
public void go_down(){ if( this.direction != Tank.direction_down) this.direction = Tank.direction_down ; else{ if(this.location_y + this.speed <= this.active_area_y - 2*this.getHeight() && ifCanWalkInThisDirection()) { this.location_y += this.speed ; ifGetProps(); } } }
ffb3cc24-1f0b-40ac-8074-92415dd41250
0
public BesieForm (ArrayList<Excel> allEx) { allex = allEx; setColoredExes(); }
c4a1af37-62f3-4936-b38c-5472bb80f895
2
@Override public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark { //Find the row. int boardPositionRow = boardPosition / columns * columns; //Find the column. int boardPositionColumn = boardPosition % columns; if (boa...
0374e9c3-c91e-4a13-ab21-feb5138a5537
2
public void add(Edge e) { String typename = e.getClass().getName(); Stack<Edge> st = null; if(typename.equals(lastStackTypeName)) { st = lastStack; } else { st = stacks.get(typename); } if(st == null) { st = new Stack<Edge>(); stacks.put(typename, st); } st.push(e); }
ee6467f2-495e-434d-87e2-3d873c28258c
6
public static void main(String[] args) { if (args.length < 3) { System.err.println( "Usage: IMAPMail <imap server hostname> <username> <password> [TLS]"); System.exit(1); } String server = args[0]; String username = args[1]; St...
d4203f9a-0cd6-44c5-b28a-7b8b0d4da359
1
public int getYAxisValue() { if (yaxis == -1) { return 127; } return getAxisValue(yaxis); }
69f5f0e2-7b2e-44a9-b9ee-c0585bdd25c4
3
public List<Item> getItemsOnPosition(Position position) { if (!validPosition(position)) throw new IllegalArgumentException("The given position isn't valid!"); List<Item> posItems = new ArrayList<Item>(); for (Element element : getElementsOnPosition(position)) { if (element instanceof Item) posItems.ad...
4347db84-3bcd-4767-859a-7478a5a7b7e3
0
public List<Film> getOsobaWypFilm(Osoba osoba) { osoba = em.find(Osoba.class, osoba.getId()); List<Film> film = new ArrayList<Film>(osoba.getFilm()); return film; }
510a38ef-5e31-4bbf-978b-f7b87601fa9b
1
public Set propagateUsage() { used = new SimpleSet(); used.addAll(getDeclarables()); StructuredBlock[] subs = getSubBlocks(); Set allUse = new SimpleSet(); allUse.addAll(used); for (int i = 0; i < subs.length; i++) { Set childUse = subs[i].propagateUsage(); /* * All variables used in more than one...
5e7c086e-a148-4a37-8d9a-063c17ad00e1
9
public void setValidationGroups(String validationGroups) { clearInitialState(); String newValidationGroups = validationGroups; // treat empty list as null if (newValidationGroups != null && newValidationGroups.matches(EMPTY_VALIDATION_GROUPS_PATTERN)) { newV...
839a5027-fb96-4d4b-9d3c-03bf519e2ce9
8
private boolean edge_adj(Edge e1,Edge e2) { if(e1.source.getId()==e2.source.getId() && e1.target.getId()==e2.target.getId()) return false; else if(e1.target.getId()==e2.source.getId() && e1.source.getId()==e2.target.getId()) return false; else if(e1.source.getId(...
e3d6ed29-2209-42b7-a987-7a8b8cc9a286
8
private Vector extractFiles(File dir) { File[] tmp = dir.listFiles(this); if ((tmp == null) || (tmp.length == 0)) { // unable to find a match String tail = ""; if (!dir.getAbsolutePath().endsWith(sep)) { tail = sep; } matches...
936c08a3-6087-45f6-8146-390aa7a76f5d
0
protected final Set<String> getList(ConfigurationSection yamlConfiguration) { return yamlConfiguration.getKeys(false); }
0f5e3db9-6dcc-49c8-b802-320083767028
8
@Override public String toString(){ StringBuilder s = new StringBuilder(); for(int i=terms.length; i>0; i--){ if(terms[(i-1)] == 0)continue; if(i!=terms.length){ if(terms[(i-1)] > 0){ s.append(" + "); } else { s.append(" - "); } } if(i-1 == 0){ s.append(numToString(Math.abs...
4c7c555e-e022-43f1-94a7-a9aaecffce04
0
public String getName() { return name; }
b245e4ab-0745-4adc-aec1-12d9e412c711
0
@Override public String getSector() { return super.getSector(); }
25a6fbc6-bec0-4667-9642-4d722fabec05
4
private double testDoublyLinkedListSearches(int[] array) { System.out.println("Testing DoublyLinkedList with " + array.length + " searches"); long[] times = new long[20]; long startTime; long endTime; for (int i = 0; i < 20; i++) { doublyLinkedList = new DoublyLinked...
25e35262-7ff9-446e-a8b4-b823157d465c
9
protected void loadFields(com.sforce.ws.parser.XmlInputStream __in, com.sforce.ws.bind.TypeMapper __typeMapper) throws java.io.IOException, com.sforce.ws.ConnectionException { super.loadFields(__in, __typeMapper); __in.peekTag(); if (__typeMapper.isElement(__in, CreatedBy__typeInfo)) { ...
bbc6e965-79bd-4470-9125-bdcc092efcc1
7
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...
4d2dee74-2adb-4ad2-9966-521f9e78e322
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Field other = (Field) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return fals...
1e032a83-c64c-47d1-a6d6-7c9bc367d302
1
public JMenuItem getMntmConectar() { if (mntmConectar == null) { mntmConectar = new JMenuItem("Conectar"); mntmConectar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { conectar(); } }); } return mntmConectar; }
8080ebe6-1a08-4d70-a808-03bd30a94796
8
public static void main(String[] args) throws Exception { bytes = new byte[200000000]; File dir = new File("./Status"); int totalTweets = 0; for (File f : dir.listFiles()) { System.out.println(f.getName()); if (f.getName().endsWith(".txt")) { long t1 = System.currentTimeMillis(); FileInputStre...
832bc23b-7d5a-4a0f-a065-413d7ed9fda4
3
public boolean remotelyEqualTo(Object other) { if (this == other || this.equals(other)) return true; return other instanceof Vector && this.floor().equals(((Vector) other).floor()); }
c6e8c9be-af64-482c-b098-9f4270dc8b99
4
public static String deleteAny(String inString, String charsToDelete) { if (!hasLength(inString) || !hasLength(charsToDelete)) { return inString; } StringBuilder sb = new StringBuilder(); for (int i = 0; i < inString.length(); i++) { char c = inString.charAt(i); if (ch...
b2fdfc3a-6101-4b0d-acd7-7828d50ff7e2
3
public static void main (String[] args) { //for(String arg : args){ // System.out.println(arg); //} for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); ...
c0c94472-6a42-4a9e-806f-d1bb534f75cd
1
@Override public void delete() throws SQLException { // also delete appointments List<Appointment> aAppt = Appointment.findByVenue(this.getId()); for(Appointment appt:aAppt) { appt.delete(); } this.deleteArray("aWaitingId"); super.delete(); }
b2af0eea-b536-4b88-85d8-78dc5642e18b
3
private String processAzotValue(String responseContent, String v, final List<Variable> contextVariables) { if(v.contains(AZOT_REPLACE)) { String azotExpr = v.substring(v.indexOf(AZOT_REPLACE) + AZOT_REPLACE.length(), v.lastIndexOf("}")); azotExpr = VariableHelper.substituteVariables(azotExpr, contextVariables);...
10a378a7-78aa-4b57-8ad7-e3910900b9ab
6
private static void setProperty(Object pt1, String propertyName, Object value) { // PropertyDescriptor pd2; // try { // pd2 = new PropertyDescriptor(propertyName, pt1.getClass()); // pd2.getWriteMethod().invoke(pt1, value); // } catch (Exception e) { // e.printStackTrace(); // } try { BeanInfo beanI...
6b7f3379-8f60-4c8e-af6a-5c24c9dc24f2
1
public static void init() { int customerIndex = 0; for (int bal=-1000; bal <= 1000; bal+=50) { BankAccount newAccount = new BankAccount(customerIds[customerIndex], BigInteger.valueOf(bal), BigInteger.valueOf(-2000)); customerIndex = (customerIndex+1)%customerIds.l...
a506117f-5b53-4645-90af-bbf54a2cd957
2
private static int countCharacters(String line, String character){ int characterCount = 0; for (int i = 0; i < line.length(); i++) { if (line.charAt(i) == character.toCharArray()[0]) characterCount++; } return characterCount; }
fd99119c-bdeb-4840-b349-716d329672b1
1
public void nouveauRapport(){ this.vue.getjTextFieldNumRapport().setText("(Nouv.)"); this.vue.getjComboBoxPraticien().setEnabled(true); this.vue.getjComboBoxPraticien().setSelectedItem(""); this.vue.getjTextFieldDateRapport().setEditable(true); this.vue.getjTextFieldDateRapport()...
89e0736e-a4c5-4e06-842a-0fe0d278fe57
9
public static void gotoSlide(int requestedID){ if(requestedID==currentSlideID) { if (Debug.engine) System.out.println("Engine -> " + "gotoSlide -> requested slide ID = currentSlideID. Request Ignored"); return; } // Nested ifs make sure to avoid null pointer exceptions by trying to // access uninstan...
3fd11eb6-f980-4f2d-8ba5-823aedc48ef7
9
private void openStackFrame(IStackFrame sf) { ClassIndex ci = SystemFacade.getInstance().getClassIndex(); ClassLocator cl = ci.getLocator(sf.location().declaringType().name()); if (cl != null) { try { ClassFile cf = SystemFacade.getInstance().getClassFile(cl); IMethod bpMethod = sf.location().method();...
51c9fb10-8864-446d-b729-f76b83d36089
7
public void logRelays(Map<RelayMap, Boolean> statusRelayValue) { HashMap<Integer, Boolean> relayMapNow = new HashMap<Integer, Boolean>(); boolean dirty = false; boolean shutdown = true; ArrayList<Temperature> temperaturesList = TemperaturesList.getInstance().list(); // Read th...
042ea7dc-37dc-47ae-8c49-b760ad0ef1ca
3
public void PrintOptions(){ for (char c:actionkeys){ if(Options.get(c) != null&&c<'q'){ System.out.print("--"+c+"-"+ "Option: "+Options.get(c).OptionName+"Tag: "+Options.get(c).RoomTag+"\n"); } } }
cf422acd-4c2e-4ed8-bfb2-1de8885d509c
8
private List<ParameterCreator<?>> extractParameterCreators(Annotation[][] annotations, Map<String, String> properties, String methodName){ List<ParameterCreator<?>> creators = new ArrayList<ParameterCreator<?>>(); for (Annotation[] annotationsOfOneParameter : annotations) { ParameterCreator<?> creator = Paramete...
0baef76d-f01f-49d9-9156-1c31ee682328
4
@Override public String getAsString(FacesContext facesContext, UIComponent component, Object object) { if (object == null || (object instanceof String && ((String) object).length() == 0)) { return null; } if (object instanceof Categoria) { Categoria o ...
75488f15-739c-4ef8-b48c-7ecac277b1fc
3
private void ordenar(){ //Cogemos el primer elemento Fechas fecha = ord.get(0); for (int i = 1; i < ord.size(); i++){ if (!fecha.compare(ord.get(i))){ //Si el elemento actual es más reciente, lo cogemos fecha = ord.get(i); } } //Cogemos el ...
8157eae3-4529-443c-969a-cfbc5a78a2e0
9
public static byte[] readChunked(InputStream inputStream) throws IOException { ByteArrayOutputStream tmpbuf = new ByteArrayOutputStream(); ByteArrayOutputStream buf = new ByteArrayOutputStream(); int ch; long bytesRead = 0; try{ //while not closed: while(true){ //read out the size. int lastCh =0;...
5ab73147-6e7f-4b1d-9331-bf5e83e7bdf1
2
public ArrayList<Ejercicio> getListaEjercicios() { ArrayList<Ejercicio> lista = new ArrayList<Ejercicio>(); Ejercicio[] listaEjercicios = eventos.listarEjercicios(); for (int i = 0; i < listaEjercicios.length; i++) if (ckbLista[i].isSelected()) lista.add(listaEjercicios[i]); return lista; }
2e9b32f4-727f-4ab3-ba7a-d01f57f82551
5
public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); if (line == null || line.equals("")) return; Post post = new Post(line); try { Document doc = Jsoup.connect(Constants.BASE_URL + post.getLink()).get(); if (doc...
e81be575-2d5a-49c6-9f01-9ed1e920d762
3
private float getPageRotation() { // Get the pages default orientation if available, if not defined // then it is zero. Object tmpRotation = library.getObject(entries, "Rotate"); if (tmpRotation != null) { pageRotation = ((Number) tmpRotation).floatValue(); // Syst...
4efdec5f-43b0-4d8a-a33b-d7ec32301af3
5
public ConfigCategory getCategory(String category) { ConfigCategory ret = categories.get(category); if (ret == null) { if (category.contains(CATEGORY_SPLITTER)) { String[] hierarchy = category.split("\\"+CATEGORY_SPLITTER); ConfigCateg...
f4546721-2f84-4d71-b7e3-598f0ed8052f
3
public final void teePanel4() { panel4 = new JPanel(); panel4.setLayout(new BorderLayout()); JPanel header = new JPanel(); JPanel sisaltoVasen = new JPanel(); JPanel sisaltoOikea = new JPanel(); // box layout header.setLayout(new BoxLayout(header, BoxLayo...
22026682-3dda-4830-8890-83fbb7c378ac
0
public double getHeight() { return height; }
93436f76-7043-4f0e-b7c4-018cf281c802
5
private void calculateGain() { // If using linear attenuation, calculate the source's gain: if( attModel == SoundSystemConfig.ATTENUATION_LINEAR ) { if( distanceFromListener <= 0 ) { gain = 1.0f; } else if( distanceFromListener ...
c4212a20-7fd0-4ccb-8bd8-de02c7d589e2
2
public static boolean isUnrestricted(Grammar grammar) { Production[] prods = grammar.getProductions(); for (int i = 0; i < prods.length; i++) if (prods[i].getLHS().length() != 1) return true; return false; }
9812a6fc-43a3-4809-9272-a7cbf65b4af7
2
public void actorDestroyedListener(GameActor actor) { //renderableActors.remove(actor.getID()); Iterator<RenderObject> it = renderableActors.iterator(); while(it.hasNext()) { RenderObject ro = it.next(); if(ro.getActor() == actor.getID()) { Application.get...
8bc3daa9-534d-4dfb-b6b7-c7c7b2787d13
9
public void updateGlassPane(){ if(Client.mo.users.get(Login.playtable.myRank).getAmount() != 0){ Login.playtable.lbActiveUser.setText("Bitte warte auf deinen Zug"); Login.playtable.lbActiveUser.setBounds(5, 50, 800, 200); } if(Client.mo.users.get(Login.playtable.myRank).getAmount() == 0 && Client.mo.nextrou...
a238c434-f1a0-465e-af0b-2b8dd9e43ee8
5
public void saveTest() { boolean test = false; if (test || m_test) { System.out.println("Saver :: saveTest() BEGIN"); } if (getClass().getSimpleName().equals("OthelloSaver")) { System.out.println(getClass().getSimpleName() + " :: saveGridTest: " ...
14a1c763-7372-4f1a-b39d-b29d2b7c1a44
4
@Override public boolean isVisibleAt(int posX, int posY) { if((posX/zoom) > originX && (posX/zoom) < (originX + width)) if((posY/zoom) > originY && (posY/zoom) < (originY + height)) return true; return false; }
90efdbab-8b55-49cb-ab17-47e50133f604
5
public boolean equals(Object object) { try { LLParseTable other = (LLParseTable) object; if (!Arrays.equals(variables, other.variables)) return false; if (!Arrays.equals(terminals, other.terminals)) return false; for (int i = 0; i < variables.length; i++) if (!Arrays.equals(entries[i], other.e...
70d8f5bd-f358-49e8-95db-7b59f2c58d6a
2
public void setLoadingStatusBorderthickness(int[] border) { if ((border == null) || (border.length != 4)) { this.loadingStatusBorderthickness = null; } else { this.loadingStatusBorderthickness = border; } somethingChanged(); }
ba04f6c7-0187-46f0-8a2e-00e5c66fa72a
7
static final BufferedPacket createBufferedPacket(GamePacket outgoingPacket, IsaacCipher isaac) { try { anInt6230++; BufferedPacket packet = Class300.getBufferedOutgoingPacket(); ((BufferedPacket) packet).sizeType = ((GamePacket) outgoingPacket).sizeType; ((BufferedPacket) packet).outgoingPacket = o...
8328a550-723f-49ec-8961-57a4eb3fd352
2
public void run() { while(Main.running) { draw(); synchronized(this) { try { wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
de06d60f-f962-4cc5-860b-2b67f3c37248
2
public void test_set_RP_int_intarray_String_Locale() { BaseDateTimeField field = new MockPreciseDateTimeField(); int[] values = new int[] {10, 20, 30, 40}; int[] expected = new int[] {10, 20, 30, 40}; int[] result = field.set(new TimeOfDay(), 2, values, "30", null); assertEquals(...
293f9c1d-629a-4aa2-b157-eb478b678a29
7
protected void drawDays() { Calendar tmpCalendar = (Calendar)model.getCal().clone(); int firstDayOfWeek = tmpCalendar.getFirstDayOfWeek(); tmpCalendar.set(Calendar.DAY_OF_MONTH, 1); int firstDay = tmpCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek; if (firstDay < 0) { firstDay += 7; } int i; for (i = ...
12e1b64a-10bd-4783-8c67-722aa3d16841
5
private void moveViewOnMousesDrag(Point p) { int dx = 0, dy = 0; int move = 10; int border = 10; boolean requireMove = false; if(p.x < border) { dx = move; requireMove = true; } if(p.x > imageSizeX - border) { dx = -move; requireMove = true; } if(p.y < border) { dy = 10; ...
3abc4cd0-b1d1-4aa8-9ea1-6364b1e2b860
3
@SuppressWarnings("incomplete-switch") public String update() { userBE.setPassword(SecurityUtils.encryptString(userBE.getPassword())); try { CrudOperation result = userSerivce.createOrUpdate(userBE); switch (result) { case CREATE: return "search?faces-redirect=true"; case UPDATE: return "view?f...
432c8389-a5f3-4579-866a-f68cee15b37a
8
public int compare(Object o1, Object o2) { final EdgeCrossing a = (EdgeCrossing)o1; final EdgeCrossing b = (EdgeCrossing)o2; if(a.getAngle() < b.getAngle()) { return -1; } if(a.getAngle() > b.getAngle()) { return 1; } // Angles are equal. ...
ac2f1b8d-1146-490b-b0ae-4eee64c7248f
6
@Override public void mouseClicked(MouseEvent e) { CreateReport cr = new CreateReport(); if(index==1){try { cr.CreatePDF(file); System.out.println("The PDF report has created successfully!"); } catch (Exception ex) {} } ...
ceb95c87-291b-4d1e-a0be-01ae5052c266
9
private void validateDate(int date, int month, int year) { // If year is divisble by four its a leap year. boolean isLeapYear = isLeapYear(year); if (year < MIN_YEAR || year > MAX_YEAR) { throw new NumberFormatException("Invalid year entered"); } if (month <= 0 || month > MONTHS.length) { throw n...
9745966d-ccbe-47d2-a416-84432974c02c
7
public static MessageHeader parseHeader(byte[] data) throws MessageHeaderParsingException { try { MessageHeader mh = new MessageHeader(); byte[] typeArray = new byte[2]; System.arraycopy(data, 0, typeArray, 0, 2); int type = Utility.twoBytesToInteger(typeArray); switch (type) { case BINDINGREQUEST: ...
963845c1-48b0-416d-a6da-7c51f001cef2
9
private void buildLawnmower() throws MowItNowException { if (CollectionUtils.isEmpty(listString)) throw new MowItNowException(BAD_LIST); // Analyse the position final String firstLine = listString.remove(0); Pattern pattern = Pattern.compile("^([0-9]+) +([0-9]+) +([NWES])$"); Matcher matcher = pattern.matc...
dab147b3-0893-476b-98a0-79e691995d89
9
@Override public PhylogenyData parse( final XmlElement element ) throws PhylogenyParserException { String unit = ""; if ( element.isHasAttribute( PhyloXmlMapping.CLADE_DATE_UNIT ) ) { unit = element.getAttribute( PhyloXmlMapping.CLADE_DATE_UNIT ); } String val = null; ...
5ffec527-8540-4969-9aa3-9f42c7d4fea9
6
private double primiera(ICard card) { if (card.getNumber() == 7) { if (Rules.existPresa(card, table.cardsOnTable())) { return 0.3; } } for (ICard tcard : table.cardsOnTable()) { // c'e' un 7 tra le carte in gioco sul tavolo if (tcard.getNumber() == 7) { List<List<ICard>> prese = Rules.getPrese...
30a01cc9-1156-432b-a3cc-304a1162a433
8
public Point generatePathTile(int[][] map, Point current) { // Decide Options int index = 0; Direction options[] = new Direction[4]; for (int i = 0; i < 4; i++) { Point p = viableTile(map, current, i); if (p == null) continue; else { options[index] = directions[i]; index++; } } // C...