text
stringlengths
14
410k
label
int32
0
9
private Node join(Node leftTree, Node rightTree) { if (leftTree == null) return rightTree; if (rightTree == null) return leftTree; if (bernoulli((double) leftTree.count / (leftTree.count + rightTree.count))) { leftTree.right = join(leftTree.right, rightTree); leftTree.count = 1 + size(leftTree.l...
3
public static List<ClanMember> getAll(String clan) throws IOException { List<ClanMember> list = new ArrayList<ClanMember>(); HttpURLConnection http = (HttpURLConnection) new URL(clanHome + clan).openConnection(); http.setConnectTimeout(15000); http.setReadTimeout(30000); BufferedReader inLines = new Buff...
7
public String getRezepteTableau(){ String out = ""; for (int i=0; i< this.getNrRezepte(); i++ ){ Recipe recipe = this.modelData.getRecipes().getRecipe().get(i); out += "<table border=\"1\" id=\"rezeptTable\" class=\"gridTable\" >\n"; out += "<tr class=\"gridTitleRow\" ><th colspan=\"5\">Rezepte "+(i+1)+"</...
7
public void setCallType(CallType callType) { this.callType = callType; }
0
public boolean login(String userID, String password) { // TODO Auto-generated method stub if (getFact.login(userID, password)) { return true; } else return false; }
1
public void customMethod() { String tmp = orgStr; System.out.println("-----------------custom--------------"); long startDate = System.currentTimeMillis(); for (int i = 0; i < 10000; i++) { while (true) { String splitStr = null; int j = tmp.indexOf(";"); if (j < 0) break; splitStr = tmp....
3
protected void noiziseOneSeq(Vector<Event> os, Vector<Event> ns){ int noiseLen=(int)(errorRate*os.size()); if(os.size()-noiseLen<0){ System.out.println("one sequence: os.size()-noiseLen<0"); return; } if(noiseLen<=1){ System.out.print...
7
public int getHeight() { return height; }
0
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...
6
public void calcFreq() { for(int i=0; i<g.getBoard().length; i++) { for(int j=0; j<g.getBoard()[0].length; j++) { for(int k=0; k<chroms.size(); k++) { chroms.get(k).checkChrom(g.getBoard()[i][j]); } ...
4
private static int[] getVector() { boolean numberBegin = false; boolean addDigit = false; boolean isDigit; int numberBeginPos = -1; int[] vector; int position = 0; char eachChar; String vector1; String temporary = ""; Scanner input; ...
9
private void dispatcher(Object message) throws UnknownHostException, IOException{ if(message instanceof ReservationRequestMessage){ ReservationRequestMessage request = (ReservationRequestMessage) message; int seat = request.getSeatReservation(); int line = seat/40; int column = seat%...
3
public void mouseClicked(MouseEvent e) { if(e.getX()>380&&e.getY()>100&&e.getX()<380+120&&e.getY()<100+40){ //Start.start(); target=new Target((WIDTH/2-GameBoard.BOARD_WIDTH/2)+Tile.WIDTH,(HEIGHT-GameBoard.BOARD_HEIGHT-100)-200); board=new GameBoard((WIDTH/2-GameBoard.BOARD_WIDTH/2),HEIGHT-GameBoard.BOARD_HEI...
4
public SegmentedImage[] track(String folderName, String headerName){ //perform tracking final File folder = new File(folderName); File[] folderFiles = folder.listFiles(); FileWrapper[] files = new FileWrapper[folderFiles.length]; SegmentedImage[] segmented = new SegmentedImage[folderFiles.length]; System.ou...
5
public String getLabelText(int pos) { if (pos < 1) pos = 1; int labelPos = 1; for (Widget i = wdg().child; i != null; i = i.next) { if (i instanceof Label) { if (labelPos == pos) { Label l = (Label) i; return l.text.text; }// pos== else { labelPos++; continue; }// else ...
4
public void addInformations(String[] code) { for (int i = 0; i < code.length; i++) addInformation(code[i]); updateSize(); notifyZElement(); }
1
protected int countNeighbours(int col, int row) { int total = 0; total = getCell(col-1, row-1) ? total + 1 : total; total = getCell( col , row-1) ? total + 1 : total; total = getCell(col+1, row-1) ? total + 1 : total; total = getCell(col-1, row ) ? total + 1 : total; total = getCell(col+1, row ) ? total +...
8
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Skills)) { return false; } Skills other = (Skills) object; if ((this.skillsid == null && other.skillsid != null...
5
public void illusion() { }
0
private static <L> State resolvePair(StatePair lr, Fst<L> left, Fst<L> rigth, final Map<StatePair, State> chart, Fst<L> intersection) { if (chart.containsKey(lr)) { return chart.get(lr); } else { boolean isInit = left.isInitial(lr.fst) && rigth.isInitial(lr.snd); boolean isAccept = left.isAccept(lr.fst)...
5
MethodsStringConverter(Class<T> cls, Method toString, Method fromString, Class<?> effectiveType) { super(cls, toString); if (Modifier.isStatic(fromString.getModifiers()) == false) { throw new IllegalStateException("FromString method must be static: " + fromString); } if (from...
8
private static boolean validateRegion(Region r, Method subCmd){ int maxHeight = -1, maxLength = -1, maxWidth = -1, minHeight = 1, minWidth = 5, minLength = 5; if(subCmd.isAnnotationPresent(SizeValidation.class...
9
private static boolean validVariable(String s) { return (s.charAt(0) == '<') && (s.charAt(s.length() - 1) == '>'); }
1
public void takeDamage(float damage) { if (basis.destroyed()) return ; if (damage < 0) I.complain("NEGATIVE DAMAGE!") ; adjustRepair(0 - damage) ; final float burnChance = damage * (1 - repairLevel()) / maxIntegrity() ; if (flammable() && Rand.num() < burnChance) burning = true ; if (integrity <...
5
private void jButton_AddAccountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_AddAccountActionPerformed String nymID = "ALL"; String assetID = "ALL"; String serverID = "ALL"; if (nymMap != null && nymMap.size() > 0 && jComboBox_Nyms.getSelectedIndex() > 0) {...
9
public void exchange (pgrid.service.corba.CorbaRoutingTable routingTable) { org.omg.CORBA.portable.InputStream $in = null; try { org.omg.CORBA.portable.OutputStream $out = _request ("exchange", true); pgrid.service.corba.CorbaRoutingTableHelper.write ($out, rout...
2
public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); Hotel hotel = new Hotel(4); boolean einde = false; int invoer; do { System.out.println("Menu: [1] Status Overzicht"); System.out.println(" [2] Check-in"); System.out.println(" [3] Check-o...
8
public static void main(String[] args) { Map<String, ArrayList<Integer>> map = new LinkedHashMap<String, ArrayList<Integer>>(); List<String> words = new LinkedList<String>(); words.addAll(new TextFile( "holding_your_objects/ex16/SetOperations.jav", "\\W+")); System.out.pr...
4
int getB(String s1, String s2) { int b = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { if (i == j) { // this situation has handled by getA. continue; } if (s1.charAt(i) == s2.charAt(j)) { // if their digit m...
4
public void go() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //InnerDrawPanel panel = new InnerDrawPanel(); MyDrawPanel panel = new MyDrawPanel(); frame.getContentPane().add(panel); frame.setSize(300, 300); frame.setVisible(true); for (int i = 0; i < ...
2
public void restartAt(int imPosn) /* * Start showing the images again, starting with image number imPosn. This * requires a resetting of the animation time as well. */ { if (numImages != 0) { if ((imPosn < 0) || (imPosn > numImages - 1)) { System.out.println("Out of range restart, starting at 0"); ...
3
private void iniciar() { fachada.criarJogo(); validadorJogarParar = fachada.gerarValidadorJogarParar(); validadorSimNao = fachada.gerarValidadorSimNao(); gerenciadorRecorde = new GerenciadorRecordeImpl(); boolean continuar = true; while (continuar) { imprimirPlacares(); String opcao = imprimirOpcoe...
9
private void writeInterface() { write( "public interface " + daoName + " { \n\n" ); write( TAB + "public int create( " + table.getDomName() ); write( " value ) throws DaoException;\n\n" ); write( TAB + "public int update( " + table.getDomName() ); write( " value ) throws DaoExcep...
3
private int partIt(int[] a,int left, int right, int pivot){ int leftPtr = left; int rightPtr = right - 1; while(true){ while(a[++leftPtr] < pivot); while(a[--rightPtr] > pivot); if(leftPtr >= rightPtr) break; else swap(a, leftPtr, rightPtr); } swap(a...
4
public int strToInt(String s) { boolean minus = false; char[] chars = s.toCharArray(); if (chars[0] == '-') { chars = ArrayUtils.subArray(chars, 1); minus = true; } else if (chars[0] == '+') { chars = ArrayUtils.subArray(chars, 1); } long result = ...
7
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof City)) { return false; } City other = (City) object; if ((this.cityID == null && other.cityID != null) || (this...
5
@Override public void setQuestAnswer(ArrayList<String> answ) { }
0
void addLine(String line) { if (curr > 0 || line != null) { if (line == null) { line = ""; } if (curr >= height && height != -1) { if (!line.isEmpty()) { write("\f" + line); curr = 0; } ...
6
@Override public void setX(double x){ for (KentallaOlija osa : osat){ osa.setX(x); } }
1
public static String[] removeEmptyStrings(String[] data) { ArrayList<String> result = new ArrayList<String>(); for (int k = 0; k < data.length; k++) if (!data[k].equals("")) result.add(data[k]); String[] res = new String[result.size()]; result.toArray(res); ...
2
public boolean isPalindrome(String s) { //if null, false if (s == null) { return false; } //if empty, ture if (s.length() == 0) { return true; } //make all in lower string in order to compare s = s.toLowerCase(); int left =...
8
public static int jauStarpv(double ra, double dec, double pmr, double pmd, double px, double rv, double pv[][]) { /* Smallest allowed parallax */ final double PXMIN = 1e-7; /* Largest allowed speed (fraction of c) */ final double VMAX = 0.5; /* Maximum...
9
public static int getMinimapTextureColor(int texture) { if (Rasterizer.averageTextureColors[texture] != 0) { return Rasterizer.averageTextureColors[texture]; } int red = 0; int green = 0; int blue = 0; int count = Rasterizer.texturePixels[texture].length; for (int i = 0; i < count; i++) { red += Ras...
3
public void doGet(HttpServletRequest request, HttpServletResponse response) { try { long id = Long.parseLong(request.getParameter("id")); PublishedSwarmDetails swarmDetails = CommunityDAO.get().getSwarmDetails(id); if( System.getProperty(EmbeddedServer.Setting.DONT_DISPLAY_PREVIEWS.getKey()) .eq...
4
public void requestUpdate(){ for(ModelChangeListener mcl : listeners){ mcl.changedStatus(serv_enabled,client_connected); mcl.changedClientIP(client_ip); mcl.changedServerIP(server_ip); mcl.changedQLFiles(quick_launch_files); mcl.changedServerName(serv_name); mcl.changedServerPswd(psw_enable); ...
1
public int read(CharBuffer cb) { if (count-- == 0) return -1; // Indicates end of input cb.append(capitals[rand.nextInt(capitals.length)]); for (int i = 0; i < 4; i++) { cb.append(vowels[rand.nextInt(vowels.length)]); cb.append(lowers[rand.nextInt(lowers.length)]); } cb.append(" "); return 10; // N...
2
protected void Update(double timeDelta) { super.Update(timeDelta); if (IsKeyTriggered(KeyEvent.VK_F1)) ToggleDebugMode(); for (PhysicsObject obj : m_physicsOnlyObjects) obj.Update(timeDelta); for (GameObject obj : m_objects) obj.Update(timeDelta); }
3
public void zoneEventOccurred(String eventZone, int eventType) { if((eventType == ZoneEvents.MOVEMENT || eventType == ZoneEvents.ENTER ) && eventZone.equals("normalMouse")){ Gui.changeCursor(Cursor.DEFAULT_CURSOR); } if(Debug.gui) System.out.println("MOUSE EVENT "+eventType); }
4
private void sort_cmp_time() { cmp_num = 0; Iterator<String> iter = cmp_timemap.keySet().iterator(); while(iter.hasNext()) { String ss = iter.next(); cmp_timekey[cmp_num] = ss; cmp_num++; } //冒泡 for(int i=0; i<cmp_num-1; i++) { for(int j=0; ...
4
public static void main (String [] args){ Logger logger = Logger.getLogger("Main"); //if args < 0, no string was introduced so program finishes. if (args.length > 0){ logger.info("Making query request..."); JSONReader jr = new JSONReader (APIURL + args[0]); String content = jr.read(); ...
3
public DeleteList(Brain brain, int cbb) { b = brain; comboBoxIndex = cbb; setBounds(100, 100, 450, 300); //getContentPane().setLayout(new BorderLayout(0, 0)); getContentPane().setLayout(null); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel); contentPanel.setLay...
7
public void SetQuery(String Query) { if (ClassQuery != null) { try { Statement = this.Connection.createStatement(); } catch(SQLException Ex) { Grizzly.WriteOut(Ex.getMessage()); } } ClassQuery = Query; }
2
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...
1
public Praticien() { }
0
@Override public void run() { String nMsg = ""; try { HttpURLConnection urlConnection = (HttpURLConnection) pageURL.openConnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); Reader r = new InputStreamReader(in); int c; String all = ""; while ((c = r.read())...
4
public void waitForNextFrame() { long waitTime = frameTime - (System.currentTimeMillis() - lastTime); if (waitTime > 0) { try { Thread.sleep(waitTime); } catch (InterruptedException ex) { Logger.getLogger(GameTimer.class.getName()).log(Level.SEVERE...
2
public void readFileIntoMemory(String fileName) throws IOException { File file = new File(fileName); BufferedReader br = new BufferedReader(new FileReader(file)); String line = br.readLine(); int curVertex = 0; int neighborVertex = 0; int edgeToNeighbor = 1; while (line != null) { String[] vertexRow =...
2
public ArrayList<ProfesorBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception { ArrayList<Integer> arrId; ArrayList<ProfesorBean> arrAlumno = new ArrayList<>(); try { oMysql.conexion(enumTipoConexion); ...
2
public boolean containsAnyASection(int min, int max) { Set<ASection> s = aDataMap.keySet(); Iterator<ASection> it = s.iterator (); boolean found = false; while(it.hasNext()){ ASection sect = it.next(); if ((sect.getStartOffset()> min && sect.getStartOffset()<= max) || (sect.getEndOffset()> min && ...
5
public static double erf(double x) { double erf = 0.0D; if (x != 0.0) { if (x == 1.0D / 0.0D) { erf = 1.0D; } else { if (x >= 0) { erf = Stat.incompleteGamma(0.5, x * x); } else { erf = -Stat.incompleteGamma(0.5, x * x); } } } return erf; }
3
private void tradeMatcher() { Thread thread = new Thread(new Runnable() { @Override public void run() { long begin = System.currentTimeMillis(); //TODO: It should not be stopped. while ((System.currentTimeMillis() - begin) < 1000){ ...
7
public static ShortImageBuffer norm(ShortImageBuffer input) { ShortImageBuffer after = input.copyShape(); // calculate min and max int min = 0xFFFF; int max = 0; for(int y=0;y<input.getHeight();y++) { for(int x=0;x<input.getWidth();x++) { ...
7
public static void asm_movf(Integer befehl, Prozessor cpu) { Integer w = cpu.getW(); Integer f = getOpcodeFromToBit(befehl, 0, 6); Integer result = cpu.getSpeicherzellenWert(f); if(getOpcodeFromToBit(befehl, 7, 7) == 1) { cpu.setSpeicherzellenWert(f, result, true); } else { cpu.setW(result, true); ...
1
public void snpEffect(String vcfFile, String txtFile, String aaHgsv, String genotype) { // Create command String argsVcf[] = { "-classic", "-cancer", "-hgvs", "testHg3766Chr1", vcfFile }; String argsTxt[] = { "-classic", "-cancer", "-cancerSamples", txtFile, "-hgvs", "testHg3766Chr1", vcfFile }; String args[] =...
6
public static void addAction(Action newAction) { newAction.setId(curActionId++); boolean offerSuccessful = actionsBuffer.offer(newAction); if(offerSuccessful && offeredListener != null) { offeredListener.actionOffered(); } }
2
private void readFile(File diffMapperFile) { try { BufferedReader reader = new BufferedReader(new FileReader(diffMapperFile)); String[] title = reader.readLine().split("\t"); String line; while((line = reader.readLine()) != null) { String[] value = line.split("\t"); for(int i = 0; i < title.le...
4
@Test public static void printMarshalMethods() throws NoSuchFieldException, IllegalAccessException { final Field field = Marshallers.class.getDeclaredField("MARSHAL_METHODS"); field.setAccessible(true); @SuppressWarnings("unchecked") final Map<?, ?> value = (Map<...
9
private boolean evaluatePlotClause(String str) { if (!model.hasEmbeddedMovie()) { out(ScriptEvent.FAILED, "No data is recorded or model not in recording mode."); return false; } byte averageFlag = 0; if (str.toLowerCase().startsWith("-ra")) { str = str.substring(3).trim(); averageFlag = 1; } else ...
7
private static int convertTimeRemaining(String time){ int seconds = 0; String[] substrings = time.split(" "); if (substrings[1].equals("hours") || substrings[1].equals("hour")){ seconds = Integer.parseInt(substrings[0]) * 3600; } if (substrings[1].equals("minutes") ||...
6
public boolean checkUserId(int uid) { for(int i=1;i<=3;i++) if( this.user_id== uid) { return true; } return false; }
2
@SuppressWarnings("unchecked") public ActionForward addToMyCart(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { int productseq = Integer.parseInt(request.getParameter("productseq")); String productname = new String(request.getParameter("pro...
8
public static void main(String[] args) { List<OfficeSpace> reserved = new ArrayList<OfficeSpace>(); String token = "abcd1234"; try { // Load initial Provider and Officespace ProviderLoad.initialLoad("./sampleData/Provider1data.txt"); ProviderLoad.initialLoad("./sampleData/Provider2data.txt"); ...
6
private synchronized void parserNode(Node node, WebPage srb) throws Exception { if (node instanceof TextNode) {// 判斷是否是文本結點 srb.addText(((TextNode) node).getText()); } else if (node instanceof Tag) {// 判斷是否是標籤庫結點 Tag atag = (Tag) node; if (atag instanceof TitleTag) {// 判斷是否是標TITLE結點 srb.setTitle(atag.g...
5
@Override public void mouseReleased(MouseEvent e) { isMouseDown = false; }
0
public void test(int down, int left, int right) { if (down == fill) { sum++; addToResult(); return; } int canNot = down | left | right; if (canNot == fill) return; for (int i = 0; i < n; i++) { int put = 1 << i; ...
4
@RequestMapping(value = "/student/{studentId}/enrolldegree", method = RequestMethod.POST) public String enrollDegree(ModelMap model, @PathVariable("studentId") int studentId, @RequestParam("degreeid") int degreeId) { logger.debug("Enrolling student " + studentId + " in degree " + degreeId); if (studentS...
1
public static int getAge2( int age0, Random aRandom) { if (age0 < 20) { return aRandom.nextInt(20); } if (age0 < 30) { return (20 + aRandom.nextInt(10)); } if (age0 < 40) { return (30 + aRandom.nextInt(10)); } ...
7
public boolean sees(Entity other) { if (distanceSquared(other) > visualRangeSquared) return false; // only check in circle with r=200 double p1X = this.xPos - other.xPos; double p1Y = this.yPos - other.yPos; double p2X = this.xPos - other.xPos + Math.cos(Math.toRadians(heading)) * 10; double p2Y = thi...
3
public static Date stoDate(String str){ Date i = null; if(str!=null){ try{ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); i = format.parse(str); new Date(); }catch(Exception e){ i = null; } }else{ i = null; } return i; }
2
public void testPeriodic() { // Updates sensors & actuators on the LiveWindow LiveWindow.run(); }
0
public void keyReleased(KeyEvent e){ int key = e.getKeyCode(); if (key == KeyEvent.VK_LEFT) { dx = 0; } if (key == KeyEvent.VK_RIGHT) { dx = 0; } if (key == KeyEvent.VK_UP) { dy = 0; } if (key == KeyEvent.VK_...
4
private static CommandLine getCommandLine(String args[]) { HelpFormatter formatter = new HelpFormatter(); Options options = getOptions(args); CommandLineParser parser = new PosixParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (ParseException e) { System.err.pr...
6
public void addButtons() { GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weightx = 1; c.weighty = 1; c.insets = new Insets(2, 2, 2, 2); int item = 0; for (int i=0;i<5; i++) { for (int j=0;j<5; j++) { if (buttons[item].equals("0")) { JButton btn; if (...
8
public String toString() { StringBuffer sb = new StringBuffer(); sb.append('['); for (int i = 0; i < pop.fieldCount(); i++) { if (pop.fieldCount() > 1) sb.append(" f"+i+":"); PopField f = pop.getField(i); if (!f.tour) { int size = f.stringSize; if (size > 50) ...
9
public void setfocus(Widget w) { if (focusctl) { if (w != focused) { Widget last = focused; focused = w; if (last != null) last.hasfocus = false; w.hasfocus = true; if (last != null) ...
7
public Object [][] getDatos(){ Object[][] data = new String[getCantidad_Cuentas ()][colum_names.length]; //realizamos la consulta sql y llenamos los datos en "Object" try{ if (colum_names.length>=0){ r_con.Connection(); String c...
5
@SuppressWarnings("unused") private static void AlphabeticalOrder(){ Scanner keyboard = new Scanner(System.in); System.out.print("What is your name? "); String input = keyboard.next(); if (input.compareTo("Carswell") <= 0) System.out.println("you don't have to wait long"); else if (input.compareTo("...
5
@Override public void run() { File plik = new File( path ); while( true ) { if( plik.canRead() ) { flaga = true; } else flaga = false; try { sleep( odstep ); } catch ( InterruptedException e ) { ret...
3
@Override public void atribuirJogo(String cod_jogo, String cod_equipa) { String[] aux = cod_jogo.split("_"); int jogo = Integer.parseInt(aux[2]); System.out.println(this.getDAOJornada().size(this.getCod_competicao())); if ((this.getDAOJornada().size(this.getCod_competicao())-1)==(Int...
9
public void generate(JFormatter f) { // generally we produce new T[x], but when T is an array type (T=T'[]) // then new T'[][x] is wrong. It has to be new T'[x][]. int arrayCount = 0; JType t = type; while( t.isArray() ) { t = t.elementType(); ...
8
public static double[] matrixMinAndMax(List<double[]> dataSet, int index, int axis){ double[] ret = new double[2]; ret[0] = Double.MAX_VALUE; ret[1] = Double.MIN_VALUE; int m = dataSet.size(); int n = dataSet.get(0).length; if(axis == 0){ for(int i=0;i<m;i++){ double val = dataSet.get(i)[index]; ...
7
public boolean setInputFormat(Instances instanceInfo) throws Exception { if ((instanceInfo.classIndex() > 0) && (!getFillWithMissing())) { throw new IllegalArgumentException("TimeSeriesDelta: Need to fill in missing values " + "using appropriate option when class inde...
7
public Sound() { Debug.println("Sound.Sound()"); muted = false; fxQueue = new LinkedList<Integer>(); AudioInputStream as = null; try { as = AudioSystem.getAudioInputStream(ROLL_SOUND); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); return; ...
9
@SuppressWarnings("unchecked") private StackInterface<Method> instantiate(SimulationComponent mComp) { String problem = ""; try { Constructor<?> m = Class.forName("CallStack").getConstructor(SimulationComponent.class); System.err.println("Call Stack instantiated... will attempt to run on VM!"); ...
8
public static void setPlatform(int plaf) { if (plaf < WINDOWS_XP || plaf > GNOME) throw new IllegalArgumentException("Unknown platform: " + plaf); CUR_PLAF = plaf; switch (plaf) { case WINDOWS_XP: setRelatedGap(LPX4, LPY4); setUnrelatedGap(LPX7, LPY9); setParagraphGap(LPX14, LPY14); setInd...
7
public void updateAccountPassword(String user, String password) { PreparedStatement statement = null; try { statement = conn.prepareStatement("update Accounts set Password=? where Username=?"); MessageDigest digest = MessageDigest.getInstance("SHA-256"); byte[] hash = digest.digest(password.getBytes("UTF-8...
5
public String toString() { StringBuffer sb = new StringBuffer(); sb.append(negative ? "N" : "n"); sb.append(overflow ? "V" : "v"); sb.append(memory_access ? "M" : "m"); sb.append(index_register ? "X" : "x"); sb.append(decimal_mode ? "D" : "d"); sb.append(irq_disable ? "I" : "i"); sb.append(z...
8
protected Transition createTransition(State from, State to, Node node, Map e2t, boolean isBlock) { /* * The boolean isBlock seems to be ignored in FSATransducer.java, so I'm ignoring * it here too. */ String label = (String) e2t.get(TRANSITION_READ_NAME); String o...
2
private static HashSet<Person> getNeighbors(Person p) { HashSet<Person> neighbors = new HashSet<Person>(); for (Person[] edge : hardConnections) { if (edge[0].equals(p)) neighbors.add(edge[1]); else if (edge[1].equals(p)) neighbors.add(edge[0]); } return neighbors; }
3
private OSMNodeData getNodeInformation(Attributes attributes) { String idStr = attributes.getValue("id"); String latStr = attributes.getValue("lat"); String lonStr = attributes.getValue("lon"); // Avoid null pointer reference! if (idStr != null && latStr != null && lonStr != null...
7